1import{A as k,e as F,f as x,j as y,r as S,s as A}from"./chunk-XFTCJCDX.js";import{a as q,b as _,j as c}from"./chunk-TWZW5B45.js";var he=(e,t)=>t.some(n=>e instanceof n),V,$;function me(){return V||(V=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function we(){return $||($=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var H=new WeakMap,C=new WeakMap,K=new WeakMap,E=new WeakMap,P=new WeakMap;function Ie(e){let t=new Promise((n,r)=>{let a=()=>{e.removeEventListener("success",o),e.removeEventListener("error",s)},o=()=>{n(d(e.result)),a()},s=()=>{r(e.error),a()};e.addEventListener("success",o),e.addEventListener("error",s)});return t.then(n=>{n instanceof IDBCursor&&H.set(n,e)}).catch(()=>{}),P.set(t,e),t}function be(e){if(C.has(e))return;let t=new Promise((n,r)=>{let a=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",s),e.removeEventListener("abort",s)},o=()=>{n(),a()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),a()};e.addEventListener("complete",o),e.addEventListener("error",s),e.addEventListener("abort",s)});C.set(e,t)}var D={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return C.get(e);if(t==="objectStoreNames")return e.objectStoreNames||K.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return d(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function U(e){D=e(D)}function Te(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){let r=e.call(w(this),t,...n);return K.set(r,t.sort?t.sort():[t]),d(r)}:we().includes(e)?function(...t){return e.apply(w(this),t),d(H.get(this))}:function(...t){return d(e.apply(w(this),t))}}function ye(e){return typeof e=="function"?Te(e):(e instanceof IDBTransaction&&be(e),he(e,me())?new Proxy(e,D):e)}function d(e){if(e instanceof IDBRequest)return Ie(e);if(E.has(e))return E.get(e);let t=ye(e);return t!==e&&(E.set(e,t),P.set(t,e)),t}var w=e=>P.get(e);function J(e,t,{blocked:n,upgrade:r,blocking:a,terminated:o}={}){let s=indexedDB.open(e,t),i=d(s);return r&&s.addEventListener("upgradeneeded",u=>{r(d(s.result),u.oldVersion,u.newVersion,d(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),i.then(u=>{o&&u.addEventListener("close",()=>o()),a&&u.addEventListener("versionchange",()=>a())}).catch(()=>{}),i}function dt(e,{blocked:t}={}){let n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),d(n).then(()=>{})}var Se=["get","getKey","getAll","getAllKeys","count"],Ae=["put","add","delete","clear"],R=new Map;function W(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(R.get(t))return R.get(t);let n=t.replace(/FromIndex$/,""),r=t!==n,a=Ae.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(a||Se.includes(n)))return;let o=function(s,...i){return c(this,null,function*(){let u=this.transaction(s,a?"readwrite":"readonly"),l=u.store;return r&&(l=l.index(i.shift())),(yield Promise.all([l[n](...i),a&&u.done]))[0]})};return R.set(t,o),o}U(e=>_(q({},e),{get:(t,n,r)=>W(t,n)||e.get(t,n,r),has:(t,n)=>!!W(t,n)||e.has(t,n)}));var X="@firebase/installations",B="0.6.4";var Y=1e4,Q=`w:${B}`,Z="FIS_v2",ke="https://firebaseinstallations.googleapis.com/v1",Ee=60*60*1e3,Ce="installations",De="Installations";var Pe={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},h=new x(Ce,De,Pe);function ee(e){return e instanceof F&&e.code.includes("request-failed")}function te({projectId:e}){return`${ke}/projects/${e}/installations`}
1function ne(e){return{token:e.token,requestStatus:2,expiresIn:Ne(e.expiresIn),creationTime:Date.now()}}function re(e,t){return c(this,null,function*(){let r=(yield t.json()).error;return h.create("request-failed",{requestName:e,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})})}function oe({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function Re(e,{refreshToken:t}){let n=oe(e);return n.append("Authorization",ve(t)),n}function se(e){return c(this,null,function*(){let t=yield e();return t.status>=500&&t.status<600?e():t})}function Ne(e){return Number(e.replace("s","000"))}function ve(e){return`${Z} ${e}`}function Oe(r,a){return c(this,arguments,function*({appConfig:e,heartbeatServiceProvider:t},{fid:n}){let o=te(e),s=oe(e),i=t.getImmediate({optional:!0});if(i){let f=yield i.getHeartbeatsHeader();f&&s.append("x-firebase-client",f)}let u={fid:n,authVersion:Z,appId:e.appId,sdkVersion:Q},l={method:"POST",headers:s,body:JSON.stringify(u)},p=yield se(()=>fetch(o,l));if(p.ok){let f=yield p.json();return{fid:f.fid||n,registrationStatus:2,refreshToken:f.refreshToken,authToken:ne(f.authToken)}}else throw yield re("Create Installation",p)})}function ae(e){return new Promise(t=>{setTimeout(t,e)})}function Be(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")}var je=/^[cdef][\w-]{21}$/,O="";function Le(){try{let e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;let n=Me(e);return je.test(n)?n:O}catch{return O}}function Me(e){return Be(e).substr(0,22)}function b(e){return`${e.appName}!${e.appId}`}var ie=new Map;function ce(e,t){let n=b(e);ue(n,t),qe(n,t)}function ue(e,t){let n=ie.get(e);if(n)for(let r of n)r(t)}function qe(e,t){let n=_e();n&&n.postMessage({key:e,fid:t}),Fe()}var g=null;function _e(){return!g&&"BroadcastChannel"in self&&(g=new BroadcastChannel("[Firebase] FID Change"),g.onmessage=e=>{ue(e.data.key,e.data.fid)}),g}function Fe(){ie.size===0&&g&&(g.close(),g=null)}var xe="firebase-installations-database",Ve=1,m="firebase-installations-store",N=null;function j(){return N||(N=J(xe,Ve,{upgrade:(e,t)=>{switch(t){case 0:e.createObjectStore(m)}}})),N}function I(e,t){return c(this,null,function*(){let n=b(e),a=(yield j()).transaction(m,"readwrite"),o=a.objectStore(m),s=yield o.get(n);return yield o.put(t,n),yield a.done,(!s||s.fid!==t.fid)&&ce(e,t.fid),t})}function fe(e){return c(this,null,function*(){let t=b(e),r=(yield j()).transaction(m,"readwrite");yield r.objectStore(m).delete(t),yield r.done})}function T(e,t){return c(this,null,function*(){let n=b(e),a=(yield j()).transaction(m,"readwrite"),o=a.objectStore(m),s=yield o.get(n),i=t(s);return i===void 0?yield o.delete(n):yield o.put(i,n),yield a.done,i&&(!s||s.fid!==i.fid)&&ce(e,i.fid),i})}function L(e){return c(this,null,function*(){let t,n=yield T(e.appConfig,r=>{let a=$e(r),o=He(e,a);return t=o.registrationPromise,o.installationEntry});return n.fid===O?{installationEntry:yield t}:{installationEntry:n,registrationPromise:t}})}function $e(e){let t=e||{fid:Le(),registrationStatus:0};return de(t)}function He(e,t){if(t.registrationStatus===0){if(!navigator.onLine){let a=Prom
1ise.reject(h.create("app-offline"));return{installationEntry:t,registrationPromise:a}}let n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=Ke(e,n);return{installationEntry:n,registrationPromise:r}}else return t.registrationStatus===1?{installationEntry:t,registrationPromise:Ue(e)}:{installationEntry:t}}function Ke(e,t){return c(this,null,function*(){try{let n=yield Oe(e,t);return I(e.appConfig,n)}catch(n){throw ee(n)&&n.customData.serverCode===409?yield fe(e.appConfig):yield I(e.appConfig,{fid:t.fid,registrationStatus:0}),n}})}function Ue(e){return c(this,null,function*(){let t=yield z(e.appConfig);for(;t.registrationStatus===1;)yield ae(100),t=yield z(e.appConfig);if(t.registrationStatus===0){let{installationEntry:n,registrationPromise:r}=yield L(e);return r||n}return t})}function z(e){return T(e,t=>{if(!t)throw h.create("installation-not-found");return de(t)})}function de(e){return We(e)?{fid:e.fid,registrationStatus:0}:e}function We(e){return e.registrationStatus===1&&e.registrationTime+Y<Date.now()}function Je(r,a){return c(this,arguments,function*({appConfig:e,heartbeatServiceProvider:t},n){let o=ze(e,n),s=Re(e,n),i=t.getImmediate({optional:!0});if(i){let f=yield i.getHeartbeatsHeader();f&&s.append("x-firebase-client",f)}let u={installation:{sdkVersion:Q,appId:e.appId}},l={method:"POST",headers:s,body:JSON.stringify(u)},p=yield se(()=>fetch(o,l));if(p.ok){let f=yield p.json();return ne(f)}else throw yield re("Generate Auth Token",p)})}function ze(e,{fid:t}){return`${te(e)}/${t}/authTokens:generate`}function M(e,t=!1){return c(this,null,function*(){let n,r=yield T(e.appConfig,o=>{if(!le(o))throw h.create("not-registered");let s=o.authToken;if(!t&&Ye(s))return o;if(s.requestStatus===1)return n=Ge(e,t),o;{if(!navigator.onLine)throw h.create("app-offline");let i=Ze(o);return n=Xe(e,i),i}});return n?yield n:r.authToken})}function Ge(e,t){return c(this,null,function*(){let n=yield G(e.appConfig);for(;n.authToken.requestStatus===1;)yield ae(100),n=yield G(e.appConfig);let r=n.authToken;return r.requestStatus===0?M(e,t):r})}function G(e){return T(e,t=>{if(!le(t))throw h.create("not-registered");let n=t.authToken;return et(n)?Object.assign(Object.assign({},t),{authToken:{requestStatus:0}}):t})}function Xe(e,t){return c(this,null,function*(){try{let n=yield Je(e,t),r=Object.assign(Object.assign({},t),{authToken:n});return yield I(e.appConfig,r),n}catch(n){if(ee(n)&&(n.customData.serverCode===401||n.customData.serverCode===404))yield fe(e.appConfig);else{let r=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});yield I(e.appConfig,r)}throw n}})}function le(e){return e!==void 0&&e.registrationStatus===2}function Ye(e){return e.requestStatus===2&&!Qe(e)}function Qe(e){let t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+Ee}function Ze(e){let t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}function et(e){return e.requestStatus===1&&e.requestTime+Y<Date.now()}function tt(e){return c(this,null,function*(){let t=e,{installationEntry:n,registrationPromise:r}=yield L(t);return r?r.catch(console.error):M(t).catch(console.error),n.fid})}function nt(e,t=!1){return c(this,null,function*(){let n=e;return yield rt(n),(yield M(n,t)).token})}function rt(e){return c(this,null,function*(){let{registrationPromise:t}=yield L(e);t&&(yield t)})}function ot(e){if(!e||!e.options)throw v("App Configuration");if(!e.name)throw v("App Name");let t=["projectId","apiKey","appId"];for(let n of t)if(!e.options[n])throw v(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}function v(e){return h.create("missing-app-config-values",{valueName:e})}var pe="installations",st="installations-internal",at=e=>{let t=e.getProvider("app").getImmediate(),n=ot(t),r=A(t,"heartbeat");return{app:t,appConfig:n,heartbeatServiceProvider:r,_delete:()=>Promise.resolve()}},it=e=>{let t=e.getProvider("app").getImmediate(),n=A(t,pe).getImmediate();return{getId:()=>tt(n),getToken:a=>nt(n,a)}};function ct(){S(new y(pe,at,"PUBLIC")),S(new y(st,it,"PRIVATE"))}ct();k(X,B);k(X,B,"esm2017");export{J as a,dt as b};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.