evrythng
Version:
Official Javascript SDK for the EVRYTHNG API.
1 lines • 83.7 kB
JavaScript
var evrythng;(()=>{var t={50:(t,e,r)=>{var n=r(117);function o(t){var e,r;function o(e,r){try{var i=t[e](r),u=i.value,a=u instanceof n;Promise.resolve(a?u.wrapped:u).then((function(t){a?o("next",t):c(i.done?"return":"normal",t)}),(function(t){o("throw",t)}))}catch(t){c("throw",t)}}function c(t,n){switch(t){case"return":e.resolve({value:n,done:!0});break;case"throw":e.reject(n);break;default:e.resolve({value:n,done:!1})}(e=e.next)?o(e.key,e.arg):r=null}this._invoke=function(t,n){return new Promise((function(c,i){var u={key:t,arg:n,resolve:c,reject:i,next:null};r?r=r.next=u:(e=r=u,o(t,n))}))},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(o.prototype[Symbol.asyncIterator]=function(){return this}),o.prototype.next=function(t){return this._invoke("next",t)},o.prototype.throw=function(t){return this._invoke("throw",t)},o.prototype.return=function(t){return this._invoke("return",t)},t.exports=o},117:t=>{t.exports=function(t){this.wrapped=t}},858:t=>{t.exports=function(t){if(Array.isArray(t))return t}},646:t=>{t.exports=function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}},506:t=>{t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},926:t=>{function e(t,e,r,n,o,c,i){try{var u=t[c](i),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,c){var i=t.apply(r,n);function u(t){e(i,o,c,u,a,"next",t)}function a(t){e(i,o,c,u,a,"throw",t)}u(void 0)}))}}},486:(t,e,r)=>{var n=r(117);t.exports=function(t){return new n(t)}},575:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},913:t=>{function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}},713:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},525:(t,e,r)=>{r(754);var n=r(331);function o(e,r,c){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=o=Reflect.get:t.exports=o=function(t,e,r){var o=n(t,e);if(o){var c=Object.getOwnPropertyDescriptor(o,e);return c.get?c.get.call(r):c.value}},o(e,r,c||e)}t.exports=o},754:t=>{function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(r)}t.exports=e},205:(t,e,r)=>{var n=r(489);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},860:t=>{t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},884:t=>{t.exports=function(t,e){var r=[],n=!0,o=!1,c=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,c=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw c}}return r}},521:t=>{t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},206:t=>{t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},479:(t,e,r)=>{var n=r(316);t.exports=function(t,e){if(null==t)return{};var r,o,c=n(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(c[r]=t[r])}return c}},316:t=>{t.exports=function(t,e){if(null==t)return{};var r,n,o={},c=Object.keys(t);for(n=0;n<c.length;n++)r=c[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}},585:(t,e,r)=>{var n=r(8),o=r(506);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?o(t):e}},489:t=>{function e(r,n){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(r,n)}t.exports=e},38:(t,e,r)=>{var n=r(858),o=r(884),c=r(521);t.exports=function(t,e){return n(t)||o(t,e)||c()}},331:(t,e,r)=>{var n=r(754);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=n(t)););return t}},249:(t,e,r)=>{var n=r(858),o=r(860),c=r(521);t.exports=function(t){return n(t)||o(t)||c()}},319:(t,e,r)=>{var n=r(646),o=r(860),c=r(206);t.exports=function(t){return n(t)||o(t)||c()}},8:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(n){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=r=function(t){return e(t)}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},r(n)}t.exports=r},551:(t,e,r)=>{var n=r(50);t.exports=function(t){return function(){return new n(t.apply(this,arguments))}}},757:(t,e,r)=>{t.exports=r(666)},905:function(){!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),c="FormData"in t,i="ArrayBuffer"in t;if(i)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function s(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function y(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function v(t){var e=new FileReader,r=y(e);return e.readAsArrayBuffer(t),r}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:c&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():i&&o&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var t,e,r,n=h(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=y(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=s(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},p.prototype.delete=function(t){delete this.map[s(t)]},p.prototype.get=function(t){return t=s(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(s(t))},p.prototype.set=function(t,e){this.map[s(t)]=f(e)},p.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),l(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),l(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),l(t)},n&&(p.prototype[Symbol.iterator]=p.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(t,e){var r,n,o=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),m.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function R(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},g.call(b.prototype),g.call(R.prototype),R.prototype.clone=function(){return new R(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},R.error=function(){var t=new R(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];R.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new R(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function k(t,r){return new Promise((function(n,c){var i=new b(t,r);if(i.signal&&i.signal.aborted)return c(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var o="response"in u?u.response:u.responseText;n(new R(o,r))},u.onerror=function(){c(new TypeError("Network request failed"))},u.ontimeout=function(){c(new TypeError("Network request failed"))},u.onabort=function(){c(new e.DOMException("Aborted","AbortError"))},u.open(i.method,i.url,!0),"include"===i.credentials?u.withCredentials=!0:"omit"===i.credentials&&(u.withCredentials=!1),"responseType"in u&&o&&(u.responseType="blob"),i.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),i.signal&&(i.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&i.signal.removeEventListener("abort",a)}),u.send(void 0===i._bodyInit?null:i._bodyInit)}))}k.polyfill=!0,t.fetch||(t.fetch=k,t.Headers=p,t.Request=b,t.Response=R),e.Headers=p,e.Request=b,e.Response=R,e.fetch=k,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},c=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function a(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,c=Object.create(o.prototype),i=new S(n||[]);return c._invoke=function(t,e,r){var n=f;return function(o,c){if(n===p)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw c;return D()}for(r.method=o,r.arg=c;;){var i=r.delegate;if(i){var u=P(i,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var a=s(t,e,r);if("normal"===a.type){if(n=r.done?h:l,a.arg===y)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(n=h,r.method="throw",r.arg=a.arg)}}}(t,r,i),c}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var f="suspendedStart",l="suspendedYield",p="executing",h="completed",y={};function v(){}function d(){}function g(){}var m={};m[c]=function(){return this};var b=Object.getPrototypeOf,w=b&&b(b(A([])));w&&w!==r&&n.call(w,c)&&(m=w);var R=g.prototype=v.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function k(t){function e(r,o,c,i){var u=s(t[r],t,o);if("throw"!==u.type){var a=u.arg,f=a.value;return f&&"object"==typeof f&&n.call(f,"__await")?Promise.resolve(f.__await).then((function(t){e("next",t,c,i)}),(function(t){e("throw",t,c,i)})):Promise.resolve(f).then((function(t){a.value=t,c(a)}),(function(t){return e("throw",t,c,i)}))}i(u.arg)}var r;this._invoke=function(t,n){function o(){return new Promise((function(r,o){e(t,n,r,o)}))}return r=r?r.then(o,o):o()}}function P(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,P(t,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=s(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var c=o.arg;return c?c.done?(r[t.resultName]=c.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):c:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function A(t){if(t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:D}}function D(){return{value:e,done:!0}}return d.prototype=R.constructor=g,g.constructor=d,g[u]=d.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(R),t},t.awrap=function(t){return{__await:t}},x(k.prototype),k.prototype[i]=function(){return this},t.AsyncIterator=k,t.async=function(e,r,n,o){var c=new k(a(e,r,n,o));return t.isGeneratorFunction(r)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},x(R),R[u]="Generator",R[c]=function(){return this},R.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=A,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var c=this.tryEntries.length-1;c>=0;--c){var i=this.tryEntries[c],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var c=o;break}}c&&("break"===t||"continue"===t)&&c.tryLoc<=e&&e<=c.finallyLoc&&(c=null);var i=c?c.completion:{};return i.type=t,i.arg=e,c?(this.method="next",this.next=c.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:A(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var c=e[n]={exports:{}};return t[n].call(c.exports,c,c.exports,r),c.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{AccessToken:()=>tr,ActionApp:()=>cr,Application:()=>We,Device:()=>Ze,Entity:()=>ir,Operator:()=>Ge,Symbol:()=>st,TrustedApplication:()=>Xe,User:()=>ze,_Entity:()=>bt,_Resource:()=>mt,_Scope:()=>ft,alias:()=>Qe,api:()=>C,settings:()=>t,setup:()=>i,use:()=>rr}),r(905);const t=Object.assign({},{apiUrl:"https://api.evrythng.io/v2",apiKey:"",fullResponse:!1,geolocation:!0,timeout:0,headers:{"content-type":"application/json"},interceptors:[],defaultShortDomain:"tn.gg",apiVersion:2,region:"us"});var e=[1,2],o=["us","eu"],c={2:{us:"https://api.evrythng.io/v2",eu:"https://api.eu.evrythng.io/v2"},1:{us:"https://api.evrythng.com",eu:"https://api-eu.evrythng.com"}};function i(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.apiUrl,i=r.apiVersion,u=void 0===i?2:i,a=r.region,s=void 0===a?"us":a;if(!e.includes(u))throw new Error("Invalid apiVersion: ".concat(u,". Choose from ").concat(e.join(", ")));if(!o.includes(s))throw new Error("Invalid region: ".concat(s,". Choose from ").concat(o.join(", ")));return r.apiUrl=n||c[u][s],r.apiVersion=u,r.region=s,Object.assign(t,r)}var u=r(757),a=r.n(u),s=r(926),f=r.n(s);const l="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;var p="object"==typeof self&&self&&self.Object===Object&&self;const h=(l||p||Function("return this")()).Symbol;var y=Object.prototype,v=y.hasOwnProperty,d=y.toString,g=h?h.toStringTag:void 0;var m=Object.prototype.toString;var b=h?h.toStringTag:void 0;const w=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":b&&b in Object(t)?function(t){var e=v.call(t,g),r=t[g];try{t[g]=void 0;var n=!0}catch(t){}var o=d.call(t);return n&&(e?t[g]=r:delete t[g]),o}(t):function(t){return m.call(t)}(t)},R=function(t){if(!function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}(t))return!1;var e=w(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e};var x=r(38),k=r.n(x);const P=(j=Object.getPrototypeOf,O=Object,function(t){return j(O(t))});var j,O;const S=function(t){return null!=t&&"object"==typeof t};var A=Function.prototype,D=Object.prototype,E=A.toString,_=D.hasOwnProperty,F=E.call(Object);const T=function(t){if(!S(t)||"[object Object]"!=w(t))return!1;var e=P(t);if(null===e)return!0;var r=_.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&E.call(r)==F};var U=new RegExp("[".concat(["&","|","!",">","<","=","~","(",")",","].join("\\"),"]"),"g");function I(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return T(t)?Object.entries(t).map(L(e)).join("&"):t}function L(t){var e=function(t){return function(e){return t?encodeURIComponent(e):function(t){return t.replace(U,"\\$&")}(e)}}(t);return function(t){var r=k()(t,2),n=r[0],o=r[1];return"".concat(e(n),"=").concat(e(I(o)))}}function K(t){return function(e){return t&&t(null,e),e}}function B(t){return function(e){if(t&&t(e),!e)throw new Error("No error message available, err was:",e);if(e.name&&e.name.includes("Error"))throw e;if(void 0!==e.ok&&!e.ok)return e.text().then((function(t){return Promise.reject(t)}));if("string"==typeof e)try{e=JSON.parse(e)}catch(t){}throw new Error(e.message||JSON.stringify(e))}}function C(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=q(t);return N(r).then((function(t){return M(t).then(G(t)).then(z(t))})).then(K(e)).catch((function(t){return B(e)(t)}))}function q(e){var r=Object.assign({method:"get",url:""},t,e,{headers:Object.assign({},t.headers,e.headers)});return!r.headers.authorization&&r.apiKey&&(r.headers.authorization=r.apiKey),r.data&&(r.body=JSON.stringify(r.data),Reflect.deleteProperty(r,"data")),r}function N(t){var e=!1;function r(){e=!0}var n=Promise.resolve(t);return Array.isArray(t.interceptors)&&t.interceptors.filter((function(t){return R(t.request)})).forEach((function(t){n=n.then((function(n){return e?n:t.request(n,r)||n}))})),n.then((function(t){return e?Promise.reject({errors:["Request cancelled on request interceptors"],cancelled:!0}):t}))}function M(t){var e=fetch(function(t){var e="".concat(t.apiUrl).concat(t.url);return t.params&&(e+="?".concat(I(t.params))),e}(t),t);return t.timeout?Promise.race([e,new Promise((function(e,r){setTimeout((function(){return r("Request timeout")}),t.timeout)}))]):e}function G(t){return function(){var e=f()(a().mark((function e(r){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.fullResponse){e.next=2;break}return e.abrupt("return",r);case 2:return e.next=4,r.text();case 4:if(!((n=e.sent).length>0)){e.next=13;break}e.prev=6,n=JSON.parse(n),e.next=13;break;case 10:throw e.prev=10,e.t0=e.catch(6),new Error("Unexpected non-JSON response: ".concat(n));case 13:if(!(r.status>=400||n.errors)){e.next=15;break}throw n;case 15:if(![202,204].includes(r.status)&&"delete"!==t.method.toLowerCase()){e.next=17;break}return e.abrupt("return",void 0);case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e,null,[[6,10]])})));return function(t){return e.apply(this,arguments)}}()}function z(t){return function(e){var r=Promise.resolve(e);return Array.isArray(t.interceptors)&&t.interceptors.filter((function(t){return R(t.response)})).forEach((function(t){r=r.then(t.response)})),r}}var H=r(713),V=r.n(H),J=r(575),$=r.n(J),W=r(913),X=r.n(W),Y=r(506),Q=r.n(Y),Z=r(205),tt=r.n(Z),et=r(585),rt=r.n(et),nt=r(525),ot=r.n(nt),ct=r(754),it=r.n(ct);const ut=Array.isArray,at=function(t){return"string"==typeof t||!ut(t)&&S(t)&&"[object String]"==w(t)},st={init:Symbol("init"),path:Symbol("path"),resource:Symbol("resource")};var ft=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if($()(this,t),!at(e))throw new Error("Scope constructor should be called with an API Key");this.apiKey=e,Object.assign(this,r)}return X()(t,[{key:"readAccess",value:function(){return C({url:"/access",apiKey:this.apiKey})}},{key:"read",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign(t,{method:"get",url:this[st.path],apiKey:this.apiKey});return this._request(e)}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Object.assign(e,{method:"put",url:this[st.path],apiKey:this.apiKey,data:t});return this._request(r)}},{key:"_request",value:function(t){var e=this;return C(t).then((function(t){return Object.assign(e,t)}))}}]),t}(),lt=r(8),pt=r.n(lt),ht=r(486),yt=r.n(ht),vt=r(551),dt=r.n(vt);function gt(t){var e={};if(t&&t.length)for(var r=t.split(","),n=0;n<r.length;n++){var o=r[n].split(";"),c=o[0].replace(/<(.*)>/,"$1").trim();e[o[1].replace(/rel="(.*)"/,"$1").trim()]=c}return e}var mt=function(){function t(e,r,n,o,c){if($()(this,t),!(e&&e instanceof ft))throw new TypeError("Scope should inherit from Scope (e.g. EVT.Application).");if(!at(r))throw new TypeError("Resource must have a String path.");this.scope=e,this.path="".concat("/"!==r[0]?"/":"").concat(r),this.preParams={},this.id=o,this.typeName=c,n&&(n===bt||n.prototype instanceof bt)&&(this.type=n)}var e,r,n,o,c,i,u;return X()(t,null,[{key:"factoryFor",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;if(!e)throw new Error("Entity type is necessary for resource factory.");return function(c){var i,u,a;if(this instanceof ft?(u=this,i=""):this instanceof t?(u=this.scope,i=this.path):this instanceof bt&&(u=this[st.resource].scope,i=this[st.resource].path),a=i+r,c){if(!at(c))throw new TypeError("ID must be a string.");a+="/".concat(encodeURIComponent(c))}return new(n?n(t):t)(u,a,e,c,o)}}}]),X()(t,[{key:"serialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.type&&t instanceof this.type?t.json():t}},{key:"deserialize",value:function(e){var r=this;if(e&&this.type){if(Array.isArray(e))return"object"===pt()(e[0])?e.map(this.deserialize.bind(this)):e;if(!e.body){var n=this.path;e.id&&-1===n.indexOf(e.id)&&(n+="/".concat(e.id));var o=new t(this.scope,n,this.type);return new(0,this.type)(o,e)}e.deserialize=function(){return e.json().then(r.deserialize.bind(r))}}return e}},{key:"setWithScopes",value:function(){return this.preParams.withScopes=!0,this}},{key:"setContext",value:function(){return this.preParams.context=!0,this}},{key:"setPerPage",value:function(t){return this.preParams.perPage=t,this}},{key:"setProject",value:function(t){return this.preParams.project=t,this}},{key:"setFilter",value:function(t){return this.preParams.filter=t,this}},{key:"setIds",value:function(t){return this.preParams.ids=t,this}},{key:"create",value:function(t,e,r){if(!t||R(t))throw new TypeError("Create method must have payload.");var n={url:e&&e.url?e.url:this.path,data:t,method:"post"};return this._request(n,e,r)}},{key:"read",value:function(t,e){return this._request({url:this.path,method:"get"},t,e)}},{key:"update",value:function(t,e,r){if(!t||R(t))throw new TypeError("Update method must have payload.");return this._request({url:this.path,data:t,method:"put"},e,r)}},{key:"delete",value:function(t,e){return this._request({url:this.path,method:"delete"},t,e)}},{key:"pages",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return dt()(a().mark((function r(){var n,o;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.fullResponse,r.next=3,yt()(t._linkRequest({url:t.path},n,e));case 3:return o=r.sent,r.next=6,o.result;case 6:if(!o.next){r.next=14;break}return r.next=9,yt()(t._linkRequest({apiUrl:o.next},n));case 9:return o=r.sent,r.next=12,o.result;case 12:r.next=6;break;case 14:case"end":return r.stop()}}),r)})))()}},{key:"rescope",value:(u=f()(a().mark((function t(e,r){var n,o,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}throw new Error("An array of project IDs to be scoped to must be provided");case 2:return n={withScopes:!0},t.next=5,this.read({params:n});case 5:return o=t.sent,(c=o.scopes).projects=e,Array.isArray(r)&&(c.users=r),t.abrupt("return",this.update({scopes:c}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"upsert",value:(i=f()(a().mark((function t(e,r,n){var o,c,i,u,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r&&("string"==typeof r||"object"===pt()(r))){t.next=2;break}throw new Error("updateKey must be a 'name' string or an object, eg: { shortId: 'a7ysf8hd' }");case 2:return o={filter:"name=".concat(r)},"object"===pt()(r)&&(c=k()(Object.entries(r)[0],2),i=c[0],u=c[1],o.filter="identifiers.".concat(i,"=").concat(u)),t.next=6,this.read({params:o});case 6:if(!((s=t.sent).length>1)){t.next=10;break}if(n){t.next=10;break}throw new Error("More than one resource was found. Set 'allowPlural' to 'true' as third parameter to update the first returned.");case 10:if(!s.length){t.next=12;break}return t.abrupt("return",s[0].update(e));case 12:return t.abrupt("return",this.create(e));case 13:case"end":return t.stop()}}),t,this)}))),function(t,e,r){return i.apply(this,arguments)})},{key:"find",value:(c=f()(a().mark((function t(e){var r,n,o,c,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r={filter:"name=".concat(e)},"object"!==pt()(e)){t.next=7;break}if(!((n=Object.entries(e)).length>1)){t.next=5;break}throw new Error("Only one key-value pair may be specified for find()");case 5:o=k()(n[0],2),c=o[0],i=o[1],r.filter="identifiers.".concat(c,"=").concat(i);case 7:return t.abrupt("return",this.read({params:r}));case 8:case"end":return t.stop()}}),t,this)}))),function(t){return c.apply(this,arguments)})},{key:"stream",value:(o=f()(a().mark((function t(e){var r,n,o,c,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=this.pages(),n=0;case 2:return t.next=4,r.next();case 4:if((o=t.sent).done){t.next=18;break}i=0;case 6:if(!(i<o.value.length)){t.next=15;break}if("boolean"!=typeof c||!c){t.next=9;break}return t.abrupt("return");case 9:return t.next=11,e(o.value[i],n+i);case 11:c=t.sent;case 12:i+=1,t.next=6;break;case 15:n+=o.value.length,t.next=2;break;case 18:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"streamPages",value:(n=f()(a().mark((function t(e){var r,n,o,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=this.pages(),n=0;case 2:return t.next=4,r.next();case 4:if((o=t.sent).done){t.next=13;break}return t.next=7,e(o.value,n);case 7:if(c=t.sent,n+=o.value.length,"boolean"!=typeof c||!c){t.next=11;break}return t.abrupt("return");case 11:t.next=2;break;case 13:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"_request",value:(r=f()(a().mark((function t(e){var r,n,o,c,i,u=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},n=u.length>2?u[2]:void 0,R(r)&&(n=r),!(o=Object.assign({},r,e,{apiKey:this.scope.apiKey})).body){t.next=8;break}return t.next=7,this.serialize(o.body);case 7:o.body=t.sent;case 8:return Object.keys(this.preParams).length&&(Object.assign(o,{params:this.preParams}),this.preParams={}),t.prev=9,t.next=12,C(o);case 12:return c=t.sent,t.next=15,this.deserialize(c);case 15:return i=t.sent,t.abrupt("return",K(n)(i));case 19:throw t.prev=19,t.t0=t.catch(9),B(n)(t.t0);case 22:case"end":return t.stop()}}),t,this,[[9,19]])}))),function(t){return r.apply(this,arguments)})},{key:"_linkRequest",value:(e=f()(a().mark((function t(e,r){var n,o,c,i,u,s,f=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>2&&void 0!==f[2]?f[2]:{},o=Object.assign({fullResponse:!0},e),t.next=4,this._request(o,n);case 4:return c=t.sent,i=gt(c.headers.get("link")),u=i.next&&decodeURIComponent(i.next),t.next=9,r?c:c.json();case 9:return s=t.sent,t.abrupt("return",{result:s,next:u});case 11:case"end":return t.stop()}}),t,this)}))),function(t,r){return e.apply(this,arguments)})}]),t}(),bt=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if($()(this,t),!(e&&e instanceof mt))throw new Error("Resource must be a Resource.");this[st.resource]=e,Object.assign(this,r)}return X()(t,[{key:"json",value:function(){return Object.entries(this).reduce((function(t,e){var r=k()(e,2),n=r[0],o=r[1];return Object.assign(t,V()({},n,o))}),{})}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.json(),r=arguments.length>1?arguments[1]:void 0;return this[st.resource].update(e,r).then((function(e){return Object.assign(t,e),e}))}},{key:"delete",value:function(t){return this[st.resource].delete(t)}}]),t}(),wt=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{access:function(t){if(this instanceof ft)throw new Error("Access is not a top-level resource.");return mt.factoryFor(r,"/accesses").call(this,t)}}}}]),r}(bt),Rt="/domains",xt=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{domain:function(){if(at(arguments[0]))throw new TypeError("There is no single resource for Domains");if(this instanceof ft)throw new Error("Domain is not a top-level resource.");return mt.factoryFor(r,Rt).call(this)}}}}]),r}(bt),kt=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{operatorAccess:function(t){return mt.factoryFor(r,"/operatorAccess").call(this,t)}}}}]),r}(bt),Pt="/shortDomains",jt=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{shortDomain:function(){if(at(arguments[0]))throw new TypeError("There is no single resource for ShortDomains");if(this instanceof ft)throw new Error("ShortDomain is not a top-level resource.");return mt.factoryFor(r,Pt).call(this)}}}}]),r}(bt),Ot=r(319),St=r.n(Ot);function At(t){var e=t.map((function(t){return t.resourceFactory()})),r=Object.assign.apply(Object,[{}].concat(St()(e)));return function(t){return Dt(r)(function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return r}(t))}}function Dt(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function(r){var n=!0,o=!1,c=void 0;try{for(var i,u=Reflect.ownKeys(t)[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var a=i.value;Object.defineProperty(e?r.prototype:r,a,{value:t[a]})}}catch(t){o=!0,c=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw c}}return r}}var Et=At([xt,jt,wt,kt]),_t=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{sharedAccount:mt.factoryFor(r,"/accounts",Et)}}}]),r}(Et(bt)),Ft=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{event:mt.factoryFor(r,"/events")}}}]),r}(bt),Tt=At([Ft]),Ut=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{adiOrder:mt.factoryFor(r,"/adis/orders",Tt)}}}]),r}(Tt(bt)),It=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{property:function(t){var e=this instanceof ft?this[st.path]:"";return Object.assign(mt.factoryFor(r,e+"/properties").call(this,t),{create:function(){var t;return(t=mt.prototype.create).call.apply(t,[this].concat(St()(Lt.apply(void 0,arguments))))},update:function(){var t;return(t=mt.prototype.update).call.apply(t,[this].concat(St()(Lt.apply(void 0,arguments))))}})}}}}]),r}(bt);function Lt(t){at(t)||"number"==typeof t||"boolean"==typeof t?t=[{value:t}]:T(t)&&(t=t.hasOwnProperty("value")?[t]:Object.entries(t).map((function(t){return{key:t[0],value:t[1]}})));for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return[t].concat(r)}var Kt=r(249),Bt=r.n(Kt);function Ct(){return new Promise((function(t,e){if("undefined"==typeof window||!window.navigator.geolocation)throw new Error("Geolocation API not available.");window.navigator.geolocation.getCurrentPosition(t,(function(t){return e(t)}),{maximumAge:3e5,timeout:1e4,enableHighAccuracy:!0})}))}const qt=function(t){return void 0===t};var Nt=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{action:function(t,e){if(!t)throw new TypeError("Action type cannot be empty.");if(!at(t))throw new TypeError("Action type must be a name string");var n="/actions/:type".replace(":type",t),o=this;return Object.assign(mt.factoryFor(r,n).call(this,e),{create:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Mt.call.apply(Mt,[this,o,t].concat(r))}})}}}}]),r}(bt);function Mt(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];var c=Gt.apply(void 0,n),i=Bt()(c),u=i[0],a=i.slice(1),s=k()(a,1),f=s[0];u=Array.isArray(u)?u.map((function(r){return zt(r,t,e)})):u=zt(u,t,e);var l=mt.prototype.create.bind(this),p=function(){return[u].concat(St()(a))};return Ht(f)?Ct().then((function(t){return u=Vt(u,t),l.apply(void 0,St()(p()))})).catch((function(t){return console.info("Unable to get position: ".concat(t)),l.apply(void 0,St()(p()))})):l.apply(void 0,St()(p()))}function Gt(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=e[0];return(qt(n)||R(n))&&e.unshift({}),e}function zt(t,e,r){var n=Object.assign({},t);n.type="all"!==r?r:t.type||"";var o=function(t){return t instanceof bt&&t[st.actionIdentifier]?t[st.actionIdentifier]:""}(e);return o&&(n[o]=e.id),n}function Ht(e){return e&&!qt(e.geolocation)?e.geolocation:t.geolocation}function Vt(t,e){var r=Object.assign({},t);return r.location={latitude:e.coords.latitude,longitude:e.coords.longitude},r.locationSource="sensor",r}var Jt=function(e){tt()(n,e);var r=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(n);function n(){return $()(this,n),r.apply(this,arguments)}return X()(n,null,[{key:"resourceFactory",value:function(){return{redirection:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.defaultShortDomain;if(this instanceof ft)throw new Error("Redirection is not a top-level resource.");var r=this,n=function(){var t=f()(a().mark((function t(n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mt.prototype._request.call(r,Object.assign({apiUrl:"https://".concat(e),url:"/redirections",headers:{Accept:"application/json"}},n)));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();return{create:function(t){return f()(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.evrythngId=r.id,t.type=r.typeName,e.abrupt("return",n({method:"post",body:JSON.stringify(t)}));case 3:case"end":return e.stop()}}),e)})))()},read:function(){return f()(a().mark((function t(){var e,o,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n({params:{evrythngId:r.id}});case 2:return e=t.sent,o=k()(e,1),c=o[0],t.abrupt("return",c);case 6:case"end":return t.stop()}}),t)})))()},update:function(t){var e=this;return f()(a().mark((function r(){var o;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.read();case 2:if(o=r.sent){r.next=5;break}return r.abrupt("return",e.create(t));case 5:return r.abrupt("return",n({url:"/redirections/".concat(o.shortId),method:"put",body:JSON.stringify(t)}));case 6:case"end":return r.stop()}}),r)})))()},delete:function(){var t=this;return f()(a().mark((function e(){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.read();case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return",Promise.resolve());case 5:return e.abrupt("return",n({url:"/redirections/".concat(r.shortId),method:"delete"}));case 6:case"end":return e.stop()}}),e)})))()}}}}}}]),n}(bt),$t=At([It,Nt,Jt]),Wt=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{product:mt.factoryFor(r,"/products",$t,"product")}}}]),r}($t(bt)),Xt="/commissionState",Yt=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{commissionState:function(){if(at(arguments[0]))throw new TypeError("There is no single resource for CommissionState");var t=this instanceof ft?this[st.path]:"";return mt.factoryFor(r,t+Xt).call(this)}}}}]),r}(bt),Qt="/location",Zt=function(t){tt()(r,t);var e=function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}return function(){var r,n=it()(t);if(e()){var o=it()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return rt()(this,r)}}(r);function r(){return $()(this,r),e.apply(this,arguments)}return X()(r,null,[{key:"resourceFactory",value:function(){return{locations:function(){if(at(arguments[0]))throw new TypeError("There is no single resource for Locations");var t=this instanceof ft?this[st.path]:"";return Object.assign(mt.factoryFor(r,t+Qt).call(this),{update:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return te.call.apply(te,[this].concat(e))}})}}}}]),r}(bt);function te(){var t=ee.apply(void 0,arguments),e=Bt()(t),r=e[0],n=e.slice(1),o=mt.prototype.update.bind(this),c=function(){return[r].concat(St()(n))};return re(r)?Ct().then((function(t){return r[0]=ne(r[0],t),o.apply(void 0,St()(c()))})).catch((function(t){return console.info("Unable to get position: ".concat(t)),o.apply(void 0,St()(c()))})):o.apply(void 0,St()(c()))}function ee(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=e[0];return T(n)?e[0]=[n]:(qt(n)||R(n))&&e.unshift([]),e}function re(e){return 0===e.length&&t.geoloca