@thefittingroom/shop-ui 2.0.2 → 3.0.0-alpha-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.
- package/dist/esm/components/SizeRec.d.ts +6 -1
- package/dist/esm/index.js +167 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +83 -84
- package/dist/esm/tfr-size-rec.d.ts +4 -1
- package/dist/esm/tfr.d.ts +1 -0
- package/package.json +2 -2
package/dist/esm/index.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom
|
|
2
|
+
* thefittingroom v3.0.0-alpha-0 (2025-01-17T19:58:29.656Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
function t(e,n){let i=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var r=new Image;r.onload=i,r.onerror=i,r.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const i=document.getElementById(t);if(!i)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 r=(null==t?void 0:t.length)-2;i.value=r.toString(),i.max=(t.length-1).toString();const s=()=>{const e=parseInt(i.value);n(i,t[e])};return n(i,t[r]),i.removeEventListener("input",s),i.addEventListener("input",s),()=>{i.removeEventListener("input",s)}}}},i=function(t){const e=[];let n=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296==(64512&r)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++i)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e},r={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_,i=[];for(let e=0;e<t.length;e+=3){const r=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=r>>2,u=(3&r)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),i.push(n[l],n[u],n[h],n[d])}return i.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(i(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,i=0;for(;n<t.length;){const r=t[n++];if(r<128)e[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=t[n++];e[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[i++]=String.fromCharCode(55296+(s>>10)),e[i++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[i++]=String.fromCharCode((15&r)<<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_,i=[];for(let e=0;e<t.length;){const r=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==r||null==o||null==a||null==c)throw new s;const l=r<<2|o>>4;if(i.push(l),64!==a){const t=o<<4&240|a>>2;if(i.push(t),64!==c){const t=a<<6&192|c;i.push(t)}}}return i},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)}}};
|
|
6
6
|
/*!
|
|
7
|
-
* thefittingroom
|
|
7
|
+
* thefittingroom v2.0.0-alpha-0 (2025-01-17T19:54:05.370Z)
|
|
8
8
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
@@ -1923,7 +1923,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1923
1923
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1924
1924
|
* See the License for the specific language governing permissions and
|
|
1925
1925
|
* limitations under the License.
|
|
1926
|
-
*/class Qh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Ms(Ps.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new eo(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
|
|
1926
|
+
*/class Qh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Ms(Ps.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new eo(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}function Yh(){return new Qh("__name__")}
|
|
1927
1927
|
/**
|
|
1928
1928
|
* @license
|
|
1929
1929
|
* Copyright 2020 Google LLC
|
|
@@ -1939,8 +1939,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1939
1939
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1940
1940
|
* See the License for the specific language governing permissions and
|
|
1941
1941
|
* limitations under the License.
|
|
1942
|
-
*/
|
|
1943
|
-
class Yh{constructor(t){this._methodName=t}}
|
|
1942
|
+
*/class Jh{constructor(t){this._methodName=t}}
|
|
1944
1943
|
/**
|
|
1945
1944
|
* @license
|
|
1946
1945
|
* Copyright 2017 Google LLC
|
|
@@ -1956,7 +1955,7 @@ class Yh{constructor(t){this._methodName=t}}
|
|
|
1956
1955
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1957
1956
|
* See the License for the specific language governing permissions and
|
|
1958
1957
|
* limitations under the License.
|
|
1959
|
-
*/class
|
|
1958
|
+
*/class Xh{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Ms(Ps.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Ms(Ps.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return Gs(this._lat,t._lat)||Gs(this._long,t._long)}}
|
|
1960
1959
|
/**
|
|
1961
1960
|
* @license
|
|
1962
1961
|
* Copyright 2017 Google LLC
|
|
@@ -1972,7 +1971,7 @@ class Yh{constructor(t){this._methodName=t}}
|
|
|
1972
1971
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1973
1972
|
* See the License for the specific language governing permissions and
|
|
1974
1973
|
* limitations under the License.
|
|
1975
|
-
*/const
|
|
1974
|
+
*/const Zh=/^__.*__$/;class td{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new hc(t,this.data,this.fieldMask,e,this.fieldTransforms):new uc(t,this.data,e,this.fieldTransforms)}}function ed(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw xs()}}class nd{constructor(t,e,n,i,r,s){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=i,void 0===r&&this.na(),this.fieldTransforms=r||[],this.fieldMask=s||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new nd(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),i=this.ia({path:n,oa:!1});return i.ua(t),i}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),i=this.ia({path:n,oa:!1});return i.na(),i}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return fd(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(ed(this.sa)&&Zh.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class id{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||ru(t)}da(t,e,n,i=!1){return new nd({sa:t,methodName:e,fa:n,path:eo.emptyPath(),oa:!1,la:i},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function rd(t){const e=t._freezeSettings(),n=ru(t._databaseId);return new id(t._databaseId,!!e.ignoreUndefinedProperties,n)}function sd(t,e,n,i,r,s={}){const o=t.da(s.merge||s.mergeFields?2:0,e,n,r);ld("Data must be an object, but it was:",o,i);const a=ad(i,o);let c,l;if(s.merge)c=new ga(o.fieldMask),l=o.fieldTransforms;else if(s.mergeFields){const t=[];for(const i of s.mergeFields){const r=ud(e,i,n);if(!o.contains(r))throw new Ms(Ps.INVALID_ARGUMENT,`Field '${r}' is specified in your field mask but missing from your input data.`);pd(t,r)||t.push(r)}c=new ga(t),l=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,l=o.fieldTransforms;return new td(new ma(a),c,l)}function od(t,e){if(cd(t=ue(t)))return ld("Unsupported field value:",e,t),ad(t,e);if(t instanceof Jh)return function(t,e){if(!ed(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let i=0;for(const r of t){let t=od(r,e.aa(i));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),i++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=ue(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ha(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Ys.fromDate(t);return{timestampValue:Gc(e.yt,n)}}if(t instanceof Ys){const n=new Ys(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Gc(e.yt,n)}}if(t instanceof Xh)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Gh)return{bytesValue:Qc(e.yt,t._byteString)};if(t instanceof Oh){const n=e.databaseId,i=t.firestore._databaseId;if(!i.isEqual(n))throw e.ha(`Document reference is for database ${i.projectId}/${i.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Xc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Ch(t)}`)}(t,e)}function ad(t,e){const n={};return yo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):mo(t,((t,i)=>{const r=od(i,e.ra(t));null!=r&&(n[t]=r)})),{mapValue:{fields:n}}}function cd(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ys||t instanceof Xh||t instanceof Gh||t instanceof Oh||t instanceof Jh)}function ld(t,e,n){if(!cd(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const i=Ch(n);throw"an object"===i?e.ha(t+" a custom object"):e.ha(t+" "+i)}}function ud(t,e,n){if((e=ue(e))instanceof Qh)return e._internalPath;if("string"==typeof e)return dd(t,e);throw fd("Field path arguments must be of type string or ",t,!1,void 0,n)}const hd=new RegExp("[~\\*/\\[\\]]");function dd(t,e,n){if(e.search(hd)>=0)throw fd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Qh(...e.split("."))._internalPath}catch(i){throw fd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function fd(t,e,n,i,r){const s=i&&!i.isEmpty(),o=void 0!==r;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${i}`),o&&(c+=` in document ${r}`),c+=")"),new Ms(Ps.INVALID_ARGUMENT,a+t+c)}function pd(t,e){return t.some((t=>t.isEqual(e)))}
|
|
1976
1975
|
/**
|
|
1977
1976
|
* @license
|
|
1978
1977
|
* Copyright 2020 Google LLC
|
|
@@ -1988,7 +1987,7 @@ class Yh{constructor(t){this._methodName=t}}
|
|
|
1988
1987
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1989
1988
|
* See the License for the specific language governing permissions and
|
|
1990
1989
|
* limitations under the License.
|
|
1991
|
-
*/class
|
|
1990
|
+
*/class gd{constructor(t,e,n,i,r){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=i,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new Oh(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new md(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(yd("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class md extends gd{data(){return super.data()}}function yd(t,e){return"string"==typeof e?dd(t,e):e instanceof Qh?e._internalPath:e._delegate._internalPath}
|
|
1992
1991
|
/**
|
|
1993
1992
|
* @license
|
|
1994
1993
|
* Copyright 2020 Google LLC
|
|
@@ -2004,7 +2003,7 @@ class Yh{constructor(t){this._methodName=t}}
|
|
|
2004
2003
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2005
2004
|
* See the License for the specific language governing permissions and
|
|
2006
2005
|
* limitations under the License.
|
|
2007
|
-
*/function
|
|
2006
|
+
*/function vd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Ms(Ps.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class wd{}class bd extends wd{}function Sd(t,e,...n){let i=[];e instanceof wd&&i.push(e),i=i.concat(n),function(t){const e=t.filter((t=>t instanceof Td)).length,n=t.filter((t=>t instanceof Ed)).length;if(e>1||e>0&&n>0)throw new Ms(Ps.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
|
|
2008
2007
|
/**
|
|
2009
2008
|
* @license
|
|
2010
2009
|
* Copyright 2020 Google LLC
|
|
@@ -2020,7 +2019,7 @@ class Yh{constructor(t){this._methodName=t}}
|
|
|
2020
2019
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2021
2020
|
* See the License for the specific language governing permissions and
|
|
2022
2021
|
* limitations under the License.
|
|
2023
|
-
*/(i);for(const e of i)t=e._apply(t);return t}class
|
|
2022
|
+
*/(i);for(const e of i)t=e._apply(t);return t}class Ed extends bd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Ed(t,e,n)}_apply(t){const e=this._parse(t);return Cd(t._query,e),new Dh(t.firestore,t.converter,xa(t._query,e))}_parse(t){const e=rd(t.firestore),n=function(t,e,n,i,r,s,o){let a;if(r.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new Ms(Ps.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){kd(o,s);const e=[];for(const n of o)e.push(Id(i,t,n));a={arrayValue:{values:e}}}else a=Id(i,t,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||kd(o,s),a=function(t,e,n,i=!1){return od(n,t.da(i?4:3,e))}(n,"where",o,"in"===s||"not-in"===s);return Wo.create(r,s,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function _d(t,e,n){const i=e,r=yd("where",t);return Ed._create(r,i,n)}class Td extends wd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Td(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Go.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const i=e.getFlattenedFilters();for(const t of i)Cd(n,t),n=xa(n,t)}(t._query,e),new Dh(t.firestore,t.converter,xa(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Id(t,e,n){if("string"==typeof(n=ue(n))){if(""===n)throw new Ms(Ps.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Ra(e)&&-1!==n.indexOf("/"))throw new Ms(Ps.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const i=e.path.child(Zs.fromString(n));if(!no.isDocumentKey(i))throw new Ms(Ps.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${i}' is not because it has an odd number of segments (${i.length}).`);return Mo(t,new no(i))}if(n instanceof Oh)return Mo(t,n._key);throw new Ms(Ps.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ch(n)}.`)}function kd(t,e){if(!Array.isArray(t)||0===t.length)throw new Ms(Ps.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Ms(Ps.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Cd(t,e){if(e.isInequality()){const n=Aa(t),i=e.field;if(null!==n&&!n.isEqual(i))throw new Ms(Ps.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${i.toString()}'`);const r=Ca(t);null!==r&&function(t,e,n){if(!n.isEqual(e))throw new Ms(Ps.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,i,r)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Ms(Ps.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Ms(Ps.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Ad{convertValue(t,e="none"){switch(Ro(t)){case 0:return null;case 1:return t.booleanValue;case 2:return _o(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(To(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw xs()}}convertObject(t,e){const n={};return mo(t.fields,((t,i)=>{n[t]=this.convertValue(i,e)})),n}convertGeoPoint(t){return new Xh(_o(t.latitude),_o(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=ko(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Co(t));default:return null}}convertTimestamp(t){const e=Eo(t);return new Ys(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Zs.fromString(t);Os(yl(n));const i=new po(n.get(1),n.get(3)),r=new no(n.popFirst(5));return i.isEqual(e)||Rs(`Document ${r} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),r}}
|
|
2024
2023
|
/**
|
|
2025
2024
|
* @license
|
|
2026
2025
|
* Copyright 2020 Google LLC
|
|
@@ -2053,7 +2052,7 @@ class Yh{constructor(t){this._methodName=t}}
|
|
|
2053
2052
|
* See the License for the specific language governing permissions and
|
|
2054
2053
|
* limitations under the License.
|
|
2055
2054
|
*/
|
|
2056
|
-
class
|
|
2055
|
+
class Rd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Ld extends gd{constructor(t,e,n,i,r,s){super(t,e,n,i,s),this._firestore=t,this._firestoreImpl=t,this.metadata=r}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Nd(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(yd("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Nd extends Ld{data(t={}){return super.data(t)}}class xd{constructor(t,e,n,i){this._firestore=t,this._userDataWriter=e,this._snapshot=i,this.metadata=new Rd(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Nd(this._firestore,this._userDataWriter,n.key,n,new Rd(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Ms(Ps.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const i=new Nd(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Rd(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const i=new Nd(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Rd(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let r=-1,s=-1;return 0!==e.type&&(r=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),s=n.indexOf(e.doc.key)),{type:Od(e.type),doc:i,oldIndex:r,newIndex:s}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Od(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return xs()}}
|
|
2057
2056
|
/**
|
|
2058
2057
|
* @license
|
|
2059
2058
|
* Copyright 2020 Google LLC
|
|
@@ -2069,7 +2068,7 @@ class Ad{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
|
|
|
2069
2068
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2070
2069
|
* See the License for the specific language governing permissions and
|
|
2071
2070
|
* limitations under the License.
|
|
2072
|
-
*/function
|
|
2071
|
+
*/function Dd(t){t=Ah(t,Oh);const e=Ah(t.firestore,$h);return function(t,e,n={}){const i=new Fs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,i,r){const s=new Uh({next:s=>{e.enqueueAndForget((()=>Wu(t,o)));const a=s.docs.has(n);!a&&s.fromCache?r.reject(new Ms(Ps.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&i&&"server"===i.source?r.reject(new Ms(Ps.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):r.resolve(s)},error:t=>r.reject(t)}),o=new Ju(Ia(n.path),s,{includeMetadataChanges:!0,Nu:!0});return Ku(t,o)}(await Hh(t),t.asyncQueue,e,n,i))),i.promise}(Kh(e),t._key).then((n=>zd(e,t,n)))}class Pd extends Ad{constructor(t){super(),this.firestore=t}convertBytes(t){return new Gh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Oh(this.firestore,null,e)}}function Md(t){t=Ah(t,Dh);const e=Ah(t.firestore,$h),n=Kh(e),i=new Pd(e);return vd(t._query),function(t,e,n={}){const i=new Fs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,i,r){const s=new Uh({next:n=>{e.enqueueAndForget((()=>Wu(t,o))),n.fromCache&&"server"===i.source?r.reject(new Ms(Ps.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):r.resolve(n)},error:t=>r.reject(t)}),o=new Ju(n,s,{includeMetadataChanges:!0,Nu:!0});return Ku(t,o)}(await Hh(t),t.asyncQueue,e,n,i))),i.promise}(n,t._query).then((n=>new xd(e,i,t,n)))}function Fd(t,e,n){t=Ah(t,Oh);const i=Ah(t.firestore,$h),r=function(t,e,n){let i;return i=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,i}(t.converter,e,n);return function(t,e){return function(t,e){const n=new Fs;return t.asyncQueue.enqueueAndForget((async()=>oh(await function(t){return Vh(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(Kh(t),e)}(i,[sd(rd(i),"setDoc",t._key,r,null!==t.converter,n).toMutation(t._key,nc.none())])}function Ud(t,...e){var n,i,r;t=ue(t);let s={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||qh(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges};if(qh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(i=t.error)||void 0===i?void 0:i.bind(t),e[o+2]=null===(r=t.complete)||void 0===r?void 0:r.bind(t)}let c,l,u;if(t instanceof Oh)l=Ah(t.firestore,$h),u=Ia(t._key.path),c={next:n=>{e[o]&&e[o](zd(l,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Ah(t,Dh);l=Ah(n.firestore,$h),u=n._query;const i=new Pd(l);c={next:t=>{e[o]&&e[o](new xd(l,i,n,t))},error:e[o+1],complete:e[o+2]},vd(t._query)}return function(t,e,n,i){const r=new Uh(i),s=new Ju(e,r,n);return t.asyncQueue.enqueueAndForget((async()=>Ku(await Hh(t),s))),()=>{r.bc(),t.asyncQueue.enqueueAndForget((async()=>Wu(await Hh(t),s)))}}(Kh(l),u,a,c)}function zd(t,e,n){const i=n.docs.get(e._key),r=new Pd(t);return new Ld(t,r,e._key,i,new Rd(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Is=Ut,Ot(new he("firestore",((t,{instanceIdentifier:n,options:i})=>{const r=t.getProvider("app").getImmediate(),s=new $h(new Vs(t.getProvider("auth-internal")),new $s(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Ms(Ps.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new po(t.options.projectId,e)}(r,n),r);return i=Object.assign({useFetchStreams:e},i),s._setSettings(i),s}),"PUBLIC").setMultipleInstances(!0)),Vt(_s,"3.8.0",t),Vt(_s,"3.8.0","esm2017")}();
|
|
2073
2072
|
/**
|
|
2074
2073
|
* @license
|
|
2075
2074
|
* Copyright 2020 Google LLC
|
|
@@ -2086,7 +2085,7 @@ class Ad{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
|
|
|
2086
2085
|
* See the License for the specific language governing permissions and
|
|
2087
2086
|
* limitations under the License.
|
|
2088
2087
|
*/
|
|
2089
|
-
Vt("firebase","10.13.0","app");class
|
|
2088
|
+
Vt("firebase","10.13.0","app");class Bd{constructor(){}static getInstance(){return Bd.instance||(Bd.instance=new Bd),Bd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Hd.firebase:Vd.firebase}get api(){return"prod"===this.env?Hd.api:Vd.api}get config(){return"prod"===this.env?Hd.config:Vd.config}}const Vd={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Hd={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var jd=1e3,qd=6e4,$d=36e5,Kd="millisecond",Wd="second",Gd="minute",Qd="hour",Yd="day",Jd="week",Xd="month",Zd="quarter",tf="year",ef="date",nf="Invalid Date",rf=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,sf=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,of={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},af=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},cf={s:af,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),r=n%60;return(e<=0?"+":"-")+af(i,2,"0")+":"+af(r,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var i=12*(n.year()-e.year())+(n.month()-e.month()),r=e.clone().add(i,Xd),s=n-r<0,o=e.clone().add(i+(s?-1:1),Xd);return+(-(i+(n-r)/(s?r-o:o-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Xd,y:tf,w:Jd,d:Yd,D:ef,h:Qd,m:Gd,s:Wd,ms:Kd,Q:Zd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},lf="en",uf={};uf[lf]=of;var hf="$isDayjsObject",df=function(t){return t instanceof mf||!(!t||!t[hf])},ff=function t(e,n,i){var r;if(!e)return lf;if("string"==typeof e){var s=e.toLowerCase();uf[s]&&(r=s),n&&(uf[s]=n,r=s);var o=e.split("-");if(!r&&o.length>1)return t(o[0])}else{var a=e.name;uf[a]=e,r=a}return!i&&r&&(lf=r),r||!i&&lf},pf=function(t,e){if(df(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new mf(n)},gf=cf;gf.l=ff,gf.i=df,gf.w=function(t,e){return pf(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var mf=function(){function t(t){this.$L=ff(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[hf]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(gf.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(rf);if(i){var r=i[2]-1||0,s=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return gf},e.isValid=function(){return!(this.$d.toString()===nf)},e.isSame=function(t,e){var n=pf(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return pf(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<pf(t)},e.$g=function(t,e,n){return gf.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,i=!!gf.u(e)||e,r=gf.p(t),s=function(t,e){var r=gf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return i?r:r.endOf(Yd)},o=function(t,e){return gf.w(n.toDate()[t].apply(n.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,l=this.$D,u="set"+(this.$u?"UTC":"");switch(r){case tf:return i?s(1,0):s(31,11);case Xd:return i?s(1,c):s(0,c+1);case Jd:var h=this.$locale().weekStart||0,d=(a<h?a+7:a)-h;return s(i?l-d:l+(6-d),c);case Yd:case ef:return o(u+"Hours",0);case Qd:return o(u+"Minutes",1);case Gd:return o(u+"Seconds",2);case Wd:return o(u+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,i=gf.p(t),r="set"+(this.$u?"UTC":""),s=(n={},n[Yd]=r+"Date",n[ef]=r+"Date",n[Xd]=r+"Month",n[tf]=r+"FullYear",n[Qd]=r+"Hours",n[Gd]=r+"Minutes",n[Wd]=r+"Seconds",n[Kd]=r+"Milliseconds",n)[i],o=i===Yd?this.$D+(e-this.$W):e;if(i===Xd||i===tf){var a=this.clone().set(ef,1);a.$d[s](o),a.init(),this.$d=a.set(ef,Math.min(this.$D,a.daysInMonth())).$d}else s&&this.$d[s](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[gf.p(t)]()},e.add=function(t,e){var n,i=this;t=Number(t);var r=gf.p(e),s=function(e){var n=pf(i);return gf.w(n.date(n.date()+Math.round(e*t)),i)};if(r===Xd)return this.set(Xd,this.$M+t);if(r===tf)return this.set(tf,this.$y+t);if(r===Yd)return s(1);if(r===Jd)return s(7);var o=(n={},n[Gd]=qd,n[Qd]=$d,n[Wd]=jd,n)[r]||1,a=this.$d.getTime()+t*o;return gf.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||nf;var i=t||"YYYY-MM-DDTHH:mm:ssZ",r=gf.z(this),s=this.$H,o=this.$m,a=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,h=function(t,n,r,s){return t&&(t[n]||t(e,i))||r[n].slice(0,s)},d=function(t){return gf.s(s%12||12,t,"0")},f=u||function(t,e,n){var i=t<12?"AM":"PM";return n?i.toLowerCase():i};return i.replace(sf,(function(t,i){return i||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return gf.s(e.$y,4,"0");case"M":return a+1;case"MM":return gf.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return e.$D;case"DD":return gf.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,c,2);case"ddd":return h(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(s);case"HH":return gf.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(s,o,!0);case"A":return f(s,o,!1);case"m":return String(o);case"mm":return gf.s(o,2,"0");case"s":return String(e.$s);case"ss":return gf.s(e.$s,2,"0");case"SSS":return gf.s(e.$ms,3,"0");case"Z":return r}return null}(t)||r.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var i,r=this,s=gf.p(e),o=pf(t),a=(o.utcOffset()-this.utcOffset())*qd,c=this-o,l=function(){return gf.m(r,o)};switch(s){case tf:i=l()/12;break;case Xd:i=l();break;case Zd:i=l()/3;break;case Jd:i=(c-a)/6048e5;break;case Yd:i=(c-a)/864e5;break;case Qd:i=c/$d;break;case Gd:i=c/qd;break;case Wd:i=c/jd;break;default:i=c}return n?i:gf.a(i)},e.daysInMonth=function(){return this.endOf(Xd).$D},e.$locale=function(){return uf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),i=ff(t,e,!0);return i&&(n.$L=i),n},e.clone=function(){return gf.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),yf=mf.prototype;function vf(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}function wf(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}pf.prototype=yf,[["$ms",Kd],["$s",Wd],["$m",Gd],["$H",Qd],["$W",Yd],["$M",Xd],["$y",tf],["$D",ef]].forEach((function(t){yf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),pf.extend=function(t,e){return t.$i||(t(e,mf,pf),t.$i=!0),pf},pf.locale=ff,pf.isDayjs=df,pf.unix=function(t){return pf(1e3*t)},pf.en=uf[lf],pf.Ls=uf,pf.p={},"function"==typeof SuppressedError&&SuppressedError;const bf=wf,Sf=new g("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),Ef="auth/user-disabled",_f=new D("@firebase/auth");function Tf(t,...e){_f.logLevel<=R.ERROR&&_f.error(`Auth (${Ut}): ${t}`,...e)}
|
|
2090
2089
|
/**
|
|
2091
2090
|
* @license
|
|
2092
2091
|
* Copyright 2020 Google LLC
|
|
@@ -2102,7 +2101,7 @@ Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){retu
|
|
|
2102
2101
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2103
2102
|
* See the License for the specific language governing permissions and
|
|
2104
2103
|
* limitations under the License.
|
|
2105
|
-
*/function
|
|
2104
|
+
*/function If(t,...e){throw Rf(t,...e)}function kf(t,...e){return Rf(t,...e)}function Cf(t,e,n){const i=Object.assign(Object.assign({},bf()),{[e]:n});return new g("auth","Firebase",i).create(e,{appName:t.name})}function Af(t){return Cf(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Rf(t,...e){if("string"!=typeof t){const n=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=t.name),t._errorFactory.create(n,...i)}return Sf.create(t,...e)}function Lf(t,e,...n){if(!t)throw Rf(e,...n)}function Nf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Tf(e),new Error(e)}function xf(t,e){t||Nf(e)}
|
|
2106
2105
|
/**
|
|
2107
2106
|
* @license
|
|
2108
2107
|
* Copyright 2020 Google LLC
|
|
@@ -2118,7 +2117,7 @@ Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){retu
|
|
|
2118
2117
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2119
2118
|
* See the License for the specific language governing permissions and
|
|
2120
2119
|
* limitations under the License.
|
|
2121
|
-
*/function
|
|
2120
|
+
*/function Of(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Df(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
|
|
2122
2121
|
/**
|
|
2123
2122
|
* @license
|
|
2124
2123
|
* Copyright 2020 Google LLC
|
|
@@ -2134,7 +2133,7 @@ Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){retu
|
|
|
2134
2133
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2135
2134
|
* See the License for the specific language governing permissions and
|
|
2136
2135
|
* limitations under the License.
|
|
2137
|
-
*/function
|
|
2136
|
+
*/function Pf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Df()&&"https:"!==Df()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
|
|
2138
2137
|
/**
|
|
2139
2138
|
* @license
|
|
2140
2139
|
* Copyright 2020 Google LLC
|
|
@@ -2151,7 +2150,7 @@ Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){retu
|
|
|
2151
2150
|
* See the License for the specific language governing permissions and
|
|
2152
2151
|
* limitations under the License.
|
|
2153
2152
|
*/
|
|
2154
|
-
class
|
|
2153
|
+
class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(f())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Pf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
|
|
2155
2154
|
/**
|
|
2156
2155
|
* @license
|
|
2157
2156
|
* Copyright 2020 Google LLC
|
|
@@ -2167,7 +2166,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2167
2166
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2168
2167
|
* See the License for the specific language governing permissions and
|
|
2169
2168
|
* limitations under the License.
|
|
2170
|
-
*/function
|
|
2169
|
+
*/function Ff(t,e){xf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
|
|
2171
2170
|
/**
|
|
2172
2171
|
* @license
|
|
2173
2172
|
* Copyright 2020 Google LLC
|
|
@@ -2183,7 +2182,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2183
2182
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2184
2183
|
* See the License for the specific language governing permissions and
|
|
2185
2184
|
* limitations under the License.
|
|
2186
|
-
*/class
|
|
2185
|
+
*/class Uf{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Nf("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Nf("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Nf("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
|
|
2187
2186
|
/**
|
|
2188
2187
|
* @license
|
|
2189
2188
|
* Copyright 2020 Google LLC
|
|
@@ -2199,7 +2198,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2199
2198
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2200
2199
|
* See the License for the specific language governing permissions and
|
|
2201
2200
|
* limitations under the License.
|
|
2202
|
-
*/const
|
|
2201
|
+
*/const zf={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Bf=new Mf(3e4,6e4);
|
|
2203
2202
|
/**
|
|
2204
2203
|
* @license
|
|
2205
2204
|
* Copyright 2020 Google LLC
|
|
@@ -2215,7 +2214,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2215
2214
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2216
2215
|
* See the License for the specific language governing permissions and
|
|
2217
2216
|
* limitations under the License.
|
|
2218
|
-
*/function
|
|
2217
|
+
*/function Vf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Hf(t,e,n,i,r={}){return jf(t,r,(async()=>{let r={},s={};i&&("GET"===e?s=i:r={body:JSON.stringify(i)});const o=w(Object.assign({key:t.config.apiKey},s)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Uf.fetch()($f(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},r))}))}async function jf(t,e,n){t._canInitEmulator=!1;const i=Object.assign(Object.assign({},zf),e);try{const e=new Wf(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await r.json();if("needConfirmation"in s)throw Gf(t,"account-exists-with-different-credential",s);if(r.ok&&!("errorMessage"in s))return s;{const e=r.ok?s.errorMessage:s.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Gf(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Gf(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Gf(t,"user-disabled",s);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Cf(t,a,o);If(t,a)}}catch(e){if(e instanceof p)throw e;If(t,"network-request-failed",{message:String(e)})}}async function qf(t,e,n,i,r={}){const s=await Hf(t,e,n,i,r);return"mfaPendingCredential"in s&&If(t,"multi-factor-auth-required",{_serverResponse:s}),s}function $f(t,e,n,i){const r=`${e}${n}?${i}`;return t.config.emulator?Ff(t.config,r):`${t.config.apiScheme}://${r}`}function Kf(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Wf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(kf(this.auth,"network-request-failed"))),Bf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Gf(t,e,n){const i={appName:t.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const r=kf(t,e,i);return r.customData._tokenResponse=n,r}function Qf(t){return void 0!==t&&void 0!==t.enterprise}class Yf{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return Kf(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Jf(t,e){return Hf(t,"POST","/v1/accounts:lookup",e)}
|
|
2219
2218
|
/**
|
|
2220
2219
|
* @license
|
|
2221
2220
|
* Copyright 2020 Google LLC
|
|
@@ -2231,7 +2230,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2231
2230
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2232
2231
|
* See the License for the specific language governing permissions and
|
|
2233
2232
|
* limitations under the License.
|
|
2234
|
-
*/function
|
|
2233
|
+
*/function Xf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Zf(t){return 1e3*Number(t)}function tp(t){const[e,n,i]=t.split(".");if(void 0===e||void 0===n||void 0===i)return Tf("JWT malformed, contained fewer than 3 sections"),null;try{const t=a(n);return t?JSON.parse(t):(Tf("Failed to decode base64 JWT payload"),null)}catch(t){return Tf("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function ep(t){const e=tp(t);return Lf(e,"internal-error"),Lf(void 0!==e.exp,"internal-error"),Lf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
|
|
2235
2234
|
/**
|
|
2236
2235
|
* @license
|
|
2237
2236
|
* Copyright 2020 Google LLC
|
|
@@ -2247,7 +2246,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2247
2246
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2248
2247
|
* See the License for the specific language governing permissions and
|
|
2249
2248
|
* limitations under the License.
|
|
2250
|
-
*/async function
|
|
2249
|
+
*/async function np(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof p&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
|
|
2251
2250
|
/**
|
|
2252
2251
|
* @license
|
|
2253
2252
|
* Copyright 2020 Google LLC
|
|
@@ -2263,7 +2262,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2263
2262
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2264
2263
|
* See the License for the specific language governing permissions and
|
|
2265
2264
|
* limitations under the License.
|
|
2266
|
-
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class
|
|
2265
|
+
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class ip{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
|
|
2267
2266
|
/**
|
|
2268
2267
|
* @license
|
|
2269
2268
|
* Copyright 2020 Google LLC
|
|
@@ -2279,7 +2278,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2279
2278
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2280
2279
|
* See the License for the specific language governing permissions and
|
|
2281
2280
|
* limitations under the License.
|
|
2282
|
-
*/class
|
|
2281
|
+
*/class rp{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Xf(this.lastLoginAt),this.creationTime=Xf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
|
|
2283
2282
|
/**
|
|
2284
2283
|
* @license
|
|
2285
2284
|
* Copyright 2019 Google LLC
|
|
@@ -2295,7 +2294,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2295
2294
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2296
2295
|
* See the License for the specific language governing permissions and
|
|
2297
2296
|
* limitations under the License.
|
|
2298
|
-
*/async function
|
|
2297
|
+
*/async function sp(t){var e;const n=t.auth,i=await t.getIdToken(),r=await np(t,Jf(n,{idToken:i}));Lf(null==r?void 0:r.users.length,n,"internal-error");const s=r.users[0];t._notifyReloadListener(s);const o=(null===(e=s.providerUserInfo)||void 0===e?void 0:e.length)?op(s.providerUserInfo):[],a=function(t,e){const n=t.filter((t=>!e.some((e=>e.providerId===t.providerId))));return[...n,...e]}(t.providerData,o),c=t.isAnonymous,l=!(t.email&&s.passwordHash||(null==a?void 0:a.length)),u=!!c&&l,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new rp(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,h)}function op(t){return t.map((t=>{var{providerId:e}=t,n=vf(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}))}
|
|
2299
2298
|
/**
|
|
2300
2299
|
* @license
|
|
2301
2300
|
* Copyright 2020 Google LLC
|
|
@@ -2328,7 +2327,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay
|
|
|
2328
2327
|
* See the License for the specific language governing permissions and
|
|
2329
2328
|
* limitations under the License.
|
|
2330
2329
|
*/
|
|
2331
|
-
class
|
|
2330
|
+
class ap{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Lf(t.idToken,"internal-error"),Lf(void 0!==t.idToken,"internal-error"),Lf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):ep(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){Lf(0!==t.length,"internal-error");const e=ep(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(Lf(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:i,expiresIn:r}=await async function(t,e){const n=await jf(t,{},(async()=>{const n=w({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:r}=t.config,s=$f(t,i,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Uf.fetch()(s,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,i,Number(r))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:i,expirationTime:r}=e,s=new ap;return n&&(Lf("string"==typeof n,"internal-error",{appName:t}),s.refreshToken=n),i&&(Lf("string"==typeof i,"internal-error",{appName:t}),s.accessToken=i),r&&(Lf("number"==typeof r,"internal-error",{appName:t}),s.expirationTime=r),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new ap,this.toJSON())}_performRefresh(){return Nf("not implemented")}}
|
|
2332
2331
|
/**
|
|
2333
2332
|
* @license
|
|
2334
2333
|
* Copyright 2020 Google LLC
|
|
@@ -2344,7 +2343,7 @@ class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2344
2343
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2345
2344
|
* See the License for the specific language governing permissions and
|
|
2346
2345
|
* limitations under the License.
|
|
2347
|
-
*/function
|
|
2346
|
+
*/function cp(t,e){Lf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class lp{constructor(t){var{uid:e,auth:n,stsTokenManager:i}=t,r=vf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ip(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new rp(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(t){const e=await np(this,this.stsTokenManager.getToken(this.auth,t));return Lf(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=T(t),i=await n.getIdToken(e),r=tp(i);Lf(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const s="object"==typeof r.firebase?r.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:r,token:i,authTime:Xf(Zf(r.auth_time)),issuedAtTime:Xf(Zf(r.iat)),expirationTime:Xf(Zf(r.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=T(t);await sp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Lf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new lp(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Lf(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await sp(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pt(this.auth.app))return Promise.reject(Af(this.auth));const t=await this.getIdToken();return await np(this,
|
|
2348
2347
|
/**
|
|
2349
2348
|
* @license
|
|
2350
2349
|
* Copyright 2020 Google LLC
|
|
@@ -2361,7 +2360,7 @@ class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2361
2360
|
* See the License for the specific language governing permissions and
|
|
2362
2361
|
* limitations under the License.
|
|
2363
2362
|
*/
|
|
2364
|
-
async function(t,e){return
|
|
2363
|
+
async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,i,r,s,o,a,c,l;const u=null!==(n=e.displayName)&&void 0!==n?n:void 0,h=null!==(i=e.email)&&void 0!==i?i:void 0,d=null!==(r=e.phoneNumber)&&void 0!==r?r:void 0,f=null!==(s=e.photoURL)&&void 0!==s?s:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(l=e.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:w,isAnonymous:b,providerData:S,stsTokenManager:E}=e;Lf(v&&E,t,"internal-error");const _=ap.fromJSON(this.name,E);Lf("string"==typeof v,t,"internal-error"),cp(u,t.name),cp(h,t.name),Lf("boolean"==typeof w,t,"internal-error"),Lf("boolean"==typeof b,t,"internal-error"),cp(d,t.name),cp(f,t.name),cp(p,t.name),cp(g,t.name),cp(m,t.name),cp(y,t.name);const T=new lp({uid:v,auth:t,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:_,createdAt:m,lastLoginAt:y});return S&&Array.isArray(S)&&(T.providerData=S.map((t=>Object.assign({},t)))),g&&(T._redirectEventId=g),T}static async _fromIdTokenResponse(t,e,n=!1){const i=new ap;i.updateFromServerResponse(e);const r=new lp({uid:e.localId,auth:t,stsTokenManager:i,isAnonymous:n});return await sp(r),r}static async _fromGetAccountInfoResponse(t,e,n){const i=e.users[0];Lf(void 0!==i.localId,"internal-error");const r=void 0!==i.providerUserInfo?op(i.providerUserInfo):[],s=!(i.email&&i.passwordHash||(null==r?void 0:r.length)),o=new ap;o.updateFromIdToken(n);const a=new lp({uid:i.localId,auth:t,stsTokenManager:o,isAnonymous:s}),c={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:r,metadata:new rp(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash||(null==r?void 0:r.length))};return Object.assign(a,c),a}}
|
|
2365
2364
|
/**
|
|
2366
2365
|
* @license
|
|
2367
2366
|
* Copyright 2020 Google LLC
|
|
@@ -2377,7 +2376,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2377
2376
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2378
2377
|
* See the License for the specific language governing permissions and
|
|
2379
2378
|
* limitations under the License.
|
|
2380
|
-
*/const
|
|
2379
|
+
*/const up=new Map;function hp(t){xf(t instanceof Function,"Expected a class definition");let e=up.get(t);return e?(xf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,up.set(t,e),e)}
|
|
2381
2380
|
/**
|
|
2382
2381
|
* @license
|
|
2383
2382
|
* Copyright 2019 Google LLC
|
|
@@ -2393,7 +2392,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2393
2392
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2394
2393
|
* See the License for the specific language governing permissions and
|
|
2395
2394
|
* limitations under the License.
|
|
2396
|
-
*/class
|
|
2395
|
+
*/class dp{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}dp.type="NONE";const fp=dp;
|
|
2397
2396
|
/**
|
|
2398
2397
|
* @license
|
|
2399
2398
|
* Copyright 2019 Google LLC
|
|
@@ -2409,7 +2408,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2409
2408
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2410
2409
|
* See the License for the specific language governing permissions and
|
|
2411
2410
|
* limitations under the License.
|
|
2412
|
-
*/function
|
|
2411
|
+
*/function pp(t,e,n){return`firebase:${t}:${e}:${n}`}class gp{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:i,name:r}=this.auth;this.fullUserKey=pp(this.userKey,i.apiKey,r),this.fullPersistenceKey=pp("persistence",i.apiKey,r),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?lp._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new gp(hp(fp),t,n);const i=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let r=i[0]||hp(fp);const s=pp(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(s);if(e){const i=lp._fromJSON(t,e);n!==r&&(o=i),r=n;break}}catch(t){}const a=i.filter((t=>t._shouldAllowMigration));return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(s,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==r)try{await t._remove(s)}catch(t){}}))),new gp(r,t,n)):new gp(r,t,n)}}
|
|
2413
2412
|
/**
|
|
2414
2413
|
* @license
|
|
2415
2414
|
* Copyright 2020 Google LLC
|
|
@@ -2425,7 +2424,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2425
2424
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2426
2425
|
* See the License for the specific language governing permissions and
|
|
2427
2426
|
* limitations under the License.
|
|
2428
|
-
*/function
|
|
2427
|
+
*/function mp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(bp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(yp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Ep(e))return"Blackberry";if(_p(e))return"Webos";if(vp(e))return"Safari";if((e.includes("chrome/")||wp(e))&&!e.includes("edge/"))return"Chrome";if(Sp(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function yp(t=f()){return/firefox\//i.test(t)}function vp(t=f()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function wp(t=f()){return/crios\//i.test(t)}function bp(t=f()){return/iemobile/i.test(t)}function Sp(t=f()){return/android/i.test(t)}function Ep(t=f()){return/blackberry/i.test(t)}function _p(t=f()){return/webos/i.test(t)}function Tp(t=f()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Ip(){return function(){const t=f();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function kp(t=f()){return Tp(t)||Sp(t)||_p(t)||Ep(t)||/windows phone/i.test(t)||bp(t)}
|
|
2429
2428
|
/**
|
|
2430
2429
|
* @license
|
|
2431
2430
|
* Copyright 2020 Google LLC
|
|
@@ -2441,7 +2440,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2441
2440
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2442
2441
|
* See the License for the specific language governing permissions and
|
|
2443
2442
|
* limitations under the License.
|
|
2444
|
-
*/function
|
|
2443
|
+
*/function Cp(t,e=[]){let n;switch(t){case"Browser":n=mp(f());break;case"Worker":n=`${mp(f())}-${t}`;break;default:n=t}const i=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ut}/${i}`}
|
|
2445
2444
|
/**
|
|
2446
2445
|
* @license
|
|
2447
2446
|
* Copyright 2022 Google LLC
|
|
@@ -2457,7 +2456,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2457
2456
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2458
2457
|
* See the License for the specific language governing permissions and
|
|
2459
2458
|
* limitations under the License.
|
|
2460
|
-
*/class
|
|
2459
|
+
*/class Ap{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,i)=>{try{n(t(e))}catch(t){i(t)}}));n.onAbort=e,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
|
|
2461
2460
|
/**
|
|
2462
2461
|
* @license
|
|
2463
2462
|
* Copyright 2023 Google LLC
|
|
@@ -2473,7 +2472,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2473
2472
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2474
2473
|
* See the License for the specific language governing permissions and
|
|
2475
2474
|
* limitations under the License.
|
|
2476
|
-
*/class
|
|
2475
|
+
*/class Rp{constructor(t){var e,n,i,r;const s=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(e=s.minPasswordLength)&&void 0!==e?e:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=t.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(r=t.forceUpgradeOnSignin)&&void 0!==r&&r,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,n,i,r,s,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,a),this.validatePasswordCharacterOptions(t,a),a.isValid&&(a.isValid=null===(e=a.meetsMinPasswordLength)||void 0===e||e),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(i=a.containsLowercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(r=a.containsUppercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsNumericCharacter)||void 0===s||s),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),i&&(e.meetsMaxPasswordLength=t.length<=i)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let i=0;i<t.length;i++)n=t.charAt(i),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,i,r){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=r))}}
|
|
2477
2476
|
/**
|
|
2478
2477
|
* @license
|
|
2479
2478
|
* Copyright 2020 Google LLC
|
|
@@ -2489,7 +2488,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2489
2488
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2490
2489
|
* See the License for the specific language governing permissions and
|
|
2491
2490
|
* limitations under the License.
|
|
2492
|
-
*/class
|
|
2491
|
+
*/class Lp{constructor(t,e,n,i){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xp(this),this.idTokenSubscription=new xp(this),this.beforeStateQueue=new Ap(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Sf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=hp(e)),this._initializationPromise=this.queue((async()=>{var n,i;if(!this._deleted&&(this.persistenceManager=await gp.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(i=this.currentUser)||void 0===i?void 0:i.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await Jf(this,{idToken:t}),n=await lp._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var e;if(Pt(this.app)){const t=this.app.settings.authIdToken;return t?new Promise((e=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(t).then(e,e)))})):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let i=n,r=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==i?void 0:i._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null==o?void 0:o.user)||(i=o.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(t){i=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return Lf(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await sp(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Pt(this.app))return Promise.reject(Af(this));const e=t?T(t):null;return e&&Lf(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Lf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return Pt(this.app)?Promise.reject(Af(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Pt(this.app)?Promise.reject(Af(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(hp(t))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Hf(t,"GET","/v2/passwordPolicy",Vf(t,e))}
|
|
2493
2492
|
/**
|
|
2494
2493
|
* @license
|
|
2495
2494
|
* Copyright 2023 Google LLC
|
|
@@ -2505,7 +2504,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2505
2504
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2506
2505
|
* See the License for the specific language governing permissions and
|
|
2507
2506
|
* limitations under the License.
|
|
2508
|
-
*/(this),e=new
|
|
2507
|
+
*/(this),e=new Rp(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new g("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise(((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged((()=>{n(),t()}),e)}}))}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Hf(t,"POST","/v2/accounts:revokeToken",Vf(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&hp(t)||this._popupRedirectResolver;Lf(e,this,"argument-error"),this.redirectPersistenceManager=await gp.create(this,[hp(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,i){if(this._deleted)return()=>{};const r="function"==typeof e?e:e.next.bind(e);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Lf(o,this,"internal-error"),o.then((()=>{s||r(this.currentUser)})),"function"==typeof e){const r=t.addObserver(e,n,i);return()=>{s=!0,r()}}{const n=t.addObserver(e);return()=>{s=!0,n()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Lf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Cp(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const i=await this._getAppCheckToken();return i&&(e["X-Firebase-AppCheck"]=i),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){_f.logLevel<=R.WARN&&_f.warn(`Auth (${Ut}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Np(t){return T(t)}class xp{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new E(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Lf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
|
|
2509
2508
|
/**
|
|
2510
2509
|
* @license
|
|
2511
2510
|
* Copyright 2020 Google LLC
|
|
@@ -2521,7 +2520,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2521
2520
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2522
2521
|
* See the License for the specific language governing permissions and
|
|
2523
2522
|
* limitations under the License.
|
|
2524
|
-
*/let
|
|
2523
|
+
*/let Op={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Dp(t){return Op.loadJS(t)}class Pp{constructor(t){this.type="recaptcha-enterprise",this.auth=Np(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{(async function(t,e){return Hf(t,"GET","/v2/recaptchaConfig",Vf(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((i=>{if(void 0!==i.recaptchaKey){const n=new Yf(i);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))}function i(e,n,i){const r=window.grecaptcha;Qf(r)?r.enterprise.ready((()=>{r.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):i(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,r)=>{n(this.auth).then((n=>{if(!e&&Qf(window.grecaptcha))i(n,t,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let e=Op.recaptchaEnterpriseScript;0!==e.length&&(e+=n),Dp(e).then((()=>{i(n,t,r)})).catch((t=>{r(t)}))}})).catch((t=>{r(t)}))}))}}async function Mp(t,e,n,i=!1){const r=new Pp(t);let s;try{s=await r.verify(n)}catch(t){s=await r.verify(n,!0)}const o=Object.assign({},e);return i?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Fp(t,e,n,i){var r;if(null===(r=t._getRecaptchaConfig())||void 0===r?void 0:r.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await Mp(t,e,n,"getOobCode"===n);return i(t,r)}return i(t,e).catch((async r=>{if("auth/missing-recaptcha-token"===r.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const r=await Mp(t,e,n,"getOobCode"===n);return i(t,r)}return Promise.reject(r)}))}
|
|
2525
2524
|
/**
|
|
2526
2525
|
* @license
|
|
2527
2526
|
* Copyright 2020 Google LLC
|
|
@@ -2537,7 +2536,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2537
2536
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2538
2537
|
* See the License for the specific language governing permissions and
|
|
2539
2538
|
* limitations under the License.
|
|
2540
|
-
*/function
|
|
2539
|
+
*/function Up(t,e,n){const i=Np(t);Lf(i._canInitEmulator,i,"emulator-config-failed"),Lf(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");const r=!!(null==n?void 0:n.disableWarnings),s=zp(e),{host:o,port:a}=function(t){const e=zp(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const t=r[1];return{host:t,port:Bp(i.substr(t.length+1))}}{const[t,e]=i.split(":");return{host:t,port:Bp(e)}}}(e),c=null===a?"":`:${a}`;i.config.emulator={url:`${s}//${o}${c}/`},i.settings.appVerificationDisabledForTesting=!0,i.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:r})}),r||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
|
|
2541
2540
|
/**
|
|
2542
2541
|
* @license
|
|
2543
2542
|
* Copyright 2020 Google LLC
|
|
@@ -2553,7 +2552,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2553
2552
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2554
2553
|
* See the License for the specific language governing permissions and
|
|
2555
2554
|
* limitations under the License.
|
|
2556
|
-
*/()}function
|
|
2555
|
+
*/()}function zp(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Bp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Vp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Nf("not implemented")}_getIdTokenResponse(t){return Nf("not implemented")}_linkToIdToken(t,e){return Nf("not implemented")}_getReauthenticationResolver(t){return Nf("not implemented")}}
|
|
2557
2556
|
/**
|
|
2558
2557
|
* @license
|
|
2559
2558
|
* Copyright 2020 Google LLC
|
|
@@ -2569,7 +2568,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2569
2568
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2570
2569
|
* See the License for the specific language governing permissions and
|
|
2571
2570
|
* limitations under the License.
|
|
2572
|
-
*/async function
|
|
2571
|
+
*/async function Hp(t,e){return Hf(t,"POST","/v1/accounts:signUp",e)}
|
|
2573
2572
|
/**
|
|
2574
2573
|
* @license
|
|
2575
2574
|
* Copyright 2020 Google LLC
|
|
@@ -2585,7 +2584,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2585
2584
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2586
2585
|
* See the License for the specific language governing permissions and
|
|
2587
2586
|
* limitations under the License.
|
|
2588
|
-
*/async function
|
|
2587
|
+
*/async function jp(t,e){return qf(t,"POST","/v1/accounts:signInWithPassword",Vf(t,e))}async function qp(t,e){return async function(t,e){return Hf(t,"POST","/v1/accounts:sendOobCode",Vf(t,e))}(t,e)}
|
|
2589
2588
|
/**
|
|
2590
2589
|
* @license
|
|
2591
2590
|
* Copyright 2020 Google LLC
|
|
@@ -2618,7 +2617,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2618
2617
|
* See the License for the specific language governing permissions and
|
|
2619
2618
|
* limitations under the License.
|
|
2620
2619
|
*/
|
|
2621
|
-
class
|
|
2620
|
+
class $p extends Vp{constructor(t,e,n,i=null){super("password",n),this._email=t,this._password=e,this._tenantId=i}static _fromEmailAndPassword(t,e){return new $p(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new $p(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return Fp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",jp);case"emailLink":return async function(t,e){return qf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{email:this._email,oobCode:this._password});default:If(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Fp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Hp);case"emailLink":return async function(t,e){return qf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:If(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
|
|
2622
2621
|
/**
|
|
2623
2622
|
* @license
|
|
2624
2623
|
* Copyright 2020 Google LLC
|
|
@@ -2634,7 +2633,7 @@ class qp extends Bp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2634
2633
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2635
2634
|
* See the License for the specific language governing permissions and
|
|
2636
2635
|
* limitations under the License.
|
|
2637
|
-
*/async function
|
|
2636
|
+
*/async function Kp(t,e){return qf(t,"POST","/v1/accounts:signInWithIdp",Vf(t,e))}
|
|
2638
2637
|
/**
|
|
2639
2638
|
* @license
|
|
2640
2639
|
* Copyright 2020 Google LLC
|
|
@@ -2650,7 +2649,7 @@ class qp extends Bp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2650
2649
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2651
2650
|
* See the License for the specific language governing permissions and
|
|
2652
2651
|
* limitations under the License.
|
|
2653
|
-
*/class
|
|
2652
|
+
*/class Wp extends Vp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Wp(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):If("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:i}=e,r=vf(e,["providerId","signInMethod"]);if(!n||!i)return null;const s=new Wp(n,i);return s.idToken=r.idToken||void 0,s.accessToken=r.accessToken||void 0,s.secret=r.secret,s.nonce=r.nonce,s.pendingToken=r.pendingToken||null,s}_getIdTokenResponse(t){return Kp(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Kp(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Kp(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=w(e)}return t}}
|
|
2654
2653
|
/**
|
|
2655
2654
|
* @license
|
|
2656
2655
|
* Copyright 2020 Google LLC
|
|
@@ -2666,7 +2665,7 @@ class qp extends Bp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2666
2665
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2667
2666
|
* See the License for the specific language governing permissions and
|
|
2668
2667
|
* limitations under the License.
|
|
2669
|
-
*/class
|
|
2668
|
+
*/class Gp{constructor(t){var e,n,i,r,s,o;const a=b(S(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,l=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(i=a.mode)&&void 0!==i?i:null);Lf(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(r=a.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(s=a.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=b(S(t)).link,n=e?b(S(e)).deep_link_id:null,i=b(S(t)).deep_link_id;return(i?b(S(i)).link:null)||i||n||e||t}(t);try{return new Gp(e)}catch(t){return null}}}
|
|
2670
2669
|
/**
|
|
2671
2670
|
* @license
|
|
2672
2671
|
* Copyright 2020 Google LLC
|
|
@@ -2682,7 +2681,7 @@ class qp extends Bp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2682
2681
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2683
2682
|
* See the License for the specific language governing permissions and
|
|
2684
2683
|
* limitations under the License.
|
|
2685
|
-
*/class
|
|
2684
|
+
*/class Qp{constructor(){this.providerId=Qp.PROVIDER_ID}static credential(t,e){return $p._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Gp.parseLink(e);return Lf(n,"argument-error"),$p._fromEmailAndCode(t,n.code,n.tenantId)}}Qp.PROVIDER_ID="password",Qp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Qp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
|
|
2686
2685
|
/**
|
|
2687
2686
|
* @license
|
|
2688
2687
|
* Copyright 2020 Google LLC
|
|
@@ -2699,7 +2698,7 @@ class qp extends Bp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2699
2698
|
* See the License for the specific language governing permissions and
|
|
2700
2699
|
* limitations under the License.
|
|
2701
2700
|
*/
|
|
2702
|
-
class
|
|
2701
|
+
class Yp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
|
|
2703
2702
|
/**
|
|
2704
2703
|
* @license
|
|
2705
2704
|
* Copyright 2019 Google LLC
|
|
@@ -2715,7 +2714,7 @@ class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2715
2714
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2716
2715
|
* See the License for the specific language governing permissions and
|
|
2717
2716
|
* limitations under the License.
|
|
2718
|
-
*/class
|
|
2717
|
+
*/class Jp extends Yp{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
|
|
2719
2718
|
/**
|
|
2720
2719
|
* @license
|
|
2721
2720
|
* Copyright 2020 Google LLC
|
|
@@ -2731,7 +2730,7 @@ class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2731
2730
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2732
2731
|
* See the License for the specific language governing permissions and
|
|
2733
2732
|
* limitations under the License.
|
|
2734
|
-
*/class
|
|
2733
|
+
*/class Xp extends Jp{constructor(){super("facebook.com")}static credential(t){return Wp._fromParams({providerId:Xp.PROVIDER_ID,signInMethod:Xp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Xp.credentialFromTaggedObject(t)}static credentialFromError(t){return Xp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Xp.credential(t.oauthAccessToken)}catch(t){return null}}}Xp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Xp.PROVIDER_ID="facebook.com";
|
|
2735
2734
|
/**
|
|
2736
2735
|
* @license
|
|
2737
2736
|
* Copyright 2020 Google LLC
|
|
@@ -2748,7 +2747,7 @@ class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2748
2747
|
* See the License for the specific language governing permissions and
|
|
2749
2748
|
* limitations under the License.
|
|
2750
2749
|
*/
|
|
2751
|
-
class
|
|
2750
|
+
class Zp extends Jp{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Wp._fromParams({providerId:Zp.PROVIDER_ID,signInMethod:Zp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Zp.credentialFromTaggedObject(t)}static credentialFromError(t){return Zp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Zp.credential(e,n)}catch(t){return null}}}Zp.GOOGLE_SIGN_IN_METHOD="google.com",Zp.PROVIDER_ID="google.com";
|
|
2752
2751
|
/**
|
|
2753
2752
|
* @license
|
|
2754
2753
|
* Copyright 2020 Google LLC
|
|
@@ -2765,7 +2764,7 @@ class Xp extends Yp{constructor(){super("google.com"),this.addScope("profile")}s
|
|
|
2765
2764
|
* See the License for the specific language governing permissions and
|
|
2766
2765
|
* limitations under the License.
|
|
2767
2766
|
*/
|
|
2768
|
-
class
|
|
2767
|
+
class tg extends Jp{constructor(){super("github.com")}static credential(t){return Wp._fromParams({providerId:tg.PROVIDER_ID,signInMethod:tg.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return tg.credentialFromTaggedObject(t)}static credentialFromError(t){return tg.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return tg.credential(t.oauthAccessToken)}catch(t){return null}}}tg.GITHUB_SIGN_IN_METHOD="github.com",tg.PROVIDER_ID="github.com";
|
|
2769
2768
|
/**
|
|
2770
2769
|
* @license
|
|
2771
2770
|
* Copyright 2020 Google LLC
|
|
@@ -2782,7 +2781,7 @@ class Zp extends Yp{constructor(){super("github.com")}static credential(t){retur
|
|
|
2782
2781
|
* See the License for the specific language governing permissions and
|
|
2783
2782
|
* limitations under the License.
|
|
2784
2783
|
*/
|
|
2785
|
-
class
|
|
2784
|
+
class eg extends Jp{constructor(){super("twitter.com")}static credential(t,e){return Wp._fromParams({providerId:eg.PROVIDER_ID,signInMethod:eg.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return eg.credentialFromTaggedObject(t)}static credentialFromError(t){return eg.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return eg.credential(e,n)}catch(t){return null}}}eg.TWITTER_SIGN_IN_METHOD="twitter.com",eg.PROVIDER_ID="twitter.com";
|
|
2786
2785
|
/**
|
|
2787
2786
|
* @license
|
|
2788
2787
|
* Copyright 2020 Google LLC
|
|
@@ -2799,7 +2798,7 @@ class tg extends Yp{constructor(){super("twitter.com")}static credential(t,e){re
|
|
|
2799
2798
|
* See the License for the specific language governing permissions and
|
|
2800
2799
|
* limitations under the License.
|
|
2801
2800
|
*/
|
|
2802
|
-
class
|
|
2801
|
+
class ng{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,i=!1){const r=await lp._fromIdTokenResponse(t,n,i),s=ig(n);return new ng({user:r,providerId:s,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const i=ig(n);return new ng({user:t,providerId:i,_tokenResponse:n,operationType:e})}}function ig(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
|
|
2803
2802
|
/**
|
|
2804
2803
|
* @license
|
|
2805
2804
|
* Copyright 2020 Google LLC
|
|
@@ -2815,7 +2814,7 @@ class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2815
2814
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2816
2815
|
* See the License for the specific language governing permissions and
|
|
2817
2816
|
* limitations under the License.
|
|
2818
|
-
*/class
|
|
2817
|
+
*/class rg extends p{constructor(t,e,n,i){var r;super(e.code,e.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,rg.prototype),this.customData={appName:t.name,tenantId:null!==(r=t.tenantId)&&void 0!==r?r:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,i){return new rg(t,e,n,i)}}function sg(t,e,n,i){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw rg._fromErrorAndOperation(t,n,e,i);throw n}))}
|
|
2819
2818
|
/**
|
|
2820
2819
|
* @license
|
|
2821
2820
|
* Copyright 2020 Google LLC
|
|
@@ -2832,7 +2831,7 @@ class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2832
2831
|
* See the License for the specific language governing permissions and
|
|
2833
2832
|
* limitations under the License.
|
|
2834
2833
|
*/
|
|
2835
|
-
async function
|
|
2834
|
+
async function og(t,e,n=!1){if(Pt(t.app))return Promise.reject(Af(t));const i="signIn",r=await sg(t,i,e),s=await ng._fromIdTokenResponse(t,i,r);return n||await t._updateCurrentUser(s.user),s}
|
|
2836
2835
|
/**
|
|
2837
2836
|
* @license
|
|
2838
2837
|
* Copyright 2020 Google LLC
|
|
@@ -2849,7 +2848,7 @@ async function sg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Cf(t));const i="s
|
|
|
2849
2848
|
* See the License for the specific language governing permissions and
|
|
2850
2849
|
* limitations under the License.
|
|
2851
2850
|
*/
|
|
2852
|
-
async function
|
|
2851
|
+
async function ag(t){const e=Np(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function cg(t,e,n){const i=Np(t),r={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&
|
|
2853
2852
|
/**
|
|
2854
2853
|
* @license
|
|
2855
2854
|
* Copyright 2020 Google LLC
|
|
@@ -2866,7 +2865,7 @@ async function og(t){const e=Lp(t);e._getPasswordPolicyInternal()&&await e._upda
|
|
|
2866
2865
|
* See the License for the specific language governing permissions and
|
|
2867
2866
|
* limitations under the License.
|
|
2868
2867
|
*/
|
|
2869
|
-
function(t,e,n){var i;
|
|
2868
|
+
function(t,e,n){var i;Lf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"invalid-continue-uri"),Lf(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Lf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Lf(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(i,r,n),await Fp(i,r,"getOobCode",qp)}async function lg(t,e,n){await async function(t,e){return Hf(t,"POST","/v1/accounts:resetPassword",Vf(t,e))}(T(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ag(t),e}))}function ug(t,e,n){return Pt(t.app)?Promise.reject(Af(t)):async function(t,e){return og(Np(t),e)}(T(t),Qp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ag(t),e}))}const hg="__sak";
|
|
2870
2869
|
/**
|
|
2871
2870
|
* @license
|
|
2872
2871
|
* Copyright 2019 Google LLC
|
|
@@ -2882,7 +2881,7 @@ function(t,e,n){var i;Rf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"inv
|
|
|
2882
2881
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2883
2882
|
* See the License for the specific language governing permissions and
|
|
2884
2883
|
* limitations under the License.
|
|
2885
|
-
*/class
|
|
2884
|
+
*/class dg{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(hg,"1"),this.storage.removeItem(hg),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
|
|
2886
2885
|
/**
|
|
2887
2886
|
* @license
|
|
2888
2887
|
* Copyright 2020 Google LLC
|
|
@@ -2898,7 +2897,7 @@ function(t,e,n){var i;Rf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"inv
|
|
|
2898
2897
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2899
2898
|
* See the License for the specific language governing permissions and
|
|
2900
2899
|
* limitations under the License.
|
|
2901
|
-
*/class
|
|
2900
|
+
*/class fg extends dg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=kp(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),i=this.localCache[e];n!==i&&t(e,i,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;e?this.detachListener():this.stopPolling();const i=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},r=this.storage.getItem(n);Ip()&&r!==t.newValue&&t.newValue!==t.oldValue?setTimeout(i,10):i()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}fg.type="LOCAL";const pg=fg;
|
|
2902
2901
|
/**
|
|
2903
2902
|
* @license
|
|
2904
2903
|
* Copyright 2020 Google LLC
|
|
@@ -2914,7 +2913,7 @@ function(t,e,n){var i;Rf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"inv
|
|
|
2914
2913
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2915
2914
|
* See the License for the specific language governing permissions and
|
|
2916
2915
|
* limitations under the License.
|
|
2917
|
-
*/class
|
|
2916
|
+
*/class gg extends dg{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}gg.type="SESSION";const mg=gg;
|
|
2918
2917
|
/**
|
|
2919
2918
|
* @license
|
|
2920
2919
|
* Copyright 2019 Google LLC
|
|
@@ -2947,7 +2946,7 @@ function(t,e,n){var i;Rf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"inv
|
|
|
2947
2946
|
* See the License for the specific language governing permissions and
|
|
2948
2947
|
* limitations under the License.
|
|
2949
2948
|
*/
|
|
2950
|
-
class
|
|
2949
|
+
class yg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new yg(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:i,data:r}=e.data,s=this.handlersMap[i];if(!(null==s?void 0:s.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const o=Array.from(s).map((async t=>t(e.origin,r))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:i,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
|
|
2951
2950
|
/**
|
|
2952
2951
|
* @license
|
|
2953
2952
|
* Copyright 2020 Google LLC
|
|
@@ -2964,7 +2963,7 @@ class mg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
|
|
|
2964
2963
|
* See the License for the specific language governing permissions and
|
|
2965
2964
|
* limitations under the License.
|
|
2966
2965
|
*/
|
|
2967
|
-
function
|
|
2966
|
+
function vg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
|
|
2968
2967
|
/**
|
|
2969
2968
|
* @license
|
|
2970
2969
|
* Copyright 2019 Google LLC
|
|
@@ -2980,7 +2979,7 @@ function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2980
2979
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2981
2980
|
* See the License for the specific language governing permissions and
|
|
2982
2981
|
* limitations under the License.
|
|
2983
|
-
*/
|
|
2982
|
+
*/yg.receivers=[];class wg{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const i="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let r,s;return new Promise(((o,a)=>{const c=vg("",20);i.port1.start();const l=setTimeout((()=>{a(new Error("unsupported_event"))}),n);s={messageChannel:i,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(l),r=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(l),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(s),i.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[i.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}
|
|
2984
2983
|
/**
|
|
2985
2984
|
* @license
|
|
2986
2985
|
* Copyright 2020 Google LLC
|
|
@@ -2996,7 +2995,7 @@ function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2996
2995
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2997
2996
|
* See the License for the specific language governing permissions and
|
|
2998
2997
|
* limitations under the License.
|
|
2999
|
-
*/function
|
|
2998
|
+
*/function bg(){return window}
|
|
3000
2999
|
/**
|
|
3001
3000
|
* @license
|
|
3002
3001
|
* Copyright 2020 Google LLC.
|
|
@@ -3013,7 +3012,7 @@ function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
3013
3012
|
* See the License for the specific language governing permissions and
|
|
3014
3013
|
* limitations under the License.
|
|
3015
3014
|
*/
|
|
3016
|
-
function
|
|
3015
|
+
function Sg(){return void 0!==bg().WorkerGlobalScope&&"function"==typeof bg().importScripts}
|
|
3017
3016
|
/**
|
|
3018
3017
|
* @license
|
|
3019
3018
|
* Copyright 2019 Google LLC
|
|
@@ -3030,7 +3029,7 @@ function bg(){return void 0!==wg().WorkerGlobalScope&&"function"==typeof wg().im
|
|
|
3030
3029
|
* See the License for the specific language governing permissions and
|
|
3031
3030
|
* limitations under the License.
|
|
3032
3031
|
*/
|
|
3033
|
-
const
|
|
3032
|
+
const Eg="firebaseLocalStorageDb",_g="firebaseLocalStorage",Tg="fbase_key";class Ig{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function kg(t,e){return t.transaction([_g],e?"readwrite":"readonly").objectStore(_g)}function Cg(){const t=indexedDB.open(Eg,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(_g,{keyPath:Tg})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(_g)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Eg);return new Ig(t).toPromise()}(),e(await Cg()))}))}))}async function Ag(t,e,n){const i=kg(t,!0).put({[Tg]:e,value:n});return new Ig(i).toPromise()}function Rg(t,e){const n=kg(t,!0).delete(e);return new Ig(n).toPromise()}class Lg{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Cg()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Sg()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=yg._getInstance(Sg()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new wg(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await Cg();return await Ag(t,hg,"1"),await Rg(t,hg),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Ag(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=kg(t,!1).get(e),i=await new Ig(n).toPromise();return void 0===i?null:i.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>Rg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=kg(t,!1).getAll();return new Ig(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:i,value:r}of t)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),e.push(i));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Lg.type="LOCAL";const Ng=Lg;new Mf(3e4,6e4);
|
|
3034
3033
|
/**
|
|
3035
3034
|
* @license
|
|
3036
3035
|
* Copyright 2019 Google LLC
|
|
@@ -3047,7 +3046,7 @@ const Sg="firebaseLocalStorageDb",Eg="firebaseLocalStorage",_g="fbase_key";class
|
|
|
3047
3046
|
* See the License for the specific language governing permissions and
|
|
3048
3047
|
* limitations under the License.
|
|
3049
3048
|
*/
|
|
3050
|
-
class
|
|
3049
|
+
class xg extends Vp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Kp(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Kp(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Kp(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function Og(t){return og(t.auth,new xg(t),t.bypassAuthState)}function Dg(t){const{auth:e,user:n}=t;return Lf(n,e,"internal-error"),
|
|
3051
3050
|
/**
|
|
3052
3051
|
* @license
|
|
3053
3052
|
* Copyright 2019 Google LLC
|
|
@@ -3064,7 +3063,7 @@ class Ng extends Bp{constructor(t){super("custom","custom"),this.params=t}_getId
|
|
|
3064
3063
|
* See the License for the specific language governing permissions and
|
|
3065
3064
|
* limitations under the License.
|
|
3066
3065
|
*/
|
|
3067
|
-
async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(
|
|
3066
|
+
async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Af(i));const r="reauthenticate";try{const s=await np(t,sg(i,r,e,t),n);Lf(s.idToken,i,"internal-error");const o=tp(s.idToken);Lf(o,i,"internal-error");const{sub:a}=o;return Lf(t.uid===a,i,"user-mismatch"),ng._forOperation(t,r,s)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&If(i,"user-mismatch"),t}}(n,new xg(t),t.bypassAuthState)}async function Pg(t){const{auth:e,user:n}=t;return Lf(n,e,"internal-error"),async function(t,e,n=!1){const i=await np(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return ng._forOperation(t,"link",i)}(n,new xg(t),t.bypassAuthState)}
|
|
3068
3067
|
/**
|
|
3069
3068
|
* @license
|
|
3070
3069
|
* Copyright 2020 Google LLC
|
|
@@ -3080,7 +3079,7 @@ async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Cf(i
|
|
|
3080
3079
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3081
3080
|
* See the License for the specific language governing permissions and
|
|
3082
3081
|
* limitations under the License.
|
|
3083
|
-
*/class
|
|
3082
|
+
*/class Mg{constructor(t,e,n,i,r=!1){this.auth=t,this.resolver=n,this.user=i,this.bypassAuthState=r,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:i,tenantId:r,error:s,type:o}=t;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:r||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return Og;case"linkViaPopup":case"linkViaRedirect":return Pg;case"reauthViaPopup":case"reauthViaRedirect":return Dg;default:If(this.auth,"internal-error")}}resolve(t){xf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){xf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
|
|
3084
3083
|
/**
|
|
3085
3084
|
* @license
|
|
3086
3085
|
* Copyright 2020 Google LLC
|
|
@@ -3096,7 +3095,7 @@ async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Cf(i
|
|
|
3096
3095
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3097
3096
|
* See the License for the specific language governing permissions and
|
|
3098
3097
|
* limitations under the License.
|
|
3099
|
-
*/const
|
|
3098
|
+
*/const Fg=new Mf(2e3,1e4);class Ug extends Mg{constructor(t,e,n,i,r){super(t,e,i,r),this.provider=n,this.authWindow=null,this.pollId=null,Ug.currentPopupAction&&Ug.currentPopupAction.cancel(),Ug.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Lf(t,this.auth,"internal-error"),t}async onExecution(){xf(1===this.filter.length,"Popup operations only handle one event");const t=vg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(kf(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(kf(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ug.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(kf(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Fg.get())};t()}}Ug.currentPopupAction=null;
|
|
3100
3099
|
/**
|
|
3101
3100
|
* @license
|
|
3102
3101
|
* Copyright 2020 Google LLC
|
|
@@ -3113,7 +3112,7 @@ async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Cf(i
|
|
|
3113
3112
|
* See the License for the specific language governing permissions and
|
|
3114
3113
|
* limitations under the License.
|
|
3115
3114
|
*/
|
|
3116
|
-
const
|
|
3115
|
+
const zg="pendingRedirect",Bg=new Map;class Vg extends Mg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=Bg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return pp(zg,t.config.apiKey,t.name)}(e),i=function(t){return hp(t._redirectPersistence)}(t);if(!await i._isAvailable())return!1;const r="true"===await i._get(n);return await i._remove(n),r}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}Bg.set(this.auth._key(),t)}return this.bypassAuthState||Bg.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Hg(t,e){Bg.set(t._key(),e)}async function jg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Af(t));const i=Np(t),r=
|
|
3117
3116
|
/**
|
|
3118
3117
|
* @license
|
|
3119
3118
|
* Copyright 2021 Google LLC
|
|
@@ -3130,7 +3129,7 @@ const Ug="pendingRedirect",zg=new Map;class Bg extends Pg{constructor(t,e,n=!1){
|
|
|
3130
3129
|
* See the License for the specific language governing permissions and
|
|
3131
3130
|
* limitations under the License.
|
|
3132
3131
|
*/
|
|
3133
|
-
function(t,e){return e?
|
|
3132
|
+
function(t,e){return e?hp(e):(Lf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(i,e),s=new Vg(i,r,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}
|
|
3134
3133
|
/**
|
|
3135
3134
|
* @license
|
|
3136
3135
|
* Copyright 2020 Google LLC
|
|
@@ -3146,7 +3145,7 @@ function(t,e){return e?up(e):(Rf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3146
3145
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3147
3146
|
* See the License for the specific language governing permissions and
|
|
3148
3147
|
* limitations under the License.
|
|
3149
|
-
*/class
|
|
3148
|
+
*/class qg{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Kg(t);default:return!1}}
|
|
3150
3149
|
/**
|
|
3151
3150
|
* @license
|
|
3152
3151
|
* Copyright 2020 Google LLC
|
|
@@ -3162,7 +3161,7 @@ function(t,e){return e?up(e):(Rf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3162
3161
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3163
3162
|
* See the License for the specific language governing permissions and
|
|
3164
3163
|
* limitations under the License.
|
|
3165
|
-
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error
|
|
3164
|
+
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Kg(t)){const i=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(kf(this.auth,i))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has($g(t))}saveEventToCache(t){this.cachedEventUids.add($g(t)),this.lastProcessedEventTime=Date.now()}}function $g(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Kg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
|
|
3166
3165
|
/**
|
|
3167
3166
|
* @license
|
|
3168
3167
|
* Copyright 2020 Google LLC
|
|
@@ -3179,7 +3178,7 @@ function(t,e){return e?up(e):(Rf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3179
3178
|
* See the License for the specific language governing permissions and
|
|
3180
3179
|
* limitations under the License.
|
|
3181
3180
|
*/
|
|
3182
|
-
const
|
|
3181
|
+
const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Gg=/^https?/;async function Qg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Hf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Yg(t))return}catch(t){}If(t,"unauthorized-domain")}function Yg(t){const e=Of(),{protocol:n,hostname:i}=new URL(e);if(t.startsWith("chrome-extension://")){const r=new URL(t);return""===r.hostname&&""===i?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===i}if(!Gg.test(n))return!1;if(Wg.test(t))return i===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}
|
|
3183
3182
|
/**
|
|
3184
3183
|
* @license
|
|
3185
3184
|
* Copyright 2020 Google LLC.
|
|
@@ -3195,7 +3194,7 @@ const Kg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Wg=/^https?/;async function Gg(t
|
|
|
3195
3194
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3196
3195
|
* See the License for the specific language governing permissions and
|
|
3197
3196
|
* limitations under the License.
|
|
3198
|
-
*/const
|
|
3197
|
+
*/const Jg=new Mf(3e4,6e4);function Xg(){const t=bg().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function Zg(t){return new Promise(((e,n)=>{var i,r,s;function o(){Xg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Xg(),n(kf(t,"network-request-failed"))},timeout:Jg.get()})}if(null===(r=null===(i=bg().gapi)||void 0===i?void 0:i.iframes)||void 0===r?void 0:r.Iframe)e(gapi.iframes.getContext());else{if(!(null===(s=bg().gapi)||void 0===s?void 0:s.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return bg()[e]=()=>{gapi.load?o():n(kf(t,"network-request-failed"))},Dp(`${Op.gapiScript}?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw tm=null,t}))}let tm=null;
|
|
3199
3198
|
/**
|
|
3200
3199
|
* @license
|
|
3201
3200
|
* Copyright 2020 Google LLC.
|
|
@@ -3212,7 +3211,7 @@ const Kg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Wg=/^https?/;async function Gg(t
|
|
|
3212
3211
|
* See the License for the specific language governing permissions and
|
|
3213
3212
|
* limitations under the License.
|
|
3214
3213
|
*/
|
|
3215
|
-
const
|
|
3214
|
+
const em=new Mf(5e3,15e3),nm="__/auth/iframe",im="emulator/auth/iframe",rm={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},sm=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function om(t){const e=t.config;Lf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Ff(e,im):`https://${t.config.authDomain}/${nm}`,i={apiKey:e.apiKey,appName:t.name,v:Ut},r=sm.get(t.config.apiHost);r&&(i.eid=r);const s=t._getFrameworks();return s.length&&(i.fw=s.join(",")),`${n}?${w(i).slice(1)}`}async function am(t){const e=await function(t){return tm=tm||Zg(t),tm}(t),n=bg().gapi;return Lf(n,t,"internal-error"),e.open({where:document.body,url:om(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:rm,dontclear:!0},(e=>new Promise((async(n,i)=>{await e.restyle({setHideOnLeave:!1});const r=kf(t,"network-request-failed"),s=bg().setTimeout((()=>{i(r)}),em.get());function o(){bg().clearTimeout(s),n(e)}e.ping(o).then(o,(()=>{i(r)}))}))))}
|
|
3216
3215
|
/**
|
|
3217
3216
|
* @license
|
|
3218
3217
|
* Copyright 2020 Google LLC.
|
|
@@ -3228,7 +3227,7 @@ const tm=new Pf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",im={styl
|
|
|
3228
3227
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3229
3228
|
* See the License for the specific language governing permissions and
|
|
3230
3229
|
* limitations under the License.
|
|
3231
|
-
*/const
|
|
3230
|
+
*/const cm={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class lm{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function um(t,e,n,i=500,r=600){const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const c=Object.assign(Object.assign({},cm),{width:i.toString(),height:r.toString(),top:s,left:o}),l=f().toLowerCase();n&&(a=wp(l)?"_blank":n),yp(l)&&(e=e||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=f()){var e;return Tp(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(l)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}
|
|
3232
3231
|
/**
|
|
3233
3232
|
* @license
|
|
3234
3233
|
* Copyright 2021 Google LLC
|
|
@@ -3244,7 +3243,7 @@ const tm=new Pf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",im={styl
|
|
|
3244
3243
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3245
3244
|
* See the License for the specific language governing permissions and
|
|
3246
3245
|
* limitations under the License.
|
|
3247
|
-
*/(e||"",a),new
|
|
3246
|
+
*/(e||"",a),new lm(null);const h=window.open(e||"",a,u);Lf(h,t,"popup-blocked");try{h.focus()}catch(t){}return new lm(h)}const hm="__/auth/handler",dm="emulator/auth/handler",fm=encodeURIComponent("fac");async function pm(t,e,n,i,r,s){Lf(t.config.authDomain,t,"auth-domain-config-required"),Lf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:i,v:Ut,eventId:r};if(e instanceof Yp){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(s||{}))o[t]=e}if(e instanceof Jp){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const c=await t._getAppCheckToken(),l=c?`#${fm}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${hm}`;return Ff(t,dm)}
|
|
3248
3247
|
/**
|
|
3249
3248
|
* @license
|
|
3250
3249
|
* Copyright 2020 Google LLC
|
|
@@ -3260,7 +3259,7 @@ const tm=new Pf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",im={styl
|
|
|
3260
3259
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3261
3260
|
* See the License for the specific language governing permissions and
|
|
3262
3261
|
* limitations under the License.
|
|
3263
|
-
*/(t)}?${w(a).slice(1)}${l}`}const
|
|
3262
|
+
*/(t)}?${w(a).slice(1)}${l}`}const gm="webStorageSupport";const mm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=mg,this._completeRedirectFn=jg,this._overrideRedirectResult=Hg}async _openPopup(t,e,n,i){var r;xf(null===(r=this.eventManagers[t._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return um(t,await pm(t,e,n,Of(),i),vg())}async _openRedirect(t,e,n,i){await this._originValidation(t);return function(t){bg().location.href=t}(await pm(t,e,n,Of(),i)),new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(xf(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await am(t),n=new qg(t);return e.register("authEvent",(e=>{Lf(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(gm,{type:gm},(n=>{var i;const r=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i[gm];void 0!==r&&e(!!r),If(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Qg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return kp()||vp()||Tp()}};var ym="@firebase/auth",vm="1.7.7";
|
|
3264
3263
|
/**
|
|
3265
3264
|
* @license
|
|
3266
3265
|
* Copyright 2020 Google LLC
|
|
@@ -3277,7 +3276,7 @@ const tm=new Pf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",im={styl
|
|
|
3277
3276
|
* See the License for the specific language governing permissions and
|
|
3278
3277
|
* limitations under the License.
|
|
3279
3278
|
*/
|
|
3280
|
-
class
|
|
3279
|
+
class wm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Lf(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
|
|
3281
3280
|
/**
|
|
3282
3281
|
* @license
|
|
3283
3282
|
* Copyright 2020 Google LLC
|
|
@@ -3310,4 +3309,4 @@ class vm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
|
|
|
3310
3309
|
* See the License for the specific language governing permissions and
|
|
3311
3310
|
* limitations under the License.
|
|
3312
3311
|
*/
|
|
3313
|
-
const wm=h("authIdTokenMaxAge")||300;let bm=null;function Sm(t=Bt()){const e=Dt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Dt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;Tf(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:gm,persistence:[Lg,fg,gg]}),i=h("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(i,location.origin);if(location.origin===t.origin){const e=(r=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 i=null==e?void 0:e.token;bm!==i&&(bm=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,i){T(t).onIdTokenChanged(e,n,i)}(n,(t=>e(t)))}}var r;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&&Fp(n,`http://${s}`),n}var Em;!function(t){xp=t}({loadJS:t=>new Promise(((e,n)=>{const i=document.createElement("script");i.setAttribute("src",t),i.onload=e,i.onerror=t=>{const e=If("internal-error");e.customData=t,n(e)},i.type="text/javascript",i.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(i)})),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",Ot(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),i=t.getProvider("heartbeat"),r=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Rf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:Em,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:kp(Em)},c=new Rp(n,i,r,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],i=(Array.isArray(n)?n:[n]).map(up);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(i,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Ot(new I("auth-internal",(t=>(t=>new vm(t))(Lp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Vt(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)),Vt(mm,ym,"esm2017");class _m extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Tm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Im extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class km{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Sm(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)})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,i,r,s,o;try{const a=Fh(this.firestore,"user_logging",e.uid),c=await Od(a),l=new Date,u=c.exists?c.data():null,h=null===(i=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===i?void 0:i.last_login;if(h&&ff(l).diff(ff(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(r=null==u?void 0:u.brands)||void 0===r?void 0:r[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 Md(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 Tm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return(await Od(Fh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=bd(Mh(this.firestore,"users"),Ed(new Qh("__name__"),"==",this.id));return e=Fd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await lg(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 Cm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((i=>{n=Fd(t,(t=>{i(t),e&&n()}))})),unsubscribe:()=>n()}};const t=zt(zd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",i=Dt("object"==typeof t?t:Bt(),"firestore").getImmediate({identifier:n});if(!i._initialized){const t=oe("firestore");t&&xh(i,...t)}return i}(t),this.user=new km(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const i=bd(Mh(this.firestore,t),e);return this.promisefyOnSnapshot(i,n)}getDocs(t,e){return Pd(bd(Mh(this.firestore,t),...e))}async getDoc(t,e){const n=Fh(this.firestore,t,e),i=await Od(n);return i.exists()?i.data():null}}const Am=t=>{if(t.code===Sf)throw new Error("account has been disabled");throw new Error(t.message)};class Rm{static get endpoint(){return zd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:i,useToken:r=!0}){const s=this.getUrl(e,r),o={method:n,headers:await this.getHeaders(t,r),credentials:"omit"};i&&(o.body=JSON.stringify(i));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,i){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:i})}static Put(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:i})}static Patch(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:i})}static Delete(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:i})}}class Lm{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 Tm;try{const i=await Rm.Get(this.user,`/styles/${t}/recommendation`),r=await i.json();return(null===(e=null==r?void 0:r.fits)||void 0===e?void 0:e.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new _m;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Rm.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 Im;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Im;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 i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(e.length?r.measurement_locations.female.filter((t=>e.includes(t))):r.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 i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(e.length?r.measurement_locations.female.filter((t=>e.includes(t))):r.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 i=[Ed("brand_id","==",this.brandId)];i.push(Ed("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",i)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Am(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 Am(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Am(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 Am(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 Am(t)}}}var Nm;!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"}(Nm||(Nm={}));const xm={[Nm.ACROSS_BACK]:"Across back",[Nm.ACROSS_FRONT]:"Across front",[Nm.ACROSS_SHOULDER]:"Across shoulder",[Nm.ANKLE]:"Ankle",[Nm.ARMEYE]:"Armeye",[Nm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Nm.BACK_CROTCH_LENGTH]:"Back crotch length",[Nm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Nm.BELOW_KNEE]:"Below knee",[Nm.BICEP]:"Bicep",[Nm.BUST]:"Chest/Bust",[Nm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Nm.CALF]:"Calf",[Nm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Nm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Nm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Nm.ELBOW]:"Elbow",[Nm.FOREARM]:"Forearm",[Nm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Nm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Nm.HIGH_HIP]:"High hip",[Nm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Nm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Nm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Nm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Nm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Nm.INSEAM]:"Inseam",[Nm.KNEE]:"Knee",[Nm.LOW_HIP]:"Low hip",[Nm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Nm.MID_NECK]:"Mid neck",[Nm.NECK_AT_BASE]:"Neck at base",[Nm.SHOULDER_DROP]:"Shoulder drop",[Nm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Nm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Nm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Nm.THIGH]:"Thigh",[Nm.TOTAL_RISE_LENGTH]:"Total rise length",[Nm.UNDER_BUST]:"Under bust",[Nm.VERTICAL_TRUNK]:"Vertical trunk",[Nm.WAIST]:"Waist",[Nm.WRIST]:"Wrist"};var Om;!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"}(Om||(Om={}));const Dm={[Om.BLOUSES]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.COATS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.DRESSES]:[Nm.LOW_HIP,Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST],[Om.JACKETS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.PANTS]:[Nm.LOW_HIP,Nm.WAIST,Nm.THIGH,Nm.INSEAM],[Om.PUFFERS_AND_PARKAS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.SHORTS]:[Nm.LOW_HIP,Nm.WAIST,Nm.THIGH,Nm.INSEAM],[Om.SKIRTS]:[Nm.LOW_HIP,Nm.WAIST],[Om.SWEATERS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.T_SHIRTS_AND_TANKS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP]},Pm={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"},Mm={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"},Fm={activewear:{leggings:Om.PANTS,joggers:Om.PANTS,sweatshirts:Om.SWEATERS},dresses:{a_line:Om.DRESSES,bodycon:Om.DRESSES,fit_and_flare:Om.DRESSES,knit:Om.DRESSES,shirt:Om.DRESSES,slip:Om.DRESSES,straight:Om.DRESSES,wrap:Om.DRESSES},jackets_and_coats:{denim_jackets:Om.JACKETS,parkas:Om.PUFFERS_AND_PARKAS,peacoats:Om.COATS,puffer_jackets:Om.PUFFERS_AND_PARKAS,raincoats:Om.COATS,rompers:Om.COATS,shackets:Om.JACKETS,trench_coats:Om.COATS},jeans:{bootcut:Om.PANTS,flared:Om.PANTS,mom:Om.PANTS,relaxed:Om.PANTS,skinny:Om.PANTS,slim:Om.PANTS,straight:Om.PANTS,tapered:Om.PANTS,wide_leg:Om.PANTS},jumpsuits_and_rompers:{boiler_suits:Om.DRESSES,denim:Om.DRESSES,jumpsuits:Om.DRESSES,overalls:Om.DRESSES,rompers:Om.DRESSES,unitards:Om.DRESSES},pants_and_shorts:{cigarette:Om.PANTS,culottes:Om.SHORTS,denim_shorts:Om.SHORTS,flared:Om.PANTS,joggers:Om.PANTS,leggings:Om.PANTS,skinny:Om.PANTS,wide_leg:Om.PANTS},skirts:{a_line_flared:Om.SKIRTS,denim:Om.SKIRTS,knit:Om.SKIRTS,pencil:Om.SKIRTS,pleated:Om.SKIRTS,skater:Om.SKIRTS,slip:Om.SKIRTS,wrap:Om.SKIRTS},suits_and_tailoring:{blazers:Om.JACKETS,suit_jackets:Om.JACKETS,suit_skirts:Om.SKIRTS,suit_trousers:Om.PANTS,suit_vests:Om.SWEATERS,trousers:Om.PANTS},sweaters:{cardigans:Om.SWEATERS,crewnecks:Om.SWEATERS,hoodies_and_zipups:Om.SWEATERS,sweatshirts:Om.SWEATERS,turtlenecks:Om.SWEATERS,v_necks:Om.SWEATERS},tops:{bodysuits:Om.BLOUSES,corsets_and_bustiers:Om.BLOUSES,polos:Om.T_SHIRTS_AND_TANKS,shirts_and_blouses:Om.BLOUSES,t_shirts:Om.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Om.T_SHIRTS_AND_TANKS}};var Um;!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"}(Um||(Um={}));const zm={[Um.TOO_TIGHT]:"Too Tight",[Um.TIGHT]:"Tight",[Um.SLIGHTLY_TIGHT]:"Slightly Tight",[Um.PERFECT_FIT]:"Perfect Fit",[Um.SLIGHTLY_LOOSE]:"Slightly Loose",[Um.LOOSE]:"Loose",[Um.OVERSIZED]:"Oversized",[Um.TOO_SHORT]:"Too Short",[Um.SHORT]:"Short",[Um.SLIGHTLY_SHORT]:"Slightly Short",[Um.SLIGHTLY_LONG]:"Slightly Long",[Um.LONG]:"Long",[Um.TOO_LONG]:"Too Long"};var Bm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Bm||(Bm={}));var Vm=Object.freeze({__proto__:null,get AvatarState(){return Bm},get MeasurementLocation(){return Nm},MeasurementLocationName:xm,get Classification(){return Om},ClassificationLocations:Dm,CategoryNames:Pm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Mm,Taxonomy:Fm,get Fit(){return Um},FitNames:zm}),Hm="Back to sign in",jm="Click here to download the app",qm="Don't have an account?",$m="Whoops! Looks like you don't have an avatar yet.",Km="Email address",Wm="Please enter a valid email address.",Gm="Enter your email address, we will send you a link to reset your password.",Qm="Forgot password?",Ym="Have an account? Sign in",Jm="Your avatar is loading...",Xm="Unfortunately, that size is not available for try on.",Zm="or",ty="Password",ey="Please enter a valid password (at least 7 characters).",ny="Return to Catalog Page",iy="Return to Product Page",ry="Return to site",sy="Please return to The Fitting Room app to create your avatar.",oy="Scan to download the app",ay="Send",cy="Sign back in",ly="Sign in",uy="Something went wrong. Try again!",hy="You have successfully logged out!",dy="The Fitting Room",fy="Username or password is empty.",py="Username or password is incorrect.",gy="End size uncertainty with",my="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var yy=[],vy=[];function wy(t,e){if(t&&"undefined"!=typeof document){var n,i=!0===e.prepend?"prepend":"append",r=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(r){var o=yy.indexOf(s);-1===o&&(o=yy.push(s)-1,vy[o]={}),n=vy[o]&&vy[o][i]?vy[o][i]:vy[o][i]=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),r=0;r<n.length;r++)t.setAttribute(n[r],e.attributes[n[r]]);var o="prepend"===i?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}wy(".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)}",{});wy('#fit-title{margin-bottom:20px;margin-top:-30px}#fit-subtitle,#fit-title{color:#209da7;font-size:24px;font-weight:700}#fit-subtitle{position:absolute;right:17px;top:100px}#fit-subtitle-mobile{color:#7d7d7d;font-size:24px;font-weight:700;margin-top:20px}#fit-outline-container{display:flex;justify-content:center}#fit-outline-inner{position:relative}#fit-outline-inner,#tfr-fit-outline-img{width:184px}#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right,#tfr-fit-outline-img{height:701px}#fit-outline-inner-left,#fit-outline-inner-right{position:relative;width:260px}#fit-outline-container .fit-outline-line{display:block}.fit-outline-line{background:#000;height:1px;position:absolute}.fit-outline-line-text{border-bottom:1px solid #000;font-size:24px;position:absolute}.fit-outline-line-chest-text{left:-11px;text-align:right;top:163px;width:254px}.fit-outline-line-n-waist-text{left:-11px;text-align:right;top:208px;width:254px}.fit-outline-line-p-waist-text{right:-10px;text-align:left;top:233px;width:253px}.fit-outline-line-h-hip-text{left:-3px;text-align:right;top:255px;width:246px}.fit-outline-line-l-hip-text{left:-3px;text-align:right;top:302px;width:246px}.fit-outline-line-thigh-text{right:3px;text-align:left;top:341px;width:240px}.fit-outline-line-chest{left:42px;top:194px;width:99px}.fit-outline-line-n-waist{left:50px;top:239px;width:83px}.fit-outline-line-p-waist{left:45px;top:264px;width:93px}.fit-outline-line-h-hip{left:30px;top:286px;width:122px}.fit-outline-line-l-hip{left:21px;top:333px;width:141px}.fit-outline-line-thigh-l{left:27px;top:372px;width:60px}.fit-outline-line-thigh-r{left:95px;top:372px;width:61px}#fit-line-container{position:relative;width:100%}#fit-line-text-container{align-items:center;display:flex;justify-content:space-between}.fit-line-item{font-weight:700;width:110px}.fit-line-item .light-text{font-weight:500}.fit-line-item-green{color:#209da7}#fit-line{display:flex;justify-content:space-around;margin-bottom:4px;margin-top:30px}#fit-line-1,#fit-line-2,#fit-line-3,#fit-line-4,#fit-line-5,#fit-line-6,#fit-line-7{background:#000;height:2px;position:relative;width:110px}#fit-line-3,#fit-line-4,#fit-line-5{background:#209da7}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before,#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{background:#000;border-radius:50%;content:"";height:12px;position:absolute;top:-5px;width:12px}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before{left:0}#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{right:0}#fit-line-1:before,#fit-line-2:before,#fit-line-6:before,#fit-line-7:before{background:#000}#fit-line-3:before,#fit-line-5:before{background:#209da7}#fit-line-2:before,#fit-line-6:before{display:none}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after{border-left:2px dashed #000;content:"";display:block;height:20px;left:50%;position:absolute;top:-20px}#fit-line-3:after,#fit-line-4:after,#fit-line-5:after{border-left:2px dashed #209da7}#fit-line-texts{display:flex;justify-content:space-between;padding:0 70px}#fit-line-texts div:nth-of-type(2){color:#209da7}.margin-top-10{margin-top:10px}.desktop-hidden{display:none}#cta-link{cursor:pointer;font-size:20px;margin:auto;text-decoration:underline;width:150px}.powered-by{align-items:center;display:flex;justify-content:center;margin-top:10px}@media screen and (max-width:599px){#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right{height:400px}#fit-outline-inner{flex-shrink:0;overflow:hidden}#fit-title{margin-top:0}#fit-outline-container{margin-top:-50px;transform:scale(.7)}.fit-line-item{font-size:10px;font-weight:500}.fit-outline-line-text{font-size:16px;line-height:31px}.fit-outline-line-chest-text,.fit-outline-line-n-waist-text{left:-11px;width:auto}.fit-outline-line-p-waist-text{right:-10px;width:auto}.fit-outline-line-h-hip-text,.fit-outline-line-l-hip-text{left:-3px;width:auto}.fit-outline-line-thigh-text{right:3px;width:auto}#fit-line{margin-top:10px}#fit-line-texts{font-size:12px;padding:0 15px}#cta-section{margin-top:-30px}#fit-line-2:before,#fit-line-6:before,.desktop-hidden{display:block}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after,.mobile-hidden{display:none}}',{});wy(".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{padding-right:10px}.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{display:flex;margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;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}.tfr-door-icon,.tfr-user-icon{color:#209da7}.tfr-logged-in,.tfr-toggle-closed{display:none}.tfr-flex{display:flex}.tfr-gap{gap:4px}.tfr-items-center{align-items:center}.tfr-mb-2{margin-bottom:8px}#tfr-logged-out-overlay-container{position:relative}#tfr-logged-out-overlay{align-items:center;background:hsla(0,0%,100%,.8);bottom:0;display:flex;font-size:16px;font-weight:700;justify-content:center;left:0;line-height:16px;position:absolute;right:0;text-align:center;top:0}",{});wy("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}",{});wy(".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)}}",{});wy("@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-small-text{font-size:12px}.tfr-mobile-hidden{display:none}.tfr-modal-content{overflow:hidden}.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-height:800px){.tfr-video-responsive{height:280px!important}}",{});wy("#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-info-icon{cursor:pointer}#tfr-size-rec-subtitle{border-bottom:2px solid #000;font-size:18px;font-weight:700;text-align:center;width:100%}#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;text-align:left}.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):not(.tfr-disabled){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,.tfr-powered-by-logo svg{height:24px;width:12px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}.tfr-disabled{cursor:default}#tfr-login-to-view{cursor:pointer}",{});wy(".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%}",{});wy(".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}",{});wy(".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}",{});wy(":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 by='\n<svg class="tfr-door-icon" width="68" height="124" 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="currentColor">\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>',Sy='<svg class="tfr-user-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_82_11365)">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M4.3125 4.78125C4.3125 3.02084 5.73959 1.59375 7.5 1.59375C9.26041 1.59375 10.6875 3.02084 10.6875 4.78125C10.6875 6.54166 9.26041 7.96875 7.5 7.96875C5.73959 7.96875 4.3125 6.54166 4.3125 4.78125ZM9.625 4.78125C9.625 3.60764 8.6736 2.65625 7.5 2.65625C6.32639 2.65625 5.375 3.60764 5.375 4.78125C5.375 5.95485 6.32639 6.90625 7.5 6.90625C8.6736 6.90625 9.625 5.95485 9.625 4.78125Z"\n fill="currentColor" fill-opacity="0.7" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M2.1875 13.1634C2.1875 10.5693 4.58181 8.5 7.5 8.5C10.4182 8.5 12.8125 10.5693 12.8125 13.1634C12.8125 16.1539 2.1875 16.1539 2.1875 13.1634ZM11.75 13.1634C11.75 11.1933 9.86303 9.5625 7.5 9.5625C5.13697 9.5625 3.25 11.1933 3.25 13.1634C3.25 13.7564 4.45689 14.126 5.96113 14.2721L6.31312 14.3019C7.08543 14.3577 7.91457 14.3577 8.68688 14.3019L9.03887 14.2721C10.5431 14.126 11.75 13.7564 11.75 13.1634Z"\n fill="currentColor" fill-opacity="0.7" />\n </g>\n <defs>\n <clipPath id="clip0_82_11365">\n <rect width="16" height="16" fill="white" />\n </clipPath>\n </defs>\n</svg>',Ey=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const i=t/200;e.style.width=n+"%";const r=setInterval((()=>{n>=100?clearInterval(r):(n+=.5,e.style.width=n+"%")}),i)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Jm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `,useFullModalContent:!0}),_y=t=>{const e=document.getElementById(t),n=document.querySelector("body");if(!e)throw new Error(`element with id ${t} not found`);let i;const r=t=>t?`\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">${gy}</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">${dy}</div>\n </div>\n </div>\n `:"",s=()=>{n.style.overflow="auto",i&&(i.Unhook(),l()),e.style.display="none"},o=t=>{"Escape"===t.key&&s()},a=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),s())},c=()=>{e.querySelector("#tfr-close-container").addEventListener("click",s),document.addEventListener("keydown",o),document.addEventListener("click",a)},l=()=>{var n;const i=e.querySelector("#tfr-close-container");i?i.removeEventListener("click",s):(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",o),document.removeEventListener("click",a)};return{open:t=>{var s,o;n.style.overflow="hidden",i&&i.Unhook(),e.innerHTML=(s=t.Body(),o=t.useFullModalContent,console.log({useFullModalContent:o}),`\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">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n ${r(o)}\n ${s}\n </div>\n </div>\n </div>\n </div>\n `),c(),t.Hook(),e.style.display="block",i=t},close:s,Content:()=>i}},Ty=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},i=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},r=()=>{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",i),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",r)},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",i),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",r)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${my}</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">${oy}</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">${Ym}</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">${jm}</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">${Ym}</div>\n `:""}\n `,useFullModalContent:!0}};class Iy{constructor(t,e,n,i){this.signIn=e,this.forgotPassword=n,this.submitTel=i,this.manager=_y(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,i;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.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">${hy}</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">${cy}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${ry}</span>\n </div>\n `,useFullModalContent:!0}})({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">${$m}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${sy}</div>\n `,Hook:()=>{},Unhook:()=>{},useFullModalContent:!0})}onLoading(){this.manager.open(Ey({timeoutMS:1e4}))}toScan(){this.manager.open(Ty({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,i=document.getElementById("password-input").value;s(),t.onSignIn(n,i,o)},i=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},r=()=>{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",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",r)},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",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",r)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${ly}</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">${Km}</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">${ty}</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">${Qm}</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">${qm}</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 ${ly}\n </button>\n </form>\n `,useFullModalContent:!0}})({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,i;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.addEventListener("click",e)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.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">${Gm}</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">${Km}</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">${Hm}</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 ${ay}\n </button>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const i=()=>{t.onNavBack()},r=()=>{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",i),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",i),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",r)},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">${ny}</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">${iy}</span>\n </div>\n `,useFullModalContent:!0}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},i=()=>{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",i)},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",i)},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||uy}</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">${ny}</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">${iy}</span>\n </div>\n `),useFullModalContent:!0}})({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,i;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>{var e,n,i;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${Xm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Zm} ${null===(i=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===i?void 0:i.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">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${iy}</span>\n </div>\n `},useFullModalContent:!0}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}toFitInfo(){this.manager.open((t=>{const e=()=>t.onSignInNav();return{Hook:()=>{document.getElementById("cta-link").addEventListener("click",e)},Unhook:()=>{document.getElementById("cta-link").removeEventListener("click",e)},Body:()=>`\n <div>\n <div id="fit-title">Fit Scale</div>\n\n <div id="fit-line-container">\n <div id="fit-line-text-container">\n <div class="fit-line-item mobile-hidden">Too Tight</div>\n\n <div class="fit-line-item">\n <div>Tight <span class="light-text">or</span><br /> More fitted</div>\n\n <div class="desktop-hidden margin-top-10">Too Tight</div>\n </div>\n\n <div class="fit-line-item fit-line-item-green">Slightly tight <br /><span class="light-text">or</span> Fitted</div>\n <div class="fit-line-item fit-line-item-green">Perfect Fit</div>\n <div class="fit-line-item fit-line-item-green">Slightly loose <br /><span class="light-text">or</span> Less fitted</div>\n\n <div class="fit-line-item">\n <div>Loose <span class="light-text">or</span><br /> Not fitted</div>\n\n <div class="desktop-hidden margin-top-10">Oversized</div>\n </div>\n\n <div class="fit-line-item mobile-hidden">Oversized</div>\n </div>\n\n <div id="fit-line">\n <div id="fit-line-1" class="mobile-hidden"> </div>\n <div id="fit-line-2"> </div>\n <div id="fit-line-3"> </div>\n <div id="fit-line-4"> </div>\n <div id="fit-line-5"> </div>\n <div id="fit-line-6"> </div>\n <div id="fit-line-7" class="mobile-hidden"> </div>\n </div>\n\n <div id="fit-line-texts">\n <div>Poor Fit</div>\n <div>Acceptable Fit</div>\n <div>Poor Fit</div>\n </div>\n </div>\n\n <div id="fit-subtitle-mobile" class="desktop-hidden">Measurement Points</div>\n\n <div id="fit-outline-container">\n <div id="fit-outline-inner-left">\n <div class="fit-outline-line-text fit-outline-line-p-waist-text">Pant Waist</div>\n <div class="fit-outline-line-text fit-outline-line-thigh-text">Thigh</div>\n </div>\n\n <div id="fit-outline-inner">\n <div class="fit-outline-line fit-outline-line-chest"></div>\n <div class="fit-outline-line fit-outline-line-n-waist"></div>\n <div class="fit-outline-line fit-outline-line-p-waist"></div>\n <div class="fit-outline-line fit-outline-line-h-hip"></div>\n <div class="fit-outline-line fit-outline-line-l-hip"></div>\n <div class="fit-outline-line fit-outline-line-thigh-l"></div>\n <div class="fit-outline-line fit-outline-line-thigh-r"></div>\n\n <img id="tfr-fit-outline-img" src="https://assets.dev.thefittingroom.xyz/images/fit-outline.png" />\n </div>\n\n <div id="fit-outline-inner-right">\n <div id="fit-subtitle" class="mobile-hidden">Measurement Points</div>\n\n <div class="fit-outline-line-text fit-outline-line-chest-text">Chest/Bust</div>\n <div class="fit-outline-line-text fit-outline-line-n-waist-text">Natural Waist</div>\n <div class="fit-outline-line-text fit-outline-line-h-hip-text">High Hip</div>\n <div class="fit-outline-line-text fit-outline-line-l-hip-text">Low Hip</div>\n </div>\n </div>\n </div>\n\n <div id="cta-section">\n <div id="cta-link">Sign Up or Login</div>\n\n <div class="powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${by}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n `,useFullModalContent:!1}})({onSignInNav:()=>this.toScan(),onClose:()=>this.close()}))}navBack(){window.history.back()}}class ky{constructor(t,e,n,i){this.onSignInClick=e,this.onSignOutClick=n,this.onFitInfoClick=i,this._sku="",this.isLoggedIn=!1,this.tfrLoggedInElements=[],this.tfrLoggedOutElements=[],this.tfrToggleOpenElements=[],this.tfrToggleClosedElements=[],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",this.tfrSizeRecSelect.style.display="flex",this.tfrSizeHowItFits.style.display="block",t?(this.tfrSizeRecSelect.style.opacity="1",this.tfrLoggedInElements.forEach((t=>t.style.display="block")),this.tfrLoggedOutElements.forEach((t=>t.style.display="none")),this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down")):(this.tfrSizeRecSelect.style.opacity="0.4",this.tfrLoggedInElements.forEach((t=>t.style.display="none")),this.tfrLoggedOutElements.forEach((t=>t.style.display="block")),this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.renderSizeRecSelectLoggedOut())}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){t&&t.length?this.renderGarmentLocations(t):this.tfrSizeRecTitle.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e)}setError(){this.tfrSizeRecTitle.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.tfrInfoIcon=document.getElementById("tfr-info-icon"),this.tfrLoginToView=document.getElementById("tfr-login-to-view"),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"),this.tfrLoggedInElements=document.querySelectorAll(".tfr-logged-in"),this.tfrLoggedOutElements=document.querySelectorAll(".tfr-logged-out"),this.tfrToggleOpenElements=document.querySelectorAll(".tfr-toggle-open"),this.tfrToggleClosedElements=document.querySelectorAll(".tfr-toggle-closed")}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)),this.tfrInfoIcon.addEventListener("click",this.onFitInfoClick),this.tfrLoginToView.addEventListener("click",this.onSignInClick)}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button")||e.classList.contains("tfr-disabled"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const i=document.querySelectorAll(".tfr-size-rec-select-button");i.forEach((t=>t.classList.remove("active"))),i.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=` ${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],i=n.map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=i}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}renderSizeRecSelectLoggedOut(){const t=['<div class="tfr-size-rec-select-button tfr-disabled">M</div>','<div class="tfr-size-rec-select-button tfr-disabled active">L</div>','<div class="tfr-size-rec-select-button tfr-disabled">XL</div>'].join("");this.tfrSizeRecSelect.innerHTML=t}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>`}renderGarmentLocations(t){const e=t.map(((t,e)=>this.renderSizeRecTableRow(t,this.randomFit(e),!0))).join(""),n=`<div id="tfr-logged-out-overlay-container">\n <div id="tfr-logged-out-overlay">\n Login to reveal how this item will fit specifically at each area of your body in different sizes\n </div>\n <div>\n ${e}\n </div>\n </div>`;this.tfrSizeRecTable.innerHTML=n}randomFit(t){const e=["Slightly Tight","Perfect Fit","Perfect Fit","Slightly Loose","Perfect Fit"];return e[t%e.length]}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrToggleOpenElements.forEach((t=>t.style.display="block")),this.tfrToggleClosedElements.forEach((t=>t.style.display="none"))):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrToggleOpenElements.forEach((t=>t.style.display="none")),this.tfrToggleClosedElements.forEach((t=>t.style.display="block")))}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 class="tfr-logged-out">\n <div class="tfr-flex tfr-gap tfr-mb-2 tfr-mobile-small-text">\n <div>Uncertain of your size?</div>\n \n <div class="tfr-toggle-closed">\n <div class="tfr-flex tfr-items-center">\n <div>Try</div>\n <div class="tfr-powered-by-logo">${by}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n\n <div class="tfr-toggle-open">\n <div id="tfr-login-to-view" class="tfr-flex tfr-items-center">\n ${Sy} Login to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-logged-in">\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 ${Sy} Sign up to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-toggle-open" style="width: 100%">\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">\n How it fits\n <span id="tfr-info-icon"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<rect width="13" height="13" fill="url(#pattern0_641_1375)"/>\n<defs>\n<pattern id="pattern0_641_1375" patternContentUnits="objectBoundingBox" width="1" height="1">\n<use xlink:href="#image0_641_1375" transform="scale(0.00793651)"/>\n</pattern>\n<image id="image0_641_1375" width="126" height="126" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAB+CAYAAADiI6WIAAAAAXNSR0IArs4c6QAADKtJREFUeF7tnc2S2zYSgLuh9VwzeYJVniDjJ7Asb06p8mhqj6nKDFN7j/wEkp/A4/MeqMllj9L4umWJfgIrT2D5CaK9ZlfATlOkLWn0g8aPCJLSJakxSIL4uhvdjQaIULFfKx42AeCiIcRflYImgDpXAE0E+n8ASP+25YcwUwrmgDAXAHMFOEOE2ULK358AzP8dXU2rNFRY5pdpxcNzAGgJFM8Q1IVScAEA9Dcfv7lCmCLgVCr5AQCmSXQ18/GgY9yzdOD/Fg9bEsWlUqqFkIIu7KcApoiYSCXvk+gqKawjBg8uBfgcNih141GjDYZv7RLS/kSCuiuDEAQLnsz4w1zbBcTrnfOyLSp/189QYH8h5YdQp4PgwC+1O4XdCVi7OSIzkKBehyYAwYAn4AqxpxS0OKNaorZBCUDh4Cn8aiDGFQa+KZtBCEBh4LM5vA+Av5ZIa112tVABKAR8Ox7eAOCbiszhNsKQOoHvry/vbG5icu1RwdfQrOsyObr2Hw18Kx7eiJOW7xOEo2q/d/AFzeWUTJkCpvn2qQScK7n4LM7O/pB//vmfJLqarxJI+3h29k1jsUjz+FKl6d8mKnUhV/P8uvpr1Q5vJUgK/9b6aHXLLRd7BU+mXQBOIF8gcd377H556lQhJkouKGnidNBIMFA0nqFSrSOlimcS1HOfsb838GkiBnDoy4FTAIkQOFpISSlSp6APyWe2AthqAF4/9MNX3oHgR77Sv17At+NhN/PaD40h698VwEwBDgDk22PD3tXRXAgQsPdl6Zf1VvsbZ1m/vsNbprdyDr4dDyk277nsKGk3NER/8vNLWg4N9vf87t2lkLLr2gr4gO8UvGvoZQG+KYk//PbumVzIvksBcA3fGXiX0MsKfJsA/G8hB66mAJfwnYB3CH0uAftJdPk2WHtu0DHKYbjyAVzBtwbvCjppuVp6saUtZ9onE2loi9gDBVRMYvVzAd8KvCPoldTyPVFAVyydX8vaQPVqHF3dmkqQMfgsTqfkjPFvGZ75TVQYd87jhaT9CDixnfuzJI9RrZ8ReEcZuVGWoDhq8sUjT9atl6lsjB9Sy1RpZPqbS1BPTaZHNviswx9t0rCZA/fa9G2rdF07vu89FPvbJGgow0fwWQrEBt+Oh7c2xRMn6I/F1h4+3o6jy1cchWCBzwooyDwZ/U7Qdw+bLXyp8Cb5Rb+gQxu87bx+gn5YVyzhs+Z7bfDtwSg2jUFP0A9Dz1vYwKdcyCTqPNd5mhZ4GxNfJPTmP//VAgHskBPVWfPTP/7+WWcAfbSxgY8Cb3Rq+A6CtzTxo3HUufIxODr3LCt4erd2PKJaBpNQj0z+d4e8/IPgTU18lpxhhxk6QHXblBl8WvUD+NEsyXPYy98LPtP2T7oDvdKO5WgY3F/rkjKDpxfMxp9yJuz0bqb1O9c99oI31faH4sZuCCtsZQefwafcPu1BYP0OOXo7wVto+2AcdSJWLz01rgJ4GpoX8WhiUtSxL5e/E7yJtoe26FIV8KYmf5/WbwVvqu1S4E1SwHagXQajKuBtTP4urd8K3lTbJ1HnO09W2+i2VQJvYfK3Tr2PwJtqu2qIVmhVsFUDb1gDsTWufwTeJEt3yIM0UlcHF1UNvKnWS4H95PpybRl8C/gRxe3bz4LbASNEbaeuVhG8odbPxhvT8Bp4k5uGqu0ODEawtzAJ7zadvDXwRk6dEJ3J9cv7YEepgh0zUVBAvB3ffC3WWAcf88w8xe2hefIV5Lz1lZ7Ho0/MPP58HHW+zW/2BbyJFIUWt9cFOr1n++6+B5JXq7dq7r+Abw/u34BSXc7gHVoI4Nzr1JY3AlnR6x+sq1bM/RfwL+LRR8U4G/bk1LGG3EtjrpNHB0hMos5T6kwK3iRpUwYzn4ZzDWAXh6I8axVZgaMrJS/u7n9VUrF200hQ31KRRgr+RTzsqOXpFdq/Mpj5Ksbxq4BMzL3KorAUPHd+XzUZ2pJSQMOqg88yeawpOg/rlho/GE1YR4puxIQFMNV6ZB3AGyhtWom71Ph4RN6hdnlPbi60Rr/ARnUAbzBNp/E8tuLhhQCkui7tX+4gaF9QUMM6gDeZ5+HsSRO5iZsyZevqAH7po40+cT7mQBYbuSFBmeL3GoEfZh920LKtKLCLXOdgM9mv9aSCGtUHPDPriniL7cGILS3vr8txOFFtwC+PgeckqgbIDeVCLbrYZlTqAp7r2dN0jewcfYC1dbtmkrqAN4jMZmTqWR4hhQLjn34sbCcpx12oEXg6JZyz1W2G7XikOINZlhie3qlG4OkgJdYSLRv8OOoc3GHLESSfbesCPsu+shT4BH6L5BV9MIKJMnAt9wn8CbyenJ1Mvd44HbuVd40/OXfHRnr4eSYLNadwrgKm3qB0jh/HZ8dnTg/LYfEt6uLVG6ywTvkp2xLtnDmB3658acqWu21K9xy14vW9Pgkc7tI6AIxOy7IVmONNltbZhRgkLUUeWsixJHUx9dwV1rQQg7ukBwCP9lpzYByzbV3At7mbXRuiRcWW3JUdKEssXwfwJjE8RWan8uqSz/EGFntZXk3vzd18V5a6uzpoPNexy4tlT1uoSq/xvF3O61uozDZNprsuj+mscZ9VdY038c/WNk2aOAgUEoRebVt18CZH0+W7nCt9MELVwXPj90cHI6SlO2ZHoQRt7qsM3sTMrzrltocfPToxkTsP+2xfZfAmZn51T8TmcWes7dKhZ/GqDd7uaLqNAw6Ze7AAKIv3PImujD5s61Pbq1xebZC0oeFYO8W60keaVlXjuU4dUd/c+vb4EGPuzpqAtb6K4LnVNin0LSeQPgZvcGJiqHvmqwjeRNu3HU237UMFtB2H9mFpn4lDUhXiXF818CbanrGhDxCufYrM5adJtL9r6tupy+9fNfDcdfdsHPQ+TUKNTSULQL0aR1eskxZ9CkGVwJvE7bu0nf6+cwMke6l2STCIL0xWTeMtvu+78xuAO8Gban1Ijl5VNJ5bCZ0L/r5jZ/dueTbUegoggjD5VQDfjoddMPjE6GbCZnNK3QveaCEgIJNfdvCmX5jcN7fnAnDwkIN2fP8GgPcBg+zms2y7VWHFGmUGn9VI0ImjrC+C7fPkV7X+IPisA+y4PntIoTX4ZQbfjkd0jHyHG/Xoft/3IHh6cCse3gjeOWpf+itBvU6iqz73BVy0Lyv4djzsA2DPZAx0PyChBZ46YO7opVm9QuCXEbwN9EMOHcvU541tHI3M2Tg6/LKBt4Gua+K1nbtVKbEx+UXBNzGXRVxjAz0dW+Yn3LVNfT4YFl5+eouizH4RMHWfaQsdAG/H0devSOo8lw2evHwE/Mj8yuFaX07wvw6HLfTMxD/l7nFgg8+8fNpoSTEma+l2QxJHElTE7bCONJehTRYm04nT7JAtfz/uvG7k3G0Opmkuf+M+lOShmr21teIygLPpo8Wiy9pjbU4SN9L4FU+/K8zyyKsvMAdQr0NazrWBeujaLPdOMbqNtQQJ2E+iy9eHnrfr363A003b8X3voarLRYJmkM39ldR+0vIGYsz6zNsOarbQ6bbW4B3Dn6HA/vvryztTSQ7xOldavoyK7DQ9Hx8n4B3Dp9vR3E+OX5D1+rrCRX6QQuy50HKX0J1pfD4QDs1+ekuFkCiVpntLJQCugbuG7hy8B81fFYC3SXQ10tW2Itr5AO4DuhfwvuBnIFMfYCHlh1BCwGU8DlQlc224dr5XRiVgN4ncf/XL2Ry/2XuS/gVgbJPh2zciNA0IxEERQkCwG0Jcg1IdV/P3lnedq4boTH5++cGH9fIGnjpLIQwCTnzBzweENvwjYiKVpEFKXGcDCTS9jkDxTCnVQoALHzBW3memPCe2vILP4J8LEBTrd30O1sa9ZwphhoBTRJgtpPw9nyqoBHxTMDKw508Azv8L0BSUXEHxPYJqKoKsjMqfDF8XbyVIcmi9lqx5B5+/PS3pImDPt/YbjnYIl82lwm7yy3FyGEcDn5t+gdgDBTchjHQofaC9CGqZtzha1vKo4E/a/0jU5lJgNykgU1kI+JP2p5H0UebyXVatMPAr2t+sk/kvwqxvg184+LoIAAGHhuj7isu5/kow4CsqABSSjVRDDEIBno9zcOBXBYCSJiUNAWcScAAgaX3BazzO1fTgwa++0A+/vXu2kPKG0qMB5wHmgDhQAkehaXfQc7yu5C6FgHLk/lOnh/qUp4rLAnv1fYI19YcGPQ8JUTS+RxICpS7S9KplLdue584z0FOFmCi5oBXCIM24ztiVGvy2F2zFw4snjcY3kgSBcuxKNRHgXAKc03/3LJ2mWTMEmFHZMiDOKc8vAWf4l8Z0/NOPn3UGtCxt/g+79EmQczmdsgAAAABJRU5ErkJggg=="/>\n</defs>\n</svg>\n</span>\n </div>\n\n <div id="tfr-size-rec-table"></div>\n </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-toggle-open">\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${by}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class Cy{constructor(t,e,n,i,r,s){this.tfrShop=n,this.onSignInClick=i,this.onSignOutClick=r,this.onFitInfoClick=s,this.perfectFits=[Vm.Fit.PERFECT_FIT,Vm.Fit.SLIGHTLY_LOOSE,Vm.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new ky(t,this.onSignInClick,this.onSignOutClick,this.onFitInfoClick)}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:"string"==typeof t.fit_label&&t.fit_label?t.fit_label:Vm.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 Ay;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Ay||(Ay={}));class Ry{constructor(t,e,n,i={},r,s){this.shopId=t,this.hooks=i,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 Iy(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"),zd.getInstance().setEnv(e),new Lm(t,new Cm)))(Number(this.shopId),o),this.tfrSizeRec=new Cy(n,r,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this),this.onFitInfoClick.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 i;if(0==t.length||0==e.length)return n(fy);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Wm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(ey);try{await this.tfrShop.user.login(t,e),(null===(i=this.hooks)||void 0===i?void 0:i.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(py)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(uy)}}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()}onFitInfoClick(){this.tfrModal.toFitInfo()}onUserProfileChange(t){var e,n,i,r;switch(t.avatar_status){case Ay.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError($m),this.tfrModal.onNotCreated();break;case Ay.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Ay.CREATED:(null===(i=this.hooks)||void 0===i?void 0:i.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(r=this.hooks)||void 0===r?void 0:r.onError)&&this.hooks.onError(uy),this.tfrModal.onError(uy)}}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),i=(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(i)}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 Ly=async(t,e,n,i={},r={},s="dev")=>{const o=new Ry(t,e,n,i,r,s);return await o.onInit(),o};export{n as InitImageSlider,Ly as initFittingRoom};
|
|
3312
|
+
const bm=h("authIdTokenMaxAge")||300;let Sm=null;function Em(t=Bt()){const e=Dt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Dt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;If(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:mm,persistence:[Ng,pg,mg]}),i=h("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(i,location.origin);if(location.origin===t.origin){const e=(r=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>bm)return;const i=null==e?void 0:e.token;Sm!==i&&(Sm=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,i){T(t).onIdTokenChanged(e,n,i)}(n,(t=>e(t)))}}var r;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&&Up(n,`http://${s}`),n}var _m;!function(t){Op=t}({loadJS:t=>new Promise(((e,n)=>{const i=document.createElement("script");i.setAttribute("src",t),i.onload=e,i.onerror=t=>{const e=kf("internal-error");e.customData=t,n(e)},i.type="text/javascript",i.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(i)})),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="}),_m="Browser",Ot(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),i=t.getProvider("heartbeat"),r=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Lf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:_m,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Cp(_m)},c=new Lp(n,i,r,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],i=(Array.isArray(n)?n:[n]).map(hp);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(i,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Ot(new I("auth-internal",(t=>(t=>new wm(t))(Np(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Vt(ym,vm,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}}(_m)),Vt(ym,vm,"esm2017");class Tm extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Im extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class km extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Cm extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Am extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Rm extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Lm="avatar not created";class Nm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Em(e),this.auth.setPersistence(pg)}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(e.uid),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,i,r,s,o;try{const a=Fh(this.firestore,"user_logging",e.uid),c=await Dd(a),l=new Date,u=c.exists?c.data():null,h=null===(i=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===i?void 0:i.last_login;if(h&&pf(l).diff(pf(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(r=null==u?void 0:u.brands)||void 0===r?void 0:r[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 Fd(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 Dd(Fh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=Sd(Mh(this.firestore,"users"),_d(Yh(),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}watchUserProfileForFrames(t){let e;const n=Sd(Mh(this.firestore,"users"),_d(Yh(),"==",this.id));return new Promise((i=>{e=Ud(n,(async n=>{await t(n)&&(e(),i(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 cg(this.auth,t)}async confirmPasswordReset(t,e){await lg(this.auth,t,e)}}class xm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((i=>{n=Ud(t,(t=>{i(t),e&&n()}))})),unsubscribe:()=>n()}};const t=zt(Bd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",i=Dt("object"==typeof t?t:Bt(),"firestore").getImmediate({identifier:n});if(!i._initialized){const t=oe("firestore");t&&xh(i,...t)}return i}(t),this.user=new Nm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const i=Sd(Mh(this.firestore,t),e);return this.promisefyOnSnapshot(i,n)}getDocs(t,e){return Md(Sd(Mh(this.firestore,t),...e))}async getDoc(t,e){const n=Fh(this.firestore,t,e),i=await Dd(n);return i.exists()?i.data():null}}const Om=t=>{if(t.code===Ef)throw new Error("account has been disabled");throw new Error(t.message)};class Dm{static get endpoint(){return Bd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:i,useToken:r=!0}){const s=this.getUrl(e,r),o={method:n,headers:await this.getHeaders(t,r),credentials:"omit"};i&&(o.body=JSON.stringify(i));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,i){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:i})}static Put(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:i})}static Patch(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:i})}static Delete(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:i})}}const Pm=t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))};class Mm{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 i=await Dm.Get(this.user,`/styles/${t}/recommendation`),r=await i.json();return(null===(e=null==r?void 0:r.fits)||void 0===e?void 0:e.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(t){if((null==t?void 0:t.error)===Lm)throw new Tm;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Dm.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 km;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new km;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 i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(e.length?r.measurement_locations.female.filter((t=>e.includes(t))):r.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 i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(e.length?r.measurement_locations.female.filter((t=>e.includes(t))):r.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 i=[_d("brand_id","==",this.brandId)];i.push(_d("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",i)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Om(t)}}async getColorwaySizeAssets(t,e){const n=[_d("brand_id","==",this.brandId)];t&&n.push(_d("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(_d("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 Om(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Om(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 Am))throw t;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e){var n,i,r;try{const s=[_d("brand_id","==",this.brandId)];s.push(_d("style_id","==",t)),s.push(_d("size_id","==",e));return null===(r=null===(i=null===(n=(await this.firebase.getDocs("colorway_size_assets",s)).docs)||void 0===n?void 0:n[0])||void 0===i?void 0:i.data())||void 0===r?void 0:r.sku}catch(t){return Om(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Om(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 Om(t)}}async requestThenGetColorwaySizeAssetFrames(t){const[e,n]=await(i=this.getColorwaySizeAssetFromSku(t),i.then((t=>[null,t])).catch((t=>[t])));var i;if(e)throw e;try{return await this.requestColorwaySizeAssetFrames(n.id),this.awaitColorwaySizeAssetFrames(t)}catch(e){if((null==e?void 0:e.error)===Lm)throw new Tm;throw new Rm}}async awaitColorwaySizeAssetFrames(t){var e,n,i,r;if(!this.isLoggedIn)throw new Im;const s=await this.user.watchUserProfileForFrames((async e=>{var n,i,r,s;const o=null===(s=null===(r=null===(i=null===(n=e.docs[0].data())||void 0===n?void 0:n.vto)||void 0===i?void 0:i[this.brandId])||void 0===r?void 0:r[t])||void 0===s?void 0:s.frames;return!!(null==o?void 0:o.length)&&Pm(o[0])}));if(!(null===(r=null===(i=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===i?void 0:i.frames)||void 0===r?void 0:r.length))throw new Am;return s.vto[this.brandId][t].frames}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Im;if(!this.user.brandUserId)throw new Cm;await Dm.Post(this.user,`/colorway-size-assets/${t}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(t){var e,n,i;const r=await this.user.getUserProfile(),s=(null===(i=null===(n=null===(e=null==r?void 0:r.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===i?void 0:i.frames)||[];if(!s.length)throw new Am;if(!await Pm(s[0]))throw new Am;return s}}var Fm;!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"}(Fm||(Fm={}));const Um={[Fm.ACROSS_BACK]:"Across back",[Fm.ACROSS_FRONT]:"Across front",[Fm.ACROSS_SHOULDER]:"Across shoulder",[Fm.ANKLE]:"Ankle",[Fm.ARMEYE]:"Armeye",[Fm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Fm.BACK_CROTCH_LENGTH]:"Back crotch length",[Fm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Fm.BELOW_KNEE]:"Below knee",[Fm.BICEP]:"Bicep",[Fm.BUST]:"Chest/Bust",[Fm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Fm.CALF]:"Calf",[Fm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Fm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Fm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Fm.ELBOW]:"Elbow",[Fm.FOREARM]:"Forearm",[Fm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Fm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Fm.HIGH_HIP]:"High hip",[Fm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Fm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Fm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Fm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Fm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Fm.INSEAM]:"Inseam",[Fm.KNEE]:"Knee",[Fm.LOW_HIP]:"Low hip",[Fm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Fm.MID_NECK]:"Mid neck",[Fm.NECK_AT_BASE]:"Neck at base",[Fm.SHOULDER_DROP]:"Shoulder drop",[Fm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Fm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Fm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Fm.THIGH]:"Thigh",[Fm.TOTAL_RISE_LENGTH]:"Total rise length",[Fm.UNDER_BUST]:"Under bust",[Fm.VERTICAL_TRUNK]:"Vertical trunk",[Fm.WAIST]:"Waist",[Fm.WRIST]:"Wrist"};var zm;!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"}(zm||(zm={}));const Bm={[zm.BLOUSES]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.COATS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.DRESSES]:[Fm.LOW_HIP,Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST],[zm.JACKETS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.PANTS]:[Fm.LOW_HIP,Fm.WAIST,Fm.THIGH,Fm.INSEAM],[zm.PUFFERS_AND_PARKAS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.SHORTS]:[Fm.LOW_HIP,Fm.WAIST,Fm.THIGH,Fm.INSEAM],[zm.SKIRTS]:[Fm.LOW_HIP,Fm.WAIST],[zm.SWEATERS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.T_SHIRTS_AND_TANKS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP]},Vm={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"},Hm={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"},jm={activewear:{leggings:zm.PANTS,joggers:zm.PANTS,sweatshirts:zm.SWEATERS},dresses:{a_line:zm.DRESSES,bodycon:zm.DRESSES,fit_and_flare:zm.DRESSES,knit:zm.DRESSES,shirt:zm.DRESSES,slip:zm.DRESSES,straight:zm.DRESSES,wrap:zm.DRESSES},jackets_and_coats:{denim_jackets:zm.JACKETS,parkas:zm.PUFFERS_AND_PARKAS,peacoats:zm.COATS,puffer_jackets:zm.PUFFERS_AND_PARKAS,raincoats:zm.COATS,rompers:zm.COATS,shackets:zm.JACKETS,trench_coats:zm.COATS},jeans:{bootcut:zm.PANTS,flared:zm.PANTS,mom:zm.PANTS,relaxed:zm.PANTS,skinny:zm.PANTS,slim:zm.PANTS,straight:zm.PANTS,tapered:zm.PANTS,wide_leg:zm.PANTS},jumpsuits_and_rompers:{boiler_suits:zm.DRESSES,denim:zm.DRESSES,jumpsuits:zm.DRESSES,overalls:zm.DRESSES,rompers:zm.DRESSES,unitards:zm.DRESSES},pants_and_shorts:{cigarette:zm.PANTS,culottes:zm.SHORTS,denim_shorts:zm.SHORTS,flared:zm.PANTS,joggers:zm.PANTS,leggings:zm.PANTS,skinny:zm.PANTS,wide_leg:zm.PANTS},skirts:{a_line_flared:zm.SKIRTS,denim:zm.SKIRTS,knit:zm.SKIRTS,pencil:zm.SKIRTS,pleated:zm.SKIRTS,skater:zm.SKIRTS,slip:zm.SKIRTS,wrap:zm.SKIRTS},suits_and_tailoring:{blazers:zm.JACKETS,suit_jackets:zm.JACKETS,suit_skirts:zm.SKIRTS,suit_trousers:zm.PANTS,suit_vests:zm.SWEATERS,trousers:zm.PANTS},sweaters:{cardigans:zm.SWEATERS,crewnecks:zm.SWEATERS,hoodies_and_zipups:zm.SWEATERS,sweatshirts:zm.SWEATERS,turtlenecks:zm.SWEATERS,v_necks:zm.SWEATERS},tops:{bodysuits:zm.BLOUSES,corsets_and_bustiers:zm.BLOUSES,polos:zm.T_SHIRTS_AND_TANKS,shirts_and_blouses:zm.BLOUSES,t_shirts:zm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:zm.T_SHIRTS_AND_TANKS}};var qm;!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"}(qm||(qm={}));const $m={[qm.TOO_TIGHT]:"Too Tight",[qm.TIGHT]:"Tight",[qm.SLIGHTLY_TIGHT]:"Slightly Tight",[qm.PERFECT_FIT]:"Perfect Fit",[qm.SLIGHTLY_LOOSE]:"Slightly Loose",[qm.LOOSE]:"Loose",[qm.OVERSIZED]:"Oversized",[qm.TOO_SHORT]:"Too Short",[qm.SHORT]:"Short",[qm.SLIGHTLY_SHORT]:"Slightly Short",[qm.SLIGHTLY_LONG]:"Slightly Long",[qm.LONG]:"Long",[qm.TOO_LONG]:"Too Long"};var Km;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Km||(Km={}));var Wm=Object.freeze({__proto__:null,get AvatarState(){return Km},get MeasurementLocation(){return Fm},MeasurementLocationName:Um,get Classification(){return zm},ClassificationLocations:Bm,CategoryNames:Vm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Hm,Taxonomy:jm,get Fit(){return qm},FitNames:$m}),Gm="Back to sign in",Qm="Click here to download the app",Ym="Don't have an account?",Jm="Whoops! Looks like you don't have an avatar yet.",Xm="Email address",Zm="Please enter a valid email address.",ty="Enter your email address, we will send you a link to reset your password.",ey="Forgot password?",ny="Have an account? Sign in",iy="Your avatar is loading...",ry="Unfortunately, that size is not available for try on.",sy="or",oy="Password",ay="Please enter a valid password (at least 7 characters).",cy="Return to Catalog Page",ly="Return to Product Page",uy="Return to site",hy="Please return to The Fitting Room app to create your avatar.",dy="Scan to download the app",fy="Send",py="Sign back in",gy="Sign in",my="Something went wrong. Try again!",yy="You have successfully logged out!",vy="The Fitting Room",wy="Username or password is empty.",by="Username or password is incorrect.",Sy="End size uncertainty with",Ey="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var _y=[],Ty=[];function Iy(t,e){if(t&&"undefined"!=typeof document){var n,i=!0===e.prepend?"prepend":"append",r=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(r){var o=_y.indexOf(s);-1===o&&(o=_y.push(s)-1,Ty[o]={}),n=Ty[o]&&Ty[o][i]?Ty[o][i]:Ty[o][i]=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),r=0;r<n.length;r++)t.setAttribute(n[r],e.attributes[n[r]]);var o="prepend"===i?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}Iy(".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)}",{});Iy('#fit-title{margin-bottom:20px;margin-top:-30px}#fit-subtitle,#fit-title{color:#209da7;font-size:24px;font-weight:700}#fit-subtitle{position:absolute;right:17px;top:100px}#fit-subtitle-mobile{color:#7d7d7d;font-size:24px;font-weight:700;margin-top:20px}#fit-outline-container{display:flex;justify-content:center}#fit-outline-inner{position:relative}#fit-outline-inner,#tfr-fit-outline-img{width:184px}#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right,#tfr-fit-outline-img{height:701px}#fit-outline-inner-left,#fit-outline-inner-right{position:relative;width:260px}#fit-outline-container .fit-outline-line{display:block}.fit-outline-line{background:#000;height:1px;position:absolute}.fit-outline-line-text{border-bottom:1px solid #000;font-size:24px;position:absolute}.fit-outline-line-chest-text{left:-11px;text-align:right;top:163px;width:254px}.fit-outline-line-n-waist-text{left:-11px;text-align:right;top:208px;width:254px}.fit-outline-line-p-waist-text{right:-10px;text-align:left;top:233px;width:253px}.fit-outline-line-h-hip-text{left:-3px;text-align:right;top:255px;width:246px}.fit-outline-line-l-hip-text{left:-3px;text-align:right;top:302px;width:246px}.fit-outline-line-thigh-text{right:3px;text-align:left;top:341px;width:240px}.fit-outline-line-chest{left:42px;top:194px;width:99px}.fit-outline-line-n-waist{left:50px;top:239px;width:83px}.fit-outline-line-p-waist{left:45px;top:264px;width:93px}.fit-outline-line-h-hip{left:30px;top:286px;width:122px}.fit-outline-line-l-hip{left:21px;top:333px;width:141px}.fit-outline-line-thigh-l{left:27px;top:372px;width:60px}.fit-outline-line-thigh-r{left:95px;top:372px;width:61px}#fit-line-container{position:relative;width:100%}#fit-line-text-container{align-items:center;display:flex;justify-content:space-between}.fit-line-item{font-weight:700;width:110px}.fit-line-item .light-text{font-weight:500}.fit-line-item-green{color:#209da7}#fit-line{display:flex;justify-content:space-around;margin-bottom:4px;margin-top:30px}#fit-line-1,#fit-line-2,#fit-line-3,#fit-line-4,#fit-line-5,#fit-line-6,#fit-line-7{background:#000;height:2px;position:relative;width:110px}#fit-line-3,#fit-line-4,#fit-line-5{background:#209da7}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before,#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{background:#000;border-radius:50%;content:"";height:12px;position:absolute;top:-5px;width:12px}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before{left:0}#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{right:0}#fit-line-1:before,#fit-line-2:before,#fit-line-6:before,#fit-line-7:before{background:#000}#fit-line-3:before,#fit-line-5:before{background:#209da7}#fit-line-2:before,#fit-line-6:before{display:none}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after{border-left:2px dashed #000;content:"";display:block;height:20px;left:50%;position:absolute;top:-20px}#fit-line-3:after,#fit-line-4:after,#fit-line-5:after{border-left:2px dashed #209da7}#fit-line-texts{display:flex;justify-content:space-between;padding:0 70px}#fit-line-texts div:nth-of-type(2){color:#209da7}.margin-top-10{margin-top:10px}.desktop-hidden{display:none}#cta-link{cursor:pointer;font-size:20px;margin:auto;text-decoration:underline;width:150px}.powered-by{align-items:center;display:flex;justify-content:center;margin-top:10px}@media screen and (max-width:599px){#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right{height:400px}#fit-outline-inner{flex-shrink:0;overflow:hidden}#fit-title{margin-top:0}#fit-outline-container{margin-top:-50px;transform:scale(.7)}.fit-line-item{font-size:10px;font-weight:500}.fit-outline-line-text{font-size:16px;line-height:31px}.fit-outline-line-chest-text,.fit-outline-line-n-waist-text{left:-11px;width:auto}.fit-outline-line-p-waist-text{right:-10px;width:auto}.fit-outline-line-h-hip-text,.fit-outline-line-l-hip-text{left:-3px;width:auto}.fit-outline-line-thigh-text{right:3px;width:auto}#fit-line{margin-top:10px}#fit-line-texts{font-size:12px;padding:0 15px}#cta-section{margin-top:-30px}#fit-line-2:before,#fit-line-6:before,.desktop-hidden{display:block}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after,.mobile-hidden{display:none}}',{});Iy(".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{padding-right:10px}.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{display:flex;margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;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}.tfr-door-icon,.tfr-user-icon{color:#209da7}.tfr-logged-in,.tfr-toggle-closed{display:none}.tfr-flex{display:flex}.tfr-gap{gap:4px}.tfr-items-center{align-items:center}.tfr-mb-2{margin-bottom:8px}#tfr-logged-out-overlay-container{position:relative}#tfr-logged-out-overlay{align-items:center;background:hsla(0,0%,100%,.8);bottom:0;display:flex;font-size:16px;font-weight:700;justify-content:center;left:0;line-height:16px;position:absolute;right:0;text-align:center;top:0}",{});Iy("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}",{});Iy(".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)}}",{});Iy("@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-small-text{font-size:12px}.tfr-mobile-hidden{display:none}.tfr-modal-content{overflow:hidden}.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-height:800px){.tfr-video-responsive{height:280px!important}}",{});Iy("#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-info-icon{cursor:pointer}#tfr-size-rec-subtitle{border-bottom:2px solid #000;font-size:18px;font-weight:700;text-align:center;width:100%}#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;text-align:left}.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):not(.tfr-disabled){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,.tfr-powered-by-logo svg{height:24px;width:12px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}.tfr-disabled{cursor:default}#tfr-login-to-view{cursor:pointer}",{});Iy(".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%}",{});Iy(".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}",{});Iy(".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}",{});Iy(":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 ky='\n<svg class="tfr-door-icon" width="68" height="124" 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="currentColor">\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>',Cy='<svg class="tfr-user-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_82_11365)">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M4.3125 4.78125C4.3125 3.02084 5.73959 1.59375 7.5 1.59375C9.26041 1.59375 10.6875 3.02084 10.6875 4.78125C10.6875 6.54166 9.26041 7.96875 7.5 7.96875C5.73959 7.96875 4.3125 6.54166 4.3125 4.78125ZM9.625 4.78125C9.625 3.60764 8.6736 2.65625 7.5 2.65625C6.32639 2.65625 5.375 3.60764 5.375 4.78125C5.375 5.95485 6.32639 6.90625 7.5 6.90625C8.6736 6.90625 9.625 5.95485 9.625 4.78125Z"\n fill="currentColor" fill-opacity="0.7" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M2.1875 13.1634C2.1875 10.5693 4.58181 8.5 7.5 8.5C10.4182 8.5 12.8125 10.5693 12.8125 13.1634C12.8125 16.1539 2.1875 16.1539 2.1875 13.1634ZM11.75 13.1634C11.75 11.1933 9.86303 9.5625 7.5 9.5625C5.13697 9.5625 3.25 11.1933 3.25 13.1634C3.25 13.7564 4.45689 14.126 5.96113 14.2721L6.31312 14.3019C7.08543 14.3577 7.91457 14.3577 8.68688 14.3019L9.03887 14.2721C10.5431 14.126 11.75 13.7564 11.75 13.1634Z"\n fill="currentColor" fill-opacity="0.7" />\n </g>\n <defs>\n <clipPath id="clip0_82_11365">\n <rect width="16" height="16" fill="white" />\n </clipPath>\n </defs>\n</svg>',Ay=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const i=t/200;e.style.width=n+"%";const r=setInterval((()=>{n>=100?clearInterval(r):(n+=.5,e.style.width=n+"%")}),i)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${iy} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `,useFullModalContent:!0}),Ry=t=>{const e=document.getElementById(t),n=document.querySelector("body");if(!e)throw new Error(`element with id ${t} not found`);let i;const r=t=>t?`\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">${Sy}</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">${vy}</div>\n </div>\n </div>\n `:"",s=()=>{n.style.overflow="auto",i&&(i.Unhook(),l()),e.style.display="none"},o=t=>{"Escape"===t.key&&s()},a=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),s())},c=()=>{e.querySelector("#tfr-close-container").addEventListener("click",s),document.addEventListener("keydown",o),document.addEventListener("click",a)},l=()=>{var n;const i=e.querySelector("#tfr-close-container");i?i.removeEventListener("click",s):(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",o),document.removeEventListener("click",a)};return{open:t=>{var s,o;n.style.overflow="hidden",i&&i.Unhook(),e.innerHTML=(s=t.Body(),o=t.useFullModalContent,console.log({useFullModalContent:o}),`\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">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n ${r(o)}\n ${s}\n </div>\n </div>\n </div>\n </div>\n `),c(),t.Hook(),e.style.display="block",i=t},close:s,Content:()=>i}},Ly=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},i=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},r=()=>{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",i),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",r)},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",i),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",r)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${Ey}</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">${dy}</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">${ny}</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">${Qm}</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">${ny}</div>\n `:""}\n `,useFullModalContent:!0}};class Ny{constructor(t,e,n,i){this.signIn=e,this.forgotPassword=n,this.submitTel=i,this.manager=Ry(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,i;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.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">${yy}</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">${py}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${uy}</span>\n </div>\n `,useFullModalContent:!0}})({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">${Jm}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${hy}</div>\n `,Hook:()=>{},Unhook:()=>{},useFullModalContent:!0})}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,i=document.getElementById("password-input").value;s(),t.onSignIn(n,i,o)},i=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},r=()=>{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",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",r)},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",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",r)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${gy}</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">${Xm}</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">${oy}</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">${ey}</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">${Ym}</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 ${gy}\n </button>\n </form>\n `,useFullModalContent:!0}})({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,i;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.addEventListener("click",e)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.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">${ty}</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">${Xm}</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">${Gm}</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 ${fy}\n </button>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const i=()=>{t.onNavBack()},r=()=>{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",i),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",i),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",r)},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 ',useFullModalContent:!0}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},i=()=>{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",i)},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",i)},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||my}</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">${cy}</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">${ly}</span>\n </div>\n `),useFullModalContent:!0}})({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,i;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>{var e,n,i;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${ry} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${sy} ${null===(i=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===i?void 0:i.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">${cy}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${ly}</span>\n </div>\n `},useFullModalContent:!0}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}toFitInfo(){this.manager.open((t=>{const e=()=>t.onSignInNav();return{Hook:()=>{document.getElementById("cta-link").addEventListener("click",e)},Unhook:()=>{document.getElementById("cta-link").removeEventListener("click",e)},Body:()=>`\n <div>\n <div id="fit-title">Fit Scale</div>\n\n <div id="fit-line-container">\n <div id="fit-line-text-container">\n <div class="fit-line-item mobile-hidden">Too Tight</div>\n\n <div class="fit-line-item">\n <div>Tight <span class="light-text">or</span><br /> More fitted</div>\n\n <div class="desktop-hidden margin-top-10">Too Tight</div>\n </div>\n\n <div class="fit-line-item fit-line-item-green">Slightly tight <br /><span class="light-text">or</span> Fitted</div>\n <div class="fit-line-item fit-line-item-green">Perfect Fit</div>\n <div class="fit-line-item fit-line-item-green">Slightly loose <br /><span class="light-text">or</span> Less fitted</div>\n\n <div class="fit-line-item">\n <div>Loose <span class="light-text">or</span><br /> Not fitted</div>\n\n <div class="desktop-hidden margin-top-10">Oversized</div>\n </div>\n\n <div class="fit-line-item mobile-hidden">Oversized</div>\n </div>\n\n <div id="fit-line">\n <div id="fit-line-1" class="mobile-hidden"> </div>\n <div id="fit-line-2"> </div>\n <div id="fit-line-3"> </div>\n <div id="fit-line-4"> </div>\n <div id="fit-line-5"> </div>\n <div id="fit-line-6"> </div>\n <div id="fit-line-7" class="mobile-hidden"> </div>\n </div>\n\n <div id="fit-line-texts">\n <div>Poor Fit</div>\n <div>Acceptable Fit</div>\n <div>Poor Fit</div>\n </div>\n </div>\n\n <div id="fit-subtitle-mobile" class="desktop-hidden">Measurement Points</div>\n\n <div id="fit-outline-container">\n <div id="fit-outline-inner-left">\n <div class="fit-outline-line-text fit-outline-line-p-waist-text">Pant Waist</div>\n <div class="fit-outline-line-text fit-outline-line-thigh-text">Thigh</div>\n </div>\n\n <div id="fit-outline-inner">\n <div class="fit-outline-line fit-outline-line-chest"></div>\n <div class="fit-outline-line fit-outline-line-n-waist"></div>\n <div class="fit-outline-line fit-outline-line-p-waist"></div>\n <div class="fit-outline-line fit-outline-line-h-hip"></div>\n <div class="fit-outline-line fit-outline-line-l-hip"></div>\n <div class="fit-outline-line fit-outline-line-thigh-l"></div>\n <div class="fit-outline-line fit-outline-line-thigh-r"></div>\n\n <img id="tfr-fit-outline-img" src="https://assets.dev.thefittingroom.xyz/images/fit-outline.png" />\n </div>\n\n <div id="fit-outline-inner-right">\n <div id="fit-subtitle" class="mobile-hidden">Measurement Points</div>\n\n <div class="fit-outline-line-text fit-outline-line-chest-text">Chest/Bust</div>\n <div class="fit-outline-line-text fit-outline-line-n-waist-text">Natural Waist</div>\n <div class="fit-outline-line-text fit-outline-line-h-hip-text">High Hip</div>\n <div class="fit-outline-line-text fit-outline-line-l-hip-text">Low Hip</div>\n </div>\n </div>\n </div>\n\n <div id="cta-section">\n <div id="cta-link">Sign Up or Login</div>\n\n <div class="powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${ky}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n `,useFullModalContent:!1}})({onSignInNav:()=>this.toScan(),onClose:()=>this.close()}))}navBack(){window.history.back()}}class xy{constructor(t,e,n,i,r){this.onSignInClick=e,this.onSignOutClick=n,this.onFitInfoClick=i,this.onTryOnClick=r,this._sku="",this._styleId=null,this.isLoggedIn=!1,this.tfrLoggedInElements=[],this.tfrLoggedOutElements=[],this.tfrToggleOpenElements=[],this.tfrToggleClosedElements=[],this.isCollapsed=!1,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}get styleId(){return this._styleId}setStyleId(t){this._styleId=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelect.style.display="flex",this.tfrSizeHowItFits.style.display="block",t?(this.tfrSizeHowItFits.style.opacity="1",this.tfrSizeRecSelect.style.opacity="1",this.tfrLoggedInElements.forEach((t=>t.style.display="block")),this.tfrLoggedOutElements.forEach((t=>t.style.display="none")),this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down")):(this.tfrSizeHowItFits.style.opacity="0.4",this.tfrSizeRecSelect.style.opacity="0.4",this.tfrLoggedInElements.forEach((t=>t.style.display="none")),this.tfrLoggedOutElements.forEach((t=>t.style.display="block")),this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.renderSizeRecSelectLoggedOut())}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){t&&t.length?this.renderGarmentLocations(t):this.tfrSizeRecTitle.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e)}setError(){this.tfrSizeRecTitle.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.tfrInfoIcon=document.getElementById("tfr-info-icon"),this.tfrLoginToView=document.getElementById("tfr-login-to-view"),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"),this.tfrLoggedInElements=document.querySelectorAll(".tfr-logged-in"),this.tfrLoggedOutElements=document.querySelectorAll(".tfr-logged-out"),this.tfrToggleOpenElements=document.querySelectorAll(".tfr-toggle-open"),this.tfrToggleClosedElements=document.querySelectorAll(".tfr-toggle-closed")}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)),this.tfrInfoIcon.addEventListener("click",this.onFitInfoClick),this.tfrLoginToView.addEventListener("click",this.onSignInClick)}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button")||e.classList.contains("tfr-disabled"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const i=document.querySelectorAll(".tfr-size-rec-select-button");i.forEach((t=>t.classList.remove("active"))),i.item(n).classList.add("active"),this.redraw(n);const r=Number(e.getAttribute("data-size-id"));Number.isNaN(r)||this.onTryOnClick(this.styleId,r)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=` ${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n);const i=e[n].size_id;this.onTryOnClick(this.styleId,i)}renderSizeRecTable(t,e){const{locations:n}=t[e],i=n.map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=i}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((n,i)=>`<div class="tfr-size-rec-select-button ${i===e?"active":""}" data-index="${i}" data-size-id="${t[i].size_id}">${n}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecSelectLoggedOut(){const t=['<div class="tfr-size-rec-select-button tfr-disabled">M</div>','<div class="tfr-size-rec-select-button tfr-disabled active">L</div>','<div class="tfr-size-rec-select-button tfr-disabled">XL</div>'].join("");this.tfrSizeRecSelect.innerHTML=t}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>`}renderGarmentLocations(t){const e=t.map(((t,e)=>this.renderSizeRecTableRow(t,this.randomFit(e),!0))).join(""),n=`<div id="tfr-logged-out-overlay-container">\n <div id="tfr-logged-out-overlay">\n Login to reveal how this item will fit specifically at each area of your body in different sizes\n </div>\n <div>\n ${e}\n </div>\n </div>`;this.tfrSizeRecTable.innerHTML=n}randomFit(t){const e=["Slightly Tight","Perfect Fit","Perfect Fit","Slightly Loose","Perfect Fit"];return e[t%e.length]}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrToggleOpenElements.forEach((t=>t.style.display="block")),this.tfrToggleClosedElements.forEach((t=>t.style.display="none"))):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrToggleOpenElements.forEach((t=>t.style.display="none")),this.tfrToggleClosedElements.forEach((t=>t.style.display="block")))}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 class="tfr-logged-out">\n <div class="tfr-flex tfr-gap tfr-mb-2 tfr-mobile-small-text">\n <div>Uncertain of your size?</div>\n \n <div class="tfr-toggle-closed">\n <div class="tfr-flex tfr-items-center">\n <div>Try</div>\n <div class="tfr-powered-by-logo">${ky}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n\n <div class="tfr-toggle-open">\n <div id="tfr-login-to-view" class="tfr-flex tfr-items-center">\n ${Cy} Login to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-logged-in">\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 ${Cy} Sign up to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-toggle-open" style="width: 100%">\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">\n How it fits\n <span id="tfr-info-icon"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<rect width="13" height="13" fill="url(#pattern0_641_1375)"/>\n<defs>\n<pattern id="pattern0_641_1375" patternContentUnits="objectBoundingBox" width="1" height="1">\n<use xlink:href="#image0_641_1375" transform="scale(0.00793651)"/>\n</pattern>\n<image id="image0_641_1375" width="126" height="126" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAB+CAYAAADiI6WIAAAAAXNSR0IArs4c6QAADKtJREFUeF7tnc2S2zYSgLuh9VwzeYJVniDjJ7Asb06p8mhqj6nKDFN7j/wEkp/A4/MeqMllj9L4umWJfgIrT2D5CaK9ZlfATlOkLWn0g8aPCJLSJakxSIL4uhvdjQaIULFfKx42AeCiIcRflYImgDpXAE0E+n8ASP+25YcwUwrmgDAXAHMFOEOE2ULK358AzP8dXU2rNFRY5pdpxcNzAGgJFM8Q1IVScAEA9Dcfv7lCmCLgVCr5AQCmSXQ18/GgY9yzdOD/Fg9bEsWlUqqFkIIu7KcApoiYSCXvk+gqKawjBg8uBfgcNih141GjDYZv7RLS/kSCuiuDEAQLnsz4w1zbBcTrnfOyLSp/189QYH8h5YdQp4PgwC+1O4XdCVi7OSIzkKBehyYAwYAn4AqxpxS0OKNaorZBCUDh4Cn8aiDGFQa+KZtBCEBh4LM5vA+Av5ZIa112tVABKAR8Ox7eAOCbiszhNsKQOoHvry/vbG5icu1RwdfQrOsyObr2Hw18Kx7eiJOW7xOEo2q/d/AFzeWUTJkCpvn2qQScK7n4LM7O/pB//vmfJLqarxJI+3h29k1jsUjz+FKl6d8mKnUhV/P8uvpr1Q5vJUgK/9b6aHXLLRd7BU+mXQBOIF8gcd377H556lQhJkouKGnidNBIMFA0nqFSrSOlimcS1HOfsb838GkiBnDoy4FTAIkQOFpISSlSp6APyWe2AthqAF4/9MNX3oHgR77Sv17At+NhN/PaD40h698VwEwBDgDk22PD3tXRXAgQsPdl6Zf1VvsbZ1m/vsNbprdyDr4dDyk277nsKGk3NER/8vNLWg4N9vf87t2lkLLr2gr4gO8UvGvoZQG+KYk//PbumVzIvksBcA3fGXiX0MsKfJsA/G8hB66mAJfwnYB3CH0uAftJdPk2WHtu0DHKYbjyAVzBtwbvCjppuVp6saUtZ9onE2loi9gDBVRMYvVzAd8KvCPoldTyPVFAVyydX8vaQPVqHF3dmkqQMfgsTqfkjPFvGZ75TVQYd87jhaT9CDixnfuzJI9RrZ8ReEcZuVGWoDhq8sUjT9atl6lsjB9Sy1RpZPqbS1BPTaZHNviswx9t0rCZA/fa9G2rdF07vu89FPvbJGgow0fwWQrEBt+Oh7c2xRMn6I/F1h4+3o6jy1cchWCBzwooyDwZ/U7Qdw+bLXyp8Cb5Rb+gQxu87bx+gn5YVyzhs+Z7bfDtwSg2jUFP0A9Dz1vYwKdcyCTqPNd5mhZ4GxNfJPTmP//VAgHskBPVWfPTP/7+WWcAfbSxgY8Cb3Rq+A6CtzTxo3HUufIxODr3LCt4erd2PKJaBpNQj0z+d4e8/IPgTU18lpxhhxk6QHXblBl8WvUD+NEsyXPYy98LPtP2T7oDvdKO5WgY3F/rkjKDpxfMxp9yJuz0bqb1O9c99oI31faH4sZuCCtsZQefwafcPu1BYP0OOXo7wVto+2AcdSJWLz01rgJ4GpoX8WhiUtSxL5e/E7yJtoe26FIV8KYmf5/WbwVvqu1S4E1SwHagXQajKuBtTP4urd8K3lTbJ1HnO09W2+i2VQJvYfK3Tr2PwJtqu2qIVmhVsFUDb1gDsTWufwTeJEt3yIM0UlcHF1UNvKnWS4H95PpybRl8C/gRxe3bz4LbASNEbaeuVhG8odbPxhvT8Bp4k5uGqu0ODEawtzAJ7zadvDXwRk6dEJ3J9cv7YEepgh0zUVBAvB3ffC3WWAcf88w8xe2hefIV5Lz1lZ7Ho0/MPP58HHW+zW/2BbyJFIUWt9cFOr1n++6+B5JXq7dq7r+Abw/u34BSXc7gHVoI4Nzr1JY3AlnR6x+sq1bM/RfwL+LRR8U4G/bk1LGG3EtjrpNHB0hMos5T6kwK3iRpUwYzn4ZzDWAXh6I8axVZgaMrJS/u7n9VUrF200hQ31KRRgr+RTzsqOXpFdq/Mpj5Ksbxq4BMzL3KorAUPHd+XzUZ2pJSQMOqg88yeawpOg/rlho/GE1YR4puxIQFMNV6ZB3AGyhtWom71Ph4RN6hdnlPbi60Rr/ARnUAbzBNp/E8tuLhhQCkui7tX+4gaF9QUMM6gDeZ5+HsSRO5iZsyZevqAH7po40+cT7mQBYbuSFBmeL3GoEfZh920LKtKLCLXOdgM9mv9aSCGtUHPDPriniL7cGILS3vr8txOFFtwC+PgeckqgbIDeVCLbrYZlTqAp7r2dN0jewcfYC1dbtmkrqAN4jMZmTqWR4hhQLjn34sbCcpx12oEXg6JZyz1W2G7XikOINZlhie3qlG4OkgJdYSLRv8OOoc3GHLESSfbesCPsu+shT4BH6L5BV9MIKJMnAt9wn8CbyenJ1Mvd44HbuVd40/OXfHRnr4eSYLNadwrgKm3qB0jh/HZ8dnTg/LYfEt6uLVG6ywTvkp2xLtnDmB3658acqWu21K9xy14vW9Pgkc7tI6AIxOy7IVmONNltbZhRgkLUUeWsixJHUx9dwV1rQQg7ukBwCP9lpzYByzbV3At7mbXRuiRcWW3JUdKEssXwfwJjE8RWan8uqSz/EGFntZXk3vzd18V5a6uzpoPNexy4tlT1uoSq/xvF3O61uozDZNprsuj+mscZ9VdY038c/WNk2aOAgUEoRebVt18CZH0+W7nCt9MELVwXPj90cHI6SlO2ZHoQRt7qsM3sTMrzrltocfPToxkTsP+2xfZfAmZn51T8TmcWes7dKhZ/GqDd7uaLqNAw6Ze7AAKIv3PImujD5s61Pbq1xebZC0oeFYO8W60keaVlXjuU4dUd/c+vb4EGPuzpqAtb6K4LnVNin0LSeQPgZvcGJiqHvmqwjeRNu3HU237UMFtB2H9mFpn4lDUhXiXF818CbanrGhDxCufYrM5adJtL9r6tupy+9fNfDcdfdsHPQ+TUKNTSULQL0aR1eskxZ9CkGVwJvE7bu0nf6+cwMke6l2STCIL0xWTeMtvu+78xuAO8Gban1Ijl5VNJ5bCZ0L/r5jZ/dueTbUegoggjD5VQDfjoddMPjE6GbCZnNK3QveaCEgIJNfdvCmX5jcN7fnAnDwkIN2fP8GgPcBg+zms2y7VWHFGmUGn9VI0ImjrC+C7fPkV7X+IPisA+y4PntIoTX4ZQbfjkd0jHyHG/Xoft/3IHh6cCse3gjeOWpf+itBvU6iqz73BVy0Lyv4djzsA2DPZAx0PyChBZ46YO7opVm9QuCXEbwN9EMOHcvU541tHI3M2Tg6/LKBt4Gua+K1nbtVKbEx+UXBNzGXRVxjAz0dW+Yn3LVNfT4YFl5+eouizH4RMHWfaQsdAG/H0devSOo8lw2evHwE/Mj8yuFaX07wvw6HLfTMxD/l7nFgg8+8fNpoSTEma+l2QxJHElTE7bCONJehTRYm04nT7JAtfz/uvG7k3G0Opmkuf+M+lOShmr21teIygLPpo8Wiy9pjbU4SN9L4FU+/K8zyyKsvMAdQr0NazrWBeujaLPdOMbqNtQQJ2E+iy9eHnrfr363A003b8X3voarLRYJmkM39ldR+0vIGYsz6zNsOarbQ6bbW4B3Dn6HA/vvryztTSQ7xOldavoyK7DQ9Hx8n4B3Dp9vR3E+OX5D1+rrCRX6QQuy50HKX0J1pfD4QDs1+ekuFkCiVpntLJQCugbuG7hy8B81fFYC3SXQ10tW2Itr5AO4DuhfwvuBnIFMfYCHlh1BCwGU8DlQlc224dr5XRiVgN4ncf/XL2Ry/2XuS/gVgbJPh2zciNA0IxEERQkCwG0Jcg1IdV/P3lnedq4boTH5++cGH9fIGnjpLIQwCTnzBzweENvwjYiKVpEFKXGcDCTS9jkDxTCnVQoALHzBW3memPCe2vILP4J8LEBTrd30O1sa9ZwphhoBTRJgtpPw9nyqoBHxTMDKw508Azv8L0BSUXEHxPYJqKoKsjMqfDF8XbyVIcmi9lqx5B5+/PS3pImDPt/YbjnYIl82lwm7yy3FyGEcDn5t+gdgDBTchjHQofaC9CGqZtzha1vKo4E/a/0jU5lJgNykgU1kI+JP2p5H0UebyXVatMPAr2t+sk/kvwqxvg184+LoIAAGHhuj7isu5/kow4CsqABSSjVRDDEIBno9zcOBXBYCSJiUNAWcScAAgaX3BazzO1fTgwa++0A+/vXu2kPKG0qMB5wHmgDhQAkehaXfQc7yu5C6FgHLk/lOnh/qUp4rLAnv1fYI19YcGPQ8JUTS+RxICpS7S9KplLdue584z0FOFmCi5oBXCIM24ztiVGvy2F2zFw4snjcY3kgSBcuxKNRHgXAKc03/3LJ2mWTMEmFHZMiDOKc8vAWf4l8Z0/NOPn3UGtCxt/g+79EmQczmdsgAAAABJRU5ErkJggg=="/>\n</defs>\n</svg>\n</span>\n </div>\n\n <div id="tfr-size-rec-table"></div>\n </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-toggle-open">\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${ky}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class Oy{constructor(t,e,n,i,r,s,o){this.tfrShop=n,this.onSignInClick=i,this.onSignOutClick=r,this.onFitInfoClick=s,this.onTryOnClick=o,this.perfectFits=[Wm.Fit.PERFECT_FIT,Wm.Fit.SLIGHTLY_LOOSE,Wm.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new xy(t,this.onSignInClick,this.onSignOutClick,this.onFitInfoClick,this.onTryOnClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}get styleId(){return this.sizeRecComponent.styleId}setStyleId(t){this.sizeRecComponent.setStyleId(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),e=await this.getRecommendedSizes(String(t.style_id));return this.setStyleId(t.style_id),e}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku),e=await this.getRecommendedSizes(String(t.id));return this.setStyleId(t.id),e}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,size_id:t.size_id,locations:t.measurement_location_fits.map((t=>({fit:"string"==typeof t.fit_label&&t.fit_label?t.fit_label:Wm.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 Dy;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Dy||(Dy={}));class Py{constructor(t,e,n,i={},r,s){this.shopId=t,this.hooks=i,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 Ny(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"),Bd.getInstance().setEnv(e),new Mm(t,new xm)))(Number(this.shopId),o),this.tfrSizeRec=new Oy(n,r,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this),this.onFitInfoClick.bind(this),this.onTryOnClick.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 i;if(0==t.length||0==e.length)return n(wy);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Zm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(ay);try{await this.tfrShop.user.login(t,e),(null===(i=this.hooks)||void 0===i?void 0:i.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(by)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(my)}}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()}onFitInfoClick(){this.tfrModal.toFitInfo()}async onTryOnClick(t,e){const n=await this.shop.tryOn(t,e);this.tfrModal.onTryOn(n)}onUserProfileChange(t){var e,n,i,r;switch(t.avatar_status){case Dy.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Jm),this.tfrModal.onNotCreated();break;case Dy.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Dy.CREATED:(null===(i=this.hooks)||void 0===i?void 0:i.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(r=this.hooks)||void 0===r?void 0:r.onError)&&this.hooks.onError(my),this.tfrModal.onError(my)}}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),i=(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(i)}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,i={},r={},s="dev")=>{const o=new Py(t,e,n,i,r,s);return await o.onInit(),o};export{n as InitImageSlider,My as initFittingRoom};
|