@thefittingroom/shop-ui 1.5.0 → 1.5.1

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v1.5.0 (2024-09-01T16:53:36.094Z)
2
+ * thefittingroom v1.5.1 (2024-09-01T17:00:41.740Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var i=new Image;i.onload=r,i.onerror=r,i.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const r=document.getElementById(t);if(!r)throw new Error(`Slider with id ${t} not found`);return{Load(t){if(!Array.isArray(t)||!t.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");e(t);const i=(null==t?void 0:t.length)-2;r.value=i.toString(),r.max=(t.length-1).toString();const s=()=>{const e=parseInt(r.value);n(r,t[e])};return n(r,t[i]),r.removeEventListener("input",s),r.addEventListener("input",s),()=>{r.removeEventListener("input",s)}}}},r=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(r(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],o=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==o||null==a||null==c)throw new s;const l=i<<2|o>>4;if(r.push(l),64!==a){const t=o<<4&240|a>>2;if(r.push(t),64!==c){const t=a<<6&192|c;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};
@@ -3280,4 +3280,4 @@ class sm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
3280
3280
  * See the License for the specific language governing permissions and
3281
3281
  * limitations under the License.
3282
3282
  */
3283
- const om=h("authIdTokenMaxAge")||300;let am=null;function cm(t=Ut()){const e=Ot(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Ot(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;_f(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:nm,persistence:[yg,tg,ng]}),r=h("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>om)return;const r=null==e?void 0:e.token;am!==r&&(am=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=(t=>{var e,n;return null===(n=null===(e=l())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return s&&kp(n,`http://${s}`),n}var lm;lm="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),i=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Tf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:lm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:gp(lm)},c=new Ep(n,r,i,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Zf);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new sm(t))(Tp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Ft(rm,im,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(lm)),Ft(rm,im,"esm2017");class um extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class hm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class dm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class fm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=cm(e),this.auth.setPersistence(tg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(t){return new Promise((e=>{const n=this.auth.onAuthStateChanged((r=>{this.setUser(r),e(Boolean(r)),n(),r&&this.logUserLogin(t,r)}))}))}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,i,s,o;try{const a=xh(this.firestore,"user_logging",e.uid),c=await Nd(a),l=new Date,u=c.exists?c.data():null,h=null===(r=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(h&&uf(l).diff(uf(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(i=null==u?void 0:u.brands)||void 0===i?void 0:i[t])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[t]:{brand_id:t,last_login:l,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Dd(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return(await Nd(xh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yd(Dh(this.firestore,"users"),wd(new Wh("__name__"),"==",this.id));return e=xd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Yp(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await async function(t,e,n){var r;const i=Tp(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};if(null===(r=i._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}else n&&Gp(i,s,n),await Lp(i,s).catch((async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}}))}(this.auth,t)}async confirmPasswordReset(t,e){await Qp(this.auth,t,e)}}class pm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=xd(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Md.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Ot("object"==typeof t?t:Ut(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=re("firestore");t&&Rh(r,...t)}return r}(t),this.user=new fm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=yd(Dh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Od(yd(Dh(this.firestore,t),...e))}async getDoc(t,e){const n=xh(this.firestore,t,e),r=await Nd(n);return r.exists()?r.data():null}}const gm=t=>{if(t.code===vf)throw new Error("account has been disabled");throw new Error(t.message)};class mm{static get endpoint(){return Md.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(s,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class ym{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new hm;try{const r=await mm.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new um;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await mm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wd("brand_id","==",this.brandId)];r.push(wd("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return gm(t)}}async getColorwaySizeAssets(t,e){const n=[wd("brand_id","==",this.brandId)];t&&n.push(wd("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wd("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return gm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return gm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return gm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return gm(t)}}}var vm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(vm||(vm={}));const wm={[vm.ACROSS_BACK]:"Across back",[vm.ACROSS_FRONT]:"Across front",[vm.ACROSS_SHOULDER]:"Across shoulder",[vm.ANKLE]:"Ankle",[vm.ARMEYE]:"Armeye",[vm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[vm.BACK_CROTCH_LENGTH]:"Back crotch length",[vm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[vm.BELOW_KNEE]:"Below knee",[vm.BICEP]:"Bicep",[vm.BUST]:"Chest/Bust",[vm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[vm.CALF]:"Calf",[vm.CB_NECK_TO_WAIST]:"Cb neck to waist",[vm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[vm.CF_NECK_TO_WAIST]:"Cf neck to waist",[vm.ELBOW]:"Elbow",[vm.FOREARM]:"Forearm",[vm.FRONT_CROTCH_LENGTH]:"Front crotch length",[vm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[vm.HIGH_HIP]:"High hip",[vm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[vm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[vm.HSP_TO_BUST_POINT]:"Hsp to bust point",[vm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[vm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[vm.INSEAM]:"Inseam",[vm.KNEE]:"Knee",[vm.LOW_HIP]:"Low hip",[vm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[vm.MID_NECK]:"Mid neck",[vm.NECK_AT_BASE]:"Neck at base",[vm.SHOULDER_DROP]:"Shoulder drop",[vm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[vm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[vm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[vm.THIGH]:"Thigh",[vm.TOTAL_RISE_LENGTH]:"Total rise length",[vm.UNDER_BUST]:"Under bust",[vm.VERTICAL_TRUNK]:"Vertical trunk",[vm.WAIST]:"Waist",[vm.WRIST]:"Wrist"};var bm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(bm||(bm={}));const _m={[bm.BLOUSES]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.COATS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.DRESSES]:[vm.LOW_HIP,vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST],[bm.JACKETS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.PANTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.PUFFERS_AND_PARKAS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.SHORTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.SKIRTS]:[vm.LOW_HIP,vm.WAIST],[bm.SWEATERS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.T_SHIRTS_AND_TANKS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP]},Sm={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},Em={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Tm={activewear:{leggings:bm.PANTS,joggers:bm.PANTS,sweatshirts:bm.SWEATERS},dresses:{a_line:bm.DRESSES,bodycon:bm.DRESSES,fit_and_flare:bm.DRESSES,knit:bm.DRESSES,shirt:bm.DRESSES,slip:bm.DRESSES,straight:bm.DRESSES,wrap:bm.DRESSES},jackets_and_coats:{denim_jackets:bm.JACKETS,parkas:bm.PUFFERS_AND_PARKAS,peacoats:bm.COATS,puffer_jackets:bm.PUFFERS_AND_PARKAS,raincoats:bm.COATS,rompers:bm.COATS,shackets:bm.JACKETS,trench_coats:bm.COATS},jeans:{bootcut:bm.PANTS,flared:bm.PANTS,mom:bm.PANTS,relaxed:bm.PANTS,skinny:bm.PANTS,slim:bm.PANTS,straight:bm.PANTS,tapered:bm.PANTS,wide_leg:bm.PANTS},jumpsuits_and_rompers:{boiler_suits:bm.DRESSES,denim:bm.DRESSES,jumpsuits:bm.DRESSES,overalls:bm.DRESSES,rompers:bm.DRESSES,unitards:bm.DRESSES},pants_and_shorts:{cigarette:bm.PANTS,culottes:bm.SHORTS,denim_shorts:bm.SHORTS,flared:bm.PANTS,joggers:bm.PANTS,leggings:bm.PANTS,skinny:bm.PANTS,wide_leg:bm.PANTS},skirts:{a_line_flared:bm.SKIRTS,denim:bm.SKIRTS,knit:bm.SKIRTS,pencil:bm.SKIRTS,pleated:bm.SKIRTS,skater:bm.SKIRTS,slip:bm.SKIRTS,wrap:bm.SKIRTS},suits_and_tailoring:{blazers:bm.JACKETS,suit_jackets:bm.JACKETS,suit_skirts:bm.SKIRTS,suit_trousers:bm.PANTS,suit_vests:bm.SWEATERS,trousers:bm.PANTS},sweaters:{cardigans:bm.SWEATERS,crewnecks:bm.SWEATERS,hoodies_and_zipups:bm.SWEATERS,sweatshirts:bm.SWEATERS,turtlenecks:bm.SWEATERS,v_necks:bm.SWEATERS},tops:{bodysuits:bm.BLOUSES,corsets_and_bustiers:bm.BLOUSES,polos:bm.T_SHIRTS_AND_TANKS,shirts_and_blouses:bm.BLOUSES,t_shirts:bm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:bm.T_SHIRTS_AND_TANKS}};var Im;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Im||(Im={}));const km={[Im.TOO_TIGHT]:"Too Tight",[Im.TIGHT]:"Tight",[Im.SLIGHTLY_TIGHT]:"Slightly Tight",[Im.PERFECT_FIT]:"Perfect Fit",[Im.SLIGHTLY_LOOSE]:"Slightly Loose",[Im.LOOSE]:"Loose",[Im.OVERSIZED]:"Oversized",[Im.TOO_SHORT]:"Too Short",[Im.SHORT]:"Short",[Im.SLIGHTLY_SHORT]:"Slightly Short",[Im.SLIGHTLY_LONG]:"Slightly Long",[Im.LONG]:"Long",[Im.TOO_LONG]:"Too Long"};var Cm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Cm||(Cm={}));var Am=Object.freeze({__proto__:null,get AvatarState(){return Cm},get MeasurementLocation(){return vm},MeasurementLocationName:wm,get Classification(){return bm},ClassificationLocations:_m,CategoryNames:Sm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Em,Taxonomy:Tm,get Fit(){return Im},FitNames:km}),Rm="Back to sign in",Nm="Click here to download the app",Lm="Don't have an account?",Om="Whoops! Looks like you don't have an avatar yet.",Dm="Email address",xm="Please enter a valid email address.",Pm="Enter your email address, we will send you a link to reset your password.",Mm="Forgot password?",Um="Have an account? Sign in",Fm="Your avatar is loading...",zm="Unfortunately, that size is not available for try on.",Bm="or",Vm="Password",Hm="Please enter a valid password (at least 7 characters).",$m="Return to Catalog Page",jm="Return to Product Page",qm="Return to site",Wm="Please return to The Fitting Room app to create your avatar.",Km="Scan to download the app",Gm="Send",Qm="Sign back in",Ym="Sign in",Jm="Something went wrong. Try again!",Xm="You have successfully logged out!",Zm="The Fitting Room",ty="Username or password is empty.",ey="Username or password is incorrect.",ny="End size uncertainty with",ry="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var iy=[],sy=[];function oy(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=iy.indexOf(s);-1===o&&(o=iy.push(s)-1,sy[o]={}),n=sy[o]&&sy[o][r]?sy[o][r]:sy[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}oy(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});oy(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:0 auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;max-height:100vh;max-width:850px;overflow:auto;width:100%}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:350px;max-width:350px}.tfr-logo-box{margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:200px}.tfr-space-above{margin-top:10px}.tfr-max-w-600{margin:auto;max-width:600px}#tfr-qr-border-box{align-items:center;border:2px solid var(--tfr-brand-color);border-radius:16px;display:flex;flex-direction:column;height:350px;justify-content:center;margin-left:20px;padding:0 30px;width:300px}.tfr-mobile-logo{height:60px}#email-input,#password-input{font-size:16px}",{});oy("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});oy(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});oy("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto;margin:auto;width:100%}}@media screen and (max-width:599px){#tfr-size-recommendations{width:calc(100vw - 30px)!important}.tfr-mobile-hidden{display:none}.tfr-modal-content-container{max-height:none;max-width:100vw;min-height:100vh;min-width:100vw}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{overflow:auto}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}@media screen and (max-width:380){#tfr-size-rec-subtitle{min-width:none}}@media screen and (max-height:800px){.tfr-video-responsive{height:280px!important}}",{});oy("#tfr-size-recommendations{align-items:center;background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;flex-direction:column;font-family:var(--tfr-main-font);justify-content:center;padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations-container{align-items:center;display:none;flex-direction:column;justify-content:center;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column;font-size:13px;width:100%}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);min-width:318px;padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;padding:0 10px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);justify-content:center;min-height:40px}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;padding-left:8px;text-align:right}.tfr-size-rec-table-cell-right{margin-left:16px;padding-right:8px}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex;width:150px}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}",{});oy(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px 10px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});oy(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});oy(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}.tfr-24-bold{font-size:24px;font-weight:700}",{});oy(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const ay=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Fm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),cy=t=>{const e=document.getElementById(t),n=document.querySelector("body");if(!e)throw new Error(`element with id ${t} not found`);let r;const i=()=>{n.style.overflow="auto",r&&(r.Unhook(),c()),e.style.display="none"},s=t=>{"Escape"===t.key&&i()},o=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),i())},a=()=>{e.querySelector("#tfr-close-container").addEventListener("click",i),document.addEventListener("keydown",s),document.addEventListener("click",o)},c=()=>{var n;const r=e.querySelector("#tfr-close-container");r?r.removeEventListener("click",i):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(t))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",s),document.removeEventListener("click",o)};return{open:t=>{var i;n.style.overflow="hidden",r&&r.Unhook(),e.innerHTML=(i=t.Body(),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">&times;</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${ny}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${Zm}</div>\n </div>\n </div>\n ${i}\n </div>\n </div>\n </div>\n </div>\n `),a(),t.Hook(),e.style.display="block",r=t},close:i,Content:()=>r}},ly=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")},s="https://assets.dev.thefittingroom.xyz/images/";return{Hook:()=>{var t,s,o;if(e||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),e){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(s=document.getElementById("tfr-app-store"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${ry}</div>\n \n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls loop autoplay playsinline>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n\n ${e?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${Km}</div>\n \n <img src="${s}qr.png" class="tfr-qr-code" />\n\n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Um}</div>\n </div>`}\n </div>\n\n ${e?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${Nm}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n <img class="tfr-mobile-logo" src="${s}apple.png" id="tfr-app-store" />\n <img class="tfr-mobile-logo" src="${s}google.png" id="tfr-google-play" />\n </div>\n \n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Um}</div>\n `:""}\n `}};class uy{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=cy(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${Xm}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${Qm}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${qm}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Om}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${Wm}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(ay({timeoutMS:1e4}))}toScan(){this.manager.open(ly({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${Ym}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Dm}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Vm}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${Mm}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${Lm}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${Ym}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Pm}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Dm}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Rm}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${Gm}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${jm}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||Jm}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${jm}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${zm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Bm} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${jm}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const hy="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class dy{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!1,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeHowItFits.style.display="block"):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.tfrSizeHowItFits.style.display="none")}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeHowItFits=document.getElementById("tfr-size-how-it-fits"),this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=`&nbsp;${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],r=n.sort((({location:t},{location:e})=>t<e?-1:1)).map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${hy}" /> Sign up or login to view</div>`}renderGarmentLocations(t){const e=t.sort().map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${hy}" /> Sign up or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-how-it-fits">Select size to see how it fits:</div>\n\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></div>\n </div>\n \n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Log out</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class fy{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Am.Fit.PERFECT_FIT,Am.Fit.SLIGHTLY_LOOSE,Am.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new dy(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Am.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:this.tfrShop.getMeasurementLocationName(t.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(t.measurement_location)}))).sort(((t,e)=>t.sortOrder<e.sortOrder?-1:1))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var py;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(py||(py={}));class gy{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");console.log("tfr-env",o),this.tfrModal=new uy(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Md.getInstance().setEnv(e),new ym(t,new pm)))(Number(this.shopId),o),this.tfrSizeRec=new fy(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(ty);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(xm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(Hm);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(ey)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(Jm)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case py.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Om),this.tfrModal.onNotCreated();break;case py.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case py.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(Jm),this.tfrModal.onError(Jm)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const my=async(t,e,n,r={},i={},s="dev")=>{const o=new gy(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,my as initFittingRoom};
3283
+ const om=h("authIdTokenMaxAge")||300;let am=null;function cm(t=Ut()){const e=Ot(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Ot(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;_f(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:nm,persistence:[yg,tg,ng]}),r=h("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>om)return;const r=null==e?void 0:e.token;am!==r&&(am=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=(t=>{var e,n;return null===(n=null===(e=l())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return s&&kp(n,`http://${s}`),n}var lm;lm="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),i=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Tf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:lm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:gp(lm)},c=new Ep(n,r,i,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Zf);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new sm(t))(Tp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Ft(rm,im,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(lm)),Ft(rm,im,"esm2017");class um extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class hm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class dm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class fm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=cm(e),this.auth.setPersistence(tg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(t){return new Promise((e=>{const n=this.auth.onAuthStateChanged((r=>{this.setUser(r),e(Boolean(r)),n(),r&&this.logUserLogin(t,r)}))}))}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,i,s,o;try{const a=xh(this.firestore,"user_logging",e.uid),c=await Nd(a),l=new Date,u=c.exists?c.data():null,h=null===(r=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(h&&uf(l).diff(uf(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(i=null==u?void 0:u.brands)||void 0===i?void 0:i[t])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[t]:{brand_id:t,last_login:l,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Dd(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return(await Nd(xh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yd(Dh(this.firestore,"users"),wd(new Wh("__name__"),"==",this.id));return e=xd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Yp(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await async function(t,e,n){var r;const i=Tp(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};if(null===(r=i._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}else n&&Gp(i,s,n),await Lp(i,s).catch((async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}}))}(this.auth,t)}async confirmPasswordReset(t,e){await Qp(this.auth,t,e)}}class pm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=xd(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Md.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Ot("object"==typeof t?t:Ut(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=re("firestore");t&&Rh(r,...t)}return r}(t),this.user=new fm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=yd(Dh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Od(yd(Dh(this.firestore,t),...e))}async getDoc(t,e){const n=xh(this.firestore,t,e),r=await Nd(n);return r.exists()?r.data():null}}const gm=t=>{if(t.code===vf)throw new Error("account has been disabled");throw new Error(t.message)};class mm{static get endpoint(){return Md.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(s,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class ym{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new hm;try{const r=await mm.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new um;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await mm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wd("brand_id","==",this.brandId)];r.push(wd("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return gm(t)}}async getColorwaySizeAssets(t,e){const n=[wd("brand_id","==",this.brandId)];t&&n.push(wd("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wd("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return gm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return gm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return gm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return gm(t)}}}var vm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(vm||(vm={}));const wm={[vm.ACROSS_BACK]:"Across back",[vm.ACROSS_FRONT]:"Across front",[vm.ACROSS_SHOULDER]:"Across shoulder",[vm.ANKLE]:"Ankle",[vm.ARMEYE]:"Armeye",[vm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[vm.BACK_CROTCH_LENGTH]:"Back crotch length",[vm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[vm.BELOW_KNEE]:"Below knee",[vm.BICEP]:"Bicep",[vm.BUST]:"Chest/Bust",[vm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[vm.CALF]:"Calf",[vm.CB_NECK_TO_WAIST]:"Cb neck to waist",[vm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[vm.CF_NECK_TO_WAIST]:"Cf neck to waist",[vm.ELBOW]:"Elbow",[vm.FOREARM]:"Forearm",[vm.FRONT_CROTCH_LENGTH]:"Front crotch length",[vm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[vm.HIGH_HIP]:"High hip",[vm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[vm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[vm.HSP_TO_BUST_POINT]:"Hsp to bust point",[vm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[vm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[vm.INSEAM]:"Inseam",[vm.KNEE]:"Knee",[vm.LOW_HIP]:"Low hip",[vm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[vm.MID_NECK]:"Mid neck",[vm.NECK_AT_BASE]:"Neck at base",[vm.SHOULDER_DROP]:"Shoulder drop",[vm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[vm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[vm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[vm.THIGH]:"Thigh",[vm.TOTAL_RISE_LENGTH]:"Total rise length",[vm.UNDER_BUST]:"Under bust",[vm.VERTICAL_TRUNK]:"Vertical trunk",[vm.WAIST]:"Waist",[vm.WRIST]:"Wrist"};var bm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(bm||(bm={}));const _m={[bm.BLOUSES]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.COATS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.DRESSES]:[vm.LOW_HIP,vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST],[bm.JACKETS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.PANTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.PUFFERS_AND_PARKAS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.SHORTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.SKIRTS]:[vm.LOW_HIP,vm.WAIST],[bm.SWEATERS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.T_SHIRTS_AND_TANKS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP]},Sm={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},Em={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Tm={activewear:{leggings:bm.PANTS,joggers:bm.PANTS,sweatshirts:bm.SWEATERS},dresses:{a_line:bm.DRESSES,bodycon:bm.DRESSES,fit_and_flare:bm.DRESSES,knit:bm.DRESSES,shirt:bm.DRESSES,slip:bm.DRESSES,straight:bm.DRESSES,wrap:bm.DRESSES},jackets_and_coats:{denim_jackets:bm.JACKETS,parkas:bm.PUFFERS_AND_PARKAS,peacoats:bm.COATS,puffer_jackets:bm.PUFFERS_AND_PARKAS,raincoats:bm.COATS,rompers:bm.COATS,shackets:bm.JACKETS,trench_coats:bm.COATS},jeans:{bootcut:bm.PANTS,flared:bm.PANTS,mom:bm.PANTS,relaxed:bm.PANTS,skinny:bm.PANTS,slim:bm.PANTS,straight:bm.PANTS,tapered:bm.PANTS,wide_leg:bm.PANTS},jumpsuits_and_rompers:{boiler_suits:bm.DRESSES,denim:bm.DRESSES,jumpsuits:bm.DRESSES,overalls:bm.DRESSES,rompers:bm.DRESSES,unitards:bm.DRESSES},pants_and_shorts:{cigarette:bm.PANTS,culottes:bm.SHORTS,denim_shorts:bm.SHORTS,flared:bm.PANTS,joggers:bm.PANTS,leggings:bm.PANTS,skinny:bm.PANTS,wide_leg:bm.PANTS},skirts:{a_line_flared:bm.SKIRTS,denim:bm.SKIRTS,knit:bm.SKIRTS,pencil:bm.SKIRTS,pleated:bm.SKIRTS,skater:bm.SKIRTS,slip:bm.SKIRTS,wrap:bm.SKIRTS},suits_and_tailoring:{blazers:bm.JACKETS,suit_jackets:bm.JACKETS,suit_skirts:bm.SKIRTS,suit_trousers:bm.PANTS,suit_vests:bm.SWEATERS,trousers:bm.PANTS},sweaters:{cardigans:bm.SWEATERS,crewnecks:bm.SWEATERS,hoodies_and_zipups:bm.SWEATERS,sweatshirts:bm.SWEATERS,turtlenecks:bm.SWEATERS,v_necks:bm.SWEATERS},tops:{bodysuits:bm.BLOUSES,corsets_and_bustiers:bm.BLOUSES,polos:bm.T_SHIRTS_AND_TANKS,shirts_and_blouses:bm.BLOUSES,t_shirts:bm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:bm.T_SHIRTS_AND_TANKS}};var Im;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Im||(Im={}));const km={[Im.TOO_TIGHT]:"Too Tight",[Im.TIGHT]:"Tight",[Im.SLIGHTLY_TIGHT]:"Slightly Tight",[Im.PERFECT_FIT]:"Perfect Fit",[Im.SLIGHTLY_LOOSE]:"Slightly Loose",[Im.LOOSE]:"Loose",[Im.OVERSIZED]:"Oversized",[Im.TOO_SHORT]:"Too Short",[Im.SHORT]:"Short",[Im.SLIGHTLY_SHORT]:"Slightly Short",[Im.SLIGHTLY_LONG]:"Slightly Long",[Im.LONG]:"Long",[Im.TOO_LONG]:"Too Long"};var Cm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Cm||(Cm={}));var Am=Object.freeze({__proto__:null,get AvatarState(){return Cm},get MeasurementLocation(){return vm},MeasurementLocationName:wm,get Classification(){return bm},ClassificationLocations:_m,CategoryNames:Sm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Em,Taxonomy:Tm,get Fit(){return Im},FitNames:km}),Rm="Back to sign in",Nm="Click here to download the app",Lm="Don't have an account?",Om="Whoops! Looks like you don't have an avatar yet.",Dm="Email address",xm="Please enter a valid email address.",Pm="Enter your email address, we will send you a link to reset your password.",Mm="Forgot password?",Um="Have an account? Sign in",Fm="Your avatar is loading...",zm="Unfortunately, that size is not available for try on.",Bm="or",Vm="Password",Hm="Please enter a valid password (at least 7 characters).",$m="Return to Catalog Page",jm="Return to Product Page",qm="Return to site",Wm="Please return to The Fitting Room app to create your avatar.",Km="Scan to download the app",Gm="Send",Qm="Sign back in",Ym="Sign in",Jm="Something went wrong. Try again!",Xm="You have successfully logged out!",Zm="The Fitting Room",ty="Username or password is empty.",ey="Username or password is incorrect.",ny="End size uncertainty with",ry="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var iy=[],sy=[];function oy(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=iy.indexOf(s);-1===o&&(o=iy.push(s)-1,sy[o]={}),n=sy[o]&&sy[o][r]?sy[o][r]:sy[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}oy(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});oy(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:0 auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;max-height:100vh;max-width:850px;overflow:auto;width:100%}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:350px;max-width:350px}.tfr-logo-box{margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:200px}.tfr-space-above{margin-top:10px}.tfr-max-w-600{margin:auto;max-width:600px}#tfr-qr-border-box{align-items:center;border:2px solid var(--tfr-brand-color);border-radius:16px;display:flex;flex-direction:column;height:350px;justify-content:center;margin-left:20px;padding:0 30px;width:300px}.tfr-mobile-logo{height:60px}#email-input,#password-input{font-size:16px}",{});oy("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});oy(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});oy("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto;margin:auto;width:100%}}@media screen and (max-width:599px){#tfr-size-recommendations{width:calc(100vw - 30px)!important}.tfr-mobile-hidden{display:none}.tfr-modal-content-container{max-height:none;max-width:100vw;min-height:100vh;min-width:100vw}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{overflow:auto}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}@media screen and (max-width:380){#tfr-size-rec-subtitle{min-width:none}}@media screen and (max-height:800px){.tfr-video-responsive{height:280px!important}}",{});oy("#tfr-size-recommendations{align-items:center;background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;flex-direction:column;font-family:var(--tfr-main-font);justify-content:center;padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations-container{align-items:center;display:none;flex-direction:column;justify-content:center;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column;font-size:13px;width:100%}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);min-width:318px;padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;padding:0 10px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);justify-content:center;min-height:40px}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;padding-left:8px;text-align:right}.tfr-size-rec-table-cell-right{margin-left:16px;padding-right:8px}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex;width:150px}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}",{});oy(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px 10px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});oy(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});oy(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}.tfr-24-bold{font-size:24px;font-weight:700}",{});oy(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const ay=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Fm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),cy=t=>{const e=document.getElementById(t),n=document.querySelector("body");if(!e)throw new Error(`element with id ${t} not found`);let r;const i=()=>{n.style.overflow="auto",r&&(r.Unhook(),c()),e.style.display="none"},s=t=>{"Escape"===t.key&&i()},o=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),i())},a=()=>{e.querySelector("#tfr-close-container").addEventListener("click",i),document.addEventListener("keydown",s),document.addEventListener("click",o)},c=()=>{var n;const r=e.querySelector("#tfr-close-container");r?r.removeEventListener("click",i):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(t))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",s),document.removeEventListener("click",o)};return{open:t=>{var i;n.style.overflow="hidden",r&&r.Unhook(),e.innerHTML=(i=t.Body(),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">&times;</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${ny}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${Zm}</div>\n </div>\n </div>\n ${i}\n </div>\n </div>\n </div>\n </div>\n `),a(),t.Hook(),e.style.display="block",r=t},close:i,Content:()=>r}},ly=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")},s="https://assets.dev.thefittingroom.xyz/images/";return{Hook:()=>{var t,s,o;if(e||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),e){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(s=document.getElementById("tfr-app-store"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${ry}</div>\n \n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls loop autoplay playsinline>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n\n ${e?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${Km}</div>\n \n <img src="${s}qr.png" class="tfr-qr-code" />\n\n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Um}</div>\n </div>`}\n </div>\n\n ${e?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${Nm}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n <img class="tfr-mobile-logo" src="${s}apple.png" id="tfr-app-store" />\n <img class="tfr-mobile-logo" src="${s}google.png" id="tfr-google-play" />\n </div>\n \n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Um}</div>\n `:""}\n `}};class uy{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=cy(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${Xm}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${Qm}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${qm}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Om}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${Wm}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(ay({timeoutMS:1e4}))}toScan(){this.manager.open(ly({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${Ym}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Dm}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Vm}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${Mm}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${Lm}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${Ym}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Pm}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Dm}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Rm}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${Gm}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${jm}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||Jm}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${jm}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${zm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Bm} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${jm}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const hy="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class dy{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!1,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeHowItFits.style.display="block"):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.tfrSizeHowItFits.style.display="none")}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeHowItFits=document.getElementById("tfr-size-how-it-fits"),this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=`&nbsp;${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],r=n.map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${hy}" /> Sign up or login to view</div>`}renderGarmentLocations(t){const e=t.map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${hy}" /> Sign up or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-how-it-fits">Select size to see how it fits:</div>\n\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></div>\n </div>\n \n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Log out</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class fy{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Am.Fit.PERFECT_FIT,Am.Fit.SLIGHTLY_LOOSE,Am.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new dy(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Am.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:this.tfrShop.getMeasurementLocationName(t.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(t.measurement_location)}))).sort(((t,e)=>t.sortOrder<e.sortOrder?-1:1))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var py;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(py||(py={}));class gy{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");console.log("tfr-env",o),this.tfrModal=new uy(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Md.getInstance().setEnv(e),new ym(t,new pm)))(Number(this.shopId),o),this.tfrSizeRec=new fy(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(ty);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(xm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(Hm);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(ey)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(Jm)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case py.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Om),this.tfrModal.onNotCreated();break;case py.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case py.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(Jm),this.tfrModal.onError(Jm)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const my=async(t,e,n,r={},i={},s="dev")=>{const o=new gy(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,my as initFittingRoom};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thefittingroom/shop-ui",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "the fitting room UI library",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/index.js",