{"size": 20459, "ext": "js", "max_stars_repo_path": "vue-storage-idb-message.js", "max_stars_repo_name": "lllllxt/vue-storage-idb-message", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "vue-storage-idb-message.js", "max_issues_repo_name": "lllllxt/vue-storage-idb-message", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "vue-storage-idb-message.js", "max_forks_repo_name": "lllllxt/vue-storage-idb-message", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 10229.5, "max_line_length": 20458, "alphanum_fraction": 0.6652817831}
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VueStorageIdbMessage=e()}(this,(function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=e((function(t,e){t.exports=function(){function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}return new(function(){function e(n){t(this,e),this.listener=new Map(n)}return n(e,[{key:"on",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";"function"==typeof e&&(this.listener.has(t)||this.listener.set(t,[]),this.listener.get(t).push({fn:e,group:n}))}},{key:"once",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";if("function"==typeof e){var r=this;this.on(t,o,n)}function o(){r.off(t,o,n),e.apply(r,arguments)}}},{key:"off",value:function(t,e,n){var r=this.listener.get(t)||[],o=null;t?e&&(o=n?r.filter((function(t){return t.group!==n||t.fn!==e})):r.filter((function(t){return t.fn!==e&&t.group!==e}))).length>0?this.listener.set(t,o):this.listener.delete(t):this.listener.clear()}},{key:"removeGroup",value:function(t){var e=this;if(!t)return!1;this.listener.forEach((function(n,r){var o=n.filter((function(e){return e.group!==t}));o.length>0?e.listener.set(r,o):e.listener.delete(r)}))}},{key:"emit",value:function(t){for(var e=this,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(this.listener.get(t)||[]).forEach((function(t){var n;(n=t.fn).call.apply(n,[e].concat(r))}))}}]),e}())}()})),r=e((function(e,n){e.exports=function(){function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function r(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{};function i(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return c(t,null==e?n.path:e)}},n.exports),n.exports}function c(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var u=function(t){return t&&t.Math==Math&&t},a=u("object"==typeof globalThis&&globalThis)||u("object"==typeof window&&window)||u("object"==typeof self&&self)||u("object"==typeof o&&o)||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},s=!f((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),l=function(t){return"object"==typeof t?null!==t:"function"==typeof t},p=a.document,v=l(p)&&l(p.createElement),d=function(t){return v?p.createElement(t):{}},h=!s&&!f((function(){return 7!=Object.defineProperty(d("div"),"a",{get:function(){return 7}}).a})),y=function(t){if(!l(t))throw TypeError(String(t)+" is not an object");return t},g=function(t,e){if(!l(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!l(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!l(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!l(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},m=Object.defineProperty,b={f:s?m:function(t,e,n){if(y(t),e=g(e,!0),y(n),h)try{return m(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},S=s?function(t,e,n){return b.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},j=function(t,e){try{S(a,t,e)}catch(n){a[t]=e}return e},E="__core-js_shared__",O=a[E]||j(E,{}),T=i((function(t){(t.exports=function(t,e){return O[t]||(O[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),_={}.hasOwnProperty,A=function(t,e){return _.call(t,e)},x=0,D=Math.random(),k=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++x+D).toString(36)},P=!!Object.getOwnPropertySymbols&&!f((function(){return!String(Symbol())})),M=P&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,R=T("wks"),I=a.Symbol,C=M?I:I&&I.withoutSetter||k,$=function(t){return A(R,t)||(P&&A(I,t)?R[t]=I[t]:R[t]=C("Symbol."+t)),R[t]},K=$("toStringTag"),N={};N[K]="z";var G="[object z]"===String(N),L=Function.toString;"function"!=typeof O.inspectSource&&(O.inspectSource=function(t){return L.call(t)});var F,Y,q,z=O.inspectSource,B=a.WeakMap,V="function"==typeof B&&/native code/.test(z(B)),W=T("keys"),J=function(t){return W[t]||(W[t]=k(t))},U={},H=a.WeakMap,Q=function(t){return q(t)?Y(t):F(t,{})},X=function(t){return function(e){var n;if(!l(e)||(n=Y(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}};if(V){var Z=new H,tt=Z.get,et=Z.has,nt=Z.set;F=function(t,e){return nt.call(Z,t,e),e},Y=function(t){return tt.call(Z,t)||{}},q=function(t){return et.call(Z,t)}}else{var rt=J("state");U[rt]=!0,F=function(t,e){return S(t,rt,e),e},Y=function(t){return A(t,rt)?t[rt]:{}},q=function(t){return A(t,rt)}}var ot={set:F,get:Y,has:q,enforce:Q,getterFor:X},it=i((function(t){var e=ot.get,n=ot.enforce,r=String(String).split("String");(t.exports=function(t,e,o,i){var c=!!i&&!!i.unsafe,u=!!i&&!!i.enumerable,f=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||A(o,"name")||S(o,"name",e),n(o).source=r.join("string"==typeof e?e:"")),t!==a?(c?!f&&t[e]&&(u=!0):delete t[e],u?t[e]=o:S(t,e,o)):u?t[e]=o:j(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||z(this)}))})),ct={}.toString,ut=function(t){return ct.call(t).slice(8,-1)},at=$("toStringTag"),ft="Arguments"==ut(function(){return arguments}()),st=function(t,e){try{return t[e]}catch(t){}},lt=G?ut:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=st(e=Object(t),at))?n:ft?ut(e):"Object"==(r=ut(e))&&"function"==typeof e.callee?"Arguments":r},pt=G?{}.toString:function(){return"[object "+lt(this)+"]"};G||it(Object.prototype,"toString",pt,{unsafe:!0});var vt={}.propertyIsEnumerable,dt=Object.getOwnPropertyDescriptor,ht={f:dt&&!vt.call({1:2},1)?function(t){var e=dt(this,t);return!!e&&e.enumerable}:vt},yt="".split,gt=f((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==ut(t)?yt.call(t,""):Object(t)}:Object,mt=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},bt=function(t){return gt(mt(t))},wt=Object.getOwnPropertyDescriptor,St={f:s?wt:function(t,e){if(t=bt(t),e=g(e,!0),h)try{return wt(t,e)}catch(t){}if(A(t,e))return w(!ht.f.call(t,e),t[e])}},jt=a,Et=function(t){return"function"==typeof t?t:void 0},Ot=function(t,e){return arguments.length<2?Et(jt[t])||Et(a[t]):jt[t]&&jt[t][e]||a[t]&&a[t][e]},Tt=Math.ceil,_t=Math.floor,At=function(t){return isNaN(t=+t)?0:(t>0?_t:Tt)(t)},xt=Math.min,Dt=function(t){return t>0?xt(At(t),9007199254740991):0},kt=Math.max,Pt=Math.min,Mt=function(t,e){var n=At(t);return n<0?kt(n+e,0):Pt(n,e)},Rt=function(t){return function(e,n,r){var o,i=bt(e),c=Dt(i.length),u=Mt(r,c);if(t&&n!=n){for(;c>u;)if((o=i[u++])!=o)return!0}else for(;c>u;u++)if((t||u in i)&&i[u]===n)return t||u||0;return!t&&-1}},It=(Rt(!0),Rt(!1)),Ct=function(t,e){var n,r=bt(t),o=0,i=[];for(n in r)!A(U,n)&&A(r,n)&&i.push(n);for(;e.length>o;)A(r,n=e[o++])&&(~It(i,n)||i.push(n));return i},$t=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),Kt={f:Object.getOwnPropertyNames||function(t){return Ct(t,$t)}},Nt={f:Object.getOwnPropertySymbols},Gt=Ot("Reflect","ownKeys")||function(t){var e=Kt.f(y(t)),n=Nt.f;return n?e.concat(n(t)):e},Lt=function(t,e){for(var n=Gt(e),r=b.f,o=St.f,i=0;i<n.length;i++){var c=n[i];A(t,c)||r(t,c,o(e,c))}},Ft=/#|\.prototype\./,Yt=function(t,e){var n=zt[qt(t)];return n==Vt||n!=Bt&&("function"==typeof e?f(e):!!e)},qt=Yt.normalize=function(t){return String(t).replace(Ft,".").toLowerCase()},zt=Yt.data={},Bt=Yt.NATIVE="N",Vt=Yt.POLYFILL="P",Wt=Yt,Jt=St.f,Ut=function(t,e){var n,r,o,i,c,u=t.target,f=t.global,s=t.stat;if(n=f?a:s?a[u]||j(u,{}):(a[u]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(c=Jt(n,r))&&c.value:n[r],!Wt(f?r:u+(s?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;Lt(i,o)}(t.sham||o&&o.sham)&&S(i,"sham",!0),it(n,r,i,t)}},Ht=a.Promise,Qt=function(t,e,n){for(var r in e)it(t,r,e[r],n);return t},Xt=b.f,Zt=$("toStringTag"),te=function(t,e,n){t&&!A(t=n?t:t.prototype,Zt)&&Xt(t,Zt,{configurable:!0,value:e})},ee=$("species"),ne=function(t){var e=Ot(t),n=b.f;s&&e&&!e[ee]&&n(e,ee,{configurable:!0,get:function(){return this}})},re=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},oe=function(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t},ie={},ce=$("iterator"),ue=Array.prototype,ae=function(t){return void 0!==t&&(ie.Array===t||ue[ce]===t)},fe=function(t,e,n){if(re(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}},se=$("iterator"),le=function(t){if(null!=t)return t[se]||t["@@iterator"]||ie[lt(t)]},pe=function(t,e,n,r){try{return r?e(y(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&y(o.call(t)),e}},ve=i((function(t){var e=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,n,r,o,i){var c,u,a,f,s,l,p,v=fe(n,r,o?2:1);if(i)c=t;else{if("function"!=typeof(u=le(t)))throw TypeError("Target is not iterable");if(ae(u)){for(a=0,f=Dt(t.length);f>a;a++)if((s=o?v(y(p=t[a])[0],p[1]):v(t[a]))&&s instanceof e)return s;return new e(!1)}c=u.call(t)}for(l=c.next;!(p=l.call(c)).done;)if("object"==typeof(s=pe(c,v,p.value,o))&&s&&s instanceof e)return s;return new e(!1)}).stop=function(t){return new e(!0,t)}})),de=$("iterator"),he=!1;try{var ye=0,ge={next:function(){return{done:!!ye++}},return:function(){he=!0}};ge[de]=function(){return this},Array.from(ge,(function(){throw 2}))}catch(t){}var me,be,we,Se=function(t,e){if(!e&&!he)return!1;var n=!1;try{var r={};r[de]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},je=$("species"),Ee=function(t,e){var n,r=y(t).constructor;return void 0===r||null==(n=y(r)[je])?e:re(n)},Oe=Ot("document","documentElement"),Te=Ot("navigator","userAgent")||"",_e=/(iphone|ipod|ipad).*applewebkit/i.test(Te),Ae=a.location,xe=a.setImmediate,De=a.clearImmediate,ke=a.process,Pe=a.MessageChannel,Me=a.Dispatch,Re=0,Ie={},Ce="onreadystatechange",$e=function(t){if(Ie.hasOwnProperty(t)){var e=Ie[t];delete Ie[t],e()}},Ke=function(t){return function(){$e(t)}},Ne=function(t){$e(t.data)},Ge=function(t){a.postMessage(t+"",Ae.protocol+"//"+Ae.host)};xe&&De||(xe=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return Ie[++Re]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},me(Re),Re},De=function(t){delete Ie[t]},"process"==ut(ke)?me=function(t){ke.nextTick(Ke(t))}:Me&&Me.now?me=function(t){Me.now(Ke(t))}:Pe&&!_e?(we=(be=new Pe).port2,be.port1.onmessage=Ne,me=fe(we.postMessage,we,1)):!a.addEventListener||"function"!=typeof postMessage||a.importScripts||f(Ge)||"file:"===Ae.protocol?me=Ce in d("script")?function(t){Oe.appendChild(d("script"))[Ce]=function(){Oe.removeChild(this),$e(t)}}:function(t){setTimeout(Ke(t),0)}:(me=Ge,a.addEventListener("message",Ne,!1)));var Le,Fe,Ye,qe,ze,Be,Ve,We,Je={set:xe,clear:De},Ue=St.f,He=Je.set,Qe=a.MutationObserver||a.WebKitMutationObserver,Xe=a.process,Ze=a.Promise,tn="process"==ut(Xe),en=Ue(a,"queueMicrotask"),nn=en&&en.value;nn||(Le=function(){var t,e;for(tn&&(t=Xe.domain)&&t.exit();Fe;){e=Fe.fn,Fe=Fe.next;try{e()}catch(t){throw Fe?qe():Ye=void 0,t}}Ye=void 0,t&&t.enter()},tn?qe=function(){Xe.nextTick(Le)}:Qe&&!_e?(ze=!0,Be=document.createTextNode(""),new Qe(Le).observe(Be,{characterData:!0}),qe=function(){Be.data=ze=!ze}):Ze&&Ze.resolve?(Ve=Ze.resolve(void 0),We=Ve.then,qe=function(){We.call(Ve,Le)}):qe=function(){He.call(a,Le)});var rn,on,cn=nn||function(t){var e={fn:t,next:void 0};Ye&&(Ye.next=e),Fe||(Fe=e,qe()),Ye=e},un=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=re(e),this.reject=re(n)},an={f:function(t){return new un(t)}},fn=function(t,e){if(y(t),l(e)&&e.constructor===t)return e;var n=an.f(t);return(0,n.resolve)(e),n.promise},sn=function(t,e){var n=a.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))},ln=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},pn=a.process,vn=pn&&pn.versions,dn=vn&&vn.v8;dn?on=(rn=dn.split("."))[0]+rn[1]:Te&&(!(rn=Te.match(/Edge\/(\d+)/))||rn[1]>=74)&&(rn=Te.match(/Chrome\/(\d+)/))&&(on=rn[1]);var hn,yn,gn,mn,bn=on&&+on,wn=Je.set,Sn=$("species"),jn="Promise",En=ot.get,On=ot.set,Tn=ot.getterFor(jn),_n=Ht,An=a.TypeError,xn=a.document,Dn=a.process,kn=Ot("fetch"),Pn=an.f,Mn=Pn,Rn="process"==ut(Dn),In=!!(xn&&xn.createEvent&&a.dispatchEvent),Cn="unhandledrejection",$n="rejectionhandled",Kn=0,Nn=1,Gn=2,Ln=1,Fn=2,Yn=Wt(jn,(function(){if(z(_n)===String(_n)){if(66===bn)return!0;if(!Rn&&"function"!=typeof PromiseRejectionEvent)return!0}if(bn>=51&&/native code/.test(_n))return!1;var t=_n.resolve(1),e=function(t){t((function(){}),(function(){}))};return(t.constructor={})[Sn]=e,!(t.then((function(){}))instanceof e)})),qn=Yn||!Se((function(t){_n.all(t).catch((function(){}))})),zn=function(t){var e;return!(!l(t)||"function"!=typeof(e=t.then))&&e},Bn=function(t,e,n){if(!e.notified){e.notified=!0;var r=e.reactions;cn((function(){for(var o=e.value,i=e.state==Nn,c=0;r.length>c;){var u,a,f,s=r[c++],l=i?s.ok:s.fail,p=s.resolve,v=s.reject,d=s.domain;try{l?(i||(e.rejection===Fn&&Un(t,e),e.rejection=Ln),!0===l?u=o:(d&&d.enter(),u=l(o),d&&(d.exit(),f=!0)),u===s.promise?v(An("Promise-chain cycle")):(a=zn(u))?a.call(u,p,v):p(u)):v(o)}catch(t){d&&!f&&d.exit(),v(t)}}e.reactions=[],e.notified=!1,n&&!e.rejection&&Wn(t,e)}))}},Vn=function(t,e,n){var r,o;In?((r=xn.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),a.dispatchEvent(r)):r={promise:e,reason:n},(o=a["on"+t])?o(r):t===Cn&&sn("Unhandled promise rejection",n)},Wn=function(t,e){wn.call(a,(function(){var n,r=e.value;if(Jn(e)&&(n=ln((function(){Rn?Dn.emit("unhandledRejection",r,t):Vn(Cn,t,r)})),e.rejection=Rn||Jn(e)?Fn:Ln,n.error))throw n.value}))},Jn=function(t){return t.rejection!==Ln&&!t.parent},Un=function(t,e){wn.call(a,(function(){Rn?Dn.emit("rejectionHandled",t):Vn($n,t,e.value)}))},Hn=function(t,e,n,r){return function(o){t(e,n,o,r)}},Qn=function(t,e,n,r){e.done||(e.done=!0,r&&(e=r),e.value=n,e.state=Gn,Bn(t,e,!0))},Xn=function(t,e,n,r){if(!e.done){e.done=!0,r&&(e=r);try{if(t===n)throw An("Promise can't be resolved itself");var o=zn(n);o?cn((function(){var r={done:!1};try{o.call(n,Hn(Xn,t,r,e),Hn(Qn,t,r,e))}catch(n){Qn(t,r,n,e)}})):(e.value=n,e.state=Nn,Bn(t,e,!1))}catch(n){Qn(t,{done:!1},n,e)}}};Yn&&(_n=function(t){oe(this,_n,jn),re(t),hn.call(this);var e=En(this);try{t(Hn(Xn,this,e),Hn(Qn,this,e))}catch(t){Qn(this,e,t)}},(hn=function(t){On(this,{type:jn,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:Kn,value:void 0})}).prototype=Qt(_n.prototype,{then:function(t,e){var n=Tn(this),r=Pn(Ee(this,_n));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=Rn?Dn.domain:void 0,n.parent=!0,n.reactions.push(r),n.state!=Kn&&Bn(this,n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),yn=function(){var t=new hn,e=En(t);this.promise=t,this.resolve=Hn(Xn,t,e),this.reject=Hn(Qn,t,e)},an.f=Pn=function(t){return t===_n||t===gn?new yn(t):Mn(t)},"function"==typeof Ht&&(mn=Ht.prototype.then,it(Ht.prototype,"then",(function(t,e){var n=this;return new _n((function(t,e){mn.call(n,t,e)})).then(t,e)}),{unsafe:!0}),"function"==typeof kn&&Ut({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return fn(_n,kn.apply(a,arguments))}}))),Ut({global:!0,wrap:!0,forced:Yn},{Promise:_n}),te(_n,jn,!1),ne(jn),gn=Ot(jn),Ut({target:jn,stat:!0,forced:Yn},{reject:function(t){var e=Pn(this);return e.reject.call(void 0,t),e.promise}}),Ut({target:jn,stat:!0,forced:Yn},{resolve:function(t){return fn(this,t)}}),Ut({target:jn,stat:!0,forced:qn},{all:function(t){var e=this,n=Pn(e),r=n.resolve,o=n.reject,i=ln((function(){var n=re(e.resolve),i=[],c=0,u=1;ve(t,(function(t){var a=c++,f=!1;i.push(void 0),u++,n.call(e,t).then((function(t){f||(f=!0,i[a]=t,--u||r(i))}),o)})),--u||r(i)}));return i.error&&o(i.value),n.promise},race:function(t){var e=this,n=Pn(e),r=n.reject,o=ln((function(){var o=re(e.resolve);ve(t,(function(t){o.call(e,t).then(n.resolve,r)}))}));return o.error&&r(o.value),n.promise}});var Zn="STORAGE_ORDER_DATA",tr=function(){function t(){var n=this,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e(this,t);var o=function(){var e=window.indexedDB.open(Zn,1);e.onsuccess=function(e){t.db=n.db=e.target.result},e.onerror=function(t){console.error("❌打开数据库",t)},e.onupgradeneeded=function(t){n.db=t.target.result,n.db,n.db.objectStoreNames.contains("ORDER_DATA")&&n.db.deleteObjectStore("ORDER_DATA");var e=n.db.createObjectStore("ORDER_DATA",{keyPath:"order_name"});e.createIndex("order_name","order_name",{unique:!1}),e.createIndex("order_value","order_value",{unique:!1})}};r?t.clearCache((function(){return o()})):o()}return r(t,[{key:"save",value:function(t,e){var n=this;return new Promise((function(r,o){var i=n.db.transaction(["ORDER_DATA"],"readwrite").objectStore("ORDER_DATA").put({order_name:t,order_value:e});i.onsuccess=function(t){r(t)},i.onerror=function(t){console.error("数据写入失败",t),o(t)}}))}},{key:"remove",value:function(t){var e=this;return new Promise((function(n,r){var o=e.db.transaction(["ORDER_DATA"],"readwrite").objectStore("ORDER_DATA").delete(t);o.onsuccess=function(t){n(t)},o.onerror=function(t){console.error("删除数据失败",t),r(t)}}))}},{key:"get",value:function(t){var e=this;return new Promise((function(n,r){var o=e.db.transaction(["ORDER_DATA"],"readonly").objectStore("ORDER_DATA").index("order_name").get(t);o.onerror=function(t){console.error("❌获取数据失败",t),r(t)},o.onsuccess=function(t){n(o.result)}}))}}],[{key:"clearCache",value:function(t,e){var n;null==this||null===(n=this.db)||void 0===n||n.close();var r=window.indexedDB.deleteDatabase(Zn);r.onerror=function(t){e&&e(t)},r.onsuccess=function(e){t&&t(e)}}}]),t}(),er=function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.storageKey,o=void 0===r?"StorageIdbMessageOrder":r,i=n.clearIdb,c=void 0===i||i,u=n.force,a=void 0!==u&&u;e(this,t),this.storageKey=o,this.clearIdb=c,this.force=a};return function(){function t(n){var r=this;e(this,t);var o=new er(n),i=o.storageKey,c=o.clearIdb,u=o.force;this.idb=new tr(u),this.STORAGE_KEY=i,window.addEventListener("storage",(function(t){if(t.key===r.STORAGE_KEY){var e=JSON.parse(t.newValue).order;r.idb.get(e).then((function(t){var e=t.order_name,n=t.order_value;r.response(e,n),c&&r.idb.remove(e)}))}}))}return r(t,[{key:"send",value:function(t,e){var n=this;this.idb.save(t,e).then((function(){var e=Math.random();localStorage.setItem(n.STORAGE_KEY,JSON.stringify({order:t,random:e}))}))}},{key:"response",value:function(t,e){}}],[{key:"clearCache",value:function(t,e){tr.clearCache(t,e)}}]),t}()}()}));return{install:function(t,e){var o=(null==e?void 0:e.name)||"SIM",i="$"+o,c=new r(e);c.response=function(t,e){n.emit(o+"_"+t,e)},t.prototype[i]=c,t.mixin({data:function(){return{$$SIM_KEY:Math.random()}},created:function(){var t=this;this.$options[o]=this.$options[o]||{};var e=this.$options[o];Object.keys(e).forEach((function(r){n.on(o+"_"+r,e[r].bind(t),t.$data.$$SIM_KEY)})),this[i]=this[i]||{}},beforeDestroy:function(){n.removeGroup(this.$data.$$SIM_KEY),this.$options[o]=null}});var u=t.config.optionMergeStrategies;u[o]=u.methods}}}));
