Plugin Directory

Changeset 3333380


Ignore:
Timestamp:
07/24/2025 08:44:15 AM (8 months ago)
Author:
webcomtlc
Message:

Changed protocol from Server Side Events to Websocket

Location:
webcom-operator-status/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • webcom-operator-status/trunk/build/block.json

    r3328858 r3333380  
    33  "apiVersion": 3,
    44  "name": "create-block/webcom-plugin",
    5   "version": "0.6.2",
     5  "version": "0.7.0",
    66  "title": "Webcom Stato Operatori",
    77  "category": "widgets",
  • webcom-operator-status/trunk/build/frontend.asset.php

    r3328858 r3333380  
    1 <?php return array('dependencies' => array('react', 'wp-element'), 'version' => '383d11184b3ee6478149');
     1<?php return array('dependencies' => array('react', 'react-dom', 'wp-element'), 'version' => '844149bab3ce135adee9');
  • webcom-operator-status/trunk/build/frontend.js

    r3328858 r3333380  
    1 (()=>{var e={790:(e,t,n)=>{e.exports=function e(t,n,r){function o(i,c){if(!n[i]){if(!t[i]){if(a)return a(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var s=n[i]={exports:{}};t[i][0].call(s.exports,(function(e){return o(t[i][1][e]||e)}),s,s.exports,e,t,n,r)}return n[i].exports}for(var a=void 0,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,r){(function(e){"use strict";var n,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var a=0,i=new o(f),c=e.document.createTextNode("");i.observe(c,{characterData:!0}),n=function(){c.data=a=++a%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};else{var u=new e.MessageChannel;u.port1.onmessage=f,n=function(){u.port2.postMessage(0)}}var s=[];function f(){var e,t;r=!0;for(var n=s.length;n;){for(t=s,s=[],e=-1;++e<n;)t[e]();n=s.length}r=!1}t.exports=function(e){1!==s.push(e)||r||n()}}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var r=e(1);function o(){}var a={},i=["REJECTED"],c=["FULFILLED"],u=["PENDING"];function s(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,e!==o&&h(this,e)}function f(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return a.reject(e,t)}r===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,r)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var n=!1;function r(t){n||(n=!0,a.reject(e,t))}function o(t){n||(n=!0,a.resolve(e,t))}var i=v((function(){t(o,r)}));"error"===i.status&&r(i.value)}function v(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=s,s.prototype.catch=function(e){return this.then(null,e)},s.prototype.then=function(e,t){if("function"!=typeof e&&this.state===c||"function"!=typeof t&&this.state===i)return this;var n=new this.constructor(o);return this.state!==u?l(n,this.state===c?e:t,this.outcome):this.queue.push(new f(n,e,t)),n},f.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){a.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},a.resolve=function(e,t){var n=v(d,t);if("error"===n.status)return a.reject(e,n.value);var r=n.value;if(r)h(e,r);else{e.state=c,e.outcome=t;for(var o=-1,i=e.queue.length;++o<i;)e.queue[o].callFulfilled(t)}return e},a.reject=function(e,t){e.state=i,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},s.resolve=function(e){return e instanceof this?e:a.resolve(new this(o),e)},s.reject=function(e){var t=new this(o);return a.reject(t,e)},s.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var i=new Array(n),c=0,u=-1,s=new this(o);++u<n;)f(e[u],u);return s;function f(e,o){t.resolve(e).then((function(e){i[o]=e,++c!==n||r||(r=!0,a.resolve(s,i))}),(function(e){r||(r=!0,a.reject(s,e))}))}},s.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n,r=e.length,i=!1;if(!r)return this.resolve([]);for(var c=-1,u=new this(o);++c<r;)n=e[c],t.resolve(n).then((function(e){i||(i=!0,a.resolve(u,e))}),(function(e){i||(i=!0,a.reject(u,e))}));return u}},{1:1}],3:[function(e,t,r){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var r="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};var o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function a(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var i=Promise;function c(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function s(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,h={},v=Object.prototype.toString,m="readonly",p="readwrite";function g(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}function b(e){return"boolean"==typeof d?i.resolve(d):function(e){return new i((function(t){var n=e.transaction(l,p),r=a([""]);n.objectStore(l).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return d=e}))}function y(e){var t=h[e.name],n={};n.promise=new i((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function w(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function I(e,t){var n=h[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function _(e,t){return new i((function(n,r){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);y(e),e.db.close()}var a=[e.name];t&&a.push(e.version);var i=o.open.apply(o,a);t&&(i.onupgradeneeded=function(t){var n=i.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(l)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),i.onerror=function(e){e.preventDefault(),r(i.error)},i.onsuccess=function(){var t=i.result;t.onversionchange=function(e){e.target.close()},n(t),w(e)}}))}function S(e){return _(e,!1)}function E(e){return _(e,!0)}function N(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,o=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||n){if(n){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function O(e){return a([g(atob(e.data))],{type:e.type})}function R(e){return e&&e.__local_forage_encoded_blob}function j(e){var t=this,n=t._initReady().then((function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(n,e,e),n}function A(e,t,n,r){void 0===r&&(r=1);try{var o=e.db.transaction(e.storeName,t);n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return i.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),E(e)})).then((function(){return function(e){y(e);for(var t=h[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,S(e).then((function(t){return e.db=t,N(e)?E(e):t})).then((function(r){e.db=t.db=r;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r})).catch((function(t){throw I(e,t),t}))}(e).then((function(){A(e,t,n,r-1)}))})).catch(n);n(o)}}var L={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=h[n.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},h[n.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=j);var a=[];function c(){return i.resolve()}for(var u=0;u<o.forages.length;u++){var s=o.forages[u];s!==t&&a.push(s._initReady().catch(c))}var f=o.forages.slice(0);return i.all(a).then((function(){return n.db=o.db,S(n)})).then((function(e){return n.db=e,N(n,t._defaultConfig.version)?E(n):e})).then((function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<f.length;r++){var a=f[r];a!==t&&(a._dbInfo.db=n.db,a._dbInfo.version=n.version)}}))},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new i((function(t,r){n.ready().then((function(){A(n._dbInfo,m,(function(o,a){if(o)return r(o);try{var i=a.objectStore(n._dbInfo.storeName).openCursor(),c=1;i.onsuccess=function(){var n=i.result;if(n){var r=n.value;R(r)&&(r=O(r));var o=e(r,n.key,c++);void 0!==o?t(o):n.continue()}else t()},i.onerror=function(){r(i.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},getItem:function(e,t){var n=this;e=s(e);var r=new i((function(t,r){n.ready().then((function(){A(n._dbInfo,m,(function(o,a){if(o)return r(o);try{var i=a.objectStore(n._dbInfo.storeName).get(e);i.onsuccess=function(){var e=i.result;void 0===e&&(e=null),R(e)&&(e=O(e)),t(e)},i.onerror=function(){r(i.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},setItem:function(e,t,n){var r=this;e=s(e);var o=new i((function(n,o){var a;r.ready().then((function(){return a=r._dbInfo,"[object Blob]"===v.call(t)?b(a.db).then((function(e){return e?t:(n=t,new i((function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):t})).then((function(t){A(r._dbInfo,p,(function(a,i){if(a)return o(a);try{var c=i.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var u=c.put(t,e);i.oncomplete=function(){void 0===t&&(t=null),n(t)},i.onabort=i.onerror=function(){var e=u.error?u.error:u.transaction.error;o(e)}}catch(e){o(e)}}))})).catch(o)}));return c(o,n),o},removeItem:function(e,t){var n=this;e=s(e);var r=new i((function(t,r){n.ready().then((function(){A(n._dbInfo,p,(function(o,a){if(o)return r(o);try{var i=a.objectStore(n._dbInfo.storeName).delete(e);a.oncomplete=function(){t()},a.onerror=function(){r(i.error)},a.onabort=function(){var e=i.error?i.error:i.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},clear:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){A(t._dbInfo,p,(function(r,o){if(r)return n(r);try{var a=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){var e=a.error?a.error:a.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return c(n,e),n},length:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){A(t._dbInfo,m,(function(r,o){if(r)return n(r);try{var a=o.objectStore(t._dbInfo.storeName).count();a.onsuccess=function(){e(a.result)},a.onerror=function(){n(a.error)}}catch(e){n(e)}}))})).catch(n)}));return c(n,e),n},key:function(e,t){var n=this,r=new i((function(t,r){e<0?t(null):n.ready().then((function(){A(n._dbInfo,m,(function(o,a){if(o)return r(o);try{var i=a.objectStore(n._dbInfo.storeName),c=!1,u=i.openKeyCursor();u.onsuccess=function(){var n=u.result;n?0===e||c?t(n.key):(c=!0,n.advance(e)):t(null)},u.onerror=function(){r(u.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},keys:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){A(t._dbInfo,m,(function(r,o){if(r)return n(r);try{var a=o.objectStore(t._dbInfo.storeName).openKeyCursor(),i=[];a.onsuccess=function(){var t=a.result;t?(i.push(t.key),t.continue()):e(i)},a.onerror=function(){n(a.error)}}catch(e){n(e)}}))})).catch(n)}));return c(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments);var n,r=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName),e.name){var a=e.name===r.name&&this._dbInfo.db?i.resolve(this._dbInfo.db):S(e).then((function(t){var n=h[e.name],r=n.forages;n.db=t;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t;return t}));n=e.storeName?a.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;y(e);var r=h[e.name],a=r.forages;t.close();for(var c=0;c<a.length;c++){var u=a[c];u._dbInfo.db=null,u._dbInfo.version=n}var s=new i((function(t,r){var a=o.open(e.name,n);a.onerror=function(e){a.result.close(),r(e)},a.onupgradeneeded=function(){a.result.deleteObjectStore(e.storeName)},a.onsuccess=function(){var e=a.result;e.close(),t(e)}}));return s.then((function(e){r.db=e;for(var t=0;t<a.length;t++){var n=a[t];n._dbInfo.db=e,w(n._dbInfo)}})).catch((function(t){throw(I(e,t)||i.resolve()).catch((function(){})),t}))}})):a.then((function(t){y(e);var n=h[e.name],r=n.forages;t.close();for(var a=0;a<r.length;a++)r[a]._dbInfo.db=null;var c=new i((function(t,n){var r=o.deleteDatabase(e.name);r.onerror=function(){var e=r.result;e&&e.close(),n(r.error)},r.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}}));return c.then((function(e){n.db=e;for(var t=0;t<r.length;t++)w(r[t]._dbInfo)})).catch((function(t){throw(I(e,t)||i.resolve()).catch((function(){})),t}))}))}else n=i.reject("Invalid arguments");return c(n,t),n}};var C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",k="arbf",B="blob",T="si08",U="ui08",P="uic8",F="si16",M="si32",z="ur16",W="ui32",q="fl32",$="fl64",J=Object.prototype.toString;function K(e){var t,n,r,o,a,i=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);var s=new ArrayBuffer(i),f=new Uint8Array(s);for(t=0;t<c;t+=4)n=C.indexOf(e[t]),r=C.indexOf(e[t+1]),o=C.indexOf(e[t+2]),a=C.indexOf(e[t+3]),f[u++]=n<<2|r>>4,f[u++]=(15&r)<<4|o>>2,f[u++]=(3&o)<<6|63&a;return s}function H(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=C[n[t]>>2],r+=C[(3&n[t])<<4|n[t+1]>>4],r+=C[(15&n[t+1])<<2|n[t+2]>>6],r+=C[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var Q={serialize:function(e,t){var n="";if(e&&(n=J.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===J.call(e.buffer))){var r,o=D;e instanceof ArrayBuffer?(r=e,o+=k):(r=e.buffer,"[object Int8Array]"===n?o+=T:"[object Uint8Array]"===n?o+=U:"[object Uint8ClampedArray]"===n?o+=P:"[object Int16Array]"===n?o+=F:"[object Uint16Array]"===n?o+=z:"[object Int32Array]"===n?o+=M:"[object Uint32Array]"===n?o+=W:"[object Float32Array]"===n?o+=q:"[object Float64Array]"===n?o+=$:t(new Error("Failed to get type for BinaryArray"))),t(o+H(r))}else if("[object Blob]"===n){var a=new FileReader;a.onload=function(){var n="~~local_forage_type~"+e.type+"~"+H(this.result);t(D+B+n)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,9)!==D)return JSON.parse(e);var t,n=e.substring(13),r=e.substring(9,13);if(r===B&&x.test(n)){var o=n.match(x);t=o[1],n=n.substring(o[0].length)}var i=K(n);switch(r){case k:return i;case B:return a([i],{type:t});case T:return new Int8Array(i);case U:return new Uint8Array(i);case P:return new Uint8ClampedArray(i);case F:return new Int16Array(i);case z:return new Uint16Array(i);case M:return new Int32Array(i);case W:return new Uint32Array(i);case q:return new Float32Array(i);case $:return new Float64Array(i);default:throw new Error("Unkown type: "+r)}},stringToBuffer:K,bufferToString:H};function G(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function X(e,t,n,r,o,a){e.executeSql(n,r,o,(function(e,i){i.code===i.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,c){c.rows.length?a(e,i):G(e,t,(function(){e.executeSql(n,r,o,a)}),a)}),a):a(e,i)}),a)}function V(e,t,n,r){var o=this;e=s(e);var a=new i((function(a,i){o.ready().then((function(){void 0===t&&(t=null);var c=t,u=o._dbInfo;u.serializer.serialize(t,(function(t,s){s?i(s):u.db.transaction((function(n){X(n,u,"INSERT OR REPLACE INTO "+u.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){a(c)}),(function(e,t){i(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void a(V.apply(o,[e,c,n,r-1]));i(t)}}))}))})).catch(i)}));return c(a,n),a}var Y={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new i((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(o){G(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=Q,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new i((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){X(n,o,"SELECT * FROM "+o.storeName,[],(function(n,r){for(var a=r.rows,i=a.length,c=0;c<i;c++){var u=a.item(c),s=u.value;if(s&&(s=o.serializer.deserialize(s)),void 0!==(s=e(s,u.key,c+1)))return void t(s)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},getItem:function(e,t){var n=this;e=s(e);var r=new i((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){X(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},setItem:function(e,t,n){return V.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=s(e);var r=new i((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){X(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},clear:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){X(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,e),n},length:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){X(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,e),n},key:function(e,t){var n=this,r=new i((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){X(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},keys:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){X(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,o=this;return c(r=e.name?new i((function(t){var r;r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(function(e){return new i((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var o=[],a=0;a<r.rows.length;a++)o.push(r.rows.item(a).name);t({db:e,storeNames:o})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}(r))})).then((function(e){return new i((function(t,n){e.db.transaction((function(r){function o(e){return new i((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var a=[],c=0,u=e.storeNames.length;c<u;c++)a.push(o(e.storeNames[c]));i.all(a).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):i.reject("Invalid arguments"),t),r}};function Z(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ee(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0}var te={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=Z(e,this._defaultConfig),ee()?(this._dbInfo=t,t.serializer=Q,i.resolve()):i.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,a=localStorage.length,i=1,c=0;c<a;c++){var u=localStorage.key(c);if(0===u.indexOf(r)){var s=localStorage.getItem(u);if(s&&(s=t.serializer.deserialize(s)),void 0!==(s=e(s,u.substring(o),i++)))return s}}}));return c(r,t),r},getItem:function(e,t){var n=this;e=s(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return c(r,t),r},setItem:function(e,t,n){var r=this;e=s(e);var o=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new i((function(o,a){var i=r._dbInfo;i.serializer.serialize(t,(function(t,r){if(r)a(r);else try{localStorage.setItem(i.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||a(e),a(e)}}))}))}));return c(o,n),o},removeItem:function(e,t){var n=this;e=s(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return c(r,t),r},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return c(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return c(t,e),t},key:function(e,t){var n=this,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return c(r,t),r},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var a=localStorage.key(o);0===a.indexOf(e.keyPrefix)&&r.push(a.substring(e.keyPrefix.length))}return r}));return c(n,e),n},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,o=this;return r=e.name?new i((function(t){e.storeName?t(Z(e,o._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):i.reject("Invalid arguments"),c(r,t),r}},ne=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(a=t)||"number"==typeof o&&"number"==typeof a&&isNaN(o)&&isNaN(a))return!0;r++}var o,a;return!1},re=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},oe={},ae={},ie={INDEXEDDB:L,WEBSQL:Y,LOCALSTORAGE:te},ce=[ie.INDEXEDDB._driver,ie.WEBSQL._driver,ie.LOCALSTORAGE._driver],ue=["dropInstance"],se=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ue),fe={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function le(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function de(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(re(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var he=function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ie)if(ie.hasOwnProperty(n)){var r=ie[n],o=r._driver;this[n]=o,oe[o]||this.defineDriver(r)}this._defaultConfig=de({},fe),this._config=de({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new i((function(t,n){try{var r=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(o);for(var a=se.concat("_initStorage"),u=0,s=a.length;u<s;u++){var f=a[u];if((!ne(ue,f)||e[f])&&"function"!=typeof e[f])return void n(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=i.reject(t);return c(n,arguments[arguments.length-1]),n}},n=0,r=ue.length;n<r;n++){var o=ue[n];e[o]||(e[o]=t(o))}}();var l=function(n){oe[r]&&console.info("Redefining LocalForage driver: "+r),oe[r]=e,ae[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,n):l(!!e._support):l(!0)}catch(e){n(e)}}));return u(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=oe[e]?i.resolve(oe[e]):i.reject(new Error("Driver not found."));return u(r,t,n),r},e.prototype.getSerializer=function(e){var t=i.resolve(Q);return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;re(e)||(e=[e]);var o=this._getSupportedDrivers(e);function a(){r._config.driver=r.driver()}function c(e){return r._extend(e),a(),r._ready=r._initStorage(r._config),r._ready}var s=null!==this._driverSet?this._driverSet.catch((function(){return i.resolve()})):i.resolve();return this._driverSet=s.then((function(){var e=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,a(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var o=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(c).catch(n)}a();var u=new Error("No available storage method found.");return r._driverSet=i.reject(u),r._driverSet}()}}(o)}))})).catch((function(){a();var e=new Error("No available storage method found.");return r._driverSet=i.reject(e),r._driverSet})),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=se.length;e<t;e++)le(this,se[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),ve=new he;t.exports=ve},{3:3}]},{},[4])(4)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{"use strict";const e=window.React,t=window.wp.element;var r=n(790);const o=n.n(r)().createInstance({name:"webcom-operator-status"}),a=e=>new Promise((t=>setTimeout(t,e))),i=async(e,t=1e3,n=8,r=2)=>{let o=0;for(;o<n;)try{return await e()}catch(e){await a(t+o*r)}finally{o++}throw new Error("Retries were exhausted!")},c=new TextDecoder("utf-8"),u=/retry:\s([0-9]{1,})/,s=/data:\s(.*)/,f=/event:\s(.*)/,l=e=>{if(e){const t=parseInt(e);if(!isNaN(t))return t}},d=e=>{if(e)return e},h=e=>{if(!e)return[];const t=c.decode(e).split("\n").filter((e=>e.trim())),n=[];for(const e of t){const t=e.trim();if(t){const e={data:d(t.match(s)?.at(1)?.trim()),event:d(t.match(f)?.at(1)?.trim()),retry:l(t.match(u)?.at(1)?.trim())};(e.data||e.event||e.retry)&&n.push(e)}}return n};let v=function(e){return e.Login="Login",e.Logout="Logout",e.OnCall="OnCall",e.Pause="Pause",e.Ringing="Ringing",e.Unreachable="Unreachable",e}({});const m=e=>{switch(e){case v.Login:return"online";case v.Pause:return"pause";case v.OnCall:case v.Ringing:return"calling";case v.Logout:case v.Unreachable:return"offline"}},p=({name:n,status:r,cardCustomization:o})=>{const a=(0,t.useMemo)((()=>m(r)),[r]),i=(0,t.useMemo)((()=>{switch(r){case v.Login:{const t=o.onlineImage;return(0,e.createElement)("img",{className:`operator-card-image online-image ${a}`,src:t})}case v.Pause:{const t=o.pauseImage;return(0,e.createElement)("img",{className:`operator-card-image pause-image ${a}`,src:t})}case v.OnCall:case v.Ringing:{const t=o.callingImage;return(0,e.createElement)("img",{className:`operator-card-image calling-image ${a}`,src:t})}case v.Logout:case v.Unreachable:{const t=o.offlineImage;return(0,e.createElement)("img",{className:`operator-card-image offline-image ${a}`,src:t})}}}),[r,o,a]),c=(0,t.useMemo)((()=>{switch(r){case v.Login:return"Online";case v.Pause:return"In pausa";case v.OnCall:case v.Ringing:return"In chiamata";case v.Logout:case v.Unreachable:return"Offline"}}),[r]);return(0,e.createElement)("div",{className:`operator-card ${a}`},i,(0,e.createElement)("div",{className:"operator-card-content"},o.withName?(0,e.createElement)("div",{className:"operator-card-name"},n):(0,e.createElement)(e.Fragment,null),o.withStatus?(0,e.createElement)("div",{className:"operator-card-status"},c):(0,e.createElement)(e.Fragment,null)))},g=()=>{const[e,n]=(0,t.useState)();return(0,t.useEffect)((()=>{Promise.all([o.getItem("withLogin"),o.getItem("withLogout"),o.getItem("withUnreachable"),o.getItem("groupName"),o.getItem("sort"),o.getItem("statusOrder"),o.getItem("filterOperatorWithoutAlias"),o.getItem("enableWhitelist"),o.getItem("whitelist")]).then((([e,t,r,o,a,i,c,u,s])=>n({withLogin:null==e||e,withLogout:null==t||t,withUnreachable:null==r||r,groupName:o||void 0,sort:a||void 0,statusOrder:null!=i?i:[],filterOperatorWithoutAlias:null!=c&&c,enableWhitelist:null!=u&&u,whitelist:null!=s?s:[]})))}),[]),e},b=n.p+"images/LIBERO.805064eb.png",y=n.p+"images/PAUSA.10c5965f.png",w=n.p+"images/LOGOUT.99a185f5.png",I=n.p+"images/OCCUPATO.c63d5b41.png",_=new URL("https://racoon.webcom-tlc.it/"),S=()=>{const n=(0,t.useRef)(),r=(0,t.useRef)(),[a,c]=(0,t.useState)({}),u=g(),s=(()=>{const[t,n]=(0,e.useState)({onlineImage:b,pauseImage:y,callingImage:I,offlineImage:w,withName:!0,withStatus:!1});return(0,e.useEffect)((()=>{Promise.all([o.getItem("onlineImage"),o.getItem("pauseImage"),o.getItem("callingImage"),o.getItem("offlineImage"),o.getItem("withName"),o.getItem("withStatus")]).then((([e,t,r,o,a,i])=>n({onlineImage:e||b,pauseImage:t||y,callingImage:r||I,offlineImage:o||w,withName:null==a||a,withStatus:null!=i&&i})))}),[]),t})(),f=(()=>{const e=g();return(0,t.useCallback)((t=>{if(!e)return!1;const{withLogin:n,withLogout:r,withUnreachable:o,filterOperatorWithoutAlias:a,groupName:i}=e,c=(({withLogin:e,withLogout:t,withUnreachable:n})=>{const r=[];return e&&r.push("Login","Pause","Ringing","OnCall"),t&&r.push("Logout"),n&&r.push("Unreachable"),r})({withLogin:n,withLogout:r,withUnreachable:o}),u=[];return u.push((()=>c.includes(t.status))),i&&u.push((()=>t.group?.toLocaleLowerCase()===i?.toLocaleLowerCase())),a&&u.push((()=>!!t.name)),u.every((e=>e()))}),[e])})(),l=(0,t.useCallback)((async()=>{if(!u)return;n.current=new AbortController;const e=new URL(_);e.pathname="/api/operators/event-stream";const t=new URLSearchParams({withLogin:u.withLogin.toString(),withLogout:u.withLogout.toString(),withUnreachable:u.withUnreachable.toString(),withAlias:u.filterOperatorWithoutAlias.toString(),withMultilineData:"true"});u.groupName&&t.set("groupName",u.groupName),u.enableWhitelist&&t.set("whitelist",u.whitelist.join(",")),e.search=t.toString();const r={},a=await o.getItem("accessToken");a&&(r.Authorization=`Bearer ${a}`),await(async()=>i((async()=>{for await(const{id:t,...o}of async function*(e,t,n){const r=await i((()=>fetch(e,n)));if(!r.body)throw new Error("Invalid endpoint!");const o=r.body.getReader();let a=!1;do{const e=await o.read();a=e.done;const n=h(e.value);for(const{data:e,event:r}of n)if(e&&(yield t(e)),"error"===r?.toLowerCase())throw console.error("Received error event",e),new Error(null!=e?e:"Unknown error")}while(!1===a)}(e,JSON.parse,{headers:r,signal:n.current?.signal}))c((e=>{const n={...e};return n[t]={id:t,...o},n}))})))()}),[u]);return(0,t.useEffect)((()=>(l(),()=>{n.current?.abort(),r.current&&clearInterval(r.current)})),[l]),(0,e.createElement)("div",{className:"operators-wrapper"},Object.values(a).sort(((e,t)=>"name-asc"===u?.sort?e.name?t.name?e.name.localeCompare(t.name):-1:1:"phone-number-asc"===u?.sort?e.line.localeCompare(t.line):"random"===u?.sort?2*Math.random()-1:"status"===u?.sort?u.statusOrder.findIndex((t=>m(e.status)===t))-u.statusOrder.findIndex((e=>m(t.status)===e)):0)).filter(f).map((t=>{var n;return(0,e.createElement)(p,{key:`operator-${t.id}`,cardCustomization:s,status:t.status,name:null!==(n=t.name)&&void 0!==n?n:void 0})})))},E=()=>(0,e.createElement)(S,null),N=async(e,t,n,r=e=>e)=>{const a=r(e.getAttribute(t));return await o.setItem(n,a),e.removeAttribute(t),a};window.addEventListener("load",(async()=>{const n=document.getElementById("webcom-plugin-entrypoint");await Promise.all([N(n,"data-api-token","accessToken"),N(n,"data-online-image","onlineImage"),N(n,"data-pause-image","pauseImage"),N(n,"data-calling-image","callingImage"),N(n,"data-offline-image","offlineImage"),N(n,"data-whitelist","whitelist",JSON.parse),N(n,"data-enable-whitelist","enableWhitelist",(e=>"1"===e)),N(n,"data-with-login","withLogin",(e=>"1"===e)),N(n,"data-with-logout","withLogout",(e=>"1"===e)),N(n,"data-with-unreachable","withUnreachable",(e=>"1"===e)),N(n,"data-group-name","groupName"),N(n,"data-hide-operator-no-alias","filterOperatorWithoutAlias",(e=>"1"===e)),N(n,"data-sort","sort"),N(n,"data-status-order","statusOrder",JSON.parse),N(n,"data-with-name","withName",(e=>"1"===e)),N(n,"data-with-status","withStatus",(e=>"1"===e))]),console.log("Initialized webcom-operator-status wordpress plugin version: 0.6.2"),(0,t.createRoot)(n).render((0,e.createElement)(E,null))}))})()})();
     1(()=>{var e={1:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsWebSocket=function(e,t){if(!t&&e instanceof WebSocket==0)throw new Error("")},t.resetGlobalState=function(e){(0,o.resetSubscribers)(e),(0,r.resetWebSockets)(e)};var r=n(389),o=n(984)},49:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.attachListeners=void 0;var o=n(789),a=n(889),i=n(800),c=n(1);t.attachListeners=function(e,t,n,u,s,f,l){var d,v,h,p=t.setLastMessage,b=t.setReadyState;return n.current.fromSocketIO&&(d=(0,o.setUpSocketIOPing)(l)),function(e,t,n,r){e.onmessage=function(e){var o;t.current.onMessage&&t.current.onMessage(e),"number"==typeof(null==r?void 0:r.current)&&(r.current=Date.now()),"function"==typeof t.current.filter&&!0!==t.current.filter(e)||t.current.heartbeat&&"boolean"!=typeof t.current.heartbeat&&(null===(o=t.current.heartbeat)||void 0===o?void 0:o.returnMessage)===e.data||n(e)}}(e,n,p,f),function(e,t,n,r,o){e.onopen=function(c){if(t.current.onOpen&&t.current.onOpen(c),r.current=0,n(i.ReadyState.OPEN),t.current.heartbeat&&e instanceof WebSocket){var u="boolean"==typeof t.current.heartbeat?void 0:t.current.heartbeat;o.current=Date.now(),(0,a.heartbeat)(e,o,u)}}}(e,n,b,s,f),v=function(e,t,n,r,o){return i.isEventSourceSupported&&e instanceof EventSource?function(){}:((0,c.assertIsWebSocket)(e,t.current.skipAssert),e.onclose=function(e){var c;if(t.current.onClose&&t.current.onClose(e),n(i.ReadyState.CLOSED),t.current.shouldReconnect&&t.current.shouldReconnect(e)){var u=null!==(c=t.current.reconnectAttempts)&&void 0!==c?c:i.DEFAULT_RECONNECT_LIMIT;if(o.current<u){var s="function"==typeof t.current.reconnectInterval?t.current.reconnectInterval(o.current):t.current.reconnectInterval;a=window.setTimeout((function(){o.current++,r()}),null!=s?s:i.DEFAULT_RECONNECT_INTERVAL_MS)}else t.current.onReconnectStop&&t.current.onReconnectStop(u),console.warn("Max reconnect attempts of ".concat(u," exceeded"))}},function(){return a&&window.clearTimeout(a)});var a}(e,n,b,u,s),h=function(e,t,n,o,a){var c;return e.onerror=function(u){var s;if(t.current.onError&&t.current.onError(u),i.isEventSourceSupported&&e instanceof EventSource&&(t.current.onClose&&t.current.onClose(r(r({},u),{code:1006,reason:"An error occurred with the EventSource: ".concat(u),wasClean:!1})),n(i.ReadyState.CLOSED),e.close()),t.current.retryOnError)if(a.current<(null!==(s=t.current.reconnectAttempts)&&void 0!==s?s:i.DEFAULT_RECONNECT_LIMIT)){var f="function"==typeof t.current.reconnectInterval?t.current.reconnectInterval(a.current):t.current.reconnectInterval;c=window.setTimeout((function(){a.current++,o()}),null!=f?f:i.DEFAULT_RECONNECT_INTERVAL_MS)}else t.current.onReconnectStop&&t.current.onReconnectStop(t.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(t.current.reconnectAttempts," exceeded"))},function(){return c&&window.clearTimeout(c)}}(e,n,b,u,s),function(){b(i.ReadyState.CLOSING),v(),h(),e.close(),d&&clearInterval(d)}}},380:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function c(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}u((r=r.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.useWebSocket=void 0;var c=n(609),u=n(795),s=n(800),f=n(604),l=n(421),d=i(n(881)),v=n(1);t.useWebSocket=function(e,t,n){void 0===t&&(t=s.DEFAULT_OPTIONS),void 0===n&&(n=!0);var i=(0,c.useState)(null),h=i[0],p=i[1],b=(0,c.useState)({}),y=b[0],g=b[1],m=(0,c.useMemo)((function(){if(!t.disableJson&&h)try{return JSON.parse(h.data)}catch(e){return s.UNPARSABLE_JSON_OBJECT}return null}),[h,t.disableJson]),S=(0,c.useRef)(null),w=(0,c.useRef)(null),_=(0,c.useRef)((function(){})),E=(0,c.useRef)(0),I=(0,c.useRef)(Date.now()),O=(0,c.useRef)([]),N=(0,c.useRef)(null),R=(0,c.useRef)(t);R.current=t;var T=S.current&&void 0!==y[S.current]?y[S.current]:null!==e&&!0===n?s.ReadyState.CONNECTING:s.ReadyState.UNINSTANTIATED,A=t.queryParams?JSON.stringify(t.queryParams):null,C=(0,c.useCallback)((function(e,t){var n;void 0===t&&(t=!0),s.isEventSourceSupported&&w.current instanceof EventSource?console.warn("Unable to send a message from an eventSource"):(null===(n=w.current)||void 0===n?void 0:n.readyState)===s.ReadyState.OPEN?((0,v.assertIsWebSocket)(w.current,R.current.skipAssert),w.current.send(e)):t&&O.current.push(e)}),[]),L=(0,c.useCallback)((function(e,t){void 0===t&&(t=!0),C(JSON.stringify(e),t)}),[C]),k=(0,c.useCallback)((function(){return!0!==R.current.share||s.isEventSourceSupported&&w.current instanceof EventSource?w.current:(null===N.current&&w.current&&((0,v.assertIsWebSocket)(w.current,R.current.skipAssert),N.current=(0,d.default)(w.current,_)),N.current)}),[]);return(0,c.useEffect)((function(){if(null!==e&&!0===n){var t,i=!1,c=!0,d=function(){return o(void 0,void 0,void 0,(function(){var n,o,d;return a(this,(function(a){switch(a.label){case 0:return n=S,[4,(0,l.getUrl)(e,R)];case 1:return n.current=a.sent(),null===S.current?(console.error("Failed to get a valid URL. WebSocket connection aborted."),S.current="ABORTED",(0,u.flushSync)((function(){return g((function(e){return r(r({},e),{ABORTED:s.ReadyState.CLOSED})}))})),[2]):(o=function(e){i||(0,u.flushSync)((function(){return p(e)}))},d=function(e){i||(0,u.flushSync)((function(){return g((function(t){var n;return r(r({},t),S.current&&((n={})[S.current]=e,n))}))}))},c&&(t=(0,f.createOrJoinSocket)(w,S.current,d,R,o,_,E,I,C)),[2])}}))}))};return _.current=function(){i||(N.current&&(N.current=null),null==t||t(),d())},d(),function(){i=!0,c=!1,N.current&&(N.current=null),null==t||t(),p(null)}}null!==e&&!1!==n||(E.current=0,g((function(e){var t;return r(r({},e),S.current&&((t={})[S.current]=s.ReadyState.CLOSED,t))})))}),[e,n,A,C]),(0,c.useEffect)((function(){T===s.ReadyState.OPEN&&O.current.splice(0).forEach((function(e){C(e)}))}),[T]),{sendMessage:C,sendJsonMessage:L,lastMessage:h,lastJsonMessage:m,readyState:T,getWebSocket:k}}},389:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetWebSockets=t.sharedWebSockets=void 0,t.sharedWebSockets={},t.resetWebSockets=function(e){if(e&&t.sharedWebSockets.hasOwnProperty(e))delete t.sharedWebSockets[e];else for(var n in t.sharedWebSockets)t.sharedWebSockets.hasOwnProperty(n)&&delete t.sharedWebSockets[n]}},407:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.useSocketIO=void 0;var o=n(609),a=n(380),i=n(800),c={type:"empty",payload:null};t.useSocketIO=function(e,t,n){void 0===t&&(t=i.DEFAULT_OPTIONS),void 0===n&&(n=!0);var u=(0,o.useMemo)((function(){return r(r({},t),{fromSocketIO:!0})}),[]),s=(0,a.useWebSocket)(e,u,n),f=s.sendMessage,l=s.sendJsonMessage,d=s.lastMessage,v=s.readyState,h=s.getWebSocket,p=(0,o.useMemo)((function(){return function(e){if(!e||!e.data)return c;var t=e.data.match(/\[.*]/);if(!t)return c;var n=JSON.parse(t);return Array.isArray(n)&&n[1]?{type:n[0],payload:n[1]}:c}(d)}),[d]);return{sendMessage:f,sendJsonMessage:l,lastMessage:p,lastJsonMessage:p,readyState:v,getWebSocket:h}}},421:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function c(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}},a=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.getUrl=void 0;var i=n(789),c=n(800);t.getUrl=function(e,n){for(var u=[],s=2;s<arguments.length;s++)u[s-2]=arguments[s];return r(void 0,a([e,n],u,!0),void 0,(function(e,n,r){var a,u,s,f,l,d,v;return void 0===r&&(r=0),o(this,(function(o){switch(o.label){case 0:if("function"!=typeof e)return[3,10];o.label=1;case 1:return o.trys.push([1,3,,9]),[4,e()];case 2:return a=o.sent(),[3,9];case 3:return o.sent(),n.current.retryOnError?(u=null!==(l=n.current.reconnectAttempts)&&void 0!==l?l:c.DEFAULT_RECONNECT_LIMIT,r<u?(s="function"==typeof n.current.reconnectInterval?n.current.reconnectInterval(r):n.current.reconnectInterval,[4,(h=null!=s?s:c.DEFAULT_RECONNECT_INTERVAL_MS,new Promise((function(e){return window.setTimeout(e,h)})))]):[3,5]):[3,7];case 4:return o.sent(),[2,(0,t.getUrl)(e,n,r+1)];case 5:return null===(v=(d=n.current).onReconnectStop)||void 0===v||v.call(d,r),[2,null];case 6:return[3,8];case 7:return[2,null];case 8:return[3,9];case 9:return[3,11];case 10:a=e,o.label=11;case 11:return f=n.current.fromSocketIO?(0,i.parseSocketIOUrl)(a):a,[2,n.current.queryParams?(0,i.appendQueryParams)(f,n.current.queryParams):f]}var h}))}))}},604:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createOrJoinSocket=void 0;var r=n(389),o=n(800),a=n(49),i=n(784),c=n(984);t.createOrJoinSocket=function(e,t,n,u,s,f,l,d,v){if(!o.isEventSourceSupported&&u.current.eventSourceOptions)throw o.isReactNative?new Error("EventSource is not supported in ReactNative"):new Error("EventSource is not supported");if(u.current.share){var h=null;void 0===r.sharedWebSockets[t]?(r.sharedWebSockets[t]=u.current.eventSourceOptions?new EventSource(t,u.current.eventSourceOptions):new WebSocket(t,u.current.protocols),e.current=r.sharedWebSockets[t],n(o.ReadyState.CONNECTING),h=(0,i.attachSharedListeners)(r.sharedWebSockets[t],t,u,v)):(e.current=r.sharedWebSockets[t],n(r.sharedWebSockets[t].readyState));var p={setLastMessage:s,setReadyState:n,optionsRef:u,reconnectCount:l,lastMessageTime:d,reconnect:f};return(0,c.addSubscriber)(t,p),function(e,t,n,a,i){return function(){if((0,c.removeSubscriber)(e,t),!(0,c.hasSubscribers)(e)){try{var u=r.sharedWebSockets[e];u instanceof WebSocket&&(u.onclose=function(e){n.current.onClose&&n.current.onClose(e),a(o.ReadyState.CLOSED)}),u.close()}catch(e){}i&&i(),delete r.sharedWebSockets[e]}}}(t,p,u,n,h)}if(e.current=u.current.eventSourceOptions?new EventSource(t,u.current.eventSourceOptions):new WebSocket(t,u.current.protocols),n(o.ReadyState.CONNECTING),!e.current)throw new Error("WebSocket failed to be created");return(0,a.attachListeners)(e.current,{setLastMessage:s,setReadyState:n},u,f.current,l,d,v)}},609:e=>{"use strict";e.exports=window.React},784:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.attachSharedListeners=void 0;var o=n(389),a=n(800),i=n(984),c=n(789),u=n(889);t.attachSharedListeners=function(e,t,n,s){var f;return n.current.fromSocketIO&&(f=(0,c.setUpSocketIOPing)(s)),function(e,t,n){e.onmessage=function(e){(0,i.getSubscribers)(t).forEach((function(t){var r;t.optionsRef.current.onMessage&&t.optionsRef.current.onMessage(e),"number"==typeof(null===(r=null==t?void 0:t.lastMessageTime)||void 0===r?void 0:r.current)&&(t.lastMessageTime.current=Date.now()),"function"==typeof t.optionsRef.current.filter&&!0!==t.optionsRef.current.filter(e)||n&&"boolean"!=typeof n&&(null==n?void 0:n.returnMessage)===e.data||t.setLastMessage(e)}))}}(e,t,n.current.heartbeat),function(e,t){e instanceof WebSocket&&(e.onclose=function(e){(0,i.getSubscribers)(t).forEach((function(t){t.optionsRef.current.onClose&&t.optionsRef.current.onClose(e),t.setReadyState(a.ReadyState.CLOSED)})),delete o.sharedWebSockets[t],(0,i.getSubscribers)(t).forEach((function(t){var n;if(t.optionsRef.current.shouldReconnect&&t.optionsRef.current.shouldReconnect(e)){var r=null!==(n=t.optionsRef.current.reconnectAttempts)&&void 0!==n?n:a.DEFAULT_RECONNECT_LIMIT;if(t.reconnectCount.current<r){var o="function"==typeof t.optionsRef.current.reconnectInterval?t.optionsRef.current.reconnectInterval(t.reconnectCount.current):t.optionsRef.current.reconnectInterval;setTimeout((function(){t.reconnectCount.current++,t.reconnect.current()}),null!=o?o:a.DEFAULT_RECONNECT_INTERVAL_MS)}else t.optionsRef.current.onReconnectStop&&t.optionsRef.current.onReconnectStop(t.optionsRef.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(r," exceeded"))}}))})}(e,t),function(e,t,n){e.onopen=function(r){var o=(0,i.getSubscribers)(t);o.forEach((function(t){t.reconnectCount.current=0,t.optionsRef.current.onOpen&&t.optionsRef.current.onOpen(r),t.setReadyState(a.ReadyState.OPEN),n&&e instanceof WebSocket&&(t.lastMessageTime.current=Date.now())})),n&&e instanceof WebSocket&&(0,u.heartbeat)(e,o.map((function(e){return e.lastMessageTime})),"boolean"==typeof n?void 0:n)}}(e,t,n.current.heartbeat),function(e,t){e.onerror=function(n){(0,i.getSubscribers)(t).forEach((function(t){t.optionsRef.current.onError&&t.optionsRef.current.onError(n),a.isEventSourceSupported&&e instanceof EventSource&&(t.optionsRef.current.onClose&&t.optionsRef.current.onClose(r(r({},n),{code:1006,reason:"An error occurred with the EventSource: ".concat(n),wasClean:!1})),t.setReadyState(a.ReadyState.CLOSED))})),a.isEventSourceSupported&&e instanceof EventSource&&e.close()}}(e,t),function(){f&&clearInterval(f)}}},789:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setUpSocketIOPing=t.appendQueryParams=t.parseSocketIOUrl=void 0;var r=n(800);t.parseSocketIOUrl=function(e){if(e){var t=/^https|wss/.test(e),n=e.replace(/^(https?|wss?)(:\/\/)?/,"").replace(/\/$/,"");return"".concat(o=t?"wss":"ws","://").concat(n).concat(r.SOCKET_IO_PATH)}if(""===e){var o=(t=/^https/.test(window.location.protocol))?"wss":"ws",a=window.location.port?":".concat(window.location.port):"";return"".concat(o,"://").concat(window.location.hostname).concat(a).concat(r.SOCKET_IO_PATH)}return e},t.appendQueryParams=function(e,t){void 0===t&&(t={});var n=/\?([\w]+=[\w]+)/.test(e),r="".concat(Object.entries(t).reduce((function(e,t){var n=t[0],r=t[1];return e+"".concat(n,"=").concat(r,"&")}),"").slice(0,-1));return"".concat(e).concat(n?"&":"?").concat(r)},t.setUpSocketIOPing=function(e,t){return void 0===t&&(t=r.SOCKET_IO_PING_INTERVAL),window.setInterval((function(){return e(r.SOCKET_IO_PING_CODE)}),t)}},790:(e,t,n)=>{e.exports=function e(t,n,r){function o(i,c){if(!n[i]){if(!t[i]){if(a)return a(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var s=n[i]={exports:{}};t[i][0].call(s.exports,(function(e){return o(t[i][1][e]||e)}),s,s.exports,e,t,n,r)}return n[i].exports}for(var a=void 0,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,r){(function(e){"use strict";var n,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var a=0,i=new o(f),c=e.document.createTextNode("");i.observe(c,{characterData:!0}),n=function(){c.data=a=++a%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};else{var u=new e.MessageChannel;u.port1.onmessage=f,n=function(){u.port2.postMessage(0)}}var s=[];function f(){var e,t;r=!0;for(var n=s.length;n;){for(t=s,s=[],e=-1;++e<n;)t[e]();n=s.length}r=!1}t.exports=function(e){1!==s.push(e)||r||n()}}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var r=e(1);function o(){}var a={},i=["REJECTED"],c=["FULFILLED"],u=["PENDING"];function s(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,e!==o&&v(this,e)}function f(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return a.reject(e,t)}r===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,r)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function v(e,t){var n=!1;function r(t){n||(n=!0,a.reject(e,t))}function o(t){n||(n=!0,a.resolve(e,t))}var i=h((function(){t(o,r)}));"error"===i.status&&r(i.value)}function h(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=s,s.prototype.catch=function(e){return this.then(null,e)},s.prototype.then=function(e,t){if("function"!=typeof e&&this.state===c||"function"!=typeof t&&this.state===i)return this;var n=new this.constructor(o);return this.state!==u?l(n,this.state===c?e:t,this.outcome):this.queue.push(new f(n,e,t)),n},f.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){a.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},a.resolve=function(e,t){var n=h(d,t);if("error"===n.status)return a.reject(e,n.value);var r=n.value;if(r)v(e,r);else{e.state=c,e.outcome=t;for(var o=-1,i=e.queue.length;++o<i;)e.queue[o].callFulfilled(t)}return e},a.reject=function(e,t){e.state=i,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},s.resolve=function(e){return e instanceof this?e:a.resolve(new this(o),e)},s.reject=function(e){var t=new this(o);return a.reject(t,e)},s.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var i=new Array(n),c=0,u=-1,s=new this(o);++u<n;)f(e[u],u);return s;function f(e,o){t.resolve(e).then((function(e){i[o]=e,++c!==n||r||(r=!0,a.resolve(s,i))}),(function(e){r||(r=!0,a.reject(s,e))}))}},s.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n,r=e.length,i=!1;if(!r)return this.resolve([]);for(var c=-1,u=new this(o);++c<r;)n=e[c],t.resolve(n).then((function(e){i||(i=!0,a.resolve(u,e))}),(function(e){i||(i=!0,a.reject(u,e))}));return u}},{1:1}],3:[function(e,t,r){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var r="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};var o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function a(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var i=Promise;function c(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function s(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,v={},h=Object.prototype.toString,p="readonly",b="readwrite";function y(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}function g(e){return"boolean"==typeof d?i.resolve(d):function(e){return new i((function(t){var n=e.transaction(l,b),r=a([""]);n.objectStore(l).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return d=e}))}function m(e){var t=v[e.name],n={};n.promise=new i((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function S(e){var t=v[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var n=v[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function _(e,t){return new i((function(n,r){if(v[e.name]=v[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);m(e),e.db.close()}var a=[e.name];t&&a.push(e.version);var i=o.open.apply(o,a);t&&(i.onupgradeneeded=function(t){var n=i.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(l)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),i.onerror=function(e){e.preventDefault(),r(i.error)},i.onsuccess=function(){var t=i.result;t.onversionchange=function(e){e.target.close()},n(t),S(e)}}))}function E(e){return _(e,!1)}function I(e){return _(e,!0)}function O(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,o=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||n){if(n){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function N(e){return a([y(atob(e.data))],{type:e.type})}function R(e){return e&&e.__local_forage_encoded_blob}function T(e){var t=this,n=t._initReady().then((function(){var e=v[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(n,e,e),n}function A(e,t,n,r){void 0===r&&(r=1);try{var o=e.db.transaction(e.storeName,t);n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return i.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),I(e)})).then((function(){return function(e){m(e);for(var t=v[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,E(e).then((function(t){return e.db=t,O(e)?I(e):t})).then((function(r){e.db=t.db=r;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r})).catch((function(t){throw w(e,t),t}))}(e).then((function(){A(e,t,n,r-1)}))})).catch(n);n(o)}}var C={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=v[n.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},v[n.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=T);var a=[];function c(){return i.resolve()}for(var u=0;u<o.forages.length;u++){var s=o.forages[u];s!==t&&a.push(s._initReady().catch(c))}var f=o.forages.slice(0);return i.all(a).then((function(){return n.db=o.db,E(n)})).then((function(e){return n.db=e,O(n,t._defaultConfig.version)?I(n):e})).then((function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<f.length;r++){var a=f[r];a!==t&&(a._dbInfo.db=n.db,a._dbInfo.version=n.version)}}))},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new i((function(t,r){n.ready().then((function(){A(n._dbInfo,p,(function(o,a){if(o)return r(o);try{var i=a.objectStore(n._dbInfo.storeName).openCursor(),c=1;i.onsuccess=function(){var n=i.result;if(n){var r=n.value;R(r)&&(r=N(r));var o=e(r,n.key,c++);void 0!==o?t(o):n.continue()}else t()},i.onerror=function(){r(i.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},getItem:function(e,t){var n=this;e=s(e);var r=new i((function(t,r){n.ready().then((function(){A(n._dbInfo,p,(function(o,a){if(o)return r(o);try{var i=a.objectStore(n._dbInfo.storeName).get(e);i.onsuccess=function(){var e=i.result;void 0===e&&(e=null),R(e)&&(e=N(e)),t(e)},i.onerror=function(){r(i.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},setItem:function(e,t,n){var r=this;e=s(e);var o=new i((function(n,o){var a;r.ready().then((function(){return a=r._dbInfo,"[object Blob]"===h.call(t)?g(a.db).then((function(e){return e?t:(n=t,new i((function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):t})).then((function(t){A(r._dbInfo,b,(function(a,i){if(a)return o(a);try{var c=i.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var u=c.put(t,e);i.oncomplete=function(){void 0===t&&(t=null),n(t)},i.onabort=i.onerror=function(){var e=u.error?u.error:u.transaction.error;o(e)}}catch(e){o(e)}}))})).catch(o)}));return c(o,n),o},removeItem:function(e,t){var n=this;e=s(e);var r=new i((function(t,r){n.ready().then((function(){A(n._dbInfo,b,(function(o,a){if(o)return r(o);try{var i=a.objectStore(n._dbInfo.storeName).delete(e);a.oncomplete=function(){t()},a.onerror=function(){r(i.error)},a.onabort=function(){var e=i.error?i.error:i.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},clear:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){A(t._dbInfo,b,(function(r,o){if(r)return n(r);try{var a=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){var e=a.error?a.error:a.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return c(n,e),n},length:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){A(t._dbInfo,p,(function(r,o){if(r)return n(r);try{var a=o.objectStore(t._dbInfo.storeName).count();a.onsuccess=function(){e(a.result)},a.onerror=function(){n(a.error)}}catch(e){n(e)}}))})).catch(n)}));return c(n,e),n},key:function(e,t){var n=this,r=new i((function(t,r){e<0?t(null):n.ready().then((function(){A(n._dbInfo,p,(function(o,a){if(o)return r(o);try{var i=a.objectStore(n._dbInfo.storeName),c=!1,u=i.openKeyCursor();u.onsuccess=function(){var n=u.result;n?0===e||c?t(n.key):(c=!0,n.advance(e)):t(null)},u.onerror=function(){r(u.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},keys:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){A(t._dbInfo,p,(function(r,o){if(r)return n(r);try{var a=o.objectStore(t._dbInfo.storeName).openKeyCursor(),i=[];a.onsuccess=function(){var t=a.result;t?(i.push(t.key),t.continue()):e(i)},a.onerror=function(){n(a.error)}}catch(e){n(e)}}))})).catch(n)}));return c(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments);var n,r=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName),e.name){var a=e.name===r.name&&this._dbInfo.db?i.resolve(this._dbInfo.db):E(e).then((function(t){var n=v[e.name],r=n.forages;n.db=t;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t;return t}));n=e.storeName?a.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;m(e);var r=v[e.name],a=r.forages;t.close();for(var c=0;c<a.length;c++){var u=a[c];u._dbInfo.db=null,u._dbInfo.version=n}var s=new i((function(t,r){var a=o.open(e.name,n);a.onerror=function(e){a.result.close(),r(e)},a.onupgradeneeded=function(){a.result.deleteObjectStore(e.storeName)},a.onsuccess=function(){var e=a.result;e.close(),t(e)}}));return s.then((function(e){r.db=e;for(var t=0;t<a.length;t++){var n=a[t];n._dbInfo.db=e,S(n._dbInfo)}})).catch((function(t){throw(w(e,t)||i.resolve()).catch((function(){})),t}))}})):a.then((function(t){m(e);var n=v[e.name],r=n.forages;t.close();for(var a=0;a<r.length;a++)r[a]._dbInfo.db=null;var c=new i((function(t,n){var r=o.deleteDatabase(e.name);r.onerror=function(){var e=r.result;e&&e.close(),n(r.error)},r.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}}));return c.then((function(e){n.db=e;for(var t=0;t<r.length;t++)S(r[t]._dbInfo)})).catch((function(t){throw(w(e,t)||i.resolve()).catch((function(){})),t}))}))}else n=i.reject("Invalid arguments");return c(n,t),n}};var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=/^~~local_forage_type~([^~]+)~/,P="__lfsc__:",D="arbf",j="blob",M="si08",U="ui08",x="uic8",W="si16",B="si32",F="ur16",z="ui32",J="fl32",q="fl64",G=Object.prototype.toString;function H(e){var t,n,r,o,a,i=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);var s=new ArrayBuffer(i),f=new Uint8Array(s);for(t=0;t<c;t+=4)n=L.indexOf(e[t]),r=L.indexOf(e[t+1]),o=L.indexOf(e[t+2]),a=L.indexOf(e[t+3]),f[u++]=n<<2|r>>4,f[u++]=(15&r)<<4|o>>2,f[u++]=(3&o)<<6|63&a;return s}function V(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=L[n[t]>>2],r+=L[(3&n[t])<<4|n[t+1]>>4],r+=L[(15&n[t+1])<<2|n[t+2]>>6],r+=L[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var K={serialize:function(e,t){var n="";if(e&&(n=G.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===G.call(e.buffer))){var r,o=P;e instanceof ArrayBuffer?(r=e,o+=D):(r=e.buffer,"[object Int8Array]"===n?o+=M:"[object Uint8Array]"===n?o+=U:"[object Uint8ClampedArray]"===n?o+=x:"[object Int16Array]"===n?o+=W:"[object Uint16Array]"===n?o+=F:"[object Int32Array]"===n?o+=B:"[object Uint32Array]"===n?o+=z:"[object Float32Array]"===n?o+=J:"[object Float64Array]"===n?o+=q:t(new Error("Failed to get type for BinaryArray"))),t(o+V(r))}else if("[object Blob]"===n){var a=new FileReader;a.onload=function(){var n="~~local_forage_type~"+e.type+"~"+V(this.result);t(P+j+n)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,9)!==P)return JSON.parse(e);var t,n=e.substring(13),r=e.substring(9,13);if(r===j&&k.test(n)){var o=n.match(k);t=o[1],n=n.substring(o[0].length)}var i=H(n);switch(r){case D:return i;case j:return a([i],{type:t});case M:return new Int8Array(i);case U:return new Uint8Array(i);case x:return new Uint8ClampedArray(i);case W:return new Int16Array(i);case F:return new Uint16Array(i);case B:return new Int32Array(i);case z:return new Uint32Array(i);case J:return new Float32Array(i);case q:return new Float64Array(i);default:throw new Error("Unkown type: "+r)}},stringToBuffer:H,bufferToString:V};function Q(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function $(e,t,n,r,o,a){e.executeSql(n,r,o,(function(e,i){i.code===i.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,c){c.rows.length?a(e,i):Q(e,t,(function(){e.executeSql(n,r,o,a)}),a)}),a):a(e,i)}),a)}function Y(e,t,n,r){var o=this;e=s(e);var a=new i((function(a,i){o.ready().then((function(){void 0===t&&(t=null);var c=t,u=o._dbInfo;u.serializer.serialize(t,(function(t,s){s?i(s):u.db.transaction((function(n){$(n,u,"INSERT OR REPLACE INTO "+u.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){a(c)}),(function(e,t){i(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void a(Y.apply(o,[e,c,n,r-1]));i(t)}}))}))})).catch(i)}));return c(a,n),a}var X={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new i((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(o){Q(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=K,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new i((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){$(n,o,"SELECT * FROM "+o.storeName,[],(function(n,r){for(var a=r.rows,i=a.length,c=0;c<i;c++){var u=a.item(c),s=u.value;if(s&&(s=o.serializer.deserialize(s)),void 0!==(s=e(s,u.key,c+1)))return void t(s)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},getItem:function(e,t){var n=this;e=s(e);var r=new i((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){$(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},setItem:function(e,t,n){return Y.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=s(e);var r=new i((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){$(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},clear:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){$(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,e),n},length:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){$(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,e),n},key:function(e,t){var n=this,r=new i((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){$(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},keys:function(e){var t=this,n=new i((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){$(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,o=this;return c(r=e.name?new i((function(t){var r;r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(function(e){return new i((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var o=[],a=0;a<r.rows.length;a++)o.push(r.rows.item(a).name);t({db:e,storeNames:o})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}(r))})).then((function(e){return new i((function(t,n){e.db.transaction((function(r){function o(e){return new i((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var a=[],c=0,u=e.storeNames.length;c<u;c++)a.push(o(e.storeNames[c]));i.all(a).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):i.reject("Invalid arguments"),t),r}};function Z(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ee(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0}var te={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=Z(e,this._defaultConfig),ee()?(this._dbInfo=t,t.serializer=K,i.resolve()):i.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,a=localStorage.length,i=1,c=0;c<a;c++){var u=localStorage.key(c);if(0===u.indexOf(r)){var s=localStorage.getItem(u);if(s&&(s=t.serializer.deserialize(s)),void 0!==(s=e(s,u.substring(o),i++)))return s}}}));return c(r,t),r},getItem:function(e,t){var n=this;e=s(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return c(r,t),r},setItem:function(e,t,n){var r=this;e=s(e);var o=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new i((function(o,a){var i=r._dbInfo;i.serializer.serialize(t,(function(t,r){if(r)a(r);else try{localStorage.setItem(i.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||a(e),a(e)}}))}))}));return c(o,n),o},removeItem:function(e,t){var n=this;e=s(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return c(r,t),r},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return c(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return c(t,e),t},key:function(e,t){var n=this,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return c(r,t),r},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var a=localStorage.key(o);0===a.indexOf(e.keyPrefix)&&r.push(a.substring(e.keyPrefix.length))}return r}));return c(n,e),n},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,o=this;return r=e.name?new i((function(t){e.storeName?t(Z(e,o._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):i.reject("Invalid arguments"),c(r,t),r}},ne=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(a=t)||"number"==typeof o&&"number"==typeof a&&isNaN(o)&&isNaN(a))return!0;r++}var o,a;return!1},re=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},oe={},ae={},ie={INDEXEDDB:C,WEBSQL:X,LOCALSTORAGE:te},ce=[ie.INDEXEDDB._driver,ie.WEBSQL._driver,ie.LOCALSTORAGE._driver],ue=["dropInstance"],se=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ue),fe={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function le(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function de(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(re(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ve=function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ie)if(ie.hasOwnProperty(n)){var r=ie[n],o=r._driver;this[n]=o,oe[o]||this.defineDriver(r)}this._defaultConfig=de({},fe),this._config=de({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new i((function(t,n){try{var r=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(o);for(var a=se.concat("_initStorage"),u=0,s=a.length;u<s;u++){var f=a[u];if((!ne(ue,f)||e[f])&&"function"!=typeof e[f])return void n(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=i.reject(t);return c(n,arguments[arguments.length-1]),n}},n=0,r=ue.length;n<r;n++){var o=ue[n];e[o]||(e[o]=t(o))}}();var l=function(n){oe[r]&&console.info("Redefining LocalForage driver: "+r),oe[r]=e,ae[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,n):l(!!e._support):l(!0)}catch(e){n(e)}}));return u(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=oe[e]?i.resolve(oe[e]):i.reject(new Error("Driver not found."));return u(r,t,n),r},e.prototype.getSerializer=function(e){var t=i.resolve(K);return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;re(e)||(e=[e]);var o=this._getSupportedDrivers(e);function a(){r._config.driver=r.driver()}function c(e){return r._extend(e),a(),r._ready=r._initStorage(r._config),r._ready}var s=null!==this._driverSet?this._driverSet.catch((function(){return i.resolve()})):i.resolve();return this._driverSet=s.then((function(){var e=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,a(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var o=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(c).catch(n)}a();var u=new Error("No available storage method found.");return r._driverSet=i.reject(u),r._driverSet}()}}(o)}))})).catch((function(){a();var e=new Error("No available storage method found.");return r._driverSet=i.reject(e),r._driverSet})),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=se.length;e<t;e++)le(this,se[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),he=new ve;t.exports=he},{3:3}]},{},[4])(4)},795:e=>{"use strict";e.exports=window.ReactDOM},797:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)},o=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.useEventSource=void 0;var a=n(609),i=n(380),c=n(800);t.useEventSource=function(e,t,n){void 0===t&&(t=c.DEFAULT_EVENT_SOURCE_OPTIONS);var u=t.withCredentials,s=t.events,f=o(t,["withCredentials","events"]);void 0===n&&(n=!0);var l=r(r({},f),{eventSourceOptions:{withCredentials:u}}),d=(0,a.useRef)(c.EMPTY_EVENT_HANDLERS);s&&(d.current=s);var v=(0,i.useWebSocket)(e,l,n),h=v.lastMessage,p=v.readyState,b=v.getWebSocket;return(0,a.useEffect)((function(){(null==h?void 0:h.type)&&Object.entries(d.current).forEach((function(e){var t=e[0],n=e[1];t===h.type&&n(h)}))}),[h]),{lastEvent:h,readyState:p,getEventSource:b}}},800:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.isEventSourceSupported=t.isReactNative=t.ReadyState=t.DEFAULT_HEARTBEAT=t.UNPARSABLE_JSON_OBJECT=t.DEFAULT_RECONNECT_INTERVAL_MS=t.DEFAULT_RECONNECT_LIMIT=t.SOCKET_IO_PING_CODE=t.SOCKET_IO_PATH=t.SOCKET_IO_PING_INTERVAL=t.DEFAULT_EVENT_SOURCE_OPTIONS=t.EMPTY_EVENT_HANDLERS=t.DEFAULT_OPTIONS=void 0,t.DEFAULT_OPTIONS={},t.EMPTY_EVENT_HANDLERS={},t.DEFAULT_EVENT_SOURCE_OPTIONS={withCredentials:!1,events:t.EMPTY_EVENT_HANDLERS},t.SOCKET_IO_PING_INTERVAL=25e3,t.SOCKET_IO_PATH="/socket.io/?EIO=3&transport=websocket",t.SOCKET_IO_PING_CODE="2",t.DEFAULT_RECONNECT_LIMIT=20,t.DEFAULT_RECONNECT_INTERVAL_MS=5e3,t.UNPARSABLE_JSON_OBJECT={},t.DEFAULT_HEARTBEAT={message:"ping",timeout:6e4,interval:25e3},function(e){e[e.UNINSTANTIATED=-1]="UNINSTANTIATED",e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(n||(t.ReadyState=n={})),t.isReactNative="undefined"!=typeof navigator&&"ReactNative"===navigator.product,t.isEventSourceSupported=!t.isReactNative&&function(){try{return"EventSource"in globalThis}catch(e){return!1}}()},881:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.websocketWrapper=void 0,t.websocketWrapper=function(e,t){return new Proxy(e,{get:function(e,n){var r=e[n];return"reconnect"===n?t:"function"==typeof r?(console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."),function(){}):r},set:function(e,t,n){return/^on/.test(t)?(console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."),!1):(e[t]=n,!0)}})},t.default=t.websocketWrapper},889:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.heartbeat=function(e,t,n){var o=n||{},a=o.interval,i=void 0===a?r.DEFAULT_HEARTBEAT.interval:a,c=o.timeout,u=void 0===c?r.DEFAULT_HEARTBEAT.timeout:c,s=o.message,f=void 0===s?r.DEFAULT_HEARTBEAT.message:s,l=Math.max(100,i/10),d=Date.now(),v=setInterval((function(){var n=Date.now(),r=function(e){return Array.isArray(e)?e.reduce((function(e,t){return e.current>t.current?e:t})).current:e.current}(t);if(r+u<=n)console.warn("Heartbeat timed out, closing connection, last message received ".concat(n-r,"ms ago, last ping sent ").concat(n-d,"ms ago")),e.close();else if(r+i<=n&&d+i<=n)try{"function"==typeof f?e.send(f()):e.send(f),d=n}catch(t){console.error("Heartbeat failed, closing connection",t instanceof Error?t.message:t),e.close()}}),l);return e.addEventListener("close",(function(){clearInterval(v)})),function(){}};var r=n(800)},921:(e,t,n)=>{"use strict";t.Ay=void 0;var r=n(380);Object.defineProperty(t,"Ay",{enumerable:!0,get:function(){return r.useWebSocket}});n(407),n(800),n(797),n(1)},984:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetSubscribers=t.removeSubscriber=t.addSubscriber=t.hasSubscribers=t.getSubscribers=void 0;var n={},r=[];t.getSubscribers=function(e){return(0,t.hasSubscribers)(e)?Array.from(n[e]):r},t.hasSubscribers=function(e){var t;return(null===(t=n[e])||void 0===t?void 0:t.size)>0},t.addSubscriber=function(e,t){n[e]=n[e]||new Set,n[e].add(t)},t.removeSubscriber=function(e,t){n[e].delete(t)},t.resetSubscribers=function(e){if(e&&n.hasOwnProperty(e))delete n[e];else for(var t in n)n.hasOwnProperty(t)&&delete n[t]}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{"use strict";var e=n(609);const t=window.wp.element;let r=function(e){return e.Login="Login",e.Logout="Logout",e.OnCall="OnCall",e.Pause="Pause",e.Ringing="Ringing",e.Unreachable="Unreachable",e}({});const o=e=>{switch(e){case r.Login:return"online";case r.Pause:return"pause";case r.OnCall:case r.Ringing:return"calling";case r.Logout:case r.Unreachable:return"offline"}},a=({name:n,status:a,cardCustomization:i})=>{const c=(0,t.useMemo)((()=>o(a)),[a]),u=(0,t.useMemo)((()=>{switch(a){case r.Login:{const t=i.onlineImage;return(0,e.createElement)("img",{className:`operator-card-image online-image ${c}`,src:t})}case r.Pause:{const t=i.pauseImage;return(0,e.createElement)("img",{className:`operator-card-image pause-image ${c}`,src:t})}case r.OnCall:case r.Ringing:{const t=i.callingImage;return(0,e.createElement)("img",{className:`operator-card-image calling-image ${c}`,src:t})}case r.Logout:case r.Unreachable:{const t=i.offlineImage;return(0,e.createElement)("img",{className:`operator-card-image offline-image ${c}`,src:t})}}}),[a,i,c]),s=(0,t.useMemo)((()=>{switch(a){case r.Login:return"Online";case r.Pause:return"In pausa";case r.OnCall:case r.Ringing:return"In chiamata";case r.Logout:case r.Unreachable:return"Offline"}}),[a]);return(0,e.createElement)("div",{className:`operator-card ${c}`},u,(0,e.createElement)("div",{className:"operator-card-content"},i.withName?(0,e.createElement)("div",{className:"operator-card-name"},n):(0,e.createElement)(e.Fragment,null),i.withStatus?(0,e.createElement)("div",{className:"operator-card-status"},s):(0,e.createElement)(e.Fragment,null)))};var i=n(921);const c=({queryParams:n,sort:r,statusOrder:c,operatorFilter:u,cardCustomization:s})=>{const[f,l]=(0,t.useState)(new Map);return(0,i.Ay)("ws://localhost:8021/api/operators/ws/event-stream",{queryParams:n,shouldReconnect:()=>!0,reconnectAttempts:5,reconnectInterval:e=>1e3*e,heartbeat:!0,onMessage:e=>{if("pong"===e.data)return;const t=JSON.parse(e.data);if(!t.id)return;const{id:n,...r}=t;l((e=>{const o=new Map(e);return o.set(n,{id:n,...r}),"DELETE"===t.operation&&o.delete(n),o}))}}),(0,e.createElement)("div",{className:"operators-wrapper"},Array.from(f.values()).sort(((e,t)=>"name-asc"===r?e.name?t.name?e.name.localeCompare(t.name):-1:1:"phone-number-asc"===r?e.line.localeCompare(t.line):"random"===r?2*Math.random()-1:"status"===r?c.findIndex((t=>o(e.status)===t))-c.findIndex((e=>o(t.status)===e)):0)).filter(u).map((t=>{var n;return(0,e.createElement)(a,{key:`operator-${t.id}`,cardCustomization:s,status:t.status,name:null!==(n=t.name)&&void 0!==n?n:void 0})})))};var u=n(790);const s=n.n(u)().createInstance({name:"webcom-operator-status"}),f=n.p+"images/LIBERO.805064eb.png",l=n.p+"images/PAUSA.10c5965f.png",d=n.p+"images/LOGOUT.99a185f5.png",v=n.p+"images/OCCUPATO.c63d5b41.png",h=()=>{const n=(()=>{const[e,n]=(0,t.useState)();return(0,t.useEffect)((()=>{Promise.all([s.getItem("withLogin"),s.getItem("withLogout"),s.getItem("withUnreachable"),s.getItem("groupName"),s.getItem("sort"),s.getItem("statusOrder"),s.getItem("filterOperatorWithoutAlias"),s.getItem("enableWhitelist"),s.getItem("whitelist"),s.getItem("accessToken")]).then((([e,t,r,o,a,i,c,u,s,f])=>n({withLogin:null==e||e,withLogout:null==t||t,withUnreachable:null==r||r,groupName:o||void 0,sort:a||void 0,statusOrder:i||[],filterOperatorWithoutAlias:null!=c&&c,enableWhitelist:null!=u&&u,whitelist:null!=s?s:[],token:f||""})))}),[]),e})(),r=(()=>{const[t,n]=(0,e.useState)({onlineImage:f,pauseImage:l,callingImage:v,offlineImage:d,withName:!0,withStatus:!1});return(0,e.useEffect)((()=>{Promise.all([s.getItem("onlineImage"),s.getItem("pauseImage"),s.getItem("callingImage"),s.getItem("offlineImage"),s.getItem("withName"),s.getItem("withStatus")]).then((([e,t,r,o,a,i])=>n({onlineImage:e||f,pauseImage:t||l,callingImage:r||v,offlineImage:o||d,withName:null==a||a,withStatus:null!=i&&i})))}),[]),t})();return(0,t.useMemo)((()=>{if(!n||!r)return(0,e.createElement)(e.Fragment,null);const t=(({withLogin:e,withLogout:t,withUnreachable:n,filterOperatorWithoutAlias:r,groupName:o})=>a=>{const i=(({withLogin:e,withLogout:t,withUnreachable:n})=>{const r=[];return e&&r.push("Login","Pause","Ringing","OnCall"),t&&r.push("Logout"),n&&r.push("Unreachable"),r})({withLogin:e,withLogout:t,withUnreachable:n}),c=[];return c.push((()=>i.includes(a.status))),o&&c.push((()=>a.group?.toLocaleLowerCase()===o?.toLocaleLowerCase())),r&&c.push((()=>!!a.name)),c.every((e=>e()))})(n),{withLogin:o,withLogout:a,withUnreachable:i,groupName:u,sort:s,enableWhitelist:f,whitelist:l,token:d,filterOperatorWithoutAlias:v}=n,h={withLogin:o.toString(),withLogout:a.toString(),withUnreachable:i.toString(),withAlias:v.toString(),token:d.toString()};return u&&(h.groupName=u),s&&(h.sort=s),f&&l&&l.length>0&&(h.whitelist=l.join(",")),(0,e.createElement)(c,{queryParams:h,sort:s,statusOrder:n.statusOrder,operatorFilter:t,cardCustomization:r})}),[r,n])},p=async(e,t,n,r=e=>e)=>{const o=r(e.getAttribute(t));return await s.setItem(n,o),e.removeAttribute(t),o};window.addEventListener("load",(async()=>{const n=document.getElementById("webcom-plugin-entrypoint");await Promise.all([p(n,"data-api-token","accessToken"),p(n,"data-online-image","onlineImage"),p(n,"data-pause-image","pauseImage"),p(n,"data-calling-image","callingImage"),p(n,"data-offline-image","offlineImage"),p(n,"data-whitelist","whitelist",JSON.parse),p(n,"data-enable-whitelist","enableWhitelist",(e=>"1"===e)),p(n,"data-with-login","withLogin",(e=>"1"===e)),p(n,"data-with-logout","withLogout",(e=>"1"===e)),p(n,"data-with-unreachable","withUnreachable",(e=>"1"===e)),p(n,"data-group-name","groupName"),p(n,"data-hide-operator-no-alias","filterOperatorWithoutAlias",(e=>"1"===e)),p(n,"data-sort","sort"),p(n,"data-status-order","statusOrder",JSON.parse),p(n,"data-with-name","withName",(e=>"1"===e)),p(n,"data-with-status","withStatus",(e=>"1"===e))]),console.log("Initialized webcom-operator-status wordpress plugin version: 0.7.0"),(0,t.createRoot)(n).render((0,e.createElement)(h,null))}))})()})();
  • webcom-operator-status/trunk/readme.txt

    r3328786 r3333380  
    33Tags:              block, webcom, operator, status
    44Tested up to:      6.8.1
    5 Stable tag:        0.6.2
     5Stable tag:        0.7.0
    66License:           GPL-2.0-or-later
    77License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    1919* `calling-image`: Immagine stato operatore in chiamata
    2020* `offline-image`: Immagine stato operatore offline/sloggato
     21
     22Il plugin espone un blocco Gutenberg ed uno short code: `webcom_stato_operatori`
    2123
    2224== Installation ==
     
    6365* Risolti problemi di versioning nel WordPress store
    6466* Corretti stable tag nelle versioni precedenti
     67
     68= 0.7.0 =
     69* Cambio protocollo sottostante
  • webcom-operator-status/trunk/webcom-plugin.php

    r3328786 r3333380  
    66 * Requires at least: 6.1
    77 * Requires PHP:      7.0
    8  * Version:           0.6.2
     8 * Version:           0.7.0
    99 * Author:            Webcom TLC
    1010 * License:           GPL-2.0-or-later
Note: See TracChangeset for help on using the changeset viewer.