var juniperTikTokFeeApp = (function instafeedLoad(){const t="nfcube.com",e="tiktok.nfcube.com",n="cdn.nfcube.com",i="juniper",o="3.2.1",s=!1;var r=function(){function n(t){this.options={target:"mintty-tiktok-feed",forceUpdate:!1,locale:"en",picturesLoaded:0,picturesNeeded:0,admin:window.location.hostname===e},Object.assign(this.options,t),this.options.admin||this._loadCss()}return n.prototype.run=function(){var t=document.getElementById(this.options.target);if(0===t.clientWidth&&parseInt(this.options.autoLayout)>0)return this._checkClientWidth(this,t),!1;parseInt(this.options.autoLayout)>0?(this.options.picturesNeeded=this.options.rows*this._getAutoColumns(t.clientWidth),this._isMobileDevice()&&this._validateCharge(this.options.charge)&&(this.options.picturesNeeded=this.options.rowsMobile*this._getAutoColumns(t.clientWidth))):this._isMobileDevice()&&this._validateCharge(this.options.charge)?this.options.picturesNeeded=this.options.rowsMobile*this.options.columnsMobile:this.options.picturesNeeded=this.options.rows*this.options.columns;var n="";this.options.admin&&(n="
Hang on we are processing your feed ☕"),t.innerHTML="loading bar"+n;var i=this;const o=new XMLHttpRequest;return o.open("GET",this._buildUrl(),!0),o.onload=function(){i.parse(JSON.parse(o.responseText))},o.onerror=function(){console.log("Network error")},o.send(),!0},n.prototype.parse=function(t){var n,o,s,r,a,l,c;if(c=document.getElementById(this.options.target),"object"!=typeof t)throw new Error("Invalid JSON response");const{meta:{code:p,error_message:d}}=t,u=parseInt(p,10);if(c.innerHTML="",204===u||200!==u)return this.options.admin&&(c.innerHTML=204===u?d:`⚠️ ${d}`,"function"==typeof this.options.error&&this.options.error.call(this,t)),!1;if(null!==this.options.success&&"function"==typeof this.options.success&&this.options.success.call(this,t),"undefined"==typeof document||null===document)return!1;a=t.data,n="";var h="standard_resolution",m=parseInt(100-this.options.space),g=0,f=0;f=g=parseInt(this.options.autoLayout)>0?parseFloat(100/this._getAutoColumns(c.clientWidth)).toFixed(6):this._isMobileDevice()&&this._validateCharge(this.options.charge)?parseFloat(100/this.options.columnsMobile).toFixed(6):parseFloat(100/this.options.columns).toFixed(6),parseInt(this.options.layout)>=2&&(f=parseFloat(g*(16/9)).toFixed(6));var v=`
{{icon}}
`,y=`
${v}
`,w="
{{containerContent}}"+y+"
";for(1===parseInt(this.options.openIg)?w=""+w+"":3===parseInt(this.options.openIg)&&(w=""+w+""),o=0,l=a.length;o","video"===s.type&&"batatas.myshopify.com"===this.options.shopOrigin?containerContent='':containerContent="{{captionAlt}}",this.options.picturesLoaded++;var _=1===this.options.picturesLoaded?this.options.picturesNeeded:this.options.picturesLoaded-1,k=this.options.picturesLoaded===this.options.picturesNeeded?1:this.options.picturesLoaded+1;if(n+=this._makeTemplate(w,{model:s,id:this.options.picturesLoaded,fullId:s.id,minusId:_,plusId:k,link:s.link,embedLink:s.embed_link,image:r.url,icon:this._generateIcon(s),username:s.user.username,fullName:s.user.full_name,userPicture:5===this.options.apiVersion?s.user.profile_picture:"https://"+e+"/assets/img/logo-instagram-transparent.png",containerContent:containerContent,imageFullHtml:imageFullHtml,taggedProduct:"",date:this._timeConverter(s.created_time),caption:this._escapeHtml(this._getObjectProperty(s,"caption.text")),captionAlt:this._escapeHtml(this._getObjectProperty(s,"caption.text").substring(0,100)),comments:this._shortenLargeNumber(s.comments.count,1),location:this._getObjectProperty(s,"location.name")}),this.options.picturesLoaded>=this.options.picturesNeeded||t.data.length===this.options.picturesLoaded)break}c.innerHTML="";var I="";if(this._validateCharge(this.options.charge)&&parseInt(this.options.showFollowers)>0&&(I="

"+this._shortenLargeNumber(b)+" followers"),this.options.title.length>0||"undefined"!=typeof juniperLocalTitle&&juniperLocalTitle.length>0){let t=document.createElement("h2");const e="undefined"!=typeof juniperLocalTitle&&juniperLocalTitle.length>0?juniperLocalTitle:this.options.title;t.innerHTML=e+I,c.insertBefore(t,c.firstChild)}if(1===parseInt(this.options.layout)||3===parseInt(this.options.layout))window.juniperSliderNumVisibleImages=parseInt(Math.round(100/g)),window.juniperSliderTotalImages=this.options.picturesLoaded,c.innerHTML+=this._generateCarouselHTML(a,this._escapeHtml),this._setNumVisibleImages(),c.addEventListener("swiped-left",(t=>{(window.lastSwipeEventJuniper||{}).target!==t.target&&(juniperSliderMove(1,this.options.feedId),window.lastSwipeEventJuniper=t)})),c.addEventListener("swiped-right",(t=>{(window.lastSwipeEventJuniper||{}).target!==t.target&&(juniperSliderMove(-1,this.options.feedId),window.lastSwipeEventJuniper=t)}));else{const t=document.createDocumentFragment();this._appendHtmlToParent(n,t),c.appendChild(t)}if(3===parseInt(this.options.openIg)){null===document.getElementById(i+"-tiktok-iframe-container")&&this._addPopupDom();const t=[];document.querySelectorAll("."+i+"-video").forEach((e=>{t.push(e.dataset.videoUrl)}));let e=0;document.querySelectorAll("."+i+"-video").forEach((n=>{n.addEventListener("click",(()=>{e=t.indexOf(n.dataset.videoUrl),this._updateIframeSrc(t,e);document.getElementById(i+"-tiktok-popup").style.display="block",this._toggleBodyScrolling(!1)}))}));const n=document.getElementById(i+"-tiktok-prev-video"),o=document.getElementById(i+"-tiktok-next-video"),s=document.getElementById(i+"-tiktok-popup-close");n&&n.addEventListener("click",(()=>{e=(e-1+t.length)%t.length,this._updateIframeSrc(t,e)})),o&&o.addEventListener("click",(()=>{e=(e+1)%t.length,this._updateIframeSrc(t,e)})),s&&s.addEventListener("click",(()=>{document.getElementById(i+"-tiktok-popup").style.display="none",this._toggleBodyScrolling(!0);document.getElementById(i+"-tiktok-iframe-container").innerHTML=""}))}return this._enableLazyLoading(),!0},n.prototype._toggleBodyScrolling=function(t){document.body.style.overflow=t?"":"hidden"},n.prototype._updateIframeSrc=function(t,e){const n=t[e],o=document.createElement("iframe");o.src=n+"&mute=1",o.width="450",o.height=`${Math.min(window.innerHeight-100,800)}`,o.allow="autoplay",o.setAttribute("playsinline","");const s=document.getElementById(i+"-tiktok-iframe-container");s.innerHTML="",s.appendChild(o)},n.prototype._addPopupDom=function(){const t=`\n \n `,e=document.createElement("template");e.innerHTML=t.trim();const n=document.body.lastChild;document.body.insertBefore(e.content.firstChild,n)},n.prototype._appendHtmlToParent=function(t,e=document.body,n=null){const i=document.createElement("template");for(i.innerHTML=t;i.content.firstChild;)e.insertBefore(i.content.firstChild,n)},n.prototype._setNumVisibleImages=function(){const t=document.getElementById(this.options.target).offsetWidth,e=t/juniperSliderNumVisibleImages,n=3===parseInt(this.options.layout)?parseFloat(e*(16/9)).toFixed(6):e;document.querySelectorAll("."+i+"-new-carousel-item").forEach((t=>{t.style.width=`${e}px`,t.style.height=`${n}px`}));const o=document.querySelector("."+i+"-new-carousel-container");o.style.width=`${t}px`,o.style.height=`${n}px`,window.juniperSliderStepSize=juniperSliderNumVisibleImages*e},n.prototype._generateCarouselHTML=function(t){let e="",n=0;for(let i of t)n++,e+=this._imageTemplate(i,n);let o="";return n>juniperSliderNumVisibleImages&&(o=`\n \n \n `),`\n `},n.prototype._imageTemplate=function(t,n){let o=t.images.standard_resolution,s=parseInt(100-this.options.space,10),r=this._escapeHtml(t.caption.text).substring(0,64),a="";const l=this._generateIcon(t);a=`\n Instagram post with the caption: '${r}...'\n `;const c=this._generatePostUrl(a,t,n);return`\n `},n.prototype._generatePostUrl=function(t,e,n){const i=parseInt(this.options.openIg,10);return 1===i?`${t}`:3===i?`${t}`:t},n.prototype._generateIcon=function(t){if(parseInt(this.options.likes)>0&&this._validateCharge(this.options.charge))return`
\n \n \n \n ${this._shortenLargeNumber(t.likes.count,1)}\n
\n
\n \n \n \n ${this._shortenLargeNumber(t.comments.count,1)}\n
`;{const n="video"===t.type?"video-icon.png":"instagram-icon-v2.svg";return`hover icon`}},n.prototype._buildUrl=function(){const{forceUpdate:t,apiVersion:n,charge:i,picturesNeeded:o,shopOrigin:s,feedId:r,hash:a,locale:l}=this.options;return`https://${e}/api/v${n}?fu=${t?1:0}&limit=${o}&account=${s}&fid=${r}&hash=${a}&locale=${l}`},n.prototype._makeTemplate=function(t,e){return t.replace(/{{([\w[\].]+)}}/g,((t,n)=>{const i=this._getObjectProperty(e,n);return null!==i?i:""}))},n.prototype._getObjectProperty=function(t,e){const n=(e=e.replace(/\[(\w+)\]/g,".$1")).split(".");for(const e of n){if(null===t||!(e in t))return null;t=t[e]}return t},n.prototype._validateCharge=function(t){return parseInt(t)>0},n.prototype._getAutoColumns=function(t){return t<480?2:t<768?3:t<1024?4:t<=1200?5:6},n.prototype._escapeHtml=function(t){return t&&(t=t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")),t},n.prototype._shortenLargeNumber=function(t,e){const n=["k","M","G","T","P","E","Z","Y"];for(let i=n.length-1;i>=0;i--){const o=Math.pow(1e3,i+1);if(t<=-o||t>=o)return+(t/o).toFixed(e)+n[i]}return t},n.prototype._timeConverter=function(t){return new Date(1e3*t).toLocaleDateString(navigator.language,{month:"long",day:"numeric"})},n.prototype._isMobileDevice=function(t=!1){return!(!this.options.admin||this.options.desktopPreview||!1!==t)||(!this.options.admin||!this.options.desktopPreview||!1!==t)&&window.matchMedia("only screen and (max-width: 768px)").matches},n.prototype._checkClientWidth=function(t,e){0===e.clientWidth?setTimeout((()=>{t._checkClientWidth(t,e)}),100):t.run()},n.prototype._loadCss=function(){if(document.currentScript&&!document.currentScript.src.includes(t))return!1;const n=document.createElement("link");n.href=`https://${e}/cdn/tiktok-${o}.css`,n.type="text/css",n.rel="stylesheet",n.media="screen,print",document.head.appendChild(n)},n.prototype._enableLazyLoading=function(){const t=document.querySelectorAll(".js-lazy-image"),e={rootMargin:"100px 0px",threshold:.01};let n,i=t.length;function o(t){const e=t.dataset.src;var n;if(e.includes("https://"))return(n=e,new Promise(((t,e)=>{const i=new Image;i.src=n,i.onload=t,i.onerror=e}))).then((()=>{!function(t,e){t.classList.add("js-lazy-image--handled"),t.src=e}(t,e)})).catch((t=>{console.log(t)}))}"IntersectionObserver"in window&&t.length?(n=new IntersectionObserver((function(t){0===i&&n.disconnect();t.forEach((t=>{t.intersectionRatio>0&&(i--,n.unobserve(t.target),o(t.target))}))}),e),t.forEach((t=>{t.classList.contains("js-lazy-image--handled")||n.observe(t)}))):function(t){t.forEach((t=>o(t)))}(t)},n}();!function(t,e){t.Instafeed=r}(this),window.juniperSlidersState={},window.juniperSliderMove=(t,e=0)=>{juniperSlidersState[e]||(juniperSlidersState[e]={currentTransform:0,minTransform:0});const n=juniperSlidersState[e],o=Math.ceil(juniperSliderTotalImages/juniperSliderNumVisibleImages)-1,s=juniperSliderStepSize*o;n.currentTransform+=t*-juniperSliderStepSize,n.currentTransform<-s&&(n.currentTransform=n.minTransform),n.currentTransform>n.minTransform&&(n.currentTransform=-s),document.querySelector(`.${i}-new-carousel-wrapper[data-feed-id="${e}"]`).style.transform=`translateX(${n.currentTransform}px)`},function(t,e){"use strict";"function"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var i=e.createEvent("CustomEvent");return i.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),i},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener("touchstart",(function(t){"true"!==t.target.getAttribute("data-swipe-ignore")&&(a=t.target,r=Date.now(),n=t.touches[0].clientX,i=t.touches[0].clientY,o=0,s=0)}),!1),e.addEventListener("touchmove",(function(t){if(n&&i){var e=t.touches[0].clientX,r=t.touches[0].clientY;o=n-e,s=i-r}}),!1),e.addEventListener("touchend",(function(t){if(a===t.target){var e=parseInt(l(a,"data-swipe-threshold","20"),10),c=parseInt(l(a,"data-swipe-timeout","500"),10),p=Date.now()-r,d="",u=t.changedTouches||t.touches||[];if(Math.abs(o)>Math.abs(s)?Math.abs(o)>e&&p0?"swiped-left":"swiped-right"):Math.abs(s)>e&&p0?"swiped-up":"swiped-down"),""!==d){var h={dir:d.replace(/swiped-/,""),xStart:parseInt(n,10),xEnd:parseInt((u[0]||{}).clientX||-1,10),yStart:parseInt(i,10),yEnd:parseInt((u[0]||{}).clientY||-1,10)};a.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:h})),a.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:h}))}n=null,i=null,r=null}}),!1);var n=null,i=null,o=null,s=null,r=null,a=null;function l(t,n,i){for(;t&&t!==e.documentElement;){var o=t.getAttribute(n);if(o)return o;t=t.parentNode}return i}}(window,document);if (document.getElementById('mintty-tiktok-feed') !== null) { var feed = new Instafeed({"account":"Tienda de la Belleza","hash":"7acc47f8ef095895f914a0030dfa2947","apiVersion":6,"shopOrigin":"tienda-de-la-belleza-5774.myshopify.com","title":"","openIg":1,"space":1,"likes":1,"corners":12,"showFollowers":0,"layout":3,"filter":"","public":0,"columns":4,"columnsMobile":4,"rows":4,"rowsMobile":4,"autoLayout":1,"feedId":0,"charge":0}); feed.run(); }return instafeedLoad;})();window.addEventListener('resize', ((lastWidth) => () => window.innerWidth !== lastWidth && (lastWidth = window.innerWidth, juniperTikTokFeeApp()))(window.innerWidth));document.addEventListener('shopify:section:load',()=>{juniperTikTokFeeApp()});