UNPKG

@memberjunction/react-runtime

Version:

Platform-agnostic React component runtime for MemberJunction. Provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.

2 lines 710 kB
/*! For license information please see runtime.umd.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MJReactRuntime=t():e.MJReactRuntime=t()}(this,(()=>(()=>{var __webpack_modules__={3815:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6298:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3288:(e,t,r)=>{"use strict";function n(e){return n="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},n(e)}function o(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(){i=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",s=u.asyncIterator||"@@asyncIterator",l=u.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,i=Object.create(o.prototype),u=new L(n||[]);return a(i,"_invoke",{value:C(e,r,u)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var y="suspendedStart",h="suspendedYield",v="executing",m="completed",b={};function g(){}function w(){}function _(){}var O={};f(O,c,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(T([])));E&&E!==r&&o.call(E,c)&&(O=E);var P=_.prototype=g.prototype=Object.create(O);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(i,a,u,c){var s=d(e[i],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,c)}),(function(e){r("throw",e,u,c)})):t.resolve(f).then((function(e){l.value=e,u(l)}),(function(e){return r("throw",e,u,c)}))}c(s.arg)}var i;a(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function C(t,r,n){var o=y;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===b)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=d(t,r,n);if("normal"===s.type){if(o=n.done?m:h,s.arg===b)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function k(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=d(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,b):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function T(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(o.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=_,a(P,"constructor",{value:_,configurable:!0}),a(_,"constructor",{value:w,configurable:!0}),w.displayName=f(_,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(x.prototype),f(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(p(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},j(P),f(P,l,"Generator"),f(P,c,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=T,L.prototype={constructor:L,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(I),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),b},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:T(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),b}},t}function a(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=u(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function u(e,t){if(e){if("string"==typeof e)return c(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function f(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}function p(e,t,r){return t=y(t),function(e,t){if(t&&("object"==n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,r||[],y(e).constructor):t.apply(e,r))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(d=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ComponentSpecRuntime=void 0;var v=r(6517),m=r(600),b=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),r=t,n=[{key:"GetRequiredPermissions",value:function(){var e,t=new Set;return null===(e=this.dataRequirements)||void 0===e||e.entities.forEach((function(e){e.permissionLevelNeeded.forEach((function(e){return t.add(e)}))})),Array.from(t)}},{key:"IsEffectivelyReadOnly",value:function(){var e=this.GetRequiredPermissions();return 1===e.length&&"read"===e[0]}},{key:"GetAccessedEntities",value:function(){var e;return(null===(e=this.dataRequirements)||void 0===e?void 0:e.entities.map((function(e){return e.name})))||[]}},{key:"HasWriteCapabilities",value:function(){return this.GetRequiredPermissions().some((function(e){return"create"===e||"update"===e||"delete"===e}))}},{key:"convertToEntityPermissionType",value:function(e){switch(e){case"read":default:return m.EntityPermissionType.Read;case"create":return m.EntityPermissionType.Create;case"update":return m.EntityPermissionType.Update;case"delete":return m.EntityPermissionType.Delete}}},{key:"ValidateUserPermissions",value:(c=i().mark((function e(t){var r,n,o,u,c,s,l;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],o=[],u=new m.Metadata,c=a((null===(r=this.dataRequirements)||void 0===r?void 0:r.entities)||[]),e.prev=4,l=i().mark((function e(){var r,o,c,l,f,p,d,y,h,v;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=s.value,o=u.Entities.find((function(e){return e.Name===r.name}))){e.next=6;break}c=a(r.permissionLevelNeeded);try{for(c.s();!(l=c.n()).done;)f=l.value,n.push({entity:r.name,permission:f})}catch(e){c.e(e)}finally{c.f()}return e.abrupt("return",1);case 6:p=o.GetUserPermisions(t),d=a(r.permissionLevelNeeded),e.prev=8,d.s();case 10:if((y=d.n()).done){e.next=27;break}h=y.value,v=!1,e.t0=h,e.next="read"===e.t0?16:"create"===e.t0?18:"update"===e.t0?20:"delete"===e.t0?22:24;break;case 16:return v=p.CanRead,e.abrupt("break",24);case 18:return v=p.CanCreate,e.abrupt("break",24);case 20:return v=p.CanUpdate,e.abrupt("break",24);case 22:return v=p.CanDelete,e.abrupt("break",24);case 24:v||n.push({entity:r.name,permission:h});case 25:e.next=10;break;case 27:e.next=32;break;case 29:e.prev=29,e.t1=e.catch(8),d.e(e.t1);case 32:return e.prev=32,d.f(),e.finish(32);case 35:case"end":return e.stop()}}),e,null,[[8,29,32,35]])})),c.s();case 7:if((s=c.n()).done){e.next=13;break}return e.delegateYield(l(),"t0",9);case 9:if(!e.t0){e.next=11;break}return e.abrupt("continue",11);case 11:e.next=7;break;case 13:e.next=18;break;case 15:e.prev=15,e.t1=e.catch(4),c.e(e.t1);case 18:return e.prev=18,c.f(),e.finish(18);case 21:return e.abrupt("return",{canRender:0===n.length,missingPermissions:n,degradedPermissions:o});case 22:case"end":return e.stop()}}),e,this,[[4,15,18,21]])})),f=function(){var e=this,t=arguments;return new Promise((function(r,n){var o=c.apply(e,t);function i(e){s(o,r,n,i,a,"next",e)}function a(e){s(o,r,n,i,a,"throw",e)}i(void 0)}))},function(e){return f.apply(this,arguments)})},{key:"GetDataAccessSummary",value:function(){var e,t,r,n=(null===(e=this.dataRequirements)||void 0===e?void 0:e.entities.map((function(e){return{name:e.name,permissions:e.permissionLevelNeeded}})))||[],o=(null===(t=this.dataRequirements)||void 0===t?void 0:t.queries.map((function(e){return{name:e.name,category:e.categoryPath}})))||[];return{mode:(null===(r=this.dataRequirements)||void 0===r?void 0:r.mode)||"none",entityCount:n.length,queryCount:o.length,requiresWrite:this.HasWriteCapabilities(),entities:n,queries:o}}},{key:"GetLibraryDependencies",value:function(){return this.libraries||[]}},{key:"DependsOnLibrary",value:function(e){var t;return(null===(t=this.libraries)||void 0===t?void 0:t.some((function(t){return t.name===e||t.globalVariable===e})))||!1}},{key:"GetAllDependencies",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set,r=[];if(e.has(this.name))return r;e.add(this.name);var n,i=a(this.dependencies||[]);try{for(i.s();!(n=i.n()).done;){var u=n.value;r.push(u),u instanceof t&&r.push.apply(r,o(u.GetAllDependencies(e)))}}catch(e){i.e(e)}finally{i.f()}return r}}],u=[{key:"FromObject",value:function(e){var r=new t;return Object.assign(r,e),r}},{key:"FromJSON",value:function(e){var r=JSON.parse(e);return t.FromObject(r)}}],n&&l(r.prototype,n),u&&l(r,u),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,u,c,f}(v.ComponentSpec);t.ComponentSpecRuntime=b},6517:(e,t)=>{"use strict";function r(e){return 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},r(e)}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}Object.defineProperty(t,"__esModule",{value:!0}),t.ComponentSpec=void 0;var a=o((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}));t.ComponentSpec=a},6589:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7890:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(6589),t),o(r(3815),t),o(r(1514),t),o(r(7677),t),o(r(6298),t),o(r(8988),t),o(r(6517),t),o(r(3288),t),o(r(1823),t)},1823:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1514:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7677:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8988:(e,t)=>{"use strict";function r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e,t){var n="/*******************************************************\n ".concat(t?"".concat(t," > "):"").concat(e.name,"\n ").concat(e.description,"\n*******************************************************/\n")+e.code;if(!e.dependencies||0===e.dependencies.length)return n;var i,a=r(e.dependencies);try{for(a.s();!(i=a.n()).done;){var u=i.value,c=o(u,t+(t?" > ":"")+u.name);c&&c.length>0&&(n+="\n\n"+c)}}catch(e){a.e(e)}finally{a.f()}return n}Object.defineProperty(t,"__esModule",{value:!0}),t.BuildComponentCode=t.BuildComponentCompleteCode=void 0,t.BuildComponentCompleteCode=function(e){var t=e.code||"// Generation Error: No root component code provided! \n\n";if(!e.dependencies||0===e.dependencies.length)return t;var n,i=r(e.dependencies);try{for(i.s();!(n=i.n()).done;){var a=o(n.value,"");a&&a.length>0&&(t+="\n\n"+a)}}catch(e){i.e(e)}finally{i.f()}return t},t.BuildComponentCode=o},8702:(e,t,r)=>{"use strict";function n(e){return n="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},n(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function c(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}Object.defineProperty(t,"__esModule",{value:!0}),t.QueryCache=void 0;var s=r(4423),l=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cache=new Map,this.accessOrder=[],this.DEFAULT_MAX_SIZE=1e3,this.DEFAULT_TTL_MINUTES=60,this.stats={hits:0,misses:0,evictions:0,expirations:0}},t=[{key:"getCacheKey",value:function(e,t){var r=Object.keys(t).sort().reduce((function(e,r){return e[r]=t[r],e}),{});return"".concat(e,":").concat(JSON.stringify(r))}},{key:"get",value:function(e,t,r){if(!r.enabled)return null;var n=this.getCacheKey(e,t),o=this.cache.get(n);return o?Date.now()>o.timestamp+60*o.ttlMinutes*1e3?(this.cache.delete(n),this.removeFromAccessOrder(n),this.stats.expirations++,this.stats.misses++,null):(this.updateAccessOrder(n),o.hitCount++,this.stats.hits++,o):(this.stats.misses++,null)}},{key:"set",value:function(e,t,r,n){if(n.enabled){var o=this.getCacheKey(e,t),i=n.maxCacheSize||this.DEFAULT_MAX_SIZE;if(this.cache.size>=i&&!this.cache.has(o)){var a=this.accessOrder.shift();a&&(this.cache.delete(a),this.stats.evictions++,(0,s.LogStatus)("Cache eviction: Removed LRU entry for key ".concat(a)))}var u={queryId:e,parameters:t,results:r,timestamp:Date.now(),ttlMinutes:n.ttlMinutes||this.DEFAULT_TTL_MINUTES,hitCount:0};this.cache.set(o,u),this.updateAccessOrder(o)}}},{key:"clear",value:function(e){var t=this;if(e){var r=Array.from(this.cache.keys()).filter((function(t){return t.startsWith("".concat(e,":"))}));r.forEach((function(e){t.cache.delete(e),t.removeFromAccessOrder(e)})),(0,s.LogStatus)("Cleared ".concat(r.length," cache entries for query ").concat(e))}else{var n=this.cache.size;this.cache.clear(),this.accessOrder=[],(0,s.LogStatus)("Cleared entire query cache (".concat(n," entries)"))}}},{key:"updateAccessOrder",value:function(e){var t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1),this.accessOrder.push(e)}},{key:"removeFromAccessOrder",value:function(e){var t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1)}},{key:"getStats",value:function(){var e=this.stats.hits+this.stats.misses,t=e>0?this.stats.hits/e:0;return{size:this.cache.size,hits:this.stats.hits,misses:this.stats.misses,hitRate:Math.round(100*t)/100,evictions:this.stats.evictions,expirations:this.stats.expirations}}},{key:"cleanupExpired",value:function(){var e,t=Date.now(),r=0,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(e))){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(this.cache.entries());try{for(n.s();!(e=n.n()).done;){var a=o(e.value,2),u=a[0],c=a[1];t>c.timestamp+60*c.ttlMinutes*1e3&&(this.cache.delete(u),this.removeFromAccessOrder(u),r++)}}catch(e){n.e(e)}finally{n.f()}return r>0&&(0,s.LogStatus)("Cleaned up ".concat(r," expired cache entries")),r}}],t&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();t.QueryCache=l},588:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4472:(e,t,r)=>{"use strict";function n(e){return n="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},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function i(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t,r){return t=l(t),function(e,t){if(t&&("object"==n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ApplicationInfo=t.ApplicationEntityInfo=t.ApplicationSettingInfo=void 0;var d=r(5485),y=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return u(this,t),(e=c(this,t)).ID=null,e.ApplicationName=null,e.Name=null,e.Value=null,e.Comments=null,e.__mj_CreatedAt=null,e.__mj_UpdatedAt=null,e.copyInitData(r),e}return f(t,e),i(t)}(d.BaseInfo);t.ApplicationSettingInfo=y;var h=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return u(this,t),(e=c(this,t)).ID=null,e.ApplicationName=null,e.EntityID=null,e.Sequence=null,e.DefaultForNewUser=null,e.Application=null,e.Entity=null,e.EntityBaseTable=null,e.EntityCodeName=null,e.EntityClassName=null,e.EntityBaseTableCodeName=null,e._EntityInfo=null,e.copyInitData(r),e}return f(t,e),i(t,[{key:"EntityInfo",get:function(){return this._EntityInfo}},{key:"_setEntity",value:function(e){this._EntityInfo=e}}])}(d.BaseInfo);t.ApplicationEntityInfo=h;var v=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1?arguments[1]:void 0;if(u(this,t),(e=c(this,t)).ID=null,e.Name=null,e.Description=null,e.Icon=null,e.DefaultForNewUser=null,e.SchemaAutoAddNewEntities=null,e._ApplicationEntities=[],e._ApplicationSettings=[],e.copyInitData(r),r){var o=r.ApplicationEntities||r._ApplicationEntities;if(o){var i=n.Entities;e._ApplicationEntities=[];for(var a=function(t){var r=new h(o[t]);e._ApplicationEntities.push(r);var n=i.find((function(e){return e.ID==o[t].EntityID}));n&&r._setEntity(n)},s=0;s<o.length;s++)a(s)}var l=r.ApplicationSettings||r._ApplicationSettings;l&&(e._ApplicationSettings=l.map((function(e){return new y(e)})))}return e}return f(t,e),i(t,[{key:"ApplicationEntities",get:function(){return this._ApplicationEntities}},{key:"ApplicationSettings",get:function(){return this._ApplicationSettings}}])}(d.BaseInfo);t.ApplicationInfo=v},2217:(e,t,r)=>{"use strict";function n(e){return n="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},n(e)}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}Object.defineProperty(t,"__esModule",{value:!0}),t.AuthorizationEvaluator=void 0;var u=r(5949),c=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"CurrentUserCanExecute",value:function(e){var t=new u.Metadata;if(!t.CurrentUser)throw new Error("No current user is set for authorization evaluation");return this.UserCanExecute(e,t.CurrentUser)}},{key:"UserCanExecute",value:function(e,t){return e.UserCanExecute(t)}},{key:"GetUserAuthorizations",value:function(e){var t=new u.Metadata,r=[];if(e&&e.UserRoles){var n,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(t.Authorizations);try{for(i.s();!(n=i.n()).done;){var a=n.value;a.UserCanExecute(e)&&r.push(a)}}catch(e){i.e(e)}finally{i.f()}return r}throw new Error("User must be provided to evaluate authorizations")}}])&&i(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();t.AuthorizationEvaluator=c},2745:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AUTH_PROVIDER_TYPES=void 0,t.AUTH_PROVIDER_TYPES={MSAL:"msal",AUTH0:"auth0",OKTA:"okta",COGNITO:"cognito",GOOGLE:"google",CUSTOM:"custom"}},4183:(e,t,r)=>{"use strict";function n(e){return n="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},n(e)}function o(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){c=!0,i=e},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw i}}}}function a(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(){c=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),u=new L(n||[]);return i(a,"_invoke",{value:C(e,r,u)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var y="suspendedStart",h="suspendedYield",v="executing",m="completed",b={};function g(){}function w(){}function _(){}var O={};f(O,u,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(T([])));E&&E!==r&&o.call(E,u)&&(O=E);var P=_.prototype=g.prototype=Object.create(O);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(i,a,u,c){var s=d(e[i],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,c)}),(function(e){r("throw",e,u,c)})):t.resolve(f).then((function(e){l.value=e,u(l)}),(function(e){return r("throw",e,u,c)}))}c(s.arg)}var a;i(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function C(t,r,n){var o=y;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===b)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=d(t,r,n);if("normal"===s.type){if(o=n.done?m:h,s.arg===b)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function k(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,k(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=d(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,b):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function T(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(o.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=_,i(P,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=f(_,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(x.prototype),f(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(p(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},j(P),f(P,l,"Generator"),f(P,u,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=T,L.prototype={constructor:L,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(I),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),b},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:T(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),b}},t}function s(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function l(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){s(i,n,o,a,u,"next",e)}function u(e){s(i,n,o,a,u,"throw",e)}a(void 0)}))}}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function p(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t,r){return t=m(t),function(e,t){if(t&&("object"==n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,v()?Reflect.construct(t,r||[],m(e).constructor):t.apply(e,r))}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(v=function(){return!!e})()}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.BaseEngine=t.BaseEnginePropertyConfig=void 0;var w=r(5120),_=r(4802),O=r(3664),S=r(4593),E=r(4423),P=r(5949),j=r(5788),x=r(5485),C=r(7074),k=function(e){function t(e){var r;return y(this,t),(r=h(this,t)).Type="entity",r.DatasetResultHandling="single_property",r.AutoRefresh=!0,e&&Object.assign(r,e),r}return b(t,e),p(t)}(x.BaseInfo);t.BaseEnginePropertyConfig=k;var A=function(e){function t(){var e;return y(this,t),(e=h(this,t))._loaded=!1,e._loadingSubject=new _.BehaviorSubject(!1),e._metadataConfigs=[],e._dynamicConfigs=new Map,e._dataMap=new Map,e._expirationTimers=new Map,e._entityEventSubjects=new Map,e._entityEventDebounceTime=5e3,e}return b(t,e),p(t,[{key:"ProviderToUse",get:function(){return this._provider||P.Metadata.Provider}},{key:"RunViewProviderToUse",get:function(){return this.ProviderToUse}},{key:"Configs",get:function(){return JSON.parse(JSON.stringify(this._metadataConfigs))}},{key:"Load",value:(T=l(c().mark((function e(t,r){var n,o,i=this,a=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>2&&void 0!==a[2]&&a[2],o=a.length>3?a[3]:void 0,this.ProviderToUse.ProviderType!==j.ProviderType.Database||o){e.next=4;break}throw new Error("For server-side use of all engine classes, you must provide the contextUser parameter");case 4:if(!this._loadingSubject.value){e.next=6;break}return e.abrupt("return",new Promise((function(e){var t=i._loadingSubject.subscribe((function(r){r||(t.unsubscribe(),e())}))})));case 6:if(this._loaded&&!n){e.next=26;break}return this._loadingSubject.next(!0),e.prev=8,this.SetProvider(r),this._contextUser=o,e.next=13,this.LoadConfigs(t,o);case 13:return e.next=15,this.AdditionalLoading(o);case 15:return e.next=17,this.SetupGlobalEventListener();case 17:this._loaded=!0,e.next=23;break;case 20:e.prev=20,e.t0=e.catch(8),(0,E.LogError)(e.t0);case 23:return e.prev=23,this._loadingSubject.next(!1),e.finish(23);case 26:case"end":return e.stop()}}),e,this,[[8,20,23,26]])}))),function(e,t){return T.apply(this,arguments)})},{key:"SetProvider",value:function(e){this._provider=e,this.CheckAddToProviderInstances(this.ProviderToUse)}},{key:"CheckAddToProviderInstances",value:function(e){var r=this;t.ProviderInstances.find((function(t){return t.provider===e&&t.subclassConstructor===r.constructor}))||t.ProviderInstances.push({provider:e,subclassConstructor:this.constructor,instance:this})}},{key:"SetupGlobalEventListener",value:(L=l(c().mark((function e(){var t=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,this._eventListener||(this._eventListener=w.MJGlobal.Instance.GetEventListener(!1),this._eventListener.subscribe(function(){var e=l(c().mark((function e(r){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.HandleIndividualEvent(r);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())),e.next=8;break;case 4:return e.prev=4,e.t0=e.catch(0),(0,E.LogError)(e.t0),e.abrupt("return",!1);case 8:case"end":return e.stop()}}),e,this,[[0,4]])}))),function(){return L.apply(this,arguments)})},{key:"HandleIndividualEvent",value:(I=l(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.event!==w.MJEventType.ComponentEvent||t.eventCode!==C.BaseEntity.BaseEventCode){e.next=5;break}return r=t.args,e.next=4,this.HandleIndividualBaseEntityEvent(r);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"HandleIndividualBaseEntityEvent",value:(A=l(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"delete"!==t.type&&"save"!==t.type){e.next=6;break}if(r=t.baseEntity.EntityInfo.Name.toLowerCase().trim(),!this.Configs.some((function(e){return e.AutoRefresh&&e.EntityName&&e.EntityName.trim().toLowerCase()===r}))){e.next=6;break}return e.abrupt("return",this.DebounceIndividualBaseEntityEvent(t));case 6:return e.abrupt("return",!0);case 9:return e.prev=9,e.t0=e.catch(0),(0,E.LogError)(e.t0),e.abrupt("return",!1);case 13:case"end":return e.stop()}}),e,this,[[0,9]])}))),function(e){return A.apply(this,arguments)})},{key:"DebounceIndividualBaseEntityEvent",value:(x=l(c().mark((function e(t){var r,n,o=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=t.baseEntity.EntityInfo.Name.toLowerCase().trim(),this._entityEventSubjects.has(r)||((n=new _.Subject).pipe((0,O.debounceTime)(this.EntityEventDebounceTime)).subscribe(function(){var e=l(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.ProcessEntityEvent(t);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),this._entityEventSubjects.set(r,n)),this._entityEventSubjects.get(r).next(t),e.abrupt("return",!0);case 7:return e.prev=7,e.t0=e.catch(0),(0,E.LogError)(e.t0),e.abrupt("return",!1);case 11:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return x.apply(this,arguments)})},{key:"EntityEventDebounceTime",get:function(){return this._entityEventDebounceTime}},{key:"ProcessEntityEvent",value:(g=l(c().mark((function e(t){var r,n,o,a,u,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,r=t.baseEntity.EntityInfo.Name.toLowerCase().trim(),n=0,o=i(this.Configs),e.prev=4,o.s();case 6:if((a=o.n()).done){e.next=14;break}if(!(s=a.value).AutoRefresh||"entity"!==s.Type||(null===(u=s.EntityName)||void 0===u?void 0:u.trim().toLowerCase())!==r){e.next=12;break}return e.next=11,this.LoadSingleConfig(s,this._contextUser);case 11:n++;case 12:e.next=6;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(4),o.e(e.t0);case 19:return e.prev=19,o.f(),e.finish(19);case 22:if(!(n>0)){e.next=25;break}return e.next=25,this.AdditionalLoading(this._contextUser);case 25:e.next=30;break;case 27:e.prev=27,e.t1=e.catch(0),(0,E.LogError)(e.t1);case 30:case"end":return e.stop()}}),e,this,[[0,27],[4,16,19,22]])}))),function(e){return g.apply(this,arguments)})},{key:"UpgradeObjectToConfig",value:function(e){return e instanceof k?e:new k(e)}},{key:"LoadConfigs",value:(m=l(c().mark((function e(t,r){var n,i,a=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._metadataConfigs=t.map((function(e){return a.UpgradeObjectToConfig(e)})),n=this._metadataConfigs.filter((function(e){return"entity"===e.Type})),i=this._metadataConfigs.filter((function(e){return"dataset"===e.Type})),e.next=5,Promise.all([].concat(o(i.map((function(e){return a.LoadSingleDatasetConfig(e,r)}))),[this.LoadMultipleEntityConfigs(n,r)]));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"LoadSingleConfig",value:(v=l(c().mark((function e(t,r){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("dataset"!==t.Type){e.next=6;break}return e.next=3,this.LoadSingleDatasetConfig(t,r);case 3:case 8:return e.abrupt("return",e.sent);case 6:return e.next=8,this.LoadSingleEntityConfig(t,r);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"LoadSingleEntityConfig",value:(d=l(c().mark((function e(t,r){var n,o,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.RunViewProviderToUse,o=new S.RunView(n),e.next=4,o.RunView({EntityName:t.EntityName,ResultType:"entity_object",ExtraFilter:t.Filter,OrderBy:t.OrderBy},r);case 4:i=e.sent,this.HandleSingleViewResult(t,i);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"HandleSingleViewResult",value:function(e,t){t.Success&&(!1!==e.AddToObject&&(this[e.PropertyName]=t.Results),this._dataMap.set(e.PropertyName,{entityName:e.EntityName,data:t.Results}),e.Expiration&&this.SetExpirationTimer(e.PropertyName,e.Expiration))}},{key:"LoadMultipleEntityConfigs",value:(f=l(c().mark((function e(t,r){var n,o,i,a,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t&&t.length>0)){e.next=8;break}return n=this.RunViewProviderToUse,o=new S.RunView(n),i=t.map((function(e){return{EntityName:e.EntityName,ResultType:"entity_object",ExtraFilter:e.Filter,OrderBy:e.OrderBy}})),e.next=6,o.RunViews(i,r);case 6:for(a=e.sent,u=0;u<t.length;u++)this.HandleSingleViewResult(t[u],a[u]);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"LoadSingleDatasetConfig",value:(s=l(c().mark((function e(t,r){var n,o,a,u,s,l,f,p,d,y,h,v,m,b;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.ProviderToUse,e.next=3,n.GetAndCacheDatasetByName(t.DatasetName,t.DatasetItemFilters);case 3:if(!(o=e.sent).Success){e.next=52;break}if(!1===t.AddToObject){e.next=50;break}if("single_property"!==t.DatasetResultHandling){e.next=48;break}a={},u=i(o.Results),e.prev=9,u.s();case 11:if((s=u.n()).done){e.next=37;break}l=s.value,f=[],p=i(l.Results),e.prev=15,p.s();case 17: