@thefittingroom/shop-ui 1.4.3 → 1.4.4
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/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +50 -50
- package/package.json +1 -1
package/dist/esm/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v1.4.
|
|
2
|
+
* thefittingroom v1.4.4 (2024-07-24T23:25:08.588Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var i=new Image;i.onload=r,i.onerror=r,i.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const r=document.getElementById(t);if(!r)throw new Error(`Slider with id ${t} not found`);return{Load(t){if(!Array.isArray(t)||!t.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");e(t);const i=(null==t?void 0:t.length)-2;r.value=i.toString(),r.max=(t.length-1).toString();const s=()=>{const e=parseInt(r.value);n(r,t[e])};return n(r,t[i]),r.removeEventListener("input",s),r.addEventListener("input",s),()=>{r.removeEventListener("input",s)}}}},r=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(r(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],o=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==o||null==a||null==c)throw new s;const l=i<<2|o>>4;if(r.push(l),64!==a){const t=o<<4&240|a>>2;if(r.push(t),64!==c){const t=a<<6&192|c;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};
|
|
@@ -121,7 +121,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
121
121
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
122
122
|
* See the License for the specific language governing permissions and
|
|
123
123
|
* limitations under the License.
|
|
124
|
-
*/function w(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function
|
|
124
|
+
*/function w(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function S(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class _{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=E),void 0===r.error&&(r.error=E),void 0===r.complete&&(r.complete=E);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(t){}})),this.observers.push(r),i}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function E(){}
|
|
125
125
|
/**
|
|
126
126
|
* @license
|
|
127
127
|
* Copyright 2021 Google LLC
|
|
@@ -218,7 +218,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
218
218
|
* See the License for the specific language governing permissions and
|
|
219
219
|
* limitations under the License.
|
|
220
220
|
*/
|
|
221
|
-
class X{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Z="@firebase/app",tt="0.9.13",et=new x("@firebase/app"),nt="@firebase/app-compat",rt="@firebase/analytics-compat",it="@firebase/analytics",st="@firebase/app-check-compat",ot="@firebase/app-check",at="@firebase/auth",ct="@firebase/auth-compat",lt="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",dt="@firebase/functions-compat",ft="@firebase/installations",pt="@firebase/installations-compat",gt="@firebase/messaging",mt="@firebase/messaging-compat",yt="@firebase/performance",vt="@firebase/performance-compat",wt="@firebase/remote-config",bt="@firebase/remote-config-compat",
|
|
221
|
+
class X{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Z="@firebase/app",tt="0.9.13",et=new x("@firebase/app"),nt="@firebase/app-compat",rt="@firebase/analytics-compat",it="@firebase/analytics",st="@firebase/app-check-compat",ot="@firebase/app-check",at="@firebase/auth",ct="@firebase/auth-compat",lt="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",dt="@firebase/functions-compat",ft="@firebase/installations",pt="@firebase/installations-compat",gt="@firebase/messaging",mt="@firebase/messaging-compat",yt="@firebase/performance",vt="@firebase/performance-compat",wt="@firebase/remote-config",bt="@firebase/remote-config-compat",St="@firebase/storage",_t="@firebase/storage-compat",Et="@firebase/firestore",Tt="@firebase/firestore-compat",It="firebase",kt="[DEFAULT]",Ct={[Z]:"fire-core",[nt]:"fire-core-compat",[it]:"fire-analytics",[rt]:"fire-analytics-compat",[ot]:"fire-app-check",[st]:"fire-app-check-compat",[at]:"fire-auth",[ct]:"fire-auth-compat",[lt]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[dt]:"fire-fn-compat",[ft]:"fire-iid",[pt]:"fire-iid-compat",[gt]:"fire-fcm",[mt]:"fire-fcm-compat",[yt]:"fire-perf",[vt]:"fire-perf-compat",[wt]:"fire-rc",[bt]:"fire-rc-compat",[St]:"fire-gcs",[_t]:"fire-gcs-compat",[Et]:"fire-fst",[Tt]:"fire-fst-compat","fire-js":"fire-js",[It]:"fire-js-all"},At=new Map,Rt=new Map;function Nt(t,e){try{t.container.addComponent(e)}catch(n){et.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Lt(t){const e=t.name;if(Rt.has(e))return et.debug(`There were multiple attempts to register component ${e}.`),!1;Rt.set(e,t);for(const e of At.values())Nt(e,t);return!0}function Dt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
|
|
222
222
|
/**
|
|
223
223
|
* @license
|
|
224
224
|
* Copyright 2019 Google LLC
|
|
@@ -397,7 +397,7 @@ const te=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
397
397
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
398
398
|
* See the License for the specific language governing permissions and
|
|
399
399
|
* limitations under the License.
|
|
400
|
-
*/var le;!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"}(le||(le={}));const ue={debug:le.DEBUG,verbose:le.VERBOSE,info:le.INFO,warn:le.WARN,error:le.ERROR,silent:le.SILENT},he=le.INFO,de={[le.DEBUG]:"log",[le.VERBOSE]:"log",[le.INFO]:"info",[le.WARN]:"warn",[le.ERROR]:"error"},fe=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=de[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};var pe=function(t,e){return pe=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])},pe(t,e)};function ge(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 me(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 ye,ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},we=we||{},be=ve||self;function _e(){}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 Ee(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Te="closure_uid_"+(1e9*Math.random()>>>0),Ie=0;function ke(t,e,n){return t.call.apply(t.bind,arguments)}function Ce(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 Ae(t,e,n){return(Ae=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ke:Ce).apply(null,arguments)}function Re(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 Ne(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 Le(){this.s=this.s,this.o=this.o}Le.prototype.s=!1,Le.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Te)&&t[Te]||(t[Te]=++Ie))},Le.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var De=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 Oe(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 xe(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 Pe(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Pe.prototype.h=function(){this.defaultPrevented=!0};var Me=function(){if(!be.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{be.addEventListener("test",_e,e),be.removeEventListener("test",_e,e)}catch(t){}return t}();function Ue(t){return/^[\s\xa0]*$/.test(t)}var Fe=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function ze(t,e){return t<e?-1:t>e?1:0}function Be(){var t=be.navigator;return t&&(t=t.userAgent)?t:""}function Ve(t){return-1!=Be().indexOf(t)}function He(t){return He[" "](t),t}He[" "]=_e;var $e,je,qe=Ve("Opera"),We=Ve("Trident")||Ve("MSIE"),Ke=Ve("Edge"),Ge=Ke||We,Qe=Ve("Gecko")&&!(-1!=Be().toLowerCase().indexOf("webkit")&&!Ve("Edge"))&&!(Ve("Trident")||Ve("MSIE"))&&!Ve("Edge"),Ye=-1!=Be().toLowerCase().indexOf("webkit")&&!Ve("Edge");function Je(){var t=be.document;return t?t.documentMode:void 0}t:{var Xe="",Ze=(je=Be(),Qe?/rv:([^\);]+)(\)|;)/.exec(je):Ke?/Edge\/([\d\.]+)/.exec(je):We?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(je):Ye?/WebKit\/(\S+)/.exec(je):qe?/(?:Version)[ \/]?(\S+)/.exec(je):void 0);if(Ze&&(Xe=Ze?Ze[1]:""),We){var tn=Je();if(null!=tn&&tn>parseFloat(Xe)){$e=String(tn);break t}}$e=Xe}var en,nn={};function rn(){return function(t){var e=nn;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Fe(String($e)).split("."),n=Fe("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=ze(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||ze(0==s[2].length,0==o[2].length)||ze(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(be.document&&We){var sn=Je();en=sn||(parseInt($e,10)||void 0)}else en=void 0;var on=en;function an(t,e){if(Pe.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(Qe){t:{try{He(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:cn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&an.X.h.call(this)}}Ne(an,Pe);var cn={2:"touch",3:"pen",4:"mouse"};an.prototype.h=function(){an.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var ln="closure_listenable_"+(1e6*Math.random()|0),un=0;function hn(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=++un,this.ba=this.ea=!1}function dn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function fn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function pn(t){var e={};for(var n in t)e[n]=t[n];return e}var gn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function mn(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<gn.length;s++)n=gn[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function yn(t){this.src=t,this.g={},this.h=0}function vn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=De(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(dn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function wn(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}yn.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=wn(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new hn(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var bn="closure_lm_"+(1e6*Math.random()|0),_n={};function Sn(t,e,n,r,i){if(r&&r.once)return Tn(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=Ln(n),t&&t[ln]?t.N(e,n,Ee(r)?!!r.capture:!!r,i):En(t,e,n,!1,r,i)}function En(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=Ee(i)?!!i.capture:!!i,a=Rn(t);if(a||(t[bn]=a=new yn(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=An;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Me||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Cn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Tn(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Tn(t,e[s],n,r,i);return null}return n=Ln(n),t&&t[ln]?t.O(e,n,Ee(r)?!!r.capture:!!r,i):En(t,e,n,!0,r,i)}function In(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)In(t,e[s],n,r,i);else r=Ee(r)?!!r.capture:!!r,n=Ln(n),t&&t[ln]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=wn(s=t.g[e],n,r,i))&&(dn(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=Rn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=wn(e,n,r,i)),(n=-1<t?e[t]:null)&&kn(n))}function kn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[ln])vn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Cn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Rn(e))?(vn(n,t),0==n.h&&(n.src=null,e[bn]=null)):dn(t)}}}function Cn(t){return t in _n?_n[t]:_n[t]="on"+t}function An(t,e){if(t.ba)t=!0;else{e=new an(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&kn(t),t=n.call(r,e)}return t}function Rn(t){return(t=t[bn])instanceof yn?t:null}var Nn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ln(t){return"function"==typeof t?t:(t[Nn]||(t[Nn]=function(e){return t.handleEvent(e)}),t[Nn])}function Dn(){Le.call(this),this.i=new yn(this),this.P=this,this.I=null}function On(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 Pe(e,t);else if(e instanceof Pe)e.target=e.target||t;else{var i=e;mn(e=new Pe(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=xn(o,r,!0,e)&&i}if(i=xn(o=e.g=t,r,!0,e)&&i,i=xn(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=xn(o=e.g=n[s],r,!1,e)&&i}function xn(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&&vn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}Ne(Dn,Le),Dn.prototype[ln]=!0,Dn.prototype.removeEventListener=function(t,e,n,r){In(this,t,e,n,r)},Dn.prototype.M=function(){if(Dn.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++)dn(n[r]);delete e.g[t],e.h--}}this.I=null},Dn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Dn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Pn=be.JSON.stringify;function Mn(){var t=jn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Un,Fn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=zn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),zn=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 Bn}),(function(t){return t.reset()})),Bn=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 Vn(t){be.setTimeout((function(){throw t}),0)}function Hn(t,e){Un||function(){var t=be.Promise.resolve(void 0);Un=function(){t.then(qn)}}(),$n||(Un(),$n=!0),jn.add(t,e)}var $n=!1,jn=new Fn;function qn(){for(var t;t=Mn();){try{t.h.call(t.g)}catch(t){Vn(t)}var e=zn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}$n=!1}function Wn(t,e){Dn.call(this),this.h=t||1,this.g=e||be,this.j=Ae(this.lb,this),this.l=Date.now()}function Kn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Gn(t,e,n){if("function"==typeof t)n&&(t=Ae(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Ae(t.handleEvent,t)}return 2147483647<Number(e)?-1:be.setTimeout(t,e||0)}function Qn(t){t.g=Gn((function(){t.g=null,t.i&&(t.i=!1,Qn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ne(Wn,Dn),(ye=Wn.prototype).ca=!1,ye.R=null,ye.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),On(this,"tick"),this.ca&&(Kn(this),this.start()))}},ye.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},ye.M=function(){Wn.X.M.call(this),Kn(this),delete this.g};var Yn=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}pe(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:Qn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(be.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Le);function Jn(t){Le.call(this),this.h=t,this.g={}}Ne(Jn,Le);var Xn=[];function Zn(t,e,n,r){Array.isArray(n)||(n&&(Xn[0]=n.toString()),n=Xn);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 tr(t){fn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&kn(t)}),t),t.g={}}function er(){this.g=!0}function nr(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 Pn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Jn.prototype.M=function(){Jn.X.M.call(this),tr(this)},Jn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},er.prototype.Aa=function(){this.g=!1},er.prototype.info=function(){};var rr={},ir=null;function sr(){return ir=ir||new Dn}function or(t){Pe.call(this,rr.Pa,t)}function ar(t){var e=sr();On(e,new or(e))}function cr(t,e){Pe.call(this,rr.STAT_EVENT,t),this.stat=e}function lr(t){var e=sr();On(e,new cr(e,t))}function ur(t,e){Pe.call(this,rr.Qa,t),this.size=e}function hr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return be.setTimeout((function(){t()}),e)}rr.Pa="serverreachability",Ne(or,Pe),rr.STAT_EVENT="statevent",Ne(cr,Pe),rr.Qa="timingevent",Ne(ur,Pe);var dr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},fr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function pr(){}function gr(t){return t.h||(t.h=t.i())}function mr(){}pr.prototype.h=null;var yr,vr={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function wr(){Pe.call(this,"d")}function br(){Pe.call(this,"c")}function _r(){}function Sr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Jn(this),this.O=Tr,t=Ge?125:void 0,this.T=new Wn(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 Er}function Er(){this.i=null,this.g="",this.h=!1}Ne(wr,Pe),Ne(br,Pe),Ne(_r,pr),_r.prototype.g=function(){return new XMLHttpRequest},_r.prototype.i=function(){return{}},yr=new _r;var Tr=45e3,Ir={},kr={};function Cr(t,e,n){t.K=1,t.v=Wr(Vr(e)),t.s=n,t.P=!0,Ar(t,null)}function Ar(t,e){t.F=Date.now(),Dr(t),t.A=Vr(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),si(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Er,t.g=ss(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Yn(Ae(t.La,t,t.g),t.N)),Zn(t.S,t.g,"readystatechange",t.ib),e=t.H?pn(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)),ar(),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 Rr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Nr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=Lr(t,n))==kr){4==e&&(t.o=4,lr(14),i=!1),nr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ir){t.o=4,lr(15),nr(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}nr(t.j,t.m,r,null),Ur(t,r)}Rr(t)&&r!=kr&&r!=Ir&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,lr(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),Ji(e),e.K=!0,lr(11))):(nr(t.j,t.m,n,"[Invalid Chunked Response]"),Mr(t),Pr(t))}function Lr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?kr:(n=Number(e.substring(n,r)),isNaN(n)?Ir:(r+=1)+n>e.length?kr:(e=e.substr(r,n),t.C=r+n,e))}function Dr(t){t.V=Date.now()+t.O,Or(t,t.O)}function Or(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=hr(Ae(t.gb,t),e)}function xr(t){t.B&&(be.clearTimeout(t.B),t.B=null)}function Pr(t){0==t.l.G||t.I||ts(t.l,t)}function Mr(t){xr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Kn(t.T),tr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Ur(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||di(n.h,t)))if(!t.J&&di(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;Zi(n),$i(n)}Yi(n),lr(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=hr(Ae(n.cb,n),6e3));if(1>=hi(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else ns(n,11)}else if((t.J||n.g==t)&&Zi(n),!Ue(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&&(fi(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,qr(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=is(r,r.H?r.ka:null,r.V),f.J){pi(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(xr(p),Dr(p)),r.g=f}else Qi(r);0<n.i.length&&qi(n)}else"stop"!=s[0]&&"close"!=s[0]||ns(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?ns(n,7):Hi(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}ar()}catch(s){}}function Fr(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)}(ye=Sr.prototype).setTimeout=function(t){this.O=t},ye.ib=function(t){t=t.target;var e=this.L;e&&3==Mi(t)?e.l():this.La(t)},ye.La=function(t){try{if(t==this.g)t:{var e=Mi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ge||this.g&&(this.h.h||this.g.fa()||Ui(this.g)))){this.I||4!=e||7==n||ar(),xr(this);var r=this.g.aa();this.Y=r;e:if(Rr(this)){var i=Ui(this.g);t="";var s=i.length,o=4==Mi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Mr(this),Pr(this);var a="";break e}this.h.i=new be.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)&&!Ue(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,lr(12),Mr(this),Pr(this);break t}nr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Ur(this,r)}this.P?(Nr(this,e,a),Ge&&this.i&&3==e&&(Zn(this.S,this.T,"tick",this.hb),this.T.start())):(nr(this.j,this.m,a,null),Ur(this,a)),4==e&&Mr(this),this.i&&!this.I&&(4==e?ts(this.l,this):(this.i=!1,Dr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,lr(12)):(this.o=0,lr(13)),Mr(this),Pr(this)}}}catch(e){}},ye.hb=function(){if(this.g){var t=Mi(this.g),e=this.g.fa();this.C<e.length&&(xr(this),Nr(this,t,e),this.i&&4!=t&&Dr(this))}},ye.cancel=function(){this.I=!0,Mr(this)},ye.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&&(ar(),lr(17)),Mr(this),this.o=2,Pr(this)):Or(this,this.V-t)};var zr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Br(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Br){this.h=void 0!==e?e:t.h,Hr(this,t.j),this.s=t.s,this.g=t.g,$r(this,t.m),this.l=t.l,e=t.i;var n=new ei;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),jr(this,n),this.o=t.o}else t&&(n=String(t).match(zr))?(this.h=!!e,Hr(this,n[1]||"",!0),this.s=Kr(n[2]||""),this.g=Kr(n[3]||"",!0),$r(this,n[4]),this.l=Kr(n[5]||"",!0),jr(this,n[6]||"",!0),this.o=Kr(n[7]||"")):(this.h=!!e,this.i=new ei(null,this.h))}function Vr(t){return new Br(t)}function Hr(t,e,n){t.j=n?Kr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function $r(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 jr(t,e,n){e instanceof ei?(t.i=e,function(t,e){e&&!t.j&&(ni(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ri(this,e),si(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Gr(e,Zr)),t.i=new ei(e,t.h))}function qr(t,e,n){t.i.set(e,n)}function Wr(t){return qr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Kr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Gr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Qr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Qr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Br.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Gr(e,Yr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Gr(e,Yr,!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(Gr(n,"/"==n.charAt(0)?Xr:Jr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Gr(n,ti)),t.join("")};var Yr=/[#\/\?@]/g,Jr=/[#\?:]/g,Xr=/[#\?]/g,Zr=/[#\?@]/g,ti=/#/g;function ei(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ni(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 ri(t,e){ni(t),e=oi(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ii(t,e){return ni(t),e=oi(t,e),t.g.has(e)}function si(t,e,n){ri(t,e),0<n.length&&(t.i=null,t.g.set(oi(t,e),Oe(n)),t.h+=n.length)}function oi(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(ye=ei.prototype).add=function(t,e){ni(this),this.i=null,t=oi(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},ye.forEach=function(t,e){ni(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},ye.oa=function(){ni(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},ye.W=function(t){ni(this);var e=[];if("string"==typeof t)ii(this,t)&&(e=e.concat(this.g.get(oi(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},ye.set=function(t,e){return ni(this),this.i=null,ii(this,t=oi(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},ye.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},ye.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 ai=function(t,e){this.h=t,this.g=e};function ci(t){this.l=t||li,be.PerformanceNavigationTiming?t=0<(t=be.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(be.g&&be.g.Ga&&be.g.Ga()&&be.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 li=10;function ui(t){return!!t.h||!!t.g&&t.g.size>=t.j}function hi(t){return t.h?1:t.g?t.g.size:0}function di(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function fi(t,e){t.g?t.g.add(e):t.h=e}function pi(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function gi(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=ge(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 Oe(t.i)}function mi(){}function yi(){this.g=new mi}function vi(t,e,n){var r=n||"";try{Fr(t,(function(t,n){var i=t;Ee(t)&&(i=Pn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function wi(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function bi(t){this.l=t.ac||null,this.j=t.jb||!1}function _i(t,e){Dn.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}ci.prototype.cancel=function(){var t,e;if(this.i=gi(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ge(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()}},mi.prototype.stringify=function(t){return be.JSON.stringify(t,void 0)},mi.prototype.parse=function(t){return be.JSON.parse(t,void 0)},Ne(bi,pr),bi.prototype.g=function(){return new _i(this.l,this.j)},bi.prototype.i=function(t){return function(){return t}}({}),Ne(_i,Dn);var Si=0;function Ei(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Ti(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ii(t)}function Ii(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(ye=_i.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,Ii(this)},ye.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||be).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},ye.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,Ti(this)),this.readyState=Si},ye.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,Ii(this)),this.g&&(this.readyState=3,Ii(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==be.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;Ei(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},ye.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?Ti(this):Ii(this),3==this.readyState&&Ei(this)}},ye.Va=function(t){this.g&&(this.response=this.responseText=t,Ti(this))},ye.Ua=function(t){this.g&&(this.response=t,Ti(this))},ye.ga=function(){this.g&&Ti(this)},ye.setRequestHeader=function(t,e){this.v.append(t,e)},ye.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},ye.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(_i.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var ki=be.JSON.parse;function Ci(t){Dn.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=Ai,this.K=this.L=!1}Ne(Ci,Dn);var Ai="",Ri=/^https?$/i,Ni=["POST","PUT"];function Li(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Di(t),xi(t)}function Di(t){t.D||(t.D=!0,On(t,"complete"),On(t,"error"))}function Oi(t){if(t.h&&void 0!==we&&(!t.C[1]||4!=Mi(t)||2!=t.aa()))if(t.v&&4==Mi(t))Gn(t.Ha,0,t);else if(On(t,"readystatechange"),4==Mi(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(zr)[1]||null;if(!s&&be.self&&be.self.location){var o=be.self.location.protocol;s=o.substr(0,o.length-1)}i=!Ri.test(s?s.toLowerCase():"")}e=i}if(e)On(t,"complete"),On(t,"success");else{t.m=6;try{var a=2<Mi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Di(t)}}finally{xi(t)}}}function xi(t,e){if(t.g){Pi(t);var n=t.g,r=t.C[0]?_e:null;t.g=null,t.C=null,e||On(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Pi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(be.clearTimeout(t.A),t.A=null)}function Mi(t){return t.g?t.g.readyState:0}function Ui(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Ai:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Fi(t){var e="";return fn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function zi(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Fi(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):qr(t,e,n))}function Bi(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Vi(t){this.Ca=0,this.i=[],this.j=new er,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=Bi("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=Bi("baseRetryDelayMs",5e3,t),this.bb=Bi("retryDelaySeedMs",1e4,t),this.$a=Bi("forwardChannelMaxRetries",2,t),this.ta=Bi("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 ci(t&&t.concurrentRequestLimit),this.Fa=new yi,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 Hi(t){if(ji(t),3==t.G){var e=t.U++,n=Vr(t.F);qr(n,"SID",t.I),qr(n,"RID",e),qr(n,"TYPE","terminate"),Ki(t,n),(e=new Sr(t,t.j,e,void 0)).K=2,e.v=Wr(Vr(n)),n=!1,be.navigator&&be.navigator.sendBeacon&&(n=be.navigator.sendBeacon(e.v.toString(),"")),!n&&be.Image&&((new Image).src=e.v,n=!0),n||(e.g=ss(e.l,null),e.g.da(e.v)),e.F=Date.now(),Dr(e)}rs(t)}function $i(t){t.g&&(Ji(t),t.g.cancel(),t.g=null)}function ji(t){$i(t),t.u&&(be.clearTimeout(t.u),t.u=null),Zi(t),t.h.cancel(),t.m&&("number"==typeof t.m&&be.clearTimeout(t.m),t.m=null)}function qi(t){ui(t.h)||t.m||(t.m=!0,Hn(t.Ja,t),t.C=0)}function Wi(t,e){var n;n=e?e.m:t.U++;var r=Vr(t.F);qr(r,"SID",t.I),qr(r,"RID",n),qr(r,"AID",t.T),Ki(t,r),t.o&&t.s&&zi(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=Gi(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),fi(t.h,n),Cr(n,r,e)}function Ki(t,e){t.ia&&fn(t.ia,(function(t,n){qr(e,n,t)})),t.l&&Fr({},(function(t,n){qr(e,n,t)}))}function Gi(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Ae(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{vi(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 Qi(t){t.g||t.u||(t.Z=1,Hn(t.Ia,t),t.A=0)}function Yi(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=hr(Ae(t.Ia,t),es(t,t.A)),t.A++,!0)}function Ji(t){null!=t.B&&(be.clearTimeout(t.B),t.B=null)}function Xi(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=Vr(t.sa);qr(e,"RID","rpc"),qr(e,"SID",t.I),qr(e,"CI",t.L?"0":"1"),qr(e,"AID",t.T),qr(e,"TYPE","xmlhttp"),Ki(t,e),t.o&&t.s&&zi(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Wr(Vr(e)),n.s=null,n.P=!0,Ar(n,t)}function Zi(t){null!=t.v&&(be.clearTimeout(t.v),t.v=null)}function ts(t,e){var n=null;if(t.g==e){Zi(t),Ji(t),t.g=null;var r=2}else{if(!di(t.h,e))return;n=e.D,pi(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;On(r=sr(),new ur(r,n)),qi(t)}else Qi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(hi(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=hr(Ae(t.Ja,t,e),es(t,t.C)),t.C++,0)))}(t,e)||2==r&&Yi(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:ns(t,5);break;case 4:ns(t,10);break;case 3:ns(t,6);break;default:ns(t,2)}}function es(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ns(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Ae(t.kb,t);n||(n=new Br("//www.google.com/images/cleardot.gif"),be.location&&"http"==be.location.protocol||Hr(n,"https"),Wr(n)),function(t,e){var n=new er;if(be.Image){var r=new Image;r.onload=Re(wi,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Re(wi,n,r,"TestLoadImage: error",!1,e),r.onabort=Re(wi,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Re(wi,n,r,"TestLoadImage: timeout",!1,e),be.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else lr(2);t.G=0,t.l&&t.l.va(e),rs(t),ji(t)}function rs(t){if(t.G=0,t.la=[],t.l){var e=gi(t.h);0==e.length&&0==t.i.length||(xe(t.la,e),xe(t.la,t.i),t.h.i.length=0,Oe(t.i),t.i.length=0),t.l.ua()}}function is(t,e,n){var r=n instanceof Br?Vr(n):new Br(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),$r(r,r.m);else{var i=be.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Br(null,void 0);r&&Hr(s,r),e&&(s.g=e),i&&$r(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&qr(r,n,e),qr(r,"VER",t.ma),Ki(t,r),r}function ss(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 Ci(new bi({jb:!0})):new Ci(t.ra)).Ka(t.H),e}function os(){}function as(){if(We&&!(10<=Number(on)))throw Error("Environmental error: no available transport.")}function cs(t,e){Dn.call(this),this.g=new Vi(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)&&!Ue(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Ue(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new hs(this)}function ls(t){wr.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 us(){br.call(this),this.status=1}function hs(t){this.g=t}(ye=Ci.prototype).Ka=function(t){this.L=t},ye.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():yr.g(),this.C=this.u?gr(this.u):gr(yr),this.g.onreadystatechange=Ae(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void Li(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=ge(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=be.FormData&&t instanceof be.FormData,!(0<=De(Ni,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ge(n),f=d.next();!f.done;f=d.next()){var p=me(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{Pi(this),0<this.B&&((this.K=function(t){return We&&rn()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Ae(this.qa,this)):this.A=Gn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){Li(this,h)}},ye.qa=function(){void 0!==we&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,On(this,"timeout"),this.abort(8))},ye.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,On(this,"complete"),On(this,"abort"),xi(this))},ye.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),xi(this,!0)),Ci.X.M.call(this)},ye.Ha=function(){this.s||(this.F||this.v||this.l?Oi(this):this.fb())},ye.fb=function(){Oi(this)},ye.aa=function(){try{return 2<Mi(this)?this.g.status:-1}catch(t){return-1}},ye.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},ye.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),ki(e)}},ye.Ea=function(){return this.m},ye.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(ye=Vi.prototype).ma=8,ye.G=1,ye.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?mn(n=pn(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=Gi(this,e,r),qr(i=Vr(this.F),"RID",t),qr(i,"CVER",22),this.D&&qr(i,"X-HTTP-Session-Id",this.D),Ki(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Fi(n)))+"&"+r:this.o&&zi(i,this.o,n)),fi(this.h,e),this.Ya&&qr(i,"TYPE","init"),this.O?(qr(i,"$req",r),qr(i,"SID","null"),e.Z=!0,Cr(e,i,null)):Cr(e,i,r),this.G=2}}else 3==this.G&&(t?Wi(this,t):0==this.i.length||ui(this.h)||Wi(this))},ye.Ia=function(){if(this.u=null,Xi(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=hr(Ae(this.eb,this),t)}},ye.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,lr(10),$i(this),Xi(this))},ye.cb=function(){null!=this.v&&(this.v=null,$i(this),Yi(this),lr(19))},ye.kb=function(t){t?(this.j.info("Successfully pinged google.com"),lr(2)):(this.j.info("Failed to ping google.com"),lr(1))},(ye=os.prototype).xa=function(){},ye.wa=function(){},ye.va=function(){},ye.ua=function(){},ye.Ra=function(){},as.prototype.g=function(t,e){return new cs(t,e)},Ne(cs,Dn),cs.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;lr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=is(t,null,t.V),qi(t)},cs.prototype.close=function(){Hi(this.g)},cs.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Pn(t),t=n);e.i.push(new ai(e.ab++,t)),3==e.G&&qi(e)},cs.prototype.M=function(){this.g.l=null,delete this.j,Hi(this.g),delete this.g,cs.X.M.call(this)},Ne(ls,wr),Ne(us,br),Ne(hs,os),hs.prototype.xa=function(){On(this.g,"a")},hs.prototype.wa=function(t){On(this.g,new ls(t))},hs.prototype.va=function(t){On(this.g,new us)},hs.prototype.ua=function(){On(this.g,"b")},as.prototype.createWebChannel=as.prototype.g,cs.prototype.send=cs.prototype.u,cs.prototype.open=cs.prototype.m,cs.prototype.close=cs.prototype.close,dr.NO_ERROR=0,dr.TIMEOUT=8,dr.HTTP_ERROR=6,fr.COMPLETE="complete",mr.EventType=vr,vr.OPEN="a",vr.CLOSE="b",vr.ERROR="c",vr.MESSAGE="d",Dn.prototype.listen=Dn.prototype.N,Ci.prototype.listenOnce=Ci.prototype.O,Ci.prototype.getLastError=Ci.prototype.Oa,Ci.prototype.getLastErrorCode=Ci.prototype.Ea,Ci.prototype.getStatus=Ci.prototype.aa,Ci.prototype.getResponseJson=Ci.prototype.Sa,Ci.prototype.getResponseText=Ci.prototype.fa,Ci.prototype.send=Ci.prototype.da,Ci.prototype.setWithCredentials=Ci.prototype.Ka;var ds=dr,fs=fr,ps=rr,gs=10,ms=11,ys=bi,vs=mr,ws=Ci;const bs="@firebase/firestore";
|
|
400
|
+
*/var le;!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"}(le||(le={}));const ue={debug:le.DEBUG,verbose:le.VERBOSE,info:le.INFO,warn:le.WARN,error:le.ERROR,silent:le.SILENT},he=le.INFO,de={[le.DEBUG]:"log",[le.VERBOSE]:"log",[le.INFO]:"info",[le.WARN]:"warn",[le.ERROR]:"error"},fe=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=de[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};var pe=function(t,e){return pe=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])},pe(t,e)};function ge(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 me(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 ye,ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},we=we||{},be=ve||self;function Se(){}function _e(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 Ee(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Te="closure_uid_"+(1e9*Math.random()>>>0),Ie=0;function ke(t,e,n){return t.call.apply(t.bind,arguments)}function Ce(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 Ae(t,e,n){return(Ae=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ke:Ce).apply(null,arguments)}function Re(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 Ne(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 Le(){this.s=this.s,this.o=this.o}Le.prototype.s=!1,Le.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Te)&&t[Te]||(t[Te]=++Ie))},Le.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var De=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 Oe(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 xe(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(_e(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 Pe(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Pe.prototype.h=function(){this.defaultPrevented=!0};var Me=function(){if(!be.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{be.addEventListener("test",Se,e),be.removeEventListener("test",Se,e)}catch(t){}return t}();function Ue(t){return/^[\s\xa0]*$/.test(t)}var Fe=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function ze(t,e){return t<e?-1:t>e?1:0}function Be(){var t=be.navigator;return t&&(t=t.userAgent)?t:""}function Ve(t){return-1!=Be().indexOf(t)}function He(t){return He[" "](t),t}He[" "]=Se;var $e,je,qe=Ve("Opera"),We=Ve("Trident")||Ve("MSIE"),Ke=Ve("Edge"),Ge=Ke||We,Qe=Ve("Gecko")&&!(-1!=Be().toLowerCase().indexOf("webkit")&&!Ve("Edge"))&&!(Ve("Trident")||Ve("MSIE"))&&!Ve("Edge"),Ye=-1!=Be().toLowerCase().indexOf("webkit")&&!Ve("Edge");function Je(){var t=be.document;return t?t.documentMode:void 0}t:{var Xe="",Ze=(je=Be(),Qe?/rv:([^\);]+)(\)|;)/.exec(je):Ke?/Edge\/([\d\.]+)/.exec(je):We?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(je):Ye?/WebKit\/(\S+)/.exec(je):qe?/(?:Version)[ \/]?(\S+)/.exec(je):void 0);if(Ze&&(Xe=Ze?Ze[1]:""),We){var tn=Je();if(null!=tn&&tn>parseFloat(Xe)){$e=String(tn);break t}}$e=Xe}var en,nn={};function rn(){return function(t){var e=nn;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Fe(String($e)).split("."),n=Fe("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=ze(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||ze(0==s[2].length,0==o[2].length)||ze(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(be.document&&We){var sn=Je();en=sn||(parseInt($e,10)||void 0)}else en=void 0;var on=en;function an(t,e){if(Pe.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(Qe){t:{try{He(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:cn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&an.X.h.call(this)}}Ne(an,Pe);var cn={2:"touch",3:"pen",4:"mouse"};an.prototype.h=function(){an.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var ln="closure_listenable_"+(1e6*Math.random()|0),un=0;function hn(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=++un,this.ba=this.ea=!1}function dn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function fn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function pn(t){var e={};for(var n in t)e[n]=t[n];return e}var gn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function mn(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<gn.length;s++)n=gn[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function yn(t){this.src=t,this.g={},this.h=0}function vn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=De(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(dn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function wn(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}yn.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=wn(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new hn(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var bn="closure_lm_"+(1e6*Math.random()|0),Sn={};function _n(t,e,n,r,i){if(r&&r.once)return Tn(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)_n(t,e[s],n,r,i);return null}return n=Ln(n),t&&t[ln]?t.N(e,n,Ee(r)?!!r.capture:!!r,i):En(t,e,n,!1,r,i)}function En(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=Ee(i)?!!i.capture:!!i,a=Rn(t);if(a||(t[bn]=a=new yn(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=An;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Me||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Cn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Tn(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Tn(t,e[s],n,r,i);return null}return n=Ln(n),t&&t[ln]?t.O(e,n,Ee(r)?!!r.capture:!!r,i):En(t,e,n,!0,r,i)}function In(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)In(t,e[s],n,r,i);else r=Ee(r)?!!r.capture:!!r,n=Ln(n),t&&t[ln]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=wn(s=t.g[e],n,r,i))&&(dn(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=Rn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=wn(e,n,r,i)),(n=-1<t?e[t]:null)&&kn(n))}function kn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[ln])vn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Cn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Rn(e))?(vn(n,t),0==n.h&&(n.src=null,e[bn]=null)):dn(t)}}}function Cn(t){return t in Sn?Sn[t]:Sn[t]="on"+t}function An(t,e){if(t.ba)t=!0;else{e=new an(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&kn(t),t=n.call(r,e)}return t}function Rn(t){return(t=t[bn])instanceof yn?t:null}var Nn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ln(t){return"function"==typeof t?t:(t[Nn]||(t[Nn]=function(e){return t.handleEvent(e)}),t[Nn])}function Dn(){Le.call(this),this.i=new yn(this),this.P=this,this.I=null}function On(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 Pe(e,t);else if(e instanceof Pe)e.target=e.target||t;else{var i=e;mn(e=new Pe(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=xn(o,r,!0,e)&&i}if(i=xn(o=e.g=t,r,!0,e)&&i,i=xn(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=xn(o=e.g=n[s],r,!1,e)&&i}function xn(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&&vn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}Ne(Dn,Le),Dn.prototype[ln]=!0,Dn.prototype.removeEventListener=function(t,e,n,r){In(this,t,e,n,r)},Dn.prototype.M=function(){if(Dn.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++)dn(n[r]);delete e.g[t],e.h--}}this.I=null},Dn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Dn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Pn=be.JSON.stringify;function Mn(){var t=jn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Un,Fn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=zn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),zn=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 Bn}),(function(t){return t.reset()})),Bn=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 Vn(t){be.setTimeout((function(){throw t}),0)}function Hn(t,e){Un||function(){var t=be.Promise.resolve(void 0);Un=function(){t.then(qn)}}(),$n||(Un(),$n=!0),jn.add(t,e)}var $n=!1,jn=new Fn;function qn(){for(var t;t=Mn();){try{t.h.call(t.g)}catch(t){Vn(t)}var e=zn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}$n=!1}function Wn(t,e){Dn.call(this),this.h=t||1,this.g=e||be,this.j=Ae(this.lb,this),this.l=Date.now()}function Kn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Gn(t,e,n){if("function"==typeof t)n&&(t=Ae(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Ae(t.handleEvent,t)}return 2147483647<Number(e)?-1:be.setTimeout(t,e||0)}function Qn(t){t.g=Gn((function(){t.g=null,t.i&&(t.i=!1,Qn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ne(Wn,Dn),(ye=Wn.prototype).ca=!1,ye.R=null,ye.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),On(this,"tick"),this.ca&&(Kn(this),this.start()))}},ye.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},ye.M=function(){Wn.X.M.call(this),Kn(this),delete this.g};var Yn=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}pe(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:Qn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(be.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Le);function Jn(t){Le.call(this),this.h=t,this.g={}}Ne(Jn,Le);var Xn=[];function Zn(t,e,n,r){Array.isArray(n)||(n&&(Xn[0]=n.toString()),n=Xn);for(var i=0;i<n.length;i++){var s=_n(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function tr(t){fn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&kn(t)}),t),t.g={}}function er(){this.g=!0}function nr(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 Pn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Jn.prototype.M=function(){Jn.X.M.call(this),tr(this)},Jn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},er.prototype.Aa=function(){this.g=!1},er.prototype.info=function(){};var rr={},ir=null;function sr(){return ir=ir||new Dn}function or(t){Pe.call(this,rr.Pa,t)}function ar(t){var e=sr();On(e,new or(e))}function cr(t,e){Pe.call(this,rr.STAT_EVENT,t),this.stat=e}function lr(t){var e=sr();On(e,new cr(e,t))}function ur(t,e){Pe.call(this,rr.Qa,t),this.size=e}function hr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return be.setTimeout((function(){t()}),e)}rr.Pa="serverreachability",Ne(or,Pe),rr.STAT_EVENT="statevent",Ne(cr,Pe),rr.Qa="timingevent",Ne(ur,Pe);var dr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},fr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function pr(){}function gr(t){return t.h||(t.h=t.i())}function mr(){}pr.prototype.h=null;var yr,vr={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function wr(){Pe.call(this,"d")}function br(){Pe.call(this,"c")}function Sr(){}function _r(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Jn(this),this.O=Tr,t=Ge?125:void 0,this.T=new Wn(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 Er}function Er(){this.i=null,this.g="",this.h=!1}Ne(wr,Pe),Ne(br,Pe),Ne(Sr,pr),Sr.prototype.g=function(){return new XMLHttpRequest},Sr.prototype.i=function(){return{}},yr=new Sr;var Tr=45e3,Ir={},kr={};function Cr(t,e,n){t.K=1,t.v=Wr(Vr(e)),t.s=n,t.P=!0,Ar(t,null)}function Ar(t,e){t.F=Date.now(),Dr(t),t.A=Vr(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),si(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Er,t.g=ss(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Yn(Ae(t.La,t,t.g),t.N)),Zn(t.S,t.g,"readystatechange",t.ib),e=t.H?pn(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)),ar(),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 Rr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Nr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=Lr(t,n))==kr){4==e&&(t.o=4,lr(14),i=!1),nr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ir){t.o=4,lr(15),nr(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}nr(t.j,t.m,r,null),Ur(t,r)}Rr(t)&&r!=kr&&r!=Ir&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,lr(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),Ji(e),e.K=!0,lr(11))):(nr(t.j,t.m,n,"[Invalid Chunked Response]"),Mr(t),Pr(t))}function Lr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?kr:(n=Number(e.substring(n,r)),isNaN(n)?Ir:(r+=1)+n>e.length?kr:(e=e.substr(r,n),t.C=r+n,e))}function Dr(t){t.V=Date.now()+t.O,Or(t,t.O)}function Or(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=hr(Ae(t.gb,t),e)}function xr(t){t.B&&(be.clearTimeout(t.B),t.B=null)}function Pr(t){0==t.l.G||t.I||ts(t.l,t)}function Mr(t){xr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Kn(t.T),tr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Ur(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||di(n.h,t)))if(!t.J&&di(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;Zi(n),$i(n)}Yi(n),lr(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=hr(Ae(n.cb,n),6e3));if(1>=hi(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else ns(n,11)}else if((t.J||n.g==t)&&Zi(n),!Ue(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&&(fi(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,qr(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=is(r,r.H?r.ka:null,r.V),f.J){pi(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(xr(p),Dr(p)),r.g=f}else Qi(r);0<n.i.length&&qi(n)}else"stop"!=s[0]&&"close"!=s[0]||ns(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?ns(n,7):Hi(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}ar()}catch(s){}}function Fr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(_e(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(_e(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(_e(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)}(ye=_r.prototype).setTimeout=function(t){this.O=t},ye.ib=function(t){t=t.target;var e=this.L;e&&3==Mi(t)?e.l():this.La(t)},ye.La=function(t){try{if(t==this.g)t:{var e=Mi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ge||this.g&&(this.h.h||this.g.fa()||Ui(this.g)))){this.I||4!=e||7==n||ar(),xr(this);var r=this.g.aa();this.Y=r;e:if(Rr(this)){var i=Ui(this.g);t="";var s=i.length,o=4==Mi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Mr(this),Pr(this);var a="";break e}this.h.i=new be.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)&&!Ue(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,lr(12),Mr(this),Pr(this);break t}nr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Ur(this,r)}this.P?(Nr(this,e,a),Ge&&this.i&&3==e&&(Zn(this.S,this.T,"tick",this.hb),this.T.start())):(nr(this.j,this.m,a,null),Ur(this,a)),4==e&&Mr(this),this.i&&!this.I&&(4==e?ts(this.l,this):(this.i=!1,Dr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,lr(12)):(this.o=0,lr(13)),Mr(this),Pr(this)}}}catch(e){}},ye.hb=function(){if(this.g){var t=Mi(this.g),e=this.g.fa();this.C<e.length&&(xr(this),Nr(this,t,e),this.i&&4!=t&&Dr(this))}},ye.cancel=function(){this.I=!0,Mr(this)},ye.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&&(ar(),lr(17)),Mr(this),this.o=2,Pr(this)):Or(this,this.V-t)};var zr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Br(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Br){this.h=void 0!==e?e:t.h,Hr(this,t.j),this.s=t.s,this.g=t.g,$r(this,t.m),this.l=t.l,e=t.i;var n=new ei;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),jr(this,n),this.o=t.o}else t&&(n=String(t).match(zr))?(this.h=!!e,Hr(this,n[1]||"",!0),this.s=Kr(n[2]||""),this.g=Kr(n[3]||"",!0),$r(this,n[4]),this.l=Kr(n[5]||"",!0),jr(this,n[6]||"",!0),this.o=Kr(n[7]||"")):(this.h=!!e,this.i=new ei(null,this.h))}function Vr(t){return new Br(t)}function Hr(t,e,n){t.j=n?Kr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function $r(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 jr(t,e,n){e instanceof ei?(t.i=e,function(t,e){e&&!t.j&&(ni(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ri(this,e),si(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Gr(e,Zr)),t.i=new ei(e,t.h))}function qr(t,e,n){t.i.set(e,n)}function Wr(t){return qr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Kr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Gr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Qr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Qr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Br.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Gr(e,Yr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Gr(e,Yr,!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(Gr(n,"/"==n.charAt(0)?Xr:Jr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Gr(n,ti)),t.join("")};var Yr=/[#\/\?@]/g,Jr=/[#\?:]/g,Xr=/[#\?]/g,Zr=/[#\?@]/g,ti=/#/g;function ei(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ni(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 ri(t,e){ni(t),e=oi(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ii(t,e){return ni(t),e=oi(t,e),t.g.has(e)}function si(t,e,n){ri(t,e),0<n.length&&(t.i=null,t.g.set(oi(t,e),Oe(n)),t.h+=n.length)}function oi(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(ye=ei.prototype).add=function(t,e){ni(this),this.i=null,t=oi(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},ye.forEach=function(t,e){ni(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},ye.oa=function(){ni(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},ye.W=function(t){ni(this);var e=[];if("string"==typeof t)ii(this,t)&&(e=e.concat(this.g.get(oi(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},ye.set=function(t,e){return ni(this),this.i=null,ii(this,t=oi(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},ye.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},ye.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 ai=function(t,e){this.h=t,this.g=e};function ci(t){this.l=t||li,be.PerformanceNavigationTiming?t=0<(t=be.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(be.g&&be.g.Ga&&be.g.Ga()&&be.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 li=10;function ui(t){return!!t.h||!!t.g&&t.g.size>=t.j}function hi(t){return t.h?1:t.g?t.g.size:0}function di(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function fi(t,e){t.g?t.g.add(e):t.h=e}function pi(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function gi(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=ge(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 Oe(t.i)}function mi(){}function yi(){this.g=new mi}function vi(t,e,n){var r=n||"";try{Fr(t,(function(t,n){var i=t;Ee(t)&&(i=Pn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function wi(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function bi(t){this.l=t.ac||null,this.j=t.jb||!1}function Si(t,e){Dn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=_i,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}ci.prototype.cancel=function(){var t,e;if(this.i=gi(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ge(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()}},mi.prototype.stringify=function(t){return be.JSON.stringify(t,void 0)},mi.prototype.parse=function(t){return be.JSON.parse(t,void 0)},Ne(bi,pr),bi.prototype.g=function(){return new Si(this.l,this.j)},bi.prototype.i=function(t){return function(){return t}}({}),Ne(Si,Dn);var _i=0;function Ei(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Ti(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ii(t)}function Ii(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(ye=Si.prototype).open=function(t,e){if(this.readyState!=_i)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ii(this)},ye.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||be).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},ye.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,Ti(this)),this.readyState=_i},ye.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,Ii(this)),this.g&&(this.readyState=3,Ii(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==be.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;Ei(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},ye.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?Ti(this):Ii(this),3==this.readyState&&Ei(this)}},ye.Va=function(t){this.g&&(this.response=this.responseText=t,Ti(this))},ye.Ua=function(t){this.g&&(this.response=t,Ti(this))},ye.ga=function(){this.g&&Ti(this)},ye.setRequestHeader=function(t,e){this.v.append(t,e)},ye.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},ye.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(Si.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var ki=be.JSON.parse;function Ci(t){Dn.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=Ai,this.K=this.L=!1}Ne(Ci,Dn);var Ai="",Ri=/^https?$/i,Ni=["POST","PUT"];function Li(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Di(t),xi(t)}function Di(t){t.D||(t.D=!0,On(t,"complete"),On(t,"error"))}function Oi(t){if(t.h&&void 0!==we&&(!t.C[1]||4!=Mi(t)||2!=t.aa()))if(t.v&&4==Mi(t))Gn(t.Ha,0,t);else if(On(t,"readystatechange"),4==Mi(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(zr)[1]||null;if(!s&&be.self&&be.self.location){var o=be.self.location.protocol;s=o.substr(0,o.length-1)}i=!Ri.test(s?s.toLowerCase():"")}e=i}if(e)On(t,"complete"),On(t,"success");else{t.m=6;try{var a=2<Mi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Di(t)}}finally{xi(t)}}}function xi(t,e){if(t.g){Pi(t);var n=t.g,r=t.C[0]?Se:null;t.g=null,t.C=null,e||On(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Pi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(be.clearTimeout(t.A),t.A=null)}function Mi(t){return t.g?t.g.readyState:0}function Ui(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Ai:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Fi(t){var e="";return fn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function zi(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Fi(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):qr(t,e,n))}function Bi(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Vi(t){this.Ca=0,this.i=[],this.j=new er,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=Bi("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=Bi("baseRetryDelayMs",5e3,t),this.bb=Bi("retryDelaySeedMs",1e4,t),this.$a=Bi("forwardChannelMaxRetries",2,t),this.ta=Bi("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 ci(t&&t.concurrentRequestLimit),this.Fa=new yi,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 Hi(t){if(ji(t),3==t.G){var e=t.U++,n=Vr(t.F);qr(n,"SID",t.I),qr(n,"RID",e),qr(n,"TYPE","terminate"),Ki(t,n),(e=new _r(t,t.j,e,void 0)).K=2,e.v=Wr(Vr(n)),n=!1,be.navigator&&be.navigator.sendBeacon&&(n=be.navigator.sendBeacon(e.v.toString(),"")),!n&&be.Image&&((new Image).src=e.v,n=!0),n||(e.g=ss(e.l,null),e.g.da(e.v)),e.F=Date.now(),Dr(e)}rs(t)}function $i(t){t.g&&(Ji(t),t.g.cancel(),t.g=null)}function ji(t){$i(t),t.u&&(be.clearTimeout(t.u),t.u=null),Zi(t),t.h.cancel(),t.m&&("number"==typeof t.m&&be.clearTimeout(t.m),t.m=null)}function qi(t){ui(t.h)||t.m||(t.m=!0,Hn(t.Ja,t),t.C=0)}function Wi(t,e){var n;n=e?e.m:t.U++;var r=Vr(t.F);qr(r,"SID",t.I),qr(r,"RID",n),qr(r,"AID",t.T),Ki(t,r),t.o&&t.s&&zi(r,t.o,t.s),n=new _r(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Gi(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),fi(t.h,n),Cr(n,r,e)}function Ki(t,e){t.ia&&fn(t.ia,(function(t,n){qr(e,n,t)})),t.l&&Fr({},(function(t,n){qr(e,n,t)}))}function Gi(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Ae(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{vi(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 Qi(t){t.g||t.u||(t.Z=1,Hn(t.Ia,t),t.A=0)}function Yi(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=hr(Ae(t.Ia,t),es(t,t.A)),t.A++,!0)}function Ji(t){null!=t.B&&(be.clearTimeout(t.B),t.B=null)}function Xi(t){t.g=new _r(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Vr(t.sa);qr(e,"RID","rpc"),qr(e,"SID",t.I),qr(e,"CI",t.L?"0":"1"),qr(e,"AID",t.T),qr(e,"TYPE","xmlhttp"),Ki(t,e),t.o&&t.s&&zi(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Wr(Vr(e)),n.s=null,n.P=!0,Ar(n,t)}function Zi(t){null!=t.v&&(be.clearTimeout(t.v),t.v=null)}function ts(t,e){var n=null;if(t.g==e){Zi(t),Ji(t),t.g=null;var r=2}else{if(!di(t.h,e))return;n=e.D,pi(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;On(r=sr(),new ur(r,n)),qi(t)}else Qi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(hi(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=hr(Ae(t.Ja,t,e),es(t,t.C)),t.C++,0)))}(t,e)||2==r&&Yi(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:ns(t,5);break;case 4:ns(t,10);break;case 3:ns(t,6);break;default:ns(t,2)}}function es(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ns(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Ae(t.kb,t);n||(n=new Br("//www.google.com/images/cleardot.gif"),be.location&&"http"==be.location.protocol||Hr(n,"https"),Wr(n)),function(t,e){var n=new er;if(be.Image){var r=new Image;r.onload=Re(wi,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Re(wi,n,r,"TestLoadImage: error",!1,e),r.onabort=Re(wi,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Re(wi,n,r,"TestLoadImage: timeout",!1,e),be.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else lr(2);t.G=0,t.l&&t.l.va(e),rs(t),ji(t)}function rs(t){if(t.G=0,t.la=[],t.l){var e=gi(t.h);0==e.length&&0==t.i.length||(xe(t.la,e),xe(t.la,t.i),t.h.i.length=0,Oe(t.i),t.i.length=0),t.l.ua()}}function is(t,e,n){var r=n instanceof Br?Vr(n):new Br(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),$r(r,r.m);else{var i=be.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Br(null,void 0);r&&Hr(s,r),e&&(s.g=e),i&&$r(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&qr(r,n,e),qr(r,"VER",t.ma),Ki(t,r),r}function ss(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 Ci(new bi({jb:!0})):new Ci(t.ra)).Ka(t.H),e}function os(){}function as(){if(We&&!(10<=Number(on)))throw Error("Environmental error: no available transport.")}function cs(t,e){Dn.call(this),this.g=new Vi(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)&&!Ue(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Ue(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new hs(this)}function ls(t){wr.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 us(){br.call(this),this.status=1}function hs(t){this.g=t}(ye=Ci.prototype).Ka=function(t){this.L=t},ye.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():yr.g(),this.C=this.u?gr(this.u):gr(yr),this.g.onreadystatechange=Ae(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void Li(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=ge(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=be.FormData&&t instanceof be.FormData,!(0<=De(Ni,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ge(n),f=d.next();!f.done;f=d.next()){var p=me(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{Pi(this),0<this.B&&((this.K=function(t){return We&&rn()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Ae(this.qa,this)):this.A=Gn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){Li(this,h)}},ye.qa=function(){void 0!==we&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,On(this,"timeout"),this.abort(8))},ye.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,On(this,"complete"),On(this,"abort"),xi(this))},ye.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),xi(this,!0)),Ci.X.M.call(this)},ye.Ha=function(){this.s||(this.F||this.v||this.l?Oi(this):this.fb())},ye.fb=function(){Oi(this)},ye.aa=function(){try{return 2<Mi(this)?this.g.status:-1}catch(t){return-1}},ye.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},ye.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),ki(e)}},ye.Ea=function(){return this.m},ye.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(ye=Vi.prototype).ma=8,ye.G=1,ye.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 _r(this,this.j,t,void 0),n=this.s;if(this.S&&(n?mn(n=pn(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=Gi(this,e,r),qr(i=Vr(this.F),"RID",t),qr(i,"CVER",22),this.D&&qr(i,"X-HTTP-Session-Id",this.D),Ki(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Fi(n)))+"&"+r:this.o&&zi(i,this.o,n)),fi(this.h,e),this.Ya&&qr(i,"TYPE","init"),this.O?(qr(i,"$req",r),qr(i,"SID","null"),e.Z=!0,Cr(e,i,null)):Cr(e,i,r),this.G=2}}else 3==this.G&&(t?Wi(this,t):0==this.i.length||ui(this.h)||Wi(this))},ye.Ia=function(){if(this.u=null,Xi(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=hr(Ae(this.eb,this),t)}},ye.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,lr(10),$i(this),Xi(this))},ye.cb=function(){null!=this.v&&(this.v=null,$i(this),Yi(this),lr(19))},ye.kb=function(t){t?(this.j.info("Successfully pinged google.com"),lr(2)):(this.j.info("Failed to ping google.com"),lr(1))},(ye=os.prototype).xa=function(){},ye.wa=function(){},ye.va=function(){},ye.ua=function(){},ye.Ra=function(){},as.prototype.g=function(t,e){return new cs(t,e)},Ne(cs,Dn),cs.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;lr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=is(t,null,t.V),qi(t)},cs.prototype.close=function(){Hi(this.g)},cs.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Pn(t),t=n);e.i.push(new ai(e.ab++,t)),3==e.G&&qi(e)},cs.prototype.M=function(){this.g.l=null,delete this.j,Hi(this.g),delete this.g,cs.X.M.call(this)},Ne(ls,wr),Ne(us,br),Ne(hs,os),hs.prototype.xa=function(){On(this.g,"a")},hs.prototype.wa=function(t){On(this.g,new ls(t))},hs.prototype.va=function(t){On(this.g,new us)},hs.prototype.ua=function(){On(this.g,"b")},as.prototype.createWebChannel=as.prototype.g,cs.prototype.send=cs.prototype.u,cs.prototype.open=cs.prototype.m,cs.prototype.close=cs.prototype.close,dr.NO_ERROR=0,dr.TIMEOUT=8,dr.HTTP_ERROR=6,fr.COMPLETE="complete",mr.EventType=vr,vr.OPEN="a",vr.CLOSE="b",vr.ERROR="c",vr.MESSAGE="d",Dn.prototype.listen=Dn.prototype.N,Ci.prototype.listenOnce=Ci.prototype.O,Ci.prototype.getLastError=Ci.prototype.Oa,Ci.prototype.getLastErrorCode=Ci.prototype.Ea,Ci.prototype.getStatus=Ci.prototype.aa,Ci.prototype.getResponseJson=Ci.prototype.Sa,Ci.prototype.getResponseText=Ci.prototype.fa,Ci.prototype.send=Ci.prototype.da,Ci.prototype.setWithCredentials=Ci.prototype.Ka;var ds=dr,fs=fr,ps=rr,gs=10,ms=11,ys=bi,vs=mr,ws=Ci;const bs="@firebase/firestore";
|
|
401
401
|
/**
|
|
402
402
|
* @license
|
|
403
403
|
* Copyright 2017 Google LLC
|
|
@@ -413,7 +413,7 @@ const te=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
413
413
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
414
414
|
* See the License for the specific language governing permissions and
|
|
415
415
|
* limitations under the License.
|
|
416
|
-
*/class
|
|
416
|
+
*/class Ss{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}Ss.UNAUTHENTICATED=new Ss(null),Ss.GOOGLE_CREDENTIALS=new Ss("google-credentials-uid"),Ss.FIRST_PARTY=new Ss("first-party-uid"),Ss.MOCK_USER=new Ss("mock-user");
|
|
417
417
|
/**
|
|
418
418
|
* @license
|
|
419
419
|
* Copyright 2017 Google LLC
|
|
@@ -430,7 +430,7 @@ const te=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
430
430
|
* See the License for the specific language governing permissions and
|
|
431
431
|
* limitations under the License.
|
|
432
432
|
*/
|
|
433
|
-
let
|
|
433
|
+
let _s="9.15.0";
|
|
434
434
|
/**
|
|
435
435
|
* @license
|
|
436
436
|
* Copyright 2017 Google LLC
|
|
@@ -446,7 +446,7 @@ let Ss="9.15.0";
|
|
|
446
446
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
447
447
|
* See the License for the specific language governing permissions and
|
|
448
448
|
* limitations under the License.
|
|
449
|
-
*/const Es=new class{constructor(t){this.name=t,this._logLevel=he,this._logHandler=fe,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in le))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?ue[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,le.DEBUG,...t),this._logHandler(this,le.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,le.VERBOSE,...t),this._logHandler(this,le.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,le.INFO,...t),this._logHandler(this,le.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,le.WARN,...t),this._logHandler(this,le.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,le.ERROR,...t),this._logHandler(this,le.ERROR,...t)}}("@firebase/firestore");function Ts(){return Es.logLevel}function Is(t,...e){if(Es.logLevel<=le.DEBUG){const n=e.map(As);Es.debug(`Firestore (${
|
|
449
|
+
*/const Es=new class{constructor(t){this.name=t,this._logLevel=he,this._logHandler=fe,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in le))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?ue[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,le.DEBUG,...t),this._logHandler(this,le.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,le.VERBOSE,...t),this._logHandler(this,le.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,le.INFO,...t),this._logHandler(this,le.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,le.WARN,...t),this._logHandler(this,le.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,le.ERROR,...t),this._logHandler(this,le.ERROR,...t)}}("@firebase/firestore");function Ts(){return Es.logLevel}function Is(t,...e){if(Es.logLevel<=le.DEBUG){const n=e.map(As);Es.debug(`Firestore (${_s}): ${t}`,...n)}}function ks(t,...e){if(Es.logLevel<=le.ERROR){const n=e.map(As);Es.error(`Firestore (${_s}): ${t}`,...n)}}function Cs(t,...e){if(Es.logLevel<=le.WARN){const n=e.map(As);Es.warn(`Firestore (${_s}): ${t}`,...n)}}function As(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
|
|
450
450
|
/**
|
|
451
451
|
* @license
|
|
452
452
|
* Copyright 2020 Google LLC
|
|
@@ -478,7 +478,7 @@ let Ss="9.15.0";
|
|
|
478
478
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
479
479
|
* See the License for the specific language governing permissions and
|
|
480
480
|
* limitations under the License.
|
|
481
|
-
*/function Rs(t="Unexpected state"){const e=`FIRESTORE (${
|
|
481
|
+
*/function Rs(t="Unexpected state"){const e=`FIRESTORE (${_s}) INTERNAL ASSERTION FAILED: `+t;throw ks(e),new Error(e)}function Ns(t,e){t||Rs()}function Ls(t,e){return t}
|
|
482
482
|
/**
|
|
483
483
|
* @license
|
|
484
484
|
* Copyright 2017 Google LLC
|
|
@@ -526,7 +526,7 @@ let Ss="9.15.0";
|
|
|
526
526
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
527
527
|
* See the License for the specific language governing permissions and
|
|
528
528
|
* limitations under the License.
|
|
529
|
-
*/class Ps{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Ms{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(
|
|
529
|
+
*/class Ps{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Ms{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Ss.UNAUTHENTICATED)))}shutdown(){}}class Us{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class Fs{constructor(t){this.t=t,this.currentUser=Ss.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let i=new xs;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new xs,t.enqueueRetryable((()=>r(this.currentUser)))};const s=()=>{const e=i;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{Is("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),s()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Is("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new xs)}}),0),s()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(Is("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Ns("string"==typeof e.accessToken),new Ps(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return Ns(null===t||"string"==typeof t),new Ss(t)}}class zs{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=Ss.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Ns(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class Bs{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new zs(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Ss.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Vs{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Hs{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Is("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.A;return this.A=t.token,Is("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{Is("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):Is("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Ns("string"==typeof t.token),this.A=t.token,new Vs(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
|
|
530
530
|
/**
|
|
531
531
|
* @license
|
|
532
532
|
* Copyright 2020 Google LLC
|
|
@@ -768,7 +768,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
768
768
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
769
769
|
* See the License for the specific language governing permissions and
|
|
770
770
|
* limitations under the License.
|
|
771
|
-
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return qs(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}yo.EMPTY_BYTE_STRING=new yo("");const vo=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function wo(t){if(Ns(!!t),"string"==typeof t){let e=0;const n=vo.exec(t);if(Ns(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:bo(t.seconds),nanos:bo(t.nanos)}}function bo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function
|
|
771
|
+
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return qs(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}yo.EMPTY_BYTE_STRING=new yo("");const vo=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function wo(t){if(Ns(!!t),"string"==typeof t){let e=0;const n=vo.exec(t);if(Ns(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:bo(t.seconds),nanos:bo(t.nanos)}}function bo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function So(t){return"string"==typeof t?yo.fromBase64String(t):yo.fromUint8Array(t)}
|
|
772
772
|
/**
|
|
773
773
|
* @license
|
|
774
774
|
* Copyright 2020 Google LLC
|
|
@@ -784,7 +784,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
784
784
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
785
785
|
* See the License for the specific language governing permissions and
|
|
786
786
|
* limitations under the License.
|
|
787
|
-
*/function
|
|
787
|
+
*/function _o(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Eo(t){const e=t.mapValue.fields.__previous_value__;return _o(e)?Eo(e):e}function To(t){const e=wo(t.mapValue.fields.__local_write_time__.timestampValue);return new Ks(e.seconds,e.nanos)}
|
|
788
788
|
/**
|
|
789
789
|
* @license
|
|
790
790
|
* Copyright 2020 Google LLC
|
|
@@ -800,7 +800,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
800
800
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
801
801
|
* See the License for the specific language governing permissions and
|
|
802
802
|
* limitations under the License.
|
|
803
|
-
*/const Io={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function ko(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?
|
|
803
|
+
*/const Io={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function ko(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?_o(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
|
|
804
804
|
/**
|
|
805
805
|
* @license
|
|
806
806
|
* Copyright 2022 Google LLC
|
|
@@ -816,7 +816,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
816
816
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
817
817
|
* See the License for the specific language governing permissions and
|
|
818
818
|
* limitations under the License.
|
|
819
|
-
*/(t)?9007199254740991:10:Rs()}function Co(t,e){if(t===e)return!0;const n=ko(t);if(n!==ko(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return To(t).isEqual(To(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=wo(t.timestampValue),r=wo(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return
|
|
819
|
+
*/(t)?9007199254740991:10:Rs()}function Co(t,e){if(t===e)return!0;const n=ko(t);if(n!==ko(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return To(t).isEqual(To(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=wo(t.timestampValue),r=wo(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return So(t.bytesValue).isEqual(So(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return bo(t.geoPointValue.latitude)===bo(e.geoPointValue.latitude)&&bo(t.geoPointValue.longitude)===bo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return bo(t.integerValue)===bo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=bo(t.doubleValue),r=bo(e.doubleValue);return n===r?mo(n)===mo(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Ws(t.arrayValue.values||[],e.arrayValue.values||[],Co);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(ho(n)!==ho(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!Co(n[t],r[t])))return!1;return!0}(t,e);default:return Rs()}}function Ao(t,e){return void 0!==(t.values||[]).find((t=>Co(t,e)))}function Ro(t,e){if(t===e)return 0;const n=ko(t),r=ko(e);if(n!==r)return qs(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return qs(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=bo(t.integerValue||t.doubleValue),r=bo(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return No(t.timestampValue,e.timestampValue);case 4:return No(To(t),To(e));case 5:return qs(t.stringValue,e.stringValue);case 6:return function(t,e){const n=So(t),r=So(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=qs(n[t],r[t]);if(0!==e)return e}return qs(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=qs(bo(t.latitude),bo(e.latitude));return 0!==n?n:qs(bo(t.longitude),bo(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Ro(n[t],r[t]);if(e)return e}return qs(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Io.mapValue&&e===Io.mapValue)return 0;if(t===Io.mapValue)return 1;if(e===Io.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),i=e.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let t=0;t<r.length&&t<s.length;++t){const e=qs(r[t],s[t]);if(0!==e)return e;const o=Ro(n[r[t]],i[s[t]]);if(0!==o)return o}return qs(r.length,s.length)}(t.mapValue,e.mapValue);default:throw Rs()}}function No(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return qs(t,e);const n=wo(t),r=wo(e),i=qs(n.seconds,r.seconds);return 0!==i?i:qs(n.nanos,r.nanos)}function Lo(t){return Do(t)}function Do(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=wo(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?So(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,Zs.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=Do(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const i of e)r?r=!1:n+=",",n+=`${i}:${Do(t.fields[i])}`;return n+"}"}(t.mapValue):Rs();var e,n}function Oo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function xo(t){return!!t&&"integerValue"in t}function Po(t){return!!t&&"arrayValue"in t}function Mo(t){return!!t&&"nullValue"in t}function Uo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Fo(t){return!!t&&"mapValue"in t}function zo(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return fo(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=zo(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=zo(t.arrayValue.values[n]);return e}return Object.assign({},t)}class Bo{constructor(t,e){this.position=t,this.inclusive=e}}function Vo(t,e,n){let r=0;for(let i=0;i<t.position.length;i++){const s=e[i],o=t.position[i];if(r=s.field.isKeyField()?Zs.comparator(Zs.fromName(o.referenceValue),n.key):Ro(o,n.data.field(s.field)),"desc"===s.dir&&(r*=-1),0!==r)break}return r}function Ho(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!Co(t.position[n],e.position[n]))return!1;return!0}
|
|
820
820
|
/**
|
|
821
821
|
* @license
|
|
822
822
|
* Copyright 2022 Google LLC
|
|
@@ -961,7 +961,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
961
961
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
962
962
|
* See the License for the specific language governing permissions and
|
|
963
963
|
* limitations under the License.
|
|
964
|
-
*/class
|
|
964
|
+
*/class Sa{constructor(t,e=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function _a(t){return new Sa(t)}function Ea(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Ta(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Ia(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function ka(t){return null!==t.collectionGroup}function Ca(t){const e=Ls(t);if(null===e.dt){e.dt=[];const t=Ia(e),n=Ta(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new sa(t)),e.dt.push(new sa(Xs.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new sa(Xs.keyField(),t))}}}return e.dt}function Aa(t){const e=Ls(t);if(!e._t)if("F"===e.limitType)e._t=ya(e.path,e.collectionGroup,Ca(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Ca(e)){const e="desc"===n.dir?"asc":"desc";t.push(new sa(n.field,e))}const n=e.endAt?new Bo(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Bo(e.startAt.position,e.startAt.inclusive):null;e._t=ya(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function Ra(t,e){e.getFirstInequalityField(),Ia(t);const n=t.filters.concat([e]);return new Sa(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Na(t,e,n){return new Sa(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function La(t,e){return wa(Aa(t),Aa(e))&&t.limitType===e.limitType}function Da(t){return`${va(Aa(t))}|lt:${t.limitType}`}function Oa(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>Yo(t))).join(", ")}]`),go(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>Lo(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Lo(t))).join(",")),`Target(${e})`}(Aa(t))}; limitType=${t.limitType})`}function xa(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):Zs.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Ca(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=Vo(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Ca(t),e))&&!(t.endAt&&!function(t,e,n){const r=Vo(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Ca(t),e))}(t,e)}function Pa(t){return(e,n)=>{let r=!1;for(const i of Ca(t)){const t=Ma(i,e,n);if(0!==t)return t;r=r||i.field.isKeyField()}return 0}}function Ma(t,e,n){const r=t.field.isKeyField()?Zs.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),i=n.data.field(t);return null!==r&&null!==i?Ro(r,i):Rs()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Rs()}}
|
|
965
965
|
/**
|
|
966
966
|
* @license
|
|
967
967
|
* Copyright 2020 Google LLC
|
|
@@ -1058,7 +1058,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1058
1058
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1059
1059
|
* See the License for the specific language governing permissions and
|
|
1060
1060
|
* limitations under the License.
|
|
1061
|
-
*/const wc=new aa(Zs.comparator);function bc(){return wc}const
|
|
1061
|
+
*/const wc=new aa(Zs.comparator);function bc(){return wc}const Sc=new aa(Zs.comparator);function _c(...t){let e=Sc;for(const n of t)e=e.insert(n.key,n);return e}function Ec(t){let e=Sc;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Tc(){return kc()}function Ic(){return kc()}function kc(){return new vc((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Cc=new aa(Zs.comparator),Ac=new ua(Zs.comparator);function Rc(...t){let e=Ac;for(const n of t)e=e.add(n);return e}const Nc=new ua(qs);function Lc(){return Nc}
|
|
1062
1062
|
/**
|
|
1063
1063
|
* @license
|
|
1064
1064
|
* Copyright 2017 Google LLC
|
|
@@ -1106,7 +1106,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1106
1106
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1107
1107
|
* See the License for the specific language governing permissions and
|
|
1108
1108
|
* limitations under the License.
|
|
1109
|
-
*/const Vc={asc:"ASCENDING",desc:"DESCENDING"},Hc={"<":"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"},$c={and:"AND",or:"OR"};class jc{constructor(t,e){this.databaseId=t,this.wt=e}}function qc(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 Wc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Kc(t,e){return qc(t,e.toTimestamp())}function Gc(t){return Ns(!!t),Gs.fromTimestamp(function(t){const e=wo(t);return new Ks(e.seconds,e.nanos)}(t))}function Qc(t,e){return function(t){return new Ys(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Yc(t){const e=Ys.fromString(t);return Ns(pl(e)),e}function Jc(t,e){return Qc(t.databaseId,e.path)}function Xc(t,e){const n=Yc(e);if(n.get(1)!==t.databaseId.projectId)throw new Os(Ds.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 Os(Ds.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Zs(el(n))}function Zc(t,e){return Qc(t.databaseId,e)}function tl(t){return new Ys(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function el(t){return Ns(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function nl(t,e,n){return{name:Jc(t,e),fields:n.value.mapValue.fields}}function rl(t,e){return{documents:[Zc(t,e.path)]}}function il(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Zc(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Zc(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const i=function(t){if(0!==t.length)return dl(qo.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:ul(t.field),direction:al(t.dir)}}(t)))}(e.orderBy);s&&(n.structuredQuery.orderBy=s);const o=function(t,e){return t.wt||go(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 sl(t){let e=function(t){const e=Yc(t);return 4===e.length?Ys.emptyPath():el(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Ns(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=ol(t);return e instanceof qo&&Ko(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new sa(hl(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,go(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new Bo(n,e)}(n.startAt));let l=null;return n.endAt&&(l=function(t){const e=!t.before,n=t.values||[];return new Bo(n,e)}(n.endAt)),function(t,e,n,r,i,s,o,a){return new
|
|
1109
|
+
*/const Vc={asc:"ASCENDING",desc:"DESCENDING"},Hc={"<":"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"},$c={and:"AND",or:"OR"};class jc{constructor(t,e){this.databaseId=t,this.wt=e}}function qc(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 Wc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Kc(t,e){return qc(t,e.toTimestamp())}function Gc(t){return Ns(!!t),Gs.fromTimestamp(function(t){const e=wo(t);return new Ks(e.seconds,e.nanos)}(t))}function Qc(t,e){return function(t){return new Ys(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Yc(t){const e=Ys.fromString(t);return Ns(pl(e)),e}function Jc(t,e){return Qc(t.databaseId,e.path)}function Xc(t,e){const n=Yc(e);if(n.get(1)!==t.databaseId.projectId)throw new Os(Ds.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 Os(Ds.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Zs(el(n))}function Zc(t,e){return Qc(t.databaseId,e)}function tl(t){return new Ys(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function el(t){return Ns(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function nl(t,e,n){return{name:Jc(t,e),fields:n.value.mapValue.fields}}function rl(t,e){return{documents:[Zc(t,e.path)]}}function il(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Zc(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Zc(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const i=function(t){if(0!==t.length)return dl(qo.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:ul(t.field),direction:al(t.dir)}}(t)))}(e.orderBy);s&&(n.structuredQuery.orderBy=s);const o=function(t,e){return t.wt||go(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 sl(t){let e=function(t){const e=Yc(t);return 4===e.length?Ys.emptyPath():el(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Ns(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=ol(t);return e instanceof qo&&Ko(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new sa(hl(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,go(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new Bo(n,e)}(n.startAt));let l=null;return n.endAt&&(l=function(t){const e=!t.before,n=t.values||[];return new Bo(n,e)}(n.endAt)),function(t,e,n,r,i,s,o,a){return new Sa(t,e,n,r,i,s,o,a)}(e,i,o,s,a,"F",c,l)}function ol(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=hl(t.unaryFilter.field);return jo.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=hl(t.unaryFilter.field);return jo.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=hl(t.unaryFilter.field);return jo.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=hl(t.unaryFilter.field);return jo.create(i,"!=",{nullValue:"NULL_VALUE"});default:return Rs()}}(t):void 0!==t.fieldFilter?function(t){return jo.create(hl(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 Rs()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return qo.create(t.compositeFilter.filters.map((t=>ol(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Rs()}}(t.compositeFilter.op))}(t):Rs()}function al(t){return Vc[t]}function cl(t){return Hc[t]}function ll(t){return $c[t]}function ul(t){return{fieldPath:t.canonicalString()}}function hl(t){return Xs.fromServerFormat(t.fieldPath)}function dl(t){return t instanceof jo?function(t){if("=="===t.op){if(Uo(t.value))return{unaryFilter:{field:ul(t.field),op:"IS_NAN"}};if(Mo(t.value))return{unaryFilter:{field:ul(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Uo(t.value))return{unaryFilter:{field:ul(t.field),op:"IS_NOT_NAN"}};if(Mo(t.value))return{unaryFilter:{field:ul(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ul(t.field),op:cl(t.op),value:t.value}}}(t):t instanceof qo?function(t){const e=t.getFilters().map((t=>dl(t)));return 1===e.length?e[0]:{compositeFilter:{op:ll(t.op),filters:e}}}(t):Rs()}function fl(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function pl(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
|
|
1110
1110
|
/**
|
|
1111
1111
|
* @license
|
|
1112
1112
|
* Copyright 2017 Google LLC
|
|
@@ -1186,7 +1186,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1186
1186
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1187
1187
|
* See the License for the specific language governing permissions and
|
|
1188
1188
|
* limitations under the License.
|
|
1189
|
-
*/class
|
|
1189
|
+
*/class Sl{constructor(){this.Je=new _l}addToCollectionParentIndex(t,e){return this.Je.add(e),oo.resolve()}getCollectionParents(t,e){return oo.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return oo.resolve()}deleteFieldIndex(t,e){return oo.resolve()}getDocumentsMatchingTarget(t,e){return oo.resolve(null)}getIndexType(t,e){return oo.resolve(0)}getFieldIndexes(t,e){return oo.resolve([])}getNextCollectionGroupToUpdate(t){return oo.resolve(null)}getMinOffset(t,e){return oo.resolve(eo.min())}getMinOffsetFromCollectionGroup(t,e){return oo.resolve(eo.min())}updateCollectionGroup(t,e,n){return oo.resolve()}updateIndexEntries(t,e){return oo.resolve()}}class _l{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new ua(Ys.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 ua(Ys.comparator)).toArray()}}
|
|
1190
1190
|
/**
|
|
1191
1191
|
* @license
|
|
1192
1192
|
* Copyright 2017 Google LLC
|
|
@@ -1266,7 +1266,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1266
1266
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1267
1267
|
* See the License for the specific language governing permissions and
|
|
1268
1268
|
* limitations under the License.
|
|
1269
|
-
*/class kl{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&&ic(n.mutation,t,da.empty(),Ks.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Rc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Rc()){const r=Tc();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=
|
|
1269
|
+
*/class kl{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&&ic(n.mutation,t,da.empty(),Ks.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Rc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Rc()){const r=Tc();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=_c();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Tc();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Rc())))}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=bc();const s=kc(),o=kc();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof cc)?i=i.insert(e.key,e):void 0!==o&&(s.set(e.key,o.mutation.getFieldMask()),ic(o.mutation,e,o.mutation.getFieldMask(),Ks.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 Il(e,null!==(n=s.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=kc();let r=new aa(((t,e)=>t-e)),i=Rc();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)||da.empty();o=i.applyToLocalView(s,o),n.set(t,o);const a=(r.get(i.batchId)||Rc()).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=Ic();c.forEach((t=>{if(!i.has(t)){const r=nc(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 oo.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 Zs.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):ka(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):oo.resolve(Tc());let o=-1,a=i;return s.next((e=>oo.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(e)?oo.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,Rc()))).next((t=>({batchId:o,changes:Ec(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new Zs(e)).next((t=>{let e=_c();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let i=_c();return this.indexManager.getCollectionParents(t,r).next((s=>oo.forEach(s,(s=>{const o=function(t,e){return new Sa(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,ga.newInvalidDocument(n)))}));let n=_c();return r.forEach(((r,i)=>{const s=t.get(r);void 0!==s&&ic(s.mutation,i,da.empty(),Ks.now()),xa(e,i)&&(n=n.insert(r,i))})),n}))}}
|
|
1270
1270
|
/**
|
|
1271
1271
|
* @license
|
|
1272
1272
|
* Copyright 2020 Google LLC
|
|
@@ -1378,7 +1378,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1378
1378
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1379
1379
|
* See the License for the specific language governing permissions and
|
|
1380
1380
|
* limitations under the License.
|
|
1381
|
-
*/class Pl{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new co(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new xl(this),this.indexManager=new
|
|
1381
|
+
*/class Pl{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new co(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new xl(this),this.indexManager=new Sl,this.remoteDocumentCache=function(t){return new Dl(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new wl(e),this.Ns=new Cl(this.yt)}start(){return Promise.resolve()}shutdown(){return this.Ds=!1,Promise.resolve()}get started(){return this.Ds}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Al,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Ll(e,this.referenceDelegate),this.Vs[t.toKey()]=n),n}getTargetCache(){return this.Cs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ns}runTransaction(t,e,n){Is("MemoryPersistence","Starting transaction:",t);const r=new Ml(this.Ss.next());return this.referenceDelegate.ks(),n(r).next((t=>this.referenceDelegate.Os(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Ms(t,e){return oo.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Ml extends io{constructor(t){super(),this.currentSequenceNumber=t}}class Ul{constructor(t){this.persistence=t,this.Fs=new Rl,this.$s=null}static Bs(t){return new Ul(t)}get Ls(){if(this.$s)return this.$s;throw Rs()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),oo.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),oo.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),oo.resolve()}removeTarget(t,e){this.Fs.ls(e.targetId).forEach((t=>this.Ls.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.Ls.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}ks(){this.$s=new Set}Os(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return oo.forEach(this.Ls,(n=>{const r=Zs.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,Gs.min())}))})).next((()=>(this.$s=null,e.apply(t))))}updateLimboDocument(t,e){return this.qs(t,e).next((t=>{t?this.Ls.delete(e.toString()):this.Ls.add(e.toString())}))}xs(t){return 0}qs(t,e){return oo.or([()=>oo.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
|
|
1382
1382
|
/**
|
|
1383
1383
|
* @license
|
|
1384
1384
|
* Copyright 2017 Google LLC
|
|
@@ -1506,7 +1506,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1506
1506
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1507
1507
|
* See the License for the specific language governing permissions and
|
|
1508
1508
|
* limitations under the License.
|
|
1509
|
-
*/class Zl extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,r,i){const s=this.ho(t,e);Is("RestConnection","Sending: ",s,n);const o={};return this.lo(o,r,i),this.fo(t,s,o,n).then((t=>(Is("RestConnection","Received: ",t),t)),(e=>{throw Cs("RestConnection",`${t} failed with error: `,e,"url: ",s,"request:",n),e}))}_o(t,e,n,r,i,s){return this.ao(t,e,n,r,i)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+
|
|
1509
|
+
*/class Zl extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,r,i){const s=this.ho(t,e);Is("RestConnection","Sending: ",s,n);const o={};return this.lo(o,r,i),this.fo(t,s,o,n).then((t=>(Is("RestConnection","Received: ",t),t)),(e=>{throw Cs("RestConnection",`${t} failed with error: `,e,"url: ",s,"request:",n),e}))}_o(t,e,n,r,i,s){return this.ao(t,e,n,r,i)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+_s,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}ho(t,e){const n=Jl[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,r){return new Promise(((i,s)=>{const o=new ws;o.setWithCredentials(!0),o.listenOnce(fs.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case ds.NO_ERROR:const e=o.getResponseJson();Is("Connection","XHR received:",JSON.stringify(e)),i(e);break;case ds.TIMEOUT:Is("Connection",'RPC "'+t+'" timed out'),s(new Os(Ds.DEADLINE_EXCEEDED,"Request time out"));break;case ds.HTTP_ERROR:const n=o.getStatus();if(Is("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let t=o.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Ds).indexOf(e)>=0?e:Ds.UNKNOWN}(e.status);s(new Os(t,e.message))}else s(new Os(Ds.UNKNOWN,"Server responded with status "+o.getStatus()))}else s(new Os(Ds.UNAVAILABLE,"Connection failed."));break;default:Rs()}}finally{Is("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=new as,s=sr(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new ys({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Is("Connection","Creating WebChannel: "+a,o);const c=i.createWebChannel(a,o);let l=!1,u=!1;const h=new Xl({Hr:t=>{u?Is("Connection","Not sending because WebChannel is closed:",t):(l||(Is("Connection","Opening WebChannel transport."),c.open(),l=!0),Is("Connection","WebChannel sending:",t),c.send(t))},Jr:()=>c.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(c,vs.EventType.OPEN,(()=>{u||Is("Connection","WebChannel transport opened.")})),d(c,vs.EventType.CLOSE,(()=>{u||(u=!0,Is("Connection","WebChannel transport closed"),h.io())})),d(c,vs.EventType.ERROR,(t=>{u||(u=!0,Cs("Connection","WebChannel transport errored:",t),h.io(new Os(Ds.UNAVAILABLE,"The operation could not be completed")))})),d(c,vs.EventType.MESSAGE,(t=>{var e;if(!u){const n=t.data[0];Ns(!!n);const r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){Is("Connection","WebChannel received error:",i);const t=i.status;let e=function(t){const e=gc[t];if(void 0!==e)return yc(e)}(t),n=i.message;void 0===e&&(e=Ds.INTERNAL,n="Unknown error status: "+t+" with message "+i.message),u=!0,h.io(new Os(e,n)),c.close()}else Is("Connection","WebChannel received:",n),h.ro(n)}})),d(s,ps.STAT_EVENT,(t=>{t.stat===gs?Is("Connection","Detected buffering proxy"):t.stat===ms&&Is("Connection","Detected no buffering proxy")})),setTimeout((()=>{h.so()}),0),h}}function tu(){return"undefined"!=typeof document?document:null}
|
|
1510
1510
|
/**
|
|
1511
1511
|
* @license
|
|
1512
1512
|
* Copyright 2020 Google LLC
|
|
@@ -1570,7 +1570,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1570
1570
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1571
1571
|
* See the License for the specific language governing permissions and
|
|
1572
1572
|
* limitations under the License.
|
|
1573
|
-
*/class cu{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()=>{yu(this)&&(Is("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Ls(t);e._u.add(4),await uu(e),e.gu.set("Unknown"),e._u.delete(4),await lu(e)}(this))}))})),this.gu=new au(n,r)}}async function lu(t){if(yu(t))for(const e of t.wu)await e(!0)}async function uu(t){for(const e of t.wu)await e(!1)}function hu(t,e){const n=Ls(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),mu(n)?gu(n):xu(n).ko()&&fu(n,e))}function du(t,e){const n=Ls(t),r=xu(n);n.du.delete(e),r.ko()&&pu(n,e),0===n.du.size&&(r.ko()?r.Fo():yu(n)&&n.gu.set("Unknown"))}function fu(t,e){t.yu.Ot(e.targetId),xu(t).zo(e)}function pu(t,e){t.yu.Ot(e),xu(t).Ho(e)}function gu(t){t.yu=new Fc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),xu(t).start(),t.gu.uu()}function mu(t){return yu(t)&&!xu(t).No()&&t.du.size>0}function yu(t){return 0===Ls(t)._u.size}function vu(t){t.yu=void 0}async function wu(t){t.du.forEach(((e,n)=>{fu(t,e)}))}async function bu(t,e){vu(t),mu(t)?(t.gu.hu(e),gu(t)):t.gu.set("Unknown")}async function
|
|
1573
|
+
*/class cu{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()=>{yu(this)&&(Is("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Ls(t);e._u.add(4),await uu(e),e.gu.set("Unknown"),e._u.delete(4),await lu(e)}(this))}))})),this.gu=new au(n,r)}}async function lu(t){if(yu(t))for(const e of t.wu)await e(!0)}async function uu(t){for(const e of t.wu)await e(!1)}function hu(t,e){const n=Ls(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),mu(n)?gu(n):xu(n).ko()&&fu(n,e))}function du(t,e){const n=Ls(t),r=xu(n);n.du.delete(e),r.ko()&&pu(n,e),0===n.du.size&&(r.ko()?r.Fo():yu(n)&&n.gu.set("Unknown"))}function fu(t,e){t.yu.Ot(e.targetId),xu(t).zo(e)}function pu(t,e){t.yu.Ot(e),xu(t).Ho(e)}function gu(t){t.yu=new Fc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),xu(t).start(),t.gu.uu()}function mu(t){return yu(t)&&!xu(t).No()&&t.du.size>0}function yu(t){return 0===Ls(t)._u.size}function vu(t){t.yu=void 0}async function wu(t){t.du.forEach(((e,n)=>{fu(t,e)}))}async function bu(t,e){vu(t),mu(t)?(t.gu.hu(e),gu(t)):t.gu.set("Unknown")}async function Su(t,e,n){if(t.gu.set("Online"),e instanceof Mc&&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){Is("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await _u(t,n)}else if(e instanceof xc?t.yu.Kt(e):e instanceof Pc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Gs.min()))try{const e=await Hl(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(yo.EMPTY_BYTE_STRING,n.snapshotVersion)),pu(t,e);const r=new vl(n.target,e,1,n.sequenceNumber);fu(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Is("RemoteStore","Failed to raise snapshot:",e),await _u(t,e)}}async function _u(t,e,n){if(!ao(e))throw e;t._u.add(1),await uu(t),t.gu.set("Offline"),n||(n=()=>Hl(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Is("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await lu(t)}))}function Eu(t,e){return e().catch((n=>_u(t,n,e)))}async function Tu(t){const e=Ls(t),n=Pu(e);let r=e.fu.length>0?e.fu[e.fu.length-1].batchId:-1;for(;Iu(e);)try{const t=await jl(e.localStore,r);if(null===t){0===e.fu.length&&n.Fo();break}r=t.batchId,ku(e,t)}catch(t){await _u(e,t)}Cu(e)&&Au(e)}function Iu(t){return yu(t)&&t.fu.length<10}function ku(t,e){t.fu.push(e);const n=Pu(t);n.ko()&&n.Yo&&n.Xo(e.mutations)}function Cu(t){return yu(t)&&!Pu(t).No()&&t.fu.length>0}function Au(t){Pu(t).start()}async function Ru(t){Pu(t).eu()}async function Nu(t){const e=Pu(t);for(const n of t.fu)e.Xo(n.mutations)}async function Lu(t,e,n){const r=t.fu.shift(),i=ml.from(r,e,n);await Eu(t,(()=>t.remoteSyncer.applySuccessfulWrite(i))),await Tu(t)}async function Du(t,e){e&&Pu(t).Yo&&await async function(t,e){if(function(t){switch(t){default:return Rs();case Ds.CANCELLED:case Ds.UNKNOWN:case Ds.DEADLINE_EXCEEDED:case Ds.RESOURCE_EXHAUSTED:case Ds.INTERNAL:case Ds.UNAVAILABLE:case Ds.UNAUTHENTICATED:return!1;case Ds.INVALID_ARGUMENT:case Ds.NOT_FOUND:case Ds.ALREADY_EXISTS:case Ds.PERMISSION_DENIED:case Ds.FAILED_PRECONDITION:case Ds.ABORTED:case Ds.OUT_OF_RANGE:case Ds.UNIMPLEMENTED:case Ds.DATA_LOSS:return!0}}(n=e.code)&&n!==Ds.ABORTED){const n=t.fu.shift();Pu(t).Mo(),await Eu(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Tu(t)}var n}(t,e),Cu(t)&&Au(t)}async function Ou(t,e){const n=Ls(t);n.asyncQueue.verifyOperationInProgress(),Is("RemoteStore","RemoteStore received new credentials");const r=yu(n);n._u.add(3),await uu(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await lu(n)}function xu(t){return t.pu||(t.pu=function(t,e,n){const r=Ls(t);return r.su(),new iu(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
|
|
1574
1574
|
/**
|
|
1575
1575
|
* @license
|
|
1576
1576
|
* Copyright 2018 Google LLC
|
|
@@ -1586,7 +1586,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1586
1586
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1587
1587
|
* See the License for the specific language governing permissions and
|
|
1588
1588
|
* limitations under the License.
|
|
1589
|
-
*/}(t.datastore,t.asyncQueue,{Yr:wu.bind(null,t),Zr:bu.bind(null,t),Wo:
|
|
1589
|
+
*/}(t.datastore,t.asyncQueue,{Yr:wu.bind(null,t),Zr:bu.bind(null,t),Wo:Su.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),mu(t)?gu(t):t.gu.set("Unknown")):(await t.pu.stop(),vu(t))}))),t.pu}function Pu(t){return t.Iu||(t.Iu=function(t,e,n){const r=Ls(t);return r.su(),new su(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)}(t.datastore,t.asyncQueue,{Yr:Ru.bind(null,t),Zr:Du.bind(null,t),tu:Nu.bind(null,t),Zo:Lu.bind(null,t)}),t.wu.push((async e=>{e?(t.Iu.Mo(),await Tu(t)):(await t.Iu.stop(),t.fu.length>0&&(Is("RemoteStore",`Stopping write stream with ${t.fu.length} pending writes`),t.fu=[]))}))),t.Iu
|
|
1590
1590
|
/**
|
|
1591
1591
|
* @license
|
|
1592
1592
|
* Copyright 2017 Google LLC
|
|
@@ -1618,7 +1618,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1618
1618
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1619
1619
|
* See the License for the specific language governing permissions and
|
|
1620
1620
|
* limitations under the License.
|
|
1621
|
-
*/class Fu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||Zs.comparator(e.key,n.key):(t,e)=>Zs.comparator(t.key,e.key),this.keyedMap=
|
|
1621
|
+
*/class Fu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||Zs.comparator(e.key,n.key):(t,e)=>Zs.comparator(t.key,e.key),this.keyedMap=_c(),this.sortedSet=new aa(this.comparator)}static emptySet(t){return new Fu(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Fu))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new Fu;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
|
|
1622
1622
|
/**
|
|
1623
1623
|
* @license
|
|
1624
1624
|
* Copyright 2017 Google LLC
|
|
@@ -1682,7 +1682,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1682
1682
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1683
1683
|
* See the License for the specific language governing permissions and
|
|
1684
1684
|
* limitations under the License.
|
|
1685
|
-
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const s=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==i.length||a?{snapshot:new Bu(this.query,t.Qu,r,i,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:s}:{Xu:s}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new zu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Rc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Yu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Qu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Rc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Bu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Xu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class Zu{constructor(t){this.key=t,this.nc=!1}}class th{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new vc((t=>Da(t)),La),this.rc=new Map,this.oc=new Set,this.uc=new aa(Zs.comparator),this.cc=new Map,this.ac=new Rl,this.hc={},this.lc=new Map,this.fc=El.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function eh(t,e){const n=function(t){const e=Ls(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ih.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=vh.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=oh.bind(null,e),e.sc.Wo=qu.bind(null,e.eventManager),e.sc.wc=Wu.bind(null,e.eventManager),e}(t);let r,i;const s=n.ic.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.ec();else{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((i=>i?(r=i,oo.resolve(r)):n.Cs.allocateTargetId(t).next((i=>(r=new vl(e,i,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Aa(e));n.isPrimaryClient&&hu(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r,i){t._c=(e,n,r)=>async function(t,e,n,r){let i=e.view.Wu(n);i.$i&&(i=await Wl(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return fh(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const s=await Wl(t.localStore,e,!0),o=new Ju(e,s.Hi),a=o.Wu(s.documents),c=Oc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,i),l=o.applyChanges(a,t.isPrimaryClient,c);fh(t,n,l.Xu);const u=new Xu(e,n,o);return t.ic.set(e,u),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),l.snapshot}(n,e,r,"current"===s,t.resumeToken)}return i}async function nh(t,e){const n=Ls(t),r=n.ic.get(e),i=n.rc.get(r.targetId);if(i.length>1)return n.rc.set(r.targetId,i.filter((t=>!La(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await ql(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),du(n.remoteStore,r.targetId),hh(n,r.targetId)})).catch(so)):(hh(n,r.targetId),await ql(n.localStore,r.targetId,!0))}async function rh(t,e,n){const r=function(t){const e=Ls(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ah.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=ch.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ls(t),r=Ks.now(),i=e.reduce(((t,e)=>t.add(e.key)),Rc());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=bc(),c=Rc();return n.Gi.getEntries(t,i).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((i=>{s=i;const o=[];for(const t of e){const e=sc(t,s.get(t.key).overlayedDocument);null!=e&&o.push(new cc(t.key,e,pa(e.value.mapValue),Za.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:Ec(s)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new aa(qs)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await mh(r,t.changes),await Tu(r.remoteStore)}catch(t){const e=Uu(t,"Failed to persist write");n.reject(e)}}async function ih(t,e){const n=Ls(t);try{const t=await $l(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Ns(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Ns(r.nc):t.removedDocuments.size>0&&(Ns(r.nc),r.nc=!1))})),await mh(n,t,e)}catch(t){await so(t)}}function sh(t,e,n){const r=Ls(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const i=r.view.bu(e);i.snapshot&&t.push(i.snapshot)})),function(t,e){const n=Ls(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Ku(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function oh(t,e,n){const r=Ls(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.cc.get(e),s=i&&i.key;if(s){let t=new aa(Zs.comparator);t=t.insert(s,ga.newNoDocument(s,Gs.min()));const n=Rc().add(s),i=new Dc(Gs.min(),new Map,new ua(qs),t,n);await ih(r,i),r.uc=r.uc.remove(s),r.cc.delete(e),gh(r)}else await ql(r.localStore,e,!1).then((()=>hh(r,e,n))).catch(so)}async function ah(t,e){const n=Ls(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),i=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const i=n.batch,s=i.keys();let o=oo.resolve();return s.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const s=n.docVersions.get(t);Ns(null!==s),e.version.compareTo(s)<0&&(i.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,i)))}(n,t,e,i).next((()=>i.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Rc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);uh(n,r,null),lh(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await mh(n,t)}catch(t){await so(t)}}async function ch(t,e,n){const r=Ls(t);try{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Ns(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);uh(r,e,n),lh(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await mh(r,t)}catch(n){await so(n)}}function lh(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function uh(t,e,n){const r=Ls(t);let i=r.hc[r.currentUser.toKey()];if(i){const t=i.get(e);t&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.hc[r.currentUser.toKey()]=i}}function hh(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||dh(t,e)}))}function dh(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(du(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),gh(t))}function fh(t,e,n){for(const r of n)r instanceof Qu?(t.ac.addReference(r.key,e),ph(t,r)):r instanceof Yu?(Is("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||dh(t,r.key)):Rs()}function ph(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Is("SyncEngine","New document in limbo: "+n),t.oc.add(r),gh(t))}function gh(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new Zs(Ys.fromString(e)),r=t.fc.next();t.cc.set(r,new Zu(n)),t.uc=t.uc.insert(n,r),hu(t.remoteStore,new vl(Aa(Sa(n.path)),r,2,co.at))}}async function mh(t,e,n){const r=Ls(t),i=[],s=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);const e=Fl.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),r.sc.Wo(i),await async function(t,e){const n=Ls(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>oo.forEach(e,(e=>oo.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>oo.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!ao(t))throw t;Is("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,i)}}}(r.localStore,s))}async function yh(t,e){const n=Ls(t);if(!n.currentUser.isEqual(e)){Is("SyncEngine","User change. New user:",e.toKey());const t=await Vl(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Os(Ds.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await mh(n,t.ji)}}function vh(t,e){const n=Ls(t),r=n.cc.get(e);if(r&&r.nc)return Rc().add(r.key);{let t=Rc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class wh{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=eu(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new Bl(t,e,n,r)}(this.persistence,new zl,t.initialUser,this.yt)}yc(t){return new Pl(Ul.Bs,this.yt)}gc(t){return new Gl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class bh{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>sh(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=yh.bind(null,this.syncEngine),await async function(t,e){const n=Ls(t);e?(n._u.delete(2),await lu(n)):e||(n._u.add(2),await uu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Hu}createDatastore(t){const e=eu(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new Zl(r));var r;return function(t,e,n,r){return new ou(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,i=t=>sh(this.syncEngine,t,0),s=Yl.C()?new Yl:new Ql,new cu(e,n,r,i,s);var e,n,r,i,s}createSyncEngine(t,e){return function(t,e,n,r,i,s,o){const a=new th(t,e,n,r,i,s);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Ls(t);Is("RemoteStore","RemoteStore shutting down."),e._u.add(5),await uu(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1685
|
+
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const s=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==i.length||a?{snapshot:new Bu(this.query,t.Qu,r,i,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:s}:{Xu:s}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new zu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Rc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Yu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Qu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Rc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Bu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Xu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class Zu{constructor(t){this.key=t,this.nc=!1}}class th{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new vc((t=>Da(t)),La),this.rc=new Map,this.oc=new Set,this.uc=new aa(Zs.comparator),this.cc=new Map,this.ac=new Rl,this.hc={},this.lc=new Map,this.fc=El.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function eh(t,e){const n=function(t){const e=Ls(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ih.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=vh.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=oh.bind(null,e),e.sc.Wo=qu.bind(null,e.eventManager),e.sc.wc=Wu.bind(null,e.eventManager),e}(t);let r,i;const s=n.ic.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.ec();else{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((i=>i?(r=i,oo.resolve(r)):n.Cs.allocateTargetId(t).next((i=>(r=new vl(e,i,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Aa(e));n.isPrimaryClient&&hu(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r,i){t._c=(e,n,r)=>async function(t,e,n,r){let i=e.view.Wu(n);i.$i&&(i=await Wl(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return fh(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const s=await Wl(t.localStore,e,!0),o=new Ju(e,s.Hi),a=o.Wu(s.documents),c=Oc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,i),l=o.applyChanges(a,t.isPrimaryClient,c);fh(t,n,l.Xu);const u=new Xu(e,n,o);return t.ic.set(e,u),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),l.snapshot}(n,e,r,"current"===s,t.resumeToken)}return i}async function nh(t,e){const n=Ls(t),r=n.ic.get(e),i=n.rc.get(r.targetId);if(i.length>1)return n.rc.set(r.targetId,i.filter((t=>!La(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await ql(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),du(n.remoteStore,r.targetId),hh(n,r.targetId)})).catch(so)):(hh(n,r.targetId),await ql(n.localStore,r.targetId,!0))}async function rh(t,e,n){const r=function(t){const e=Ls(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ah.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=ch.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ls(t),r=Ks.now(),i=e.reduce(((t,e)=>t.add(e.key)),Rc());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=bc(),c=Rc();return n.Gi.getEntries(t,i).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((i=>{s=i;const o=[];for(const t of e){const e=sc(t,s.get(t.key).overlayedDocument);null!=e&&o.push(new cc(t.key,e,pa(e.value.mapValue),Za.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:Ec(s)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new aa(qs)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await mh(r,t.changes),await Tu(r.remoteStore)}catch(t){const e=Uu(t,"Failed to persist write");n.reject(e)}}async function ih(t,e){const n=Ls(t);try{const t=await $l(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Ns(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Ns(r.nc):t.removedDocuments.size>0&&(Ns(r.nc),r.nc=!1))})),await mh(n,t,e)}catch(t){await so(t)}}function sh(t,e,n){const r=Ls(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const i=r.view.bu(e);i.snapshot&&t.push(i.snapshot)})),function(t,e){const n=Ls(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Ku(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function oh(t,e,n){const r=Ls(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.cc.get(e),s=i&&i.key;if(s){let t=new aa(Zs.comparator);t=t.insert(s,ga.newNoDocument(s,Gs.min()));const n=Rc().add(s),i=new Dc(Gs.min(),new Map,new ua(qs),t,n);await ih(r,i),r.uc=r.uc.remove(s),r.cc.delete(e),gh(r)}else await ql(r.localStore,e,!1).then((()=>hh(r,e,n))).catch(so)}async function ah(t,e){const n=Ls(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),i=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const i=n.batch,s=i.keys();let o=oo.resolve();return s.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const s=n.docVersions.get(t);Ns(null!==s),e.version.compareTo(s)<0&&(i.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,i)))}(n,t,e,i).next((()=>i.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Rc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);uh(n,r,null),lh(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await mh(n,t)}catch(t){await so(t)}}async function ch(t,e,n){const r=Ls(t);try{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Ns(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);uh(r,e,n),lh(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await mh(r,t)}catch(n){await so(n)}}function lh(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function uh(t,e,n){const r=Ls(t);let i=r.hc[r.currentUser.toKey()];if(i){const t=i.get(e);t&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.hc[r.currentUser.toKey()]=i}}function hh(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||dh(t,e)}))}function dh(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(du(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),gh(t))}function fh(t,e,n){for(const r of n)r instanceof Qu?(t.ac.addReference(r.key,e),ph(t,r)):r instanceof Yu?(Is("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||dh(t,r.key)):Rs()}function ph(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Is("SyncEngine","New document in limbo: "+n),t.oc.add(r),gh(t))}function gh(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new Zs(Ys.fromString(e)),r=t.fc.next();t.cc.set(r,new Zu(n)),t.uc=t.uc.insert(n,r),hu(t.remoteStore,new vl(Aa(_a(n.path)),r,2,co.at))}}async function mh(t,e,n){const r=Ls(t),i=[],s=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);const e=Fl.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),r.sc.Wo(i),await async function(t,e){const n=Ls(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>oo.forEach(e,(e=>oo.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>oo.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!ao(t))throw t;Is("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,i)}}}(r.localStore,s))}async function yh(t,e){const n=Ls(t);if(!n.currentUser.isEqual(e)){Is("SyncEngine","User change. New user:",e.toKey());const t=await Vl(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Os(Ds.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await mh(n,t.ji)}}function vh(t,e){const n=Ls(t),r=n.cc.get(e);if(r&&r.nc)return Rc().add(r.key);{let t=Rc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class wh{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=eu(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new Bl(t,e,n,r)}(this.persistence,new zl,t.initialUser,this.yt)}yc(t){return new Pl(Ul.Bs,this.yt)}gc(t){return new Gl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class bh{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>sh(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=yh.bind(null,this.syncEngine),await async function(t,e){const n=Ls(t);e?(n._u.delete(2),await lu(n)):e||(n._u.add(2),await uu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Hu}createDatastore(t){const e=eu(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new Zl(r));var r;return function(t,e,n,r){return new ou(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,i=t=>sh(this.syncEngine,t,0),s=Yl.C()?new Yl:new Ql,new cu(e,n,r,i,s);var e,n,r,i,s}createSyncEngine(t,e){return function(t,e,n,r,i,s,o){const a=new th(t,e,n,r,i,s);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Ls(t);Is("RemoteStore","RemoteStore shutting down."),e._u.add(5),await uu(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1686
1686
|
/**
|
|
1687
1687
|
* @license
|
|
1688
1688
|
* Copyright 2017 Google LLC
|
|
@@ -1698,7 +1698,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1698
1698
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1699
1699
|
* See the License for the specific language governing permissions and
|
|
1700
1700
|
* limitations under the License.
|
|
1701
|
-
*/function
|
|
1701
|
+
*/function Sh(t,e,n){if(!n)throw new Os(Ds.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function _h(t){if(!Zs.isDocumentKey(t))throw new Os(Ds.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Eh(t){if(Zs.isDocumentKey(t))throw new Os(Ds.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Th(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Rs()}function Ih(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Os(Ds.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Th(t);throw new Os(Ds.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
|
|
1702
1702
|
/**
|
|
1703
1703
|
* @license
|
|
1704
1704
|
* Copyright 2020 Google LLC
|
|
@@ -1730,7 +1730,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1730
1730
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1731
1731
|
* See the License for the specific language governing permissions and
|
|
1732
1732
|
* limitations under the License.
|
|
1733
|
-
*/class Ah{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Ch({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Os(Ds.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Os(Ds.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Ch(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Ms;switch(t.type){case"gapi":const e=t.client;return new Bs(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Os(Ds.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=kh.get(t);e&&(Is("ComponentProvider","Removing Datastore"),kh.delete(t),e.terminate())}(this),Promise.resolve()}}function Rh(t,e,n,r={}){var i;const s=(t=Ih(t,Ah))._getSettings();if("firestore.googleapis.com"!==s.host&&s.host!==e&&Cs("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},s),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=
|
|
1733
|
+
*/class Ah{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Ch({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Os(Ds.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Os(Ds.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Ch(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Ms;switch(t.type){case"gapi":const e=t.client;return new Bs(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Os(Ds.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=kh.get(t);e&&(Is("ComponentProvider","Removing Datastore"),kh.delete(t),e.terminate())}(this),Promise.resolve()}}function Rh(t,e,n,r={}){var i;const s=(t=Ih(t,Ah))._getSettings();if("firestore.googleapis.com"!==s.host&&s.host!==e&&Cs("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},s),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=Ss.MOCK_USER;else{e=
|
|
1734
1734
|
/**
|
|
1735
1735
|
* @license
|
|
1736
1736
|
* Copyright 2021 Google LLC
|
|
@@ -1763,7 +1763,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1763
1763
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1764
1764
|
* See the License for the specific language governing permissions and
|
|
1765
1765
|
* limitations under the License.
|
|
1766
|
-
*/(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new Os(Ds.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new
|
|
1766
|
+
*/(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new Os(Ds.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Ss(s)}t._authCredentials=new Us(new Ps(e,n))}}
|
|
1767
1767
|
/**
|
|
1768
1768
|
* @license
|
|
1769
1769
|
* Copyright 2020 Google LLC
|
|
@@ -1779,7 +1779,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1779
1779
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1780
1780
|
* See the License for the specific language governing permissions and
|
|
1781
1781
|
* limitations under the License.
|
|
1782
|
-
*/class Nh{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 Dh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Nh(this.firestore,t,this._key)}}class Lh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Lh(this.firestore,t,this._query)}}class Dh extends Lh{constructor(t,e,n){super(t,e,
|
|
1782
|
+
*/class Nh{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 Dh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Nh(this.firestore,t,this._key)}}class Lh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Lh(this.firestore,t,this._query)}}class Dh extends Lh{constructor(t,e,n){super(t,e,_a(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 Nh(this.firestore,null,new Zs(t))}withConverter(t){return new Dh(this.firestore,t,this._path)}}function Oh(t,e,...n){if(t=ae(t),Sh("collection","path",e),t instanceof Ah){const r=Ys.fromString(e,...n);return Eh(r),new Dh(t,null,r)}{if(!(t instanceof Nh||t instanceof Dh))throw new Os(Ds.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ys.fromString(e,...n));return Eh(r),new Dh(t.firestore,null,r)}}function xh(t,e,...n){if(t=ae(t),1===arguments.length&&(e=js.R()),Sh("doc","path",e),t instanceof Ah){const r=Ys.fromString(e,...n);return _h(r),new Nh(t,null,new Zs(r))}{if(!(t instanceof Nh||t instanceof Dh))throw new Os(Ds.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ys.fromString(e,...n));return _h(r),new Nh(t.firestore,t instanceof Dh?t.converter:null,new Zs(r))}}
|
|
1783
1783
|
/**
|
|
1784
1784
|
* @license
|
|
1785
1785
|
* Copyright 2020 Google LLC
|
|
@@ -1827,7 +1827,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1827
1827
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1828
1828
|
* See the License for the specific language governing permissions and
|
|
1829
1829
|
* limitations under the License.
|
|
1830
|
-
*/class Mh{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=
|
|
1830
|
+
*/class Mh{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=Ss.UNAUTHENTICATED,this.clientId=js.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Is("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Is("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Os(Ds.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new xs;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=Uu(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function Uh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Is("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Is("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await Vl(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new wh)),t.offlineComponents}(t);Is("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>Ou(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>Ou(e.remoteStore,n))),t.onlineComponents=e}async function Fh(t){return t.onlineComponents||(Is("FirestoreClient","Using default OnlineComponentProvider"),await Uh(t,new bh)),t.onlineComponents}async function zh(t){const e=await Fh(t),n=e.eventManager;return n.onListen=eh.bind(null,e.syncEngine),n.onUnlisten=nh.bind(null,e.syncEngine),n}class Bh{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new nu(this,"async_queue_retry"),this.Wc=()=>{const t=tu();t&&Is("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=tu();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.zc(),this.Hc(t)}enterRestrictedMode(t){if(!this.qc){this.qc=!0,this.Qc=t||!1;const e=tu();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new xs;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!ao(t))throw t;Is("AsyncQueue","Operation failed with retryable error: "+t)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(t){const e=this.Bc.then((()=>(this.Gc=!0,t().catch((t=>{this.Kc=t,this.Gc=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}
|
|
1831
1831
|
/**
|
|
1832
1832
|
* @license
|
|
1833
1833
|
* Copyright 2017 Google LLC
|
|
@@ -2020,7 +2020,7 @@ class Kh{constructor(t){this._methodName=t}}
|
|
|
2020
2020
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2021
2021
|
* See the License for the specific language governing permissions and
|
|
2022
2022
|
* limitations under the License.
|
|
2023
|
-
*/(r);for(const e of r)t=e._apply(t);return t}class vd extends md{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new vd(t,e,n)}_apply(t){const e=this._parse(t);return Ed(t._query,e),new Lh(t.firestore,t.converter,Ra(t._query,e))}_parse(t){const e=td(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 Os(Ds.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){
|
|
2023
|
+
*/(r);for(const e of r)t=e._apply(t);return t}class vd extends md{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new vd(t,e,n)}_apply(t){const e=this._parse(t);return Ed(t._query,e),new Lh(t.firestore,t.converter,Ra(t._query,e))}_parse(t){const e=td(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 Os(Ds.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){_d(o,s);const e=[];for(const n of o)e.push(Sd(r,t,n));a={arrayValue:{values:e}}}else a=Sd(r,t,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||_d(o,s),a=function(t,e,n,r=!1){return nd(n,t.da(r?4:3,e))}(n,"where",o,"in"===s||"not-in"===s);return jo.create(i,s,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function wd(t,e,n){const r=e,i=fd("where",t);return vd._create(i,r,n)}class bd extends gd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new bd(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]:qo.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)Ed(n,t),n=Ra(n,t)}(t._query,e),new Lh(t.firestore,t.converter,Ra(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Sd(t,e,n){if("string"==typeof(n=ae(n))){if(""===n)throw new Os(Ds.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ka(e)&&-1!==n.indexOf("/"))throw new Os(Ds.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(Ys.fromString(n));if(!Zs.isDocumentKey(r))throw new Os(Ds.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 Oo(t,new Zs(r))}if(n instanceof Nh)return Oo(t,n._key);throw new Os(Ds.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Th(n)}.`)}function _d(t,e){if(!Array.isArray(t)||0===t.length)throw new Os(Ds.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Os(Ds.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Ed(t,e){if(e.isInequality()){const n=Ia(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Os(Ds.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=Ta(t);null!==i&&function(t,e,n){if(!n.isEqual(e))throw new Os(Ds.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 Os(Ds.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Os(Ds.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Td{convertValue(t,e="none"){switch(ko(t)){case 0:return null;case 1:return t.booleanValue;case 2:return bo(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(So(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 Rs()}}convertObject(t,e){const n={};return fo(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Gh(bo(t.latitude),bo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Eo(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(To(t));default:return null}}convertTimestamp(t){const e=wo(t);return new Ks(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Ys.fromString(t);Ns(pl(n));const r=new uo(n.get(1),n.get(3)),i=new Zs(n.popFirst(5));return r.isEqual(e)||ks(`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}}
|
|
2024
2024
|
/**
|
|
2025
2025
|
* @license
|
|
2026
2026
|
* Copyright 2020 Google LLC
|
|
@@ -2069,7 +2069,7 @@ class Id{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
|
|
|
2069
2069
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2070
2070
|
* See the License for the specific language governing permissions and
|
|
2071
2071
|
* limitations under the License.
|
|
2072
|
-
*/function Nd(t){t=Ih(t,Nh);const e=Ih(t.firestore,Hh);return function(t,e,n={}){const r=new xs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new Ph({next:s=>{e.enqueueAndForget((()=>ju(t,o)));const a=s.docs.has(n);!a&&s.fromCache?i.reject(new Os(Ds.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&r&&"server"===r.source?i.reject(new Os(Ds.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 Gu(
|
|
2072
|
+
*/function Nd(t){t=Ih(t,Nh);const e=Ih(t.firestore,Hh);return function(t,e,n={}){const r=new xs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new Ph({next:s=>{e.enqueueAndForget((()=>ju(t,o)));const a=s.docs.has(n);!a&&s.fromCache?i.reject(new Os(Ds.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&r&&"server"===r.source?i.reject(new Os(Ds.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 Gu(_a(n.path),s,{includeMetadataChanges:!0,Nu:!0});return $u(t,o)}(await zh(t),t.asyncQueue,e,n,r))),r.promise}($h(e),t._key).then((n=>Pd(e,t,n)))}class Ld extends Td{constructor(t){super(),this.firestore=t}convertBytes(t){return new qh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Nh(this.firestore,null,e)}}function Dd(t){t=Ih(t,Lh);const e=Ih(t.firestore,Hh),n=$h(e),r=new Ld(e);return pd(t._query),function(t,e,n={}){const r=new xs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new Ph({next:n=>{e.enqueueAndForget((()=>ju(t,o))),n.fromCache&&"server"===r.source?i.reject(new Os(Ds.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 Gu(n,s,{includeMetadataChanges:!0,Nu:!0});return $u(t,o)}(await zh(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Ad(e,r,t,n)))}function Od(t,e,n){t=Ih(t,Nh);const r=Ih(t.firestore,Hh),i=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new xs;return t.asyncQueue.enqueueAndForget((async()=>rh(await function(t){return Fh(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}($h(t),e)}(r,[ed(td(r),"setDoc",t._key,i,null!==t.converter,n).toMutation(t._key,Za.none())])}function xd(t,...e){var n,r,i;t=ae(t);let s={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||Vh(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges};if(Vh(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 Nh)l=Ih(t.firestore,Hh),u=_a(t._key.path),c={next:n=>{e[o]&&e[o](Pd(l,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Ih(t,Lh);l=Ih(n.firestore,Hh),u=n._query;const r=new Ld(l);c={next:t=>{e[o]&&e[o](new Ad(l,r,n,t))},error:e[o+1],complete:e[o+2]},pd(t._query)}return function(t,e,n,r){const i=new Ph(r),s=new Gu(e,i,n);return t.asyncQueue.enqueueAndForget((async()=>$u(await zh(t),s))),()=>{i.bc(),t.asyncQueue.enqueueAndForget((async()=>ju(await zh(t),s)))}}($h(l),u,a,c)}function Pd(t,e,n){const r=n.docs.get(e._key),i=new Ld(t);return new kd(t,i,e._key,r,new Id(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){_s=Pt,Lt(new ce("firestore",((t,{instanceIdentifier:n,options:r})=>{const i=t.getProvider("app").getImmediate(),s=new Hh(new Fs(t.getProvider("auth-internal")),new Hs(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Os(Ds.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new uo(t.options.projectId,e)}(i,n),i);return r=Object.assign({useFetchStreams:e},r),s._setSettings(r),s}),"PUBLIC").setMultipleInstances(!0)),Ft(bs,"3.8.0",t),Ft(bs,"3.8.0","esm2017")}();
|
|
2073
2073
|
/**
|
|
2074
2074
|
* @license
|
|
2075
2075
|
* Copyright 2020 Google LLC
|
|
@@ -2102,7 +2102,7 @@ Ft("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){retur
|
|
|
2102
2102
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2103
2103
|
* See the License for the specific language governing permissions and
|
|
2104
2104
|
* limitations under the License.
|
|
2105
|
-
*/function
|
|
2105
|
+
*/function Sf(t,...e){throw Ef(t,...e)}function _f(t,...e){return Ef(t,...e)}function Ef(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return yf.create(t,...e)}function Tf(t,e,...n){if(!t)throw Ef(e,...n)}function If(t){const e="INTERNAL ASSERTION FAILED: "+t;throw bf(e),new Error(e)}function kf(t,e){t||If(e)}
|
|
2106
2106
|
/**
|
|
2107
2107
|
* @license
|
|
2108
2108
|
* Copyright 2020 Google LLC
|
|
@@ -2215,7 +2215,7 @@ class Nf{constructor(t,e){this.shortDelay=t,this.longDelay=e,kf(e>t,"Short delay
|
|
|
2215
2215
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2216
2216
|
* See the License for the specific language governing permissions and
|
|
2217
2217
|
* limitations under the License.
|
|
2218
|
-
*/function Pf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Mf(t,e,n,r,i={}){return Uf(t,i,(async()=>{let i={},s={};r&&("GET"===e?s=r:i={body:JSON.stringify(r)});const o=w(Object.assign({key:t.config.apiKey},s)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Df.fetch()(zf(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},i))}))}async function Uf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Of),e);try{const e=new Bf(t),i=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await i.json();if("needConfirmation"in s)throw Vf(t,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{const e=i.ok?s.errorMessage:s.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Vf(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Vf(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Vf(t,"user-disabled",s);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(t,e,n){const r=Object.assign(Object.assign({},mf()),{[e]:n});return new g("auth","Firebase",r).create(e,{appName:t.name})}(t,a,o);
|
|
2218
|
+
*/function Pf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Mf(t,e,n,r,i={}){return Uf(t,i,(async()=>{let i={},s={};r&&("GET"===e?s=r:i={body:JSON.stringify(r)});const o=w(Object.assign({key:t.config.apiKey},s)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Df.fetch()(zf(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},i))}))}async function Uf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Of),e);try{const e=new Bf(t),i=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await i.json();if("needConfirmation"in s)throw Vf(t,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{const e=i.ok?s.errorMessage:s.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Vf(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Vf(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Vf(t,"user-disabled",s);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(t,e,n){const r=Object.assign(Object.assign({},mf()),{[e]:n});return new g("auth","Firebase",r).create(e,{appName:t.name})}(t,a,o);Sf(t,a)}}catch(e){if(e instanceof p)throw e;Sf(t,"network-request-failed",{message:String(e)})}}async function Ff(t,e,n,r,i={}){const s=await Mf(t,e,n,r,i);return"mfaPendingCredential"in s&&Sf(t,"multi-factor-auth-required",{_serverResponse:s}),s}function zf(t,e,n,r){const i=`${e}${n}?${r}`;return t.config.emulator?Lf(t.config,i):`${t.config.apiScheme}://${i}`}class Bf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(_f(this.auth,"network-request-failed"))),xf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Vf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=_f(t,e,r);return i.customData._tokenResponse=n,i}
|
|
2219
2219
|
/**
|
|
2220
2220
|
* @license
|
|
2221
2221
|
* Copyright 2020 Google LLC
|
|
@@ -2362,7 +2362,7 @@ class Qf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2362
2362
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2363
2363
|
* See the License for the specific language governing permissions and
|
|
2364
2364
|
* limitations under the License.
|
|
2365
|
-
*/function Yf(t,e){Tf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Jf{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,i=pf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Wf(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 Kf(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(t){const e=await qf(this,this.stsTokenManager.getToken(this.auth,t));return Tf(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=jf(r);Tf(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:Hf($f(i.auth_time)),issuedAtTime:Hf($f(i.iat)),expirationTime:Hf($f(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 Gf(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Tf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new Jf(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Tf(!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 Gf(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await qf(this,async function(t,e){return Mf(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:
|
|
2365
|
+
*/function Yf(t,e){Tf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Jf{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,i=pf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Wf(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 Kf(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(t){const e=await qf(this,this.stsTokenManager.getToken(this.auth,t));return Tf(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=jf(r);Tf(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:Hf($f(i.auth_time)),issuedAtTime:Hf($f(i.iat)),expirationTime:Hf($f(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 Gf(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Tf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new Jf(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Tf(!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 Gf(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await qf(this,async function(t,e){return Mf(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;Tf(v&&_,t,"internal-error");const E=Qf.fromJSON(this.name,_);Tf("string"==typeof v,t,"internal-error"),Yf(u,t.name),Yf(h,t.name),Tf("boolean"==typeof w,t,"internal-error"),Tf("boolean"==typeof b,t,"internal-error"),Yf(d,t.name),Yf(f,t.name),Yf(p,t.name),Yf(g,t.name),Yf(m,t.name),Yf(y,t.name);const T=new Jf({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 Qf;r.updateFromServerResponse(e);const i=new Jf({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await Gf(i),i}}
|
|
2366
2366
|
/**
|
|
2367
2367
|
* @license
|
|
2368
2368
|
* Copyright 2020 Google LLC
|
|
@@ -2459,7 +2459,7 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2459
2459
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2460
2460
|
* See the License for the specific language governing permissions and
|
|
2461
2461
|
* limitations under the License.
|
|
2462
|
-
*/function wp(t){return new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=
|
|
2462
|
+
*/function wp(t){return new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=_f("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)}))}class bp{constructor(t){this.type="recaptcha-enterprise",this.auth=Tp(t)}async verify(t="verify",e=!1){function n(e,n,r){const i=window.grecaptcha;yp(i)?i.enterprise.ready((()=>{i.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,r)=>{(async function(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{mp(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new vp(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))})(this.auth).then((i=>{if(!e&&yp(window.grecaptcha))n(i,t,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));wp("https://www.google.com/recaptcha/enterprise.js?render="+i).then((()=>{n(i,t,r)})).catch((t=>{r(t)}))}})).catch((t=>{r(t)}))}))}}async function Sp(t,e,n,r=!1){const i=new bp(t);let s;try{s=await i.verify(n)}catch(t){s=await i.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}
|
|
2463
2463
|
/**
|
|
2464
2464
|
* @license
|
|
2465
2465
|
* Copyright 2022 Google LLC
|
|
@@ -2475,7 +2475,7 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2475
2475
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2476
2476
|
* See the License for the specific language governing permissions and
|
|
2477
2477
|
* limitations under the License.
|
|
2478
|
-
*/class
|
|
2478
|
+
*/class _p{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
|
|
2479
2479
|
/**
|
|
2480
2480
|
* @license
|
|
2481
2481
|
* Copyright 2020 Google LLC
|
|
@@ -2491,7 +2491,7 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2491
2491
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2492
2492
|
* See the License for the specific language governing permissions and
|
|
2493
2493
|
* limitations under the License.
|
|
2494
|
-
*/class Ep{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ip(this),this.idTokenSubscription=new Ip(this),this.beforeStateQueue=new
|
|
2494
|
+
*/class Ep{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ip(this),this.idTokenSubscription=new Ip(this),this.beforeStateQueue=new _p(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=yf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Zf(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await rp.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 Tf(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 Gf(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&&Tf(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&&Tf(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(Zf(t))}))}async initializeRecaptchaConfig(){const t=await mp(this,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),e=new vp(t);if(null==this.tenantId?this._agentRecaptchaConfig=e:this._tenantRecaptchaConfigs[this.tenantId]=e,e.emailPasswordEnabled){new bp(this).verify()}}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}_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&&Zf(t)||this._popupRedirectResolver;Tf(e,this,"argument-error"),this.redirectPersistenceManager=await rp.create(this,[Zf(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 Tf(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 Tf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=gp(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){wf.logLevel<=R.WARN&&wf.warn(`Auth (${Pt}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Tp(t){return T(t)}class Ip{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 Tf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
|
|
2495
2495
|
/**
|
|
2496
2496
|
* @license
|
|
2497
2497
|
* Copyright 2020 Google LLC
|
|
@@ -2589,7 +2589,7 @@ async function Np(t,e){return Ff(t,"POST","/v1/accounts:signInWithPassword",Pf(t
|
|
|
2589
2589
|
* See the License for the specific language governing permissions and
|
|
2590
2590
|
* limitations under the License.
|
|
2591
2591
|
*/
|
|
2592
|
-
class Dp extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new Dp(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new Dp(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){var e;switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(null===(e=t._getRecaptchaConfig())||void 0===e?void 0:e.emailPasswordEnabled){const e=await
|
|
2592
|
+
class Dp extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new Dp(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new Dp(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){var e;switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(null===(e=t._getRecaptchaConfig())||void 0===e?void 0:e.emailPasswordEnabled){const e=await Sp(t,n,"signInWithPassword");return Np(t,e)}return Np(t,n).catch((async e=>{if("auth/missing-recaptcha-token"===e.code){console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");const e=await Sp(t,n,"signInWithPassword");return Np(t,e)}return Promise.reject(e)}));case"emailLink":return async function(t,e){return Ff(t,"POST","/v1/accounts:signInWithEmailLink",Pf(t,e))}(t,{email:this._email,oobCode:this._password});default:Sf(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return async function(t,e){return Mf(t,"POST","/v1/accounts:update",e)}(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return Ff(t,"POST","/v1/accounts:signInWithEmailLink",Pf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:Sf(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
|
|
2593
2593
|
/**
|
|
2594
2594
|
* @license
|
|
2595
2595
|
* Copyright 2020 Google LLC
|
|
@@ -2621,7 +2621,7 @@ class Dp extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,
|
|
|
2621
2621
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2622
2622
|
* See the License for the specific language governing permissions and
|
|
2623
2623
|
* limitations under the License.
|
|
2624
|
-
*/class xp extends Rp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new xp(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):
|
|
2624
|
+
*/class xp extends Rp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new xp(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):Sf("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=pf(e,["providerId","signInMethod"]);if(!n||!r)return null;const s=new xp(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 Op(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Op(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Op(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}}
|
|
2625
2625
|
/**
|
|
2626
2626
|
* @license
|
|
2627
2627
|
* Copyright 2020 Google LLC
|
|
@@ -2637,7 +2637,7 @@ class Dp extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,
|
|
|
2637
2637
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2638
2638
|
* See the License for the specific language governing permissions and
|
|
2639
2639
|
* limitations under the License.
|
|
2640
|
-
*/class Pp{constructor(t){var e,n,r,i,s,o;const a=b(
|
|
2640
|
+
*/class Pp{constructor(t){var e,n,r,i,s,o;const a=b(S(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,l=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);Tf(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(i=a.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(s=a.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=b(S(t)).link,n=e?b(S(e)).deep_link_id:null,r=b(S(t)).deep_link_id;return(r?b(S(r)).link:null)||r||n||e||t}(t);try{return new Pp(e)}catch(t){return null}}}
|
|
2641
2641
|
/**
|
|
2642
2642
|
* @license
|
|
2643
2643
|
* Copyright 2020 Google LLC
|
|
@@ -3034,7 +3034,7 @@ class vg extends Rp{constructor(t){super("custom","custom"),this.params=t}_getId
|
|
|
3034
3034
|
* See the License for the specific language governing permissions and
|
|
3035
3035
|
* limitations under the License.
|
|
3036
3036
|
*/
|
|
3037
|
-
async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await qf(t,Wp(r,i,e,t),n);Tf(s.idToken,r,"internal-error");const o=jf(s.idToken);Tf(o,r,"internal-error");const{sub:a}=o;return Tf(t.uid===a,r,"user-mismatch"),$p._forOperation(t,i,s)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&
|
|
3037
|
+
async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await qf(t,Wp(r,i,e,t),n);Tf(s.idToken,r,"internal-error");const o=jf(s.idToken);Tf(o,r,"internal-error");const{sub:a}=o;return Tf(t.uid===a,r,"user-mismatch"),$p._forOperation(t,i,s)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&Sf(r,"user-mismatch"),t}}(n,new vg(t),t.bypassAuthState)}async function Sg(t){const{auth:e,user:n}=t;return Tf(n,e,"internal-error"),async function(t,e,n=!1){const r=await qf(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return $p._forOperation(t,"link",r)}(n,new vg(t),t.bypassAuthState)}
|
|
3038
3038
|
/**
|
|
3039
3039
|
* @license
|
|
3040
3040
|
* Copyright 2020 Google LLC
|
|
@@ -3050,7 +3050,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await qf
|
|
|
3050
3050
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3051
3051
|
* See the License for the specific language governing permissions and
|
|
3052
3052
|
* limitations under the License.
|
|
3053
|
-
*/class
|
|
3053
|
+
*/class _g{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 wg;case"linkViaPopup":case"linkViaRedirect":return Sg;case"reauthViaPopup":case"reauthViaRedirect":return bg;default:Sf(this.auth,"internal-error")}}resolve(t){kf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){kf(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()}}
|
|
3054
3054
|
/**
|
|
3055
3055
|
* @license
|
|
3056
3056
|
* Copyright 2020 Google LLC
|
|
@@ -3066,7 +3066,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await qf
|
|
|
3066
3066
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3067
3067
|
* See the License for the specific language governing permissions and
|
|
3068
3068
|
* limitations under the License.
|
|
3069
|
-
*/const Eg=new Nf(2e3,1e4);class Tg extends
|
|
3069
|
+
*/const Eg=new Nf(2e3,1e4);class Tg extends _g{constructor(t,e,n,r,i){super(t,e,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Tg.currentPopupAction&&Tg.currentPopupAction.cancel(),Tg.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Tf(t,this.auth,"internal-error"),t}async onExecution(){kf(1===this.filter.length,"Popup operations only handle one event");const t=ig();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(_f(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(_f(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Tg.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(_f(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Eg.get())};t()}}Tg.currentPopupAction=null;
|
|
3070
3070
|
/**
|
|
3071
3071
|
* @license
|
|
3072
3072
|
* Copyright 2020 Google LLC
|
|
@@ -3083,7 +3083,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await qf
|
|
|
3083
3083
|
* See the License for the specific language governing permissions and
|
|
3084
3084
|
* limitations under the License.
|
|
3085
3085
|
*/
|
|
3086
|
-
const Ig="pendingRedirect",kg=new Map;class Cg extends
|
|
3086
|
+
const Ig="pendingRedirect",kg=new Map;class Cg extends _g{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=kg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return np(Ig,t.config.apiKey,t.name)}(e),r=function(t){return Zf(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const i="true"===await r._get(n);return await r._remove(n),i}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}kg.set(this.auth._key(),t)}return this.bypassAuthState||kg.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Ag(t,e){kg.set(t._key(),e)}async function Rg(t,e,n=!1){const r=Tp(t),i=
|
|
3087
3087
|
/**
|
|
3088
3088
|
* @license
|
|
3089
3089
|
* Copyright 2021 Google LLC
|
|
@@ -3132,7 +3132,7 @@ function(t,e){return e?Zf(e):(Tf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3132
3132
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3133
3133
|
* See the License for the specific language governing permissions and
|
|
3134
3134
|
* limitations under the License.
|
|
3135
|
-
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Dg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(
|
|
3135
|
+
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Dg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(_f(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Lg(t))}saveEventToCache(t){this.cachedEventUids.add(Lg(t)),this.lastProcessedEventTime=Date.now()}}function Lg(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Dg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
|
|
3136
3136
|
/**
|
|
3137
3137
|
* @license
|
|
3138
3138
|
* Copyright 2020 Google LLC
|
|
@@ -3149,7 +3149,7 @@ function(t,e){return e?Zf(e):(Tf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3149
3149
|
* See the License for the specific language governing permissions and
|
|
3150
3150
|
* limitations under the License.
|
|
3151
3151
|
*/
|
|
3152
|
-
const Og=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,xg=/^https?/;async function Pg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Mf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Mg(t))return}catch(t){}
|
|
3152
|
+
const Og=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,xg=/^https?/;async function Pg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Mf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Mg(t))return}catch(t){}Sf(t,"unauthorized-domain")}function Mg(t){const e=Cf(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const i=new URL(t);return""===i.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!xg.test(n))return!1;if(Og.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}
|
|
3153
3153
|
/**
|
|
3154
3154
|
* @license
|
|
3155
3155
|
* Copyright 2020 Google LLC.
|
|
@@ -3165,7 +3165,7 @@ const Og=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,xg=/^https?/;async function Pg(t
|
|
|
3165
3165
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3166
3166
|
* See the License for the specific language governing permissions and
|
|
3167
3167
|
* limitations under the License.
|
|
3168
|
-
*/const Ug=new Nf(3e4,6e4);function Fg(){const t=og().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function zg(t){return new Promise(((e,n)=>{var r,i,s;function o(){Fg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Fg(),n(
|
|
3168
|
+
*/const Ug=new Nf(3e4,6e4);function Fg(){const t=og().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function zg(t){return new Promise(((e,n)=>{var r,i,s;function o(){Fg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Fg(),n(_f(t,"network-request-failed"))},timeout:Ug.get()})}if(null===(i=null===(r=og().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)e(gapi.iframes.getContext());else{if(!(null===(s=og().gapi)||void 0===s?void 0:s.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return og()[e]=()=>{gapi.load?o():n(_f(t,"network-request-failed"))},wp(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Bg=null,t}))}let Bg=null;
|
|
3169
3169
|
/**
|
|
3170
3170
|
* @license
|
|
3171
3171
|
* Copyright 2020 Google LLC.
|
|
@@ -3182,7 +3182,7 @@ const Og=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,xg=/^https?/;async function Pg(t
|
|
|
3182
3182
|
* See the License for the specific language governing permissions and
|
|
3183
3183
|
* limitations under the License.
|
|
3184
3184
|
*/
|
|
3185
|
-
const Vg=new Nf(5e3,15e3),Hg="__/auth/iframe",$g="emulator/auth/iframe",jg={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},qg=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Wg(t){const e=t.config;Tf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Lf(e,$g):`https://${t.config.authDomain}/${Hg}`,r={apiKey:e.apiKey,appName:t.name,v:Pt},i=qg.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${w(r).slice(1)}`}async function Kg(t){const e=await function(t){return Bg=Bg||zg(t),Bg}(t),n=og().gapi;return Tf(n,t,"internal-error"),e.open({where:document.body,url:Wg(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:jg,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const i=
|
|
3185
|
+
const Vg=new Nf(5e3,15e3),Hg="__/auth/iframe",$g="emulator/auth/iframe",jg={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},qg=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Wg(t){const e=t.config;Tf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Lf(e,$g):`https://${t.config.authDomain}/${Hg}`,r={apiKey:e.apiKey,appName:t.name,v:Pt},i=qg.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${w(r).slice(1)}`}async function Kg(t){const e=await function(t){return Bg=Bg||zg(t),Bg}(t),n=og().gapi;return Tf(n,t,"internal-error"),e.open({where:document.body,url:Wg(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:jg,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const i=_f(t,"network-request-failed"),s=og().setTimeout((()=>{r(i)}),Vg.get());function o(){og().clearTimeout(s),n(e)}e.ping(o).then(o,(()=>{r(i)}))}))))}
|
|
3186
3186
|
/**
|
|
3187
3187
|
* @license
|
|
3188
3188
|
* Copyright 2020 Google LLC.
|
|
@@ -3230,7 +3230,7 @@ const Vg=new Nf(5e3,15e3),Hg="__/auth/iframe",$g="emulator/auth/iframe",jg={styl
|
|
|
3230
3230
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3231
3231
|
* See the License for the specific language governing permissions and
|
|
3232
3232
|
* limitations under the License.
|
|
3233
|
-
*/(t)}?${w(a).slice(1)}${l}`}const em="webStorageSupport";const nm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=ng,this._completeRedirectFn=Rg,this._overrideRedirectResult=Ag}async _openPopup(t,e,n,r){var i;kf(null===(i=this.eventManagers[t._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return Yg(t,await tm(t,e,n,Cf(),r),ig())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){og().location.href=t}(await tm(t,e,n,Cf(),r)),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):(kf(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 Kg(t),n=new Ng(t);return e.register("authEvent",(e=>{Tf(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(em,{type:em},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[em];void 0!==i&&e(!!i),
|
|
3233
|
+
*/(t)}?${w(a).slice(1)}${l}`}const em="webStorageSupport";const nm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=ng,this._completeRedirectFn=Rg,this._overrideRedirectResult=Ag}async _openPopup(t,e,n,r){var i;kf(null===(i=this.eventManagers[t._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return Yg(t,await tm(t,e,n,Cf(),r),ig())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){og().location.href=t}(await tm(t,e,n,Cf(),r)),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):(kf(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 Kg(t),n=new Ng(t);return e.register("authEvent",(e=>{Tf(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(em,{type:em},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[em];void 0!==i&&e(!!i),Sf(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Pg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return pp()||op()||dp()}};var rm="@firebase/auth",im="0.23.2";
|
|
3234
3234
|
/**
|
|
3235
3235
|
* @license
|
|
3236
3236
|
* Copyright 2020 Google LLC
|
|
@@ -3280,4 +3280,4 @@ class sm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
|
|
|
3280
3280
|
* See the License for the specific language governing permissions and
|
|
3281
3281
|
* limitations under the License.
|
|
3282
3282
|
*/
|
|
3283
|
-
const om=h("authIdTokenMaxAge")||300;let am=null;function cm(t=Ut()){const e=Dt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Dt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;_f(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:nm,persistence:[yg,tg,ng]}),r=h("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>om)return;const r=null==e?void 0:e.token;am!==r&&(am=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=(t=>{var e,n;return null===(n=null===(e=l())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return s&&kp(n,`http://${s}`),n}var lm;lm="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),i=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Tf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:lm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:gp(lm)},c=new Ep(n,r,i,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Zf);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new sm(t))(Tp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Ft(rm,im,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(lm)),Ft(rm,im,"esm2017");class um extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class hm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class dm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class fm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=cm(e),this.auth.setPersistence(tg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(t){return new Promise((e=>{const n=this.auth.onAuthStateChanged((r=>{this.setUser(r),e(Boolean(r)),n(),r&&this.logUserLogin(t,r)}))}))}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,i,s,o;try{const a=xh(this.firestore,"user_logging",e.uid),c=await Nd(a),l=new Date,u=c.exists?c.data():null,h=null===(r=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(h&&uf(l).diff(uf(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(i=null==u?void 0:u.brands)||void 0===i?void 0:i[t])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[t]:{brand_id:t,last_login:l,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Od(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return(await Nd(xh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yd(Oh(this.firestore,"users"),wd(new Wh("__name__"),"==",this.id));return e=xd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Yp(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await async function(t,e,n){var r;const i=Tp(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};if(null===(r=i._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}else n&&Gp(i,s,n),await Lp(i,s).catch((async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}}))}(this.auth,t)}async confirmPasswordReset(t,e){await Qp(this.auth,t,e)}}class pm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=xd(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Md.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Dt("object"==typeof t?t:Ut(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=re("firestore");t&&Rh(r,...t)}return r}(t),this.user=new fm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=yd(Oh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Dd(yd(Oh(this.firestore,t),...e))}async getDoc(t,e){const n=xh(this.firestore,t,e),r=await Nd(n);return r.exists()?r.data():null}}const gm=t=>{if(t.code===vf)throw new Error("account has been disabled");throw new Error(t.message)};class mm{static get endpoint(){return Md.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"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 ym{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new hm;try{const r=await mm.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new um;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await mm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):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.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wd("brand_id","==",this.brandId)];r.push(wd("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return gm(t)}}async getColorwaySizeAssets(t,e){const n=[wd("brand_id","==",this.brandId)];t&&n.push(wd("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wd("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return gm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return gm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t):t}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return gm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return gm(t)}}}var vm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(vm||(vm={}));const wm={[vm.ACROSS_BACK]:"Across back",[vm.ACROSS_FRONT]:"Across front",[vm.ACROSS_SHOULDER]:"Across shoulder",[vm.ANKLE]:"Ankle",[vm.ARMEYE]:"Armeye",[vm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[vm.BACK_CROTCH_LENGTH]:"Back crotch length",[vm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[vm.BELOW_KNEE]:"Below knee",[vm.BICEP]:"Bicep",[vm.BUST]:"Chest/Bust",[vm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[vm.CALF]:"Calf",[vm.CB_NECK_TO_WAIST]:"Cb neck to waist",[vm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[vm.CF_NECK_TO_WAIST]:"Cf neck to waist",[vm.ELBOW]:"Elbow",[vm.FOREARM]:"Forearm",[vm.FRONT_CROTCH_LENGTH]:"Front crotch length",[vm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[vm.HIGH_HIP]:"High hip",[vm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[vm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[vm.HSP_TO_BUST_POINT]:"Hsp to bust point",[vm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[vm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[vm.INSEAM]:"Inseam",[vm.KNEE]:"Knee",[vm.LOW_HIP]:"Low hip",[vm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[vm.MID_NECK]:"Mid neck",[vm.NECK_AT_BASE]:"Neck at base",[vm.SHOULDER_DROP]:"Shoulder drop",[vm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[vm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[vm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[vm.THIGH]:"Thigh",[vm.TOTAL_RISE_LENGTH]:"Total rise length",[vm.UNDER_BUST]:"Under bust",[vm.VERTICAL_TRUNK]:"Vertical trunk",[vm.WAIST]:"Waist",[vm.WRIST]:"Wrist"};var bm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(bm||(bm={}));const _m={[bm.BLOUSES]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.COATS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.DRESSES]:[vm.LOW_HIP,vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST],[bm.JACKETS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.PANTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.PUFFERS_AND_PARKAS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.SHORTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.SKIRTS]:[vm.LOW_HIP,vm.WAIST],[bm.SWEATERS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.T_SHIRTS_AND_TANKS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP]},Sm={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},Em={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Tm={activewear:{leggings:bm.PANTS,joggers:bm.PANTS,sweatshirts:bm.SWEATERS},dresses:{a_line:bm.DRESSES,bodycon:bm.DRESSES,fit_and_flare:bm.DRESSES,knit:bm.DRESSES,shirt:bm.DRESSES,slip:bm.DRESSES,straight:bm.DRESSES,wrap:bm.DRESSES},jackets_and_coats:{denim_jackets:bm.JACKETS,parkas:bm.PUFFERS_AND_PARKAS,peacoats:bm.COATS,puffer_jackets:bm.PUFFERS_AND_PARKAS,raincoats:bm.COATS,rompers:bm.COATS,shackets:bm.JACKETS,trench_coats:bm.COATS},jeans:{bootcut:bm.PANTS,flared:bm.PANTS,mom:bm.PANTS,relaxed:bm.PANTS,skinny:bm.PANTS,slim:bm.PANTS,straight:bm.PANTS,tapered:bm.PANTS,wide_leg:bm.PANTS},jumpsuits_and_rompers:{boiler_suits:bm.DRESSES,denim:bm.DRESSES,jumpsuits:bm.DRESSES,overalls:bm.DRESSES,rompers:bm.DRESSES,unitards:bm.DRESSES},pants_and_shorts:{cigarette:bm.PANTS,culottes:bm.SHORTS,denim_shorts:bm.SHORTS,flared:bm.PANTS,joggers:bm.PANTS,leggings:bm.PANTS,skinny:bm.PANTS,wide_leg:bm.PANTS},skirts:{a_line_flared:bm.SKIRTS,denim:bm.SKIRTS,knit:bm.SKIRTS,pencil:bm.SKIRTS,pleated:bm.SKIRTS,skater:bm.SKIRTS,slip:bm.SKIRTS,wrap:bm.SKIRTS},suits_and_tailoring:{blazers:bm.JACKETS,suit_jackets:bm.JACKETS,suit_skirts:bm.SKIRTS,suit_trousers:bm.PANTS,suit_vests:bm.SWEATERS,trousers:bm.PANTS},sweaters:{cardigans:bm.SWEATERS,crewnecks:bm.SWEATERS,hoodies_and_zipups:bm.SWEATERS,sweatshirts:bm.SWEATERS,turtlenecks:bm.SWEATERS,v_necks:bm.SWEATERS},tops:{bodysuits:bm.BLOUSES,corsets_and_bustiers:bm.BLOUSES,polos:bm.T_SHIRTS_AND_TANKS,shirts_and_blouses:bm.BLOUSES,t_shirts:bm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:bm.T_SHIRTS_AND_TANKS}};var Im;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Im||(Im={}));const km={[Im.TOO_TIGHT]:"Too Tight",[Im.TIGHT]:"Tight",[Im.SLIGHTLY_TIGHT]:"Slightly Tight",[Im.PERFECT_FIT]:"Perfect Fit",[Im.SLIGHTLY_LOOSE]:"Slightly Loose",[Im.LOOSE]:"Loose",[Im.OVERSIZED]:"Oversized",[Im.TOO_SHORT]:"Too Short",[Im.SHORT]:"Short",[Im.SLIGHTLY_SHORT]:"Slightly Short",[Im.SLIGHTLY_LONG]:"Slightly Long",[Im.LONG]:"Long",[Im.TOO_LONG]:"Too Long"};var Cm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Cm||(Cm={}));var Am=Object.freeze({__proto__:null,get AvatarState(){return Cm},get MeasurementLocation(){return vm},MeasurementLocationName:wm,get Classification(){return bm},ClassificationLocations:_m,CategoryNames:Sm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Em,Taxonomy:Tm,get Fit(){return Im},FitNames:km}),Rm="Back to sign in",Nm="Click here to download the app",Lm="Don't have an account?",Dm="Whoops! Looks like you don't have an avatar yet.",Om="Email address",xm="Please enter a valid email address.",Pm="Enter your email address, we will send you a link to reset your password.",Mm="Forgot password?",Um="Have an account? Sign in",Fm="Your avatar is loading...",zm="Unfortunately, that size is not available for try on.",Bm="or",Vm="Password",Hm="Please enter a valid password (at least 7 characters).",$m="Return to Catalog Page",jm="Return to Product Page",qm="Return to site",Wm="Please return to The Fitting Room app to create your avatar.",Km="Scan the QR code to download the app",Gm="Send",Qm="Sign back in",Ym="Sign in",Jm="Something went wrong. Try again!",Xm="You have successfully logged out!",Zm="The Fitting Room",ty="Username or password is empty.",ey="Username or password is incorrect.",ny="End size uncertainty with",ry="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique for the perfect fit every time.";var iy=[],sy=[];function oy(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=iy.indexOf(s);-1===o&&(o=iy.push(s)-1,sy[o]={}),n=sy[o]&&sy[o][r]?sy[o][r]:sy[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}oy(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});oy(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin: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}",{});oy("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});oy(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});oy("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto}}@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}}",{});oy("#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{align-items:center;display:none;flex-direction:column}#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}",{});oy(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});oy(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});oy(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}",{});oy(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const ay=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Fm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),cy=t=>{const e=document.getElementById(t);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">${ny}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${Zm}</div>\n </div>\n </div>\n ${r}\n </div>\n </div>\n </div>\n </div>\n `),o(),t.Hook(),e.style.display="block",n=t},close:r,Content:()=>n}},ly=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")};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">${ry}</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?Nm:Km}</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">${Um}</div>\n `}};class uy{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=cy(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${Xm}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${Qm}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${qm}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Dm}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${Wm}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(ay({timeoutMS:1e4}))}toScan(){this.manager.open(ly({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${Ym}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Om}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Vm}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${Mm}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${Lm}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${Ym}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Pm}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Om}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Rm}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${Gm}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${jm}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||Jm}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${jm}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${zm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Bm} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${jm}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const hy="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class dy{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!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.tfrSizeRecSelectContainer.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down")):(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="${hy}" /> 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.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-down">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${hy}" /> 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 fy{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Am.Fit.PERFECT_FIT,Am.Fit.SLIGHTLY_LOOSE,Am.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new dy(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Am.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:this.tfrShop.getMeasurementLocationName(t.measurement_location)})))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var py;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(py||(py={}));class gy{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");this.tfrModal=new uy(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Md.getInstance().setEnv(e),new ym(t,new pm)))(Number(this.shopId),o),this.tfrSizeRec=new fy(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(ty);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(xm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(Hm);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(ey)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(Jm)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case py.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Dm),this.tfrModal.onNotCreated();break;case py.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case py.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(Jm),this.tfrModal.onError(Jm)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const my=async(t,e,n,r={},i={},s="dev")=>{const o=new gy(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,my as initFittingRoom};
|
|
3283
|
+
const om=h("authIdTokenMaxAge")||300;let am=null;function cm(t=Ut()){const e=Dt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Dt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;Sf(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:nm,persistence:[yg,tg,ng]}),r=h("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>om)return;const r=null==e?void 0:e.token;am!==r&&(am=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=(t=>{var e,n;return null===(n=null===(e=l())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return s&&kp(n,`http://${s}`),n}var lm;lm="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),i=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Tf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:lm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:gp(lm)},c=new Ep(n,r,i,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Zf);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new sm(t))(Tp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Ft(rm,im,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(lm)),Ft(rm,im,"esm2017");class um extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class hm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class dm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class fm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=cm(e),this.auth.setPersistence(tg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(t){return new Promise((e=>{const n=this.auth.onAuthStateChanged((r=>{this.setUser(r),e(Boolean(r)),n(),r&&this.logUserLogin(t,r)}))}))}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,i,s,o;try{const a=xh(this.firestore,"user_logging",e.uid),c=await Nd(a),l=new Date,u=c.exists?c.data():null,h=null===(r=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(h&&uf(l).diff(uf(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(i=null==u?void 0:u.brands)||void 0===i?void 0:i[t])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[t]:{brand_id:t,last_login:l,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Od(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return(await Nd(xh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yd(Oh(this.firestore,"users"),wd(new Wh("__name__"),"==",this.id));return e=xd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Yp(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await async function(t,e,n){var r;const i=Tp(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};if(null===(r=i._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const t=await Sp(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}else n&&Gp(i,s,n),await Lp(i,s).catch((async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const t=await Sp(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}}))}(this.auth,t)}async confirmPasswordReset(t,e){await Qp(this.auth,t,e)}}class pm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=xd(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Md.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Dt("object"==typeof t?t:Ut(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=re("firestore");t&&Rh(r,...t)}return r}(t),this.user=new fm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=yd(Oh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Dd(yd(Oh(this.firestore,t),...e))}async getDoc(t,e){const n=xh(this.firestore,t,e),r=await Nd(n);return r.exists()?r.data():null}}const gm=t=>{if(t.code===vf)throw new Error("account has been disabled");throw new Error(t.message)};class mm{static get endpoint(){return Md.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"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 ym{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new hm;try{const r=await mm.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new um;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await mm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):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.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wd("brand_id","==",this.brandId)];r.push(wd("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return gm(t)}}async getColorwaySizeAssets(t,e){const n=[wd("brand_id","==",this.brandId)];t&&n.push(wd("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wd("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return gm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return gm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t):t}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return gm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return gm(t)}}}var vm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(vm||(vm={}));const wm={[vm.ACROSS_BACK]:"Across back",[vm.ACROSS_FRONT]:"Across front",[vm.ACROSS_SHOULDER]:"Across shoulder",[vm.ANKLE]:"Ankle",[vm.ARMEYE]:"Armeye",[vm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[vm.BACK_CROTCH_LENGTH]:"Back crotch length",[vm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[vm.BELOW_KNEE]:"Below knee",[vm.BICEP]:"Bicep",[vm.BUST]:"Chest/Bust",[vm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[vm.CALF]:"Calf",[vm.CB_NECK_TO_WAIST]:"Cb neck to waist",[vm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[vm.CF_NECK_TO_WAIST]:"Cf neck to waist",[vm.ELBOW]:"Elbow",[vm.FOREARM]:"Forearm",[vm.FRONT_CROTCH_LENGTH]:"Front crotch length",[vm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[vm.HIGH_HIP]:"High hip",[vm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[vm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[vm.HSP_TO_BUST_POINT]:"Hsp to bust point",[vm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[vm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[vm.INSEAM]:"Inseam",[vm.KNEE]:"Knee",[vm.LOW_HIP]:"Low hip",[vm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[vm.MID_NECK]:"Mid neck",[vm.NECK_AT_BASE]:"Neck at base",[vm.SHOULDER_DROP]:"Shoulder drop",[vm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[vm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[vm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[vm.THIGH]:"Thigh",[vm.TOTAL_RISE_LENGTH]:"Total rise length",[vm.UNDER_BUST]:"Under bust",[vm.VERTICAL_TRUNK]:"Vertical trunk",[vm.WAIST]:"Waist",[vm.WRIST]:"Wrist"};var bm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(bm||(bm={}));const Sm={[bm.BLOUSES]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.COATS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.DRESSES]:[vm.LOW_HIP,vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST],[bm.JACKETS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.PANTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.PUFFERS_AND_PARKAS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.SHORTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.SKIRTS]:[vm.LOW_HIP,vm.WAIST],[bm.SWEATERS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.T_SHIRTS_AND_TANKS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP]},_m={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},Em={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Tm={activewear:{leggings:bm.PANTS,joggers:bm.PANTS,sweatshirts:bm.SWEATERS},dresses:{a_line:bm.DRESSES,bodycon:bm.DRESSES,fit_and_flare:bm.DRESSES,knit:bm.DRESSES,shirt:bm.DRESSES,slip:bm.DRESSES,straight:bm.DRESSES,wrap:bm.DRESSES},jackets_and_coats:{denim_jackets:bm.JACKETS,parkas:bm.PUFFERS_AND_PARKAS,peacoats:bm.COATS,puffer_jackets:bm.PUFFERS_AND_PARKAS,raincoats:bm.COATS,rompers:bm.COATS,shackets:bm.JACKETS,trench_coats:bm.COATS},jeans:{bootcut:bm.PANTS,flared:bm.PANTS,mom:bm.PANTS,relaxed:bm.PANTS,skinny:bm.PANTS,slim:bm.PANTS,straight:bm.PANTS,tapered:bm.PANTS,wide_leg:bm.PANTS},jumpsuits_and_rompers:{boiler_suits:bm.DRESSES,denim:bm.DRESSES,jumpsuits:bm.DRESSES,overalls:bm.DRESSES,rompers:bm.DRESSES,unitards:bm.DRESSES},pants_and_shorts:{cigarette:bm.PANTS,culottes:bm.SHORTS,denim_shorts:bm.SHORTS,flared:bm.PANTS,joggers:bm.PANTS,leggings:bm.PANTS,skinny:bm.PANTS,wide_leg:bm.PANTS},skirts:{a_line_flared:bm.SKIRTS,denim:bm.SKIRTS,knit:bm.SKIRTS,pencil:bm.SKIRTS,pleated:bm.SKIRTS,skater:bm.SKIRTS,slip:bm.SKIRTS,wrap:bm.SKIRTS},suits_and_tailoring:{blazers:bm.JACKETS,suit_jackets:bm.JACKETS,suit_skirts:bm.SKIRTS,suit_trousers:bm.PANTS,suit_vests:bm.SWEATERS,trousers:bm.PANTS},sweaters:{cardigans:bm.SWEATERS,crewnecks:bm.SWEATERS,hoodies_and_zipups:bm.SWEATERS,sweatshirts:bm.SWEATERS,turtlenecks:bm.SWEATERS,v_necks:bm.SWEATERS},tops:{bodysuits:bm.BLOUSES,corsets_and_bustiers:bm.BLOUSES,polos:bm.T_SHIRTS_AND_TANKS,shirts_and_blouses:bm.BLOUSES,t_shirts:bm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:bm.T_SHIRTS_AND_TANKS}};var Im;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Im||(Im={}));const km={[Im.TOO_TIGHT]:"Too Tight",[Im.TIGHT]:"Tight",[Im.SLIGHTLY_TIGHT]:"Slightly Tight",[Im.PERFECT_FIT]:"Perfect Fit",[Im.SLIGHTLY_LOOSE]:"Slightly Loose",[Im.LOOSE]:"Loose",[Im.OVERSIZED]:"Oversized",[Im.TOO_SHORT]:"Too Short",[Im.SHORT]:"Short",[Im.SLIGHTLY_SHORT]:"Slightly Short",[Im.SLIGHTLY_LONG]:"Slightly Long",[Im.LONG]:"Long",[Im.TOO_LONG]:"Too Long"};var Cm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Cm||(Cm={}));var Am=Object.freeze({__proto__:null,get AvatarState(){return Cm},get MeasurementLocation(){return vm},MeasurementLocationName:wm,get Classification(){return bm},ClassificationLocations:Sm,CategoryNames:_m,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Em,Taxonomy:Tm,get Fit(){return Im},FitNames:km}),Rm="Back to sign in",Nm="Click here to download the app",Lm="Don't have an account?",Dm="Whoops! Looks like you don't have an avatar yet.",Om="Email address",xm="Please enter a valid email address.",Pm="Enter your email address, we will send you a link to reset your password.",Mm="Forgot password?",Um="Have an account? Sign in",Fm="Your avatar is loading...",zm="Unfortunately, that size is not available for try on.",Bm="or",Vm="Password",Hm="Please enter a valid password (at least 7 characters).",$m="Return to Catalog Page",jm="Return to Product Page",qm="Return to site",Wm="Please return to The Fitting Room app to create your avatar.",Km="Scan the QR code to download the app",Gm="Send",Qm="Sign back in",Ym="Sign in",Jm="Something went wrong. Try again!",Xm="You have successfully logged out!",Zm="The Fitting Room",ty="Username or password is empty.",ey="Username or password is incorrect.",ny="End size uncertainty with",ry="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique for the perfect fit every time.";var iy=[],sy=[];function oy(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=iy.indexOf(s);-1===o&&(o=iy.push(s)-1,sy[o]={}),n=sy[o]&&sy[o][r]?sy[o][r]:sy[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}oy(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});oy(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin: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}",{});oy("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});oy(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});oy("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto}}@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}}",{});oy("#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{align-items:center;display:none;flex-direction:column}#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}#tfr-size-rec-select-container{font-size:13px}",{});oy(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});oy(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});oy(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}",{});oy(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const ay=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Fm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),cy=t=>{const e=document.getElementById(t);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">${ny}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${Zm}</div>\n </div>\n </div>\n ${r}\n </div>\n </div>\n </div>\n </div>\n `),o(),t.Hook(),e.style.display="block",n=t},close:r,Content:()=>n}},ly=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")};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">${ry}</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?Nm:Km}</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">${Um}</div>\n `}};class uy{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=cy(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${Xm}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${Qm}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${qm}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Dm}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${Wm}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(ay({timeoutMS:1e4}))}toScan(){this.manager.open(ly({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${Ym}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Om}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Vm}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${Mm}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${Lm}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${Ym}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Pm}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Om}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Rm}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${Gm}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${jm}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||Jm}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${jm}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${zm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Bm} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${jm}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const hy="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class dy{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!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.tfrSizeRecSelectContainer.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down")):(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="${hy}" /> 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.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-down">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${hy}" /> 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-how-it-fits">Select size to see how it fits:</div>\n\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></div>\n </div>\n \n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">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 fy{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Am.Fit.PERFECT_FIT,Am.Fit.SLIGHTLY_LOOSE,Am.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new dy(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Am.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:this.tfrShop.getMeasurementLocationName(t.measurement_location)})))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var py;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(py||(py={}));class gy{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");this.tfrModal=new uy(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Md.getInstance().setEnv(e),new ym(t,new pm)))(Number(this.shopId),o),this.tfrSizeRec=new fy(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(ty);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(xm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(Hm);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(ey)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(Jm)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case py.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Dm),this.tfrModal.onNotCreated();break;case py.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case py.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(Jm),this.tfrModal.onError(Jm)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const my=async(t,e,n,r={},i={},s="dev")=>{const o=new gy(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,my as initFittingRoom};
|