PageSourceSearch

https://tremdopampars.com.br/chunk-GZ4LZUL7.js

js tremdopampars.com.br collected 2026-10-04 06:00:22 UTC 448,731 bytes, 24 lines download raw bytes

1import{$ as Un,Aa as ms,Ca as Rt,Da as Yt,Fa as hs,Ga as Oi,Ja as fs,Ka as Zt,La as gs,Ma as en,Oa as Dt,R as es,S as ts,T as Ot,U as is,V as F,X as wt,Y as Si,aa as yi,b as Ja,ba as ns,c as Pe,d as Vn,ea as Ti,fa as Pi,ga as Bn,ha as Hn,ia as $n,ja as rs,la as os,ma as as,oa as ki,pa as ss,qa as jn,ra as ls,sa as cs,ta as ds,ua as us,wa as ps,ya as Ai}from"./chunk-3TL7HCJZ.js";import{$ as hi,$a as ne,$b as re,$c as pe,A as we,Ab as C,Ac as kt,B as Yi,Ba as Ua,Bc as Fn,Ca as Q,Cd as xi,Da as Kr,Dd as Ei,Eb as Qi,F as Da,Fa as Me,Hc as Ya,Ia as Ba,Ic as Qr,J as xe,Jb as Z,Jc as Le,Kb as p,L as Na,Lb as P,Mb as E,N as De,Na as Ha,Nb as Te,Oa as Yr,Pa as Fe,Qb as ot,Rb as at,Rc as Za,Sa as l,Sb as st,T as Zi,Tb as za,Ua as $a,Ub as Ci,Vb as Ji,Vc as ze,Wa as ja,Wb as X,Wc as Xa,Xa as O,Y as Ma,Yc as Jr,Zb as v,_b as _,_c as Qa,a as U,aa as Wt,ab as _i,ac as Dn,ad as ct,b as ie,ba as qr,bb as Zr,bc as ve,bd as At,cc as Wa,dc as qa,eb as x,fa as G,fc as Xr,g as zt,ga as fi,gb as Rn,gc as Nn,h as b,ha as rt,hb as Xi,ia as Y,ib as h,j as Ki,ja as ee,jb as ye,k as nt,ka as qt,kb as ge,kd as Ie,lb as Ge,ma as Kt,md as Be,n as Aa,na as Fa,nc as Ii,nd as Ln,o as Oa,oa as wn,pa as gi,q as An,qa as R,qb as s,r as zr,ra as D,rb as c,s as Wr,sa as le,sb as T,sc as lt,t as wa,ta as Ne,tb as ce,tc as Ce,u as _e,ua as La,ub as de,uc as oe,v as On,va as Pt,wb as z,wc as Mn,x as Ra,xa as Va,ya as vi,yb as Ga,yc as bi,za as Ue,zb as M,zc as Ka}from"./chunk-HKM3EISO.js";var Gn=Ln("cart"),tn=n=>n.cart,vs=Be(tn,n=>n.items.reduce((t,e)=>t+e.quantity,0)),ft=Be(Gn,n=>n.items),wi=Be(Gn,n=>n.total),Q0=Be(ft,n=>n.reduce((t,e)=>t+e.quantity,0)),J0=Be(Gn,n=>n.nrSession),ev=Be(Gn,n=>n.idCestoCompra);var zn=Ln("user"),nn=Be(zn,n=>n.user),nv=Be(zn,n=>n.loading),rv=Be(zn,n=>n.error),ov=Be(nn,n=>!!n),av=Be(zn,n=>n.token);function gc(n,t){if(n&1&&T(0,"img",30),n&2){let e=C();h("src",e.getImagemPrincipal(),Fe)("alt",e.produto.nmItem)}}function vc(n,t){n&1&&(s(0,"div",31),T(1,"i",32),c())}function _c(n,t){if(n&1&&(s(0,"p",33),p(1),c()),n&2){let e=C();l(),E(" ",e.produto.dsSubTitulo," ")}}function Cc(n,t){if(n&1&&(s(0,"div",46),p(1),c()),n&2){let e=t.$implicit;l(),P(e)}}function Ic(n,t){if(n&1){let e=z();s(0,"div",47),M("click",function(){let r=R(e).$implicit,o=C(2);return D(o.selecionarData(r))}),p(1),c()}if(n&2){let e=t.$implicit,i=C(2);ge("empty",!e)("selected",i.isDiaSelecionado(e))("today",i.isHoje(e))("disabled",e&&!i.isDiaDisponivel(e))("available",e&&i.isDiaDisponivel(e)),l(),E(" ",e==null?null:e.getDate()," ")}}function bc(n,t){if(n&1){let e=z();s(0,"div",13)(1,"div",14),T(2,"i",34),s(3,"span"),p(4,"Data do Passeio"),c()(),s(5,"div",35)(6,"div",36)(7,"button",37),M("click",function(){R(e);let r=C();return D(r.mesAnterior())}),T(8,"i",38),c(),s(9,"span",39),p(10),c(),s(11,"button",37),M("click",function(){R(e);let r=C();return D(r.proximoMes())}),T(12,"i",40),c()(),s(13,"div",41),x(14,Cc,2,1,"div",42)(15,Ic,2,11,"div",43),c(),s(16,"p",44),T(17,"i",45),p(18," Selecione a data desejada para o passeio "),c()()()}if(n&2){let e=C();l(10),P(e.getNomeMes()),l(4),h("ngForOf",e.diasSemana),l(),h("ngForOf",e.diasDoMes)}}function xc(n,t){if(n&1){let e=z();s(0,"label",48)(1,"input",49),M("change",function(){let r=R(e).$implicit,o=C();return D(o.togglePassageiro(r))}),c(),s(2,"span",50),p(3),c(),s(4,"span",51),p(5),v(6,"currency"),c()()}if(n&2){let e=t.$implicit,i=C();ge("selected",i.isPassageiroSelecionado(e)),l(),h("checked",i.isPassageiroSelecionado(e)),l(2),P(e.nome),l(2),P(re(6,5,i.getPrecoPassageiro(e),"BRL"))}}function Ec(n,t){n&1&&(s(0,"p",52),p(1," Nenhum passageiro dispon\xEDvel "),c())}var Wn=class n{constructor(t,e,i){this.dialogRef=t;this.data=e;this.productService=i;this.passageirosDisponiveis=[];this.passageirosSelecionados=[];this.dataSelecionada=null;this.horarioSelecionado=null;this.mesAtual=new Date;this.diasDoMes=[];this.diasSemana=["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"];this.mostrarCalendario=!1;this.loadingTarifario=!1;this.tarifarioCarregado=!1;this.valorPorPassageiro=0;this.idItemGatilho=null;this.nrDias=1;this.produto=e.produto,this.passageirosDisponiveis=e.passageirosDisponiveis||[],this.dataSelecionada=e.dataOrigem||null,this.horarioSelecionado=e.horarioOrigem||null,this.idItemGatilho=e.idItemGatilho||null,this.nrDias=e.nrDias||1,console.log("\u{1F550} [MODAL] Hor\xE1rio recebido do item original:",this.horarioSelecionado),console.log("\u{1F4C5} [MODAL] Data recebida do item original:",this.dataSelecionada),console.log("\u{1F5BC}\uFE0F [MODAL] Produto recebido:",this.produto),console.log("\u{1F5BC}\uFE0F [MODAL] Imagens do produto:",this.produto?.Imagens),this.mostrarCalendario=this.nrDias>=2}ngOnInit(){this.dataSelecionada&&(this.mesAtual=new Date(this.dataSelecionada)),this.gerarDiasDoMes(),setTimeout(()=>{this.carregarTarifario()})}carregarTarifario(){if(!this.idItemGatilho||!this.dataSelecionada){console.warn("Dados insuficientes para consultar tarif\xE1rio"),this.valorPorPassageiro=this.produto.vlVenda,this.tarifarioCarregado=!0;return}debugger;this.loadingTarifario=!0;let t=this.formatarDataParaApi(this.dataSelecionada),e=this.produto.idItemSistema.toString();console.log("Consultando tarif\xE1rio - idItemSistema:",this.produto.idItemSistema,"idItem:",this.produto.idItem),this.productService.getTarifarioProduto(e,this.idItemGatilho,t).subscribe({next:i=>{debugger;this.processarTarifario(i),console.log("Tarif\xE1rio carregado com sucesso:",i),this.loadingTarifario=!1,this.tarifarioCarregado=!0},error:i=>{debugger;console.error("Erro ao carregar tarif\xE1rio:",i),this.valorPorPassageiro=this.produto.vlVenda,this.loadingTarifario=!1,this.tarifarioCarregado=!0}})}processarTarifario(t){let e=t.Itens?.find(i=>i.idItem===this.produto.idItemSistema);if(!e){console.warn("Item n\xE3o encontrado no tarif\xE1rio (idItemSistema: "+this.produto.idItemSistema+"), usando valor padr\xE3o"),this.valorPorPassageiro=this.produto.vlVenda;return}if(e.flValorPorPax&&!e.flValorFaixaPax){let i=e.Pax.find(r=>r.tpPax==="adt");i&&i.vlVenda?(this.valorPorPassageiro=i.vlVenda,console.log("Pre\xE7o adulto encontrado (flValorPorPax):",this.valorPorPassageiro)):(this.valorPorPassageiro=this.produto.vlVenda,console.warn("Pre\xE7o adulto n\xE3o encontrado, usando valor padr\xE3o"))}else if(e.flValorFaixaPax){let i=e.Pax.find(r=>r.tpPax==="adt");i&&i.Valores&&i.Valores.length>0?(this.valorPorPassageiro=i.Valores[0].vlPax,console.log("Pre\xE7o adulto encontrado (flValorFaixaPax):",this.valorPorPassageiro)):(this.valorPorPassageiro=this.produto.vlVenda,console.warn("Pre\xE7o adulto n\xE3o encontrado na faixa, usando valor padr\xE3o"))}else this.valorPorPassageiro=this.produto.vlVenda,console.warn("Tipo de tarif\xE1rio desconhecido, usando valor padr\xE3o");console.log("Valor final por passageiro:",this.valorPorPassageiro)}formatarDataParaApi(t){let e=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${e}-${i}-${r}`}gerarDiasDoMes(){let t=this.mesAtual.getFullYear(),e=this.mesAtual.getMonth(),i=new Date(t,e,1),r=new Date(t,e+1,0);this.diasDoMes=[];for(let o=0;o<i.getDay();o++)this.diasDoMes.push(null);for(let o=1;o<=r.getDate();o++)this.diasDoMes.push(new Date(t,e,o))}mesAnterior(){this.mesAtual=new Date(this.mesAtual.getFullYear(),this.mesAtual.getMonth()-1,1),this.gerarDiasDoMes()}proximoMes(){this.mesAtual=new Date(this.mesAtual.getFullYear(),this.mesAtual.getMonth()+1,
11),this.gerarDiasDoMes()}isDiaSelecionado(t){return!t||!this.dataSelecionada?!1:t.toDateString()===new Date(this.dataSelecionada).toDateString()}isDiaDisponivel(t){if(!t)return!1;let e=new Date;return e.setHours(0,0,0,0),t>=e}selecionarData(t){t&&this.isDiaDisponivel(t)&&(this.dataSelecionada=t)}isHoje(t){return t?t.toDateString()===new Date().toDateString():!1}getImagemPrincipal(){if(console.log("\u{1F5BC}\uFE0F [MODAL] getImagemPrincipal chamado para:",this.produto.nmItem),console.log("\u{1F5BC}\uFE0F [MODAL] Produto completo:",this.produto),console.log("\u{1F5BC}\uFE0F [MODAL] Imagens:",this.produto.Imagens),!this.produto.Imagens||this.produto.Imagens.length===0)return console.log("\u{1F5BC}\uFE0F [MODAL] Sem imagens no produto"),"";console.log("\u{1F5BC}\uFE0F [MODAL] Detalhes de cada imagem:"),this.produto.Imagens.forEach((i,r)=>{console.log(`  [${r}]`,{idItemImagem:i.idItemImagem,idImagem:i.idImagem,flPadrao:i.flPadrao,Imagem:i.Imagem,tpImagem:i.Imagem?.tpImagem,dsPath:i.Imagem?.dsPath})});let t=this.produto.Imagens.find(i=>i.Imagem?.tpImagem?.trim().toLowerCase()==="s");console.log('\u{1F5BC}\uFE0F [MODAL] Imagem tipo "s" encontrada:',t),t||(console.log('\u{1F5BC}\uFE0F [MODAL] N\xE3o encontrou tipo "s", buscando primeira imagem dispon\xEDvel'),t=this.produto.Imagens[0],console.log("\u{1F5BC}\uFE0F [MODAL] Usando primeira imagem:",t));let e=Rt(t?.Imagem?.dsPath,"400x300");return console.log("\u{1F5BC}\uFE0F [MODAL] Caminho final da imagem:",e),e}isPassageiroSelecionado(t){return this.passageirosSelecionados.some(e=>e.nome===t.nome)}togglePassageiro(t){let e=this.passageirosSelecionados.findIndex(i=>i.nome===t.nome);e>-1?this.passageirosSelecionados.splice(e,1):this.passageirosSelecionados.push(t)}selecionarTodos(){this.passageirosSelecionados=[...this.passageirosDisponiveis]}limparSelecao(){this.passageirosSelecionados=[]}getValorTotal(){if(!this.produto.tarifarioData||!this.produto.tarifarioData.Pax)return this.valorPorPassageiro*this.passageirosSelecionados.length;if(this.produto.tarifarioData.flValorPorPax){let t=0;return this.passageirosSelecionados.forEach(e=>{let i=this.determinarTipoPax(e),r=this.produto.tarifarioData.Pax.find(o=>o.tpPax===i);r&&r.vlVenda?(t+=r.vlVenda,console.log(`Passageiro ${e.nome} (${i}): ${r.vlVenda}`)):(t+=this.valorPorPassageiro,console.warn(`Tipo de PAX n\xE3o encontrado para ${e.nome}, usando valor padr\xE3o`))}),t}return this.valorPorPassageiro*this.passageirosSelecionados.length}determinarTipoPax(t){if(t.tpParametro){if(t.tpParametro.toLowerCase().includes("adt")||t.tpParametro.toLowerCase().includes("adulto"))return"adt";if(t.tpParametro.toLowerCase().includes("chd")||t.tpParametro.toLowerCase().includes("crianca"))return"chd";if(t.tpParametro.toLowerCase().includes("colo")||t.tpParametro.toLowerCase().includes("inf"))return"colo"}if(t.nrIdadeIni!==void 0||t.nrIdadeFim!==void 0){let e=t.nrIdadeIni||0;return e<3?"colo":e>=3&&e<=12?"chd":"adt"}return"adt"}getPrecoPassageiro(t){if(!this.produto.tarifarioData||!this.produto.tarifarioData.flValorPorPax)return this.valorPorPassageiro;let e=this.determinarTipoPax(t),i=this.produto.tarifarioData.Pax.find(r=>r.tpPax===e);return i&&i.vlVenda?i.vlVenda:this.valorPorPassageiro}getNomeMes(){return this.mesAtual.toLocaleDateString("pt-BR",{month:"long",year:"numeric"})}confirmar(){if(this.passageirosSelecionados.length===0)return;let t=this.getValorTotal();console.log("\u{1F4E6} [MODAL] Confirmando adi\xE7\xE3o ao carrinho:"),console.log("  - Passageiros selecionados:",this.passageirosSelecionados.length),console.log("  - Valor total calculado:",t),console.log("  - Hor\xE1rio (do item original):",this.horarioSelecionado),console.log("  - Data:",this.dataSelecionada),console.log("  - Detalhes dos passageiros:",this.passageirosSelecionados.map(e=>({nome:e.nome,tipo:this.determinarTipoPax(e),preco:this.getPrecoPassageiro(e)}))),this.dialogRef.close({produto:this.produto,passageiros:this.passageirosSelecionados,data:this.dataSelecionada,horario:this.horarioSelecionado,valorPorPassageiro:this.valorPorPassageiro,valorTotal:t})}fechar(){this.dialogRef.close(null)}static{this.\u0275fac=function(e){return new(e||n)(O(ls),O(cs),O(xi))}}static{this.\u0275cmp=ne({type:n,selectors:[["app-exclusive-item-modal"]],standalone:!1,decls:44,vars:18,consts:[[1,"exclusive-modal-container"],[1,"modal-header"],[1,"modal-title"],["aria-label","Fechar",1,"close-btn",3,"click"],[1,"bi","bi-x-lg"],[1,"modal-content"],[1,"product-image-container"],["class","product-image",3,"src","alt",4,"ngIf"],["class","no-image",4,"ngIf"],[1,"exclusive-badge"],[1,"product-details"],["class","product-subtitle",4,"ngIf"],["class","section-block",4,"ngIf"],[1,"section-block"],[1,"section-header"],[1,"bi","bi-people-fill"],[1,"passenger-actions"],[1,"action-link",3,"click","disabled"],[1,"separator"],[1,"passengers-list"],["class","passenger-item",3,"selected",4,"ngFor","ngForOf"],["class","no-passengers",4,"ngIf"],[1,"modal-footer"],[1,"price-summary"],[1,"price-detail"],[1,"price-label"],[1,"price-calc"],[1,"total-price"],[1,"confirm-btn",3,"click","disabled"],[1,"bi","bi-cart-plus"],[1,"product-image",3,"src","alt"],[1,"no-image"],[1,"bi","bi-image"],[1,"product-subtitle"],[1,"bi","bi-calendar3"],[1,"calendar-container"],[1,"calendar-nav"],[1,"nav-btn",3,"click"],[1,"bi","bi-chevron-left"],[1,"month-name"],[1,"bi","bi-chevron-right"],[1,"calendar-grid"],["class","weekday",4,"ngFor","ngForOf"],["class","day",3,"empty","selected","today","disabled","available","click",4,"ngFor","ngForOf"],[1,"calendar-note"],[1,"bi","bi-info-circle"],[1,"weekday"],[1,"day",3,"click"],[1,"passenger-item"],["type","checkbox",1,"passenger-checkbox",3,"change","checked"],[1,"passenger-name"],[1,"passenger-price"],[1,"no-passengers"]],template:function(e,i){e&1&&(s(0,"div",0)(1,"div",1)(2,"h2",2),p(3),v(4,"contentTranslate"),c(),s(5,"button",3),M("click",function(){return i.fechar()}),T(6,"i",4),c()(),s(7,"div",5)(8,"div",6),x(9,gc,1,2,"img",7)(10,vc,2,0,"div",8),s(11,"span",9),p(12,"EXCLUSIVO"),c()(),s(13,"div",10),x(14,_c,2,1,"p",11)(15,bc,19,3,"div",12),s(16,"div",13)(17,"div",14),T(18,"i",15),s(19,"span"),p(20,"Passageiros"),c(),s(21,"div",16)(22,"button",17),M("click",function(){return i.selecionarTodos()}),p(23," Selecionar todos "),c(),s(24,"span",18),p(25,"|"),c(),s(26,"button",17),M("click",function(){return i.limparSelecao()}),p(27," Limpar "),c()()(),s(28,"div",19),x(29,xc,7,8,"label",20),c(),x(30,Ec,2,0,"p",21),c()()(),s(31,"div",22)(32,"div",23)(33,"div",24)(34,"span",25),p(35),c(),s(36,"span",26),p(37,"Total calculado por tipo de passageiro"),c()(),s(38,"div",27),p(39),v(40,"currency"),c()(),s(41,"button",28),M("click",function(){return i.confirmar()}),T(42,"i",29),p(43," Adicionar ao Carrinho "),c()()()),e&2&&(l(3),P(re(4,12,i.produto,"nmItem")),l(6),h("ngIf",i.getImagemPrincipal()),l(),h("ngIf",!i.getImagemPrincipal()),l(4),h("ngIf",i.produto.dsSubTitulo),l(),h("ngIf",i.mostrarCalendario),l(7),h("disabled",i.passageirosSelecionados.length===i.passageirosDisponiveis.length),l(4),h("disabled",i.passageirosSelecionados.length===0),l(3),h("ngForOf",i.passageirosDisponiveis),l(),h("ngIf",i.passageirosDisponiveis.length===0),l(5),E("",i.passageirosSelecionados.length," passageiro(s)"),l(4),E(" ",re(40,15,i.getValorTotal(),"BRL")," "),l(2),h("disabled",i.passageirosSelecionados.length===0))},dependencies:[Ce,oe,kt,Dt],styles:[".exclusive-modal-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;max-height:90vh;max-width:450px;width:100%;background:#fff;border-radius:16px;overflow:hidden}@media (max-width: 640px){.exclusive-modal-container[_ngcontent-%COMP%]{max-height:100vh;max-width:100vw;border-radius:0;height:100vh}}.modal-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;background:linear-gradient(135deg,#f59e0b,#d97706);color:#fff}
1.modal-header[_ngcontent-%COMP%]   .modal-title[_ngcontent-%COMP%]{font-size:1.125rem;font-weight:700;margin:0;line-height:1.3;flex:1;padding-right:12px}.modal-header[_ngcontent-%COMP%]   .close-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;background:#fff3;border-radius:50%;color:#fff;cursor:pointer;transition:all .2s ease;flex-shrink:0}.modal-header[_ngcontent-%COMP%]   .close-btn[_ngcontent-%COMP%]:hover{background:#ffffff4d;transform:scale(1.05)}.modal-header[_ngcontent-%COMP%]   .close-btn[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:1rem}.modal-content[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:0;-webkit-overflow-scrolling:touch}.product-image-container[_ngcontent-%COMP%]{position:relative;width:100%;height:200px;background:#f3f4f6}@media (max-width: 640px){.product-image-container[_ngcontent-%COMP%]{height:180px}}.product-image-container[_ngcontent-%COMP%]   .product-image[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover}.product-image-container[_ngcontent-%COMP%]   .no-image[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:#9ca3af}.product-image-container[_ngcontent-%COMP%]   .no-image[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:3rem}.product-image-container[_ngcontent-%COMP%]   .exclusive-badge[_ngcontent-%COMP%]{position:absolute;top:12px;right:12px;background:#f59e0b;color:#fff;font-size:.625rem;font-weight:700;padding:4px 10px;border-radius:20px;letter-spacing:.5px}.product-details[_ngcontent-%COMP%]{padding:20px}@media (max-width: 640px){.product-details[_ngcontent-%COMP%]{padding:16px}}.product-subtitle[_ngcontent-%COMP%]{color:#6b7280;font-size:.875rem;line-height:1.5;margin:0 0 20px}.section-block[_ngcontent-%COMP%]{margin-bottom:20px}.section-block[_ngcontent-%COMP%]:last-child{margin-bottom:0}.section-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-bottom:12px;flex-wrap:wrap}.section-header[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{color:#f59e0b;font-size:1.125rem}.section-header[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{font-weight:600;color:#374151;font-size:.9375rem}.section-header[_ngcontent-%COMP%]   .passenger-actions[_ngcontent-%COMP%]{margin-left:auto;display:flex;align-items:center;gap:8px}@media (max-width: 400px){.section-header[_ngcontent-%COMP%]   .passenger-actions[_ngcontent-%COMP%]{width:100%;margin-left:0;margin-top:8px}}.section-header[_ngcontent-%COMP%]   .passenger-actions[_ngcontent-%COMP%]   .action-link[_ngcontent-%COMP%]{background:none;border:none;color:#f59e0b;font-size:.75rem;cursor:pointer;padding:0}.section-header[_ngcontent-%COMP%]   .passenger-actions[_ngcontent-%COMP%]   .action-link[_ngcontent-%COMP%]:hover:not(:disabled){text-decoration:underline}.section-header[_ngcontent-%COMP%]   .passenger-actions[_ngcontent-%COMP%]   .action-link[_ngcontent-%COMP%]:disabled{color:#9ca3af;cursor:default}.section-header[_ngcontent-%COMP%]   .passenger-actions[_ngcontent-%COMP%]   .separator[_ng
1content-%COMP%]{color:#d1d5db;font-size:.75rem}.calendar-container[_ngcontent-%COMP%]{background:#fefce8;border-radius:12px;padding:16px;border:1px solid #fde68a}.calendar-nav[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.calendar-nav[_ngcontent-%COMP%]   .nav-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:#fff;border-radius:8px;cursor:pointer;color:#374151;transition:all .2s ease}.calendar-nav[_ngcontent-%COMP%]   .nav-btn[_ngcontent-%COMP%]:hover{background:#f59e0b;color:#fff}.calendar-nav[_ngcontent-%COMP%]   .month-name[_ngcontent-%COMP%]{font-weight:600;color:#374151;font-size:.9375rem;text-transform:capitalize}.calendar-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}.calendar-grid[_ngcontent-%COMP%]   .weekday[_ngcontent-%COMP%]{text-align:center;font-size:.6875rem;font-weight:600;color:#9ca3af;padding:4px 0}.calendar-grid[_ngcontent-%COMP%]   .day[_ngcontent-%COMP%]{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:.8125rem;border-radius:8px;color:#374151;transition:all .2s ease}.calendar-grid[_ngcontent-%COMP%]   .day.empty[_ngcontent-%COMP%]{visibility:hidden}.calendar-grid[_ngcontent-%COMP%]   .day.today[_ngcontent-%COMP%]{border:2px solid #f59e0b}.calendar-grid[_ngcontent-%COMP%]   .day.available[_ngcontent-%COMP%]{cursor:pointer;background:#fff}.calendar-grid[_ngcontent-%COMP%]   .day.available[_ngcontent-%COMP%]:hover{background:#fde68a}.calendar-grid[_ngcontent-%COMP%]   .day.selected[_ngcontent-%COMP%]{background:#f59e0b;color:#fff;font-weight:600}.calendar-grid[_ngcontent-%COMP%]   .day.selected[_ngcontent-%COMP%]:hover{background:#d97706}.calendar-grid[_ngcontent-%COMP%]   .day.disabled[_ngcontent-%COMP%]:not(.selected){color:#d1d5db;cursor:not-allowed}.time-options[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:8px}.time-option[_ngcontent-%COMP%]{padding:10px 16px;background:#f3f4f6;border:2px solid transparent;border-radius:8px;font-size:.875rem;font-weight:500;color:#374151;cursor:pointer;transition:all .2s ease}.time-option[_ngcontent-%COMP%]:hover{background:#fef3c7;border-color:#f59e0b}.time-option.selected[_ngcontent-%COMP%]{background:#f59e0b;color:#fff;border-color:#d97706}.calendar-note[_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px;margin:12px 0 0;font-size:.75rem;color:#92400e}.calendar-note[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:.875rem}.time-display[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;background:#f3f4f6;padding:12px 16px;border-radius:10px}.time-display[_ngcontent-%COMP%]   .time-value[_ngcontent-%COMP%]{font-size:1.125rem;font-weight:700;color:#374151}.time-display[_ngcontent-%COMP%]   .time-note[_ngcontent-%COMP%]{font-size:.75rem;color:#6b7280}.passengers-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px;max-height:200px;overflow-y:auto;-webkit-overflow-scrolling:touch}@media (max-width: 640px){.passengers-list[_ngcontent-%COMP%]{max-height:150px}}.passenger-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:12px;background:#f9fafb;border-radius:10px;cursor:pointer;transition:all .2s ease;border:2px solid transparent}.passenger-item[_ngcontent-%COMP%]:hover{background:#f3f4f6}.passenger-item.selected[_ngcontent-%COMP%]{background:#fef3c7;border-color:#f59e0b}.passenger-item[_ngcontent-%COMP%]   .passenger-checkbox[_ngcontent-%COMP%]{width:18px;height:18px;accent-color:#f59e0b;cursor:pointer;flex-shrink:0}.passenger-item[_ngcontent-%COMP%]   .passenger-name[_ngcontent-%COMP%]{flex:1;font-size:.875rem;color:#374151;font-weight:500}.passenger-item[_ngcontent-%COMP%]   .passenger-price[_ngcontent-%COMP%]{font-size:.8125rem;color:#6b7280;font-weight:600;flex-shrink:0}.no-passengers[_ngcontent-%COMP%]{text-align:center;color:#9ca3af;font-size:.875rem;padding:20px;margin:0}.modal-footer[_ngcontent-%COMP%]{padding:16px 20px;background:#fafafa;border-top:1px solid #e5e7eb}@media (max-width: 640px){.modal-footer[_ngcontent-%COMP%]{padding:12px 16px;padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}}.price-summary[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.price-summary[_ngcontent-%COMP%]   .price-detail[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px}.price-summary[_ngcontent-%COMP%]   .price-detail[_ngcontent-%COMP%]   .price-label[_ngcontent-%COMP%]{font-size:.8125rem;color:#6b7280}.price-summary[_ngcontent-%COMP%]   .price-detail[_ngcontent-%COMP%]   .price-calc[_ngcontent-%COMP%]{font-size:.75rem;color:#9ca3af}.price-summary[_ngcontent-%COMP%]   .total-price[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;color:#f59e0b}@media (max-width: 640px){.price-summary[_ngcontent-%COMP%]   .total-price[_ngcontent-%COMP%]{font-size:1.25rem}}.confirm-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:14px 20px;background:linear-gradient(135deg,#f59e0b,#d97706);color:#fff;border:none;border-radius:12px;font-size:1rem;font-weight:600;cursor:pointer;transition:all .3s ease}.confirm-btn[_ngcontent-%COMP%]:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 4px 12px #f59e0b66}.confirm-btn[_ngcontent-%COMP%]:active:not(:disabled){transform:translateY(0)}
1.confirm-btn[_ngcontent-%COMP%]:disabled{background:#d1d5db;cursor:not-allowed}.confirm-btn[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:1.125rem}"]})}};var Nt=class n{constructor(t,e,i){this.http=t;this.productService=e;this.sharedDataService=i;this.apiUrl=pe.EXTERNALAPIURL;this.sessionStorageKey="cart_nr_session";this.cartItemMetadataStorageKey="cart_item_metadata";this.openCartRequestMap=new Map;this.cartOperationQueue=Promise.resolve()}enqueueCartOperation(t){return new Ki(e=>{let i=this.cartOperationQueue.then(()=>Ra(t()));this.cartOperationQueue=i.then(()=>{},()=>{}),i.then(r=>{e.next(r),e.complete()},r=>e.error(r))})}getCurrentSessionId(){let t=localStorage.getItem(this.sessionStorageKey);return t?t.trim():null}clearCurrentSessionId(){localStorage.removeItem(this.sessionStorageKey),localStorage.removeItem(this.cartItemMetadataStorageKey)}getOrCreateSessionId(){let t=localStorage.getItem(this.sessionStorageKey);if(t)return t;let e=this.generateSessionId();return localStorage.setItem(this.sessionStorageKey,e),e}syncCartReferencesFromBackend(t){let e=(t?.nrSession||this.getOrCreateSessionId()).trim();return this.getOpenCartSync({nrSession:e,idCestoCompra:t?.idCestoCompra??null}).pipe(we(i=>{let r=this.extractRefs(i,e);return r.nrSession&&localStorage.setItem(this.sessionStorageKey,r.nrSession),r}),xe(()=>_e({nrSession:e,idCestoCompra:t?.idCestoCompra??null})))}refreshCartSnapshot(t){let e=t?.nrSession?.trim()||this.getCurrentSessionId(),i=t?.idCestoCompra??null;return this.getOpenCartSync({nrSession:e,idCestoCompra:i}).pipe(we(r=>{let o=this.extractRefs(r,e);return o.nrSession&&localStorage.setItem(this.sessionStorageKey,o.nrSession),{refs:o,response:r}}),xe(()=>_e({refs:{nrSession:e,idCestoCompra:i},response:null})))}rehydrateCartFromBackend(t,e){return this.refreshCartSnapshot(e).pipe(hi(({refs:i,response:r})=>{let o=this.extractBackendItems(r),a=this.mapBackendItemsToCart(o,t||[]);return this.hasItemsMissingSystemId(a)?this.productService.getAll().pipe(hi(u=>{let d=this.mapBackendItemsToCart(o,t||[],u||[]);return this.hasItemsMissingSystemId(d)?this.enrichMissingSystemIdsFromItemDetail(d):_e(d)}),we(u=>this.finalizeRehydration(u,i,r)),xe(u=>(console.warn("[FEC][cart-persistence] Falha ao enriquecer carrinho persistido com catalogo de produtos.",u),_e(this.finalizeRehydration(a,i,r))))):_e(this.finalizeRehydration(a,i,r))}))}finalizeRehydration(t,e,i){return t.forEach(r=>this.persistItemMetadata(r)),{items:t,refs:e,total:this.extractBackendTotal(i,t)}}addOrUpdateCartItem(t,e){let i=(e.nrSession||this.getOrCreateSessionId()).trim(),r={idItem:t.product?.idItem,nrSession:i,dsDetalhesPax:JSON.stringify(t.passageiros||t.product?.Book?.passengers||[]),vlTotal:t.precoComDesconto??t.subtotal??0,dtReserva:this.toDateOnly(t.product?.Book?.date),hrReserva:t.product?.Book?.timeOfDeparture||null};return e.idCestoCompra&&(r.idCestoCompra=e.idCestoCompra),this.persistItemMetadata(t),this.enqueueCartOperation(()=>this.http.post(`${this.apiUrl}/venda/AddCestoSync`,r)).pipe(we(o=>{let a=this.extractRefs(o,i);return a.nrSession&&localStorage.setItem(this.sessionStorageKey,a.nrSession),a}),xe(()=>_e({nrSession:i,idCestoCompra:e.idCestoCompra??null})))}deleteCartItem(t,e){let i=new Qr().set("id",String(t));return e&&(i=i.set("s",e)),console.log("[FEC][cart-persistence] DELETE DeleteCestoCompraItem",{idCestoCompraItem:t,nrSession:e,url:`${this.apiUrl}/CestoCompra/DeleteCestoCompraItem`,params:i.toString()}),this.enqueueCartOperation(()=>this.http.delete(`${this.apiUrl}/CestoCompra/DeleteCestoCompraItem`,{params:i})).pipe(we(()=>{}))}deleteCartItemByKey(t,e){let i=(t.nrSession||this.getOrCreateSessionId()).trim(),r=t.idCestoCompra??null;return console.log("[FEC][cart-persistence] deleteCartItemByKey start",{refs:t,normalizedNrSession:i,idCestoCompra:r,key:e}),this.getOpenCartSync({nrSession:i,idCestoCompra:r}).pipe(we(o=>this.extractMatchingCartItemIds(o,e)),hi(o=>{if(console.log("[FEC][cart-persistence] matched ids for delete",{ids:o,key:e}),!o.length)throw new Error("Nenhum item persistido do carrinho foi encontrado para remo\xE7\xE3o.");return this.removeItemMetadataByKey(e),wa(o).pipe(Na(a=>
1this.deleteCartItem(a,i)),we(()=>{}))}))}getOpenCartSync(t){let e=new Qr;t.idCestoCompra&&(e=e.set("idCestoCompra",String(t.idCestoCompra))),t.nrSession&&(e=e.set("s",t.nrSession));let i=`${t.nrSession??""}|${t.idCestoCompra??""}`,r=this.openCartRequestMap.get(i);if(r)return r;let o=this.enqueueCartOperation(()=>this.http.get(`${this.apiUrl}/CestoCompra/GetCestoCompraAbertoSync`,{params:e})).pipe(we(a=>(this.openCartRequestMap.delete(i),a)),xe(a=>{throw this.openCartRequestMap.delete(i),a}),Ma(1));return this.openCartRequestMap.set(i,o),o}extractRefs(t,e){let i=t?.CestoCompra||t?.cestoCompra||t||{},r=i?.nrSession||i?.NrSession||i?.s||e,o=i?.idCestoCompra??i?.IdCestoCompra??t?.idCestoCompra??t?.IdCestoCompra??null,a=this.toNumberOrNull(o);return{nrSession:r?String(r):null,idCestoCompra:a}}extractMatchingCartItemIds(t,e){let i=t?.CestoCompra||t?.cestoCompra||t||{},r=i?.Itens||i?.itens||t?.Itens||t?.itens||[];if(!Array.isArray(r))return[];let o=e.dtReserva||null,a=e.hrReserva||null;return r.filter(d=>{let m=Number(d?.idItem??d?.IdItem??0),I=this.toDateOnly(d?.dtReserva??d?.DtReserva??null),y=d?.hrReserva??d?.HrReserva??null;return o===null&&a===null?m===e.idItem:m===e.idItem&&I===o&&y===a}).map(d=>this.toNumberOrNull(d?.idCestoCompraItem??d?.IdCestoCompraItem??null)).filter(d=>d!==null)}extractBackendItems(t){let e=t?.CestoCompra||t?.cestoCompra||t||{},i=e?.Itens||e?.itens||t?.Itens||t?.itens||[];return Array.isArray(i)?i:[]}mapBackendItemsToCart(t,e,i=[]){return Array.isArray(t)?t.map(r=>{let o=Number(r?.idItem??r?.IdItem??0),a=this.toDateOnly(r?.dtReserva??r?.DtReserva??null),u=r?.hrReserva??r?.HrReserva??null,d=(e||[]).find(k=>k?.product?.idItem===o&&this.toDateOnly(k?.product?.Book?.date)===a&&(k?.product?.Book?.timeOfDeparture??null)===u),m=Number(r?.vlTotal??r?.VlTotal??r?.vlVenda??r?.VlVenda??d?.precoComDesconto??d?.subtotal??0),I=this.findCatalogProductForBackendItem(r,d,i),y=this.getPersistedItemMetadata({idItem:o,dtReserva:a,hrReserva:u});if(d){let k=this.resolvePersistedItemIds(r,y,d,I),g=this.normalizeHorariosItensCombo(d?.product?.Book?.horariosItensCombo)??this.normalizeHorariosItensCombo(y?.horariosItensCombo);return ie(U({},d),{idCestoCompraItem:this.toNumberOrNull(r?.idCestoCompraItem??r?.IdCestoCompraItem??null),subtotal:Number.isFinite(m)?m:d.subtotal,precoComDesconto:Number.isFinite(m)?m:d.precoComDesconto,product:ie(U(U({},I||{}),d.product),{idItem:k.idItemGestor,idItemSistema:k.idItemSistema,nmItem:r?.nmItem??r?.NmItem??d.product?.nmItem,Book:ie(U({},d.product?.Book),{idItem:k.bookIdItem,idItemGestor:k.idItemGestor,idItemSistema:k.idItemSistema,date:a??d.product?.Book?.date,timeOfDeparture:u??d.product?.Book?.timeOfDeparture??null,vlVenda:Number.isFinite(m)?m:d.product?.Book?.vlVenda,passengers:this.extractPassengers(r,d),horariosItensCombo:g??d.product?.Book?.horariosItensCombo})})})}let S=this.createPlaceholderProduct(r,Number.isFinite(m)?m:0,a,u,y,I);return{idCestoCompraItem:this.toNumberOrNull(r?.idCestoCompraItem??r?.IdCestoCompraItem??null),quantity:1,cupom:null,subtotal:Number.isFinite(m)?m:0,precoComDesconto:Number.isFinite(m)?m:0,passageiros:this.extractPassengers(r),product:S}}):e||[]}createPlaceholderProduct(t,e,i,r,o,a){let u=this.extractPassengers(t),d=this.resolvePersistedItemIds(t,o,void 0,a);return ie(U({},a||{}),{idItem:d.idItemGestor,nmItem:t?.nmItem??t?.NmItem??a?.nmItem??`Item ${t?.idItem??t?.IdItem??""}`,vlVenda:e,Imagem:null,ImagemGeral:null,ImagemLista:null,TipoItem:{},VendasItens:[],Estabelecimento:{},DetalhesItens:[],Imagens:[],ItensSugestao:null,TiposPessoa:null,ItemHorarios:[],ConfigIntegracao:null,ItensCombo:t?.ItensCombo??t?.itensCombo??a?.ItensCombo??[],CategoriasItem:null,ValoresData:a?.ValoresData??null,PacoteTrem:a?.PacoteTrem??null,flEmbarque:null,flAgendaData:!0,flAgendaHora:!0,flExigeNome:!1,flExigeDocumento:!1,flInativo:!1,idTipoItem:0,idEstabelecimento:0,dsSubTitulo:"",dsNotas:null,dsItem:"",idImagem:0,idImagemGeral:null,idImagemLista:0,nrPontos:0,idUsuario:0,dtInclusao:"",idItemSistema:d.idItemSistema,nmItemSistema:a?.nmItemSistema??null,nrLatitude:"",nrLongitude:"",vlFatorValorVenda:0,vlOldValorVenda:null,dsHorarioFuncionamento:"",dsInstrucoes:"",nrDiasValidade:null,nrOrdem:0,dsEndereco:"",flExigeNacionalidade:null,flExigeDtNascimento:null,flListaPassageiros:null,flCombo:null,flExclusivo:null,flContemExclusivo:null,tpExclusivo:null,dsIncluso:null,dsNaoIncluso:null,dsCardapio:null,Book:{idItem:d.bookIdItem,idItemGestor:d.idItemGestor,idItemSistema:d.idItemSistema,date:i??null,timeOfDeparture:r,timeOfArrival:null,passengers:u,vlVenda:e,localEmbarqueId:null,localEmbarqueNome:null,horariosItensCombo:this.normalizeHorariosItensCombo(o?.horariosItensCombo)}})}enrichMissingSystemIdsFromItemDetail(t){let e=Array.from(new Set(t.filter(i=>this.isItemMissingSystemId(i)).map(i=>Number(i.product?.idItem??0)).filter(i=>i>0)));return e.length===0?_e(t):Da(e.map(i=>this.sharedDataService.loadTour(i).pipe(we(r=>({idItemGestor:i,idItemSistema:Number(r?.idItemSistema??0)}
1)),xe(()=>_e({idItemGestor:i,idItemSistema:0}))))).pipe(we(i=>{let r=new Map(i.map(o=>[o.idItemGestor,o.idItemSistema]));return t.map(o=>{if(!this.isItemMissingSystemId(o))return o;let a=r.get(Number(o.product?.idItem??0))??0;return a<=0?o:ie(U({},o),{product:ie(U({},o.product),{idItemSistema:a,Book:ie(U({},o.product?.Book),{idItemSistema:a})})})})}),xe(i=>(console.warn("[FEC][cart-persistence] Falha ao resolver idItemSistema pelo detalhe do item.",i),_e(t))))}isItemMissingSystemId(t){let e=Number(t?.product?.idItemSistema??0);return Number(t?.product?.idItem??0)>0&&e<=0}hasItemsMissingSystemId(t){return t.some(e=>this.isItemMissingSystemId(e))}findCatalogProductForBackendItem(t,e,i){if(!Array.isArray(i)||!i.length)return null;let r=Number(t?.idItem??t?.IdItem??0),o=Number(t?.idItemSistema??t?.IdItemSistema??0),a=Number(e?.product?.idItemSistema??0);return i.find(u=>{let d=Number(u?.idItem??0),m=Number(u?.idItemSistema??0);return r>0&&d===r||o>0&&m===o||a>0&&m===a})??null}resolvePersistedItemIds(t,e,i,r){let o=this.firstPositiveNumber(t?.idItem,t?.IdItem,e?.idItemGestor,i?.product?.Book?.idItemGestor,i?.product?.idItem,r?.idItem),a=Number(i?.product?.Book?.idItem??0),u=a>0&&a!==o&&Number(i?.product?.Book?.idItemGestor??0)===o,d=this.firstPositiveNumber(t?.idItemSistema,t?.IdItemSistema,e?.idItemSistema,i?.product?.idItemSistema,i?.product?.Book?.idItemSistema,u?a:0,r?.idItemSistema),m=this.firstPositiveNumber(e?.bookIdItem,i?.product?.ValoresData?.IdItem,i?.product?.ValoresData?.idItem,u?a:0,d,o);return{idItemGestor:o,idItemSistema:d,bookIdItem:m}}firstPositiveNumber(...t){return t.map(i=>Number(i)).find(i=>Number.isFinite(i)&&i>0)??0}persistItemMetadata(t){let e={idItem:Number(t?.product?.idItem??0),dtReserva:this.toDateOnly(t?.product?.Book?.date),hrReserva:t?.product?.Book?.timeOfDeparture??null};this.persistResolvedMetadata(e,{idItemGestor:Number(t?.product?.idItem??0),idItemSistema:this.firstPositiveNumber(t?.product?.idItemSistema,t?.product?.Book?.idItemSistema,t?.product?.ValoresData?.IdItemSistema,t?.product?.ValoresData?.idItemSistema),bookIdItem:this.firstPositiveNumber(t?.product?.Book?.idItem,t?.product?.ValoresData?.IdItem,t?.product?.ValoresData?.idItem),horariosItensCombo:this.normalizeHorariosItensCombo(t?.product?.Book?.horariosItensCombo)})}normalizeHorariosItensCombo(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=Object.entries(t).map(([i,r])=>{let o=Number(i);return!Number.isFinite(o)||!r?.ida?null:[o,U(U({ida:String(r.ida)},r.volta?{volta:String(r.volta)}:{}),r.fltrem!==void 0?{fltrem:!!r.fltrem}:{})]}).filter(i=>!!i);if(e.length)return Object.fromEntries(e)}persistResolvedMetadata(t,e){let i=this.buildItemMetadataKey(t);if(!i)return;let r=this.readItemMetadataStore();r[i]=e,localStorage.setItem(this.cartItemMetadataStorageKey,JSON.stringify(r))}getPersistedItemMetadata(t){let e=this.buildItemMetadataKey(t);return e?this.readItemMetadataStore()[e]??null:null}removeItemMetadataByKey(t){let e=this.buildItemMetadataKey(t);if(!e)return;let i=this.readItemMetadataStore();i[e]&&(delete i[e],localStorage.setItem(this.cartItemMetadataStorageKey,JSON.stringify(i)))}readItemMetadataStore(){let t=localStorage.getItem(this.cartItemMetadataStorageKey);if(!t)return{};try{let e=JSON.parse(t);return e&&typeof e=="object"?e:{}}catch{return{}}}buildItemMetadataKey(t){let e=Number(t?.idItem??0),i=t?.dtReserva??null,r=t?.hrReserva??null;return!e||!i?null:`${e}|${i}|${r??""}`}extractPassengers(t,e){let i=e?.passageiros||e?.product?.Book?.passengers;if(Array.isArray(i)&&i.length)return i;let r=t?.dsDetalhesPax??t?.DsDetalhesPax??t?.TiposPessoas??t?.tiposPessoas??[];if(typeof r=="string")try{let o=JSON.parse(r);return Array.isArray(o)?o:[]}catch{return[]}return Array.isArray(r)?r:[]}extractBackendTotal(t,e){let i=t?.CestoCompra||t?.cestoCompra||t||{},r=i?.vlTotal??i?.VlTotal??t?.vlTotal??t?.VlTotal??null;return this.toNumberOrNull(r)??e.reduce((a,u)=>a+Number(u?.precoComDesconto||0),0)}toDateOnly(t){if(!t)return null;if(typeof t=="string")return t.includes("T")?t.split("T")[0]:t;let e=new Date(t);if(Number.isNaN(e.getTime()))return null;let i=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${i}-${r}-${o}`}toNumberOrNull(t){if(t==null)return null;let e=Number(t);return Number.isFinite(e)?e:null}generateSessionId(){let t=Math.random().toString(36).slice(2,10);return`sess-${Date.now()}-${t}`}static{this.\u0275fac=function(e){return new(e||n)(Y(Le),Y(xi),Y(Ei))}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Di=class n{constructor(){this.purchaseStoragePrefix="ga4_purchase_tracked_"}trackAddToCart(t){let e=this.mapCartItem(t);e&&this.pushEcommerceEvent("add_to_cart",{currency:"BRL",value:this.roundCurrency(e.price*e.quantity),items:[e]})}trackBeginCheckout(t,e){let i=t.map(o=>this.mapCartItem(o)).filter(o=>!!o);if(!i.length)return;let r=Number.isFinite(Number(e))?Number(e):i.reduce((o,a)=>o+a.price*a.quantity,0);this.pushEcommerceEvent("begin_checkout",{currency:"BRL",value:this.roundCurrency(r),items:i})}trackPurchase(t){let e=this.getTransactionId(t);if(!e)return;let i=`${this.purchaseStoragePrefix}${e}`;if(sessionStorage.getItem(i)==="1")return;let r=this.mapPurchaseItems(t);if(!r.length)return;let o=this.getPurchaseValue(t,r);this.pushEcommerceEvent("purchase",{transaction_id:e,currency:"BRL",value:this.roundCurrency(o),items:r}),sessionStorage.setItem(i,"1")}pushEcommerceEvent(t,e){typeof window>"u"||(window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:t,ecommerce:e}))}mapCartItem(t){let e=this.resolveItemId(t?.product),i=t?.product?.nmItem||t?.product?.ValoresData?.dsItem||"Produto",r=Number(t?.quantity||1),o=Number(t?.precoComDesconto??t?.subtotal??t?.product?.vlVenda??0),a=r>0?o/r:o;
1return!e||!i||!Number.isFinite(a)?null:{item_id:e,item_name:i,price:this.roundCurrency(a),quantity:r>0?r:1}}mapPurchaseItems(t){let e=t?.Reserva||t?.ReservaResponse?.Reserva||t?.reserva||null,i=Array.isArray(e?.Servicos)?e.Servicos:[];return i.length>0?i.map(o=>{let a=this.getPassengerCount(o?.Pax),u=Number(o?.vlTotal??0),d=a>0?u/a:u,m=o?.idItem?String(o.idItem):"",I=o?.nmItem||"Produto";return!m||!Number.isFinite(d)?null:{item_id:m,item_name:I,price:this.roundCurrency(d),quantity:a>0?a:1}}).filter(o=>!!o):(Array.isArray(t?.VendaItens)?t.VendaItens:[]).map(o=>{let a=Number(o?.qtPax||1),u=Number(o?.vlTotal??o?.vlItem??0),d=a>0?u/a:u,m=o?.idItem?String(o.idItem):"";return!m||!Number.isFinite(d)?null:{item_id:m,item_name:o?.nmItem||"Produto",price:this.roundCurrency(d),quantity:a>0?a:1}}).filter(o=>!!o)}getPassengerCount(t=[]){return t.reduce((e,i)=>e+Number(i?.nrQtde||0),0)}getPurchaseValue(t,e){let i=t?.Reserva||t?.ReservaResponse?.Reserva||t?.reserva||null,o=[t?.vlTotal,i?.vlTotal,i?.Pagamentos?.[0]?.vlPagamento,i?.pagamentos?.[0]?.vlPagamento].find(a=>Number.isFinite(Number(a)));return o!==void 0?Number(o):e.reduce((a,u)=>a+u.price*u.quantity,0)}getTransactionId(t){let e=t?.Reserva||t?.ReservaResponse?.Reserva||t?.reserva||null,i=t?.idVenda||e?.nrLocalizador||e?.idReserva;return i?String(i):""}resolveItemId(t){let e=t?.idItemSistema||t?.ValoresData?.IdItemSistema||t?.Book?.idItemSistema||t?.Book?.idItem||t?.idItem||t?.ValoresData?.IdItem;return e?String(e):""}roundCurrency(t){return Math.round((Number(t)+Number.EPSILON)*100)/100}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};function Sc(n,t){if(n&1&&(ce(0),p(1),de()),n&2){let e=C();l(),Te(" ",e.getPrimeiroHorarioCombo()," \xE0s ",e.item.product.Book.timeOfArrival," ")}}function yc(n,t){if(n&1&&p(0),n&2){let e=C();E(" ",e.getPrimeiroHorarioCombo()," ")}}function Tc(n,t){n&1&&(s(0,"span"),p(1,", "),c())}function Pc(n,t){if(n&1&&(ce(0),p(1),x(2,Tc,2,0,"span",32),de()),n&2){let e=t.$implicit,i=t.last;l(),E(" ",e.nome,""),l(),h("ngIf",!i)}}function kc(n,t){if(n&1&&(ce(0),s(1,"span",30),x(2,Pc,3,2,"ng-container",31),c(),de()),n&2){let e=C(2);l(2),h("ngForOf",e.item.product.Book.passengers)}}function Ac(n,t){if(n&1&&(s(0,"span",30),p(1),c()),n&2){let e=C(2);l(),P(e.getResumoPassageirosPorTipo())}}function Oc(n,t){if(n&1&&(ce(0),x(1,kc,3,1,"ng-container",20)(2,Ac,2,1,"ng-template",null,2,ve),de()),n&2){let e=Z(3),i=C();l(),h("ngIf",i.passageirosPossuemNomes())("ngIfElse",e)}}function wc(n,t){n&1&&(p(0),v(1,"translate")),n&2&&E(" ",_(1,1,"ITEM-CART.NAO-INFORMADO")," ")}function Rc(n,t){if(n&1&&(s(0,"div",11)(1,"div",12),T(2,"img",33),c(),s(3,"p",14)(4,"span",15),p(5),v(6,"translate"),c(),p(7),c()()),n&2){let e=C();l(5),E("",_(6,2,"ITEM-CART.EMBARQUE"),":"),l(2),E(" ",e.item.product.Book.localEmbarqueNome," ")}}var qn=class n{constructor(t,e){this.store=t;this.router=e;this.$imageUrl=pe.IMAGEURL}ngOnInit(){}ImageOrEmpty(t,e){return Rt(t,e)}formatar(t){return Yt(t)}formatarValorUnitario(t){let e=t.product.Book?.vlVenda??t.product.vlVenda??0;return Yt(e)}calcularValorTotalItem(t){return(t.product.Book?.vlVenda??t.product.vlVenda??0)*t.quantity}removeItem(t,e,i){t!=null&&this.store.select(vs).pipe(De(1)).subscribe(r=>{let o=r===1;console.log("[FEC][item-cart] click removeItem",{productId:t,bookDate:e,timeOfDeparture:i,total:r,isLast:o}),this.store.dispatch(Oi({productId:t,bookDate:e,timeOfDeparture:i})),o&&this.router.navigate(["/"])})}passageirosPossuemNomes(){return!this.item?.product?.Book?.passengers||this.item.product.Book.passengers.length===0?!1:this.item.product.Book.passengers.some(t=>t.nome&&t.nome.trim()!=="")}getResumoPassageirosPorTipo(){if(!this.item?.product?.Book?.passengers||this.item.product.Book.passengers.length===0)return"";let t={};this.item.product.Book.passengers.forEach(r=>{let o=r.tipo||"Passageiro";t[o]=(t[o]||0)+1});let e={adt:"Adulto",chd:"Crian\xE7a",sen:"Senior",inf:"Beb\xEA",Adulto:"Adulto",Crian\u00E7a:"Crian\xE7a",Senior:"Senior",Beb\u00EA:"Beb\xEA"};return Object.entries(t).map(([r,o])=>{let a=e[r]||r;return`${o} ${a}${o>1?"s":""}`}).join(", ")}getPrimeiroHorarioCombo(){let t=this.item?.product,e=t?.Book?.horariosItensCombo;if(e&&Object.keys(e).length>0){let i=Object.values(e).find(a=>this.isFlagTrem(a?.fltrem)&&!this.isHorarioSemHora(this.getHorarioValue(a)));if(i)return this.getHorarioValue(i);let r=t?.Book?.timeOfDeparture||null;if(!this.isHorarioSemHora(r))return r;let o=Object.values(e).map(a=>this.getHorarioValue(a)).filter(a=>!this.isHorarioSemHora(a));if(o.length>0)return o.sort((u,d)=>u.localeCompare(d))[0]}return t?.Book?.timeOfDeparture||null}getHorarioValue(t){return t?.ida||t?.hrServico||t?.hora||null}isHorarioSemHora(t){return!t||t==="00:00"||t==="0:00"}isFlagTrem(t){return t===!0||t==="true"||t===1||t==="1"||t==="S"||t==="s"}static{this.\u0275fac=function(e){return new(e||n)(O(Ie),O(ze))}}static{this.\u0275cmp=ne({type:n,selectors:[["app-item-cart"]],inputs:{item:"item"},standalone:!1,decls:51,vars:32,consts:[["showSubtitulo",""],["semPax",""],["semNomes",""],[1,"relative","py-6","border-b","border-[#
1E5E5E5]","last:border-0","hover:bg-[#F9F9F9]","transition-colors","duration-300","px-4","rounded-lg","group-card"],[1,"flex","flex-col","md:flex-row","gap-6","md:gap-8","items-start","mb-6","md:mb-0","pb-6"],[1,"shrink-0","relative","group"],[1,"overflow-hidden","rounded-md","border","border-gray-100","w-[100px]","h-[100px]","md:w-[120px]","md:h-[120px]"],["alt","Imagem do passeio",1,"w-full","h-full","object-cover","transform","group-hover:scale-105","transition-transform","duration-500",3,"src"],[1,"flex-1","flex","flex-col","gap-3","pr-4"],[1,"text-normal","text-[--primary-background-text-color]","font-bold","leading-tight","tracking-wide",3,"title"],[1,"flex","flex-col","gap-2","text-sm","text-[--primary-black-color]"],[1,"flex","items-center","gap-3"],[1,"w-5","flex","justify-center","opacity-60"],["src","../../../../assets/img/icones/solar_calendar-linear.svg",1,"w-4","h-4"],[1,"font-normal","text-gray-600"],[1,"font-bold","text-[--primary-background-text-color]","mr-1"],[1,"flex","items-start","gap-3"],[1,"w-5","flex","justify-center","opacity-60","mt-0.5"],["src","../../../../assets/img/icones/tabler_clock.svg",1,"w-4","h-4"],[1,"flex-1","font-normal","text-gray-600"],[4,"ngIf","ngIfElse"],["src","../../../../assets/img/icones/bi_people.svg",1,"w-4","h-4"],["class","flex items-center gap-3",4,"ngIf"],[1,"w-full","md:w-auto","flex","justify-between","md:justify-end","items-center","md:items-start","pt-4","md:pt-0","border-t","md:border-t-0","border-gray-100","md:mr-10"],[1,"md:hidden","text-sm","text-gray-500","font-bold","uppercase"],[1,"text-normal","md:text-xl","font-bold","text-[--primary-background-text-color]","tracking-tight","text-right"],["tabindex","0","title","Remover do carrinho","aria-label","Remover item do carrinho",1,"absolute","top-5","right-3","z-10","p-2","text-gray-400","transition-all","duration-200","rounded-full","hover:text-[#C4544B]","hover:bg-red-50","focus:outline-none","focus:ring-2","focus:ring-[#C4544B]","focus:ring-offset-2",3,"click"],["xmlns","http://www.w3.org/2000/svg","width","22","height","22","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round","aria-hidden","true"],["x1","18","y1","6","x2","6","y2","18"],["x1","6","y1","6","x2","18","y2","18"],[1,"italic"],[4,"ngFor","ngForOf"],[4,"ngIf"],["src","../../../../assets/img/icones/buildings.svg",1,"w-4","h-4"]],template:function(e,i){if(e&1){let r=z();s(0,"section",3)(1,"div",4)(2,"div",5)(3,"div",6),T(4,"img",7),c()(),s(5,"div",8)(6,"p",9),v(7,"contentTranslate"),p(8),v(9,"contentTranslate"),c(),s(10,"div",10)(11,"div",11)(12,"div",12),T(13,"img",13),c(),s(14,"p",14)(15,"span",15),p(16),v(17,"translate"),c(),p(18),v(19,"date"),c()(),s(20,"div",16)(21,"div",17),T(22,"img",18),c(),s(23,"div",19)(24,"span",15),p(25),v(26,"translate"),c(),x(27,Sc,2,2,"ng-container",20)(28,yc,1,1,"ng-template",null,0,ve),c()(),s(30,"div",16)(31,"div",17),T(32,"img",21),c(),s(33,"div",19)(34,"span",15),p(35),v(36,"translate"),c(),x(37,Oc,4,2,"ng-container",20)(38,wc,2,3,"ng-template",null,1,ve),c()(),x(40,Rc,8,4,"div",22),c()(),s(41,"div",23)(42,"span",24),p(43,"Total"),c(),s(44,"span",25),p(45),v(46,"currency"),c()()(),s(47,"button",26),M("click",function(){return R(r),D(i.removeItem(i.item.product.idItem,i.item.product.Book.date,i.item.product.Book.timeOfDeparture))}),le(),s(48,"svg",27),T(49,"line",28)(50,"line",29),c()()()}if(e&2){let r=Z(29),o=Z(39);l(4),h("src",i.ImageOrEmpty(i.item.product.Imagem==null?null:i.item.product.Imagem.dsPath,"120x120"),Fe),l(2),h("title",re(7,13,i.item.product,"nmItem")),l(2),E(" ",re(9,16,i.item.product,"nmItem")," "),l(8),E("",_(17,19,"ITEM-CART.DATA"),":"),l(2),E(" ",Dn(19,21,i.item.product.Book.date,"dd/MM/yyyy","+0000")," "),l(7),E("",_(26,25,"ITEM-CART.HORARIO"),":"),l(2),h("ngIf",i.item.product.Book.timeOfArrival)("ngIfElse",r),l(8),E("",_(36,27,"ITEM-CART.PASSAGEIRO"),":"),l(2),h("ngIf",i.item.product.Book.passengers.length)("ngIfElse",o),l(3),h("ngIf",i.item.product.Book.localEmbarqueId),l(5),E(" ",re(46,29,i.calcularValorTotalItem(i.item),"BRL")," ")}},dependencies:[Ce,oe,kt,bi,Pe,Dt],encapsulation:2})}};var Ft=class n{constructor(t){this.http=t;this.APIURL=pe.EXTERNALAPIURL}setVenda(t){this.venda=t}getVenda(){return this.venda}getCupomDesconto(t){let e=`${this.APIURL}/Integra/getCupomDesconto?cdCupom=${t}`;return this.http.get(e)}getAllTipoFormaPagamentos(){let t=`${this.APIURL}/TipoFormaPagamento/GetAllTipoFormaPagamentos`;return this.http.get(t)}postVenda(t){let e=`${this.APIURL}/venda/PostVenda`;return this.http.post(e,t)}static{this.\u0275fac=function(e){return new(e||n)(Y(Le))}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Nc=(n,t)=>({border:!0,"border-red-500":n,"border-gray-300":t}),Mc=(n,t)=>({"text-green-500":n,"text-red-500":t});function Fc(n,t){if(n&1&&(s(0,"div",7),p(1),c()),n&2){let e=C();h("ngClass",X(2,Mc,e.cupomValido,!e.cupomValido)),l(),E(" ",e.mensagemCupom," ")}}var Mi=class n{constructor(t,e,i){this.store=t;this.fb=e;this.checkoutService=i;this.cupomValido=!1;this.mensagemCupom=null}ngOnInit(){this.discountForm=this.fb.group({cupom:[""]})}
1campoInvalido(t){let e=this.discountForm.get(t);return e?.invalid&&(e?.dirty||e?.touched)}calcularDesconto(t,e){return t.tpDesconto==="Percentual"?e*t.vlDesconto/100:t.vlDesconto}aplicarCupom(){let t=this.discountForm.get("cupom")?.value?.trim();t&&this.checkoutService.getCupomDesconto(t).subscribe({next:e=>{Yi([this.store.select(tn).pipe(De(1)),this.store.select(wi).pipe(De(1))]).subscribe(([i,r])=>{let o=i.items;console.log("Cupom recuperado:",e);let a=o.filter(m=>this.cupomValidoParaItem(e,m)).map(m=>m.product.idItem);if(a.length===0){this.cupomValido=!1,this.mensagemCupom="Cupom n\xE3o \xE9 v\xE1lido para os itens do carrinho.";return}let u=this.calcularDesconto(e,r),d=r-u;this.store.dispatch(gs({cupom:e,itensAfetados:a})),this.cupomValido=!0,this.mensagemCupom="Cupom aplicado com sucesso!"})},error:e=>{this.cupomValido=!1,this.mensagemCupom="Cupom inv\xE1lido ou expirado."}})}cupomValidoParaItem(t,e){let i=this.parseDateValue(t.dtValidade);if(i&&new Date>i)return!1;let r=(t.Itens||[]).map(o=>o.idItem);return!(r.length&&!r.includes(e.product.idItem)||!this.isDataServicoDentroDoRange(t,e)||!this.isTipoPaxValidoParaCupom(t,e))}isTipoPaxValidoParaCupom(t,e){let i=(t.TiposPax||[]).map(r=>(r.tpParametro||"").toLowerCase()).filter(Boolean);return!i.length||!e.passageiros?.length?!0:e.passageiros.some(r=>i.includes((r.tpParametro||"").toLowerCase()))}isDataServicoDentroDoRange(t,e){let i=this.parseDateValue(e.product?.Book?.date);if(!i)return!0;let r=this.parseDateValue(t?.dtCheckin),o=this.parseDateValue(t?.dtCheckout);if(!r&&!o)return!0;let a=this.toStartOfDay(i);return!(r&&a<this.toStartOfDay(r)||o&&a>this.toStartOfDay(o))}parseDateValue(t){if(!t)return null;if(t instanceof Date&&!isNaN(t.getTime()))return t;if(typeof t!="string")return null;let e=t.trim();if(!e)return null;let i=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(i){let[,a,u,d]=i;return new Date(Number(a),Number(u)-1,Number(d))}let r=e.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);if(r){let[,a,u,d]=r;return new Date(Number(d),Number(u)-1,Number(a))}let o=new Date(e);return isNaN(o.getTime())?null:o}toStartOfDay(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}static{this.\u0275fac=function(e){return new(e||n)(O(Ie),O(ki),O(Ft))}}static{this.\u0275cmp=ne({type:n,selectors:[["discount-coupon"]],standalone:!1,decls:12,vars:15,consts:[[3,"formGroup"],[1,"w-full","flex","flex-col","gap-[10px]","relative"],[1,"font-medium","text-[--primary-black-color]"],[1,"relative","w-full"],["type","text","id","cupom","name","cupom","formControlName","cupom",1,"text-[--primary-black-color]","uppercase","w-full","h-[50px]","pl-[17px]","pr-[100px]","rounded-[24px]","outline-none","placeholder-[--secondary-black-color]",3,"ngClass","placeholder"],[1,"absolute","right-2","top-1/2","-translate-y-1/2","border","border-[--primary-txt-color]","text-[--primary-txt-color]","hover:bg-[--primary-btn-bg-color]","hover:text-[--primary-btn-text-color]","hover:brightness-125","rounded-[24px]","px-[16px]","py-[6px]",3,"click"],["class","text-sm mt-1",3,"ngClass",4,"ngIf"],[1,"text-sm","mt-1",3,"ngClass"]],template:function(e,i){e&1&&(s(0,"form",0)(1,"div",1)(2,"p",2),p(3),v(4,"translate"),c(),s(5,"div",3),T(6,"input",4),v(7,"translate"),s(8,"button",5),M("click",function(){return i.aplicarCupom()}),p(9),v(10,"translate"),c()(),x(11,Fc,2,5,"div",6),c()()),e&2&&(h("formGroup",i.discountForm),l(3),P(_(4,6,"DISCOUNT.CUPOM-DESCONTO")),l(3),h("ngClass",X(12,Nc,i.campoInvalido("cupom"),!i.campoInvalido("cupom")))("placeholder",_(7,8,"DISCOUNT.PLACEHOLDER-CUPOM")),l(3),E(" ",_(10,10,"DISCOUNT.APLICAR")," "),l(2),h("ngIf",i.mensagemCupom))},dependencies:[lt,oe,yi,Ot,wt,Si,Ti,Pi,Pe],encapsulation:2})}};function Lc(n,t){if(n&1&&(s(0,"div",22),p(1),c()),n&2){let e=C();l(),Te(" ",e.getPassageirosInvalidos()," pendente",e.getPassageirosInvalidos()>1?"s":""," ")}}function Vc(n,t){n&1&&(s(0,"div",23),T(1,"i",24),p(2,"Completo "),c())}function Uc(n,t){n&1&&(s(0,"span",45),T(1,"i",46),c())}function Bc(n,t){if(n&1&&(s(0,"option",50),p(1),c()),n&2){let e=t.$implicit,i=C(3);h("ngValue",e),l(),E(" ",i.getLabelPassageiroDisponivel(e)," ")}}function Hc(n,t){if(n&1){let e=z();s(0,"div",47)(1,"div",48)(2,"select",49),st("ngModelChange",function(r){R(e);let o=C().index,a=C();return at(a.passageiroSelecionadoParaCopia[o],r)||(a.passageiroSelecionadoParaCopia[o]=r),D(r)}),M("change",function(){R(e);let r=C().index,o=C();return D(o.copiarDePassageiro(r))}),s(3,"option",50),p(4,"Copiar dados de outro passageiro..."),c(),x(5,Bc,2,2,"option",51),c()()()}if(n&2){let e=C().index,i=C();l(2),ot("ngModel",i.passageiroSelecionadoParaCopia[e]),h("name","copiarDe"+e),l(),h("ngValue",null),l(2),h("ngForOf",i.getTodosPassageirosDisponiveis())}}function $c(n,t){n&1&&(s(0,"p",52),p(1," Nome deve ter pelo menos 3 caracteres "),c())}
1function jc(n,t){n&1&&(s(0,"p",52),p(1," Data invalida "),c())}function Gc(n,t){if(n&1&&(s(0,"p",52),p(1),c()),n&2){let e=C().index,i=C();l(),E(" ",i.getMensagemErroIdade(e)," ")}}function zc(n,t){n&1&&(s(0,"p",52),p(1," CPF invalido "),c())}function Wc(n,t){n&1&&(s(0,"p",52),p(1," RG deve ter entre 5 e 20 caracteres "),c())}function qc(n,t){n&1&&(s(0,"p",52),T(1,"i",53),p(2," Documento duplicado "),c())}function Kc(n,t){if(n&1){let e=z();s(0,"div",25)(1,"div",26)(2,"div",27)(3,"div",28),p(4),c(),s(5,"span",29),p(6),c(),x(7,Uc,2,0,"span",30),c()(),x(8,Hc,6,4,"div",31),s(9,"div",32)(10,"div",33)(11,"label",34),p(12," Nome Completo "),s(13,"span",35),p(14,"*"),c()(),s(15,"input",36,0),st("ngModelChange",function(r){let o=R(e).$implicit;return at(o.nome,r)||(o.nome=r),D(r)}),M("ngModelChange",function(){R(e);let r=C();return D(r.onFieldChange())})("blur",function(){R(e);let r=C();return D(r.onFieldBlur())}),c(),x(17,$c,2,0,"p",37),c(),s(18,"div")(19,"label",34),p(20," Data de Nascimento "),s(21,"span",35),p(22,"*"),c()(),s(23,"input",38,1),st("ngModelChange",function(r){let o=R(e).$implicit;return at(o.dataNascimento,r)||(o.dataNascimento=r),D(r)}),M("ngModelChange",function(){R(e);let r=C();return D(r.onFieldChange())})("blur",function(){R(e);let r=C();return D(r.onFieldBlur())}),c(),x(25,jc,2,0,"p",37)(26,Gc,2,1,"p",37),c(),s(27,"div")(28,"label",34),p(29," Tipo de Documento "),s(30,"span",35),p(31,"*"),c()(),s(32,"select",39,2),st("ngModelChange",function(r){let o=R(e).$implicit;return at(o.tipoDocumento,r)||(o.tipoDocumento=r),D(r)}),M("ngModelChange",function(){R(e);let r=C();return D(r.onFieldChange())})("change",function(){R(e);let r=C();return D(r.onFieldBlur())}),s(34,"option",40),p(35,"Selecione"),c(),s(36,"option",41),p(37,"CPF"),c(),s(38,"option",42),p(39,"RG"),c(),s(40,"option",43),p(41,"Passaporte"),c()()(),s(42,"div",33)(43,"label",34),p(44," Numero do Documento "),s(45,"span",35),p(46,"*"),c()(),s(47,"input",44,3),st("ngModelChange",function(r){let o=R(e).$implicit;return at(o.numeroDocumento,r)||(o.numeroDocumento=r),D(r)}),M("ngModelChange",function(){R(e);let r=C();return D(r.onFieldChange())})("blur",function(){R(e);let r=C();return D(r.onFieldBlur())}),c(),x(49,zc,2,0,"p",37)(50,Wc,2,0,"p",37)(51,qc,3,0,"p",37),c()()()}if(n&2){let e=t.$implicit,i=t.index,r=Z(16),o=Z(24),a=Z(33),u=Z(48),d=C();ye("border-color",!e.nome&&!e.numeroDocumento?"var(--primary-background-bg-color)":""),ge("border-red-300",!d.isPassageiroValido(i)&&(e.nome||e.numeroDocumento))("border-green-300",d.isPassageiroValido(i)),l(4),E(" ",i+1," "),l(2),P(e.tipo),l(),h("ngIf",d.isPassageiroValido(i)),l(),h("ngIf",d.getTodosPassageirosDisponiveis().length>0),l(7),ye("border-color",r.touched?"":"var(--primary-background-bg-color)")("focus:ring-color","var(--primary-btn-bg-color)"),ge("border-red-300",r.invalid&&r.touched)("border-green-300",r.valid&&r.touched)("bg-red-50",r.invalid&&r.touched),Qi("name","nome",i,""),ot("ngModel",e.nome),l(2),h("ngIf",r.invalid&&r.touched),l(6),ye("border-color",o.touched?"":"var(--primary-background-bg-color)"),ge("border-red-300",o.invalid&&o.touched)("border-green-300",o.valid&&o.touched&&d.isDataNascimentoValida(i))("bg-red-50",o.invalid&&o.touched),Qi("name","dataNascimento",i,""),ot("ngModel",e.dataNascimento),h("min",d.minDateStr)("max",d.maxDate),l(2),h("ngIf",o.invalid&&o.touched),l(),h("ngIf",o.valid&&e.dataNascimento&&d.isDataNascimentoValida(i)&&!d.isIdadeValidaParaTipo(i)),l(6),ye("border-color",a.touched?"":"var(--primary-background-bg-color)"),ge("border-red-300",a.invalid&&a.touched)("border-green-300",a.valid&&a.touched),Qi("name","tipoDocumento",i,""),ot("ngModel",e.tipoDocumento),l(15),ye("border-color",u.touched?"":"var(--primary-background-bg-color)"),ge("border-red-300",u.touched&&(u.invalid||!d.isDocumentoValido(i)||d.isDuplicado(i)))("border-green-300",u.valid&&u.touched&&d.isDocumentoValido(i)&&!d.isDuplicado(i))("bg-red-50",u.touched&&(u.invalid||!d.isDocumentoValido(i)||d.isDuplicado(i))),Qi("name","numeroDocumento",i,""),ot("ngModel",e.numeroDocumento),h("placeholder",e.tipoDocumento==="CPF"?"000.000.000-00":"Digite o numero"),l(2),h("ngIf",u.touched&&e.numeroDocumento&&e.tipoDocumento==="CPF"&&!d.isDocumentoValido(i)),l(),h("ngIf",u.touched&&e.numeroDocumento&&e.tipoDocumento==="RG"&&!d.isDocumentoValido(i)),l(),h("ngIf",u.touched&&d.isDuplicado(i))}}function Yc(n,t){n&1&&(s(0,"div",54),T(1,"i",55),s(2,"div",56)(3,"p",57),p(4,"Dados Incompletos"),c(),s(5,"p"),p(6,"Complete os dados de "),s(7,"strong"),p(8,"todos os passageiros"),c(),p(9," para prosseguir."),c()()())}function Zc(n,t){n&1&&(s(0,"div",58),T(1,"i",59),s(2,"p",60),p(3," Todos os dados estao preenchidos corretamente! "),c()())}var Kn=class n{constructor(t){this.cdr=t;this.passageiros=[];this.productName="";this.allCartItems=[];this.currentCartItem=null;this.passageirosChanged=new vi;this.minDate=new Date(1900,0,1);this.maxDate=new Date().toISOString().split("T")[0];this.minDateStr="1900-01-01";this.minDateObj=new Date(1900,0,1);this.exibirFormulario=!0;this.passageirosLocal=[];this.isEditing=!1;this.passageiroSelecionadoParaCopia={};this.tabDebugListener=null;this.cpfCheck=Ai()}ngOnChanges(t){if(t.passageiros&&this.passageiros&&!this.isEditing){if(this.passageiros===this.passageirosLocal)return;let e=this.criarCopiaMutavel(this.passageiros);JSON.stringify(e)!==JSON.stringify(this.passageirosLocal)&&(this.passageirosLocal=e)}}ngOnInit(){this.passageirosLocal=this.criarCopiaMutavel(this.passageiros),this.exibirFormulario=!0,this.setupTabIndexDebugger()}criarCopiaMutavel(t){return t.map(e=>({nome:e.nome,dataNascimento:e.dataNascimento,tipoDocumento:e.tipoDocumento,numeroDocumento:e.numeroDocumento,tipo:e.tipo,idPax:e.idPax,vlPax:e.vlPax,nrIdadeIni:e.nrIdadeIni,nrIdadeFim:e.nrIdadeFim,tpParametro:e.tpParametro}))}setupTabIndexDebugger(){this.tabDebugListener=t=>{let e=t.target;if(e.closest("app-cart-passengers-form")){let i=e.getAttribute("tabindex")||e.tabIndex,r=e.tagName.toLowerCase(),o=e.getAttribute("name")||"",a=e.getAttribute("placeholder")||"",u=e.getAttribute("aria-label")||"";console.log("\u{1F50D} TAB DEBUG:",{tabindex:i,elemento:r,nome:o,placeholder:a,ariaLabel:u,element:e})}},document.addEventListener("focusin",this.tabDebugListener)}ngOnDestroy(){this.isEditing&&this.salvarDados(),this.tabDebugListener&&(document.removeEventListener("focusin",this.tabDebugListener),this.tabDebugListener=null)}toggleFormulario(){if(this.isEditing){console.log("Bloqueado toggle durante edi\xE7\xE3o");return}this.exibirFormulario&&this.passageirosChanged.emit([...this.passageirosLocal]),this.exibirFormulario=!this.exibirFormulario}onFieldBlur(){this.isEditing=!0,this.salvarDados()}onFieldChange(){this.isEditing=!0,this.cdr.markForCheck()}salvarDados(){if(!this.isEditing)return;let t=this.passageirosLocal.map(e=>U({},e));this.passageirosChanged.emit(t),this.cdr.detectChanges(),setTimeout(()=>{this.isEditing=!1},500)}finalizarEdicao(){this.isEditing&&this.salvarDados()}copiarDadosPrimeiro(t){if(t===0||!this.passageirosLocal[0].nome)return;let e=this.passageirosLocal[0],i=this.passageirosLocal[t];this.passageirosLocal[t]={nome:e.nome,dataNascimento:e.dataNascimento,tipoDocumento:e.tipoDocumento,numeroDocumento:e.numeroDocumento,tipo:i.tipo,idPax:i.idPax,vlPax:i.vlPax,nrIdadeIni:i.nrIdadeIni,nrIdadeFim:i.nrIdadeFim,tpParametro:i.tpParametro},console.log("\u{1F4CB} Copiou dados do primeiro passageiro para o passageiro",t),this.isEditing=!0,this.cdr.detectChanges(),this.salvarDados()}trackByIndex(t){return t}isNomeValido(t){let e=this.passageirosLocal[t]?.nome;return!!e&&e.trim().length>=3}isDataNascimentoValida(t){let e=this.passageirosLocal[t]?.dataNascimento;if(!e)return!1;let i=this.parseDateString(e),r=this.getTodayDateOnly();return!!(i&&i<=r&&i>=this.minDateObj)}isIdadeValidaParaTipo(t){let e=this.passageirosLocal[t];if(!e.dataNascimento)return!1;let i=this.calcularIdade(e.dataNascimento);if(i===null)return!1;if(e.nrIdadeIni!==void 0||e.nrIdadeFim!==void 0){let r=e.nrIdadeIni??0,o=e.nrIdadeFim??999;return i>=r&&i<=o}return!0}isDocumentoValido(t){let e=this.passageirosLocal[t];if(!e.tipoDocumento||!e.numeroDocumento)return!1;if(e.tipoDocumento==="CPF"){let i={value:e.numeroDocumento};return this.cpfCheck(i)===null}else if(e.tipoDocumento==="RG"){let i=e.numeroDocumento.replace(/[^a-zA-Z0-9]/g,"");return i.length>=5&&i.length<=20}else if(e.tipoDocumento==="Passaporte")return e.numeroDocumento.replace(/[^a-zA-Z0-9]/g,"").length>=5;return!1}isDuplicado(t){let e=this.passageirosLocal[t]?.numeroDocumento;return e?this.passageirosLocal.some((i,r)=>r!==t&&i.numeroDocumento===e&&e.trim()!==""):!1}isPassageiroValido(t){return this.isNomeValido(t)&&this.isDataNascimentoValida(t)&&this.isIdadeValidaParaTipo(t)&&this.isDocumentoValido(t)&&!this.isDuplicado(t)}getTodosPassageirosValidos(){return this.passageirosLocal.every((t,e)=>this.isPassageiroValido(e))}getPassageirosInvalidos(){return this.passageirosLocal.filter((t,e)=>!this.isPassageiroValido(e)).length}parseDateString(t){if(!t)return null;let e=t.split("-");return e.length!==3?null:new Date(Number(e[0]),Number(e[1])-1,Number(e[2]))}getTodayDateOnly(){let t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate())}calcularIdade(t){if(!t)return null;let e=new Date,i=new Date(t),r=e.getFullYear()-i.getFullYear(),o=e.getMonth()-i.getMonth();return(o<0||o===0&&e.getDate()<i.getDate())&&r--,r}getMensagemErroIdade(t){let e=this.passageirosLocal[t];if(!e.dataNascimento)return"";let i=this.calcularIdade(e.dataNascimento);return i===null?"":e.nrIdadeIni!==void 0&&e.nrIdadeFim!==void 0?`Idade ${i}
1 anos n\xE3o \xE9 v\xE1lida para ${e.tipo}. Faixa permitida: ${e.nrIdadeIni}-${e.nrIdadeFim} anos.`:""}getTodosPassageirosDisponiveis(){if(!this.allCartItems)return[];let t=[];return this.allCartItems.forEach(e=>{e.passageiros&&e.passageiros.forEach((i,r)=>{if(i.nome&&i.nome.trim().length>0){let o=e.product.nmItem,a=e.product.Book?.date,u="";a&&(u=(a instanceof Date?a:this.parseDateKeepingCalendarDay(a)).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})),t.push({passageiro:i,passeioNome:o.length>35?o.substring(0,35)+"...":o,passeioData:u,index:r+1})}})}),t}parseDateKeepingCalendarDay(t){let[e,i,r]=t.split("T")[0].split("-").map(Number);return!e||!i||!r?new Date(t):new Date(e,i-1,r)}getLabelPassageiroDisponivel(t){let e=`${t.passeioNome}`;return t.passeioData&&(e+=` (${t.passeioData})`),e+=` - ${t.passageiro.tipo} #${t.index}`,e}copiarDePassageiro(t){let e=this.passageiroSelecionadoParaCopia[t];if(!e)return;let i=e.passageiro,r=this.passageirosLocal[t];this.passageirosLocal[t]={nome:i.nome,dataNascimento:i.dataNascimento,tipoDocumento:i.tipoDocumento,numeroDocumento:i.numeroDocumento,tipo:r.tipo,idPax:r.idPax,vlPax:r.vlPax,nrIdadeIni:r.nrIdadeIni,nrIdadeFim:r.nrIdadeFim,tpParametro:r.tpParametro},console.log("\u{1F4CB} Copiou dados de outro passageiro para o passageiro",t),this.isEditing=!0,this.cdr.detectChanges(),this.salvarDados(),this.passageiroSelecionadoParaCopia[t]=null}static{this.\u0275fac=function(e){return new(e||n)(O(Nn))}}static{this.\u0275cmp=ne({type:n,selectors:[["app-cart-passengers-form"]],inputs:{passageiros:"passageiros",productName:"productName",allCartItems:"allCartItems",currentCartItem:"currentCartItem"},outputs:{passageirosChanged:"passageirosChanged"},standalone:!1,features:[gi],decls:25,vars:7,consts:[["nomeRef","ngModel"],["dataRef","ngModel"],["tipoDocRef","ngModel"],["docRef","ngModel"],[1,"bg-white","rounded-lg","border-2","overflow-hidden","mb-4",2,"border-color","var(--primary-background-bg-color)"],[1,"p-4","flex","items-center","justify-between","transition-all",2,"background","linear-gradient(135deg, var(--primary-background-bg-color) 0%, var(--tertiary-background-bg-color) 100%)"],[1,"flex","items-center","gap-3"],[1,"text-white","rounded-full","w-10","h-10","flex","items-center","justify-center",2,"background-color","var(--primary-btn-bg-color)"],[1,"bi","bi-person-fill","text-xl"],[1,"font-bold","text-base","md:text-lg",2,"color","var(--primary-background-text-color)"],[1,"text-xs","md:text-sm",2,"color","var(--primary-txt-color)","opacity","0.8"],["class","px-3 py-1 rounded-full text-xs font-semibold","style","background-color: #fff8e1; color: var(--primary-txt-color);",4,"ngIf"],["class","px-3 py-1 rounded-full text-xs font-semibold","style","background-color: #e8f5e9; color: var(--primary-btn-bg-color);",4,"ngIf"],[1,"p-4","md:p-6",2,"background-color","var(--secondary-background-bg-color)"],[1,"rounded-lg","p-3","mb-4","flex","items-start","gap-2","border",2,"background-color","var(--tertiary-background-bg-color)","border-color","var(--primary-background-bg-color)"],[1,"bi","bi-info-circle-fill","text-lg","mt-0.5",2,"color","var(--primary-btn-bg-color)"],[1,"text-xs","md:text-sm",2,"color","var(--primary-txt-color)"],[1,"font-semibold","mb-1"],[1,"space-y-4"],["class","bg-white rounded-lg border-2 p-4 md:p-5 transition-all shadow-sm",3,"border-red-300","border-green-300","border-color",4,"ngFor","ngForOf","ngForTrackBy"],["class","mt-4 rounded-lg p-4 flex items-start gap-3 border-2","style","background-color: #fff8e1; border-color: var(--primary-pagination-color);",4,"ngIf"],["class","mt-4 rounded-lg p-4 flex items-center gap-3 border-2","style","background-color: #e8f5e9; border-color: var(--primary-btn-bg-color);",4,"ngIf"],[1,"px-3","py-1","rounded-full","text-xs","font-semibold",2,"background-color","#fff8e1","color","var(--primary-txt-color)"],[1,"px-3","py-1","rounded-full","text-xs","font-semibold",2,"background-color","#e8f5e9","color","var(--primary-btn-bg-color)"],[1,"bi","bi-check-circle-fill","mr-1"],[1,"bg-white","rounded-lg","border-2","p-4","md:p-5","transition-all","shadow-sm"],[1,"flex","items-center","justify-between","mb-4"],[1,"flex","items-center","gap-2"],[1,"text-white","rounded-full","w-8","h-8","flex","items-center","justify-center","text-sm","font-bold",2,"background-color","var(--primary-btn-bg-color)"],[1,"font-semibold",2,"color","var(--primary-background-text-color)"],["class","font-semibold","style","color: var(--primary-btn-bg-color);",4,"ngIf"],["class","mb-4 p-3 rounded-lg","style","background-color: var(--tertiary-background-bg-color); border: 1px solid var(--primary-background-bg-color);",4,"ngIf"],[1,"grid","grid-cols-1","md:grid-cols-2","gap-4"],[1,"md:col-span-2"],[1,"block","text-sm","font-medium","mb-1",2,"color","var(--primary-background-text-color)"],[1,"text-red-500"],["type","text","required","","minlength","3","placeholder","Digite o nome completo",1,"w-full","px-4","py-2.5","border-2","rounded-lg","focus:ring-2","transition-all",3,"ngModelChange","blur","ngModel","name"],["class","text-xs text-red-600 mt-1",4,"ngIf"],["type","date","required","",1,"w-full","px-4","py-2.5","border-2","rounded-lg","focus:ring-2","transition-all",3,"ngModelChange","blur","ngModel","name","min","max"],["required","",1,"w-full","px-4","py-2.5","border-2","rounded-lg","focus:ring-2","transition-all",3,"ngModelChange","change","ngModel","name"],["value",""],["value","CPF"],["value","RG"],["value","Passaporte"],["type","text","required","",1,"w-full","px-4","py-2.5","border-2","rounded-lg","focus:ring-2","transition-all",3,"ngModelChange","blur","ngModel","name","placeholder"],[1,"font-semibold",2,"color","var(--primary-btn-bg-color)"],[1,"bi","bi-check-circle-fill"],[1,"mb-4","p-3","rounded-lg",2,"background-color","var(--tertiary-background-bg-color)","border","1p
1x solid var(--primary-background-bg-color)"],[1,"flex","flex-col","md:flex-row","gap-2"],["aria-label","Copiar dados de outro passageiro",1,"flex-1","px-3","py-2","text-xs","md:text-sm","rounded-lg","focus:outline-none","focus:ring-2","font-medium",2,"border","2px solid var(--primary-background-bg-color)","color","var(--primary-background-text-color)","background-color","white",3,"ngModelChange","change","ngModel","name"],[3,"ngValue"],[3,"ngValue",4,"ngFor","ngForOf"],[1,"text-xs","text-red-600","mt-1"],[1,"bi","bi-exclamation-triangle-fill"],[1,"mt-4","rounded-lg","p-4","flex","items-start","gap-3","border-2",2,"background-color","#fff8e1","border-color","var(--primary-pagination-color)"],[1,"bi","bi-exclamation-triangle-fill","text-xl",2,"color","var(--primary-pagination-color)"],[1,"text-sm",2,"color","var(--primary-txt-color)"],[1,"font-bold","mb-1"],[1,"mt-4","rounded-lg","p-4","flex","items-center","gap-3","border-2",2,"background-color","#e8f5e9","border-color","var(--primary-btn-bg-color)"],[1,"bi","bi-check-circle-fill","text-xl",2,"color","var(--primary-btn-bg-color)"],[1,"text-sm","font-bold",2,"color","var(--primary-txt-color)"]],template:function(e,i){e&1&&(s(0,"div",4)(1,"div",5)(2,"div",6)(3,"div",7),T(4,"i",8),c(),s(5,"div")(6,"h3",9),p(7," Dados dos Passageiros "),c(),s(8,"p",10),p(9),c()()(),s(10,"div",6),x(11,Lc,2,2,"div",11)(12,Vc,3,0,"div",12),c()(),s(13,"div",13)(14,"div",14),T(15,"i",15),s(16,"div",16)(17,"p",17),p(18,"Dica para economizar tempo:"),
1c(),s(19,"p"),p(20,'Use o seletor "Copiar dados de..." em cada passageiro para copiar as informa\xE7\xF5es j\xE1 preenchidas.'),c()()(),s(21,"div",18),x(22,Kc,52,63,"div",19),c(),x(23,Yc,10,0,"div",20)(24,Zc,4,0,"div",21),c()()),e&2&&(l(9),P(i.productName),l(2),h("ngIf",!i.getTodosPassageirosValidos()),l(),h("ngIf",i.getTodosPassageirosValidos()),l(10),h("ngForOf",i.passageirosLocal)("ngForTrackBy",i.trackByIndex),l(),h("ngIf",!i.getTodosPassageirosValidos()),l(),h("ngIf",i.getTodosPassageirosValidos()))},dependencies:[Ce,oe,Hn,$n,Ot,Bn,wt,rs,os,Un],styles:['@charset "UTF-8";.animate-fade-in[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_fadeIn .3s ease-in-out}@keyframes _ngcontent-%COMP%_fadeIn{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}input[_ngcontent-%COMP%], select[_ngcontent-%COMP%]{transition:border-color .2s,background-color .2s}.border-red-300[_ngcontent-%COMP%]:focus{ring-color:rgb(252,165,165)}.border-green-300[_ngcontent-%COMP%]:focus{ring-color:rgb(134,239,172)}']})}};var Qc=()=>[],Jc=(n,t)=>({"bi-bus-front-fill":n,"bi-cup-hot-fill":t}),ed=n=>({count:n});function td(n,t){n&1&&(ce(0),s(1,"p",34),p(2),v(3,"translate"),c(),de()),n&2&&(l(2),P(_(3,1,"CART-COMPONENT.CARRINHO-EXCLUSAO-24HRS")))}function id(n,t){if(n&1&&(s(0,"div",33),x(1,td,4,3,"ng-container",24),c()),n&2){let e=t.ngIf;l(),h("ngIf",e.length>0)}}function nd(n,t){if(n&1){let e=z();s(0,"div",41)(1,"app-cart-passengers-form",42),M("passageirosChanged",function(r){R(e);let o=C().$implicit,a=C(3);return D(a.onPassageirosChanged(o,r))}),c()()}if(n&2){let e=C().$implicit,i=C(2).ngIf;l(),h("passageiros",e.passageiros||e.product.Book.passengers||Ci(4,Qc))("productName",e.product.nmItem)("allCartItems",i)("currentCartItem",e)}}function rd(n,t){if(n&1&&(s(0,"li"),T(1,"app-item-cart",39),x(2,nd,2,5,"div",40),c()),n&2){let e=t.$implicit,i=C(3);l(),h("item",e),l(),h("ngIf",i.itemPrecisaPassageiros(e))}}function od(n,t){n&1&&(s(0,"div",58),T(1,"div",59),c())}function ad(n,t){if(n&1&&T(0,"img",85),n&2){let e=C().$implicit,i=C(6);h("src",i.getPrimeiraImagemTipoS(e),Fe)("alt",e.nmItem)}}function sd(n,t){n&1&&(s(0,"div",86),T(1,"i",87),c())}function ld(n,t){if(n&1&&(s(0,"p",90)(1,"span",91),p(2),c(),s(3,"span",92),p(4),v(5,"currency"),c()()),n&2){let e=t.$implicit;l(2),E("",e.label,":"),l(2),P(re(5,2,e.preco,"BRL"))}}function cd(n,t){if(n&1&&(ce(0),s(1,"div",88),x(2,ld,6,5,"p",89),c(),de()),n&2){let e=C().$implicit,i=C(6);l(2),h("ngForOf",i.getPrecosPorTipoPassageiro(e))}}function dd(n,t){if(n&1&&(s(0,"p",93),p(1),v(2,"currency"),s(3,"span",94),p(4,"/pessoa"),c()()),n&2){let e=C().$implicit;l(),E(" ",re(2,1,e.vlVenda,"BRL")," ")}}function ud(n,t){if(n&1){let e=z();s(0,"div",76),M("click",function(){let r=R(e).$implicit,o=C(6);return D(o.abrirModalExclusivo(r))}),s(1,"div",77),x(2,ad,1,2,"img",78)(3,sd,2,0,"div",79),s(4,"span",80),p(5," EXCLUSIVO "),c(),s(6,"div",81)(7,"span",82),p(8," Ver detalhes "),c()()(),s(9,"h5",83),p(10),c(),s(11,"div",84),x(12,cd,3,1,"ng-container",36)(13,dd,5,4,"ng-template",null,2,ve),c()()}if(n&2){let e=t.$implicit,i=Z(14),r=C(6);l(2),h("ngIf",r.getPrimeiraImagemTipoS(e)),l(),h("ngIf",!r.getPrimeiraImagemTipoS(e)),l(7),E(" ",e.nmItem," "),l(2),h("ngIf",r.temPrecosPorTipo(e))("ngIfElse",i)}}function pd(n,t){if(n&1){let e=z();s(0,"div",62)(1,"div",63),T(2,"i",64),s(3,"h4",65),p(4),c(),s(5,"span",66),p(6),c()(),s(7,"div",67)(8,"button",68),M("click",function(){let r=R(e).$implicit,o=Z(11),a=C(5);return D(a.scrollCarouselLeft(r,o))}),T(9,"i",69),c(),s(10,"div",70,1),x(12,ud,15,5,"div",71),c(),s(13,"button",72),M("click",function(){let r=R(e).$implicit,o=Z(11),a=C(5);return D(a.scrollCarouselRight(r,o))}),T(14,"i",73),c()(),s(15,"p",74),T(16,"i",75),p(17," Deslize para ver mais "),c()()}if(n&2){let e=t.$implicit;l(2),h("ngClass",X(5,Jc,e.nome.includes("Experi\xEAncia"),e.nome.includes("Gastronomia"))),l(2),P(e.nome),l(2),Te(" ",e.itens.length," ",e.itens.length===1?"item":"itens"," "),l(6),h("ngForOf",e.itens)}}function md(n,t){if(n&1&&(s(0,"div",60),x(1,pd,18,8,"div",61),c()),n&2){let e=C(4);l(),h("ngForOf",e.categoriasExclusivos)}}function hd(n,t){n&1&&(s(0,"div",95),T(1,"i",96),s(2,"p",97),p(3,"Nenhum item exclusivo dispon\xEDvel no momento."),c()())}function fd(n,t){if(n&1){let e=z();s(0,"div",43)(1,"div",44)(2,"div",45),T(3,"i",46),s(4,"h3",47),p(5,"Itens Exclusivos Dispon\xEDveis"),c()(),s(6,"p",48),p(7," Aproveite itens especiais dispon\xEDveis apenas para voc\xEA! Toque no card para ver detalhes. "),c(),s(8,"div",49)(9,"div",50)(10,"button",51),M("click",function(){R(e);let r=C(3);return D(r.selecionarFiltroTpExclusivo(null))}),T(11,"i",52),s(12,"span"),p(13,"Todos"),c()(),s(14,"button",51),M("click",function(){R(e);let r=C(3);return D(r.selecionarFiltroTpExclusivo("E"))}
1),T(15,"i",53),s(16,"span"),p(17,"Experi\xEAncias"),c()(),s(18,"button",51),M("click",function(){R(e);let r=C(3);return D(r.selecionarFiltroTpExclusivo("G"))}),T(19,"i",54),s(20,"span"),p(21,"Gastronomia"),c()()()(),x(22,od,2,0,"div",55)(23,md,2,1,"div",56)(24,hd,4,0,"div",57),c()()}if(n&2){let e=C(3);l(10),ge("active",!e.filtroTpExclusivo),l(4),ge("active",e.filtroTpExclusivo==="E"),l(4),ge("active",e.filtroTpExclusivo==="G"),l(4),h("ngIf",e.loadingExclusivos),l(),h("ngIf",!e.loadingExclusivos&&e.categoriasExclusivos.length>0),l(),h("ngIf",!e.loadingExclusivos&&e.categoriasExclusivos.length===0)}}function gd(n,t){if(n&1&&(ce(0),s(1,"ul"),x(2,rd,3,2,"li",37),c(),x(3,fd,25,9,"div",38),de()),n&2){let e=C().ngIf,i=C();l(2),h("ngForOf",e)("ngForTrackBy",i.trackByCartItem),l(),h("ngIf",i.mostrarItensExclusivos)}}function vd(n,t){if(n&1&&(s(0,"div",35),x(1,gd,4,3,"ng-container",36),c()),n&2){let e=t.ngIf;C();let i=Z(15);l(),h("ngIf",e.length>0)("ngIfElse",i)}}function _d(n,t){n&1&&(s(0,"div",98)(1,"p",99)(2,"strong"),p(3),v(4,"translate"),c()()()),n&2&&(l(3),P(_(4,1,"CART-COMPONENT.NAO-ITENS-CARRINHO")))}function Cd(n,t){if(n&1&&(ce(0),s(1,"p",101),p(2),v(3,"translate"),c(),s(4,"p",102),p(5),v(6,"currency"),c(),de()),n&2){let e=C().ngIf,i=C();l(2),E(" ",re(3,2,"CART-COMPONENT.EM-ATE-SEM-JUROS",Ji(8,ed,i.getNumeroParcelasPermitidas(e)))," "),l(3),E(" de ",re(6,5,i.getValorParcela(e),"BRL")," ")}}function Id(n,t){if(n&1&&(s(0,"p",103),p(1),v(2,"translate"),v(3,"currency"),c()),n&2){let e=C().ngIf;l(),Te(" ",_(2,2,"CART-COMPONENT.TOTAL")," ",re(3,4,e,"BRL")," ")}}function bd(n,t){if(n&1&&(s(0,"div",100),x(1,Cd,7,10,"ng-container",36)(2,Id,4,7,"ng-template",null,3,ve),c()),n&2){let e=t.ngIf,i=Z(3),r=C();l(),h("ngIf",r.getNumeroParcelasPermitidas(e)>1)("ngIfElse",i)}}function xd(n,t){n&1&&(s(0,"div",105),T(1,"i",106),s(2,"p",107),p(3," Preencha todos os dados dos passageiros para continuar "),c()())}function Ed(n,t){if(n&1&&(s(0,"div"),x(1,xd,4,0,"div",104),c()),n&2){let e=t.ngIf,i=C();l(),h("ngIf",!i.validarCheckout(e))}}function Sd(n,t){if(n&1){let e=z();s(0,"a",108),M("click",function(r){let o=R(e).ngIf,a=C();return D(a.onFecharPedido(r,o))}),p(1),v(2,"translate"),c()}if(n&2){let e=t.ngIf,i=C();ye("background-color",i.validarCheckout(e)?"var(--primary-btn-bg-color)":"#ccc")("color","var(--primary-btn-text-color)"),ge("opacity-50",!i.validarCheckout(e))("cursor-not-allowed",!i.validarCheckout(e))("pointer-events-none",!i.validarCheckout(e)),h("routerLink",i.validarCheckout(e)?"/checkout/Payment":null),l(),E(" ",_(2,12,"CART-COMPONENT.FECHAR-PEDIDO")," ")}}var Yn=class n{constructor(t,e,i,r,o,a){this.store=t;this.sharedDataService=e;this.productService=i;this.dialog=r;this.cartPersistenceService=o;this.ecommerceTrackingService=a;this.vlParcelaMinima=0;this.itensExclusivos=[];this.mostrarItensExclusivos=!1;this.loadingExclusivos=!1;this.passageirosDisponiveis=[];this.passageirosSelecionadosPorItem={};this.itemExclusivoExpandido=null;this.itemComExclusivoOriginal=null;this.categoriasExclusivos=[];this.filtroTpExclusivo=null;this.itensExclusivosFiltrados=[];this.beginCheckoutTracked=!1;this.CATEGORIA_EXPERIENCIAS="Experi\xEAncias Ciao Bus";this.CATEGORIA_GASTRONOMIA="Gastronomia Ciao Bus";this.cartItems$=this.store.select(ft),this.cartTotal$=this.store.select(wi),this.currentUser$=this.store.select(nn)}ngOnInit(){this.cartPersistenceService.syncCartReferencesFromBackend().pipe(De(1)).subscribe(t=>{this.store.dispatch(en({nrSession:t.nrSession,idCestoCompra:t.idCestoCompra}))}),this.cartItems$=this.store.select(ft),this.sharedDataService.getVlParcelaMinima().subscribe({next:t=>this.vlParcelaMinima=t??0,error:()=>this.vlParcelaMinima=0}),this.cartItems$.subscribe(t=>{this.verificarItensExclusivos(t)})}removeItem(t,e,i){console.log("Removing item with ID:",t,"bookDate:",e,"timeOfDeparture:",i),this.store.dispatch(Oi({productId:t,bookDate:e,timeOfDeparture:i}))}onPassageirosChanged(t,e){this.store.dispatch(fs({productId:t.product.idItem,bookDate:t.product.Book?.date,timeOfDeparture:t.product.Book?.timeOfDeparture,passageiros:e}))}trackByCartItem(t,e){let i=e.product?.idItem??"sem-id",r=e.product?.Book?.date?new Date(e.product.Book.date).toISOString():"sem-data",o=e.product?.Book?.timeOfDeparture??"sem-hora";return`${i}-${r}-${o}`}itemPrecisaPassageiros(t){return t.product.Book?.passengers&&t.product.Book.passengers.length>0}passageirosPreenchidos(t){if(!this.itemPrecisaPassageiros(t))return!0;let e=t.passageiros||[],i=t.product.Book?.passengers||[];return console.log("\u{1F50D}
1 Validando passageiros do item:",t.product.nmItem),console.log("   Passageiros no item:",e),console.log("   Passageiros esperados:",i.length),e.length!==i.length?(console.log("\u274C Quantidade de passageiros incorreta",e.length,"!=",i.length),!1):e.every((o,a)=>{let u=o.nome&&o.nome.trim().length>=3,d=o.dataNascimento&&o.dataNascimento.trim().length>0,m=o.tipoDocumento&&o.tipoDocumento.trim().length>0,I=o.numeroDocumento&&o.numeroDocumento.trim().length>0;return u&&d&&m&&I})}todosPassageirosPreenchidos(t){return t.every(e=>this.passageirosPreenchidos(e))}getItensPendentes(t){return t.filter(e=>this.itemPrecisaPassageiros(e)&&!this.passageirosPreenchidos(e))}validarCheckout(t){return this.getItensPendentes(t).length===0}onFecharPedido(t,e){if(this.getItensPendentes(e).length>0){t.preventDefault(),setTimeout(()=>{let r=document.querySelector('.border-red-300, [class*="pendente"]');r&&r.scrollIntoView({behavior:"smooth",block:"center"})},100);return}this.beginCheckoutTracked||(this.beginCheckoutTracked=!0,this.cartTotal$.pipe(De(1)).subscribe(r=>{this.ecommerceTrackingService.trackBeginCheckout(e,r)}))}getNumeroParcelasPermitidas(t){if(t<=0||this.vlParcelaMinima<=0)return 0;let i=Math.floor(t/50),r=Math.min(this.vlParcelaMinima,i);return r>=1?r:0}getValorParcela(t){let e=this.getNumeroParcelasPermitidas(t);return e<=0||t<=0?0:t/e}verificarItensExclusivos(t){let e=t.find(i=>i.product.flContemExclusivo===!0);e?(this.passageirosDisponiveis=e.product.Book?.passengers||[],this.itemComExclusivoOriginal=e,console.log("Item original com flContemExclusivo completo:",e),console.log("Book completo:",e.product.Book),this.mostrarItensExclusivos||(this.mostrarItensExclusivos=!0,this.carregarItensExclusivos())):(this.mostrarItensExclusivos=!1,this.itensExclusivos=[],this.passageirosDisponiveis=[],this.passageirosSelecionadosPorItem={},this.itemComExclusivoOriginal=null)}carregarItensExclusivos(){this.loadingExclusivos=!0,console.log("\u{1F535} [CART] Carregando itens exclusivos..."),this.productService.getItensExclusivos().subscribe({next:t=>{console.log("\u{1F535} [CART] Itens exclusivos recebidos da API:",t.length,t),t.forEach(i=>{console.log(`\u{1F5BC}\uFE0F [IMAGENS] Item: ${i.nmItem}`),console.log("  - Imagens array:",i.Imagens),console.log("  - Quantidade de imagens:",i.Imagens?.length||0),i.Imagens&&i.Imagens.length>0&&i.Imagens.forEach((r,o)=>{console.log(`    [${o}] tpImagem: ${r.Imagem?.tpImagem}, dsPath: ${r.Imagem?.dsPath}`)})});let e=t.filter(i=>i.idItemSistema);if(console.log("\u{1F535} [CART] Itens com idItemSistema:",e.length,e.map(i=>({id:i.idItem,idSistema:i.idItemSistema,nome:i.nmItem}))),e.length===0){console.warn("\u26A0\uFE0F [CART] Nenhum item com idItemSistema encontrado!"),this.itensExclusivos=[],this.loadingExclusivos=!1;return}this.consultarTarifarioParaFiltrar(e)},error:t=>{console.error("\u274C [CART] Erro ao carregar itens exclusivos:",t),this.loadingExclusivos=!1,this.itensExclusivos=[],this.categoriasExclusivos=[]}})}consultarTarifarioParaFiltrar(t){let e=this.itemComExclusivoOriginal?.product?.Book,i=this.itemComExclusivoOriginal?.product;if(console.log("\u{1F535} [TARIF\xC1RIO] Verificando dados para consulta..."),console.log("\u{1F535} [TARIF\xC1RIO] Book original:",e),console.log("\u{1F535} [TARIF\xC1RIO] Produto original:",i),!e?.date||!i?.idItem){console.warn("\u26A0\uFE0F [TARIF\xC1RIO] Sem data ou item principal - MOSTRANDO TODOS OS ITENS SEM FILTRAR!"),console.warn("\u26A0\uFE0F [TARIF\xC1RIO] bookOriginal?.date:",e?.date),console.warn("\u26A0\uFE0F [TARIF\xC1RIO] produtoOriginal?.idItem:",i?.idItem),this.itensExclusivos=t,this.aplicarFiltroTpExclusivo(),this.loadingExclusivos=!1;return}this.currentUser$.subscribe(r=>{console.log("\u{1F535} [TARIF\xC1RIO] Usu\xE1rio atual:",r);let o=t.map(u=>u.idItemSistema).join(","),a=this.formatarDataParaApi(e.date);console.log("\u{1F7E2} [TARIF\xC1RIO] Consultando tarif\xE1rio com par\xE2metros:"),console.log("  \u{1F4E6} idItens:",o),console.log("  \u{1F68C} idItemGatilho (item principal):",i.idItemSistema),console.log("  \u{1F4C5} dtConsulta:",a),this.productService.getTarifarioProduto(o,i.idItemSistema,a).subscribe({next:u=>{console.log("\u2705 [TARIF\xC1RIO] Resposta recebida:",u),console.log("\u2705 [TARIF\xC1RIO] Itens no tarif\xE1rio:",u.Itens?.length),console.log("\u2705 [TARIF\xC1RIO] Detalhes dos itens:",u.Itens),this.itensExclusivos=t.filter(d=>{let m=u.Itens?.find(S=>S.idItem===d.idItemSistema);if(console.log(`  \u{1F50D} Verificando item ${d.nmItem} (idItemSistema: ${d.idItemSistema}):`),!m)return console.log("    \u274C N\xE3o encontrado no tarif\xE1rio"),!1;console.log("    \u2705 Encontrado no tarif\xE1rio:",m);let I=m.Pax?.find(S=>S.tpPax==="adt");console.log("    \u{1F464} PAX Adulto:",I);let y=I&&I.vlVenda&&I.vlVenda>0;return console.log(`    \u{1F4B0} Tem pre\xE7o v\xE1lido: ${y}`),y&&(d.tarifarioData=m,console.log(`    \u{1F4CC} Tarif\xE1rio associado ao item ${d.nmItem}`)),y}),console.log("\u2705 [TARIF\xC1RIO] Itens ap\xF3s filtragem:",this.itensExclusivos.length),console.log("\u2705 [TARIF\xC1RIO] Itens filtrados:",this.itensExclusivos.map(d=>({id:d.idItem,nome:d.nmItem,idSistema:d.idItemSistema}))),this.aplicarFiltroTpExclusivo(),this.loadingExclusivos=!1},error:u=>{console.error("\u274C [TARIF\xC1RIO] Erro ao consultar tarif\xE1rio:",u),this.itensExclusivos=t,this.aplicarFiltroTpExclusivo(),this.loadingExclusivos=!1}})}).unsubscribe()}formatarDataParaApi(t){let e=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${e}-${i}-${r}`}selecionarFiltroTpExclusivo(t){this.filtroTpExclusivo=this.filtroTpExclusivo===t?null:t,this.aplicarFiltroTpExclusivo()}getLabelTpExclusivo(t){return t==="E"?"Experi\xEAncias":"Gastronomia"}aplicarFiltroTpExclusivo(){this.filtroTpExclusivo?this.itensExclusivosFiltrados=this.itensExclusivos.filter(t=>t.tpExclusivo===this.filtroTpExclusivo):this.itensExclusivosFiltrados=[...this.itensExclusivos],this.agruparPorCategorias(this.itensExclusivosFiltrados)}agruparPorCategorias(t){let e=new Map;t.forEach(r=>{let o=this.determinarCategoria(r);e.has(o)||e.set(o,[]),e.get(o).push(r)}),this.categoriasExclusivos=[],[this.CATEGORIA_EXPERIENCIAS,this.CATEGORIA_GASTRONOMIA].forEach(r=>{e.has(r)&&(this.categoriasExclusivos.push({nome:r,itens:e.get(r),scrollPosition:0}),e.delete(r))}),e.forEach((r,o)=>{this.categoriasExclusivos.push({nome:o,itens:r,scrollPosition:0})})}determinarCategoria(t){return t.tpExclusivo==="G"?this.CATEGORIA_GASTRONOMIA:this.CATEGORIA_EXPERIENCIAS}abrirModalExclusivo(t){console.log("\u{1F5BC}
1\uFE0F [CART] Abrindo modal para produto:",t.nmItem),console.log("\u{1F5BC}\uFE0F [CART] Produto completo:",t),console.log("\u{1F5BC}\uFE0F [CART] Imagens do produto:",t.Imagens);let e=this.itemComExclusivoOriginal?.product?.Book,i=this.itemComExclusivoOriginal?.product,r=null;if(e?.horariosItensCombo){let a=Object.keys(e.horariosItensCombo)[0];a&&(r=e.horariosItensCombo[Number(a)].ida||null)}r||(r=e?.timeOfDeparture||null),console.log("\u{1F550} [CART] Abrindo modal com hor\xE1rio do item original:",r);let o=1;i?.PacoteTrem&&Array.isArray(i.PacoteTrem)&&i.PacoteTrem.length>0&&(o=i.PacoteTrem[0].flRoundTrip==="S"?2:1),this.currentUser$.subscribe(a=>{this.dialog.open(Wn,{data:{produto:t,passageirosDisponiveis:this.passageirosDisponiveis,dataOrigem:e?.date,horarioOrigem:r,idItemGatilho:i?.idItem||null,nrDias:o},panelClass:"exclusive-modal-panel",maxWidth:"450px",width:"100%",maxHeight:"90vh",autoFocus:!1}).afterClosed().subscribe(d=>{d&&this.processarResultadoModal(d)})}).unsubscribe()}processarResultadoModal(t){let{produto:e,passageiros:i,data:r,horario:o,valorPorPassageiro:a,valorTotal:u}=t;if(console.log("\u{1F6D2} [CART] Processando resultado do modal:"),console.log("  - Produto:",e.nmItem),console.log("  - Passageiros:",i.length),console.log("  - valorTotal recebido:",u),console.log("  - valorPorPassageiro (fallback):",a),!i||i.length===0)return;let d=this.itemComExclusivoOriginal?.product?.Book,m=u||a*i.length,I=m/i.length;console.log("  - valorTotalFinal a ser usado:",m),console.log("  - valorUnitario (m\xE9dia):",I);let y={idItem:e.idItemSistema||e.idItem,idItemGestor:e.idItem,date:r||d?.date||new Date,timeOfDeparture:o||d?.timeOfDeparture||null,timeOfArrival:d?.timeOfArrival||null,passengers:i,vlVenda:m,localEmbarqueId:d?.localEmbarqueId||null,localEmbarqueNome:d?.localEmbarqueNome||null},k={product:ie(U({},e),{vlVenda:I,Book:y,ValoresData:void 0}),quantity:1,cupom:null,subtotal:m,precoComDesconto:m};console.log("\u2705 [CART] Item preparado para adicionar:",{nome:e.nmItem,vlVenda:k.product.vlVenda,subtotal:k.subtotal,precoComDesconto:k.precoComDesconto}),this.store.dispatch(hs({item:k}))}scrollCarouselLeft(t,e){e.scrollBy({left:-280,behavior:"smooth"})}scrollCarouselRight(t,e){e.scrollBy({left:280,behavior:"smooth"})}canScrollLeft(t){return t?.scrollLeft>0}canScrollRight(t){return t?t.scrollLeft<t.scrollWidth-t.clientWidth-10:!1}getPrimeiraImagemTipoS(t){if(!t.Imagens||t.Imagens.length===0)return console.log(`\u{1F5BC}\uFE0F [getPrimeiraImagemTipoS] Produto ${t.nmItem} n\xE3o tem imagens`),"";let e=t.Imagens.find(r=>r.flPadrao?.trim().toLowerCase()==="s");e||(console.log(`\u{1F5BC}\uFE0F [getPrimeiraImagemTipoS] Produto ${t.nmItem} n\xE3o tem imagem tipo 's'`),console.log("  Tipos dispon\xEDveis:",t.Imagens.map(r=>r.Imagem?.tpImagem)));let i=Rt(e?.Imagem?.dsPath,"50x50");return console.log(`\u{1F5BC}\uFE0F [getPrimeiraImagemTipoS] Produto ${t.nmItem}: ${i}`),i}toggleSelecaoPassageiros(t){this.itemExclusivoExpandido=this.itemExclusivoExpandido===t?null:t}isItemExpandido(t){return this.itemExclusivoExpandido===t}inicializarPassageiros(t){this.passageirosSelecionadosPorItem[t]||(this.passageirosSelecionadosPorItem[t]=[])}isPassageiroSelecionado(t,e){return(this.passageirosSelecionadosPorItem[t]||[]).some(r=>r.nome===e.nome)}togglePassageiro(t,e){this.inicializarPassageiros(t);let i=this.passageirosSelecionadosPorItem[t],r=i.findIndex(o=>o.nome===e.nome);r>-1?i.splice(r,1):i.push(e)}getQuantidadePassageirosSelecionados(t){return(this.passageirosSelecionadosPorItem[t]||[]).length}getValorTotalComPassageiros(t){let e=this.getQuantidadePassageirosSelecionados(t.idItem);return t.vlVenda*e}getTotalPassageirosDisponiveis(){return this.passageirosDisponiveis.length}getTotalPassageirosAlocados(){let t=0;for(let e in this.passageirosSelecionadosPorItem)this.passageirosSelecionadosPorItem[e]&&(t+=this.passageirosSelecionadosPorItem[e].length);return t}getPrecosPorTipoPassageiro(t){if(!t.tarifarioData||!t.tarifarioData.Pax)return[{tipo:"geral",label:"Por pessoa",preco:t.vlVenda}];let e=[];return t.tarifarioData.Pax.forEach(i=>{if(i.vlVenda&&i.vlVenda>0){let r=i.nmPax||"";if(i.tpPax==="adt")r="Adulto";else if(i.tpPax==="chd"&&i.nmPax){let o=i.nmPax.match(/(\d+)\s*-\s*(\d+)/);o?r=`Crian\xE7a ${o[1]}-${o[2]} anos`:r="Crian\xE7a"}else i.nmPax&&i.nmPax.toLowerCase().includes("colo")&&(r="Colo");e.push({tipo:i.tpPax,label:r,preco:i.vlVenda})}}),e.length>0?e:[{tipo:"geral",label:"Por pessoa",preco:t.vlVenda}]}temPrecosPorTipo(t){return t.tarifarioData&&t.tarifarioData.flValorPorPax===!0}
1getMenorPreco(t){let e=this.getPrecosPorTipoPassageiro(t);return Math.min(...e.map(i=>i.preco))}static{this.\u0275fac=function(e){return new(e||n)(O(Ie),O(Ei),O(xi),O(ds),O(Nt),O(Di))}}static{this.\u0275cmp=ne({type:n,selectors:[["app-cart"]],inputs:{item:"item"},standalone:!1,decls:51,vars:40,consts:[["emptyCart",""],["carouselContainer",""],["precoUnico",""],["valorUnico",""],[1,"flex","justify-center","w-full","overflow-hidden"],[1,"flex","flex-col","gap-y-[14px]","items-center","justify-center","mt-[14px]","w-full","px-5"],["class","static top-0 left-0 w-full flex flex-col items-center justify-center",4,"ngIf"],[1,"w-full","flex","justify-start","mb-4"],["routerLink","/passeios",1,"inline-flex","items-center","gap-2","px-6","py-3","bg-white","border-2","rounded-lg","shadow-sm","hover:shadow-md","transition-all"],[1,"bi","bi-arrow-left","text-xl","font-bold"],[1,"font-bold","text-base"],[1,"flex","flex-col","w-full","mx-auto","gap-y-[14px]","lg:flex-row","lg:gap-[90px]","lg:mx-[0px]","lg:max-w-[100%]","overflow-hidden"],[1,"flex","flex-col","w-full","mx-auto","gap-y-[14px]","relative","min-w-0","overflow-hidden"],["class","static top-0 left-0 w-full",4,"ngIf"],[1,"flex","flex-col","w-full","lg:w-[380px]","shrink-0","bg-[#FAF9F6]","border","border-gray-200","rounded-2xl","p-6","lg:p-8","shadow-sm","lg:sticky","lg:top-4","h-fit","transition-all","duration-300"],[1,"border-b","border-gray-200","pb-4","mb-6"],[1,"text-[--primary-background-text-color]","font-bold","tracking-wide","text-xl"],[1,"mb-6","w-full"],[1,"flex","flex-col","gap-4"],[1,"flex","justify-between","items-center","pt-4","border-t","border-gray-200"],[1,"text-gray-600","font-medium","text-lg"],[1,"text-[--primary-background-text-color]","font-bold","text-2xl","tracking-tight"],["class","flex flex-col items-end text-right",4,"ngIf"],[1,"mt-8"],[4,"ngIf"],["class","flex items-center justify-center w-full font-bold text-lg rounded-full py-4 px-6 shadow-md hover:shadow-lg hover:brightness-110 transform hover:-translate-y-0.5 transition-all duration-300",3,"routerLink","opacity-50","cursor-not-allowed","pointer-events-none","background-color","color","click",4,"ngIf"],[1,"flex","items-center","justify-center","gap-2","mt-4","text-xs","text-green-600","font-medium","uppercase","tracking-wider"],[1,"bi","bi-lock-fill"],[1,"flex","flex-col","gap-[8px]","my-7"],[1,"text-[--secondary-background-text-color]","font-normal","text-base","text-center"],[1,"flex","justify-center","items-center","gap-[8px]"],[1,"bi","bi-telephone","text-[--primary-black-color]"],[1,"text-[--primary-black-color]","font-normal","text-base"],[1,"static","top-0","left-0","w-full","flex","flex-col","items-center","justify-center"],[1,"text-center","bg-orange-50","text-orange-800","w-auto","w-fit","py-2","px-4","rounded-lg"],[1,"static","top-0","left-0","w-full"],[4,"ngIf","ngIfElse"],[4,"ngFor","ngForOf","ngForTrackBy"],["class","mt-8 mb-6 overflow-hidden",4,"ngIf"],[3,"item"],["class","mt-2",4,"ngIf"],[1,"mt-2"],[3,"passageirosChanged","passageiros","productName","allCartItems","currentCartItem"],[1,"mt-8","mb-6","overflow-hidden"],[1,"bg-gradient-to-r","from-amber-50","to-orange-50","border-2","border-amber-200","rounded-xl","p-4","md:p-6","shadow-md","overflow-hidden"],[1,"flex","items-center","gap-3","mb-4"],[1,"bi","bi-star-fill","text-amber-500","text-xl","md:text-2xl"],[1,"text-lg","md:text-xl","font-bold","text-amber-900"],[1,"text-xs","md:text-sm","text-amber-800","mb-4"],[1,"mb-4"],[1,"flex","flex-wrap","gap-2"],[1,"filter-btn",3,"click"],[1,"bi","bi-grid-3x3-gap-fill"],[1,"bi","bi-bus-front-fill"],[1,"bi","bi-cup-hot-fill"],["class","flex justify-center py-8",4,"ngIf"],["class","space-y-6 min-w-0",4,"ngIf"],["class","text-center py-6 text-amber-700",4,"ngIf"],[1,"flex","justify-center","py-8"],[1,"animate-spin","rounded-full","h-10","w-10","border-b-2","border-amber-600"],[1,"space-y-6","min-w-0"],["class","categoria-section min-w-0",4,"ngFor","ngForOf"],[1,"categoria-section","min-w-0"],[1,"flex","items-center","gap-2","mb-3"],[1,"text-amber-600",3,"ngClass"],[1,"text-sm","md:text-base","font-bold","text-amber-900"],[1,"text-xs","text-amber-600","bg-amber-100","px-2","py-0.5","rounded-full"],[1,"relative","carousel-wrapper"],[1,"carousel-nav-btn","carousel-nav-left","hidden","md:flex",3,"click"],[1,"bi","bi-chevron-left"],[1,"carousel-container","gap-3","md:gap-4","pb-2"],["class","exclusive-card flex-shrink-0 w-[140px] md:w-[180px] cursor-pointer group",3,"click",4,"ngFor","ngForOf"],[1,"carousel-nav-btn","carousel-nav-right","hidden","md:flex",3,"click"],[1,"bi","bi-chevron-right"],[1,"text-center","text-[10px]","text-amber-600","mt-2","md:hidden"],[1,"bi","bi-hand-index-thumb"],[1,"exclusive-card","flex-shrink-0","w-[140px]","md:w-[180px]","cursor-pointer","group",3,"click"],[1,"relative","aspect-[4/3]","rounded-xl","overflow-hidden","bg-gray-100","mb-2"],["class","w-full h-full object-cover transition-transform duration-300 group-hover:scale-110","loading","lazy",3,"src","alt",4,"ngIf"],["class","w-full h-full flex items-center justify-center text-gray-300",4,"ngIf"],[1,"absolute","top-2","right-2","bg-amber-500","text-white","text-[10px]","font-bold","px-2","py-0.5","rounded-full","shadow"],[1,"absolute","
1inset-0","bg-black/0","group-hover:bg-black/20","transition-colors","duration-300","flex","items-center","justify-center"],[1,"opacity-0","group-hover:opacity-100","transition-opacity","duration-300","bg-white/90","text-amber-700","text-xs","font-semibold","px-3","py-1.5","rounded-full"],[1,"text-xs","md:text-sm","font-semibold","text-gray-800","line-clamp-2","leading-tight","group-hover:text-amber-700","transition-colors"],[1,"mt-1"],["loading","lazy",1,"w-full","h-full","object-cover","transition-transform","duration-300","group-hover:scale-110",3,"src","alt"],[1,"w-full","h-full","flex","items-center","justify-center","text-gray-300"],[1,"bi","bi-image","text-3xl"],[1,"space-y-0.5"],["class","text-[10px] md:text-xs text-gray-600",4,"ngFor","ngForOf"],[1,"text-[10px]","md:text-xs","text-gray-600"],[1,"font-medium"],[1,"text-amber-600","font-bold","ml-1"],[1,"text-xs","text-amber-600","font-bold"],[1,"text-gray-400","font-normal"],[1,"text-center","py-6","text-amber-700"],[1,"bi","bi-inbox","text-3xl","mb-2"],[1,"text-sm"],[1,"flex","items-center","justify-center","h-full"],[1,"text-[--primary-background-text-color]","text-center"],[1,"flex","flex-col","items-end","text-right"],[1,"text-gray-500","text-sm","font-medium"],[1,"text-[--primary-background-text-color]","font-semibold","text-base","mt-1"],[1,"text-gray-500","text-sm"],["class","mb-4 rounded-lg p-3 flex items-center gap-3 border-2","style","background-color: #fff8e1; border-color: var(--primary-pagination-color);",4,"ngIf"],[1,"mb-4","rounded-lg","p-3","flex","items-center","gap-3","border-2",2,"background-color","#fff8e1","border-color","var(--primary-pagination-color)"],[1,"bi","bi-exclamation-triangle-fill","text-xl",2,"color","var(--primary-pagination-color)"],[1,"text-sm","font-semibold",2,"color","var(--primary-txt-color)"],[1,"flex","items-center","justify-center","w-full","font-bold","text-lg","rounded-full","py-4","px-6","shadow-md","hover:shadow-lg","hover:brightness-110","transform","hover:-translate-y-0.5","transition-all","duration-300",3,"click","routerLink"]],template:function(e,i){e&1&&(s(0,"section",4)(1,"div",5),x(2,id,2,1,"div",6),v(3,"async"),s(4,"div",7)(5,"a",8),T(6,"i",9),s(7,"span",10),p(8),v(9,"translate"),c()()(),s(10,"div",11)(11,"div",12),x(12,vd,2,2,"div",13),v(13,"async"),x(14,_d,5,3,"ng-template",null,0,ve),c(),s(16,"div",14)(17,"div",15)(18,"p",16),p(19),v(20,"translate"),c()(),s(21,"div",17),T(22,"discount-coupon"),c(),s(23,"div",18)(24,"div",19)(25,"p",20),p(26),v(27,"translate"),c(),s(28,"p",21),p(29),v(30,"async"),v(31,"currency"),c()(),x(32,bd,4,2,"div",22),v(33,"async"),c(),s(34,"div",23),x(35,Ed,2,1,"div",24),v(36,"async"),x(37,Sd,3,14,"a",25),v(38,"async"),s(39,"div",26),T(40,"i",27),p(41),v(42,"translate"),c()()()(),s(43,"div",28)(44,"p",29),p(45),v(46,"translate"),c(),s(47,"div",30),T(48,"i",31),s(49,"p",32),p(50,"(54) 3455-2788"),c()()()()()),e&2&&(l(2),h("ngIf",_(3,15,i.cartItems$)),l(3),ye("border-color","var(--primary-background-bg-color)")("color","var(--primary-background-text-color)"),l(3),P(_(9,17,"CART.CONTINUAR-COMPRANDO")),l(4),h("ngIf",_(13,19,i.cartItems$)),l(7),E(" ",_(20,21,"CART-COMPONENT.RESUMO-COMPRA")," "),l(7),E(" ",_(27,23,"CART-COMPONENT.TOTAL")," "),l(3),E(" ",re(31,27,_(30,25,i.cartTotal$),"BRL")," "),l(3),h("ngIf",_(33,30,i.cartTotal$)),l(3),h("ngIf",_(36,32,i.cartItems$)),l(2),h("ngIf",_(38,34,i.cartItems$)),l(4),E(" ",_(42,36,"CART-COMPONENT.COMPRA-SEGURA")," "),l(4),P(_(46,38,"CART-COMPONENT.CENTRAL-VENDAS")))},dependencies:[lt,Ce,oe,Xa,qn,Mi,Kn,Mn,kt,Pe],styles:[".line-clamp-2[_ngcontent-%COMP%]{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}.filter-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;font-size:.8125rem;font-weight:500;background:#fff;border:1px solid #fde68a;border-radius:20px;color:#92400e;cursor:pointer;transition:all .2s ease;white-space:nowrap}.filter-btn[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:.875rem}.filter-btn[_ngcontent-%COMP%]:hover{background:#fef3c7;border-color:#f59e0b}.filter-btn.active[_ngcontent-%COMP%]{background:#f59e0b;border-color:#d97706;color:#fff}.carousel-wrapper[_ngcontent-%COMP%]{position:relative;overflow:hidden;max-width:100%;width:100%}
1.carousel-container[_ngcontent-%COMP%]{display:flex;scroll-snap-type:x mandatory;scroll-behavior:smooth;-webkit-overflow-scrolling:touch;overflow-x:auto;overflow-y:hidden;max-width:100%;box-sizing:border-box;scrollbar-width:none;-ms-overflow-style:none}.carousel-container[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}@media (min-width: 768px){.carousel-container[_ngcontent-%COMP%]{padding:0 48px}}.exclusive-card[_ngcontent-%COMP%]{scroll-snap-align:start;transition:transform .3s ease,box-shadow .3s ease}@media (min-width: 768px){.exclusive-card[_ngcontent-%COMP%]:hover{transform:translateY(-4px)}}@media (max-width: 767px){.exclusive-card[_ngcontent-%COMP%]:first-child{margin-left:0}}@media (max-width: 767px){.exclusive-card[_ngcontent-%COMP%]:last-child{margin-right:16px}}.carousel-nav-btn[_ngcontent-%COMP%]{position:absolute;top:50%;transform:translateY(-50%);z-index:10;display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;border-radius:50%;background:#fff;color:#92400e;box-shadow:0 2px 8px #00000026;cursor:pointer;transition:all .2s ease}.carousel-nav-btn[_ngcontent-%COMP%]:hover{background:#f59e0b;color:#fff;transform:translateY(-50%) scale(1.1)}.carousel-nav-btn[_ngcontent-%COMP%]:active{transform:translateY(-50%) scale(.95)}.carousel-nav-btn[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:1rem}.carousel-nav-left[_ngcontent-%COMP%]{left:4px}.carousel-nav-right[_ngcontent-%COMP%]{right:4px}.categoria-section[_ngcontent-%COMP%]{overflow:hidden;max-width:100%}.categoria-section[_ngcontent-%COMP%]:not(:last-child){padding-bottom:20px;border-bottom:1px dashed rgba(245,158,11,.3)}.scrollbar-hide[_ngcontent-%COMP%]{scrollbar-width:none;-ms-overflow-style:none}.scrollbar-hide[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.exclusive-card[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_fadeInUp .4s ease forwards}.exclusive-card[_ngcontent-%COMP%]:nth-child(1){animation-delay:.
105s}.exclusive-card[_ngcontent-%COMP%]:nth-child(2){animation-delay:.1s}.exclusive-card[_ngcontent-%COMP%]:nth-child(3){animation-delay:.15s}.exclusive-card[_ngcontent-%COMP%]:nth-child(4){animation-delay:.2s}.exclusive-card[_ngcontent-%COMP%]:nth-child(5){animation-delay:.25s}.exclusive-card[_ngcontent-%COMP%]:nth-child(6){animation-delay:.3s}.exclusive-card[_ngcontent-%COMP%]:nth-child(7){animation-delay:.35s}.exclusive-card[_ngcontent-%COMP%]:nth-child(8){animation-delay:.4s}.exclusive-card[_ngcontent-%COMP%]:nth-child(9){animation-delay:.45s}.exclusive-card[_ngcontent-%COMP%]:nth-child(10){animation-delay:.5s}"]})}};function Es(){return n=>{if(!n.value)return null;let e=String(n.value).trim().toUpperCase().replace(/[^A-Z0-9]/g,"");return/^[A-Z0-9]{6,20}$/.test(e)?null:{passaportInvalido:!0}}}function yd(n,t){if(n?.telefonePix)return n.telefonePix;if(n?.telefoneInternacional){let e=n?.ddiTelefone||"";return e?`${e}${n.telefoneInternacional}`:n.telefoneInternacional}if(n?.telefone){let e=n?.ddi||n?.nrDdi||"";return e?`${e}${n.telefone}`:n.telefone}return t?.nrTelCelular?t.nrTelCelular:null}function Zn(n,t,e=null,i,r,o){let a=new Date,u=t[0]?.cupom?.cdCupom??null,d=yd(e,n),m={idReserva:0,dtReserva:Td(a),flFaturado:!1,flProcessarCartao:!1,flPix:!1,flCheckOut:!1,idCliente:0,qrCodePix:null,Cliente:{nmCliente:n.nmCliente||null,nrDocumento:n.nrDocumento?n.nrDocumento:r||o,dsEmail:n.dsEmail||null,nrFone:d,dsEndereco:e?.endereco||null,dsNumero:e?.numero||null,idCidade:0,nrCEP:e?.cep||"0",nmBairro:e?.nmBairro||"0",nmCidade:e?.nmCidade||"0",cdUF:e?.nmUf||null,idPais:0},nrLocalizador:"",nmTitular:e?.nmTitular||n.nmCliente||null,dsEmailTitular:e?.dsEmail||n.dsEmail||null,nrTelefone:d,nrWhatsApp:null,dsIdioma:"Portugu\xEAs",dsSiglaMoeda:"BRL",dtChegada:null,dtSaida:null,idHotel:0,dsSituacao:null,QuartosOmnibees:null,Pagamentos:null,cdCupom:u||null,Pacote:null,Cartao:null,idPacoteOpcao:0,nmGrupoPacote:null,cdAfiliado:null,idLink:0,idPdv:0,idEvento:0,nmPOS:null,dsLogin:null,idTipoContato:0,vlCotacao:0};return console.log(m,"reservaRequest##"),m}function Td(n){let t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),i=String(n.getDate()).padStart(2,"0"),r=String(n.getHours()).padStart(2,"0"),o=String(n.getMinutes()).padStart(2,"0"),a=String(n.getSeconds()).padStart(2,"0");return`${t}-${e}-${i}T${r}:${o}:${a}`}var Ss=[{code:"BR",name:"Brasil",nameEn:"Brazil",nameEs:"Brasil",zipCodeFormat:"00000-000",dialCode:"+55"},{code:"AR",name:"Argentina",nameEn:"Argentina",nameEs:"Argentina",zipCodeFormat:"0000",dialCode:"+54"},{code:"UY",name:"Uruguai",nameEn:"Uruguay",nameEs:"Uruguay",zipCodeFormat:"00000",dialCode:"+598"},{code:"PY",name:"Paraguai",nameEn:"Paraguay",nameEs:"Paraguay",zipCodeFormat:"0000",dialCode:"+595"},{code:"CL",name:"Chile",nameEn:"Chile",nameEs:"Chile",zipCodeFormat:"0000000",dialCode:"+56"},{code:"US",name:"Estados Unidos",nameEn:"United States",nameEs:"Estados Unidos",zipCodeFormat:"00000",dialCode:"+1"},{code:"CA",name:"Canad\xE1",nameEn:"Canada",nameEs:"Canad\xE1",zipCodeFormat:"A0A 0A0",dialCode:"+1"},{code:"MX",name:"M\xE9xico",nameEn:"Mexico",nameEs:"M\xE9xico",zipCodeFormat:"00000",dialCode:"+52"},{code:"CO",name:"Col\xF4mbia",nameEn:"Colombia",nameEs:"Colombia",zipCodeFormat:"000000",dialCode:"+57"},{code:"PE",name:"Peru",nameEn:"Peru",nameEs:"Per\xFA",zipCodeFormat:"00000",dialCode:"+51"},{code:"BO",name:"Bol\xEDvia",nameEn:"Bolivia",nameEs:"Bolivia",zipCodeFormat:"0000",dialCode:"+591"},{code:"VE",name:"Venezuela",nameEn:"Venezuela",nameEs:"Venezuela",zipCodeFormat:"0000",dialCode:"+58"},{code:"EC",name:"Equador",nameEn:"Ecuador",nameEs:"Ecuador",zipCodeFormat:"000000",dialCode:"+593"},{code:"PT",name:"Portugal",nameEn:"Portugal",nameEs:"Portugal",zipCodeFormat:"0000-000",dialCode:"+351"},{code:"ES",name:"Espanha",nameEn:"Spain",nameEs:"Espa\xF1a",zipCodeFormat:"00000",dialCode:"+34"},{code:"FR",name:"Fran\xE7a",nameEn:"France",nameEs:"Francia",zipCodeFormat:"00000",dialCode:"+33"},{code:"IT",name:"It\xE1lia",nameEn:"Italy",nameEs:"Italia",zipCodeFormat:"00000",dialCode:"+39"},{code:"DE",name:"Alemanha",nameEn:"Germany",nameEs:"Alemania",zipCodeFormat:"00000",dialCode:"+49"},{code:"GB",name:"Reino Unido",nameEn:"United Kingdom",nameEs:"Reino Unido",zipCodeFormat:"AA0A 0AA",dialCode:"+44"},{code:"CH",name:"Su\xED\xE7a",nameEn:"Switzerland",nameEs:"Suiza",zipCodeFormat:"0000",dialCode:"+41"},{code:"JP",name:"Jap\xE3o",nameEn:"Japan",nameEs:"Jap\xF3n",zipCodeFormat:"000-0000",dialCode:"+81"},{code:"CN",name:"China",nameEn:"China",nameEs:"China",zipCodeFormat:"000000",dialCode:"+86"},{code:"AU",name:"Austr\xE1lia",nameEn:"Australia",nameEs:"Australia",zipCodeFormat:"0000",dialCode:"+61"},{code:"NZ",name:"Nova Zel\xE2ndia",nameEn:"New Zealand",nameEs:"Nueva Zelanda",zipCodeFormat:"0000",dialCode:"+64"},{code:"ZA",name:"\xC1frica do Sul",nameEn:"South Africa",nameEs:"Sud\xE1frica",zipCodeFormat:"0000",dialCode:"+27"},{code:"IN",name:"\xCDndia",nameEn:"India",nameEs:"India",zipCodeFormat:"000000",dialCode:"+91"},{code:"RU",name:"R\xFAssia",nameEn:"Russia",nameEs:"Rusia",zipCodeFormat:"000000",dialCode:"+7"},{code:"OTHER",name:"Outro",nameEn:"Other",nameEs:"Otro",zipCodeFormat:void 0,dialCode:void 0}];var Qt={PIX:"PIX",CARTAO:"CART\xC3O"},no={PIX:"P",CARTAO:"C"};var Ze={ADULT:"ADT",SENIOR:"MELHORIDADE",CHILD_6_12:"CHD6A12",CHILD_3_5:"CHD3A5",LAP_INFANT:"COLO"},Fi={[Ze.ADULT]:"ADULTO",[Ze.SENIOR]:"MELHORIDADE",[Ze.CHILD_6_12]:"CHD6A12",[Ze.CHILD_3_5]:"CHD3A5",[Ze.LAP_INFANT]:"COLO"},j={VISA:"visa",MASTERCARD:"mastercard",ELO:"Elo",AMEX:"American Express",DISCOVER:"Discover",HIPERCARD:"Hipercard"},_t={[j.MASTERCARD]:"../assets/img/logos/mastercard.png",[j.VISA]:"../assets/img/logos/visa.jpg",[j.ELO]:"../assets/img/logos/cartao-elo.jpg",[j.AMEX]:"../assets/img/logos/amex.jpg",[j.DISCOVER]:"../assets/img/logos/discover.jpg",[j.HIPERCARD]:"../assets/img/logos/hipercard.jpg"},Jt={[j.ELO]:/^(4011|4312|4389|4514|4576|5041|5067|5090|6277|6362|6363|650[0-9]{1}|651[6-9]|652[0-9]{1}|653[0-9]{1}|654[0-9]{1}|6550)/,[j.MASTERCARD]:/^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$/,[j.AMEX]:/^3[47]/,[j.DISCOVER]:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,[j.VISA]:/^4/,[j.HIPERCARD]:/^(38|60|62)/},Xe={AMEX:"0000",DEFAULT:"000"},Ct={CEP:/^\d{8}$/,PHONE:/^\d{10,11}$/,CARD_NUMBER_15:/^\d{15}$/,CARD_NUMBER_16:/^\d{16}$/},rn={MAX_PARCELAS:1,CATEGORIA_VEICULO_ID:1,SERVICO_DATA_DEFAULT:"0001-01-01T00:00:00",PAIS_PADRAO:"Brasil"},ei={USER_NOT_FOUND:"Usu\xE1rio n\xE3o encontrado",EMPTY_CART:"Seu carrinho est\xE1 vazio. Adicione itens antes de finalizar a compra.",PAYMENT_ERROR:"Ocorreu um erro ao processar o pagamento. Por favor, tente novamente ou utilize outra forma de pagamento.",PAYMENT_CONFIRMED:"Pagamento confirmado!",INVALID_QR_CODE_DATA:"Dados insuficientes para salvar QR Code PIX",INVALID_VENDA_ID:"ID da venda n\xE3o encontrado",INVALID_EXPIRATION_DATE:"Data de expira\xE7\xE3o do QR Code inv\xE1lida",QR_CODE_SAVE_ERROR:"N\xE3o foi poss\xEDvel salvar os dados do pagamento PIX"},Xn={BOOKING:"book"};var Qn=class n{constructor(t){this.http=t}getByCEP(t){return t&&t.replace(/\D/g,"").length===8?this.http.get(`https://viacep.com.br/ws/${t.replace(/\D/g,"")}/json/`):_e(null)}static{this.\u0275fac=function(e){return new(e||n)(Y(Le))}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Jn=class n{constructor(t){this.store=t}buildPaymentRequest(t,e,i,r,o,a,u,d){let m=new Date,I=e[0]?.cupom?.cdCupom??null,y=e.flatMap(B=>B.passageiros&&B.passageiros.length>0?B.passageiros:B.product.Book?.passengers||[]),S=this.buildPagamentoSoftTur(r,i,o,t),k=this.buildPagamentosGestor(r,i,o,a,u),g=this.buildTiposPessoas(y),A=this.buildNomesPax(y),$=this.buildPax(y),ue=this.buildVendaItens(e),te=this.buildServicos(e),q=this.buildCartao(r,i,t,o),me=this.buildPixInfo(r,i,t);debugger;console.log("=== DEBUG formValue ===",r);let Re=Zn(t,e,r,i,r.cpfUsuarioPix,r.documentoTitular||r.cpfTitular),fe=(r.formaPagamento||"").toUpperCase()===Qt.PIX;Re.flPix=fe,Re.flProcessarCartao=!fe;let $e=U(ie(U({},Re),{cupom:I,Servicos:te,NomesPax:A,Pax:$}),fe?{PixInfo:me}:{Cartao:q}),Ae=e.reduce((B,N)=>B+(N.desconto||0),0);return{idVenda:0,idCestoCompra:d?.idCestoCompra??null,nrSession:d?.nrSession??null,dtVenda:this.formatLocalDateTime(m),vlTotal:i,vlDesconto:Ae,idCliente:t.idCliente,nmTitular:t.nmCliente,Cliente:this.buildCliente(t,r),VendaItens:ue,TiposPessoas:g,Pagamentos:k,cupom:I,ReservaRequest:$e}}buildPagamentoSoftTur(t,e,i,r){let o=this.extractCardInfo(t.nmCartao),a=(t.formaPagamento||"").toUpperCase()===Qt.PIX;return[{idPedidoOrdem:null,nrDocumento:t.documentoTitular||t.cpfTitular||r.nrDocumento||null,tpDocumento:t.tipoDocumento||"CPF",nmCliente:t.nmTitular||r.nmCliente||null,nrFone:r.nrTelCelular||null,dtNascimento:null,dsEmail:r.dsEmail||null,nrCEP:t.cep||null,dsLograduro:t.endereco||null,nrPredial:t.numero||null,dsComplemento:t.complemento||null,dsBairro:t.nmBairro||null,
1nmCidade:t.nmCidade||null,nmEstado:t.nmUf||null,nmPais:t.nmPais||null,vlPagamento:e,nmBandeira:i||null,nmPortador:t.nmTitular||null,nrCartao:t.nmCartao||null,nrMesValidade:t.validade?t.validade.substring(0,2):null,nrAnoValidade:t.validade?t.validade.slice(-2):null,nrParcelas:a?1:parseInt((t.parcelamento||"1").replace("x",""),10),nrCVV:t.cvv||null}]}buildPagamentosGestor(t,e,i,r,o){let a=new Date,u=null,d=null;t.validade&&(t.validade.includes("/")?([u,d]=t.validade.split("/"),d=d?d.slice(-2):null):(u=t.validade.substring(0,2),d=t.validade.slice(-2)));let m=t.formaPagamento,I=r.find(g=>g.nmTipoFormaPagto===m)?.idTipoFormaPagto,y=this.extractCardInfo(t.nmCartao),S=(t.formaPagamento||"").toUpperCase()===Qt.PIX,k=S?1:parseInt((t.parcelamento||"1").replace("x",""),10);return[{idPagamento:0,idVenda:0,idFormaPagamento:o.find(g=>g.nmFormaPagamento===i)?.idFormaPagamento||0,dtPagamento:this.formatLocalDateTime(a),vlPagamento:e,nmTitularCartao:t.nmTitular||null,nrDocumento:t.documentoTitular||t.cpfTitular||null,nrMesVencimento:u||null,nrAnoVencimento:d||null,nrCVV:t.cvv||null,nmCartao:t.nmCartao||null,cvvCartao:t.cvv||null,nrCartao:t.nmCartao||null,nrInicioCartao:y.nrInicioCartao,nrFinalCartao:y.nrFinalCartao,nrParcelas:k,FormasPagamento:{idTipoFormaPagto:I,idFormaPagamento:t.idFormaPagamento,nmFormaPagamento:m,nmBandeira:i||null,tpFormaPagamento:S?no.PIX:no.CARTAO},parcelas:k}]}buildCartao(t,e,i,r){let o=t.parcelamento||t.parcelas||"1";return{dtNascimento:null,vlPagamento:e,dsBairro:t.nmBairro,nmCidade:t.nmCidade,nmEstado:t.nmUf,nmPais:t.nmPais,dsEmail:i.dsEmail||null,nrCEP:t.cep||null,nrPredial:t.numero||null,nmCliente:t.nmTitular||null,nrDocumento:t.documentoTitular||t.cpfTitular||null,tpDocumento:t.tipoDocumento||"CPF",dsLograduro:t.endereco||null,dsComplemento:t.complemento||null,nmBandeira:r||null,nmPortador:t.nmTitular||null,nrCartao:t.nmCartao||null,nrMesValidade:t.validade?t.validade.substring(0,2):null,nrAnoValidade:t.validade?t.validade.slice(-4):null,nrParcelas:parseInt(String(o).replace("x",""),10)||1,nrCVV:t.cvv||null}}buildPixInfo(t,e,i){let r=i.nrDocumento||t.cpfUsuarioPix||t.documentoTitular||t.cpfTitular,o=new Date;o.setMinutes(o.getMinutes()+10);let a=this.formatLocalDateTime(o);return{idReserva:0,idVenda:0,idEmpresa:0,dtExpiracao:a,dt1Vencimento:a,vlCobranca:e,dsInfoAdicionais:"Cobran\xE7a Cart: ",nrParcelas:0,dtServicos:rn.SERVICO_DATA_DEFAULT,nmCliente:i.nmCliente||null,tpDoc:"CPF",nrCPFCNPJ:r,dsEmail:i.dsEmail||null,idPedidoOrdem:null,nrDocumento:r,nrCelular:t.telefone||i.nrTelCelular||null,dsCEP:null,nmLogradouro:null,numero:null,dsComplemento:t.complemento,nmPais:t.nmPais,nmBairro:t.nmBairro,nmCidade:t.nmCidade,nmEstado:t.nmUf,idCidade:0,idPais:0,Pais:null,quartos:[]}}buildTiposPessoas(t){return t.map(e=>({idPax:e.idPax||0,nmPax:e.nome,vlUnitario:e.vlPax,nrQtde:1,vlVenda:e.vlPax,tpPax:e.tpParametro?.toUpperCase()}))}buildNomesPax(t){return t.map((e,i)=>({idPax:e.idPax||1,dsNome:e.nome||null,dsTipoDocto:e.tipoDocumento||null,nrDocto:e.numeroDocumento||null,dtNascimento:e.dataNascimento||null,dsNacionalidade:null,tpPax:e.tpParametro||Fi[Ze.ADULT],dsDeficiencia:"",idProduto:null,nrPlaca:null,nmVeiculo:null,nmProdutoCardapio:null,tpSexo:null,flRefeicaoEspecial:!1}))}buildPax(t){let e=new Map;return t.forEach(i=>{let r=(i.tpParametro||i.tipo||Fi[Ze.ADULT]).toString().toUpperCase(),o=i.vlPax||null;if(e.has(r)){let a=e.get(r);a.nrQtde+=1,a.vlVenda=a.vlUnitario&&a.nrQtde?a.vlUnitario*a.nrQtde:null}else e.set(r,{idPax:i.idPax,nmPax:i.nome,vlUnitario:o,nrQtde:1,vlVenda:o,tpPax:r})}),Array.from(e.values())}buildVendaItens(t){return t.map(e=>{let i=e.passageiros&&e.passageiros.length>0?e.passageiros:e.product.Book?.passengers||[],r=e.product.Book?.vlVenda||0,o=this.resolveVendaItemId(e),a=i.map((u,d)=>({idPax:u.idPax||1,nmPax:u.nmPax,nome:u.nome,idTipoPessoa:1,vlCusto:r,vlUnitario:u.vlPax||null,nrQtde:1,vlCobrado:r,vlVenda:r,tpPax:u.tpParametro||Fi[Ze.ADULT]}));return{idVenda:0,idItem:o,dtReserva:this.formatDateForReservation(e.product.Book?.date),hrReserva:e.product.Book?.timeOfDeparture||null,TiposPessoas:a,qtPax:a.length,vlDesconto:e.desconto||0,vlItem:e.precoComDesconto+(e.desconto||0),vlTotal:e.precoComDesconto}})}buildServicos(t){return t.filter(e=>!!e.product.Book?.date).map(e=>{let i=e.passageiros&&e.passageiros.length>0?e.passageiros:e.product.Book?.passengers||[],r=this.resolveServicoItemId(e),o=this.buildPaxForServico(i),a=this.buildNomesPaxForServico(i),{ItensCombo:u,hrPartida:d,hrRetorno:m}=this.buildItensCombo(e),I=e.product.tarifarioData?.idTipoTabela||null,y;if(Array.isArray(e.product.PacoteTrem)&&e.product.PacoteTrem.length>0){let $=e.product.PacoteTrem[0];$?.Categorias&&Array.isArray($.Categorias)&&$.Categorias.length>0&&(y=$.Categorias[0]?.idCategoria)}y||(y=pe.CATEGORIAVEICULOID===1?1:41);let S=this.hasLocalEmbarquePadrao(e.product),k=S?{idPlace:"SEMLOCAL",dsEndereco:"",nrLatLng:""}:null,g=!S&&e.product.Book?.localEmbarqueId?{idPlace:String(e.product.Book.localEmbarqueId),dsEndereco:e.product.Book.localEmbarqueNome||"",nrLatLng:""}:null,A=S?"Sem Local":e.product.Book?.localEmbarqueNome||null;return{id:0,idItem:r,nmItem:e.product.ValoresData?.dsItem||null,dsTipo:e.product.ValoresData?.dsTipo||null,nmCategoria:e.product.PacoteTrem?.nmCategoria||null,idCidade:e.product.PacoteTrem?.idCidade||0,dtServico:this.formatDateForReservation(e.product.Book?.date),hrServico:d,hrRetorno:m,vlDesconto:e.desconto||0,vlTotal:e.precoComDesconto,dtOut:null,Pax:o,NomesPax:a,ItensCombo:u,dsObservacoes:null,dsInformacoes:null,dsRoteiro:null,nrVoo:"",hrVoo:null,dsLocalEmbarque:A,dsLocalDesembarque:"",LocalEmbarque:k||g,idCategoriaVeiculo:y,idLocalTransfer:e.product.Book?.localEmbarqueId||0,idLocalTransferDesembarque:0,idTipoTabela:I}})}formatDateForReservation(t){if(!t)return null;if(t instanceof Date){let a=t.getFullYear(),u=String(t.getMonth()+1).padStart(2,"0"),d=String(t.getDate()).padStart(2,"0");return`${a}-${u}-${d}T00:00:00`}let e=t.split("T")[0],[i,r,o]=e.split("-").map(Number);return!i||!r||!o?t:`${e}T00:00:00`}buildPaxForServico(t){let e=new Map;return t.forEach(i=>
1{let r=i.tipo||Fi[Ze.ADULT],o=i.vlPax||null;if(e.has(r)){let a=e.get(r);a.nrQtde+=1,a.vlVenda=a.vlUnitario&&a.nrQtde?a.vlUnitario*a.nrQtde:null}else e.set(r,{idPax:i.idPax||1,nmPax:null,nrQtde:1,vlUnitario:o,vlVenda:o,tpPax:r})}),Array.from(e.values())}buildNomesPaxForServico(t){return t.map((e,i)=>({idPax:e.idPax||1,dsNome:e.nome||null,dsTipoDocto:e.tipoDocumento||null,nrDocto:e.numeroDocumento||null,dtNascimento:e.dataNascimento||null,dsNacionalidade:null,tpPax:e.tipo||Fi[Ze.ADULT],dsDeficiencia:"",idProduto:null,nrPlaca:null,nmVeiculo:null,nmProdutoCardapio:null,tpSexo:null,flRefeicaoEspecial:!1}))}buildItensCombo(t){let e=[],i=null,r=null,o=this.resolveServicoItemId(t),a=t.product.Book?.timeOfDeparture,u=t.product.Book?.timeOfArrival;console.log("=== DEBUG buildItensCombo ==="),console.log("timeOfDeparture do Book:",a),console.log("timeOfArrival do Book:",u),console.log("horariosItensCombo:",t.product.Book?.horariosItensCombo);let d=t.product.Book?.horariosItensCombo,m=this.formatDateForReservation(t.product.Book?.date);if(d&&Object.keys(d).length>0){e=Object.entries(d).map(([y,S])=>({idItem:parseInt(y),dtServico:m,hrServico:S.ida||S.hrServico||S.hora||null,hrRetorno:S.volta||S.hrRetorno||null,fltrem:this.isTruthyFlag(S.fltrem??S.flTrem)}));let I=Object.entries(d).find(([y,S])=>{let k=S.ida||S.hrServico||S.hora||null,g=this.isTruthyFlag(S.fltrem??S.flTrem),A=t.product?.ItensCombo?.find(q=>(q.IdItem??q.idItem)===parseInt(y)),$=(A?.dsItem||"").toLowerCase(),ue=this.isTruthyFlag(A?.flTrem??A?.fltrem),te=$.includes("sa\xEDda de trem")||$.includes("saida de trem")||$.includes("maria fuma\xE7a")||$.includes("maria fumaca")||$.includes("trem pampa")||$.includes("trem do pampa");return!this.isHorarioSemHora(k)&&(g||ue||te)});if(I){let[,y]=I;i=y.ida||y.hrServico||y.hora||null,r=y.volta||y.hrRetorno||null}else{let y=Object.values(d).find(S=>!this.isHorarioSemHora(S?.ida||S?.hrServico||S?.hora));i=y?.ida||y?.hrServico||y?.hora||null,r=y?.volta||y?.hrRetorno||null}}else i=a||null,r=u||null,e=[{idItem:o,dtServico:m,hrServico:i,hrRetorno:r,fltrem:!1}];return{ItensCombo:e,hrPartida:i,hrRetorno:r}}resolveVendaItemId(t){let i=[t.product?.idItem,t.product?.Book?.idItemGestor,t.product?.ValoresData?.idItemGestor,t.product?.ValoresData?.IdItemGestor,t.product?.Book?.idItem].map(r=>Number(r)).find(r=>Number.isFinite(r)&&r>0);return i||console.warn("Nao foi possivel resolver idItem para VendaItens do checkout.",{productId:t.product?.idItem,idItemGestor:t.product?.Book?.idItemGestor,bookIdItem:t.product?.Book?.idItem}),i??0}resolveServicoItemId(t){let i=[t.product?.Book?.idItemSistema,t.product?.ValoresData?.idItemSistema,t.product?.ValoresData?.IdItemSistema,t.product?.idItemSistema,t.product?.IdItemSistema,t.product?.Book?.idItem,t.product?.ValoresData?.IdItem,t.product?.ValoresData?.idItem].map(r=>Number(r)).find(r=>Number.isFinite(r)&&r>0);return i||console.warn("Nao foi possivel resolver idItemSistema para Servicos do checkout.",{productId:t.product?.idItem,idItemSistema:t.product?.idItemSistema,bookIdItem:t.product?.Book?.idItem,idItemGestor:t.product?.Book?.idItemGestor}),i??0}formatLocalDateTime(t){let e=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),u=String(t.getSeconds()).padStart(2,"0");return`${e}-${i}-${r}T${o}:${a}:${u}`}hasLocalEmbarquePadrao(t){return[t?.ValoresData,t?.tarifarioData,t].some(i=>this.isTruthyFlag(i?.flLocalEmbPadrao??i?.flLocalEmbarquePadrao??i?.localEmbarquePadrao??i?.localdeEmba??i?.localdeEmbarquePadrao??i?.localdeEmbaquePadrao))}isTruthyFlag(t){if(t===!0||t===1)return!0;if(typeof t=="string"){let e=t.trim().toLowerCase();return["true","1","s","sim"].includes(e)}return!1}isHorarioSemHora(t){return!t||t==="00:00"||t==="0:00"}buildCliente(t,e){let i=t.nrDocumento||e.cpfUsuarioPix||e.documentoTitular||e.cpfTitular,r=e.telefone||t.nrTelCelular||null;return{idCliente:t.idCliente,nrDocumento:i,nmCliente:t.nmCliente,dsEmail:t.dsEmail||null,nrTelCelular:r,dsComplemento:e.complemento||null,
1nrCEP:e.cep||null,nrRua:e.endereco||null,cdIBGECidade:e.cdIBGECidade||"0",cdUF:e.nmUf||null,dsEndereco:e.endereco||null,dsNumero:e.numero||null,idCidade:e.idCidade||0,idPais:e.idPais||0,nmBairro:e.nmBairro||"0",nmCidade:e.nmCidade||"0",nrFone:r}}extractCardInfo(t){if(!t)return{nrInicioCartao:"",nrFinalCartao:""};let e=t.replace(/\D/g,""),i=e.substring(0,4)||"",r=e.slice(-4)||"";return{nrInicioCartao:i,nrFinalCartao:r}}static{this.\u0275fac=function(e){return new(e||n)(Y(Ie))}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};var er=class n{identifyCardBrand(t){if(!t)return null;let e=t.replace(/\s+/g,"");return Jt[j.ELO].test(e)?{brand:j.ELO,image:_t[j.ELO],cvvMask:Xe.DEFAULT}:Jt[j.MASTERCARD].test(e)?{brand:j.MASTERCARD,image:_t[j.MASTERCARD],cvvMask:Xe.DEFAULT}:Jt[j.AMEX].test(e)?{brand:j.AMEX,image:_t[j.AMEX],cvvMask:Xe.AMEX}:Jt[j.DISCOVER].test(e)?{brand:j.DISCOVER,image:_t[j.DISCOVER],cvvMask:Xe.DEFAULT}:Jt[j.VISA].test(e)?{brand:j.VISA,image:_t[j.VISA],cvvMask:Xe.DEFAULT}:Jt[j.HIPERCARD].test(e)?{brand:j.HIPERCARD,image:_t[j.HIPERCARD],cvvMask:Xe.DEFAULT}:null}getCvvMask(t){return t===j.AMEX?Xe.AMEX:Xe.DEFAULT}getCvvMaxLength(t){return t===j.AMEX?4:3}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Li=class n{salvarQrCode(t){try{if(console.log("=== DEBUG salvarQrCode ==="),console.log("reserva completa:",t),console.log("ReservaResponse:",t?.ReservaResponse),console.log("Reserva:",t?.ReservaResponse?.Reserva),console.log("QrCodePix:",t?.ReservaResponse?.Reserva?.QrCodePix),console.log("=========================="),!t?.ReservaResponse?.Reserva?.QrCodePix?.cdCopia||!t?.ReservaResponse?.Reserva?.QrCodePix?.dtExpiracao){console.warn("Dados insuficientes para salvar QR Code PIX"),console.warn("cdCopia:",t?.ReservaResponse?.Reserva?.QrCodePix?.cdCopia),console.warn("dtExpiracao:",t?.ReservaResponse?.Reserva?.QrCodePix?.dtExpiracao);return}let e=t.idVenda;if(!e)throw new Error(ei.INVALID_VENDA_ID);let i=t.ReservaResponse.Reserva.QrCodePix.dtExpiracao,r;if(i.includes("Z")||i.includes("+")||i.match(/-\d{2}:\d{2}$/))r=new Date(i);else{let a=i.match(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/);if(a){let[,u,d,m,I,y,S]=a;r=new Date(parseInt(u),parseInt(d)-1,parseInt(m),parseInt(I),parseInt(y),parseInt(S))}else r=new Date(i)}if(isNaN(r.getTime()))throw new Error(ei.INVALID_EXPIRATION_DATE);let o={idVenda:e,Reserva:t,dtExpiracao:r.getTime(),dtCriacao:new Date().getTime()};localStorage.setItem(Xn.BOOKING,JSON.stringify(o)),console.log(`QR Code da venda ${e} salvo com sucesso at\xE9 ${r.toLocaleString("pt-BR")}`)}catch(e){throw console.error("Erro ao salvar QR Code PIX:",e),e instanceof Error?e.message:ei.QR_CODE_SAVE_ERROR}}getReservaSalva(){try{let t=localStorage.getItem(Xn.BOOKING);if(!t)return null;let e=JSON.parse(t),i=new Date().getTime();return e.dtExpiracao&&i>e.dtExpiracao?(console.log("Reserva expirada, removendo..."),this.limparReserva(),null):e}catch(t){return console.error("Erro ao recuperar reserva:",t),this.limparReserva(),null}}limparReserva(){try{localStorage.removeItem(Xn.BOOKING),console.log("Reserva removida do localStorage")}catch(t){console.error("Erro ao limpar reserva:",t)}}hasReservaSalva(){return this.getReservaSalva()!==null}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};var tr=class n{constructor(t){this.http=t;this.baseUrl="https://api.zippopotam.us"}searchByZipCode(t,e){let i=e.replace(/[^a-zA-Z0-9]/g,"");if(!i||i.length<3)return _e({success:!1,error:"C\xF3digo postal inv\xE1lido"});let r=this.getApiCountryCode(t);if(!r)return _e({success:!1,error:"Pa\xEDs n\xE3o suportado para busca autom\xE1tica"});let o=`${this.baseUrl}/${r}/${i}`;return this.http.get(o).pipe(we(a=>
1this.parseResponse(a)),xe(a=>(console.error("Erro ao buscar ZIP Code:",a),_e({success:!1,error:"C\xF3digo postal n\xE3o encontrado"}))))}getApiCountryCode(t){let e=t.toLowerCase();return["us","ca","mx","ar","br","cl","co","gb","de","fr","es","it","pt","ch","nl","au","nz","in","jp","za"].includes(e)?e:null}parseResponse(t){if(!t||!t.places||t.places.length===0)return{success:!1,error:"Nenhum endere\xE7o encontrado"};let e=t.places[0];return{success:!0,city:e["place name"],state:e.state,stateAbbr:e["state abbreviation"],country:t.country,zipCode:t["post code"]}}isCountrySupported(t){return this.getApiCountryCode(t)!==null}getSupportedCountries(){return["US","CA","MX","AR","BR","CL","CO","GB","DE","FR","ES","IT","PT","CH","NL","AU","NZ","IN","JP","ZA"]}static{this.\u0275fac=function(e){return new(e||n)(Y(Le))}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};var u_=ct("[User] Load User"),p_=ct("[User] Load User Success",At()),m_=ct("[User] Load User Failure",At()),h_=ct("[User] Update User",At()),f_=ct("[Auth] Login",At()),on=ct("[User] Set User",At()),Ts=ct("[Auth] Logout"),g_=ct("[Auth] Login Attempt",At()),v_=ct("[Auth] Login Failure",At());var Ps=()=>{};var Os=function(n){let t=[],e=0;for(let i=0;i<n.length;i++){let r=n.charCodeAt(i);r<128?t[e++]=r:r<2048?(t[e++]=r>>6|192,t[e++]=r&63|128):(r&64512)===55296&&i+1<n.length&&(n.charCodeAt(i+1)&64512)===56320?(r=65536+((r&1023)<<10)+(n.charCodeAt(++i)&1023),t[e++]=r>>18|240,t[e++]=r>>12&63|128,t[e++]=r>>6&63|128,t[e++]=r&63|128):(t[e++]=r>>12|224,t[e++]=r>>6&63|128,t[e++]=r&63|128)}return t},wd=function(n){let t=[],e=0,i=0;for(;e<n.length;){let r=n[e++];if(r<128)t[i++]=String.fromCharCode(r);else if(r>191&&r<224){let o=n[e++];t[i++]=String.fromCharCode((r&31)<<6|o&63)}else if(r>239&&r<365){let o=n[e++],a=n[e++],u=n[e++],d=((r&7)<<18|(o&63)<<12|(a&63)<<6|u&63)-65536;t[i++]=String.fromCharCode(55296+(d>>10)),t[i++]=String.fromCharCode(56320+(d&1023))}else{let o=n[e++],a=n[e++];t[i++]=String.fromCharCode((r&15)<<12|(o&63)<<6|a&63)}}return t.join("")},ir={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,t){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();let e=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let r=0;r<n.length;r+=3){let o=n[r],a=r+1<n.length,u=a?n[r+1]:0,d=r+2<n.length,m=d?n[r+2]:0,I=o>>2,y=(o&3)<<4|u>>4,S=(u&15)<<2|m>>6,k=m&63;d||(k=64,a||(S=64)),i.push(e[I],e[y],e[S],e[k])}return i.join("")},encodeString(n,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(n):this.encodeByteArray(Os(n),t)},decodeString(n,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(n):wd(this.decodeStringToByteArray(n,t))},decodeStringToByteArray(n,t){this.init_();let e=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let r=0;r<n.length;){let o=e[n.charAt(r++)],u=r<n.length?e[n.charAt(r)]:0;++r;let m=r<n.length?e[n.charAt(r)]:64;++r;let y=r<n.length?e[n.charAt(r)]:64;if(++r,o==null||u==null||m==null||y==null)throw new oo;let S=o<<2|u>>4;if(i.push(S),m!==64){let k=u<<4&240|m>>2;if(i.push(k),y!==64){let g=m<<6&192|y;i.push(g)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}},oo=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},Rd=function(n){let t=Os(n);return ir.encodeByteArray(t,!0)},so=function(n){return Rd(n).replace(/\./g,"")},nr=function(n){try{return ir.decodeString(n,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};function ws(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Dd=()=>ws().__FIREBASE_DEFAULTS__,Nd=()=>
vendor: 21,225 bytes, lines 1-15
1{if(typeof process>"u"||typeof process.env>"u")return;let n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Md=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let t=n&&nr(n[1]);return t&&JSON.parse(t)},lo=()=>{try{return Ps()||Dd()||Nd()||Md()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Rs=n=>{var t,e;return(e=(t=lo())===null||t===void 0?void 0:t.emulatorHosts)===null||e===void 0?void 0:e[n]};var co=()=>{var n;return(n=lo())===null||n===void 0?void 0:n.config},uo=n=>{var t;return(t=lo())===null||t===void 0?void 0:t[`_${n}`]};var ti=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}wrapCallback(t){return(e,i)=>{e?this.reject(e):this.resolve(i),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(e):t(e,i))}}};function sn(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}function Ds(n){return b(this,null,function*(){return(yield fetch(n,{credentials:"include"})).ok})}var an={};function Fd(){let n={prod:[],emulator:[]};for(let t of Object.keys(an))an[t]?n.emulator.push(t):n.prod.push(t);return n}function Ld(n){let t=document.getElementById(n),e=!1;return t||(t=document.createElement("div"),t.setAttribute("id",n),e=!0),{created:e,element:t}}var ks=!1;function Ns(n,t){if(typeof window>"u"||typeof document>"u"||!sn(window.location.host)||an[n]===t||an[n]||ks)return;an[n]=t;function e(S){return`__firebase__banner__${S}`}let i="__firebase__banner",o=Fd().prod.length>0;function a(){let S=document.getElementById(i);S&&S.remove()}function u(S){S.style.display="flex",S.style.background="#7faaf0",S.style.position="fixed",S.style.bottom="5px",S.style.left="5px",S.style.padding=".5em",S.style.borderRadius="5px",S.style.alignItems="center"}function d(S,k){S.setAttribute("width","24"),S.setAttribute("id",k),S.setAttribute("height","24"),S.setAttribute("viewBox","0 0 24 24"),S.setAttribute("fill","none"),S.style.marginLeft="-6px"}function m(){let S=document.createElement("span");return S.style.cursor="pointer",S.style.marginLeft="16px",S.style.fontSize="24px",S.innerHTML=" &times;",S.onclick=()=>{ks=!0,a()},S}function I(S,k){S.setAttribute("id",k),S.innerText="Learn more",S.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",S.setAttribute("target","__blank"),S.style.paddingLeft="5px",S.style.textDecoration="underline"}function y(){let S=Ld(i),k=e("text"),g=document.getElementById(k)||document.createElement("span"),A=e("learnmore"),$=document.getElementById(A)||document.createElement("a"),ue=e("preprendIcon"),te=document.getElementById(ue)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(S.created){let q=S.element;u(q),I($,A);let me=m();d(te,ue),q.append(te,g,$,me),document.body.appendChild(q)}o?(g.innerText="Preview backend disconnected.",te.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
2<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
3</g>
4<defs>
5<clipPath id="clip0_6013_33858">
6<rect width="24" height="24" fill="white"/>
7</clipPath>
8</defs>`):(te.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
9<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
10</g>
11<defs>
12<clipPath id="clip0_6083_34804">
13<rect width="24" height="24" fill="white"/>
14</clipPath>
15</defs>`,g.innerText="Preview backend running in this workspace."),g.setAttribute("id",k)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",y):y()}function ke(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Ms(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(ke())}function Fs(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Ls(){let n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Vs(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Us(){let n=ke();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function rr(){try{return typeof indexedDB=="object"}catch{return!1}}function Bs(){return new Promise((n,t)=>{try{let e=!0,i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),e||self.indexedDB.deleteDatabase(i),n(!0)},r.onupgradeneeded=()=>{e=!1},r.onerror=()=>{var o;t(((o=r.error)===null||o===void 0?void 0:o.message)||"")}}catch(e){t(e)}})}var Vd="FirebaseError",Qe=class n extends Error{constructor(t,e,i){super(e),this.code=t,this.customData=i,this.name=Vd,Object.setPrototypeOf(this,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Je.prototype.create)}},Je=class{constructor(t,e,i){this.service=t,this.serviceName=e,this.errors=i}create(t,...e){let i=e[0]||{},r=`${this.service}/${t}`,o=this.errors[t],a=o?Ud(o,i):"Error",u=`${this.serviceName}: ${a} (${r}).`;return new Qe(r,u,i)}};function Ud(n,t){return n.replace(Bd,(e,i)=>{let r=t[i];return r!=null?String(r):`<${i}?>`})}var Bd=/\{\$([^}]+)}/g;function Hs(n){for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t))return!1;return!0}function Lt(n,t){if(n===t)return!0;let e=Object.keys(n),i=Object.keys(t);for(let r of e){if(!i.includes(r))return!1;let o=n[r],a=t[r];if(As(o)&&As(a)){if(!Lt(o,a))return!1}else if(o!==a)return!1}for(let r of i)if(!e.includes(r))return!1;return!0}function As(n){return n!==null&&typeof n=="object"}function Vi(n){let t=[];for(let[e,i]of Object.entries(n))Array.isArray(i)?i.forEach(r=>{t.push(encodeURIComponent(e)+"="+encodeURIComponent(r))}):t.push(encodeURIComponent(e)+"="+encodeURIComponent(i));return t.length?"&"+t.join("&"):""}function $s(n,t){let e=new ao(n,t);return e.subscribe.bind(e)}var ao=class{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(()=>{t(this)}).catch(i=>{this.error(i)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,e,i){let r;if(t===void 0&&e===void 0&&i===void 0)throw new Error("Missing Observer.");Hd(t,["next","error","complete"])?r=t:r={next:t,error:e,complete:i},r.next===void 0&&(r.next=ro),r.error===void 0&&(r.error=ro),r.complete===void 0&&(r.complete=ro);let o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch{}}),this.observers.push(r),o}unsubscribeOne(t){this.observers===void 0||this.observers[t]===void 0||(delete this.observers[t],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then(()=>{if(this.observers!==void 0&&this.observers[t]!==void 0)try{e(this.observers[t])}catch(i){typeof console<"u"&&console.error&&console.error(i)}})}close(t){this.finalized||(this.finalized=!0,t!==void 0&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Hd(n,t){if(typeof n!="object"||n===null)return!1;for(let e of t)if(e in n&&typeof n[e]=="function")return!0;return!1}function ro(){}var b_=4*60*60*1e3;function It(n){return n&&n._delegate?n._delegate:n}var He=class{constructor(t,e,i){this.name=t,this.instanceFactory=e,this.type=i,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}};var ii="[DEFAULT]";var po=class{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){let e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){let i=new ti;if(this.instancesDeferred.set(e,i),this.isInitialized(e)||this.shouldAutoInitialize())try{let r=this.getOrInitializeService({instanceIdentifier:e});r&&i.resolve(r)}catch{}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;let i=this.normalizeInstanceIdentifier(t?.identifier),r=(e=t?.optional)!==null&&e!==void 0?e:!1;if(this.isInitialized(i)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:i})}catch(o){if(r)return null;throw o}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(jd(t))try{this.getOrInitializeService({instanceIdentifier:ii})}catch{}for(let[e,i]of this.instancesDeferred.entries()){let r=this.normalizeInstanceIdentifier(e);try{let o=this.getOrInitializeService({instanceIdentifier:r});i.resolve(o)}catch{}}}}clearInstance(t=ii){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}delete(){return b(this,null,function*(){let t=Array.from(this.instances.values());yield Promise.all([...t.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...t.filter(e=>"_delete"in e).map(e=>e._delete())])})}isComponentSet(){return this.component!=null}isInitialized(t=ii){return this.instances.has(t)}getOptions(t=ii){return this.instancesOptions.get(t)||{}}initialize(t={}){let{options:e={}}=t,i=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(i))throw Error(`${this.name}(${i}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let r=this.getOrInitializeService({instanceIdentifier:i,options:e});for(let[o,a]of this.instancesDeferred.entries()){let u=this.normalizeInstanceIdentifier(o);i===u&&a.resolve(r)}return r}onInit(t,e){var i;let r=this.normalizeInstanceIdentifier(e),o=(i=this.onInitCallbacks.get(r))!==null&&i!==void 0?i:new Set;o.add(t),this.onInitCallbacks.set(r,o);let a=this.instances.get(r);return a&&t(a,r),()=>{o.delete(t)}}invokeOnInitCallbacks(t,e){let i=this.onInitCallbacks.get(e);if(i)for(let r of i)try{r(t,e)}catch{}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let i=this.instances.get(t);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:$d(t),options:e}),this.instances.set(t,i),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(i,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,i)}catch{}return i||null}normalizeInstanceIdentifier(t=ii){return this.component?this.component.multipleInstances?t:ii:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function $d(n){return n===ii?void 0:n}function jd(n){return n.instantiationMode==="EAGER"}var or=class{constructor(t){this.name=t,this.providers=new Map}addComponent(t){let e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);let e=new po(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}};var Gd=[],K=function(n){return n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT",n}(K||{}),zd={debug:K.DEBUG,verbose:K.VERBOSE,info:K.INFO,warn:K.WARN,error:K.ERROR,silent:K.SILENT},Wd=K.INFO,qd={[K.DEBUG]:"log",[K.VERBOSE]:"log",[K.INFO]:"info",[K.WARN]:"warn",[K.ERROR]:"error"},Kd=(n,t,...e)=>{if(t<n.logLevel)return;let i=new Date().toISOString(),r=qd[t];if(r)console[r](`[${i}]  ${n.name}:`,...e);else throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)},Vt=class{constructor(t){this.name=t,this._logLevel=Wd,this._logHandler=Kd,this._userLogHandler=null,Gd.push(this)}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in K))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?zd[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,K.DEBUG,...t),this._logHandler(this,K.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,K.VERBOSE,...t),this._logHandler(this,K.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,K.INFO,...t),this._logHandler(this,K.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,K.WARN,...t),this._logHandler(this,K.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,K.ERROR,...t),this._logHandler(this,K.ERROR,...t)}};var Yd=(n,t)=>t.some(e=>n instanceof e),js,Gs;function Zd(){return js||(js=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Xd(){return Gs||(Gs=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var zs=new WeakMap,ho=new WeakMap,Ws=new WeakMap,mo=new WeakMap,go=new WeakMap;function Qd(n){let t=new Promise((e,i)=>{let r=()=>{n.removeEventListener("success",o),n.removeEventListener("error",a)},o=()=>{e(dt(n.result)),r()},a=()=>{i(n.error),r()};n.addEventListener("success",o),n.addEventListener("error",a)});return t.then(e=>{e instanceof IDBCursor&&zs.set(e,n)}).catch(()=>{}),go.set(t,n),t}function Jd(n){if(ho.has(n))return;let t=new Promise((e,i)=>{let r=()=>{n.removeEventListener("complete",o),n.removeEventListener("error",a),n.removeEventListener("abort",a)},o=()=>{e(),r()},a=()=>{i(n.error||new DOMException("AbortError","AbortError")),r()};n.addEventListener("complete",o),n.addEventListener("error",a),n.addEventListener("abort",a)});ho.set(n,t)}var fo={get(n,t,e){if(n instanceof IDBTransaction){if(t==="done")return ho.get(n);if(t==="objectStoreNames")return n.objectStoreNames||Ws.get(n);if(t==="store")return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return dt(n[t])},set(n,t,e){return n[t]=e,!0},has(n,t){return n instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in n}};function qs(n){fo=n(fo)}function eu(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...e){let i=n.call(ar(this),t,...e);return Ws.set(i,t.sort?t.sort():[t]),dt(i)}:Xd().includes(n)?function(...t){return n.apply(ar(this),t),dt(zs.get(this))}:function(...t){return dt(n.apply(ar(this),t))}}function tu(n){return typeof n=="function"?eu(n):(n instanceof IDBTransaction&&Jd(n),Yd(n,Zd())?new Proxy(n,fo):n)}function dt(n){if(n instanceof IDBRequest)return Qd(n);if(mo.has(n))return mo.get(n);let t=tu(n);return t!==n&&(mo.set(n,t),go.set(t,n)),t}var ar=n=>go.get(n);function Ys(n,t,{blocked:e,upgrade:i,blocking:r,terminated:o}={}){let a=indexedDB.open(n,t),u=dt(a);return i&&a.addEventListener("upgradeneeded",d=>{i(dt(a.result),d.oldVersion,d.newVersion,dt(a.transaction),d)}),e&&a.addEventListener("blocked",d=>e(d.oldVersion,d.newVersion,d)),u.then(d=>{o&&d.addEventListener("close",()=>o()),r&&d.addEventListener("versionchange",m=>r(m.oldVersion,m.newVersion,m))}).catch(()=>{}),u}var iu=["get","getKey","getAll","getAllKeys","count"],nu=["put","add","delete","clear"],vo=new Map;function Ks(n,t){if(!(n instanceof IDBDatabase&&!(t in n)&&typeof t=="string"))return;if(vo.get(t))return vo.get(t);let e=t.replace(/FromIndex$/,""),i=t!==e,r=nu.includes(e);if(!(e in(i?IDBIndex:IDBObjectStore).prototype)||!(r||iu.includes(e)))return;let o=function(a,...u){return b(this,null,function*(){let d=this.transaction(a,r?"readwrite":"readonly"),m=d.store;return i&&(m=m.index(u.shift())),(yield Promise.all([m[e](...u),r&&d.done]))[0]})};return vo.set(t,o),o}qs(n=>ie(U({},n),{get:(t,e,i)=>Ks(t,e)||n.get(t,e,i),has:(t,e)=>!!Ks(t,e)||n.has(t,e)}));var Co=class{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(ru(e)){let i=e.getImmediate();return`${i.library}/${i.version}`}else return null}).filter(e=>e).join(" ")}};function ru(n){let t=n.getComponent();return t?.type==="VERSION"}var Io="@firebase/app",Zs="0.13.2";var bt=new Vt("@firebase/app"),ou="@firebase/app-compat",au="@firebase/analytics-compat",su="@firebase/analytics",lu="@firebase/app-check-compat",cu="@firebase/app-check",du="@firebase/auth",uu="@firebase/auth-compat",pu="@firebase/database",mu="@firebase/data-connect",hu="@firebase/database-compat",fu="@firebase/functions",gu="@firebase/functions-compat",vu="@firebase/installations",_u="@firebase/installations-compat",Cu="@firebase/messaging",Iu="@firebase/messaging-compat",bu="@firebase/performance",xu="@firebase/performance-compat",Eu="@firebase/remote-config",Su="@firebase/remote-config-compat",yu="@firebase/storage",Tu="@firebase/storage-compat",Pu="@firebase/firestore",ku="@firebase/ai",Au="@firebase/firestore-compat",Ou="firebase",wu="11.10.0";var bo="[DEFAULT]",Ru={[Io]:"fire-core",[ou]:"fire-core-compat",[su]:"fire-analytics",[au]:"fire-analytics-compat",[cu]:"fire-app-check",[lu]:"fire-app-check-compat",[du]:"fire-auth",[uu]:"fire-auth-compat",[pu]:"fire-rtdb",[mu]:"fire-data-connect",[hu]:"fire-rtdb-compat",[fu]:"fire-fn",[gu]:"fire-fn-compat",[vu]:"fire-iid",[_u]:"fire-iid-compat",[Cu]:"fire-fcm",[Iu]:"fire-fcm-compat",[bu]:"fire-perf",[xu]:"fire-perf-compat",[Eu]:"fire-rc",[Su]:"fire-rc-compat",[yu]:"fire-gcs",[Tu]:"fire-gcs-compat",[Pu]:"fire-fst",[Au]:"fire-fst-compat",[ku]:"fire-vertex","fire-js":"fire-js",[Ou]:"fire-js-all"};var ln=new Map,Du=new Map,xo=new Map;function Xs(n,t){try{n.container.addComponent(t)}catch(e){bt.debug(`Component ${t.name} failed to register with FirebaseApp ${n.name}`,e)}}function xt(n){let t=n.name;if(xo.has(t))return bt.debug(`There were multiple attempts to register component ${t}.`),!1;xo.set(t,n);for(let e of ln.values())Xs(e,n);for(let e of Du.values())Xs(e,n);return!0}function sr(n,t){let e=n.container.getProvider("heartbeat").getImmediate({optional:!0});return e&&e.triggerHeartbeat(),n.container.getProvider(t)}function et(n){return n==null?!1:n.settings!==void 0}var Nu={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invali
15d-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Ut=new Je("app","Firebase",Nu);var Eo=class{constructor(t,e,i){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=i,this.container.addComponent(new He("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Ut.create("app-deleted",{appName:this._name})}};var Ui=wu;function To(n,t={}){let e=n;typeof t!="object"&&(t={name:t});let i=Object.assign({name:bo,automaticDataCollectionEnabled:!0},t),r=i.name;if(typeof r!="string"||!r)throw Ut.create("bad-app-name",{appName:String(r)});if(e||(e=co()),!e)throw Ut.create("no-options");let o=ln.get(r);if(o){if(Lt(e,o.options)&&Lt(i,o.config))return o;throw Ut.create("duplicate-app",{appName:r})}let a=new or(r);for(let d of xo.values())a.addComponent(d);let u=new Eo(e,i,a);return ln.set(r,u),u}function dn(n=bo){let t=ln.get(n);if(!t&&n===bo&&co())return To();if(!t)throw Ut.create("no-app",{appName:n});return t}function lr(){return Array.from(ln.values())}function Ee(n,t,e){var i;let r=(i=Ru[n])!==null&&i!==void 0?i:n;e&&(r+=`-${e}`);let o=r.match(/\s|\//),a=t.match(/\s|\//);if(o||a){let u=[`Unable to register library "${r}" with version "${t}":`];o&&u.push(`library name "${r}" contains illegal characters (whitespace or "/")`),o&&a&&u.push("and"),a&&u.push(`version name "${t}" contains illegal characters (whitespace or "/")`),bt.warn(u.join(" "));return}xt(new He(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}var Mu="firebase-heartbeat-database",Fu=1,cn="firebase-heartbeat-store",_o=null;function tl(){return _o||(_o=Ys(Mu,Fu,{upgrade:(n,t)=>{switch(t){case 0:try{n.createObjectStore(cn)}catch(e){console.warn(e)}}}}).catch(n=>{throw Ut.create("idb-open",{originalErrorMessage:n.message})})),_o}function Lu(n){return b(this,null,function*(){try{let e=(yield tl()).transaction(cn),i=yield e.objectStore(cn).get(il(n));return yield e.done,i}catch(t){if(t instanceof Qe)bt.warn(t.message);else{let e=Ut.create("idb-get",{originalErrorMessage:t?.message});bt.warn(e.message)}}})}function Qs(n,t){return b(this,null,function*(){try{let i=(yield tl()).transaction(cn,"readwrite");yield i.objectStore(cn).put(t,il(n)),yield i.done}catch(e){if(e instanceof Qe)bt.warn(e.message);else{let i=Ut.create("idb-set",{originalErrorMessage:e?.message});bt.warn(i.message)}}})}function il(n){return`${n.name}!${n.options.appId}`}var Vu=1024,Uu=30,So=class{constructor(t){this.container=t,this._heartbeatsCache=null;let e=this.container.getProvider("app").getImmediate();this._storage=new yo(e),this._heartbeatsCachePromise=this._storage.read().then(i=>(this._heartbeatsCache=i,i))}triggerHeartbeat(){return b(this,null,function*(){var t,e;try{let r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=Js();if(((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null&&(this._heartbeatsCache=yield this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(a=>a.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:r}),this._heartbeatsCache.heartbeats.length>Uu){let a=Hu(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(a,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(i){bt.warn(i)}})}getHeartbeatsHeader(){return b(this,null,function*(){var t;try{if(this._heartbeatsCache===null&&(yield this._heartbeatsCachePromise),((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=Js(),{heartbeatsToSend:i,unsentEntries:r}=Bu(this._heartbeatsCache.heartbeats),o=so(JSON.stringify({version:2,heartbeats:i}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,yield this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(e){return bt.warn(e),""}})}};function Js(){return new Date().toISOString().substring(0,10)}function Bu(n,t=Vu){let e=[],i=n.slice();for(let r of n){let o=e.find(a=>a.agent===r.agent);if(o){if(o.dates.push(r.date),el(e)>t){o.dates.pop();break}}else if(e.push({agent:r.agent,dates:[r.date]}),el(e)>t){e.pop();break}i=i.slice(1)}return{heartbeatsToSend:e,unsentEntries:i}}var yo=class{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}runIndexedDBEnvironmentCheck(){return b(this,null,function*(){return rr()?Bs().then(()=>!0).catch(()=>!1):!1})}read(){return b(this,null,function*(){if(yield this._canUseIndexedDBPromise){let e=yield Lu(this.app);return e?.heartbeats?e:{heartbeats:[]}}else return{heartbeats:[]}})}overwrite(t){return b(this,null,function*(){var e;if(yield this._canUseIndexedDBPromise){let r=yield this.read();return Qs(this.app,{lastSentHeartbeatDate:(e=t.lastSentHeartbeatDate)!==null&&e!==void 0?e:r.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return})}add(t){return b(this,null,function*(){var e;if(yield this._canUseIndexedDBPromise){let r=yield this.read();return Qs(this.app,{lastSentHeartbeatDate:(e=t.lastSentHeartbeatDate)!==null&&e!==void 0?e:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return})}};function el(n){return so(JSON.stringify({version:2,heartbeats:n})).length}function Hu(n){if(n.length===0)return-1;let t=0,e=n[0].date;for(let i=1;i<n.length;i++)n[i].date<e&&(e=n[i].date,t=i);return t}function $u(n){xt(new He("platform-logger",t=>new Co(t),"PRIVATE")),xt(new He("heartbeat",t=>new So(t),"PRIVATE")),Ee(Io,Zs,n),Ee(Io,Zs,"esm2017"),Ee("fire-js","")}$u("");var ju="firebase",Gu="11.10.0";Ee(ju,Gu,"app");var Hi=new Wa("ANGULARFIRE2_VERSION");function Po(n,t,e){if(t){if(t.length===1)return t[0];let o=t.filter(a=>a.app===e);if(o.length===1)return o[0]}return e.container.getProvider(n).getImmediate({optional:!0})}var dr=(n,t)=>{let e=t?[t]:lr(),i=[];return e.forEach(r=>
vendor: 50,511 bytes, lines 15-17
15{r.container.getProvider(n).instances.forEach(a=>{i.includes(a)||i.push(a)})}),i},Bi=function(n){return n[n.SILENT=0]="SILENT",n[n.WARN=1]="WARN",n[n.VERBOSE=2]="VERBOSE",n}(Bi||{}),nl=Xr()&&typeof Zone<"u"?Bi.WARN:Bi.SILENT;var cr=class{zone;delegate;constructor(t,e=Oa){this.zone=t,this.delegate=e}now(){return this.delegate.now()}schedule(t,e,i){let r=this.zone,o=function(a){r?r.runGuarded(()=>{t.apply(this,[a])}):t.apply(this,[a])};return this.delegate.schedule(o,e,i)}},$i=(()=>{class n{outsideAngular;insideAngular;constructor(){let e=ee(Ue);this.outsideAngular=e.runOutsideAngular(()=>new cr(typeof Zone>"u"?void 0:Zone.current)),this.insideAngular=e.run(()=>new cr(typeof Zone>"u"?void 0:Zone.current,Aa))}static \u0275fac=function(i){return new(i||n)};static \u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),rl=!1;function zu(n,t){!rl&&(nl>Bi.SILENT||Xr())&&(rl=!0,console.warn("Calling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs. Find more at https://github.com/angular/angularfire/blob/main/docs/zones.md")),nl>=t&&console.warn(`Firebase API called outside injection context: ${n.name}`)}function Wu(n){let t=ee(Ue,{optional:!0});return t?t.runOutsideAngular(()=>n()):n()}function ni(n){let t=ee(Ue,{optional:!0});return t?t.run(()=>n()):n()}var qu=(n,t,e)=>(...i)=>(t&&setTimeout(t,0),wn(e,()=>ni(()=>n.apply(void 0,i)))),Bt=(n,t,e)=>(e||=t?Bi.WARN:Bi.VERBOSE,function(){let i,r=arguments,o,a,u;try{o=ee($i),a=ee(Va),u=ee(Fa)}catch{return zu(n,e),n.apply(this,r)}for(let m=0;m<arguments.length;m++)typeof r[m]=="function"&&(t&&(i||=ni(()=>a.add())),r[m]=qu(r[m],i,u));let d=Wu(()=>n.apply(this,r));return t?d instanceof Ki?d.pipe(Wr(o.outsideAngular),zr(o.insideAngular),Qa(u)):d instanceof Promise?ni(()=>new Promise((m,I)=>{a.run(()=>d).then(y=>wn(u,()=>ni(()=>m(y))),y=>wn(u,()=>ni(()=>I(y))))})):typeof d=="function"&&i?function(){return setTimeout(i,0),d.apply(this,arguments)}:ni(()=>d):d instanceof Ki?d.pipe(Wr(o.outsideAngular),zr(o.insideAngular)):ni(()=>d)});var ri=class{constructor(t){return t}},un=class{constructor(){return lr()}};function Ku(n){return n&&n.length===1?n[0]:new ri(dn())}var ko=new rt("angularfire2._apps"),Yu={provide:ri,useFactory:Ku,deps:[[new qt,ko]]},Zu={provide:un,deps:[[new qt,ko]]};function Xu(n){return(t,e)=>{let i=e.get(Ba);Ee("angularfire",Hi.full,"core"),Ee("angularfire",Hi.full,"app"),Ee("angular",qa.full,i.toString());let r=t.runOutsideAngular(()=>n(e));return new ri(r)}}function cC(n,...t){return Kt([Yu,Zu,{provide:ko,useFactory:Xu(n),multi:!0,deps:[Ue,Pt,$i,...t]}])}var dC=Bt(To,!0);var Qu=new Map,Ju={activated:!1,tokenObservers:[]},ep={initialized:!1,enabled:!1};function tt(n){return Qu.get(n)||Object.assign({},Ju)}function ll(){return ep}var tp="https://content-firebaseappcheck.googleapis.com/v1";var ip="exchangeDebugToken",ol={OFFSET_DURATION:5*60*1e3,RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:16*60*1e3},CC=24*60*60*1e3;var wo=class{constructor(t,e,i,r,o){if(this.operation=t,this.retryPolicy=e,this.getWaitDuration=i,this.lowerBound=r,this.upperBound=o,this.pending=null,this.nextErrorWaitInterval=r,r>o)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}process(t){return b(this,null,function*(){this.stop();try{this.pending=new ti,this.pending.promise.catch(e=>{}),yield np(this.getNextRun(t)),this.pending.resolve(),yield this.pending.promise,this.pending=new ti,this.pending.promise.catch(e=>{}),yield this.operation(),this.pending.resolve(),yield this.pending.promise,this.process(!0).catch(()=>{})}catch(e){this.retryPolicy(e)?this.process(!1).catch(()=>{}):this.stop()}})}getNextRun(t){if(t)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let e=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),e}}};function np(n){return new Promise(t=>{setTimeout(t,n)})}var rp={"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.","initial-throttle":"{$httpStatus} error. Attempts allowed again after {$time}",throttled:"Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}"},Ht=new Je("appCheck","AppCheck",rp);function cl(n){if(!tt(n).activated)throw Ht.create("use-before-activation",{appName:n.name})}function dl(i,r){return b(this,arguments,function*({url:n,body:t},e){let o={"Content-Type":"application/json"},a=e.getImmediate({optional:!0});if(a){let k=yield a.getHeartbeatsHeader();k&&(o["X-Firebase-Client"]=k)}let u={method:"POST",body:JSON.stringify(t),headers:o},d;try{d=yield fetch(n,u)}catch(k){throw Ht.create("fetch-network-error",{originalErrorMessage:k?.message})}if(d.status!==200)throw Ht.create("fetch-status-error",{httpStatus:d.status});let m;try{m=yield d.json()}catch(k){throw Ht.create("fetch-parse-error",{originalErrorMessage:k?.message})}let I=m.ttl.match(/^([\d.]+)(s)$/);if(!I||!I[2]||isNaN(Number(I[1])))throw Ht.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${m.ttl}`});let y=Number(I[1])*1e3,S=Date.now();return{token:m.token,expireTimeMillis:S+y,issuedAtTimeMillis:S}})}function ul(n,t){let{projectId:e,appId:i,apiKey:r}=n.options;return{url:`${tp}/projects/${e}/apps/${i}:${ip}?key=${r}`,body:{debug_token:t}}}var op="firebase-app-check-database",ap=1,Ro="firebase-app-check-store";var ur=null;function sp(){return ur||(ur=new Promise((n,t)=>{try{let e=indexedDB.open(op,ap);e.onsuccess=i=>{n(i.target.result)},e.onerror=i=>{var r;t(Ht.create("storage-open",{originalErrorMessage:(r=i.target.error)===null||r===void 0?void 0:r.message}))},e.onupgradeneeded=i=>{let r=i.target.result;switch(i.oldVersion){case 0:r.createObjectStore(Ro,{keyPath:"compositeKey"})}}}catch(e){t(Ht.create("storage-open",{originalErrorMessage:e?.message}))}}),ur)}function lp(n,t){return cp(dp(n),t)}function cp(n,t){return b(this,null,function*(){let i=(yield sp()).transaction(Ro,"readwrite"),o=i.objectStore(Ro).put({compositeKey:n,value:t});return new Promise((a,u)=>{o.onsuccess=d=>{a()},i.onerror=d=>{var m;u(Ht.create("storage-set",{originalErrorMessage:(m=d.target.error)===null||m===void 0?void 0:m.message}))}})})}function dp(n){return`${n.options.appId}-${n.name}`}var pn=new Vt("@firebase/app-check");function Ao(n,t){return rr()?lp(n,t).catch(e=>{pn.warn(`Failed to write token to IndexedDB. Error: ${e}`)}):Promise.resolve()}function pl(){return ll().enabled}function ml(){return b(this,null,function*(){let n=ll();if(n.enabled&&n.token)return n.token.promise;throw Error(`
16            Can't get debug token in production mode.
17        `)})}var up={error:"UNKNOWN_ERROR"};function pp(n){return ir.encodeString(JSON.stringify(n),!1)}function Do(n,t=!1,e=!1){return b(this,null,function*(){let i=n.app;cl(i);let r=tt(i),o=r.token,a;if(o&&!mn(o)&&(r.token=void 0,o=void 0),!o){let m=yield r.cachedTokenPromise;m&&(mn(m)?o=m:yield Ao(i,void 0))}if(!t&&o&&mn(o))return{token:o.token};let u=!1;if(pl())try{r.exchangeTokenPromise||(r.exchangeTokenPromise=dl(ul(i,yield ml()),n.heartbeatServiceProvider).finally(()=>{r.exchangeTokenPromise=void 0}),u=!0);let m=yield r.exchangeTokenPromise;return yield Ao(i,m),r.token=m,{token:m.token}}catch(m){return m.code==="appCheck/throttled"||m.code==="appCheck/initial-throttle"?pn.warn(m.message):e&&pn.error(m),Oo(m)}try{r.exchangeTokenPromise||(r.exchangeTokenPromise=r.provider.getToken().finally(()=>{r.exchangeTokenPromise=void 0}),u=!0),o=yield tt(i).exchangeTokenPromise}catch(m){m.code==="appCheck/throttled"||m.code==="appCheck/initial-throttle"?pn.warn(m.message):e&&pn.error(m),a=m}let d;return o?a?mn(o)?d={token:o.token,internalError:a}:d=Oo(a):(d={token:o.token},r.token=o,yield Ao(i,o)):d=Oo(a),u&&gp(i,d),d})}function mp(n){return b(this,null,function*(){let t=n.app;cl(t);let{provider:e}=tt(t);if(pl()){let i=yield ml(),{token:r}=yield dl(ul(t,i),n.heartbeatServiceProvider);return{token:r}}else{let{token:i}=yield e.getToken();return{token:i}}})}function hp(n,t,e,i){let{app:r}=n,o=tt(r),a={next:e,error:i,type:t};if(o.tokenObservers=[...o.tokenObservers,a],o.token&&mn(o.token)){let u=o.token;Promise.resolve().then(()=>{e({token:u.token}),al(n)}).catch(()=>{})}o.cachedTokenPromise.then(()=>al(n))}function hl(n,t){let e=tt(n),i=e.tokenObservers.filter(r=>r.next!==t);i.length===0&&e.tokenRefresher&&e.tokenRefresher.isRunning()&&e.tokenRefresher.stop(),e.tokenObservers=i}function al(n){let{app:t}=n,e=tt(t),i=e.tokenRefresher;i||(i=fp(n),e.tokenRefresher=i),!i.isRunning()&&e.isTokenAutoRefreshEnabled&&i.start()}function fp(n){let{app:t}=n;return new wo(()=>b(null,null,function*(){let e=tt(t),i;if(e.token?i=yield Do(n,!0):i=yield Do(n),i.error)throw i.error;if(i.internalError)throw i.internalError}),()=>!0,()=>{let e=tt(t);if(e.token){let i=e.token.issuedAtTimeMillis+(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)*.5+3e5,r=e.token.expireTimeMillis-5*60*1e3;return i=Math.min(i,r),Math.max(0,i-Date.now())}else return 0},ol.RETRIAL_MIN_WAIT,ol.RETRIAL_MAX_WAIT)}function gp(n,t){let e=tt(n).tokenObservers;for(let i of e)try{i.type==="EXTERNAL"&&t.error!=null?i.error(t.error):i.next(t)}catch{}}function mn(n){return n.expireTimeMillis-Date.now()>0}function Oo(n){return{token:pp(up),error:n}}var No=class{constructor(t,e){this.app=t,this.heartbeatServiceProvider=e}_delete(){let{tokenObservers:t}=tt(this.app);for(let e of t)hl(this.app,e.next);return Promise.resolve()}};function vp(n,t){return new No(n,t)}function _p(n){return{getToken:t=>Do(n,t),getLimitedUseToken:()=>mp(n),addTokenListener:t=>hp(n,"INTERNAL",t),removeTokenListener:t=>hl(n.app,t)}}var Cp="@firebase/app-check",Ip="0.10.1";var bp="app-check",sl="app-check-internal";function xp(){xt(new He(bp,n=>{let t=n.getProvider("app").getImmediate(),e=n.getProvider("heartbeat");return vp(t,e)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((n,t,e)=>{n.getProvider(sl).initialize()})),xt(new He(sl,n=>{let t=n.getProvider("app-check").getImmediate();return _p(t)},"PUBLIC").setInstantiationMode("EXPLICIT")),Ee(Cp,Ip)}xp();var Ep="app-check";var pr=class{constructor(){return dr(Ep)}};var Sp=["localhost","0.0.0.0","127.0.0.1"],RC=typeof window<"u"&&Sp.includes(window.location.hostname);function Al(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}var Ol=Al,wl=new Je("auth","Firebase",Al());var _r=new Vt("@firebase/auth");function yp(n,...t){_r.logLevel<=K.WARN&&_r.warn(`Auth (${Ui}): ${n}`,...t)}function hr(n,...t){_r.logLevel<=K.ERROR&&_r.error(`Auth (${Ui}): ${n}`,...t)}function pt(n,...t){throw Qo(n,...t)}function it(n,...t){return Qo(n,...t)}function Xo(n,t,e){let i=Object.assign(Object.assign({},Ol()),{[t]:e});return new Je("auth","Firebase",i).create(t,{appName:n.name})}function oi(n){return Xo(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Tp(n,t,e){let i=e;if(!(t instanceof i))throw i.name!==t.constructor.name&&pt(n,"argument-error"),Xo(n,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Qo(n,...t){if(typeof n!="string"){let e=t[0],i=[...t.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(e,...i)}return wl.create(n,...t)}function L(n,t,...e){if(!n)throw Qo(t,...e)}function Et(n){let t="INTERNAL ASSERTION FAILED: "+n;throw hr(t),new Error(t)}function yt(n,t){n||Et(t)}function Lo(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function Pp(){return fl()==="http:"||fl()==="https:"}function fl(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}function kp(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Pp()||Ls()||"connection"in navigator)?navigator.onLine:!0}function Ap(){if(typeof navigator>"u")return null;let n=navigator;return n.languages&&n.languages[0]||n.language||null}var ai=class{constructor(t,e){this.shortDelay=t,this.longDelay=e,yt(e>t,"Short delay should be less than long delay!"),this.isMobile=Ms()||Vs()}get(){return kp()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Jo(n,t){yt(n.emulator,"Emulator should always be set here");let{url:e}=n.emulator;return t?`${e}${t.startsWith("/")?t.slice(1):t}`:e}var Cr=class{static initialize(t,e,i){this.fetchImpl=t,e&&(this.headersImpl=e),i&&(this.responseImpl=i)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Et("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Et("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Et("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var Op={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};var wp=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Rp=new ai(3e4,6e4);function ea(n,t){return n.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:n.tenantId}):t}function zi(o,a,u,d){return b(this,arguments,function*(n,t,e,i,r={}){return Rl(n,r,()=>b(null,null,function*(){let m={},I={};i&&(t==="GET"?I=i:m={body:JSON.stringify(i)});let y=Vi(Object.assign({key:n.config.apiKey},I)).slice(1),S=yield n._getAdditionalHeaders();S["Content-Type"]="application/json",n.languageCode&&(S["X-Firebase-Locale"]=n.languageCode);let k=Object.assign({method:t,headers:S},m);return Fs()||(k.referrerPolicy="no-referrer"),n.emulatorConfig&&sn(n.emulatorConfig.host)&&(k.credentials="include"),Cr.fetch()(yield Dl(n,n.config.apiHost,e,y),k)}))})}function Rl(n,t,e){return b(this,null,function*(){n._canInitEmulator=!1;let i=Object.assign(Object.assign({},Op),t);try{let r=new Vo(n),o=yield Promise.race([e(),r.promise]);r.clearNetworkTimeout();let a=yield o.json();if("needConfirmation"in a)throw mr(n,"account-exists-with-different-credential",a);if(o.ok&&!("errorMessage"in a))return a;{let u=o.ok?a.errorMessage:a.error.message,[d,m]=u.split(" : ");if(d==="FEDERATED_USER_ID_ALREADY_LINKED")throw mr(n,"credential-already-in-use",a);if(d==="EMAIL_EXISTS")throw mr(n,"email-already-in-use",a);if(d==="USER_DISABLED")throw mr(n,"user-disabled",a);let I=i[d]||d.toLowerCase().replace(/[_\s]+/g,"-");if(m)throw Xo(n,I,m);pt(n,I)}}catch(r){if(r instanceof Qe)throw r;pt(n,"network-request-failed",{message:String(r)})}})}function Dp(o,a,u,d){return b(this,arguments,function*(n,t,e,i,r={}){let m=yield zi(n,t,e,i,r);return"mfaPendingCredential"in m&&pt(n,"multi-factor-auth-required",{_serverResponse:m}),m})}function Dl(n,t,e,i){return b(this,null,function*(){let r=`${t}${e}?${i}`,o=n,a=o.config.emulator?Jo(n.config,r):`${n.config.apiScheme}://${r}`;return wp.includes(e)&&(yield o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(a).toString():a})}var Vo=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((e,i)=>{this.timer=setTimeout(()=>i(it(this.auth,"network-request-failed")),Rp.get())})}};function mr(n,t,e){let i={appName:n.name};e.email&&(i.email=e.email),e.phoneNumber&&(i.phoneNumber=e.phoneNumber);let r=it(n,t,i);return r.customData._tokenResponse=e,r}function Np(n,t){return b(this,null,function*(){return zi(n,"POST","/v1/accounts:delete",t)})}function Ir(n,t){return b(this,null,function*(){return zi(n,"POST","/v1/accounts:lookup",t)})}function hn(n){if(n)try{let t=new Date(Number(n));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}function ta(n,t=!1){return b(this,null,function*(){let e=It(n),i=yield e.getIdToken(t),r=ia(i);L(r&&r.exp&&r.auth_time&&r.iat,e.auth,"internal-error");let o=typeof r.firebase=="object"?r.firebase:void 0,a=o?.sign_in_provider;return{claims:r,token:i,authTime:hn(Mo(r.auth_time)),issuedAtTime:hn(Mo(r.iat)),expirationTime:hn(Mo(r.exp)),signInProvider:a||null,signInSecondFactor:o?.sign_in_second_factor||null}})}function Mo(n){return Number(n)*1e3}function ia(n){let[t,e,i]=n.split(".");if(t===void 0||e===void 0||i===void 0)return hr("JWT malformed, contained fewer than 3 sections"),null;try{let r=nr(e);return r?JSON.parse(r):(hr("Failed to decode base64 JWT payload"),null)}catch(r){return hr("Caught error parsing JWT payload as JSON",r?.toString()),null}}function gl(n){let t=ia(n);return L(t,"internal-error"),L(typeof t.exp<"u","internal-error"),L(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}function gn(n,t,e=!1){return b(this,null,function*(){if(e)return t;try{return yield t}catch(i){throw i instanceof Qe&&Mp(i)&&n.auth.currentUser===n&&(yield n.auth.signOut()),i}})}function Mp({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}var Uo=class{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){let i=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),i}else{this.errorBackoff=3e4;let r=((e=this.user.stsTokenManager.expirationTime)!==null&&e!==void 0?e:0)-Date.now()-3e5;return Math.max(0,r)}}schedule(t=!1){if(!this.isRunning)return;let e=this.getInterval(t);this.timerId=setTimeout(()=>b(this,null,function*(){yield this.iteration()}),e)}iteration(){return b(this,null,function*(){try{yield this.user.getIdToken(!0)}catch(t){t?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()})}};var vn=class{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=hn(this.lastLoginAt),this.creationTime=hn(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};function br(n){return b(this,null,function*(){var t;let e=n.auth,i=yield n.getIdToken(),r=yield gn(n,Ir(e,{idToken:i}));L(r?.users.length,e,"internal-error");let o=r.users[0];n._notifyReloadListener(o);let a=!((t=o.providerUserInfo)===null||t===void 0)&&t.length?Nl(o.providerUserInfo):[],u=Fp(n.providerData,a),d=n.isAnonymous,m=!(n.email&&o.passwordHash)&&!u?.length,I=d?m:!1,y={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:u,metadata:new vn(o.createdAt,o.lastLoginAt),isAnonymous:I};Object.assign(n,y)})}function na(n){return b(this,null,function*(){let t=It(n);yield br(t),yield t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)})}function Fp(n,t){return[...n.filter(i=>!t.some(r=>r.providerId===i.providerId)),...t]}function Nl(n){return n.map(t=>{var{providerId:e}=t,i=An(t,["providerId"]);return{providerId:e,uid:i.rawId||"",displayName:i.displayName||null,email:i.email||null,phoneNumber:i.phoneNumber||null,photoURL:i.photoUrl||null}})}function Lp(n,t){return b(this,null,function*(){let e=yield Rl(n,{},()=>b(null,null,function*(){let i=Vi({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:o}=n.config,a=yield Dl(n,r,"/v1/token",`key=${o}`),u=yield n._getAdditionalHeaders();u["Content-Type"]="application/x-www-form-urlencoded";let d={method:"POST",headers:u,body:i};return n.emulatorConfig&&sn(n.emulatorConfig.host)&&(d.credentials="include"),Cr.fetch()(a,d)}));return{accessToken:e.access_token,expiresIn:e.expires_in,refreshToken:e.refresh_token}})}function Vp(n,t){return b(this,null,function*(){return zi(n,"POST","/v2/accounts:revokeToken",ea(n,t))})}var fn=class n{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){L(t.idToken,"internal-error"),L(typeof t.idToken<"u","internal-error"),L(typeof t.refreshToken<"u","internal-error");let e="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):gl(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){L(t.length!==0,"internal-error");let e=gl(t);this.updateTokensAndExpiration(t,null,e)}getToken(t,e=!1){return b(this,null,function*(){return!e&&this.accessToken&&!this.isExpired?this.accessToken:(L(this.refreshToken,t,"user-token-expired"),this.refreshToken?(yield this.refresh(t,this.refreshToken),this.accessToken):null)})}clearRefreshToken(){this.refreshToken=null}refresh(t,e){return b(this,null,function*(){let{accessToken:i,refreshToken:r,expiresIn:o}=yield Lp(t,e);this.updateTokensAndExpiration(i,r,Number(o))})}updateTokensAndExpiration(t,e,i){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(t,e){let{refreshToken:i,accessToken:r,expirationTime:o}=e,a=new n;return i&&(L(typeof i=="string","internal-error",{appName:t}),a.refreshToken=i),r&&(L(typeof r=="string","internal-error",{appName:t}),a.accessToken=r),o&&(L(typeof o=="number","internal-error",{appName:t}),a.expirationTime=o),a}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new n,this.toJSON())}_performRefresh(){return Et("not implemented")}};function $t(n,t){L(typeof n=="string"||typeof n>"u","internal-error",{appName:t})}var jt=class n{constructor(t){var{uid:e,auth:i,stsTokenManager:r}=t,o=An(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Uo(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=i,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=o.displayName||null,this.email=o.email||null,this.emailVerified=o.emailVerified||!1,this.phoneNumber=o.phoneNumber||null,this.photoURL=o.photoURL||null,this.isAnonymous=o.isAnonymous||!1,this.tenantId=o.tenantId||null,this.providerData=o.providerData?[...o.providerData]:[],this.metadata=new vn(o.createdAt||void 0,o.lastLoginAt||void 0)}getIdToken(t){return b(this,null,function*(){let e=yield gn(this,this.stsTokenManager.getToken(this.auth,t));return L(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,yield this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e})}getIdTokenResult(t){return ta(this,t)}reload(){return na(this)}_assign(t){this!==t&&(L(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(e=>Object.assign({},e)),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){let e=new n(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){L(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}_updateTokensIfNecessary(t,e=!1){return b(this,null,function*(){let i=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),i=!0),e&&(yield br(this)),yield this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)})}delete(){return b(this,null,function*(){if(et(this.auth.app))return Promise.reject(oi(this.auth));let t=yield this.getIdToken();return yield gn(this,Np(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()})}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(t=>Object.assign({},t)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var i,r,o,a,u,d,m,I;let y=(i=e.displayName)!==null&&i!==void 0?i:void 0,S=(r=e.email)!==null&&r!==void 0?r:void 0,k=(o=e.phoneNumber)!==null&&o!==void 0?o:void 0,g=(a=e.photoURL)!==null&&a!==void 0?a:void 0,A=(u=e.tenantId)!==null&&u!==void 0?u:void 0,$=(d=e._redirectEventId)!==null&&d!==void 0?d:void 0,ue=(m=e.createdAt)!==null&&m!==void 0?m:void 0,te=(I=e.lastLoginAt)!==null&&I!==void 0?I:void 0,{uid:q,emailVerified:me,isAnonymous:Re,providerData:fe,stsTokenManager:$e}=e;L(q&&$e,t,"internal-error");let Ae=fn.fromJSON(this.name,$e);L(typeof q=="string",t,"internal-error"),$t(y,t.name),$t(S,t.name),L(typeof me=="boolean",t,"internal-error"),L(typeof Re=="boolean",t,"internal-error"),$t(k,t.name),$t(g,t.name),$t(A,t.name),$t($,t.name),$t(ue,t.name),$t(te,t.name);let We=new n({uid:q,auth:t,email:S,emailVerified:me,displayName:y,isAnonymous:Re,photoURL:g,phoneNumber:k,tenantId:A,stsTokenManager:Ae,createdAt:ue,lastLoginAt:te});return fe&&Array.isArray(fe)&&(We.providerData=fe.map(B=>Object.assign({},B))),$&&(We._redirectEventId=$),We}static _fromIdTokenResponse(t,e,i=!1){return b(this,null,function*(){let r=new fn;r.updateFromServerResponse(e);let o=new n({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:i});return yield br(o),o})}static _fromGetAccountInfoResponse(t,e,i){return b(this,null,function*(){let r=e.users[0];L(r.localId!==void 0,"internal-error");let o=r.providerUserInfo!==void 0?Nl(r.providerUserInfo):[],a=!(r.email&&r.passwordHash)&&!o?.length,u=new fn;u.updateFromIdToken(i);let d=new n({uid:r.localId,auth:t,stsTokenManager:u,isAnonymous:a}),m={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:o,metadata:new vn(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash)&&!o?.length};return Object.assign(d,m),d})}};var vl=new Map;function St(n){yt(n instanceof Function,"Expected a class definition");let t=vl.get(n);return t?(yt(t instanceof n,"Instance stored in cache mismatched with class"),t):(t=new n,vl.set(n,t),t)}var Up=(()=>{class n{constructor(){this.type="NONE",this.storage={}}_isAvailable(){return b(this,null,function*(){return!0})}_set(e,i){return b(this,null,function*(){this.storage[e]=i})}_get(e){return b(this,null,function*(){let i=this.storage[e];return i===void 0?null:i})}_remove(e){return b(this,null,function*(){delete this.storage[e]})}_addListener(e,i){}_removeListener(e,i){}}return n.type="NONE",n})(),Bo=Up;function fr(n,t,e){return`firebase:${n}:${t}:${e}`}var xr=class n{constructor(t,e,i){this.persistence=t,this.auth=e,this.userKey=i;let{config:r,name:o}=this.auth;this.fullUserKey=fr(this.userKey,r.apiKey,o),this.fullPersistenceKey=fr("persistence",r.apiKey,o),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}getCurrentUser(){return b(this,null,function*(){let t=yield this.persistence._get(this.fullUserKey);if(!t)return null;if(typeof t=="string"){let e=yield Ir(this.auth,{idToken:t}).catch(()=>{});return e?jt._fromGetAccountInfoResponse(this.auth,e,t):null}return jt._fromJSON(this.auth,t)})}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}setPersistence(t){return b(this,null,function*(){if(this.persistence===t)return;let e=yield this.getCurrentUser();if(yield this.removeCurrentUser(),this.persistence=t,e)return this.setCurrentUser(e)})}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static create(t,e,i="authUser"){return b(this,null,function*(){if(!e.length)return new n(St(Bo),t,i);let r=(yield Promise.all(e.map(m=>b(null,null,function*(){if(yield m._isAvailable())return m})))).filter(m=>m),o=r[0]||St(Bo),a=fr(i,t.config.apiKey,t.name),u=null;for(let m of e)try{let I=yield m._get(a);if(I){let y;if(typeof I=="string"){let S=yield Ir(t,{idToken:I}).catch(()=>{});if(!S)break;y=yield jt._fromGetAccountInfoResponse(t,S,I)}else y=jt._fromJSON(t,I);m!==o&&(u=y),o=m;break}}catch{}let d=r.filter(m=>m._shouldAllowMigration);return!o._shouldAllowMigration||!d.length?new n(o,t,i):(o=d[0],u&&(yield o._set(a,u.toJSON())),yield Promise.all(e.map(m=>b(null,null,function*(){if(m!==o)try{yield m._remove(a)}catch{}}))),new n(o,t,i))})}};function _l(n){let t=n.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Vl(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Ml(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Bl(t))return"Blackberry";if(Hl(t))return"Webos";if(Fl(t))return"Safari";if((t.includes("chrome/")||Ll(t))&&!t.includes("edge/"))return"Chrome";if(Ul(t))return"Android";{let e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(e);if(i?.length===2)return i[1]}return"Other"}function Ml(n=ke()){return/firefox\//i.test(n)}function Fl(n=ke()){let t=n.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Ll(n=ke()){return/crios\//i.test(n)}function Vl(n=ke()){return/iemobile/i.test(n)}function Ul(n=ke()){return/android/i.test(n)}function Bl(n=ke()){return/blackberry/i.test(n)}function Hl(n=ke()){return/webos/i.test(n)}function ra(n=ke()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Bp(n=ke()){var t;return ra(n)&&!!(!((t=window.navigator)===null||t===void 0)&&t.standalone)}function Hp(){return Us()&&document.documentMode===10}function $l(n=ke()){return ra(n)||Ul(n)||Hl(n)||Bl(n)||/windows phone/i.test(n)||Vl(n)}function jl(n,t=[]){let e;switch(n){case"Browser":e=_l(ke());break;case"Worker":e=`${_l(ke())}-${n}`;break;default:e=n}let i=t.length?t.join(","):"FirebaseCore-web";return`${e}/JsCore/${Ui}/${i}`}var Ho=class{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){let i=o=>new Promise((a,u)=>{try{let d=t(o);a(d)}catch(d){u(d)}});i.onAbort=e,this.queue.push(i);let r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}runMiddleware(t){return b(this,null,function*(){if(this.auth.currentUser===t)return;let e=[];try{for(let i of this.queue)yield i(t),i.onAbort&&e.push(i.onAbort)}catch(i){e.reverse();for(let r of e)try{r()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:i?.message})}})}};function $p(e){return b(this,arguments,function*(n,t={}){return zi(n,"GET","/v2/passwordPolicy",ea(n,t))})}var jp=6,$o=class{constructor(t){var e,i,r,o;let a=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(e=a.minPasswordLength)!==null&&e!==void 0?e:jp,a.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=a.maxPasswordLength),a.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=a.containsLowercaseCharacter),a.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=a.containsUppercaseCharacter),a.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=a.containsNumericCharacter),a.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=a.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(r=(i=t.allowedNonAlphanumericCharacters)===null||i===void 0?void 0:i.join(""))!==null&&r!==void 0?r:"",this.forceUpgradeOnSignin=(o=t.forceUpgradeOnSignin)!==null&&o!==void 0?o:!1,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,i,r,o,a,u;let d={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,d),this.validatePasswordCharacterOptions(t,d),d.isValid&&(d.isValid=(e=d.meetsMinPasswordLength)!==null&&e!==void 0?e:!0),d.isValid&&(d.isValid=(i=d.meetsMaxPasswordLength)!==null&&i!==void 0?i:!0),d.isValid&&(d.isValid=(r=d.containsLowercaseLetter)!==null&&r!==void 0?r:!0),d.isValid&&(d.isValid=(o=d.containsUppercaseLetter)!==null&&o!==void 0?o:!0),d.isValid&&(d.isValid=(a=d.containsNumericCharacter)!==null&&a!==void 0?a:!0),d.isValid&&(d.isValid=(u=d.containsNonAlphanumericCharacter)!==null&&u!==void 0?u:!0),d}validatePasswordLengthOptions(t,e){let i=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;i&&(e.meetsMinPasswordLength=t.length>=i),r&&(e.meetsMaxPasswordLength=t.length<=r)}validatePasswordCharacterOptions(t,e){this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);let i;for(let r=0;r<t.length;r++)i=t.charAt(r),this.updatePasswordCharacterOptionsStatuses(e,i>="a"&&i<="z",i>="A"&&i<="Z",i>="0"&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(t,e,i,r,o){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=i)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=o))}};var jo=class{constructor(t,e,i,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=i,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Er(this),this.idTokenSubscription=new Er(this),this.beforeStateQueue=new Ho(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=wl,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(o=>this._resolvePersistenceManagerAvailable=o)}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=St(e)),this._initializationPromise=this.queue(()=>b(this,null,function*(){var i,r,o;if(!this._deleted&&(this.persistenceManager=yield xr.create(this,t),(i=this._resolvePersistenceManagerAvailable)===null||i===void 0||i.call(this),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{yield this._popupRedirectResolver._initialize(this)}catch{}yield this.initializeCurrentUser(e),this.lastNotifiedUid=((o=this.currentUser)===null||o===void 0?void 0:o.uid)||null,!this._deleted&&(this._isInitialized=!0)}})),this._initializationPromise}_onStorageEvent(){return b(this,null,function*(){if(this._deleted)return;let t=yield this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!t)){if(this.currentUser&&t&&this.currentUser.uid===t.uid){this._currentUser._assign(t),yield this.currentUser.getIdToken();return}yield this._updateCurrentUser(t,!0)}})}initializeCurrentUserFromIdToken(t){return b(this,null,function*(){try{let e=yield Ir(this,{idToken:t}),i=yield jt._fromGetAccountInfoResponse(this,e,t);yield this.directlySetCurrentUser(i)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),yield this.directlySetCurrentUser(null)}})}initializeCurrentUser(t){return b(this,null,function*(){var e;if(et(this.app)){let a=this.app.settings.authIdToken;return a?new Promise(u=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(a).then(u,u))}):this.directlySetCurrentUser(null)}let i=yield this.assertedPersistence.getCurrentUser(),r=i,o=!1;if(t&&this.config.authDomain){yield this.getOrInitRedirectPersistenceManager();let a=(e=this.redirectUser)===null||e===void 0?void 0:e._redirectEventId,u=r?._redirectEventId,d=yield this.tryRedirectSignIn(t);(!a||a===u)&&d?.user&&(r=d.user,o=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(o)try{yield this.beforeStateQueue.runMiddleware(r)}catch(a){r=i,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(a))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return L(this._popupRedirectResolver,this,"argument-error"),yield this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)})}tryRedirectSignIn(t){return b(this,null,function*(){let e=null;try{e=yield this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch{yield this._setRedirectUser(null)}return e})}reloadAndSetCurrentUserOrClear(t){return b(this,null,function*(){try{yield br(t)}catch(e){if(e?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)})}useDeviceLanguage(){this.languageCode=Ap()}_delete(){return b(this,null,function*(){this._deleted=!0})}updateCurrentUser(t){return b(this,null,function*(){if(et(this.app))return Promise.reject(oi(this));let e=t?It(t):null;return e&&L(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))})}_updateCurrentUser(t,e=!1){return b(this,null,function*(){if(!this._deleted)return t&&L(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||(yield this.beforeStateQueue.runMiddleware(t)),this.queue(()=>b(this,null,function*(){yield this.directlySetCurrentUser(t),this.notifyAuthListeners()}))})}signOut(){return b(this,null,function*(){return et(this.app)?Promise.reject(oi(this)):(yield this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&(yield this._setRedirectUser(null)),this._updateCurrentUser(null,!0))})}setPersistence(t){return et(this.app)?Promise.reject(oi(this)):this.queue(()=>b(this,null,function*(){yield this.assertedPersistence.setPersistence(St(t))}))}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}validatePassword(t){return b(this,null,function*(){this._getPasswordPolicyInternal()||(yield this._updatePasswordPolicy());let e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)})}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}_updatePasswordPolicy(){return b(this,null,function*(){let t=yield $p(this),e=new $o(t);this.tenantId===null?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e})}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new Je("auth","Firebase",t())}onAuthStateChanged(t,e,i){return this.registerStateListener(this.authStateSubscription,t,e,i)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,i){return this.registerStateListener(this.idTokenSubscription,t,e,i)}authStateReady(){return new Promise((t,e)=>{if(this.currentUser)t();else{let i=this.onAuthStateChanged(()=>{i(),t()},e)}})}revokeAccessToken(t){return b(this,null,function*(){if(this.currentUser){let e=yield this.currentUser.getIdToken(),i={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:e};this.tenantId!=null&&(i.tenantId=this.tenantId),yield Vp(this,i)}})}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(t=this._currentUser)===null||t===void 0?void 0:t.toJSON()}}_setRedirectUser(t,e){return b(this,null,function*(){let i=yield this.getOrInitRedirectPersistenceManager(e);return t===null?i.removeCurrentUser():i.setCurrentUser(t)})}getOrInitRedirectPersistenceManager(t){return b(this,null,function*(){if(!this.redirectPersistenceManager){let e=t&&St(t)||this._popupRedirectResolver;L(e,this,"argument-error"),this.redirectPersistenceManager=yield xr.create(this,[St(e._redirectPersistence)],"redirectUser"),this.redirectUser=yield this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager})}_redirectUserForId(t){return b(this,null,function*(){var e,i;return this._isInitialized&&(yield this.queue(()=>b(this,null,function*(){}))),((e=this._currentUser)===null||e===void 0?void 0:e._redirectEventId)===t?this._currentUser:((i=this.redirectUser)===null||i===void 0?void 0:i._redirectEventId)===t?this.redirectUser:null})}_persistUserIfCurrent(t){return b(this,null,function*(){if(t===this.currentUser)return this.queue(()=>b(this,null,function*(){return this.directlySetCurrentUser(t)}))})}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let i=(e=(t=this.currentUser)===null||t===void 0?void 0:t.uid)!==null&&e!==void 0?e:null;this.lastNotifiedUid!==i&&(this.lastNotifiedUid=i,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,i,r){if(this._deleted)return()=>{};let o=typeof e=="function"?e:e.next.bind(e),a=!1,u=this._isInitialized?Promise.resolve():this._initializationPromise;if(L(u,this,"internal-error"),u.then(()=>{a||o(this.currentUser)}),typeof e=="function"){let d=t.addObserver(e,i,r);return()=>{a=!0,d()}}else{let d=t.addObserver(e);return()=>{a=!0,d()}}}directlySetCurrentUser(t){return b(this,null,function*(){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?yield this.assertedPersistence.setCurrentUser(t):yield this.assertedPersistence.removeCurrentUser()})}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return L(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=jl(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}_getAdditionalHeaders(){return b(this,null,function*(){var t;let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let i=yield(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||t===void 0?void 0:t.getHeartbeatsHeader();i&&(e["X-Firebase-Client"]=i);let r=yield this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e})}_getAppCheckToken(){return b(this,null,function*(){var t;if(et(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=yield(t=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||t===void 0?void 0:t.getToken();return e?.error&&yp(`Error while retrieving App Check token: ${e.error}`),e?.token})}};function En(n){return It(n)}var Er=class{constructor(t){this.auth=t,this.observer=null,this.addObserver=$s(e=>this.observer=e)}get next(){return L(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var oa={loadJS(){return b(this,null,function*(){throw new Error("Unable to load external scripts")})},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Gp(n){oa=n}function zp(n){return oa.loadJS(n)}function Wp(){return oa.gapiScript}function Gl(n){return`__${n}${Math.floor(Math.random()*1e6)}`}function aa(n,t){let e=sr(n,"auth");if(e.isInitialized()){let r=e.getImmediate(),o=e.getOptions();if(Lt(o,t??{}))return r;pt(r,"already-initialized")}return e.initialize({options:t})}function qp(n,t){let e=t?.persistence||[],i=(Array.isArray(e)?e:[e]).map(St);t?.errorMap&&n._updateErrorMap(t.errorMap),n._initializeWithPersistence(i,t?.popupRedirectResolver)}function sa(n,t,e){let i=En(n);L(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");let r=!!e?.disableWarnings,o=zl(t),{host:a,port:u}=Kp(t),d=u===null?"":`:${u}`,m={url:`${o}//${a}${d}/`},I=Object.freeze({host:a,port:u,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:r})});if(!i._canInitEmulator){L(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),L(Lt(m,i.config.emulator)&&Lt(I,i.emulatorConfig),i,"emulator-config-failed");return}i.config.emulator=m,i.emulatorConfig=I,i.settings.appVerificationDisabledForTesting=!0,sn(a)?(Ds(`${o}//${a}${d}`),Ns("Auth",!0)):r||Yp()}function zl(n){let t=n.indexOf(":");
17return t<0?"":n.substr(0,t+1)}function Kp(n){let t=zl(n),e=/(\/\/)?([^?#/]+)/.exec(n.substr(t.length));if(!e)return{host:"",port:null};let i=e[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){let o=r[1];return{host:o,port:Cl(i.substr(o.length+1))}}else{let[o,a]=i.split(":");return{host:o,port:Cl(a)}}}function Cl(n){if(!n)return null;let t=Number(n);return isNaN(t)?null:t}function Yp(){function n(){let t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}var _n=class{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Et("not implemented")}_getIdTokenResponse(t){return Et("not implemented")}_linkToIdToken(t,e){return Et("not implemented")}_getReauthenticationResolver(t){return Et("not implemented")}};function ji(n,t){return b(this,null,function*(){return Dp(n,"POST","/v1/accounts:signInWithIdp",ea(n,t))})}var Zp="http://localhost",si=class n extends _n{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){let e=new n(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):pt("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
17once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){let e=typeof t=="string"?JSON.parse(t):t,{providerId:i,signInMethod:r}=e,o=An(e,["providerId","signInMethod"]);if(!i||!r)return null;let a=new n(i,r);return a.idToken=o.idToken||void 0,a.accessToken=o.accessToken||void 0,a.secret=o.secret,a.nonce=o.nonce,a.pendingToken=o.pendingToken||null,a}_getIdTokenResponse(t){let e=this.buildRequest();return ji(t,e)}_linkToIdToken(t,e){let i=this.buildRequest();return i.idToken=e,ji(t,i)}_getReauthenticationResolver(t){let e=this.buildRequest();return e.autoCreate=!1,ji(t,e)}buildRequest(){let t={requestUri:Zp,returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{let e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=Vi(e)}return t}};var Cn=class{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}};var Gi=class extends Cn{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}},In=class n extends Gi{static credentialFromJSON(t){let e=typeof t=="string"?JSON.parse(t):t;return L("providerId"in e&&"signInMethod"in e,"argument-error"),si._fromParams(e)}credential(t){return this._credential(Object.assign(Object.assign({},t),{nonce:t.rawNonce}))}_credential(t){return L(t.idToken||t.accessToken,"argument-error"),si._fromParams(Object.assign(Object.assign({}
17,t),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(t){return n.oauthCredentialFromTaggedObject(t)}static credentialFromError(t){return n.oauthCredentialFromTaggedObject(t.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;let{oauthIdToken:e,oauthAccessToken:i,oauthTokenSecret:r,pendingToken:o,nonce:a,providerId:u}=t;if(!i&&!r&&!e&&!o||!u)return null;try{return new n(u)._credential({idToken:e,accessToken:i,nonce:a,pendingToken:o})}catch{return null}}};var Ar=(()=>{class n extends Gi{constructor(){super("facebook.com")}static credential(e){return si._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return n.credential(e.oauthAccessToken)}catch{return null}}}n.FACEBOOK_SIGN_IN_METHOD="facebook.com",n.PROVIDER_ID="facebook.com";return n})(),la=(()=>{class n extends Gi{constructor(){super("google.com"),this.addScope("profile")}static credential(e,i){return si._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:i})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:i,oauthAccessToken:r}=e;if(!i&&!r)return null;try{return n.credential(i,r)}catch{return null}}}n.GOOGLE_SIGN_IN_METHOD="google.com",n.PROVIDER_ID="google.com";return n})();var bn=class n{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static _fromIdTokenResponse(t,e,i,r=!1){return b(this,null,function*(){let o=yield jt._fromIdTokenResponse(t,i,r),a=Il(i);return new n({user:o,providerId:a,_tokenResponse:i,operationType:e})})}static _forOperation(t,e,i){return b(this,null,function*(){yield t._updateTokensIfNecessary(i,!0);let r=Il(i);return new n({user:t,providerId:r,_tokenResponse:i,operationType:e})})}};function Il(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}var Go=class n extends Qe{constructor(t,e,i,r){var o;super(e.code,e.message),this.operationType=i,this.user=r,Object.setPrototypeOf(this,n.prototype),this.customData={appName:t.name,tenantId:(o=t.tenantId)!==null&&o!==void 0?o:void 0,_serverResponse:e.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(t,e,i,r){return new n(t,e,i,r)}};function Wl(n,t,e,i){return(t==="reauthenticate"?e._getReauthenticationResolver(n):e._getIdTokenResponse(n)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?Go._fromErrorAndOperation(n,o,t,i):o})}function Xp(n,t,e=!1){return b(this,null,function*(){let i=yield gn(n,t._linkToIdToken(n.auth,yield n.getIdToken()),e);return bn._forOperation(n,"link",i)})}function Qp(n,t,e=!1){return b(this,null,function*(){let{auth:i}=n;if(et(i.app))return Promise.reject(oi(i));let r="reauthenticate";try{let o=yield gn(n,Wl(i,r,t,n),e);L(o.idToken,i,"internal-error");let a=ia(o.idToken);L(a,i,"internal-error");let{sub:u}=a;return L(n.uid===u,i,"user-mismatch"),bn._forOperation(n,r,o)}catch(o){throw o?.code==="auth/user-not-found"&&pt(i,"user-mismatch"),o}})}function Jp(n,t,e=!1){return b(this,null,function*(){if(et(n.app))return Promise.reject(oi(n));let i="signIn",r=yield Wl(n,i,t),o=yield bn._fromIdTokenResponse(n,i,r);return e||(yield n._updateCurrentUser(o.user)),o})}function ca(n,t,e,i){return It(n).onIdTokenChanged(t,e,i)}function da(n,t,e){return It(n).beforeAuthStateChanged(t,e)}function ua(n){return It(n).signOut()}var Sr="__sak";var yr=class{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(Sr,"1"),this.storage.removeItem(Sr),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){let e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}};var em=1e3,tm=10,im=(()=>{class n extends yr{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,i)=>this.onStorageEvent(e,i),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=$l(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let i of Object.keys(this.listeners)){let r=this.storage.getItem(i),o=this.localCache[i];r!==o&&e(i,o,r)}}
vendor: 9,468 bytes, line 17
17onStorageEvent(e,i=!1){if(!e.key){this.forAllChangedKeys((u,d,m)=>{this.notifyListeners(u,m)});return}let r=e.key;i?this.detachListener():this.stopPolling();let o=()=>{let u=this.storage.getItem(r);!i&&this.localCache[r]===u||this.notifyListeners(r,u)},a=this.storage.getItem(r);Hp()&&a!==e.newValue&&e.newValue!==e.oldValue?setTimeout(o,tm):o()}notifyListeners(e,i){this.localCache[e]=i;let r=this.listeners[e];if(r)for(let o of Array.from(r))o(i&&JSON.parse(i))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,i,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:i,newValue:r}),!0)})},em)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,i){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(i)}_removeListener(e,i){this.listeners[e]&&(this.listeners[e].delete(i),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}_set(e,i){return b(this,null,function*(){yield zt(n.prototype,this,"_set").call(this,e,i),this.localCache[e]=JSON.stringify(i)})}_get(e){return b(this,null,function*(){let i=yield zt(n.prototype,this,"_get").call(this,e);return this.localCache[e]=JSON.stringify(i),i})}_remove(e){return b(this,null,function*(){yield zt(n.prototype,this,"_remove").call(this,e),delete this.localCache[e]})}}return n.type="LOCAL",n})(),ql=im;var nm=(()=>{class n extends yr{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,i){}_removeListener(e,i){}}return n.type="SESSION",n})(),pa=nm;function rm(n){return Promise.all(n.map(t=>b(null,null,function*(){try{return{fulfilled:!0,value:yield t}}catch(e){return{fulfilled:!1,reason:e}}})))}var om=(()=>{class n{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let i=this.receivers.find(o=>o.isListeningto(e));if(i)return i;let r=new n(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}handleEvent(e){return b(this,null,function*(){let i=e,{eventId:r,eventType:o,data:a}=i.data,u=this.handlersMap[o];if(!u?.size)return;i.ports[0].postMessage({status:"ack",eventId:r,eventType:o});let d=Array.from(u).map(I=>b(this,null,function*(){return I(i.origin,a)})),m=yield rm(d);i.ports[0].postMessage({status:"done",eventId:r,eventType:o,response:m})})}_subscribe(e,i){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(i)}_unsubscribe(e,i){this.handlersMap[e]&&i&&this.handlersMap[e].delete(i),(!i||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}n.receivers=[];return n})();function ma(n="",t=10){let e="";for(let i=0;i<t;i++)e+=Math.floor(Math.random()*10);return n+e}var zo=class{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}_send(t,e,i=50){return b(this,null,function*(){let r=typeof MessageChannel<"u"?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let o,a;return new Promise((u,d)=>{let m=ma("",20);r.port1.start();let I=setTimeout(()=>{d(new Error("unsupported_event"))},i);a={messageChannel:r,onMessage(y){let S=y;if(S.data.eventId===m)switch(S.data.status){case"ack":clearTimeout(I),o=setTimeout(()=>{d(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),u(S.data.response);break;default:clearTimeout(I),clearTimeout(o),d(new Error("invalid_response"));break}}},this.handlers.add(a),r.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:t,eventId:m,data:e},[r.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})})}};function ut(){return window}function am(n){ut().location.href=n}function Kl(){return typeof ut().WorkerGlobalScope<"u"&&typeof ut().importScripts=="function"}function sm(){return b(this,null,function*(){if(!navigator?.serviceWorker)return null;try{return(yield navigator.serviceWorker.ready).active}catch{return null}})}function lm(){var n;return((n=navigator?.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function cm(){return Kl()?self:null}var Yl="firebaseLocalStorageDb",dm=1,Tr="firebaseLocalStorage",Zl="fbase_key",li=class{constructor(t){this.request=t}toPromise(){return new Promise((t,e)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{e(this.request.error)})})}};function Or(n,t){return n.transaction([Tr],t?"readwrite":"readonly").objectStore(Tr)}function um(){let n=indexedDB.deleteDatabase(Yl);return new li(n).toPromise()}function Wo(){let n=indexedDB.open(Yl,dm);return new Promise((t,e)=>{n.addEventListener("error",()=>{e(n.error)}),n.addEventListener("upgradeneeded",()=>{let i=n.result;try{i.createObjectStore(Tr,{keyPath:Zl})}catch(r){e(r)}}),n.addEventListener("success",()=>b(null,null,function*(){let i=n.result;i.objectStoreNames.contains(Tr)?t(i):(i.close(),yield um(),t(yield Wo()))}))})}function bl(n,t,e){return b(this,null,function*(){let i=Or(n,!0).put({[Zl]:t,value:e});return new li(i).toPromise()})}function pm(n,t){return b(this,null,function*(){let e=Or(n,!1).get(t),i=yield new li(e).toPromise();return i===void 0?null:i.value})}function xl(n,t){let e=Or(n,!0).delete(t);return new li(e).toPromise()}var mm=800,hm=3,fm=(()=>{class n{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}_openDb(){return b(this,null,function*(){return this.db?this.db:(this.db=yield Wo(),this.db)})}_withRetries(e){return b(this,null,function*(){let i=0;for(;;)try{let r=yield this._openDb();return yield e(r)}catch(r){if(i++>hm)throw r;this.db&&(this.db.close(),this.db=void 0)}})}initializeServiceWorkerMessaging(){return b(this,null,function*(){return Kl()?this.initializeReceiver():this.initializeSender()})}initializeReceiver(){return b(this,null,function*(){this.receiver=om._getInstance(cm()),this.receiver._subscribe("keyChanged",(e,i)=>b(this,null,function*(){return{keyProcessed:(yield this._poll()).includes(i.key)}})),this.receiver._subscribe("ping",(e,i)=>b(this,null,function*(){return["keyChanged"]}))})}initializeSender(){return b(this,null,function*(){var e,i;if(this.activeServiceWorker=yield sm(),!this.activeServiceWorker)return;this.sender=new zo(this.activeServiceWorker);let r=yield this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((i=r[0])===null||i===void 0)&&i.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)})}notifyServiceWorker(e){return b(this,null,function*(){if(!(!this.sender||!this.activeServiceWorker||lm()!==this.activeServiceWorker))try{yield this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}})}_isAvailable(){return b(this,null,function*(){try{if(!indexedDB)return!1;let e=yield Wo();return yield bl(e,Sr,"1"),yield xl(e,Sr),!0}catch{}return!1})}_withPendingWrite(e){return b(this,null,function*(){this.pendingWrites++;try{yield e()}finally{this.pendingWrites--}})}_set(e,i){return b(this,null,function*(){return this._withPendingWrite(()=>b(this,null,function*(){return yield this._withRetries(r=>bl(r,e,i)),this.localCache[e]=i,this.notifyServiceWorker(e)}))})}_get(e){return b(this,null,function*(){let i=yield this._withRetries(r=>pm(r,e));return this.localCache[e]=i,i})}_remove(e){return b(this,null,function*(){return this._withPendingWrite(()=>b(this,null,function*(){return yield this._withRetries(i=>xl(i,e)),delete this.localCache[e],this.notifyServiceWorker(e)}))})}_poll(){return b(this,null,function*(){let e=yield this._withRetries(o=>{let a=Or(o,!1).getAll();return new li(a).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let i=[],r=new Set;if(e.length!==0)for(let{fbase_key:o,value:a}of e)r.add(o),JSON.stringify(this.localCache[o])!==JSON.stringify(a)&&(this.notifyListeners(o,a),i.push(o));for(let o of Object.keys(this.localCache))this.localCache[o]&&!r.has(o)&&(this.notifyListeners(o,null),i.push(o));return i})}notifyListeners(e,i){this.localCache[e]=i;let r=this.listeners[e];if(r)for(let o of Array.from(r))o(i)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>b(this,null,function*(){return this._poll()}),mm)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,i){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(i)}_removeListener(e,i){this.listeners[e]&&(this.listeners[e].delete(i),this.listeners[e].size===0&&delete this.listeners[e]),Ob
17ject.keys(this.listeners).length===0&&this.stopPolling()}}return n.type="LOCAL",n})(),Xl=fm;var $C=Gl("rcb"),jC=new ai(3e4,6e4);function Ql(n,t){return t?St(t):(L(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}var xn=class extends _n{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return ji(t,this._buildIdpRequest())}_linkToIdToken(t,e){return ji(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return ji(t,this._buildIdpRequest())}_buildIdpRequest(t){let e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}};function gm(n){return Jp(n.auth,new xn(n),n.bypassAuthState)}function vm(n){let{auth:t,user:e}=n;return L(e,t,"internal-error"),Qp(e,new xn(n),n.bypassAuthState)}function _m(n){return b(this,null,function*(){let{auth:t,user:e}=n;return L(e,t,"internal-error"),Xp(e,new xn(n),n.bypassAuthState)})}var Pr=class{constructor(t,e,i,r,o=!1){this.auth=t,this.resolver=i,this.user=r,this.bypassAuthState=o,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((t,e)=>b(this,null,function*(){this.pendingPromise={resolve:t,reject:e};try{this.eventManager=yield this.resolver._initialize(this.auth),yield this.onExecution(),this.eventManager.registerConsumer(this)}catch(i){this.reject(i)}}))}onAuthEvent(t){return b(this,null,function*(){let{urlResponse:e,sessionId:i,postBody:r,tenantId:o,error:a,type:u}=t;if(a){this.reject(a);return}let d={auth:this.auth,requestUri:e,sessionId:i,tenantId:o||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(yield this.getIdpTask(u)(d))}catch(m){this.reject(m)}})}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return gm;case"linkViaPopup":case"linkViaRedirect":return _m;case"reauthViaPopup":case"reauthViaRedirect":return vm;default:pt(this.auth,"internal-error")}}resolve(t){yt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){yt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}};var Cm=new ai(2e3,1e4);function ha(n,t,e){return b(this,null,function*(){if(et(n.app))return Promise.reject(it(n,"operation-not-supported-in-this-environment"));let i=En(n);Tp(n,t,Cn);let r=Ql(i,e);return new Im(i,"signInViaPopup",t,r).executeNotNull()})}var Im=(()=>{class n extends Pr{constructor(e,i,r,o,a){super(e,i,o,a),this.provider=r,this.authWindow=null,this.pollId=null,n.currentPopupAction&&n.currentPopupAction.cancel(),n.currentPopupAction=this}executeNotNull(){return b(this,null,function*(){let e=yield this.execute();return L(e,this.auth,"internal-error"),e})}onExecution(){return b(this,null,function*(){yt(this.filter.length===1,"Popup operations only handle one event");let e=ma();this.authWindow=yield this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(i=>{this.reject(i)}),this.resolver._isIframeWebStorageSupported(this.auth,i=>{i||this.reject(it(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()})}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(it(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,n.currentPopupAction=null}pollUserCancellation(){let e=()=>{var i,r;if(!((r=(i=this.authWindow)===null||i===void 0?void 0:i.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(it(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Cm.get())};e()}}n.currentPopupAction=null;return n})(),bm="pendingRedirect",gr=new Map,qo=class n extends Pr{constructor(t,e,i=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,i),this.eventId=null}execute(){return b(this,null,function*(){let t=gr.get(this.auth._key());if(!t){try{let i=(yield xm(this.resolver,this.auth))?yield zt(n.prototype,this,"execute").call(this):null;t=()=>Promise.resolve(i)}catch(e){t=()=>Promise.reject(e)}gr.set(this.auth._key(),t)}return this.bypassAuthState||gr.set(this.auth._key(),()=>Promise.resolve(null)),t()})}
17onAuthEvent(t){return b(this,null,function*(){if(t.type==="signInViaRedirect")return zt(n.prototype,this,"onAuthEvent").call(this,t);if(t.type==="unknown"){this.resolve(null);return}if(t.eventId){let e=yield this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,zt(n.prototype,this,"onAuthEvent").call(this,t);this.resolve(null)}})}onExecution(){return b(this,null,function*(){})}cleanUp(){}};function xm(n,t){return b(this,null,function*(){let e=ym(t),i=Sm(n);if(!(yield i._isAvailable()))return!1;let r=(yield i._get(e))==="true";return yield i._remove(e),r})}function Em(n,t){gr.set(n._key(),t)}function Sm(n){return St(n._redirectPersistence)}function ym(n){return fr(bm,n.config.apiKey,n.name)}function fa(n,t){return b(this,null,function*(){return yield En(n)._initializationPromise,Jl(n,t,!1)})}function Jl(n,t,e=!1){return b(this,null,function*(){if(et(n.app))return Promise.reject(oi(n));let i=En(n),r=Ql(i,t),a=yield new qo(i,r,e).execute();return a&&!e&&(delete a.user._redirectEventId,yield i._persistUserIfCurrent(a.user),yield i._setRedirectUser(null,t)),a})}var Tm=10*60*1e3,Ko=class{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach(i=>{this.isEventForConsumer(t,i)&&(e=!0,this.sendToConsumer(t,i),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!Pm(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var i;if(t.error&&!ec(t)){let r=((i=t.error.code)===null||i===void 0?void 0:i.split("auth/")[1])||"internal-error";e.onError(it(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){let i=e.eventId===null||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&i}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=Tm&&this.cachedEventUids.clear(),this.cachedEventUids.has(El(t))}saveEventToCache(t){this.cachedEventUids.add(El(t)),this.lastProcessedEventTime=Date.now()}};function El(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(t=>t).join("-")}function ec({type:n,error:t}){return n==="unknown"&&t?.code==="auth/no-auth-event"}function Pm(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ec(n);default:return!1}}function km(e){return b(this,arguments,function*(n,t={}){return zi(n,"GET","/v1/projects",t)})}var Am=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Om=/^https?/;function wm(n){return b(this,null,function*(){if(n.config.emulator)return;let{authorizedDomains:t}=yield km(n);for(let e of t)try{if(Rm(e))return}catch{}pt(n,"unauthorized-domain")})}function Rm(n){let t=Lo(),{protocol:e,hostname:i}=new URL(t);if(n.startsWith("chrome-extension://")){let a=new URL(n);return a.hostname===""&&i===""?e==="chrome-extension:"&&n.replace("chrome-extension://","")===t.replace("chrome-extension://",""):e==="chrome-extension:"&&a.hostname===i}if(!Om.test(e))return!1;if(Am.test(n))return i===n;let r=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}var Dm=new ai(3e4,6e4);function Sl(){let n=ut().___jsl;if(n?.H){for(let t of Object.keys(n.H))if(n.H[t].r=n.H[t].r||[],n.H[t].L=n.H[t].L||[],n.H[t].r=[...n.H[t].L],n.CP)for(let e=0;e<n.CP.length;e++)n.CP[e]=null}}function Nm(n){return new Promise((t,e)=>{var i,r,o;function a(){Sl(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Sl(),e(it(n,"network-request-failed"))},timeout:Dm.get()})}if(!((r=(i=ut().gapi)===null||i===void 0?void 0:i.iframes)===null||r===void 0)&&r.Iframe)t(gapi.iframes.getContext());else if(!((o=ut().gapi)===null||o===void 0)&&o.load)a();else{let u=Gl("iframefcb");return ut()[u]=()=>{gapi.load?a():e(it(n,"network-request-failed"))},zp(`${Wp()}?onload=${u}`).catch(d=>e(d))}}).catch(t=>{throw vr=null,t})}var vr=null;function Mm(n){return vr=vr||Nm(n),vr}var Fm=new ai(5e3,15e3),Lm="__/auth/iframe",Vm="emulator/auth/iframe",Um={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Bm=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Hm(n){let t=n.config;L(t.authDomain,n,"auth-domain-config-required");let e=t.emulator?Jo(t,Vm):`https://${n.config.authDomain}/${Lm}`,i={apiKey:t.apiKey,appName:n.name,v:Ui},r=Bm.get(n.config.apiHost);r&&(i.eid=r);let o=n._getFrameworks();return o.length&&(i.fw=o.join(",")),`${e}?${Vi(i).slice(1)}`}function $m(n){return b(this,null,function*(){let t=yield Mm(n),e=ut().gapi;return L(e,n,"internal-error"),t.open({where:document.body,url:Hm(n),messageHandlersFilter:e.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Um,dontclear:!0},i=>new Promise((r,o)=>b(null,null,function*(){yield i.restyle({setHideOnLeave:!1});let a=it(n,"network-request-failed"),u=ut().setTimeout(()=>{o(a)},Fm.get());function d(){ut().clearTimeout(u),r(i)}i.ping(d).then(d,()=>{o(a)})})))})}var jm={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Gm=500,zm=600,Wm="_blank",qm="http://localhost",kr=class{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Km(n,t,e,i=Gm,r=zm){let o=Math.max((window.screen.availHeight-r)/2,0).toString(),a=Math.max((window.screen.availWi
17dth-i)/2,0).toString(),u="",d=Object.assign(Object.assign({},jm),{width:i.toString(),height:r.toString(),top:o,left:a}),m=ke().toLowerCase();e&&(u=Ll(m)?Wm:e),Ml(m)&&(t=t||qm,d.scrollbars="yes");let I=Object.entries(d).reduce((S,[k,g])=>`${S}${k}=${g},`,"");if(Bp(m)&&u!=="_self")return Ym(t||"",u),new kr(null);let y=window.open(t||"",u,I);L(y,n,"popup-blocked");try{y.focus()}catch{}return new kr(y)}function Ym(n,t){let e=document.createElement("a");e.href=n,e.target=t;let i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),e.dispatchEvent(i)}var Zm="__/auth/handler",Xm="emulator/auth/handler",Qm=encodeURIComponent("fac");function yl(n,t,e,i,r,o){return b(this,null,function*(){L(n.config.authDomain,n,"auth-domain-config-required"),L(n.config.apiKey,n,"invalid-api-key");let a={apiKey:n.config.apiKey,appName:n.name,authType:e,redirectUrl:i,v:Ui,eventId:r};if(t instanceof Cn){t.setDefaultLanguage(n.languageCode),a.providerId=t.providerId||"",Hs(t.getCustomParameters())||(a.customParameters=JSON.stringify(t.getCustomParameters()));for(let[I,y]of Object.entries(o||{}))a[I]=y}if(t instanceof Gi){let I=t.getScopes().filter(y=>y!=="");I.length>0&&(a.scopes=I.join(","))}n.tenantId&&(a.tid=n.tenantId);let u=a;for(let I of Object.keys(u))u[I]===void 0&&delete u[I];let d=yield n._getAppCheckToken(),m=d?`#${Qm}=${encodeURIComponent(d)}`:"";return`${Jm(n)}?${Vi(u).slice(1)}${m}`})}function Jm({config:n}){return n.emulator?Jo(n,Xm):`https://${n.authDomain}/${Zm}`}var Fo="webStorageSupport",Yo=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=pa,this._completeRedirectFn=Jl,this._overrideRedirectResult=Em}_openPopup(t,e,i,r){return b(this,null,function*(){var o;yt((o=this.eventManagers[t._key()])===null||o===void 0?void 0:o.manager,"_initialize() not called before _openPopup()");let a=yield yl(t,e,i,Lo(),r);return Km(t,a,ma())})}_openRedirect(t,e,i,r){return b(this,null,function*(){yield this._originValidation(t);let o=yield yl(t,e,i,Lo(),r);return am(o),new Promise(()=>{})})}_initialize(t){let e=t._key();if(this.eventManagers[e]){let{manager:r,promise:o}=this.eventManagers[e];return r?Promise.resolve(r):(yt(o,"If manager is not set, promise should be"),o)}let i=this.initAndGetManager(t);return this.eventManagers[e]={promise:i},i.catch(()=>{delete this.eventManagers[e]}),i}initAndGetManager(t){return b(this,null,function*(){let e=yield $m(t),i=new Ko(t);return e.register("authEvent",r=>
17(L(r?.authEvent,t,"invalid-auth-event"),{status:i.onEvent(r.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:i},this.iframes[t._key()]=e,i})}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(Fo,{type:Fo},r=>{var o;let a=(o=r?.[0])===null||o===void 0?void 0:o[Fo];a!==void 0&&e(!!a),pt(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){let e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=wm(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return $l()||Fl()||ra()}},tc=Yo;var Tl="@firebase/auth",Pl="1.10.8";var Zo=class{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),((t=this.auth.currentUser)===null||t===void 0?void 0:t.uid)||null}getToken(t){return b(this,null,function*(){return this.assertAuthConfigured(),yield this.auth._initializationPromise,this.auth.currentUser?{accessToken:yield this.auth.currentUser.getIdToken(t)}:null})}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;let e=this.auth.onIdTokenChanged(i=>{t(i?.stsTokenManager.accessToken||null)});this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();let e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){L(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function eh(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function th(n){xt(new He("auth",(t,{options:e})=>{let i=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),o=t.getProvider("app-check-internal"),{apiKey:a,authDomain:u}=i.options;L(a&&!a.includes(":"),"invalid-api-key",{appName:i.name});let d={apiKey:a,authDomain:u,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:jl(n)},m=new jo(i,r,o,d);return qp(m,e),m},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,e,i)=>{t.getProvider("auth-internal").initialize()})),xt(new He("auth-internal",t=>{let e=En(t.getProvider("auth").getImmediate());return(i=>new Zo(i))(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),Ee(Tl,Pl,eh(n)),Ee(Tl,Pl,"esm2017")}
17var ih=5*60,nh=uo("authIdTokenMaxAge")||ih,kl=null,rh=n=>t=>b(null,null,function*(){let e=t&&(yield t.getIdTokenResult()),i=e&&(new Date().getTime()-Date.parse(e.issuedAtTime))/1e3;if(i&&i>nh)return;let r=e?.token;kl!==r&&(kl=r,yield fetch(n,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});function ga(n=dn()){let t=sr(n,"auth");if(t.isInitialized())return t.getImmediate();let e=aa(n,{popupRedirectResolver:tc,persistence:[Xl,ql,pa]}),i=uo("authTokenSyncURL");if(i&&typeof isSecureContext=="boolean"&&isSecureContext){let o=new URL(i,location.origin);if(location.origin===o.origin){let a=rh(o.toString());da(e,a,()=>a(e.currentUser)),ca(e,u=>a(u))}}let r=Rs("auth");return r&&sa(e,`http://${r}`),e}function oh(){var n,t;return(t=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&t!==void 0?t:document}Gp({loadJS(n){return new Promise((t,e)=>{let i=document.createElement("script");i.setAttribute("src",n),i.onload=t,i.onerror=r=>{let o=it("internal-error");o.customData=r,e(o)},i.type="text/javascript",i.charset="UTF-8",oh().appendChild(i)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});th("Browser");var ic="auth",ci=class{constructor(t){return t}},va=class{constructor(){return dr(ic)}};var _a=new rt("angularfire2.auth-instances");function Yh(n,t){let e=Po(ic,n,t);return e&&new ci(e)}function Zh(n){return(t,e)=>{let i=t.runOutsideAngular(()=>n(e));return new ci(i)}}var Xh={provide:va,deps:[[new qt,_a]]},Qh={provide:ci,useFactory:Yh,deps:[[new qt,_a],ri]};function kI(n,...t){return Ee("angularfire",Hi.full,"auth"),Kt([Qh,Xh,{provide:_a,useFactory:Zh(n),multi:!0,deps:[Ue,Pt,$i,un,[new qt,pr],...t]}])}var AI=Bt(ga,!0);var nc=Bt(fa,!0);var Sn=Bt(ha,!0,2);var rc=Bt(ua,!0,2);var wr=class n{constructor(t,e,i,r,o){this.http=t;this.auth=e;this.router=i;this.store=r;this.cartPersistenceService=o;this.apiUrl=pe.EXTERNALAPIURL;this.EXPIRATION_DURATION=864e5;this.headers=new Ya({"Content-Type":"application/json",Accept:"application/json"})}startSessionTimer(){let t=new Date().getTime()+this.EXPIRATION_DURATION;localStorage.setItem("expirationDate",t.toString()),this.autoLogout(this.EXPIRATION_DURATION)}autoLogout(t){console.log(`Sess\xE3o ir\xE1 expirar em: ${t/1e3/60} minutos`),this.tokenExpirationTimer&&clearTimeout(this.tokenExpirationTimer),this.tokenExpirationTimer=setTimeout(()=>{this.logout()},t)}checkAutoLogin(){let t=localStorage.getItem("expirationDate");if(!t)return;let e=new Date().getTime(),r=Number(t)-e;r>0?this.autoLogout(r):this.logout()}ResetPassword(t){return this.http.get(`${this.apiUrl}/cliente/SendPasswordRequest`,{headers:this.headers,params:{email:t}}).pipe(xe(e=>(console.error("Erro no reenvio do e-mail:",e.error.dsMessage||e.message),On(()=>e))))}login(t){let e=t.nrSession??this.cartPersistenceService.getCurrentSessionId(),i=U({login:t.dsEmail,stSenha:t.stSenha},e?{nrSession:e}:{});return this.http.post(`${this.apiUrl}/Cliente/LogInCliente`,i).pipe(qr(r=>{this.startSessionTimer()}),xe(r=>{throw console.error("Erro ao fazer login 01:",r.message||r),r}))}register(t){return this.http.post(`${this.apiUrl}/cliente/CreateAccount`,t,{headers:this.headers}).pipe(xe(e=>(console.error("Erro ao cadastrar usu\xE1rio:",e.error.dsMessage||e.message),On(()=>e))))}loginMidiaSocial(t){let e=t.nrSession??this.cartPersistenceService.getCurrentSessionId(),i=U(U({},t),e?{nrSession:e}:{});return this.http.post(`${this.apiUrl}/cliente/loginSocialMidia`,i,{headers:this.headers}).pipe(qr(r=>{this.startSessionTimer()}),xe(r=>(console.error("Erro ao efeturar login com a rede social:",r.error.dsMessage||r.message),On(()=>r))))}logout(){this.tokenExpirationTimer&&(clearTimeout(this.tokenExpirationTimer),this.tokenExpirationTimer=null),localStorage.removeItem("expirationDate"),localStorage.removeItem("cart"),localStorage.removeItem("cart_last_update"),localStorage.removeItem("book"),this.cartPersistenceService.clearCurrentSessionId(),this.store.dispatch(Zt()),this.store.dispatch(Ts()),this.auth.signOut().then(()=>{this.router.navigate(["/login"])})}loginWithGoogle(){return b(this,null,function*(){let t=new la;return yield Sn(this.auth,t)})}loginWithFacebook(){return b(this,null,function*(){let t=new Ar;return yield Sn(this.auth,t)})}getFacebookRedirectResult(){return b(this,null,function*(){return yield nc(this.auth)})}loginWithApple(){return b(this,null,function*(){let t=new In("apple.com");return yield Sn(this.auth,t)})}logoutFirebase(){return console.log("logoutFirebase"),rc(this.auth)}loginWithFacebookPopup(){return b(this,null,function*(){let t=new Ar;return t.addScope("email"),yield Sn(this.auth,t)})}static{this.\u0275fac=function(e){return new(e||n)(Y(Le),Y(ci),Y(ze),Y(Ie),Y(Nt))}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};var Gt=function(n){return n[n.State=0]="State",n[n.Transition=1]="Transition",n[n.Sequence=2]="Sequence",n[n.Group=3]="Group",n[n.Animate=4]="Animate",n[n.Keyframes=5]="Keyframes",n[n.Style=6]="Style",n[n.Trigger=7]="Trigger",n[n.Reference=8]="Reference",n[n.AnimateChild=9]="AnimateChild",n[n.AnimateRef=10]="AnimateRef",n[n.Query=11]="Query",n[n.Stagger=12]="Stagger",n}(Gt||{}),tf="*";function ba(n,t){return{type:Gt.Trigger,name:n,definitions:t,options:{}}}function Rr(n,t=null){return{type:Gt.Animate,styles:t,timings:n}}function jI(n,t=null){return{type:Gt.Sequence,steps:n,options:t}}function yn(n){return{type:Gt.Style,styles:n,offset:null}}function Tn(n,t,e){return{type:Gt.State,name:n,styles:t,options:e}}function Dr(n,t,e=null){return{type:Gt.Transition,expr:n,animation:t,options:e}}var Ca=class{_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_originalOnDoneFns=[];_originalOnStartFns=[];_started=!1;_destroyed=!1;_finished=!1;_position=0;parentPlayer=null;totalTime;constructor(t=0,e=0){this.totalTime=t+e}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(t=>t()),this._onDoneFns=[])}onStart(t){this._originalOnStartFns.push(t),this._onStartFns.push(t)}onDone(t){this._originalOnDoneFns.push(t),this._onDoneFns.push(t)}onDestroy(t){this._onDestroyFns.push(t)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(t=>t()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(t=>t()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(t){this._position=this.totalTime?t*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(t){let e=t=="start"?this._onStartFns:this._onDoneFns;e.forEach(i=>
17i()),e.length=0}},Ia=class{_onDoneFns=[];_onStartFns=[];_finished=!1;_started=!1;_destroyed=!1;_onDestroyFns=[];parentPlayer=null;totalTime=0;players;constructor(t){this.players=t;let e=0,i=0,r=0,o=this.players.length;o==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(a=>{a.onDone(()=>{++e==o&&this._onFinish()}),a.onDestroy(()=>{++i==o&&this._onDestroy()}),a.onStart(()=>{++r==o&&this._onStart()})}),this.totalTime=this.players.reduce((a,u)=>Math.max(a,u.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(t=>t()),this._onDoneFns=[])}init(){this.players.forEach(t=>t.init())}onStart(t){this._onStartFns.push(t)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(t=>t()),this._onStartFns=[])}onDone(t){this._onDoneFns.push(t)}onDestroy(t){this._onDestroyFns.push(t)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(t=>t.play())}pause(){this.players.forEach(t=>t.pause())}restart(){this.players.forEach(t=>t.restart())}finish(){this._onFinish(),this.players.forEach(t=>t.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(t=>t.destroy()),this._onDestroyFns.forEach(t=>t()),this._onDestroyFns=[])}reset(){this.players.forEach(t=>t.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(t){let e=t*this.totalTime;this.players.forEach(i=>{let r=i.totalTime?Math.min(1,e/i.totalTime):1;i.setPosition(r)})}getPosition(){let t=this.players.reduce((e,i)=>e===null||i.totalTime>e.totalTime?i:e,null);return t!=null?t.getPosition():0}beforeDestroy(){this.players.forEach(t=>{t.beforeDestroy&&t.beforeDestroy()})}triggerCallback(t){let e=t=="start"?this._onStartFns:this._onDoneFns;e.forEach(i=>i()),e.length=0}},nf="!";var oc=["toast-component",""];function rf(n,t){if(n&1){let e=z();s(0,"button",5),M("click",function(){R(e);let r=C();return D(r.remove())}),s(1,"span",6),p(2,"\xD7"),c()()}}function of(n,t){if(n&1&&(ce(0),p(1),de()),n&2){let e=C(2);l(),E("[",e.duplicatesCount+1,"]")}}function af(n,t){if(n&1&&(s(0,"div"),p(1),x(2,of,2,1,"ng-container",4),c()),n&2){let e=C();Ge(e.options.titleClass),Xi("aria-label",e.title),l(),E(" ",e.title," "),l(),h("ngIf",e.duplicatesCount)}}function sf(n,t){if(n&1&&T(0,"div",7),n&2){let e=C();Ge(e.options.messageClass),h("innerHTML",e.message,Yr)}}function lf(n,t){if(n&1&&(s(0,"div",8),p(1),c()),n&2){let e=C();Ge(e.options.messageClass),Xi("aria-label",e.message),l(),E(" ",e.message," ")}}function cf(n,t){if(n&1&&(s(0,"div"),T(1,"div",9),c()),n&2){let e=C();l(),ye("width",e.width()+"%")}}function df(n,t){if(n&1){let e=z();s(0,"button",5),M("click",function(){R(e);let r=C();return D(r.remove())}),s(1,"span",6),p(2,"\xD7"),c()()}}function uf(n,t){if(n&1&&(ce(0),p(1),de()),n&2){let e=C(2);l(),E("[",e.duplicatesCount+1,"]")}}function pf(n,t){if(n&1&&(s(0,"div"),p(1),x(2,uf,2,1,"ng-container",4),c()),n&2){let e=C();Ge(e.options.titleClass),Xi("aria-label",e.title),l(),E(" ",e.title," "),l(),h("ngIf",e.duplicatesCount)}}function mf(n,t){if(n&1&&T(0,"div",7),n&2){let e=C();Ge(e.options.messageClass),h("innerHTML",e.message,Yr)}}function hf(n,t){if(n&1&&(s(0,"div",8),p(1),c()),n&2){let e=C();Ge(e.options.messageClass),Xi("aria-label",e.message),l(),E(" ",e.message," ")}}function ff(n,t){if(n&1&&(s(0,"div"),T(1,"div",9),c()),n&2){let e=C();l(),ye("width",e.width()+"%")}}var xa=class{_attachedHost;component;viewContainerRef;injector;constructor(t,e){this.component=t,this.injector=e}attach(t,e){return this._attachedHost=t,t.attach(this,e)}detach(){let t=this._attachedHost;if(t)return this._attachedHost=void 0,t.detach()}get isAttached(){return this._attachedHost!=null}setAttachedHost(t){this._attachedHost=t}},Ea=class{_attachedPortal;_disposeFn;attach(t,e){return this._attachedPortal=t,this.attachComponentPortal(t,e)}detach(){this._attachedPortal&&this._attachedPortal.setAttachedHost(),this._attachedPortal=void 0,this._disposeFn&&(this._disposeFn(),this._disposeFn=void 0)}setDisposeFn(t){this._disposeFn=t}},Sa=class{_overlayRef;componentInstance;duplicatesCount=0;_afterClosed=new nt;_activate=new nt;_manualClose=new nt;_resetTimeout=new nt;_countDuplicate=new nt;constructor(t){this._overlayRef=t}manualClose(){this._manualClose.next(),this._manualClose.complete()}manualClosed(){return this._manualClose.asObservable()}timeoutReset(){return this._resetTimeout.asObservable()}countDuplicate(){return this._countDuplicate.asObservable()}close(){this._overlayRef.detach(),this._afterClosed.next(),this._manualClose.next(),this._afterClosed.complete(),this._manualClose.complete(),this._activate.complete(),this._resetTimeout.complete(),this._countDuplicate.complete()}afterClosed(){return this._afterClosed.asObservable()}isInactive(){return this._activate.isStopped}activate(){this._activate.next(),this._activate.complete()}afterActivate(){return this._activate.asObservable()}
vendor: 16,036 bytes, line 17
17onDuplicate(t,e){t&&this._resetTimeout.next(),e&&this._countDuplicate.next(++this.duplicatesCount)}},Wi=class{toastId;config;message;title;toastType;toastRef;_onTap=new nt;_onAction=new nt;constructor(t,e,i,r,o,a){this.toastId=t,this.config=e,this.message=i,this.title=r,this.toastType=o,this.toastRef=a,this.toastRef.afterClosed().subscribe(()=>{this._onAction.complete(),this._onTap.complete()})}triggerTap(){this._onTap.next(),this.config.tapToDismiss&&this._onTap.complete()}onTap(){return this._onTap.asObservable()}triggerAction(t){this._onAction.next(t)}onAction(){return this._onAction.asObservable()}},ac={maxOpened:0,autoDismiss:!1,newestOnTop:!0,preventDuplicates:!1,countDuplicates:!1,resetTimeoutOnDuplicate:!1,includeTitleDuplicates:!1,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},closeButton:!1,disableTimeOut:!1,timeOut:5e3,extendedTimeOut:1e3,enableHtml:!1,progressBar:!1,toastClass:"ngx-toastr",positionClass:"toast-top-right",titleClass:"toast-title",messageClass:"toast-message",easing:"ease-in",easeTime:300,tapToDismiss:!0,onActivateTick:!1,progressAnimation:"decreasing"},sc=new rt("ToastConfig"),ya=class extends Ea{_hostDomElement;_componentFactoryResolver;_appRef;constructor(t,e,i){super(),this._hostDomElement=t,this._componentFactoryResolver=e,this._appRef=i}attachComponentPortal(t,e){let i=this._componentFactoryResolver.resolveComponentFactory(t.component),r;return r=i.create(t.injector),this._appRef.attachView(r.hostView),this.setDisposeFn(()=>{this._appRef.detachView(r.hostView),r.destroy()}),e?this._hostDomElement.insertBefore(this._getComponentRootNode(r),this._hostDomElement.firstChild):this._hostDomElement.appendChild(this._getComponentRootNode(r)),r}_getComponentRootNode(t){return t.hostView.rootNodes[0]}},gf=(()=>{class n{_document=ee(Ii);_containerElement;ngOnDestroy(){this._containerElement&&this._containerElement.parentNode&&this._containerElement.parentNode.removeChild(this._containerElement)}getContainerElement(){return this._containerElement||this._createContainer(),this._containerElement}_createContainer(){let e=this._document.createElement("div");e.classList.add("overlay-container"),e.setAttribute("aria-live","polite"),this._document.body.appendChild(e),this._containerElement=e}static \u0275fac=function(i){return new(i||n)};static \u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),Ta=class{_portalHost;constructor(t){this._portalHost=t}attach(t,e=!0){return this._portalHost.attach(t,e)}detach(){return this._portalHost.detach()}},vf=(()=>{class n{_overlayContainer=ee(gf);_componentFactoryResolver=ee($a);_appRef=ee(Rn);_document=ee(Ii);_paneElements=new Map;create(e,i){return this._createOverlayRef(this.getPaneElement(e,i))}getPaneElement(e="",i){return this._paneElements.get(i)||this._paneElements.set(i,{}),this._paneElements.get(i)[e]||(this._paneElements.get(i)[e]=this._createPaneElement(e,i)),this._paneElements.get(i)[e]}_createPaneElement(e,i){let r=this._document.createElement("div");return r.id="toast-container",r.classList.add(e),r.classList.add("toast-container"),i?i.getContainerElement().appendChild(r):this._overlayContainer.getContainerElement().appendChild(r),r}_createPortalHost(e){return new ya(e,this._componentFactoryResolver,this._appRef)}_createOverlayRef(e){return new Ta(this._createPortalHost(e))}static \u0275fac=function(i){return new(i||n)};static \u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),Nr=(()=>{class n{overlay;_injector;sanitizer;ngZone;toastrConfig;currentlyActive=0;toasts=[];overlayContainer;previousToastMessage;index=0;constructor(e,i,r,o,a){this.overlay=i,this._injector=r,this.sanitizer=o,this.ngZone=a,this.toastrConfig=U(U({},e.default),e.config),e.config.iconClasses&&(this.toastrConfig.iconClasses=U(U({},e.default.iconClasses),e.config.iconClasses))}show(e,i,r={},o=""){return this._preBuildNotification(o,e,i,this.applyConfig(r))}success(e,i,r={}){let o=this.toastrConfig.iconClasses.success||"";return this._preBuildNotification(o,e,i,this.applyConfig(r))}error(e,i,r={}){let o=this.toastrConfig.iconClasses.error||"";return this._preBuildNotification(o,e,i,this.applyConfig(r))}info(e,i,r={}){let o=this.toastrConfig.iconClasses.info||"";return this._preBuildNotification(o,e,i,this.applyConfig(r))}warning(e,i,r={}){let o=this.toastrConfig.iconClasses.warning||"";return this._preBuildNotification(o,e,i,this.applyConfig(r))}clear(e){for(let i of this.toasts)if(e!==void 0){if(i.toastId===e){i.toastRef.manualClose();return}}else i.toastRef.manualClose()}remove(e){let i=this._findToast(e);if(!i||(i.activeToast.toastRef.close(),this.toasts.splice(i.index,1),this.currentlyActive=this.currentlyActive-1,!this.toastrConfig.maxOpened||!this.toasts.length))return!1;if(this.currentlyActive<this.toastrConfig.maxOpened&&this.toasts[this.currentlyActive]){let r=this.toasts[this.currentlyActive].toastRef;r.isInactive()||(this.currentlyActive=this.currentlyActive+1,r.activate())}return!0}findDuplicate(e="",i="",r,o){let{includeTitleDuplicates:a}=this.toastrConfig;for(let u of this.toasts){let d=a&&u.title===e;if((!a||d)&&u.message===i)return u.toastRef.onDuplicate(r,o),u}return null}applyConfig(e={}){return U(U({},this.toastrConfig),e)}_findToast(e){for(let i=0;i<this.toasts.length;i++)if(this.toasts[i].toastId===e)return{index:i,activeToast:this.toasts[i]};return null}_preBuildNotification(e,i,r,o){return o.onActivateTick?this.ngZone.run(()=>this._buildNotification(e,i,r,o)):this._buildNotification(e,i,r,o)}_buildNotification(e,i,r,o){if(!o.toastComponent)throw new Error("toastComponent required");let a=this.findDuplicate(r,i,this.toastrConfig.resetTimeoutOnDuplicate&&o.timeOut>0,this.toastrConfig.countDuplicates);if((this.toastrConfig.includeTitleDuplicates&&r||i)&&this.toastrConfig.preventDuplicates&&a!==null)return a;this.previousToastMessage=i;let u=!1;this.toastrConfig.maxOpened&&this.currentlyActive>=this.toastrConfig.maxOpened&&(u=!0,this.toastrConfig.autoDismiss&&this.clear(this.toasts[0].toastId));let d=this.overlay.create(o.positionClass,this.overlayContainer);this.index=this.index+1;let m=i;i&&o.enableHtml&&(m=this.sanitizer.sanitize(Ha.HTML,i));let I=new Sa(d),y=new Wi(this.index,o,m,r,e,I),S=[{provide:Wi,useValue:y}],k=Pt.create({providers:S,parent:this._injector}),g=new xa(o.toastComponent,k),A=d.attach(g,o.newestOnTop);I.componentInstance=A.instance;let $={toastId:this.index,title:r||"",message:i||"",toastRef:I,onShown:I.afterActivate(),onHidden:I.afterClosed(),onTap:y.onTap(),onAction:y.onAction(),portal:A};return u||(this.currentlyActive=this.currentlyActive+1,setTimeout(()=>{$.toastRef.activate()})),this.toasts.push($),$}static \u0275fac=function(i){return new(i||n)(Y(sc),Y(vf),Y(Pt),Y(Za),Y(Ue))};static \u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),_f=(()=>{class n{toastrService;toastPackage;ngZone;message;title;options;duplicatesCount;originalTimeout;width=Me(-1);toastClasses="";state;get _state(){return this.state()}get displayStyle(){if(this.state().value==="inactive")return"none"}timeout;intervalId;hideTime;sub;sub1;sub2;sub3;constructor(e,i,r){this.toastrService=e,this.toastPackage=i,this.ngZone=r,this.message=i.message,this.title=i.title,this.options=i.config,this.originalTimeout=i.config.timeOut,this.toastClasses=`${i.toastType} ${i.config.toastClass}`,this.sub=i.toastRef.afterActivate().subscribe(()=>{this.activateToast()}),this.sub1=i.toastRef.manualClosed().subscribe(()=>{this.remove()}),this.sub2=i.toastRef.timeoutReset().subscribe(()=>{this.resetTimeout()}),this.sub3=i.toastRef.countDuplicate().subscribe(o=>{this.duplicatesCount=o}),this.state=Me({value:"inactive",params:{easeTime:this.toastPackage.config.easeTime,easing:"ease-in"}})}ngOnDestroy(){this.sub.unsubscribe(),this.sub1.unsubscribe(),this.sub2.unsubscribe(),this.sub3.unsubscribe(),clearInterval(this.intervalId),clearTimeout(this.timeout)}activateToast(){this.state.update(e=>ie(U({},e),{value:"active"})),!(this.options.disableTimeOut===!0||this.options.disableTimeOut==="timeOut")&&this.options.timeOut&&(this.outsideTimeout(()=>this.remove(),this.options.timeOut),this.hideTime=new Date().getTime()+this.options.timeOut,this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10))}updateProgress(){if(this.width()===0||this.width()===100||!this.options.timeOut)return;let e=new Date().getTime(),i=this.hideTime-e;this.width.set(i/this.options.timeOut*100),this.options.progressAnimation==="increasing"&&this.width.update(r=>100-r),this.width()<=0&&this.width.set(0),this.width()>=100&&this.width.set(100)}resetTimeout(){clearTimeout(this.timeout),clearInterval(this.intervalId),this.state.update(e=>ie(U({},e),{value:"active"})),this.outsideTimeout(()=>this.remove(),this.originalTimeout),this.options.timeOut=this.originalTimeout,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width.set(-1),this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10)}remove(){this.state().value!=="removed"&&(clearTimeout(this.timeout),this.state.update(e=>ie(U({},e),{value:"removed"})),this.outsideTimeout(()=>this.toastrService.remove(this.toastPackage.toastId),+this.toastPackage.config.easeTime))}tapToast(){this.state().value!=="removed"&&(this.toastPackage.triggerTap(),this.options.tapToDismiss&&this.remove())}stickAround(){this.state().value!=="removed"&&this.options.disableTimeOut!=="extendedTimeOut"&&(clearTimeout(this.timeout),this.options.timeOut=0,this.hideTime=0,clearInterval(this.intervalId),this.width.set(0))}delayedHideToast(){this.options.disableTimeOut===!0||this.options.disableTimeOut==="extendedTimeOut"||this.options.extendedTimeOut===0||this.state().value==="removed"||(this.outsideTimeout(()=>this.remove(),this.options.extendedTimeOut),this.options.timeOut=this.options.extendedTimeOut,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width.set(-1),this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10))}outsideTimeout(e,i){this.ngZone?this.ngZone.runOutsideAngular(()=>this.timeout=setTimeout(()=>this.runInsideAngular(e),i)):this.timeout=setTimeout(()=>e(),i)}outsideInterval(e,i){this.ngZone?this.ngZone.runOutsideAngular(()=>this.intervalId=setInterval(()=>this.runInsideAngular(e),i)):this.intervalId=setInterval(()=>e(),i)}runInsideAngular(e){this.ngZone?this.ngZone.run(()=>e()):e()}static \u0275fac=function(i){return new(i||n)(O(Nr),O(Wi),O(Ue))};static \u0275cmp=ne({type:n,selectors:[["","toast-component",""]],hostVars:5,hostBindings:function(i,r){i&1&&M("click",function(){return r.tapToast()})("mouseenter",function(){return r.stickAround()})("mouseleave",function(){return r.delayedHideToast()}),i&2&&(Ga("@flyInOut",r._state),Ge(r.toastClasses),ye("display",r.displayStyle))},attrs:oc,decls:5,vars:5,consts:[["type","button","class","toast-close-button","aria-label","Close",3,"click",4,"ngIf"],[3,"class",4,"ngIf"],["role","alert",3,"class","innerHTML",4,"ngIf"],["role","alert",3,"class",4,"ngIf"],[4,"ngIf"],["type","button","aria-label","Close",1,"toast-close-button",3,"click"],["aria-hidden","true"],["role","alert",3,"innerHTML"],["role","alert"],[1,"toast-progress"]],template:function(i,r){i&1&&x(0,rf,3,0,"button",0)(1,af,3,5,"div",1)(2,sf,1,3,"div",2)(3,lf,2,4,"div",3)(4,cf,2,2,"div",4),i&2&&(h("ngIf",r.options.closeButton),l(),h("ngIf",r.title),l(),h("ngIf",r.message&&r.options.enableHtml),l(),h("ngIf",r.message&&!r.options.enableHtml),l(),h("ngIf",r.options.progressBar))},dependencies:[oe],encapsulation:2,data:{animation:[ba("flyInOut",[Tn("inactive",yn({opacity:0})),Tn("active",yn({opacity:1})),Tn("removed",yn({opacity:0})),Dr("inactive => active",Rr("{{ easeTime }}ms {{ easing }}")),Dr("active => removed",Rr("{{ easeTime }}ms {{ easing }}"))])]},changeDetection:0})}return n})(),Cf=ie(U({},ac),{toastComponent:_f}),If=(n={})=>Kt([{provide:sc,useValue:{default:Cf,config:n}}]),m1=(()=>{class n{static forRoot(e={}){return{ngModule:n,providers:[If(e)]}}static \u0275fac=function(i){return new(i||n)};static \u0275mod=_i({type:n});static \u0275inj=fi({})}return n})();var bf=(()=>{class n{toastrService;toastPackage;appRef;message;title;options;duplicatesCount;originalTimeout;width=Me(-1);toastClasses="";get displayStyle(){return this.state()==="inactive"?"none":null}state=Me("inactive");timeout;intervalId;hideTime;sub;sub1;sub2;sub3;constructor(e,i,r){this.toastrService=e,this.toastPackage=i,this.appRef=r,this.message=i.message,this.title=i.title,this.options=i.config,this.originalTimeout=i.config.timeOut,this.toastClasses=`${i.toastType} ${i.config.toastClass}`,this.sub=i.toastRef.afterActivate().subscribe(()=>{this.activateToast()}),this.sub1=i.toastRef.manualClosed().subscribe(()=>{this.remove()}),this.sub2=i.toastRef.timeoutReset().subscribe(()=>{this.resetTimeout()}),this.sub3=i.toastRef.countDuplicate().subscribe(o=>{this.duplicatesCount=o})}ngOnDestroy(){this.sub.unsubscribe(),this.sub1.unsubscribe(),this.sub2.unsubscribe(),this.sub3.unsubscribe(),clearInterval(this.intervalId),clearTimeout(this.timeout)}activateToast(){this.state.set("active"),!(this.options.disableTimeOut===!0||this.options.disableTimeOut==="timeOut")&&this.options.timeOut&&(this.timeout=setTimeout(()=>{this.remove()},this.options.timeOut),this.hideTime=new Date().getTime()+this.options.timeOut,this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10))),this.options.onActivateTick&&this.appRef.tick()}updateProgress(){if(this.width()===0||this.width()===100||!this.options.timeOut)return;let e=new Date().getTime(),i=this.hideTime-e;this.width.set(i/this.options.timeOut*100),this.options.progressAnimation==="increasing"&&this.width.update(r=>100-r),this.width()<=0&&this.width.set(0),this.width()>=100&&this.width.set(100)}resetTimeout(){clearTimeout(this.timeout),clearInterval(this.intervalId),this.state.set("active"),this.options.timeOut=this.originalTimeout,this.timeout=setTimeout(()=>this.remove(),this.originalTimeout),this.hideTime=new Date().getTime()+(this.originalTimeout||0),this.width.set(-1),this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10))}remove(){this.state()!=="removed"&&(clearTimeout(this.timeout),this.state.set("removed"),this.timeout=setTimeout(()=>this.toastrService.remove(this.toastPackage.toastId)))}tapToast(){this.state()!=="removed"&&(this.toastPackage.triggerTap(),this.options.tapToDismiss&&this.remove())}stickAround(){this.state()!=="removed"&&(clearTimeout(this.timeout),this.options.timeOut=0,this.hideTime=0,clearInterval(this.intervalId),this.width.set(0))}delayedHideToast(){this.options.disableTimeOut===!0||this.options.disableTimeOut==="extendedTimeOut"||this.options.extendedTimeOut===0||this.state()==="removed"||(this.timeout=setTimeout(()=>this.remove(),this.options.extendedTimeOut),this.options.timeOut=this.options.extendedTimeOut,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width.set(-1),this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10)))}static \u0275fac=function(i){return new(i||n)(O(Nr),O(Wi),O(Rn))};static \u0275cmp=ne({type:n,selectors:[["","toast-component",""]],hostVars:4,hostBindings:function(i,r){i&1&&M("click",function(){return r.tapToast()})("mouseenter",function(){return r.stickAround()})("mouseleave",function(){return r.delayedHideToast()}),i&2&&(Ge(r.toastClasses),ye("display",r.displayStyle))},attrs:oc,decls:5,vars:5,consts:[["type","button","class","toast-close-button","aria-label","Close",3,"click",4,"ngIf"],[3,"class",4,"ngIf"],["role","alert",3,"class","innerHTML",4,"ngIf"],["role","alert",3,"class",4,"ngIf"],[4,"ngIf"],["type","button","aria-label","Close",1,"toast-close-button",3,"click"],["aria-hidden","true"],["role","alert",3,"innerHTML"],["role","alert"],[1,"toast-progress"]],template:function(i,r){i&1&&x(0,df,3,0,"button",0)(1,pf,3,5,"div",1)(2,mf,1,3,"div",2)(3,hf,2,4,"div",3)(4,ff,2,2,"div",4),i&2&&(h("ngIf",r.options.closeButton),l(),h("ngIf",r.title),l(
17),h("ngIf",r.message&&r.options.enableHtml),l(),h("ngIf",r.message&&!r.options.enableHtml),l(),h("ngIf",r.options.progressBar))},dependencies:[oe],encapsulation:2,changeDetection:0})}return n})(),h1=ie(U({},ac),{toastComponent:bf});var Mr=class n{constructor(){this.storageKey="auth_return_url"}setReturnUrl(t){let e=this.normalizeUrl(t);e&&sessionStorage.setItem(this.storageKey,e)}consumeReturnUrl(t="/"){let e=sessionStorage.getItem(this.storageKey);return sessionStorage.removeItem(this.storageKey),this.normalizeUrl(e)||t}normalizeUrl(t){if(!t)return null;let e=t.trim();return e.startsWith("/")?e:null}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};var lc=n=>({"border-red-500":n});function Sf(n,t){if(n&1&&(s(0,"div")(1,"p",2),p(2),v(3,"translate"),s(4,"strong"),p(5),c(),p(6,"!"),c(),s(7,"p",3),p(8),v(9,"translate"),s(10,"strong"),p(11),c()()()),n&2){let e=C();l(2),P(_(3,4,"CREDENTIALS.OLA")),l(3),P(e.user.nmCliente),l(3),P(_(9,6,"CREDENTIALS.EMAIL")),l(3),P(e.user.dsEmail)}}function yf(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),P(_(2,1,"CREDENTIALS.OBRIGATORIO-EMAIL")))}function Tf(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),P(_(2,1,"CREDENTIALS.FORMATO-EMAIL")))}function Pf(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),P(_(2,1,"CREDENTIALS.CAMPO-NAO-ESPACO")))}function kf(n,t){if(n&1&&(s(0,"div",27),x(1,yf,3,3,"span",16)(2,Tf,3,3,"span",16)(3,Pf,3,3,"span",16),c()),n&2){let e,i,r,o=C(2);l(),h("ngIf",(e=o.loginForm.get("email"))==null||e.errors==null?null:e.errors.required),l(),h("ngIf",(i=o.loginForm.get("email"))==null||i.errors==null?null:i.errors.invalidEmailFormat),l(),h("ngIf",(r=o.loginForm.get("email"))==null||r.errors==null?null:r.errors.whitespace)}}function Af(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),P(_(2,1,"CREDENTIALS.SENHA-OBRIGATORIA")))}function Of(n,t){if(n&1&&(s(0,"div",27),x(1,Af,3,3,"span",16),c()),n&2){let e,i=C(2);l(),h("ngIf",(e=i.loginForm.get("password"))==null||e.errors==null?null:e.errors.required)}}function wf(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),P(_(2,1,"CREDENTIALS.ENTRAR")))}function Rf(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),P(_(2,1,"CREDENTIALS.ENTRANDO")))}function Df(n,t){if(n&1&&(s(0,"div",28),p(1),v(2,"translate"),c()),n&2){let e=C(2);l(),E(" ",_(2,1,e.errorMessage)," ")}}function Nf(n,t){if(n&1){let e=z();s(0,"button",29),M("click",function(){let r=R(e).$implicit;return D(r.action())}),T(1,"img",30),s(2,"span",31),p(3),v(4,"translate"),c()()}if(n&2){let e=t.$implicit,i=C(2);h("disabled",i.isLoading),l(),h("src",e.icon,Fe)("alt",e.name+" logo"),l(2),Te(" ",_(4,5,"CREDENTIALS.CONTINUAR-COM")," ",e.name," ")}}function Mf(n,t){if(n&1){let e=z();s(0,"form",4)(1,"div",5),T(2,"input",6),v(3,"translate"),x(4,kf,4,3,"div",7),s(5,"div",8),T(6,"input",9),v(7,"translate"),s(8,"i",10),M("click",function(){R(e);let r=C();return D(r.togglePasswordVisibility())}),c()(),x(9,Of,2,1,"div",7),s(10,"div",11)(11,"a",12),M("click",function(){R(e);let r=C();return D(r.forgotPassword())}),T(12,"i",13),p(13),v(14,"translate"),c()(),s(15,"div",14)(16,"button",15),M("click",function(){R(e);let r=C();return D(r.onLogin())}),x(17,wf,3,3,"span",16)(18,Rf,3,3,"span",16),c(),s(19,"button",17),M("click",function(){R(e);let r=C();return D(r.onCreateAccount())}),p(20),v(21,"translate"),c()(),x(22,Df,3,3,"div",18),s(23,"div",19),T(24,"div",20),s(25,"button",21),M("click",function(){R(e);let r=C();return D(r.toggleSocialLogins())}),p(26),v(27,"translate"),v(28,"translate"),T(29,"i"),c(),T(30,"div",20),c(),s(31,"div",22)(32,"div",23)(33,"p",24),p(34),v(35,"translate"),c(),s(36,"div",25),x(37,Nf,5,7,"button",26),c()()()()()}if(n&2){let e=C();h("formGroup",e.loginForm),l(2),h("placeholder",_(3,25,"CREDENTIALS.PLACEHOLDER-EMAIL"))("ngClass",Ji(39,lc,e.campoInvalido("email"))),l(2),h("ngIf",e.campoInvalido("email")),l(2),h("type",e.showPassword?"text":"password")("placeholder",_(7,27,"CREDENTIALS.PLACEHOLDER-SENHA"))("ngClass",Ji(41,lc,e.campoInvali
17do("password"))),l(2),Ge(e.showPassword?"bi bi-eye-slash":"bi bi-eye"),l(),h("ngIf",e.campoInvalido("password")),l(4),E(" ",_(14,29,"CREDENTIALS.ESQUECI-SENHA")," "),l(3),h("disabled",e.isLoading),l(),h("ngIf",!e.isLoading),l(),h("ngIf",e.isLoading),l(2),E(" ",_(21,31,"CREDENTIALS.CRIAR-CONTA")," "),l(2),h("ngIf",e.errorMessage),l(4),E(" ",e.showSocialLogins?_(27,33,"CREDENTIALS.OCULTAR-OPCOES"):_(28,35,"CREDENTIALS.MAIS-OPCOES")," "),l(3),Ge(e.showSocialLogins?"bi bi-chevron-up":"bi bi-chevron-down"),l(2),ye("max-height",e.showSocialLogins?"500px":"0px")("opacity",e.showSocialLogins?"1":"0"),l(3),E(" ",_(35,37,"CREDENTIALS.CONTINUAR-COM")," "),l(3),h("ngForOf",e.socialLoginOptions)}}var qi=class n{constructor(t,e,i,r,o,a,u,d){this.fb=t;this.authService=e;this.store=i;this.cdRef=r;this.router=o;this.toastr=a;this.zone=u;this.authRedirectService=d;this.user=null;this.createAccountRedirect=new vi;this.triggerValidation=!1;this.isLoading=!1;this.errorMessage=null;this.showPassword=!1;this.showForgotPassword=!1;this.showSocialLogins=!1;this.socialLoginOptions=[{name:"Google",icon:"../../../../assets/img/icones/icons8-google-logo.svg",action:()=>this.loginWithGoogle()},{name:"Facebook",icon:"../../../../assets/img/icones/icons8-facebook-novo.svg",action:()=>this.loginWithFacebook()},{name:"Apple",icon:"../../../../assets/img/icones/icons8-mac-os.svg",action:()=>this.loginWithApple()}]}ngOnInit(){this.loginForm=this.fb.group({email:["",[F.required,ms(),F.maxLength(150),ps()]],password:["",[F.required]]})}ngOnChanges(t){t.triggerValidation&&t.triggerValidation.currentValue===!0&&(console.log("CredentialsComponent: Recebido triggerValidation=true"),this.loginForm.markAllAsTouched(),this.cdRef.detectChanges())}campoInvalido(t){let e=this.loginForm.get(t);
17return e?.invalid&&(e?.dirty||e?.touched)}onLogin(){if(console.log("entrou"),this.loginForm.invalid){console.error("Formul\xE1rio INV\xC1LIDO. Login interrompido."),Object.keys(this.loginForm.controls).forEach(e=>{let i=this.loginForm.get(e);i?.invalid&&console.log(`Campo '${e}' tem os seguintes erros:`,i.errors)}),this.loginForm.markAllAsTouched();return}this.isLoading=!0,this.errorMessage=null;let t={dsEmail:this.loginForm.value.email,stSenha:this.loginForm.value.password};this.authService.login(t).pipe(Zi(()=>this.isLoading=!1)).subscribe({next:e=>{this.store.dispatch(on({user:e.cliente,token:e.token}))},error:e=>{console.error("Erro completo recebido no login:",e);let i="CREDENTIALS.ERRO_LOGIN_GENERICO";e.status===400&&e.error&&(typeof e.error=="object"&&e.error!==null&&(e.error.dsMensagem||e.error.Message)?i=e.error.dsMensagem||e.error.Message:typeof e.error=="string"&&(i=e.error)),this.errorMessage=i}})}onCreateAccount(){this.createAccountRedirect.emit(),this.authRedirectService.setReturnUrl(this.router.url),this.router.navigate(["/signin"])}togglePasswordVisibility(){this.showPassword=!this.showPassword}toggleForgotPassword(){this.showForgotPassword=!this.showForgotPassword}toggleSocialLogins(){this.showSocialLogins=!this.showSocialLogins}loginWithGoogle(){this.isLoading=!0,this.authService.loginWithGoogle().then(t=>{let e={dsEmail:t.user.email,nmCliente:t.user.displayName,nrGoogle:t.user.uid};this.authService.loginMidiaSocial(e).subscribe({next:i=>{let r=i.cliente,o=i.token;this.store.dispatch(on({user:r,token:o})),this.toastr.success("Login com Google realizado com sucesso!"),this.isLoading=!1},error:i=>{this.isLoading=!1,this.toastr.error("Erro ao comunicar com o servidor.","Ops!")}})}).catch(t=>{this.isLoading=!1,t.code!=="auth/popup-closed-by-user"&&this.toastr.error("Erro no login com Google.","Ops!")})}loginWithFacebook(){this.isLoading=!0,this.authService.loginWithFacebookPopup().then(t=>{this.zone.run(()=>{if(t&&t.user){let e=t.user.email;if(!e||e.trim()===""){this.toastr.error("A sua conta do Facebook n\xE3o forneceu um e-mail. O login foi cancelado.","E-mail Necess\xE1rio"),this.isLoading=!1,this.authService.logoutFirebase();return}let i={dsEmail:e,nmCliente:t.user.displayName,nrFacebook:t.user.uid};this.authService.loginMidiaSocial(i).subscribe({next:r=>{this.store.dispatch(on({user:r.cliente,token:r.token})),this.toastr.success("Login com Facebook realizado com sucesso!"),this.isLoading=!1},error:r=>{this.toastr.error("Erro ao comunicar com nosso servidor.","Ops!"),this.isLoading=!1}})}else this.isLoading=!1})}).catch(t=>{this.zone.run(()=>{t.code!=="auth/popup-closed-by-user"&&this.toastr.error("Ocorreu um erro durante o login com Facebook.","Ops!"),this.isLoading=!1})})}loginWithApple(){this.isLoading=!0,this.authService.loginWithApple().then(t=>{let e={dsEmail:t.user.email,nmCliente:t.user.displayName,nrApple:t.user.uid};this.authService.loginMidiaSocial(e).subscribe({next:i=>{this.isLoading=!1;let r=i.cliente,o=i.token;this.store.dispatch(on({user:r,token:o})),this.toastr.success("Login com Apple realizado com sucesso!")},error:i=>{this.isLoading=!1,this.toastr.error("Erro ao comunicar com o servidor.","Ops!")}})}).catch(t=>{this.zone.run(()=>{this.isLoading=!1,t.code!=="auth/popup-closed-by-user"&&this.toastr.error("A janela de login foi fechada ou ocorreu um erro.","Ops!")})})}forgotPassword(){let t=this.loginForm.get("email")?.value;if(!t){this.toastr.warning("Por favor, digite seu e-mail no campo acima.","E-mail necess\xE1rio"),this.loginForm.get("email")?.markAsTouched();return}this.isLoading=!0,this.authService.ResetPassword(t).subscribe({next:e=>{this.isLoading=!1,this.toastr.success("Link de recupera\xE7\xE3o enviado para seu e-mail!","Sucesso"),this.showForgotPassword=!1},error:e=>{this.isLoading=!1,this.toastr.error("Erro ao enviar e-mail de recupera\xE7\xE3o. Tente novamente.","Erro")}})}static{this.\u0275fac=function(e){return new(e||n)(O(ki),O(wr),O(Ie),O(Nn),O(ze),O(Nr),O(Ue),O(Mr))}}static{this.\u0275cmp=ne({type:n,selectors:[["app-credentials"]],inputs:{user:"user",triggerValidation:"triggerValidation"},outputs:{createAccountRedirect:"createAccountRedirect"},features:[gi],decls:3,vars:2,consts:[["naoLogado",""],[4,"ngIf","ngIfElse"],[1,"text-[--primary-black-color]","font-medium"],[1,"text-[--primary-black-color]"],[3,"formGroup"],[1,"flex","flex-col","gap-[10px]"],["type","email","formControlName","email",1,"text-[--primary-black-color]","max-h-[50px]","py-[11px]","px-[17px]","rounded-[24px]","border","outline-none",3,"placeholder","ngClass"],["class","text-red-500 text-sm mt-1 min-h-[20px]",4,"ngIf"],[1,"relative","w-full"],["formControlName","password",1,"text-[--primary-black-color]","max-h-[50px]","py-[11px]","px-[17px]","rounded-[24px]","border","outline-none","w-full","pr-10",3,"type","placeholder","ngClass"],[1,"absolute","right-4","top-1/2","transform","-translate-y-1/2","text-[--primary-black-color]","cursor-pointer","text-lg",3,"click"],[1,"flex","justify-end","-mt-1","mb-2"],["href","javascript:void(0)",1,"text-[--primary-btn-bg-color]","hover:text-[--primary-btn-bg-color]","hover:brightness-125","text-sm","font-semibold","transition-colors","duration-200","flex","items-center","gap-1",3,"click"],[1,"bi","bi-key-fill","text-xs"],[1,"flex","flex-col","sm:flex-row","gap-3","sm:gap-[20px]","w-full"],["type","button",1,"w-full","min-h-[50px]","py-[11px]","px-4","rounded-[24px]","border","text-center","border-[--primary-btn-bg-color]","text-[--primary-btn-bg-color]","hover:bg-[--primary-btn-bg-color]","hover:text-[--primary-btn-text-color]","hover:brightness-125","disabled:opacity-50","disabled:cursor-not-allowed","flex","items-center","justify-center","transition-colors","duration-300",3,"click","disabled"],[4,"ngIf"],["type","button",1,"w-full","min-h-[50px]","py-[11px]","px-4","rounded-[24px]","border","text-center","border-[--primary-btn-bg-color]","text-[--primary-btn-bg-color]","hover:bg-[--primary-btn-bg-color]","hover:text-[--primary-btn-text-color]","hover:brightness-125","flex","items-center","justify-center","transition-colors","duration-300",3,"click"],["class","text-red-500 text-sm font-bold text-center mb-2",4,"ngIf"],[1,"w-full","flex","items-center","gap-3","my-3"],[1,"flex-1","h-[1px]","bg-gray-300"],["type","button",1,"text-[--primary-black-color]","text-xs","font-semibold","hover:text-[--primary-btn-bg-color]","transition-colors","duration-200","flex","items-center","gap-1",3,"click"],[1,"overflow-hidden","transition-all","duration-500","ease-in-out"],[1,"flex","flex-col","gap-3","pb-2"],[1,"text-xs","text-center","text-gray-500","font-medium"],[1,"flex","flex-col","gap-2"],["type","button","class",`social-login-btn w-full h-[48px] bg-white border border-gray-300 rounded-[24px]
18                     flex items-center justify-center gap-3
19                     hover:bg-gray-50 hover:border-[--primary-btn-bg-color] hover:shadow-md
20                     disabled:opacity-50 disabled:cursor-not-allowed
21                     transition-all duration-300 transform hover:scale-[1.02]`,3,"disabled","click",4,"ngFor","ngForOf"],[1,"text-red-500","text-sm","mt-1","min-h-[20px]"],[1,"text-red-500","text-sm","font-bold","text-center","mb-2"],["type","button",1,"social-login-btn","w-full","h-[48px]","bg-white","border","border-gray-300","rounded-[24px]","flex","items-center","justify-center","gap-3","hover:bg-gray-50","hover:border-[--primary-btn-bg-color]","hover:shadow-md","disabled:opacity-50","disabled:cursor-not-allowed","transition-all","duration-300","transform","hover:scale-[1.02]",3,"click","disabled"],[1,"w-5","h-5",3,"src","alt"],[1,"text-[--primary-black-color]","font-semibold","text-sm"]],template:function(e,i){if(e&1&&x(0,Sf,12,8,"div",1)(1,Mf,38,43,"ng-template",null,0,ve),e&2){let r=Z(2);h("ngIf",i.user)("ngIfElse",r)}},dependencies:[Fn,lt,Ce,oe,jn,yi,Ot,wt,Si,Ti,Pi,Vn,Pe],encapsulation:2})}};var f=function(n){return n.SEPARATOR="separator",n.PERCENT="percent",n.IP="IP",n.CPF_CNPJ="CPF_CNPJ",n.MONTH="M",n.MONTHS="M0",n.MINUTE="m",n.HOUR="h",n.HOURS="H",n.MINUTES="m0",n.HOURS_HOUR="Hh",n.SECONDS="s0",n.HOURS_MINUTES_SECONDS="Hh:m0:s0",n.EMAIL_MASK="A*@A*.A*",n.HOURS_MINUTES="Hh:m0",n.MINUTES_SECONDS="m0:s0",n.DAYS_MONTHS_YEARS="d0/M0/0000",n.DAYS_MONTHS="d0/M0",n.DAYS="d0",n.DAY="d",n.SECOND="s",n.LETTER_S="S",n.DOT=".",n.COMMA=",",n.CURLY_BRACKETS_LEFT="{",n.CURLY_BRACKETS_RIGHT="}",n.MINUS="-",n.OR="||",n.HASH="#",n.EMPTY_STRING="",n.SYMBOL_STAR="*",n.SYMBOL_QUESTION="?",n.SLASH="/",n.WHITE_SPACE=" ",n.NUMBER_ZERO="0",n.NUMBER_NINE="9",n.BACKSPACE="Backspace",n.DELETE="Delete",n.ARROW_LEFT="ArrowLeft",n.ARROW_UP="ArrowUp",n.DOUBLE_ZERO="00",n}(f||{}),Fr=new rt("ngx-mask config"),cc=new rt("new ngx-mask config"),dc=new rt("initial ngx-mask config"),Lf={suffix:"",prefix:"",thousandSeparator:" ",decimalMarker:[".",","],clearIfNotMatch:!1,showMaskTyped:!1,instantPrefix:!1,placeHolderCharacter:"_",dropSpecialCharacters:!0,hiddenInput:!1,shownMaskExpression:"",separatorLimit:"",allowNegativeNumbers:!1,validation:!0,specialCharacters:["-","/","(",")",".",":"," ","+",",","@","[","]",'"',"'"],leadZeroDateTime:!1,apm:!1,leadZero:!1,keepCharacterPositions:!1,triggerOnMaskChange:!1,inputTransformFn:n=>n,outputTransformFn:n=>n,maskFilled:new vi,patterns:{0:{pattern:new RegExp("\\d")},9:{pattern:new RegExp("\\d"),optional:!0},X:{pattern:new RegExp("\\d"),symbol:"*"},A:{pattern:new RegExp("[a-zA-Z0-9]")},S:{pattern:new RegExp("[a-zA-Z]")},U:{pattern:new RegExp("[A-Z]")},L:{pattern:new RegExp("[a-z]")},d:{pattern:new RegExp("\\d")},m:{pattern:new RegExp("\\d")},M:{pattern:new RegExp("\\d")},H:{pattern:new RegExp("\\d")},h:{pattern:new RegExp("\\d")},s:{pattern:new RegExp("\\d")}}},Vf=[f.HOURS_MINUTES_SECONDS,f.HOURS_MINUTES,f.MINUTES_SECONDS],Uf=[f.PERCENT,f.HOURS_HOUR,f.SECONDS,f.MINUTES,f.SEPARATOR,f.DAYS_MONTHS_YEARS,f.DAYS_MONTHS,f.DAYS,f.MONTHS],Bf=(()=>{class n{_config=ee(Fr);dropSpecialCharacters=this._config.dropSpecialCharacters;hiddenInput=this._config.hiddenInput;clearIfNotMatch=this._config.clearIfNotMatch;specialCharacters=this._config.specialCharacters;patterns=this._config.patterns;prefix=this._config.prefix;suffix=this._config.suffix;thousandSeparator=this._config.thousandSeparator;decimalMarker=this._config.decimalMarker;customPattern;showMaskTyped=this._config.showMaskTyped;placeHolderCharacter=this._config.placeHolderCharacter;validation=this._config.validation;separatorLimit=this._config.separatorLimit;allowNegativeNumbers=this._config.allowNegativeNumbers;leadZeroDateTime=this._config.leadZeroDateTime;leadZero=this._config.leadZero;apm=this._config.apm;inputTransformFn=this._config.inputTransformFn;outputTransformFn=this._config.outputTransformFn;keepCharacterPositions=this._config.keepCharacterPositions;instantPrefix=this._config.instantPrefix;triggerOnMaskChange=this._config.triggerOnMaskChange;_shift=new Set;plusOnePosition=!1;maskExpression="";actualValue="";showKeepCharacterExp="";shownMaskExpression=this._config.shownMaskExpression;deletedSpecialCharacter=!1;ipError;cpfCnpjError;applyMask(e,i,r=0,o=!1,a=!1,u=()=>{}){if(!i||typeof e!="string")return f.EMPTY_STRING;let d=0,m="",I=!1,y=!1,S=1,k=!1,g=e,A=r,$=g.slice(0,this.prefix.length)===this.prefix,ue=o&&g.length===this.prefix.length+i.length,te=g===this.prefix+g.slice(this.prefix.length);$&&(ue||te)&&(g=g.slice(this.prefix.length)),this.suffix&&g.length>0&&(g=this.checkAndRemoveSuffix(g)),g==="("&&this.prefix&&(g="");let q=g.toString().split(f.EMPTY_STRING);if(this.allowNegativeNumbers&&g.slice(d,d+1)===f.MINUS&&(m+=g.slice(d,d+1)),i===f.IP){let B=g.split(f.DOT);
21this.ipError=this._validIP(B),i="099.099.099.099"}let me=[];for(let B=0;B<g.length;B++)g[B]?.match("\\d")&&me.push(g[B]??f.EMPTY_STRING);if(i===f.CPF_CNPJ&&(this.cpfCnpjError=me.length!==11&&me.length!==14,me.length>11?i="00.000.000/0000-00":i="000.000.000-00"),i.startsWith(f.PERCENT)){if(g.match("[a-z]|[A-Z]")||g.match(/[-!$%^&*()_+|~=`{}\[\]:";'<>?,\/.]/)&&!a){g=this._stripToDecimal(g);let w=this.getPrecision(i);g=this.checkInputPrecision(g,w,this.decimalMarker)}let B=typeof this.decimalMarker=="string"?this.decimalMarker:f.DOT;if(g.indexOf(B)>0&&!this.percentage(g.substring(0,g.indexOf(B)))){let w=g.substring(0,g.indexOf(B)-1);this.allowNegativeNumbers&&g.slice(d,d+1)===f.MINUS&&!a&&(w=g.substring(0,g.indexOf(B))),g=`${w}${g.substring(g.indexOf(B),g.length)}`}let N="";this.allowNegativeNumbers&&g.slice(d,d+1)===f.MINUS?N=`${f.MINUS}${g.slice(d+1,d+g.length)}`:N=g,this.percentage(N)?m=this._splitPercentZero(g):m=this._splitPercentZero(g.substring(0,g.length-1))}else if(i.startsWith(f.SEPARATOR)){(g.match("[w\u0430-\u044F\u0410-\u042F]")||g.match("[\u0401\u0451\u0410-\u044F]")||g.match("[a-z]|[A-Z]")||g.match(/[-@#!$%\\^&*()_£¬'+|~=`{}\]:";<>.?/]/)||g.match("[^A-Za-z0-9,]"))&&(g=this._stripToDecimal(g));let B=this.getPrecision(i),N=this.decimalMarker;if(Array.isArray(this.decimalMarker)&&(this.actualValue.includes(this.decimalMarker[0])||this.actualValue.includes(this.decimalMarker[1])?N=this.actualValue.includes(this.decimalMarker[0])?this.decimalMarker[0]:this.decimalMarker[1]:N=this.decimalMarker.find(W=>W!==this.thousandSeparator)),a){let{decimalMarkerIndex:W,nonZeroIndex:ae}=this._findFirstNonZeroAndDecimalIndex(g,N),Ke=g[0]===f.MINUS,di=g[0]===f.NUMBER_ZERO,Ye=g[0]===N,je=g[1]===N;(Ye&&!ae||Ke&&je&&!ae||di&&!W&&!ae)&&(g=f.NUMBER_ZERO),W&&ae&&Ke&&A===1&&(W<ae||W>ae)&&(g=f.MINUS+g.slice(ae)),!W&&ae&&g.length>ae&&(g=Ke?f.MINUS+g.slice(ae):g.slice(ae)),W&&ae&&A===0&&(W<ae&&(g=g.slice(W-1)),W>ae&&(g=g.slice(ae)))}B===0?g=this.allowNegativeNumbers?g.length>2&&g[0]===f.MINUS&&g[1]===f.NUMBER_ZERO&&g[2]!==this.thousandSeparator&&g[2]!==f.COMMA&&g[2]!==f.DOT?"-"+g.slice(2,g.length):g[0]===f.NUMBER_ZERO&&g.length>1&&g[1]!==this.thousandSeparator&&g[1]!==f.COMMA&&g[1]!==f.DOT?g.slice(1,g.length):g:g.length>1&&g[0]===f.NUMBER_ZERO&&g[1]!==this.thousandSeparator&&g[1]!==f.COMMA&&g[1]!==f.DOT?g.slice(1,g.length):g:(g[0]===N&&g.length>1&&!a&&(g=f.NUMBER_ZERO+g.slice(0,g.length+1),this.plusOnePosition=!0),g[0]===f.NUMBER_ZERO&&g[1]!==N&&g[1]!==this.thousandSeparator&&!a&&(g=g.length>1?g.slice(0,1)+N+g.slice(1,g.length+1):g,this.plusOnePosition=!0),this.allowNegativeNumbers&&!a&&g[0]===f.MINUS&&(g[1]===N||g[1]===f.NUMBER_ZERO)&&(g=g[1]===N&&g.length>2?g.slice(0,1)+f.NUMBER_ZERO+g.slice(1,g.length):g[1]===f.NUMBER_ZERO&&g.length>2&&g[2]!==N?g.slice(0,2)+N+g.slice(2,g.length):g,this.plusOnePosition=!0));let w=this._charToRegExpExpression(this.thousandSeparator),H='@#!$%^&*()_+|~=`{}\\[\\]:\\s,\\.";<>?\\/'.replace(w,"");if(Array.isArray(this.decimalMarker))for(let W of this.decimalMarker)H=H.replace(this._charToRegExpExpression(W),f.EMPTY_STRING);else H=H.replace(this._charToRegExpExpression(this.decimalMarker),"");let V=new RegExp("["+H+"]");g.match(V)&&(g=g.substring(0,g.length-1)),g=this.checkInputPrecision(g,B,this.decimalMarker);let Ve=g.replace(new RegExp(w,"g"),"");m=this._formatWithSeparators(Ve,this.thousandSeparator,this.decimalMarker,B);let mt=m.indexOf(f.COMMA)-g.indexOf(f.COMMA),Se=m.length-g.length,qe=a&&m.length<e.length-this.suffix.length&&this.separatorLimit;if((m[A-1]===this.thousandSeparator||m[A-this.prefix.length])&&this.prefix&&a)A=A-1;else if(Se>0&&m[A]!==this.thousandSeparator||qe){y=!0;let W=0;do this._shift.add(A+W),W++;while(W<Se)}else m[A-1]===this.thousandSeparator||Se===-4||Se===-3||m[A]===this.thousandSeparator?(this._shift.clear(),this._shift.add(A-1)):mt!==0&&A>0&&!(m.indexOf(f.COMMA)>=A&&A>3)||!(m.indexOf(f.DOT)>=A&&A>3)&&Se<=0?(this._shift.clear(),y=!0,S=Se,A+=Se,this._shift.add(A)):this._shift.clear()}else for(let B=0,N=q[0];B<q.length&&d!==i.length;B++,N=q[B]??f.EMPTY_STRING){let w=f.SYMBOL_STAR in this.patterns;if(this._checkSymbolMask(N,i[d]??f.EMPTY_STRING)&&i[d+1]===f.SYMBOL_QUESTION)m+=N,d+=2;else if(i[d+1]===f.SYMBOL_STAR&&I&&this._checkSymbolMask(N,i[d+2]??f.EMPTY_STRING))m+=N,d+=3,I=!1;else if(this._checkSymbolMask(N,i[d]??f.EMPTY_STRING)&&i[d+1]===f.SYMBOL_STAR&&!w)m+=N,I=!0;else if(i[d+1]===f.SYMBOL_QUESTION&&this._checkSymbolMask(N,i[d+2]??f.EMPTY_STRING))m+=N,d+=3;else if(this._checkSymbolMask(N,i[d]??f.EMPTY_STRING)){if(i[d]===f.HOURS&&(this.apm?Number(N)>9:Number(N)>2)){A=this.leadZeroDateTime?A:A+1,d+=1,this._shiftStep(d),B--,this.leadZeroDateTime&&(m+="0");continue}if(i[d]===f.HOUR&&(this.apm?m.length===1&&Number(m)>1||m==="1"&&Number(N)>2||g.slice(d-1,d).length===1&&Number(g.slice(d-1,d))>2||g.slice(d-1,d)==="1"&&Number(N)>2:m==="2"&&Number(N)>3||(m.slice(d-2,d)==="2"||m.slice(d-3,d)==="2"||m.slice(d-4,d)==="2"||m.slice(d-1,d)==="2")&&Number(N)>3&&d>10)){A=A+1,d+=1,B--;continue}if((i[d]===f.MINUTE||i[d]===f.SECOND)&&Number(N)>5){A=this.leadZeroDateTime?A:A+1,d+=1,this._shiftStep(d),B--,this.leadZeroDateTime&&(m+="0");continue}let H=31,V=g[d],Ve=g[d+1],mt=g[d+2],Se=g[d-1],qe=g[d-2],W=g.slice(d-3,d-1),ae=g.slice(d-1,d+1),Ke=g.slice(d,d+2),di=g.slice(d-2,d);if(i[d]===f.DAY){let Ye=i.slice(0,2)===f.MONTHS,je=i.slice(0,2)===f.MONTHS&&this.specialCharacters.includes(qe);if(Number(N)>3&&this.leadZeroDateTime||!Ye&&(Number(Ke)>H||Number(ae)>H||this.specialCharacters.includes(Ve))||(je?Number(ae)>H||!this.specialCharacters.includes(V)&&this.specialCharacters.includes(mt)||this.specialCharacters.includes(V):Number(Ke)>H||this.specialCharacters.includes(Ve)&&!a)){A=this.leadZeroDateTime?A:A+1,d+=1,this._shiftStep(d),B--,this.leadZeroDateTime&&(m+="0");continue}}if(i[d]===f.MONTH){let je=d===0&&(Number(N)>2||Number(Ke)>12||this.specialCharacters.includes(Ve)&&!a),Tt=i.slice(d+2,d+3),ui=W.includes(Tt)&&i.includes("d0")&&(this.specialCharacters.includes(qe)&&Number(ae)>12&&!this.specialCharacters.includes(V)||this.specialCharacters.includes(V)),ht=Number(W)<=H&&!this.specialCharacters.includes(W)&&this.specialCharacters.includes(Se)&&(Number(Ke)>12||this.specialCharacters.includes(Ve)),jr=Number(Ke)>12&&d===5||this.specialCharacters.includes(Ve)&&d===5,Pn=Number(W)>H&&!this.specialCharacters.includes(W)&&!this.specialCharacters.includes(di)&&Number(di)>12&&i.includes("d0"),se=Number(W)<=H&&!this.specialCharacters.includes(W)&&!this.specialCharacters.includes(Se)&&Number(ae)>12;if(Number(N)>1&&this.leadZeroDateTime||je||ui||se||Pn||ht||jr&&!this.leadZeroDateTime){A=this.leadZeroDateTime?A:A+1,d+=1,this._shiftStep(d),B--,this.leadZeroDateTime&&(m+="0");continue}}m+=N,d++}else this.specialCharacters.includes(N)&&i[d]===N?(m+=N,d++):this.specialCharacters.indexOf(i[d]??f.EMPTY_STRING)!==-1?(m+=i[d],d++,this._shiftStep(d),B--):i[d]===f.NUMBER_NINE&&this.showMaskTyped?this._shiftStep(d):this.patterns[i[d]??f.EMPTY_STRING]&&this.patterns[i[d]??f.EMPTY_STRING]?.optional?(q[d]&&i!=="099.099.099.099"&&i!=="000.000.000-00"&&i!=="00.000.000/0000-00"&&!i.match(/^9+\.0+$/)&&!this.patterns[i[d]??f.EMPTY_STRING]?.optional&&(m+=q[d]),i.includes(f.NUMBER_NINE+f.SYMBOL_STAR)&&i.includes(f.NUMBER_ZERO+f.SYMBOL_STAR)&&d++,d++,B--):this.maskExpression[d+1]===f.SYMBOL_STAR&&this._findSpecialChar(this.maskExpression[d+2]??f.EMPTY_STRING)&&this._findSpecialChar(N)===this.maskExpression[d+2]&&I||this.maskExpression[d+1]===f.SYMBOL_QUESTION&&this._findSpecialChar(this.maskExpression[d+2]??f.EMPTY_STRING)&&this._findSpecialChar(N)===this.maskExpression[d+2]&&I?(d+=3,m+=N):this.showMaskTyped&&this.specialCharacters.indexOf(N)<0&&N!==this.placeHolderCharacter&&this.placeHolderCharacter.length===1&&(k=!0)}m[A-1]&&m.length+1===i.length&&this.specialCharacters.indexOf(i[i.length-1]??f.EMPTY_STRING)!==-1&&(m+=i[i.length-1]);let Re=A+1;for(;this._shift.has(Re);)S++,Re++;let fe=o&&!i.startsWith(f.SEPARATOR)?d:this._shift.has(A)?S:0;k&&fe--,u(fe,y),S<0&&this._shift.clear();let $e=!1;a&&($e=q.every(B=>this.specialCharacters.includes(B)));let Ae=`${this.prefix}${$e?f.EMPTY_STRING:m}${this.showMaskTyped?"":this.suffix}`;m.length===0&&(Ae=this.instantPrefix?`${this.prefix}${m}`:`${m}`);let We=g.length===1&&this.specialCharacters.includes(i[0])&&g!==i[0];if(!this._checkSymbolMask(g,i[1])&&We)return"";if(m.includes(f.MINUS)&&this.prefix&&this.allowNegativeNumbers){if(a&&m===f.MINUS)return"";Ae=`${f.MINUS}${this.prefix}${m.split(f.MINUS).join(f.EMPTY_STRING)}${this.suffix}`}return Ae}_findDropSpecialChar(e){return Array.isArray(this.dropSpecialCharacters)?this.dropSpecialCharacters.find(i=>i===e):this._findSpecialChar(e)}_findSpecialChar(e){return this.specialCharacters.find(i=>i===e)}_checkSymbolMask(e,i){return this.patterns=this.customPattern?this.customPattern:this.patterns,(this.patterns[i]?.pattern&&this.patterns[i]?.pattern.test(e))??!1}_formatWithSeparators=(e,i,r,o)=>{let a=[],u="";if(Array.isArray(r)){let S=new RegExp(r.map(k=>"[\\^$.|?*+()".indexOf(k)>=0?`\\${k}`:k).join("|"));a=e.split(S),u=e.match(S)?.[0]??f.EMPTY_STRING}else a=e.split(r),u=r;let d=a.length>1?`${u}${a[1]}`:f.EMPTY_STRING,m=a[0]??f.EMPTY_STRING,I=this.separatorLimit.replace(/\s/g,f.EMPTY_STRING);I&&+I&&(m[0]===f.MINUS?m=`-${m.slice(1,m.length).slice(0,I.length)}`:m=m.slice(0,I.length));let y=/(\d+)(\d{3})/;for(;i&&y.test(m);)m=m.replace(y,"$1"+i+"$2");return typeof o>"u"?m+d:o===0?m:m+d.substring(0,o+1)};percentage=e=>{let i=e.replace(",","."),r=Number(this.allowNegativeNumbers&&e.includes(f.MINUS)?i.slice(1,e.length):i);return!isNaN(r)&&r>=0&&r<=100};getPrecision=e=>{let i=e.split(f.DOT);return i.length>1?Number(i[i.length-1]):1/0};checkAndRemoveSuffix=e=>{for(let i=this.suffix?.length-1;i>=0;i--){let r=this.suffix.substring(i,this.suffix?.length);if(e.includes(r)&&i!==this.suffix?.length-1&&(i-1<0||!e.includes(this.suffix.substring(i-1,this.suffix?.length))))return e.replace(r,f.EMPTY_STRING)}return e};checkInputPrecision=(e,i,r)=>{let o=e,a=r;if(i<1/0){if(Array.isArray(a)){let I=a.find(y=>y!==this.thousandSeparator);a=I||a[0]}let u=new RegExp(this._charToRegExpExpression(a)+`\\d{${i}}.*$`),d=o.match(u),m=(d&&d[0]?.length)??0;if(m-1>i){let I=m-1-i;o=o.substring(0,o.length-I)}i===0&&this._compareOrIncludes(o[o.length-1],a,this.thousandSeparator)&&(o=o.substring(0,o.length-1))}return o};_stripToDecimal(e){return e.split(f.EMPTY_STRING).filter((i,r)=>{let o=typeof this.decimalMarker=="string"?i===this.decimalMarker:this.decimalMarker.includes(i);return i.match("^-?\\d")||i===this.thousandSeparator||o||i===f.MINUS&&r===0&&this.allowNegativeNumbers}).join(f.EMPTY_STRING)}_charToRegExpExpression(e){return e&&(e===" "?"\\s":"[\\^$.|?*+()".indexOf(e)>=0?`\\${e}`:e)}_shiftStep(e){this._shift.add(e+this.prefix.length||0)}_compareOrIncludes(e,i,r){return Array.isArray(i)?i.filter(o=>o!==r).includes(e):e===i}_validIP(e){return!(e.length===4&&!e.some((i,r)=>e.length!==r+1?i===f.EMPTY_STRING||Number(i)>255:i===f.EMPTY_STRING||Number(i.substring(0,3))>
21255))}_splitPercentZero(e){if(e===f.MINUS&&this.allowNegativeNumbers)return e;let i=typeof this.decimalMarker=="string"?e.indexOf(this.decimalMarker):e.indexOf(f.DOT),r=this.allowNegativeNumbers&&e.includes(f.MINUS)?"-":"";if(i===-1){let o=parseInt(r?e.slice(1,e.length):e,10);return isNaN(o)?f.EMPTY_STRING:`${r}${o}`}else{let o=parseInt(e.replace("-","").substring(0,i),10),a=e.substring(i+1),u=isNaN(o)?"":o.toString(),d=typeof this.decimalMarker=="string"?this.decimalMarker:f.DOT;return u===f.EMPTY_STRING?f.EMPTY_STRING:`${r}${u}${d}${a}`}}_findFirstNonZeroAndDecimalIndex(e,i){let r=null,o=null;for(let a=0;a<e.length;a++){let u=e[a];if(u===i&&r===null&&(r=a),u&&u>="1"&&u<="9"&&o===null&&(o=a),r!==null&&o!==null)break}return{decimalMarkerIndex:r,nonZeroIndex:o}}static \u0275fac=function(i){return new(i||n)};static \u0275prov=G({token:n,factory:n.\u0275fac})}return n})(),Pa=(()=>{class n extends Bf{isNumberValue=!1;maskIsShown="";selStart=null;selEnd=null;maskChanged=!1;maskExpressionArray=[];previousValue="";currentValue="";writingValue=!1;isInitialized=!1;_emitValue=!1;_start;_end;onChange=e=>{};_elementRef=ee(Kr,{optional:!0});document=ee(Ii);_config=ee(Fr);_renderer=ee(ja,{optional:!0});applyMask(e,i,r=0,o=!1,a=!1,u=()=>{}){if(!i)return e!==this.actualValue?this.actualValue:e;if(this.maskIsShown=this.showMaskTyped?this.showMaskInInput():f.EMPTY_STRING,this.maskExpression===f.IP&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(e||f.HASH)),this.maskExpression===f.CPF_CNPJ&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(e||f.HASH)),!e&&this.showMaskTyped)return this.formControlResult(this.prefix),`${this.prefix}${this.maskIsShown}${this.suffix}`;let d=e&&typeof this.selStart=="number"?e[this.selStart]??f.EMPTY_STRING:f.EMPTY_STRING,m="",I=r;if((this.hiddenInput||e&&e.indexOf(f.SYMBOL_STAR)>=0)&&!this.writingValue){let g=e&&e.length===1?e.split(f.EMPTY_STRING):this.actualValue.split(f.EMPTY_STRING);a&&(g=g.slice(0,r).concat(g.slice(r+1))),this.showMaskTyped&&(e=this.removeMask(e),g=this.removeMask(g.join("")).split(f.EMPTY_STRING)),typeof this.selStart=="object"&&typeof this.selEnd=="object"?(this.selStart=Number(this.selStart),this.selEnd=Number(this.selEnd)):e!==f.EMPTY_STRING&&g.length?typeof this.selStart=="number"&&typeof this.selEnd=="number"&&(e.length>g.length?g.splice(this.selStart,0,d):e.length<g.length&&(g.length-e.length===1?a?g.splice(this.selStart-1,1):g.splice(e.length-1,1):g.splice(this.selStart,this.selEnd-this.selStart))):g=[],this.showMaskTyped&&!this.hiddenInput&&(m=this.removeMask(e)),this.actualValue.length?g.length<e.length?m=this.shiftTypedSymbols(g.join(f.EMPTY_STRING)):g.length===e.length?m=g.join(f.EMPTY_STRING):m=e:m=e}if(o&&(this.hiddenInput||!this.hiddenInput)&&(m=e),a&&this.specialCharacters.indexOf(this.maskExpression[I]??f.EMPTY_STRING)!==-1&&this.showMaskTyped&&!this.prefix&&(m=this.currentValue),this.deletedSpecialCharacter&&I&&(this.specialCharacters.includes(this.actualValue.slice(I,I+1))?I=I+1:i.slice(I-1,I+1)!==f.MONTHS&&(I=I-2),this.deletedSpecialCharacter=!1),this.showMaskTyped&&this.placeHolderCharacter.length===1&&!this.leadZeroDateTime&&(m=this.removeMask(m)),this.maskChanged?m=e:m=m&&m.length?m:e,this.showMaskTyped&&this.keepCharacterPositions&&this.actualValue&&!o&&!this.writingValue){let g=this.dropSpecialCharacters?this.removeMask(this.actualValue):this.actualValue;return this.formControlResult(g),this.actualValue?this.actualValue:`${this.prefix}${this.maskIsShown}${this.suffix}`}let y=super.applyMask(m,i,I,o,a,u);if(this.actualValue=this.getActualValue(y),this.thousandSeparator===f.DOT&&this.decimalMarker===f.DOT&&(this.decimalMarker=f.COMMA),this.maskExpression.startsWith(f.SEPARATOR)&&this.dropSpecialCharacters===!0&&(this.specialCharacters=this.specialCharacters.filter(g=>!this._compareOrIncludes(g,this.decimalMarker,this.thousandSeparator))),(y||y==="")&&(this.previousValue=this.currentValue,this.currentValue=y,this._emitValue=this.previousValue!==this.currentValue||this.previousValue===this.currentValue&&o),this._emitValue&&this.formControlResult(y),!this.showMaskTyped||this.showMaskTyped&&this.hiddenInput)return this.hiddenInput?`${this.hideInput(y,this.maskExpression)}${this.maskIsShown.slice(y.length)}`:y;let S=y.length,k=`${this.prefix}${this.maskIsShown}${this.suffix}`;
21if(this.maskExpression.includes(f.HOURS)){let g=this._numberSkipedSymbols(y);return`${y}${k.slice(S+g)}`}else if(this.maskExpression===f.IP||this.maskExpression===f.CPF_CNPJ)return`${y}${k}`;return`${y}${k.slice(S)}`}_numberSkipedSymbols(e){let i=/(^|\D)(\d\D)/g,r=i.exec(e),o=0;for(;r!=null;)o+=1,r=i.exec(e);return o}applyValueChanges(e,i,r,o=()=>{}){let a=this._elementRef?.nativeElement;a&&(a.value=this.applyMask(a.value,this.maskExpression,e,i,r,o),a!==this._getActiveElement()&&this.clearIfNotMatchFn())}hideInput(e,i){return e.split(f.EMPTY_STRING).map((r,o)=>this.patterns&&this.patterns[i[o]??f.EMPTY_STRING]&&this.patterns[i[o]??f.EMPTY_STRING]?.symbol?this.patterns[i[o]??f.EMPTY_STRING]?.symbol:r).join(f.EMPTY_STRING)}getActualValue(e){let i=e.split(f.EMPTY_STRING).filter((r,o)=>{let a=this.maskExpression[o]??f.EMPTY_STRING;return this._checkSymbolMask(r,a)||this.specialCharacters.includes(a)&&r===a});return i.join(f.EMPTY_STRING)===e?i.join(f.EMPTY_STRING):e}shiftTypedSymbols(e){let i="";return(e&&e.split(f.EMPTY_STRING).map((o,a)=>{if(this.specialCharacters.includes(e[a+1]??f.EMPTY_STRING)&&e[a+1]!==this.maskExpression[a+1])return i=o,e[a+1];if(i.length){let u=i;return i=f.EMPTY_STRING,u}return o})||[]).join(f.EMPTY_STRING)}numberToString(e){return!e&&e!==0||this.maskExpression.startsWith(f.SEPARATOR)&&(this.leadZero||!this.dropSpecialCharacters)||this.maskExpression.startsWith(f.SEPARATOR)&&this.separatorLimit.length>14&&String(e).length>14?String(e):Number(e).toLocaleString("fullwide",{useGrouping:!1,maximumFractionDigits:20}).replace(`/${f.MINUS}/`,f.MINUS)}showMaskInInput(e){if(this.showMaskTyped&&this.shownMaskExpression){if(this.maskExpression.length!==this.shownMaskExpression.length)throw new Error("Mask expression must match mask placeholder length");return this.shownMaskExpression}else if(this.showMaskTyped){if(e){if(this.maskExpression===f.IP)return this._checkForIp(e);if(this.maskExpression===f.CPF_CNPJ)return this._checkForCpfCnpj(e)}return this.placeHolderCharacter.length===this.maskExpression.length?this.placeHolderCharacter:this.maskExpression.replace(/\w/g,this.placeHolderCharacter)}return""}clearIfNotMatchFn(){let e=this._elementRef?.nativeElement;e&&this.clearIfNotMatch&&this.prefix.length+this.maskExpression.length+this.suffix.length!==e.value.replace(this.placeHolderCharacter,f.EMPTY_STRING).length&&(this.formElementProperty=["value",f.EMPTY_STRING],this.applyMask("",this.maskExpression))}set formElementProperty([e,i]){!this._renderer||!this._elementRef||Promise.resolve().then(()=>this._renderer?.setProperty(this._elementRef?.nativeElement,e,i))}checkDropSpecialCharAmount(e){return e.split(f.EMPTY_STRING).filter(r=>this._findDropSpecialChar(r)).length}removeMask(e){return this._removeMask(this._removeSuffix(this._removePrefix(e)),this.specialCharacters.concat("_").concat(this.placeHolderCharacter))}_checkForIp(e){if(e===f.HASH)return`${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`;let i=[];for(let r=0;r<e.length;r++){let o=e[r]??f.EMPTY_STRING;o&&o.match("\\d")&&i.push(o)}return i.length<=3?`${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`:i.length>3&&i.length<=6?`${this.placeHolderCharacter}.${this.placeHolderCharacter}`:i.length>6&&i.length<=9?this.placeHolderCharacter:(i.length>9&&i.length<=12,"")}_checkForCpfCnpj(e){let i=`${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}-${this.placeHolderCharacter}${this.placeHolderCharacter}`,r=`${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}/${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}-${this.placeHolderCharacter}${this.placeHolderCharacter}`;if(e===f.HASH)return i;let o=[];for(let a=0;a<e.length;a++){let u=e[a]??f.EMPTY_STRING;u&&u.match("\\d")&&o.push(u)}return o.length<=3?i.slice(o.length,i.length):o.length>3&&o.length<=6?i.slice(o.length+1,i.length):o.length>6&&o.length<=9?i.slice(o.length+2,i.length):o.length>9&&o.length<11?i.slice(o.length+3,i.length):o.length===11?"":o.length===12?e.length===17?r.slice(16,r.length):r.slice(15,r.length):o.length>12&&o.length<=14?r.slice(o.length+4,r.length):""}_getActiveElement(e=this.document){let i=e?.activeElement?.shadowRoot;return i?.activeElement?this._getActiveElement(i):e.activeElement}formControlResult(e){let i=this.outputTransformFn?this.outputTransformFn:r=>r;this.writingValue=!1,this.maskChanged=!1,!(!this.isInitialized&&this._emitValue)&&(Array.isArray(this.dropSpecialCharacters)?this.onChange(i(this._toNumber(this._checkSymbol
21s(this._removeMask(this._removeSuffix(this._removePrefix(e)),this.dropSpecialCharacters))))):this.dropSpecialCharacters||!this.dropSpecialCharacters&&this.prefix===e?this.onChange(i(this._toNumber(this._checkSymbols(this._removeSuffix(this._removePrefix(e)))))):this.onChange(i(this._toNumber(e))))}_toNumber(e){if(!this.isNumberValue||e===f.EMPTY_STRING||this.maskExpression.startsWith(f.SEPARATOR)&&(this.leadZero||!this.dropSpecialCharacters))return e;if(String(e).length>14&&this.maskExpression.startsWith(f.SEPARATOR))return String(e);let i=Number(e);if(this.maskExpression.startsWith(f.SEPARATOR)&&Number.isNaN(i)){let r=String(e).replace(",",".");return Number(r)}return Number.isNaN(i)?e:i}_removeMask(e,i){return this.maskExpression.startsWith(f.PERCENT)&&e.includes(f.DOT)?e:e&&e.replace(this._regExpForRemove(i),f.EMPTY_STRING)}_removePrefix(e){return this.prefix?e&&e.replace(this.prefix,f.EMPTY_STRING):e}_removeSuffix(e){return this.suffix?e&&e.replace(this.suffix,f.EMPTY_STRING):e}_retrieveSeparatorValue(e){let i=Array.isArray(this.dropSpecialCharacters)?this.specialCharacters.filter(r=>this.dropSpecialCharacters.includes(r)):this.specialCharacters;return!this.deletedSpecialCharacter&&this._checkPatternForSpace()&&e.includes(f.WHITE_SPACE)&&this.maskExpression.includes(f.SYMBOL_STAR)&&(i=i.filter(r=>r!==f.WHITE_SPACE)),this._removeMask(e,i)}_regExpForRemove(e){return new RegExp(e.map(i=>`\\${i}`).join("|"),"gi")}_replaceDecimalMarkerToDot(e){let i=Array.isArray(this.decimalMarker)?this.decimalMarker:[this.decimalMarker];return e.replace(this._regExpForRemove(i),f.DOT)}_checkSymbols(e){let i=e;if(i===f.EMPTY_STRING)return i;this.maskExpression.startsWith(f.PERCENT)&&this.decimalMarker===f.COMMA&&(i=i.replace(f.COMMA,f.DOT));let r=this._retrieveSeparatorPrecision(this.maskExpression),o=this.specialCharacters.length===0?this._retrieveSeparatorValue(i):this._replaceDecimalMarkerToDot(this._retrieveSeparatorValue(i));return this.isNumberValue&&r?i===this.decimalMarker?null:o.length>14?String(o):this._checkPrecision(this.maskExpression,o):o}_checkPatternForSpace(){for(let e in this.patterns)if(this.patterns[e]&&this.patterns[e]?.hasOwnProperty("pattern")){let i=this.patterns[e]?.pattern.toString(),r=this.patterns[e]?.pattern;if(i?.includes(f.WHITE_SPACE)&&r?.test(this.maskExpression))return!0}return!1}_retrieveSeparatorPrecision(e){let i=e.match(new RegExp("^separator\\.([^d]*)"));return i?Number(i[1]):null}_checkPrecision(e,i){let r=this.getPrecision(e),o=i;return e.indexOf("2")>0||this.leadZero&&Number(r)>0&&Number.isFinite(r)?(this.decimalMarker===f.COMMA&&this.leadZero&&(o=o.replace(",",".")),this.leadZero?Number(o).toFixed(Number(r)):Number(o).toFixed(2)):this.numberToString(o)}_repeatPatternSymbols(e){return e.match(/{[0-9]+}/)&&e.split(f.EMPTY_STRING).reduce((i,r,o)=>{if(this._start=r===f.CURLY_BRACKETS_LEFT?o:this._start,r!==f.CURLY_BRACKETS_RIGHT)return this._findSpecialChar(r)?i+r:i;this._end=o;let a=Number(e.slice(this._start+1,this._end)),u=new Array(a+1).join(e[this._start-1]);if(e.slice(0,this._start).length>1&&e.includes(f.LETTER_S)){let d=e.slice(0,this._start-1);return d.includes(f.CURLY_BRACKETS_LEFT)?i+u:d+i+u}else return i+u},"")||e}currentLocaleDecimalMarker(){return 1.1.toLocaleString().substring(1,2)}static \u0275fac=(()=>{let e;return function(r){return(e||(e=La(n)))(r||n)}})();static \u0275prov=G({token:n,factory:n.\u0275fac})}return n})();function Hf(){let n=ee(dc),t=ee(cc);return t instanceof Function?U(U({},n),t()):U(U({},n),t)}function uc(n){return[{provide:cc,useValue:n},{provide:dc,useValue:Lf},{provide:Fr,useFactory:Hf},Pa]}var pc=(()=>{class n{mask=Q("");specialCharacters=Q([]);patterns=Q({});prefix=Q("");suffix=Q("");thousandSeparator=Q(" ");decimalMarker=Q(".");dropSpecialCharacters=Q(null);hiddenInput=Q(null);showMaskTyped=Q(null);placeHolderCharacter=Q(null);shownMaskExpression=Q(null);clearIfNotMatch=Q(null);validation=Q(null);separatorLimit=Q("");allowNegativeNumbers=Q(null);leadZeroDateTime=Q(null);leadZero=Q(null);triggerOnMaskChange=Q(null);apm=Q(null);inputTransformFn=Q(null);outputTransformFn=Q(null);keepCharacterPositions=Q(null);instantPrefix=Q(null);maskFilled=Ua();_maskValue=Me("");_inputValue=Me("");_position=Me(null);_code=Me("");_maskExpressionArray=Me([]);_justPasted=Me(!1);_isFocused=Me(!1);_isComposing=Me(!1);_maskService=ee(Pa,{self:!0});document=ee(Ii);_config=ee(Fr);onChange=e=>{};onTouch=()=>{};ngOnChanges(e){let{mask:i,specialCharacters:r,patterns:o,prefix:a,suffix:u,thousandSeparator:d,decimalMarker:m,dropSpecialCharacters:I,hiddenInput:y,showMaskTyped:S,placeHolderCharacter:k,shownMaskExpression:g,clearIfNotMatch:A,validation:$,separatorLimit:ue,allowNegativeNumbers:te,leadZeroDateTime:q,leadZero:me,triggerOnMaskChange:Re,apm:fe,inputTransformFn:$e,outputTransformFn:Ae,keepCharacterPositions:We,instantPrefix:B}=e;if(i&&(i.currentValue!==i.previousValue&&!i.firstChange&&(this._maskService.maskChanged=!0),i.currentValue&&i.currentValue.split(f.OR).length>1?(this._maskExpressionArray.set(i.currentValue.split(f.OR).sort((N,w)=>N.length-w.length)),this._setMask()):(this._maskExpressionArray.set([]),this._maskValue.set(i.currentValue||f.EMPTY_STRING),this._maskService.maskExpression=this._maskValue())),r){if(!r.currentValue||!Array.isArray(r.currentValue))return;this._maskService.specialCharacters=r.currentValue||[]}if(te&&(this._maskService.allowNegativeNumbers=te.currentValue,this._maskService.allowNegativeNumbers&&(this._maskService.specialCharacters=this._maskService.specialCharacters.filter(N=>N!==f.MINUS))),o&&o.currentValue&&(this._maskService.patterns=o.currentValue),fe&&fe.currentValue&&(this._maskService.apm=fe.currentValue),B&&(this._maskService.instantPrefix=B.currentValue),a&&(this._maskService.prefix=a.currentValue),u&&(this._maskService.suffix=u.currentValue),d&&(this._maskService.thousandSeparator=d.currentValue,d.previousValue&&d.currentValue)){let N=this._maskService.decimalMarker;d.currentValue===this._maskService.decimalMarker&&(this._maskService.decimalMarker=d.currentValue===f.COMMA?f.DOT:f.COMMA),this._maskService.dropSpecialCharacters===!0&&(this._maskService.specialCharacters=this._config.specialCharacters),typeof N=="string"&&typeof this._maskService.decimalMarker=="string"&&(this._inputValue.set(this._inputValue().split(d.previousValue).join("").replace(N,this._maskService.decimalMarker)),this._maskService.actualValue=this._inputValue()),this._maskService.writingValue=!0}m&&(this._maskService.decimalMarker=m.currentValue),I&&(this._maskService.dropSpecialCharacters=I.currentValue),y&&(this._maskService.hiddenInput=y.currentValue,y.previousValue===!0&&y.currentValue===!1&&this._inputValue.set(this._maskService.actualValue)),S&&(this._maskService.showMaskTyped=S.currentValue,S.previousValue===!1&&S.currentValue===!0&&this._isFocused()&&requestAnimationFrame(()=>
21{this._maskService._elementRef?.nativeElement.click()})),k&&(this._maskService.placeHolderCharacter=k.currentValue),g&&(this._maskService.shownMaskExpression=g.currentValue),A&&(this._maskService.clearIfNotMatch=A.currentValue),$&&(this._maskService.validation=$.currentValue),ue&&(this._maskService.separatorLimit=ue.currentValue),q&&(this._maskService.leadZeroDateTime=q.currentValue),me&&(this._maskService.leadZero=me.currentValue),Re&&(this._maskService.triggerOnMaskChange=Re.currentValue),$e&&(this._maskService.inputTransformFn=$e.currentValue),Ae&&(this._maskService.outputTransformFn=Ae.currentValue),We&&(this._maskService.keepCharacterPositions=We.currentValue),this._applyMask()}validate({value:e}){let i=typeof e=="number"?String(e):e,r=this._maskValue();if(!this._maskService.validation||!r)return null;if(this._maskService.ipError)return this._createValidationError(i);if(this._maskService.cpfCnpjError)return this._createValidationError(i);if(r.startsWith(f.SEPARATOR)||Uf.includes(r)||this._maskService.clearIfNotMatch)return null;if(Vf.includes(r))return this._validateTime(i);if(r===f.EMAIL_MASK)return!/^[^@]+@[^@]+\.[^@]+$/.test(i)&&i?this._createValidationError(i):null;if(i&&i.length>=1){let o=0;if(r.includes(f.CURLY_BRACKETS_LEFT)&&r.includes(f.CURLY_BRACKETS_RIGHT))return r.slice(r.indexOf(f.CURLY_BRACKETS_LEFT)+1,r.indexOf(f.CURLY_BRACKETS_RIGHT))===String(i.length)?null:this._createValidationError(i);if(r.startsWith(f.PERCENT))return null;for(let a in this._maskService.patterns)if(this._maskService.patterns[a]?.optional){if(r.indexOf(a)!==r.lastIndexOf(a)){let u=r.split(f.EMPTY_STRING).filter(d=>d===a).join(f.EMPTY_STRING);o+=u.length}else r.indexOf(a)!==-1&&o++;if(r.indexOf(a)!==-1&&i.length>=r.indexOf(a)||o===r.length)return null}if(r.indexOf(f.SYMBOL_STAR)>1&&i.length<r.indexOf(f.SYMBOL_STAR)||r.indexOf(f.SYMBOL_QUESTION)>1&&i.length<r.indexOf(f.SYMBOL_QUESTION))return this._createValidationError(i);if(r.indexOf(f.SYMBOL_STAR)===-1||r.indexOf(f.SYMBOL_QUESTION)===-1){let a=r.split("*"),u=this._maskService.dropSpecialCharacters?r.length-this._maskService.checkDropSpecialCharAmount(r)-o:this.prefix()?r.length+this.prefix().length-o:r.length-o;if(a.length===1&&i.length<u)return this._createValidationError(i);if(a.length>1){let d=a[a.length-1];if(d&&this._maskService.specialCharacters.includes(d[0])&&String(i).includes(d[0]??"")&&!this.dropSpecialCharacters()){let m=e.split(d[0]);return m[m.length-1].length===d.length-1?null:this._createValidationError(i)}else return(d&&!this._maskService.specialCharacters.includes(d[0])||!d||this._maskService.dropSpecialCharacters)&&i.length>=u-1?null:this._createValidationError(i)}}if(r.indexOf(f.SYMBOL_STAR)===1||r.indexOf(f.SYMBOL_QUESTION)===1)return null}return e&&this.maskFilled.emit(),null}onPaste(){this._justPasted.set(!0)}onFocus(){this._isFocused.set(!0)}onModelChange(e){(e===f.EMPTY_STRING||e===null||typeof e>"u")&&this._maskService.actualValue&&(this._maskService.actualValue=this._maskService.getActualValue(f.EMPTY_STRING))}onInput(e){if(this._maskService.isInitialized=!0,this._isComposing())return;let i=e.target,r=this._maskService.inputTransformFn?this._maskService.inputTransformFn(i.value):i.value;if(i.type!=="number")if(typeof r=="string"||typeof r=="number"){if(i.value=r.toString(),this._inputValue.set(i.value),this._setMask(),!this._maskValue()){this.onChange(i.value);return}let o=i.selectionStart===1?i.selectionStart+this._maskService.prefix.length:i.selectionStart;if(this.showMaskTyped()&&this.keepCharacterPositions()&&this._maskService.placeHolderCharacter.length===1){let m=this.suffix(),I=this.prefix(),y=i.value.slice(o-1,o),S=I.length,k=this._maskService._checkSymbolMask(y,this._maskService.maskExpression[o-1-S]??f.EMPTY_STRING),g=this._maskService._checkSymbolMask(y,this._maskService.maskExpression[o+1-S]??f.EMPTY_STRING),A=this._maskService.selStart===this._maskService.selEnd,$=Number(this._maskService.selStart)-S,ue=Number(this._maskService.selEnd)-S,te=this._code()===f.BACKSPACE||this._code()===f.DELETE;if(te){if(!A)this._maskService.selStart===S?this._maskService.actualValue=`${I}${this._maskService.maskIsShown.slice(0,ue)}${this._inputValue().split(I).join("")}`:this._maskService.selStart===this._maskService.maskIsShown.length+S?this._maskService.actualValue=`${this._inputValue()}${this._maskService.maskIsShown.slice($,ue)}`:this._maskService.actualValue=`${I}${this._inputValue().split(I).join("").slice(0,$)}${this._maskService.maskIsShown.slice($,ue)}${this._maskService.actualValue.slice(ue+S,this._maskService.maskIsShown.length+S)}${m}`;else if(!this._maskService.specialCharacters.includes(this._maskService.maskExpression.slice(o-S,o+1-S))&&A)if($===1&&I)this._maskService.actualValue=`${I}${this._maskService.placeHolderCharacter}${i.value.split(I).join("").split(m).join("")}${m}`,o=o-1;else{let q=i.value.substring(0,o),me=i.value.substring(o);this._maskService.actualValue=`${q}${this._maskService.placeHolderCharacter}${me}`}o=this._code()===f.DELETE?o+1:o}te||(!k&&!g&&A?o=Number(i.selectionStart)-1:this._maskService.specialCharacters.includes(i.value.slice(o,o+1))&&g&&!this._maskService.specialCharacters.includes(i.value.slice(o+1,o+2))?(this._maskService.actualValue=`${i.value.slice(0,o-1)}${i.value.slice(o,o+1)}${y}${i.value.slice(o+2)}`,o=o+1):k?i.value.length===1&&o===1?this._maskService.actualValue=`${I}${y}${this._maskService.maskIsShown.slice(1,this._maskService.maskIsShown.length)}${m}`:this._maskService.actualValue=`${i.value.slice(0,o-1)}${y}${i.value.slice(o+1).split(m).join("")}${m}`:I&&i.value.length===1&&o-S===1&&this._maskService._checkSymbolMask(i.value,this._maskService.maskExpression[o-1-S]??f.EMPTY_STRING)&&(this._maskService.actualValue=`${I}${i.value}${this._maskService.maskIsShown.slice(1,this._maskService.maskIsShown.length)}${m}`))}let a=0,u=!1;if(this._code()===f.DELETE&&f.SEPARATOR&&(this._maskService.deletedSpecialCharacter=!0),this._inputValue().length>=this._maskService.maskExpression.length-1&&this._code()!==f.BACKSPACE&&this._maskService.maskExpression===f.DAYS_MONTHS_YEARS&&o<10){let m=this._inputValue().slice(o-1,o);i.value=this._inputValue().slice(0,o-1)+m+this._inputValue().slice(o+1)}if(this._maskService.maskExpression===f.DAYS_MONTHS_YEARS&&this.leadZeroDateTime()&&(o<3&&Number(i.value)>31&&Number(i.value)<40||o===5&&Number(i.value.slice(3,5))>12)&&(o=o+2),this._maskService.maskExpression===f.HOURS_MINUTES_SECONDS&&this.apm()&&(this._justPasted()&&i.value.slice(0,2)===f.DOUBLE_ZERO&&(i.value=i.value.slice(1,2)+i.value.slice(2,i.value.length)),i.value=i.value===f.DOUBLE_ZERO?f.NUMBER_ZERO:i.value),this._maskService.applyValueChanges(o,this._justPasted(),this._code()===f.BACKSPACE||this._code()===f.DELETE,(m,I)=>{this._justPasted.set(!1),a=m,u=I}),this._getActiveElement()!==i)return;if(this._maskService.plusOnePosition&&(o=o+1,this._maskService.plusOnePosition=!1),this._maskExpressionArray().length)if(this._code()===f.BACKSPACE){let m=this.specialCharacters().includes(this._maskService.actualValue.slice(o-1,o)),I=this._maskService.removeMask(this._inputValue())?.length===this._maskService.removeMask(this._maskService.maskExpression)?.length,y=this.specialCharacters().includes(this._maskService.actualValue.slice(o,o+1));I&&!y?o=i.selectionStart+1:o=m?o-1:o}
21else o=i.selectionStart===1?i.selectionStart+this._maskService.prefix.length:i.selectionStart;this._position.set(this._position()===1&&this._inputValue().length===1?null:this._position());let d=this._position()?this._inputValue().length+o+a:o+(this._code()===f.BACKSPACE&&!u?0:a);d>this._getActualInputLength()&&(d=i.value===this._maskService.decimalMarker&&i.value.length===1?this._getActualInputLength()+1:this._getActualInputLength()),d<0&&(d=0),i.setSelectionRange(d,d),this._position.set(null)}else console.warn("Ngx-mask writeValue work with string | number, your current value:",typeof r);else{if(!this._maskValue()){this.onChange(i.value);return}this._maskService.applyValueChanges(i.value.length,this._justPasted(),this._code()===f.BACKSPACE||this._code()===f.DELETE)}}onCompositionStart(){this._isComposing.set(!0)}onCompositionEnd(e){this._isComposing.set(!1),this._justPasted.set(!0),this.onInput(e)}onBlur(e){if(this._maskValue()){let i=e.target;if(this._maskService.leadZero&&i.value.length>0&&typeof this._maskService.decimalMarker=="string"){let r=this._maskService.maskExpression,o=this._maskService.decimalMarker,a=this._maskService.suffix,u=Number(this._maskService.maskExpression.slice(r.length-1,r.length));if(u>0){i.value=a?i.value.split(a).join(""):i.value;let d=i.value.split(o)[1];i.value=i.value.includes(o)?i.value+f.NUMBER_ZERO.repeat(u-d.length)+a:i.value+o+f.NUMBER_ZERO.repeat(u)+a,this._maskService.actualValue=i.value}}this._maskService.clearIfNotMatchFn()}this._isFocused.set(!1),this.onTouch()}onClick(e){if(!this._maskValue())return;let i=e.target,r=0,o=0;i!==null&&i.selectionStart!==null&&i.selectionStart===i.selectionEnd&&i.selectionStart>this._maskService.prefix.length&&e.keyCode!==38&&this._maskService.showMaskTyped&&!this.keepCharacterPositions()&&(this._maskService.maskIsShown=this._maskService.showMaskInInput(),i.setSelectionRange&&this._maskService.prefix+this._maskService.maskIsShown===i.value?(i.focus(),i.setSelectionRange(r,o)):i.selectionStart>this._maskService.actualValue.length&&i.setSelectionRange(this._maskService.actualValue.length,this._maskService.actualValue.length));let a=i&&(i.value===this._maskService.prefix?this._maskService.prefix+this._maskService.maskIsShown:i.value);if(i&&i.value!==a&&(i.value=a),i&&i.type!=="number"&&(i.selectionStart||i.selectionEnd)<=this._maskService.prefix.length){let u=this._maskService.maskExpression.match(new RegExp(`^[${this._maskService.specialCharacters.map(d=>`\\${d}`).join("")}]+`))?.[0].length||0;i.selectionStart=this._maskService.prefix.length+u;return}i&&i.selectionEnd>this._getActualInputLength()&&(i.selectionEnd=this._getActualInputLength())}onKeyDown(e){if(!this._maskValue())return;if(this._isComposing()){e.key==="Enter"&&this.onCompositionEnd(e);return}this._code.set(e.code?e.code:e.key);let i=e.target;this._inputValue.set(i.value),this._setMask();let r=i.tagName.toLowerCase()==="textarea";if(i.type!=="number"){if(e.key===f.ARROW_UP&&!r&&e.preventDefault(),e.key===f.ARROW_LEFT||e.key===f.BACKSPACE||e.key===f.DELETE){if(e.key===f.BACKSPACE&&i.value.length===0&&(i.selectionStart=i.selectionEnd),e.key===f.BACKSPACE&&i.selectionStart!==0){let a=this.prefix().length,u=this.specialCharacters().length?this.specialCharacters():this._config.specialCharacters;if(a>1&&i.selectionStart<=a)i.setSelectionRange(a,i.selectionEnd);else if(this._inputValue().length!==i.selectionStart&&i.selectionStart!==1)for(;u.includes((this._inputValue()[i.selectionStart-1]??f.EMPTY_STRING).toString())&&(a>=1&&i.selectionStart>a||a===0);)i.setSelectionRange(i.selectionStart-1,i.selectionEnd)}this.checkSelectionOnDeletion(i),this._maskService.prefix.length&&i.selectionStart<=this._maskService.prefix.length&&i.selectionEnd<=this._maskService.prefix.length&&e.preventDefault();let o=i.selectionStart;e.key===f.BACKSPACE&&!i.readOnly&&o===0&&i.selectionEnd===i.value.length&&i.value.length!==0&&(this._position.set(this._maskService.prefix?this._maskService.prefix.length:0),this._maskService.applyMask(this._maskService.prefix,this._maskService.maskExpression,this._position()))}this.suffix()&&this.suffix().length>1&&this._inputValue().length-this.suffix().length<i.selectionStart?i.setSelectionRange(this._inputValue().length-this.suffix().length,this._inputValue().length):(e.code==="KeyA"&&e.ctrlKey||e.code==="KeyA"&&e.metaKey)&&(i.setSelectionRange(0,this._getActualInputLength()),e.preventDefault()),this._maskService.selStart=i.selectionStart,this._maskService.selEnd=i.selectionEnd}}writeValue(e){return b(this,null,function*(){let i=e,r=this._maskService.inputTransformFn;if(typeof i=="object"&&i!==null&&"value"in i&&("disable"in i&&this.setDisabledState(!!i.disable),i=i.value),i!==null&&(i=r?r(i):i),typeof i=="string"||typeof i=="number"||i===null||typeof i>"u"){(i===null||typeof i>"u"||i==="")&&(this._maskService.currentValue="",this._maskService.previousValue="");let o=i;if(typeof o=="number"||this._maskValue().startsWith(f.SEPARATOR)){o=String(o);let a=this._maskService.currentLocaleDecimalMarker();Array.isArray(this._maskService.decimalMarker)||(o=this._maskService.decimalMarker!==a?o.replace(a,this._maskService.decimalMarker):o),this._maskService.leadZero&&o&&this.mask()&&this.dropSpecialCharacters()!==!1&&(o=this._maskService._checkPrecision(this._maskService.maskExpression,o)),(this._maskService.decimalMarker===f.COMMA||Array.isArray(this._maskService.decimalMarker)&&this._maskService.thousandSeparator===f.DOT)&&(o=o.toString().replace(f.DOT,f.COMMA)),this.mask()?.startsWith(f.SEPARATOR)&&this.leadZero()&&requestAnimationFrame(()=>
21{this._maskService.applyMask(o?.toString()??"",this._maskService.maskExpression)}),this._maskService.isNumberValue=!0}(typeof o!="string"||i===null||typeof i>"u")&&(o=""),this._inputValue.set(o),this._setMask(),o&&this._maskService.maskExpression||this._maskService.maskExpression&&(this._maskService.prefix||this._maskService.showMaskTyped)?(this._maskService.writingValue=!0,this._maskService.formElementProperty=["value",this._maskService.applyMask(o,this._maskService.maskExpression)],this._maskService.writingValue=!1,this._maskService.isInitialized=!0):(this._maskService.formElementProperty=["value",o],this._maskService.isInitialized=!0),this._inputValue.set(o)}else console.warn("Ngx-mask writeValue work with string | number, your current value:",typeof i)})}registerOnChange(e){this._maskService.onChange=this.onChange=e}registerOnTouched(e){this.onTouch=e}_getActiveElement(e=this.document){let i=e?.activeElement?.shadowRoot;return i?.activeElement?this._getActiveElement(i):e.activeElement}checkSelectionOnDeletion(e){let i=this.prefix().length,r=this.suffix().length,o=this._inputValue().length;e.selectionStart=Math.min(Math.max(i,e.selectionStart),o-r),e.selectionEnd=Math.min(Math.max(i,e.selectionEnd),o-r)}setDisabledState(e){this._maskService.formElementProperty=["disabled",e]}_applyMask(){this._maskService.maskExpression=this._maskService._repeatPatternSymbols(this._maskValue()||""),this._maskService.formElementProperty=["value",this._maskService.applyMask(this._inputValue(),this._maskService.maskExpression)]}_validateTime(e){let i=this._maskValue().split(f.EMPTY_STRING).filter(r=>r!==":").length;return e&&(+(e[e.length-1]??-1)==0&&e.length<i||e.length<=i-2)?this._createValidationError(e):null}_getActualInputLength(){return this._maskService.actualValue.length||this._maskService.actualValue.length+this._maskService.prefix.length}_createValidationError(e){return{mask:{requiredMask:this._maskValue(),actualValue:e}}}_setMask(){this._maskExpressionArray().some(e=>{if(e.split(f.EMPTY_STRING).some(r=>this._maskService.specialCharacters.includes(r))&&this._inputValue()&&this._areAllCharactersInEachStringSame(this._maskExpressionArray())||e.includes(f.CURLY_BRACKETS_LEFT)){let r=this._maskService.removeMask(this._inputValue())?.length<=this._maskService.removeMask(e)?.length;if(r){let o=e.includes(f.CURLY_BRACKETS_LEFT)?this._maskService._repeatPatternSymbols(e):e;return this._maskValue.set(o),this._maskService.maskExpression=o,r}else{let o=this._maskExpressionArray()[this._maskExpressionArray().length-1]??f.EMPTY_STRING,a=o.includes(f.CURLY_BRACKETS_LEFT)?this._maskService._repeatPatternSymbols(o):o;this._maskValue.set(a),this._maskService.maskExpression=a}}else{let r=this._maskService.removeMask(e),o=this._maskService.removeMask(this._inputValue())?.split(f.EMPTY_STRING).every((a,u)=>{let d=r.charAt(u);return this._maskService._checkSymbolMask(a,d)});if(o||this._justPasted())return this._maskValue.set(e),this._maskService.maskExpression=e,o}})}_areAllCharactersInEachStringSame(e){let i=this._maskService.specialCharacters;function r(a){let u=new RegExp(`[${i.map(d=>`\\${d}`).join("")}]`,"g");return a.replace(u,"")}return e.map(r).every(a=>new Set(a).size===1)}static \u0275fac=function(i){return new(i||n)};static \u0275dir=Zr({type:n,selectors:[["input","mask",""],["textarea","mask",""]],hostBindings:function(i,r){i&1&&M("paste",function(){return r.onPaste()})("focus",function(a){return r.onFocus(a)})("ngModelChange",function(a){return r.onModelChange(a)})("input",function(a){return r.onInput(a)})("compositionstart",function(a){return r.onCompositionStart(a)})("compositionend",function(a){return r.onCompositionEnd(a)})("blur",function(a){return r.onBlur(a)})("click",function(a){return r.onClick(a)})("keydown",function(a){return r.onKeyDown(a)})},inputs:{mask:[1,"mask"],specialCharacters:[1,"specialCharacters"],patterns:[1,"patterns"],prefix:[1,"prefix"],suffix:[1,"suffix"],thousandSeparator:[1,"thousandSeparator"],decimalMarker:[1,"decimalMarker"],dropSpecialCharacters:[1,"dropSpecialCharacters"],hiddenInput:[1,"hiddenInput"],showMaskTyped:[1,"showMaskTyped"],placeHolderCharacter:[1,"placeHolderCharacter"],shownMaskExpression:[1,"shownMaskExpression"],clearIfNotMatch:[1,"clearIfNotMatch"],validation:[1,"validation"],separatorLimit:[1,"separatorLimit"],allowNegativeNumbers:[1,"allowNegativeNumbers"],leadZeroDateTime:[1,"leadZeroDateTime"],leadZero:[1,"leadZero"],triggerOnMaskChange:[1,"triggerOnMaskChange"],apm:[1,"apm"],inputTransformFn:[1,"inputTransformFn"],outputTransformFn:[1,"outputTransformFn"],keepCharacterPositions:[1,"keepCharacterPositions"],instantPrefix:[1,"instantPrefix"]},outputs:{maskFilled:"maskFilled"},exportAs:["mask","ngxMask"],features:[za([{provide:es,useExisting:n,multi:!0},{provide:is,useExisting:n,multi:!0},Pa]),gi]})}return n})();function jf(n,t){if(n&1&&(s(0,"div",20),T(1,"img",27),s(2,"p",17),p(3),v(4,"translate"),c(),s(5,"p"),p(6),v(7,"date"),c()()),n&2){let e=C();l(3),P(_(4,2,"ITEM-CHECKOUT.DATA")),l(3),P(Dn(7,4,e.item.product.Book.date,"dd/MM/yyyy","+0000"))}}function Gf(n,t){if(n&1&&(ce(0),p(1),de()),n&2){let e=C();l(),Te(" ",e.getPrimeiroHorarioCombo()," \xE0s ",e.item.product.Book.timeOfArrival," ")}}function zf(n,t){if(n&1&&p(0),n&2){let e=C();E(" ",e.getPrimeiroHorarioCombo()," ")}}function Wf(n,t){if(n&1&&(ce(0),s(1,"p",29),p(2),c(),de()),n&2){let e=t.$implicit;l(2),P(e.nome)}}function qf(n,t){if(n&1&&(ce(0),x(1,Wf,3,1,"ng-container",28),de()),n&2){let e=C(2);l(),h("ngForOf",e.getPassageirosParaExibicao())}}function Kf(n,t){if(n&1&&(s(0,"p",29),p(1),c()),n&2){let e=C(2);l(),P(e.getResumoPassageirosPorTipo())}}function Yf(n,t){if(n&1&&(ce(0),x(1,qf,2,1,"ng-container",19)(2,Kf,2,1,"ng-template",null,2,ve),de()),n&2){let e=Z(3),i=C();l(),h("ngIf",i.passageirosPossuemNomes())("ngIfElse",e)}}function Zf(n,t){n&1&&(s(0,"p",29),p(1),v(2,"translate"),c()),n&2&&(l(),P(_(2,1,"ITEM-CHECKOUT.NENHUM-PASSAGEIRO")))}function Xf(n,t){if(n&1&&(s(0,"div",20),T(1,"img",30),s(2,"p"),p(3),v(4,"translate"),c()()),n&2){let e=C();l(3),Te(" ",_(4,2,"ITEM-CHECKOUT.EMBARQUE")," ",e.item.product.Book.localEmbarqueNome," ")}}function Qf(n,t){if(n&1&&(s(0,"div")(1,"p",24),p(2),v(3,"translate"),c(),s(4,"p",31),p(5),v(6,"translate"),c()()),n&2){let e=C();l(2),Te("",_(3,4,"ITEM-CHECKOUT.CUPOM")," ",e.item.cupom==null?null:e.item.cupom.cdCupom,""),l(3),Te(" ",_(6,6,"ITEM-CHECKOUT.DESCONTO")," ",e.formatarValorDesconto(e.item)," ")}}function Jf(n,t){if(n&1&&(s(0,"strong",32)(1,"p",24),p(2),v(3,"translate"),c()()),n&2){let e=C();l(2),Te(" ",_(3,2,"ITEM-CHECKOUT.TOTAL")," ",e.formatarValorTotal(e.item)," ")}}var Lr=class n{constructor(t){this.store=t;this.$imageUrl=pe.IMAGEURL;this.aberto=!0;this.primeiroHorario=null}ngOnInit(){this.primeiroHorario=this.calcularPrimeiroHorario()}ImageOrEmpty(t,e){return Rt(t,e)}removeItem(t){t!=null&&this.store.dispatch(Oi({productId:t}))}formatarValor(t){let e=t.product.Book?.vlVenda??t.product.vlVenda??0;return Yt(e)}formatarValorDesconto(t){let e=t.desconto??0;return Yt(e)}formatarValorTotal(t){let e=t.precoComDesconto??0;return Yt(e)}toggle(){this.aberto=!this.aberto}getLocalDateUTC(t){return t}calcularValorTotalItem(t){return(t.product.Book?.vlVenda??t.product.vlVenda??0)*t.quantity}passageirosPossuemNomes(){return this.item?.passageiros&&this.item.passageiros.length>0?this.item.passageiros.some(t=>t.nome&&t.nome.trim()!==""):!this.item?.product?.Book?.passengers||this.item.product.Book.passengers.length===0?!1:this.item.product.Book.passengers.some(t=>t.nome&&t.nome.trim()!=="")}getResumoPassageirosPorTipo(){let t=this.item?.passageiros&&this.item.passageiros.length>0?this.item.passageiros:this.item?.product?.Book?.passengers||[];if(t.length===0)return"";let e={};t.forEach(o=>{let a=o.tipo||"Passageiro";e[a]=(e[a]||0)+1});let i={adt:"Adulto",chd:"Crian\xE7a",sen:"Senior",inf:"Beb\xEA",Adulto:"Adulto",Crian\u00E7a:"Crian\xE7a",Senior:"Senior",Beb\u00EA:"Beb\xEA"};return Object.entries(e).map(([o,a])=>{let u=i[o]||o;return`${a} ${u}${a>1?"s":""}`}).join(", ")}getPassageirosParaExibicao(){return this.item?.passageiros&&this.item.passageiros.length>0?this.item.passageiros:this.item?.product?.Book?.passengers||[]}calcularPrimeiroHorario(){let t=this.item?.product,e=t?.Book?.horariosItensCombo;if(e&&Object.keys(e).length>0){let i=Object.values(e).find(a=>this.isFlagTrem(a?.fltrem)&&!this.isHorarioSemHora(this.getHorarioValue(a)));if(i)return this.getHorarioValue(i);let r=t?.Book?.timeOfDeparture||null;if(!this.isHorarioSemHora(r))return r;let o=Object.values(e).map(a=>this.getHorarioValue(a)).filter(a=>!this.isHorarioSemHora(a));if(o.length>0)return o.sort((u,d)=>u.localeCompare(d))[0]}return t?.Book?.timeOfDeparture||null}getHorarioValue(t){return t?.ida||t?.hrServico||t?.hora||null}isHorarioSemHora(t){return!t||t==="00:00"||t==="0:00"}isFlagTrem(t){return t===!0||t==="true"||t===1||t==="1"||t==="S"||t==="s"}getPrimeiroHorarioCombo(){return this.primeiroHorario}static{this.\u0275fac=function(e){return new(e||n)(O(Ie))}}static{this.\u0275cmp=ne({type:n,selectors:[["app-item-checkout"]],inputs:{item:"item"},standalone:!1,decls:42,vars:33,consts:[["apenasIda",""],["nenhumPassageiro",""],["semNomes",""],[1,"bg-[--secondary-background-bg-color]","text-[--secondary-background-text-color]","p-[7px]","mb-[16px]","rounded-lg","max-w-[92%]","mx-auto"],[1,"flex","flex-row","items-center","justify-between","gap-3","w-full"],["alt","",1,"w-[50px]","h-[50px]","min-w-[50px]","object-cover","rounded-xl","shrink-0",3,"src"],[1,"flex-1","text-sm","text-[--secondary-background-text-color]","font-semibold","leading-tight","break-words",3,"title"],[1,"flex","items-center","justify-center","w-10","h-10","min-w-[40px]","shrink-0","transition-transform","duration-300","rounded-full","hover:bg-black/5",3,"click"],[1,"bi","bi-chevron-compact-down","text-lg","text-[--secondary-background-text-color]"],[1,"overflow-hidden","transition-all","duration-500","ease-in-out"],[1,"flex","gap-[7px]","justify-around","mt-2"],[1,"gap-[7px]","flex","flex-col","w-full"],[1,"flex","flex-col","gap-[5px]","text-[14px]","text-[--primary-black-color]"],["class","flex items-center gap-[11px]",4,"ngIf"],[1,"flex","items-start","gap-[11px]"],["src","../../../../assets/img/icones/tabler_clock.svg",1,"max-w-[20px]","min-w-[20px]","mt-0.5"],[1,"flex","flex-col","w-full"],[1,"text-[--primary-background-text-color]","font-bold"],[1,"text-sm"],[4,"ngIf","ngIfElse"],[1,"flex","items-center","gap-[11px]"],["src","../../../../assets/img/icones/bi_people.svg",1,"max-w-[20px]","min-w-[20px]","self-start","mr-1"],[1,"flex","flex-col"],[1,"flex","flex-row","justify-between","items-center","mt-2"],[1,"text-[--primary-black-color]","font-semibold"],[4,"ngIf"],["class","text-green-600 font-semibold",4,"ngIf"],["src","../../../../assets/img/icones/solar_calendar-linear.
21svg",1,"max-w-[20px]","min-w-[20px]"],[4,"ngFor","ngForOf"],[1,"text-[--primary-black-color]","font-normal"],["src","../../../../assets/img/icones/buildings.svg",1,"max-w-[20px]","min-w-[20px]","self-start","mr-1"],[1,"text-red-500","font-semibold"],[1,"text-green-600","font-semibold"]],template:function(e,i){if(e&1){let r=z();s(0,"section")(1,"div",3)(2,"div",4),T(3,"img",5),s(4,"p",6),v(5,"contentTranslate"),p(6),v(7,"contentTranslate"),c(),s(8,"button",7),M("click",function(){return R(r),D(i.toggle())}),T(9,"i",8),c()(),s(10,"div",9)(11,"div",10)(12,"div",11)(13,"div",12),x(14,jf,8,8,"div",13),s(15,"div",14),T(16,"img",15),s(17,"div",16)(18,"p",17),p(19),v(20,"translate"),c(),s(21,"p",18),x(22,Gf,2,2,"ng-container",19)(23,zf,1,1,"ng-template",null,0,ve),c()()(),s(25,"div",20),T(26,"img",21),s(27,"div",22)(28,"p",17),p(29),v(30,"translate"),c(),x(31,Yf,4,2,"ng-container",19)(32,Zf,3,3,"ng-template",null,1,ve),c()(),x(34,Xf,5,4,"div",13),s(35,"div",23)(36,"div")(37,"p",24),p(38),v(39,"translate"),c(),x(40,Qf,7,8,"div",25)(41,Jf,4,4,"strong",26),c()()()()()()()()}if(e&2){let r=Z(24),o=Z(33);l(3),h("src",i.ImageOrEmpty(i.item.product.Imagem==null?null:i.item.product.Imagem.dsPath,"50x50"),Fe),l(),h("title",re(5,21,i.item.product,"nmItem")),l(2),E(" ",re(7,24,i.item.product,"nmItem")," "),l(2),ge("rotate-180",i.aberto),l(2),ge("max-h-0",!i.aberto)("max-h-[1000px]",i.aberto),l(4),h("ngIf",i.item.product.Book.date),l(5),E(" ",_(20,27,"ITEM-CHECKOUT.HORARIO")," "),l(3),h("ngIf",i.item.product.Book.timeOfArrival)("ngIfElse",r),l(7),E(" ",_(30,29,"ITEM-CHECKOUT.PASSAGEIROS")," "),l(2),h("ngIf",i.getPassageirosParaExibicao().length>0)("ngIfElse",o),l(3),h("ngIf",i.item.product.Book.localEmbarqueId),l(4),Te(" ",_(39,31,"ITEM-CHECKOUT.SUB-TOTAL")," ",i.formatarValor(i.item)," "),l(2),h("ngIf",i.item.desconto),l(),h("ngIf",i.item.desconto)}},dependencies:[Ce,oe,bi,Pe,Dt],encapsulation:2})}};var ka=()=>({standalone:!0}),he=(n,t)=>({border:!0,"border-red-500":n,"border-gray-300":t});function tg(n,t){if(n&1&&(s(0,"li",55),T(1,"app-item-checkout",56),c()),n&2){let e=t.$implicit;l(),h("item",e)}}function ig(n,t){if(n&1&&(ce(0),s(1,"ul",53),x(2,tg,2,1,"li",54),c(),de()),n&2){let e=C().ngIf;l(2),h("ngForOf",e)}}function ng(n,t){if(n&1&&(s(0,"div"),x(1,ig,3,1,"ng-container",52),c()),n&2){let e=t.ngIf;C();let i=Z(15);l(),h("ngIf",e.length>0)("ngIfElse",i)}}function rg(n,t){n&1&&(s(0,"div",57),le(),s(1,"svg",58),T(2,"path",59),c(),Ne(),s(3,"p",60),p(4),v(5,"translate"),c()()),n&2&&(l(4),E(" ",_(5,1,"CHECKOUT.SEM-ITENS-CARRINHO")," "))}function og(n,t){if(n&1){let e=z();s(0,"div",61)(1,"div",62)(2,"div",63)(3,"div",64),le(),s(4,"svg",65),T(5,"path",66),c()(),Ne(),s(6,"div",67)(7,"h3",68),p(8," Aten\xE7\xE3o "),c(),s(9,"p",69),p(10),c()(),s(11,"button",70),M("click",function(){R(e);let r=C();return D(r.clearPaymentErrorState())}),le(),s(12,"svg",71),T(13,"path",72),c()()()()()}if(n&2){let e=C();l(10),E(" ",e.paymentErrorMessage," ")}}function ag(n,t){if(n&1&&(s(0,"label",73),T(1,"input",74),s(2,"p",75),p(3),v(4,"translate"),c()()),n&2){let e=t.$implicit,i=C();h("ngClass",X(5,he,i.campoInvalido("formaPagamento"),!i.campoInvalido("formaPagamento"))),l(),h("value",e.nmTipoFormaPagto),l(2),P(_(4,3,"CHECKOUT.FORMAS-PAGAMENTO."+e.nmTipoFormaPagto.toUpperCase()))}}function sg(n,t){n&1&&(s(0,"div",103),p(1," Escolha uma forma de pagamento. "),c())}function lg(n,t){if(n&1&&(s(0,"option",104),p(1),c()),n&2){let e=t.$implicit;h("value",e.value),l(),E(" ",e.label," ")}}function cg(n,t){if(n&1&&T(0,"img",105),n&2){let e=C(2);h("src",e.bandeiraCartao,Fe)}}function dg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.NUMERO-CARTAO-OBRIGATORIO"),"."))}function ug(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.PADRAO-CARTAO"),"."))}function pg(n,t){if(n&1&&(s(0,"div",103),x(1,dg,3,3,"span",8)(2,ug,3,3,"span",8),c()),n&2){let e,i,r=C(2);l(),h("ngIf",(e=r.checkoutForm.get("nmCartao"))==null||e.errors==null?null:e.errors.required),l(),h("ngIf",(i=r.checkoutForm.get("nmCartao"))==null||i.errors==null?null:i.errors.pattern)}}function mg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.NOME-TITULAR-OBRIGATORIO"),"."))}function hg(n,t){if(n&1&&(s(0,"div",103),x(1,mg,3,3,"span",8),c()),n&2){let e,i=C(2);l(),h("ngIf",(e=i.checkoutForm.get("nmTitular"))==null||e.errors==null?null:e.errors.required)}}function fg(n,t){if(n&1&&(s(0,"span"),p(1),v(2,"translate"),v(3,"translate"),c()),n&2){let e=C(3);l(),E(" ",e.tipoDocumento==="CPF"?_(2,1,"CHECKOUT.CPF-OBRIGATORIO"):_(3,3,"CHECKOUT.PASSAPORTE-OBRIGATORIO")," ")}}function gg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E(" ",_(2,1,"CHECKOUT.CPF-INVALIDO")," "))}function vg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E(" ",_(2,1,"CHECKOUT.PASSAPORTE-INVALIDO")," "))}function _g(n,t){if(n&1&&(s(0,"div",103),x(1,fg,4,5,"span",8)(2,gg,3,3,"span",8)(3,vg,3,3,"span",8),c()),n&2){let e,i,r,o=C(2);l(),h("ngIf",(e=o.checkoutForm.get("documentoTitular"))==null||e.errors==null?null:e.errors.required),l(),h("ngIf",(i=o.checkoutForm.get("documentoTitular"))==null||i.errors==null?null:i.errors.cpfInvalido),l(),h("ngIf",(r=o.checkoutForm.get("documentoTitular"))==null||r.errors==null?null:r.errors.passaportInvalido)}}function Cg(n,t){if(n&1){let e=z();s(0,"div",76),x(1,sg,2,0,"div",77),s(2,"div",36)(3,"label",78),p(4),v(5,"translate"),c(),s(6,"select",79)(7,"option",80),p(8),v(9,"translate"),c(),x(10,lg,2,2,"option",81),c()(),s(11,"div",76)(12,"p",82),p(13),v(14,"translate"),c(),s(15,"div",76)(16,"div",83)(17,"div",84),x(18,cg,1,1,"img",85),s(19,"input",86),v(20,"translate"),M("blur",function(){R(e);let r=C();return D(r.checkBandeira())}),c()()(),x(21,pg,3,2,"div",77),c(),s(22,"div",36)(23,"div",14),T(24,"input",87),v(25,"translate"),x(26,hg,2,1,"div",77),c()(),s(27,"div",88)(28,"div",89)(29,"div",90)(30,"label",91),T(31,"input",92),s(32,"span",93),p(33),v(34,"translate"),c()(),s(35,"label",91),T(36,"input",94),s(37,"span",93),p(38),v(39,"translate"),c()()()(),s(40,"div",95),T(41,"input",96),v(42,"translate"),v(43,"translate"),x(44,_g,4,3,"div",77),c()(),s(45,"div",88)(46,"div",97),T(47,"input",98),v(48,"translate"),c(),s(49,"div",97),T(50,"input",99),c()()(),s(51,"div",100),T(52,"input",101),s(53,"p",102),p(54),v(55,"translate"),c()()()}if(n&2){let e=C();
21l(),h("ngIf",e.campoInvalido("formaPagamento")),l(3),E("",_(5,27,"CHECKOUT.PARCELAMENTO"),":"),l(3),h("value",null),l(),P(_(9,29,"CHECKOUT.SELECIONE-OPCAO")),l(2),h("ngForOf",e.parcelas),l(3),E("",_(14,31,"CHECKOUT.DADOS-CARTAO")," "),l(5),h("ngIf",e.bandeiraCartao),l(),h("placeholder",_(20,33,"CHECKOUT.NUMERO-CARTAO"))("dropSpecialCharacters",!0)("ngClass",X(49,he,e.campoInvalido("nmCartao"),!e.campoInvalido("nmCartao"))),l(2),h("ngIf",e.campoInvalido("nmCartao")),l(3),h("ngClass",X(52,he,e.campoInvalido("nmTitular"),!e.campoInvalido("nmTitular")))("placeholder",_(25,35,"CHECKOUT.NOME-TITULAR")),l(2),h("ngIf",e.campoInvalido("nmTitular")),l(7),P(_(34,37,"CHECKOUT.CPF")),l(5),P(_(39,39,"CHECKOUT.PASSAPORTE")),l(3),h("ngClass",X(55,he,e.campoInvalido("documentoTitular"),!e.campoInvalido("documentoTitular")))("placeholder",e.tipoDocumento==="CPF"?_(42,41,"CHECKOUT.CPF"):_(43,43,"CHECKOUT.NUMERO-PASSAPORTE"))("mask",e.tipoDocumento==="CPF"?e.documentMask:"")("dropSpecialCharacters",!0),l(3),h("ngIf",e.campoInvalido("documentoTitular")),l(3),h("placeholder",_(48,45,"CHECKOUT.CARTAO-VALIDADE"))("ngClass",X(58,he,e.campoInvalido("validade"),!e.campoInvalido("validade"))),l(3),h("ngClass",X(61,he,e.campoInvalido("cvv"),!e.campoInvalido("cvv")))("mask",e.cvvMask)("dropSpecialCharacters",!0),l(4),P(_(55,47,"CHECKOUT.SALVAR-DADOS-CARTAO"))}}function Ig(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E(" ",_(2,1,"CHECKOUT.CPF-OBRIGATORIO"),". "))}function bg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E(" ",_(2,1,"CHECKOUT.CPF-INVALIDO"),". "))}function xg(n,t){if(n&1&&(s(0,"div",103),x(1,Ig,3,3,"span",8)(2,bg,3,3,"span",8),c()),n&2){let e,i,r=C(3);l(),h("ngIf",(e=r.checkoutForm.get("cpfUsuarioPix"))==null||e.errors==null?null:e.errors.required),l(),h("ngIf",(i=r.checkoutForm.get("cpfUsuarioPix"))==null||i.errors==null?null:i.errors.cpfInvalido)}}function Eg(n,t){if(n&1&&(s(0,"div",95),T(1,"input",109),v(2,"translate"),x(3,xg,3,2,"div",77),c()),n&2){let e=C(2);l(),h("ngClass",X(6,he,e.campoInvalido("cpfUsuarioPix"),!e.campoInvalido("cpfUsuarioPix")))("placeholder",_(2,4,"CHECKOUT.CPF"))("dropSpecialCharacters",!0),l(2),h("ngIf",e.campoInvalido("cpfUsuarioPix"))}}function Sg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E(" ",_(2,1,"CHECKOUT.TELEFONE-OBRIGATORIO"),". "))}function yg(n,t){if(n&1&&(s(0,"div",103),x(1,Sg,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("telefone"))==null||e.errors==null?null:e.errors.required)}}function Tg(n,t){if(n&1&&(s(0,"div",95),T(1,"input",110),v(2,"translate"),x(3,yg,2,1,"div",77),c()),n&2){let e=C(2);l(),h("ngClass",X(6,he,e.campoInvalido("telefone"),!e.campoInvalido("telefone")))("placeholder",_(2,4,"CHECKOUT.TELEFONE"))("dropSpecialCharacters",!0),l(2),h("ngIf",e.campoInvalido("telefone"))}}function Pg(n,t){if(n&1&&(s(0,"div",106)(1,"div",107),x(2,Eg,4,9,"div",108)(3,Tg,4,9,"div",108),c()()),n&2){let e=C();l(2),h("ngIf",!e.currentUser||!e.currentUser.nrDocumento),l(),h("ngIf",!e.currentUser||!e.currentUser.nrTelCelular)}}function kg(n,t){if(n&1&&(s(0,"option",118),p(1),c()),n&2){let e=t.$implicit;h("value",e.code),l(),E(" ",e.name," ")}}function Ag(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E(" ",_(2,1,"CHECKOUT.PAIS-OBRIGATORIO")," "))}function Og(n,t){if(n&1&&(s(0,"div",103),x(1,Ag,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("paisSelecionado"))==null||e.errors==null?null:e.errors.required)}}function wg(n,t){if(n&1&&(s(0,"div",115)(1,"div",97)(2,"select",116),x(3,kg,2,2,"option",117),c(),x(4,Og,2,1,"div",77),c()()),n&2){let e=C(2);l(2),h("ngClass",X(3,he,e.campoInvalido("paisSelecionado"),!e.campoInvalido("paisSelecionado"))),l(),h("ngForOf",e.countries),l(),h("ngIf",e.campoInvalido("paisSelecionado"))}}function Rg(n,t){n&1&&(s(0,"div",133),le(),s(1,"svg",134),T(2,"circle",135)(3,"path",136),c()())}function Dg(n,t){if(n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2){let e=C(4);l(),E(" ",e.selectedCountry==="BR"?_(2,1,"CHECKOUT.CEP-OBRIGATORIO"):"C\xF3digo postal \xE9 obrigat\xF3rio"," ")}}function Ng(n,t){if(n&1&&(s(0,"span"),p(1),c()),n&2){let e=C(4);l(),E(" ",e.selectedCountry==="BR"?"CEP n\xE3o encontrado ou inv\xE1lido":"C\xF3digo postal n\xE3o encontrado"," ")}}function Mg(n,t){if(n&1&&(s(0,"span"),p(1),c()),n&2){let e=C(4);l(),E(" ",e.selectedCountry==="BR"?"N\xE3o foi poss\xEDvel consultar o CEP":"N\xE3o foi poss\xEDvel consultar o c\xF3digo postal"," ")}}function Fg(n,t){if(n&1&&(s(0,"div",103),x(1,Dg,3,3,"span",8)(2,Ng,2,1,"span",8)(3,Mg,2,1,"span",8),c()),n&2){let e,i,r,o=C(3);l(),h("ngIf",(e=o.checkoutForm.get("cep"))==null||e.errors==null?null:e.errors.required),l(),h("ngIf",(i=o.checkoutForm.get("cep"))==null||i.errors==null?null:i.errors.cepNaoEncontrado),l(),h("ngIf",(r=o.checkoutForm.get("cep"))==null||r.errors==null?null:r.errors.cepApiError)}}function Lg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.CIDADE-OBRIGATORIO"),"."))}function Vg(n,t){if(n&1&&(s(0,"div",103),x(1,Lg,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("cidade"))==null||e.errors==null?null:e.errors.required)}}function Ug(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.ESTADO-OBRIGATORIO"),"."))}function Bg(n,t){if(n&1&&(s(0,"div",103),x(1,Ug,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("nmEstado"))==null||e.errors==null?null:e.errors.required)}}function Hg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.UF-OBRIGATORIO"),"."))}function $g(n,t){if(n&1&&(s(0,"div",103),x(1,Hg,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("nmUf"))==null||e.errors==null?null:e.errors.required)}}function jg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.PAIS-OBRIGATORIO"),"."))}function Gg(n,t){if(n&1&&(s(0,"div",103),x(1,jg,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("nmPais"))==null||e.errors==null?null:e.errors.required)}}function zg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.LOCALIZACAO-OBRIGATORIO.ENDERECO"),"."))}function Wg(n,t){if(n&1&&(s(0,"div",103),x(1,zg,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("endereco"))==null||e.errors==null?null:e.errors.required)}}function qg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.LOCALIZACAO-OBRIGATORIO.BAIRRO"),"."))}function Kg(n,t){if(n&1&&(s(0,"div",103),x(1,qg,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("nmBairro"))==null||e.errors==null?null:e.errors.required)}}function Yg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.LOCALIZACAO-OBRIGATORIO.NUMERO"),"."))}function Zg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.LOCALIZACAO-MAXLENGTH.NUMERO"),"."))}function Xg(n,t){if(n&1&&(s(0,"div",103),x(1,Yg,3,3,"span",8)(2,Zg,3,3,"span",8),c()),n&2){let e,i,r=C(3);l(),h("ngIf",(e=r.checkoutForm.get("numero"))==null||e.errors==null?null:e.errors.required),l(),h("ngIf",(i=r.checkoutForm.get("numero"))==null||i.errors==null?null:i.errors.maxlength)}}function Qg(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.TELEFONE-OBRIGATORIO"),"."))}function Jg(n,t){if(n&1&&(s(0,"div",103),x(1,Qg,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("telefone"))==null||e.errors==null?null:e.errors.required)}}function e0(n,t){n&1&&(s(0,"span"),p(1),v(2,"translate"),c()),n&2&&(l(),E("",_(2,1,"CHECKOUT.LOCALIZACAO-OBRIGATORIO.COMPLEMENTO"),"."))}function t0(n,t){if(n&1&&(s(0,"div",103),x(1,e0,3,3,"span",8),c()),n&2){let e,i=C(3);l(),h("ngIf",(e=i.checkoutForm.get("complemento"))==null||e.errors==null?null:e.errors.required)}}function i0(n,t){if(n&1){let e=z();s(0,"div",36)(1,"div",115)(2,"div",119)(3,"input",120),v(4,"translate"),v(5,"translate"),M("maskFilled",function(){R(e);let r=C(2);return D(r.buscarEndereco())})("blur",function(){R(e);let r=C(2);return D(r.selectedCountry==="BR"&&r.onCepBlur())})("input",function(r){R(e);let o=C(2);return D(o.onCepInput(r))}),c(),x(6,Rg,4,0,"div",121)(7,Fg,4,3,"div",77),c(),s(8,"div",97),T(9,"input",122),v(10,"translate"),x(11,Vg,2,1,"div",77),c()(),s(12,"div",115)(13,"div",97),T(14,"input",123),v(15,"translate"),x(16,Bg,2,1,"div",77),c(),s(17,"div",97),T(18,"input",124),x(19,$g,2,1,"div",77),c(),s(20,"div",97),T(21,"input",125),v(22,"translate"),x(23,Gg,2,1,"div",77),c()(),s(24,"div",36)(25,"div",14),T(26,"input",126),v(27,"translate"),x(28,Wg,2,1,"div",77),c()(),s(29,"div",127)(30,"div",128)(31,"div",97),T(32,"input",129),v(33,"translate"),x(34,Kg,2,1,"div",77),c(),s(35,"div",97),T(36,"input",130),v(37,"translate"),x(38,Xg,3,2,"div",77),c(),s(39,"div",97),T(40,"input",131),v(41,"translate"),x(42,Jg,2,1,"div",77),c()(),s(43,"div"),T(44,"input",132),v(45,"translate"),x(46,t0,2,1,"div",77),c()()()}if(n&2){let e=C(2);
21l(3),h("ngClass",X(53,he,e.campoInvalido("cep"),!e.campoInvalido("cep")))("placeholder",e.selectedCountry==="BR"?_(4,33,"CHECKOUT.CEP"):_(5,35,"CHECKOUT.CODIGO-POSTAL"))("mask",e.selectedCountry==="BR"?"00000-000":"")("dropSpecialCharacters",!0),l(3),h("ngIf",e.isCepLoading),l(),h("ngIf",e.campoInvalido("cep")),l(2),h("ngClass",X(56,he,e.campoInvalido("nmCidade"),!e.campoInvalido("nmCidade")))("placeholder",_(10,37,"CHECKOUT.CIDADE")),l(2),h("ngIf",e.campoInvalido("nmCidade")),l(3),h("ngClass",X(59,he,e.campoInvalido("nmEstado"),!e.campoInvalido("nmEstado")))("placeholder",_(15,39,"CHECKOUT.ESTADO")),l(2),h("ngIf",e.campoInvalido("nmEstado")),l(2),h("ngClass",X(62,he,e.campoInvalido("nmUf"),!e.campoInvalido("nmUf"))),l(),h("ngIf",e.campoInvalido("nmUf")),l(2),h("ngClass",X(65,he,e.campoInvalido("nmPais"),!e.campoInvalido("nmPais")))("placeholder",_(22,41,"CHECKOUT.PAIS")),l(2),h("ngIf",e.campoInvalido("nmPais")),l(3),h("ngClass",X(68,he,e.campoInvalido("endereco"),!e.campoInvalido("endereco")))("placeholder",_(27,43,"CHECKOUT.LOCALIZACAO.ENDERECO")),l(2),h("ngIf",e.campoInvalido("endereco")),l(4),h("ngClass",X(71,he,e.campoInvalido("nmBairro"),!e.campoInvalido("nmBairro")))("placeholder",_(33,45,"CHECKOUT.LOCALIZACAO.BAIRRO")),l(2),h("ngIf",e.campoInvalido("nmBairro")),l(2),h("ngClass",X(74,he,e.campoInvalido("numero"),!e.campoInvalido("numero")))("placeholder",_(37,47,"CHECKOUT.LOCALIZACAO.NUMERO")),l(2),h("ngIf",e.campoInvalido("numero")),l(2),h("ngClass",X(77,he,e.campoInvalido("telefone"),!e.campoInvalido("telefone")))("placeholder",_(41,49,"CHECKOUT.TELEFONE"))("dropSpecialCharacters",!0),l(2),h("ngIf",e.campoInvalido("telefone")),l(2),h("ngClass",X(80,he,e.campoInvalido("complemento"),!e.campoInvalido("complemento")))("placeholder",_(45,51,"CHECKOUT.LOCALIZACAO.COMPLEMENTO")),l(2),h("ngIf",e.campoInvalido("complemento"))}}function n0(n,t){n&1&&(s(0,"span"),p(1," Telefone \xE9 obrigat\xF3rio "),c())}function r0(n,t){n&1&&(s(0,"span"),p(1," Telefone deve ter no m\xEDnimo 6 d\xEDgitos "),c())}function o0(n,t){if(n&1&&(s(0,"div",103),x(1,n0,2,0,"span",8)(2,r0,2,0,"span",8),c()),n&2){let e,i,r=C(3);l(),h("ngIf",(e=r.checkoutForm.get("telefoneInternacional"))==null||e.errors==null?null:e.errors.required),l(),h("ngIf",(i=r.checkoutForm.get("telefoneInternacional"))==null||i.errors==null?null:i.errors.minlength)}}function a0(n,t){if(n&1&&(s(0,"div",36)(1,"div",128)(2,"div",137),T(3,"input",138),c(),s(4,"div",97),T(5,"input",139),x(6,o0,3,2,"div",77),c()()()),n&2){let e=C(2);l(5),h("ngClass",X(2,he,e.campoInvalido("telefoneInternacional"),!e.campoInvalido("telefoneInternacional"))),l(),h("ngIf",e.campoInvalido("telefoneInternacional"))}}function s0(n,t){if(n&1&&(s(0,"div",111)(1,"p",112),p(2),v(3,"translate"),c(),x(4,wg,5,6,"div",113)(5,i0,47,83,"div",114)(6,a0,7,5,"div",114),c()),n&2){let e=C();l(2),P(_(3,4,"CHECKOUT.ENDERECO")),l(2),h("ngIf",e.tipoDocumento==="PASSAPORTE"),l(),h("ngIf",e.selectedCountry==="BR"),l(),h("ngIf",e.selectedCountry!=="BR")}}function l0(n,t){n&1&&(s(0,"p",140),p(1),v(2,"translate"),c()),n&2&&(l(),E(" ",_(2,1,"CHECKOUT.ERRO-COMUNICACAO")," "))}function c0(n,t){n&1&&(s(0,"p",140),p(1),v(2,"translate"),c()),n&2&&(l(),E(" ",_(2,1,"CHECKOUT.ERRO-ACEITE-POLITICAS")," "))}var Vr=class n{constructor(t,e,i,r,o,a,u,d,m,I,y,S){this.store=t;this.fb=e;this.http=i;this.checkoutService=r;this.utilService=o;this.router=a;this.sharedDataService=u;this.paymentRequestBuilder=d;this.cardValidationService=m;this.reservaStorageService=I;this.cartPersistenceService=y;this.zipcodeService=S;this.emailPasswordDefault=!0;this.credentialsDontMatch=!0;this.changeAccount=!0;this.loading=!1;this.isCepLoading=!1;this.paymentErrorMessage="";this.paymentRequestBlocked=!1;this.currentUser=null;this.triggerLoginValidation=!1;this.aceitePoliticas=!1;this.mostrarErroAceite=!1;this.receberComunicacoesEmail=!0;this.receberComunicacoesWhatsApp=!1;this.mostrarErroComunicacao=!1;this.maxParcelas=rn.MAX_PARCELAS;this.parcelas=[];this.ListFormaPagamentos=[];this.FormasCartao=[];this.bandeiraCartao="";this.cardType="";this.cvvMask=Xe.DEFAULT;this.cardImages=_t;this.countries=Ss;this.selectedCountry="BR";this.tipoDocumento="CPF";this.documentMask="000.000.000-00";this.destroy$=new nt}ngOnInit(){this.initializeObservables(),this.syncCartReferences(),this.subscribeToUser(),this.getAllFormaPagamentos(),this.initializeForm(),this.setupParcelamentoLogic(),this.setupFormaPagamentoListener(),this.setupDocumentTypeListener(),this.setupCountryListener()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}initializeObservables(){this.cartItems$=this.store.select(ft),this.cartTotal$=this.store.select(wi),this.user$=this.store.select(nn)}subscribeToUser(){this.user$.pipe(Wt(this.destroy$)).subscribe(t=>
21{if(this.currentUser=t,t&&this.checkoutForm){let e=this.checkoutForm.get("telefone");e&&!e.value&&t.nrTelCelular&&e.patchValue(t.nrTelCelular.replace(/\D/g,""),{emitEvent:!1})}})}initializeForm(){this.checkoutForm=this.fb.group({validade:["",[F.required]],cvv:["",[F.required]],nmCartao:["",[F.required,F.pattern(Ct.CARD_NUMBER_16)]],nmTitular:["",F.required],tipoDocumento:["CPF",F.required],documentoTitular:["",[F.required,Ai()]],paisSelecionado:["BR",F.required],cep:["",[F.required,F.pattern(Ct.CEP)]],endereco:[""],numero:["",[F.required,F.maxLength(10)]],telefone:["",[F.required,F.pattern(Ct.PHONE)]],ddiTelefone:[""],telefoneInternacional:[""],formaPagamento:[null,F.required],parcelamento:[null,F.required],nmBairro:[null],nmCidade:[null],nmUf:[null],nmEstado:[null],nmPais:["Brasil"],complemento:[null],cpfUsuarioPix:[null],cpfTitular:[""]}),this.currentUser?.nrTelCelular&&this.checkoutForm.patchValue({telefone:this.currentUser.nrTelCelular.replace(/\D/g,"")},{emitEvent:!1})}setupParcelamentoLogic(){this.cartTotal$&&Yi([this.cartTotal$,this.sharedDataService.getVlParcelaMinima()]).pipe(Wt(this.destroy$)).subscribe(([t,e])=>{this.maxParcelas=e>0?e:rn.MAX_PARCELAS,e===0&&console.error('Par\xE2metro "vlParcelaMinima" n\xE3o encontrado ou inv\xE1lido. Usando fallback 1.'),this.gerarParcelas(t)})}setupFormaPagamentoListener(){this.checkoutForm.get("formaPagamento")?.valueChanges.pipe(Wt(this.destroy$)).subscribe(t=>{this.clearPaymentErrorState();let e=this.normalizePaymentType(t)===Qt.PIX;this.ajustarValidadoresPorTipoPagamento(e)}),this.checkoutForm.valueChanges.pipe(Wt(this.destroy$)).subscribe(()=>{this.paymentRequestBlocked&&this.clearPaymentErrorState()})}setupDocumentTypeListener(){this.checkoutForm.get("tipoDocumento")?.valueChanges.pipe(Wt(this.destroy$)).subscribe(t=>{this.tipoDocumento=t,this.ajustarValidadoresDocumento(t),this.ajustarMascaraDocumento(t),t==="CPF"&&this.checkoutForm.patchValue({paisSelecionado:"BR"},{emitEvent:!0}),this.checkoutForm.get("documentoTitular")?.setValue("")})}setupCountryListener(){this.checkoutForm.get("paisSelecionado")?.valueChanges.pipe(Wt(this.destroy$)).subscribe(t=>{this.selectedCountry=t,this.ajustarValidadoresPorPais(t),this.atualizarNomePais(t),this.atualizarDDI(t),this.checkoutForm.patchValue({cep:"",endereco:"",nmBairro:"",nmCidade:"",nmUf:"",nmEstado:"",numero:"",telefone:"",telefoneInternacional:"",complemento:""},{emitEvent:!1})})}ajustarValidadoresDocumento(t){let e=this.checkoutForm.get("documentoTitular");e&&(t==="CPF"?e.setValidators([F.required,Ai()]):t==="PASSAPORTE"&&e.setValidators([F.required,Es()]),e.updateValueAndValidity())}ajustarMascaraDocumento(t){t==="CPF"?this.documentMask="000.000.000-00":this.documentMask="SSSSSSSSSSSSSSSSSSSS"}ajustarValidadoresPorPais(t){if(!(t==="BR")){["cep","endereco","numero","nmBairro","nmCidade","nmEstado","nmUf","telefone","complemento"].forEach(y=>{let S=this.checkoutForm.get(y);S&&(S.clearValidators(),S.updateValueAndValidity())});let I=this.checkoutForm.get("telefoneInternacional");I&&(I.setValidators([F.required,F.minLength(6)]),I.updateValueAndValidity());return}let i=this.checkoutForm.get("cep");i&&(i.setValidators([F.required,F.pattern(Ct.CEP)]),i.updateValueAndValidity()),["endereco","numero","nmBairro","nmCidade","telefone"].forEach(m=>{let I=this.checkoutForm.get(m);I&&(I.setValidators([F.required]),I.updateValueAndValidity())});let o=this.checkoutForm.get("nmEstado"),a=this.checkoutForm.get("nmUf");o?.setValidators([F.required]),a?.setValidators([F.required]),o?.updateValueAndValidity(),a?.updateValueAndValidity();let u=this.checkoutForm.get("telefone");u&&(u.setValidators([F.required,F.pattern(Ct.PHONE)]),u.updateValueAndValidity());let d=this.checkoutForm.get("telefoneInternacional");d&&(d.clearValidators(),d.updateValueAndValidity())}atualizarNomePais(t){let e=this.countries.find(i=>i.code===t);e&&this.checkoutForm.patchValue({nmPais:e.name},{emitEvent:!1})}atualizarDDI(t){let e=this.countries.find(i=>i.code===t);e?.dialCode&&this.checkoutForm.patchValue({ddiTelefone:e.dialCode},{emitEvent:!1})}getTelefoneCompleto(){if(this.selectedCountry==="BR")return this.checkoutForm.value.telefone||this.currentUser?.nrTelCelular||null;{let e=this.checkoutForm.value.ddiTelefone,i=this.checkoutForm.value.telefoneInternacional;if(e&&i){let r=i.replace(/\D/g,"");return`${e}${r}`}return null}}normalizePaymentType(t){if(typeof t=="string")return t.trim().toUpperCase();if(!t)return"";if(t.nmTipoFormaPagto)return String(t.nmTipoFormaPagto).trim().toUpperCase();if(t.nmFormaPagamento)return String(t.nmFormaPagamento).trim().toUpperCase();try{return String(t.toString()).trim().toUpperCase()}catch{return""}}
21ajustarValidadoresPorTipoPagamento(t){this.ajustarValidadoresCamposCartao(t),this.ajustarValidadoresCamposEndereco(t),this.ajustarValidadorCpfPix(t),this.ajustarValidadorTelefone(),this.ajustarValidadorParcelamento(t)}ajustarValidadoresCamposCartao(t){["nmCartao","nmTitular","documentoTitular","tipoDocumento","validade","cvv"].forEach(i=>{let r=this.checkoutForm.get(i);if(r){if(t)i!=="tipoDocumento"&&(r.clearValidators(),r.setValue(""),r.markAsUntouched(),r.markAsPristine());else switch(i){case"nmCartao":r.setValidators([F.required,F.pattern(Ct.CARD_NUMBER_16)]);break;case"nmTitular":r.setValidators([F.required]);break;case"documentoTitular":let o=this.checkoutForm.get("tipoDocumento")?.value;this.ajustarValidadoresDocumento(o||"CPF");break;case"tipoDocumento":r.setValidators([F.required]);break;case"validade":case"cvv":r.setValidators([F.required]);break}r.updateValueAndValidity({emitEvent:!1})}})}ajustarValidadoresCamposEndereco(t){["cep","endereco","numero","nmBairro","nmCidade","nmUf","nmEstado","nmPais","paisSelecionado"].forEach(i=>{let r=this.checkoutForm.get(i);if(r){if(t)i!=="paisSelecionado"&&(r.clearValidators(),r.setValue(null),r.markAsUntouched(),r.markAsPristine());else{let o=this.checkoutForm.get("paisSelecionado")?.value||"BR";i==="paisSelecionado"?r.setValidators([F.required]):i==="cep"?o==="BR"?r.setValidators([F.required,F.pattern(Ct.CEP)]):r.setValidators([F.required]):i==="nmUf"||i==="nmEstado"?o==="BR"?r.setValidators([F.required]):r.clearValidators():r.setValidators([F.required])}r.updateValueAndValidity({emitEvent:!1})}})}ajustarValidadorTelefone(){let t=this.checkoutForm.get("telefone");t&&(!this.currentUser||!this.currentUser.nrTelCelular?t.setValidators([F.required,F.pattern(Ct.PHONE)]):t.clearValidators(),t.updateValueAndValidity({emitEvent:!1}))}ajustarValidadorCpfPix(t){let e=this.checkoutForm.get("cpfUsuarioPix");e&&(t&&(!this.currentUser||!this.currentUser.nrDocumento)?e.setValidators([F.required,Ai()]):(e.clearValidators(),e.setValue(null),e.markAsUntouched(),e.markAsPristine()),e.updateValueAndValidity({emitEvent:!1}))}ajustarValidadorParcelamento(t){let e=this.checkoutForm.get("parcelamento");e&&(t?(e.clearValidators(),e.setValue(null),e.markAsUntouched(),e.markAsPristine()):e.setValidators([F.required]),e.updateValueAndValidity({emitEvent:!1}))}campoInvalido(t){let e=this.checkoutForm.get(t);return!!(e?.invalid&&(e?.dirty||e?.touched))}enviarFormulario(){if(!(this.loading||this.paymentRequestBlocked)){if(!this.aceitePoliticas){this.mostrarErroAceite=!0;return}if(this.mostrarErroAceite=!1,!this.receberComunicacoesEmail&&!this.receberComunicacoesWhatsApp){this.mostrarErroComunicacao=!0;return}if(this.mostrarErroComunicacao=!1,!this.currentUser){this.triggerLoginValidation=!0,window.scrollTo({top:0,behavior:"smooth"});return}if(this.triggerLoginValidation=!1,!this.checkoutForm.valid){this.checkoutForm.markAllAsTouched();return}this.loading=!0,this.cartPersistenceService.refreshCartSnapshot().pipe(xe(()=>_e(null)),hi(t=>Yi([this.user$,this.cartItems$,this.cartTotal$,this.store.select(tn)]).pipe(De(1),we(([e,i,r,o])=>({snapshot:t,user:e,cartItems:i,cartTotal:r,cartState:o}))))).subscribe(({snapshot:t,user:e,cartItems:i,cartTotal:r,cartState:o})=>{if(!e){alert(ei.USER_NOT_FOUND),this.loading=!1;return}if(!i||i.length===0){alert(ei.EMPTY_CART),this.loading=!1;return}let a={nrSession:t?.refs?.nrSession??o?.nrSession??null,idCestoCompra:t?.refs?.idCestoCompra??o?.idCestoCompra??null};this.store.dispatch(en(a));let u=this.paymentRequestBuilder.buildPaymentRequest(e,i,r,this.checkoutForm.value,this.cardType,this.ListFormaPagamentos,this.FormasCartao,{idCestoCompra:a.idCestoCompra,nrSession:a.nrSession});console.log("=== REQUEST PARA API ==="),console.log("Request completo:",JSON.stringify(u.ReservaRequest,null,2)),console.log(`
22=== DETALHAMENTO DOS SERVI\xC7OS E HOR\xC1RIOS ===`),u.ReservaRequest.Servicos?.forEach((d,m)=>{console.log(`
23Servi\xE7o ${m+1}:`),console.log(`  idItem: ${d.idItem}`),console.log(`  nmItem: ${d.nmItem}`),console.log(`  hrServico (principal): ${d.hrServico}`),console.log(`  hrRetorno (principal): ${d.hrRetorno}`),console.log(`  ItensCombo (${d.ItensCombo?.length||0} itens):`),d.ItensCombo?.forEach(I=>{console.log(`    - idItem: ${I.idItem}, hrServico: ${I.hrServico}, hrRetorno: ${I.hrRetorno}`)})}),console.log(`=============================================
24`),console.log("========================"),this.checkoutService.postVenda(u).subscribe({next:d=>this.handleVendaSuccess(d),error:d=>this.handleVendaError(d)})})}}syncCartReferences(){this.cartPersistenceService.syncCartReferencesFromBackend().pipe(De(1)).subscribe(t=>{this.store.dispatch(en({nrSession:t.nrSession,idCestoCompra:t.idCestoCompra}))})}handleVendaSuccess(t){this.paymentRequestBlocked=!1;let e=U({},t.venda);e.ReservaResponse?.Reserva?.flPix?(this.store.dispatch(Zt()),this.loading=!1,this.reservaStorageService.salvarQrCode(e),this.router.navigate(["/checkout/Pix"],{state:{reserva:e}})):(this.store.dispatch(Zt()),this.loading=!1,this.checkoutService.setVenda(e),this.router.navigate(["/checkout/Confirmation"],{state:{venda:e}}))}handleVendaError(t){this.loading=!1,this.paymentRequestBlocked=!0,console.log("\u{1F534} Erro completo:",t),console.log("\u{1F534} err.error:",t.error),console.log("\u{1F534} err.error.error:",t.error?.error);let e=t.error?.error?.Message||t.error?.error||t.error?.Message||t.error?.message||t.error?.dsMensagem||t.message;console.log("\u{1F534}
24 apiErrorMessage extra\xEDda:",e),e&&(e=this.removerUrlsDaMensagem(e)),console.error("Erro ao processar venda:",e||t);let i="N\xE3o foi poss\xEDvel processar seu pagamento no momento.";e?i+=` Detalhes: ${e}`:i+=" Por favor, verifique os dados informados e tente novamente.",this.paymentErrorMessage=i}clearPaymentErrorState(){this.paymentErrorMessage="",this.paymentRequestBlocked=!1}onComunicacaoChange(){(this.receberComunicacoesEmail||this.receberComunicacoesWhatsApp)&&(this.mostrarErroComunicacao=!1)}removerUrlsDaMensagem(t){let e=/(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/gi;return t.replace(e,"").replace(/\s+/g," ").trim()}getAllFormaPagamentos(){this.checkoutService.getAllTipoFormaPagamentos().subscribe({next:t=>{this.ListFormaPagamentos=t;let e=t.find(i=>i.nmTipoFormaPagto===Qt.CARTAO);this.FormasCartao=e?e.FormasPagamentos:[],this.ListFormaPagamentos&&this.ListFormaPagamentos.length>0&&this.checkoutForm.patchValue({formaPagamento:this.ListFormaPagamentos[0].nmTipoFormaPagto})},error:t=>{this.loading=!1,console.error("Erro ao buscar formas de pagamento:",t)}})}salvarQrCodeLocal(t){try{if(!t?.ReservaResponse?.Reserva?.QrCodePix?.cdCopia||!t?.ReservaResponse?.Reserva?.QrCodePix?.dtExpiracao){console.warn("Dados insuficientes para salvar QR Code PIX");return}let e=t.idVenda;if(!e)throw new Error("ID da venda n\xE3o encontrado");let i=t.ReservaResponse.Reserva.QrCodePix.dtExpiracao,r;if(i.includes("Z")||i.includes("+")||i.match(/-\d{2}:\d{2}$/))r=new Date(i);else{let a=i.match(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/);if(a){let[,u,d,m,I,y,S]=a;r=new Date(parseInt(u),parseInt(d)-1,parseInt(m),parseInt(I),parseInt(y),parseInt(S))}else r=new Date(i)}if(isNaN(r.getTime()))throw new Error("Data de expira\xE7\xE3o do QR Code inv\xE1lida");let o={idVenda:e,Reserva:t,dtExpiracao:r.getTime(),dtCriacao:new Date().getTime()};localStorage.setItem("book",JSON.stringify(o)),console.log(`QR Code da venda ${e} salvo com sucesso at\xE9 ${r.toLocaleString("pt-BR")}`)}catch(e){throw console.error("Erro ao salvar QR Code PIX:",e),e instanceof Error?e.message:"N\xE3o foi poss\xEDvel salvar os dados do pagamento PIX"}}getReservaSalva(){try{let t=localStorage.getItem("book");if(!t)return null;let e=JSON.parse(t),i=new Date().getTime();return e.dtExpiracao&&i>e.dtExpiracao?(console.log("Reserva expirada, removendo..."),localStorage.removeItem("book"),null):e}catch(t){return console.error("Erro ao recuperar reserva:",t),localStorage.removeItem("book"),null}}limparReserva(){try{localStorage.removeItem("book"),console.log("Reserva removida do localStorage")}catch(t){console.error("Erro ao limpar reserva:",t)}}getNomeTipo(t){switch(t){case"ADT":return"ADULTO";case"MELHORIDADE":return"MELHORIDADE";case"CHD6A12":return"CHD6A12";case"CHD3A5":return"CHD3A5";case"COLO":return"COLO";default:return t}}gerarObjectRequestPayment(t,e,i){let o=(()=>{let w=this.checkoutForm.value.formaPagamento;if(typeof w=="string")return w.trim().toUpperCase();if(!w)return"";if(w.nmTipoFormaPagto)return String(w.nmTipoFormaPagto).trim().toUpperCase();if(w.nmFormaPagamento)return String(w.nmFormaPagamento).trim().toUpperCase();try{return String(w.toString()).trim().toUpperCase()}catch{return""}})()==="PIX",a=e[0]?.cupom?.cdCupom??null,u=e.flatMap(w=>w.passageiros&&w.passageiros.length>0?w.passageiros:w.product.Book?.passengers||[]),d=[{idPagamento:0,dtPagamento:this.formatLocalDateTime(new Date),vlPagamento:i,nmTitularCartao:this.checkoutForm.value.nmTitular||null,cpfTitularCartao:this.checkoutForm.value.cpfTitular||null,nrMesValidade:this.checkoutForm.value.validade?this.checkoutForm.value.validade.slice(0,2):null,nrAnoValidade:this.checkoutForm.value.validade?this.checkoutForm.value.validade.slice(-4):null,cvvCartao:this.checkoutForm.value.cvv||null,nrDocumento:null,nmBandeira:this.cardType||null,nrCartao:this.checkoutForm.value.nmCartao,nrInicioCartao:this.checkoutForm.value.nmCartao?this.extrairInicioEFimCartao(this.checkoutForm.value.nmCartao).nrInicioCartao:null,formaPagamento:this.checkoutForm.value.formaPagamento,parcelas:o?1:parseInt((this.checkoutForm.value.parcelamento||"1").replace("x",""),10)}],m=this.checkoutForm.value.validade?this.checkoutForm.value.validade.slice(0,2):null,I=this.checkoutForm.value.validade?this.checkoutForm.value.validade.slice(-4):null,y=this.checkoutForm.value.formaPagamento,S=this.ListFormaPagamentos.find(w=>w.nmTipoFormaPagto===y)?.idTipoFormaPagto,k=[{idPagamento:0,idVenda:0,idFormaPagamento:this.FormasCartao.find(w=>w.nmFormaPagamento===this.cardType)?.idFormaPagamento||0,dtPagamento:this.formatLocalDateTime(new Date),vlPagamento:i,nmTitularCartao:this.checkoutForm.value.nmTitular||null,nrDocumento:this.checkoutForm.value.cpfTitular||null,nrMesVencimento:m||null,nrAnoVencimento:I||null,cvvCartao:this.checkoutForm.value.cvv||null,nrCartao:this.checkoutForm.value.nmCartao?this.checkoutForm.value.nmCartao:null,nrInicioCartao:this.checkoutForm.value.nmCartao?this.extrairInicioEFimCartao(this.checkoutForm.value.nmCartao).nrInicioCartao:null,nrFinalCartao:this.checkoutForm.value.nmCartao?this.extrairInicioEFimCartao(this.checkoutForm.value.nmCartao).nrInicioCartao:null,FormasPagamento:{idTipoFormaPagto:S,idFormaPagamento:this.checkoutForm.value.idFormaPagamento,nmFormaPagamento:y,nmBandeira:this.cardType||null,tpFormaPagamento:o?"P":"C"},parcelas:o?1:parseInt((this.checkoutForm.value.parcelamento||"1").replace("x",""),10)}],g=new Date;g.setMinutes(g.getMinutes()+10);let A={dtNascimento:null,vlPagamento:i,dsBairro:this.checkoutForm.value.nmBairro,nmCidade:this.checkoutForm.value.nmCidade,nmEstado:this.checkoutForm.value.nmEstado,nmPais:this.checkoutForm.value.nmPais,dsEmail:t.dsEmail||null,nrCEP:this.checkoutForm.value.cep||null,
24nrPredial:this.checkoutForm.value.numero||null,nmCliente:this.checkoutForm.value.nmTitular||null,nrDocumento:this.checkoutForm.value.cpfTitular||null,dsLograduro:this.checkoutForm.value.endereco||null,dsComplemento:this.checkoutForm.value.complemento||null,nmBandeira:this.cardType||null,nmPortador:this.checkoutForm.value.nmTitular||null,nrCartao:this.checkoutForm.value.nmCartao||null,nrMesValidade:this.checkoutForm.value.validade?this.checkoutForm.value.validade.slice(0,2):null,nrAnoValidade:this.checkoutForm.value.validade?this.checkoutForm.value.validade.slice(-4):null,nrParcelas:this.checkoutForm.value.parcelas?parseInt(this.checkoutForm.value.parcelas.replace("x",""),10):1,nrCVV:this.checkoutForm.value.cvv||null};console.log("Cartao:",A);let $={idReserva:0,idVenda:0,idEmpresa:0,dtExpiracao:this.formatLocalDateTime(g),dt1Vencimento:this.formatLocalDateTime(g),vlCobranca:i,dsInfoAdicionais:"Cobran\xE7a Cart: ",nrParcelas:0,dtServicos:"0001-01-01T00:00:00",nmCliente:t.nmCliente||null,tpDoc:"CPF",nrCPFCNPJ:t.nrDocumento?t.nrDocumento:this.checkoutForm.value.cpfUsuarioPix||this.checkoutForm.value.cpfTitular,dsEmail:t.dsEmail||null,idPedidoOrdem:null,nrDocumento:t.nrDocumento?t.nrDocumento:this.checkoutForm.value.cpfUsuarioPix||this.checkoutForm.value.cpfTitular,nrCelular:this.getTelefoneCompleto(),dsCEP:null,nmLogradouro:null,numero:null,dsComplemento:this.checkoutForm.value.complemento,nmPais:this.checkoutForm.value.nmPais,nmBairro:this.checkoutForm.value.nmBairro,nmCidade:this.checkoutForm.value.nmCidade,nmEstado:this.checkoutForm.value.nmEstado,idCidade:0,idPais:0,Pais:null,quartos:[]},ue=u.map(w=>({idPax:w.idPax||0,nmPax:w.nome,vlUnitario:w.vlPax,nrQtde:null,vlVenda:w.vlPax,tpPax:w.tpParametro?.toUpperCase()})),te=[];console.log("=== DEBUG CHECKOUT - VendaItens ==="),this.store.select(ft).pipe(De(1)).subscribe(w=>{te=w.map(H=>{let Ve=(H.passageiros&&H.passageiros.length>0?H.passageiros:H.product.Book.passengers||[]).map((qe,W)=>({idPax:qe.idPax||1,nmPax:qe.nmPax,nome:qe.nome,idTipoPessoa:1,vlCusto:H.product.Book.vlVenda,nrQtde:1,vlCobrado:H.product.Book.vlVenda,vlVenda:H.product.Book.vlVenda,tpPax:qe.tpParametro||"ADULTO"})),Se={idVenda:0,idItem:H.product.idItem||H.product.Book?.idItemGestor||H.product.Book?.idItem||0,dtReserva:H.product.Book.date||null,hrReserva:H.product.Book.timeOfDeparture||null,TiposPessoas:Ve,qtPax:Ve.length,vlDesconto:H.desconto,vlItem:i,vlTotal:i};return console.log(`VendaItem - idItem: ${Se.idItem}, hrReserva: ${Se.hrReserva}`),Se}),console.log("VendaItens completo:",te),console.log("====================================")});let q=[];this.store.select(ft).pipe(De(1)).subscribe(w=>{q=[...w.filter(V=>!!V.product.Book?.timeOfDeparture||V.product.Book?.horariosItensCombo&&Object.keys(V.product.Book.horariosItensCombo).length>0).map(V=>{let Ve=V.passageiros&&V.passageiros.length>0?V.passageiros:V.product.Book?.passengers||[],mt=new Map;Ve.forEach(se=>{let Oe=se.tpParametro||"ADULTO";if(mt.has(Oe)){let be=mt.get(Oe);be.nrQtde+=1}else mt.set(Oe,{idPax:se.idPax||1,nmPax:null,nrQtde:1,vlUnitario:se.vlPax||null,vlVenda:se.vlPax||null,tpPax:Oe})});let Se=Array.from(mt.values()),qe=Ve.map((se,Oe)=>({idPax:se.idPax||1,dsNome:se.nome||null,dsTipoDocto:se.tipoDocumento||null,nrDocto:se.numeroDocumento||null,dtNascimento:se.dataNascimento||null,dsNacionalidade:null,tpPax:se.tpParametro||"ADULTO",dsDeficiencia:"",idProduto:null,nrPlaca:null,nmVeiculo:null,nmProdutoCardapio:null,tpSexo:null,flRefeicaoEspecial:!1})),W=V.product.Book?.timeOfDeparture,ae=V.product.Book?.timeOfArrival,Ke=V.product.PacoteTrem.find(se=>se.hrPartida===W&&se.tpSentido==="I"),di=V.product.PacoteTrem.find(se=>se.hrRetorno===ae&&se.tpSentido==="V"),Ye=Ke?.hrPartida||null,je=di?.hrRetorno||null,Tt=V.product.idItemSistema||V.product.Book?.idItem||V.product.ValoresData?.IdItem||0,ui=[],ht=V.product.Book?.horariosItensCombo;if(console.log("=== DEBUG CHECKOUT - buildServicos ==="),console.log("Item:",V.product.ValoresData?.dsItem),console.log("horariosItensCombo recebido:",ht),ht&&Object.keys(ht).length>0){console.log("\u{1F4E6} \xC9 um COMBO, montando ItensCombo..."),ui=Object.entries(ht).map(([Oe,be])=>{let pi=parseInt(Oe),mi={idItem:pi,hrServico:be.ida||null,hrRetorno:be.volta||null,fltrem:be.fltrem||!1};return console.log(`  Item ${pi}: hrServico=${mi.hrServico}, hrRetorno=${mi.hrRetorno}, flTrem=${be.fltrem}`),mi}),console.log("ItensCombo montado:",ui),console.log("\u{1F50D} Procurando item TREM..."),console.log("ItensCombo dispon\xEDveis:",V.product?.ItensCombo);let se=Object.entries(ht).find(([Oe,be])=>{let pi=be.fltrem===!0||be.fltrem==="true"||be.fltrem===1,mi=V.product?.ItensCombo?.find(hc=>hc.IdItem===parseInt(Oe)),kn=(mi?.dsItem||"").toLowerCase(),Gr=kn.includes("sa\xEDda de trem")||kn.includes("saida de trem")||kn.includes("trem pampa")||kn.includes("trem do pampa");return console.log(`  Verificando item ${Oe}:`,{dsItem:mi?.dsItem,temFlagTrem:pi,isTremPorNome:Gr,resultado:pi||Gr}),pi||Gr});if(se){let[Oe,be]=se;Tt=parseInt(Oe),Ye=be.ida||null,je=be.volta||null,console.log("\u{1F682} \u2713 ITEM COM TREM ENCONTRADO - USANDO HOR\xC1RIO DO TREM:",{idItem:Tt,hrPartida:Ye,hrRetorno:je,fltrem:be.fltrem})}else{let Oe=Object.values(ht)[0],be=Number(Object.keys(ht)[0]||0);Tt=be>0?be:Tt,Ye=Oe?.ida||null,je=Oe?.volta||null,console.log("\u26A0 Nenhum item com fltrem=true. Usando primeiro hor\xE1rio dispon\xEDvel:",{idItem:Tt,hrPartida:Ye,hrRetorno:je})}console.log("==========================================")}else ui=[{idItem:V.product.idItemSistema||V.product.Book?.idItem||V.product.ValoresData?.IdItem||0,hrServico:Ye,hrRetorno:je,fltrem:!1}];let jr=V.product.tarifarioData?.idTipoTabela||null,Pn={id:0,idItem:Tt,nmItem:V.product.ValoresData.dsItem||null,dsTipo:V.product.ValoresData.dsTipo||null,nmCategoria:V.product.PacoteTrem.nmCategoria||null,idCidade:V.product.PacoteTrem.idCidade||0,dtServico:V.product.Book.date||null,hrServico:Ye,hrRetorno:je,vlDesconto:V.desconto||0,vlTotal:V.prec
24oComDesconto,dtOut:null,Pax:Se,NomesPax:qe,ItensCombo:ui,dsObservacoes:null,dsInformacoes:null,dsRoteiro:null,nrVoo:"",hrVoo:null,dsLocalEmbarque:null,dsLocalDesembarque:"",idCategoriaVeiculo:V.product.idCategoriaVeiculo||V.product.idCategoria||pe.CATEGORIAVEICULOID||1,idLocalTransfer:V.product.Book?.localEmbarqueId||0,idLocalTransferDesembarque:0,idTipoTabela:jr};return console.log("Servi\xE7o criado:",{servico:Pn}),Pn})]});let me=[];this.store.select(ft).pipe(De(1)).subscribe(w=>{me=w.flatMap(H=>H.passageiros&&H.passageiros.length>0?H.passageiros:H.product.Book?.passengers||[])});let Re=me.map(w=>({dsNome:w.nome||null,dsTipoDocto:w.tipoDocumento||null,nrDocto:w.numeroDocumento||null,dtNascimento:w.dataNascimento||null,dsNacionalidade:null,idPax:w.idPax||0,tpPax:w.tpParametro||"ADULTO",dsDeficiencia:"",idProduto:null,nrPlaca:null,nmVeiculo:null,nmProdutoCardapio:null,tpSexo:null,flRefeicaoEspecial:!1})),fe=new Map;me.forEach(w=>{let H=w.tpParametro||w.tipo||"ADULTO";if(fe.has(H)){let V=fe.get(H);V.nrQtde+=1,V.vlVenda=(V.vlVenda||0)+(w.vlPax||0)}else fe.set(H,{idPax:w.idPax,nmPax:w.nome,vlUnitario:w.vlPax,nrQtde:1,vlVenda:w.vlPax||null,tpPax:H})});let $e=Array.from(fe.values()),Ae=Zn(t,e,this.checkoutForm.value,i,this.checkoutForm.value.cpfUsuarioPix,this.checkoutForm.value.cpfTitular);o?Ae.flPix=!0:Ae.flProcessarCartao=!0;let We=U(ie(U({},Ae),{cupom:a,Servicos:q,Pagamento:d,NomesPax:Re,Pax:$e}),Ae.flPix?{PixInfo:$}:{Cartao:A}),B=e.reduce((w,H)=>w+(H.desconto||0),0);return{idVenda:0,dtVenda:this.formatLocalDateTime(new Date),vlTotal:i,vlDesconto:B,idCliente:t.idCliente,nmTitular:t.nmCliente,Cliente:{idCliente:t.idCliente,nrDocumento:t.nrDocumento?t.nrDocumento:this.checkoutForm.value.cpfUsuarioPix||this.checkoutForm.value.cpfTitular,nmCliente:t.nmCliente,dsEmail:t.dsEmail,nrTelCelular:this.getTelefoneCompleto(),dsComplemento:this.checkoutForm.value.complemento||null,nrCEP:this.checkoutForm.value.cep||null,nrRua:this.checkoutForm.value.endereco||null},VendaItens:te,TiposPessoas:ue,Pagamentos:k,cupom:a,ReservaRequest:We}}extrairInicioEFimCartao(t){let e=t.replace(/\D/g,""),i=e.substring(0,4)||"",r=e.slice(-4)||"";return{nrInicioCartao:i,nrFinalCartao:r}}gerarParcelas(t){this.parcelas=[];let i=Math.floor(t/50),r=Math.min(this.maxParcelas,i),o=r>=1?r:1;for(let a=1;a<=o;a++){let u=(t/a).toFixed(2);this.parcelas.push({value:`${a}x`,label:`${a} X ${u.replace(".",",")}`})}}buscarCep(){let t=this.checkoutForm.get("cep"),e=t?.value;if(!e||e.length!==8){this.clearAddressFields();return}this.isCepLoading=!0;let i=t.errors||{};delete i.cepNaoEncontrado,delete i.cepApiError,t.setErrors(Object.keys(i).length?i:null),this.utilService.getByCEP(e).pipe(Zi(()=>this.isCepLoading=!1)).subscribe({next:r=>{r&&!r.erro?(console.log(r),this.checkoutForm.patchValue({endereco:r.logradouro,nmBairro:r.bairro,nmCidade:r.localidade,nmUf:r.uf,nmEstado:r.estado,nmPais:"Brasil"}),this.checkoutForm.get("endereco")?.markAsTouched(),this.checkoutForm.get("nmBairro")?.markAsTouched(),this.checkoutForm.get("nmCidade")?.markAsTouched(),this.checkoutForm.get("nmUf")?.markAsTouched(),this.checkoutForm.get("nmEstado")?.markAsTouched(),this.checkoutForm.get("nmPais")?.markAsTouched()):(this.clearAddressFields(),t.setErrors({cepNaoEncontrado:!0}))},error:r=>{console.error("Erro ao buscar CEP:",r),this.clearAddressFields(),t.setErrors({cepApiError:!0})}})}clearAddressFields(){this.checkoutForm.patchValue({endereco:"",nmBairro:"",nmCidade:"",nmUf:"",nmEstado:"",nmPais:""})}buscarZipCode(){let t=this.checkoutForm.get("cep"),e=this.checkoutForm.get("paisSelecionado"),i=t?.value,r=e?.value||"BR";if(!i||i.length<3){this.clearAddressFields();return}if(r==="BR"){this.buscarCep();return}if(!this.zipcodeService.isCountrySupported(r)){console.log("Pa\xEDs n\xE3o suportado para busca autom\xE1tica:",r);return}this.isCepLoading=!0;let o=t?.errors||{};delete o.cepNaoEncontrado,delete o.cepApiError,t?.setErrors(Object.keys(o).length?o:null),this.zipcodeService.searchByZipCode(r,i).pipe(Zi(()=>this.isCepLoading=!1)).subscribe({next:a=>{a.success&&a.city?(console.log("ZIP Code encontrado:",a),this.checkoutForm.patchValue({nmCidade:a.city,nmEstado:a.state||"",nmUf:a.stateAbbr||"",nmPais:a.country||this.getCountryName(r)}),this.checkoutForm.get("nmCidade")?.markAsTouched(),this.checkoutForm.get("nmEstado")?.markAsTouched(),this.checkoutForm.get("nmUf")?.markAsTouched(),this.checkoutForm.get("nmPais")?.markAsTouched(),this.checkoutForm.patchValue({endereco:"",nmBairro:""}
24)):(console.warn("ZIP Code n\xE3o encontrado:",a.error),t?.setErrors({cepNaoEncontrado:!0}))},error:a=>{console.error("Erro ao buscar ZIP Code:",a),t?.setErrors({cepApiError:!0})}})}buscarEndereco(){(this.checkoutForm.get("paisSelecionado")?.value||"BR")==="BR"?this.buscarCep():this.buscarZipCode()}getCountryName(t){return this.countries.find(i=>i.code===t)?.name||t}checkBandeira(){let t=this.cardValidationService.identifyCardBrand(this.checkoutForm.get("nmCartao")?.value||"");if(!t){this.bandeiraCartao="",this.cardType="",this.checkoutForm.get("nmBandeira")?.setValue("");return}this.bandeiraCartao=t.image,this.cardType=t.brand,this.cvvMask=t.cvvMask,this.checkoutForm.get("nmBandeira")?.setValue(t.brand);let e=this.checkoutForm.get("cvv"),i=t.brand==="American Express"?4:3;e?.setValidators([F.required,F.maxLength(i)]),e?.updateValueAndValidity()}onCepBlur(){let t=this.checkoutForm.get("cep")?.value;t&&t.length===8&&this.buscarCep()}onCepInput(t){t.target.value.replace(/\D/g,"").length===8&&this.buscarCep()}formatLocalDateTime(t){let e=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),u=String(t.getSeconds()).padStart(2,"0");return`${e}-${i}-${r}T${o}:${a}:${u}`}static{this.\u0275fac=function(e){return new(e||n)(O(Ie),O(ki),O(Le),O(Ft),O(Qn),O(ze),O(Ei),O(Jn),O(er),O(Li),O(Nt),O(tr))}}static{this.\u0275cmp=ne({type:n,selectors:[["app-checkout"]],inputs:{emailPasswordDefault:"emailPasswordDefault",credentialsDontMatch:"credentialsDontMatch",changeAccount:"changeAccount"},standalone:!1,decls:89,vars:64,consts:[["emptyCart",""],[1,"flex","flex-col","lg:flex-row","pt-[16px]","gap-8","pb-[20px]","justify-center","margin-auto","m-5"],[1,"flex","flex-col","self-start","lg:sticky","lg:top-6","w-full","bg-white","rounded-xl","shadow-lg","border","border-gray-100","overflow-hidden","transition-all","duration-300"],[1,"px-6","py-5","bg-[#FAF9F6]","border-b","border-gray-100"],[1,"text-xl","font-bold","text-[--primary-background-text-color]","tracking-tight"],[1,"text-xs","text-gray-400","font-medium","uppercase","tracking-wider","mt-1"],[1,"flex","flex-col","p-6","space-y-6"],[1,"w-full"],[4,"ngIf"],[1,"pt-4","border-t","border-gray-100"],[1,"text-xs","font-bold","text-gray-400","uppercase","tracking-wider","mb-2"],[1,"discount-wrapper"],[1,"bg-[#FDFBF7]","p-6","border-t","border-[#E5E5E5]"],[1,"flex","justify-between","items-end","w-full"],[1,"flex","flex-col"],[1,"text-sm","text-gray-500","font-medium","uppercase","tracking-wide","mb-1"],[1,"text-[10px]","text-green-600","font-semibold","flex","items-center","gap-1"],["fill","none","stroke","currentColor","viewBox","0 0 24 24",1,"w-3","h-3"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"],[1,"text-right"],[1,"text-2xl","font-bold","text-[--primary-background-text-color]","leading-none"],[1,"flex","flex-col","w-full","bg-[--secondary-background-bg-color]","text-[--secondary-background-text-color]"],[1,"min-h-[47px]","flex","flex-row","items-end","lg:items-start","lg:max-h-[24px]","lg:min-h-[20px]","mb-2"],[1,"text-[--secondary","-background-text-color]","font-semibold","text-base"],[3,"user","triggerValidation"],[3,"formGroup"],["class","w-full mb-6 animate-fade-in",4,"ngIf"],[1,"w-full","flex","flex-col","gap-[16px]"],[1,"h-[47px]","flex","flex-row","items-end"],[1,"font-semibold","text-base","text-[--primary-background-text-color]"],[1,"flex","h-[50px]","justify-between","gap-[10px]"],["class","bg-white flex flex-1 justify-center items-center gap-[5px] rounded-[34px] cursor-pointer",3,"ngClass",4,"ngFor","ngForOf"],["class","flex flex-col gap-[10px] max-w-[100%]",4,"ngIf"],["class","flex flex-col gap-[10px] max-w-[100%] mt-4",4,"ngIf"],[1,"w-full","flex","flex-col","gap-[10px]","mt-[20px]"],["class","gap-[10px] flex flex-col",4,"ngIf"],[1,"flex","flex-col","gap-[10px]"],[1,"text-[--secondary-background-text-color]","font-medium","text-sm"],[1,"flex","gap-[10px]"],[1,"flex","flex-1","items-center","justify-center","gap-2","px-4","py-3","rounded-full","border","bg-white","text-[--secondary-txt-color]","cursor-pointer","transition-all","duration-200","outline-none"],["type","checkbox",1,"h-[18px]","w-[18px]","rounded","border","border-[--secondary-black-color]","appearance-none","checked:bg-[--primary-txt-color]","text-[--primary-txt-color]","checked:border-[--secondary-background-bg-color]","cursor-pointer","transition-colors","duration-200",3,"ngModelChange","ngModel","ngModelOptions"],[1,"text-sm","font-medium"],[1,"flex","flex-1","items-center","justify-center","gap-2","px-4","py-3","rounded-full","border","bg-white","text-[--secondary-txt-color]","cursor-pointer","transition-all","duration-200"],["type","checkbox",1,"h-[18px]","w-[18px]","rounded","border","border-[--secondary-black-color]","appearance-none","checked:bg-[--primary-txt-color]","text-[--secondary-text-color]","checked:border-[--secondary-background-bg-color]","cursor-pointer","transition-colors","duration-200",3,"ngModelChange","ngModel","ngModelOptions"],["class","text-xs text-red-600 ml-1",4,"ngIf"],[1,"flex","flex-col","gap-[10px]","mt-6"],[1,"flex","items-start","gap-3","p-4","bg-gray-50","rounded-lg","border","border-gray-200"],["type","checkbox","id","aceitePoliticas",1,"h-[18px]","w-[18px]","mt-0.5","rounded","border","border-gray-400","appearance-none","checked:bg-[--primary-txt-color]","cursor-pointer","transition-colors","duration-200","flex-shrink-0",3,"ngModelChange","ngModel","ngModelOptions"],["for","aceitePoliticas",1,"text-sm","text-gray-700","cursor-pointer","leading-relaxed"],["href","#/pagina/1/politica-de-privacidade","target","_blank",1,"text-[--primary-txt-color]","underline","hover:brightness-110"],["href","#/pagina/3/politica-de-cancelamento","target","_blank",1,"text-[--primary-txt-color]","underline","hover:brightness-110"],["type","button",1,"w-full","flex","justify-center","items-center","min-h-[45px]","bg-[--primary-btn-bg-color]","text-[--primary-btn-text-color]","hover:brightness-125","rounded-[100px]","mt-3",3,"click","disabled"],[4,"ngIf","ngIfElse"],[1,"flex","flex-col","divide-y","divide-dashed","divide-gray-200"],["class","py-4 first:pt-0 last:pb-0",4,"ngFor","ngForOf"],[1,"py-4","first:pt-0","last:pb-0"],[3,"item"],[1,"flex","flex-col","items-center","justify-center","py-8","text-center","bg-gray-50","rounded-lg","border","border-gray-100","border-dashed"],["fill","none","stroke","currentColor","viewBox","0 0 24 24",1,"w-8","h-8","text-gray-300","mb-2"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"],[1,"text-sm","font-medium","text-gray-500"],[1,"w-full","mb-6","animate-fade-in"],["role","alert",1,"bg-amber-50","border-l-4","border-amber-500","p-4","rounded-r-lg","shadow-sm","relative"],[1,"flex","items-start"],[1,"flex-shrink-0"],["fill","none","viewBox","0 0 24 24","stroke","currentColor",1,"h-5","w-5","text-amber-500"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"],[1,"ml-3","flex-1"],[1,"text-sm","font-semibold","text-amber-800","mb-1"],[1,"text-sm","text-amber-700","leading-relaxed"],["type","button","aria-label","Fechar",1,"flex-shrink-0","ml-3","text-amber-500","hover:text-amber-700","transition-colors",3,"click"],["fill","none","viewBox","0 0 24 24","stroke","currentColor",1,"h-5","w-5"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M6 18L18 6M6 6l12 12"],[1,"bg-white","flex","flex-1","justify-center","items-center","gap-[5px]","rounded-[34px]","cursor-pointer",3,"ngClass"],["type","radio","name","formaPagamento","formControlName","formaPagamento",1,"appearance-none","h-[16px]","w-[16px]","rounded-full","border","border-gray-400","checked:bg-[--primary-background-text-color]","checked:text-[--secondary-text-color]","checked:border-[--secondary-background-bg-color]","cursor-pointer","outline-none",3,"value"],[1,"text-[--primary-black-color]"],[1,"flex","flex-col","gap-[10px]","max-w-[100%]"],["class","text-red-500 text-sm mt-1",4,"ngIf"],["for","parcelamento",1,"text-[--secondary-background-text-color]","font-medium"],["id","parcelamento","name","parcelamento","formControlName","parcelamento",1,"text-[--secondary-black-color]","h-[50px]","rounded-[22px]","px-[16px]","outline-none"],["disabled","","selected","",3,"value"],["class","text-[--secondary-black-color] text-sm font-normal outline-none",3,"value",4,"ngFor","ngForOf"],[1,"text-[--secondary-background-text-color]","font-medium"],[1,"flex","items-center","h-[50px]"],[1,"relative","flex","flex-col","w-full","h-[50px]"],["alt","Bandeira do cart\xE3o","class","h-8 w-auto absolute right-3 top-1/2 -translate-y-1/2 z-10",3,"src",4,"ngIf"],["type","text","name","nmCartao","id","nmCartao","formControlName","nmCartao","mask","0000 0000 0000 0000","maxlength","19","autocomplete","cc-number","inputmode","numeric",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","pl-[17px]","rounded-[25px]","border","outline-none","flex-1",3,"blur","placeholder","dropSpecialCharacters","ngClass"],["type","text","id","nmTitular","name","nmTitular","formControlName","nmTitular",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","outline-none",3,"ngClass","placeholder"],[1,"flex","w-full","gap-2"],[1,"flex-1","flex","items-center","h-[50px]","px-[17px]","rounded-[24px]","border","border-gray-300","bg-white"],[1,"flex","gap-4","w-full"],[1,"flex","items-center","cursor-pointer"],["type","radio","name","tipoDocumento","value","CPF","formControlName","tipoDocumento",1,"mr-2","w-4","h-4","text-[--primary-btn-bg-color]","focus:ring-[--primary-btn-bg-color]"],[1,"text-[--primary-black-color]","text-sm"],["type","radio","name","tipoDocumento","value","PASSAPORTE","formControlName","tipoDocumento",1,"mr-2","w-4","h-4","text-[--primary-btn-bg-color]","focus:ring-[--primary-btn-bg-color]"],[1,"flex-1","flex-col"],["type","text","id","documentoTitular","name","documentoTitular","formControlName","documentoTitular",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder","mask","dropSpecialCharacters"],[1,"flex-1"],["type","text","id","validade","maxlength","7","formControlName","validade","mask","00/0000",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"placeholder","ngClass"],["type","text","id","cvv","formControlName","cvv","placeholder","CCV",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","mask","dropSpecialCharacters"],[1,"flex","flex-row","justify-between","items-center","gap-[16px]","md:w-1/2","md:self-center","lg:w-full"],["type","checkbox","name","","id","",1,"appearance-none","min-h-[16px]","min-w-[16px]","rounded-full","border","border-gray-400","bg-white","outline-none","checked:bg-[--primary-txt-color]","checked:border-[--primary-text-color]","cursor-pointer"],[1,"flex-1","text-[--secondary-background-text-color]","text-sm","font-normal"],[1,"text-red-500","text-sm","mt-1"],[1,"text-[--secondary-black-color]","text-sm","font-normal","outline-none",3,"value"],["alt","Bandeira do cart\xE3o",1,"h-8","w-auto","absolute","right-3","to
24p-1/2","-translate-y-1/2","z-10",3,"src"],[1,"flex","flex-col","gap-[10px]","max-w-[100%]","mt-4"],[1,"flex","flex-col","md:flex-row","gap-[10px]"],["class","flex-1 flex-col",4,"ngIf"],["type","text","id","cpfUsuarioPix","name","cpfUsuarioPix","mask","000.000.000-00","formControlName","cpfUsuarioPix",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder","dropSpecialCharacters"],["type","text","id","telefonePix","name","telefonePix","mask","(00) 0000-0000||(00) 0 0000-0000","formControlName","telefone",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder","dropSpecialCharacters"],[1,"gap-[10px]","flex","flex-col"],[1,"min-h-[30px]","text-[--secondary-background-text-color]","font-semibold"],["class","flex w-full gap-[5px]",4,"ngIf"],["class","flex flex-col gap-[10px]",4,"ngIf"],[1,"flex","w-full","gap-[5px]"],["id","paisSelecionado","name","paisSelecionado","formControlName","paisSelecionado",1,"text-[--primary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"flex-1","relative"],["type","text","id","cep","name","cep","autocomplete","postal-code","formControlName","cep",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"maskFilled","blur","input","ngClass","placeholder","mask","dropSpecialCharacters"],["class","absolute right-4 top-1/2 -translate-y-1/2 animate-spin","style","top: 50%; right: 1rem; position: absolute; transform: translateY(-50%);",4,"ngIf"],["type","text","id","nmCidade","name","nmCidade","autocomplete","address-level2","formControlName","nmCidade",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder"],["type","text","id","nmEstado","name","nmEstado","autocomplete","address-level1","formControlName","nmEstado",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder"],["type","text","id","nmUf","name","nmUf","autocomplete","off","placeholder","UF","formControlName","nmUf",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass"],["type","text","id","nmPais","name","nmPais","autocomplete","country-name","formControlName","nmPais",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder"],["type","text","id","endereco","name","endereco","autocomplete","address-line1","formControlName","endereco",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","outline-none",3,"ngClass","placeholder"],[1,"flex","flex-col","gap-[10px]","w-full"],[1,"flex","gap-[10px]","w-full"],["type","text","id","nmBairro","name","nmBairro","autocomplete","off","formControlName","nmBairro",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder"],["type","text","id","numero","name","numero","autocomplete","address-line2","maxlength","10","formControlName","numero",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder"],["type","text","id","telefone","name","telefone","mask","(00) 0000-0000||(00) 0 0000-0000","formControlName","telefone",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder","dropSpecialCharacters"],["type","text","id","complemento","name","complemento","autocomplete","address-line3","formControlName","complemento",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass","placeholder"],[1,"absolute","right-4","top-1/2","-translate-y-1/2","animate-spin",2,"to
24p","50%","right","1rem","position","absolute","transform","translateY(-50%)"],["xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24",1,"w-5","h-5","text-[--primary-background-bg-color]"],["cx","12","cy","12","r","10","stroke","currentColor","stroke-width","4",1,"opacity-25"],["fill","currentColor","d","M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",1,"opacity-75"],[2,"width","120px"],["type","text","id","ddiTelefone","name","ddiTelefone","formControlName","ddiTelefone","readonly","","placeholder","DDI",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none","bg-gray-100","border","border-gray-300"],["type","tel","id","telefoneInternacional","name","telefoneInternacional","placeholder","Telefone","formControlName","telefoneInternacional","maxlength","20",1,"text-[--primary-black-color]","placeholder-[--secondary-black-color]","h-[50px]","pl-[17px]","rounded-[24px]","w-full","outline-none",3,"ngClass"],[1,"text-xs","text-red-600","ml-1"]],template:function(e,i){if(e&1){let r=z();s(0,"section")(1,"div",1)(2,"div",2)(3,"div",3)(4,"h3",4),p(5),v(6,"translate"),c(),s(7,"p",5),p(8),v(9,"translate"),c()(),s(10,"div",6)(11,"div",7),x(12,ng,2,2,"div",8),v(13,"async"),x(14,rg,6,3,"ng-template",null,0,ve),c(),s(16,"div",9)(17,"p",10),p(18),v(19,"translate"),c(),s(20,"div",11),T(21,"discount-coupon"),c()()(),s(22,"div",12)(23,"div",13)(24,"div",14)(25,"p",15),p(26),v(27,"translate"),c(),s(28,"p",16),le(),s(29,"svg",17),T(30,"path",18),c(),p(31),v(32,"translate"),c()(),Ne(),s(33,"div",19)(34,"p",20),p(35),v(36,"async"),v(37,"currency"),c()()()()(),s(38,"div",21)(39,"div",22)(40,"p",23),p(41),v(42,"translate"),c()(),T(43,"app-credentials",24),v(44,"async"),s(45,"form",25),x(46,og,14,1,"div",26),s(47,"div",27)(48,"div",28)(49,"p",29),p(50),v(51,"translate"),c()(),s(52,"div",30),x(53,ag,5,8,"label",31),c(),x(54,Cg,56,64,"div",32),c(),x(55,Pg,4,2,"div",33),s(56,"div",34),x(57,s0,7,6,"div",35),s(58,"div",36)(59,"p",37),p(60),v(61,"translate"),c(),s(62,"div",38)(63,"label",39)(64,"input",40),st("ngModelChange",function(a){return R(r),at(i.receberComunicacoesEmail,a)||(i.receberComunicacoesEmail=a),D(a)}),M("ngModelChange",function(){return R(r),D(i.onComunicacaoChange())}),c(),s(65,"span",41)(66,"strong"),p(67,"E-mail"),c()()(),s(68,"label",42)(69,"input",43),st("ngModelChange",function(a){return R(r),at(i.receberComunicacoesWhatsApp,a)||(i.receberComunicacoesWhatsApp=a),D(a)}),M("ngModelChange",function(){return R(r),D(i.onComunicacaoChange())}),c(),s(70,"span",41)(71,"strong"),p(72,"WhatsApp"),c()()()(),x(73,l0,3,3,"p",44),c(),s(74,"div",45)(75,"div",46)(76,"input",47),st("ngModelChange",function(a){return R(r),at(i.aceitePoliticas,a)||(i.aceitePoliticas=a),D(a)}),c(),s(77,"label",48),p(78," Li e concordo com a "),s(79,"a",49),p(80," Pol\xEDtica de Privacidade (LGPD) "),c(),p(81," e com a "),s(82,"a",50),p(83," Pol\xEDtica Comercial de Cancelamento "),c(),p(84,". "),c()(),x(85,c0,3,3,"p",44),c()(),s(86,"button",51),M("click",function(){return R(r),D(i.enviarFormulario())}),p(87),v(88,"translate"),c()()()()()}if(e&2){let r,o,a;l(5),E(" ",_(6,34,"CHECKOUT.FINALIZAR-COMPRA")," "),l(3),E(" ",_(9,36,"CHECKOUT.RESUMO-DO-PEDIDO")," "),l(4),h("ngIf",_(13,38,i.cartItems$)),l(6),P(_(19,40,"CHECKOUT.POSSUI-DESCONTO")),l(8),P(_(27,42,"CHECKOUT.TOTAL-A-PAGAR")),l(5),E(" ",_(32,44,"CHECKOUT.COMPRA-SEGURO")," "),l(4),E(" ",re(37,48,_(36,46,i.cartTotal$),"BRL")," "),l(6),P(_(42,51,"CHECKOUT.FINALIZE-SUA-COMPRA")),l(2),h("user",_(44,53,i.user$))("triggerValidation",i.triggerLoginValidation),l(2),h("formGroup",i.checkoutForm),l(),h("ngIf",i.paymentErrorMessage),l(4),P(_(51,55,"CHECKOUT.DETALHES-DO-PAGAMENTO")),l(3),h("ngForOf",i.ListFormaPagamentos),l(),h("ngIf",((r=(r=i.checkoutForm.get("formaPagamento"))==null?null:r.value)!==null&&r!==void 0?r:"").toUpperCase()==="CART\xC3O"),l(),h("ngIf",((o=(o=i.checkoutForm.get("formaPagamento"))==null?null:o.value)!==null&&o!==void 0?o:"").toUpperCase()==="PIX"),l(2),h("ngIf",((a=(a=i.checkoutForm.get("formaPagamento"))==null?null:a.value)!==null&&a!==void 0?a:"").toUpperCase()!=="PIX"),l(3),P(_(61,57,"CHECKOUT.RECEBER-COMUNICACOES")),l(4),ot("ngModel",i.receberComunicacoesEmail),h("ngModelOptions",Ci(61,ka)),l(5),ot("ngModel",i.receberComunicacoesWhatsApp),h("ngModelOptions",Ci(62,ka)),l(4),h("ngIf",i.mostrarErroComunicacao),l(3),ot("ngModel",i.aceitePoliticas),h("ngModelOptions",Ci(63,ka)),l(9),h("ngIf",i.mostrarErroAceite),l(),ge("cursor-pointer",!(i.loading||i.paymentRequestBlocked))("cursor-not-allowed",i.loading||i.paymentRequestBlocked)("opacity-50",i.loading||i.paymentRequestBlocked),h("disabled",i.loading||i.paymentRequestBlocked),l(),E(" ",_(88,59,"CHECKOUT.EFETUAR-PAGAMENTO")," ")}},dependencies:[lt,Ce,oe,yi,Hn,$n,Ot,ts,Bn,ns,wt,Si,as,Ti,Pi,Un,qi,pc,Lr,Mi,Mn,kt,Pe],styles:["select[_ngcontent-%COMP%]{background:#fff;padding:12px 18px;font-size:1rem;transition:border .2s,box-shadow .2s;box-shadow:0 2px 10px #2c3e5014;outline:none;appearance:none;min-height:48px}select[_ngcontent-%COMP%]:focus{border:2px solid grey}"]})}};function d0(n,t){if(n&1&&(s(0,"div",37)(1,"p",38),p(2),v(3,"translate"),c(),s(4,"p",39),p(5),c()()),n&2){let e=t.$implicit;l(2),E(" ",_(3,2,e.label)," "),l(3),E(" ",e.value," ")}}function u0(n,t){if(n&1&&(s(0,"div",35),x(1,d0,6,4,"div",36),c()),n&2){let e=C();l(),h("ngForOf",e.reservationSummary)("ngForTrackBy",e.trackBySummary)}}function p0(n,t){if(n&1&&(s(0,"div",45)(1,"p",38),p(2),v(3,"translate"),c(),s(4,"p",39),p(5),c()()),n&2){let e=t.$implicit;l(2),E(" ",_(3,2,e.label)," "),l(3),E(" ",e.value," ")}}function m0(n,t){if(n&1&&(s(0,"div",27)(1,"div",40)(2,"h2",41),p(3),v(4,"translate"),c(),s(5,"p",42),p(6),v(7,"translate"),v(8,"translate"),c()(),s(9,"div",43),x(10,p0,6,4,"div",44),c()()),n&2){let e=C();l(3),E(" ",_(4,4,"CHECKOUT-CONFIRMATION.DETALHES-DO-PAGAMENTO")," "),l(3),E(" ",e.isCardPayment?_(7,6,"CHECKOUT-CONFIRMATION.PAGAMENTO-CARTAO"):_(8,8,"CHECKOUT.FORMAS-PAGAMENTO.PIX")," "),l(4),h("ngForOf",e.paymentSummary)("ngForTrackBy",e.trackBySummary)}}function h0(n,t){if(n&1&&(s(0,"div",53)(1,"p",38),p(2),v(3,"translate"),c(),s(4,"p",51),p(
245),c()()),n&2){let e=C().$implicit;l(2),E(" ",_(3,2,"CHECKOUT-CONFIRMATION.OBSERVACOES")," "),l(3),P(e.observations)}}function f0(n,t){if(n&1&&(s(0,"div",49)(1,"div",50)(2,"div")(3,"p",38),p(4),v(5,"translate"),c(),s(6,"p",51),p(7),v(8,"translate"),c()(),s(9,"div")(10,"p",38),p(11),v(12,"translate"),c(),s(13,"p",51),p(14),v(15,"translate"),c()(),s(16,"div")(17,"p",38),p(18),v(19,"translate"),c(),s(20,"p",51),p(21),c()(),s(22,"div")(23,"p",38),p(24),v(25,"translate"),c(),s(26,"p",51),p(27),c()()(),x(28,h0,6,4,"div",52),c()),n&2){let e=t.$implicit;l(4),E(" ",_(5,9,"ITEM-CHECKOUT.DATA")," "),l(3),P(e.date||_(8,11,"CHECKOUT-CONFIRMATION.NAO-INFORMADO")),l(4),E(" ",_(12,13,"ITEM-CHECKOUT.HORARIO")," "),l(3),P(e.time||_(15,15,"CHECKOUT-CONFIRMATION.NAO-INFORMADO")),l(4),E(" ",_(19,17,"CHECKOUT-CONFIRMATION.PASSAGEIROS")," "),l(3),P(e.passengerCount),l(3),E(" ",_(25,19,"CHECKOUT-CONFIRMATION.VALOR-PAGO")," "),l(3),P(e.total),l(),h("ngIf",e.observations)}}function g0(n,t){if(n&1&&(s(0,"div",27)(1,"h2",46),p(2),v(3,"translate"),c(),s(4,"div",47),x(5,f0,29,21,"div",48),c()()),n&2){let e=C();l(2),E(" ",_(3,3,"CHECKOUT-CONFIRMATION.SERVICOS-RESERVADOS")," "),l(3),h("ngForOf",e.serviceSummary)("ngForTrackBy",e.trackByService)}}function v0(n,t){if(n&1&&(s(0,"div",45)(1,"p",38),p(2),v(3,"translate"),c(),s(4,"p",39),p(5),c()()),n&2){let e=t.$implicit;l(2),E(" ",_(3,2,e.label)," "),l(3),E(" ",e.value," ")}}function _0(n,t){if(n&1&&(s(0,"div",27)(1,"h2",46),p(2),v(3,"translate"),c(),s(4,"div",54),x(5,v0,6,4,"div",44),c()()),n&2){let e=C();l(2),E(" ",_(3,3,"CHECKOUT-CONFIRMATION.CONTATO-DO-TITULAR")," "),l(3),h("ngForOf",e.contactSummary)("ngForTrackBy",e.trackBySummary)}}function C0(n,t){if(n&1&&(s(0,"div",59)(1,"p",38),p(2),c(),s(3,"p",60),p(4),c()()),n&2){let e=t.$implicit;l(2),E(" ",e.label," "),l(2),P(e.quantity)}}function I0(n,t){if(n&1&&(s(0,"div",57),x(1,C0,5,2,"div",58),c()),n&2){let e=C(2);l(),h("ngForOf",e.passengerSummary)("ngForTrackBy",e.trackByPassengerSummary)}}function b0(n,t){if(n&1&&(s(0,"p"),p(1),c()),n&2){let e=C().$implicit;l(),P(e.birthDate)}}function x0(n,t){if(n&1&&(s(0,"p"),p(1),c()),n&2){let e=C().$implicit;l(),P(e.nationality)}}function E0(n,t){if(n&1&&(s(0,"div",45)(1,"p",61),p(2),c(),s(3,"div",62)(4,"p"),p(5),c(),x(6,b0,2,1,"p",63)(7,x0,2,1,"p",63),c()()),n&2){let e=t.$implicit;l(2),P(e.name),l(3),P(e.document),l(),h("ngIf",e.birthDate),l(),h("ngIf",e.nationality)}}function S0(n,t){if(n&1&&(s(0,"div",54),x(1,E0,8,4,"div",44),c()),n&2){let e=C(2);l(),h("ngForOf",e.passengerDetails)("ngForTrackBy",e.trackByPassengerDetail)}}function y0(n,t){if(n&1&&(s(0,"div",27)(1,"h2",46),p(2),v(3,"translate"),c(),x(4,I0,2,2,"div",55)(5,S0,2,2,"div",56),c()),n&2){let e=C();l(2),E(" ",_(3,3,"CHECKOUT-CONFIRMATION.DADOS-DOS-PASSAGEIROS")," "),l(2),h("ngIf",e.passengerSummary.length),l(),h("ngIf",e.passengerDetails.length)}}var Ur=class n{constructor(t,e,i,r){this.router=t;this.checkoutService=e;this.translateService=i;this.ecommerceTrackingService=r;this.reserva=null;this.pagamento=null;this.orderId="---";this.isPix=!1;this.isCardPayment=!1;this.reservationSummary=[];this.paymentSummary=[];this.contactSummary=[];this.passengerSummary=[];this.passengerDetails=[];this.serviceSummary=[];let o=this.router.getCurrentNavigation();this.venda=o?.extras?.state?.venda||history.state.venda||this.checkoutService.getVenda()}ngOnInit(){this.ecommerceTrackingService.trackPurchase(this.venda),this.reserva=this.venda?.Reserva||this.venda?.ReservaResponse?.Reserva||this.venda?.reserva||null,this.reserva&&(this.pagamento=this.reserva?.Pagamentos?.[0]||this.reserva?.pagamentos?.[0]||null,this.isPix=!!this.reserva?.flPix,this.isCardPayment=!this.isPix&&!!this.pagamento,this.orderId=this.reserva?.nrLocalizador||this.venda?.idVenda||this.reserva?.idReserva||"---",this.reservationSummary=[this.buildSummaryItem("CHECKOUT-CONFIRMATION.LOCALIZADOR",this.reserva.nrLocalizador),this.buildSummaryItem("CHECKOUT-CONFIRMATION.RESERVA",this.toDisplayValue(this.reserva.idReserva)),this.buildSummaryItem("CHECKOUT-CONFIRMATION.DATA-DA-RESERVA",this.formatDate(this.reserva.dtReserva)),this.buildSummaryItem("CHECKOUT-CONFIRMATION.CHECK-IN",this.formatDate(this.reserva.dtChegada
24)),this.buildSummaryItem("CHECKOUT-CONFIRMATION.CHECK-OUT",this.formatDate(this.reserva.dtSaida)),this.buildSummaryItem("CHECKOUT-CONFIRMATION.MOEDA",this.reserva.dsSiglaMoeda)].filter(t=>t.value),this.contactSummary=[this.buildSummaryItem("CHECKOUT-CONFIRMATION.EMAIL",this.reserva.dsEmailTitular),this.buildSummaryItem("CHECKOUT-CONFIRMATION.TELEFONE",this.reserva.nrTelefone),this.buildSummaryItem("CHECKOUT-CONFIRMATION.WHATSAPP",this.reserva.nrWhatsApp),this.buildSummaryItem("CHECKOUT-CONFIRMATION.IDIOMA",this.reserva.dsIdioma),this.buildSummaryItem("CHECKOUT-CONFIRMATION.TITULAR",this.reserva.nmTitular)].filter(t=>t.value),this.paymentSummary=[this.buildSummaryItem("CHECKOUT-CONFIRMATION.METODO-DE-PAGAMENTO",this.isPix?this.translateService.instant("CHECKOUT.FORMAS-PAGAMENTO.PIX"):this.translateService.instant("CHECKOUT-CONFIRMATION.PAGAMENTO-CARTAO")),this.buildSummaryItem("CHECKOUT-CONFIRMATION.BANDEIRA",this.pagamento?.nmBandeira),this.buildSummaryItem("CHECKOUT-CONFIRMATION.PARCELAS",this.pagamento?.nrParcelas?`${this.pagamento.nrParcelas}x`:""),this.buildSummaryItem("CHECKOUT-CONFIRMATION.VALOR-PAGO",this.formatCurrency(this.pagamento?.vlPago??this.getReservationTotal())),this.buildSummaryItem("CHECKOUT-CONFIRMATION.DATA-DO-PAGAMENTO",this.formatDate(this.pagamento?.dtPagamento)),this.buildSummaryItem("CHECKOUT-CONFIRMATION.CARTAO",this.getMaskedCard()),this.buildSummaryItem("CHECKOUT-CONFIRMATION.TRANSACAO",this.pagamento?.nrTransacao),this.buildSummaryItem("CHECKOUT-CONFIRMATION.AUTORIZACAO",this.pagamento?.nrAutorizacao)].filter(t=>t.value),this.passengerSummary=(this.reserva.Pax||[]).map(t=>({id:t.idPax??`${t.nmPax}-${t.nrQtde}`,label:this.getPassengerTypeLabel(t.idPax),quantity:Number(t.nrQtde||0)})).filter(t=>t.quantity>0),this.passengerDetails=(this.reserva.NomesPax||[]).map(t=>({id:t.IdDetalhe??t.idPax??t.dsNome,name:t.dsNome||this.translateService.instant("CHECKOUT-CONFIRMATION.NAO-INFORMADO"),document:this.getDocumentLabel(t),birthDate:this.formatDate(t.dtNascimento),nationality:this.toDisplayValue(t.dsNacionalidade)})),this.serviceSummary=(this.reserva.Servicos||[]).map((t,e)=>({id:t.id??t.idItem??e,date:this.formatDate(t.dtServico),time:this.toDisplayValue(t.hrServico),total:this.formatCurrency(t.vlTotal),observations:this.toDisplayValue(t.dsObservacoes),passengerCount:this.getPassengerCount(t.Pax)})))}irParaVouchers(){debugger;this.router.navigate(["/minhas-compras"])}irParaHome(){this.router.navigate(["/"])}trackBySummary(t,e){return e.label}trackByPassengerSummary(t,e){return e.id}trackByPassengerDetail(t,e){return e.id}trackByService(t,e){return e.id}buildSummaryItem(t,e){return{label:t,value:e}}getReservationTotal(){return(this.reserva?.Servicos||[]).reduce((t,e)=>t+Number(e.vlTotal||0),0)}getPassengerCount(t=[]){return t.reduce((e,i)=>e+Number(i.nrQtde||0),0)}getPassengerTypeLabel(t){return{1:this.translateService.instant("PAX.ADULTO"),2:this.translateService.instant("PAX.CRIANCA_6_A_12"),3:this.translateService.instant("PAX.CRIANCA_3_A_5"),4:this.translateService.instant("PAX.MELHOR_IDADE"),5:this.translateService.instant("PAX.BEBE_COLO")}[t]||this.translateService.instant("CHECKOUT-CONFIRMATION.PASSAGEIROS")}getMaskedCard(){let t=this.pagamento?.nrInicioCartao,e=this.pagamento?.nrFinalCartao;return!t&&!e?"":`${t||"****"} **** **** ${e||"****"}`}getDocumentLabel(t){let e=this.toDisplayValue(t.dsTipoDocto),i=this.toDisplayValue(t.nrDocto);return!e&&!i?this.translateService.instant("CHECKOUT-CONFIRMATION.NAO-INFORMADO"):[e,i].filter(Boolean).join(": ")}toDisplayValue(t){return t==null||t===""?"":String(t)}formatDate(t){if(!t)return"";let e=new Date(t);return Number.isNaN(e.getTime())?"":new Intl.DateTimeFormat(this.getLocale(),{day:"2-digit",month:"2-digit",year:"numeric"}).format(e)}formatCurrency(t){return t==null||Number.isNaN(Number(t))?"":new Intl.NumberFormat(this.getLocale(),{style:"currency",currency:this.reserva?.dsSiglaMoeda||"BRL"}).format(Number(t))}getLocale(){let t=(this.translateService.currentLang||"").toLowerCase();return t.startsWith("es")?"es-ES":t.startsWith("en")?"en-US":"pt-BR"}static{this.\u0275fac=function(e){return new(e||n)(O(ze),O(Ft),O(Ja),O(Di))}}static{this.\u0275cmp=ne({type:n,selectors:[["app-checkout-confirmation"]],standalone:!1,decls:56,vars:27,consts:[[1,"min-h-screen","w-full","py-8","px-4","md:py-12","bg-[#F9F7F5]","relative","overflow-hidden","my-5"],[1,"absolute","top-0","left-0","w-full","h-full","overflow-hidden","pointer-events-none"],[1,"absolute","-top-[10%]","-left-[10%]","w-[40rem]","h-[40rem]","bg-[#A57B6A]/5","rounded-full","blur-3xl"],[1,"absolute","top-[20%]","-right-[10%]","w-[30rem]","h-[30rem]","bg-[#A57B6A]/10","rounded-full","blur-3xl"],[1,"max-w-5xl","mx-auto","relative","z-10"],[1,"bg-white","rounded-[2rem]","shadow-2xl","border","border-white/60","overflow-hidden"],[1,"h-1.5","w-full","bg-gradient-to-r","from-[#8e6a5b]","via-[#A57B6A]","to-[#8e6a5b]"],[1,"p-6","md:p-10"],[1,"flex","flex-col","items-center","text-center","mb-8"],[1,"relative","mb-6"],[1,"absolute","
24inset-0","bg-green-100","rounded-full","animate-ping","opacity-75"],[1,"relative","w-24","h-24","bg-gradient-to-b","from-green-50","to-white","border","border-green-100","rounded-full","flex","items-center","justify-center","shadow-sm"],["fill","none","stroke","currentColor","viewBox","0 0 24 24",1,"w-10","h-10","text-green-600","drop-shadow-sm"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2.5","d","M5 13l4 4L19 7"],[1,"text-[#3D3D3D]","font-bold","text-3xl","md:text-4xl","mb-3","tracking-tight"],[1,"text-gray-500","text-base","md:text-lg","leading-relaxed","max-w-2xl"],[1,"grid","gap-6","lg:grid-cols-[1.25fr_0.75fr]"],[1,"space-y-6"],[1,"bg-[#A57B6A]/5","border","border-[#A57B6A]/20","rounded-3xl","p-6","md:p-8"],[1,"flex","flex-col","gap-5","md:flex-row","md:items-end","md:justify-between"],[1,"text-[11px]","text-[#8e6a5b]","font-bold","uppercase","tracking-[0.2em]","mb-2","opacity-80"],[1,"text-4xl","md:text-5xl","font-extrabold","text-[#3D3D3D]","tracking-tighter"],[1,"inline-flex","items-center","gap-2","px-4","py-2","bg-green-50","border","border-green-100","rounded-full","self-start","md:self-auto"],[1,"w-2","h-2","rounded-full","bg-green-500","animate-pulse"],[1,"text-xs","font-semibold","text-green-700","uppercase","tracking-wide"],["class","grid gap-4 sm:grid-cols-2 xl:grid-cols-3 mt-6 pt-6 border-t border-dashed border-[#A57B6A]/25",4,"ngIf"],["class","bg-white border border-[#EADFD8] rounded-3xl p-6",4,"ngIf"],[1,"bg-white","border","border-[#EADFD8]","rounded-3xl","p-6"],[1,"w-full","flex","flex-col","gap-3"],[1,"w-full","bg-[#A57B6A]","hover:bg-[#946b5b]","text-white","font-semibold","py-4","rounded-xl","transition-all","duration-300","shadow-[#A57B6A]/30","shadow-lg","hover:shadow-xl","hover:-translate-y-0.5","flex","items-center","justify-center","gap-2.5","group","overflow-hidden","relative",3,"click"],[1,"absolute","inset-0","w-full","h-full","bg-gradient-to-r","from-transparent","via-white/10","to-transparent","-translate-x-full","group-hover:animate-[shimmer_1.5s_infinite]"],["fill","none","stroke","currentColor","viewBox","0 0 24 24",1,"w-5","h-5","opacity-90"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"],[1,"w-full","bg-transparent","text-gray-500","font-medium","py-3","rounded-xl","hover:text-[#A57B6A]","hover:bg-[#A57B6A]/5","transition-colors","text-sm",3,"click"],[1,"text-xs","text-[#A57B6A]","font-light","text-center","mt-8"],[1,"grid","gap-4","sm:grid-cols-2","xl:grid-cols-3","mt-6","pt-6","border-t","border-dashed","border-[#A57B6A]/25"],["class","rounded-2xl bg-white/70 border border-white px-4 py-3",4,"ngFor","ngForOf","ngForTrackBy"],[1,"rounded-2xl","bg-white/70","border","border-white","px-4","py-3"],[1,"text-xs","uppercase","tracking-[0.14em]","text-[#8e6a5b]","font-semibold","mb-1"],[1,"text-sm","text-[#3D3D3D]","font-medium","break-words"],[1,"mb-5"],[1,"text-xl","font-bold","text-[#3D3D3D]"],[1,"text-sm","text-gray-500"],[1,"grid","gap-4","sm:grid-cols-2"],["class","rounded-2xl border border-[#F1E7E1] bg-[#FCFAF8] px-4 py-3",4,"ngFor","ngForOf","ngForTrackBy"],[1,"rounded-2xl","border","border-[#F1E7E1]","bg-[#FCFAF8]","px-4","py-3"],[1,"text-xl","font-bold","text-[#3D3D3D]","mb-5"],[1,"space-y-4"],["class","rounded-2xl border border-[#F1E7E1] bg-[#FCFAF8] px-4 py-4",4,"ngFor","ngForOf","ngForTrackBy"],[1,"rounded-2xl","border","border-[#F1E7E1]","bg-[#FCFAF8]","px-4","py-4"],[1,"grid","gap-4","sm:grid-cols-2","xl:grid-cols-4"],[1,"text-sm","text-[#3D3D3D]","font-medium"],["class","mt-4 pt-4 border-t border-dashed border-[#EADFD8]",4,"ngIf"],[1,"mt-4","pt-4","border-t","border-dashed","border-[#EADFD8]"],[1,"space-y-3"],["class","flex flex-wrap gap-3 mb-5",4,"ngIf"],["class","space-y-3",4,"ngIf"],[1,"flex","flex-wrap","gap-3","mb-5"],["class","min-w-[9rem] rounded-2xl border border-[#F1E7E1] bg-[#FCFAF8] px-4 py-3",4,"ngFor","ngForOf","ngForTrackBy"],[1,"min-w-[9rem]","rounded-2xl","border","border-[#F1E7E1]","bg-[#FCFAF8]","px-4","py-3"],[1,"text-lg","font-bold","text-[#3D3D3D]"],[1,"text-sm","font-semibold","text-[#3D3D3D]","break-words"],[1,"grid","gap-2","mt-2","text-sm","text-gray-500"],[4,"ngIf"]],template:function(e,i){e&1&&(s(0,"section",0)(1,"div",1),T(2,"div",2)(3,"div",3),c(),s(4,"div",4)(5,"div",5),T(6,"div",6),s(7,"div",7)(8,"div",8)(9,"div",9),T(10,"div",10),s(11,"div",11),le(),s(12,"svg",12),T(13,"path",13),c()()(),Ne(),s(14,"h1",14),p(15),v(16,"translate"),c(),s(17,"p",15),p(18),v(19,"translate"),c()(),s(20,"div",16)(21,"div",17)(22,"div",18)(23,"div",19)(24,"div")(25,"p",20),p(26),v(27,"translate"),c(),s(28,"p",21),p(29),c()(),s(30,"div",22),T(31,"span",23),s(32,"span",24),p(33),v(34,"translate"),c()()(),x(35,u0,2,2,"div",25),c(),x(36,m0,11,10,"div",26)(37,g0,6,5,"div",26),c(),s(38,"div",17),x(39,_0,6,5,"div",26)(40,y0,6,5,"div",26),s(41,"div",27)(42,"div",28)(43,"button",29),M("click",function(){return i.irParaVouchers()}),T(44,"div",30),le(),s(45,"svg",31),T(46,"path",32),c(),Ne(),s(47,"span"),p(48),v(49,"translate"),c()(),s(50,"button",33),M("click",function(){return i.irParaHome()}),p(51),v(52,"translate"),c()()()()(),s(53,"p",34),p(54),v(55,"translate"),c()()()()()),e&2&&(l(15),E(" ",_(16,13,"CHECKOUT-CONFIRMATION.COMPRA-FINALIZADA")," "),l(3),E(" ",_(19,15,"CHECKOUT-CONFIRMATION.AGRADECEMOS")," "),l(8),E(" ",_(27,17,"CHECKOUT-CONFIRMATION.LOCALIZADOR")," "),l(3),E(" ",i.orderId," "),l(4),E(" ",_(34,19,"CHECKOUT-CONFIRMATION.PAGAMENTO-APROVADO")," "),l(2),h("ngIf",i.reservationSummary.length),l(),h("ngIf",i.paymentSummary.length),l(),h("ngIf",i.serviceSummary.length),l(2),h("ngIf",i.contactSummary.length),l(),h("ngIf",i.passengerSummary.length||i.passengerDetails.length),l(8),P(_(49,21,"CHECKOUT-CONFIRMATION.MEUS-VOUCHERS")),l(3),E(" ",_(52,23,"CHECKOUT-CONFIRMATION.VOLTAR-PARA-INICIO")," "),l(3),E(" ",_(55,25,"CHECKOUT-CONFIRMATION.OBR
24IGADO-POR-ESCOLHER-NOSSOS-SERVICOS")," "))},dependencies:[Ce,oe,Pe],styles:["@keyframes _ngcontent-%COMP%_bounce-slow{0%,to{transform:translateY(-5%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:translateY(0);animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce-slow[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_bounce-slow 2s infinite}"]})}};var Br=class n{constructor(t){this.http=t;this.apiUrl=pe.EXTERNALAPIURL}getVendasByCliente(t){return this.http.get(`${this.apiUrl}/Venda/ListVendasByCliente/${t}`)}getStatusReserva(t){return console.log(`Consultando status da reserva para venda ID: ${t} no endpoint ${this.apiUrl}/Venda/getStatusReserva/${t}`),this.http.get(`${this.apiUrl}/Venda/getStatusReserva/${t}`)}static{this.\u0275fac=function(e){return new(e||n)(Y(Le))}}static{this.\u0275prov=G({token:n,factory:n.\u0275fac,providedIn:"root"})}};function P0(n,t){n&1&&(s(0,"div",10)(1,"div",11)(2,"div",12),le(),s(3,"svg",13),T(4,"path",14),c()(),Ne(),s(5,"h3",15),p(6,"PIX Expirado"),c(),s(7,"p",16),p(8,"O tempo para pagamento expirou."),c(),s(9,"p",17),p(10,"Redirecionando para a pagina inicial..."),c()()())}function k0(n,t){if(n&1&&(s(0,"div",18)(1,"div",19)(2,"div",20)(3,"div")(4,"p",21),p(5),v(6,"translate"),c(),s(7,"p",22),p(8),c()(),s(9,"div",23),T(10,"span",24),s(11,"span",25),p(12),v(13,"translate"),c()()(),s(14,"div",26)(15,"div",27)(16,"p",28),p(17),v(18,"translate"),c(),s(19,"p",29),p(20),c()(),s(21,"div",27)(22,"p",28),p(23),v(24,"translate"),c(),s(25,"p",29),p(26),c()(),s(27,"div",27)(28,"p",28),p(29),v(30,"translate"),c(),s(31,"p",29),p(32),c()(),s(33,"div",27)(34,"p",28),p(35),v(36,"translate"),c(),s(37,"p",29),p(38),c()()()()()),n&2){let e=C(2);l(5),E(" ",_(6,11,"CHECKOUT-CONFIRMATION.LOCALIZADOR")," "),l(3),E(" ",e.localizador," "),l(4),E(" ",_(13,13,"PIX.STATUS-AGUARDANDO")," "),l(5),E(" ",_(18,15,"PIX.VALOR-PIX")," "),l(3),E(" ",e.formatCurrency(e.valorPix)," "),l(3),E(" ",_(24,17,"PIX.EXPIRA-EM")," "),l(3),E(" ",e.tempoRestante," "),l(3),E(" ",_(30,19,"CHECKOUT-CONFIRMATION.TITULAR")," "),l(3),E(" ",e.nomeTitular," "),l(3),E(" ",_(36,21,"CHECKOUT-CONFIRMATION.PASSAGEIROS")," "),l(3),E(" ",e.quantidadePassageiros," ")}}function A0(n,t){if(n&1&&(s(0,"div",41)(1,"span",39),p(2),v(3,"translate"),c(),s(4,"span",42),p(5),c()()),n&2){let e=C(3);l(2),P(_(3,2,"CHECKOUT-CONFIRMATION.LOCALIZADOR")),l(3),P(e.Reserva==null?null:e.Reserva.nrLocalizador)}}function O0(n,t){if(n&1&&(s(0,"div",41)(1,"span",39),p(2),v(3,"translate"),c(),s(4,"span",55),p(5),c()()),n&2){let e=C(3);l(2),P(_(3,2,"CHECKOUT-CONFIRMATION.EMAIL")),l(3),P(e.emailTitular)}}function w0(n,t){if(n&1&&(s(0,"div",41)(1,"span",39),p(2),v(3,"translate"),c(),s(4,"span",42),p(5),c()()),n&2){let e=C(3);l(2),P(_(3,2,"PIX.EXPIRACAO")),l(3),P(e.expiracaoFormatada)}}function R0(n,t){if(n&1&&(s(0,"p",61),p(1),c()),n&2){let e=C().$implicit;l(),P(e.nmItem)}}function D0(n,t){if(n&1&&(s(0,"div",62)(1,"span",63),p(2),v(3,"translate"),c(),s(4,"span",64),p(5),v(6,"date"),c()()),n&2){let e=C().$implicit;l(2),P(_(3,2,"PIX.DATA-RESERVA")),l(3),P(re(6,4,e.dtServico,"dd/MM/yyyy"))}}function N0(n,t){if(n&1&&(s(0,"div",62)(1,"span",63),p(2),v(3,"translate"),c(),s(4,"span",64),p(5),c()()),n&2){let e=C().$implicit,i=C(3);l(2),P(_(3,2,"PIX.HORA-RESERVA")),l(3),P(i.getPrimeiroHorarioCombo(e))}}function M0(n,t){if(n&1&&(s(0,"div",62)(1,"span",63),p(2),v(3,"translate"),c(),s(4,"span",64),p(5),c()()),n&2){let e=C().$implicit;l(2),P(_(3,2,"PIX.HORA-RETORNO")),l(3),P(e.hrRetorno)}}function F0(n,t){if(n&1&&(s(0,"div",65)(1,"span",66),p(2),v(3,"translate"),c(),s(4,"span",67),p(5),v(6,"number"),c()()),n&2){let e=C().$implicit;l(2),P(_(3,2,"PIX.TOTAL-SERVICO")),l(3),E("R$ ",re(6,4,e.vlTotal,"1.2-2"),"")}}function L0(n,t){if(n&1&&(s(0,"div",56),x(1,R0,2,1,"p",57),s(2,"div",58),x(3,D0,7,7,"div",59)(4,N0,6,4,"div",59)(5,M0,6,4,"div",59)(6,F0,7,7,"div",60),c()()),n&2){let e=t.$implicit,i=C(3);l(),h("ngIf",e.nmItem),l(2),h("ngIf",e.dtServico),l(),h("ngIf",i.getPrimeiroHorarioCombo(e)),l(),h("ngIf",e.hrRetorno!=null),l(),h("ngIf",e.vlTotal)}}function V0(n,t){n&1&&(s(0,"span"),le(),s(1,"svg",34),T(2,"path",82),c()())}function U0(n,t){n&1&&(s(0,"span"),le(),s(1,"svg",34),T(2,"path",83),
24c()())}function B0(n,t){n&1&&(le(),s(0,"svg",34),T(1,"path",84),c())}function H0(n,t){n&1&&(le(),s(0,"svg",85),T(1,"circle",86)(2,"path",87),c())}function $0(n,t){if(n&1&&(s(0,"div",88),p(1),v(2,"translate"),c()),n&2){let e=C(4);h("ngClass",e.statusConsultaManual==="error"?"bg-red-50 text-red-700 border-red-100":"bg-slate-50 text-slate-700 border-slate-200"),l(),E(" ",_(2,2,e.mensagemConsultaManual)," ")}}function j0(n,t){if(n&1){let e=z();ce(0),s(1,"div",68),T(2,"img",69),c(),s(3,"div",70)(4,"button",71),M("click",function(){R(e);let r=C(3);return D(r.copiarCodigoPix())}),x(5,V0,3,0,"span",72)(6,U0,3,0,"span",72),p(7),v(8,"translate"),v(9,"translate"),v(10,"translate"),c(),s(11,"button",73),M("click",function(){R(e);let r=C(3);return D(r.consultarStatusManual())}),x(12,B0,2,0,"svg",74)(13,H0,3,0,"svg",75),s(14,"span"),p(15),v(16,"translate"),v(17,"translate"),c()(),x(18,$0,3,4,"div",76),s(19,"div",77),le(),s(20,"svg",78),T(21,"path",79),c(),Ne(),s(22,"span"),p(23),v(24,"translate"),s(25,"span",80),p(26),c()()(),s(27,"div",81),p(28),v(29,"translate"),c()(),de()}if(n&2){let e=C(3);l(2),h("src","data:image/png;base64,"+e.qrCodePixBase64,Fe),l(2),h("ngClass",e.copiado?"bg-green-600 hover:bg-green-700":"bg-[--primary-background-text-color] hover:opacity-90"),l(),h("ngIf",!e.copiado),l(),h("ngIf",e.copiado),l(),E(" ",e.copiado?_(8,13,"PIX.COPIADO"):_(9,15,"PIX.PIX")+" "+_(10,17,"PIX.COPIAR-COPIA-E-COLA")," "),l(4),h("disabled",e.consultandoStatus||e.pixExpirado),l(),h("ngIf",!e.consultandoStatus),l(),h("ngIf",e.consultandoStatus),l(2),E(" ",e.consultandoStatus?_(16,19,"PIX.CONSULTANDO-STATUS"):_(17,21,"PIX.CONSULTAR-PAGAMENTO")," "),l(3),h("ngIf",e.mensagemConsultaManual),l(5),E(" ",_(24,23,"PIX.EXPIRA")," "),l(3),P(e.tempoRestante),l(2),E(" ",_(29,25,"PIX.ATUALIZACAO-AUTOMATICA")," ")}}function G0(n,t){n&1&&(s(0,"div",89),le(),s(1,"svg",90),T(2,"circle",86)(3,"path",87),c(),Ne(),s(4,"p",91),p(5),v(6,"translate"),c()()),n&2&&(l(5),P(_(6,1,"PIX.GERANDO-QR")))}function z0(n,t){if(n&1&&(s(0,"div",30)(1,"div",31)(2,"div",32)(3,"h3",33),le(),s(4,"svg",34),T(5,"path",35),c(),p(6),v(7,"translate"),c()(),Ne(),s(8,"div",36)(9,"div",37)(10,"div",38)(11,"span",39),p(12),v(13,"translate"),c(),s(14,"span",40),p(15),c()(),s(16,"div",41)(17,"span",39),p(18),v(19,"translate"),c(),s(20,"span",42),p(21),c()(),x(22,A0,6,4,"div",43)(23,O0,6,4,"div",43)(24,w0,6,4,"div",43),c(),s(25,"div",44),x(26,L0,7,5,"div",45),c(),s(27,"div",46)(28,"span",47),p(29),v(30,"translate"),c(),s(31,"span",48),p(32),c()()()(),s(33,"div",49)(34,"h3",50),p(35),v(36,"translate"),c(),s(37,"div",51)(38,"p",52),p(39),v(40,"translate"),c(),s(41,"ol",53)(42,"li"),p(43),v(44,"translate"),c(),s(45,"li"),p(46),v(47,"translate"),c(),s(48,"li"),p(49),v(50,"translate"),c(),s(51,"li"),p(52),v(53,"translate"),c()()(),x(54,j0,30,27,"ng-container",54)(55,G0,7,3,"ng-template",null,1,ve),c()()),n&2){let e=Z(56),i=C(2);l(6),E(" ",_(7,19,"PIX.RESUMO-RESERVA")," "),l(6),P(_(13,21,"PIX.NOME")),l(3),P(i.nomeTitular),l(3),P(_(19,23,"PIX.ID-VENDA")),l(3),P(i.idVenda),l(),h("ngIf",i.Reserva==null?null:i.Reserva.nrLocalizador),l(),h("ngIf",i.emailTitular),l(),h("ngIf",i.expiracaoFormatada),l(2),h("ngForOf",i.Reserva==null?null:i.Reserva.Servicos),l(3),P(_(30,25,"PIX.VALOR")),l(3),P(i.formatCurrency(i.valorPix)),l(3),P(_(36,27,"PIX.ESCANEIE-PARA-PAGAR")),l(4),E(" ",_(40,29,"PIX.COMO-PAGAR")," "),l(4),E("1. ",_(44,31,"PIX.PASSO-APP"),""),l(3),E("2. ",_(47,33,"PIX.PASSO-ESCANEAR"),""),l(3),E("3. ",_(50,35,"PIX.PASSO-CONCLUIR"),""),l(3),E("4. ",_(53,37,"PIX.PASSO-ATUALIZACAO"),""),l(2),h("ngIf",i.qrCodePixBase64)("ngIfElse",e)}}function W0(n,t){if(n&1&&(s(0,"section",3),x(1,P0,11,0,"div",4),s(2,"div",5)(3,"h2",6),p(4),v(5,"translate"),c(),s(6,"p",7),p(7),v(8,"translate"),c()(),x(9,k0,39,23,"div",8)(10,z0,57,39,"div",9),c()),n&2){let e=C();l(),h("ngIf",e.pixExpirado),l(3),E(" ",_(5,5,"PIX.PAGAMENTO-PIX")," "),l(3),E(" ",_(8,7,"PIX.ESCOLHA-OPCAO")," "),l(2),h("ngIf",!e.pixExpirado),l(),h("ngIf",!e.pixExpirado)}}function q0(n,t){n&1&&(s(0,"div"),le(),s(1,"svg",94),T(2,"circle",86)(3,"path",87),c(),Ne(),s(4,"p",95),p(5,"Carregando dados do pagamento..."),c()())}function K0(n,t){n&1&&(s(0,"div",96)(1,"div",97)(2,"div",12),le(),s(3,"svg",98),T(4,"path",99),c()(),Ne(),s(5,"h3",100),p(6,"Dados nao encontrados"),c(),s(7,"p",101),p(8,"Nao foi possivel carregar os dados do pagamento PIX."),c(),s(9,"p",102),p(10,"Redirecionando para a pagina inicial..."),c()()())}function Y0(n,t){if(n&1&&(s(0,"div",92),x(1,q0,6,0,"div",72)(2,K0,11,0,"div",93),c()),n&2){let e=C();l(),h("ngIf",!e.semDados),l(),h("ngIf",e.semDados)}}var Hr=class n{constructor(t,e,i,r){this.router=t;this.vendaService=e;this.reservaStorageService=i;this.store=r;this.idVenda=null;this.copiado=!1;this.tempoRestante="";this.pixExpirado=!1;this.semDados=!1;this.consultandoStatus=!1;this.statusConsultaManual=null;this.mensagemConsultaManual="";this.POLLING_INTERVAL=3e3;let a=this.router.getCurrentNavigation()?.extras?.state?.reserva;if(a)console.log("Dados PIX recebidos via router state"),this.definirDadosReserva(a);else{let u=this.reservaStorageService.getReservaSalva();u&&u.Reserva?(console.log("Dados PIX recuperados do localStorage"),this.definirDadosReserva(u.Reserva)):console.warn("Nenhum dado de PIX encontrado")}}ngOnInit(){if(!this.Reserva){let t=this.reservaStorageService.getReservaSalva();t&&t.Reserva&&this.definirDadosReserva(t.Reserva)}if(this.Reserva&&this.isReservaExpirada()){this.onPagamentoExpirado();return}this.Reserva?(this.iniciarContagemRegressiva(),this.iniciarVerificacaoPagamento()):(this.semDados=!0,this.router.navigate(["/"]))}ngOnDestroy(){this.intervalId&&clearInterval(this.intervalId),this.pollingIntervalId&&clearInterval(this.pollingIntervalId)}copiarCodigoPix(){let t=this.codigoPix;if(!t){console.warn("Codigo PIX nao encontrado.");return}let e=r=>{this.copiado=!0,navigator.clipboard.writeText(r).then(()=>{setTimeout(()=>this.copiado=!1,3e3)}).catch(o=>{console.error("Erro ao copiar:",o)})};if(navigator.clipboard&&window.isSecureContext){e(t);return}let i=document.createElement("textarea");i.value=t,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.focus(),i.select();try{document.execCommand("copy")?e(t):console.error("Erro ao copiar o codigo PIX.")}catch(r){console.error("Erro ao usar execCommand:",r)}document.body.removeChild(i)}consultarStatusManual(){let t=this.idVenda;!t||this.consultandoStatus||this.pixExpirado||(this.consultandoStatus=!0,this.statusConsultaManual=null,this.mensagemConsultaManual="",this.verificarStatusPagamento(t,!0))}iniciarContagemRegressiva(){let t=this.obterDataExpiracao();if(!t){this.tempoRestante="--:--";return}let e=()=>{let i=new Date,r=t.getTime()-i.getTime();if(r<=0){this.tempoRestante="Expirado",clearInterval(this.intervalId),this.onPagamentoExpirado();return}let o=Math.floor(r/1e3),a=Math.floor(o/60),u=o%60;this.tempoRestante=`${this.formatarTempo(a)}:${this.formatarTempo(u)}`};e(),this.intervalId=setInterval(e,1e3)}formatarTempo(t){return t<10?`0${t}`:`${t}`}iniciarVerificacaoPagamento(){let t=this.idVenda;if(!t){console.warn("ID da venda nao encontrado. Nao e possivel verificar o status do pagamento.");return}this.verificarStatusPagamento(t),this.pollingIntervalId=setInterval(()=>{this.verificarStatusPagamento(t)},this.POLLING_INTERVAL)}verificarStatusPagamento(t,e=!1){this.vendaService.getStatusReserva(t).subscribe({next:i=>{if(i.status===!0){this.onPagamentoConfirmado();return}e&&(this.statusConsultaManual="info",this.mensagemConsultaManual="PIX.STATUS-AINDA-PENDENT
24E")},error:i=>{i.status!==404&&console.error("Erro ao verificar status do pagamento:",i),e&&(this.statusConsultaManual="error",this.mensagemConsultaManual="PIX.ERRO-CONSULTA-MANUAL")},complete:()=>{e&&(this.consultandoStatus=!1)}})}onPagamentoConfirmado(){this.pollingIntervalId&&(clearInterval(this.pollingIntervalId),this.pollingIntervalId=null),this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),localStorage.removeItem("book"),this.reservaStorageService.limparReserva(),this.store.dispatch(Zt()),this.router.navigate(["/checkout/Confirmation"],{state:{venda:this.venda||{Reserva:this.Reserva}}})}onPagamentoExpirado(){this.pixExpirado=!0,this.pollingIntervalId&&(clearInterval(this.pollingIntervalId),this.pollingIntervalId=null),this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.reservaStorageService.limparReserva(),setTimeout(()=>{this.router.navigate(["/"])},1e4)}getPrimeiroHorarioCombo(t){let e=t?.itensCombo||t?.ItensCombo;return!e||e.length===0?t.hrServico:[...e].sort((r,o)=>{let a=r.hrServico||"23:59",u=o.hrServico||"23:59";return a.localeCompare(u)})[0]?.hrServico||t.hrServico}obterHorarioMaisAntigoCombo(t){let e=t?.itensCombo||t?.ItensCombo;return!e||e.length===0?t.hrServico:e.reduce((r,o)=>{let a=r?.hrServico||"23:59";return(o?.hrServico||"23:59")<a?o:r},e[0])?.hrServico||t.hrServico}get codigoPix(){return this.Reserva?.QrCodePix?.cdCopia||""}get qrCodePixBase64(){return this.Reserva?.QrCodePix?.bnPix||""}get localizador(){return this.Reserva?.nrLocalizador||this.idVenda?.toString()||"---"}get valorPix(){let t=Number(this.Reserva?.PixInfo?.vlCobranca);if(Number.isFinite(t)&&t>0)return t;let e=Number(this.Reserva?.Pagamentos?.[0]?.vlPagamento);return Number.isFinite(e)&&e>0?e:(this.Reserva?.Servicos||[]).reduce((r,o)=>r+Number(o?.vlTotal||0),0)}get expiracaoFormatada(){let t=this.obterDataExpiracao();return t?new Intl.DateTimeFormat("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(t):""}isReservaExpirada(){let t=this.obterDataExpiracao();return t?t.getTime()<=Date.now():!1}get nomeTitular(){return this.Reserva?.nmTitular||this.Reserva?.Cliente?.nmCliente||""}get emailTitular(){return this.Reserva?.dsEmailTitular||this.Reserva?.Cliente?.dsEmail||""}get quantidadePassageiros(){return(this.Reserva?.Pax||[]).reduce((t,e)=>t+Number(e?.nrQtde||0),0)}formatCurrency(t){return Number.isFinite(Number(t))?new Intl.NumberFormat("pt-BR",{style:"currency",currency:this.Reserva?.dsSiglaMoeda||"BRL"}).format(Number(t)):""}definirDadosReserva(t){this.venda=t,this.Reserva=t?.ReservaResponse?.Reserva||t?.Reserva||t?.reserva||t||null,this.idVenda=this.toNumberOrNull(t?.idVenda)??this.toNumberOrNull(t?.ReservaResponse?.idVenda)??this.toNumberOrNull(t?.Reserva?.idVenda)??this.toNumberOrNull(this.Reserva?.idVenda)??null}obterDataExpiracao(){let t=this.Reserva?.QrCodePix?.dtExpiracao||this.Reserva?.PixInfo?.dtExpiracao;if(!t)return null;let e=this.parseDatePreservingLocalTime(t);return Number.isNaN(e.getTime())?null:e}parseDatePreservingLocalTime(t){if(t.includes("Z")||t.includes("+")||t.match(/-\d{2}:\d{2}$/))return new Date(t);let e=t.match(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?/);if(!e)return new Date(t);let[,i,r,o,a,u,d="0"]=e;return new Date(parseInt(i,10),parseInt(r,10)-1,parseInt(o,10),parseInt(a,10),parseInt(u,10),parseInt(d,10))}toNumberOrNull(t){if(t==null||t==="")return null;let e=Number(t);return Number.isFinite(e)?e:null}static{this.\u0275fac=function(e){return new(e||n)(O(ze),O(Br),O(Li),O(Ie))}}static{this.\u0275cmp=ne({type:n,selectors:[["app-pix-qrcode"]],standalone:!1,decls:3,vars:2,consts:[["carregando",""],["loading",""],["class","py-8 bg-[--secondary-background-bg-color]mt-4 mb-8",4,"ngIf","ngIfElse"],[1,"py-8","bg-[--secondary-background-bg-color]mt-4","mb-8"],["class","max-w-4xl mx-auto px-4 mb-6",4,"ngIf"],[1,"max-w-4xl","mx-auto","px-4","mb-8","text-center"],[1,"text-3xl","font-bold","text-[--primary-background-text-color]","mb-2"],[1,"text-gray-600"],["class","max-w-5xl mx-auto px-4 mb-6",4,"ngIf"],["class","max-w-5xl mx-auto px-4 grid grid-cols-1 lg:grid-cols-2 gap-8 items-start",4,"ngIf"],[1,"max-w-4xl","mx-auto","px-4","mb-6"],[1,"bg-red-50","border-2","border-red-500","rounded-xl","p-6","text-center","shadow-lg","animate-pulse"],[1,"flex","justify-center","mb-4"],["xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24","stroke","currentColor",1,"h-16","w-16","text-red-500"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"],[1,"text-2xl","font-bold","text-red-600","mb-2"],[1,"text-red-700","text-lg","mb-4"],[1,"text-red-600"],[1,"max-w-5xl","mx-auto","px-4","mb-6"],[1,"bg-white","border","border-[#
24EADFD8]","rounded-3xl","p-6","shadow-sm"],[1,"flex","flex-col","gap-5","md:flex-row","md:items-end","md:justify-between"],[1,"text-[11px]","text-[#8e6a5b]","font-bold","uppercase","tracking-[0.2em]","mb-2","opacity-80"],[1,"text-4xl","md:text-5xl","font-extrabold","text-[#3D3D3D]","tracking-tighter"],[1,"inline-flex","items-center","gap-2","px-4","py-2","bg-orange-50","border","border-orange-100","rounded-full","self-start","md:self-auto"],[1,"w-2","h-2","rounded-full","bg-orange-500","animate-pulse"],[1,"text-xs","font-semibold","text-orange-700","uppercase","tracking-wide"],[1,"grid","gap-4","sm:grid-cols-2","xl:grid-cols-4","mt-6","pt-6","border-t","border-dashed","border-[#A57B6A]/25"],[1,"rounded-2xl","bg-[#FCFAF8]","border","border-[#F1E7E1]","px-4","py-3"],[1,"text-xs","uppercase","tracking-[0.14em]","text-[#8e6a5b]","font-semibold","mb-1"],[1,"text-sm","text-[#3D3D3D]","font-medium","break-words"],[1,"max-w-5xl","mx-auto","px-4","grid","grid-cols-1","lg:grid-cols-2","gap-8","items-start"],[1,"rounded-xl","shadow-lg","border","border-gray-100","overflow-hidden"],[1,"bg-[--primary-background-text-color]","px-6","py-4"],[1,"text-white","font-semibold","text-lg","flex","items-center","gap-2"],["xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24","stroke","currentColor",1,"h-5","w-5"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"],[1,"p-6","space-y-4","bg-white"],[1,"pb-4","border-b","border-gray-100","space-y-2"],[1,"flex","justify-between","items-start"],[1,"text-gray-500","text-sm","font-medium"],[1,"text-gray-900","font-semibold","text-right"],[1,"flex","justify-between","items-center"],[1,"text-gray-900","font-medium"],["class","flex justify-between items-center",4,"ngIf"],[1,"space-y-4"],["class","bg-gray-50 rounded-lg p-4 border border-gray-200",4,"ngFor","ngForOf"],[1,"pt-4","border-t","border-gray-100","mt-4","flex","justify-between","items-center"],[1,"text-lg","text-gray-600","font-medium"],[1,"text-2xl","font-bold","text-green-600"],[1,"rounded-xl","shadow-lg","border","border-gray-100","p-8","flex","flex-col","items-center","text-center","sticky","top-5","bg-white"],[1,"text-xl","font-semibold","text-gray-800","mb-6"],[1,"w-full","mb-6","rounded-2xl","border","border-[#F1E7E1]","bg-[#FCFAF8]","px-4","py-4","text-left"],[1,"text-xs","uppercase","tracking-[0.14em]","text-[#8e6a5b]","font-semibold","mb-3"],[1,"space-y-2","text-sm","text-[#3D3D3D]"],[4,"ngIf","ngIfElse"],[1,"text-gray-900","font-medium","text-right","break-all"],[1,"bg-gray-50","rounded-lg","p-4","border","border-gray-200"],["class","font-bold text-[--primary-background-text-color] mb-2",4,"ngIf"],[1,"space-y-1","text-sm"],["class","flex justify-between",4,"ngIf"],["class","flex justify-between pt-2 mt-2 border-t border-gray-200",4,"ngIf"],[1,"font-bold","text-[--primary-background-text-color]","mb-2"],[1,"flex","justify-between"],[1,"text-gray-500"],[1,"font-medium"],[1,"flex","justify-between","pt-2","mt-2","border-t","border-gray-200"],[1,"text-gray-700","font-bold"],[1,"text-gray-900","font-bold"],[1,"p-2","border-2","border-dashed","border-gray-300","rounded-xl","mb-6","shadow-sm"],["alt","QR Code PIX",1,"w-64","h-64","object-contain",3,"src"],[1,"w-full","max-w-xs","space-y-4"],[1,"w-full","text-white","font-medium","px-6","py-3","rounded-lg","shadow-md","transition-all","duration-200","flex","justify-center","items-center","gap-2","transform","active:scale-95",3,"click","ngClass"],[4,"ngIf"],["type","button",1,"w-full","border","border-[--primary-background-text-color]/20","bg-white","text-[--primary-background-text-color]","font-semibold","px-6","py-3","rounded-lg","shadow-sm","transition-all","duration-200","flex","justify-center","items-center","gap-2","hover:bg-[--primary-background-text-color]/5","disabled:opacity-60","disabled:cursor-not-allowed",3,"click","disabled"],["xmlns","http://www.w3.org/2000/svg","class","h-5 w-5","fill","none","viewBox","0 0 24 24","stroke","currentColor",4,"ngIf"],["class","animate-spin h-5 w-5","xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24",4,"ngIf"],["class","text-sm px-4 py-3 rounded-lg border",3,"ngClass",4,"ngIf"],[1,"bg-orange-50","text-orange-800","text-sm","px-4","py-3","rounded-lg","border","border-orange-100","flex","items-center","justify-center","gap-2"],["xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24","stroke","currentColor",1,"h-5","w-5","text-orange-500"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"],[1,"font-bold"],[1,"bg-slate-50","text-slate-700","text-sm","px-4","py-3","rounded-lg","border","border-slate-200"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M5 13l4 4L19 7"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M4 4v5h.582m14.836 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-14.357-2M15 15h5"],["xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24",1,"animate-spin","h-5","w-5"],["cx","12","cy","12","r","10","stroke","currentColor","stroke-width","4",1,"opacity-25"],["fill","currentColor","d","M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",1,"opacity-75"],[1,"text-sm","px-4","py-3","rounded-lg","border",3,"ngClass"],[1,"flex","flex-col","items-center","justify-center","py-10"],["xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24",1,"animate-spin","h-10","w-10","text-[--primary-background-text-color]","mb-4"],[1,"text-gray-500","font-medium"],[1,"flex","flex-col","items-center","justify-center","py-20"],["class","max-w-lg mx-auto",4,"ngIf"],["xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24",1,"animate-spin","h-12","w-12","text-[--primary-background-text-color]","mb-4","mx-auto"],[1,"text-gray-500","font-medium","text-lg","text-center"],[1,"max-w-lg","mx-auto"],[1,"bg-orange-50","border-2","border-orange-500","rounded-xl","p-8","text-center","shadow-lg"],["xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24","stroke","currentColor",1,"h-16","w-16","text-orange-500"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"],[1,"text-2xl","font-bold","text-orange-600","mb-3"],[1,"text-orange-700","text-base","mb-4"],[1,"text-orange-600","text-sm"]],template:function(e,i){if(e&1&&x(0,W0,11,9,"section",2)(1,Y0,3,2,"ng-template",null,0,ve),e&2){let r=Z(2);h("ngIf",i.Reserva)("ngIfElse",r)}},dependencies:[lt,Ce,oe,Ka,bi,Pe],encapsulation:2})}};var Z0=[{path:"",redirectTo:"Cart",pathMatch:"full"},{path:"Cart",component:Yn,data:{breadcrumb:"Carrinho",title:`Carrinho de Compras | ${pe.
24SITE_TITLE}`}},{path:"Payment",component:Vr,data:{breadcrumb:"Pagamento",title:`Pagamento | ${pe.SITE_TITLE}`}},{path:"Confirmation",component:Ur,data:{breadcrumb:"Confirma\xE7\xE3o de Pagamento",title:`Confirma\xE7\xE3o de Pagamento | ${pe.SITE_TITLE}`}},{path:"Pix",component:Hr,data:{breadcrumb:"Pix",title:`Pagamento via Pix | ${pe.SITE_TITLE}`}},{path:"**",redirectTo:"Cart"}],$r=class n{static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275mod=_i({type:n})}static{this.\u0275inj=fi({imports:[Jr.forChild(Z0),Jr]})}};var mc=class n{static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275mod=_i({type:n})}static{this.\u0275inj=fi({providers:[Dt,uc()],imports:[Fn,$r,jn,ss,qi,Vn,us]})}};export{cC as a,dC as b,kI as c,AI as d,Gt as e,tf as f,jI as g,yn as h,Ca as i,Ia as j,nf as k,Gn as l,vs as m,nn as n,av as o,Nt as p,Di as q,u_ as r,p_ as s,m_ as t,h_ as u,f_ as v,on as w,Ts as x,g_ as y,v_ as z,wr as A,Nr as B,m1 as C,Mr as D,uc as E,pc as F,Br as G,mc as H};

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.