mk-sdk-git 1.1.25 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mk-core.js +1 -1
- package/dist/mk-sdk.js +1 -1
- package/package.json +1 -1
- package/src/tryon/bridge.js +30 -15
- package/src/tryon/launchers/index.js +18 -0
- package/src/tryon/launchers/mkfashion.js +19 -0
- package/src/tryon/launchers/pulpoar.js +86 -0
package/dist/mk-core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var ir=Object.defineProperty;var I=(t,e)=>{for(var r in e)ir(t,r,{get:e[r],enumerable:!0})};var mt={collectorUrl:"https://api-collector.mk3dlabs.com",appUrl:"https://mkfashion.mk3dlabs.com/visualizer",apiUrl:"https://mkfashion-new-api.mk3dlabs.com"},cr={},F=null;function ht(){if(F)return F;let t=null;try{t=document.currentScript||document.querySelector("script[data-mk-project]")||document.querySelector('script[src*="mk-sdk"]')||document.querySelector('script[src*="mk-pixel"]')}catch(i){}let e=i=>{try{return t&&t.getAttribute(i)}catch(c){return null}},r=e("data-mk-project")||e("data-mk-client")||window.__MK&&(window.__MK.projectId||window.__MK.clientSlug)||null,n=e("data-mk-product")||window.__MK&&window.__MK.product||"mk-fashion",o=e("data-mk-collector")||window.__MK&&window.__MK.collectorUrl||cr.collectorUrl||mt.collectorUrl;return F={projectId:r,product:n,collectorUrl:o,appUrl:window.__MK&&window.__MK.appUrl||mt.appUrl,apiUrl:window.__MK&&window.__MK.apiUrl||mt.apiUrl,debug:!!(e("data-mk-debug")!==null||window.__MK&&window.__MK.debug||/[?&]mkdebug\b/.test(location.search)),observe:!!(window.__MK&&window.__MK.observe),forceButton:!!(window.__MK&&window.__MK.forceButton),anchor:window.__MK&&window.__MK.anchor||null,cartRedirect:!(window.__MK&&window.__MK.cartRedirect===!1),cartBehavior:window.__MK&&window.__MK.cartBehavior||null,cartOpenSelector:window.__MK&&window.__MK.cartOpenSelector||null,autoTrack:e("data-mk-no-autotrack")===null,batchIntervalMs:window.__MK&&window.__MK.batchIntervalMs||8e3,batchMaxSize:window.__MK&&window.__MK.batchMaxSize||20,engagementIntervalMs:15e3},F}function m(){return F||ht()}function y(...t){let e=m();e&&e.debug&&typeof console!="undefined"&&console.log("[mk-sdk]",...t)}var Vt="_mk_vid",Jt="_mk_sid",D=null,q=null;function G(){return typeof crypto!="undefined"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function Wt(){if(D)return D;try{let t=localStorage.getItem(Vt);return t||(t="v_"+G(),localStorage.setItem(Vt,t)),D=t,t}catch(t){return D="v_"+G(),D}}function Gt(){if(q)return q;try{let t=sessionStorage.getItem(Jt);return t||(t="s_"+G(),sessionStorage.setItem(Jt,t)),q=t,t}catch(t){return q="s_"+G(),q}}var Xt=[/email/i,/e-?mail/i,/cpf/i,/cnpj/i,/phone/i,/telefone/i,/celular/i,/address/i,/endereco/i,/cep/i,/zip/i,/card/i,/cartao/i,/cvv/i,/password/i,/senha/i,/token/i,/\bnome\b/i,/fullname/i,/firstname/i,/lastname/i,/sobrenome/i,/birth/i,/nascimento/i,/rg\b/i],Yt={imageUrl:1,image:1,thumbnail:1,photo:1,imageBase64:1,src:1},yt=2e3;function Zt(t){for(let e=0;e<Xt.length;e++)if(Xt[e].test(t))return!0;return!1}function Qt(t){if(!t||typeof t!="object"||Array.isArray(t))return typeof t=="string"&&t.length>yt?t.slice(0,200)+"...[truncated "+t.length+"B]":t;let e={};for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||Zt(r))continue;let n=t[r];if(Yt[r]){e[r+"Present"]=!!n;continue}if(typeof n=="string"&&n.length>yt){e[r]=n.slice(0,200)+"...[truncated "+n.length+"B]";continue}if(n&&typeof n=="object"&&!Array.isArray(n)){e[r]=ar(n);continue}e[r]=n}return e}function ar(t){let e={};for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||Zt(r))continue;let n=t[r];if(Yt[r]){e[r+"Present"]=!!n;continue}if(typeof n=="string"&&n.length>yt){e[r]=n.slice(0,200)+"...[truncated]";continue}e[r]=n}return e}var X=[],gt=null,R=null,lr=["off","pdp_tryon","pdp","all","tryon_engaged"],z,wt=null,Y="unknown",j=[],P=null;function ee(){let t=m();return"mk_engaged_"+(t&&t.projectId||"")}function xt(){if(P!==null)return P;try{P=localStorage.getItem(ee())==="1"}catch(t){P=!1}return P}function re(){if(!xt()){P=!0;try{localStorage.setItem(ee(),"1")}catch(t){}Z(!1)}}var sr=/^purchase$/;function ne(t,e){if(z===void 0)return"hold";if(z==="off")return"drop";if(z==="all"||e&&sr.test(e))return"collect";switch(z){case"pdp":return t==="pdp"?"collect":"drop";case"tryon_engaged":if(xt())return"collect";case"pdp_tryon":return t!=="pdp"?"drop":Y==="available"?"collect":Y==="unavailable"?"drop":"hold";default:return"collect"}}function Z(t){if(!j.length)return;let e=[];for(let r of j){let n=ne(r._pt,r.name);n==="collect"?ce(r.name,r.params,r.ts):n==="hold"&&!t&&e.push(r)}j=e}function bt(t){z=lr.indexOf(t)>=0?t:"all",Z(!1)}function oe(t){Y=t==="available"?"available":"unavailable",Z(!1)}function ie(t){Z(!0),R=t,wt=t&&t.pageType||null,Y="unknown"}function s(t,e,r){if(!m().projectId){(s._pre=s._pre||[]).push({name:t,params:e,ts:r||Date.now()}),s._pre.length>50&&s._pre.shift();return}if(s._pre&&s._pre.length){let o=s._pre;s._pre=[];for(let i of o)te(i.name,i.params,i.ts)}te(t,e,r)}function te(t,e,r){let n=ne(wt,t);if(n==="collect"){ce(t,e,r);return}if(n==="drop"){y("descartado (escopo)",t);return}j.push({name:t,params:e,ts:r||Date.now(),_pt:wt}),j.length>300&&j.shift()}function ce(t,e,r){let n=m(),o=Qt(e||{}),i="page_"+ur(t);if(X.push({name:i,ts:r||Date.now(),params:o}),y("queued",t,o),n.observe)try{window.postMessage({__mkpixel:!0,event:{name:i,params:o},site:R?{pageType:R.pageType,platform:R.platform,url:R.url}:null},"*")}catch(c){}if(X.length>=n.batchMaxSize){A();return}gt||(gt=setTimeout(()=>{gt=null,A()},n.batchIntervalMs))}function ur(t){if(typeof t!="string"||!t)return"unknown";let e=t.replace(/^on/,"");return e=e.replace(/[A-Z]/g,(r,n)=>(n>0?"_":"")+r.toLowerCase()),e.indexOf("page_")===0&&(e=e.slice(5)),e}function A(t){if(X.length===0)return;let e=m();if(!e.projectId||!e.collectorUrl)return;let r=X.splice(0,50),n=JSON.stringify({product:e.product||void 0,visitorId:Wt(),sessionId:Gt(),engaged:xt()||void 0,events:r,site:R||void 0}),o=e.collectorUrl+"/v1/track";try{fetch(o,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json","X-MK-Project-Id":e.projectId},body:n}).catch(()=>{})}catch(i){try{navigator.sendBeacon&&navigator.sendBeacon(o+"?projectId="+encodeURIComponent(e.projectId),new Blob([n],{type:"text/plain"}))}catch(c){}}}function ae(){try{window.addEventListener("pagehide",()=>A(!0)),window.addEventListener("beforeunload",()=>A(!0)),document.addEventListener("visibilitychange",()=>{document.hidden&&A(!0)})}catch(t){}}function k(t){let e=[];try{let r=document.querySelectorAll('script[type="application/ld+json"]');for(let n of r){let o;try{o=JSON.parse(n.textContent)}catch(c){continue}let i=[];Array.isArray(o)?i.push(...o):o["@graph"]?i.push(...o["@graph"]):i.push(o);for(let c of i){if(!c||!c["@type"])continue;let l=Array.isArray(c["@type"])?c["@type"]:[c["@type"]];(!t||t.some(u=>l.includes(u)))&&e.push(c)}}}catch(r){}return e}var le=["off","pdp_tryon","pdp","all","tryon_engaged"],dr="all",fr=30*60*1e3,B=null;function N(){if(B)return B;let t=m();return!t.projectId||!t.apiUrl?(B=Promise.resolve(null),B):(B=fetch(t.apiUrl+"/projects/"+t.projectId).then(e=>e.ok?e.json():null).then(e=>e&&e.project||e||null).catch(()=>null),B)}function se(t){let e=t&&t.analytic&&t.analytic.scope;return le.indexOf(e)>=0?e:dr}var ue=t=>"mk_scope_"+t;function de(t){try{let e=localStorage.getItem(ue(t));if(!e)return null;let r=JSON.parse(e);return!r||typeof r.exp!="number"||r.exp<Date.now()?null:le.indexOf(r.scope)>=0?r.scope:null}catch(e){return null}}function fe(t,e){try{localStorage.setItem(ue(t),JSON.stringify({scope:e,exp:Date.now()+fr}))}catch(r){}}var _t={};I(_t,{addToCart:()=>yr,detect:()=>mr,getCartSummary:()=>gr,id:()=>pr,openCartDrawer:()=>br,resolveSku:()=>hr});var pr="shopify";function mr(){return!!(window.Shopify||window.ShopifyAnalytics)}function hr(){let t=window;return t.ShopifyAnalytics&&t.ShopifyAnalytics.meta&&t.ShopifyAnalytics.meta.product?{value:String(t.ShopifyAnalytics.meta.product.id),source:"shopify"}:null}var Q=t=>String(t==null?"":t).trim().toLowerCase();async function yr({size:t,color:e,sku:r,quantity:n}){let o=(location.pathname.split("/products/")[1]||"").split(/[?#]/)[0];if(!o)throw new Error("shopify: sem handle de produto na URL (n\xE3o \xE9 PDP?)");let c=(await fetch("/products/"+o+".js").then(a=>a.json())).variants||[],l=a=>[a.option1,a.option2,a.option3].concat(String(a.title||"").split("/")).map(Q).filter(Boolean),u=(a,f)=>l(a).indexOf(Q(f))>=0,d=a=>(!t||u(a,t))&&(!e||u(a,e)),h=null;if((t||e)&&(h=c.find(a=>d(a)&&a.available)||c.find(d)),!h&&r&&(h=c.find(a=>Q(a.sku)===Q(r))),h||(h=c.find(a=>a.available)||c[0]),!h)throw new Error("shopify: variante n\xE3o encontrada");let x=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:h.id,quantity:n||1}]})});if(!x.ok)throw new Error("shopify: /cart/add.js HTTP "+x.status);return{platform:"shopify",variantId:h.id,size:h.title,sku:h.sku||null}}async function gr(){try{let t=await fetch("/cart.js",{headers:{Accept:"application/json"}}).then(e=>e.json());return{value:(Number(t.total_price)||0)/100,itemCount:Number(t.item_count)||0,currency:t.currency||null}}catch(t){return null}}var wr=["[data-cart-drawer-toggle]",'[data-action="open-cart-drawer"]','[data-action="open-cart"]',".js-cart-drawer-open",".js-drawer-open-cart",".cart-drawer-toggle",".js-cart-toggle",'[aria-controls="CartDrawer"]','[aria-controls="cart-drawer"]',"#cart-icon-bubble","#lk-cart-icon",".header__cart",".site-header__cart",".cart-link",".header-cart",'a[href="/cart"]','a[href$="/cart"]'];function xr(t){try{let e=t.getBoundingClientRect();return e.width>0&&e.height>0&&getComputedStyle(t).visibility!=="hidden"}catch(e){return!1}}function br(){let t=null;for(let e of wr)try{if(t=[...document.querySelectorAll(e)].find(xr),t)break}catch(r){}return t?(setTimeout(()=>{try{t.click()}catch(e){}},300),!0):!1}var vt={};I(vt,{addToCart:()=>kr,detect:()=>Cr,getCartSummary:()=>Sr,id:()=>_r,resolveSku:()=>vr});var _r="hybris";function Cr(){return!!(window.ACC&&window.ACC.config)}function vr(){let t=(location.pathname||"").match(/\/p\/([^/?#]+)/);return t&&t[1]?{value:decodeURIComponent(t[1]),source:"hybris/url"}:null}var pe=t=>String(t==null?"":t).trim().toLowerCase();async function kr({size:t,quantity:e}){let r=[...document.querySelectorAll('.js-product-select-size, a[data-code], [class*="select-size"]')].filter(f=>f.getAttribute&&f.getAttribute("data-code")),n=t?r.find(f=>pe(f.textContent)===pe(t)):null;n||(n=r.find(f=>f.offsetParent!==null)||r[0]);let o=n&&n.getAttribute("data-code");if(!o)throw new Error("hybris: variante (data-code) n\xE3o encontrada");let i=document.getElementById("product--add-to-cart-form")||document.querySelector('form[action*="/cart/add"]'),c=i&&i.querySelector('[name="CSRFToken"]'),l=c&&c.value,u=i&&i.getAttribute("action")||"/cart/add";if(!l)throw new Error("hybris: CSRFToken n\xE3o encontrado");let d=new URLSearchParams;d.set("productCodePost",o),d.set("qty",String(e||1)),d.set("CSRFToken",l);let h=await fetch(u,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:d.toString()});if(!h.ok)throw new Error("hybris: "+u+" HTTP "+h.status);let x=null,a=null;try{let f=await h.clone().json(),g=f&&f.cartData;g&&(x=Ct(g.total!=null?g.total:g.totalPrice),a=g.totalUnitCount!=null?Number(g.totalUnitCount):Array.isArray(g.products)?g.products.length:null)}catch(f){}return{platform:"hybris",productCode:o,size:n.textContent.trim(),cartValue:x,itemCount:a,currency:"BRL"}}function Ct(t){if(t==null||t==="")return null;if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).replace(/[^\d.,]/g,"");if(!e)return null;let r=e.indexOf(",")>e.indexOf(".")?parseFloat(e.replace(/\./g,"").replace(",",".")):parseFloat(e.replace(/,/g,""));return Number.isFinite(r)?r:null}async function Sr(){try{let t=await fetch("/cart/async?nocache="+Date.now(),{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(c=>c.ok?c.text():"");if(!t)return null;let e=new DOMParser().parseFromString(t,"text/html"),r=e.querySelector(".minicart-total .price")||e.querySelector(".floating-cart--cart-total"),n=r?Ct(r.textContent):null,o=e.querySelector(".mini-badge"),i=o?parseInt(o.textContent,10)||0:null;return n==null&&i==null?null:{value:n,itemCount:i,currency:"BRL"}}catch(t){}try{let t=[".minicart-total .price",".js-cart-total",".cart-total",".total-price",".grand-total"];for(let e of t){let r=document.querySelector(e),n=r&&Ct(r.textContent);if(n)return{value:n,itemCount:null,currency:"BRL"}}}catch(t){}return null}var kt={};I(kt,{addToCart:()=>Lr,detect:()=>Ar,getCartSummary:()=>Ir,id:()=>Tr,resolveSku:()=>Er});var Tr="vtex";function Ar(){return!!(window.vtex||window.vtexjs||window.vtxctx||window.skuJson_0)}function Er(){let t=window;return t.vtxctx&&t.vtxctx.skus&&t.vtxctx.skus[0]?{value:String(t.vtxctx.skus[0]),source:"vtex/vtxctx"}:t.skuJson_0&&t.skuJson_0.skus&&t.skuJson_0.skus[0]?{value:String(t.skuJson_0.skus[0].sku),source:"vtex/skuJson"}:null}var tt=t=>String(t==null?"":t).trim().toLowerCase();async function Lr({size:t,quantity:e}){let r=window.skuJson_0&&window.skuJson_0.skus||[];if(!r.length)throw new Error("vtex: skuJson_0 indispon\xEDvel");let n=i=>tt(i.skuname)===tt(t)||i.dimensions&&Object.values(i.dimensions).some(c=>tt(c)===tt(t)),o=t?r.find(i=>n(i)&&i.available)||r.find(n):null;if(o||(o=r.find(i=>i.available)||r[0]),!o)throw new Error("vtex: variante n\xE3o encontrada");if(window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.addToCart)return await window.vtexjs.checkout.addToCart([{id:parseInt(o.sku,10),quantity:e||1,seller:"1"}]),{platform:"vtex",skuId:o.sku,size:o.skuname||t};throw new Error("vtex: vtexjs.checkout indispon\xEDvel")}function Ir(){try{let t=window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.orderForm;if(t&&typeof t.value=="number"){let e=t.storePreferencesData&&t.storePreferencesData.currencyCode||"BRL",r=(t.items||[]).reduce((n,o)=>n+(Number(o.quantity)||1),0);return{value:t.value/100,itemCount:r,currency:e}}}catch(t){}return null}var St={};I(St,{addToCart:()=>Nr,detect:()=>jr,getCartSummary:()=>Mr,id:()=>Pr,resolveSku:()=>Br,skipRedirect:()=>Rr});var Pr="nuvemshop",Rr=!0;function jr(){return!!(window.LS&&(window.LS.cart||window.LS.addToCart))}function Br(){try{let t=window.LS,e=t&&t.variants||[],r=document.querySelector('[name="variant_id"]'),n=r&&r.value?e.find(o=>String(o.id)===String(r.value)):null;if(n||(n=e.find(o=>o.available!==!1&&o.sku)||e.find(o=>o.sku)||e[0]),n&&n.sku)return{value:String(n.sku),source:"nuvemshop/variant"};if(t&&t.product&&t.product.sku)return{value:String(t.product.sku),source:"nuvemshop/product"}}catch(t){}return null}var et=t=>String(t==null?"":t).trim().toLowerCase();async function Nr({size:t,quantity:e}){let r=document.getElementById("product_form")||document.querySelector('.js-product-form, form[action*="/comprar"]');if(!r)throw new Error("nuvemshop: #product_form n\xE3o encontrado");t&&r.querySelectorAll('select[name^="variation"]').forEach(i=>{let c=[...i.options].find(l=>et(l.textContent).includes(et(t))||et(l.value)===et(t));c&&(i.value=c.value,i.dispatchEvent(new Event("change",{bubbles:!0})))});let n=r.querySelector('[name="quantity"]');return n&&e&&(n.value=String(e)),await new Promise(i=>setTimeout(i,400)),typeof r.requestSubmit=="function"?r.requestSubmit():r.submit(),{platform:"nuvemshop",variantId:(r.querySelector('[name="variant_id"]')||{}).value||null}}function Mr(){try{let t=window.LS,e=t&&t.cart;if(!e)return null;let r=t.currency&&t.currency.code||"BRL",n=Array.isArray(e.items)?e.items.reduce((i,c)=>i+(Number(c.quantity)||1),0):Number(e.items)||0,o=e.subtotal!=null?Number(e.subtotal):null;return{value:o!=null?o/100:null,itemCount:n,currency:r}}catch(t){return null}}var Tt={};I(Tt,{addToCart:()=>qr,detect:()=>Fr,getCartSummary:()=>zr,id:()=>Or,resolveSku:()=>Dr,skipRedirect:()=>Ur});var Or="wake",Ur=!0;function Fr(){return!!(window.StorefrontClient||typeof window.addOrCreateCheckout=="function"||typeof window.addToCartClick=="function")}function Dr(){try{let t=document.querySelector('input[name="product-id"], [data-product-id]'),e=t?t.value||t.getAttribute("data-product-id"):null;if(e)return{value:String(e).trim(),source:"wake/product-id"};let r=(location.pathname||"").match(/-(\d+)\/?(?:[?#]|$)/);if(r)return{value:r[1],source:"wake/url"}}catch(t){}return null}var me=t=>String(t==null?"":t).trim().toLowerCase();async function qr({size:t,quantity:e}){if(t){let i=[...document.querySelectorAll("input[attribute-value]")].find(c=>me(c.getAttribute("attribute-value"))===me(t));if(i){try{i.checked=!0}catch(c){}try{typeof window.selectAttribute=="function"?window.selectAttribute(i):i.click()}catch(c){}await new Promise(c=>setTimeout(c,600))}}let r=document.querySelector('[name="product-variant-id"]'),n=r&&r.value;if(!n)throw new Error("wake: product-variant-id n\xE3o encontrado");if(typeof window.addOrCreateCheckout!="function")throw new Error("wake: addOrCreateCheckout indispon\xEDvel");if(!await window.addOrCreateCheckout([{productVariantId:Number(n),quantity:e||1,customization:[]}]))throw new Error("wake: addOrCreateCheckout retornou false");return{platform:"wake",productVariantId:n,size:t||null}}function zr(){try{let t=document.querySelectorAll('[class*="total" i],[class*="minicart" i],[class*="cart" i]');for(let e of t){let r=e.textContent||"";if(/total/i.test(r)){let n=r.match(/R\$\s*([\d.]+,\d{2})/);if(n){let o=parseFloat(n[1].replace(/\./g,"").replace(",","."));if(Number.isFinite(o)&&o>0)return{value:o,itemCount:null,currency:"BRL"}}}}}catch(t){}return null}var Et={};I(Et,{addToCart:()=>rt,detect:()=>Kr,id:()=>$r,resolveSku:()=>At});var $r="generic";function Kr(){return!0}function At(){let t=k(["Product"]);if(t[0]){let e=t[0],r=e.sku||e.mpn||e.gtin13||e.productID;if(r)return{value:String(r),source:"jsonld"}}try{let e=document.querySelector('[itemprop="sku"]');if(e){let r=e.getAttribute("content")||(e.textContent||"").trim();if(r)return{value:String(r),source:"microdata"}}}catch(e){}try{let e=window.konfidencyData;if(e&&e.product&&e.product.variants&&e.product.variants[0])return{value:String(e.product.variants[0]),source:"konfidency"}}catch(e){}return null}var Hr=/(adicionar\s*(à|a|ao)?\s*(sacola|carrinho|cesta|bolsa))|adicionar ao carrinho|add to (cart|bag)|comprar agora/i,Vr=/continuar|como comprar|lista|desejos|favorito/i;async function rt(){let t=document.querySelectorAll("button,[role=button],input[type=submit]");for(let e of t){let r=(e.textContent||e.value||"").replace(/\s+/g," ").trim();if(r&&r.length<40&&Hr.test(r)&&!Vr.test(r))try{return e.click(),{platform:"native-click",clicked:r}}catch(n){}}return{platform:"none",error:"bot\xE3o de carrinho nativo n\xE3o encontrado"}}var ge=[_t,vt,kt,St,Tt],Jr=[["woocommerce",()=>!!(window.wc_add_to_cart_params||window.woocommerce_params)],["lojaintegrada",()=>!!window.LojaIntegrada]],nt;function $(){return nt||(nt=ge.find(t=>{try{return t.detect()}catch(e){return!1}})||Et,nt)}function we(){let t=ge.find(e=>{try{return e.detect()}catch(r){return!1}});if(t)return t.id;for(let[e,r]of Jr)try{if(r())return e}catch(n){}return null}function K(){let t=$();if(t.id!=="generic"&&t.resolveSku)try{let e=t.resolveSku();if(e)return e}catch(e){}return At()}async function xe(t){t=t||{};let e={size:t.size||t.selectedSize||t.tamanho||null,color:t.color||t.selectedColor||t.colour||t.cor||null,sku:t.sku||t.identifier||t.selectedIdentifier||null,quantity:t.quantity||1},r=$();try{let n=r.addToCart?await r.addToCart(e):await rt(e);return y("cart: adicionado",n),ye(),he(r,n,e.sku),n}catch(n){y('cart: adapter "'+r.id+'" falhou \u2014 fallback clique nativo',n&&n.message);let o=await rt(e);return ye(),he(r,o,e.sku),o}}async function he(t,e,r){try{let n=null;e&&e.cartValue!=null?n={value:e.cartValue,itemCount:e.itemCount!=null?e.itemCount:null,currency:e.currency||null}:t&&t.getCartSummary&&(n=await t.getCartSummary()),n&&n.value!=null&&(n.value>0||(n.itemCount||0)>0)&&s("cart_value",{via:"tryon",value:n.value,itemCount:n.itemCount!=null?n.itemCount:null,currency:n.currency||null,sku:r||null})}catch(n){}}async function be(){let t=$();if(t&&t.getCartSummary)try{return await t.getCartSummary()}catch(e){}return null}function ye(){["cart:refresh","cart:updated","cart:build","ajaxProduct:added","product:added-to-cart"].forEach(t=>{try{document.dispatchEvent(new CustomEvent(t))}catch(e){}})}async function _e(){let t=$(),e=m(),r=null;try{r=await N()}catch(i){}let n=r&&r.template&&r.template.cart||r&&r.cart||{},o=n.afterAdd||n.behavior||e.cartBehavior;if(o||(o=e.cartRedirect===!1?"none":"auto"),o==="none")return!1;if(o==="auto"||o==="drawer"){let i=n.openSelector||e.cartOpenSelector;if(i){let c=document.querySelector(i);if(c)return setTimeout(()=>{try{c.click()}catch(l){}},300),!1}else if(t&&t.openCartDrawer){let c=!1;try{c=t.openCartDrawer()}catch(l){}if(c)return!1}}return!0}function Ce(){let t=$();if(t&&t.skipRedirect)return;let e=t&&t.cartUrl||"/cart";setTimeout(()=>{try{window.location.href=e}catch(r){}},250)}var Wr=/\/(thank[_-]?you|orders?\/|pedido[_-]?(confirmado|realizado|finalizado|sucesso)|sucesso|order[_-]?confirmation|compra[_-]?(finalizada|concluida)|orderplaced)/i,Gr=/\/(my[_-]?account|minha[_-]?conta|account|conta|customer|cliente|profile|perfil|wishlist|favoritos)(\/|$)/i,Xr=/\/checkout/i,Yr=/\/(cart|carrinho|sacola|bag)(\/|$|\?|#)/i,Zr=/\/(products?|produtos?|p)\//i,Qr=/\/(collections?|categoria|categorias|c|departamento)\//i,tn=/\/(search|busca|s)(\/|\?)/i;function ve(){try{if(window.__mkPageType)return window.__mkPageType}catch(r){}let t=(location.pathname||"").toLowerCase(),e=Gr.test(t);try{let r=k();for(let n of r){let o=Array.isArray(n["@type"])?n["@type"]:[n["@type"]];if((o.includes("Order")||o.includes("Invoice"))&&!e)return"purchase";if(o.includes("Product"))return"pdp";if(o.includes("SearchResultsPage"))return"search";if(o.includes("CollectionPage")||o.includes("ItemList"))return"category"}}catch(r){}return t==="/"||t===""||t==="/home"||t==="/index.html"?"home":Wr.test(t)&&!e?"purchase":Xr.test(t)?"checkout":Yr.test(t)?"cart":Zr.test(t)?"pdp":Qr.test(t)?"category":tn.test(t)?"search":"other"}function ke(t){let e=null;try{let r=new URLSearchParams(location.search),n=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],o={};for(let i of n){let c=r.get(i);c&&(o[i.replace("utm_","")]=c)}Object.keys(o).length&&(e=o)}catch(r){}return{url:location.href,pathname:location.pathname,referrer:document.referrer||null,title:document.title||null,pageType:t,utm:e,userAgent:navigator.userAgent,language:navigator.language,viewport:window.innerWidth+"x"+window.innerHeight,platform:en()}}function en(){return we()}var Lt={},rn=null,H=0,Se=!1;function Te(t){Se||(Se=!0,Ae(t),nn(),on(),cn(),an(),ln(t))}function Ae(t){Lt={};let e=ve(),r=ke(e);if(ie(r),s("view",{url:location.href,pathname:location.pathname,referrer:document.referrer||null,title:document.title||null,pageType:e}),typeof t=="function")try{t(e,r)}catch(n){}}function nn(){if(!document.body)return;let t={A:1,BUTTON:1,INPUT:1,SELECT:1,TEXTAREA:1},e=0;document.body.addEventListener("click",r=>{try{let n=Date.now();if(n-e<100)return;e=n;let o=r.target;for(let l=0;l<5&&o&&o!==document.body&&!(t[o.tagName]||o.getAttribute&&o.getAttribute("role")==="button");l++)o=o.parentElement;if(!o||!t[o.tagName]&&!(o.getAttribute&&o.getAttribute("role")==="button"))return;let i={tag:o.tagName},c=o.tagName==="INPUT"||o.tagName==="TEXTAREA"?o.value:o.textContent;i.text=(c||"").replace(/\s+/g," ").trim().substring(0,100),o.href&&(i.href=String(o.href).substring(0,500)),o.id&&(i.id=o.id),o.className&&typeof o.className=="string"&&(i.classes=o.className.trim().substring(0,200)),s("click",i)}catch(n){}},{capture:!0,passive:!0})}function on(){let t=[25,50,75,100],e=null,r=()=>{try{let n=window.scrollY||document.documentElement.scrollTop||0,o=Math.max(document.body&&document.body.scrollHeight||0,document.documentElement&&document.documentElement.scrollHeight||0);if(o<=0)return;let i=Math.min(100,Math.floor((n+window.innerHeight)/o*100));for(let c of t)i>=c&&!Lt[c]&&(Lt[c]=!0,s("scroll_depth",{depth:c}))}catch(n){}};r(),window.addEventListener("scroll",()=>{e||(e=setTimeout(()=>{e=null,r()},250))},{passive:!0})}function cn(){document.body&&document.body.addEventListener("submit",t=>{try{let e=t.target;if(!e||e.tagName!=="FORM"||e.querySelector('input[type="password"], input[name*="card"], input[name*="cpf"]'))return;let r="other",n=(e.className||"").toLowerCase(),o=(e.action||"").toLowerCase();e.querySelector('input[type="search"], input[name="q"], input[name="s"]')?r="search":/newsletter|subscribe|mailchimp/.test(n+o)?r="newsletter":/contact|contato/.test(n+o)&&(r="contact"),s("form_submit",{form_id:e.id||"",form_type:r})}catch(e){}},{capture:!0})}function an(){let t=m();H=Date.now(),rn=setInterval(()=>{if(document.hidden)return;let e=Date.now(),r=Math.round((e-H)/1e3);H=e,r>0&&r<60&&s("engagement",{url:location.pathname,dwellSec:r})},t.engagementIntervalMs),document.addEventListener("visibilitychange",()=>{if(document.hidden){let e=Math.round((Date.now()-H)/1e3);e>0&&e<600&&s("engagement",{url:location.pathname,dwellSec:e})}H=Date.now()})}function ln(t){let e=location.href,r=()=>{location.href!==e&&(e=location.href,Ae(t))};try{let n=history.pushState,o=history.replaceState;history.pushState=function(){n.apply(this,arguments),setTimeout(r,0)},history.replaceState=function(){o.apply(this,arguments),setTimeout(r,0)},window.addEventListener("popstate",r)}catch(n){}}function Pt(){let t=K(),e=k(["Product"]);if(e.length>0){let o=e[0],i=Array.isArray(o.offers)?o.offers[0]:o.offers;return{sku:t?t.value:o.sku||o.mpn||o.gtin13||o.productID||null,skuSource:t?t.source:null,name:typeof o.name=="string"?o.name:null,price:i&&parseFloat(i.price||i.lowPrice)||null||Ee(),currency:i?i.priceCurrency:null,brand:o.brand?typeof o.brand=="string"?o.brand:o.brand.name:null,category:o.category||null}}let r=o=>{let i=document.querySelector('meta[property="og:'+o+'"], meta[property="product:'+o+'"]');return i?i.getAttribute("content"):null},n=o=>{let i=document.querySelector('[itemprop="'+o+'"]');return i?i.getAttribute("content")||(i.textContent||"").trim():null};if(t||r("type")==="product"||r("price:amount")||n("name")){let o=n("price")||r("price:amount"),i=o&&parseFloat(String(o).replace(",","."))||null;return{sku:t?t.value:null,skuSource:t?t.source:null,name:n("name")||r("title")||document.title||null,price:(i&&i>0?i:null)||Ee(),currency:n("priceCurrency")||r("price:currency")||null,brand:n("brand")||null,category:null}}return null}function Ee(){try{let t=window.dataLayer;if(!Array.isArray(t))return null;for(let e=t.length-1;e>=0;e--){let r=t[e];if(!r||typeof r!="object")continue;let n=r.ecommerce||r,o=n&&n.items||null,i=n&&n.detail&&n.detail.products||n&&n.products||r.products||null,c=Array.isArray(o)&&o[0]&&o[0].price||Array.isArray(i)&&i[0]&&i[0].price||null,l=It(c!=null?String(c):"");if(l)return l}}catch(t){}return null}function E(){try{let t=location.pathname+location.search,e=t.match(/order[_-]?confirmation\/([\w-]+)/i)||t.match(/[?&]order[_-]?id=([\w-]+)/i)||t.match(/\/orders?\/([\w-]{4,})/i)||t.match(/pedido[_-]?(?:confirmado|realizado|finalizado)?\/([\w-]+)/i);return e?e[1]:null}catch(t){return null}}function Rt(){let t=k(["Order","Invoice"]);if(t.length>0){let o=t[0],i=o.totalPaymentDue?parseFloat(o.totalPaymentDue.price):parseFloat(o.price||o.total);return{orderId:o.orderNumber||o.confirmationNumber||o.identifier||E(),revenue:Number.isFinite(i)?i:null,currency:o.totalPaymentDue&&o.totalPaymentDue.priceCurrency||o.priceCurrency||null,source:"jsonld"}}try{let o=window.Shopify&&window.Shopify.checkout;if(o&&o.total_price!=null){let i=parseFloat(o.total_price);return{orderId:(o.order_id!=null?String(o.order_id):null)||o.token||E(),revenue:Number.isFinite(i)?i:null,currency:o.currency||null,itemCount:Array.isArray(o.line_items)?o.line_items.length:null,source:"shopify"}}}catch(o){}try{if(Array.isArray(window.dataLayer))for(let o=window.dataLayer.length-1;o>=0;o--){let i=window.dataLayer[o],c=i&&i.ecommerce||i&&i.ecommerce_data&&i.ecommerce_data.ecommerce;if(c&&(i.event==="purchase"||c.purchase)){let l=c.purchase&&c.purchase.actionField,u=parseFloat(l&&(l.revenue||l.value)||c.value||c.revenue);return{orderId:l&&(l.id||l.transaction_id)||c.transaction_id||c.transactionId||E(),revenue:Number.isFinite(u)?u:null,currency:c.currency||c.currencyCode||l&&l.currency||null,itemCount:(c.purchase&&c.purchase.products||c.items||c.products||[]).length||null,source:"datalayer"}}}}catch(o){}let e=document.querySelector('meta[property="order:total"], meta[name="order-total"]');if(e&&e.content)return{orderId:E(),revenue:parseFloat(e.content)||null,source:"meta"};let r=sn();if(r)return r;let n=E();return n?{orderId:n,revenue:null,source:"url"}:null}function sn(){try{let t=document.querySelector(".orderTotalPrice");if(t){let r=String(t.value||t.getAttribute("value")||t.textContent||"").trim(),n=r.split(/\s+/),o=It(n.length>1?n[n.length-1]:r);if(o)return{orderId:Le(),revenue:o,currency:(n.length>1?n[0]:null)||null,source:"dom"}}let e=[".order-total","#order-total",".total-price",".order__total","[data-order-total]",".summary-total",".grand-total"];for(let r of e){let n=document.querySelector(r);if(n){let o=It(n.value||n.textContent);if(o)return{orderId:Le(),revenue:o,source:"dom"}}}return null}catch(t){return null}}function Le(){try{let t=document.querySelector(".orderID");if(t&&(t.value||t.getAttribute("value")))return t.value||t.getAttribute("value");let r=(document.body.innerText||"").match(/(?:pedido|order|n[º°o]\.?)\s*#?\s*([A-Z0-9-]{4,})/i);return r?r[1]:null}catch(t){return null}}function It(t){if(!t)return null;let e=String(t).replace(/[^\d.,]/g,"");if(!e)return null;let r;e.indexOf(",")>e.indexOf(".")?r=e.replace(/\./g,"").replace(",","."):r=e.replace(/,/g,"");let n=parseFloat(r);return Number.isFinite(n)&&n>0?n:null}function Ie(){let t=k(["ItemList","CollectionPage"]);if(t.length===0)return null;let e=t[0],r=e.itemListElement||e.mainEntity&&e.mainEntity.itemListElement||[],n=[];for(let o of r.slice(0,50)){let i=o.item||o;i&&(i.sku||i.productID||i.name)&&n.push(i.sku||i.productID||i.name)}return n.length>0?{count:n.length,skus:n.slice(0,20)}:null}var Pe=!1,ot=[/\b(adicionar|adic\.?|colocar|incluir|jogar)\b.{0,30}\b(carrinho|sacola|sacolinha|bag)\b/i,/\bcomprar\b(?!\s+(em|por|sem))/i,/\bcomprar\s*$/i,/^add\s+to\s+(cart|bag)\b/i,/^buy\s+(now|it|this)\b/i,/^(sacolinha|carrinho|sacola)$/i],un=[/^finalizar(\s+(compra|pedido|pagamento))?\b/i,/^(fechar|confirmar)\s+(compra|pedido|pagamento)\b/i,/^pagar(\s+(agora|pedido))?\b/i,/^(complete|place)\s+(purchase|order)\b/i,/^checkout$/i];function V(t,e){for(let r=0;r<t.length;r++)if(t[r].test(e))return!0;return!1}function Be(t){switch(t){case"pdp":{let e=Pt();s("view_item",e||{sku:null});break}case"category":case"search":{let e=Ie();s("view_item_list",e||{count:0});break}case"cart":be().then(e=>s("view_cart",e&&e.value!=null?{value:e.value,itemCount:e.itemCount,currency:e.currency}:{})).catch(()=>s("view_cart",{}));break;case"checkout":s("begin_checkout",{});break;case"purchase":dn();break}}var Re=500,je=16;function dn(){let t=!1,e=0,r=(o,i)=>{t||(t=!0,fn(o,i))};try{window.addEventListener("pagehide",()=>r(Rt(),!0),{once:!0})}catch(o){}let n=()=>{if(t)return;let o=Rt();if(o&&o.revenue!=null)return r(o);if(e++>=je)return y("purchase: receita n\xE3o apareceu em "+Re*je+"ms \u2014 emitindo sem valor"),r(o);setTimeout(n,Re)};n()}function fn(t,e){if(t&&!t.orderId&&(t.orderId=E()),t&&t.orderId){let r="_mk_purch_"+t.orderId;try{if(sessionStorage.getItem(r)){y("purchase j\xE1 contado",t.orderId);return}sessionStorage.setItem(r,"1")}catch(n){}}else if(Pe)return;if(Pe=!0,s("purchase",t||{revenue:null,_note:"no_order_data_extracted"}),y("purchase emitido",t),e)try{A(!0)}catch(r){}}function Ne(){if(!document.body)return;let t=0;document.body.addEventListener("click",e=>{try{let r=Date.now();if(r-t<150)return;let n=e.target;for(let l=0;l<5&&n&&n!==document.body&&!(n.tagName==="BUTTON"||n.tagName==="A"||n.getAttribute&&n.getAttribute("role")==="button");l++)n=n.parentElement;if(!n)return;let o=n.tagName!=="A",i=(n.textContent||"").replace(/\s+/g," ").trim();if(!i||i.length>80)return;let c=!1;if((V([ot[0]],i)||o&&V([ot[1]],i)||o&&V([ot[2]],i)||V(ot.slice(3),i))&&(c=!0),c){t=r;let l=Pt();s("add_to_cart",{via:"click",buttonText:i,sku:l?l.sku:null,price:l?l.price:null});return}o&&V(un,i)&&(t=r,s("begin_checkout",{via:"click",buttonText:i}))}catch(r){}},{capture:!0,passive:!0})}var v=null,S=null,ct=!1,at=!1,M=null,Me={},jt=null,it=0,_={onReady:null,onClose:null,onAddToCart:null,onProductLoaded:null,onError:null,onInteraction:null,onGenerationComplete:null},pn={gregory:"698c7e791d3129430f15dddd"};function Ue(t){return t?pn[String(t).toLowerCase()]||t:null}async function O(t,e){let r=m(),n=Ue(t);e=String(e||"").trim();let o=r.apiUrl+"/availability/"+n+"?sku="+encodeURIComponent(e),i=await fetch(o);if(!i.ok)throw new Error("availability HTTP "+i.status);return i.json()}async function Fe(t,e){e||(e=t,t="698c7e791d3129430f15dddd");try{return(await O(t,e)).available===!0}catch(r){return!1}}async function lt(t){if(t=t||{},ct)return;let e=Ue(t.projectId||t.projectid||t.store),r=String(t.identifier||t.sku||"").trim();if(!e||!r){console.error("[mk-sdk] open: projectId e identifier obrigatorios");return}let n=e+":"+r;if(Me[n]!==!0){try{if(!(await O(e,r)).available){alert("Produto nao disponivel para prova virtual.");return}}catch(o){alert("Produto nao encontrado ou indisponivel.");return}Me[n]=!0}M={projectId:e,identifier:r,width:t.width||430,height:t.height||800},at=!1,ze(),mn(M),ct=!0,it=Date.now(),s("modal_opened",{projectId:e,identifier:r})}function Nt(){if(!ct)return;let t=at;if(at=!1,hn(),ct=!1,L("onClose"),s("modal_closed",{projectId:M&&M.projectId,identifier:M&&M.identifier}),t)try{Ce()}catch(e){}}function De(t){try{let e=Xe();if(!e)return;t?(e.dataset.mkPrevDisplay===void 0&&(e.dataset.mkPrevDisplay=e.style.display),e.style.display="none"):(e.style.display=e.dataset.mkPrevDisplay||"",delete e.dataset.mkPrevDisplay)}catch(e){}}function mn(t){v=document.createElement("div"),v.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,.8);display:flex;align-items:center;justify-content:center;z-index:2147483647;",De(!0);let e=document.createElement("div"),r=typeof t.width=="number"?t.width+"px":t.width,n=typeof t.height=="number"?t.height+"px":t.height;e.style.cssText="position:relative;width:"+r+";height:"+n+";max-width:100vw;max-height:100dvh;border-radius:12px;overflow:hidden;background:#fff;",S=document.createElement("iframe");let o=encodeURIComponent(t.identifier).replace(/\./g,"%2E");S.src=m().appUrl+"/"+t.projectId+"/"+o,S.style.cssText="width:100%;height:100%;border:none;",S.setAttribute("allow","camera *; microphone *"),S.setAttribute("allowfullscreen","true"),e.appendChild(S),v.appendChild(e),document.body.appendChild(v),y("try-on modal aberto",S.src)}function hn(){v&&v.parentNode&&v.parentNode.removeChild(v),v=null,S=null,De(!1)}var Oe=!1;function qe(){ze()}function ze(){Oe||(Oe=!0,window.addEventListener("message",t=>{let e=t.data;if(!e||e.source!=="mkfashion-app")return;let r=e.action,n=e.data||{};switch(r){case"close_request":Nt();break;case"ready":L("onReady",n);break;case"product_loaded":L("onProductLoaded",n),s("product_loaded",Bt(n));break;case"interaction":{L("onInteraction",n),n&&n.method&&(jt=n.method),s(yn(n),Bt(n));break}case"add_to_cart":s("add_to_cart",Object.assign({via:"tryon"},Bt(n))),typeof _.onAddToCart=="function"?L("onAddToCart",n):xe(n).then(()=>_e()).then(o=>{at=!!o}).catch(()=>{});break;case"generation_start":it=Date.now();break;case"generation_complete":L("onGenerationComplete",n),s("generation_complete",{method:n.method||jt||"unknown",durationMs:it?Date.now()-it:null,success:n.success!==!1,imageUrlPresent:!!n.imageUrl});break;case"generation_error":L("onError",n),s("generation_error",{method:jt||"unknown",error:n&&n.error});break}}))}function yn(t){return t&&t.action,"interaction"}function Bt(t){if(!t||typeof t!="object")return t;let e={};for(let r in t){if(r==="imageUrl"||r==="image"||r==="product"){r==="product"&&t[r]?(e.productSku=t[r].sku||null,e.productName=t[r].name||null):e[r+"Present"]=!!t[r];continue}e[r]=t[r]}return e}function L(t,e){if(typeof _[t]=="function")try{_[t](e)}catch(r){console.error("[mk-sdk]",r)}}function $e(t){_.onReady=t}function Ke(t){_.onClose=t}function He(t){_.onAddToCart=t}function Ve(t){_.onProductLoaded=t}function Je(t){_.onError=t}function We(t){_.onInteraction=t}function Ge(t){_.onGenerationComplete=t}var wn=767,xn=1024,bn=/(adicionar\s*(à|a|ao)?\s*(sacola|carrinho|cesta|bolsa))|adicionar ao carrinho|add to (cart|bag)|comprar agora|^comprar$|finalizar compra|eu quero/i,_n=/continuar|como comprar|lista|desejos|favorito|looks|cupom/i;function Mt(t){try{let e=t.getBoundingClientRect();if(e.width<=0||e.height<=0)return!1;let r=getComputedStyle(t);return r.display!=="none"&&r.visibility!=="hidden"&&r.opacity!=="0"}catch(e){return!1}}function Cn(t){if(!t)return!1;try{let e=document.querySelector(t);return!!e&&Mt(e)}catch(e){return!1}}function vn(t){return(t.tagName==="INPUT"?t.value||"":t.textContent||"").replace(/\s+/g," ").trim()}function kn(t){if(!t||typeof t!="object"||t.selector)return t;let e=!1;if(["mobile","tablet","desktop"].forEach(n=>{let o=t[n];o&&o.mkAnchor===1&&o.anchor&&typeof o.anchor=="object"&&(e=!0)}),!e)return t;let r={};return["mobile","tablet","desktop"].forEach(n=>{let o=t[n];if(o){if(o.selector){r[n]=o;return}if(o.mkAnchor===1&&o.anchor&&typeof o.anchor=="object"){let i=o.anchor[n]||o.anchor.desktop||o.anchor.mobile||o.anchor.tablet;i&&i.selector&&(r[n]=i)}}}),["bpMobile","bpTablet","breakpoint"].forEach(n=>{t[n]!=null&&(r[n]=t[n])}),r}function Ot(t){if(!t||typeof t!="object")return null;if(t=kn(t),t.selector)return t;let e=[["mobile",t.mobile],["tablet",t.tablet],["desktop",t.desktop]].filter(u=>u[1]&&u[1].selector);if(e.length===0)return null;if(e.length===1)return e[0][1];let r=e.filter(([,u])=>Cn(u.selector));if(r.length===1)return r[0][1];let n=window.innerWidth||1024,o=Number(t.bpMobile)||Number(t.breakpoint)||wn,i=Number(t.bpTablet)||xn,c=u=>(e.find(d=>d[0]===u)||[])[1],l=n<=o?["mobile","tablet","desktop"]:n<=i?["tablet","desktop","mobile"]:["desktop","tablet","mobile"];for(let u of l){let d=c(u);if(d)return d}return e[0][1]}function Ye(){let t=m(),e=Ot(t&&t.anchor);if(e&&e.selector)try{let n=document.querySelector(e.selector);if(n&&Mt(n))return{el:n,position:e.position||"afterend",mode:e.mode||"flow",style:e.style||"",align:e.align||"top-left",selector:e.selector}}catch(n){}let r=document.querySelectorAll('button, [role="button"], a.btn, a.button, input[type="submit"], input[type="button"]');for(let n of r){let o=vn(n);if(!(!o||o.length>40)&&!_n.test(o)&&bn.test(o)&&Mt(n))return{el:n,position:"afterend",mode:"flow",style:"",selector:null}}return null}var b="'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Ut={none:"0",sm:"4px",md:"8px",pill:"9999px"},Ft={none:"0",sm:"4px",md:"8px",lg:"16px"},Sn='<svg viewBox="0 0 17.5263 20.6862" fill="none" xmlns="http://www.w3.org/2000/svg" style="display:block;width:100%;height:100%"><g><path d="M8.49995 12.1862C10.1568 12.1862 11.5 10.8431 11.5 9.18622C11.5 7.52936 10.1568 6.18622 8.49995 6.18622C6.8431 6.18622 5.49995 7.52936 5.49995 9.18622C5.49995 10.8431 6.8431 12.1862 8.49995 12.1862Z" stroke="currentColor" shape-rendering="crispEdges"/><path d="M0.5 9.11152C0.5 6.56953 0.5 5.29894 1.1099 4.38664C1.375 3.9902 1.71424 3.65088 2.10821 3.38809C2.6945 2.9958 3.42899 2.85564 4.55351 2.80588C5.09013 2.80588 5.55183 2.39949 5.65687 1.87284C5.73715 1.48708 5.94572 1.14138 6.24735 0.894155C6.54898 0.646934 6.92516 0.51336 7.31231 0.516006H9.9734C10.7779 0.516006 11.4709 1.08412 11.6288 1.87284C11.7339 2.39949 12.1956 2.80588 12.7322 2.80588C13.8559 2.85564 12.9129 4.67413 13.5 5.06559C13.8949 5.32932 15.1484 3.80355 15.5 4.02647C16.1099 4.93876 16.7857 6.56953 16.7857 9.11152C16.7857 11.6535 16.7857 12.9233 16.1758 13.8364C15.9107 14.2328 15.5715 14.5722 15.1775 14.835C14.2647 15.4445 12.9936 15.4445 10.4522 15.4445H6.83351C4.29213 15.4445 3.02103 15.4445 2.10821 14.835C1.71446 14.5718 1.3755 14.2322 1.11071 13.8356C0.933802 13.5672 0.803519 13.2698 0.725557 12.9564" stroke="currentColor" stroke-linecap="round"/><path d="M12.676 0.607931C12.9446 -0.178095 14.0307 -0.2019 14.3491 0.536515L14.3761 0.60838L14.7385 1.66839C14.8216 1.91149 14.9559 2.13395 15.1322 2.32076C15.3086 2.50757 15.5229 2.65439 15.7608 2.75131L15.8583 2.78769L16.9183 3.14971C17.7044 3.41831 17.7282 4.50437 16.9902 4.82283L16.9183 4.84978L15.8583 5.21225C15.6151 5.29526 15.3926 5.42947 15.2057 5.60582C15.0188 5.78218 14.8719 5.99657 14.7749 6.23453L14.7385 6.33155L14.3765 7.39201C14.1079 8.17803 13.0219 8.20184 12.7039 7.46387L12.676 7.39201L12.314 6.332C12.231 6.08881 12.0968 5.86627 11.9204 5.67938C11.744 5.49249 11.5297 5.3456 11.2917 5.24863L11.1947 5.21225L10.1347 4.85022C9.34817 4.58163 9.32437 3.49557 10.0628 3.17756L10.1347 3.14971L11.1947 2.78769C11.4378 2.70462 11.6602 2.57039 11.847 2.39404C12.0339 2.21769 12.1807 2.00333 12.2776 1.76541L12.314 1.66839L12.676 0.607931Z" fill="currentColor"/></g></svg>',Tn='<svg viewBox="0 0 11.6122 12.7248" fill="none" xmlns="http://www.w3.org/2000/svg" style="display:block;width:12px;height:12px"><path d="M4.09055 2.01133C4.43939 0.9905 5.84989 0.959583 6.26347 1.91858L6.29847 2.01192L6.76922 3.38858C6.8771 3.7043 7.05144 3.99321 7.28047 4.23583C7.5095 4.47845 7.7879 4.66912 8.09689 4.795L8.22347 4.84225L9.60014 5.31242C10.621 5.66125 10.6519 7.07175 9.69347 7.48533L9.60014 7.52033L8.22347 7.99108C7.90764 8.09889 7.61862 8.2732 7.3759 8.50223C7.13318 8.73127 6.94241 9.0097 6.81647 9.31875L6.76922 9.44475L6.29905 10.822C5.95022 11.8428 4.53972 11.8737 4.12672 10.9153L4.09055 10.822L3.62039 9.44533C3.51258 9.12951 3.33827 8.84048 3.10924 8.59776C2.8802 8.35504 2.60177 8.16427 2.29272 8.03833L2.16672 7.99108L0.790054 7.52092C-0.231363 7.17208 -0.26228 5.76158 0.69672 5.34858L0.790054 5.31242L2.16672 4.84225C2.48244 4.73437 2.77135 4.56003 3.01397 4.331C3.25658 4.10197 3.44726 3.82357 3.57314 3.51458L3.62039 3.38858L4.09055 2.01133ZM9.86147 0C9.9706 0 10.0775 0.0306123 10.1701 0.0883584C10.2627 0.146104 10.3373 0.228668 10.3853 0.326667L10.4133 0.394917L10.6175 0.993417L11.2166 1.19758C11.3259 1.23474 11.4218 1.30353 11.492 1.39523C11.5623 1.48693 11.6037 1.59741 11.611 1.71268C11.6184 1.82795 11.5914 1.94281 11.5334 2.04271C11.4755 2.14261 11.3891 2.22305 11.2854 2.27383L11.2166 2.30183L10.6181 2.506L10.4139 3.10508C10.3767 3.21442 10.3078 3.31024 10.2161 3.38041C10.1244 3.45058 10.0139 3.49194 9.89859 3.49925C9.78333 3.50656 9.66849 3.47949 9.56863 3.42147C9.46876 3.36345 9.38837 3.27709 9.33764 3.17333L9.30964 3.10508L9.10547 2.50658L8.50639 2.30242C8.39702 2.26526 8.30115 2.19647 8.23092 2.10477C8.16069 2.01307 8.11926 1.90259 8.11189 1.78732C8.10452 1.67205 8.13153 1.55719 8.18951 1.45729C8.24749 1.35739 8.33381 1.27695 8.43755 1.22617L8.50639 1.19817L9.10489 0.994L9.30905 0.394917C9.34839 0.279665 9.42281 0.179613 9.52187 0.108791C9.62094 0.0379686 9.73969 -0.0000730808 9.86147 0Z" fill="currentColor"/></svg>';function p(t,e={}){let r=document.createElement(t);if(e.style&&(r.style.cssText=e.style),e.text!=null&&(r.textContent=e.text),e.html!=null&&(r.innerHTML=e.html),e.attrs)for(let n in e.attrs)r.setAttribute(n,e.attrs[n]);if(e.on)for(let n in e.on)r.addEventListener(n,e.on[n]);if(e.children)for(let n of e.children)n&&r.appendChild(n);return r}function st(t,e){let r=Number(e)>0?Number(e):24;return p("span",{style:`width:${r}px;height:${r}px;padding:2px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;color:${t};flex-shrink:0;`,html:Sn})}function Ze(t){return p("span",{style:`width:12px;height:12px;display:inline-flex;align-items:center;justify-content:center;color:${t};flex-shrink:0;`,html:Tn})}function ut(t){return t.borderWidth>0&&t.borderColor?`${t.borderWidth}px solid ${t.borderColor}`:"none"}function dt(){if(!document.getElementById("mk-jakarta-font"))try{document.head.appendChild(p("link",{attrs:{id:"mk-jakarta-font",rel:"stylesheet",href:"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700&display=swap"}}))}catch(t){}}function An(t){return t.subtext?p("span",{style:`display:flex;align-items:center;justify-content:center;padding:4px;background:${t.badgeBgColor};font-family:${b};font-weight:700;font-size:16px;text-transform:uppercase;color:${t.badgeTextColor};line-height:1;white-space:nowrap;`,text:t.subtext}):null}function Qe(t,e){dt();let r=p("span",{style:"display:inline-flex;align-items:center;gap:4px;",children:[st(t.textColor,t.iconSize),p("span",{text:t.text,style:`font-family:${b};font-weight:700;font-size:${t.fontSize}px;text-transform:uppercase;letter-spacing:2px;color:${t.textColor};white-space:nowrap;text-align:center;line-height:1;`})]});return p("button",{attrs:{type:"button"},style:`display:flex;align-items:center;justify-content:center;gap:8px;padding:8px;width:100%;max-width:238px;box-sizing:border-box;background:${t.bgColor};border:${ut(t)};border-radius:${t.borderRadiusPx};font-family:${b};cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[r,An(t)],on:{mouseenter:n=>{n.currentTarget.style.opacity="0.85"},mouseleave:n=>{n.currentTarget.style.opacity="1"},click:()=>{try{e&&e()}catch(n){}}}})}function Ln(t){return t.subtext?p("span",{style:`display:flex;align-items:center;gap:4px;padding:4px;background:${t.badgeBgColor};font-family:${b};font-weight:600;font-size:10px;text-transform:uppercase;color:${t.badgeTextColor};line-height:1;white-space:nowrap;`,children:[Ze(t.badgeTextColor),p("span",{text:t.subtext})]}):null}function In(t,e){return p("button",{attrs:{type:"button"},style:`display:flex;align-items:center;justify-content:center;gap:8px;padding:8px 12px 8px 8px;width:100%;margin-top:auto;box-sizing:border-box;background:${t.bgColor};border:${ut(t)};border-radius:${t.borderRadiusPx};filter:drop-shadow(0 0 6px rgba(0,0,0,0.08));font-family:${b};cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[st(t.textColor,t.iconSize),p("span",{text:t.text,style:`font-family:${b};font-weight:700;font-size:${t.fontSize}px;color:${t.textColor};white-space:nowrap;line-height:1;`})],on:{mouseenter:r=>{r.currentTarget.style.opacity="0.85"},mouseleave:r=>{r.currentTarget.style.opacity="1"},click:()=>{try{e&&e()}catch(r){}}}})}function tr(t,e){dt();let r=p("div",{style:"display:flex;flex-direction:column;gap:4px;",children:[t.cardTitle&&p("p",{text:t.cardTitle,style:`margin:0;font-family:${b};font-weight:700;font-size:16px;letter-spacing:1px;text-transform:uppercase;color:${t.cardTitleColor};line-height:1.2;`}),t.cardDescription&&p("p",{html:t.cardDescription,style:`margin:0;font-family:${b};font-weight:400;font-size:12px;max-width:177px;line-height:1.2;color:${t.cardTextColor};`})]}),n=p("div",{style:"display:flex;flex-direction:column;justify-content:space-between;gap:16px;flex:1 1 0;min-width:0;",children:[r,t.cardFooter&&p("p",{text:t.cardFooter,style:`margin:0;font-family:${b};font-weight:400;font-size:10px;color:${t.cardTextColor};line-height:1.2;`})]}),o=p("div",{style:"display:flex;flex-direction:column;align-items:flex-end;flex:1 1 0;min-width:0;",children:[Ln(t),In(t,e)]}),i=p("div",{style:"display:flex;gap:16px;align-items:stretch;width:100%;flex:1;box-sizing:border-box;",children:[n,o]});return p("div",{style:`display:flex;flex-direction:column;align-items:flex-start;padding:12px;width:100%;max-width:402px;min-height:140px;box-sizing:border-box;background:${t.cardBgColor};border-radius:${t.cardBorderRadiusPx};font-family:${b};`,children:[i]})}var Rn={style:"gregory-black",text:"Provar Virtualmente",fontSize:14,iconSize:24,subtext:"",bgColor:"#1E1E1E",textColor:"#FFFFFF",badgeBgColor:"#C51A1B",badgeTextColor:"#FFFFFF",borderRadius:"md",borderColor:"#1E1E1E",borderWidth:0,cardTitle:"",cardDescription:"",cardFooter:"",cardBgColor:"#F6F6F6",cardTitleColor:"#1E1E1E",cardTextColor:"#717171",cardBorderRadius:"md"};function Dt(t,e){let r=(e?t&&t.mobile:t&&t.desktop)||t&&t.desktop||t&&t.mobile||{},n={...Rn,...r};return n.style==="gregory-card"&&e&&(n.style="gregory-black"),n.borderRadiusPx=Ut[n.borderRadius]!=null?Ut[n.borderRadius]:"0",n.cardBorderRadiusPx=Ft[n.cardBorderRadius]!=null?Ft[n.cardBorderRadius]:"0",n.fontSize=Number(n.fontSize)||14,n.iconSize=Number(n.iconSize)||24,n.borderWidth=Number(n.borderWidth)||0,n}var qt={"gregory-black":Qe,"gregory-card":tr},jo=Object.keys(qt);function er(t,e){return(qt[t.style]||qt["gregory-black"])(t,e)}function jn(){return"abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)]+Math.random().toString(36).slice(2,11)}var J=null;function Xe(){return J}function Bn(t,e){let r;try{r=document.createElement("iframe"),r.setAttribute("aria-hidden","true"),r.style.cssText="display:none!important;width:0;height:0;border:0;position:absolute;left:-9999px;",(document.body||document.documentElement).appendChild(r);let n=r.contentWindow&&r.contentWindow.Element&&r.contentWindow.Element.prototype&&r.contentWindow.Element.prototype.attachShadow;if(typeof n=="function"){let o=n.call(t,e);return r.remove(),o}}catch(n){}try{r&&r.remove()}catch(n){}return t.attachShadow(e)}var Nn=/^(transform|transform-origin|margin|margin-(top|right|bottom|left)|position|inset|top|right|bottom|left|z-index|width|min-width|max-width|height|min-height|max-height)$/i;function Mn(t){return!t||typeof t!="string"?"":t.split(";").map(e=>e.trim()).filter(Boolean).filter(e=>Nn.test(e.split(":")[0].trim().toLowerCase())).join(";")}var ft=null,zt=!1,$t={},rr=!1,Kt=null;function nr(){return Kt||(Kt=N().then(t=>t&&t.template&&t.template.tryOnButton||null).catch(()=>null)),Kt}function On(){if(rr)return;rr=!0;let t=null;try{window.addEventListener("resize",()=>{clearTimeout(t),t=setTimeout(()=>{ft&&U("pdp")},200)})}catch(e){}}function Ht(){let t=J;if(t){if(typeof t.__mkCleanup=="function")try{t.__mkCleanup()}catch(e){}t.parentNode&&t.parentNode.removeChild(t)}J=null,ft=null}var Un={IMG:1,INPUT:1,VIDEO:1,CANVAS:1,EMBED:1,OBJECT:1,IFRAME:1,BR:1,HR:1,SELECT:1,TEXTAREA:1,SVG:1};function Fn(t){switch(t){case"top-center":return"top:0;left:50%;transform:translateX(-50%);";case"top-right":return"top:0;right:0;";case"middle-left":return"top:50%;left:0;transform:translateY(-50%);";case"center":return"top:50%;left:50%;transform:translate(-50%,-50%);";case"middle-right":return"top:50%;right:0;transform:translateY(-50%);";case"bottom-left":return"bottom:0;left:0;";case"bottom-center":return"bottom:0;left:50%;transform:translateX(-50%);";case"bottom-right":return"bottom:0;right:0;";case"top-left":default:return"top:0;left:0;"}}function Dn(t,e,r){let o=!Un[t.tagName]?t:t.parentElement||document.body;try{getComputedStyle(o).position==="static"&&(o.style.position="relative")}catch(d){}if(o===t){e.style.cssText="position:absolute;z-index:2147483000;"+Fn(r),t.appendChild(e);return}e.style.cssText="position:absolute;z-index:2147483000;",o.appendChild(e);let i=()=>{try{let d=t.getBoundingClientRect(),h=o.getBoundingClientRect(),x=e.offsetWidth,a=e.offsetHeight,f=d.top-h.top+o.scrollTop,g=d.left-h.left+o.scrollLeft,w=r||"top-left",W=f,T=g;w.indexOf("bottom")===0?W=f+d.height-a:(w.indexOf("middle")===0||w==="center")&&(W=f+(d.height-a)/2),w.indexOf("right")>=0?T=g+d.width-x:w.indexOf("center")>=0&&(T=g+(d.width-x)/2),e.style.top=W+"px",e.style.left=T+"px"}catch(d){}};i();let c=()=>i();window.addEventListener("resize",c);let l=setTimeout(i,600),u=setTimeout(i,1500);e.__mkCleanup=()=>{window.removeEventListener("resize",c),clearTimeout(l),clearTimeout(u)}}function qn(t,e,r){try{return t.insertAdjacentElement(r||"afterend",e),!0}catch(n){try{return t.parentNode.insertBefore(e,t.nextSibling),!0}catch(o){return!1}}}async function U(t){let e=m();if(t!=="pdp"){Ht();return}if(!e.projectId)return;if(!e._anchorFromPicker){let u=await nr();u&&u.anchor&&(e.anchor=u.anchor)}if(zt)return;let r=K(),n=r&&r.value,o=!!e.forceButton,i=Ot(e.anchor),c=[n||"demo",i?[i.selector,i.position,i.mode,i.align,i.style].join("~"):"heuristic"].join("|"),l=J;if(!(l&&ft===c)){if(l&&Ht(),!n&&!o){y("auto-mount: SKU n\xE3o resolvido na PDP");return}zt=!0;try{let u=o;o||($t[n]||($t[n]=O(e.projectId,n).then(C=>!!(C&&C.available)).catch(()=>!1)),u=await $t[n]);try{oe(u?"available":"unavailable")}catch(C){}if(!u){y("auto-mount: produto sem try-on",n);return}let d=await nr(),h=window.matchMedia("(max-width: 767px)").matches,x=Dt(d,h),a=Ye(),f=a&&a.mode||"flow",g=er(x,()=>{let C=K(),pt=C&&C.value||n||"";re(),s("button_clicked",{sku:pt,style:x.style,mode:f}),lt({projectId:e.projectId,identifier:pt})}),w=document.createElement("div");w.id=jn(),J=w,Bn(w,{mode:"closed"}).appendChild(g);let T=!1;if(a&&a.el&&a.el.parentNode&&(f==="overlay"?(Dn(a.el,w,a.align),T=!0):(w.style.cssText="display:contents;",T=qn(a.el,w,a.position))),T||(w.style.cssText="position:fixed;left:16px;bottom:16px;z-index:2147483000;",document.body.appendChild(w)),a&&a.style){let C=Mn(a.style);if(C)try{g.style.cssText+=";"+C}catch(pt){}}ft=c,On(),y("auto-mount: bot\xE3o injetado",{style:x.style,sku:n,anchorFound:!!a,position:a&&a.position,mode:f,forced:o}),s("button_rendered",{style:x.style,sku:n||null,skuSource:r&&r.source,anchorFound:!!a,position:a?a.position:null,mode:f,forced:o})}finally{zt=!1}}}function or(){try{let t=m(),e={anchor:t.anchor,forceButton:t.forceButton};window.addEventListener("message",r=>{if(r.source!==window)return;let n=r.data;!n||!n.__mkCmd||(n.__mkCmd==="remount"||n.__mkCmd==="applyRecipe"?(t.anchor=n.anchor||null,t._anchorFromPicker=!0,t.forceButton=!0,U("pdp")):n.__mkCmd==="cancelPreview"&&(t.anchor=e.anchor,t._anchorFromPicker=!1,t.forceButton=e.forceButton,Ht(),U("pdp")))})}catch(t){}}(function(){"use strict";try{let r=function(){try{ae(),or(),qe(),e.autoTrack!==!1&&(Te((o,i)=>{Be(o,i),U(o)}),Ne()),y("mk-sdk iniciado",{projectId:e.projectId,collectorUrl:e.collectorUrl})}catch(o){e.debug&&console.error("[mk-sdk] init erro",o)}},e=ht();if(e.projectId){let o=de(e.projectId);o&&bt(o),N().then(i=>{let c=se(i);bt(c),fe(e.projectId,c),y("escopo de coleta",c)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r();let n={open:lt,close:Nt,isAvailable:Fe,getAvailability:O,onReady:$e,onClose:Ke,onAddToCart:He,onProductLoaded:Ve,onError:Je,onInteraction:We,onGenerationComplete:Ge,_version:"0.1.0",_isMkSdk:!0};typeof window!="undefined"&&(window.mk=n)}catch(e){typeof console!="undefined"&&console.error("[mk-sdk] boot fatal",e)}})();})();
|
|
1
|
+
(()=>{var ur=Object.defineProperty;var S=(t,e)=>{for(var r in e)ur(t,r,{get:e[r],enumerable:!0})};var yt={collectorUrl:"https://api-collector.mk3dlabs.com",appUrl:"https://mkfashion.mk3dlabs.com/visualizer",apiUrl:"https://mkfashion-new-api.mk3dlabs.com"},dr={},D=null;function gt(){if(D)return D;let t=null;try{t=document.currentScript||document.querySelector("script[data-mk-project]")||document.querySelector('script[src*="mk-sdk"]')||document.querySelector('script[src*="mk-pixel"]')}catch(i){}let e=i=>{try{return t&&t.getAttribute(i)}catch(c){return null}},r=e("data-mk-project")||e("data-mk-client")||window.__MK&&(window.__MK.projectId||window.__MK.clientSlug)||null,n=e("data-mk-product")||window.__MK&&window.__MK.product||"mk-fashion",o=e("data-mk-collector")||window.__MK&&window.__MK.collectorUrl||dr.collectorUrl||yt.collectorUrl;return D={projectId:r,product:n,collectorUrl:o,appUrl:window.__MK&&window.__MK.appUrl||yt.appUrl,apiUrl:window.__MK&&window.__MK.apiUrl||yt.apiUrl,debug:!!(e("data-mk-debug")!==null||window.__MK&&window.__MK.debug||/[?&]mkdebug\b/.test(location.search)),observe:!!(window.__MK&&window.__MK.observe),forceButton:!!(window.__MK&&window.__MK.forceButton),anchor:window.__MK&&window.__MK.anchor||null,cartRedirect:!(window.__MK&&window.__MK.cartRedirect===!1),cartBehavior:window.__MK&&window.__MK.cartBehavior||null,cartOpenSelector:window.__MK&&window.__MK.cartOpenSelector||null,autoTrack:e("data-mk-no-autotrack")===null,batchIntervalMs:window.__MK&&window.__MK.batchIntervalMs||8e3,batchMaxSize:window.__MK&&window.__MK.batchMaxSize||20,engagementIntervalMs:15e3},D}function f(){return D||gt()}function d(...t){let e=f();e&&e.debug&&typeof console!="undefined"&&console.log("[mk-sdk]",...t)}var Xt="_mk_vid",Yt="_mk_sid",F=null,q=null;function G(){return typeof crypto!="undefined"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function Zt(){if(F)return F;try{let t=localStorage.getItem(Xt);return t||(t="v_"+G(),localStorage.setItem(Xt,t)),F=t,t}catch(t){return F="v_"+G(),F}}function Qt(){if(q)return q;try{let t=sessionStorage.getItem(Yt);return t||(t="s_"+G(),sessionStorage.setItem(Yt,t)),q=t,t}catch(t){return q="s_"+G(),q}}var te=[/email/i,/e-?mail/i,/cpf/i,/cnpj/i,/phone/i,/telefone/i,/celular/i,/address/i,/endereco/i,/cep/i,/zip/i,/card/i,/cartao/i,/cvv/i,/password/i,/senha/i,/token/i,/\bnome\b/i,/fullname/i,/firstname/i,/lastname/i,/sobrenome/i,/birth/i,/nascimento/i,/rg\b/i],ee={imageUrl:1,image:1,thumbnail:1,photo:1,imageBase64:1,src:1},wt=2e3;function re(t){for(let e=0;e<te.length;e++)if(te[e].test(t))return!0;return!1}function ne(t){if(!t||typeof t!="object"||Array.isArray(t))return typeof t=="string"&&t.length>wt?t.slice(0,200)+"...[truncated "+t.length+"B]":t;let e={};for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||re(r))continue;let n=t[r];if(ee[r]){e[r+"Present"]=!!n;continue}if(typeof n=="string"&&n.length>wt){e[r]=n.slice(0,200)+"...[truncated "+n.length+"B]";continue}if(n&&typeof n=="object"&&!Array.isArray(n)){e[r]=pr(n);continue}e[r]=n}return e}function pr(t){let e={};for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||re(r))continue;let n=t[r];if(ee[r]){e[r+"Present"]=!!n;continue}if(typeof n=="string"&&n.length>wt){e[r]=n.slice(0,200)+"...[truncated]";continue}e[r]=n}return e}var X=[],xt=null,R=null,fr=["off","pdp_tryon","pdp","all","tryon_engaged"],z,bt=null,Y="unknown",j=[],P=null;function ie(){let t=f();return"mk_engaged_"+(t&&t.projectId||"")}function _t(){if(P!==null)return P;try{P=localStorage.getItem(ie())==="1"}catch(t){P=!1}return P}function ce(){if(!_t()){P=!0;try{localStorage.setItem(ie(),"1")}catch(t){}Z(!1)}}var mr=/^purchase$/;function ae(t,e){if(z===void 0)return"hold";if(z==="off")return"drop";if(z==="all"||e&&mr.test(e))return"collect";switch(z){case"pdp":return t==="pdp"?"collect":"drop";case"tryon_engaged":if(_t())return"collect";case"pdp_tryon":return t!=="pdp"?"drop":Y==="available"?"collect":Y==="unavailable"?"drop":"hold";default:return"collect"}}function Z(t){if(!j.length)return;let e=[];for(let r of j){let n=ae(r._pt,r.name);n==="collect"?ue(r.name,r.params,r.ts):n==="hold"&&!t&&e.push(r)}j=e}function Ct(t){z=fr.indexOf(t)>=0?t:"all",Z(!1)}function le(t){Y=t==="available"?"available":"unavailable",Z(!1)}function se(t){Z(!0),R=t,bt=t&&t.pageType||null,Y="unknown"}function s(t,e,r){if(!f().projectId){(s._pre=s._pre||[]).push({name:t,params:e,ts:r||Date.now()}),s._pre.length>50&&s._pre.shift();return}if(s._pre&&s._pre.length){let o=s._pre;s._pre=[];for(let i of o)oe(i.name,i.params,i.ts)}oe(t,e,r)}function oe(t,e,r){let n=ae(bt,t);if(n==="collect"){ue(t,e,r);return}if(n==="drop"){d("descartado (escopo)",t);return}j.push({name:t,params:e,ts:r||Date.now(),_pt:bt}),j.length>300&&j.shift()}function ue(t,e,r){let n=f(),o=ne(e||{}),i="page_"+hr(t);if(X.push({name:i,ts:r||Date.now(),params:o}),d("queued",t,o),n.observe)try{window.postMessage({__mkpixel:!0,event:{name:i,params:o},site:R?{pageType:R.pageType,platform:R.platform,url:R.url}:null},"*")}catch(c){}if(X.length>=n.batchMaxSize){L();return}xt||(xt=setTimeout(()=>{xt=null,L()},n.batchIntervalMs))}function hr(t){if(typeof t!="string"||!t)return"unknown";let e=t.replace(/^on/,"");return e=e.replace(/[A-Z]/g,(r,n)=>(n>0?"_":"")+r.toLowerCase()),e.indexOf("page_")===0&&(e=e.slice(5)),e}function L(t){if(X.length===0)return;let e=f();if(!e.projectId||!e.collectorUrl)return;let r=X.splice(0,50),n=JSON.stringify({product:e.product||void 0,visitorId:Zt(),sessionId:Qt(),engaged:_t()||void 0,events:r,site:R||void 0}),o=e.collectorUrl+"/v1/track";try{fetch(o,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json","X-MK-Project-Id":e.projectId},body:n}).catch(()=>{})}catch(i){try{navigator.sendBeacon&&navigator.sendBeacon(o+"?projectId="+encodeURIComponent(e.projectId),new Blob([n],{type:"text/plain"}))}catch(c){}}}function de(){try{window.addEventListener("pagehide",()=>L(!0)),window.addEventListener("beforeunload",()=>L(!0)),document.addEventListener("visibilitychange",()=>{document.hidden&&L(!0)})}catch(t){}}function T(t){let e=[];try{let r=document.querySelectorAll('script[type="application/ld+json"]');for(let n of r){let o;try{o=JSON.parse(n.textContent)}catch(c){continue}let i=[];Array.isArray(o)?i.push(...o):o["@graph"]?i.push(...o["@graph"]):i.push(o);for(let c of i){if(!c||!c["@type"])continue;let l=Array.isArray(c["@type"])?c["@type"]:[c["@type"]];(!t||t.some(u=>l.includes(u)))&&e.push(c)}}}catch(r){}return e}var pe=["off","pdp_tryon","pdp","all","tryon_engaged"],yr="all",gr=30*60*1e3,N=null;function M(){if(N)return N;let t=f();return!t.projectId||!t.apiUrl?(N=Promise.resolve(null),N):(N=fetch(t.apiUrl+"/projects/"+t.projectId).then(e=>e.ok?e.json():null).then(e=>e&&e.project||e||null).catch(()=>null),N)}function fe(t){let e=t&&t.analytic&&t.analytic.scope;return pe.indexOf(e)>=0?e:yr}var me=t=>"mk_scope_"+t;function he(t){try{let e=localStorage.getItem(me(t));if(!e)return null;let r=JSON.parse(e);return!r||typeof r.exp!="number"||r.exp<Date.now()?null:pe.indexOf(r.scope)>=0?r.scope:null}catch(e){return null}}function ye(t,e){try{localStorage.setItem(me(t),JSON.stringify({scope:e,exp:Date.now()+gr}))}catch(r){}}var kt={};S(kt,{addToCart:()=>_r,detect:()=>xr,getCartSummary:()=>Cr,id:()=>wr,openCartDrawer:()=>Sr,resolveSku:()=>br});var wr="shopify";function xr(){return!!(window.Shopify||window.ShopifyAnalytics)}function br(){let t=window;return t.ShopifyAnalytics&&t.ShopifyAnalytics.meta&&t.ShopifyAnalytics.meta.product?{value:String(t.ShopifyAnalytics.meta.product.id),source:"shopify"}:null}var Q=t=>String(t==null?"":t).trim().toLowerCase();async function _r({size:t,color:e,sku:r,quantity:n}){let o=(location.pathname.split("/products/")[1]||"").split(/[?#]/)[0];if(!o)throw new Error("shopify: sem handle de produto na URL (n\xE3o \xE9 PDP?)");let c=(await fetch("/products/"+o+".js").then(a=>a.json())).variants||[],l=a=>[a.option1,a.option2,a.option3].concat(String(a.title||"").split("/")).map(Q).filter(Boolean),u=(a,m)=>l(a).indexOf(Q(m))>=0,p=a=>(!t||u(a,t))&&(!e||u(a,e)),y=null;if((t||e)&&(y=c.find(a=>p(a)&&a.available)||c.find(p)),!y&&r&&(y=c.find(a=>Q(a.sku)===Q(r))),y||(y=c.find(a=>a.available)||c[0]),!y)throw new Error("shopify: variante n\xE3o encontrada");let x=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:y.id,quantity:n||1}]})});if(!x.ok)throw new Error("shopify: /cart/add.js HTTP "+x.status);return{platform:"shopify",variantId:y.id,size:y.title,sku:y.sku||null}}async function Cr(){try{let t=await fetch("/cart.js",{headers:{Accept:"application/json"}}).then(e=>e.json());return{value:(Number(t.total_price)||0)/100,itemCount:Number(t.item_count)||0,currency:t.currency||null}}catch(t){return null}}var kr=["[data-cart-drawer-toggle]",'[data-action="open-cart-drawer"]','[data-action="open-cart"]',".js-cart-drawer-open",".js-drawer-open-cart",".cart-drawer-toggle",".js-cart-toggle",'[aria-controls="CartDrawer"]','[aria-controls="cart-drawer"]',"#cart-icon-bubble","#lk-cart-icon",".header__cart",".site-header__cart",".cart-link",".header-cart",'a[href="/cart"]','a[href$="/cart"]'];function vr(t){try{let e=t.getBoundingClientRect();return e.width>0&&e.height>0&&getComputedStyle(t).visibility!=="hidden"}catch(e){return!1}}function Sr(){let t=null;for(let e of kr)try{if(t=[...document.querySelectorAll(e)].find(vr),t)break}catch(r){}return t?(setTimeout(()=>{try{t.click()}catch(e){}},300),!0):!1}var St={};S(St,{addToCart:()=>Lr,detect:()=>Ar,getCartSummary:()=>Ir,id:()=>Tr,resolveSku:()=>Er});var Tr="hybris";function Ar(){return!!(window.ACC&&window.ACC.config)}function Er(){let t=(location.pathname||"").match(/\/p\/([^/?#]+)/);return t&&t[1]?{value:decodeURIComponent(t[1]),source:"hybris/url"}:null}var ge=t=>String(t==null?"":t).trim().toLowerCase();async function Lr({size:t,quantity:e}){let r=[...document.querySelectorAll('.js-product-select-size, a[data-code], [class*="select-size"]')].filter(m=>m.getAttribute&&m.getAttribute("data-code")),n=t?r.find(m=>ge(m.textContent)===ge(t)):null;n||(n=r.find(m=>m.offsetParent!==null)||r[0]);let o=n&&n.getAttribute("data-code");if(!o)throw new Error("hybris: variante (data-code) n\xE3o encontrada");let i=document.getElementById("product--add-to-cart-form")||document.querySelector('form[action*="/cart/add"]'),c=i&&i.querySelector('[name="CSRFToken"]'),l=c&&c.value,u=i&&i.getAttribute("action")||"/cart/add";if(!l)throw new Error("hybris: CSRFToken n\xE3o encontrado");let p=new URLSearchParams;p.set("productCodePost",o),p.set("qty",String(e||1)),p.set("CSRFToken",l);let y=await fetch(u,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:p.toString()});if(!y.ok)throw new Error("hybris: "+u+" HTTP "+y.status);let x=null,a=null;try{let m=await y.clone().json(),g=m&&m.cartData;g&&(x=vt(g.total!=null?g.total:g.totalPrice),a=g.totalUnitCount!=null?Number(g.totalUnitCount):Array.isArray(g.products)?g.products.length:null)}catch(m){}return{platform:"hybris",productCode:o,size:n.textContent.trim(),cartValue:x,itemCount:a,currency:"BRL"}}function vt(t){if(t==null||t==="")return null;if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).replace(/[^\d.,]/g,"");if(!e)return null;let r=e.indexOf(",")>e.indexOf(".")?parseFloat(e.replace(/\./g,"").replace(",",".")):parseFloat(e.replace(/,/g,""));return Number.isFinite(r)?r:null}async function Ir(){try{let t=await fetch("/cart/async?nocache="+Date.now(),{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(c=>c.ok?c.text():"");if(!t)return null;let e=new DOMParser().parseFromString(t,"text/html"),r=e.querySelector(".minicart-total .price")||e.querySelector(".floating-cart--cart-total"),n=r?vt(r.textContent):null,o=e.querySelector(".mini-badge"),i=o?parseInt(o.textContent,10)||0:null;return n==null&&i==null?null:{value:n,itemCount:i,currency:"BRL"}}catch(t){}try{let t=[".minicart-total .price",".js-cart-total",".cart-total",".total-price",".grand-total"];for(let e of t){let r=document.querySelector(e),n=r&&vt(r.textContent);if(n)return{value:n,itemCount:null,currency:"BRL"}}}catch(t){}return null}var Tt={};S(Tt,{addToCart:()=>Nr,detect:()=>Rr,getCartSummary:()=>Mr,id:()=>Pr,resolveSku:()=>jr});var Pr="vtex";function Rr(){return!!(window.vtex||window.vtexjs||window.vtxctx||window.skuJson_0)}function jr(){let t=window;return t.vtxctx&&t.vtxctx.skus&&t.vtxctx.skus[0]?{value:String(t.vtxctx.skus[0]),source:"vtex/vtxctx"}:t.skuJson_0&&t.skuJson_0.skus&&t.skuJson_0.skus[0]?{value:String(t.skuJson_0.skus[0].sku),source:"vtex/skuJson"}:null}var tt=t=>String(t==null?"":t).trim().toLowerCase();async function Nr({size:t,quantity:e}){let r=window.skuJson_0&&window.skuJson_0.skus||[];if(!r.length)throw new Error("vtex: skuJson_0 indispon\xEDvel");let n=i=>tt(i.skuname)===tt(t)||i.dimensions&&Object.values(i.dimensions).some(c=>tt(c)===tt(t)),o=t?r.find(i=>n(i)&&i.available)||r.find(n):null;if(o||(o=r.find(i=>i.available)||r[0]),!o)throw new Error("vtex: variante n\xE3o encontrada");if(window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.addToCart)return await window.vtexjs.checkout.addToCart([{id:parseInt(o.sku,10),quantity:e||1,seller:"1"}]),{platform:"vtex",skuId:o.sku,size:o.skuname||t};throw new Error("vtex: vtexjs.checkout indispon\xEDvel")}function Mr(){try{let t=window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.orderForm;if(t&&typeof t.value=="number"){let e=t.storePreferencesData&&t.storePreferencesData.currencyCode||"BRL",r=(t.items||[]).reduce((n,o)=>n+(Number(o.quantity)||1),0);return{value:t.value/100,itemCount:r,currency:e}}}catch(t){}return null}var At={};S(At,{addToCart:()=>Fr,detect:()=>Ur,getCartSummary:()=>qr,id:()=>Br,resolveSku:()=>Dr,skipRedirect:()=>Or});var Br="nuvemshop",Or=!0;function Ur(){return!!(window.LS&&(window.LS.cart||window.LS.addToCart))}function Dr(){try{let t=window.LS,e=t&&t.variants||[],r=document.querySelector('[name="variant_id"]'),n=r&&r.value?e.find(o=>String(o.id)===String(r.value)):null;if(n||(n=e.find(o=>o.available!==!1&&o.sku)||e.find(o=>o.sku)||e[0]),n&&n.sku)return{value:String(n.sku),source:"nuvemshop/variant"};if(t&&t.product&&t.product.sku)return{value:String(t.product.sku),source:"nuvemshop/product"}}catch(t){}return null}var et=t=>String(t==null?"":t).trim().toLowerCase();async function Fr({size:t,quantity:e}){let r=document.getElementById("product_form")||document.querySelector('.js-product-form, form[action*="/comprar"]');if(!r)throw new Error("nuvemshop: #product_form n\xE3o encontrado");t&&r.querySelectorAll('select[name^="variation"]').forEach(i=>{let c=[...i.options].find(l=>et(l.textContent).includes(et(t))||et(l.value)===et(t));c&&(i.value=c.value,i.dispatchEvent(new Event("change",{bubbles:!0})))});let n=r.querySelector('[name="quantity"]');return n&&e&&(n.value=String(e)),await new Promise(i=>setTimeout(i,400)),typeof r.requestSubmit=="function"?r.requestSubmit():r.submit(),{platform:"nuvemshop",variantId:(r.querySelector('[name="variant_id"]')||{}).value||null}}function qr(){try{let t=window.LS,e=t&&t.cart;if(!e)return null;let r=t.currency&&t.currency.code||"BRL",n=Array.isArray(e.items)?e.items.reduce((i,c)=>i+(Number(c.quantity)||1),0):Number(e.items)||0,o=e.subtotal!=null?Number(e.subtotal):null;return{value:o!=null?o/100:null,itemCount:n,currency:r}}catch(t){return null}}var Et={};S(Et,{addToCart:()=>Vr,detect:()=>Kr,getCartSummary:()=>Jr,id:()=>zr,resolveSku:()=>Hr,skipRedirect:()=>$r});var zr="wake",$r=!0;function Kr(){return!!(window.StorefrontClient||typeof window.addOrCreateCheckout=="function"||typeof window.addToCartClick=="function")}function Hr(){try{let t=document.querySelector('input[name="product-id"], [data-product-id]'),e=t?t.value||t.getAttribute("data-product-id"):null;if(e)return{value:String(e).trim(),source:"wake/product-id"};let r=(location.pathname||"").match(/-(\d+)\/?(?:[?#]|$)/);if(r)return{value:r[1],source:"wake/url"}}catch(t){}return null}var we=t=>String(t==null?"":t).trim().toLowerCase();async function Vr({size:t,quantity:e}){if(t){let i=[...document.querySelectorAll("input[attribute-value]")].find(c=>we(c.getAttribute("attribute-value"))===we(t));if(i){try{i.checked=!0}catch(c){}try{typeof window.selectAttribute=="function"?window.selectAttribute(i):i.click()}catch(c){}await new Promise(c=>setTimeout(c,600))}}let r=document.querySelector('[name="product-variant-id"]'),n=r&&r.value;if(!n)throw new Error("wake: product-variant-id n\xE3o encontrado");if(typeof window.addOrCreateCheckout!="function")throw new Error("wake: addOrCreateCheckout indispon\xEDvel");if(!await window.addOrCreateCheckout([{productVariantId:Number(n),quantity:e||1,customization:[]}]))throw new Error("wake: addOrCreateCheckout retornou false");return{platform:"wake",productVariantId:n,size:t||null}}function Jr(){try{let t=document.querySelectorAll('[class*="total" i],[class*="minicart" i],[class*="cart" i]');for(let e of t){let r=e.textContent||"";if(/total/i.test(r)){let n=r.match(/R\$\s*([\d.]+,\d{2})/);if(n){let o=parseFloat(n[1].replace(/\./g,"").replace(",","."));if(Number.isFinite(o)&&o>0)return{value:o,itemCount:null,currency:"BRL"}}}}}catch(t){}return null}var It={};S(It,{addToCart:()=>rt,detect:()=>Gr,id:()=>Wr,resolveSku:()=>Lt});var Wr="generic";function Gr(){return!0}function Lt(){let t=T(["Product"]);if(t[0]){let e=t[0],r=e.sku||e.mpn||e.gtin13||e.productID;if(r)return{value:String(r),source:"jsonld"}}try{let e=document.querySelector('[itemprop="sku"]');if(e){let r=e.getAttribute("content")||(e.textContent||"").trim();if(r)return{value:String(r),source:"microdata"}}}catch(e){}try{let e=window.konfidencyData;if(e&&e.product&&e.product.variants&&e.product.variants[0])return{value:String(e.product.variants[0]),source:"konfidency"}}catch(e){}return null}var Xr=/(adicionar\s*(à|a|ao)?\s*(sacola|carrinho|cesta|bolsa))|adicionar ao carrinho|add to (cart|bag)|comprar agora/i,Yr=/continuar|como comprar|lista|desejos|favorito/i;async function rt(){let t=document.querySelectorAll("button,[role=button],input[type=submit]");for(let e of t){let r=(e.textContent||e.value||"").replace(/\s+/g," ").trim();if(r&&r.length<40&&Xr.test(r)&&!Yr.test(r))try{return e.click(),{platform:"native-click",clicked:r}}catch(n){}}return{platform:"none",error:"bot\xE3o de carrinho nativo n\xE3o encontrado"}}var _e=[kt,St,Tt,At,Et],Zr=[["woocommerce",()=>!!(window.wc_add_to_cart_params||window.woocommerce_params)],["lojaintegrada",()=>!!window.LojaIntegrada]],nt;function $(){return nt||(nt=_e.find(t=>{try{return t.detect()}catch(e){return!1}})||It,nt)}function Ce(){let t=_e.find(e=>{try{return e.detect()}catch(r){return!1}});if(t)return t.id;for(let[e,r]of Zr)try{if(r())return e}catch(n){}return null}function K(){let t=$();if(t.id!=="generic"&&t.resolveSku)try{let e=t.resolveSku();if(e)return e}catch(e){}return Lt()}async function ke(t){t=t||{};let e={size:t.size||t.selectedSize||t.tamanho||null,color:t.color||t.selectedColor||t.colour||t.cor||null,sku:t.sku||t.identifier||t.selectedIdentifier||null,quantity:t.quantity||1},r=$();try{let n=r.addToCart?await r.addToCart(e):await rt(e);return d("cart: adicionado",n),be(),xe(r,n,e.sku),n}catch(n){d('cart: adapter "'+r.id+'" falhou \u2014 fallback clique nativo',n&&n.message);let o=await rt(e);return be(),xe(r,o,e.sku),o}}async function xe(t,e,r){try{let n=null;e&&e.cartValue!=null?n={value:e.cartValue,itemCount:e.itemCount!=null?e.itemCount:null,currency:e.currency||null}:t&&t.getCartSummary&&(n=await t.getCartSummary()),n&&n.value!=null&&(n.value>0||(n.itemCount||0)>0)&&s("cart_value",{via:"tryon",value:n.value,itemCount:n.itemCount!=null?n.itemCount:null,currency:n.currency||null,sku:r||null})}catch(n){}}async function ve(){let t=$();if(t&&t.getCartSummary)try{return await t.getCartSummary()}catch(e){}return null}function be(){["cart:refresh","cart:updated","cart:build","ajaxProduct:added","product:added-to-cart"].forEach(t=>{try{document.dispatchEvent(new CustomEvent(t))}catch(e){}})}async function Se(){let t=$(),e=f(),r=null;try{r=await M()}catch(i){}let n=r&&r.template&&r.template.cart||r&&r.cart||{},o=n.afterAdd||n.behavior||e.cartBehavior;if(o||(o=e.cartRedirect===!1?"none":"auto"),o==="none")return!1;if(o==="auto"||o==="drawer"){let i=n.openSelector||e.cartOpenSelector;if(i){let c=document.querySelector(i);if(c)return setTimeout(()=>{try{c.click()}catch(l){}},300),!1}else if(t&&t.openCartDrawer){let c=!1;try{c=t.openCartDrawer()}catch(l){}if(c)return!1}}return!0}function Te(){let t=$();if(t&&t.skipRedirect)return;let e=t&&t.cartUrl||"/cart";setTimeout(()=>{try{window.location.href=e}catch(r){}},250)}var Qr=/\/(thank[_-]?you|orders?\/|pedido[_-]?(confirmado|realizado|finalizado|sucesso)|sucesso|order[_-]?confirmation|compra[_-]?(finalizada|concluida)|orderplaced)/i,tn=/\/(my[_-]?account|minha[_-]?conta|account|conta|customer|cliente|profile|perfil|wishlist|favoritos)(\/|$)/i,en=/\/checkout/i,rn=/\/(cart|carrinho|sacola|bag)(\/|$|\?|#)/i,nn=/\/(products?|produtos?|p)\//i,on=/\/(collections?|categoria|categorias|c|departamento)\//i,cn=/\/(search|busca|s)(\/|\?)/i;function Ae(){try{if(window.__mkPageType)return window.__mkPageType}catch(r){}let t=(location.pathname||"").toLowerCase(),e=tn.test(t);try{let r=T();for(let n of r){let o=Array.isArray(n["@type"])?n["@type"]:[n["@type"]];if((o.includes("Order")||o.includes("Invoice"))&&!e)return"purchase";if(o.includes("Product"))return"pdp";if(o.includes("SearchResultsPage"))return"search";if(o.includes("CollectionPage")||o.includes("ItemList"))return"category"}}catch(r){}return t==="/"||t===""||t==="/home"||t==="/index.html"?"home":Qr.test(t)&&!e?"purchase":en.test(t)?"checkout":rn.test(t)?"cart":nn.test(t)?"pdp":on.test(t)?"category":cn.test(t)?"search":"other"}function Ee(t){let e=null;try{let r=new URLSearchParams(location.search),n=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],o={};for(let i of n){let c=r.get(i);c&&(o[i.replace("utm_","")]=c)}Object.keys(o).length&&(e=o)}catch(r){}return{url:location.href,pathname:location.pathname,referrer:document.referrer||null,title:document.title||null,pageType:t,utm:e,userAgent:navigator.userAgent,language:navigator.language,viewport:window.innerWidth+"x"+window.innerHeight,platform:an()}}function an(){return Ce()}var Pt={},ln=null,H=0,Le=!1;function Ie(t){Le||(Le=!0,Pe(t),sn(),un(),dn(),pn(),fn(t))}function Pe(t){Pt={};let e=Ae(),r=Ee(e);if(se(r),s("view",{url:location.href,pathname:location.pathname,referrer:document.referrer||null,title:document.title||null,pageType:e}),typeof t=="function")try{t(e,r)}catch(n){}}function sn(){if(!document.body)return;let t={A:1,BUTTON:1,INPUT:1,SELECT:1,TEXTAREA:1},e=0;document.body.addEventListener("click",r=>{try{let n=Date.now();if(n-e<100)return;e=n;let o=r.target;for(let l=0;l<5&&o&&o!==document.body&&!(t[o.tagName]||o.getAttribute&&o.getAttribute("role")==="button");l++)o=o.parentElement;if(!o||!t[o.tagName]&&!(o.getAttribute&&o.getAttribute("role")==="button"))return;let i={tag:o.tagName},c=o.tagName==="INPUT"||o.tagName==="TEXTAREA"?o.value:o.textContent;i.text=(c||"").replace(/\s+/g," ").trim().substring(0,100),o.href&&(i.href=String(o.href).substring(0,500)),o.id&&(i.id=o.id),o.className&&typeof o.className=="string"&&(i.classes=o.className.trim().substring(0,200)),s("click",i)}catch(n){}},{capture:!0,passive:!0})}function un(){let t=[25,50,75,100],e=null,r=()=>{try{let n=window.scrollY||document.documentElement.scrollTop||0,o=Math.max(document.body&&document.body.scrollHeight||0,document.documentElement&&document.documentElement.scrollHeight||0);if(o<=0)return;let i=Math.min(100,Math.floor((n+window.innerHeight)/o*100));for(let c of t)i>=c&&!Pt[c]&&(Pt[c]=!0,s("scroll_depth",{depth:c}))}catch(n){}};r(),window.addEventListener("scroll",()=>{e||(e=setTimeout(()=>{e=null,r()},250))},{passive:!0})}function dn(){document.body&&document.body.addEventListener("submit",t=>{try{let e=t.target;if(!e||e.tagName!=="FORM"||e.querySelector('input[type="password"], input[name*="card"], input[name*="cpf"]'))return;let r="other",n=(e.className||"").toLowerCase(),o=(e.action||"").toLowerCase();e.querySelector('input[type="search"], input[name="q"], input[name="s"]')?r="search":/newsletter|subscribe|mailchimp/.test(n+o)?r="newsletter":/contact|contato/.test(n+o)&&(r="contact"),s("form_submit",{form_id:e.id||"",form_type:r})}catch(e){}},{capture:!0})}function pn(){let t=f();H=Date.now(),ln=setInterval(()=>{if(document.hidden)return;let e=Date.now(),r=Math.round((e-H)/1e3);H=e,r>0&&r<60&&s("engagement",{url:location.pathname,dwellSec:r})},t.engagementIntervalMs),document.addEventListener("visibilitychange",()=>{if(document.hidden){let e=Math.round((Date.now()-H)/1e3);e>0&&e<600&&s("engagement",{url:location.pathname,dwellSec:e})}H=Date.now()})}function fn(t){let e=location.href,r=()=>{location.href!==e&&(e=location.href,Pe(t))};try{let n=history.pushState,o=history.replaceState;history.pushState=function(){n.apply(this,arguments),setTimeout(r,0)},history.replaceState=function(){o.apply(this,arguments),setTimeout(r,0)},window.addEventListener("popstate",r)}catch(n){}}function jt(){let t=K(),e=T(["Product"]);if(e.length>0){let o=e[0],i=Array.isArray(o.offers)?o.offers[0]:o.offers;return{sku:t?t.value:o.sku||o.mpn||o.gtin13||o.productID||null,skuSource:t?t.source:null,name:typeof o.name=="string"?o.name:null,price:i&&parseFloat(i.price||i.lowPrice)||null||Re(),currency:i?i.priceCurrency:null,brand:o.brand?typeof o.brand=="string"?o.brand:o.brand.name:null,category:o.category||null}}let r=o=>{let i=document.querySelector('meta[property="og:'+o+'"], meta[property="product:'+o+'"]');return i?i.getAttribute("content"):null},n=o=>{let i=document.querySelector('[itemprop="'+o+'"]');return i?i.getAttribute("content")||(i.textContent||"").trim():null};if(t||r("type")==="product"||r("price:amount")||n("name")){let o=n("price")||r("price:amount"),i=o&&parseFloat(String(o).replace(",","."))||null;return{sku:t?t.value:null,skuSource:t?t.source:null,name:n("name")||r("title")||document.title||null,price:(i&&i>0?i:null)||Re(),currency:n("priceCurrency")||r("price:currency")||null,brand:n("brand")||null,category:null}}return null}function Re(){try{let t=window.dataLayer;if(!Array.isArray(t))return null;for(let e=t.length-1;e>=0;e--){let r=t[e];if(!r||typeof r!="object")continue;let n=r.ecommerce||r,o=n&&n.items||null,i=n&&n.detail&&n.detail.products||n&&n.products||r.products||null,c=Array.isArray(o)&&o[0]&&o[0].price||Array.isArray(i)&&i[0]&&i[0].price||null,l=Rt(c!=null?String(c):"");if(l)return l}}catch(t){}return null}function I(){try{let t=location.pathname+location.search,e=t.match(/order[_-]?confirmation\/([\w-]+)/i)||t.match(/[?&]order[_-]?id=([\w-]+)/i)||t.match(/\/orders?\/([\w-]{4,})/i)||t.match(/pedido[_-]?(?:confirmado|realizado|finalizado)?\/([\w-]+)/i);return e?e[1]:null}catch(t){return null}}function Nt(){let t=T(["Order","Invoice"]);if(t.length>0){let o=t[0],i=o.totalPaymentDue?parseFloat(o.totalPaymentDue.price):parseFloat(o.price||o.total);return{orderId:o.orderNumber||o.confirmationNumber||o.identifier||I(),revenue:Number.isFinite(i)?i:null,currency:o.totalPaymentDue&&o.totalPaymentDue.priceCurrency||o.priceCurrency||null,source:"jsonld"}}try{let o=window.Shopify&&window.Shopify.checkout;if(o&&o.total_price!=null){let i=parseFloat(o.total_price);return{orderId:(o.order_id!=null?String(o.order_id):null)||o.token||I(),revenue:Number.isFinite(i)?i:null,currency:o.currency||null,itemCount:Array.isArray(o.line_items)?o.line_items.length:null,source:"shopify"}}}catch(o){}try{if(Array.isArray(window.dataLayer))for(let o=window.dataLayer.length-1;o>=0;o--){let i=window.dataLayer[o],c=i&&i.ecommerce||i&&i.ecommerce_data&&i.ecommerce_data.ecommerce;if(c&&(i.event==="purchase"||c.purchase)){let l=c.purchase&&c.purchase.actionField,u=parseFloat(l&&(l.revenue||l.value)||c.value||c.revenue);return{orderId:l&&(l.id||l.transaction_id)||c.transaction_id||c.transactionId||I(),revenue:Number.isFinite(u)?u:null,currency:c.currency||c.currencyCode||l&&l.currency||null,itemCount:(c.purchase&&c.purchase.products||c.items||c.products||[]).length||null,source:"datalayer"}}}}catch(o){}let e=document.querySelector('meta[property="order:total"], meta[name="order-total"]');if(e&&e.content)return{orderId:I(),revenue:parseFloat(e.content)||null,source:"meta"};let r=mn();if(r)return r;let n=I();return n?{orderId:n,revenue:null,source:"url"}:null}function mn(){try{let t=document.querySelector(".orderTotalPrice");if(t){let r=String(t.value||t.getAttribute("value")||t.textContent||"").trim(),n=r.split(/\s+/),o=Rt(n.length>1?n[n.length-1]:r);if(o)return{orderId:je(),revenue:o,currency:(n.length>1?n[0]:null)||null,source:"dom"}}let e=[".order-total","#order-total",".total-price",".order__total","[data-order-total]",".summary-total",".grand-total"];for(let r of e){let n=document.querySelector(r);if(n){let o=Rt(n.value||n.textContent);if(o)return{orderId:je(),revenue:o,source:"dom"}}}return null}catch(t){return null}}function je(){try{let t=document.querySelector(".orderID");if(t&&(t.value||t.getAttribute("value")))return t.value||t.getAttribute("value");let r=(document.body.innerText||"").match(/(?:pedido|order|n[º°o]\.?)\s*#?\s*([A-Z0-9-]{4,})/i);return r?r[1]:null}catch(t){return null}}function Rt(t){if(!t)return null;let e=String(t).replace(/[^\d.,]/g,"");if(!e)return null;let r;e.indexOf(",")>e.indexOf(".")?r=e.replace(/\./g,"").replace(",","."):r=e.replace(/,/g,"");let n=parseFloat(r);return Number.isFinite(n)&&n>0?n:null}function Ne(){let t=T(["ItemList","CollectionPage"]);if(t.length===0)return null;let e=t[0],r=e.itemListElement||e.mainEntity&&e.mainEntity.itemListElement||[],n=[];for(let o of r.slice(0,50)){let i=o.item||o;i&&(i.sku||i.productID||i.name)&&n.push(i.sku||i.productID||i.name)}return n.length>0?{count:n.length,skus:n.slice(0,20)}:null}var Me=!1,ot=[/\b(adicionar|adic\.?|colocar|incluir|jogar)\b.{0,30}\b(carrinho|sacola|sacolinha|bag)\b/i,/\bcomprar\b(?!\s+(em|por|sem))/i,/\bcomprar\s*$/i,/^add\s+to\s+(cart|bag)\b/i,/^buy\s+(now|it|this)\b/i,/^(sacolinha|carrinho|sacola)$/i],hn=[/^finalizar(\s+(compra|pedido|pagamento))?\b/i,/^(fechar|confirmar)\s+(compra|pedido|pagamento)\b/i,/^pagar(\s+(agora|pedido))?\b/i,/^(complete|place)\s+(purchase|order)\b/i,/^checkout$/i];function V(t,e){for(let r=0;r<t.length;r++)if(t[r].test(e))return!0;return!1}function Ue(t){switch(t){case"pdp":{let e=jt();s("view_item",e||{sku:null});break}case"category":case"search":{let e=Ne();s("view_item_list",e||{count:0});break}case"cart":ve().then(e=>s("view_cart",e&&e.value!=null?{value:e.value,itemCount:e.itemCount,currency:e.currency}:{})).catch(()=>s("view_cart",{}));break;case"checkout":s("begin_checkout",{});break;case"purchase":yn();break}}var Be=500,Oe=16;function yn(){let t=!1,e=0,r=(o,i)=>{t||(t=!0,gn(o,i))};try{window.addEventListener("pagehide",()=>r(Nt(),!0),{once:!0})}catch(o){}let n=()=>{if(t)return;let o=Nt();if(o&&o.revenue!=null)return r(o);if(e++>=Oe)return d("purchase: receita n\xE3o apareceu em "+Be*Oe+"ms \u2014 emitindo sem valor"),r(o);setTimeout(n,Be)};n()}function gn(t,e){if(t&&!t.orderId&&(t.orderId=I()),t&&t.orderId){let r="_mk_purch_"+t.orderId;try{if(sessionStorage.getItem(r)){d("purchase j\xE1 contado",t.orderId);return}sessionStorage.setItem(r,"1")}catch(n){}}else if(Me)return;if(Me=!0,s("purchase",t||{revenue:null,_note:"no_order_data_extracted"}),d("purchase emitido",t),e)try{L(!0)}catch(r){}}function De(){if(!document.body)return;let t=0;document.body.addEventListener("click",e=>{try{let r=Date.now();if(r-t<150)return;let n=e.target;for(let l=0;l<5&&n&&n!==document.body&&!(n.tagName==="BUTTON"||n.tagName==="A"||n.getAttribute&&n.getAttribute("role")==="button");l++)n=n.parentElement;if(!n)return;let o=n.tagName!=="A",i=(n.textContent||"").replace(/\s+/g," ").trim();if(!i||i.length>80)return;let c=!1;if((V([ot[0]],i)||o&&V([ot[1]],i)||o&&V([ot[2]],i)||V(ot.slice(3),i))&&(c=!0),c){t=r;let l=jt();s("add_to_cart",{via:"click",buttonText:i,sku:l?l.sku:null,price:l?l.price:null});return}o&&V(hn,i)&&(t=r,s("begin_checkout",{via:"click",buttonText:i}))}catch(r){}},{capture:!0,passive:!0})}var it={};S(it,{id:()=>wn,iframeSrc:()=>bn,modalSize:()=>xn,onMounted:()=>_n});var wn="mk-fashion",xn={width:430,height:800};function bn(t,e){let r=encodeURIComponent(e).replace(/\./g,"%2E");return f().appUrl+"/"+t+"/"+r}function _n(){}var Mt={};S(Mt,{id:()=>Cn,iframeSrc:()=>Sn,modalSize:()=>kn,onMounted:()=>Ln});var Cn="mk-makeup",kn={width:1160,height:700};function vn(){return window.__MK&&window.__MK.pulpoarUrl||"https://plugin.pulpoar.com/vto"}function Sn(t){return vn()+"/"+encodeURIComponent(t)}var Tn="https://cdn.jsdelivr.net/npm/@pulpoar/plugin-sdk@latest/dist/index.iife.js",ct=null;function An(){return window.pulpoar?Promise.resolve(window.pulpoar):ct||(ct=new Promise(t=>{try{let e=document.createElement("script");e.src=Tn,e.async=!0,e.onload=()=>t(window.pulpoar||null),e.onerror=()=>t(null),(document.head||document.documentElement).appendChild(e)}catch(e){t(null)}}),ct)}function En(t){let e=Array.isArray(t)?t[0]:t;return!e||typeof e!="object"?{quantity:1}:{sku:e.sku||e.slug||e.key||e.variant_key||e.barcode||null,color:e.color||e.shade||e.colorName||null,size:e.size||null,quantity:1}}function Ln(t,e){An().then(r=>{if(!r){d("pulpoar: SDK n\xE3o carregou");return}if(e.identifier)try{r.applyVariantsWithCatalog([String(e.identifier)],n=>{e.track("product_loaded",{via:"makeup",applied:Array.isArray(n)?n.length:0})})}catch(n){d("pulpoar applyVariantsWithCatalog falhou",n&&n.message)}try{r.onReady(()=>e.fire("onReady",{}))}catch(n){}try{r.onAddToCart(n=>{d("pulpoar onAddToCart",n),e.handleAddToCart(En(n),"makeup")})}catch(n){}try{r.onGoToProduct(n=>e.fire("onGoToProduct",n))}catch(n){}})}var In={"mk-fashion":it,"mk-makeup":Mt};function Bt(t){return In[t]||it}var v=null,k=null,lt=!1,st=!1,B=null,Fe={},Ot=null,at=0,_={onReady:null,onClose:null,onAddToCart:null,onProductLoaded:null,onError:null,onInteraction:null,onGenerationComplete:null},Pn={gregory:"698c7e791d3129430f15dddd"};function ze(t){return t?Pn[String(t).toLowerCase()]||t:null}async function O(t,e){let r=f(),n=ze(t);e=String(e||"").trim();let o=r.apiUrl+"/availability/"+n+"?sku="+encodeURIComponent(e),i=await fetch(o);if(!i.ok)throw new Error("availability HTTP "+i.status);return i.json()}async function $e(t,e){e||(e=t,t="698c7e791d3129430f15dddd");try{return(await O(t,e)).available===!0}catch(r){return!1}}async function ut(t){if(t=t||{},lt)return;let e=ze(t.projectId||t.projectid||t.store),r=String(t.identifier||t.sku||"").trim();if(!e||!r){console.error("[mk-sdk] open: projectId e identifier obrigatorios");return}let n=e+":"+r;if(Fe[n]!==!0){try{if(!(await O(e,r)).available){alert("Produto nao disponivel para prova virtual.");return}}catch(i){alert("Produto nao encontrado ou indisponivel.");return}Fe[n]=!0}let o=Bt(f().product).modalSize||{width:430,height:800};B={projectId:e,identifier:r,width:t.width||o.width,height:t.height||o.height},st=!1,Ve(),Rn(B),lt=!0,at=Date.now(),s("modal_opened",{projectId:e,identifier:r})}function Dt(){if(!lt)return;let t=st;if(st=!1,jn(),lt=!1,A("onClose"),s("modal_closed",{projectId:B&&B.projectId,identifier:B&&B.identifier}),t)try{Te()}catch(e){}}function Ke(t){try{let e=er();if(!e)return;t?(e.dataset.mkPrevDisplay===void 0&&(e.dataset.mkPrevDisplay=e.style.display),e.style.display="none"):(e.style.display=e.dataset.mkPrevDisplay||"",delete e.dataset.mkPrevDisplay)}catch(e){}}function Rn(t){v=document.createElement("div"),v.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,.8);display:flex;align-items:center;justify-content:center;z-index:2147483647;",Ke(!0);let e=document.createElement("div"),r=typeof t.width=="number"?t.width+"px":t.width,n=typeof t.height=="number"?t.height+"px":t.height;e.style.cssText="position:relative;width:"+r+";height:"+n+";max-width:100vw;max-height:100dvh;border-radius:12px;overflow:hidden;background:#fff;",k=document.createElement("iframe");let o=Bt(f().product);k.src=o.iframeSrc(t.projectId,t.identifier),k.style.cssText="width:100%;height:100%;border:none;",k.setAttribute("allow","camera *; microphone *"),k.setAttribute("allowfullscreen","true"),e.appendChild(k),v.appendChild(e),document.body.appendChild(v);try{o.onMounted(k,{projectId:t.projectId,identifier:t.identifier,handleAddToCart:Je,track:s,fire:A})}catch(i){d("launcher.onMounted falhou",i&&i.message)}d("try-on modal aberto",k.src)}function jn(){v&&v.parentNode&&v.parentNode.removeChild(v),v=null,k=null,Ke(!1)}var qe=!1;function He(){Ve()}function Ve(){qe||(qe=!0,window.addEventListener("message",t=>{let e=t.data;if(!e||e.source!=="mkfashion-app")return;let r=e.action,n=e.data||{};switch(r){case"close_request":Dt();break;case"ready":A("onReady",n);break;case"product_loaded":A("onProductLoaded",n),s("product_loaded",Ut(n));break;case"interaction":{A("onInteraction",n),n&&n.method&&(Ot=n.method),s(Nn(n),Ut(n));break}case"add_to_cart":Je(n,"tryon");break;case"generation_start":at=Date.now();break;case"generation_complete":A("onGenerationComplete",n),s("generation_complete",{method:n.method||Ot||"unknown",durationMs:at?Date.now()-at:null,success:n.success!==!1,imageUrlPresent:!!n.imageUrl});break;case"generation_error":A("onError",n),s("generation_error",{method:Ot||"unknown",error:n&&n.error});break}}))}function Je(t,e){if(s("add_to_cart",Object.assign({via:e||"tryon"},Ut(t))),typeof _.onAddToCart=="function"){A("onAddToCart",t);return}ke(t).then(()=>Se()).then(r=>{st=!!r}).catch(()=>{})}function Nn(t){return t&&t.action,"interaction"}function Ut(t){if(!t||typeof t!="object")return t;let e={};for(let r in t){if(r==="imageUrl"||r==="image"||r==="product"){r==="product"&&t[r]?(e.productSku=t[r].sku||null,e.productName=t[r].name||null):e[r+"Present"]=!!t[r];continue}e[r]=t[r]}return e}function A(t,e){if(typeof _[t]=="function")try{_[t](e)}catch(r){console.error("[mk-sdk]",r)}}function We(t){_.onReady=t}function Ge(t){_.onClose=t}function Xe(t){_.onAddToCart=t}function Ye(t){_.onProductLoaded=t}function Ze(t){_.onError=t}function Qe(t){_.onInteraction=t}function tr(t){_.onGenerationComplete=t}var Bn=767,On=1024,Un=/(adicionar\s*(à|a|ao)?\s*(sacola|carrinho|cesta|bolsa))|adicionar ao carrinho|add to (cart|bag)|comprar agora|^comprar$|finalizar compra|eu quero/i,Dn=/continuar|como comprar|lista|desejos|favorito|looks|cupom/i;function Ft(t){try{let e=t.getBoundingClientRect();if(e.width<=0||e.height<=0)return!1;let r=getComputedStyle(t);return r.display!=="none"&&r.visibility!=="hidden"&&r.opacity!=="0"}catch(e){return!1}}function Fn(t){if(!t)return!1;try{let e=document.querySelector(t);return!!e&&Ft(e)}catch(e){return!1}}function qn(t){return(t.tagName==="INPUT"?t.value||"":t.textContent||"").replace(/\s+/g," ").trim()}function zn(t){if(!t||typeof t!="object"||t.selector)return t;let e=!1;if(["mobile","tablet","desktop"].forEach(n=>{let o=t[n];o&&o.mkAnchor===1&&o.anchor&&typeof o.anchor=="object"&&(e=!0)}),!e)return t;let r={};return["mobile","tablet","desktop"].forEach(n=>{let o=t[n];if(o){if(o.selector){r[n]=o;return}if(o.mkAnchor===1&&o.anchor&&typeof o.anchor=="object"){let i=o.anchor[n]||o.anchor.desktop||o.anchor.mobile||o.anchor.tablet;i&&i.selector&&(r[n]=i)}}}),["bpMobile","bpTablet","breakpoint"].forEach(n=>{t[n]!=null&&(r[n]=t[n])}),r}function qt(t){if(!t||typeof t!="object")return null;if(t=zn(t),t.selector)return t;let e=[["mobile",t.mobile],["tablet",t.tablet],["desktop",t.desktop]].filter(u=>u[1]&&u[1].selector);if(e.length===0)return null;if(e.length===1)return e[0][1];let r=e.filter(([,u])=>Fn(u.selector));if(r.length===1)return r[0][1];let n=window.innerWidth||1024,o=Number(t.bpMobile)||Number(t.breakpoint)||Bn,i=Number(t.bpTablet)||On,c=u=>(e.find(p=>p[0]===u)||[])[1],l=n<=o?["mobile","tablet","desktop"]:n<=i?["tablet","desktop","mobile"]:["desktop","tablet","mobile"];for(let u of l){let p=c(u);if(p)return p}return e[0][1]}function rr(){let t=f(),e=qt(t&&t.anchor);if(e&&e.selector)try{let n=document.querySelector(e.selector);if(n&&Ft(n))return{el:n,position:e.position||"afterend",mode:e.mode||"flow",style:e.style||"",align:e.align||"top-left",selector:e.selector}}catch(n){}let r=document.querySelectorAll('button, [role="button"], a.btn, a.button, input[type="submit"], input[type="button"]');for(let n of r){let o=qn(n);if(!(!o||o.length>40)&&!Dn.test(o)&&Un.test(o)&&Ft(n))return{el:n,position:"afterend",mode:"flow",style:"",selector:null}}return null}var b="'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",zt={none:"0",sm:"4px",md:"8px",pill:"9999px"},$t={none:"0",sm:"4px",md:"8px",lg:"16px"},$n='<svg viewBox="0 0 17.5263 20.6862" fill="none" xmlns="http://www.w3.org/2000/svg" style="display:block;width:100%;height:100%"><g><path d="M8.49995 12.1862C10.1568 12.1862 11.5 10.8431 11.5 9.18622C11.5 7.52936 10.1568 6.18622 8.49995 6.18622C6.8431 6.18622 5.49995 7.52936 5.49995 9.18622C5.49995 10.8431 6.8431 12.1862 8.49995 12.1862Z" stroke="currentColor" shape-rendering="crispEdges"/><path d="M0.5 9.11152C0.5 6.56953 0.5 5.29894 1.1099 4.38664C1.375 3.9902 1.71424 3.65088 2.10821 3.38809C2.6945 2.9958 3.42899 2.85564 4.55351 2.80588C5.09013 2.80588 5.55183 2.39949 5.65687 1.87284C5.73715 1.48708 5.94572 1.14138 6.24735 0.894155C6.54898 0.646934 6.92516 0.51336 7.31231 0.516006H9.9734C10.7779 0.516006 11.4709 1.08412 11.6288 1.87284C11.7339 2.39949 12.1956 2.80588 12.7322 2.80588C13.8559 2.85564 12.9129 4.67413 13.5 5.06559C13.8949 5.32932 15.1484 3.80355 15.5 4.02647C16.1099 4.93876 16.7857 6.56953 16.7857 9.11152C16.7857 11.6535 16.7857 12.9233 16.1758 13.8364C15.9107 14.2328 15.5715 14.5722 15.1775 14.835C14.2647 15.4445 12.9936 15.4445 10.4522 15.4445H6.83351C4.29213 15.4445 3.02103 15.4445 2.10821 14.835C1.71446 14.5718 1.3755 14.2322 1.11071 13.8356C0.933802 13.5672 0.803519 13.2698 0.725557 12.9564" stroke="currentColor" stroke-linecap="round"/><path d="M12.676 0.607931C12.9446 -0.178095 14.0307 -0.2019 14.3491 0.536515L14.3761 0.60838L14.7385 1.66839C14.8216 1.91149 14.9559 2.13395 15.1322 2.32076C15.3086 2.50757 15.5229 2.65439 15.7608 2.75131L15.8583 2.78769L16.9183 3.14971C17.7044 3.41831 17.7282 4.50437 16.9902 4.82283L16.9183 4.84978L15.8583 5.21225C15.6151 5.29526 15.3926 5.42947 15.2057 5.60582C15.0188 5.78218 14.8719 5.99657 14.7749 6.23453L14.7385 6.33155L14.3765 7.39201C14.1079 8.17803 13.0219 8.20184 12.7039 7.46387L12.676 7.39201L12.314 6.332C12.231 6.08881 12.0968 5.86627 11.9204 5.67938C11.744 5.49249 11.5297 5.3456 11.2917 5.24863L11.1947 5.21225L10.1347 4.85022C9.34817 4.58163 9.32437 3.49557 10.0628 3.17756L10.1347 3.14971L11.1947 2.78769C11.4378 2.70462 11.6602 2.57039 11.847 2.39404C12.0339 2.21769 12.1807 2.00333 12.2776 1.76541L12.314 1.66839L12.676 0.607931Z" fill="currentColor"/></g></svg>',Kn='<svg viewBox="0 0 11.6122 12.7248" fill="none" xmlns="http://www.w3.org/2000/svg" style="display:block;width:12px;height:12px"><path d="M4.09055 2.01133C4.43939 0.9905 5.84989 0.959583 6.26347 1.91858L6.29847 2.01192L6.76922 3.38858C6.8771 3.7043 7.05144 3.99321 7.28047 4.23583C7.5095 4.47845 7.7879 4.66912 8.09689 4.795L8.22347 4.84225L9.60014 5.31242C10.621 5.66125 10.6519 7.07175 9.69347 7.48533L9.60014 7.52033L8.22347 7.99108C7.90764 8.09889 7.61862 8.2732 7.3759 8.50223C7.13318 8.73127 6.94241 9.0097 6.81647 9.31875L6.76922 9.44475L6.29905 10.822C5.95022 11.8428 4.53972 11.8737 4.12672 10.9153L4.09055 10.822L3.62039 9.44533C3.51258 9.12951 3.33827 8.84048 3.10924 8.59776C2.8802 8.35504 2.60177 8.16427 2.29272 8.03833L2.16672 7.99108L0.790054 7.52092C-0.231363 7.17208 -0.26228 5.76158 0.69672 5.34858L0.790054 5.31242L2.16672 4.84225C2.48244 4.73437 2.77135 4.56003 3.01397 4.331C3.25658 4.10197 3.44726 3.82357 3.57314 3.51458L3.62039 3.38858L4.09055 2.01133ZM9.86147 0C9.9706 0 10.0775 0.0306123 10.1701 0.0883584C10.2627 0.146104 10.3373 0.228668 10.3853 0.326667L10.4133 0.394917L10.6175 0.993417L11.2166 1.19758C11.3259 1.23474 11.4218 1.30353 11.492 1.39523C11.5623 1.48693 11.6037 1.59741 11.611 1.71268C11.6184 1.82795 11.5914 1.94281 11.5334 2.04271C11.4755 2.14261 11.3891 2.22305 11.2854 2.27383L11.2166 2.30183L10.6181 2.506L10.4139 3.10508C10.3767 3.21442 10.3078 3.31024 10.2161 3.38041C10.1244 3.45058 10.0139 3.49194 9.89859 3.49925C9.78333 3.50656 9.66849 3.47949 9.56863 3.42147C9.46876 3.36345 9.38837 3.27709 9.33764 3.17333L9.30964 3.10508L9.10547 2.50658L8.50639 2.30242C8.39702 2.26526 8.30115 2.19647 8.23092 2.10477C8.16069 2.01307 8.11926 1.90259 8.11189 1.78732C8.10452 1.67205 8.13153 1.55719 8.18951 1.45729C8.24749 1.35739 8.33381 1.27695 8.43755 1.22617L8.50639 1.19817L9.10489 0.994L9.30905 0.394917C9.34839 0.279665 9.42281 0.179613 9.52187 0.108791C9.62094 0.0379686 9.73969 -0.0000730808 9.86147 0Z" fill="currentColor"/></svg>';function h(t,e={}){let r=document.createElement(t);if(e.style&&(r.style.cssText=e.style),e.text!=null&&(r.textContent=e.text),e.html!=null&&(r.innerHTML=e.html),e.attrs)for(let n in e.attrs)r.setAttribute(n,e.attrs[n]);if(e.on)for(let n in e.on)r.addEventListener(n,e.on[n]);if(e.children)for(let n of e.children)n&&r.appendChild(n);return r}function dt(t,e){let r=Number(e)>0?Number(e):24;return h("span",{style:`width:${r}px;height:${r}px;padding:2px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;color:${t};flex-shrink:0;`,html:$n})}function nr(t){return h("span",{style:`width:12px;height:12px;display:inline-flex;align-items:center;justify-content:center;color:${t};flex-shrink:0;`,html:Kn})}function pt(t){return t.borderWidth>0&&t.borderColor?`${t.borderWidth}px solid ${t.borderColor}`:"none"}function ft(){if(!document.getElementById("mk-jakarta-font"))try{document.head.appendChild(h("link",{attrs:{id:"mk-jakarta-font",rel:"stylesheet",href:"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700&display=swap"}}))}catch(t){}}function Hn(t){return t.subtext?h("span",{style:`display:flex;align-items:center;justify-content:center;padding:4px;background:${t.badgeBgColor};font-family:${b};font-weight:700;font-size:16px;text-transform:uppercase;color:${t.badgeTextColor};line-height:1;white-space:nowrap;`,text:t.subtext}):null}function or(t,e){ft();let r=h("span",{style:"display:inline-flex;align-items:center;gap:4px;",children:[dt(t.textColor,t.iconSize),h("span",{text:t.text,style:`font-family:${b};font-weight:700;font-size:${t.fontSize}px;text-transform:uppercase;letter-spacing:2px;color:${t.textColor};white-space:nowrap;text-align:center;line-height:1;`})]});return h("button",{attrs:{type:"button"},style:`display:flex;align-items:center;justify-content:center;gap:8px;padding:8px;width:100%;max-width:238px;box-sizing:border-box;background:${t.bgColor};border:${pt(t)};border-radius:${t.borderRadiusPx};font-family:${b};cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[r,Hn(t)],on:{mouseenter:n=>{n.currentTarget.style.opacity="0.85"},mouseleave:n=>{n.currentTarget.style.opacity="1"},click:()=>{try{e&&e()}catch(n){}}}})}function Jn(t){return t.subtext?h("span",{style:`display:flex;align-items:center;gap:4px;padding:4px;background:${t.badgeBgColor};font-family:${b};font-weight:600;font-size:10px;text-transform:uppercase;color:${t.badgeTextColor};line-height:1;white-space:nowrap;`,children:[nr(t.badgeTextColor),h("span",{text:t.subtext})]}):null}function Wn(t,e){return h("button",{attrs:{type:"button"},style:`display:flex;align-items:center;justify-content:center;gap:8px;padding:8px 12px 8px 8px;width:100%;margin-top:auto;box-sizing:border-box;background:${t.bgColor};border:${pt(t)};border-radius:${t.borderRadiusPx};filter:drop-shadow(0 0 6px rgba(0,0,0,0.08));font-family:${b};cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[dt(t.textColor,t.iconSize),h("span",{text:t.text,style:`font-family:${b};font-weight:700;font-size:${t.fontSize}px;color:${t.textColor};white-space:nowrap;line-height:1;`})],on:{mouseenter:r=>{r.currentTarget.style.opacity="0.85"},mouseleave:r=>{r.currentTarget.style.opacity="1"},click:()=>{try{e&&e()}catch(r){}}}})}function ir(t,e){ft();let r=h("div",{style:"display:flex;flex-direction:column;gap:4px;",children:[t.cardTitle&&h("p",{text:t.cardTitle,style:`margin:0;font-family:${b};font-weight:700;font-size:16px;letter-spacing:1px;text-transform:uppercase;color:${t.cardTitleColor};line-height:1.2;`}),t.cardDescription&&h("p",{html:t.cardDescription,style:`margin:0;font-family:${b};font-weight:400;font-size:12px;max-width:177px;line-height:1.2;color:${t.cardTextColor};`})]}),n=h("div",{style:"display:flex;flex-direction:column;justify-content:space-between;gap:16px;flex:1 1 0;min-width:0;",children:[r,t.cardFooter&&h("p",{text:t.cardFooter,style:`margin:0;font-family:${b};font-weight:400;font-size:10px;color:${t.cardTextColor};line-height:1.2;`})]}),o=h("div",{style:"display:flex;flex-direction:column;align-items:flex-end;flex:1 1 0;min-width:0;",children:[Jn(t),Wn(t,e)]}),i=h("div",{style:"display:flex;gap:16px;align-items:stretch;width:100%;flex:1;box-sizing:border-box;",children:[n,o]});return h("div",{style:`display:flex;flex-direction:column;align-items:flex-start;padding:12px;width:100%;max-width:402px;min-height:140px;box-sizing:border-box;background:${t.cardBgColor};border-radius:${t.cardBorderRadiusPx};font-family:${b};`,children:[i]})}var Xn={style:"gregory-black",text:"Provar Virtualmente",fontSize:14,iconSize:24,subtext:"",bgColor:"#1E1E1E",textColor:"#FFFFFF",badgeBgColor:"#C51A1B",badgeTextColor:"#FFFFFF",borderRadius:"md",borderColor:"#1E1E1E",borderWidth:0,cardTitle:"",cardDescription:"",cardFooter:"",cardBgColor:"#F6F6F6",cardTitleColor:"#1E1E1E",cardTextColor:"#717171",cardBorderRadius:"md"};function Kt(t,e){let r=(e?t&&t.mobile:t&&t.desktop)||t&&t.desktop||t&&t.mobile||{},n={...Xn,...r};return n.style==="gregory-card"&&e&&(n.style="gregory-black"),n.borderRadiusPx=zt[n.borderRadius]!=null?zt[n.borderRadius]:"0",n.cardBorderRadiusPx=$t[n.cardBorderRadius]!=null?$t[n.cardBorderRadius]:"0",n.fontSize=Number(n.fontSize)||14,n.iconSize=Number(n.iconSize)||24,n.borderWidth=Number(n.borderWidth)||0,n}var Ht={"gregory-black":or,"gregory-card":ir},ri=Object.keys(Ht);function cr(t,e){return(Ht[t.style]||Ht["gregory-black"])(t,e)}function Yn(){return"abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)]+Math.random().toString(36).slice(2,11)}var J=null;function er(){return J}function Zn(t,e){let r;try{r=document.createElement("iframe"),r.setAttribute("aria-hidden","true"),r.style.cssText="display:none!important;width:0;height:0;border:0;position:absolute;left:-9999px;",(document.body||document.documentElement).appendChild(r);let n=r.contentWindow&&r.contentWindow.Element&&r.contentWindow.Element.prototype&&r.contentWindow.Element.prototype.attachShadow;if(typeof n=="function"){let o=n.call(t,e);return r.remove(),o}}catch(n){}try{r&&r.remove()}catch(n){}return t.attachShadow(e)}var Qn=/^(transform|transform-origin|margin|margin-(top|right|bottom|left)|position|inset|top|right|bottom|left|z-index|width|min-width|max-width|height|min-height|max-height)$/i;function to(t){return!t||typeof t!="string"?"":t.split(";").map(e=>e.trim()).filter(Boolean).filter(e=>Qn.test(e.split(":")[0].trim().toLowerCase())).join(";")}var mt=null,Vt=!1,Jt={},ar=!1,Wt=null;function lr(){return Wt||(Wt=M().then(t=>t&&t.template&&t.template.tryOnButton||null).catch(()=>null)),Wt}function eo(){if(ar)return;ar=!0;let t=null;try{window.addEventListener("resize",()=>{clearTimeout(t),t=setTimeout(()=>{mt&&U("pdp")},200)})}catch(e){}}function Gt(){let t=J;if(t){if(typeof t.__mkCleanup=="function")try{t.__mkCleanup()}catch(e){}t.parentNode&&t.parentNode.removeChild(t)}J=null,mt=null}var ro={IMG:1,INPUT:1,VIDEO:1,CANVAS:1,EMBED:1,OBJECT:1,IFRAME:1,BR:1,HR:1,SELECT:1,TEXTAREA:1,SVG:1};function no(t){switch(t){case"top-center":return"top:0;left:50%;transform:translateX(-50%);";case"top-right":return"top:0;right:0;";case"middle-left":return"top:50%;left:0;transform:translateY(-50%);";case"center":return"top:50%;left:50%;transform:translate(-50%,-50%);";case"middle-right":return"top:50%;right:0;transform:translateY(-50%);";case"bottom-left":return"bottom:0;left:0;";case"bottom-center":return"bottom:0;left:50%;transform:translateX(-50%);";case"bottom-right":return"bottom:0;right:0;";case"top-left":default:return"top:0;left:0;"}}function oo(t,e,r){let o=!ro[t.tagName]?t:t.parentElement||document.body;try{getComputedStyle(o).position==="static"&&(o.style.position="relative")}catch(p){}if(o===t){e.style.cssText="position:absolute;z-index:2147483000;"+no(r),t.appendChild(e);return}e.style.cssText="position:absolute;z-index:2147483000;",o.appendChild(e);let i=()=>{try{let p=t.getBoundingClientRect(),y=o.getBoundingClientRect(),x=e.offsetWidth,a=e.offsetHeight,m=p.top-y.top+o.scrollTop,g=p.left-y.left+o.scrollLeft,w=r||"top-left",W=m,E=g;w.indexOf("bottom")===0?W=m+p.height-a:(w.indexOf("middle")===0||w==="center")&&(W=m+(p.height-a)/2),w.indexOf("right")>=0?E=g+p.width-x:w.indexOf("center")>=0&&(E=g+(p.width-x)/2),e.style.top=W+"px",e.style.left=E+"px"}catch(p){}};i();let c=()=>i();window.addEventListener("resize",c);let l=setTimeout(i,600),u=setTimeout(i,1500);e.__mkCleanup=()=>{window.removeEventListener("resize",c),clearTimeout(l),clearTimeout(u)}}function io(t,e,r){try{return t.insertAdjacentElement(r||"afterend",e),!0}catch(n){try{return t.parentNode.insertBefore(e,t.nextSibling),!0}catch(o){return!1}}}async function U(t){let e=f();if(t!=="pdp"){Gt();return}if(!e.projectId)return;if(!e._anchorFromPicker){let u=await lr();u&&u.anchor&&(e.anchor=u.anchor)}if(Vt)return;let r=K(),n=r&&r.value,o=!!e.forceButton,i=qt(e.anchor),c=[n||"demo",i?[i.selector,i.position,i.mode,i.align,i.style].join("~"):"heuristic"].join("|"),l=J;if(!(l&&mt===c)){if(l&&Gt(),!n&&!o){d("auto-mount: SKU n\xE3o resolvido na PDP");return}Vt=!0;try{let u=o;o||(Jt[n]||(Jt[n]=O(e.projectId,n).then(C=>!!(C&&C.available)).catch(()=>!1)),u=await Jt[n]);try{le(u?"available":"unavailable")}catch(C){}if(!u){d("auto-mount: produto sem try-on",n);return}let p=await lr(),y=window.matchMedia("(max-width: 767px)").matches,x=Kt(p,y),a=rr(),m=a&&a.mode||"flow",g=cr(x,()=>{let C=K(),ht=C&&C.value||n||"";ce(),s("button_clicked",{sku:ht,style:x.style,mode:m}),ut({projectId:e.projectId,identifier:ht})}),w=document.createElement("div");w.id=Yn(),J=w,Zn(w,{mode:"closed"}).appendChild(g);let E=!1;if(a&&a.el&&a.el.parentNode&&(m==="overlay"?(oo(a.el,w,a.align),E=!0):(w.style.cssText="display:contents;",E=io(a.el,w,a.position))),E||(w.style.cssText="position:fixed;left:16px;bottom:16px;z-index:2147483000;",document.body.appendChild(w)),a&&a.style){let C=to(a.style);if(C)try{g.style.cssText+=";"+C}catch(ht){}}mt=c,eo(),d("auto-mount: bot\xE3o injetado",{style:x.style,sku:n,anchorFound:!!a,position:a&&a.position,mode:m,forced:o}),s("button_rendered",{style:x.style,sku:n||null,skuSource:r&&r.source,anchorFound:!!a,position:a?a.position:null,mode:m,forced:o})}finally{Vt=!1}}}function sr(){try{let t=f(),e={anchor:t.anchor,forceButton:t.forceButton};window.addEventListener("message",r=>{if(r.source!==window)return;let n=r.data;!n||!n.__mkCmd||(n.__mkCmd==="remount"||n.__mkCmd==="applyRecipe"?(t.anchor=n.anchor||null,t._anchorFromPicker=!0,t.forceButton=!0,U("pdp")):n.__mkCmd==="cancelPreview"&&(t.anchor=e.anchor,t._anchorFromPicker=!1,t.forceButton=e.forceButton,Gt(),U("pdp")))})}catch(t){}}(function(){"use strict";try{let r=function(){try{de(),sr(),He(),e.autoTrack!==!1&&(Ie((o,i)=>{Ue(o,i),U(o)}),De()),d("mk-sdk iniciado",{projectId:e.projectId,collectorUrl:e.collectorUrl})}catch(o){e.debug&&console.error("[mk-sdk] init erro",o)}},e=gt();if(e.projectId){let o=he(e.projectId);o&&Ct(o),M().then(i=>{let c=fe(i);Ct(c),ye(e.projectId,c),d("escopo de coleta",c)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r();let n={open:ut,close:Dt,isAvailable:$e,getAvailability:O,onReady:We,onClose:Ge,onAddToCart:Xe,onProductLoaded:Ye,onError:Ze,onInteraction:Qe,onGenerationComplete:tr,_version:"0.1.0",_isMkSdk:!0};typeof window!="undefined"&&(window.mk=n)}catch(e){typeof console!="undefined"&&console.error("[mk-sdk] boot fatal",e)}})();})();
|
package/dist/mk-sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{(function(){try{let a=function(){try{var t=JSON.parse(localStorage.getItem(o));return t&&d.test(t.v)&&t.exp>Date.now()?t.v:null}catch(u){return null}};var m=a;if(window.__mkBooted)return;window.__mkBooted=!0;var o="mk_sdk_v",i=10*60*1e3,d=/^\d+\.\d+\.\d+$/,e=document.currentScript||document.querySelector("script[data-mk-project]")||document.querySelector('script[src*="mk-sdk"]'),s=a()||"1.1.
|
|
1
|
+
(()=>{(function(){try{let a=function(){try{var t=JSON.parse(localStorage.getItem(o));return t&&d.test(t.v)&&t.exp>Date.now()?t.v:null}catch(u){return null}};var m=a;if(window.__mkBooted)return;window.__mkBooted=!0;var o="mk_sdk_v",i=10*60*1e3,d=/^\d+\.\d+\.\d+$/,e=document.currentScript||document.querySelector("script[data-mk-project]")||document.querySelector('script[src*="mk-sdk"]'),s=a()||"1.1.26",n=document.createElement("script");if(n.src="https://cdn.jsdelivr.net/npm/mk-sdk-git@"+s+"/dist/mk-core.js",n.async=!0,e&&e.attributes)for(var r=0;r<e.attributes.length;r++){var c=e.attributes[r];c.name.indexOf("data-")===0&&n.setAttribute(c.name,c.value)}(document.head||document.documentElement).appendChild(n),fetch("https://api-collector.mk3dlabs.com/v1/sdk/version").then(function(t){return t.ok?t.json():null}).then(function(t){var u=t&&t.version;d.test(u)&&localStorage.setItem(o,JSON.stringify({v:u,exp:Date.now()+i}))}).catch(function(){})}catch(a){}})();})();
|
package/package.json
CHANGED
package/src/tryon/bridge.js
CHANGED
|
@@ -5,6 +5,7 @@ import { getConfig, log } from '../core/config.js';
|
|
|
5
5
|
import { track } from '../core/transport.js';
|
|
6
6
|
import { addToCart as cartAdd, openCartAfterAdd, redirectToCart } from '../platforms/index.js';
|
|
7
7
|
import { getButtonHost } from './automount.js';
|
|
8
|
+
import { resolveLauncher } from './launchers/index.js';
|
|
8
9
|
|
|
9
10
|
let modal = null;
|
|
10
11
|
let iframe = null;
|
|
@@ -67,7 +68,9 @@ export async function open(options) {
|
|
|
67
68
|
availabilityChecked[key] = true;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
// tamanho do modal pelo launcher do produto (fashion: retrato; makeup: maior)
|
|
72
|
+
const size = (resolveLauncher(getConfig().product).modalSize) || { width: 430, height: 800 };
|
|
73
|
+
currentConfig = { projectId, identifier, width: options.width || size.width, height: options.height || size.height };
|
|
71
74
|
pendingRedirect = false;
|
|
72
75
|
setupMessageListener();
|
|
73
76
|
openModal(currentConfig);
|
|
@@ -120,8 +123,8 @@ function openModal(cfg) {
|
|
|
120
123
|
container.style.cssText = 'position:relative;width:' + w + ';height:' + h + ';max-width:100vw;max-height:100dvh;border-radius:12px;overflow:hidden;background:#fff;';
|
|
121
124
|
|
|
122
125
|
iframe = document.createElement('iframe');
|
|
123
|
-
const
|
|
124
|
-
iframe.src =
|
|
126
|
+
const launcher = resolveLauncher(getConfig().product);
|
|
127
|
+
iframe.src = launcher.iframeSrc(cfg.projectId, cfg.identifier);
|
|
125
128
|
iframe.style.cssText = 'width:100%;height:100%;border:none;';
|
|
126
129
|
iframe.setAttribute('allow', 'camera *; microphone *');
|
|
127
130
|
iframe.setAttribute('allowfullscreen', 'true');
|
|
@@ -130,6 +133,15 @@ function openModal(cfg) {
|
|
|
130
133
|
modal.appendChild(container);
|
|
131
134
|
document.body.appendChild(modal);
|
|
132
135
|
|
|
136
|
+
// pós-montagem específico do produto (makeup: carrega o SDK do PulpoAR, aplica
|
|
137
|
+
// a variante, liga onAddToCart→nosso carrinho). fashion: noop (listener global).
|
|
138
|
+
try {
|
|
139
|
+
launcher.onMounted(iframe, {
|
|
140
|
+
projectId: cfg.projectId, identifier: cfg.identifier,
|
|
141
|
+
handleAddToCart, track, fire
|
|
142
|
+
});
|
|
143
|
+
} catch (e) { log('launcher.onMounted falhou', e && e.message); }
|
|
144
|
+
|
|
133
145
|
log('try-on modal aberto', iframe.src);
|
|
134
146
|
}
|
|
135
147
|
|
|
@@ -174,18 +186,7 @@ function setupMessageListener() {
|
|
|
174
186
|
break;
|
|
175
187
|
}
|
|
176
188
|
case 'add_to_cart':
|
|
177
|
-
|
|
178
|
-
if (typeof callbacks.onAddToCart === 'function') {
|
|
179
|
-
fire('onAddToCart', payload); // cliente cuida (compat SDK v2)
|
|
180
|
-
} else {
|
|
181
|
-
// mk-sdk adiciona sozinho (zero-touch) e abre a sacola JÁ (atrás do
|
|
182
|
-
// provador, que segue aberto pro NPS). Tema sem sacola → marca redirect
|
|
183
|
-
// pro fechamento (não navega agora pra não matar o NPS).
|
|
184
|
-
cartAdd(payload)
|
|
185
|
-
.then(() => openCartAfterAdd())
|
|
186
|
-
.then((needRedirect) => { pendingRedirect = !!needRedirect; })
|
|
187
|
-
.catch(() => {});
|
|
188
|
-
}
|
|
189
|
+
handleAddToCart(payload, 'tryon');
|
|
189
190
|
break;
|
|
190
191
|
case 'generation_start':
|
|
191
192
|
generationStartedAt = Date.now();
|
|
@@ -207,6 +208,20 @@ function setupMessageListener() {
|
|
|
207
208
|
});
|
|
208
209
|
}
|
|
209
210
|
|
|
211
|
+
// Add-to-cart unificado (mk-fashion via postMessage 'mkfashion-app' e mk-makeup
|
|
212
|
+
// via PulpoAR onAddToCart). Rastreia + adiciona ao carrinho da loja (zero-touch)
|
|
213
|
+
// e abre a sacola JÁ (atrás do provador, que segue aberto pro NPS); tema sem
|
|
214
|
+
// sacola marca redirect pro fechamento. Se o cliente registrou onAddToCart, ele
|
|
215
|
+
// cuida (compat SDK v2).
|
|
216
|
+
function handleAddToCart(payload, via) {
|
|
217
|
+
track('add_to_cart', Object.assign({ via: via || 'tryon' }, stripImg(payload)));
|
|
218
|
+
if (typeof callbacks.onAddToCart === 'function') { fire('onAddToCart', payload); return; }
|
|
219
|
+
cartAdd(payload)
|
|
220
|
+
.then(() => openCartAfterAdd())
|
|
221
|
+
.then((needRedirect) => { pendingRedirect = !!needRedirect; })
|
|
222
|
+
.catch(() => {});
|
|
223
|
+
}
|
|
224
|
+
|
|
210
225
|
// Eventos de interaction viram page_<category>_<action> ou page_interaction
|
|
211
226
|
function interactionName(payload) {
|
|
212
227
|
if (payload && payload.action) return 'interaction'; // mantém genérico, action vai no params
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// launchers/index.js — registro de launchers por PRODUTO. O que o botão abre
|
|
2
|
+
// depende do produto MetaKosmos (cfg.product): mk-fashion → visualizer MK;
|
|
3
|
+
// mk-makeup → VTO de maquiagem (PulpoAR). Botão (automount), funil e carrinho
|
|
4
|
+
// são reaproveitados; só o "o que abre" muda aqui.
|
|
5
|
+
// • nova modalidade = 1 arquivo aqui + 1 linha no LAUNCHERS.
|
|
6
|
+
|
|
7
|
+
import * as mkfashion from './mkfashion.js';
|
|
8
|
+
import * as pulpoar from './pulpoar.js';
|
|
9
|
+
|
|
10
|
+
const LAUNCHERS = {
|
|
11
|
+
'mk-fashion': mkfashion,
|
|
12
|
+
'mk-makeup': pulpoar
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Launcher do produto (fallback: mk-fashion). */
|
|
16
|
+
export function resolveLauncher(product) {
|
|
17
|
+
return LAUNCHERS[product] || mkfashion;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// launcher mk-fashion — o provador MetaKosmos (visualizer em iframe).
|
|
2
|
+
// Comportamento original: iframe = appUrl/<projectId>/<sku>; a comunicação
|
|
3
|
+
// (product_loaded, interaction, add_to_cart, generation_*) vem por postMessage
|
|
4
|
+
// 'mkfashion-app' e é tratada pelo listener global do bridge — então onMounted
|
|
5
|
+
// não precisa fazer nada aqui.
|
|
6
|
+
|
|
7
|
+
import { getConfig } from '../../core/config.js';
|
|
8
|
+
|
|
9
|
+
export const id = 'mk-fashion';
|
|
10
|
+
export const modalSize = { width: 430, height: 800 }; // retrato (provador de roupa)
|
|
11
|
+
|
|
12
|
+
/** URL do iframe do visualizer pra um projeto + produto. */
|
|
13
|
+
export function iframeSrc(projectId, identifier) {
|
|
14
|
+
const encoded = encodeURIComponent(identifier).replace(/\./g, '%2E');
|
|
15
|
+
return getConfig().appUrl + '/' + projectId + '/' + encoded;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Comunicação tratada pelo listener global 'mkfashion-app' do bridge. */
|
|
19
|
+
export function onMounted() { /* noop */ }
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// launcher mk-makeup — VTO de maquiagem via PulpoAR (plugin.pulpoar.com).
|
|
2
|
+
// O projectId É o slug do PulpoAR. O iframe roda o catálogo deles; controlamos
|
|
3
|
+
// por meio do SDK oficial (@pulpoar/plugin-sdk → global `pulpoar`):
|
|
4
|
+
// • applyVariantsWithCatalog([slug]) → abre/aplica a variante selecionada na PDP
|
|
5
|
+
// • onAddToCart(variants) → reaproveita o NOSSO carrinho (igual fashion)
|
|
6
|
+
// • onReady / onGoToProduct → callbacks
|
|
7
|
+
// Doc: https://plugin.pulpoar.com/console/guide/vto/<slug> (SDK Guide / API).
|
|
8
|
+
|
|
9
|
+
import { getConfig, log } from '../../core/config.js';
|
|
10
|
+
|
|
11
|
+
export const id = 'mk-makeup';
|
|
12
|
+
export const modalSize = { width: 1160, height: 700 }; // recomendação PulpoAR (desktop)
|
|
13
|
+
|
|
14
|
+
// Base do plugin PulpoAR. Override em testes via window.__MK.pulpoarUrl.
|
|
15
|
+
function base() {
|
|
16
|
+
return (window.__MK && window.__MK.pulpoarUrl) || 'https://plugin.pulpoar.com/vto';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** iframe = plugin.pulpoar.com/vto/<slug> (modo catálogo, pra applyVariantsWithCatalog). */
|
|
20
|
+
export function iframeSrc(projectId /* slug */) {
|
|
21
|
+
return base() + '/' + encodeURIComponent(projectId);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const SDK_URL = 'https://cdn.jsdelivr.net/npm/@pulpoar/plugin-sdk@latest/dist/index.iife.js';
|
|
25
|
+
let _sdkPromise = null;
|
|
26
|
+
function loadSdk() {
|
|
27
|
+
if (window.pulpoar) return Promise.resolve(window.pulpoar);
|
|
28
|
+
if (_sdkPromise) return _sdkPromise;
|
|
29
|
+
_sdkPromise = new Promise((resolve) => {
|
|
30
|
+
try {
|
|
31
|
+
const s = document.createElement('script');
|
|
32
|
+
s.src = SDK_URL;
|
|
33
|
+
s.async = true;
|
|
34
|
+
s.onload = () => resolve(window.pulpoar || null);
|
|
35
|
+
s.onerror = () => resolve(null);
|
|
36
|
+
(document.head || document.documentElement).appendChild(s);
|
|
37
|
+
} catch (_) { resolve(null); }
|
|
38
|
+
});
|
|
39
|
+
return _sdkPromise;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Normaliza a Variant do PulpoAR pro payload que o platforms.addToCart entende.
|
|
43
|
+
// A estrutura exata da Variant não é documentada — tentamos os campos prováveis
|
|
44
|
+
// (slug/sku/key) e mandamos o bruto junto (refinar quando virmos o payload real).
|
|
45
|
+
function variantToCart(variants) {
|
|
46
|
+
const v = Array.isArray(variants) ? variants[0] : variants;
|
|
47
|
+
if (!v || typeof v !== 'object') return { quantity: 1 };
|
|
48
|
+
return {
|
|
49
|
+
sku: v.sku || v.slug || v.key || v.variant_key || v.barcode || null,
|
|
50
|
+
color: v.color || v.shade || v.colorName || null,
|
|
51
|
+
size: v.size || null,
|
|
52
|
+
quantity: 1
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Pós-montagem do iframe: carrega o SDK do PulpoAR, aplica a variante selecionada
|
|
58
|
+
* e liga os eventos. ctx = { projectId, identifier, handleAddToCart, track, fire }.
|
|
59
|
+
*/
|
|
60
|
+
export function onMounted(iframe, ctx) {
|
|
61
|
+
loadSdk().then((p) => {
|
|
62
|
+
if (!p) { log('pulpoar: SDK não carregou'); return; }
|
|
63
|
+
|
|
64
|
+
// abre já com a variante/cor selecionada na PDP (catálogo). O callback confirma
|
|
65
|
+
// o que aplicou — serve também de checagem de cadastro/disponibilidade.
|
|
66
|
+
if (ctx.identifier) {
|
|
67
|
+
try {
|
|
68
|
+
p.applyVariantsWithCatalog([String(ctx.identifier)], (variants) => {
|
|
69
|
+
ctx.track('product_loaded', { via: 'makeup', applied: Array.isArray(variants) ? variants.length : 0 });
|
|
70
|
+
});
|
|
71
|
+
} catch (e) { log('pulpoar applyVariantsWithCatalog falhou', e && e.message); }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
try { p.onReady(() => ctx.fire('onReady', {})); } catch (_) {}
|
|
75
|
+
|
|
76
|
+
// add-to-cart pelo VTO → MESMO motor de carrinho do mk-fashion (cart_value, drawer, NPS)
|
|
77
|
+
try {
|
|
78
|
+
p.onAddToCart((variants) => {
|
|
79
|
+
log('pulpoar onAddToCart', variants);
|
|
80
|
+
ctx.handleAddToCart(variantToCart(variants), 'makeup');
|
|
81
|
+
});
|
|
82
|
+
} catch (_) {}
|
|
83
|
+
|
|
84
|
+
try { p.onGoToProduct((v) => ctx.fire('onGoToProduct', v)); } catch (_) {}
|
|
85
|
+
});
|
|
86
|
+
}
|