@isardsat/editorial-admin 6.19.5 → 6.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/build/client/assets/FilePicker-DGseBDOZ.js +1 -0
  2. package/build/client/assets/{Loading-MKgXMPvl.js → Loading-C1QGFwZC.js} +1 -1
  3. package/build/client/assets/{URLInput-CPrLDhlu.js → URLInput-ATIRZflA.js} +1 -1
  4. package/build/client/assets/{authSlice-BI_rlf3v.js → authSlice-DWtXmmFR.js} +1 -1
  5. package/build/client/assets/{badge-gLcN3Bjg.js → badge-DTudhbGs.js} +1 -1
  6. package/build/client/assets/button-BEFuP7Ru.js +1 -0
  7. package/build/client/assets/chevron-down-qxzqwz13.js +1 -0
  8. package/build/client/assets/clear-button-DDlOMSPc.js +1 -0
  9. package/build/client/assets/{dashboard-Dpm8zjXn.js → dashboard-Z-q3vTcz.js} +1 -1
  10. package/build/client/assets/dashboard._collection-BJjjgsuR.js +1 -0
  11. package/build/client/assets/dashboard._collection._document-DsM6Ccoi.js +1 -0
  12. package/build/client/assets/dashboard._collection.new-CSCI2lHu.js +1 -0
  13. package/build/client/assets/dashboard._layout-BcvvHYJk.js +1 -0
  14. package/build/client/assets/dashboard.files-wgFLZCcb.js +1 -0
  15. package/build/client/assets/date-picker-BdkIUMlY.js +1 -0
  16. package/build/client/assets/datetime-picker-D5KjBZgW.js +1 -0
  17. package/build/client/assets/files-BTW5qTjQ.js +1 -0
  18. package/build/client/assets/home-DkI84frB.js +1 -0
  19. package/build/client/assets/index-6Qui8hKi.js +1 -0
  20. package/build/client/assets/index-BWbeFPrX.js +1 -0
  21. package/build/client/assets/{index-CtLWaleL.js → index-CbaefyjV.js} +1 -1
  22. package/build/client/assets/{index-pxU98Is7.js → index-Cgk-ojIv.js} +1 -1
  23. package/build/client/assets/index-DVXSV0SY.js +1 -0
  24. package/build/client/assets/index-F1mp4zFe.js +45 -0
  25. package/build/client/assets/{input-Bk91TMQj.js → input-C3iFdiD8.js} +1 -1
  26. package/build/client/assets/itemForm-DLH0QBUu.js +8 -0
  27. package/build/client/assets/manifest-31b20659.js +1 -0
  28. package/build/client/assets/{markdownEditor-DQlvnWfs.js → markdownEditor-DmTXZRsO.js} +2 -2
  29. package/build/client/assets/{root-CLpfMQQt.js → root-BYBo3WgS.js} +1 -1
  30. package/build/client/assets/root-CKQ4Xhj3.css +1 -0
  31. package/build/client/assets/{schemas-MhAKMGOb.js → schemas-D-U8dKAF.js} +1 -1
  32. package/build/client/assets/{utils-CCKKso3e.js → utils-B48p8Qal.js} +1 -1
  33. package/build/client/assets/x-D6gZWaAR.js +1 -0
  34. package/build/client/assets/zod-3z1GyiF_.js +1 -0
  35. package/build/client/index.html +2 -2
  36. package/package.json +2 -2
  37. package/build/client/assets/FilePicker-C1CJTrRE.js +0 -1
  38. package/build/client/assets/alert-dialog-CN-uuUVp.js +0 -7
  39. package/build/client/assets/clear-button-D05R9Y5Y.js +0 -1
  40. package/build/client/assets/dashboard._collection-WrdG5htb.js +0 -1
  41. package/build/client/assets/dashboard._collection._document-B1GJt2sO.js +0 -1
  42. package/build/client/assets/dashboard._collection.new-Diuwwt8Y.js +0 -1
  43. package/build/client/assets/dashboard._layout-B1StatCH.js +0 -1
  44. package/build/client/assets/dashboard.files-BK6IOREO.js +0 -1
  45. package/build/client/assets/date-picker-Dgbvfw_1.js +0 -1
  46. package/build/client/assets/datetime-picker-De7vM6e7.js +0 -1
  47. package/build/client/assets/files-Cdeyho5X.js +0 -1
  48. package/build/client/assets/home-DChaVk_H.js +0 -1
  49. package/build/client/assets/index-B0u0hYGX.js +0 -1
  50. package/build/client/assets/index-B2dzkZu5.js +0 -1
  51. package/build/client/assets/index-B3bJjaCJ.js +0 -1
  52. package/build/client/assets/index-BhARCKRr.js +0 -1
  53. package/build/client/assets/index-CHzEoQKp.js +0 -1
  54. package/build/client/assets/index-cCny74f5.js +0 -45
  55. package/build/client/assets/itemForm-CQAq1Sag.js +0 -2
  56. package/build/client/assets/manifest-fd6f5f23.js +0 -1
  57. package/build/client/assets/root-D5WeoLDH.css +0 -1
  58. package/build/client/assets/x-BVtfHpQX.js +0 -1
  59. package/build/client/assets/zod-BFfp0fV9.js +0 -1
@@ -15,4 +15,4 @@ import{r as Rh,a as B}from"./chunk-EPOLDU6W-CiSVlmCe.js";const kh=()=>{};var va=
15
15
  </defs>`,f.innerText="Preview backend running in this workspace."),f.setAttribute("id",p)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",d):d()}function we(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function _o(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(we())}function Bh(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function qh(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function Pl(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function zh(){const t=we();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function Hh(){return bl.NODE_ADMIN===!0}function jh(){try{return typeof indexedDB=="object"}catch{return!1}}function $h(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}const Gh="FirebaseError";class It extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=Gh,Object.setPrototypeOf(this,It.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,gr.prototype.create)}}class gr{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Qh(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new It(i,a,r)}}function Qh(t,e){return t.replace(Kh,(n,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const Kh=/\{\$([^}]+)}/g;function Yn(t){return JSON.parse(t)}function ue(t){return JSON.stringify(t)}const Al=function(t){let e={},n={},r={},i="";try{const s=t.split(".");e=Yn(ti(s[0])||""),n=Yn(ti(s[1])||""),i=s[2],r=n.d||{},delete n.d}catch{}return{header:e,claims:n,data:r,signature:i}},Yh=function(t){const e=Al(t),n=e.claims;return!!n&&typeof n=="object"&&n.hasOwnProperty("iat")},Jh=function(t){const e=Al(t).claims;return typeof e=="object"&&e.admin===!0};function nt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function an(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]}function Os(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function ni(t,e,n){const r={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=e.call(n,t[i],i,t));return r}function Dt(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],o=e[i];if(wa(s)&&wa(o)){if(!Dt(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function wa(t){return t!==null&&typeof t=="object"}function yn(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function xn(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Mn(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class Xh{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,n){n||(n=0);const r=this.W_;if(typeof e=="string")for(let d=0;d<16;d++)r[d]=e.charCodeAt(n)<<24|e.charCodeAt(n+1)<<16|e.charCodeAt(n+2)<<8|e.charCodeAt(n+3),n+=4;else for(let d=0;d<16;d++)r[d]=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3],n+=4;for(let d=16;d<80;d++){const h=r[d-3]^r[d-8]^r[d-14]^r[d-16];r[d]=(h<<1|h>>>31)&4294967295}let i=this.chain_[0],s=this.chain_[1],o=this.chain_[2],a=this.chain_[3],c=this.chain_[4],l,u;for(let d=0;d<80;d++){d<40?d<20?(l=a^s&(o^a),u=1518500249):(l=s^o^a,u=1859775393):d<60?(l=s&o|a&(s|o),u=2400959708):(l=s^o^a,u=3395469782);const h=(i<<5|i>>>27)+l+c+u+r[d]&4294967295;c=a,a=o,o=(s<<30|s>>>2)&4294967295,s=i,i=h}this.chain_[0]=this.chain_[0]+i&4294967295,this.chain_[1]=this.chain_[1]+s&4294967295,this.chain_[2]=this.chain_[2]+o&4294967295,this.chain_[3]=this.chain_[3]+a&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(e,n){if(e==null)return;n===void 0&&(n=e.length);const r=n-this.blockSize;let i=0;const s=this.buf_;let o=this.inbuf_;for(;i<n;){if(o===0)for(;i<=r;)this.compress_(e,i),i+=this.blockSize;if(typeof e=="string"){for(;i<n;)if(s[o]=e.charCodeAt(i),++o,++i,o===this.blockSize){this.compress_(s),o=0;break}}else for(;i<n;)if(s[o]=e[i],++o,++i,o===this.blockSize){this.compress_(s),o=0;break}}this.inbuf_=o,this.total_+=n}digest(){const e=[];let n=this.total_*8;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let i=this.blockSize-1;i>=56;i--)this.buf_[i]=n&255,n/=256;this.compress_(this.buf_);let r=0;for(let i=0;i<5;i++)for(let s=24;s>=0;s-=8)e[r]=this.chain_[i]>>s&255,++r;return e}}function Zh(t,e){const n=new ef(t,e);return n.subscribe.bind(n)}class ef{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");tf(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=os),i.error===void 0&&(i.error=os),i.complete===void 0&&(i.complete=os);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function tf(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function os(){}function Nl(t,e){return`${t} failed: ${e} argument `}const nf=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);if(i>=55296&&i<=56319){const s=i-55296;r++,D(r<t.length,"Surrogate pair missing trail surrogate.");const o=t.charCodeAt(r)-56320;i=65536+(s<<10)+o}i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):i<65536?(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},Li=function(t){let e=0;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);r<128?e++:r<2048?e+=2:r>=55296&&r<=56319?(e+=4,n++):e+=3}return e};function Ee(t){return t&&t._delegate?t._delegate:t}class xt{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const Pt="[DEFAULT]";let rf=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new mo;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;const r=this.normalizeInstanceIdentifier(e?.identifier),i=(n=e?.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(of(e))try{this.getOrInitializeService({instanceIdentifier:Pt})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=Pt){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Pt){return this.instances.has(e)}getOptions(e=Pt){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,n){var r;const i=this.normalizeInstanceIdentifier(n),s=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;s.add(e),this.onInitCallbacks.set(i,s);const o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:sf(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Pt){return this.component?this.component.multipleInstances?e:Pt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function sf(t){return t===Pt?void 0:t}function of(t){return t.instantiationMode==="EAGER"}class af{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new rf(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}var ne;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(ne||(ne={}));const cf={debug:ne.DEBUG,verbose:ne.VERBOSE,info:ne.INFO,warn:ne.WARN,error:ne.ERROR,silent:ne.SILENT},lf=ne.INFO,uf={[ne.DEBUG]:"log",[ne.VERBOSE]:"log",[ne.INFO]:"info",[ne.WARN]:"warn",[ne.ERROR]:"error"},df=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),i=uf[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class yo{constructor(e){this.name=e,this._logLevel=lf,this._logHandler=df,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in ne))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?cf[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,ne.DEBUG,...e),this._logHandler(this,ne.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,ne.VERBOSE,...e),this._logHandler(this,ne.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,ne.INFO,...e),this._logHandler(this,ne.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,ne.WARN,...e),this._logHandler(this,ne.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,ne.ERROR,...e),this._logHandler(this,ne.ERROR,...e)}}const hf=(t,e)=>e.some(n=>t instanceof n);let Ea,Ia;function ff(){return Ea||(Ea=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function pf(){return Ia||(Ia=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ol=new WeakMap,Ds=new WeakMap,Dl=new WeakMap,as=new WeakMap,vo=new WeakMap;function gf(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(dt(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Ol.set(n,t)}).catch(()=>{}),vo.set(e,t),e}function mf(t){if(Ds.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});Ds.set(t,e)}let xs={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Ds.get(t);if(e==="objectStoreNames")return t.objectStoreNames||Dl.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return dt(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function _f(t){xs=t(xs)}function yf(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(cs(this),e,...n);return Dl.set(r,e.sort?e.sort():[e]),dt(r)}:pf().includes(t)?function(...e){return t.apply(cs(this),e),dt(Ol.get(this))}:function(...e){return dt(t.apply(cs(this),e))}}function vf(t){return typeof t=="function"?yf(t):(t instanceof IDBTransaction&&mf(t),hf(t,ff())?new Proxy(t,xs):t)}function dt(t){if(t instanceof IDBRequest)return gf(t);if(as.has(t))return as.get(t);const e=vf(t);return e!==t&&(as.set(t,e),vo.set(e,t)),e}const cs=t=>vo.get(t);function bf(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=dt(o);return r&&o.addEventListener("upgradeneeded",c=>{r(dt(o.result),c.oldVersion,c.newVersion,dt(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const wf=["get","getKey","getAll","getAllKeys","count"],Ef=["put","add","delete","clear"],ls=new Map;function Ca(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(ls.get(e))return ls.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=Ef.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||wf.includes(n)))return;const s=async function(o,...a){const c=this.transaction(o,i?"readwrite":"readonly");let l=c.store;return r&&(l=l.index(a.shift())),(await Promise.all([l[n](...a),i&&c.done]))[0]};return ls.set(e,s),s}_f(t=>({...t,get:(e,n,r)=>Ca(e,n)||t.get(e,n,r),has:(e,n)=>!!Ca(e,n)||t.has(e,n)}));class If{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(Cf(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function Cf(t){const e=t.getComponent();return e?.type==="VERSION"}const Ms="@firebase/app",Sa="0.13.2";const Je=new yo("@firebase/app"),Sf="@firebase/app-compat",Tf="@firebase/analytics-compat",Rf="@firebase/analytics",kf="@firebase/app-check-compat",Pf="@firebase/app-check",Af="@firebase/auth",Nf="@firebase/auth-compat",Of="@firebase/database",Df="@firebase/data-connect",xf="@firebase/database-compat",Mf="@firebase/functions",Lf="@firebase/functions-compat",Ff="@firebase/installations",Uf="@firebase/installations-compat",Wf="@firebase/messaging",Vf="@firebase/messaging-compat",Bf="@firebase/performance",qf="@firebase/performance-compat",zf="@firebase/remote-config",Hf="@firebase/remote-config-compat",jf="@firebase/storage",$f="@firebase/storage-compat",Gf="@firebase/firestore",Qf="@firebase/ai",Kf="@firebase/firestore-compat",Yf="firebase",Jf="11.10.0";const Ls="[DEFAULT]",Xf={[Ms]:"fire-core",[Sf]:"fire-core-compat",[Rf]:"fire-analytics",[Tf]:"fire-analytics-compat",[Pf]:"fire-app-check",[kf]:"fire-app-check-compat",[Af]:"fire-auth",[Nf]:"fire-auth-compat",[Of]:"fire-rtdb",[Df]:"fire-data-connect",[xf]:"fire-rtdb-compat",[Mf]:"fire-fn",[Lf]:"fire-fn-compat",[Ff]:"fire-iid",[Uf]:"fire-iid-compat",[Wf]:"fire-fcm",[Vf]:"fire-fcm-compat",[Bf]:"fire-perf",[qf]:"fire-perf-compat",[zf]:"fire-rc",[Hf]:"fire-rc-compat",[jf]:"fire-gcs",[$f]:"fire-gcs-compat",[Gf]:"fire-fst",[Kf]:"fire-fst-compat",[Qf]:"fire-vertex","fire-js":"fire-js",[Yf]:"fire-js-all"};const ri=new Map,Zf=new Map,Fs=new Map;function Ta(t,e){try{t.container.addComponent(e)}catch(n){Je.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function cn(t){const e=t.name;if(Fs.has(e))return Je.debug(`There were multiple attempts to register component ${e}.`),!1;Fs.set(e,t);for(const n of ri.values())Ta(n,t);for(const n of Zf.values())Ta(n,t);return!0}function bo(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Oe(t){return t==null?!1:t.settings!==void 0}const ep={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},ht=new gr("app","Firebase",ep);class tp{constructor(e,n,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new xt("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw ht.create("app-deleted",{appName:this._name})}}const vn=Jf;function xl(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Ls,automaticDataCollectionEnabled:!0},e),i=r.name;if(typeof i!="string"||!i)throw ht.create("bad-app-name",{appName:String(i)});if(n||(n=Sl()),!n)throw ht.create("no-options");const s=ri.get(i);if(s){if(Dt(n,s.options)&&Dt(r,s.config))return s;throw ht.create("duplicate-app",{appName:i})}const o=new af(i);for(const c of Fs.values())o.addComponent(c);const a=new tp(n,r,o);return ri.set(i,a),a}function Ml(t=Ls){const e=ri.get(t);if(!e&&t===Ls&&Sl())return xl();if(!e)throw ht.create("no-app",{appName:t});return e}function ft(t,e,n){var r;let i=(r=Xf[t])!==null&&r!==void 0?r:t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Je.warn(a.join(" "));return}cn(new xt(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}const np="firebase-heartbeat-database",rp=1,Jn="firebase-heartbeat-store";let us=null;function Ll(){return us||(us=bf(np,rp,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(Jn)}catch(n){console.warn(n)}}}}).catch(t=>{throw ht.create("idb-open",{originalErrorMessage:t.message})})),us}async function ip(t){try{const n=(await Ll()).transaction(Jn),r=await n.objectStore(Jn).get(Fl(t));return await n.done,r}catch(e){if(e instanceof It)Je.warn(e.message);else{const n=ht.create("idb-get",{originalErrorMessage:e?.message});Je.warn(n.message)}}}async function Ra(t,e){try{const r=(await Ll()).transaction(Jn,"readwrite");await r.objectStore(Jn).put(e,Fl(t)),await r.done}catch(n){if(n instanceof It)Je.warn(n.message);else{const r=ht.create("idb-set",{originalErrorMessage:n?.message});Je.warn(r.message)}}}function Fl(t){return`${t.name}!${t.options.appId}`}const sp=1024,op=30;class ap{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new lp(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=ka();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s))return;if(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats.length>op){const o=up(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Je.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=ka(),{heartbeatsToSend:r,unsentEntries:i}=cp(this._heartbeatsCache.heartbeats),s=ei(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return Je.warn(n),""}}}function ka(){return new Date().toISOString().substring(0,10)}function cp(t,e=sp){const n=[];let r=t.slice();for(const i of t){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Pa(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Pa(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class lp{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return jh()?$h().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await ip(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return Ra(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return Ra(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}}function Pa(t){return ei(JSON.stringify({version:2,heartbeats:t})).length}function up(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}function dp(t){cn(new xt("platform-logger",e=>new If(e),"PRIVATE")),cn(new xt("heartbeat",e=>new ap(e),"PRIVATE")),ft(Ms,Sa,t),ft(Ms,Sa,"esm2017"),ft("fire-js","")}dp("");var hp="firebase",fp="11.10.0";ft(hp,fp,"app");var Aa=function(){return Aa=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Aa.apply(this,arguments)};function wo(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function QE(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function Ul(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const pp=Ul,Wl=new gr("auth","Firebase",Ul());const ii=new yo("@firebase/auth");function gp(t,...e){ii.logLevel<=ne.WARN&&ii.warn(`Auth (${vn}): ${t}`,...e)}function Gr(t,...e){ii.logLevel<=ne.ERROR&&ii.error(`Auth (${vn}): ${t}`,...e)}function We(t,...e){throw Eo(t,...e)}function Ve(t,...e){return Eo(t,...e)}function Vl(t,e,n){const r=Object.assign(Object.assign({},pp()),{[e]:n});return new gr("auth","Firebase",r).create(e,{appName:t.name})}function pt(t){return Vl(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Eo(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return Wl.create(t,...e)}function H(t,e,...n){if(!t)throw Eo(e,...n)}function Ge(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Gr(e),new Error(e)}function Xe(t,e){t||Ge(e)}function Us(){var t;return typeof self<"u"&&((t=self.location)===null||t===void 0?void 0:t.href)||""}function mp(){return Na()==="http:"||Na()==="https:"}function Na(){var t;return typeof self<"u"&&((t=self.location)===null||t===void 0?void 0:t.protocol)||null}function _p(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(mp()||qh()||"connection"in navigator)?navigator.onLine:!0}function yp(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}class mr{constructor(e,n){this.shortDelay=e,this.longDelay=n,Xe(n>e,"Short delay should be less than long delay!"),this.isMobile=_o()||Pl()}get(){return _p()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Io(t,e){Xe(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class Bl{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Ge("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Ge("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Ge("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const vp={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};const bp=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],wp=new mr(3e4,6e4);function qt(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Ct(t,e,n,r,i={}){return ql(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const a=yn(Object.assign({key:t.config.apiKey},o)).slice(1),c=await t._getAdditionalHeaders();c["Content-Type"]="application/json",t.languageCode&&(c["X-Firebase-Locale"]=t.languageCode);const l=Object.assign({method:e,headers:c},s);return Bh()||(l.referrerPolicy="no-referrer"),t.emulatorConfig&&_n(t.emulatorConfig.host)&&(l.credentials="include"),Bl.fetch()(await zl(t,t.config.apiHost,n,a),l)})}async function ql(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},vp),e);try{const i=new Ip(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw xr(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw xr(t,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw xr(t,"email-already-in-use",o);if(c==="USER_DISABLED")throw xr(t,"user-disabled",o);const u=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw Vl(t,u,l);We(t,u)}}catch(i){if(i instanceof It)throw i;We(t,"network-request-failed",{message:String(i)})}}async function Fi(t,e,n,r,i={}){const s=await Ct(t,e,n,r,i);return"mfaPendingCredential"in s&&We(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function zl(t,e,n,r){const i=`${e}${n}?${r}`,s=t,o=s.config.emulator?Io(t.config,i):`${t.config.apiScheme}://${i}`;return bp.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function Ep(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Ip{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Ve(this.auth,"network-request-failed")),wp.get())})}}function xr(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=Ve(t,e,r);return i.customData._tokenResponse=n,i}function Oa(t){return t!==void 0&&t.enterprise!==void 0}class Cp{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return Ep(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function Sp(t,e){return Ct(t,"GET","/v2/recaptchaConfig",qt(t,e))}async function Tp(t,e){return Ct(t,"POST","/v1/accounts:delete",e)}async function si(t,e){return Ct(t,"POST","/v1/accounts:lookup",e)}function Vn(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Rp(t,e=!1){const n=Ee(t),r=await n.getIdToken(e),i=Co(r);H(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:r,authTime:Vn(ds(i.auth_time)),issuedAtTime:Vn(ds(i.iat)),expirationTime:Vn(ds(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function ds(t){return Number(t)*1e3}function Co(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Gr("JWT malformed, contained fewer than 3 sections"),null;try{const i=ti(n);return i?JSON.parse(i):(Gr("Failed to decode base64 JWT payload"),null)}catch(i){return Gr("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Da(t){const e=Co(t);return H(e,"internal-error"),H(typeof e.exp<"u","internal-error"),H(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function Xn(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof It&&kp(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function kp({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}class Pp{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class Ws{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Vn(this.lastLoginAt),this.creationTime=Vn(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function oi(t){var e;const n=t.auth,r=await t.getIdToken(),i=await Xn(t,si(n,{idToken:r}));H(i?.users.length,n,"internal-error");const s=i.users[0];t._notifyReloadListener(s);const o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?Hl(s.providerUserInfo):[],a=Np(t.providerData,o),c=t.isAnonymous,l=!(t.email&&s.passwordHash)&&!a?.length,u=c?l:!1,d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new Ws(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,d)}async function Ap(t){const e=Ee(t);await oi(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Np(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function Hl(t){return t.map(e=>{var{providerId:n}=e,r=wo(e,["providerId"]);return{providerId:n,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}async function Op(t,e){const n=await ql(t,{},async()=>{const r=yn({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await zl(t,i,"/v1/token",`key=${s}`),a=await t._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:a,body:r};return t.emulatorConfig&&_n(t.emulatorConfig.host)&&(c.credentials="include"),Bl.fetch()(o,c)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function Dp(t,e){return Ct(t,"POST","/v2/accounts:revokeToken",qt(t,e))}class tn{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){H(e.idToken,"internal-error"),H(typeof e.idToken<"u","internal-error"),H(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Da(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){H(e.length!==0,"internal-error");const n=Da(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(H(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:i,expiresIn:s}=await Op(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:i,expirationTime:s}=n,o=new tn;return r&&(H(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(H(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(H(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new tn,this.toJSON())}_performRefresh(){return Ge("not implemented")}}function st(t,e){H(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class xe{constructor(e){var{uid:n,auth:r,stsTokenManager:i}=e,s=wo(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Pp(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Ws(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const n=await Xn(this,this.stsTokenManager.getToken(this.auth,e));return H(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return Rp(this,e)}reload(){return Ap(this)}_assign(e){this!==e&&(H(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new xe(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){H(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await oi(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Oe(this.auth.app))return Promise.reject(pt(this.auth));const e=await this.getIdToken();return await Xn(this,Tp(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var r,i,s,o,a,c,l,u;const d=(r=n.displayName)!==null&&r!==void 0?r:void 0,h=(i=n.email)!==null&&i!==void 0?i:void 0,p=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,f=(o=n.photoURL)!==null&&o!==void 0?o:void 0,I=(a=n.tenantId)!==null&&a!==void 0?a:void 0,g=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,T=(l=n.createdAt)!==null&&l!==void 0?l:void 0,P=(u=n.lastLoginAt)!==null&&u!==void 0?u:void 0,{uid:m,emailVerified:b,isAnonymous:_,providerData:v,stsTokenManager:S}=n;H(m&&S,e,"internal-error");const w=tn.fromJSON(this.name,S);H(typeof m=="string",e,"internal-error"),st(d,e.name),st(h,e.name),H(typeof b=="boolean",e,"internal-error"),H(typeof _=="boolean",e,"internal-error"),st(p,e.name),st(f,e.name),st(I,e.name),st(g,e.name),st(T,e.name),st(P,e.name);const R=new xe({uid:m,auth:e,email:h,emailVerified:b,displayName:d,isAnonymous:_,photoURL:f,phoneNumber:p,tenantId:I,stsTokenManager:w,createdAt:T,lastLoginAt:P});return v&&Array.isArray(v)&&(R.providerData=v.map(C=>Object.assign({},C))),g&&(R._redirectEventId=g),R}static async _fromIdTokenResponse(e,n,r=!1){const i=new tn;i.updateFromServerResponse(n);const s=new xe({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await oi(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];H(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?Hl(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new tn;a.updateFromIdToken(r);const c=new xe({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new Ws(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(c,l),c}}const xa=new Map;function Qe(t){Xe(t instanceof Function,"Expected a class definition");let e=xa.get(t);return e?(Xe(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,xa.set(t,e),e)}class jl{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}jl.type="NONE";const Ma=jl;function Qr(t,e,n){return`firebase:${t}:${e}:${n}`}class nn{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=Qr(this.userKey,i.apiKey,s),this.fullPersistenceKey=Qr("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await si(this.auth,{idToken:e}).catch(()=>{});return n?xe._fromGetAccountInfoResponse(this.auth,n,e):null}return xe._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new nn(Qe(Ma),e,r);const i=(await Promise.all(n.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l);let s=i[0]||Qe(Ma);const o=Qr(r,e.config.apiKey,e.name);let a=null;for(const l of n)try{const u=await l._get(o);if(u){let d;if(typeof u=="string"){const h=await si(e,{idToken:u}).catch(()=>{});if(!h)break;d=await xe._fromGetAccountInfoResponse(e,h,u)}else d=xe._fromJSON(e,u);l!==s&&(a=d),s=l;break}}catch{}const c=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new nn(s,e,r):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new nn(s,e,r))}}function La(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Kl(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if($l(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Jl(e))return"Blackberry";if(Xl(e))return"Webos";if(Gl(e))return"Safari";if((e.includes("chrome/")||Ql(e))&&!e.includes("edge/"))return"Chrome";if(Yl(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if(r?.length===2)return r[1]}return"Other"}function $l(t=we()){return/firefox\//i.test(t)}function Gl(t=we()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Ql(t=we()){return/crios\//i.test(t)}function Kl(t=we()){return/iemobile/i.test(t)}function Yl(t=we()){return/android/i.test(t)}function Jl(t=we()){return/blackberry/i.test(t)}function Xl(t=we()){return/webos/i.test(t)}function So(t=we()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function xp(t=we()){var e;return So(t)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function Mp(){return zh()&&document.documentMode===10}function Zl(t=we()){return So(t)||Yl(t)||Xl(t)||Jl(t)||/windows phone/i.test(t)||Kl(t)}function eu(t,e=[]){let n;switch(t){case"Browser":n=La(we());break;case"Worker":n=`${La(we())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${vn}/${r}`}class Lp{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,a)=>{try{const c=e(s);o(c)}catch(c){a(c)}});r.onAbort=n,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}}async function Fp(t,e={}){return Ct(t,"GET","/v2/passwordPolicy",qt(t,e))}const Up=6;class Wp{constructor(e){var n,r,i,s;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:Up,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,r,i,s,o,a;const c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(r=c.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),c.isValid&&(c.isValid=(i=c.containsLowercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(s=c.containsUppercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}class Vp{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Fa(this),this.idTokenSubscription=new Fa(this),this.beforeStateQueue=new Lp(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Wl,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Qe(n)),this._initializationPromise=this.queue(async()=>{var r,i,s;if(!this._deleted&&(this.persistenceManager=await nn.create(this,e),(r=this._resolvePersistenceManagerAvailable)===null||r===void 0||r.call(this),!this._deleted)){if(!((i=this._popupRedirectResolver)===null||i===void 0)&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((s=this.currentUser)===null||s===void 0?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await si(this,{idToken:e}),r=await xe._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(Oe(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let i=r,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(i=c.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return H(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await oi(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=yp()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Oe(this.app))return Promise.reject(pt(this));const n=e?Ee(e):null;return n&&H(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&H(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Oe(this.app)?Promise.reject(pt(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Oe(this.app)?Promise.reject(pt(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Qe(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await Fp(this),n=new Wp(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new gr("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await Dp(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&Qe(e)||this._popupRedirectResolver;H(n,this,"argument-error"),this.redirectPersistenceManager=await nn.create(this,[Qe(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};const s=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(H(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){const c=e.addObserver(n,r,i);return()=>{o=!0,c()}}else{const c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return H(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=eu(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);const r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(n["X-Firebase-Client"]=r);const i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;if(Oe(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n?.error&&gp(`Error while retrieving App Check token: ${n.error}`),n?.token}}function bn(t){return Ee(t)}class Fa{constructor(e){this.auth=e,this.observer=null,this.addObserver=Zh(n=>this.observer=n)}get next(){return H(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Ui={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Bp(t){Ui=t}function tu(t){return Ui.loadJS(t)}function qp(){return Ui.recaptchaEnterpriseScript}function zp(){return Ui.gapiScript}function Hp(t){return`__${t}${Math.floor(Math.random()*1e6)}`}class jp{constructor(){this.enterprise=new $p}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class $p{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}const Gp="recaptcha-enterprise",nu="NO_RECAPTCHA";class Qp{constructor(e){this.type=Gp,this.auth=bn(e)}async verify(e="verify",n=!1){async function r(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{Sp(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const l=new Cp(c);return s.tenantId==null?s._agentRecaptchaConfig=l:s._tenantRecaptchaConfigs[s.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function i(s,o,a){const c=window.grecaptcha;Oa(c)?c.enterprise.ready(()=>{c.enterprise.execute(s,{action:e}).then(l=>{o(l)}).catch(()=>{o(nu)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new jp().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{r(this.auth).then(a=>{if(!n&&Oa(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=qp();c.length!==0&&(c+=a),tu(c).then(()=>{i(a,s,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}}async function Ua(t,e,n,r=!1,i=!1){const s=new Qp(t);let o;if(i)o=nu;else try{o=await s.verify(n)}catch{o=await s.verify(n,!0)}const a=Object.assign({},e);if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in a){const c=a.phoneEnrollmentInfo.phoneNumber,l=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:c,recaptchaToken:l,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const c=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:c,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return r?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Wa(t,e,n,r,i){var s;if(!((s=t._getRecaptchaConfig())===null||s===void 0)&&s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const o=await Ua(t,e,n,n==="getOobCode");return r(t,o)}else return r(t,e).catch(async o=>{if(o.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const a=await Ua(t,e,n,n==="getOobCode");return r(t,a)}else return Promise.reject(o)})}function Kp(t,e){const n=bo(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(Dt(s,e??{}))return i;We(i,"already-initialized")}return n.initialize({options:e})}function Yp(t,e){const n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(Qe);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function Jp(t,e,n){const r=bn(t);H(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=ru(e),{host:o,port:a}=Xp(e),c=a===null?"":`:${a}`,l={url:`${s}//${o}${c}/`},u=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){H(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),H(Dt(l,r.config.emulator)&&Dt(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=l,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,_n(o)?(Rl(`${s}//${o}${c}`),kl("Auth",!0)):Zp()}function ru(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Xp(t){const e=ru(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:Va(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:Va(o)}}}function Va(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function Zp(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}class To{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Ge("not implemented")}_getIdTokenResponse(e){return Ge("not implemented")}_linkToIdToken(e,n){return Ge("not implemented")}_getReauthenticationResolver(e){return Ge("not implemented")}}async function eg(t,e){return Ct(t,"POST","/v1/accounts:signUp",e)}async function tg(t,e){return Fi(t,"POST","/v1/accounts:signInWithPassword",qt(t,e))}async function ng(t,e){return Fi(t,"POST","/v1/accounts:signInWithEmailLink",qt(t,e))}async function rg(t,e){return Fi(t,"POST","/v1/accounts:signInWithEmailLink",qt(t,e))}class Zn extends To{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new Zn(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new Zn(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Wa(e,n,"signInWithPassword",tg);case"emailLink":return ng(e,{email:this._email,oobCode:this._password});default:We(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":const r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Wa(e,r,"signUpPassword",eg);case"emailLink":return rg(e,{idToken:n,email:this._email,oobCode:this._password});default:We(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function rn(t,e){return Fi(t,"POST","/v1/accounts:signInWithIdp",qt(t,e))}const ig="http://localhost";class Mt extends To{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new Mt(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):We("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i}=n,s=wo(n,["providerId","signInMethod"]);if(!r||!i)return null;const o=new Mt(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return rn(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,rn(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,rn(e,n)}buildRequest(){const e={requestUri:ig,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=yn(n)}return e}}function sg(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function og(t){const e=xn(Mn(t)).link,n=e?xn(Mn(e)).deep_link_id:null,r=xn(Mn(t)).deep_link_id;return(r?xn(Mn(r)).link:null)||r||n||e||t}class Ro{constructor(e){var n,r,i,s,o,a;const c=xn(Mn(e)),l=(n=c.apiKey)!==null&&n!==void 0?n:null,u=(r=c.oobCode)!==null&&r!==void 0?r:null,d=sg((i=c.mode)!==null&&i!==void 0?i:null);H(l&&u&&d,"argument-error"),this.apiKey=l,this.operation=d,this.code=u,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.lang)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const n=og(e);try{return new Ro(n)}catch{return null}}}class wn{constructor(){this.providerId=wn.PROVIDER_ID}static credential(e,n){return Zn._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=Ro.parseLink(n);return H(r,"argument-error"),Zn._fromEmailAndCode(e,r.code,r.tenantId)}}wn.PROVIDER_ID="password";wn.EMAIL_PASSWORD_SIGN_IN_METHOD="password";wn.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class iu{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class _r extends iu{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class at extends _r{constructor(){super("facebook.com")}static credential(e){return Mt._fromParams({providerId:at.PROVIDER_ID,signInMethod:at.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return at.credentialFromTaggedObject(e)}static credentialFromError(e){return at.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return at.credential(e.oauthAccessToken)}catch{return null}}}at.FACEBOOK_SIGN_IN_METHOD="facebook.com";at.PROVIDER_ID="facebook.com";class ct extends _r{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Mt._fromParams({providerId:ct.PROVIDER_ID,signInMethod:ct.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return ct.credentialFromTaggedObject(e)}static credentialFromError(e){return ct.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return ct.credential(n,r)}catch{return null}}}ct.GOOGLE_SIGN_IN_METHOD="google.com";ct.PROVIDER_ID="google.com";class lt extends _r{constructor(){super("github.com")}static credential(e){return Mt._fromParams({providerId:lt.PROVIDER_ID,signInMethod:lt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return lt.credentialFromTaggedObject(e)}static credentialFromError(e){return lt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return lt.credential(e.oauthAccessToken)}catch{return null}}}lt.GITHUB_SIGN_IN_METHOD="github.com";lt.PROVIDER_ID="github.com";class ut extends _r{constructor(){super("twitter.com")}static credential(e,n){return Mt._fromParams({providerId:ut.PROVIDER_ID,signInMethod:ut.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return ut.credentialFromTaggedObject(e)}static credentialFromError(e){return ut.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return ut.credential(n,r)}catch{return null}}}ut.TWITTER_SIGN_IN_METHOD="twitter.com";ut.PROVIDER_ID="twitter.com";class ln{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){const s=await xe._fromIdTokenResponse(e,r,i),o=Ba(r);return new ln({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=Ba(r);return new ln({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function Ba(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class ai extends It{constructor(e,n,r,i){var s;super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,ai.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new ai(e,n,r,i)}}function su(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?ai._fromErrorAndOperation(t,s,e,r):s})}async function ag(t,e,n=!1){const r=await Xn(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return ln._forOperation(t,"link",r)}async function cg(t,e,n=!1){const{auth:r}=t;if(Oe(r.app))return Promise.reject(pt(r));const i="reauthenticate";try{const s=await Xn(t,su(r,i,e,t),n);H(s.idToken,r,"internal-error");const o=Co(s.idToken);H(o,r,"internal-error");const{sub:a}=o;return H(t.uid===a,r,"user-mismatch"),ln._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&We(r,"user-mismatch"),s}}async function ou(t,e,n=!1){if(Oe(t.app))return Promise.reject(pt(t));const r="signIn",i=await su(t,r,e),s=await ln._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function lg(t,e){return ou(bn(t),e)}async function ug(t){const e=bn(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function KE(t,e,n){return Oe(t.app)?Promise.reject(pt(t)):lg(Ee(t),wn.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&ug(t),r})}function YE(t,e){return Ee(t).setPersistence(e)}function dg(t,e,n,r){return Ee(t).onIdTokenChanged(e,n,r)}function hg(t,e,n){return Ee(t).beforeAuthStateChanged(e,n)}function JE(t,e,n,r){return Ee(t).onAuthStateChanged(e,n,r)}function XE(t){return Ee(t).signOut()}const ci="__sak";class au{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(ci,"1"),this.storage.removeItem(ci),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}const fg=1e3,pg=10;class cu extends au{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Zl(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}const r=e.key;n?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);Mp()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,pg):i()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},fg)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}cu.type="LOCAL";const gg=cu;class lu extends au{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}lu.type="SESSION";const uu=lu;function mg(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}class Wi{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;const r=new Wi(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const a=Array.from(o).map(async l=>l(n.origin,s)),c=await mg(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Wi.receivers=[];function ko(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}class _g{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,n,r=50){const i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((a,c)=>{const l=ko("",20);i.port1.start();const u=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(d){const h=d;if(h.data.eventId===l)switch(h.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(h.data.response);break;default:clearTimeout(u),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}function Be(){return window}function yg(t){Be().location.href=t}function du(){return typeof Be().WorkerGlobalScope<"u"&&typeof Be().importScripts=="function"}async function vg(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function bg(){var t;return((t=navigator?.serviceWorker)===null||t===void 0?void 0:t.controller)||null}function wg(){return du()?self:null}const hu="firebaseLocalStorageDb",Eg=1,li="firebaseLocalStorage",fu="fbase_key";class yr{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Vi(t,e){return t.transaction([li],e?"readwrite":"readonly").objectStore(li)}function Ig(){const t=indexedDB.deleteDatabase(hu);return new yr(t).toPromise()}function Vs(){const t=indexedDB.open(hu,Eg);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(li,{keyPath:fu})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(li)?e(r):(r.close(),await Ig(),e(await Vs()))})})}async function qa(t,e,n){const r=Vi(t,!0).put({[fu]:e,value:n});return new yr(r).toPromise()}async function Cg(t,e){const n=Vi(t,!1).get(e),r=await new yr(n).toPromise();return r===void 0?null:r.value}function za(t,e){const n=Vi(t,!0).delete(e);return new yr(n).toPromise()}const Sg=800,Tg=3;class pu{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Vs(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>Tg)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return du()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Wi._getInstance(wg()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await vg(),!this.activeServiceWorker)return;this.sender=new _g(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((n=r[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||bg()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Vs();return await qa(e,ci,"1"),await za(e,ci),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>qa(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>Cg(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>za(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=Vi(i,!1).getAll();return new yr(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Sg)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}pu.type="LOCAL";const Rg=pu;new mr(3e4,6e4);function kg(t,e){return e?Qe(e):(H(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}class Po extends To{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return rn(e,this._buildIdpRequest())}_linkToIdToken(e,n){return rn(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return rn(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function Pg(t){return ou(t.auth,new Po(t),t.bypassAuthState)}function Ag(t){const{auth:e,user:n}=t;return H(n,e,"internal-error"),cg(n,new Po(t),t.bypassAuthState)}async function Ng(t){const{auth:e,user:n}=t;return H(n,e,"internal-error"),ag(n,new Po(t),t.bypassAuthState)}class gu{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Pg;case"linkViaPopup":case"linkViaRedirect":return Ng;case"reauthViaPopup":case"reauthViaRedirect":return Ag;default:We(this.auth,"internal-error")}}resolve(e){Xe(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Xe(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const Og=new mr(2e3,1e4);class Jt extends gu{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,Jt.currentPopupAction&&Jt.currentPopupAction.cancel(),Jt.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return H(e,this.auth,"internal-error"),e}async onExecution(){Xe(this.filter.length===1,"Popup operations only handle one event");const e=ko();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(Ve(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(Ve(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Jt.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if(!((r=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Ve(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Og.get())};e()}}Jt.currentPopupAction=null;const Dg="pendingRedirect",Kr=new Map;class xg extends gu{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Kr.get(this.auth._key());if(!e){try{const r=await Mg(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Kr.set(this.auth._key(),e)}return this.bypassAuthState||Kr.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function Mg(t,e){const n=Ug(e),r=Fg(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function Lg(t,e){Kr.set(t._key(),e)}function Fg(t){return Qe(t._redirectPersistence)}function Ug(t){return Qr(Dg,t.config.apiKey,t.name)}async function Wg(t,e,n=!1){if(Oe(t.app))return Promise.reject(pt(t));const r=bn(t),i=kg(r,e),o=await new xg(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}const Vg=600*1e3;class Bg{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!qg(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!mu(e)){const i=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";n.onError(Ve(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=Vg&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ha(e))}saveEventToCache(e){this.cachedEventUids.add(Ha(e)),this.lastProcessedEventTime=Date.now()}}function Ha(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function mu({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function qg(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return mu(t);default:return!1}}async function zg(t,e={}){return Ct(t,"GET","/v1/projects",e)}const Hg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,jg=/^https?/;async function $g(t){if(t.config.emulator)return;const{authorizedDomains:e}=await zg(t);for(const n of e)try{if(Gg(n))return}catch{}We(t,"unauthorized-domain")}function Gg(t){const e=Us(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!jg.test(n))return!1;if(Hg.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const Qg=new mr(3e4,6e4);function ja(){const t=Be().___jsl;if(t?.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}}function Kg(t){return new Promise((e,n)=>{var r,i,s;function o(){ja(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{ja(),n(Ve(t,"network-request-failed"))},timeout:Qg.get()})}if(!((i=(r=Be().gapi)===null||r===void 0?void 0:r.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=Be().gapi)===null||s===void 0)&&s.load)o();else{const a=Hp("iframefcb");return Be()[a]=()=>{gapi.load?o():n(Ve(t,"network-request-failed"))},tu(`${zp()}?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw Yr=null,e})}let Yr=null;function Yg(t){return Yr=Yr||Kg(t),Yr}const Jg=new mr(5e3,15e3),Xg="__/auth/iframe",Zg="emulator/auth/iframe",em={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},tm=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function nm(t){const e=t.config;H(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Io(e,Zg):`https://${t.config.authDomain}/${Xg}`,r={apiKey:e.apiKey,appName:t.name,v:vn},i=tm.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${yn(r).slice(1)}`}async function rm(t){const e=await Yg(t),n=Be().gapi;return H(n,t,"internal-error"),e.open({where:document.body,url:nm(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:em,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=Ve(t,"network-request-failed"),a=Be().setTimeout(()=>{s(o)},Jg.get());function c(){Be().clearTimeout(a),i(r)}r.ping(c).then(c,()=>{s(o)})}))}const im={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},sm=500,om=600,am="_blank",cm="http://localhost";class $a{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function lm(t,e,n,r=sm,i=om){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},im),{width:r.toString(),height:i.toString(),top:s,left:o}),l=we().toLowerCase();n&&(a=Ql(l)?am:n),$l(l)&&(e=e||cm,c.scrollbars="yes");const u=Object.entries(c).reduce((h,[p,f])=>`${h}${p}=${f},`,"");if(xp(l)&&a!=="_self")return um(e||"",a),new $a(null);const d=window.open(e||"",a,u);H(d,t,"popup-blocked");try{d.focus()}catch{}return new $a(d)}function um(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}const dm="__/auth/handler",hm="emulator/auth/handler",fm=encodeURIComponent("fac");async function Ga(t,e,n,r,i,s){H(t.config.authDomain,t,"auth-domain-config-required"),H(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:vn,eventId:i};if(e instanceof iu){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",Os(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[u,d]of Object.entries({}))o[u]=d}if(e instanceof _r){const u=e.getScopes().filter(d=>d!=="");u.length>0&&(o.scopes=u.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const u of Object.keys(a))a[u]===void 0&&delete a[u];const c=await t._getAppCheckToken(),l=c?`#${fm}=${encodeURIComponent(c)}`:"";return`${pm(t)}?${yn(a).slice(1)}${l}`}function pm({config:t}){return t.emulator?Io(t,hm):`https://${t.authDomain}/${dm}`}const hs="webStorageSupport";class gm{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=uu,this._completeRedirectFn=Wg,this._overrideRedirectResult=Lg}async _openPopup(e,n,r,i){var s;Xe((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const o=await Ga(e,n,r,Us(),i);return lm(e,o,ko())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await Ga(e,n,r,Us(),i);return yg(s),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(Xe(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await rm(e),r=new Bg(e);return n.register("authEvent",i=>(H(i?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(hs,{type:hs},i=>{var s;const o=(s=i?.[0])===null||s===void 0?void 0:s[hs];o!==void 0&&n(!!o),We(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=$g(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Zl()||Gl()||So()}}const mm=gm;var Qa="@firebase/auth",Ka="1.10.8";class _m{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){H(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function ym(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function vm(t){cn(new xt("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;H(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:eu(t)},l=new Vp(r,i,s,c);return Yp(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),cn(new xt("auth-internal",e=>{const n=bn(e.getProvider("auth").getImmediate());return(r=>new _m(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),ft(Qa,Ka,ym(t)),ft(Qa,Ka,"esm2017")}const bm=300,wm=Tl("authIdTokenMaxAge")||bm;let Ya=null;const Em=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>wm)return;const i=n?.token;Ya!==i&&(Ya=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function Im(t=Ml()){const e=bo(t,"auth");if(e.isInitialized())return e.getImmediate();const n=Kp(t,{popupRedirectResolver:mm,persistence:[Rg,gg,uu]}),r=Tl("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=Em(s.toString());hg(n,o,()=>o(n.currentUser)),dg(n,a=>o(a))}}const i=Cl("auth");return i&&Jp(n,`http://${i}`),n}function Cm(){var t,e;return(e=(t=document.getElementsByTagName("head"))===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:document}Bp({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=Ve("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",Cm().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});vm("Browser");var Ja={};const Xa="@firebase/database",Za="1.0.20";let _u="";function Sm(t){_u=t}class Tm{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,n){n==null?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),ue(n))}get(e){const n=this.domStorage_.getItem(this.prefixedName_(e));return n==null?null:Yn(n)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}}class Rm{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,n){n==null?delete this.cache_[e]:this.cache_[e]=n}get(e){return nt(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}}const yu=function(t){try{if(typeof window<"u"&&typeof window[t]<"u"){const e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new Tm(e)}}catch{}return new Rm},Ot=yu("localStorage"),km=yu("sessionStorage");const sn=new yo("@firebase/database"),Pm=(function(){let t=1;return function(){return t++}})(),vu=function(t){const e=nf(t),n=new Xh;n.update(e);const r=n.digest();return po.encodeByteArray(r)},vr=function(...t){let e="";for(let n=0;n<t.length;n++){const r=t[n];Array.isArray(r)||r&&typeof r=="object"&&typeof r.length=="number"?e+=vr.apply(null,r):typeof r=="object"?e+=ue(r):e+=r,e+=" "}return e};let Bn=null,ec=!0;const Am=function(t,e){D(!0,"Can't turn on custom loggers persistently."),sn.logLevel=ne.VERBOSE,Bn=sn.log.bind(sn)},ve=function(...t){if(ec===!0&&(ec=!1,Bn===null&&km.get("logging_enabled")===!0&&Am()),Bn){const e=vr.apply(null,t);Bn(e)}},br=function(t){return function(...e){ve(t,...e)}},Bs=function(...t){const e="FIREBASE INTERNAL ERROR: "+vr(...t);sn.error(e)},Ze=function(...t){const e=`FIREBASE FATAL ERROR: ${vr(...t)}`;throw sn.error(e),new Error(e)},Re=function(...t){const e="FIREBASE WARNING: "+vr(...t);sn.warn(e)},Nm=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&Re("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},bu=function(t){return typeof t=="number"&&(t!==t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)},Om=function(t){if(document.readyState==="complete")t();else{let e=!1;const n=function(){if(!document.body){setTimeout(n,Math.floor(10));return}e||(e=!0,t())};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&n()}),window.attachEvent("onload",n))}},un="[MIN_NAME]",Lt="[MAX_NAME]",En=function(t,e){if(t===e)return 0;if(t===un||e===Lt)return-1;if(e===un||t===Lt)return 1;{const n=tc(t),r=tc(e);return n!==null?r!==null?n-r===0?t.length-e.length:n-r:-1:r!==null?1:t<e?-1:1}},Dm=function(t,e){return t===e?0:t<e?-1:1},Tn=function(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+ue(e))},Ao=function(t){if(typeof t!="object"||t===null)return ue(t);const e=[];for(const r in t)e.push(r);e.sort();let n="{";for(let r=0;r<e.length;r++)r!==0&&(n+=","),n+=ue(e[r]),n+=":",n+=Ao(t[e[r]]);return n+="}",n},wu=function(t,e){const n=t.length;if(n<=e)return[t];const r=[];for(let i=0;i<n;i+=e)i+e>n?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r};function Se(t,e){for(const n in t)t.hasOwnProperty(n)&&e(n,t[n])}const Eu=function(t){D(!bu(t),"Invalid JSON number");const e=11,n=52,r=(1<<e-1)-1;let i,s,o,a,c;t===0?(s=0,o=0,i=1/t===-1/0?1:0):(i=t<0,t=Math.abs(t),t>=Math.pow(2,1-r)?(a=Math.min(Math.floor(Math.log(t)/Math.LN2),r),s=a+r,o=Math.round(t*Math.pow(2,n-a)-Math.pow(2,n))):(s=0,o=Math.round(t/Math.pow(2,1-r-n))));const l=[];for(c=n;c;c-=1)l.push(o%2?1:0),o=Math.floor(o/2);for(c=e;c;c-=1)l.push(s%2?1:0),s=Math.floor(s/2);l.push(i?1:0),l.reverse();const u=l.join("");let d="";for(c=0;c<64;c+=8){let h=parseInt(u.substr(c,8),2).toString(16);h.length===1&&(h="0"+h),d=d+h}return d.toLowerCase()},xm=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},Mm=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function Lm(t,e){let n="Unknown Error";t==="too_big"?n="The data requested exceeds the maximum size that can be accessed with a single request.":t==="permission_denied"?n="Client doesn't have permission to access the desired data.":t==="unavailable"&&(n="The service is unavailable");const r=new Error(t+" at "+e._path.toString()+": "+n);return r.code=t.toUpperCase(),r}const Fm=new RegExp("^-?(0*)\\d{1,10}$"),Um=-2147483648,Wm=2147483647,tc=function(t){if(Fm.test(t)){const e=Number(t);if(e>=Um&&e<=Wm)return e}return null},wr=function(t){try{t()}catch(e){setTimeout(()=>{const n=e.stack||"";throw Re("Exception was thrown by user callback.",n),e},Math.floor(0))}},Vm=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},qn=function(t,e){const n=setTimeout(t,e);return typeof n=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(n):typeof n=="object"&&n.unref&&n.unref(),n};class Bm{constructor(e,n){this.appCheckProvider=n,this.appName=e.name,Oe(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=n?.getImmediate({optional:!0}),this.appCheck||n?.get().then(r=>this.appCheck=r)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((n,r)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(n,r):n(null)},0)})}addTokenChangeListener(e){var n;(n=this.appCheckProvider)===null||n===void 0||n.get().then(r=>r.addTokenListener(e))}notifyForInvalidToken(){Re(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}}class qm{constructor(e,n,r){this.appName_=e,this.firebaseOptions_=n,this.authProvider_=r,this.auth_=null,this.auth_=r.getImmediate({optional:!0}),this.auth_||r.onInit(i=>this.auth_=i)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(n=>n&&n.code==="auth/token-not-initialized"?(ve("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(n)):new Promise((n,r)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(n,r):n(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(n=>n.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(n=>n.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Re(e)}}class Jr{constructor(e){this.accessToken=e}getToken(e){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(e){e(this.accessToken)}removeTokenChangeListener(e){}notifyForInvalidToken(){}}Jr.OWNER="owner";const No="5",Iu="v",Cu="s",Su="r",Tu="f",Ru=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,ku="ls",Pu="p",qs="ac",Au="websocket",Nu="long_polling";class Ou{constructor(e,n,r,i,s=!1,o="",a=!1,c=!1,l=null){this.secure=n,this.namespace=r,this.webSocketOnly=i,this.nodeAdmin=s,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this.isUsingEmulator=c,this.emulatorOptions=l,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Ot.get("host:"+e)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&Ot.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){const e=this.secure?"https://":"http://",n=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${n}`}}function zm(t){return t.host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams}function Du(t,e,n){D(typeof e=="string","typeof type must == string"),D(typeof n=="object","typeof params must == object");let r;if(e===Au)r=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else if(e===Nu)r=(t.secure?"https://":"http://")+t.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+e);zm(t)&&(n.ns=t.namespace);const i=[];return Se(n,(s,o)=>{i.push(s+"="+o)}),r+i.join("&")}class Hm{constructor(){this.counters_={}}incrementCounter(e,n=1){nt(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=n}get(){return Nh(this.counters_)}}const fs={},ps={};function Oo(t){const e=t.toString();return fs[e]||(fs[e]=new Hm),fs[e]}function jm(t,e){const n=t.toString();return ps[n]||(ps[n]=e()),ps[n]}class $m{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,n){this.closeAfterResponse=e,this.onClose=n,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,n){for(this.pendingResponses[e]=n;this.pendingResponses[this.currentResponseNum];){const r=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let i=0;i<r.length;++i)r[i]&&wr(()=>{this.onMessage_(r[i])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}const nc="start",Gm="close",Qm="pLPCommand",Km="pRTLPCB",xu="id",Mu="pw",Lu="ser",Ym="cb",Jm="seg",Xm="ts",Zm="d",e_="dframe",Fu=1870,Uu=30,t_=Fu-Uu,n_=25e3,r_=3e4;class Xt{constructor(e,n,r,i,s,o,a){this.connId=e,this.repoInfo=n,this.applicationId=r,this.appCheckToken=i,this.authToken=s,this.transportSessionId=o,this.lastSessionId=a,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=br(e),this.stats_=Oo(n),this.urlFn=c=>(this.appCheckToken&&(c[qs]=this.appCheckToken),Du(n,Nu,c))}open(e,n){this.curSegmentNum=0,this.onDisconnect_=n,this.myPacketOrderer=new $m(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(r_)),Om(()=>{if(this.isClosed_)return;this.scriptTagHolder=new Do((...s)=>{const[o,a,c,l,u]=s;if(this.incrementIncomingBytes_(s),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,o===nc)this.id=a,this.password=c;else if(o===Gm)a?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(a,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+o)},(...s)=>{const[o,a]=s;this.incrementIncomingBytes_(s),this.myPacketOrderer.handleResponse(o,a)},()=>{this.onClosed_()},this.urlFn);const r={};r[nc]="t",r[Lu]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(r[Ym]=this.scriptTagHolder.uniqueCallbackIdentifier),r[Iu]=No,this.transportSessionId&&(r[Cu]=this.transportSessionId),this.lastSessionId&&(r[ku]=this.lastSessionId),this.applicationId&&(r[Pu]=this.applicationId),this.appCheckToken&&(r[qs]=this.appCheckToken),typeof location<"u"&&location.hostname&&Ru.test(location.hostname)&&(r[Su]=Tu);const i=this.urlFn(r);this.log_("Connecting via long-poll to "+i),this.scriptTagHolder.addTag(i,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){Xt.forceAllow_=!0}static forceDisallow(){Xt.forceDisallow_=!0}static isAvailable(){return Xt.forceAllow_?!0:!Xt.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!xm()&&!Mm()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){const n=ue(e);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);const r=El(n),i=wu(r,t_);for(let s=0;s<i.length;s++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[s]),this.curSegmentNum++}addDisconnectPingFrame(e,n){this.myDisconnFrame=document.createElement("iframe");const r={};r[e_]="t",r[xu]=e,r[Mu]=n,this.myDisconnFrame.src=this.urlFn(r),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){const n=ue(e).length;this.bytesReceived+=n,this.stats_.incrementCounter("bytes_received",n)}}class Do{constructor(e,n,r,i){this.onDisconnect=r,this.urlFn=i,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0;{this.uniqueCallbackIdentifier=Pm(),window[Qm+this.uniqueCallbackIdentifier]=e,window[Km+this.uniqueCallbackIdentifier]=n,this.myIFrame=Do.createIFrame_();let s="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(s='<script>document.domain="'+document.domain+'";<\/script>');const o="<html><body>"+s+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(a){ve("frame writing exception"),a.stack&&ve(a.stack),ve(a)}}}static createIFrame_(){const e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||ve("No IE domain setting required")}catch{const r=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+r+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,n){for(this.myID=e,this.myPW=n,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const e={};e[xu]=this.myID,e[Mu]=this.myPW,e[Lu]=this.currentSerial;let n=this.urlFn(e),r="",i=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+Uu+r.length<=Fu;){const o=this.pendingSegs.shift();r=r+"&"+Jm+i+"="+o.seg+"&"+Xm+i+"="+o.ts+"&"+Zm+i+"="+o.d,i++}return n=n+r,this.addLongPollTag_(n,this.currentSerial),!0}else return!1}enqueueSegment(e,n,r){this.pendingSegs.push({seg:e,ts:n,d:r}),this.alive&&this.newRequest_()}addLongPollTag_(e,n){this.outstandingRequests.add(n);const r=()=>{this.outstandingRequests.delete(n),this.newRequest_()},i=setTimeout(r,Math.floor(n_)),s=()=>{clearTimeout(i),r()};this.addTag(e,s)}addTag(e,n){setTimeout(()=>{try{if(!this.sendNewPolls)return;const r=this.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=e,r.onload=r.onreadystatechange=function(){const i=r.readyState;(!i||i==="loaded"||i==="complete")&&(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),n())},r.onerror=()=>{ve("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(r)}catch{}},Math.floor(1))}}const i_=16384,s_=45e3;let ui=null;typeof MozWebSocket<"u"?ui=MozWebSocket:typeof WebSocket<"u"&&(ui=WebSocket);class De{constructor(e,n,r,i,s,o,a){this.connId=e,this.applicationId=r,this.appCheckToken=i,this.authToken=s,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=br(this.connId),this.stats_=Oo(n),this.connURL=De.connectionURL_(n,o,a,i,r),this.nodeAdmin=n.nodeAdmin}static connectionURL_(e,n,r,i,s){const o={};return o[Iu]=No,typeof location<"u"&&location.hostname&&Ru.test(location.hostname)&&(o[Su]=Tu),n&&(o[Cu]=n),r&&(o[ku]=r),i&&(o[qs]=i),s&&(o[Pu]=s),Du(e,Au,o)}open(e,n){this.onDisconnect=n,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Ot.set("previous_websocket_failure",!0);try{let r;Hh(),this.mySock=new ui(this.connURL,[],r)}catch(r){this.log_("Error instantiating WebSocket.");const i=r.message||r.data;i&&this.log_(i),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=r=>{this.handleIncomingFrame(r)},this.mySock.onerror=r=>{this.log_("WebSocket error. Closing connection.");const i=r.message||r.data;i&&this.log_(i),this.onClosed_()}}start(){}static forceDisallow(){De.forceDisallow_=!0}static isAvailable(){let e=!1;if(typeof navigator<"u"&&navigator.userAgent){const n=/Android ([0-9]{0,}\.[0-9]{0,})/,r=navigator.userAgent.match(n);r&&r.length>1&&parseFloat(r[1])<4.4&&(e=!0)}return!e&&ui!==null&&!De.forceDisallow_}static previouslyFailed(){return Ot.isInMemoryStorage||Ot.get("previous_websocket_failure")===!0}markConnectionHealthy(){Ot.remove("previous_websocket_failure")}appendFrame_(e){if(this.frames.push(e),this.frames.length===this.totalFrames){const n=this.frames.join("");this.frames=null;const r=Yn(n);this.onMessage(r)}}handleNewFrameCount_(e){this.totalFrames=e,this.frames=[]}extractFrameCount_(e){if(D(this.frames===null,"We already have a frame buffer"),e.length<=6){const n=Number(e);if(!isNaN(n))return this.handleNewFrameCount_(n),null}return this.handleNewFrameCount_(1),e}handleIncomingFrame(e){if(this.mySock===null)return;const n=e.data;if(this.bytesReceived+=n.length,this.stats_.incrementCounter("bytes_received",n.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(n);else{const r=this.extractFrameCount_(n);r!==null&&this.appendFrame_(r)}}send(e){this.resetKeepAlive();const n=ue(e);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);const r=wu(n,i_);r.length>1&&this.sendString_(String(r.length));for(let i=0;i<r.length;i++)this.sendString_(r[i])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(s_))}sendString_(e){try{this.mySock.send(e)}catch(n){this.log_("Exception thrown from WebSocket.send():",n.message||n.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}De.responsesRequiredToBeHealthy=2;De.healthyTimeout=3e4;class er{static get ALL_TRANSPORTS(){return[Xt,De]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(e){this.initTransports_(e)}initTransports_(e){const n=De&&De.isAvailable();let r=n&&!De.previouslyFailed();if(e.webSocketOnly&&(n||Re("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),r=!0),r)this.transports_=[De];else{const i=this.transports_=[];for(const s of er.ALL_TRANSPORTS)s&&s.isAvailable()&&i.push(s);er.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}er.globalTransportInitialized_=!1;const o_=6e4,a_=5e3,c_=10*1024,l_=100*1024,gs="t",rc="d",u_="s",ic="r",d_="e",sc="o",oc="a",ac="n",cc="p",h_="h";class f_{constructor(e,n,r,i,s,o,a,c,l,u){this.id=e,this.repoInfo_=n,this.applicationId_=r,this.appCheckToken_=i,this.authToken_=s,this.onMessage_=o,this.onReady_=a,this.onDisconnect_=c,this.onKill_=l,this.lastSessionId=u,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=br("c:"+this.id+":"),this.transportManager_=new er(n),this.log_("Connection created"),this.start_()}start_(){const e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(n,r)},Math.floor(0));const i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=qn(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>l_?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>c_?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(i)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return n=>{e===this.conn_?this.onConnectionLost_(n):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return n=>{this.state_!==2&&(e===this.rx_?this.onPrimaryMessageReceived_(n):e===this.secondaryConn_?this.onSecondaryMessageReceived_(n):this.log_("message on old connection"))}}sendRequest(e){const n={t:"d",d:e};this.sendData_(n)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if(gs in e){const n=e[gs];n===oc?this.upgradeIfSecondaryHealthy_():n===ic?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):n===sc&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){const n=Tn("t",e),r=Tn("d",e);if(n==="c")this.onSecondaryControl_(r);else if(n==="d")this.pendingDataMessages.push(r);else throw new Error("Unknown protocol layer: "+n)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:cc,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:oc,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:ac,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){const n=Tn("t",e),r=Tn("d",e);n==="c"?this.onControl_(r):n==="d"&&this.onDataMessage_(r)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){const n=Tn(gs,e);if(rc in e){const r=e[rc];if(n===h_){const i=Object.assign({},r);this.repoInfo_.isUsingEmulator&&(i.h=this.repoInfo_.host),this.onHandshake_(i)}else if(n===ac){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let i=0;i<this.pendingDataMessages.length;++i)this.onDataMessage_(this.pendingDataMessages[i]);this.pendingDataMessages=[],this.tryCleanupConnection()}else n===u_?this.onConnectionShutdown_(r):n===ic?this.onReset_(r):n===d_?Bs("Server Error: "+r):n===sc?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):Bs("Unknown control packet command: "+n)}}onHandshake_(e){const n=e.ts,r=e.v,i=e.h;this.sessionId=e.s,this.repoInfo_.host=i,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,n),No!==r&&Re("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){const e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;const n=this.connReceiver_(this.secondaryConn_),r=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,r),qn(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(o_))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,n){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(n,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):qn(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(a_))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:cc,d:{}}}))}onSecondaryConnectionLost_(){const e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,!e&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(Ot.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(e)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}class Wu{put(e,n,r,i){}merge(e,n,r,i){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,n,r){}onDisconnectMerge(e,n,r){}onDisconnectCancel(e,n){}reportStats(e){}}class Vu{constructor(e){this.allowedEvents_=e,this.listeners_={},D(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...n){if(Array.isArray(this.listeners_[e])){const r=[...this.listeners_[e]];for(let i=0;i<r.length;i++)r[i].callback.apply(r[i].context,n)}}on(e,n,r){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:n,context:r});const i=this.getInitialEvent(e);i&&n.apply(r,i)}off(e,n,r){this.validateEventType_(e);const i=this.listeners_[e]||[];for(let s=0;s<i.length;s++)if(i[s].callback===n&&(!r||r===i[s].context)){i.splice(s,1);return}}validateEventType_(e){D(this.allowedEvents_.find(n=>n===e),"Unknown event: "+e)}}class di extends Vu{static getInstance(){return new di}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!_o()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(e){return D(e==="online","Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}}const lc=32,uc=768;class ie{constructor(e,n){if(n===void 0){this.pieces_=e.split("/");let r=0;for(let i=0;i<this.pieces_.length;i++)this.pieces_[i].length>0&&(this.pieces_[r]=this.pieces_[i],r++);this.pieces_.length=r,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=n}toString(){let e="";for(let n=this.pieceNum_;n<this.pieces_.length;n++)this.pieces_[n]!==""&&(e+="/"+this.pieces_[n]);return e||"/"}}function Z(){return new ie("")}function X(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function _t(t){return t.pieces_.length-t.pieceNum_}function se(t){let e=t.pieceNum_;return e<t.pieces_.length&&e++,new ie(t.pieces_,e)}function Bu(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function p_(t){let e="";for(let n=t.pieceNum_;n<t.pieces_.length;n++)t.pieces_[n]!==""&&(e+="/"+encodeURIComponent(String(t.pieces_[n])));return e||"/"}function qu(t,e=0){return t.pieces_.slice(t.pieceNum_+e)}function zu(t){if(t.pieceNum_>=t.pieces_.length)return null;const e=[];for(let n=t.pieceNum_;n<t.pieces_.length-1;n++)e.push(t.pieces_[n]);return new ie(e,0)}function de(t,e){const n=[];for(let r=t.pieceNum_;r<t.pieces_.length;r++)n.push(t.pieces_[r]);if(e instanceof ie)for(let r=e.pieceNum_;r<e.pieces_.length;r++)n.push(e.pieces_[r]);else{const r=e.split("/");for(let i=0;i<r.length;i++)r[i].length>0&&n.push(r[i])}return new ie(n,0)}function J(t){return t.pieceNum_>=t.pieces_.length}function be(t,e){const n=X(t),r=X(e);if(n===null)return e;if(n===r)return be(se(t),se(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function Hu(t,e){if(_t(t)!==_t(e))return!1;for(let n=t.pieceNum_,r=e.pieceNum_;n<=t.pieces_.length;n++,r++)if(t.pieces_[n]!==e.pieces_[r])return!1;return!0}function Me(t,e){let n=t.pieceNum_,r=e.pieceNum_;if(_t(t)>_t(e))return!1;for(;n<t.pieces_.length;){if(t.pieces_[n]!==e.pieces_[r])return!1;++n,++r}return!0}class g_{constructor(e,n){this.errorPrefix_=n,this.parts_=qu(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let r=0;r<this.parts_.length;r++)this.byteLength_+=Li(this.parts_[r]);ju(this)}}function m_(t,e){t.parts_.length>0&&(t.byteLength_+=1),t.parts_.push(e),t.byteLength_+=Li(e),ju(t)}function __(t){const e=t.parts_.pop();t.byteLength_-=Li(e),t.parts_.length>0&&(t.byteLength_-=1)}function ju(t){if(t.byteLength_>uc)throw new Error(t.errorPrefix_+"has a key path longer than "+uc+" bytes ("+t.byteLength_+").");if(t.parts_.length>lc)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+lc+") or object contains a cycle "+At(t))}function At(t){return t.parts_.length===0?"":"in property '"+t.parts_.join(".")+"'"}class xo extends Vu{static getInstance(){return new xo}constructor(){super(["visible"]);let e,n;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(n="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(n="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(n="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(n="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,n&&document.addEventListener(n,()=>{const r=!document[e];r!==this.visible_&&(this.visible_=r,this.trigger("visible",r))},!1)}getInitialEvent(e){return D(e==="visible","Unknown event type: "+e),[this.visible_]}}const Rn=1e3,y_=300*1e3,dc=30*1e3,v_=1.3,b_=3e4,w_="server_kill",hc=3;class Ye extends Wu{constructor(e,n,r,i,s,o,a,c){if(super(),this.repoInfo_=e,this.applicationId_=n,this.onDataUpdate_=r,this.onConnectStatus_=i,this.onServerInfoUpdate_=s,this.authTokenProvider_=o,this.appCheckTokenProvider_=a,this.authOverride_=c,this.id=Ye.nextPersistentConnectionId_++,this.log_=br("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=Rn,this.maxReconnectDelay_=y_,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,c)throw new Error("Auth override specified in options, but not supported on non Node.js platforms");xo.getInstance().on("visible",this.onVisible_,this),e.host.indexOf("fblocal")===-1&&di.getInstance().on("online",this.onOnline_,this)}sendRequest(e,n,r){const i=++this.requestNumber_,s={r:i,a:e,b:n};this.log_(ue(s)),D(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(s),r&&(this.requestCBHash_[i]=r)}get(e){this.initConnection_();const n=new mo,i={action:"g",request:{p:e._path.toString(),q:e._queryObject},onComplete:o=>{const a=o.d;o.s==="ok"?n.resolve(a):n.reject(a)}};this.outstandingGets_.push(i),this.outstandingGetCount_++;const s=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(s),n.promise}listen(e,n,r,i){this.initConnection_();const s=e._queryIdentifier,o=e._path.toString();this.log_("Listen called for "+o+" "+s),this.listens.has(o)||this.listens.set(o,new Map),D(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"listen() called for non-default but complete query"),D(!this.listens.get(o).has(s),"listen() called twice for same path/queryId.");const a={onComplete:i,hashFn:n,query:e,tag:r};this.listens.get(o).set(s,a),this.connected_&&this.sendListen_(a)}sendGet_(e){const n=this.outstandingGets_[e];this.sendRequest("g",n.request,r=>{delete this.outstandingGets_[e],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),n.onComplete&&n.onComplete(r)})}sendListen_(e){const n=e.query,r=n._path.toString(),i=n._queryIdentifier;this.log_("Listen on "+r+" for "+i);const s={p:r},o="q";e.tag&&(s.q=n._queryObject,s.t=e.tag),s.h=e.hashFn(),this.sendRequest(o,s,a=>{const c=a.d,l=a.s;Ye.warnOnListenWarnings_(c,n),(this.listens.get(r)&&this.listens.get(r).get(i))===e&&(this.log_("listen response",a),l!=="ok"&&this.removeListen_(r,i),e.onComplete&&e.onComplete(l,c))})}static warnOnListenWarnings_(e,n){if(e&&typeof e=="object"&&nt(e,"w")){const r=an(e,"w");if(Array.isArray(r)&&~r.indexOf("no_index")){const i='".indexOn": "'+n._queryParams.getIndex().toString()+'"',s=n._path.toString();Re(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${i} at ${s} to your security rules for better performance.`)}}}refreshAuthToken(e){this.authToken_=e,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(e)}reduceReconnectDelayIfAdminCredential_(e){(e&&e.length===40||Jh(e))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=dc)}refreshAppCheckToken(e){this.appCheckToken_=e,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const e=this.authToken_,n=Yh(e)?"auth":"gauth",r={cred:e};this.authOverride_===null?r.noauth=!0:typeof this.authOverride_=="object"&&(r.authvar=this.authOverride_),this.sendRequest(n,r,i=>{const s=i.s,o=i.d||"error";this.authToken_===e&&(s==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(s,o))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},e=>{const n=e.s,r=e.d||"error";n==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(n,r)})}unlisten(e,n){const r=e._path.toString(),i=e._queryIdentifier;this.log_("Unlisten called for "+r+" "+i),D(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(r,i)&&this.connected_&&this.sendUnlisten_(r,i,e._queryObject,n)}sendUnlisten_(e,n,r,i){this.log_("Unlisten on "+e+" for "+n);const s={p:e},o="n";i&&(s.q=r,s.t=i),this.sendRequest(o,s)}onDisconnectPut(e,n,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",e,n,r):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:n,onComplete:r})}onDisconnectMerge(e,n,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",e,n,r):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:n,onComplete:r})}onDisconnectCancel(e,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",e,null,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:n})}sendOnDisconnect_(e,n,r,i){const s={p:n,d:r};this.log_("onDisconnect "+e,s),this.sendRequest(e,s,o=>{i&&setTimeout(()=>{i(o.s,o.d)},Math.floor(0))})}put(e,n,r,i){this.putInternal("p",e,n,r,i)}merge(e,n,r,i){this.putInternal("m",e,n,r,i)}putInternal(e,n,r,i,s){this.initConnection_();const o={p:n,d:r};s!==void 0&&(o.h=s),this.outstandingPuts_.push({action:e,request:o,onComplete:i}),this.outstandingPutCount_++;const a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+n)}sendPut_(e){const n=this.outstandingPuts_[e].action,r=this.outstandingPuts_[e].request,i=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(n,r,s=>{this.log_(n+" response",s),delete this.outstandingPuts_[e],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),i&&i(s.s,s.d)})}reportStats(e){if(this.connected_){const n={c:e};this.log_("reportStats",n),this.sendRequest("s",n,r=>{if(r.s!=="ok"){const s=r.d;this.log_("reportStats","Error sending stats: "+s)}})}}onDataMessage_(e){if("r"in e){this.log_("from server: "+ue(e));const n=e.r,r=this.requestCBHash_[n];r&&(delete this.requestCBHash_[n],r(e.b))}else{if("error"in e)throw"A server-side error has occurred: "+e.error;"a"in e&&this.onDataPush_(e.a,e.b)}}onDataPush_(e,n){this.log_("handleServerMessage",e,n),e==="d"?this.onDataUpdate_(n.p,n.d,!1,n.t):e==="m"?this.onDataUpdate_(n.p,n.d,!0,n.t):e==="c"?this.onListenRevoked_(n.p,n.q):e==="ac"?this.onAuthRevoked_(n.s,n.d):e==="apc"?this.onAppCheckRevoked_(n.s,n.d):e==="sd"?this.onSecurityDebugPacket_(n):Bs("Unrecognized action received from server: "+ue(e)+`
16
16
  Are you using the latest client?`)}onReady_(e,n){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=n,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){D(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(e))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=Rn,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=Rn,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>b_&&(this.reconnectDelay_=Rn),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const e=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_);let n=Math.max(0,this.reconnectDelay_-e);n=Math.random()*n,this.log_("Trying to reconnect in "+n+"ms"),this.scheduleConnect_(n),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*v_)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const e=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+Ye.nextConnectionId_++,s=this.lastSessionId;let o=!1,a=null;const c=function(){a?a.close():(o=!0,r())},l=function(d){D(a,"sendRequest call when we're not connected not allowed."),a.sendRequest(d)};this.realtime_={close:c,sendRequest:l};const u=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[d,h]=await Promise.all([this.authTokenProvider_.getToken(u),this.appCheckTokenProvider_.getToken(u)]);o?ve("getToken() completed but was canceled"):(ve("getToken() completed. Creating connection."),this.authToken_=d&&d.accessToken,this.appCheckToken_=h&&h.token,a=new f_(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,e,n,r,p=>{Re(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(w_)},s))}catch(d){this.log_("Failed to get token: "+d),o||(this.repoInfo_.nodeAdmin&&Re(d),c())}}}interrupt(e){ve("Interrupting connection for reason: "+e),this.interruptReasons_[e]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(e){ve("Resuming connection for reason: "+e),delete this.interruptReasons_[e],Os(this.interruptReasons_)&&(this.reconnectDelay_=Rn,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(e){const n=e-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:n})}cancelSentTransactions_(){for(let e=0;e<this.outstandingPuts_.length;e++){const n=this.outstandingPuts_[e];n&&"h"in n.request&&n.queued&&(n.onComplete&&n.onComplete("disconnect"),delete this.outstandingPuts_[e],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(e,n){let r;n?r=n.map(s=>Ao(s)).join("$"):r="default";const i=this.removeListen_(e,r);i&&i.onComplete&&i.onComplete("permission_denied")}removeListen_(e,n){const r=new ie(e).toString();let i;if(this.listens.has(r)){const s=this.listens.get(r);i=s.get(n),s.delete(n),s.size===0&&this.listens.delete(r)}else i=void 0;return i}onAuthRevoked_(e,n){ve("Auth token revoked: "+e+"/"+n),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(e==="invalid_token"||e==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=hc&&(this.reconnectDelay_=dc,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(e,n){ve("App check token revoked: "+e+"/"+n),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(e==="invalid_token"||e==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=hc&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace(`
17
17
  `,`
18
- FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of this.listens.values())for(const n of e.values())this.sendListen_(n);for(let e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){const e=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(e.action,e.pathString,e.data,e.onComplete)}for(let e=0;e<this.outstandingGets_.length;e++)this.outstandingGets_[e]&&this.sendGet_(e)}sendConnectStats_(){const e={};let n="js";e["sdk."+n+"."+_u.replace(/\./g,"-")]=1,_o()?e["framework.cordova"]=1:Pl()&&(e["framework.reactnative"]=1),this.reportStats(e)}shouldReconnect_(){const e=di.getInstance().currentlyOnline();return Os(this.interruptReasons_)&&e}}Ye.nextPersistentConnectionId_=0;Ye.nextConnectionId_=0;class K{constructor(e,n){this.name=e,this.node=n}static Wrap(e,n){return new K(e,n)}}class Bi{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,n){const r=new K(un,e),i=new K(un,n);return this.compare(r,i)!==0}minPost(){return K.MIN}}let Mr;class $u extends Bi{static get __EMPTY_NODE(){return Mr}static set __EMPTY_NODE(e){Mr=e}compare(e,n){return En(e.name,n.name)}isDefinedOn(e){throw mn("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,n){return!1}minPost(){return K.MIN}maxPost(){return new K(Lt,Mr)}makePost(e,n){return D(typeof e=="string","KeyIndex indexValue must always be a string."),new K(e,Mr)}toString(){return".key"}}const on=new $u;class Lr{constructor(e,n,r,i,s=null){this.isReverse_=i,this.resultGenerator_=s,this.nodeStack_=[];let o=1;for(;!e.isEmpty();)if(e=e,o=n?r(e.key,n):1,i&&(o*=-1),o<0)this.isReverse_?e=e.left:e=e.right;else if(o===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),n;if(this.resultGenerator_?n=this.resultGenerator_(e.key,e.value):n={key:e.key,value:e.value},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 n}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;const e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class pe{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??pe.RED,this.left=i??Ce.EMPTY_NODE,this.right=s??Ce.EMPTY_NODE}copy(e,n,r,i,s){return new pe(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}count(){return this.left.count()+1+this.right.count()}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,n,r){let i=this;const s=r(e,i.key);return s<0?i=i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i=i.copy(null,n,null,null,null):i=i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp_()}removeMin_(){if(this.left.isEmpty())return Ce.EMPTY_NODE;let e=this;return!e.left.isRed_()&&!e.left.left.isRed_()&&(e=e.moveRedLeft_()),e=e.copy(null,null,null,e.left.removeMin_(),null),e.fixUp_()}remove(e,n){let r,i;if(r=this,n(e,r.key)<0)!r.left.isEmpty()&&!r.left.isRed_()&&!r.left.left.isRed_()&&(r=r.moveRedLeft_()),r=r.copy(null,null,null,r.left.remove(e,n),null);else{if(r.left.isRed_()&&(r=r.rotateRight_()),!r.right.isEmpty()&&!r.right.isRed_()&&!r.right.left.isRed_()&&(r=r.moveRedRight_()),n(e,r.key)===0){if(r.right.isEmpty())return Ce.EMPTY_NODE;i=r.right.min_(),r=r.copy(i.key,i.value,null,null,r.right.removeMin_())}r=r.copy(null,null,null,null,r.right.remove(e,n))}return r.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_(){const e=this.copy(null,null,pe.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight_(){const e=this.copy(null,null,pe.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip_(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth_(){const e=this.check_();return Math.pow(2,e)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const e=this.left.check_();if(e!==this.right.check_())throw new Error("Black depths differ");return e+(this.isRed_()?0:1)}}pe.RED=!0;pe.BLACK=!1;class E_{copy(e,n,r,i,s){return this}insert(e,n,r){return new pe(e,n,null)}remove(e,n){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class Ce{constructor(e,n=Ce.EMPTY_NODE){this.comparator_=e,this.root_=n}insert(e,n){return new Ce(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,pe.BLACK,null,null))}remove(e){return new Ce(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,pe.BLACK,null,null))}get(e){let n,r=this.root_;for(;!r.isEmpty();){if(n=this.comparator_(e,r.key),n===0)return r.value;n<0?r=r.left:n>0&&(r=r.right)}return null}getPredecessorKey(e){let n,r=this.root_,i=null;for(;!r.isEmpty();)if(n=this.comparator_(e,r.key),n===0){if(r.left.isEmpty())return i?i.key:null;for(r=r.left;!r.right.isEmpty();)r=r.right;return r.key}else n<0?r=r.left:n>0&&(i=r,r=r.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new Lr(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,n){return new Lr(this.root_,e,this.comparator_,!1,n)}getReverseIteratorFrom(e,n){return new Lr(this.root_,e,this.comparator_,!0,n)}getReverseIterator(e){return new Lr(this.root_,null,this.comparator_,!0,e)}}Ce.EMPTY_NODE=new E_;function I_(t,e){return En(t.name,e.name)}function Mo(t,e){return En(t,e)}let zs;function C_(t){zs=t}const Gu=function(t){return typeof t=="number"?"number:"+Eu(t):"string:"+t},Qu=function(t){if(t.isLeafNode()){const e=t.val();D(typeof e=="string"||typeof e=="number"||typeof e=="object"&&nt(e,".sv"),"Priority must be a string or number.")}else D(t===zs||t.isEmpty(),"priority of unexpected type.");D(t===zs||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};let fc;class fe{static set __childrenNodeConstructor(e){fc=e}static get __childrenNodeConstructor(){return fc}constructor(e,n=fe.__childrenNodeConstructor.EMPTY_NODE){this.value_=e,this.priorityNode_=n,this.lazyHash_=null,D(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),Qu(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(e){return new fe(this.value_,e)}getImmediateChild(e){return e===".priority"?this.priorityNode_:fe.__childrenNodeConstructor.EMPTY_NODE}getChild(e){return J(e)?this:X(e)===".priority"?this.priorityNode_:fe.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(e,n){return null}updateImmediateChild(e,n){return e===".priority"?this.updatePriority(n):n.isEmpty()&&e!==".priority"?this:fe.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,n).updatePriority(this.priorityNode_)}updateChild(e,n){const r=X(e);return r===null?n:n.isEmpty()&&r!==".priority"?this:(D(r!==".priority"||_t(e)===1,".priority must be the last token in a path"),this.updateImmediateChild(r,fe.__childrenNodeConstructor.EMPTY_NODE.updateChild(se(e),n)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(e,n){return!1}val(e){return e&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let e="";this.priorityNode_.isEmpty()||(e+="priority:"+Gu(this.priorityNode_.val())+":");const n=typeof this.value_;e+=n+":",n==="number"?e+=Eu(this.value_):e+=this.value_,this.lazyHash_=vu(e)}return this.lazyHash_}getValue(){return this.value_}compareTo(e){return e===fe.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof fe.__childrenNodeConstructor?-1:(D(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))}compareToLeafNode_(e){const n=typeof e.value_,r=typeof this.value_,i=fe.VALUE_TYPE_ORDER.indexOf(n),s=fe.VALUE_TYPE_ORDER.indexOf(r);return D(i>=0,"Unknown leaf type: "+n),D(s>=0,"Unknown leaf type: "+r),i===s?r==="object"?0:this.value_<e.value_?-1:this.value_===e.value_?0:1:s-i}withIndex(){return this}isIndexed(){return!0}equals(e){if(e===this)return!0;if(e.isLeafNode()){const n=e;return this.value_===n.value_&&this.priorityNode_.equals(n.priorityNode_)}else return!1}}fe.VALUE_TYPE_ORDER=["object","boolean","number","string"];let Ku,Yu;function S_(t){Ku=t}function T_(t){Yu=t}class R_ extends Bi{compare(e,n){const r=e.node.getPriority(),i=n.node.getPriority(),s=r.compareTo(i);return s===0?En(e.name,n.name):s}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,n){return!e.getPriority().equals(n.getPriority())}minPost(){return K.MIN}maxPost(){return new K(Lt,new fe("[PRIORITY-POST]",Yu))}makePost(e,n){const r=Ku(e);return new K(n,new fe("[PRIORITY-POST]",r))}toString(){return".priority"}}const ce=new R_;const k_=Math.log(2);class P_{constructor(e){const n=s=>parseInt(Math.log(s)/k_,10),r=s=>parseInt(Array(s+1).join("1"),2);this.count=n(e+1),this.current_=this.count-1;const i=r(this.count);this.bits_=e+1&i}nextBitIsOne(){const e=!(this.bits_&1<<this.current_);return this.current_--,e}}const hi=function(t,e,n,r){t.sort(e);const i=function(c,l){const u=l-c;let d,h;if(u===0)return null;if(u===1)return d=t[c],h=n?n(d):d,new pe(h,d.node,pe.BLACK,null,null);{const p=parseInt(u/2,10)+c,f=i(c,p),I=i(p+1,l);return d=t[p],h=n?n(d):d,new pe(h,d.node,pe.BLACK,f,I)}},s=function(c){let l=null,u=null,d=t.length;const h=function(f,I){const g=d-f,T=d;d-=f;const P=i(g+1,T),m=t[g],b=n?n(m):m;p(new pe(b,m.node,I,null,P))},p=function(f){l?(l.left=f,l=f):(u=f,l=f)};for(let f=0;f<c.count;++f){const I=c.nextBitIsOne(),g=Math.pow(2,c.count-(f+1));I?h(g,pe.BLACK):(h(g,pe.BLACK),h(g,pe.RED))}return u},o=new P_(t.length),a=s(o);return new Ce(r||e,a)};let ms;const Gt={};class Ke{static get Default(){return D(Gt&&ce,"ChildrenNode.ts has not been loaded"),ms=ms||new Ke({".priority":Gt},{".priority":ce}),ms}constructor(e,n){this.indexes_=e,this.indexSet_=n}get(e){const n=an(this.indexes_,e);if(!n)throw new Error("No index defined for "+e);return n instanceof Ce?n:null}hasIndex(e){return nt(this.indexSet_,e.toString())}addIndex(e,n){D(e!==on,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const r=[];let i=!1;const s=n.getIterator(K.Wrap);let o=s.getNext();for(;o;)i=i||e.isDefinedOn(o.node),r.push(o),o=s.getNext();let a;i?a=hi(r,e.getCompare()):a=Gt;const c=e.toString(),l=Object.assign({},this.indexSet_);l[c]=e;const u=Object.assign({},this.indexes_);return u[c]=a,new Ke(u,l)}addToIndexes(e,n){const r=ni(this.indexes_,(i,s)=>{const o=an(this.indexSet_,s);if(D(o,"Missing index implementation for "+s),i===Gt)if(o.isDefinedOn(e.node)){const a=[],c=n.getIterator(K.Wrap);let l=c.getNext();for(;l;)l.name!==e.name&&a.push(l),l=c.getNext();return a.push(e),hi(a,o.getCompare())}else return Gt;else{const a=n.get(e.name);let c=i;return a&&(c=c.remove(new K(e.name,a))),c.insert(e,e.node)}});return new Ke(r,this.indexSet_)}removeFromIndexes(e,n){const r=ni(this.indexes_,i=>{if(i===Gt)return i;{const s=n.get(e.name);return s?i.remove(new K(e.name,s)):i}});return new Ke(r,this.indexSet_)}}let kn;class j{static get EMPTY_NODE(){return kn||(kn=new j(new Ce(Mo),null,Ke.Default))}constructor(e,n,r){this.children_=e,this.priorityNode_=n,this.indexMap_=r,this.lazyHash_=null,this.priorityNode_&&Qu(this.priorityNode_),this.children_.isEmpty()&&D(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||kn}updatePriority(e){return this.children_.isEmpty()?this:new j(this.children_,e,this.indexMap_)}getImmediateChild(e){if(e===".priority")return this.getPriority();{const n=this.children_.get(e);return n===null?kn:n}}getChild(e){const n=X(e);return n===null?this:this.getImmediateChild(n).getChild(se(e))}hasChild(e){return this.children_.get(e)!==null}updateImmediateChild(e,n){if(D(n,"We should always be passing snapshot nodes"),e===".priority")return this.updatePriority(n);{const r=new K(e,n);let i,s;n.isEmpty()?(i=this.children_.remove(e),s=this.indexMap_.removeFromIndexes(r,this.children_)):(i=this.children_.insert(e,n),s=this.indexMap_.addToIndexes(r,this.children_));const o=i.isEmpty()?kn:this.priorityNode_;return new j(i,o,s)}}updateChild(e,n){const r=X(e);if(r===null)return n;{D(X(e)!==".priority"||_t(e)===1,".priority must be the last token in a path");const i=this.getImmediateChild(r).updateChild(se(e),n);return this.updateImmediateChild(r,i)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(e){if(this.isEmpty())return null;const n={};let r=0,i=0,s=!0;if(this.forEachChild(ce,(o,a)=>{n[o]=a.val(e),r++,s&&j.INTEGER_REGEXP_.test(o)?i=Math.max(i,Number(o)):s=!1}),!e&&s&&i<2*r){const o=[];for(const a in n)o[a]=n[a];return o}else return e&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n}hash(){if(this.lazyHash_===null){let e="";this.getPriority().isEmpty()||(e+="priority:"+Gu(this.getPriority().val())+":"),this.forEachChild(ce,(n,r)=>{const i=r.hash();i!==""&&(e+=":"+n+":"+i)}),this.lazyHash_=e===""?"":vu(e)}return this.lazyHash_}getPredecessorChildName(e,n,r){const i=this.resolveIndex_(r);if(i){const s=i.getPredecessorKey(new K(e,n));return s?s.name:null}else return this.children_.getPredecessorKey(e)}getFirstChildName(e){const n=this.resolveIndex_(e);if(n){const r=n.minKey();return r&&r.name}else return this.children_.minKey()}getFirstChild(e){const n=this.getFirstChildName(e);return n?new K(n,this.children_.get(n)):null}getLastChildName(e){const n=this.resolveIndex_(e);if(n){const r=n.maxKey();return r&&r.name}else return this.children_.maxKey()}getLastChild(e){const n=this.getLastChildName(e);return n?new K(n,this.children_.get(n)):null}forEachChild(e,n){const r=this.resolveIndex_(e);return r?r.inorderTraversal(i=>n(i.name,i.node)):this.children_.inorderTraversal(n)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,n){const r=this.resolveIndex_(n);if(r)return r.getIteratorFrom(e,i=>i);{const i=this.children_.getIteratorFrom(e.name,K.Wrap);let s=i.peek();for(;s!=null&&n.compare(s,e)<0;)i.getNext(),s=i.peek();return i}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,n){const r=this.resolveIndex_(n);if(r)return r.getReverseIteratorFrom(e,i=>i);{const i=this.children_.getReverseIteratorFrom(e.name,K.Wrap);let s=i.peek();for(;s!=null&&n.compare(s,e)>0;)i.getNext(),s=i.peek();return i}}compareTo(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===Er?-1:0}withIndex(e){if(e===on||this.indexMap_.hasIndex(e))return this;{const n=this.indexMap_.addIndex(e,this.children_);return new j(this.children_,this.priorityNode_,n)}}isIndexed(e){return e===on||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode())return!1;{const n=e;if(this.getPriority().equals(n.getPriority()))if(this.children_.count()===n.children_.count()){const r=this.getIterator(ce),i=n.getIterator(ce);let s=r.getNext(),o=i.getNext();for(;s&&o;){if(s.name!==o.name||!s.node.equals(o.node))return!1;s=r.getNext(),o=i.getNext()}return s===null&&o===null}else return!1;else return!1}}resolveIndex_(e){return e===on?null:this.indexMap_.get(e.toString())}}j.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class A_ extends j{constructor(){super(new Ce(Mo),j.EMPTY_NODE,Ke.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return j.EMPTY_NODE}isEmpty(){return!1}}const Er=new A_;Object.defineProperties(K,{MIN:{value:new K(un,j.EMPTY_NODE)},MAX:{value:new K(Lt,Er)}});$u.__EMPTY_NODE=j.EMPTY_NODE;fe.__childrenNodeConstructor=j;C_(Er);T_(Er);const N_=!0;function _e(t,e=null){if(t===null)return j.EMPTY_NODE;if(typeof t=="object"&&".priority"in t&&(e=t[".priority"]),D(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof t=="object"&&".value"in t&&t[".value"]!==null&&(t=t[".value"]),typeof t!="object"||".sv"in t){const n=t;return new fe(n,_e(e))}if(!(t instanceof Array)&&N_){const n=[];let r=!1;if(Se(t,(o,a)=>{if(o.substring(0,1)!=="."){const c=_e(a);c.isEmpty()||(r=r||!c.getPriority().isEmpty(),n.push(new K(o,c)))}}),n.length===0)return j.EMPTY_NODE;const s=hi(n,I_,o=>o.name,Mo);if(r){const o=hi(n,ce.getCompare());return new j(s,_e(e),new Ke({".priority":o},{".priority":ce}))}else return new j(s,_e(e),Ke.Default)}else{let n=j.EMPTY_NODE;return Se(t,(r,i)=>{if(nt(t,r)&&r.substring(0,1)!=="."){const s=_e(i);(s.isLeafNode()||!s.isEmpty())&&(n=n.updateImmediateChild(r,s))}}),n.updatePriority(_e(e))}}S_(_e);class O_ extends Bi{constructor(e){super(),this.indexPath_=e,D(!J(e)&&X(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,n){const r=this.extractChild(e.node),i=this.extractChild(n.node),s=r.compareTo(i);return s===0?En(e.name,n.name):s}makePost(e,n){const r=_e(e),i=j.EMPTY_NODE.updateChild(this.indexPath_,r);return new K(n,i)}maxPost(){const e=j.EMPTY_NODE.updateChild(this.indexPath_,Er);return new K(Lt,e)}toString(){return qu(this.indexPath_,0).join("/")}}class D_ extends Bi{compare(e,n){const r=e.node.compareTo(n.node);return r===0?En(e.name,n.name):r}isDefinedOn(e){return!0}indexedValueChanged(e,n){return!e.equals(n)}minPost(){return K.MIN}maxPost(){return K.MAX}makePost(e,n){const r=_e(e);return new K(n,r)}toString(){return".value"}}const x_=new D_;function Ju(t){return{type:"value",snapshotNode:t}}function dn(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function tr(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function nr(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}function M_(t,e){return{type:"child_moved",snapshotNode:e,childName:t}}class Lo{constructor(e){this.index_=e}updateChild(e,n,r,i,s,o){D(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");const a=e.getImmediateChild(n);return a.getChild(i).equals(r.getChild(i))&&a.isEmpty()===r.isEmpty()||(o!=null&&(r.isEmpty()?e.hasChild(n)?o.trackChildChange(tr(n,a)):D(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(dn(n,r)):o.trackChildChange(nr(n,r,a))),e.isLeafNode()&&r.isEmpty())?e:e.updateImmediateChild(n,r).withIndex(this.index_)}updateFullNode(e,n,r){return r!=null&&(e.isLeafNode()||e.forEachChild(ce,(i,s)=>{n.hasChild(i)||r.trackChildChange(tr(i,s))}),n.isLeafNode()||n.forEachChild(ce,(i,s)=>{if(e.hasChild(i)){const o=e.getImmediateChild(i);o.equals(s)||r.trackChildChange(nr(i,s,o))}else r.trackChildChange(dn(i,s))})),n.withIndex(this.index_)}updatePriority(e,n){return e.isEmpty()?j.EMPTY_NODE:e.updatePriority(n)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}class rr{constructor(e){this.indexedFilter_=new Lo(e.getIndex()),this.index_=e.getIndex(),this.startPost_=rr.getStartPost_(e),this.endPost_=rr.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){const n=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,r=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return n&&r}updateChild(e,n,r,i,s,o){return this.matches(new K(n,r))||(r=j.EMPTY_NODE),this.indexedFilter_.updateChild(e,n,r,i,s,o)}updateFullNode(e,n,r){n.isLeafNode()&&(n=j.EMPTY_NODE);let i=n.withIndex(this.index_);i=i.updatePriority(j.EMPTY_NODE);const s=this;return n.forEachChild(ce,(o,a)=>{s.matches(new K(o,a))||(i=i.updateImmediateChild(o,j.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,i,r)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){const n=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),n)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){const n=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),n)}else return e.getIndex().maxPost()}}class L_{constructor(e){this.withinDirectionalStart=n=>this.reverse_?this.withinEndPost(n):this.withinStartPost(n),this.withinDirectionalEnd=n=>this.reverse_?this.withinStartPost(n):this.withinEndPost(n),this.withinStartPost=n=>{const r=this.index_.compare(this.rangedFilter_.getStartPost(),n);return this.startIsInclusive_?r<=0:r<0},this.withinEndPost=n=>{const r=this.index_.compare(n,this.rangedFilter_.getEndPost());return this.endIsInclusive_?r<=0:r<0},this.rangedFilter_=new rr(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,n,r,i,s,o){return this.rangedFilter_.matches(new K(n,r))||(r=j.EMPTY_NODE),e.getImmediateChild(n).equals(r)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,n,r,i,s,o):this.fullLimitUpdateChild_(e,n,r,s,o)}updateFullNode(e,n,r){let i;if(n.isLeafNode()||n.isEmpty())i=j.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<n.numChildren()&&n.isIndexed(this.index_)){i=j.EMPTY_NODE.withIndex(this.index_);let s;this.reverse_?s=n.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):s=n.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let o=0;for(;s.hasNext()&&o<this.limit_;){const a=s.getNext();if(this.withinDirectionalStart(a))if(this.withinDirectionalEnd(a))i=i.updateImmediateChild(a.name,a.node),o++;else break;else continue}}else{i=n.withIndex(this.index_),i=i.updatePriority(j.EMPTY_NODE);let s;this.reverse_?s=i.getReverseIterator(this.index_):s=i.getIterator(this.index_);let o=0;for(;s.hasNext();){const a=s.getNext();o<this.limit_&&this.withinDirectionalStart(a)&&this.withinDirectionalEnd(a)?o++:i=i.updateImmediateChild(a.name,j.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,i,r)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(e,n,r,i,s){let o;if(this.reverse_){const d=this.index_.getCompare();o=(h,p)=>d(p,h)}else o=this.index_.getCompare();const a=e;D(a.numChildren()===this.limit_,"");const c=new K(n,r),l=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),u=this.rangedFilter_.matches(c);if(a.hasChild(n)){const d=a.getImmediateChild(n);let h=i.getChildAfterChild(this.index_,l,this.reverse_);for(;h!=null&&(h.name===n||a.hasChild(h.name));)h=i.getChildAfterChild(this.index_,h,this.reverse_);const p=h==null?1:o(h,c);if(u&&!r.isEmpty()&&p>=0)return s?.trackChildChange(nr(n,r,d)),a.updateImmediateChild(n,r);{s?.trackChildChange(tr(n,d));const I=a.updateImmediateChild(n,j.EMPTY_NODE);return h!=null&&this.rangedFilter_.matches(h)?(s?.trackChildChange(dn(h.name,h.node)),I.updateImmediateChild(h.name,h.node)):I}}else return r.isEmpty()?e:u&&o(l,c)>=0?(s!=null&&(s.trackChildChange(tr(l.name,l.node)),s.trackChildChange(dn(n,r))),a.updateImmediateChild(n,r).updateImmediateChild(l.name,j.EMPTY_NODE)):e}}class Fo{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=ce}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return D(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return D(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:un}hasEnd(){return this.endSet_}getIndexEndValue(){return D(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return D(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Lt}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return D(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===ce}copy(){const e=new Fo;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}}function F_(t){return t.loadsAllData()?new Lo(t.getIndex()):t.hasLimit()?new L_(t):new rr(t)}function pc(t){const e={};if(t.isDefault())return e;let n;if(t.index_===ce?n="$priority":t.index_===x_?n="$value":t.index_===on?n="$key":(D(t.index_ instanceof O_,"Unrecognized index type!"),n=t.index_.toString()),e.orderBy=ue(n),t.startSet_){const r=t.startAfterSet_?"startAfter":"startAt";e[r]=ue(t.indexStartValue_),t.startNameSet_&&(e[r]+=","+ue(t.indexStartName_))}if(t.endSet_){const r=t.endBeforeSet_?"endBefore":"endAt";e[r]=ue(t.indexEndValue_),t.endNameSet_&&(e[r]+=","+ue(t.indexEndName_))}return t.limitSet_&&(t.isViewFromLeft()?e.limitToFirst=t.limit_:e.limitToLast=t.limit_),e}function gc(t){const e={};if(t.startSet_&&(e.sp=t.indexStartValue_,t.startNameSet_&&(e.sn=t.indexStartName_),e.sin=!t.startAfterSet_),t.endSet_&&(e.ep=t.indexEndValue_,t.endNameSet_&&(e.en=t.indexEndName_),e.ein=!t.endBeforeSet_),t.limitSet_){e.l=t.limit_;let n=t.viewFrom_;n===""&&(t.isViewFromLeft()?n="l":n="r"),e.vf=n}return t.index_!==ce&&(e.i=t.index_.toString()),e}class fi extends Wu{reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,n){return n!==void 0?"tag$"+n:(D(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,n,r,i){super(),this.repoInfo_=e,this.onDataUpdate_=n,this.authTokenProvider_=r,this.appCheckTokenProvider_=i,this.log_=br("p:rest:"),this.listens_={}}listen(e,n,r,i){const s=e._path.toString();this.log_("Listen called for "+s+" "+e._queryIdentifier);const o=fi.getListenId_(e,r),a={};this.listens_[o]=a;const c=pc(e._queryParams);this.restRequest_(s+".json",c,(l,u)=>{let d=u;if(l===404&&(d=null,l=null),l===null&&this.onDataUpdate_(s,d,!1,r),an(this.listens_,o)===a){let h;l?l===401?h="permission_denied":h="rest_error:"+l:h="ok",i(h,null)}})}unlisten(e,n){const r=fi.getListenId_(e,n);delete this.listens_[r]}get(e){const n=pc(e._queryParams),r=e._path.toString(),i=new mo;return this.restRequest_(r+".json",n,(s,o)=>{let a=o;s===404&&(a=null,s=null),s===null?(this.onDataUpdate_(r,a,!1,null),i.resolve(a)):i.reject(new Error(a))}),i.promise}refreshAuthToken(e){}restRequest_(e,n={},r){return n.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([i,s])=>{i&&i.accessToken&&(n.auth=i.accessToken),s&&s.token&&(n.ac=s.token);const o=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+yn(n);this.log_("Sending REST request for "+o);const a=new XMLHttpRequest;a.onreadystatechange=()=>{if(r&&a.readyState===4){this.log_("REST Response for "+o+" received. status:",a.status,"response:",a.responseText);let c=null;if(a.status>=200&&a.status<300){try{c=Yn(a.responseText)}catch{Re("Failed to parse JSON response for "+o+": "+a.responseText)}r(null,c)}else a.status!==401&&a.status!==404&&Re("Got unsuccessful REST response for "+o+" Status: "+a.status),r(a.status);r=null}},a.open("GET",o,!0),a.send()})}}class U_{constructor(){this.rootNode_=j.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,n){this.rootNode_=this.rootNode_.updateChild(e,n)}}function pi(){return{value:null,children:new Map}}function Xu(t,e,n){if(J(e))t.value=n,t.children.clear();else if(t.value!==null)t.value=t.value.updateChild(e,n);else{const r=X(e);t.children.has(r)||t.children.set(r,pi());const i=t.children.get(r);e=se(e),Xu(i,e,n)}}function Hs(t,e,n){t.value!==null?n(e,t.value):W_(t,(r,i)=>{const s=new ie(e.toString()+"/"+r);Hs(i,s,n)})}function W_(t,e){t.children.forEach((n,r)=>{e(r,n)})}class V_{constructor(e){this.collection_=e,this.last_=null}get(){const e=this.collection_.get(),n=Object.assign({},e);return this.last_&&Se(this.last_,(r,i)=>{n[r]=n[r]-i}),this.last_=e,n}}const mc=10*1e3,B_=30*1e3,q_=300*1e3;class z_{constructor(e,n){this.server_=n,this.statsToReport_={},this.statsListener_=new V_(e);const r=mc+(B_-mc)*Math.random();qn(this.reportStats_.bind(this),Math.floor(r))}reportStats_(){const e=this.statsListener_.get(),n={};let r=!1;Se(e,(i,s)=>{s>0&&nt(this.statsToReport_,i)&&(n[i]=s,r=!0)}),r&&this.server_.reportStats(n),qn(this.reportStats_.bind(this),Math.floor(Math.random()*2*q_))}}var Le;(function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"})(Le||(Le={}));function Zu(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function Uo(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function Wo(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}class gi{constructor(e,n,r){this.path=e,this.affectedTree=n,this.revert=r,this.type=Le.ACK_USER_WRITE,this.source=Zu()}operationForChild(e){if(J(this.path)){if(this.affectedTree.value!=null)return D(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const n=this.affectedTree.subtree(new ie(e));return new gi(Z(),n,this.revert)}}else return D(X(this.path)===e,"operationForChild called for unrelated child."),new gi(se(this.path),this.affectedTree,this.revert)}}class ir{constructor(e,n){this.source=e,this.path=n,this.type=Le.LISTEN_COMPLETE}operationForChild(e){return J(this.path)?new ir(this.source,Z()):new ir(this.source,se(this.path))}}class Ft{constructor(e,n,r){this.source=e,this.path=n,this.snap=r,this.type=Le.OVERWRITE}operationForChild(e){return J(this.path)?new Ft(this.source,Z(),this.snap.getImmediateChild(e)):new Ft(this.source,se(this.path),this.snap)}}class sr{constructor(e,n,r){this.source=e,this.path=n,this.children=r,this.type=Le.MERGE}operationForChild(e){if(J(this.path)){const n=this.children.subtree(new ie(e));return n.isEmpty()?null:n.value?new Ft(this.source,Z(),n.value):new sr(this.source,Z(),n)}else return D(X(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new sr(this.source,se(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}class yt{constructor(e,n,r){this.node_=e,this.fullyInitialized_=n,this.filtered_=r}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(J(e))return this.isFullyInitialized()&&!this.filtered_;const n=X(e);return this.isCompleteForChild(n)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}}class H_{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}}function j_(t,e,n,r){const i=[],s=[];return e.forEach(o=>{o.type==="child_changed"&&t.index_.indexedValueChanged(o.oldSnap,o.snapshotNode)&&s.push(M_(o.childName,o.snapshotNode))}),Pn(t,i,"child_removed",e,r,n),Pn(t,i,"child_added",e,r,n),Pn(t,i,"child_moved",s,r,n),Pn(t,i,"child_changed",e,r,n),Pn(t,i,"value",e,r,n),i}function Pn(t,e,n,r,i,s){const o=r.filter(a=>a.type===n);o.sort((a,c)=>G_(t,a,c)),o.forEach(a=>{const c=$_(t,a,s);i.forEach(l=>{l.respondsTo(a.type)&&e.push(l.createEvent(c,t.query_))})})}function $_(t,e,n){return e.type==="value"||e.type==="child_removed"||(e.prevName=n.getPredecessorChildName(e.childName,e.snapshotNode,t.index_)),e}function G_(t,e,n){if(e.childName==null||n.childName==null)throw mn("Should only compare child_ events.");const r=new K(e.childName,e.snapshotNode),i=new K(n.childName,n.snapshotNode);return t.index_.compare(r,i)}function qi(t,e){return{eventCache:t,serverCache:e}}function zn(t,e,n,r){return qi(new yt(e,n,r),t.serverCache)}function ed(t,e,n,r){return qi(t.eventCache,new yt(e,n,r))}function mi(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function Ut(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}let _s;const Q_=()=>(_s||(_s=new Ce(Dm)),_s);class oe{static fromObject(e){let n=new oe(null);return Se(e,(r,i)=>{n=n.set(new ie(r),i)}),n}constructor(e,n=Q_()){this.value=e,this.children=n}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,n){if(this.value!=null&&n(this.value))return{path:Z(),value:this.value};if(J(e))return null;{const r=X(e),i=this.children.get(r);if(i!==null){const s=i.findRootMostMatchingPathAndValue(se(e),n);return s!=null?{path:de(new ie(r),s.path),value:s.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(J(e))return this;{const n=X(e),r=this.children.get(n);return r!==null?r.subtree(se(e)):new oe(null)}}set(e,n){if(J(e))return new oe(n,this.children);{const r=X(e),s=(this.children.get(r)||new oe(null)).set(se(e),n),o=this.children.insert(r,s);return new oe(this.value,o)}}remove(e){if(J(e))return this.children.isEmpty()?new oe(null):new oe(null,this.children);{const n=X(e),r=this.children.get(n);if(r){const i=r.remove(se(e));let s;return i.isEmpty()?s=this.children.remove(n):s=this.children.insert(n,i),this.value===null&&s.isEmpty()?new oe(null):new oe(this.value,s)}else return this}}get(e){if(J(e))return this.value;{const n=X(e),r=this.children.get(n);return r?r.get(se(e)):null}}setTree(e,n){if(J(e))return n;{const r=X(e),s=(this.children.get(r)||new oe(null)).setTree(se(e),n);let o;return s.isEmpty()?o=this.children.remove(r):o=this.children.insert(r,s),new oe(this.value,o)}}fold(e){return this.fold_(Z(),e)}fold_(e,n){const r={};return this.children.inorderTraversal((i,s)=>{r[i]=s.fold_(de(e,i),n)}),n(e,this.value,r)}findOnPath(e,n){return this.findOnPath_(e,Z(),n)}findOnPath_(e,n,r){const i=this.value?r(n,this.value):!1;if(i)return i;if(J(e))return null;{const s=X(e),o=this.children.get(s);return o?o.findOnPath_(se(e),de(n,s),r):null}}foreachOnPath(e,n){return this.foreachOnPath_(e,Z(),n)}foreachOnPath_(e,n,r){if(J(e))return this;{this.value&&r(n,this.value);const i=X(e),s=this.children.get(i);return s?s.foreachOnPath_(se(e),de(n,i),r):new oe(null)}}foreach(e){this.foreach_(Z(),e)}foreach_(e,n){this.children.inorderTraversal((r,i)=>{i.foreach_(de(e,r),n)}),this.value&&n(e,this.value)}foreachChild(e){this.children.inorderTraversal((n,r)=>{r.value&&e(n,r.value)})}}class Fe{constructor(e){this.writeTree_=e}static empty(){return new Fe(new oe(null))}}function Hn(t,e,n){if(J(e))return new Fe(new oe(n));{const r=t.writeTree_.findRootMostValueAndPath(e);if(r!=null){const i=r.path;let s=r.value;const o=be(i,e);return s=s.updateChild(o,n),new Fe(t.writeTree_.set(i,s))}else{const i=new oe(n),s=t.writeTree_.setTree(e,i);return new Fe(s)}}}function _c(t,e,n){let r=t;return Se(n,(i,s)=>{r=Hn(r,de(e,i),s)}),r}function yc(t,e){if(J(e))return Fe.empty();{const n=t.writeTree_.setTree(e,new oe(null));return new Fe(n)}}function js(t,e){return zt(t,e)!=null}function zt(t,e){const n=t.writeTree_.findRootMostValueAndPath(e);return n!=null?t.writeTree_.get(n.path).getChild(be(n.path,e)):null}function vc(t){const e=[],n=t.writeTree_.value;return n!=null?n.isLeafNode()||n.forEachChild(ce,(r,i)=>{e.push(new K(r,i))}):t.writeTree_.children.inorderTraversal((r,i)=>{i.value!=null&&e.push(new K(r,i.value))}),e}function gt(t,e){if(J(e))return t;{const n=zt(t,e);return n!=null?new Fe(new oe(n)):new Fe(t.writeTree_.subtree(e))}}function $s(t){return t.writeTree_.isEmpty()}function hn(t,e){return td(Z(),t.writeTree_,e)}function td(t,e,n){if(e.value!=null)return n.updateChild(t,e.value);{let r=null;return e.children.inorderTraversal((i,s)=>{i===".priority"?(D(s.value!==null,"Priority writes must always be leaf nodes"),r=s.value):n=td(de(t,i),s,n)}),!n.getChild(t).isEmpty()&&r!==null&&(n=n.updateChild(de(t,".priority"),r)),n}}function zi(t,e){return sd(e,t)}function K_(t,e,n,r,i){D(r>t.lastWriteId,"Stacking an older write on top of newer ones"),i===void 0&&(i=!0),t.allWrites.push({path:e,snap:n,writeId:r,visible:i}),i&&(t.visibleWrites=Hn(t.visibleWrites,e,n)),t.lastWriteId=r}function Y_(t,e){for(let n=0;n<t.allWrites.length;n++){const r=t.allWrites[n];if(r.writeId===e)return r}return null}function J_(t,e){const n=t.allWrites.findIndex(a=>a.writeId===e);D(n>=0,"removeWrite called with nonexistent writeId.");const r=t.allWrites[n];t.allWrites.splice(n,1);let i=r.visible,s=!1,o=t.allWrites.length-1;for(;i&&o>=0;){const a=t.allWrites[o];a.visible&&(o>=n&&X_(a,r.path)?i=!1:Me(r.path,a.path)&&(s=!0)),o--}if(i){if(s)return Z_(t),!0;if(r.snap)t.visibleWrites=yc(t.visibleWrites,r.path);else{const a=r.children;Se(a,c=>{t.visibleWrites=yc(t.visibleWrites,de(r.path,c))})}return!0}else return!1}function X_(t,e){if(t.snap)return Me(t.path,e);for(const n in t.children)if(t.children.hasOwnProperty(n)&&Me(de(t.path,n),e))return!0;return!1}function Z_(t){t.visibleWrites=nd(t.allWrites,ey,Z()),t.allWrites.length>0?t.lastWriteId=t.allWrites[t.allWrites.length-1].writeId:t.lastWriteId=-1}function ey(t){return t.visible}function nd(t,e,n){let r=Fe.empty();for(let i=0;i<t.length;++i){const s=t[i];if(e(s)){const o=s.path;let a;if(s.snap)Me(n,o)?(a=be(n,o),r=Hn(r,a,s.snap)):Me(o,n)&&(a=be(o,n),r=Hn(r,Z(),s.snap.getChild(a)));else if(s.children){if(Me(n,o))a=be(n,o),r=_c(r,a,s.children);else if(Me(o,n))if(a=be(o,n),J(a))r=_c(r,Z(),s.children);else{const c=an(s.children,X(a));if(c){const l=c.getChild(se(a));r=Hn(r,Z(),l)}}}else throw mn("WriteRecord should have .snap or .children")}}return r}function rd(t,e,n,r,i){if(!r&&!i){const s=zt(t.visibleWrites,e);if(s!=null)return s;{const o=gt(t.visibleWrites,e);if($s(o))return n;if(n==null&&!js(o,Z()))return null;{const a=n||j.EMPTY_NODE;return hn(o,a)}}}else{const s=gt(t.visibleWrites,e);if(!i&&$s(s))return n;if(!i&&n==null&&!js(s,Z()))return null;{const o=function(l){return(l.visible||i)&&(!r||!~r.indexOf(l.writeId))&&(Me(l.path,e)||Me(e,l.path))},a=nd(t.allWrites,o,e),c=n||j.EMPTY_NODE;return hn(a,c)}}}function ty(t,e,n){let r=j.EMPTY_NODE;const i=zt(t.visibleWrites,e);if(i)return i.isLeafNode()||i.forEachChild(ce,(s,o)=>{r=r.updateImmediateChild(s,o)}),r;if(n){const s=gt(t.visibleWrites,e);return n.forEachChild(ce,(o,a)=>{const c=hn(gt(s,new ie(o)),a);r=r.updateImmediateChild(o,c)}),vc(s).forEach(o=>{r=r.updateImmediateChild(o.name,o.node)}),r}else{const s=gt(t.visibleWrites,e);return vc(s).forEach(o=>{r=r.updateImmediateChild(o.name,o.node)}),r}}function ny(t,e,n,r,i){D(r||i,"Either existingEventSnap or existingServerSnap must exist");const s=de(e,n);if(js(t.visibleWrites,s))return null;{const o=gt(t.visibleWrites,s);return $s(o)?i.getChild(n):hn(o,i.getChild(n))}}function ry(t,e,n,r){const i=de(e,n),s=zt(t.visibleWrites,i);if(s!=null)return s;if(r.isCompleteForChild(n)){const o=gt(t.visibleWrites,i);return hn(o,r.getNode().getImmediateChild(n))}else return null}function iy(t,e){return zt(t.visibleWrites,e)}function sy(t,e,n,r,i,s,o){let a;const c=gt(t.visibleWrites,e),l=zt(c,Z());if(l!=null)a=l;else if(n!=null)a=hn(c,n);else return[];if(a=a.withIndex(o),!a.isEmpty()&&!a.isLeafNode()){const u=[],d=o.getCompare(),h=s?a.getReverseIteratorFrom(r,o):a.getIteratorFrom(r,o);let p=h.getNext();for(;p&&u.length<i;)d(p,r)!==0&&u.push(p),p=h.getNext();return u}else return[]}function oy(){return{visibleWrites:Fe.empty(),allWrites:[],lastWriteId:-1}}function _i(t,e,n,r){return rd(t.writeTree,t.treePath,e,n,r)}function Vo(t,e){return ty(t.writeTree,t.treePath,e)}function bc(t,e,n,r){return ny(t.writeTree,t.treePath,e,n,r)}function yi(t,e){return iy(t.writeTree,de(t.treePath,e))}function ay(t,e,n,r,i,s){return sy(t.writeTree,t.treePath,e,n,r,i,s)}function Bo(t,e,n){return ry(t.writeTree,t.treePath,e,n)}function id(t,e){return sd(de(t.treePath,e),t.writeTree)}function sd(t,e){return{treePath:t,writeTree:e}}class cy{constructor(){this.changeMap=new Map}trackChildChange(e){const n=e.type,r=e.childName;D(n==="child_added"||n==="child_changed"||n==="child_removed","Only child changes supported for tracking"),D(r!==".priority","Only non-priority child changes can be tracked.");const i=this.changeMap.get(r);if(i){const s=i.type;if(n==="child_added"&&s==="child_removed")this.changeMap.set(r,nr(r,e.snapshotNode,i.snapshotNode));else if(n==="child_removed"&&s==="child_added")this.changeMap.delete(r);else if(n==="child_removed"&&s==="child_changed")this.changeMap.set(r,tr(r,i.oldSnap));else if(n==="child_changed"&&s==="child_added")this.changeMap.set(r,dn(r,e.snapshotNode));else if(n==="child_changed"&&s==="child_changed")this.changeMap.set(r,nr(r,e.snapshotNode,i.oldSnap));else throw mn("Illegal combination of changes: "+e+" occurred after "+i)}else this.changeMap.set(r,e)}getChanges(){return Array.from(this.changeMap.values())}}class ly{getCompleteChild(e){return null}getChildAfterChild(e,n,r){return null}}const od=new ly;class qo{constructor(e,n,r=null){this.writes_=e,this.viewCache_=n,this.optCompleteServerCache_=r}getCompleteChild(e){const n=this.viewCache_.eventCache;if(n.isCompleteForChild(e))return n.getNode().getImmediateChild(e);{const r=this.optCompleteServerCache_!=null?new yt(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return Bo(this.writes_,e,r)}}getChildAfterChild(e,n,r){const i=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:Ut(this.viewCache_),s=ay(this.writes_,i,n,1,r,e);return s.length===0?null:s[0]}}function uy(t){return{filter:t}}function dy(t,e){D(e.eventCache.getNode().isIndexed(t.filter.getIndex()),"Event snap not indexed"),D(e.serverCache.getNode().isIndexed(t.filter.getIndex()),"Server snap not indexed")}function hy(t,e,n,r,i){const s=new cy;let o,a;if(n.type===Le.OVERWRITE){const l=n;l.source.fromUser?o=Gs(t,e,l.path,l.snap,r,i,s):(D(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered()&&!J(l.path),o=vi(t,e,l.path,l.snap,r,i,a,s))}else if(n.type===Le.MERGE){const l=n;l.source.fromUser?o=py(t,e,l.path,l.children,r,i,s):(D(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered(),o=Qs(t,e,l.path,l.children,r,i,a,s))}else if(n.type===Le.ACK_USER_WRITE){const l=n;l.revert?o=_y(t,e,l.path,r,i,s):o=gy(t,e,l.path,l.affectedTree,r,i,s)}else if(n.type===Le.LISTEN_COMPLETE)o=my(t,e,n.path,r,s);else throw mn("Unknown operation type: "+n.type);const c=s.getChanges();return fy(e,o,c),{viewCache:o,changes:c}}function fy(t,e,n){const r=e.eventCache;if(r.isFullyInitialized()){const i=r.getNode().isLeafNode()||r.getNode().isEmpty(),s=mi(t);(n.length>0||!t.eventCache.isFullyInitialized()||i&&!r.getNode().equals(s)||!r.getNode().getPriority().equals(s.getPriority()))&&n.push(Ju(mi(e)))}}function ad(t,e,n,r,i,s){const o=e.eventCache;if(yi(r,n)!=null)return e;{let a,c;if(J(n))if(D(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){const l=Ut(e),u=l instanceof j?l:j.EMPTY_NODE,d=Vo(r,u);a=t.filter.updateFullNode(e.eventCache.getNode(),d,s)}else{const l=_i(r,Ut(e));a=t.filter.updateFullNode(e.eventCache.getNode(),l,s)}else{const l=X(n);if(l===".priority"){D(_t(n)===1,"Can't have a priority with additional path components");const u=o.getNode();c=e.serverCache.getNode();const d=bc(r,n,u,c);d!=null?a=t.filter.updatePriority(u,d):a=o.getNode()}else{const u=se(n);let d;if(o.isCompleteForChild(l)){c=e.serverCache.getNode();const h=bc(r,n,o.getNode(),c);h!=null?d=o.getNode().getImmediateChild(l).updateChild(u,h):d=o.getNode().getImmediateChild(l)}else d=Bo(r,l,e.serverCache);d!=null?a=t.filter.updateChild(o.getNode(),l,d,u,i,s):a=o.getNode()}}return zn(e,a,o.isFullyInitialized()||J(n),t.filter.filtersNodes())}}function vi(t,e,n,r,i,s,o,a){const c=e.serverCache;let l;const u=o?t.filter:t.filter.getIndexedFilter();if(J(n))l=u.updateFullNode(c.getNode(),r,null);else if(u.filtersNodes()&&!c.isFiltered()){const p=c.getNode().updateChild(n,r);l=u.updateFullNode(c.getNode(),p,null)}else{const p=X(n);if(!c.isCompleteForPath(n)&&_t(n)>1)return e;const f=se(n),g=c.getNode().getImmediateChild(p).updateChild(f,r);p===".priority"?l=u.updatePriority(c.getNode(),g):l=u.updateChild(c.getNode(),p,g,f,od,null)}const d=ed(e,l,c.isFullyInitialized()||J(n),u.filtersNodes()),h=new qo(i,d,s);return ad(t,d,n,i,h,a)}function Gs(t,e,n,r,i,s,o){const a=e.eventCache;let c,l;const u=new qo(i,e,s);if(J(n))l=t.filter.updateFullNode(e.eventCache.getNode(),r,o),c=zn(e,l,!0,t.filter.filtersNodes());else{const d=X(n);if(d===".priority")l=t.filter.updatePriority(e.eventCache.getNode(),r),c=zn(e,l,a.isFullyInitialized(),a.isFiltered());else{const h=se(n),p=a.getNode().getImmediateChild(d);let f;if(J(h))f=r;else{const I=u.getCompleteChild(d);I!=null?Bu(h)===".priority"&&I.getChild(zu(h)).isEmpty()?f=I:f=I.updateChild(h,r):f=j.EMPTY_NODE}if(p.equals(f))c=e;else{const I=t.filter.updateChild(a.getNode(),d,f,h,u,o);c=zn(e,I,a.isFullyInitialized(),t.filter.filtersNodes())}}}return c}function wc(t,e){return t.eventCache.isCompleteForChild(e)}function py(t,e,n,r,i,s,o){let a=e;return r.foreach((c,l)=>{const u=de(n,c);wc(e,X(u))&&(a=Gs(t,a,u,l,i,s,o))}),r.foreach((c,l)=>{const u=de(n,c);wc(e,X(u))||(a=Gs(t,a,u,l,i,s,o))}),a}function Ec(t,e,n){return n.foreach((r,i)=>{e=e.updateChild(r,i)}),e}function Qs(t,e,n,r,i,s,o,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let c=e,l;J(n)?l=r:l=new oe(null).setTree(n,r);const u=e.serverCache.getNode();return l.children.inorderTraversal((d,h)=>{if(u.hasChild(d)){const p=e.serverCache.getNode().getImmediateChild(d),f=Ec(t,p,h);c=vi(t,c,new ie(d),f,i,s,o,a)}}),l.children.inorderTraversal((d,h)=>{const p=!e.serverCache.isCompleteForChild(d)&&h.value===null;if(!u.hasChild(d)&&!p){const f=e.serverCache.getNode().getImmediateChild(d),I=Ec(t,f,h);c=vi(t,c,new ie(d),I,i,s,o,a)}}),c}function gy(t,e,n,r,i,s,o){if(yi(i,n)!=null)return e;const a=e.serverCache.isFiltered(),c=e.serverCache;if(r.value!=null){if(J(n)&&c.isFullyInitialized()||c.isCompleteForPath(n))return vi(t,e,n,c.getNode().getChild(n),i,s,a,o);if(J(n)){let l=new oe(null);return c.getNode().forEachChild(on,(u,d)=>{l=l.set(new ie(u),d)}),Qs(t,e,n,l,i,s,a,o)}else return e}else{let l=new oe(null);return r.foreach((u,d)=>{const h=de(n,u);c.isCompleteForPath(h)&&(l=l.set(u,c.getNode().getChild(h)))}),Qs(t,e,n,l,i,s,a,o)}}function my(t,e,n,r,i){const s=e.serverCache,o=ed(e,s.getNode(),s.isFullyInitialized()||J(n),s.isFiltered());return ad(t,o,n,r,od,i)}function _y(t,e,n,r,i,s){let o;if(yi(r,n)!=null)return e;{const a=new qo(r,e,i),c=e.eventCache.getNode();let l;if(J(n)||X(n)===".priority"){let u;if(e.serverCache.isFullyInitialized())u=_i(r,Ut(e));else{const d=e.serverCache.getNode();D(d instanceof j,"serverChildren would be complete if leaf node"),u=Vo(r,d)}u=u,l=t.filter.updateFullNode(c,u,s)}else{const u=X(n);let d=Bo(r,u,e.serverCache);d==null&&e.serverCache.isCompleteForChild(u)&&(d=c.getImmediateChild(u)),d!=null?l=t.filter.updateChild(c,u,d,se(n),a,s):e.eventCache.getNode().hasChild(u)?l=t.filter.updateChild(c,u,j.EMPTY_NODE,se(n),a,s):l=c,l.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=_i(r,Ut(e)),o.isLeafNode()&&(l=t.filter.updateFullNode(l,o,s)))}return o=e.serverCache.isFullyInitialized()||yi(r,Z())!=null,zn(e,l,o,t.filter.filtersNodes())}}class yy{constructor(e,n){this.query_=e,this.eventRegistrations_=[];const r=this.query_._queryParams,i=new Lo(r.getIndex()),s=F_(r);this.processor_=uy(s);const o=n.serverCache,a=n.eventCache,c=i.updateFullNode(j.EMPTY_NODE,o.getNode(),null),l=s.updateFullNode(j.EMPTY_NODE,a.getNode(),null),u=new yt(c,o.isFullyInitialized(),i.filtersNodes()),d=new yt(l,a.isFullyInitialized(),s.filtersNodes());this.viewCache_=qi(d,u),this.eventGenerator_=new H_(this.query_)}get query(){return this.query_}}function vy(t){return t.viewCache_.serverCache.getNode()}function by(t){return mi(t.viewCache_)}function wy(t,e){const n=Ut(t.viewCache_);return n&&(t.query._queryParams.loadsAllData()||!J(e)&&!n.getImmediateChild(X(e)).isEmpty())?n.getChild(e):null}function Ic(t){return t.eventRegistrations_.length===0}function Ey(t,e){t.eventRegistrations_.push(e)}function Cc(t,e,n){const r=[];if(n){D(e==null,"A cancel should cancel all event registrations.");const i=t.query._path;t.eventRegistrations_.forEach(s=>{const o=s.createCancelEvent(n,i);o&&r.push(o)})}if(e){let i=[];for(let s=0;s<t.eventRegistrations_.length;++s){const o=t.eventRegistrations_[s];if(!o.matches(e))i.push(o);else if(e.hasAnyCallback()){i=i.concat(t.eventRegistrations_.slice(s+1));break}}t.eventRegistrations_=i}else t.eventRegistrations_=[];return r}function Sc(t,e,n,r){e.type===Le.MERGE&&e.source.queryId!==null&&(D(Ut(t.viewCache_),"We should always have a full cache before handling merges"),D(mi(t.viewCache_),"Missing event cache, even though we have a server cache"));const i=t.viewCache_,s=hy(t.processor_,i,e,n,r);return dy(t.processor_,s.viewCache),D(s.viewCache.serverCache.isFullyInitialized()||!i.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=s.viewCache,cd(t,s.changes,s.viewCache.eventCache.getNode(),null)}function Iy(t,e){const n=t.viewCache_.eventCache,r=[];return n.getNode().isLeafNode()||n.getNode().forEachChild(ce,(s,o)=>{r.push(dn(s,o))}),n.isFullyInitialized()&&r.push(Ju(n.getNode())),cd(t,r,n.getNode(),e)}function cd(t,e,n,r){const i=r?[r]:t.eventRegistrations_;return j_(t.eventGenerator_,e,n,i)}let bi;class ld{constructor(){this.views=new Map}}function Cy(t){D(!bi,"__referenceConstructor has already been defined"),bi=t}function Sy(){return D(bi,"Reference.ts has not been loaded"),bi}function Ty(t){return t.views.size===0}function zo(t,e,n,r){const i=e.source.queryId;if(i!==null){const s=t.views.get(i);return D(s!=null,"SyncTree gave us an op for an invalid query."),Sc(s,e,n,r)}else{let s=[];for(const o of t.views.values())s=s.concat(Sc(o,e,n,r));return s}}function ud(t,e,n,r,i){const s=e._queryIdentifier,o=t.views.get(s);if(!o){let a=_i(n,i?r:null),c=!1;a?c=!0:r instanceof j?(a=Vo(n,r),c=!1):(a=j.EMPTY_NODE,c=!1);const l=qi(new yt(a,c,!1),new yt(r,i,!1));return new yy(e,l)}return o}function Ry(t,e,n,r,i,s){const o=ud(t,e,r,i,s);return t.views.has(e._queryIdentifier)||t.views.set(e._queryIdentifier,o),Ey(o,n),Iy(o,n)}function ky(t,e,n,r){const i=e._queryIdentifier,s=[];let o=[];const a=vt(t);if(i==="default")for(const[c,l]of t.views.entries())o=o.concat(Cc(l,n,r)),Ic(l)&&(t.views.delete(c),l.query._queryParams.loadsAllData()||s.push(l.query));else{const c=t.views.get(i);c&&(o=o.concat(Cc(c,n,r)),Ic(c)&&(t.views.delete(i),c.query._queryParams.loadsAllData()||s.push(c.query)))}return a&&!vt(t)&&s.push(new(Sy())(e._repo,e._path)),{removed:s,events:o}}function dd(t){const e=[];for(const n of t.views.values())n.query._queryParams.loadsAllData()||e.push(n);return e}function mt(t,e){let n=null;for(const r of t.views.values())n=n||wy(r,e);return n}function hd(t,e){if(e._queryParams.loadsAllData())return Hi(t);{const r=e._queryIdentifier;return t.views.get(r)}}function fd(t,e){return hd(t,e)!=null}function vt(t){return Hi(t)!=null}function Hi(t){for(const e of t.views.values())if(e.query._queryParams.loadsAllData())return e;return null}let wi;function Py(t){D(!wi,"__referenceConstructor has already been defined"),wi=t}function Ay(){return D(wi,"Reference.ts has not been loaded"),wi}let Ny=1;class Tc{constructor(e){this.listenProvider_=e,this.syncPointTree_=new oe(null),this.pendingWriteTree_=oy(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function Oy(t,e,n,r,i){return K_(t.pendingWriteTree_,e,n,r,i),i?Cr(t,new Ft(Zu(),e,n)):[]}function Zt(t,e,n=!1){const r=Y_(t.pendingWriteTree_,e);if(J_(t.pendingWriteTree_,e)){let s=new oe(null);return r.snap!=null?s=s.set(Z(),!0):Se(r.children,o=>{s=s.set(new ie(o),!0)}),Cr(t,new gi(r.path,s,n))}else return[]}function Ir(t,e,n){return Cr(t,new Ft(Uo(),e,n))}function Dy(t,e,n){const r=oe.fromObject(n);return Cr(t,new sr(Uo(),e,r))}function xy(t,e){return Cr(t,new ir(Uo(),e))}function My(t,e,n){const r=Ho(t,n);if(r){const i=jo(r),s=i.path,o=i.queryId,a=be(s,e),c=new ir(Wo(o),a);return $o(t,s,c)}else return[]}function pd(t,e,n,r,i=!1){const s=e._path,o=t.syncPointTree_.get(s);let a=[];if(o&&(e._queryIdentifier==="default"||fd(o,e))){const c=ky(o,e,n,r);Ty(o)&&(t.syncPointTree_=t.syncPointTree_.remove(s));const l=c.removed;if(a=c.events,!i){const u=l.findIndex(h=>h._queryParams.loadsAllData())!==-1,d=t.syncPointTree_.findOnPath(s,(h,p)=>vt(p));if(u&&!d){const h=t.syncPointTree_.subtree(s);if(!h.isEmpty()){const p=Wy(h);for(let f=0;f<p.length;++f){const I=p[f],g=I.query,T=vd(t,I);t.listenProvider_.startListening(jn(g),or(t,g),T.hashFn,T.onComplete)}}}!d&&l.length>0&&!r&&(u?t.listenProvider_.stopListening(jn(e),null):l.forEach(h=>{const p=t.queryToTagMap.get(ji(h));t.listenProvider_.stopListening(jn(h),p)}))}Vy(t,l)}return a}function gd(t,e,n,r){const i=Ho(t,r);if(i!=null){const s=jo(i),o=s.path,a=s.queryId,c=be(o,e),l=new Ft(Wo(a),c,n);return $o(t,o,l)}else return[]}function Ly(t,e,n,r){const i=Ho(t,r);if(i){const s=jo(i),o=s.path,a=s.queryId,c=be(o,e),l=oe.fromObject(n),u=new sr(Wo(a),c,l);return $o(t,o,u)}else return[]}function Fy(t,e,n,r=!1){const i=e._path;let s=null,o=!1;t.syncPointTree_.foreachOnPath(i,(h,p)=>{const f=be(h,i);s=s||mt(p,f),o=o||vt(p)});let a=t.syncPointTree_.get(i);a?(o=o||vt(a),s=s||mt(a,Z())):(a=new ld,t.syncPointTree_=t.syncPointTree_.set(i,a));let c;s!=null?c=!0:(c=!1,s=j.EMPTY_NODE,t.syncPointTree_.subtree(i).foreachChild((p,f)=>{const I=mt(f,Z());I&&(s=s.updateImmediateChild(p,I))}));const l=fd(a,e);if(!l&&!e._queryParams.loadsAllData()){const h=ji(e);D(!t.queryToTagMap.has(h),"View does not exist, but we have a tag");const p=By();t.queryToTagMap.set(h,p),t.tagToQueryMap.set(p,h)}const u=zi(t.pendingWriteTree_,i);let d=Ry(a,e,n,u,s,c);if(!l&&!o&&!r){const h=hd(a,e);d=d.concat(qy(t,e,h))}return d}function md(t,e,n){const i=t.pendingWriteTree_,s=t.syncPointTree_.findOnPath(e,(o,a)=>{const c=be(o,e),l=mt(a,c);if(l)return l});return rd(i,e,s,n,!0)}function Uy(t,e){const n=e._path;let r=null;t.syncPointTree_.foreachOnPath(n,(l,u)=>{const d=be(l,n);r=r||mt(u,d)});let i=t.syncPointTree_.get(n);i?r=r||mt(i,Z()):(i=new ld,t.syncPointTree_=t.syncPointTree_.set(n,i));const s=r!=null,o=s?new yt(r,!0,!1):null,a=zi(t.pendingWriteTree_,e._path),c=ud(i,e,a,s?o.getNode():j.EMPTY_NODE,s);return by(c)}function Cr(t,e){return _d(e,t.syncPointTree_,null,zi(t.pendingWriteTree_,Z()))}function _d(t,e,n,r){if(J(t.path))return yd(t,e,n,r);{const i=e.get(Z());n==null&&i!=null&&(n=mt(i,Z()));let s=[];const o=X(t.path),a=t.operationForChild(o),c=e.children.get(o);if(c&&a){const l=n?n.getImmediateChild(o):null,u=id(r,o);s=s.concat(_d(a,c,l,u))}return i&&(s=s.concat(zo(i,t,r,n))),s}}function yd(t,e,n,r){const i=e.get(Z());n==null&&i!=null&&(n=mt(i,Z()));let s=[];return e.children.inorderTraversal((o,a)=>{const c=n?n.getImmediateChild(o):null,l=id(r,o),u=t.operationForChild(o);u&&(s=s.concat(yd(u,a,c,l)))}),i&&(s=s.concat(zo(i,t,r,n))),s}function vd(t,e){const n=e.query,r=or(t,n);return{hashFn:()=>(vy(e)||j.EMPTY_NODE).hash(),onComplete:i=>{if(i==="ok")return r?My(t,n._path,r):xy(t,n._path);{const s=Lm(i,n);return pd(t,n,null,s)}}}}function or(t,e){const n=ji(e);return t.queryToTagMap.get(n)}function ji(t){return t._path.toString()+"$"+t._queryIdentifier}function Ho(t,e){return t.tagToQueryMap.get(e)}function jo(t){const e=t.indexOf("$");return D(e!==-1&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new ie(t.substr(0,e))}}function $o(t,e,n){const r=t.syncPointTree_.get(e);D(r,"Missing sync point for query tag that we're tracking");const i=zi(t.pendingWriteTree_,e);return zo(r,n,i,null)}function Wy(t){return t.fold((e,n,r)=>{if(n&&vt(n))return[Hi(n)];{let i=[];return n&&(i=dd(n)),Se(r,(s,o)=>{i=i.concat(o)}),i}})}function jn(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?new(Ay())(t._repo,t._path):t}function Vy(t,e){for(let n=0;n<e.length;++n){const r=e[n];if(!r._queryParams.loadsAllData()){const i=ji(r),s=t.queryToTagMap.get(i);t.queryToTagMap.delete(i),t.tagToQueryMap.delete(s)}}}function By(){return Ny++}function qy(t,e,n){const r=e._path,i=or(t,e),s=vd(t,n),o=t.listenProvider_.startListening(jn(e),i,s.hashFn,s.onComplete),a=t.syncPointTree_.subtree(r);if(i)D(!vt(a.value),"If we're adding a query, it shouldn't be shadowed");else{const c=a.fold((l,u,d)=>{if(!J(l)&&u&&vt(u))return[Hi(u).query];{let h=[];return u&&(h=h.concat(dd(u).map(p=>p.query))),Se(d,(p,f)=>{h=h.concat(f)}),h}});for(let l=0;l<c.length;++l){const u=c[l];t.listenProvider_.stopListening(jn(u),or(t,u))}}return o}class Go{constructor(e){this.node_=e}getImmediateChild(e){const n=this.node_.getImmediateChild(e);return new Go(n)}node(){return this.node_}}class Qo{constructor(e,n){this.syncTree_=e,this.path_=n}getImmediateChild(e){const n=de(this.path_,e);return new Qo(this.syncTree_,n)}node(){return md(this.syncTree_,this.path_)}}const zy=function(t){return t=t||{},t.timestamp=t.timestamp||new Date().getTime(),t},Rc=function(t,e,n){if(!t||typeof t!="object")return t;if(D(".sv"in t,"Unexpected leaf node or priority contents"),typeof t[".sv"]=="string")return Hy(t[".sv"],e,n);if(typeof t[".sv"]=="object")return jy(t[".sv"],e);D(!1,"Unexpected server value: "+JSON.stringify(t,null,2))},Hy=function(t,e,n){if(t==="timestamp")return n.timestamp;D(!1,"Unexpected server value: "+t)},jy=function(t,e,n){t.hasOwnProperty("increment")||D(!1,"Unexpected server value: "+JSON.stringify(t,null,2));const r=t.increment;typeof r!="number"&&D(!1,"Unexpected increment value: "+r);const i=e.node();if(D(i!==null&&typeof i<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return r;const o=i.getValue();return typeof o!="number"?r:o+r},$y=function(t,e,n,r){return Ko(e,new Qo(n,t),r)},Gy=function(t,e,n){return Ko(t,new Go(e),n)};function Ko(t,e,n){const r=t.getPriority().val(),i=Rc(r,e.getImmediateChild(".priority"),n);let s;if(t.isLeafNode()){const o=t,a=Rc(o.getValue(),e,n);return a!==o.getValue()||i!==o.getPriority().val()?new fe(a,_e(i)):t}else{const o=t;return s=o,i!==o.getPriority().val()&&(s=s.updatePriority(new fe(i))),o.forEachChild(ce,(a,c)=>{const l=Ko(c,e.getImmediateChild(a),n);l!==c&&(s=s.updateImmediateChild(a,l))}),s}}class Yo{constructor(e="",n=null,r={children:{},childCount:0}){this.name=e,this.parent=n,this.node=r}}function Jo(t,e){let n=e instanceof ie?e:new ie(e),r=t,i=X(n);for(;i!==null;){const s=an(r.node.children,i)||{children:{},childCount:0};r=new Yo(i,r,s),n=se(n),i=X(n)}return r}function In(t){return t.node.value}function bd(t,e){t.node.value=e,Ks(t)}function wd(t){return t.node.childCount>0}function Qy(t){return In(t)===void 0&&!wd(t)}function $i(t,e){Se(t.node.children,(n,r)=>{e(new Yo(n,t,r))})}function Ed(t,e,n,r){n&&e(t),$i(t,i=>{Ed(i,e,!0)})}function Ky(t,e,n){let r=t.parent;for(;r!==null;){if(e(r))return!0;r=r.parent}return!1}function Sr(t){return new ie(t.parent===null?t.name:Sr(t.parent)+"/"+t.name)}function Ks(t){t.parent!==null&&Yy(t.parent,t.name,t)}function Yy(t,e,n){const r=Qy(n),i=nt(t.node.children,e);r&&i?(delete t.node.children[e],t.node.childCount--,Ks(t)):!r&&!i&&(t.node.children[e]=n.node,t.node.childCount++,Ks(t))}const Jy=/[\[\].#$\/\u0000-\u001F\u007F]/,Xy=/[\[\].#$\u0000-\u001F\u007F]/,ys=10*1024*1024,Id=function(t){return typeof t=="string"&&t.length!==0&&!Jy.test(t)},Cd=function(t){return typeof t=="string"&&t.length!==0&&!Xy.test(t)},Zy=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),Cd(t)},Sd=function(t,e,n){const r=n instanceof ie?new g_(n,t):n;if(e===void 0)throw new Error(t+"contains undefined "+At(r));if(typeof e=="function")throw new Error(t+"contains a function "+At(r)+" with contents = "+e.toString());if(bu(e))throw new Error(t+"contains "+e.toString()+" "+At(r));if(typeof e=="string"&&e.length>ys/3&&Li(e)>ys)throw new Error(t+"contains a string greater than "+ys+" utf8 bytes "+At(r)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let i=!1,s=!1;if(Se(e,(o,a)=>{if(o===".value")i=!0;else if(o!==".priority"&&o!==".sv"&&(s=!0,!Id(o)))throw new Error(t+" contains an invalid key ("+o+") "+At(r)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);m_(r,o),Sd(t,a,r),__(r)}),i&&s)throw new Error(t+' contains ".value" child '+At(r)+" in addition to actual children.")}},Td=function(t,e,n,r){if(!Cd(n))throw new Error(Nl(t,e)+'was an invalid path = "'+n+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},ev=function(t,e,n,r){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),Td(t,e,n)},tv=function(t,e){const n=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!Id(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||n.length!==0&&!Zy(n))throw new Error(Nl(t,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};class nv{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function rv(t,e){let n=null;for(let r=0;r<e.length;r++){const i=e[r],s=i.getPath();n!==null&&!Hu(s,n.path)&&(t.eventLists_.push(n),n=null),n===null&&(n={events:[],path:s}),n.events.push(i)}n&&t.eventLists_.push(n)}function St(t,e,n){rv(t,n),iv(t,r=>Me(r,e)||Me(e,r))}function iv(t,e){t.recursionDepth_++;let n=!0;for(let r=0;r<t.eventLists_.length;r++){const i=t.eventLists_[r];if(i){const s=i.path;e(s)?(sv(t.eventLists_[r]),t.eventLists_[r]=null):n=!1}}n&&(t.eventLists_=[]),t.recursionDepth_--}function sv(t){for(let e=0;e<t.events.length;e++){const n=t.events[e];if(n!==null){t.events[e]=null;const r=n.getEventRunner();Bn&&ve("event: "+n.toString()),wr(r)}}}const ov="repo_interrupt",av=25;class cv{constructor(e,n,r,i){this.repoInfo_=e,this.forceRestClient_=n,this.authTokenProvider_=r,this.appCheckProvider_=i,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new nv,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=pi(),this.transactionQueueTree_=new Yo,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function lv(t,e,n){if(t.stats_=Oo(t.repoInfo_),t.forceRestClient_||Vm())t.server_=new fi(t.repoInfo_,(r,i,s,o)=>{kc(t,r,i,s,o)},t.authTokenProvider_,t.appCheckProvider_),setTimeout(()=>Pc(t,!0),0);else{if(typeof n<"u"&&n!==null){if(typeof n!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{ue(n)}catch(r){throw new Error("Invalid authOverride provided: "+r)}}t.persistentConnection_=new Ye(t.repoInfo_,e,(r,i,s,o)=>{kc(t,r,i,s,o)},r=>{Pc(t,r)},r=>{dv(t,r)},t.authTokenProvider_,t.appCheckProvider_,n),t.server_=t.persistentConnection_}t.authTokenProvider_.addTokenChangeListener(r=>{t.server_.refreshAuthToken(r)}),t.appCheckProvider_.addTokenChangeListener(r=>{t.server_.refreshAppCheckToken(r.token)}),t.statsReporter_=jm(t.repoInfo_,()=>new z_(t.stats_,t.server_)),t.infoData_=new U_,t.infoSyncTree_=new Tc({startListening:(r,i,s,o)=>{let a=[];const c=t.infoData_.getNode(r._path);return c.isEmpty()||(a=Ir(t.infoSyncTree_,r._path,c),setTimeout(()=>{o("ok")},0)),a},stopListening:()=>{}}),Xo(t,"connected",!1),t.serverSyncTree_=new Tc({startListening:(r,i,s,o)=>(t.server_.listen(r,s,i,(a,c)=>{const l=o(a,c);St(t.eventQueue_,r._path,l)}),[]),stopListening:(r,i)=>{t.server_.unlisten(r,i)}})}function uv(t){const n=t.infoData_.getNode(new ie(".info/serverTimeOffset")).val()||0;return new Date().getTime()+n}function Rd(t){return zy({timestamp:uv(t)})}function kc(t,e,n,r,i){t.dataUpdateCount++;const s=new ie(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;let o=[];if(i)if(r){const c=ni(n,l=>_e(l));o=Ly(t.serverSyncTree_,s,c,i)}else{const c=_e(n);o=gd(t.serverSyncTree_,s,c,i)}else if(r){const c=ni(n,l=>_e(l));o=Dy(t.serverSyncTree_,s,c)}else{const c=_e(n);o=Ir(t.serverSyncTree_,s,c)}let a=s;o.length>0&&(a=ta(t,s)),St(t.eventQueue_,a,o)}function Pc(t,e){Xo(t,"connected",e),e===!1&&pv(t)}function dv(t,e){Se(e,(n,r)=>{Xo(t,n,r)})}function Xo(t,e,n){const r=new ie("/.info/"+e),i=_e(n);t.infoData_.updateSnapshot(r,i);const s=Ir(t.infoSyncTree_,r,i);St(t.eventQueue_,r,s)}function hv(t){return t.nextWriteId_++}function fv(t,e,n){const r=Uy(t.serverSyncTree_,e);return r!=null?Promise.resolve(r):t.server_.get(e).then(i=>{const s=_e(i).withIndex(e._queryParams.getIndex());Fy(t.serverSyncTree_,e,n,!0);let o;if(e._queryParams.loadsAllData())o=Ir(t.serverSyncTree_,e._path,s);else{const a=or(t.serverSyncTree_,e);o=gd(t.serverSyncTree_,e._path,s,a)}return St(t.eventQueue_,e._path,o),pd(t.serverSyncTree_,e,n,null,!0),s},i=>(Zo(t,"get for query "+ue(e)+" failed: "+i),Promise.reject(new Error(i))))}function pv(t){Zo(t,"onDisconnectEvents");const e=Rd(t),n=pi();Hs(t.onDisconnect_,Z(),(i,s)=>{const o=$y(i,s,t.serverSyncTree_,e);Xu(n,i,o)});let r=[];Hs(n,Z(),(i,s)=>{r=r.concat(Ir(t.serverSyncTree_,i,s));const o=yv(t,i);ta(t,o)}),t.onDisconnect_=pi(),St(t.eventQueue_,Z(),r)}function gv(t){t.persistentConnection_&&t.persistentConnection_.interrupt(ov)}function Zo(t,...e){let n="";t.persistentConnection_&&(n=t.persistentConnection_.id+":"),ve(n,...e)}function kd(t,e,n){return md(t.serverSyncTree_,e,n)||j.EMPTY_NODE}function ea(t,e=t.transactionQueueTree_){if(e||Gi(t,e),In(e)){const n=Ad(t,e);D(n.length>0,"Sending zero length transaction queue"),n.every(i=>i.status===0)&&mv(t,Sr(e),n)}else wd(e)&&$i(e,n=>{ea(t,n)})}function mv(t,e,n){const r=n.map(l=>l.currentWriteId),i=kd(t,e,r);let s=i;const o=i.hash();for(let l=0;l<n.length;l++){const u=n[l];D(u.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),u.status=1,u.retryCount++;const d=be(e,u.path);s=s.updateChild(d,u.currentOutputSnapshotRaw)}const a=s.val(!0),c=e;t.server_.put(c.toString(),a,l=>{Zo(t,"transaction put response",{path:c.toString(),status:l});let u=[];if(l==="ok"){const d=[];for(let h=0;h<n.length;h++)n[h].status=2,u=u.concat(Zt(t.serverSyncTree_,n[h].currentWriteId)),n[h].onComplete&&d.push(()=>n[h].onComplete(null,!0,n[h].currentOutputSnapshotResolved)),n[h].unwatcher();Gi(t,Jo(t.transactionQueueTree_,e)),ea(t,t.transactionQueueTree_),St(t.eventQueue_,e,u);for(let h=0;h<d.length;h++)wr(d[h])}else{if(l==="datastale")for(let d=0;d<n.length;d++)n[d].status===3?n[d].status=4:n[d].status=0;else{Re("transaction at "+c.toString()+" failed: "+l);for(let d=0;d<n.length;d++)n[d].status=4,n[d].abortReason=l}ta(t,e)}},o)}function ta(t,e){const n=Pd(t,e),r=Sr(n),i=Ad(t,n);return _v(t,i,r),r}function _v(t,e,n){if(e.length===0)return;const r=[];let i=[];const o=e.filter(a=>a.status===0).map(a=>a.currentWriteId);for(let a=0;a<e.length;a++){const c=e[a],l=be(n,c.path);let u=!1,d;if(D(l!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),c.status===4)u=!0,d=c.abortReason,i=i.concat(Zt(t.serverSyncTree_,c.currentWriteId,!0));else if(c.status===0)if(c.retryCount>=av)u=!0,d="maxretry",i=i.concat(Zt(t.serverSyncTree_,c.currentWriteId,!0));else{const h=kd(t,c.path,o);c.currentInputSnapshot=h;const p=e[a].update(h.val());if(p!==void 0){Sd("transaction failed: Data returned ",p,c.path);let f=_e(p);typeof p=="object"&&p!=null&&nt(p,".priority")||(f=f.updatePriority(h.getPriority()));const g=c.currentWriteId,T=Rd(t),P=Gy(f,h,T);c.currentOutputSnapshotRaw=f,c.currentOutputSnapshotResolved=P,c.currentWriteId=hv(t),o.splice(o.indexOf(g),1),i=i.concat(Oy(t.serverSyncTree_,c.path,P,c.currentWriteId,c.applyLocally)),i=i.concat(Zt(t.serverSyncTree_,g,!0))}else u=!0,d="nodata",i=i.concat(Zt(t.serverSyncTree_,c.currentWriteId,!0))}St(t.eventQueue_,n,i),i=[],u&&(e[a].status=2,(function(h){setTimeout(h,Math.floor(0))})(e[a].unwatcher),e[a].onComplete&&(d==="nodata"?r.push(()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot)):r.push(()=>e[a].onComplete(new Error(d),!1,null))))}Gi(t,t.transactionQueueTree_);for(let a=0;a<r.length;a++)wr(r[a]);ea(t,t.transactionQueueTree_)}function Pd(t,e){let n,r=t.transactionQueueTree_;for(n=X(e);n!==null&&In(r)===void 0;)r=Jo(r,n),e=se(e),n=X(e);return r}function Ad(t,e){const n=[];return Nd(t,e,n),n.sort((r,i)=>r.order-i.order),n}function Nd(t,e,n){const r=In(e);if(r)for(let i=0;i<r.length;i++)n.push(r[i]);$i(e,i=>{Nd(t,i,n)})}function Gi(t,e){const n=In(e);if(n){let r=0;for(let i=0;i<n.length;i++)n[i].status!==2&&(n[r]=n[i],r++);n.length=r,bd(e,n.length>0?n:void 0)}$i(e,r=>{Gi(t,r)})}function yv(t,e){const n=Sr(Pd(t,e)),r=Jo(t.transactionQueueTree_,e);return Ky(r,i=>{vs(t,i)}),vs(t,r),Ed(r,i=>{vs(t,i)}),n}function vs(t,e){const n=In(e);if(n){const r=[];let i=[],s=-1;for(let o=0;o<n.length;o++)n[o].status===3||(n[o].status===1?(D(s===o-1,"All SENT items should be at beginning of queue."),s=o,n[o].status=3,n[o].abortReason="set"):(D(n[o].status===0,"Unexpected transaction status in abort"),n[o].unwatcher(),i=i.concat(Zt(t.serverSyncTree_,n[o].currentWriteId,!0)),n[o].onComplete&&r.push(n[o].onComplete.bind(null,new Error("set"),!1,null))));s===-1?bd(e,void 0):n.length=s+1,St(t.eventQueue_,Sr(e),i);for(let o=0;o<r.length;o++)wr(r[o])}}function vv(t){let e="";const n=t.split("/");for(let r=0;r<n.length;r++)if(n[r].length>0){let i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch{}e+="/"+i}return e}function bv(t){const e={};t.charAt(0)==="?"&&(t=t.substring(1));for(const n of t.split("&")){if(n.length===0)continue;const r=n.split("=");r.length===2?e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]):Re(`Invalid query segment '${n}' in query '${t}'`)}return e}const Ac=function(t,e){const n=wv(t),r=n.namespace;n.domain==="firebase.com"&&Ze(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!r||r==="undefined")&&n.domain!=="localhost"&&Ze("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||Nm();const i=n.scheme==="ws"||n.scheme==="wss";return{repoInfo:new Ou(n.host,n.secure,r,i,e,"",r!==n.subdomain),path:new ie(n.pathString)}},wv=function(t){let e="",n="",r="",i="",s="",o=!0,a="https",c=443;if(typeof t=="string"){let l=t.indexOf("//");l>=0&&(a=t.substring(0,l-1),t=t.substring(l+2));let u=t.indexOf("/");u===-1&&(u=t.length);let d=t.indexOf("?");d===-1&&(d=t.length),e=t.substring(0,Math.min(u,d)),u<d&&(i=vv(t.substring(u,d)));const h=bv(t.substring(Math.min(t.length,d)));l=e.indexOf(":"),l>=0?(o=a==="https"||a==="wss",c=parseInt(e.substring(l+1),10)):l=e.length;const p=e.slice(0,l);if(p.toLowerCase()==="localhost")n="localhost";else if(p.split(".").length<=2)n=p;else{const f=e.indexOf(".");r=e.substring(0,f).toLowerCase(),n=e.substring(f+1),s=r}"ns"in h&&(s=h.ns)}return{host:e,port:c,domain:n,subdomain:r,secure:o,scheme:a,pathString:i,namespace:s}};class Ev{constructor(e,n,r,i){this.eventType=e,this.eventRegistration=n,this.snapshot=r,this.prevName=i}getPath(){const e=this.snapshot.ref;return this.eventType==="value"?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+ue(this.snapshot.exportVal())}}class Iv{constructor(e,n,r){this.eventRegistration=e,this.error=n,this.path=r}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}class Cv{constructor(e,n){this.snapshotCallback=e,this.cancelCallback=n}onValue(e,n){this.snapshotCallback.call(null,e,n)}onCancel(e){return D(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}}class na{constructor(e,n,r,i){this._repo=e,this._path=n,this._queryParams=r,this._orderByCalled=i}get key(){return J(this._path)?null:Bu(this._path)}get ref(){return new rt(this._repo,this._path)}get _queryIdentifier(){const e=gc(this._queryParams),n=Ao(e);return n==="{}"?"default":n}get _queryObject(){return gc(this._queryParams)}isEqual(e){if(e=Ee(e),!(e instanceof na))return!1;const n=this._repo===e._repo,r=Hu(this._path,e._path),i=this._queryIdentifier===e._queryIdentifier;return n&&r&&i}toJSON(){return this.toString()}toString(){return this._repo.toString()+p_(this._path)}}class rt extends na{constructor(e,n){super(e,n,new Fo,!1)}get parent(){const e=zu(this._path);return e===null?null:new rt(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}}class ar{constructor(e,n,r){this._node=e,this.ref=n,this._index=r}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){const n=new ie(e),r=Ys(this.ref,e);return new ar(this._node.getChild(n),r,ce)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(r,i)=>e(new ar(i,Ys(this.ref,r),ce)))}hasChild(e){const n=new ie(e);return!this._node.getChild(n).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function ZE(t,e){return t=Ee(t),t._checkNotDeleted("ref"),e!==void 0?Ys(t._root,e):t._root}function Ys(t,e){return t=Ee(t),X(t._path)===null?ev("child","path",e):Td("child","path",e),new rt(t._repo,de(t._path,e))}function eI(t){t=Ee(t);const e=new Cv(()=>{}),n=new ra(e);return fv(t._repo,t,n).then(r=>new ar(r,new rt(t._repo,t._path),t._queryParams.getIndex()))}class ra{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,n){const r=n._queryParams.getIndex();return new Ev("value",this,new ar(e.snapshotNode,new rt(n._repo,n._path),r))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new Iv(this,e,n):null}matches(e){return e instanceof ra?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}Cy(rt);Py(rt);const Sv="FIREBASE_DATABASE_EMULATOR_HOST",Js={};let Tv=!1;function Rv(t,e,n,r){const i=e.lastIndexOf(":"),s=e.substring(0,i),o=_n(s);t.repoInfo_=new Ou(e,o,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams,!0,n),r&&(t.authTokenProvider_=r)}function kv(t,e,n,r,i){let s=r||t.options.databaseURL;s===void 0&&(t.options.projectId||Ze("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),ve("Using default host for project ",t.options.projectId),s=`${t.options.projectId}-default-rtdb.firebaseio.com`);let o=Ac(s,i),a=o.repoInfo,c;typeof process<"u"&&Ja&&(c=Ja[Sv]),c?(s=`http://${c}?ns=${a.namespace}`,o=Ac(s,i),a=o.repoInfo):o.repoInfo.secure;const l=new qm(t.name,t.options,e);tv("Invalid Firebase Database URL",o),J(o.path)||Ze("Database URL must point to the root of a Firebase Database (not including a child path).");const u=Av(a,t,l,new Bm(t,n));return new Nv(u,t)}function Pv(t,e){const n=Js[e];(!n||n[t.key]!==t)&&Ze(`Database ${e}(${t.repoInfo_}) has already been deleted.`),gv(t),delete n[t.key]}function Av(t,e,n,r){let i=Js[e.name];i||(i={},Js[e.name]=i);let s=i[t.toURLString()];return s&&Ze("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),s=new cv(t,Tv,n,r),i[t.toURLString()]=s,s}class Nv{constructor(e,n){this._repoInternal=e,this.app=n,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(lv(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new rt(this._repo,Z())),this._rootInternal}_delete(){return this._rootInternal!==null&&(Pv(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&Ze("Cannot call "+e+" on a deleted database.")}}function Ov(t=Ml(),e){const n=bo(t,"database").getImmediate({identifier:e});if(!n._instanceStarted){const r=Fh("database");r&&Dv(n,...r)}return n}function Dv(t,e,n,r={}){t=Ee(t),t._checkNotDeleted("useEmulator");const i=`${e}:${n}`,s=t._repoInternal;if(t._instanceStarted){if(i===t._repoInternal.repoInfo_.host&&Dt(r,s.repoInfo_.emulatorOptions))return;Ze("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let o;if(s.repoInfo_.nodeAdmin)r.mockUserToken&&Ze('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),o=new Jr(Jr.OWNER);else if(r.mockUserToken){const a=typeof r.mockUserToken=="string"?r.mockUserToken:Uh(r.mockUserToken,t.app.options.projectId);o=new Jr(a)}_n(e)&&(Rl(e),kl("Database",!0)),Rv(s,i,r,o)}function xv(t){Sm(vn),cn(new xt("database",(e,{instanceIdentifier:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),s=e.getProvider("app-check-internal");return kv(r,i,s,n)},"PUBLIC").setMultipleInstances(!0)),ft(Xa,Za,t),ft(Xa,Za,"esm2017")}Ye.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)};Ye.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};xv();function Mv(t){const e=xl(t),n=Im(e),r=Ov(e);return{app:e,auth:n,firebaseDb:r}}let en=null;function tI(t){if(en)return en;const e={apiKey:t.apiKey,authDomain:t.authDomain,databaseURL:t.databaseURL,projectId:t.projectId,storageBucket:t.storageBucket,messagingSenderId:t.messagingSenderId};return en=Mv(e),en}function ia(){if(!en)throw new Error("Firebase not initialized. Call initializeFirebase() first.");return en}const nI=new Proxy({},{get(t,e){return ia().auth[e]}}),rI=new Proxy({},{get(t,e){return ia().firebaseDb[e]}});function me(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Lv=typeof Symbol=="function"&&Symbol.observable||"@@observable",Nc=Lv,bs=()=>Math.random().toString(36).substring(7).split("").join("."),Fv={INIT:`@@redux/INIT${bs()}`,REPLACE:`@@redux/REPLACE${bs()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${bs()}`},Ei=Fv;function bt(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Od(t,e,n){if(typeof t!="function")throw new Error(me(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(me(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(me(1));return n(Od)(t,e)}let r=t,i=e,s=new Map,o=s,a=0,c=!1;function l(){o===s&&(o=new Map,s.forEach((g,T)=>{o.set(T,g)}))}function u(){if(c)throw new Error(me(3));return i}function d(g){if(typeof g!="function")throw new Error(me(4));if(c)throw new Error(me(5));let T=!0;l();const P=a++;return o.set(P,g),function(){if(T){if(c)throw new Error(me(6));T=!1,l(),o.delete(P),s=null}}}function h(g){if(!bt(g))throw new Error(me(7));if(typeof g.type>"u")throw new Error(me(8));if(typeof g.type!="string")throw new Error(me(17));if(c)throw new Error(me(9));try{c=!0,i=r(i,g)}finally{c=!1}return(s=o).forEach(P=>{P()}),g}function p(g){if(typeof g!="function")throw new Error(me(10));r=g,h({type:Ei.REPLACE})}function f(){const g=d;return{subscribe(T){if(typeof T!="object"||T===null)throw new Error(me(11));function P(){const b=T;b.next&&b.next(u())}return P(),{unsubscribe:g(P)}},[Nc](){return this}}}return h({type:Ei.INIT}),{dispatch:h,subscribe:d,getState:u,replaceReducer:p,[Nc]:f}}function Uv(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:Ei.INIT})>"u")throw new Error(me(12));if(typeof n(void 0,{type:Ei.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(me(13))})}function Dd(t){const e=Object.keys(t),n={};for(let s=0;s<e.length;s++){const o=e[s];typeof t[o]=="function"&&(n[o]=t[o])}const r=Object.keys(n);let i;try{Uv(n)}catch(s){i=s}return function(o={},a){if(i)throw i;let c=!1;const l={};for(let u=0;u<r.length;u++){const d=r[u],h=n[d],p=o[d],f=h(p,a);if(typeof f>"u")throw a&&a.type,new Error(me(14));l[d]=f,c=c||f!==p}return c=c||r.length!==Object.keys(o).length,c?l:o}}function Ii(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function Wv(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(me(15))};const o={getState:i.getState,dispatch:(c,...l)=>s(c,...l)},a=t.map(c=>c(o));return s=Ii(...a)(i.dispatch),{...i,dispatch:s}}}function xd(t){return bt(t)&&"type"in t&&typeof t.type=="string"}var sa=Symbol.for("immer-nothing"),$n=Symbol.for("immer-draftable"),ge=Symbol.for("immer-state");function ye(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Te=Object,Wt=Te.getPrototypeOf,cr="constructor",Tr="prototype",Xs="configurable",Ci="enumerable",Xr="writable",lr="value",ke=t=>!!t&&!!t[ge];function Pe(t){return t?Md(t)||kr(t)||!!t[$n]||!!t[cr]?.[$n]||Pr(t)||Ar(t):!1}var Vv=Te[Tr][cr].toString(),Oc=new WeakMap;function Md(t){if(!t||!fn(t))return!1;const e=Wt(t);if(e===null||e===Te[Tr])return!0;const n=Te.hasOwnProperty.call(e,cr)&&e[cr];if(n===Object)return!0;if(!Nt(n))return!1;let r=Oc.get(n);return r===void 0&&(r=Function.toString.call(n),Oc.set(n,r)),r===Vv}function Bv(t){return ke(t)||ye(15,t),t[ge].base_}function Rr(t,e,n=!0){Vt(t)===0?(n?Reflect.ownKeys(t):Te.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function Vt(t){const e=t[ge];return e?e.type_:kr(t)?1:Pr(t)?2:Ar(t)?3:0}var Gn=(t,e,n=Vt(t))=>n===2?t.has(e):Te[Tr].hasOwnProperty.call(t,e),je=(t,e,n=Vt(t))=>n===2?t.get(e):t[e],Si=(t,e,n,r=Vt(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function qv(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var kr=Array.isArray,Pr=t=>t instanceof Map,Ar=t=>t instanceof Set,fn=t=>typeof t=="object",Nt=t=>typeof t=="function",ws=t=>typeof t=="boolean";function zv(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Hv=t=>fn(t)?t?.[ge]:null,$e=t=>t.copy_||t.base_,oa=t=>t.modified_?t.copy_:t.base_;function Zs(t,e){if(Pr(t))return new Map(t);if(Ar(t))return new Set(t);if(kr(t))return Array[Tr].slice.call(t);const n=Md(t);if(e===!0||e==="class_only"&&!n){const r=Te.getOwnPropertyDescriptors(t);delete r[ge];let i=Reflect.ownKeys(r);for(let s=0;s<i.length;s++){const o=i[s],a=r[o];a[Xr]===!1&&(a[Xr]=!0,a[Xs]=!0),(a.get||a.set)&&(r[o]={[Xs]:!0,[Xr]:!0,[Ci]:a[Ci],[lr]:t[o]})}return Te.create(Wt(t),r)}else{const r=Wt(t);if(r!==null&&n)return{...t};const i=Te.create(r);return Te.assign(i,t)}}function aa(t,e=!1){return Qi(t)||ke(t)||!Pe(t)||(Vt(t)>1&&Te.defineProperties(t,{set:Fr,add:Fr,clear:Fr,delete:Fr}),Te.freeze(t),e&&Rr(t,(n,r)=>{aa(r,!0)},!1)),t}function jv(){ye(2)}var Fr={[lr]:jv};function Qi(t){return t===null||!fn(t)?!0:Te.isFrozen(t)}var Ti="MapSet",Ri="Patches",Dc="ArrayMethods",ki={};function Bt(t){const e=ki[t];return e||ye(0,t),e}var xc=t=>!!ki[t];function $v(t,e){ki[t]||(ki[t]=e)}var ur,Ld=()=>ur,Gv=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:xc(Ti)?Bt(Ti):void 0,arrayMethodsPlugin_:xc(Dc)?Bt(Dc):void 0});function Mc(t,e){e&&(t.patchPlugin_=Bt(Ri),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function eo(t){to(t),t.drafts_.forEach(Qv),t.drafts_=null}function to(t){t===ur&&(ur=t.parent_)}var Lc=t=>ur=Gv(ur,t);function Qv(t){const e=t[ge];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Fc(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[ge].modified_&&(eo(e),ye(4)),Pe(t)&&(t=Uc(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[ge].base_,t,e)}else t=Uc(e,n);return Kv(e,t,!0),eo(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==sa?t:void 0}function Uc(t,e){if(Qi(e))return e;const n=e[ge];if(!n)return Pi(e,t.handledSet_,t);if(!Ki(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);Wd(n,t)}return n.copy_}function Kv(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&aa(e,n)}function Fd(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var Ki=(t,e)=>t.scope_===e,Yv=[];function Ud(t,e,n,r){const i=$e(t),s=t.type_;if(r!==void 0&&je(i,r,s)===e){Si(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;Rr(i,(c,l)=>{if(ke(l)){const u=a.get(l)||[];u.push(c),a.set(l,u)}})}const o=t.draftLocations_.get(e)??Yv;for(const a of o)Si(i,a,n,s)}function Jv(t,e,n){t.callbacks_.push(function(i){const s=e;if(!s||!Ki(s,i))return;i.mapSetPlugin_?.fixSetContents(s);const o=oa(s);Ud(t,s.draft_??s,o,n),Wd(s,i)})}function Wd(t,e){if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){const{patchPlugin_:r}=e;if(r){const i=r.getPath(t);i&&r.generatePatches_(t,i,e)}Fd(t)}}function Xv(t,e,n){const{scope_:r}=t;if(ke(n)){const i=n[ge];Ki(i,r)&&i.callbacks_.push(function(){Zr(t);const o=oa(i);Ud(t,n,o,e)})}else Pe(n)&&t.callbacks_.push(function(){const s=$e(t);t.type_===3?s.has(n)&&Pi(n,r.handledSet_,r):je(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&Pi(je(t.copy_,e,t.type_),r.handledSet_,r)})}function Pi(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||ke(t)||e.has(t)||!Pe(t)||Qi(t)||(e.add(t),Rr(t,(r,i)=>{if(ke(i)){const s=i[ge];if(Ki(s,n)){const o=oa(s);Si(t,r,o,t.type_),Fd(s)}}else Pe(i)&&Pi(i,e,n)})),t}function Zv(t,e){const n=kr(t),r={type_:n?1:0,scope_:e?e.scope_:Ld(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=Ai;n&&(i=[r],s=dr);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var Ai={get(t,e){if(e===ge)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n?.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=$e(t);if(!Gn(i,e,t.type_))return eb(t,i,e);const s=i[e];if(t.finalized_||!Pe(s)||r&&t.operationMethod&&n?.isMutatingArrayMethod(t.operationMethod)&&zv(e))return s;if(s===Es(t.base_,e)){Zr(t);const o=t.type_===1?+e:e,a=ro(t.scope_,s,t,o);return t.copy_[o]=a}return s},has(t,e){return e in $e(t)},ownKeys(t){return Reflect.ownKeys($e(t))},set(t,e,n){const r=Vd($e(t),e);if(r?.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=Es($e(t),e),s=i?.[ge];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(qv(n,i)&&(n!==void 0||Gn(t.base_,e,t.type_)))return!0;Zr(t),no(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),Xv(t,e,n)),!0},deleteProperty(t,e){return Zr(t),Es(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),no(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=$e(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[Xr]:!0,[Xs]:t.type_!==1||e!=="length",[Ci]:r[Ci],[lr]:n[e]}},defineProperty(){ye(11)},getPrototypeOf(t){return Wt(t.base_)},setPrototypeOf(){ye(12)}},dr={};for(let t in Ai){let e=Ai[t];dr[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}dr.deleteProperty=function(t,e){return dr.set.call(this,t,e,void 0)};dr.set=function(t,e,n){return Ai.set.call(this,t[0],e,n,t[0])};function Es(t,e){const n=t[ge];return(n?$e(n):t)[e]}function eb(t,e,n){const r=Vd(e,n);return r?lr in r?r[lr]:r.get?.call(t.draft_):void 0}function Vd(t,e){if(!(e in t))return;let n=Wt(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Wt(n)}}function no(t){t.modified_||(t.modified_=!0,t.parent_&&no(t.parent_))}function Zr(t){t.copy_||(t.assigned_=new Map,t.copy_=Zs(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var tb=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,n,r)=>{if(Nt(e)&&!Nt(n)){const s=n;n=e;const o=this;return function(c=s,...l){return o.produce(c,u=>n.call(this,u,...l))}}Nt(n)||ye(6),r!==void 0&&!Nt(r)&&ye(7);let i;if(Pe(e)){const s=Lc(this),o=ro(s,e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?eo(s):to(s)}return Mc(s,r),Fc(i,s)}else if(!e||!fn(e)){if(i=n(e),i===void 0&&(i=e),i===sa&&(i=void 0),this.autoFreeze_&&aa(i,!0),r){const s=[],o=[];Bt(Ri).generateReplacementPatches_(e,i,{patches_:s,inversePatches_:o}),r(s,o)}return i}else ye(1,e)},this.produceWithPatches=(e,n)=>{if(Nt(e))return(o,...a)=>this.produceWithPatches(o,c=>e(c,...a));let r,i;return[this.produce(e,n,(o,a)=>{r=o,i=a}),r,i]},ws(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),ws(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),ws(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Pe(t)||ye(8),ke(t)&&(t=Bd(t));const e=Lc(this),n=ro(e,t,void 0);return n[ge].isManual_=!0,to(e),n}finishDraft(t,e){const n=t&&t[ge];(!n||!n.isManual_)&&ye(9);const{scope_:r}=n;return Mc(r,e),Fc(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=Bt(Ri).applyPatches_;return ke(t)?r(t,e):this.produce(t,i=>r(i,e))}};function ro(t,e,n,r){const[i,s]=Pr(e)?Bt(Ti).proxyMap_(e,n):Ar(e)?Bt(Ti).proxySet_(e,n):Zv(e,n);return(n?.scope_??Ld()).drafts_.push(i),s.callbacks_=n?.callbacks_??[],s.key_=r,n&&r!==void 0?Jv(n,s,r):s.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(s);const{patchPlugin_:l}=c;s.modified_&&l&&l.generatePatches_(s,[],c)}),i}function Bd(t){return ke(t)||ye(10,t),qd(t)}function qd(t){if(!Pe(t)||Qi(t))return t;const e=t[ge];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=Zs(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=Zs(t,!0);return Rr(n,(i,s)=>{Si(n,i,qd(s))},r),e&&(e.finalized_=!1),n}function nb(){function e(f,I=[]){if(f.key_!==void 0){const g=f.parent_.copy_??f.parent_.base_,T=Hv(je(g,f.key_)),P=je(g,f.key_);if(P===void 0||P!==f.draft_&&P!==f.base_&&P!==f.copy_||T!=null&&T.base_!==f.base_)return null;const m=f.parent_.type_===3;let b;if(m){const _=f.parent_;b=Array.from(_.drafts_.keys()).indexOf(f.key_)}else b=f.key_;if(!(m&&g.size>b||Gn(g,b)))return null;I.push(b)}if(f.parent_)return e(f.parent_,I);I.reverse();try{n(f.copy_,I)}catch{return null}return I}function n(f,I){let g=f;for(let T=0;T<I.length-1;T++){const P=I[T];if(g=je(g,P),!fn(g)||g===null)throw new Error(`Cannot resolve path at '${I.join("/")}'`)}return g}const r="replace",i="add",s="remove";function o(f,I,g){if(f.scope_.processedForPatches_.has(f))return;f.scope_.processedForPatches_.add(f);const{patches_:T,inversePatches_:P}=g;switch(f.type_){case 0:case 2:return c(f,I,T,P);case 1:return a(f,I,T,P);case 3:return l(f,I,T,P)}}function a(f,I,g,T){let{base_:P,assigned_:m}=f,b=f.copy_;b.length<P.length&&([P,b]=[b,P],[g,T]=[T,g]);const _=f.allIndicesReassigned_===!0;for(let v=0;v<P.length;v++){const S=b[v],w=P[v];if((_||m?.get(v.toString()))&&S!==w){const C=S?.[ge];if(C&&C.modified_)continue;const y=I.concat([v]);g.push({op:r,path:y,value:p(S)}),T.push({op:r,path:y,value:p(w)})}}for(let v=P.length;v<b.length;v++){const S=I.concat([v]);g.push({op:i,path:S,value:p(b[v])})}for(let v=b.length-1;P.length<=v;--v){const S=I.concat([v]);T.push({op:s,path:S})}}function c(f,I,g,T){const{base_:P,copy_:m,type_:b}=f;Rr(f.assigned_,(_,v)=>{const S=je(P,_,b),w=je(m,_,b),R=v?Gn(P,_)?r:i:s;if(S===w&&R===r)return;const C=I.concat(_);g.push(R===s?{op:R,path:C}:{op:R,path:C,value:p(w)}),T.push(R===i?{op:s,path:C}:R===s?{op:i,path:C,value:p(S)}:{op:r,path:C,value:p(S)})})}function l(f,I,g,T){let{base_:P,copy_:m}=f,b=0;P.forEach(_=>{if(!m.has(_)){const v=I.concat([b]);g.push({op:s,path:v,value:_}),T.unshift({op:i,path:v,value:_})}b++}),b=0,m.forEach(_=>{if(!P.has(_)){const v=I.concat([b]);g.push({op:i,path:v,value:_}),T.unshift({op:s,path:v,value:_})}b++})}function u(f,I,g){const{patches_:T,inversePatches_:P}=g;T.push({op:r,path:[],value:I===sa?void 0:I}),P.push({op:r,path:[],value:f})}function d(f,I){return I.forEach(g=>{const{path:T,op:P}=g;let m=f;for(let S=0;S<T.length-1;S++){const w=Vt(m);let R=T[S];typeof R!="string"&&typeof R!="number"&&(R=""+R),(w===0||w===1)&&(R==="__proto__"||R===cr)&&ye(19),Nt(m)&&R===Tr&&ye(19),m=je(m,R),fn(m)||ye(18,T.join("/"))}const b=Vt(m),_=h(g.value),v=T[T.length-1];switch(P){case r:switch(b){case 2:return m.set(v,_);case 3:ye(16);default:return m[v]=_}case i:switch(b){case 1:return v==="-"?m.push(_):m.splice(v,0,_);case 2:return m.set(v,_);case 3:return m.add(_);default:return m[v]=_}case s:switch(b){case 1:return m.splice(v,1);case 2:return m.delete(v);case 3:return m.delete(g.value);default:return delete m[v]}default:ye(17,P)}}),f}function h(f){if(!Pe(f))return f;if(kr(f))return f.map(h);if(Pr(f))return new Map(Array.from(f.entries()).map(([g,T])=>[g,h(T)]));if(Ar(f))return new Set(Array.from(f).map(h));const I=Object.create(Wt(f));for(const g in f)I[g]=h(f[g]);return Gn(f,$n)&&(I[$n]=f[$n]),I}function p(f){return ke(f)?h(f):f}$v(Ri,{applyPatches_:d,generatePatches_:o,generateReplacementPatches_:u,getPath:e})}var hr=new tb,Nr=hr.produce,zd=hr.produceWithPatches.bind(hr),Wc=hr.applyPatches.bind(hr);function rb(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function ib(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function sb(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var Vc=t=>Array.isArray(t)?t:[t];function ob(t){const e=Array.isArray(t[0])?t[0]:t;return sb(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function ab(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}var cb=class{constructor(t){this.value=t}deref(){return this.value}},lb=typeof WeakRef<"u"?WeakRef:cb,ub=0,Bc=1;function Ur(){return{s:ub,v:void 0,o:null,p:null}}function Ni(t,e={}){let n=Ur();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=n;const{length:c}=arguments;for(let d=0,h=c;d<h;d++){const p=arguments[d];if(typeof p=="function"||typeof p=="object"&&p!==null){let f=a.o;f===null&&(a.o=f=new WeakMap);const I=f.get(p);I===void 0?(a=Ur(),f.set(p,a)):a=I}else{let f=a.p;f===null&&(a.p=f=new Map);const I=f.get(p);I===void 0?(a=Ur(),f.set(p,a)):a=I}}const l=a;let u;if(a.s===Bc)u=a.v;else if(u=t.apply(null,arguments),s++,r){const d=i?.deref?.()??i;d!=null&&r(d,u)&&(u=d,s!==0&&s--),i=typeof u=="object"&&u!==null||typeof u=="function"?new lb(u):u}return l.s=Bc,l.v=u,u}return o.clearCache=()=>{n=Ur(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function db(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,a,c={},l=i.pop();typeof l=="object"&&(c=l,l=i.pop()),rb(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const u={...n,...c},{memoize:d,memoizeOptions:h=[],argsMemoize:p=Ni,argsMemoizeOptions:f=[]}=u,I=Vc(h),g=Vc(f),T=ob(i),P=d(function(){return s++,l.apply(null,arguments)},...I),m=p(function(){o++;const _=ab(T,arguments);return a=P.apply(null,_),a},...g);return Object.assign(m,{resultFunc:l,memoizedResultFunc:P,dependencies:T,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var ca=db(Ni),hb=Object.assign((t,e=ca)=>{ib(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(s=>t[s]);return e(r,(...s)=>s.reduce((o,a,c)=>(o[n[c]]=a,o),{}))},{withTypes:()=>hb});function Hd(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var fb=Hd(),pb=Hd,gb=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ii:Ii.apply(null,arguments)},mb=t=>t&&typeof t.match=="function";function Ue(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(Ae(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>xd(r)&&r.type===t,n}var jd=class Ln extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Ln.prototype)}static get[Symbol.species](){return Ln}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new Ln(...e[0].concat(this)):new Ln(...e.concat(this))}};function qc(t){return Pe(t)?Nr(t,()=>{}):t}function Wr(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function _b(t){return typeof t=="boolean"}var yb=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new jd;return n&&(_b(n)?o.push(fb):o.push(pb(n.extraArgument))),o},Yi="RTK_autoBatch",An=()=>t=>({payload:t,meta:{[Yi]:!0}}),zc=t=>e=>{setTimeout(e,t)},vb=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const a=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:zc(10):t.type==="callback"?t.queueNotification:zc(t.timeout),l=()=>{o=!1,s&&(s=!1,a.forEach(u=>u()))};return Object.assign({},r,{subscribe(u){const d=()=>i&&u(),h=r.subscribe(d);return a.add(u),()=>{h(),a.delete(u)}},dispatch(u){try{return i=!u?.meta?.[Yi],s=!i,s&&(o||(o=!0,c(l))),r.dispatch(u)}finally{i=!0}}})},bb=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new jd(t);return r&&i.push(vb(typeof r=="object"?r:void 0)),i};function iI(t){const e=yb(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(bt(n))a=Dd(n);else throw new Error(Ae(1));let c;typeof r=="function"?c=r(e):c=e();let l=Ii;i&&(l=gb({trace:!1,...typeof i=="object"&&i}));const u=Wv(...c),d=bb(u);let h=typeof o=="function"?o(d):d();const p=l(...h);return Od(a,s,p)}function $d(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(Ae(28));if(a in e)throw new Error(Ae(29));return e[a]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function wb(t){return typeof t=="function"}function Eb(t,e){let[n,r,i]=$d(e),s;if(wb(t))s=()=>qc(t());else{const a=qc(t);s=()=>a}function o(a=s(),c){let l=[n[c.type],...r.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return l.filter(u=>!!u).length===0&&(l=[i]),l.reduce((u,d)=>{if(d)if(ke(u)){const p=d(u,c);return p===void 0?u:p}else{if(Pe(u))return Nr(u,h=>d(h,c));{const h=d(u,c);if(h===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return h}}return u},a)}return o.getInitialState=s,o}var Gd=(t,e)=>mb(t)?t.match(e):t(e);function et(...t){return e=>t.some(n=>Gd(n,e))}function Qn(...t){return e=>t.every(n=>Gd(n,e))}function Ji(t,e){if(!t||!t.meta)return!1;const n=typeof t.meta.requestId=="string",r=e.indexOf(t.meta.requestStatus)>-1;return n&&r}function Or(t){return typeof t[0]=="function"&&"pending"in t[0]&&"fulfilled"in t[0]&&"rejected"in t[0]}function la(...t){return t.length===0?e=>Ji(e,["pending"]):Or(t)?et(...t.map(e=>e.pending)):la()(t[0])}function pn(...t){return t.length===0?e=>Ji(e,["rejected"]):Or(t)?et(...t.map(e=>e.rejected)):pn()(t[0])}function Xi(...t){const e=n=>n&&n.meta&&n.meta.rejectedWithValue;return t.length===0?Qn(pn(...t),e):Or(t)?Qn(pn(...t),e):Xi()(t[0])}function wt(...t){return t.length===0?e=>Ji(e,["fulfilled"]):Or(t)?et(...t.map(e=>e.fulfilled)):wt()(t[0])}function io(...t){return t.length===0?e=>Ji(e,["pending","fulfilled","rejected"]):Or(t)?et(...t.flatMap(e=>[e.pending,e.rejected,e.fulfilled])):io()(t[0])}var Ib="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ua=(t=21)=>{let e="",n=t;for(;n--;)e+=Ib[Math.random()*64|0];return e},Cb=["name","message","stack","code"],Is=class{constructor(t,e){this.payload=t,this.meta=e}_type},Hc=class{constructor(t,e){this.payload=t,this.meta=e}_type},Sb=t=>{if(typeof t=="object"&&t!==null){const e={};for(const n of Cb)typeof t[n]=="string"&&(e[n]=t[n]);return e}return{message:String(t)}},jc="External signal was aborted",$c=(()=>{function t(e,n,r){const i=Ue(e+"/fulfilled",(c,l,u,d)=>({payload:c,meta:{...d||{},arg:u,requestId:l,requestStatus:"fulfilled"}})),s=Ue(e+"/pending",(c,l,u)=>({payload:void 0,meta:{...u||{},arg:l,requestId:c,requestStatus:"pending"}})),o=Ue(e+"/rejected",(c,l,u,d,h)=>({payload:d,error:(r&&r.serializeError||Sb)(c||"Rejected"),meta:{...h||{},arg:u,requestId:l,rejectedWithValue:!!d,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:l}={}){return(u,d,h)=>{const p=r?.idGenerator?r.idGenerator(c):ua(),f=new AbortController;let I,g;function T(m){g=m,f.abort()}l&&(l.aborted?T(jc):l.addEventListener("abort",()=>T(jc),{once:!0}));const P=(async function(){let m;try{let _=r?.condition?.(c,{getState:d,extra:h});if(Rb(_)&&(_=await _),_===!1||f.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const v=new Promise((S,w)=>{I=()=>{w({name:"AbortError",message:g||"Aborted"})},f.signal.addEventListener("abort",I,{once:!0})});u(s(p,c,r?.getPendingMeta?.({requestId:p,arg:c},{getState:d,extra:h}))),m=await Promise.race([v,Promise.resolve(n(c,{dispatch:u,getState:d,extra:h,requestId:p,signal:f.signal,abort:T,rejectWithValue:(S,w)=>new Is(S,w),fulfillWithValue:(S,w)=>new Hc(S,w)})).then(S=>{if(S instanceof Is)throw S;return S instanceof Hc?i(S.payload,p,c,S.meta):i(S,p,c)})])}catch(_){m=_ instanceof Is?o(null,p,c,_.payload,_.meta):o(_,p,c)}finally{I&&f.signal.removeEventListener("abort",I)}return r&&!r.dispatchConditionRejection&&o.match(m)&&m.meta.condition||u(m),m})();return Object.assign(P,{abort:T,requestId:p,arg:c,unwrap(){return P.then(Tb)}})}}return Object.assign(a,{pending:s,rejected:o,fulfilled:i,settled:et(o,i),typePrefix:e})}return t.withTypes=()=>t,t})();function Tb(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function Rb(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var kb=Symbol.for("rtk-slice-createasyncthunk");function Pb(t,e){return`${t}/${e}`}function Ab({creators:t}={}){const e=t?.asyncThunk?.[kb];return function(r){const{name:i,reducerPath:s=i}=r;if(!i)throw new Error(Ae(11));const o=(typeof r.reducers=="function"?r.reducers(Ob()):r.reducers)||{},a=Object.keys(o),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},l={addCase(m,b){const _=typeof m=="string"?m:m.type;if(!_)throw new Error(Ae(12));if(_ in c.sliceCaseReducersByType)throw new Error(Ae(13));return c.sliceCaseReducersByType[_]=b,l},addMatcher(m,b){return c.sliceMatchers.push({matcher:m,reducer:b}),l},exposeAction(m,b){return c.actionCreators[m]=b,l},exposeCaseReducer(m,b){return c.sliceCaseReducersByName[m]=b,l}};a.forEach(m=>{const b=o[m],_={reducerName:m,type:Pb(i,m),createNotation:typeof r.reducers=="function"};xb(b)?Lb(_,b,l,e):Db(_,b,l)});function u(){const[m={},b=[],_=void 0]=typeof r.extraReducers=="function"?$d(r.extraReducers):[r.extraReducers],v={...m,...c.sliceCaseReducersByType};return Eb(r.initialState,S=>{for(let w in v)S.addCase(w,v[w]);for(let w of c.sliceMatchers)S.addMatcher(w.matcher,w.reducer);for(let w of b)S.addMatcher(w.matcher,w.reducer);_&&S.addDefaultCase(_)})}const d=m=>m,h=new Map,p=new WeakMap;let f;function I(m,b){return f||(f=u()),f(m,b)}function g(){return f||(f=u()),f.getInitialState()}function T(m,b=!1){function _(S){let w=S[m];return typeof w>"u"&&b&&(w=Wr(p,_,g)),w}function v(S=d){const w=Wr(h,b,()=>new WeakMap);return Wr(w,S,()=>{const R={};for(const[C,y]of Object.entries(r.selectors??{}))R[C]=Nb(y,S,()=>Wr(p,S,g),b);return R})}return{reducerPath:m,getSelectors:v,get selectors(){return v(_)},selectSlice:_}}const P={name:i,reducer:I,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:g,...T(s),injectInto(m,{reducerPath:b,..._}={}){const v=b??s;return m.inject({reducerPath:v,reducer:I},_),{...P,...T(v,!0)}}};return P}}function Nb(t,e,n,r){function i(s,...o){let a=e(s);return typeof a>"u"&&r&&(a=n()),t(a,...o)}return i.unwrapped=t,i}var Qt=Ab();function Ob(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function Db({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!Mb(r))throw new Error(Ae(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Ue(t,o):Ue(t))}function xb(t){return t._reducerDefinitionType==="asyncThunk"}function Mb(t){return t._reducerDefinitionType==="reducerWithPrepare"}function Lb({type:t,reducerName:e},n,r,i){if(!i)throw new Error(Ae(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:c,settled:l,options:u}=n,d=i(t,s,u);r.exposeAction(e,d),o&&r.addCase(d.fulfilled,o),a&&r.addCase(d.pending,a),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(e,{fulfilled:o||Vr,pending:a||Vr,rejected:c||Vr,settled:l||Vr})}function Vr(){}function Ae(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Cs={exports:{}},Ss={};var Gc;function Fb(){if(Gc)return Ss;Gc=1;var t=Rh();function e(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,o=t.useMemo,a=t.useDebugValue;return Ss.useSyncExternalStoreWithSelector=function(c,l,u,d,h){var p=i(null);if(p.current===null){var f={hasValue:!1,value:null};p.current=f}else f=p.current;p=o(function(){function g(_){if(!T){if(T=!0,P=_,_=d(_),h!==void 0&&f.hasValue){var v=f.value;if(h(v,_))return m=v}return m=_}if(v=m,n(P,_))return v;var S=d(_);return h!==void 0&&h(v,S)?(P=_,v):(P=_,m=S)}var T=!1,P,m,b=u===void 0?null:u;return[function(){return g(l())},b===null?void 0:function(){return g(b())}]},[l,u,d,h]);var I=r(c,p[0],p[1]);return s(function(){f.hasValue=!0,f.value=I},[I]),a(I),I},Ss}var Qc;function Ub(){return Qc||(Qc=1,Cs.exports=Fb()),Cs.exports}var Wb=Ub();function Qd(t){t()}function Vb(){let t=null,e=null;return{clear(){t=null,e=null},notify(){Qd(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Kc={notify(){},get:()=>[]};function Bb(t,e){let n,r=Kc,i=0,s=!1;function o(I){u();const g=r.subscribe(I);let T=!1;return()=>{T||(T=!0,g(),d())}}function a(){r.notify()}function c(){f.onStateChange&&f.onStateChange()}function l(){return s}function u(){i++,n||(n=t.subscribe(c),r=Vb())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Kc)}function h(){s||(s=!0,u())}function p(){s&&(s=!1,d())}const f={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:c,isSubscribed:l,trySubscribe:h,tryUnsubscribe:p,getListeners:()=>r};return f}var qb=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",zb=qb(),Hb=()=>typeof navigator<"u"&&navigator.product==="ReactNative",jb=Hb(),$b=()=>zb||jb?B.useLayoutEffect:B.useEffect,Gb=$b();function Yc(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function Kn(t,e){if(Yc(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(!Object.prototype.hasOwnProperty.call(e,n[i])||!Yc(t[n[i]],e[n[i]]))return!1;return!0}var Qb=Symbol.for("react-redux-context"),Kb=typeof globalThis<"u"?globalThis:{};function Yb(){if(!B.createContext)return{};const t=Kb[Qb]??=new Map;let e=t.get(B.createContext);return e||(e=B.createContext(null),t.set(B.createContext,e)),e}var Et=Yb();function Jb(t){const{children:e,context:n,serverState:r,store:i}=t,s=B.useMemo(()=>{const c=Bb(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=B.useMemo(()=>i.getState(),[i]);Gb(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const a=n||Et;return B.createElement(a.Provider,{value:s},e)}var sI=Jb;function da(t=Et){return function(){return B.useContext(t)}}var Kd=da();function Yd(t=Et){const e=t===Et?Kd:da(t),n=()=>{const{store:r}=e();return r};return Object.assign(n,{withTypes:()=>n}),n}var Jd=Yd();function Xb(t=Et){const e=t===Et?Jd:Yd(t),n=()=>e().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Zb=Xb(),ew=(t,e)=>t===e;function tw(t=Et){const e=t===Et?Kd:da(t),n=(r,i={})=>{const{equalityFn:s=ew}=typeof i=="function"?{equalityFn:i}:i,o=e(),{store:a,subscription:c,getServerState:l}=o;B.useRef(!0);const u=B.useCallback({[r.name](h){return r(h)}}[r.name],[r]),d=Wb.useSyncExternalStoreWithSelector(c.addNestedSub,a.getState,l||a.getState,u,s);return B.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var nw=tw(),rw=Qd,iw=class extends Error{issues;constructor(t){super(t[0].message),this.name="SchemaError",this.issues=t}},Xd=(t=>(t.uninitialized="uninitialized",t.pending="pending",t.fulfilled="fulfilled",t.rejected="rejected",t))(Xd||{}),tt="uninitialized",so="pending",Fn="fulfilled",Un="rejected";function Jc(t){return{status:t,isUninitialized:t===tt,isLoading:t===so,isSuccess:t===Fn,isError:t===Un}}var Xc=bt;function ha(t,e){if(t===e||!(Xc(t)&&Xc(e)||Array.isArray(t)&&Array.isArray(e)))return e;const n=Object.keys(e),r=Object.keys(t);let i=n.length===r.length;const s=Array.isArray(e)?[]:{};for(const o of n)s[o]=ha(t[o],e[o]),i&&(i=t[o]===s[o]);return i?t:s}function oo(t,e,n){return t.reduce((r,i,s)=>(e(i,s)&&r.push(n(i,s)),r),[]).flat()}function sw(t){return new RegExp("(^|:)//").test(t)}function ow(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function fa(t){return t!=null}function Zc(t){return[...t?.values()??[]].filter(fa)}function aw(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var cw=t=>t.replace(/\/$/,""),lw=t=>t.replace(/^\//,"");function uw(t,e){if(!t)return e;if(!e)return t;if(sw(e))return e;const n=t.endsWith("/")||!e.startsWith("?")?"/":"";return t=cw(t),e=lw(e),`${t}${n}${e}`}function Oi(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}var ao=()=>new Map,dw=t=>{const e=new AbortController;return setTimeout(()=>{const n="signal timed out",r="TimeoutError";e.abort(typeof DOMException<"u"?new DOMException(n,r):Object.assign(new Error(n),{name:r}))},t),e.signal},hw=(...t)=>{for(const n of t)if(n.aborted)return AbortSignal.abort(n.reason);const e=new AbortController;for(const n of t)n.addEventListener("abort",()=>e.abort(n.reason),{signal:e.signal,once:!0});return e.signal},el=(...t)=>fetch(...t),fw=t=>t.status>=200&&t.status<=299,pw=t=>/ion\/(vnd\.api\+)?json/.test(t.get("content-type")||"");function tl(t){if(!bt(t))return t;const e={...t};for(const[n,r]of Object.entries(e))r===void 0&&delete e[n];return e}var gw=t=>typeof t=="object"&&(bt(t)||Array.isArray(t)||typeof t.toJSON=="function");function mw({baseUrl:t,prepareHeaders:e=d=>d,fetchFn:n=el,paramsSerializer:r,isJsonContentType:i=pw,jsonContentType:s="application/json",jsonReplacer:o,timeout:a,responseHandler:c,validateStatus:l,...u}={}){return typeof fetch>"u"&&n===el&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(h,p,f)=>{const{getState:I,extra:g,endpoint:T,forced:P,type:m}=p;let b,{url:_,headers:v=new Headers(u.headers),params:S=void 0,responseHandler:w=c??"json",validateStatus:R=l??fw,timeout:C=a,...y}=typeof h=="string"?{url:h}:h,E={...u,signal:C?hw(p.signal,dw(C)):p.signal,...y};v=new Headers(tl(v)),E.headers=await e(v,{getState:I,arg:h,extra:g,endpoint:T,forced:P,type:m,extraOptions:f})||v;const k=gw(E.body);if(E.body!=null&&!k&&typeof E.body!="string"&&E.headers.delete("content-type"),!E.headers.has("content-type")&&k&&E.headers.set("content-type",s),k&&i(E.headers)&&(E.body=JSON.stringify(E.body,o)),E.headers.has("accept")||(w==="json"?E.headers.set("accept","application/json"):w==="text"&&E.headers.set("accept","text/plain, text/html, */*")),S){const V=~_.indexOf("?")?"&":"?",z=r?r(S):new URLSearchParams(tl(S));_+=V+z}_=uw(t,_);const A=new Request(_,E);b={request:new Request(_,E)};let M;try{M=await n(A)}catch(V){return{error:{status:(V instanceof Error||typeof DOMException<"u"&&V instanceof DOMException)&&V.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(V)},meta:b}}const W=M.clone();b.response=W;let N,x="";try{let V;if(await Promise.all([d(M,w).then(z=>N=z,z=>V=z),W.text().then(z=>x=z,()=>{})]),V)throw V}catch(V){return{error:{status:"PARSING_ERROR",originalStatus:M.status,data:x,error:String(V)},meta:b}}return R(M,N)?{data:N,meta:b}:{error:{status:M.status,data:N},meta:b}};async function d(h,p){if(typeof p=="function")return p(h);if(p==="content-type"&&(p=i(h.headers)?"json":"text"),p==="json"){const f=await h.text();return f.length?JSON.parse(f):null}return h.text()}}var nl=class{constructor(t,e=void 0){this.value=t,this.meta=e}},Zi="__rtkq/",Zd="online",eh="offline",_w="focus",th="focused",yw="visibilitychange",es=Ue(`${Zi}${th}`),pa=Ue(`${Zi}un${th}`),ts=Ue(`${Zi}${Zd}`),ga=Ue(`${Zi}${eh}`),Br=!1;function oI(t,e){function n(){const[r,i,s,o]=[es,pa,ts,ga].map(l=>()=>t(l())),a=()=>{window.document.visibilityState==="visible"?r():i()};let c=()=>{Br=!1};if(!Br&&typeof window<"u"&&window.addEventListener){let l=function(d){Object.entries(u).forEach(([h,p])=>{d?window.addEventListener(h,p,!1):window.removeEventListener(h,p)})};const u={[_w]:r,[yw]:a,[Zd]:s,[eh]:o};l(!0),Br=!0,c=()=>{l(!1),Br=!1}}return c}return n()}var Dr="query",nh="mutation",rh="infinitequery";function ns(t){return t.type===Dr}function vw(t){return t.type===nh}function rs(t){return t.type===rh}function Di(t){return ns(t)||rs(t)}function ma(t,e,n,r,i,s){const o=bw(t)?t(e,n,r,i):t;return o?oo(o,fa,a=>s(ih(a))):[]}function bw(t){return typeof t=="function"}function ih(t){return typeof t=="string"?{type:t}:t}function ww(t,e){return t.catch(e)}var gn=(t,e)=>t.endpointDefinitions[e],fr=Symbol("forceQueryFn"),co=t=>typeof t[fr]=="function";function Ew({serializeQueryArgs:t,queryThunk:e,infiniteQueryThunk:n,mutationThunk:r,api:i,context:s,getInternalState:o}){const a=b=>o(b)?.runningQueries,c=b=>o(b)?.runningMutations,{unsubscribeQueryResult:l,removeMutationResult:u,updateSubscriptionOptions:d}=i.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:P,buildInitiateMutation:m,getRunningQueryThunk:h,getRunningMutationThunk:p,getRunningQueriesThunk:f,getRunningMutationsThunk:I};function h(b,_){return v=>{const S=gn(s,b),w=t({queryArgs:_,endpointDefinition:S,endpointName:b});return a(v)?.get(w)}}function p(b,_){return v=>c(v)?.get(_)}function f(){return b=>Zc(a(b))}function I(){return b=>Zc(c(b))}function g(b,_){const v=(S,{subscribe:w=!0,forceRefetch:R,subscriptionOptions:C,[fr]:y,...E}={})=>(k,A)=>{const O=t({queryArgs:S,endpointDefinition:_,endpointName:b});let M;const W={...E,type:Dr,subscribe:w,forceRefetch:R,subscriptionOptions:C,endpointName:b,originalArgs:S,queryCacheKey:O,[fr]:y};if(ns(_))M=e(W);else{const{direction:U,initialPageParam:ae,refetchCachedPages:$}=E;M=n({...W,direction:U,initialPageParam:ae,refetchCachedPages:$})}const N=i.endpoints[b].select(S),x=k(M),V=N(A()),{requestId:z,abort:ee}=x,G=V.requestId!==z,q=a(k)?.get(O),re=()=>N(A()),te=Object.assign(y?x.then(re):G&&!q?Promise.resolve(V):Promise.all([q,x]).then(re),{arg:S,requestId:z,subscriptionOptions:C,queryCacheKey:O,abort:ee,async unwrap(){const U=await te;if(U.isError)throw U.error;return U.data},refetch:U=>k(v(S,{subscribe:!1,forceRefetch:!0,...U})),unsubscribe(){w&&k(l({queryCacheKey:O,requestId:z}))},updateSubscriptionOptions(U){te.subscriptionOptions=U,k(d({endpointName:b,requestId:z,queryCacheKey:O,options:U}))}});if(!q&&!G&&!y){const U=a(k);U.set(O,te),te.then(()=>{U.delete(O)})}return te};return v}function T(b,_){return g(b,_)}function P(b,_){return g(b,_)}function m(b){return(_,{track:v=!0,fixedCacheKey:S}={})=>(w,R)=>{const C=r({type:"mutation",endpointName:b,originalArgs:_,track:v,fixedCacheKey:S}),y=w(C),{requestId:E,abort:k,unwrap:A}=y,O=ww(y.unwrap().then(x=>({data:x})),x=>({error:x})),M=()=>{w(u({requestId:E,fixedCacheKey:S}))},W=Object.assign(O,{arg:y.arg,requestId:E,abort:k,unwrap:A,reset:M}),N=c(w);return N.set(E,W),W.then(()=>{N.delete(E)}),S&&(N.set(S,W),W.then(()=>{N.get(S)===W&&N.delete(S)})),W}}}var sh=class extends iw{constructor(t,e,n,r){super(t),this.value=e,this.schemaName=n,this._bqMeta=r}},Tt=(t,e)=>Array.isArray(t)?t.includes(e):!!t;async function Rt(t,e,n,r){const i=await t["~standard"].validate(e);if(i.issues)throw new sh(i.issues,e,n,r);return i.value}function rl(t){return t}var Nn=(t={})=>({...t,[Yi]:!0});function Iw({reducerPath:t,baseQuery:e,context:{endpointDefinitions:n},serializeQueryArgs:r,api:i,assertTagType:s,selectors:o,onSchemaFailure:a,catchSchemaFailure:c,skipSchemaValidation:l}){const u=(y,E,k,A)=>(O,M)=>{const W=n[y],N=r({queryArgs:E,endpointDefinition:W,endpointName:y});if(O(i.internalActions.queryResultPatched({queryCacheKey:N,patches:k})),!A)return;const x=i.endpoints[y].select(E)(M()),V=ma(W.providesTags,x.data,void 0,E,{},s);O(i.internalActions.updateProvidedBy([{queryCacheKey:N,providedTags:V}]))};function d(y,E,k=0){const A=[E,...y];return k&&A.length>k?A.slice(0,-1):A}function h(y,E,k=0){const A=[...y,E];return k&&A.length>k?A.slice(1):A}const p=(y,E,k,A=!0)=>(O,M)=>{const N=i.endpoints[y].select(E)(M()),x={patches:[],inversePatches:[],undo:()=>O(i.util.patchQueryData(y,E,x.inversePatches,A))};if(N.status===tt)return x;let V;if("data"in N)if(Pe(N.data)){const[z,ee,G]=zd(N.data,k);x.patches.push(...ee),x.inversePatches.push(...G),V=z}else V=k(N.data),x.patches.push({op:"replace",path:[],value:V}),x.inversePatches.push({op:"replace",path:[],value:N.data});return x.patches.length===0||O(i.util.patchQueryData(y,E,x.patches,A)),x},f=(y,E,k)=>A=>A(i.endpoints[y].initiate(E,{subscribe:!1,forceRefetch:!0,[fr]:()=>({data:k})})),I=(y,E)=>y.query&&y[E]?y[E]:rl,g=async(y,{signal:E,abort:k,rejectWithValue:A,fulfillWithValue:O,dispatch:M,getState:W,extra:N})=>{const x=n[y.endpointName],{metaSchema:V,skipSchemaValidation:z=l}=x,ee=y.type===Dr;try{let G=rl;const q={signal:E,abort:k,dispatch:M,getState:W,extra:N,endpoint:y.endpointName,type:y.type,forced:ee?T(y,W()):void 0,queryCacheKey:ee?y.queryCacheKey:void 0},re=ee?y[fr]:void 0;let te;const U=async($,Y,Ie,he)=>{if(Y==null&&$.pages.length)return Promise.resolve({data:$});const Ht={queryArg:y.originalArgs,pageParam:Y},qe=await ae(Ht),jt=he?d:h;return{data:{pages:jt($.pages,qe.data,Ie),pageParams:jt($.pageParams,Y,Ie)},meta:qe.meta}};async function ae($){let Y;const{extraOptions:Ie,argSchema:he,rawResponseSchema:Ht,responseSchema:qe}=x;if(he&&!Tt(z,"arg")&&($=await Rt(he,$,"argSchema",{})),re?Y=re():x.query?(G=I(x,"transformResponse"),Y=await e(x.query($),q,Ie)):Y=await x.queryFn($,q,Ie,$t=>e($t,q,Ie)),typeof process<"u",Y.error)throw new nl(Y.error,Y.meta);let{data:jt}=Y;Ht&&!Tt(z,"rawResponse")&&(jt=await Rt(Ht,Y.data,"rawResponseSchema",Y.meta));let it=await G(jt,Y.meta,$);return qe&&!Tt(z,"response")&&(it=await Rt(qe,it,"responseSchema",Y.meta)),{...Y,data:it}}if(ee&&"infiniteQueryOptions"in x){const{infiniteQueryOptions:$}=x,{maxPages:Y=1/0}=$,Ie=y.refetchCachedPages??$.refetchCachedPages??!0;let he;const Ht={pages:[],pageParams:[]},qe=o.selectQueryEntry(W(),y.queryCacheKey)?.data,it=T(y,W())&&!y.direction||!qe?Ht:qe;if("direction"in y&&y.direction&&it.pages.length){const $t=y.direction==="backward",ss=($t?oh:lo)($,it,y.originalArgs);he=await U(it,ss,Y,$t)}else{const{initialPageParam:$t=$.initialPageParam}=y,is=qe?.pageParams??[],ss=is[0]??$t,Sh=is.length;if(he=await U(it,ss,Y),re&&(he={data:he.data.pages[0]}),Ie)for(let ya=1;ya<Sh;ya++){const Th=lo($,he.data,y.originalArgs);he=await U(he.data,Th,Y)}}te=he}else te=await ae(y.originalArgs);return V&&!Tt(z,"meta")&&te.meta&&(te.meta=await Rt(V,te.meta,"metaSchema",te.meta)),O(te.data,Nn({fulfilledTimeStamp:Date.now(),baseQueryMeta:te.meta}))}catch(G){let q=G;if(q instanceof nl){let re=I(x,"transformErrorResponse");const{rawErrorResponseSchema:te,errorResponseSchema:U}=x;let{value:ae,meta:$}=q;try{te&&!Tt(z,"rawErrorResponse")&&(ae=await Rt(te,ae,"rawErrorResponseSchema",$)),V&&!Tt(z,"meta")&&($=await Rt(V,$,"metaSchema",$));let Y=await re(ae,$,y.originalArgs);return U&&!Tt(z,"errorResponse")&&(Y=await Rt(U,Y,"errorResponseSchema",$)),A(Y,Nn({baseQueryMeta:$}))}catch(Y){q=Y}}try{if(q instanceof sh){const re={endpoint:y.endpointName,arg:y.originalArgs,type:y.type,queryCacheKey:ee?y.queryCacheKey:void 0};x.onSchemaFailure?.(q,re),a?.(q,re);const{catchSchemaFailure:te=c}=x;if(te)return A(te(q,re),Nn({baseQueryMeta:q._bqMeta}))}}catch(re){q=re}throw console.error(q),q}};function T(y,E){const k=o.selectQueryEntry(E,y.queryCacheKey),A=o.selectConfig(E).refetchOnMountOrArgChange,O=k?.fulfilledTimeStamp,M=y.forceRefetch??(y.subscribe&&A);return M?M===!0||(Number(new Date)-Number(O))/1e3>=M:!1}const P=()=>$c(`${t}/executeQuery`,g,{getPendingMeta({arg:E}){const k=n[E.endpointName];return Nn({startedTimeStamp:Date.now(),...rs(k)?{direction:E.direction}:{}})},condition(E,{getState:k}){const A=k(),O=o.selectQueryEntry(A,E.queryCacheKey),M=O?.fulfilledTimeStamp,W=E.originalArgs,N=O?.originalArgs,x=n[E.endpointName],V=E.direction;return co(E)?!0:O?.status==="pending"?!1:T(E,A)||ns(x)&&x?.forceRefetch?.({currentArg:W,previousArg:N,endpointState:O,state:A})?!0:!(M&&!V)},dispatchConditionRejection:!0}),m=P(),b=P(),_=$c(`${t}/executeMutation`,g,{getPendingMeta(){return Nn({startedTimeStamp:Date.now()})}}),v=y=>"force"in y,S=y=>"ifOlderThan"in y,w=(y,E,k={})=>(A,O)=>{const M=v(k)&&k.force,W=S(k)&&k.ifOlderThan,N=(V=!0)=>{const z={forceRefetch:V,subscribe:!1};return i.endpoints[y].initiate(E,z)},x=i.endpoints[y].select(E)(O());if(M)A(N());else if(W){const V=x?.fulfilledTimeStamp;if(!V){A(N());return}(Number(new Date)-Number(new Date(V)))/1e3>=W&&A(N())}else A(N(!1))};function R(y){return E=>E?.meta?.arg?.endpointName===y}function C(y,E){return{matchPending:Qn(la(y),R(E)),matchFulfilled:Qn(wt(y),R(E)),matchRejected:Qn(pn(y),R(E))}}return{queryThunk:m,mutationThunk:_,infiniteQueryThunk:b,prefetch:w,updateQueryData:p,upsertQueryData:f,patchQueryData:u,buildMatchThunkActions:C}}function lo(t,{pages:e,pageParams:n},r){const i=e.length-1;return t.getNextPageParam(e[i],e,n[i],n,r)}function oh(t,{pages:e,pageParams:n},r){return t.getPreviousPageParam?.(e[0],e,n[0],n,r)}function ah(t,e,n,r){return ma(n[t.meta.arg.endpointName][e],wt(t)?t.payload:void 0,Xi(t)?t.payload:void 0,t.meta.arg.originalArgs,"baseQueryMeta"in t.meta?t.meta.baseQueryMeta:void 0,r)}function il(t){return ke(t)?Bd(t):t}function qr(t,e,n){const r=t[e];r&&n(r)}function pr(t){return("arg"in t?t.arg.fixedCacheKey:t.fixedCacheKey)??t.requestId}function sl(t,e,n){const r=t[pr(e)];r&&n(r)}var zr={};function Cw({reducerPath:t,queryThunk:e,mutationThunk:n,serializeQueryArgs:r,context:{endpointDefinitions:i,apiUid:s,extractRehydrationInfo:o,hasRehydrationInfo:a},assertTagType:c,config:l}){const u=Ue(`${t}/resetApiState`);function d(R,C,y,E){R[C.queryCacheKey]??={status:tt,endpointName:C.endpointName},qr(R,C.queryCacheKey,k=>{k.status=so,k.requestId=y&&k.requestId?k.requestId:E.requestId,C.originalArgs!==void 0&&(k.originalArgs=C.originalArgs),k.startedTimeStamp=E.startedTimeStamp;const A=i[E.arg.endpointName];rs(A)&&"direction"in C&&(k.direction=C.direction)})}function h(R,C,y,E){qr(R,C.arg.queryCacheKey,k=>{if(k.requestId!==C.requestId&&!E)return;const{merge:A}=i[C.arg.endpointName];if(k.status=Fn,A)if(k.data!==void 0){const{fulfilledTimeStamp:O,arg:M,baseQueryMeta:W,requestId:N}=C;let x=Nr(k.data,V=>A(V,y,{arg:M.originalArgs,baseQueryMeta:W,fulfilledTimeStamp:O,requestId:N}));k.data=x}else k.data=y;else k.data=i[C.arg.endpointName].structuralSharing??!0?ha(ke(k.data)?Bv(k.data):k.data,y):y;delete k.error,k.fulfilledTimeStamp=C.fulfilledTimeStamp})}const p=Qt({name:`${t}/queries`,initialState:zr,reducers:{removeQueryResult:{reducer(R,{payload:{queryCacheKey:C}}){delete R[C]},prepare:An()},cacheEntriesUpserted:{reducer(R,C){for(const y of C.payload){const{queryDescription:E,value:k}=y;d(R,E,!0,{arg:E,requestId:C.meta.requestId,startedTimeStamp:C.meta.timestamp}),h(R,{arg:E,requestId:C.meta.requestId,fulfilledTimeStamp:C.meta.timestamp,baseQueryMeta:{}},k,!0)}},prepare:R=>({payload:R.map(E=>{const{endpointName:k,arg:A,value:O}=E,M=i[k];return{queryDescription:{type:Dr,endpointName:k,originalArgs:E.arg,queryCacheKey:r({queryArgs:A,endpointDefinition:M,endpointName:k})},value:O}}),meta:{[Yi]:!0,requestId:ua(),timestamp:Date.now()}})},queryResultPatched:{reducer(R,{payload:{queryCacheKey:C,patches:y}}){qr(R,C,E=>{E.data=Wc(E.data,y.concat())})},prepare:An()}},extraReducers(R){R.addCase(e.pending,(C,{meta:y,meta:{arg:E}})=>{const k=co(E);d(C,E,k,y)}).addCase(e.fulfilled,(C,{meta:y,payload:E})=>{const k=co(y.arg);h(C,y,E,k)}).addCase(e.rejected,(C,{meta:{condition:y,arg:E,requestId:k},error:A,payload:O})=>{qr(C,E.queryCacheKey,M=>{if(!y){if(M.requestId!==k)return;M.status=Un,M.error=O??A}})}).addMatcher(a,(C,y)=>{const{queries:E}=o(y);for(const[k,A]of Object.entries(E))(A?.status===Fn||A?.status===Un)&&(C[k]=A)})}}),f=Qt({name:`${t}/mutations`,initialState:zr,reducers:{removeMutationResult:{reducer(R,{payload:C}){const y=pr(C);y in R&&delete R[y]},prepare:An()}},extraReducers(R){R.addCase(n.pending,(C,{meta:y,meta:{requestId:E,arg:k,startedTimeStamp:A}})=>{k.track&&(C[pr(y)]={requestId:E,status:so,endpointName:k.endpointName,startedTimeStamp:A})}).addCase(n.fulfilled,(C,{payload:y,meta:E})=>{E.arg.track&&sl(C,E,k=>{k.requestId===E.requestId&&(k.status=Fn,k.data=y,k.fulfilledTimeStamp=E.fulfilledTimeStamp)})}).addCase(n.rejected,(C,{payload:y,error:E,meta:k})=>{k.arg.track&&sl(C,k,A=>{A.requestId===k.requestId&&(A.status=Un,A.error=y??E)})}).addMatcher(a,(C,y)=>{const{mutations:E}=o(y);for(const[k,A]of Object.entries(E))(A?.status===Fn||A?.status===Un)&&k!==A?.requestId&&(C[k]=A)})}}),I={tags:{},keys:{}},g=Qt({name:`${t}/invalidation`,initialState:I,reducers:{updateProvidedBy:{reducer(R,C){for(const{queryCacheKey:y,providedTags:E}of C.payload){T(R,y);for(const{type:k,id:A}of E){const O=(R.tags[k]??={})[A||"__internal_without_id"]??=[];O.includes(y)||O.push(y)}R.keys[y]=E}},prepare:An()}},extraReducers(R){R.addCase(p.actions.removeQueryResult,(C,{payload:{queryCacheKey:y}})=>{T(C,y)}).addMatcher(a,(C,y)=>{const{provided:E}=o(y);for(const[k,A]of Object.entries(E.tags??{}))for(const[O,M]of Object.entries(A)){const W=(C.tags[k]??={})[O||"__internal_without_id"]??=[];for(const N of M)W.includes(N)||W.push(N),C.keys[N]=E.keys[N]}}).addMatcher(et(wt(e),Xi(e)),(C,y)=>{P(C,[y])}).addMatcher(p.actions.cacheEntriesUpserted.match,(C,y)=>{const E=y.payload.map(({queryDescription:k,value:A})=>({type:"UNKNOWN",payload:A,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:k}}));P(C,E)})}});function T(R,C){const y=il(R.keys[C]??[]);for(const E of y){const k=E.type,A=E.id??"__internal_without_id",O=R.tags[k]?.[A];O&&(R.tags[k][A]=il(O).filter(M=>M!==C))}delete R.keys[C]}function P(R,C){const y=C.map(E=>{const k=ah(E,"providesTags",i,c),{queryCacheKey:A}=E.meta.arg;return{queryCacheKey:A,providedTags:k}});g.caseReducers.updateProvidedBy(R,g.actions.updateProvidedBy(y))}const m=Qt({name:`${t}/subscriptions`,initialState:zr,reducers:{updateSubscriptionOptions(R,C){},unsubscribeQueryResult(R,C){},internal_getRTKQSubscriptions(){}}}),b=Qt({name:`${t}/internalSubscriptions`,initialState:zr,reducers:{subscriptionsUpdated:{reducer(R,C){return Wc(R,C.payload)},prepare:An()}}}),_=Qt({name:`${t}/config`,initialState:{online:aw(),focused:ow(),middlewareRegistered:!1,...l},reducers:{middlewareRegistered(R,{payload:C}){R.middlewareRegistered=R.middlewareRegistered==="conflict"||s!==C?"conflict":!0}},extraReducers:R=>{R.addCase(ts,C=>{C.online=!0}).addCase(ga,C=>{C.online=!1}).addCase(es,C=>{C.focused=!0}).addCase(pa,C=>{C.focused=!1}).addMatcher(a,C=>({...C}))}}),v=Dd({queries:p.reducer,mutations:f.reducer,provided:g.reducer,subscriptions:b.reducer,config:_.reducer}),S=(R,C)=>v(u.match(C)?void 0:R,C),w={..._.actions,...p.actions,...m.actions,...b.actions,...f.actions,...g.actions,resetApiState:u};return{reducer:S,actions:w}}var Ne=Symbol.for("RTKQ/skipToken"),ch={status:tt},ol=Nr(ch,()=>{}),al=Nr(ch,()=>{});function Sw({serializeQueryArgs:t,reducerPath:e,createSelector:n}){const r=m=>ol,i=m=>al;return{buildQuerySelector:h,buildInfiniteQuerySelector:p,buildMutationSelector:f,selectInvalidatedBy:I,selectCachedArgsForQuery:g,selectApiState:o,selectQueries:a,selectMutations:l,selectQueryEntry:c,selectConfig:u};function s(m){return{...m,...Jc(m.status)}}function o(m){return m[e]}function a(m){return o(m)?.queries}function c(m,b){return a(m)?.[b]}function l(m){return o(m)?.mutations}function u(m){return o(m)?.config}function d(m,b,_){return v=>{if(v===Ne)return n(r,_);const S=t({queryArgs:v,endpointDefinition:b,endpointName:m});return n(R=>c(R,S)??ol,_)}}function h(m,b){return d(m,b,s)}function p(m,b){const{infiniteQueryOptions:_}=b;function v(S){const w={...S,...Jc(S.status)},{isLoading:R,isError:C,direction:y}=w,E=y==="forward",k=y==="backward";return{...w,hasNextPage:T(_,w.data,w.originalArgs),hasPreviousPage:P(_,w.data,w.originalArgs),isFetchingNextPage:R&&E,isFetchingPreviousPage:R&&k,isFetchNextPageError:C&&E,isFetchPreviousPageError:C&&k}}return d(m,b,v)}function f(){return m=>{let b;return typeof m=="object"?b=pr(m)??Ne:b=m,n(b===Ne?i:S=>o(S)?.mutations?.[b]??al,s)}}function I(m,b){const _=m[e],v=new Set,S=oo(b,fa,ih);for(const w of S){const R=_.provided.tags[w.type];if(!R)continue;let C=(w.id!==void 0?R[w.id]:Object.values(R).flat())??[];for(const y of C)v.add(y)}return Array.from(v.values()).flatMap(w=>{const R=_.queries[w];return R?{queryCacheKey:w,endpointName:R.endpointName,originalArgs:R.originalArgs}:[]})}function g(m,b){return oo(Object.values(a(m)),_=>_?.endpointName===b&&_.status!==tt,_=>_.originalArgs)}function T(m,b,_){return b?lo(m,b,_)!=null:!1}function P(m,b,_){return!b||!m.getPreviousPageParam?!1:oh(m,b,_)!=null}}var cl=WeakMap?new WeakMap:void 0,ll=({endpointName:t,queryArgs:e})=>{let n="";const r=cl?.get(e);if(typeof r=="string")n=r;else{const i=JSON.stringify(e,(s,o)=>(o=typeof o=="bigint"?{$bigint:o.toString()}:o,o=bt(o)?Object.keys(o).sort().reduce((a,c)=>(a[c]=o[c],a),{}):o,o));bt(e)&&cl?.set(e,i),n=i}return`${t}(${n})`};function lh(...t){return function(n){const r=Ni(l=>n.extractRehydrationInfo?.(l,{reducerPath:n.reducerPath??"api"})),i={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...n,extractRehydrationInfo:r,serializeQueryArgs(l){let u=ll;if("serializeQueryArgs"in l.endpointDefinition){const d=l.endpointDefinition.serializeQueryArgs;u=h=>{const p=d(h);return typeof p=="string"?p:ll({...h,queryArgs:p})}}else n.serializeQueryArgs&&(u=n.serializeQueryArgs);return u(l)},tagTypes:[...n.tagTypes||[]]},s={endpointDefinitions:{},batch(l){l()},apiUid:ua(),extractRehydrationInfo:r,hasRehydrationInfo:Ni(l=>r(l)!=null)},o={injectEndpoints:c,enhanceEndpoints({addTagTypes:l,endpoints:u}){if(l)for(const d of l)i.tagTypes.includes(d)||i.tagTypes.push(d);if(u)for(const[d,h]of Object.entries(u))typeof h=="function"?h(gn(s,d)):Object.assign(gn(s,d)||{},h);return o}},a=t.map(l=>l.init(o,i,s));function c(l){const u=l.endpoints({query:d=>({...d,type:Dr}),mutation:d=>({...d,type:nh}),infiniteQuery:d=>({...d,type:rh})});for(const[d,h]of Object.entries(u)){if(l.overrideExisting!==!0&&d in s.endpointDefinitions){if(l.overrideExisting==="throw")throw new Error(Ae(39));continue}s.endpointDefinitions[d]=h;for(const p of a)p.injectEndpoint(d,h)}return o}return o.injectEndpoints({endpoints:n.endpoints})}}function ze(t,...e){return Object.assign(t,...e)}var Tw=({api:t,queryThunk:e,internalState:n,mwApi:r})=>{const i=`${t.reducerPath}/subscriptions`;let s=null,o=null;const{updateSubscriptionOptions:a,unsubscribeQueryResult:c}=t.internalActions,l=(I,g)=>{if(a.match(g)){const{queryCacheKey:P,requestId:m,options:b}=g.payload,_=I.get(P);return _?.has(m)&&_.set(m,b),!0}if(c.match(g)){const{queryCacheKey:P,requestId:m}=g.payload,b=I.get(P);return b&&b.delete(m),!0}if(t.internalActions.removeQueryResult.match(g))return I.delete(g.payload.queryCacheKey),!0;if(e.pending.match(g)){const{meta:{arg:P,requestId:m}}=g,b=Oi(I,P.queryCacheKey,ao);return P.subscribe&&b.set(m,P.subscriptionOptions??b.get(m)??{}),!0}let T=!1;if(e.rejected.match(g)){const{meta:{condition:P,arg:m,requestId:b}}=g;if(P&&m.subscribe){const _=Oi(I,m.queryCacheKey,ao);_.set(b,m.subscriptionOptions??_.get(b)??{}),T=!0}}return T},u=()=>n.currentSubscriptions,p={getSubscriptions:u,getSubscriptionCount:I=>u().get(I)?.size??0,isRequestSubscribed:(I,g)=>!!u()?.get(I)?.get(g)};function f(I){return JSON.parse(JSON.stringify(Object.fromEntries([...I].map(([g,T])=>[g,Object.fromEntries(T)]))))}return(I,g)=>{if(s||(s=f(n.currentSubscriptions)),t.util.resetApiState.match(I))return s={},n.currentSubscriptions.clear(),o=null,[!0,!1];if(t.internalActions.internal_getRTKQSubscriptions.match(I))return[!1,p];const T=l(n.currentSubscriptions,I);let P=!0;if(T){o||(o=setTimeout(()=>{const _=f(n.currentSubscriptions),[,v]=zd(s,()=>_);g.next(t.internalActions.subscriptionsUpdated(v)),s=_,o=null},500));const m=typeof I.type=="string"&&!!I.type.startsWith(i),b=e.rejected.match(I)&&I.meta.condition&&!!I.meta.arg.subscribe;P=!m&&!b}return[P,!1]}},Rw=2147483647/1e3-1,kw=({reducerPath:t,api:e,queryThunk:n,context:r,internalState:i,selectors:{selectQueryEntry:s,selectConfig:o},getRunningQueryThunk:a,mwApi:c})=>{const{removeQueryResult:l,unsubscribeQueryResult:u,cacheEntriesUpserted:d}=e.internalActions,h=et(u.match,n.fulfilled,n.rejected,d.match);function p(m){const b=i.currentSubscriptions.get(m);return b?b.size>0:!1}const f={};function I(m){for(const b of m.values())b?.abort?.()}const g=(m,b)=>{const _=b.getState(),v=o(_);if(h(m)){let S;if(d.match(m))S=m.payload.map(w=>w.queryDescription.queryCacheKey);else{const{queryCacheKey:w}=u.match(m)?m.payload:m.meta.arg;S=[w]}T(S,b,v)}if(e.util.resetApiState.match(m)){for(const[S,w]of Object.entries(f))w&&clearTimeout(w),delete f[S];I(i.runningQueries),I(i.runningMutations)}if(r.hasRehydrationInfo(m)){const{queries:S}=r.extractRehydrationInfo(m);T(Object.keys(S),b,v)}};function T(m,b,_){const v=b.getState();for(const S of m){const w=s(v,S);w?.endpointName&&P(S,w.endpointName,b,_)}}function P(m,b,_,v){const w=gn(r,b)?.keepUnusedDataFor??v.keepUnusedDataFor;if(w===1/0)return;const R=Math.max(0,Math.min(w,Rw));if(!p(m)){const C=f[m];C&&clearTimeout(C),f[m]=setTimeout(()=>{if(!p(m)){const y=s(_.getState(),m);y?.endpointName&&_.dispatch(a(y.endpointName,y.originalArgs))?.abort(),_.dispatch(l({queryCacheKey:m}))}delete f[m]},R*1e3)}}return g},ul=new Error("Promise never resolved before cacheEntryRemoved."),Pw=({api:t,reducerPath:e,context:n,queryThunk:r,mutationThunk:i,internalState:s,selectors:{selectQueryEntry:o,selectApiState:a}})=>{const c=io(r),l=io(i),u=wt(r,i),d={},{removeQueryResult:h,removeMutationResult:p,cacheEntriesUpserted:f}=t.internalActions;function I(_,v,S){const w=d[_];w?.valueResolved&&(w.valueResolved({data:v,meta:S}),delete w.valueResolved)}function g(_){const v=d[_];v&&(delete d[_],v.cacheEntryRemoved())}function T(_){const{arg:v,requestId:S}=_.meta,{endpointName:w,originalArgs:R}=v;return[w,R,S]}const P=(_,v,S)=>{const w=m(_);function R(C,y,E,k){const A=o(S,y),O=o(v.getState(),y);!A&&O&&b(C,k,y,v,E)}if(r.pending.match(_)){const[C,y,E]=T(_);R(C,w,E,y)}else if(f.match(_))for(const{queryDescription:C,value:y}of _.payload){const{endpointName:E,originalArgs:k,queryCacheKey:A}=C;R(E,A,_.meta.requestId,k),I(A,y,{})}else if(i.pending.match(_)){if(v.getState()[e].mutations[w]){const[y,E,k]=T(_);b(y,E,w,v,k)}}else if(u(_))I(w,_.payload,_.meta.baseQueryMeta);else if(h.match(_)||p.match(_))g(w);else if(t.util.resetApiState.match(_))for(const C of Object.keys(d))g(C)};function m(_){return c(_)?_.meta.arg.queryCacheKey:l(_)?_.meta.arg.fixedCacheKey??_.meta.requestId:h.match(_)?_.payload.queryCacheKey:p.match(_)?pr(_.payload):""}function b(_,v,S,w,R){const C=gn(n,_),y=C?.onCacheEntryAdded;if(!y)return;const E={},k=new Promise(x=>{E.cacheEntryRemoved=x}),A=Promise.race([new Promise(x=>{E.valueResolved=x}),k.then(()=>{throw ul})]);A.catch(()=>{}),d[S]=E;const O=t.endpoints[_].select(Di(C)?v:S),M=w.dispatch((x,V,z)=>z),W={...w,getCacheEntry:()=>O(w.getState()),requestId:R,extra:M,updateCachedData:Di(C)?x=>w.dispatch(t.util.updateQueryData(_,v,x)):void 0,cacheDataLoaded:A,cacheEntryRemoved:k},N=y(v,W);Promise.resolve(N).catch(x=>{if(x!==ul)throw x})}return P},Aw=({api:t,context:{apiUid:e},reducerPath:n})=>(r,i)=>{t.util.resetApiState.match(r)&&i.dispatch(t.internalActions.middlewareRegistered(e))},Nw=({reducerPath:t,context:e,context:{endpointDefinitions:n},mutationThunk:r,queryThunk:i,api:s,assertTagType:o,refetchQuery:a,internalState:c})=>{const{removeQueryResult:l}=s.internalActions,u=et(wt(r),Xi(r)),d=et(wt(i,r),pn(i,r));let h=[],p=0;const f=(T,P)=>{(i.pending.match(T)||r.pending.match(T))&&p++,d(T)&&(p=Math.max(0,p-1)),u(T)?g(ah(T,"invalidatesTags",n,o),P):d(T)?g([],P):s.util.invalidateTags.match(T)&&g(ma(T.payload,void 0,void 0,void 0,void 0,o),P)};function I(){return p>0}function g(T,P){const m=P.getState(),b=m[t];if(h.push(...T),b.config.invalidationBehavior==="delayed"&&I())return;const _=h;if(h=[],_.length===0)return;const v=s.util.selectInvalidatedBy(m,_);e.batch(()=>{const S=Array.from(v.values());for(const{queryCacheKey:w}of S){const R=b.queries[w],C=Oi(c.currentSubscriptions,w,ao);R&&(C.size===0?P.dispatch(l({queryCacheKey:w})):R.status!==tt&&P.dispatch(a(R)))}})}return f},Ow=({reducerPath:t,queryThunk:e,api:n,refetchQuery:r,internalState:i})=>{const{currentPolls:s,currentSubscriptions:o}=i,a=new Set;let c=null;const l=(g,T)=>{(n.internalActions.updateSubscriptionOptions.match(g)||n.internalActions.unsubscribeQueryResult.match(g))&&u(g.payload.queryCacheKey,T),(e.pending.match(g)||e.rejected.match(g)&&g.meta.condition)&&u(g.meta.arg.queryCacheKey,T),(e.fulfilled.match(g)||e.rejected.match(g)&&!g.meta.condition)&&d(g.meta.arg,T),n.util.resetApiState.match(g)&&(f(),c&&(clearTimeout(c),c=null),a.clear())};function u(g,T){a.add(g),c||(c=setTimeout(()=>{for(const P of a)h({queryCacheKey:P},T);a.clear(),c=null},0))}function d({queryCacheKey:g},T){const P=T.getState()[t],m=P.queries[g],b=o.get(g);if(!m||m.status===tt)return;const{lowestPollingInterval:_,skipPollingIfUnfocused:v}=I(b);if(!Number.isFinite(_))return;const S=s.get(g);S?.timeout&&(clearTimeout(S.timeout),S.timeout=void 0);const w=Date.now()+_;s.set(g,{nextPollTimestamp:w,pollingInterval:_,timeout:setTimeout(()=>{(P.config.focused||!v)&&T.dispatch(r(m)),d({queryCacheKey:g},T)},_)})}function h({queryCacheKey:g},T){const m=T.getState()[t].queries[g],b=o.get(g);if(!m||m.status===tt)return;const{lowestPollingInterval:_}=I(b);if(!Number.isFinite(_)){p(g);return}const v=s.get(g),S=Date.now()+_;(!v||S<v.nextPollTimestamp)&&d({queryCacheKey:g},T)}function p(g){const T=s.get(g);T?.timeout&&clearTimeout(T.timeout),s.delete(g)}function f(){for(const g of s.keys())p(g)}function I(g=new Map){let T=!1,P=Number.POSITIVE_INFINITY;for(const m of g.values())m.pollingInterval&&(P=Math.min(m.pollingInterval,P),T=m.skipPollingIfUnfocused||T);return{lowestPollingInterval:P,skipPollingIfUnfocused:T}}return l},Dw=({api:t,context:e,queryThunk:n,mutationThunk:r})=>{const i=la(n,r),s=pn(n,r),o=wt(n,r),a={};return(l,u)=>{if(i(l)){const{requestId:d,arg:{endpointName:h,originalArgs:p}}=l.meta,f=gn(e,h),I=f?.onQueryStarted;if(I){const g={},T=new Promise((_,v)=>{g.resolve=_,g.reject=v});T.catch(()=>{}),a[d]=g;const P=t.endpoints[h].select(Di(f)?p:d),m=u.dispatch((_,v,S)=>S),b={...u,getCacheEntry:()=>P(u.getState()),requestId:d,extra:m,updateCachedData:Di(f)?_=>u.dispatch(t.util.updateQueryData(h,p,_)):void 0,queryFulfilled:T};I(p,b)}}else if(o(l)){const{requestId:d,baseQueryMeta:h}=l.meta;a[d]?.resolve({data:l.payload,meta:h}),delete a[d]}else if(s(l)){const{requestId:d,rejectedWithValue:h,baseQueryMeta:p}=l.meta;a[d]?.reject({error:l.payload??l.error,isUnhandledError:!h,meta:p}),delete a[d]}}},xw=({reducerPath:t,context:e,api:n,refetchQuery:r,internalState:i})=>{const{removeQueryResult:s}=n.internalActions,o=(c,l)=>{es.match(c)&&a(l,"refetchOnFocus"),ts.match(c)&&a(l,"refetchOnReconnect")};function a(c,l){const u=c.getState()[t],d=u.queries,h=i.currentSubscriptions;e.batch(()=>{for(const p of h.keys()){const f=d[p],I=h.get(p);if(!I||!f)continue;const g=[...I.values()];(g.some(P=>P[l]===!0)||g.every(P=>P[l]===void 0)&&u.config[l])&&(I.size===0?c.dispatch(s({queryCacheKey:p})):f.status!==tt&&c.dispatch(r(f)))}})}return o};function Mw(t){const{reducerPath:e,queryThunk:n,api:r,context:i,getInternalState:s}=t,{apiUid:o}=i,a={invalidateTags:Ue(`${e}/invalidateTags`)},c=h=>h.type.startsWith(`${e}/`),l=[Aw,kw,Nw,Ow,Pw,Dw];return{middleware:h=>{let p=!1;const f=s(h.dispatch),I={...t,internalState:f,refetchQuery:d,isThisApiSliceAction:c,mwApi:h},g=l.map(m=>m(I)),T=Tw(I),P=xw(I);return m=>b=>{if(!xd(b))return m(b);p||(p=!0,h.dispatch(r.internalActions.middlewareRegistered(o)));const _={...h,next:m},v=h.getState(),[S,w]=T(b,_,v);let R;if(S?R=m(b):R=w,h.getState()[e]&&(P(b,_,v),c(b)||i.hasRehydrationInfo(b)))for(const C of g)C(b,_,v);return R}},actions:a};function d(h){return t.api.endpoints[h.endpointName].initiate(h.originalArgs,{subscribe:!1,forceRefetch:!0})}}var dl=Symbol(),uh=({createSelector:t=ca}={})=>({name:dl,init(e,{baseQuery:n,tagTypes:r,reducerPath:i,serializeQueryArgs:s,keepUnusedDataFor:o,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:l,invalidationBehavior:u,onSchemaFailure:d,catchSchemaFailure:h,skipSchemaValidation:p},f){nb();const I=U=>U;Object.assign(e,{reducerPath:i,endpoints:{},internalActions:{onOnline:ts,onOffline:ga,onFocus:es,onFocusLost:pa},util:{}});const g=Sw({serializeQueryArgs:s,reducerPath:i,createSelector:t}),{selectInvalidatedBy:T,selectCachedArgsForQuery:P,buildQuerySelector:m,buildInfiniteQuerySelector:b,buildMutationSelector:_}=g;ze(e.util,{selectInvalidatedBy:T,selectCachedArgsForQuery:P});const{queryThunk:v,infiniteQueryThunk:S,mutationThunk:w,patchQueryData:R,updateQueryData:C,upsertQueryData:y,prefetch:E,buildMatchThunkActions:k}=Iw({baseQuery:n,reducerPath:i,context:f,api:e,serializeQueryArgs:s,assertTagType:I,selectors:g,onSchemaFailure:d,catchSchemaFailure:h,skipSchemaValidation:p}),{reducer:A,actions:O}=Cw({context:f,queryThunk:v,mutationThunk:w,serializeQueryArgs:s,reducerPath:i,assertTagType:I,config:{refetchOnFocus:c,refetchOnReconnect:l,refetchOnMountOrArgChange:a,keepUnusedDataFor:o,reducerPath:i,invalidationBehavior:u}});ze(e.util,{patchQueryData:R,updateQueryData:C,upsertQueryData:y,prefetch:E,resetApiState:O.resetApiState,upsertQueryEntries:O.cacheEntriesUpserted}),ze(e.internalActions,O);const M=new WeakMap,W=U=>Oi(M,U,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:N,buildInitiateInfiniteQuery:x,buildInitiateMutation:V,getRunningMutationThunk:z,getRunningMutationsThunk:ee,getRunningQueriesThunk:G,getRunningQueryThunk:q}=Ew({queryThunk:v,mutationThunk:w,infiniteQueryThunk:S,api:e,serializeQueryArgs:s,context:f,getInternalState:W});ze(e.util,{getRunningMutationThunk:z,getRunningMutationsThunk:ee,getRunningQueryThunk:q,getRunningQueriesThunk:G});const{middleware:re,actions:te}=Mw({reducerPath:i,context:f,queryThunk:v,mutationThunk:w,infiniteQueryThunk:S,api:e,assertTagType:I,selectors:g,getRunningQueryThunk:q,getInternalState:W});return ze(e.util,te),ze(e,{reducer:A,middleware:re}),{name:dl,injectEndpoint(U,ae){const $=e,Y=$.endpoints[U]??={};ns(ae)&&ze(Y,{name:U,select:m(U,ae),initiate:N(U,ae)},k(v,U)),vw(ae)&&ze(Y,{name:U,select:_(),initiate:V(U)},k(w,U)),rs(ae)&&ze(Y,{name:U,select:b(U,ae),initiate:x(U,ae)},k(v,U))}}}});uh();function Hr(t){return t.replace(t[0],t[0].toUpperCase())}var Lw="query",Fw="mutation",Uw="infinitequery";function Ww(t){return t.type===Lw}function Vw(t){return t.type===Fw}function dh(t){return t.type===Uw}function On(t,...e){return Object.assign(t,...e)}var Ts=Symbol();function Rs(t){const e=B.useRef(t),n=B.useMemo(()=>ha(e.current,t),[t]);return B.useEffect(()=>{e.current!==n&&(e.current=n)},[n]),n}function Kt(t){const e=B.useRef(t);return B.useEffect(()=>{Kn(e.current,t)||(e.current=t)},[t]),Kn(e.current,t)?e.current:t}var Bw=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",qw=Bw(),zw=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Hw=zw(),jw=()=>qw||Hw?B.useLayoutEffect:B.useEffect,$w=jw(),hl=t=>t.isUninitialized?{...t,isUninitialized:!1,isFetching:!0,isLoading:t.data===void 0,status:Xd.pending}:t;function ks(t,...e){const n={};return e.forEach(r=>{n[r]=t[r]}),n}var Ps=["data","status","isLoading","isSuccess","isError","error"];function Gw({api:t,moduleOptions:{batch:e,hooks:{useDispatch:n,useSelector:r,useStore:i},unstable__sideEffectsInRender:s,createSelector:o},serializeQueryArgs:a,context:c}){const l=s?v=>v():B.useEffect,u=v=>v.current?.unsubscribe?.(),d=c.endpointDefinitions;return{buildQueryHooks:m,buildInfiniteQueryHooks:b,buildMutationHook:_,usePrefetch:f};function h(v,S,w){if(S?.endpointName&&v.isUninitialized){const{endpointName:A}=S,O=d[A];w!==Ne&&a({queryArgs:S.originalArgs,endpointDefinition:O,endpointName:A})===a({queryArgs:w,endpointDefinition:O,endpointName:A})&&(S=void 0)}let R=v.isSuccess?v.data:S?.data;R===void 0&&(R=v.data);const C=R!==void 0,y=v.isLoading,E=(!S||S.isLoading||S.isUninitialized)&&!C&&y,k=v.isSuccess||C&&(y&&!S?.isError||v.isUninitialized);return{...v,data:R,currentData:v.data,isFetching:y,isLoading:E,isSuccess:k}}function p(v,S,w){if(S?.endpointName&&v.isUninitialized){const{endpointName:A}=S,O=d[A];w!==Ne&&a({queryArgs:S.originalArgs,endpointDefinition:O,endpointName:A})===a({queryArgs:w,endpointDefinition:O,endpointName:A})&&(S=void 0)}let R=v.isSuccess?v.data:S?.data;R===void 0&&(R=v.data);const C=R!==void 0,y=v.isLoading,E=(!S||S.isLoading||S.isUninitialized)&&!C&&y,k=v.isSuccess||y&&C;return{...v,data:R,currentData:v.data,isFetching:y,isLoading:E,isSuccess:k}}function f(v,S){const w=n(),R=Kt(S);return B.useCallback((C,y)=>w(t.util.prefetch(v,C,{...R,...y})),[v,w,R])}function I(v,S,{refetchOnReconnect:w,refetchOnFocus:R,refetchOnMountOrArgChange:C,skip:y=!1,pollingInterval:E=0,skipPollingIfUnfocused:k=!1,...A}={}){const{initiate:O}=t.endpoints[v],M=n(),W=B.useRef(void 0);if(!W.current){const $=M(t.internalActions.internal_getRTKQSubscriptions());W.current=$}const N=Rs(y?Ne:S),x=Kt({refetchOnReconnect:w,refetchOnFocus:R,pollingInterval:E,skipPollingIfUnfocused:k}),V=A.initialPageParam,z=Kt(V),ee=A.refetchCachedPages,G=Kt(ee),q=B.useRef(void 0);let{queryCacheKey:re,requestId:te}=q.current||{},U=!1;re&&te&&(U=W.current.isRequestSubscribed(re,te));const ae=!U&&q.current!==void 0;return l(()=>{ae&&(q.current=void 0)},[ae]),l(()=>{const $=q.current;if(N===Ne){$?.unsubscribe(),q.current=void 0;return}const Y=q.current?.subscriptionOptions;if(!$||$.arg!==N){$?.unsubscribe();const Ie=M(O(N,{subscriptionOptions:x,forceRefetch:C,...dh(d[v])?{initialPageParam:z,refetchCachedPages:G}:{}}));q.current=Ie}else x!==Y&&$.updateSubscriptionOptions(x)},[M,O,C,N,x,ae,z,G,v]),[q,M,O,x]}function g(v,S){return(R,{skip:C=!1,selectFromResult:y}={})=>{const{select:E}=t.endpoints[v],k=Rs(C?Ne:R),A=B.useRef(void 0),O=B.useMemo(()=>o([E(k),(V,z)=>z,V=>k],S,{memoizeOptions:{resultEqualityCheck:Kn}}),[E,k]),M=B.useMemo(()=>y?o([O],y,{devModeChecks:{identityFunctionCheck:"never"}}):O,[O,y]),W=r(V=>M(V,A.current),Kn),N=i(),x=O(N.getState(),A.current);return $w(()=>{A.current=x},[x]),W}}function T(v){B.useEffect(()=>()=>{u(v),v.current=void 0},[v])}function P(v){if(!v.current)throw new Error(Ae(38));return v.current.refetch()}function m(v){const S=(C,y={})=>{const[E]=I(v,C,y);return T(E),B.useMemo(()=>({refetch:()=>P(E)}),[E])},w=({refetchOnReconnect:C,refetchOnFocus:y,pollingInterval:E=0,skipPollingIfUnfocused:k=!1}={})=>{const{initiate:A}=t.endpoints[v],O=n(),[M,W]=B.useState(Ts),N=B.useRef(void 0),x=Kt({refetchOnReconnect:C,refetchOnFocus:y,pollingInterval:E,skipPollingIfUnfocused:k});l(()=>{const G=N.current?.subscriptionOptions;x!==G&&N.current?.updateSubscriptionOptions(x)},[x]);const V=B.useRef(x);l(()=>{V.current=x},[x]);const z=B.useCallback(function(G,q=!1){let re;return e(()=>{u(N),N.current=re=O(A(G,{subscriptionOptions:V.current,forceRefetch:!q})),W(G)}),re},[O,A]),ee=B.useCallback(()=>{N.current?.queryCacheKey&&O(t.internalActions.removeQueryResult({queryCacheKey:N.current?.queryCacheKey}))},[O]);return B.useEffect(()=>()=>{u(N)},[]),B.useEffect(()=>{M!==Ts&&!N.current&&z(M,!0)},[M,z]),B.useMemo(()=>[z,M,{reset:ee}],[z,M,ee])},R=g(v,h);return{useQueryState:R,useQuerySubscription:S,useLazyQuerySubscription:w,useLazyQuery(C){const[y,E,{reset:k}]=w(C),A=R(E,{...C,skip:E===Ts}),O=B.useMemo(()=>({lastArg:E}),[E]);return B.useMemo(()=>[y,{...A,reset:k},O],[y,A,k,O])},useQuery(C,y){const E=S(C,y),k=R(C,{selectFromResult:C===Ne||y?.skip?void 0:hl,...y}),A=ks(k,...Ps);return B.useDebugValue(A),B.useMemo(()=>({...k,...E}),[k,E])}}}function b(v){const S=(R,C={})=>{const[y,E,k,A]=I(v,R,C),O=B.useRef(A);l(()=>{O.current=A},[A]);const M=C.refetchCachedPages,W=Kt(M),N=B.useCallback(function(z,ee){let G;return e(()=>{u(y),y.current=G=E(k(z,{subscriptionOptions:O.current,direction:ee}))}),G},[y,E,k]);T(y);const x=Rs(C.skip?Ne:R),V=B.useCallback(z=>{if(!y.current)throw new Error(Ae(38));const ee={refetchCachedPages:z?.refetchCachedPages??W};return y.current.refetch(ee)},[y,W]);return B.useMemo(()=>({trigger:N,refetch:V,fetchNextPage:()=>N(x,"forward"),fetchPreviousPage:()=>N(x,"backward")}),[V,N,x])},w=g(v,p);return{useInfiniteQueryState:w,useInfiniteQuerySubscription:S,useInfiniteQuery(R,C){const{refetch:y,fetchNextPage:E,fetchPreviousPage:k}=S(R,C),A=w(R,{selectFromResult:R===Ne||C?.skip?void 0:hl,...C}),O=ks(A,...Ps,"hasNextPage","hasPreviousPage");return B.useDebugValue(O),B.useMemo(()=>({...A,fetchNextPage:E,fetchPreviousPage:k,refetch:y}),[A,E,k,y])}}}function _(v){return({selectFromResult:S,fixedCacheKey:w}={})=>{const{select:R,initiate:C}=t.endpoints[v],y=n(),[E,k]=B.useState();B.useEffect(()=>()=>{E?.arg.fixedCacheKey||E?.reset()},[E]);const A=B.useCallback(function(G){const q=y(C(G,{fixedCacheKey:w}));return k(q),q},[y,C,w]),{requestId:O}=E||{},M=B.useMemo(()=>R({fixedCacheKey:w,requestId:E?.requestId}),[w,E,R]),W=B.useMemo(()=>S?o([M],S):M,[S,M]),N=r(W,Kn),x=w==null?E?.arg.originalArgs:void 0,V=B.useCallback(()=>{e(()=>{E&&k(void 0),w&&y(t.internalActions.removeMutationResult({requestId:O,fixedCacheKey:w}))})},[y,w,E,O]),z=ks(N,...Ps,"endpointName");B.useDebugValue(z);const ee=B.useMemo(()=>({...N,originalArgs:x,reset:V}),[N,x,V]);return B.useMemo(()=>[A,ee],[A,ee])}}}var Qw=Symbol(),Kw=({batch:t=rw,hooks:e={useDispatch:Zb,useSelector:nw,useStore:Jd},createSelector:n=ca,unstable__sideEffectsInRender:r=!1,...i}={})=>({name:Qw,init(s,{serializeQueryArgs:o},a){const c=s,{buildQueryHooks:l,buildInfiniteQueryHooks:u,buildMutationHook:d,usePrefetch:h}=Gw({api:s,moduleOptions:{batch:t,hooks:e,unstable__sideEffectsInRender:r,createSelector:n},serializeQueryArgs:o,context:a});return On(c,{usePrefetch:h}),On(a,{batch:t}),{injectEndpoint(p,f){if(Ww(f)){const{useQuery:I,useLazyQuery:g,useLazyQuerySubscription:T,useQueryState:P,useQuerySubscription:m}=l(p);On(c.endpoints[p],{useQuery:I,useLazyQuery:g,useLazyQuerySubscription:T,useQueryState:P,useQuerySubscription:m}),s[`use${Hr(p)}Query`]=I,s[`useLazy${Hr(p)}Query`]=g}if(Vw(f)){const I=d(p);On(c.endpoints[p],{useMutation:I}),s[`use${Hr(p)}Mutation`]=I}else if(dh(f)){const{useInfiniteQuery:I,useInfiniteQuerySubscription:g,useInfiniteQueryState:T}=u(p);On(c.endpoints[p],{useInfiniteQuery:I,useInfiniteQuerySubscription:g,useInfiniteQueryState:T}),s[`use${Hr(p)}InfiniteQuery`]=I}}}}}),Yw=lh(uh(),Kw());const Jw="/api/v1";async function Xw(){if(typeof window>"u")return null;try{const{auth:t}=ia(),e=t.currentUser;if(e)return await e.getIdToken()}catch{}return null}const Zw=mw({baseUrl:Jw,prepareHeaders:async t=>{const e=await Xw();return e&&t.set("Authorization",`Bearer ${e}`),t}}),eE=async(t,e,n)=>typeof window>"u"?{data:{}}:Zw(t,e,n),tE=Yw({reducerPath:"editorialApi",baseQuery:eE,tagTypes:["schema","data","files","config","dataDiff"],endpoints:t=>({getConfig:t.query({query:()=>"/config",providesTags:[{type:"config"}]}),pull:t.mutation({query:()=>({url:"/pull",method:"POST"})}),push:t.mutation({query:({author:e})=>({url:"/push",method:"POST",body:{author:e}})}),publish:t.mutation({query:({author:e})=>({url:"/publish",method:"POST",body:{author:e}}),invalidatesTags:()=>[{type:"dataDiff"}]}),getSchema:t.query({query:()=>"/schema",providesTags:[{type:"schema"}]}),getSchemaType:t.query({query:()=>"/schema",transformResponse:(e,n,r)=>e[r]||null,providesTags:(e,n,r)=>[{type:"schema",id:r}]}),getData:t.query({query:()=>"/data?preview=true",providesTags:()=>[{type:"data"}]}),getDataDiff:t.query({query:()=>"/environments/diff",providesTags:()=>[{type:"dataDiff"}]}),getDataCount:t.query({query:()=>"/data?preview=true",transformResponse(e){return Object.values(e).reduce((r,i)=>r+Object.keys(i).length,0)}}),getDataObject:t.query({query:()=>"/data?preview=true",transformResponse:(e,n,{itemType:r,id:i})=>e[r]?.[i]||null,providesTags:(e,n,{itemType:r,id:i})=>[{type:"data",id:`${r}-${i}`}]}),getFiles:t.query({query:()=>"/files",transformResponse:e=>e.files,providesTags:()=>[{type:"files"}]}),getFileCount:t.query({query:()=>"/files",transformResponse:e=>{function n(i){let s=i.type==="file"?1:0;return i.children&&i.children.length>0&&(s+=i.children.reduce((o,a)=>o+n(a),0)),s}function r(i){return i.reduce((s,o)=>s+n(o),0)}return r(e.files)},providesTags:()=>[{type:"files"}]}),getFilesTotalSize:t.query({query:()=>"/files",transformResponse:e=>e.totalSize,providesTags:()=>[{type:"files"}]}),deleteFile:t.mutation({query:e=>({url:"/files",method:"DELETE",body:{path:e}}),invalidatesTags:()=>[{type:"files"}]}),uploadFiles:t.mutation({query:({files:e,path:n})=>{const r=new FormData;return Array.from(e).forEach(i=>{r.append("files",i)}),n&&r.append("path",n),{url:"/files",method:"PUT",body:r}},invalidatesTags:()=>[{type:"files"}]}),createDirectory:t.mutation({query:({name:e,path:n})=>({url:"/files/directory",method:"POST",body:{name:e,path:n}}),invalidatesTags:()=>[{type:"files"}]}),updateObject:t.mutation({query:({id:e,type:n,...r})=>({url:`/data/${n}/${e}`,method:"PATCH",body:{id:e,type:n,...r}}),invalidatesTags:()=>[{type:"data"},{type:"dataDiff"}]}),createObject:t.mutation({query:({id:e,type:n,...r})=>({url:`/data/${n}/${e}`,method:"PUT",body:{id:e,type:n,...r}}),invalidatesTags:()=>[{type:"data"},{type:"dataDiff"}]}),deleteObject:t.mutation({query:({id:e,type:n})=>({url:`/data/${n}/${e}`,method:"DELETE"}),invalidatesTags:()=>[{type:"data"},{type:"dataDiff"}]})})}),{useCreateDirectoryMutation:aI,useCreateObjectMutation:cI,useDeleteFileMutation:lI,useDeleteObjectMutation:uI,useGetConfigQuery:dI,useGetDataCountQuery:hI,useGetDataObjectQuery:fI,useGetDataQuery:pI,useGetDataDiffQuery:gI,useGetFileCountQuery:mI,useGetFilesQuery:_I,useGetSchemaQuery:yI,useGetSchemaTypeQuery:vI,usePublishMutation:bI,usePullMutation:wI,usePushMutation:EI,useUpdateObjectMutation:II,useUploadFilesMutation:CI}=tE;function hh(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=hh(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function nE(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=hh(t))&&(r&&(r+=" "),r+=e);return r}const rE=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},iE=(t,e)=>({classGroupId:t,validator:e}),fh=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xi="-",fl=[],sE="arbitrary..",oE=t=>{const e=cE(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return aE(o);const a=o.split(xi),c=a[0]===""&&a.length>1?1:0;return ph(a,c,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const c=r[o],l=n[o];return c?l?rE(l,c):c:l||fl}return n[o]||fl}}},ph=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const l=ph(t,e+1,s);if(l)return l}const o=n.validators;if(o===null)return;const a=e===0?t.join(xi):t.slice(e).join(xi),c=o.length;for(let l=0;l<c;l++){const u=o[l];if(u.validator(a))return u.classGroupId}},aE=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?sE+r:void 0})(),cE=t=>{const{theme:e,classGroups:n}=t;return lE(n,e)},lE=(t,e)=>{const n=fh();for(const r in t){const i=t[r];_a(i,n,r,e)}return n},_a=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];uE(o,e,n,r)}},uE=(t,e,n,r)=>{if(typeof t=="string"){dE(t,e,n);return}if(typeof t=="function"){hE(t,e,n,r);return}fE(t,e,n,r)},dE=(t,e,n)=>{const r=t===""?e:gh(e,t);r.classGroupId=n},hE=(t,e,n,r)=>{if(pE(t)){_a(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(iE(n,t))},fE=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,c]=i[o];_a(c,gh(e,a),n,r)}},gh=(t,e)=>{let n=t;const r=e.split(xi),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=fh(),n.nextPart.set(o,a)),n=a}return n},pE=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,gE=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},uo="!",pl=":",mE=[],gl=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),_E=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let o=0,a=0,c=0,l;const u=i.length;for(let I=0;I<u;I++){const g=i[I];if(o===0&&a===0){if(g===pl){s.push(i.slice(c,I)),c=I+1;continue}if(g==="/"){l=I;continue}}g==="["?o++:g==="]"?o--:g==="("?a++:g===")"&&a--}const d=s.length===0?i:i.slice(c);let h=d,p=!1;d.endsWith(uo)?(h=d.slice(0,-1),p=!0):d.startsWith(uo)&&(h=d.slice(1),p=!0);const f=l&&l>c?l-c:void 0;return gl(s,p,h,f)};if(e){const i=e+pl,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):gl(mE,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},yE=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],a=o[0]==="[",c=e.has(o);a||c?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},vE=t=>({cache:gE(t.cacheSize),parseClassName:_E(t),sortModifiers:yE(t),...oE(t)}),bE=/\s+/,wE=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(bE);let c="";for(let l=a.length-1;l>=0;l-=1){const u=a[l],{isExternal:d,modifiers:h,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:I}=n(u);if(d){c=u+(c.length>0?" "+c:c);continue}let g=!!I,T=r(g?f.substring(0,I):f);if(!T){if(!g){c=u+(c.length>0?" "+c:c);continue}if(T=r(f),!T){c=u+(c.length>0?" "+c:c);continue}g=!1}const P=h.length===0?"":h.length===1?h[0]:s(h).join(":"),m=p?P+uo:P,b=m+T;if(o.indexOf(b)>-1)continue;o.push(b);const _=i(T,g);for(let v=0;v<_.length;++v){const S=_[v];o.push(m+S)}c=u+(c.length>0?" "+c:c)}return c},EE=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=mh(n))&&(i&&(i+=" "),i+=r);return i},mh=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=mh(t[r]))&&(n&&(n+=" "),n+=e);return n},IE=(t,...e)=>{let n,r,i,s;const o=c=>{const l=e.reduce((u,d)=>d(u),t());return n=vE(l),r=n.cache.get,i=n.cache.set,s=a,a(c)},a=c=>{const l=r(c);if(l)return l;const u=wE(c,n);return i(c,u),u};return s=o,(...c)=>s(EE(...c))},CE=[],le=t=>{const e=n=>n[t]||CE;return e.isThemeGetter=!0,e},_h=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,SE=/^\d+\/\d+$/,TE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,PE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yt=t=>SE.test(t),Q=t=>!!t&&!Number.isNaN(Number(t)),ot=t=>!!t&&Number.isInteger(Number(t)),As=t=>t.endsWith("%")&&Q(t.slice(0,-1)),He=t=>TE.test(t),NE=()=>!0,OE=t=>RE.test(t)&&!kE.test(t),vh=()=>!1,DE=t=>PE.test(t),xE=t=>AE.test(t),ME=t=>!L(t)&&!F(t),LE=t=>Cn(t,Eh,vh),L=t=>_h.test(t),kt=t=>Cn(t,Ih,OE),Ns=t=>Cn(t,BE,Q),ml=t=>Cn(t,bh,vh),FE=t=>Cn(t,wh,xE),jr=t=>Cn(t,Ch,DE),F=t=>yh.test(t),Dn=t=>Sn(t,Ih),UE=t=>Sn(t,qE),_l=t=>Sn(t,bh),WE=t=>Sn(t,Eh),VE=t=>Sn(t,wh),$r=t=>Sn(t,Ch,!0),Cn=(t,e,n)=>{const r=_h.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Sn=(t,e,n=!1)=>{const r=yh.exec(t);return r?r[1]?e(r[1]):n:!1},bh=t=>t==="position"||t==="percentage",wh=t=>t==="image"||t==="url",Eh=t=>t==="length"||t==="size"||t==="bg-size",Ih=t=>t==="length",BE=t=>t==="number",qE=t=>t==="family-name",Ch=t=>t==="shadow",zE=()=>{const t=le("color"),e=le("font"),n=le("text"),r=le("font-weight"),i=le("tracking"),s=le("leading"),o=le("breakpoint"),a=le("container"),c=le("spacing"),l=le("radius"),u=le("shadow"),d=le("inset-shadow"),h=le("text-shadow"),p=le("drop-shadow"),f=le("blur"),I=le("perspective"),g=le("aspect"),T=le("ease"),P=le("animate"),m=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...b(),F,L],v=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],w=()=>[F,L,c],R=()=>[Yt,"full","auto",...w()],C=()=>[ot,"none","subgrid",F,L],y=()=>["auto",{span:["full",ot,F,L]},ot,F,L],E=()=>[ot,"auto",F,L],k=()=>["auto","min","max","fr",F,L],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...w()],W=()=>[Yt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],N=()=>[t,F,L],x=()=>[...b(),_l,ml,{position:[F,L]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",WE,LE,{size:[F,L]}],ee=()=>[As,Dn,kt],G=()=>["","none","full",l,F,L],q=()=>["",Q,Dn,kt],re=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>[Q,As,_l,ml],ae=()=>["","none",f,F,L],$=()=>["none",Q,F,L],Y=()=>["none",Q,F,L],Ie=()=>[Q,F,L],he=()=>[Yt,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[He],breakpoint:[He],color:[NE],container:[He],"drop-shadow":[He],ease:["in","out","in-out"],font:[ME],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[He],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[He],shadow:[He],spacing:["px",Q],text:[He],"text-shadow":[He],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Yt,L,F,g]}],container:["container"],columns:[{columns:[Q,L,F,a]}],"break-after":[{"break-after":m()}],"break-before":[{"break-before":m()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:v()}],"overflow-x":[{"overflow-x":v()}],"overflow-y":[{"overflow-y":v()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[ot,"auto",F,L]}],basis:[{basis:[Yt,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Q,Yt,"auto","initial","none",L]}],grow:[{grow:["",Q,F,L]}],shrink:[{shrink:["",Q,F,L]}],order:[{order:[ot,"first","last","none",F,L]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:y()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:y()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[a,"screen",...W()]}],"min-w":[{"min-w":[a,"screen","none",...W()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Dn,kt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,F,Ns]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",As,L]}],"font-family":[{font:[UE,L,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,F,L]}],"line-clamp":[{"line-clamp":[Q,"none",F,Ns]}],leading:[{leading:[s,...w()]}],"list-image":[{"list-image":["none",F,L]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",F,L]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Q,"from-font","auto",F,kt]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Q,"auto",F,L]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",F,L]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",F,L]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:x()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ot,F,L],radial:["",F,L],conic:[ot,F,L]},VE,FE]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Q,F,L]}],"outline-w":[{outline:["",Q,Dn,kt]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",u,$r,jr]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",d,$r,jr]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Q,kt]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",h,$r,jr]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Q,F,L]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Q]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[F,L]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Q]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:x()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",F,L]}],filter:[{filter:["","none",F,L]}],blur:[{blur:ae()}],brightness:[{brightness:[Q,F,L]}],contrast:[{contrast:[Q,F,L]}],"drop-shadow":[{"drop-shadow":["","none",p,$r,jr]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",Q,F,L]}],"hue-rotate":[{"hue-rotate":[Q,F,L]}],invert:[{invert:["",Q,F,L]}],saturate:[{saturate:[Q,F,L]}],sepia:[{sepia:["",Q,F,L]}],"backdrop-filter":[{"backdrop-filter":["","none",F,L]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[Q,F,L]}],"backdrop-contrast":[{"backdrop-contrast":[Q,F,L]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Q,F,L]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Q,F,L]}],"backdrop-invert":[{"backdrop-invert":["",Q,F,L]}],"backdrop-opacity":[{"backdrop-opacity":[Q,F,L]}],"backdrop-saturate":[{"backdrop-saturate":[Q,F,L]}],"backdrop-sepia":[{"backdrop-sepia":["",Q,F,L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",F,L]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Q,"initial",F,L]}],ease:[{ease:["linear","initial",T,F,L]}],delay:[{delay:[Q,F,L]}],animate:[{animate:["none",P,F,L]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[I,F,L]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:$()}],"rotate-x":[{"rotate-x":$()}],"rotate-y":[{"rotate-y":$()}],"rotate-z":[{"rotate-z":$()}],scale:[{scale:Y()}],"scale-x":[{"scale-x":Y()}],"scale-y":[{"scale-y":Y()}],"scale-z":[{"scale-z":Y()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[F,L,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:he()}],"translate-x":[{"translate-x":he()}],"translate-y":[{"translate-y":he()}],"translate-z":[{"translate-z":he()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",F,L]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",F,L]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[Q,Dn,kt,Ns]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},HE=IE(zE),jE=["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];function SI(...t){return HE(nE(t))}function TI(t,e=1){if(t===0)return"0 bytes";const n=1024,r=Math.floor(Math.log(t)/Math.log(n)),i=t/Math.pow(n,r);return`${parseFloat(i.toFixed(e))} ${jE[r]}`}const ho=60*1e3,fo=ho*60,Mi=fo*24,yl=Mi*30,vl=Mi*365;function RI(t,e=!1){const r=new Date().getTime()-t.getTime(),i=r<0,s=Math.abs(r);let o,a;if(s<ho)o=Math.round(s/1e3),a=o===1?"second":"seconds";else if(s<fo)o=Math.round(s/ho),a=o===1?"minute":"minutes";else if(s<Mi)o=Math.round(s/fo),a=o===1?"hour":"hours";else if(s<yl&&e)o=Math.round(s/Mi),a=o===1?"day":"days";else if(s<vl&&e)o=Math.round(s/yl),a=o===1?"month":"months";else if(e)o=Math.round(s/vl),a=o===1?"year":"years";else{const c=String(t.getDate()).padStart(2,"0"),l=String(t.getMonth()+1).padStart(2,"0"),u=t.getFullYear();return`${c}/${l}/${u}`}return i?`in ${o} ${a}`:`${o} ${a} ago`}const kI={added:"bg-green-100 text-green-800",modified:"bg-yellow-100 text-yellow-800",deleted:"bg-red-100 text-red-800"};export{II as A,wo as B,QE as C,_I as D,lI as E,CI as F,aI as G,TI as H,Zb as I,nw as J,Jd as K,$c as L,ia as M,YE as N,gg as O,sI as P,uu as Q,KE as R,XE as S,Qt as T,Aa as _,nI as a,SI as b,iI as c,yI as d,tE as e,rI as f,eI as g,pI as h,tI as i,bI as j,wI as k,EI as l,RI as m,kI as n,JE as o,gI as p,hI as q,ZE as r,oI as s,mI as t,dI as u,vI as v,uI as w,nE as x,fI as y,cI as z};
18
+ FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const e of this.listens.values())for(const n of e.values())this.sendListen_(n);for(let e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){const e=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(e.action,e.pathString,e.data,e.onComplete)}for(let e=0;e<this.outstandingGets_.length;e++)this.outstandingGets_[e]&&this.sendGet_(e)}sendConnectStats_(){const e={};let n="js";e["sdk."+n+"."+_u.replace(/\./g,"-")]=1,_o()?e["framework.cordova"]=1:Pl()&&(e["framework.reactnative"]=1),this.reportStats(e)}shouldReconnect_(){const e=di.getInstance().currentlyOnline();return Os(this.interruptReasons_)&&e}}Ye.nextPersistentConnectionId_=0;Ye.nextConnectionId_=0;class K{constructor(e,n){this.name=e,this.node=n}static Wrap(e,n){return new K(e,n)}}class Bi{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,n){const r=new K(un,e),i=new K(un,n);return this.compare(r,i)!==0}minPost(){return K.MIN}}let Mr;class $u extends Bi{static get __EMPTY_NODE(){return Mr}static set __EMPTY_NODE(e){Mr=e}compare(e,n){return En(e.name,n.name)}isDefinedOn(e){throw mn("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,n){return!1}minPost(){return K.MIN}maxPost(){return new K(Lt,Mr)}makePost(e,n){return D(typeof e=="string","KeyIndex indexValue must always be a string."),new K(e,Mr)}toString(){return".key"}}const on=new $u;class Lr{constructor(e,n,r,i,s=null){this.isReverse_=i,this.resultGenerator_=s,this.nodeStack_=[];let o=1;for(;!e.isEmpty();)if(e=e,o=n?r(e.key,n):1,i&&(o*=-1),o<0)this.isReverse_?e=e.left:e=e.right;else if(o===0){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),this.isReverse_?e=e.right:e=e.left}getNext(){if(this.nodeStack_.length===0)return null;let e=this.nodeStack_.pop(),n;if(this.resultGenerator_?n=this.resultGenerator_(e.key,e.value):n={key:e.key,value:e.value},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 n}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;const e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class pe{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??pe.RED,this.left=i??Ce.EMPTY_NODE,this.right=s??Ce.EMPTY_NODE}copy(e,n,r,i,s){return new pe(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}count(){return this.left.count()+1+this.right.count()}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,n,r){let i=this;const s=r(e,i.key);return s<0?i=i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i=i.copy(null,n,null,null,null):i=i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp_()}removeMin_(){if(this.left.isEmpty())return Ce.EMPTY_NODE;let e=this;return!e.left.isRed_()&&!e.left.left.isRed_()&&(e=e.moveRedLeft_()),e=e.copy(null,null,null,e.left.removeMin_(),null),e.fixUp_()}remove(e,n){let r,i;if(r=this,n(e,r.key)<0)!r.left.isEmpty()&&!r.left.isRed_()&&!r.left.left.isRed_()&&(r=r.moveRedLeft_()),r=r.copy(null,null,null,r.left.remove(e,n),null);else{if(r.left.isRed_()&&(r=r.rotateRight_()),!r.right.isEmpty()&&!r.right.isRed_()&&!r.right.left.isRed_()&&(r=r.moveRedRight_()),n(e,r.key)===0){if(r.right.isEmpty())return Ce.EMPTY_NODE;i=r.right.min_(),r=r.copy(i.key,i.value,null,null,r.right.removeMin_())}r=r.copy(null,null,null,null,r.right.remove(e,n))}return r.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_(){const e=this.copy(null,null,pe.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight_(){const e=this.copy(null,null,pe.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip_(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth_(){const e=this.check_();return Math.pow(2,e)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const e=this.left.check_();if(e!==this.right.check_())throw new Error("Black depths differ");return e+(this.isRed_()?0:1)}}pe.RED=!0;pe.BLACK=!1;class E_{copy(e,n,r,i,s){return this}insert(e,n,r){return new pe(e,n,null)}remove(e,n){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class Ce{constructor(e,n=Ce.EMPTY_NODE){this.comparator_=e,this.root_=n}insert(e,n){return new Ce(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,pe.BLACK,null,null))}remove(e){return new Ce(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,pe.BLACK,null,null))}get(e){let n,r=this.root_;for(;!r.isEmpty();){if(n=this.comparator_(e,r.key),n===0)return r.value;n<0?r=r.left:n>0&&(r=r.right)}return null}getPredecessorKey(e){let n,r=this.root_,i=null;for(;!r.isEmpty();)if(n=this.comparator_(e,r.key),n===0){if(r.left.isEmpty())return i?i.key:null;for(r=r.left;!r.right.isEmpty();)r=r.right;return r.key}else n<0?r=r.left:n>0&&(i=r,r=r.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new Lr(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,n){return new Lr(this.root_,e,this.comparator_,!1,n)}getReverseIteratorFrom(e,n){return new Lr(this.root_,e,this.comparator_,!0,n)}getReverseIterator(e){return new Lr(this.root_,null,this.comparator_,!0,e)}}Ce.EMPTY_NODE=new E_;function I_(t,e){return En(t.name,e.name)}function Mo(t,e){return En(t,e)}let zs;function C_(t){zs=t}const Gu=function(t){return typeof t=="number"?"number:"+Eu(t):"string:"+t},Qu=function(t){if(t.isLeafNode()){const e=t.val();D(typeof e=="string"||typeof e=="number"||typeof e=="object"&&nt(e,".sv"),"Priority must be a string or number.")}else D(t===zs||t.isEmpty(),"priority of unexpected type.");D(t===zs||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};let fc;class fe{static set __childrenNodeConstructor(e){fc=e}static get __childrenNodeConstructor(){return fc}constructor(e,n=fe.__childrenNodeConstructor.EMPTY_NODE){this.value_=e,this.priorityNode_=n,this.lazyHash_=null,D(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),Qu(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(e){return new fe(this.value_,e)}getImmediateChild(e){return e===".priority"?this.priorityNode_:fe.__childrenNodeConstructor.EMPTY_NODE}getChild(e){return J(e)?this:X(e)===".priority"?this.priorityNode_:fe.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(e,n){return null}updateImmediateChild(e,n){return e===".priority"?this.updatePriority(n):n.isEmpty()&&e!==".priority"?this:fe.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,n).updatePriority(this.priorityNode_)}updateChild(e,n){const r=X(e);return r===null?n:n.isEmpty()&&r!==".priority"?this:(D(r!==".priority"||_t(e)===1,".priority must be the last token in a path"),this.updateImmediateChild(r,fe.__childrenNodeConstructor.EMPTY_NODE.updateChild(se(e),n)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(e,n){return!1}val(e){return e&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let e="";this.priorityNode_.isEmpty()||(e+="priority:"+Gu(this.priorityNode_.val())+":");const n=typeof this.value_;e+=n+":",n==="number"?e+=Eu(this.value_):e+=this.value_,this.lazyHash_=vu(e)}return this.lazyHash_}getValue(){return this.value_}compareTo(e){return e===fe.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof fe.__childrenNodeConstructor?-1:(D(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))}compareToLeafNode_(e){const n=typeof e.value_,r=typeof this.value_,i=fe.VALUE_TYPE_ORDER.indexOf(n),s=fe.VALUE_TYPE_ORDER.indexOf(r);return D(i>=0,"Unknown leaf type: "+n),D(s>=0,"Unknown leaf type: "+r),i===s?r==="object"?0:this.value_<e.value_?-1:this.value_===e.value_?0:1:s-i}withIndex(){return this}isIndexed(){return!0}equals(e){if(e===this)return!0;if(e.isLeafNode()){const n=e;return this.value_===n.value_&&this.priorityNode_.equals(n.priorityNode_)}else return!1}}fe.VALUE_TYPE_ORDER=["object","boolean","number","string"];let Ku,Yu;function S_(t){Ku=t}function T_(t){Yu=t}class R_ extends Bi{compare(e,n){const r=e.node.getPriority(),i=n.node.getPriority(),s=r.compareTo(i);return s===0?En(e.name,n.name):s}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,n){return!e.getPriority().equals(n.getPriority())}minPost(){return K.MIN}maxPost(){return new K(Lt,new fe("[PRIORITY-POST]",Yu))}makePost(e,n){const r=Ku(e);return new K(n,new fe("[PRIORITY-POST]",r))}toString(){return".priority"}}const ce=new R_;const k_=Math.log(2);class P_{constructor(e){const n=s=>parseInt(Math.log(s)/k_,10),r=s=>parseInt(Array(s+1).join("1"),2);this.count=n(e+1),this.current_=this.count-1;const i=r(this.count);this.bits_=e+1&i}nextBitIsOne(){const e=!(this.bits_&1<<this.current_);return this.current_--,e}}const hi=function(t,e,n,r){t.sort(e);const i=function(c,l){const u=l-c;let d,h;if(u===0)return null;if(u===1)return d=t[c],h=n?n(d):d,new pe(h,d.node,pe.BLACK,null,null);{const p=parseInt(u/2,10)+c,f=i(c,p),I=i(p+1,l);return d=t[p],h=n?n(d):d,new pe(h,d.node,pe.BLACK,f,I)}},s=function(c){let l=null,u=null,d=t.length;const h=function(f,I){const g=d-f,T=d;d-=f;const P=i(g+1,T),m=t[g],b=n?n(m):m;p(new pe(b,m.node,I,null,P))},p=function(f){l?(l.left=f,l=f):(u=f,l=f)};for(let f=0;f<c.count;++f){const I=c.nextBitIsOne(),g=Math.pow(2,c.count-(f+1));I?h(g,pe.BLACK):(h(g,pe.BLACK),h(g,pe.RED))}return u},o=new P_(t.length),a=s(o);return new Ce(r||e,a)};let ms;const Gt={};class Ke{static get Default(){return D(Gt&&ce,"ChildrenNode.ts has not been loaded"),ms=ms||new Ke({".priority":Gt},{".priority":ce}),ms}constructor(e,n){this.indexes_=e,this.indexSet_=n}get(e){const n=an(this.indexes_,e);if(!n)throw new Error("No index defined for "+e);return n instanceof Ce?n:null}hasIndex(e){return nt(this.indexSet_,e.toString())}addIndex(e,n){D(e!==on,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const r=[];let i=!1;const s=n.getIterator(K.Wrap);let o=s.getNext();for(;o;)i=i||e.isDefinedOn(o.node),r.push(o),o=s.getNext();let a;i?a=hi(r,e.getCompare()):a=Gt;const c=e.toString(),l=Object.assign({},this.indexSet_);l[c]=e;const u=Object.assign({},this.indexes_);return u[c]=a,new Ke(u,l)}addToIndexes(e,n){const r=ni(this.indexes_,(i,s)=>{const o=an(this.indexSet_,s);if(D(o,"Missing index implementation for "+s),i===Gt)if(o.isDefinedOn(e.node)){const a=[],c=n.getIterator(K.Wrap);let l=c.getNext();for(;l;)l.name!==e.name&&a.push(l),l=c.getNext();return a.push(e),hi(a,o.getCompare())}else return Gt;else{const a=n.get(e.name);let c=i;return a&&(c=c.remove(new K(e.name,a))),c.insert(e,e.node)}});return new Ke(r,this.indexSet_)}removeFromIndexes(e,n){const r=ni(this.indexes_,i=>{if(i===Gt)return i;{const s=n.get(e.name);return s?i.remove(new K(e.name,s)):i}});return new Ke(r,this.indexSet_)}}let kn;class j{static get EMPTY_NODE(){return kn||(kn=new j(new Ce(Mo),null,Ke.Default))}constructor(e,n,r){this.children_=e,this.priorityNode_=n,this.indexMap_=r,this.lazyHash_=null,this.priorityNode_&&Qu(this.priorityNode_),this.children_.isEmpty()&&D(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||kn}updatePriority(e){return this.children_.isEmpty()?this:new j(this.children_,e,this.indexMap_)}getImmediateChild(e){if(e===".priority")return this.getPriority();{const n=this.children_.get(e);return n===null?kn:n}}getChild(e){const n=X(e);return n===null?this:this.getImmediateChild(n).getChild(se(e))}hasChild(e){return this.children_.get(e)!==null}updateImmediateChild(e,n){if(D(n,"We should always be passing snapshot nodes"),e===".priority")return this.updatePriority(n);{const r=new K(e,n);let i,s;n.isEmpty()?(i=this.children_.remove(e),s=this.indexMap_.removeFromIndexes(r,this.children_)):(i=this.children_.insert(e,n),s=this.indexMap_.addToIndexes(r,this.children_));const o=i.isEmpty()?kn:this.priorityNode_;return new j(i,o,s)}}updateChild(e,n){const r=X(e);if(r===null)return n;{D(X(e)!==".priority"||_t(e)===1,".priority must be the last token in a path");const i=this.getImmediateChild(r).updateChild(se(e),n);return this.updateImmediateChild(r,i)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(e){if(this.isEmpty())return null;const n={};let r=0,i=0,s=!0;if(this.forEachChild(ce,(o,a)=>{n[o]=a.val(e),r++,s&&j.INTEGER_REGEXP_.test(o)?i=Math.max(i,Number(o)):s=!1}),!e&&s&&i<2*r){const o=[];for(const a in n)o[a]=n[a];return o}else return e&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n}hash(){if(this.lazyHash_===null){let e="";this.getPriority().isEmpty()||(e+="priority:"+Gu(this.getPriority().val())+":"),this.forEachChild(ce,(n,r)=>{const i=r.hash();i!==""&&(e+=":"+n+":"+i)}),this.lazyHash_=e===""?"":vu(e)}return this.lazyHash_}getPredecessorChildName(e,n,r){const i=this.resolveIndex_(r);if(i){const s=i.getPredecessorKey(new K(e,n));return s?s.name:null}else return this.children_.getPredecessorKey(e)}getFirstChildName(e){const n=this.resolveIndex_(e);if(n){const r=n.minKey();return r&&r.name}else return this.children_.minKey()}getFirstChild(e){const n=this.getFirstChildName(e);return n?new K(n,this.children_.get(n)):null}getLastChildName(e){const n=this.resolveIndex_(e);if(n){const r=n.maxKey();return r&&r.name}else return this.children_.maxKey()}getLastChild(e){const n=this.getLastChildName(e);return n?new K(n,this.children_.get(n)):null}forEachChild(e,n){const r=this.resolveIndex_(e);return r?r.inorderTraversal(i=>n(i.name,i.node)):this.children_.inorderTraversal(n)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,n){const r=this.resolveIndex_(n);if(r)return r.getIteratorFrom(e,i=>i);{const i=this.children_.getIteratorFrom(e.name,K.Wrap);let s=i.peek();for(;s!=null&&n.compare(s,e)<0;)i.getNext(),s=i.peek();return i}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,n){const r=this.resolveIndex_(n);if(r)return r.getReverseIteratorFrom(e,i=>i);{const i=this.children_.getReverseIteratorFrom(e.name,K.Wrap);let s=i.peek();for(;s!=null&&n.compare(s,e)>0;)i.getNext(),s=i.peek();return i}}compareTo(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===Er?-1:0}withIndex(e){if(e===on||this.indexMap_.hasIndex(e))return this;{const n=this.indexMap_.addIndex(e,this.children_);return new j(this.children_,this.priorityNode_,n)}}isIndexed(e){return e===on||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode())return!1;{const n=e;if(this.getPriority().equals(n.getPriority()))if(this.children_.count()===n.children_.count()){const r=this.getIterator(ce),i=n.getIterator(ce);let s=r.getNext(),o=i.getNext();for(;s&&o;){if(s.name!==o.name||!s.node.equals(o.node))return!1;s=r.getNext(),o=i.getNext()}return s===null&&o===null}else return!1;else return!1}}resolveIndex_(e){return e===on?null:this.indexMap_.get(e.toString())}}j.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class A_ extends j{constructor(){super(new Ce(Mo),j.EMPTY_NODE,Ke.Default)}compareTo(e){return e===this?0:1}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return j.EMPTY_NODE}isEmpty(){return!1}}const Er=new A_;Object.defineProperties(K,{MIN:{value:new K(un,j.EMPTY_NODE)},MAX:{value:new K(Lt,Er)}});$u.__EMPTY_NODE=j.EMPTY_NODE;fe.__childrenNodeConstructor=j;C_(Er);T_(Er);const N_=!0;function _e(t,e=null){if(t===null)return j.EMPTY_NODE;if(typeof t=="object"&&".priority"in t&&(e=t[".priority"]),D(e===null||typeof e=="string"||typeof e=="number"||typeof e=="object"&&".sv"in e,"Invalid priority type found: "+typeof e),typeof t=="object"&&".value"in t&&t[".value"]!==null&&(t=t[".value"]),typeof t!="object"||".sv"in t){const n=t;return new fe(n,_e(e))}if(!(t instanceof Array)&&N_){const n=[];let r=!1;if(Se(t,(o,a)=>{if(o.substring(0,1)!=="."){const c=_e(a);c.isEmpty()||(r=r||!c.getPriority().isEmpty(),n.push(new K(o,c)))}}),n.length===0)return j.EMPTY_NODE;const s=hi(n,I_,o=>o.name,Mo);if(r){const o=hi(n,ce.getCompare());return new j(s,_e(e),new Ke({".priority":o},{".priority":ce}))}else return new j(s,_e(e),Ke.Default)}else{let n=j.EMPTY_NODE;return Se(t,(r,i)=>{if(nt(t,r)&&r.substring(0,1)!=="."){const s=_e(i);(s.isLeafNode()||!s.isEmpty())&&(n=n.updateImmediateChild(r,s))}}),n.updatePriority(_e(e))}}S_(_e);class O_ extends Bi{constructor(e){super(),this.indexPath_=e,D(!J(e)&&X(e)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,n){const r=this.extractChild(e.node),i=this.extractChild(n.node),s=r.compareTo(i);return s===0?En(e.name,n.name):s}makePost(e,n){const r=_e(e),i=j.EMPTY_NODE.updateChild(this.indexPath_,r);return new K(n,i)}maxPost(){const e=j.EMPTY_NODE.updateChild(this.indexPath_,Er);return new K(Lt,e)}toString(){return qu(this.indexPath_,0).join("/")}}class D_ extends Bi{compare(e,n){const r=e.node.compareTo(n.node);return r===0?En(e.name,n.name):r}isDefinedOn(e){return!0}indexedValueChanged(e,n){return!e.equals(n)}minPost(){return K.MIN}maxPost(){return K.MAX}makePost(e,n){const r=_e(e);return new K(n,r)}toString(){return".value"}}const x_=new D_;function Ju(t){return{type:"value",snapshotNode:t}}function dn(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function tr(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function nr(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}function M_(t,e){return{type:"child_moved",snapshotNode:e,childName:t}}class Lo{constructor(e){this.index_=e}updateChild(e,n,r,i,s,o){D(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");const a=e.getImmediateChild(n);return a.getChild(i).equals(r.getChild(i))&&a.isEmpty()===r.isEmpty()||(o!=null&&(r.isEmpty()?e.hasChild(n)?o.trackChildChange(tr(n,a)):D(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(dn(n,r)):o.trackChildChange(nr(n,r,a))),e.isLeafNode()&&r.isEmpty())?e:e.updateImmediateChild(n,r).withIndex(this.index_)}updateFullNode(e,n,r){return r!=null&&(e.isLeafNode()||e.forEachChild(ce,(i,s)=>{n.hasChild(i)||r.trackChildChange(tr(i,s))}),n.isLeafNode()||n.forEachChild(ce,(i,s)=>{if(e.hasChild(i)){const o=e.getImmediateChild(i);o.equals(s)||r.trackChildChange(nr(i,s,o))}else r.trackChildChange(dn(i,s))})),n.withIndex(this.index_)}updatePriority(e,n){return e.isEmpty()?j.EMPTY_NODE:e.updatePriority(n)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}class rr{constructor(e){this.indexedFilter_=new Lo(e.getIndex()),this.index_=e.getIndex(),this.startPost_=rr.getStartPost_(e),this.endPost_=rr.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){const n=this.startIsInclusive_?this.index_.compare(this.getStartPost(),e)<=0:this.index_.compare(this.getStartPost(),e)<0,r=this.endIsInclusive_?this.index_.compare(e,this.getEndPost())<=0:this.index_.compare(e,this.getEndPost())<0;return n&&r}updateChild(e,n,r,i,s,o){return this.matches(new K(n,r))||(r=j.EMPTY_NODE),this.indexedFilter_.updateChild(e,n,r,i,s,o)}updateFullNode(e,n,r){n.isLeafNode()&&(n=j.EMPTY_NODE);let i=n.withIndex(this.index_);i=i.updatePriority(j.EMPTY_NODE);const s=this;return n.forEachChild(ce,(o,a)=>{s.matches(new K(o,a))||(i=i.updateImmediateChild(o,j.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,i,r)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(e.hasStart()){const n=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),n)}else return e.getIndex().minPost()}static getEndPost_(e){if(e.hasEnd()){const n=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),n)}else return e.getIndex().maxPost()}}class L_{constructor(e){this.withinDirectionalStart=n=>this.reverse_?this.withinEndPost(n):this.withinStartPost(n),this.withinDirectionalEnd=n=>this.reverse_?this.withinStartPost(n):this.withinEndPost(n),this.withinStartPost=n=>{const r=this.index_.compare(this.rangedFilter_.getStartPost(),n);return this.startIsInclusive_?r<=0:r<0},this.withinEndPost=n=>{const r=this.index_.compare(n,this.rangedFilter_.getEndPost());return this.endIsInclusive_?r<=0:r<0},this.rangedFilter_=new rr(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,n,r,i,s,o){return this.rangedFilter_.matches(new K(n,r))||(r=j.EMPTY_NODE),e.getImmediateChild(n).equals(r)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,n,r,i,s,o):this.fullLimitUpdateChild_(e,n,r,s,o)}updateFullNode(e,n,r){let i;if(n.isLeafNode()||n.isEmpty())i=j.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<n.numChildren()&&n.isIndexed(this.index_)){i=j.EMPTY_NODE.withIndex(this.index_);let s;this.reverse_?s=n.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):s=n.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let o=0;for(;s.hasNext()&&o<this.limit_;){const a=s.getNext();if(this.withinDirectionalStart(a))if(this.withinDirectionalEnd(a))i=i.updateImmediateChild(a.name,a.node),o++;else break;else continue}}else{i=n.withIndex(this.index_),i=i.updatePriority(j.EMPTY_NODE);let s;this.reverse_?s=i.getReverseIterator(this.index_):s=i.getIterator(this.index_);let o=0;for(;s.hasNext();){const a=s.getNext();o<this.limit_&&this.withinDirectionalStart(a)&&this.withinDirectionalEnd(a)?o++:i=i.updateImmediateChild(a.name,j.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,i,r)}updatePriority(e,n){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(e,n,r,i,s){let o;if(this.reverse_){const d=this.index_.getCompare();o=(h,p)=>d(p,h)}else o=this.index_.getCompare();const a=e;D(a.numChildren()===this.limit_,"");const c=new K(n,r),l=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),u=this.rangedFilter_.matches(c);if(a.hasChild(n)){const d=a.getImmediateChild(n);let h=i.getChildAfterChild(this.index_,l,this.reverse_);for(;h!=null&&(h.name===n||a.hasChild(h.name));)h=i.getChildAfterChild(this.index_,h,this.reverse_);const p=h==null?1:o(h,c);if(u&&!r.isEmpty()&&p>=0)return s?.trackChildChange(nr(n,r,d)),a.updateImmediateChild(n,r);{s?.trackChildChange(tr(n,d));const I=a.updateImmediateChild(n,j.EMPTY_NODE);return h!=null&&this.rangedFilter_.matches(h)?(s?.trackChildChange(dn(h.name,h.node)),I.updateImmediateChild(h.name,h.node)):I}}else return r.isEmpty()?e:u&&o(l,c)>=0?(s!=null&&(s.trackChildChange(tr(l.name,l.node)),s.trackChildChange(dn(n,r))),a.updateImmediateChild(n,r).updateImmediateChild(l.name,j.EMPTY_NODE)):e}}class Fo{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=ce}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return D(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return D(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:un}hasEnd(){return this.endSet_}getIndexEndValue(){return D(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return D(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Lt}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return D(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===ce}copy(){const e=new Fo;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}}function F_(t){return t.loadsAllData()?new Lo(t.getIndex()):t.hasLimit()?new L_(t):new rr(t)}function pc(t){const e={};if(t.isDefault())return e;let n;if(t.index_===ce?n="$priority":t.index_===x_?n="$value":t.index_===on?n="$key":(D(t.index_ instanceof O_,"Unrecognized index type!"),n=t.index_.toString()),e.orderBy=ue(n),t.startSet_){const r=t.startAfterSet_?"startAfter":"startAt";e[r]=ue(t.indexStartValue_),t.startNameSet_&&(e[r]+=","+ue(t.indexStartName_))}if(t.endSet_){const r=t.endBeforeSet_?"endBefore":"endAt";e[r]=ue(t.indexEndValue_),t.endNameSet_&&(e[r]+=","+ue(t.indexEndName_))}return t.limitSet_&&(t.isViewFromLeft()?e.limitToFirst=t.limit_:e.limitToLast=t.limit_),e}function gc(t){const e={};if(t.startSet_&&(e.sp=t.indexStartValue_,t.startNameSet_&&(e.sn=t.indexStartName_),e.sin=!t.startAfterSet_),t.endSet_&&(e.ep=t.indexEndValue_,t.endNameSet_&&(e.en=t.indexEndName_),e.ein=!t.endBeforeSet_),t.limitSet_){e.l=t.limit_;let n=t.viewFrom_;n===""&&(t.isViewFromLeft()?n="l":n="r"),e.vf=n}return t.index_!==ce&&(e.i=t.index_.toString()),e}class fi extends Wu{reportStats(e){throw new Error("Method not implemented.")}static getListenId_(e,n){return n!==void 0?"tag$"+n:(D(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,n,r,i){super(),this.repoInfo_=e,this.onDataUpdate_=n,this.authTokenProvider_=r,this.appCheckTokenProvider_=i,this.log_=br("p:rest:"),this.listens_={}}listen(e,n,r,i){const s=e._path.toString();this.log_("Listen called for "+s+" "+e._queryIdentifier);const o=fi.getListenId_(e,r),a={};this.listens_[o]=a;const c=pc(e._queryParams);this.restRequest_(s+".json",c,(l,u)=>{let d=u;if(l===404&&(d=null,l=null),l===null&&this.onDataUpdate_(s,d,!1,r),an(this.listens_,o)===a){let h;l?l===401?h="permission_denied":h="rest_error:"+l:h="ok",i(h,null)}})}unlisten(e,n){const r=fi.getListenId_(e,n);delete this.listens_[r]}get(e){const n=pc(e._queryParams),r=e._path.toString(),i=new mo;return this.restRequest_(r+".json",n,(s,o)=>{let a=o;s===404&&(a=null,s=null),s===null?(this.onDataUpdate_(r,a,!1,null),i.resolve(a)):i.reject(new Error(a))}),i.promise}refreshAuthToken(e){}restRequest_(e,n={},r){return n.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([i,s])=>{i&&i.accessToken&&(n.auth=i.accessToken),s&&s.token&&(n.ac=s.token);const o=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+yn(n);this.log_("Sending REST request for "+o);const a=new XMLHttpRequest;a.onreadystatechange=()=>{if(r&&a.readyState===4){this.log_("REST Response for "+o+" received. status:",a.status,"response:",a.responseText);let c=null;if(a.status>=200&&a.status<300){try{c=Yn(a.responseText)}catch{Re("Failed to parse JSON response for "+o+": "+a.responseText)}r(null,c)}else a.status!==401&&a.status!==404&&Re("Got unsuccessful REST response for "+o+" Status: "+a.status),r(a.status);r=null}},a.open("GET",o,!0),a.send()})}}class U_{constructor(){this.rootNode_=j.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,n){this.rootNode_=this.rootNode_.updateChild(e,n)}}function pi(){return{value:null,children:new Map}}function Xu(t,e,n){if(J(e))t.value=n,t.children.clear();else if(t.value!==null)t.value=t.value.updateChild(e,n);else{const r=X(e);t.children.has(r)||t.children.set(r,pi());const i=t.children.get(r);e=se(e),Xu(i,e,n)}}function Hs(t,e,n){t.value!==null?n(e,t.value):W_(t,(r,i)=>{const s=new ie(e.toString()+"/"+r);Hs(i,s,n)})}function W_(t,e){t.children.forEach((n,r)=>{e(r,n)})}class V_{constructor(e){this.collection_=e,this.last_=null}get(){const e=this.collection_.get(),n=Object.assign({},e);return this.last_&&Se(this.last_,(r,i)=>{n[r]=n[r]-i}),this.last_=e,n}}const mc=10*1e3,B_=30*1e3,q_=300*1e3;class z_{constructor(e,n){this.server_=n,this.statsToReport_={},this.statsListener_=new V_(e);const r=mc+(B_-mc)*Math.random();qn(this.reportStats_.bind(this),Math.floor(r))}reportStats_(){const e=this.statsListener_.get(),n={};let r=!1;Se(e,(i,s)=>{s>0&&nt(this.statsToReport_,i)&&(n[i]=s,r=!0)}),r&&this.server_.reportStats(n),qn(this.reportStats_.bind(this),Math.floor(Math.random()*2*q_))}}var Le;(function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"})(Le||(Le={}));function Zu(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function Uo(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function Wo(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}class gi{constructor(e,n,r){this.path=e,this.affectedTree=n,this.revert=r,this.type=Le.ACK_USER_WRITE,this.source=Zu()}operationForChild(e){if(J(this.path)){if(this.affectedTree.value!=null)return D(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const n=this.affectedTree.subtree(new ie(e));return new gi(Z(),n,this.revert)}}else return D(X(this.path)===e,"operationForChild called for unrelated child."),new gi(se(this.path),this.affectedTree,this.revert)}}class ir{constructor(e,n){this.source=e,this.path=n,this.type=Le.LISTEN_COMPLETE}operationForChild(e){return J(this.path)?new ir(this.source,Z()):new ir(this.source,se(this.path))}}class Ft{constructor(e,n,r){this.source=e,this.path=n,this.snap=r,this.type=Le.OVERWRITE}operationForChild(e){return J(this.path)?new Ft(this.source,Z(),this.snap.getImmediateChild(e)):new Ft(this.source,se(this.path),this.snap)}}class sr{constructor(e,n,r){this.source=e,this.path=n,this.children=r,this.type=Le.MERGE}operationForChild(e){if(J(this.path)){const n=this.children.subtree(new ie(e));return n.isEmpty()?null:n.value?new Ft(this.source,Z(),n.value):new sr(this.source,Z(),n)}else return D(X(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new sr(this.source,se(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}class yt{constructor(e,n,r){this.node_=e,this.fullyInitialized_=n,this.filtered_=r}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(J(e))return this.isFullyInitialized()&&!this.filtered_;const n=X(e);return this.isCompleteForChild(n)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}}class H_{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}}function j_(t,e,n,r){const i=[],s=[];return e.forEach(o=>{o.type==="child_changed"&&t.index_.indexedValueChanged(o.oldSnap,o.snapshotNode)&&s.push(M_(o.childName,o.snapshotNode))}),Pn(t,i,"child_removed",e,r,n),Pn(t,i,"child_added",e,r,n),Pn(t,i,"child_moved",s,r,n),Pn(t,i,"child_changed",e,r,n),Pn(t,i,"value",e,r,n),i}function Pn(t,e,n,r,i,s){const o=r.filter(a=>a.type===n);o.sort((a,c)=>G_(t,a,c)),o.forEach(a=>{const c=$_(t,a,s);i.forEach(l=>{l.respondsTo(a.type)&&e.push(l.createEvent(c,t.query_))})})}function $_(t,e,n){return e.type==="value"||e.type==="child_removed"||(e.prevName=n.getPredecessorChildName(e.childName,e.snapshotNode,t.index_)),e}function G_(t,e,n){if(e.childName==null||n.childName==null)throw mn("Should only compare child_ events.");const r=new K(e.childName,e.snapshotNode),i=new K(n.childName,n.snapshotNode);return t.index_.compare(r,i)}function qi(t,e){return{eventCache:t,serverCache:e}}function zn(t,e,n,r){return qi(new yt(e,n,r),t.serverCache)}function ed(t,e,n,r){return qi(t.eventCache,new yt(e,n,r))}function mi(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function Ut(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}let _s;const Q_=()=>(_s||(_s=new Ce(Dm)),_s);class oe{static fromObject(e){let n=new oe(null);return Se(e,(r,i)=>{n=n.set(new ie(r),i)}),n}constructor(e,n=Q_()){this.value=e,this.children=n}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,n){if(this.value!=null&&n(this.value))return{path:Z(),value:this.value};if(J(e))return null;{const r=X(e),i=this.children.get(r);if(i!==null){const s=i.findRootMostMatchingPathAndValue(se(e),n);return s!=null?{path:de(new ie(r),s.path),value:s.value}:null}else return null}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(J(e))return this;{const n=X(e),r=this.children.get(n);return r!==null?r.subtree(se(e)):new oe(null)}}set(e,n){if(J(e))return new oe(n,this.children);{const r=X(e),s=(this.children.get(r)||new oe(null)).set(se(e),n),o=this.children.insert(r,s);return new oe(this.value,o)}}remove(e){if(J(e))return this.children.isEmpty()?new oe(null):new oe(null,this.children);{const n=X(e),r=this.children.get(n);if(r){const i=r.remove(se(e));let s;return i.isEmpty()?s=this.children.remove(n):s=this.children.insert(n,i),this.value===null&&s.isEmpty()?new oe(null):new oe(this.value,s)}else return this}}get(e){if(J(e))return this.value;{const n=X(e),r=this.children.get(n);return r?r.get(se(e)):null}}setTree(e,n){if(J(e))return n;{const r=X(e),s=(this.children.get(r)||new oe(null)).setTree(se(e),n);let o;return s.isEmpty()?o=this.children.remove(r):o=this.children.insert(r,s),new oe(this.value,o)}}fold(e){return this.fold_(Z(),e)}fold_(e,n){const r={};return this.children.inorderTraversal((i,s)=>{r[i]=s.fold_(de(e,i),n)}),n(e,this.value,r)}findOnPath(e,n){return this.findOnPath_(e,Z(),n)}findOnPath_(e,n,r){const i=this.value?r(n,this.value):!1;if(i)return i;if(J(e))return null;{const s=X(e),o=this.children.get(s);return o?o.findOnPath_(se(e),de(n,s),r):null}}foreachOnPath(e,n){return this.foreachOnPath_(e,Z(),n)}foreachOnPath_(e,n,r){if(J(e))return this;{this.value&&r(n,this.value);const i=X(e),s=this.children.get(i);return s?s.foreachOnPath_(se(e),de(n,i),r):new oe(null)}}foreach(e){this.foreach_(Z(),e)}foreach_(e,n){this.children.inorderTraversal((r,i)=>{i.foreach_(de(e,r),n)}),this.value&&n(e,this.value)}foreachChild(e){this.children.inorderTraversal((n,r)=>{r.value&&e(n,r.value)})}}class Fe{constructor(e){this.writeTree_=e}static empty(){return new Fe(new oe(null))}}function Hn(t,e,n){if(J(e))return new Fe(new oe(n));{const r=t.writeTree_.findRootMostValueAndPath(e);if(r!=null){const i=r.path;let s=r.value;const o=be(i,e);return s=s.updateChild(o,n),new Fe(t.writeTree_.set(i,s))}else{const i=new oe(n),s=t.writeTree_.setTree(e,i);return new Fe(s)}}}function _c(t,e,n){let r=t;return Se(n,(i,s)=>{r=Hn(r,de(e,i),s)}),r}function yc(t,e){if(J(e))return Fe.empty();{const n=t.writeTree_.setTree(e,new oe(null));return new Fe(n)}}function js(t,e){return zt(t,e)!=null}function zt(t,e){const n=t.writeTree_.findRootMostValueAndPath(e);return n!=null?t.writeTree_.get(n.path).getChild(be(n.path,e)):null}function vc(t){const e=[],n=t.writeTree_.value;return n!=null?n.isLeafNode()||n.forEachChild(ce,(r,i)=>{e.push(new K(r,i))}):t.writeTree_.children.inorderTraversal((r,i)=>{i.value!=null&&e.push(new K(r,i.value))}),e}function gt(t,e){if(J(e))return t;{const n=zt(t,e);return n!=null?new Fe(new oe(n)):new Fe(t.writeTree_.subtree(e))}}function $s(t){return t.writeTree_.isEmpty()}function hn(t,e){return td(Z(),t.writeTree_,e)}function td(t,e,n){if(e.value!=null)return n.updateChild(t,e.value);{let r=null;return e.children.inorderTraversal((i,s)=>{i===".priority"?(D(s.value!==null,"Priority writes must always be leaf nodes"),r=s.value):n=td(de(t,i),s,n)}),!n.getChild(t).isEmpty()&&r!==null&&(n=n.updateChild(de(t,".priority"),r)),n}}function zi(t,e){return sd(e,t)}function K_(t,e,n,r,i){D(r>t.lastWriteId,"Stacking an older write on top of newer ones"),i===void 0&&(i=!0),t.allWrites.push({path:e,snap:n,writeId:r,visible:i}),i&&(t.visibleWrites=Hn(t.visibleWrites,e,n)),t.lastWriteId=r}function Y_(t,e){for(let n=0;n<t.allWrites.length;n++){const r=t.allWrites[n];if(r.writeId===e)return r}return null}function J_(t,e){const n=t.allWrites.findIndex(a=>a.writeId===e);D(n>=0,"removeWrite called with nonexistent writeId.");const r=t.allWrites[n];t.allWrites.splice(n,1);let i=r.visible,s=!1,o=t.allWrites.length-1;for(;i&&o>=0;){const a=t.allWrites[o];a.visible&&(o>=n&&X_(a,r.path)?i=!1:Me(r.path,a.path)&&(s=!0)),o--}if(i){if(s)return Z_(t),!0;if(r.snap)t.visibleWrites=yc(t.visibleWrites,r.path);else{const a=r.children;Se(a,c=>{t.visibleWrites=yc(t.visibleWrites,de(r.path,c))})}return!0}else return!1}function X_(t,e){if(t.snap)return Me(t.path,e);for(const n in t.children)if(t.children.hasOwnProperty(n)&&Me(de(t.path,n),e))return!0;return!1}function Z_(t){t.visibleWrites=nd(t.allWrites,ey,Z()),t.allWrites.length>0?t.lastWriteId=t.allWrites[t.allWrites.length-1].writeId:t.lastWriteId=-1}function ey(t){return t.visible}function nd(t,e,n){let r=Fe.empty();for(let i=0;i<t.length;++i){const s=t[i];if(e(s)){const o=s.path;let a;if(s.snap)Me(n,o)?(a=be(n,o),r=Hn(r,a,s.snap)):Me(o,n)&&(a=be(o,n),r=Hn(r,Z(),s.snap.getChild(a)));else if(s.children){if(Me(n,o))a=be(n,o),r=_c(r,a,s.children);else if(Me(o,n))if(a=be(o,n),J(a))r=_c(r,Z(),s.children);else{const c=an(s.children,X(a));if(c){const l=c.getChild(se(a));r=Hn(r,Z(),l)}}}else throw mn("WriteRecord should have .snap or .children")}}return r}function rd(t,e,n,r,i){if(!r&&!i){const s=zt(t.visibleWrites,e);if(s!=null)return s;{const o=gt(t.visibleWrites,e);if($s(o))return n;if(n==null&&!js(o,Z()))return null;{const a=n||j.EMPTY_NODE;return hn(o,a)}}}else{const s=gt(t.visibleWrites,e);if(!i&&$s(s))return n;if(!i&&n==null&&!js(s,Z()))return null;{const o=function(l){return(l.visible||i)&&(!r||!~r.indexOf(l.writeId))&&(Me(l.path,e)||Me(e,l.path))},a=nd(t.allWrites,o,e),c=n||j.EMPTY_NODE;return hn(a,c)}}}function ty(t,e,n){let r=j.EMPTY_NODE;const i=zt(t.visibleWrites,e);if(i)return i.isLeafNode()||i.forEachChild(ce,(s,o)=>{r=r.updateImmediateChild(s,o)}),r;if(n){const s=gt(t.visibleWrites,e);return n.forEachChild(ce,(o,a)=>{const c=hn(gt(s,new ie(o)),a);r=r.updateImmediateChild(o,c)}),vc(s).forEach(o=>{r=r.updateImmediateChild(o.name,o.node)}),r}else{const s=gt(t.visibleWrites,e);return vc(s).forEach(o=>{r=r.updateImmediateChild(o.name,o.node)}),r}}function ny(t,e,n,r,i){D(r||i,"Either existingEventSnap or existingServerSnap must exist");const s=de(e,n);if(js(t.visibleWrites,s))return null;{const o=gt(t.visibleWrites,s);return $s(o)?i.getChild(n):hn(o,i.getChild(n))}}function ry(t,e,n,r){const i=de(e,n),s=zt(t.visibleWrites,i);if(s!=null)return s;if(r.isCompleteForChild(n)){const o=gt(t.visibleWrites,i);return hn(o,r.getNode().getImmediateChild(n))}else return null}function iy(t,e){return zt(t.visibleWrites,e)}function sy(t,e,n,r,i,s,o){let a;const c=gt(t.visibleWrites,e),l=zt(c,Z());if(l!=null)a=l;else if(n!=null)a=hn(c,n);else return[];if(a=a.withIndex(o),!a.isEmpty()&&!a.isLeafNode()){const u=[],d=o.getCompare(),h=s?a.getReverseIteratorFrom(r,o):a.getIteratorFrom(r,o);let p=h.getNext();for(;p&&u.length<i;)d(p,r)!==0&&u.push(p),p=h.getNext();return u}else return[]}function oy(){return{visibleWrites:Fe.empty(),allWrites:[],lastWriteId:-1}}function _i(t,e,n,r){return rd(t.writeTree,t.treePath,e,n,r)}function Vo(t,e){return ty(t.writeTree,t.treePath,e)}function bc(t,e,n,r){return ny(t.writeTree,t.treePath,e,n,r)}function yi(t,e){return iy(t.writeTree,de(t.treePath,e))}function ay(t,e,n,r,i,s){return sy(t.writeTree,t.treePath,e,n,r,i,s)}function Bo(t,e,n){return ry(t.writeTree,t.treePath,e,n)}function id(t,e){return sd(de(t.treePath,e),t.writeTree)}function sd(t,e){return{treePath:t,writeTree:e}}class cy{constructor(){this.changeMap=new Map}trackChildChange(e){const n=e.type,r=e.childName;D(n==="child_added"||n==="child_changed"||n==="child_removed","Only child changes supported for tracking"),D(r!==".priority","Only non-priority child changes can be tracked.");const i=this.changeMap.get(r);if(i){const s=i.type;if(n==="child_added"&&s==="child_removed")this.changeMap.set(r,nr(r,e.snapshotNode,i.snapshotNode));else if(n==="child_removed"&&s==="child_added")this.changeMap.delete(r);else if(n==="child_removed"&&s==="child_changed")this.changeMap.set(r,tr(r,i.oldSnap));else if(n==="child_changed"&&s==="child_added")this.changeMap.set(r,dn(r,e.snapshotNode));else if(n==="child_changed"&&s==="child_changed")this.changeMap.set(r,nr(r,e.snapshotNode,i.oldSnap));else throw mn("Illegal combination of changes: "+e+" occurred after "+i)}else this.changeMap.set(r,e)}getChanges(){return Array.from(this.changeMap.values())}}class ly{getCompleteChild(e){return null}getChildAfterChild(e,n,r){return null}}const od=new ly;class qo{constructor(e,n,r=null){this.writes_=e,this.viewCache_=n,this.optCompleteServerCache_=r}getCompleteChild(e){const n=this.viewCache_.eventCache;if(n.isCompleteForChild(e))return n.getNode().getImmediateChild(e);{const r=this.optCompleteServerCache_!=null?new yt(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return Bo(this.writes_,e,r)}}getChildAfterChild(e,n,r){const i=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:Ut(this.viewCache_),s=ay(this.writes_,i,n,1,r,e);return s.length===0?null:s[0]}}function uy(t){return{filter:t}}function dy(t,e){D(e.eventCache.getNode().isIndexed(t.filter.getIndex()),"Event snap not indexed"),D(e.serverCache.getNode().isIndexed(t.filter.getIndex()),"Server snap not indexed")}function hy(t,e,n,r,i){const s=new cy;let o,a;if(n.type===Le.OVERWRITE){const l=n;l.source.fromUser?o=Gs(t,e,l.path,l.snap,r,i,s):(D(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered()&&!J(l.path),o=vi(t,e,l.path,l.snap,r,i,a,s))}else if(n.type===Le.MERGE){const l=n;l.source.fromUser?o=py(t,e,l.path,l.children,r,i,s):(D(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered(),o=Qs(t,e,l.path,l.children,r,i,a,s))}else if(n.type===Le.ACK_USER_WRITE){const l=n;l.revert?o=_y(t,e,l.path,r,i,s):o=gy(t,e,l.path,l.affectedTree,r,i,s)}else if(n.type===Le.LISTEN_COMPLETE)o=my(t,e,n.path,r,s);else throw mn("Unknown operation type: "+n.type);const c=s.getChanges();return fy(e,o,c),{viewCache:o,changes:c}}function fy(t,e,n){const r=e.eventCache;if(r.isFullyInitialized()){const i=r.getNode().isLeafNode()||r.getNode().isEmpty(),s=mi(t);(n.length>0||!t.eventCache.isFullyInitialized()||i&&!r.getNode().equals(s)||!r.getNode().getPriority().equals(s.getPriority()))&&n.push(Ju(mi(e)))}}function ad(t,e,n,r,i,s){const o=e.eventCache;if(yi(r,n)!=null)return e;{let a,c;if(J(n))if(D(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){const l=Ut(e),u=l instanceof j?l:j.EMPTY_NODE,d=Vo(r,u);a=t.filter.updateFullNode(e.eventCache.getNode(),d,s)}else{const l=_i(r,Ut(e));a=t.filter.updateFullNode(e.eventCache.getNode(),l,s)}else{const l=X(n);if(l===".priority"){D(_t(n)===1,"Can't have a priority with additional path components");const u=o.getNode();c=e.serverCache.getNode();const d=bc(r,n,u,c);d!=null?a=t.filter.updatePriority(u,d):a=o.getNode()}else{const u=se(n);let d;if(o.isCompleteForChild(l)){c=e.serverCache.getNode();const h=bc(r,n,o.getNode(),c);h!=null?d=o.getNode().getImmediateChild(l).updateChild(u,h):d=o.getNode().getImmediateChild(l)}else d=Bo(r,l,e.serverCache);d!=null?a=t.filter.updateChild(o.getNode(),l,d,u,i,s):a=o.getNode()}}return zn(e,a,o.isFullyInitialized()||J(n),t.filter.filtersNodes())}}function vi(t,e,n,r,i,s,o,a){const c=e.serverCache;let l;const u=o?t.filter:t.filter.getIndexedFilter();if(J(n))l=u.updateFullNode(c.getNode(),r,null);else if(u.filtersNodes()&&!c.isFiltered()){const p=c.getNode().updateChild(n,r);l=u.updateFullNode(c.getNode(),p,null)}else{const p=X(n);if(!c.isCompleteForPath(n)&&_t(n)>1)return e;const f=se(n),g=c.getNode().getImmediateChild(p).updateChild(f,r);p===".priority"?l=u.updatePriority(c.getNode(),g):l=u.updateChild(c.getNode(),p,g,f,od,null)}const d=ed(e,l,c.isFullyInitialized()||J(n),u.filtersNodes()),h=new qo(i,d,s);return ad(t,d,n,i,h,a)}function Gs(t,e,n,r,i,s,o){const a=e.eventCache;let c,l;const u=new qo(i,e,s);if(J(n))l=t.filter.updateFullNode(e.eventCache.getNode(),r,o),c=zn(e,l,!0,t.filter.filtersNodes());else{const d=X(n);if(d===".priority")l=t.filter.updatePriority(e.eventCache.getNode(),r),c=zn(e,l,a.isFullyInitialized(),a.isFiltered());else{const h=se(n),p=a.getNode().getImmediateChild(d);let f;if(J(h))f=r;else{const I=u.getCompleteChild(d);I!=null?Bu(h)===".priority"&&I.getChild(zu(h)).isEmpty()?f=I:f=I.updateChild(h,r):f=j.EMPTY_NODE}if(p.equals(f))c=e;else{const I=t.filter.updateChild(a.getNode(),d,f,h,u,o);c=zn(e,I,a.isFullyInitialized(),t.filter.filtersNodes())}}}return c}function wc(t,e){return t.eventCache.isCompleteForChild(e)}function py(t,e,n,r,i,s,o){let a=e;return r.foreach((c,l)=>{const u=de(n,c);wc(e,X(u))&&(a=Gs(t,a,u,l,i,s,o))}),r.foreach((c,l)=>{const u=de(n,c);wc(e,X(u))||(a=Gs(t,a,u,l,i,s,o))}),a}function Ec(t,e,n){return n.foreach((r,i)=>{e=e.updateChild(r,i)}),e}function Qs(t,e,n,r,i,s,o,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let c=e,l;J(n)?l=r:l=new oe(null).setTree(n,r);const u=e.serverCache.getNode();return l.children.inorderTraversal((d,h)=>{if(u.hasChild(d)){const p=e.serverCache.getNode().getImmediateChild(d),f=Ec(t,p,h);c=vi(t,c,new ie(d),f,i,s,o,a)}}),l.children.inorderTraversal((d,h)=>{const p=!e.serverCache.isCompleteForChild(d)&&h.value===null;if(!u.hasChild(d)&&!p){const f=e.serverCache.getNode().getImmediateChild(d),I=Ec(t,f,h);c=vi(t,c,new ie(d),I,i,s,o,a)}}),c}function gy(t,e,n,r,i,s,o){if(yi(i,n)!=null)return e;const a=e.serverCache.isFiltered(),c=e.serverCache;if(r.value!=null){if(J(n)&&c.isFullyInitialized()||c.isCompleteForPath(n))return vi(t,e,n,c.getNode().getChild(n),i,s,a,o);if(J(n)){let l=new oe(null);return c.getNode().forEachChild(on,(u,d)=>{l=l.set(new ie(u),d)}),Qs(t,e,n,l,i,s,a,o)}else return e}else{let l=new oe(null);return r.foreach((u,d)=>{const h=de(n,u);c.isCompleteForPath(h)&&(l=l.set(u,c.getNode().getChild(h)))}),Qs(t,e,n,l,i,s,a,o)}}function my(t,e,n,r,i){const s=e.serverCache,o=ed(e,s.getNode(),s.isFullyInitialized()||J(n),s.isFiltered());return ad(t,o,n,r,od,i)}function _y(t,e,n,r,i,s){let o;if(yi(r,n)!=null)return e;{const a=new qo(r,e,i),c=e.eventCache.getNode();let l;if(J(n)||X(n)===".priority"){let u;if(e.serverCache.isFullyInitialized())u=_i(r,Ut(e));else{const d=e.serverCache.getNode();D(d instanceof j,"serverChildren would be complete if leaf node"),u=Vo(r,d)}u=u,l=t.filter.updateFullNode(c,u,s)}else{const u=X(n);let d=Bo(r,u,e.serverCache);d==null&&e.serverCache.isCompleteForChild(u)&&(d=c.getImmediateChild(u)),d!=null?l=t.filter.updateChild(c,u,d,se(n),a,s):e.eventCache.getNode().hasChild(u)?l=t.filter.updateChild(c,u,j.EMPTY_NODE,se(n),a,s):l=c,l.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=_i(r,Ut(e)),o.isLeafNode()&&(l=t.filter.updateFullNode(l,o,s)))}return o=e.serverCache.isFullyInitialized()||yi(r,Z())!=null,zn(e,l,o,t.filter.filtersNodes())}}class yy{constructor(e,n){this.query_=e,this.eventRegistrations_=[];const r=this.query_._queryParams,i=new Lo(r.getIndex()),s=F_(r);this.processor_=uy(s);const o=n.serverCache,a=n.eventCache,c=i.updateFullNode(j.EMPTY_NODE,o.getNode(),null),l=s.updateFullNode(j.EMPTY_NODE,a.getNode(),null),u=new yt(c,o.isFullyInitialized(),i.filtersNodes()),d=new yt(l,a.isFullyInitialized(),s.filtersNodes());this.viewCache_=qi(d,u),this.eventGenerator_=new H_(this.query_)}get query(){return this.query_}}function vy(t){return t.viewCache_.serverCache.getNode()}function by(t){return mi(t.viewCache_)}function wy(t,e){const n=Ut(t.viewCache_);return n&&(t.query._queryParams.loadsAllData()||!J(e)&&!n.getImmediateChild(X(e)).isEmpty())?n.getChild(e):null}function Ic(t){return t.eventRegistrations_.length===0}function Ey(t,e){t.eventRegistrations_.push(e)}function Cc(t,e,n){const r=[];if(n){D(e==null,"A cancel should cancel all event registrations.");const i=t.query._path;t.eventRegistrations_.forEach(s=>{const o=s.createCancelEvent(n,i);o&&r.push(o)})}if(e){let i=[];for(let s=0;s<t.eventRegistrations_.length;++s){const o=t.eventRegistrations_[s];if(!o.matches(e))i.push(o);else if(e.hasAnyCallback()){i=i.concat(t.eventRegistrations_.slice(s+1));break}}t.eventRegistrations_=i}else t.eventRegistrations_=[];return r}function Sc(t,e,n,r){e.type===Le.MERGE&&e.source.queryId!==null&&(D(Ut(t.viewCache_),"We should always have a full cache before handling merges"),D(mi(t.viewCache_),"Missing event cache, even though we have a server cache"));const i=t.viewCache_,s=hy(t.processor_,i,e,n,r);return dy(t.processor_,s.viewCache),D(s.viewCache.serverCache.isFullyInitialized()||!i.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=s.viewCache,cd(t,s.changes,s.viewCache.eventCache.getNode(),null)}function Iy(t,e){const n=t.viewCache_.eventCache,r=[];return n.getNode().isLeafNode()||n.getNode().forEachChild(ce,(s,o)=>{r.push(dn(s,o))}),n.isFullyInitialized()&&r.push(Ju(n.getNode())),cd(t,r,n.getNode(),e)}function cd(t,e,n,r){const i=r?[r]:t.eventRegistrations_;return j_(t.eventGenerator_,e,n,i)}let bi;class ld{constructor(){this.views=new Map}}function Cy(t){D(!bi,"__referenceConstructor has already been defined"),bi=t}function Sy(){return D(bi,"Reference.ts has not been loaded"),bi}function Ty(t){return t.views.size===0}function zo(t,e,n,r){const i=e.source.queryId;if(i!==null){const s=t.views.get(i);return D(s!=null,"SyncTree gave us an op for an invalid query."),Sc(s,e,n,r)}else{let s=[];for(const o of t.views.values())s=s.concat(Sc(o,e,n,r));return s}}function ud(t,e,n,r,i){const s=e._queryIdentifier,o=t.views.get(s);if(!o){let a=_i(n,i?r:null),c=!1;a?c=!0:r instanceof j?(a=Vo(n,r),c=!1):(a=j.EMPTY_NODE,c=!1);const l=qi(new yt(a,c,!1),new yt(r,i,!1));return new yy(e,l)}return o}function Ry(t,e,n,r,i,s){const o=ud(t,e,r,i,s);return t.views.has(e._queryIdentifier)||t.views.set(e._queryIdentifier,o),Ey(o,n),Iy(o,n)}function ky(t,e,n,r){const i=e._queryIdentifier,s=[];let o=[];const a=vt(t);if(i==="default")for(const[c,l]of t.views.entries())o=o.concat(Cc(l,n,r)),Ic(l)&&(t.views.delete(c),l.query._queryParams.loadsAllData()||s.push(l.query));else{const c=t.views.get(i);c&&(o=o.concat(Cc(c,n,r)),Ic(c)&&(t.views.delete(i),c.query._queryParams.loadsAllData()||s.push(c.query)))}return a&&!vt(t)&&s.push(new(Sy())(e._repo,e._path)),{removed:s,events:o}}function dd(t){const e=[];for(const n of t.views.values())n.query._queryParams.loadsAllData()||e.push(n);return e}function mt(t,e){let n=null;for(const r of t.views.values())n=n||wy(r,e);return n}function hd(t,e){if(e._queryParams.loadsAllData())return Hi(t);{const r=e._queryIdentifier;return t.views.get(r)}}function fd(t,e){return hd(t,e)!=null}function vt(t){return Hi(t)!=null}function Hi(t){for(const e of t.views.values())if(e.query._queryParams.loadsAllData())return e;return null}let wi;function Py(t){D(!wi,"__referenceConstructor has already been defined"),wi=t}function Ay(){return D(wi,"Reference.ts has not been loaded"),wi}let Ny=1;class Tc{constructor(e){this.listenProvider_=e,this.syncPointTree_=new oe(null),this.pendingWriteTree_=oy(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function Oy(t,e,n,r,i){return K_(t.pendingWriteTree_,e,n,r,i),i?Cr(t,new Ft(Zu(),e,n)):[]}function Zt(t,e,n=!1){const r=Y_(t.pendingWriteTree_,e);if(J_(t.pendingWriteTree_,e)){let s=new oe(null);return r.snap!=null?s=s.set(Z(),!0):Se(r.children,o=>{s=s.set(new ie(o),!0)}),Cr(t,new gi(r.path,s,n))}else return[]}function Ir(t,e,n){return Cr(t,new Ft(Uo(),e,n))}function Dy(t,e,n){const r=oe.fromObject(n);return Cr(t,new sr(Uo(),e,r))}function xy(t,e){return Cr(t,new ir(Uo(),e))}function My(t,e,n){const r=Ho(t,n);if(r){const i=jo(r),s=i.path,o=i.queryId,a=be(s,e),c=new ir(Wo(o),a);return $o(t,s,c)}else return[]}function pd(t,e,n,r,i=!1){const s=e._path,o=t.syncPointTree_.get(s);let a=[];if(o&&(e._queryIdentifier==="default"||fd(o,e))){const c=ky(o,e,n,r);Ty(o)&&(t.syncPointTree_=t.syncPointTree_.remove(s));const l=c.removed;if(a=c.events,!i){const u=l.findIndex(h=>h._queryParams.loadsAllData())!==-1,d=t.syncPointTree_.findOnPath(s,(h,p)=>vt(p));if(u&&!d){const h=t.syncPointTree_.subtree(s);if(!h.isEmpty()){const p=Wy(h);for(let f=0;f<p.length;++f){const I=p[f],g=I.query,T=vd(t,I);t.listenProvider_.startListening(jn(g),or(t,g),T.hashFn,T.onComplete)}}}!d&&l.length>0&&!r&&(u?t.listenProvider_.stopListening(jn(e),null):l.forEach(h=>{const p=t.queryToTagMap.get(ji(h));t.listenProvider_.stopListening(jn(h),p)}))}Vy(t,l)}return a}function gd(t,e,n,r){const i=Ho(t,r);if(i!=null){const s=jo(i),o=s.path,a=s.queryId,c=be(o,e),l=new Ft(Wo(a),c,n);return $o(t,o,l)}else return[]}function Ly(t,e,n,r){const i=Ho(t,r);if(i){const s=jo(i),o=s.path,a=s.queryId,c=be(o,e),l=oe.fromObject(n),u=new sr(Wo(a),c,l);return $o(t,o,u)}else return[]}function Fy(t,e,n,r=!1){const i=e._path;let s=null,o=!1;t.syncPointTree_.foreachOnPath(i,(h,p)=>{const f=be(h,i);s=s||mt(p,f),o=o||vt(p)});let a=t.syncPointTree_.get(i);a?(o=o||vt(a),s=s||mt(a,Z())):(a=new ld,t.syncPointTree_=t.syncPointTree_.set(i,a));let c;s!=null?c=!0:(c=!1,s=j.EMPTY_NODE,t.syncPointTree_.subtree(i).foreachChild((p,f)=>{const I=mt(f,Z());I&&(s=s.updateImmediateChild(p,I))}));const l=fd(a,e);if(!l&&!e._queryParams.loadsAllData()){const h=ji(e);D(!t.queryToTagMap.has(h),"View does not exist, but we have a tag");const p=By();t.queryToTagMap.set(h,p),t.tagToQueryMap.set(p,h)}const u=zi(t.pendingWriteTree_,i);let d=Ry(a,e,n,u,s,c);if(!l&&!o&&!r){const h=hd(a,e);d=d.concat(qy(t,e,h))}return d}function md(t,e,n){const i=t.pendingWriteTree_,s=t.syncPointTree_.findOnPath(e,(o,a)=>{const c=be(o,e),l=mt(a,c);if(l)return l});return rd(i,e,s,n,!0)}function Uy(t,e){const n=e._path;let r=null;t.syncPointTree_.foreachOnPath(n,(l,u)=>{const d=be(l,n);r=r||mt(u,d)});let i=t.syncPointTree_.get(n);i?r=r||mt(i,Z()):(i=new ld,t.syncPointTree_=t.syncPointTree_.set(n,i));const s=r!=null,o=s?new yt(r,!0,!1):null,a=zi(t.pendingWriteTree_,e._path),c=ud(i,e,a,s?o.getNode():j.EMPTY_NODE,s);return by(c)}function Cr(t,e){return _d(e,t.syncPointTree_,null,zi(t.pendingWriteTree_,Z()))}function _d(t,e,n,r){if(J(t.path))return yd(t,e,n,r);{const i=e.get(Z());n==null&&i!=null&&(n=mt(i,Z()));let s=[];const o=X(t.path),a=t.operationForChild(o),c=e.children.get(o);if(c&&a){const l=n?n.getImmediateChild(o):null,u=id(r,o);s=s.concat(_d(a,c,l,u))}return i&&(s=s.concat(zo(i,t,r,n))),s}}function yd(t,e,n,r){const i=e.get(Z());n==null&&i!=null&&(n=mt(i,Z()));let s=[];return e.children.inorderTraversal((o,a)=>{const c=n?n.getImmediateChild(o):null,l=id(r,o),u=t.operationForChild(o);u&&(s=s.concat(yd(u,a,c,l)))}),i&&(s=s.concat(zo(i,t,r,n))),s}function vd(t,e){const n=e.query,r=or(t,n);return{hashFn:()=>(vy(e)||j.EMPTY_NODE).hash(),onComplete:i=>{if(i==="ok")return r?My(t,n._path,r):xy(t,n._path);{const s=Lm(i,n);return pd(t,n,null,s)}}}}function or(t,e){const n=ji(e);return t.queryToTagMap.get(n)}function ji(t){return t._path.toString()+"$"+t._queryIdentifier}function Ho(t,e){return t.tagToQueryMap.get(e)}function jo(t){const e=t.indexOf("$");return D(e!==-1&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new ie(t.substr(0,e))}}function $o(t,e,n){const r=t.syncPointTree_.get(e);D(r,"Missing sync point for query tag that we're tracking");const i=zi(t.pendingWriteTree_,e);return zo(r,n,i,null)}function Wy(t){return t.fold((e,n,r)=>{if(n&&vt(n))return[Hi(n)];{let i=[];return n&&(i=dd(n)),Se(r,(s,o)=>{i=i.concat(o)}),i}})}function jn(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?new(Ay())(t._repo,t._path):t}function Vy(t,e){for(let n=0;n<e.length;++n){const r=e[n];if(!r._queryParams.loadsAllData()){const i=ji(r),s=t.queryToTagMap.get(i);t.queryToTagMap.delete(i),t.tagToQueryMap.delete(s)}}}function By(){return Ny++}function qy(t,e,n){const r=e._path,i=or(t,e),s=vd(t,n),o=t.listenProvider_.startListening(jn(e),i,s.hashFn,s.onComplete),a=t.syncPointTree_.subtree(r);if(i)D(!vt(a.value),"If we're adding a query, it shouldn't be shadowed");else{const c=a.fold((l,u,d)=>{if(!J(l)&&u&&vt(u))return[Hi(u).query];{let h=[];return u&&(h=h.concat(dd(u).map(p=>p.query))),Se(d,(p,f)=>{h=h.concat(f)}),h}});for(let l=0;l<c.length;++l){const u=c[l];t.listenProvider_.stopListening(jn(u),or(t,u))}}return o}class Go{constructor(e){this.node_=e}getImmediateChild(e){const n=this.node_.getImmediateChild(e);return new Go(n)}node(){return this.node_}}class Qo{constructor(e,n){this.syncTree_=e,this.path_=n}getImmediateChild(e){const n=de(this.path_,e);return new Qo(this.syncTree_,n)}node(){return md(this.syncTree_,this.path_)}}const zy=function(t){return t=t||{},t.timestamp=t.timestamp||new Date().getTime(),t},Rc=function(t,e,n){if(!t||typeof t!="object")return t;if(D(".sv"in t,"Unexpected leaf node or priority contents"),typeof t[".sv"]=="string")return Hy(t[".sv"],e,n);if(typeof t[".sv"]=="object")return jy(t[".sv"],e);D(!1,"Unexpected server value: "+JSON.stringify(t,null,2))},Hy=function(t,e,n){if(t==="timestamp")return n.timestamp;D(!1,"Unexpected server value: "+t)},jy=function(t,e,n){t.hasOwnProperty("increment")||D(!1,"Unexpected server value: "+JSON.stringify(t,null,2));const r=t.increment;typeof r!="number"&&D(!1,"Unexpected increment value: "+r);const i=e.node();if(D(i!==null&&typeof i<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return r;const o=i.getValue();return typeof o!="number"?r:o+r},$y=function(t,e,n,r){return Ko(e,new Qo(n,t),r)},Gy=function(t,e,n){return Ko(t,new Go(e),n)};function Ko(t,e,n){const r=t.getPriority().val(),i=Rc(r,e.getImmediateChild(".priority"),n);let s;if(t.isLeafNode()){const o=t,a=Rc(o.getValue(),e,n);return a!==o.getValue()||i!==o.getPriority().val()?new fe(a,_e(i)):t}else{const o=t;return s=o,i!==o.getPriority().val()&&(s=s.updatePriority(new fe(i))),o.forEachChild(ce,(a,c)=>{const l=Ko(c,e.getImmediateChild(a),n);l!==c&&(s=s.updateImmediateChild(a,l))}),s}}class Yo{constructor(e="",n=null,r={children:{},childCount:0}){this.name=e,this.parent=n,this.node=r}}function Jo(t,e){let n=e instanceof ie?e:new ie(e),r=t,i=X(n);for(;i!==null;){const s=an(r.node.children,i)||{children:{},childCount:0};r=new Yo(i,r,s),n=se(n),i=X(n)}return r}function In(t){return t.node.value}function bd(t,e){t.node.value=e,Ks(t)}function wd(t){return t.node.childCount>0}function Qy(t){return In(t)===void 0&&!wd(t)}function $i(t,e){Se(t.node.children,(n,r)=>{e(new Yo(n,t,r))})}function Ed(t,e,n,r){n&&e(t),$i(t,i=>{Ed(i,e,!0)})}function Ky(t,e,n){let r=t.parent;for(;r!==null;){if(e(r))return!0;r=r.parent}return!1}function Sr(t){return new ie(t.parent===null?t.name:Sr(t.parent)+"/"+t.name)}function Ks(t){t.parent!==null&&Yy(t.parent,t.name,t)}function Yy(t,e,n){const r=Qy(n),i=nt(t.node.children,e);r&&i?(delete t.node.children[e],t.node.childCount--,Ks(t)):!r&&!i&&(t.node.children[e]=n.node,t.node.childCount++,Ks(t))}const Jy=/[\[\].#$\/\u0000-\u001F\u007F]/,Xy=/[\[\].#$\u0000-\u001F\u007F]/,ys=10*1024*1024,Id=function(t){return typeof t=="string"&&t.length!==0&&!Jy.test(t)},Cd=function(t){return typeof t=="string"&&t.length!==0&&!Xy.test(t)},Zy=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),Cd(t)},Sd=function(t,e,n){const r=n instanceof ie?new g_(n,t):n;if(e===void 0)throw new Error(t+"contains undefined "+At(r));if(typeof e=="function")throw new Error(t+"contains a function "+At(r)+" with contents = "+e.toString());if(bu(e))throw new Error(t+"contains "+e.toString()+" "+At(r));if(typeof e=="string"&&e.length>ys/3&&Li(e)>ys)throw new Error(t+"contains a string greater than "+ys+" utf8 bytes "+At(r)+" ('"+e.substring(0,50)+"...')");if(e&&typeof e=="object"){let i=!1,s=!1;if(Se(e,(o,a)=>{if(o===".value")i=!0;else if(o!==".priority"&&o!==".sv"&&(s=!0,!Id(o)))throw new Error(t+" contains an invalid key ("+o+") "+At(r)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);m_(r,o),Sd(t,a,r),__(r)}),i&&s)throw new Error(t+' contains ".value" child '+At(r)+" in addition to actual children.")}},Td=function(t,e,n,r){if(!Cd(n))throw new Error(Nl(t,e)+'was an invalid path = "'+n+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},ev=function(t,e,n,r){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),Td(t,e,n)},tv=function(t,e){const n=e.path.toString();if(typeof e.repoInfo.host!="string"||e.repoInfo.host.length===0||!Id(e.repoInfo.namespace)&&e.repoInfo.host.split(":")[0]!=="localhost"||n.length!==0&&!Zy(n))throw new Error(Nl(t,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};class nv{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function rv(t,e){let n=null;for(let r=0;r<e.length;r++){const i=e[r],s=i.getPath();n!==null&&!Hu(s,n.path)&&(t.eventLists_.push(n),n=null),n===null&&(n={events:[],path:s}),n.events.push(i)}n&&t.eventLists_.push(n)}function St(t,e,n){rv(t,n),iv(t,r=>Me(r,e)||Me(e,r))}function iv(t,e){t.recursionDepth_++;let n=!0;for(let r=0;r<t.eventLists_.length;r++){const i=t.eventLists_[r];if(i){const s=i.path;e(s)?(sv(t.eventLists_[r]),t.eventLists_[r]=null):n=!1}}n&&(t.eventLists_=[]),t.recursionDepth_--}function sv(t){for(let e=0;e<t.events.length;e++){const n=t.events[e];if(n!==null){t.events[e]=null;const r=n.getEventRunner();Bn&&ve("event: "+n.toString()),wr(r)}}}const ov="repo_interrupt",av=25;class cv{constructor(e,n,r,i){this.repoInfo_=e,this.forceRestClient_=n,this.authTokenProvider_=r,this.appCheckProvider_=i,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new nv,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=pi(),this.transactionQueueTree_=new Yo,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function lv(t,e,n){if(t.stats_=Oo(t.repoInfo_),t.forceRestClient_||Vm())t.server_=new fi(t.repoInfo_,(r,i,s,o)=>{kc(t,r,i,s,o)},t.authTokenProvider_,t.appCheckProvider_),setTimeout(()=>Pc(t,!0),0);else{if(typeof n<"u"&&n!==null){if(typeof n!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{ue(n)}catch(r){throw new Error("Invalid authOverride provided: "+r)}}t.persistentConnection_=new Ye(t.repoInfo_,e,(r,i,s,o)=>{kc(t,r,i,s,o)},r=>{Pc(t,r)},r=>{dv(t,r)},t.authTokenProvider_,t.appCheckProvider_,n),t.server_=t.persistentConnection_}t.authTokenProvider_.addTokenChangeListener(r=>{t.server_.refreshAuthToken(r)}),t.appCheckProvider_.addTokenChangeListener(r=>{t.server_.refreshAppCheckToken(r.token)}),t.statsReporter_=jm(t.repoInfo_,()=>new z_(t.stats_,t.server_)),t.infoData_=new U_,t.infoSyncTree_=new Tc({startListening:(r,i,s,o)=>{let a=[];const c=t.infoData_.getNode(r._path);return c.isEmpty()||(a=Ir(t.infoSyncTree_,r._path,c),setTimeout(()=>{o("ok")},0)),a},stopListening:()=>{}}),Xo(t,"connected",!1),t.serverSyncTree_=new Tc({startListening:(r,i,s,o)=>(t.server_.listen(r,s,i,(a,c)=>{const l=o(a,c);St(t.eventQueue_,r._path,l)}),[]),stopListening:(r,i)=>{t.server_.unlisten(r,i)}})}function uv(t){const n=t.infoData_.getNode(new ie(".info/serverTimeOffset")).val()||0;return new Date().getTime()+n}function Rd(t){return zy({timestamp:uv(t)})}function kc(t,e,n,r,i){t.dataUpdateCount++;const s=new ie(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;let o=[];if(i)if(r){const c=ni(n,l=>_e(l));o=Ly(t.serverSyncTree_,s,c,i)}else{const c=_e(n);o=gd(t.serverSyncTree_,s,c,i)}else if(r){const c=ni(n,l=>_e(l));o=Dy(t.serverSyncTree_,s,c)}else{const c=_e(n);o=Ir(t.serverSyncTree_,s,c)}let a=s;o.length>0&&(a=ta(t,s)),St(t.eventQueue_,a,o)}function Pc(t,e){Xo(t,"connected",e),e===!1&&pv(t)}function dv(t,e){Se(e,(n,r)=>{Xo(t,n,r)})}function Xo(t,e,n){const r=new ie("/.info/"+e),i=_e(n);t.infoData_.updateSnapshot(r,i);const s=Ir(t.infoSyncTree_,r,i);St(t.eventQueue_,r,s)}function hv(t){return t.nextWriteId_++}function fv(t,e,n){const r=Uy(t.serverSyncTree_,e);return r!=null?Promise.resolve(r):t.server_.get(e).then(i=>{const s=_e(i).withIndex(e._queryParams.getIndex());Fy(t.serverSyncTree_,e,n,!0);let o;if(e._queryParams.loadsAllData())o=Ir(t.serverSyncTree_,e._path,s);else{const a=or(t.serverSyncTree_,e);o=gd(t.serverSyncTree_,e._path,s,a)}return St(t.eventQueue_,e._path,o),pd(t.serverSyncTree_,e,n,null,!0),s},i=>(Zo(t,"get for query "+ue(e)+" failed: "+i),Promise.reject(new Error(i))))}function pv(t){Zo(t,"onDisconnectEvents");const e=Rd(t),n=pi();Hs(t.onDisconnect_,Z(),(i,s)=>{const o=$y(i,s,t.serverSyncTree_,e);Xu(n,i,o)});let r=[];Hs(n,Z(),(i,s)=>{r=r.concat(Ir(t.serverSyncTree_,i,s));const o=yv(t,i);ta(t,o)}),t.onDisconnect_=pi(),St(t.eventQueue_,Z(),r)}function gv(t){t.persistentConnection_&&t.persistentConnection_.interrupt(ov)}function Zo(t,...e){let n="";t.persistentConnection_&&(n=t.persistentConnection_.id+":"),ve(n,...e)}function kd(t,e,n){return md(t.serverSyncTree_,e,n)||j.EMPTY_NODE}function ea(t,e=t.transactionQueueTree_){if(e||Gi(t,e),In(e)){const n=Ad(t,e);D(n.length>0,"Sending zero length transaction queue"),n.every(i=>i.status===0)&&mv(t,Sr(e),n)}else wd(e)&&$i(e,n=>{ea(t,n)})}function mv(t,e,n){const r=n.map(l=>l.currentWriteId),i=kd(t,e,r);let s=i;const o=i.hash();for(let l=0;l<n.length;l++){const u=n[l];D(u.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),u.status=1,u.retryCount++;const d=be(e,u.path);s=s.updateChild(d,u.currentOutputSnapshotRaw)}const a=s.val(!0),c=e;t.server_.put(c.toString(),a,l=>{Zo(t,"transaction put response",{path:c.toString(),status:l});let u=[];if(l==="ok"){const d=[];for(let h=0;h<n.length;h++)n[h].status=2,u=u.concat(Zt(t.serverSyncTree_,n[h].currentWriteId)),n[h].onComplete&&d.push(()=>n[h].onComplete(null,!0,n[h].currentOutputSnapshotResolved)),n[h].unwatcher();Gi(t,Jo(t.transactionQueueTree_,e)),ea(t,t.transactionQueueTree_),St(t.eventQueue_,e,u);for(let h=0;h<d.length;h++)wr(d[h])}else{if(l==="datastale")for(let d=0;d<n.length;d++)n[d].status===3?n[d].status=4:n[d].status=0;else{Re("transaction at "+c.toString()+" failed: "+l);for(let d=0;d<n.length;d++)n[d].status=4,n[d].abortReason=l}ta(t,e)}},o)}function ta(t,e){const n=Pd(t,e),r=Sr(n),i=Ad(t,n);return _v(t,i,r),r}function _v(t,e,n){if(e.length===0)return;const r=[];let i=[];const o=e.filter(a=>a.status===0).map(a=>a.currentWriteId);for(let a=0;a<e.length;a++){const c=e[a],l=be(n,c.path);let u=!1,d;if(D(l!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),c.status===4)u=!0,d=c.abortReason,i=i.concat(Zt(t.serverSyncTree_,c.currentWriteId,!0));else if(c.status===0)if(c.retryCount>=av)u=!0,d="maxretry",i=i.concat(Zt(t.serverSyncTree_,c.currentWriteId,!0));else{const h=kd(t,c.path,o);c.currentInputSnapshot=h;const p=e[a].update(h.val());if(p!==void 0){Sd("transaction failed: Data returned ",p,c.path);let f=_e(p);typeof p=="object"&&p!=null&&nt(p,".priority")||(f=f.updatePriority(h.getPriority()));const g=c.currentWriteId,T=Rd(t),P=Gy(f,h,T);c.currentOutputSnapshotRaw=f,c.currentOutputSnapshotResolved=P,c.currentWriteId=hv(t),o.splice(o.indexOf(g),1),i=i.concat(Oy(t.serverSyncTree_,c.path,P,c.currentWriteId,c.applyLocally)),i=i.concat(Zt(t.serverSyncTree_,g,!0))}else u=!0,d="nodata",i=i.concat(Zt(t.serverSyncTree_,c.currentWriteId,!0))}St(t.eventQueue_,n,i),i=[],u&&(e[a].status=2,(function(h){setTimeout(h,Math.floor(0))})(e[a].unwatcher),e[a].onComplete&&(d==="nodata"?r.push(()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot)):r.push(()=>e[a].onComplete(new Error(d),!1,null))))}Gi(t,t.transactionQueueTree_);for(let a=0;a<r.length;a++)wr(r[a]);ea(t,t.transactionQueueTree_)}function Pd(t,e){let n,r=t.transactionQueueTree_;for(n=X(e);n!==null&&In(r)===void 0;)r=Jo(r,n),e=se(e),n=X(e);return r}function Ad(t,e){const n=[];return Nd(t,e,n),n.sort((r,i)=>r.order-i.order),n}function Nd(t,e,n){const r=In(e);if(r)for(let i=0;i<r.length;i++)n.push(r[i]);$i(e,i=>{Nd(t,i,n)})}function Gi(t,e){const n=In(e);if(n){let r=0;for(let i=0;i<n.length;i++)n[i].status!==2&&(n[r]=n[i],r++);n.length=r,bd(e,n.length>0?n:void 0)}$i(e,r=>{Gi(t,r)})}function yv(t,e){const n=Sr(Pd(t,e)),r=Jo(t.transactionQueueTree_,e);return Ky(r,i=>{vs(t,i)}),vs(t,r),Ed(r,i=>{vs(t,i)}),n}function vs(t,e){const n=In(e);if(n){const r=[];let i=[],s=-1;for(let o=0;o<n.length;o++)n[o].status===3||(n[o].status===1?(D(s===o-1,"All SENT items should be at beginning of queue."),s=o,n[o].status=3,n[o].abortReason="set"):(D(n[o].status===0,"Unexpected transaction status in abort"),n[o].unwatcher(),i=i.concat(Zt(t.serverSyncTree_,n[o].currentWriteId,!0)),n[o].onComplete&&r.push(n[o].onComplete.bind(null,new Error("set"),!1,null))));s===-1?bd(e,void 0):n.length=s+1,St(t.eventQueue_,Sr(e),i);for(let o=0;o<r.length;o++)wr(r[o])}}function vv(t){let e="";const n=t.split("/");for(let r=0;r<n.length;r++)if(n[r].length>0){let i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch{}e+="/"+i}return e}function bv(t){const e={};t.charAt(0)==="?"&&(t=t.substring(1));for(const n of t.split("&")){if(n.length===0)continue;const r=n.split("=");r.length===2?e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]):Re(`Invalid query segment '${n}' in query '${t}'`)}return e}const Ac=function(t,e){const n=wv(t),r=n.namespace;n.domain==="firebase.com"&&Ze(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!r||r==="undefined")&&n.domain!=="localhost"&&Ze("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||Nm();const i=n.scheme==="ws"||n.scheme==="wss";return{repoInfo:new Ou(n.host,n.secure,r,i,e,"",r!==n.subdomain),path:new ie(n.pathString)}},wv=function(t){let e="",n="",r="",i="",s="",o=!0,a="https",c=443;if(typeof t=="string"){let l=t.indexOf("//");l>=0&&(a=t.substring(0,l-1),t=t.substring(l+2));let u=t.indexOf("/");u===-1&&(u=t.length);let d=t.indexOf("?");d===-1&&(d=t.length),e=t.substring(0,Math.min(u,d)),u<d&&(i=vv(t.substring(u,d)));const h=bv(t.substring(Math.min(t.length,d)));l=e.indexOf(":"),l>=0?(o=a==="https"||a==="wss",c=parseInt(e.substring(l+1),10)):l=e.length;const p=e.slice(0,l);if(p.toLowerCase()==="localhost")n="localhost";else if(p.split(".").length<=2)n=p;else{const f=e.indexOf(".");r=e.substring(0,f).toLowerCase(),n=e.substring(f+1),s=r}"ns"in h&&(s=h.ns)}return{host:e,port:c,domain:n,subdomain:r,secure:o,scheme:a,pathString:i,namespace:s}};class Ev{constructor(e,n,r,i){this.eventType=e,this.eventRegistration=n,this.snapshot=r,this.prevName=i}getPath(){const e=this.snapshot.ref;return this.eventType==="value"?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+ue(this.snapshot.exportVal())}}class Iv{constructor(e,n,r){this.eventRegistration=e,this.error=n,this.path=r}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}class Cv{constructor(e,n){this.snapshotCallback=e,this.cancelCallback=n}onValue(e,n){this.snapshotCallback.call(null,e,n)}onCancel(e){return D(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}}class na{constructor(e,n,r,i){this._repo=e,this._path=n,this._queryParams=r,this._orderByCalled=i}get key(){return J(this._path)?null:Bu(this._path)}get ref(){return new rt(this._repo,this._path)}get _queryIdentifier(){const e=gc(this._queryParams),n=Ao(e);return n==="{}"?"default":n}get _queryObject(){return gc(this._queryParams)}isEqual(e){if(e=Ee(e),!(e instanceof na))return!1;const n=this._repo===e._repo,r=Hu(this._path,e._path),i=this._queryIdentifier===e._queryIdentifier;return n&&r&&i}toJSON(){return this.toString()}toString(){return this._repo.toString()+p_(this._path)}}class rt extends na{constructor(e,n){super(e,n,new Fo,!1)}get parent(){const e=zu(this._path);return e===null?null:new rt(this._repo,e)}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}}class ar{constructor(e,n,r){this._node=e,this.ref=n,this._index=r}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){const n=new ie(e),r=Ys(this.ref,e);return new ar(this._node.getChild(n),r,ce)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(r,i)=>e(new ar(i,Ys(this.ref,r),ce)))}hasChild(e){const n=new ie(e);return!this._node.getChild(n).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function ZE(t,e){return t=Ee(t),t._checkNotDeleted("ref"),e!==void 0?Ys(t._root,e):t._root}function Ys(t,e){return t=Ee(t),X(t._path)===null?ev("child","path",e):Td("child","path",e),new rt(t._repo,de(t._path,e))}function eI(t){t=Ee(t);const e=new Cv(()=>{}),n=new ra(e);return fv(t._repo,t,n).then(r=>new ar(r,new rt(t._repo,t._path),t._queryParams.getIndex()))}class ra{constructor(e){this.callbackContext=e}respondsTo(e){return e==="value"}createEvent(e,n){const r=n._queryParams.getIndex();return new Ev("value",this,new ar(e.snapshotNode,new rt(n._repo,n._path),r))}getEventRunner(e){return e.getEventType()==="cancel"?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,n){return this.callbackContext.hasCancelCallback?new Iv(this,e,n):null}matches(e){return e instanceof ra?!e.callbackContext||!this.callbackContext?!0:e.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}Cy(rt);Py(rt);const Sv="FIREBASE_DATABASE_EMULATOR_HOST",Js={};let Tv=!1;function Rv(t,e,n,r){const i=e.lastIndexOf(":"),s=e.substring(0,i),o=_n(s);t.repoInfo_=new Ou(e,o,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams,!0,n),r&&(t.authTokenProvider_=r)}function kv(t,e,n,r,i){let s=r||t.options.databaseURL;s===void 0&&(t.options.projectId||Ze("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),ve("Using default host for project ",t.options.projectId),s=`${t.options.projectId}-default-rtdb.firebaseio.com`);let o=Ac(s,i),a=o.repoInfo,c;typeof process<"u"&&Ja&&(c=Ja[Sv]),c?(s=`http://${c}?ns=${a.namespace}`,o=Ac(s,i),a=o.repoInfo):o.repoInfo.secure;const l=new qm(t.name,t.options,e);tv("Invalid Firebase Database URL",o),J(o.path)||Ze("Database URL must point to the root of a Firebase Database (not including a child path).");const u=Av(a,t,l,new Bm(t,n));return new Nv(u,t)}function Pv(t,e){const n=Js[e];(!n||n[t.key]!==t)&&Ze(`Database ${e}(${t.repoInfo_}) has already been deleted.`),gv(t),delete n[t.key]}function Av(t,e,n,r){let i=Js[e.name];i||(i={},Js[e.name]=i);let s=i[t.toURLString()];return s&&Ze("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),s=new cv(t,Tv,n,r),i[t.toURLString()]=s,s}class Nv{constructor(e,n){this._repoInternal=e,this.app=n,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(lv(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new rt(this._repo,Z())),this._rootInternal}_delete(){return this._rootInternal!==null&&(Pv(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){this._rootInternal===null&&Ze("Cannot call "+e+" on a deleted database.")}}function Ov(t=Ml(),e){const n=bo(t,"database").getImmediate({identifier:e});if(!n._instanceStarted){const r=Fh("database");r&&Dv(n,...r)}return n}function Dv(t,e,n,r={}){t=Ee(t),t._checkNotDeleted("useEmulator");const i=`${e}:${n}`,s=t._repoInternal;if(t._instanceStarted){if(i===t._repoInternal.repoInfo_.host&&Dt(r,s.repoInfo_.emulatorOptions))return;Ze("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let o;if(s.repoInfo_.nodeAdmin)r.mockUserToken&&Ze('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),o=new Jr(Jr.OWNER);else if(r.mockUserToken){const a=typeof r.mockUserToken=="string"?r.mockUserToken:Uh(r.mockUserToken,t.app.options.projectId);o=new Jr(a)}_n(e)&&(Rl(e),kl("Database",!0)),Rv(s,i,r,o)}function xv(t){Sm(vn),cn(new xt("database",(e,{instanceIdentifier:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),s=e.getProvider("app-check-internal");return kv(r,i,s,n)},"PUBLIC").setMultipleInstances(!0)),ft(Xa,Za,t),ft(Xa,Za,"esm2017")}Ye.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)};Ye.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};xv();function Mv(t){const e=xl(t),n=Im(e),r=Ov(e);return{app:e,auth:n,firebaseDb:r}}let en=null;function tI(t){if(en)return en;const e={apiKey:t.apiKey,authDomain:t.authDomain,databaseURL:t.databaseURL,projectId:t.projectId,storageBucket:t.storageBucket,messagingSenderId:t.messagingSenderId};return en=Mv(e),en}function ia(){if(!en)throw new Error("Firebase not initialized. Call initializeFirebase() first.");return en}const nI=new Proxy({},{get(t,e){return ia().auth[e]}}),rI=new Proxy({},{get(t,e){return ia().firebaseDb[e]}});function me(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Lv=typeof Symbol=="function"&&Symbol.observable||"@@observable",Nc=Lv,bs=()=>Math.random().toString(36).substring(7).split("").join("."),Fv={INIT:`@@redux/INIT${bs()}`,REPLACE:`@@redux/REPLACE${bs()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${bs()}`},Ei=Fv;function bt(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Od(t,e,n){if(typeof t!="function")throw new Error(me(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(me(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(me(1));return n(Od)(t,e)}let r=t,i=e,s=new Map,o=s,a=0,c=!1;function l(){o===s&&(o=new Map,s.forEach((g,T)=>{o.set(T,g)}))}function u(){if(c)throw new Error(me(3));return i}function d(g){if(typeof g!="function")throw new Error(me(4));if(c)throw new Error(me(5));let T=!0;l();const P=a++;return o.set(P,g),function(){if(T){if(c)throw new Error(me(6));T=!1,l(),o.delete(P),s=null}}}function h(g){if(!bt(g))throw new Error(me(7));if(typeof g.type>"u")throw new Error(me(8));if(typeof g.type!="string")throw new Error(me(17));if(c)throw new Error(me(9));try{c=!0,i=r(i,g)}finally{c=!1}return(s=o).forEach(P=>{P()}),g}function p(g){if(typeof g!="function")throw new Error(me(10));r=g,h({type:Ei.REPLACE})}function f(){const g=d;return{subscribe(T){if(typeof T!="object"||T===null)throw new Error(me(11));function P(){const b=T;b.next&&b.next(u())}return P(),{unsubscribe:g(P)}},[Nc](){return this}}}return h({type:Ei.INIT}),{dispatch:h,subscribe:d,getState:u,replaceReducer:p,[Nc]:f}}function Uv(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:Ei.INIT})>"u")throw new Error(me(12));if(typeof n(void 0,{type:Ei.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(me(13))})}function Dd(t){const e=Object.keys(t),n={};for(let s=0;s<e.length;s++){const o=e[s];typeof t[o]=="function"&&(n[o]=t[o])}const r=Object.keys(n);let i;try{Uv(n)}catch(s){i=s}return function(o={},a){if(i)throw i;let c=!1;const l={};for(let u=0;u<r.length;u++){const d=r[u],h=n[d],p=o[d],f=h(p,a);if(typeof f>"u")throw a&&a.type,new Error(me(14));l[d]=f,c=c||f!==p}return c=c||r.length!==Object.keys(o).length,c?l:o}}function Ii(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function Wv(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(me(15))};const o={getState:i.getState,dispatch:(c,...l)=>s(c,...l)},a=t.map(c=>c(o));return s=Ii(...a)(i.dispatch),{...i,dispatch:s}}}function xd(t){return bt(t)&&"type"in t&&typeof t.type=="string"}var sa=Symbol.for("immer-nothing"),$n=Symbol.for("immer-draftable"),ge=Symbol.for("immer-state");function ye(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Te=Object,Wt=Te.getPrototypeOf,cr="constructor",Tr="prototype",Xs="configurable",Ci="enumerable",Xr="writable",lr="value",ke=t=>!!t&&!!t[ge];function Pe(t){return t?Md(t)||kr(t)||!!t[$n]||!!t[cr]?.[$n]||Pr(t)||Ar(t):!1}var Vv=Te[Tr][cr].toString(),Oc=new WeakMap;function Md(t){if(!t||!fn(t))return!1;const e=Wt(t);if(e===null||e===Te[Tr])return!0;const n=Te.hasOwnProperty.call(e,cr)&&e[cr];if(n===Object)return!0;if(!Nt(n))return!1;let r=Oc.get(n);return r===void 0&&(r=Function.toString.call(n),Oc.set(n,r)),r===Vv}function Bv(t){return ke(t)||ye(15,t),t[ge].base_}function Rr(t,e,n=!0){Vt(t)===0?(n?Reflect.ownKeys(t):Te.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function Vt(t){const e=t[ge];return e?e.type_:kr(t)?1:Pr(t)?2:Ar(t)?3:0}var Gn=(t,e,n=Vt(t))=>n===2?t.has(e):Te[Tr].hasOwnProperty.call(t,e),je=(t,e,n=Vt(t))=>n===2?t.get(e):t[e],Si=(t,e,n,r=Vt(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function qv(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var kr=Array.isArray,Pr=t=>t instanceof Map,Ar=t=>t instanceof Set,fn=t=>typeof t=="object",Nt=t=>typeof t=="function",ws=t=>typeof t=="boolean";function zv(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Hv=t=>fn(t)?t?.[ge]:null,$e=t=>t.copy_||t.base_,oa=t=>t.modified_?t.copy_:t.base_;function Zs(t,e){if(Pr(t))return new Map(t);if(Ar(t))return new Set(t);if(kr(t))return Array[Tr].slice.call(t);const n=Md(t);if(e===!0||e==="class_only"&&!n){const r=Te.getOwnPropertyDescriptors(t);delete r[ge];let i=Reflect.ownKeys(r);for(let s=0;s<i.length;s++){const o=i[s],a=r[o];a[Xr]===!1&&(a[Xr]=!0,a[Xs]=!0),(a.get||a.set)&&(r[o]={[Xs]:!0,[Xr]:!0,[Ci]:a[Ci],[lr]:t[o]})}return Te.create(Wt(t),r)}else{const r=Wt(t);if(r!==null&&n)return{...t};const i=Te.create(r);return Te.assign(i,t)}}function aa(t,e=!1){return Qi(t)||ke(t)||!Pe(t)||(Vt(t)>1&&Te.defineProperties(t,{set:Fr,add:Fr,clear:Fr,delete:Fr}),Te.freeze(t),e&&Rr(t,(n,r)=>{aa(r,!0)},!1)),t}function jv(){ye(2)}var Fr={[lr]:jv};function Qi(t){return t===null||!fn(t)?!0:Te.isFrozen(t)}var Ti="MapSet",Ri="Patches",Dc="ArrayMethods",ki={};function Bt(t){const e=ki[t];return e||ye(0,t),e}var xc=t=>!!ki[t];function $v(t,e){ki[t]||(ki[t]=e)}var ur,Ld=()=>ur,Gv=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:xc(Ti)?Bt(Ti):void 0,arrayMethodsPlugin_:xc(Dc)?Bt(Dc):void 0});function Mc(t,e){e&&(t.patchPlugin_=Bt(Ri),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function eo(t){to(t),t.drafts_.forEach(Qv),t.drafts_=null}function to(t){t===ur&&(ur=t.parent_)}var Lc=t=>ur=Gv(ur,t);function Qv(t){const e=t[ge];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Fc(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[ge].modified_&&(eo(e),ye(4)),Pe(t)&&(t=Uc(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[ge].base_,t,e)}else t=Uc(e,n);return Kv(e,t,!0),eo(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==sa?t:void 0}function Uc(t,e){if(Qi(e))return e;const n=e[ge];if(!n)return Pi(e,t.handledSet_,t);if(!Ki(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);Wd(n,t)}return n.copy_}function Kv(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&aa(e,n)}function Fd(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var Ki=(t,e)=>t.scope_===e,Yv=[];function Ud(t,e,n,r){const i=$e(t),s=t.type_;if(r!==void 0&&je(i,r,s)===e){Si(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;Rr(i,(c,l)=>{if(ke(l)){const u=a.get(l)||[];u.push(c),a.set(l,u)}})}const o=t.draftLocations_.get(e)??Yv;for(const a of o)Si(i,a,n,s)}function Jv(t,e,n){t.callbacks_.push(function(i){const s=e;if(!s||!Ki(s,i))return;i.mapSetPlugin_?.fixSetContents(s);const o=oa(s);Ud(t,s.draft_??s,o,n),Wd(s,i)})}function Wd(t,e){if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){const{patchPlugin_:r}=e;if(r){const i=r.getPath(t);i&&r.generatePatches_(t,i,e)}Fd(t)}}function Xv(t,e,n){const{scope_:r}=t;if(ke(n)){const i=n[ge];Ki(i,r)&&i.callbacks_.push(function(){Zr(t);const o=oa(i);Ud(t,n,o,e)})}else Pe(n)&&t.callbacks_.push(function(){const s=$e(t);t.type_===3?s.has(n)&&Pi(n,r.handledSet_,r):je(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&Pi(je(t.copy_,e,t.type_),r.handledSet_,r)})}function Pi(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||ke(t)||e.has(t)||!Pe(t)||Qi(t)||(e.add(t),Rr(t,(r,i)=>{if(ke(i)){const s=i[ge];if(Ki(s,n)){const o=oa(s);Si(t,r,o,t.type_),Fd(s)}}else Pe(i)&&Pi(i,e,n)})),t}function Zv(t,e){const n=kr(t),r={type_:n?1:0,scope_:e?e.scope_:Ld(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=Ai;n&&(i=[r],s=dr);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var Ai={get(t,e){if(e===ge)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n?.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=$e(t);if(!Gn(i,e,t.type_))return eb(t,i,e);const s=i[e];if(t.finalized_||!Pe(s)||r&&t.operationMethod&&n?.isMutatingArrayMethod(t.operationMethod)&&zv(e))return s;if(s===Es(t.base_,e)){Zr(t);const o=t.type_===1?+e:e,a=ro(t.scope_,s,t,o);return t.copy_[o]=a}return s},has(t,e){return e in $e(t)},ownKeys(t){return Reflect.ownKeys($e(t))},set(t,e,n){const r=Vd($e(t),e);if(r?.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=Es($e(t),e),s=i?.[ge];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(qv(n,i)&&(n!==void 0||Gn(t.base_,e,t.type_)))return!0;Zr(t),no(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),Xv(t,e,n)),!0},deleteProperty(t,e){return Zr(t),Es(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),no(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=$e(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[Xr]:!0,[Xs]:t.type_!==1||e!=="length",[Ci]:r[Ci],[lr]:n[e]}},defineProperty(){ye(11)},getPrototypeOf(t){return Wt(t.base_)},setPrototypeOf(){ye(12)}},dr={};for(let t in Ai){let e=Ai[t];dr[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}dr.deleteProperty=function(t,e){return dr.set.call(this,t,e,void 0)};dr.set=function(t,e,n){return Ai.set.call(this,t[0],e,n,t[0])};function Es(t,e){const n=t[ge];return(n?$e(n):t)[e]}function eb(t,e,n){const r=Vd(e,n);return r?lr in r?r[lr]:r.get?.call(t.draft_):void 0}function Vd(t,e){if(!(e in t))return;let n=Wt(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Wt(n)}}function no(t){t.modified_||(t.modified_=!0,t.parent_&&no(t.parent_))}function Zr(t){t.copy_||(t.assigned_=new Map,t.copy_=Zs(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var tb=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,n,r)=>{if(Nt(e)&&!Nt(n)){const s=n;n=e;const o=this;return function(c=s,...l){return o.produce(c,u=>n.call(this,u,...l))}}Nt(n)||ye(6),r!==void 0&&!Nt(r)&&ye(7);let i;if(Pe(e)){const s=Lc(this),o=ro(s,e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?eo(s):to(s)}return Mc(s,r),Fc(i,s)}else if(!e||!fn(e)){if(i=n(e),i===void 0&&(i=e),i===sa&&(i=void 0),this.autoFreeze_&&aa(i,!0),r){const s=[],o=[];Bt(Ri).generateReplacementPatches_(e,i,{patches_:s,inversePatches_:o}),r(s,o)}return i}else ye(1,e)},this.produceWithPatches=(e,n)=>{if(Nt(e))return(o,...a)=>this.produceWithPatches(o,c=>e(c,...a));let r,i;return[this.produce(e,n,(o,a)=>{r=o,i=a}),r,i]},ws(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),ws(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),ws(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Pe(t)||ye(8),ke(t)&&(t=Bd(t));const e=Lc(this),n=ro(e,t,void 0);return n[ge].isManual_=!0,to(e),n}finishDraft(t,e){const n=t&&t[ge];(!n||!n.isManual_)&&ye(9);const{scope_:r}=n;return Mc(r,e),Fc(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=Bt(Ri).applyPatches_;return ke(t)?r(t,e):this.produce(t,i=>r(i,e))}};function ro(t,e,n,r){const[i,s]=Pr(e)?Bt(Ti).proxyMap_(e,n):Ar(e)?Bt(Ti).proxySet_(e,n):Zv(e,n);return(n?.scope_??Ld()).drafts_.push(i),s.callbacks_=n?.callbacks_??[],s.key_=r,n&&r!==void 0?Jv(n,s,r):s.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(s);const{patchPlugin_:l}=c;s.modified_&&l&&l.generatePatches_(s,[],c)}),i}function Bd(t){return ke(t)||ye(10,t),qd(t)}function qd(t){if(!Pe(t)||Qi(t))return t;const e=t[ge];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=Zs(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=Zs(t,!0);return Rr(n,(i,s)=>{Si(n,i,qd(s))},r),e&&(e.finalized_=!1),n}function nb(){function e(f,I=[]){if(f.key_!==void 0){const g=f.parent_.copy_??f.parent_.base_,T=Hv(je(g,f.key_)),P=je(g,f.key_);if(P===void 0||P!==f.draft_&&P!==f.base_&&P!==f.copy_||T!=null&&T.base_!==f.base_)return null;const m=f.parent_.type_===3;let b;if(m){const _=f.parent_;b=Array.from(_.drafts_.keys()).indexOf(f.key_)}else b=f.key_;if(!(m&&g.size>b||Gn(g,b)))return null;I.push(b)}if(f.parent_)return e(f.parent_,I);I.reverse();try{n(f.copy_,I)}catch{return null}return I}function n(f,I){let g=f;for(let T=0;T<I.length-1;T++){const P=I[T];if(g=je(g,P),!fn(g)||g===null)throw new Error(`Cannot resolve path at '${I.join("/")}'`)}return g}const r="replace",i="add",s="remove";function o(f,I,g){if(f.scope_.processedForPatches_.has(f))return;f.scope_.processedForPatches_.add(f);const{patches_:T,inversePatches_:P}=g;switch(f.type_){case 0:case 2:return c(f,I,T,P);case 1:return a(f,I,T,P);case 3:return l(f,I,T,P)}}function a(f,I,g,T){let{base_:P,assigned_:m}=f,b=f.copy_;b.length<P.length&&([P,b]=[b,P],[g,T]=[T,g]);const _=f.allIndicesReassigned_===!0;for(let v=0;v<P.length;v++){const S=b[v],w=P[v];if((_||m?.get(v.toString()))&&S!==w){const C=S?.[ge];if(C&&C.modified_)continue;const y=I.concat([v]);g.push({op:r,path:y,value:p(S)}),T.push({op:r,path:y,value:p(w)})}}for(let v=P.length;v<b.length;v++){const S=I.concat([v]);g.push({op:i,path:S,value:p(b[v])})}for(let v=b.length-1;P.length<=v;--v){const S=I.concat([v]);T.push({op:s,path:S})}}function c(f,I,g,T){const{base_:P,copy_:m,type_:b}=f;Rr(f.assigned_,(_,v)=>{const S=je(P,_,b),w=je(m,_,b),R=v?Gn(P,_)?r:i:s;if(S===w&&R===r)return;const C=I.concat(_);g.push(R===s?{op:R,path:C}:{op:R,path:C,value:p(w)}),T.push(R===i?{op:s,path:C}:R===s?{op:i,path:C,value:p(S)}:{op:r,path:C,value:p(S)})})}function l(f,I,g,T){let{base_:P,copy_:m}=f,b=0;P.forEach(_=>{if(!m.has(_)){const v=I.concat([b]);g.push({op:s,path:v,value:_}),T.unshift({op:i,path:v,value:_})}b++}),b=0,m.forEach(_=>{if(!P.has(_)){const v=I.concat([b]);g.push({op:i,path:v,value:_}),T.unshift({op:s,path:v,value:_})}b++})}function u(f,I,g){const{patches_:T,inversePatches_:P}=g;T.push({op:r,path:[],value:I===sa?void 0:I}),P.push({op:r,path:[],value:f})}function d(f,I){return I.forEach(g=>{const{path:T,op:P}=g;let m=f;for(let S=0;S<T.length-1;S++){const w=Vt(m);let R=T[S];typeof R!="string"&&typeof R!="number"&&(R=""+R),(w===0||w===1)&&(R==="__proto__"||R===cr)&&ye(19),Nt(m)&&R===Tr&&ye(19),m=je(m,R),fn(m)||ye(18,T.join("/"))}const b=Vt(m),_=h(g.value),v=T[T.length-1];switch(P){case r:switch(b){case 2:return m.set(v,_);case 3:ye(16);default:return m[v]=_}case i:switch(b){case 1:return v==="-"?m.push(_):m.splice(v,0,_);case 2:return m.set(v,_);case 3:return m.add(_);default:return m[v]=_}case s:switch(b){case 1:return m.splice(v,1);case 2:return m.delete(v);case 3:return m.delete(g.value);default:return delete m[v]}default:ye(17,P)}}),f}function h(f){if(!Pe(f))return f;if(kr(f))return f.map(h);if(Pr(f))return new Map(Array.from(f.entries()).map(([g,T])=>[g,h(T)]));if(Ar(f))return new Set(Array.from(f).map(h));const I=Object.create(Wt(f));for(const g in f)I[g]=h(f[g]);return Gn(f,$n)&&(I[$n]=f[$n]),I}function p(f){return ke(f)?h(f):f}$v(Ri,{applyPatches_:d,generatePatches_:o,generateReplacementPatches_:u,getPath:e})}var hr=new tb,Nr=hr.produce,zd=hr.produceWithPatches.bind(hr),Wc=hr.applyPatches.bind(hr);function rb(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function ib(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function sb(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var Vc=t=>Array.isArray(t)?t:[t];function ob(t){const e=Array.isArray(t[0])?t[0]:t;return sb(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function ab(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}var cb=class{constructor(t){this.value=t}deref(){return this.value}},lb=typeof WeakRef<"u"?WeakRef:cb,ub=0,Bc=1;function Ur(){return{s:ub,v:void 0,o:null,p:null}}function Ni(t,e={}){let n=Ur();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=n;const{length:c}=arguments;for(let d=0,h=c;d<h;d++){const p=arguments[d];if(typeof p=="function"||typeof p=="object"&&p!==null){let f=a.o;f===null&&(a.o=f=new WeakMap);const I=f.get(p);I===void 0?(a=Ur(),f.set(p,a)):a=I}else{let f=a.p;f===null&&(a.p=f=new Map);const I=f.get(p);I===void 0?(a=Ur(),f.set(p,a)):a=I}}const l=a;let u;if(a.s===Bc)u=a.v;else if(u=t.apply(null,arguments),s++,r){const d=i?.deref?.()??i;d!=null&&r(d,u)&&(u=d,s!==0&&s--),i=typeof u=="object"&&u!==null||typeof u=="function"?new lb(u):u}return l.s=Bc,l.v=u,u}return o.clearCache=()=>{n=Ur(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function db(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,a,c={},l=i.pop();typeof l=="object"&&(c=l,l=i.pop()),rb(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const u={...n,...c},{memoize:d,memoizeOptions:h=[],argsMemoize:p=Ni,argsMemoizeOptions:f=[]}=u,I=Vc(h),g=Vc(f),T=ob(i),P=d(function(){return s++,l.apply(null,arguments)},...I),m=p(function(){o++;const _=ab(T,arguments);return a=P.apply(null,_),a},...g);return Object.assign(m,{resultFunc:l,memoizedResultFunc:P,dependencies:T,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var ca=db(Ni),hb=Object.assign((t,e=ca)=>{ib(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(s=>t[s]);return e(r,(...s)=>s.reduce((o,a,c)=>(o[n[c]]=a,o),{}))},{withTypes:()=>hb});function Hd(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var fb=Hd(),pb=Hd,gb=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ii:Ii.apply(null,arguments)},mb=t=>t&&typeof t.match=="function";function Ue(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(Ae(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>xd(r)&&r.type===t,n}var jd=class Ln extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Ln.prototype)}static get[Symbol.species](){return Ln}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new Ln(...e[0].concat(this)):new Ln(...e.concat(this))}};function qc(t){return Pe(t)?Nr(t,()=>{}):t}function Wr(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function _b(t){return typeof t=="boolean"}var yb=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new jd;return n&&(_b(n)?o.push(fb):o.push(pb(n.extraArgument))),o},Yi="RTK_autoBatch",An=()=>t=>({payload:t,meta:{[Yi]:!0}}),zc=t=>e=>{setTimeout(e,t)},vb=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const a=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:zc(10):t.type==="callback"?t.queueNotification:zc(t.timeout),l=()=>{o=!1,s&&(s=!1,a.forEach(u=>u()))};return Object.assign({},r,{subscribe(u){const d=()=>i&&u(),h=r.subscribe(d);return a.add(u),()=>{h(),a.delete(u)}},dispatch(u){try{return i=!u?.meta?.[Yi],s=!i,s&&(o||(o=!0,c(l))),r.dispatch(u)}finally{i=!0}}})},bb=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new jd(t);return r&&i.push(vb(typeof r=="object"?r:void 0)),i};function iI(t){const e=yb(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(bt(n))a=Dd(n);else throw new Error(Ae(1));let c;typeof r=="function"?c=r(e):c=e();let l=Ii;i&&(l=gb({trace:!1,...typeof i=="object"&&i}));const u=Wv(...c),d=bb(u);let h=typeof o=="function"?o(d):d();const p=l(...h);return Od(a,s,p)}function $d(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(Ae(28));if(a in e)throw new Error(Ae(29));return e[a]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function wb(t){return typeof t=="function"}function Eb(t,e){let[n,r,i]=$d(e),s;if(wb(t))s=()=>qc(t());else{const a=qc(t);s=()=>a}function o(a=s(),c){let l=[n[c.type],...r.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return l.filter(u=>!!u).length===0&&(l=[i]),l.reduce((u,d)=>{if(d)if(ke(u)){const p=d(u,c);return p===void 0?u:p}else{if(Pe(u))return Nr(u,h=>d(h,c));{const h=d(u,c);if(h===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return h}}return u},a)}return o.getInitialState=s,o}var Gd=(t,e)=>mb(t)?t.match(e):t(e);function et(...t){return e=>t.some(n=>Gd(n,e))}function Qn(...t){return e=>t.every(n=>Gd(n,e))}function Ji(t,e){if(!t||!t.meta)return!1;const n=typeof t.meta.requestId=="string",r=e.indexOf(t.meta.requestStatus)>-1;return n&&r}function Or(t){return typeof t[0]=="function"&&"pending"in t[0]&&"fulfilled"in t[0]&&"rejected"in t[0]}function la(...t){return t.length===0?e=>Ji(e,["pending"]):Or(t)?et(...t.map(e=>e.pending)):la()(t[0])}function pn(...t){return t.length===0?e=>Ji(e,["rejected"]):Or(t)?et(...t.map(e=>e.rejected)):pn()(t[0])}function Xi(...t){const e=n=>n&&n.meta&&n.meta.rejectedWithValue;return t.length===0?Qn(pn(...t),e):Or(t)?Qn(pn(...t),e):Xi()(t[0])}function wt(...t){return t.length===0?e=>Ji(e,["fulfilled"]):Or(t)?et(...t.map(e=>e.fulfilled)):wt()(t[0])}function io(...t){return t.length===0?e=>Ji(e,["pending","fulfilled","rejected"]):Or(t)?et(...t.flatMap(e=>[e.pending,e.rejected,e.fulfilled])):io()(t[0])}var Ib="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ua=(t=21)=>{let e="",n=t;for(;n--;)e+=Ib[Math.random()*64|0];return e},Cb=["name","message","stack","code"],Is=class{constructor(t,e){this.payload=t,this.meta=e}_type},Hc=class{constructor(t,e){this.payload=t,this.meta=e}_type},Sb=t=>{if(typeof t=="object"&&t!==null){const e={};for(const n of Cb)typeof t[n]=="string"&&(e[n]=t[n]);return e}return{message:String(t)}},jc="External signal was aborted",$c=(()=>{function t(e,n,r){const i=Ue(e+"/fulfilled",(c,l,u,d)=>({payload:c,meta:{...d||{},arg:u,requestId:l,requestStatus:"fulfilled"}})),s=Ue(e+"/pending",(c,l,u)=>({payload:void 0,meta:{...u||{},arg:l,requestId:c,requestStatus:"pending"}})),o=Ue(e+"/rejected",(c,l,u,d,h)=>({payload:d,error:(r&&r.serializeError||Sb)(c||"Rejected"),meta:{...h||{},arg:u,requestId:l,rejectedWithValue:!!d,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function a(c,{signal:l}={}){return(u,d,h)=>{const p=r?.idGenerator?r.idGenerator(c):ua(),f=new AbortController;let I,g;function T(m){g=m,f.abort()}l&&(l.aborted?T(jc):l.addEventListener("abort",()=>T(jc),{once:!0}));const P=(async function(){let m;try{let _=r?.condition?.(c,{getState:d,extra:h});if(Rb(_)&&(_=await _),_===!1||f.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const v=new Promise((S,w)=>{I=()=>{w({name:"AbortError",message:g||"Aborted"})},f.signal.addEventListener("abort",I,{once:!0})});u(s(p,c,r?.getPendingMeta?.({requestId:p,arg:c},{getState:d,extra:h}))),m=await Promise.race([v,Promise.resolve(n(c,{dispatch:u,getState:d,extra:h,requestId:p,signal:f.signal,abort:T,rejectWithValue:(S,w)=>new Is(S,w),fulfillWithValue:(S,w)=>new Hc(S,w)})).then(S=>{if(S instanceof Is)throw S;return S instanceof Hc?i(S.payload,p,c,S.meta):i(S,p,c)})])}catch(_){m=_ instanceof Is?o(null,p,c,_.payload,_.meta):o(_,p,c)}finally{I&&f.signal.removeEventListener("abort",I)}return r&&!r.dispatchConditionRejection&&o.match(m)&&m.meta.condition||u(m),m})();return Object.assign(P,{abort:T,requestId:p,arg:c,unwrap(){return P.then(Tb)}})}}return Object.assign(a,{pending:s,rejected:o,fulfilled:i,settled:et(o,i),typePrefix:e})}return t.withTypes=()=>t,t})();function Tb(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function Rb(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var kb=Symbol.for("rtk-slice-createasyncthunk");function Pb(t,e){return`${t}/${e}`}function Ab({creators:t}={}){const e=t?.asyncThunk?.[kb];return function(r){const{name:i,reducerPath:s=i}=r;if(!i)throw new Error(Ae(11));const o=(typeof r.reducers=="function"?r.reducers(Ob()):r.reducers)||{},a=Object.keys(o),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},l={addCase(m,b){const _=typeof m=="string"?m:m.type;if(!_)throw new Error(Ae(12));if(_ in c.sliceCaseReducersByType)throw new Error(Ae(13));return c.sliceCaseReducersByType[_]=b,l},addMatcher(m,b){return c.sliceMatchers.push({matcher:m,reducer:b}),l},exposeAction(m,b){return c.actionCreators[m]=b,l},exposeCaseReducer(m,b){return c.sliceCaseReducersByName[m]=b,l}};a.forEach(m=>{const b=o[m],_={reducerName:m,type:Pb(i,m),createNotation:typeof r.reducers=="function"};xb(b)?Lb(_,b,l,e):Db(_,b,l)});function u(){const[m={},b=[],_=void 0]=typeof r.extraReducers=="function"?$d(r.extraReducers):[r.extraReducers],v={...m,...c.sliceCaseReducersByType};return Eb(r.initialState,S=>{for(let w in v)S.addCase(w,v[w]);for(let w of c.sliceMatchers)S.addMatcher(w.matcher,w.reducer);for(let w of b)S.addMatcher(w.matcher,w.reducer);_&&S.addDefaultCase(_)})}const d=m=>m,h=new Map,p=new WeakMap;let f;function I(m,b){return f||(f=u()),f(m,b)}function g(){return f||(f=u()),f.getInitialState()}function T(m,b=!1){function _(S){let w=S[m];return typeof w>"u"&&b&&(w=Wr(p,_,g)),w}function v(S=d){const w=Wr(h,b,()=>new WeakMap);return Wr(w,S,()=>{const R={};for(const[C,y]of Object.entries(r.selectors??{}))R[C]=Nb(y,S,()=>Wr(p,S,g),b);return R})}return{reducerPath:m,getSelectors:v,get selectors(){return v(_)},selectSlice:_}}const P={name:i,reducer:I,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:g,...T(s),injectInto(m,{reducerPath:b,..._}={}){const v=b??s;return m.inject({reducerPath:v,reducer:I},_),{...P,...T(v,!0)}}};return P}}function Nb(t,e,n,r){function i(s,...o){let a=e(s);return typeof a>"u"&&r&&(a=n()),t(a,...o)}return i.unwrapped=t,i}var Qt=Ab();function Ob(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function Db({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!Mb(r))throw new Error(Ae(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Ue(t,o):Ue(t))}function xb(t){return t._reducerDefinitionType==="asyncThunk"}function Mb(t){return t._reducerDefinitionType==="reducerWithPrepare"}function Lb({type:t,reducerName:e},n,r,i){if(!i)throw new Error(Ae(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:c,settled:l,options:u}=n,d=i(t,s,u);r.exposeAction(e,d),o&&r.addCase(d.fulfilled,o),a&&r.addCase(d.pending,a),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(e,{fulfilled:o||Vr,pending:a||Vr,rejected:c||Vr,settled:l||Vr})}function Vr(){}function Ae(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Cs={exports:{}},Ss={};var Gc;function Fb(){if(Gc)return Ss;Gc=1;var t=Rh();function e(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,o=t.useMemo,a=t.useDebugValue;return Ss.useSyncExternalStoreWithSelector=function(c,l,u,d,h){var p=i(null);if(p.current===null){var f={hasValue:!1,value:null};p.current=f}else f=p.current;p=o(function(){function g(_){if(!T){if(T=!0,P=_,_=d(_),h!==void 0&&f.hasValue){var v=f.value;if(h(v,_))return m=v}return m=_}if(v=m,n(P,_))return v;var S=d(_);return h!==void 0&&h(v,S)?(P=_,v):(P=_,m=S)}var T=!1,P,m,b=u===void 0?null:u;return[function(){return g(l())},b===null?void 0:function(){return g(b())}]},[l,u,d,h]);var I=r(c,p[0],p[1]);return s(function(){f.hasValue=!0,f.value=I},[I]),a(I),I},Ss}var Qc;function Ub(){return Qc||(Qc=1,Cs.exports=Fb()),Cs.exports}var Wb=Ub();function Qd(t){t()}function Vb(){let t=null,e=null;return{clear(){t=null,e=null},notify(){Qd(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Kc={notify(){},get:()=>[]};function Bb(t,e){let n,r=Kc,i=0,s=!1;function o(I){u();const g=r.subscribe(I);let T=!1;return()=>{T||(T=!0,g(),d())}}function a(){r.notify()}function c(){f.onStateChange&&f.onStateChange()}function l(){return s}function u(){i++,n||(n=t.subscribe(c),r=Vb())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Kc)}function h(){s||(s=!0,u())}function p(){s&&(s=!1,d())}const f={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:c,isSubscribed:l,trySubscribe:h,tryUnsubscribe:p,getListeners:()=>r};return f}var qb=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",zb=qb(),Hb=()=>typeof navigator<"u"&&navigator.product==="ReactNative",jb=Hb(),$b=()=>zb||jb?B.useLayoutEffect:B.useEffect,Gb=$b();function Yc(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function Kn(t,e){if(Yc(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(!Object.prototype.hasOwnProperty.call(e,n[i])||!Yc(t[n[i]],e[n[i]]))return!1;return!0}var Qb=Symbol.for("react-redux-context"),Kb=typeof globalThis<"u"?globalThis:{};function Yb(){if(!B.createContext)return{};const t=Kb[Qb]??=new Map;let e=t.get(B.createContext);return e||(e=B.createContext(null),t.set(B.createContext,e)),e}var Et=Yb();function Jb(t){const{children:e,context:n,serverState:r,store:i}=t,s=B.useMemo(()=>{const c=Bb(i);return{store:i,subscription:c,getServerState:r?()=>r:void 0}},[i,r]),o=B.useMemo(()=>i.getState(),[i]);Gb(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==i.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const a=n||Et;return B.createElement(a.Provider,{value:s},e)}var sI=Jb;function da(t=Et){return function(){return B.useContext(t)}}var Kd=da();function Yd(t=Et){const e=t===Et?Kd:da(t),n=()=>{const{store:r}=e();return r};return Object.assign(n,{withTypes:()=>n}),n}var Jd=Yd();function Xb(t=Et){const e=t===Et?Jd:Yd(t),n=()=>e().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Zb=Xb(),ew=(t,e)=>t===e;function tw(t=Et){const e=t===Et?Kd:da(t),n=(r,i={})=>{const{equalityFn:s=ew}=typeof i=="function"?{equalityFn:i}:i,o=e(),{store:a,subscription:c,getServerState:l}=o;B.useRef(!0);const u=B.useCallback({[r.name](h){return r(h)}}[r.name],[r]),d=Wb.useSyncExternalStoreWithSelector(c.addNestedSub,a.getState,l||a.getState,u,s);return B.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var nw=tw(),rw=Qd,iw=class extends Error{issues;constructor(t){super(t[0].message),this.name="SchemaError",this.issues=t}},Xd=(t=>(t.uninitialized="uninitialized",t.pending="pending",t.fulfilled="fulfilled",t.rejected="rejected",t))(Xd||{}),tt="uninitialized",so="pending",Fn="fulfilled",Un="rejected";function Jc(t){return{status:t,isUninitialized:t===tt,isLoading:t===so,isSuccess:t===Fn,isError:t===Un}}var Xc=bt;function ha(t,e){if(t===e||!(Xc(t)&&Xc(e)||Array.isArray(t)&&Array.isArray(e)))return e;const n=Object.keys(e),r=Object.keys(t);let i=n.length===r.length;const s=Array.isArray(e)?[]:{};for(const o of n)s[o]=ha(t[o],e[o]),i&&(i=t[o]===s[o]);return i?t:s}function oo(t,e,n){return t.reduce((r,i,s)=>(e(i,s)&&r.push(n(i,s)),r),[]).flat()}function sw(t){return new RegExp("(^|:)//").test(t)}function ow(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function fa(t){return t!=null}function Zc(t){return[...t?.values()??[]].filter(fa)}function aw(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var cw=t=>t.replace(/\/$/,""),lw=t=>t.replace(/^\//,"");function uw(t,e){if(!t)return e;if(!e)return t;if(sw(e))return e;const n=t.endsWith("/")||!e.startsWith("?")?"/":"";return t=cw(t),e=lw(e),`${t}${n}${e}`}function Oi(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}var ao=()=>new Map,dw=t=>{const e=new AbortController;return setTimeout(()=>{const n="signal timed out",r="TimeoutError";e.abort(typeof DOMException<"u"?new DOMException(n,r):Object.assign(new Error(n),{name:r}))},t),e.signal},hw=(...t)=>{for(const n of t)if(n.aborted)return AbortSignal.abort(n.reason);const e=new AbortController;for(const n of t)n.addEventListener("abort",()=>e.abort(n.reason),{signal:e.signal,once:!0});return e.signal},el=(...t)=>fetch(...t),fw=t=>t.status>=200&&t.status<=299,pw=t=>/ion\/(vnd\.api\+)?json/.test(t.get("content-type")||"");function tl(t){if(!bt(t))return t;const e={...t};for(const[n,r]of Object.entries(e))r===void 0&&delete e[n];return e}var gw=t=>typeof t=="object"&&(bt(t)||Array.isArray(t)||typeof t.toJSON=="function");function mw({baseUrl:t,prepareHeaders:e=d=>d,fetchFn:n=el,paramsSerializer:r,isJsonContentType:i=pw,jsonContentType:s="application/json",jsonReplacer:o,timeout:a,responseHandler:c,validateStatus:l,...u}={}){return typeof fetch>"u"&&n===el&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(h,p,f)=>{const{getState:I,extra:g,endpoint:T,forced:P,type:m}=p;let b,{url:_,headers:v=new Headers(u.headers),params:S=void 0,responseHandler:w=c??"json",validateStatus:R=l??fw,timeout:C=a,...y}=typeof h=="string"?{url:h}:h,E={...u,signal:C?hw(p.signal,dw(C)):p.signal,...y};v=new Headers(tl(v)),E.headers=await e(v,{getState:I,arg:h,extra:g,endpoint:T,forced:P,type:m,extraOptions:f})||v;const k=gw(E.body);if(E.body!=null&&!k&&typeof E.body!="string"&&E.headers.delete("content-type"),!E.headers.has("content-type")&&k&&E.headers.set("content-type",s),k&&i(E.headers)&&(E.body=JSON.stringify(E.body,o)),E.headers.has("accept")||(w==="json"?E.headers.set("accept","application/json"):w==="text"&&E.headers.set("accept","text/plain, text/html, */*")),S){const V=~_.indexOf("?")?"&":"?",z=r?r(S):new URLSearchParams(tl(S));_+=V+z}_=uw(t,_);const A=new Request(_,E);b={request:new Request(_,E)};let M;try{M=await n(A)}catch(V){return{error:{status:(V instanceof Error||typeof DOMException<"u"&&V instanceof DOMException)&&V.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(V)},meta:b}}const W=M.clone();b.response=W;let N,x="";try{let V;if(await Promise.all([d(M,w).then(z=>N=z,z=>V=z),W.text().then(z=>x=z,()=>{})]),V)throw V}catch(V){return{error:{status:"PARSING_ERROR",originalStatus:M.status,data:x,error:String(V)},meta:b}}return R(M,N)?{data:N,meta:b}:{error:{status:M.status,data:N},meta:b}};async function d(h,p){if(typeof p=="function")return p(h);if(p==="content-type"&&(p=i(h.headers)?"json":"text"),p==="json"){const f=await h.text();return f.length?JSON.parse(f):null}return h.text()}}var nl=class{constructor(t,e=void 0){this.value=t,this.meta=e}},Zi="__rtkq/",Zd="online",eh="offline",_w="focus",th="focused",yw="visibilitychange",es=Ue(`${Zi}${th}`),pa=Ue(`${Zi}un${th}`),ts=Ue(`${Zi}${Zd}`),ga=Ue(`${Zi}${eh}`),Br=!1;function oI(t,e){function n(){const[r,i,s,o]=[es,pa,ts,ga].map(l=>()=>t(l())),a=()=>{window.document.visibilityState==="visible"?r():i()};let c=()=>{Br=!1};if(!Br&&typeof window<"u"&&window.addEventListener){let l=function(d){Object.entries(u).forEach(([h,p])=>{d?window.addEventListener(h,p,!1):window.removeEventListener(h,p)})};const u={[_w]:r,[yw]:a,[Zd]:s,[eh]:o};l(!0),Br=!0,c=()=>{l(!1),Br=!1}}return c}return n()}var Dr="query",nh="mutation",rh="infinitequery";function ns(t){return t.type===Dr}function vw(t){return t.type===nh}function rs(t){return t.type===rh}function Di(t){return ns(t)||rs(t)}function ma(t,e,n,r,i,s){const o=bw(t)?t(e,n,r,i):t;return o?oo(o,fa,a=>s(ih(a))):[]}function bw(t){return typeof t=="function"}function ih(t){return typeof t=="string"?{type:t}:t}function ww(t,e){return t.catch(e)}var gn=(t,e)=>t.endpointDefinitions[e],fr=Symbol("forceQueryFn"),co=t=>typeof t[fr]=="function";function Ew({serializeQueryArgs:t,queryThunk:e,infiniteQueryThunk:n,mutationThunk:r,api:i,context:s,getInternalState:o}){const a=b=>o(b)?.runningQueries,c=b=>o(b)?.runningMutations,{unsubscribeQueryResult:l,removeMutationResult:u,updateSubscriptionOptions:d}=i.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:P,buildInitiateMutation:m,getRunningQueryThunk:h,getRunningMutationThunk:p,getRunningQueriesThunk:f,getRunningMutationsThunk:I};function h(b,_){return v=>{const S=gn(s,b),w=t({queryArgs:_,endpointDefinition:S,endpointName:b});return a(v)?.get(w)}}function p(b,_){return v=>c(v)?.get(_)}function f(){return b=>Zc(a(b))}function I(){return b=>Zc(c(b))}function g(b,_){const v=(S,{subscribe:w=!0,forceRefetch:R,subscriptionOptions:C,[fr]:y,...E}={})=>(k,A)=>{const O=t({queryArgs:S,endpointDefinition:_,endpointName:b});let M;const W={...E,type:Dr,subscribe:w,forceRefetch:R,subscriptionOptions:C,endpointName:b,originalArgs:S,queryCacheKey:O,[fr]:y};if(ns(_))M=e(W);else{const{direction:U,initialPageParam:ae,refetchCachedPages:$}=E;M=n({...W,direction:U,initialPageParam:ae,refetchCachedPages:$})}const N=i.endpoints[b].select(S),x=k(M),V=N(A()),{requestId:z,abort:ee}=x,G=V.requestId!==z,q=a(k)?.get(O),re=()=>N(A()),te=Object.assign(y?x.then(re):G&&!q?Promise.resolve(V):Promise.all([q,x]).then(re),{arg:S,requestId:z,subscriptionOptions:C,queryCacheKey:O,abort:ee,async unwrap(){const U=await te;if(U.isError)throw U.error;return U.data},refetch:U=>k(v(S,{subscribe:!1,forceRefetch:!0,...U})),unsubscribe(){w&&k(l({queryCacheKey:O,requestId:z}))},updateSubscriptionOptions(U){te.subscriptionOptions=U,k(d({endpointName:b,requestId:z,queryCacheKey:O,options:U}))}});if(!q&&!G&&!y){const U=a(k);U.set(O,te),te.then(()=>{U.delete(O)})}return te};return v}function T(b,_){return g(b,_)}function P(b,_){return g(b,_)}function m(b){return(_,{track:v=!0,fixedCacheKey:S}={})=>(w,R)=>{const C=r({type:"mutation",endpointName:b,originalArgs:_,track:v,fixedCacheKey:S}),y=w(C),{requestId:E,abort:k,unwrap:A}=y,O=ww(y.unwrap().then(x=>({data:x})),x=>({error:x})),M=()=>{w(u({requestId:E,fixedCacheKey:S}))},W=Object.assign(O,{arg:y.arg,requestId:E,abort:k,unwrap:A,reset:M}),N=c(w);return N.set(E,W),W.then(()=>{N.delete(E)}),S&&(N.set(S,W),W.then(()=>{N.get(S)===W&&N.delete(S)})),W}}}var sh=class extends iw{constructor(t,e,n,r){super(t),this.value=e,this.schemaName=n,this._bqMeta=r}},Tt=(t,e)=>Array.isArray(t)?t.includes(e):!!t;async function Rt(t,e,n,r){const i=await t["~standard"].validate(e);if(i.issues)throw new sh(i.issues,e,n,r);return i.value}function rl(t){return t}var Nn=(t={})=>({...t,[Yi]:!0});function Iw({reducerPath:t,baseQuery:e,context:{endpointDefinitions:n},serializeQueryArgs:r,api:i,assertTagType:s,selectors:o,onSchemaFailure:a,catchSchemaFailure:c,skipSchemaValidation:l}){const u=(y,E,k,A)=>(O,M)=>{const W=n[y],N=r({queryArgs:E,endpointDefinition:W,endpointName:y});if(O(i.internalActions.queryResultPatched({queryCacheKey:N,patches:k})),!A)return;const x=i.endpoints[y].select(E)(M()),V=ma(W.providesTags,x.data,void 0,E,{},s);O(i.internalActions.updateProvidedBy([{queryCacheKey:N,providedTags:V}]))};function d(y,E,k=0){const A=[E,...y];return k&&A.length>k?A.slice(0,-1):A}function h(y,E,k=0){const A=[...y,E];return k&&A.length>k?A.slice(1):A}const p=(y,E,k,A=!0)=>(O,M)=>{const N=i.endpoints[y].select(E)(M()),x={patches:[],inversePatches:[],undo:()=>O(i.util.patchQueryData(y,E,x.inversePatches,A))};if(N.status===tt)return x;let V;if("data"in N)if(Pe(N.data)){const[z,ee,G]=zd(N.data,k);x.patches.push(...ee),x.inversePatches.push(...G),V=z}else V=k(N.data),x.patches.push({op:"replace",path:[],value:V}),x.inversePatches.push({op:"replace",path:[],value:N.data});return x.patches.length===0||O(i.util.patchQueryData(y,E,x.patches,A)),x},f=(y,E,k)=>A=>A(i.endpoints[y].initiate(E,{subscribe:!1,forceRefetch:!0,[fr]:()=>({data:k})})),I=(y,E)=>y.query&&y[E]?y[E]:rl,g=async(y,{signal:E,abort:k,rejectWithValue:A,fulfillWithValue:O,dispatch:M,getState:W,extra:N})=>{const x=n[y.endpointName],{metaSchema:V,skipSchemaValidation:z=l}=x,ee=y.type===Dr;try{let G=rl;const q={signal:E,abort:k,dispatch:M,getState:W,extra:N,endpoint:y.endpointName,type:y.type,forced:ee?T(y,W()):void 0,queryCacheKey:ee?y.queryCacheKey:void 0},re=ee?y[fr]:void 0;let te;const U=async($,Y,Ie,he)=>{if(Y==null&&$.pages.length)return Promise.resolve({data:$});const Ht={queryArg:y.originalArgs,pageParam:Y},qe=await ae(Ht),jt=he?d:h;return{data:{pages:jt($.pages,qe.data,Ie),pageParams:jt($.pageParams,Y,Ie)},meta:qe.meta}};async function ae($){let Y;const{extraOptions:Ie,argSchema:he,rawResponseSchema:Ht,responseSchema:qe}=x;if(he&&!Tt(z,"arg")&&($=await Rt(he,$,"argSchema",{})),re?Y=re():x.query?(G=I(x,"transformResponse"),Y=await e(x.query($),q,Ie)):Y=await x.queryFn($,q,Ie,$t=>e($t,q,Ie)),typeof process<"u",Y.error)throw new nl(Y.error,Y.meta);let{data:jt}=Y;Ht&&!Tt(z,"rawResponse")&&(jt=await Rt(Ht,Y.data,"rawResponseSchema",Y.meta));let it=await G(jt,Y.meta,$);return qe&&!Tt(z,"response")&&(it=await Rt(qe,it,"responseSchema",Y.meta)),{...Y,data:it}}if(ee&&"infiniteQueryOptions"in x){const{infiniteQueryOptions:$}=x,{maxPages:Y=1/0}=$,Ie=y.refetchCachedPages??$.refetchCachedPages??!0;let he;const Ht={pages:[],pageParams:[]},qe=o.selectQueryEntry(W(),y.queryCacheKey)?.data,it=T(y,W())&&!y.direction||!qe?Ht:qe;if("direction"in y&&y.direction&&it.pages.length){const $t=y.direction==="backward",ss=($t?oh:lo)($,it,y.originalArgs);he=await U(it,ss,Y,$t)}else{const{initialPageParam:$t=$.initialPageParam}=y,is=qe?.pageParams??[],ss=is[0]??$t,Sh=is.length;if(he=await U(it,ss,Y),re&&(he={data:he.data.pages[0]}),Ie)for(let ya=1;ya<Sh;ya++){const Th=lo($,he.data,y.originalArgs);he=await U(he.data,Th,Y)}}te=he}else te=await ae(y.originalArgs);return V&&!Tt(z,"meta")&&te.meta&&(te.meta=await Rt(V,te.meta,"metaSchema",te.meta)),O(te.data,Nn({fulfilledTimeStamp:Date.now(),baseQueryMeta:te.meta}))}catch(G){let q=G;if(q instanceof nl){let re=I(x,"transformErrorResponse");const{rawErrorResponseSchema:te,errorResponseSchema:U}=x;let{value:ae,meta:$}=q;try{te&&!Tt(z,"rawErrorResponse")&&(ae=await Rt(te,ae,"rawErrorResponseSchema",$)),V&&!Tt(z,"meta")&&($=await Rt(V,$,"metaSchema",$));let Y=await re(ae,$,y.originalArgs);return U&&!Tt(z,"errorResponse")&&(Y=await Rt(U,Y,"errorResponseSchema",$)),A(Y,Nn({baseQueryMeta:$}))}catch(Y){q=Y}}try{if(q instanceof sh){const re={endpoint:y.endpointName,arg:y.originalArgs,type:y.type,queryCacheKey:ee?y.queryCacheKey:void 0};x.onSchemaFailure?.(q,re),a?.(q,re);const{catchSchemaFailure:te=c}=x;if(te)return A(te(q,re),Nn({baseQueryMeta:q._bqMeta}))}}catch(re){q=re}throw console.error(q),q}};function T(y,E){const k=o.selectQueryEntry(E,y.queryCacheKey),A=o.selectConfig(E).refetchOnMountOrArgChange,O=k?.fulfilledTimeStamp,M=y.forceRefetch??(y.subscribe&&A);return M?M===!0||(Number(new Date)-Number(O))/1e3>=M:!1}const P=()=>$c(`${t}/executeQuery`,g,{getPendingMeta({arg:E}){const k=n[E.endpointName];return Nn({startedTimeStamp:Date.now(),...rs(k)?{direction:E.direction}:{}})},condition(E,{getState:k}){const A=k(),O=o.selectQueryEntry(A,E.queryCacheKey),M=O?.fulfilledTimeStamp,W=E.originalArgs,N=O?.originalArgs,x=n[E.endpointName],V=E.direction;return co(E)?!0:O?.status==="pending"?!1:T(E,A)||ns(x)&&x?.forceRefetch?.({currentArg:W,previousArg:N,endpointState:O,state:A})?!0:!(M&&!V)},dispatchConditionRejection:!0}),m=P(),b=P(),_=$c(`${t}/executeMutation`,g,{getPendingMeta(){return Nn({startedTimeStamp:Date.now()})}}),v=y=>"force"in y,S=y=>"ifOlderThan"in y,w=(y,E,k={})=>(A,O)=>{const M=v(k)&&k.force,W=S(k)&&k.ifOlderThan,N=(V=!0)=>{const z={forceRefetch:V,subscribe:!1};return i.endpoints[y].initiate(E,z)},x=i.endpoints[y].select(E)(O());if(M)A(N());else if(W){const V=x?.fulfilledTimeStamp;if(!V){A(N());return}(Number(new Date)-Number(new Date(V)))/1e3>=W&&A(N())}else A(N(!1))};function R(y){return E=>E?.meta?.arg?.endpointName===y}function C(y,E){return{matchPending:Qn(la(y),R(E)),matchFulfilled:Qn(wt(y),R(E)),matchRejected:Qn(pn(y),R(E))}}return{queryThunk:m,mutationThunk:_,infiniteQueryThunk:b,prefetch:w,updateQueryData:p,upsertQueryData:f,patchQueryData:u,buildMatchThunkActions:C}}function lo(t,{pages:e,pageParams:n},r){const i=e.length-1;return t.getNextPageParam(e[i],e,n[i],n,r)}function oh(t,{pages:e,pageParams:n},r){return t.getPreviousPageParam?.(e[0],e,n[0],n,r)}function ah(t,e,n,r){return ma(n[t.meta.arg.endpointName][e],wt(t)?t.payload:void 0,Xi(t)?t.payload:void 0,t.meta.arg.originalArgs,"baseQueryMeta"in t.meta?t.meta.baseQueryMeta:void 0,r)}function il(t){return ke(t)?Bd(t):t}function qr(t,e,n){const r=t[e];r&&n(r)}function pr(t){return("arg"in t?t.arg.fixedCacheKey:t.fixedCacheKey)??t.requestId}function sl(t,e,n){const r=t[pr(e)];r&&n(r)}var zr={};function Cw({reducerPath:t,queryThunk:e,mutationThunk:n,serializeQueryArgs:r,context:{endpointDefinitions:i,apiUid:s,extractRehydrationInfo:o,hasRehydrationInfo:a},assertTagType:c,config:l}){const u=Ue(`${t}/resetApiState`);function d(R,C,y,E){R[C.queryCacheKey]??={status:tt,endpointName:C.endpointName},qr(R,C.queryCacheKey,k=>{k.status=so,k.requestId=y&&k.requestId?k.requestId:E.requestId,C.originalArgs!==void 0&&(k.originalArgs=C.originalArgs),k.startedTimeStamp=E.startedTimeStamp;const A=i[E.arg.endpointName];rs(A)&&"direction"in C&&(k.direction=C.direction)})}function h(R,C,y,E){qr(R,C.arg.queryCacheKey,k=>{if(k.requestId!==C.requestId&&!E)return;const{merge:A}=i[C.arg.endpointName];if(k.status=Fn,A)if(k.data!==void 0){const{fulfilledTimeStamp:O,arg:M,baseQueryMeta:W,requestId:N}=C;let x=Nr(k.data,V=>A(V,y,{arg:M.originalArgs,baseQueryMeta:W,fulfilledTimeStamp:O,requestId:N}));k.data=x}else k.data=y;else k.data=i[C.arg.endpointName].structuralSharing??!0?ha(ke(k.data)?Bv(k.data):k.data,y):y;delete k.error,k.fulfilledTimeStamp=C.fulfilledTimeStamp})}const p=Qt({name:`${t}/queries`,initialState:zr,reducers:{removeQueryResult:{reducer(R,{payload:{queryCacheKey:C}}){delete R[C]},prepare:An()},cacheEntriesUpserted:{reducer(R,C){for(const y of C.payload){const{queryDescription:E,value:k}=y;d(R,E,!0,{arg:E,requestId:C.meta.requestId,startedTimeStamp:C.meta.timestamp}),h(R,{arg:E,requestId:C.meta.requestId,fulfilledTimeStamp:C.meta.timestamp,baseQueryMeta:{}},k,!0)}},prepare:R=>({payload:R.map(E=>{const{endpointName:k,arg:A,value:O}=E,M=i[k];return{queryDescription:{type:Dr,endpointName:k,originalArgs:E.arg,queryCacheKey:r({queryArgs:A,endpointDefinition:M,endpointName:k})},value:O}}),meta:{[Yi]:!0,requestId:ua(),timestamp:Date.now()}})},queryResultPatched:{reducer(R,{payload:{queryCacheKey:C,patches:y}}){qr(R,C,E=>{E.data=Wc(E.data,y.concat())})},prepare:An()}},extraReducers(R){R.addCase(e.pending,(C,{meta:y,meta:{arg:E}})=>{const k=co(E);d(C,E,k,y)}).addCase(e.fulfilled,(C,{meta:y,payload:E})=>{const k=co(y.arg);h(C,y,E,k)}).addCase(e.rejected,(C,{meta:{condition:y,arg:E,requestId:k},error:A,payload:O})=>{qr(C,E.queryCacheKey,M=>{if(!y){if(M.requestId!==k)return;M.status=Un,M.error=O??A}})}).addMatcher(a,(C,y)=>{const{queries:E}=o(y);for(const[k,A]of Object.entries(E))(A?.status===Fn||A?.status===Un)&&(C[k]=A)})}}),f=Qt({name:`${t}/mutations`,initialState:zr,reducers:{removeMutationResult:{reducer(R,{payload:C}){const y=pr(C);y in R&&delete R[y]},prepare:An()}},extraReducers(R){R.addCase(n.pending,(C,{meta:y,meta:{requestId:E,arg:k,startedTimeStamp:A}})=>{k.track&&(C[pr(y)]={requestId:E,status:so,endpointName:k.endpointName,startedTimeStamp:A})}).addCase(n.fulfilled,(C,{payload:y,meta:E})=>{E.arg.track&&sl(C,E,k=>{k.requestId===E.requestId&&(k.status=Fn,k.data=y,k.fulfilledTimeStamp=E.fulfilledTimeStamp)})}).addCase(n.rejected,(C,{payload:y,error:E,meta:k})=>{k.arg.track&&sl(C,k,A=>{A.requestId===k.requestId&&(A.status=Un,A.error=y??E)})}).addMatcher(a,(C,y)=>{const{mutations:E}=o(y);for(const[k,A]of Object.entries(E))(A?.status===Fn||A?.status===Un)&&k!==A?.requestId&&(C[k]=A)})}}),I={tags:{},keys:{}},g=Qt({name:`${t}/invalidation`,initialState:I,reducers:{updateProvidedBy:{reducer(R,C){for(const{queryCacheKey:y,providedTags:E}of C.payload){T(R,y);for(const{type:k,id:A}of E){const O=(R.tags[k]??={})[A||"__internal_without_id"]??=[];O.includes(y)||O.push(y)}R.keys[y]=E}},prepare:An()}},extraReducers(R){R.addCase(p.actions.removeQueryResult,(C,{payload:{queryCacheKey:y}})=>{T(C,y)}).addMatcher(a,(C,y)=>{const{provided:E}=o(y);for(const[k,A]of Object.entries(E.tags??{}))for(const[O,M]of Object.entries(A)){const W=(C.tags[k]??={})[O||"__internal_without_id"]??=[];for(const N of M)W.includes(N)||W.push(N),C.keys[N]=E.keys[N]}}).addMatcher(et(wt(e),Xi(e)),(C,y)=>{P(C,[y])}).addMatcher(p.actions.cacheEntriesUpserted.match,(C,y)=>{const E=y.payload.map(({queryDescription:k,value:A})=>({type:"UNKNOWN",payload:A,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:k}}));P(C,E)})}});function T(R,C){const y=il(R.keys[C]??[]);for(const E of y){const k=E.type,A=E.id??"__internal_without_id",O=R.tags[k]?.[A];O&&(R.tags[k][A]=il(O).filter(M=>M!==C))}delete R.keys[C]}function P(R,C){const y=C.map(E=>{const k=ah(E,"providesTags",i,c),{queryCacheKey:A}=E.meta.arg;return{queryCacheKey:A,providedTags:k}});g.caseReducers.updateProvidedBy(R,g.actions.updateProvidedBy(y))}const m=Qt({name:`${t}/subscriptions`,initialState:zr,reducers:{updateSubscriptionOptions(R,C){},unsubscribeQueryResult(R,C){},internal_getRTKQSubscriptions(){}}}),b=Qt({name:`${t}/internalSubscriptions`,initialState:zr,reducers:{subscriptionsUpdated:{reducer(R,C){return Wc(R,C.payload)},prepare:An()}}}),_=Qt({name:`${t}/config`,initialState:{online:aw(),focused:ow(),middlewareRegistered:!1,...l},reducers:{middlewareRegistered(R,{payload:C}){R.middlewareRegistered=R.middlewareRegistered==="conflict"||s!==C?"conflict":!0}},extraReducers:R=>{R.addCase(ts,C=>{C.online=!0}).addCase(ga,C=>{C.online=!1}).addCase(es,C=>{C.focused=!0}).addCase(pa,C=>{C.focused=!1}).addMatcher(a,C=>({...C}))}}),v=Dd({queries:p.reducer,mutations:f.reducer,provided:g.reducer,subscriptions:b.reducer,config:_.reducer}),S=(R,C)=>v(u.match(C)?void 0:R,C),w={..._.actions,...p.actions,...m.actions,...b.actions,...f.actions,...g.actions,resetApiState:u};return{reducer:S,actions:w}}var Ne=Symbol.for("RTKQ/skipToken"),ch={status:tt},ol=Nr(ch,()=>{}),al=Nr(ch,()=>{});function Sw({serializeQueryArgs:t,reducerPath:e,createSelector:n}){const r=m=>ol,i=m=>al;return{buildQuerySelector:h,buildInfiniteQuerySelector:p,buildMutationSelector:f,selectInvalidatedBy:I,selectCachedArgsForQuery:g,selectApiState:o,selectQueries:a,selectMutations:l,selectQueryEntry:c,selectConfig:u};function s(m){return{...m,...Jc(m.status)}}function o(m){return m[e]}function a(m){return o(m)?.queries}function c(m,b){return a(m)?.[b]}function l(m){return o(m)?.mutations}function u(m){return o(m)?.config}function d(m,b,_){return v=>{if(v===Ne)return n(r,_);const S=t({queryArgs:v,endpointDefinition:b,endpointName:m});return n(R=>c(R,S)??ol,_)}}function h(m,b){return d(m,b,s)}function p(m,b){const{infiniteQueryOptions:_}=b;function v(S){const w={...S,...Jc(S.status)},{isLoading:R,isError:C,direction:y}=w,E=y==="forward",k=y==="backward";return{...w,hasNextPage:T(_,w.data,w.originalArgs),hasPreviousPage:P(_,w.data,w.originalArgs),isFetchingNextPage:R&&E,isFetchingPreviousPage:R&&k,isFetchNextPageError:C&&E,isFetchPreviousPageError:C&&k}}return d(m,b,v)}function f(){return m=>{let b;return typeof m=="object"?b=pr(m)??Ne:b=m,n(b===Ne?i:S=>o(S)?.mutations?.[b]??al,s)}}function I(m,b){const _=m[e],v=new Set,S=oo(b,fa,ih);for(const w of S){const R=_.provided.tags[w.type];if(!R)continue;let C=(w.id!==void 0?R[w.id]:Object.values(R).flat())??[];for(const y of C)v.add(y)}return Array.from(v.values()).flatMap(w=>{const R=_.queries[w];return R?{queryCacheKey:w,endpointName:R.endpointName,originalArgs:R.originalArgs}:[]})}function g(m,b){return oo(Object.values(a(m)),_=>_?.endpointName===b&&_.status!==tt,_=>_.originalArgs)}function T(m,b,_){return b?lo(m,b,_)!=null:!1}function P(m,b,_){return!b||!m.getPreviousPageParam?!1:oh(m,b,_)!=null}}var cl=WeakMap?new WeakMap:void 0,ll=({endpointName:t,queryArgs:e})=>{let n="";const r=cl?.get(e);if(typeof r=="string")n=r;else{const i=JSON.stringify(e,(s,o)=>(o=typeof o=="bigint"?{$bigint:o.toString()}:o,o=bt(o)?Object.keys(o).sort().reduce((a,c)=>(a[c]=o[c],a),{}):o,o));bt(e)&&cl?.set(e,i),n=i}return`${t}(${n})`};function lh(...t){return function(n){const r=Ni(l=>n.extractRehydrationInfo?.(l,{reducerPath:n.reducerPath??"api"})),i={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...n,extractRehydrationInfo:r,serializeQueryArgs(l){let u=ll;if("serializeQueryArgs"in l.endpointDefinition){const d=l.endpointDefinition.serializeQueryArgs;u=h=>{const p=d(h);return typeof p=="string"?p:ll({...h,queryArgs:p})}}else n.serializeQueryArgs&&(u=n.serializeQueryArgs);return u(l)},tagTypes:[...n.tagTypes||[]]},s={endpointDefinitions:{},batch(l){l()},apiUid:ua(),extractRehydrationInfo:r,hasRehydrationInfo:Ni(l=>r(l)!=null)},o={injectEndpoints:c,enhanceEndpoints({addTagTypes:l,endpoints:u}){if(l)for(const d of l)i.tagTypes.includes(d)||i.tagTypes.push(d);if(u)for(const[d,h]of Object.entries(u))typeof h=="function"?h(gn(s,d)):Object.assign(gn(s,d)||{},h);return o}},a=t.map(l=>l.init(o,i,s));function c(l){const u=l.endpoints({query:d=>({...d,type:Dr}),mutation:d=>({...d,type:nh}),infiniteQuery:d=>({...d,type:rh})});for(const[d,h]of Object.entries(u)){if(l.overrideExisting!==!0&&d in s.endpointDefinitions){if(l.overrideExisting==="throw")throw new Error(Ae(39));continue}s.endpointDefinitions[d]=h;for(const p of a)p.injectEndpoint(d,h)}return o}return o.injectEndpoints({endpoints:n.endpoints})}}function ze(t,...e){return Object.assign(t,...e)}var Tw=({api:t,queryThunk:e,internalState:n,mwApi:r})=>{const i=`${t.reducerPath}/subscriptions`;let s=null,o=null;const{updateSubscriptionOptions:a,unsubscribeQueryResult:c}=t.internalActions,l=(I,g)=>{if(a.match(g)){const{queryCacheKey:P,requestId:m,options:b}=g.payload,_=I.get(P);return _?.has(m)&&_.set(m,b),!0}if(c.match(g)){const{queryCacheKey:P,requestId:m}=g.payload,b=I.get(P);return b&&b.delete(m),!0}if(t.internalActions.removeQueryResult.match(g))return I.delete(g.payload.queryCacheKey),!0;if(e.pending.match(g)){const{meta:{arg:P,requestId:m}}=g,b=Oi(I,P.queryCacheKey,ao);return P.subscribe&&b.set(m,P.subscriptionOptions??b.get(m)??{}),!0}let T=!1;if(e.rejected.match(g)){const{meta:{condition:P,arg:m,requestId:b}}=g;if(P&&m.subscribe){const _=Oi(I,m.queryCacheKey,ao);_.set(b,m.subscriptionOptions??_.get(b)??{}),T=!0}}return T},u=()=>n.currentSubscriptions,p={getSubscriptions:u,getSubscriptionCount:I=>u().get(I)?.size??0,isRequestSubscribed:(I,g)=>!!u()?.get(I)?.get(g)};function f(I){return JSON.parse(JSON.stringify(Object.fromEntries([...I].map(([g,T])=>[g,Object.fromEntries(T)]))))}return(I,g)=>{if(s||(s=f(n.currentSubscriptions)),t.util.resetApiState.match(I))return s={},n.currentSubscriptions.clear(),o=null,[!0,!1];if(t.internalActions.internal_getRTKQSubscriptions.match(I))return[!1,p];const T=l(n.currentSubscriptions,I);let P=!0;if(T){o||(o=setTimeout(()=>{const _=f(n.currentSubscriptions),[,v]=zd(s,()=>_);g.next(t.internalActions.subscriptionsUpdated(v)),s=_,o=null},500));const m=typeof I.type=="string"&&!!I.type.startsWith(i),b=e.rejected.match(I)&&I.meta.condition&&!!I.meta.arg.subscribe;P=!m&&!b}return[P,!1]}},Rw=2147483647/1e3-1,kw=({reducerPath:t,api:e,queryThunk:n,context:r,internalState:i,selectors:{selectQueryEntry:s,selectConfig:o},getRunningQueryThunk:a,mwApi:c})=>{const{removeQueryResult:l,unsubscribeQueryResult:u,cacheEntriesUpserted:d}=e.internalActions,h=et(u.match,n.fulfilled,n.rejected,d.match);function p(m){const b=i.currentSubscriptions.get(m);return b?b.size>0:!1}const f={};function I(m){for(const b of m.values())b?.abort?.()}const g=(m,b)=>{const _=b.getState(),v=o(_);if(h(m)){let S;if(d.match(m))S=m.payload.map(w=>w.queryDescription.queryCacheKey);else{const{queryCacheKey:w}=u.match(m)?m.payload:m.meta.arg;S=[w]}T(S,b,v)}if(e.util.resetApiState.match(m)){for(const[S,w]of Object.entries(f))w&&clearTimeout(w),delete f[S];I(i.runningQueries),I(i.runningMutations)}if(r.hasRehydrationInfo(m)){const{queries:S}=r.extractRehydrationInfo(m);T(Object.keys(S),b,v)}};function T(m,b,_){const v=b.getState();for(const S of m){const w=s(v,S);w?.endpointName&&P(S,w.endpointName,b,_)}}function P(m,b,_,v){const w=gn(r,b)?.keepUnusedDataFor??v.keepUnusedDataFor;if(w===1/0)return;const R=Math.max(0,Math.min(w,Rw));if(!p(m)){const C=f[m];C&&clearTimeout(C),f[m]=setTimeout(()=>{if(!p(m)){const y=s(_.getState(),m);y?.endpointName&&_.dispatch(a(y.endpointName,y.originalArgs))?.abort(),_.dispatch(l({queryCacheKey:m}))}delete f[m]},R*1e3)}}return g},ul=new Error("Promise never resolved before cacheEntryRemoved."),Pw=({api:t,reducerPath:e,context:n,queryThunk:r,mutationThunk:i,internalState:s,selectors:{selectQueryEntry:o,selectApiState:a}})=>{const c=io(r),l=io(i),u=wt(r,i),d={},{removeQueryResult:h,removeMutationResult:p,cacheEntriesUpserted:f}=t.internalActions;function I(_,v,S){const w=d[_];w?.valueResolved&&(w.valueResolved({data:v,meta:S}),delete w.valueResolved)}function g(_){const v=d[_];v&&(delete d[_],v.cacheEntryRemoved())}function T(_){const{arg:v,requestId:S}=_.meta,{endpointName:w,originalArgs:R}=v;return[w,R,S]}const P=(_,v,S)=>{const w=m(_);function R(C,y,E,k){const A=o(S,y),O=o(v.getState(),y);!A&&O&&b(C,k,y,v,E)}if(r.pending.match(_)){const[C,y,E]=T(_);R(C,w,E,y)}else if(f.match(_))for(const{queryDescription:C,value:y}of _.payload){const{endpointName:E,originalArgs:k,queryCacheKey:A}=C;R(E,A,_.meta.requestId,k),I(A,y,{})}else if(i.pending.match(_)){if(v.getState()[e].mutations[w]){const[y,E,k]=T(_);b(y,E,w,v,k)}}else if(u(_))I(w,_.payload,_.meta.baseQueryMeta);else if(h.match(_)||p.match(_))g(w);else if(t.util.resetApiState.match(_))for(const C of Object.keys(d))g(C)};function m(_){return c(_)?_.meta.arg.queryCacheKey:l(_)?_.meta.arg.fixedCacheKey??_.meta.requestId:h.match(_)?_.payload.queryCacheKey:p.match(_)?pr(_.payload):""}function b(_,v,S,w,R){const C=gn(n,_),y=C?.onCacheEntryAdded;if(!y)return;const E={},k=new Promise(x=>{E.cacheEntryRemoved=x}),A=Promise.race([new Promise(x=>{E.valueResolved=x}),k.then(()=>{throw ul})]);A.catch(()=>{}),d[S]=E;const O=t.endpoints[_].select(Di(C)?v:S),M=w.dispatch((x,V,z)=>z),W={...w,getCacheEntry:()=>O(w.getState()),requestId:R,extra:M,updateCachedData:Di(C)?x=>w.dispatch(t.util.updateQueryData(_,v,x)):void 0,cacheDataLoaded:A,cacheEntryRemoved:k},N=y(v,W);Promise.resolve(N).catch(x=>{if(x!==ul)throw x})}return P},Aw=({api:t,context:{apiUid:e},reducerPath:n})=>(r,i)=>{t.util.resetApiState.match(r)&&i.dispatch(t.internalActions.middlewareRegistered(e))},Nw=({reducerPath:t,context:e,context:{endpointDefinitions:n},mutationThunk:r,queryThunk:i,api:s,assertTagType:o,refetchQuery:a,internalState:c})=>{const{removeQueryResult:l}=s.internalActions,u=et(wt(r),Xi(r)),d=et(wt(i,r),pn(i,r));let h=[],p=0;const f=(T,P)=>{(i.pending.match(T)||r.pending.match(T))&&p++,d(T)&&(p=Math.max(0,p-1)),u(T)?g(ah(T,"invalidatesTags",n,o),P):d(T)?g([],P):s.util.invalidateTags.match(T)&&g(ma(T.payload,void 0,void 0,void 0,void 0,o),P)};function I(){return p>0}function g(T,P){const m=P.getState(),b=m[t];if(h.push(...T),b.config.invalidationBehavior==="delayed"&&I())return;const _=h;if(h=[],_.length===0)return;const v=s.util.selectInvalidatedBy(m,_);e.batch(()=>{const S=Array.from(v.values());for(const{queryCacheKey:w}of S){const R=b.queries[w],C=Oi(c.currentSubscriptions,w,ao);R&&(C.size===0?P.dispatch(l({queryCacheKey:w})):R.status!==tt&&P.dispatch(a(R)))}})}return f},Ow=({reducerPath:t,queryThunk:e,api:n,refetchQuery:r,internalState:i})=>{const{currentPolls:s,currentSubscriptions:o}=i,a=new Set;let c=null;const l=(g,T)=>{(n.internalActions.updateSubscriptionOptions.match(g)||n.internalActions.unsubscribeQueryResult.match(g))&&u(g.payload.queryCacheKey,T),(e.pending.match(g)||e.rejected.match(g)&&g.meta.condition)&&u(g.meta.arg.queryCacheKey,T),(e.fulfilled.match(g)||e.rejected.match(g)&&!g.meta.condition)&&d(g.meta.arg,T),n.util.resetApiState.match(g)&&(f(),c&&(clearTimeout(c),c=null),a.clear())};function u(g,T){a.add(g),c||(c=setTimeout(()=>{for(const P of a)h({queryCacheKey:P},T);a.clear(),c=null},0))}function d({queryCacheKey:g},T){const P=T.getState()[t],m=P.queries[g],b=o.get(g);if(!m||m.status===tt)return;const{lowestPollingInterval:_,skipPollingIfUnfocused:v}=I(b);if(!Number.isFinite(_))return;const S=s.get(g);S?.timeout&&(clearTimeout(S.timeout),S.timeout=void 0);const w=Date.now()+_;s.set(g,{nextPollTimestamp:w,pollingInterval:_,timeout:setTimeout(()=>{(P.config.focused||!v)&&T.dispatch(r(m)),d({queryCacheKey:g},T)},_)})}function h({queryCacheKey:g},T){const m=T.getState()[t].queries[g],b=o.get(g);if(!m||m.status===tt)return;const{lowestPollingInterval:_}=I(b);if(!Number.isFinite(_)){p(g);return}const v=s.get(g),S=Date.now()+_;(!v||S<v.nextPollTimestamp)&&d({queryCacheKey:g},T)}function p(g){const T=s.get(g);T?.timeout&&clearTimeout(T.timeout),s.delete(g)}function f(){for(const g of s.keys())p(g)}function I(g=new Map){let T=!1,P=Number.POSITIVE_INFINITY;for(const m of g.values())m.pollingInterval&&(P=Math.min(m.pollingInterval,P),T=m.skipPollingIfUnfocused||T);return{lowestPollingInterval:P,skipPollingIfUnfocused:T}}return l},Dw=({api:t,context:e,queryThunk:n,mutationThunk:r})=>{const i=la(n,r),s=pn(n,r),o=wt(n,r),a={};return(l,u)=>{if(i(l)){const{requestId:d,arg:{endpointName:h,originalArgs:p}}=l.meta,f=gn(e,h),I=f?.onQueryStarted;if(I){const g={},T=new Promise((_,v)=>{g.resolve=_,g.reject=v});T.catch(()=>{}),a[d]=g;const P=t.endpoints[h].select(Di(f)?p:d),m=u.dispatch((_,v,S)=>S),b={...u,getCacheEntry:()=>P(u.getState()),requestId:d,extra:m,updateCachedData:Di(f)?_=>u.dispatch(t.util.updateQueryData(h,p,_)):void 0,queryFulfilled:T};I(p,b)}}else if(o(l)){const{requestId:d,baseQueryMeta:h}=l.meta;a[d]?.resolve({data:l.payload,meta:h}),delete a[d]}else if(s(l)){const{requestId:d,rejectedWithValue:h,baseQueryMeta:p}=l.meta;a[d]?.reject({error:l.payload??l.error,isUnhandledError:!h,meta:p}),delete a[d]}}},xw=({reducerPath:t,context:e,api:n,refetchQuery:r,internalState:i})=>{const{removeQueryResult:s}=n.internalActions,o=(c,l)=>{es.match(c)&&a(l,"refetchOnFocus"),ts.match(c)&&a(l,"refetchOnReconnect")};function a(c,l){const u=c.getState()[t],d=u.queries,h=i.currentSubscriptions;e.batch(()=>{for(const p of h.keys()){const f=d[p],I=h.get(p);if(!I||!f)continue;const g=[...I.values()];(g.some(P=>P[l]===!0)||g.every(P=>P[l]===void 0)&&u.config[l])&&(I.size===0?c.dispatch(s({queryCacheKey:p})):f.status!==tt&&c.dispatch(r(f)))}})}return o};function Mw(t){const{reducerPath:e,queryThunk:n,api:r,context:i,getInternalState:s}=t,{apiUid:o}=i,a={invalidateTags:Ue(`${e}/invalidateTags`)},c=h=>h.type.startsWith(`${e}/`),l=[Aw,kw,Nw,Ow,Pw,Dw];return{middleware:h=>{let p=!1;const f=s(h.dispatch),I={...t,internalState:f,refetchQuery:d,isThisApiSliceAction:c,mwApi:h},g=l.map(m=>m(I)),T=Tw(I),P=xw(I);return m=>b=>{if(!xd(b))return m(b);p||(p=!0,h.dispatch(r.internalActions.middlewareRegistered(o)));const _={...h,next:m},v=h.getState(),[S,w]=T(b,_,v);let R;if(S?R=m(b):R=w,h.getState()[e]&&(P(b,_,v),c(b)||i.hasRehydrationInfo(b)))for(const C of g)C(b,_,v);return R}},actions:a};function d(h){return t.api.endpoints[h.endpointName].initiate(h.originalArgs,{subscribe:!1,forceRefetch:!0})}}var dl=Symbol(),uh=({createSelector:t=ca}={})=>({name:dl,init(e,{baseQuery:n,tagTypes:r,reducerPath:i,serializeQueryArgs:s,keepUnusedDataFor:o,refetchOnMountOrArgChange:a,refetchOnFocus:c,refetchOnReconnect:l,invalidationBehavior:u,onSchemaFailure:d,catchSchemaFailure:h,skipSchemaValidation:p},f){nb();const I=U=>U;Object.assign(e,{reducerPath:i,endpoints:{},internalActions:{onOnline:ts,onOffline:ga,onFocus:es,onFocusLost:pa},util:{}});const g=Sw({serializeQueryArgs:s,reducerPath:i,createSelector:t}),{selectInvalidatedBy:T,selectCachedArgsForQuery:P,buildQuerySelector:m,buildInfiniteQuerySelector:b,buildMutationSelector:_}=g;ze(e.util,{selectInvalidatedBy:T,selectCachedArgsForQuery:P});const{queryThunk:v,infiniteQueryThunk:S,mutationThunk:w,patchQueryData:R,updateQueryData:C,upsertQueryData:y,prefetch:E,buildMatchThunkActions:k}=Iw({baseQuery:n,reducerPath:i,context:f,api:e,serializeQueryArgs:s,assertTagType:I,selectors:g,onSchemaFailure:d,catchSchemaFailure:h,skipSchemaValidation:p}),{reducer:A,actions:O}=Cw({context:f,queryThunk:v,mutationThunk:w,serializeQueryArgs:s,reducerPath:i,assertTagType:I,config:{refetchOnFocus:c,refetchOnReconnect:l,refetchOnMountOrArgChange:a,keepUnusedDataFor:o,reducerPath:i,invalidationBehavior:u}});ze(e.util,{patchQueryData:R,updateQueryData:C,upsertQueryData:y,prefetch:E,resetApiState:O.resetApiState,upsertQueryEntries:O.cacheEntriesUpserted}),ze(e.internalActions,O);const M=new WeakMap,W=U=>Oi(M,U,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:N,buildInitiateInfiniteQuery:x,buildInitiateMutation:V,getRunningMutationThunk:z,getRunningMutationsThunk:ee,getRunningQueriesThunk:G,getRunningQueryThunk:q}=Ew({queryThunk:v,mutationThunk:w,infiniteQueryThunk:S,api:e,serializeQueryArgs:s,context:f,getInternalState:W});ze(e.util,{getRunningMutationThunk:z,getRunningMutationsThunk:ee,getRunningQueryThunk:q,getRunningQueriesThunk:G});const{middleware:re,actions:te}=Mw({reducerPath:i,context:f,queryThunk:v,mutationThunk:w,infiniteQueryThunk:S,api:e,assertTagType:I,selectors:g,getRunningQueryThunk:q,getInternalState:W});return ze(e.util,te),ze(e,{reducer:A,middleware:re}),{name:dl,injectEndpoint(U,ae){const $=e,Y=$.endpoints[U]??={};ns(ae)&&ze(Y,{name:U,select:m(U,ae),initiate:N(U,ae)},k(v,U)),vw(ae)&&ze(Y,{name:U,select:_(),initiate:V(U)},k(w,U)),rs(ae)&&ze(Y,{name:U,select:b(U,ae),initiate:x(U,ae)},k(v,U))}}}});uh();function Hr(t){return t.replace(t[0],t[0].toUpperCase())}var Lw="query",Fw="mutation",Uw="infinitequery";function Ww(t){return t.type===Lw}function Vw(t){return t.type===Fw}function dh(t){return t.type===Uw}function On(t,...e){return Object.assign(t,...e)}var Ts=Symbol();function Rs(t){const e=B.useRef(t),n=B.useMemo(()=>ha(e.current,t),[t]);return B.useEffect(()=>{e.current!==n&&(e.current=n)},[n]),n}function Kt(t){const e=B.useRef(t);return B.useEffect(()=>{Kn(e.current,t)||(e.current=t)},[t]),Kn(e.current,t)?e.current:t}var Bw=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",qw=Bw(),zw=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Hw=zw(),jw=()=>qw||Hw?B.useLayoutEffect:B.useEffect,$w=jw(),hl=t=>t.isUninitialized?{...t,isUninitialized:!1,isFetching:!0,isLoading:t.data===void 0,status:Xd.pending}:t;function ks(t,...e){const n={};return e.forEach(r=>{n[r]=t[r]}),n}var Ps=["data","status","isLoading","isSuccess","isError","error"];function Gw({api:t,moduleOptions:{batch:e,hooks:{useDispatch:n,useSelector:r,useStore:i},unstable__sideEffectsInRender:s,createSelector:o},serializeQueryArgs:a,context:c}){const l=s?v=>v():B.useEffect,u=v=>v.current?.unsubscribe?.(),d=c.endpointDefinitions;return{buildQueryHooks:m,buildInfiniteQueryHooks:b,buildMutationHook:_,usePrefetch:f};function h(v,S,w){if(S?.endpointName&&v.isUninitialized){const{endpointName:A}=S,O=d[A];w!==Ne&&a({queryArgs:S.originalArgs,endpointDefinition:O,endpointName:A})===a({queryArgs:w,endpointDefinition:O,endpointName:A})&&(S=void 0)}let R=v.isSuccess?v.data:S?.data;R===void 0&&(R=v.data);const C=R!==void 0,y=v.isLoading,E=(!S||S.isLoading||S.isUninitialized)&&!C&&y,k=v.isSuccess||C&&(y&&!S?.isError||v.isUninitialized);return{...v,data:R,currentData:v.data,isFetching:y,isLoading:E,isSuccess:k}}function p(v,S,w){if(S?.endpointName&&v.isUninitialized){const{endpointName:A}=S,O=d[A];w!==Ne&&a({queryArgs:S.originalArgs,endpointDefinition:O,endpointName:A})===a({queryArgs:w,endpointDefinition:O,endpointName:A})&&(S=void 0)}let R=v.isSuccess?v.data:S?.data;R===void 0&&(R=v.data);const C=R!==void 0,y=v.isLoading,E=(!S||S.isLoading||S.isUninitialized)&&!C&&y,k=v.isSuccess||y&&C;return{...v,data:R,currentData:v.data,isFetching:y,isLoading:E,isSuccess:k}}function f(v,S){const w=n(),R=Kt(S);return B.useCallback((C,y)=>w(t.util.prefetch(v,C,{...R,...y})),[v,w,R])}function I(v,S,{refetchOnReconnect:w,refetchOnFocus:R,refetchOnMountOrArgChange:C,skip:y=!1,pollingInterval:E=0,skipPollingIfUnfocused:k=!1,...A}={}){const{initiate:O}=t.endpoints[v],M=n(),W=B.useRef(void 0);if(!W.current){const $=M(t.internalActions.internal_getRTKQSubscriptions());W.current=$}const N=Rs(y?Ne:S),x=Kt({refetchOnReconnect:w,refetchOnFocus:R,pollingInterval:E,skipPollingIfUnfocused:k}),V=A.initialPageParam,z=Kt(V),ee=A.refetchCachedPages,G=Kt(ee),q=B.useRef(void 0);let{queryCacheKey:re,requestId:te}=q.current||{},U=!1;re&&te&&(U=W.current.isRequestSubscribed(re,te));const ae=!U&&q.current!==void 0;return l(()=>{ae&&(q.current=void 0)},[ae]),l(()=>{const $=q.current;if(N===Ne){$?.unsubscribe(),q.current=void 0;return}const Y=q.current?.subscriptionOptions;if(!$||$.arg!==N){$?.unsubscribe();const Ie=M(O(N,{subscriptionOptions:x,forceRefetch:C,...dh(d[v])?{initialPageParam:z,refetchCachedPages:G}:{}}));q.current=Ie}else x!==Y&&$.updateSubscriptionOptions(x)},[M,O,C,N,x,ae,z,G,v]),[q,M,O,x]}function g(v,S){return(R,{skip:C=!1,selectFromResult:y}={})=>{const{select:E}=t.endpoints[v],k=Rs(C?Ne:R),A=B.useRef(void 0),O=B.useMemo(()=>o([E(k),(V,z)=>z,V=>k],S,{memoizeOptions:{resultEqualityCheck:Kn}}),[E,k]),M=B.useMemo(()=>y?o([O],y,{devModeChecks:{identityFunctionCheck:"never"}}):O,[O,y]),W=r(V=>M(V,A.current),Kn),N=i(),x=O(N.getState(),A.current);return $w(()=>{A.current=x},[x]),W}}function T(v){B.useEffect(()=>()=>{u(v),v.current=void 0},[v])}function P(v){if(!v.current)throw new Error(Ae(38));return v.current.refetch()}function m(v){const S=(C,y={})=>{const[E]=I(v,C,y);return T(E),B.useMemo(()=>({refetch:()=>P(E)}),[E])},w=({refetchOnReconnect:C,refetchOnFocus:y,pollingInterval:E=0,skipPollingIfUnfocused:k=!1}={})=>{const{initiate:A}=t.endpoints[v],O=n(),[M,W]=B.useState(Ts),N=B.useRef(void 0),x=Kt({refetchOnReconnect:C,refetchOnFocus:y,pollingInterval:E,skipPollingIfUnfocused:k});l(()=>{const G=N.current?.subscriptionOptions;x!==G&&N.current?.updateSubscriptionOptions(x)},[x]);const V=B.useRef(x);l(()=>{V.current=x},[x]);const z=B.useCallback(function(G,q=!1){let re;return e(()=>{u(N),N.current=re=O(A(G,{subscriptionOptions:V.current,forceRefetch:!q})),W(G)}),re},[O,A]),ee=B.useCallback(()=>{N.current?.queryCacheKey&&O(t.internalActions.removeQueryResult({queryCacheKey:N.current?.queryCacheKey}))},[O]);return B.useEffect(()=>()=>{u(N)},[]),B.useEffect(()=>{M!==Ts&&!N.current&&z(M,!0)},[M,z]),B.useMemo(()=>[z,M,{reset:ee}],[z,M,ee])},R=g(v,h);return{useQueryState:R,useQuerySubscription:S,useLazyQuerySubscription:w,useLazyQuery(C){const[y,E,{reset:k}]=w(C),A=R(E,{...C,skip:E===Ts}),O=B.useMemo(()=>({lastArg:E}),[E]);return B.useMemo(()=>[y,{...A,reset:k},O],[y,A,k,O])},useQuery(C,y){const E=S(C,y),k=R(C,{selectFromResult:C===Ne||y?.skip?void 0:hl,...y}),A=ks(k,...Ps);return B.useDebugValue(A),B.useMemo(()=>({...k,...E}),[k,E])}}}function b(v){const S=(R,C={})=>{const[y,E,k,A]=I(v,R,C),O=B.useRef(A);l(()=>{O.current=A},[A]);const M=C.refetchCachedPages,W=Kt(M),N=B.useCallback(function(z,ee){let G;return e(()=>{u(y),y.current=G=E(k(z,{subscriptionOptions:O.current,direction:ee}))}),G},[y,E,k]);T(y);const x=Rs(C.skip?Ne:R),V=B.useCallback(z=>{if(!y.current)throw new Error(Ae(38));const ee={refetchCachedPages:z?.refetchCachedPages??W};return y.current.refetch(ee)},[y,W]);return B.useMemo(()=>({trigger:N,refetch:V,fetchNextPage:()=>N(x,"forward"),fetchPreviousPage:()=>N(x,"backward")}),[V,N,x])},w=g(v,p);return{useInfiniteQueryState:w,useInfiniteQuerySubscription:S,useInfiniteQuery(R,C){const{refetch:y,fetchNextPage:E,fetchPreviousPage:k}=S(R,C),A=w(R,{selectFromResult:R===Ne||C?.skip?void 0:hl,...C}),O=ks(A,...Ps,"hasNextPage","hasPreviousPage");return B.useDebugValue(O),B.useMemo(()=>({...A,fetchNextPage:E,fetchPreviousPage:k,refetch:y}),[A,E,k,y])}}}function _(v){return({selectFromResult:S,fixedCacheKey:w}={})=>{const{select:R,initiate:C}=t.endpoints[v],y=n(),[E,k]=B.useState();B.useEffect(()=>()=>{E?.arg.fixedCacheKey||E?.reset()},[E]);const A=B.useCallback(function(G){const q=y(C(G,{fixedCacheKey:w}));return k(q),q},[y,C,w]),{requestId:O}=E||{},M=B.useMemo(()=>R({fixedCacheKey:w,requestId:E?.requestId}),[w,E,R]),W=B.useMemo(()=>S?o([M],S):M,[S,M]),N=r(W,Kn),x=w==null?E?.arg.originalArgs:void 0,V=B.useCallback(()=>{e(()=>{E&&k(void 0),w&&y(t.internalActions.removeMutationResult({requestId:O,fixedCacheKey:w}))})},[y,w,E,O]),z=ks(N,...Ps,"endpointName");B.useDebugValue(z);const ee=B.useMemo(()=>({...N,originalArgs:x,reset:V}),[N,x,V]);return B.useMemo(()=>[A,ee],[A,ee])}}}var Qw=Symbol(),Kw=({batch:t=rw,hooks:e={useDispatch:Zb,useSelector:nw,useStore:Jd},createSelector:n=ca,unstable__sideEffectsInRender:r=!1,...i}={})=>({name:Qw,init(s,{serializeQueryArgs:o},a){const c=s,{buildQueryHooks:l,buildInfiniteQueryHooks:u,buildMutationHook:d,usePrefetch:h}=Gw({api:s,moduleOptions:{batch:t,hooks:e,unstable__sideEffectsInRender:r,createSelector:n},serializeQueryArgs:o,context:a});return On(c,{usePrefetch:h}),On(a,{batch:t}),{injectEndpoint(p,f){if(Ww(f)){const{useQuery:I,useLazyQuery:g,useLazyQuerySubscription:T,useQueryState:P,useQuerySubscription:m}=l(p);On(c.endpoints[p],{useQuery:I,useLazyQuery:g,useLazyQuerySubscription:T,useQueryState:P,useQuerySubscription:m}),s[`use${Hr(p)}Query`]=I,s[`useLazy${Hr(p)}Query`]=g}if(Vw(f)){const I=d(p);On(c.endpoints[p],{useMutation:I}),s[`use${Hr(p)}Mutation`]=I}else if(dh(f)){const{useInfiniteQuery:I,useInfiniteQuerySubscription:g,useInfiniteQueryState:T}=u(p);On(c.endpoints[p],{useInfiniteQuery:I,useInfiniteQuerySubscription:g,useInfiniteQueryState:T}),s[`use${Hr(p)}InfiniteQuery`]=I}}}}}),Yw=lh(uh(),Kw());const Jw="/api/v1";async function Xw(){if(typeof window>"u")return null;try{const{auth:t}=ia(),e=t.currentUser;if(e)return await e.getIdToken()}catch{}return null}const Zw=mw({baseUrl:Jw,prepareHeaders:async t=>{const e=await Xw();return e&&t.set("Authorization",`Bearer ${e}`),t}}),eE=async(t,e,n)=>typeof window>"u"?{data:{}}:Zw(t,e,n),tE=Yw({reducerPath:"editorialApi",baseQuery:eE,tagTypes:["schema","data","files","config","dataDiff"],endpoints:t=>({getConfig:t.query({query:()=>"/config",providesTags:[{type:"config"}]}),pull:t.mutation({query:()=>({url:"/pull",method:"POST"})}),push:t.mutation({query:({author:e})=>({url:"/push",method:"POST",body:{author:e}})}),publish:t.mutation({query:({author:e})=>({url:"/publish",method:"POST",body:{author:e}}),invalidatesTags:()=>[{type:"dataDiff"}]}),getSchema:t.query({query:()=>"/schema",providesTags:[{type:"schema"}]}),getSchemaType:t.query({query:()=>"/schema",transformResponse:(e,n,r)=>e[r]||null,providesTags:(e,n,r)=>[{type:"schema",id:r}]}),getData:t.query({query:()=>"/data?preview=true",providesTags:()=>[{type:"data"}]}),getDataDiff:t.query({query:()=>"/environments/diff",providesTags:()=>[{type:"dataDiff"}]}),getDataCount:t.query({query:()=>"/data?preview=true",transformResponse(e){return Object.values(e).reduce((r,i)=>r+Object.keys(i).length,0)}}),getDataObject:t.query({query:()=>"/data?preview=true",transformResponse:(e,n,{itemType:r,id:i})=>e[r]?.[i]||null,providesTags:(e,n,{itemType:r,id:i})=>[{type:"data",id:`${r}-${i}`}]}),getFiles:t.query({query:()=>"/files",transformResponse:e=>e.files,providesTags:()=>[{type:"files"}]}),getFileCount:t.query({query:()=>"/files",transformResponse:e=>{function n(i){let s=i.type==="file"?1:0;return i.children&&i.children.length>0&&(s+=i.children.reduce((o,a)=>o+n(a),0)),s}function r(i){return i.reduce((s,o)=>s+n(o),0)}return r(e.files)},providesTags:()=>[{type:"files"}]}),getFilesTotalSize:t.query({query:()=>"/files",transformResponse:e=>e.totalSize,providesTags:()=>[{type:"files"}]}),deleteFile:t.mutation({query:e=>({url:"/files",method:"DELETE",body:{path:e}}),invalidatesTags:()=>[{type:"files"}]}),uploadFiles:t.mutation({query:({files:e,path:n})=>{const r=new FormData;return Array.from(e).forEach(i=>{r.append("files",i)}),n&&r.append("path",n),{url:"/files",method:"PUT",body:r}},invalidatesTags:()=>[{type:"files"}]}),createDirectory:t.mutation({query:({name:e,path:n})=>({url:"/files/directory",method:"POST",body:{name:e,path:n}}),invalidatesTags:()=>[{type:"files"}]}),updateObject:t.mutation({query:({id:e,type:n,newId:r,...i})=>({url:`/data/${n}/${e}`,method:"PATCH",body:{id:e,type:n,newId:r,...i}}),invalidatesTags:(e,n)=>n?[]:[{type:"data"},{type:"dataDiff"}]}),createObject:t.mutation({query:({id:e,type:n,...r})=>({url:`/data/${n}/${e}`,method:"PUT",body:{id:e,type:n,...r}}),invalidatesTags:()=>[{type:"data"},{type:"dataDiff"}]}),deleteObject:t.mutation({query:({id:e,type:n})=>({url:`/data/${n}/${e}`,method:"DELETE"}),invalidatesTags:()=>[{type:"data"},{type:"dataDiff"}]})})}),{useCreateDirectoryMutation:aI,useCreateObjectMutation:cI,useDeleteFileMutation:lI,useDeleteObjectMutation:uI,useGetConfigQuery:dI,useGetDataCountQuery:hI,useGetDataObjectQuery:fI,useGetDataQuery:pI,useGetDataDiffQuery:gI,useGetFileCountQuery:mI,useGetFilesQuery:_I,useGetSchemaQuery:yI,useGetSchemaTypeQuery:vI,usePublishMutation:bI,usePullMutation:wI,usePushMutation:EI,useUpdateObjectMutation:II,useUploadFilesMutation:CI}=tE;function hh(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=hh(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function nE(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=hh(t))&&(r&&(r+=" "),r+=e);return r}const rE=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},iE=(t,e)=>({classGroupId:t,validator:e}),fh=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xi="-",fl=[],sE="arbitrary..",oE=t=>{const e=cE(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return aE(o);const a=o.split(xi),c=a[0]===""&&a.length>1?1:0;return ph(a,c,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const c=r[o],l=n[o];return c?l?rE(l,c):c:l||fl}return n[o]||fl}}},ph=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const l=ph(t,e+1,s);if(l)return l}const o=n.validators;if(o===null)return;const a=e===0?t.join(xi):t.slice(e).join(xi),c=o.length;for(let l=0;l<c;l++){const u=o[l];if(u.validator(a))return u.classGroupId}},aE=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?sE+r:void 0})(),cE=t=>{const{theme:e,classGroups:n}=t;return lE(n,e)},lE=(t,e)=>{const n=fh();for(const r in t){const i=t[r];_a(i,n,r,e)}return n},_a=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];uE(o,e,n,r)}},uE=(t,e,n,r)=>{if(typeof t=="string"){dE(t,e,n);return}if(typeof t=="function"){hE(t,e,n,r);return}fE(t,e,n,r)},dE=(t,e,n)=>{const r=t===""?e:gh(e,t);r.classGroupId=n},hE=(t,e,n,r)=>{if(pE(t)){_a(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(iE(n,t))},fE=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,c]=i[o];_a(c,gh(e,a),n,r)}},gh=(t,e)=>{let n=t;const r=e.split(xi),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=fh(),n.nextPart.set(o,a)),n=a}return n},pE=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,gE=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},uo="!",pl=":",mE=[],gl=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),_E=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let o=0,a=0,c=0,l;const u=i.length;for(let I=0;I<u;I++){const g=i[I];if(o===0&&a===0){if(g===pl){s.push(i.slice(c,I)),c=I+1;continue}if(g==="/"){l=I;continue}}g==="["?o++:g==="]"?o--:g==="("?a++:g===")"&&a--}const d=s.length===0?i:i.slice(c);let h=d,p=!1;d.endsWith(uo)?(h=d.slice(0,-1),p=!0):d.startsWith(uo)&&(h=d.slice(1),p=!0);const f=l&&l>c?l-c:void 0;return gl(s,p,h,f)};if(e){const i=e+pl,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):gl(mE,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},yE=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],a=o[0]==="[",c=e.has(o);a||c?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},vE=t=>({cache:gE(t.cacheSize),parseClassName:_E(t),sortModifiers:yE(t),...oE(t)}),bE=/\s+/,wE=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(bE);let c="";for(let l=a.length-1;l>=0;l-=1){const u=a[l],{isExternal:d,modifiers:h,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:I}=n(u);if(d){c=u+(c.length>0?" "+c:c);continue}let g=!!I,T=r(g?f.substring(0,I):f);if(!T){if(!g){c=u+(c.length>0?" "+c:c);continue}if(T=r(f),!T){c=u+(c.length>0?" "+c:c);continue}g=!1}const P=h.length===0?"":h.length===1?h[0]:s(h).join(":"),m=p?P+uo:P,b=m+T;if(o.indexOf(b)>-1)continue;o.push(b);const _=i(T,g);for(let v=0;v<_.length;++v){const S=_[v];o.push(m+S)}c=u+(c.length>0?" "+c:c)}return c},EE=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=mh(n))&&(i&&(i+=" "),i+=r);return i},mh=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=mh(t[r]))&&(n&&(n+=" "),n+=e);return n},IE=(t,...e)=>{let n,r,i,s;const o=c=>{const l=e.reduce((u,d)=>d(u),t());return n=vE(l),r=n.cache.get,i=n.cache.set,s=a,a(c)},a=c=>{const l=r(c);if(l)return l;const u=wE(c,n);return i(c,u),u};return s=o,(...c)=>s(EE(...c))},CE=[],le=t=>{const e=n=>n[t]||CE;return e.isThemeGetter=!0,e},_h=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,SE=/^\d+\/\d+$/,TE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,PE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yt=t=>SE.test(t),Q=t=>!!t&&!Number.isNaN(Number(t)),ot=t=>!!t&&Number.isInteger(Number(t)),As=t=>t.endsWith("%")&&Q(t.slice(0,-1)),He=t=>TE.test(t),NE=()=>!0,OE=t=>RE.test(t)&&!kE.test(t),vh=()=>!1,DE=t=>PE.test(t),xE=t=>AE.test(t),ME=t=>!L(t)&&!F(t),LE=t=>Cn(t,Eh,vh),L=t=>_h.test(t),kt=t=>Cn(t,Ih,OE),Ns=t=>Cn(t,BE,Q),ml=t=>Cn(t,bh,vh),FE=t=>Cn(t,wh,xE),jr=t=>Cn(t,Ch,DE),F=t=>yh.test(t),Dn=t=>Sn(t,Ih),UE=t=>Sn(t,qE),_l=t=>Sn(t,bh),WE=t=>Sn(t,Eh),VE=t=>Sn(t,wh),$r=t=>Sn(t,Ch,!0),Cn=(t,e,n)=>{const r=_h.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Sn=(t,e,n=!1)=>{const r=yh.exec(t);return r?r[1]?e(r[1]):n:!1},bh=t=>t==="position"||t==="percentage",wh=t=>t==="image"||t==="url",Eh=t=>t==="length"||t==="size"||t==="bg-size",Ih=t=>t==="length",BE=t=>t==="number",qE=t=>t==="family-name",Ch=t=>t==="shadow",zE=()=>{const t=le("color"),e=le("font"),n=le("text"),r=le("font-weight"),i=le("tracking"),s=le("leading"),o=le("breakpoint"),a=le("container"),c=le("spacing"),l=le("radius"),u=le("shadow"),d=le("inset-shadow"),h=le("text-shadow"),p=le("drop-shadow"),f=le("blur"),I=le("perspective"),g=le("aspect"),T=le("ease"),P=le("animate"),m=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...b(),F,L],v=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],w=()=>[F,L,c],R=()=>[Yt,"full","auto",...w()],C=()=>[ot,"none","subgrid",F,L],y=()=>["auto",{span:["full",ot,F,L]},ot,F,L],E=()=>[ot,"auto",F,L],k=()=>["auto","min","max","fr",F,L],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...w()],W=()=>[Yt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],N=()=>[t,F,L],x=()=>[...b(),_l,ml,{position:[F,L]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",WE,LE,{size:[F,L]}],ee=()=>[As,Dn,kt],G=()=>["","none","full",l,F,L],q=()=>["",Q,Dn,kt],re=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>[Q,As,_l,ml],ae=()=>["","none",f,F,L],$=()=>["none",Q,F,L],Y=()=>["none",Q,F,L],Ie=()=>[Q,F,L],he=()=>[Yt,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[He],breakpoint:[He],color:[NE],container:[He],"drop-shadow":[He],ease:["in","out","in-out"],font:[ME],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[He],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[He],shadow:[He],spacing:["px",Q],text:[He],"text-shadow":[He],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Yt,L,F,g]}],container:["container"],columns:[{columns:[Q,L,F,a]}],"break-after":[{"break-after":m()}],"break-before":[{"break-before":m()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:v()}],"overflow-x":[{"overflow-x":v()}],"overflow-y":[{"overflow-y":v()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[ot,"auto",F,L]}],basis:[{basis:[Yt,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Q,Yt,"auto","initial","none",L]}],grow:[{grow:["",Q,F,L]}],shrink:[{shrink:["",Q,F,L]}],order:[{order:[ot,"first","last","none",F,L]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:y()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:y()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[a,"screen",...W()]}],"min-w":[{"min-w":[a,"screen","none",...W()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Dn,kt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,F,Ns]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",As,L]}],"font-family":[{font:[UE,L,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,F,L]}],"line-clamp":[{"line-clamp":[Q,"none",F,Ns]}],leading:[{leading:[s,...w()]}],"list-image":[{"list-image":["none",F,L]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",F,L]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Q,"from-font","auto",F,kt]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Q,"auto",F,L]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",F,L]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",F,L]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:x()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ot,F,L],radial:["",F,L],conic:[ot,F,L]},VE,FE]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Q,F,L]}],"outline-w":[{outline:["",Q,Dn,kt]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",u,$r,jr]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",d,$r,jr]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Q,kt]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",h,$r,jr]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Q,F,L]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Q]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[F,L]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Q]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:x()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",F,L]}],filter:[{filter:["","none",F,L]}],blur:[{blur:ae()}],brightness:[{brightness:[Q,F,L]}],contrast:[{contrast:[Q,F,L]}],"drop-shadow":[{"drop-shadow":["","none",p,$r,jr]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",Q,F,L]}],"hue-rotate":[{"hue-rotate":[Q,F,L]}],invert:[{invert:["",Q,F,L]}],saturate:[{saturate:[Q,F,L]}],sepia:[{sepia:["",Q,F,L]}],"backdrop-filter":[{"backdrop-filter":["","none",F,L]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[Q,F,L]}],"backdrop-contrast":[{"backdrop-contrast":[Q,F,L]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Q,F,L]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Q,F,L]}],"backdrop-invert":[{"backdrop-invert":["",Q,F,L]}],"backdrop-opacity":[{"backdrop-opacity":[Q,F,L]}],"backdrop-saturate":[{"backdrop-saturate":[Q,F,L]}],"backdrop-sepia":[{"backdrop-sepia":["",Q,F,L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",F,L]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Q,"initial",F,L]}],ease:[{ease:["linear","initial",T,F,L]}],delay:[{delay:[Q,F,L]}],animate:[{animate:["none",P,F,L]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[I,F,L]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:$()}],"rotate-x":[{"rotate-x":$()}],"rotate-y":[{"rotate-y":$()}],"rotate-z":[{"rotate-z":$()}],scale:[{scale:Y()}],"scale-x":[{"scale-x":Y()}],"scale-y":[{"scale-y":Y()}],"scale-z":[{"scale-z":Y()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[F,L,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:he()}],"translate-x":[{"translate-x":he()}],"translate-y":[{"translate-y":he()}],"translate-z":[{"translate-z":he()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",F,L]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",F,L]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[Q,Dn,kt,Ns]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},HE=IE(zE),jE=["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];function SI(...t){return HE(nE(t))}function TI(t,e=1){if(t===0)return"0 bytes";const n=1024,r=Math.floor(Math.log(t)/Math.log(n)),i=t/Math.pow(n,r);return`${parseFloat(i.toFixed(e))} ${jE[r]}`}const ho=60*1e3,fo=ho*60,Mi=fo*24,yl=Mi*30,vl=Mi*365;function RI(t,e=!1){const r=new Date().getTime()-t.getTime(),i=r<0,s=Math.abs(r);let o,a;if(s<ho)o=Math.round(s/1e3),a=o===1?"second":"seconds";else if(s<fo)o=Math.round(s/ho),a=o===1?"minute":"minutes";else if(s<Mi)o=Math.round(s/fo),a=o===1?"hour":"hours";else if(s<yl&&e)o=Math.round(s/Mi),a=o===1?"day":"days";else if(s<vl&&e)o=Math.round(s/yl),a=o===1?"month":"months";else if(e)o=Math.round(s/vl),a=o===1?"year":"years";else{const c=String(t.getDate()).padStart(2,"0"),l=String(t.getMonth()+1).padStart(2,"0"),u=t.getFullYear();return`${c}/${l}/${u}`}return i?`in ${o} ${a}`:`${o} ${a} ago`}const kI={added:"bg-green-100 text-green-800",modified:"bg-yellow-100 text-yellow-800",deleted:"bg-red-100 text-red-800"};export{II as A,wo as B,QE as C,_I as D,lI as E,CI as F,aI as G,TI as H,Zb as I,nw as J,Jd as K,$c as L,ia as M,YE as N,gg as O,sI as P,uu as Q,KE as R,XE as S,Qt as T,Aa as _,nI as a,SI as b,iI as c,yI as d,tE as e,rI as f,eI as g,pI as h,tI as i,bI as j,wI as k,EI as l,RI as m,kI as n,JE as o,gI as p,hI as q,ZE as r,oI as s,mI as t,dI as u,vI as v,uI as w,nE as x,fI as y,cI as z};