Plugin Directory

Changeset 3273925


Ignore:
Timestamp:
04/15/2025 08:35:14 PM (12 months ago)
Author:
lavour
Message:

fix error that perform the comunication

Location:
docu-chat/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • docu-chat/trunk/admin/modules/docuchat_activation_module.php

    r3259221 r3273925  
    1111    <form id="activate_form" class="docuchatMain_container_body_content_form">
    1212        <input type="number" name="code" maxlength="4" required>
     13        <?php wp_nonce_field( 'activate' ); ?>
    1314        <input type="submit" value="Activate" class="docuchatMain_container_body_content_form_submit">
    1415    </form>
  • docu-chat/trunk/admin/modules/docuchat_document_module.php

    r3259221 r3273925  
    33if (! defined('ABSPATH')) exit;
    44
     5 
    56function docuchat_document_module()
    67{
     
    1718    </div>
    1819    <form id="document_form" enctype="multipart/form-data" class="docuchatMain_container_body_content_form">
     20    <?php wp_nonce_field( 'upload' ); ?>
    1921        <div class="docuchatMain_container_body_content_form_wrapper">
    2022            <div class="docuchatMain_container_body_content_form_wrapper_input">
     
    2729            </div>
    2830        </div>
    29 
     31       
    3032        <input type="submit" value="Upload" class="docuchatMain_container_body_content_form_submit">
    3133    </form>
  • docu-chat/trunk/admin/modules/docuchat_register_module.php

    r3259221 r3273925  
    4444          "docu-chat"
    4545        ); ?></label>
    46        
     46      <?php wp_nonce_field( 'register' ); ?>
    4747    </div>
    4848    <input type="submit" value=<?php echo esc_attr('Register', 'docu-chat');  ?> class="docuchatMain_container_body_content_form_submit">
  • docu-chat/trunk/helpers/docuchat_plugin_document_uploaded_status.php

    r3259221 r3273925  
    1111        if(isset($_POST["status"]) && !empty($_POST["status"]) &&
    1212        $_POST["status"] == 200 && isset($_POST["nonce"]) && !empty($_POST["nonce"]) &&
    13         wp_verify_nonce( wp_unslash( $_POST["nonce"])  , 'document' ) ){
     13        wp_verify_nonce( wp_unslash( $_POST["nonce"])  , 'upload' ) ){
    1414         
    1515                $getOptions = unserialize( get_option( DOCUCHAT_ACTIVATION_SERIALIZACION ) );
  • docu-chat/trunk/helpers/docuchat_plugin_register.php

    r3259221 r3273925  
    55function docuchat_plugin_register()
    66{
    7     echo wp_json_encode(docuchat_process_token()); 
     7    echo wp_json_encode(docuchat_process_token());   
    88    wp_die();
    99}
  • docu-chat/trunk/helpers/docuchat_plugin_uploadFile.php

    r3259221 r3273925  
    99{
    1010  try {
     11
     12    $token = get_option( DOCUCHAT_TOKEN ) ?  get_option( DOCUCHAT_TOKEN ) : false;
     13
     14
    1115    if (
    1216      isset($_POST["nonce"]) && !empty($_POST["nonce"]) &&
    13       isset($_POST["file"]) && !empty($_POST["file"]) &&
    14       isset($_POST["token"]) && !empty($_POST["token"]) &&
    15       wp_verify_nonce( wp_unslash($_POST["nonce"] ), 'uploadFile')
     17      isset($_POST["file"]) && !empty($_POST["file"]) && 
     18      isset($token) && !empty($token) &&
     19      wp_verify_nonce( wp_unslash($_POST["nonce"] ), 'upload')
    1620    ) {
    1721
    1822                $sanitized_unlashed_file = sanitize_file_name(wp_unslash($_POST["file"]));
    19                 $sanitized_unlashed_token = sanitize_file_name(wp_unslash($_POST["token"]));
     23                $sanitized_unlashed_token = sanitize_file_name(wp_unslash($token));
    2024
    2125                $file_path = get_attached_file(intval($sanitized_unlashed_file));
  • docu-chat/trunk/readme.txt

    r3259221 r3273925  
    44Requires at least: 4.7
    55Tested up to: 6.7
    6 Stable tag: 1.0.0
     6Stable tag: 1.0.1
    77Requires PHP: 7.0
    88License: GPLv2 or later
  • docu-chat/trunk/src/docuchat_backend.js

    r3259221 r3273925  
    11/*! For license information please see docuchat_backend.js.LICENSE.txt */
    2 (()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}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,o(r.key),r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e,n){return(e=o(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(e){var n=function(e){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:n+""}const i=n((function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r(this,"submnitForm",(function(){e.form&&e.form.addEventListener("submit",(function(t){e.message.innerHTML+='<div class="loaderAnimation"><span class="dot"></span></div>',t.preventDefault();var n=new FormData(e.form),r={};n.forEach((function(t,e){r[e]=t})),e.sendInfo(r,e.message)}))})),r(this,"sendInfo",(function(t,n){fetch("https://api.docuchat.es/api/v1/register",{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}).then((function(t){return t.json()})).then((function(t){200==t.status&&e.saveData(t.token,t.email,n),400==t.status&&e.returnExeption(t.message,n)}))})),r(this,"saveData",(function(t,e,n){jQuery.ajax({type:"post",url:ajax.url,dataType:"text",data:"action=register&token=".concat(t,"&email=").concat(e,"&nonce=").concat(ajax.register_nonce),error:function(t){console.error(t)},success:function(t){var e=JSON.parse(t.replace("}0","}"));if(200==e.status){n.innerHTML+='<p class="success">'.concat(e.message,"</p>");var r=setTimeout((function(){n.innerHTML+='<p class="success">Check your email, we\'ve send you a email</p>',clearTimeout(r)}),4e3),o=setTimeout((function(){n.innerHTML+='<p class="success">Automatic reload to next step...</p>',clearTimeout(o)}),8600),i=setTimeout((function(){window.location.reload(),clearTimeout(i)}),13e3)}else n.innerHTML="",n.innerHTML+='<div id="my-note-id" class="notice notice-error is-dismissible my-note-class-1 my-note-class-2">\n          <p>'.concat(e.message,"</p>\n          </div>")}})})),r(this,"returnExeption",(function(t,e){e&&(e.innerHTML+='<p class="error" style="color:red">'.concat(t,"</p>"))})),this.form=document.getElementById("register_form"),this.message=document.getElementsByClassName("docuchatMain_container_body_content_response")[0],this.submnitForm()}));function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(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,s(r.key),r)}}function u(t,e,n){return(e=s(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){var e=function(t){if("object"!=a(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:e+""}const l=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,"sendInfo",(function(t,n){fetch("https://api.docuchat.es/api/v1/activate",{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}).then((function(t){return t.json()})).then((function(t){console.log(t.message),200==t.status?e.saveData(t.message,n):e.returnExeption(t.message,n)}))})),u(this,"saveData",(function(t,e){jQuery.ajax({type:"post",url:ajax.url,dataType:"text",data:"action=activate&status=".concat(t,"&nonce=").concat(ajax.activate_nonce),error:function(t){console.error(t)},success:function(t){var n=JSON.parse(t.replace("}0","}"));if(200==n.status){e.innerHTML+='<p class="success">'.concat(n.message,"</p>");var r=setTimeout((function(){e.innerHTML+='<p class="success">Plugin ready to recive your document.</p>',clearTimeout(r)}),4e3),o=setTimeout((function(){e.innerHTML+='<p class="success">Automatic reload to next step...</p>',clearTimeout(o)}),8600),i=setTimeout((function(){window.location.reload(),clearTimeout(i)}),13e3)}}})})),u(this,"returnExeption",(function(t,e){e.innerHTML+='<p class="error" style="color:red">'.concat(t,"</p>")})),this.form=document.getElementById("activate_form"),this.message=document.getElementsByClassName("docuchatMain_container_body_content_response")[0],this.submnitForm()},e=[{key:"submnitForm",value:function(){var t=this;this.form&&this.form.addEventListener("submit",(function(e){e.preventDefault(),t.message.innerHTML+='<div class="loaderAnimation"><span class="dot"></span></div>',e.target.reset();var n=new FormData(t.form),r={};n.forEach((function(t,e){r[e]=t})),ajax.emailRegistred&&(r.email=ajax.emailRegistred),ajax.token&&(r.token=ajax.token),t.saveData(r,t.message)}))}}],e&&c(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function p(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,y(r.key),r)}}function h(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function y(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}const m=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,"sendInfo",(function(t,n){jQuery.ajax({type:"post",url:ajax.url,dataType:"text",data:"action=uploadFile&token=".concat(t.get("token"),"&file=").concat(t.get("fileNumber"),"&nonce=").concat(ajax.uploadFile_nonce),error:function(t){console.error(t)},success:function(t){var e=JSON.parse(t.replace("}0","}")),r=JSON.parse(e.body);200==r.status?this.saveData(r.status,n):this.returnExeption(r.message,n)}.bind(e)})})),h(this,"saveData",(function(t,e){jQuery.ajax({type:"post",url:ajax.url,dataType:"text",data:"action=document&status=".concat(t,"&nonce=").concat(ajax.document_nonce),error:function(t){console.error(t)},success:function(t){var n=JSON.parse(t.replace("}0","}"));if(200==n.status){e.innerHTML+='<p class="success">'.concat(n.message,"</p>");var r=setTimeout((function(){e.innerHTML+='<p class="success">Document has benn uploaded, now can interact with DocuChat</p>',clearTimeout(r)}),4e3),o=setTimeout((function(){e.innerHTML+='<p class="success">Automatic reload, thanks for using DocuChat</p>',clearTimeout(o)}),8600),i=setTimeout((function(){window.location.reload(),clearTimeout(i)}),1e4)}}})})),h(this,"returnExeption",(function(t,e){e.innerHTML+='<p class="error" style="color:red">'.concat(t,"</p>"),setTimeout((function(){window.location.reload()}),5e3)})),this.form=document.getElementById("document_form"),this.message=document.getElementsByClassName("docuchatMain_container_body_content_response")[0],this.submnitForm()},e=[{key:"submnitForm",value:function(){var t=this;this.form&&this.form.addEventListener("submit",(function(e){e.preventDefault(),t.message.innerHTML+='<div class="loaderAnimation"><span class="dot"></span></div>',t.message.innerHTML+='<p class="success">Please wait, this can take a few minutes..</p>';var n=new FormData(t.form);n.append("token",ajax.token),t.sendInfo(n,t.message)}))}}],e&&p(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function v(){v=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new M(r||[]);return o(a,"_invoke",{value:O(t,n,c)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function x(){}var L={};s(L,a,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(D([])));j&&j!==n&&r.call(j,a)&&(L=j);var T=x.prototype=b.prototype=Object.create(L);function S(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==d(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=P(c,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var s=f(e,n,r);if("normal"===s.type){if(o=r.done?m:h,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=m,r.method="throw",r.arg=s.arg)}}}function P(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,P(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function D(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(d(e)+" is not iterable")}return w.prototype=x,o(T,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:w,configurable:!0}),w.displayName=s(x,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,s(t,u,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(_.prototype),s(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new _(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(T),s(T,u,"Generator"),s(T,a,(function(){return this})),s(T,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=D,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;N(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:D(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function g(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function b(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,w(r.key),r)}}function w(t){var e=function(t){if("object"!=d(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==d(e)?e:e+""}const x=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.deleteButton,this.responseBox,this.init()},e=[{key:"init",value:function(){var t=this;document.getElementsByClassName("docuchatMain_container_delete_left_button")[0]&&(this.responseBox=document.getElementsByClassName("delete_acount_responses")[0],this.deleteButton=document.getElementsByClassName("docuchatMain_container_delete_left_button")[0],this.deleteButton.addEventListener("click",(function(e){e.preventDefault(),t.responseBox.innerHTML="",t.responseBox.innerHTML+='<div class="loaderAnimation"><span class="dot"></span></div>',fetch("https://api.docuchat.es/api/v1/d_acount",{method:"DELETE",body:JSON.stringify({token:ajax.token}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.json()})).then((function(e){t.responseBox.innerHTML="",200==e.status?(t.responseBox.innerHTML+='<p class="success">'.concat(e.message,"</p>"),t.deletePartialData(t.responseBox)):(t.responseBox.innerHTML+='<p class="error">'.concat(e.message,"</p>"),t.deletePartialData(t.responseBox))}))})))}},{key:"deletePartialData",value:(n=v().mark((function t(e){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:jQuery.ajax({type:"post",url:ajax.url,dataType:"text",data:"action=partialDelete&nonce=".concat(ajax.partialDelete_nonce),success:function(t){console.log("🚀 ~ DeleteAcount ~ deletePartialData ~ data:",t);var n=JSON.parse(t);200==n.status&&(e.innerHTML+='<p class="success">'.concat(n.message,"</p>"),setTimeout((function(){window.location.href=ajax.adminUrl}),3e3))},error:function(t){console.log(t);var n=JSON.parse(t);e.innerHTML+='<p class="success">'.concat(n.message,"</p>"),setTimeout((function(){window.location.reload()}),3e3)}});case 1:case"end":return t.stop()}}),t)})),r=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){g(i,r,o,a,c,"next",t)}function c(t){g(i,r,o,a,c,"throw",t)}a(void 0)}))},function(t){return r.apply(this,arguments)})}],e&&b(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function E(){E=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),c=new M(r||[]);return o(a,"_invoke",{value:O(t,n,c)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",y="executing",m="completed",d={};function v(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(D([])));j&&j!==n&&r.call(j,a)&&(w=j);var T=b.prototype=v.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==L(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=P(c,r);if(u){if(u===d)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var s=f(e,n,r);if("normal"===s.type){if(o=r.done?m:h,s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=m,r.method="throw",r.arg=s.arg)}}}function P(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,P(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function D(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(L(e)+" is not iterable")}return g.prototype=b,o(T,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,u,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(_.prototype),s(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new _(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(T),s(T,u,"Generator"),s(T,a,(function(){return this})),s(T,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=D,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;N(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:D(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),d}},e}function j(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function T(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,S(r.key),r)}}function S(t){var e=function(t){if("object"!=L(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==L(e)?e:e+""}const _=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.pdfSelector=document.getElementById("pdfSelector"),this.inputPdfSelector=document.getElementById("fileNumberInput"),this.init()},e=[{key:"init",value:function(){var t=this;this.pdfSelector&&this.pdfSelector.addEventListener("click",(function(e){var n=null,r=t.inputPdfSelector;t.pdfSelector&&t.inputPdfSelector&&t.pdfSelector.addEventListener("click",(function(t){t.preventDefault(),(n=wp.media({title:"Select a pdf 150mb max",button:{text:"Use this pdf"},library:{type:"application/pdf"},multiple:!1})).on("select",function(){var t,e=(t=E().mark((function t(e){var o;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.state().get("selection").first().toJSON();case 2:return o=t.sent,r.value=o.id,t.abrupt("return");case 5:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){j(i,r,o,a,c,"next",t)}function c(t){j(i,r,o,a,c,"throw",t)}a(void 0)}))});return function(t){return e.apply(this,arguments)}}()),n&&n.open()}))}))}}],e&&T(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.addEventListener("load",(function(){window.RegisterForm=new i,window.ActivationForm=new l,window.UploadForm=new m,window.DeleteAcount=new x,window.SelectFileFromMedia=new _}))})();
     2(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}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,o(r.key),r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e,n){return(e=o(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(e){var n=function(e){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:n+""}const i=n((function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r(this,"submnitForm",(function(){e.form&&e.form.addEventListener("submit",(function(t){e.message.innerHTML+='<div class="loaderAnimation"><span class="dot"></span></div>',t.preventDefault();var n=new FormData(e.form),r={};n.forEach((function(t,e){r[e]=t})),e.nonce_now=r._wpnonce,e.sendInfo(r,e.message)}))})),r(this,"sendInfo",(function(t,n){fetch("https://api.docuchat.es/api/v1/register",{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}).then((function(t){return t.json()})).then((function(t){200==t.status&&e.saveData(t.token,t.email,n),400==t.status&&e.returnExeption(t.message,n)}))})),r(this,"saveData",(function(t,n,r){jQuery.ajax({type:"post",url:docuchat_ajax.url,dataType:"text",data:"action=register&token=".concat(t,"&email=").concat(n,"&nonce=").concat(e.nonce_now),error:function(t){console.error(t)},success:function(t){var e=JSON.parse(t.replace("}0","}"));if(200==e.status){r.innerHTML+='<p class="success">'.concat(e.message,"</p>");var n=setTimeout((function(){r.innerHTML+='<p class="success">Check your email, we\'ve send you a email</p>',clearTimeout(n)}),4e3),o=setTimeout((function(){r.innerHTML+='<p class="success">Automatic reload to next step...</p>',clearTimeout(o)}),8600),i=setTimeout((function(){window.location.reload(),clearTimeout(i)}),13e3)}else r.innerHTML="",r.innerHTML+='<div id="my-note-id" class="notice notice-error is-dismissible my-note-class-1 my-note-class-2">\n          <p>'.concat(e.message,"</p>\n          </div>")}})})),r(this,"returnExeption",(function(t,e){e&&(e.innerHTML+='<p class="error" style="color:red">'.concat(t,"</p>"))})),this.form=document.getElementById("register_form"),this.message=document.getElementsByClassName("docuchatMain_container_body_content_response")[0],this.nonce_now,this.submnitForm()}));function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(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,s(r.key),r)}}function u(t,e,n){return(e=s(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){var e=function(t){if("object"!=a(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:e+""}const l=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,"sendInfo",(function(t,n){fetch("https://api.docuchat.es/api/v1/activate",{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}).then((function(t){return t.json()})).then((function(t){200==t.status?e.saveData(t.message,n):e.returnExeption(t.message,n)}))})),u(this,"saveData",(function(t,n){jQuery.ajax({type:"post",url:docuchat_ajax.url,dataType:"text",data:"action=activate&status=".concat(t,"&nonce=").concat(e.nonce_now),error:function(t){console.error(t)},success:function(t){var e=JSON.parse(t.replace("}0","}"));if(200==e.status){n.innerHTML+='<p class="success">'.concat(e.message,"</p>");var r=setTimeout((function(){n.innerHTML+='<p class="success">Plugin ready to recive your document.</p>',clearTimeout(r)}),4e3),o=setTimeout((function(){n.innerHTML+='<p class="success">Automatic reload to next step...</p>',clearTimeout(o)}),8600),i=setTimeout((function(){window.location.reload(),clearTimeout(i)}),13e3)}}})})),u(this,"returnExeption",(function(t,e){e.innerHTML+='<p class="error" style="color:red">'.concat(t,"</p>")})),this.form=document.getElementById("activate_form"),this.message=document.getElementsByClassName("docuchatMain_container_body_content_response")[0],this.nonce_now,this.submnitForm()},e=[{key:"submnitForm",value:function(){var t=this;this.form&&this.form.addEventListener("submit",(function(e){e.preventDefault(),t.message.innerHTML+='<div class="loaderAnimation"><span class="dot"></span></div>';var n=new FormData(t.form),r={};n.forEach((function(t,e){r[e]=t})),docuchat_ajax.emailRegistred&&(r.email=ajax.emailRegistred),docuchat_ajax.token&&(r.token=ajax.token),t.nonce_now=r._wpnonce,t.saveData(r,t.message),e.target.reset()}))}}],e&&c(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function p(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,y(r.key),r)}}function h(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function y(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}const m=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,"sendInfo",(function(t,n){jQuery.ajax({type:"post",url:docuchat_ajax.url,dataType:"text",data:"action=uploadFile&file=".concat(t.get("fileNumber"),"&nonce=").concat(e.nonce_now),error:function(t){console.error(t)},success:function(t){var e=JSON.parse(t.replace("}0","}")),r=JSON.parse(e.body);200==r.status?(n.innerHTML+='<p class="success">'.concat(r.message,"</p>"),this.saveData(r.status,n)):this.returnExeption(r.message,n)}.bind(e)})})),h(this,"saveData",(function(t,n){jQuery.ajax({type:"post",url:docuchat_ajax.url,dataType:"text",data:"action=document&status=".concat(t,"&nonce=").concat(e.nonce_now),error:function(t){console.error(t)},success:function(t){var e=JSON.parse(t.replace("}0","}"));if(200==e.status){n.innerHTML+='<p class="success">'.concat(e.message,"</p>");var r=setTimeout((function(){n.innerHTML+='<p class="success">Document has benn uploaded, now can interact with DocuChat</p>',clearTimeout(r)}),4e3),o=setTimeout((function(){n.innerHTML+='<p class="success">Automatic reload, thanks for using DocuChat</p>',clearTimeout(o)}),8600),i=setTimeout((function(){window.location.reload(),clearTimeout(i)}),1e4)}else this.returnExeption(e.message,n)}})})),h(this,"returnExeption",(function(t,e){e.innerHTML+='<p class="error" style="color:red">'.concat(t,"</p>"),setTimeout((function(){window.location.reload()}),5e3)})),this.form=document.getElementById("document_form"),this.message=document.getElementsByClassName("docuchatMain_container_body_content_response")[0],this.nonce_now,this.submnitForm()},e=[{key:"submnitForm",value:function(){var t=this;this.form&&this.form.addEventListener("submit",(function(e){e.preventDefault(),t.message.innerHTML+='<div class="loaderAnimation"><span class="dot"></span></div>',t.message.innerHTML+='<p class="success">Please wait, this can take a few minutes..</p>';var n=new FormData(t.form);t.nonce_now=n.get("_wpnonce"),t.sendInfo(n,t.message)}))}}],e&&p(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function v(){v=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new M(r||[]);return o(a,"_invoke",{value:O(t,n,c)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function x(){}var L={};s(L,a,(function(){return this}));var E=Object.getPrototypeOf,T=E&&E(E(H([])));T&&T!==n&&r.call(T,a)&&(L=T);var _=x.prototype=b.prototype=Object.create(L);function j(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==d(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=P(c,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var s=f(e,n,r);if("normal"===s.type){if(o=r.done?m:h,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=m,r.method="throw",r.arg=s.arg)}}}function P(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,P(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function H(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(d(e)+" is not iterable")}return w.prototype=x,o(_,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:w,configurable:!0}),w.displayName=s(x,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,s(t,u,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},j(S.prototype),s(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new S(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(_),s(_,u,"Generator"),s(_,a,(function(){return this})),s(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=H,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;N(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:H(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function g(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function b(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,w(r.key),r)}}function w(t){var e=function(t){if("object"!=d(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==d(e)?e:e+""}const x=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.deleteButton,this.responseBox,this.init()},e=[{key:"init",value:function(){var t=this;document.getElementsByClassName("docuchatMain_container_delete_left_button")[0]&&(this.responseBox=document.getElementsByClassName("delete_acount_responses")[0],this.deleteButton=document.getElementsByClassName("docuchatMain_container_delete_left_button")[0],this.deleteButton.addEventListener("click",(function(e){e.preventDefault(),t.responseBox.innerHTML="",t.responseBox.innerHTML+='<div class="loaderAnimation"><span class="dot"></span></div>',fetch("https://api.docuchat.es/api/v1/d_acount",{method:"DELETE",body:JSON.stringify({token:docuchat_ajax.token}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.json()})).then((function(e){t.responseBox.innerHTML="",200==e.status?(t.responseBox.innerHTML+='<p class="success">'.concat(e.message,"</p>"),t.deletePartialData(t.responseBox)):(t.responseBox.innerHTML+='<p class="error">'.concat(e.message,"</p>"),t.deletePartialData(t.responseBox))}))})))}},{key:"deletePartialData",value:(n=v().mark((function t(e){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:jQuery.ajax({type:"post",url:docuchat_ajax.url,dataType:"text",data:"action=partialDelete&nonce=".concat(docuchat_ajax.partialDelete_nonce),success:function(t){var n=JSON.parse(t);200==n.status&&(e.innerHTML+='<p class="success">'.concat(n.message,"</p>"),setTimeout((function(){window.location.href=ajax.adminUrl}),3e3))},error:function(t){var n=JSON.parse(t);e.innerHTML+='<p class="success">'.concat(n.message,"</p>"),setTimeout((function(){window.location.reload()}),3e3)}});case 1:case"end":return t.stop()}}),t)})),r=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){g(i,r,o,a,c,"next",t)}function c(t){g(i,r,o,a,c,"throw",t)}a(void 0)}))},function(t){return r.apply(this,arguments)})}],e&&b(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function E(){E=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),c=new M(r||[]);return o(a,"_invoke",{value:O(t,n,c)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",y="executing",m="completed",d={};function v(){}function g(){}function b(){}var w={};s(w,a,(function(){return this}));var x=Object.getPrototypeOf,T=x&&x(x(H([])));T&&T!==n&&r.call(T,a)&&(w=T);var _=b.prototype=v.prototype=Object.create(w);function j(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==L(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=P(c,r);if(u){if(u===d)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var s=f(e,n,r);if("normal"===s.type){if(o=r.done?m:h,s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=m,r.method="throw",r.arg=s.arg)}}}function P(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,P(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function H(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(L(e)+" is not iterable")}return g.prototype=b,o(_,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,u,"GeneratorFunction")),t.prototype=Object.create(_),t},e.awrap=function(t){return{__await:t}},j(S.prototype),s(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new S(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(_),s(_,u,"Generator"),s(_,a,(function(){return this})),s(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=H,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;N(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:H(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),d}},e}function T(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function _(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,j(r.key),r)}}function j(t){var e=function(t){if("object"!=L(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==L(e)?e:e+""}const S=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.pdfSelector=document.getElementById("pdfSelector"),this.inputPdfSelector=document.getElementById("fileNumberInput"),this.init()},e=[{key:"init",value:function(){var t=this;this.pdfSelector&&this.pdfSelector.addEventListener("click",(function(e){var n=null,r=t.inputPdfSelector;t.pdfSelector&&t.inputPdfSelector&&t.pdfSelector.addEventListener("click",(function(t){t.preventDefault(),(n=wp.media({title:"Select a pdf 150mb max",button:{text:"Use this pdf"},library:{type:"application/pdf"},multiple:!1})).on("select",function(){var t,e=(t=E().mark((function t(e){var o;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.state().get("selection").first().toJSON();case 2:return o=t.sent,r.value=o.id,t.abrupt("return");case 5:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){T(i,r,o,a,c,"next",t)}function c(t){T(i,r,o,a,c,"throw",t)}a(void 0)}))});return function(t){return e.apply(this,arguments)}}()),n&&n.open()}))}))}}],e&&_(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.addEventListener("load",(function(){window.RegisterForm=new i,window.ActivationForm=new l,window.UploadForm=new m,window.DeleteAcount=new x,window.SelectFileFromMedia=new S}))})();
  • docu-chat/trunk/src/docuchat_front.js

    r3259221 r3273925  
    11/*! For license information please see docuchat_front.js.LICENSE.txt */
    2 (()=>{var e={956:function(e,t,n){var r,o,i;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}i=function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)},t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function r(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||((r=r||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,i=Object.keys,u=Array.isArray;function c(e,t){return"object"!=a(t)||i(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||o.Promise||(o.Promise=Promise);var s=Object.getPrototypeOf,l={}.hasOwnProperty;function f(e,t){return l.call(e,t)}function h(e,t){"function"==typeof t&&(t=t(s(e))),("undefined"==typeof Reflect?i:Reflect.ownKeys)(t).forEach((function(n){p(e,n,t[n])}))}var d=Object.defineProperty;function p(e,t,n,r){d(e,t,c(n&&f(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function y(e){return{from:function(t){return e.prototype=Object.create(t.prototype),p(e.prototype,"constructor",e),{extend:h.bind(null,e.prototype)}}}}var v=Object.getOwnPropertyDescriptor,m=[].slice;function b(e,t,n){return m.call(e,t,n)}function g(e,t){return t(e)}function w(e){if(!e)throw new Error("Assertion Failed")}function _(e){o.setImmediate?setImmediate(e):setTimeout(e,0)}function x(e,t){if("string"==typeof t&&f(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,o=t.length;r<o;++r){var i=x(e,t[r]);n.push(i)}return n}var a=t.indexOf(".");if(-1!==a){var u=e[t.substr(0,a)];return null==u?void 0:x(u,t.substr(a+1))}}function k(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){w("string"!=typeof n&&"length"in n);for(var r=0,o=t.length;r<o;++r)k(e,t[r],n[r])}else{var i,a,c=t.indexOf(".");-1!==c?(i=t.substr(0,c),""===(a=t.substr(c+1))?void 0===n?u(e)&&!isNaN(parseInt(i))?e.splice(i,1):delete e[i]:e[i]=n:k(c=(c=e[i])&&f(e,i)?c:e[i]={},a,n)):void 0===n?u(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function E(e){var t,n={};for(t in e)f(e,t)&&(n[t]=e[t]);return n}var O=[].concat;function S(e){return O.apply([],e)}var P="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(S([8,16,32,64].map((function(e){return["Int","Uint","Float"].map((function(t){return t+e+"Array"}))})))).filter((function(e){return o[e]})),j=new Set(P.map((function(e){return o[e]}))),C=null;function K(e){return C=new WeakMap,e=function e(t){if(!t||"object"!=a(t))return t;var n=C.get(t);if(n)return n;if(u(t)){n=[],C.set(t,n);for(var r=0,o=t.length;r<o;++r)n.push(e(t[r]))}else if(j.has(t.constructor))n=t;else{var i,c=s(t);for(i in n=c===Object.prototype?{}:Object.create(c),C.set(t,n),t)f(t,i)&&(n[i]=e(t[i]))}return n}(e),C=null,e}var T={}.toString;function A(e){return T.call(e).slice(8,-1)}var I="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",B="symbol"==a(I)?function(e){var t;return null!=e&&(t=e[I])&&t.apply(e)}:function(){return null};function D(e,t){return 0<=(t=e.indexOf(t))&&e.splice(t,1),0<=t}var q={};function R(e){var t,n,r,o;if(1===arguments.length){if(u(e))return e.slice();if(this===q&&"string"==typeof e)return[e];if(o=B(e)){for(n=[];!(r=o.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"!=typeof(t=e.length))return[e];for(n=new Array(t);t--;)n[t]=e[t];return n}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var L="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},N=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(ce=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"]),M={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function F(e,t){this.name=e,this.message=t}function U(e,t){return e+". Errors: "+Object.keys(t).map((function(e){return t[e].toString()})).filter((function(e,t,n){return n.indexOf(e)===t})).join("\n")}function V(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=U(e,t)}function G(e,t){this.name="BulkError",this.failures=Object.keys(t).map((function(e){return t[e]})),this.failuresByPos=t,this.message=U(e,this.failures)}y(F).from(Error).extend({toString:function(){return this.name+": "+this.message}}),y(V).from(F),y(G).from(F);var z=N.reduce((function(e,t){return e[t]=t+"Error",e}),{}),Y=F,H=N.reduce((function(e,t){var n=t+"Error";function r(e,r){this.name=n,e?"string"==typeof e?(this.message="".concat(e).concat(r?"\n "+r:""),this.inner=r||null):"object"==a(e)&&(this.message="".concat(e.name," ").concat(e.message),this.inner=e):(this.message=M[t]||n,this.inner=null)}return y(r).from(Y),e[t]=r,e}),{});H.Syntax=SyntaxError,H.Type=TypeError,H.Range=RangeError;var W=ce.reduce((function(e,t){return e[t+"Error"]=H[t],e}),{}),$=N.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=H[t]),e}),{});function Q(){}function X(e){return e}function J(e,t){return null==e||e===X?t:function(n){return t(e(n))}}function Z(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ee(e,t){return e===Q?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?Z(r,this.onsuccess):r),o&&(this.onerror=this.onerror?Z(o,this.onerror):o),void 0!==i?i:n}}function te(e,t){return e===Q?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?Z(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Z(r,this.onerror):r)}}function ne(e,t){return e===Q?t:function(n){var r=e.apply(this,arguments);c(n,r);var o=this.onsuccess,i=this.onerror;return this.onsuccess=null,this.onerror=null,n=t.apply(this,arguments),o&&(this.onsuccess=this.onsuccess?Z(o,this.onsuccess):o),i&&(this.onerror=this.onerror?Z(i,this.onerror):i),void 0===r?void 0===n?void 0:n:c(r,n)}}function re(e,t){return e===Q?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function oe(e,t){return e===Q?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,o=arguments.length,i=new Array(o);o--;)i[o]=arguments[o];return n.then((function(){return t.apply(r,i)}))}return t.apply(this,arguments)}}$.ModifyError=V,$.DexieError=F,$.BulkError=G;var ie="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function ae(e){ie=e}var ue={},ce=(P="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,s(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,s(t),e]}(),P[0]),se=(N=P[1],P=P[2],N=N&&N.then,ce&&ce.constructor),le=!!P,fe=function(e,t){ge.push([e,t]),de&&(queueMicrotask(Ce),de=!1)},he=!0,de=!0,pe=[],ye=[],ve=X,me={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Q,pgp:!1,env:{},finalize:Q},be=me,ge=[],we=0,_e=[];function xe(e){if("object"!=a(this))throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=be;if("function"!=typeof e){if(e!==ue)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Oe(this,this._value))}this._state=null,this._value=null,++t.ref,function e(t,n){try{n((function(n){if(null===t._state){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&Ke();n&&"function"==typeof n.then?e(t,(function(e,t){n instanceof xe?n._then(e,t):n.then(e,t)})):(t._state=!0,t._value=n,Se(t)),r&&Te()}}),Oe.bind(null,t))}catch(n){Oe(t,n)}}(this,e)}var ke={get:function(){var e=be,t=Ne;function n(n,r){var o=this,i=!e.global&&(e!==be||t!==Ne),a=i&&!Ve(),u=new xe((function(t,u){Pe(o,new Ee($e(n,e,i,a),$e(r,e,i,a),t,u,e))}));return this._consoleTask&&(u._consoleTask=this._consoleTask),u}return n.prototype=ue,n},set:function(e){p(this,"then",e&&e.prototype===ue?ke:{get:function(){return e},set:ke.set})}};function Ee(e,t,n,r,o){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=o}function Oe(e,t){var n,r;ye.push(t),null===e._state&&(n=e._lib&&Ke(),t=ve(t),e._state=!1,e._value=t,r=e,pe.some((function(e){return e._value===r._value}))||pe.push(r),Se(e),n&&Te())}function Se(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Pe(e,t[n]);var o=e._PSD;--o.ref||o.finalize(),0===we&&(++we,fe((function(){0==--we&&Ae()}),[]))}function Pe(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++we,fe(je,[n,e,t])}else e._listeners.push(t)}function je(e,t,n){try{var r,o=t._value;!t._state&&ye.length&&(ye=[]),r=ie&&t._consoleTask?t._consoleTask.run((function(){return e(o)})):e(o),t._state||-1!==ye.indexOf(o)||function(e){for(var t=pe.length;t;)if(pe[--t]._value===e._value)return pe.splice(t,1)}(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--we&&Ae(),--n.psd.ref||n.psd.finalize()}}function Ce(){We(me,(function(){Ke()&&Te()}))}function Ke(){var e=he;return de=he=!1,e}function Te(){var e,t,n;do{for(;0<ge.length;)for(e=ge,ge=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(0<ge.length);de=he=!0}function Ae(){var e=pe;pe=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));for(var t=_e.slice(0),n=t.length;n;)t[--n]()}function Ie(e){return new xe(ue,!1,e)}function Be(e,t){var n=be;return function(){var r=Ke(),o=be;try{return Ye(n,!0),e.apply(this,arguments)}catch(r){t&&t(r)}finally{Ye(o,!1),r&&Te()}}}h(xe.prototype,{then:ke,_then:function(e,t){Pe(this,new Ee(null,null,e,t,be))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=e,n=arguments[1];return"function"==typeof t?this.then(null,(function(e){return(e instanceof t?n:Ie)(e)})):this.then(null,(function(e){return(e&&e.name===t?n:Ie)(e)}))},finally:function(e){return this.then((function(t){return xe.resolve(e()).then((function(){return t}))}),(function(t){return xe.resolve(e()).then((function(){return Ie(t)}))}))},timeout:function(e,t){var n=this;return e<1/0?new xe((function(r,o){var i=setTimeout((function(){return o(new H.Timeout(t))}),e);n.then(r,o).finally(clearTimeout.bind(null,i))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&p(xe.prototype,Symbol.toStringTag,"Dexie.Promise"),me.env=He(),h(xe,{all:function(){var e=R.apply(null,arguments).map(Ge);return new xe((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(o,i){return xe.resolve(o).then((function(n){e[i]=n,--r||t(e)}),n)}))}))},resolve:function(e){return e instanceof xe?e:e&&"function"==typeof e.then?new xe((function(t,n){e.then(t,n)})):new xe(ue,!0,e)},reject:Ie,race:function(){var e=R.apply(null,arguments).map(Ge);return new xe((function(t,n){e.map((function(e){return xe.resolve(e).then(t,n)}))}))},PSD:{get:function(){return be},set:function(e){return be=e}},totalEchoes:{get:function(){return Ne}},newPSD:Fe,usePSD:We,scheduler:{get:function(){return fe},set:function(e){fe=e}},rejectionMapper:{get:function(){return ve},set:function(e){ve=e}},follow:function(e,t){return new xe((function(n,r){return Fe((function(t,n){var r=be;r.unhandleds=[],r.onunhandled=n,r.finalize=Z((function(){var e,r=this;e=function(){0===r.unhandleds.length?t():n(r.unhandleds[0])},_e.push((function t(){e(),_e.splice(_e.indexOf(t),1)})),++we,fe((function(){0==--we&&Ae()}),[])}),r.finalize),e()}),t,n,r)}))}}),se&&(se.allSettled&&p(xe,"allSettled",(function(){var e=R.apply(null,arguments).map(Ge);return new xe((function(t){0===e.length&&t([]);var n=e.length,r=new Array(n);e.forEach((function(e,o){return xe.resolve(e).then((function(e){return r[o]={status:"fulfilled",value:e}}),(function(e){return r[o]={status:"rejected",reason:e}})).then((function(){return--n||t(r)}))}))}))})),se.any&&"undefined"!=typeof AggregateError&&p(xe,"any",(function(){var e=R.apply(null,arguments).map(Ge);return new xe((function(t,n){0===e.length&&n(new AggregateError([]));var r=e.length,o=new Array(r);e.forEach((function(e,i){return xe.resolve(e).then((function(e){return t(e)}),(function(e){o[i]=e,--r||n(new AggregateError(o))}))}))}))})),se.withResolvers&&(xe.withResolvers=se.withResolvers));var De={awaits:0,echoes:0,id:0},qe=0,Re=[],Le=0,Ne=0,Me=0;function Fe(e,t,n,r){var o=be,i=Object.create(o);return i.parent=o,i.ref=0,i.global=!1,i.id=++Me,me.env,i.env=le?{Promise:xe,PromiseProp:{value:xe,configurable:!0,writable:!0},all:xe.all,race:xe.race,allSettled:xe.allSettled,any:xe.any,resolve:xe.resolve,reject:xe.reject}:{},t&&c(i,t),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()},r=We(i,e,n,r),0===i.ref&&i.finalize(),r}function Ue(){return De.id||(De.id=++qe),++De.awaits,De.echoes+=100,De.id}function Ve(){return!!De.awaits&&(0==--De.awaits&&(De.id=0),De.echoes=100*De.awaits,!0)}function Ge(e){return De.echoes&&e&&e.constructor===se?(Ue(),e.then((function(e){return Ve(),e}),(function(e){return Ve(),Xe(e)}))):e}function ze(){var e=Re[Re.length-1];Re.pop(),Ye(e,!1)}function Ye(e,t){var n,r=be;(t?!De.echoes||Le++&&e===be:!Le||--Le&&e===be)||queueMicrotask(t?function(e){++Ne,De.echoes&&0!=--De.echoes||(De.echoes=De.awaits=De.id=0),Re.push(be),Ye(e,!0)}.bind(null,e):ze),e!==be&&(be=e,r===me&&(me.env=He()),le&&(n=me.env.Promise,t=e.env,(r.global||e.global)&&(Object.defineProperty(o,"Promise",t.PromiseProp),n.all=t.all,n.race=t.race,n.resolve=t.resolve,n.reject=t.reject,t.allSettled&&(n.allSettled=t.allSettled),t.any&&(n.any=t.any))))}function He(){var e=o.Promise;return le?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(o,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function We(e,t,n,r,o){var i=be;try{return Ye(e,!0),t(n,r,o)}finally{Ye(i,!1)}}function $e(e,t,n,r){return"function"!=typeof e?e:function(){var o=be;n&&Ue(),Ye(t,!0);try{return e.apply(this,arguments)}finally{Ye(o,!1),r&&queueMicrotask(Ve)}}}function Qe(e){Promise===se&&0===De.echoes?0===Le?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+N).indexOf("[native code]")&&(Ue=Ve=Q);var Xe=xe.reject,Je=String.fromCharCode(65535),Ze="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",et="String expected.",tt=[],nt="__dbnames",rt="readonly",ot="readwrite";function it(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var at={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function ut(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=K(t))[e],t}}function ct(){throw H.Type()}function st(e,t){try{var n=lt(e),r=lt(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(e,t){for(var n=e.length,r=t.length,o=n<r?n:r,i=0;i<o;++i)if(e[i]!==t[i])return e[i]<t[i]?-1:1;return n===r?0:n<r?-1:1}(ft(e),ft(t));case"Array":return function(e,t){for(var n=e.length,r=t.length,o=n<r?n:r,i=0;i<o;++i){var a=st(e[i],t[i]);if(0!==a)return a}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function lt(e){var t=a(e);return"object"!=t?t:ArrayBuffer.isView(e)||"ArrayBuffer"===(e=A(e))?"binary":e}function ft(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var ht=(dt.prototype._trans=function(e,t,n){var r=this._tx||be.trans,o=this.name,i=ie&&"undefined"!=typeof console&&console.createTask&&console.createTask("Dexie: ".concat("readonly"===e?"read":"write"," ").concat(this.name));function a(e,n,r){if(!r.schema[o])throw new H.NotFound("Table "+o+" not part of transaction");return t(r.idbtrans,r)}var u=Ke();try{var c=r&&r.db._novip===this.db._novip?r===be.trans?r._promise(e,a,n):Fe((function(){return r._promise(e,a,n)}),{trans:r,transless:be.transless||be}):function e(t,n,r,o){if(t.idbdb&&(t._state.openComplete||be.letThrough||t._vip)){var i=t._createTransaction(n,r,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===z.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,o)}))):Xe(i)}return i._promise(n,(function(e,t){return Fe((function(){return be.trans=i,o(e,t,i)}))})).then((function(e){if("readwrite"===n)try{i.idbtrans.commit()}catch(e){}return"readonly"===n?e:i._completion.then((function(){return e}))}))}if(t._state.openComplete)return Xe(new H.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return Xe(new H.DatabaseClosed);t.open().catch(Q)}return t._state.dbReadyPromise.then((function(){return e(t,n,r,o)}))}(this.db,e,[this.name],a);return i&&(c._consoleTask=i,c=c.catch((function(e){return console.trace(e),Xe(e)}))),c}finally{u&&Te()}},dt.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?Xe(new H.Type("Invalid argument to Table.get()")):this._trans("readonly",(function(t){return n.core.get({trans:t,key:e}).then((function(e){return n.hook.reading.fire(e)}))})).then(t)},dt.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(u(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=i(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter((function(e){if(e.compound&&t.every((function(t){return 0<=e.keyPath.indexOf(t)}))){for(var n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort((function(e,t){return e.keyPath.length-t.keyPath.length}))[0];if(n&&this.db._maxKey!==Je){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map((function(t){return e[t]})))}!n&&ie&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(t.join("+"),"]"));var o=this.schema.idxByName;function a(e,t){return 0===st(e,t)}var c=t.reduce((function(t,n){var r=t[0],i=t[1],c=(t=o[n],e[n]);return[r||t,r||!t?it(i,t&&t.multi?function(e){return e=x(e,n),u(e)&&e.some((function(e){return a(c,e)}))}:function(e){return a(c,x(e,n))}):i]}),[null,null]);return r=c[0],c=c[1],r?this.where(r.name).equals(e[r.keyPath]).filter(c):n?this.filter(c):this.where(t).equals("")},dt.prototype.filter=function(e){return this.toCollection().and(e)},dt.prototype.count=function(e){return this.toCollection().count(e)},dt.prototype.offset=function(e){return this.toCollection().offset(e)},dt.prototype.limit=function(e){return this.toCollection().limit(e)},dt.prototype.each=function(e){return this.toCollection().each(e)},dt.prototype.toArray=function(e){return this.toCollection().toArray(e)},dt.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},dt.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,u(e)?"[".concat(e.join("+"),"]"):e))},dt.prototype.reverse=function(){return this.toCollection().reverse()},dt.prototype.mapToClass=function(t){var n,r=this.db,o=this.name;function i(){return null!==n&&n.apply(this,arguments)||this}(this.schema.mappedClass=t).prototype instanceof ct&&(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(i,n=t),Object.defineProperty(i.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),i.prototype.table=function(){return o},t=i);for(var a=new Set,u=t.prototype;u;u=s(u))Object.getOwnPropertyNames(u).forEach((function(e){return a.add(e)}));function c(e){if(!e)return e;var n,r=Object.create(t.prototype);for(n in e)if(!a.has(n))try{r[n]=e[n]}catch(e){}return r}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=c,this.hook("reading",c),t},dt.prototype.defineClass=function(){return this.mapToClass((function(e){c(this,e)}))},dt.prototype.add=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,a=e;return i&&o&&(a=ut(i)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):e.lastResult})).then((function(t){if(i)try{k(e,i,t)}catch(t){}return t}))},dt.prototype.update=function(e,t){return"object"!=a(e)||u(e)?this.where(":id").equals(e).modify(t):void 0===(e=x(e,this.schema.primKey.keyPath))?Xe(new H.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},dt.prototype.put=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,a=e;return i&&o&&(a=ut(i)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):e.lastResult})).then((function(t){if(i)try{k(e,i,t)}catch(t){}return t}))},dt.prototype.delete=function(e){var t=this;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):void 0}))},dt.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(t){return e.core.mutate({trans:t,type:"deleteRange",range:at})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):void 0}))},dt.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",(function(n){return t.core.getMany({keys:e,trans:n}).then((function(e){return e.map((function(e){return t.hook.reading.fire(e)}))}))}))},dt.prototype.bulkAdd=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(u=r.schema.primKey).auto;if((u=u.keyPath)&&o)throw new H.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new H.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,u=u&&n?e.map(ut(u)):e;return r.core.mutate({trans:t,type:"add",keys:o,values:u,wantResults:i}).then((function(e){var t=e.numFailures,n=e.results,o=e.lastResult;if(e=e.failures,0===t)return i?n:o;throw new G("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},dt.prototype.bulkPut=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(u=r.schema.primKey).auto;if((u=u.keyPath)&&o)throw new H.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new H.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,u=u&&n?e.map(ut(u)):e;return r.core.mutate({trans:t,type:"put",keys:o,values:u,wantResults:i}).then((function(e){var t=e.numFailures,n=e.results,o=e.lastResult;if(e=e.failures,0===t)return i?n:o;throw new G("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},dt.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map((function(e){return e.key})),o=e.map((function(e){return e.changes})),i=[];return this._trans("readwrite",(function(a){return n.getMany({trans:a,keys:r,cache:"clone"}).then((function(u){var c=[],s=[];e.forEach((function(e,n){var r=e.key,o=e.changes,a=u[n];if(a){for(var l=0,f=Object.keys(o);l<f.length;l++){var h=f[l],d=o[h];if(h===t.schema.primKey.keyPath){if(0!==st(d,r))throw new H.Constraint("Cannot update primary key in bulkUpdate()")}else k(a,h,d)}i.push(n),c.push(r),s.push(a)}}));var l=c.length;return n.mutate({trans:a,type:"put",keys:c,values:s,updates:{keys:r,changeSpecs:o}}).then((function(e){var n=e.numFailures,r=e.failures;if(0===n)return l;for(var o=0,a=Object.keys(r);o<a.length;o++){var u,c=a[o],s=i[Number(c)];null!=s&&(u=r[c],delete r[c],r[s]=u)}throw new G("".concat(t.name,".bulkUpdate(): ").concat(n," of ").concat(l," operations failed"),r)}))}))}))},dt.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:e})})).then((function(e){var r=e.numFailures,o=e.lastResult;if(e=e.failures,0===r)return o;throw new G("".concat(t.name,".bulkDelete(): ").concat(r," of ").concat(n," operations failed"),e)}))},dt);function dt(){}function pt(e){function t(t,r){if(r){for(var o=arguments.length,i=new Array(o-1);--o;)i[o-1]=arguments[o];return n[t].subscribe.apply(null,i),e}if("string"==typeof t)return n[t]}var n={};t.addEventType=c;for(var r=1,o=arguments.length;r<o;++r)c(arguments[r]);return t;function c(e,r,o){if("object"!=a(e)){var s;r=r||re;var l={subscribers:[],fire:o=o||Q,subscribe:function(e){-1===l.subscribers.indexOf(e)&&(l.subscribers.push(e),l.fire=r(l.fire,e))},unsubscribe:function(e){l.subscribers=l.subscribers.filter((function(t){return t!==e})),l.fire=l.subscribers.reduce(r,o)}};return n[e]=t[e]=l}i(s=e).forEach((function(e){var t=s[e];if(u(t))c(e,s[e][0],s[e][1]);else{if("asap"!==t)throw new H.InvalidArgument("Invalid event config");var n=c(e,X,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){_((function(){e.apply(null,t)}))}))}))}}))}}function yt(e,t){return y(t).from({prototype:e}),t}function vt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function mt(e,t){e.filter=it(e.filter,t)}function bt(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return it(r(),t())}:t,e.justLimit=n&&!r}function gt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new H.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function wt(e,t,n){var r=gt(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function _t(e,t,n,r){var o=e.replayFilter?it(e.filter,e.replayFilter()):e.filter;if(e.or){var i={},a=function(e,n,r){var a,u;o&&!o(n,r,(function(e){return n.stop(e)}),(function(e){return n.fail(e)}))||("[object ArrayBuffer]"==(u=""+(a=n.primaryKey))&&(u=""+new Uint8Array(a)),f(i,u)||(i[u]=!0,t(e,n,r)))};return Promise.all([e.or._iterate(a,n),xt(wt(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return xt(wt(e,r,n),it(e.algorithm,o),t,!e.keysOnly&&e.valueMapper)}function xt(e,t,n,r){var o=Be(r?function(e,t,o){return n(r(e),t,o)}:n);return e.then((function(e){if(e)return e.start((function(){var n=function(){return e.continue()};t&&!t(e,(function(e){return n=e}),(function(t){e.stop(t),n=Q}),(function(t){e.fail(t),n=Q}))||o(e.value,e,(function(e){return n=e})),n()}))}))}var kt=(Et.prototype.execute=function(e){var t=this["@@propmod"];if(void 0!==t.add){var n=t.add;if(u(n))return r(r([],u(e)?e:[],!0),n,!0).sort();if("number"==typeof n)return(Number(e)||0)+n;if("bigint"==typeof n)try{return BigInt(e)+n}catch(e){return BigInt(0)+n}throw new TypeError("Invalid term ".concat(n))}if(void 0!==t.remove){var o=t.remove;if(u(o))return u(e)?e.filter((function(e){return!o.includes(e)})).sort():[];if("number"==typeof o)return Number(e)-o;if("bigint"==typeof o)try{return BigInt(e)-o}catch(e){return BigInt(0)-o}throw new TypeError("Invalid subtrahend ".concat(o))}return(n=null===(n=t.replacePrefix)||void 0===n?void 0:n[0])&&"string"==typeof e&&e.startsWith(n)?t.replacePrefix[1]+e.substring(n.length):e},Et);function Et(e){this["@@propmod"]=e}var Ot=(St.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,Xe.bind(null,n.error)):n.table._trans("readonly",e).then(t)},St.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,Xe.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},St.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=it(t.algorithm,e)},St.prototype._iterate=function(e,t){return _t(this._ctx,e,t,this._ctx.table.core)},St.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&c(n,e),t._ctx=n,t},St.prototype.raw=function(){return this._ctx.valueMapper=null,this},St.prototype.each=function(e){var t=this._ctx;return this._read((function(n){return _t(t,e,n,t.table.core)}))},St.prototype.count=function(e){var t=this;return this._read((function(e){var n=t._ctx,r=n.table.core;if(vt(n,!0))return r.count({trans:e,query:{index:gt(n,r.schema),range:n.range}}).then((function(e){return Math.min(e,n.limit)}));var o=0;return _t(n,(function(){return++o,!1}),e,r).then((function(){return o}))})).then(e)},St.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],o=n.length-1;function i(e,t){return t?i(e[n[t]],t-1):e[r]}var a="next"===this._ctx.dir?1:-1;function u(e,t){return st(i(e,o),i(t,o))*a}return this.toArray((function(e){return e.sort(u)})).then(t)},St.prototype.toArray=function(e){var t=this;return this._read((function(e){var n=t._ctx;if("next"===n.dir&&vt(n,!0)&&0<n.limit){var r=n.valueMapper,o=gt(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,query:{index:o,range:n.range}}).then((function(e){return e=e.result,r?e.map(r):e}))}var i=[];return _t(n,(function(e){return i.push(e)}),e,n.table.core).then((function(){return i}))}),e)},St.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,vt(t)?bt(t,(function(){var t=e;return function(e,n){return 0===t||(1===t?--t:n((function(){e.advance(t),t=0})),!1)}})):bt(t,(function(){var t=e;return function(){return--t<0}}))),this},St.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),bt(this._ctx,(function(){var t=e;return function(e,n,r){return--t<=0&&n(r),0<=t}}),!0),this},St.prototype.until=function(e,t){return mt(this._ctx,(function(n,r,o){return!e(n.value)||(r(o),t)})),this},St.prototype.first=function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)},St.prototype.last=function(e){return this.reverse().first(e)},St.prototype.filter=function(e){var t;return mt(this._ctx,(function(t){return e(t.value)})),(t=this._ctx).isMatch=it(t.isMatch,e),this},St.prototype.and=function(e){return this.filter(e)},St.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},St.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},St.prototype.desc=function(){return this.reverse()},St.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))},St.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},St.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))},St.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)},St.prototype.primaryKeys=function(e){var t=this._ctx;if("next"===t.dir&&vt(t,!0)&&0<t.limit)return this._read((function(e){var n=gt(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((function(e){return e.result})).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)},St.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},St.prototype.firstKey=function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)},St.prototype.lastKey=function(e){return this.reverse().firstKey(e)},St.prototype.distinct=function(){var e;if(!(e=(e=this._ctx).index&&e.table.schema.idxByName[e.index])||!e.multi)return this;var t={};return mt(this._ctx,(function(e){var n=e.primaryKey.toString();return e=f(t,n),t[n]=!0,!e})),this},St.prototype.modify=function(e){var t=this,n=this._ctx;return this._write((function(r){var o,u,c;c="function"==typeof e?e:(o=i(e),u=o.length,function(t){for(var n=!1,r=0;r<u;++r){var i=o[r],a=e[i],c=x(t,i);a instanceof kt?(k(t,i,a.execute(c)),n=!0):c!==a&&(k(t,i,a),n=!0)}return n});var s,l=n.table.core,f=(s=l.schema.primaryKey).outbound,h=s.extractKey,d=200;function p(e,t){var n=t.failures;t=t.numFailures,v+=e-t;for(var r=0,o=i(n);r<o.length;r++){var a=o[r];y.push(n[a])}}(s=t.db._options.modifyChunkSize)&&(d="object"==a(s)?s[l.name]||s["*"]||200:s);var y=[],v=0,m=[];return t.clone().primaryKeys().then((function(t){var o=vt(n)&&n.limit===1/0&&("function"!=typeof e||e===Pt)&&{index:n.index,range:n.range};return function n(i){var u=Math.min(d,t.length-i);return l.getMany({trans:r,keys:t.slice(i,i+u),cache:"immutable"}).then((function(s){for(var y=[],v=[],m=f?[]:null,b=[],g=0;g<u;++g){var w=s[g],_={value:K(w),primKey:t[i+g]};!1!==c.call(_,_.value,_)&&(null==_.value?b.push(t[i+g]):f||0===st(h(w),h(_.value))?(v.push(_.value),f&&m.push(t[i+g])):(b.push(t[i+g]),y.push(_.value)))}return Promise.resolve(0<y.length&&l.mutate({trans:r,type:"add",values:y}).then((function(e){for(var t in e.failures)b.splice(parseInt(t),1);p(y.length,e)}))).then((function(){return(0<v.length||o&&"object"==a(e))&&l.mutate({trans:r,type:"put",keys:m,values:v,criteria:o,changeSpec:"function"!=typeof e&&e,isAdditionalChunk:0<i}).then((function(e){return p(v.length,e)}))})).then((function(){return(0<b.length||o&&e===Pt)&&l.mutate({trans:r,type:"delete",keys:b,criteria:o,isAdditionalChunk:0<i}).then((function(e){return p(b.length,e)}))})).then((function(){return t.length>i+u&&n(i+d)}))}))}(0).then((function(){if(0<y.length)throw new V("Error modifying one or more objects",y,v,m);return t.length}))}))}))},St.prototype.delete=function(){var e=this._ctx,t=e.range;return vt(e)&&(e.isPrimKey||3===t.type)?this._write((function(n){var r=e.table.core.schema.primaryKey,o=t;return e.table.core.count({trans:n,query:{index:r,range:o}}).then((function(t){return e.table.core.mutate({trans:n,type:"deleteRange",range:o}).then((function(e){var n=e.failures;if(e.lastResult,e.results,e=e.numFailures)throw new V("Could not delete some values",Object.keys(n).map((function(e){return n[e]})),t-e);return t-e}))}))})):this.modify(Pt)},St);function St(){}var Pt=function(e,t){return t.value=null};function jt(e,t){return e<t?-1:e===t?0:1}function Ct(e,t){return t<e?-1:e===t?0:1}function Kt(e,t,n){return(e=e instanceof Dt?new e.Collection(e):e)._ctx.error=new(n||TypeError)(t),e}function Tt(e){return new e.Collection(e,(function(){return Bt("")})).limit(0)}function At(e,t,n,r){var o,i,a,u,c,s,l,f=n.length;if(!n.every((function(e){return"string"==typeof e})))return Kt(e,et);function h(e){o="next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()},i="next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()},a="next"===e?jt:Ct;var t=n.map((function(e){return{lower:i(e),upper:o(e)}})).sort((function(e,t){return a(e.lower,t.lower)}));u=t.map((function(e){return e.upper})),c=t.map((function(e){return e.lower})),l="next"===(s=e)?"":r}h("next"),(e=new e.Collection(e,(function(){return It(u[0],c[f-1]+r)})))._ondirectionchange=function(e){h(e)};var d=0;return e._addAlgorithm((function(e,n,r){var o=e.key;if("string"!=typeof o)return!1;var h=i(o);if(t(h,c,d))return!0;for(var p=null,y=d;y<f;++y){var v=function(e,t,n,r,o,i){for(var a=Math.min(e.length,r.length),u=-1,c=0;c<a;++c){var s=t[c];if(s!==r[c])return o(e[c],n[c])<0?e.substr(0,c)+n[c]+n.substr(c+1):o(e[c],r[c])<0?e.substr(0,c)+r[c]+n.substr(c+1):0<=u?e.substr(0,u)+t[u]+n.substr(u+1):null;o(e[c],s)<0&&(u=c)}return a<r.length&&"next"===i?e+n.substr(e.length):a<e.length&&"prev"===i?e.substr(0,n.length):u<0?null:e.substr(0,u)+r[u]+n.substr(u+1)}(o,h,u[y],c[y],a,s);null===v&&null===p?d=y+1:(null===p||0<a(p,v))&&(p=v)}return n(null!==p?function(){e.continue(p+l)}:r),!1})),e}function It(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Bt(e){return{type:1,lower:e,upper:e}}var Dt=(Object.defineProperty(qt.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),qt.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return 0<this._cmp(e,t)||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?Tt(this):new this.Collection(this,(function(){return It(e,t,!n,!r)}))}catch(e){return Kt(this,Ze)}},qt.prototype.equals=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return Bt(e)}))},qt.prototype.above=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return It(e,void 0,!0)}))},qt.prototype.aboveOrEqual=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return It(e,void 0,!1)}))},qt.prototype.below=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return It(void 0,e,!1,!0)}))},qt.prototype.belowOrEqual=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return It(void 0,e)}))},qt.prototype.startsWith=function(e){return"string"!=typeof e?Kt(this,et):this.between(e,e+Je,!0,!0)},qt.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):At(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],Je)},qt.prototype.equalsIgnoreCase=function(e){return At(this,(function(e,t){return e===t[0]}),[e],"")},qt.prototype.anyOfIgnoreCase=function(){var e=R.apply(q,arguments);return 0===e.length?Tt(this):At(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},qt.prototype.startsWithAnyOfIgnoreCase=function(){var e=R.apply(q,arguments);return 0===e.length?Tt(this):At(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,Je)},qt.prototype.anyOf=function(){var e=this,t=R.apply(q,arguments),n=this._cmp;try{t.sort(n)}catch(r){return Kt(this,Ze)}if(0===t.length)return Tt(this);var r=new this.Collection(this,(function(){return It(t[0],t[t.length-1])}));r._ondirectionchange=function(r){n="next"===r?e._ascending:e._descending,t.sort(n)};var o=0;return r._addAlgorithm((function(e,r,i){for(var a=e.key;0<n(a,t[o]);)if(++o===t.length)return r(i),!1;return 0===n(a,t[o])||(r((function(){e.continue(t[o])})),!1)})),r},qt.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},qt.prototype.noneOf=function(){var e=R.apply(q,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Kt(this,Ze)}var t=e.reduce((function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[-1/0,t]]}),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},qt.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,o=this._ascending,i=this._descending,a=this._min,u=this._max;if(0===e.length)return Tt(this);if(!e.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&o(e[0],e[1])<=0})))return Kt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",H.InvalidArgument);var c,s=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,f=o;function h(e,t){return f(e[0],t[0])}try{(c=e.reduce((function(e,t){for(var n=0,o=e.length;n<o;++n){var i=e[n];if(r(t[0],i[1])<0&&0<r(t[1],i[0])){i[0]=a(i[0],t[0]),i[1]=u(i[1],t[1]);break}}return n===o&&e.push(t),e}),[])).sort(h)}catch(e){return Kt(this,Ze)}var d=0,p=l?function(e){return 0<o(e,c[d][1])}:function(e){return 0<=o(e,c[d][1])},y=s?function(e){return 0<i(e,c[d][0])}:function(e){return 0<=i(e,c[d][0])},v=p;return(e=new this.Collection(this,(function(){return It(c[0][0],c[c.length-1][1],!s,!l)})))._ondirectionchange=function(e){f="next"===e?(v=p,o):(v=y,i),c.sort(h)},e._addAlgorithm((function(e,t,r){for(var i,a=e.key;v(a);)if(++d===c.length)return t(r),!1;return!p(i=a)&&!y(i)||(0===n._cmp(a,c[d][1])||0===n._cmp(a,c[d][0])||t((function(){f===o?e.continue(c[d][0]):e.continue(c[d][1])})),!1)})),e},qt.prototype.startsWithAnyOf=function(){var e=R.apply(q,arguments);return e.every((function(e){return"string"==typeof e}))?0===e.length?Tt(this):this.inAnyRange(e.map((function(e){return[e,e+Je]}))):Kt(this,"startsWithAnyOf() only works with strings")},qt);function qt(){}function Rt(e){return Be((function(t){return Lt(t),e(t.target.error),!1}))}function Lt(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Nt="storagemutated",Mt="x-storagemutated-1",Ft=pt(null,Nt),Ut=(Vt.prototype._lock=function(){return w(!be.global),++this._reculock,1!==this._reculock||be.global||(be.lockOwnerFor=this),this},Vt.prototype._unlock=function(){if(w(!be.global),0==--this._reculock)for(be.global||(be.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{We(e[1],e[0])}catch(e){}}return this},Vt.prototype._locked=function(){return this._reculock&&be.lockOwnerFor!==this},Vt.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(w(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new H.DatabaseClosed(r);case"MissingAPIError":throw new H.MissingAPI(r.message,r);default:throw new H.OpenFailed(r)}if(!this.active)throw new H.TransactionInactive;return w(null===this._completion._state),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Be((function(n){Lt(n),t._reject(e.error)})),e.onabort=Be((function(n){Lt(n),t.active&&t._reject(new H.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=Be((function(){t.active=!1,t._resolve(),"mutatedParts"in e&&Ft.storagemutated.fire(e.mutatedParts)})),this},Vt.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return Xe(new H.ReadOnly("Transaction is readonly"));if(!this.active)return Xe(new H.TransactionInactive);if(this._locked())return new xe((function(o,i){r._blockedFuncs.push([function(){r._promise(e,t,n).then(o,i)},be])}));if(n)return Fe((function(){var e=new xe((function(e,n){r._lock();var o=t(e,n,r);o&&o.then&&o.then(e,n)}));return e.finally((function(){return r._unlock()})),e._lib=!0,e}));var o=new xe((function(e,n){var o=t(e,n,r);o&&o.then&&o.then(e,n)}));return o._lib=!0,o},Vt.prototype._root=function(){return this.parent?this.parent._root():this},Vt.prototype.waitFor=function(e){var t,n=this._root(),r=xe.resolve(e);n._waitingFor?n._waitingFor=n._waitingFor.then((function(){return r})):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=e)}());var o=n._waitingFor;return new xe((function(e,t){r.then((function(t){return n._waitingQueue.push(Be(e.bind(null,t)))}),(function(e){return n._waitingQueue.push(Be(t.bind(null,e)))})).finally((function(){n._waitingFor===o&&(n._waitingFor=null)}))}))},Vt.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new H.Abort))},Vt.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(f(t,e))return t[e];var n=this.schema[e];if(!n)throw new H.NotFound("Table "+e+" not part of transaction");return(n=new this.db.Table(e,n,this)).core=this.db.core.table(e),t[e]=n},Vt);function Vt(){}function Gt(e,t,n,r,o,i,a){return{name:e,keyPath:t,unique:n,multi:r,auto:o,compound:i,src:(n&&!a?"&":"")+(r?"*":"")+(o?"++":"")+zt(t)}}function zt(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function Yt(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(e){return[e.name,e]},n.reduce((function(e,t,n){return(n=r(t))&&(e[n[0]]=n[1]),e}),{}))};var r}var Ht=function(e){try{return e.only([[]]),Ht=function(){return[[]]},[[]]}catch(e){return Ht=function(){return Je},Je}};function Wt(e){return null==e?function(){}:"string"==typeof e?1===(t=e).split(".").length?function(e){return e[t]}:function(e){return x(e,t)}:function(t){return x(t,e)};var t}function $t(e){return[].slice.call(e)}var Qt=0;function Xt(e){return null==e?":id":"string"==typeof e?e:"[".concat(e.join("+"),"]")}function Jt(e,t,n){function r(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,o=e.lowerOpen;return e=e.upperOpen,void 0===n?void 0===r?null:t.upperBound(r,!!e):void 0===r?t.lowerBound(n,!!o):t.bound(n,r,!!o,!!e)}var o,i,a,c=(i=n,a=$t((o=e).objectStoreNames),{schema:{name:o.name,tables:a.map((function(e){return i.objectStore(e)})).map((function(e){var t=e.keyPath,n=e.autoIncrement,r=u(t),o={};return n={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:null==t,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:Wt(t)},indexes:$t(e.indexNames).map((function(t){return e.index(t)})).map((function(e){var t=e.name,n=e.unique,r=e.multiEntry;return e=e.keyPath,r={name:t,compound:u(e),keyPath:e,unique:n,multiEntry:r,extractKey:Wt(e)},o[Xt(e)]=r})),getIndexByKeyPath:function(e){return o[Xt(e)]}},o[":id"]=n.primaryKey,null!=t&&(o[Xt(t)]=n.primaryKey),n}))},hasGetAll:0<a.length&&"getAll"in i.objectStore(a[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),s=(n=c.schema,c.hasGetAll),l=(c=n.tables.map((function(e){var t,n=e.name;return{name:n,schema:e,mutate:function(e){var t=e.trans,o=e.type,i=e.keys,a=e.values,u=e.range;return new Promise((function(e,c){e=Be(e);var s=t.objectStore(n),l=null==s.keyPath,f="put"===o||"add"===o;if(!f&&"delete"!==o&&"deleteRange"!==o)throw new Error("Invalid operation type: "+o);var h,d=(i||a||{length:1}).length;if(i&&a&&i.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return e({numFailures:0,failures:{},results:[],lastResult:void 0});function p(e){++m,Lt(e)}var y=[],v=[],m=0;if("deleteRange"===o){if(4===u.type)return e({numFailures:m,failures:v,results:[],lastResult:void 0});3===u.type?y.push(h=s.clear()):y.push(h=s.delete(r(u)))}else{var b=(l=f?l?[a,i]:[a,null]:[i,null])[0],g=l[1];if(f)for(var w=0;w<d;++w)y.push(h=g&&void 0!==g[w]?s[o](b[w],g[w]):s[o](b[w])),h.onerror=p;else for(w=0;w<d;++w)y.push(h=s[o](b[w])),h.onerror=p}function _(t){t=t.target.result,y.forEach((function(e,t){return null!=e.error&&(v[t]=e.error)})),e({numFailures:m,failures:v,results:"delete"===o?i:y.map((function(e){return e.result})),lastResult:t})}h.onerror=function(e){p(e),_(e)},h.onsuccess=_}))},getMany:function(e){var t=e.trans,r=e.keys;return new Promise((function(e,o){e=Be(e);for(var i,a=t.objectStore(n),u=r.length,c=new Array(u),s=0,l=0,f=function(t){t=t.target,c[t._pos]=t.result,++l===s&&e(c)},h=Rt(o),d=0;d<u;++d)null!=r[d]&&((i=a.get(r[d]))._pos=d,i.onsuccess=f,i.onerror=h,++s);0===s&&e(c)}))},get:function(e){var t=e.trans,r=e.key;return new Promise((function(e,o){e=Be(e);var i=t.objectStore(n).get(r);i.onsuccess=function(t){return e(t.target.result)},i.onerror=Rt(o)}))},query:(t=s,function(e){return new Promise((function(o,i){o=Be(o);var a,u,c,s=e.trans,l=e.values,f=e.limit,h=e.query,d=f===1/0?void 0:f,p=h.index;if(h=h.range,s=s.objectStore(n),p=p.isPrimaryKey?s:s.index(p.name),h=r(h),0===f)return o({result:[]});t?((d=l?p.getAll(h,d):p.getAllKeys(h,d)).onsuccess=function(e){return o({result:e.target.result})},d.onerror=Rt(i)):(a=0,u=!l&&"openKeyCursor"in p?p.openKeyCursor(h):p.openCursor(h),c=[],u.onsuccess=function(e){var t=u.result;return t?(c.push(l?t.value:t.primaryKey),++a===f?o({result:c}):void t.continue()):o({result:c})},u.onerror=Rt(i))}))}),openCursor:function(e){var t=e.trans,o=e.values,i=e.query,a=e.reverse,u=e.unique;return new Promise((function(e,c){e=Be(e);var s=i.index,l=i.range,f=t.objectStore(n),h=(f=s.isPrimaryKey?f:f.index(s.name),s=a?u?"prevunique":"prev":u?"nextunique":"next",!o&&"openKeyCursor"in f?f.openKeyCursor(r(l),s):f.openCursor(r(l),s));h.onerror=Rt(c),h.onsuccess=Be((function(n){var r,o,i,a,u=h.result;u?(u.___id=++Qt,u.done=!1,r=u.continue.bind(u),o=(o=u.continuePrimaryKey)&&o.bind(u),i=u.advance.bind(u),a=function(){throw new Error("Cursor not stopped")},u.trans=t,u.stop=u.continue=u.continuePrimaryKey=u.advance=function(){throw new Error("Cursor not started")},u.fail=Be(c),u.next=function(){var e=this,t=1;return this.start((function(){return t--?e.continue():e.stop()})).then((function(){return e}))},u.start=function(e){function t(){if(h.result)try{e()}catch(e){u.fail(e)}else u.done=!0,u.start=function(){throw new Error("Cursor behind last entry")},u.stop()}var n=new Promise((function(e,t){e=Be(e),h.onerror=Rt(t),u.fail=t,u.stop=function(t){u.stop=u.continue=u.continuePrimaryKey=u.advance=a,e(t)}}));return h.onsuccess=Be((function(e){h.onsuccess=t,t()})),u.continue=r,u.continuePrimaryKey=o,u.advance=i,t(),n},e(u)):e(null)}),c)}))},count:function(e){var t=e.query,o=e.trans,i=t.index,a=t.range;return new Promise((function(e,t){var u=o.objectStore(n),c=i.isPrimaryKey?u:u.index(i.name);(c=(u=r(a))?c.count(u):c.count()).onsuccess=Be((function(t){return e(t.target.result)})),c.onerror=Rt(t)}))}}})),{});return c.forEach((function(e){return l[e.name]=e})),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(e){if(!l[e])throw new Error("Table '".concat(e,"' not found"));return l[e]},MIN_KEY:-1/0,MAX_KEY:Ht(t),schema:n}}function Zt(e,n){var r=n.db;n=function(e,n,r,o){var i=r.IDBKeyRange;return r.indexedDB,{dbcore:(o=Jt(n,i,o),e.dbcore.reduce((function(e,n){return n=n.create,t(t({},e),n(e))}),o))}}(e._middlewares,r,e._deps,n),e.core=n.dbcore,e.tables.forEach((function(t){var n=t.name;e.core.schema.tables.some((function(e){return e.name===n}))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function en(e,t,n,r){n.forEach((function(n){var o=r[n];t.forEach((function(t){var r=function e(t,n){return v(t,n)||(t=s(t))&&e(t,n)}(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?p(t,n,{get:function(){return this.table(n)},set:function(e){d(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,o))}))}))}function tn(e,t){t.forEach((function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]}))}function nn(e,t){return e._cfg.version-t._cfg.version}function rn(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var o=e[n],i=t[n];if(o){var a={name:n,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||o.primKey.auto!==i.primKey.auto)a.recreate=!0,r.change.push(a);else{var u=o.idxByName,c=i.idxByName,s=void 0;for(s in u)c[s]||a.del.push(s);for(s in c){var l=u[s],f=c[s];l?l.src!==f.src&&a.change.push(f):a.add.push(f)}(0<a.del.length||0<a.add.length||0<a.change.length)&&r.change.push(a)}}else r.add.push([n,i])}return r}function on(e,t,n,r){var o=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((function(e){return un(o,e)})),o}function an(e,t){i(e).forEach((function(n){t.db.objectStoreNames.contains(n)||(ie&&console.debug("Dexie: Creating missing table",n),on(t,n,e[n].primKey,e[n].indexes))}))}function un(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function cn(e,t,n){var r={};return b(t.objectStoreNames,0).forEach((function(e){for(var t=n.objectStore(e),o=Gt(zt(u=t.keyPath),u||"",!0,!1,!!t.autoIncrement,u&&"string"!=typeof u,!0),i=[],a=0;a<t.indexNames.length;++a){var u=(c=t.index(t.indexNames[a])).keyPath,c=Gt(c.name,u,!!c.unique,!!c.multiEntry,!1,u&&"string"!=typeof u,!1);i.push(c)}r[e]=Yt(e,o,i)})),r}function sn(e,t,n){for(var r=n.db.objectStoreNames,i=0;i<r.length;++i){var a=r[i],u=n.objectStore(a);e._hasGetAll="getAll"in u;for(var c=0;c<u.indexNames.length;++c){var s=u.indexNames[c],l=u.index(s).keyPath,f="string"==typeof l?l:"["+b(l).join("+")+"]";!t[a]||(l=t[a].idxByName[f])&&(l.name=s,delete t[a].idxByName[f],t[a].idxByName[s]=l)}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&o.WorkerGlobalScope&&o instanceof o.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function ln(e){return e.split(",").map((function(e,t){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return Gt(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),u(r),0===t)}))}var fn=(hn.prototype._parseStoresSpec=function(e,t){i(e).forEach((function(n){if(null!==e[n]){var r=ln(e[n]),o=r.shift();if(o.unique=!0,o.multi)throw new H.Schema("Primary key cannot be multi-valued");r.forEach((function(e){if(e.auto)throw new H.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new H.Schema("Index must have a name and cannot be an empty string")})),t[n]=Yt(n,o,r)}}))},hn.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?c(this._cfg.storesSource,e):e,e=t._versions;var n={},r={};return e.forEach((function(e){c(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)})),t._dbSchema=r,tn(t,[t._allTables,t,t.Transaction.prototype]),en(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],i(r),r),t._storeNames=i(r),this},hn.prototype.upgrade=function(e){return this._cfg.contentUpgrade=oe(this._cfg.contentUpgrade||Q,e),this},hn);function hn(){}function dn(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new $n(nt,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function pn(e){return e&&"function"==typeof e.databases}function yn(e){return Fe((function(){return be.letThrough=!0,e()}))}function vn(e){return!("from"in e)}var mn=function(e,t){if(!this){var n=new mn;return e&&"d"in e&&c(n,e),n}c(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function bn(e,t,n){var r=st(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(vn(e))return c(e,{from:t,to:n,d:1});var o=e.l;if(r=e.r,st(n,e.from)<0)return o?bn(o,t,n):e.l={from:t,to:n,d:1,l:null,r:null},xn(e);if(0<st(t,e.to))return r?bn(r,t,n):e.r={from:t,to:n,d:1,l:null,r:null},xn(e);st(t,e.from)<0&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0<st(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),n=!e.r,o&&!e.l&&gn(e,o),r&&n&&gn(e,r)}}function gn(e,t){vn(t)||function e(t,n){var r=n.from,o=n.to,i=n.l;n=n.r,bn(t,r,o),i&&e(t,i),n&&e(t,n)}(e,t)}function wn(e,t){var n=_n(t),r=n.next();if(r.done)return!1;for(var o=r.value,i=_n(e),a=i.next(o.from),u=a.value;!r.done&&!a.done;){if(st(u.from,o.to)<=0&&0<=st(u.to,o.from))return!0;st(o.from,u.from)<0?o=(r=n.next(u.from)).value:u=(a=i.next(o.from)).value}return!1}function _n(e){var t=vn(e)?null:{s:0,n:e};return{next:function(e){for(var n=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&st(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||st(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function xn(e){var n,r,o=((null===(n=e.r)||void 0===n?void 0:n.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),i=1<o?"r":o<-1?"l":"";i&&(n="r"==i?"l":"r",r=t({},e),o=e[i],e.from=o.from,e.to=o.to,e[i]=o[i],r[i]=o[n],(e[n]=r).d=kn(r)),e.d=kn(e)}function kn(e){var t=e.r;return e=e.l,(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function En(e,t){return i(t).forEach((function(n){e[n]?gn(e[n],t[n]):e[n]=function e(t){var n,r,o={};for(n in t)f(t,n)&&(r=t[n],o[n]=!r||"object"!=a(r)||j.has(r.constructor)?r:e(r));return o}(t[n])})),e}function On(e,t){return e.all||t.all||Object.keys(e).some((function(n){return t[n]&&wn(t[n],e[n])}))}h(mn.prototype,((N={add:function(e){return gn(this,e),this},addKey:function(e){return bn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach((function(e){return bn(t,e,e)})),this},hasKey:function(e){var t=_n(this).next(e).value;return t&&st(t.from,e)<=0&&0<=st(t.to,e)}})[I]=function(){return _n(this)},N));var Sn={},Pn={},jn=!1;function Cn(e){En(Pn,e),jn||(jn=!0,setTimeout((function(){jn=!1,Kn(Pn,!(Pn={}))}),0))}function Kn(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,o=Object.values(Sn);r<o.length;r++)Tn(a=o[r],e,n,t);else for(var i in e){var a,u=/^idb\:\/\/(.*)\/(.*)\//.exec(i);u&&(i=u[1],u=u[2],(a=Sn["idb://".concat(i,"/").concat(u)])&&Tn(a,e,n,t))}n.forEach((function(e){return e()}))}function Tn(e,t,n,r){for(var o=[],i=0,a=Object.entries(e.queries.query);i<a.length;i++){for(var u=a[i],c=u[0],s=[],l=0,f=u[1];l<f.length;l++){var h=f[l];On(t,h.obsSet)?h.subscribers.forEach((function(e){return n.add(e)})):r&&s.push(h)}r&&o.push([c,s])}if(r)for(var d=0,p=o;d<p.length;d++){var y=p[d];c=y[0],s=y[1],e.queries.query[c]=s}}function An(e){function t(t){return e.next(t)}var n=o(t),r=o((function(t){return e.throw(t)}));function o(e){return function(t){var o=e(t);return t=o.value,o.done?t:t&&"function"==typeof t.then?t.then(n,r):u(t)?Promise.all(t).then(n,r):n(t)}}return o(t)()}function In(e,t,n){for(var r=u(e)?e.slice():[e],o=0;o<n;++o)r.push(t);return r}var Bn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return t(t({},e),{table:function(n){var r=e.table(n),o=r.schema,i={},a=[];function u(e,n,r){var o=Xt(e),c=i[o]=i[o]||[],s=null==e?0:"string"==typeof e?1:e.length,l=0<n;return l=t(t({},r),{name:l?"".concat(o,"(virtual-from:").concat(r.name,")"):r.name,lowLevelIndex:r,isVirtual:l,keyTail:n,keyLength:s,extractKey:Wt(e),unique:!l&&r.unique}),c.push(l),l.isPrimaryKey||a.push(l),1<s&&u(2===s?e[0]:e.slice(0,s-1),n+1,r),c.sort((function(e,t){return e.keyTail-t.keyTail})),l}n=u(o.primaryKey.keyPath,0,o.primaryKey),i[":id"]=[n];for(var c=0,s=o.indexes;c<s.length;c++){var l=s[c];u(l.keyPath,0,l)}function f(n){var r,o=n.query.index;return o.isVirtual?t(t({},n),{query:{index:o.lowLevelIndex,range:(r=n.query.range,o=o.keyTail,{type:1===r.type?2:r.type,lower:In(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,o),lowerOpen:!0,upper:In(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,o),upperOpen:!0})}}):n}return t(t({},r),{schema:t(t({},o),{primaryKey:n,indexes:a,getIndexByKeyPath:function(e){return(e=i[Xt(e)])&&e[0]}}),count:function(e){return r.count(f(e))},query:function(e){return r.query(f(e))},openCursor:function(t){var n=t.query.index,o=n.keyTail,i=n.isVirtual,a=n.keyLength;return i?r.openCursor(f(t)).then((function(n){return n&&function(n){return Object.create(n,{continue:{value:function(r){null!=r?n.continue(In(r,t.reverse?e.MAX_KEY:e.MIN_KEY,o)):t.unique?n.continue(n.key.slice(0,a).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,o)):n.continue()}},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(In(t,e.MAX_KEY,o),r)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var e=n.key;return 1===a?e[0]:e.slice(0,a)}},value:{get:function(){return n.value}}})}(n)})):r.openCursor(t)}})}})}};function Dn(e,t,n,r){return n=n||{},r=r||"",i(e).forEach((function(o){var i,u,c;f(t,o)?(i=e[o],u=t[o],"object"==a(i)&&"object"==a(u)&&i&&u?(c=A(i))!==A(u)?n[r+o]=t[o]:"Object"===c?Dn(i,u,n,r+o+"."):i!==u&&(n[r+o]=t[o]):i!==u&&(n[r+o]=t[o])):n[r+o]=void 0})),i(t).forEach((function(o){f(e,o)||(n[r+o]=t[o])})),n}function qn(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}var Rn={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return t(t({},e),{table:function(n){var o=e.table(n),i=o.schema.primaryKey;return t(t({},o),{mutate:function(e){var a=be.trans,u=a.table(n).hook,c=u.deleting,s=u.creating,l=u.updating;switch(e.type){case"add":if(s.fire===Q)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"put":if(s.fire===Q&&l.fire===Q)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"delete":if(c.fire===Q)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"deleteRange":if(c.fire===Q)break;return a._promise("readwrite",(function(){return function e(n,r,a){return o.query({trans:n,values:!1,query:{index:i,range:r},limit:a}).then((function(o){var i=o.result;return h({type:"delete",keys:i,trans:n}).then((function(o){return 0<o.numFailures?Promise.reject(o.failures[0]):i.length<a?{failures:[],numFailures:0,lastResult:void 0}:e(n,t(t({},r),{lower:i[i.length-1],lowerOpen:!0}),a)}))}))}(e.trans,e.range,1e4)}),!0)}return o.mutate(e);function h(e){var n,a,u,h=be.trans,d=e.keys||qn(i,e);if(!d)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?t(t({},e),{keys:d}):t({},e)).type&&(e.values=r([],e.values,!0)),e.keys&&(e.keys=r([],e.keys,!0)),n=o,u=d,("add"===(a=e).type?Promise.resolve([]):n.getMany({trans:a.trans,keys:u,cache:"immutable"})).then((function(t){var n=d.map((function(n,r){var o,a,u,d=t[r],p={onerror:null,onsuccess:null};return"delete"===e.type?c.fire.call(p,n,d,h):"add"===e.type||void 0===d?(o=s.fire.call(p,n,e.values[r],h),null==n&&null!=o&&(e.keys[r]=n=o,i.outbound||k(e.values[r],i.keyPath,n))):(o=Dn(d,e.values[r]),(a=l.fire.call(p,o,n,d,h))&&(u=e.values[r],Object.keys(a).forEach((function(e){f(u,e)?u[e]=a[e]:k(u,e,a[e])})))),p}));return o.mutate(e).then((function(r){for(var o=r.failures,i=r.results,a=r.numFailures,u=(r=r.lastResult,0);u<d.length;++u){var c=(i||d)[u],s=n[u];null==c?s.onerror&&s.onerror(o[u]):s.onsuccess&&s.onsuccess("put"===e.type&&t[u]?e.values[u]:c)}return{failures:o,results:i,numFailures:a,lastResult:r}})).catch((function(e){return n.forEach((function(t){return t.onerror&&t.onerror(e)})),Promise.reject(e)}))}))}}})}})}};function Ln(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;for(var r=[],o=0,i=0;o<t.keys.length&&i<e.length;++o)0===st(t.keys[o],e[i])&&(r.push(n?K(t.values[o]):t.values[o]),++i);return r.length===e.length?r:null}catch(e){return null}}var Nn={stack:"dbcore",level:-1,create:function(e){return{table:function(n){var r=e.table(n);return t(t({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=Ln(e.keys,e.trans._cache,"clone"===e.cache);return t?xe.resolve(t):r.getMany(e).then((function(t){return e.trans._cache={keys:e.keys,values:"clone"===e.cache?K(t):t},t}))},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),r.mutate(e)}})}}}};function Mn(e,t){return"readonly"===e.trans.mode&&!!e.subscr&&!e.trans.explicit&&"disabled"!==e.trans.db._options.cache&&!t.schema.primaryKey.outbound}function Fn(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Un={stack:"dbcore",level:0,name:"Observability",create:function(e){var n=e.schema.name,r=new mn(e.MIN_KEY,e.MAX_KEY);return t(t({},e),{transaction:function(t,n,r){if(be.subscr&&"readonly"!==n)throw new H.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(be.querier));return e.transaction(t,n,r)},table:function(o){var a=e.table(o),c=a.schema,s=c.primaryKey,l=c.indexes,f=s.extractKey,h=s.outbound,d=s.autoIncrement&&l.filter((function(e){return e.compound&&e.keyPath.includes(s.keyPath)})),p=t(t({},a),{mutate:function(t){function i(e){return e="idb://".concat(n,"/").concat(o,"/").concat(e),y[e]||(y[e]=new mn)}var l,f,h,p=t.trans,y=t.mutatedParts||(t.mutatedParts={}),v=i(""),m=i(":dels"),b=t.type,g="deleteRange"===t.type?[t.range]:"delete"===t.type?[t.keys]:t.values.length<50?[qn(s,t).filter((function(e){return e})),t.values]:[],w=g[0],_=g[1];return g=t.trans._cache,u(w)?(v.addKeys(w),(g="delete"===b||w.length===_.length?Ln(w,g):null)||m.addKeys(w),(g||_)&&(l=i,f=g,h=_,c.indexes.forEach((function(e){var t=l(e.name||"");function n(t){return null!=t?e.extractKey(t):null}function r(n){return e.multiEntry&&u(n)?n.forEach((function(e){return t.addKey(e)})):t.addKey(n)}(f||h).forEach((function(e,t){var o=f&&n(f[t]);0!==st(o,t=h&&n(h[t]))&&(null!=o&&r(o),null!=t&&r(t))}))})))):w?(_={from:null!==(_=w.lower)&&void 0!==_?_:e.MIN_KEY,to:null!==(_=w.upper)&&void 0!==_?_:e.MAX_KEY},m.add(_),v.add(_)):(v.add(r),m.add(r),c.indexes.forEach((function(e){return i(e.name).add(r)}))),a.mutate(t).then((function(e){return!w||"add"!==t.type&&"put"!==t.type||(v.addKeys(e.results),d&&d.forEach((function(n){for(var r=t.values.map((function(e){return n.extractKey(e)})),o=n.keyPath.findIndex((function(e){return e===s.keyPath})),a=0,u=e.results.length;a<u;++a)r[a][o]=e.results[a];i(n.name).addKeys(r)}))),p.mutatedParts=En(p.mutatedParts||{},y),e}))}}),y=(l=function(t){t=(n=t.query).index;var n=n.range;return[t,new mn(null!==(t=n.lower)&&void 0!==t?t:e.MIN_KEY,null!==(n=n.upper)&&void 0!==n?n:e.MAX_KEY)]},{get:function(e){return[s,new mn(e.key)]},getMany:function(e){return[s,(new mn).addKeys(e.keys)]},count:l,query:l,openCursor:l});return i(y).forEach((function(e){p[e]=function(i){var u=!!(p=be.subscr),c=Mn(be,a)&&Fn(e,i)?i.obsSet={}:p;if(u){var s=function(e){return e="idb://".concat(n,"/").concat(o,"/").concat(e),c[e]||(c[e]=new mn)},l=s(""),d=s(":dels"),p=(u=(p=y[e](i))[0],p[1]);if(("query"===e&&u.isPrimaryKey&&!i.values?d:s(u.name||"")).add(p),!u.isPrimaryKey){if("count"!==e){var v="query"===e&&h&&i.values&&a.query(t(t({},i),{values:!1}));return a[e].apply(this,arguments).then((function(t){if("query"===e){if(h&&i.values)return v.then((function(e){return e=e.result,l.addKeys(e),t}));var n=i.values?t.result.map(f):t.result;(i.values?l:d).addKeys(n)}else if("openCursor"===e){var r=t,o=i.values;return r&&Object.create(r,{key:{get:function(){return d.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var e=r.primaryKey;return d.addKey(e),e}},value:{get:function(){return o&&l.addKey(r.primaryKey),r.value}}})}return t}))}d.add(r)}}return a[e].apply(this,arguments)}})),p}})}};function Vn(e,n,r){if(0===r.numFailures)return n;if("deleteRange"===n.type)return null;var o=n.keys?n.keys.length:"values"in n&&n.values?n.values.length:1;return r.numFailures===o?null:(n=t({},n),u(n.keys)&&(n.keys=n.keys.filter((function(e,t){return!(t in r.failures)}))),"values"in n&&u(n.values)&&(n.values=n.values.filter((function(e,t){return!(t in r.failures)}))),n)}function Gn(e,t){return n=e,(void 0===(r=t).lower||(r.lowerOpen?0<st(n,r.lower):0<=st(n,r.lower)))&&(void 0===t.upper||(t.upperOpen?st(e,t.upper)<0:st(e,t.upper)<=0));var n,r}function zn(e,t,n,r,o,i){if(!n||0===n.length)return e;var a=t.query.index,c=a.multiEntry,s=t.query.range,l=r.schema.primaryKey.extractKey,f=a.extractKey,h=(a.lowLevelIndex||a).extractKey;return n=n.reduce((function(e,n){var r=e,o=[];if("add"===n.type||"put"===n.type)for(var i=new mn,a=n.values.length-1;0<=a;--a){var h,d=n.values[a],p=l(d);i.hasKey(p)||(h=f(d),(c&&u(h)?h.some((function(e){return Gn(e,s)})):Gn(h,s))&&(i.addKey(p),o.push(d)))}switch(n.type){case"add":var y=(new mn).addKeys(t.values?e.map((function(e){return l(e)})):e);r=e.concat(t.values?o.filter((function(e){return e=l(e),!y.hasKey(e)&&(y.addKey(e),!0)})):o.map((function(e){return l(e)})).filter((function(e){return!y.hasKey(e)&&(y.addKey(e),!0)})));break;case"put":var v=(new mn).addKeys(n.values.map((function(e){return l(e)})));r=e.filter((function(e){return!v.hasKey(t.values?l(e):e)})).concat(t.values?o:o.map((function(e){return l(e)})));break;case"delete":var m=(new mn).addKeys(n.keys);r=e.filter((function(e){return!m.hasKey(t.values?l(e):e)}));break;case"deleteRange":var b=n.range;r=e.filter((function(e){return!Gn(l(e),b)}))}return r}),e),n===e?e:(n.sort((function(e,t){return st(h(e),h(t))||st(l(e),l(t))})),t.limit&&t.limit<1/0&&(n.length>t.limit?n.length=t.limit:e.length===t.limit&&n.length<t.limit&&(o.dirty=!0)),i?Object.freeze(n):n)}function Yn(e,t){return 0===st(e.lower,t.lower)&&0===st(e.upper,t.upper)&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}var Hn={stack:"dbcore",level:0,name:"Cache",create:function(e){var n=e.schema.name;return t(t({},e),{transaction:function(t,r,o){var i,a,u=e.transaction(t,r,o);return"readwrite"===r&&(a=(i=new AbortController).signal,o=function(o){return function(){if(i.abort(),"readwrite"===r){for(var a=new Set,c=0,s=t;c<s.length;c++){var l=s[c],f=Sn["idb://".concat(n,"/").concat(l)];if(f){var h=e.table(l),d=f.optimisticOps.filter((function(e){return e.trans===u}));if(u._explicit&&o&&u.mutatedParts)for(var p=0,y=Object.values(f.queries.query);p<y.length;p++)for(var v=0,m=(w=y[p]).slice();v<m.length;v++)On((_=m[v]).obsSet,u.mutatedParts)&&(D(w,_),_.subscribers.forEach((function(e){return a.add(e)})));else if(0<d.length){f.optimisticOps=f.optimisticOps.filter((function(e){return e.trans!==u}));for(var b=0,g=Object.values(f.queries.query);b<g.length;b++)for(var w,_,x,k=0,E=(w=g[b]).slice();k<E.length;k++)null!=(_=E[k]).res&&u.mutatedParts&&(o&&!_.dirty?(x=Object.isFrozen(_.res),x=zn(_.res,_.req,d,h,_,x),_.dirty?(D(w,_),_.subscribers.forEach((function(e){return a.add(e)}))):x!==_.res&&(_.res=x,_.promise=xe.resolve({result:x}))):(_.dirty&&D(w,_),_.subscribers.forEach((function(e){return a.add(e)}))))}}}a.forEach((function(e){return e()}))}}},u.addEventListener("abort",o(!1),{signal:a}),u.addEventListener("error",o(!1),{signal:a}),u.addEventListener("complete",o(!0),{signal:a})),u},table:function(r){var o=e.table(r),i=o.schema.primaryKey;return t(t({},o),{mutate:function(e){var a=be.trans;if(i.outbound||"disabled"===a.db._options.cache||a.explicit||"readwrite"!==a.idbtrans.mode)return o.mutate(e);var u=Sn["idb://".concat(n,"/").concat(r)];return u?(a=o.mutate(e),"add"!==e.type&&"put"!==e.type||!(50<=e.values.length||qn(i,e).some((function(e){return null==e})))?(u.optimisticOps.push(e),e.mutatedParts&&Cn(e.mutatedParts),a.then((function(t){0<t.numFailures&&(D(u.optimisticOps,e),(t=Vn(0,e,t))&&u.optimisticOps.push(t),e.mutatedParts&&Cn(e.mutatedParts))})),a.catch((function(){D(u.optimisticOps,e),e.mutatedParts&&Cn(e.mutatedParts)}))):a.then((function(n){var r=Vn(0,t(t({},e),{values:e.values.map((function(e,r){var o;return n.failures[r]||k(e=null!==(o=i.keyPath)&&void 0!==o&&o.includes(".")?K(e):t({},e),i.keyPath,n.results[r]),e}))}),n);u.optimisticOps.push(r),queueMicrotask((function(){return e.mutatedParts&&Cn(e.mutatedParts)}))})),a):o.mutate(e)},query:function(e){if(!Mn(be,o)||!Fn("query",e))return o.query(e);var t="immutable"===(null===(u=be.trans)||void 0===u?void 0:u.db._options.cache),i=(s=be).requery,a=s.signal,u=function(e,t,n,r){var o=Sn["idb://".concat(e,"/").concat(t)];if(!o)return[];if(!(t=o.queries[n]))return[null,!1,o,null];var i=t[(r.query?r.query.index.name:null)||""];if(!i)return[null,!1,o,null];switch(n){case"query":var a=i.find((function(e){return e.req.limit===r.limit&&e.req.values===r.values&&Yn(e.req.query.range,r.query.range)}));return a?[a,!0,o,i]:[i.find((function(e){return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(!r.values||e.req.values)&&function(e,t){return function(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(t=st(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return-1}return t}(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=function(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return-1;if(0===(t=st(e,t))){if(n&&r)return 0;if(n)return-1;if(r)return 1}return t}(e.upper,t.upper,e.upperOpen,t.upperOpen)}(e.req.query.range,r.query.range)})),!1,o,i];case"count":return a=i.find((function(e){return Yn(e.req.query.range,r.query.range)})),[a,!!a,o,i]}}(n,r,"query",e),c=u[0],s=u[1],l=u[2],f=u[3];return c&&s?c.obsSet=e.obsSet:(s=o.query(e).then((function(e){var n=e.result;if(c&&(c.res=n),t){for(var r=0,o=n.length;r<o;++r)Object.freeze(n[r]);Object.freeze(n)}else e.result=K(n);return e})).catch((function(e){return f&&c&&D(f,c),Promise.reject(e)})),c={obsSet:e.obsSet,promise:s,subscribers:new Set,type:"query",req:e,dirty:!1},f?f.push(c):(f=[c],(l=l||(Sn["idb://".concat(n,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[e.query.index.name||""]=f)),function(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",(function(){var r,o;e.subscribers.delete(n),0===e.subscribers.size&&(r=e,o=t,setTimeout((function(){0===r.subscribers.size&&D(o,r)}),3e3))}))}(c,f,i,a),c.promise.then((function(n){return{result:zn(n.result,e,null==l?void 0:l.optimisticOps,o,c,t)}}))}})}})}};function Wn(e,t){return new Proxy(e,{get:function(e,n,r){return"db"===n?t:Reflect.get(e,n,r)}})}var $n=(Qn.prototype.version=function(e){if(isNaN(e)||e<.1)throw new H.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new H.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter((function(t){return t._cfg.version===e}))[0];return n||(n=new this.Version(e),t.push(n),t.sort(nn),n.stores({}),this._state.autoSchema=!1,n)},Qn.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||be.letThrough||this._vip)?e():new xe((function(e,n){if(t._state.openComplete)return n(new H.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new H.DatabaseClosed);t.open().catch(Q)}t._state.dbReadyPromise.then(e,n)})).then(e)},Qn.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,o=e.name;return o&&this.unuse({stack:t,name:o}),(e=this._middlewares[t]||(this._middlewares[t]=[])).push({stack:t,create:n,level:null==r?10:r,name:o}),e.sort((function(e,t){return e.level-t.level})),this},Qn.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter((function(e){return r?e.create!==r:!!n&&e.name!==n}))),this},Qn.prototype.open=function(){var e=this;return We(me,(function(){return function(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((function(){return t.dbOpenError?Xe(t.dbOpenError):e}));t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,o=Math.round(10*e.verno),u=!1;function c(){if(t.openCanceller!==r)throw new H.DatabaseClosed("db.open() was cancelled")}var s,l=t.dbReadyResolve,f=null,h=!1;return xe.race([r,("undefined"==typeof navigator?xe.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(e){function t(){return indexedDB.databases().finally(e)}s=setInterval(t,100),t()})).finally((function(){return clearInterval(s)})):Promise.resolve()).then((function r(){return new xe((function(s,l){if(c(),!n)throw new H.MissingAPI;var d=e.name,p=t.autoSchema||!o?n.open(d):n.open(d,o);if(!p)throw new H.MissingAPI;p.onerror=Rt(l),p.onblocked=Be(e._fireOnBlocked),p.onupgradeneeded=Be((function(r){var o;f=p.transaction,t.autoSchema&&!e._options.allowEmptyDB?(p.onerror=Lt,f.abort(),p.result.close(),(o=n.deleteDatabase(d)).onsuccess=o.onerror=Be((function(){l(new H.NoSuchDatabase("Database ".concat(d," doesnt exist")))}))):(f.onerror=Rt(l),r=r.oldVersion>Math.pow(2,62)?0:r.oldVersion,h=r<1,e.idbdb=p.result,u&&function(e,t){an(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=cn(0,e.idbdb,t);sn(e,e._dbSchema,t);for(var r=0,o=rn(n,e._dbSchema).change;r<o.length;r++){var i=function(e){if(e.change.length||e.recreate)return console.warn("Unable to patch indexes of table ".concat(e.name," because it has changes on the type of index or primary key.")),{value:void 0};var n=t.objectStore(e.name);e.add.forEach((function(t){ie&&console.debug("Dexie upgrade patch: Creating missing index ".concat(e.name,".").concat(t.src)),un(n,t)}))}(o[r]);if("object"==a(i))return i.value}}(e,f),function(e,t,n,r){var o=e._dbSchema;n.objectStoreNames.contains("$meta")&&!o.$meta&&(o.$meta=Yt("$meta",ln("")[0],[]),e._storeNames.push("$meta"));var a=e._createTransaction("readwrite",e._storeNames,o);a.create(n),a._completion.catch(r);var u=a._reject.bind(a),c=be.transless||be;Fe((function(){return be.trans=a,be.transless=c,0!==t?(Zt(e,n),s=t,((r=a).storeNames.includes("$meta")?r.table("$meta").get("version").then((function(e){return null!=e?e:s})):xe.resolve(s)).then((function(t){return o=t,u=a,c=n,s=[],t=(r=e)._versions,l=r._dbSchema=cn(0,r.idbdb,c),0!==(t=t.filter((function(e){return e._cfg.version>=o}))).length?(t.forEach((function(e){s.push((function(){var t=l,n=e._cfg.dbschema;sn(r,t,c),sn(r,n,c),l=r._dbSchema=n;var a=rn(t,n);a.add.forEach((function(e){on(c,e[0],e[1].primKey,e[1].indexes)})),a.change.forEach((function(e){if(e.recreate)throw new H.Upgrade("Not yet support for changing primary key");var t=c.objectStore(e.name);e.add.forEach((function(e){return un(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),un(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var s=e._cfg.contentUpgrade;if(s&&e._cfg.version>o){Zt(r,c),u._memoizedTables={};var f=E(n);a.del.forEach((function(e){f[e]=t[e]})),tn(r,[r.Transaction.prototype]),en(r,[r.Transaction.prototype],i(f),f),u.schema=f;var h,d=L(s);return d&&Ue(),a=xe.follow((function(){var e;(h=s(u))&&d&&(e=Ve.bind(null,null),h.then(e,e))})),h&&"function"==typeof h.then?xe.resolve(h):a.then((function(){return h}))}})),s.push((function(t){var n,o,i=e._cfg.dbschema;n=i,o=t,[].slice.call(o.db.objectStoreNames).forEach((function(e){return null==n[e]&&o.db.deleteObjectStore(e)})),tn(r,[r.Transaction.prototype]),en(r,[r.Transaction.prototype],r._storeNames,r._dbSchema),u.schema=r._dbSchema})),s.push((function(t){r.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(r.idbdb.version/10)===e._cfg.version?(r.idbdb.deleteObjectStore("$meta"),delete r._dbSchema.$meta,r._storeNames=r._storeNames.filter((function(e){return"$meta"!==e}))):t.objectStore("$meta").put(e._cfg.version,"version"))}))})),function e(){return s.length?xe.resolve(s.shift()(u.idbtrans)).then(e):xe.resolve()}().then((function(){an(l,c)}))):xe.resolve();var r,o,u,c,s,l})).catch(u)):(i(o).forEach((function(e){on(n,e,o[e].primKey,o[e].indexes)})),Zt(e,n),void xe.follow((function(){return e.on.populate.fire(a)})).catch(u));var r,s}))}(e,r/10,f,l))}),l),p.onsuccess=Be((function(){f=null;var n,a,c,l,y,v=e.idbdb=p.result,m=b(v.objectStoreNames);if(0<m.length)try{var g=v.transaction(1===(l=m).length?l[0]:l,"readonly");if(t.autoSchema)a=v,c=g,(n=e).verno=a.version/10,c=n._dbSchema=cn(0,a,c),n._storeNames=b(a.objectStoreNames,0),en(n,[n._allTables],i(c),c);else if(sn(e,e._dbSchema,g),((y=rn(cn(0,(y=e).idbdb,g),y._dbSchema)).add.length||y.change.some((function(e){return e.add.length||e.change.length})))&&!u)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),v.close(),o=v.version+1,u=!0,s(r());Zt(e,g)}catch(n){}tt.push(e),v.onversionchange=Be((function(n){t.vcFired=!0,e.on("versionchange").fire(n)})),v.onclose=Be((function(t){e.on("close").fire(t)})),h&&(y=e._deps,g=d,v=y.indexedDB,y=y.IDBKeyRange,pn(v)||g===nt||dn(v,y).put({name:g}).catch(Q)),s()}),l)})).catch((function(e){switch(null==e?void 0:e.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),r();break;case"VersionError":if(0<o)return o=0,r()}return xe.reject(e)}))}))]).then((function(){return c(),t.onReadyBeingFired=[],xe.resolve(yn((function(){return e.on.ready.fire(e.vip)}))).then((function n(){if(0<t.onReadyBeingFired.length){var r=t.onReadyBeingFired.reduce(oe,Q);return t.onReadyBeingFired=[],xe.resolve(yn((function(){return r(e.vip)}))).then(n)}}))})).finally((function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)})).catch((function(n){t.dbOpenError=n;try{f&&f.abort()}catch(n){}return r===t.openCanceller&&e._close(),Xe(n)})).finally((function(){t.openComplete=!0,l()})).then((function(){var t;return h&&(t={},e.tables.forEach((function(n){n.schema.indexes.forEach((function(r){r.name&&(t["idb://".concat(e.name,"/").concat(n.name,"/").concat(r.name)]=new mn(-1/0,[[[]]]))})),t["idb://".concat(e.name,"/").concat(n.name,"/")]=t["idb://".concat(e.name,"/").concat(n.name,"/:dels")]=new mn(-1/0,[[[]]])})),Ft(Nt).fire(t),Kn(t,!0)),e}))}(e)}))},Qn.prototype._close=function(){var e=this._state,t=tt.indexOf(this);if(0<=t&&tt.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(t){}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new xe((function(t){e.dbReadyResolve=t})),e.openCanceller=new xe((function(t,n){e.cancelOpen=n})))},Qn.prototype.close=function(e){var t=(void 0===e?{disableAutoOpen:!0}:e).disableAutoOpen;e=this._state,t?(e.isBeingOpened&&e.cancelOpen(new H.DatabaseClosed),this._close(),e.autoOpen=!1,e.dbOpenError=new H.DatabaseClosed):(this._close(),e.autoOpen=this._options.autoOpen||e.isBeingOpened,e.openComplete=!1,e.dbOpenError=null)},Qn.prototype.delete=function(e){var t=this;void 0===e&&(e={disableAutoOpen:!0});var n=0<arguments.length&&"object"!=a(arguments[0]),r=this._state;return new xe((function(o,i){function a(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=Be((function(){var e,n,r;e=t._deps,n=t.name,r=e.indexedDB,e=e.IDBKeyRange,pn(r)||n===nt||dn(r,e).delete(n).catch(Q),o()})),n.onerror=Rt(i),n.onblocked=t._fireOnBlocked}if(n)throw new H.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()}))},Qn.prototype.backendDB=function(){return this.idbdb},Qn.prototype.isOpen=function(){return null!==this.idbdb},Qn.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},Qn.prototype.hasFailed=function(){return null!==this._state.dbOpenError},Qn.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(Qn.prototype,"tables",{get:function(){var e=this;return i(this._allTables).map((function(t){return e._allTables[t]}))},enumerable:!1,configurable:!0}),Qn.prototype.transaction=function(){var e=function(e,t,n){var r=arguments.length;if(r<2)throw new H.InvalidArgument("Too few arguments");for(var o=new Array(r-1);--r;)o[r-1]=arguments[r];return n=o.pop(),[e,S(o),n]}.apply(this,arguments);return this._transaction.apply(this,e)},Qn.prototype._transaction=function(e,t,n){var r=this,o=be.trans;o&&o.db===this&&-1===e.indexOf("!")||(o=null);var i,a,u=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map((function(e){if("string"!=typeof(e=e instanceof r.Table?e.name:e))throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e})),"r"==e||e===rt)i=rt;else{if("rw"!=e&&e!=ot)throw new H.InvalidArgument("Invalid transaction mode: "+e);i=ot}if(o){if(o.mode===rt&&i===ot){if(!u)throw new H.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o=null}o&&a.forEach((function(e){if(o&&-1===o.storeNames.indexOf(e)){if(!u)throw new H.SubTransaction("Table "+e+" not included in parent transaction.");o=null}})),u&&o&&!o.active&&(o=null)}}catch(n){return o?o._promise(null,(function(e,t){t(n)})):Xe(n)}var c=function e(t,n,r,o,i){return xe.resolve().then((function(){var a=be.transless||be,u=t._createTransaction(n,r,t._dbSchema,o);if(u.explicit=!0,a={trans:u,transless:a},o)u.idbtrans=o.idbtrans;else try{u.create(),u.idbtrans._explicit=!0,t._state.PR1398_maxLoop=3}catch(a){return a.name===z.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,null,i)}))):Xe(a)}var c,s=L(i);return s&&Ue(),a=xe.follow((function(){var e;(c=i.call(u,u))&&(s?(e=Ve.bind(null,null),c.then(e,e)):"function"==typeof c.next&&"function"==typeof c.throw&&(c=An(c)))}),a),(c&&"function"==typeof c.then?xe.resolve(c).then((function(e){return u.active?e:Xe(new H.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):a.then((function(){return c}))).then((function(e){return o&&u._resolve(),u._completion.then((function(){return e}))})).catch((function(e){return u._reject(e),Xe(e)}))}))}.bind(null,this,i,a,o,n);return o?o._promise(i,c,"lock"):be.trans?We(be.transless,(function(){return r._whenReady(c)})):this._whenReady(c)},Qn.prototype.table=function(e){if(!f(this._allTables,e))throw new H.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},Qn);function Qn(e,n){var r=this;this._middlewares={},this.verno=0;var o=Qn.dependencies;this._options=n=t({addons:Qn.addons,autoOpen:!0,indexedDB:o.indexedDB,IDBKeyRange:o.IDBKeyRange,cache:"cloned"},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},o=n.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var i,a,u,c,s,l={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Q,dbReadyPromise:null,cancelOpen:Q,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:n.autoOpen};l.dbReadyPromise=new xe((function(e){l.dbReadyResolve=e})),l.openCanceller=new xe((function(e,t){l.cancelOpen=t})),this._state=l,this.name=e,this.on=pt(this,"populate","blocked","versionchange","close",{ready:[oe,Q]}),this.on.ready.subscribe=g(this.on.ready.subscribe,(function(e){return function(t,n){Qn.vip((function(){var o,i=r._state;i.openComplete?(i.dbOpenError||xe.resolve().then(t),n&&e(t)):i.onReadyBeingFired?(i.onReadyBeingFired.push(t),n&&e(t)):(e(t),o=r,n||e((function e(){o.on.ready.unsubscribe(t),o.on.ready.unsubscribe(e)})))}))}})),this.Collection=(i=this,yt(Ot.prototype,(function(e,t){this.db=i;var n=at,r=null;if(t)try{n=t()}catch(e){r=e}var o=e._ctx;e=(t=o.table).hook.reading.fire,this._ctx={table:t,index:o.index,isPrimKey:!o.index||t.schema.primKey.keyPath&&o.index===t.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:o.or,valueMapper:e!==X?e:null}}))),this.Table=(a=this,yt(ht.prototype,(function(e,t,n){this.db=a,this._tx=n,this.name=e,this.schema=t,this.hook=a._allTables[e]?a._allTables[e].hook:pt(null,{creating:[ee,Q],reading:[J,X],updating:[ne,Q],deleting:[te,Q]})}))),this.Transaction=(u=this,yt(Ut.prototype,(function(e,t,n,r,o){var i=this;this.db=u,this.mode=e,this.storeNames=t,this.schema=n,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=pt(this,"complete","error","abort"),this.parent=o||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new xe((function(e,t){i._resolve=e,i._reject=t})),this._completion.then((function(){i.active=!1,i.on.complete.fire()}),(function(e){var t=i.active;return i.active=!1,i.on.error.fire(e),i.parent?i.parent._reject(e):t&&i.idbtrans&&i.idbtrans.abort(),Xe(e)}))}))),this.Version=(c=this,yt(fn.prototype,(function(e){this.db=c,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))),this.WhereClause=(s=this,yt(Dt.prototype,(function(e,t,n){if(this.db=s,this._ctx={table:e,index:":id"===t?null:t,or:n},this._cmp=this._ascending=st,this._descending=function(e,t){return st(t,e)},this._max=function(e,t){return 0<st(e,t)?e:t},this._min=function(e,t){return st(e,t)<0?e:t},this._IDBKeyRange=s._deps.IDBKeyRange,!this._IDBKeyRange)throw new H.MissingAPI}))),this.on("versionchange",(function(e){0<e.newVersion?console.warn("Another connection wants to upgrade database '".concat(r.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(r.name,"'. Closing db now to resume the delete request.")),r.close({disableAutoOpen:!1})})),this.on("blocked",(function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('".concat(r.name,"') was blocked")):console.warn("Upgrade '".concat(r.name,"' blocked by other connection holding version ").concat(e.oldVersion/10))})),this._maxKey=Ht(n.IDBKeyRange),this._createTransaction=function(e,t,n,o){return new r.Transaction(e,t,n,r._options.chromeTransactionDurability,o)},this._fireOnBlocked=function(e){r.on("blocked").fire(e),tt.filter((function(e){return e.name===r.name&&e!==r&&!e._state.vcFired})).map((function(t){return t.on("versionchange").fire(e)}))},this.use(Nn),this.use(Hn),this.use(Un),this.use(Bn),this.use(Rn);var f=new Proxy(this,{get:function(e,t,n){if("_vip"===t)return!0;if("table"===t)return function(e){return Wn(r.table(e),f)};var o=Reflect.get(e,t,n);return o instanceof ht?Wn(o,f):"tables"===t?o.map((function(e){return Wn(e,f)})):"_createTransaction"===t?function(){return Wn(o.apply(this,arguments),f)}:o}});this.vip=f,o.forEach((function(e){return e(r)}))}N="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";var Xn,Jn=(Zn.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},Zn.prototype[N]=function(){return this},Zn);function Zn(e){this._subscribe=e}try{Xn={indexedDB:o.indexedDB||o.mozIndexedDB||o.webkitIndexedDB||o.msIndexedDB,IDBKeyRange:o.IDBKeyRange||o.webkitIDBKeyRange}}catch(P){Xn={indexedDB:null,IDBKeyRange:null}}function er(e){var t,n=!1,r=new Jn((function(r){var o,i=L(e),a=!1,u={},c={},s={get closed(){return a},unsubscribe:function(){a||(a=!0,o&&o.abort(),l&&Ft.storagemutated.unsubscribe(d))}};r.start&&r.start(s);var l=!1,h=function(){return Qe(p)},d=function(e){En(u,e),On(c,u)&&h()},p=function(){var s,p,y;!a&&Xn.indexedDB&&(u={},s={},o&&o.abort(),o=new AbortController,y=function(t){var n=Ke();try{i&&Ue();var r=Fe(e,t);return r=i?r.finally(Ve):r}finally{n&&Te()}}(p={subscr:s,signal:o.signal,requery:h,querier:e,trans:null}),Promise.resolve(y).then((function(e){n=!0,t=e,a||p.signal.aborted||(u={},function(e){for(var t in e)if(f(e,t))return;return 1}(c=s)||l||(Ft(Nt,d),l=!0),Qe((function(){return!a&&r.next&&r.next(e)})))}),(function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||a||Qe((function(){a||r.error&&r.error(e)}))})))};return setTimeout(h,0),s}));return r.hasValue=function(){return n},r.getValue=function(){return t},r}var tr=$n;function nr(e){var t=or;try{or=!0,Ft.storagemutated.fire(e),Kn(e,!0)}finally{or=t}}h(tr,t(t({},$),{delete:function(e){return new tr(e,{addons:[]}).delete()},exists:function(e){return new tr(e,{addons:[]}).open().then((function(e){return e.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(e){try{return n=(t=tr.dependencies).indexedDB,t=t.IDBKeyRange,(pn(n)?Promise.resolve(n.databases()).then((function(e){return e.map((function(e){return e.name})).filter((function(e){return e!==nt}))})):dn(n,t).toCollection().primaryKeys()).then(e)}catch(e){return Xe(new H.MissingAPI)}var t,n},defineClass:function(){return function(e){c(this,e)}},ignoreTransaction:function(e){return be.trans?We(be.transless,e):e()},vip:yn,async:function(e){return function(){try{var t=An(e.apply(this,arguments));return t&&"function"==typeof t.then?t:xe.resolve(t)}catch(t){return Xe(t)}}},spawn:function(e,t,n){try{var r=An(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:xe.resolve(r)}catch(e){return Xe(e)}},currentTransaction:{get:function(){return be.trans||null}},waitFor:function(e,t){return t=xe.resolve("function"==typeof e?tr.ignoreTransaction(e):e).timeout(t||6e4),be.trans?be.trans.waitFor(t):t},Promise:xe,debug:{get:function(){return ie},set:function(e){ae(e)}},derive:y,extend:c,props:h,override:g,Events:pt,on:Ft,liveQuery:er,extendObservabilitySet:En,getByKeyPath:x,setByKeyPath:k,delByKeyPath:function(e,t){"string"==typeof t?k(e,t,void 0):"length"in t&&[].map.call(t,(function(t){k(e,t,void 0)}))},shallowClone:E,deepClone:K,getObjectDiff:Dn,cmp:st,asap:_,minKey:-1/0,addons:[],connections:tt,errnames:z,dependencies:Xn,cache:Sn,semVer:"4.0.11",version:"4.0.11".split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)}))})),tr.maxKey=Ht(tr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(Ft(Nt,(function(e){or||(e=new CustomEvent(Mt,{detail:e}),or=!0,dispatchEvent(e),or=!1)})),addEventListener(Mt,(function(e){e=e.detail,or||nr(e)})));var rr,or=!1,ir=function(){};return"undefined"!=typeof BroadcastChannel&&((ir=function(){(rr=new BroadcastChannel(Mt)).onmessage=function(e){return e.data&&nr(e.data)}})(),"function"==typeof rr.unref&&rr.unref(),Ft(Nt,(function(e){or||rr.postMessage(e)}))),"undefined"!=typeof addEventListener&&(addEventListener("pagehide",(function(e){if(!$n.disableBfCache&&e.persisted){ie&&console.debug("Dexie: handling persisted pagehide"),null!=rr&&rr.close();for(var t=0,n=tt;t<n.length;t++)n[t].close({disableAutoOpen:!1})}})),addEventListener("pageshow",(function(e){!$n.disableBfCache&&e.persisted&&(ie&&console.debug("Dexie: handling persisted pageshow"),ir(),nr({all:new mn(-1/0,[[]])}))}))),xe.rejectionMapper=function(e,t){return!e||e instanceof F||e instanceof TypeError||e instanceof SyntaxError||!e.name||!W[e.name]?e:(t=new W[e.name](t||e.message,e),"stack"in e&&p(t,"stack",{get:function(){return this.inner.stack}}),t)},ae(ie),t($n,Object.freeze({__proto__:null,Dexie:$n,liveQuery:er,Entity:ct,cmp:st,PropModification:kt,replacePrefix:function(e,t){return new kt({replacePrefix:[e,t]})},add:function(e){return new kt({add:e})},remove:function(e){return new kt({remove:e})},default:$n,RangeSet:mn,mergeRanges:gn,rangesOverlap:wn}),{default:$n}),$n},"object"==a(t)?e.exports=i():void 0===(o="function"==typeof(r=i)?r.call(t,n,t,e):r)||(e.exports=o)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{"use strict";const e=function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return'<div class="docuchatMain_main_body_wrapper_ai">\n                <div class="docuchatMain_main_body_wrapper_ai_wrapper">\n                <b>'.concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,'</b>\n                <div class="docuchatMain_main_body_wrapper_ai_wrapper_bubble">\n                ').concat(e&&e," \n           </div>     \n          </div>\n        </div>")};var t=n(956),r=Symbol.for("Dexie"),o=globalThis[r]||(globalThis[r]=t);if(t.semVer!==o.semVer)throw new Error("Two different versions of Dexie loaded in the same app: ".concat(t.semVer," and ").concat(o.semVer));o.liveQuery,o.mergeRanges,o.rangesOverlap,o.RangeSet,o.cmp,o.Entity,o.PropModification,o.replacePrefix,o.add,o.remove;const i=o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}const s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.db,this.dcdb="docuchatDB",this.init()},(t=[{key:"init",value:function(){return this.db=new i(this.dcdb),this.db.version(1).stores({chat:"++id, emisor, message"}),this.db}}])&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),l=function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return'<div class="docuchatMain_main_body_wrapper_humman">\n            <div class="docuchatMain_main_body_wrapper_humman_wrapper">\n            <b>'.concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,'</b>\n            <div class="docuchatMain_main_body_wrapper_humman_wrapper_bubble">\n            ').concat(e&&e," \n       </div>     \n      </div>\n    </div>")};var f=function(){var e=document.getElementsByClassName("docuchatMain_main_body_wrapper")[0];e.scrollTop=e.scrollHeight};function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function p(e){var t=function(e){if("object"!=h(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}const y=function(){return t=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.containerIconChat,this.clientdb=(new s).db,this.init()},(n=[{key:"init",value:function(){var t=this;try{document.getElementsByClassName("docuchatMain_main_body_wrapper")[0]&&(this.containerIconChat=document.getElementsByClassName("docuchatMain_main_body_wrapper")[0],this.containerIconChat.innerHTML+=e("AI","".concat(ajax.initialMessage)),this.clientdb.chat.toArray().then((function(n){n&&n.map((function(n){"AI"==n.transmiter?t.containerIconChat.innerHTML+=e(n.transmiter,n.message):t.containerIconChat.innerHTML+=l(n.transmiter,n.message)}))})))}catch(e){console.log(e)}finally{setTimeout((function(){f()}),500)}}}])&&d(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,b(r.key),r)}}function b(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}const g=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.containerIconChat,this.class="open",this.timeOut,this.timer=3e3,this.eventType="mouseenter",this.automaticRevealChat()},(t=[{key:"automaticRevealChat",value:function(){var e=this;try{document.getElementsByClassName("docuChatRevealChat_wrapper")[0]&&(this.containerIconChat=document.getElementsByClassName("docuChatRevealChat_wrapper")[0]),this.containerIconChat.addEventListener(this.eventType,(function(){e.containerIconChat.classList.add(e.class),e.timeOut=setTimeout((function(){e.containerIconChat.classList.remove(e.class)}),e.timer)}))}catch(e){console.log(e)}finally{clearTimeout(this.timeOut)}}}])&&m(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),w=function(){var e=document.getElementById("loaderChat");e&&e.classList.toggle("active")};function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function x(){x=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),u=new A(r||[]);return o(a,"_invoke",{value:j(e,n,u)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",v={};function m(){}function b(){}function g(){}var w={};s(w,a,(function(){return this}));var k=Object.getPrototypeOf,E=k&&k(k(I([])));E&&E!==n&&r.call(E,a)&&(w=E);var O=g.prototype=m.prototype=Object.create(w);function S(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function n(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==_(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function j(t,n,r){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var c=C(u,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var s=f(t,n,r);if("normal"===s.type){if(o=r.done?y:d,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=y,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function K(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(K,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(_(t)+" is not iterable")}return b.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},S(P.prototype),s(P.prototype,u,(function(){return this})),t.AsyncIterator=P,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new P(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(O),s(O,c,"Generator"),s(O,a,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function k(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,O(r.key),r)}}function O(e){var t=function(e){if("object"!=_(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_(t)?t:t+""}const S=function(){return t=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.containerIconChat,this.humanText,this.animation,this.init(),this.clientdb=(new s).db},n=[{key:"init",value:function(){var e=this;try{document.getElementsByClassName("docuchatMain_main_body_wrapper")[0]&&document.getElementsByClassName("docuchatMain_main_footer_form")[0]&&document.getElementsByClassName("docuchatMain_main_body_wrapper_loadingAmination")[0]&&(this.containerIconChat=document.getElementsByClassName("docuchatMain_main_body_wrapper")[0],this.humanText=document.getElementsByClassName("docuchatMain_main_footer_form")[0],this.humanText&&this.humanText.addEventListener("submit",(function(t){t.preventDefault(),w(),e.containerIconChat.innerHTML+=l("Me",e.humanText.children[0].value),e.clientdb.chat.add({transmiter:"Me",message:e.humanText.children[0].value}).then((function(){console.log("Data added to object store")})).catch((function(e){console.log("Data not added to object store",e)})),e.getResponse(e.humanText.children[0].value),e.humanText.children[0].value="",f()})))}catch(e){console.log(e)}}},{key:"getResponse",value:function(t){var n,r,o=this;try{t&&ajax.token&&jQuery.ajax({type:"post",url:ajax.url,dataType:"text",data:"action=llmChat&nonce=".concat(ajax.nonce,"&token=").concat(ajax.token,"&message=").concat(t),success:(n=x().mark((function t(n){var r,i,a,u,c;return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,JSON.parse(n);case 2:200==(i=t.sent).status&&null!=i&&null!==(r=i.message)&&void 0!==r&&r.body&&((u=JSON.parse(null==i||null===(a=i.message)||void 0===a?void 0:a.body)).message.status,c=u.message.message,o.containerIconChat.innerHTML+=e("AI",c),o.clientdb.chat.add({transmiter:"AI",message:c})),f(),w();case 6:case"end":return t.stop()}}),t)})),r=function(){var e=this,t=arguments;return new Promise((function(r,o){var i=n.apply(e,t);function a(e){k(i,r,o,a,u,"next",e)}function u(e){k(i,r,o,a,u,"throw",e)}a(void 0)}))},function(e){return r.apply(this,arguments)}),error:function(e){console.log("error",e)}})}catch(e){console.log("Error",e)}}}],n&&E(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,C(r.key),r)}}function C(e){var t=function(e){if("object"!=P(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=P(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==P(t)?t:t+""}const K=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.chatrobot=document.querySelector(".docuChatRevealChat"),this.chatBox=document.querySelector(".docuchatMain"),this.init()},(t=[{key:"init",value:function(){document.cookie.split(";").filter((function(e){return e.trim().includes("docuchat_chatStatus")})).length>0?this.chatBox&&this.chatBox.classList.add("active"):this.chatrobot&&this.chatrobot.classList.add("active")}}])&&j(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function A(){A=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),u=new K(r||[]);return o(a,"_invoke",{value:S(e,n,u)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",v={};function m(){}function b(){}function g(){}var w={};s(w,a,(function(){return this}));var _=Object.getPrototypeOf,x=_&&_(_(I([])));x&&x!==n&&r.call(x,a)&&(w=x);var k=g.prototype=m.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==T(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function S(t,n,r){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var c=P(u,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var s=f(t,n,r);if("normal"===s.type){if(o=r.done?y:d,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=y,r.method="throw",r.arg=s.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function K(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(T(t)+" is not iterable")}return b.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(O.prototype),s(O.prototype,u,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new O(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),s(k,c,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,K.prototype={constructor:K,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function I(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function B(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){I(i,r,o,a,u,"next",e)}function u(e){I(i,r,o,a,u,"throw",e)}a(void 0)}))}}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,q(r.key),r)}}function q(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=T(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}const R=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.openChat=document.querySelector(".docuChatRevealChat"),this.chatBox=document.querySelector(".docuchatMain"),this.closeChat=document.querySelector(".docuchatMain_main_header_actions_wrapper_minimize"),this.clearChatAndHistory=document.querySelector(".docuchatMain_main_header_actions_wrapper_close"),this.date=new Date,this.date.setTime(this.date.getTime()+6048e5),this.expiresOnSevenDays="; expires="+this.date.toUTCString(),this.expireInmediately="; expires=Thu, 01 Jan 1970 00:00:00 UTC",this.init()},(t=[{key:"init",value:function(){var e=this;this.openChat.addEventListener("click",(function(){document.cookie="docuchat_chatStatus=active"+e.expiresOnSevenDays+"; path=/",e.openChat.classList.remove("active"),e.chatBox.classList.add("active")})),this.closeChat.addEventListener("click",(function(){return e.hiddeBoxAndShowButton()})),this.clearChatAndHistory.addEventListener("click",B(A().mark((function t(){var n,r;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(new s).db,t.next=3,n.table("chat").count();case 3:r=t.sent,document.cookie.split(";").filter((function(e){return e.trim().includes("docuchat_chatStatus")})).length>0&&r>0&&confirm(" ⌛️ Are you sure you want to clear the chat history?")&&(new s).db.delete().then((function(){console.log("Database successfully deleted"),document.cookie="docuchat_chatStatus=hidden"+e.expireInmediately+"; path=/",e.hiddeBoxAndShowButton(),window.location.reload()}));case 7:case"end":return t.stop()}}),t)}))))}},{key:"hiddeBoxAndShowButton",value:function(){document.cookie="docuchat_chatStatus=hidden"+this.expireInmediately+"; path=/",this.openChat.classList.add("active"),this.chatBox.classList.remove("active")}}])&&D(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();window.addEventListener("load",(function(){window.RevealIconChat=new g,window.InitialInteraction=new y,window.HummanInteraction=new S,window.ShowAndHideChatStatus=new K,window.ChatShowAndHiddeAction=new R}))})()})();
     2(()=>{var e={956:function(e,t,n){var r,o,i;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}i=function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)},t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function r(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||((r=r||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,i=Object.keys,u=Array.isArray;function c(e,t){return"object"!=a(t)||i(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||o.Promise||(o.Promise=Promise);var s=Object.getPrototypeOf,l={}.hasOwnProperty;function f(e,t){return l.call(e,t)}function h(e,t){"function"==typeof t&&(t=t(s(e))),("undefined"==typeof Reflect?i:Reflect.ownKeys)(t).forEach((function(n){p(e,n,t[n])}))}var d=Object.defineProperty;function p(e,t,n,r){d(e,t,c(n&&f(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function y(e){return{from:function(t){return e.prototype=Object.create(t.prototype),p(e.prototype,"constructor",e),{extend:h.bind(null,e.prototype)}}}}var v=Object.getOwnPropertyDescriptor,m=[].slice;function b(e,t,n){return m.call(e,t,n)}function g(e,t){return t(e)}function w(e){if(!e)throw new Error("Assertion Failed")}function _(e){o.setImmediate?setImmediate(e):setTimeout(e,0)}function x(e,t){if("string"==typeof t&&f(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,o=t.length;r<o;++r){var i=x(e,t[r]);n.push(i)}return n}var a=t.indexOf(".");if(-1!==a){var u=e[t.substr(0,a)];return null==u?void 0:x(u,t.substr(a+1))}}function k(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){w("string"!=typeof n&&"length"in n);for(var r=0,o=t.length;r<o;++r)k(e,t[r],n[r])}else{var i,a,c=t.indexOf(".");-1!==c?(i=t.substr(0,c),""===(a=t.substr(c+1))?void 0===n?u(e)&&!isNaN(parseInt(i))?e.splice(i,1):delete e[i]:e[i]=n:k(c=(c=e[i])&&f(e,i)?c:e[i]={},a,n)):void 0===n?u(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function E(e){var t,n={};for(t in e)f(e,t)&&(n[t]=e[t]);return n}var O=[].concat;function S(e){return O.apply([],e)}var P="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(S([8,16,32,64].map((function(e){return["Int","Uint","Float"].map((function(t){return t+e+"Array"}))})))).filter((function(e){return o[e]})),j=new Set(P.map((function(e){return o[e]}))),C=null;function K(e){return C=new WeakMap,e=function e(t){if(!t||"object"!=a(t))return t;var n=C.get(t);if(n)return n;if(u(t)){n=[],C.set(t,n);for(var r=0,o=t.length;r<o;++r)n.push(e(t[r]))}else if(j.has(t.constructor))n=t;else{var i,c=s(t);for(i in n=c===Object.prototype?{}:Object.create(c),C.set(t,n),t)f(t,i)&&(n[i]=e(t[i]))}return n}(e),C=null,e}var T={}.toString;function A(e){return T.call(e).slice(8,-1)}var I="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",B="symbol"==a(I)?function(e){var t;return null!=e&&(t=e[I])&&t.apply(e)}:function(){return null};function D(e,t){return 0<=(t=e.indexOf(t))&&e.splice(t,1),0<=t}var q={};function R(e){var t,n,r,o;if(1===arguments.length){if(u(e))return e.slice();if(this===q&&"string"==typeof e)return[e];if(o=B(e)){for(n=[];!(r=o.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"!=typeof(t=e.length))return[e];for(n=new Array(t);t--;)n[t]=e[t];return n}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var L="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},N=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(ce=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"]),M={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function F(e,t){this.name=e,this.message=t}function U(e,t){return e+". Errors: "+Object.keys(t).map((function(e){return t[e].toString()})).filter((function(e,t,n){return n.indexOf(e)===t})).join("\n")}function V(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=U(e,t)}function G(e,t){this.name="BulkError",this.failures=Object.keys(t).map((function(e){return t[e]})),this.failuresByPos=t,this.message=U(e,this.failures)}y(F).from(Error).extend({toString:function(){return this.name+": "+this.message}}),y(V).from(F),y(G).from(F);var z=N.reduce((function(e,t){return e[t]=t+"Error",e}),{}),Y=F,H=N.reduce((function(e,t){var n=t+"Error";function r(e,r){this.name=n,e?"string"==typeof e?(this.message="".concat(e).concat(r?"\n "+r:""),this.inner=r||null):"object"==a(e)&&(this.message="".concat(e.name," ").concat(e.message),this.inner=e):(this.message=M[t]||n,this.inner=null)}return y(r).from(Y),e[t]=r,e}),{});H.Syntax=SyntaxError,H.Type=TypeError,H.Range=RangeError;var W=ce.reduce((function(e,t){return e[t+"Error"]=H[t],e}),{}),$=N.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=H[t]),e}),{});function Q(){}function X(e){return e}function J(e,t){return null==e||e===X?t:function(n){return t(e(n))}}function Z(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ee(e,t){return e===Q?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?Z(r,this.onsuccess):r),o&&(this.onerror=this.onerror?Z(o,this.onerror):o),void 0!==i?i:n}}function te(e,t){return e===Q?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?Z(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Z(r,this.onerror):r)}}function ne(e,t){return e===Q?t:function(n){var r=e.apply(this,arguments);c(n,r);var o=this.onsuccess,i=this.onerror;return this.onsuccess=null,this.onerror=null,n=t.apply(this,arguments),o&&(this.onsuccess=this.onsuccess?Z(o,this.onsuccess):o),i&&(this.onerror=this.onerror?Z(i,this.onerror):i),void 0===r?void 0===n?void 0:n:c(r,n)}}function re(e,t){return e===Q?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function oe(e,t){return e===Q?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,o=arguments.length,i=new Array(o);o--;)i[o]=arguments[o];return n.then((function(){return t.apply(r,i)}))}return t.apply(this,arguments)}}$.ModifyError=V,$.DexieError=F,$.BulkError=G;var ie="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function ae(e){ie=e}var ue={},ce=(P="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,s(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,s(t),e]}(),P[0]),se=(N=P[1],P=P[2],N=N&&N.then,ce&&ce.constructor),le=!!P,fe=function(e,t){ge.push([e,t]),de&&(queueMicrotask(Ce),de=!1)},he=!0,de=!0,pe=[],ye=[],ve=X,me={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Q,pgp:!1,env:{},finalize:Q},be=me,ge=[],we=0,_e=[];function xe(e){if("object"!=a(this))throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=be;if("function"!=typeof e){if(e!==ue)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Oe(this,this._value))}this._state=null,this._value=null,++t.ref,function e(t,n){try{n((function(n){if(null===t._state){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&Ke();n&&"function"==typeof n.then?e(t,(function(e,t){n instanceof xe?n._then(e,t):n.then(e,t)})):(t._state=!0,t._value=n,Se(t)),r&&Te()}}),Oe.bind(null,t))}catch(n){Oe(t,n)}}(this,e)}var ke={get:function(){var e=be,t=Ne;function n(n,r){var o=this,i=!e.global&&(e!==be||t!==Ne),a=i&&!Ve(),u=new xe((function(t,u){Pe(o,new Ee($e(n,e,i,a),$e(r,e,i,a),t,u,e))}));return this._consoleTask&&(u._consoleTask=this._consoleTask),u}return n.prototype=ue,n},set:function(e){p(this,"then",e&&e.prototype===ue?ke:{get:function(){return e},set:ke.set})}};function Ee(e,t,n,r,o){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=o}function Oe(e,t){var n,r;ye.push(t),null===e._state&&(n=e._lib&&Ke(),t=ve(t),e._state=!1,e._value=t,r=e,pe.some((function(e){return e._value===r._value}))||pe.push(r),Se(e),n&&Te())}function Se(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Pe(e,t[n]);var o=e._PSD;--o.ref||o.finalize(),0===we&&(++we,fe((function(){0==--we&&Ae()}),[]))}function Pe(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++we,fe(je,[n,e,t])}else e._listeners.push(t)}function je(e,t,n){try{var r,o=t._value;!t._state&&ye.length&&(ye=[]),r=ie&&t._consoleTask?t._consoleTask.run((function(){return e(o)})):e(o),t._state||-1!==ye.indexOf(o)||function(e){for(var t=pe.length;t;)if(pe[--t]._value===e._value)return pe.splice(t,1)}(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--we&&Ae(),--n.psd.ref||n.psd.finalize()}}function Ce(){We(me,(function(){Ke()&&Te()}))}function Ke(){var e=he;return de=he=!1,e}function Te(){var e,t,n;do{for(;0<ge.length;)for(e=ge,ge=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(0<ge.length);de=he=!0}function Ae(){var e=pe;pe=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));for(var t=_e.slice(0),n=t.length;n;)t[--n]()}function Ie(e){return new xe(ue,!1,e)}function Be(e,t){var n=be;return function(){var r=Ke(),o=be;try{return Ye(n,!0),e.apply(this,arguments)}catch(r){t&&t(r)}finally{Ye(o,!1),r&&Te()}}}h(xe.prototype,{then:ke,_then:function(e,t){Pe(this,new Ee(null,null,e,t,be))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=e,n=arguments[1];return"function"==typeof t?this.then(null,(function(e){return(e instanceof t?n:Ie)(e)})):this.then(null,(function(e){return(e&&e.name===t?n:Ie)(e)}))},finally:function(e){return this.then((function(t){return xe.resolve(e()).then((function(){return t}))}),(function(t){return xe.resolve(e()).then((function(){return Ie(t)}))}))},timeout:function(e,t){var n=this;return e<1/0?new xe((function(r,o){var i=setTimeout((function(){return o(new H.Timeout(t))}),e);n.then(r,o).finally(clearTimeout.bind(null,i))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&p(xe.prototype,Symbol.toStringTag,"Dexie.Promise"),me.env=He(),h(xe,{all:function(){var e=R.apply(null,arguments).map(Ge);return new xe((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(o,i){return xe.resolve(o).then((function(n){e[i]=n,--r||t(e)}),n)}))}))},resolve:function(e){return e instanceof xe?e:e&&"function"==typeof e.then?new xe((function(t,n){e.then(t,n)})):new xe(ue,!0,e)},reject:Ie,race:function(){var e=R.apply(null,arguments).map(Ge);return new xe((function(t,n){e.map((function(e){return xe.resolve(e).then(t,n)}))}))},PSD:{get:function(){return be},set:function(e){return be=e}},totalEchoes:{get:function(){return Ne}},newPSD:Fe,usePSD:We,scheduler:{get:function(){return fe},set:function(e){fe=e}},rejectionMapper:{get:function(){return ve},set:function(e){ve=e}},follow:function(e,t){return new xe((function(n,r){return Fe((function(t,n){var r=be;r.unhandleds=[],r.onunhandled=n,r.finalize=Z((function(){var e,r=this;e=function(){0===r.unhandleds.length?t():n(r.unhandleds[0])},_e.push((function t(){e(),_e.splice(_e.indexOf(t),1)})),++we,fe((function(){0==--we&&Ae()}),[])}),r.finalize),e()}),t,n,r)}))}}),se&&(se.allSettled&&p(xe,"allSettled",(function(){var e=R.apply(null,arguments).map(Ge);return new xe((function(t){0===e.length&&t([]);var n=e.length,r=new Array(n);e.forEach((function(e,o){return xe.resolve(e).then((function(e){return r[o]={status:"fulfilled",value:e}}),(function(e){return r[o]={status:"rejected",reason:e}})).then((function(){return--n||t(r)}))}))}))})),se.any&&"undefined"!=typeof AggregateError&&p(xe,"any",(function(){var e=R.apply(null,arguments).map(Ge);return new xe((function(t,n){0===e.length&&n(new AggregateError([]));var r=e.length,o=new Array(r);e.forEach((function(e,i){return xe.resolve(e).then((function(e){return t(e)}),(function(e){o[i]=e,--r||n(new AggregateError(o))}))}))}))})),se.withResolvers&&(xe.withResolvers=se.withResolvers));var De={awaits:0,echoes:0,id:0},qe=0,Re=[],Le=0,Ne=0,Me=0;function Fe(e,t,n,r){var o=be,i=Object.create(o);return i.parent=o,i.ref=0,i.global=!1,i.id=++Me,me.env,i.env=le?{Promise:xe,PromiseProp:{value:xe,configurable:!0,writable:!0},all:xe.all,race:xe.race,allSettled:xe.allSettled,any:xe.any,resolve:xe.resolve,reject:xe.reject}:{},t&&c(i,t),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()},r=We(i,e,n,r),0===i.ref&&i.finalize(),r}function Ue(){return De.id||(De.id=++qe),++De.awaits,De.echoes+=100,De.id}function Ve(){return!!De.awaits&&(0==--De.awaits&&(De.id=0),De.echoes=100*De.awaits,!0)}function Ge(e){return De.echoes&&e&&e.constructor===se?(Ue(),e.then((function(e){return Ve(),e}),(function(e){return Ve(),Xe(e)}))):e}function ze(){var e=Re[Re.length-1];Re.pop(),Ye(e,!1)}function Ye(e,t){var n,r=be;(t?!De.echoes||Le++&&e===be:!Le||--Le&&e===be)||queueMicrotask(t?function(e){++Ne,De.echoes&&0!=--De.echoes||(De.echoes=De.awaits=De.id=0),Re.push(be),Ye(e,!0)}.bind(null,e):ze),e!==be&&(be=e,r===me&&(me.env=He()),le&&(n=me.env.Promise,t=e.env,(r.global||e.global)&&(Object.defineProperty(o,"Promise",t.PromiseProp),n.all=t.all,n.race=t.race,n.resolve=t.resolve,n.reject=t.reject,t.allSettled&&(n.allSettled=t.allSettled),t.any&&(n.any=t.any))))}function He(){var e=o.Promise;return le?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(o,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function We(e,t,n,r,o){var i=be;try{return Ye(e,!0),t(n,r,o)}finally{Ye(i,!1)}}function $e(e,t,n,r){return"function"!=typeof e?e:function(){var o=be;n&&Ue(),Ye(t,!0);try{return e.apply(this,arguments)}finally{Ye(o,!1),r&&queueMicrotask(Ve)}}}function Qe(e){Promise===se&&0===De.echoes?0===Le?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+N).indexOf("[native code]")&&(Ue=Ve=Q);var Xe=xe.reject,Je=String.fromCharCode(65535),Ze="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",et="String expected.",tt=[],nt="__dbnames",rt="readonly",ot="readwrite";function it(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var at={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function ut(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=K(t))[e],t}}function ct(){throw H.Type()}function st(e,t){try{var n=lt(e),r=lt(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(e,t){for(var n=e.length,r=t.length,o=n<r?n:r,i=0;i<o;++i)if(e[i]!==t[i])return e[i]<t[i]?-1:1;return n===r?0:n<r?-1:1}(ft(e),ft(t));case"Array":return function(e,t){for(var n=e.length,r=t.length,o=n<r?n:r,i=0;i<o;++i){var a=st(e[i],t[i]);if(0!==a)return a}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function lt(e){var t=a(e);return"object"!=t?t:ArrayBuffer.isView(e)||"ArrayBuffer"===(e=A(e))?"binary":e}function ft(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var ht=(dt.prototype._trans=function(e,t,n){var r=this._tx||be.trans,o=this.name,i=ie&&"undefined"!=typeof console&&console.createTask&&console.createTask("Dexie: ".concat("readonly"===e?"read":"write"," ").concat(this.name));function a(e,n,r){if(!r.schema[o])throw new H.NotFound("Table "+o+" not part of transaction");return t(r.idbtrans,r)}var u=Ke();try{var c=r&&r.db._novip===this.db._novip?r===be.trans?r._promise(e,a,n):Fe((function(){return r._promise(e,a,n)}),{trans:r,transless:be.transless||be}):function e(t,n,r,o){if(t.idbdb&&(t._state.openComplete||be.letThrough||t._vip)){var i=t._createTransaction(n,r,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===z.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,o)}))):Xe(i)}return i._promise(n,(function(e,t){return Fe((function(){return be.trans=i,o(e,t,i)}))})).then((function(e){if("readwrite"===n)try{i.idbtrans.commit()}catch(e){}return"readonly"===n?e:i._completion.then((function(){return e}))}))}if(t._state.openComplete)return Xe(new H.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return Xe(new H.DatabaseClosed);t.open().catch(Q)}return t._state.dbReadyPromise.then((function(){return e(t,n,r,o)}))}(this.db,e,[this.name],a);return i&&(c._consoleTask=i,c=c.catch((function(e){return console.trace(e),Xe(e)}))),c}finally{u&&Te()}},dt.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?Xe(new H.Type("Invalid argument to Table.get()")):this._trans("readonly",(function(t){return n.core.get({trans:t,key:e}).then((function(e){return n.hook.reading.fire(e)}))})).then(t)},dt.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(u(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=i(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter((function(e){if(e.compound&&t.every((function(t){return 0<=e.keyPath.indexOf(t)}))){for(var n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort((function(e,t){return e.keyPath.length-t.keyPath.length}))[0];if(n&&this.db._maxKey!==Je){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map((function(t){return e[t]})))}!n&&ie&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(t.join("+"),"]"));var o=this.schema.idxByName;function a(e,t){return 0===st(e,t)}var c=t.reduce((function(t,n){var r=t[0],i=t[1],c=(t=o[n],e[n]);return[r||t,r||!t?it(i,t&&t.multi?function(e){return e=x(e,n),u(e)&&e.some((function(e){return a(c,e)}))}:function(e){return a(c,x(e,n))}):i]}),[null,null]);return r=c[0],c=c[1],r?this.where(r.name).equals(e[r.keyPath]).filter(c):n?this.filter(c):this.where(t).equals("")},dt.prototype.filter=function(e){return this.toCollection().and(e)},dt.prototype.count=function(e){return this.toCollection().count(e)},dt.prototype.offset=function(e){return this.toCollection().offset(e)},dt.prototype.limit=function(e){return this.toCollection().limit(e)},dt.prototype.each=function(e){return this.toCollection().each(e)},dt.prototype.toArray=function(e){return this.toCollection().toArray(e)},dt.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},dt.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,u(e)?"[".concat(e.join("+"),"]"):e))},dt.prototype.reverse=function(){return this.toCollection().reverse()},dt.prototype.mapToClass=function(t){var n,r=this.db,o=this.name;function i(){return null!==n&&n.apply(this,arguments)||this}(this.schema.mappedClass=t).prototype instanceof ct&&(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(i,n=t),Object.defineProperty(i.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),i.prototype.table=function(){return o},t=i);for(var a=new Set,u=t.prototype;u;u=s(u))Object.getOwnPropertyNames(u).forEach((function(e){return a.add(e)}));function c(e){if(!e)return e;var n,r=Object.create(t.prototype);for(n in e)if(!a.has(n))try{r[n]=e[n]}catch(e){}return r}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=c,this.hook("reading",c),t},dt.prototype.defineClass=function(){return this.mapToClass((function(e){c(this,e)}))},dt.prototype.add=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,a=e;return i&&o&&(a=ut(i)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):e.lastResult})).then((function(t){if(i)try{k(e,i,t)}catch(t){}return t}))},dt.prototype.update=function(e,t){return"object"!=a(e)||u(e)?this.where(":id").equals(e).modify(t):void 0===(e=x(e,this.schema.primKey.keyPath))?Xe(new H.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},dt.prototype.put=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,a=e;return i&&o&&(a=ut(i)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):e.lastResult})).then((function(t){if(i)try{k(e,i,t)}catch(t){}return t}))},dt.prototype.delete=function(e){var t=this;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):void 0}))},dt.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(t){return e.core.mutate({trans:t,type:"deleteRange",range:at})})).then((function(e){return e.numFailures?xe.reject(e.failures[0]):void 0}))},dt.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",(function(n){return t.core.getMany({keys:e,trans:n}).then((function(e){return e.map((function(e){return t.hook.reading.fire(e)}))}))}))},dt.prototype.bulkAdd=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(u=r.schema.primKey).auto;if((u=u.keyPath)&&o)throw new H.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new H.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,u=u&&n?e.map(ut(u)):e;return r.core.mutate({trans:t,type:"add",keys:o,values:u,wantResults:i}).then((function(e){var t=e.numFailures,n=e.results,o=e.lastResult;if(e=e.failures,0===t)return i?n:o;throw new G("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},dt.prototype.bulkPut=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(u=r.schema.primKey).auto;if((u=u.keyPath)&&o)throw new H.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new H.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,u=u&&n?e.map(ut(u)):e;return r.core.mutate({trans:t,type:"put",keys:o,values:u,wantResults:i}).then((function(e){var t=e.numFailures,n=e.results,o=e.lastResult;if(e=e.failures,0===t)return i?n:o;throw new G("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},dt.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map((function(e){return e.key})),o=e.map((function(e){return e.changes})),i=[];return this._trans("readwrite",(function(a){return n.getMany({trans:a,keys:r,cache:"clone"}).then((function(u){var c=[],s=[];e.forEach((function(e,n){var r=e.key,o=e.changes,a=u[n];if(a){for(var l=0,f=Object.keys(o);l<f.length;l++){var h=f[l],d=o[h];if(h===t.schema.primKey.keyPath){if(0!==st(d,r))throw new H.Constraint("Cannot update primary key in bulkUpdate()")}else k(a,h,d)}i.push(n),c.push(r),s.push(a)}}));var l=c.length;return n.mutate({trans:a,type:"put",keys:c,values:s,updates:{keys:r,changeSpecs:o}}).then((function(e){var n=e.numFailures,r=e.failures;if(0===n)return l;for(var o=0,a=Object.keys(r);o<a.length;o++){var u,c=a[o],s=i[Number(c)];null!=s&&(u=r[c],delete r[c],r[s]=u)}throw new G("".concat(t.name,".bulkUpdate(): ").concat(n," of ").concat(l," operations failed"),r)}))}))}))},dt.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:e})})).then((function(e){var r=e.numFailures,o=e.lastResult;if(e=e.failures,0===r)return o;throw new G("".concat(t.name,".bulkDelete(): ").concat(r," of ").concat(n," operations failed"),e)}))},dt);function dt(){}function pt(e){function t(t,r){if(r){for(var o=arguments.length,i=new Array(o-1);--o;)i[o-1]=arguments[o];return n[t].subscribe.apply(null,i),e}if("string"==typeof t)return n[t]}var n={};t.addEventType=c;for(var r=1,o=arguments.length;r<o;++r)c(arguments[r]);return t;function c(e,r,o){if("object"!=a(e)){var s;r=r||re;var l={subscribers:[],fire:o=o||Q,subscribe:function(e){-1===l.subscribers.indexOf(e)&&(l.subscribers.push(e),l.fire=r(l.fire,e))},unsubscribe:function(e){l.subscribers=l.subscribers.filter((function(t){return t!==e})),l.fire=l.subscribers.reduce(r,o)}};return n[e]=t[e]=l}i(s=e).forEach((function(e){var t=s[e];if(u(t))c(e,s[e][0],s[e][1]);else{if("asap"!==t)throw new H.InvalidArgument("Invalid event config");var n=c(e,X,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){_((function(){e.apply(null,t)}))}))}))}}))}}function yt(e,t){return y(t).from({prototype:e}),t}function vt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function mt(e,t){e.filter=it(e.filter,t)}function bt(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return it(r(),t())}:t,e.justLimit=n&&!r}function gt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new H.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function wt(e,t,n){var r=gt(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function _t(e,t,n,r){var o=e.replayFilter?it(e.filter,e.replayFilter()):e.filter;if(e.or){var i={},a=function(e,n,r){var a,u;o&&!o(n,r,(function(e){return n.stop(e)}),(function(e){return n.fail(e)}))||("[object ArrayBuffer]"==(u=""+(a=n.primaryKey))&&(u=""+new Uint8Array(a)),f(i,u)||(i[u]=!0,t(e,n,r)))};return Promise.all([e.or._iterate(a,n),xt(wt(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return xt(wt(e,r,n),it(e.algorithm,o),t,!e.keysOnly&&e.valueMapper)}function xt(e,t,n,r){var o=Be(r?function(e,t,o){return n(r(e),t,o)}:n);return e.then((function(e){if(e)return e.start((function(){var n=function(){return e.continue()};t&&!t(e,(function(e){return n=e}),(function(t){e.stop(t),n=Q}),(function(t){e.fail(t),n=Q}))||o(e.value,e,(function(e){return n=e})),n()}))}))}var kt=(Et.prototype.execute=function(e){var t=this["@@propmod"];if(void 0!==t.add){var n=t.add;if(u(n))return r(r([],u(e)?e:[],!0),n,!0).sort();if("number"==typeof n)return(Number(e)||0)+n;if("bigint"==typeof n)try{return BigInt(e)+n}catch(e){return BigInt(0)+n}throw new TypeError("Invalid term ".concat(n))}if(void 0!==t.remove){var o=t.remove;if(u(o))return u(e)?e.filter((function(e){return!o.includes(e)})).sort():[];if("number"==typeof o)return Number(e)-o;if("bigint"==typeof o)try{return BigInt(e)-o}catch(e){return BigInt(0)-o}throw new TypeError("Invalid subtrahend ".concat(o))}return(n=null===(n=t.replacePrefix)||void 0===n?void 0:n[0])&&"string"==typeof e&&e.startsWith(n)?t.replacePrefix[1]+e.substring(n.length):e},Et);function Et(e){this["@@propmod"]=e}var Ot=(St.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,Xe.bind(null,n.error)):n.table._trans("readonly",e).then(t)},St.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,Xe.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},St.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=it(t.algorithm,e)},St.prototype._iterate=function(e,t){return _t(this._ctx,e,t,this._ctx.table.core)},St.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&c(n,e),t._ctx=n,t},St.prototype.raw=function(){return this._ctx.valueMapper=null,this},St.prototype.each=function(e){var t=this._ctx;return this._read((function(n){return _t(t,e,n,t.table.core)}))},St.prototype.count=function(e){var t=this;return this._read((function(e){var n=t._ctx,r=n.table.core;if(vt(n,!0))return r.count({trans:e,query:{index:gt(n,r.schema),range:n.range}}).then((function(e){return Math.min(e,n.limit)}));var o=0;return _t(n,(function(){return++o,!1}),e,r).then((function(){return o}))})).then(e)},St.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],o=n.length-1;function i(e,t){return t?i(e[n[t]],t-1):e[r]}var a="next"===this._ctx.dir?1:-1;function u(e,t){return st(i(e,o),i(t,o))*a}return this.toArray((function(e){return e.sort(u)})).then(t)},St.prototype.toArray=function(e){var t=this;return this._read((function(e){var n=t._ctx;if("next"===n.dir&&vt(n,!0)&&0<n.limit){var r=n.valueMapper,o=gt(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,query:{index:o,range:n.range}}).then((function(e){return e=e.result,r?e.map(r):e}))}var i=[];return _t(n,(function(e){return i.push(e)}),e,n.table.core).then((function(){return i}))}),e)},St.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,vt(t)?bt(t,(function(){var t=e;return function(e,n){return 0===t||(1===t?--t:n((function(){e.advance(t),t=0})),!1)}})):bt(t,(function(){var t=e;return function(){return--t<0}}))),this},St.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),bt(this._ctx,(function(){var t=e;return function(e,n,r){return--t<=0&&n(r),0<=t}}),!0),this},St.prototype.until=function(e,t){return mt(this._ctx,(function(n,r,o){return!e(n.value)||(r(o),t)})),this},St.prototype.first=function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)},St.prototype.last=function(e){return this.reverse().first(e)},St.prototype.filter=function(e){var t;return mt(this._ctx,(function(t){return e(t.value)})),(t=this._ctx).isMatch=it(t.isMatch,e),this},St.prototype.and=function(e){return this.filter(e)},St.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},St.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},St.prototype.desc=function(){return this.reverse()},St.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))},St.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},St.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))},St.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)},St.prototype.primaryKeys=function(e){var t=this._ctx;if("next"===t.dir&&vt(t,!0)&&0<t.limit)return this._read((function(e){var n=gt(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((function(e){return e.result})).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)},St.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},St.prototype.firstKey=function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)},St.prototype.lastKey=function(e){return this.reverse().firstKey(e)},St.prototype.distinct=function(){var e;if(!(e=(e=this._ctx).index&&e.table.schema.idxByName[e.index])||!e.multi)return this;var t={};return mt(this._ctx,(function(e){var n=e.primaryKey.toString();return e=f(t,n),t[n]=!0,!e})),this},St.prototype.modify=function(e){var t=this,n=this._ctx;return this._write((function(r){var o,u,c;c="function"==typeof e?e:(o=i(e),u=o.length,function(t){for(var n=!1,r=0;r<u;++r){var i=o[r],a=e[i],c=x(t,i);a instanceof kt?(k(t,i,a.execute(c)),n=!0):c!==a&&(k(t,i,a),n=!0)}return n});var s,l=n.table.core,f=(s=l.schema.primaryKey).outbound,h=s.extractKey,d=200;function p(e,t){var n=t.failures;t=t.numFailures,v+=e-t;for(var r=0,o=i(n);r<o.length;r++){var a=o[r];y.push(n[a])}}(s=t.db._options.modifyChunkSize)&&(d="object"==a(s)?s[l.name]||s["*"]||200:s);var y=[],v=0,m=[];return t.clone().primaryKeys().then((function(t){var o=vt(n)&&n.limit===1/0&&("function"!=typeof e||e===Pt)&&{index:n.index,range:n.range};return function n(i){var u=Math.min(d,t.length-i);return l.getMany({trans:r,keys:t.slice(i,i+u),cache:"immutable"}).then((function(s){for(var y=[],v=[],m=f?[]:null,b=[],g=0;g<u;++g){var w=s[g],_={value:K(w),primKey:t[i+g]};!1!==c.call(_,_.value,_)&&(null==_.value?b.push(t[i+g]):f||0===st(h(w),h(_.value))?(v.push(_.value),f&&m.push(t[i+g])):(b.push(t[i+g]),y.push(_.value)))}return Promise.resolve(0<y.length&&l.mutate({trans:r,type:"add",values:y}).then((function(e){for(var t in e.failures)b.splice(parseInt(t),1);p(y.length,e)}))).then((function(){return(0<v.length||o&&"object"==a(e))&&l.mutate({trans:r,type:"put",keys:m,values:v,criteria:o,changeSpec:"function"!=typeof e&&e,isAdditionalChunk:0<i}).then((function(e){return p(v.length,e)}))})).then((function(){return(0<b.length||o&&e===Pt)&&l.mutate({trans:r,type:"delete",keys:b,criteria:o,isAdditionalChunk:0<i}).then((function(e){return p(b.length,e)}))})).then((function(){return t.length>i+u&&n(i+d)}))}))}(0).then((function(){if(0<y.length)throw new V("Error modifying one or more objects",y,v,m);return t.length}))}))}))},St.prototype.delete=function(){var e=this._ctx,t=e.range;return vt(e)&&(e.isPrimKey||3===t.type)?this._write((function(n){var r=e.table.core.schema.primaryKey,o=t;return e.table.core.count({trans:n,query:{index:r,range:o}}).then((function(t){return e.table.core.mutate({trans:n,type:"deleteRange",range:o}).then((function(e){var n=e.failures;if(e.lastResult,e.results,e=e.numFailures)throw new V("Could not delete some values",Object.keys(n).map((function(e){return n[e]})),t-e);return t-e}))}))})):this.modify(Pt)},St);function St(){}var Pt=function(e,t){return t.value=null};function jt(e,t){return e<t?-1:e===t?0:1}function Ct(e,t){return t<e?-1:e===t?0:1}function Kt(e,t,n){return(e=e instanceof Dt?new e.Collection(e):e)._ctx.error=new(n||TypeError)(t),e}function Tt(e){return new e.Collection(e,(function(){return Bt("")})).limit(0)}function At(e,t,n,r){var o,i,a,u,c,s,l,f=n.length;if(!n.every((function(e){return"string"==typeof e})))return Kt(e,et);function h(e){o="next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()},i="next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()},a="next"===e?jt:Ct;var t=n.map((function(e){return{lower:i(e),upper:o(e)}})).sort((function(e,t){return a(e.lower,t.lower)}));u=t.map((function(e){return e.upper})),c=t.map((function(e){return e.lower})),l="next"===(s=e)?"":r}h("next"),(e=new e.Collection(e,(function(){return It(u[0],c[f-1]+r)})))._ondirectionchange=function(e){h(e)};var d=0;return e._addAlgorithm((function(e,n,r){var o=e.key;if("string"!=typeof o)return!1;var h=i(o);if(t(h,c,d))return!0;for(var p=null,y=d;y<f;++y){var v=function(e,t,n,r,o,i){for(var a=Math.min(e.length,r.length),u=-1,c=0;c<a;++c){var s=t[c];if(s!==r[c])return o(e[c],n[c])<0?e.substr(0,c)+n[c]+n.substr(c+1):o(e[c],r[c])<0?e.substr(0,c)+r[c]+n.substr(c+1):0<=u?e.substr(0,u)+t[u]+n.substr(u+1):null;o(e[c],s)<0&&(u=c)}return a<r.length&&"next"===i?e+n.substr(e.length):a<e.length&&"prev"===i?e.substr(0,n.length):u<0?null:e.substr(0,u)+r[u]+n.substr(u+1)}(o,h,u[y],c[y],a,s);null===v&&null===p?d=y+1:(null===p||0<a(p,v))&&(p=v)}return n(null!==p?function(){e.continue(p+l)}:r),!1})),e}function It(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Bt(e){return{type:1,lower:e,upper:e}}var Dt=(Object.defineProperty(qt.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),qt.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return 0<this._cmp(e,t)||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?Tt(this):new this.Collection(this,(function(){return It(e,t,!n,!r)}))}catch(e){return Kt(this,Ze)}},qt.prototype.equals=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return Bt(e)}))},qt.prototype.above=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return It(e,void 0,!0)}))},qt.prototype.aboveOrEqual=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return It(e,void 0,!1)}))},qt.prototype.below=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return It(void 0,e,!1,!0)}))},qt.prototype.belowOrEqual=function(e){return null==e?Kt(this,Ze):new this.Collection(this,(function(){return It(void 0,e)}))},qt.prototype.startsWith=function(e){return"string"!=typeof e?Kt(this,et):this.between(e,e+Je,!0,!0)},qt.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):At(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],Je)},qt.prototype.equalsIgnoreCase=function(e){return At(this,(function(e,t){return e===t[0]}),[e],"")},qt.prototype.anyOfIgnoreCase=function(){var e=R.apply(q,arguments);return 0===e.length?Tt(this):At(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},qt.prototype.startsWithAnyOfIgnoreCase=function(){var e=R.apply(q,arguments);return 0===e.length?Tt(this):At(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,Je)},qt.prototype.anyOf=function(){var e=this,t=R.apply(q,arguments),n=this._cmp;try{t.sort(n)}catch(r){return Kt(this,Ze)}if(0===t.length)return Tt(this);var r=new this.Collection(this,(function(){return It(t[0],t[t.length-1])}));r._ondirectionchange=function(r){n="next"===r?e._ascending:e._descending,t.sort(n)};var o=0;return r._addAlgorithm((function(e,r,i){for(var a=e.key;0<n(a,t[o]);)if(++o===t.length)return r(i),!1;return 0===n(a,t[o])||(r((function(){e.continue(t[o])})),!1)})),r},qt.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},qt.prototype.noneOf=function(){var e=R.apply(q,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Kt(this,Ze)}var t=e.reduce((function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[-1/0,t]]}),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},qt.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,o=this._ascending,i=this._descending,a=this._min,u=this._max;if(0===e.length)return Tt(this);if(!e.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&o(e[0],e[1])<=0})))return Kt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",H.InvalidArgument);var c,s=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,f=o;function h(e,t){return f(e[0],t[0])}try{(c=e.reduce((function(e,t){for(var n=0,o=e.length;n<o;++n){var i=e[n];if(r(t[0],i[1])<0&&0<r(t[1],i[0])){i[0]=a(i[0],t[0]),i[1]=u(i[1],t[1]);break}}return n===o&&e.push(t),e}),[])).sort(h)}catch(e){return Kt(this,Ze)}var d=0,p=l?function(e){return 0<o(e,c[d][1])}:function(e){return 0<=o(e,c[d][1])},y=s?function(e){return 0<i(e,c[d][0])}:function(e){return 0<=i(e,c[d][0])},v=p;return(e=new this.Collection(this,(function(){return It(c[0][0],c[c.length-1][1],!s,!l)})))._ondirectionchange=function(e){f="next"===e?(v=p,o):(v=y,i),c.sort(h)},e._addAlgorithm((function(e,t,r){for(var i,a=e.key;v(a);)if(++d===c.length)return t(r),!1;return!p(i=a)&&!y(i)||(0===n._cmp(a,c[d][1])||0===n._cmp(a,c[d][0])||t((function(){f===o?e.continue(c[d][0]):e.continue(c[d][1])})),!1)})),e},qt.prototype.startsWithAnyOf=function(){var e=R.apply(q,arguments);return e.every((function(e){return"string"==typeof e}))?0===e.length?Tt(this):this.inAnyRange(e.map((function(e){return[e,e+Je]}))):Kt(this,"startsWithAnyOf() only works with strings")},qt);function qt(){}function Rt(e){return Be((function(t){return Lt(t),e(t.target.error),!1}))}function Lt(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Nt="storagemutated",Mt="x-storagemutated-1",Ft=pt(null,Nt),Ut=(Vt.prototype._lock=function(){return w(!be.global),++this._reculock,1!==this._reculock||be.global||(be.lockOwnerFor=this),this},Vt.prototype._unlock=function(){if(w(!be.global),0==--this._reculock)for(be.global||(be.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{We(e[1],e[0])}catch(e){}}return this},Vt.prototype._locked=function(){return this._reculock&&be.lockOwnerFor!==this},Vt.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(w(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new H.DatabaseClosed(r);case"MissingAPIError":throw new H.MissingAPI(r.message,r);default:throw new H.OpenFailed(r)}if(!this.active)throw new H.TransactionInactive;return w(null===this._completion._state),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Be((function(n){Lt(n),t._reject(e.error)})),e.onabort=Be((function(n){Lt(n),t.active&&t._reject(new H.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=Be((function(){t.active=!1,t._resolve(),"mutatedParts"in e&&Ft.storagemutated.fire(e.mutatedParts)})),this},Vt.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return Xe(new H.ReadOnly("Transaction is readonly"));if(!this.active)return Xe(new H.TransactionInactive);if(this._locked())return new xe((function(o,i){r._blockedFuncs.push([function(){r._promise(e,t,n).then(o,i)},be])}));if(n)return Fe((function(){var e=new xe((function(e,n){r._lock();var o=t(e,n,r);o&&o.then&&o.then(e,n)}));return e.finally((function(){return r._unlock()})),e._lib=!0,e}));var o=new xe((function(e,n){var o=t(e,n,r);o&&o.then&&o.then(e,n)}));return o._lib=!0,o},Vt.prototype._root=function(){return this.parent?this.parent._root():this},Vt.prototype.waitFor=function(e){var t,n=this._root(),r=xe.resolve(e);n._waitingFor?n._waitingFor=n._waitingFor.then((function(){return r})):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=e)}());var o=n._waitingFor;return new xe((function(e,t){r.then((function(t){return n._waitingQueue.push(Be(e.bind(null,t)))}),(function(e){return n._waitingQueue.push(Be(t.bind(null,e)))})).finally((function(){n._waitingFor===o&&(n._waitingFor=null)}))}))},Vt.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new H.Abort))},Vt.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(f(t,e))return t[e];var n=this.schema[e];if(!n)throw new H.NotFound("Table "+e+" not part of transaction");return(n=new this.db.Table(e,n,this)).core=this.db.core.table(e),t[e]=n},Vt);function Vt(){}function Gt(e,t,n,r,o,i,a){return{name:e,keyPath:t,unique:n,multi:r,auto:o,compound:i,src:(n&&!a?"&":"")+(r?"*":"")+(o?"++":"")+zt(t)}}function zt(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function Yt(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(e){return[e.name,e]},n.reduce((function(e,t,n){return(n=r(t))&&(e[n[0]]=n[1]),e}),{}))};var r}var Ht=function(e){try{return e.only([[]]),Ht=function(){return[[]]},[[]]}catch(e){return Ht=function(){return Je},Je}};function Wt(e){return null==e?function(){}:"string"==typeof e?1===(t=e).split(".").length?function(e){return e[t]}:function(e){return x(e,t)}:function(t){return x(t,e)};var t}function $t(e){return[].slice.call(e)}var Qt=0;function Xt(e){return null==e?":id":"string"==typeof e?e:"[".concat(e.join("+"),"]")}function Jt(e,t,n){function r(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,o=e.lowerOpen;return e=e.upperOpen,void 0===n?void 0===r?null:t.upperBound(r,!!e):void 0===r?t.lowerBound(n,!!o):t.bound(n,r,!!o,!!e)}var o,i,a,c=(i=n,a=$t((o=e).objectStoreNames),{schema:{name:o.name,tables:a.map((function(e){return i.objectStore(e)})).map((function(e){var t=e.keyPath,n=e.autoIncrement,r=u(t),o={};return n={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:null==t,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:Wt(t)},indexes:$t(e.indexNames).map((function(t){return e.index(t)})).map((function(e){var t=e.name,n=e.unique,r=e.multiEntry;return e=e.keyPath,r={name:t,compound:u(e),keyPath:e,unique:n,multiEntry:r,extractKey:Wt(e)},o[Xt(e)]=r})),getIndexByKeyPath:function(e){return o[Xt(e)]}},o[":id"]=n.primaryKey,null!=t&&(o[Xt(t)]=n.primaryKey),n}))},hasGetAll:0<a.length&&"getAll"in i.objectStore(a[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),s=(n=c.schema,c.hasGetAll),l=(c=n.tables.map((function(e){var t,n=e.name;return{name:n,schema:e,mutate:function(e){var t=e.trans,o=e.type,i=e.keys,a=e.values,u=e.range;return new Promise((function(e,c){e=Be(e);var s=t.objectStore(n),l=null==s.keyPath,f="put"===o||"add"===o;if(!f&&"delete"!==o&&"deleteRange"!==o)throw new Error("Invalid operation type: "+o);var h,d=(i||a||{length:1}).length;if(i&&a&&i.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return e({numFailures:0,failures:{},results:[],lastResult:void 0});function p(e){++m,Lt(e)}var y=[],v=[],m=0;if("deleteRange"===o){if(4===u.type)return e({numFailures:m,failures:v,results:[],lastResult:void 0});3===u.type?y.push(h=s.clear()):y.push(h=s.delete(r(u)))}else{var b=(l=f?l?[a,i]:[a,null]:[i,null])[0],g=l[1];if(f)for(var w=0;w<d;++w)y.push(h=g&&void 0!==g[w]?s[o](b[w],g[w]):s[o](b[w])),h.onerror=p;else for(w=0;w<d;++w)y.push(h=s[o](b[w])),h.onerror=p}function _(t){t=t.target.result,y.forEach((function(e,t){return null!=e.error&&(v[t]=e.error)})),e({numFailures:m,failures:v,results:"delete"===o?i:y.map((function(e){return e.result})),lastResult:t})}h.onerror=function(e){p(e),_(e)},h.onsuccess=_}))},getMany:function(e){var t=e.trans,r=e.keys;return new Promise((function(e,o){e=Be(e);for(var i,a=t.objectStore(n),u=r.length,c=new Array(u),s=0,l=0,f=function(t){t=t.target,c[t._pos]=t.result,++l===s&&e(c)},h=Rt(o),d=0;d<u;++d)null!=r[d]&&((i=a.get(r[d]))._pos=d,i.onsuccess=f,i.onerror=h,++s);0===s&&e(c)}))},get:function(e){var t=e.trans,r=e.key;return new Promise((function(e,o){e=Be(e);var i=t.objectStore(n).get(r);i.onsuccess=function(t){return e(t.target.result)},i.onerror=Rt(o)}))},query:(t=s,function(e){return new Promise((function(o,i){o=Be(o);var a,u,c,s=e.trans,l=e.values,f=e.limit,h=e.query,d=f===1/0?void 0:f,p=h.index;if(h=h.range,s=s.objectStore(n),p=p.isPrimaryKey?s:s.index(p.name),h=r(h),0===f)return o({result:[]});t?((d=l?p.getAll(h,d):p.getAllKeys(h,d)).onsuccess=function(e){return o({result:e.target.result})},d.onerror=Rt(i)):(a=0,u=!l&&"openKeyCursor"in p?p.openKeyCursor(h):p.openCursor(h),c=[],u.onsuccess=function(e){var t=u.result;return t?(c.push(l?t.value:t.primaryKey),++a===f?o({result:c}):void t.continue()):o({result:c})},u.onerror=Rt(i))}))}),openCursor:function(e){var t=e.trans,o=e.values,i=e.query,a=e.reverse,u=e.unique;return new Promise((function(e,c){e=Be(e);var s=i.index,l=i.range,f=t.objectStore(n),h=(f=s.isPrimaryKey?f:f.index(s.name),s=a?u?"prevunique":"prev":u?"nextunique":"next",!o&&"openKeyCursor"in f?f.openKeyCursor(r(l),s):f.openCursor(r(l),s));h.onerror=Rt(c),h.onsuccess=Be((function(n){var r,o,i,a,u=h.result;u?(u.___id=++Qt,u.done=!1,r=u.continue.bind(u),o=(o=u.continuePrimaryKey)&&o.bind(u),i=u.advance.bind(u),a=function(){throw new Error("Cursor not stopped")},u.trans=t,u.stop=u.continue=u.continuePrimaryKey=u.advance=function(){throw new Error("Cursor not started")},u.fail=Be(c),u.next=function(){var e=this,t=1;return this.start((function(){return t--?e.continue():e.stop()})).then((function(){return e}))},u.start=function(e){function t(){if(h.result)try{e()}catch(e){u.fail(e)}else u.done=!0,u.start=function(){throw new Error("Cursor behind last entry")},u.stop()}var n=new Promise((function(e,t){e=Be(e),h.onerror=Rt(t),u.fail=t,u.stop=function(t){u.stop=u.continue=u.continuePrimaryKey=u.advance=a,e(t)}}));return h.onsuccess=Be((function(e){h.onsuccess=t,t()})),u.continue=r,u.continuePrimaryKey=o,u.advance=i,t(),n},e(u)):e(null)}),c)}))},count:function(e){var t=e.query,o=e.trans,i=t.index,a=t.range;return new Promise((function(e,t){var u=o.objectStore(n),c=i.isPrimaryKey?u:u.index(i.name);(c=(u=r(a))?c.count(u):c.count()).onsuccess=Be((function(t){return e(t.target.result)})),c.onerror=Rt(t)}))}}})),{});return c.forEach((function(e){return l[e.name]=e})),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(e){if(!l[e])throw new Error("Table '".concat(e,"' not found"));return l[e]},MIN_KEY:-1/0,MAX_KEY:Ht(t),schema:n}}function Zt(e,n){var r=n.db;n=function(e,n,r,o){var i=r.IDBKeyRange;return r.indexedDB,{dbcore:(o=Jt(n,i,o),e.dbcore.reduce((function(e,n){return n=n.create,t(t({},e),n(e))}),o))}}(e._middlewares,r,e._deps,n),e.core=n.dbcore,e.tables.forEach((function(t){var n=t.name;e.core.schema.tables.some((function(e){return e.name===n}))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function en(e,t,n,r){n.forEach((function(n){var o=r[n];t.forEach((function(t){var r=function e(t,n){return v(t,n)||(t=s(t))&&e(t,n)}(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?p(t,n,{get:function(){return this.table(n)},set:function(e){d(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,o))}))}))}function tn(e,t){t.forEach((function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]}))}function nn(e,t){return e._cfg.version-t._cfg.version}function rn(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var o=e[n],i=t[n];if(o){var a={name:n,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||o.primKey.auto!==i.primKey.auto)a.recreate=!0,r.change.push(a);else{var u=o.idxByName,c=i.idxByName,s=void 0;for(s in u)c[s]||a.del.push(s);for(s in c){var l=u[s],f=c[s];l?l.src!==f.src&&a.change.push(f):a.add.push(f)}(0<a.del.length||0<a.add.length||0<a.change.length)&&r.change.push(a)}}else r.add.push([n,i])}return r}function on(e,t,n,r){var o=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((function(e){return un(o,e)})),o}function an(e,t){i(e).forEach((function(n){t.db.objectStoreNames.contains(n)||(ie&&console.debug("Dexie: Creating missing table",n),on(t,n,e[n].primKey,e[n].indexes))}))}function un(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function cn(e,t,n){var r={};return b(t.objectStoreNames,0).forEach((function(e){for(var t=n.objectStore(e),o=Gt(zt(u=t.keyPath),u||"",!0,!1,!!t.autoIncrement,u&&"string"!=typeof u,!0),i=[],a=0;a<t.indexNames.length;++a){var u=(c=t.index(t.indexNames[a])).keyPath,c=Gt(c.name,u,!!c.unique,!!c.multiEntry,!1,u&&"string"!=typeof u,!1);i.push(c)}r[e]=Yt(e,o,i)})),r}function sn(e,t,n){for(var r=n.db.objectStoreNames,i=0;i<r.length;++i){var a=r[i],u=n.objectStore(a);e._hasGetAll="getAll"in u;for(var c=0;c<u.indexNames.length;++c){var s=u.indexNames[c],l=u.index(s).keyPath,f="string"==typeof l?l:"["+b(l).join("+")+"]";!t[a]||(l=t[a].idxByName[f])&&(l.name=s,delete t[a].idxByName[f],t[a].idxByName[s]=l)}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&o.WorkerGlobalScope&&o instanceof o.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function ln(e){return e.split(",").map((function(e,t){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return Gt(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),u(r),0===t)}))}var fn=(hn.prototype._parseStoresSpec=function(e,t){i(e).forEach((function(n){if(null!==e[n]){var r=ln(e[n]),o=r.shift();if(o.unique=!0,o.multi)throw new H.Schema("Primary key cannot be multi-valued");r.forEach((function(e){if(e.auto)throw new H.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new H.Schema("Index must have a name and cannot be an empty string")})),t[n]=Yt(n,o,r)}}))},hn.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?c(this._cfg.storesSource,e):e,e=t._versions;var n={},r={};return e.forEach((function(e){c(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)})),t._dbSchema=r,tn(t,[t._allTables,t,t.Transaction.prototype]),en(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],i(r),r),t._storeNames=i(r),this},hn.prototype.upgrade=function(e){return this._cfg.contentUpgrade=oe(this._cfg.contentUpgrade||Q,e),this},hn);function hn(){}function dn(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new $n(nt,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function pn(e){return e&&"function"==typeof e.databases}function yn(e){return Fe((function(){return be.letThrough=!0,e()}))}function vn(e){return!("from"in e)}var mn=function(e,t){if(!this){var n=new mn;return e&&"d"in e&&c(n,e),n}c(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function bn(e,t,n){var r=st(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(vn(e))return c(e,{from:t,to:n,d:1});var o=e.l;if(r=e.r,st(n,e.from)<0)return o?bn(o,t,n):e.l={from:t,to:n,d:1,l:null,r:null},xn(e);if(0<st(t,e.to))return r?bn(r,t,n):e.r={from:t,to:n,d:1,l:null,r:null},xn(e);st(t,e.from)<0&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0<st(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),n=!e.r,o&&!e.l&&gn(e,o),r&&n&&gn(e,r)}}function gn(e,t){vn(t)||function e(t,n){var r=n.from,o=n.to,i=n.l;n=n.r,bn(t,r,o),i&&e(t,i),n&&e(t,n)}(e,t)}function wn(e,t){var n=_n(t),r=n.next();if(r.done)return!1;for(var o=r.value,i=_n(e),a=i.next(o.from),u=a.value;!r.done&&!a.done;){if(st(u.from,o.to)<=0&&0<=st(u.to,o.from))return!0;st(o.from,u.from)<0?o=(r=n.next(u.from)).value:u=(a=i.next(o.from)).value}return!1}function _n(e){var t=vn(e)?null:{s:0,n:e};return{next:function(e){for(var n=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&st(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||st(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function xn(e){var n,r,o=((null===(n=e.r)||void 0===n?void 0:n.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),i=1<o?"r":o<-1?"l":"";i&&(n="r"==i?"l":"r",r=t({},e),o=e[i],e.from=o.from,e.to=o.to,e[i]=o[i],r[i]=o[n],(e[n]=r).d=kn(r)),e.d=kn(e)}function kn(e){var t=e.r;return e=e.l,(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function En(e,t){return i(t).forEach((function(n){e[n]?gn(e[n],t[n]):e[n]=function e(t){var n,r,o={};for(n in t)f(t,n)&&(r=t[n],o[n]=!r||"object"!=a(r)||j.has(r.constructor)?r:e(r));return o}(t[n])})),e}function On(e,t){return e.all||t.all||Object.keys(e).some((function(n){return t[n]&&wn(t[n],e[n])}))}h(mn.prototype,((N={add:function(e){return gn(this,e),this},addKey:function(e){return bn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach((function(e){return bn(t,e,e)})),this},hasKey:function(e){var t=_n(this).next(e).value;return t&&st(t.from,e)<=0&&0<=st(t.to,e)}})[I]=function(){return _n(this)},N));var Sn={},Pn={},jn=!1;function Cn(e){En(Pn,e),jn||(jn=!0,setTimeout((function(){jn=!1,Kn(Pn,!(Pn={}))}),0))}function Kn(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,o=Object.values(Sn);r<o.length;r++)Tn(a=o[r],e,n,t);else for(var i in e){var a,u=/^idb\:\/\/(.*)\/(.*)\//.exec(i);u&&(i=u[1],u=u[2],(a=Sn["idb://".concat(i,"/").concat(u)])&&Tn(a,e,n,t))}n.forEach((function(e){return e()}))}function Tn(e,t,n,r){for(var o=[],i=0,a=Object.entries(e.queries.query);i<a.length;i++){for(var u=a[i],c=u[0],s=[],l=0,f=u[1];l<f.length;l++){var h=f[l];On(t,h.obsSet)?h.subscribers.forEach((function(e){return n.add(e)})):r&&s.push(h)}r&&o.push([c,s])}if(r)for(var d=0,p=o;d<p.length;d++){var y=p[d];c=y[0],s=y[1],e.queries.query[c]=s}}function An(e){function t(t){return e.next(t)}var n=o(t),r=o((function(t){return e.throw(t)}));function o(e){return function(t){var o=e(t);return t=o.value,o.done?t:t&&"function"==typeof t.then?t.then(n,r):u(t)?Promise.all(t).then(n,r):n(t)}}return o(t)()}function In(e,t,n){for(var r=u(e)?e.slice():[e],o=0;o<n;++o)r.push(t);return r}var Bn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return t(t({},e),{table:function(n){var r=e.table(n),o=r.schema,i={},a=[];function u(e,n,r){var o=Xt(e),c=i[o]=i[o]||[],s=null==e?0:"string"==typeof e?1:e.length,l=0<n;return l=t(t({},r),{name:l?"".concat(o,"(virtual-from:").concat(r.name,")"):r.name,lowLevelIndex:r,isVirtual:l,keyTail:n,keyLength:s,extractKey:Wt(e),unique:!l&&r.unique}),c.push(l),l.isPrimaryKey||a.push(l),1<s&&u(2===s?e[0]:e.slice(0,s-1),n+1,r),c.sort((function(e,t){return e.keyTail-t.keyTail})),l}n=u(o.primaryKey.keyPath,0,o.primaryKey),i[":id"]=[n];for(var c=0,s=o.indexes;c<s.length;c++){var l=s[c];u(l.keyPath,0,l)}function f(n){var r,o=n.query.index;return o.isVirtual?t(t({},n),{query:{index:o.lowLevelIndex,range:(r=n.query.range,o=o.keyTail,{type:1===r.type?2:r.type,lower:In(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,o),lowerOpen:!0,upper:In(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,o),upperOpen:!0})}}):n}return t(t({},r),{schema:t(t({},o),{primaryKey:n,indexes:a,getIndexByKeyPath:function(e){return(e=i[Xt(e)])&&e[0]}}),count:function(e){return r.count(f(e))},query:function(e){return r.query(f(e))},openCursor:function(t){var n=t.query.index,o=n.keyTail,i=n.isVirtual,a=n.keyLength;return i?r.openCursor(f(t)).then((function(n){return n&&function(n){return Object.create(n,{continue:{value:function(r){null!=r?n.continue(In(r,t.reverse?e.MAX_KEY:e.MIN_KEY,o)):t.unique?n.continue(n.key.slice(0,a).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,o)):n.continue()}},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(In(t,e.MAX_KEY,o),r)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var e=n.key;return 1===a?e[0]:e.slice(0,a)}},value:{get:function(){return n.value}}})}(n)})):r.openCursor(t)}})}})}};function Dn(e,t,n,r){return n=n||{},r=r||"",i(e).forEach((function(o){var i,u,c;f(t,o)?(i=e[o],u=t[o],"object"==a(i)&&"object"==a(u)&&i&&u?(c=A(i))!==A(u)?n[r+o]=t[o]:"Object"===c?Dn(i,u,n,r+o+"."):i!==u&&(n[r+o]=t[o]):i!==u&&(n[r+o]=t[o])):n[r+o]=void 0})),i(t).forEach((function(o){f(e,o)||(n[r+o]=t[o])})),n}function qn(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}var Rn={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return t(t({},e),{table:function(n){var o=e.table(n),i=o.schema.primaryKey;return t(t({},o),{mutate:function(e){var a=be.trans,u=a.table(n).hook,c=u.deleting,s=u.creating,l=u.updating;switch(e.type){case"add":if(s.fire===Q)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"put":if(s.fire===Q&&l.fire===Q)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"delete":if(c.fire===Q)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"deleteRange":if(c.fire===Q)break;return a._promise("readwrite",(function(){return function e(n,r,a){return o.query({trans:n,values:!1,query:{index:i,range:r},limit:a}).then((function(o){var i=o.result;return h({type:"delete",keys:i,trans:n}).then((function(o){return 0<o.numFailures?Promise.reject(o.failures[0]):i.length<a?{failures:[],numFailures:0,lastResult:void 0}:e(n,t(t({},r),{lower:i[i.length-1],lowerOpen:!0}),a)}))}))}(e.trans,e.range,1e4)}),!0)}return o.mutate(e);function h(e){var n,a,u,h=be.trans,d=e.keys||qn(i,e);if(!d)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?t(t({},e),{keys:d}):t({},e)).type&&(e.values=r([],e.values,!0)),e.keys&&(e.keys=r([],e.keys,!0)),n=o,u=d,("add"===(a=e).type?Promise.resolve([]):n.getMany({trans:a.trans,keys:u,cache:"immutable"})).then((function(t){var n=d.map((function(n,r){var o,a,u,d=t[r],p={onerror:null,onsuccess:null};return"delete"===e.type?c.fire.call(p,n,d,h):"add"===e.type||void 0===d?(o=s.fire.call(p,n,e.values[r],h),null==n&&null!=o&&(e.keys[r]=n=o,i.outbound||k(e.values[r],i.keyPath,n))):(o=Dn(d,e.values[r]),(a=l.fire.call(p,o,n,d,h))&&(u=e.values[r],Object.keys(a).forEach((function(e){f(u,e)?u[e]=a[e]:k(u,e,a[e])})))),p}));return o.mutate(e).then((function(r){for(var o=r.failures,i=r.results,a=r.numFailures,u=(r=r.lastResult,0);u<d.length;++u){var c=(i||d)[u],s=n[u];null==c?s.onerror&&s.onerror(o[u]):s.onsuccess&&s.onsuccess("put"===e.type&&t[u]?e.values[u]:c)}return{failures:o,results:i,numFailures:a,lastResult:r}})).catch((function(e){return n.forEach((function(t){return t.onerror&&t.onerror(e)})),Promise.reject(e)}))}))}}})}})}};function Ln(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;for(var r=[],o=0,i=0;o<t.keys.length&&i<e.length;++o)0===st(t.keys[o],e[i])&&(r.push(n?K(t.values[o]):t.values[o]),++i);return r.length===e.length?r:null}catch(e){return null}}var Nn={stack:"dbcore",level:-1,create:function(e){return{table:function(n){var r=e.table(n);return t(t({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=Ln(e.keys,e.trans._cache,"clone"===e.cache);return t?xe.resolve(t):r.getMany(e).then((function(t){return e.trans._cache={keys:e.keys,values:"clone"===e.cache?K(t):t},t}))},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),r.mutate(e)}})}}}};function Mn(e,t){return"readonly"===e.trans.mode&&!!e.subscr&&!e.trans.explicit&&"disabled"!==e.trans.db._options.cache&&!t.schema.primaryKey.outbound}function Fn(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Un={stack:"dbcore",level:0,name:"Observability",create:function(e){var n=e.schema.name,r=new mn(e.MIN_KEY,e.MAX_KEY);return t(t({},e),{transaction:function(t,n,r){if(be.subscr&&"readonly"!==n)throw new H.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(be.querier));return e.transaction(t,n,r)},table:function(o){var a=e.table(o),c=a.schema,s=c.primaryKey,l=c.indexes,f=s.extractKey,h=s.outbound,d=s.autoIncrement&&l.filter((function(e){return e.compound&&e.keyPath.includes(s.keyPath)})),p=t(t({},a),{mutate:function(t){function i(e){return e="idb://".concat(n,"/").concat(o,"/").concat(e),y[e]||(y[e]=new mn)}var l,f,h,p=t.trans,y=t.mutatedParts||(t.mutatedParts={}),v=i(""),m=i(":dels"),b=t.type,g="deleteRange"===t.type?[t.range]:"delete"===t.type?[t.keys]:t.values.length<50?[qn(s,t).filter((function(e){return e})),t.values]:[],w=g[0],_=g[1];return g=t.trans._cache,u(w)?(v.addKeys(w),(g="delete"===b||w.length===_.length?Ln(w,g):null)||m.addKeys(w),(g||_)&&(l=i,f=g,h=_,c.indexes.forEach((function(e){var t=l(e.name||"");function n(t){return null!=t?e.extractKey(t):null}function r(n){return e.multiEntry&&u(n)?n.forEach((function(e){return t.addKey(e)})):t.addKey(n)}(f||h).forEach((function(e,t){var o=f&&n(f[t]);0!==st(o,t=h&&n(h[t]))&&(null!=o&&r(o),null!=t&&r(t))}))})))):w?(_={from:null!==(_=w.lower)&&void 0!==_?_:e.MIN_KEY,to:null!==(_=w.upper)&&void 0!==_?_:e.MAX_KEY},m.add(_),v.add(_)):(v.add(r),m.add(r),c.indexes.forEach((function(e){return i(e.name).add(r)}))),a.mutate(t).then((function(e){return!w||"add"!==t.type&&"put"!==t.type||(v.addKeys(e.results),d&&d.forEach((function(n){for(var r=t.values.map((function(e){return n.extractKey(e)})),o=n.keyPath.findIndex((function(e){return e===s.keyPath})),a=0,u=e.results.length;a<u;++a)r[a][o]=e.results[a];i(n.name).addKeys(r)}))),p.mutatedParts=En(p.mutatedParts||{},y),e}))}}),y=(l=function(t){t=(n=t.query).index;var n=n.range;return[t,new mn(null!==(t=n.lower)&&void 0!==t?t:e.MIN_KEY,null!==(n=n.upper)&&void 0!==n?n:e.MAX_KEY)]},{get:function(e){return[s,new mn(e.key)]},getMany:function(e){return[s,(new mn).addKeys(e.keys)]},count:l,query:l,openCursor:l});return i(y).forEach((function(e){p[e]=function(i){var u=!!(p=be.subscr),c=Mn(be,a)&&Fn(e,i)?i.obsSet={}:p;if(u){var s=function(e){return e="idb://".concat(n,"/").concat(o,"/").concat(e),c[e]||(c[e]=new mn)},l=s(""),d=s(":dels"),p=(u=(p=y[e](i))[0],p[1]);if(("query"===e&&u.isPrimaryKey&&!i.values?d:s(u.name||"")).add(p),!u.isPrimaryKey){if("count"!==e){var v="query"===e&&h&&i.values&&a.query(t(t({},i),{values:!1}));return a[e].apply(this,arguments).then((function(t){if("query"===e){if(h&&i.values)return v.then((function(e){return e=e.result,l.addKeys(e),t}));var n=i.values?t.result.map(f):t.result;(i.values?l:d).addKeys(n)}else if("openCursor"===e){var r=t,o=i.values;return r&&Object.create(r,{key:{get:function(){return d.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var e=r.primaryKey;return d.addKey(e),e}},value:{get:function(){return o&&l.addKey(r.primaryKey),r.value}}})}return t}))}d.add(r)}}return a[e].apply(this,arguments)}})),p}})}};function Vn(e,n,r){if(0===r.numFailures)return n;if("deleteRange"===n.type)return null;var o=n.keys?n.keys.length:"values"in n&&n.values?n.values.length:1;return r.numFailures===o?null:(n=t({},n),u(n.keys)&&(n.keys=n.keys.filter((function(e,t){return!(t in r.failures)}))),"values"in n&&u(n.values)&&(n.values=n.values.filter((function(e,t){return!(t in r.failures)}))),n)}function Gn(e,t){return n=e,(void 0===(r=t).lower||(r.lowerOpen?0<st(n,r.lower):0<=st(n,r.lower)))&&(void 0===t.upper||(t.upperOpen?st(e,t.upper)<0:st(e,t.upper)<=0));var n,r}function zn(e,t,n,r,o,i){if(!n||0===n.length)return e;var a=t.query.index,c=a.multiEntry,s=t.query.range,l=r.schema.primaryKey.extractKey,f=a.extractKey,h=(a.lowLevelIndex||a).extractKey;return n=n.reduce((function(e,n){var r=e,o=[];if("add"===n.type||"put"===n.type)for(var i=new mn,a=n.values.length-1;0<=a;--a){var h,d=n.values[a],p=l(d);i.hasKey(p)||(h=f(d),(c&&u(h)?h.some((function(e){return Gn(e,s)})):Gn(h,s))&&(i.addKey(p),o.push(d)))}switch(n.type){case"add":var y=(new mn).addKeys(t.values?e.map((function(e){return l(e)})):e);r=e.concat(t.values?o.filter((function(e){return e=l(e),!y.hasKey(e)&&(y.addKey(e),!0)})):o.map((function(e){return l(e)})).filter((function(e){return!y.hasKey(e)&&(y.addKey(e),!0)})));break;case"put":var v=(new mn).addKeys(n.values.map((function(e){return l(e)})));r=e.filter((function(e){return!v.hasKey(t.values?l(e):e)})).concat(t.values?o:o.map((function(e){return l(e)})));break;case"delete":var m=(new mn).addKeys(n.keys);r=e.filter((function(e){return!m.hasKey(t.values?l(e):e)}));break;case"deleteRange":var b=n.range;r=e.filter((function(e){return!Gn(l(e),b)}))}return r}),e),n===e?e:(n.sort((function(e,t){return st(h(e),h(t))||st(l(e),l(t))})),t.limit&&t.limit<1/0&&(n.length>t.limit?n.length=t.limit:e.length===t.limit&&n.length<t.limit&&(o.dirty=!0)),i?Object.freeze(n):n)}function Yn(e,t){return 0===st(e.lower,t.lower)&&0===st(e.upper,t.upper)&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}var Hn={stack:"dbcore",level:0,name:"Cache",create:function(e){var n=e.schema.name;return t(t({},e),{transaction:function(t,r,o){var i,a,u=e.transaction(t,r,o);return"readwrite"===r&&(a=(i=new AbortController).signal,o=function(o){return function(){if(i.abort(),"readwrite"===r){for(var a=new Set,c=0,s=t;c<s.length;c++){var l=s[c],f=Sn["idb://".concat(n,"/").concat(l)];if(f){var h=e.table(l),d=f.optimisticOps.filter((function(e){return e.trans===u}));if(u._explicit&&o&&u.mutatedParts)for(var p=0,y=Object.values(f.queries.query);p<y.length;p++)for(var v=0,m=(w=y[p]).slice();v<m.length;v++)On((_=m[v]).obsSet,u.mutatedParts)&&(D(w,_),_.subscribers.forEach((function(e){return a.add(e)})));else if(0<d.length){f.optimisticOps=f.optimisticOps.filter((function(e){return e.trans!==u}));for(var b=0,g=Object.values(f.queries.query);b<g.length;b++)for(var w,_,x,k=0,E=(w=g[b]).slice();k<E.length;k++)null!=(_=E[k]).res&&u.mutatedParts&&(o&&!_.dirty?(x=Object.isFrozen(_.res),x=zn(_.res,_.req,d,h,_,x),_.dirty?(D(w,_),_.subscribers.forEach((function(e){return a.add(e)}))):x!==_.res&&(_.res=x,_.promise=xe.resolve({result:x}))):(_.dirty&&D(w,_),_.subscribers.forEach((function(e){return a.add(e)}))))}}}a.forEach((function(e){return e()}))}}},u.addEventListener("abort",o(!1),{signal:a}),u.addEventListener("error",o(!1),{signal:a}),u.addEventListener("complete",o(!0),{signal:a})),u},table:function(r){var o=e.table(r),i=o.schema.primaryKey;return t(t({},o),{mutate:function(e){var a=be.trans;if(i.outbound||"disabled"===a.db._options.cache||a.explicit||"readwrite"!==a.idbtrans.mode)return o.mutate(e);var u=Sn["idb://".concat(n,"/").concat(r)];return u?(a=o.mutate(e),"add"!==e.type&&"put"!==e.type||!(50<=e.values.length||qn(i,e).some((function(e){return null==e})))?(u.optimisticOps.push(e),e.mutatedParts&&Cn(e.mutatedParts),a.then((function(t){0<t.numFailures&&(D(u.optimisticOps,e),(t=Vn(0,e,t))&&u.optimisticOps.push(t),e.mutatedParts&&Cn(e.mutatedParts))})),a.catch((function(){D(u.optimisticOps,e),e.mutatedParts&&Cn(e.mutatedParts)}))):a.then((function(n){var r=Vn(0,t(t({},e),{values:e.values.map((function(e,r){var o;return n.failures[r]||k(e=null!==(o=i.keyPath)&&void 0!==o&&o.includes(".")?K(e):t({},e),i.keyPath,n.results[r]),e}))}),n);u.optimisticOps.push(r),queueMicrotask((function(){return e.mutatedParts&&Cn(e.mutatedParts)}))})),a):o.mutate(e)},query:function(e){if(!Mn(be,o)||!Fn("query",e))return o.query(e);var t="immutable"===(null===(u=be.trans)||void 0===u?void 0:u.db._options.cache),i=(s=be).requery,a=s.signal,u=function(e,t,n,r){var o=Sn["idb://".concat(e,"/").concat(t)];if(!o)return[];if(!(t=o.queries[n]))return[null,!1,o,null];var i=t[(r.query?r.query.index.name:null)||""];if(!i)return[null,!1,o,null];switch(n){case"query":var a=i.find((function(e){return e.req.limit===r.limit&&e.req.values===r.values&&Yn(e.req.query.range,r.query.range)}));return a?[a,!0,o,i]:[i.find((function(e){return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(!r.values||e.req.values)&&function(e,t){return function(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(t=st(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return-1}return t}(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=function(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return-1;if(0===(t=st(e,t))){if(n&&r)return 0;if(n)return-1;if(r)return 1}return t}(e.upper,t.upper,e.upperOpen,t.upperOpen)}(e.req.query.range,r.query.range)})),!1,o,i];case"count":return a=i.find((function(e){return Yn(e.req.query.range,r.query.range)})),[a,!!a,o,i]}}(n,r,"query",e),c=u[0],s=u[1],l=u[2],f=u[3];return c&&s?c.obsSet=e.obsSet:(s=o.query(e).then((function(e){var n=e.result;if(c&&(c.res=n),t){for(var r=0,o=n.length;r<o;++r)Object.freeze(n[r]);Object.freeze(n)}else e.result=K(n);return e})).catch((function(e){return f&&c&&D(f,c),Promise.reject(e)})),c={obsSet:e.obsSet,promise:s,subscribers:new Set,type:"query",req:e,dirty:!1},f?f.push(c):(f=[c],(l=l||(Sn["idb://".concat(n,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[e.query.index.name||""]=f)),function(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",(function(){var r,o;e.subscribers.delete(n),0===e.subscribers.size&&(r=e,o=t,setTimeout((function(){0===r.subscribers.size&&D(o,r)}),3e3))}))}(c,f,i,a),c.promise.then((function(n){return{result:zn(n.result,e,null==l?void 0:l.optimisticOps,o,c,t)}}))}})}})}};function Wn(e,t){return new Proxy(e,{get:function(e,n,r){return"db"===n?t:Reflect.get(e,n,r)}})}var $n=(Qn.prototype.version=function(e){if(isNaN(e)||e<.1)throw new H.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new H.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter((function(t){return t._cfg.version===e}))[0];return n||(n=new this.Version(e),t.push(n),t.sort(nn),n.stores({}),this._state.autoSchema=!1,n)},Qn.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||be.letThrough||this._vip)?e():new xe((function(e,n){if(t._state.openComplete)return n(new H.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new H.DatabaseClosed);t.open().catch(Q)}t._state.dbReadyPromise.then(e,n)})).then(e)},Qn.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,o=e.name;return o&&this.unuse({stack:t,name:o}),(e=this._middlewares[t]||(this._middlewares[t]=[])).push({stack:t,create:n,level:null==r?10:r,name:o}),e.sort((function(e,t){return e.level-t.level})),this},Qn.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter((function(e){return r?e.create!==r:!!n&&e.name!==n}))),this},Qn.prototype.open=function(){var e=this;return We(me,(function(){return function(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((function(){return t.dbOpenError?Xe(t.dbOpenError):e}));t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,o=Math.round(10*e.verno),u=!1;function c(){if(t.openCanceller!==r)throw new H.DatabaseClosed("db.open() was cancelled")}var s,l=t.dbReadyResolve,f=null,h=!1;return xe.race([r,("undefined"==typeof navigator?xe.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(e){function t(){return indexedDB.databases().finally(e)}s=setInterval(t,100),t()})).finally((function(){return clearInterval(s)})):Promise.resolve()).then((function r(){return new xe((function(s,l){if(c(),!n)throw new H.MissingAPI;var d=e.name,p=t.autoSchema||!o?n.open(d):n.open(d,o);if(!p)throw new H.MissingAPI;p.onerror=Rt(l),p.onblocked=Be(e._fireOnBlocked),p.onupgradeneeded=Be((function(r){var o;f=p.transaction,t.autoSchema&&!e._options.allowEmptyDB?(p.onerror=Lt,f.abort(),p.result.close(),(o=n.deleteDatabase(d)).onsuccess=o.onerror=Be((function(){l(new H.NoSuchDatabase("Database ".concat(d," doesnt exist")))}))):(f.onerror=Rt(l),r=r.oldVersion>Math.pow(2,62)?0:r.oldVersion,h=r<1,e.idbdb=p.result,u&&function(e,t){an(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=cn(0,e.idbdb,t);sn(e,e._dbSchema,t);for(var r=0,o=rn(n,e._dbSchema).change;r<o.length;r++){var i=function(e){if(e.change.length||e.recreate)return console.warn("Unable to patch indexes of table ".concat(e.name," because it has changes on the type of index or primary key.")),{value:void 0};var n=t.objectStore(e.name);e.add.forEach((function(t){ie&&console.debug("Dexie upgrade patch: Creating missing index ".concat(e.name,".").concat(t.src)),un(n,t)}))}(o[r]);if("object"==a(i))return i.value}}(e,f),function(e,t,n,r){var o=e._dbSchema;n.objectStoreNames.contains("$meta")&&!o.$meta&&(o.$meta=Yt("$meta",ln("")[0],[]),e._storeNames.push("$meta"));var a=e._createTransaction("readwrite",e._storeNames,o);a.create(n),a._completion.catch(r);var u=a._reject.bind(a),c=be.transless||be;Fe((function(){return be.trans=a,be.transless=c,0!==t?(Zt(e,n),s=t,((r=a).storeNames.includes("$meta")?r.table("$meta").get("version").then((function(e){return null!=e?e:s})):xe.resolve(s)).then((function(t){return o=t,u=a,c=n,s=[],t=(r=e)._versions,l=r._dbSchema=cn(0,r.idbdb,c),0!==(t=t.filter((function(e){return e._cfg.version>=o}))).length?(t.forEach((function(e){s.push((function(){var t=l,n=e._cfg.dbschema;sn(r,t,c),sn(r,n,c),l=r._dbSchema=n;var a=rn(t,n);a.add.forEach((function(e){on(c,e[0],e[1].primKey,e[1].indexes)})),a.change.forEach((function(e){if(e.recreate)throw new H.Upgrade("Not yet support for changing primary key");var t=c.objectStore(e.name);e.add.forEach((function(e){return un(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),un(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var s=e._cfg.contentUpgrade;if(s&&e._cfg.version>o){Zt(r,c),u._memoizedTables={};var f=E(n);a.del.forEach((function(e){f[e]=t[e]})),tn(r,[r.Transaction.prototype]),en(r,[r.Transaction.prototype],i(f),f),u.schema=f;var h,d=L(s);return d&&Ue(),a=xe.follow((function(){var e;(h=s(u))&&d&&(e=Ve.bind(null,null),h.then(e,e))})),h&&"function"==typeof h.then?xe.resolve(h):a.then((function(){return h}))}})),s.push((function(t){var n,o,i=e._cfg.dbschema;n=i,o=t,[].slice.call(o.db.objectStoreNames).forEach((function(e){return null==n[e]&&o.db.deleteObjectStore(e)})),tn(r,[r.Transaction.prototype]),en(r,[r.Transaction.prototype],r._storeNames,r._dbSchema),u.schema=r._dbSchema})),s.push((function(t){r.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(r.idbdb.version/10)===e._cfg.version?(r.idbdb.deleteObjectStore("$meta"),delete r._dbSchema.$meta,r._storeNames=r._storeNames.filter((function(e){return"$meta"!==e}))):t.objectStore("$meta").put(e._cfg.version,"version"))}))})),function e(){return s.length?xe.resolve(s.shift()(u.idbtrans)).then(e):xe.resolve()}().then((function(){an(l,c)}))):xe.resolve();var r,o,u,c,s,l})).catch(u)):(i(o).forEach((function(e){on(n,e,o[e].primKey,o[e].indexes)})),Zt(e,n),void xe.follow((function(){return e.on.populate.fire(a)})).catch(u));var r,s}))}(e,r/10,f,l))}),l),p.onsuccess=Be((function(){f=null;var n,a,c,l,y,v=e.idbdb=p.result,m=b(v.objectStoreNames);if(0<m.length)try{var g=v.transaction(1===(l=m).length?l[0]:l,"readonly");if(t.autoSchema)a=v,c=g,(n=e).verno=a.version/10,c=n._dbSchema=cn(0,a,c),n._storeNames=b(a.objectStoreNames,0),en(n,[n._allTables],i(c),c);else if(sn(e,e._dbSchema,g),((y=rn(cn(0,(y=e).idbdb,g),y._dbSchema)).add.length||y.change.some((function(e){return e.add.length||e.change.length})))&&!u)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),v.close(),o=v.version+1,u=!0,s(r());Zt(e,g)}catch(n){}tt.push(e),v.onversionchange=Be((function(n){t.vcFired=!0,e.on("versionchange").fire(n)})),v.onclose=Be((function(t){e.on("close").fire(t)})),h&&(y=e._deps,g=d,v=y.indexedDB,y=y.IDBKeyRange,pn(v)||g===nt||dn(v,y).put({name:g}).catch(Q)),s()}),l)})).catch((function(e){switch(null==e?void 0:e.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),r();break;case"VersionError":if(0<o)return o=0,r()}return xe.reject(e)}))}))]).then((function(){return c(),t.onReadyBeingFired=[],xe.resolve(yn((function(){return e.on.ready.fire(e.vip)}))).then((function n(){if(0<t.onReadyBeingFired.length){var r=t.onReadyBeingFired.reduce(oe,Q);return t.onReadyBeingFired=[],xe.resolve(yn((function(){return r(e.vip)}))).then(n)}}))})).finally((function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)})).catch((function(n){t.dbOpenError=n;try{f&&f.abort()}catch(n){}return r===t.openCanceller&&e._close(),Xe(n)})).finally((function(){t.openComplete=!0,l()})).then((function(){var t;return h&&(t={},e.tables.forEach((function(n){n.schema.indexes.forEach((function(r){r.name&&(t["idb://".concat(e.name,"/").concat(n.name,"/").concat(r.name)]=new mn(-1/0,[[[]]]))})),t["idb://".concat(e.name,"/").concat(n.name,"/")]=t["idb://".concat(e.name,"/").concat(n.name,"/:dels")]=new mn(-1/0,[[[]]])})),Ft(Nt).fire(t),Kn(t,!0)),e}))}(e)}))},Qn.prototype._close=function(){var e=this._state,t=tt.indexOf(this);if(0<=t&&tt.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(t){}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new xe((function(t){e.dbReadyResolve=t})),e.openCanceller=new xe((function(t,n){e.cancelOpen=n})))},Qn.prototype.close=function(e){var t=(void 0===e?{disableAutoOpen:!0}:e).disableAutoOpen;e=this._state,t?(e.isBeingOpened&&e.cancelOpen(new H.DatabaseClosed),this._close(),e.autoOpen=!1,e.dbOpenError=new H.DatabaseClosed):(this._close(),e.autoOpen=this._options.autoOpen||e.isBeingOpened,e.openComplete=!1,e.dbOpenError=null)},Qn.prototype.delete=function(e){var t=this;void 0===e&&(e={disableAutoOpen:!0});var n=0<arguments.length&&"object"!=a(arguments[0]),r=this._state;return new xe((function(o,i){function a(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=Be((function(){var e,n,r;e=t._deps,n=t.name,r=e.indexedDB,e=e.IDBKeyRange,pn(r)||n===nt||dn(r,e).delete(n).catch(Q),o()})),n.onerror=Rt(i),n.onblocked=t._fireOnBlocked}if(n)throw new H.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()}))},Qn.prototype.backendDB=function(){return this.idbdb},Qn.prototype.isOpen=function(){return null!==this.idbdb},Qn.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},Qn.prototype.hasFailed=function(){return null!==this._state.dbOpenError},Qn.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(Qn.prototype,"tables",{get:function(){var e=this;return i(this._allTables).map((function(t){return e._allTables[t]}))},enumerable:!1,configurable:!0}),Qn.prototype.transaction=function(){var e=function(e,t,n){var r=arguments.length;if(r<2)throw new H.InvalidArgument("Too few arguments");for(var o=new Array(r-1);--r;)o[r-1]=arguments[r];return n=o.pop(),[e,S(o),n]}.apply(this,arguments);return this._transaction.apply(this,e)},Qn.prototype._transaction=function(e,t,n){var r=this,o=be.trans;o&&o.db===this&&-1===e.indexOf("!")||(o=null);var i,a,u=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map((function(e){if("string"!=typeof(e=e instanceof r.Table?e.name:e))throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e})),"r"==e||e===rt)i=rt;else{if("rw"!=e&&e!=ot)throw new H.InvalidArgument("Invalid transaction mode: "+e);i=ot}if(o){if(o.mode===rt&&i===ot){if(!u)throw new H.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o=null}o&&a.forEach((function(e){if(o&&-1===o.storeNames.indexOf(e)){if(!u)throw new H.SubTransaction("Table "+e+" not included in parent transaction.");o=null}})),u&&o&&!o.active&&(o=null)}}catch(n){return o?o._promise(null,(function(e,t){t(n)})):Xe(n)}var c=function e(t,n,r,o,i){return xe.resolve().then((function(){var a=be.transless||be,u=t._createTransaction(n,r,t._dbSchema,o);if(u.explicit=!0,a={trans:u,transless:a},o)u.idbtrans=o.idbtrans;else try{u.create(),u.idbtrans._explicit=!0,t._state.PR1398_maxLoop=3}catch(a){return a.name===z.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,null,i)}))):Xe(a)}var c,s=L(i);return s&&Ue(),a=xe.follow((function(){var e;(c=i.call(u,u))&&(s?(e=Ve.bind(null,null),c.then(e,e)):"function"==typeof c.next&&"function"==typeof c.throw&&(c=An(c)))}),a),(c&&"function"==typeof c.then?xe.resolve(c).then((function(e){return u.active?e:Xe(new H.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):a.then((function(){return c}))).then((function(e){return o&&u._resolve(),u._completion.then((function(){return e}))})).catch((function(e){return u._reject(e),Xe(e)}))}))}.bind(null,this,i,a,o,n);return o?o._promise(i,c,"lock"):be.trans?We(be.transless,(function(){return r._whenReady(c)})):this._whenReady(c)},Qn.prototype.table=function(e){if(!f(this._allTables,e))throw new H.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},Qn);function Qn(e,n){var r=this;this._middlewares={},this.verno=0;var o=Qn.dependencies;this._options=n=t({addons:Qn.addons,autoOpen:!0,indexedDB:o.indexedDB,IDBKeyRange:o.IDBKeyRange,cache:"cloned"},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},o=n.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var i,a,u,c,s,l={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Q,dbReadyPromise:null,cancelOpen:Q,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:n.autoOpen};l.dbReadyPromise=new xe((function(e){l.dbReadyResolve=e})),l.openCanceller=new xe((function(e,t){l.cancelOpen=t})),this._state=l,this.name=e,this.on=pt(this,"populate","blocked","versionchange","close",{ready:[oe,Q]}),this.on.ready.subscribe=g(this.on.ready.subscribe,(function(e){return function(t,n){Qn.vip((function(){var o,i=r._state;i.openComplete?(i.dbOpenError||xe.resolve().then(t),n&&e(t)):i.onReadyBeingFired?(i.onReadyBeingFired.push(t),n&&e(t)):(e(t),o=r,n||e((function e(){o.on.ready.unsubscribe(t),o.on.ready.unsubscribe(e)})))}))}})),this.Collection=(i=this,yt(Ot.prototype,(function(e,t){this.db=i;var n=at,r=null;if(t)try{n=t()}catch(e){r=e}var o=e._ctx;e=(t=o.table).hook.reading.fire,this._ctx={table:t,index:o.index,isPrimKey:!o.index||t.schema.primKey.keyPath&&o.index===t.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:o.or,valueMapper:e!==X?e:null}}))),this.Table=(a=this,yt(ht.prototype,(function(e,t,n){this.db=a,this._tx=n,this.name=e,this.schema=t,this.hook=a._allTables[e]?a._allTables[e].hook:pt(null,{creating:[ee,Q],reading:[J,X],updating:[ne,Q],deleting:[te,Q]})}))),this.Transaction=(u=this,yt(Ut.prototype,(function(e,t,n,r,o){var i=this;this.db=u,this.mode=e,this.storeNames=t,this.schema=n,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=pt(this,"complete","error","abort"),this.parent=o||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new xe((function(e,t){i._resolve=e,i._reject=t})),this._completion.then((function(){i.active=!1,i.on.complete.fire()}),(function(e){var t=i.active;return i.active=!1,i.on.error.fire(e),i.parent?i.parent._reject(e):t&&i.idbtrans&&i.idbtrans.abort(),Xe(e)}))}))),this.Version=(c=this,yt(fn.prototype,(function(e){this.db=c,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))),this.WhereClause=(s=this,yt(Dt.prototype,(function(e,t,n){if(this.db=s,this._ctx={table:e,index:":id"===t?null:t,or:n},this._cmp=this._ascending=st,this._descending=function(e,t){return st(t,e)},this._max=function(e,t){return 0<st(e,t)?e:t},this._min=function(e,t){return st(e,t)<0?e:t},this._IDBKeyRange=s._deps.IDBKeyRange,!this._IDBKeyRange)throw new H.MissingAPI}))),this.on("versionchange",(function(e){0<e.newVersion?console.warn("Another connection wants to upgrade database '".concat(r.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(r.name,"'. Closing db now to resume the delete request.")),r.close({disableAutoOpen:!1})})),this.on("blocked",(function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('".concat(r.name,"') was blocked")):console.warn("Upgrade '".concat(r.name,"' blocked by other connection holding version ").concat(e.oldVersion/10))})),this._maxKey=Ht(n.IDBKeyRange),this._createTransaction=function(e,t,n,o){return new r.Transaction(e,t,n,r._options.chromeTransactionDurability,o)},this._fireOnBlocked=function(e){r.on("blocked").fire(e),tt.filter((function(e){return e.name===r.name&&e!==r&&!e._state.vcFired})).map((function(t){return t.on("versionchange").fire(e)}))},this.use(Nn),this.use(Hn),this.use(Un),this.use(Bn),this.use(Rn);var f=new Proxy(this,{get:function(e,t,n){if("_vip"===t)return!0;if("table"===t)return function(e){return Wn(r.table(e),f)};var o=Reflect.get(e,t,n);return o instanceof ht?Wn(o,f):"tables"===t?o.map((function(e){return Wn(e,f)})):"_createTransaction"===t?function(){return Wn(o.apply(this,arguments),f)}:o}});this.vip=f,o.forEach((function(e){return e(r)}))}N="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";var Xn,Jn=(Zn.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},Zn.prototype[N]=function(){return this},Zn);function Zn(e){this._subscribe=e}try{Xn={indexedDB:o.indexedDB||o.mozIndexedDB||o.webkitIndexedDB||o.msIndexedDB,IDBKeyRange:o.IDBKeyRange||o.webkitIDBKeyRange}}catch(P){Xn={indexedDB:null,IDBKeyRange:null}}function er(e){var t,n=!1,r=new Jn((function(r){var o,i=L(e),a=!1,u={},c={},s={get closed(){return a},unsubscribe:function(){a||(a=!0,o&&o.abort(),l&&Ft.storagemutated.unsubscribe(d))}};r.start&&r.start(s);var l=!1,h=function(){return Qe(p)},d=function(e){En(u,e),On(c,u)&&h()},p=function(){var s,p,y;!a&&Xn.indexedDB&&(u={},s={},o&&o.abort(),o=new AbortController,y=function(t){var n=Ke();try{i&&Ue();var r=Fe(e,t);return r=i?r.finally(Ve):r}finally{n&&Te()}}(p={subscr:s,signal:o.signal,requery:h,querier:e,trans:null}),Promise.resolve(y).then((function(e){n=!0,t=e,a||p.signal.aborted||(u={},function(e){for(var t in e)if(f(e,t))return;return 1}(c=s)||l||(Ft(Nt,d),l=!0),Qe((function(){return!a&&r.next&&r.next(e)})))}),(function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||a||Qe((function(){a||r.error&&r.error(e)}))})))};return setTimeout(h,0),s}));return r.hasValue=function(){return n},r.getValue=function(){return t},r}var tr=$n;function nr(e){var t=or;try{or=!0,Ft.storagemutated.fire(e),Kn(e,!0)}finally{or=t}}h(tr,t(t({},$),{delete:function(e){return new tr(e,{addons:[]}).delete()},exists:function(e){return new tr(e,{addons:[]}).open().then((function(e){return e.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(e){try{return n=(t=tr.dependencies).indexedDB,t=t.IDBKeyRange,(pn(n)?Promise.resolve(n.databases()).then((function(e){return e.map((function(e){return e.name})).filter((function(e){return e!==nt}))})):dn(n,t).toCollection().primaryKeys()).then(e)}catch(e){return Xe(new H.MissingAPI)}var t,n},defineClass:function(){return function(e){c(this,e)}},ignoreTransaction:function(e){return be.trans?We(be.transless,e):e()},vip:yn,async:function(e){return function(){try{var t=An(e.apply(this,arguments));return t&&"function"==typeof t.then?t:xe.resolve(t)}catch(t){return Xe(t)}}},spawn:function(e,t,n){try{var r=An(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:xe.resolve(r)}catch(e){return Xe(e)}},currentTransaction:{get:function(){return be.trans||null}},waitFor:function(e,t){return t=xe.resolve("function"==typeof e?tr.ignoreTransaction(e):e).timeout(t||6e4),be.trans?be.trans.waitFor(t):t},Promise:xe,debug:{get:function(){return ie},set:function(e){ae(e)}},derive:y,extend:c,props:h,override:g,Events:pt,on:Ft,liveQuery:er,extendObservabilitySet:En,getByKeyPath:x,setByKeyPath:k,delByKeyPath:function(e,t){"string"==typeof t?k(e,t,void 0):"length"in t&&[].map.call(t,(function(t){k(e,t,void 0)}))},shallowClone:E,deepClone:K,getObjectDiff:Dn,cmp:st,asap:_,minKey:-1/0,addons:[],connections:tt,errnames:z,dependencies:Xn,cache:Sn,semVer:"4.0.11",version:"4.0.11".split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)}))})),tr.maxKey=Ht(tr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(Ft(Nt,(function(e){or||(e=new CustomEvent(Mt,{detail:e}),or=!0,dispatchEvent(e),or=!1)})),addEventListener(Mt,(function(e){e=e.detail,or||nr(e)})));var rr,or=!1,ir=function(){};return"undefined"!=typeof BroadcastChannel&&((ir=function(){(rr=new BroadcastChannel(Mt)).onmessage=function(e){return e.data&&nr(e.data)}})(),"function"==typeof rr.unref&&rr.unref(),Ft(Nt,(function(e){or||rr.postMessage(e)}))),"undefined"!=typeof addEventListener&&(addEventListener("pagehide",(function(e){if(!$n.disableBfCache&&e.persisted){ie&&console.debug("Dexie: handling persisted pagehide"),null!=rr&&rr.close();for(var t=0,n=tt;t<n.length;t++)n[t].close({disableAutoOpen:!1})}})),addEventListener("pageshow",(function(e){!$n.disableBfCache&&e.persisted&&(ie&&console.debug("Dexie: handling persisted pageshow"),ir(),nr({all:new mn(-1/0,[[]])}))}))),xe.rejectionMapper=function(e,t){return!e||e instanceof F||e instanceof TypeError||e instanceof SyntaxError||!e.name||!W[e.name]?e:(t=new W[e.name](t||e.message,e),"stack"in e&&p(t,"stack",{get:function(){return this.inner.stack}}),t)},ae(ie),t($n,Object.freeze({__proto__:null,Dexie:$n,liveQuery:er,Entity:ct,cmp:st,PropModification:kt,replacePrefix:function(e,t){return new kt({replacePrefix:[e,t]})},add:function(e){return new kt({add:e})},remove:function(e){return new kt({remove:e})},default:$n,RangeSet:mn,mergeRanges:gn,rangesOverlap:wn}),{default:$n}),$n},"object"==a(t)?e.exports=i():void 0===(o="function"==typeof(r=i)?r.call(t,n,t,e):r)||(e.exports=o)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{"use strict";const e=function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return'<div class="docuchatMain_main_body_wrapper_ai">\n                <div class="docuchatMain_main_body_wrapper_ai_wrapper">\n                <b>'.concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,'</b>\n                <div class="docuchatMain_main_body_wrapper_ai_wrapper_bubble">\n                ').concat(e&&e," \n           </div>     \n          </div>\n        </div>")};var t=n(956),r=Symbol.for("Dexie"),o=globalThis[r]||(globalThis[r]=t);if(t.semVer!==o.semVer)throw new Error("Two different versions of Dexie loaded in the same app: ".concat(t.semVer," and ").concat(o.semVer));o.liveQuery,o.mergeRanges,o.rangesOverlap,o.RangeSet,o.cmp,o.Entity,o.PropModification,o.replacePrefix,o.add,o.remove;const i=o;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function c(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}const s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.db,this.dcdb="docuchatDB",this.init()},(t=[{key:"init",value:function(){return this.db=new i(this.dcdb),this.db.version(1).stores({chat:"++id, emisor, message"}),this.db}}])&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),l=function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return'<div class="docuchatMain_main_body_wrapper_humman">\n            <div class="docuchatMain_main_body_wrapper_humman_wrapper">\n            <b>'.concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,'</b>\n            <div class="docuchatMain_main_body_wrapper_humman_wrapper_bubble">\n            ').concat(e&&e," \n       </div>     \n      </div>\n    </div>")};var f=function(){var e=document.getElementsByClassName("docuchatMain_main_body_wrapper")[0];e.scrollTop=e.scrollHeight};function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function p(e){var t=function(e){if("object"!=h(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}const y=function(){return t=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.containerIconChat,this.clientdb=(new s).db,this.init()},(n=[{key:"init",value:function(){var t=this;try{document.getElementsByClassName("docuchatMain_main_body_wrapper")[0]&&(this.containerIconChat=document.getElementsByClassName("docuchatMain_main_body_wrapper")[0],this.containerIconChat.innerHTML+=e("AI","".concat(docuchat_ajax.initialMessage)),this.clientdb.chat.toArray().then((function(n){n&&n.map((function(n){"AI"==n.transmiter?t.containerIconChat.innerHTML+=e(n.transmiter,n.message):t.containerIconChat.innerHTML+=l(n.transmiter,n.message)}))})))}catch(e){console.log(e)}finally{setTimeout((function(){f()}),500)}}}])&&d(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,b(r.key),r)}}function b(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}const g=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.containerIconChat,this.class="open",this.timeOut,this.timer=3e3,this.eventType="mouseenter",this.automaticRevealChat()},(t=[{key:"automaticRevealChat",value:function(){var e=this;try{document.getElementsByClassName("docuChatRevealChat_wrapper")[0]&&(this.containerIconChat=document.getElementsByClassName("docuChatRevealChat_wrapper")[0]),this.containerIconChat.addEventListener(this.eventType,(function(){e.containerIconChat.classList.add(e.class),e.timeOut=setTimeout((function(){e.containerIconChat.classList.remove(e.class)}),e.timer)}))}catch(e){console.log(e)}finally{clearTimeout(this.timeOut)}}}])&&m(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),w=function(){var e=document.getElementById("loaderChat");e&&e.classList.toggle("active")};function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function x(){x=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),u=new A(r||[]);return o(a,"_invoke",{value:j(e,n,u)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",v={};function m(){}function b(){}function g(){}var w={};s(w,a,(function(){return this}));var k=Object.getPrototypeOf,E=k&&k(k(I([])));E&&E!==n&&r.call(E,a)&&(w=E);var O=g.prototype=m.prototype=Object.create(w);function S(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function n(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==_(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function j(t,n,r){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var c=C(u,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var s=f(t,n,r);if("normal"===s.type){if(o=r.done?y:d,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=y,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function K(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(K,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(_(t)+" is not iterable")}return b.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},S(P.prototype),s(P.prototype,u,(function(){return this})),t.AsyncIterator=P,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new P(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(O),s(O,c,"Generator"),s(O,a,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function k(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,O(r.key),r)}}function O(e){var t=function(e){if("object"!=_(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_(t)?t:t+""}const S=function(){return t=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.containerIconChat,this.humanText,this.animation,this.init(),this.clientdb=(new s).db},n=[{key:"init",value:function(){var e=this;try{document.getElementsByClassName("docuchatMain_main_body_wrapper")[0]&&document.getElementsByClassName("docuchatMain_main_footer_form")[0]&&document.getElementsByClassName("docuchatMain_main_body_wrapper_loadingAmination")[0]&&(this.containerIconChat=document.getElementsByClassName("docuchatMain_main_body_wrapper")[0],this.humanText=document.getElementsByClassName("docuchatMain_main_footer_form")[0],this.humanText&&this.humanText.addEventListener("submit",(function(t){t.preventDefault(),w(),e.containerIconChat.innerHTML+=l("Me",e.humanText.children[0].value),e.clientdb.chat.add({transmiter:"Me",message:e.humanText.children[0].value}).then((function(){console.log("Data added to object store")})).catch((function(e){console.log("Data not added to object store",e)})),e.getResponse(e.humanText.children[0].value),e.humanText.children[0].value="",f()})))}catch(e){console.log(e)}}},{key:"getResponse",value:function(t){var n,r,o=this;try{t&&docuchat_ajax.token&&jQuery.ajax({type:"post",url:docuchat_ajax.url,dataType:"text",data:"action=llmChat&nonce=".concat(docuchat_ajax.nonce,"&token=").concat(docuchat_ajax.token,"&message=").concat(t),success:(n=x().mark((function t(n){var r,i,a,u,c;return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,JSON.parse(n);case 2:200==(i=t.sent).status&&null!=i&&null!==(r=i.message)&&void 0!==r&&r.body&&((u=JSON.parse(null==i||null===(a=i.message)||void 0===a?void 0:a.body)).message.status,c=u.message.message,o.containerIconChat.innerHTML+=e("AI",c),o.clientdb.chat.add({transmiter:"AI",message:c})),f(),w();case 6:case"end":return t.stop()}}),t)})),r=function(){var e=this,t=arguments;return new Promise((function(r,o){var i=n.apply(e,t);function a(e){k(i,r,o,a,u,"next",e)}function u(e){k(i,r,o,a,u,"throw",e)}a(void 0)}))},function(e){return r.apply(this,arguments)}),error:function(e){console.log("error",e)}})}catch(e){console.log("Error",e)}}}],n&&E(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,C(r.key),r)}}function C(e){var t=function(e){if("object"!=P(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=P(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==P(t)?t:t+""}const K=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.chatrobot=document.querySelector(".docuChatRevealChat"),this.chatBox=document.querySelector(".docuchatMain"),this.init()},(t=[{key:"init",value:function(){document.cookie.split(";").filter((function(e){return e.trim().includes("docuchat_chatStatus")})).length>0?this.chatBox&&this.chatBox.classList.add("active"):this.chatrobot&&this.chatrobot.classList.add("active")}}])&&j(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function A(){A=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),u=new K(r||[]);return o(a,"_invoke",{value:S(e,n,u)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",v={};function m(){}function b(){}function g(){}var w={};s(w,a,(function(){return this}));var _=Object.getPrototypeOf,x=_&&_(_(I([])));x&&x!==n&&r.call(x,a)&&(w=x);var k=g.prototype=m.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==T(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function S(t,n,r){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var c=P(u,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var s=f(t,n,r);if("normal"===s.type){if(o=r.done?y:d,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=y,r.method="throw",r.arg=s.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function K(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(T(t)+" is not iterable")}return b.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=s(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},E(O.prototype),s(O.prototype,u,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new O(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(k),s(k,c,"Generator"),s(k,a,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,K.prototype={constructor:K,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function I(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function B(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){I(i,r,o,a,u,"next",e)}function u(e){I(i,r,o,a,u,"throw",e)}a(void 0)}))}}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,q(r.key),r)}}function q(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=T(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}const R=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.openChat=document.querySelector(".docuChatRevealChat"),this.chatBox=document.querySelector(".docuchatMain"),this.closeChat=document.querySelector(".docuchatMain_main_header_actions_wrapper_minimize"),this.clearChatAndHistory=document.querySelector(".docuchatMain_main_header_actions_wrapper_close"),this.date=new Date,this.date.setTime(this.date.getTime()+6048e5),this.expiresOnSevenDays="; expires="+this.date.toUTCString(),this.expireInmediately="; expires=Thu, 01 Jan 1970 00:00:00 UTC",this.init()},(t=[{key:"init",value:function(){var e=this;this.openChat.addEventListener("click",(function(){document.cookie="docuchat_chatStatus=active"+e.expiresOnSevenDays+"; path=/",e.openChat.classList.remove("active"),e.chatBox.classList.add("active")})),this.closeChat.addEventListener("click",(function(){return e.hiddeBoxAndShowButton()})),this.clearChatAndHistory.addEventListener("click",B(A().mark((function t(){var n,r;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(new s).db,t.next=3,n.table("chat").count();case 3:r=t.sent,document.cookie.split(";").filter((function(e){return e.trim().includes("docuchat_chatStatus")})).length>0&&r>0&&confirm(" ⌛️ Are you sure you want to clear the chat history?")&&(new s).db.delete().then((function(){console.log("Database successfully deleted"),document.cookie="docuchat_chatStatus=hidden"+e.expireInmediately+"; path=/",e.hiddeBoxAndShowButton(),window.location.reload()}));case 7:case"end":return t.stop()}}),t)}))))}},{key:"hiddeBoxAndShowButton",value:function(){document.cookie="docuchat_chatStatus=hidden"+this.expireInmediately+"; path=/",this.openChat.classList.add("active"),this.chatBox.classList.remove("active")}}])&&D(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();window.addEventListener("load",(function(){window.RevealIconChat=new g,window.InitialInteraction=new y,window.HummanInteraction=new S,window.ShowAndHideChatStatus=new K,window.ChatShowAndHiddeAction=new R}))})()})();
  • docu-chat/trunk/utils/docuchat_script_styles_files.php

    r3259221 r3273925  
    44
    55function docuchat_script_styles_files() {
    6     $token = get_option( DOCUCHAT_TOKEN ) ?  get_option( DOCUCHAT_TOKEN ) : false;
     6    $token = get_option( DOCUCHAT_TOKEN ) ?  get_option( DOCUCHAT_TOKEN ) : false; 
    77    $email = get_option( DOCUCHAT_EMAIL ) ?  get_option( DOCUCHAT_EMAIL ) : false;
     8
    89    wp_enqueue_media();
    910    wp_enqueue_style( "docuchat_styles_for_backend", plugins_url( "../src/styles/docuchat_backend.css", __FILE__ ), array(), "1.0.0" );
    1011    wp_enqueue_script( "docuchat_script_for_backend", plugins_url( "../src/docuchat_backend.js", __FILE__ ), array(), "1.0.0", true ); 
    1112     
    12     wp_localize_script( "docuchat_script_for_backend", "ajax", array(
     13    wp_localize_script( "docuchat_script_for_backend", "docuchat_ajax", array(
    1314      "url"                           => admin_url( "admin-ajax.php" ),
    14       "adminUrl"                      => admin_url('options-general.php?page=DocuChat'),
    15       "partialDelete_nonce"           => wp_create_nonce( "partialDelete" ),
    16       "activate_nonce"                => wp_create_nonce( "activate" ),
    17       "register_nonce"                => wp_create_nonce( "register" ),
    18       "uploadFile_nonce"              => wp_create_nonce( "uploadFile" ),
    19       "document_nonce"                => wp_create_nonce( "document" ),
    20       "token"                         =>  $token,
    21       "emailRegistred"                =>  $email
     15      "adminUrl"                      => admin_url('options-general.php?page=DocuChat'), 
     16      "partialDelete_nonce"           => wp_create_nonce("partialDelete"),
     17      "emailRegistred"                =>  $email,
     18      "token"                         =>  $token,
    2219    ));
    2320  }
     
    2825    wp_enqueue_style( "docuchat_styles_for_frontend", plugins_url( "../src/styles/docuchat_front.css", __FILE__ ), array(), "1.0.0" );
    2926    wp_enqueue_script( "docuchat_script_for_frontend", plugins_url( "../src/docuchat_front.js", __FILE__ ), array(), "1.0.0", true );
    30     wp_localize_script( "docuchat_script_for_frontend", "ajax", array(
     27    wp_localize_script( "docuchat_script_for_frontend", "docuchat_ajax", array(
    3128      "token"           =>  $token,
    3229      "url"             => admin_url( "admin-ajax.php" ),
  • docu-chat/trunk/utils/function.php

    r3259221 r3273925  
    6868if(function_exists('docuchat_script_styles_files')){
    6969add_action('admin_enqueue_scripts', 'docuchat_script_styles_files');
     70add_action('wp_enqueue_scripts', 'docuchat_script_styles_files_front');
     71
    7072}
    7173
    7274# this for add css and js for the front
    73 if(function_exists('docuchat_script_styles_files_front')){
    74 add_action('wp_enqueue_scripts', 'docuchat_script_styles_files_front');
    75 }
     75// if(function_exists('docuchat_script_styles_files_front')){
     76// add_action('wp_enqueue_scripts', 'docuchat_script_styles_files_front');
     77// }
    7678
    7779# add this action when activate the plg
Note: See TracChangeset for help on using the changeset viewer.