whipdesk 0.1.2 → 0.1.3
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/README.md +21 -0
- package/dist/agent.cjs +267 -69
- package/dist/mobile-web/assets/index-CaqF5am7.css +1 -0
- package/dist/mobile-web/assets/index-D-eJUnpy.js +2 -0
- package/dist/mobile-web/assets/index.esm-DZJXVPeZ.js +33 -0
- package/dist/mobile-web/index.html +2 -2
- package/package.json +1 -1
- package/dist/mobile-web/assets/index-C_O8Rc7r.css +0 -1
- package/dist/mobile-web/assets/index-_PAhuG6R.js +0 -2
- package/dist/mobile-web/assets/index.esm-wogdVWd2.js +0 -30
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{A as e,B as t,L as n,N as r,U as i,Z as a,_ as o,c as s,g as c,n as l,o as u,p as d,s as f,tt as p,u as ee,v as te,x as m,z as ne}from"./index.esm-B3ZTr43m.js";var re=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},ie={},ae,oe;(function(){var e;function t(e,t){function n(){}n.prototype=t.prototype,e.F=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.D=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}function n(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.C=Array(this.blockSize),this.o=this.h=0,this.u()}t(r,n),r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(e,t,n){n||=0;let r=Array(16);if(typeof t==`string`)for(var i=0;i<16;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;i<16;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];let a=e.g[3],o;o=t+(a^n&(i^a))+r[0]+3614090360&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[1]+3905402710&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[2]+606105819&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[3]+3250441966&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[4]+4118548399&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[5]+1200080426&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[6]+2821735955&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[7]+4249261313&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[8]+1770035416&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[9]+2336552879&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[10]+4294925233&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[11]+2304563134&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[12]+1804603682&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[13]+4254626195&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[14]+2792965006&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[15]+1236535329&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(i^a&(n^i))+r[1]+4129170786&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[6]+3225465664&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[11]+643717713&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[0]+3921069994&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[5]+3593408605&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[10]+38016083&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[15]+3634488961&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[4]+3889429448&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[9]+568446438&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[14]+3275163606&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[3]+4107603335&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[8]+1163531501&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[13]+2850285829&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[2]+4243563512&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[7]+1735328473&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[12]+2368359562&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(n^i^a)+r[5]+4294588738&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[8]+2272392833&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[11]+1839030562&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[14]+4259657740&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[1]+2763975236&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[4]+1272893353&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[7]+4139469664&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[10]+3200236656&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[13]+681279174&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[0]+3936430074&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[3]+3572445317&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[6]+76029189&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[9]+3654602809&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[12]+3873151461&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[15]+530742520&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[2]+3299628645&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(i^(n|~a))+r[0]+4096336452&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[7]+1126891415&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[14]+2878612391&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[5]+4237533241&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[12]+1700485571&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[3]+2399980690&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[10]+4293915773&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[1]+2240044497&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[8]+1873313359&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[15]+4264355552&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[6]+2734768916&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[13]+1309151649&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[4]+4149444226&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[11]+3174756917&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[2]+718787259&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+a&4294967295}r.prototype.v=function(e,t){t===void 0&&(t=e.length);let n=t-this.blockSize,r=this.C,a=this.h,o=0;for(;o<t;){if(a==0)for(;o<=n;)i(this,e,o),o+=this.blockSize;if(typeof e==`string`){for(;o<t;)if(r[a++]=e.charCodeAt(o++),a==this.blockSize){i(this,r),a=0;break}}else for(;o<t;)if(r[a++]=e[o++],a==this.blockSize){i(this,r),a=0;break}}this.h=a,this.o+=t},r.prototype.A=function(){var e=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;t=this.o*8;for(var n=e.length-8;n<e.length;++n)e[n]=t&255,t/=256;for(this.v(e),e=Array(16),t=0,n=0;n<4;++n)for(let r=0;r<32;r+=8)e[t++]=this.g[n]>>>r&255;return e};function a(e,t){var n=s;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}function o(e,t){this.h=t;let n=[],r=!0;for(let i=e.length-1;i>=0;i--){let a=e[i]|0;r&&a==t||(n[i]=a,r=!1)}this.g=n}var s={};function c(e){return-128<=e&&e<128?a(e,function(e){return new o([e|0],e<0?-1:0)}):new o([e|0],e<0?-1:0)}function l(e){if(isNaN(e)||!isFinite(e))return d;if(e<0)return m(l(-e));let t=[],n=1;for(let r=0;e>=n;r++)t[r]=e/n|0,n*=4294967296;return new o(t,0)}function u(e,t){if(e.length==0)throw Error(`number format error: empty string`);if(t||=10,t<2||36<t)throw Error(`radix out of range: `+t);if(e.charAt(0)==`-`)return m(u(e.substring(1),t));if(e.indexOf(`-`)>=0)throw Error(`number format error: interior "-" character`);let n=l(t**8),r=d;for(let a=0;a<e.length;a+=8){var i=Math.min(8,e.length-a);let o=parseInt(e.substring(a,a+i),t);i<8?(i=l(t**+i),r=r.j(i).add(l(o))):(r=r.j(n),r=r.add(l(o)))}return r}var d=c(0),f=c(1),p=c(16777216);e=o.prototype,e.m=function(){if(te(this))return-m(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){let r=this.i(n);e+=(r>=0?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(e){if(e||=10,e<2||36<e)throw Error(`radix out of range: `+e);if(ee(this))return`0`;if(te(this))return`-`+m(this).toString(e);let t=l(e**6);var n=this;let r=``;for(;;){let i=ce(n,t).g;n=ne(n,i.j(t));let a=((n.g.length>0?n.g[0]:n.h)>>>0).toString(e);if(n=i,ee(n))return a+r;for(;a.length<6;)a=`0`+a;r=a+r}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h};function ee(e){if(e.h!=0)return!1;for(let t=0;t<e.g.length;t++)if(e.g[t]!=0)return!1;return!0}function te(e){return e.h==-1}e.l=function(e){return e=ne(this,e),te(e)?-1:+!ee(e)};function m(e){let t=e.g.length,n=[];for(let r=0;r<t;r++)n[r]=~e.g[r];return new o(n,~e.h).add(f)}e.abs=function(){return te(this)?m(this):this},e.add=function(e){let t=Math.max(this.g.length,e.g.length),n=[],r=0;for(let i=0;i<=t;i++){let t=r+(this.i(i)&65535)+(e.i(i)&65535),a=(t>>>16)+(this.i(i)>>>16)+(e.i(i)>>>16);r=a>>>16,t&=65535,a&=65535,n[i]=a<<16|t}return new o(n,n[n.length-1]&-2147483648?-1:0)};function ne(e,t){return e.add(m(t))}e.j=function(e){if(ee(this)||ee(e))return d;if(te(this))return te(e)?m(this).j(m(e)):m(m(this).j(e));if(te(e))return m(this.j(m(e)));if(this.l(p)<0&&e.l(p)<0)return l(this.m()*e.m());let t=this.g.length+e.g.length,n=[];for(var r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let t=0;t<e.g.length;t++){let i=this.i(r)>>>16,a=this.i(r)&65535,o=e.i(t)>>>16,s=e.i(t)&65535;n[2*r+2*t]+=a*s,re(n,2*r+2*t),n[2*r+2*t+1]+=i*s,re(n,2*r+2*t+1),n[2*r+2*t+1]+=a*o,re(n,2*r+2*t+1),n[2*r+2*t+2]+=i*o,re(n,2*r+2*t+2)}for(e=0;e<t;e++)n[e]=n[2*e+1]<<16|n[2*e];for(e=t;e<2*t;e++)n[e]=0;return new o(n,0)};function re(e,t){for(;(e[t]&65535)!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function se(e,t){this.g=e,this.h=t}function ce(e,t){if(ee(t))throw Error(`division by zero`);if(ee(e))return new se(d,d);if(te(e))return t=ce(m(e),t),new se(m(t.g),m(t.h));if(te(t))return t=ce(e,m(t)),new se(m(t.g),t.h);if(e.g.length>30){if(te(e)||te(t))throw Error(`slowDivide_ only works with positive integers.`);for(var n=f,r=t;r.l(e)<=0;)n=le(n),r=le(r);var i=ue(n,1),a=ue(r,1);for(r=ue(r,2),n=ue(n,2);!ee(r);){var o=a.add(r);o.l(e)<=0&&(i=i.add(n),a=o),r=ue(r,1),n=ue(n,1)}return t=ne(e,i.j(t)),new se(i,t)}for(i=d;e.l(t)>=0;){for(n=Math.max(1,Math.floor(e.m()/t.m())),r=Math.ceil(Math.log(n)/Math.LN2),r=r<=48?1:2**(r-48),a=l(n),o=a.j(t);te(o)||o.l(e)>0;)n-=r,a=l(n),o=a.j(t);ee(a)&&(a=f),i=i.add(a),e=ne(e,o)}return new se(i,e)}e.B=function(e){return ce(this,e).h},e.and=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new o(n,this.h&e.h)},e.or=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new o(n,this.h|e.h)},e.xor=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new o(n,this.h^e.h)};function le(e){let t=e.g.length+1,n=[];for(let r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new o(n,e.h)}function ue(e,t){let n=t>>5;t%=32;let r=e.g.length-n,i=[];for(let a=0;a<r;a++)i[a]=t>0?e.i(a+n)>>>t|e.i(a+n+1)<<32-t:e.i(a+n);return new o(i,e.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,oe=ie.Md5=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=l,o.fromString=u,ae=ie.Integer=o}).apply(re===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:re);var se=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},ce={},le,ue,de,fe,pe,me,he,ge;(function(){var e,t=Object.defineProperty;function n(e){e=[typeof globalThis==`object`&&globalThis,e,typeof window==`object`&&window,typeof self==`object`&&self,typeof se==`object`&&se];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error(`Cannot find global object`)}var r=n(this);function i(e,n){if(n)a:{var i=r;e=e.split(`.`);for(var a=0;a<e.length-1;a++){var o=e[a];if(!(o in i))break a;i=i[o]}e=e[e.length-1],a=i[e],n=n(a),n!=a&&n!=null&&t(i,e,{configurable:!0,writable:!0,value:n})}}i(`Symbol.dispose`,function(e){return e||Symbol(`Symbol.dispose`)}),i(`Array.prototype.values`,function(e){return e||function(){return this[Symbol.iterator]()}}),i(`Object.entries`,function(e){return e||function(e){var t=[],n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push([n,e[n]]);return t}});var a=a||{},o=this||self;function s(e){var t=typeof e;return t==`object`&&e!=null||t==`function`}function c(e,t,n){return e.call.apply(e.bind,arguments)}function l(e,t,n){return l=c,l.apply(null,arguments)}function u(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function d(e,t){function n(){}n.prototype=t.prototype,e.Z=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Ob=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}var f=typeof AsyncContext<`u`&&typeof AsyncContext.Snapshot==`function`?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function p(e){let t=e.length;if(t>0){let n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function ee(e,t){for(let t=1;t<arguments.length;t++){let r=arguments[t];var n=typeof r;if(n=n==`object`?r?Array.isArray(r)?`array`:n:`null`:n,n==`array`||n==`object`&&typeof r.length==`number`){n=e.length||0;let t=r.length||0;e.length=n+t;for(let i=0;i<t;i++)e[n+i]=r[i]}else e.push(r)}}class te{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return this.h>0?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function m(e){o.setTimeout(()=>{throw e},0)}function ne(){var e=g;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}class re{constructor(){this.h=this.g=null}add(e,t){let n=ie.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}}var ie=new te(()=>new ae,e=>e.reset());class ae{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let oe,h=!1,g=new re,_e=()=>{let e=Promise.resolve(void 0);oe=()=>{e.then(_)}};function _(){for(var e;e=ne();){try{e.h.call(e.g)}catch(e){m(e)}var t=ie;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}h=!1}function v(){this.u=this.u,this.C=this.C}v.prototype.u=!1,v.prototype.dispose=function(){this.u||(this.u=!0,this.N())},v.prototype[Symbol.dispose]=function(){this.dispose()},v.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function y(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}y.prototype.h=function(){this.defaultPrevented=!0};var ve=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{let e=()=>{};o.addEventListener(`test`,e,t),o.removeEventListener(`test`,e,t)}catch{}return e}();function ye(e){return/^[\s\xa0]*$/.test(e)}function be(e,t){y.call(this,e?e.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,e&&this.init(e,t)}d(be,y),be.prototype.init=function(e,t){let n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget,t||(n==`mouseover`?t=e.fromElement:n==`mouseout`&&(t=e.toElement)),this.relatedTarget=t,r?(this.clientX=r.clientX===void 0?r.pageX:r.clientX,this.clientY=r.clientY===void 0?r.pageY:r.clientY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=e.clientX===void 0?e.pageX:e.clientX,this.clientY=e.clientY===void 0?e.pageY:e.clientY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||``,this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=e.pointerType,this.state=e.state,this.i=e,e.defaultPrevented&&be.Z.h.call(this)},be.prototype.h=function(){be.Z.h.call(this);let e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var xe=`closure_listenable_`+(Math.random()*1e6|0),Se=0;function b(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=i,this.key=++Se,this.da=this.fa=!1}function Ce(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function we(e,t,n){for(let r in e)t.call(n,e[r],r,e)}function Te(e,t){for(let n in e)t.call(void 0,e[n],n,e)}function Ee(e){let t={};for(let n in e)t[n]=e[n];return t}let De=`constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf`.split(` `);function Oe(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t],r)e[n]=r[n];for(let t=0;t<De.length;t++)n=De[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function ke(e){this.src=e,this.g={},this.h=0}ke.prototype.add=function(e,t,n,r,i){let a=e.toString();e=this.g[a],e||(e=this.g[a]=[],this.h++);let o=S(e,t,r,i);return o>-1?(t=e[o],n||(t.fa=!1)):(t=new b(t,this.src,a,!!r,i),t.fa=n,e.push(t)),t};function x(e,t){let n=t.type;if(n in e.g){var r=e.g[n],i=Array.prototype.indexOf.call(r,t,void 0),a;(a=i>=0)&&Array.prototype.splice.call(r,i,1),a&&(Ce(t),e.g[n].length==0&&(delete e.g[n],e.h--))}}function S(e,t,n,r){for(let i=0;i<e.length;++i){let a=e[i];if(!a.da&&a.listener==t&&a.capture==!!n&&a.ha==r)return i}return-1}var C=`closure_lm_`+(Math.random()*1e6|0),Ae={};function je(e,t,n,r,i){if(r&&r.once)return w(e,t,n,r,i);if(Array.isArray(t)){for(let a=0;a<t.length;a++)je(e,t[a],n,r,i);return null}return n=Be(n),e&&e[xe]?e.J(t,n,s(r)?!!r.capture:!!r,i):Me(e,t,n,!1,r,i)}function Me(e,t,n,r,i,a){if(!t)throw Error(`Invalid event type`);let o=s(i)?!!i.capture:!!i,c=Re(e);if(c||(e[C]=c=new ke(e)),n=c.add(t,n,r,o,a),n.proxy)return n;if(r=Ne(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)ve||(i=o),i===void 0&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(Ie(t.toString()),r);else if(e.addListener&&e.removeListener)e.addListener(r);else throw Error(`addEventListener and attachEvent are unavailable.`);return n}function Ne(){function e(n){return t.call(e.src,e.listener,n)}let t=Le;return e}function w(e,t,n,r,i){if(Array.isArray(t)){for(let a=0;a<t.length;a++)w(e,t[a],n,r,i);return null}return n=Be(n),e&&e[xe]?e.K(t,n,s(r)?!!r.capture:!!r,i):Me(e,t,n,!0,r,i)}function Pe(e,t,n,r,i){if(Array.isArray(t))for(var a=0;a<t.length;a++)Pe(e,t[a],n,r,i);else r=s(r)?!!r.capture:!!r,n=Be(n),e&&e[xe]?(e=e.i,a=String(t).toString(),a in e.g&&(t=e.g[a],n=S(t,n,r,i),n>-1&&(Ce(t[n]),Array.prototype.splice.call(t,n,1),t.length==0&&(delete e.g[a],e.h--)))):(e&&=Re(e))&&(t=e.g[t.toString()],e=-1,t&&(e=S(t,n,r,i)),(n=e>-1?t[e]:null)&&Fe(n))}function Fe(e){if(typeof e!=`number`&&e&&!e.da){var t=e.src;if(t&&t[xe])x(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(Ie(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Re(t))?(x(n,e),n.h==0&&(n.src=null,t[C]=null)):Ce(e)}}}function Ie(e){return e in Ae?Ae[e]:Ae[e]=`on`+e}function Le(e,t){if(e.da)e=!0;else{t=new be(t,this);let n=e.listener,r=e.ha||e.src;e.fa&&Fe(e),e=n.call(r,t)}return e}function Re(e){return e=e[C],e instanceof ke?e:null}var ze=`__closure_events_fn_`+(Math.random()*1e9>>>0);function Be(e){return typeof e==`function`?e:(e[ze]||(e[ze]=function(t){return e.handleEvent(t)}),e[ze])}function Ve(){v.call(this),this.i=new ke(this),this.M=this,this.G=null}d(Ve,v),Ve.prototype[xe]=!0,Ve.prototype.removeEventListener=function(e,t,n,r){Pe(this,e,t,n,r)};function He(e,t){var n,r=e.G;if(r)for(n=[];r;r=r.G)n.push(r);if(e=e.M,r=t.type||t,typeof t==`string`)t=new y(t,e);else if(t instanceof y)t.target=t.target||e;else{var i=t;t=new y(r,e),Oe(t,i)}i=!0;let a,o;if(n)for(o=n.length-1;o>=0;o--)a=t.g=n[o],i=Ue(a,r,!0,t)&&i;if(a=t.g=e,i=Ue(a,r,!0,t)&&i,i=Ue(a,r,!1,t)&&i,n)for(o=0;o<n.length;o++)a=t.g=n[o],i=Ue(a,r,!1,t)&&i}Ve.prototype.N=function(){if(Ve.Z.N.call(this),this.i){var e=this.i;for(let t in e.g){let n=e.g[t];for(let e=0;e<n.length;e++)Ce(n[e]);delete e.g[t],e.h--}}this.G=null},Ve.prototype.J=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},Ve.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};function Ue(e,t,n,r){if(t=e.i.g[String(t)],!t)return!0;t=t.concat();let i=!0;for(let a=0;a<t.length;++a){let o=t[a];if(o&&!o.da&&o.capture==n){let t=o.listener,n=o.ha||o.src;o.fa&&x(e.i,o),i=t.call(n,r)!==!1&&i}}return i&&!r.defaultPrevented}function We(e,t){if(typeof e!=`function`)if(e&&typeof e.handleEvent==`function`)e=l(e.handleEvent,e);else throw Error(`Invalid listener argument`);return Number(t)>2147483647?-1:o.setTimeout(e,t||0)}function Ge(e){e.g=We(()=>{e.g=null,e.i&&(e.i=!1,Ge(e))},e.l);let t=e.h;e.h=null,e.m.apply(null,t)}class Ke extends v{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:Ge(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function qe(e){v.call(this),this.h=e,this.g={}}d(qe,v);var Je=[];function Ye(e){we(e.g,function(e,t){this.g.hasOwnProperty(t)&&Fe(e)},e),e.g={}}qe.prototype.N=function(){qe.Z.N.call(this),Ye(this)},qe.prototype.handleEvent=function(){throw Error(`EventHandler.handleEvent not implemented`)};var Xe=o.JSON.stringify,Ze=o.JSON.parse,Qe=class{stringify(e){return o.JSON.stringify(e,void 0)}parse(e){return o.JSON.parse(e,void 0)}};function $e(){}function et(){}var tt={OPEN:`a`,hb:`b`,ERROR:`c`,tb:`d`};function nt(){y.call(this,`d`)}d(nt,y);function rt(){y.call(this,`c`)}d(rt,y);var it={},at=null;function ot(){return at||=new Ve}it.Ia=`serverreachability`;function st(e){y.call(this,it.Ia,e)}d(st,y);function ct(e){let t=ot();He(t,new st(t))}it.STAT_EVENT=`statevent`;function lt(e,t){y.call(this,it.STAT_EVENT,e),this.stat=t}d(lt,y);function T(e){let t=ot();He(t,new lt(t,e))}it.Ja=`timingevent`;function ut(e,t){y.call(this,it.Ja,e),this.size=t}d(ut,y);function dt(e,t){if(typeof e!=`function`)throw Error(`Fn must not be null and must be a function`);return o.setTimeout(function(){e()},t)}function ft(){this.g=!0}ft.prototype.ua=function(){this.g=!1};function E(e,t,n,r,i,a){e.info(function(){if(e.g)if(a){var o=``,s=a.split(`&`);for(let e=0;e<s.length;e++){var c=s[e].split(`=`);if(c.length>1){let e=c[0];c=c[1];let t=e.split(`_`);o=t.length>=2&&t[1]==`type`?o+(e+`=`+c+`&`):o+(e+`=redacted&`)}}}else o=null;else o=a;return`XMLHTTP REQ (`+r+`) [attempt `+i+`]: `+t+`
|
|
2
|
+
`+n+`
|
|
3
|
+
`+o})}function pt(e,t,n,r,i,a,o){e.info(function(){return`XMLHTTP RESP (`+r+`) [ attempt `+i+`]: `+t+`
|
|
4
|
+
`+n+`
|
|
5
|
+
`+a+` `+o})}function mt(e,t,n,r){e.info(function(){return`XMLHTTP TEXT (`+t+`): `+D(e,n)+(r?` `+r:``)})}function ht(e,t){e.info(function(){return`TIMEOUT: `+t})}ft.prototype.info=function(){};function D(e,t){if(!e.g)return t;if(!t)return null;try{let a=JSON.parse(t);if(a){for(e=0;e<a.length;e++)if(Array.isArray(a[e])){var n=a[e];if(!(n.length<2)){var r=n[1];if(Array.isArray(r)&&!(r.length<1)){var i=r[0];if(i!=`noop`&&i!=`stop`&&i!=`close`)for(let e=1;e<r.length;e++)r[e]=``}}}}return Xe(a)}catch{return t}}var gt={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},O={ib:`complete`,Fb:`success`,ERROR:`error`,Ga:`abort`,xb:`ready`,yb:`readystatechange`,TIMEOUT:`timeout`,sb:`incrementaldata`,wb:`progress`,lb:`downloadprogress`,Nb:`uploadprogress`},k;function A(){}d(A,$e),A.prototype.g=function(){return new XMLHttpRequest},k=new A;function j(e){return encodeURIComponent(String(e))}function _t(e){var t=1;e=e.split(`:`);let n=[];for(;t>0&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(`:`)),n}function vt(e,t,n,r){this.j=e,this.i=t,this.l=n,this.S=r||1,this.V=new qe(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new yt}function yt(){this.i=null,this.g=``,this.h=!1}var bt={},xt={};function St(e,t,n){e.M=1,e.A=Wt(Vt(t)),e.u=n,e.R=!0,Ct(e,null)}function Ct(e,t){e.F=Date.now(),Dt(e),e.B=Vt(e.A);var n=e.B,r=e.S;Array.isArray(r)||(r=[String(r)]),tn(n.i,`t`,r),e.C=0,n=e.j.L,e.h=new yt,e.g=Hn(e.j,n?t:null,!e.u),e.P>0&&(e.O=new Ke(l(e.Y,e,e.g),e.P)),t=e.V,n=e.g,r=e.ba;var i=`readystatechange`;Array.isArray(i)||(i&&(Je[0]=i.toString()),i=Je);for(let e=0;e<i.length;e++){let a=je(n,i[e],r||t.handleEvent,!1,t.h||t);if(!a)break;t.g[a.key]=a}t=e.J?Ee(e.J):{},e.u?(e.v||=`POST`,t[`Content-Type`]=`application/x-www-form-urlencoded`,e.g.ea(e.B,e.v,e.u,t)):(e.v=`GET`,e.g.ea(e.B,e.v,null,t)),ct(),E(e.i,e.v,e.B,e.l,e.S,e.u)}vt.prototype.ba=function(e){e=e.target;let t=this.O;t&&U(e)==3?t.j():this.Y(e)},vt.prototype.Y=function(e){try{if(e==this.g)a:{let s=U(this.g),c=this.g.ya(),l=this.g.ca();if(!(s<3)&&(s!=3||this.g&&(this.h.h||this.g.la()||xn(this.g)))){this.K||s!=4||c==7||ct(c==8||l<=0?3:2),Ot(this);var t=this.g.ca();this.X=t;var n=wt(this);if(this.o=t==200,pt(this.i,this.v,this.B,this.l,this.S,s,t),this.o){if(this.U&&!this.L){b:{if(this.g){var r,i=this.g;if((r=i.g?i.g.getResponseHeader(`X-HTTP-Initial-Response`):null)&&!ye(r)){var a=r;break b}}a=null}if(e=a)mt(this.i,this.l,e,`Initial handshake response via X-HTTP-Initial-Response`),this.L=!0,jt(this,e);else{this.o=!1,this.m=3,T(12),At(this),kt(this);break a}}if(this.R){e=!0;let t;for(;!this.K&&this.C<n.length;)if(t=Et(this,n),t==xt){s==4&&(this.m=4,T(14),e=!1),mt(this.i,this.l,null,`[Incomplete Response]`);break}else if(t==bt){this.m=4,T(15),mt(this.i,this.l,n,`[Invalid Chunk]`),e=!1;break}else mt(this.i,this.l,t,null),jt(this,t);if(Tt(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),s!=4||n.length!=0||this.h.h||(this.m=1,T(16),e=!1),this.o=this.o&&e,!e)mt(this.i,this.l,n,`[Invalid Chunked Response]`),At(this),kt(this);else if(n.length>0&&!this.W){this.W=!0;var o=this.j;o.g==this&&o.aa&&!o.P&&(o.j.info(`Great, no buffering proxy detected. Bytes received: `+n.length),Pn(o),o.P=!0,T(11))}}else mt(this.i,this.l,n,null),jt(this,n);s==4&&At(this),this.o&&!this.K&&(s==4?Ln(this.j,this):(this.o=!1,Dt(this)))}else Sn(this.g),t==400&&n.indexOf(`Unknown SID`)>0?(this.m=3,T(12)):(this.m=0,T(13)),At(this),kt(this)}}}catch{}};function wt(e){if(!Tt(e))return e.g.la();let t=xn(e.g);if(t===``)return``;let n=``,r=t.length,i=U(e.g)==4;if(!e.h.i){if(typeof TextDecoder>`u`)return At(e),kt(e),``;e.h.i=new o.TextDecoder}for(let a=0;a<r;a++)e.h.h=!0,n+=e.h.i.decode(t[a],{stream:!(i&&a==r-1)});return t.length=0,e.h.g+=n,e.C=0,e.h.g}function Tt(e){return e.g?e.v==`GET`&&e.M!=2&&e.j.Aa:!1}function Et(e,t){var n=e.C,r=t.indexOf(`
|
|
6
|
+
`,n);return r==-1?xt:(n=Number(t.substring(n,r)),isNaN(n)?bt:(r+=1,r+n>t.length?xt:(t=t.slice(r,r+n),e.C=r+n,t)))}vt.prototype.cancel=function(){this.K=!0,At(this)};function Dt(e){e.T=Date.now()+e.H,M(e,e.H)}function M(e,t){if(e.D!=null)throw Error(`WatchDog timer not null`);e.D=dt(l(e.aa,e),t)}function Ot(e){e.D&&=(o.clearTimeout(e.D),null)}vt.prototype.aa=function(){this.D=null;let e=Date.now();e-this.T>=0?(ht(this.i,this.B),this.M!=2&&(ct(),T(17)),At(this),this.m=2,kt(this)):M(this,this.T-e)};function kt(e){e.j.I==0||e.K||Ln(e.j,e)}function At(e){Ot(e);var t=e.O;t&&typeof t.dispose==`function`&&t.dispose(),e.O=null,Ye(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dispose())}function jt(e,t){try{var n=e.j;if(n.I!=0&&(n.g==e||Ft(n.h,e))){if(!e.L&&Ft(n.h,e)&&n.I==3){try{var r=n.Ba.g.parse(t)}catch{r=null}if(Array.isArray(r)&&r.length==3){var i=r;if(i[0]==0){a:if(!n.v){if(n.g)if(n.g.F+3e3<e.F)In(n),Tn(n);else break a;Nn(n),T(18)}}else n.xa=i[1],0<n.xa-n.K&&i[2]<37500&&n.F&&n.A==0&&!n.C&&(n.C=dt(l(n.Va,n),6e3));N(n.h)<=1&&n.ta&&(n.ta=void 0)}else zn(n,11)}else if((e.L||n.g==e)&&In(n),!ye(t))for(i=n.Ba.g.parse(t),t=0;t<i.length;t++){let l=i[t],u=l[0];if(!(u<=n.K))if(n.K=u,l=l[1],n.I==2)if(l[0]==`c`){n.M=l[1],n.ba=l[2];let t=l[3];t!=null&&(n.ka=t,n.j.info(`VER=`+n.ka));let i=l[4];i!=null&&(n.za=i,n.j.info(`SVER=`+n.za));let u=l[5];u!=null&&typeof u==`number`&&u>0&&(r=1.5*u,n.O=r,n.j.info(`backChannelRequestTimeoutMs_=`+r)),r=n;let d=e.g;if(d){let e=d.g?d.g.getResponseHeader(`X-Client-Wire-Protocol`):null;if(e){var a=r.h;a.g||e.indexOf(`spdy`)==-1&&e.indexOf(`quic`)==-1&&e.indexOf(`h2`)==-1||(a.j=a.l,a.g=new Set,a.h&&=(It(a,a.h),null))}if(r.G){let e=d.g?d.g.getResponseHeader(`X-HTTP-Session-Id`):null;e&&(r.wa=e,I(r.J,r.G,e))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-e.F,n.j.info(`Handshake RTT: `+n.T+`ms`)),r=n;var o=e;if(r.na=Vn(r,r.L?r.ba:null,r.W),o.L){P(r.h,o);var s=o,c=r.O;c&&(s.H=c),s.D&&(Ot(s),Dt(s)),r.g=o}else Mn(r);n.i.length>0&&Dn(n)}else l[0]!=`stop`&&l[0]!=`close`||zn(n,7);else n.I==3&&(l[0]==`stop`||l[0]==`close`?l[0]==`stop`?zn(n,7):wn(n):l[0]!=`noop`&&n.l&&n.l.qa(l),n.A=0)}}ct(4)}catch{}}var Mt=class{constructor(e,t){this.g=e,this.map=t}};function Nt(e){this.l=e||10,o.PerformanceNavigationTiming?(e=o.performance.getEntriesByType(`navigation`),e=e.length>0&&(e[0].nextHopProtocol==`hq`||e[0].nextHopProtocol==`h2`)):e=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function Pt(e){return e.h?!0:e.g?e.g.size>=e.j:!1}function N(e){return e.h?1:e.g?e.g.size:0}function Ft(e,t){return e.h?e.h==t:e.g?e.g.has(t):!1}function It(e,t){e.g?e.g.add(t):e.h=t}function P(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}Nt.prototype.cancel=function(){if(this.i=Lt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let e of this.g.values())e.cancel();this.g.clear()}};function Lt(e){if(e.h!=null)return e.i.concat(e.h.G);if(e.g!=null&&e.g.size!==0){let t=e.i;for(let n of e.g.values())t=t.concat(n.G);return t}return p(e.i)}var Rt=RegExp(`^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$`);function zt(e,t){if(e){e=e.split(`&`);for(let n=0;n<e.length;n++){let r=e[n].indexOf(`=`),i,a=null;r>=0?(i=e[n].substring(0,r),a=e[n].substring(r+1)):i=e[n],t(i,a?decodeURIComponent(a.replace(/\+/g,` `)):``)}}}function Bt(e){this.g=this.o=this.j=``,this.u=null,this.m=this.h=``,this.l=!1;let t;e instanceof Bt?(this.l=e.l,Ht(this,e.j),this.o=e.o,this.g=e.g,F(this,e.u),this.h=e.h,Ut(this,nn(e.i)),this.m=e.m):e&&(t=String(e).match(Rt))?(this.l=!1,Ht(this,t[1]||``,!0),this.o=L(t[2]||``),this.g=L(t[3]||``,!0),F(this,t[4]),this.h=L(t[5]||``,!0),Ut(this,t[6]||``,!0),this.m=L(t[7]||``)):(this.l=!1,this.i=new Zt(null,this.l))}Bt.prototype.toString=function(){let e=[];var t=this.j;t&&e.push(R(t,Kt,!0),`:`);var n=this.g;return(n||t==`file`)&&(e.push(`//`),(t=this.o)&&e.push(R(t,Kt,!0),`@`),e.push(j(n).replace(/%25([0-9a-fA-F]{2})/g,`%$1`)),n=this.u,n!=null&&e.push(`:`,String(n))),(n=this.h)&&(this.g&&n.charAt(0)!=`/`&&e.push(`/`),e.push(R(n,n.charAt(0)==`/`?Jt:qt,!0))),(n=this.i.toString())&&e.push(`?`,n),(n=this.m)&&e.push(`#`,R(n,Xt)),e.join(``)},Bt.prototype.resolve=function(e){let t=Vt(this),n=!!e.j;n?Ht(t,e.j):n=!!e.o,n?t.o=e.o:n=!!e.g,n?t.g=e.g:n=e.u!=null;var r=e.h;if(n)F(t,e.u);else if(n=!!e.h){if(r.charAt(0)!=`/`)if(this.g&&!this.h)r=`/`+r;else{var i=t.h.lastIndexOf(`/`);i!=-1&&(r=t.h.slice(0,i+1)+r)}if(i=r,i==`..`||i==`.`)r=``;else if(i.indexOf(`./`)!=-1||i.indexOf(`/.`)!=-1){r=i.lastIndexOf(`/`,0)==0,i=i.split(`/`);let e=[];for(let t=0;t<i.length;){let n=i[t++];n==`.`?r&&t==i.length&&e.push(``):n==`..`?((e.length>1||e.length==1&&e[0]!=``)&&e.pop(),r&&t==i.length&&e.push(``)):(e.push(n),r=!0)}r=e.join(`/`)}else r=i}return n?t.h=r:n=e.i.toString()!==``,n?Ut(t,nn(e.i)):n=!!e.m,n&&(t.m=e.m),t};function Vt(e){return new Bt(e)}function Ht(e,t,n){e.j=n?L(t,!0):t,e.j&&=e.j.replace(/:$/,``)}function F(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error(`Bad port number `+t);e.u=t}else e.u=null}function Ut(e,t,n){t instanceof Zt?(e.i=t,an(e.i,e.l)):(n||(t=R(t,Yt)),e.i=new Zt(t,e.l))}function I(e,t,n){e.i.set(t,n)}function Wt(e){return I(e,`zx`,Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),e}function L(e,t){return e?t?decodeURI(e.replace(/%25/g,`%2525`)):decodeURIComponent(e):``}function R(e,t,n){return typeof e==`string`?(e=encodeURI(e).replace(t,Gt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,`%$1`)),e):null}function Gt(e){return e=e.charCodeAt(0),`%`+(e>>4&15).toString(16)+(e&15).toString(16)}var Kt=/[#\/\?@]/g,qt=/[#\?:]/g,Jt=/[#\?]/g,Yt=/[#\?@]/g,Xt=/#/g;function Zt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Qt(e){e.g||(e.g=new Map,e.h=0,e.i&&zt(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g,` `)),n)}))}e=Zt.prototype,e.add=function(e,t){Qt(this),this.i=null,e=rn(this,e);let n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this};function $t(e,t){Qt(e),t=rn(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function z(e,t){return Qt(e),t=rn(e,t),e.g.has(t)}e.forEach=function(e,t){Qt(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)};function en(e,t){Qt(e);let n=[];if(typeof t==`string`)z(e,t)&&(n=n.concat(e.g.get(rn(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)n=n.concat(e[t]);return n}e.set=function(e,t){return Qt(this),this.i=null,e=rn(this,e),z(this,e)&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e?(e=en(this,e),e.length>0?String(e[0]):t):t};function tn(e,t,n){$t(e,t),n.length>0&&(e.i=null,e.g.set(rn(e,t),p(n)),e.h+=n.length)}e.toString=function(){if(this.i)return this.i;if(!this.g)return``;let e=[],t=Array.from(this.g.keys());for(let r=0;r<t.length;r++){var n=t[r];let i=j(n);n=en(this,n);for(let t=0;t<n.length;t++){let r=i;n[t]!==``&&(r+=`=`+j(n[t])),e.push(r)}}return this.i=e.join(`&`)};function nn(e){let t=new Zt;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function rn(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function an(e,t){t&&!e.j&&(Qt(e),e.i=null,e.g.forEach(function(e,t){let n=t.toLowerCase();t!=n&&($t(this,t),tn(this,n,e))},e)),e.j=t}function on(e,t){let n=new ft;if(o.Image){let r=new Image;r.onload=u(cn,n,`TestLoadImage: loaded`,!0,t,r),r.onerror=u(cn,n,`TestLoadImage: error`,!1,t,r),r.onabort=u(cn,n,`TestLoadImage: abort`,!1,t,r),r.ontimeout=u(cn,n,`TestLoadImage: timeout`,!1,t,r),o.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}function sn(e,t){let n=new ft,r=new AbortController,i=setTimeout(()=>{r.abort(),cn(n,`TestPingServer: timeout`,!1,t)},1e4);fetch(e,{signal:r.signal}).then(e=>{clearTimeout(i),e.ok?cn(n,`TestPingServer: ok`,!0,t):cn(n,`TestPingServer: server error`,!1,t)}).catch(()=>{clearTimeout(i),cn(n,`TestPingServer: error`,!1,t)})}function cn(e,t,n,r,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),r(n)}catch{}}function ln(){this.g=new Qe}function un(e){this.i=e.Sb||null,this.h=e.ab||!1}d(un,$e),un.prototype.g=function(){return new dn(this.i,this.h)};function dn(e,t){Ve.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText=``,this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F=`GET`,this.D=``,this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}d(dn,Ve),e=dn.prototype,e.open=function(e,t){if(this.readyState!=0)throw this.abort(),Error(`Error reopening a connection`);this.F=e,this.D=t,this.readyState=1,pn(this)},e.send=function(e){if(this.readyState!=1)throw this.abort(),Error(`need to call open() first. `);if(this.v.signal.aborted)throw this.abort(),Error(`Request was aborted.`);this.g=!0;let t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||o).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText=``,this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel(`Request was aborted.`).catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,B(this)),this.readyState=0},e.Pa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,pn(this)),this.g&&(this.readyState=3,pn(this),this.g)))if(this.responseType===`arraybuffer`)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(o.ReadableStream!==void 0&&`body`in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error(`responseType must be empty for "streamBinaryChunks" mode responses.`);this.response=[]}else this.response=this.responseText=``,this.B=new TextDecoder;fn(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))};function fn(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}e.Ma=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array;(t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?B(this):pn(this),this.readyState==3&&fn(this)}},e.Oa=function(e){this.g&&(this.response=this.responseText=e,B(this))},e.Na=function(e){this.g&&(this.response=e,B(this))},e.ga=function(){this.g&&B(this)};function B(e){e.readyState=4,e.l=null,e.j=null,e.B=null,pn(e)}e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||``},e.getAllResponseHeaders=function(){if(!this.h)return``;let e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+`: `+n[1]),n=t.next();return e.join(`\r
|
|
7
|
+
`)};function pn(e){e.onreadystatechange&&e.onreadystatechange.call(e)}Object.defineProperty(dn.prototype,"withCredentials",{get:function(){return this.m===`include`},set:function(e){this.m=e?`include`:`same-origin`}});function mn(e){let t=``;return we(e,function(e,n){t+=n,t+=`:`,t+=e,t+=`\r
|
|
8
|
+
`}),t}function V(e,t,n){a:{for(r in n){var r=!1;break a}r=!0}r||(n=mn(n),typeof e==`string`||I(e,t,n))}function H(e){Ve.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D=``,this.o=0,this.l=``,this.j=this.B=this.v=this.A=!1,this.m=null,this.F=``,this.H=!1}d(H,Ve);var hn=/^https?$/i,gn=[`POST`,`PUT`];e=H.prototype,e.Fa=function(e){this.H=e},e.ea=function(e,t,n,r){if(this.g)throw Error(`[goog.net.XhrIo] Object is active with another request=`+this.D+`; newUri=`+e);t=t?t.toUpperCase():`GET`,this.D=e,this.l=``,this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():k.g(),this.g.onreadystatechange=f(l(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){_n(this,e);return}if(e=n||``,n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else if(typeof r.keys==`function`&&typeof r.get==`function`)for(let e of r.keys())n.set(e,r.get(e));else throw Error(`Unknown input type for opt_headers: `+String(r));r=Array.from(n.keys()).find(e=>e.toLowerCase()==`content-type`),i=o.FormData&&e instanceof o.FormData,!(Array.prototype.indexOf.call(gn,t,void 0)>=0)||r||i||n.set(`Content-Type`,`application/x-www-form-urlencoded;charset=utf-8`);for(let[e,t]of n)this.g.setRequestHeader(e,t);this.F&&(this.g.responseType=this.F),`withCredentials`in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&=(clearTimeout(this.m),null),this.v=!0,this.g.send(e),this.v=!1}catch(e){_n(this,e)}};function _n(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,vn(e),bn(e)}function vn(e){e.A||(e.A=!0,He(e,`complete`),He(e,`error`))}e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,He(this,`complete`),He(this,`abort`),bn(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),bn(this,!0)),H.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?yn(this):this.Xa())},e.Xa=function(){yn(this)};function yn(e){if(e.h&&a!==void 0){if(e.v&&U(e)==4)setTimeout(e.Ca.bind(e),0);else if(He(e,`readystatechange`),U(e)==4){e.h=!1;try{let a=e.ca();a:switch(a){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break a;default:t=!1}var n;if(!(n=t)){var r;if(r=a===0){let t=String(e.D).match(Rt)[1]||null;!t&&o.self&&o.self.location&&(t=o.self.location.protocol.slice(0,-1)),r=!hn.test(t?t.toLowerCase():``)}n=r}if(n)He(e,`complete`),He(e,`success`);else{e.o=6;try{var i=U(e)>2?e.g.statusText:``}catch{i=``}e.l=i+` [`+e.ca()+`]`,vn(e)}}finally{bn(e)}}}}function bn(e,t){if(e.g){e.m&&=(clearTimeout(e.m),null);let n=e.g;e.g=null,t||He(e,`ready`);try{n.onreadystatechange=null}catch{}}}e.isActive=function(){return!!this.g};function U(e){return e.g?e.g.readyState:0}e.ca=function(){try{return U(this)>2?this.g.status:-1}catch{return-1}},e.la=function(){try{return this.g?this.g.responseText:``}catch{return``}},e.La=function(e){if(this.g){var t=this.g.responseText;return e&&t.indexOf(e)==0&&(t=t.substring(e.length)),Ze(t)}};function xn(e){try{if(!e.g)return null;if(`response`in e.g)return e.g.response;switch(e.F){case``:case`text`:return e.g.responseText;case`arraybuffer`:if(`mozResponseArrayBuffer`in e.g)return e.g.mozResponseArrayBuffer}return null}catch{return null}}function Sn(e){let t={};e=(e.g&&U(e)>=2&&e.g.getAllResponseHeaders()||``).split(`\r
|
|
9
|
+
`);for(let r=0;r<e.length;r++){if(ye(e[r]))continue;var n=_t(e[r]);let i=n[0];if(n=n[1],typeof n!=`string`)continue;n=n.trim();let a=t[i]||[];t[i]=a,a.push(n)}Te(t,function(e){return e.join(`, `)})}e.ya=function(){return this.o},e.Ha=function(){return typeof this.l==`string`?this.l:String(this.l)};function W(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Cn(e){this.za=0,this.i=[],this.j=new ft,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=W(`failFast`,!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=W(`baseRetryDelayMs`,5e3,e),this.Za=W(`retryDelaySeedMs`,1e4,e),this.Ta=W(`forwardChannelMaxRetries`,2,e),this.va=W(`forwardChannelRequestTimeoutMs`,2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M=``,this.h=new Nt(e&&e.concurrentRequestLimit),this.Ba=new ln,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&e.longPollingTimeout>0&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}e=Cn.prototype,e.ka=8,e.I=1,e.connect=function(e,t,n,r){T(0),this.W=e,this.H=t||{},n&&r!==void 0&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.J=Vn(this,null,this.W),Dn(this)};function wn(e){if(En(e),e.I==3){var t=e.V++,n=Vt(e.J);if(I(n,`SID`,e.M),I(n,`RID`,t),I(n,`TYPE`,`terminate`),An(e,n),t=new vt(e,e.j,t),t.M=2,t.A=Wt(Vt(n)),n=!1,o.navigator&&o.navigator.sendBeacon)try{n=o.navigator.sendBeacon(t.A.toString(),``)}catch{}!n&&o.Image&&(new Image().src=t.A,n=!0),n||(t.g=Hn(t.j,null),t.g.ea(t.A)),t.F=Date.now(),Dt(t)}Bn(e)}function Tn(e){e.g&&=(Pn(e),e.g.cancel(),null)}function En(e){Tn(e),e.v&&=(o.clearTimeout(e.v),null),In(e),e.h.cancel(),e.m&&=(typeof e.m==`number`&&o.clearTimeout(e.m),null)}function Dn(e){if(!Pt(e.h)&&!e.m){e.m=!0;var t=e.Ea;oe||_e(),h||=(oe(),!0),g.add(t,e),e.D=0}}function On(e,t){return N(e.h)>=e.h.j-+!!e.m?!1:e.m?(e.i=t.G.concat(e.i),!0):e.I==1||e.I==2||e.D>=(e.Sa?0:e.Ta)?!1:(e.m=dt(l(e.Ea,e,t),Rn(e,e.D)),e.D++,!0)}e.Ea=function(e){if(this.m)if(this.m=null,this.I==1){if(!e){this.V=Math.floor(Math.random()*1e5),e=this.V++;let i=new vt(this,this.j,e),a=this.o;if(this.U&&(a?(a=Ee(a),Oe(a,this.U)):a=this.U),this.u!==null||this.R||(i.J=a,a=null),this.S)a:{for(var t=0,n=0;n<this.i.length;n++){b:{var r=this.i[n];if(`__data__`in r.map&&(r=r.map.__data__,typeof r==`string`)){r=r.length;break b}r=void 0}if(r===void 0)break;if(t+=r,t>4096){t=n;break a}if(t===4096||n===this.i.length-1){t=n+1;break a}}t=1e3}else t=1e3;t=jn(this,i,t),n=Vt(this.J),I(n,`RID`,e),I(n,`CVER`,22),this.G&&I(n,`X-HTTP-Session-Id`,this.G),An(this,n),a&&(this.R?t=`headers=`+j(mn(a))+`&`+t:this.u&&V(n,this.u,a)),It(this.h,i),this.Ra&&I(n,`TYPE`,`init`),this.S?(I(n,`$req`,t),I(n,`SID`,`null`),i.U=!0,St(i,n,null)):St(i,n,t),this.I=2}}else this.I==3&&(e?kn(this,e):this.i.length==0||Pt(this.h)||kn(this))};function kn(e,t){var n=t?t.l:e.V++;let r=Vt(e.J);I(r,`SID`,e.M),I(r,`RID`,n),I(r,`AID`,e.K),An(e,r),e.u&&e.o&&V(r,e.u,e.o),n=new vt(e,e.j,n,e.D+1),e.u===null&&(n.J=e.o),t&&(e.i=t.G.concat(e.i)),t=jn(e,n,1e3),n.H=Math.round(e.va*.5)+Math.round(e.va*.5*Math.random()),It(e.h,n),St(n,r,t)}function An(e,t){e.H&&we(e.H,function(e,n){I(t,n,e)}),e.l&&we({},function(e,n){I(t,n,e)})}function jn(e,t,n){n=Math.min(e.i.length,n);let r=e.l?l(e.l.Ka,e.l,e):null;a:{var i=e.i;let t=-1;for(;;){let e=[`count=`+n];t==-1?n>0?(t=i[0].g,e.push(`ofs=`+t)):t=0:e.push(`ofs=`+t);let c=!0;for(let l=0;l<n;l++){var a=i[l].g;let n=i[l].map;if(a-=t,a<0)t=Math.max(0,i[l].g-100),c=!1;else try{a=`req`+a+`_`||``;try{var o=n instanceof Map?n:Object.entries(n);for(let[t,n]of o){let r=n;s(n)&&(r=Xe(n)),e.push(a+t+`=`+encodeURIComponent(r))}}catch(t){throw e.push(a+`type=_badmap`),t}}catch{r&&r(n)}}if(c){o=e.join(`&`);break a}}o=void 0}return e=e.i.splice(0,n),t.G=e,o}function Mn(e){if(!e.g&&!e.v){e.Y=1;var t=e.Da;oe||_e(),h||=(oe(),!0),g.add(t,e),e.A=0}}function Nn(e){return e.g||e.v||e.A>=3?!1:(e.Y++,e.v=dt(l(e.Da,e),Rn(e,e.A)),e.A++,!0)}e.Da=function(){if(this.v=null,Fn(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var e=4*this.T;this.j.info(`BP detection timer enabled: `+e),this.B=dt(l(this.Wa,this),e)}},e.Wa=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.F=!1,this.P=!0,T(10),Tn(this),Fn(this))};function Pn(e){e.B!=null&&(o.clearTimeout(e.B),e.B=null)}function Fn(e){e.g=new vt(e,e.j,`rpc`,e.Y),e.u===null&&(e.g.J=e.o),e.g.P=0;var t=Vt(e.na);I(t,`RID`,`rpc`),I(t,`SID`,e.M),I(t,`AID`,e.K),I(t,`CI`,e.F?`0`:`1`),!e.F&&e.ia&&I(t,`TO`,e.ia),I(t,`TYPE`,`xmlhttp`),An(e,t),e.u&&e.o&&V(t,e.u,e.o),e.O&&(e.g.H=e.O);var n=e.g;e=e.ba,n.M=1,n.A=Wt(Vt(t)),n.u=null,n.R=!0,Ct(n,e)}e.Va=function(){this.C!=null&&(this.C=null,Tn(this),Nn(this),T(19))};function In(e){e.C!=null&&(o.clearTimeout(e.C),e.C=null)}function Ln(e,t){var n=null;if(e.g==t){In(e),Pn(e),e.g=null;var r=2}else if(Ft(e.h,t))n=t.G,P(e.h,t),r=1;else return;if(e.I!=0){if(t.o)if(r==1){n=t.u?t.u.length:0,t=Date.now()-t.F;var i=e.D;r=ot(),He(r,new ut(r,n)),Dn(e)}else Mn(e);else if(i=t.m,i==3||i==0&&t.X>0||!(r==1&&On(e,t)||r==2&&Nn(e)))switch(n&&n.length>0&&(t=e.h,t.i=t.i.concat(n)),i){case 1:zn(e,5);break;case 4:zn(e,10);break;case 3:zn(e,6);break;default:zn(e,2)}}}function Rn(e,t){let n=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(n*=2),n*t}function zn(e,t){if(e.j.info(`Error code `+t),t==2){var n=l(e.bb,e),r=e.Ua;let t=!r;r=new Bt(r||`//www.google.com/images/cleardot.gif`),o.location&&o.location.protocol==`http`||Ht(r,`https`),Wt(r),t?on(r.toString(),n):sn(r.toString(),n)}else T(2);e.I=0,e.l&&e.l.pa(t),Bn(e),En(e)}e.bb=function(e){e?(this.j.info(`Successfully pinged google.com`),T(2)):(this.j.info(`Failed to ping google.com`),T(1))};function Bn(e){if(e.I=0,e.ja=[],e.l){let t=Lt(e.h);(t.length!=0||e.i.length!=0)&&(ee(e.ja,t),ee(e.ja,e.i),e.h.i.length=0,p(e.i),e.i.length=0),e.l.oa()}}function Vn(e,t,n){var r=n instanceof Bt?Vt(n):new Bt(n);if(r.g!=``)t&&(r.g=t+`.`+r.g),F(r,r.u);else{var i=o.location;r=i.protocol,t=t?t+`.`+i.hostname:i.hostname,i=+i.port;let e=new Bt(null);r&&Ht(e,r),t&&(e.g=t),i&&F(e,i),n&&(e.h=n),r=e}return n=e.G,t=e.wa,n&&t&&I(r,n,t),I(r,`VER`,e.ka),An(e,r),r}function Hn(e,t,n){if(t&&!e.L)throw Error(`Can't create secondary domain capable XhrIo object.`);return t=e.Aa&&!e.ma?new H(new un({ab:n})):new H(e.ma),t.Fa(e.L),t}e.isActive=function(){return!!this.l&&this.l.isActive(this)};function G(){}e=G.prototype,e.ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){};function Un(){}Un.prototype.g=function(e,t){return new Wn(e,t)};function Wn(e,t){Ve.call(this),this.g=new Cn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e[`X-Client-Protocol`]=`webchannel`:e={"X-Client-Protocol":`webchannel`}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e[`X-WebChannel-Content-Type`]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.sa&&(e?e[`X-WebChannel-Client-Profile`]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!ye(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t&&=t.httpSessionIdParam)&&!ye(t)&&(this.g.G=t,e=this.h,e!==null&&t in e&&(e=this.h,t in e&&delete e[t])),this.j=new qn(this)}d(Wn,Ve),Wn.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},Wn.prototype.close=function(){wn(this.g)},Wn.prototype.o=function(e){var t=this.g;if(typeof e==`string`){var n={};n.__data__=e,e=n}else this.v&&(n={},n.__data__=Xe(e),e=n);t.i.push(new Mt(t.Ya++,e)),t.I==3&&Dn(t)},Wn.prototype.N=function(){this.g.l=null,delete this.j,wn(this.g),delete this.g,Wn.Z.N.call(this)};function Gn(e){nt.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){a:{for(let n in t){e=n;break a}e=void 0}(this.i=e)&&(e=this.i,t=t!==null&&e in t?t[e]:void 0),this.data=t}else this.data=e}d(Gn,nt);function Kn(){rt.call(this),this.status=1}d(Kn,rt);function qn(e){this.g=e}d(qn,G),qn.prototype.ra=function(){He(this.g,`a`)},qn.prototype.qa=function(e){He(this.g,new Gn(e))},qn.prototype.pa=function(e){He(this.g,new Kn)},qn.prototype.oa=function(){He(this.g,`b`)},Un.prototype.createWebChannel=Un.prototype.g,Wn.prototype.send=Wn.prototype.o,Wn.prototype.open=Wn.prototype.m,Wn.prototype.close=Wn.prototype.close,ge=ce.createWebChannelTransport=function(){return new Un},he=ce.getStatEventTarget=function(){return ot()},me=ce.Event=it,pe=ce.Stat={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},gt.NO_ERROR=0,gt.TIMEOUT=8,gt.HTTP_ERROR=6,fe=ce.ErrorCode=gt,O.COMPLETE=`complete`,de=ce.EventType=O,et.EventType=tt,tt.OPEN=`a`,tt.CLOSE=`b`,tt.ERROR=`c`,tt.MESSAGE=`d`,Ve.prototype.listen=Ve.prototype.J,ue=ce.WebChannel=et,ce.FetchXmlHttpFactory=un,H.prototype.listenOnce=H.prototype.K,H.prototype.getLastError=H.prototype.Ha,H.prototype.getLastErrorCode=H.prototype.ya,H.prototype.getStatus=H.prototype.ca,H.prototype.getResponseJson=H.prototype.La,H.prototype.getResponseText=H.prototype.la,H.prototype.send=H.prototype.ea,H.prototype.setWithCredentials=H.prototype.Fa,le=ce.XhrIo=H}).apply(se===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:se);var h=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},g=class{static CODES=new Map([[`\x07`,7],[`\b`,8],[` `,9],[`
|
|
10
|
+
`,10],[`\v`,11],[`\f`,12],[`\r`,13],[` `,32],[`"`,34],[`$`,36],[`&`,38],[`(`,40],[`)`,41],[`*`,42],[`+`,43],[`-`,45],[`.`,46],[`0`,48],[`1`,49],[`2`,50],[`3`,51],[`4`,52],[`5`,53],[`6`,54],[`7`,55],[`8`,56],[`9`,57],[`:`,58],[`<`,60],[`>`,62],[`?`,63],[`A`,65],[`B`,66],[`C`,67],[`F`,70],[`P`,80],[`Q`,81],[`U`,85],[`Z`,90],[`[`,91],[`\\`,92],[`]`,93],[`^`,94],[`_`,95],[`a`,97],[`b`,98],[`f`,102],[`i`,105],[`m`,109],[`n`,110],[`r`,114],[`s`,115],[`t`,116],[`v`,118],[`x`,120],[`z`,122],[`{`,123],[`|`,124],[`}`,125]]);static toUpperCase(e){let t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){let t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}},_e=class e{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=[[0,31,1],[127,159,1],[173,888,715],[889,896,7],[897,899,1],[907,909,2],[930,1328,398],[1367,1368,1],[1419,1420,1],[1424,1480,56],[1481,1487,1],[1515,1518,1],[1525,1541,1],[1564,1757,193],[1806,1807,1],[1867,1868,1],[1970,1983,1],[2043,2044,1],[2094,2095,1],[2111,2140,29],[2141,2143,2],[2155,2159,1],[2191,2199,1],[2274,2436,162],[2445,2446,1],[2449,2450,1],[2473,2481,8],[2483,2485,1],[2490,2491,1],[2501,2502,1],[2505,2506,1],[2511,2518,1],[2520,2523,1],[2526,2532,6],[2533,2559,26],[2560,2564,4],[2571,2574,1],[2577,2578,1],[2601,2609,8],[2612,2618,3],[2619,2621,2],[2627,2630,1],[2633,2634,1],[2638,2640,1],[2642,2648,1],[2653,2655,2],[2656,2661,1],[2679,2688,1],[2692,2702,10],[2706,2729,23],[2737,2740,3],[2746,2747,1],[2758,2766,4],[2767,2769,2],[2770,2783,1],[2788,2789,1],[2802,2808,1],[2816,2820,4],[2829,2830,1],[2833,2834,1],[2857,2865,8],[2868,2874,6],[2875,2885,10],[2886,2889,3],[2890,2894,4],[2895,2900,1],[2904,2907,1],[2910,2916,6],[2917,2936,19],[2937,2945,1],[2948,2955,7],[2956,2957,1],[2961,2966,5],[2967,2968,1],[2971,2973,2],[2976,2978,1],[2981,2983,1],[2987,2989,1],[3002,3005,1],[3011,3013,1],[3017,3022,5],[3023,3025,2],[3026,3030,1],[3032,3045,1],[3067,3071,1],[3085,3089,4],[3113,3130,17],[3131,3141,10],[3145,3150,5],[3151,3156,1],[3159,3163,4],[3164,3166,2],[3167,3172,5],[3173,3184,11],[3185,3190,1],[3213,3217,4],[3241,3252,11],[3258,3259,1],[3269,3273,4],[3278,3284,1],[3287,3292,1],[3295,3300,5],[3301,3312,11],[3316,3327,1],[3341,3345,4],[3397,3401,4],[3408,3411,1],[3428,3429,1],[3456,3460,4],[3479,3481,1],[3506,3516,10],[3518,3519,1],[3527,3529,1],[3531,3534,1],[3541,3543,2],[3552,3557,1],[3568,3569,1],[3573,3584,1],[3643,3646,1],[3676,3712,1],[3715,3717,2],[3723,3748,25],[3750,3774,24],[3775,3781,6],[3783,3791,8],[3802,3803,1],[3808,3839,1],[3912,3949,37],[3950,3952,1],[3992,4029,37],[4045,4059,14],[4060,4095,1],[4294,4296,2],[4297,4300,1],[4302,4303,1],[4681,4686,5],[4687,4695,8],[4697,4702,5],[4703,4745,42],[4750,4751,1],[4785,4790,5],[4791,4799,8],[4801,4806,5],[4807,4823,16],[4881,4886,5],[4887,4955,68],[4956,4989,33],[4990,4991,1],[5018,5023,1],[5110,5111,1],[5118,5119,1],[5789,5791,1],[5881,5887,1],[5910,5918,1],[5943,5951,1],[5972,5983,1],[5997,6001,4],[6004,6015,1],[6110,6111,1],[6122,6127,1],[6138,6143,1],[6158,6170,12],[6171,6175,1],[6265,6271,1],[6315,6319,1],[6390,6399,1],[6431,6444,13],[6445,6447,1],[6460,6463,1],[6465,6467,1],[6510,6511,1],[6517,6527,1],[6572,6575,1],[6602,6607,1],[6619,6621,1],[6684,6685,1],[6751,6781,30],[6782,6794,12],[6795,6799,1],[6810,6815,1],[6830,6831,1],[6863,6911,1],[6989,6991,1],[7039,7156,117],[7157,7163,1],[7224,7226,1],[7242,7244,1],[7305,7311,1],[7355,7356,1],[7368,7375,1],[7419,7423,1],[7958,7959,1],[7966,7967,1],[8006,8007,1],[8014,8015,1],[8024,8030,2],[8062,8063,1],[8117,8133,16],[8148,8149,1],[8156,8176,20],[8177,8181,4],[8191,8203,12],[8204,8207,1],[8234,8238,1],[8288,8303,1],[8306,8307,1],[8335,8349,14],[8350,8351,1],[8385,8399,1],[8433,8447,1],[8588,8591,1],[9255,9279,1],[9291,9311,1],[11124,11125,1],[11158,11508,350],[11509,11512,1],[11558,11560,2],[11561,11564,1],[11566,11567,1],[11624,11630,1],[11633,11646,1],[11671,11679,1],[11687,11743,8],[11870,11903,1],[11930,12020,90],[12021,12031,1],[12246,12271,1],[12352,12439,87],[12440,12544,104],[12545,12548,1],[12592,12687,95],[12772,12782,1],[12831,42125,29294],[42126,42127,1],[42183,42191,1],[42540,42559,1],[42744,42751,1],[42955,42959,1],[42962,42964,2],[42970,42993,1],[43053,43055,1],[43066,43071,1],[43128,43135,1],[43206,43213,1],[43226,43231,1],[43348,43358,1],[43389,43391,1],[43470,43482,12],[43483,43485,1],[43519,43575,56],[43576,43583,1],[43598,43599,1],[43610,43611,1],[43715,43738,1],[43767,43776,1],[43783,43784,1],[43791,43792,1],[43799,43807,1],[43815,43823,8],[43884,43887,1],[44014,44015,1],[44026,44031,1],[55204,55215,1],[55239,55242,1],[55292,63743,1],[64110,64111,1],[64218,64255,1],[64263,64274,1],[64280,64284,1],[64311,64317,6],[64319,64325,3],[64451,64466,1],[64912,64913,1],[64968,64974,1],[64976,65007,1],[65050,65055,1],[65107,65127,20],[65132,65135,1],[65141,65277,136],[65278,65280,1],[65471,65473,1],[65480,65481,1],[65488,65489,1],[65496,65497,1],[65501,65503,1],[65511,65519,8],[65520,65531,1],[65534,65535,1],[65548,65575,27],[65595,65598,3],[65614,65615,1],[65630,65663,1],[65787,65791,1],[65795,65798,1],[65844,65846,1],[65935,65949,14],[65950,65951,1],[65953,65999,1],[66046,66175,1],[66205,66207,1],[66257,66271,1],[66300,66303,1],[66340,66348,1],[66379,66383,1],[66427,66431,1],[66462,66500,38],[66501,66503,1],[66518,66559,1],[66718,66719,1],[66730,66735,1],[66772,66775,1],[66812,66815,1],[66856,66863,1],[66916,66926,1],[66939,66955,16],[66963,66966,3],[66978,66994,16],[67002,67005,3],[67006,67071,1],[67383,67391,1],[67414,67423,1],[67432,67455,1],[67462,67505,43],[67515,67583,1],[67590,67591,1],[67593,67638,45],[67641,67643,1],[67645,67646,1],[67670,67743,73],[67744,67750,1],[67760,67807,1],[67827,67830,3],[67831,67834,1],[67868,67870,1],[67898,67902,1],[67904,67967,1],[68024,68027,1],[68048,68049,1],[68100,68103,3],[68104,68107,1],[68116,68120,4],[68150,68151,1],[68155,68158,1],[68169,68175,1],[68185,68191,1],[68256,68287,1],[68327,68330,1],[68343,68351,1],[68406,68408,1],[68438,68439,1],[68467,68471,1],[68498,68504,1],[68509,68520,1],[68528,68607,1],[68681,68735,1],[68787,68799,1],[68851,68857,1],[68904,68911,1],[68922,69215,1],[69247,69290,43],[69294,69295,1],[69298,69372,1],[69416,69423,1],[69466,69487,1],[69514,69551,1],[69580,69599,1],[69623,69631,1],[69710,69713,1],[69750,69758,1],[69821,69827,6],[69828,69839,1],[69865,69871,1],[69882,69887,1],[69941,69960,19],[69961,69967,1],[70007,70015,1],[70112,70133,21],[70134,70143,1],[70162,70210,48],[70211,70271,1],[70279,70281,2],[70286,70302,16],[70314,70319,1],[70379,70383,1],[70394,70399,1],[70404,70413,9],[70414,70417,3],[70418,70441,23],[70449,70452,3],[70458,70469,11],[70470,70473,3],[70474,70478,4],[70479,70481,2],[70482,70486,1],[70488,70492,1],[70500,70501,1],[70509,70511,1],[70517,70655,1],[70748,70754,6],[70755,70783,1],[70856,70863,1],[70874,71039,1],[71094,71095,1],[71134,71167,1],[71237,71247,1],[71258,71263,1],[71277,71295,1],[71354,71359,1],[71370,71423,1],[71451,71452,1],[71468,71471,1],[71495,71679,1],[71740,71839,1],[71923,71934,1],[71943,71944,1],[71946,71947,1],[71956,71959,3],[71990,71993,3],[71994,72007,13],[72008,72015,1],[72026,72095,1],[72104,72105,1],[72152,72153,1],[72165,72191,1],[72264,72271,1],[72355,72367,1],[72441,72447,1],[72458,72703,1],[72713,72759,46],[72774,72783,1],[72813,72815,1],[72848,72849,1],[72872,72887,15],[72888,72959,1],[72967,72970,3],[73015,73017,1],[73019,73022,3],[73032,73039,1],[73050,73055,1],[73062,73065,3],[73103,73106,3],[73113,73119,1],[73130,73439,1],[73465,73471,1],[73489,73531,42],[73532,73533,1],[73562,73647,1],[73649,73663,1],[73714,73726,1],[74650,74751,1],[74863,74869,6],[74870,74879,1],[75076,77711,1],[77811,77823,1],[78896,78911,1],[78934,82943,1],[83527,92159,1],[92729,92735,1],[92767,92778,11],[92779,92781,1],[92863,92874,11],[92875,92879,1],[92910,92911,1],[92918,92927,1],[92998,93007,1],[93018,93026,8],[93048,93052,1],[93072,93759,1],[93851,93951,1],[94027,94030,1],[94088,94094,1],[94112,94175,1],[94181,94191,1],[94194,94207,1],[100344,100351,1],[101590,101631,1],[101641,110575,1],[110580,110588,8],[110591,110883,292],[110884,110897,1],[110899,110927,1],[110931,110932,1],[110934,110947,1],[110952,110959,1],[111356,113663,1],[113771,113775,1],[113789,113791,1],[113801,113807,1],[113818,113819,1],[113824,118527,1],[118574,118575,1],[118599,118607,1],[118724,118783,1],[119030,119039,1],[119079,119080,1],[119155,119162,1],[119275,119295,1],[119366,119487,1],[119508,119519,1],[119540,119551,1],[119639,119647,1],[119673,119807,1],[119893,119965,72],[119968,119969,1],[119971,119972,1],[119975,119976,1],[119981,119994,13],[119996,120004,8],[120070,120075,5],[120076,120085,9],[120093,120122,29],[120127,120133,6],[120135,120137,1],[120145,120486,341],[120487,120780,293],[120781,121484,703],[121485,121498,1],[121504,121520,16],[121521,122623,1],[122655,122660,1],[122667,122879,1],[122887,122905,18],[122906,122914,8],[122917,122923,6],[122924,122927,1],[122990,123022,1],[123024,123135,1],[123181,123183,1],[123198,123199,1],[123210,123213,1],[123216,123535,1],[123567,123583,1],[123642,123646,1],[123648,124111,1],[124154,124895,1],[124903,124908,5],[124911,124927,16],[125125,125126,1],[125143,125183,1],[125260,125263,1],[125274,125277,1],[125280,126064,1],[126133,126208,1],[126270,126463,1],[126468,126496,28],[126499,126501,2],[126502,126504,2],[126515,126520,5],[126522,126524,2],[126525,126529,1],[126531,126534,1],[126536,126540,2],[126544,126547,3],[126549,126550,1],[126552,126560,2],[126563,126565,2],[126566,126571,5],[126579,126589,5],[126591,126602,11],[126620,126624,1],[126628,126634,6],[126652,126703,1],[126706,126975,1],[127020,127023,1],[127124,127135,1],[127151,127152,1],[127168,127184,16],[127222,127231,1],[127406,127461,1],[127491,127503,1],[127548,127551,1],[127561,127567,1],[127570,127583,1],[127590,127743,1],[128728,128731,1],[128749,128751,1],[128765,128767,1],[128887,128890,1],[128986,128991,1],[129004,129007,1],[129009,129023,1],[129036,129039,1],[129096,129103,1],[129114,129119,1],[129160,129167,1],[129198,129199,1],[129202,129279,1],[129620,129631,1],[129646,129647,1],[129661,129663,1],[129673,129679,1],[129726,129734,8],[129735,129741,1],[129756,129759,1],[129769,129775,1],[129785,129791,1],[129939,129995,56],[129996,130031,1],[130042,131071,1],[173792,173823,1],[177978,177983,1],[178206,178207,1],[183970,183983,1],[191457,191471,1],[192094,194559,1],[195102,196607,1],[201547,201551,1],[205744,917759,1],[918e3,1114111,1]];static Cc=[[0,31,1],[127,159,1]];static Cf=[[173,1536,1363],[1537,1541,1],[1564,1757,193],[1807,2192,385],[2193,2274,81],[6158,8203,2045],[8204,8207,1],[8234,8238,1],[8288,8292,1],[8294,8303,1],[65279,65529,250],[65530,65531,1],[69821,69837,16],[78896,78911,1],[113824,113827,1],[119155,119162,1],[917505,917536,31],[917537,917631,1]];static Co=[[57344,63743,1],[983040,1048573,1],[1048576,1114109,1]];static Cs=[[55296,57343,1]];static L=[[65,90,1],[97,122,1],[170,181,11],[186,192,6],[193,214,1],[216,246,1],[248,705,1],[710,721,1],[736,740,1],[748,750,2],[880,884,1],[886,887,1],[890,893,1],[895,902,7],[904,906,1],[908,910,2],[911,929,1],[931,1013,1],[1015,1153,1],[1162,1327,1],[1329,1366,1],[1369,1376,7],[1377,1416,1],[1488,1514,1],[1519,1522,1],[1568,1610,1],[1646,1647,1],[1649,1747,1],[1749,1765,16],[1766,1774,8],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2036,2037,1],[2042,2048,6],[2049,2069,1],[2074,2084,10],[2088,2112,24],[2113,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2249,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2417,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3654,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3782,3804,22],[3805,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4256,18],[4257,4293,1],[4295,4301,6],[4304,4346,1],[4348,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5024,5109,1],[5112,5117,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6103,6108,5],[6176,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6823,6917,94],[6918,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7293,1],[7296,7304,1],[7312,7354,1],[7357,7359,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,7424,6],[7425,7615,1],[7680,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8124,1],[8126,8130,4],[8131,8132,1],[8134,8140,1],[8144,8147,1],[8150,8155,1],[8160,8172,1],[8178,8180,1],[8182,8188,1],[8305,8319,14],[8336,8348,1],[8450,8455,5],[8458,8467,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8495,8505,1],[8508,8511,1],[8517,8521,1],[8526,8579,53],[8580,11264,2684],[11265,11492,1],[11499,11502,1],[11506,11507,1],[11520,11557,1],[11559,11565,6],[11568,11623,1],[11631,11648,17],[11649,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[11823,12293,470],[12294,12337,43],[12338,12341,1],[12347,12348,1],[12353,12438,1],[12445,12447,1],[12449,12538,1],[12540,12543,1],[12549,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,42124,1],[42192,42237,1],[42240,42508,1],[42512,42527,1],[42538,42539,1],[42560,42606,1],[42623,42653,1],[42656,42725,1],[42775,42783,1],[42786,42888,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43471,43488,17],[43489,43492,1],[43494,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43741,1],[43744,43754,1],[43762,43764,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43824,43866,1],[43868,43881,1],[43888,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64256,64262,1],[64275,64279,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65313,65338,1],[65345,65370,1],[65382,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66560,66717,1],[66736,66771,1],[66776,66811,1],[66816,66855,1],[66864,66915,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68736,68786,1],[68800,68850,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71840,71903,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[92992,92995,1],[93027,93047,1],[93053,93071,1],[93760,93823,1],[93952,94026,1],[94032,94099,67],[94100,94111,1],[94176,94177,1],[94179,94208,29],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120512,1],[120514,120538,1],[120540,120570,1],[120572,120596,1],[120598,120628,1],[120630,120654,1],[120656,120686,1],[120688,120712,1],[120714,120744,1],[120746,120770,1],[120772,120779,1],[122624,122654,1],[122661,122666,1],[122928,122989,1],[123136,123180,1],[123191,123197,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124139,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[125184,125251,1],[125259,126464,1205],[126465,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static foldL=[[837,837,1]];static Ll=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,311,2],[312,328,2],[329,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[397,402,5],[405,409,4],[410,411,1],[414,417,3],[419,421,2],[424,426,2],[427,429,2],[432,436,4],[438,441,3],[442,445,3],[446,447,1],[454,460,3],[462,476,2],[477,495,2],[496,499,3],[501,505,4],[507,563,2],[564,569,1],[572,575,3],[576,578,2],[583,591,2],[592,659,1],[661,687,1],[881,883,2],[887,891,4],[892,893,1],[912,940,28],[941,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1020,1072,52],[1073,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1376,1416,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7424,7467,1],[7531,7543,1],[7545,7578,1],[7681,7829,2],[7830,7837,1],[7839,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8016,8023,1],[8032,8039,1],[8048,8061,1],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8112,8116,1],[8118,8119,1],[8126,8130,4],[8131,8132,1],[8134,8135,1],[8144,8147,1],[8150,8151,1],[8160,8167,1],[8178,8180,1],[8182,8183,1],[8458,8462,4],[8463,8467,4],[8495,8505,5],[8508,8509,1],[8518,8521,1],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11377,11379,2],[11380,11382,2],[11383,11387,1],[11393,11491,2],[11492,11500,8],[11502,11507,5],[11520,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42800,42801,1],[42803,42865,2],[42866,42872,1],[42874,42876,2],[42879,42887,2],[42892,42894,2],[42897,42899,2],[42900,42901,1],[42903,42921,2],[42927,42933,6],[42935,42947,2],[42952,42954,2],[42961,42969,2],[42998,43002,4],[43824,43866,1],[43872,43880,1],[43888,43967,1],[64256,64262,1],[64275,64279,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[119834,119859,1],[119886,119892,1],[119894,119911,1],[119938,119963,1],[119990,119993,1],[119995,119997,2],[119998,120003,1],[120005,120015,1],[120042,120067,1],[120094,120119,1],[120146,120171,1],[120198,120223,1],[120250,120275,1],[120302,120327,1],[120354,120379,1],[120406,120431,1],[120458,120485,1],[120514,120538,1],[120540,120545,1],[120572,120596,1],[120598,120603,1],[120630,120654,1],[120656,120661,1],[120688,120712,1],[120714,120719,1],[120746,120770,1],[120772,120777,1],[120779,122624,1845],[122625,122633,1],[122635,122654,1],[122661,122666,1],[125218,125251,1]];static foldLl=[[65,90,1],[192,214,1],[216,222,1],[256,302,2],[306,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,453,1],[455,456,1],[458,459,1],[461,475,2],[478,494,2],[497,498,1],[500,502,2],[503,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[837,880,43],[882,886,4],[895,902,7],[904,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,984,9],[986,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8072,8079,1],[8088,8095,1],[8104,8111,1],[8120,8124,1],[8136,8140,1],[8152,8155,1],[8168,8172,1],[8184,8188,1],[8486,8490,4],[8491,8498,7],[8579,11264,2685],[11265,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[125184,125217,1]];static Lm=[[688,705,1],[710,721,1],[736,740,1],[748,750,2],[884,890,6],[1369,1600,231],[1765,1766,1],[2036,2037,1],[2042,2074,32],[2084,2088,4],[2249,2417,168],[3654,3782,128],[4348,6103,1755],[6211,6823,612],[7288,7293,1],[7468,7530,1],[7544,7579,35],[7580,7615,1],[8305,8319,14],[8336,8348,1],[11388,11389,1],[11631,11823,192],[12293,12337,44],[12338,12341,1],[12347,12445,98],[12446,12540,94],[12541,12542,1],[40981,42232,1251],[42233,42237,1],[42508,42623,115],[42652,42653,1],[42775,42783,1],[42864,42888,24],[42994,42996,1],[43e3,43001,1],[43471,43494,23],[43632,43741,109],[43763,43764,1],[43868,43871,1],[43881,65392,21511],[65438,65439,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[92992,92995,1],[94099,94111,1],[94176,94177,1],[94179,110576,16397],[110577,110579,1],[110581,110587,1],[110589,110590,1],[122928,122989,1],[123191,123197,1],[124139,125259,1120]];static Lo=[[170,186,16],[443,448,5],[449,451,1],[660,1488,828],[1489,1514,1],[1519,1522,1],[1568,1599,1],[1601,1610,1],[1646,1647,1],[1649,1747,1],[1749,1774,25],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2048,2069,1],[2112,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2248,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2418,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3653,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3804,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4352,114],[4353,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6108,6176,68],[6177,6210,1],[6212,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6917,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7287,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,8501,1083],[8502,8504,1],[11568,11623,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[12294,12348,54],[12353,12438,1],[12447,12449,2],[12450,12538,1],[12543,12549,6],[12550,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,40980,1],[40982,42124,1],[42192,42231,1],[42240,42507,1],[42512,42527,1],[42538,42539,1],[42606,42656,50],[42657,42725,1],[42895,42999,104],[43003,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43488,43492,1],[43495,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43631,1],[43633,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43740,1],[43744,43754,1],[43762,43777,15],[43778,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43968,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65382,65391,1],[65393,65437,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66640,66717,1],[66816,66855,1],[66864,66915,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[93027,93047,1],[93053,93071,1],[93952,94026,1],[94032,94208,176],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[122634,123136,502],[123137,123180,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124138,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Lt=[[453,459,3],[498,8072,7574],[8073,8079,1],[8088,8095,1],[8104,8111,1],[8124,8140,16],[8188,8188,1]];static foldLt=[[452,454,2],[455,457,2],[458,460,2],[497,499,2],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8115,8131,16],[8179,8179,1]];static Lu=[[65,90,1],[192,214,1],[216,222,1],[256,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,461,3],[463,475,2],[478,494,2],[497,500,3],[502,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[880,882,2],[886,895,9],[902,904,2],[905,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,978,3],[979,980,1],[984,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8120,8123,1],[8136,8139,1],[8152,8155,1],[8168,8172,1],[8184,8187,1],[8450,8455,5],[8459,8461,1],[8464,8466,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8496,8499,1],[8510,8511,1],[8517,8579,62],[11264,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[119808,119833,1],[119860,119885,1],[119912,119937,1],[119964,119966,2],[119967,119973,3],[119974,119977,3],[119978,119980,1],[119982,119989,1],[120016,120041,1],[120068,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120120,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120172,120197,1],[120224,120249,1],[120276,120301,1],[120328,120353,1],[120380,120405,1],[120432,120457,1],[120488,120512,1],[120546,120570,1],[120604,120628,1],[120662,120686,1],[120720,120744,1],[120778,125184,4406],[125185,125217,1]];static Upper=this.Lu;static foldLu=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,303,2],[307,311,2],[314,328,2],[331,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[402,405,3],[409,410,1],[414,417,3],[419,421,2],[424,429,5],[432,436,4],[438,441,3],[445,447,2],[453,454,1],[456,457,1],[459,460,1],[462,476,2],[477,495,2],[498,499,1],[501,505,4],[507,543,2],[547,563,2],[572,575,3],[576,578,2],[583,591,2],[592,596,1],[598,599,1],[601,603,2],[604,608,4],[609,613,2],[614,616,2],[617,620,1],[623,625,2],[626,629,3],[637,640,3],[642,643,1],[647,652,1],[658,669,11],[670,837,167],[881,883,2],[887,891,4],[892,893,1],[940,943,1],[945,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1072,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1377,1414,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7545,7549,4],[7566,7681,115],[7683,7829,2],[7835,7841,6],[7843,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8017,8023,2],[8032,8039,1],[8048,8061,1],[8112,8113,1],[8126,8144,18],[8145,8160,15],[8161,8165,4],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11379,11382,3],[11393,11491,2],[11500,11502,2],[11507,11520,13],[11521,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42803,42863,2],[42874,42876,2],[42879,42887,2],[42892,42897,5],[42899,42900,1],[42903,42921,2],[42933,42947,2],[42952,42954,2],[42961,42967,6],[42969,42998,29],[43859,43888,29],[43889,43967,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[125218,125251,1]];static M=[[768,879,1],[1155,1161,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2307,1],[2362,2364,1],[2366,2383,1],[2385,2391,1],[2402,2403,1],[2433,2435,1],[2492,2494,2],[2495,2500,1],[2503,2504,1],[2507,2509,1],[2519,2530,11],[2531,2558,27],[2561,2563,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2672,31],[2673,2677,4],[2689,2691,1],[2748,2750,2],[2751,2757,1],[2759,2761,1],[2763,2765,1],[2786,2787,1],[2810,2815,1],[2817,2819,1],[2876,2878,2],[2879,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2914,2915,1],[2946,3006,60],[3007,3010,1],[3014,3016,1],[3018,3021,1],[3031,3072,41],[3073,3076,1],[3132,3134,2],[3135,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3203,1],[3260,3262,2],[3263,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3298,3299,1],[3315,3328,13],[3329,3331,1],[3387,3388,1],[3390,3396,1],[3398,3400,1],[3402,3405,1],[3415,3426,11],[3427,3457,30],[3458,3459,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3570,3571,1],[3633,3636,3],[3637,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3902,3903,1],[3953,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4139,101],[4140,4158,1],[4182,4185,1],[4190,4192,1],[4194,4196,1],[4199,4205,1],[4209,4212,1],[4226,4237,1],[4239,4250,11],[4251,4253,1],[4957,4959,1],[5906,5909,1],[5938,5940,1],[5970,5971,1],[6002,6003,1],[6068,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6443,1],[6448,6459,1],[6679,6683,1],[6741,6750,1],[6752,6780,1],[6783,6832,49],[6833,6862,1],[6912,6916,1],[6964,6980,1],[7019,7027,1],[7040,7042,1],[7073,7085,1],[7142,7155,1],[7204,7223,1],[7376,7378,1],[7380,7400,1],[7405,7412,7],[7415,7417,1],[7616,7679,1],[8400,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12335,1],[12441,12442,1],[42607,42610,1],[42612,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43043,24],[43044,43047,1],[43052,43136,84],[43137,43188,51],[43189,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43347,1],[43392,43395,1],[43443,43456,1],[43493,43561,68],[43562,43574,1],[43587,43596,9],[43597,43643,46],[43644,43645,1],[43696,43698,2],[43699,43700,1],[43703,43704,1],[43710,43711,1],[43713,43755,42],[43756,43759,1],[43765,43766,1],[44003,44010,1],[44012,44013,1],[64286,65024,738],[65025,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69632,69634,1],[69688,69702,1],[69744,69747,3],[69748,69759,11],[69760,69762,1],[69808,69818,1],[69826,69888,62],[69889,69890,1],[69927,69940,1],[69957,69958,1],[70003,70016,13],[70017,70018,1],[70067,70080,1],[70089,70092,1],[70094,70095,1],[70188,70199,1],[70206,70209,3],[70367,70378,1],[70400,70403,1],[70459,70460,1],[70462,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70502,3],[70503,70508,1],[70512,70516,1],[70709,70726,1],[70750,70832,82],[70833,70851,1],[71087,71093,1],[71096,71104,1],[71132,71133,1],[71216,71232,1],[71339,71351,1],[71453,71467,1],[71724,71738,1],[71984,71989,1],[71991,71992,1],[71995,71998,1],[72e3,72002,2],[72003,72145,142],[72146,72151,1],[72154,72160,1],[72164,72193,29],[72194,72202,1],[72243,72249,1],[72251,72254,1],[72263,72273,10],[72274,72283,1],[72330,72345,1],[72751,72758,1],[72760,72767,1],[72850,72871,1],[72873,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73098,67],[73099,73102,1],[73104,73105,1],[73107,73111,1],[73459,73462,1],[73472,73473,1],[73475,73524,49],[73525,73530,1],[73534,73538,1],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94033,2],[94034,94087,1],[94095,94098,1],[94180,94192,12],[94193,113821,19628],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119141,119145,1],[119149,119154,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldM=[[921,953,32],[8126,8126,1]];static Mc=[[2307,2363,56],[2366,2368,1],[2377,2380,1],[2382,2383,1],[2434,2435,1],[2494,2496,1],[2503,2504,1],[2507,2508,1],[2519,2563,44],[2622,2624,1],[2691,2750,59],[2751,2752,1],[2761,2763,2],[2764,2818,54],[2819,2878,59],[2880,2887,7],[2888,2891,3],[2892,2903,11],[3006,3007,1],[3009,3010,1],[3014,3016,1],[3018,3020,1],[3031,3073,42],[3074,3075,1],[3137,3140,1],[3202,3203,1],[3262,3264,2],[3265,3268,1],[3271,3272,1],[3274,3275,1],[3285,3286,1],[3315,3330,15],[3331,3390,59],[3391,3392,1],[3398,3400,1],[3402,3404,1],[3415,3458,43],[3459,3535,76],[3536,3537,1],[3544,3551,1],[3570,3571,1],[3902,3903,1],[3967,4139,172],[4140,4145,5],[4152,4155,3],[4156,4182,26],[4183,4194,11],[4195,4196,1],[4199,4205,1],[4227,4228,1],[4231,4236,1],[4239,4250,11],[4251,4252,1],[5909,5940,31],[6070,6078,8],[6079,6085,1],[6087,6088,1],[6435,6438,1],[6441,6443,1],[6448,6449,1],[6451,6456,1],[6681,6682,1],[6741,6743,2],[6753,6755,2],[6756,6765,9],[6766,6770,1],[6916,6965,49],[6971,6973,2],[6974,6977,1],[6979,6980,1],[7042,7073,31],[7078,7079,1],[7082,7143,61],[7146,7148,1],[7150,7154,4],[7155,7204,49],[7205,7211,1],[7220,7221,1],[7393,7415,22],[12334,12335,1],[43043,43044,1],[43047,43136,89],[43137,43188,51],[43189,43203,1],[43346,43347,1],[43395,43444,49],[43445,43450,5],[43451,43454,3],[43455,43456,1],[43567,43568,1],[43571,43572,1],[43597,43643,46],[43645,43755,110],[43758,43759,1],[43765,44003,238],[44004,44006,2],[44007,44009,2],[44010,44012,2],[69632,69634,2],[69762,69808,46],[69809,69810,1],[69815,69816,1],[69932,69957,25],[69958,70018,60],[70067,70069,1],[70079,70080,1],[70094,70188,94],[70189,70190,1],[70194,70195,1],[70197,70368,171],[70369,70370,1],[70402,70403,1],[70462,70463,1],[70465,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70709,210],[70710,70711,1],[70720,70721,1],[70725,70832,107],[70833,70834,1],[70841,70843,2],[70844,70846,1],[70849,71087,238],[71088,71089,1],[71096,71099,1],[71102,71216,114],[71217,71218,1],[71227,71228,1],[71230,71340,110],[71342,71343,1],[71350,71456,106],[71457,71462,5],[71724,71726,1],[71736,71984,248],[71985,71989,1],[71991,71992,1],[71997,72e3,3],[72002,72145,143],[72146,72147,1],[72156,72159,1],[72164,72249,85],[72279,72280,1],[72343,72751,408],[72766,72873,107],[72881,72884,3],[73098,73102,1],[73107,73108,1],[73110,73461,351],[73462,73475,13],[73524,73525,1],[73534,73535,1],[73537,94033,20496],[94034,94087,1],[94192,94193,1],[119141,119142,1],[119149,119154,1]];static Me=[[1160,1161,1],[6846,8413,1567],[8414,8416,1],[8418,8420,1],[42608,42610,1]];static Mn=[[768,879,1],[1155,1159,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2306,1],[2362,2364,2],[2369,2376,1],[2381,2385,4],[2386,2391,1],[2402,2403,1],[2433,2492,59],[2497,2500,1],[2509,2530,21],[2531,2558,27],[2561,2562,1],[2620,2625,5],[2626,2631,5],[2632,2635,3],[2636,2637,1],[2641,2672,31],[2673,2677,4],[2689,2690,1],[2748,2753,5],[2754,2757,1],[2759,2760,1],[2765,2786,21],[2787,2810,23],[2811,2815,1],[2817,2876,59],[2879,2881,2],[2882,2884,1],[2893,2901,8],[2902,2914,12],[2915,2946,31],[3008,3021,13],[3072,3076,4],[3132,3134,2],[3135,3136,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3260,59],[3263,3270,7],[3276,3277,1],[3298,3299,1],[3328,3329,1],[3387,3388,1],[3393,3396,1],[3405,3426,21],[3427,3457,30],[3530,3538,8],[3539,3540,1],[3542,3633,91],[3636,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3953,3966,1],[3968,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4141,103],[4142,4144,1],[4146,4151,1],[4153,4154,1],[4157,4158,1],[4184,4185,1],[4190,4192,1],[4209,4212,1],[4226,4229,3],[4230,4237,7],[4253,4957,704],[4958,4959,1],[5906,5908,1],[5938,5939,1],[5970,5971,1],[6002,6003,1],[6068,6069,1],[6071,6077,1],[6086,6089,3],[6090,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6434,1],[6439,6440,1],[6450,6457,7],[6458,6459,1],[6679,6680,1],[6683,6742,59],[6744,6750,1],[6752,6754,2],[6757,6764,1],[6771,6780,1],[6783,6832,49],[6833,6845,1],[6847,6862,1],[6912,6915,1],[6964,6966,2],[6967,6970,1],[6972,6978,6],[7019,7027,1],[7040,7041,1],[7074,7077,1],[7080,7081,1],[7083,7085,1],[7142,7144,2],[7145,7149,4],[7151,7153,1],[7212,7219,1],[7222,7223,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8400,8412,1],[8417,8421,4],[8422,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12333,1],[12441,12442,1],[42607,42612,5],[42613,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43045,26],[43046,43052,6],[43204,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43345,1],[43392,43394,1],[43443,43446,3],[43447,43449,1],[43452,43453,1],[43493,43561,68],[43562,43566,1],[43569,43570,1],[43573,43574,1],[43587,43596,9],[43644,43696,52],[43698,43700,1],[43703,43704,1],[43710,43711,1],[43713,43756,43],[43757,43766,9],[44005,44008,3],[44013,64286,20273],[65024,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69633,69688,55],[69689,69702,1],[69744,69747,3],[69748,69759,11],[69760,69761,1],[69811,69814,1],[69817,69818,1],[69826,69888,62],[69889,69890,1],[69927,69931,1],[69933,69940,1],[70003,70016,13],[70017,70070,53],[70071,70078,1],[70089,70092,1],[70095,70191,96],[70192,70193,1],[70196,70198,2],[70199,70206,7],[70209,70367,158],[70371,70378,1],[70400,70401,1],[70459,70460,1],[70464,70502,38],[70503,70508,1],[70512,70516,1],[70712,70719,1],[70722,70724,1],[70726,70750,24],[70835,70840,1],[70842,70847,5],[70848,70850,2],[70851,71090,239],[71091,71093,1],[71100,71101,1],[71103,71104,1],[71132,71133,1],[71219,71226,1],[71229,71231,2],[71232,71339,107],[71341,71344,3],[71345,71349,1],[71351,71453,102],[71454,71455,1],[71458,71461,1],[71463,71467,1],[71727,71735,1],[71737,71738,1],[71995,71996,1],[71998,72003,5],[72148,72151,1],[72154,72155,1],[72160,72193,33],[72194,72202,1],[72243,72248,1],[72251,72254,1],[72263,72273,10],[72274,72278,1],[72281,72283,1],[72330,72342,1],[72344,72345,1],[72752,72758,1],[72760,72765,1],[72767,72850,83],[72851,72871,1],[72874,72880,1],[72882,72883,1],[72885,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73104,73],[73105,73109,4],[73111,73459,348],[73460,73472,12],[73473,73526,53],[73527,73530,1],[73536,73538,2],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94095,64],[94096,94098,1],[94180,113821,19641],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldMn=[[921,953,32],[8126,8126,1]];static N=[[48,57,1],[178,179,1],[185,188,3],[189,190,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2548,2553,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[2930,2935,1],[3046,3058,1],[3174,3183,1],[3192,3198,1],[3302,3311,1],[3416,3422,1],[3430,3448,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3891,1],[4160,4169,1],[4240,4249,1],[4969,4988,1],[5870,5872,1],[6112,6121,1],[6128,6137,1],[6160,6169,1],[6470,6479,1],[6608,6618,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[8304,8308,4],[8309,8313,1],[8320,8329,1],[8528,8578,1],[8581,8585,1],[9312,9371,1],[9450,9471,1],[10102,10131,1],[11517,12295,778],[12321,12329,1],[12344,12346,1],[12690,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[42528,42537,1],[42726,42735,1],[43056,43061,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[65799,65843,1],[65856,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[66369,66378,9],[66513,66517,1],[66720,66729,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[68912,68921,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70113,70132,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71483,1],[71904,71922,1],[72016,72025,1],[72784,72812,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[73664,73684,1],[74752,74862,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125127,125135,1],[125264,125273,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1],[130032,130041,1]];static Nd=[[48,57,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[3046,3055,1],[3174,3183,1],[3302,3311,1],[3430,3439,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3881,1],[4160,4169,1],[4240,4249,1],[6112,6121,1],[6160,6169,1],[6470,6479,1],[6608,6617,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[42528,42537,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[66720,66729,1],[68912,68921,1],[69734,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71481,1],[71904,71913,1],[72016,72025,1],[72784,72793,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125264,125273,1],[130032,130041,1]];static Nl=[[5870,5872,1],[8544,8578,1],[8581,8584,1],[12295,12321,26],[12322,12329,1],[12344,12346,1],[42726,42735,1],[65856,65908,1],[66369,66378,9],[66513,66517,1],[74752,74862,1]];static No=[[178,179,1],[185,188,3],[189,190,1],[2548,2553,1],[2930,2935,1],[3056,3058,1],[3192,3198,1],[3416,3422,1],[3440,3448,1],[3882,3891,1],[4969,4988,1],[6128,6137,1],[6618,8304,1686],[8308,8313,1],[8320,8329,1],[8528,8543,1],[8585,9312,727],[9313,9371,1],[9450,9471,1],[10102,10131,1],[11517,12690,1173],[12691,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[43056,43061,1],[65799,65843,1],[65909,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69733,1],[70113,70132,1],[71482,71483,1],[71914,71922,1],[72794,72812,1],[73664,73684,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[125127,125135,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1]];static P=[[33,35,1],[37,42,1],[44,47,1],[58,59,1],[63,64,1],[91,93,1],[95,123,28],[125,161,36],[167,171,4],[182,183,1],[187,191,4],[894,903,9],[1370,1375,1],[1417,1418,1],[1470,1472,2],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3898,38],[3899,3901,1],[3973,4048,75],[4049,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5120,5742,622],[5787,5788,1],[5867,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8208,829],[8209,8231,1],[8240,8259,1],[8261,8273,1],[8275,8286,1],[8317,8318,1],[8333,8334,1],[8968,8971,1],[9001,9002,1],[10088,10101,1],[10181,10182,1],[10214,10223,1],[10627,10648,1],[10712,10715,1],[10748,10749,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11822,1],[11824,11855,1],[11858,11869,1],[12289,12291,1],[12296,12305,1],[12308,12319,1],[12336,12349,13],[12448,12539,91],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,64830,20819],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65121,1],[65123,65128,5],[65130,65131,1],[65281,65283,1],[65285,65290,1],[65292,65295,1],[65306,65307,1],[65311,65312,1],[65339,65341,1],[65343,65371,28],[65373,65375,2],[65376,65381,1],[65792,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69293,69461,168],[69462,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Pc=[[95,8255,8160],[8256,8276,20],[65075,65076,1],[65101,65103,1],[65343,65343,1]];static Pd=[[45,1418,1373],[1470,5120,3650],[6150,8208,2058],[8209,8213,1],[11799,11802,3],[11834,11835,1],[11840,11869,29],[12316,12336,20],[12448,65073,52625],[65074,65112,38],[65123,65293,170],[69293,69293,1]];static Pe=[[41,93,52],[125,3899,3774],[3901,5788,1887],[8262,8318,56],[8334,8969,635],[8971,9002,31],[10089,10101,2],[10182,10215,33],[10217,10223,2],[10628,10648,2],[10713,10715,2],[10749,11811,1062],[11813,11817,2],[11862,11868,2],[12297,12305,2],[12309,12315,2],[12318,12319,1],[64830,65048,218],[65078,65092,2],[65096,65114,18],[65116,65118,2],[65289,65341,52],[65373,65379,3]];static Pf=[[187,8217,8030],[8221,8250,29],[11779,11781,2],[11786,11789,3],[11805,11809,4]];static Pi=[[171,8216,8045],[8219,8220,1],[8223,8249,26],[11778,11780,2],[11785,11788,3],[11804,11808,4]];static Po=[[33,35,1],[37,39,1],[42,46,2],[47,58,11],[59,63,4],[64,92,28],[161,167,6],[182,183,1],[191,894,703],[903,1370,467],[1371,1375,1],[1417,1472,55],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3973,113],[4048,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5742,5867,125],[5868,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6149,1],[6151,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8214,835],[8215,8224,9],[8225,8231,1],[8240,8248,1],[8251,8254,1],[8257,8259,1],[8263,8273,1],[8275,8277,2],[8278,8286,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11782,5],[11783,11784,1],[11787,11790,3],[11791,11798,1],[11800,11801,1],[11803,11806,3],[11807,11818,11],[11819,11822,1],[11824,11833,1],[11836,11839,1],[11841,11843,2],[11844,11855,1],[11858,11860,1],[12289,12291,1],[12349,12539,190],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,65040,21029],[65041,65046,1],[65049,65072,23],[65093,65094,1],[65097,65100,1],[65104,65106,1],[65108,65111,1],[65119,65121,1],[65128,65130,2],[65131,65281,150],[65282,65283,1],[65285,65287,1],[65290,65294,2],[65295,65306,11],[65307,65311,4],[65312,65340,28],[65377,65380,3],[65381,65792,411],[65793,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Ps=[[40,91,51],[123,3898,3775],[3900,5787,1887],[8218,8222,4],[8261,8317,56],[8333,8968,635],[8970,9001,31],[10088,10100,2],[10181,10214,33],[10216,10222,2],[10627,10647,2],[10712,10714,2],[10748,11810,1062],[11812,11816,2],[11842,11861,19],[11863,11867,2],[12296,12304,2],[12308,12314,2],[12317,64831,52514],[65047,65077,30],[65079,65091,2],[65095,65113,18],[65115,65117,2],[65288,65339,51],[65371,65375,4],[65378,65378,1]];static S=[[36,43,7],[60,62,1],[94,96,2],[124,126,2],[162,166,1],[168,169,1],[172,174,2],[175,177,1],[180,184,4],[215,247,32],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,1014,113],[1154,1421,267],[1422,1423,1],[1542,1544,1],[1547,1550,3],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2046,2047,1],[2184,2546,362],[2547,2554,7],[2555,2801,246],[2928,3059,131],[3060,3066,1],[3199,3407,208],[3449,3647,198],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6107,366],[6464,6622,158],[6623,6655,1],[7009,7018,1],[7028,7036,1],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8352,8384,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8472,1],[8478,8483,1],[8485,8489,2],[8494,8506,12],[8507,8512,5],[8513,8516,1],[8522,8525,1],[8527,8586,59],[8587,8592,5],[8593,8967,1],[8972,9e3,1],[9003,9254,1],[9280,9290,1],[9372,9449,1],[9472,10087,1],[10132,10180,1],[10183,10213,1],[10224,10626,1],[10649,10711,1],[10716,10747,1],[10750,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12443,12444,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43048,43051,1],[43062,43065,1],[43639,43641,1],[43867,43882,15],[43883,64297,20414],[64434,64450,1],[64832,64847,1],[64975,65020,45],[65021,65023,1],[65122,65124,2],[65125,65126,1],[65129,65284,155],[65291,65308,17],[65309,65310,1],[65342,65344,2],[65372,65374,2],[65504,65510,1],[65512,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,123647,432],[126124,126128,4],[126254,126704,450],[126705,126976,271],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Sc=[[36,162,126],[163,165,1],[1423,1547,124],[2046,2047,1],[2546,2547,1],[2555,2801,246],[3065,3647,582],[6107,8352,2245],[8353,8384,1],[43064,65020,21956],[65129,65284,155],[65504,65505,1],[65509,65510,1],[73693,73696,1],[123647,126128,2481]];static Sk=[[94,96,2],[168,175,7],[180,184,4],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,2184,1283],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[12443,12444,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43867,43882,15],[43883,64434,20551],[64435,64450,1],[65342,65344,2],[65507,127995,62488],[127996,127999,1]];static Sm=[[43,60,17],[61,62,1],[124,126,2],[172,177,5],[215,247,32],[1014,1542,528],[1543,1544,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8472,8512,40],[8513,8516,1],[8523,8592,69],[8593,8596,1],[8602,8603,1],[8608,8614,3],[8622,8654,32],[8655,8658,3],[8660,8692,32],[8693,8959,1],[8992,8993,1],[9084,9115,31],[9116,9139,1],[9180,9185,1],[9655,9665,10],[9720,9727,1],[9839,10176,337],[10177,10180,1],[10183,10213,1],[10224,10239,1],[10496,10626,1],[10649,10711,1],[10716,10747,1],[10750,11007,1],[11056,11076,1],[11079,11084,1],[64297,65122,825],[65124,65126,1],[65291,65308,17],[65309,65310,1],[65372,65374,2],[65506,65513,7],[65514,65516,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[126704,126705,1]];static So=[[166,169,3],[174,176,2],[1154,1421,267],[1422,1550,128],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2554,2928,374],[3059,3064,1],[3066,3199,133],[3407,3449,42],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6464,723],[6622,6655,1],[7009,7018,1],[7028,7036,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8478,7],[8479,8483,1],[8485,8489,2],[8494,8506,12],[8507,8522,15],[8524,8525,1],[8527,8586,59],[8587,8597,10],[8598,8601,1],[8604,8607,1],[8609,8610,1],[8612,8613,1],[8615,8621,1],[8623,8653,1],[8656,8657,1],[8659,8661,2],[8662,8691,1],[8960,8967,1],[8972,8991,1],[8994,9e3,1],[9003,9083,1],[9085,9114,1],[9140,9179,1],[9186,9254,1],[9280,9290,1],[9372,9449,1],[9472,9654,1],[9656,9664,1],[9666,9719,1],[9728,9838,1],[9840,10087,1],[10132,10175,1],[10240,10495,1],[11008,11055,1],[11077,11078,1],[11085,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[43048,43051,1],[43062,43063,1],[43065,43639,574],[43640,43641,1],[64832,64847,1],[64975,65021,46],[65022,65023,1],[65508,65512,4],[65517,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73692,1],[73697,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,126124,2909],[126254,126976,722],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,127994,1],[128e3,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Z=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8232,8233,1],[8239,8287,48],[12288,12288,1]];static Zl=[[8232,8232,1]];static Zp=[[8233,8233,1]];static Zs=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8239,8287,48],[12288,12288,1]];static Adlam=[[125184,125259,1],[125264,125273,1],[125278,125279,1]];static Ahom=[[71424,71450,1],[71453,71467,1],[71472,71494,1]];static Anatolian_Hieroglyphs=[[82944,83526,1]];static Arabic=[[1536,1540,1],[1542,1547,1],[1549,1562,1],[1564,1566,1],[1568,1599,1],[1601,1610,1],[1622,1647,1],[1649,1756,1],[1758,1791,1],[1872,1919,1],[2160,2190,1],[2192,2193,1],[2200,2273,1],[2275,2303,1],[64336,64450,1],[64467,64829,1],[64832,64911,1],[64914,64967,1],[64975,65008,33],[65009,65023,1],[65136,65140,1],[65142,65276,1],[69216,69246,1],[69373,69375,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[126704,126705,1]];static Armenian=[[1329,1366,1],[1369,1418,1],[1421,1423,1],[64275,64279,1]];static Avestan=[[68352,68405,1],[68409,68415,1]];static Balinese=[[6912,6988,1],[6992,7038,1]];static Bamum=[[42656,42743,1],[92160,92728,1]];static Bassa_Vah=[[92880,92909,1],[92912,92917,1]];static Batak=[[7104,7155,1],[7164,7167,1]];static Bengali=[[2432,2435,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2492,2500,1],[2503,2504,1],[2507,2510,1],[2519,2524,5],[2525,2527,2],[2528,2531,1],[2534,2558,1]];static Bhaiksuki=[[72704,72712,1],[72714,72758,1],[72760,72773,1],[72784,72812,1]];static Bopomofo=[[746,747,1],[12549,12591,1],[12704,12735,1]];static Brahmi=[[69632,69709,1],[69714,69749,1],[69759,69759,1]];static Braille=[[10240,10495,1]];static Buginese=[[6656,6683,1],[6686,6687,1]];static Buhid=[[5952,5971,1]];static Canadian_Aboriginal=[[5120,5759,1],[6320,6389,1],[72368,72383,1]];static Carian=[[66208,66256,1]];static Caucasian_Albanian=[[66864,66915,1],[66927,66927,1]];static Chakma=[[69888,69940,1],[69942,69959,1]];static Cham=[[43520,43574,1],[43584,43597,1],[43600,43609,1],[43612,43615,1]];static Cherokee=[[5024,5109,1],[5112,5117,1],[43888,43967,1]];static Chorasmian=[[69552,69579,1]];static Common=[[0,64,1],[91,96,1],[123,169,1],[171,185,1],[187,191,1],[215,247,32],[697,735,1],[741,745,1],[748,767,1],[884,894,10],[901,903,2],[1541,1548,7],[1563,1567,4],[1600,1757,157],[2274,2404,130],[2405,3647,1242],[4053,4056,1],[4347,5867,1520],[5868,5869,1],[5941,5942,1],[6146,6147,1],[6149,7379,1230],[7393,7401,8],[7402,7404,1],[7406,7411,1],[7413,7415,1],[7418,8192,774],[8193,8203,1],[8206,8292,1],[8294,8304,1],[8308,8318,1],[8320,8334,1],[8352,8384,1],[8448,8485,1],[8487,8489,1],[8492,8497,1],[8499,8525,1],[8527,8543,1],[8585,8587,1],[8592,9254,1],[9280,9290,1],[9312,10239,1],[10496,11123,1],[11126,11157,1],[11159,11263,1],[11776,11869,1],[12272,12292,1],[12294,12296,2],[12297,12320,1],[12336,12343,1],[12348,12351,1],[12443,12444,1],[12448,12539,91],[12540,12688,148],[12689,12703,1],[12736,12771,1],[12783,12832,49],[12833,12895,1],[12927,13007,1],[13055,13144,89],[13145,13311,1],[19904,19967,1],[42752,42785,1],[42888,42890,1],[43056,43065,1],[43310,43471,161],[43867,43882,15],[43883,64830,20947],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65126,1],[65128,65131,1],[65279,65281,2],[65282,65312,1],[65339,65344,1],[65371,65381,1],[65392,65438,46],[65439,65504,65],[65505,65510,1],[65512,65518,1],[65529,65533,1],[65792,65794,1],[65799,65843,1],[65847,65855,1],[65936,65948,1],[66e3,66044,1],[66273,66299,1],[113824,113827,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119142,1],[119146,119162,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119488,119507,1],[119520,119539,1],[119552,119638,1],[119648,119672,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120779,1],[120782,120831,1],[126065,126132,1],[126209,126269,1],[126976,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127232,127405,1],[127462,127487,1],[127489,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1],[130032,130041,1],[917505,917536,31],[917537,917631,1]];static foldCommon=[[924,956,32]];static Coptic=[[994,1007,1],[11392,11507,1],[11513,11519,1]];static Cuneiform=[[73728,74649,1],[74752,74862,1],[74864,74868,1],[74880,75075,1]];static Cypriot=[[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3]];static Cypro_Minoan=[[77712,77810,1]];static Cyrillic=[[1024,1156,1],[1159,1327,1],[7296,7304,1],[7467,7544,77],[11744,11775,1],[42560,42655,1],[65070,65071,1],[122928,122989,1],[123023,123023,1]];static Deseret=[[66560,66639,1]];static Devanagari=[[2304,2384,1],[2389,2403,1],[2406,2431,1],[43232,43263,1],[72448,72457,1]];static Dives_Akuru=[[71936,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71989,1],[71991,71992,1],[71995,72006,1],[72016,72025,1]];static Dogra=[[71680,71739,1]];static Duployan=[[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[113820,113823,1]];static Egyptian_Hieroglyphs=[[77824,78933,1]];static Elbasan=[[66816,66855,1]];static Elymaic=[[69600,69622,1]];static Ethiopic=[[4608,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4957,4988,1],[4992,5017,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1]];static Georgian=[[4256,4293,1],[4295,4301,6],[4304,4346,1],[4348,4351,1],[7312,7354,1],[7357,7359,1],[11520,11557,1],[11559,11565,6]];static Glagolitic=[[11264,11359,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1]];static Gothic=[[66352,66378,1]];static Grantha=[[70400,70403,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70460,70468,1],[70471,70472,1],[70475,70477,1],[70480,70487,7],[70493,70499,1],[70502,70508,1],[70512,70516,1]];static Greek=[[880,883,1],[885,887,1],[890,893,1],[895,900,5],[902,904,2],[905,906,1],[908,910,2],[911,929,1],[931,993,1],[1008,1023,1],[7462,7466,1],[7517,7521,1],[7526,7530,1],[7615,7936,321],[7937,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8132,1],[8134,8147,1],[8150,8155,1],[8157,8175,1],[8178,8180,1],[8182,8190,1],[8486,43877,35391],[65856,65934,1],[65952,119296,53344],[119297,119365,1]];static foldGreek=[[181,837,656]];static Gujarati=[[2689,2691,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2748,2757,1],[2759,2761,1],[2763,2765,1],[2768,2784,16],[2785,2787,1],[2790,2801,1],[2809,2815,1]];static Gunjala_Gondi=[[73056,73061,1],[73063,73064,1],[73066,73102,1],[73104,73105,1],[73107,73112,1],[73120,73129,1]];static Gurmukhi=[[2561,2563,1],[2565,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2649,8],[2650,2652,1],[2654,2662,8],[2663,2678,1]];static Han=[[11904,11929,1],[11931,12019,1],[12032,12245,1],[12293,12295,2],[12321,12329,1],[12344,12347,1],[13312,19903,1],[19968,40959,1],[63744,64109,1],[64112,64217,1],[94178,94179,1],[94192,94193,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Hangul=[[4352,4607,1],[12334,12335,1],[12593,12686,1],[12800,12830,1],[12896,12926,1],[43360,43388,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1]];static Hanifi_Rohingya=[[68864,68903,1],[68912,68921,1]];static Hanunoo=[[5920,5940,1]];static Hatran=[[67808,67826,1],[67828,67829,1],[67835,67839,1]];static Hebrew=[[1425,1479,1],[1488,1514,1],[1519,1524,1],[64285,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64335,1]];static Hiragana=[[12353,12438,1],[12445,12447,1],[110593,110879,1],[110898,110928,30],[110929,110930,1],[127488,127488,1]];static Imperial_Aramaic=[[67648,67669,1],[67671,67679,1]];static Inherited=[[768,879,1],[1157,1158,1],[1611,1621,1],[1648,2385,737],[2386,2388,1],[6832,6862,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8204,8205,1],[8400,8432,1],[12330,12333,1],[12441,12442,1],[65024,65039,1],[65056,65069,1],[66045,66272,227],[70459,118528,48069],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[917760,917999,1]];static foldInherited=[[921,953,32],[8126,8126,1]];static Inscriptional_Pahlavi=[[68448,68466,1],[68472,68479,1]];static Inscriptional_Parthian=[[68416,68437,1],[68440,68447,1]];static Javanese=[[43392,43469,1],[43472,43481,1],[43486,43487,1]];static Kaithi=[[69760,69826,1],[69837,69837,1]];static Kannada=[[3200,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3260,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3293,3294,1],[3296,3299,1],[3302,3311,1],[3313,3315,1]];static Katakana=[[12449,12538,1],[12541,12543,1],[12784,12799,1],[13008,13054,1],[13056,13143,1],[65382,65391,1],[65393,65437,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110880,288],[110881,110882,1],[110933,110948,15],[110949,110951,1]];static Kawi=[[73472,73488,1],[73490,73530,1],[73534,73561,1]];static Kayah_Li=[[43264,43309,1],[43311,43311,1]];static Kharoshthi=[[68096,68099,1],[68101,68102,1],[68108,68115,1],[68117,68119,1],[68121,68149,1],[68152,68154,1],[68159,68168,1],[68176,68184,1]];static Khitan_Small_Script=[[94180,101120,6940],[101121,101589,1]];static Khmer=[[6016,6109,1],[6112,6121,1],[6128,6137,1],[6624,6655,1]];static Khojki=[[70144,70161,1],[70163,70209,1]];static Khudawadi=[[70320,70378,1],[70384,70393,1]];static Lao=[[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3773,1],[3776,3780,1],[3782,3784,2],[3785,3790,1],[3792,3801,1],[3804,3807,1]];static Latin=[[65,90,1],[97,122,1],[170,186,16],[192,214,1],[216,246,1],[248,696,1],[736,740,1],[7424,7461,1],[7468,7516,1],[7522,7525,1],[7531,7543,1],[7545,7614,1],[7680,7935,1],[8305,8319,14],[8336,8348,1],[8490,8491,1],[8498,8526,28],[8544,8584,1],[11360,11391,1],[42786,42887,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43007,1],[43824,43866,1],[43868,43876,1],[43878,43881,1],[64256,64262,1],[65313,65338,1],[65345,65370,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[122624,122654,1],[122661,122666,1]];static Lepcha=[[7168,7223,1],[7227,7241,1],[7245,7247,1]];static Limbu=[[6400,6430,1],[6432,6443,1],[6448,6459,1],[6464,6468,4],[6469,6479,1]];static Linear_A=[[67072,67382,1],[67392,67413,1],[67424,67431,1]];static Linear_B=[[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1]];static Lisu=[[42192,42239,1],[73648,73648,1]];static Lycian=[[66176,66204,1]];static Lydian=[[67872,67897,1],[67903,67903,1]];static Mahajani=[[69968,70006,1]];static Makasar=[[73440,73464,1]];static Malayalam=[[3328,3340,1],[3342,3344,1],[3346,3396,1],[3398,3400,1],[3402,3407,1],[3412,3427,1],[3430,3455,1]];static Mandaic=[[2112,2139,1],[2142,2142,1]];static Manichaean=[[68288,68326,1],[68331,68342,1]];static Marchen=[[72816,72847,1],[72850,72871,1],[72873,72886,1]];static Masaram_Gondi=[[72960,72966,1],[72968,72969,1],[72971,73014,1],[73018,73020,2],[73021,73023,2],[73024,73031,1],[73040,73049,1]];static Medefaidrin=[[93760,93850,1]];static Meetei_Mayek=[[43744,43766,1],[43968,44013,1],[44016,44025,1]];static Mende_Kikakui=[[124928,125124,1],[125127,125142,1]];static Meroitic_Cursive=[[68e3,68023,1],[68028,68047,1],[68050,68095,1]];static Meroitic_Hieroglyphs=[[67968,67999,1]];static Miao=[[93952,94026,1],[94031,94087,1],[94095,94111,1]];static Modi=[[71168,71236,1],[71248,71257,1]];static Mongolian=[[6144,6145,1],[6148,6150,2],[6151,6169,1],[6176,6264,1],[6272,6314,1],[71264,71276,1]];static Mro=[[92736,92766,1],[92768,92777,1],[92782,92783,1]];static Multani=[[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70313,1]];static Myanmar=[[4096,4255,1],[43488,43518,1],[43616,43647,1]];static Nabataean=[[67712,67742,1],[67751,67759,1]];static Nag_Mundari=[[124112,124153,1]];static Nandinagari=[[72096,72103,1],[72106,72151,1],[72154,72164,1]];static New_Tai_Lue=[[6528,6571,1],[6576,6601,1],[6608,6618,1],[6622,6623,1]];static Newa=[[70656,70747,1],[70749,70753,1]];static Nko=[[1984,2042,1],[2045,2047,1]];static Nushu=[[94177,110960,16783],[110961,111355,1]];static Nyiakeng_Puachue_Hmong=[[123136,123180,1],[123184,123197,1],[123200,123209,1],[123214,123215,1]];static Ogham=[[5760,5788,1]];static Ol_Chiki=[[7248,7295,1]];static Old_Hungarian=[[68736,68786,1],[68800,68850,1],[68858,68863,1]];static Old_Italic=[[66304,66339,1],[66349,66351,1]];static Old_North_Arabian=[[68224,68255,1]];static Old_Permic=[[66384,66426,1]];static Old_Persian=[[66464,66499,1],[66504,66517,1]];static Old_Sogdian=[[69376,69415,1]];static Old_South_Arabian=[[68192,68223,1]];static Old_Turkic=[[68608,68680,1]];static Old_Uyghur=[[69488,69513,1]];static Oriya=[[2817,2819,1],[2821,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2876,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2908,2909,1],[2911,2915,1],[2918,2935,1]];static Osage=[[66736,66771,1],[66776,66811,1]];static Osmanya=[[66688,66717,1],[66720,66729,1]];static Pahawh_Hmong=[[92928,92997,1],[93008,93017,1],[93019,93025,1],[93027,93047,1],[93053,93071,1]];static Palmyrene=[[67680,67711,1]];static Pau_Cin_Hau=[[72384,72440,1]];static Phags_Pa=[[43072,43127,1]];static Phoenician=[[67840,67867,1],[67871,67871,1]];static Psalter_Pahlavi=[[68480,68497,1],[68505,68508,1],[68521,68527,1]];static Rejang=[[43312,43347,1],[43359,43359,1]];static Runic=[[5792,5866,1],[5870,5880,1]];static Samaritan=[[2048,2093,1],[2096,2110,1]];static Saurashtra=[[43136,43205,1],[43214,43225,1]];static Sharada=[[70016,70111,1]];static Shavian=[[66640,66687,1]];static Siddham=[[71040,71093,1],[71096,71133,1]];static SignWriting=[[120832,121483,1],[121499,121503,1],[121505,121519,1]];static Sinhala=[[3457,3459,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3558,3567,1],[3570,3572,1],[70113,70132,1]];static Sogdian=[[69424,69465,1]];static Sora_Sompeng=[[69840,69864,1],[69872,69881,1]];static Soyombo=[[72272,72354,1]];static Sundanese=[[7040,7103,1],[7360,7367,1]];static Syloti_Nagri=[[43008,43052,1]];static Syriac=[[1792,1805,1],[1807,1866,1],[1869,1871,1],[2144,2154,1]];static Tagalog=[[5888,5909,1],[5919,5919,1]];static Tagbanwa=[[5984,5996,1],[5998,6e3,1],[6002,6003,1]];static Tai_Le=[[6480,6509,1],[6512,6516,1]];static Tai_Tham=[[6688,6750,1],[6752,6780,1],[6783,6793,1],[6800,6809,1],[6816,6829,1]];static Tai_Viet=[[43648,43714,1],[43739,43743,1]];static Takri=[[71296,71353,1],[71360,71369,1]];static Tamil=[[2946,2947,1],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3006,3010,1],[3014,3016,1],[3018,3021,1],[3024,3031,7],[3046,3066,1],[73664,73713,1],[73727,73727,1]];static Tangsa=[[92784,92862,1],[92864,92873,1]];static Tangut=[[94176,94208,32],[94209,100343,1],[100352,101119,1],[101632,101640,1]];static Telugu=[[3072,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3132,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3160,3162,1],[3165,3168,3],[3169,3171,1],[3174,3183,1],[3191,3199,1]];static Thaana=[[1920,1969,1]];static Thai=[[3585,3642,1],[3648,3675,1]];static Tibetan=[[3840,3911,1],[3913,3948,1],[3953,3991,1],[3993,4028,1],[4030,4044,1],[4046,4052,1],[4057,4058,1]];static Tifinagh=[[11568,11623,1],[11631,11632,1],[11647,11647,1]];static Tirhuta=[[70784,70855,1],[70864,70873,1]];static Toto=[[123536,123566,1]];static Ugaritic=[[66432,66461,1],[66463,66463,1]];static Vai=[[42240,42539,1]];static Vithkuqi=[[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1]];static Wancho=[[123584,123641,1],[123647,123647,1]];static Warang_Citi=[[71840,71922,1],[71935,71935,1]];static Yezidi=[[69248,69289,1],[69291,69293,1],[69296,69297,1]];static Yi=[[40960,42124,1],[42128,42182,1]];static Zanabazar_Square=[[72192,72263,1]];static CATEGORIES=new Map([[`C`,e.C],[`Cc`,e.Cc],[`Cf`,e.Cf],[`Co`,e.Co],[`Cs`,e.Cs],[`L`,e.L],[`Ll`,e.Ll],[`Lm`,e.Lm],[`Lo`,e.Lo],[`Lt`,e.Lt],[`Lu`,e.Lu],[`M`,e.M],[`Mc`,e.Mc],[`Me`,e.Me],[`Mn`,e.Mn],[`N`,e.N],[`Nd`,e.Nd],[`Nl`,e.Nl],[`No`,e.No],[`P`,e.P],[`Pc`,e.Pc],[`Pd`,e.Pd],[`Pe`,e.Pe],[`Pf`,e.Pf],[`Pi`,e.Pi],[`Po`,e.Po],[`Ps`,e.Ps],[`S`,e.S],[`Sc`,e.Sc],[`Sk`,e.Sk],[`Sm`,e.Sm],[`So`,e.So],[`Z`,e.Z],[`Zl`,e.Zl],[`Zp`,e.Zp],[`Zs`,e.Zs]]);static SCRIPTS=new Map([[`Adlam`,e.Adlam],[`Ahom`,e.Ahom],[`Anatolian_Hieroglyphs`,e.Anatolian_Hieroglyphs],[`Arabic`,e.Arabic],[`Armenian`,e.Armenian],[`Avestan`,e.Avestan],[`Balinese`,e.Balinese],[`Bamum`,e.Bamum],[`Bassa_Vah`,e.Bassa_Vah],[`Batak`,e.Batak],[`Bengali`,e.Bengali],[`Bhaiksuki`,e.Bhaiksuki],[`Bopomofo`,e.Bopomofo],[`Brahmi`,e.Brahmi],[`Braille`,e.Braille],[`Buginese`,e.Buginese],[`Buhid`,e.Buhid],[`Canadian_Aboriginal`,e.Canadian_Aboriginal],[`Carian`,e.Carian],[`Caucasian_Albanian`,e.Caucasian_Albanian],[`Chakma`,e.Chakma],[`Cham`,e.Cham],[`Cherokee`,e.Cherokee],[`Chorasmian`,e.Chorasmian],[`Common`,e.Common],[`Coptic`,e.Coptic],[`Cuneiform`,e.Cuneiform],[`Cypriot`,e.Cypriot],[`Cypro_Minoan`,e.Cypro_Minoan],[`Cyrillic`,e.Cyrillic],[`Deseret`,e.Deseret],[`Devanagari`,e.Devanagari],[`Dives_Akuru`,e.Dives_Akuru],[`Dogra`,e.Dogra],[`Duployan`,e.Duployan],[`Egyptian_Hieroglyphs`,e.Egyptian_Hieroglyphs],[`Elbasan`,e.Elbasan],[`Elymaic`,e.Elymaic],[`Ethiopic`,e.Ethiopic],[`Georgian`,e.Georgian],[`Glagolitic`,e.Glagolitic],[`Gothic`,e.Gothic],[`Grantha`,e.Grantha],[`Greek`,e.Greek],[`Gujarati`,e.Gujarati],[`Gunjala_Gondi`,e.Gunjala_Gondi],[`Gurmukhi`,e.Gurmukhi],[`Han`,e.Han],[`Hangul`,e.Hangul],[`Hanifi_Rohingya`,e.Hanifi_Rohingya],[`Hanunoo`,e.Hanunoo],[`Hatran`,e.Hatran],[`Hebrew`,e.Hebrew],[`Hiragana`,e.Hiragana],[`Imperial_Aramaic`,e.Imperial_Aramaic],[`Inherited`,e.Inherited],[`Inscriptional_Pahlavi`,e.Inscriptional_Pahlavi],[`Inscriptional_Parthian`,e.Inscriptional_Parthian],[`Javanese`,e.Javanese],[`Kaithi`,e.Kaithi],[`Kannada`,e.Kannada],[`Katakana`,e.Katakana],[`Kawi`,e.Kawi],[`Kayah_Li`,e.Kayah_Li],[`Kharoshthi`,e.Kharoshthi],[`Khitan_Small_Script`,e.Khitan_Small_Script],[`Khmer`,e.Khmer],[`Khojki`,e.Khojki],[`Khudawadi`,e.Khudawadi],[`Lao`,e.Lao],[`Latin`,e.Latin],[`Lepcha`,e.Lepcha],[`Limbu`,e.Limbu],[`Linear_A`,e.Linear_A],[`Linear_B`,e.Linear_B],[`Lisu`,e.Lisu],[`Lycian`,e.Lycian],[`Lydian`,e.Lydian],[`Mahajani`,e.Mahajani],[`Makasar`,e.Makasar],[`Malayalam`,e.Malayalam],[`Mandaic`,e.Mandaic],[`Manichaean`,e.Manichaean],[`Marchen`,e.Marchen],[`Masaram_Gondi`,e.Masaram_Gondi],[`Medefaidrin`,e.Medefaidrin],[`Meetei_Mayek`,e.Meetei_Mayek],[`Mende_Kikakui`,e.Mende_Kikakui],[`Meroitic_Cursive`,e.Meroitic_Cursive],[`Meroitic_Hieroglyphs`,e.Meroitic_Hieroglyphs],[`Miao`,e.Miao],[`Modi`,e.Modi],[`Mongolian`,e.Mongolian],[`Mro`,e.Mro],[`Multani`,e.Multani],[`Myanmar`,e.Myanmar],[`Nabataean`,e.Nabataean],[`Nag_Mundari`,e.Nag_Mundari],[`Nandinagari`,e.Nandinagari],[`New_Tai_Lue`,e.New_Tai_Lue],[`Newa`,e.Newa],[`Nko`,e.Nko],[`Nushu`,e.Nushu],[`Nyiakeng_Puachue_Hmong`,e.Nyiakeng_Puachue_Hmong],[`Ogham`,e.Ogham],[`Ol_Chiki`,e.Ol_Chiki],[`Old_Hungarian`,e.Old_Hungarian],[`Old_Italic`,e.Old_Italic],[`Old_North_Arabian`,e.Old_North_Arabian],[`Old_Permic`,e.Old_Permic],[`Old_Persian`,e.Old_Persian],[`Old_Sogdian`,e.Old_Sogdian],[`Old_South_Arabian`,e.Old_South_Arabian],[`Old_Turkic`,e.Old_Turkic],[`Old_Uyghur`,e.Old_Uyghur],[`Oriya`,e.Oriya],[`Osage`,e.Osage],[`Osmanya`,e.Osmanya],[`Pahawh_Hmong`,e.Pahawh_Hmong],[`Palmyrene`,e.Palmyrene],[`Pau_Cin_Hau`,e.Pau_Cin_Hau],[`Phags_Pa`,e.Phags_Pa],[`Phoenician`,e.Phoenician],[`Psalter_Pahlavi`,e.Psalter_Pahlavi],[`Rejang`,e.Rejang],[`Runic`,e.Runic],[`Samaritan`,e.Samaritan],[`Saurashtra`,e.Saurashtra],[`Sharada`,e.Sharada],[`Shavian`,e.Shavian],[`Siddham`,e.Siddham],[`SignWriting`,e.SignWriting],[`Sinhala`,e.Sinhala],[`Sogdian`,e.Sogdian],[`Sora_Sompeng`,e.Sora_Sompeng],[`Soyombo`,e.Soyombo],[`Sundanese`,e.Sundanese],[`Syloti_Nagri`,e.Syloti_Nagri],[`Syriac`,e.Syriac],[`Tagalog`,e.Tagalog],[`Tagbanwa`,e.Tagbanwa],[`Tai_Le`,e.Tai_Le],[`Tai_Tham`,e.Tai_Tham],[`Tai_Viet`,e.Tai_Viet],[`Takri`,e.Takri],[`Tamil`,e.Tamil],[`Tangsa`,e.Tangsa],[`Tangut`,e.Tangut],[`Telugu`,e.Telugu],[`Thaana`,e.Thaana],[`Thai`,e.Thai],[`Tibetan`,e.Tibetan],[`Tifinagh`,e.Tifinagh],[`Tirhuta`,e.Tirhuta],[`Toto`,e.Toto],[`Ugaritic`,e.Ugaritic],[`Vai`,e.Vai],[`Vithkuqi`,e.Vithkuqi],[`Wancho`,e.Wancho],[`Warang_Citi`,e.Warang_Citi],[`Yezidi`,e.Yezidi],[`Yi`,e.Yi],[`Zanabazar_Square`,e.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([[`L`,e.foldL],[`Ll`,e.foldLl],[`Lt`,e.foldLt],[`Lu`,e.foldLu],[`M`,e.foldM],[`Mn`,e.foldMn]]);static FOLD_SCRIPT=new Map([[`Common`,e.foldCommon],[`Greek`,e.foldGreek],[`Inherited`,e.foldInherited]])},_=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2),a=e[i];if(a[0]<=t&&t<=a[1])return(t-a[0])%a[2]===0;t<a[0]?r=i:n=i+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let n of e)if(!(t>n[1]))return t<n[0]?!1:(t-n[0])%n[2]===0;return!1}return e.length>0&&t>=e[0][0]&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){let t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(_e.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<127||e>=161&&e!==173:this.is(_e.L,e)||this.is(_e.M,e)||this.is(_e.N,e)||this.is(_e.P,e)||this.is(_e.S,e)}static simpleFold(e){if(_e.CASE_ORBIT.has(e))return _e.CASE_ORBIT.get(e);let t=g.toLowerCase(e);return t===e?g.toUpperCase(e):t}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return g.CODES.get(`A`)<=e&&e<=g.CODES.get(`Z`)&&(e|=32),g.CODES.get(`A`)<=t&&t<=g.CODES.get(`Z`)&&(t|=32),e===t;for(let n=this.simpleFold(e);n!==e;n=this.simpleFold(n))if(n===t)return!0;return!1}},v=class{static METACHARACTERS=`\\.+*?()|[]{}^$`;static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(e){return g.CODES.get(`0`)<=e&&e<=g.CODES.get(`9`)||g.CODES.get(`a`)<=e&&e<=g.CODES.get(`z`)||g.CODES.get(`A`)<=e&&e<=g.CODES.get(`Z`)}static unhex(e){return g.CODES.get(`0`)<=e&&e<=g.CODES.get(`9`)?e-g.CODES.get(`0`):g.CODES.get(`a`)<=e&&e<=g.CODES.get(`f`)?e-g.CODES.get(`a`)+10:g.CODES.get(`A`)<=e&&e<=g.CODES.get(`F`)?e-g.CODES.get(`A`)+10:-1}static escapeRune(e){let t=``;if(_.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+=`\\`),t+=String.fromCodePoint(e);else switch(e){case g.CODES.get(`"`):t+=`\\"`;break;case g.CODES.get(`\\`):t+=`\\\\`;break;case g.CODES.get(` `):t+=`\\t`;break;case g.CODES.get(`
|
|
11
|
+
`):t+=`\\n`;break;case g.CODES.get(`\r`):t+=`\\r`;break;case g.CODES.get(`\b`):t+=`\\b`;break;case g.CODES.get(`\f`):t+=`\\f`;break;default:{let n=e.toString(16);e<256?(t+=`\\x`,n.length===1&&(t+=`0`),t+=n):t+=`\\x{${n}}`;break}}return t}static stringToRunes(e){return String(e).split(``).map(e=>e.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return g.CODES.get(`a`)<=e&&e<=g.CODES.get(`z`)||g.CODES.get(`A`)<=e&&e<=g.CODES.get(`Z`)||g.CODES.get(`0`)<=e&&e<=g.CODES.get(`9`)||e===g.CODES.get(`_`)}static emptyOpContext(e,t){let n=0;return e<0&&(n|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===g.CODES.get(`
|
|
12
|
+
`)&&(n|=this.EMPTY_BEGIN_LINE),t<0&&(n|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===g.CODES.get(`
|
|
13
|
+
`)&&(n|=this.EMPTY_END_LINE),this.isWordRune(e)===this.isWordRune(t)?n|=this.EMPTY_NO_WORD_BOUNDARY:n|=this.EMPTY_WORD_BOUNDARY,n}static quoteMeta(e){return e.split(``).map(e=>this.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join(``)}static charCount(e){return e>_.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(e));{let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder(`utf-8`).decode(new Uint8Array(e));{let t=[],n=0,r=0;for(;n<e.length;){let i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){let a=e[n++];t[r++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){let a=e[n++],o=e[n++],s=e[n++],c=((i&7)<<18|(a&63)<<12|(o&63)<<6|s&63)-65536;t[r++]=String.fromCharCode(55296+(c>>10)),t[r++]=String.fromCharCode(56320+(c&1023))}else{let a=e[n++],o=e[n++];t[r++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63)}}return t.join(``)}}},y=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let i=e[r],a=t+r;n[i]=a,n[a]=i}return Object.freeze(n)},ve=class e{static Encoding=y([`UTF_16`,`UTF_8`]);getEncoding(){throw Error(`not implemented`)}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},ye=class extends ve{constructor(e=null){super(),this.bytes=e}getEncoding(){return ve.Encoding.UTF_8}asCharSequence(){return v.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},be=class extends ve{constructor(e=null){super(),this.charSequence=e}getEncoding(){return ve.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split(``).map(e=>e.codePointAt(0))}length(){return this.charSequence.length}},xe=class{static utf16(e){return new be(e)}static utf8(e){return Array.isArray(e)?new ye(e):new ye(v.stringToUtf8ByteArray(e))}},Se=class extends Error{constructor(e){super(e),this.name=`RE2JSException`}},b=class extends Se{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name=`RE2JSSyntaxException`,this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}},Ce=class extends Se{constructor(e){super(e),this.name=`RE2JSCompileException`}},we=class extends Se{constructor(e){super(e),this.name=`RE2JSGroupException`}},Te=class extends Se{constructor(e){super(e),this.name=`RE2JSFlagsException`}},Ee=class{static quoteReplacement(e){return e.indexOf(`\\`)<0&&e.indexOf(`$`)<0?e:e.split(``).map(e=>{let t=e.codePointAt(0);return t===g.CODES[`\\`]||t===g.CODES.$?`\\${e}`:e}).join(``)}constructor(e,t){if(e===null)throw Error(`pattern is null`);this.patternInput=e;let n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,t instanceof ve?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(xe.utf8(t)):this.resetMatcherInput(xe.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw Error(`input is null`);return this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new we(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new we(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}group(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new we(`group '${e}' not found`);e=t}let t=this.start(e),n=this.end(e);return t<0&&n<0?null:this.substring(t,n)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new we(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new we(`perhaps no match attempted`);if(e===0||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);let n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!n[0])throw new we(`inconsistency in matching group data`);this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,h.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,h.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new we(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,h.UNANCHORED)}genMatch(e,t){let n=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0):!1}substring(e,t){return this.matcherInput.isUTF8Encoding()?v.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let n=``,r=this.start(),i=this.end();return this.appendPos<r&&(n+=this.substring(this.appendPos,r)),this.appendPos=i,n+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),n}appendReplacementInternal(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++){if(e.codePointAt(i)===g.CODES.get(`\\`)){n<i&&(t+=e.substring(n,i)),i++,n=i;continue}if(e.codePointAt(i)===g.CODES.get(`$`)){let a=e.codePointAt(i+1);if(g.CODES.get(`0`)<=a&&a<=g.CODES.get(`9`)){let o=a-g.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<g.CODES.get(`0`)||a>g.CODES.get(`9`)||o*10+a-g.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-g.CODES.get(`0`);if(o>this.patternGroupCount)throw new we(`n > number of groups: ${o}`);let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===g.CODES.get(`{`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==g.CODES.get(`}`)&&e.codePointAt(r)!==g.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==g.CODES.get(`}`))throw new we(`named capture group is missing trailing '}'`);let a=e.substring(i+1,r);t+=this.group(a),n=r+1}}}return n<r&&(t+=e.substring(n,r)),t}appendReplacementInternalPerl(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++)if(e.codePointAt(i)===g.CODES.get(`$`)){let a=e.codePointAt(i+1);if(g.CODES.get(`$`)===a){n<i&&(t+=e.substring(n,i)),t+=`$`,i++,n=i+1;continue}else if(g.CODES.get(`&`)===a){n<i&&(t+=e.substring(n,i));let r=this.group(0);r===null?t+=`$&`:t+=r,i++,n=i+1;continue}else if(g.CODES.get(`1`)<=a&&a<=g.CODES.get(`9`)){let o=a-g.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<g.CODES.get(`0`)||a>g.CODES.get(`9`)||o*10+a-g.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-g.CODES.get(`0`);if(o>this.patternGroupCount){t+=`$${o}`,n=i,i--;continue}let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===g.CODES.get(`<`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==g.CODES.get(`>`)&&e.codePointAt(r)!==g.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==g.CODES.get(`>`)){t+=e.substring(i-1,r+1),n=r+1;continue}let a=e.substring(i+1,r);Object.prototype.hasOwnProperty.call(this.namedGroups,a)?t+=this.group(a):t+=`$<${a}>`,n=r+1}}return n<r&&(t+=e.substring(n,r)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,n=!1){let r=``;for(this.reset();this.find()&&(r+=this.appendReplacement(e,n),t););return r+=this.appendTail(),r}},De=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},Oe=class extends De{constructor(e,t=0,n=e.length){super(),this.bytes=e,this.start=t,this.end=n}step(e){if(e+=this.start,e>=this.end)return De.EOF();let t=this.bytes[e++]&255;return t&128?(t&224)==192?(t&=31,e>=this.end?De.EOF():(t=t<<6|this.bytes[e++]&63,t<<3|2)):(t&240)==224?(t&=15,e+1>=this.end?De.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|3)):(t&=7,e+2>=this.end?De.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|4)):t<<3|1}index(e,t){t+=this.start;let n=this.indexOf(this.bytes,e.prefixUTF8,t);return n<0?n:n-t}context(e){e+=this.start;let t=-1;if(e>this.start&&e<=this.end){let n=e-1;if(t=this.bytes[n--],t>=128){let r=e-4;for(r<this.start&&(r=this.start);n>=r&&(this.bytes[n]&192)==128;)n--;n<this.start&&(n=this.start),t=this.step(n)>>3}}let n=e<this.end?this.step(e)>>3:-1;return v.emptyOpContext(t,n)}indexOf(e,t,n=0){let r=t.length;if(r===0)return-1;let i=e.length;for(let a=n;a<=i-r;a++)for(let n=0;n<r&&e[a+n]===t[n];n++)if(n===r-1)return a;return-1}},ke=class extends De{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}step(e){if(e+=this.start,e<this.end){let t=this.charSequence.codePointAt(e);return t<<3|v.charCount(t)}else return De.EOF()}index(e,t){t+=this.start;let n=this.charSequence.indexOf(e.prefix,t);return n<0?n:n-t}context(e){e+=this.start;let t=e>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,n=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return v.emptyOpContext(t,n)}},x=class{static fromUTF8(e,t=0,n=e.length){return new Oe(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new ke(e,t,n)}},S=class e{static Op=y([`NO_MATCH`,`EMPTY_MATCH`,`LITERAL`,`CHAR_CLASS`,`ANY_CHAR_NOT_NL`,`ANY_CHAR`,`BEGIN_LINE`,`END_LINE`,`BEGIN_TEXT`,`END_TEXT`,`WORD_BOUNDARY`,`NO_WORD_BOUNDARY`,`CAPTURE`,`STAR`,`PLUS`,`QUEST`,`REPEAT`,`CONCAT`,`ALTERNATE`,`LEFT_PAREN`,`VERTICAL_BAR`]);static isPseudoOp(t){return t>=e.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===g.CODES.get(`-`)?`\\`:``}static fromRegexp(t){let n=new e(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n}constructor(t){this.op=t,this.flags=0,this.subs=e.emptySubs(),this.runes=null,this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=e.emptySubs(),this.runes=null,this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t=``;switch(this.op){case e.Op.NO_MATCH:t+=`[^\\x00-\\x{10FFFF}]`;break;case e.Op.EMPTY_MATCH:t+=`(?:)`;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:case e.Op.REPEAT:{let n=this.subs[0];switch(n.op>e.Op.CAPTURE||n.op===e.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case e.Op.STAR:t+=`*`;break;case e.Op.PLUS:t+=`+`;break;case e.Op.QUEST:t+=`?`;break;case e.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=`,`,this.max>=0&&(t+=this.max)),t+=`}`;break}(this.flags&h.NON_GREEDY)!==0&&(t+=`?`);break}case e.Op.CONCAT:for(let n of this.subs)n.op===e.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break;case e.Op.ALTERNATE:{let e=``;for(let n of this.subs)t+=e,e=`|`,t+=n.appendTo();break}case e.Op.LITERAL:(this.flags&h.FOLD_CASE)!==0&&(t+=`(?i:`);for(let e of this.runes)t+=v.escapeRune(e);(this.flags&h.FOLD_CASE)!==0&&(t+=`)`);break;case e.Op.ANY_CHAR_NOT_NL:t+=`(?-s:.)`;break;case e.Op.ANY_CHAR:t+=`(?s:.)`;break;case e.Op.CAPTURE:this.name===null||this.name.length===0?t+=`(`:t+=`(?P<${this.name}>`,this.subs[0].op!==e.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=`)`;break;case e.Op.BEGIN_TEXT:t+=`\\A`;break;case e.Op.END_TEXT:(this.flags&h.WAS_DOLLAR)===0?t+=`\\z`:t+=`(?-m:$)`;break;case e.Op.BEGIN_LINE:t+=`^`;break;case e.Op.END_LINE:t+=`$`;break;case e.Op.WORD_BOUNDARY:t+=`\\b`;break;case e.Op.NO_WORD_BOUNDARY:t+=`\\B`;break;case e.Op.CHAR_CLASS:if(this.runes.length%2!=0){t+=`[invalid char class]`;break}if(t+=`[`,this.runes.length===0)t+=`^\\x00-\\x{10FFFF}`;else if(this.runes[0]===0&&this.runes[this.runes.length-1]===_.MAX_RUNE){t+=`^`;for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,i=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=v.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=v.escapeRune(i))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],i=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=v.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=v.escapeRune(i))}t+=`]`;break;default:t+=this.op;break}return t}maxCap(){let t=0;if(this.op===e.Op.CAPTURE&&(t=this.cap),this.subs!==null)for(let e of this.subs){let n=e.maxCap();t<n&&(t=n)}return t}equals(t){if(!(t!==null&&t instanceof e)||this.op!==t.op)return!1;switch(this.op){case e.Op.END_TEXT:if((this.flags&h.WAS_DOLLAR)!==(t.flags&h.WAS_DOLLAR))return!1;break;case e.Op.LITERAL:case e.Op.CHAR_CLASS:if(this.runes===null&&t.runes===null)break;if(this.runes===null||t.runes===null||this.runes.length!==t.runes.length)return!1;for(let e=0;e<this.runes.length;e++)if(this.runes[e]!==t.runes[e])return!1;break;case e.Op.ALTERNATE:case e.Op.CONCAT:if(this.subs.length!==t.subs.length)return!1;for(let e=0;e<this.subs.length;++e)if(!this.subs[e].equals(t.subs[e]))return!1;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:if((this.flags&h.NON_GREEDY)!==(t.flags&h.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.REPEAT:if((this.flags&h.NON_GREEDY)!==(t.flags&h.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.CAPTURE:if(this.cap!==t.cap||(this.name===null?t.name!==null:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break}return!0}},C=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(e){let t=`"`;for(let n of e)t+=v.escapeRune(n);return t+=`"`,t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=null}matchRune(e){if(this.runes.length===1){let t=this.runes[0];return(this.arg&h.FOLD_CASE)===0?e===t:_.equalsIgnoreCase(t,e)}for(let t=0;t<this.runes.length&&t<=8;t+=2){if(e<this.runes[t])return!1;if(e<=this.runes[t+1])return!0}let t=0,n=this.runes.length/2|0;for(;t<n;){let r=t+((n-t)/2|0);if(this.runes[2*r]<=e){if(e<=this.runes[2*r+1])return!0;t=r+1}else n=r}return!1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return`match`;case e.FAIL:return`fail`;case e.NOP:return`nop -> ${this.out}`;case e.RUNE:return this.runes===null?`rune <null>`:[`rune `,e.escapeRunes(this.runes),(this.arg&h.FOLD_CASE)===0?``:`/i`,` -> `,this.out].join(``);case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw Error(`unhandled case in Inst.toString`)}}},Ae=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new C(e))}skipNop(e){let t=this.inst[e];for(;t.op===C.NOP||t.op===C.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e=``,t=this.skipNop(this.start);if(!C.isRuneOp(t.op)||t.runes.length!==1)return[t.op===C.MATCH,e];for(;C.isRuneOp(t.op)&&t.runes.length===1&&(t.arg&h.FOLD_CASE)===0;)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===C.MATCH,e]}startCond(){let e=0,t=this.start;loop:for(;;){let n=this.inst[t];switch(n.op){case C.EMPTY_WIDTH:e|=n.arg;break;case C.FAIL:return-1;case C.CAPTURE:case C.NOP:break;default:break loop}t=n.out}return e}next(e){let t=this.inst[e>>1];return e&1?t.arg:t.out}patch(e,t){for(;e!==0;){let n=this.inst[e>>1];e&1?(e=n.arg,n.arg=t):(e=n.out,n.out=t)}}append(e,t){if(e===0)return t;if(t===0)return e;let n=e;for(;;){let e=this.next(n);if(e===0)break;n=e}let r=this.inst[n>>1];return n&1?r.arg=t:r.out=t,e}toString(){let e=``;for(let t=0;t<this.inst.length;t++){let n=e.length;e+=t,t===this.start&&(e+=`*`),e+=` `.substring(e.length-n),e+=this.inst[t],e+=`
|
|
14
|
+
`}return e}},je=class{constructor(e=0,t=0,n=!1){this.i=e,this.out=t,this.nullable=n}},Me=class e{static ANY_RUNE_NOT_NL(){return[0,g.CODES.get(`
|
|
15
|
+
`)-1,g.CODES.get(`
|
|
16
|
+
`)+1,_.MAX_RUNE]}static ANY_RUNE(){return[0,_.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(C.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new Ae,this.newInst(C.FAIL)}newInst(e){return this.prog.addInst(e),new je(this.prog.numInst()-1,0,!0)}nop(){let e=this.newInst(C.NOP);return e.out=e.i<<1,e}fail(){return new je}cap(e){let t=this.newInst(C.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return e.i===0||t.i===0?this.fail():(this.prog.patch(e.out,t.i),new je(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(e.i===0)return t;if(t.i===0)return e;let n=this.newInst(C.ALT),r=this.prog.getInst(n.i);return r.out=e.i,r.arg=t.i,n.out=this.prog.append(e.out,t.out),n.nullable=e.nullable||t.nullable,n}loop(e,t){let n=this.newInst(C.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),this.prog.patch(e.out,n.i),n}quest(e,t){let n=this.newInst(C.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),n.out=this.prog.append(n.out,e.out),n}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new je(e.i,this.loop(e,t).out,e.nullable)}empty(e){let t=this.newInst(C.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){let n=this.newInst(C.RUNE);n.nullable=!1;let r=this.prog.getInst(n.i);return r.runes=e,t&=h.FOLD_CASE,(e.length!==1||_.simpleFold(e[0])===e[0])&&(t&=~h.FOLD_CASE),r.arg=t,n.out=n.i<<1,(t&h.FOLD_CASE)===0&&e.length===1||e.length===2&&e[0]===e[1]?r.op=C.RUNE1:e.length===2&&e[0]===0&&e[1]===_.MAX_RUNE?r.op=C.RUNE_ANY:e.length===4&&e[0]===0&&e[1]===g.CODES.get(`
|
|
17
|
+
`)-1&&e[2]===g.CODES.get(`
|
|
18
|
+
`)+1&&e[3]===_.MAX_RUNE&&(r.op=C.RUNE_ANY_NOT_NL),n}compile(t){switch(t.op){case S.Op.NO_MATCH:return this.fail();case S.Op.EMPTY_MATCH:return this.nop();case S.Op.LITERAL:if(t.runes.length===0)return this.nop();{let e=null;for(let n of t.runes){let r=this.rune([n],t.flags);e=e===null?r:this.cat(e,r)}return e}case S.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case S.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case S.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case S.Op.BEGIN_LINE:return this.empty(v.EMPTY_BEGIN_LINE);case S.Op.END_LINE:return this.empty(v.EMPTY_END_LINE);case S.Op.BEGIN_TEXT:return this.empty(v.EMPTY_BEGIN_TEXT);case S.Op.END_TEXT:return this.empty(v.EMPTY_END_TEXT);case S.Op.WORD_BOUNDARY:return this.empty(v.EMPTY_WORD_BOUNDARY);case S.Op.NO_WORD_BOUNDARY:return this.empty(v.EMPTY_NO_WORD_BOUNDARY);case S.Op.CAPTURE:{let e=this.cap(t.cap<<1),n=this.compile(t.subs[0]),r=this.cap(t.cap<<1|1);return this.cat(this.cat(e,n),r)}case S.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&h.NON_GREEDY)!==0);case S.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&h.NON_GREEDY)!==0);case S.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&h.NON_GREEDY)!==0);case S.Op.CONCAT:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.cat(e,t)}return e}case S.Op.ALTERNATE:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.alt(e,t)}return e}default:throw new Ce(`regexp: unhandled case in compile`)}}},Ne=class e{static simplify(t){if(t===null)return null;switch(t.op){case S.Op.CAPTURE:case S.Op.CONCAT:case S.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let i=t.subs[r],a=e.simplify(i);n===t&&a!==i&&(n=S.fromRegexp(t),n.runes=null,n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=a)}return n}case S.Op.STAR:case S.Op.PLUS:case S.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case S.Op.REPEAT:{if(t.min===0&&t.max===0)return new S(S.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(S.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(S.Op.PLUS,t.flags,n,null);let r=new S(S.Op.CONCAT),i=[];for(let e=0;e<t.min-1;e++)i.push(n);return i.push(e.simplify1(S.Op.PLUS,t.flags,n,null)),r.subs=i.slice(0),r}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let e=0;e<t.min;e++)r.push(n)}if(t.max>t.min){let i=e.simplify1(S.Op.QUEST,t.flags,n,null);for(let r=t.min+1;r<t.max;r++){let r=new S(S.Op.CONCAT);r.subs=[n,i],i=e.simplify1(S.Op.QUEST,t.flags,r,null)}if(r===null)return i;r.push(i)}if(r!==null){let e=new S(S.Op.CONCAT);return e.subs=r.slice(0),e}return new S(S.Op.NO_MATCH)}}return t}static simplify1(e,t,n,r){return n.op===S.Op.EMPTY_MATCH||e===n.op&&(t&h.NON_GREEDY)===(n.flags&h.NON_GREEDY)?n:r!==null&&r.op===e&&(r.flags&h.NON_GREEDY)===(t&h.NON_GREEDY)&&n===r.subs[0]?r:(r=new S(e),r.flags=t,r.subs=[n],r)}},w=class{constructor(e,t){this.sign=e,this.cls=t}},Pe=[48,57],Fe=[9,10,12,13,32,32],Ie=[48,57,65,90,95,95,97,122],Le=new Map([[`\\d`,new w(1,Pe)],[`\\D`,new w(-1,Pe)],[`\\s`,new w(1,Fe)],[`\\S`,new w(-1,Fe)],[`\\w`,new w(1,Ie)],[`\\W`,new w(-1,Ie)]]),Re=[48,57,65,90,97,122],ze=[65,90,97,122],Be=[0,127],Ve=[9,9,32,32],He=[0,31,127,127],Ue=[48,57],We=[33,126],Ge=[97,122],Ke=[32,126],qe=[33,47,58,64,91,96,123,126],Je=[9,13,32,32],Ye=[65,90],Xe=[48,57,65,90,95,95,97,122],Ze=[48,57,65,70,97,102],Qe=new Map([[`[:alnum:]`,new w(1,Re)],[`[:^alnum:]`,new w(-1,Re)],[`[:alpha:]`,new w(1,ze)],[`[:^alpha:]`,new w(-1,ze)],[`[:ascii:]`,new w(1,Be)],[`[:^ascii:]`,new w(-1,Be)],[`[:blank:]`,new w(1,Ve)],[`[:^blank:]`,new w(-1,Ve)],[`[:cntrl:]`,new w(1,He)],[`[:^cntrl:]`,new w(-1,He)],[`[:digit:]`,new w(1,Ue)],[`[:^digit:]`,new w(-1,Ue)],[`[:graph:]`,new w(1,We)],[`[:^graph:]`,new w(-1,We)],[`[:lower:]`,new w(1,Ge)],[`[:^lower:]`,new w(-1,Ge)],[`[:print:]`,new w(1,Ke)],[`[:^print:]`,new w(-1,Ke)],[`[:punct:]`,new w(1,qe)],[`[:^punct:]`,new w(-1,qe)],[`[:space:]`,new w(1,Je)],[`[:^space:]`,new w(-1,Je)],[`[:upper:]`,new w(1,Ye)],[`[:^upper:]`,new w(-1,Ye)],[`[:word:]`,new w(1,Xe)],[`[:^word:]`,new w(-1,Xe)],[`[:xdigit:]`,new w(1,Ze)],[`[:^xdigit:]`,new w(-1,Ze)]]),$e=class e{static charClassToString(e,t){let n=`[`;for(let r=0;r<t;r+=2){r>0&&(n+=` `);let t=e[r],i=e[r+1];t===i?n+=`0x${t.toString(16)}`:n+=`0x${t.toString(16)}-0x${i.toString(16)}`}return n+=`]`,n}static cmp(e,t,n,r){let i=e[t]-n;return i===0?r-e[t+1]:i}static qsortIntPair(t,n,r){let i=((n+r)/2|0)&-2,a=t[i],o=t[i+1],s=n,c=r;for(;s<=c;){for(;s<r&&e.cmp(t,s,a,o)<0;)s+=2;for(;c>n&&e.cmp(t,c,a,o)>0;)c-=2;if(s<=c){if(s!==c){let e=t[s];t[s]=t[c],t[c]=e,e=t[s+1],t[s+1]=t[c+1],t[c+1]=e}s+=2,c-=2}}n<c&&e.qsortIntPair(t,n,c),s<r&&e.qsortIntPair(t,s,r)}constructor(e=v.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;e.qsortIntPair(this.r,0,this.len-2);let t=2;for(let e=2;e<this.len;e+=2){let n=this.r[e],r=this.r[e+1];if(n<=this.r[t-1]+1){r>this.r[t-1]&&(this.r[t-1]=r);continue}this.r[t]=n,this.r[t+1]=r,t+=2}return this.len=t,this}appendLiteral(e,t){return(t&h.FOLD_CASE)===0?this.appendRange(e,e):this.appendFoldedRange(e,e)}appendRange(e,t){if(this.len>0){for(let n=2;n<=4;n+=2)if(this.len>=n){let r=this.r[this.len-n],i=this.r[this.len-n+1];if(e<=i+1&&r<=t+1)return e<r&&(this.r[this.len-n]=e),t>i&&(this.r[this.len-n+1]=t),this}}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=_.MIN_FOLD&&t>=_.MAX_FOLD||t<_.MIN_FOLD||e>_.MAX_FOLD)return this.appendRange(e,t);e<_.MIN_FOLD&&(this.appendRange(e,_.MIN_FOLD-1),e=_.MIN_FOLD),t>_.MAX_FOLD&&(this.appendRange(_.MAX_FOLD+1,t),t=_.MAX_FOLD);for(let n=e;n<=t;n++){this.appendRange(n,n);for(let e=_.simpleFold(n);e!==n;e=_.simpleFold(e))this.appendRange(e,e)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];t<=r-1&&this.appendRange(t,r-1),t=i+1}return t<=_.MAX_RUNE&&this.appendRange(t,_.MAX_RUNE),this}appendTable(e){for(let t of e){let e=t[0],n=t[1],r=t[2];if(r===1){this.appendRange(e,n);continue}for(let t=e;t<=n;t+=r)this.appendRange(t,t)}return this}appendNegatedTable(e){let t=0;for(let n of e){let e=n[0],r=n[1],i=n[2];if(i===1){t<=e-1&&this.appendRange(t,e-1),t=r+1;continue}for(let n=e;n<=r;n+=i)t<=n-1&&this.appendRange(t,n-1),t=n+1}return t<=_.MAX_RUNE&&this.appendRange(t,_.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let n=0;n<this.len;n+=2){let r=this.r[n],i=this.r[n+1];e<=r-1&&(this.r[t]=e,this.r[t+1]=r-1,t+=2),e=i+1}return this.len=t,e<=_.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=_.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(t,n){let r=t.cls;return n&&(r=new e().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},et=class e{static of(t,n){return new e(t,n)}constructor(e,t){this.first=e,this.second=t}},tt=class{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){let e=this.str.codePointAt(this.position);return this.position+=v.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}},nt=class e{static ERR_INTERNAL_ERROR=`regexp/syntax: internal error`;static ERR_INVALID_CHAR_RANGE=`invalid character class range`;static ERR_INVALID_ESCAPE=`invalid escape sequence`;static ERR_INVALID_NAMED_CAPTURE=`invalid named capture`;static ERR_INVALID_PERL_OP=`invalid or unsupported Perl syntax`;static ERR_INVALID_REPEAT_OP=`invalid nested repetition operator`;static ERR_INVALID_REPEAT_SIZE=`invalid repeat count`;static ERR_MISSING_BRACKET=`missing closing ]`;static ERR_MISSING_PAREN=`missing closing )`;static ERR_MISSING_REPEAT_ARGUMENT=`missing argument to repetition operator`;static ERR_TRAILING_BACKSLASH=`trailing backslash at end of expression`;static ERR_DUPLICATE_NAMED_CAPTURE=`duplicate capture group name`;static ANY_TABLE(){return[[0,_.MAX_RUNE,1]]}static unicodeTable(t){return t===`Any`?et.of(e.ANY_TABLE(),e.ANY_TABLE()):_e.CATEGORIES.has(t)?et.of(_e.CATEGORIES.get(t),_e.FOLD_CATEGORIES.get(t)):_e.SCRIPTS.has(t)?et.of(_e.SCRIPTS.get(t),_e.FOLD_SCRIPT.get(t)):null}static minFoldRune(e){if(e<_.MIN_FOLD||e>_.MAX_FOLD)return e;let t=e,n=e;for(e=_.simpleFold(e);e!==n;e=_.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===S.Op.EMPTY_MATCH)return null;if(e.op===S.Op.CONCAT&&e.subs.length>0){let t=e.subs[0];return t.op===S.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){let n=new S(S.Op.LITERAL);return n.flags=t,n.runes=v.stringToRunes(e),n}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){let n=t.pos();if(!t.more()||!t.lookingAt(`{`))return-1;t.skip(1);let r=e.parseInt(t);if(r===-1||!t.more())return-1;let i;if(!t.lookingAt(`,`))i=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt(`}`))i=-1;else if((i=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt(`}`))return-1;if(t.skip(1),r<0||r>1e3||i===-2||i>1e3||i>=0&&r>i)throw new b(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|i&_.MAX_BMP}static isValidCaptureName(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n!==g.CODES.get(`_`)&&!v.isalnum(n))return!1}return!0}static parseInt(e){let t=e.pos();for(;e.more()&&e.peek()>=g.CODES.get(`0`)&&e.peek()<=g.CODES.get(`9`);)e.skip(1);let n=e.from(t);return n.length===0||n.length>1&&n.codePointAt(0)===g.CODES.get(`0`)?-1:n.length>8?-2:parseFloat(n,10)}static isCharClass(e){return e.op===S.Op.LITERAL&&e.runes.length===1||e.op===S.Op.CHAR_CLASS||e.op===S.Op.ANY_CHAR_NOT_NL||e.op===S.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case S.Op.LITERAL:return e.runes.length===1&&e.runes[0]===t;case S.Op.CHAR_CLASS:for(let n=0;n<e.runes.length;n+=2)if(e.runes[n]<=t&&t<=e.runes[n+1])return!0;return!1;case S.Op.ANY_CHAR_NOT_NL:return t!==g.CODES.get(`
|
|
19
|
+
`);case S.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case S.Op.ANY_CHAR:break;case S.Op.ANY_CHAR_NOT_NL:e.matchRune(n,g.CODES.get(`
|
|
20
|
+
`))&&(t.op=S.Op.ANY_CHAR);break;case S.Op.CHAR_CLASS:n.op===S.Op.LITERAL?t.runes=new $e(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new $e(t.runes).appendClass(n.runes).toArray();break;case S.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=S.Op.CHAR_CLASS,t.runes=new $e().appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toArray();break}}static parseEscape(t){let n=t.pos();if(t.skip(1),!t.more())throw new b(e.ERR_TRAILING_BACKSLASH);let r=t.pop();bigswitch:switch(r){case g.CODES.get(`1`):case g.CODES.get(`2`):case g.CODES.get(`3`):case g.CODES.get(`4`):case g.CODES.get(`5`):case g.CODES.get(`6`):case g.CODES.get(`7`):if(!t.more()||t.peek()<g.CODES.get(`0`)||t.peek()>g.CODES.get(`7`))break;case g.CODES.get(`0`):{let e=r-g.CODES.get(`0`);for(let n=1;n<3&&!(!t.more()||t.peek()<g.CODES.get(`0`)||t.peek()>g.CODES.get(`7`));n++)e=e*8+t.peek()-g.CODES.get(`0`),t.skip(1);return e}case g.CODES.get(`x`):{if(!t.more())break;if(r=t.pop(),r===g.CODES.get(`{`)){let e=0,n=0;for(;;){if(!t.more())break bigswitch;if(r=t.pop(),r===g.CODES.get(`}`))break;let i=v.unhex(r);if(i<0||(n=n*16+i,n>_.MAX_RUNE))break bigswitch;e++}if(e===0)break bigswitch;return n}let e=v.unhex(r);if(!t.more())break;r=t.pop();let n=v.unhex(r);if(e<0||n<0)break;return e*16+n}case g.CODES.get(`a`):return g.CODES.get(`\x07`);case g.CODES.get(`f`):return g.CODES.get(`\f`);case g.CODES.get(`n`):return g.CODES.get(`
|
|
21
|
+
`);case g.CODES.get(`r`):return g.CODES.get(`\r`);case g.CODES.get(`t`):return g.CODES.get(` `);case g.CODES.get(`v`):return g.CODES.get(`\v`);default:if(!v.isalnum(r))return r;break}throw new b(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new b(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt(`\\`)?e.parseEscape(t):t.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null}newRegexp(e){let t=this.free;return t!==null&&t.subs!==null&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):t=new S(e),t}reuse(e){e.subs!==null&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}pop(){return this.stack.pop()}popToPseudo(){let e=this.stack.length,t=e;for(;t>0&&!S.isPseudoOp(this.stack[t-1].op);)t--;let n=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),n}push(e){if(e.op===S.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&~h.FOLD_CASE))return null;e.op=S.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&~h.FOLD_CASE}else if(e.op===S.Op.CHAR_CLASS&&e.runes.length===4&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&_.simpleFold(e.runes[0])===e.runes[2]&&_.simpleFold(e.runes[2])===e.runes[0]||e.op===S.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]+1===e.runes[1]&&_.simpleFold(e.runes[0])===e.runes[1]&&_.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|h.FOLD_CASE))return null;e.op=S.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|h.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),e}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let i=this.stack[r-1],a=this.stack[r-2];return i.op!==S.Op.LITERAL||a.op!==S.Op.LITERAL||(i.flags&h.FOLD_CASE)!==(a.flags&h.FOLD_CASE)?!1:(a.runes=e.concatRunes(a.runes,i.runes),t>=0?(i.runes=[t],i.flags=n,!0):(this.pop(),this.reuse(i),!1))}newLiteral(t,n){let r=this.newRegexp(S.Op.LITERAL);return r.flags=n,(n&h.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){let t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(t,n,r,i,a,o){let s=this.flags;if((s&h.PERL_X)!==0&&(a.more()&&a.lookingAt(`?`)&&(a.skip(1),s^=h.NON_GREEDY),o!==-1))throw new b(e.ERR_INVALID_REPEAT_OP,a.from(o));let c=this.stack.length;if(c===0)throw new b(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let l=this.stack[c-1];if(S.isPseudoOp(l.op))throw new b(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let u=this.newRegexp(t);u.min=n,u.max=r,u.flags=s,u.subs=[l],this.stack[c-1]=u}concat(){this.maybeConcat(-1,0);let e=this.popToPseudo();return e.length===0?this.push(this.newRegexp(S.Op.EMPTY_MATCH)):this.push(this.collapse(e,S.Op.CONCAT))}alternate(){let e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),e.length===0?this.push(this.newRegexp(S.Op.NO_MATCH)):this.push(this.collapse(e,S.Op.ALTERNATE))}cleanAlt(e){e.op===S.Op.CHAR_CLASS&&(e.runes=new $e(e.runes).cleanClass().toArray(),e.runes.length===2&&e.runes[0]===0&&e.runes[1]===_.MAX_RUNE?(e.runes=null,e.op=S.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===g.CODES.get(`
|
|
22
|
+
`)-1&&e.runes[2]===g.CODES.get(`
|
|
23
|
+
`)+1&&e.runes[3]===_.MAX_RUNE&&(e.runes=null,e.op=S.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(e.length===1)return e[0];let n=0;for(let r of e)n+=r.op===t?r.subs.length:1;let r=Array(n).fill(null),i=0;for(let n of e)n.op===t?(r.splice(i,n.subs.length,...n.subs),i+=n.subs.length,this.reuse(n)):r[i++]=n;let a=this.newRegexp(t);if(a.subs=r,t===S.Op.ALTERNATE&&(a.subs=this.factor(a.subs),a.subs.length===1)){let e=a;a=a.subs[0],this.reuse(e)}return a}factor(t){if(t.length<2)return t;let n=0,r=t.length,i=0,a=null,o=0,s=0,c=0;for(let e=0;e<=r;e++){let l=null,u=0,d=0;if(e<r){let r=t[n+e];if(r.op===S.Op.CONCAT&&r.subs.length>0&&(r=r.subs[0]),r.op===S.Op.LITERAL&&(l=r.runes,u=r.runes.length,d=r.flags&h.FOLD_CASE),d===s){let e=0;for(;e<o&&e<u&&a[e]===l[e];)e++;if(e>0){o=e;continue}}}if(e!==c)if(e===c+1)t[i++]=t[n+c];else{let r=this.newRegexp(S.Op.LITERAL);r.flags=s,r.runes=a.slice(0,o);for(let r=c;r<e;r++)t[n+r]=this.removeLeadingString(t[n+r],o);let l=this.collapse(t.slice(n+c,n+e),S.Op.ALTERNATE),u=this.newRegexp(S.Op.CONCAT);u.subs=[r,l],t[i++]=u}c=e,a=l,o=u,s=d}r=i,n=0,c=0,i=0;let l=null;for(let a=0;a<=r;a++){let o=null;if(!(a<r&&(o=e.leadingRegexp(t[n+a]),l!==null&&l.equals(o)&&(e.isCharClass(l)||l.op===S.Op.REPEAT&&l.min===l.max&&e.isCharClass(l.subs[0]))))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let e=l;for(let e=c;e<a;e++){let r=e!==c;t[n+e]=this.removeLeadingRegexp(t[n+e],r)}let r=this.collapse(t.slice(n+c,n+a),S.Op.ALTERNATE),o=this.newRegexp(S.Op.CONCAT);o.subs=[e,r],t[i++]=o}c=a,l=o}}r=i,n=0,c=0,i=0;for(let a=0;a<=r;a++)if(!(a<r&&e.isCharClass(t[n+a]))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let r=c;for(let e=c+1;e<a;e++){let i=t[n+r],a=t[n+e];(i.op<a.op||i.op===a.op&&(i.runes===null?0:i.runes.length)<(a.runes===null?0:a.runes.length))&&(r=e)}let o=t[n+c];t[n+c]=t[n+r],t[n+r]=o;for(let r=c+1;r<a;r++)e.mergeCharClass(t[n+c],t[n+r]),this.reuse(t[n+r]);this.cleanAlt(t[n+c]),t[i++]=t[n+c]}a<r&&(t[i++]=t[n+a]),c=a+1}r=i,n=0,c=0,i=0;for(let e=0;e<r;++e)e+1<r&&t[n+e].op===S.Op.EMPTY_MATCH&&t[n+e+1].op===S.Op.EMPTY_MATCH||(t[i++]=t[n+e]);return r=i,n=0,t.slice(n,r)}removeLeadingString(e,t){if(e.op===S.Op.CONCAT&&e.subs.length>0){let n=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=n,n.op===S.Op.EMPTY_MATCH)switch(this.reuse(n),e.subs.length){case 0:case 1:e.op=S.Op.EMPTY_MATCH,e.subs=null;break;case 2:{let t=e;e=e.subs[1],this.reuse(t);break}default:e.subs=e.subs.slice(1,e.subs.length);break}return e}return e.op===S.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),e.runes.length===0&&(e.op=S.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===S.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:e.op=S.Op.EMPTY_MATCH,e.subs=S.emptySubs();break;case 1:{let t=e;e=e.subs[0],this.reuse(t);break}}return e}return t&&this.reuse(e),this.newRegexp(S.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&h.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,i=new tt(this.wholeRegexp);for(;i.more();){let a=-1;bigswitch:switch(i.peek()){case g.CODES.get(`(`):if((this.flags&h.PERL_X)!==0&&i.lookingAt(`(?`)){this.parsePerlFlags(i);break}this.op(S.Op.LEFT_PAREN).cap=++this.numCap,i.skip(1);break;case g.CODES.get(`|`):this.parseVerticalBar(),i.skip(1);break;case g.CODES.get(`)`):this.parseRightParen(),i.skip(1);break;case g.CODES.get(`^`):(this.flags&h.ONE_LINE)===0?this.op(S.Op.BEGIN_LINE):this.op(S.Op.BEGIN_TEXT),i.skip(1);break;case g.CODES.get(`$`):(this.flags&h.ONE_LINE)===0?this.op(S.Op.END_LINE):this.op(S.Op.END_TEXT).flags|=h.WAS_DOLLAR,i.skip(1);break;case g.CODES.get(`.`):(this.flags&h.DOT_NL)===0?this.op(S.Op.ANY_CHAR_NOT_NL):this.op(S.Op.ANY_CHAR),i.skip(1);break;case g.CODES.get(`[`):this.parseClass(i);break;case g.CODES.get(`*`):case g.CODES.get(`+`):case g.CODES.get(`?`):{a=i.pos();let e=null;switch(i.pop()){case g.CODES.get(`*`):e=S.Op.STAR;break;case g.CODES.get(`+`):e=S.Op.PLUS;break;case g.CODES.get(`?`):e=S.Op.QUEST;break}this.repeat(e,n,r,a,i,t);break}case g.CODES.get(`{`):{a=i.pos();let o=e.parseRepeat(i);if(o<0){i.rewindTo(a),this.literal(i.pop());break}n=o>>16,r=(o&_.MAX_BMP)<<16>>16,this.repeat(S.Op.REPEAT,n,r,a,i,t);break}case g.CODES.get(`\\`):{let t=i.pos();if(i.skip(1),(this.flags&h.PERL_X)!==0&&i.more())switch(i.pop()){case g.CODES.get(`A`):this.op(S.Op.BEGIN_TEXT);break bigswitch;case g.CODES.get(`b`):this.op(S.Op.WORD_BOUNDARY);break bigswitch;case g.CODES.get(`B`):this.op(S.Op.NO_WORD_BOUNDARY);break bigswitch;case g.CODES.get(`C`):throw new b(e.ERR_INVALID_ESCAPE,`\\C`);case g.CODES.get(`Q`):{let e=i.rest(),t=e.indexOf(`\\E`);t>=0&&(e=e.substring(0,t)),i.skipString(e),i.skipString(`\\E`);let n=0;for(;n<e.length;){let t=e.codePointAt(n);this.literal(t),n+=v.charCount(t)}break bigswitch}case g.CODES.get(`z`):this.op(S.Op.END_TEXT);break bigswitch;default:i.rewindTo(t);break}let n=this.newRegexp(S.Op.CHAR_CLASS);if(n.flags=this.flags,i.lookingAt(`\\p`)||i.lookingAt(`\\P`)){let e=new $e;if(this.parseUnicodeClass(i,e)){n.runes=e.toArray(),this.push(n);break bigswitch}}let r=new $e;if(this.parsePerlClassEscape(i,r)){n.runes=r.toArray(),this.push(n);break bigswitch}i.rewindTo(t),this.reuse(n),this.literal(e.parseEscape(i));break}default:this.literal(i.pop());break}t=a}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new b(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){let n=t.pos(),r=t.rest();if(r.startsWith(`(?P<`)||r.startsWith(`(?<`)){let n=r.charAt(2)===`P`?4:3,i=r.indexOf(`>`);if(i<0)throw new b(e.ERR_INVALID_NAMED_CAPTURE,r);let a=r.substring(n,i);if(t.skipString(a),t.skip(n+1),!e.isValidCaptureName(a))throw new b(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,i+1));let o=this.op(S.Op.LEFT_PAREN);if(o.cap=++this.numCap,this.namedGroups[a])throw new b(e.ERR_DUPLICATE_NAMED_CAPTURE,a);this.namedGroups[a]=this.numCap,o.name=a;return}t.skip(2);let i=this.flags,a=1,o=!1;loop:for(;t.more();){let e=t.pop();switch(e){case g.CODES.get(`i`):i|=h.FOLD_CASE,o=!0;break;case g.CODES.get(`m`):i&=~h.ONE_LINE,o=!0;break;case g.CODES.get(`s`):i|=h.DOT_NL,o=!0;break;case g.CODES.get(`U`):i|=h.NON_GREEDY,o=!0;break;case g.CODES.get(`-`):if(a<0)break loop;a=-1,i=~i,o=!1;break;case g.CODES.get(`:`):case g.CODES.get(`)`):if(a<0){if(!o)break loop;i=~i}e===g.CODES.get(`:`)&&this.op(S.Op.LEFT_PAREN),this.flags=i;return;default:break loop}}throw new b(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(S.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===S.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){let e=r;r=n,n=e,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let e=this.stack[t-1],n=this.stack[t-2];if(n.op===S.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=e,this.stack[t-1]=n,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new b(e.ERR_INTERNAL_ERROR,`stack underflow`);let t=this.pop(),n=this.pop();if(n.op!==S.Op.LEFT_PAREN)throw new b(e.ERR_MISSING_PAREN,this.wholeRegexp);this.flags=n.flags,n.cap===0?this.push(t):(n.op=S.Op.CAPTURE,n.subs=[t],this.push(n))}parsePerlClassEscape(e,t){let n=e.pos();if((this.flags&h.PERL_X)===0||!e.more()||e.pop()!==g.CODES.get(`\\`)||!e.more())return!1;e.pop();let r=e.from(n),i=Le.has(r)?Le.get(r):null;return i===null?!1:(t.appendGroup(i,(this.flags&h.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),i=r.indexOf(`:]`);if(i<0)return!1;let a=r.substring(0,i+2);t.skipString(a);let o=Qe.has(a)?Qe.get(a):null;if(o===null)throw new b(e.ERR_INVALID_CHAR_RANGE,a);return n.appendGroup(o,(this.flags&h.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&h.UNICODE_GROUPS)===0||!t.lookingAt(`\\p`)&&!t.lookingAt(`\\P`))return!1;t.skip(1);let i=1,a=t.pop();if(a===g.CODES.get(`P`)&&(i=-1),!t.more())throw t.rewindTo(r),new b(e.ERR_INVALID_CHAR_RANGE,t.rest());a=t.pop();let o;if(a!==g.CODES.get(`{`))o=v.runeToString(a);else{let n=t.rest(),i=n.indexOf(`}`);if(i<0)throw t.rewindTo(r),new b(e.ERR_INVALID_CHAR_RANGE,t.rest());o=n.substring(0,i),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===g.CODES.get(`^`)&&(i=0-i,o=o.substring(1));let s=e.unicodeTable(o);if(s===null)throw new b(e.ERR_INVALID_CHAR_RANGE,t.from(r));let c=s.first,l=s.second;if((this.flags&h.FOLD_CASE)===0||l===null)n.appendTableWithSign(c,i);else{let e=new $e().appendTable(c).appendTable(l).cleanClass().toArray();n.appendClassWithSign(e,i)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(S.Op.CHAR_CLASS);r.flags=this.flags;let i=new $e,a=1;t.more()&&t.lookingAt(`^`)&&(a=-1,t.skip(1),(this.flags&h.CLASS_NL)===0&&i.appendRange(g.CODES.get(`
|
|
24
|
+
`),g.CODES.get(`
|
|
25
|
+
`)));let o=!0;for(;!t.more()||t.peek()!==g.CODES.get(`]`)||o;){if(t.more()&&t.lookingAt(`-`)&&(this.flags&h.PERL_X)===0&&!o){let r=t.rest();if(r===`-`||!r.startsWith(`-]`))throw t.rewindTo(n),new b(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let r=t.pos();if(t.lookingAt(`[:`)){if(this.parseNamedClass(t,i))continue;t.rewindTo(r)}if(this.parseUnicodeClass(t,i)||this.parsePerlClassEscape(t,i))continue;t.rewindTo(r);let a=e.parseClassChar(t,n),s=a;if(t.more()&&t.lookingAt(`-`)){if(t.skip(1),t.more()&&t.lookingAt(`]`))t.skip(-1);else if(s=e.parseClassChar(t,n),s<a)throw new b(e.ERR_INVALID_CHAR_RANGE,t.from(r))}(this.flags&h.FOLD_CASE)===0?i.appendRange(a,s):i.appendFoldedRange(a,s)}t.skip(1),i.cleanClass(),a<0&&i.negateClass(),r.runes=i.toArray(),this.push(r)}},rt=class{constructor(){this.inst=null,this.cap=[]}},it=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){let t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return this.size===0}add(e){let t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e=`{`;for(let t=0;t<this.size;t++)t!==0&&(e+=`, `),e+=this.densePcs[t];return e+=`}`,e}},at=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new it(n.prog.numInst()),n.q1=new it(n.prog.numInst()),n.pool=[],n.poolSize=0,n.matched=!1,n.matchcap=Array(n.prog.numCap<2?2:n.prog.numCap).fill(0),n.ncap=0,n}static fromMachine(t){let n=new e;return n.re2=t.re2,n.prog=t.prog,n.q0=t.q0,n.q1=t.q1,n.pool=t.pool,n.poolSize=t.poolSize,n.matched=t.matched,n.matchcap=t.matchcap,n.ncap=t.ncap,n}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];n.cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];n.cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return this.ncap===0?v.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new rt,t.inst=e,t}freeQueue(e,t=0){let n=e.size-t,r=this.poolSize+n;this.pool.length<r&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,r)));for(let n=t;n<e.size;n++){let t=e.denseThreads[n];t!==null&&(this.pool[this.poolSize]=t,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=e,this.poolSize++}match(e,t,n){let r=this.re2.cond;if(r===v.EMPTY_ALL||(n===h.ANCHOR_START||n===h.ANCHOR_BOTH)&&t!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,a=this.q1,o=e.step(t),s=o>>3,c=o&7,l=-1,u=0;o!==De.EOF()&&(o=e.step(t+c),l=o>>3,u=o&7);let d;for(d=t===0?v.emptyOpContext(-1,s):e.context(t);;){if(i.isEmpty()){if((r&v.EMPTY_BEGIN_TEXT)!==0&&t!==0||this.matched)break;if(this.re2.prefix.length!==0&&l!==this.re2.prefixRune&&e.canCheckPrefix()){let n=e.index(this.re2,t);if(n<0)break;t+=n,o=e.step(t),s=o>>3,c=o&7,o=e.step(t+c),l=o>>3,u=o&7}}!this.matched&&(t===0||n===h.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=t),this.add(i,this.prog.start,t,this.matchcap,d,null));let f=t+c;if(d=e.context(f),this.step(i,a,t,f,s,d,n,t===e.endPos()),c===0||this.ncap===0&&this.matched)break;t+=c,s=l,c=u,s!==-1&&(o=e.step(t+c),l=o>>3,u=o&7);let p=i;i=a,a=p}return this.freeQueue(a),this.matched}step(e,t,n,r,i,a,o,s){let c=this.re2.longest;for(let l=0;l<e.size;l++){let u=e.denseThreads[l];if(u===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<u.cap[0]){this.freeThread(u);continue}let d=u.inst,f=!1;switch(d.op){case C.MATCH:if(o===h.ANCHOR_BOTH&&!s)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<n)&&(u.cap[1]=n,this.matchcap=u.cap.slice(0,this.ncap)),c||this.freeQueue(e,l+1),this.matched=!0;break;case C.RUNE:f=d.matchRune(i);break;case C.RUNE1:f=i===d.runes[0];break;case C.RUNE_ANY:f=!0;break;case C.RUNE_ANY_NOT_NL:f=i!==g.CODES.get(`
|
|
26
|
+
`);break;default:throw Error(`bad inst`)}f&&(u=this.add(t,d.out,r,u.cap,a,u)),u!==null&&(this.freeThread(u),e.denseThreads[l]=null)}e.clear()}add(e,t,n,r,i,a){if(t===0||e.contains(t))return a;let o=e.add(t),s=this.prog.inst[t];switch(s.op){case C.FAIL:break;case C.ALT:case C.ALT_MATCH:a=this.add(e,s.out,n,r,i,a),a=this.add(e,s.arg,n,r,i,a);break;case C.EMPTY_WIDTH:(s.arg&~i)===0&&(a=this.add(e,s.out,n,r,i,a));break;case C.NOP:a=this.add(e,s.out,n,r,i,a);break;case C.CAPTURE:if(s.arg<this.ncap){let t=r[s.arg];r[s.arg]=n,this.add(e,s.out,n,r,i,null),r[s.arg]=t}else a=this.add(e,s.out,n,r,i,a);break;case C.MATCH:case C.RUNE:case C.RUNE1:case C.RUNE_ANY:case C.RUNE_ANY_NOT_NL:a===null?a=this.alloc(s):a.inst=s,this.ncap>0&&a.cap!==r&&(a.cap=r.slice(0,this.ncap)),e.denseThreads[o]=a,a=null;break;default:throw Error(`unhandled`)}return a}},ot=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e?(this.value=t,!0):!1}},st=class e{static initTest(t){let n=e.compile(t),r=new e(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return e.compileImpl(t,h.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,h.POSIX,!0)}static compileImpl(t,n,r){let i=nt.parse(t,n),a=i.maxCap();i=Ne.simplify(i);let o=Me.compileRegexp(i),s=new e(t,o,a,r),[c,l]=o.prefix();return s.prefixComplete=c,s.prefix=l,s.prefixUTF8=v.stringToUtf8ByteArray(s.prefix),s.prefix.length>0&&(s.prefixRune=s.prefix.codePointAt(0)),s.namedGroups=i.namedGroups,s}static match(t,n){return e.compile(t).match(n)}constructor(e,t,n=0,r=0){this.expr=e,this.prog=t,this.numSubexp=n,this.longest=r,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new ot}numberOfCapturingGroups(){return this.numSubexp}get(){let e;do e=this.pooled.get();while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let n=this.pooled.get();do n=this.pooled.get(),!t&&n&&(e=at.fromMachine(e),t=!0),e.next!==n&&(e.next=n);while(!this.pooled.compareAndSet(n,e))}toString(){return this.expr}doExecute(e,t,n,r){let i=this.get(),a=!1;i?i.next!==null&&(i=at.fromMachine(i),a=!0):(i=at.fromRE2(this),a=!0),i.init(r);let o=i.match(e,t,n)?i.submatches():null;return this.put(i,a),o}match(e){return this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,0)!==null}matchWithGroup(e,t,n,r,i){return e instanceof ve||(e=xe.utf16(e)),this.matchMachineInput(e,t,n,r,i)}matchMachineInput(e,t,n,r,i){if(t>n)return[!1,null];let a=e.isUTF16Encoding()?x.fromUTF16(e.asCharSequence(),0,n):x.fromUTF8(e.asBytes(),0,n),o=this.doExecute(a,t,r,2*i);return o===null?[!1,null]:[!0,o]}matchUTF8(e){return this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,0)!==null}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,n){let r=0,i=0,a=``,o=x.fromUTF16(e),s=0;for(;i<=e.length;){let c=this.doExecute(o,i,h.UNANCHORED,2);if(c===null||c.length===0)break;a+=e.substring(r,c[0]),(c[1]>r||c[0]===0)&&(a+=t(e.substring(c[0],c[1])),s++),r=c[1];let l=o.step(i)&7;if(i+l>c[1]?i+=l:i+1>c[1]?i++:i=c[1],s>=n)break}return a+=e.substring(r),a}pad(e){if(e===null)return null;let t=(1+this.numSubexp)*2;if(e.length<t){let n=Array(t).fill(-1);for(let t=0;t<e.length;t++)n[t]=e[t];e=n}return e}allMatches(e,t,n=e=>e){let r=[],i=e.endPos();t<0&&(t=i+1);let a=0,o=0,s=-1;for(;o<t&&a<=i;){let t=this.doExecute(e,a,h.UNANCHORED,this.prog.numCap);if(t===null||t.length===0)break;let c=!0;if(t[1]===a){t[0]===s&&(c=!1);let n=e.step(a);n<0?a=i+1:a+=n&7}else a=t[1];s=t[1],c&&(r.push(n(this.pad(t))),o++)}return r}findUTF8(e){let t=this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,2);return t===null?null:e.slice(t[0],t[1])}findUTF8Index(e){let t=this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,2);return t===null?null:t.slice(0,2)}find(e){let t=this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,2);return t===null?``:e.substring(t[0],t[1])}findIndex(e){return this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,2)}findUTF8Submatch(e){let t=this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,this.prog.numCap))}findSubmatch(e){let t=this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n}findSubmatchIndex(e){return this.pad(this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){let n=this.allMatches(x.fromUTF8(e),t,t=>e.slice(t[0],t[1]));return n.length===0?null:n}findAllUTF8Index(e,t){let n=this.allMatches(x.fromUTF8(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAll(e,t){let n=this.allMatches(x.fromUTF16(e),t,t=>e.substring(t[0],t[1]));return n.length===0?null:n}findAllIndex(e,t){let n=this.allMatches(x.fromUTF16(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAllUTF8Submatch(e,t){let n=this.allMatches(x.fromUTF8(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllUTF8SubmatchIndex(e,t){let n=this.allMatches(x.fromUTF8(e),t);return n.length===0?null:n}findAllSubmatch(e,t){let n=this.allMatches(x.fromUTF16(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllSubmatchIndex(e,t){let n=this.allMatches(x.fromUTF16(e),t);return n.length===0?null:n}},ct=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(e){return v.quoteMeta(e)}static compile(t,n=0){let r=t;if((n&e.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(n&e.DOTALL)!==0&&(r=`(?s)${r}`),(n&e.MULTILINE)!==0&&(r=`(?m)${r}`),(n&~(e.MULTILINE|e.DOTALL|e.CASE_INSENSITIVE|e.DISABLE_UNICODE_GROUPS|e.LONGEST_MATCH))!==0)throw new Te(`Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH`);let i=h.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(i&=~h.UNICODE_GROUPS);let a=new e(t,n);return a.re2Input=st.compileImpl(r,i,(n&e.LONGEST_MATCH)!==0),a}static matches(t,n){return e.compile(t).matcher(n).matches()}static initTest(t,n,r){if(t==null)throw Error(`pattern is null`);if(r==null)throw Error(`re2 is null`);let i=new e(t,n);return i.re2Input=r,i}constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=xe.utf8(e)),new Ee(this,e)}split(e,t=0){let n=this.matcher(e),r=[],i=0,a=0;for(;n.find();){if(a===0&&n.end()===0){a=n.end();continue}if(t>0&&r.length===t-1)break;if(a===n.start()){if(t===0){i+=1,a=n.end();continue}}else for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.start())),a=n.end()}if(t===0&&a!==n.inputLength()){for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.inputLength()))}return(t!==0||r.length===0)&&r.push(n.substring(a,n.inputLength())),r}toString(){return this.patternInput}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e?!0:e===null||this.constructor!==e.constructor?!1:this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput}},lt=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?`uid:`+this.uid:`anonymous-user`}isEqual(e){return e.uid===this.uid}};lt.UNAUTHENTICATED=new lt(null),lt.GOOGLE_CREDENTIALS=new lt(`google-credentials-uid`),lt.FIRST_PARTY=new lt(`first-party-uid`),lt.MOCK_USER=new lt(`mock-user`);var T=`12.15.0`;function ut(e){T=e}var dt=new o(`@firebase/firestore`);function ft(){return dt.logLevel}function E(e,...t){if(dt.logLevel<=c.DEBUG){let n=t.map(ht);dt.debug(`Firestore (${T}): ${e}`,...n)}}function pt(e,...t){if(dt.logLevel<=c.ERROR){let n=t.map(ht);dt.error(`Firestore (${T}): ${e}`,...n)}}function mt(e,...t){if(dt.logLevel<=c.WARN){let n=t.map(ht);dt.warn(`Firestore (${T}): ${e}`,...n)}}function ht(e){if(typeof e==`string`)return e;try{return function(e){return JSON.stringify(e)}(e)}catch{return e}}function D(e,t,n){let r=`Unexpected state`;typeof t==`string`?r=t:n=t,gt(e,r,n)}function gt(e,t,n){let r=`FIRESTORE (${T}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(n!==void 0)try{r+=` CONTEXT: `+JSON.stringify(n)}catch{r+=` CONTEXT: `+n}throw pt(r),Error(r)}function O(e,t,n,r){let i=`Unexpected state`;typeof n==`string`?i=n:r=n,e||gt(t,i,r)}function k(e,t){return e}var A={OK:`ok`,CANCELLED:`cancelled`,UNKNOWN:`unknown`,INVALID_ARGUMENT:`invalid-argument`,DEADLINE_EXCEEDED:`deadline-exceeded`,NOT_FOUND:`not-found`,ALREADY_EXISTS:`already-exists`,PERMISSION_DENIED:`permission-denied`,UNAUTHENTICATED:`unauthenticated`,RESOURCE_EXHAUSTED:`resource-exhausted`,FAILED_PRECONDITION:`failed-precondition`,ABORTED:`aborted`,OUT_OF_RANGE:`out-of-range`,UNIMPLEMENTED:`unimplemented`,INTERNAL:`internal`,UNAVAILABLE:`unavailable`,DATA_LOSS:`data-loss`},j=class extends m{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}},_t=class{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}},vt=class{constructor(e,t){this.user=t,this.type=`OAuth`,this.headers=new Map,this.headers.set(`Authorization`,`Bearer ${e}`)}},yt=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(lt.UNAUTHENTICATED)))}shutdown(){}},bt=class{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable((()=>t(this.token.user)))}shutdown(){this.changeListener=null}},xt=class{constructor(e){this.t=e,this.currentUser=lt.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){O(this.o===void 0,42304);let n=this.i,r=e=>this.i===n?Promise.resolve():(n=this.i,t(e)),i=new _t;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new _t,e.enqueueRetryable((()=>r(this.currentUser)))};let a=()=>{let t=i;e.enqueueRetryable((async()=>{await t.promise,await r(this.currentUser)}))},o=e=>{E(`FirebaseAuthCredentialsProvider`,`Auth detected`),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit((e=>o(e))),setTimeout((()=>{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?o(e):(E(`FirebaseAuthCredentialsProvider`,`Auth not yet detected`),i.resolve(),i=new _t)}}),0),a()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i===e?t?(O(typeof t.accessToken==`string`,31837,{l:t}),new vt(t.accessToken,this.currentUser)):null:(E(`FirebaseAuthCredentialsProvider`,`getToken aborted due to token change.`),this.getToken()))):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){let e=this.auth&&this.auth.getUid();return O(e===null||typeof e==`string`,2055,{h:e}),new lt(e)}},St=class{constructor(e,t,n){this.T=e,this.P=t,this.R=n,this.type=`FirstParty`,this.user=lt.FIRST_PARTY,this.I=new Map}A(){return this.R?this.R():null}get headers(){this.I.set(`X-Goog-AuthUser`,this.T);let e=this.A();return e&&this.I.set(`Authorization`,e),this.P&&this.I.set(`X-Goog-Iam-Authorization-Token`,this.P),this.I}},Ct=class{constructor(e,t,n){this.T=e,this.P=t,this.R=n}getToken(){return Promise.resolve(new St(this.T,this.P,this.R))}start(e,t){e.enqueueRetryable((()=>t(lt.FIRST_PARTY)))}shutdown(){}invalidateToken(){}},wt=class{constructor(e){this.value=e,this.type=`AppCheck`,this.headers=new Map,e&&e.length>0&&this.headers.set(`x-firebase-appcheck`,this.value)}},Tt=class{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,f(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){O(this.o===void 0,3512);let n=e=>{e.error!=null&&E(`FirebaseAppCheckTokenProvider`,`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let n=e.token!==this.m;return this.m=e.token,E(`FirebaseAppCheckTokenProvider`,`Received ${n?`new`:`existing`} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};let r=e=>{E(`FirebaseAppCheckTokenProvider`,`AppCheck detected`),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((e=>r(e))),setTimeout((()=>{if(!this.appCheck){let e=this.V.getImmediate({optional:!0});e?r(e):E(`FirebaseAppCheckTokenProvider`,`AppCheck not yet detected`)}}),0)}getToken(){if(this.p)return Promise.resolve(new wt(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(O(typeof e.token==`string`,44558,{tokenResult:e}),this.m=e.token,new wt(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function Et(e){let t=typeof self<`u`&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&typeof t.getRandomValues==`function`)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}var Dt=class{static newId(){let e=``;for(;e.length<20;){let t=Et(40);for(let n=0;n<t.length;++n)e.length<20&&t[n]<248&&(e+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.charAt(t[n]%62))}return e}};function M(e,t){return e<t?-1:+(e>t)}function Ot(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e.charAt(r),i=t.charAt(r);if(n!==i)return jt(n)===jt(i)?M(n,i):jt(n)?1:-1}return M(e.length,t.length)}var kt=55296,At=57343;function jt(e){let t=e.charCodeAt(0);return t>=kt&&t<=At}function Mt(e,t,n){return e.length===t.length&&e.every(((e,r)=>n(e,t[r])))}var Nt=`__name__`,Pt=class e{constructor(e,t,n){t===void 0?t=0:t>e.length&&D(637,{offset:t,range:e.length}),n===void 0?n=e.length-t:n>e.length-t&&D(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(t){return e.comparator(this,t)===0}child(t){let n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach((e=>{n.push(e)})):n.push(t),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,n){let r=Math.min(t.length,n.length);for(let i=0;i<r;i++){let r=e.compareSegments(t.get(i),n.get(i));if(r!==0)return r}return M(t.length,n.length)}static compareSegments(t,n){let r=e.isNumericId(t),i=e.isNumericId(n);return r&&!i?-1:!r&&i?1:r&&i?e.extractNumericId(t).compare(e.extractNumericId(n)):Ot(t,n)}static isNumericId(e){return e.startsWith(`__id`)&&e.endsWith(`__`)}static extractNumericId(e){return ae.fromString(e.substring(4,e.length-2))}},N=class e extends Pt{construct(t,n,r){return new e(t,n,r)}canonicalString(){return this.toArray().join(`/`)}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join(`/`)}static fromString(...t){let n=[];for(let e of t){if(e.indexOf(`//`)>=0)throw new j(A.INVALID_ARGUMENT,`Invalid segment (${e}). Paths must not contain // in them.`);n.push(...e.split(`/`).filter((e=>e.length>0)))}return new e(n)}static emptyPath(){return new e([])}},Ft=/^[_a-zA-Z][_a-zA-Z0-9]*$/,It=class e extends Pt{construct(t,n,r){return new e(t,n,r)}static isValidIdentifier(e){return Ft.test(e)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,`\\\\`).replace(/`/g,"\\`"),e.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(`.`)}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Nt}static keyField(){return new e([Nt])}static fromServerFormat(t){let n=[],r=``,i=0,a=()=>{if(r.length===0)throw new j(A.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=``},o=!1;for(;i<t.length;){let e=t[i];if(e===`\\`){if(i+1===t.length)throw new j(A.INVALID_ARGUMENT,`Path has trailing escape character: `+t);let e=t[i+1];if(e!==`\\`&&e!==`.`&&e!=="`")throw new j(A.INVALID_ARGUMENT,`Path has invalid escape sequence: `+t);r+=e,i+=2}else e==="`"?(o=!o,i++):e!==`.`||o?(r+=e,i++):(a(),i++)}if(a(),o)throw new j(A.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new e(n)}static emptyPath(){return new e([])}},P=class e{constructor(e){this.path=e}static fromPath(t){return new e(N.fromString(t))}static fromName(t){return new e(N.fromString(t).popFirst(5))}static empty(){return new e(N.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&N.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return N.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(t){return new e(new N(t.slice()))}};function Lt(e,t,n){if(!n)throw new j(A.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Rt(e,t,n,r){if(!0===t&&!0===r)throw new j(A.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)}function zt(e){if(!P.isDocumentKey(e))throw new j(A.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function Bt(e){return typeof e==`object`&&!!e&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Vt(e){if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`string`)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if(typeof e==`number`||typeof e==`boolean`)return``+e;if(typeof e==`object`){if(e instanceof Array)return`an array`;{let t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:`an object`}}return typeof e==`function`?`a function`:D(12329,{type:typeof e})}function Ht(e,t){if(`_delegate`in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new j(A.INVALID_ARGUMENT,`Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?`);{let n=Vt(e);throw new j(A.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function F(e,t){let n={typeString:e};return t&&(n.value=t),n}function Ut(e,t){if(!Bt(e))throw new j(A.INVALID_ARGUMENT,`JSON must be an object`);let n;for(let r in t)if(t[r]){let i=t[r].typeString,a=`value`in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}let o=e[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(a!==void 0&&o!==a.value){n=`Expected '${r}' field to equal '${a.value}'`;break}}if(n)throw new j(A.INVALID_ARGUMENT,n);return!0}var I=-62135596800,Wt=1e6,L=class e{static now(){return e.fromMillis(Date.now())}static fromDate(t){return e.fromMillis(t.getTime())}static fromMillis(t){let n=Math.floor(t/1e3),r=Math.floor((t-1e3*n)*Wt);return new e(n,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new j(A.INVALID_ARGUMENT,`Timestamp nanoseconds out of range: `+t);if(e<I||e>=253402300800)throw new j(A.INVALID_ARGUMENT,`Timestamp seconds out of range: `+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Wt}_compareTo(e){return this.seconds===e.seconds?M(this.nanoseconds,e.nanoseconds):M(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return`Timestamp(seconds=`+this.seconds+`, nanoseconds=`+this.nanoseconds+`)`}toJSON(){return{type:e._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(Ut(t,e._jsonSchema))return new e(t.seconds,t.nanoseconds)}valueOf(){let e=this.seconds-I;return String(e).padStart(12,`0`)+`.`+String(this.nanoseconds).padStart(9,`0`)}};L._jsonSchemaVersion=`firestore/timestamp/1.0`,L._jsonSchema={type:F(`string`,L._jsonSchemaVersion),seconds:F(`number`),nanoseconds:F(`number`)};var R=class e{static fromTimestamp(t){return new e(t)}static min(){return new e(new L(0,0))}static max(){return new e(new L(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return`SnapshotVersion(`+this.timestamp.toString()+`)`}toTimestamp(){return this.timestamp}},Gt=-1,Kt=class{constructor(e,t,n,r){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=r}};Kt.UNKNOWN_ID=-1;function qt(e,t){let n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1;return new Yt(R.fromTimestamp(r===1e9?new L(n+1,0):new L(n,r)),P.empty(),t)}function Jt(e){return new Yt(e.readTime,e.key,Gt)}var Yt=class e{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new e(R.min(),P.empty(),Gt)}static max(){return new e(R.max(),P.empty(),Gt)}};function Xt(e,t){let n=e.readTime.compareTo(t.readTime);return n===0?(n=P.comparator(e.documentKey,t.documentKey),n===0?M(e.largestBatchId,t.largestBatchId):n):n}var Zt=`The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.`,Qt=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}};async function $t(e){if(e.code!==A.FAILED_PRECONDITION||e.message!==Zt)throw e;E(`LocalStore`,`Unexpectedly lost primary lease`)}var z=class e{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){return this.next(void 0,e)}next(t,n){return this.callbackAttached&&D(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new e(((e,r)=>{this.nextCallback=n=>{this.wrapSuccess(t,n).next(e,r)},this.catchCallback=t=>{this.wrapFailure(n,t).next(e,r)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(t){try{let n=t();return n instanceof e?n:e.resolve(n)}catch(t){return e.reject(t)}}wrapSuccess(t,n){return t?this.wrapUserFunction((()=>t(n))):e.resolve(n)}wrapFailure(t,n){return t?this.wrapUserFunction((()=>t(n))):e.reject(n)}static resolve(t){return new e(((e,n)=>{e(t)}))}static reject(t){return new e(((e,n)=>{n(t)}))}static waitFor(t){return new e(((e,n)=>{let r=0,i=0,a=!1;t.forEach((t=>{++r,t.next((()=>{++i,a&&i===r&&e()}),(e=>n(e)))})),a=!0,i===r&&e()}))}static or(t){let n=e.resolve(!1);for(let r of t)n=n.next((t=>t?e.resolve(t):r()));return n}static forEach(e,t){let n=[];return e.forEach(((e,r)=>{n.push(t.call(this,e,r))})),this.waitFor(n)}static mapArray(t,n){return new e(((e,r)=>{let i=t.length,a=Array(i),o=0;for(let s=0;s<i;s++){let c=s;n(t[c]).next((t=>{a[c]=t,++o,o===i&&e(a)}),(e=>r(e)))}}))}static doWhile(t,n){return new e(((e,r)=>{let i=()=>{!0===t()?n().next((()=>{i()}),r):e()};i()}))}};function en(e){let t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(`.`).slice(0,2).join(`.`):`-1`;return Number(n)}function tn(e){return e.name===`IndexedDbTransactionError`}var nn=class{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ae(e),this.ue=e=>t.writeSequenceNumber(e))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ue&&this.ue(e),e}};nn.ce=-1;var rn=-1;function an(e){return e==null}function on(e){return e===0&&1/e==-1/0}function sn(e){return typeof e==`number`&&Number.isInteger(e)&&!on(e)&&e<=2**53-1&&e>=-(2**53-1)}function cn(e){return typeof e==`string`}var ln=``;function un(e){let t=``;for(let n=0;n<e.length;n++)t.length>0&&(t=fn(t)),t=dn(e.get(n),t);return fn(t)}function dn(e,t){let n=t,r=e.length;for(let t=0;t<r;t++){let r=e.charAt(t);switch(r){case`\0`:n+=``;break;case ln:n+=``;break;default:n+=r}}return n}function fn(e){return e+``}var B=class e{constructor(e,t){this.comparator=e,this.root=t||mn.EMPTY}insert(t,n){return new e(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,mn.BLACK,null,null))}remove(t){return new e(this.comparator,this.root.remove(t,this.comparator).copy(null,null,mn.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let n=this.comparator(e,t.key);if(n===0)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){let r=this.comparator(e,n.key);if(r===0)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,n)=>(e(t,n),!1)))}toString(){let e=[];return this.inorderTraversal(((t,n)=>(e.push(`${t}:${n}`),!1))),`{${e.join(`, `)}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new pn(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new pn(this.root,e,this.comparator,!1)}getReverseIterator(){return new pn(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new pn(this.root,e,this.comparator,!0)}},pn=class{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&r&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}},mn=class e{constructor(t,n,r,i,a){this.key=t,this.value=n,this.color=r??e.RED,this.left=i??e.EMPTY,this.right=a??e.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,n,r,i,a){return new e(t??this.key,n??this.value,r??this.color,i??this.left,a??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this,i=n(e,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):i===0?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return e.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,n){let r,i=this;if(n(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(t,i.key)===0){if(i.right.isEmpty())return e.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){let t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){let t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){return 2**this.check()<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw D(43730,{key:this.key,value:this.value});if(this.right.isRed())throw D(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw D(27949);return e+ +!this.isRed()}};mn.EMPTY=null,mn.RED=!0,mn.BLACK=!1,mn.EMPTY=new class{constructor(){this.size=0}get key(){throw D(57766)}get value(){throw D(16141)}get color(){throw D(16727)}get left(){throw D(29726)}get right(){throw D(36894)}copy(e,t,n,r,i){return this}insert(e,t,n){return new mn(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};var V=class e{constructor(e){this.comparator=e,this.data=new B(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,n)=>(e(t),!1)))}forEachInRange(e,t){let n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){let r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=t===void 0?this.data.getIterator():this.data.getIteratorFrom(t);n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new H(this.data.getIterator())}getIteratorFrom(e){return new H(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((e=>{t=t.add(e)})),t}isEqual(t){if(!(t instanceof e)||this.size!==t.size)return!1;let n=this.data.getIterator(),r=t.data.getIterator();for(;n.hasNext();){let e=n.getNext().key,t=r.getNext().key;if(this.comparator(e,t)!==0)return!1}return!0}toArray(){let e=[];return this.forEach((t=>{e.push(t)})),e}toString(){let e=[];return this.forEach((t=>e.push(t))),`SortedSet(`+e.toString()+`)`}copy(t){let n=new e(this.comparator);return n.data=t,n}},H=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}},hn=class e{constructor(e){this.fields=e,e.sort(It.comparator)}static empty(){return new e([])}unionWith(t){let n=new V(It.comparator);for(let e of this.fields)n=n.add(e);for(let e of t)n=n.add(e);return new e(n.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Mt(this.fields,e.fields,((e,t)=>e.isEqual(t)))}};function gn(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function _n(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function vn(e,t){let n=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.push(t(e[r],r,e));return n}function yn(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}var bn=class extends Error{constructor(){super(...arguments),this.name=`Base64DecodeError`}},U=class e{constructor(e){this.binaryString=e}static fromBase64String(t){let n=function(e){try{return atob(e)}catch(e){throw typeof DOMException<`u`&&e instanceof DOMException?new bn(`Invalid base64 string: `+e):e}}(t);return new e(n)}static fromUint8Array(t){let n=function(e){let t=``;for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(t);return new e(n)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(e){return btoa(e)}(this.binaryString)}toUint8Array(){return function(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return M(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};U.EMPTY_BYTE_STRING=new U(``);var xn=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Sn(e){if(O(!!e,39018),typeof e==`string`){let t=0,n=xn.exec(e);if(O(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+`000000000`).substr(0,9),t=Number(e)}let r=new Date(e);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:W(e.seconds),nanos:W(e.nanos)}}function W(e){return typeof e==`number`?e:typeof e==`string`?Number(e):0}function Cn(e){return typeof e==`string`?U.fromBase64String(e):U.fromUint8Array(e)}var wn=`server_timestamp`,Tn=`__type__`,En=`__previous_value__`,Dn=`__local_write_time__`;function On(e){return(e?.mapValue?.fields||{})[Tn]?.stringValue===wn}function kn(e){let t=e.mapValue.fields[En];return On(t)?kn(t):t}function An(e){let t=Sn(e.mapValue.fields[Dn].timestampValue);return new L(t.seconds,t.nanos)}var jn=class{constructor(e,t,n,r,i,a,o,s,c,l,u){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=o,this.longPollingOptions=s,this.useFetchStreams=c,this.isUsingEmulator=l,this.apiKey=u}},Mn=`(default)`,Nn=class e{constructor(e,t){this.projectId=e,this.database=t||Mn}static empty(){return new e(``,``)}get isDefaultDatabase(){return this.database===Mn}isEqual(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database}};function Pn(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,[`projectId`]))throw new j(A.INVALID_ARGUMENT,`"projectId" not provided in firebase.initializeApp.`);return new Nn(e.options.projectId,t)}var Fn=`__type__`,In=`__max__`,Ln={mapValue:{fields:{__type__:{stringValue:In}}}},Rn=`__vector__`,zn=`value`,Bn={nullValue:`NULL_VALUE`},Vn={booleanValue:!0},Hn={booleanValue:!1};function G(e){return`nullValue`in e?0:`booleanValue`in e?1:`integerValue`in e||`doubleValue`in e?2:`timestampValue`in e?3:`stringValue`in e?5:`bytesValue`in e?6:`referenceValue`in e?7:`geoPointValue`in e?8:`arrayValue`in e?9:`mapValue`in e?On(e)?4:sr(e)?9007199254740991:ir(e)?10:11:D(28295,{value:e})}function Un(e,t,n){if(e===t)return!0;let r=G(e);if(r!==G(t))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return An(e).isEqual(An(t));case 3:return function(e,t){if(typeof e.timestampValue==`string`&&typeof t.timestampValue==`string`&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let n=Sn(e.timestampValue),r=Sn(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Cn(e.bytesValue).isEqual(Cn(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return W(e.geoPointValue.latitude)===W(t.geoPointValue.latitude)&&W(e.geoPointValue.longitude)===W(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t,n){if(`integerValue`in e&&`integerValue`in t)return W(e.integerValue)===W(t.integerValue);let r,i;if(`doubleValue`in e&&`doubleValue`in t)r=W(e.doubleValue),i=W(t.doubleValue);else{if(!n?.Ee)return!1;r=W(e.integerValue??e.doubleValue),i=W(t.integerValue??t.doubleValue)}return r===i?!!n?.he||on(r)===on(i):!!(n===void 0||n.Te)&&isNaN(r)&&isNaN(i)}(e,t,n);case 9:return Mt(e.arrayValue.values||[],t.arrayValue.values||[],((e,t)=>Un(e,t,n)));case 10:case 11:return function(e,t,n){let r=e.mapValue.fields||{},i=t.mapValue.fields||{};if(gn(r)!==gn(i))return!1;for(let e in r)if(r.hasOwnProperty(e)&&(i[e]===void 0||!Un(r[e],i[e],n)))return!1;return!0}(e,t,n);default:return D(52216,{left:e})}}function Wn(e,t){return(e.values||[]).find((e=>Un(e,t)))!==void 0}function Gn(e,t){if(e===t)return 0;let n=G(e),r=G(t);if(n!==r)return M(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return M(e.booleanValue,t.booleanValue);case 2:return function(e,t){let n=W(e.integerValue||e.doubleValue),r=W(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return Kn(e.timestampValue,t.timestampValue);case 4:return Kn(An(e),An(t));case 5:return Ot(e.stringValue,t.stringValue);case 6:return function(e,t){let n=Cn(e),r=Cn(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){let n=e.split(`/`),r=t.split(`/`);for(let e=0;e<n.length&&e<r.length;e++){let t=M(n[e],r[e]);if(t!==0)return t}return M(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){let n=M(W(e.latitude),W(t.latitude));return n===0?M(W(e.longitude),W(t.longitude)):n}(e.geoPointValue,t.geoPointValue);case 9:return qn(e.arrayValue,t.arrayValue);case 10:return function(e,t){let n=e.fields||{},r=t.fields||{},i=n[zn]?.arrayValue,a=r[zn]?.arrayValue,o=M(i?.values?.length||0,a?.values?.length||0);return o===0?qn(i,a):o}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===Ln.mapValue&&t===Ln.mapValue)return 0;if(e===Ln.mapValue)return 1;if(t===Ln.mapValue)return-1;let n=e.fields||{},r=Object.keys(n),i=t.fields||{},a=Object.keys(i);r.sort(),a.sort();for(let e=0;e<r.length&&e<a.length;++e){let t=Ot(r[e],a[e]);if(t!==0)return t;let o=Gn(n[r[e]],i[a[e]]);if(o!==0)return o}return M(r.length,a.length)}(e.mapValue,t.mapValue);default:throw D(23264,{Pe:n})}}function Kn(e,t){if(typeof e==`string`&&typeof t==`string`&&e.length===t.length)return M(e,t);let n=Sn(e),r=Sn(t),i=M(n.seconds,r.seconds);return i===0?M(n.nanos,r.nanos):i}function qn(e,t){let n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){let t=Gn(n[e],r[e]);if(t!==void 0&&t!==0)return t}return M(n.length,r.length)}function Jn(e){return Yn(e)}function Yn(e){return`nullValue`in e?`null`:`booleanValue`in e?``+e.booleanValue:`integerValue`in e?``+e.integerValue:`doubleValue`in e?``+e.doubleValue:`timestampValue`in e?function(e){let t=Sn(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):`stringValue`in e?e.stringValue:`bytesValue`in e?function(e){return Cn(e).toBase64()}(e.bytesValue):`referenceValue`in e?function(e){return P.fromName(e).toString()}(e.referenceValue):`geoPointValue`in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):`arrayValue`in e?function(e){let t=`[`,n=!0;for(let r of e.values||[])n?n=!1:t+=`,`,t+=Yn(r);return t+`]`}(e.arrayValue):`mapValue`in e?function(e){let t=Object.keys(e.fields||{}).sort(),n=`{`,r=!0;for(let i of t)r?r=!1:n+=`,`,n+=`${i}:${Yn(e.fields[i])}`;return n+`}`}(e.mapValue):D(61005,{value:e})}function Xn(e){switch(G(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let t=kn(e);return t?16+Xn(t):16;case 5:return 2*e.stringValue.length;case 6:return Cn(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce(((e,t)=>e+Xn(t)),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return _n(e.fields,((e,n)=>{t+=e.length+Xn(n)})),t}(e.mapValue);default:throw D(13486,{value:e})}}function Zn(e){return!!e&&`integerValue`in e}function Qn(e){return!!e&&`doubleValue`in e}function $n(e){return Zn(e)||Qn(e)}function er(e){return!!e&&`arrayValue`in e}function tr(e){return!!e&&`nullValue`in e}function nr(e){return!!e&&`doubleValue`in e&&isNaN(Number(e.doubleValue))}function rr(e){return!!e&&`mapValue`in e}function ir(e){return(e?.mapValue?.fields||{})[Fn]?.stringValue===Rn}function ar(e){return(e?.mapValue?.fields||{})[zn]?.arrayValue}function or(e){if(e.geoPointValue)return{geoPointValue:{...e.geoPointValue}};if(e.timestampValue&&typeof e.timestampValue==`object`)return{timestampValue:{...e.timestampValue}};if(e.mapValue){let t={mapValue:{fields:{}}};return _n(e.mapValue.fields,((e,n)=>t.mapValue.fields[e]=or(n))),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=or(e.arrayValue.values[n]);return t}return{...e}}function sr(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===In}var cr=class e{constructor(e){this.value=e}static empty(){return new e({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!rr(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=or(t)}setAll(e){let t=It.emptyPath(),n={},r=[];e.forEach(((e,i)=>{if(!t.isImmediateParentOf(i)){let e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=i.popLast()}e?n[i.lastSegment()]=or(e):r.push(i.lastSegment())}));let i=this.getFieldsMap(t);this.applyChanges(i,n,r)}delete(e){let t=this.field(e.popLast());rr(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Un(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let r=t.mapValue.fields[e.get(n)];rr(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,n){_n(t,((t,n)=>e[t]=n));for(let t of n)delete e[t]}clone(){return new e(or(this.value))}};function lr(e){let t=[];return _n(e.fields,((e,n)=>{let r=new It([e]);if(rr(n)){let e=lr(n.mapValue).fields;if(e.length===0)t.push(r);else for(let n of e)t.push(r.child(n))}else t.push(r)})),new hn(t)}function ur(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:`NaN`};if(t===1/0)return{doubleValue:`Infinity`};if(t===-1/0)return{doubleValue:`-Infinity`}}return{doubleValue:on(t)?`-0`:t}}function dr(e){return{integerValue:``+e}}function fr(e,t,n){return Number.isInteger(t)&&n?.preferIntegers||sn(t)?dr(t):ur(e,t)}var pr=class{constructor(){this._=void 0}};function mr(e,t,n){return e instanceof _r?function(e,t){let n={fields:{[Tn]:{stringValue:wn},[Dn]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&On(t)&&(t=kn(t)),t&&(n.fields[En]=t),{mapValue:n}}(n,t):e instanceof vr?yr(e,t):e instanceof br?xr(e,t):e instanceof Cr?function(e,t){let n=gr(e,t),r=Dr(n)+Dr(e.Re);return Zn(n)&&Zn(e.Re)?dr(r):ur(e.serializer,r)}(e,t):e instanceof wr?function(e,t){return Er(e,t,Math.min)}(e,t):e instanceof Tr?function(e,t){return Er(e,t,Math.max)}(e,t):void 0}function hr(e,t,n){return e instanceof vr?yr(e,t):e instanceof br?xr(e,t):n}function gr(e,t){return e instanceof Cr?$n(t)?t:{integerValue:0}:null}var _r=class extends pr{},vr=class extends pr{constructor(e){super(),this.elements=e}};function yr(e,t){let n=Or(t);for(let t of e.elements)n.some((e=>Un(e,t)))||n.push(t);return{arrayValue:{values:n}}}var br=class extends pr{constructor(e){super(),this.elements=e}};function xr(e,t){let n=Or(t);for(let t of e.elements)n=n.filter((e=>!Un(e,t)));return{arrayValue:{values:n}}}var Sr=class extends pr{constructor(e,t){super(),this.serializer=e,this.Re=t}},Cr=class extends Sr{},wr=class extends Sr{},Tr=class extends Sr{};function Er(e,t,n){if(!$n(t))return e.Re;let r=n(Dr(t),Dr(e.Re));return Zn(t)&&Zn(e.Re)?dr(r):ur(e.serializer,r)}function Dr(e){return W(e.integerValue||e.doubleValue)}function Or(e){return er(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}var kr=class{constructor(e,t){this.field=e,this.transform=t}};function Ar(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof vr&&t instanceof vr||e instanceof br&&t instanceof br?Mt(e.elements,t.elements,Un):e instanceof Cr&&t instanceof Cr||e instanceof wr&&t instanceof wr||e instanceof Tr&&t instanceof Tr?Un(e.Re,t.Re):e instanceof _r&&t instanceof _r}(e.transform,t.transform)}var jr=class{constructor(e,t){this.version=e,this.transformResults=t}},Mr=class e{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new e}static exists(t){return new e(void 0,t)}static updateTime(t){return new e(t)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}};function Nr(e,t){return e.updateTime===void 0?e.exists===void 0||e.exists===t.isFoundDocument():t.isFoundDocument()&&t.version.isEqual(e.updateTime)}var Pr=class{};function Fr(e,t){if(!e.hasLocalMutations||t&&t.fields.length===0)return null;if(t===null)return e.isNoDocument()?new Gr(e.key,Mr.none()):new Br(e.key,e.data,Mr.none());{let n=e.data,r=cr.empty(),i=new V(It.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);t===null&&e.length>1&&(e=e.popLast(),t=n.field(e)),t===null?r.delete(e):r.set(e,t),i=i.add(e)}return new Vr(e.key,r,new hn(i.toArray()),Mr.none())}}function Ir(e,t,n){e instanceof Br?function(e,t,n){let r=e.value.clone(),i=Ur(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof Vr?function(e,t,n){if(!Nr(e.precondition,t))return void t.convertToUnknownDocument(n.version);let r=Ur(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(Hr(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function Lr(e,t,n,r){return e instanceof Br?function(e,t,n,r){if(!Nr(e.precondition,t))return n;let i=e.value.clone(),a=Wr(e.fieldTransforms,r,t);return i.setAll(a),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof Vr?function(e,t,n,r){if(!Nr(e.precondition,t))return n;let i=Wr(e.fieldTransforms,r,t),a=t.data;return a.setAll(Hr(e)),a.setAll(i),t.convertToFoundDocument(t.version,a).setHasLocalMutations(),n===null?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,r):function(e,t,n){return Nr(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Rr(e,t){let n=null;for(let r of e.fieldTransforms){let e=t.data.field(r.field),i=gr(r.transform,e||null);i!=null&&(n===null&&(n=cr.empty()),n.set(r.field,i))}return n||null}function zr(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return e===void 0&&t===void 0||!(!e||!t)&&Mt(e,t,((e,t)=>Ar(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(e.type===0?e.value.isEqual(t.value):e.type!==1||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}var Br=class extends Pr{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}},Vr=class extends Pr{constructor(e,t,n,r,i=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}};function Hr(e){let t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){let r=e.data.field(n);t.set(n,r)}})),t}function Ur(e,t,n){let r=new Map;O(e.length===n.length,32656,{Ie:n.length,Ae:e.length});for(let i=0;i<n.length;i++){let a=e[i],o=a.transform,s=t.data.field(a.field);r.set(a.field,hr(o,s,n[i]))}return r}function Wr(e,t,n){let r=new Map;for(let i of e){let e=i.transform,a=n.data.field(i.field);r.set(i.field,mr(e,a,t))}return r}var Gr=class extends Pr{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},Kr=class extends Pr{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}},qr=class{constructor(e,t){this.position=e,this.inclusive=t}};function Jr(e,t,n){let r=0;for(let i=0;i<e.position.length;i++){let a=t[i],o=e.position[i];if(r=a.field.isKeyField()?P.comparator(P.fromName(o.referenceValue),n.key):Gn(o,n.data.field(a.field)),a.dir===`desc`&&(r*=-1),r!==0)break}return r}function Yr(e,t){if(e===null)return t===null;if(t===null||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!Un(e.position[n],t.position[n]))return!1;return!0}var Xr=class{},Zr=class e extends Xr{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(t,n,r){return t.isKeyField()?n===`in`||n===`not-in`?this.createKeyFieldInFilter(t,n,r):new ai(t,n,r):n===`array-contains`?new li(t,r):n===`in`?new ui(t,r):n===`not-in`?new di(t,r):n===`array-contains-any`?new fi(t,r):new e(t,n,r)}static createKeyFieldInFilter(e,t,n){return t===`in`?new oi(e,n):new si(e,n)}matches(e){let t=e.data.field(this.field);return this.op===`!=`?t!==null&&t.nullValue===void 0&&this.matchesComparison(Gn(t,this.value)):t!==null&&G(this.value)===G(t)&&this.matchesComparison(Gn(t,this.value))}matchesComparison(e){switch(this.op){case`<`:return e<0;case`<=`:return e<=0;case`==`:return e===0;case`!=`:return e!==0;case`>`:return e>0;case`>=`:return e>=0;default:return D(47266,{operator:this.op})}}isInequality(){return[`<`,`<=`,`>`,`>=`,`!=`,`not-in`].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},Qr=class e extends Xr{constructor(e,t){super(),this.filters=e,this.op=t,this.Ve=null}static create(t,n){return new e(t,n)}matches(e){return $r(this)?this.filters.find((t=>!t.matches(e)))===void 0:this.filters.find((t=>t.matches(e)))!==void 0}getFlattenedFilters(){return this.Ve!==null||(this.Ve=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.Ve}getFilters(){return Object.assign([],this.filters)}};function $r(e){return e.op===`and`}function ei(e){return ti(e)&&$r(e)}function ti(e){for(let t of e.filters)if(t instanceof Qr)return!1;return!0}function ni(e){if(e instanceof Zr)return e.field.canonicalString()+e.op.toString()+Jn(e.value);if(ei(e))return e.filters.map((e=>ni(e))).join(`,`);{let t=e.filters.map((e=>ni(e))).join(`,`);return`${e.op}(${t})`}}function ri(e,t){return e instanceof Zr?function(e,t){return t instanceof Zr&&e.op===t.op&&e.field.isEqual(t.field)&&Un(e.value,t.value)}(e,t):e instanceof Qr?function(e,t){return t instanceof Qr&&e.op===t.op&&e.filters.length===t.filters.length?e.filters.reduce(((e,n,r)=>e&&ri(n,t.filters[r])),!0):!1}(e,t):void D(19439)}function ii(e){return e instanceof Zr?function(e){return`${e.field.canonicalString()} ${e.op} ${Jn(e.value)}`}(e):e instanceof Qr?function(e){return e.op.toString()+` {`+e.getFilters().map(ii).join(` ,`)+`}`}(e):`Filter`}var ai=class extends Zr{constructor(e,t,n){super(e,t,n),this.key=P.fromName(n.referenceValue)}matches(e){let t=P.comparator(e.key,this.key);return this.matchesComparison(t)}},oi=class extends Zr{constructor(e,t){super(e,`in`,t),this.keys=ci(`in`,t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}},si=class extends Zr{constructor(e,t){super(e,`not-in`,t),this.keys=ci(`not-in`,t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}};function ci(e,t){return(t.arrayValue?.values||[]).map((e=>P.fromName(e.referenceValue)))}var li=class extends Zr{constructor(e,t){super(e,`array-contains`,t)}matches(e){let t=e.data.field(this.field);return er(t)&&Wn(t.arrayValue,this.value)}},ui=class extends Zr{constructor(e,t){super(e,`in`,t)}matches(e){let t=e.data.field(this.field);return t!==null&&Wn(this.value.arrayValue,t)}},di=class extends Zr{constructor(e,t){super(e,`not-in`,t)}matches(e){if(Wn(this.value.arrayValue,{nullValue:`NULL_VALUE`}))return!1;let t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!Wn(this.value.arrayValue,t)}},fi=class extends Zr{constructor(e,t){super(e,`array-contains-any`,t)}matches(e){let t=e.data.field(this.field);return!(!er(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>Wn(this.value.arrayValue,e)))}},pi=class{constructor(e,t=`asc`){this.field=e,this.dir=t}};function mi(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}var hi=class e{constructor(e,t,n,r,i,a,o){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=i,this.data=a,this.documentState=o}static newInvalidDocument(t){return new e(t,0,R.min(),R.min(),R.min(),cr.empty(),0)}static newFoundDocument(t,n,r,i){return new e(t,1,n,R.min(),r,i,0)}static newNoDocument(t,n){return new e(t,2,n,R.min(),R.min(),cr.empty(),0)}static newUnknownDocument(t,n){return new e(t,3,n,R.min(),R.min(),cr.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(R.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=cr.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=cr.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=R.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new e(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}},gi=class{constructor(e,t=null,n=[],r=[],i=null,a=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=a,this.endAt=o,this.de=null}};function _i(e,t=null,n=[],r=[],i=null,a=null,o=null){return new gi(e,t,n,r,i,a,o)}function vi(e){let t=k(e);if(t.de===null){let e=t.path.canonicalString();t.collectionGroup!==null&&(e+=`|cg:`+t.collectionGroup),e+=`|f:`,e+=t.filters.map((e=>ni(e))).join(`,`),e+=`|ob:`,e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(`,`),an(t.limit)||(e+=`|l:`,e+=t.limit),t.startAt&&(e+=`|lb:`,e+=t.startAt.inclusive?`b:`:`a:`,e+=t.startAt.position.map((e=>Jn(e))).join(`,`)),t.endAt&&(e+=`|ub:`,e+=t.endAt.inclusive?`a:`:`b:`,e+=t.endAt.position.map((e=>Jn(e))).join(`,`)),t.de=e}return t.de}function yi(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!mi(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!ri(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!Yr(e.startAt,t.startAt)&&Yr(e.endAt,t.endAt)}function bi(e){return!!e.isCorePipeline}function xi(e){return!!e.path&&P.isDocumentKey(e.path)&&e.collectionGroup===null&&e.filters.length===0}var Si=class{constructor(e,t=null,n=[],r=[],i=null,a=`F`,o=null,s=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=a,this.startAt=o,this.endAt=s,this.fe=null,this.me=null,this.pe=null,this.startAt,this.endAt}};function Ci(e,t,n,r,i,a,o,s){return new Si(e,t,n,r,i,a,o,s)}function wi(e){return new Si(e)}function Ti(e){return e.filters.length===0&&e.limit===null&&e.startAt==null&&e.endAt==null&&(e.explicitOrderBy.length===0||e.explicitOrderBy.length===1&&e.explicitOrderBy[0].field.isKeyField())}function Ei(e){return P.isDocumentKey(e.path)&&e.collectionGroup===null&&e.filters.length===0}function Di(e){return e.collectionGroup!==null}function Oi(e){let t=k(e);if(t.fe===null){t.fe=[];let e=new Set;for(let n of t.explicitOrderBy)t.fe.push(n),e.add(n.field.canonicalString());let n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:`asc`;(function(e){let t=new V(It.comparator);return e.filters.forEach((e=>{e.getFlattenedFilters().forEach((e=>{e.isInequality()&&(t=t.add(e.field))}))})),t})(t).forEach((r=>{e.has(r.canonicalString())||r.isKeyField()||t.fe.push(new pi(r,n))})),e.has(It.keyField().canonicalString())||t.fe.push(new pi(It.keyField(),n))}return t.fe}function ki(e){let t=k(e);return t.me||=Ai(t,Oi(e)),t.me}function Ai(e,t){if(e.limitType===`F`)return _i(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map((e=>{let t=e.dir===`desc`?`asc`:`desc`;return new pi(e.field,t)}));let n=e.endAt?new qr(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new qr(e.startAt.position,e.startAt.inclusive):null;return _i(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}function ji(e,t,n){return new Si(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function Mi(e,t){return yi(ki(e),ki(t))&&e.limitType===t.limitType}function Ni(e){return`Query(target=${function(e){let t=e.path.canonicalString();return e.collectionGroup!==null&&(t+=` collectionGroup=`+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map((e=>ii(e))).join(`, `)}]`),an(e.limit)||(t+=`, limit: `+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map((e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e))).join(`, `)}]`),e.startAt&&(t+=`, startAt: `,t+=e.startAt.inclusive?`b:`:`a:`,t+=e.startAt.position.map((e=>Jn(e))).join(`,`)),e.endAt&&(t+=`, endAt: `,t+=e.endAt.inclusive?`a:`:`b:`,t+=e.endAt.position.map((e=>Jn(e))).join(`,`)),`Target(${t})`}(ki(e))}; limitType=${e.limitType})`}function Pi(e,t){return t.isFoundDocument()&&function(e,t){let n=t.key.path;return e.collectionGroup===null?P.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n):t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n)}(e,t)&&function(e,t){for(let n of Oi(e))if(!n.field.isKeyField()&&t.data.field(n.field)===null)return!1;return!0}(e,t)&&function(e,t){for(let n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){let r=Jr(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Oi(e),t)||e.endAt&&!function(e,t,n){let r=Jr(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Oi(e),t))}(e,t)}function Fi(e){return(t,n)=>{let r=!1;for(let i of Oi(e)){let e=Ii(i,t,n);if(e!==0)return e;r||=i.field.isKeyField()}return 0}}function Ii(e,t,n){let r=e.field.isKeyField()?P.comparator(t.key,n.key):function(e,t,n){let r=t.data.field(e),i=n.data.field(e);return r!==null&&i!==null?Gn(r,i):D(42886)}(e.field,t,n);switch(e.dir){case`asc`:return r;case`desc`:return-1*r;default:return D(19790,{direction:e.dir})}}var Li=class{constructor(e,t){this.count=e,this.unchangedNames=t}},K,q;function Ri(e){switch(e){case A.OK:return D(64938);case A.CANCELLED:case A.UNKNOWN:case A.DEADLINE_EXCEEDED:case A.RESOURCE_EXHAUSTED:case A.INTERNAL:case A.UNAVAILABLE:case A.UNAUTHENTICATED:return!1;case A.INVALID_ARGUMENT:case A.NOT_FOUND:case A.ALREADY_EXISTS:case A.PERMISSION_DENIED:case A.FAILED_PRECONDITION:case A.ABORTED:case A.OUT_OF_RANGE:case A.UNIMPLEMENTED:case A.DATA_LOSS:return!0;default:return D(15467,{code:e})}}function zi(e){if(e===void 0)return pt(`GRPC error has no .code`),A.UNKNOWN;switch(e){case K.OK:return A.OK;case K.CANCELLED:return A.CANCELLED;case K.UNKNOWN:return A.UNKNOWN;case K.DEADLINE_EXCEEDED:return A.DEADLINE_EXCEEDED;case K.RESOURCE_EXHAUSTED:return A.RESOURCE_EXHAUSTED;case K.INTERNAL:return A.INTERNAL;case K.UNAVAILABLE:return A.UNAVAILABLE;case K.UNAUTHENTICATED:return A.UNAUTHENTICATED;case K.INVALID_ARGUMENT:return A.INVALID_ARGUMENT;case K.NOT_FOUND:return A.NOT_FOUND;case K.ALREADY_EXISTS:return A.ALREADY_EXISTS;case K.PERMISSION_DENIED:return A.PERMISSION_DENIED;case K.FAILED_PRECONDITION:return A.FAILED_PRECONDITION;case K.ABORTED:return A.ABORTED;case K.OUT_OF_RANGE:return A.OUT_OF_RANGE;case K.UNIMPLEMENTED:return A.UNIMPLEMENTED;case K.DATA_LOSS:return A.DATA_LOSS;default:return D(39323,{code:e})}}(q=K||={})[q.OK=0]=`OK`,q[q.CANCELLED=1]=`CANCELLED`,q[q.UNKNOWN=2]=`UNKNOWN`,q[q.INVALID_ARGUMENT=3]=`INVALID_ARGUMENT`,q[q.DEADLINE_EXCEEDED=4]=`DEADLINE_EXCEEDED`,q[q.NOT_FOUND=5]=`NOT_FOUND`,q[q.ALREADY_EXISTS=6]=`ALREADY_EXISTS`,q[q.PERMISSION_DENIED=7]=`PERMISSION_DENIED`,q[q.UNAUTHENTICATED=16]=`UNAUTHENTICATED`,q[q.RESOURCE_EXHAUSTED=8]=`RESOURCE_EXHAUSTED`,q[q.FAILED_PRECONDITION=9]=`FAILED_PRECONDITION`,q[q.ABORTED=10]=`ABORTED`,q[q.OUT_OF_RANGE=11]=`OUT_OF_RANGE`,q[q.UNIMPLEMENTED=12]=`UNIMPLEMENTED`,q[q.INTERNAL=13]=`INTERNAL`,q[q.UNAVAILABLE=14]=`UNAVAILABLE`,q[q.DATA_LOSS=15]=`DATA_LOSS`;var Bi=class{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n!==void 0){for(let[t,r]of n)if(this.equalsFn(t,e))return r}}has(e){return this.get(e)!==void 0}set(e,t){let n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n===void 0)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return n.length===1?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){_n(this.inner,((t,n)=>{for(let[t,r]of n)e(t,r)}))}isEmpty(){return yn(this.inner)}size(){return this.innerSize}},Vi=new B(P.comparator);function Hi(){return Vi}var Ui=new B(P.comparator);function Wi(...e){let t=Ui;for(let n of e)t=t.insert(n.key,n);return t}function Gi(e){let t=Ui;return e.forEach(((e,n)=>t=t.insert(e,n.overlayedDocument))),t}function Ki(){return Ji()}function qi(){return Ji()}function Ji(){return new Bi((e=>e.toString()),((e,t)=>e.isEqual(t)))}var Yi=new B(P.comparator),Xi=new V(P.comparator);function J(...e){let t=Xi;for(let n of e)t=t.add(n);return t}var Zi=new V(M);function Qi(){return Zi}var $i=null;function ea(){return new TextEncoder}var ta=new ae([4294967295,4294967295],0);function na(e){let t=ea().encode(e),n=new oe;return n.update(t),new Uint8Array(n.digest())}function ra(e){let t=new DataView(e.buffer),n=t.getUint32(0,!0),r=t.getUint32(4,!0),i=t.getUint32(8,!0),a=t.getUint32(12,!0);return[new ae([n,r],0),new ae([i,a],0)]}var ia=class e{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new aa(`Invalid padding: ${t}`);if(n<0||e.length>0&&this.hashCount===0)throw new aa(`Invalid hash count: ${n}`);if(e.length===0&&t!==0)throw new aa(`Invalid padding when bitmap length is 0: ${t}`);this.ge=8*e.length-t,this.ye=ae.fromNumber(this.ge)}we(e,t,n){let r=e.add(t.multiply(ae.fromNumber(n)));return r.compare(ta)===1&&(r=new ae([r.getBits(0),r.getBits(1)],0)),r.modulo(this.ye).toNumber()}be(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;let[t,n]=ra(na(e));for(let e=0;e<this.hashCount;e++){let r=this.we(t,n,e);if(!this.be(r))return!1}return!0}static create(t,n,r){let i=t%8==0?0:8-t%8,a=new Uint8Array(Math.ceil(t/8)),o=new e(a,i,n);return r.forEach((e=>o.insert(e))),o}insert(e){if(this.ge===0)return;let[t,n]=ra(na(e));for(let e=0;e<this.hashCount;e++){let r=this.we(t,n,e);this.ve(r)}}ve(e){let t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}},aa=class extends Error{constructor(){super(...arguments),this.name=`BloomFilterError`}},oa=class e{constructor(e,t,n,r,i,a){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.augmentedDocumentUpdates=i,this.resolvedLimboDocuments=a}static createSynthesizedRemoteEventForCurrentChange(t,n,r){let i=new Map;return i.set(t,sa.createSynthesizedTargetChangeForCurrentChange(t,n,r)),new e(R.min(),i,new B(M),Hi(),Hi(),J())}},sa=class e{constructor(e,t,n,r,i){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(t,n,r){return new e(r,n,J(),J(),J())}},ca=class{constructor(e,t,n,r){this.Se=e,this.removedTargetIds=t,this.key=n,this.De=r}},la=class{constructor(e,t){this.targetId=e,this.xe=t}},ua=class{constructor(e,t,n=U.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}},da=class{constructor(e){this.targetId=e,this.Ce=0,this.Fe=ha(),this.Oe=U.EMPTY_BYTE_STRING,this.Me=!1,this.Ne=!0}get current(){return this.Me}get resumeToken(){return this.Oe}get Le(){return this.Ce!==0}get Be(){return this.Ne}Ue(e){e.approximateByteSize()>0&&(this.Ne=!0,this.Oe=e)}ke(){let e=J(),t=J(),n=J();return this.Fe.forEach(((r,i)=>{switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:D(38017,{changeType:i})}})),new sa(this.Oe,this.Me,e,t,n)}qe(){this.Ne=!1,this.Fe=ha()}$e(e,t){this.Ne=!0,this.Fe=this.Fe.insert(e,t)}Ke(e){this.Ne=!0,this.Fe=this.Fe.remove(e)}We(){this.Ce+=1}Qe(){--this.Ce,O(this.Ce>=0,3241,{Ce:this.Ce,targetId:this.targetId})}Ge(){this.Ne=!0,this.Me=!0}},fa=`WatchChangeAggregator`,pa=class{constructor(e){this.ze=e,this.je=new Map,this.He=Hi(),this.Je=ma(),this.Ye=Hi(),this.Ze=ma(),this.Xe=new B(M)}et(e){for(let t of e.Se)e.De&&e.De.isFoundDocument()?this.tt(t,e.De):this.nt(t,e.key,e.De);for(let t of e.removedTargetIds)this.nt(t,e.key,e.De)}rt(e){this.forEachTarget(e,(t=>{let n=this.je.get(t);if(n)switch(e.state){case 0:this.it(t)&&n.Ue(e.resumeToken);break;case 1:n.Qe(),n.Le||n.qe(),n.Ue(e.resumeToken);break;case 2:n.Qe(),n.Le||this.removeTarget(t);break;case 3:this.it(t)&&(n.Ge(),n.Ue(e.resumeToken));break;case 4:this.it(t)&&(this.st(t),n.Ue(e.resumeToken));break;default:D(56790,{state:e.state})}else E(fa,`handleTargetChange received targetChange for untracked target ID (${t}) with state (${e.state})`)}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.je.forEach(((e,n)=>{this.it(n)&&t(n)}))}_t(e){return bi(e)?e.getPipelineSourceType()===`documents`&&e.getPipelineDocuments()?.length===1:xi(e)}ot(e){let t=e.targetId,n=e.xe.count,r=this.ut(t);if(r){let i=r.target;if(this._t(i))if(n===0){let e=new P(bi(i)?N.fromString(i.getPipelineDocuments()[0]):i.path);this.nt(t,e,hi.newNoDocument(e,R.min()))}else O(n===1,20013,`Single document existence filter with count: `+n);else{let r=this.ct(t);if(r!==n){let n=this.lt(e),i=n?this.Et(n,e,r):1;if(i!==0){this.st(t);let e=i===2?`TargetPurposeExistenceFilterMismatchBloom`:`TargetPurposeExistenceFilterMismatch`;this.Xe=this.Xe.insert(t,e)}$i?.u(function(e,t,n,r,i){let a={localCacheCount:e,existenceFilterCount:t.count,databaseId:n.database,projectId:n.projectId},o=t.unchangedNames;return o&&(a.bloomFilter={applied:i===0,hashCount:o?.hashCount??0,bitmapLength:o?.bits?.bitmap?.length??0,padding:o?.bits?.padding??0,mightContain:e=>r?.mightContain(e)??!1}),a}(r,e.xe,this.ze.Tt(),n,i))}}}}lt(e){let t=e.xe.unchangedNames;if(!t||!t.bits)return null;let{bits:{bitmap:n=``,padding:r=0},hashCount:i=0}=t,a,o;try{a=Cn(n).toUint8Array()}catch(e){if(e instanceof bn)return mt(`Decoding the base64 bloom filter in existence filter failed (`+e.message+`); ignoring the bloom filter and falling back to full re-query.`),null;throw e}try{o=new ia(a,r,i)}catch(e){return mt(e instanceof aa?`BloomFilter error: `:`Applying bloom filter failed: `,e),null}return o.ge===0?null:o}Et(e,t,n){return t.xe.count===n-this.Pt(e,t.targetId)?0:2}Pt(e,t){let n=this.ze.getRemoteKeysForTarget(t),r=0;return n.forEach((n=>{let i=this.ze.Tt(),a=`projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;e.mightContain(a)||(this.nt(t,n,null),r++)})),r}Rt(e){let t=new Map;this.je.forEach(((n,r)=>{let i=this.ut(r);if(i){if(n.current&&this._t(i.target)){let t=new P(bi(i.target)?N.fromString(i.target.getPipelineDocuments()[0]):i.target.path);this.It(t).has(r)||this.At(r,t)||this.nt(r,t,hi.newNoDocument(t,e))}n.Be&&(t.set(r,n.ke()),n.qe())}}));let n=J();this.Ze.forEach(((e,t)=>{let r=!0;t.forEachWhile((e=>{let t=this.ut(e);return!t||t.purpose===`TargetPurposeLimboResolution`||(r=!1,!1)})),r&&(n=n.add(e))})),this.He.forEach(((t,n)=>n.setReadTime(e))),this.Ye.forEach(((t,n)=>n.setReadTime(e)));let r=new oa(e,t,this.Xe,this.He,this.Ye,n);return this.He=Hi(),this.Je=ma(),this.Ye=Hi(),this.Ze=ma(),this.Xe=new B(M),r}tt(e,t){let n=this.je.get(e);if(!n||!this.it(e))return void E(fa,`addDocumentToTarget received document for unknown inactive target (${e})`);let r=this.At(e,t.key)?2:0;n.$e(t.key,r),bi(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!==`exact`?this.Ye=this.Ye.insert(t.key,t):this.He=this.He.insert(t.key,t),this.Je=this.Je.insert(t.key,this.It(t.key).add(e)),this.Ze=this.Ze.insert(t.key,this.Vt(t.key).add(e))}nt(e,t,n){let r=this.je.get(e);r&&this.it(e)?(this.At(e,t)?r.$e(t,1):r.Ke(t),this.Ze=this.Ze.insert(t,this.Vt(t).delete(e)),this.Ze=this.Ze.insert(t,this.Vt(t).add(e)),n&&(bi(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!==`exact`?this.Ye=this.Ye.insert(t,n):this.He=this.He.insert(t,n))):E(fa,`removeDocumentFromTarget received document for unknown or inactive target (${e})`)}removeTarget(e){this.je.delete(e)}ct(e){let t=this.je.get(e);if(!t)return 0;let n=t.ke();return this.ze.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}We(e){let t=this.je.get(e);t||(E(fa,`recordPendingTargetRequest set up tracking for target ID ${e}`),t=new da(e),this.je.set(e,t)),t.We()}Vt(e){let t=this.Ze.get(e);return t||(t=new V(M),this.Ze=this.Ze.insert(e,t)),t}It(e){let t=this.Je.get(e);return t||(t=new V(M),this.Je=this.Je.insert(e,t)),t}it(e){let t=this.ut(e)!==null;return t||E(fa,`Detected inactive target`,e),t}ut(e){let t=this.je.get(e);return t===void 0||t.Le?null:this.ze.dt(e)}st(e){this.je.set(e,new da(e)),this.ze.getRemoteKeysForTarget(e).forEach((t=>{this.nt(e,t,null)}))}At(e,t){return this.ze.getRemoteKeysForTarget(e).has(t)}};function ma(){return new B(P.comparator)}function ha(){return new B(P.comparator)}var ga={asc:`ASCENDING`,desc:`DESCENDING`},_a={"<":`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`},va={and:`AND`,or:`OR`},ya=class{constructor(e,t){this.databaseId=e,this.useProto3Json=t}};function ba(e,t){return e.useProto3Json||an(t)?t:{value:t}}function xa(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,``).replace(`Z`,``)}.${(`000000000`+t.nanoseconds).slice(-9)}Z`:{seconds:``+t.seconds,nanos:t.nanoseconds}}function Sa(e){let t=Sn(e);return new L(t.seconds,t.nanos)}function Ca(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function wa(e,t){return xa(e,t.toTimestamp())}function Ta(e){return O(!!e,49232),R.fromTimestamp(Sa(e))}function Ea(e,t){return Da(e,t).canonicalString()}function Da(e,t){let n=function(e){return new N([`projects`,e.projectId,`databases`,e.database])}(e).child(`documents`);return t===void 0?n:n.child(t)}function Oa(e){let t=N.fromString(e);return O(Qa(t),10190,{key:t.toString()}),t}function ka(e,t){return Ea(e.databaseId,t.path)}function Aa(e,t){let n=Oa(t);if(n.get(1)!==e.databaseId.projectId)throw new j(A.INVALID_ARGUMENT,`Tried to deserialize key from different project: `+n.get(1)+` vs `+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new j(A.INVALID_ARGUMENT,`Tried to deserialize key from different database: `+n.get(3)+` vs `+e.databaseId.database);return new P(Pa(n))}function ja(e,t){return Ea(e.databaseId,t)}function Ma(e){let t=Oa(e);return t.length===4?N.emptyPath():Pa(t)}function Na(e){return new N([`projects`,e.databaseId.projectId,`databases`,e.databaseId.database]).canonicalString()}function Pa(e){return O(e.length>4&&e.get(4)===`documents`,29091,{key:e.toString()}),e.popFirst(5)}function Fa(e,t,n){return{name:ka(e,t),fields:n.value.mapValue.fields}}function Ia(e,t){let n;if(`targetChange`in t){t.targetChange;let r=function(e){return e===`NO_CHANGE`?0:e===`ADD`?1:e===`REMOVE`?2:e===`CURRENT`?3:e===`RESET`?4:D(39313,{state:e})}(t.targetChange.targetChangeType||`NO_CHANGE`),i=t.targetChange.targetIds||[],a=function(e,t){return e.useProto3Json?(O(t===void 0||typeof t==`string`,58123),U.fromBase64String(t||``)):(O(t===void 0||t instanceof Buffer||t instanceof Uint8Array,16193),U.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause;n=new ua(r,i,a,o&&function(e){return new j(e.code===void 0?A.UNKNOWN:zi(e.code),e.message||``)}(o)||null)}else if(`documentChange`in t){t.documentChange;let r=t.documentChange;r.document,r.document.name,r.document.updateTime;let i=Aa(e,r.document.name),a=Ta(r.document.updateTime),o=r.document.createTime?Ta(r.document.createTime):R.min(),s=new cr({mapValue:{fields:r.document.fields}}),c=hi.newFoundDocument(i,a,o,s);n=new ca(r.targetIds||[],r.removedTargetIds||[],c.key,c)}else if(`documentDelete`in t){t.documentDelete;let r=t.documentDelete;r.document;let i=Aa(e,r.document),a=r.readTime?Ta(r.readTime):R.min(),o=hi.newNoDocument(i,a);n=new ca([],r.removedTargetIds||[],o.key,o)}else if(`documentRemove`in t){t.documentRemove;let r=t.documentRemove;r.document;let i=Aa(e,r.document);n=new ca([],r.removedTargetIds||[],i,null)}else{if(!(`filter`in t))return D(11601,{ft:t});{t.filter;let e=t.filter;e.targetId;let{count:r=0,unchangedNames:i}=e,a=new Li(r,i),o=e.targetId;n=new la(o,a)}}return n}function La(e,t){let n;if(t instanceof Br)n={update:Fa(e,t.key,t.value)};else if(t instanceof Gr)n={delete:ka(e,t.key)};else if(t instanceof Vr)n={update:Fa(e,t.key,t.data),updateMask:Za(t.fieldMask)};else{if(!(t instanceof Kr))return D(16599,{gt:t.type});n={verify:ka(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((e=>function(e,t){let n=t.transform;if(n instanceof _r)return{fieldPath:t.field.canonicalString(),setToServerValue:`REQUEST_TIME`};if(n instanceof vr)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof br)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Cr)return{fieldPath:t.field.canonicalString(),increment:n.Re};if(n instanceof wr)return{fieldPath:t.field.canonicalString(),minimum:n.Re};if(n instanceof Tr)return{fieldPath:t.field.canonicalString(),maximum:n.Re};throw D(20930,{transform:t.transform})}(0,e)))),t.precondition.isNone||(n.currentDocument=function(e,t){return t.updateTime===void 0?t.exists===void 0?D(27497):{exists:t.exists}:{updateTime:wa(e,t.updateTime)}}(e,t.precondition)),n}function Ra(e,t){return e&&e.length>0?(O(t!==void 0,14353),e.map((e=>function(e,t){let n=e.updateTime?Ta(e.updateTime):Ta(t);return n.isEqual(R.min())&&(n=Ta(t)),new jr(n,e.transformResults||[])}(e,t)))):[]}function za(e,t){return{documents:[ja(e,t.path)]}}function Ba(e,t){let n={structuredQuery:{}},r=t.path,i;t.collectionGroup===null?(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]):(i=r,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]),n.parent=ja(e,i);let a=function(e){if(e.length!==0)return Xa(Qr.create(e,`and`))}(t.filters);a&&(n.structuredQuery.where=a);let o=function(e){if(e.length!==0)return e.map((e=>function(e){return{field:Ja(e.field),direction:Ga(e.dir)}}(e)))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);let s=ba(e,t.limit);return s!==null&&(n.structuredQuery.limit=s),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{yt:n,parent:i}}function Va(e){let t=Ma(e.parent),n=e.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){O(r===1,65062);let e=n.from[0];e.allDescendants?i=e.collectionId:t=t.child(e.collectionId)}let a=[];n.where&&(a=function(e){let t=Wa(e);return t instanceof Qr&&ei(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map((e=>function(e){return new pi(Ya(e.field),function(e){switch(e){case`ASCENDING`:return`asc`;case`DESCENDING`:return`desc`;default:return}}(e.direction))}(e)))}(n.orderBy));let s=null;n.limit&&(s=function(e){let t;return t=typeof e==`object`?e.value:e,an(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){let t=!!e.before;return new qr(e.values||[],t)}(n.startAt));let l=null;return n.endAt&&(l=function(e){let t=!e.before;return new qr(e.values||[],t)}(n.endAt)),Ci(t,i,o,a,s,`F`,c,l)}function Ha(e,t){let n=function(e){switch(e){case`TargetPurposeListen`:return null;case`TargetPurposeExistenceFilterMismatch`:return`existence-filter-mismatch`;case`TargetPurposeExistenceFilterMismatchBloom`:return`existence-filter-mismatch-bloom`;case`TargetPurposeLimboResolution`:return`limbo-document`;default:return D(28987,{purpose:e})}}(t.purpose);return n==null?null:{"goog-listen-tags":n}}function Ua(e,t){return{structuredPipeline:{pipeline:{stages:t.stages.map((t=>t._toProto(e)))}}}}function Wa(e){return e.unaryFilter===void 0?e.fieldFilter===void 0?e.compositeFilter===void 0?D(30097,{filter:e}):function(e){return Qr.create(e.compositeFilter.filters.map((e=>Wa(e))),function(e){switch(e){case`AND`:return`and`;case`OR`:return`or`;default:return D(1026)}}(e.compositeFilter.op))}(e):function(e){return Zr.create(Ya(e.fieldFilter.field),function(e){switch(e){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`;case`OPERATOR_UNSPECIFIED`:return D(58110);default:return D(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):function(e){switch(e.unaryFilter.op){case`IS_NAN`:let t=Ya(e.unaryFilter.field);return Zr.create(t,`==`,{doubleValue:NaN});case`IS_NULL`:let n=Ya(e.unaryFilter.field);return Zr.create(n,`==`,{nullValue:`NULL_VALUE`});case`IS_NOT_NAN`:let r=Ya(e.unaryFilter.field);return Zr.create(r,`!=`,{doubleValue:NaN});case`IS_NOT_NULL`:let i=Ya(e.unaryFilter.field);return Zr.create(i,`!=`,{nullValue:`NULL_VALUE`});case`OPERATOR_UNSPECIFIED`:return D(61313);default:return D(60726)}}(e)}function Ga(e){return ga[e]}function Ka(e){return _a[e]}function qa(e){return va[e]}function Ja(e){return{fieldPath:e.canonicalString()}}function Ya(e){return It.fromServerFormat(e.fieldPath)}function Xa(e){return e instanceof Zr?function(e){if(e.op===`==`){if(nr(e.value))return{unaryFilter:{field:Ja(e.field),op:`IS_NAN`}};if(tr(e.value))return{unaryFilter:{field:Ja(e.field),op:`IS_NULL`}}}else if(e.op===`!=`){if(nr(e.value))return{unaryFilter:{field:Ja(e.field),op:`IS_NOT_NAN`}};if(tr(e.value))return{unaryFilter:{field:Ja(e.field),op:`IS_NOT_NULL`}}}return{fieldFilter:{field:Ja(e.field),op:Ka(e.op),value:e.value}}}(e):e instanceof Qr?function(e){let t=e.getFilters().map((e=>Xa(e)));return t.length===1?t[0]:{compositeFilter:{op:qa(e.op),filters:t}}}(e):D(54877,{filter:e})}function Za(e){let t=[];return e.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function Qa(e){return e.length>=4&&e.get(0)===`projects`&&e.get(2)===`databases`}function $a(e){return!!e&&typeof e._toProto==`function`&&e._protoValueType===`ProtoValue`}function eo(e,t){let n={fields:{}};return t.forEach(((t,r)=>{if(typeof r!=`string`)throw Error(`Cannot encode map with non-string key: ${r}`);n.fields[r]=t._toProto(e)})),{mapValue:n}}function to(e){return{stringValue:e}}function no(e){return new ya(e,!0)}var ro=class e{constructor(e){this._byteString=e}static fromBase64String(t){try{return new e(U.fromBase64String(t))}catch(e){throw new j(A.INVALID_ARGUMENT,`Failed to construct data from Base64 string: `+e)}}static fromUint8Array(t){return new e(U.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return`Bytes(base64: `+this.toBase64()+`)`}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:e._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(Ut(t,e._jsonSchema))return e.fromBase64String(t.bytes)}};ro._jsonSchemaVersion=`firestore/bytes/1.0`,ro._jsonSchema={type:F(`string`,ro._jsonSchemaVersion),bytes:F(`string`)};var io=class{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new j(A.INVALID_ARGUMENT,`Invalid field name at argument $(i + 1). Field names must not be empty.`);this._internalPath=new It(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};function ao(){return new io(Nt)}var oo=class{constructor(e){this._methodName=e}},so=class e{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new j(A.INVALID_ARGUMENT,`Latitude must be a number between -90 and 90, but was: `+e);if(!isFinite(t)||t<-180||t>180)throw new j(A.INVALID_ARGUMENT,`Longitude must be a number between -180 and 180, but was: `+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return M(this._lat,e._lat)||M(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:e._jsonSchemaVersion}}static fromJSON(t){if(Ut(t,e._jsonSchema))return new e(t.latitude,t.longitude)}};function co(e){let t={};return e.timeoutSeconds!==void 0&&(t.timeoutSeconds=e.timeoutSeconds),t}so._jsonSchemaVersion=`firestore/geoPoint/1.0`,so._jsonSchema={type:F(`string`,so._jsonSchemaVersion),latitude:F(`number`),longitude:F(`number`)};var lo=class{bt(e){}shutdown(){}},uo=`ConnectivityMonitor`,fo=class{constructor(){this.vt=()=>this.St(),this.Dt=()=>this.xt(),this.Ct=[],this.Ft()}bt(e){this.Ct.push(e)}shutdown(){window.removeEventListener(`online`,this.vt),window.removeEventListener(`offline`,this.Dt)}Ft(){window.addEventListener(`online`,this.vt),window.addEventListener(`offline`,this.Dt)}St(){E(uo,`Network connectivity changed: AVAILABLE`);for(let e of this.Ct)e(0)}xt(){E(uo,`Network connectivity changed: UNAVAILABLE`);for(let e of this.Ct)e(1)}static C(){return typeof window<`u`&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}},po=null;function mo(){return po===null?po=function(){return 268435456+Math.round(2147483648*Math.random())}():po++,`0x`+po.toString(16)}var ho=`RestConnection`,go={BatchGetDocuments:`batchGet`,Commit:`commit`,RunQuery:`runQuery`,RunAggregationQuery:`runAggregationQuery`,ExecutePipeline:`executePipeline`},_o=class{get Ot(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let t=e.ssl?`https`:`http`,n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.Mt=t+`://`+e.host,this.Nt=`projects/${n}/databases/${r}`,this.Lt=this.databaseId.database===Mn?`project_id=${n}`:`project_id=${n}&database_id=${r}`}Bt(e,t,n,r,a){let o=mo(),s=this.Ut(e,t.toUriEncodedString());E(ho,`Sending RPC '${e}' ${o}:`,s,n);let c={"google-cloud-resource-prefix":this.Nt,"x-goog-request-params":this.Lt};this.kt(c,r,a);let{host:l}=new URL(s),u=i(l);return this.qt(e,s,c,n,u).then((t=>(E(ho,`Received RPC '${e}' ${o}: `,t),t)),(t=>{throw mt(ho,`RPC '${e}' ${o} failed with error: `,t,`url: `,s,`request:`,n),t}))}$t(e,t,n,r,i,a){return this.Bt(e,t,n,r,i)}kt(e,t,n){e[`X-Goog-Api-Client`]=function(){return`gl-js/ fire/`+T}(),e[`Content-Type`]=`text/plain`,this.databaseInfo.appId&&(e[`X-Firebase-GMPID`]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}Ut(e,t){let n=go[e],r=`${this.Mt}/v1/${t}:${n}`;return this.databaseInfo.apiKey&&(r=`${r}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),r}terminate(){}},vo=class{constructor(e){this.Kt=e.Kt,this.Wt=e.Wt}Qt(e){this.Gt=e}zt(e){this.jt=e}Ht(e){this.Jt=e}onMessage(e){this.Yt=e}close(){this.Wt()}send(e){this.Kt(e)}Zt(){this.Gt()}Xt(){this.jt()}en(e){this.Jt(e)}tn(e){this.Yt(e)}},yo=`WebChannelConnection`,bo=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))},xo=class e extends _o{constructor(e){super(e),this.nn=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static rn(){e.sn||=(bo(he(),me.STAT_EVENT,(e=>{e.stat===pe.PROXY?E(yo,`STAT_EVENT: detected buffering proxy`):e.stat===pe.NOPROXY&&E(yo,`STAT_EVENT: detected no buffering proxy`)})),!0)}qt(e,t,n,r,i){let a=mo();return new Promise(((i,o)=>{let s=new le;s.setWithCredentials(!0),s.listenOnce(de.COMPLETE,(()=>{try{switch(s.getLastErrorCode()){case fe.NO_ERROR:let t=s.getResponseJson();E(yo,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(t)),i(t);break;case fe.TIMEOUT:E(yo,`RPC '${e}' ${a} timed out`),o(new j(A.DEADLINE_EXCEEDED,`Request time out`));break;case fe.HTTP_ERROR:let n=s.getStatus();if(E(yo,`RPC '${e}' ${a} failed with status:`,n,`response text:`,s.getResponseText()),n>0){let e=s.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=e?.error;t&&t.status&&t.message?o(new j(function(e){let t=e.toLowerCase().replace(/_/g,`-`);return Object.values(A).indexOf(t)>=0?t:A.UNKNOWN}(t.status),t.message)):o(new j(A.UNKNOWN,`Server responded with status `+s.getStatus()))}else o(new j(A.UNAVAILABLE,`Connection failed.`));break;default:D(9055,{_n:e,streamId:a,an:s.getLastErrorCode(),un:s.getLastError()})}}finally{E(yo,`RPC '${e}' ${a} completed.`)}}));let c=JSON.stringify(r);E(yo,`RPC '${e}' ${a} sending request:`,r),s.send(t,`POST`,c,n,15)}))}cn(t,n,r){let i=mo(),a=[this.Mt,`/`,`google.firestore.v1.Firestore`,`/`,t,`/channel`],o=this.createWebChannelTransport(),s={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},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(s.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(s.useFetchStreams=!0),this.kt(s.initMessageHeaders,n,r),s.encodeInitMessageHeaders=!0;let l=a.join(``);E(yo,`Creating RPC '${t}' stream ${i}: ${l}`,s);let u=o.createWebChannel(l,s);this.En(u);let d=!1,f=!1,p=new vo({Kt:e=>{f?E(yo,`Not sending because RPC '${t}' stream ${i} is closed:`,e):(d||=(E(yo,`Opening RPC '${t}' stream ${i} transport.`),u.open(),!0),E(yo,`RPC '${t}' stream ${i} sending:`,e),u.send(e))},Wt:()=>u.close()});return bo(u,ue.EventType.OPEN,(()=>{f||(E(yo,`RPC '${t}' stream ${i} transport opened.`),p.Zt())})),bo(u,ue.EventType.CLOSE,(()=>{f||(f=!0,E(yo,`RPC '${t}' stream ${i} transport closed`),p.en(),this.hn(u))})),bo(u,ue.EventType.ERROR,(e=>{f||(f=!0,mt(yo,`RPC '${t}' stream ${i} transport errored. Name:`,e.name,`Message:`,e.message),p.en(new j(A.UNAVAILABLE,`The operation could not be completed`)))})),bo(u,ue.EventType.MESSAGE,(e=>{if(!f){let n=e.data[0];O(!!n,16349);let r=n,a=r?.error||r[0]?.error;if(a){E(yo,`RPC '${t}' stream ${i} received error:`,a);let e=a.status,n=function(e){let t=K[e];if(t!==void 0)return zi(t)}(e),r=a.message;e===`NOT_FOUND`&&r.includes(`database`)&&r.includes(`does not exist`)&&r.includes(this.databaseId.database)&&mt(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),n===void 0&&(n=A.INTERNAL,r=`Unknown error status: `+e+` with message `+a.message),f=!0,p.en(new j(n,r)),u.close()}else E(yo,`RPC '${t}' stream ${i} received:`,n),p.tn(n)}})),e.rn(),setTimeout((()=>{p.Xt()}),0),p}terminate(){this.nn.forEach((e=>e.close())),this.nn=[]}En(e){this.nn.push(e)}hn(e){this.nn=this.nn.filter((t=>t===e))}kt(e,t,n){super.kt(e,t,n),this.databaseInfo.apiKey&&(e[`x-goog-api-key`]=this.databaseInfo.apiKey)}createWebChannelTransport(){return ge()}};function So(e){return new xo(e)}xo.sn=!1;var Co=class{constructor(e,t,n=1e3,r=1.5,i=6e4){this.Tn=e,this.timerId=t,this.Pn=n,this.Rn=r,this.In=i,this.An=0,this.Vn=null,this.dn=Date.now(),this.reset()}reset(){this.An=0}fn(){this.An=this.In}mn(e){this.cancel();let t=Math.floor(this.An+this.pn()),n=Math.max(0,Date.now()-this.dn),r=Math.max(0,t-n);r>0&&E(`ExponentialBackoff`,`Backing off for ${r} ms (base delay: ${this.An} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Vn=this.Tn.enqueueAfterDelay(this.timerId,r,(()=>(this.dn=Date.now(),e()))),this.An*=this.Rn,this.An<this.Pn&&(this.An=this.Pn),this.An>this.In&&(this.An=this.In)}gn(){this.Vn!==null&&(this.Vn.skipDelay(),this.Vn=null)}cancel(){this.Vn!==null&&(this.Vn.cancel(),this.Vn=null)}pn(){return(Math.random()-.5)*this.An}},wo=`PersistentStream`,To=class{constructor(e,t,n,r,i,a,o,s){this.Tn=e,this.yn=n,this.wn=r,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=o,this.listener=s,this.state=0,this.bn=0,this.vn=null,this.Sn=null,this.stream=null,this.Dn=0,this.xn=new Co(e,t)}Cn(){return this.state===1||this.state===5||this.Fn()}Fn(){return this.state===2||this.state===3}start(){this.Dn=0,this.state===4?this.On():this.auth()}async stop(){this.Cn()&&await this.close(0)}Mn(){this.state=0,this.xn.reset()}Nn(){this.Fn()&&this.vn===null&&(this.vn=this.Tn.enqueueAfterDelay(this.yn,6e4,(()=>this.Ln())))}Bn(e){this.Un(),this.stream.send(e)}async Ln(){if(this.Fn())return this.close(0)}Un(){this.vn&&=(this.vn.cancel(),null)}kn(){this.Sn&&=(this.Sn.cancel(),null)}async close(e,t){this.Un(),this.kn(),this.xn.cancel(),this.bn++,e===4?t&&t.code===A.RESOURCE_EXHAUSTED?(pt(t.toString()),pt(`Using maximum backoff delay to prevent overloading the backend.`),this.xn.fn()):t&&t.code===A.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()):this.xn.reset(),this.stream!==null&&(this.qn(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Ht(t)}qn(){}auth(){this.state=1;let e=this.$n(this.bn),t=this.bn;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([e,n])=>{this.bn===t&&this.Kn(e,n)}),(t=>{e((()=>{let e=new j(A.UNKNOWN,`Fetching auth token failed: `+t.message);return this.Wn(e)}))}))}Kn(e,t){let n=this.$n(this.bn);this.stream=this.Qn(e,t),this.stream.Qt((()=>{n((()=>this.listener.Qt()))})),this.stream.zt((()=>{n((()=>(this.state=2,this.Sn=this.Tn.enqueueAfterDelay(this.wn,1e4,(()=>(this.Fn()&&(this.state=3),Promise.resolve()))),this.listener.zt())))})),this.stream.Ht((e=>{n((()=>this.Wn(e)))})),this.stream.onMessage((e=>{n((()=>++this.Dn==1?this.Gn(e):this.onNext(e)))}))}On(){this.state=5,this.xn.mn((async()=>{this.state=0,this.start()}))}Wn(e){return E(wo,`close with error: ${e}`),this.stream=null,this.close(4,e)}$n(e){return t=>{this.Tn.enqueueAndForget((()=>this.bn===e?t():(E(wo,`stream callback skipped by getCloseGuardedDispatcher.`),Promise.resolve())))}}},Eo=class extends To{constructor(e,t,n,r,i,a){super(e,`listen_stream_connection_backoff`,`listen_stream_idle`,`health_check_timeout`,t,n,r,a),this.serializer=i}Qn(e,t){return this.connection.cn(`Listen`,e,t)}Gn(e){return this.onNext(e)}onNext(e){this.xn.reset();let t=Ia(this.serializer,e),n=function(e){if(!(`targetChange`in e))return R.min();let t=e.targetChange;return t.targetIds&&t.targetIds.length?R.min():t.readTime?Ta(t.readTime):R.min()}(e);return this.listener.zn(t,n)}jn(e){let t={};t.database=Na(this.serializer),t.addTarget=function(e,t){let n,r=t.target;if(n=bi(r)?{pipelineQuery:Ua(e,r)}:xi(r)?{documents:za(e,r)}:{query:Ba(e,r).yt},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Ca(e,t.resumeToken);let r=ba(e,t.expectedCount);r!==null&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(R.min())>0){n.readTime=xa(e,t.snapshotVersion.toTimestamp());let r=ba(e,t.expectedCount);r!==null&&(n.expectedCount=r)}return n}(this.serializer,e);let n=Ha(this.serializer,e);n&&(t.labels=n),this.Bn(t)}Hn(e){let t={};t.database=Na(this.serializer),t.removeTarget=e,this.Bn(t)}},Do=class extends To{constructor(e,t,n,r,i,a){super(e,`write_stream_connection_backoff`,`write_stream_idle`,`health_check_timeout`,t,n,r,a),this.serializer=i}get Jn(){return this.Dn>0}start(){this.lastStreamToken=void 0,super.start()}qn(){this.Jn&&this.Yn([])}Qn(e,t){return this.connection.cn(`Write`,e,t)}Gn(e){return O(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,O(!e.writeResults||e.writeResults.length===0,55816),this.listener.Zn()}onNext(e){O(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.xn.reset();let t=Ra(e.writeResults,e.commitTime),n=Ta(e.commitTime);return this.listener.Xn(n,t)}er(){let e={};e.database=Na(this.serializer),this.Bn(e)}Yn(e){let t={streamToken:this.lastStreamToken,writes:e.map((e=>La(this.serializer,e)))};this.Bn(t)}},Oo=class{},ko=class extends Oo{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.tr=!1}nr(){if(this.tr)throw new j(A.FAILED_PRECONDITION,`The client has already been terminated.`)}Bt(e,t,n,r){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,a])=>this.connection.Bt(e,Da(t,n),r,i,a))).catch((e=>{throw e.name===`FirebaseError`?(e.code===A.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new j(A.UNKNOWN,e.toString())}))}$t(e,t,n,r,i){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([a,o])=>this.connection.$t(e,Da(t,n),r,a,o,i))).catch((e=>{throw e.name===`FirebaseError`?(e.code===A.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new j(A.UNKNOWN,e.toString())}))}terminate(){this.tr=!0,this.connection.terminate()}};function Ao(e,t,n,r){return new ko(e,t,n,r)}var jo=`ComponentProvider`,Mo=new Map;function No(e,t,n,r,i){return new jn(e,t,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,co(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator,r)}var Po={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Fo=41943040,Io=class e{static withCacheSize(t){return new e(t,e.DEFAULT_COLLECTION_PERCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}};Io.DEFAULT_COLLECTION_PERCENTILE=10,Io.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Io.DEFAULT=new Io(Fo,Io.DEFAULT_COLLECTION_PERCENTILE,Io.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Io.DISABLED=new Io(-1,0,0);var Lo=`LruGarbageCollector`,Ro=1048576;function zo([e,t],[n,r]){let i=M(e,n);return i===0?M(t,r):i}var Bo=class{constructor(e){this.rr=e,this.buffer=new V(zo),this.ir=0}sr(){return++this.ir}_r(e){let t=[e,this.sr()];if(this.buffer.size<this.rr)this.buffer=this.buffer.add(t);else{let e=this.buffer.last();zo(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}},Vo=class{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.ar=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.ur(6e4)}stop(){this.ar&&=(this.ar.cancel(),null)}get started(){return this.ar!==null}ur(e){E(Lo,`Garbage collection scheduled in ${e}ms`),this.ar=this.asyncQueue.enqueueAfterDelay(`lru_garbage_collection`,e,(async()=>{this.ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){tn(e)?E(Lo,`Ignoring IndexedDB error during garbage collection: `,e):await $t(e)}await this.ur(3e5)}))}},Ho=class{constructor(e,t){this.cr=e,this.params=t}calculateTargetCount(e,t){return this.cr.lr(e).next((e=>Math.floor(t/100*e)))}nthSequenceNumber(e,t){if(t===0)return z.resolve(nn.ce);let n=new Bo(t);return this.cr.forEachTarget(e,(e=>n._r(e.sequenceNumber))).next((()=>this.cr.Er(e,(e=>n._r(e))))).next((()=>n.maxValue))}removeTargets(e,t,n){return this.cr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.cr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(E(`LruGarbageCollector`,`Garbage collection skipped; disabled`),z.resolve(Po)):this.getCacheSize(e).next((n=>n<this.params.cacheSizeCollectionThreshold?(E(`LruGarbageCollector`,`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Po):this.hr(e,t)))}getCacheSize(e){return this.cr.getCacheSize(e)}hr(e,t){let n,r,i,a,o,s,l,u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((t=>(t>this.params.maximumSequenceNumbersToCollect?(E(`LruGarbageCollector`,`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),r=this.params.maximumSequenceNumbersToCollect):r=t,a=Date.now(),this.nthSequenceNumber(e,r)))).next((r=>(n=r,o=Date.now(),this.removeTargets(e,n,t)))).next((t=>(i=t,s=Date.now(),this.removeOrphanedDocuments(e,n)))).next((e=>(l=Date.now(),ft()<=c.DEBUG&&E(`LruGarbageCollector`,`LRU Garbage Collection\n\tCounted targets in ${a-u}ms\n\tDetermined least recently used ${r} in `+(o-a)+`ms
|
|
27
|
+
\tRemoved ${i} targets in `+(s-o)+`ms
|
|
28
|
+
\tRemoved ${e} documents in `+(l-s)+`ms
|
|
29
|
+
Total Duration: ${l-u}ms`),z.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:i,documentsRemoved:e}))))}};function Uo(e,t){return new Ho(e,t)}var Wo=`firestore.googleapis.com`,Go=!0,Ko=class{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new j(A.INVALID_ARGUMENT,`Can't provide ssl option if host option is not set`);this.host=Wo,this.ssl=Go}else this.host=e.host,this.ssl=e.ssl??Go;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=Fo;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<Ro)throw new j(A.INVALID_ARGUMENT,`cacheSizeBytes must be at least 1048576`);this.cacheSizeBytes=e.cacheSizeBytes}Rt(`experimentalForceLongPolling`,e.experimentalForceLongPolling,`experimentalAutoDetectLongPolling`,e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=co(e.experimentalLongPollingOptions??{}),function(e){if(e.timeoutSeconds!==void 0){if(isNaN(e.timeoutSeconds))throw new j(A.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new j(A.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new j(A.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},qo=class{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type=`firestore-lite`,this._persistenceKey=`(lite)`,this._settings=new Ko({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask=`notTerminated`}get app(){if(!this._app)throw new j(A.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 this._terminateTask!==`notTerminated`}_setSettings(e){if(this._settingsFrozen)throw new j(A.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 Ko(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(e){if(!e)return new yt;switch(e.type){case`firstParty`:return new Ct(e.sessionIndex||`0`,e.iamToken||null,e.authTokenFactory||null);case`provider`:return e.client;default:throw new j(A.INVALID_ARGUMENT,`makeAuthCredentialsProvider failed due to invalid credential type`)}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask===`notTerminated`&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask===`notTerminated`?await this._terminate():this._terminateTask=`notTerminated`}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){let t=Mo.get(e);t&&(E(jo,`Removing Datastore`),Mo.delete(e),t.terminate())}(this),Promise.resolve()}};function Jo(t,n,a,o={}){t=Ht(t,qo);let s=i(n),c=t._getSettings(),l={...c,emulatorOptions:t._getEmulatorOptions()},u=`${n}:${a}`;s&&p(`https://${u}`),c.host!==Wo&&c.host!==u&&mt(`Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.`);let d={...c,host:u,ssl:s,emulatorOptions:o};if(!r(d,l)&&(t._setSettings(d),o.mockUserToken)){let n,r;if(typeof o.mockUserToken==`string`)n=o.mockUserToken,r=lt.MOCK_USER;else{n=e(o.mockUserToken,t._app?.options.projectId);let i=o.mockUserToken.sub||o.mockUserToken.user_id;if(!i)throw new j(A.INVALID_ARGUMENT,`mockUserToken must contain 'sub' or 'user_id' field!`);r=new lt(i)}t._authCredentials=new bt(new vt(n,r))}}var Yo=class e{constructor(e,t,n){this.converter=t,this._query=n,this.type=`query`,this.firestore=e}withConverter(t){return new e(this.firestore,t,this._query)}},Xo=class e{constructor(e,t,n){this.converter=t,this._key=n,this.type=`document`,this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Zo(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new e(this.firestore,t,this._key)}toJSON(){return{type:e._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,n,r){if(Ut(n,e._jsonSchema))return new e(t,r||null,new P(N.fromString(n.referencePath)))}};Xo._jsonSchemaVersion=`firestore/documentReference/1.0`,Xo._jsonSchema={type:F(`string`,Xo._jsonSchemaVersion),referencePath:F(`string`)};var Zo=class e extends Yo{constructor(e,t,n){super(e,t,wi(n)),this._path=n,this.type=`collection`}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let e=this._path.popLast();return e.isEmpty()?null:new Xo(this.firestore,null,new P(e))}withConverter(t){return new e(this.firestore,t,this._path)}};function Qo(e,t,...n){if(e=ne(e),arguments.length===1&&(t=Dt.newId()),Lt(`doc`,`path`,t),e instanceof qo){let r=N.fromString(t,...n);return zt(r),new Xo(e,null,new P(r))}{if(!(e instanceof Xo||e instanceof Zo))throw new j(A.INVALID_ARGUMENT,`Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore`);let r=e._path.child(N.fromString(t,...n));return zt(r),new Xo(e.firestore,e instanceof Zo?e.converter:null,new P(r))}}var $o=class e{constructor(e){this._values=(e||[]).map((e=>e))}toArray(){return this._values.map((e=>e))}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:e._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(Ut(t,e._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every((e=>typeof e==`number`)))return new e(t.vectorValues);throw new j(A.INVALID_ARGUMENT,`Expected 'vectorValues' field to be a number array`)}}};$o._jsonSchemaVersion=`firestore/vectorValue/1.0`,$o._jsonSchema={type:F(`string`,$o._jsonSchemaVersion),vectorValues:F(`object`)};var es=/^__.*__$/,ts=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return this.fieldMask===null?new Br(e,this.data,t,this.fieldTransforms):new Vr(e,this.data,this.fieldMask,t,this.fieldTransforms)}};function ns(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw D(40011,{dataSource:e})}}var rs=class e{constructor(e,t,n,r,i,a){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=r,i===void 0&&this.validatePath(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(t){return new e({...this.settings,...t},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){let t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePathSegment(e),n}childContextForFieldPath(e){let t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePath(),n}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return gs(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((t=>e.isPrefixOf(t)))!==void 0||this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError(`Document fields must not be empty`);if(ns(this.dataSource)&&es.test(e))throw this.createError(`Document fields cannot begin and end with "__"`)}},is=class{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||no(e)}createContext(e,t,n,r=!1){return new rs({dataSource:e,methodName:t,targetDoc:n,path:It.emptyPath(),arrayElement:!1,hasConverter:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function as(e){let t=e._freezeSettings(),n=no(e._databaseId);return new is(e._databaseId,!!t.ignoreUndefinedProperties,n)}function os(e,t,n,r,i,a={}){let o=e.createContext(a.merge||a.mergeFields?2:0,t,n,i);fs(`Data must be an object, but it was:`,o,r);let s=us(r,o),c,l;if(a.merge)c=new hn(o.fieldMask),l=o.fieldTransforms;else if(a.mergeFields){let e=[];for(let r of a.mergeFields){let i=ps(t,r,n);if(!o.contains(i))throw new j(A.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);_s(e,i)||e.push(i)}c=new hn(e),l=o.fieldTransforms.filter((e=>c.covers(e.field)))}else c=null,l=o.fieldTransforms;return new ts(new cr(s),c,l)}var ss=class e extends oo{_toFieldTransform(e){return new kr(e.path,new _r)}isEqual(t){return t instanceof e}},cs=class e extends oo{constructor(e,t){super(e),this.Pr=t}_toFieldTransform(e){let t=new Cr(e.serializer,fr(e.serializer,this.Pr));return new kr(e.path,t)}isEqual(t){return t instanceof e&&(this.Pr===t.Pr||Number.isNaN(this.Pr)&&Number.isNaN(t.Pr))}};function ls(e,t,n){if(ds(e=ne(e)))return fs(`Unsupported field value:`,t,e),us(e,t);if(e instanceof oo)return function(e,t){if(!ns(t.dataSource))throw t.createError(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.createError(`${e._methodName}() is not currently supported inside arrays`);let n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(e===void 0&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.arrayElement&&t.dataSource!==4)throw t.createError(`Nested arrays are not supported`);return function(e,t){let n=[],r=0;for(let i of e){let e=ls(i,t.childContextForArray(r));e??={nullValue:`NULL_VALUE`},n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t,n){if((e=ne(e))===null)return{nullValue:`NULL_VALUE`};if(typeof e==`number`)return fr(t.serializer,e,n);if(typeof e==`boolean`)return{booleanValue:e};if(typeof e==`string`)return{stringValue:e};if(e instanceof Date){let n=L.fromDate(e);return{timestampValue:xa(t.serializer,n)}}if(e instanceof L){let n=new L(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:xa(t.serializer,n)}}if(e instanceof so)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof ro)return{bytesValue:Ca(t.serializer,e._byteString)};if(e instanceof Xo){let n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.createError(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Ea(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof $o)return function(e,t){let n=e instanceof $o?e.toArray():e;return{mapValue:{fields:{[Fn]:{stringValue:Rn},[zn]:{arrayValue:{values:n.map((e=>{if(typeof e!=`number`)throw t.createError(`VectorValues must only contain numeric values.`);return ur(t.serializer,e)}))}}}}}}(e,t);if($a(e))return e._toProto(t.serializer);throw t.createError(`Unsupported field value: ${Vt(e)}`)}(e,t,n)}function us(e,t){let n={};return yn(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):_n(e,((e,r)=>{let i=ls(r,t.childContextForField(e));i!=null&&(n[e]=i)})),{mapValue:{fields:n}}}function ds(e){return!(typeof e!=`object`||!e||e instanceof Array||e instanceof Date||e instanceof L||e instanceof so||e instanceof ro||e instanceof Xo||e instanceof oo||e instanceof $o||$a(e))}function fs(e,t,n){if(!ds(n)||!Bt(n)){let r=Vt(n);throw r===`an object`?t.createError(e+` a custom object`):t.createError(e+` `+r)}}function ps(e,t,n){if((t=ne(t))instanceof io)return t._internalPath;if(typeof t==`string`)return hs(e,t);throw gs(`Field path arguments must be of type string or `,e,!1,void 0,n)}var ms=RegExp(`[~\\*/\\[\\]]`);function hs(e,t,n){if(t.search(ms)>=0)throw gs(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new io(...t.split(`.`))._internalPath}catch{throw gs(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function gs(e,t,n,r,i){let a=r&&!r.isEmpty(),o=i!==void 0,s=`Function ${t}() called with invalid data`;n&&(s+=" (via `toFirestore()`)"),s+=`. `;let c=``;return(a||o)&&(c+=` (found`,a&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=`)`),new j(A.INVALID_ARGUMENT,s+e+c)}function _s(e,t){return e.some((e=>e.isEqual(t)))}function vs(e){return typeof e._readUserData==`function`}var ys=class e{constructor(e){this.optionDefinitions=e}_getKnownOptions(t,n){let r=cr.empty();for(let i in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(i)){let a=this.optionDefinitions[i];if(i in t){let o=t[i],s;a.nestedOptions&&Bt(o)?s={mapValue:{fields:new e(a.nestedOptions).getOptionsProto(n,o)}}:o&&(s=ls(o,n)??void 0),s&&r.set(It.fromServerFormat(a.serverName),s)}}return r}getOptionsProto(e,t,n){let r=this._getKnownOptions(t,e);if(n){let t=new Map(vn(n,((t,n)=>[It.fromServerFormat(n),t===void 0?null:ls(t,e)])));r.setAll(t)}return r.value.mapValue.fields??{}}};function bs(e){return typeof e==`object`&&!!e&&!!(`nullValue`in e&&(e.nullValue===null||e.nullValue===`NULL_VALUE`)||`booleanValue`in e&&(e.booleanValue===null||typeof e.booleanValue==`boolean`)||`integerValue`in e&&(e.integerValue===null||typeof e.integerValue==`number`||typeof e.integerValue==`string`)||`doubleValue`in e&&(e.doubleValue===null||typeof e.doubleValue==`number`)||`timestampValue`in e&&(e.timestampValue===null||function(e){return typeof e==`object`&&!!e&&`seconds`in e&&(e.seconds===null||typeof e.seconds==`number`||typeof e.seconds==`string`)&&`nanos`in e&&(e.nanos===null||typeof e.nanos==`number`)}(e.timestampValue))||`stringValue`in e&&(e.stringValue===null||typeof e.stringValue==`string`)||`bytesValue`in e&&(e.bytesValue===null||e.bytesValue instanceof Uint8Array)||`referenceValue`in e&&(e.referenceValue===null||typeof e.referenceValue==`string`)||`geoPointValue`in e&&(e.geoPointValue===null||function(e){return typeof e==`object`&&!!e&&`latitude`in e&&(e.latitude===null||typeof e.latitude==`number`)&&`longitude`in e&&(e.longitude===null||typeof e.longitude==`number`)}(e.geoPointValue))||`arrayValue`in e&&(e.arrayValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`values`in e)||e.values!==null&&!Array.isArray(e.values))}(e.arrayValue))||`mapValue`in e&&(e.mapValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`fields`in e)||e.fields!==null&&!Bt(e.fields))}(e.mapValue))||`fieldReferenceValue`in e&&(e.fieldReferenceValue===null||typeof e.fieldReferenceValue==`string`)||`functionValue`in e&&(e.functionValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`name`in e)||e.name!==null&&typeof e.name!=`string`||!(`args`in e)||e.args!==null&&!Array.isArray(e.args))}(e.functionValue))||`pipelineValue`in e&&(e.pipelineValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`stages`in e)||e.stages!==null&&!Array.isArray(e.stages))}(e.pipelineValue)))}function xs(){return new ss(`serverTimestamp`)}function Ss(e){return new cs(`increment`,e)}function Cs(e){return new $o(e)}function Y(e){let t;return e instanceof Es?e:(t=Bt(e)?Vs(e):e instanceof Array?Hs(e):Is(e,void 0),t)}function ws(e){if(e instanceof Es)return e;if(e instanceof $o)return Fs(e);if(Array.isArray(e))return Fs(Cs(e));throw Error(`Unsupported value: `+typeof e)}function Ts(e){return cn(e)?Ms(e):Y(e)}var Es=class{constructor(){this._protoValueType=`ProtoValue`}add(e){return new X(`add`,[this,Y(e)],`add`)}asBoolean(){if(this instanceof Ls)return this;if(this instanceof Ps)return new zs(this);if(this instanceof js)return new Bs(this);if(this instanceof X)return new Rs(this);throw new j(`invalid-argument`,`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new X(`subtract`,[this,Y(e)],`subtract`)}multiply(e){return new X(`multiply`,[this,Y(e)],`multiply`)}divide(e){return new X(`divide`,[this,Y(e)],`divide`)}mod(e){return new X(`mod`,[this,Y(e)],`mod`)}equal(e){return new X(`equal`,[this,Y(e)],`equal`).asBoolean()}notEqual(e){return new X(`not_equal`,[this,Y(e)],`notEqual`).asBoolean()}lessThan(e){return new X(`less_than`,[this,Y(e)],`lessThan`).asBoolean()}lessThanOrEqual(e){return new X(`less_than_or_equal`,[this,Y(e)],`lessThanOrEqual`).asBoolean()}greaterThan(e){return new X(`greater_than`,[this,Y(e)],`greaterThan`).asBoolean()}greaterThanOrEqual(e){return new X(`greater_than_or_equal`,[this,Y(e)],`greaterThanOrEqual`).asBoolean()}arrayConcat(e,...t){let n=[e,...t].map((e=>Y(e)));return new X(`array_concat`,[this,...n],`arrayConcat`)}arrayContains(e){return new X(`array_contains`,[this,Y(e)],`arrayContains`).asBoolean()}arrayContainsAll(e){let t=Array.isArray(e)?new As(e.map(Y),`arrayContainsAll`):e;return new X(`array_contains_all`,[this,t],`arrayContainsAll`).asBoolean()}arrayContainsAny(e){let t=Array.isArray(e)?new As(e.map(Y),`arrayContainsAny`):e;return new X(`array_contains_any`,[this,t],`arrayContainsAny`).asBoolean()}arrayReverse(){return new X(`array_reverse`,[this])}arrayLength(){return new X(`array_length`,[this],`arrayLength`)}equalAny(e){let t=Array.isArray(e)?new As(e.map(Y),`equalAny`):e;return new X(`equal_any`,[this,t],`equalAny`).asBoolean()}notEqualAny(e){let t=Array.isArray(e)?new As(e.map(Y),`notEqualAny`):e;return new X(`not_equal_any`,[this,t],`notEqualAny`).asBoolean()}exists(){return new X(`exists`,[this],`exists`).asBoolean()}charLength(){return new X(`char_length`,[this],`charLength`)}like(e){return new X(`like`,[this,Y(e)],`like`).asBoolean()}regexContains(e){return new X(`regex_contains`,[this,Y(e)],`regexContains`).asBoolean()}regexFind(e){return new X(`regex_find`,[this,Y(e)],`regexFind`)}regexFindAll(e){return new X(`regex_find_all`,[this,Y(e)],`regexFindAll`)}regexMatch(e){return new X(`regex_match`,[this,Y(e)],`regexMatch`).asBoolean()}stringContains(e){return new X(`string_contains`,[this,Y(e)],`stringContains`).asBoolean()}startsWith(e){return new X(`starts_with`,[this,Y(e)],`startsWith`).asBoolean()}endsWith(e){return new X(`ends_with`,[this,Y(e)],`endsWith`).asBoolean()}toLower(){return new X(`to_lower`,[this],`toLower`)}toUpper(){return new X(`to_upper`,[this],`toUpper`)}trim(e){let t=[this];return e&&t.push(Y(e)),new X(`trim`,t,`trim`)}ltrim(e){let t=[this];return e&&t.push(Y(e)),new X(`ltrim`,t,`ltrim`)}rtrim(e){let t=[this];return e&&t.push(Y(e)),new X(`rtrim`,t,`rtrim`)}type(){return new X(`type`,[this])}isType(e){return new X(`is_type`,[this,Fs(e)],`isType`).asBoolean()}stringConcat(e,...t){let n=[e,...t].map(Y);return new X(`string_concat`,[this,...n],`stringConcat`)}stringIndexOf(e){return new X(`string_index_of`,[this,Y(e)],`stringIndexOf`)}stringRepeat(e){return new X(`string_repeat`,[this,Y(e)],`stringRepeat`)}stringReplaceAll(e,t){return new X(`string_replace_all`,[this,Y(e),Y(t)],`stringReplaceAll`)}stringReplaceOne(e,t){return new X(`string_replace_one`,[this,Y(e),Y(t)],`stringReplaceOne`)}concat(e,...t){let n=[e,...t].map(Y);return new X(`concat`,[this,...n],`concat`)}reverse(){return new X(`reverse`,[this],`reverse`)}arrayFilter(e,t){return new X(`array_filter`,[this,Y(e),t],`arrayFilter`)}arrayTransform(e,t){return new X(`array_transform`,[this,Y(e),t],`arrayTransform`)}arrayTransformWithIndex(e,t,n){return new X(`array_transform`,[this,Y(e),Y(t),n],`arrayTransformWithIndex`)}arraySlice(e,t){let n=[this,Y(e)];return t!==void 0&&n.push(Y(t)),new X(`array_slice`,n,`arraySlice`)}arrayFirst(){return new X(`array_first`,[this],`arrayFirst`)}arrayFirstN(e){return new X(`array_first_n`,[this,Y(e)],`arrayFirstN`)}arrayLast(){return new X(`array_last`,[this],`arrayLast`)}arrayLastN(e){return new X(`array_last_n`,[this,Y(e)],`arrayLastN`)}arrayMaximum(){return new X(`maximum`,[this],`arrayMaximum`)}arrayMaximumN(e){return new X(`maximum_n`,[this,Y(e)],`arrayMaximumN`)}arrayMinimum(){return new X(`minimum`,[this],`arrayMinimum`)}arrayMinimumN(e){return new X(`minimum_n`,[this,Y(e)],`arrayMinimumN`)}arrayIndexOf(e){return new X(`array_index_of`,[this,Y(e),Y(`first`)],`arrayIndexOf`)}arrayLastIndexOf(e){return new X(`array_index_of`,[this,Y(e),Y(`last`)],`arrayLastIndexOf`)}arrayIndexOfAll(e){return new X(`array_index_of_all`,[this,Y(e)],`arrayIndexOfAll`)}byteLength(){return new X(`byte_length`,[this],`byteLength`)}ceil(){return new X(`ceil`,[this])}floor(){return new X(`floor`,[this])}abs(){return new X(`abs`,[this])}exp(){return new X(`exp`,[this])}mapGet(e){return new X(`map_get`,[this,Fs(e)],`mapGet`)}mapSet(e,t,...n){return new X(`map_set`,[this,Y(e),Y(t),...n.map(Y)],`mapSet`)}mapKeys(){return new X(`map_keys`,[this],`mapKeys`)}mapValues(){return new X(`map_values`,[this],`mapValues`)}mapEntries(){return new X(`map_entries`,[this],`mapEntries`)}getField(e){return new X(`get_field`,[this,Y(e)],`get_field`)}count(){return Ds._create(`count`,[this],`count`)}sum(){return Ds._create(`sum`,[this],`sum`)}average(){return Ds._create(`average`,[this],`average`)}minimum(){return Ds._create(`minimum`,[this],`minimum`)}maximum(){return Ds._create(`maximum`,[this],`maximum`)}first(){return Ds._create(`first`,[this],`first`)}last(){return Ds._create(`last`,[this],`last`)}arrayAgg(){return Ds._create(`array_agg`,[this],`arrayAgg`)}arrayAggDistinct(){return Ds._create(`array_agg_distinct`,[this],`arrayAggDistinct`)}countDistinct(){return Ds._create(`count_distinct`,[this],`countDistinct`)}logicalMaximum(e,...t){let n=[e,...t];return new X(`maximum`,[this,...n.map(Y)],`logicalMaximum`)}logicalMinimum(e,...t){let n=[e,...t];return new X(`minimum`,[this,...n.map(Y)],`minimum`)}vectorLength(){return new X(`vector_length`,[this],`vectorLength`)}cosineDistance(e){return new X(`cosine_distance`,[this,ws(e)],`cosineDistance`)}dotProduct(e){return new X(`dot_product`,[this,ws(e)],`dotProduct`)}euclideanDistance(e){return new X(`euclidean_distance`,[this,ws(e)],`euclideanDistance`)}unixMicrosToTimestamp(){return new X(`unix_micros_to_timestamp`,[this],`unixMicrosToTimestamp`)}timestampToUnixMicros(){return new X(`timestamp_to_unix_micros`,[this],`timestampToUnixMicros`)}unixMillisToTimestamp(){return new X(`unix_millis_to_timestamp`,[this],`unixMillisToTimestamp`)}timestampToUnixMillis(){return new X(`timestamp_to_unix_millis`,[this],`timestampToUnixMillis`)}unixSecondsToTimestamp(){return new X(`unix_seconds_to_timestamp`,[this],`unixSecondsToTimestamp`)}timestampToUnixSeconds(){return new X(`timestamp_to_unix_seconds`,[this],`timestampToUnixSeconds`)}timestampAdd(e,t){return new X(`timestamp_add`,[this,Y(e),Y(t)],`timestampAdd`)}timestampSubtract(e,t){return new X(`timestamp_subtract`,[this,Y(e),Y(t)],`timestampSubtract`)}timestampDiff(e,t){return new X(`timestamp_diff`,[this,Ts(e),Y(t)],`timestampDiff`)}timestampExtract(e,t){let n=[this,Y(e)];return t&&n.push(Y(t)),new X(`timestamp_extract`,n,`timestampExtract`)}documentId(){return new X(`document_id`,[this],`documentId`)}parent(){return new X(`parent`,[this],`parent`)}substring(e,t){let n=Y(e);return new X(`substring`,t===void 0?[this,n]:[this,n,Y(t)],`substring`)}arrayGet(e){return new X(`array_get`,[this,Y(e)],`arrayGet`)}isError(){return new X(`is_error`,[this],`isError`).asBoolean()}ifError(e){let t=new X(`if_error`,[this,Y(e)],`ifError`);return e instanceof Ls?t.asBoolean():t}isAbsent(){return new X(`is_absent`,[this],`isAbsent`).asBoolean()}mapRemove(e){return new X(`map_remove`,[this,Y(e)],`mapRemove`)}mapMerge(e,...t){let n=Y(e),r=t.map(Y);return new X(`map_merge`,[this,n,...r],`mapMerge`)}pow(e){return new X(`pow`,[this,Y(e)])}trunc(e){return e===void 0?new X(`trunc`,[this]):new X(`trunc`,[this,Y(e)],`trunc`)}round(e){return e===void 0?new X(`round`,[this]):new X(`round`,[this,Y(e)],`round`)}collectionId(){return new X(`collection_id`,[this])}length(){return new X(`length`,[this])}ln(){return new X(`ln`,[this])}sqrt(){return new X(`sqrt`,[this])}stringReverse(){return new X(`string_reverse`,[this])}ifAbsent(e){return new X(`if_absent`,[this,Y(e)],`ifAbsent`)}ifNull(e){return new X(`if_null`,[this,Y(e)],`ifNull`)}coalesce(e,...t){return new X(`coalesce`,[this,Y(e),...t.map(Y)],`coalesce`)}join(e){return new X(`join`,[this,Y(e)],`join`)}log10(){return new X(`log10`,[this])}arraySum(){return new X(`sum`,[this])}split(e){return new X(`split`,[this,Y(e)])}timestampTruncate(e,t){let n=[this,Y(e)];return t&&n.push(Y(t)),new X(`timestamp_trunc`,n)}ascending(){return Us(this)}descending(){return Ws(this)}as(e){return new ks(this,e,`as`)}},Ds=class e{constructor(e,t){this.name=e,this.params=t,this.exprType=`AggregateFunction`,this._protoValueType=`ProtoValue`}static _create(t,n,r){let i=new e(t,n);return i._methodName=r,i}as(e){return new Os(this,e,`as`)}_toProto(e){return{functionValue:{name:this.name,args:this.params.map((t=>t._toProto(e)))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e)))}},Os=class{constructor(e,t,n){this.aggregate=e,this.alias=t,this._methodName=n}_readUserData(e){this.aggregate._readUserData(e)}},ks=class{constructor(e,t,n){this.expr=e,this.alias=t,this._methodName=n,this.exprType=`AliasedExpression`,this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}},As=class extends Es{constructor(e,t){super(),this.Rr=e,this._methodName=t,this.expressionType=`ListOfExpressions`}_toProto(e){return{arrayValue:{values:this.Rr.map((t=>t._toProto(e)))}}}_readUserData(e){this.Rr.forEach((t=>t._readUserData(e)))}},js=class extends Es{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType=`Field`,this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new X(`geo_distance`,[this,Y(e)],`geoDistance`)}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}};function Ms(e){return Ns(e,`field`)}function Ns(e,t){return new js(typeof e==`string`?Nt===e?ao()._internalPath:ps(`field`,e):e._internalPath,t)}var Ps=class e extends Es{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType=`Constant`}static _fromProto(t){let n=new e(t,void 0);return n._protoValue=t,n}_toProto(e){return O(this._protoValue!==void 0,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,bs(this._protoValue)||(this._protoValue=ls(this.value,e))}};function Fs(e,t){return Is(e,`constant`)}function Is(e,t){let n=new Ps(e,t);return typeof e==`boolean`?new zs(n):n}var X=class extends Es{constructor(e,t,n,r){super(),this.name=e,this.params=t,this.expressionType=`Function`,this._optionsProto=void 0,n!==void 0&&(this._methodName=n),r!==void 0&&(this._options=r)}get _optionsUtil(){return new ys({})}_toProto(e){let t={functionValue:{name:this.name,args:this.params.map((t=>t._toProto(e)))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e))),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}},Ls=class e extends Es{get _methodName(){return this._expr._methodName}countIf(){return Ds._create(`count_if`,[this],`countIf`)}not(){return new X(`not`,[this],`not`).asBoolean()}conditional(e,t){return new X(`conditional`,[this,e,t],`conditional`)}ifError(t){let n=Y(t),r=new X(`if_error`,[this,n],`ifError`);return n instanceof e?r.asBoolean():r}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}},Rs=class extends Ls{constructor(e){super(),this._expr=e,this.expressionType=`Function`}},zs=class extends Ls{constructor(e){super(),this._expr=e,this.expressionType=`Constant`}_getValue(){return this._expr._getValue()}},Bs=class extends Ls{constructor(e){super(),this._expr=e,this.expressionType=`Field`}};function Vs(e,t){let n=[];for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];n.push(Fs(t)),n.push(Y(r))}return new X(`map`,n,`map`)}function Hs(e){return function(e,t){return new X(`array`,e.map((e=>Y(e))),t)}(e,`array`)}function Us(e){return new Gs(Ts(e),`ascending`,`ascending`)}function Ws(e){return new Gs(Ts(e),`descending`,`descending`)}var Gs=class{constructor(e,t,n){this.expr=e,this.direction=t,this._methodName=n,this._protoValueType=`ProtoValue`}_toProto(e){return{mapValue:{fields:{direction:to(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}},Ks=class{constructor(e){this.optionsProto=void 0,{rawOptions:this.rawOptions,...this.knownOptions}=e}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}},qs=class extends Ks{get _name(){return`add_fields`}get _optionsUtil(){return new ys({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[eo(e,this.fields)]}}_readUserData(e){super._readUserData(e),oc(this.fields,e)}},Js=class extends Ks{get _name(){return`aggregate`}get _optionsUtil(){return new ys({})}constructor(e,t,n){super(n),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[eo(e,this.accumulators),eo(e,this.groups)]}}_readUserData(e){super._readUserData(e),oc(this.groups,e),oc(this.accumulators,e)}},Ys=class extends Ks{get _name(){return`distinct`}get _optionsUtil(){return new ys({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[eo(e,this.groups)]}}_readUserData(e){super._readUserData(e),oc(this.groups,e)}},Xs=class extends Ks{get _name(){return`collection`}get _optionsUtil(){return new ys({forceIndex:{serverName:`force_index`}})}constructor(e,t){super(t),this.Vr=e.startsWith(`/`)?e:`/`+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.Vr}]}}_readUserData(e){super._readUserData(e)}},Zs=class extends Ks{get _name(){return`collection_group`}get _optionsUtil(){return new ys({forceIndex:{serverName:`force_index`}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:``},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}},Qs=class extends Ks{get _name(){return`database`}get _optionsUtil(){return new ys({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}},$s=class extends Ks{get _name(){return`documents`}get _optionsUtil(){return new ys({})}constructor(e,t){if(super(t),!e||e.length===0)throw new j(A.INVALID_ARGUMENT,`Empty document paths are not allowed in DocumentsSource`);let n=e.map((e=>e.startsWith(`/`)?e:`/`+e)),r=new Set(n);if(r.size!==n.length)throw new j(A.INVALID_ARGUMENT,`Duplicate document paths are not allowed in DocumentsSource`);this.dr=n,this.mr=r}_toProto(e){return{...super._toProto(e),args:this.dr.map((e=>({referenceValue:e})))}}_readUserData(e){super._readUserData(e)}},ec=class extends Ks{get _name(){return`where`}get _optionsUtil(){return new ys({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),oc(this.condition,e)}},tc=class extends Ks{get _name(){return`limit`}get _optionsUtil(){return new ys({})}constructor(e,t){O(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[fr(e,this.limit)]}}},nc=class extends Ks{get _name(){return`offset`}get _optionsUtil(){return new ys({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[fr(e,this.offset)]}}},rc=class extends Ks{get _name(){return`select`}get _optionsUtil(){return new ys({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[eo(e,this.selections)]}}_readUserData(e){super._readUserData(e),oc(this.selections,e)}},ic=class extends Ks{get _name(){return`sort`}get _optionsUtil(){return new ys({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map((t=>t._toProto(e)))}}_readUserData(e){super._readUserData(e),oc(this.orderings,e)}},ac=class e extends Ks{get _name(){return`replace_with`}get _optionsUtil(){return new ys({})}constructor(e,t){super(t),this.map=e}_toProto(t){return{...super._toProto(t),args:[this.map._toProto(t),to(e.pr)]}}_readUserData(e){super._readUserData(e),oc(this.map,e)}};ac.pr=`full_replace`;function oc(e,t){return vs(e)?e._readUserData(t):Array.isArray(e)||e instanceof Map?e.forEach((e=>e._readUserData(t))):Object.values(e).forEach((e=>e._readUserData(t))),e}var sc=class{constructor(e,t,n){this.serializer=e,this.stages=t,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return lc(this)}getPipelineCollectionGroup(){return uc(this)}getPipelineCollectionId(){return dc(this)}getPipelineDocuments(){return fc(this)}getPipelineFlavor(){return function(e){let t=`exact`;return e.stages.forEach(((n,r)=>{n._name!==Ys.name&&n._name!==Js.name||(t=`keyless`),n._name===rc.name&&t===`exact`&&(t=`augmented`),n._name===qs.name&&r<e.stages.length-1&&t===`exact`&&(t=`augmented`)})),t}(this)}getPipelineSourceType(){return cc(this)}};function cc(e){let t=e.stages[0];return t instanceof Xs||t instanceof Zs||t instanceof Qs||t instanceof $s?t._name:`unknown`}function lc(e){if(cc(e)===`collection`)return e.stages[0].Vr}function uc(e){if(cc(e)===`collection_group`)return e.stages[0].collectionId}function dc(e){switch(cc(e)){case`collection`:return N.fromString(lc(e)).lastSegment();case`collection_group`:return uc(e);default:return}}function fc(e){if(cc(e)===`documents`)return e.stages[0].dr}var Z=class e{constructor(e,t){this.type=e,this.value=t}static vr(){return new e(`ERROR`,void 0)}static Sr(){return new e(`UNSET`,void 0)}static Dr(){return new e(`NULL`,Bn)}static newValue(t){return tr(t)?new e(`NULL`,Bn):function(e){return!!e&&`booleanValue`in e}(t)?new e(`BOOLEAN`,t):Zn(t)?new e(`INT`,t):Qn(t)?new e(`DOUBLE`,t):function(e){return!!e&&`timestampValue`in e&&!!e.timestampValue}(t)?new e(`TIMESTAMP`,t):function(e){return!!e&&`stringValue`in e}(t)?new e(`STRING`,t):function(e){return!!e&&`bytesValue`in e}(t)?new e(`BYTES`,t):t.referenceValue?new e(`REFERENCE`,t):t.geoPointValue?new e(`GEO_POINT`,t):er(t)?new e(`ARRAY`,t):ir(t)?new e(`VECTOR`,t):rr(t)?new e(`MAP`,t):new e(`ERROR`,void 0)}Cr(){return this.type===`ERROR`||this.type===`UNSET`}Fr(){return this.type===`NULL`}};function pc(e){if(!e.Cr())return e.value}function mc(e){return e instanceof Ls?e._expr:e}function Q(e){if((e=mc(e))instanceof js)return new hc(e);if(e instanceof Ps)return new gc(e);if(e instanceof As)return new _c(e);if(e instanceof X){if(e.name===`add`)return new wc(e);if(e.name===`subtract`)return new Tc(e);if(e.name===`multiply`)return new Ec(e);if(e.name===`divide`)return new Dc(e);if(e.name===`mod`)return new Oc(e);if(e.name===`and`)return new kc(e);if(e.name===`equal`)return new Gc(e);if(e.name===`not_equal`)return new Kc(e);if(e.name===`less_than`)return new qc(e);if(e.name===`less_than_or_equal`)return new Jc(e);if(e.name===`greater_than`)return new Yc(e);if(e.name===`greater_than_or_equal`)return new Xc(e);if(e.name===`array_concat`)return new Zc(e);if(e.name===`array_reverse`)return new Qc(e);if(e.name===`array_contains`)return new $c(e);if(e.name===`array_contains_all`)return new el(e);if(e.name===`array_contains_any`)return new tl(e);if(e.name===`array_length`)return new nl(e);if(e.name===`array_element`)return new rl(e);if(e.name===`equal_any`)return new Nc(e);if(e.name===`not_equal_any`)return new Pc(e);if(e.name===`is_nan`)return new Fc(e);if(e.name===`is_not_nan`)return new Ic(e);if(e.name===`is_null`)return new Lc(e);if(e.name===`is_not_null`)return new Rc(e);if(e.name===`is_error`)return new zc(e);if(e.name===`exists`)return new Bc(e);if(e.name===`not`)return new Ac(e);if(e.name===`or`)return new jc(e);if(e.name===`xor`)return new Mc(e);if(e.name===`conditional`)return new Vc(e);if(e.name===`maximum`)return new Hc(e);if(e.name===`minimum`)return new Uc(e);if(e.name===`reverse`)return new il(e);if(e.name===`replace_first`)return new al(e);if(e.name===`replace_all`)return new ol(e);if(e.name===`char_length`)return new sl(e);if(e.name===`byte_length`)return new cl(e);if(e.name===`like`)return new ul(e);if(e.name===`regex_contains`)return new dl(e);if(e.name===`regex_match`)return new fl(e);if(e.name===`string_contains`)return new pl(e);if(e.name===`starts_with`)return new ml(e);if(e.name===`ends_with`)return new hl(e);if(e.name===`to_lower`)return new gl(e);if(e.name===`to_upper`)return new _l(e);if(e.name===`trim`)return new vl(e);if(e.name===`string_concat`)return new yl(e);if(e.name===`map_get`)return new bl(e);if(e.name===`cosine_distance`)return new Sl(e);if(e.name===`dot_product`)return new Cl(e);if(e.name===`euclidean_distance`)return new wl(e);if(e.name===`vector_length`)return new Tl(e);if(e.name===`unix_micros_to_timestamp`)return new Bl(e);if(e.name===`timestamp_to_unix_micros`)return new Wl(e);if(e.name===`unix_millis_to_timestamp`)return new Vl(e);if(e.name===`timestamp_to_unix_millis`)return new Gl(e);if(e.name===`unix_seconds_to_timestamp`)return new Hl(e);if(e.name===`timestamp_to_unix_seconds`)return new Kl(e);if(e.name===`timestamp_add`)return new Jl(e);if(e.name===`timestamp_subtract`)return new Yl(e)}throw Error(`Unknown Expr : ${e}`)}var hc=class{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===Nt)return Z.newValue({referenceValue:ka(e.serializer,t.key)});if(this.expr.fieldName===`__update_time__`)return Z.newValue({timestampValue:wa(e.serializer,t.version)});if(this.expr.fieldName===`__create_time__`)return Z.newValue({timestampValue:wa(e.serializer,t.createTime)});let n=t.data.field(this.expr._fieldPath);return n?On(n)?Z.newValue(function(e,t){if(e.serverTimestampBehavior===`estimate`)return{timestampValue:wa(e.serializer,R.fromTimestamp(An(t)))};if(e.serverTimestampBehavior===`previous`){let e=kn(t);if(e)return e}return{nullValue:`NULL_VALUE`}}(e,n)):Z.newValue(n):Z.Sr()}},gc=class{constructor(e){this.expr=e}evaluate(e,t){return Z.newValue(this.expr._getValue())}},_c=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.Rr.map((n=>Q(n).evaluate(e,t)));return n.some((e=>e.Cr()))?Z.vr():Z.newValue({arrayValue:{values:n.map((e=>e.value))}})}};function vc(e){return Qn(e)?Number(e.doubleValue):Number(e.integerValue)}function yc(e){return BigInt(e.integerValue)}var bc=BigInt(`0x7fffffffffffffff`),xc=-BigInt(`0x8000000000000000`),Sc=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length>=2,24778);let n=Q(this.expr.params[0]).evaluate(e,t),r=Q(this.expr.params[1]).evaluate(e,t),i=this.Or(n,r);for(let n of this.expr.params.slice(2)){let r=Q(n).evaluate(e,t);i=this.Or(i,r)}return i}Or(e,t){if(e.Cr()||t.Cr())return Z.vr();if(e.Fr()||t.Fr())return Z.Dr();let n=e.value,r=t.value;if(!Qn(n)&&!Zn(n)||!Qn(r)&&!Zn(r))return Z.vr();if(Qn(n)||Qn(r)){let e=this.Mr(n,r);return e?Z.newValue(e):Z.vr()}if(Zn(n)&&Zn(r)){let e=this.Nr(n,r);return e===void 0?Z.vr():typeof e==`number`?Z.newValue({doubleValue:e}):e<xc||e>bc?Z.vr():Z.newValue({integerValue:`${e}`})}return Z.vr()}};function Cc(e,t){return G(e)===G(t)?nr(e)||nr(t)?`NOT_EQ`:tr(e)&&tr(t)?`EQ`:tr(e)||tr(t)?`NULL`:er(e)&&er(t)?function(e,t){if(e.values?.length!==t.values?.length)return`NOT_EQ`;let n=!1;for(let r=0;r<(e.values?.length??0);r++){let i=e.values[r],a=t.values[r];switch(Cc(i,a)){case`EQ`:break;case`NOT_EQ`:case`TYPE_MISMATCH`:return`NOT_EQ`;case`NULL`:n=!0;break;default:D(44609,{Lr:i,Br:a})}}return n?`NULL`:`EQ`}(e.arrayValue,t.arrayValue):ir(e)&&ir(t)||rr(e)&&rr(t)?function(e,t){let n=e.fields||{},r=t.fields||{};if(gn(n)!==gn(r))return`NOT_EQ`;let i=!1;for(let e in n)if(n.hasOwnProperty(e)){if(r[e]===void 0)return`NOT_EQ`;switch(Cc(n[e],r[e])){case`NOT_EQ`:case`TYPE_MISMATCH`:return`NOT_EQ`;case`NULL`:i=!0}}return i?`NULL`:`EQ`}(e.mapValue,t.mapValue):function(e,t){return Un(e,t,{Te:!1,Ee:!0,he:!0})}(e,t)?`EQ`:`NOT_EQ`:`TYPE_MISMATCH`}var wc=class extends Sc{Nr(e,t){return yc(e)+yc(t)}Mr(e,t){return{doubleValue:vc(e)+vc(t)}}},Tc=class extends Sc{constructor(e){super(e),this.expr=e}Nr(e,t){return yc(e)-yc(t)}Mr(e,t){return{doubleValue:vc(e)-vc(t)}}},Ec=class extends Sc{constructor(e){super(e),this.expr=e}Nr(e,t){return yc(e)*yc(t)}Mr(e,t){return{doubleValue:vc(e)*vc(t)}}},Dc=class extends Sc{constructor(e){super(e),this.expr=e}Nr(e,t){let n=yc(t);if(n!==BigInt(0))return yc(e)/n}Mr(e,t){let n=vc(t);return n===0?{doubleValue:on(n)?-1/0:1/0}:{doubleValue:vc(e)/n}}},Oc=class extends Sc{constructor(e){super(e),this.expr=e}Nr(e,t){let n=yc(t);if(n!==BigInt(0))return yc(e)%n}Mr(e,t){let n=vc(t);if(n!==0)return{doubleValue:vc(e)%n}}},kc=class{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(let i of this.expr.params){let a=Q(i).evaluate(e,t);switch(a.type){case`BOOLEAN`:if(!a.value?.booleanValue)return Z.newValue(Hn);break;case`NULL`:r=!0;break;default:n=!0}}return n?Z.vr():r?Z.Dr():Z.newValue(Vn)}},Ac=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,9634);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`BOOLEAN`:return Z.newValue({booleanValue:!n.value?.booleanValue});case`NULL`:return Z.Dr();default:return Z.vr()}}},jc=class{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(let i of this.expr.params){let a=Q(i).evaluate(e,t);switch(a.type){case`BOOLEAN`:if(a.value?.booleanValue)return Z.newValue(Vn);break;case`NULL`:r=!0;break;default:n=!0}}return n?Z.vr():r?Z.Dr():Z.newValue(Hn)}},Mc=class e{constructor(e){this.expr=e}evaluate(t,n){let r=!1,i=!1;for(let a of this.expr.params){let o=Q(a).evaluate(t,n);switch(o.type){case`BOOLEAN`:r=e.xor(r,!!o.value?.booleanValue);break;case`NULL`:i=!0;break;default:return Z.vr()}}return i?Z.Dr():Z.newValue({booleanValue:r})}static xor(e,t){return(e||t)&&!(e&&t)}},Nc=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===2,55094);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`NULL`:n=!0;break;case`ERROR`:case`UNSET`:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();for(let e of i.value?.arrayValue?.values??[])switch(tr(r.value)&&tr(e)?`EQ`:Cc(r.value,e)){case`EQ`:return Z.newValue(Vn);case`NOT_EQ`:case`TYPE_MISMATCH`:break;case`NULL`:n=!0;break;default:D(44608,{value:r.value,candidate:e})}return n?Z.Dr():Z.newValue(Hn)}},Pc=class{constructor(e){this.expr=e}evaluate(e,t){return new Ac(new X(`not`,[new X(`equal_any`,this.expr.params)])).evaluate(e,t)}},Fc=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,23322);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`INT`:return Z.newValue(Hn);case`DOUBLE`:return Z.newValue({booleanValue:isNaN(vc(n.value))});case`NULL`:return Z.Dr();default:return Z.vr()}}},Ic=class{constructor(e){this.expr=e}evaluate(e,t){return O(this.expr.params.length===1,50406),new Ac(new X(`not`,[new X(`is_nan`,this.expr.params)])).evaluate(e,t)}},Lc=class{constructor(e){this.expr=e}evaluate(e,t){switch(O(this.expr.params.length===1,23123),Q(this.expr.params[0]).evaluate(e,t).type){case`NULL`:return Z.newValue(Vn);case`UNSET`:case`ERROR`:return Z.vr();default:return Z.newValue(Hn)}}},Rc=class{constructor(e){this.expr=e}evaluate(e,t){return O(this.expr.params.length===1,23167),new Ac(new X(`not`,[new X(`is_null`,this.expr.params)])).evaluate(e,t)}},zc=class{constructor(e){this.expr=e}evaluate(e,t){return O(this.expr.params.length===1,5228),Q(this.expr.params[0]).evaluate(e,t).type===`ERROR`?Z.newValue(Vn):Z.newValue(Hn)}},Bc=class{constructor(e){this.expr=e}evaluate(e,t){switch(O(this.expr.params.length===1,6877),Q(this.expr.params[0]).evaluate(e,t).type){case`ERROR`:return Z.vr();case`UNSET`:return Z.newValue(Hn);default:return Z.newValue(Vn)}}},Vc=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===3,11706);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`BOOLEAN`:return n.value?.booleanValue?Q(this.expr.params[1]).evaluate(e,t):Q(this.expr.params[2]).evaluate(e,t);case`NULL`:return Q(this.expr.params[2]).evaluate(e,t);default:return Z.vr()}}},Hc=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.params.map((n=>Q(n).evaluate(e,t))),r;for(let e of n)switch(e.type){case`ERROR`:case`UNSET`:case`NULL`:continue;default:r=r===void 0||Gn(e.value,r.value)>0?e:r}return r===void 0?Z.Dr():r}},Uc=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.params.map((n=>Q(n).evaluate(e,t))),r;for(let e of n)switch(e.type){case`ERROR`:case`UNSET`:case`NULL`:continue;default:r=r===void 0||Gn(e.value,r.value)<0?e:r}return r===void 0?Z.Dr():r}},Wc=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===2,31033,`${this.expr.name}() function should have exactly 2 params`);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`ERROR`:case`UNSET`:return Z.vr()}let r=Q(this.expr.params[1]).evaluate(e,t);switch(r.type){case`ERROR`:case`UNSET`:return Z.vr()}return this.Ur(n,r)}},Gc=class extends Wc{constructor(e){super(e),this.expr=e}Ur(e,t){if(e.Fr()&&t.Fr())return Z.newValue(Vn);if(e.Fr()||t.Fr()||nr(e.value)||nr(t.value)||G(e.value)!==G(t.value))return Z.newValue(Hn);switch(Cc(e.value,t.value)){case`EQ`:return Z.newValue(Vn);case`NOT_EQ`:return Z.newValue(Hn);case`NULL`:return Z.Dr();default:D(44615,{left:e,right:t})}}},Kc=class extends Wc{constructor(e){super(e),this.expr=e}Ur(e,t){switch(Cc(e.value,t.value)){case`EQ`:return Z.newValue(Hn);case`NOT_EQ`:case`TYPE_MISMATCH`:return Z.newValue(Vn);case`NULL`:return Z.Dr();default:D(44614,{left:e,right:t})}}},qc=class extends Wc{constructor(e){super(e),this.expr=e}Ur(e,t){return G(e.value)!==G(t.value)||nr(e.value)||nr(t.value)?Z.newValue(Hn):Z.newValue({booleanValue:Gn(e.value,t.value)<0})}},Jc=class extends Wc{constructor(e){super(e),this.expr=e}Ur(e,t){return G(e.value)!==G(t.value)||nr(e.value)||nr(t.value)?Z.newValue(Hn):Cc(e.value,t.value)===`EQ`?Z.newValue(Vn):Z.newValue({booleanValue:Gn(e.value,t.value)<0})}},Yc=class extends Wc{constructor(e){super(e),this.expr=e}Ur(e,t){return G(e.value)!==G(t.value)||nr(e.value)||nr(t.value)?Z.newValue(Hn):Z.newValue({booleanValue:Gn(e.value,t.value)>0})}},Xc=class extends Wc{constructor(e){super(e),this.expr=e}Ur(e,t){return G(e.value)!==G(t.value)||nr(e.value)||nr(t.value)?Z.newValue(Hn):Cc(e.value,t.value)===`EQ`?Z.newValue(Vn):Z.newValue({booleanValue:Gn(e.value,t.value)>0})}},Zc=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},Qc=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,216);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`ARRAY`:{let e=n.value.arrayValue?.values??[];return Z.newValue({arrayValue:{values:[...e].reverse()}})}default:return Z.vr()}}},$c=class{constructor(e){this.expr=e}evaluate(e,t){return O(this.expr.params.length===2,52884),new Nc(new X(`eq_any`,[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}},el=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===2,1392);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let a=i.value?.arrayValue?.values??[],o=r.value?.arrayValue?.values??[];for(let e of a){let t=!1;n=!1;for(let r of o){switch(tr(e)&&tr(r)?`EQ`:Cc(e,r)){case`EQ`:t=!0;break;case`NOT_EQ`:case`TYPE_MISMATCH`:break;case`NULL`:n=!0;break;default:D(44613,{value:r,search:e})}if(t)break}if(!t)return Z.newValue(Hn)}return Z.newValue(Vn)}},tl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===2,2680);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let a=i.value?.arrayValue?.values??[],o=r.value?.arrayValue?.values??[];for(let e of o)for(let t of a)switch(tr(e)&&tr(t)?`EQ`:Cc(e,t)){case`EQ`:return Z.newValue(Vn);case`NOT_EQ`:case`TYPE_MISMATCH`:break;case`NULL`:n=!0;break;default:D(44608,{value:e,search:t})}return n?Z.Dr():Z.newValue(Hn)}},nl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,38605);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`ARRAY`:return Z.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return Z.vr()}}},rl=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},il=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,1508);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`BYTES`:{let e=n.value?.bytesValue;if(typeof e==`string`){let t=U.fromBase64String(e).toUint8Array();return t.reverse(),Z.newValue({bytesValue:U.fromUint8Array(t).toBase64()})}return Z.newValue({bytesValue:new Uint8Array(e).reverse()})}case`STRING`:{let e=n.value?.stringValue,t=new Intl.__PRIVATE_Segmenter(void 0,{granularity:`grapheme`}).segment(e),r=Array.from(t,(e=>e.segment)).reverse();return Z.newValue({stringValue:r.join(``)})}default:return Z.vr()}}},al=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},ol=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},sl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,19400);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`STRING`:{let e=function(e){let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);if(r===void 0)return;if(r<=65535)if(r>=55296&&r<=57343)if(r<=56319){let r=e.codePointAt(n+1);r!==void 0&&r>=56320&&r<=57343?(t+=1,n++):t+=1}else t+=1;else t+=1;else{if(!(r<=1114111))return;t+=1,n++}}return t}(n.value.stringValue);return e===void 0?Z.vr():Z.newValue({integerValue:e})}default:return Z.vr()}}},cl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,8486);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`BYTES`:{let e=n.value?.bytesValue;return typeof e==`string`?Z.newValue({integerValue:U.fromBase64String(e).toUint8Array().length}):Z.newValue({integerValue:new Uint8Array(e).length})}case`STRING`:{let e=function(e){let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);if(r===void 0)return;if(r>=55296&&r<=57343){if(!(r<=56319))return;{let r=e.codePointAt(n+1);if(r===void 0||!(r>=56320&&r<=57343))return;t+=4,n++}}else if(r<=127)t+=1;else if(r<=2047)t+=2;else if(r<=65535)t+=3;else{if(!(r<=1114111))return;t+=4,n++}}return t}(n.value?.stringValue);return e===void 0?Z.vr():Z.newValue({integerValue:e})}case`NULL`:return Z.Dr();default:return Z.vr()}}},ll=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===2,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`STRING`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`STRING`:break;case`NULL`:n=!0;break;default:return Z.vr()}return n?Z.Dr():this.kr(r.value?.stringValue,i.value?.stringValue)}},ul=class extends ll{kr(e,t){try{let n=function(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charAt(n);switch(r){case`_`:t+=`.`;break;case`%`:t+=`.*`;break;case`\\`:case`.`:case`*`:case`?`:case`+`:case`^`:case`$`:case`|`:case`(`:case`)`:case`[`:case`]`:case`{`:case`}`:t+=`\\`+r;break;default:t+=r}}return`^`+t+`$`}(t),r=ct.compile(n);return Z.newValue({booleanValue:r.matches(e)})}catch(e){return mt(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${e}`),Z.vr()}}},dl=class extends ll{kr(e,t){try{let n=ct.compile(t);return Z.newValue({booleanValue:n.matcher(e).find()})}catch{return mt(`Invalid regex pattern found in regex_contains: ${t}, returning error`),Z.vr()}}},fl=class extends ll{kr(e,t){try{return Z.newValue({booleanValue:ct.compile(t).matches(e)})}catch{return mt(`Invalid regex pattern found in regex_match: ${t}, returning error`),Z.vr()}}},pl=class extends ll{kr(e,t){return Z.newValue({booleanValue:e.includes(t)})}},ml=class extends ll{kr(e,t){return Z.newValue({booleanValue:e.startsWith(t)})}},hl=class extends ll{kr(e,t){return Z.newValue({booleanValue:e.endsWith(t)})}},gl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,29079);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`STRING`:return Z.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case`NULL`:return Z.Dr();default:return Z.vr()}}},_l=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,60487);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`STRING`:return Z.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case`NULL`:return Z.Dr();default:return Z.vr()}}},vl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,28544);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`STRING`:return Z.newValue({stringValue:n.value?.stringValue?.trim()});case`NULL`:return Z.Dr();default:return Z.vr()}}},yl=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.params.map((n=>Q(n).evaluate(e,t))),r=``,i=!1;for(let e of n)switch(e.type){case`STRING`:r+=e.value.stringValue;break;case`NULL`:i=!0;break;default:return Z.vr()}return i?Z.Dr():Z.newValue({stringValue:r})}},bl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===2,4483);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`UNSET`:return Z.Sr();case`MAP`:break;default:return Z.vr()}let r=Q(this.expr.params[1]).evaluate(e,t);if(r.type!==`STRING`)return Z.vr();let i=n.value?.mapValue?.fields?.[r.value?.stringValue];return i===void 0?Z.Sr():Z.newValue(i)}},xl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===2,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`VECTOR`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`VECTOR`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let a=ar(r.value),o=ar(i.value);if(a===void 0||o===void 0||a.values?.length!==o.values?.length)return Z.vr();let s=this.qr(a,o);return s===void 0||isNaN(s)?Z.vr():Z.newValue({doubleValue:s})}},Sl=class extends xl{qr(e,t){let n=e?.values??[],r=t?.values??[];if(n.length===0)return;let i=0,a=0,o=0;for(let e=0;e<n.length;e++){if(!$n(n[e])||!$n(r[e]))return;let t=vc(n[e]),s=vc(r[e]);i+=t*s,a+=t*t,o+=s*s}let s=Math.sqrt(a)*Math.sqrt(o);if(s!==0)return 1-Math.max(-1,Math.min(1,i/s))}},Cl=class extends xl{qr(e,t){let n=e?.values??[],r=t?.values??[];if(n.length===0)return 0;let i=0;for(let e=0;e<n.length;e++){if(!$n(n[e])||!$n(r[e]))return;i+=vc(n[e])*vc(r[e])}return i}},wl=class extends xl{qr(e,t){let n=e?.values??[],r=t?.values??[];if(n.length===0)return 0;let i=0;for(let e=0;e<n.length;e++){if(!$n(n[e])||!$n(r[e]))return;let t=vc(n[e]),a=vc(r[e]);i+=(t-a)**2}return Math.sqrt(i)}},Tl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,39044);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`VECTOR`:{let e=ar(n.value);return Z.newValue({integerValue:e?.values?.length??0})}case`NULL`:return Z.Dr();default:return Z.vr()}}},El=BigInt(-62135596800),Dl=BigInt(253402300799),Ol=BigInt(1e3),kl=BigInt(1e6),Al=El*Ol,jl=Dl*Ol+BigInt(999),Ml=El*kl,Nl=Dl*kl+BigInt(999999);function Pl(e){return e>=Ml&&e<=Nl}function Fl(e){return e>=El&&e<=Dl}function Il(e,t){let n=BigInt(e);return!(n<El||n>Dl)&&!(t<0||t>=1e9)&&(n!==El||t===0)&&!(n===Dl&&t>999999999)}function Ll(e,t){return t<0?{seconds:e-1,nanos:t+1e9}:{seconds:e,nanos:t}}function Rl(e){return BigInt(e.seconds)*kl+BigInt(Math.trunc(e.nanoseconds/1e3))}var zl=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,49262,`${this.expr.name}() function should have exactly one parameter`);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`INT`:return this.toTimestamp(BigInt(n.value.integerValue));case`NULL`:return Z.Dr();default:return Z.vr()}}},Bl=class extends zl{toTimestamp(e){if(!Pl(e))return Z.vr();let t=Number(e/kl),n=Number(e%kl*BigInt(1e3)),r=Ll(t,n);return t=r.seconds,n=r.nanos,Il(t,n)?Z.newValue({timestampValue:{seconds:t,nanos:n}}):Z.vr()}},Vl=class extends zl{toTimestamp(e){if(!function(e){return e>=Al&&e<=jl}(e))return Z.vr();let t=Number(e/Ol),n=Number(e%Ol*BigInt(1e6)),r=Ll(t,n);return t=r.seconds,n=r.nanos,Il(t,n)?Z.newValue({timestampValue:{seconds:t,nanos:n}}):Z.vr()}},Hl=class extends zl{toTimestamp(e){if(!Fl(e))return Z.vr();let t=Number(e);return Z.newValue({timestampValue:{seconds:t,nanos:0}})}},Ul=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===1,1265,`${this.expr.name}() function should have exactly one parameter`);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`TIMESTAMP`:break;case`NULL`:return Z.Dr();default:return Z.vr()}let r=Sa(n.value.timestampValue);return Il(r.seconds,r.nanoseconds)?this.$r(r):Z.vr()}},Wl=class extends Ul{$r(e){let t=Rl(e);return Pl(t)?Z.newValue({integerValue:`${t.toString()}`}):Z.vr()}},Gl=class extends Ul{$r(e){let t=Rl(e),n=t/BigInt(1e3),r=t%BigInt(1e3);return n>BigInt(0)||r===BigInt(0)?Z.newValue({integerValue:n.toString()}):Z.newValue({integerValue:(n-BigInt(1)).toString()})}},Kl=class extends Ul{$r(e){let t=BigInt(e.seconds);return Fl(t)?Z.newValue({integerValue:t.toString()}):Z.vr()}},ql=class{constructor(e){this.expr=e}evaluate(e,t){O(this.expr.params.length===3,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`TIMESTAMP`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t),a;switch(i.type){case`STRING`:if(a=function(e){switch(e){case`microsecond`:return`microsecond`;case`millisecond`:return`millisecond`;case`second`:return`second`;case`minute`:return`minute`;case`hour`:return`hour`;case`day`:return`day`;default:return}}(i.value.stringValue),a===void 0)return Z.vr();break;case`NULL`:n=!0;break;default:return Z.vr()}let o=Q(this.expr.params[2]).evaluate(e,t);switch(o.type){case`INT`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let s=BigInt(o.value.integerValue),c;try{switch(a){case`microsecond`:c=s;break;case`millisecond`:c=s*BigInt(1e3);break;case`second`:c=s*BigInt(1e6);break;case`minute`:c=s*BigInt(6e7);break;case`hour`:c=s*BigInt(36e8);break;case`day`:c=s*BigInt(864e8);break;default:return Z.vr()}if(a!==`microsecond`&&s!==BigInt(0)&&c/s!==BigInt(this.Kr(a)))return Z.vr()}catch(e){return mt(`Error during timestamp arithmetic: ${e}`),Z.vr()}let l=Sa(r.value.timestampValue);if(!Il(l.seconds,l.nanoseconds))return Z.vr();let u=Rl(l),d=this.Wr(u,c);if(!Pl(d))return Z.vr();let f=Number(d/kl),p=d%kl,ee=Number((p<0?p+kl:p)*BigInt(1e3)),te=p<0?f-1:f;return Il(te,ee)?Z.newValue({timestampValue:{seconds:te,nanos:ee}}):Z.vr()}Kr(e){switch(e){case`millisecond`:return 1e3;case`second`:return 1e6;case`minute`:return 6e7;case`hour`:return 36e8;case`day`:return 864e8;default:return 1}}},Jl=class extends ql{Wr(e,t){return e+t}},Yl=class extends ql{Wr(e,t){return e-t}};function Xl(e){if((e=mc(e))instanceof js)return`fld(${e.fieldName})`;if(e instanceof Ps)return`cst(${function(e){return e===null?`null`:typeof e==`number`?e.toString():typeof e==`string`?`"${e}"`:e instanceof Xo?`ref(${e.path})`:e instanceof $o?`vec(${JSON.stringify(e)})`:JSON.stringify(e)}(e.value)})`;if(e instanceof X)return`fn(${e.name},[${e.params.map(Xl).join(`,`)}])`;if(e.expressionType===`ListOfExpressions`)return`list([${e.Rr.map(Xl).join(`,`)}])`;throw Error(`Unrecognized expr ${JSON.stringify(e,null,2)}`)}function Zl(e){if(e instanceof qs)return`${e._name}(${Ql(e.fields)})`;if(e instanceof Js){let t=`${e._name}(${Ql(e.accumulators)})`;return e.groups.size>0&&(t+=`grouping(${Ql(e.groups)})`),t}if(e instanceof Ys)return`${e._name}(${Ql(e.groups)})`;if(e instanceof Xs)return`${e._name}(${e.Vr})`;if(e instanceof Zs)return`${e._name}(${e.collectionId})`;if(e instanceof Qs)return`${e._name}()`;if(e instanceof $s)return`${e._name}(${e.dr.sort()})`;if(e instanceof ec)return`${e._name}(${Xl(e.condition)})`;if(e instanceof tc)return`${e._name}(${e.limit})`;if(e instanceof ic)return`${e._name}(${function(e){return e.map((e=>`${Xl(e.expr)}${e.direction}`)).join(`,`)}(e.orderings)})`;throw Error(`Unrecognized stage ${e._name}`)}function Ql(e){return`${Array.from(e.entries()).sort().map((([e,t])=>`${e}=${Xl(t)}`)).join(`,`)}`}function $l(e){return e.stages.map((e=>Zl(e))).join(`|`)}function eu(e,t){return $l(e)===$l(t)}function $(e){return e instanceof sc}function tu(e){return $(e)?$l(e):Ni(e)}function nu(e){return $(e)?$l(e):function(e){return`${vi(ki(e))}|lt:${e.limitType}`}(e)}function ru(e,t){return e instanceof sc&&t instanceof sc?eu(e,t):!(e instanceof sc&&!(t instanceof sc)||!(e instanceof sc)&&t instanceof sc)&&Mi(e,t)}function iu(e){return bi(e)?$l(e):vi(e)}function au(e,t){return e instanceof sc&&t instanceof sc?eu(e,t):!(e instanceof sc&&!(t instanceof sc)||!(e instanceof sc)&&t instanceof sc)&&yi(e,t)}var ou=class{constructor(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let r=this.mutations[t];r.key.isEqual(e.key)&&Ir(r,e,n[t])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=Lr(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=Lr(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=qi();return this.mutations.forEach((r=>{let i=e.get(r.key),a=i.overlayedDocument,o=this.applyToLocalView(a,i.mutatedFields);o=t.has(r.key)?null:o;let s=Fr(a,o);s!==null&&n.set(r.key,s),a.isValidDocument()||a.convertToNoDocument(R.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),J())}isEqual(e){return this.batchId===e.batchId&&Mt(this.mutations,e.mutations,((e,t)=>zr(e,t)))&&Mt(this.baseMutations,e.baseMutations,((e,t)=>zr(e,t)))}},su=class e{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(t,n,r){O(t.mutations.length===r.length,58842,{Qr:t.mutations.length,Gr:r.length});let i=function(){return Yi}(),a=t.mutations;for(let e=0;e<a.length;e++)i=i.insert(a[e].key,r[e].version);return new e(t,n,r,i)}},cu=class{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}},lu=class e{constructor(e,t,n,r,i=R.min(),a=R.min(),o=U.EMPTY_BYTE_STRING,s=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=o,this.expectedCount=s}withSequenceNumber(t){return new e(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(t,n){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,t,null)}withExpectedCount(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}withLastLimboFreeSnapshotVersion(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}},uu=class{constructor(e){this.zr=e}};function du(e){let t=Va({parent:e.parent,structuredQuery:e.structuredQuery});return e.limitType===`LAST`?ji(t,t.limit,`L`):t}var fu=class{constructor(){}Yr(e,t){this.Zr(e,t),t.Xr()}Zr(e,t){if(`nullValue`in e)this.ei(t,5);else if(`booleanValue`in e)this.ei(t,10),t.ti(+!!e.booleanValue);else if(`integerValue`in e)this.ei(t,15),t.ti(W(e.integerValue));else if(`doubleValue`in e){let n=W(e.doubleValue);isNaN(n)?this.ei(t,13):(this.ei(t,15),on(n)?t.ti(0):t.ti(n))}else if(`timestampValue`in e){let n=e.timestampValue;this.ei(t,20),typeof n==`string`&&(n=Sn(n)),t.ni(`${n.seconds||``}`),t.ti(n.nanos||0)}else if(`stringValue`in e)this.ri(e.stringValue,t),this.ii(t);else if(`bytesValue`in e)this.ei(t,30),t.si(Cn(e.bytesValue)),this.ii(t);else if(`referenceValue`in e)this._i(e.referenceValue,t);else if(`geoPointValue`in e){let n=e.geoPointValue;this.ei(t,45),t.ti(n.latitude||0),t.ti(n.longitude||0)}else`mapValue`in e?sr(e)?this.ei(t,2**53-1):ir(e)?this.oi(e.mapValue,t):(this.ai(e.mapValue,t),this.ii(t)):`arrayValue`in e?(this.ui(e.arrayValue,t),this.ii(t)):D(19022,{ci:e})}ri(e,t){this.ei(t,25),this.li(e,t)}li(e,t){t.ni(e)}ai(e,t){let n=e.fields||{};this.ei(t,55);for(let e of Object.keys(n))this.ri(e,t),this.Zr(n[e],t)}oi(e,t){let n=e.fields||{};this.ei(t,53);let r=zn,i=n[r].arrayValue?.values?.length||0;this.ei(t,15),t.ti(W(i)),this.ri(r,t),this.Zr(n[r],t)}ui(e,t){let n=e.values||[];this.ei(t,50);for(let e of n)this.Zr(e,t)}_i(e,t){this.ei(t,37),P.fromName(e).path.forEach((e=>{this.ei(t,60),this.li(e,t)}))}ei(e,t){e.ti(t)}ii(e){e.ti(2)}};fu.Ei=new fu;var pu=class{constructor(){this.Hi=new mu}addToCollectionParentIndex(e,t){return this.Hi.add(t),z.resolve()}getCollectionParents(e,t){return z.resolve(this.Hi.getEntries(t))}addFieldIndex(e,t){return z.resolve()}deleteFieldIndex(e,t){return z.resolve()}deleteAllFieldIndexes(e){return z.resolve()}createTargetIndexes(e,t){return z.resolve()}getDocumentsMatchingTarget(e,t){return z.resolve(null)}getIndexType(e,t){return z.resolve(0)}getFieldIndexes(e,t){return z.resolve([])}getNextCollectionGroupToUpdate(e){return z.resolve(null)}getMinOffset(e,t){return z.resolve(Yt.min())}getMinOffsetFromCollectionGroup(e,t){return z.resolve(Yt.min())}updateCollectionGroup(e,t,n){return z.resolve()}updateIndexEntries(e,t){return z.resolve()}},mu=class{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new V(N.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}has(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new V(N.comparator)).toArray()}},hu=class e{constructor(e){this.Ds=e}next(){return this.Ds+=2,this.Ds}static xs(){return new e(0)}static Cs(){return new e(-1)}};function gu(e,t){let n=t;for(let t of e.stages)n=yu({serializer:e.serializer,serverTimestampBehavior:e.listenOptions?.serverTimestampBehavior},t,n);return n}function _u(e,t){return gu(e,[t]).length>0}function vu(e,t){return $(e)?_u(e,t):Pi(e,t)}function yu(e,t,n){if(t instanceof Xs)return function(e,t,n){return n.filter((e=>e.isFoundDocument()&&`/${e.key.getCollectionPath().canonicalString()}`===t.Vr))}(0,t,n);if(t instanceof ec)return function(e,t,n){return n.filter((n=>{let r=pc(Q(t.condition).evaluate(e,n));return r!==void 0&&Un(r,Vn)}))}(e,t,n);if(t instanceof Zs)return function(e,t,n){return n.filter((e=>e.isFoundDocument()&&e.key.getCollectionPath().lastSegment()===t.collectionId))}(0,t,n);if(t instanceof Qs)return function(e,t,n){return n.filter((e=>e.isFoundDocument()))}(0,0,n);if(t instanceof $s)return function(e,t,n){return n.filter((e=>e.isFoundDocument()&&t.mr.has(e.key.path.toStringWithLeadingSlash())))}(0,t,n);if(t instanceof tc)return function(e,t,n){return n.slice(0,t.limit)}(0,t,n);if(t instanceof ic)return function(e,t,n){let r=t.orderings.map((e=>({ks:Q(e.expr),direction:e.direction})));return[...n].sort(((t,n)=>{for(let{ks:i,direction:a}of r){let r=pc(i.evaluate(e,t)),o=pc(i.evaluate(e,n)),s=Gn(r??Bn,o??Bn);if(s!==0)return a===`ascending`?s:-s}return 0}))}(e,t,n);throw Error(`Unknown stage: ${t._name}`)}function bu(e){let t=function(e){for(let t=e.stages.length-1;t>=0;t--){let n=e.stages[t];if(n instanceof ic)return n.orderings}throw Error(`Pipeline must contain at least one Sort stage`)}(e);return(n,r)=>{for(let i of t){let t=pc(Q(i.expr).evaluate({serializer:e.serializer},n)),a=pc(Q(i.expr).evaluate({serializer:e.serializer},r)),o=Gn(t||Bn,a||Bn);if(o!==0)return i.direction===`ascending`?o:-o}return 0}}function xu(e){for(let t=e.stages.length-1;t>=0;t--){let n=e.stages[t];if(n instanceof tc)return{limit:n.limit}}}var Su=class{constructor(){this.changes=new Bi((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,hi.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return n===void 0?this.getFromCache(e,t):z.resolve(n)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}},Cu=class{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}},wu=class{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((r=>(n=r,this.remoteDocumentCache.getEntry(e,t)))).next((e=>(n!==null&&Lr(n.mutation,e,hn.empty(),L.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,J()).next((()=>t))))}getLocalViewOfDocuments(e,t,n=J()){let r=Ki();return this.populateOverlays(e,r,t).next((()=>this.computeViews(e,t,r,n).next((e=>{let t=Wi();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){let n=Ki();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,J())))}populateOverlays(e,t,n){let r=[];return n.forEach((e=>{t.has(e)||r.push(e)})),this.documentOverlayCache.getOverlays(e,r).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,r){let i=Hi(),a=Ji(),o=function(){return Ji()}();return t.forEach(((e,t)=>{let o=n.get(t.key);r.has(t.key)&&(o===void 0||o.mutation instanceof Vr)?i=i.insert(t.key,t):o===void 0?a.set(t.key,hn.empty()):(a.set(t.key,o.mutation.getFieldMask()),Lr(o.mutation,t,o.mutation.getFieldMask(),L.now()))})),this.recalculateAndSaveOverlays(e,i).next((e=>(e.forEach(((e,t)=>a.set(e,t))),t.forEach(((e,t)=>o.set(e,new Cu(t,a.get(e)??null)))),o)))}recalculateAndSaveOverlays(e,t){let n=Ji(),r=new B(((e,t)=>e-t)),i=J();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(let i of e)i.keys().forEach((e=>{let a=t.get(e);if(a===null)return;let o=n.get(e)||hn.empty();o=i.applyToLocalView(a,o),n.set(e,o);let s=(r.get(i.batchId)||J()).add(e);r=r.insert(i.batchId,s)}))})).next((()=>{let a=[],o=r.getReverseIterator();for(;o.hasNext();){let r=o.getNext(),s=r.key,c=r.value,l=qi();c.forEach((e=>{if(!i.has(e)){let r=Fr(t.get(e),n.get(e));r!==null&&l.set(e,r),i=i.add(e)}})),a.push(this.documentOverlayCache.saveOverlays(e,s,l))}return z.waitFor(a)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n,r){return $(t)?this.getDocumentsMatchingPipeline(e,t,n,r):Ei(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Di(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next((i=>{let a=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-i.size):z.resolve(Ki()),o=Gt,s=i;return a.next((t=>z.forEach(t,((t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(t)?z.resolve():this.remoteDocumentCache.getEntry(e,t).next((e=>{s=s.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,i))).next((()=>this.computeViews(e,s,t,J()))).next((e=>({batchId:o,changes:Gi(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new P(t)).next((e=>{let t=Wi();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){let i=t.collectionGroup,a=Wi();return this.indexManager.getCollectionParents(e,i).next((o=>z.forEach(o,(o=>{let s=function(e,t){return new Si(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(i));return this.getDocumentsMatchingCollectionQuery(e,s,n,r).next((e=>{e.forEach(((e,t)=>{a=a.insert(e,t)}))}))})).next((()=>a))))}getDocumentsMatchingCollectionQuery(e,t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r)))).next((e=>this.retrieveMatchingLocalDocuments(i,e,(e=>Pi(t,e)))))}getDocumentsMatchingPipeline(e,t,n,r){if(cc(t)===`collection_group`){let i=uc(t),a=Wi();return this.indexManager.getCollectionParents(e,i).next((o=>z.forEach(o,(o=>{let s=function(e,t){let n=e.stages.map((e=>e instanceof Zs?new Xs(t.canonicalString(),{}):e));return new sc(e.serializer,n)}(t,o.child(i));return this.getDocumentsMatchingPipeline(e,s,n,r).next((e=>{e.forEach(((e,t)=>{a=a.insert(e,t)}))}))})).next((()=>a))))}{let i;return this.getOverlaysForPipeline(e,t,n.largestBatchId).next((a=>{switch(i=a,cc(t)){case`collection`:return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r);case`documents`:let a=J();for(let e of fc(t))a=a.add(P.fromPath(e));return this.remoteDocumentCache.getEntries(e,a);case`database`:return this.remoteDocumentCache.getAllEntries(e);default:throw new j(`invalid-argument`,`Invalid pipeline source to execute offline: ${$l(t)}`)}})).next((e=>this.retrieveMatchingLocalDocuments(i,e,(e=>_u(t,e)))))}}retrieveMatchingLocalDocuments(e,t,n){e.forEach(((e,n)=>{let r=n.getKey();t.get(r)===null&&(t=t.insert(r,hi.newInvalidDocument(r)))}));let r=Wi();return t.forEach(((t,i)=>{let a=e.get(t);a!==void 0&&Lr(a.mutation,i,hn.empty(),L.now()),n(i)&&(r=r.insert(t,i))})),r}getOverlaysForPipeline(e,t,n){switch(cc(t)){case`collection`:return this.documentOverlayCache.getOverlaysForCollection(e,N.fromString(lc(t)),n);case`collection_group`:throw new j(`invalid-argument`,`Unexpected collection group pipeline: ${$l(t)}`);case`documents`:return this.documentOverlayCache.getOverlays(e,fc(t).map((e=>P.fromPath(e))));case`database`:return this.documentOverlayCache.getAllOverlays(e,n);default:throw new j(`invalid-argument`,`Failed to get overlays for pipeline: ${$l(t)}`)}}},Tu=class{constructor(e){this.serializer=e,this.Hs=new Map,this.Js=new Map}getBundleMetadata(e,t){return z.resolve(this.Hs.get(t))}saveBundleMetadata(e,t){return this.Hs.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Ta(e.createTime)}}(t)),z.resolve()}getNamedQuery(e,t){return z.resolve(this.Js.get(t))}saveNamedQuery(e,t){return this.Js.set(t.name,function(e){return{name:e.name,query:du(e.bundledQuery),readTime:Ta(e.readTime)}}(t)),z.resolve()}},Eu=class{constructor(){this.overlays=new B(P.comparator),this.Ys=new Map}getOverlay(e,t){return z.resolve(this.overlays.get(t))}getOverlays(e,t){let n=Ki();return z.forEach(t,(t=>this.getOverlay(e,t).next((e=>{e!==null&&n.set(t,e)})))).next((()=>n))}getAllOverlays(e,t){let n=Ki();return this.overlays.forEach(((e,r)=>{r.largestBatchId>t&&n.set(e,r)})),z.resolve(n)}saveOverlays(e,t,n){return n.forEach(((n,r)=>{this.Hr(e,t,r)})),z.resolve()}removeOverlaysForBatchId(e,t,n){let r=this.Ys.get(n);return r!==void 0&&(r.forEach((e=>this.overlays=this.overlays.remove(e))),this.Ys.delete(n)),z.resolve()}getOverlaysForCollection(e,t,n){let r=Ki(),i=t.length+1,a=new P(t.child(``)),o=this.overlays.getIteratorFrom(a);for(;o.hasNext();){let e=o.getNext().value,a=e.getKey();if(!t.isPrefixOf(a.path))break;a.path.length===i&&e.largestBatchId>n&&r.set(e.getKey(),e)}return z.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let i=new B(((e,t)=>e-t)),a=this.overlays.getIterator();for(;a.hasNext();){let e=a.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);t===null&&(t=Ki(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let o=Ki(),s=i.getIterator();for(;s.hasNext()&&(s.getNext().value.forEach(((e,t)=>o.set(e,t))),!(o.size()>=r)););return z.resolve(o)}Hr(e,t,n){let r=this.overlays.get(n.key);if(r!==null){let e=this.Ys.get(r.largestBatchId).delete(n.key);this.Ys.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new cu(t,n));let i=this.Ys.get(t);i===void 0&&(i=J(),this.Ys.set(t,i)),this.Ys.set(t,i.add(n.key))}},Du=class{constructor(){this.sessionToken=U.EMPTY_BYTE_STRING}getSessionToken(e){return z.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,z.resolve()}},Ou=class{constructor(){this.Zs=new V(ku.Xs),this.e_=new V(ku.t_)}isEmpty(){return this.Zs.isEmpty()}addReference(e,t){let n=new ku(e,t);this.Zs=this.Zs.add(n),this.e_=this.e_.add(n)}n_(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.r_(new ku(e,t))}i_(e,t){e.forEach((e=>this.removeReference(e,t)))}s_(e){let t=new P(new N([])),n=new ku(t,e),r=new ku(t,e+1),i=[];return this.e_.forEachInRange([n,r],(e=>{this.r_(e),i.push(e.key)})),i}__(){this.Zs.forEach((e=>this.r_(e)))}r_(e){this.Zs=this.Zs.delete(e),this.e_=this.e_.delete(e)}o_(e){let t=new P(new N([])),n=new ku(t,e),r=new ku(t,e+1),i=J();return this.e_.forEachInRange([n,r],(e=>{i=i.add(e.key)})),i}containsKey(e){let t=new ku(e,0),n=this.Zs.firstAfterOrEqual(t);return n!==null&&e.isEqual(n.key)}},ku=class{constructor(e,t){this.key=e,this.a_=t}static Xs(e,t){return P.comparator(e.key,t.key)||M(e.a_,t.a_)}static t_(e,t){return M(e.a_,t.a_)||P.comparator(e.key,t.key)}},Au=class{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.gs=1,this.u_=new V(ku.Xs)}checkEmpty(e){return z.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,n,r){let i=this.gs;this.gs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let a=new ou(i,t,n,r);this.mutationQueue.push(a);for(let t of r)this.u_=this.u_.add(new ku(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return z.resolve(a)}lookupMutationBatch(e,t){return z.resolve(this.c_(t))}getNextMutationBatchAfterBatchId(e,t){let n=t+1,r=this.l_(n),i=r<0?0:r;return z.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return z.resolve(this.mutationQueue.length===0?rn:this.gs-1)}getAllMutationBatches(e){return z.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new ku(t,0),r=new ku(t,1/0),i=[];return this.u_.forEachInRange([n,r],(e=>{let t=this.c_(e.a_);i.push(t)})),z.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new V(M);return t.forEach((e=>{let t=new ku(e,0),r=new ku(e,1/0);this.u_.forEachInRange([t,r],(e=>{n=n.add(e.a_)}))})),z.resolve(this.E_(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,r=n.length+1,i=n;P.isDocumentKey(i)||(i=i.child(``));let a=new ku(new P(i),0),o=new V(M);return this.u_.forEachWhile((e=>{let t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e.a_)),!0)}),a),z.resolve(this.E_(o))}E_(e){let t=[];return e.forEach((e=>{let n=this.c_(e);n!==null&&t.push(n)})),t}removeMutationBatch(e,t){O(this.h_(t.batchId,`removed`)===0,55003),this.mutationQueue.shift();let n=this.u_;return z.forEach(t.mutations,(r=>{let i=new ku(r.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)})).next((()=>{this.u_=n}))}bs(e){}containsKey(e,t){let n=new ku(t,0),r=this.u_.firstAfterOrEqual(n);return z.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,z.resolve()}h_(e,t){return this.l_(e)}l_(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}c_(e){let t=this.l_(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}},ju=class{constructor(e){this.T_=e,this.docs=function(){return new B(P.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,r=this.docs.get(n),i=r?r.size:0,a=this.T_(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){let t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){let n=this.docs.get(t);return z.resolve(n?n.document.mutableCopy():hi.newInvalidDocument(t))}getEntries(e,t){let n=Hi();return t.forEach((e=>{let t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():hi.newInvalidDocument(e))})),z.resolve(n)}getAllEntries(e){let t=Hi();return this.docs.forEach(((e,n)=>{t=t.insert(e,n.document)})),z.resolve(t)}getDocumentsMatchingQuery(e,t,n,r){let i,a;$(t)?(i=N.fromString(lc(t)),a=e=>_u(t,e)):(i=t.path,a=e=>Pi(t,e));let o=Hi(),s=new P(i.child(`__id-9223372036854775808__`)),c=this.docs.getIteratorFrom(s);for(;c.hasNext();){let{key:e,value:{document:t}}=c.getNext();if(!i.isPrefixOf(e.path))break;e.path.length>i.length+1||Xt(Jt(t),n)<=0||(r.has(t.key)||a(t))&&(o=o.insert(t.key,t.mutableCopy()))}return z.resolve(o)}getAllFromCollectionGroup(e,t,n,r){D(9500)}P_(e,t){return z.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new Mu(this)}getSize(e){return z.resolve(this.size)}},Mu=class extends Su{constructor(e){super(),this.zs=e}applyChanges(e){let t=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?t.push(this.zs.addEntry(e,r)):this.zs.removeEntry(n)})),z.waitFor(t)}getFromCache(e,t){return this.zs.getEntry(e,t)}getAllFromCache(e,t){return this.zs.getEntries(e,t)}},Nu=class{constructor(e){this.persistence=e,this.R_=new Bi((e=>iu(e)),au),this.lastRemoteSnapshotVersion=R.min(),this.highestTargetId=0,this.I_=0,this.A_=new Ou,this.targetCount=0,this.V_=hu.xs()}forEachTarget(e,t){return this.R_.forEach(((e,n)=>t(n))),z.resolve()}getLastRemoteSnapshotVersion(e){return z.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return z.resolve(this.I_)}allocateTargetId(e){return this.highestTargetId=this.V_.next(),z.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.I_&&(this.I_=t),z.resolve()}Ms(e){this.R_.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.V_=new hu(t),this.highestTargetId=t),e.sequenceNumber>this.I_&&(this.I_=e.sequenceNumber)}addTargetData(e,t){return this.Ms(t),this.targetCount+=1,z.resolve()}updateTargetData(e,t){return this.Ms(t),z.resolve()}removeTargetData(e,t){return this.R_.delete(t.target),this.A_.s_(t.targetId),--this.targetCount,z.resolve()}removeTargets(e,t,n){let r=0,i=[];return this.R_.forEach(((a,o)=>{o.sequenceNumber<=t&&n.get(o.targetId)===null&&(this.R_.delete(a),i.push(this.removeMatchingKeysForTargetId(e,o.targetId)),r++)})),z.waitFor(i).next((()=>r))}getTargetCount(e){return z.resolve(this.targetCount)}getTargetData(e,t){let n=this.R_.get(t)||null;return z.resolve(n)}addMatchingKeys(e,t,n){return this.A_.n_(t,n),z.resolve()}removeMatchingKeys(e,t,n){this.A_.i_(t,n);let r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((t=>{i.push(r.markPotentiallyOrphaned(e,t))})),z.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.A_.s_(t),z.resolve()}getMatchingKeysForTargetId(e,t){let n=this.A_.o_(t);return z.resolve(n)}containsKey(e,t){return z.resolve(this.A_.containsKey(t))}},Pu=class{constructor(e,t){this.d_={},this.overlays={},this.f_=new nn(0),this.m_=!1,this.m_=!0,this.p_=new Du,this.referenceDelegate=e(this),this.g_=new Nu(this),this.indexManager=new pu,this.remoteDocumentCache=function(e){return new ju(e)}((e=>this.referenceDelegate.y_(e))),this.serializer=new uu(t),this.w_=new Tu(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.m_=!1,Promise.resolve()}get started(){return this.m_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Eu,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.d_[e.toKey()];return n||(n=new Au(t,this.referenceDelegate),this.d_[e.toKey()]=n),n}getGlobalsCache(){return this.p_}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.w_}runTransaction(e,t,n){E(`MemoryPersistence`,`Starting transaction:`,e);let r=new Fu(this.f_.next());return this.referenceDelegate.b_(),n(r).next((e=>this.referenceDelegate.v_(r).next((()=>e)))).toPromise().then((e=>(r.raiseOnCommittedEvent(),e)))}S_(e,t){return z.or(Object.values(this.d_).map((n=>()=>n.containsKey(e,t))))}},Fu=class extends Qt{constructor(e){super(),this.currentSequenceNumber=e}},Iu=class e{constructor(e){this.persistence=e,this.D_=new Ou,this.x_=null}static C_(t){return new e(t)}get F_(){if(this.x_)return this.x_;throw D(60996)}addReference(e,t,n){return this.D_.addReference(n,t),this.F_.delete(n.toString()),z.resolve()}removeReference(e,t,n){return this.D_.removeReference(n,t),this.F_.add(n.toString()),z.resolve()}markPotentiallyOrphaned(e,t){return this.F_.add(t.toString()),z.resolve()}removeTarget(e,t){this.D_.s_(t.targetId).forEach((e=>this.F_.add(e.toString())));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.F_.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}b_(){this.x_=new Set}v_(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return z.forEach(this.F_,(n=>{let r=P.fromPath(n);return this.O_(e,r).next((e=>{e||t.removeEntry(r,R.min())}))})).next((()=>(this.x_=null,t.apply(e))))}updateLimboDocument(e,t){return this.O_(e,t).next((e=>{e?this.F_.delete(t.toString()):this.F_.add(t.toString())}))}y_(e){return 0}O_(e,t){return z.or([()=>z.resolve(this.D_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.S_(e,t)])}},Lu=class e{constructor(e,t){this.persistence=e,this.M_=new Bi((e=>un(e.path)),((e,t)=>e.isEqual(t))),this.garbageCollector=Uo(this,t)}static C_(t,n){return new e(t,n)}b_(){}v_(e){return z.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}lr(e){let t=this.Ls(e);return this.persistence.getTargetCache().getTargetCount(e).next((e=>t.next((t=>e+t))))}Ls(e){let t=0;return this.Er(e,(e=>{t++})).next((()=>t))}Er(e,t){return z.forEach(this.M_,((n,r)=>this.Us(e,n,r).next((e=>e?z.resolve():t(r)))))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0,r=this.persistence.getRemoteDocumentCache(),i=r.newChangeBuffer();return r.P_(e,(r=>this.Us(e,r,t).next((e=>{e||(n++,i.removeEntry(r,R.min()))})))).next((()=>i.apply(e))).next((()=>n))}markPotentiallyOrphaned(e,t){return this.M_.set(t,e.currentSequenceNumber),z.resolve()}removeTarget(e,t){let n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),z.resolve()}removeReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),z.resolve()}updateLimboDocument(e,t){return this.M_.set(t,e.currentSequenceNumber),z.resolve()}y_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=Xn(e.data.value)),t}Us(e,t,n){return z.or([()=>this.persistence.S_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let e=this.M_.get(t);return z.resolve(e!==void 0&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}},Ru=class e{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.wo=n,this.bo=r}static vo(t,n){let r=J(),i=J();for(let e of n.docChanges)switch(e.type){case 0:r=r.add(e.doc.key);break;case 1:i=i.add(e.doc.key)}return new e(t,n.fromCache,r,i)}};function zu(e,t){return P.comparator(e.key,t.key)}var Bu=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}},Vu=class{constructor(){this.So=!1,this.Do=!1,this.xo=100,this.Co=function(){return a()?8:en(t())>0?6:4}()}initialize(e,t){this.Fo=e,this.indexManager=t,this.So=!0}getDocumentsMatchingQuery(e,t,n,r){let i={result:null};return this.Oo(e,t).next((e=>{i.result=e})).next((()=>{if(!i.result)return this.Mo(e,t,r,n).next((e=>{i.result=e}))})).next((()=>{if(i.result)return;let n=new Bu;return this.No(e,t,n).next((r=>{if(i.result=r,this.Do)return this.Lo(e,t,n,r.size)}))})).next((()=>i.result))}Lo(e,t,n,r){return $(t)?z.resolve():n.documentReadCount<this.xo?(ft()<=c.DEBUG&&E(`QueryEngine`,`SDK will not create cache indexes for query:`,Ni(t),`since it only creates cache indexes for collection contains`,`more than or equal to`,this.xo,`documents`),z.resolve()):(ft()<=c.DEBUG&&E(`QueryEngine`,`Query:`,Ni(t),`scans`,n.documentReadCount,`local documents and returns`,r,`documents as results.`),n.documentReadCount>this.Co*r?(ft()<=c.DEBUG&&E(`QueryEngine`,`The SDK decides to create cache indexes for query:`,Ni(t),`as using cache indexes may help improve performance.`),this.indexManager.createTargetIndexes(e,ki(t))):z.resolve())}Oo(e,t){if($(t))return z.resolve(null);let n=t;if(Ti(n))return z.resolve(null);let r=ki(n);return this.indexManager.getIndexType(e,r).next((t=>t===0?null:(n.limit!==null&&t===1&&(n=ji(n,null,`F`),r=ki(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next((t=>{let i=J(...t);return this.Fo.getDocuments(e,i).next((t=>this.indexManager.getMinOffset(e,r).next((r=>{let a=this.Bo(n,t);return this.Uo(n,a,i,r.readTime)?this.Oo(e,ji(n,null,`F`)):this.ko(e,a,n,r)}))))})))))}Mo(e,t,n,r){return($(t)?function(e){for(let t of e.stages){if(t instanceof tc||t instanceof nc)return!1;if(t instanceof ec){if(t.condition instanceof Rs&&t.condition._expr.name===`exists`&&t.condition._expr.params[0]instanceof js&&t.condition._expr.params[0].fieldName===Nt)continue;return!1}}return!0}(t):Ti(t))||r.isEqual(R.min())?z.resolve(null):this.Fo.getDocuments(e,n).next((i=>{let a=this.Bo(t,i);return this.Uo(t,a,n,r)?z.resolve(null):(ft()<=c.DEBUG&&E(`QueryEngine`,`Re-using previous result from %s to execute query: %s`,r.toString(),tu(t)),this.ko(e,a,t,qt(r,Gt)).next((e=>e)))}))}Bo(e,t){let n,r;return $(e)?(n=new V(zu),r=t=>_u(e,t)):(n=new V(Fi(e)),r=t=>Pi(e,t)),t.forEach(((e,t)=>{r(t)&&(n=n.add(t))})),n}Uo(e,t,n,r){if($(e))return function(e){return e.stages.some((e=>e instanceof tc||e instanceof nc))}(e);if(e.limit===null)return!1;if(n.size!==t.size)return!0;let i=e.limitType===`F`?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}No(e,t,n){return ft()<=c.DEBUG&&E(`QueryEngine`,`Using full collection scan to execute query:`,tu(t)),this.Fo.getDocumentsMatchingQuery(e,t,Yt.min(),n)}ko(e,t,n,r){return this.Fo.getDocumentsMatchingQuery(e,n,r).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}},Hu=`LocalStore`,Uu=3e8,Wu=class{constructor(e,t,n,r){this.persistence=e,this.qo=t,this.serializer=r,this.$o=new B(M),this.Ko=new Bi((e=>iu(e)),au),this.Wo=new Map,this.Qo=e.getRemoteDocumentCache(),this.g_=e.getTargetCache(),this.w_=e.getBundleCache(),this.Go(n)}Go(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new wu(this.Qo,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Qo.setIndexManager(this.indexManager),this.qo.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction(`Collect garbage`,`readwrite-primary`,(t=>e.collect(t,this.$o)))}};function Gu(e,t,n,r){return new Wu(e,t,n,r)}async function Ku(e,t){let n=k(e);return await n.persistence.runTransaction(`Handle user change`,`readonly`,(e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next((i=>(r=i,n.Go(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{let i=[],a=[],o=J();for(let e of r){i.push(e.batchId);for(let t of e.mutations)o=o.add(t.key)}for(let e of t){a.push(e.batchId);for(let t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next((e=>({zo:e,removedBatchIds:i,addedBatchIds:a})))}))}))}function qu(e,t){let n=k(e);return n.persistence.runTransaction(`Acknowledge batch`,`readwrite-primary`,(e=>{let r=t.batch.keys(),i=n.Qo.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){let i=n.batch,a=i.keys(),o=z.resolve();return a.forEach((e=>{o=o.next((()=>r.getEntry(t,e))).next((t=>{let a=n.docVersions.get(e);O(a!==null,48541),t.version.compareTo(a)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))}))})),o.next((()=>e.mutationQueue.removeMutationBatch(t,i)))}(n,e,t,i).next((()=>i.apply(e))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=J();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t)))).next((()=>n.localDocuments.getDocuments(e,r)))}))}function Ju(e){let t=k(e);return t.persistence.runTransaction(`Get last remote snapshot version`,`readonly`,(e=>t.g_.getLastRemoteSnapshotVersion(e)))}function Yu(e,t){let n=k(e),r=t.snapshotVersion,i=n.$o;return n.persistence.runTransaction(`Apply remote event`,`readwrite-primary`,(e=>{let a=n.Qo.newChangeBuffer({trackRemovals:!0});i=n.$o;let o=[];t.targetChanges.forEach(((a,s)=>{let c=i.get(s);if(!c)return;o.push(n.g_.removeMatchingKeys(e,a.removedDocuments,s).next((()=>n.g_.addMatchingKeys(e,a.addedDocuments,s))));let l=c.withSequenceNumber(e.currentSequenceNumber);t.targetMismatches.get(s)===null?a.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(a.resumeToken,r)):l=l.withResumeToken(U.EMPTY_BYTE_STRING,R.min()).withLastLimboFreeSnapshotVersion(R.min()),i=i.insert(s,l),function(e,t,n){return e.resumeToken.approximateByteSize()===0||t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=Uu?!0:n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(c,l,a)&&o.push(n.g_.updateTargetData(e,l))}));let s=Hi(),c=J();if(t.documentUpdates.forEach((r=>{t.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))})),o.push(Xu(e,a,t.documentUpdates).next((e=>{s=e.jo,c=e.Ho}))),!r.isEqual(R.min())){let t=n.g_.getLastRemoteSnapshotVersion(e).next((t=>n.g_.setTargetsMetadata(e,e.currentSequenceNumber,r)));o.push(t)}return z.waitFor(o).next((()=>a.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,s,c))).next((()=>s))})).then((e=>(n.$o=i,e)))}function Xu(e,t,n){let r=J(),i=J();return n.forEach((e=>r=r.add(e))),t.getEntries(e,r).next((e=>{let r=Hi();return n.forEach(((n,a)=>{let o=e.get(n);a.isFoundDocument()!==o.isFoundDocument()&&(i=i.add(n)),a.isNoDocument()&&a.version.isEqual(R.min())?(t.removeEntry(n,a.readTime),r=r.insert(n,a)):!o.isValidDocument()||a.version.compareTo(o.version)>0||a.version.compareTo(o.version)===0&&o.hasPendingWrites?(t.addEntry(a),r=r.insert(n,a)):E(Hu,`Ignoring outdated watch update for `,n,`. Current version:`,o.version,` Watch version:`,a.version)})),{jo:r,Ho:i}}))}function Zu(e,t){let n=k(e);return n.persistence.runTransaction(`Get next mutation batch`,`readonly`,(e=>(t===void 0&&(t=rn),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t))))}function Qu(e,t){let n=k(e);return n.persistence.runTransaction(`Allocate target`,`readwrite`,(e=>{let r;return n.g_.getTargetData(e,t).next((i=>i?(r=i,z.resolve(r)):n.g_.allocateTargetId(e).next((i=>(r=new lu(t,i,`TargetPurposeListen`,e.currentSequenceNumber),n.g_.addTargetData(e,r).next((()=>r)))))))})).then((e=>{let r=n.$o.get(e.targetId);return(r===null||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.$o=n.$o.insert(e.targetId,e),n.Ko.set(t,e.targetId)),e}))}async function $u(e,t,n){let r=k(e),i=r.$o.get(t),a=n?`readwrite`:`readwrite-primary`;try{n||await r.persistence.runTransaction(`Release target`,a,(e=>r.persistence.referenceDelegate.removeTarget(e,i)))}catch(e){if(!tn(e))throw e;E(Hu,`Failed to update sequence numbers for target ${t}: ${e}`)}r.$o=r.$o.remove(t),r.Ko.delete(i.target)}function ed(e,t,n){let r=k(e),i=R.min(),a=J();return r.persistence.runTransaction(`Execute query`,`readwrite`,(e=>function(e,t,n){let r=k(e),i=r.Ko.get(n);return i===void 0?r.g_.getTargetData(t,n):z.resolve(r.$o.get(i))}(r,e,$(t)?t:ki(t)).next((t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,r.g_.getMatchingKeysForTargetId(e,t.targetId).next((e=>{a=e}))})).next((()=>r.qo.getDocumentsMatchingQuery(e,t,n?i:R.min(),n?a:J()))).next((e=>(td(r,e),{documents:e,Jo:a})))))}function td(e,t){t.forEach(((t,n)=>{let r=n.key.getCollectionGroup(),i=e.Wo.get(r)||R.min();n.readTime.compareTo(i)>0&&e.Wo.set(r,n.readTime)}))}var nd=class{constructor(){this.activeTargetIds=Qi()}na(e){this.activeTargetIds=this.activeTargetIds.add(e)}ra(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ta(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}},rd=class{constructor(){this.Ua=new nd,this.ka={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Ua.na(e),this.ka[e]||`not-current`}updateQueryState(e,t,n){this.ka[e]=t}removeLocalQueryTarget(e){this.Ua.ra(e)}isLocalQueryTarget(e){return this.Ua.activeTargetIds.has(e)}clearQueryState(e){delete this.ka[e]}getAllActiveQueryTargets(){return this.Ua.activeTargetIds}isActiveQueryTarget(e){return this.Ua.activeTargetIds.has(e)}start(){return this.Ua=new nd,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};function id(){return typeof document<`u`?document:null}var ad=class{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state=`Unknown`,this.qa=0,this.$a=null,this.Ka=!0}Wa(){this.qa===0&&(this.Qa(`Unknown`),this.$a=this.asyncQueue.enqueueAfterDelay(`online_state_timeout`,1e4,(()=>(this.$a=null,this.Ga(`Backend didn't respond within 10 seconds.`),this.Qa(`Offline`),Promise.resolve()))))}za(e){this.state===`Online`?this.Qa(`Unknown`):(this.qa++,this.qa>=1&&(this.ja(),this.Ga(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.Qa(`Offline`)))}set(e){this.ja(),this.qa=0,e===`Online`&&(this.Ka=!1),this.Qa(e)}Qa(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}Ga(e){let t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Ka?(pt(t),this.Ka=!1):E(`OnlineStateTracker`,t)}ja(){this.$a!==null&&(this.$a.cancel(),this.$a=null)}},od=`RemoteStore`,sd=class{constructor(e,t,n,r,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Ha=[],this.Ja=new Map,this.Ya=new Map,this.Za=new Map,this.Xa=new hu(1e3),this.eu=new hu(1001),this.tu=new Set,this.nu=[],this.ru=i,this.ru.bt((e=>{n.enqueueAndForget((async()=>{_d(this)&&(E(od,`Restarting streams for network reachability change.`),await async function(e){let t=k(e);t.tu.add(4),await ld(t),t.iu.set(`Unknown`),t.tu.delete(4),await cd(t)}(this))}))})),this.iu=new ad(n,r)}};async function cd(e){if(_d(e))for(let t of e.nu)await t(!0)}async function ld(e){for(let t of e.nu)await t(!1)}function ud(e,t){return e.Ya.get(t)||void 0}function dd(e,t){let n=k(e),r=ud(n,t.targetId);if(r!==void 0&&n.Ja.has(r))return;let i=function(e,t){let n=ud(e,t);n!==void 0&&e.Za.delete(n);let r=function(e,t){return t%2==0?e.Xa.next():e.eu.next()}(e,t);return e.Ya.set(t,r),e.Za.set(r,t),r}(n,t.targetId);E(od,`remoteStoreListen mapping SDK target ID to remote`,t.targetId,i);let a=new lu(t.target,i,t.purpose,t.sequenceNumber,t.snapshotVersion,t.lastLimboFreeSnapshotVersion,t.resumeToken);n.Ja.set(i,a),gd(n)?hd(n):Id(n).Fn()&&pd(n,a)}function fd(e,t){let n=k(e),r=Id(n),i=ud(n,t);E(od,`remoteStoreUnlisten removing mapping of SDK target ID to remote`,t,i),n.Ja.delete(i),n.Ya.delete(t),n.Za.delete(i),r.Fn()&&md(n,i),n.Ja.size===0&&(r.Fn()?r.Nn():_d(n)&&n.iu.set(`Unknown`))}function pd(e,t){if(e.su.We(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(R.min())>0){let n=e.Za.get(t.targetId);if(n===void 0)return void E(od,`SDK target ID not found for remote ID: `+t.targetId);let r=e.remoteSyncer.getRemoteKeysForTarget(n).size;t=t.withExpectedCount(r)}Id(e).jn(t)}function md(e,t){e.su.We(t),Id(e).Hn(t)}function hd(e){e.su=new pa({getRemoteKeysForTarget:t=>{let n=e.Za.get(t);return n===void 0?J():e.remoteSyncer.getRemoteKeysForTarget(n)},dt:t=>e.Ja.get(t)||null,Tt:()=>e.datastore.serializer.databaseId}),Id(e).start(),e.iu.Wa()}function gd(e){return _d(e)&&!Id(e).Cn()&&e.Ja.size>0}function _d(e){return k(e).tu.size===0}function vd(e){e.su=void 0}async function yd(e){e.iu.set(`Online`)}async function bd(e){e.Ja.forEach(((t,n)=>{pd(e,t)}))}async function xd(e,t){vd(e),gd(e)?(e.iu.za(t),hd(e)):e.iu.set(`Unknown`)}async function Sd(e,t,n){if(e.iu.set(`Online`),t instanceof ua&&t.state===2&&t.cause)try{await async function(e,t){let n=t.cause;for(let r of t.targetIds){if(e.Ja.has(r)){let t=e.Za.get(r);t!==void 0&&(await e.remoteSyncer.rejectListen(t,n),e.Ya.delete(t),e.Za.delete(r)),e.Ja.delete(r)}e.su.removeTarget(r)}}(e,t)}catch(n){E(od,`Failed to remove targets %s: %s `,t.targetIds.join(`,`),n),await Cd(e,n)}else if(t instanceof ca?e.su.et(t):t instanceof la?e.su.ot(t):e.su.rt(t),!n.isEqual(R.min()))try{let t=await Ju(e.localStore);n.compareTo(t)>=0&&await function(e,t){let n=e.su.Rt(t);n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){let i=e.Ja.get(r);i&&e.Ja.set(r,i.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{let r=e.Ja.get(t);r&&(e.Ja.set(t,r.withResumeToken(U.EMPTY_BYTE_STRING,r.snapshotVersion)),md(e,t),pd(e,new lu(r.target,t,n,r.sequenceNumber)))}));let r=function(e,t){let n=new Map;t.targetChanges.forEach(((t,r)=>{let i=e.Za.get(r);i!==void 0&&n.set(i,t)}));let r=new B(M);return t.targetMismatches.forEach(((t,n)=>{let i=e.Za.get(t);i!==void 0&&(r=r.insert(i,n))})),new oa(t.snapshotVersion,n,r,t.documentUpdates,t.augmentedDocumentUpdates,t.resolvedLimboDocuments)}(e,n);return e.remoteSyncer.applyRemoteEvent(r)}(e,n)}catch(t){E(od,`Failed to raise snapshot:`,t),await Cd(e,t)}}async function Cd(e,t,n){if(!tn(t))throw t;e.tu.add(1),await ld(e),e.iu.set(`Offline`),n||=()=>Ju(e.localStore),e.asyncQueue.enqueueRetryable((async()=>{E(od,`Retrying IndexedDB access`),await n(),e.tu.delete(1),await cd(e)}))}function wd(e,t){return t().catch((n=>Cd(e,n,t)))}async function Td(e){let t=k(e),n=Ld(t),r=t.Ha.length>0?t.Ha[t.Ha.length-1].batchId:rn;for(;Ed(t);)try{let e=await Zu(t.localStore,r);if(e===null){t.Ha.length===0&&n.Nn();break}r=e.batchId,Dd(t,e)}catch(e){await Cd(t,e)}Od(t)&&kd(t)}function Ed(e){return _d(e)&&e.Ha.length<10}function Dd(e,t){e.Ha.push(t);let n=Ld(e);n.Fn()&&n.Jn&&n.Yn(t.mutations)}function Od(e){return _d(e)&&!Ld(e).Cn()&&e.Ha.length>0}function kd(e){Ld(e).start()}async function Ad(e){Ld(e).er()}async function jd(e){let t=Ld(e);for(let n of e.Ha)t.Yn(n.mutations)}async function Md(e,t,n){let r=e.Ha.shift(),i=su.from(r,t,n);await wd(e,(()=>e.remoteSyncer.applySuccessfulWrite(i))),await Td(e)}async function Nd(e,t){t&&Ld(e).Jn&&await async function(e,t){if(function(e){return Ri(e)&&e!==A.ABORTED}(t.code)){let n=e.Ha.shift();Ld(e).Mn(),await wd(e,(()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t))),await Td(e)}}(e,t),Od(e)&&kd(e)}async function Pd(e,t){let n=k(e);n.asyncQueue.verifyOperationInProgress(),E(od,`RemoteStore received new credentials`);let r=_d(n);n.tu.add(3),await ld(n),r&&n.iu.set(`Unknown`),await n.remoteSyncer.handleCredentialChange(t),n.tu.delete(3),await cd(n)}async function Fd(e,t){let n=k(e);t?(n.tu.delete(2),await cd(n)):t||(n.tu.add(2),await ld(n),n.iu.set(`Unknown`))}function Id(e){return e._u||(e._u=function(e,t,n){let r=k(e);return r.nr(),new Eo(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Qt:yd.bind(null,e),zt:bd.bind(null,e),Ht:xd.bind(null,e),zn:Sd.bind(null,e)}),e.nu.push((async t=>{t?(e._u.Mn(),gd(e)?hd(e):e.iu.set(`Unknown`)):(await e._u.stop(),vd(e))}))),e._u}function Ld(e){return e.ou||(e.ou=function(e,t,n){let r=k(e);return r.nr(),new Do(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Qt:()=>Promise.resolve(),zt:Ad.bind(null,e),Ht:Nd.bind(null,e),Zn:jd.bind(null,e),Xn:Md.bind(null,e)}),e.nu.push((async t=>{t?(e.ou.Mn(),await Td(e)):(await e.ou.stop(),e.Ha.length>0&&(E(od,`Stopping write stream with ${e.Ha.length} pending writes`),e.Ha=[]))}))),e.ou}var Rd=class e{constructor(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new _t,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(t,n,r,i,a){let o=Date.now()+r,s=new e(t,n,o,i,a);return s.start(r),s}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new j(A.CANCELLED,`Operation cancelled`+(e?`: `+e:``))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle===null?Promise.resolve():(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e))))))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function zd(e,t){if(pt(`AsyncQueue`,`${t}: ${e}`),tn(e))return new j(A.UNAVAILABLE,`${t}: ${e}`);throw e}var Bd=class e{static emptySet(t){return new e(t.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||P.comparator(t.key,n.key):(e,t)=>P.comparator(e.key,t.key),this.keyedMap=Wi(),this.sortedSet=new B(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,n)=>(e(t),!1)))}add(e){let t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){let t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(t){if(!(t instanceof e)||this.size!==t.size)return!1;let n=this.sortedSet.getIterator(),r=t.sortedSet.getIterator();for(;n.hasNext();){let e=n.getNext().key,t=r.getNext().key;if(!e.isEqual(t))return!1}return!0}toString(){let e=[];return this.forEach((t=>{e.push(t.toString())})),e.length===0?`DocumentSet ()`:`DocumentSet (
|
|
30
|
+
`+e.join(`
|
|
31
|
+
`)+`
|
|
32
|
+
)`}copy(t,n){let r=new e;return r.comparator=this.comparator,r.keyedMap=t,r.sortedSet=n,r}},Vd=class{constructor(){this.au=new B(P.comparator)}track(e){let t=e.doc.key,n=this.au.get(t);n?e.type!==0&&n.type===3?this.au=this.au.insert(t,e):e.type===3&&n.type!==1?this.au=this.au.insert(t,{type:n.type,doc:e.doc}):e.type===2&&n.type===2?this.au=this.au.insert(t,{type:2,doc:e.doc}):e.type===2&&n.type===0?this.au=this.au.insert(t,{type:0,doc:e.doc}):e.type===1&&n.type===0?this.au=this.au.remove(t):e.type===1&&n.type===2?this.au=this.au.insert(t,{type:1,doc:n.doc}):e.type===0&&n.type===1?this.au=this.au.insert(t,{type:2,doc:e.doc}):D(63341,{ft:e,uu:n}):this.au=this.au.insert(t,e)}cu(){let e=[];return this.au.inorderTraversal(((t,n)=>{e.push(n)})),e}},Hd=class e{constructor(e,t,n,r,i,a,o,s,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=o,this.excludesMetadataChanges=s,this.hasCachedResults=c}static fromInitialDocuments(t,n,r,i,a){let o=[];return n.forEach((e=>{o.push({type:0,doc:e})})),new e(t,n,Bd.emptySet(n),o,r,i,!0,!1,a)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&ru(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}},Ud=class{constructor(){this.lu=void 0,this.Eu=[]}hu(){return this.Eu.some((e=>e.Tu()))}},Wd=class{constructor(){this.queries=Gd(),this.onlineState=`Unknown`,this.Pu=new Set}terminate(){(function(e,t){let n=k(e),r=n.queries;n.queries=Gd(),r.forEach(((e,n)=>{for(let e of n.Eu)e.onError(t)}))})(this,new j(A.ABORTED,`Firestore shutting down`))}};function Gd(){return new Bi((e=>nu(e)),ru)}async function Kd(e,t){let n=k(e),r=3,i=t.query,a=n.queries.get(i);a?!a.hu()&&t.Tu()&&(r=2):(a=new Ud,r=+!t.Tu());try{switch(r){case 0:a.lu=await n.onListen(i,!0);break;case 1:a.lu=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(e){let n=zd(e,`Initialization of query '${$(t.query)?$l(t.query):Ni(t.query)}' failed`);t.onError(n);return}n.queries.set(i,a),a.Eu.push(t),t.Ru(n.onlineState),a.lu&&t.Iu(a.lu)&&Xd(n)}async function qd(e,t){let n=k(e),r=t.query,i=3,a=n.queries.get(r);if(a){let e=a.Eu.indexOf(t);e>=0&&(a.Eu.splice(e,1),a.Eu.length===0?i=+!t.Tu():!a.hu()&&t.Tu()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function Jd(e,t){let n=k(e),r=!1;for(let e of t){let t=e.query,i=n.queries.get(t);if(i){for(let t of i.Eu)t.Iu(e)&&(r=!0);i.lu=e}}r&&Xd(n)}function Yd(e,t,n){let r=k(e),i=r.queries.get(t);if(i)for(let e of i.Eu)e.onError(n);r.queries.delete(t)}function Xd(e){e.Pu.forEach((e=>{e.next()}))}var Zd;(function(e){e.Default=`default`,e.Cache=`cache`})(Zd||={});var Qd=class{constructor(e,t,n){this.query=e,this.Au=t,this.Vu=!1,this.du=null,this.onlineState=`Unknown`,this.options=n||{}}Iu(e){if(!this.options.includeMetadataChanges){let t=[];for(let n of e.docChanges)n.type!==3&&t.push(n);e=new Hd(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Vu?this.fu(e)&&(this.Au.next(e),t=!0):this.mu(e,this.onlineState)&&(this.pu(e),t=!0),this.du=e,t}onError(e){this.Au.error(e)}Ru(e){this.onlineState=e;let t=!1;return this.du&&!this.Vu&&this.mu(this.du,e)&&(this.pu(this.du),t=!0),t}mu(e,t){if(!e.fromCache||!this.Tu())return!0;let n=t!==`Offline`;return(!this.options.waitForSyncWhenOnline||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||t===`Offline`)}fu(e){if(e.docChanges.length>0)return!0;let t=this.du&&this.du.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}pu(e){e=Hd.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Vu=!0,this.Au.next(e)}Tu(){return this.options.source!==Zd.Cache}},$d=class{constructor(e){this.key=e}},ef=class{constructor(e){this.key=e}},tf=class{constructor(e,t){this.query=e,this.Ou=t,this.Mu=null,this.hasCachedResults=!1,this.current=!1,this.Nu=J(),this.mutatedKeys=J(),this.Lu=$(e)?bu(e):Fi(e),this.Bu=new Bd(this.Lu)}get Uu(){return this.Ou}ku(e,t){let n=t?t.qu:new Vd,r=t?t.Bu:this.Bu,i=t?t.mutatedKeys:this.mutatedKeys,a=r,o=!1,[s,c]=this.$u(this.query,r);e.inorderTraversal(((e,t)=>{let l=r.get(e),u=vu(this.query,t)?t:null,d=!!l&&this.mutatedKeys.has(l.key),f=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations),p=!1;l&&u?l.data.isEqual(u.data)?d!==f&&(n.track({type:3,doc:u}),p=!0):this.Ku(l,u)||(n.track({type:2,doc:u}),p=!0,(s&&this.Lu(u,s)>0||c&&this.Lu(u,c)<0)&&(o=!0)):!l&&u?(n.track({type:0,doc:u}),p=!0):l&&!u&&(n.track({type:1,doc:l}),p=!0,(s||c)&&(o=!0)),p&&(u?(a=a.add(u),i=f?i.add(e):i.delete(e)):(a=a.delete(e),i=i.delete(e)))}));let l=this.Wu(this.query);if(l)if($(this.query)){let e=[];a.forEach((t=>e.push(t)));let t=gu(this.query,e),r=new Bd(bu(this.query));for(let e of t)r=r.add(e);a.forEach((e=>{r.has(e.key)||(i=i.delete(e.key),n.track({type:1,doc:e}))})),a=r}else{let e=this.Qu(this.query);for(;a.size>l;){let t=e===`F`?a.last():a.first();a=a.delete(t.key),i=i.delete(t.key),n.track({type:1,doc:t})}}return{Bu:a,qu:n,Uo:o,mutatedKeys:i}}Wu(e){return $(e)?xu(e)?.limit:e.limit||void 0}Qu(e){if($(e)){let t=xu(e);return t&&t.limit<0?`L`:`F`}return e.limitType}$u(e,t){if($(e)){let n=xu(e)?.limit;return[t.size===n?t.last():null,null]}return[e.limitType===`F`&&t.size===this.Wu(this.query)?t.last():null,e.limitType===`L`&&t.size===this.Wu(this.query)?t.first():null]}Ku(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){let i=this.Bu;this.Bu=e.Bu,this.mutatedKeys=e.mutatedKeys;let a=e.qu.cu();a.sort(((e,t)=>function(e,t){let n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return D(20277,{ft:e})}};return n(e)-n(t)}(e.type,t.type)||this.Lu(e.doc,t.doc))),this.Gu(n),r??=!1;let o=t&&!r?this.zu():[],s=this.Nu.size===0&&this.current&&!r?1:0,c=s!==this.Mu;return this.Mu=s,a.length!==0||c?{snapshot:new Hd(this.query,e.Bu,i,a,e.mutatedKeys,s===0,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),ju:o}:{ju:o}}Ru(e){return this.current&&e===`Offline`?(this.current=!1,this.applyChanges({Bu:this.Bu,qu:new Vd,mutatedKeys:this.mutatedKeys,Uo:!1},!1)):{ju:[]}}Hu(e){return!this.Ou.has(e)&&!!this.Bu.has(e)&&!this.Bu.get(e).hasLocalMutations}Gu(e){e&&(e.addedDocuments.forEach((e=>this.Ou=this.Ou.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.Ou=this.Ou.delete(e))),this.current=e.current)}zu(){if(!this.current)return[];let e=this.Nu;this.Nu=J(),this.Bu.forEach((e=>{this.Hu(e.key)&&(this.Nu=this.Nu.add(e.key))}));let t=[];return e.forEach((e=>{this.Nu.has(e)||t.push(new ef(e))})),this.Nu.forEach((n=>{e.has(n)||t.push(new $d(n))})),t}Ju(e){this.Ou=e.Jo,this.Nu=J();let t=this.ku(e.documents);return this.applyChanges(t,!0)}Yu(){return Hd.fromInitialDocuments(this.query,this.Bu,this.mutatedKeys,this.Mu===0,this.hasCachedResults)}},nf=`SyncEngine`,rf=class{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}},af=class{constructor(e){this.key=e,this.Zu=!1}},of=class{constructor(e,t,n,r,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Xu={},this.ec=new Bi((e=>nu(e)),ru),this.tc=new Map,this.nc=new Set,this.rc=new B(P.comparator),this.sc=new Map,this._c=new Ou,this.oc={},this.ac=new Map,this.uc=hu.Cs(),this.onlineState=`Unknown`,this.cc=void 0}get isPrimaryClient(){return!0===this.cc}};async function sf(e,t,n=!0){let r=kf(e),i,a=r.ec.get(t);return a?(r.sharedClientState.addLocalQueryTarget(a.targetId),i=a.view.Yu()):i=await lf(r,t,n,!0),i}async function cf(e,t){await lf(kf(e),t,!0,!1)}async function lf(e,t,n,r){let i=await Qu(e.localStore,$(t)?t:ki(t)),a=i.targetId,o=e.sharedClientState.addLocalQueryTarget(a,n),s;return r&&(s=await uf(e,t,a,o===`current`,i.resumeToken)),e.isPrimaryClient&&n&&dd(e.remoteStore,i),s}async function uf(e,t,n,r,i){e.lc=(t,n,r)=>async function(e,t,n,r){let i=t.view.ku(n);i.Uo&&(i=await ed(e.localStore,t.query,!1).then((({documents:e})=>t.view.ku(e,i))));let a=r&&r.targetChanges.get(t.targetId),o=r&&r.targetMismatches.get(t.targetId)!=null,s=t.view.applyChanges(i,e.isPrimaryClient,a,o);return Cf(e,t.targetId,s.ju),s.snapshot}(e,t,n,r);let a=await ed(e.localStore,t,!0),o=new tf(t,a.Jo),s=o.ku(a.documents),c=sa.createSynthesizedTargetChangeForCurrentChange(n,r&&e.onlineState!==`Offline`,i),l=o.applyChanges(s,e.isPrimaryClient,c);Cf(e,n,l.ju);let u=new rf(t,n,o);return e.ec.set(t,u),e.tc.has(n)?e.tc.get(n).push(t):e.tc.set(n,[t]),l.snapshot}async function df(e,t,n){let r=k(e),i=r.ec.get(t),a=r.tc.get(i.targetId);if(a.length>1)return r.tc.set(i.targetId,a.filter((e=>!ru(e,t)))),void r.ec.delete(t);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedClientState.isActiveQueryTarget(i.targetId)||await $u(r.localStore,i.targetId,!1).then((()=>{r.sharedClientState.clearQueryState(i.targetId),n&&fd(r.remoteStore,i.targetId),xf(r,i.targetId)})).catch($t)):(xf(r,i.targetId),await $u(r.localStore,i.targetId,!0))}async function ff(e,t){let n=k(e),r=n.ec.get(t),i=n.tc.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),fd(n.remoteStore,r.targetId))}async function pf(e,t,n){let r=Af(e);try{let e=await function(e,t){let n=k(e),r=L.now(),i=t.reduce(((e,t)=>e.add(t.key)),J()),a,o;return n.persistence.runTransaction(`Locally write mutations`,`readwrite`,(e=>{let s=Hi(),c=J();return n.Qo.getEntries(e,i).next((e=>{s=e,s.forEach(((e,t)=>{t.isValidDocument()||(c=c.add(e))}))})).next((()=>n.localDocuments.getOverlayedDocuments(e,s))).next((i=>{a=i;let o=[];for(let e of t){let t=Rr(e,a.get(e.key).overlayedDocument);t!=null&&o.push(new Vr(e.key,t,lr(t.value.mapValue),Mr.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,o,t)})).next((t=>{o=t;let r=t.applyToLocalDocumentSet(a,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:Gi(a)})))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.oc[e.currentUser.toKey()];r||=new B(M),r=r.insert(t,n),e.oc[e.currentUser.toKey()]=r}(r,e.batchId,n),await Ef(r,e.changes),await Td(r.remoteStore)}catch(e){let t=zd(e,`Failed to persist write`);n.reject(t)}}async function mf(e,t){let n=k(e);try{let e=await Yu(n.localStore,t);t.targetChanges.forEach(((e,t)=>{let r=n.sc.get(t);r&&(O(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?r.Zu=!0:e.modifiedDocuments.size>0?O(r.Zu,14607):e.removedDocuments.size>0&&(O(r.Zu,42227),r.Zu=!1))})),await Ef(n,e,t)}catch(e){await $t(e)}}function hf(e,t,n){let r=k(e);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){let e=[];r.ec.forEach(((n,r)=>{let i=r.view.Ru(t);i.snapshot&&e.push(i.snapshot)})),function(e,t){let n=k(e);n.onlineState=t;let r=!1;n.queries.forEach(((e,n)=>{for(let e of n.Eu)e.Ru(t)&&(r=!0)})),r&&Xd(n)}(r.eventManager,t),e.length&&r.Xu.zn(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function gf(e,t,n){let r=k(e);r.sharedClientState.updateQueryState(t,`rejected`,n);let i=r.sc.get(t),a=i&&i.key;if(a){let e=new B(P.comparator);e=e.insert(a,hi.newNoDocument(a,R.min()));let n=J().add(a);await mf(r,new oa(R.min(),new Map,new B(M),e,Hi(),n)),r.rc=r.rc.remove(a),r.sc.delete(t),Tf(r)}else await $u(r.localStore,t,!1).then((()=>xf(r,t,n))).catch($t)}async function _f(e,t){let n=k(e),r=t.batch.batchId;try{let e=await qu(n.localStore,t);bf(n,r,null),yf(n,r),n.sharedClientState.updateMutationState(r,`acknowledged`),await Ef(n,e)}catch(e){await $t(e)}}async function vf(e,t,n){let r=k(e);try{let e=await function(e,t){let n=k(e);return n.persistence.runTransaction(`Reject batch`,`readwrite-primary`,(e=>{let r;return n.mutationQueue.lookupMutationBatch(e,t).next((t=>(O(t!==null,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t)))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r))).next((()=>n.localDocuments.getDocuments(e,r)))}))}(r.localStore,t);bf(r,t,n),yf(r,t),r.sharedClientState.updateMutationState(t,`rejected`,n),await Ef(r,e)}catch(e){await $t(e)}}function yf(e,t){(e.ac.get(t)||[]).forEach((e=>{e.resolve()})),e.ac.delete(t)}function bf(e,t,n){let r=k(e),i=r.oc[r.currentUser.toKey()];if(i){let e=i.get(t);e&&(n?e.reject(n):e.resolve(),i=i.remove(t)),r.oc[r.currentUser.toKey()]=i}}function xf(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(let r of e.tc.get(t))e.ec.delete(r),n&&e.Xu.Ec(r,n);e.tc.delete(t),e.isPrimaryClient&&e._c.s_(t).forEach((t=>{e._c.containsKey(t)||Sf(e,t)}))}function Sf(e,t){e.nc.delete(t.path.canonicalString());let n=e.rc.get(t);n!==null&&(fd(e.remoteStore,n),e.rc=e.rc.remove(t),e.sc.delete(n),Tf(e))}function Cf(e,t,n){for(let r of n)r instanceof $d?(e._c.addReference(r.key,t),wf(e,r)):r instanceof ef?(E(nf,`Document no longer in limbo: `+r.key),e._c.removeReference(r.key,t),e._c.containsKey(r.key)||Sf(e,r.key)):D(19791,{hc:r})}function wf(e,t){let n=t.key,r=n.path.canonicalString();e.rc.get(n)||e.nc.has(r)||(E(nf,`New document in limbo: `+n),e.nc.add(r),Tf(e))}function Tf(e){for(;e.nc.size>0&&e.rc.size<e.maxConcurrentLimboResolutions;){let t=e.nc.values().next().value;e.nc.delete(t);let n=new P(N.fromString(t)),r=e.uc.next();e.sc.set(r,new af(n)),e.rc=e.rc.insert(n,r),dd(e.remoteStore,new lu(ki(wi(n.path)),r,`TargetPurposeLimboResolution`,nn.ce))}}async function Ef(e,t,n){let r=k(e),i=[],a=[],o=[];r.ec.isEmpty()||(r.ec.forEach(((e,s)=>{o.push(r.lc(s,t,n).then((e=>{if((e||n)&&r.isPrimaryClient){let t=e?!e.fromCache:n?.targetChanges.get(s.targetId)?.current;r.sharedClientState.updateQueryState(s.targetId,t?`current`:`not-current`)}if(e){i.push(e);let t=Ru.vo(s.targetId,e);a.push(t)}})))})),await Promise.all(o),r.Xu.zn(i),await async function(e,t){let n=k(e);try{await n.persistence.runTransaction(`notifyLocalViewChanges`,`readwrite`,(e=>z.forEach(t,(t=>z.forEach(t.wo,(r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r))).next((()=>z.forEach(t.bo,(r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))))))}catch(e){if(!tn(e))throw e;E(Hu,`Failed to update sequence numbers: `+e)}for(let e of t){let t=e.targetId;if(!e.fromCache){let e=n.$o.get(t),r=e.snapshotVersion,i=e.withLastLimboFreeSnapshotVersion(r);n.$o=n.$o.insert(t,i)}}}(r.localStore,a))}async function Df(e,t){let n=k(e);if(!n.currentUser.isEqual(t)){E(nf,`User change. New user:`,t.toKey());let e=await Ku(n.localStore,t);n.currentUser=t,function(e,t){e.ac.forEach((e=>{e.forEach((e=>{e.reject(new j(A.CANCELLED,t))}))})),e.ac.clear()}(n,`'waitForPendingWrites' promise is rejected due to a user change.`),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Ef(n,e.zo)}}function Of(e,t){let n=k(e),r=n.sc.get(t);if(r&&r.Zu)return J().add(r.key);{let e=J(),r=n.tc.get(t);if(!r)return e;for(let t of r??[]){let r=n.ec.get(t);e=e.unionWith(r.view.Uu)}return e}}function kf(e){let t=k(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=mf.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Of.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=gf.bind(null,t),t.Xu.zn=Jd.bind(null,t.eventManager),t.Xu.Ec=Yd.bind(null,t.eventManager),t}function Af(e){let t=k(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=_f.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=vf.bind(null,t),t}var jf=class{constructor(){this.kind=`memory`,this.synchronizeTabs=!1}async initialize(e){this.serializer=no(e.databaseInfo.databaseId),this.sharedClientState=this.Rc(e),this.persistence=this.Ic(e),await this.persistence.start(),this.localStore=this.Ac(e),this.gcScheduler=this.Vc(e,this.localStore),this.indexBackfillerScheduler=this.dc(e,this.localStore)}Vc(e,t){return null}dc(e,t){return null}Ac(e){return Gu(this.persistence,new Vu,e.initialUser,this.serializer)}Ic(e){return new Pu(Iu.C_,this.serializer)}Rc(e){return new rd}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}};jf.provider={build:()=>new jf};var Mf=class extends jf{constructor(e){super(),this.cacheSizeBytes=e}Vc(e,t){O(this.persistence.referenceDelegate instanceof Lu,46915);let n=this.persistence.referenceDelegate.garbageCollector;return new Vo(n,e.asyncQueue,t)}Ic(e){let t=this.cacheSizeBytes===void 0?Io.DEFAULT:Io.withCacheSize(this.cacheSizeBytes);return new Pu((e=>Lu.C_(e,t)),this.serializer)}},Nf=class{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>hf(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Df.bind(null,this.syncEngine),await Fd(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new Wd}()}createDatastore(e){let t=no(e.databaseInfo.databaseId),n=So(e.databaseInfo);return Ao(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,i){return new sd(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,(e=>hf(this.syncEngine,e,0)),function(){return fo.C()?new fo:new lo}())}createSyncEngine(e,t){return function(e,t,n,r,i,a,o){let s=new of(e,t,n,r,i,a);return o&&(s.cc=!0),s}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await async function(e){let t=k(e);E(od,`RemoteStore shutting down.`),t.tu.add(5),await ld(t),t.ru.shutdown(),t.iu.set(`Unknown`)}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}};Nf.provider={build:()=>new Nf};var Pf=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.mc(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.mc(this.observer.error,e):pt(`Uncaught Error in snapshot listener:`,e.toString()))}gc(){this.muted=!0}mc(e,t){setTimeout((()=>{this.muted||e(t)}),0)}},Ff=`FirestoreClient`,If=class{constructor(e,t,n,r,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this._databaseInfo=r,this.user=lt.UNAUTHENTICATED,this.clientId=Dt.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,(async e=>{E(Ff,`Received user=`,e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(E(Ff,`Received new app check token=`,e),this.appCheckCredentialListener(e,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();let e=new _t;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){let n=zd(t,`Failed to shutdown persistence`);e.reject(n)}})),e.promise}};async function Lf(e,t){e.asyncQueue.verifyOperationInProgress(),E(Ff,`Initializing OfflineComponentProvider`);let n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener((async e=>{r.isEqual(e)||(await Ku(t.localStore,e),r=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function Rf(e,t){e.asyncQueue.verifyOperationInProgress();let n=await zf(e);E(Ff,`Initializing OnlineComponentProvider`),await t.initialize(n,e.configuration),e.setCredentialChangeListener((e=>Pd(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>Pd(t.remoteStore,n))),e._onlineComponents=t}async function zf(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){E(Ff,`Using user provided OfflineComponentProvider`);try{await Lf(e,e._uninitializedComponentsProvider._offline)}catch(t){let n=t;if(!function(e){return e.name===`FirebaseError`?e.code===A.FAILED_PRECONDITION||e.code===A.UNIMPLEMENTED:!(typeof DOMException<`u`&&e instanceof DOMException)||e.code===22||e.code===20||e.code===11}(n))throw n;mt(`Error using user provided cache. Falling back to memory cache: `+n),await Lf(e,new jf)}}else E(Ff,`Using default OfflineComponentProvider`),await Lf(e,new Mf(void 0));return e._offlineComponents}async function Bf(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(E(Ff,`Using user provided OnlineComponentProvider`),await Rf(e,e._uninitializedComponentsProvider._online)):(E(Ff,`Using default OnlineComponentProvider`),await Rf(e,new Nf))),e._onlineComponents}function Vf(e){return Bf(e).then((e=>e.syncEngine))}async function Hf(e){let t=await Bf(e),n=t.eventManager;return n.onListen=sf.bind(null,t.syncEngine),n.onUnlisten=df.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=cf.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=ff.bind(null,t.syncEngine),n}function Uf(e,t,n={}){let r=new _t;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,r,i){let a=new Pf({next:s=>{a.gc(),t.enqueueAndForget((()=>qd(e,o)));let c=s.docs.has(n);!c&&s.fromCache?i.reject(new j(A.UNAVAILABLE,`Failed to get document because the client is offline.`)):c&&s.fromCache&&r&&r.source===`server`?i.reject(new j(A.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:e=>i.reject(e)}),o=new Qd(wi(n.path),a,{includeMetadataChanges:!0,waitForSyncWhenOnline:!0});return Kd(e,o)}(await Hf(e),e.asyncQueue,t,n,r))),r.promise}function Wf(e,t){let n=new _t;return e.asyncQueue.enqueueAndForget((async()=>pf(await Vf(e),t,n))),n.promise}var Gf=`AsyncQueue`,Kf=class{constructor(e=Promise.resolve()){this.qc=[],this.$c=!1,this.Kc=[],this.Wc=null,this.Qc=!1,this.Gc=!1,this.zc=[],this.xn=new Co(this,`async_queue_retry`),this.jc=()=>{let e=id();e&&E(Gf,`Visibility state changed to `+e.visibilityState),this.xn.gn()},this.Hc=e;let t=id();t&&typeof t.addEventListener==`function`&&t.addEventListener(`visibilitychange`,this.jc)}get isShuttingDown(){return this.$c}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Jc(),this.Yc(e)}enterRestrictedMode(e){if(!this.$c){this.$c=!0,this.Gc=e||!1;let t=id();t&&typeof t.removeEventListener==`function`&&t.removeEventListener(`visibilitychange`,this.jc)}}enqueue(e){if(this.Jc(),this.$c)return new Promise((()=>{}));let t=new _t;return this.Yc((()=>this.$c&&this.Gc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.qc.push(e),this.Zc())))}async Zc(){if(this.qc.length!==0){try{await this.qc[0](),this.qc.shift(),this.xn.reset()}catch(e){if(!tn(e))throw e;E(Gf,`Operation failed with retryable error: `+e)}this.qc.length>0&&this.xn.mn((()=>this.Zc()))}}Yc(e){let t=this.Hc.then((()=>(this.Qc=!0,e().catch((e=>{throw this.Wc=e,this.Qc=!1,pt(`INTERNAL UNHANDLED ERROR: `,qf(e)),e})).then((e=>(this.Qc=!1,e))))));return this.Hc=t,t}enqueueAfterDelay(e,t,n){this.Jc(),this.zc.indexOf(e)>-1&&(t=0);let r=Rd.createAndSchedule(this,e,t,n,(e=>this.Xc(e)));return this.Kc.push(r),r}Jc(){this.Wc&&D(47125,{el:qf(this.Wc)})}verifyOperationInProgress(){}async tl(){let e;do e=this.Hc,await e;while(e!==this.Hc)}nl(e){for(let t of this.Kc)if(t.timerId===e)return!0;return!1}rl(e){return this.tl().then((()=>{this.Kc.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(let t of this.Kc)if(t.skipDelay(),e!==`all`&&t.timerId===e)break;return this.tl()}))}il(e){this.zc.push(e)}Xc(e){let t=this.Kc.indexOf(e);this.Kc.splice(t,1)}};function qf(e){let t=e.message||``;return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+`
|
|
33
|
+
`+e.stack),t}var Jf=class extends qo{constructor(e,t,n,r){super(e,t,n,r),this.type=`firestore`,this._queue=new Kf,this._persistenceKey=r?.name||`[DEFAULT]`}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new Kf(e),this._firestoreClient=void 0,await e}}};function Yf(e,t){let r=typeof e==`object`?e:ee(),i=typeof e==`string`?e:t||Mn,a=u(r,`firestore`).getImmediate({identifier:i});if(!a._initialized){let e=n(`firestore`);e&&Jo(a,...e)}return a}function Xf(e){if(e._terminated)throw new j(A.FAILED_PRECONDITION,`The client has already been terminated.`);return e._firestoreClient||Zf(e),e._firestoreClient}function Zf(e){let t=e._freezeSettings(),n=No(e._databaseId,e._app?.options.appId||``,e._persistenceKey,e._app?.options.apiKey,t);e._componentsProvider||t.localCache?._offlineComponentProvider&&t.localCache?._onlineComponentProvider&&(e._componentsProvider={_offline:t.localCache._offlineComponentProvider,_online:t.localCache._onlineComponentProvider}),e._firestoreClient=new If(e._authCredentials,e._appCheckCredentials,e._queue,n,e._componentsProvider&&function(e){let t=e?._online.build();return{_offline:e?._offline.build(t),_online:t}}(e._componentsProvider))}var Qf=class{convertValue(e,t=`none`){switch(G(e)){case 0:return null;case 1:return e.booleanValue;case 2:return W(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Cn(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw D(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t=`none`){let n={};return _n(e,((e,r)=>{n[e]=this.convertValue(r,t)})),n}convertVectorValue(e){let t=e.fields?.[zn].arrayValue?.values?.map((e=>W(e.doubleValue)));return new $o(t)}convertGeoPoint(e){return new so(W(e.latitude),W(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case`previous`:let n=kn(e);return n==null?null:this.convertValue(n,t);case`estimate`:return this.convertTimestamp(An(e));default:return null}}convertTimestamp(e){let t=Sn(e);return new L(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=N.fromString(e);O(Qa(n),9688,{name:e});let r=new Nn(n.get(1),n.get(3)),i=new P(n.popFirst(5));return r.isEqual(t)||pt(`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 (${t.projectId}/${t.database}) instead.`),i}},$f=class extends Qf{constructor(e){super(),this.firestore=e}convertBytes(e){return new ro(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return new Xo(this.firestore,null,t)}},ep=`@firebase/firestore`,tp=`4.16.0`,np=class{constructor(e,t,n,r,i){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Xo(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new rp(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){let t=this._document.data.field(ps(`DocumentSnapshot.get`,e));if(t!==null)return this._userDataWriter.convertValue(t)}}},rp=class extends np{data(){return super.data()}};function ip(e,t,n){let r;return r=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,r}var ap=class{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},op=class e extends np{constructor(e,t,n,r,i,a){super(e,t,n,r,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new sp(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){let n=this._document.data.field(ps(`DocumentSnapshot.get`,e));if(n!==null)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new j(A.FAILED_PRECONDITION,`DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().`);let t=this._document,n={};return n.type=e._jsonSchemaVersion,n.bundle=``,n.bundleSource=`DocumentSnapshot`,n.bundleName=this._key.toString(),!t||!t.isValidDocument()||!t.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,`previous`),n.bundle=(this._firestore,this.ref.path,`NOT SUPPORTED`),n)}};op._jsonSchemaVersion=`firestore/documentSnapshot/1.0`,op._jsonSchema={type:F(`string`,op._jsonSchemaVersion),bundleSource:F(`string`,`DocumentSnapshot`),bundleName:F(`string`),bundle:F(`string`)};var sp=class extends op{data(e={}){return super.data(e)}},cp=class e{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new ap(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){let e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new sp(this._firestore,this._userDataWriter,n.key,n,new ap(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){let t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new j(A.INVALID_ARGUMENT,`To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().`);return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map((n=>{$(e._snapshot.query)?bu(e._snapshot.query):e.query._query;let r=new sp(e._firestore,e._userDataWriter,n.doc.key,n.doc,new ap(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:`added`,doc:r,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||e.type!==3)).map((t=>{let r=new sp(e._firestore,e._userDataWriter,t.doc.key,t.doc,new ap(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),i=-1,a=-1;return t.type!==0&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),t.type!==1&&(n=n.add(t.doc),a=n.indexOf(t.doc.key)),{type:lp(t.type),doc:r,oldIndex:i,newIndex:a}}))}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new j(A.FAILED_PRECONDITION,`QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().`);let t={};t.type=e._jsonSchemaVersion,t.bundleSource=`QuerySnapshot`,t.bundleName=Dt.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let n=[],r=[],i=[];return this.docs.forEach((e=>{e._document!==null&&(n.push(e._document),r.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,`previous`)),i.push(e.ref.path))})),t.bundle=(this._firestore,this.query._query,t.bundleName,`NOT SUPPORTED`),t}};function lp(e){switch(e){case 0:return`added`;case 2:case 3:return`modified`;case 1:return`removed`;default:return D(61501,{type:e})}}cp._jsonSchemaVersion=`firestore/querySnapshot/1.0`,cp._jsonSchema={type:F(`string`,cp._jsonSchemaVersion),bundleSource:F(`string`,`QuerySnapshot`),bundleName:F(`string`),bundle:F(`string`)};function up(e){e=Ht(e,Xo);let t=Ht(e.firestore,Jf);return Uf(Xf(t),e._key).then((n=>pp(t,e,n)))}function dp(e,t,n){e=Ht(e,Xo);let r=Ht(e.firestore,Jf),i=ip(e.converter,t,n);return fp(r,[os(as(r),`setDoc`,e._key,i,e.converter!==null,n).toMutation(e._key,Mr.none())])}function fp(e,t){return Wf(Xf(e),t)}function pp(e,t,n){let r=n.docs.get(t._key);return new op(e,new $f(e),t._key,r,new ap(n.hasPendingWrites,n.fromCache),t.converter)}(function(e,t=!0){ut(l),s(new te(`firestore`,((e,{instanceIdentifier:n,options:r})=>{let i=e.getProvider(`app`).getImmediate(),a=new Jf(new xt(e.getProvider(`auth-internal`)),new Tt(i,e.getProvider(`app-check-internal`)),Pn(i,n),i);return r={useFetchStreams:t,...r},a._setSettings(r),a}),`PUBLIC`).setMultipleInstances(!0)),d(ep,tp,e),d(ep,tp,`esm2020`)})();export{Qo as doc,up as getDoc,Yf as getFirestore,Ss as increment,xs as serverTimestamp,dp as setDoc};
|