@ema/js-base-library
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.0.
2 lines • 37.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("@ema/js-base-library",["exports"],t):t((e.ema=e.ema||{},e.ema["js-base-library"]={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(t,a,s,u){return new(s||(s=Promise))(function(e,n){function r(e){try{i(u.next(e))}catch(t){n(t)}}function o(e){try{i(u["throw"](e))}catch(t){n(t)}}function i(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(r,o)}i((u=u.apply(t,a||[])).next())})}function s(r,o){var i,a,s,e,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return e={next:t(0),"throw":t(1),"return":t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function n(e){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,a&&(s=2&e[0]?a["return"]:e[0]?a["throw"]||((s=a["return"])&&s.call(a),0):a.next)&&!(s=s.call(a,e[1])).done)return s;switch(a=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,a=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){u.label=e[1];break}if(6===e[0]&&u.label<s[1]){u.label=s[1],s=e;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(e);break}s[2]&&u.ops.pop(),u.trys.pop();continue}e=o.call(r,u)}catch(t){e=[6,t],a=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([t,e])}}}function n(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i["return"])&&n.call(i)}finally{if(o)throw o.error}}return a}function u(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(n(arguments[t]));return e}var t=function(){function e(){this.headers={},this.routes={},this.baseUrl="/api",this.idField="id",this.requestCredentials="same-origin",this.corsMode="same-origin",this.cachePolicy="no-cache",this.entities={},this.hasDebugger=!1}return e.prototype.init=function(e){var t=this;if(this.settings=e,this.settings.host&&(this.baseUrl=e.host),this.settings.routes&&this.initApiRoutes(this.settings.routes),this.settings.headers){var n=this;this.settings.headers.forEach(function(e){for(var t in e)n.headers[t]=e[t]})}this.httpHeaders&&Object.keys(this.headers).forEach(function(e){t.httpHeaders.set(e,t.headers[e])})},e.prototype.route=function(t){var n,r=this;return Object.keys(this.routes).forEach(function(e){e===t&&(n=r.routes[e])}),n||t},e.prototype.post=function(t,n){return a(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,fetch(""+this.baseUrl+t,{body:JSON.stringify(n),cache:this.cachePolicy,credentials:this.requestCredentials,headers:this.headers,mode:this.corsMode,method:"POST"}).then(function(e){return 400<=e.status?(console.log(e),console.error("Bad response from server"),e):e.json()})["catch"](this.errorHandler).then(function(e){return e})];case 1:return[2,e.sent()]}})})},e.prototype.get=function(t,n){return void 0===n&&(n=undefined),a(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return n&&(t+="?",Object.keys(n).forEach(function(e){return t+=e+"="+n[e]+"&"})),[4,fetch(""+this.baseUrl+t,{cache:this.cachePolicy,credentials:this.requestCredentials,headers:this.headers,mode:this.corsMode,method:"GET"}).then(function(e){return 400<=e.status?(console.log(e),console.log("Bad response from server"),e):e.json()})["catch"](this.errorHandler).then(function(e){return e})];case 1:return[2,e.sent()]}})})},e.prototype.patch=function(t,n,r){return a(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,fetch(""+this.baseUrl+t+"/"+n,{headers:this.headers,method:"patch",body:JSON.stringify(r)})];case 1:return e.sent(),[2]}})})},e.prototype["delete"]=function(t,n){return a(this,void 0,void 0,function(){return s(this,function(e){return console.log(t,n),[2]})})},e.prototype.login=function(e,t){console.log(e,t.length)},e.prototype.logout=function(e,t){void 0===e&&(e="app:authData"),void 0===t&&(t=!1),this.clearCredentials(e),this.settings.authenticated=!1,t&&(location.href=location.href)},e.prototype.setCredentials=function(e,t){void 0===t&&(t="app-auth"),this.credentials=e,"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem(t,JSON.stringify(e))},e.prototype.getCredentials=function(e){if(void 0===e&&(e="app:authData"),"undefined"!=typeof window&&window.localStorage&&window.localStorage.getItem(e))return JSON.parse(window.localStorage.getItem(e))},e.prototype.clearCredentials=function(e){void 0===e&&(e="app:authData"),"undefined"!=typeof window&&window.localStorage.getItem(e)&&window.localStorage.removeItem(e)},e.prototype.initApiRoutes=function(e){var n=this;e.forEach(function(e){for(var t in e)n.routes[t]=e[t]}),n.settings.dev&&n.settings.routes_dev&&n.settings.routes_dev.forEach(function(e){for(var t in e)n.routes[t]=e[t]})},e.prototype.errorHandler=function(e){console.error(e)},e.prototype.saveLocalResource=function(e){localStorage.setItem(e[this.idField],e)},e.prototype.loadLocalResource=function(e){localStorage.getItem(e)&&localStorage.getItem(e)},e.prototype.flushLocalResource=function(e){localStorage.getItem(e)&&localStorage.removeItem(e)},e}(),c=function(t){function e(){var e=t.call(this)||this;return e.data={},e}return o(e,t),e.prototype.init=function(){return a(this,void 0,void 0,function(){return s(this,function(e){return[2]})})},e.prototype.render=function(){},e.prototype.definePublicMethods=function(){},e.prototype.remove=function(){},e.prototype.attributeChangedCallback=function(e,t,n){},e.prototype.connectedCallback=function(){var e,t=this;this.data={},e=this.shadowRoot?this.root=this.shadowRoot:this.root=this.attachShadow({mode:"open"}),this.el=e.appendChild(this.template.content.cloneNode(!0)),this.setState=this.setState.bind(this),this.getState=this.getState.bind(this),this.removeState=this.removeState.bind(this),this.getData=this.getData.bind(this),this.setData=this.setData.bind(this),this.definePublicMethods&&this.definePublicMethods(),this.init&&(this.init=this.init.bind(this)),this.dataJson&&(this.data=JSON.parse(this.dataJson)),this.init?this.init().then(function(){t.preRender()}):this.preRender()},Object.defineProperty(e.prototype,"template",{get:function(){if(this._template)return this._template;this._template=document.createElement("template");var e=document.createElement("style"),t=document.createElement("div"),n=document.createElement("head");return n.innerHTML=this.imports||"",e.innerHTML=this.styles||"",t.innerHTML=this.htmlTemplate||"",t.className="content",this._template.content.appendChild(e),this._template.content.appendChild(n),this._template.content.appendChild(t),this._template},enumerable:!0,configurable:!0}),e.prototype.declareProp=function(n,e,t){var r=this,o={};e||(e=function(){return null!==this.getAttribute(n)?this.getAttribute(n):""}),t||(t=function(e){this.setAttribute(n,e)}),"current-state"===n&&(t=function(e){r.isJson(e)?r.setState(JSON.parse(e)):r.setState({value:e}),r.sharedState?r.setAttribute(n,JSON.stringify(r.state)):r.setAttribute(n,e)}),"data-json"===n&&(t=function(e){var t=JSON.parse(e);Object.keys(t).forEach(function(e){r.data[e]=t[e]}),r.setAttribute(n,e)}),o[this.kebabToLowerCamelCase(n)]={get:e,set:t},Object.defineProperties(this,o)},e.prototype.dispatch=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))},e.prototype.setState=function(e){"string"!=typeof e||this.isJson(e)?("string"==typeof e&&this.isJson(e)&&(e=JSON.parse(e)),this.state=i({},this.state,e)):console.error("setState only accepts an object as argument")},e.prototype.getState=function(e){return e&&this.state[e]?JSON.parse(JSON.stringify(this.state[e])):JSON.parse(JSON.stringify(this.state))},e.prototype.removeState=function(e){e?delete this.state[e]:(this.state={},this.currentState="{}",this.preRender())},e.prototype.setData=function(n,e){var r=this;e?Object.keys(n).forEach(function(e,t){r.data[e]=n[e]}):this.data=n,this.preRender()},e.prototype.getData=function(){return this.data},e.prototype.preRender=function(){this.root&&(this.root.querySelector(".content").innerHTML=this.render())},e.prototype.isJson=function(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t)return t}catch(n){}return!1},e.prototype.kebabToLowerCamelCase=function(e){return(e.charAt(0).toLowerCase()+e.slice(1)).replace(/(\-\w)/g,function(e){return e[1].toUpperCase()})},e}(HTMLElement),d=function(){function t(){}return t.arrayRemoveValue=function(e,t){return e.filter(function(e){return e!=t})},t.arraySetUnique=function(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;var r=[];for(var o in t)r.push(o);return r},t.castToType=function(e){var t=e;return Number(t)&&"true"!==t&&"false"!==t&&(t=Number(t)),"0"===t&&(t=0),"true"===t&&(t=!0),"false"===t&&(t=!1),t},t.copy=function(e){return JSON.parse(JSON.stringify(e))},t.fetchJson=function(t){return a(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,fetch(t)["catch"](function(e){console.error(e)})];case 1:return[4,e.sent().json()];case 2:return[2,e.sent()]}})})},t.tryParseJSON=function(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t)return t}catch(n){}return!1},t.getGlobal=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")},t.getTimeStamp=function(e){return void 0===e&&(e=null),e?"string"==typeof e?Math.round(+new Date(e)):Math.round(+e):Math.round(+new Date)},t.getUnixTimeStamp=function(e){return void 0===e&&(e=null),Math.floor(t.getTimeStamp(e)/1e3)},t.getUUID=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:7&t|8).toString(16)})},t.isBrowser=function(){return"undefined"!=typeof window},t.isOnline=function(){return!("undefined"==typeof window||!window.navigator.onLine)},t}(),l=function(){function o(){}return o.deepAssign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!e.length)return t;var r=e.shift();return r===undefined?t:(o.isMergebleObject(t)&&o.isMergebleObject(r)&&Object.keys(r).forEach(function(e){o.isMergebleObject(r[e])?(t[e]||(t[e]={}),o.deepAssign(t[e],r[e])):t[e]=r[e]}),o.deepAssign.apply(o,u([t],e)))},o.isMergebleObject=function(e){return o.isObject(e)&&!Array.isArray(e)},o.isObject=function(e){return null!==e&&"object"==typeof e},o}(),f=function(){function e(){}return e.saveLocalModel=function(e,t){void 0===t&&(t="model"),"undefined"!=typeof window&&window.localStorage?(window.localStorage.setItem(t,JSON.stringify(e)),window.localStorage.setItem(t+"-changed",String(Math.round(+new Date/1e3)))):console.error("localStorage not available: not running in a browser")},e.restoreLocalModel=function(e){if(void 0===e&&(e="model"),"undefined"!=typeof window&&window.localStorage){if(localStorage.getItem(e))return JSON.parse(localStorage.getItem(e))}else console.error("localStorage not available: not running in a browser")},e.flushLocalModel=function(e){void 0===e&&(e="model"),"undefined"!=typeof window&&window.localStorage?(localStorage.getItem(e)&&localStorage.removeItem(e),localStorage.getItem(e+"-changed")&&localStorage.removeItem(e+"-changed")):console.error("localStorage not available: not running in a browser")},e}(),p=function(){function e(){this._config={},this._locked=["_config","_defaults"]}return e.prototype.get=function(e){return this._config[e]},e.prototype.set=function(e,t,n){if(void 0===n&&(n=!1),!this.islocked(e))return n&&(t=d.castToType(t)),this._config[e]=t;console.error('Config: property "'+e+'" can not be changed.')},e.prototype.add=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var r=this;e?this.extend(t):Object.keys(t).forEach(function(e){r.set(e,t[e],n)})},e.prototype.fetch=function(t,o){return void 0===o&&(o=!1),a(this,void 0,void 0,function(){var n,r;return s(this,function(e){switch(e.label){case 0:return n=this,[4,fetch(t).then(function(e){return e.json()})["catch"](function(e){console.log("config fetch error:",e.message)})];case 1:return r=e.sent(),o?this.extend(r):Object.keys(r).forEach(function(e,t){n.set(e,r[e])}),[2,r]}})})},e.prototype.extend=function(e,t){void 0===t&&(t=this._config),l.deepAssign(t,e)},e.prototype.all=function(){return this._config},e.prototype.getLocalSettings=function(e){"undefined"!=typeof window&&window.localStorage&&window.localStorage.getItem(e)&&this.add(f.restoreLocalModel(e))},e.prototype.setLocalSettings=function(e,t){void 0===t&&(t=this._config),"undefined"!=typeof window&&window.localStorage&&f.saveLocalModel(t,e)},e.prototype.setDefaults=function(t){var n=this;n._defaults=t,Object.keys(t).forEach(function(e){n.set(e,d.copy(t[e]))})},e.prototype.restoreDefaults=function(){var t=this;Object.keys(t._defaults).forEach(function(e){t.set(e,t._defaults[e])})},e.prototype.islocked=function(t){var n=!1;return this._locked.forEach(function(e){e===t&&(n=!0)}),n},e.prototype.lock=function(e){return!1},e.prototype.unLock=function(e){},e.prototype.initXdomain=function(e){"undefined"!=typeof window&&window.xdomain&&(window.xdomain.masters(e.masters),window.xdomain.slaves(e.slaves))},e}(),h=Symbol(),y=Symbol(),g=function(n){function e(e){var t=n.call(this)||this;if(e!==y)throw new Error("Cannot construct singleton");return t._type="ConfigService",t}return o(e,n),Object.defineProperty(e,"instance",{get:function(){return this[h]||(this[h]=new e(y)),this[h]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){this._type=e},enumerable:!0,configurable:!0}),e}(p),m={id:"ema-js-base",name:"ema-js-base",authenticated:!1,version:"0.1.1",domain:"ema-js-base.firebaseapp.com",baseUrl:"https://ema-js-base.firebaseapp.com/",baseRoot:"https://ema-js-base.firebaseapp.com",api_headers:[{"Content-Type":"application/json;charset=utf-8"}],language:"en",languages:[{key:"nl",value:"Nederlands"},{key:"en",value:"English"}],roles:{ANONYMOUS:[{actions:["read"],subject:["all"]},{actions:["login"],subject:["user"]}],AUTHENTICATED:[{actions:["logout"],subject:["user"]}],EDITOR:[{actions:["create","read","update","delete"],subject:["all"]}],DEVELOPER:[{actions:["create","read","update","delete","debug"],subject:["all"]}],ADMINISTRATOR:[{actions:["create","read","update","delete","administrate"],subject:["all"]},{actions:["create","read","update","delete"],subject:["user"]}],OWNER:[{actions:["create","read","update","delete","administrate","debug","autoLogin","fetchCredentials"],subject:["all"]},{actions:["create","read","update","delete"],subject:["user"]}]},firebaseApps:{"ema-js-base":{apiKey:"AIzaSyDQuSusOA5HNwIUoyViVOPwEWbGXWt91p4",authDomain:"ema-js-base.firebaseapp.com",databaseURL:"https://ema-js-base.firebaseio.com",projectId:"ema-js-base",storageBucket:"ema-js-base.appspot.com",messagingSenderId:"419979785648"},"app-base":{apiKey:"AIzaSyDds578OH_xcxGw7QiTDOCdweLRSBEyxng",authDomain:"app-base.firebaseapp.com",databaseURL:"https://app-base.firebaseio.com",projectId:"app-base-dce3f",storageBucket:"app-base-dce3f.appspot.com",messagingSenderId:"271464035830"}},drupal:{domain:"local.streamer.nl:8888",protocol:"http:",app_uuid:"319e0e50-5f1b-4b76-8798-3f89da31dd12"},wordpress:{host:"wordpress-dev:8888",protocol:"http:",base_path:"/"}},b={ADD:"Add",ADDRESS:"Address",ADMIN:"Administration",CANCEL:"Cancel","CHANGE LANGUAGE":"Change language",CLOSE:"Close",CONFIRM:"Confirm","CONFIRM WARNING":"This action cannot be undone",CONTACT:"Contact",COUNTRY:"Country",CREATE:"Create",CURRENT:"Current",DATA:"Data",DATE:"Date",DATE_NTH:{1:"{day} January {year}",2:"{day} February {year}",3:"{day} March {year}",4:"{day} April {year}",5:"{day} May {year}",6:"{day} June {year}",7:"{day} July {year}",8:"{day} August {year}",9:"{day} September {year}",10:"{day} October {year}",11:"{day} November {year}",12:"{day} December {year}"},DATE_MONTH_NTH:{1:"January",2:"February",3:"March",4:"April",5:"May",6:"June",7:"July",8:"August",9:"September",10:"October",11:"November",12:"December"},DELETE:"Delete","DELETE CONFIRM":"Are you sure you want to delete this item","DELETE CONFIRM MULTIPLE":"Are you sure you want to delete these items",DETAIL:"Detail",DETAILS:"Details",EDIT:"Edit",EMAIL:"E-mail","EMAIL ADDRESS":"E-mail address","EMAIL ERROR":"This is not a valid email address",ERROR:"Error",FIELD:"Field","FIELD REQUIRED":"This field is required","FORM INVALID":"The form can not be submitted yet. Please fill in the required fields","FORM SUCCESS":"The data have been stored",LANGUAGE:"Language",LOGIN:"Login","LOGIN ERROR":"The credentials you provided are not valid","LOGIN EXPIRED":"Your authorization has expired. Please login again",LOGOUT:"Log out",NAME:"Name","NETWORK ERROR":"There is no internet connection",PASSWORD:"Password","PASSWORD ERROR":"Password is required","PASSWORD MATCH ERROR":"The passwords don't match",REMARKS:"Remarks",REMEMBER:"Remember",REQUIRED:"Required",RESET:"Wissen",RESULT:"Result",RESULTS:"Results",RESULTS_NTH:{0:"No results",1:"{n} result",2:"{n} results",n:"{n} results",gt99:"99+ results"},SAVE:"Save",SEARCH:"Search",SUBMIT:"Submit",TITLE:"Title",USER:"User",USERS:"Users",USERNAME:"Username",counter:"The count is {n}"},E={ADD:"Toevoegen",ADDRESS:"Adres",ADMIN:"Beheer",CANCEL:"Annuleren","CHANGE LANGUAGE":"Taal wijzigen",CLOSE:"Sluiten",CONFIRM:"Bevestigen","CONFIRM WARNING":"Deze handeling kan niet ongedaan worden gemaakt",CONTACT:"Contact",COUNTRY:"Land",CREATE:"Aanmaken",CURRENT:"Huidige",DATA:"Gegevens",DATE:"Datum",DATE_NTH:{1:"{day} Januari {year}",2:"{day} Februari {year}",3:"{day} Maart {year}",4:"{day} April {year}",5:"{day} Mei {year}",6:"{day} Juni {year}",7:"{day} Juli {year}",8:"{day} Augustus {year}",9:"{day} September {year}",10:"{day} Oktober {year}",11:"{day} November {year}",12:"{day} December {year}"},DATE_MONTH_NTH:{1:"Januari",2:"Februari",3:"Maart",4:"April",5:"Mei",6:"Juni",7:"Juli",8:"Augustus",9:"September",10:"Oktober",11:"November",12:"December"},DELETE:"Verwijderen","DELETE CONFIRM":"Weet u zeker dat u dit onderdeel wilt verwijderen","DELETE CONFIRM MULTIPLE":"Weet u zeker dat u deze onderdelen wilt verwijderen",DETAIL:"Detail",DETAILS:"Details",EDIT:"Bewerken",EMAIL:"E-mail","EMAIL ADDRESS":"E-mailadres","EMAIL ERROR":"Er is geen geldige e-mail ingevoerd",ERROR:"Fout",FIELD:"Veld","FIELD REQUIRED":"Dit veld is verplicht","FORM INVALID":"Het formulier kan niet worden verstuurd. Vul eerst de ontbrekende velden in","FORM SUCCESS":"De gegevens zijn opgeslagen",LANGUAGE:"Taal",LOGIN:"Inloggen","LOGIN ERROR":"De ingevoerde login combinatie is niet geldig","LOGIN EXPIRED":"Uw autorisatie is verlopen. Log opnieuw in a.u.b",LOGOUT:"Uitloggen",NAME:"Naam","NETWORK ERROR":"De internetverbinding is verbroken",PASSWORD:"Wachtwoord","PASSWORD ERROR":"Er is geen geldig wachtwoord ingevoerd","PASSWORD MATCH ERROR":"De ingevoerde wachtwoorden komen niet overeen",REMARKS:"Opmerkingen",REMEMBER:"Onthouden",REQUIRED:"Verplicht",RESET:"Reset",RESULT:"Resultaat",RESULTS:"Resultaten",RESULTS_NTH:{0:"Geen resultaten",1:"{n} resultaat",2:"{n} resultaten",n:"{n} resultaten",gt99:"99+ resultaten"},SAVE:"Opslaan",SEARCH:"Zoeken",SUBMIT:"Indienen",TITLE:"Titel",USER:"Gebruiker",USERS:"Gebruikers",USERNAME:"Gebruikersnaam",counter:"Het aantal is {n}"},v={en:b,nl:E},S=function(){function e(){var t=this;this.i18n=v,this.defaultLanguage="en-US",this.supportedLanguages=["en-US","nl-NL"],this.translations={},this.translationsLocation="assets/translations",this.options={debug:!1,namespaceSplitter:"::"},this.initTranslateJs(),this.libTranslate=d.getGlobal().libTranslate,Object.keys(v).forEach(function(e){t.supportedLanguages.push(e)}),this.translations=d.copy(v),this.translations["nl-NL"]=d.copy(this.translations.nl),this.translations["en-US"]=d.copy(this.translations.en),this.translations["en-BE"]=d.copy(this.translations.en),this.use(this.defaultLanguage)}return e.prototype.get=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return this.t.apply(this,u([e],t))},e.prototype.set=function(e,t){this.translations[this.language][e]=t},e.prototype.add=function(t){var n=this;Object.keys(t).forEach(function(e){n.set(e,t[e])})},e.prototype.use=function(t,n){return void 0===n&&(n=!1),a(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return this.language=t,this.translations[t]&&!n?[3,2]:[4,this.loadTranslation(t)];case 1:e.sent(),e.label=2;case 2:return this.t=this.libTranslate.getTranslationFunction(this.translations[t],[this.options]),[2]}})})},e.prototype.loadTranslation=function(r){return a(this,void 0,void 0,function(){var t,n=this;return s(this,function(e){switch(e.label){case 0:return this.translations[r]||(this.translations[r]={}),[4,d.fetchJson(this.translationsLocation+"/"+r+".json")];case 1:return t=e.sent(),Object.keys(t).forEach(function(e){n.translations[r][e]=t[e]}),[2]}})})},e.prototype.updateTranslateComponents=function(){Array.from(document.getElementsByTagName("ema-translate")).forEach(function(e){e.update()})},e.prototype.initTranslateJs=function(){var l,f;l=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},f=function(e){return"object"==typeof e&&null!==e},d.getGlobal().libTranslate={getTranslationFunction:function(a,e){function s(e,n){return t=e,"[object String]"===Object.prototype.toString.call(t)?e.replace(/\{(\w*)\}/g,function(e,t){return n.hasOwnProperty(t)?n.hasOwnProperty(t)?n[t]:t:(u&&console.log('Could not find replacement "'+t+'" in provided replacements object:',n),"{"+t+"}")}):e;var t}var u=(e=f(e)?e:{}).debug,c=e.namespaceSplitter||"::";return function(e){var t=f(arguments[1])?arguments[1]:f(arguments[2])?arguments[2]:{},n=l(arguments[1])?arguments[1]:l(arguments[2])?arguments[2]:null,r=function o(e){if(a[e])return a[e];var t=e.split(c),n=t[0],r=t[1];return a[n]&&a[n][r]?a[n][r]:null}(e);return null!==n&&(t.n=t.n?t.n:n,r=function i(e,t){if(f(e)){var n,r=Object.keys(e);if(0===r.length)return u&&console.log("[Translation] No plural forms found."),null;for(var o=0;o<r.length;o++)0===r[o].indexOf("gt")&&(n=parseInt(r[o].replace("gt",""),10));e=e[t]?e[t]:n<t?e["gt"+n]:e.n?e.n:(u&&console.log('[Translation] No plural forms found for count:"'+t+'" in',e),e[Object.keys(e).reverse()[0]])}return e}(r,n)),null===(r=s(r,t))&&(r=u?"@@"+e+"@@":e,u&&console.log('Translation for "'+e+'" not found.')),r}}}},e}(),w=Symbol(),R=Symbol(),O=function(n){function e(e){var t=n.call(this)||this;if(e!==R)throw new Error("Cannot construct singleton");return t._type="TranslateService",t}return o(e,n),Object.defineProperty(e,"instance",{get:function(){return this[w]||(this[w]=new e(R)),this[w]},enumerable:!0,configurable:!0}),e.prototype.registerTranslateComponents=function(){var t=this;Array.from(document.getElementsByTagName("ema-translate")).forEach(function(e){e.setTranslateService(t)})},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){this._type=e},enumerable:!0,configurable:!0}),e}(S),A=Symbol(),T=Symbol(),C=function(){function e(e){if(e!==T)throw new Error("Cannot construct singleton");this._configService=g.instance,this._translateService=O.instance,this._type="BaseService",this._environment={global:this.getGlobal(),started:Math.round(+new Date/1e3),type:"js"}}return e.prototype.initApp=function(t,n,r){return void 0===n&&(n=!1),void 0===r&&(r=undefined),a(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return r&&this.initGlobalNameSpace(r),n&&this.config.setDefaults(m),"string"!=typeof t?[3,2]:[4,this.config.fetch(t,!0)];case 1:return[2,e.sent()];case 2:return"object"==typeof t?(this.config.add(t),[2,t]):[2]}})})},e.prototype.fetchJson=function(t){return a(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,fetch(t)];case 1:return[4,e.sent().json()];case 2:return[2,e.sent()]}})})},e.prototype.getGlobal=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")},e.prototype.initGlobalNameSpace=function(e){void 0===e&&(e="_ema"),this.config.set("globalNameSpace",e),this.getGlobal()[e]=this},Object.defineProperty(e.prototype,"config",{get:function(){return this._configService},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"environment",{get:function(){return this._environment},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"translation",{get:function(){return this._translateService},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"translateService",{get:function(){return this._translateService},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return this[A]||(this[A]=new e(T)),this[A]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){this._type=e},enumerable:!0,configurable:!0}),e}(),N=function H(){this.base=C.instance},L=function F(){this.base=C.instance},_=function(){function e(){this.optionsDefault={cache:"no-cache",credentials:"same-origin",headers:{},mode:"same-origin",method:"GET"},this._interceptors=[]}return e.prototype.get=function(n,r){return void 0===r&&(r={}),a(this,void 0,void 0,function(){var t;return s(this,function(e){switch(e.label){case 0:return t=this.preflightGet(n,r),[4,fetch(t.url,t.options).then(function(e){return e.json()}).then(function(e){return e})["catch"](function(e){console.error(e)})];case 1:return[2,e.sent()]}})})},e.prototype.put=function(e,t,n){},e.prototype.post=function(e,t,n){},e.prototype["delete"]=function(e,t,n){},e.prototype.preflightGet=function(e,t){void 0===t&&(t={});var n=d.copy(this.optionsDefault);(t=i({},n,t)).params&&(e+=(-1===e.indexOf("?")?"?":"&")+this.queryParams(t.params),delete t.params);var r=this.applyInterceptors({type:"request",url:e,options:t});return{url:e=r[0],options:t=r[1]}},e.prototype.queryParams=function(t){return Object.keys(t).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])}).join("&")},e.prototype.applyInterceptors=function(e){var t;if("request"===e.type)return t=[e.url,e.options],this.interceptors.forEach(function(e){e.request&&(t=e.request(t[0],t[1]))}),t},e.prototype.flushInterceptors=function(){this._interceptors=[]},e.prototype.registerInterceptor=function(e){this._interceptors.push(e)},e.prototype.unregisterInterceptor=function(t){var n=this,r=0;this._interceptors.forEach(function(e){e===t&&n._interceptors.splice(r,1),r++})},Object.defineProperty(e.prototype,"interceptors",{get:function(){return this._interceptors},enumerable:!0,configurable:!0}),e}(),j=Symbol(),D=Symbol(),I=function(n){function e(e){var t=n.call(this)||this;if(e!==D)throw new Error("Cannot construct singleton");return t._type="HttpService",t}return o(e,n),Object.defineProperty(e,"instance",{get:function(){return this[j]||(this[j]=new e(D)),this[j]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){this._type=e},enumerable:!0,configurable:!0}),e}(_),M=Symbol(),U=Symbol(),P=function(){function e(e){if(this._roles={ANONYMOUS:[{actions:"read",subject:"all"}]},e!==U)throw new Error("Cannot construct singleton");this._type="PermissionsService",this._http=I.instance,this._rules=this._roles.ANONYMOUS}return Object.defineProperty(e,"instance",{get:function(){return this[M]||(this[M]=new e(U)),this[M]},enumerable:!0,configurable:!0}),e.prototype.loadRules=function(n,r,o){return void 0===r&&(r=!0),void 0===o&&(o=undefined),a(this,void 0,void 0,function(){var t;return s(this,function(e){switch(e.label){case 0:return[4,this._http.get(n)];case 1:return t=e.sent(),o&&(t=t[o]),this.addRules(t,r),[2]}})})},e.prototype.addRules=function(e,t){void 0===t&&(t=!1),this.rules=t?e:u(this.rules,e),d.isBrowser()&&dispatchEvent(new CustomEvent("permissionsRulesChange",{detail:{rules:this.rules}}))},e.prototype.registerPermissionComponents=function(e){var t=this;(e||Array.from(document.getElementsByTagName("ema-permission"))).forEach(function(e){e.setPermissionService(t)})},Object.defineProperty(e.prototype,"rules",{get:function(){return this._rules},set:function(e){this._rules=e,d.isBrowser()&&dispatchEvent(new CustomEvent("permissionsRulesChange",{detail:{rules:this._rules}}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"roles",{get:function(){return this._roles},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"user",{get:function(){return this._user},set:function(e){this._user=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){this._type=e},enumerable:!0,configurable:!0}),e}(),x=function(){function e(e,t,n,r){void 0===e&&(e="visitor"),void 0===t&&(t=["ANONYMOUS"]),this.roles=[],this.permissions=P.instance,this.name=e,this.roles=t,n||(this.id=d.getUUID()),r||(this.created=d.getTimeStamp())}return e.prototype.addRole=function(e){this.roles.push(e),this.roles=d.arraySetUnique(this.roles)},e.prototype.removeRole=function(r){var e=this.roles.filter(function(e,t,n){return e!==r});this.roles=e},e.prototype.hasRole=function(t){var n=!1;return this.roles.forEach(function(e){e===t&&(n=!0)}),n},e}(),G=function(){function r(){}return r.getStyle=function(e,t){return void 0===t&&(t=document.documentElement),window.getComputedStyle(t).getPropertyValue(e)},r.setStyle=function(e,t,n){void 0===n&&(n=document.documentElement),n.style.setProperty(e,t)},r.getVar=function(e,t){return void 0===t&&(t=document.documentElement),"-"!==e[0]&&"-"!==e[1]&&(e="--"+e),r.getStyle(e,t)},r.setVar=function(e,t,n){void 0===n&&(n=document.documentElement),"-"!==e[0]&&"-"!==e[1]&&(e="--"+e),r.setStyle(e,t,n)},r}(),k=function(){function e(){}return e.addClass=function(e,t){e.classList?e.classList.add(t):e.className+=" "+t},e.hasClass=function(e,t){e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)},e.removeClass=function(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")},e.toggleClass=function(e,t){if(e.classList)e.classList.toggle(t);else{var n=e.className.split(" "),r=n.indexOf(t);0<=r?n.splice(r,1):n.push(t),e.className=n.join(" ")}},e.remove=function(e){e.parentNode.removeChild(e)},e.getAttributes=function(e){for(var t=e.attributes,n={},r=0;r<t.length;r++)n[t[r].name]=t[r].value;return n},e.setAttributes=function(t,n){Object.keys(n).forEach(function(e){t.setAttribute(e,n[e])})},e.getStyle=function(e,t){var n,r,o,i,a=e.ownerDocument.defaultView;return a&&a.getComputedStyle?(t=t.replace(/([A-Z])/g,"-$1").toLowerCase(),a.getComputedStyle(e,null).getPropertyValue(t)):e.currentStyle?(t=t.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()}),n=e.currentStyle[t],/^\d+(em|pt|%|ex)?$/i.test(n)?(r=n,o=e.style.left,i=e.runtimeStyle.left,e.runtimeStyle.left=e.currentStyle.left,e.style.left=r||0,r=e.style.pixelLeft+"px",e.style.left=o,e.runtimeStyle.left=i,r):n):void 0},e.viewportSize=function(){var e={width:undefined,height:undefined};return"undefined"!=typeof window&&(window.innerHeight?(e.width=window.innerWidth,e.height=window.innerHeight):(e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight)),e},e.copyToClipboard=function(e){var t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t);var n=0<document.getSelection().rangeCount&&document.getSelection().getRangeAt(0);t.select(),document.execCommand("copy"),document.body.removeChild(t),n&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n))},e.fadeIn=function(n,e,t,r){void 0===e&&(e=300),void 0===t&&(t=0),void 0===r&&(r="block");var o=1/e*10;n.style.opacity="0",n.style.display=r,setTimeout(function(){!function t(){var e=parseFloat(n.style.opacity);1<(e+=o)||(n.style.opacity=e.toString(),requestAnimationFrame(t))}()},t)},e.fadeOut=function(n,e,t,r){void 0===e&&(e=300),void 0===t&&(t=0),void 0===r&&(r=!1);var o=1/e*10;n.style.opacity="1",setTimeout(function(){!function t(){var e=Number(n.style.opacity);e-=o,n.style.opacity=e.toString(),e<0?!1===r&&(n.style.display="none",n.style.opacity="1"):requestAnimationFrame(t)}()},t)},e.getUrlParameterByName=function(e){var t=RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))},e}(),J=function(){function t(){}return t.allBetween=function(e,n,r,o){void 0===o&&(o=!0);var t=new RegExp(n+"(.*?)"+r,"g"),i=e.match(t),a=[];return i&&i.length&&i.forEach(function(e,t){o?a.push(e.replace(n,"").replace(r,"")):a.push(e)}),a},t.between=function(e,t,n,r){if(void 0===r&&(r=!1),!e)return e;return function o(e,t,n){var r=e.indexOf(t);if(!(0<=r))return"";if(e=e.substring(r+t.length),n){if(!(0<=(r=e.indexOf(n))))return"";e=e.substring(0,r)}return e}(e,t,n)},t.camelCase=function(e){return e.replace(/\w+/g,function(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()})},t.lowerCamelCase=function(e){return t.lowercaseFirst(e.replace(/\w+/g,function(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}))},t.kebabToCamelCase=function(e){return t.uppercaseFirst(e.replace(/(\-\w)/g,function(e){return e[1].toUpperCase()}))},t.kebabToLowerCamelCase=function(e){return t.lowercaseFirst(e.replace(/(\-\w)/g,function(e){return e[1].toUpperCase()}))},t.camelToKebabCase=function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},t.isJson=function(e){try{JSON.parse(e)}catch(t){return!1}return!0},t.lowercaseFirst=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},t.uppercaseFirst=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},t.replaceAll=function(e,t,n,r){if(void 0===r&&(r=!1),!e)return e;return function o(e,t,n,r){return String(e).replace(new RegExp(t.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g,"\\$&"),r?"gi":"g"),"string"==typeof n?n.replace(/\$/g,"$$$$"):n)}(e,t,n,r)},t}();e.BaseApi=t,e.BaseWebComponent=c,e.BaseService=C,e.Browser=N,e.Server=L,e.Config=p,e.ConfigService=g,e.configDefaults=m,e.HttpService=I,e.PermissionsService=P,e.Translate=S,e.TranslateService=O,e.User=x,e.i18n=v,e.Css=G,e.DomUtil=k,e.ObjectUtil=l,e.Storage=f,e.StringUtil=J,e.Util=d,e.validationConstants={REGEX_BSN:/^[0-9]{9}$/,REGEX_BTW_NL:/(NL)?[0-9]{9}B[0-9]{2}/,REGEX_CURRENCY_EURO:/^\s*-?((\d{1,3}(\.(\d){3})*)|\d*)(,\d{1,2})?\s?(\u20AC)?\s*$/,REGEX_DATE:/(((0[1-9]|[12][0-9]|3[01])([-])(0[13578]|10|12)([-])([1-2][0,9][0-9][0-9]))|(([0][1-9]|[12][0-9]|30)([-])(0[469]|11)([-])([1-2][0,9][0-9][0-9]))|((0[1-9]|1[0-9]|2[0-8])([-])(02)([-])([1-2][0,9][0-9][0-9]))|((29)(\.|-|\/)(02)([-])([02468][048]00))|((29)([-])(02)([-])([13579][26]00))|((29)([-])(02)([-])([0-9][0-9][0][48]))|((29)([-])(02)([-])([0-9][0-9][2468][048]))|((29)([-])(02)([-])([0-9][0-9][13579][26])))/,REGEX_EMAIL:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,REGEX_IBAN:/[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}/,REGEX_INITIALS:/^([a-zA-Z]|[cC][hH]|[cC][Hh][Rr]|[fF][Rr]|[Ii][jJ]|[jJ][aA][Cc]|[pP][Hh]|[tT][Hh]|[tT][Jj])((\.([a-zA-Z]|[cC][hC]|[cC][Hh][Rr]|[fF][Rr]|[Ii][jJ]|[jJ][aA][Cc]|[pP][Hh]|[tT][Hh]|[tT][Jj]))*)(\.)?$/,REGEX_ZIPCODE:/^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$/i,REGEX_PHONE:/^(((0)[1-9]{2}[0-9][-]?[1-9][0-9]{5})|((\\+31|0|0031)[1-9][0-9][-]?[1-9][0-9]{6}))$/,REGEX_PHONE_MOBILE:/^(((\\+31|0|0031)6){1}[1-9]{1}[0-9]{7})$/i,REGEX_PASSWORD:/^(?=.*[A-Z])(?=.*[!@#$&*])(?=.*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{8,24}$/,REGEX_URL:/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/i,REGEX_LASTNAME:/^[^0-9]+$/i,REGEX_INTEGER:/^[-+]?\d+$/,REGEX_ALPHA:/^[a-zA-ZàáâäãåąćęèéêëìíîïłńòóôöõøùúûüÿýżźñçčšžÀÁÂÄÃÅĄĆĘÈÉÊËÌÍÎÏŁŃÒÓÔÖÕØÙÚÛÜŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-]+$/,REGEX_ALPHANUM:/^[a-zA-Z0-9àáâäãåąćęèéêëìíîïłńòóôöõøùúûüÿýżźñçčšžÀÁÂÄÃÅĄĆĘÈÉÊËÌÍÎÏŁŃÒÓÔÖÕØÙÚÛÜŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-]+$/,REGEX_NUMERIC:/^[0-9]+$/,REGEX_NO_SPACES:/^\S+$/,REGEX_NO_PUNCTUATION:/^[^,.'-]+$/,REGEX_REQUIRED:/[0-9a-zA-Z]{1,}/,REGEX_JSON:/^\"([^\"\\]*|\\(["\\\/bfnrt]{1}|u[a-f0-9]{4}))*\"$/},e.ɵa=_,e.ɵb=b,e.ɵc=E,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ema-js-base-library.umd.min.js.map