@thefittingroom/sdk 2.0.0-alpha-2 → 2.0.0

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 v2.0.0-alpha-2 (2025-04-18T19:07:04.956Z)
2
+ * thefittingroom v2.0.0-alpha-3 (2025-07-15T19:34:00.661Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
@@ -3306,5 +3306,5 @@ class vm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
3306
3306
  * See the License for the specific language governing permissions and
3307
3307
  * limitations under the License.
3308
3308
  */
3309
- const wm=h("authIdTokenMaxAge")||300;let _m=null;function Tm(t=Vt()){const e=Lt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Lt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(m(n.getOptions(),null!=e?e:{}))return t;If(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:gm,persistence:[Rg,fg,gg]}),r=h("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(r,location.origin);if(location.origin===t.origin){const e=(s=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>wm)return;const r=null==e?void 0:e.token;_m!==r&&(_m=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){S(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,r){S(t).onIdTokenChanged(e,n,r)}(n,(t=>e(t)))}}var s;const i=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return i&&Up(n,`http://${i}`),n}var Em;!function(t){Dp=t}({loadJS:t=>new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=bf("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Em="Browser",Dt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Nf(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Em,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ap(Em)},c=new Np(n,r,s,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(hp);(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()}))),Dt(new I("auth-internal",(t=>(t=>new vm(t))(Rp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Bt(mm,ym,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Em)),Bt(mm,ym,"esm2017");class Sm extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Im extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class bm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Am extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Cm extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class km extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}class Nm extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Rm="avatar not created";var Om=Object.freeze({__proto__:null,AvatarNotCreatedError:Sm,UserNotLoggedInError:Im,NoColorwaySizeAssetsFoundError:bm,BrandUserIdNotSetError:Am,NoFramesFoundError:Cm,RecommendedAvailableSizesError:km,NoStylesFoundError:Nm,AvatarNotCreated:Rm});class Dm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Tm(e),this.auth.setPersistence(fg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}async onInit(t){this.auth.onAuthStateChanged((e=>{this.setUser(e),e&&(this.logUserLogin(t,e),this.setBrandUserId(e.uid))})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),this.setBrandUserId(null==e?void 0:e.uid),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,s,i,o;try{const a=xl(this.firestore,"user_logging",e.uid),c=await Ld(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(l&&ff(u).diff(ff(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[t])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[t]:{brand_id:t,last_login:u,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:u,updated_at:u};await xd(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 Im;return await this.user.getIdToken()}get userId(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return this.user.uid}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return(await Ld(xl(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=_d(Ml(this.firestore,"users"),Ed(Ql(),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}watchUserProfileForFrames(t){let e;const n=_d(Ml(this.firestore,"users"),Ed(Ql(),"==",this.id));return new Promise((r=>{e=Ud(n,(async n=>{await t(n)&&(e(),r(n.docs[0].data()))}))}))}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await ug(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await ag(this.auth,t)}async confirmPasswordReset(t,e){await cg(this.auth,t,e)}}class Lm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Ud(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Ft(Vd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Lt("object"==typeof t?t:Vt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=ie("firestore");t&&Ol(r,...t)}return r}(t),this.user=new Dm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=_d(Ml(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Md(_d(Ml(this.firestore,t),...e))}async getDoc(t,e){const n=xl(this.firestore,t,e),r=await Ld(n);return r.exists()?r.data():null}}const Pm=t=>{if(t.code===Tf)throw new Error("account has been disabled");throw new Error(t.message)};class Mm{static get endpoint(){return Vd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,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})}}const xm=t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))};class Um{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 Im;try{const r=await Mm.Get(this.user,`/styles/${t}/recommendation`),s=await r.json();return(null===(e=null==s?void 0:s.fits)||void 0===e?void 0:e.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(t){if((null==t?void 0:t.error)===Rm)throw new Sm;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 bm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new bm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){console.log({sku:t});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 s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.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 s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.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=[Ed("brand_id","==",this.brandId)];r.push(Ed("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 Pm(t)}}async getColorwaySizeAssets(t,e){const n=[Ed("brand_id","==",this.brandId)];t&&n.push(Ed("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(Ed("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 Pm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Pm(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 tryOn(t,e){if(!this.isLoggedIn)throw new Im;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e);try{return await this.getColorwaySizeAssetFrames(n)}catch(t){if(!(t instanceof Cm))throw t;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e){var n,r,s;try{const i=[Ed("brand_id","==",this.brandId)];i.push(Ed("style_id","==",t)),i.push(Ed("size_id","==",e));return null===(s=null===(r=null===(n=(await this.firebase.getDocs("colorway_size_assets",i)).docs)||void 0===n?void 0:n[0])||void 0===r?void 0:r.data())||void 0===s?void 0:s.sku}catch(t){return Pm(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Pm(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 Pm(t)}}async requestThenGetColorwaySizeAssetFrames(t){const[e,n]=await(r=this.getColorwaySizeAssetFromSku(t),r.then((t=>[null,t])).catch((t=>[t])));var r;if(e)throw e;try{return this.requestColorwaySizeAssetFrames(n.id),this.awaitColorwaySizeAssetFrames(t)}catch(e){if((null==e?void 0:e.error)===Rm)throw new Sm;throw new Nm}}async awaitColorwaySizeAssetFrames(t){var e,n,r,s;if(!this.isLoggedIn)throw new Im;const i=await this.user.watchUserProfileForFrames((async e=>{var n,r,s,i;const o=null===(i=null===(s=null===(r=null===(n=e.docs[0].data())||void 0===n?void 0:n.vto)||void 0===r?void 0:r[this.brandId])||void 0===s?void 0:s[t])||void 0===i?void 0:i.frames;return!!(null==o?void 0:o.length)&&xm(o[0])}));if(!(null===(s=null===(r=null===(n=null===(e=null==i?void 0:i.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||void 0===s?void 0:s.length))throw new Cm;return i.vto[this.brandId][t].frames}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Im;if(!this.user.brandUserId)throw new Am;await Mm.Post(this.user,`/colorway-size-assets/${t}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(t){var e,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(e=null==s?void 0:s.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Cm;if(!await xm(i[0]))throw new Cm;return i}}const Fm=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Vd.getInstance().setEnv(e),new Um(t,new Lm));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 Bm={[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 Hm;!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"}(Hm||(Hm={}));const jm={[Hm.BLOUSES]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.COATS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.DRESSES]:[Vm.LOW_HIP,Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST],[Hm.JACKETS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.PANTS]:[Vm.LOW_HIP,Vm.WAIST,Vm.THIGH,Vm.INSEAM],[Hm.PUFFERS_AND_PARKAS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.SHORTS]:[Vm.LOW_HIP,Vm.WAIST,Vm.THIGH,Vm.INSEAM],[Hm.SKIRTS]:[Vm.LOW_HIP,Vm.WAIST],[Hm.SWEATERS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.T_SHIRTS_AND_TANKS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP]},$m={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"},qm={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"},Km={activewear:{leggings:Hm.PANTS,joggers:Hm.PANTS,sweatshirts:Hm.SWEATERS},dresses:{a_line:Hm.DRESSES,bodycon:Hm.DRESSES,fit_and_flare:Hm.DRESSES,knit:Hm.DRESSES,shirt:Hm.DRESSES,slip:Hm.DRESSES,straight:Hm.DRESSES,wrap:Hm.DRESSES},jackets_and_coats:{denim_jackets:Hm.JACKETS,parkas:Hm.PUFFERS_AND_PARKAS,peacoats:Hm.COATS,puffer_jackets:Hm.PUFFERS_AND_PARKAS,raincoats:Hm.COATS,rompers:Hm.COATS,shackets:Hm.JACKETS,trench_coats:Hm.COATS},jeans:{bootcut:Hm.PANTS,flared:Hm.PANTS,mom:Hm.PANTS,relaxed:Hm.PANTS,skinny:Hm.PANTS,slim:Hm.PANTS,straight:Hm.PANTS,tapered:Hm.PANTS,wide_leg:Hm.PANTS},jumpsuits_and_rompers:{boiler_suits:Hm.DRESSES,denim:Hm.DRESSES,jumpsuits:Hm.DRESSES,overalls:Hm.DRESSES,rompers:Hm.DRESSES,unitards:Hm.DRESSES},pants_and_shorts:{cigarette:Hm.PANTS,culottes:Hm.SHORTS,denim_shorts:Hm.SHORTS,flared:Hm.PANTS,joggers:Hm.PANTS,leggings:Hm.PANTS,skinny:Hm.PANTS,wide_leg:Hm.PANTS},skirts:{a_line_flared:Hm.SKIRTS,denim:Hm.SKIRTS,knit:Hm.SKIRTS,pencil:Hm.SKIRTS,pleated:Hm.SKIRTS,skater:Hm.SKIRTS,slip:Hm.SKIRTS,wrap:Hm.SKIRTS},suits_and_tailoring:{blazers:Hm.JACKETS,suit_jackets:Hm.JACKETS,suit_skirts:Hm.SKIRTS,suit_trousers:Hm.PANTS,suit_vests:Hm.SWEATERS,trousers:Hm.PANTS},sweaters:{cardigans:Hm.SWEATERS,crewnecks:Hm.SWEATERS,hoodies_and_zipups:Hm.SWEATERS,sweatshirts:Hm.SWEATERS,turtlenecks:Hm.SWEATERS,v_necks:Hm.SWEATERS},tops:{bodysuits:Hm.BLOUSES,corsets_and_bustiers:Hm.BLOUSES,polos:Hm.T_SHIRTS_AND_TANKS,shirts_and_blouses:Hm.BLOUSES,t_shirts:Hm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Hm.T_SHIRTS_AND_TANKS}};var Wm;!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"}(Wm||(Wm={}));const zm={[Wm.TOO_TIGHT]:"Too Tight",[Wm.TIGHT]:"Tight",[Wm.SLIGHTLY_TIGHT]:"Slightly Tight",[Wm.PERFECT_FIT]:"Perfect Fit",[Wm.SLIGHTLY_LOOSE]:"Slightly Loose",[Wm.LOOSE]:"Loose",[Wm.OVERSIZED]:"Oversized",[Wm.TOO_SHORT]:"Too Short",[Wm.SHORT]:"Short",[Wm.SLIGHTLY_SHORT]:"Slightly Short",[Wm.SLIGHTLY_LONG]:"Slightly Long",[Wm.LONG]:"Long",[Wm.TOO_LONG]:"Too Long"};var Gm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Gm||(Gm={}));var Qm=Object.freeze({__proto__:null,get AvatarState(){return Gm},get MeasurementLocation(){return Vm},MeasurementLocationName:Bm,get Classification(){return Hm},ClassificationLocations:jm,CategoryNames:$m,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:qm,Taxonomy:Km,get Fit(){return Wm},FitNames:zm});export{Om as Errors,Fm as initShop,t as requests,e as responses,Qm as types};
3309
+ const wm=h("authIdTokenMaxAge")||300;let _m=null;function Tm(t=Vt()){const e=Lt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Lt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(m(n.getOptions(),null!=e?e:{}))return t;If(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:gm,persistence:[Rg,fg,gg]}),r=h("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(r,location.origin);if(location.origin===t.origin){const e=(s=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>wm)return;const r=null==e?void 0:e.token;_m!==r&&(_m=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){S(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,r){S(t).onIdTokenChanged(e,n,r)}(n,(t=>e(t)))}}var s;const i=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return i&&Up(n,`http://${i}`),n}var Em;!function(t){Dp=t}({loadJS:t=>new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=bf("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Em="Browser",Dt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Nf(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Em,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ap(Em)},c=new Np(n,r,s,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(hp);(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()}))),Dt(new I("auth-internal",(t=>(t=>new vm(t))(Rp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Bt(mm,ym,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Em)),Bt(mm,ym,"esm2017");class Sm extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Im extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class bm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Am extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Cm extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class km extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}class Nm extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Rm="avatar not created";var Om=Object.freeze({__proto__:null,AvatarNotCreatedError:Sm,UserNotLoggedInError:Im,NoColorwaySizeAssetsFoundError:bm,BrandUserIdNotSetError:Am,NoFramesFoundError:Cm,RecommendedAvailableSizesError:km,NoStylesFoundError:Nm,AvatarNotCreated:Rm});class Dm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Tm(e),this.auth.setPersistence(fg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}async onInit(t){this.auth.onAuthStateChanged((e=>{this.setUser(e),e&&(this.logUserLogin(t,e),this.setBrandUserId(e.uid))})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),this.setBrandUserId(null==e?void 0:e.uid),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,s,i,o;try{const a=xl(this.firestore,"user_logging",e.uid),c=await Ld(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(l&&ff(u).diff(ff(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[t])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[t]:{brand_id:t,last_login:u,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:u,updated_at:u};await xd(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 Im;return await this.user.getIdToken()}get userId(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return this.user.uid}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return(await Ld(xl(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=_d(Ml(this.firestore,"users"),Ed(Ql(),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}watchUserProfileForFrames(t){let e;const n=_d(Ml(this.firestore,"users"),Ed(Ql(),"==",this.id));return new Promise((r=>{e=Ud(n,(async n=>{await t(n)&&(e(),r(n.docs[0].data()))}))}))}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await ug(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await ag(this.auth,t)}async confirmPasswordReset(t,e){await cg(this.auth,t,e)}}class Lm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Ud(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Ft(Vd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Lt("object"==typeof t?t:Vt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=ie("firestore");t&&Ol(r,...t)}return r}(t),this.user=new Dm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=_d(Ml(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Md(_d(Ml(this.firestore,t),...e))}async getDoc(t,e){const n=xl(this.firestore,t,e),r=await Ld(n);return r.exists()?r.data():null}}const Pm=t=>{if(t.code===Tf)throw new Error("account has been disabled");throw new Error(t.message)};class Mm{static get endpoint(){return Vd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,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})}}const xm=t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))};class Um{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 Im;try{const r=await Mm.Get(this.user,`/styles/${t}/recommendation`),s=await r.json();return(null===(e=null==s?void 0:s.fits)||void 0===e?void 0:e.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(t){if((null==t?void 0:t.error)===Rm)throw new Sm;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 bm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new bm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){console.log({sku:t});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 s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.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 s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.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=[Ed("brand_id","==",this.brandId)];r.push(Ed("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 Pm(t)}}async getColorwaySizeAssets(t,e){const n=[Ed("brand_id","==",this.brandId)];t&&n.push(Ed("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(Ed("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 Pm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Pm(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 tryOn(t,e){if(!this.isLoggedIn)throw new Im;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e);try{return await this.getColorwaySizeAssetFrames(n)}catch(t){if(!(t instanceof Cm))throw t;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e){var n,r,s;try{const i=[Ed("brand_id","==",this.brandId)];i.push(Ed("style_id","==",t)),i.push(Ed("size_id","==",e));return null===(s=null===(r=null===(n=(await this.firebase.getDocs("colorway_size_assets",i)).docs)||void 0===n?void 0:n[0])||void 0===r?void 0:r.data())||void 0===s?void 0:s.sku}catch(t){return Pm(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Pm(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 Pm(t)}}async requestThenGetColorwaySizeAssetFrames(t){const[e,n]=await(r=this.getColorwaySizeAssetFromSku(t),r.then((t=>[null,t])).catch((t=>[t])));var r;if(e)throw e;try{try{this.requestColorwaySizeAssetFrames(n.id)}catch(t){}return this.awaitColorwaySizeAssetFrames(t)}catch(e){if((null==e?void 0:e.error)===Rm)throw new Sm;throw new Nm}}async awaitColorwaySizeAssetFrames(t){var e,n,r,s;if(!this.isLoggedIn)throw new Im;const i=await this.user.watchUserProfileForFrames((async e=>{var n,r,s,i;const o=null===(i=null===(s=null===(r=null===(n=e.docs[0].data())||void 0===n?void 0:n.vto)||void 0===r?void 0:r[this.brandId])||void 0===s?void 0:s[t])||void 0===i?void 0:i.frames;return!!(null==o?void 0:o.length)&&xm(o[0])}));if(!(null===(s=null===(r=null===(n=null===(e=null==i?void 0:i.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||void 0===s?void 0:s.length))throw new Cm;return i.vto[this.brandId][t].frames}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Im;if(!this.user.brandUserId)throw new Am;await Mm.Post(this.user,`/colorway-size-assets/${t}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(t){var e,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(e=null==s?void 0:s.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Cm;if(!await xm(i[0]))throw new Cm;return i}}const Fm=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Vd.getInstance().setEnv(e),new Um(t,new Lm));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 Bm={[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 Hm;!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"}(Hm||(Hm={}));const jm={[Hm.BLOUSES]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.COATS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.DRESSES]:[Vm.LOW_HIP,Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST],[Hm.JACKETS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.PANTS]:[Vm.LOW_HIP,Vm.WAIST,Vm.THIGH,Vm.INSEAM],[Hm.PUFFERS_AND_PARKAS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.SHORTS]:[Vm.LOW_HIP,Vm.WAIST,Vm.THIGH,Vm.INSEAM],[Hm.SKIRTS]:[Vm.LOW_HIP,Vm.WAIST],[Hm.SWEATERS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.T_SHIRTS_AND_TANKS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP]},$m={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"},qm={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"},Km={activewear:{leggings:Hm.PANTS,joggers:Hm.PANTS,sweatshirts:Hm.SWEATERS},dresses:{a_line:Hm.DRESSES,bodycon:Hm.DRESSES,fit_and_flare:Hm.DRESSES,knit:Hm.DRESSES,shirt:Hm.DRESSES,slip:Hm.DRESSES,straight:Hm.DRESSES,wrap:Hm.DRESSES},jackets_and_coats:{denim_jackets:Hm.JACKETS,parkas:Hm.PUFFERS_AND_PARKAS,peacoats:Hm.COATS,puffer_jackets:Hm.PUFFERS_AND_PARKAS,raincoats:Hm.COATS,rompers:Hm.COATS,shackets:Hm.JACKETS,trench_coats:Hm.COATS},jeans:{bootcut:Hm.PANTS,flared:Hm.PANTS,mom:Hm.PANTS,relaxed:Hm.PANTS,skinny:Hm.PANTS,slim:Hm.PANTS,straight:Hm.PANTS,tapered:Hm.PANTS,wide_leg:Hm.PANTS},jumpsuits_and_rompers:{boiler_suits:Hm.DRESSES,denim:Hm.DRESSES,jumpsuits:Hm.DRESSES,overalls:Hm.DRESSES,rompers:Hm.DRESSES,unitards:Hm.DRESSES},pants_and_shorts:{cigarette:Hm.PANTS,culottes:Hm.SHORTS,denim_shorts:Hm.SHORTS,flared:Hm.PANTS,joggers:Hm.PANTS,leggings:Hm.PANTS,skinny:Hm.PANTS,wide_leg:Hm.PANTS},skirts:{a_line_flared:Hm.SKIRTS,denim:Hm.SKIRTS,knit:Hm.SKIRTS,pencil:Hm.SKIRTS,pleated:Hm.SKIRTS,skater:Hm.SKIRTS,slip:Hm.SKIRTS,wrap:Hm.SKIRTS},suits_and_tailoring:{blazers:Hm.JACKETS,suit_jackets:Hm.JACKETS,suit_skirts:Hm.SKIRTS,suit_trousers:Hm.PANTS,suit_vests:Hm.SWEATERS,trousers:Hm.PANTS},sweaters:{cardigans:Hm.SWEATERS,crewnecks:Hm.SWEATERS,hoodies_and_zipups:Hm.SWEATERS,sweatshirts:Hm.SWEATERS,turtlenecks:Hm.SWEATERS,v_necks:Hm.SWEATERS},tops:{bodysuits:Hm.BLOUSES,corsets_and_bustiers:Hm.BLOUSES,polos:Hm.T_SHIRTS_AND_TANKS,shirts_and_blouses:Hm.BLOUSES,t_shirts:Hm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Hm.T_SHIRTS_AND_TANKS}};var Wm;!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"}(Wm||(Wm={}));const zm={[Wm.TOO_TIGHT]:"Too Tight",[Wm.TIGHT]:"Tight",[Wm.SLIGHTLY_TIGHT]:"Slightly Tight",[Wm.PERFECT_FIT]:"Perfect Fit",[Wm.SLIGHTLY_LOOSE]:"Slightly Loose",[Wm.LOOSE]:"Loose",[Wm.OVERSIZED]:"Oversized",[Wm.TOO_SHORT]:"Too Short",[Wm.SHORT]:"Short",[Wm.SLIGHTLY_SHORT]:"Slightly Short",[Wm.SLIGHTLY_LONG]:"Slightly Long",[Wm.LONG]:"Long",[Wm.TOO_LONG]:"Too Long"};var Gm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Gm||(Gm={}));var Qm=Object.freeze({__proto__:null,get AvatarState(){return Gm},get MeasurementLocation(){return Vm},MeasurementLocationName:Bm,get Classification(){return Hm},ClassificationLocations:jm,CategoryNames:$m,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:qm,Taxonomy:Km,get Fit(){return Wm},FitNames:zm});export{Om as Errors,Fm as initShop,t as requests,e as responses,Qm as types};
3310
3310
  //# sourceMappingURL=index.min.js.map