!function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t){window.FitMix=new function(){var e=function(){var e,t,o,n,i,a,r,s=!1,d=!1,m=this,p=null;this.init=function(r,s,d,p){if(o=r,e=s,a=p,(i=d).cid&&(console.warn("usage of cid is deprecated, use apiKey instead"),i.apiKey=i.cid),!i.apiKey)throw new Error("apiKey required parameter missing");i.fbxAnalyticsExternalId=i.fbxAnalyticsExternalId||window.fbxAnalyticsExternalId||"";var c=o+"?htmlContainerId="+e;c+="&apiKey="+i.apiKey,m.iframe=document.createElement("iframe"),m.iframe.setAttribute("src",c),m.iframe.setAttribute("scrolling","no"),m.iframe.setAttribute("frameborder",0),m.iframe.setAttribute("id","fitmixWidgetIframeContainer"),m.iframe.setAttribute("width",i.width?i.width:"100%"),m.iframe.setAttribute("height",i.height?i.height:"100%"),m.iframe.setAttribute("allow","camera");if(i.popupIntegration){var l="position:fixed; z-index: 1000;",f="bottom",u="18px",g="right",w="18px",y="400px",v="300px";"top"==i.popupIntegration.vertical&&(f="top"),"left"==i.popupIntegration.horizontal&&(g="left"),i.popupIntegration.verticalOffset&&(u=i.popupIntegration.verticalOffset),i.popupIntegration.horizontalOffset&&(w=i.popupIntegration.horizontalOffset),i.popupIntegration.width&&(y=i.popupIntegration.width),i.popupIntegration.height&&(v=i.popupIntegration.height),l+=f+": "+u+";",l+=g+": "+w+";",l+="width: "+y+";",l+="height: "+v+";",i.popupIntegration.centeredHorizontal&&(l+="margin: auto; left: 0px; right: 0px;"),i.popupIntegration.centeredVertical&&(l+="margin: auto; top: 0px; bottom: 0px;"),m.iframe.style.cssText="position:absolute; left:0px; right: 0px; top: 0px; bottom: 0px; box-shadow: 0 0 4px 0 rgba(0,0,0,0.5)";var x=document.createElement("div");x.style.cssText="position:absolute; background:rgb(230,230,230); height: 28px; width: 28px; right: -14px; top: -14px; background: white; border-radius: 50px; box-shadow: 0 0 2px 0 rgba(0,0,0,0.5)",x.setAttribute("id","fitmixPopupIntegrationMenu"),x.addEventListener("click",(function(){m.popupHide()}));var b=document.createElement("div");b.innerHTML="✕",b.style.cssText="position:absolute; color:black; right: 7px; top: 3px; cursor: pointer; font-size: 16px;",x.appendChild(b),m.frameContainer=document.createElement("div"),m.frameContainer.className="frameContainer",m.frameContainer.style.cssText=l,m.frameContainer.appendChild(m.iframe),m.frameContainer.appendChild(x);var I="@media screen and (max-width:"+y+") , (max-height:"+v+")"+"{#fitmixPopupIntegrationMenu { top: -14px !important; left: 0px !important; right: 0px !important; margin: auto; } .frameContainer {bottom: 0px !important;left: 0px !important;right: 0px !important;top: 20px !important;width: initial !important;height: initial !important; }} } }",S=document.createElement("style");S.type="text/css",S.appendChild(document.createTextNode(I)),document.head.appendChild(S),m.addedToDocument=!1}else{if(!(t=document.getElementById(e)))throw new Error("element with id "+e+" does not exist");for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(m.iframe),n=m.iframe.contentWindow}window.addEventListener("message",h)},this.popupInit=function(){i.popupIntegration?m.addedToDocument?console.log("popup already ready"):(m.frameContainer.style.display="none",document.body.appendChild(m.frameContainer),n=m.iframe.contentWindow,m.addedToDocument=!0):console.log("available only with popupIntegration option")},this.popupHide=function(){i.popupIntegration?(m.frameContainer.style.display="none",m.closeCamera()):console.log("available only with popupIntegration option")},this.popupShow=function(){i.popupIntegration?(m.addedToDocument?m.openCamera():(document.body.appendChild(m.frameContainer),n=m.iframe.contentWindow,m.addedToDocument=!0),m.frameContainer.style.display="block"):console.log("available only with popupIntegration option")},this.setInitializeOptions=function(e){if(!n)throw new Error('call "init" method first');var t={methods:[]};for(var o in e)"function"!=typeof e[o]?t[o]=e[o]:t.methods.push(o);c({method:"setInitializeOptions",params:t})},this.getVersion=function(){return n&&c({method:"getVersion"}),"8.7.0"},this.openCamera=function(e){if(!n)throw new Error('call "init" method first');c({method:"openCamera",params:e})},this.pauseStream=function(){c({method:"pauseStream"})},this.resumeStream=function(){c({method:"resumeStream"})},this.startStream=function(){if(!n)throw new Error('call "init" method first');c({method:"startStream"})},this.stopStream=function(){if(!n)throw new Error('call "init" method first');c({method:"stopStream"})},this.closeCamera=function(){if(!n)throw new Error('call "init" method first');c({method:"closeCamera"})},this.startTryOn=function(){if(!n)throw new Error('call "init" method first');c({method:"startTryOn"})},this.stopTryOn=function(){if(!n)throw new Error('call "init" method first');c({method:"stopTryOn"})},this.clearFrameInfo=function(){if(!n)throw new Error('call "init" method first');c({method:"clearFrameInfo",params:null})},this.setFrameInfo=function(e){if(i.popupIntegration){if(!m.addedToDocument)return p=function(){m.setFrameInfo(e)},document.body.appendChild(m.frameContainer),n=m.iframe.contentWindow,void(m.addedToDocument=!0);m.popupShow()}c({method:"setFrameInfo",params:e})},this.setFrame=function(e,t){m.setFrameInfo({id:e,dataType:t})},this.setClip=function(e){c({method:"setClip",params:e})},this.setFrameID=function(e,t,o){m.setFrameInfo({dataId:e,dataKey:t,dataType:o})},this.setTryonPicture=function(e,t){if(!n)throw new Error('call "init" method first');c({method:"setTryonPicture",params:{imgData:e,options:t}})},this.setLang=function(e){if(!n)throw new Error('call "init" method first');c({method:"setLang",params:{lang:e}})},this.setUiConfiguration=function(e){if(!n)throw new Error('call "init" method first');c({method:"setUiConfiguration",params:e})},this.getFrameDataById=function(e){if(!n)throw new Error('call "init" method first');c({method:"getFrameDataById",params:e})},this.getFrameDataBySku=function(e){console.log("getFrameDataBySku deprecated, use getFrameDataById instead"),m.getFrameDataById(e)},this.setFrameData=function(e){m.setFrameInfo(e)},this.loadEnvironmentMap=function(e){if(!n)throw new Error('call "init" method first');c({method:"loadEnvironmentMap",params:e})},this.addCss=function(e){if(!n)throw new Error('call "init" method first');c({method:"addCss",params:{styles:e}})},this.setCss=function(e){m.addCss(e)},this.remove=function(e){window.removeEventListener("message",h);var o=t.firstChild;o&&(o.onload=function(){t.removeChild(o),o=null,e&&e()},o.src="data:text/html;charset=utf-8,%3Chtml%3E%3Cbody%3E%3C/body%3E%3C/html%3E")},this.getStatus=function(){return r},this.setMode=function(e){return!!d&&(c({method:"setMode",params:{mode:e}}),!0)},this.externalPhotoRender=function(e){c({method:"externalPhotoRender",params:e})},this.setNewLensSimulationMaterial=function(e){c({method:"setNewLensSimulationMaterial",params:e})},this.setLensesAntireflection=function(e){d&&c({method:"setLensesAntireflection",params:{enable:e}})},this.setLensesInSolarMode=function(){d&&c({method:"setLensesInSolarMode"})},this.setLensesInOpticalMode=function(){d&&c({method:"setLensesInOpticalMode"})},this.setLensesInTintedMode=function(e,t,o,n){d&&c({method:"setLensesInTintedMode",params:{red:e,green:t,blue:o,alpha:n}})},this.setLensesInTintedMirrorMode=function(e,t,o,n,i,a,r,s){d&&c({method:"setLensesInTintedMirrorMode",params:{red:e=0===e?1e-4:e,green:t=0===t?1e-4:t,blue:o=0===o?1e-4:o,alpha:n=0===n?1e-4:n,specularRed:i=0===i?1e-4:i,specularGreen:a=0===a?1e-4:a,specularBlue:r=0===r?1e-4:r,glossiness:s=0===s?1e-4:s}})},this.setLensesPhotochromicWeight=function(e){d&&c({method:"setLensesPhotochromicWeight",params:{weight:e}})},this.registerLensesAnimation=function(e){d&&c({method:"registerLensesAnimation",params:e})},this.playLensesAnimation=function(e){d&&c({method:"playLensesAnimation",params:e})},this.setLensesAnimationPercentage=function(e){d&&c({method:"setLensesAnimationPercentage",params:e})},this.stopLensesAnimation=function(){d&&c({method:"stopLensesAnimation"})},this.restoreLensesInitialMaterial=function(){d&&c({method:"restoreLensesInitialMaterial"})},this.setPupillaryDistance=function(e){m.setUserInfo({pupillaryDistance:e})},this.setUserInfo=function(e){c({method:"setUserInfo",params:e})},this.setFramesPatternCoordinates=function(e){console.log("setFramesPatternCoordinates is deprecated")},this.setFramesPatternAvatar=function(e){console.log("setFramesPatternCoordinates is deprecated")},this.resetLive=function(){d&&c({method:"resetLive"})},this.resetSession=function(){c({method:"resetSession"})},this.resetDisclaimer=function(){c({method:"resetDisclaimer"})},this.getSnapshot=function(){c({method:"getSnapshot"})},this.profileLive=function(e){c({method:"profileLive",params:e})},this.completeProfile=function(){c({method:"completeProfile"})},this.getGrabbingImage=function(){c({method:"getGrabbingImage"})},this.resetDetection=function(){c({method:"resetDetection"})},this.setVideoGrabber=function(){d&&c({method:"setVideoGrabber"})},this.setVideoSequence=function(e){d&&c({method:"setVideoSequence",params:e})},this.setVideoImage=function(e){d&&c({method:"setVideoImage",params:e})},this.setGrabberLiveMode=function(){d&&c({method:"setGrabberLiveMode"})},this.getAnatomicalFitScore=function(e){d&&c({method:"getAnatomicalFitScore",params:e})},this.getFaceshape=function(e){d&&c({method:"getFaceshape",params:e})},this.resetFaceshape=function(e){d&&c({method:"resetFaceshape",params:e})},this.fsendDirect=function(e){c({method:"fsendDirect",params:e})},this.reinitialize=function(e){c({method:"reinitialize",params:e})},this.startGlassesRemoval=function(){c({method:"startGlassesRemoval"})},this.stopGlassesRemoval=function(){c({method:"stopGlassesRemoval"})},this.setZoomFactor=function(e){c({method:"setZoomFactor",params:e})};var c=function(t){t.from=e,n&&n.postMessage(t,o)},h=function(t){var o=t.data;if(o.from===e){var n,c=o.method,h=o.params;if("getOptions"===c&&m.setInitializeOptions(i),s||"connect"!==c)"disconnect"===c?s=!1:"status"===c?(r=h.status,i.onStatus&&i.onStatus(r)):"onModePhoto"===c?i.onModePhoto&&i.onModePhoto():"onModeLive"===c?i.onModeLive&&i.onModeLive():"onModeFaceshape"===c?i.onModeFaceshape&&i.onModeFaceshape():"onPhotoRender"===c?i.onPhotoRender&&i.onPhotoRender(h):"onExternalPhotoRender"===c?i.onExternalPhotoRender&&i.onExternalPhotoRender(h):"onLiveStatus"===c?i.onLiveStatus&&i.onLiveStatus(h):"onSnapshot"===c?i.onSnapshot&&i.onSnapshot(h):"onProfileLive"===c?i.onProfileLive&&i.onProfileLive(h):"onCompleteProfile"===c?i.onCompleteProfile&&i.onCompleteProfile(h):"onGrabbingImage"===c?i.onGrabbingImage&&i.onGrabbingImage(h):"onSetFramesPatternCoordinates"===c?i.onSetFramesPatternCoordinates&&i.onSetFramesPatternCoordinates(h):"onGetFrameDataById"===c?i.onGetFrameDataById?i.onGetFrameDataById(h):i.onGetFrameDataBySku&&(console.log("onGetFrameDataBySku deprecated, use onGetFrameDataById instead"),i.onGetFrameDataBySku(h)):"onUiStatus"===c?i.onUiStatus&&i.onUiStatus(h):"onProtocolsInfos"===c?i.onProtocolsInfos&&i.onProtocolsInfos(h):"onSetObjectLoading"===c?i.onSetObjectLoading&&i.onSetObjectLoading(h):"onLensesAnimationPlay"===c?i.onLensesAnimationPlay&&i.onLensesAnimationPlay(h):"onOpenStream"===c?i.onOpenStream&&i.onOpenStream(h):"onSwipe"===c?i.onSwipe&&i.onSwipe(h):"onGetAnatomicalFitScore"===c?i.onGetAnatomicalFitScore&&i.onGetAnatomicalFitScore(h):"onFaceShape"===c?i.onFaceShape&&i.onFaceShape(h):"onGetFaceshape"===c?i.onGetFaceshape&&i.onGetFaceshape(h):"onGetVersion"===c?i.onGetVersion&&(h["fitmix-api"]="8.7.0",i.onGetVersion(h)):"onPrivacyTermsShown"===c?i.onPrivacyTermsShown&&i.onPrivacyTermsShown(h):"onDisagreePrivacyTerms"===c?i.onDisagreePrivacyTerms&&i.onDisagreePrivacyTerms(h):"onAgreePrivacyTerms"===c?i.onAgreePrivacyTerms&&i.onAgreePrivacyTerms(h):"backToTryOnFromRemoval"===c?i.backToTryOnFromRemoval&&i.backToTryOnFromRemoval(h):"removalExperienceStarted"===c?i.removalExperienceStarted&&i.removalExperienceStarted(h):"removalExperienceEnded"===c&&i.removalExperienceEnded&&i.removalExperienceEnded(h);else s=!0,h&&(d=h.liveSupported,n=h.advanced),p&&p(),a&&a(d,n)}else o.method}};this.WIDGET_BASE_URL="https://static.fittingbox.com",this.createWidget=function(t,o,n){if(!(-1!==navigator.userAgent.indexOf("MSIE")||navigator.appVersion.indexOf("Trident/")>-1)){var i=new e;try{o.widgetUrl?i.init(o.widgetUrl,t,o,n):i.init(this.WIDGET_BASE_URL+"/widgets/fitmix/index.html",t,o,n)}catch(e){throw new Error("FitMix.createWidget: "+e.message+" (please refer to integration documentation)")}return i}setTimeout((function(){document.getElementById(t).textContent=" Internet explorer is not supported."}),1e3)},this.waitResource=function(e,t,o){if(o||(o={timeout:1500}),window["wait_"+e+"_TimerStart"]){if(new Date-window["wait_"+e+"_TimerStart"]>o.timeout)return console.log("Waiting of",e,"has reach timeout"),delete window["wait_"+e+"_TimerStart"],void t()}else window["wait_"+e+"_TimerStart"]=new Date;window[e]?(console.log(e,"is now defined"),delete window["wait_"+e+"_TimerStart"],t()):setTimeout((function(){window.FitMix.waitResource(e,t,o)}),100)}},e.exports=FitMix}]);