if(!customElements.get("remex-p2p")){const e="dev"!=document.querySelector('meta[name="app-env"]')?.getAttribute("content"),t=document.querySelector('meta[name="x-cpl"]')?.getAttribute("content")||"1.0.0";_loadScript=async(n,i)=>new Promise(((a,r)=>{if(i&&customElements.get(i))a(!0);else{const o=document.createElement("script");i&&(o.tik=setInterval((()=>{customElements.get(i)&&(clearInterval(o.tik),a(!0))}),100)),o.src=`/cdn/${t}/${e?n.replace(".min.js","").replace(".js",".min.js"):n}`,o.async=!0,o.onload=()=>{o.tik&&clearInterval(o.tik),a(!0)},o.onerror=()=>{o.tik&&clearInterval(o.tik),r(!1)},document.head.appendChild(o)}})),_loadScript("microfronts/remex-icon/index.js","remex-icon"),_loadScript("microfronts/remex-p2p/routing.js","remex-router"),_loadScript("microfronts/remex-select/index.js","remex-select"),_loadScript("microfronts/remex-p2p/menu.js","remex-p2p-menu"),_loadScript("microfronts/remex-p2p/header.js","remex-p2p-header"),
_loadScript("microfronts/remex-dialog/index.js","remex-dialog"),_loadScript("microfronts/remex-card-loading/index.js","remex-card-loading"),_loadScript("microfronts/remex-pagginator/index.js","remex-pagginator"),document.querySelector(`script[src="/cdn/${t}/js/remex/tooltip${e?".min":""}.js"]`)||_loadScript("js/remex/tooltip.js");class n extends HTMLElement{constructor(){switch(super(),this.uniqueSuffix="_"+Math.random().toString(36).substr(2,9),this.classList.add(this.uniqueSuffix),this.isTelegram="undefined"!=typeof Telegram&&Telegram.WebApp&&Telegram.WebApp.initData,
this.defaultStyles=` \n :host{color:var(--text-color, #005f75);} \n h5{color:var(--text-color,#000) !important;}\n .${this.uniqueSuffix} .auth-form { max-width: 100%; margin: auto; padding: 20px; background: #ffffff0a; border-radius: 4px; box-shadow: none; text-align: center;border: 1px solid var(--input-bg,--auth-input-light-border-color,#127a8b);animation: fadeInAnimation .5s ease-in-out;}\n .${this.uniqueSuffix} .auth-form .auth-button { background: #18a2b8 !important;color: #ffffff !important; }\n .${this.uniqueSuffix} .auth-form label { color: #c7dade !important; }\n .${this.uniqueSuffix} .auth-form .auth-button-cancel{ color: #c7dade !important; }\n .${this.uniqueSuffix} .auth-form .auth-footer a { color: #afbec1 !important;} \n .${this.uniqueSuffix} .auth-form .recovery-password-action { color: #afbec1 !important;} \n .${this.uniqueSuffix} .auth-form .auth-footer a b {font-size: 14px;color: #fff !important;}\n .${this.uniqueSuffix} .auth-form .action-help { color: #a8aaab !important;} \n .${this.uniqueSuffix} .auth-form .auth-subtitle { color: #ffffff !important;} \n .${this.uniqueSuffix} .auth-form .auth-input-icon { color:#072932 !important;} \n .${this.uniqueSuffix}{ -webkit-transition: all 1s ease-in-out; -moz-transition: all 1s ease-in-out;-o-transition: all 1s ease-in-out;transition: all 1s ease-in-out;transition: all 1s ease-in-out;}\n\n .${this.uniqueSuffix} input[name="intentAmount"]::-webkit-inner-spin-button,\n .${this.uniqueSuffix} input[name="intentAmount"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }\n .${this.uniqueSuffix} input[name="intentAmount"] {-moz-appearance: textfield;}\n .${this.uniqueSuffix} .btn-tab,.${this.uniqueSuffix} .btn-tab:hover{background: var(--tab-btn-bg,#fff) !important;color: var(--tab-btn-text,#015f75) !important;}\n .${this.uniqueSuffix} .btn-tab-active,.${this.uniqueSuffix} .btn-tab-active:hover{background: var(--tab-btn-active-bg,#ffffff1a) !important;color: var(--tab-btn-active-text,#FFF) !important;box-shadow:0px 0px 1px #015f75 !important;}\n .${this.uniqueSuffix} .announcement-details{display:none;}\n .${this.uniqueSuffix}.choiced .anouncement,\n .${this.uniqueSuffix}.choiced .btn-intent{display:none;} \n .${this.uniqueSuffix}.choiced .intent-nav{display:none;} \n .${this.uniqueSuffix} .nickname{background: linear-gradient(276.46deg, #03a9f4 1.16%, #00bcd4 51.05%, rgb(182 182 182) 105.69%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;text-fill-color: transparent;font-family: Mija !important;font-size:calc(1rem + 0.4vw)!important}\n .${this.uniqueSuffix}.choiced .anouncement.choiced{display:block;}\n .${this.uniqueSuffix}.choiced .announcement-details{display:flex;background: linear-gradient(0deg, rgb(230 249 254 / 5%) 0%, rgb(4 86 107 / 0%) 82%);border-bottom-left-radius: 14px;border-bottom-right-radius: 14px;}\n .${this.uniqueSuffix} .announcement-terms{max-height: 300px;overflow: auto;border:1px solid rgb(23 86 102 / 86%)}\n .${this.uniqueSuffix} .announcement-terms::-webkit-scrollbar {width: 2px;}\n .${this.uniqueSuffix} .announcement-terms::-webkit-scrollbar-track {background:rgba(255, 255, 255, 0.1);border-radius: 2px;}\n .${this.uniqueSuffix} .announcement-terms::-webkit-scrollbar-thumb {background:rgba(221, 250, 255, 0.86);border-radius: 1px;}\n .${this.uniqueSuffix} .announcement-terms::-webkit-scrollbar-thumb:hover {background: #ffffff00;}\n .${this.uniqueSuffix} .announcement-terms::-webkit-scrollbar-track-piece {background: #f9f9f900;}\n .${this.uniqueSuffix} .verified-item{ color: var(--text-primary-color,#3dbeda) !important;}\n .${this.uniqueSuffix} .verified-item:after{content: '✔';color:var(--text-primary-color,#3dbeda);margin-left: 2px;margin-right: 2px;}\n .${this.uniqueSuffix} .nav-link{color: var(--nav-text,white);text-transform: uppercase;font-family:Mija !important;font-weight: bold;font-size:calc(0.8rem + 0.6vw)!important}\n .${this.uniqueSuffix} .nav-link.active{color:var(--text-primary-color,#3dbeda);border-bottom: 1px solid var(--text-primary-color,#3dbeda);} \n .${this.uniqueSuffix} #deal-unseen{display:none;color:white !important;animation: borderCircleInfinitedAnimated 1s infinite;background:var(--text-primary-color,#3dbeda); border-radius: 1rem; min-width: 12px; min-height: 12px; margin-left: 2px; font-size: 0.5rem !important; padding: 0.2rem; position: relative; top: -4px;}\n @keyframes borderCircleInfinitedAnimated {0% {box-shadow: 0 0 0 0 rgba(61, 190, 218, 0.7);}100% {box-shadow: 0 0 0 10px rgba(61, 190, 218, 0);}}\n .bg-dark{\n background-color: var(--bg-primary , #005f75 ) !important;\n }\n .btn.btn-dark{\n background-color: var(--bg-primary , #005f75 ) !important;\n }\n .show-sm{display:none;}\n @media(min-width:992px){.${this.uniqueSuffix} .hidden-lg{display:none;} .bk-lg{display:block;} }\n @media(max-width:992px){.${this.uniqueSuffix} .show-sm{display:block;} .hidden-sm{display:none;}.${this.uniqueSuffix} .onlinestatus{margin-top:-16px}.${this.uniqueSuffix}.choiced ${this.uniqueSuffix} .badge-sm{background: #2f7e8f; border-radius: 5px; padding: 2px 4px; margin-right: 4px;display: flex;align-items: center;justify-content: center;}}\n @media(max-width:768px){.${this.uniqueSuffix} .hidden-xs{display:none;}.${this.uniqueSuffix} .onlinestatus{margin-top:-16px}.${this.uniqueSuffix}.choiced .${this.uniqueSuffix}.choiced .announcement-details{display:flex;background:transparent;}}\n .btn-navigation-back){ animation: fadeIn .5s ease-in-out; transition: all 0.5s ease-in-out; }\n #${this.uniqueSuffix}anouncementsContainer{color:var(--text-color, #005f75);}\n `,
this.loadingHtml='',this.overrideStyles=null,this.data={},this.wallet=null,this.lang=document.querySelector("html")?.getAttribute("lang")??"es",this.lang){case"es":this.i18n={"You already have an ad to sell SRM created, you must delete it to be able to create another one.":"Ya tienes un anuncio para vender SRM creado, debes eliminarlo para poder crear otro.","You already have an ad to buy SRM created, you must delete it to be able to create another one.":"Ya tienes un anuncio para comprar SRM creado, debes eliminarlo para poder crear otro.","The announcement has been withdrawn":"El anuncio ha sido retirado","Payment method not found":"Método de pago no encontrado","The owner of announcement does not accept this payment method.":"El anunciante no acepta este método de pago.","The advertiser has already committed their balance":"El anunciante ya ha comprometido su saldo",
"Your balance is not enough for this deal.":"Tu saldo no es suficiente para este trato.","Seller balance is not enough for this deal.":"El saldo del vendedor no es suficiente para este trato.","P2P seles is disabled for seller customer level.":"Las ventas de saldo estan desabilitdas en el nivel de cliente del vendedor","The amount exceeds the maximum allowed in the seller customer level.":"El monto excede el máximo permitido en el nivel de cliente del vendedor","The seller has exceeded the maximum number of allowed daily operations.":"El vendedor ha superado el número máximo de operaciones diarias permitidas.","You can not buy your own announcement.":"No eres el anunciante de este anuncio","The advertiser has already committed their balance.":"El anunciante ya ha comprometido su saldo","The owner of announcement does not accept this payment method.":"El anunciante no acepta este método de pago","Payment method not found.":"Forma de pago no encontrado",
"The announcement has been withdrawn.":"El anuncio ha sido retirado","Announcement not found.":"Anuncio no encontrado","Your balance is not enough for this deal.":"Tu saldo no es suficiente para este trato.","Seller balance is not enough for this deal.":"El saldo del vendedor no es suficiente para este trato.","This deal had already been cancelled.":"Este trato ya había sido cancelado.","This deal had already been accepted.":"Este trato ya había sido aceptado.","This deal had already been completed.":"Este trat ya había sido completado.","Deal not found.":"Trato no encontrado.","Let us avoid sharing contact information and using words that are prohibited in the terms of the advertisement.":"Evitemos compartir información de contacto y usar palabras prohibidas en los términos del anuncio.",
"You must define the terms of the announcement, so we can show your counterparty what your conditions are for creating a deal.":"Debes definir los términos del anuncio, para que podamos mostrarle a tu contraparte cuáles son tus condiciones para crear un trato."};break;case"en":this.i18n={"No hay tratos para mostrar.":"No deals to show.","No tienes anuncios que administrar.":"You have no ads to manage.","Mis Tratos":"My Deals","Mis anuncios P2P":"My P2P Announcement","Publica un anuncio":"Post an Announcement","Anuncio creado correctamente":"Announcement created successfully","El Anuncio ha sido actualizado":"The Announcement has been updated","El Anuncio ha sido eliminado":"The Announcement has been deleted","Ocurrió un error cargando los detalles del anuncio, por eso te redireccionamos nuevamente a la lista de anuncios.":"An error occurred loading the announcement details, so we redirect you back to the list of announcements.",
"No se encontró el anuncio solicitado":"The requested announcement was not found","Todos los pagos (*)":"All payment methods (*)",Anuncios:"Announcements",Entendido:"Understood","Para acceder a esta sección debes estar autenticado":"To access this section you must be authenticated","Serás redireccionado a la pantalla de autenticación":"You will be redirected to the authentication screen",Anunciante:"Advertiser",Indicadores:"Indicators",Cantidad:"Amount",Precio:"Price","Método de pago":"Payment method",Estado:"Status",Fecha:"Date",Acciones:"Actions","Ver detalles":"View details",Aceptar:"Accept",Cancelar:"Cancel",Cerrar:"Close",Publicar:"Post",Editar:"Edit",Eliminar:"Delete",Comprar:"Buy",Vender:"Sell","Reputación":"Reputation",Tratos:"Deals","Menú":"Menu","Formas de pago":"Payment methods","Límites":"Limits","Ocurrió un error al crear el trato, inténtelo luego":"An error occurred creating the deal, please try again later",
"Debes iniciar sesión para poder crear un trato":"You must log in to create a deal"};break;default:this.i18n={}}this.onInitialized=()=>{};const e=JSON.parse(window.localStorage.getItem("remex-p2p-filter")??null);this._filterState=e??{intent:"buy",paymentMethod:"*",amount:null,pgSize:50,pg:1};const t=this;this.filterState=new Proxy(this._filterState,{set(e,n,i){if(e[n]!==i){e[n]=i;const a=new CustomEvent("filterStateChanged",{detail:{property:n,value:i},bubbles:!0,composed:!0});window.localStorage.setItem("remex-p2p-filter",JSON.stringify(t._filterState)),t.dispatchEvent(a)}return!0}}),this.debounceTimer=null,this.initialized=!1,this.observer=new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&(this.data[e.attributeName]=this.getAttribute(e.attributeName)||"",this.refresh())}))})),this.router=new i,this.setupRouterListeners(),this.addEventListener("forceauth",(async e=>this.redirectToAuth())),
this.addEventListener("showpeer",(e=>this.router.navigate("/p2p/profile/"+e.detail))),this.addEventListener("force-navigate",(e=>this.router.navigate(e.detail))),this.addEventListener("profile",(e=>{this.router.navigate("/p2p/profile/me")})),this.addEventListener("wallet-refresh",(e=>{this.wallet=e.detail})),this.addEventListener("deal-confirmed",(async e=>{this.querySelector("remex-p2p-header")&&(await this.querySelector("remex-p2p-header").refresh(),this.querySelector("remex-p2p-header").updateWalletInfo())})),this.addEventListener("deal-canceled",(async e=>{this.querySelector("remex-p2p-header")&&(await this.querySelector("remex-p2p-header").refresh(),this.querySelector("remex-p2p-header").updateWalletInfo())})),this.addEventListener("deal-accepted",(async e=>{this.querySelector("remex-p2p-header")&&(await this.querySelector("remex-p2p-header").refresh(),this.querySelector("remex-p2p-header").updateWalletInfo())})),this.addEventListener("RemexAuthLogout",(async e=>{
this.querySelector("remex-p2p-header")&&(this.querySelector("remex-p2p-header").headers=await this.buildRequestHeaders(),await this.querySelector("remex-p2p-header").refresh(),this.querySelector("remex-p2p-header").updateWalletInfo())})),this.addEventListener("RemexAuthLogged",(async e=>{this.querySelector("remex-p2p-header")&&(this.querySelector("remex-p2p-header").headers=await this.buildRequestHeaders(),await this.querySelector("remex-p2p-header").refresh(),this.querySelector("remex-p2p-header").updateWalletInfo())})),this.addEventListener("sessionCreated",(async e=>{this.querySelector("remex-p2p-header")&&(this.querySelector("remex-p2p-header").headers=await this.buildRequestHeaders(),await this.querySelector("remex-p2p-header").refresh(),this.querySelector("remex-p2p-header").updateWalletInfo())})),this.realtimeSuscriberInit()}static get observedAttributes(){return["intent","payment-method","amount","currency","theme"]}attributeChangedCallback(e,t,n){
"theme"===e&&this.applyTheme(n),"intent"===e&&["buy","sell"].includes(n)&&(this.filterState.intent=n),"payment-method"===e&&(this.filterState.paymentMethod=n),"amount"===e&&(this.filterState.amount=parseFloat(n)),"currency"===e&&(this.currency=n),this.initialized&&this.handleFilterStateChanged()}applyTheme(e){this.overrideStyles={dark:{"background-color":"#1a1a1a",color:"#ffffff"},light:{"background-color":"#ffffff",color:"#000000"}}[e]||null,this.refresh()}realtimeSuscriberInit(){if(!window.auth?.user?.id)return!1;new Promise(((e,t)=>{if(void 0!==window.DeepstreamClient)e(!0);else{const n=document.createElement("script");n.tik=setInterval((()=>{void 0!==window.DeepstreamClient&&(clearInterval(n.tik),e(!0))}),100),n.src="/assets/js/ds.min.js",n.async=!0,n.onload=()=>{n.tik&&clearInterval(n.tik),e(!0)},n.onerror=()=>{n.tik&&clearInterval(n.tik),t(!1)},document.head.appendChild(n)}})).then((()=>{if(void 0===window.realtime){const{DeepstreamClient:e}=window.DeepstreamClient
;window.realtime={client:new e("dev"==document.querySelector('meta[name="app-env"]')?.getAttribute("content")?"wss://dev.remesita.com/deepstream":"wss://remesita.com/deepstream"),login:()=>new Promise(((e,t)=>{"OPEN"==window.realtime.client.getConnectionState()?e(!0):window.realtime.client.login({uid:window.auth.user.id},(n=>n?e(!0):t(!1)))}))}}window.realtime.login().then((()=>{if(!this._realTime){const e=`p2p/${window.auth.user.id}`;this._realTime=window.realtime.client.record.getRecord(e),this._realTime.subscribe("deal",(e=>{}))}}))})).catch((()=>{this.chat.startPullinghMessages()}))}async checkUnseenDeals(){try{if(this.unseenChecking)return!1;this.unseenChecking=!0;const e=await fetch("/rest/v2/p2p/deal/unseen",{method:"GET",headers:await this.buildRequestHeaders()});if(e.ok){const t=await e.json();if(this.unseenChecking=!1,t.unseen>0)return this.querySelector("#deal-unseen").innerHTML=t.unseen,this.querySelector("#deal-unseen").style.display="inline-block",!0}}catch(e){}
return this.unseenChecking=!1,this.querySelector("#deal-unseen").style.display="none",!1}setupRouterListeners(){this.addEventListener("route-activated",(async e=>{setTimeout((async()=>{await this.isConnected()&&(this.querySelector("remex-p2p-header").headers=await this.buildRequestHeaders(),await this.checkUnseenDeals())}),100);const t=e.detail.route;if(this.currentRoute!=t||JSON.stringify(e.detail.params??{})!=JSON.stringify(this.currentRouteParams??{}))switch(this.currentRoute=t,this.currentRouteParams=e.detail.params??null,this.initialized||await this.renderLayout(),this.updateNavState(t),this.querySelector(".btn-navigation-back")&&this.querySelector(".btn-navigation-back").classList.remove("hidden-lg"),this.isTelegram&&(Telegram.WebApp.SettingsButton.onClick((()=>{window.navigation.back()})),Telegram.WebApp.BackButton.show(),Telegram.WebApp.SettingsButton.onClick((()=>{this.router.navigate("/p2p/menu")})),Telegram.WebApp.SettingsButton.show(),Telegram.WebApp.MainButton.hide()),t){
case"/p2p/announcements":return this.querySelector(".btn-navigation-back")&&this.querySelector(".btn-navigation-back").classList.add("hidden-lg"),this.isTelegram&&Telegram.WebApp.BackButton.hide(),this.anouncementPg=1,await this.renderAnnouncementLists();case"/p2p/my-announcements":return this.anouncementPg=1,await this.renderMyAnnouncementLists();case"/p2p/announcement/:id":return await this.renderAcnnouncementDetails(e.detail.params.id);case"/p2p/profile/:id":return await this.renderProfile("me"!=e.detail.params.id?e.detail.params.id:null);case"/p2p/announcements/new":return await this.renderAnnouncementForm();case"/p2p/announcement/edit/:id":return await this.renderAnnouncementForm(e.detail.params.id);case"/p2p/deals":return await this.renderMyDealsList();case"/p2p/deal/:id":return await this.renderDealDetails(e.detail.params.id);case"/p2p/menu":default:break;case"/p2p/payment-methods":return await this.renderPaymentMethodsSettings();case"/p2p/auth":
return await this.renderAuthForm()}}))}async renderAnnouncementForm(e){if(!await this.isConnected())return this.redirectToAuth();const t=this.container.querySelector(e?'remex-router[route="/p2p/announcement/edit/:id"]':'remex-router[route="/p2p/announcements/new"]');t.innerHTML=`
${this.loadingHtml}`,await this.loadScript("microfronts/remex-p2p/announcement-form.js","remex-announcement-form"),t.innerHTML="";const n=document.createElement("remex-announcement-form");n.i18n=this.i18n,n.headers=await this.buildRequestHeaders();const i=e?await this.fetchAnnouncementById(e):null;i&&(n.announcement=i),t.appendChild(n),n.addEventListener("created",(e=>{this.showMessage(this.trans("Anuncio creado correctamente")),this.router.navigate("/p2p/my-announcements")})),n.addEventListener("updated",(e=>{this.showMessage(this.trans("El Anuncio ha sido actualizado")),this.router.navigate("/p2p/my-announcements")})),n.addEventListener("removed",(e=>{
this.showMessage(this.trans("El Anuncio ha sido eliminado")),this.router.navigate("/p2p/announcements")}))}async renderPaymentMethodsSettings(){if(!await this.isConnected())return this.redirectToAuth();const e=this.container.querySelector('remex-router[route="/p2p/payment-methods"]');e.innerHTML=`
${this.loadingHtml}`,this.loadScript("microfronts/remex-message/index.js","remex-message").then((()=>{const e=document.createElement("remex-message");e.message=this.trans("Ocurrió un error cargando los detalles del anuncio, por eso te redireccionamos nuevamente a la lista de anuncios."),e.duration=3e3,e.position="bottom-left",e.color="danger",document.body.appendChild(e),this.router.navigate("/p2p/announcements"),this.isTelegram&&Telegram.WebApp.MainButton.hide()}))})),i.setAttribute("evlistened","yes")),i.headers=await this.buildRequestHeaders(),i.data=n}else this.showError("No se encontró el anuncio solicitado"),this.router.navigate("/p2p/announcements")}async renderMyDealsList(){
if(!await this.isConnected())return this.redirectToAuth();const e=this.container.querySelector('remex-router[route="/p2p/deals"]');e.innerHTML=`
${this.loadingHtml}`,[this.tabBuy,this.tabSell].filter((e=>null!=e)).forEach((e=>{e.addEventListener("click",(e=>{this._filterState.pg=1;const t=e.target.classList.contains("btn-tab-buy")?"buy":"sell";this.tabBuy.classList.toggle("btn-tab-active","buy"==t),this.tabBuy.classList.toggle("btn-tab","buy"!=t),this.tabSell.classList.toggle("btn-tab-active","sell"==t),this.tabSell.classList.toggle("btn-tab","sell"!=t),this.filterState.intent=t,this.dispatchEvent(new CustomEvent("intent",{detail:t}))}))})),this.methodIntent=this.container.querySelector('remex-select[name="intentPaymentMethod"]'),this.methodIntent.addEventListener("change",(e=>{this.filterState.paymentMethod=e.target.value,this._filterState.pg=1,this.dispatchEvent(new CustomEvent("intentPaymentMethod",{detail:this.intentPaymentMethod}))})),
this.amountIntent=this.container.querySelector('input[name="intentAmount"]'),this.amountIntent.addEventListener("input",(e=>{this._filterState.pg=1,this.filterState.amount=e.target.value,this.dispatchEvent(new CustomEvent("intentAmount",{detail:e.target.value}))})),this._paymentMethods?(this.methodIntent.items=this._paymentMethods,this.methodIntent.value=this._filterState.paymentMethod??"*",this.handleFilterStateChanged()):setTimeout((async()=>{const e=[{id:"*",name:this.trans("Todos los pagos (*)"),isActive:!0}],t=await this.fetchPaymentMethods();e.push(...t),this._paymentMethods=e.map((e=>({value:e.id,label:e.name.toUpperCase(),group:e.groupType,img:e.logo?`https://remesita.s3.amazonaws.com/uploads/logos/${e.logo}`:null,disabled:!e.isActive}))),this.methodIntent.items=this._paymentMethods,this.methodIntent.value=this._filterState.paymentMethod??"*",this.handleFilterStateChanged()}),100)}async loadScript(e,t){return _loadScript(e,t)}async init(){
this.cpl=document.querySelector('meta[name="x-cpl"]')?.getAttribute("content")??this.cookies?.fetch("x-cpl")??"1.0.0",this.initialized=!0,this.overrideStyles=!1,await window.auth.checkUserIsLogged(),this.dispatchEvent(new CustomEvent("initialized")),this.onInitialized(),setTimeout((async()=>{if(this.isTelegram){const e=Telegram.WebApp.initData,t=new URLSearchParams(e).get("start_param");t&&this.router.navigate("/p2p/"+t.replace(/__/g,"/"))}}),1)}connectedCallback(){this.observer.observe(this,{attributes:!0}),this.addEventListener("filterStateChanged",this.handleFilterStateChanged.bind(this)),this.refresh()}disconnectedCallback(){this.observer.disconnect(),this.removeEventListener("filterStateChanged",this.handleFilterStateChanged.bind(this))}attributeChangedCallback(e,t,n){void 0===this.data[e]&&t!=n&&(this.data[e]=n,this.refresh())}trans(e,t){let n=void 0!==this.i18n[e]?(this.i18n[e]??e).trim():e.trim();if(void 0!==t)for(var e in t)n=n.replace(e,t[e]).trim();return n.trim()}
createApiUrl(e){return`https://${document.querySelector('meta[name="app-env"]')&&"dev"==document.querySelector('meta[name="app-env"]').getAttribute("content")?"dev-api":"api"}.remesita.com/rest/v1/${e}`}refresh(){this.overrideStyles&&(this.initialized=!1),setTimeout((async()=>await this.renderLayout()),1)}async renderLayout(){if(!this.initialized){let e="";if(this.overrideStyles)for(let t in this.overrideStyles){let n=[];for(let e in this.overrideStyles[t])n.push(`${e}:${this.overrideStyles[t][e]};`);e+=`.${this.uniqueSuffix} ${t} {${n.join("")}}`}this.innerHTML=`\n \n \n `,this.container=document.createElement("div"),this.isTelegram&&(this.container.style.cssText="min-height: 100vh; display: flex ; align-content: flex-start;"),this.appendChild(this.container),
[this.uniqueSuffix,"col-12","px-0","py-2","row","mx-0"].forEach((e=>this.container.classList.add(e))),this.intent="buy"}
return this.container.innerHTML=` \n
\n \n
\n \n \x3c!--\n
\n \n Estamos en Beta: Esto significa que estamos haciendo pruebas, aunque la mayoría de las herramientas son funcionales. Te agradeceríamos que informes cualquier inconveniente.\n
${this.trans(e.total?"No hay anuncios para mostrar en esta página.":"buy"==this._filterState.intent?"Nadie esta vendiendo SRM bajo con este criterio.":"Nadie esta comprando SRM con este criterio.")}