Plugin Directory

Changeset 3328858


Ignore:
Timestamp:
07/16/2025 09:25:43 AM (8 months ago)
Author:
webcomtlc
Message:

Updated frontend.js with new changes

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

Legend:

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

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

    r3328365 r3328858  
    1 <?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-element'), 'version' => '1533d996a8de9ed2ad62');
     1<?php return array('dependencies' => array('react', 'wp-element'), 'version' => '383d11184b3ee6478149');
  • webcom-operator-status/trunk/build/frontend.js

    r3328365 r3328858  
    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,p="readonly",m="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,m),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 N(e){return _(e,!0)}function E(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 j(e){return a([g(atob(e.data))],{type:e.type})}function O(e){return e&&e.__local_forage_encoded_blob}function R(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),N(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,E(e)?N(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 x={_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=R);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,E(n,t._defaultConfig.version)?N(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;O(r)&&(r=j(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),O(e)&&(e=j(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,m,(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,m,(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,m,(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):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 L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C=/^~~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=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 H(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 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&&C.test(n)){var o=n.match(C);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 X(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function G(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):X(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){G(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){X(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){G(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){G(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){G(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){G(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){G(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){G(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){G(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:x,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.wp.element,t=window.React;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 p=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"}},m=window.ReactJSXRuntime,g=({name:t,status:n,cardCustomization:r})=>{const o=(0,e.useMemo)((()=>p(n)),[n]),a=(0,e.useMemo)((()=>{switch(n){case v.Login:{const e=r.onlineImage;return(0,m.jsx)("img",{className:`operator-card-image online-image ${o}`,src:e})}case v.Pause:{const e=r.pauseImage;return(0,m.jsx)("img",{className:`operator-card-image pause-image ${o}`,src:e})}case v.OnCall:case v.Ringing:{const e=r.callingImage;return(0,m.jsx)("img",{className:`operator-card-image calling-image ${o}`,src:e})}case v.Logout:case v.Unreachable:{const e=r.offlineImage;return(0,m.jsx)("img",{className:`operator-card-image offline-image ${o}`,src:e})}}}),[n,r,o]),i=(0,e.useMemo)((()=>{switch(n){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"}}),[n]);return(0,m.jsxs)("div",{className:`operator-card ${o}`,children:[a,(0,m.jsxs)("div",{className:"operator-card-content",children:[r.withName?(0,m.jsx)("div",{className:"operator-card-name",children:t}):(0,m.jsx)(m.Fragment,{}),r.withStatus?(0,m.jsx)("div",{className:"operator-card-status",children:i}):(0,m.jsx)(m.Fragment,{})]})]})},b=()=>{const[t,n]=(0,e.useState)();return(0,e.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:[]})))}),[]),t},y=n.p+"images/LIBERO.805064eb.png",w=n.p+"images/PAUSA.10c5965f.png",I=n.p+"images/LOGOUT.99a185f5.png",_=n.p+"images/OCCUPATO.c63d5b41.png",S=new URL("https://racoon.webcom-tlc.it/"),N=()=>{const n=(0,e.useRef)(),r=(0,e.useRef)(),[a,c]=(0,e.useState)({}),u=b(),s=(()=>{const[e,n]=(0,t.useState)({onlineImage:y,pauseImage:w,callingImage:_,offlineImage:I,withName:!0,withStatus:!1});return(0,t.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||y,pauseImage:t||w,callingImage:r||_,offlineImage:o||I,withName:null==a||a,withStatus:null!=i&&i})))}),[]),e})(),f=(()=>{const t=b();return(0,e.useCallback)((e=>{if(!t)return!1;const{withLogin:n,withLogout:r,withUnreachable:o,filterOperatorWithoutAlias:a,groupName:i}=t,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(e.status))),i&&u.push((()=>e.group?.toLocaleLowerCase()===i?.toLocaleLowerCase())),a&&u.push((()=>!!e.name)),u.every((e=>e()))}),[t])})(),l=(0,e.useCallback)((async()=>{if(!u)return;n.current=new AbortController;const e=new URL(S);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,e.useEffect)((()=>(l(),()=>{n.current?.abort(),r.current&&clearInterval(r.current)})),[l]),(0,m.jsx)("div",{className:"operators-wrapper",children: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=>p(e.status)===t))-u.statusOrder.findIndex((e=>p(t.status)===e)):0)).filter(f).map((e=>{var t;return(0,m.jsx)(g,{cardCustomization:s,status:e.status,name:null!==(t=e.name)&&void 0!==t?t:void 0},`operator-${e.id}`)}))})},E=()=>(0,m.jsx)(N,{}),j=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 t=document.getElementById("webcom-plugin-entrypoint");await Promise.all([j(t,"data-api-token","accessToken"),j(t,"data-online-image","onlineImage"),j(t,"data-pause-image","pauseImage"),j(t,"data-calling-image","callingImage"),j(t,"data-offline-image","offlineImage"),j(t,"data-whitelist","whitelist",JSON.parse),j(t,"data-enable-whitelist","enableWhitelist",(e=>"1"===e)),j(t,"data-with-login","withLogin",(e=>"1"===e)),j(t,"data-with-logout","withLogout",(e=>"1"===e)),j(t,"data-with-unreachable","withUnreachable",(e=>"1"===e)),j(t,"data-group-name","groupName"),j(t,"data-hide-operator-no-alias","filterOperatorWithoutAlias",(e=>"1"===e)),j(t,"data-sort","sort"),j(t,"data-status-order","statusOrder",JSON.parse),j(t,"data-with-name","withName",(e=>"1"===e)),j(t,"data-with-status","withStatus",(e=>"1"===e))]),console.log("Initialized webcom-operator-status wordpress plugin version: 0.6.1"),(0,e.createRoot)(t).render((0,m.jsx)(E,{}))}))})()})();
     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))}))})()})();
  • webcom-operator-status/trunk/build/index.asset.php

    r3328365 r3328858  
    1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '4332bc93bbad03e029c4');
     1<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '8c66abac8f102f6bec8e');
  • webcom-operator-status/trunk/build/index.js

    r3328365 r3328858  
    1 (()=>{"use strict";var r,e={597:()=>{const r=window.wp.blocks,e=window.wp.i18n,o=window.wp.blockEditor,i=window.ReactJSXRuntime,n=JSON.parse('{"UU":"create-block/webcom-plugin"}');(0,r.registerBlockType)(n.UU,{edit:function(){return(0,i.jsx)("p",{...(0,o.useBlockProps)(),children:(0,e.__)("Webcom Plugin 😀","webcom-plugin")})},save:()=>(0,i.jsx)("div",{})})}},o={};function i(r){var n=o[r];if(void 0!==n)return n.exports;var t=o[r]={exports:{}};return e[r](t,t.exports,i),t.exports}i.m=e,r=[],i.O=(e,o,n,t)=>{if(!o){var l=1/0;for(a=0;a<r.length;a++){for(var[o,n,t]=r[a],c=!0,p=0;p<o.length;p++)(!1&t||l>=t)&&Object.keys(i.O).every((r=>i.O[r](o[p])))?o.splice(p--,1):(c=!1,t<l&&(l=t));if(c){r.splice(a--,1);var s=n();void 0!==s&&(e=s)}}return e}t=t||0;for(var a=r.length;a>0&&r[a-1][2]>t;a--)r[a]=r[a-1];r[a]=[o,n,t]},i.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),(()=>{var r={57:0,350:0};i.O.j=e=>0===r[e];var e=(e,o)=>{var n,t,[l,c,p]=o,s=0;if(l.some((e=>0!==r[e]))){for(n in c)i.o(c,n)&&(i.m[n]=c[n]);if(p)var a=p(i)}for(e&&e(o);s<l.length;s++)t=l[s],i.o(r,t)&&r[t]&&r[t][0](),r[t]=0;return i.O(a)},o=globalThis.webpackChunkwebcom_plugin=globalThis.webpackChunkwebcom_plugin||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})();var n=i.O(void 0,[350],(()=>i(597)));n=i.O(n)})();
     1(()=>{"use strict";var e,r={17:()=>{const e=window.React,r=window.wp.blocks,o=window.wp.i18n,n=window.wp.blockEditor,i=JSON.parse('{"UU":"create-block/webcom-plugin"}');(0,r.registerBlockType)(i.UU,{edit:function(){return(0,e.createElement)("p",{...(0,n.useBlockProps)()},(0,o.__)("Webcom Plugin 😀","webcom-plugin"))},save:()=>(0,e.createElement)("div",null)})}},o={};function n(e){var i=o[e];if(void 0!==i)return i.exports;var t=o[e]={exports:{}};return r[e](t,t.exports,n),t.exports}n.m=r,e=[],n.O=(r,o,i,t)=>{if(!o){var l=1/0;for(s=0;s<e.length;s++){for(var[o,i,t]=e[s],c=!0,a=0;a<o.length;a++)(!1&t||l>=t)&&Object.keys(n.O).every((e=>n.O[e](o[a])))?o.splice(a--,1):(c=!1,t<l&&(l=t));if(c){e.splice(s--,1);var p=i();void 0!==p&&(r=p)}}return r}t=t||0;for(var s=e.length;s>0&&e[s-1][2]>t;s--)e[s]=e[s-1];e[s]=[o,i,t]},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={57:0,350:0};n.O.j=r=>0===e[r];var r=(r,o)=>{var i,t,[l,c,a]=o,p=0;if(l.some((r=>0!==e[r]))){for(i in c)n.o(c,i)&&(n.m[i]=c[i]);if(a)var s=a(n)}for(r&&r(o);p<l.length;p++)t=l[p],n.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return n.O(s)},o=globalThis.webpackChunkwebcom_plugin=globalThis.webpackChunkwebcom_plugin||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})();var i=n.O(void 0,[350],(()=>n(17)));i=n.O(i)})();
Note: See TracChangeset for help on using the changeset viewer.