"use strict";(self["webpackChunksgc_mobile"]=self["webpackChunksgc_mobile"]||[]).push([[505],{6531:function(e,t,n){n.d(t,{Lj:function(){return E},X3:function(){return B}});const r=(e,t)=>t.some((t=>e instanceof t));let o,s;function i(){return o||(o=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function a(){return s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const c=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,l=new WeakMap;function p(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",o),e.removeEventListener("error",s)},o=()=>{t(I(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",o),e.addEventListener("error",s)}));return t.then((t=>{t instanceof IDBCursor&&c.set(t,e)})).catch((()=>{})),l.set(t,e),t}function b(e){if(u.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",s),e.removeEventListener("abort",s)},o=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",o),e.addEventListener("error",s),e.addEventListener("abort",s)}));u.set(e,t)}let D={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return u.get(e);if("objectStoreNames"===t)return e.objectStoreNames||d.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return I(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function v(e){D=e(D)}function g(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?a().includes(e)?function(...t){return e.apply(h(this),t),I(c.get(this))}:function(...t){return I(e.apply(h(this),t))}:function(t,...n){const r=e.call(h(this),t,...n);return d.set(r,t.sort?t.sort():[t]),I(r)}}function m(e){return"function"===typeof e?g(e):(e instanceof IDBTransaction&&b(e),r(e,i())?new Proxy(e,D):e)}function I(e){if(e instanceof IDBRequest)return p(e);if(f.has(e))return f.get(e);const t=m(e);return t!==e&&(f.set(e,t),l.set(t,e)),t}const h=e=>l.get(e);function B(e,t,{blocked:n,upgrade:r,blocking:o,terminated:s}={}){const i=indexedDB.open(e,t),a=I(i);return r&&i.addEventListener("upgradeneeded",(e=>{r(I(i.result),e.oldVersion,e.newVersion,I(i.transaction))})),n&&i.addEventListener("blocked",(()=>n())),a.then((e=>{s&&e.addEventListener("close",(()=>s())),o&&e.addEventListener("versionchange",(()=>o()))})).catch((()=>{})),a}function E(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",(()=>t())),I(n).then((()=>{}))}const y=["get","getKey","getAll","getAllKeys","count"],L=["put","add","delete","clear"],w=new Map;function k(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!==typeof t)return;if(w.get(t))return w.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=L.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!o&&!y.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,o?"readwrite":"readonly");let i=s.store;return r&&(i=i.index(t.shift())),(await Promise.all([i[n](...t),o&&s.done]))[0]};return w.set(t,s),s}v((e=>({...e,get:(t,n,r)=>k(t,n)||e.get(t,n,r),has:(t,n)=>!!k(t,n)||e.has(t,n)})))}}]);
//# sourceMappingURL=chunk-vendors-839c41ae.64fadebe.js.map