@thefittingroom/shop-ui 1.3.11 → 1.3.12
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 +4 -0
- package/dist/esm/index.js +30 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +33 -33
- package/package.json +1 -1
package/dist/esm/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v1.3.
|
|
2
|
+
* thefittingroom v1.3.12 (2024-07-06T01:48:00.929Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var i=new Image;i.onload=r,i.onerror=r,i.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const r=document.getElementById(t);if(!r)throw new Error(`Slider with id ${t} not found`);return{Load(t){if(!Array.isArray(t)||!t.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");e(t);const i=(null==t?void 0:t.length)-2;r.value=i.toString(),r.max=(t.length-1).toString();const s=()=>{const e=parseInt(r.value);n(r,t[e])};return n(r,t[i]),r.removeEventListener("input",s),r.addEventListener("input",s),()=>{r.removeEventListener("input",s)}}}},r=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(r(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],s=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==s||null==o||null==a)throw Error();const c=i<<2|s>>4;if(r.push(c),64!==o){const t=s<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},s=function(t){return function(t){const e=r(t);return i.encodeByteArray(e,!0)}(t).replace(/\./g,"")},o=function(t){try{return i.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
|
|
@@ -201,7 +201,7 @@ class f{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
201
201
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
202
|
* See the License for the specific language governing permissions and
|
|
203
203
|
* limitations under the License.
|
|
204
|
-
*/var R;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(R||(R={}));const N={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},L=R.INFO,O={[R.DEBUG]:"log",[R.VERBOSE]:"log",[R.INFO]:"info",[R.WARN]:"warn",[R.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=O[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};class x{constructor(t){this.name=t,this._logLevel=L,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in R))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?N[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,R.DEBUG,...t),this._logHandler(this,R.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,R.VERBOSE,...t),this._logHandler(this,R.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,R.INFO,...t),this._logHandler(this,R.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,R.WARN,...t),this._logHandler(this,R.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,R.ERROR,...t),this._logHandler(this,R.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,U;const
|
|
204
|
+
*/var R;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(R||(R={}));const N={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},L=R.INFO,O={[R.DEBUG]:"log",[R.VERBOSE]:"log",[R.INFO]:"info",[R.WARN]:"warn",[R.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=O[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};class x{constructor(t){this.name=t,this._logLevel=L,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in R))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?N[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,R.DEBUG,...t),this._logHandler(this,R.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,R.VERBOSE,...t),this._logHandler(this,R.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,R.INFO,...t),this._logHandler(this,R.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,R.WARN,...t),this._logHandler(this,R.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,R.ERROR,...t),this._logHandler(this,R.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,U;const z=new WeakMap,F=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return F.get(t);if("objectStoreNames"===e)return t.objectStoreNames||B.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function q(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(U||(U=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(G(this),e),K(z.get(this))}:function(...e){return K(t.apply(G(this),e))}:function(e,...n){const r=t.call(G(this),e,...n);return B.set(r,e.sort?e.sort():[e]),K(r)}}function $(t){return"function"==typeof t?q(t):(t instanceof IDBTransaction&&function(t){if(F.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",s),t.removeEventListener("abort",s)},i=()=>{e(),r()},s=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",i),t.addEventListener("error",s),t.addEventListener("abort",s)}));F.set(t,e)}(t),P(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function K(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",i),t.removeEventListener("error",s)},i=()=>{e(K(t.result)),r()},s=()=>{n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",s)}));return e.then((e=>{e instanceof IDBCursor&&z.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(V.has(t))return V.get(t);const e=$(t);return e!==t&&(V.set(t,e),H.set(e,t)),e}const G=t=>H.get(t);const W=["get","getKey","getAll","getAllKeys","count"],Q=["put","add","delete","clear"],Y=new Map;function J(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Y.get(e))return Y.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=Q.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!W.includes(n))return;const s=async function(t,...e){const s=this.transaction(t,i?"readwrite":"readonly");let o=s.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),i&&s.done]))[0]};return Y.set(e,s),s}j=(t=>({...t,get:(e,n,r)=>J(e,n)||t.get(e,n,r),has:(e,n)=>!!J(e,n)||t.has(e,n)}))(j);
|
|
205
205
|
/**
|
|
206
206
|
* @license
|
|
207
207
|
* Copyright 2019 Google LLC
|
|
@@ -267,7 +267,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
267
267
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
268
268
|
* See the License for the specific language governing permissions and
|
|
269
269
|
* limitations under the License.
|
|
270
|
-
*/const Pt="9.15.0";function Mt(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:kt,automaticDataCollectionEnabled:!1},e),i=r.name;if("string"!=typeof i||!i)throw Dt.create("bad-app-name",{appName:String(i)});if(n||(n=h()),!n)throw Dt.create("no-options");const s=At.get(i);if(s){if(y(n,s.options)&&y(r,s.config))return s;throw Dt.create("duplicate-app",{appName:i})}const o=new A(i);for(const t of Rt.values())o.addComponent(t);const a=new xt(n,r,o);return At.set(i,a),a}function Ut(t=kt){const e=At.get(t);if(!e&&t===kt)return Mt();if(!e)throw Dt.create("no-app",{appName:t});return e}function
|
|
270
|
+
*/const Pt="9.15.0";function Mt(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:kt,automaticDataCollectionEnabled:!1},e),i=r.name;if("string"!=typeof i||!i)throw Dt.create("bad-app-name",{appName:String(i)});if(n||(n=h()),!n)throw Dt.create("no-options");const s=At.get(i);if(s){if(y(n,s.options)&&y(r,s.config))return s;throw Dt.create("duplicate-app",{appName:i})}const o=new A(i);for(const t of Rt.values())o.addComponent(t);const a=new xt(n,r,o);return At.set(i,a),a}function Ut(t=kt){const e=At.get(t);if(!e&&t===kt)return Mt();if(!e)throw Dt.create("no-app",{appName:t});return e}function zt(t,e,n){var r;let i=null!==(r=Ct[t])&&void 0!==r?r:t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const t=[`Unable to register library "${i}" with version "${e}":`];return s&&t.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void et.warn(t.join(" "))}Lt(new I(`${i}-version`,(()=>({library:i,version:e})),"VERSION"))}
|
|
271
271
|
/**
|
|
272
272
|
* @license
|
|
273
273
|
* Copyright 2021 Google LLC
|
|
@@ -283,7 +283,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
283
283
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
284
284
|
* See the License for the specific language governing permissions and
|
|
285
285
|
* limitations under the License.
|
|
286
|
-
*/const
|
|
286
|
+
*/const Ft="firebase-heartbeat-database",Bt=1,Vt="firebase-heartbeat-store";let Ht=null;function jt(){return Ht||(Ht=function(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=K(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(K(o.result),t.oldVersion,t.newVersion,K(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),a.then((t=>{s&&t.addEventListener("close",(()=>s())),i&&t.addEventListener("versionchange",(()=>i()))})).catch((()=>{})),a}(Ft,Bt,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(Vt)}}).catch((t=>{throw Dt.create("idb-open",{originalErrorMessage:t.message})}))),Ht}async function qt(t,e){try{const n=(await jt()).transaction(Vt,"readwrite"),r=n.objectStore(Vt);return await r.put(e,$t(t)),n.done}catch(t){if(t instanceof p)et.warn(t.message);else{const e=Dt.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});et.warn(e.message)}}}function $t(t){return`${t.name}!${t.options.appId}`}
|
|
287
287
|
/**
|
|
288
288
|
* @license
|
|
289
289
|
* Copyright 2021 Google LLC
|
|
@@ -315,7 +315,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
315
315
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
316
316
|
* See the License for the specific language governing permissions and
|
|
317
317
|
* limitations under the License.
|
|
318
|
-
*/var Yt;Yt="",Lt(new I("platform-logger",(t=>new X(t)),"PRIVATE")),Lt(new I("heartbeat",(t=>new Kt(t)),"PRIVATE")),Ft(Z,tt,Yt),Ft(Z,tt,"esm2017"),Ft("fire-js","");var Jt=function(t,e){return Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Jt(t,e)};function Xt(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Zt(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var te,ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ne=ne||{},re=ee||self;function ie(){}function se(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function oe(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var ae="closure_uid_"+(1e9*Math.random()>>>0),ce=0;function le(t,e,n){return t.call.apply(t.bind,arguments)}function ue(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function he(t,e,n){return(he=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?le:ue).apply(null,arguments)}function de(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function fe(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function pe(){this.s=this.s,this.o=this.o}pe.prototype.s=!1,pe.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,ae)&&t[ae]||(t[ae]=++ce))},pe.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var ge=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function ye(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(se(r)){var i=t.length||0,s=r.length||0;t.length=i+s;for(var o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function ve(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}ve.prototype.h=function(){this.defaultPrevented=!0};var we=function(){if(!re.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{re.addEventListener("test",ie,e),re.removeEventListener("test",ie,e)}catch(t){}return t}();function be(t){return/^[\s\xa0]*$/.test(t)}var Se=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function _e(t,e){return t<e?-1:t>e?1:0}function Ee(){var t=re.navigator;return t&&(t=t.userAgent)?t:""}function Te(t){return-1!=Ee().indexOf(t)}function Ie(t){return Ie[" "](t),t}Ie[" "]=ie;var ke,Ce,Ae=Te("Opera"),Re=Te("Trident")||Te("MSIE"),Ne=Te("Edge"),Le=Ne||Re,Oe=Te("Gecko")&&!(-1!=Ee().toLowerCase().indexOf("webkit")&&!Te("Edge"))&&!(Te("Trident")||Te("MSIE"))&&!Te("Edge"),De=-1!=Ee().toLowerCase().indexOf("webkit")&&!Te("Edge");function xe(){var t=re.document;return t?t.documentMode:void 0}t:{var Pe="",Me=(Ce=Ee(),Oe?/rv:([^\);]+)(\)|;)/.exec(Ce):Ne?/Edge\/([\d\.]+)/.exec(Ce):Re?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Ce):De?/WebKit\/(\S+)/.exec(Ce):Ae?/(?:Version)[ \/]?(\S+)/.exec(Ce):void 0);if(Me&&(Pe=Me?Me[1]:""),Re){var Ue=xe();if(null!=Ue&&Ue>parseFloat(Pe)){ke=String(Ue);break t}}ke=Pe}var Fe,ze={};function Be(){return function(t){var e=ze;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Se(String(ke)).split("."),n=Se("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=_e(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||_e(0==s[2].length,0==o[2].length)||_e(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(re.document&&Re){var Ve=xe();Fe=Ve||(parseInt(ke,10)||void 0)}else Fe=void 0;var He=Fe;function je(t,e){if(ve.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Oe){t:{try{Ie(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:qe[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&je.X.h.call(this)}}fe(je,ve);var qe={2:"touch",3:"pen",4:"mouse"};je.prototype.h=function(){je.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var $e="closure_listenable_"+(1e6*Math.random()|0),Ke=0;function Ge(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=i,this.key=++Ke,this.ba=this.ea=!1}function We(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function Qe(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Ye(t){var e={};for(var n in t)e[n]=t[n];return e}var Je="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Xe(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<Je.length;s++)n=Je[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Ze(t){this.src=t,this.g={},this.h=0}function tn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=ge(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(We(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function en(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==r)return i}return-1}Ze.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=en(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new Ge(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var nn="closure_lm_"+(1e6*Math.random()|0),rn={};function sn(t,e,n,r,i){if(r&&r.once)return an(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)sn(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.N(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!1,r,i)}function on(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=oe(i)?!!i.capture:!!i,a=dn(t);if(a||(t[nn]=a=new Ze(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=hn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)we||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(un(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function an(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)an(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.O(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!0,r,i)}function cn(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)cn(t,e[s],n,r,i);else r=oe(r)?!!r.capture:!!r,n=pn(n),t&&t[$e]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=en(s=t.g[e],n,r,i))&&(We(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=dn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=en(e,n,r,i)),(n=-1<t?e[t]:null)&&ln(n))}function ln(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[$e])tn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(un(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=dn(e))?(tn(n,t),0==n.h&&(n.src=null,e[nn]=null)):We(t)}}}function un(t){return t in rn?rn[t]:rn[t]="on"+t}function hn(t,e){if(t.ba)t=!0;else{e=new je(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&ln(t),t=n.call(r,e)}return t}function dn(t){return(t=t[nn])instanceof Ze?t:null}var fn="__closure_events_fn_"+(1e9*Math.random()>>>0);function pn(t){return"function"==typeof t?t:(t[fn]||(t[fn]=function(e){return t.handleEvent(e)}),t[fn])}function gn(){pe.call(this),this.i=new Ze(this),this.P=this,this.I=null}function mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new ve(e,t);else if(e instanceof ve)e.target=e.target||t;else{var i=e;Xe(e=new ve(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=yn(o,r,!0,e)&&i}if(i=yn(o=e.g=t,r,!0,e)&&i,i=yn(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=yn(o=e.g=n[s],r,!1,e)&&i}function yn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&tn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}fe(gn,pe),gn.prototype[$e]=!0,gn.prototype.removeEventListener=function(t,e,n,r){cn(this,t,e,n,r)},gn.prototype.M=function(){if(gn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)We(n[r]);delete e.g[t],e.h--}}this.I=null},gn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},gn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var vn=re.JSON.stringify;function wn(){var t=Cn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var bn,Sn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=_n.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),_n=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new En}),(function(t){return t.reset()})),En=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function Tn(t){re.setTimeout((function(){throw t}),0)}function In(t,e){bn||function(){var t=re.Promise.resolve(void 0);bn=function(){t.then(An)}}(),kn||(bn(),kn=!0),Cn.add(t,e)}var kn=!1,Cn=new Sn;function An(){for(var t;t=wn();){try{t.h.call(t.g)}catch(t){Tn(t)}var e=_n;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}kn=!1}function Rn(t,e){gn.call(this),this.h=t||1,this.g=e||re,this.j=he(this.lb,this),this.l=Date.now()}function Nn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Ln(t,e,n){if("function"==typeof t)n&&(t=he(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=he(t.handleEvent,t)}return 2147483647<Number(e)?-1:re.setTimeout(t,e||0)}function On(t){t.g=Ln((function(){t.g=null,t.i&&(t.i=!1,On(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}fe(Rn,gn),(te=Rn.prototype).ca=!1,te.R=null,te.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),mn(this,"tick"),this.ca&&(Nn(this),this.start()))}},te.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},te.M=function(){Rn.X.M.call(this),Nn(this),delete this.g};var Dn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Jt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:On(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(re.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(pe);function xn(t){pe.call(this),this.h=t,this.g={}}fe(xn,pe);var Pn=[];function Mn(t,e,n,r){Array.isArray(n)||(n&&(Pn[0]=n.toString()),n=Pn);for(var i=0;i<n.length;i++){var s=sn(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function Un(t){Qe(t.g,(function(t,e){this.g.hasOwnProperty(e)&&ln(t)}),t),t.g={}}function Fn(){this.g=!0}function zn(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return vn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}xn.prototype.M=function(){xn.X.M.call(this),Un(this)},xn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},Fn.prototype.Aa=function(){this.g=!1},Fn.prototype.info=function(){};var Bn={},Vn=null;function Hn(){return Vn=Vn||new gn}function jn(t){ve.call(this,Bn.Pa,t)}function qn(t){var e=Hn();mn(e,new jn(e))}function $n(t,e){ve.call(this,Bn.STAT_EVENT,t),this.stat=e}function Kn(t){var e=Hn();mn(e,new $n(e,t))}function Gn(t,e){ve.call(this,Bn.Qa,t),this.size=e}function Wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return re.setTimeout((function(){t()}),e)}Bn.Pa="serverreachability",fe(jn,ve),Bn.STAT_EVENT="statevent",fe($n,ve),Bn.Qa="timingevent",fe(Gn,ve);var Qn={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Yn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function Jn(){}function Xn(t){return t.h||(t.h=t.i())}function Zn(){}Jn.prototype.h=null;var tr,er={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function nr(){ve.call(this,"d")}function rr(){ve.call(this,"c")}function ir(){}function sr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new xn(this),this.O=ar,t=Le?125:void 0,this.T=new Rn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new or}function or(){this.i=null,this.g="",this.h=!1}fe(nr,ve),fe(rr,ve),fe(ir,Jn),ir.prototype.g=function(){return new XMLHttpRequest},ir.prototype.i=function(){return{}},tr=new ir;var ar=45e3,cr={},lr={};function ur(t,e,n){t.K=1,t.v=Rr(Tr(e)),t.s=n,t.P=!0,hr(t,null)}function hr(t,e){t.F=Date.now(),gr(t),t.A=Tr(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),Hr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new or,t.g=Hi(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Dn(he(t.La,t,t.g),t.N)),Mn(t.S,t.g,"readystatechange",t.ib),e=t.H?Ye(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),qn(),function(t,e,n,r,i,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function dr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function fr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=pr(t,n))==lr){4==e&&(t.o=4,Kn(14),i=!1),zn(t.j,t.m,null,"[Incomplete Response]");break}if(r==cr){t.o=4,Kn(15),zn(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}zn(t.j,t.m,r,null),br(t,r)}dr(t)&&r!=lr&&r!=cr&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,Kn(16),i=!1),t.i=t.i&&i,i?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),xi(e),e.K=!0,Kn(11))):(zn(t.j,t.m,n,"[Invalid Chunked Response]"),wr(t),vr(t))}function pr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?lr:(n=Number(e.substring(n,r)),isNaN(n)?cr:(r+=1)+n>e.length?lr:(e=e.substr(r,n),t.C=r+n,e))}function gr(t){t.V=Date.now()+t.O,mr(t,t.O)}function mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=Wn(he(t.gb,t),e)}function yr(t){t.B&&(re.clearTimeout(t.B),t.B=null)}function vr(t){0==t.l.G||t.I||Ui(t.l,t)}function wr(t){yr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Nn(t.T),Un(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function br(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||Qr(n.h,t)))if(!t.J&&Qr(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Mi(n),ki(n)}Di(n),Kn(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=Wn(he(n.cb,n),6e3));if(1>=Wr(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else zi(n,11)}else if((t.J||n.g==t)&&Mi(n),!be(e))for(i=n.Fa.g.parse(e),e=0;e<i.length;e++){var s=i[e];if(n.T=s[0],s=s[1],2==n.G)if("c"==s[0]){n.I=s[1],n.ka=s[2];var o=s[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=s[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=r.h;h.g||-1==u.indexOf("spdy")&&-1==u.indexOf("quic")&&-1==u.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(Yr(h,h.h),h.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Ar(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=Vi(r,r.H?r.ka:null,r.V),f.J){Jr(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(yr(p),gr(p)),r.g=f}else Oi(r);0<n.i.length&&Ai(n)}else"stop"!=s[0]&&"close"!=s[0]||zi(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?zi(n,7):Ii(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}qn()}catch(s){}}function Sr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(se(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(se(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(se(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}(te=sr.prototype).setTimeout=function(t){this.O=t},te.ib=function(t){t=t.target;var e=this.L;e&&3==wi(t)?e.l():this.La(t)},te.La=function(t){try{if(t==this.g)t:{var e=wi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Le||this.g&&(this.h.h||this.g.fa()||bi(this.g)))){this.I||4!=e||7==n||qn(),yr(this);var r=this.g.aa();this.Y=r;e:if(dr(this)){var i=bi(this.g);t="";var s=i.length,o=4==wi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){wr(this),vr(this);var a="";break e}this.h.i=new re.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:o&&n==s-1});i.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!be(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,Kn(12),wr(this),vr(this);break t}zn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,br(this,r)}this.P?(fr(this,e,a),Le&&this.i&&3==e&&(Mn(this.S,this.T,"tick",this.hb),this.T.start())):(zn(this.j,this.m,a,null),br(this,a)),4==e&&wr(this),this.i&&!this.I&&(4==e?Ui(this.l,this):(this.i=!1,gr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,Kn(12)):(this.o=0,Kn(13)),wr(this),vr(this)}}}catch(e){}},te.hb=function(){if(this.g){var t=wi(this.g),e=this.g.fa();this.C<e.length&&(yr(this),fr(this,t,e),this.i&&4!=t&&gr(this))}},te.cancel=function(){this.I=!0,wr(this)},te.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(qn(),Kn(17)),wr(this),this.o=2,vr(this)):mr(this,this.V-t)};var _r=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Er(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Er){this.h=void 0!==e?e:t.h,Ir(this,t.j),this.s=t.s,this.g=t.g,kr(this,t.m),this.l=t.l,e=t.i;var n=new Fr;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Cr(this,n),this.o=t.o}else t&&(n=String(t).match(_r))?(this.h=!!e,Ir(this,n[1]||"",!0),this.s=Nr(n[2]||""),this.g=Nr(n[3]||"",!0),kr(this,n[4]),this.l=Nr(n[5]||"",!0),Cr(this,n[6]||"",!0),this.o=Nr(n[7]||"")):(this.h=!!e,this.i=new Fr(null,this.h))}function Tr(t){return new Er(t)}function Ir(t,e,n){t.j=n?Nr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function kr(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Cr(t,e,n){e instanceof Fr?(t.i=e,function(t,e){e&&!t.j&&(zr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(Br(this,e),Hr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Lr(e,Mr)),t.i=new Fr(e,t.h))}function Ar(t,e,n){t.i.set(e,n)}function Rr(t){return Ar(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Nr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Lr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Or),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Or(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Er.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Lr(e,Dr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Lr(e,Dr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Lr(n,"/"==n.charAt(0)?Pr:xr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Lr(n,Ur)),t.join("")};var Dr=/[#\/\?@]/g,xr=/[#\?:]/g,Pr=/[#\?]/g,Mr=/[#\?@]/g,Ur=/#/g;function Fr(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function zr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function Br(t,e){zr(t),e=jr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function Vr(t,e){return zr(t),e=jr(t,e),t.g.has(e)}function Hr(t,e,n){Br(t,e),0<n.length&&(t.i=null,t.g.set(jr(t,e),me(n)),t.h+=n.length)}function jr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(te=Fr.prototype).add=function(t,e){zr(this),this.i=null,t=jr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},te.forEach=function(t,e){zr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},te.oa=function(){zr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},te.W=function(t){zr(this);var e=[];if("string"==typeof t)Vr(this,t)&&(e=e.concat(this.g.get(jr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},te.set=function(t,e){return zr(this),this.i=null,Vr(this,t=jr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},te.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},te.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r)),s=this.W(r);for(r=0;r<s.length;r++){var o=i;""!==s[r]&&(o+="="+encodeURIComponent(String(s[r]))),t.push(o)}}return this.i=t.join("&")};var qr=function(t,e){this.h=t,this.g=e};function $r(t){this.l=t||Kr,re.PerformanceNavigationTiming?t=0<(t=re.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(re.g&&re.g.Ga&&re.g.Ga()&&re.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Kr=10;function Gr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function Wr(t){return t.h?1:t.g?t.g.size:0}function Qr(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Yr(t,e){t.g?t.g.add(e):t.h=e}function Jr(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Xr(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var i=Xt(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return me(t.i)}function Zr(){}function ti(){this.g=new Zr}function ei(t,e,n){var r=n||"";try{Sr(t,(function(t,n){var i=t;oe(t)&&(i=vn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function ni(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function ri(t){this.l=t.ac||null,this.j=t.jb||!1}function ii(t,e){gn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=si,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}$r.prototype.cancel=function(){var t,e;if(this.i=Xr(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Xt(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Zr.prototype.stringify=function(t){return re.JSON.stringify(t,void 0)},Zr.prototype.parse=function(t){return re.JSON.parse(t,void 0)},fe(ri,Jn),ri.prototype.g=function(){return new ii(this.l,this.j)},ri.prototype.i=function(t){return function(){return t}}({}),fe(ii,gn);var si=0;function oi(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function ai(t){t.readyState=4,t.l=null,t.j=null,t.A=null,ci(t)}function ci(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(te=ii.prototype).open=function(t,e){if(this.readyState!=si)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,ci(this)},te.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||re).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},te.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,ai(this)),this.readyState=si},te.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,ci(this)),this.g&&(this.readyState=3,ci(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==re.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;oi(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},te.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?ai(this):ci(this),3==this.readyState&&oi(this)}},te.Va=function(t){this.g&&(this.response=this.responseText=t,ai(this))},te.Ua=function(t){this.g&&(this.response=t,ai(this))},te.ga=function(){this.g&&ai(this)},te.setRequestHeader=function(t,e){this.v.append(t,e)},te.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},te.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(ii.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var li=re.JSON.parse;function ui(t){gn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=hi,this.K=this.L=!1}fe(ui,gn);var hi="",di=/^https?$/i,fi=["POST","PUT"];function pi(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,gi(t),yi(t)}function gi(t){t.D||(t.D=!0,mn(t,"complete"),mn(t,"error"))}function mi(t){if(t.h&&void 0!==ne&&(!t.C[1]||4!=wi(t)||2!=t.aa()))if(t.v&&4==wi(t))Ln(t.Ha,0,t);else if(mn(t,"readystatechange"),4==wi(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var s=String(t.H).match(_r)[1]||null;if(!s&&re.self&&re.self.location){var o=re.self.location.protocol;s=o.substr(0,o.length-1)}i=!di.test(s?s.toLowerCase():"")}e=i}if(e)mn(t,"complete"),mn(t,"success");else{t.m=6;try{var a=2<wi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",gi(t)}}finally{yi(t)}}}function yi(t,e){if(t.g){vi(t);var n=t.g,r=t.C[0]?ie:null;t.g=null,t.C=null,e||mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function vi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(re.clearTimeout(t.A),t.A=null)}function wi(t){return t.g?t.g.readyState:0}function bi(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case hi:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Si(t){var e="";return Qe(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function _i(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Si(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Ar(t,e,n))}function Ei(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ti(t){this.Ca=0,this.i=[],this.j=new Fn,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Ei("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Ei("baseRetryDelayMs",5e3,t),this.bb=Ei("retryDelaySeedMs",1e4,t),this.$a=Ei("forwardChannelMaxRetries",2,t),this.ta=Ei("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new $r(t&&t.concurrentRequestLimit),this.Fa=new ti,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Ii(t){if(Ci(t),3==t.G){var e=t.U++,n=Tr(t.F);Ar(n,"SID",t.I),Ar(n,"RID",e),Ar(n,"TYPE","terminate"),Ni(t,n),(e=new sr(t,t.j,e,void 0)).K=2,e.v=Rr(Tr(n)),n=!1,re.navigator&&re.navigator.sendBeacon&&(n=re.navigator.sendBeacon(e.v.toString(),"")),!n&&re.Image&&((new Image).src=e.v,n=!0),n||(e.g=Hi(e.l,null),e.g.da(e.v)),e.F=Date.now(),gr(e)}Bi(t)}function ki(t){t.g&&(xi(t),t.g.cancel(),t.g=null)}function Ci(t){ki(t),t.u&&(re.clearTimeout(t.u),t.u=null),Mi(t),t.h.cancel(),t.m&&("number"==typeof t.m&&re.clearTimeout(t.m),t.m=null)}function Ai(t){Gr(t.h)||t.m||(t.m=!0,In(t.Ja,t),t.C=0)}function Ri(t,e){var n;n=e?e.m:t.U++;var r=Tr(t.F);Ar(r,"SID",t.I),Ar(r,"RID",n),Ar(r,"AID",t.T),Ni(t,r),t.o&&t.s&&_i(r,t.o,t.s),n=new sr(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Li(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Yr(t.h,n),ur(n,r,e)}function Ni(t,e){t.ia&&Qe(t.ia,(function(t,n){Ar(e,n,t)})),t.l&&Sr({},(function(t,n){Ar(e,n,t)}))}function Li(t,e,n){n=Math.min(t.i.length,n);var r=t.l?he(t.l.Ra,t.l,t):null;t:for(var i=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=i[c].h,u=i[c].g;if(0>(l-=s))s=Math.max(0,i[c].h-100),a=!1;else try{ei(u,o,"req"+l+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Oi(t){t.g||t.u||(t.Z=1,In(t.Ia,t),t.A=0)}function Di(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=Wn(he(t.Ia,t),Fi(t,t.A)),t.A++,!0)}function xi(t){null!=t.B&&(re.clearTimeout(t.B),t.B=null)}function Pi(t){t.g=new sr(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Tr(t.sa);Ar(e,"RID","rpc"),Ar(e,"SID",t.I),Ar(e,"CI",t.L?"0":"1"),Ar(e,"AID",t.T),Ar(e,"TYPE","xmlhttp"),Ni(t,e),t.o&&t.s&&_i(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Rr(Tr(e)),n.s=null,n.P=!0,hr(n,t)}function Mi(t){null!=t.v&&(re.clearTimeout(t.v),t.v=null)}function Ui(t,e){var n=null;if(t.g==e){Mi(t),xi(t),t.g=null;var r=2}else{if(!Qr(t.h,e))return;n=e.D,Jr(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var i=t.C;mn(r=Hn(),new Gn(r,n)),Ai(t)}else Oi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(Wr(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=Wn(he(t.Ja,t,e),Fi(t,t.C)),t.C++,0)))}(t,e)||2==r&&Di(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:zi(t,5);break;case 4:zi(t,10);break;case 3:zi(t,6);break;default:zi(t,2)}}function Fi(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function zi(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=he(t.kb,t);n||(n=new Er("//www.google.com/images/cleardot.gif"),re.location&&"http"==re.location.protocol||Ir(n,"https"),Rr(n)),function(t,e){var n=new Fn;if(re.Image){var r=new Image;r.onload=de(ni,n,r,"TestLoadImage: loaded",!0,e),r.onerror=de(ni,n,r,"TestLoadImage: error",!1,e),r.onabort=de(ni,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=de(ni,n,r,"TestLoadImage: timeout",!1,e),re.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else Kn(2);t.G=0,t.l&&t.l.va(e),Bi(t),Ci(t)}function Bi(t){if(t.G=0,t.la=[],t.l){var e=Xr(t.h);0==e.length&&0==t.i.length||(ye(t.la,e),ye(t.la,t.i),t.h.i.length=0,me(t.i),t.i.length=0),t.l.ua()}}function Vi(t,e,n){var r=n instanceof Er?Tr(n):new Er(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),kr(r,r.m);else{var i=re.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Er(null,void 0);r&&Ir(s,r),e&&(s.g=e),i&&kr(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&Ar(r,n,e),Ar(r,"VER",t.ma),Ni(t,r),r}function Hi(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new ui(new ri({jb:!0})):new ui(t.ra)).Ka(t.H),e}function ji(){}function qi(){if(Re&&!(10<=Number(He)))throw Error("Environmental error: no available transport.")}function $i(t,e){gn.call(this),this.g=new Ti(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!be(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!be(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new Wi(this)}function Ki(t){nr.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function Gi(){rr.call(this),this.status=1}function Wi(t){this.g=t}(te=ui.prototype).Ka=function(t){this.L=t},te.da=function(t,e,n,r){var i,s,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():tr.g(),this.C=this.u?Xn(this.u):Xn(tr),this.g.onreadystatechange=he(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void pi(this,h)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var l=Xt(r.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,r.get(h))}}catch(t){i={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=re.FormData&&t instanceof re.FormData,!(0<=ge(fi,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Xt(n),f=d.next();!f.done;f=d.next()){var p=Zt(f.value,2),g=(h=p[0],p[1]);this.g.setRequestHeader(h,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{vi(this),0<this.B&&((this.K=function(t){return Re&&Be()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=he(this.qa,this)):this.A=Ln(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){pi(this,h)}},te.qa=function(){void 0!==ne&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,mn(this,"timeout"),this.abort(8))},te.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,mn(this,"complete"),mn(this,"abort"),yi(this))},te.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),yi(this,!0)),ui.X.M.call(this)},te.Ha=function(){this.s||(this.F||this.v||this.l?mi(this):this.fb())},te.fb=function(){mi(this)},te.aa=function(){try{return 2<wi(this)?this.g.status:-1}catch(t){return-1}},te.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},te.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),li(e)}},te.Ea=function(){return this.m},te.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(te=Ti.prototype).ma=8,te.G=1,te.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new sr(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Xe(n=Ye(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,i=0;i<this.i.length;i++){var s=this.i[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.i.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Li(this,e,r),Ar(i=Tr(this.F),"RID",t),Ar(i,"CVER",22),this.D&&Ar(i,"X-HTTP-Session-Id",this.D),Ni(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Si(n)))+"&"+r:this.o&&_i(i,this.o,n)),Yr(this.h,e),this.Ya&&Ar(i,"TYPE","init"),this.O?(Ar(i,"$req",r),Ar(i,"SID","null"),e.Z=!0,ur(e,i,null)):ur(e,i,r),this.G=2}}else 3==this.G&&(t?Ri(this,t):0==this.i.length||Gr(this.h)||Ri(this))},te.Ia=function(){if(this.u=null,Pi(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=Wn(he(this.eb,this),t)}},te.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,Kn(10),ki(this),Pi(this))},te.cb=function(){null!=this.v&&(this.v=null,ki(this),Di(this),Kn(19))},te.kb=function(t){t?(this.j.info("Successfully pinged google.com"),Kn(2)):(this.j.info("Failed to ping google.com"),Kn(1))},(te=ji.prototype).xa=function(){},te.wa=function(){},te.va=function(){},te.ua=function(){},te.Ra=function(){},qi.prototype.g=function(t,e){return new $i(t,e)},fe($i,gn),$i.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;Kn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=Vi(t,null,t.V),Ai(t)},$i.prototype.close=function(){Ii(this.g)},$i.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=vn(t),t=n);e.i.push(new qr(e.ab++,t)),3==e.G&&Ai(e)},$i.prototype.M=function(){this.g.l=null,delete this.j,Ii(this.g),delete this.g,$i.X.M.call(this)},fe(Ki,nr),fe(Gi,rr),fe(Wi,ji),Wi.prototype.xa=function(){mn(this.g,"a")},Wi.prototype.wa=function(t){mn(this.g,new Ki(t))},Wi.prototype.va=function(t){mn(this.g,new Gi)},Wi.prototype.ua=function(){mn(this.g,"b")},qi.prototype.createWebChannel=qi.prototype.g,$i.prototype.send=$i.prototype.u,$i.prototype.open=$i.prototype.m,$i.prototype.close=$i.prototype.close,Qn.NO_ERROR=0,Qn.TIMEOUT=8,Qn.HTTP_ERROR=6,Yn.COMPLETE="complete",Zn.EventType=er,er.OPEN="a",er.CLOSE="b",er.ERROR="c",er.MESSAGE="d",gn.prototype.listen=gn.prototype.N,ui.prototype.listenOnce=ui.prototype.O,ui.prototype.getLastError=ui.prototype.Oa,ui.prototype.getLastErrorCode=ui.prototype.Ea,ui.prototype.getStatus=ui.prototype.aa,ui.prototype.getResponseJson=ui.prototype.Sa,ui.prototype.getResponseText=ui.prototype.fa,ui.prototype.send=ui.prototype.da,ui.prototype.setWithCredentials=ui.prototype.Ka;var Qi=Qn,Yi=Yn,Ji=Bn,Xi=10,Zi=11,ts=ri,es=Zn,ns=ui;const rs="@firebase/firestore";
|
|
318
|
+
*/var Yt;Yt="",Lt(new I("platform-logger",(t=>new X(t)),"PRIVATE")),Lt(new I("heartbeat",(t=>new Kt(t)),"PRIVATE")),zt(Z,tt,Yt),zt(Z,tt,"esm2017"),zt("fire-js","");var Jt=function(t,e){return Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Jt(t,e)};function Xt(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Zt(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var te,ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ne=ne||{},re=ee||self;function ie(){}function se(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function oe(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var ae="closure_uid_"+(1e9*Math.random()>>>0),ce=0;function le(t,e,n){return t.call.apply(t.bind,arguments)}function ue(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function he(t,e,n){return(he=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?le:ue).apply(null,arguments)}function de(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function fe(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function pe(){this.s=this.s,this.o=this.o}pe.prototype.s=!1,pe.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,ae)&&t[ae]||(t[ae]=++ce))},pe.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var ge=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function ye(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(se(r)){var i=t.length||0,s=r.length||0;t.length=i+s;for(var o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function ve(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}ve.prototype.h=function(){this.defaultPrevented=!0};var we=function(){if(!re.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{re.addEventListener("test",ie,e),re.removeEventListener("test",ie,e)}catch(t){}return t}();function be(t){return/^[\s\xa0]*$/.test(t)}var Se=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function _e(t,e){return t<e?-1:t>e?1:0}function Ee(){var t=re.navigator;return t&&(t=t.userAgent)?t:""}function Te(t){return-1!=Ee().indexOf(t)}function Ie(t){return Ie[" "](t),t}Ie[" "]=ie;var ke,Ce,Ae=Te("Opera"),Re=Te("Trident")||Te("MSIE"),Ne=Te("Edge"),Le=Ne||Re,Oe=Te("Gecko")&&!(-1!=Ee().toLowerCase().indexOf("webkit")&&!Te("Edge"))&&!(Te("Trident")||Te("MSIE"))&&!Te("Edge"),De=-1!=Ee().toLowerCase().indexOf("webkit")&&!Te("Edge");function xe(){var t=re.document;return t?t.documentMode:void 0}t:{var Pe="",Me=(Ce=Ee(),Oe?/rv:([^\);]+)(\)|;)/.exec(Ce):Ne?/Edge\/([\d\.]+)/.exec(Ce):Re?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Ce):De?/WebKit\/(\S+)/.exec(Ce):Ae?/(?:Version)[ \/]?(\S+)/.exec(Ce):void 0);if(Me&&(Pe=Me?Me[1]:""),Re){var Ue=xe();if(null!=Ue&&Ue>parseFloat(Pe)){ke=String(Ue);break t}}ke=Pe}var ze,Fe={};function Be(){return function(t){var e=Fe;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Se(String(ke)).split("."),n=Se("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=_e(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||_e(0==s[2].length,0==o[2].length)||_e(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(re.document&&Re){var Ve=xe();ze=Ve||(parseInt(ke,10)||void 0)}else ze=void 0;var He=ze;function je(t,e){if(ve.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Oe){t:{try{Ie(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:qe[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&je.X.h.call(this)}}fe(je,ve);var qe={2:"touch",3:"pen",4:"mouse"};je.prototype.h=function(){je.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var $e="closure_listenable_"+(1e6*Math.random()|0),Ke=0;function Ge(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=i,this.key=++Ke,this.ba=this.ea=!1}function We(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function Qe(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Ye(t){var e={};for(var n in t)e[n]=t[n];return e}var Je="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Xe(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<Je.length;s++)n=Je[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Ze(t){this.src=t,this.g={},this.h=0}function tn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=ge(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(We(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function en(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==r)return i}return-1}Ze.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=en(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new Ge(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var nn="closure_lm_"+(1e6*Math.random()|0),rn={};function sn(t,e,n,r,i){if(r&&r.once)return an(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)sn(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.N(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!1,r,i)}function on(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=oe(i)?!!i.capture:!!i,a=dn(t);if(a||(t[nn]=a=new Ze(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=hn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)we||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(un(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function an(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)an(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.O(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!0,r,i)}function cn(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)cn(t,e[s],n,r,i);else r=oe(r)?!!r.capture:!!r,n=pn(n),t&&t[$e]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=en(s=t.g[e],n,r,i))&&(We(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=dn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=en(e,n,r,i)),(n=-1<t?e[t]:null)&&ln(n))}function ln(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[$e])tn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(un(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=dn(e))?(tn(n,t),0==n.h&&(n.src=null,e[nn]=null)):We(t)}}}function un(t){return t in rn?rn[t]:rn[t]="on"+t}function hn(t,e){if(t.ba)t=!0;else{e=new je(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&ln(t),t=n.call(r,e)}return t}function dn(t){return(t=t[nn])instanceof Ze?t:null}var fn="__closure_events_fn_"+(1e9*Math.random()>>>0);function pn(t){return"function"==typeof t?t:(t[fn]||(t[fn]=function(e){return t.handleEvent(e)}),t[fn])}function gn(){pe.call(this),this.i=new Ze(this),this.P=this,this.I=null}function mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new ve(e,t);else if(e instanceof ve)e.target=e.target||t;else{var i=e;Xe(e=new ve(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=yn(o,r,!0,e)&&i}if(i=yn(o=e.g=t,r,!0,e)&&i,i=yn(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=yn(o=e.g=n[s],r,!1,e)&&i}function yn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&tn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}fe(gn,pe),gn.prototype[$e]=!0,gn.prototype.removeEventListener=function(t,e,n,r){cn(this,t,e,n,r)},gn.prototype.M=function(){if(gn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)We(n[r]);delete e.g[t],e.h--}}this.I=null},gn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},gn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var vn=re.JSON.stringify;function wn(){var t=Cn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var bn,Sn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=_n.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),_n=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new En}),(function(t){return t.reset()})),En=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function Tn(t){re.setTimeout((function(){throw t}),0)}function In(t,e){bn||function(){var t=re.Promise.resolve(void 0);bn=function(){t.then(An)}}(),kn||(bn(),kn=!0),Cn.add(t,e)}var kn=!1,Cn=new Sn;function An(){for(var t;t=wn();){try{t.h.call(t.g)}catch(t){Tn(t)}var e=_n;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}kn=!1}function Rn(t,e){gn.call(this),this.h=t||1,this.g=e||re,this.j=he(this.lb,this),this.l=Date.now()}function Nn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Ln(t,e,n){if("function"==typeof t)n&&(t=he(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=he(t.handleEvent,t)}return 2147483647<Number(e)?-1:re.setTimeout(t,e||0)}function On(t){t.g=Ln((function(){t.g=null,t.i&&(t.i=!1,On(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}fe(Rn,gn),(te=Rn.prototype).ca=!1,te.R=null,te.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),mn(this,"tick"),this.ca&&(Nn(this),this.start()))}},te.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},te.M=function(){Rn.X.M.call(this),Nn(this),delete this.g};var Dn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Jt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:On(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(re.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(pe);function xn(t){pe.call(this),this.h=t,this.g={}}fe(xn,pe);var Pn=[];function Mn(t,e,n,r){Array.isArray(n)||(n&&(Pn[0]=n.toString()),n=Pn);for(var i=0;i<n.length;i++){var s=sn(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function Un(t){Qe(t.g,(function(t,e){this.g.hasOwnProperty(e)&&ln(t)}),t),t.g={}}function zn(){this.g=!0}function Fn(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return vn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}xn.prototype.M=function(){xn.X.M.call(this),Un(this)},xn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},zn.prototype.Aa=function(){this.g=!1},zn.prototype.info=function(){};var Bn={},Vn=null;function Hn(){return Vn=Vn||new gn}function jn(t){ve.call(this,Bn.Pa,t)}function qn(t){var e=Hn();mn(e,new jn(e))}function $n(t,e){ve.call(this,Bn.STAT_EVENT,t),this.stat=e}function Kn(t){var e=Hn();mn(e,new $n(e,t))}function Gn(t,e){ve.call(this,Bn.Qa,t),this.size=e}function Wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return re.setTimeout((function(){t()}),e)}Bn.Pa="serverreachability",fe(jn,ve),Bn.STAT_EVENT="statevent",fe($n,ve),Bn.Qa="timingevent",fe(Gn,ve);var Qn={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Yn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function Jn(){}function Xn(t){return t.h||(t.h=t.i())}function Zn(){}Jn.prototype.h=null;var tr,er={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function nr(){ve.call(this,"d")}function rr(){ve.call(this,"c")}function ir(){}function sr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new xn(this),this.O=ar,t=Le?125:void 0,this.T=new Rn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new or}function or(){this.i=null,this.g="",this.h=!1}fe(nr,ve),fe(rr,ve),fe(ir,Jn),ir.prototype.g=function(){return new XMLHttpRequest},ir.prototype.i=function(){return{}},tr=new ir;var ar=45e3,cr={},lr={};function ur(t,e,n){t.K=1,t.v=Rr(Tr(e)),t.s=n,t.P=!0,hr(t,null)}function hr(t,e){t.F=Date.now(),gr(t),t.A=Tr(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),Hr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new or,t.g=Hi(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Dn(he(t.La,t,t.g),t.N)),Mn(t.S,t.g,"readystatechange",t.ib),e=t.H?Ye(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),qn(),function(t,e,n,r,i,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function dr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function fr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=pr(t,n))==lr){4==e&&(t.o=4,Kn(14),i=!1),Fn(t.j,t.m,null,"[Incomplete Response]");break}if(r==cr){t.o=4,Kn(15),Fn(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}Fn(t.j,t.m,r,null),br(t,r)}dr(t)&&r!=lr&&r!=cr&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,Kn(16),i=!1),t.i=t.i&&i,i?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),xi(e),e.K=!0,Kn(11))):(Fn(t.j,t.m,n,"[Invalid Chunked Response]"),wr(t),vr(t))}function pr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?lr:(n=Number(e.substring(n,r)),isNaN(n)?cr:(r+=1)+n>e.length?lr:(e=e.substr(r,n),t.C=r+n,e))}function gr(t){t.V=Date.now()+t.O,mr(t,t.O)}function mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=Wn(he(t.gb,t),e)}function yr(t){t.B&&(re.clearTimeout(t.B),t.B=null)}function vr(t){0==t.l.G||t.I||Ui(t.l,t)}function wr(t){yr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Nn(t.T),Un(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function br(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||Qr(n.h,t)))if(!t.J&&Qr(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Mi(n),ki(n)}Di(n),Kn(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=Wn(he(n.cb,n),6e3));if(1>=Wr(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else Fi(n,11)}else if((t.J||n.g==t)&&Mi(n),!be(e))for(i=n.Fa.g.parse(e),e=0;e<i.length;e++){var s=i[e];if(n.T=s[0],s=s[1],2==n.G)if("c"==s[0]){n.I=s[1],n.ka=s[2];var o=s[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=s[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=r.h;h.g||-1==u.indexOf("spdy")&&-1==u.indexOf("quic")&&-1==u.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(Yr(h,h.h),h.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Ar(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=Vi(r,r.H?r.ka:null,r.V),f.J){Jr(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(yr(p),gr(p)),r.g=f}else Oi(r);0<n.i.length&&Ai(n)}else"stop"!=s[0]&&"close"!=s[0]||Fi(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?Fi(n,7):Ii(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}qn()}catch(s){}}function Sr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(se(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(se(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(se(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}(te=sr.prototype).setTimeout=function(t){this.O=t},te.ib=function(t){t=t.target;var e=this.L;e&&3==wi(t)?e.l():this.La(t)},te.La=function(t){try{if(t==this.g)t:{var e=wi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Le||this.g&&(this.h.h||this.g.fa()||bi(this.g)))){this.I||4!=e||7==n||qn(),yr(this);var r=this.g.aa();this.Y=r;e:if(dr(this)){var i=bi(this.g);t="";var s=i.length,o=4==wi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){wr(this),vr(this);var a="";break e}this.h.i=new re.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:o&&n==s-1});i.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!be(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,Kn(12),wr(this),vr(this);break t}Fn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,br(this,r)}this.P?(fr(this,e,a),Le&&this.i&&3==e&&(Mn(this.S,this.T,"tick",this.hb),this.T.start())):(Fn(this.j,this.m,a,null),br(this,a)),4==e&&wr(this),this.i&&!this.I&&(4==e?Ui(this.l,this):(this.i=!1,gr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,Kn(12)):(this.o=0,Kn(13)),wr(this),vr(this)}}}catch(e){}},te.hb=function(){if(this.g){var t=wi(this.g),e=this.g.fa();this.C<e.length&&(yr(this),fr(this,t,e),this.i&&4!=t&&gr(this))}},te.cancel=function(){this.I=!0,wr(this)},te.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(qn(),Kn(17)),wr(this),this.o=2,vr(this)):mr(this,this.V-t)};var _r=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Er(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Er){this.h=void 0!==e?e:t.h,Ir(this,t.j),this.s=t.s,this.g=t.g,kr(this,t.m),this.l=t.l,e=t.i;var n=new zr;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Cr(this,n),this.o=t.o}else t&&(n=String(t).match(_r))?(this.h=!!e,Ir(this,n[1]||"",!0),this.s=Nr(n[2]||""),this.g=Nr(n[3]||"",!0),kr(this,n[4]),this.l=Nr(n[5]||"",!0),Cr(this,n[6]||"",!0),this.o=Nr(n[7]||"")):(this.h=!!e,this.i=new zr(null,this.h))}function Tr(t){return new Er(t)}function Ir(t,e,n){t.j=n?Nr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function kr(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Cr(t,e,n){e instanceof zr?(t.i=e,function(t,e){e&&!t.j&&(Fr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(Br(this,e),Hr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Lr(e,Mr)),t.i=new zr(e,t.h))}function Ar(t,e,n){t.i.set(e,n)}function Rr(t){return Ar(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Nr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Lr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Or),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Or(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Er.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Lr(e,Dr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Lr(e,Dr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Lr(n,"/"==n.charAt(0)?Pr:xr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Lr(n,Ur)),t.join("")};var Dr=/[#\/\?@]/g,xr=/[#\?:]/g,Pr=/[#\?]/g,Mr=/[#\?@]/g,Ur=/#/g;function zr(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function Fr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function Br(t,e){Fr(t),e=jr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function Vr(t,e){return Fr(t),e=jr(t,e),t.g.has(e)}function Hr(t,e,n){Br(t,e),0<n.length&&(t.i=null,t.g.set(jr(t,e),me(n)),t.h+=n.length)}function jr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(te=zr.prototype).add=function(t,e){Fr(this),this.i=null,t=jr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},te.forEach=function(t,e){Fr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},te.oa=function(){Fr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},te.W=function(t){Fr(this);var e=[];if("string"==typeof t)Vr(this,t)&&(e=e.concat(this.g.get(jr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},te.set=function(t,e){return Fr(this),this.i=null,Vr(this,t=jr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},te.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},te.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r)),s=this.W(r);for(r=0;r<s.length;r++){var o=i;""!==s[r]&&(o+="="+encodeURIComponent(String(s[r]))),t.push(o)}}return this.i=t.join("&")};var qr=function(t,e){this.h=t,this.g=e};function $r(t){this.l=t||Kr,re.PerformanceNavigationTiming?t=0<(t=re.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(re.g&&re.g.Ga&&re.g.Ga()&&re.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Kr=10;function Gr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function Wr(t){return t.h?1:t.g?t.g.size:0}function Qr(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Yr(t,e){t.g?t.g.add(e):t.h=e}function Jr(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Xr(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var i=Xt(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return me(t.i)}function Zr(){}function ti(){this.g=new Zr}function ei(t,e,n){var r=n||"";try{Sr(t,(function(t,n){var i=t;oe(t)&&(i=vn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function ni(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function ri(t){this.l=t.ac||null,this.j=t.jb||!1}function ii(t,e){gn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=si,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}$r.prototype.cancel=function(){var t,e;if(this.i=Xr(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Xt(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Zr.prototype.stringify=function(t){return re.JSON.stringify(t,void 0)},Zr.prototype.parse=function(t){return re.JSON.parse(t,void 0)},fe(ri,Jn),ri.prototype.g=function(){return new ii(this.l,this.j)},ri.prototype.i=function(t){return function(){return t}}({}),fe(ii,gn);var si=0;function oi(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function ai(t){t.readyState=4,t.l=null,t.j=null,t.A=null,ci(t)}function ci(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(te=ii.prototype).open=function(t,e){if(this.readyState!=si)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,ci(this)},te.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||re).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},te.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,ai(this)),this.readyState=si},te.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,ci(this)),this.g&&(this.readyState=3,ci(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==re.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;oi(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},te.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?ai(this):ci(this),3==this.readyState&&oi(this)}},te.Va=function(t){this.g&&(this.response=this.responseText=t,ai(this))},te.Ua=function(t){this.g&&(this.response=t,ai(this))},te.ga=function(){this.g&&ai(this)},te.setRequestHeader=function(t,e){this.v.append(t,e)},te.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},te.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(ii.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var li=re.JSON.parse;function ui(t){gn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=hi,this.K=this.L=!1}fe(ui,gn);var hi="",di=/^https?$/i,fi=["POST","PUT"];function pi(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,gi(t),yi(t)}function gi(t){t.D||(t.D=!0,mn(t,"complete"),mn(t,"error"))}function mi(t){if(t.h&&void 0!==ne&&(!t.C[1]||4!=wi(t)||2!=t.aa()))if(t.v&&4==wi(t))Ln(t.Ha,0,t);else if(mn(t,"readystatechange"),4==wi(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var s=String(t.H).match(_r)[1]||null;if(!s&&re.self&&re.self.location){var o=re.self.location.protocol;s=o.substr(0,o.length-1)}i=!di.test(s?s.toLowerCase():"")}e=i}if(e)mn(t,"complete"),mn(t,"success");else{t.m=6;try{var a=2<wi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",gi(t)}}finally{yi(t)}}}function yi(t,e){if(t.g){vi(t);var n=t.g,r=t.C[0]?ie:null;t.g=null,t.C=null,e||mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function vi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(re.clearTimeout(t.A),t.A=null)}function wi(t){return t.g?t.g.readyState:0}function bi(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case hi:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Si(t){var e="";return Qe(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function _i(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Si(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Ar(t,e,n))}function Ei(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ti(t){this.Ca=0,this.i=[],this.j=new zn,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Ei("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Ei("baseRetryDelayMs",5e3,t),this.bb=Ei("retryDelaySeedMs",1e4,t),this.$a=Ei("forwardChannelMaxRetries",2,t),this.ta=Ei("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new $r(t&&t.concurrentRequestLimit),this.Fa=new ti,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Ii(t){if(Ci(t),3==t.G){var e=t.U++,n=Tr(t.F);Ar(n,"SID",t.I),Ar(n,"RID",e),Ar(n,"TYPE","terminate"),Ni(t,n),(e=new sr(t,t.j,e,void 0)).K=2,e.v=Rr(Tr(n)),n=!1,re.navigator&&re.navigator.sendBeacon&&(n=re.navigator.sendBeacon(e.v.toString(),"")),!n&&re.Image&&((new Image).src=e.v,n=!0),n||(e.g=Hi(e.l,null),e.g.da(e.v)),e.F=Date.now(),gr(e)}Bi(t)}function ki(t){t.g&&(xi(t),t.g.cancel(),t.g=null)}function Ci(t){ki(t),t.u&&(re.clearTimeout(t.u),t.u=null),Mi(t),t.h.cancel(),t.m&&("number"==typeof t.m&&re.clearTimeout(t.m),t.m=null)}function Ai(t){Gr(t.h)||t.m||(t.m=!0,In(t.Ja,t),t.C=0)}function Ri(t,e){var n;n=e?e.m:t.U++;var r=Tr(t.F);Ar(r,"SID",t.I),Ar(r,"RID",n),Ar(r,"AID",t.T),Ni(t,r),t.o&&t.s&&_i(r,t.o,t.s),n=new sr(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Li(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Yr(t.h,n),ur(n,r,e)}function Ni(t,e){t.ia&&Qe(t.ia,(function(t,n){Ar(e,n,t)})),t.l&&Sr({},(function(t,n){Ar(e,n,t)}))}function Li(t,e,n){n=Math.min(t.i.length,n);var r=t.l?he(t.l.Ra,t.l,t):null;t:for(var i=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=i[c].h,u=i[c].g;if(0>(l-=s))s=Math.max(0,i[c].h-100),a=!1;else try{ei(u,o,"req"+l+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Oi(t){t.g||t.u||(t.Z=1,In(t.Ia,t),t.A=0)}function Di(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=Wn(he(t.Ia,t),zi(t,t.A)),t.A++,!0)}function xi(t){null!=t.B&&(re.clearTimeout(t.B),t.B=null)}function Pi(t){t.g=new sr(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Tr(t.sa);Ar(e,"RID","rpc"),Ar(e,"SID",t.I),Ar(e,"CI",t.L?"0":"1"),Ar(e,"AID",t.T),Ar(e,"TYPE","xmlhttp"),Ni(t,e),t.o&&t.s&&_i(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Rr(Tr(e)),n.s=null,n.P=!0,hr(n,t)}function Mi(t){null!=t.v&&(re.clearTimeout(t.v),t.v=null)}function Ui(t,e){var n=null;if(t.g==e){Mi(t),xi(t),t.g=null;var r=2}else{if(!Qr(t.h,e))return;n=e.D,Jr(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var i=t.C;mn(r=Hn(),new Gn(r,n)),Ai(t)}else Oi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(Wr(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=Wn(he(t.Ja,t,e),zi(t,t.C)),t.C++,0)))}(t,e)||2==r&&Di(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:Fi(t,5);break;case 4:Fi(t,10);break;case 3:Fi(t,6);break;default:Fi(t,2)}}function zi(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function Fi(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=he(t.kb,t);n||(n=new Er("//www.google.com/images/cleardot.gif"),re.location&&"http"==re.location.protocol||Ir(n,"https"),Rr(n)),function(t,e){var n=new zn;if(re.Image){var r=new Image;r.onload=de(ni,n,r,"TestLoadImage: loaded",!0,e),r.onerror=de(ni,n,r,"TestLoadImage: error",!1,e),r.onabort=de(ni,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=de(ni,n,r,"TestLoadImage: timeout",!1,e),re.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else Kn(2);t.G=0,t.l&&t.l.va(e),Bi(t),Ci(t)}function Bi(t){if(t.G=0,t.la=[],t.l){var e=Xr(t.h);0==e.length&&0==t.i.length||(ye(t.la,e),ye(t.la,t.i),t.h.i.length=0,me(t.i),t.i.length=0),t.l.ua()}}function Vi(t,e,n){var r=n instanceof Er?Tr(n):new Er(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),kr(r,r.m);else{var i=re.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Er(null,void 0);r&&Ir(s,r),e&&(s.g=e),i&&kr(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&Ar(r,n,e),Ar(r,"VER",t.ma),Ni(t,r),r}function Hi(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new ui(new ri({jb:!0})):new ui(t.ra)).Ka(t.H),e}function ji(){}function qi(){if(Re&&!(10<=Number(He)))throw Error("Environmental error: no available transport.")}function $i(t,e){gn.call(this),this.g=new Ti(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!be(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!be(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new Wi(this)}function Ki(t){nr.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function Gi(){rr.call(this),this.status=1}function Wi(t){this.g=t}(te=ui.prototype).Ka=function(t){this.L=t},te.da=function(t,e,n,r){var i,s,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():tr.g(),this.C=this.u?Xn(this.u):Xn(tr),this.g.onreadystatechange=he(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void pi(this,h)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var l=Xt(r.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,r.get(h))}}catch(t){i={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=re.FormData&&t instanceof re.FormData,!(0<=ge(fi,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Xt(n),f=d.next();!f.done;f=d.next()){var p=Zt(f.value,2),g=(h=p[0],p[1]);this.g.setRequestHeader(h,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{vi(this),0<this.B&&((this.K=function(t){return Re&&Be()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=he(this.qa,this)):this.A=Ln(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){pi(this,h)}},te.qa=function(){void 0!==ne&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,mn(this,"timeout"),this.abort(8))},te.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,mn(this,"complete"),mn(this,"abort"),yi(this))},te.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),yi(this,!0)),ui.X.M.call(this)},te.Ha=function(){this.s||(this.F||this.v||this.l?mi(this):this.fb())},te.fb=function(){mi(this)},te.aa=function(){try{return 2<wi(this)?this.g.status:-1}catch(t){return-1}},te.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},te.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),li(e)}},te.Ea=function(){return this.m},te.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(te=Ti.prototype).ma=8,te.G=1,te.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new sr(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Xe(n=Ye(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,i=0;i<this.i.length;i++){var s=this.i[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.i.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Li(this,e,r),Ar(i=Tr(this.F),"RID",t),Ar(i,"CVER",22),this.D&&Ar(i,"X-HTTP-Session-Id",this.D),Ni(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Si(n)))+"&"+r:this.o&&_i(i,this.o,n)),Yr(this.h,e),this.Ya&&Ar(i,"TYPE","init"),this.O?(Ar(i,"$req",r),Ar(i,"SID","null"),e.Z=!0,ur(e,i,null)):ur(e,i,r),this.G=2}}else 3==this.G&&(t?Ri(this,t):0==this.i.length||Gr(this.h)||Ri(this))},te.Ia=function(){if(this.u=null,Pi(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=Wn(he(this.eb,this),t)}},te.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,Kn(10),ki(this),Pi(this))},te.cb=function(){null!=this.v&&(this.v=null,ki(this),Di(this),Kn(19))},te.kb=function(t){t?(this.j.info("Successfully pinged google.com"),Kn(2)):(this.j.info("Failed to ping google.com"),Kn(1))},(te=ji.prototype).xa=function(){},te.wa=function(){},te.va=function(){},te.ua=function(){},te.Ra=function(){},qi.prototype.g=function(t,e){return new $i(t,e)},fe($i,gn),$i.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;Kn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=Vi(t,null,t.V),Ai(t)},$i.prototype.close=function(){Ii(this.g)},$i.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=vn(t),t=n);e.i.push(new qr(e.ab++,t)),3==e.G&&Ai(e)},$i.prototype.M=function(){this.g.l=null,delete this.j,Ii(this.g),delete this.g,$i.X.M.call(this)},fe(Ki,nr),fe(Gi,rr),fe(Wi,ji),Wi.prototype.xa=function(){mn(this.g,"a")},Wi.prototype.wa=function(t){mn(this.g,new Ki(t))},Wi.prototype.va=function(t){mn(this.g,new Gi)},Wi.prototype.ua=function(){mn(this.g,"b")},qi.prototype.createWebChannel=qi.prototype.g,$i.prototype.send=$i.prototype.u,$i.prototype.open=$i.prototype.m,$i.prototype.close=$i.prototype.close,Qn.NO_ERROR=0,Qn.TIMEOUT=8,Qn.HTTP_ERROR=6,Yn.COMPLETE="complete",Zn.EventType=er,er.OPEN="a",er.CLOSE="b",er.ERROR="c",er.MESSAGE="d",gn.prototype.listen=gn.prototype.N,ui.prototype.listenOnce=ui.prototype.O,ui.prototype.getLastError=ui.prototype.Oa,ui.prototype.getLastErrorCode=ui.prototype.Ea,ui.prototype.getStatus=ui.prototype.aa,ui.prototype.getResponseJson=ui.prototype.Sa,ui.prototype.getResponseText=ui.prototype.fa,ui.prototype.send=ui.prototype.da,ui.prototype.setWithCredentials=ui.prototype.Ka;var Qi=Qn,Yi=Yn,Ji=Bn,Xi=10,Zi=11,ts=ri,es=Zn,ns=ui;const rs="@firebase/firestore";
|
|
319
319
|
/**
|
|
320
320
|
* @license
|
|
321
321
|
* Copyright 2017 Google LLC
|
|
@@ -540,7 +540,7 @@ let ss="9.15.0";
|
|
|
540
540
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
541
541
|
* See the License for the specific language governing permissions and
|
|
542
542
|
* limitations under the License.
|
|
543
|
-
*/class Ms{constructor(t){this.path=t}static fromPath(t){return new Ms(Ds.fromString(t))}static fromName(t){return new Ms(Ds.fromString(t).popFirst(5))}static empty(){return new Ms(Ds.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Ds.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Ds.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new Ms(new Ds(t.slice()))}}function Us(t){return new
|
|
543
|
+
*/class Ms{constructor(t){this.path=t}static fromPath(t){return new Ms(Ds.fromString(t))}static fromName(t){return new Ms(Ds.fromString(t).popFirst(5))}static empty(){return new Ms(Ds.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Ds.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Ds.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new Ms(new Ds(t.slice()))}}function Us(t){return new zs(t.readTime,t.key,-1)}class zs{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new zs(Ls.min(),Ms.empty(),-1)}static max(){return new zs(Ls.max(),Ms.empty(),-1)}}function Fs(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=Ms.comparator(t.documentKey,e.documentKey),0!==n?n:As(t.largestBatchId,e.largestBatchId)
|
|
544
544
|
/**
|
|
545
545
|
* @license
|
|
546
546
|
* Copyright 2020 Google LLC
|
|
@@ -750,7 +750,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
750
750
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
751
751
|
* See the License for the specific language governing permissions and
|
|
752
752
|
* limitations under the License.
|
|
753
|
-
*/class ko{}class Co extends ko{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new xo(t,e,n):"array-contains"===e?new
|
|
753
|
+
*/class ko{}class Co extends ko{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new xo(t,e,n):"array-contains"===e?new zo(t,n):"in"===e?new Fo(t,n):"not-in"===e?new Bo(t,n):"array-contains-any"===e?new Vo(t,n):new Co(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new Po(t,n):new Mo(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(ho(e,this.value)):null!==e&&co(this.value)===co(e)&&this.matchesComparison(ho(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return ds()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Ao extends ko{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Ao(t,e)}matches(t){return Ro(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Ro(t){return"and"===t.op}function No(t){return function(t){for(const e of t.filters)if(e instanceof Ao)return!1;return!0}(t)&&Ro(t)}function Lo(t){if(t instanceof Co)return t.field.canonicalString()+t.op.toString()+po(t.value);{const e=t.filters.map((t=>Lo(t))).join(",");return`${t.op}(${e})`}}function Oo(t,e){return t instanceof Co?function(t,e){return e instanceof Co&&t.op===e.op&&t.field.isEqual(e.field)&&lo(t.value,e.value)}(t,e):t instanceof Ao?function(t,e){return e instanceof Ao&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Oo(n,e.filters[r])),!0)}(t,e):void ds()}function Do(t){return t instanceof Co?function(t){return`${t.field.canonicalString()} ${t.op} ${po(t.value)}`}(t):t instanceof Ao?function(t){return t.op.toString()+" {"+t.getFilters().map(Do).join(" ,")+"}"}(t):"Filter"}class xo extends Co{constructor(t,e,n){super(t,e,n),this.key=Ms.fromName(n.referenceValue)}matches(t){const e=Ms.comparator(t.key,this.key);return this.matchesComparison(e)}}class Po extends Co{constructor(t,e){super(t,"in",e),this.keys=Uo("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class Mo extends Co{constructor(t,e){super(t,"not-in",e),this.keys=Uo("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function Uo(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>Ms.fromName(t.referenceValue)))}class zo extends Co{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return vo(e)&&uo(e.arrayValue,this.value)}}class Fo extends Co{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&uo(this.value.arrayValue,e)}}class Bo extends Co{constructor(t,e){super(t,"not-in",e)}matches(t){if(uo(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!uo(this.value.arrayValue,e)}}class Vo extends Co{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!vo(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>uo(this.value.arrayValue,t)))}}
|
|
754
754
|
/**
|
|
755
755
|
* @license
|
|
756
756
|
* Copyright 2022 Google LLC
|
|
@@ -911,7 +911,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
911
911
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
912
912
|
* See the License for the specific language governing permissions and
|
|
913
913
|
* limitations under the License.
|
|
914
|
-
*/class _a{constructor(){this._=void 0}}function Ea(t,e,n){return t instanceof Ia?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof ka?Ca(t,e):t instanceof Aa?Ra(t,e):function(t,e){const n=function(t,e){return t instanceof Na?yo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}(t,e),r=La(n)+La(t.gt);return yo(n)&&yo(t.gt)?ba(r):wa(t.yt,r)}(t,e)}function Ta(t,e,n){return t instanceof ka?Ca(t,e):t instanceof Aa?Ra(t,e):n}class Ia extends _a{}class ka extends _a{constructor(t){super(),this.elements=t}}function Ca(t,e){const n=Oa(e);for(const e of t.elements)n.some((t=>lo(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Aa extends _a{constructor(t){super(),this.elements=t}}function Ra(t,e){let n=Oa(e);for(const e of t.elements)n=n.filter((t=>!lo(t,e)));return{arrayValue:{values:n}}}class Na extends _a{constructor(t,e){super(),this.yt=t,this.gt=e}}function La(t){return no(t.integerValue||t.doubleValue)}function Oa(t){return vo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class Da{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Da}static exists(t){return new Da(void 0,t)}static updateTime(t){return new Da(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function xa(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class Pa{}function Ma(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new $a(t.key,Da.none()):new Ba(t.key,t.data,Da.none());{const n=t.data,r=Yo.empty();let i=new Go(Ps.comparator);for(let t of e.fields)if(!i.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),i=i.add(t)}return new Va(t.key,r,new Qo(i.toArray()),Da.none())}}function Ua(t,e,n){t instanceof Ba?function(t,e,n){const r=t.value.clone(),i=ja(t.fieldTransforms,e,n.transformResults);r.setAll(i),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof Va?function(t,e,n){if(!xa(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=ja(t.fieldTransforms,e,n.transformResults),i=e.data;i.setAll(Ha(t)),i.setAll(r),e.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function
|
|
914
|
+
*/class _a{constructor(){this._=void 0}}function Ea(t,e,n){return t instanceof Ia?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof ka?Ca(t,e):t instanceof Aa?Ra(t,e):function(t,e){const n=function(t,e){return t instanceof Na?yo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}(t,e),r=La(n)+La(t.gt);return yo(n)&&yo(t.gt)?ba(r):wa(t.yt,r)}(t,e)}function Ta(t,e,n){return t instanceof ka?Ca(t,e):t instanceof Aa?Ra(t,e):n}class Ia extends _a{}class ka extends _a{constructor(t){super(),this.elements=t}}function Ca(t,e){const n=Oa(e);for(const e of t.elements)n.some((t=>lo(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Aa extends _a{constructor(t){super(),this.elements=t}}function Ra(t,e){let n=Oa(e);for(const e of t.elements)n=n.filter((t=>!lo(t,e)));return{arrayValue:{values:n}}}class Na extends _a{constructor(t,e){super(),this.yt=t,this.gt=e}}function La(t){return no(t.integerValue||t.doubleValue)}function Oa(t){return vo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class Da{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Da}static exists(t){return new Da(void 0,t)}static updateTime(t){return new Da(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function xa(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class Pa{}function Ma(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new $a(t.key,Da.none()):new Ba(t.key,t.data,Da.none());{const n=t.data,r=Yo.empty();let i=new Go(Ps.comparator);for(let t of e.fields)if(!i.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),i=i.add(t)}return new Va(t.key,r,new Qo(i.toArray()),Da.none())}}function Ua(t,e,n){t instanceof Ba?function(t,e,n){const r=t.value.clone(),i=ja(t.fieldTransforms,e,n.transformResults);r.setAll(i),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof Va?function(t,e,n){if(!xa(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=ja(t.fieldTransforms,e,n.transformResults),i=e.data;i.setAll(Ha(t)),i.setAll(r),e.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function za(t,e,n,r){return t instanceof Ba?function(t,e,n,r){if(!xa(t.precondition,e))return n;const i=t.value.clone(),s=qa(t.fieldTransforms,r,e);return i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null}(t,e,n,r):t instanceof Va?function(t,e,n,r){if(!xa(t.precondition,e))return n;const i=qa(t.fieldTransforms,r,e),s=e.data;return s.setAll(Ha(t)),s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return xa(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function Fa(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&Rs(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof ka&&e instanceof ka||t instanceof Aa&&e instanceof Aa?Rs(t.elements,e.elements,lo):t instanceof Na&&e instanceof Na?lo(t.gt,e.gt):t instanceof Ia&&e instanceof Ia}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class Ba extends Pa{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class Va extends Pa{constructor(t,e,n,r,i=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function Ha(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function ja(t,e,n){const r=new Map;fs(t.length===n.length);for(let i=0;i<n.length;i++){const s=t[i],o=s.transform,a=e.data.field(s.field);r.set(s.field,Ta(o,a,n[i]))}return r}function qa(t,e,n){const r=new Map;for(const i of t){const t=i.transform,s=n.data.field(i.field);r.set(i.field,Ea(t,s,e))}return r}class $a extends Pa{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}
|
|
915
915
|
/**
|
|
916
916
|
* @license
|
|
917
917
|
* Copyright 2017 Google LLC
|
|
@@ -1024,7 +1024,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1024
1024
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1025
1025
|
* See the License for the specific language governing permissions and
|
|
1026
1026
|
* limitations under the License.
|
|
1027
|
-
*/const vc={asc:"ASCENDING",desc:"DESCENDING"},wc={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},bc={and:"AND",or:"OR"};class Sc{constructor(t,e){this.databaseId=t,this.wt=e}}function _c(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Ec(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Tc(t){return fs(!!t),Ls.fromTimestamp(function(t){const e=eo(t);return new Ns(e.seconds,e.nanos)}(t))}function Ic(t,e){return function(t){return new Ds(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function kc(t){const e=Ds.fromString(t);return fs(Vc(e)),e}function Cc(t,e){const n=kc(e);if(n.get(1)!==t.databaseId.projectId)throw new ms(gs.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new ms(gs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Ms(Nc(n))}function Ac(t,e){return Ic(t.databaseId,e)}function Rc(t){return new Ds(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Nc(t){return fs(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function Lc(t,e){return{documents:[Ac(t,e.path)]}}function Oc(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Ac(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Ac(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const i=function(t){if(0!==t.length)return Bc(Ao.create(t,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const s=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:
|
|
1027
|
+
*/const vc={asc:"ASCENDING",desc:"DESCENDING"},wc={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},bc={and:"AND",or:"OR"};class Sc{constructor(t,e){this.databaseId=t,this.wt=e}}function _c(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Ec(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Tc(t){return fs(!!t),Ls.fromTimestamp(function(t){const e=eo(t);return new Ns(e.seconds,e.nanos)}(t))}function Ic(t,e){return function(t){return new Ds(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function kc(t){const e=Ds.fromString(t);return fs(Vc(e)),e}function Cc(t,e){const n=kc(e);if(n.get(1)!==t.databaseId.projectId)throw new ms(gs.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new ms(gs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Ms(Nc(n))}function Ac(t,e){return Ic(t.databaseId,e)}function Rc(t){return new Ds(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Nc(t){return fs(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function Lc(t,e){return{documents:[Ac(t,e.path)]}}function Oc(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Ac(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Ac(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const i=function(t){if(0!==t.length)return Bc(Ao.create(t,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const s=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:zc(t.field),direction:Pc(t.dir)}}(t)))}(e.orderBy);s&&(n.structuredQuery.orderBy=s);const o=function(t,e){return t.wt||Js(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function Dc(t){let e=function(t){const e=kc(t);return 4===e.length?Ds.emptyPath():Nc(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){fs(1===r);const t=n.from[0];t.allDescendants?i=t.collectionId:e=e.child(t.collectionId)}let s=[];n.where&&(s=function(t){const e=xc(t);return e instanceof Ao&&No(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new Ho(Fc(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,Js(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new Eo(n,e)}(n.startAt));let l=null;return n.endAt&&(l=function(t){const e=!t.before,n=t.values||[];return new Eo(n,e)}(n.endAt)),function(t,e,n,r,i,s,o,a){return new ra(t,e,n,r,i,s,o,a)}(e,i,o,s,a,"F",c,l)}function xc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=Fc(t.unaryFilter.field);return Co.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=Fc(t.unaryFilter.field);return Co.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=Fc(t.unaryFilter.field);return Co.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=Fc(t.unaryFilter.field);return Co.create(i,"!=",{nullValue:"NULL_VALUE"});default:return ds()}}(t):void 0!==t.fieldFilter?function(t){return Co.create(Fc(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return ds()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Ao.create(t.compositeFilter.filters.map((t=>xc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return ds()}}(t.compositeFilter.op))}(t):ds()}function Pc(t){return vc[t]}function Mc(t){return wc[t]}function Uc(t){return bc[t]}function zc(t){return{fieldPath:t.canonicalString()}}function Fc(t){return Ps.fromServerFormat(t.fieldPath)}function Bc(t){return t instanceof Co?function(t){if("=="===t.op){if(bo(t.value))return{unaryFilter:{field:zc(t.field),op:"IS_NAN"}};if(wo(t.value))return{unaryFilter:{field:zc(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(bo(t.value))return{unaryFilter:{field:zc(t.field),op:"IS_NOT_NAN"}};if(wo(t.value))return{unaryFilter:{field:zc(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:zc(t.field),op:Mc(t.op),value:t.value}}}(t):t instanceof Ao?function(t){const e=t.getFilters().map((t=>Bc(t)));return 1===e.length?e[0]:{compositeFilter:{op:Uc(t.op),filters:e}}}(t):ds()}function Vc(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
|
|
1028
1028
|
/**
|
|
1029
1029
|
* @license
|
|
1030
1030
|
* Copyright 2017 Google LLC
|
|
@@ -1040,7 +1040,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1040
1040
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1041
1041
|
* See the License for the specific language governing permissions and
|
|
1042
1042
|
* limitations under the License.
|
|
1043
|
-
*/class Hc{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&Ua(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=
|
|
1043
|
+
*/class Hc{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&Ua(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=za(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=za(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=rc();return this.mutations.forEach((r=>{const i=t.get(r.key),s=i.overlayedDocument;let o=this.applyToLocalView(s,i.mutatedFields);o=e.has(r.key)?null:o;const a=Ma(s,o);null!==a&&n.set(r.key,a),s.isValidDocument()||s.convertToNoDocument(Ls.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),oc())}isEqual(t){return this.batchId===t.batchId&&Rs(this.mutations,t.mutations,((t,e)=>Fa(t,e)))&&Rs(this.baseMutations,t.baseMutations,((t,e)=>Fa(t,e)))}}
|
|
1044
1044
|
/**
|
|
1045
1045
|
* @license
|
|
1046
1046
|
* Copyright 2022 Google LLC
|
|
@@ -1104,7 +1104,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1104
1104
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1105
1105
|
* See the License for the specific language governing permissions and
|
|
1106
1106
|
* limitations under the License.
|
|
1107
|
-
*/class Gc{constructor(){this.Je=new Wc}addToCollectionParentIndex(t,e){return this.Je.add(e),js.resolve()}getCollectionParents(t,e){return js.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return js.resolve()}deleteFieldIndex(t,e){return js.resolve()}getDocumentsMatchingTarget(t,e){return js.resolve(null)}getIndexType(t,e){return js.resolve(0)}getFieldIndexes(t,e){return js.resolve([])}getNextCollectionGroupToUpdate(t){return js.resolve(null)}getMinOffset(t,e){return js.resolve(
|
|
1107
|
+
*/class Gc{constructor(){this.Je=new Wc}addToCollectionParentIndex(t,e){return this.Je.add(e),js.resolve()}getCollectionParents(t,e){return js.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return js.resolve()}deleteFieldIndex(t,e){return js.resolve()}getDocumentsMatchingTarget(t,e){return js.resolve(null)}getIndexType(t,e){return js.resolve(0)}getFieldIndexes(t,e){return js.resolve([])}getNextCollectionGroupToUpdate(t){return js.resolve(null)}getMinOffset(t,e){return js.resolve(zs.min())}getMinOffsetFromCollectionGroup(t,e){return js.resolve(zs.min())}updateCollectionGroup(t,e,n){return js.resolve()}updateIndexEntries(t,e){return js.resolve()}}class Wc{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new Go(Ds.comparator),i=!r.has(n);return this.index[e]=r.add(n),i}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new Go(Ds.comparator)).toArray()}}
|
|
1108
1108
|
/**
|
|
1109
1109
|
* @license
|
|
1110
1110
|
* Copyright 2017 Google LLC
|
|
@@ -1184,7 +1184,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1184
1184
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1185
1185
|
* See the License for the specific language governing permissions and
|
|
1186
1186
|
* limitations under the License.
|
|
1187
|
-
*/class Xc{constructor(t,e,n,r){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=r}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((r=>(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&
|
|
1187
|
+
*/class Xc{constructor(t,e,n,r){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=r}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((r=>(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&za(n.mutation,t,Qo.empty(),Ns.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,oc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=oc()){const r=nc();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=tc();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=nc();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,oc())))}populateOverlays(t,e,n){const r=[];return n.forEach((t=>{e.has(t)||r.push(t)})),this.documentOverlayCache.getOverlays(t,r).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,r){let i=Xa();const s=ic(),o=ic();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof Va)?i=i.insert(e.key,e):void 0!==o&&(s.set(e.key,o.mutation.getFieldMask()),za(o.mutation,e,o.mutation.getFieldMask(),Ns.now()))})),this.recalculateAndSaveOverlays(t,i).next((t=>(t.forEach(((t,e)=>s.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Jc(e,null!==(n=s.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=ic();let r=new qo(((t,e)=>t-e)),i=oc();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const i of t)i.keys().forEach((t=>{const s=e.get(t);if(null===s)return;let o=n.get(t)||Qo.empty();o=i.applyToLocalView(s,o),n.set(t,o);const a=(r.get(i.batchId)||oc()).add(t);r=r.insert(i.batchId,a)}))})).next((()=>{const s=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,l=rc();c.forEach((t=>{if(!i.has(t)){const r=Ma(e.get(t),n.get(t));null!==r&&l.set(t,r),i=i.add(t)}})),s.push(this.documentOverlayCache.saveOverlays(t,a,l))}return js.waitFor(s)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.recalculateAndSaveOverlays(t,e)))}getDocumentsMatchingQuery(t,e,n){return function(t){return Ms.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):ca(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,r).next((i=>{const s=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,r-i.size):js.resolve(nc());let o=-1,a=i;return s.next((e=>js.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(e)?js.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,i))).next((()=>this.computeViews(t,a,e,oc()))).next((t=>({batchId:o,changes:ec(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new Ms(e)).next((t=>{let e=tc();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let i=tc();return this.indexManager.getCollectionParents(t,r).next((s=>js.forEach(s,(s=>{const o=function(t,e){return new ra(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,s.child(r));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{i=i.insert(t,e)}))}))})).next((()=>i))))}getDocumentsMatchingCollectionQuery(t,e,n){let r;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((i=>(r=i,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===r.get(n)&&(r=r.insert(n,Jo.newInvalidDocument(n)))}));let n=tc();return r.forEach(((r,i)=>{const s=t.get(r);void 0!==s&&za(s.mutation,i,Qo.empty(),Ns.now()),ma(e,i)&&(n=n.insert(r,i))})),n}))}}
|
|
1188
1188
|
/**
|
|
1189
1189
|
* @license
|
|
1190
1190
|
* Copyright 2020 Google LLC
|
|
@@ -1264,7 +1264,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1264
1264
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1265
1265
|
* See the License for the specific language governing permissions and
|
|
1266
1266
|
* limitations under the License.
|
|
1267
|
-
*/class il{constructor(t){this.Es=t,this.docs=new qo(Ms.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),i=r?r.size:0,s=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:s}),this.size+=s-i,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return js.resolve(n?n.document.mutableCopy():Jo.newInvalidDocument(e))}getEntries(t,e){let n=Xa();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():Jo.newInvalidDocument(t))})),js.resolve(n)}getAllFromCollection(t,e,n){let r=Xa();const i=new Ms(e.child("")),s=this.docs.getIteratorFrom(i);for(;s.hasNext();){const{key:t,value:{document:i}}=s.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||
|
|
1267
|
+
*/class il{constructor(t){this.Es=t,this.docs=new qo(Ms.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),i=r?r.size:0,s=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:s}),this.size+=s-i,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return js.resolve(n?n.document.mutableCopy():Jo.newInvalidDocument(e))}getEntries(t,e){let n=Xa();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():Jo.newInvalidDocument(t))})),js.resolve(n)}getAllFromCollection(t,e,n){let r=Xa();const i=new Ms(e.child("")),s=this.docs.getIteratorFrom(i);for(;s.hasNext();){const{key:t,value:{document:i}}=s.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||Fs(Us(i),n)<=0||(r=r.insert(i.key,i.mutableCopy()))}return js.resolve(r)}getAllFromCollectionGroup(t,e,n,r){ds()}As(t,e){return js.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new sl(this)}getSize(t){return js.resolve(this.size)}}class sl extends Yc{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?e.push(this.Yn.addEntry(t,r)):this.Yn.removeEntry(n)})),js.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
|
|
1268
1268
|
/**
|
|
1269
1269
|
* @license
|
|
1270
1270
|
* Copyright 2017 Google LLC
|
|
@@ -1328,7 +1328,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1328
1328
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1329
1329
|
* See the License for the specific language governing permissions and
|
|
1330
1330
|
* limitations under the License.
|
|
1331
|
-
*/class hl{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((i=>i||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(sa(e))return js.resolve(null);let n=ua(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=da(e,null,"F"),n=ua(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const i=oc(...r);return this.Ni.getDocuments(t,i).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const s=this.Fi(e,r);return this.$i(e,s,i,n.readTime)?this.ki(t,da(e,null,"F")):this.Bi(t,s,e,n)}))))})))))}Oi(t,e,n,r){return sa(e)||r.isEqual(Ls.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((i=>{const s=this.Fi(e,i);return this.$i(e,s,n,r)?this.Mi(t,e):(as()<=R.DEBUG&&cs("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),ga(e)),this.Bi(t,s,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=Ls.fromTimestamp(1e9===r?new Ns(n+1,0):new Ns(n,r));return new
|
|
1331
|
+
*/class hl{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((i=>i||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(sa(e))return js.resolve(null);let n=ua(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=da(e,null,"F"),n=ua(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const i=oc(...r);return this.Ni.getDocuments(t,i).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const s=this.Fi(e,r);return this.$i(e,s,i,n.readTime)?this.ki(t,da(e,null,"F")):this.Bi(t,s,e,n)}))))})))))}Oi(t,e,n,r){return sa(e)||r.isEqual(Ls.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((i=>{const s=this.Fi(e,i);return this.$i(e,s,n,r)?this.Mi(t,e):(as()<=R.DEBUG&&cs("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),ga(e)),this.Bi(t,s,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=Ls.fromTimestamp(1e9===r?new Ns(n+1,0):new Ns(n,r));return new zs(i,Ms.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new Go(ya(t));return e.forEach(((e,r)=>{ma(t,r)&&(n=n.add(r))})),n}$i(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const i="F"===t.limitType?e.last():e.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}Mi(t,e){return as()<=R.DEBUG&&cs("QueryEngine","Using full collection scan to execute query:",ga(e)),this.Ni.getDocumentsMatchingQuery(t,e,zs.min())}Bi(t,e,n,r){return this.Ni.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
|
|
1332
1332
|
/**
|
|
1333
1333
|
* @license
|
|
1334
1334
|
* Copyright 2020 Google LLC
|
|
@@ -1488,7 +1488,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1488
1488
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1489
1489
|
* See the License for the specific language governing permissions and
|
|
1490
1490
|
* limitations under the License.
|
|
1491
|
-
*/class Ol{constructor(t,e,n,r,i){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=i,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{Vl(this)&&(cs("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=ps(t);e._u.add(4),await xl(e),e.gu.set("Unknown"),e._u.delete(4),await Dl(e)}(this))}))})),this.gu=new Ll(n,r)}}async function Dl(t){if(Vl(t))for(const e of t.wu)await e(!0)}async function xl(t){for(const e of t.wu)await e(!1)}function Pl(t,e){const n=ps(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),Bl(n)?
|
|
1491
|
+
*/class Ol{constructor(t,e,n,r,i){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=i,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{Vl(this)&&(cs("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=ps(t);e._u.add(4),await xl(e),e.gu.set("Unknown"),e._u.delete(4),await Dl(e)}(this))}))})),this.gu=new Ll(n,r)}}async function Dl(t){if(Vl(t))for(const e of t.wu)await e(!0)}async function xl(t){for(const e of t.wu)await e(!1)}function Pl(t,e){const n=ps(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),Bl(n)?Fl(n):Wl(n).ko()&&Ul(n,e))}function Ml(t,e){const n=ps(t),r=Wl(n);n.du.delete(e),r.ko()&&zl(n,e),0===n.du.size&&(r.ko()?r.Fo():Vl(n)&&n.gu.set("Unknown"))}function Ul(t,e){t.yu.Ot(e.targetId),Wl(t).zo(e)}function zl(t,e){t.yu.Ot(e),Wl(t).Ho(e)}function Fl(t){t.yu=new gc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),Wl(t).start(),t.gu.uu()}function Bl(t){return Vl(t)&&!Wl(t).No()&&t.du.size>0}function Vl(t){return 0===ps(t)._u.size}function Hl(t){t.yu=void 0}async function jl(t){t.du.forEach(((e,n)=>{Ul(t,e)}))}async function ql(t,e){Hl(t),Bl(t)?(t.gu.hu(e),Fl(t)):t.gu.set("Unknown")}async function $l(t,e,n){if(t.gu.set("Online"),e instanceof fc&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.du.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.du.delete(r),t.yu.removeTarget(r))}(t,e)}catch(n){cs("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Kl(t,n)}else if(e instanceof hc?t.yu.Kt(e):e instanceof dc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Ls.min()))try{const e=await pl(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const i=t.du.get(r);i&&t.du.set(r,i.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(Zs.EMPTY_BYTE_STRING,n.snapshotVersion)),zl(t,e);const r=new qc(n.target,e,1,n.sequenceNumber);Ul(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){cs("RemoteStore","Failed to raise snapshot:",e),await Kl(t,e)}}async function Kl(t,e,n){if(!qs(e))throw e;t._u.add(1),await xl(t),t.gu.set("Offline"),n||(n=()=>pl(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{cs("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await Dl(t)}))}async function Gl(t,e){const n=ps(t);n.asyncQueue.verifyOperationInProgress(),cs("RemoteStore","RemoteStore received new credentials");const r=Vl(n);n._u.add(3),await xl(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await Dl(n)}function Wl(t){return t.pu||(t.pu=function(t,e,n){const r=ps(t);return r.su(),new Rl(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
|
|
1492
1492
|
/**
|
|
1493
1493
|
* @license
|
|
1494
1494
|
* Copyright 2018 Google LLC
|
|
@@ -1504,7 +1504,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1504
1504
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1505
1505
|
* See the License for the specific language governing permissions and
|
|
1506
1506
|
* limitations under the License.
|
|
1507
|
-
*/}(t.datastore,t.asyncQueue,{Yr:jl.bind(null,t),Zr:ql.bind(null,t),Wo:$l.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),Bl(t)?
|
|
1507
|
+
*/}(t.datastore,t.asyncQueue,{Yr:jl.bind(null,t),Zr:ql.bind(null,t),Wo:$l.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),Bl(t)?Fl(t):t.gu.set("Unknown")):(await t.pu.stop(),Hl(t))}))),t.pu
|
|
1508
1508
|
/**
|
|
1509
1509
|
* @license
|
|
1510
1510
|
* Copyright 2017 Google LLC
|
|
@@ -1680,7 +1680,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1680
1680
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1681
1681
|
* See the License for the specific language governing permissions and
|
|
1682
1682
|
* limitations under the License.
|
|
1683
|
-
*/class
|
|
1683
|
+
*/class zu{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Bu(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new zu(this.firestore,t,this._key)}}class Fu{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Fu(this.firestore,t,this._query)}}class Bu extends Fu{constructor(t,e,n){super(t,e,ia(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new zu(this.firestore,null,new Ms(t))}withConverter(t){return new Bu(this.firestore,t,this._path)}}function Vu(t,e,...n){if(t=T(t),Ru("collection","path",e),t instanceof Mu){const r=Ds.fromString(e,...n);return Lu(r),new Bu(t,null,r)}{if(!(t instanceof zu||t instanceof Bu))throw new ms(gs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ds.fromString(e,...n));return Lu(r),new Bu(t.firestore,null,r)}}function Hu(t,e,...n){if(t=T(t),1===arguments.length&&(e=Cs.R()),Ru("doc","path",e),t instanceof Mu){const r=Ds.fromString(e,...n);return Nu(r),new zu(t,null,new Ms(r))}{if(!(t instanceof zu||t instanceof Bu))throw new ms(gs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ds.fromString(e,...n));return Nu(r),new zu(t.firestore,t instanceof Bu?t.converter:null,new Ms(r))}}
|
|
1684
1684
|
/**
|
|
1685
1685
|
* @license
|
|
1686
1686
|
* Copyright 2020 Google LLC
|
|
@@ -1873,7 +1873,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1873
1873
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1874
1874
|
* See the License for the specific language governing permissions and
|
|
1875
1875
|
* limitations under the License.
|
|
1876
|
-
*/const rh=/^__.*__$/;function ih(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ds()}}class sh{constructor(t,e,n,r,i,s){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===i&&this.na(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new sh(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),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return uh(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(ih(this.sa)&&rh.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class oh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||kl(t)}da(t,e,n,r=!1){return new sh({sa:t,methodName:e,fa:n,path:Ps.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function ah(t,e){if(ch(t=T(t)))return function(t,e,n){if(!ch(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Ou(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}("Unsupported field value:",e,t),function(t,e){const n={};return Ys(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Qs(t,((t,r)=>{const i=ah(r,e.ra(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}(t,e);if(t instanceof eh)return function(t,e){if(!ih(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 r=0;for(const i of t){let t=ah(i,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=T(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Sa(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Ns.fromDate(t);return{timestampValue:_c(e.yt,n)}}if(t instanceof Ns){const n=new Ns(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:_c(e.yt,n)}}if(t instanceof nh)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Zu)return{bytesValue:Ec(e.yt,t._byteString)};if(t instanceof
|
|
1876
|
+
*/const rh=/^__.*__$/;function ih(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ds()}}class sh{constructor(t,e,n,r,i,s){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===i&&this.na(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new sh(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),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return uh(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(ih(this.sa)&&rh.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class oh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||kl(t)}da(t,e,n,r=!1){return new sh({sa:t,methodName:e,fa:n,path:Ps.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function ah(t,e){if(ch(t=T(t)))return function(t,e,n){if(!ch(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Ou(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}("Unsupported field value:",e,t),function(t,e){const n={};return Ys(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Qs(t,((t,r)=>{const i=ah(r,e.ra(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}(t,e);if(t instanceof eh)return function(t,e){if(!ih(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 r=0;for(const i of t){let t=ah(i,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=T(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Sa(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Ns.fromDate(t);return{timestampValue:_c(e.yt,n)}}if(t instanceof Ns){const n=new Ns(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:_c(e.yt,n)}}if(t instanceof nh)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Zu)return{bytesValue:Ec(e.yt,t._byteString)};if(t instanceof zu){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Ic(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Ou(t)}`)}(t,e)}function ch(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ns||t instanceof nh||t instanceof Zu||t instanceof zu||t instanceof eh)}const lh=new RegExp("[~\\*/\\[\\]]");function uh(t,e,n,r,i){const s=r&&!r.isEmpty(),o=void 0!==i;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=")"),new ms(gs.INVALID_ARGUMENT,a+t+c)
|
|
1877
1877
|
/**
|
|
1878
1878
|
* @license
|
|
1879
1879
|
* Copyright 2020 Google LLC
|
|
@@ -1889,7 +1889,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1889
1889
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1890
1890
|
* See the License for the specific language governing permissions and
|
|
1891
1891
|
* limitations under the License.
|
|
1892
|
-
*/}class hh{constructor(t,e,n,r,i){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new
|
|
1892
|
+
*/}class hh{constructor(t,e,n,r,i){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new zu(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new dh(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(fh("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class dh extends hh{data(){return super.data()}}function fh(t,e){return"string"==typeof e?function(t,e,n){if(e.search(lh)>=0)throw uh(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new th(...e.split("."))._internalPath}catch(r){throw uh(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}(t,e):e instanceof th?e._internalPath:e._delegate._internalPath}
|
|
1893
1893
|
/**
|
|
1894
1894
|
* @license
|
|
1895
1895
|
* Copyright 2020 Google LLC
|
|
@@ -1921,7 +1921,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1921
1921
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1922
1922
|
* See the License for the specific language governing permissions and
|
|
1923
1923
|
* limitations under the License.
|
|
1924
|
-
*/(r);for(const e of r)t=e._apply(t);return t}class vh extends mh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new vh(t,e,n)}_apply(t){const e=this._parse(t);return Eh(t._query,e),new
|
|
1924
|
+
*/(r);for(const e of r)t=e._apply(t);return t}class vh extends mh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new vh(t,e,n)}_apply(t){const e=this._parse(t);return Eh(t._query,e),new Fu(t.firestore,t.converter,ha(t._query,e))}_parse(t){const e=function(t){const e=t._freezeSettings(),n=kl(t._databaseId);return new oh(t._databaseId,!!e.ignoreUndefinedProperties,n)}(t.firestore),n=function(t,e,n,r,i,s,o){let a;if(i.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new ms(gs.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){_h(o,s);const e=[];for(const n of o)e.push(Sh(r,t,n));a={arrayValue:{values:e}}}else a=Sh(r,t,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||_h(o,s),a=function(t,e,n,r=!1){return ah(n,t.da(r?4:3,e))}(n,"where",o,"in"===s||"not-in"===s);return Co.create(i,s,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function wh(t,e,n){const r=e,i=fh("where",t);return vh._create(i,r,n)}class bh extends gh{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new bh(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]:Ao.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)Eh(n,t),n=ha(n,t)}(t._query,e),new Fu(t.firestore,t.converter,ha(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Sh(t,e,n){if("string"==typeof(n=T(n))){if(""===n)throw new ms(gs.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ca(e)&&-1!==n.indexOf("/"))throw new ms(gs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Ds.fromString(n));if(!Ms.isDocumentKey(r))throw new ms(gs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return mo(t,new Ms(r))}if(n instanceof zu)return mo(t,n._key);throw new ms(gs.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ou(n)}.`)}function _h(t,e){if(!Array.isArray(t)||0===t.length)throw new ms(gs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new ms(gs.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Eh(t,e){if(e.isInequality()){const n=aa(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new ms(gs.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 '${r.toString()}'`);const i=oa(t);null!==i&&function(t,e,n){if(!n.isEqual(e))throw new ms(gs.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,r,i)}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(gs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new ms(gs.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Th{convertValue(t,e="none"){switch(co(t)){case 0:return null;case 1:return t.booleanValue;case 2:return no(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(ro(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 ds()}}convertObject(t,e){const n={};return Qs(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new nh(no(t.latitude),no(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=so(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(oo(t));default:return null}}convertTimestamp(t){const e=eo(t);return new Ns(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Ds.fromString(t);fs(Vc(n));const r=new Gs(n.get(1),n.get(3)),i=new Ms(n.popFirst(5));return r.isEqual(e)||ls(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),i}}
|
|
1925
1925
|
/**
|
|
1926
1926
|
* @license
|
|
1927
1927
|
* Copyright 2020 Google LLC
|
|
@@ -1953,7 +1953,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1953
1953
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1954
1954
|
* See the License for the specific language governing permissions and
|
|
1955
1955
|
* limitations under the License.
|
|
1956
|
-
*/function Nh(t){t=Du(t,
|
|
1956
|
+
*/function Nh(t){t=Du(t,zu);const e=Du(t.firestore,Qu);return function(t,e,n={}){const r=new ys;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new ju({next:s=>{e.enqueueAndForget((()=>ru(t,o)));const a=s.docs.has(n);!a&&s.fromCache?i.reject(new ms(gs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&r&&"server"===r.source?i.reject(new ms(gs.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.)')):i.resolve(s)},error:t=>i.reject(t)}),o=new au(ia(n.path),s,{includeMetadataChanges:!0,Nu:!0});return nu(t,o)}(await Ku(t),t.asyncQueue,e,n,r))),r.promise}(Ju(e),t._key).then((n=>xh(e,t,n)))}class Lh extends Th{constructor(t){super(),this.firestore=t}convertBytes(t){return new Zu(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new zu(this.firestore,null,e)}}function Oh(t){t=Du(t,Fu);const e=Du(t.firestore,Qu),n=Ju(e),r=new Lh(e);return ph(t._query),function(t,e,n={}){const r=new ys;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new ju({next:n=>{e.enqueueAndForget((()=>ru(t,o))),n.fromCache&&"server"===r.source?i.reject(new ms(gs.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.)')):i.resolve(n)},error:t=>i.reject(t)}),o=new au(n,s,{includeMetadataChanges:!0,Nu:!0});return nu(t,o)}(await Ku(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Ah(e,r,t,n)))}function Dh(t,...e){var n,r,i;t=T(t);let s={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||Wu(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges};if(Wu(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(i=t.complete)||void 0===i?void 0:i.bind(t)}let c,l,u;if(t instanceof zu)l=Du(t.firestore,Qu),u=ia(t._key.path),c={next:n=>{e[o]&&e[o](xh(l,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Du(t,Fu);l=Du(n.firestore,Qu),u=n._query;const r=new Lh(l);c={next:t=>{e[o]&&e[o](new Ah(l,r,n,t))},error:e[o+1],complete:e[o+2]},ph(t._query)}return function(t,e,n,r){const i=new ju(r),s=new au(e,i,n);return t.asyncQueue.enqueueAndForget((async()=>nu(await Ku(t),s))),()=>{i.bc(),t.asyncQueue.enqueueAndForget((async()=>ru(await Ku(t),s)))}}(Ju(l),u,a,c)}function xh(t,e,n){const r=n.docs.get(e._key),i=new Lh(t);return new kh(t,i,e._key,r,new Ih(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){ss=Pt,Lt(new I("firestore",((t,{instanceIdentifier:n,options:r})=>{const i=t.getProvider("app").getImmediate(),s=new Qu(new Ss(t.getProvider("auth-internal")),new Is(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new ms(gs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Gs(t.options.projectId,e)}(i,n),i);return r=Object.assign({useFetchStreams:e},r),s._setSettings(r),s}),"PUBLIC").setMultipleInstances(!0)),zt(rs,"3.8.0",t),zt(rs,"3.8.0","esm2017")}();
|
|
1957
1957
|
/**
|
|
1958
1958
|
* @license
|
|
1959
1959
|
* Copyright 2020 Google LLC
|
|
@@ -1970,7 +1970,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1970
1970
|
* See the License for the specific language governing permissions and
|
|
1971
1971
|
* limitations under the License.
|
|
1972
1972
|
*/
|
|
1973
|
-
|
|
1973
|
+
zt("firebase","9.15.0","app");class Ph{constructor(){}static getInstance(){return Ph.instance||(Ph.instance=new Ph),Ph.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Uh.firebase:Mh.firebase}get api(){return"prod"===this.env?Uh.api:Mh.api}get config(){return"prod"===this.env?Uh.config:Mh.config}}const Mh={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")}},Uh={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")}};function zh(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function Fh(){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."}}const Bh=Fh,Vh=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."}),Hh="auth/user-disabled",jh=new x("@firebase/auth");function qh(t,...e){jh.logLevel<=R.ERROR&&jh.error(`Auth (${Pt}): ${t}`,...e)}
|
|
1974
1974
|
/**
|
|
1975
1975
|
* @license
|
|
1976
1976
|
* Copyright 2020 Google LLC
|
|
@@ -2230,7 +2230,7 @@ async function yd(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2230
2230
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2231
2231
|
* See the License for the specific language governing permissions and
|
|
2232
2232
|
* limitations under the License.
|
|
2233
|
-
*/async function bd(t){var e;const n=t.auth,r=await t.getIdToken(),i=await yd(t,async function(t,e){return cd(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:r}));Wh(null==i?void 0:i.users.length,n,"internal-error");const s=i.users[0];t._notifyReloadListener(s);const o=(null===(e=s.providerUserInfo)||void 0===e?void 0:e.length)?s.providerUserInfo.map((t=>{var{providerId:e}=t,n=
|
|
2233
|
+
*/async function bd(t){var e;const n=t.auth,r=await t.getIdToken(),i=await yd(t,async function(t,e){return cd(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:r}));Wh(null==i?void 0:i.users.length,n,"internal-error");const s=i.users[0];t._notifyReloadListener(s);const o=(null===(e=s.providerUserInfo)||void 0===e?void 0:e.length)?s.providerUserInfo.map((t=>{var{providerId:e}=t,n=zh(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const 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 wd(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,h)}
|
|
2234
2234
|
/**
|
|
2235
2235
|
* @license
|
|
2236
2236
|
* Copyright 2020 Google LLC
|
|
@@ -2279,7 +2279,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2279
2279
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2280
2280
|
* See the License for the specific language governing permissions and
|
|
2281
2281
|
* limitations under the License.
|
|
2282
|
-
*/function _d(t,e){Wh("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Ed{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,i=
|
|
2282
|
+
*/function _d(t,e){Wh("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Ed{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,i=zh(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new vd(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new wd(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(t){const e=await yd(this,this.stsTokenManager.getToken(this.auth,t));return Wh(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),r=await n.getIdToken(e),i=md(r);Wh(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s="object"==typeof i.firebase?i.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:pd(gd(i.auth_time)),issuedAtTime:pd(gd(i.iat)),expirationTime:pd(gd(i.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 bd(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Wh(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){return new Ed(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(t){Wh(!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 bd(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await yd(this,async function(t,e){return cd(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,r,i,s,o,a,c,l;const u=null!==(n=e.displayName)&&void 0!==n?n:void 0,h=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(i=e.phoneNumber)&&void 0!==i?i: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;Wh(v&&_,t,"internal-error");const E=Sd.fromJSON(this.name,_);Wh("string"==typeof v,t,"internal-error"),_d(u,t.name),_d(h,t.name),Wh("boolean"==typeof w,t,"internal-error"),Wh("boolean"==typeof b,t,"internal-error"),_d(d,t.name),_d(f,t.name),_d(p,t.name),_d(g,t.name),_d(m,t.name),_d(y,t.name);const T=new Ed({uid:v,auth:t,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,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 r=new Sd;r.updateFromServerResponse(e);const i=new Ed({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await bd(i),i}}
|
|
2283
2283
|
/**
|
|
2284
2284
|
* @license
|
|
2285
2285
|
* Copyright 2019 Google LLC
|
|
@@ -2327,7 +2327,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2327
2327
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2328
2328
|
* See the License for the specific language governing permissions and
|
|
2329
2329
|
* limitations under the License.
|
|
2330
|
-
*/function Ad(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Od(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Rd(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(xd(e))return"Blackberry";if(Pd(e))return"Webos";if(Nd(e))return"Safari";if((e.includes("chrome/")||Ld(e))&&!e.includes("edge/"))return"Chrome";if(Dd(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 Rd(t=a()){return/firefox\//i.test(t)}function Nd(t=a()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Ld(t=a()){return/crios\//i.test(t)}function Od(t=a()){return/iemobile/i.test(t)}function Dd(t=a()){return/android/i.test(t)}function xd(t=a()){return/blackberry/i.test(t)}function Pd(t=a()){return/webos/i.test(t)}function Md(t=a()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Ud(){return function(){const t=a();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function
|
|
2330
|
+
*/function Ad(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Od(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Rd(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(xd(e))return"Blackberry";if(Pd(e))return"Webos";if(Nd(e))return"Safari";if((e.includes("chrome/")||Ld(e))&&!e.includes("edge/"))return"Chrome";if(Dd(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 Rd(t=a()){return/firefox\//i.test(t)}function Nd(t=a()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Ld(t=a()){return/crios\//i.test(t)}function Od(t=a()){return/iemobile/i.test(t)}function Dd(t=a()){return/android/i.test(t)}function xd(t=a()){return/blackberry/i.test(t)}function Pd(t=a()){return/webos/i.test(t)}function Md(t=a()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Ud(){return function(){const t=a();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function zd(t=a()){return Md(t)||Dd(t)||Pd(t)||xd(t)||/windows phone/i.test(t)||Od(t)}
|
|
2331
2331
|
/**
|
|
2332
2332
|
* @license
|
|
2333
2333
|
* Copyright 2020 Google LLC
|
|
@@ -2344,7 +2344,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2344
2344
|
* See the License for the specific language governing permissions and
|
|
2345
2345
|
* limitations under the License.
|
|
2346
2346
|
*/
|
|
2347
|
-
function
|
|
2347
|
+
function Fd(t,e=[]){let n;switch(t){case"Browser":n=Ad(a());break;case"Worker":n=`${Ad(a())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Pt}/${r}`}
|
|
2348
2348
|
/**
|
|
2349
2349
|
* @license
|
|
2350
2350
|
* Copyright 2022 Google LLC
|
|
@@ -2376,7 +2376,7 @@ function zd(t,e=[]){let n;switch(t){case"Browser":n=Ad(a());break;case"Worker":n
|
|
|
2376
2376
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2377
2377
|
* See the License for the specific language governing permissions and
|
|
2378
2378
|
* limitations under the License.
|
|
2379
|
-
*/class Vd{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new jd(this),this.idTokenSubscription=new jd(this),this.beforeStateQueue=new Bd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Vh,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Xh(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await Cd.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===(r=this.currentUser)||void 0===r?void 0:r.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 initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null==o?void 0:o.user)||(r=o.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Wh(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}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 bd(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){const e=t?T(t):null;return e&&Wh(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&&Wh(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 await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Xh(t))}))}_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)}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&&Xh(t)||this._popupRedirectResolver;Wh(e,this,"argument-error"),this.redirectPersistenceManager=await Cd.create(this,[Xh(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,r){if(this._deleted)return()=>{};const i="function"==typeof e?e:e.next.bind(e),s=this._isInitialized?Promise.resolve():this._initializationPromise;return Wh(s,this,"internal-error"),s.then((()=>i(this.currentUser))),"function"==typeof e?t.addObserver(e,n,r):t.addObserver(e)}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 Wh(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=
|
|
2379
|
+
*/class Vd{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new jd(this),this.idTokenSubscription=new jd(this),this.beforeStateQueue=new Bd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Vh,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Xh(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await Cd.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===(r=this.currentUser)||void 0===r?void 0:r.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 initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null==o?void 0:o.user)||(r=o.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Wh(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}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 bd(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){const e=t?T(t):null;return e&&Wh(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&&Wh(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 await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Xh(t))}))}_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)}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&&Xh(t)||this._popupRedirectResolver;Wh(e,this,"argument-error"),this.redirectPersistenceManager=await Cd.create(this,[Xh(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,r){if(this._deleted)return()=>{};const i="function"==typeof e?e:e.next.bind(e),s=this._isInitialized?Promise.resolve():this._initializationPromise;return Wh(s,this,"internal-error"),s.then((()=>i(this.currentUser))),"function"==typeof e?t.addObserver(e,n,r):t.addObserver(e)}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 Wh(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Fd(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());return n&&(e["X-Firebase-Client"]=n),e}}function Hd(t){return T(t)}class jd{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new _(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Wh(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function qd(t,e,n){const r=Hd(t);Wh(r._canInitEmulator,r,"emulator-config-failed"),Wh(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!!(null==n?void 0:n.disableWarnings),s=$d(e),{host:o,port:a}=function(t){const e=$d(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const t=i[1];return{host:t,port:Kd(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:Kd(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${s}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||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())}
|
|
2380
2380
|
/**
|
|
2381
2381
|
* @license
|
|
2382
2382
|
* Copyright 2020 Google LLC
|
|
@@ -2490,7 +2490,7 @@ return async function(t,e){return ud(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2490
2490
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2491
2491
|
* See the License for the specific language governing permissions and
|
|
2492
2492
|
* limitations under the License.
|
|
2493
|
-
*/class Jd extends Gd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Jd(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):$h("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:r}=e,i=
|
|
2493
|
+
*/class Jd extends Gd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Jd(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):$h("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:r}=e,i=zh(e,["providerId","signInMethod"]);if(!n||!r)return null;const s=new Jd(n,r);return s.idToken=i.idToken||void 0,s.accessToken=i.accessToken||void 0,s.secret=i.secret,s.nonce=i.nonce,s.pendingToken=i.pendingToken||null,s}_getIdTokenResponse(t){return Yd(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Yd(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Yd(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}}
|
|
2494
2494
|
/**
|
|
2495
2495
|
* @license
|
|
2496
2496
|
* Copyright 2020 Google LLC
|
|
@@ -2738,7 +2738,7 @@ function(t,e,n){var r;Wh((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2738
2738
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2739
2739
|
* See the License for the specific language governing permissions and
|
|
2740
2740
|
* limitations under the License.
|
|
2741
|
-
*/class yf extends mf{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=a();return Nd(t)||Md(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=
|
|
2741
|
+
*/class yf extends mf{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=a();return Nd(t)||Md(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=zd(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(t.newValue!==r)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},i=this.storage.getItem(n);Ud()&&i!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}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]}}yf.type="LOCAL";const vf=yf;
|
|
2742
2742
|
/**
|
|
2743
2743
|
* @license
|
|
2744
2744
|
* Copyright 2020 Google LLC
|
|
@@ -2903,7 +2903,7 @@ const kf="firebaseLocalStorageDb",Cf="firebaseLocalStorage",Af="fbase_key";class
|
|
|
2903
2903
|
* See the License for the specific language governing permissions and
|
|
2904
2904
|
* limitations under the License.
|
|
2905
2905
|
*/
|
|
2906
|
-
class Uf extends Gd{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Yd(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Yd(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Yd(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
|
|
2906
|
+
class Uf extends Gd{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Yd(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Yd(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Yd(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 zf(t){return hf(t.auth,new Uf(t),t.bypassAuthState)}function Ff(t){const{auth:e,user:n}=t;return Wh(n,e,"internal-error"),
|
|
2907
2907
|
/**
|
|
2908
2908
|
* @license
|
|
2909
2909
|
* Copyright 2019 Google LLC
|
|
@@ -2936,7 +2936,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await yd
|
|
|
2936
2936
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2937
2937
|
* See the License for the specific language governing permissions and
|
|
2938
2938
|
* limitations under the License.
|
|
2939
|
-
*/class Vf{constructor(t,e,n,r,i=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=i,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:r,tenantId:i,error:s,type:o}=t;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:i||void 0,postBody:r||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
|
|
2939
|
+
*/class Vf{constructor(t,e,n,r,i=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=i,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:r,tenantId:i,error:s,type:o}=t;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:i||void 0,postBody:r||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 zf;case"linkViaPopup":case"linkViaRedirect":return Bf;case"reauthViaPopup":case"reauthViaRedirect":return Ff;default:$h(this.auth,"internal-error")}}resolve(t){Yh(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Yh(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()}}
|
|
2940
2940
|
/**
|
|
2941
2941
|
* @license
|
|
2942
2942
|
* Copyright 2020 Google LLC
|
|
@@ -3116,7 +3116,7 @@ const op=new nd(5e3,15e3),ap="__/auth/iframe",cp="emulator/auth/iframe",lp={styl
|
|
|
3116
3116
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3117
3117
|
* See the License for the specific language governing permissions and
|
|
3118
3118
|
* limitations under the License.
|
|
3119
|
-
*/(t)}?${w(a).slice(1)}`}const wp="webStorageSupport";const bp=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=bf,this._completeRedirectFn=Wf,this._overrideRedirectResult=Gf}async _openPopup(t,e,n,r){var i;Yh(null===(i=this.eventManagers[t._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return gp(t,vp(t,e,n,Zh(),r),_f())}async _openRedirect(t,e,n,r){var i;return await this._originValidation(t),i=vp(t,e,n,Zh(),r),Tf().location.href=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):(Yh(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 dp(t),n=new Qf(t);return e.register("authEvent",(e=>{Wh(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(wp,{type:wp},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[wp];void 0!==i&&e(!!i),$h(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=tp(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return
|
|
3119
|
+
*/(t)}?${w(a).slice(1)}`}const wp="webStorageSupport";const bp=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=bf,this._completeRedirectFn=Wf,this._overrideRedirectResult=Gf}async _openPopup(t,e,n,r){var i;Yh(null===(i=this.eventManagers[t._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return gp(t,vp(t,e,n,Zh(),r),_f())}async _openRedirect(t,e,n,r){var i;return await this._originValidation(t),i=vp(t,e,n,Zh(),r),Tf().location.href=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):(Yh(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 dp(t),n=new Qf(t);return e.register("authEvent",(e=>{Wh(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(wp,{type:wp},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[wp];void 0!==i&&e(!!i),$h(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=tp(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return zd()||Nd()||Md()}};var Sp="@firebase/auth",_p="0.21.0";
|
|
3120
3120
|
/**
|
|
3121
3121
|
* @license
|
|
3122
3122
|
* Copyright 2020 Google LLC
|
|
@@ -3166,4 +3166,4 @@ class Ep{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
|
|
|
3166
3166
|
* See the License for the specific language governing permissions and
|
|
3167
3167
|
* limitations under the License.
|
|
3168
3168
|
*/
|
|
3169
|
-
const Tp=d("authIdTokenMaxAge")||300;let Ip=null;function kp(t=Ut()){const e=Ot(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Ot(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;$h(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:bp,persistence:[Pf,vf,bf]}),r=d("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Tp)return;const r=null==e?void 0:e.token;Ip!==r&&(Ip=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=u("auth");return s&&qd(n,`http://${s}`),n}var Cp;Cp="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:i,authDomain:s}=n.options;return((t,n)=>{Wh(i&&!i.includes(":"),"invalid-api-key",{appName:t.name}),Wh(!(null==s?void 0:s.includes(":")),"argument-error",{appName:t.name});const r={apiKey:i,authDomain:s,clientPlatform:Cp,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:zd(Cp)},o=new Vd(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Xh);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new Ep(t))(Hd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Ft(Sp,_p,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Cp)),Ft(Sp,_p,"esm2017");class Ap extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Rp extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Np extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Lp{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=kp(e),this.auth.setPersistence(vf)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return(await Nh(Hu(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yh(Vu(this.firestore,"users"),wh(new th("__name__"),"==",this.id));return e=Dh(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await pf(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await df(this.auth,t)}async confirmPasswordReset(t,e){await ff(this.auth,t,e)}}class Op{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Dh(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Ph.getInstance().firebase);this.firestore=Yu(t),this.user=new Lp(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const r=yh(Vu(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Oh(yh(Vu(this.firestore,t),...e))}async getDoc(t,e){const n=Hu(this.firestore,t,e),r=await Nh(n);return r.exists()?r.data():null}}const Dp=t=>{if(t.code===Hh)throw new Error("account has been disabled");throw new Error(t.message)};class xp{static get endpoint(){return Ph.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"include"};r&&(o.body=JSON.stringify(r));const a=await fetch(s,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class Pp{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()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Rp;try{const r=await xp.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new Ap;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await xp.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 Np;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Np;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wh("brand_id","==",this.brandId)];r.push(wh("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Dp(t)}}async getColorwaySizeAssets(t,e){const n=[wh("brand_id","==",this.brandId)];t&&n.push(wh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wh("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 Dp(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Dp(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Dp(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("garment_measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Dp(t)}}}var Mp;!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"}(Mp||(Mp={}));const Up={[Mp.ACROSS_BACK]:"Across back",[Mp.ACROSS_FRONT]:"Across front",[Mp.ACROSS_SHOULDER]:"Across shoulder",[Mp.ANKLE]:"Ankle",[Mp.ARMEYE]:"Armeye",[Mp.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Mp.BACK_CROTCH_LENGTH]:"Back crotch length",[Mp.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Mp.BELOW_KNEE]:"Below knee",[Mp.BICEP]:"Bicep",[Mp.BUST]:"Chest/Bust",[Mp.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Mp.CALF]:"Calf",[Mp.CB_NECK_TO_WAIST]:"Cb neck to waist",[Mp.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Mp.CF_NECK_TO_WAIST]:"Cf neck to waist",[Mp.ELBOW]:"Elbow",[Mp.FOREARM]:"Forearm",[Mp.FRONT_CROTCH_LENGTH]:"Front crotch length",[Mp.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Mp.HIGH_HIP]:"High hip",[Mp.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Mp.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Mp.HSP_TO_BUST_POINT]:"Hsp to bust point",[Mp.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Mp.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Mp.INSEAM]:"Inseam",[Mp.KNEE]:"Knee",[Mp.LOW_HIP]:"Low hip",[Mp.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Mp.MID_NECK]:"Mid neck",[Mp.NECK_AT_BASE]:"Neck at base",[Mp.SHOULDER_DROP]:"Shoulder drop",[Mp.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Mp.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Mp.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Mp.THIGH]:"Thigh",[Mp.TOTAL_RISE_LENGTH]:"Total rise length",[Mp.UNDER_BUST]:"Under bust",[Mp.VERTICAL_TRUNK]:"Vertical trunk",[Mp.WAIST]:"Waist",[Mp.WRIST]:"Wrist"};var Fp;!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"}(Fp||(Fp={}));const zp={[Fp.BLOUSES]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[Fp.COATS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[Fp.DRESSES]:[Mp.LOW_HIP,Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST],[Fp.JACKETS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[Fp.PANTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[Fp.PUFFERS_AND_PARKAS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[Fp.SHORTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[Fp.SKIRTS]:[Mp.LOW_HIP,Mp.WAIST],[Fp.SWEATERS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[Fp.T_SHIRTS_AND_TANKS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP]},Bp={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"},Vp={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"},Hp={activewear:{leggings:Fp.PANTS,joggers:Fp.PANTS,sweatshirts:Fp.SWEATERS},dresses:{a_line:Fp.DRESSES,bodycon:Fp.DRESSES,fit_and_flare:Fp.DRESSES,knit:Fp.DRESSES,shirt:Fp.DRESSES,slip:Fp.DRESSES,straight:Fp.DRESSES,wrap:Fp.DRESSES},jackets_and_coats:{denim_jackets:Fp.JACKETS,parkas:Fp.PUFFERS_AND_PARKAS,peacoats:Fp.COATS,puffer_jackets:Fp.PUFFERS_AND_PARKAS,raincoats:Fp.COATS,rompers:Fp.COATS,shackets:Fp.JACKETS,trench_coats:Fp.COATS},jeans:{bootcut:Fp.PANTS,flared:Fp.PANTS,mom:Fp.PANTS,relaxed:Fp.PANTS,skinny:Fp.PANTS,slim:Fp.PANTS,straight:Fp.PANTS,tapered:Fp.PANTS,wide_leg:Fp.PANTS},jumpsuits_and_rompers:{boiler_suits:Fp.DRESSES,denim:Fp.DRESSES,jumpsuits:Fp.DRESSES,overalls:Fp.DRESSES,rompers:Fp.DRESSES,unitards:Fp.DRESSES},pants_and_shorts:{cigarette:Fp.PANTS,culottes:Fp.SHORTS,denim_shorts:Fp.SHORTS,flared:Fp.PANTS,joggers:Fp.PANTS,leggings:Fp.PANTS,skinny:Fp.PANTS,wide_leg:Fp.PANTS},skirts:{a_line_flared:Fp.SKIRTS,denim:Fp.SKIRTS,knit:Fp.SKIRTS,pencil:Fp.SKIRTS,pleated:Fp.SKIRTS,skater:Fp.SKIRTS,slip:Fp.SKIRTS,wrap:Fp.SKIRTS},suits_and_tailoring:{blazers:Fp.JACKETS,suit_jackets:Fp.JACKETS,suit_skirts:Fp.SKIRTS,suit_trousers:Fp.PANTS,suit_vests:Fp.SWEATERS,trousers:Fp.PANTS},sweaters:{cardigans:Fp.SWEATERS,crewnecks:Fp.SWEATERS,hoodies_and_zipups:Fp.SWEATERS,sweatshirts:Fp.SWEATERS,turtlenecks:Fp.SWEATERS,v_necks:Fp.SWEATERS},tops:{bodysuits:Fp.BLOUSES,corsets_and_bustiers:Fp.BLOUSES,polos:Fp.T_SHIRTS_AND_TANKS,shirts_and_blouses:Fp.BLOUSES,t_shirts:Fp.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Fp.T_SHIRTS_AND_TANKS}};var jp;!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"}(jp||(jp={}));const qp={[jp.TOO_TIGHT]:"Too Tight",[jp.TIGHT]:"Tight",[jp.SLIGHTLY_TIGHT]:"Slightly Tight",[jp.PERFECT_FIT]:"Perfect Fit",[jp.SLIGHTLY_LOOSE]:"Slightly Loose",[jp.LOOSE]:"Loose",[jp.OVERSIZED]:"Oversized",[jp.TOO_SHORT]:"Too Short",[jp.SHORT]:"Short",[jp.SLIGHTLY_SHORT]:"Slightly Short",[jp.SLIGHTLY_LONG]:"Slightly Long",[jp.LONG]:"Long",[jp.TOO_LONG]:"Too Long"};var $p;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}($p||($p={}));var Kp=Object.freeze({__proto__:null,get AvatarState(){return $p},get MeasurementLocation(){return Mp},MeasurementLocationName:Up,get Classification(){return Fp},ClassificationLocations:zp,CategoryNames:Bp,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Vp,Taxonomy:Hp,get Fit(){return jp},FitNames:qp}),Gp="Back to sign in",Wp="Click here to download the app",Qp="Don't have an account?",Yp="Whoops! Looks like you don't have an avatar yet.",Jp="Email address",Xp="Please enter a valid email address.",Zp="Enter your email address, we will send you a link to reset your password.",tg="Forgot password?",eg="Have an account? Sign in",ng="Your avatar is loading...",rg="Unfortunately, that size is not available for try on.",ig="or",sg="Password",og="Please enter a valid password (at least 7 characters).",ag="Return to Catalog Page",cg="Return to Product Page",lg="Return to site",ug="Please return to The Fitting Room app to create your avatar.",hg="Scan the QR code to download the app",dg="Send",fg="Sign back in",pg="Sign in",gg="Something went wrong. Try again!",mg="You have successfully logged out!",yg="The Fitting Room",vg="Username or password is empty.",wg="Username or password is incorrect.",bg="End size uncertainty with",Sg="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique for the perfect fit every time.";var _g=[],Eg=[];function Tg(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=_g.indexOf(s);-1===o&&(o=_g.push(s)-1,Eg[o]={}),n=Eg[o]&&Eg[o][r]?Eg[o][r]:Eg[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}Tg(".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)}",{});Tg(".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: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;margin:auto;max-height:100vh;max-width:709px;overflow:auto;width:100%}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:390px;max-width:390px}.tfr-logo-box{aspect-ratio:1;margin:auto;max-height:430px;max-width:430px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:50%}.tfr-space-above{margin-top:10px}",{});Tg("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}",{});Tg(".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)}}",{});Tg("@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}}@media screen and (max-width:599px){.tfr-mobile-hidden{display:none}.tfr-modal-content-container{min-height:100vh}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{height:calc(100vh - 76px)}}@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}}",{});Tg("#tfr-size-recommendations{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;font-family:var(--tfr-main-font);padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations,#tfr-size-recommendations-container{align-items:center;flex-direction:column;justify-content:center}#tfr-size-recommendations-container{display:none;width:100%}#tfr-size-rec-login-svg{display:none}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;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);height:40px;justify-content:center}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{margin-right:70px;text-align:right}.tfr-size-rec-table-cell-right{margin-left:16px}.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}#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;margin-top:14px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}",{});Tg(".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}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});Tg(".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}",{});Tg(".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}",{});Tg(":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 Ig=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${ng} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),kg=t=>{const e=document.getElementById(t);if(!e)throw new Error(`element with id ${t} not found`);let n;const r=()=>{n&&(n.Unhook(),a()),e.style.display="none"},i=t=>{"Escape"===t.key&&r()},s=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),r())},o=()=>{e.querySelector("#tfr-close-container").addEventListener("click",r),document.addEventListener("keydown",i),document.addEventListener("click",s)},a=()=>{var n;const o=e.querySelector("#tfr-close-container");o?o.removeEventListener("click",r):(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",i),document.removeEventListener("click",s)};return{open:t=>{var r;n&&n.Unhook(),e.innerHTML=(r=t.Body(),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content tfr-pt-20 tfr-pb-50">\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">${bg}</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">${yg}</div>\n </div>\n </div>\n ${r}\n </div>\n </div>\n </div>\n </div>\n `),o(),t.Hook(),e.style.display="block",n=t},close:r,Content:()=>n}},Cg=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")};return{Hook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.addEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.addEventListener("click",i)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${Sg}</div>\n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls autoplay loop>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n </div>\n\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${e?Wp:hg}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n ${(()=>{const t="https://assets.dev.thefittingroom.xyz/images/";return e?`\n <img src="${t}apple.png" id="tfr-app-store" />\n <img src="${t}google.png" id="tfr-google-play" />\n `:`<img src="${t}qr.png" class="tfr-qr-code" />`})()}\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">${eg}</div>\n `}};class Ag{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=kg(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${mg}</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">${fg}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${lg}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Yp}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${ug}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(Ig({timeoutMS:1e4}))}toScan(){this.manager.open(Cg({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${pg}</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">${Jp}</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">${sg}</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">${tg}</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">${Qp}</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 ${pg}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Zp}</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">${Jp}</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">${Gp}</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 ${dg}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</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">${cg}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||gg}</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">${ag}</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">${cg}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${rg} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${ig} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${cg}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const Rg="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class Ng{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block"):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="")}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=` ${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],r=n.sort((({location:t},{location:e})=>t<e?-1:1)).map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${Rg}" /> Signup or login to view</div>`}renderGarmentLocations(t){const e=t.sort().map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}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 <img id="tfr-size-rec-login-svg" src="${Rg}" />\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${Rg}" /> Signup or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select"></div>\n\n <div id="tfr-size-rec-subtitle">How it fits</div>\n\n <div id="tfr-size-rec-table"></div>\n\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">Sign out of the Fitting Room</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class Lg{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Kp.Fit.PERFECT_FIT,Kp.Fit.SLIGHTLY_LOOSE,Kp.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new Ng(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Kp.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:Kp.MeasurementLocationName[t.measurement_location]})))})))}: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 Og;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Og||(Og={}));class Dg{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");this.tfrModal=new Ag(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"),Ph.getInstance().setEnv(e),new Pp(t,new Op)))(Number(this.shopId),o),this.tfrSizeRec=new Lg(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(vg);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Xp);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(og);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(wg)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(gg)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case Og.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Yp),this.tfrModal.onNotCreated();break;case Og.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Og.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(gg),this.tfrModal.onError(gg)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.garment_measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const xg=async(t,e,n,r={},i={},s="dev")=>{const o=new Dg(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,xg as initFittingRoom};
|
|
3169
|
+
const Tp=d("authIdTokenMaxAge")||300;let Ip=null;function kp(t=Ut()){const e=Ot(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Ot(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;$h(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:bp,persistence:[Pf,vf,bf]}),r=d("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Tp)return;const r=null==e?void 0:e.token;Ip!==r&&(Ip=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=u("auth");return s&&qd(n,`http://${s}`),n}var Cp;Cp="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:i,authDomain:s}=n.options;return((t,n)=>{Wh(i&&!i.includes(":"),"invalid-api-key",{appName:t.name}),Wh(!(null==s?void 0:s.includes(":")),"argument-error",{appName:t.name});const r={apiKey:i,authDomain:s,clientPlatform:Cp,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Fd(Cp)},o=new Vd(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Xh);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new Ep(t))(Hd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),zt(Sp,_p,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Cp)),zt(Sp,_p,"esm2017");class Ap extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Rp extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Np extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Lp{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=kp(e),this.auth.setPersistence(vf)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return(await Nh(Hu(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yh(Vu(this.firestore,"users"),wh(new th("__name__"),"==",this.id));return e=Dh(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await pf(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await df(this.auth,t)}async confirmPasswordReset(t,e){await ff(this.auth,t,e)}}class Op{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Dh(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Ph.getInstance().firebase);this.firestore=Yu(t),this.user=new Lp(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const r=yh(Vu(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Oh(yh(Vu(this.firestore,t),...e))}async getDoc(t,e){const n=Hu(this.firestore,t,e),r=await Nh(n);return r.exists()?r.data():null}}const Dp=t=>{if(t.code===Hh)throw new Error("account has been disabled");throw new Error(t.message)};class xp{static get endpoint(){return Ph.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"include"};r&&(o.body=JSON.stringify(r));const a=await fetch(s,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class Pp{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()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Rp;try{const r=await xp.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new Ap;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await xp.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 Np;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Np;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wh("brand_id","==",this.brandId)];r.push(wh("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Dp(t)}}async getColorwaySizeAssets(t,e){const n=[wh("brand_id","==",this.brandId)];t&&n.push(wh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wh("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 Dp(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Dp(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Dp(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("garment_measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Dp(t)}}}var Mp;!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"}(Mp||(Mp={}));const Up={[Mp.ACROSS_BACK]:"Across back",[Mp.ACROSS_FRONT]:"Across front",[Mp.ACROSS_SHOULDER]:"Across shoulder",[Mp.ANKLE]:"Ankle",[Mp.ARMEYE]:"Armeye",[Mp.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Mp.BACK_CROTCH_LENGTH]:"Back crotch length",[Mp.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Mp.BELOW_KNEE]:"Below knee",[Mp.BICEP]:"Bicep",[Mp.BUST]:"Chest/Bust",[Mp.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Mp.CALF]:"Calf",[Mp.CB_NECK_TO_WAIST]:"Cb neck to waist",[Mp.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Mp.CF_NECK_TO_WAIST]:"Cf neck to waist",[Mp.ELBOW]:"Elbow",[Mp.FOREARM]:"Forearm",[Mp.FRONT_CROTCH_LENGTH]:"Front crotch length",[Mp.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Mp.HIGH_HIP]:"High hip",[Mp.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Mp.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Mp.HSP_TO_BUST_POINT]:"Hsp to bust point",[Mp.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Mp.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Mp.INSEAM]:"Inseam",[Mp.KNEE]:"Knee",[Mp.LOW_HIP]:"Low hip",[Mp.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Mp.MID_NECK]:"Mid neck",[Mp.NECK_AT_BASE]:"Neck at base",[Mp.SHOULDER_DROP]:"Shoulder drop",[Mp.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Mp.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Mp.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Mp.THIGH]:"Thigh",[Mp.TOTAL_RISE_LENGTH]:"Total rise length",[Mp.UNDER_BUST]:"Under bust",[Mp.VERTICAL_TRUNK]:"Vertical trunk",[Mp.WAIST]:"Waist",[Mp.WRIST]:"Wrist"};var zp;!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"}(zp||(zp={}));const Fp={[zp.BLOUSES]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.COATS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.DRESSES]:[Mp.LOW_HIP,Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST],[zp.JACKETS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.PANTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[zp.PUFFERS_AND_PARKAS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.SHORTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[zp.SKIRTS]:[Mp.LOW_HIP,Mp.WAIST],[zp.SWEATERS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.T_SHIRTS_AND_TANKS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP]},Bp={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"},Vp={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"},Hp={activewear:{leggings:zp.PANTS,joggers:zp.PANTS,sweatshirts:zp.SWEATERS},dresses:{a_line:zp.DRESSES,bodycon:zp.DRESSES,fit_and_flare:zp.DRESSES,knit:zp.DRESSES,shirt:zp.DRESSES,slip:zp.DRESSES,straight:zp.DRESSES,wrap:zp.DRESSES},jackets_and_coats:{denim_jackets:zp.JACKETS,parkas:zp.PUFFERS_AND_PARKAS,peacoats:zp.COATS,puffer_jackets:zp.PUFFERS_AND_PARKAS,raincoats:zp.COATS,rompers:zp.COATS,shackets:zp.JACKETS,trench_coats:zp.COATS},jeans:{bootcut:zp.PANTS,flared:zp.PANTS,mom:zp.PANTS,relaxed:zp.PANTS,skinny:zp.PANTS,slim:zp.PANTS,straight:zp.PANTS,tapered:zp.PANTS,wide_leg:zp.PANTS},jumpsuits_and_rompers:{boiler_suits:zp.DRESSES,denim:zp.DRESSES,jumpsuits:zp.DRESSES,overalls:zp.DRESSES,rompers:zp.DRESSES,unitards:zp.DRESSES},pants_and_shorts:{cigarette:zp.PANTS,culottes:zp.SHORTS,denim_shorts:zp.SHORTS,flared:zp.PANTS,joggers:zp.PANTS,leggings:zp.PANTS,skinny:zp.PANTS,wide_leg:zp.PANTS},skirts:{a_line_flared:zp.SKIRTS,denim:zp.SKIRTS,knit:zp.SKIRTS,pencil:zp.SKIRTS,pleated:zp.SKIRTS,skater:zp.SKIRTS,slip:zp.SKIRTS,wrap:zp.SKIRTS},suits_and_tailoring:{blazers:zp.JACKETS,suit_jackets:zp.JACKETS,suit_skirts:zp.SKIRTS,suit_trousers:zp.PANTS,suit_vests:zp.SWEATERS,trousers:zp.PANTS},sweaters:{cardigans:zp.SWEATERS,crewnecks:zp.SWEATERS,hoodies_and_zipups:zp.SWEATERS,sweatshirts:zp.SWEATERS,turtlenecks:zp.SWEATERS,v_necks:zp.SWEATERS},tops:{bodysuits:zp.BLOUSES,corsets_and_bustiers:zp.BLOUSES,polos:zp.T_SHIRTS_AND_TANKS,shirts_and_blouses:zp.BLOUSES,t_shirts:zp.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:zp.T_SHIRTS_AND_TANKS}};var jp;!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"}(jp||(jp={}));const qp={[jp.TOO_TIGHT]:"Too Tight",[jp.TIGHT]:"Tight",[jp.SLIGHTLY_TIGHT]:"Slightly Tight",[jp.PERFECT_FIT]:"Perfect Fit",[jp.SLIGHTLY_LOOSE]:"Slightly Loose",[jp.LOOSE]:"Loose",[jp.OVERSIZED]:"Oversized",[jp.TOO_SHORT]:"Too Short",[jp.SHORT]:"Short",[jp.SLIGHTLY_SHORT]:"Slightly Short",[jp.SLIGHTLY_LONG]:"Slightly Long",[jp.LONG]:"Long",[jp.TOO_LONG]:"Too Long"};var $p;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}($p||($p={}));var Kp=Object.freeze({__proto__:null,get AvatarState(){return $p},get MeasurementLocation(){return Mp},MeasurementLocationName:Up,get Classification(){return zp},ClassificationLocations:Fp,CategoryNames:Bp,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Vp,Taxonomy:Hp,get Fit(){return jp},FitNames:qp}),Gp="Back to sign in",Wp="Click here to download the app",Qp="Don't have an account?",Yp="Whoops! Looks like you don't have an avatar yet.",Jp="Email address",Xp="Please enter a valid email address.",Zp="Enter your email address, we will send you a link to reset your password.",tg="Forgot password?",eg="Have an account? Sign in",ng="Your avatar is loading...",rg="Unfortunately, that size is not available for try on.",ig="or",sg="Password",og="Please enter a valid password (at least 7 characters).",ag="Return to Catalog Page",cg="Return to Product Page",lg="Return to site",ug="Please return to The Fitting Room app to create your avatar.",hg="Scan the QR code to download the app",dg="Send",fg="Sign back in",pg="Sign in",gg="Something went wrong. Try again!",mg="You have successfully logged out!",yg="The Fitting Room",vg="Username or password is empty.",wg="Username or password is incorrect.",bg="End size uncertainty with",Sg="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique for the perfect fit every time.";var _g=[],Eg=[];function Tg(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=_g.indexOf(s);-1===o&&(o=_g.push(s)-1,Eg[o]={}),n=Eg[o]&&Eg[o][r]?Eg[o][r]:Eg[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}Tg(".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)}",{});Tg(".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: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;margin:auto;max-height:100vh;max-width:709px;overflow:auto;width:100%}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:390px;max-width:390px}.tfr-logo-box{aspect-ratio:1;margin:auto;max-height:430px;max-width:430px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:50%}.tfr-space-above{margin-top:10px}",{});Tg("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}",{});Tg(".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)}}",{});Tg("@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}}@media screen and (max-width:599px){.tfr-mobile-hidden{display:none}.tfr-modal-content-container{min-height:100vh}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{height:calc(100vh - 76px)}}@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}}",{});Tg("#tfr-size-recommendations{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;font-family:var(--tfr-main-font);padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations,#tfr-size-recommendations-container{align-items:center;flex-direction:column;justify-content:center}#tfr-size-recommendations-container{display:none;position:relative;width:100%}#tfr-size-rec-select-container{display:none}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;width:370px}.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);height:40px;justify-content:center}.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;margin-right:70px;text-align:right}.tfr-size-rec-table-cell-right{flex-grow:2;margin-left:16px}.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}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}",{});Tg(".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}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});Tg(".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}",{});Tg(".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}",{});Tg(":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 Ig=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${ng} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),kg=t=>{const e=document.getElementById(t);if(!e)throw new Error(`element with id ${t} not found`);let n;const r=()=>{n&&(n.Unhook(),a()),e.style.display="none"},i=t=>{"Escape"===t.key&&r()},s=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),r())},o=()=>{e.querySelector("#tfr-close-container").addEventListener("click",r),document.addEventListener("keydown",i),document.addEventListener("click",s)},a=()=>{var n;const o=e.querySelector("#tfr-close-container");o?o.removeEventListener("click",r):(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",i),document.removeEventListener("click",s)};return{open:t=>{var r;n&&n.Unhook(),e.innerHTML=(r=t.Body(),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content tfr-pt-20 tfr-pb-50">\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">${bg}</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">${yg}</div>\n </div>\n </div>\n ${r}\n </div>\n </div>\n </div>\n </div>\n `),o(),t.Hook(),e.style.display="block",n=t},close:r,Content:()=>n}},Cg=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")};return{Hook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.addEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.addEventListener("click",i)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${Sg}</div>\n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls autoplay loop>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n </div>\n\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${e?Wp:hg}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n ${(()=>{const t="https://assets.dev.thefittingroom.xyz/images/";return e?`\n <img src="${t}apple.png" id="tfr-app-store" />\n <img src="${t}google.png" id="tfr-google-play" />\n `:`<img src="${t}qr.png" class="tfr-qr-code" />`})()}\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">${eg}</div>\n `}};class Ag{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=kg(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${mg}</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">${fg}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${lg}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Yp}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${ug}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(Ig({timeoutMS:1e4}))}toScan(){this.manager.open(Cg({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${pg}</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">${Jp}</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">${sg}</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">${tg}</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">${Qp}</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 ${pg}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Zp}</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">${Jp}</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">${Gp}</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 ${dg}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</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">${cg}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||gg}</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">${ag}</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">${cg}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${rg} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${ig} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${cg}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const Rg="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class Ng{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!0,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block"):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="")}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=` ${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],r=n.sort((({location:t},{location:e})=>t<e?-1:1)).map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${Rg}" /> Signup or login to view</div>`}renderGarmentLocations(t){const e=t.sort().map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="block"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${Rg}" /> Signup or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></div>\n </div>\n \n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Sign out of the Fitting Room</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class Lg{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Kp.Fit.PERFECT_FIT,Kp.Fit.SLIGHTLY_LOOSE,Kp.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new Ng(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Kp.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:Kp.MeasurementLocationName[t.measurement_location]})))})))}: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 Og;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Og||(Og={}));class Dg{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");this.tfrModal=new Ag(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"),Ph.getInstance().setEnv(e),new Pp(t,new Op)))(Number(this.shopId),o),this.tfrSizeRec=new Lg(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(vg);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Xp);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(og);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(wg)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(gg)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case Og.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Yp),this.tfrModal.onNotCreated();break;case Og.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Og.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(gg),this.tfrModal.onError(gg)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.garment_measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const xg=async(t,e,n,r={},i={},s="dev")=>{const o=new Dg(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,xg as initFittingRoom};
|