@wavemaker/app-runtime-wm-build 11.4.0-next.24686 → 11.4.0-next.24691

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -827,7 +827,7 @@ var b=function(e,t){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
827
827
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
828
828
  PERFORMANCE OF THIS SOFTWARE.
829
829
  ***************************************************************************** */
830
- var p=function(e,t){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function d(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var h,m=function(){n.register("wm-media-list",new Map([["class",n.PROP_STRING],["dataset",n.PROP_ANY],["layout",Object.assign({value:"Single-row"},n.PROP_STRING)],["mediaurl",n.PROP_STRING],["name",n.PROP_STRING],["offline",Object.assign({value:!0},n.PROP_BOOLEAN)],["show",Object.assign({value:!0},n.PROP_BOOLEAN)],["thumbnailheight",Object.assign({value:"100pt"},n.PROP_STRING)],["thumbnailwidth",Object.assign({value:"100pt"},n.PROP_STRING)],["thumbnailurl",n.PROP_STRING]]))},f={widgetType:"wm-media-list",hostClass:"app-medialist"};!function(e){e.SINGLE_ROW="Single-row",e.MULTI_ROW="Multi-row"}(h||(h={}));var g=function(e){function t(t){var i=e.call(this,t,f)||this;return i.selectedMediaIndex=-1,n.styler(i.nativeElement,i,n.APPLY_STYLES_TYPE.SCROLLABLE_CONTAINER),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.appendToBody=function(){var e=this;return this.$fullScreenEle||setTimeout((function(){e.$fullScreenEle=e.$element.find(">.app-media-fullscreen"),e.$fullScreenEle.appendTo("body")}),100),!0},t.prototype.onPropertyChange=function(t,n,o){"dataset"===t?this.onDataChange(n):"layout"===t?n===h.SINGLE_ROW?i.addClass(this.nativeElement,"singlerow"):i.removeClass(this.nativeElement,"singlerow"):e.prototype.onPropertyChange.call(this,t,n,o)},t.prototype.exitFullScreen=function(){this.selectedMediaIndex=-1,this.$fullScreenEle.appendTo(this.$element),this.$fullScreenEle=null,i.$appDigest()},t.prototype.getPicTitle=function(){return this.selectedMediaIndex+1+"/"+this.fieldDefs.length},t.prototype.showFullScreen=function(e){this.selectedMediaIndex=e,i.$appDigest()},t.prototype.showNext=function(){this.selectedMediaIndex<this.fieldDefs.length-1&&(this.selectedMediaIndex++,i.$appDigest())},t.prototype.getSrc=function(e){return e?this.fieldDefs[this.selectedMediaIndex][e]:""},t.prototype.showPrev=function(){this.selectedMediaIndex>0&&(this.selectedMediaIndex--,i.$appDigest())},t.prototype.onDataChange=function(e){e?(i.isObject(e)&&!i.isArray(e)&&(e=[e]),this.binddataset||i.isString(e)&&(e=e.split(",")),i.isArray(e)&&this.updateFieldDefs(e)):this.updateFieldDefs([])},t.prototype.updateFieldDefs=function(e){var t=this;this.fieldDefs=e,e.forEach((function(e){e.mediaUrlVal=n.getEvaluatedData(e,{field:t.mediaurl},t.viewParent),e.thumbnailUrlVal=n.getEvaluatedData(e,t.thumbnailurl,t.viewParent)})),this.fieldDefs=e},t.prototype.listTrackByFn=function(e){return e},t}(n.StylableComponent);g.initializeProps=m(),g.decorators=[{type:t.Component,args:[{selector:"[wmMediaList]",template:'<ul class="list-unstyled list-inline app-media-thumbnail">\n <li *ngFor="let item of fieldDefs; index as index;" [ngStyle]="{width: thumbnailwidth, height: thumbnailheight}" (click)="showFullScreen(index)">\n <div class="thumbnail">\n <ng-container [ngTemplateOutlet]="imgTemplate"\n [ngTemplateOutletContext]="{src: item.thumbnailUrlVal, class: \'thumbnail-image\'}">\n </ng-container>\n <div class="thumbnail-details">\n <ng-container [ngTemplateOutlet]="mediaListTemplate" [ngTemplateOutletContext]="{item:item, index:index}" [wmMediaListItem]="item">\n </ng-container>\n </div>\n </div>\n </li>\n</ul>\n<div class="app-media-fullscreen" *ngIf="selectedMediaIndex >= 0 && appendToBody()">\n <header wmMobileNavbar\n backbutton="true"\n backbtnclick.event="exitFullScreen()"\n showLeftnavbtn="false"\n backbuttoniconclass.event="wi wi-chevron-left"\n title.bind="getPicTitle()">\n </header>\n <div wmContent>\n <div wmPageContent>\n <div class="media-content">\n <div class="image-container" (swipeleft)="showNext()" (swiperight)="showPrev()">\n <ng-container [ngTemplateOutlet]="imgTemplate"\n [ngTemplateOutletContext]="{field: \'mediaUrlVal\', class: \'center-block\'}">\n </ng-container>\n <a class="app-media-fullscreen-nav-control left" [hidden]="!(selectedMediaIndex > 0)" (click)="showPrev()">\n <i class="wi wi-chevron-left"></i>\n </a>\n <a class="app-media-fullscreen-nav-control right" [hidden]="!(selectedMediaIndex < fieldDefs.length-1)" (click)="showNext()">\n <i class="wi wi-chevron-right"></i>\n </a>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #imgTemplate let-src="src" let-classname="class" let-field="field">\n <img wmPicture class="{{classname}}" picturesource.bind="src || getSrc(field)" wmImageCache="{{offline}}" />\n</ng-template>\n',providers:[n.provideAsWidgetRef(g)]}]}],g.ctorParameters=function(){return[{type:t.Injector}]},g.propDecorators={mediaListTemplate:[{type:t.ContentChild,args:["mediaListTemplate"]}]};var v=[c,g],y=function(){};y.decorators=[{type:t.NgModule,args:[{imports:[l.BasicModule,o.CommonModule,r.BasicModule,a.MobileNavbarModule,s.PageModule,n.WmComponentsModule],declarations:d([],u(v)),exports:d([],u(v)),entryComponents:[]}]}],e.MediaListComponent=g,e.MediaListItemDirective=c,e.MediaListModule=y,e["\u0275a"]=m,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@wavemaker/variables"),require("@wm/core"),require("angular2-websocket/angular2-websocket"),require("@metrichor/jmespath"),require("@angular/core"),require("@angular/router"),require("@wm/oAuth"),require("@wm/security"),require("@angular/common"),require("@angular/common/http"),require("ngx-toastr"),require("@wm/http")):"function"==typeof define&&define.amd?define("@wm/variables",["exports","@wavemaker/variables","@wm/core","angular2-websocket/angular2-websocket","@metrichor/jmespath","@angular/core","@angular/router","@wm/oAuth","@wm/security","@angular/common","@angular/common/http","ngx-toastr","@wm/http"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.variables={}),e.wm_common_variables,e.wm.core,e.angularWebSocket,e.jmespath,e.ng.core,e.ng.router,e.wm.oAuth,e.wm.security,e.ng.common,e.ng.common.http,e.ngxToastr,e.wm.http)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d){"use strict";var h={hasCordova:void 0!==window.cordova,isStudioMode:!1,isRunMode:!0,XSRF_COOKIE_NAME:"wm_xsrf_token",DEFAULT_TIMER_DELAY:500,WIDGET_DOESNT_EXIST:"The widget you're trying to navigate to doesn't exist on this page"},m={CATEGORY:{MODEL:"wm.Variable",LIVE:"wm.LiveVariable",CRUD:"wm.CrudVariable",SERVICE:"wm.ServiceVariable",WEBSOCKET:"wm.WebSocketVariable",NAVIGATION:"wm.NavigationVariable",NOTIFICATION:"wm.NotificationVariable",TIMER:"wm.TimerVariable",LOGIN:"wm.LoginVariable",LOGOUT:"wm.LogoutVariable",DEVICE:"wm.DeviceVariable"},EVENTS:["onBefore","onBeforeUpdate","onResult","onBeforeOpen","onOpen","onBeforeMessageSend","onMessageReceive","onProgress","onError","onBeforeDatasetReady","onCanUpdate","onClick","onHide","onOk","onCancel","onBeforeClose","onClose","onTimerFire","onSuccess","onOnline","onOffline"],EVENT:{CAN_UPDATE:"onCanUpdate",BEFORE:"onBefore",BEFORE_UPDATE:"onBeforeUpdate",PREPARE_SETDATA:"onBeforeDatasetReady",RESULT:"onResult",ERROR:"onError",ABORT:"onAbort",PROGRESS:"onProgress",CLICK:"onClick",HIDE:"onHide",OK:"onOk",CANCEL:"onCancel",CLOSE:"onClose",TIMER_FIRE:"onTimerFire",SUCCESS:"onSuccess",BEFORE_OPEN:"onBeforeOpen",OPEN:"onOpen",BEFORE_SEND:"onBeforeMessageSend",MESSAGE_RECEIVE:"onMessageReceive",BEFORE_CLOSE:"onBeforeClose"},OWNER:{APP:"App",PAGE:"Page"},REST_SUPPORTED_SERVICES:["JavaService","SoapService","FeedService","RestService","SecurityServiceType","DataService","WebSocketService","OpenAPIService"],PAGINATION_PARAMS:["page","size","sort"],REST_SERVICE:{BASE_PATH_KEY:"x-WM-BASE_PATH",RELATIVE_PATH_KEY:"x-WM-RELATIVE_PATH",OAUTH_PROVIDER_KEY:"x-WM-PROVIDER_ID",AUTH_HDR_KEY:"Authorization",SECURITY_DEFN:{BASIC:"basic",OAUTH2:"oauth2"},AUTH_TYPE:{BASIC:"BASIC",OAUTH:"OAUTH2",NONE:"NONE"},CONTENT_TYPE_KEY:"x-WM-CONTENT_TYPE",ACCESSTOKEN_PLACEHOLDER:{LEFT:"",RIGHT:".access_token"},ERR_TYPE:{NO_ACCESSTOKEN:"missing_accesstoken",NO_CREDENTIALS:"no_credentials",METADATA_MISSING:"metadata_missing",CRUD_OPERATION_MISSING:"crud_operation_missing",USER_UNAUTHORISED:"user_unauthorised",REQUIRED_FIELD_MISSING:"required_field_missing"},ERR_MSG:{NO_ACCESSTOKEN:"Access token missing",NO_CREDENTIALS:"No credentials present",METADATA_MISSING:'Metadata missing for "$variable"',USER_UNAUTHORISED:"Unauthorized User",CRUD_OPERATION_MISSING:'Operation "$operation" not allowed for "$variable"',REQUIRED_FIELD_MISSING:'Required field(s) missing: "${0}"'},UNCLOAKED_HEADERS:["CONTENT-TYPE","ACCEPT","CONTENT-LENGTH","ACCEPT-ENCODING","ACCEPT-LANGUAGE"],PREFIX:{AUTH_HDR_VAL:{BASIC:"Basic",OAUTH:"Bearer"},CLOAK_HEADER_KEY:"X-WM-"}},SERVICE_TYPE:{JAVA:"JavaService",REST:"RestService",SOAP:"SoapService",FEED:"FeedService",DATA:"DataService",SECURITY:"SecurityServiceType",WEBSOCKET:"WebSocketService",OPENAPI:"OpenAPIService"},CONTROLLER_TYPE:{QUERY:"QueryExecution",PROCEDURE:"ProcedureExecution"},HTTP_STATUS_CODE:{CORS_FAILURE:-1,UNAUTHORIZED:401,FORBIDDEN:403},EXPORT_TYPES_MAP:{EXCEL:".xlsx",CSV:".csv"},DEFAULT_VAR:{NOTIFICATION:"appNotification"}},f={NON_BODY_HTTP_METHODS:["GET","HEAD"],CONTENT_TYPES:{FORM_URL_ENCODED:"application/x-www-form-urlencoded",MULTIPART_FORMDATA:"multipart/form-data",OCTET_STREAM:"application/octet-stream"}},g={WM_DATA_JSON:"wm_data_json",WM_HTTP_JSON:"wm_httpRequestDetails"},v=t.$rootScope,y=function(e,t){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.create;function w(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function P(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var O={EXCEL:".xlsx",CSV:".csv"};e.appManager=void 0,e.httpService=void 0,e.metadataService=void 0,e.navigationService=void 0,e.routerService=void 0,e.toasterService=void 0,e.oauthService=void 0,e.securityService=void 0,e.dialogService=void 0;var S=/^\[("|')[\w\W]*(\1)\]$/,E=new Map,T=new Map,R=function(e,t){var n,i,o=_.noop;T.has(e)&&(o=T.get(e).cancel),o(),n=_.debounce((function(){(i=e[t]())instanceof Promise&&i.catch(_.noop)}),100),T.set(e,n),n()},A=function(e,t,n,i,o){switch(i.category){case m.CATEGORY.LIVE:"read"===i.operation?("dataBinding"===e?_.forEach(t,(function(e,t){i.filterFields[t]={value:e}})):i.filterFields[e]={value:t,type:n},i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i.listRecords)&&!o&&R(i,"listRecords")):("dataBinding"===e?i.inputFields=t:i.inputFields[e]=t,i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i[i.operation+"Record"])&&!o&&R(i,i.operation+"Record"));break;case m.CATEGORY.CRUD:"list"===i.operationType&&i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i.invoke)&&!o&&R(i,"invoke");break;case m.CATEGORY.SERVICE:case m.CATEGORY.LOGIN:i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i.invoke)&&!o&&R(i,"invoke");break;case m.CATEGORY.DEVICE:i[e]=t,i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i.invoke)&&!o&&R(i,"invoke")}},C=function(t,n){switch(t){case"appManager":e.appManager=n;break;case"http":e.httpService=n;break;case"metadata":e.metadataService=n;break;case"navigationService":e.navigationService=n;break;case"router":e.routerService=n;break;case"toaster":e.toasterService=n;break;case"oAuth":e.oauthService=n;break;case"security":e.securityService=n;break;case"dialog":e.dialogService=n}},I=function(e,t,i,o,r){var a,s=t[e],l=t._context;e!==m.EVENT.ERROR||r||s||(a=l.Actions[m.DEFAULT_VAR.NOTIFICATION])&&(i=a.getMessage()||i,i=_.isString(i)?i:"An error has occured. Please check the app logs.",a.invoke({message:i},void 0,void 0));var c=n.$parseEvent(t[e]);return e===m.EVENT.BEFORE_UPDATE?"wm.LiveVariable"===t.category&&"read"===t.operation?c(t._context,{variable:t,dataFilter:i,options:o}):c(t._context,{variable:t,inputData:i,options:o}):c(t._context,{variable:t,data:i,options:o})},D=function(e){setTimeout((function(){n.triggerFn(e)}),500)},N=function(e,t,i,o){var r,a,s,l,c,p="",u=t.get("Content-Disposition");if(u&&-1!==u.indexOf("attachment")&&null!==(r=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(u))&&r[1]&&(p=r[1].replace(/['"]/g,"")),a=t.get("Content-Type"),s=new Blob([e],{type:a}),void 0!==window.navigator.msSaveBlob)window.navigator.msSaveBlob(s,p)?D(i):n.triggerFn(o);else{if(l=window.URL||window.webkitURL,c=l.createObjectURL(s),p){var d,h=document.createElement("a");void 0===h.download?((d=new FileReader).onloadend=function(){var e=d.result.replace(/^data:[^;]*;/,"data:attachment/file;");window.open(e,"_blank")||(window.location.href=e)},d.onload=D.bind(void 0,i),d.onerror=o,d.readAsDataURL(s)):(h.href=c,h.download=p,document.body.appendChild(h),h.click(),D(i))}else window.open(c,"_blank")||(window.location.href=c),D(i);setTimeout((function(){l.revokeObjectURL(c)}),100)}},x=function(e,t){e=_.split(e,"&"),_.forEach(e,(function(e){e=_.split(e,"="),t[e[0]]=decodeURIComponent(_.join(_.slice(e,1),"="))}))},k=function(e,t){"/"===e.url[1]&&"/"===e.url[2]&&(e.url=e.url.slice(0,1)+e.url.slice(2));var i,o,r,a="",s="fileDownloadIFrame",l="fileDownloadForm",c="Content-Type",p=e.url,u=_.get(e.headers,c),d=_.pickBy(e.headers,(function(e,t){return t!==c}));(i=$("#"+s)).length&&i.first().remove(),i=$('<iframe id="'+s+'" name="'+s+'" class="ng-hide"></iframe>'),(o=$('<form id="'+l+'" name="'+l+'"></form>')).attr({target:i.attr("name"),action:p,method:e.method,enctype:u}),a+=-1!==p.indexOf("?")?p.substring(p.indexOf("?")+1):"",a+=u===f.CONTENT_TYPES.FORM_URL_ENCODED?(a?"&":"")+e.dataParams:"",_.includes(f.NON_BODY_HTTP_METHODS,_.toUpper(e.method))&&x(a,d),x(e.data,d),_.forEach(d,(function(e,t){(r=$('<input type="hidden">')).attr({name:t,value:e}),o.append(r)})),$("body").append(i),setTimeout((function(){i.contents().find("body").append(o),o.submit(),n.triggerFn(t)}),100)},M=function(t,i,o){var r=t.url,a=t.method,s=t.dataParams||t.data,l=t.headers;l["Content-Type"]=l["Content-Type"]||"application/x-www-form-urlencoded",e.httpService.send({target:"WebService",action:"invokeRuntimeRestCall",method:a,url:r,headers:l,data:s,responseType:"arraybuffer"}).then((function(e){setTimeout((function(){N(e.body,e.headers,i,o)}),900)}),(function(e){n.triggerFn(o,e)}))},L=function(){return!!h.hasCordova&&localStorage.getItem(h.XSRF_COOKIE_NAME)},F=function(e,t,i){var o,r=e.target,a=i[t];return S.test(r)?o=a:(r=r.substr(0,r.lastIndexOf(".")),o=e.target===t?i:r?n.findValueOf(a,r,!0):a),o},j=function(e){return S.test(e)?e.replace(/^(\[["'])|(["']\])$/g,""):e.split(".").pop()},B=function(e,t,n,i,o,r){var a=j(e),s=F(t,n,i);o=_.isUndefined(o)?t.value:o,s&&(s[a]=o),A(a,o,t.type,i,r)},G=function(e,t,n){var i,o=_.keys(_.get(E.get(n),[n.name,t])),r=j(e);(i=_.filter(o,(function(e){return e!==r&&_.includes(e,r)||(r===t||"dataBinding"===r)&&e!==r}))).length&&_.forEach(i,(function(e){B(e,{target:e},t,n,_.get(E.get(n),[n.name,t,e]))}))},V=function(e,t,i,o){var r=e.target,a=F(e,i,o),s=j(r),l=t.registerDestroyListener?t.registerDestroyListener.bind(t):_.noop;if(n.stringStartsWith(e.value,"bind:")){l(n.$watch(e.value.replace("bind:",""),t,{},(function(t,l){t===l&&_.isUndefined(t)||!(!_.isUndefined(t)||_.isUndefined(l)&&_.isUndefined(a[s]))||(_.includes(["blob","file"],e.type)||(t=n.getClonedObject(t)),B(r,e,i,o,t),E.has(o)||E.set(o,{}),_.set(E.get(o),[o.name,i,r],t),_.isObject(t)&&G(r,i,o))}),void 0,void 0,void 0,(function(){return o.isMuted})))}else _.isUndefined(e.value)||(B(r,e,i,o,e.value,!0),i!==s&&(E.has(o)||E.set(o,{}),_.set(E.get(o),[o.name,i,r],e.value)))},U=function(e,t,n,i){i=i||"dataBinding";var o=e[n=n||"dataBinding"];e[n]={},e["_bind"+n]=o,o&&_.isArray(o)&&o.forEach((function(n){"wm.Variable"===e.category&&"dataBinding"===n.target&&(n.target="dataSet"),V(n,t,i,e)}))},W=function(t,n,i,o,r){if(h.hasCordova){var a=void 0;i&&(a=O[i]),e.appManager.notify("device-file-download",{url:t.url,name:n,extension:a,headers:t.headers,successCb:o,errorCb:r})}else!_.isEmpty(t.headers)||L()?M(t,o,r):k(t,o)},q=function(){return window.File&&window.FileReader&&window.FileList&&window.Blob},z=R,H=function(e){return n.DEFAULT_FORMATS[_.toUpper(e)]},Y=function(t,i){var o;return _.isDate(t)?o=t.getTime():(isNaN(t)||(t=parseInt(t,10)),o=t&&moment(t).valueOf()),isNaN(o)&&i!==n.DataType.TIME||i===n.DataType.TIMESTAMP?o:(i!==n.DataType.TIME||o||(o=moment((new Date).toDateString()+" "+t).valueOf()),t&&e.appManager.getPipe("date").transform(o,H(i)))},K=function(e,t){return _.includes(t,".")&&(t=_.toLower(n.extractType(t))),_.isArray(e)?_.map(e,(function(e){return Y(e,t)})):Y(e,t)};var Q=function(){function t(){}return t.prototype.initBinding=function(e,t,n){U(e,e._context,t,n)},t.prototype.notifyInflight=function(t,n,i){e.appManager.notify("toggle-variable-state",{variable:t,active:n,data:i})},t}(),X=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return b(i,t),i.prototype.invoke=function(t,i){!function(t,i){var o;t.dataSet=i&&i.data||t.dataSet;var r=t.dataBinding.pageName||t.pageName,a=t.operation,s=_.clone(t.dataSet),l=_.isNil(null==i?void 0:i.cacheable)?t.cacheable:i.cacheable;switch(i=i||{},_.isNil(l)||n.isString(l)&&""===l.trim()||(s._cache_page=l),a){case"goToPreviousPage":e.navigationService.goToPrevious();break;case"gotoPage":e.navigationService.goToPage(r,{transition:t.pageTransitions,$event:i.$event,urlParams:s,cacheable:t.cacheable});break;case"gotoView":o=t.dataBinding&&t.dataBinding.viewName||t.viewName;break;case"gotoTab":o=t.dataBinding&&t.dataBinding.tabName||t.tabName;break;case"gotoAccordion":o=t.dataBinding&&t.dataBinding.accordionName||t.accordionName;break;case"gotoSegment":o=t.dataBinding&&t.dataBinding.segmentName||t.segmentName}o&&e.navigationService.goToView(o,{pageName:r,transition:t.pageTransitions,$event:i.$event,urlParams:s},t)}(t,i)},i}(Q),J=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return b(n,t),n.prototype.onToasterClick=function(e){I("onClick",e,"")},n.prototype.onToasterHide=function(e){I("onHide",e,"")},n.prototype.notifyViaToaster=function(t,n){var i,o=(n.class||t.dataBinding.class||"info").toLowerCase(),r=n.message||t.dataBinding.text,a=n.title,s="toast-"+(n.position||t.dataBinding.toasterPosition||"bottom right").replace(" ","-"),l=t.dataBinding.page,c=parseInt(n.duration||t.dataBinding.duration,null);c||(c=0!==c&&"success"===o?3e3:0),i=t.dataBinding.content&&"page"===t.dataBinding.content&&l?e.toasterService.showCustom(l,{positionClass:s,timeOut:c,partialParams:t._binddataSet,context:t._context}):e.toasterService.show(o,a,r||null,{positionClass:s,timeOut:c,enableHtml:!0}),t.onClick&&i.onTap.subscribe(this.onToasterClick.bind(this,t)),t.onHide&&i.onHidden.subscribe(this.onToasterHide.bind(this,t))},n.prototype.notifyViaDialog=function(t,n){var i="Common"+_.capitalize(t.operation)+"Dialog",o=function(){return I("onOk",t,n.data)};e.dialogService.open(i,void 0,{notification:{title:n.title||t.dataBinding.title,text:n.message||t.dataBinding.text,okButtonText:n.okButtonText||t.dataBinding.okButtonText||"OK",cancelButtonText:n.cancelButtonText||t.dataBinding.cancelButtonText||"CANCEL",alerttype:n.alerttype||t.dataBinding.alerttype||"information",onOk:function(){e.dialogService.close(i,void 0,o)},onCancel:function(){I("onCancel",t,n.data),e.dialogService.close(i,void 0)},onClose:function(){I("onClose",t,n.data)}}})},n.prototype.notify=function(e,t,n,i){t=t||{},"toast"===e.operation?this.notifyViaToaster(e,t):this.notifyViaDialog(e,t)},n.prototype.getMessage=function(e){return e.dataBinding.text},n.prototype.setMessage=function(e,t){return _.isString(t)&&(e.dataBinding.text=t),e.dataBinding.text},n.prototype.getOkButtonText=function(e){return e.dataBinding.okButtonText},n.prototype.setOkButtonText=function(e,t){return _.isString(t)&&(e.dataBinding.okButtonText=t),e.dataBinding.okButtonText},n.prototype.getToasterDuration=function(e){return e.dataBinding.duration},n.prototype.setToasterDuration=function(e,t){return e.dataBinding.duration=t,e.dataBinding.duration},n.prototype.getToasterClass=function(e){return e.dataBinding.class},n.prototype.setToasterClass=function(e,t){return _.isString(t)&&(e.dataBinding.class=t),e.dataBinding.class},n.prototype.getToasterPosition=function(e){return e.dataBinding.class},n.prototype.setToasterPosition=function(e,t){return _.isString(t)&&(e.dataBinding.position=t),e.dataBinding.position},n.prototype.getAlertType=function(e){return e.dataBinding.alerttype},n.prototype.setAlertType=function(e,t){return _.isString(t)&&(e.dataBinding.alerttype=t),e.dataBinding.alerttype},n.prototype.getCancelButtonText=function(e){return e.dataBinding.cancelButtonText},n.prototype.setCancelButtonText=function(e,t){return _.isString(t)&&(e.dataBinding.cancelButtonText=t),e.dataBinding.cancelButtonText},n}(Q),Z=function(){function t(){}return t.prototype.initBinding=function(e,t,n){U(e,e._context,t,n)},t.prototype.notifyInflight=function(t,n,i,o){e.appManager.notify("toggle-variable-state",{variable:t,active:n,data:i,options:o})},t.prototype.setRequestTrackId=function(e,t){var n,i=null===(n=null==e?void 0:e.headers)||void 0===n?void 0:n.get("x-wm-request-track-id");i&&(t._requestTrackId=i)},t.prototype.httpCall=function(t,n,i){var o=this;return new Promise((function(r,a){n._observable=e.httpService.sendCallAsObservable(t,i).subscribe((function(e){e&&e.type&&(o.setRequestTrackId(e,n),r(e))}),(function(t){o.setRequestTrackId(t,n),e.httpService.isPlatformSessionTimeout(t)?(o.notifyInflight(n,!1,t),t._401Subscriber.asObservable().subscribe((function(e){return r(e)}),(function(e){return a(e)}))):a(t)}))}))},t.prototype.prepareCallbackOptions=function(e,t){var n={};return n.xhrObj=e,t&&_.extend(n,t),n},t}(),ee=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return b(i,t),i.prototype.validate=function(e){var t,n,i;for(n in["rememberme","remembermecheck"].forEach((function(t){_.isBoolean(e[t])&&(i=t)})),e[i=i||"j_rememberme"]=!!_.isBoolean(e[i])&&e[i],e)if(e.hasOwnProperty(n)&&(""===e[n]||void 0===e[n])){t="Please provide required credentials";break}return t},i.prototype.migrateOldParams=function(e){var t={},n={usernametext:"j_username",username:"j_username",passwordtext:"j_password",password:"j_password",remembermecheck:"j_rememberme",rememberme:"j_rememberme"};return _.each(e,(function(e,i){n[i]?t[n[i]]=e:t[i]=e})),t},i.prototype.redirectToAppBasePath=function(){e.routerService.navigate(["/"]).then((function(e){e&&window.location.reload()}))},i.prototype.login=function(t,i,o,r){var a,s=this,l=(i=i||{}).loginInfo||i.input||t.dataBinding,c=this.validate(l);if(c)return n.triggerFn(r,c),void I("onError",t,c);var p=n.getClonedObject(l),u=I(m.EVENT.BEFORE_UPDATE,t,p);if(_.isObject(u))p=u;else if(!1===u)return void n.triggerFn(r);p=this.migrateOldParams(p);var d=_.get(e.securityService.get(),"userInfo.userName");this.notifyInflight(t,!0),t.promise=e.securityService.appLogin(p,(function(i){e.dialogService.close("CommonLoginDialog"),e.appManager.reloadAppData().then((function(r){I(m.EVENT.RESULT,t,_.get(r,"userInfo")),(a=I(m.EVENT.PREPARE_SETDATA,t,_.get(r,"userInfo")))&&_.set(r,"userInfo",a),s.notifyInflight(t,!1,i),n.triggerFn(o),setTimeout((function(){if(I(m.EVENT.SUCCESS,t,_.get(r,"userInfo")),t.useDefaultSuccessHandler){var n=d===p.j_username;d&&!n||e.appManager.executeSessionFailureRequests();var i=e.securityService.getCurrentRouteQueryParam("redirectTo"),o=e.appManager.noRedirect(),a=e.securityService.getRedirectedRouteQueryParams();if(a.redirectTo&&delete a.redirectTo,e.appManager.noRedirect(!1),d)if(_.isEmpty(i)){var l=e.securityService.get(),c=_.get(l,"loginConfig.sessionTimeout.type")||"PAGE";n&&"DIALOG"===c||s.redirectToAppBasePath()}else d===p.j_username?e.routerService.navigate(["/"+i],{queryParams:a}):s.redirectToAppBasePath();else _.isEmpty(i)?o||e.routerService.navigate(["/"]):e.routerService.navigate(["/"+i],{queryParams:a})}I(m.EVENT.CAN_UPDATE,t,_.get(r,"userInfo"))}))}))}),(function(e){I(m.EVENT.RESULT,t,e),s.notifyInflight(t,!1,e);var i=e.error||"Invalid credentials.",o=e.details;h.isRunMode&&I("onError",t,i,o,!0),n.triggerFn(r,i,o),I(m.EVENT.CAN_UPDATE,t,e)}))},i}(Q),te=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return b(i,t),i.prototype.logout=function(t,i,o,r){var a,s,l,c=this;a=function(e,i,o){h.isStudioMode||I("onError",t,e,o),n.triggerFn(r,e,o)},!1!==I(m.EVENT.BEFORE_UPDATE,t,null)?e.securityService.isAuthenticated((function(i){i?(c.notifyInflight(t,!0),t.promise=e.securityService.appLogout((function(i){var r=i.body;r=n.getValidJSON(r),e.appManager.reloadAppData().then((function(){c.notifyInflight(t,!1,r),I(m.EVENT.RESULT,t,r),(l=I(m.EVENT.PREPARE_SETDATA,t,r))&&(r=l),setTimeout((function(){I(m.EVENT.SUCCESS,t,r),I(m.EVENT.CAN_UPDATE,t,r)}))})),r&&r.result?window.location.href=r.result:t.useDefaultSuccessHandler&&((s=t.redirectTo)&&"login.html"!==s&&"index.html"!==s||(s=""),e.routerService.navigate(["/"+s]),window.cordova||setTimeout((function(){window.location.reload()}))),n.triggerFn(o)}),a)):a("No authenticated user to logout.")}),(function(e){c.notifyInflight(t,!1,e),a(e)})):n.triggerFn(r)},i}(Q),ne=function(e){function t(){var t=e.apply(this,P([],w(arguments)))||this;return t.serviceRegistry=new Map,t}return b(t,e),t.prototype.invoke=function(e,t){var n=this,i=this.serviceRegistry.get(e.service);return null==i?(I("onError",e,null),Promise.reject("Could not find service '"+i+"'")):(this.notifyInflight(e,!0),i.invoke(e,t).then((function(t){return n.notifyInflight(e,!1,t),t}),(function(t){return n.notifyInflight(e,!1,t),Promise.reject(t)})))},t.prototype.registerService=function(e){this.serviceRegistry.set(e.name,e)},t}(Z),ie=function(){function e(){}return e.setPaginationQueryParams=function(e,t,n){t.parameters.forEach((function(t){var i;i="offset"===n.type||n.input.offset?"offset":"page",t.name===n.input[i].split(".")[0]?t.sampleValue=e.pagination.page:t.name===n.input.size.split(".")[0]&&(t.sampleValue=e.pagination.size)}))},e.setVariablePagination=function(e,t,n){e.pagination||(e.pagination={empty:!1}),e.pagination.size=t.size,e.pagination.page=t.page||0,e.pagination.totalElements=t.totalElements,e.pagination.numberOfElements=e.pagination.size,e.pagination.number=n.page?n.page-1:0,e.pagination.totalPages=e.pagination.totalElements/e.pagination.size,e.pagination.totalElements%e.pagination.size==0?e.pagination.totalPages=parseInt(e.pagination.totalPages):e.pagination.totalPages=parseInt(e.pagination.totalPages)+1,t.next?(e.pagination.next=t.next,e.pagination.prev=t.prev,e.pagination.last=!t.next,e.pagination.first=!t.prev):(e.pagination.first=e.pagination.page<=1,e.pagination.last=""===t.hasMoreItems?!(e.pagination.page<e.pagination.totalPages):!t.hasMoreItems)},e.setPaginationItems=function(e,t,n,i,r){var a;if(_.startsWith(e,"$body")){var s=e.replace("$body.","");try{n[i]=o.jmespath.search(t,s)}catch(t){console.warn(e+" expression needs to be corrected as per JMES guidelines")}}else if(_.startsWith(e,"$header")){var l=e.replace("$header.",""),c=Object.fromEntries(r.headers),p=l.split(".");try{n[i]=o.jmespath.search(c,p[0].toLowerCase())}catch(t){console.warn(e+" expression needs to be corrected as per JMES guidelines")}if(null===(a=n[i])||void 0===a?void 0:a.length){var u=n[i].join();if(1===p.length)n[i]=u;else{var d=p.slice(1).join("."),h=JSON.parse(u);/[!@#$%^&*()+\=\[\]{};':"\\|,<>\/?]+/.test(d)&&(d="headerResp."+d);try{n[i]=o.jmespath.search(h,d)}catch(t){console.warn(e+" expression needs to be corrected as per JMES guidelines")}}}}},e.getPaginationInfo=function(e,t){return(null==e?void 0:e.paginationInfo)?e.paginationInfo:t._paginationConfig},e.checkPaginationAtQuery=function(e,t,n){var i,o=this.getPaginationInfo(e,t);if(n&&n.page&&(null==o?void 0:o.input.size)&&t.pagination){var r;r="offset"===o.type||o.input.offset?"offset":"page";var a=o.input[r].split(".")[0],s=_.find(e.parameters,(function(e){return e.name===a}));!_.isEmpty(t.dataBinding)&&s&&"query"===s.parameterType&&((null===(i=o.output)||void 0===i?void 0:i.page)||"offset"===o.type?t.pagination.page=this.getOffsetInfo(t,n):t.pagination.page=n.page,this.setPaginationQueryParams(t,e,o))}},e.getOffsetInfo=function(e,t){return e.pagination.size*(t.page?t.page-1:1)},e.setPaginationAtReq=function(e,t,n,i,o,r,a){var s,l={},c={};s="offset"===e.type||e.input.offset?"offset":"page";var p=e.input[s].split(".")[0],u=_.find(t.parameters,(function(e){return e.name===p}));if("header"===(null==u?void 0:u.parameterType))_.set(l,e.input[s],n.pagination.page),_.set(l,e.input.size,n.pagination.size),i[p]=JSON.stringify(l[p]),c.headers=i;else if("body"===(null==u?void 0:u.parameterType)){var d=JSON.parse(u.sampleValue),h=e.input[s].split(".")[1];if(d&&d[h]){var m=e.input[s].split(".").splice(1).join(".");"offset"!==s?_.set(l,m,n.pagination.page):_.set(l,m,this.getOffsetInfo(n,a)),_.set(l,e.input.size.split(".").splice(1).join("."),n.pagination.size),d[h]=l[h],o=JSON.stringify(d),c.requestBody=o}}else if(n.pagination.next&&u)if("path"===u.parameterType){var f=t.relativePath.split("/"),g="{"+u.name+"}",v=f.indexOf(g),y=void 0;y=n.pagination.isNext?n.pagination.next.split("/"):n.pagination.prev.split("/");var b=void 0,w=void 0;t.directPath?((b=(w=new URL(r)).pathname.split("/"))[v]=y[v],w.pathname=b.join("/"),r=w.href,c.url=r):((b=r.split("/"))[v+1]=y[v],r=b.join("/"),c.url=r)}else if("query"===u.parameterType){f=r.split("?"),y=void 0;y=n.pagination.isNext?n.pagination.next.split("?"):n.pagination.prev.split("?"),f[1]=y[1],r=f.join("?"),c.url=r}return c},e.setParameterVal=function(e,t,n,i){var o=this.getPaginationInfo(n,i).input[e].split(".")[0],r=_.find(n.parameters,(function(e){return e.name===o}));t[e]=_.result(r,"sampleValue")},e.generatePaginationRes=function(e,t,n,i,o,r){var a={},s=t.output;if(null==s?void 0:s.next)s&&(this.setPaginationItems(s.next,n,a,"next",i),this.setPaginationItems(s.prev,n,a,"prev",i));else{if((null==s?void 0:s.size)?this.setPaginationItems(s.size,n,a,"size",i):this.setParameterVal("size",a,e,r),(null==s?void 0:s.page)?this.setPaginationItems(s.page,n,a,"page",i):"offset"!==t.type&&this.setParameterVal("page",a,e,r),_.startsWith(null==s?void 0:s.totalElements,"$minValue")){var l=s.totalElements.replace("$minValue=",""),c=a.page?a.page:o.page,p=a.size*c;!r.pagination||r.pagination.totalElements>p?a.totalElements=parseInt(l):a.totalElements=p+1}else(null==s?void 0:s.totalElements)?this.setPaginationItems(s.totalElements,n,a,"totalElements",i):"offset"===t.type||t.input.offset?a.totalElements=a.size*(o.page?o.page:1)+1:a.totalElements=a.size*a.page+1;(null==s?void 0:s.hasMoreItems)?this.setPaginationItems(s.hasMoreItems,n,a,"hasMoreItems",i):a.hasMoreItems=""}return a},e}(),oe=function(e){return _.includes(["QueryExecution","ProcedureExecution"],e.controller)&&_.includes(["put","post"],e.operationType)},re=function(e,t){return e===m.CONTROLLER_TYPE.QUERY&&t===m.SERVICE_TYPE.DATA},ae=function(e,t,i){var o=_.toLower(n.extractType(_.get(t,"items.type")||t.type)),r=h.isStudioMode?t["x-WM-CONTENT_TYPE"]:t.contentType;if(q())return"file"===o||"string"!==r&&r?_.isArray(i)&&"file"===o?_.forEach(i,(function(i){e.append(t.name,i&&i.content||n.getBlob(i),i.name)})):e.append(t.name,n.getBlob(i,r),i&&i.name):(_.isObject(i)&&(i=JSON.stringify(i)),e.append(t.name,i)),e},se=function(e,t){var i,o={},r=[];return _.forEach(t,(function(t){i=_.get(e,t.name),_.isUndefined(i)||""===i||null===i||t.readOnly?t.required&&r.push(t.name||t.id):(i=n.isDateTimeType(t.type)?K(i,t.type):i,_.isArray(i)&&"string"===_.toLower(n.extractType(t.type))&&(i=_.join(i,",")),o[t.name]=i)})),{requestBody:o,missingParams:r}},le=function(e){var t={},n=m.REST_SERVICE.UNCLOAKED_HEADERS,i=m.REST_SERVICE.PREFIX.CLOAK_HEADER_KEY;return _.forEach(e,(function(e,o){_.includes(n,o.toUpperCase())?t[o]=e:t[i+o]=e})),t},ce=function(){function t(){}return t.constructRequestParams=function(t,i,o,r){if(t=t||{},null===i)return{error:{type:m.REST_SERVICE.ERR_TYPE.USER_UNAUTHORISED,message:m.REST_SERVICE.ERR_MSG.USER_UNAUTHORISED,field:"_wmServiceOperationInfo"}};if(_.isEmpty(i))return{error:{type:m.REST_SERVICE.ERR_TYPE.METADATA_MISSING,message:m.REST_SERVICE.ERR_MSG.METADATA_MISSING,field:"_wmServiceOperationInfo"}};if(i&&i.invalid)return{error:{type:m.REST_SERVICE.ERR_TYPE.CRUD_OPERATION_MISSING,message:m.REST_SERVICE.ERR_MSG.CRUD_OPERATION_MISSING,field:"_wmServiceOperationInfo"}};var a,s,l,c,p,u,d,y,b,w,P,O,S,E,T,R,A,C=i.directPath||"",I=i.basePath?i.basePath+i.relativePath:i.relativePath,D=oe(t),N="",x={},k=[],M=null;function L(){return b||(b=new FormData)}if(S=_.get(i.securityDefinitions,"0"))switch(S.type){case m.REST_SERVICE.SECURITY_DEFN.OAUTH2:if(R=S[m.REST_SERVICE.OAUTH_PROVIDER_KEY],A=null,!(E=e.oauthService.getAccessToken(R,A)))return{error:{type:m.REST_SERVICE.ERR_TYPE.NO_ACCESSTOKEN,message:m.REST_SERVICE.ERR_MSG.NO_ACCESSTOKEN},securityDefnObj:S};x[m.REST_SERVICE.AUTH_HDR_KEY]=m.REST_SERVICE.PREFIX.AUTH_HDR_VAL.OAUTH+" "+E;break;case m.REST_SERVICE.SECURITY_DEFN.BASIC:if(u=o.wm_auth_username,d=o.wm_auth_password,!u||!d)return{error:{type:m.REST_SERVICE.ERR_TYPE.NO_CREDENTIALS,message:m.REST_SERVICE.ERR_MSG.NO_CREDENTIALS},securityDefnObj:S};x[m.REST_SERVICE.AUTH_HDR_KEY]=m.REST_SERVICE.PREFIX.AUTH_HDR_VAL.BASIC+" "+btoa(u+":"+d),M={type:m.REST_SERVICE.AUTH_TYPE.BASIC}}if(ie.checkPaginationAtQuery(i,t,r),i.proxySettings=i.proxySettings||{web:!0,mobile:!1},y=i.httpMethod||i.methodType,w=h.hasCordova?i.proxySettings.mobile:i.proxySettings.web,T=i.proxySettings.withCredentials,l=w?I:C,_.forEach(i.parameters,(function(e){function r(){o?(P=o[e.name]&&_.isObject(o[e.name])?o[e.name]:o,O=_.get(i,["definitions",e.type])):(P=c||{},O=e.children)}var c=e.sampleValue;if(n.isDefined(c)&&null!==c&&""!==c||D&&"file"!==e.type)switch(t.serviceType===m.SERVICE_TYPE.DATA&&n.isDateTimeType(e.type)&&(c=K(c,e.type)),_.isArray(c)&&"string"===_.toLower(n.extractType(e.type))&&t.serviceType===m.SERVICE_TYPE.DATA&&(c=_.join(c,",")),e.parameterType.toUpperCase()){case"QUERY":if(_.isNull(c)&&re(t.controller,t.serviceType))break;N?N+="&"+e.name+"="+encodeURIComponent(c):N="?"+e.name+"="+encodeURIComponent(c);break;case"PATH":p=new RegExp("\\s*\\{\\s*"+e.name+"(:\\.\\+)?\\s*\\}\\s*"),l=l.replace(p,c);break;case"HEADER":x[e.name]=c;break;case"BODY":D?(r(),a=se(P,O),s=a.requestBody,k=_.concat(k,a.missingParams)):s=c;break;case"FORMDATA":D&&e.name===g.WM_DATA_JSON?(r(),a=se(P,O),s=ae(L(),e,a.requestBody),k=_.concat(k,a.missingParams)):s=ae(L(),e,c)}else e.required&&k.push(e.name||e.id)})),k.length)return{error:{type:m.REST_SERVICE.ERR_TYPE.REQUIRED_FIELD_MISSING,field:k.join(","),message:n.replace(m.REST_SERVICE.ERR_MSG.REQUIRED_FIELD_MISSING,[k.join(",")]),skipDefaultNotification:!0}};_.includes(f.NON_BODY_HTTP_METHODS,_.toUpper(y))||i.consumes&&i.consumes[0]===f.CONTENT_TYPES.MULTIPART_FORMDATA||(x["Content-Type"]=i.consumes&&i.consumes[0]||"application/json"),_.includes(i.consumes,f.CONTENT_TYPES.FORM_URL_ENCODED)&&!_.includes(f.NON_BODY_HTTP_METHODS,(y||"").toUpperCase())?(N&&(s=(s?s+"&":"")+N.substring(1)),x["Content-Type"]=f.CONTENT_TYPES.FORM_URL_ENCODED):l+=N,w&&(x=t.serviceType!==m.SERVICE_TYPE.REST&&t.serviceType!==m.SERVICE_TYPE.OPENAPI||i.skipCloakHeaders?x:le(x),t.getPrefabName()&&-1!==m.REST_SUPPORTED_SERVICES.indexOf(t.serviceType)?(l="prefabs/"+t.getPrefabName()+l,c="invokePrefabRestService"):t.getPrefabName()||(l="services"+l),l=v.project.deployedUrl+l);var F=ie.getPaginationInfo(i,t);if(F&&t.pagination){var j=ie.setPaginationAtReq(F,i,t,x,s,l,r);j&&(j.headers?x=j.headers:j.requestBody?s=j.requestBody:j.url&&(l=j.url))}return{projectID:v.project.id,url:l,target:c,method:y,headers:x,data:s,authDetails:M,isDirectCall:!w,isExtURL:t.serviceType===m.SERVICE_TYPE.REST,withCredentials:T}},t.isFileUploadRequest=function(e){return"FileService"===e.service&&"uploadFile"===e.operation},t.excludePaginationParams=function(e){return _.map(_.reject(e,(function(e){return _.includes(m.PAGINATION_PARAMS,e.name)})),(function(e){return e.name}))},t}(),pe=function(t){function o(){var e=t.apply(this,P([],w(arguments)))||this;return e.scope_var_socket_map=new Map,e.PROPERTY={SERVICE:"service",DATA_UPDATE_STRATEGY:"dataUpdateStrategy",DATA_LIMIT:"dataLimit"},e.DATA_UPDATE_STRATEGY={REFRESH:"refresh",PREPEND:"prepend",APPEND:"append"},e}return b(o,t),o.prototype.shouldAppendData=function(e){return(e=e||this)[this.PROPERTY.DATA_UPDATE_STRATEGY]!==this.DATA_UPDATE_STRATEGY.REFRESH},o.prototype.shouldAppendLast=function(e){return e[this.PROPERTY.DATA_UPDATE_STRATEGY]===this.DATA_UPDATE_STRATEGY.APPEND},o.prototype.getDataLimit=function(e){return e.dataLimit},o.prototype.getURL=function(t){var n,i=t.getPrefabName(),o=i?_.get(e.metadataService.getByOperationId(t.operationId,i),"wmServiceOperationInfo"):_.get(e.metadataService.getByOperationId(t.operationId),"wmServiceOperationInfo"),r=t.dataBinding;if(_.forEach(o.parameters,(function(e){e.sampleValue=r[e.name]})),$.extend(o,{skipCloakHeaders:!0}),!(n=ce.constructRequestParams(t,o,r)).error||!n.error.message)return n.url;this._onSocketError(t,{data:n.error.message})},o.prototype._onSocketMessage=function(e,t){var i,o,r,a,s,l=_.get(t,"data");l=n.getValidJSON(l)||n.xmlToJson(l)||l,i=I(m.EVENT.MESSAGE_RECEIVE,e,l,t),l=n.isDefined(i)?i:l,this.shouldAppendData(e)?(e.dataSet=e.dataSet||[],o=e.dataSet.length,r=this.getDataLimit(e),a=this.shouldAppendLast(e),r&&o>=r&&(a?e.dataSet.shift():e.dataSet.pop()),s=a?o:0,e.dataSet.splice(s,0,l)):e.dataSet=n.isDefined(i)?i:l},o.prototype._onBeforeSend=function(e,t){return I(m.EVENT.BEFORE_SEND,e,t)},o.prototype._onBeforeSocketClose=function(e,t){return I(m.EVENT.BEFORE_CLOSE,e,_.get(t,"data"),t)},o.prototype._onBeforeSocketOpen=function(e,t){return I(m.EVENT.BEFORE_OPEN,e,_.get(t,"data"),t)},o.prototype._onSocketOpen=function(e,t){e._socketConnected=!0,I(m.EVENT.OPEN,e,_.get(t,"data"),t)},o.prototype.freeSocket=function(e){this.scope_var_socket_map.set(e,void 0)},o.prototype._onSocketClose=function(e,t){e._socketConnected=!1,this.freeSocket(e),I(m.EVENT.CLOSE,e,_.get(t,"data"),t)},o.prototype._onSocketError=function(e,t){e._socketConnected=!1,this.freeSocket(e),I(m.EVENT.ERROR,e,_.get(t,"data")||"Error while connecting with "+e.service,t)},o.prototype.getSocket=function(e){var t=this.getURL(e),o=this.scope_var_socket_map.get(e);return o||(h.hasCordova||!n.isInsecureContentRequest(t)?((o=new i.$WebSocket(t)).onOpen(this._onSocketOpen.bind(this,e)),o.onError(this._onSocketError.bind(this,e)),o.onMessage(this._onSocketMessage.bind(this,e)),o.onClose(this._onSocketClose.bind(this,e)),this.scope_var_socket_map.set(e,o),e._socket=o,o):void n.triggerFn(this._onSocketError.bind(this,e)))},o.prototype.open=function(e,t,i){var o;if(!1!==this._onBeforeSocketOpen(e))return o=this.getSocket(e),n.triggerFn(t),o;n.triggerFn(i)},o.prototype.close=function(e){var t=this._onBeforeSocketClose(e),n=this.getSocket(e);!1!==t&&n.close()},o.prototype.send=function(e,t){var i,o=this.getSocket(e);t=t||_.get(e,"dataBinding.RequestBody"),!1!==(i=this._onBeforeSend(e,t))&&(t=n.isDefined(i)?i:t,t=n.isObject(t)?JSON.stringify(t):t,o.send(t,0))},o}(Z),ue=new Map,de={Variable:Z,Action:Q,"wm.NavigationVariable":X,"wm.NotificationVariable":J,"wm.LoginVariable":ee,"wm.LogoutVariable":te,"wm.DeviceVariable":ne,"wm.WebSocketVariable":pe},he=function(){function e(){}return e.get=function(e){return ue.has(e)?ue.get(e):ue.set(e,new de[e]).get(e)},e}(),me=function(){function e(){}return e.prototype.invoke=function(e,t){var i=this.operations.find((function(t){return t.name===e.operation}));if(null==i)return I(m.EVENT.ERROR,e,null),Promise.reject("Could not find operation '"+e.operation+"' in service '"+this.name+"'");if(n.hasCordova()){var o=new Map;return void 0!==e.dataBinding&&(Object.entries(e).forEach((function(e){o.set(e[0],e[1])})),Object.entries(e.dataBinding).forEach((function(e){o.set(e[0],e[1])}))),i.invoke(e,t,o).then((function(t){return e.dataSet=t,n.$invokeWatchers(!0),I(m.EVENT.SUCCESS,e,t),t}),(function(t){return e.dataSet={},n.$invokeWatchers(!0),I(m.EVENT.ERROR,e,null),t}))}return Promise.resolve().then((function(){return I(m.EVENT.SUCCESS,e,i.model),i.model}))},e}(),fe=function(){return he.get(m.CATEGORY.DEVICE)},ge=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.init=function(){fe().initBinding(this)},t.prototype.invoke=function(e,t,n){fe().invoke(this,e).then(t,n)},t}(t.ApiAwareVariable),ve=function(){return he.get(m.CATEGORY.NAVIGATION)},ye=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.invoke=function(e){ve().invoke(this,e)},t.prototype.navigate=function(e){this.invoke(e)},t.prototype.init=function(){ve().initBinding(this,"dataBinding","dataBinding"),ve().initBinding(this,"dataSet","dataSet")},t}(t.BaseAction),be=function(){return he.get(m.CATEGORY.NOTIFICATION)},we=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.execute=function(t,i){var o=this,r=e.prototype.execute.call(this,t,i);return n.isDefined(r)?r:new Promise((function(e,r){switch(t){case n.DataSource.Operation.INVOKE:o.invoke(i,e,r);break;case n.DataSource.Operation.NOTIFY:o.notify(i,e,r);break;default:r(t+" operation is not supported on this data source")}}))},t.prototype.notify=function(e,t,n){be().notify(this,e,t,n)},t.prototype.invoke=function(e,t,n){this.notify(e,t,n)},t.prototype.getMessage=function(){return be().getMessage(this)},t.prototype.setMessage=function(e){return be().setMessage(this,e)},t.prototype.clearMessage=function(){return be().setMessage(this,"")},t.prototype.getOkButtonText=function(){return be().getOkButtonText(this)},t.prototype.setOkButtonText=function(e){return be().setOkButtonText(this,e)},t.prototype.getToasterDuration=function(){return be().getToasterDuration(this)},t.prototype.setToasterDuration=function(e){return be().setToasterDuration(this,e)},t.prototype.getToasterClass=function(){return be().getToasterClass(this)},t.prototype.setToasterClass=function(e){return be().setToasterClass(this,e)},t.prototype.getToasterPosition=function(){return be().getToasterPosition(this)},t.prototype.setToasterPosition=function(e){return be().setToasterPosition(this,e)},t.prototype.getAlertType=function(){return be().getAlertType(this)},t.prototype.setAlertType=function(e){return be().setAlertType(this,e)},t.prototype.getCancelButtonText=function(){return be().getCancelButtonText(this)},t.prototype.setCancelButtonText=function(e){return be().setCancelButtonText(this,e)},t.prototype.init=function(){be().initBinding(this,"dataBinding","dataBinding"),be().initBinding(this,"dataSet","dataSet")},t}(t.BaseAction),Pe=function(){return he.get(m.CATEGORY.LOGIN)},_e=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.login=function(e,t,n){return Pe().login(this,e,t,n)},t.prototype.invoke=function(e,t,n){return this.login(e,t,n)},t.prototype.cancel=function(){},t.prototype.init=function(){Pe().initBinding(this,"dataBinding","dataBinding")},t}(t.BaseAction),Oe=function(){return he.get(m.CATEGORY.LOGOUT)},Se=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.logout=function(e,t,n){Oe().logout(this,e,t,n)},t.prototype.invoke=function(e,t,n){this.logout(e,t,n)},t.prototype.cancel=function(){},t}(t.BaseAction),Ee=function(){return he.get(m.CATEGORY.WEBSOCKET)},Te=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.open=function(e,t){return Ee().open(this,e,t)},t.prototype.close=function(){return Ee().close(this)},t.prototype.update=function(){return Ee().update(this)},t.prototype.send=function(e){return Ee().send(this,e)},t.prototype.cancel=function(){return this.close()},t.prototype.invoke=function(e,t,n){this.open(t,n)},t.prototype.init=function(){Ee().initBinding(this)},t}(t.ApiAwareVariable),Re=function(){function e(){}return e.create=function(e,n){var i;switch(e.category){case t.VARIABLE_CONSTANTS.CATEGORY.MODEL:i=new t.ModelVariable(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.SERVICE:i=new t.ServiceVariable(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.LIVE:i=new t.LiveVariable(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.CRUD:i=new t.CrudVariable(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.DEVICE:i=new ge(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.NAVIGATION:i=new ye(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.NOTIFICATION:i=new we(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.LOGIN:i=new _e(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.LOGOUT:i=new Se(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.TIMER:i=new t.TimerAction(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.WEBSOCKET:i=new Te(e)}return i._context=n,i.__cloneable__=!1,i},e}(),Ae=function(){function e(e){this.$http=e,this.CONTEXT_APP="app"}return e.prototype.isLoaded=function(){return!!this.metadataMap&&this.metadataMap.has(this.CONTEXT_APP)},e.prototype.load=function(e){var t,i=this;return t=n.hasCordova()?"metadata/"+(e?"prefabs/"+e+"/":"app/")+"service-definitions.json":"./services/"+(e?"prefabs/"+e+"/":"")+"servicedefs",new Promise((function(n,o){i.$http.send({url:t,method:"GET"}).then((function(t){i.metadataMap=i.metadataMap||new Map,i.providerMap=i.providerMap||new Map,t.body=t.body||{},i.metadataMap.set(e||i.CONTEXT_APP,t.body.serviceDefs),t.body.securityDefinitions&&i.providerMap.set(e||i.CONTEXT_APP,t.body.securityDefinitions.oauthProvider),n(t.body.serviceDefs)}),o)}))},e.prototype.getByOperationId=function(e,t){t=t||this.CONTEXT_APP;var n=this.metadataMap.get(t);return n&&n[e]},e.prototype.getByProviderId=function(e,t){t=t||this.CONTEXT_APP;var n=this.providerMap.get(t);return n&&n[e]},e.prototype.getByCrudId=function(e,t){t=t||this.CONTEXT_APP;var n=this.metadataMap.get(t),i=[];for(var o in n)n[o]&&n[o].crudOperationId===e&&i.push(n[o]);return i},e}();Ae.decorators=[{type:r.Injectable}],Ae.ctorParameters=function(){return[{type:n.AbstractHttpService}]};var Ce=function(){function t(){}return t.prototype.format=function(t,n){return e.appManager.getPipe("date").transform(t,n)},t}(),Ie=function(){function e(e,n,i,o,r,a,s,l){this.httpService=e,this.metadataService=n,this.navigationService=i,this.routerService=o,this.toasterService=r,this.oAuthService=a,this.securityService=s,this.dialogService=l,C("http",this.httpService),C("metadata",this.metadataService),C("navigationService",this.navigationService),C("router",this.routerService),C("toaster",this.toasterService),C("oAuth",this.oAuthService),C("security",this.securityService),C("dialog",this.dialogService),t.wmSetDependency("oAuth",this.oAuthService),t.wmSetDependency("security",this.securityService),t.wmSetDependency("metadata",this.metadataService)}return e.prototype.bulkCancel=function(e){Object.keys(e).forEach((function(t){var n=e[t];_.isFunction(n.cancel)&&n.cancel()}))},e.prototype.triggerStartUpdate=function(e){return Promise.all(Object.keys(e).map((function(t){return e[t]})).filter((function(e){return(null==e?void 0:e.startUpdate)&&e.invoke})).map((function(e){return e.invoke()})))},e.prototype.processBindExp=function(e,i,o){var r=t.getTarget(o),a=t.getTargetNodeKey(e.target),s=_.isArray(e.value)?e.value[0]:e.value;return s&&(s.startsWith&&s.startsWith("bind:")?s=n.$watch(s.replace("bind:",""),i,{},o.invokeOnParamChange.bind(o,e),void 0,void 0,void 0,(function(){return o.isMuted})):_.isUndefined(e.value)||(t.setValueToNode(e.target,e,r,o,e.value,!0),r!==a&&(t.internalBoundNodeMap.has(o)||t.internalBoundNodeMap.set(o,{}),_.set(t.internalBoundNodeMap.get(o),[o.name,r,e.target],e.value)))),{name:e.target,value:s}},e.prototype.processBinding=function(e,t,n,i){var o=this;i=i||"dataBinding";var r=e[n=n||"dataBinding"];e[n]={},e["_bind"+n]=r,r&&_.isArray(r)&&r.forEach((function(n){"wm.Variable"===e.category&&"dataBinding"===n.target&&(n.target="dataSet"),o.processBindExp(n,t,e)}))},e.prototype.isVariableSeperated=function(e,t){return"wm.Variable"===e[t].category||"wm.ServiceVariable"===e[t].category||"wm.LiveVariable"===e[t].category||"wm.CrudVariable"===e[t].category},e.prototype.getBindSourceTarget=function(e){return"wm.LiveVariable"===e.category?"read"===e.operation?"filterFields":"inputFields":"wm.ModelVariable"===e.category?"dataSet":"dataBinding"},e.prototype.register=function(e,i,o){var r,a=this,s={Variables:{},Actions:{},callback:this.triggerStartUpdate};for(var l in i){if((r=Re.create(i[l],o)).init(),this.isVariableSeperated(i,l)&&(this.processBinding(r,o,"dataBinding",this.getBindSourceTarget(r)),r.httpService=this.httpService,r.dateFormatter=new Ce,r.subscribe("afterInvoke",(function(){return n.$invokeWatchers(!0)})),"wm.LiveVariable"===r.category&&"read"===r.operation&&n.processFilterExpBindNode(r._context,r.filterExpressions,r),"wm.CrudVariable"!==r.category&&"wm.ServiceVariable"!==r.category||(r.simulateFileDownload=W)),this.isVariableSeperated(i,l)||"wm.TimerVariable"===i[l].category)for(var c in m.EVENT)r[m.EVENT[c]]&&(r[m.EVENT[c]]=n.$parseEvent(r[m.EVENT[c]]));r instanceof t.BaseAction?s.Actions[l]=r:s.Variables[l]=r}return o.registerDestroyListener&&o.registerDestroyListener((function(){a.bulkCancel(s.Variables),a.bulkCancel(s.Actions)})),s},e.prototype.destroy=function(){},e.prototype.registerDependency=function(e,n){C(e,n),t.wmSetDependency(e,n)},e}();Ie.decorators=[{type:r.Injectable}],Ie.ctorParameters=function(){return[{type:n.AbstractHttpService},{type:Ae},{type:n.AbstractNavigationService},{type:a.Router},{type:n.AbstractToasterService},{type:s.OAuthService},{type:l.SecurityService},{type:n.AbstractDialogService}]};var De=u.ToastrModule.forRoot({maxOpened:1,autoDismiss:!0}),Ne=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[Ie,Ae,c.Location,{provide:c.LocationStrategy,useClass:c.HashLocationStrategy}]}},e}();Ne.decorators=[{type:r.NgModule,args:[{imports:[c.CommonModule,De,p.HttpClientModule,d.HttpServiceModule,s.OAuthModule,l.SecurityModule],declarations:[]}]}],e.$rootScope=v,e.CONSTANTS=h,e.DB_CONSTANTS={DATABASE_MATCH_MODES:{like:"LIKE",start:"STARTING_WITH",startignorecase:"STARTING_WITH_IGNORECASE",end:"ENDING_WITH",endignorecase:"ENDING_WITH_IGNORECASE",anywhere:"CONTAINING",anywhereignorecase:"CONTAINING_IGNORECASE",nowhere:"DOES_NOT_CONTAIN",nowhereignorecase:"DOES_NOT_CONTAIN_IGNORECASE",exact:"EQUALS",exactignorecase:"EQUALS_IGNORECASE",notequals:"NOT_EQUALS",notequalsignorecase:"NOT_EQUALS_IGNORECASE",between:"BETWEEN",in:"IN",notin:"NOTIN",lessthan:"LESS_THAN",lessthanequal:"LESS_THAN_OR_EQUALS",greaterthan:"GREATER_THAN",greaterthanequal:"GREATER_THAN_OR_EQUALS",null:"NULL",isnotnull:"IS_NOT_NULL",empty:"EMPTY",isnotempty:"IS_NOT_EMPTY",nullorempty:"NULL_OR_EMPTY"},DATABASE_EMPTY_MATCH_MODES:["NULL","IS_NOT_NULL","EMPTY","IS_NOT_EMPTY","NULL_OR_EMPTY"],DATABASE_RANGE_MATCH_MODES:["IN","NOTIN","BETWEEN","LESS_THAN","LESS_THAN_OR_EQUALS","GREATER_THAN","GREATER_THAN_OR_EQUALS","NOT_EQUALS"],DATABASE_NULL_EMPTY_MATCH:{NULL:"NULL",IS_NOT_NULL:"IS_NOT_NULL",EMPTY:"NULL",IS_NOT_EMPTY:"IS_NOT_NULL",NULL_OR_EMPTY:"NULL"},DATABASE_MATCH_MODES_WITH_QUERY:{LIKE:"${0} like ${1}",STARTING_WITH:"${0} like ${1}",STARTING_WITH_IGNORECASE:"${0} like ${1}",ENDING_WITH:"${0} like ${1}",ENDING_WITH_IGNORECASE:"${0} like ${1}",CONTAINING:"${0} like ${1}",CONTAINING_IGNORECASE:"${0} like ${1}",DOES_NOT_CONTAIN:"${0} not like ${1}",DOES_NOT_CONTAIN_IGNORECASE:"${0} not like ${1}",EQUALS:"${0}=${1}",EQUALS_IGNORECASE:"${0}=${1}",NOT_EQUALS:"${0}!=${1}",NOT_EQUALS_IGNORECASE:"${0}!=${1}",BETWEEN:"${0} between ${1}",IN:"${0} in ${1}",NOTIN:"${0} not in ${1}",LESS_THAN:"${0}<${1}",LESS_THAN_OR_EQUALS:"${0}<=${1}",GREATER_THAN:"${0}>${1}",GREATER_THAN_OR_EQUALS:"${0}>=${1}",NULL:"${0} is null",IS_NOT_NULL:"${0} is not null",EMPTY:"${0}=''",IS_NOT_EMPTY:"${0}<>''",NULL_OR_EMPTY:"${0} is null or ${0}=''"},DATABASE_STRING_MODES:["LIKE","STARTING_WITH","STARTING_WITH_IGNORECASE","ENDING_WITH","ENDING_WITH_IGNORECASE","CONTAINING","CONTAINING_IGNORECASE","DOES_NOT_CONTAIN","DOES_NOT_CONTAIN_IGNORECASE","EQUALS","EQUALS_IGNORECASE","NOT_EQUALS","NOT_EQUALS_IGNORECASE"]},e.DeviceVariableManager=ne,e.DeviceVariableService=me,e.Formatter=Ce,e.MetadataService=Ae,e.SWAGGER_CONSTANTS=g,e.VARIABLE_CONSTANTS=m,e.VARIABLE_URLS={DATABASE:{searchTableData:{url:"/:service/:dataModelName/:entityName/search?page=:page&size=:size&:sort",method:"POST"},searchTableDataWithQuery:{url:"/:service/:dataModelName/:entityName/filter?page=:page&size=:size&:sort",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"}},readTableData:{url:"/:service/:dataModelName/:entityName?page=:page&size=:size&:sort",method:"GET"},insertTableData:{url:"/:service/:dataModelName/:entityName",method:"POST"},insertMultiPartTableData:{url:"/:service/:dataModelName/:entityName",method:"POST",headers:{}},updateTableData:{url:"/:service/:dataModelName/:entityName/:id",method:"PUT"},updateMultiPartTableData:{url:"/:service/:dataModelName/:entityName/:id",method:"POST",headers:{}},deleteTableData:{url:"/:service/:dataModelName/:entityName/:id",method:"DELETE"},updateCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id?:id",method:"PUT"},periodUpdateCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id/periods?:id",method:"PUT"},updateMultiPartCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id?:id",method:"POST",headers:{}},deleteCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id?:id",method:"DELETE"},periodDeleteCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id/periods?:id",method:"DELETE"},getDistinctDataByFields:{url:"/:service/:dataModelName/:entityName/aggregations?page=:page&size=:size&:sort",method:"POST"},exportTableData:{url:"/services/:dataModelName/:entityName/export?:sort",method:"POST"},readTableRelatedData:{url:"/:service/:dataModelName/:entityName/:id/:relatedFieldName?page=:page&size=:size&:sort",method:"GET"},executeNamedQuery:{url:"/:service/:dataModelName/queryExecutor/queries/:queryName?page=:page&size=:size&:queryParams",method:"GET"},executeCustomQuery:{url:"/:service/:dataModelName/queries/execute?page=:page&size=:size",method:"POST"},executeAggregateQuery:{url:"/services/:dataModelName/:entityName/aggregations?page=:page&size=:size&sort=:sort",method:"POST"},executeNamedProcedure:{url:"/:service/:dataModelName/procedureExecutor/procedure/execute/:procedureName?page=:page&size=:size&:procedureParams",method:"GET"},countTableDataWithQuery:{url:"/:service/:dataModelName/:entityName/count?:queryParams",method:"GET"}},oauthConfiguration:{getAuthorizationUrl:{url:"services/oauth2/:providerId/authorizationUrl",method:"GET"}}},e.VariableManagerFactory=he,e.VariablesModule=Ne,e.VariablesService=Ie,e.WS_CONSTANTS=f,e.debounceVariableCall=z,e.formatDate=K,e.formatExportExpression=function(e){return _.forEach(e,(function(e){e.expression&&(e.expression="${"+e.expression+"}")})),e},e.getEvaluatedOrderBy=function(e,t){var n,i;return!t||_.isEmpty(t)?e:e?(e=_.split(e,","),t=_.split(t,","),n=_.map(t,(function(e){return _.split(_.trim(e)," ")[0]})),_.remove(e,(function(e){return _.includes(n,_.split(_.trim(e)," ")[0])})),i=e.length?","+_.join(e,","):"",_.join(t,",")+i):t},e.initiateCallback=I,e.isFileUploadSupported=q,e.processBinding=U,e.setDependency=C,e.setInput=function(e,t,i,o){e=e||{};var r,a,s={};if(_.isObject(o))switch(o.type){case"file":i=n.getBlob(i,o.contentType);break;case"number":i=_.isNumber(i)?i:parseInt(i,10)}return _.isObject(t)?s=t:t.indexOf(".")>-1?(a=(r=t.split(".")).pop(),e=n.findValueOf(e,r.join("."),!0),s[t=a]=i):s[t]=i,_.forEach(s,(function(t,n){e[n]=t})),e},e.simulateFileDownload=W,e.toastrModule=De,e["\u0275a"]=Z,e["\u0275b"]=Q,e["\u0275c"]=X,e["\u0275d"]=J,e["\u0275e"]=ee,e["\u0275f"]=te,e["\u0275g"]=pe,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@awesome-cordova-plugins/file/ngx"),require("@wm/core"),require("@wm/mobile/core"),require("@wm/security"),require("@awesome-cordova-plugins/app-version/ngx"),require("@awesome-cordova-plugins/sqlite/ngx"),require("@wm/variables"),require("@awesome-cordova-plugins/app-version/ngx/index"),require("@awesome-cordova-plugins/file/ngx/index"),require("@awesome-cordova-plugins/sqlite/ngx/index"),require("rxjs"),require("@wavemaker/variables")):"function"==typeof define&&define.amd?define("@wm/mobile/offline",["exports","@angular/core","@angular/common","@awesome-cordova-plugins/file/ngx","@wm/core","@wm/mobile/core","@wm/security","@awesome-cordova-plugins/app-version/ngx","@awesome-cordova-plugins/sqlite/ngx","@wm/variables","@awesome-cordova-plugins/app-version/ngx/index","@awesome-cordova-plugins/file/ngx/index","@awesome-cordova-plugins/sqlite/ngx/index","rxjs","@wavemaker/variables"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.mobile=e.wm.mobile||{},e.wm.mobile.offline={}),e.ng.core,e.ng.common,e.awesomeCordova.plugins,e.wm.core,e.wm.mobile.core,e.wm.security,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.wm.variables,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.rxjs,e.wm_common_variables)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h,m){"use strict";function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var g=f(t),v=f(o),y=f(r),b=f(a),w=f(p),P=f(u),O=f(d),S=function(){function e(){}return e.prototype.get=function(e){return this.fetchEntry(e).then((function(e){var t;return e&&e.length>0&&(t=e[0].value)&&(t=JSON.parse(t)),t}))},e.prototype.init=function(e){this.store=e},e.prototype.put=function(e,t){var n=this;return t&&(t=JSON.stringify(t)),this.fetchEntry(e).then((function(i){return i&&i.length>0?n.store.save({id:i[0].id,key:e,value:t}):n.store.add({key:e,value:t})}))},e.prototype.remove=function(e){var t=this;return this.fetchEntry(e).then((function(e){if(e&&e.length>0)return t.store.delete(e[0].id)}))},e.prototype.fetchEntry=function(e){var t=[{attributeName:"key",attributeValue:e,attributeType:"STRING",filterCondition:"EQUALS"}];return this.store.filter(t)},e}();S.SERVICE_NAME="LocalKeyValueService",S.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new S},token:S,providedIn:"root"}),S.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var E,T="WM_LOCAL_OFFLINE_CALL",R=function(e){if(e)return'"'+(e=e.replace(/"/g,'""'))+'"'},A=function(e){var t=[],n=[];return _.forEach(e.columns,(function(e){t.push(R(e.name)),n.push("?")})),"INSERT INTO "+R(e.name)+" ("+t.join(",")+") VALUES ("+n.join(",")+")"},C=function(e){var t=[],n=[];return _.forEach(e.columns,(function(e){t.push(R(e.name)),n.push("?")})),"REPLACE INTO "+R(e.name)+" ("+t.join(",")+") VALUES ("+n.join(",")+")"},I=function(e){var t=_.find(e.columns,"primaryKey");return t?"DELETE FROM "+R(e.name)+" WHERE "+R(t.name)+" = ?":""},D=function(e){var t=[],n=[];return e.columns.forEach((function(i){var o;t.push(R(e.name)+"."+R(i.name)+" as "+i.fieldName),i.foreignRelations&&i.foreignRelations.forEach((function(r){o=r.sourceFieldName,_.forEach(r.dataMapper,(function(e,n){t.push(o+"."+R(e.name)+" as '"+n+"'")})),n.push(" LEFT JOIN "+R(r.targetTable)+" "+o+"\n ON "+o+"."+R(r.targetColumn)+" = "+R(e.name)+"."+R(i.name))}))})),"SELECT "+t.join(",")+" FROM "+R(e.name)+" "+n.join(" ")},N=function(e){var t=[];return e.columns.forEach((function(n){var i;n.foreignRelations&&n.foreignRelations.forEach((function(o){i=o.sourceFieldName,t.push(" LEFT JOIN "+R(o.targetTable)+" "+i+"\n ON "+i+"."+R(o.targetColumn)+" = "+R(e.name)+"."+R(n.name))}))})),"SELECT count(*) as count FROM "+R(e.name)+" "+t.join(" ")},x=function(e,t){var n,i=e.fieldToColumnMapping,o=e.entitySchema.name;return!_.isEmpty(t)&&_.isString(t)?" WHERE "+t:(t&&(n=t.map((function(e){var t=i[e.attributeName],n=e.filterCondition,r=e.attributeValue,a="=";return"STRING"===e.attributeType?("STARTING_WITH"===n?(r+="%",a="like"):"ENDING_WITH"===n?(r="%"+r,a="like"):"CONTAINING"===n&&(r="%"+r+"%",a="like"),r="'"+r+"'"):"BOOLEAN"===e.attributeType&&(r=!0===r?1:0),R(o)+"."+R(t)+" "+a+" "+r}))),n&&n.length>0?" WHERE "+n.join(" AND "):"")},k=function(e,t){return t?" ORDER BY "+_.map(t.split(","),(function(t){var n=_.trim(t).split(" ");return n[0]=R(e.entitySchema.name)+"."+R(e.fieldToColumnMapping[n[0]]),n.join(" ")})).join(","):""},M=function(e){return" LIMIT "+((e=e||{}).limit||100)+" OFFSET "+(e.offset||0)},L=function(e,t){return e.columns.forEach((function(e){var n=t[e.fieldName];e.foreignRelations?e.foreignRelations.forEach((function(e){var n=null;_.forEach(e.dataMapper,(function(e,i){var r=t[i];o.isDefined(r)&&null!==r&&""!==r&&((n=n||{})[e.fieldName]=t[i]),delete t[i]})),t[e.sourceFieldName]=n})):"boolean"!==e.sqlType||_.isNil(n)||(t[e.fieldName]=1===n)})),t},F=function(e,t){var n=e[t.fieldName];return t.foreignRelations&&t.foreignRelations.some((function(t){return!(!t.targetEntity||!e[t.sourceFieldName])&&(n=e[t.sourceFieldName][t.targetFieldName],!0)})),_.isNil(n)?t.defaultValue:"boolean"===t.sqlType?!0===n?1:0:n},j=function(e,t){var n={};return e.entitySchema.columns.forEach((function(e){return n[e.name]=F(t,e)})),n},B=function(){function e(e,t,n,i,o){var r=this;this.deviceFileService=e,this.entitySchema=t,this.file=n,this.localDbManagementService=i,this.sqliteObject=o,this.fieldToColumnMapping={},this.primaryKeyField=_.find(this.entitySchema.columns,"primaryKey"),this.primaryKeyName=this.primaryKeyField?this.primaryKeyField.fieldName:void 0,this.entitySchema.columns.forEach((function(e){r.fieldToColumnMapping[e.fieldName]=e.name,e.foreignRelations&&e.foreignRelations.forEach((function(t){r.fieldToColumnMapping[t.targetPath]=e.name,_.forEach(t.dataMapper,(function(e,n){r.fieldToColumnMapping[n]=t.sourceFieldName+"."+e.name}))}))})),this.insertRecordSqlTemplate=A(this.entitySchema),this.replaceRecordSqlTemplate=C(this.entitySchema),this.deleteRecordTemplate=I(this.entitySchema),this.selectSqlTemplate=D(this.entitySchema),this.countQuery=N(this.entitySchema)}return e.prototype.add=function(e){if(this.primaryKeyName){var t=e[this.primaryKeyName];if("number"===this.primaryKeyField.sqlType&&(!o.isDefined(t)||_.isString(t)&&_.isEmpty(_.trim(t))))if("identity"===this.primaryKeyField.generatorType)e[this.primaryKeyName]=this.localDbManagementService.nextIdCount();else{var n=this.getValue(e,this.primaryKeyName);e[this.primaryKeyName]=n}}var i=j(this,e),r=this.entitySchema.columns.map((function(e){return i[e.name]}));return this.sqliteObject.executeSql(this.insertRecordSqlTemplate,r).then((function(e){return e.insertId}))},e.prototype.clear=function(){return this.sqliteObject.executeSql("DELETE FROM "+R(this.entitySchema.name))},e.prototype.create=function(){var e=this;return this.sqliteObject.executeSql(this.createTableSql(this.entitySchema)).then((function(){return e}))},e.prototype.count=function(e){var t=this.countQuery+x(this,e);return this.sqliteObject.executeSql(t).then((function(e){return e.rows.item(0).count}))},e.prototype.deserialize=function(e){return this.deserializeMapToFormData(e)},e.prototype.filter=function(e,t,n){var i=this,o=this.selectSqlTemplate;return o+=x(this,e),o+=k(this,t),o+=M(n),this.sqliteObject.executeSql(o).then((function(e){for(var t=[],n=e.rows.length,o=0;o<n;o++)t.push(L(i.entitySchema,e.rows.item(o)));return t}))},e.prototype.refresh=function(e){var t=this.primaryKeyName,n=this.getValue(e,t);return n?this.get(n):Promise.resolve(e)},e.prototype.delete=function(e){return this.sqliteObject.executeSql(this.deleteRecordTemplate,[e])},e.prototype.get=function(e){var t=[{attributeName:this.primaryKeyName,filterCondition:"=",attributeValue:e,attributeType:this.primaryKeyField.sqlType.toUpperCase()}];return this.filter(t).then((function(e){return e&&1===e.length?e[0]:void 0}))},e.prototype.getValue=function(e,t){var n=this.entitySchema.columns.find((function(e){return e.fieldName===t}));return F(e,n)},e.prototype.save=function(e){return this.saveAll([e])},e.prototype.saveAll=function(e){var t=this;e=_.filter(e,null);var n=_.map(e,(function(e){var n=j(t,e),i=t.entitySchema.columns.map((function(e){return n[e.name]}));return[t.replaceRecordSqlTemplate,i]}));return this.sqliteObject.sqlBatch(n)},e.prototype.serialize=function(e){return this.serializeFormDataToMap(e)},e.prototype.saveBlobToFile=function(e){var t=this.deviceFileService.appendToFileName(e.name),n=this.deviceFileService.getUploadDirectory();return this.file.writeFile(n,t,e).then((function(){return{name:e.name,type:e.type,lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,size:e.size,wmLocalPath:n+"/"+t}}))},e.prototype.serializeFormDataToMap=function(e){var t=this,n=_.filter(this.entitySchema.columns,{sqlType:"blob"}),i=[],o={};return e&&"function"==typeof e.append&&e.rowData?_.forEach(e.rowData,(function(e,r){e&&_.find(n,{fieldName:r})?i.push(t.saveBlobToFile(e).then((function(e){o[r]=e}))):o[r]=e})):o=e,Promise.all(i).then((function(){return o}))},e.prototype.deserializeMapToFormData=function(e){var t=new FormData,n=this.entitySchema.columns.filter((function(e){return"blob"===e.sqlType})),i=[];return _.forEach(n,(function(n){var r=e[n.fieldName];r&&r.wmLocalPath&&(i.push(o.convertToBlob(r.wmLocalPath).then((function(e){return t.append(n.fieldName,e.blob,r.name)}))),e[n.fieldName]="")})),t.append(c.SWAGGER_CONSTANTS.WM_DATA_JSON,new Blob([JSON.stringify(e)],{type:"application/json"})),Promise.all(i).then((function(){return t}))},e.prototype.createTableSql=function(e){var t=_.reduce(e.columns,(function(e,t){var n=R(t.name);return t.primaryKey&&("number"===t.sqlType&&"databaseIdentity"===t.generatorType?n+=" INTEGER PRIMARY KEY AUTOINCREMENT":n+=" PRIMARY KEY"),e?e+","+n:n}),!1);return"CREATE TABLE IF NOT EXISTS "+R(e.name)+" ("+t+")"},e}(),G=function(){this.schema={name:"",isInternal:!1,entities:new Map},this.stores=new Map,this.queries=new Map},V=function(e,t){this.name=e,this.fieldName=t,this.primaryKey=!1,this.fieldName=this.fieldName||this.name};!function(e){e.LIVE="LIVE",e.BUNDLED="BUNDLED",e.APP_START="APP_START"}(E||(E={}));var U="localDBStore.nextIdCount",W="www/metadata/app",q={name:"wavemaker",version:1,isInternal:!0,tables:[{name:"key_value",entityName:"key-value",columns:[{fieldName:"id",name:"id",generatorType:"databaseIdentity",sqlType:"number",primaryKey:!0},{fieldName:"key",name:"key"},{name:"value",fieldName:"value"}]},{name:"offlineChangeLog",entityName:"offlineChangeLog",columns:[{fieldName:"id",name:"id",generatorType:"databaseIdentity",sqlType:"number",primaryKey:!0},{name:"service",fieldName:"service"},{name:"operation",fieldName:"operation"},{name:"params",fieldName:"params"},{name:"timestamp",fieldName:"timestamp"},{name:"hasError",fieldName:"hasError"},{name:"errorMessage",fieldName:"errorMessage"}]}]},z=function(){function e(e,t,n,i,o,r,a){var s=this;this.appVersion=e,this.deviceService=t,this.deviceFileService=n,this.file=i,this.localKeyValueService=o,this.securityService=r,this.sqlite=a,this.callbacks=[],this._logSql=!1,this.nextId=1e11,this.systemProperties={USER_ID:{name:"USER_ID",value:function(){return s.securityService.getLoggedInUser().then((function(e){return e.userId}))}},USER_NAME:{name:"USER_NAME",value:function(){return s.securityService.getLoggedInUser().then((function(e){return e.userName}))}},DATE_TIME:{name:"DATE_TIME",value:function(){return moment().format("YYYY-MM-DDThh:mm:ss")}},DATE:{name:"CURRENT_DATE",value:function(){return moment().format("YYYY-MM-DD")}},TIME:{name:"TIME",value:function(){return moment().format("hh:mm:ss")}}}}return e.prototype.close=function(){var e=this;return new Promise((function(t,n){setTimeout((function(){var i=_.map(_.values(e.databases),(function(e){return e.sqliteObject.close()}));Promise.all(i).then(t,n)}),1e3)}))},e.prototype.nextIdCount=function(){return this.nextId=this.nextId+1,this.localKeyValueService.put(U,this.nextId),this.nextId},e.prototype.executeNamedQuery=function(e,t,n){var i,r,a=this;return this.databases[e]&&this.databases[e].queries[t]?(i=this.databases[e].queries[t],r=_.chain(i.params).filter((function(e){return"PROMPT"!==e.variableType})).forEach((function(e){var t=a.systemProperties[e.variableType].value(e.name,n);return o.toPromise(t).then((function(t){return n[e.name]=t}))})).value(),Promise.all(r).then((function(){return n=_.map(i.params,(function(e){return"string"==typeof n[e.name]||e.type!==o.DataType.DATETIME&&e.type!==o.DataType.LOCALDATETIME?e.type===o.DataType.BOOLEAN?a.convertBoolToInt(n[e.name]):n[e.name]:c.formatDate(n[e.name],e.type)})),a.executeSQLQuery(e,i.query,n).then((function(e){var t,n;return _.isEmpty(e.rows)||(t=e.rows[0],n=_.find(i.response.properties,(function(e){return!t.hasOwnProperty(e.fieldName)})),_.isUndefined(n)||(e.rows=_.map(e.rows,(function(e){var t={},n={};return _.forEach(e,(function(e,t){return n[t.toUpperCase()]=e})),_.forEach(i.response.properties,(function(i){var r=o.extractType(i.fieldType.typeRef),s=(o.DEFAULT_FORMATS[_.toUpper(r)],e[i.name]);!s||"string"==typeof s||r!==o.DataType.DATETIME&&r!==o.DataType.LOCALDATETIME&&r!==o.DataType.DATE||(moment(s).isValid()?e[i.name]=c.formatDate(s,r):moment(s,"HH:mm").isValid()&&(e[i.name]=moment().format("YYYY-MM-DD")+"T"+s)),r===o.DataType.BOOLEAN&&(e[i.name]=a.convertIntToBool(s)),n[i.nameInUpperCase]=e[i.name],t[i.name]=e[i.name],t[i.fieldName]=e[i.fieldName]||n[i.nameInUpperCase]})),t})))),e}))}))):Promise.reject("Query by name ' "+t+" ' Not Found")},e.prototype.exportDB=function(){var e=this;return new Promise((function(t,n){var i,r="offline_temp_"+_.now(),a=cordova.file.cacheDirectory+r+"/",s={app:null,OS:"",createdOn:0};i=o.isIos()?cordova.file.documentsDirectory:cordova.file.externalRootDirectory+"Download/",e.file.createDir(cordova.file.cacheDirectory,r,!1).then((function(){return e.file.copyDir(e.dbInstallParentDirectory,e.dbInstallDirectoryName,a,"databases").then((function(){return e.getAppInfo()})).then((function(e){return s.app=e,o.isIos()?s.OS="IOS":o.isAndroid()&&(s.OS="ANDROID"),s.createdOn=_.now(),s})).then((function(){return o.executePromiseChain(e.getCallbacksFor("preExport"),[a,s])})).then((function(){return e.file.writeFile(a,"META.json",JSON.stringify(s))}))})).then((function(){var t=s.app.name;return t=t.replace(/\s+/g,"_"),e.deviceFileService.newFileName(i,t+"_offline_data.zip").then((function(e){return new Promise((function(t,n){Zeep.zip({from:a,to:i+e},(function(){return t(i+e)}),n)}))}))})).then(t,n).catch(o.noop).then((function(){return e.deviceFileService.removeDir(cordova.file.cacheDirectory+r)}))}))},e.prototype.getStore=function(e,t){var n=this;return new Promise((function(i,o){n.databases[e]&&i(n.databases[e].stores[t]),o("store with name'"+t+"' in datamodel '"+e+"' is not found")}))},e.prototype.importDB=function(e,t){var n=this;return new Promise((function(i,r){var a,s="offline_temp_"+_.now(),l=cordova.file.cacheDirectory+s+"/";n.file.createDir(cordova.file.cacheDirectory,s,!1).then((function(){return new Promise((function(t,n){Zeep.unzip({from:e,to:l},t,n)}))})).then((function(){return n.file.readAsText(l,"META.json").then((function(e){return a=JSON.parse(e),n.getAppInfo()})).then((function(e){return a.app?a.app.packageName!==e.packageName?Promise.reject("database zip of app with same package name can only be imported"):void 0:Promise.reject("meta information is not found in zip")}))})).then((function(){var e;return n.close().then((function(){if(t)return n.exportDB().then((function(t){return e=t}))})).then((function(){return n.deviceFileService.removeDir(n.dbInstallDirectory)})).then((function(){return n.file.copyDir(l,"databases",n.dbInstallParentDirectory,n.dbInstallDirectoryName)})).then((function(){return n.databases=null,n.loadDatabases()})).then((function(){return o.executePromiseChain(n.getCallbacksFor("postImport"),[l,a])})).then((function(){if(e)return n.deviceFileService.removeFile(e)}),(function(t){return e?n.importDB(e,!1).then((function(){return n.deviceFileService.removeFile(e),Promise.reject(t)})):Promise.reject(t)}))})).then(i,r).catch(o.noop).then((function(){return n.deviceFileService.removeDir(cordova.file.cacheDirectory+s)}))}))},e.prototype.isOperationAllowed=function(e,t,n){return this.getStore(e,t).then((function(e){return!!e&&("READ"===n?e.entitySchema.pushConfig.readEnabled:"INSERT"===n?e.entitySchema.pushConfig.insertEnabled:"UPDATE"===n?e.entitySchema.pushConfig.updateEnabled:"DELETE"===n&&e.entitySchema.pushConfig.deleteEnabled)})).catch((function(){return!1}))},e.prototype.loadDatabases=function(){var e=this,t=!1;return this.databases?Promise.resolve(this.databases):(o.isIos()?(this.dbInstallDirectoryName="LocalDatabase",this.dbInstallParentDirectory=cordova.file.applicationStorageDirectory+"Library/"):(this.dbInstallDirectoryName="databases",this.dbInstallParentDirectory=cordova.file.applicationStorageDirectory),this.dbInstallDirectory=this.dbInstallParentDirectory+this.dbInstallDirectoryName,this.databases=new Map,this.setUpDatabases().then((function(e){return t=e})).then((function(){return e.loadDBSchemas()})).then((function(t){return e.loadNamedQueries(t)})).then((function(t){return e.loadOfflineConfig(t)})).then((function(t){return Promise.all(_.map(t,(function(t){return e.openDatabase(t).then((function(n){e.databases[t.schema.name]=n}))})))})).then((function(){return e.getStore("wavemaker","key-value").then((function(t){return e.localKeyValueService.init(t),e.localKeyValueService.get(U).then((function(t){e.nextId=t||e.nextId}))}))})).then((function(){return t?e.normalizeData().then((function(){return e.disableForeignKeys()})).then((function(){return e.deviceService.getAppBuildTime()})).then((function(t){return o.executePromiseChain(_.map(e.callbacks,"onDbCreate"),[{databases:e.databases,dbCreatedOn:_.now(),dbSeedCreatedOn:t}])})).then((function(){return e.databases})):e.databases})))},e.prototype.registerCallback=function(e){this.callbacks.push(e)},e.prototype.setLogSQl=function(e){this._logSql=e},e.prototype.cleanAndCopyDatabases=function(){var e=this,t=cordova.file.applicationDirectory+W;return this.file.createDir(this.dbInstallParentDirectory,this.dbInstallDirectoryName,!1).catch(o.noop).then((function(){return e.deviceFileService.listFiles(e.dbInstallDirectory,/.+\.db$/)})).then((function(t){if(t&&t.length>0)return Promise.all(t.map((function(t){if("wavemaker.db"!==t.name)return e.file.removeFile(e.dbInstallDirectory,t.name)})))})).then((function(){return e.deviceFileService.listFiles(t,/.+\.db$/)})).then((function(n){if(n&&n.length>0)return e.file.createDir(e.dbInstallParentDirectory,e.dbInstallDirectoryName,!1).catch(o.noop).then((function(){return Promise.all(n.map((function(n){return e.file.copyFile(t,n.name,e.dbInstallDirectory,n.name)})))}))}))},e.prototype.compactEntitySchema=function(e,t,n){var i=n[t.entityName];return i.entityName=t.entityName,i.name=t.name,i.columns=[],t.columns.forEach((function(e){var t=e.columnValue?e.columnValue.defaultValue:"",n=e.sqlType;t="number"!==n||e.primaryKey?"boolean"===n?_.isEmpty(t)?null:"true"===t?1:0:_.isEmpty(t)?null:t:_.isEmpty(t)?null:_.parseInt(t),i.columns.push({name:e.name,fieldName:e.fieldName,generatorType:e.generatorType,sqlType:e.sqlType,primaryKey:e.primaryKey,defaultValue:t})})),_.forEach(t.relations,(function(t){var n,o,r,a,s;if(("ManyToOne"===t.cardinality||"OneToOne"===t.cardinality)&&(o=_.find(e.tables,(function(e){return e.name===t.targetTable})),s=t.mappings[0],o)){o=o.entityName,a=s.sourceColumn,r=i.columns.find((function(e){return e.name===a})),n=e.tables.find((function(e){return e.name===t.targetTable}));var l={sourceFieldName:t.fieldName,targetEntity:o,targetTable:t.targetTable,targetColumn:s.targetColumn,targetPath:"",dataMapper:[],targetFieldName:n.columns.find((function(e){return e.name===s.targetColumn})).fieldName};l.targetPath=l.sourceFieldName+"."+l.targetFieldName,l.dataMapper=_.chain(n.columns).keyBy((function(e){return l.sourceFieldName+"."+e.fieldName})).mapValues((function(e){return new V(e.name,e.fieldName)})).value(),r.foreignRelations=r.foreignRelations||[],r.foreignRelations.push(l)}})),i},e.prototype.compactQueries=function(e){var t=this,n=new Map;return _.forEach(e.queries,(function(e){var i,o;e.nativeSql&&"SELECT"===e.type&&(i=_.isEmpty(e.offlineQueryString)?e.queryString:e.offlineQueryString,(o=_.map(t.extractQueryParams(i),(function(t){var n=_.find(e.parameters,{name:t});return{name:n.name,type:n.type,variableType:n.variableType}}))).forEach((function(e){return i=_.replace(i,":"+e.name,"?")})),n[e.name]={name:e.name,query:i,params:o,response:{properties:_.map(e.response.properties,(function(e){return e.nameInUpperCase=e.name.toUpperCase(),e}))}})})),n},e.prototype.compactSchema=function(e){var t=this,n=new G,i=new Map;return e.tables.forEach((function(e){i[e.entityName]={}})),e.tables.forEach((function(n){t.compactEntitySchema(e,n,i)})),n.schema.name=e.name,n.schema.isInternal=e.isInternal,n.schema.entities=i,n},e.prototype.convertBoolToInt=function(e){return"true"===_.toString(e)?1:0},e.prototype.convertIntToBool=function(e){return!!e},e.prototype.disableForeignKeys=function(){var e=this;return Promise.all(_.map(this.databases,(function(t){return e.executeSQLQuery(t.schema.name,"PRAGMA foreign_keys = OFF")})))},e.prototype.executeSQLQuery=function(e,t,n,i){var o=this.databases[e];return o?o.sqliteObject.executeSql(t,n,i).then((function(e){for(var t=[],n=e.rows,i=0;i<n.length;i++)t.push(n.item(i));return{rowsAffected:e.rowsAffected,rows:t}})):Promise.reject("No Database with name "+e+" found")},e.prototype.extractQueryParams=function(e){var t;return(t=e.match(/[^"'\w\\]:\s*\w+\s*/g)||[]).length?t.map((function(e){return/[=|\W]/g.test(e)?e.replace(/\W/g,"").trim():e.trim()})):null},e.prototype.getAppInfo=function(){var e=this,t={name:"",packageName:"",versionNumber:"",versionCode:null};return this.appVersion.getPackageName().then((function(n){return t.packageName=n,e.appVersion.getAppName()})).then((function(n){return t.name=n,e.appVersion.getVersionNumber()})).then((function(n){return t.versionNumber=n,e.appVersion.getVersionCode()})).then((function(e){return t.versionCode=e,t}))},e.prototype.getCallbacksFor=function(e){return this.callbacks.map((function(t){return t[e]?t[e].bind(t):null}))},e.prototype.getMetaInfo=function(e){var t=cordova.file.applicationDirectory+W+"/";return this.deviceFileService.listFiles(t,e).then((function(e){return Promise.all(_.map(e,(function(e){return new Promise((function(n,i){$.getJSON(o.transformFileURI(t)+e.name,(function(e){return n(e)}))}))})))}))},e.prototype.isBundled=function(e,t){return this.getStore(e,t).then((function(e){return e.entitySchema.pullConfig.pullType===E.BUNDLED}))},e.prototype.loadDBSchemas=function(){var e=this;return this.getMetaInfo(/.+_dataModel\.json$/).then((function(t){var n=new Map;return(t=o.isArray(t)?t:[t]).push(q),t.map((function(t){return e.compactSchema(t)})).forEach((function(e){n[e.schema.name]=e})),n}))},e.prototype.loadNamedQueries=function(e){var t=this;return this.getMetaInfo(/.+_query\.json$/).then((function(n){return(n=_.isArray(n)?n:[n]).map((function(n){return e[n.name].queries=t.compactQueries(n)})),e}))},e.prototype.loadOfflineConfig=function(e){return this.getMetaInfo(/.+_offline\.json$/).then((function(t){return _.forEach(t,(function(t){_.forEach(t.entities,(function(n){var i=_.find(e[t.name].schema.entities,(function(e){return e.name===n.name}));_.assignIn(i,n)}))})),e}))},e.prototype.logSql=function(e){var t=this,n=console,i=e.executeSql;e.executeSql=function(o,r,a){var s=_.now();return i.call(e,o,r).then((function(e){if(a||t._logSql){for(var i=[],l=e.rows.length,c=0;c<l;c++)i.push(e.rows.item(c));n.debug('SQL "%s" with params %O took [%d ms]. And the result is %O',o,r,_.now()-s,i)}return e}),(function(e){return n.error('SQL "%s" with params %O failed with error message %s',o,r,e.message),Promise.reject(e)}))}},e.prototype.normalizeBooleanData=function(e,t,n){var i=this,o="update "+R(t)+" set "+R(n)+" = 1 where "+R(n)+" = 'true'",r="update "+R(t)+" set "+R(n)+" = 0\n where "+R(n)+" is not null and "+R(n)+" != 1";return this.executeSQLQuery(e,o).then((function(){return i.executeSQLQuery(e,r)}))},e.prototype.normalizeData=function(){var e=this;return Promise.all(_.map(this.databases,(function(t){return Promise.all(_.map(t.schema.entities,(function(n){return Promise.all(_.map(n.columns,(function(i){if("boolean"===i.sqlType)return e.normalizeBooleanData(t.schema.name,n.name,i.name)})))})))})))},e.prototype.openDatabase=function(e){var t=this;return this.sqlite.create({name:e.schema.name+".db",location:"default"}).then((function(n){e.sqliteObject=n,t.logSql(n);var i=_.map(e.schema.entities,(function(e){return new B(t.deviceFileService,e,t.file,t,n).create()}));return Promise.all(i).then((function(t){return _.forEach(t,(function(t){e.stores[t.entitySchema.entityName]=t})),e}))}))},e.prototype.setUpDatabases=function(){var e=this;return this.deviceService.getAppBuildTime().then((function(t){var n=e.deviceService.getEntry("database")||{};return(!n.lastBuildTime||n.lastBuildTime!==t)&&e.cleanAndCopyDatabases().then((function(){return n.lastBuildTime=t,e.deviceService.storeEntry("database",n)})).then((function(){return!0}))}))},e}();z.SERVICE_NAME="LocalDBManagementService",z.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new z(g.\u0275\u0275inject(w.AppVersion),g.\u0275\u0275inject(y.DeviceService),g.\u0275\u0275inject(y.DeviceFileService),g.\u0275\u0275inject(P.File),g.\u0275\u0275inject(S),g.\u0275\u0275inject(b.SecurityService),g.\u0275\u0275inject(O.SQLite))},token:z,providedIn:"root"}),z.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],z.ctorParameters=function(){return[{type:s.AppVersion},{type:r.DeviceService},{type:r.DeviceFileService},{type:i.File},{type:S},{type:a.SecurityService},{type:l.SQLite}]};var H=function(){},Y="changeLogService.flushContext",K="changeLogService.lastPushInfo",Q=function(){function e(e,t,n,i){this.localDBManagementService=e,this.localKeyValueService=t,this.pushService=n,this.networkService=i,this.workers=[],this.currentPushInfo={},this.addWorker(new X(this,this.localKeyValueService,this.currentPushInfo))}return e.prototype.add=function(e,t,n){var i=this,r={service:e,operation:t,params:n,hasError:0};return o.executePromiseChain(this.getWorkers("transformParamsToMap"),[r]).then((function(){return o.executePromiseChain(i.getWorkers("onAddCall"),[r])})).then((function(){return r.params=JSON.stringify(r.params),i.getStore().then((function(e){return e.add(r)})).then(o.noop)}))},e.prototype.addWorker=function(e){this.workers.push(e)},e.prototype.clearLog=function(){return this.getStore().then((function(e){return e.clear()}))},e.prototype.flush=function(e){var t,n=this;return this.deferredFlush||(this.deferredFlush=o.getAbortableDefer(),this.createContext().then((function(e){return n.flushContext=e,o.executePromiseChain(n.getWorkers("preFlush"),[n.flushContext])})).then((function(){return t=n._flush(e),n.deferredFlush.onAbort=function(){return t.abort()},t})).catch(o.noop).then((function(){Promise.resolve().then((function(){if(n.currentPushInfo.totalTaskCount===n.currentPushInfo.completedTaskCount)return n.flushContext.clear().then((function(){return n.flushContext=null}))})).then((function(){e.complete(),n.currentPushInfo.failedTaskCount>0?n.deferredFlush.reject(n.currentPushInfo):n.deferredFlush.resolve(n.currentPushInfo),n.deferredFlush=null})).then((function(){return o.executePromiseChain(n.getWorkers("postFlush"),[n.currentPushInfo,n.flushContext])}))}))),this.deferredFlush.promise},e.prototype.getChanges=function(){return this.getStore().then((function(e){return e.filter(void 0,"id",{offset:0,limit:500})})).then((function(e){return e.forEach((function(e){e.params=JSON.parse(e.params)})),e}))},e.prototype.getErrors=function(){return this.getStore().then((function(e){return e.filter([{attributeName:"hasError",attributeValue:1,attributeType:"NUMBER",filterCondition:"EQUALS"}])}))},e.prototype.getLastPushInfo=function(){return this.localKeyValueService.get(K).then((function(e){return o.isString(e.startTime)&&(e.startTime=new Date(e.startTime)),o.isString(e.endTime)&&(e.endTime=new Date(e.endTime)),e}))},e.prototype.getLogLength=function(){return this.getStore().then((function(e){return e.count([{attributeName:"hasError",attributeValue:0,attributeType:"NUMBER",filterCondition:"EQUALS"}])}))},e.prototype.getStore=function(){return this.localDBManagementService.getStore("wavemaker","offlineChangeLog")},e.prototype.isFlushInProgress=function(){return!(_.isUndefined(this.deferredFlush)||_.isNull(this.deferredFlush))},e.prototype.stop=function(){var e=this;return new Promise((function(t){e.deferredFlush?(e.deferredFlush.promise.catch().then(t),e.deferredFlush.promise.abort()):t()}))},e.prototype.createContext=function(){var e=this;return this.localKeyValueService.get(Y).then((function(t){return t=t||{},{clear:function(){return t={},e.localKeyValueService.remove(Y)},get:function(e){var n=t[e];return n||(n={},t[e]=n),n},save:function(){return e.localKeyValueService.put(Y,t)}}}))},e.prototype._flush=function(e,t){var n=this;return(t=t||o.getAbortableDefer()).isAborted?Promise.resolve():(this.getNextChange().then((function(e){if(e)return e.params=JSON.parse(e.params),n.flushChange(e)})).then((function(i){if(e.next(n.currentPushInfo),i)return n.getStore().then((function(e){return e.delete(i.id)})).then((function(){return n._flush(e,t)}));t.resolve()}),(function(i){if(n.networkService.isConnected())i.hasError=1,i.params=JSON.stringify(i.params),n.getStore().then((function(e){return e.save(i)})).then((function(){return n._flush(e,t)}));else{var o=n.networkService.onConnect();t.promise.catch((function(){o&&o.abort()})),o.then((function(){n._flush(e,t),o=null}))}})),t.promise)},e.prototype.flushChange=function(e){var t=this,n=this;return o.executePromiseChain(this.getWorkers("preCall"),[e]).then((function(){return e.hasError?Promise.reject(e.errorMessage):""})).then((function(){return o.executePromiseChain(t.getWorkers("transformParamsFromMap"),[e])})).then((function(){return t.pushService.push(e)})).then((function(){return o.executePromiseChain(_.reverse(n.getWorkers("postCallSuccess")),[e,arguments]).then((function(){return e}))})).catch((function(){return n.networkService.isConnected()?o.executePromiseChain(_.reverse(n.getWorkers("postCallError")),[e,arguments]).catch(o.noop).then((function(){return Promise.reject(e)})):Promise.reject(e)}))},e.prototype.getNextChange=function(){var e=[{attributeName:"hasError",attributeValue:0,attributeType:"NUMBER",filterCondition:"EQUALS"}];return this.getStore().then((function(t){return t.filter(e,"id",{offset:0,limit:1})})).then((function(e){return e&&e[0]}))},e.prototype.getWorkers=function(e){return _.map(this.workers,(function(t){return t[e]&&t[e].bind(t)}))},e}();Q.SERVICE_NAME="ChangeLogService",Q.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new Q(g.\u0275\u0275inject(z),g.\u0275\u0275inject(S),g.\u0275\u0275inject(H),g.\u0275\u0275inject(y.NetworkService))},token:Q,providedIn:"root"}),Q.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Q.ctorParameters=function(){return[{type:z},{type:S},{type:H},{type:r.NetworkService}]};var X=function(){function e(e,t,n){this.changeLogService=e,this.localKeyValueService=t,this.pushInfo=n,this.logger=window.console}return e.prototype.onAddCall=function(e){this.logger.debug("Added the following call %o to log.",e)},e.prototype.preFlush=function(e){var t=this;return this.pushInfo.totalTaskCount=0,this.pushInfo.successfulTaskCount=0,this.pushInfo.failedTaskCount=0,this.pushInfo.completedTaskCount=0,this.pushInfo.inProgress=!0,this.pushInfo.startTime=new Date,this.flushContext=e,this.logger.debug("Starting flush"),this.changeLogService.getStore().then((function(e){return e.count([{attributeName:"hasError",attributeValue:0,attributeType:"NUMBER",filterCondition:"EQUALS"}])})).then((function(e){return t.pushInfo.totalTaskCount=e}))},e.prototype.postFlush=function(e,t){this.logger.debug("flush completed. {Success : %i , Error : %i , completed : %i, total : %i }.",this.pushInfo.successfulTaskCount,this.pushInfo.failedTaskCount,this.pushInfo.completedTaskCount,this.pushInfo.totalTaskCount),this.pushInfo.inProgress=!1,this.pushInfo.endTime=new Date,this.localKeyValueService.put(K,this.pushInfo),this.flushContext=null},e.prototype.preCall=function(e){this.logger.debug("%i. Invoking call %o",1+this.pushInfo.completedTaskCount,e)},e.prototype.postCallError=function(e,t){return this.pushInfo.completedTaskCount++,this.pushInfo.failedTaskCount++,this.logger.error("call failed with the response %o.",t),this.flushContext.save()},e.prototype.postCallSuccess=function(e,t){return this.pushInfo.completedTaskCount++,this.pushInfo.successfulTaskCount++,this.logger.debug("call returned the following response %o.",t),this.flushContext.save()},e}(),J=function(){function e(e){this.localDBManagementService=e,this.searchTableData=this.readTableData.bind(this),this.searchTableDataWithQuery=this.readTableData.bind(this),this.getDistinctDataByFields=this.readTableData.bind(this)}return e.prototype.getStore=function(e){return this.localDBManagementService.getStore(e.dataModelName,e.entityName)},e.prototype.insertTableData=function(e,t,n,i){void 0===i&&(i={}),this.getStore(e).then((function(n){var o=n.primaryKeyField&&"identity"===n.primaryKeyField.generatorType;return!1!==_.get(i,"resetPrimaryKey")&&o&&e.data[n.primaryKeyName]&&delete e.data[n.primaryKeyName],n.add(e.data).then((function(){n.refresh(e.data).then(t)}))})).catch(n)},e.prototype.insertMultiPartTableData=function(e,t,n,i){var o=this;void 0===i&&(i={}),this.getStore(e).then((function(r){r.serialize(e.data).then((function(r){e.data=r,o.insertTableData(e,t,n,i)}))})).catch(n)},e.prototype.updateTableData=function(e,t,n){this.getStore(e).then((function(n){return n.save(e.data).then((function(){n.refresh(e.data).then(t)}))})).catch(n)},e.prototype.updateMultiPartTableData=function(e,t,n){var i=e.data&&e.data.rowData||e.data;this.getStore(e).then((function(e){return e.save(i)})).then((function(){t&&t(i)})).catch(n)},e.prototype.deleteTableData=function(e,t,n){this.getStore(e).then((function(n){var i=n.primaryKeyField,o=e[i.fieldName]||e[i.name]||e.data&&e.data[i.fieldName]||e.id;n.delete(o).then(t)})).catch(n)},e.prototype.readTableData=function(e,t,n){var i=this;this.getStore(e).then((function(n){var o=e.filter((function(e,t){i.convertFieldNameToColumnName(n,e,t)}),!0);return o=o.replace(/wm_bool\('true'\)/g,1).replace(/wm_bool\('false'\)/g,0),n.count(o).then((function(i){var r=e.sort.split("=")[1];return n.filter(o,r,{offset:(e.page-1)*e.size,limit:e.size}).then((function(n){var o=Math.ceil(i/e.size);t({content:n,first:1===e.page,last:e.page===o,number:e.page-1,numberOfElements:n.length,size:e.size,sort:{sorted:!!r,unsorted:!r},totalElements:i,totalPages:o})}))}))})).catch(n)},e.prototype.escapeName=function(e){return e?'"'+(e=e.replace(/"/g,'""')).replace(/\./g,'"."')+'"':e},e.prototype.getColumnName=function(e,t){if(e.fieldToColumnMapping[t]){var n=this.escapeName(e.fieldToColumnMapping[t]);return n.indexOf(".")<0?this.escapeName(e.entitySchema.name)+"."+n:n}return t},e.prototype.convertFieldNameToColumnName=function(e,t,n){var i=this;_.forEach(t.rules,(function(t){t.rules?i.convertFieldNameToColumnName(e,t):t.target=i.getColumnName(e,t.target)})),n&&n.filterFields&&(n.filterFields=_.mapKeys(n.filterFields,(function(t,n){return i.getColumnName(e,n)})))},e}();J.SERVICE_NAME="LocalDbService",J.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new J(g.\u0275\u0275inject(z))},token:J,providedIn:"root"}),J.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],J.ctorParameters=function(){return[{type:z}]};var Z=function(){function e(){this.logger=window.console}return e.prototype.preFlush=function(e){this.fileStore=e.get("offlineFileUpload")},e.prototype.preCall=function(e){var t=this;"DatabaseService"===e.service&&(e.params.data=_.mapValues(e.params.data,(function(e){var n=t.fileStore[e];return n?(t.logger.debug("swapped file path from %s -> %s",e,n),n):e})))},e.prototype.postCallSuccess=function(e,t){if("OfflineFileUploadService"===e.service&&"uploadToServer"===e.operation){var n=JSON.parse(t[0].text)[0];this.fileStore[e.params.file]=n.path,this.fileStore[e.params.file+"?inline"]=n.inlinePath}},e}(),ee=function(){function e(e,t,n,i){this.changeLogService=e,this.deviceFileService=t,this.localDBManagementService=n,this.file=i}return e.prototype.preExport=function(e,t){var n=this.deviceFileService.getUploadDirectory(),i=n.lastIndexOf("/"),o=n.substring(0,i+1),r=n.substring(i+1);return t.uploadDir=n,this.file.copyDir(o,r,e,"uploads")},e.prototype.postImport=function(e,t){var n=this,i=this.deviceFileService.getUploadDirectory(),r=i.lastIndexOf("/"),a=i.substring(0,r+1),s=i.substring(r+1);return this.uploadDir=i,this.file.checkDir(e,"uploads").then((function(){return n.deviceFileService.removeDir(i).then((function(){return n.file.copyDir(e,"uploads",a,s)})).then((function(){return n.updateChanges(t)}))}),o.noop)},e.prototype.getChanges=function(e,t){return this.changeLogService.getStore().then((function(n){return n.filter([],"id",{offset:(e-1)*t,limit:t})}))},e.prototype.updateDBChange=function(e,t,n){var i=this,o={},r=e.params.entityName,a=e.params.dataModelName;e.params.data=_.mapValues(e.params.data,(function(e,i){var r=e,a=!1;return _.isString(e)?(r=_.replace(e,t,n),a=!_.isEqual(r,e)):_.isObject(e)&&e.wmLocalPath&&(r=_.replace(e.wmLocalPath,t,n),a=!_.isEqual(r,e.wmLocalPath)),a&&(o[i]=r),r})),_.isEmpty(o)||this.localDBManagementService.getStore(a,r).then((function(t){if(t.primaryKeyField&&"identity"===t.primaryKeyField.generatorType){var n=t.primaryKeyName,i=e.params.data[n];return t.get(i).then((function(e){return t.save(_.assignIn(e,o))}))}})).then((function(){return e.params=JSON.stringify(e.params),i.changeLogService.getStore().then((function(t){return t.save(e)}))}))},e.prototype.updateChange=function(e,t){return e.params=JSON.parse(e.params),"OfflineFileUploadService"===e.service&&"uploadToServer"===e.operation?(e.params.file=_.replace(e.params.file,t.uploadDir,this.uploadDir),e.params=JSON.stringify(e.params),this.changeLogService.getStore().then((function(t){return t.save(e)}))):"DatabaseService"===e.service?this.updateDBChange(e,t.uploadDir,this.uploadDir):void 0},e.prototype.updateChanges=function(e,t){var n=this;void 0===t&&(t=1);return this.getChanges(t,10).then((function(t){if(t&&t.length>0)return Promise.all(t.map((function(t){return n.updateChange(t,e)})))})).then((function(i){if(i&&10===i.length)return n.updateChanges(e,t+1)}))},e}(),te=function(){function e(e){this.localDBManagementService=e}return e.prototype.preFlush=function(e){this.errorStore=e.get("errorBlockerStore")},e.prototype.preCall=function(e){var t=this;if(e&&"DatabaseService"===e.service){var n=e.params.entityName,i=e.params.dataModelName;switch(e.operation){case"insertTableData":case"insertMultiPartTableData":case"updateTableData":case"updateMultiPartTableData":return this.localDBManagementService.getStore(i,n).then((function(o){t.blockCall(o,e,i,n,e.params.data)}));case"deleteTableData":return this.localDBManagementService.getStore(i,n).then((function(o){t.blockCall(o,e,i,n,e.params)}))}}},e.prototype.postCallSuccess=function(e){var t=this;if(e&&"DatabaseService"===e.service){var n=e.params.entityName,i=e.params.dataModelName;return this.localDBManagementService.getStore(i,n).then((function(o){var r=e.dataLocalId||e.params.data[o.primaryKeyName];_.isUndefined(r)||_.isNull(r)||t.removeError(i,n,r)}))}},e.prototype.postCallError=function(e){var t=this;if(e&&"DatabaseService"===e.service){var n=e.params.entityName,i=e.params.dataModelName;return this.localDBManagementService.getStore(i,n).then((function(o){var r=e.dataLocalId||e.params.data&&e.params.data[o.primaryKeyName]||e.params[o.primaryKeyName]||e.params.id;_.isUndefined(r)||_.isNull(r)||t.recordError(i,n,r)}))}},e.prototype.blockCall=function(e,t,n,i,o){var r=this;0===t.hasError&&(this.checkForPreviousError(e,t,n,i,o),e.entitySchema.columns.forEach((function(i){i.foreignRelations&&i.foreignRelations.some((function(a){return o[a.sourceFieldName]?r.blockCall(e,t,n,a.targetEntity,o[a.sourceFieldName]):o[i.fieldName]&&r.checkForPreviousError(e,t,n,a.targetEntity,o,i.fieldName),1===t.hasError}))})))},e.prototype.checkForPreviousError=function(e,t,n,i,o,r){var a=r||e.primaryKeyName;this.hasError(n,i,o[a])&&(t.hasError=1,t.errorMessage="Blocked call due to error in previous call of entity [ "+i+" ] with id [ "+o[a]+" ]")},e.prototype.hasError=function(e,t,n){return!!(this.errorStore[e]&&this.errorStore[e][t]&&this.errorStore[e][t][n])},e.prototype.removeError=function(e,t,n){this.errorStore[e]&&this.errorStore[e][t]&&this.errorStore[e][t][n]&&delete this.errorStore[e][t][n]},e.prototype.recordError=function(e,t,n){this.errorStore[e]=this.errorStore[e]||{},this.errorStore[e][t]=this.errorStore[e][t]||{},this.errorStore[e][t][n]=!0},e}(),ne=function(){function e(e){this.localDBManagementService=e,this.logger=window.console}return e.prototype.preFlush=function(e){this.idStore=e.get("idConflictResolution")},e.prototype.preCall=function(e){var t=this;if(e&&"DatabaseService"===e.service){var n=e.params.entityName,i=e.params.dataModelName;switch(e.operation){case"insertTableData":case"insertMultiPartTableData":return e.params.skipLocalDB=!0,this.localDBManagementService.getStore(i,n).then((function(r){var a=r.primaryKeyName;return a&&(t.transactionLocalId=e.params.data[a],e.dataLocalId=t.transactionLocalId),t.exchangeIds(r,i,n,e.params.data).then((function(){if(r.primaryKeyField&&"identity"===r.primaryKeyField.generatorType)delete e.params.data[a];else{var s=r.getValue(e.params.data,r.primaryKeyName);o.isDefined(s)&&(e.params.data[a]=s,null!==t.transactionLocalId&&t.pushIdToStore(i,n,t.transactionLocalId,s)),t.transactionLocalId=null}}))}));case"updateTableData":case"updateMultiPartTableData":case"deleteTableData":return this.localDBManagementService.getStore(i,n).then((function(o){if(t.exchangeId(o,i,n,e.params,"id"),e.params.data)return t.exchangeIds(o,i,n,e.params.data)}))}}},e.prototype.postCallSuccess=function(e,t){var n=this;if(e&&"DatabaseService"===e.service&&("insertTableData"===e.operation||"insertMultiPartTableData"===e.operation)&&this.transactionLocalId){var i=t[0].body,r=e.params.entityName,a=e.params.dataModelName;return this.localDBManagementService.getStore(a,r).then((function(e){return n.pushIdToStore(a,r,n.transactionLocalId,i[e.primaryKeyName]),e.delete(n.transactionLocalId).catch(o.noop).then((function(){return n.transactionLocalId=null,e.save(i)}))}))}},e.prototype.postCallError=function(e){var t=this;if(e&&"DatabaseService"===e.service&&("insertTableData"===e.operation||"insertMultiPartTableData"===e.operation)&&this.transactionLocalId){var n=e.params.entityName,i=e.params.dataModelName;return this.localDBManagementService.getStore(i,n).then((function(n){e.params.data[n.primaryKeyName]=t.transactionLocalId}))}},e.prototype.getEntityIdStore=function(e,t){return this.idStore[e]=this.idStore[e]||{},this.idStore[e][t]=this.idStore[e][t]||{},this.idStore[e][t]},e.prototype.pushIdToStore=function(e,t,n,i){n!==i&&(this.getEntityIdStore(e,t)[n]=i,this.logger.debug("Conflict found for entity (%s) with local id (%i) and remote Id (%i)",t,n,i))},e.prototype.logResolution=function(e,t,n){this.logger.debug("Conflict resolved found for entity (%s) with local id (%i) and remote Id (%i)",e,t,n)},e.prototype.exchangeId=function(e,t,n,i,o){var r=o||e.primaryKeyName,a=this.getEntityIdStore(t,n);if(i&&r){for(var s=i[r],l=s;a[l];)l=a[l];l!==s&&(i[r]=l,this.logResolution(n,s,l))}},e.prototype.exchangeIds=function(e,t,n,i){var o=this;this.exchangeId(e,t,n,i);var r=[];return e.entitySchema.columns.forEach((function(n){n.foreignRelations&&n.foreignRelations.forEach((function(a){i[n.fieldName]&&o.exchangeId(e,t,a.targetEntity,i,n.fieldName),i[a.sourceFieldName]&&r.push(o.localDBManagementService.getStore(t,a.targetEntity).then((function(e){return o.exchangeIds(e,t,a.targetEntity,i[a.sourceFieldName])})))}))})),Promise.all(r)},e}();ne.decorators=[{type:t.Injectable}],ne.ctorParameters=function(){return[{type:z}]};var ie=function(){function e(e,t){this.deviceFileService=e,this.localDBManagementService=t}return e.prototype.postCallSuccess=function(e){var t=this;if(e&&"DatabaseService"===e.service)switch(e.operation){case"insertMultiPartTableData":case"updateMultiPartTableData":_.forEach(e.params.data,(function(e){_.isObject(e)&&e.wmLocalPath&&t.deviceFileService.removeFile(e.wmLocalPath)}))}},e.prototype.transformParamsFromMap=function(e){if(e&&"DatabaseService"===e.service)switch(e.operation){case"insertMultiPartTableData":case"updateMultiPartTableData":return this.localDBManagementService.getStore(e.params.dataModelName,e.params.entityName).then((function(t){return t.deserialize(e.params.data).then((function(t){e.params.data=t}))}))}},e.prototype.transformParamsToMap=function(e){if(e&&"DatabaseService"===e.service)switch(e.operation){case"insertMultiPartTableData":case"updateMultiPartTableData":return this.localDBManagementService.getStore(e.params.dataModelName,e.params.entityName).then((function(t){return t.serialize(e.params.data).then((function(n){return e.params.data=n,t.save(_.mapValues(n,(function(e){return _.isObject(e)&&e.wmLocalPath||e}))),n}))}))}},e}(),oe=[{name:"insertTableData",type:"INSERT"},{name:"insertMultiPartTableData",type:"INSERT"},{name:"updateTableData",type:"UPDATE"},{name:"updateMultiPartTableData",type:"UPDATE"},{name:"deleteTableData",type:"DELETE"},{name:"readTableData",type:"READ",saveResponse:!0},{name:"searchTableData",type:"READ",saveResponse:!0},{name:"searchTableDataWithQuery",type:"READ",saveResponse:!0},{name:"getDistinctDataByFields",type:"READ",saveResponse:!1}],re=!1,ae=function(){function e(e,t,n,i,o){this.changeLogService=e,this.httpService=t,this.localDBManagementService=n,this.networkService=i,this.offlineDBService=o,this.onlineDBService=m.LVService}return e.prototype.add=function(){var e=this;if(!re){re=!0;var t=this.httpService.sendCallAsObservable;t&&(this.httpService.sendCallAsObservable=function(n,i){!i&&_.get(n,"url")&&(i={url:n.url});var o=_.clone(i.url);i=_.extend(i,n);var r=_.find(oe,{name:_.get(i,"operation")});return e.networkService.isConnected()||i.onlyOnline||!r||!i.dataModelName?h.from(e.remoteDBcall(r,t,i)):h.from(e.localDBManagementService.isOperationAllowed(i.dataModelName,i.entityName,r.type).then((function(n){var a;return n?Promise.resolve().then((function(){if(!i.isCascadingStopped&&("insertTableData"===r.name||"updateTableData"===r.name))return e.prepareToCascade(i).then((function(e){return a=e}))})).then((function(){return new Promise((function(t,n){e.localDBcall(r,i,t,n,o)}))})).then((function(t){return a?a.cascade().then((function(){return e.getStore(i).then((function(e){return e.refresh(t.body)})).then((function(e){return t&&t.body&&(t.body=e),t}))})):t})):e.remoteDBcall(r,t,i)})))})}},e.prototype.getStore=function(e){return this.localDBManagementService.getStore(e.dataModelName,e.entityName)},e.prototype.hasBlob=function(e){return!!_.filter(e.entitySchema.columns,{sqlType:"blob"}).length},e.prototype.localDBcall=function(e,t,n,i,r){var a=this;return new Promise((function(n,i){a.offlineDBService[e.name](t,(function(i){if("READ"!==e.type)return t.onlyOnline=!0,t.url=r,a.changeLogService.add("DatabaseService",e.name,t).then((function(){return n(i)}));n(i)}))})).then((function(e){return e={body:e,type:T},o.triggerFn(n,e),e}),i)},e.prototype.remoteDBcall=function(e,t,n){var i=this;return new Promise((function(r,a){t.call(i.httpService,n).subscribe((function(t){t&&t.type&&(n.skipLocalDB||i.offlineDBService.getStore(n).then((function(r){"READ"===e.type&&e.saveResponse?r.saveAll(t.body.content):"INSERT"===e.type?((n=_.clone(n)).data=_.clone(t.body),i.offlineDBService[e.name](n,o.noop,o.noop,{resetPrimaryKey:!1})):i.offlineDBService[e.name](n,o.noop,o.noop)})).catch(o.noop),r(t))}),(function(e){a(e)}))}))},e.prototype.prepareToCascade=function(e){var t=this;return this.getStore(e).then((function(n){var i=[];return _.forEach(e.data,(function(o,r){var a,s,l;if(_.isObject(o)&&!_.isArray(o)&&(a=n.entitySchema.columns.find((function(e){return e.primaryKey&&e.foreignRelations&&(s=e.foreignRelations.find((function(e){return e.sourceFieldName===r}))),!!s}))),a){(l=_.cloneDeep(e)).entityName=s.targetEntity,l.data=o;var c=t.getStore(l).then((function(i){var o=e.data,a=i.entitySchema.columns.find((function(e){return e.name===s.targetColumn}));if(a&&a.foreignRelations){var c=a.foreignRelations.find((function(e){return e.targetTable===n.entitySchema.name})).sourceFieldName;l.data[c]=o}return o[r]=null,l.onlyOnline=!1,l.isCascadingStopped=!0,l.hasBlob=t.hasBlob(i),l.url="",function(){return Promise.resolve().then((function(){var e=i.getValue(l.data,i.primaryKeyField.fieldName);return e?i.get(e):null})).then((function(e){var n;return n=e?l.hasBlob?"updateMultiPartTableData":"updateTableData":l.hasBlob?"insertMultiPartTableData":"insertTableData",t.onlineDBService[n](l).toPromise()}))}}));i.push(c)}})),Promise.all(i).then((function(e){return{cascade:function(){return Promise.all(e.map((function(e){return e()})))}}}))}))},e}(),se=!1,le=function(){function e(e,t,n,i,o,r){this.changeLogService=e,this.deviceFileService=t,this.deviceFileUploadService=n,this.file=i,this.networkService=o,this.uploadDir=r}return e.prototype.add=function(){var e=this;if(!se){se=!0;var t=this.deviceFileUploadService.upload;this.deviceFileUploadService.uploadToServer=t,this.deviceFileUploadService.upload=function(n,i,o,r,a,s){return e.networkService.isConnected()?t.call(e.deviceFileUploadService,n,i,o,r,a,s):e.uploadLater(n,i,o,r,a,s).then((function(e){return{text:JSON.stringify(e),headers:null,response:e}}))}}},e.prototype.uploadLater=function(e,t,n,i,o,r){var a=this,s=n.lastIndexOf("/"),l=n.substring(0,s),c=n.substring(s+1),p=this.deviceFileService.appendToFileName(c),u=this.uploadDir+"/"+p;return this.file.copyFile(l,c,this.uploadDir,p).then((function(){return a.changeLogService.add("OfflineFileUploadService","uploadToServer",{file:u,ftOptions:{fileKey:t,fileName:i},params:o,headers:r,serverUrl:e,deleteOnUpload:!0})})).then((function(){return[{fileName:c,path:u,length:0,success:!0,inlinePath:u+"?inline"}]}))},e}(),ce=/^\d+(\.\d+)?$/,pe=!1,ue=function(){function e(e,t,n,i){this.changeLogService=e,this.httpService=t,this.localDBManagementService=n,this.networkService=i}return e.prototype.add=function(){var e=this;if(!pe){pe=!0;var t=this.httpService.sendCallAsObservable;this.httpService.sendCallAsObservable=function(n,i){return!i&&_.get(n,"url")&&(i={url:n.url}),!e.networkService.isConnected()&&i.url.indexOf("/queryExecutor/")>0?h.from(e.executeLocally(i)):t.call(e.httpService,n,i)}}},e.prototype.executeLocally=function(e){var t=this,n=e.url,i=n.indexOf("?")>0,o=this.substring(n,"services/","/queryExecutor"),r=this.substring(n,"queries/",i?"?":void 0),a=i?this.getHttpParamMap(this.substring(n,"?",void 0)):{},s=this.getHttpParamMap(e.dataParams),l=_.extend(a,s);return this.localDBManagementService.executeNamedQuery(o,r,l).then((function(n){var i=n.rows;return n.rowsAffected?t.changeLogService.add("WebService","invokeJavaService",e).then((function(){return n.rowsAffected})):{type:T,body:{totalPages:i&&i.length>0?1:0,totalElements:i.length,first:!0,sort:null,numberOfElements:i.length,last:!0,size:e.size,number:0,content:i}}}))},e.prototype.substring=function(e,t,n){if(t){var i=e.indexOf(t)+t.length,o=n?e.indexOf(n):void 0;return e.substring(i,o)}},e.prototype.getHttpParamMap=function(e){var t={};return e&&(e=decodeURIComponent(e)).split("&").forEach((function(e){var n=e.split("=");_.isEmpty(_.trim(n[1]))||!ce.test(n[1])?t[n[0]]=n[1]:t[n[0]]=parseInt(n[1],10)})),t},e}(),de="logged-in-user.info",he=!1,me=function(){function e(e,t,n,i,o){var r=this;this.app=e,this.file=t,this.deviceService=n,this.networkService=i,this.securityService=o,this.saveSecurityConfigLocally=_.debounce((function(e){r._saveSecurityConfigLocally(e)}),1e3)}return e.prototype.add=function(){var e=this;if(!he){he=!0;var t=this.securityService.load,n=this.securityService.appLogout;this.securityService.load=function(n){return new Promise((function(i,o){e.networkService.isConnected()?t.call(e.securityService,n).then((function(t){e.securityConfig=t,e.saveSecurityConfigLocally(t),i(e.securityConfig)}),o):e.readLocalSecurityConfig().then((function(t){return void 0===t&&(t={}),e.securityConfig=t,e.securityService.config=t,t}),(function(){return t.call(e.securityConfig)})).then(i,o)}))},this.securityService.appLogout=function(t,i){e.securityConfig={authenticated:!1,loggedOut:!0,securityEnabled:e.securityConfig&&e.securityConfig.securityEnabled,loggedOutOffline:!e.networkService.isConnected(),loginConfig:e.securityConfig&&e.securityConfig.loginConfig,userInfo:null},e._saveSecurityConfigLocally(e.securityConfig).catch(o.noop).then((function(){e.networkService.isConnected()?n.call(e.securityService,t,i):location.assign(window.location.origin+window.location.pathname)}))},this.securityService.isAuthenticated=function(t){o.triggerFn(t,!0===e.securityConfig.authenticated)},this.deviceService.whenReady().then((function(){return e.clearLastLoggedInUser()})),this.app.subscribe("onNetworkStateChange",(function(t){t.isConnected&&e.clearLastLoggedInUser()}))}},e.prototype._saveSecurityConfigLocally=function(e){return this.file.writeFile(cordova.file.dataDirectory,de,JSON.stringify(e),{replace:!0})},e.prototype.clearLastLoggedInUser=function(){var e=this;return this.readLocalSecurityConfig().then((function(t){t&&t.loggedOutOffline?e.securityService.appLogout(null,null):e.networkService.isConnected()||(e.securityConfig=t||{})}))},e.prototype.readLocalSecurityConfig=function(){var e=this;return new Promise((function(t,n){var i=cordova.file.dataDirectory;e.file.checkFile(i,de).then((function(){return e.readFileAsTxt(i,de).then(t,n)}),(function(){var i=cordova.file.applicationDirectory+"www/metadata/app";return e.readFileAsTxt(i,"security-config.json").then(t,n)}))}))},e.prototype.readFileAsTxt=function(e,t){return this.file.readAsText(e,t).then(JSON.parse).catch(o.noop)},e}(),fe=function(){function e(t,n,i,r,a,s,l,c,p,u,d){o.hasCordova()&&e.initialize(t,n,i,r,a,s,l,c,p,u,d)}return e.initialize=function(e,t,n,i,r,a,s,l,c,p,u){this.initialized||(n.addStartUpService({getServiceName:function(){return"OfflineStartupService"},start:function(){return window.SQLitePlugin?(l.setLogSQl("true"===sessionStorage.getItem("wm.logSql")||"true"===sessionStorage.getItem("debugMode")),window.logSql=function(e){void 0===e&&(e=!0),l.setLogSQl(e),sessionStorage.setItem("wm.logSql",e?"true":"false")},window.executeLocalSql=function(e,t,n){l.executeSQLQuery(e,t,n,!0)},l.loadDatabases().then((function(){t.addWorker(new ne(l)),t.addWorker(new te(l)),t.addWorker(new Z),t.addWorker(new ie(i,l)),new ae(t,s,l,p,c).add(),new le(t,i,r,a,p,i.getUploadDirectory()).add(),new ue(t,s,l,p).add(),l.registerCallback(new ee(t,i,l,a)),t.addWorker({onAddCall:function(){p.isConnected()||p.disableAutoConnect()},postFlush:function(e){e.totalTaskCount>0&&l.close().catch(o.noop).then((function(){location.assign(window.location.origin+window.location.pathname)}))}})}))):Promise.resolve()}}),new me(e,a,n,p,u).add())},e}();fe.initialized=!1,fe.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[],exports:[],providers:[],entryComponents:[]}]}],fe.ctorParameters=function(){return[{type:o.App},{type:Q},{type:r.DeviceService},{type:r.DeviceFileService},{type:r.DeviceFileUploadService},{type:i.File},{type:o.AbstractHttpService},{type:z},{type:J},{type:r.NetworkService},{type:a.SecurityService}]};var ge=function(){function e(e){this.deviceFileUploadService=e}return e.prototype.getPromiseFromObs=function(e){return new Promise((function(t,n){e.subscribe((function(e){e&&e.type&&t(e)}),n)}))},e.prototype.push=function(e){var t=e.params;switch(e.service){case"DatabaseService":switch(e.operation){case"insertTableData":return this.getPromiseFromObs(m.LVService.insertTableData(e.params,null,null));case"insertMultiPartTableData":return this.getPromiseFromObs(m.LVService.insertMultiPartTableData(e.params,null,null));case"updateTableData":return this.getPromiseFromObs(m.LVService.updateTableData(e.params,null,null));case"updateMultiPartTableData":return this.getPromiseFromObs(m.LVService.updateMultiPartTableData(e.params,null,null));case"deleteTableData":return this.getPromiseFromObs(m.LVService.deleteTableData(e.params,null,null))}case"OfflineFileUploadService":if("uploadToServer"===e.operation)return this.deviceFileUploadService.uploadToServer.call(this.deviceFileUploadService,t.serverUrl,t.ftOptions.fileKey,t.file,t.ftOptions.fileName,t.params,t.headers)}return Promise.reject(e.service+" service with operation "+e.operation+" is not supported for push.")},e}();ge.decorators=[{type:t.Injectable}],ge.ctorParameters=function(){return[{type:r.DeviceFileUploadService}]};var ve="localDBManager.lastPullInfo",ye=function(){var e={};return{start:function(e){e.$$pullProcessId="PULL_"+_.now()},add:function(t,n){var i=t.$$pullProcessId;e[i]||(e[i]=[]),e[i].push(n)},remove:function(t,n){var i=t.$$pullProcessId;_.remove(e[i],n),_.isEmpty(e[i])&&delete e[i]},abort:function(t){var n=t.$$pullProcessId;return e[n]&&(_.forEach(e[n],(function(e){e&&e.abort&&e.abort()})),delete e[n]),t.$$isMarkedToAbort=!0,t.catch((function(){return"cancelled"}))}}},be=ye(),we=function(){function e(e,t,n,i){var o=this;this.app=e,this.localDBManagementService=t,this.localKeyValueService=n,this.networkService=i,this.localDBManagementService.registerCallback({onDbCreate:function(e){o.localKeyValueService.put(ve,{databases:[],totalRecordsToPull:0,totalPulledRecordCount:0,startTime:new Date(0),endTime:new Date(e.dbSeedCreatedOn)})}})}return e.prototype.addDeltaCriteria=function(e,t,n){var i,o=this,r=e.schema.entities[t],a=r.pullConfig.deltaFieldName,s=_.find(r.columns,{fieldName:a})||{};return _.isEmpty(a)?Promise.resolve(n):this.localDBManagementService.isBundled(e.schema.name,t).then((function(e){return i=e})).then((function(){return o.getLastPullInfo()})).then((function(o){var r=o&&o.startTime&&o.startTime.getTime(),l=_.find(o&&o.databases,{name:e.schema.name}),c=_.find(l&&l.entities,{entityName:t})||{};return!r&&i&&(r=o&&o.endTime&&o.endTime.getTime(),c.query=n),c.query===n&&r>0&&(_.isEmpty(n)?n="":n+=" AND ","datetime"===s.sqlType?n+=a+" > '"+moment(r).utc().format("YYYY-MM-DDTHH:mm:ss")+"'":n+=a+" > "+r),n}),(function(){return Promise.resolve(n)}))},e.prototype.copyDataFromRemoteDBToLocalDB=function(e,t,n,i,r){var a,s=this,l=e.stores[t],c=e.schema.entities[t],p={entityName:t,totalRecordsToPull:0,pulledRecordCount:0},u=0,d=!1;return new Promise((function(h,m){s.prepareQuery(e,t).then((function(n){return p.query=n,s.addDeltaCriteria(e,t,n)})).then((function(e){return n&&p.query===e?l.clear().then((function(){return e})):e})).then((function(t){return a=_.isEmpty(t)?"":"q="+t,s.getTotalRecordsToPull(e,c,a,i)})).then((function(n){var m=c.pullConfig.size||100,f=Math.ceil(n/m);p.totalRecordsToPull=n;var g=c.pullConfig.orderBy;g=(_.isEmpty(g)?"":g+",")+l.primaryKeyName,r.next(p);var v={next:function(e){u++,e=_.slice(e,0,p.totalRecordsToPull-p.pulledRecordCount),l.saveAll(e).then((function(){p.pulledRecordCount+=e?e.length:0,r.next(p)})).catch(o.noop).then((function(){0===--u&&d&&h(p)}))},error:null,complete:null};return s._pullEntityData(e,t,a,g,f,m,1,i,void 0,v)})).then(null,m).catch(o.noop).then((function(){d=!0,0===u&&h(p)}))}))},e.prototype.evalIfBind=function(e){return _.startsWith(e,"bind:")?(e=e.replace(/\[\$\i\]/g,"[0]"),o.$parseExpr(e.replace("bind:",""))(this.app)):e},e.prototype.executeDatabaseCountQuery=function(e){return new Promise((function(t,n){m.LVService.countTableDataWithQuery(e,null,null).subscribe((function(e){return t(e.body)}),n)}))},e.prototype.executeDatabaseSearchQuery=function(e){return new Promise((function(t,n){return m.LVService.searchTableDataWithQuery(e,null,null).subscribe((function(e){return t(e&&e.body&&e.body.content)}),n)}))},e.prototype.getTotalRecordsToPull=function(e,t,n,i){var o=this,r={dataModelName:e.schema.name,entityName:t.entityName,queryParams:n};return this.retryIfNetworkFails((function(){return o.executeDatabaseCountQuery(r).then((function(e){var n=e,i=_.parseInt(t.pullConfig.maxNumberOfRecords);return _.isNaN(i)||i<=0||n<i?n:i}))}),i)},e.prototype.prepareQuery=function(e,t){var n,i=this,o=e.schema.entities[t];return this.localDBManagementService.isBundled(e.schema.name,t).then((function(e){var t=!1;if(e||_.isEmpty(o.pullConfig.query)){if(n=_.cloneDeep(o.pullConfig.filter),n=_.map(n,(function(e){return e.attributeValue=i.evalIfBind(e.attributeValue),t=t||_.isNil(e.attributeValue),e})),t)return Promise.reject("Null criteria values are present");n=_.sortBy(n,"attributeName"),n=m.LiveVariableUtils.getSearchQuery(n," AND ",!0)}else n=i.evalIfBind(o.pullConfig.query);return _.isNil(n)?Promise.resolve(null):Promise.resolve(encodeURIComponent(n))}))},e.prototype._pullDbData=function(e,t,n,i){var o=this,r=e.schema.name,a={name:e.schema.name,entities:[],totalRecordsToPull:0,pulledRecordCount:0,completedTaskCount:0,totalTaskCount:0},s=[];return _.forEach(e.schema.entities,(function(e){s.push(o.localDBManagementService.getStore(r,e.entityName))})),new Promise((function(r,l){Promise.all(s).then((function(s){var c=[];s.forEach((function(e){var t=e.entitySchema.pullConfig,n=t.pullType;(n===E.APP_START||n===E.BUNDLED&&t.deltaFieldName)&&c.push(e.entitySchema)}));var p=_.chain(c).map((function(r){var s={next:function(e){var t=_.findIndex(a.entities,{entityName:e.entityName});t>=0?a.entities[t]=e:a.entities.push(e),a.pulledRecordCount=_.reduce(a.entities,(function(e,t){return e+t.pulledRecordCount}),0),a.totalRecordsToPull=_.reduce(a.entities,(function(e,t){return e+t.totalRecordsToPull}),0),i.next(a)},error:null,complete:null};return o.copyDataFromRemoteDBToLocalDB(e,r.entityName,t,n,s).then((function(e){return a.completedTaskCount++,i.next(a),e}),null)})).value();a.totalTaskCount=p.length,i.next(a),Promise.all(p).then(r,l)}))}))},e.prototype._pullEntityData=function(e,t,n,i,r,a,s,l,c,p){var u=this,d=e.schema.name;if(c||(c=o.defer()),s>r)return c.resolve();var h={dataModelName:d,entityName:t,page:s,size:a,data:n,sort:i,onlyOnline:!0,skipLocalDB:!0};return this.retryIfNetworkFails((function(){return u.executeDatabaseSearchQuery(h)}),l).then((function(o){p.next(o),u._pullEntityData(e,t,n,i,r,a,s+1,l,c,p)}),c.reject),c.promise},e.prototype.retryIfNetworkFails=function(e,t){if(t.$$isMarkedToAbort)return Promise.reject("aborted");var n=this.networkService.retryIfNetworkFails(e);return be.add(t,n),n.catch(o.noop).then((function(){be.remove(t,n)})),n},e.prototype.cancel=function(e){return be.abort(e)},e.prototype.getDb=function(e){return this.localDBManagementService.loadDatabases().then((function(t){return _.find(t,{name:e})||Promise.reject("Local database ("+e+") not found")}))},e.prototype.getLastPullInfo=function(){return this.localKeyValueService.get(ve).then((function(e){return _.isString(e.startTime)&&(e.startTime=new Date(e.startTime)),_.isString(e.endTime)&&(e.endTime=new Date(e.endTime)),e}))},e.prototype.pullAllDbData=function(e,t){var n=this,i=o.getAbortableDefer(),r={completedTaskCount:0,totalTaskCount:0,inProgress:!0,databases:[],totalRecordsToPull:0,totalPulledRecordCount:0,startTime:new Date,endTime:new Date};return this.localDBManagementService.loadDatabases().then((function(o){var a=_.chain(o).filter((function(e){return!e.schema.isInternal})).map((function(o){be.start(i.promise);var a={next:function(e){var n=_.findIndex(r.databases,{name:e.name});n>=0?r.databases[n]=e:r.databases.push(e),r.totalTaskCount=_.reduce(r.databases,(function(e,t){return e+t.totalTaskCount}),0),r.completedTaskCount=_.reduce(r.databases,(function(e,t){return e+t.completedTaskCount}),0),r.totalPulledRecordCount=_.reduce(r.databases,(function(e,t){return e+t.pulledRecordCount}),0),r.totalRecordsToPull=_.reduce(r.databases,(function(e,t){return e+t.totalRecordsToPull}),0),t.next(r)},error:null,complete:null};return n._pullDbData(o,e,i.promise,a)})).value();return Promise.all(a)})).then((function(){r.endTime=new Date,r.inProgress=!1,n.localKeyValueService.put(ve,r),i.resolve(r)}),i.reject),i.promise},e.prototype.pullDbData=function(e,t,n){var i=this,r=o.getAbortableDefer();return this.getDb(e).then((function(e){return i._pullDbData(e,t,r.promise,n)})).then(r.resolve,r.reject),r.promise},e.prototype.pullEntityData=function(e,t,n,i){var r=this,a=o.getAbortableDefer();return this.getDb(e).then((function(e){return r.copyDataFromRemoteDBToLocalDB(e,t,n,a.promise,i)})).then(a.resolve,a.reject),a.promise},e}();we.SERVICE_NAME="LocalDBDataPullService",we.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new we(g.\u0275\u0275inject(v.App),g.\u0275\u0275inject(z),g.\u0275\u0275inject(S),g.\u0275\u0275inject(y.NetworkService))},token:we,providedIn:"root"}),we.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],we.ctorParameters=function(){return[{type:o.App},{type:z},{type:S},{type:r.NetworkService}]},e.CONTEXT_KEY=Y,e.ChangeLogService=Q,e.LAST_PUSH_INFO_KEY=K,e.LocalDBDataPullService=we,e.LocalDBManagementService=z,e.LocalDbService=J,e.OfflineModule=fe,e.PushService=H,e.PushServiceImpl=ge,e["\u02750"]=ye,e["\u0275a"]=S,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@awesome-cordova-plugins/app-version/ngx"),require("@awesome-cordova-plugins/barcode-scanner/ngx"),require("@awesome-cordova-plugins/calendar/ngx"),require("@awesome-cordova-plugins/camera/ngx"),require("@awesome-cordova-plugins/device/ngx"),require("@awesome-cordova-plugins/media-capture/ngx"),require("@awesome-cordova-plugins/geolocation/ngx"),require("@awesome-cordova-plugins/vibration/ngx"),require("@awesome-cordova-plugins/location-accuracy/ngx"),require("@awesome-cordova-plugins/diagnostic/ngx"),require("@wm/core"),require("@wm/mobile/core"),require("@wm/mobile/offline"),require("@wm/security"),require("@wm/variables"),require("@wm/mobile/components/basic")):"function"==typeof define&&define.amd?define("@wm/mobile/variables",["exports","@angular/core","@awesome-cordova-plugins/app-version/ngx","@awesome-cordova-plugins/barcode-scanner/ngx","@awesome-cordova-plugins/calendar/ngx","@awesome-cordova-plugins/camera/ngx","@awesome-cordova-plugins/device/ngx","@awesome-cordova-plugins/media-capture/ngx","@awesome-cordova-plugins/geolocation/ngx","@awesome-cordova-plugins/vibration/ngx","@awesome-cordova-plugins/location-accuracy/ngx","@awesome-cordova-plugins/diagnostic/ngx","@wm/core","@wm/mobile/core","@wm/mobile/offline","@wm/security","@wm/variables","@wm/mobile/components/basic"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.mobile=e.wm.mobile||{},e.wm.mobile.variables={}),e.ng.core,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.wm.core,e.wm.mobile.core,e.wm.mobile.offline,e.wm.security,e.wm.variables,e.wm.mobile.components.basic)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h,m,f,g,v){"use strict";
830
+ var p=function(e,t){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function d(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var h,m=function(){n.register("wm-media-list",new Map([["class",n.PROP_STRING],["dataset",n.PROP_ANY],["layout",Object.assign({value:"Single-row"},n.PROP_STRING)],["mediaurl",n.PROP_STRING],["name",n.PROP_STRING],["offline",Object.assign({value:!0},n.PROP_BOOLEAN)],["show",Object.assign({value:!0},n.PROP_BOOLEAN)],["thumbnailheight",Object.assign({value:"100pt"},n.PROP_STRING)],["thumbnailwidth",Object.assign({value:"100pt"},n.PROP_STRING)],["thumbnailurl",n.PROP_STRING]]))},f={widgetType:"wm-media-list",hostClass:"app-medialist"};!function(e){e.SINGLE_ROW="Single-row",e.MULTI_ROW="Multi-row"}(h||(h={}));var g=function(e){function t(t){var i=e.call(this,t,f)||this;return i.selectedMediaIndex=-1,n.styler(i.nativeElement,i,n.APPLY_STYLES_TYPE.SCROLLABLE_CONTAINER),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.appendToBody=function(){var e=this;return this.$fullScreenEle||setTimeout((function(){e.$fullScreenEle=e.$element.find(">.app-media-fullscreen"),e.$fullScreenEle.appendTo("body")}),100),!0},t.prototype.onPropertyChange=function(t,n,o){"dataset"===t?this.onDataChange(n):"layout"===t?n===h.SINGLE_ROW?i.addClass(this.nativeElement,"singlerow"):i.removeClass(this.nativeElement,"singlerow"):e.prototype.onPropertyChange.call(this,t,n,o)},t.prototype.exitFullScreen=function(){this.selectedMediaIndex=-1,this.$fullScreenEle.appendTo(this.$element),this.$fullScreenEle=null,i.$appDigest()},t.prototype.getPicTitle=function(){return this.selectedMediaIndex+1+"/"+this.fieldDefs.length},t.prototype.showFullScreen=function(e){this.selectedMediaIndex=e,i.$appDigest()},t.prototype.showNext=function(){this.selectedMediaIndex<this.fieldDefs.length-1&&(this.selectedMediaIndex++,i.$appDigest())},t.prototype.getSrc=function(e){return e?this.fieldDefs[this.selectedMediaIndex][e]:""},t.prototype.showPrev=function(){this.selectedMediaIndex>0&&(this.selectedMediaIndex--,i.$appDigest())},t.prototype.onDataChange=function(e){e?(i.isObject(e)&&!i.isArray(e)&&(e=[e]),this.binddataset||i.isString(e)&&(e=e.split(",")),i.isArray(e)&&this.updateFieldDefs(e)):this.updateFieldDefs([])},t.prototype.updateFieldDefs=function(e){var t=this;this.fieldDefs=e,e.forEach((function(e){e.mediaUrlVal=n.getEvaluatedData(e,{field:t.mediaurl},t.viewParent),e.thumbnailUrlVal=n.getEvaluatedData(e,t.thumbnailurl,t.viewParent)})),this.fieldDefs=e},t.prototype.listTrackByFn=function(e){return e},t}(n.StylableComponent);g.initializeProps=m(),g.decorators=[{type:t.Component,args:[{selector:"[wmMediaList]",template:'<ul class="list-unstyled list-inline app-media-thumbnail">\n <li *ngFor="let item of fieldDefs; index as index;" [ngStyle]="{width: thumbnailwidth, height: thumbnailheight}" (click)="showFullScreen(index)">\n <div class="thumbnail">\n <ng-container [ngTemplateOutlet]="imgTemplate"\n [ngTemplateOutletContext]="{src: item.thumbnailUrlVal, class: \'thumbnail-image\'}">\n </ng-container>\n <div class="thumbnail-details">\n <ng-container [ngTemplateOutlet]="mediaListTemplate" [ngTemplateOutletContext]="{item:item, index:index}" [wmMediaListItem]="item">\n </ng-container>\n </div>\n </div>\n </li>\n</ul>\n<div class="app-media-fullscreen" *ngIf="selectedMediaIndex >= 0 && appendToBody()">\n <header wmMobileNavbar\n backbutton="true"\n backbtnclick.event="exitFullScreen()"\n showLeftnavbtn="false"\n backbuttoniconclass.event="wi wi-chevron-left"\n title.bind="getPicTitle()">\n </header>\n <div wmContent>\n <div wmPageContent>\n <div class="media-content">\n <div class="image-container" (swipeleft)="showNext()" (swiperight)="showPrev()">\n <ng-container [ngTemplateOutlet]="imgTemplate"\n [ngTemplateOutletContext]="{field: \'mediaUrlVal\', class: \'center-block\'}">\n </ng-container>\n <a class="app-media-fullscreen-nav-control left" [hidden]="!(selectedMediaIndex > 0)" (click)="showPrev()">\n <i class="wi wi-chevron-left"></i>\n </a>\n <a class="app-media-fullscreen-nav-control right" [hidden]="!(selectedMediaIndex < fieldDefs.length-1)" (click)="showNext()">\n <i class="wi wi-chevron-right"></i>\n </a>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #imgTemplate let-src="src" let-classname="class" let-field="field">\n <img wmPicture class="{{classname}}" picturesource.bind="src || getSrc(field)" wmImageCache="{{offline}}" />\n</ng-template>\n',providers:[n.provideAsWidgetRef(g)]}]}],g.ctorParameters=function(){return[{type:t.Injector}]},g.propDecorators={mediaListTemplate:[{type:t.ContentChild,args:["mediaListTemplate"]}]};var v=[c,g],y=function(){};y.decorators=[{type:t.NgModule,args:[{imports:[l.BasicModule,o.CommonModule,r.BasicModule,a.MobileNavbarModule,s.PageModule,n.WmComponentsModule],declarations:d([],u(v)),exports:d([],u(v)),entryComponents:[]}]}],e.MediaListComponent=g,e.MediaListItemDirective=c,e.MediaListModule=y,e["\u0275a"]=m,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@wavemaker/variables"),require("@wm/core"),require("angular2-websocket/angular2-websocket"),require("@metrichor/jmespath"),require("@angular/core"),require("@angular/router"),require("@wm/oAuth"),require("@wm/security"),require("@angular/common"),require("@angular/common/http"),require("ngx-toastr"),require("@wm/http")):"function"==typeof define&&define.amd?define("@wm/variables",["exports","@wavemaker/variables","@wm/core","angular2-websocket/angular2-websocket","@metrichor/jmespath","@angular/core","@angular/router","@wm/oAuth","@wm/security","@angular/common","@angular/common/http","ngx-toastr","@wm/http"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.variables={}),e.wm_common_variables,e.wm.core,e.angularWebSocket,e.jmespath,e.ng.core,e.ng.router,e.wm.oAuth,e.wm.security,e.ng.common,e.ng.common.http,e.ngxToastr,e.wm.http)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d){"use strict";var h={hasCordova:void 0!==window.cordova,isStudioMode:!1,isRunMode:!0,XSRF_COOKIE_NAME:"wm_xsrf_token",DEFAULT_TIMER_DELAY:500,WIDGET_DOESNT_EXIST:"The widget you're trying to navigate to doesn't exist on this page"},m={CATEGORY:{MODEL:"wm.Variable",LIVE:"wm.LiveVariable",CRUD:"wm.CrudVariable",SERVICE:"wm.ServiceVariable",WEBSOCKET:"wm.WebSocketVariable",NAVIGATION:"wm.NavigationVariable",NOTIFICATION:"wm.NotificationVariable",TIMER:"wm.TimerVariable",LOGIN:"wm.LoginVariable",LOGOUT:"wm.LogoutVariable",DEVICE:"wm.DeviceVariable"},EVENTS:["onBefore","onBeforeUpdate","onResult","onBeforeOpen","onOpen","onBeforeMessageSend","onMessageReceive","onProgress","onError","onBeforeDatasetReady","onCanUpdate","onClick","onHide","onOk","onCancel","onBeforeClose","onClose","onTimerFire","onSuccess","onOnline","onOffline"],EVENT:{CAN_UPDATE:"onCanUpdate",BEFORE:"onBefore",BEFORE_UPDATE:"onBeforeUpdate",PREPARE_SETDATA:"onBeforeDatasetReady",RESULT:"onResult",ERROR:"onError",ABORT:"onAbort",PROGRESS:"onProgress",CLICK:"onClick",HIDE:"onHide",OK:"onOk",CANCEL:"onCancel",CLOSE:"onClose",TIMER_FIRE:"onTimerFire",SUCCESS:"onSuccess",BEFORE_OPEN:"onBeforeOpen",OPEN:"onOpen",BEFORE_SEND:"onBeforeMessageSend",MESSAGE_RECEIVE:"onMessageReceive",BEFORE_CLOSE:"onBeforeClose"},OWNER:{APP:"App",PAGE:"Page"},REST_SUPPORTED_SERVICES:["JavaService","SoapService","FeedService","RestService","SecurityServiceType","DataService","WebSocketService","OpenAPIService"],PAGINATION_PARAMS:["page","size","sort"],REST_SERVICE:{BASE_PATH_KEY:"x-WM-BASE_PATH",RELATIVE_PATH_KEY:"x-WM-RELATIVE_PATH",OAUTH_PROVIDER_KEY:"x-WM-PROVIDER_ID",AUTH_HDR_KEY:"Authorization",SECURITY_DEFN:{BASIC:"basic",OAUTH2:"oauth2"},AUTH_TYPE:{BASIC:"BASIC",OAUTH:"OAUTH2",NONE:"NONE"},CONTENT_TYPE_KEY:"x-WM-CONTENT_TYPE",ACCESSTOKEN_PLACEHOLDER:{LEFT:"",RIGHT:".access_token"},ERR_TYPE:{NO_ACCESSTOKEN:"missing_accesstoken",NO_CREDENTIALS:"no_credentials",METADATA_MISSING:"metadata_missing",CRUD_OPERATION_MISSING:"crud_operation_missing",USER_UNAUTHORISED:"user_unauthorised",REQUIRED_FIELD_MISSING:"required_field_missing"},ERR_MSG:{NO_ACCESSTOKEN:"Access token missing",NO_CREDENTIALS:"No credentials present",METADATA_MISSING:'Metadata missing for "$variable"',USER_UNAUTHORISED:"Unauthorized User",CRUD_OPERATION_MISSING:'Operation "$operation" not allowed for "$variable"',REQUIRED_FIELD_MISSING:'Required field(s) missing: "${0}"'},UNCLOAKED_HEADERS:["CONTENT-TYPE","ACCEPT","CONTENT-LENGTH","ACCEPT-ENCODING","ACCEPT-LANGUAGE"],PREFIX:{AUTH_HDR_VAL:{BASIC:"Basic",OAUTH:"Bearer"},CLOAK_HEADER_KEY:"X-WM-"}},SERVICE_TYPE:{JAVA:"JavaService",REST:"RestService",SOAP:"SoapService",FEED:"FeedService",DATA:"DataService",SECURITY:"SecurityServiceType",WEBSOCKET:"WebSocketService",OPENAPI:"OpenAPIService"},CONTROLLER_TYPE:{QUERY:"QueryExecution",PROCEDURE:"ProcedureExecution"},HTTP_STATUS_CODE:{CORS_FAILURE:-1,UNAUTHORIZED:401,FORBIDDEN:403},EXPORT_TYPES_MAP:{EXCEL:".xlsx",CSV:".csv"},DEFAULT_VAR:{NOTIFICATION:"appNotification"}},f={NON_BODY_HTTP_METHODS:["GET","HEAD"],CONTENT_TYPES:{FORM_URL_ENCODED:"application/x-www-form-urlencoded",MULTIPART_FORMDATA:"multipart/form-data",OCTET_STREAM:"application/octet-stream"}},g={WM_DATA_JSON:"wm_data_json",WM_HTTP_JSON:"wm_httpRequestDetails"},v=t.$rootScope,y=function(e,t){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.create;function w(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function P(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var O={EXCEL:".xlsx",CSV:".csv"};e.appManager=void 0,e.httpService=void 0,e.metadataService=void 0,e.navigationService=void 0,e.routerService=void 0,e.toasterService=void 0,e.oauthService=void 0,e.securityService=void 0,e.dialogService=void 0;var S=/^\[("|')[\w\W]*(\1)\]$/,E=new Map,T=new Map,R=function(e,t){var n,i,o=_.noop;T.has(e)&&(o=T.get(e).cancel),o(),n=_.debounce((function(){(i=e[t]())instanceof Promise&&i.catch(_.noop)}),100),T.set(e,n),n()},A=function(e,t,n,i,o){switch(i.category){case m.CATEGORY.LIVE:"read"===i.operation?("dataBinding"===e?_.forEach(t,(function(e,t){i.filterFields[t]={value:e}})):i.filterFields[e]={value:t,type:n},i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i.listRecords)&&!o&&R(i,"listRecords")):("dataBinding"===e?i.inputFields=t:i.inputFields[e]=t,i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i[i.operation+"Record"])&&!o&&R(i,i.operation+"Record"));break;case m.CATEGORY.CRUD:"list"===i.operationType&&i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i.invoke)&&!o&&R(i,"invoke");break;case m.CATEGORY.SERVICE:case m.CATEGORY.LOGIN:i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i.invoke)&&!o&&R(i,"invoke");break;case m.CATEGORY.DEVICE:i[e]=t,i.autoUpdate&&!_.isUndefined(t)&&_.isFunction(i.invoke)&&!o&&R(i,"invoke")}},C=function(t,n){switch(t){case"appManager":e.appManager=n;break;case"http":e.httpService=n;break;case"metadata":e.metadataService=n;break;case"navigationService":e.navigationService=n;break;case"router":e.routerService=n;break;case"toaster":e.toasterService=n;break;case"oAuth":e.oauthService=n;break;case"security":e.securityService=n;break;case"dialog":e.dialogService=n}},I=function(e,t,i,o,r){var a,s=t[e],l=t._context;e!==m.EVENT.ERROR||r||s||(a=l.Actions[m.DEFAULT_VAR.NOTIFICATION])&&(i=a.getMessage()||i,i=_.isString(i)?i:"An error has occured. Please check the app logs.",a.invoke({message:i},void 0,void 0));var c=n.$parseEvent(t[e]);return e===m.EVENT.BEFORE_UPDATE?"wm.LiveVariable"===t.category&&"read"===t.operation?c(t._context,{variable:t,dataFilter:i,options:o}):c(t._context,{variable:t,inputData:i,options:o}):c(t._context,{variable:t,data:i,options:o})},D=function(e){setTimeout((function(){n.triggerFn(e)}),500)},N=function(e,t,i,o){var r,a,s,l,c,p="",u=t.get("Content-Disposition");if(u&&-1!==u.indexOf("attachment")&&null!==(r=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(u))&&r[1]&&(p=r[1].replace(/['"]/g,"")),a=t.get("Content-Type"),s=new Blob([e],{type:a}),void 0!==window.navigator.msSaveBlob)window.navigator.msSaveBlob(s,p)?D(i):n.triggerFn(o);else{if(l=window.URL||window.webkitURL,c=l.createObjectURL(s),p){var d,h=document.createElement("a");void 0===h.download?((d=new FileReader).onloadend=function(){var e=d.result.replace(/^data:[^;]*;/,"data:attachment/file;");window.open(e,"_blank")||(window.location.href=e)},d.onload=D.bind(void 0,i),d.onerror=o,d.readAsDataURL(s)):(h.href=c,h.download=p,document.body.appendChild(h),h.click(),D(i))}else window.open(c,"_blank")||(window.location.href=c),D(i);setTimeout((function(){l.revokeObjectURL(c)}),100)}},x=function(e,t){e=_.split(e,"&"),_.forEach(e,(function(e){e=_.split(e,"="),t[e[0]]=decodeURIComponent(_.join(_.slice(e,1),"="))}))},k=function(e,t){"/"===e.url[1]&&"/"===e.url[2]&&(e.url=e.url.slice(0,1)+e.url.slice(2));var i,o,r,a="",s="fileDownloadIFrame",l="fileDownloadForm",c="Content-Type",p=e.url,u=_.get(e.headers,c),d=_.pickBy(e.headers,(function(e,t){return t!==c}));(i=$("#"+s)).length&&i.first().remove(),i=$('<iframe id="'+s+'" name="'+s+'" class="ng-hide"></iframe>'),(o=$('<form id="'+l+'" name="'+l+'"></form>')).attr({target:i.attr("name"),action:p,method:e.method,enctype:u}),a+=-1!==p.indexOf("?")?p.substring(p.indexOf("?")+1):"",a+=u===f.CONTENT_TYPES.FORM_URL_ENCODED?(a?"&":"")+e.dataParams:"",_.includes(f.NON_BODY_HTTP_METHODS,_.toUpper(e.method))&&x(a,d),x(e.data,d),_.forEach(d,(function(e,t){(r=$('<input type="hidden">')).attr({name:t,value:e}),o.append(r)})),$("body").append(i),setTimeout((function(){i.contents().find("body").append(o),o.submit(),n.triggerFn(t)}),100)},M=function(t,i,o){var r=t.url,a=t.method,s=t.dataParams||t.data,l=t.headers;l["Content-Type"]=l["Content-Type"]||"application/x-www-form-urlencoded",e.httpService.send({target:"WebService",action:"invokeRuntimeRestCall",method:a,url:r,headers:l,data:s,responseType:"arraybuffer"}).then((function(e){setTimeout((function(){N(e.body,e.headers,i,o)}),900)}),(function(e){n.triggerFn(o,e)}))},L=function(){return!!h.hasCordova&&localStorage.getItem(h.XSRF_COOKIE_NAME)},F=function(e,t,i){var o,r=e.target,a=i[t];return S.test(r)?o=a:(r=r.substr(0,r.lastIndexOf(".")),o=e.target===t?i:r?n.findValueOf(a,r,!0):a),o},j=function(e){return S.test(e)?e.replace(/^(\[["'])|(["']\])$/g,""):e.split(".").pop()},B=function(e,t,n,i,o,r){var a=j(e),s=F(t,n,i);o=_.isUndefined(o)?t.value:o,s&&(s[a]=o),A(a,o,t.type,i,r)},G=function(e,t,n){var i,o=_.keys(_.get(E.get(n),[n.name,t])),r=j(e);(i=_.filter(o,(function(e){return e!==r&&_.includes(e,r)||(r===t||"dataBinding"===r)&&e!==r}))).length&&_.forEach(i,(function(e){B(e,{target:e},t,n,_.get(E.get(n),[n.name,t,e]))}))},V=function(e,t,i,o){var r=e.target,a=F(e,i,o),s=j(r),l=t.registerDestroyListener?t.registerDestroyListener.bind(t):_.noop;if(n.stringStartsWith(e.value,"bind:")){l(n.$watch(e.value.replace("bind:",""),t,{},(function(t,l){t===l&&_.isUndefined(t)||!(!_.isUndefined(t)||_.isUndefined(l)&&_.isUndefined(a[s]))||(_.includes(["blob","file"],e.type)||(t=n.getClonedObject(t)),B(r,e,i,o,t),E.has(o)||E.set(o,{}),_.set(E.get(o),[o.name,i,r],t),_.isObject(t)&&G(r,i,o))}),void 0,void 0,void 0,(function(){return o.isMuted})))}else _.isUndefined(e.value)||(B(r,e,i,o,e.value,!0),i!==s&&(E.has(o)||E.set(o,{}),_.set(E.get(o),[o.name,i,r],e.value)))},U=function(e,t,n,i){i=i||"dataBinding";var o=e[n=n||"dataBinding"];e[n]={},e["_bind"+n]=o,o&&_.isArray(o)&&o.forEach((function(n){"wm.Variable"===e.category&&"dataBinding"===n.target&&(n.target="dataSet"),V(n,t,i,e)}))},W=function(t,n,i,o,r){if(h.hasCordova){var a=void 0;i&&(a=O[i]),e.appManager.notify("device-file-download",{url:t.url,name:n,extension:a,headers:t.headers,successCb:o,errorCb:r})}else!_.isEmpty(t.headers)||L()?M(t,o,r):k(t,o)},q=function(){return window.File&&window.FileReader&&window.FileList&&window.Blob},z=R,H=function(e){return n.DEFAULT_FORMATS[_.toUpper(e)]},Y=function(t,i){var o;return _.isDate(t)?o=t.getTime():(isNaN(t)||(t=parseInt(t,10)),o=t&&moment(t).valueOf()),isNaN(o)&&i!==n.DataType.TIME||i===n.DataType.TIMESTAMP?o:(i!==n.DataType.TIME||o||(o=moment((new Date).toDateString()+" "+t).valueOf()),t&&e.appManager.getPipe("date").transform(o,H(i)))},K=function(e,t){return _.includes(t,".")&&(t=_.toLower(n.extractType(t))),_.isArray(e)?_.map(e,(function(e){return Y(e,t)})):Y(e,t)};var Q=function(){function t(){}return t.prototype.initBinding=function(e,t,n){U(e,e._context,t,n)},t.prototype.notifyInflight=function(t,n,i){e.appManager.notify("toggle-variable-state",{variable:t,active:n,data:i})},t}(),X=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return b(i,t),i.prototype.invoke=function(t,i){!function(t,i){var o;t.dataSet=i&&i.data||t.dataSet;var r=t.dataBinding.pageName||t.pageName,a=t.operation,s=_.clone(t.dataSet),l=_.isNil(null==i?void 0:i.cacheable)?t.cacheable:i.cacheable;switch(i=i||{},_.isNil(l)||n.isString(l)&&""===l.trim()||(s._cache_page=l),a){case"goToPreviousPage":e.navigationService.goToPrevious();break;case"gotoPage":e.navigationService.goToPage(r,{transition:t.pageTransitions,$event:i.$event,urlParams:s,cacheable:t.cacheable});break;case"gotoView":o=t.dataBinding&&t.dataBinding.viewName||t.viewName;break;case"gotoTab":o=t.dataBinding&&t.dataBinding.tabName||t.tabName;break;case"gotoAccordion":o=t.dataBinding&&t.dataBinding.accordionName||t.accordionName;break;case"gotoSegment":o=t.dataBinding&&t.dataBinding.segmentName||t.segmentName}o&&e.navigationService.goToView(o,{pageName:r,transition:t.pageTransitions,$event:i.$event,urlParams:s},t)}(t,i)},i}(Q),J=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return b(i,t),i.prototype.onToasterClick=function(e){I("onClick",e,"")},i.prototype.onToasterHide=function(e){I("onHide",e,"")},i.prototype.notifyViaToaster=function(t,n){var i,o=(n.class||t.dataBinding.class||"info").toLowerCase(),r=n.message||t.dataBinding.text,a=n.title,s="toast-"+(n.position||t.dataBinding.toasterPosition||"bottom right").replace(" ","-"),l=t.dataBinding.page,c=parseInt(n.duration||t.dataBinding.duration,null);c||(c=0!==c&&"success"===o?3e3:0),i=t.dataBinding.content&&"page"===t.dataBinding.content&&l?e.toasterService.showCustom(l,{positionClass:s,timeOut:c,partialParams:t._binddataSet,context:t._context}):e.toasterService.show(o,a,r||null,{positionClass:s,timeOut:c,enableHtml:!0}),t.onClick&&i.onTap.subscribe(this.onToasterClick.bind(this,t)),t.onHide&&i.onHidden.subscribe(this.onToasterHide.bind(this,t))},i.prototype.getDialogConfig=function(t,n,i,o){return{title:n.title||t.dataBinding.title,text:n.message||t.dataBinding.text,okButtonText:n.okButtonText||t.dataBinding.okButtonText||"OK",cancelButtonText:n.cancelButtonText||t.dataBinding.cancelButtonText||"CANCEL",alerttype:n.alerttype||t.dataBinding.alerttype||"information",onOk:function(){e.dialogService.close(i,void 0,o)},onCancel:function(){I("onCancel",t,n.data),e.dialogService.close(i,void 0)},onClose:function(){I("onClose",t,n.data)}}},i.prototype.notifyViaDialog=function(t,i){var o="PREFAB"===n.getWmProjectProperties().type,r=(o?"Prefab":"Common")+_.capitalize(t.operation)+"Dialog",a=this.getDialogConfig(t,i,r,(function(){return I("onOk",t,i.data)}));a=o?a:{notification:a},e.dialogService.open(r,void 0,a)},i.prototype.notify=function(e,t,n,i){t=t||{},"toast"===e.operation?this.notifyViaToaster(e,t):this.notifyViaDialog(e,t)},i.prototype.getMessage=function(e){return e.dataBinding.text},i.prototype.setMessage=function(e,t){return _.isString(t)&&(e.dataBinding.text=t),e.dataBinding.text},i.prototype.getOkButtonText=function(e){return e.dataBinding.okButtonText},i.prototype.setOkButtonText=function(e,t){return _.isString(t)&&(e.dataBinding.okButtonText=t),e.dataBinding.okButtonText},i.prototype.getToasterDuration=function(e){return e.dataBinding.duration},i.prototype.setToasterDuration=function(e,t){return e.dataBinding.duration=t,e.dataBinding.duration},i.prototype.getToasterClass=function(e){return e.dataBinding.class},i.prototype.setToasterClass=function(e,t){return _.isString(t)&&(e.dataBinding.class=t),e.dataBinding.class},i.prototype.getToasterPosition=function(e){return e.dataBinding.class},i.prototype.setToasterPosition=function(e,t){return _.isString(t)&&(e.dataBinding.position=t),e.dataBinding.position},i.prototype.getAlertType=function(e){return e.dataBinding.alerttype},i.prototype.setAlertType=function(e,t){return _.isString(t)&&(e.dataBinding.alerttype=t),e.dataBinding.alerttype},i.prototype.getCancelButtonText=function(e){return e.dataBinding.cancelButtonText},i.prototype.setCancelButtonText=function(e,t){return _.isString(t)&&(e.dataBinding.cancelButtonText=t),e.dataBinding.cancelButtonText},i}(Q),Z=function(){function t(){}return t.prototype.initBinding=function(e,t,n){U(e,e._context,t,n)},t.prototype.notifyInflight=function(t,n,i,o){e.appManager.notify("toggle-variable-state",{variable:t,active:n,data:i,options:o})},t.prototype.setRequestTrackId=function(e,t){var n,i=null===(n=null==e?void 0:e.headers)||void 0===n?void 0:n.get("x-wm-request-track-id");i&&(t._requestTrackId=i)},t.prototype.httpCall=function(t,n,i){var o=this;return new Promise((function(r,a){n._observable=e.httpService.sendCallAsObservable(t,i).subscribe((function(e){e&&e.type&&(o.setRequestTrackId(e,n),r(e))}),(function(t){o.setRequestTrackId(t,n),e.httpService.isPlatformSessionTimeout(t)?(o.notifyInflight(n,!1,t),t._401Subscriber.asObservable().subscribe((function(e){return r(e)}),(function(e){return a(e)}))):a(t)}))}))},t.prototype.prepareCallbackOptions=function(e,t){var n={};return n.xhrObj=e,t&&_.extend(n,t),n},t}(),ee=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return b(i,t),i.prototype.validate=function(e){var t,n,i;for(n in["rememberme","remembermecheck"].forEach((function(t){_.isBoolean(e[t])&&(i=t)})),e[i=i||"j_rememberme"]=!!_.isBoolean(e[i])&&e[i],e)if(e.hasOwnProperty(n)&&(""===e[n]||void 0===e[n])){t="Please provide required credentials";break}return t},i.prototype.migrateOldParams=function(e){var t={},n={usernametext:"j_username",username:"j_username",passwordtext:"j_password",password:"j_password",remembermecheck:"j_rememberme",rememberme:"j_rememberme"};return _.each(e,(function(e,i){n[i]?t[n[i]]=e:t[i]=e})),t},i.prototype.redirectToAppBasePath=function(){e.routerService.navigate(["/"]).then((function(e){e&&window.location.reload()}))},i.prototype.login=function(t,i,o,r){var a,s=this,l=(i=i||{}).loginInfo||i.input||t.dataBinding,c=this.validate(l);if(c)return n.triggerFn(r,c),void I("onError",t,c);var p=n.getClonedObject(l),u=I(m.EVENT.BEFORE_UPDATE,t,p);if(_.isObject(u))p=u;else if(!1===u)return void n.triggerFn(r);p=this.migrateOldParams(p);var d=_.get(e.securityService.get(),"userInfo.userName");this.notifyInflight(t,!0),t.promise=e.securityService.appLogin(p,(function(i){e.dialogService.close("CommonLoginDialog"),e.appManager.reloadAppData().then((function(r){I(m.EVENT.RESULT,t,_.get(r,"userInfo")),(a=I(m.EVENT.PREPARE_SETDATA,t,_.get(r,"userInfo")))&&_.set(r,"userInfo",a),s.notifyInflight(t,!1,i),n.triggerFn(o),setTimeout((function(){if(I(m.EVENT.SUCCESS,t,_.get(r,"userInfo")),t.useDefaultSuccessHandler){var n=d===p.j_username;d&&!n||e.appManager.executeSessionFailureRequests();var i=e.securityService.getCurrentRouteQueryParam("redirectTo"),o=e.appManager.noRedirect(),a=e.securityService.getRedirectedRouteQueryParams();if(a.redirectTo&&delete a.redirectTo,e.appManager.noRedirect(!1),d)if(_.isEmpty(i)){var l=e.securityService.get(),c=_.get(l,"loginConfig.sessionTimeout.type")||"PAGE";n&&"DIALOG"===c||s.redirectToAppBasePath()}else d===p.j_username?e.routerService.navigate(["/"+i],{queryParams:a}):s.redirectToAppBasePath();else _.isEmpty(i)?o||e.routerService.navigate(["/"]):e.routerService.navigate(["/"+i],{queryParams:a})}I(m.EVENT.CAN_UPDATE,t,_.get(r,"userInfo"))}))}))}),(function(e){I(m.EVENT.RESULT,t,e),s.notifyInflight(t,!1,e);var i=e.error||"Invalid credentials.",o=e.details;h.isRunMode&&I("onError",t,i,o,!0),n.triggerFn(r,i,o),I(m.EVENT.CAN_UPDATE,t,e)}))},i}(Q),te=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return b(i,t),i.prototype.logout=function(t,i,o,r){var a,s,l,c=this;a=function(e,i,o){h.isStudioMode||I("onError",t,e,o),n.triggerFn(r,e,o)},!1!==I(m.EVENT.BEFORE_UPDATE,t,null)?e.securityService.isAuthenticated((function(i){i?(c.notifyInflight(t,!0),t.promise=e.securityService.appLogout((function(i){var r=i.body;r=n.getValidJSON(r),e.appManager.reloadAppData().then((function(){c.notifyInflight(t,!1,r),I(m.EVENT.RESULT,t,r),(l=I(m.EVENT.PREPARE_SETDATA,t,r))&&(r=l),setTimeout((function(){I(m.EVENT.SUCCESS,t,r),I(m.EVENT.CAN_UPDATE,t,r)}))})),r&&r.result?window.location.href=r.result:t.useDefaultSuccessHandler&&((s=t.redirectTo)&&"login.html"!==s&&"index.html"!==s||(s=""),e.routerService.navigate(["/"+s]),window.cordova||setTimeout((function(){window.location.reload()}))),n.triggerFn(o)}),a)):a("No authenticated user to logout.")}),(function(e){c.notifyInflight(t,!1,e),a(e)})):n.triggerFn(r)},i}(Q),ne=function(e){function t(){var t=e.apply(this,P([],w(arguments)))||this;return t.serviceRegistry=new Map,t}return b(t,e),t.prototype.invoke=function(e,t){var n=this,i=this.serviceRegistry.get(e.service);return null==i?(I("onError",e,null),Promise.reject("Could not find service '"+i+"'")):(this.notifyInflight(e,!0),i.invoke(e,t).then((function(t){return n.notifyInflight(e,!1,t),t}),(function(t){return n.notifyInflight(e,!1,t),Promise.reject(t)})))},t.prototype.registerService=function(e){this.serviceRegistry.set(e.name,e)},t}(Z),ie=function(){function e(){}return e.setPaginationQueryParams=function(e,t,n){t.parameters.forEach((function(t){var i;i="offset"===n.type||n.input.offset?"offset":"page",t.name===n.input[i].split(".")[0]?t.sampleValue=e.pagination.page:t.name===n.input.size.split(".")[0]&&(t.sampleValue=e.pagination.size)}))},e.setVariablePagination=function(e,t,n){e.pagination||(e.pagination={empty:!1}),e.pagination.size=t.size,e.pagination.page=t.page||0,e.pagination.totalElements=t.totalElements,e.pagination.numberOfElements=e.pagination.size,e.pagination.number=n.page?n.page-1:0,e.pagination.totalPages=e.pagination.totalElements/e.pagination.size,e.pagination.totalElements%e.pagination.size==0?e.pagination.totalPages=parseInt(e.pagination.totalPages):e.pagination.totalPages=parseInt(e.pagination.totalPages)+1,t.next?(e.pagination.next=t.next,e.pagination.prev=t.prev,e.pagination.last=!t.next,e.pagination.first=!t.prev):(e.pagination.first=e.pagination.page<=1,e.pagination.last=""===t.hasMoreItems?!(e.pagination.page<e.pagination.totalPages):!t.hasMoreItems)},e.setPaginationItems=function(e,t,n,i,r){var a;if(_.startsWith(e,"$body")){var s=e.replace("$body.","");try{n[i]=o.jmespath.search(t,s)}catch(t){console.warn(e+" expression needs to be corrected as per JMES guidelines")}}else if(_.startsWith(e,"$header")){var l=e.replace("$header.",""),c=Object.fromEntries(r.headers),p=l.split(".");try{n[i]=o.jmespath.search(c,p[0].toLowerCase())}catch(t){console.warn(e+" expression needs to be corrected as per JMES guidelines")}if(null===(a=n[i])||void 0===a?void 0:a.length){var u=n[i].join();if(1===p.length)n[i]=u;else{var d=p.slice(1).join("."),h=JSON.parse(u);/[!@#$%^&*()+\=\[\]{};':"\\|,<>\/?]+/.test(d)&&(d="headerResp."+d);try{n[i]=o.jmespath.search(h,d)}catch(t){console.warn(e+" expression needs to be corrected as per JMES guidelines")}}}}},e.getPaginationInfo=function(e,t){return(null==e?void 0:e.paginationInfo)?e.paginationInfo:t._paginationConfig},e.checkPaginationAtQuery=function(e,t,n){var i,o=this.getPaginationInfo(e,t);if(n&&n.page&&(null==o?void 0:o.input.size)&&t.pagination){var r;r="offset"===o.type||o.input.offset?"offset":"page";var a=o.input[r].split(".")[0],s=_.find(e.parameters,(function(e){return e.name===a}));!_.isEmpty(t.dataBinding)&&s&&"query"===s.parameterType&&((null===(i=o.output)||void 0===i?void 0:i.page)||"offset"===o.type?t.pagination.page=this.getOffsetInfo(t,n):t.pagination.page=n.page,this.setPaginationQueryParams(t,e,o))}},e.getOffsetInfo=function(e,t){return e.pagination.size*(t.page?t.page-1:1)},e.setPaginationAtReq=function(e,t,n,i,o,r,a){var s,l={},c={};s="offset"===e.type||e.input.offset?"offset":"page";var p=e.input[s].split(".")[0],u=_.find(t.parameters,(function(e){return e.name===p}));if("header"===(null==u?void 0:u.parameterType))_.set(l,e.input[s],n.pagination.page),_.set(l,e.input.size,n.pagination.size),i[p]=JSON.stringify(l[p]),c.headers=i;else if("body"===(null==u?void 0:u.parameterType)){var d=JSON.parse(u.sampleValue),h=e.input[s].split(".")[1];if(d&&d[h]){var m=e.input[s].split(".").splice(1).join(".");"offset"!==s?_.set(l,m,n.pagination.page):_.set(l,m,this.getOffsetInfo(n,a)),_.set(l,e.input.size.split(".").splice(1).join("."),n.pagination.size),d[h]=l[h],o=JSON.stringify(d),c.requestBody=o}}else if(n.pagination.next&&u)if("path"===u.parameterType){var f=t.relativePath.split("/"),g="{"+u.name+"}",v=f.indexOf(g),y=void 0;y=n.pagination.isNext?n.pagination.next.split("/"):n.pagination.prev.split("/");var b=void 0,w=void 0;t.directPath?((b=(w=new URL(r)).pathname.split("/"))[v]=y[v],w.pathname=b.join("/"),r=w.href,c.url=r):((b=r.split("/"))[v+1]=y[v],r=b.join("/"),c.url=r)}else if("query"===u.parameterType){f=r.split("?"),y=void 0;y=n.pagination.isNext?n.pagination.next.split("?"):n.pagination.prev.split("?"),f[1]=y[1],r=f.join("?"),c.url=r}return c},e.setParameterVal=function(e,t,n,i){var o=this.getPaginationInfo(n,i).input[e].split(".")[0],r=_.find(n.parameters,(function(e){return e.name===o}));t[e]=_.result(r,"sampleValue")},e.generatePaginationRes=function(e,t,n,i,o,r){var a={},s=t.output;if(null==s?void 0:s.next)s&&(this.setPaginationItems(s.next,n,a,"next",i),this.setPaginationItems(s.prev,n,a,"prev",i));else{if((null==s?void 0:s.size)?this.setPaginationItems(s.size,n,a,"size",i):this.setParameterVal("size",a,e,r),(null==s?void 0:s.page)?this.setPaginationItems(s.page,n,a,"page",i):"offset"!==t.type&&this.setParameterVal("page",a,e,r),_.startsWith(null==s?void 0:s.totalElements,"$minValue")){var l=s.totalElements.replace("$minValue=",""),c=a.page?a.page:o.page,p=a.size*c;!r.pagination||r.pagination.totalElements>p?a.totalElements=parseInt(l):a.totalElements=p+1}else(null==s?void 0:s.totalElements)?this.setPaginationItems(s.totalElements,n,a,"totalElements",i):"offset"===t.type||t.input.offset?a.totalElements=a.size*(o.page?o.page:1)+1:a.totalElements=a.size*a.page+1;(null==s?void 0:s.hasMoreItems)?this.setPaginationItems(s.hasMoreItems,n,a,"hasMoreItems",i):a.hasMoreItems=""}return a},e}(),oe=function(e){return _.includes(["QueryExecution","ProcedureExecution"],e.controller)&&_.includes(["put","post"],e.operationType)},re=function(e,t){return e===m.CONTROLLER_TYPE.QUERY&&t===m.SERVICE_TYPE.DATA},ae=function(e,t,i){var o=_.toLower(n.extractType(_.get(t,"items.type")||t.type)),r=h.isStudioMode?t["x-WM-CONTENT_TYPE"]:t.contentType;if(q())return"file"===o||"string"!==r&&r?_.isArray(i)&&"file"===o?_.forEach(i,(function(i){e.append(t.name,i&&i.content||n.getBlob(i),i.name)})):e.append(t.name,n.getBlob(i,r),i&&i.name):(_.isObject(i)&&(i=JSON.stringify(i)),e.append(t.name,i)),e},se=function(e,t){var i,o={},r=[];return _.forEach(t,(function(t){i=_.get(e,t.name),_.isUndefined(i)||""===i||null===i||t.readOnly?t.required&&r.push(t.name||t.id):(i=n.isDateTimeType(t.type)?K(i,t.type):i,_.isArray(i)&&"string"===_.toLower(n.extractType(t.type))&&(i=_.join(i,",")),o[t.name]=i)})),{requestBody:o,missingParams:r}},le=function(e){var t={},n=m.REST_SERVICE.UNCLOAKED_HEADERS,i=m.REST_SERVICE.PREFIX.CLOAK_HEADER_KEY;return _.forEach(e,(function(e,o){_.includes(n,o.toUpperCase())?t[o]=e:t[i+o]=e})),t},ce=function(){function t(){}return t.constructRequestParams=function(t,i,o,r){if(t=t||{},null===i)return{error:{type:m.REST_SERVICE.ERR_TYPE.USER_UNAUTHORISED,message:m.REST_SERVICE.ERR_MSG.USER_UNAUTHORISED,field:"_wmServiceOperationInfo"}};if(_.isEmpty(i))return{error:{type:m.REST_SERVICE.ERR_TYPE.METADATA_MISSING,message:m.REST_SERVICE.ERR_MSG.METADATA_MISSING,field:"_wmServiceOperationInfo"}};if(i&&i.invalid)return{error:{type:m.REST_SERVICE.ERR_TYPE.CRUD_OPERATION_MISSING,message:m.REST_SERVICE.ERR_MSG.CRUD_OPERATION_MISSING,field:"_wmServiceOperationInfo"}};var a,s,l,c,p,u,d,y,b,w,P,O,S,E,T,R,A,C=i.directPath||"",I=i.basePath?i.basePath+i.relativePath:i.relativePath,D=oe(t),N="",x={},k=[],M=null;function L(){return b||(b=new FormData)}if(S=_.get(i.securityDefinitions,"0"))switch(S.type){case m.REST_SERVICE.SECURITY_DEFN.OAUTH2:if(R=S[m.REST_SERVICE.OAUTH_PROVIDER_KEY],A=null,!(E=e.oauthService.getAccessToken(R,A)))return{error:{type:m.REST_SERVICE.ERR_TYPE.NO_ACCESSTOKEN,message:m.REST_SERVICE.ERR_MSG.NO_ACCESSTOKEN},securityDefnObj:S};x[m.REST_SERVICE.AUTH_HDR_KEY]=m.REST_SERVICE.PREFIX.AUTH_HDR_VAL.OAUTH+" "+E;break;case m.REST_SERVICE.SECURITY_DEFN.BASIC:if(u=o.wm_auth_username,d=o.wm_auth_password,!u||!d)return{error:{type:m.REST_SERVICE.ERR_TYPE.NO_CREDENTIALS,message:m.REST_SERVICE.ERR_MSG.NO_CREDENTIALS},securityDefnObj:S};x[m.REST_SERVICE.AUTH_HDR_KEY]=m.REST_SERVICE.PREFIX.AUTH_HDR_VAL.BASIC+" "+btoa(u+":"+d),M={type:m.REST_SERVICE.AUTH_TYPE.BASIC}}if(ie.checkPaginationAtQuery(i,t,r),i.proxySettings=i.proxySettings||{web:!0,mobile:!1},y=i.httpMethod||i.methodType,w=h.hasCordova?i.proxySettings.mobile:i.proxySettings.web,T=i.proxySettings.withCredentials,l=w?I:C,_.forEach(i.parameters,(function(e){function r(){o?(P=o[e.name]&&_.isObject(o[e.name])?o[e.name]:o,O=_.get(i,["definitions",e.type])):(P=c||{},O=e.children)}var c=e.sampleValue;if(n.isDefined(c)&&null!==c&&""!==c||D&&"file"!==e.type)switch(t.serviceType===m.SERVICE_TYPE.DATA&&n.isDateTimeType(e.type)&&(c=K(c,e.type)),_.isArray(c)&&"string"===_.toLower(n.extractType(e.type))&&t.serviceType===m.SERVICE_TYPE.DATA&&(c=_.join(c,",")),e.parameterType.toUpperCase()){case"QUERY":if(_.isNull(c)&&re(t.controller,t.serviceType))break;N?N+="&"+e.name+"="+encodeURIComponent(c):N="?"+e.name+"="+encodeURIComponent(c);break;case"PATH":p=new RegExp("\\s*\\{\\s*"+e.name+"(:\\.\\+)?\\s*\\}\\s*"),l=l.replace(p,c);break;case"HEADER":x[e.name]=c;break;case"BODY":D?(r(),a=se(P,O),s=a.requestBody,k=_.concat(k,a.missingParams)):s=c;break;case"FORMDATA":D&&e.name===g.WM_DATA_JSON?(r(),a=se(P,O),s=ae(L(),e,a.requestBody),k=_.concat(k,a.missingParams)):s=ae(L(),e,c)}else e.required&&k.push(e.name||e.id)})),k.length)return{error:{type:m.REST_SERVICE.ERR_TYPE.REQUIRED_FIELD_MISSING,field:k.join(","),message:n.replace(m.REST_SERVICE.ERR_MSG.REQUIRED_FIELD_MISSING,[k.join(",")]),skipDefaultNotification:!0}};_.includes(f.NON_BODY_HTTP_METHODS,_.toUpper(y))||i.consumes&&i.consumes[0]===f.CONTENT_TYPES.MULTIPART_FORMDATA||(x["Content-Type"]=i.consumes&&i.consumes[0]||"application/json"),_.includes(i.consumes,f.CONTENT_TYPES.FORM_URL_ENCODED)&&!_.includes(f.NON_BODY_HTTP_METHODS,(y||"").toUpperCase())?(N&&(s=(s?s+"&":"")+N.substring(1)),x["Content-Type"]=f.CONTENT_TYPES.FORM_URL_ENCODED):l+=N,w&&(x=t.serviceType!==m.SERVICE_TYPE.REST&&t.serviceType!==m.SERVICE_TYPE.OPENAPI||i.skipCloakHeaders?x:le(x),t.getPrefabName()&&-1!==m.REST_SUPPORTED_SERVICES.indexOf(t.serviceType)?(l="prefabs/"+t.getPrefabName()+l,c="invokePrefabRestService"):t.getPrefabName()||(l="services"+l),l=v.project.deployedUrl+l);var F=ie.getPaginationInfo(i,t);if(F&&t.pagination){var j=ie.setPaginationAtReq(F,i,t,x,s,l,r);j&&(j.headers?x=j.headers:j.requestBody?s=j.requestBody:j.url&&(l=j.url))}return{projectID:v.project.id,url:l,target:c,method:y,headers:x,data:s,authDetails:M,isDirectCall:!w,isExtURL:t.serviceType===m.SERVICE_TYPE.REST,withCredentials:T}},t.isFileUploadRequest=function(e){return"FileService"===e.service&&"uploadFile"===e.operation},t.excludePaginationParams=function(e){return _.map(_.reject(e,(function(e){return _.includes(m.PAGINATION_PARAMS,e.name)})),(function(e){return e.name}))},t}(),pe=function(t){function o(){var e=t.apply(this,P([],w(arguments)))||this;return e.scope_var_socket_map=new Map,e.PROPERTY={SERVICE:"service",DATA_UPDATE_STRATEGY:"dataUpdateStrategy",DATA_LIMIT:"dataLimit"},e.DATA_UPDATE_STRATEGY={REFRESH:"refresh",PREPEND:"prepend",APPEND:"append"},e}return b(o,t),o.prototype.shouldAppendData=function(e){return(e=e||this)[this.PROPERTY.DATA_UPDATE_STRATEGY]!==this.DATA_UPDATE_STRATEGY.REFRESH},o.prototype.shouldAppendLast=function(e){return e[this.PROPERTY.DATA_UPDATE_STRATEGY]===this.DATA_UPDATE_STRATEGY.APPEND},o.prototype.getDataLimit=function(e){return e.dataLimit},o.prototype.getURL=function(t){var n,i=t.getPrefabName(),o=i?_.get(e.metadataService.getByOperationId(t.operationId,i),"wmServiceOperationInfo"):_.get(e.metadataService.getByOperationId(t.operationId),"wmServiceOperationInfo"),r=t.dataBinding;if(_.forEach(o.parameters,(function(e){e.sampleValue=r[e.name]})),$.extend(o,{skipCloakHeaders:!0}),!(n=ce.constructRequestParams(t,o,r)).error||!n.error.message)return n.url;this._onSocketError(t,{data:n.error.message})},o.prototype._onSocketMessage=function(e,t){var i,o,r,a,s,l=_.get(t,"data");l=n.getValidJSON(l)||n.xmlToJson(l)||l,i=I(m.EVENT.MESSAGE_RECEIVE,e,l,t),l=n.isDefined(i)?i:l,this.shouldAppendData(e)?(e.dataSet=e.dataSet||[],o=e.dataSet.length,r=this.getDataLimit(e),a=this.shouldAppendLast(e),r&&o>=r&&(a?e.dataSet.shift():e.dataSet.pop()),s=a?o:0,e.dataSet.splice(s,0,l)):e.dataSet=n.isDefined(i)?i:l},o.prototype._onBeforeSend=function(e,t){return I(m.EVENT.BEFORE_SEND,e,t)},o.prototype._onBeforeSocketClose=function(e,t){return I(m.EVENT.BEFORE_CLOSE,e,_.get(t,"data"),t)},o.prototype._onBeforeSocketOpen=function(e,t){return I(m.EVENT.BEFORE_OPEN,e,_.get(t,"data"),t)},o.prototype._onSocketOpen=function(e,t){e._socketConnected=!0,I(m.EVENT.OPEN,e,_.get(t,"data"),t)},o.prototype.freeSocket=function(e){this.scope_var_socket_map.set(e,void 0)},o.prototype._onSocketClose=function(e,t){e._socketConnected=!1,this.freeSocket(e),I(m.EVENT.CLOSE,e,_.get(t,"data"),t)},o.prototype._onSocketError=function(e,t){e._socketConnected=!1,this.freeSocket(e),I(m.EVENT.ERROR,e,_.get(t,"data")||"Error while connecting with "+e.service,t)},o.prototype.getSocket=function(e){var t=this.getURL(e),o=this.scope_var_socket_map.get(e);return o||(h.hasCordova||!n.isInsecureContentRequest(t)?((o=new i.$WebSocket(t)).onOpen(this._onSocketOpen.bind(this,e)),o.onError(this._onSocketError.bind(this,e)),o.onMessage(this._onSocketMessage.bind(this,e)),o.onClose(this._onSocketClose.bind(this,e)),this.scope_var_socket_map.set(e,o),e._socket=o,o):void n.triggerFn(this._onSocketError.bind(this,e)))},o.prototype.open=function(e,t,i){var o;if(!1!==this._onBeforeSocketOpen(e))return o=this.getSocket(e),n.triggerFn(t),o;n.triggerFn(i)},o.prototype.close=function(e){var t=this._onBeforeSocketClose(e),n=this.getSocket(e);!1!==t&&n.close()},o.prototype.send=function(e,t){var i,o=this.getSocket(e);t=t||_.get(e,"dataBinding.RequestBody"),!1!==(i=this._onBeforeSend(e,t))&&(t=n.isDefined(i)?i:t,t=n.isObject(t)?JSON.stringify(t):t,o.send(t,0))},o}(Z),ue=new Map,de={Variable:Z,Action:Q,"wm.NavigationVariable":X,"wm.NotificationVariable":J,"wm.LoginVariable":ee,"wm.LogoutVariable":te,"wm.DeviceVariable":ne,"wm.WebSocketVariable":pe},he=function(){function e(){}return e.get=function(e){return ue.has(e)?ue.get(e):ue.set(e,new de[e]).get(e)},e}(),me=function(){function e(){}return e.prototype.invoke=function(e,t){var i=this.operations.find((function(t){return t.name===e.operation}));if(null==i)return I(m.EVENT.ERROR,e,null),Promise.reject("Could not find operation '"+e.operation+"' in service '"+this.name+"'");if(n.hasCordova()){var o=new Map;return void 0!==e.dataBinding&&(Object.entries(e).forEach((function(e){o.set(e[0],e[1])})),Object.entries(e.dataBinding).forEach((function(e){o.set(e[0],e[1])}))),i.invoke(e,t,o).then((function(t){return e.dataSet=t,n.$invokeWatchers(!0),I(m.EVENT.SUCCESS,e,t),t}),(function(t){return e.dataSet={},n.$invokeWatchers(!0),I(m.EVENT.ERROR,e,null),t}))}return Promise.resolve().then((function(){return I(m.EVENT.SUCCESS,e,i.model),i.model}))},e}(),fe=function(){return he.get(m.CATEGORY.DEVICE)},ge=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.init=function(){fe().initBinding(this)},t.prototype.invoke=function(e,t,n){fe().invoke(this,e).then(t,n)},t}(t.ApiAwareVariable),ve=function(){return he.get(m.CATEGORY.NAVIGATION)},ye=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.invoke=function(e){ve().invoke(this,e)},t.prototype.navigate=function(e){this.invoke(e)},t.prototype.init=function(){ve().initBinding(this,"dataBinding","dataBinding"),ve().initBinding(this,"dataSet","dataSet")},t}(t.BaseAction),be=function(){return he.get(m.CATEGORY.NOTIFICATION)},we=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.execute=function(t,i){var o=this,r=e.prototype.execute.call(this,t,i);return n.isDefined(r)?r:new Promise((function(e,r){switch(t){case n.DataSource.Operation.INVOKE:o.invoke(i,e,r);break;case n.DataSource.Operation.NOTIFY:o.notify(i,e,r);break;default:r(t+" operation is not supported on this data source")}}))},t.prototype.notify=function(e,t,n){be().notify(this,e,t,n)},t.prototype.invoke=function(e,t,n){this.notify(e,t,n)},t.prototype.getMessage=function(){return be().getMessage(this)},t.prototype.setMessage=function(e){return be().setMessage(this,e)},t.prototype.clearMessage=function(){return be().setMessage(this,"")},t.prototype.getOkButtonText=function(){return be().getOkButtonText(this)},t.prototype.setOkButtonText=function(e){return be().setOkButtonText(this,e)},t.prototype.getToasterDuration=function(){return be().getToasterDuration(this)},t.prototype.setToasterDuration=function(e){return be().setToasterDuration(this,e)},t.prototype.getToasterClass=function(){return be().getToasterClass(this)},t.prototype.setToasterClass=function(e){return be().setToasterClass(this,e)},t.prototype.getToasterPosition=function(){return be().getToasterPosition(this)},t.prototype.setToasterPosition=function(e){return be().setToasterPosition(this,e)},t.prototype.getAlertType=function(){return be().getAlertType(this)},t.prototype.setAlertType=function(e){return be().setAlertType(this,e)},t.prototype.getCancelButtonText=function(){return be().getCancelButtonText(this)},t.prototype.setCancelButtonText=function(e){return be().setCancelButtonText(this,e)},t.prototype.init=function(){be().initBinding(this,"dataBinding","dataBinding"),be().initBinding(this,"dataSet","dataSet")},t}(t.BaseAction),Pe=function(){return he.get(m.CATEGORY.LOGIN)},_e=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.login=function(e,t,n){return Pe().login(this,e,t,n)},t.prototype.invoke=function(e,t,n){return this.login(e,t,n)},t.prototype.cancel=function(){},t.prototype.init=function(){Pe().initBinding(this,"dataBinding","dataBinding")},t}(t.BaseAction),Oe=function(){return he.get(m.CATEGORY.LOGOUT)},Se=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.logout=function(e,t,n){Oe().logout(this,e,t,n)},t.prototype.invoke=function(e,t,n){this.logout(e,t,n)},t.prototype.cancel=function(){},t}(t.BaseAction),Ee=function(){return he.get(m.CATEGORY.WEBSOCKET)},Te=function(e){function t(t){var n=e.call(this)||this;return Object.assign(n,t),n}return b(t,e),t.prototype.open=function(e,t){return Ee().open(this,e,t)},t.prototype.close=function(){return Ee().close(this)},t.prototype.update=function(){return Ee().update(this)},t.prototype.send=function(e){return Ee().send(this,e)},t.prototype.cancel=function(){return this.close()},t.prototype.invoke=function(e,t,n){this.open(t,n)},t.prototype.init=function(){Ee().initBinding(this)},t}(t.ApiAwareVariable),Re=function(){function e(){}return e.create=function(e,n){var i;switch(e.category){case t.VARIABLE_CONSTANTS.CATEGORY.MODEL:i=new t.ModelVariable(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.SERVICE:i=new t.ServiceVariable(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.LIVE:i=new t.LiveVariable(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.CRUD:i=new t.CrudVariable(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.DEVICE:i=new ge(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.NAVIGATION:i=new ye(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.NOTIFICATION:i=new we(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.LOGIN:i=new _e(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.LOGOUT:i=new Se(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.TIMER:i=new t.TimerAction(e);break;case t.VARIABLE_CONSTANTS.CATEGORY.WEBSOCKET:i=new Te(e)}return i._context=n,i.__cloneable__=!1,i},e}(),Ae=function(){function e(e){this.$http=e,this.CONTEXT_APP="app"}return e.prototype.isLoaded=function(){return!!this.metadataMap&&this.metadataMap.has(this.CONTEXT_APP)},e.prototype.load=function(e){var t,i=this;return t=n.hasCordova()?"metadata/"+(e?"prefabs/"+e+"/":"app/")+"service-definitions.json":"./services/"+(e?"prefabs/"+e+"/":"")+"servicedefs",new Promise((function(n,o){i.$http.send({url:t,method:"GET"}).then((function(t){i.metadataMap=i.metadataMap||new Map,i.providerMap=i.providerMap||new Map,t.body=t.body||{},i.metadataMap.set(e||i.CONTEXT_APP,t.body.serviceDefs),t.body.securityDefinitions&&i.providerMap.set(e||i.CONTEXT_APP,t.body.securityDefinitions.oauthProvider),n(t.body.serviceDefs)}),o)}))},e.prototype.getByOperationId=function(e,t){t=t||this.CONTEXT_APP;var n=this.metadataMap.get(t);return n&&n[e]},e.prototype.getByProviderId=function(e,t){t=t||this.CONTEXT_APP;var n=this.providerMap.get(t);return n&&n[e]},e.prototype.getByCrudId=function(e,t){t=t||this.CONTEXT_APP;var n=this.metadataMap.get(t),i=[];for(var o in n)n[o]&&n[o].crudOperationId===e&&i.push(n[o]);return i},e}();Ae.decorators=[{type:r.Injectable}],Ae.ctorParameters=function(){return[{type:n.AbstractHttpService}]};var Ce=function(){function t(){}return t.prototype.format=function(t,n){return e.appManager.getPipe("date").transform(t,n)},t}(),Ie=function(){function e(e,n,i,o,r,a,s,l){this.httpService=e,this.metadataService=n,this.navigationService=i,this.routerService=o,this.toasterService=r,this.oAuthService=a,this.securityService=s,this.dialogService=l,C("http",this.httpService),C("metadata",this.metadataService),C("navigationService",this.navigationService),C("router",this.routerService),C("toaster",this.toasterService),C("oAuth",this.oAuthService),C("security",this.securityService),C("dialog",this.dialogService),t.wmSetDependency("oAuth",this.oAuthService),t.wmSetDependency("security",this.securityService),t.wmSetDependency("metadata",this.metadataService)}return e.prototype.bulkCancel=function(e){Object.keys(e).forEach((function(t){var n=e[t];_.isFunction(n.cancel)&&n.cancel()}))},e.prototype.triggerStartUpdate=function(e){return Promise.all(Object.keys(e).map((function(t){return e[t]})).filter((function(e){return(null==e?void 0:e.startUpdate)&&e.invoke})).map((function(e){return e.invoke()})))},e.prototype.processBindExp=function(e,i,o){var r=t.getTarget(o),a=t.getTargetNodeKey(e.target),s=_.isArray(e.value)?e.value[0]:e.value;return s&&(s.startsWith&&s.startsWith("bind:")?s=n.$watch(s.replace("bind:",""),i,{},o.invokeOnParamChange.bind(o,e),void 0,void 0,void 0,(function(){return o.isMuted})):_.isUndefined(e.value)||(t.setValueToNode(e.target,e,r,o,e.value,!0),r!==a&&(t.internalBoundNodeMap.has(o)||t.internalBoundNodeMap.set(o,{}),_.set(t.internalBoundNodeMap.get(o),[o.name,r,e.target],e.value)))),{name:e.target,value:s}},e.prototype.processBinding=function(e,t,n,i){var o=this;i=i||"dataBinding";var r=e[n=n||"dataBinding"];e[n]={},e["_bind"+n]=r,r&&_.isArray(r)&&r.forEach((function(n){"wm.Variable"===e.category&&"dataBinding"===n.target&&(n.target="dataSet"),o.processBindExp(n,t,e)}))},e.prototype.isVariableSeperated=function(e,t){return"wm.Variable"===e[t].category||"wm.ServiceVariable"===e[t].category||"wm.LiveVariable"===e[t].category||"wm.CrudVariable"===e[t].category},e.prototype.getBindSourceTarget=function(e){return"wm.LiveVariable"===e.category?"read"===e.operation?"filterFields":"inputFields":"wm.ModelVariable"===e.category?"dataSet":"dataBinding"},e.prototype.register=function(e,i,o){var r,a=this,s={Variables:{},Actions:{},callback:this.triggerStartUpdate};for(var l in i){if((r=Re.create(i[l],o)).init(),this.isVariableSeperated(i,l)&&(this.processBinding(r,o,"dataBinding",this.getBindSourceTarget(r)),r.httpService=this.httpService,r.dateFormatter=new Ce,r.subscribe("afterInvoke",(function(){return n.$invokeWatchers(!0)})),"wm.LiveVariable"===r.category&&"read"===r.operation&&n.processFilterExpBindNode(r._context,r.filterExpressions,r),"wm.CrudVariable"!==r.category&&"wm.ServiceVariable"!==r.category||(r.simulateFileDownload=W)),this.isVariableSeperated(i,l)||"wm.TimerVariable"===i[l].category)for(var c in m.EVENT)r[m.EVENT[c]]&&(r[m.EVENT[c]]=n.$parseEvent(r[m.EVENT[c]]));r instanceof t.BaseAction?s.Actions[l]=r:s.Variables[l]=r}return o.registerDestroyListener&&o.registerDestroyListener((function(){a.bulkCancel(s.Variables),a.bulkCancel(s.Actions)})),s},e.prototype.destroy=function(){},e.prototype.registerDependency=function(e,n){C(e,n),t.wmSetDependency(e,n)},e}();Ie.decorators=[{type:r.Injectable}],Ie.ctorParameters=function(){return[{type:n.AbstractHttpService},{type:Ae},{type:n.AbstractNavigationService},{type:a.Router},{type:n.AbstractToasterService},{type:s.OAuthService},{type:l.SecurityService},{type:n.AbstractDialogService}]};var De=u.ToastrModule.forRoot({maxOpened:1,autoDismiss:!0}),Ne=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[Ie,Ae,c.Location,{provide:c.LocationStrategy,useClass:c.HashLocationStrategy}]}},e}();Ne.decorators=[{type:r.NgModule,args:[{imports:[c.CommonModule,De,p.HttpClientModule,d.HttpServiceModule,s.OAuthModule,l.SecurityModule],declarations:[]}]}],e.$rootScope=v,e.CONSTANTS=h,e.DB_CONSTANTS={DATABASE_MATCH_MODES:{like:"LIKE",start:"STARTING_WITH",startignorecase:"STARTING_WITH_IGNORECASE",end:"ENDING_WITH",endignorecase:"ENDING_WITH_IGNORECASE",anywhere:"CONTAINING",anywhereignorecase:"CONTAINING_IGNORECASE",nowhere:"DOES_NOT_CONTAIN",nowhereignorecase:"DOES_NOT_CONTAIN_IGNORECASE",exact:"EQUALS",exactignorecase:"EQUALS_IGNORECASE",notequals:"NOT_EQUALS",notequalsignorecase:"NOT_EQUALS_IGNORECASE",between:"BETWEEN",in:"IN",notin:"NOTIN",lessthan:"LESS_THAN",lessthanequal:"LESS_THAN_OR_EQUALS",greaterthan:"GREATER_THAN",greaterthanequal:"GREATER_THAN_OR_EQUALS",null:"NULL",isnotnull:"IS_NOT_NULL",empty:"EMPTY",isnotempty:"IS_NOT_EMPTY",nullorempty:"NULL_OR_EMPTY"},DATABASE_EMPTY_MATCH_MODES:["NULL","IS_NOT_NULL","EMPTY","IS_NOT_EMPTY","NULL_OR_EMPTY"],DATABASE_RANGE_MATCH_MODES:["IN","NOTIN","BETWEEN","LESS_THAN","LESS_THAN_OR_EQUALS","GREATER_THAN","GREATER_THAN_OR_EQUALS","NOT_EQUALS"],DATABASE_NULL_EMPTY_MATCH:{NULL:"NULL",IS_NOT_NULL:"IS_NOT_NULL",EMPTY:"NULL",IS_NOT_EMPTY:"IS_NOT_NULL",NULL_OR_EMPTY:"NULL"},DATABASE_MATCH_MODES_WITH_QUERY:{LIKE:"${0} like ${1}",STARTING_WITH:"${0} like ${1}",STARTING_WITH_IGNORECASE:"${0} like ${1}",ENDING_WITH:"${0} like ${1}",ENDING_WITH_IGNORECASE:"${0} like ${1}",CONTAINING:"${0} like ${1}",CONTAINING_IGNORECASE:"${0} like ${1}",DOES_NOT_CONTAIN:"${0} not like ${1}",DOES_NOT_CONTAIN_IGNORECASE:"${0} not like ${1}",EQUALS:"${0}=${1}",EQUALS_IGNORECASE:"${0}=${1}",NOT_EQUALS:"${0}!=${1}",NOT_EQUALS_IGNORECASE:"${0}!=${1}",BETWEEN:"${0} between ${1}",IN:"${0} in ${1}",NOTIN:"${0} not in ${1}",LESS_THAN:"${0}<${1}",LESS_THAN_OR_EQUALS:"${0}<=${1}",GREATER_THAN:"${0}>${1}",GREATER_THAN_OR_EQUALS:"${0}>=${1}",NULL:"${0} is null",IS_NOT_NULL:"${0} is not null",EMPTY:"${0}=''",IS_NOT_EMPTY:"${0}<>''",NULL_OR_EMPTY:"${0} is null or ${0}=''"},DATABASE_STRING_MODES:["LIKE","STARTING_WITH","STARTING_WITH_IGNORECASE","ENDING_WITH","ENDING_WITH_IGNORECASE","CONTAINING","CONTAINING_IGNORECASE","DOES_NOT_CONTAIN","DOES_NOT_CONTAIN_IGNORECASE","EQUALS","EQUALS_IGNORECASE","NOT_EQUALS","NOT_EQUALS_IGNORECASE"]},e.DeviceVariableManager=ne,e.DeviceVariableService=me,e.Formatter=Ce,e.MetadataService=Ae,e.SWAGGER_CONSTANTS=g,e.VARIABLE_CONSTANTS=m,e.VARIABLE_URLS={DATABASE:{searchTableData:{url:"/:service/:dataModelName/:entityName/search?page=:page&size=:size&:sort",method:"POST"},searchTableDataWithQuery:{url:"/:service/:dataModelName/:entityName/filter?page=:page&size=:size&:sort",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"}},readTableData:{url:"/:service/:dataModelName/:entityName?page=:page&size=:size&:sort",method:"GET"},insertTableData:{url:"/:service/:dataModelName/:entityName",method:"POST"},insertMultiPartTableData:{url:"/:service/:dataModelName/:entityName",method:"POST",headers:{}},updateTableData:{url:"/:service/:dataModelName/:entityName/:id",method:"PUT"},updateMultiPartTableData:{url:"/:service/:dataModelName/:entityName/:id",method:"POST",headers:{}},deleteTableData:{url:"/:service/:dataModelName/:entityName/:id",method:"DELETE"},updateCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id?:id",method:"PUT"},periodUpdateCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id/periods?:id",method:"PUT"},updateMultiPartCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id?:id",method:"POST",headers:{}},deleteCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id?:id",method:"DELETE"},periodDeleteCompositeTableData:{url:"/:service/:dataModelName/:entityName/composite-id/periods?:id",method:"DELETE"},getDistinctDataByFields:{url:"/:service/:dataModelName/:entityName/aggregations?page=:page&size=:size&:sort",method:"POST"},exportTableData:{url:"/services/:dataModelName/:entityName/export?:sort",method:"POST"},readTableRelatedData:{url:"/:service/:dataModelName/:entityName/:id/:relatedFieldName?page=:page&size=:size&:sort",method:"GET"},executeNamedQuery:{url:"/:service/:dataModelName/queryExecutor/queries/:queryName?page=:page&size=:size&:queryParams",method:"GET"},executeCustomQuery:{url:"/:service/:dataModelName/queries/execute?page=:page&size=:size",method:"POST"},executeAggregateQuery:{url:"/services/:dataModelName/:entityName/aggregations?page=:page&size=:size&sort=:sort",method:"POST"},executeNamedProcedure:{url:"/:service/:dataModelName/procedureExecutor/procedure/execute/:procedureName?page=:page&size=:size&:procedureParams",method:"GET"},countTableDataWithQuery:{url:"/:service/:dataModelName/:entityName/count?:queryParams",method:"GET"}},oauthConfiguration:{getAuthorizationUrl:{url:"services/oauth2/:providerId/authorizationUrl",method:"GET"}}},e.VariableManagerFactory=he,e.VariablesModule=Ne,e.VariablesService=Ie,e.WS_CONSTANTS=f,e.debounceVariableCall=z,e.formatDate=K,e.formatExportExpression=function(e){return _.forEach(e,(function(e){e.expression&&(e.expression="${"+e.expression+"}")})),e},e.getEvaluatedOrderBy=function(e,t){var n,i;return!t||_.isEmpty(t)?e:e?(e=_.split(e,","),t=_.split(t,","),n=_.map(t,(function(e){return _.split(_.trim(e)," ")[0]})),_.remove(e,(function(e){return _.includes(n,_.split(_.trim(e)," ")[0])})),i=e.length?","+_.join(e,","):"",_.join(t,",")+i):t},e.initiateCallback=I,e.isFileUploadSupported=q,e.processBinding=U,e.setDependency=C,e.setInput=function(e,t,i,o){e=e||{};var r,a,s={};if(_.isObject(o))switch(o.type){case"file":i=n.getBlob(i,o.contentType);break;case"number":i=_.isNumber(i)?i:parseInt(i,10)}return _.isObject(t)?s=t:t.indexOf(".")>-1?(a=(r=t.split(".")).pop(),e=n.findValueOf(e,r.join("."),!0),s[t=a]=i):s[t]=i,_.forEach(s,(function(t,n){e[n]=t})),e},e.simulateFileDownload=W,e.toastrModule=De,e["\u0275a"]=Z,e["\u0275b"]=Q,e["\u0275c"]=X,e["\u0275d"]=J,e["\u0275e"]=ee,e["\u0275f"]=te,e["\u0275g"]=pe,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@awesome-cordova-plugins/file/ngx"),require("@wm/core"),require("@wm/mobile/core"),require("@wm/security"),require("@awesome-cordova-plugins/app-version/ngx"),require("@awesome-cordova-plugins/sqlite/ngx"),require("@wm/variables"),require("@awesome-cordova-plugins/app-version/ngx/index"),require("@awesome-cordova-plugins/file/ngx/index"),require("@awesome-cordova-plugins/sqlite/ngx/index"),require("rxjs"),require("@wavemaker/variables")):"function"==typeof define&&define.amd?define("@wm/mobile/offline",["exports","@angular/core","@angular/common","@awesome-cordova-plugins/file/ngx","@wm/core","@wm/mobile/core","@wm/security","@awesome-cordova-plugins/app-version/ngx","@awesome-cordova-plugins/sqlite/ngx","@wm/variables","@awesome-cordova-plugins/app-version/ngx/index","@awesome-cordova-plugins/file/ngx/index","@awesome-cordova-plugins/sqlite/ngx/index","rxjs","@wavemaker/variables"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.mobile=e.wm.mobile||{},e.wm.mobile.offline={}),e.ng.core,e.ng.common,e.awesomeCordova.plugins,e.wm.core,e.wm.mobile.core,e.wm.security,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.wm.variables,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.rxjs,e.wm_common_variables)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h,m){"use strict";function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var g=f(t),v=f(o),y=f(r),b=f(a),w=f(p),P=f(u),O=f(d),S=function(){function e(){}return e.prototype.get=function(e){return this.fetchEntry(e).then((function(e){var t;return e&&e.length>0&&(t=e[0].value)&&(t=JSON.parse(t)),t}))},e.prototype.init=function(e){this.store=e},e.prototype.put=function(e,t){var n=this;return t&&(t=JSON.stringify(t)),this.fetchEntry(e).then((function(i){return i&&i.length>0?n.store.save({id:i[0].id,key:e,value:t}):n.store.add({key:e,value:t})}))},e.prototype.remove=function(e){var t=this;return this.fetchEntry(e).then((function(e){if(e&&e.length>0)return t.store.delete(e[0].id)}))},e.prototype.fetchEntry=function(e){var t=[{attributeName:"key",attributeValue:e,attributeType:"STRING",filterCondition:"EQUALS"}];return this.store.filter(t)},e}();S.SERVICE_NAME="LocalKeyValueService",S.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new S},token:S,providedIn:"root"}),S.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var E,T="WM_LOCAL_OFFLINE_CALL",R=function(e){if(e)return'"'+(e=e.replace(/"/g,'""'))+'"'},A=function(e){var t=[],n=[];return _.forEach(e.columns,(function(e){t.push(R(e.name)),n.push("?")})),"INSERT INTO "+R(e.name)+" ("+t.join(",")+") VALUES ("+n.join(",")+")"},C=function(e){var t=[],n=[];return _.forEach(e.columns,(function(e){t.push(R(e.name)),n.push("?")})),"REPLACE INTO "+R(e.name)+" ("+t.join(",")+") VALUES ("+n.join(",")+")"},I=function(e){var t=_.find(e.columns,"primaryKey");return t?"DELETE FROM "+R(e.name)+" WHERE "+R(t.name)+" = ?":""},D=function(e){var t=[],n=[];return e.columns.forEach((function(i){var o;t.push(R(e.name)+"."+R(i.name)+" as "+i.fieldName),i.foreignRelations&&i.foreignRelations.forEach((function(r){o=r.sourceFieldName,_.forEach(r.dataMapper,(function(e,n){t.push(o+"."+R(e.name)+" as '"+n+"'")})),n.push(" LEFT JOIN "+R(r.targetTable)+" "+o+"\n ON "+o+"."+R(r.targetColumn)+" = "+R(e.name)+"."+R(i.name))}))})),"SELECT "+t.join(",")+" FROM "+R(e.name)+" "+n.join(" ")},N=function(e){var t=[];return e.columns.forEach((function(n){var i;n.foreignRelations&&n.foreignRelations.forEach((function(o){i=o.sourceFieldName,t.push(" LEFT JOIN "+R(o.targetTable)+" "+i+"\n ON "+i+"."+R(o.targetColumn)+" = "+R(e.name)+"."+R(n.name))}))})),"SELECT count(*) as count FROM "+R(e.name)+" "+t.join(" ")},x=function(e,t){var n,i=e.fieldToColumnMapping,o=e.entitySchema.name;return!_.isEmpty(t)&&_.isString(t)?" WHERE "+t:(t&&(n=t.map((function(e){var t=i[e.attributeName],n=e.filterCondition,r=e.attributeValue,a="=";return"STRING"===e.attributeType?("STARTING_WITH"===n?(r+="%",a="like"):"ENDING_WITH"===n?(r="%"+r,a="like"):"CONTAINING"===n&&(r="%"+r+"%",a="like"),r="'"+r+"'"):"BOOLEAN"===e.attributeType&&(r=!0===r?1:0),R(o)+"."+R(t)+" "+a+" "+r}))),n&&n.length>0?" WHERE "+n.join(" AND "):"")},k=function(e,t){return t?" ORDER BY "+_.map(t.split(","),(function(t){var n=_.trim(t).split(" ");return n[0]=R(e.entitySchema.name)+"."+R(e.fieldToColumnMapping[n[0]]),n.join(" ")})).join(","):""},M=function(e){return" LIMIT "+((e=e||{}).limit||100)+" OFFSET "+(e.offset||0)},L=function(e,t){return e.columns.forEach((function(e){var n=t[e.fieldName];e.foreignRelations?e.foreignRelations.forEach((function(e){var n=null;_.forEach(e.dataMapper,(function(e,i){var r=t[i];o.isDefined(r)&&null!==r&&""!==r&&((n=n||{})[e.fieldName]=t[i]),delete t[i]})),t[e.sourceFieldName]=n})):"boolean"!==e.sqlType||_.isNil(n)||(t[e.fieldName]=1===n)})),t},F=function(e,t){var n=e[t.fieldName];return t.foreignRelations&&t.foreignRelations.some((function(t){return!(!t.targetEntity||!e[t.sourceFieldName])&&(n=e[t.sourceFieldName][t.targetFieldName],!0)})),_.isNil(n)?t.defaultValue:"boolean"===t.sqlType?!0===n?1:0:n},j=function(e,t){var n={};return e.entitySchema.columns.forEach((function(e){return n[e.name]=F(t,e)})),n},B=function(){function e(e,t,n,i,o){var r=this;this.deviceFileService=e,this.entitySchema=t,this.file=n,this.localDbManagementService=i,this.sqliteObject=o,this.fieldToColumnMapping={},this.primaryKeyField=_.find(this.entitySchema.columns,"primaryKey"),this.primaryKeyName=this.primaryKeyField?this.primaryKeyField.fieldName:void 0,this.entitySchema.columns.forEach((function(e){r.fieldToColumnMapping[e.fieldName]=e.name,e.foreignRelations&&e.foreignRelations.forEach((function(t){r.fieldToColumnMapping[t.targetPath]=e.name,_.forEach(t.dataMapper,(function(e,n){r.fieldToColumnMapping[n]=t.sourceFieldName+"."+e.name}))}))})),this.insertRecordSqlTemplate=A(this.entitySchema),this.replaceRecordSqlTemplate=C(this.entitySchema),this.deleteRecordTemplate=I(this.entitySchema),this.selectSqlTemplate=D(this.entitySchema),this.countQuery=N(this.entitySchema)}return e.prototype.add=function(e){if(this.primaryKeyName){var t=e[this.primaryKeyName];if("number"===this.primaryKeyField.sqlType&&(!o.isDefined(t)||_.isString(t)&&_.isEmpty(_.trim(t))))if("identity"===this.primaryKeyField.generatorType)e[this.primaryKeyName]=this.localDbManagementService.nextIdCount();else{var n=this.getValue(e,this.primaryKeyName);e[this.primaryKeyName]=n}}var i=j(this,e),r=this.entitySchema.columns.map((function(e){return i[e.name]}));return this.sqliteObject.executeSql(this.insertRecordSqlTemplate,r).then((function(e){return e.insertId}))},e.prototype.clear=function(){return this.sqliteObject.executeSql("DELETE FROM "+R(this.entitySchema.name))},e.prototype.create=function(){var e=this;return this.sqliteObject.executeSql(this.createTableSql(this.entitySchema)).then((function(){return e}))},e.prototype.count=function(e){var t=this.countQuery+x(this,e);return this.sqliteObject.executeSql(t).then((function(e){return e.rows.item(0).count}))},e.prototype.deserialize=function(e){return this.deserializeMapToFormData(e)},e.prototype.filter=function(e,t,n){var i=this,o=this.selectSqlTemplate;return o+=x(this,e),o+=k(this,t),o+=M(n),this.sqliteObject.executeSql(o).then((function(e){for(var t=[],n=e.rows.length,o=0;o<n;o++)t.push(L(i.entitySchema,e.rows.item(o)));return t}))},e.prototype.refresh=function(e){var t=this.primaryKeyName,n=this.getValue(e,t);return n?this.get(n):Promise.resolve(e)},e.prototype.delete=function(e){return this.sqliteObject.executeSql(this.deleteRecordTemplate,[e])},e.prototype.get=function(e){var t=[{attributeName:this.primaryKeyName,filterCondition:"=",attributeValue:e,attributeType:this.primaryKeyField.sqlType.toUpperCase()}];return this.filter(t).then((function(e){return e&&1===e.length?e[0]:void 0}))},e.prototype.getValue=function(e,t){var n=this.entitySchema.columns.find((function(e){return e.fieldName===t}));return F(e,n)},e.prototype.save=function(e){return this.saveAll([e])},e.prototype.saveAll=function(e){var t=this;e=_.filter(e,null);var n=_.map(e,(function(e){var n=j(t,e),i=t.entitySchema.columns.map((function(e){return n[e.name]}));return[t.replaceRecordSqlTemplate,i]}));return this.sqliteObject.sqlBatch(n)},e.prototype.serialize=function(e){return this.serializeFormDataToMap(e)},e.prototype.saveBlobToFile=function(e){var t=this.deviceFileService.appendToFileName(e.name),n=this.deviceFileService.getUploadDirectory();return this.file.writeFile(n,t,e).then((function(){return{name:e.name,type:e.type,lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,size:e.size,wmLocalPath:n+"/"+t}}))},e.prototype.serializeFormDataToMap=function(e){var t=this,n=_.filter(this.entitySchema.columns,{sqlType:"blob"}),i=[],o={};return e&&"function"==typeof e.append&&e.rowData?_.forEach(e.rowData,(function(e,r){e&&_.find(n,{fieldName:r})?i.push(t.saveBlobToFile(e).then((function(e){o[r]=e}))):o[r]=e})):o=e,Promise.all(i).then((function(){return o}))},e.prototype.deserializeMapToFormData=function(e){var t=new FormData,n=this.entitySchema.columns.filter((function(e){return"blob"===e.sqlType})),i=[];return _.forEach(n,(function(n){var r=e[n.fieldName];r&&r.wmLocalPath&&(i.push(o.convertToBlob(r.wmLocalPath).then((function(e){return t.append(n.fieldName,e.blob,r.name)}))),e[n.fieldName]="")})),t.append(c.SWAGGER_CONSTANTS.WM_DATA_JSON,new Blob([JSON.stringify(e)],{type:"application/json"})),Promise.all(i).then((function(){return t}))},e.prototype.createTableSql=function(e){var t=_.reduce(e.columns,(function(e,t){var n=R(t.name);return t.primaryKey&&("number"===t.sqlType&&"databaseIdentity"===t.generatorType?n+=" INTEGER PRIMARY KEY AUTOINCREMENT":n+=" PRIMARY KEY"),e?e+","+n:n}),!1);return"CREATE TABLE IF NOT EXISTS "+R(e.name)+" ("+t+")"},e}(),G=function(){this.schema={name:"",isInternal:!1,entities:new Map},this.stores=new Map,this.queries=new Map},V=function(e,t){this.name=e,this.fieldName=t,this.primaryKey=!1,this.fieldName=this.fieldName||this.name};!function(e){e.LIVE="LIVE",e.BUNDLED="BUNDLED",e.APP_START="APP_START"}(E||(E={}));var U="localDBStore.nextIdCount",W="www/metadata/app",q={name:"wavemaker",version:1,isInternal:!0,tables:[{name:"key_value",entityName:"key-value",columns:[{fieldName:"id",name:"id",generatorType:"databaseIdentity",sqlType:"number",primaryKey:!0},{fieldName:"key",name:"key"},{name:"value",fieldName:"value"}]},{name:"offlineChangeLog",entityName:"offlineChangeLog",columns:[{fieldName:"id",name:"id",generatorType:"databaseIdentity",sqlType:"number",primaryKey:!0},{name:"service",fieldName:"service"},{name:"operation",fieldName:"operation"},{name:"params",fieldName:"params"},{name:"timestamp",fieldName:"timestamp"},{name:"hasError",fieldName:"hasError"},{name:"errorMessage",fieldName:"errorMessage"}]}]},z=function(){function e(e,t,n,i,o,r,a){var s=this;this.appVersion=e,this.deviceService=t,this.deviceFileService=n,this.file=i,this.localKeyValueService=o,this.securityService=r,this.sqlite=a,this.callbacks=[],this._logSql=!1,this.nextId=1e11,this.systemProperties={USER_ID:{name:"USER_ID",value:function(){return s.securityService.getLoggedInUser().then((function(e){return e.userId}))}},USER_NAME:{name:"USER_NAME",value:function(){return s.securityService.getLoggedInUser().then((function(e){return e.userName}))}},DATE_TIME:{name:"DATE_TIME",value:function(){return moment().format("YYYY-MM-DDThh:mm:ss")}},DATE:{name:"CURRENT_DATE",value:function(){return moment().format("YYYY-MM-DD")}},TIME:{name:"TIME",value:function(){return moment().format("hh:mm:ss")}}}}return e.prototype.close=function(){var e=this;return new Promise((function(t,n){setTimeout((function(){var i=_.map(_.values(e.databases),(function(e){return e.sqliteObject.close()}));Promise.all(i).then(t,n)}),1e3)}))},e.prototype.nextIdCount=function(){return this.nextId=this.nextId+1,this.localKeyValueService.put(U,this.nextId),this.nextId},e.prototype.executeNamedQuery=function(e,t,n){var i,r,a=this;return this.databases[e]&&this.databases[e].queries[t]?(i=this.databases[e].queries[t],r=_.chain(i.params).filter((function(e){return"PROMPT"!==e.variableType})).forEach((function(e){var t=a.systemProperties[e.variableType].value(e.name,n);return o.toPromise(t).then((function(t){return n[e.name]=t}))})).value(),Promise.all(r).then((function(){return n=_.map(i.params,(function(e){return"string"==typeof n[e.name]||e.type!==o.DataType.DATETIME&&e.type!==o.DataType.LOCALDATETIME?e.type===o.DataType.BOOLEAN?a.convertBoolToInt(n[e.name]):n[e.name]:c.formatDate(n[e.name],e.type)})),a.executeSQLQuery(e,i.query,n).then((function(e){var t,n;return _.isEmpty(e.rows)||(t=e.rows[0],n=_.find(i.response.properties,(function(e){return!t.hasOwnProperty(e.fieldName)})),_.isUndefined(n)||(e.rows=_.map(e.rows,(function(e){var t={},n={};return _.forEach(e,(function(e,t){return n[t.toUpperCase()]=e})),_.forEach(i.response.properties,(function(i){var r=o.extractType(i.fieldType.typeRef),s=(o.DEFAULT_FORMATS[_.toUpper(r)],e[i.name]);!s||"string"==typeof s||r!==o.DataType.DATETIME&&r!==o.DataType.LOCALDATETIME&&r!==o.DataType.DATE||(moment(s).isValid()?e[i.name]=c.formatDate(s,r):moment(s,"HH:mm").isValid()&&(e[i.name]=moment().format("YYYY-MM-DD")+"T"+s)),r===o.DataType.BOOLEAN&&(e[i.name]=a.convertIntToBool(s)),n[i.nameInUpperCase]=e[i.name],t[i.name]=e[i.name],t[i.fieldName]=e[i.fieldName]||n[i.nameInUpperCase]})),t})))),e}))}))):Promise.reject("Query by name ' "+t+" ' Not Found")},e.prototype.exportDB=function(){var e=this;return new Promise((function(t,n){var i,r="offline_temp_"+_.now(),a=cordova.file.cacheDirectory+r+"/",s={app:null,OS:"",createdOn:0};i=o.isIos()?cordova.file.documentsDirectory:cordova.file.externalRootDirectory+"Download/",e.file.createDir(cordova.file.cacheDirectory,r,!1).then((function(){return e.file.copyDir(e.dbInstallParentDirectory,e.dbInstallDirectoryName,a,"databases").then((function(){return e.getAppInfo()})).then((function(e){return s.app=e,o.isIos()?s.OS="IOS":o.isAndroid()&&(s.OS="ANDROID"),s.createdOn=_.now(),s})).then((function(){return o.executePromiseChain(e.getCallbacksFor("preExport"),[a,s])})).then((function(){return e.file.writeFile(a,"META.json",JSON.stringify(s))}))})).then((function(){var t=s.app.name;return t=t.replace(/\s+/g,"_"),e.deviceFileService.newFileName(i,t+"_offline_data.zip").then((function(e){return new Promise((function(t,n){Zeep.zip({from:a,to:i+e},(function(){return t(i+e)}),n)}))}))})).then(t,n).catch(o.noop).then((function(){return e.deviceFileService.removeDir(cordova.file.cacheDirectory+r)}))}))},e.prototype.getStore=function(e,t){var n=this;return new Promise((function(i,o){n.databases[e]&&i(n.databases[e].stores[t]),o("store with name'"+t+"' in datamodel '"+e+"' is not found")}))},e.prototype.importDB=function(e,t){var n=this;return new Promise((function(i,r){var a,s="offline_temp_"+_.now(),l=cordova.file.cacheDirectory+s+"/";n.file.createDir(cordova.file.cacheDirectory,s,!1).then((function(){return new Promise((function(t,n){Zeep.unzip({from:e,to:l},t,n)}))})).then((function(){return n.file.readAsText(l,"META.json").then((function(e){return a=JSON.parse(e),n.getAppInfo()})).then((function(e){return a.app?a.app.packageName!==e.packageName?Promise.reject("database zip of app with same package name can only be imported"):void 0:Promise.reject("meta information is not found in zip")}))})).then((function(){var e;return n.close().then((function(){if(t)return n.exportDB().then((function(t){return e=t}))})).then((function(){return n.deviceFileService.removeDir(n.dbInstallDirectory)})).then((function(){return n.file.copyDir(l,"databases",n.dbInstallParentDirectory,n.dbInstallDirectoryName)})).then((function(){return n.databases=null,n.loadDatabases()})).then((function(){return o.executePromiseChain(n.getCallbacksFor("postImport"),[l,a])})).then((function(){if(e)return n.deviceFileService.removeFile(e)}),(function(t){return e?n.importDB(e,!1).then((function(){return n.deviceFileService.removeFile(e),Promise.reject(t)})):Promise.reject(t)}))})).then(i,r).catch(o.noop).then((function(){return n.deviceFileService.removeDir(cordova.file.cacheDirectory+s)}))}))},e.prototype.isOperationAllowed=function(e,t,n){return this.getStore(e,t).then((function(e){return!!e&&("READ"===n?e.entitySchema.pushConfig.readEnabled:"INSERT"===n?e.entitySchema.pushConfig.insertEnabled:"UPDATE"===n?e.entitySchema.pushConfig.updateEnabled:"DELETE"===n&&e.entitySchema.pushConfig.deleteEnabled)})).catch((function(){return!1}))},e.prototype.loadDatabases=function(){var e=this,t=!1;return this.databases?Promise.resolve(this.databases):(o.isIos()?(this.dbInstallDirectoryName="LocalDatabase",this.dbInstallParentDirectory=cordova.file.applicationStorageDirectory+"Library/"):(this.dbInstallDirectoryName="databases",this.dbInstallParentDirectory=cordova.file.applicationStorageDirectory),this.dbInstallDirectory=this.dbInstallParentDirectory+this.dbInstallDirectoryName,this.databases=new Map,this.setUpDatabases().then((function(e){return t=e})).then((function(){return e.loadDBSchemas()})).then((function(t){return e.loadNamedQueries(t)})).then((function(t){return e.loadOfflineConfig(t)})).then((function(t){return Promise.all(_.map(t,(function(t){return e.openDatabase(t).then((function(n){e.databases[t.schema.name]=n}))})))})).then((function(){return e.getStore("wavemaker","key-value").then((function(t){return e.localKeyValueService.init(t),e.localKeyValueService.get(U).then((function(t){e.nextId=t||e.nextId}))}))})).then((function(){return t?e.normalizeData().then((function(){return e.disableForeignKeys()})).then((function(){return e.deviceService.getAppBuildTime()})).then((function(t){return o.executePromiseChain(_.map(e.callbacks,"onDbCreate"),[{databases:e.databases,dbCreatedOn:_.now(),dbSeedCreatedOn:t}])})).then((function(){return e.databases})):e.databases})))},e.prototype.registerCallback=function(e){this.callbacks.push(e)},e.prototype.setLogSQl=function(e){this._logSql=e},e.prototype.cleanAndCopyDatabases=function(){var e=this,t=cordova.file.applicationDirectory+W;return this.file.createDir(this.dbInstallParentDirectory,this.dbInstallDirectoryName,!1).catch(o.noop).then((function(){return e.deviceFileService.listFiles(e.dbInstallDirectory,/.+\.db$/)})).then((function(t){if(t&&t.length>0)return Promise.all(t.map((function(t){if("wavemaker.db"!==t.name)return e.file.removeFile(e.dbInstallDirectory,t.name)})))})).then((function(){return e.deviceFileService.listFiles(t,/.+\.db$/)})).then((function(n){if(n&&n.length>0)return e.file.createDir(e.dbInstallParentDirectory,e.dbInstallDirectoryName,!1).catch(o.noop).then((function(){return Promise.all(n.map((function(n){return e.file.copyFile(t,n.name,e.dbInstallDirectory,n.name)})))}))}))},e.prototype.compactEntitySchema=function(e,t,n){var i=n[t.entityName];return i.entityName=t.entityName,i.name=t.name,i.columns=[],t.columns.forEach((function(e){var t=e.columnValue?e.columnValue.defaultValue:"",n=e.sqlType;t="number"!==n||e.primaryKey?"boolean"===n?_.isEmpty(t)?null:"true"===t?1:0:_.isEmpty(t)?null:t:_.isEmpty(t)?null:_.parseInt(t),i.columns.push({name:e.name,fieldName:e.fieldName,generatorType:e.generatorType,sqlType:e.sqlType,primaryKey:e.primaryKey,defaultValue:t})})),_.forEach(t.relations,(function(t){var n,o,r,a,s;if(("ManyToOne"===t.cardinality||"OneToOne"===t.cardinality)&&(o=_.find(e.tables,(function(e){return e.name===t.targetTable})),s=t.mappings[0],o)){o=o.entityName,a=s.sourceColumn,r=i.columns.find((function(e){return e.name===a})),n=e.tables.find((function(e){return e.name===t.targetTable}));var l={sourceFieldName:t.fieldName,targetEntity:o,targetTable:t.targetTable,targetColumn:s.targetColumn,targetPath:"",dataMapper:[],targetFieldName:n.columns.find((function(e){return e.name===s.targetColumn})).fieldName};l.targetPath=l.sourceFieldName+"."+l.targetFieldName,l.dataMapper=_.chain(n.columns).keyBy((function(e){return l.sourceFieldName+"."+e.fieldName})).mapValues((function(e){return new V(e.name,e.fieldName)})).value(),r.foreignRelations=r.foreignRelations||[],r.foreignRelations.push(l)}})),i},e.prototype.compactQueries=function(e){var t=this,n=new Map;return _.forEach(e.queries,(function(e){var i,o;e.nativeSql&&"SELECT"===e.type&&(i=_.isEmpty(e.offlineQueryString)?e.queryString:e.offlineQueryString,(o=_.map(t.extractQueryParams(i),(function(t){var n=_.find(e.parameters,{name:t});return{name:n.name,type:n.type,variableType:n.variableType}}))).forEach((function(e){return i=_.replace(i,":"+e.name,"?")})),n[e.name]={name:e.name,query:i,params:o,response:{properties:_.map(e.response.properties,(function(e){return e.nameInUpperCase=e.name.toUpperCase(),e}))}})})),n},e.prototype.compactSchema=function(e){var t=this,n=new G,i=new Map;return e.tables.forEach((function(e){i[e.entityName]={}})),e.tables.forEach((function(n){t.compactEntitySchema(e,n,i)})),n.schema.name=e.name,n.schema.isInternal=e.isInternal,n.schema.entities=i,n},e.prototype.convertBoolToInt=function(e){return"true"===_.toString(e)?1:0},e.prototype.convertIntToBool=function(e){return!!e},e.prototype.disableForeignKeys=function(){var e=this;return Promise.all(_.map(this.databases,(function(t){return e.executeSQLQuery(t.schema.name,"PRAGMA foreign_keys = OFF")})))},e.prototype.executeSQLQuery=function(e,t,n,i){var o=this.databases[e];return o?o.sqliteObject.executeSql(t,n,i).then((function(e){for(var t=[],n=e.rows,i=0;i<n.length;i++)t.push(n.item(i));return{rowsAffected:e.rowsAffected,rows:t}})):Promise.reject("No Database with name "+e+" found")},e.prototype.extractQueryParams=function(e){var t;return(t=e.match(/[^"'\w\\]:\s*\w+\s*/g)||[]).length?t.map((function(e){return/[=|\W]/g.test(e)?e.replace(/\W/g,"").trim():e.trim()})):null},e.prototype.getAppInfo=function(){var e=this,t={name:"",packageName:"",versionNumber:"",versionCode:null};return this.appVersion.getPackageName().then((function(n){return t.packageName=n,e.appVersion.getAppName()})).then((function(n){return t.name=n,e.appVersion.getVersionNumber()})).then((function(n){return t.versionNumber=n,e.appVersion.getVersionCode()})).then((function(e){return t.versionCode=e,t}))},e.prototype.getCallbacksFor=function(e){return this.callbacks.map((function(t){return t[e]?t[e].bind(t):null}))},e.prototype.getMetaInfo=function(e){var t=cordova.file.applicationDirectory+W+"/";return this.deviceFileService.listFiles(t,e).then((function(e){return Promise.all(_.map(e,(function(e){return new Promise((function(n,i){$.getJSON(o.transformFileURI(t)+e.name,(function(e){return n(e)}))}))})))}))},e.prototype.isBundled=function(e,t){return this.getStore(e,t).then((function(e){return e.entitySchema.pullConfig.pullType===E.BUNDLED}))},e.prototype.loadDBSchemas=function(){var e=this;return this.getMetaInfo(/.+_dataModel\.json$/).then((function(t){var n=new Map;return(t=o.isArray(t)?t:[t]).push(q),t.map((function(t){return e.compactSchema(t)})).forEach((function(e){n[e.schema.name]=e})),n}))},e.prototype.loadNamedQueries=function(e){var t=this;return this.getMetaInfo(/.+_query\.json$/).then((function(n){return(n=_.isArray(n)?n:[n]).map((function(n){return e[n.name].queries=t.compactQueries(n)})),e}))},e.prototype.loadOfflineConfig=function(e){return this.getMetaInfo(/.+_offline\.json$/).then((function(t){return _.forEach(t,(function(t){_.forEach(t.entities,(function(n){var i=_.find(e[t.name].schema.entities,(function(e){return e.name===n.name}));_.assignIn(i,n)}))})),e}))},e.prototype.logSql=function(e){var t=this,n=console,i=e.executeSql;e.executeSql=function(o,r,a){var s=_.now();return i.call(e,o,r).then((function(e){if(a||t._logSql){for(var i=[],l=e.rows.length,c=0;c<l;c++)i.push(e.rows.item(c));n.debug('SQL "%s" with params %O took [%d ms]. And the result is %O',o,r,_.now()-s,i)}return e}),(function(e){return n.error('SQL "%s" with params %O failed with error message %s',o,r,e.message),Promise.reject(e)}))}},e.prototype.normalizeBooleanData=function(e,t,n){var i=this,o="update "+R(t)+" set "+R(n)+" = 1 where "+R(n)+" = 'true'",r="update "+R(t)+" set "+R(n)+" = 0\n where "+R(n)+" is not null and "+R(n)+" != 1";return this.executeSQLQuery(e,o).then((function(){return i.executeSQLQuery(e,r)}))},e.prototype.normalizeData=function(){var e=this;return Promise.all(_.map(this.databases,(function(t){return Promise.all(_.map(t.schema.entities,(function(n){return Promise.all(_.map(n.columns,(function(i){if("boolean"===i.sqlType)return e.normalizeBooleanData(t.schema.name,n.name,i.name)})))})))})))},e.prototype.openDatabase=function(e){var t=this;return this.sqlite.create({name:e.schema.name+".db",location:"default"}).then((function(n){e.sqliteObject=n,t.logSql(n);var i=_.map(e.schema.entities,(function(e){return new B(t.deviceFileService,e,t.file,t,n).create()}));return Promise.all(i).then((function(t){return _.forEach(t,(function(t){e.stores[t.entitySchema.entityName]=t})),e}))}))},e.prototype.setUpDatabases=function(){var e=this;return this.deviceService.getAppBuildTime().then((function(t){var n=e.deviceService.getEntry("database")||{};return(!n.lastBuildTime||n.lastBuildTime!==t)&&e.cleanAndCopyDatabases().then((function(){return n.lastBuildTime=t,e.deviceService.storeEntry("database",n)})).then((function(){return!0}))}))},e}();z.SERVICE_NAME="LocalDBManagementService",z.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new z(g.\u0275\u0275inject(w.AppVersion),g.\u0275\u0275inject(y.DeviceService),g.\u0275\u0275inject(y.DeviceFileService),g.\u0275\u0275inject(P.File),g.\u0275\u0275inject(S),g.\u0275\u0275inject(b.SecurityService),g.\u0275\u0275inject(O.SQLite))},token:z,providedIn:"root"}),z.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],z.ctorParameters=function(){return[{type:s.AppVersion},{type:r.DeviceService},{type:r.DeviceFileService},{type:i.File},{type:S},{type:a.SecurityService},{type:l.SQLite}]};var H=function(){},Y="changeLogService.flushContext",K="changeLogService.lastPushInfo",Q=function(){function e(e,t,n,i){this.localDBManagementService=e,this.localKeyValueService=t,this.pushService=n,this.networkService=i,this.workers=[],this.currentPushInfo={},this.addWorker(new X(this,this.localKeyValueService,this.currentPushInfo))}return e.prototype.add=function(e,t,n){var i=this,r={service:e,operation:t,params:n,hasError:0};return o.executePromiseChain(this.getWorkers("transformParamsToMap"),[r]).then((function(){return o.executePromiseChain(i.getWorkers("onAddCall"),[r])})).then((function(){return r.params=JSON.stringify(r.params),i.getStore().then((function(e){return e.add(r)})).then(o.noop)}))},e.prototype.addWorker=function(e){this.workers.push(e)},e.prototype.clearLog=function(){return this.getStore().then((function(e){return e.clear()}))},e.prototype.flush=function(e){var t,n=this;return this.deferredFlush||(this.deferredFlush=o.getAbortableDefer(),this.createContext().then((function(e){return n.flushContext=e,o.executePromiseChain(n.getWorkers("preFlush"),[n.flushContext])})).then((function(){return t=n._flush(e),n.deferredFlush.onAbort=function(){return t.abort()},t})).catch(o.noop).then((function(){Promise.resolve().then((function(){if(n.currentPushInfo.totalTaskCount===n.currentPushInfo.completedTaskCount)return n.flushContext.clear().then((function(){return n.flushContext=null}))})).then((function(){e.complete(),n.currentPushInfo.failedTaskCount>0?n.deferredFlush.reject(n.currentPushInfo):n.deferredFlush.resolve(n.currentPushInfo),n.deferredFlush=null})).then((function(){return o.executePromiseChain(n.getWorkers("postFlush"),[n.currentPushInfo,n.flushContext])}))}))),this.deferredFlush.promise},e.prototype.getChanges=function(){return this.getStore().then((function(e){return e.filter(void 0,"id",{offset:0,limit:500})})).then((function(e){return e.forEach((function(e){e.params=JSON.parse(e.params)})),e}))},e.prototype.getErrors=function(){return this.getStore().then((function(e){return e.filter([{attributeName:"hasError",attributeValue:1,attributeType:"NUMBER",filterCondition:"EQUALS"}])}))},e.prototype.getLastPushInfo=function(){return this.localKeyValueService.get(K).then((function(e){return o.isString(e.startTime)&&(e.startTime=new Date(e.startTime)),o.isString(e.endTime)&&(e.endTime=new Date(e.endTime)),e}))},e.prototype.getLogLength=function(){return this.getStore().then((function(e){return e.count([{attributeName:"hasError",attributeValue:0,attributeType:"NUMBER",filterCondition:"EQUALS"}])}))},e.prototype.getStore=function(){return this.localDBManagementService.getStore("wavemaker","offlineChangeLog")},e.prototype.isFlushInProgress=function(){return!(_.isUndefined(this.deferredFlush)||_.isNull(this.deferredFlush))},e.prototype.stop=function(){var e=this;return new Promise((function(t){e.deferredFlush?(e.deferredFlush.promise.catch().then(t),e.deferredFlush.promise.abort()):t()}))},e.prototype.createContext=function(){var e=this;return this.localKeyValueService.get(Y).then((function(t){return t=t||{},{clear:function(){return t={},e.localKeyValueService.remove(Y)},get:function(e){var n=t[e];return n||(n={},t[e]=n),n},save:function(){return e.localKeyValueService.put(Y,t)}}}))},e.prototype._flush=function(e,t){var n=this;return(t=t||o.getAbortableDefer()).isAborted?Promise.resolve():(this.getNextChange().then((function(e){if(e)return e.params=JSON.parse(e.params),n.flushChange(e)})).then((function(i){if(e.next(n.currentPushInfo),i)return n.getStore().then((function(e){return e.delete(i.id)})).then((function(){return n._flush(e,t)}));t.resolve()}),(function(i){if(n.networkService.isConnected())i.hasError=1,i.params=JSON.stringify(i.params),n.getStore().then((function(e){return e.save(i)})).then((function(){return n._flush(e,t)}));else{var o=n.networkService.onConnect();t.promise.catch((function(){o&&o.abort()})),o.then((function(){n._flush(e,t),o=null}))}})),t.promise)},e.prototype.flushChange=function(e){var t=this,n=this;return o.executePromiseChain(this.getWorkers("preCall"),[e]).then((function(){return e.hasError?Promise.reject(e.errorMessage):""})).then((function(){return o.executePromiseChain(t.getWorkers("transformParamsFromMap"),[e])})).then((function(){return t.pushService.push(e)})).then((function(){return o.executePromiseChain(_.reverse(n.getWorkers("postCallSuccess")),[e,arguments]).then((function(){return e}))})).catch((function(){return n.networkService.isConnected()?o.executePromiseChain(_.reverse(n.getWorkers("postCallError")),[e,arguments]).catch(o.noop).then((function(){return Promise.reject(e)})):Promise.reject(e)}))},e.prototype.getNextChange=function(){var e=[{attributeName:"hasError",attributeValue:0,attributeType:"NUMBER",filterCondition:"EQUALS"}];return this.getStore().then((function(t){return t.filter(e,"id",{offset:0,limit:1})})).then((function(e){return e&&e[0]}))},e.prototype.getWorkers=function(e){return _.map(this.workers,(function(t){return t[e]&&t[e].bind(t)}))},e}();Q.SERVICE_NAME="ChangeLogService",Q.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new Q(g.\u0275\u0275inject(z),g.\u0275\u0275inject(S),g.\u0275\u0275inject(H),g.\u0275\u0275inject(y.NetworkService))},token:Q,providedIn:"root"}),Q.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Q.ctorParameters=function(){return[{type:z},{type:S},{type:H},{type:r.NetworkService}]};var X=function(){function e(e,t,n){this.changeLogService=e,this.localKeyValueService=t,this.pushInfo=n,this.logger=window.console}return e.prototype.onAddCall=function(e){this.logger.debug("Added the following call %o to log.",e)},e.prototype.preFlush=function(e){var t=this;return this.pushInfo.totalTaskCount=0,this.pushInfo.successfulTaskCount=0,this.pushInfo.failedTaskCount=0,this.pushInfo.completedTaskCount=0,this.pushInfo.inProgress=!0,this.pushInfo.startTime=new Date,this.flushContext=e,this.logger.debug("Starting flush"),this.changeLogService.getStore().then((function(e){return e.count([{attributeName:"hasError",attributeValue:0,attributeType:"NUMBER",filterCondition:"EQUALS"}])})).then((function(e){return t.pushInfo.totalTaskCount=e}))},e.prototype.postFlush=function(e,t){this.logger.debug("flush completed. {Success : %i , Error : %i , completed : %i, total : %i }.",this.pushInfo.successfulTaskCount,this.pushInfo.failedTaskCount,this.pushInfo.completedTaskCount,this.pushInfo.totalTaskCount),this.pushInfo.inProgress=!1,this.pushInfo.endTime=new Date,this.localKeyValueService.put(K,this.pushInfo),this.flushContext=null},e.prototype.preCall=function(e){this.logger.debug("%i. Invoking call %o",1+this.pushInfo.completedTaskCount,e)},e.prototype.postCallError=function(e,t){return this.pushInfo.completedTaskCount++,this.pushInfo.failedTaskCount++,this.logger.error("call failed with the response %o.",t),this.flushContext.save()},e.prototype.postCallSuccess=function(e,t){return this.pushInfo.completedTaskCount++,this.pushInfo.successfulTaskCount++,this.logger.debug("call returned the following response %o.",t),this.flushContext.save()},e}(),J=function(){function e(e){this.localDBManagementService=e,this.searchTableData=this.readTableData.bind(this),this.searchTableDataWithQuery=this.readTableData.bind(this),this.getDistinctDataByFields=this.readTableData.bind(this)}return e.prototype.getStore=function(e){return this.localDBManagementService.getStore(e.dataModelName,e.entityName)},e.prototype.insertTableData=function(e,t,n,i){void 0===i&&(i={}),this.getStore(e).then((function(n){var o=n.primaryKeyField&&"identity"===n.primaryKeyField.generatorType;return!1!==_.get(i,"resetPrimaryKey")&&o&&e.data[n.primaryKeyName]&&delete e.data[n.primaryKeyName],n.add(e.data).then((function(){n.refresh(e.data).then(t)}))})).catch(n)},e.prototype.insertMultiPartTableData=function(e,t,n,i){var o=this;void 0===i&&(i={}),this.getStore(e).then((function(r){r.serialize(e.data).then((function(r){e.data=r,o.insertTableData(e,t,n,i)}))})).catch(n)},e.prototype.updateTableData=function(e,t,n){this.getStore(e).then((function(n){return n.save(e.data).then((function(){n.refresh(e.data).then(t)}))})).catch(n)},e.prototype.updateMultiPartTableData=function(e,t,n){var i=e.data&&e.data.rowData||e.data;this.getStore(e).then((function(e){return e.save(i)})).then((function(){t&&t(i)})).catch(n)},e.prototype.deleteTableData=function(e,t,n){this.getStore(e).then((function(n){var i=n.primaryKeyField,o=e[i.fieldName]||e[i.name]||e.data&&e.data[i.fieldName]||e.id;n.delete(o).then(t)})).catch(n)},e.prototype.readTableData=function(e,t,n){var i=this;this.getStore(e).then((function(n){var o=e.filter((function(e,t){i.convertFieldNameToColumnName(n,e,t)}),!0);return o=o.replace(/wm_bool\('true'\)/g,1).replace(/wm_bool\('false'\)/g,0),n.count(o).then((function(i){var r=e.sort.split("=")[1];return n.filter(o,r,{offset:(e.page-1)*e.size,limit:e.size}).then((function(n){var o=Math.ceil(i/e.size);t({content:n,first:1===e.page,last:e.page===o,number:e.page-1,numberOfElements:n.length,size:e.size,sort:{sorted:!!r,unsorted:!r},totalElements:i,totalPages:o})}))}))})).catch(n)},e.prototype.escapeName=function(e){return e?'"'+(e=e.replace(/"/g,'""')).replace(/\./g,'"."')+'"':e},e.prototype.getColumnName=function(e,t){if(e.fieldToColumnMapping[t]){var n=this.escapeName(e.fieldToColumnMapping[t]);return n.indexOf(".")<0?this.escapeName(e.entitySchema.name)+"."+n:n}return t},e.prototype.convertFieldNameToColumnName=function(e,t,n){var i=this;_.forEach(t.rules,(function(t){t.rules?i.convertFieldNameToColumnName(e,t):t.target=i.getColumnName(e,t.target)})),n&&n.filterFields&&(n.filterFields=_.mapKeys(n.filterFields,(function(t,n){return i.getColumnName(e,n)})))},e}();J.SERVICE_NAME="LocalDbService",J.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new J(g.\u0275\u0275inject(z))},token:J,providedIn:"root"}),J.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],J.ctorParameters=function(){return[{type:z}]};var Z=function(){function e(){this.logger=window.console}return e.prototype.preFlush=function(e){this.fileStore=e.get("offlineFileUpload")},e.prototype.preCall=function(e){var t=this;"DatabaseService"===e.service&&(e.params.data=_.mapValues(e.params.data,(function(e){var n=t.fileStore[e];return n?(t.logger.debug("swapped file path from %s -> %s",e,n),n):e})))},e.prototype.postCallSuccess=function(e,t){if("OfflineFileUploadService"===e.service&&"uploadToServer"===e.operation){var n=JSON.parse(t[0].text)[0];this.fileStore[e.params.file]=n.path,this.fileStore[e.params.file+"?inline"]=n.inlinePath}},e}(),ee=function(){function e(e,t,n,i){this.changeLogService=e,this.deviceFileService=t,this.localDBManagementService=n,this.file=i}return e.prototype.preExport=function(e,t){var n=this.deviceFileService.getUploadDirectory(),i=n.lastIndexOf("/"),o=n.substring(0,i+1),r=n.substring(i+1);return t.uploadDir=n,this.file.copyDir(o,r,e,"uploads")},e.prototype.postImport=function(e,t){var n=this,i=this.deviceFileService.getUploadDirectory(),r=i.lastIndexOf("/"),a=i.substring(0,r+1),s=i.substring(r+1);return this.uploadDir=i,this.file.checkDir(e,"uploads").then((function(){return n.deviceFileService.removeDir(i).then((function(){return n.file.copyDir(e,"uploads",a,s)})).then((function(){return n.updateChanges(t)}))}),o.noop)},e.prototype.getChanges=function(e,t){return this.changeLogService.getStore().then((function(n){return n.filter([],"id",{offset:(e-1)*t,limit:t})}))},e.prototype.updateDBChange=function(e,t,n){var i=this,o={},r=e.params.entityName,a=e.params.dataModelName;e.params.data=_.mapValues(e.params.data,(function(e,i){var r=e,a=!1;return _.isString(e)?(r=_.replace(e,t,n),a=!_.isEqual(r,e)):_.isObject(e)&&e.wmLocalPath&&(r=_.replace(e.wmLocalPath,t,n),a=!_.isEqual(r,e.wmLocalPath)),a&&(o[i]=r),r})),_.isEmpty(o)||this.localDBManagementService.getStore(a,r).then((function(t){if(t.primaryKeyField&&"identity"===t.primaryKeyField.generatorType){var n=t.primaryKeyName,i=e.params.data[n];return t.get(i).then((function(e){return t.save(_.assignIn(e,o))}))}})).then((function(){return e.params=JSON.stringify(e.params),i.changeLogService.getStore().then((function(t){return t.save(e)}))}))},e.prototype.updateChange=function(e,t){return e.params=JSON.parse(e.params),"OfflineFileUploadService"===e.service&&"uploadToServer"===e.operation?(e.params.file=_.replace(e.params.file,t.uploadDir,this.uploadDir),e.params=JSON.stringify(e.params),this.changeLogService.getStore().then((function(t){return t.save(e)}))):"DatabaseService"===e.service?this.updateDBChange(e,t.uploadDir,this.uploadDir):void 0},e.prototype.updateChanges=function(e,t){var n=this;void 0===t&&(t=1);return this.getChanges(t,10).then((function(t){if(t&&t.length>0)return Promise.all(t.map((function(t){return n.updateChange(t,e)})))})).then((function(i){if(i&&10===i.length)return n.updateChanges(e,t+1)}))},e}(),te=function(){function e(e){this.localDBManagementService=e}return e.prototype.preFlush=function(e){this.errorStore=e.get("errorBlockerStore")},e.prototype.preCall=function(e){var t=this;if(e&&"DatabaseService"===e.service){var n=e.params.entityName,i=e.params.dataModelName;switch(e.operation){case"insertTableData":case"insertMultiPartTableData":case"updateTableData":case"updateMultiPartTableData":return this.localDBManagementService.getStore(i,n).then((function(o){t.blockCall(o,e,i,n,e.params.data)}));case"deleteTableData":return this.localDBManagementService.getStore(i,n).then((function(o){t.blockCall(o,e,i,n,e.params)}))}}},e.prototype.postCallSuccess=function(e){var t=this;if(e&&"DatabaseService"===e.service){var n=e.params.entityName,i=e.params.dataModelName;return this.localDBManagementService.getStore(i,n).then((function(o){var r=e.dataLocalId||e.params.data[o.primaryKeyName];_.isUndefined(r)||_.isNull(r)||t.removeError(i,n,r)}))}},e.prototype.postCallError=function(e){var t=this;if(e&&"DatabaseService"===e.service){var n=e.params.entityName,i=e.params.dataModelName;return this.localDBManagementService.getStore(i,n).then((function(o){var r=e.dataLocalId||e.params.data&&e.params.data[o.primaryKeyName]||e.params[o.primaryKeyName]||e.params.id;_.isUndefined(r)||_.isNull(r)||t.recordError(i,n,r)}))}},e.prototype.blockCall=function(e,t,n,i,o){var r=this;0===t.hasError&&(this.checkForPreviousError(e,t,n,i,o),e.entitySchema.columns.forEach((function(i){i.foreignRelations&&i.foreignRelations.some((function(a){return o[a.sourceFieldName]?r.blockCall(e,t,n,a.targetEntity,o[a.sourceFieldName]):o[i.fieldName]&&r.checkForPreviousError(e,t,n,a.targetEntity,o,i.fieldName),1===t.hasError}))})))},e.prototype.checkForPreviousError=function(e,t,n,i,o,r){var a=r||e.primaryKeyName;this.hasError(n,i,o[a])&&(t.hasError=1,t.errorMessage="Blocked call due to error in previous call of entity [ "+i+" ] with id [ "+o[a]+" ]")},e.prototype.hasError=function(e,t,n){return!!(this.errorStore[e]&&this.errorStore[e][t]&&this.errorStore[e][t][n])},e.prototype.removeError=function(e,t,n){this.errorStore[e]&&this.errorStore[e][t]&&this.errorStore[e][t][n]&&delete this.errorStore[e][t][n]},e.prototype.recordError=function(e,t,n){this.errorStore[e]=this.errorStore[e]||{},this.errorStore[e][t]=this.errorStore[e][t]||{},this.errorStore[e][t][n]=!0},e}(),ne=function(){function e(e){this.localDBManagementService=e,this.logger=window.console}return e.prototype.preFlush=function(e){this.idStore=e.get("idConflictResolution")},e.prototype.preCall=function(e){var t=this;if(e&&"DatabaseService"===e.service){var n=e.params.entityName,i=e.params.dataModelName;switch(e.operation){case"insertTableData":case"insertMultiPartTableData":return e.params.skipLocalDB=!0,this.localDBManagementService.getStore(i,n).then((function(r){var a=r.primaryKeyName;return a&&(t.transactionLocalId=e.params.data[a],e.dataLocalId=t.transactionLocalId),t.exchangeIds(r,i,n,e.params.data).then((function(){if(r.primaryKeyField&&"identity"===r.primaryKeyField.generatorType)delete e.params.data[a];else{var s=r.getValue(e.params.data,r.primaryKeyName);o.isDefined(s)&&(e.params.data[a]=s,null!==t.transactionLocalId&&t.pushIdToStore(i,n,t.transactionLocalId,s)),t.transactionLocalId=null}}))}));case"updateTableData":case"updateMultiPartTableData":case"deleteTableData":return this.localDBManagementService.getStore(i,n).then((function(o){if(t.exchangeId(o,i,n,e.params,"id"),e.params.data)return t.exchangeIds(o,i,n,e.params.data)}))}}},e.prototype.postCallSuccess=function(e,t){var n=this;if(e&&"DatabaseService"===e.service&&("insertTableData"===e.operation||"insertMultiPartTableData"===e.operation)&&this.transactionLocalId){var i=t[0].body,r=e.params.entityName,a=e.params.dataModelName;return this.localDBManagementService.getStore(a,r).then((function(e){return n.pushIdToStore(a,r,n.transactionLocalId,i[e.primaryKeyName]),e.delete(n.transactionLocalId).catch(o.noop).then((function(){return n.transactionLocalId=null,e.save(i)}))}))}},e.prototype.postCallError=function(e){var t=this;if(e&&"DatabaseService"===e.service&&("insertTableData"===e.operation||"insertMultiPartTableData"===e.operation)&&this.transactionLocalId){var n=e.params.entityName,i=e.params.dataModelName;return this.localDBManagementService.getStore(i,n).then((function(n){e.params.data[n.primaryKeyName]=t.transactionLocalId}))}},e.prototype.getEntityIdStore=function(e,t){return this.idStore[e]=this.idStore[e]||{},this.idStore[e][t]=this.idStore[e][t]||{},this.idStore[e][t]},e.prototype.pushIdToStore=function(e,t,n,i){n!==i&&(this.getEntityIdStore(e,t)[n]=i,this.logger.debug("Conflict found for entity (%s) with local id (%i) and remote Id (%i)",t,n,i))},e.prototype.logResolution=function(e,t,n){this.logger.debug("Conflict resolved found for entity (%s) with local id (%i) and remote Id (%i)",e,t,n)},e.prototype.exchangeId=function(e,t,n,i,o){var r=o||e.primaryKeyName,a=this.getEntityIdStore(t,n);if(i&&r){for(var s=i[r],l=s;a[l];)l=a[l];l!==s&&(i[r]=l,this.logResolution(n,s,l))}},e.prototype.exchangeIds=function(e,t,n,i){var o=this;this.exchangeId(e,t,n,i);var r=[];return e.entitySchema.columns.forEach((function(n){n.foreignRelations&&n.foreignRelations.forEach((function(a){i[n.fieldName]&&o.exchangeId(e,t,a.targetEntity,i,n.fieldName),i[a.sourceFieldName]&&r.push(o.localDBManagementService.getStore(t,a.targetEntity).then((function(e){return o.exchangeIds(e,t,a.targetEntity,i[a.sourceFieldName])})))}))})),Promise.all(r)},e}();ne.decorators=[{type:t.Injectable}],ne.ctorParameters=function(){return[{type:z}]};var ie=function(){function e(e,t){this.deviceFileService=e,this.localDBManagementService=t}return e.prototype.postCallSuccess=function(e){var t=this;if(e&&"DatabaseService"===e.service)switch(e.operation){case"insertMultiPartTableData":case"updateMultiPartTableData":_.forEach(e.params.data,(function(e){_.isObject(e)&&e.wmLocalPath&&t.deviceFileService.removeFile(e.wmLocalPath)}))}},e.prototype.transformParamsFromMap=function(e){if(e&&"DatabaseService"===e.service)switch(e.operation){case"insertMultiPartTableData":case"updateMultiPartTableData":return this.localDBManagementService.getStore(e.params.dataModelName,e.params.entityName).then((function(t){return t.deserialize(e.params.data).then((function(t){e.params.data=t}))}))}},e.prototype.transformParamsToMap=function(e){if(e&&"DatabaseService"===e.service)switch(e.operation){case"insertMultiPartTableData":case"updateMultiPartTableData":return this.localDBManagementService.getStore(e.params.dataModelName,e.params.entityName).then((function(t){return t.serialize(e.params.data).then((function(n){return e.params.data=n,t.save(_.mapValues(n,(function(e){return _.isObject(e)&&e.wmLocalPath||e}))),n}))}))}},e}(),oe=[{name:"insertTableData",type:"INSERT"},{name:"insertMultiPartTableData",type:"INSERT"},{name:"updateTableData",type:"UPDATE"},{name:"updateMultiPartTableData",type:"UPDATE"},{name:"deleteTableData",type:"DELETE"},{name:"readTableData",type:"READ",saveResponse:!0},{name:"searchTableData",type:"READ",saveResponse:!0},{name:"searchTableDataWithQuery",type:"READ",saveResponse:!0},{name:"getDistinctDataByFields",type:"READ",saveResponse:!1}],re=!1,ae=function(){function e(e,t,n,i,o){this.changeLogService=e,this.httpService=t,this.localDBManagementService=n,this.networkService=i,this.offlineDBService=o,this.onlineDBService=m.LVService}return e.prototype.add=function(){var e=this;if(!re){re=!0;var t=this.httpService.sendCallAsObservable;t&&(this.httpService.sendCallAsObservable=function(n,i){!i&&_.get(n,"url")&&(i={url:n.url});var o=_.clone(i.url);i=_.extend(i,n);var r=_.find(oe,{name:_.get(i,"operation")});return e.networkService.isConnected()||i.onlyOnline||!r||!i.dataModelName?h.from(e.remoteDBcall(r,t,i)):h.from(e.localDBManagementService.isOperationAllowed(i.dataModelName,i.entityName,r.type).then((function(n){var a;return n?Promise.resolve().then((function(){if(!i.isCascadingStopped&&("insertTableData"===r.name||"updateTableData"===r.name))return e.prepareToCascade(i).then((function(e){return a=e}))})).then((function(){return new Promise((function(t,n){e.localDBcall(r,i,t,n,o)}))})).then((function(t){return a?a.cascade().then((function(){return e.getStore(i).then((function(e){return e.refresh(t.body)})).then((function(e){return t&&t.body&&(t.body=e),t}))})):t})):e.remoteDBcall(r,t,i)})))})}},e.prototype.getStore=function(e){return this.localDBManagementService.getStore(e.dataModelName,e.entityName)},e.prototype.hasBlob=function(e){return!!_.filter(e.entitySchema.columns,{sqlType:"blob"}).length},e.prototype.localDBcall=function(e,t,n,i,r){var a=this;return new Promise((function(n,i){a.offlineDBService[e.name](t,(function(i){if("READ"!==e.type)return t.onlyOnline=!0,t.url=r,a.changeLogService.add("DatabaseService",e.name,t).then((function(){return n(i)}));n(i)}))})).then((function(e){return e={body:e,type:T},o.triggerFn(n,e),e}),i)},e.prototype.remoteDBcall=function(e,t,n){var i=this;return new Promise((function(r,a){t.call(i.httpService,n).subscribe((function(t){t&&t.type&&(n.skipLocalDB||i.offlineDBService.getStore(n).then((function(r){"READ"===e.type&&e.saveResponse?r.saveAll(t.body.content):"INSERT"===e.type?((n=_.clone(n)).data=_.clone(t.body),i.offlineDBService[e.name](n,o.noop,o.noop,{resetPrimaryKey:!1})):i.offlineDBService[e.name](n,o.noop,o.noop)})).catch(o.noop),r(t))}),(function(e){a(e)}))}))},e.prototype.prepareToCascade=function(e){var t=this;return this.getStore(e).then((function(n){var i=[];return _.forEach(e.data,(function(o,r){var a,s,l;if(_.isObject(o)&&!_.isArray(o)&&(a=n.entitySchema.columns.find((function(e){return e.primaryKey&&e.foreignRelations&&(s=e.foreignRelations.find((function(e){return e.sourceFieldName===r}))),!!s}))),a){(l=_.cloneDeep(e)).entityName=s.targetEntity,l.data=o;var c=t.getStore(l).then((function(i){var o=e.data,a=i.entitySchema.columns.find((function(e){return e.name===s.targetColumn}));if(a&&a.foreignRelations){var c=a.foreignRelations.find((function(e){return e.targetTable===n.entitySchema.name})).sourceFieldName;l.data[c]=o}return o[r]=null,l.onlyOnline=!1,l.isCascadingStopped=!0,l.hasBlob=t.hasBlob(i),l.url="",function(){return Promise.resolve().then((function(){var e=i.getValue(l.data,i.primaryKeyField.fieldName);return e?i.get(e):null})).then((function(e){var n;return n=e?l.hasBlob?"updateMultiPartTableData":"updateTableData":l.hasBlob?"insertMultiPartTableData":"insertTableData",t.onlineDBService[n](l).toPromise()}))}}));i.push(c)}})),Promise.all(i).then((function(e){return{cascade:function(){return Promise.all(e.map((function(e){return e()})))}}}))}))},e}(),se=!1,le=function(){function e(e,t,n,i,o,r){this.changeLogService=e,this.deviceFileService=t,this.deviceFileUploadService=n,this.file=i,this.networkService=o,this.uploadDir=r}return e.prototype.add=function(){var e=this;if(!se){se=!0;var t=this.deviceFileUploadService.upload;this.deviceFileUploadService.uploadToServer=t,this.deviceFileUploadService.upload=function(n,i,o,r,a,s){return e.networkService.isConnected()?t.call(e.deviceFileUploadService,n,i,o,r,a,s):e.uploadLater(n,i,o,r,a,s).then((function(e){return{text:JSON.stringify(e),headers:null,response:e}}))}}},e.prototype.uploadLater=function(e,t,n,i,o,r){var a=this,s=n.lastIndexOf("/"),l=n.substring(0,s),c=n.substring(s+1),p=this.deviceFileService.appendToFileName(c),u=this.uploadDir+"/"+p;return this.file.copyFile(l,c,this.uploadDir,p).then((function(){return a.changeLogService.add("OfflineFileUploadService","uploadToServer",{file:u,ftOptions:{fileKey:t,fileName:i},params:o,headers:r,serverUrl:e,deleteOnUpload:!0})})).then((function(){return[{fileName:c,path:u,length:0,success:!0,inlinePath:u+"?inline"}]}))},e}(),ce=/^\d+(\.\d+)?$/,pe=!1,ue=function(){function e(e,t,n,i){this.changeLogService=e,this.httpService=t,this.localDBManagementService=n,this.networkService=i}return e.prototype.add=function(){var e=this;if(!pe){pe=!0;var t=this.httpService.sendCallAsObservable;this.httpService.sendCallAsObservable=function(n,i){return!i&&_.get(n,"url")&&(i={url:n.url}),!e.networkService.isConnected()&&i.url.indexOf("/queryExecutor/")>0?h.from(e.executeLocally(i)):t.call(e.httpService,n,i)}}},e.prototype.executeLocally=function(e){var t=this,n=e.url,i=n.indexOf("?")>0,o=this.substring(n,"services/","/queryExecutor"),r=this.substring(n,"queries/",i?"?":void 0),a=i?this.getHttpParamMap(this.substring(n,"?",void 0)):{},s=this.getHttpParamMap(e.dataParams),l=_.extend(a,s);return this.localDBManagementService.executeNamedQuery(o,r,l).then((function(n){var i=n.rows;return n.rowsAffected?t.changeLogService.add("WebService","invokeJavaService",e).then((function(){return n.rowsAffected})):{type:T,body:{totalPages:i&&i.length>0?1:0,totalElements:i.length,first:!0,sort:null,numberOfElements:i.length,last:!0,size:e.size,number:0,content:i}}}))},e.prototype.substring=function(e,t,n){if(t){var i=e.indexOf(t)+t.length,o=n?e.indexOf(n):void 0;return e.substring(i,o)}},e.prototype.getHttpParamMap=function(e){var t={};return e&&(e=decodeURIComponent(e)).split("&").forEach((function(e){var n=e.split("=");_.isEmpty(_.trim(n[1]))||!ce.test(n[1])?t[n[0]]=n[1]:t[n[0]]=parseInt(n[1],10)})),t},e}(),de="logged-in-user.info",he=!1,me=function(){function e(e,t,n,i,o){var r=this;this.app=e,this.file=t,this.deviceService=n,this.networkService=i,this.securityService=o,this.saveSecurityConfigLocally=_.debounce((function(e){r._saveSecurityConfigLocally(e)}),1e3)}return e.prototype.add=function(){var e=this;if(!he){he=!0;var t=this.securityService.load,n=this.securityService.appLogout;this.securityService.load=function(n){return new Promise((function(i,o){e.networkService.isConnected()?t.call(e.securityService,n).then((function(t){e.securityConfig=t,e.saveSecurityConfigLocally(t),i(e.securityConfig)}),o):e.readLocalSecurityConfig().then((function(t){return void 0===t&&(t={}),e.securityConfig=t,e.securityService.config=t,t}),(function(){return t.call(e.securityConfig)})).then(i,o)}))},this.securityService.appLogout=function(t,i){e.securityConfig={authenticated:!1,loggedOut:!0,securityEnabled:e.securityConfig&&e.securityConfig.securityEnabled,loggedOutOffline:!e.networkService.isConnected(),loginConfig:e.securityConfig&&e.securityConfig.loginConfig,userInfo:null},e._saveSecurityConfigLocally(e.securityConfig).catch(o.noop).then((function(){e.networkService.isConnected()?n.call(e.securityService,t,i):location.assign(window.location.origin+window.location.pathname)}))},this.securityService.isAuthenticated=function(t){o.triggerFn(t,!0===e.securityConfig.authenticated)},this.deviceService.whenReady().then((function(){return e.clearLastLoggedInUser()})),this.app.subscribe("onNetworkStateChange",(function(t){t.isConnected&&e.clearLastLoggedInUser()}))}},e.prototype._saveSecurityConfigLocally=function(e){return this.file.writeFile(cordova.file.dataDirectory,de,JSON.stringify(e),{replace:!0})},e.prototype.clearLastLoggedInUser=function(){var e=this;return this.readLocalSecurityConfig().then((function(t){t&&t.loggedOutOffline?e.securityService.appLogout(null,null):e.networkService.isConnected()||(e.securityConfig=t||{})}))},e.prototype.readLocalSecurityConfig=function(){var e=this;return new Promise((function(t,n){var i=cordova.file.dataDirectory;e.file.checkFile(i,de).then((function(){return e.readFileAsTxt(i,de).then(t,n)}),(function(){var i=cordova.file.applicationDirectory+"www/metadata/app";return e.readFileAsTxt(i,"security-config.json").then(t,n)}))}))},e.prototype.readFileAsTxt=function(e,t){return this.file.readAsText(e,t).then(JSON.parse).catch(o.noop)},e}(),fe=function(){function e(t,n,i,r,a,s,l,c,p,u,d){o.hasCordova()&&e.initialize(t,n,i,r,a,s,l,c,p,u,d)}return e.initialize=function(e,t,n,i,r,a,s,l,c,p,u){this.initialized||(n.addStartUpService({getServiceName:function(){return"OfflineStartupService"},start:function(){return window.SQLitePlugin?(l.setLogSQl("true"===sessionStorage.getItem("wm.logSql")||"true"===sessionStorage.getItem("debugMode")),window.logSql=function(e){void 0===e&&(e=!0),l.setLogSQl(e),sessionStorage.setItem("wm.logSql",e?"true":"false")},window.executeLocalSql=function(e,t,n){l.executeSQLQuery(e,t,n,!0)},l.loadDatabases().then((function(){t.addWorker(new ne(l)),t.addWorker(new te(l)),t.addWorker(new Z),t.addWorker(new ie(i,l)),new ae(t,s,l,p,c).add(),new le(t,i,r,a,p,i.getUploadDirectory()).add(),new ue(t,s,l,p).add(),l.registerCallback(new ee(t,i,l,a)),t.addWorker({onAddCall:function(){p.isConnected()||p.disableAutoConnect()},postFlush:function(e){e.totalTaskCount>0&&l.close().catch(o.noop).then((function(){location.assign(window.location.origin+window.location.pathname)}))}})}))):Promise.resolve()}}),new me(e,a,n,p,u).add())},e}();fe.initialized=!1,fe.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],declarations:[],exports:[],providers:[],entryComponents:[]}]}],fe.ctorParameters=function(){return[{type:o.App},{type:Q},{type:r.DeviceService},{type:r.DeviceFileService},{type:r.DeviceFileUploadService},{type:i.File},{type:o.AbstractHttpService},{type:z},{type:J},{type:r.NetworkService},{type:a.SecurityService}]};var ge=function(){function e(e){this.deviceFileUploadService=e}return e.prototype.getPromiseFromObs=function(e){return new Promise((function(t,n){e.subscribe((function(e){e&&e.type&&t(e)}),n)}))},e.prototype.push=function(e){var t=e.params;switch(e.service){case"DatabaseService":switch(e.operation){case"insertTableData":return this.getPromiseFromObs(m.LVService.insertTableData(e.params,null,null));case"insertMultiPartTableData":return this.getPromiseFromObs(m.LVService.insertMultiPartTableData(e.params,null,null));case"updateTableData":return this.getPromiseFromObs(m.LVService.updateTableData(e.params,null,null));case"updateMultiPartTableData":return this.getPromiseFromObs(m.LVService.updateMultiPartTableData(e.params,null,null));case"deleteTableData":return this.getPromiseFromObs(m.LVService.deleteTableData(e.params,null,null))}case"OfflineFileUploadService":if("uploadToServer"===e.operation)return this.deviceFileUploadService.uploadToServer.call(this.deviceFileUploadService,t.serverUrl,t.ftOptions.fileKey,t.file,t.ftOptions.fileName,t.params,t.headers)}return Promise.reject(e.service+" service with operation "+e.operation+" is not supported for push.")},e}();ge.decorators=[{type:t.Injectable}],ge.ctorParameters=function(){return[{type:r.DeviceFileUploadService}]};var ve="localDBManager.lastPullInfo",ye=function(){var e={};return{start:function(e){e.$$pullProcessId="PULL_"+_.now()},add:function(t,n){var i=t.$$pullProcessId;e[i]||(e[i]=[]),e[i].push(n)},remove:function(t,n){var i=t.$$pullProcessId;_.remove(e[i],n),_.isEmpty(e[i])&&delete e[i]},abort:function(t){var n=t.$$pullProcessId;return e[n]&&(_.forEach(e[n],(function(e){e&&e.abort&&e.abort()})),delete e[n]),t.$$isMarkedToAbort=!0,t.catch((function(){return"cancelled"}))}}},be=ye(),we=function(){function e(e,t,n,i){var o=this;this.app=e,this.localDBManagementService=t,this.localKeyValueService=n,this.networkService=i,this.localDBManagementService.registerCallback({onDbCreate:function(e){o.localKeyValueService.put(ve,{databases:[],totalRecordsToPull:0,totalPulledRecordCount:0,startTime:new Date(0),endTime:new Date(e.dbSeedCreatedOn)})}})}return e.prototype.addDeltaCriteria=function(e,t,n){var i,o=this,r=e.schema.entities[t],a=r.pullConfig.deltaFieldName,s=_.find(r.columns,{fieldName:a})||{};return _.isEmpty(a)?Promise.resolve(n):this.localDBManagementService.isBundled(e.schema.name,t).then((function(e){return i=e})).then((function(){return o.getLastPullInfo()})).then((function(o){var r=o&&o.startTime&&o.startTime.getTime(),l=_.find(o&&o.databases,{name:e.schema.name}),c=_.find(l&&l.entities,{entityName:t})||{};return!r&&i&&(r=o&&o.endTime&&o.endTime.getTime(),c.query=n),c.query===n&&r>0&&(_.isEmpty(n)?n="":n+=" AND ","datetime"===s.sqlType?n+=a+" > '"+moment(r).utc().format("YYYY-MM-DDTHH:mm:ss")+"'":n+=a+" > "+r),n}),(function(){return Promise.resolve(n)}))},e.prototype.copyDataFromRemoteDBToLocalDB=function(e,t,n,i,r){var a,s=this,l=e.stores[t],c=e.schema.entities[t],p={entityName:t,totalRecordsToPull:0,pulledRecordCount:0},u=0,d=!1;return new Promise((function(h,m){s.prepareQuery(e,t).then((function(n){return p.query=n,s.addDeltaCriteria(e,t,n)})).then((function(e){return n&&p.query===e?l.clear().then((function(){return e})):e})).then((function(t){return a=_.isEmpty(t)?"":"q="+t,s.getTotalRecordsToPull(e,c,a,i)})).then((function(n){var m=c.pullConfig.size||100,f=Math.ceil(n/m);p.totalRecordsToPull=n;var g=c.pullConfig.orderBy;g=(_.isEmpty(g)?"":g+",")+l.primaryKeyName,r.next(p);var v={next:function(e){u++,e=_.slice(e,0,p.totalRecordsToPull-p.pulledRecordCount),l.saveAll(e).then((function(){p.pulledRecordCount+=e?e.length:0,r.next(p)})).catch(o.noop).then((function(){0===--u&&d&&h(p)}))},error:null,complete:null};return s._pullEntityData(e,t,a,g,f,m,1,i,void 0,v)})).then(null,m).catch(o.noop).then((function(){d=!0,0===u&&h(p)}))}))},e.prototype.evalIfBind=function(e){return _.startsWith(e,"bind:")?(e=e.replace(/\[\$\i\]/g,"[0]"),o.$parseExpr(e.replace("bind:",""))(this.app)):e},e.prototype.executeDatabaseCountQuery=function(e){return new Promise((function(t,n){m.LVService.countTableDataWithQuery(e,null,null).subscribe((function(e){return t(e.body)}),n)}))},e.prototype.executeDatabaseSearchQuery=function(e){return new Promise((function(t,n){return m.LVService.searchTableDataWithQuery(e,null,null).subscribe((function(e){return t(e&&e.body&&e.body.content)}),n)}))},e.prototype.getTotalRecordsToPull=function(e,t,n,i){var o=this,r={dataModelName:e.schema.name,entityName:t.entityName,queryParams:n};return this.retryIfNetworkFails((function(){return o.executeDatabaseCountQuery(r).then((function(e){var n=e,i=_.parseInt(t.pullConfig.maxNumberOfRecords);return _.isNaN(i)||i<=0||n<i?n:i}))}),i)},e.prototype.prepareQuery=function(e,t){var n,i=this,o=e.schema.entities[t];return this.localDBManagementService.isBundled(e.schema.name,t).then((function(e){var t=!1;if(e||_.isEmpty(o.pullConfig.query)){if(n=_.cloneDeep(o.pullConfig.filter),n=_.map(n,(function(e){return e.attributeValue=i.evalIfBind(e.attributeValue),t=t||_.isNil(e.attributeValue),e})),t)return Promise.reject("Null criteria values are present");n=_.sortBy(n,"attributeName"),n=m.LiveVariableUtils.getSearchQuery(n," AND ",!0)}else n=i.evalIfBind(o.pullConfig.query);return _.isNil(n)?Promise.resolve(null):Promise.resolve(encodeURIComponent(n))}))},e.prototype._pullDbData=function(e,t,n,i){var o=this,r=e.schema.name,a={name:e.schema.name,entities:[],totalRecordsToPull:0,pulledRecordCount:0,completedTaskCount:0,totalTaskCount:0},s=[];return _.forEach(e.schema.entities,(function(e){s.push(o.localDBManagementService.getStore(r,e.entityName))})),new Promise((function(r,l){Promise.all(s).then((function(s){var c=[];s.forEach((function(e){var t=e.entitySchema.pullConfig,n=t.pullType;(n===E.APP_START||n===E.BUNDLED&&t.deltaFieldName)&&c.push(e.entitySchema)}));var p=_.chain(c).map((function(r){var s={next:function(e){var t=_.findIndex(a.entities,{entityName:e.entityName});t>=0?a.entities[t]=e:a.entities.push(e),a.pulledRecordCount=_.reduce(a.entities,(function(e,t){return e+t.pulledRecordCount}),0),a.totalRecordsToPull=_.reduce(a.entities,(function(e,t){return e+t.totalRecordsToPull}),0),i.next(a)},error:null,complete:null};return o.copyDataFromRemoteDBToLocalDB(e,r.entityName,t,n,s).then((function(e){return a.completedTaskCount++,i.next(a),e}),null)})).value();a.totalTaskCount=p.length,i.next(a),Promise.all(p).then(r,l)}))}))},e.prototype._pullEntityData=function(e,t,n,i,r,a,s,l,c,p){var u=this,d=e.schema.name;if(c||(c=o.defer()),s>r)return c.resolve();var h={dataModelName:d,entityName:t,page:s,size:a,data:n,sort:i,onlyOnline:!0,skipLocalDB:!0};return this.retryIfNetworkFails((function(){return u.executeDatabaseSearchQuery(h)}),l).then((function(o){p.next(o),u._pullEntityData(e,t,n,i,r,a,s+1,l,c,p)}),c.reject),c.promise},e.prototype.retryIfNetworkFails=function(e,t){if(t.$$isMarkedToAbort)return Promise.reject("aborted");var n=this.networkService.retryIfNetworkFails(e);return be.add(t,n),n.catch(o.noop).then((function(){be.remove(t,n)})),n},e.prototype.cancel=function(e){return be.abort(e)},e.prototype.getDb=function(e){return this.localDBManagementService.loadDatabases().then((function(t){return _.find(t,{name:e})||Promise.reject("Local database ("+e+") not found")}))},e.prototype.getLastPullInfo=function(){return this.localKeyValueService.get(ve).then((function(e){return _.isString(e.startTime)&&(e.startTime=new Date(e.startTime)),_.isString(e.endTime)&&(e.endTime=new Date(e.endTime)),e}))},e.prototype.pullAllDbData=function(e,t){var n=this,i=o.getAbortableDefer(),r={completedTaskCount:0,totalTaskCount:0,inProgress:!0,databases:[],totalRecordsToPull:0,totalPulledRecordCount:0,startTime:new Date,endTime:new Date};return this.localDBManagementService.loadDatabases().then((function(o){var a=_.chain(o).filter((function(e){return!e.schema.isInternal})).map((function(o){be.start(i.promise);var a={next:function(e){var n=_.findIndex(r.databases,{name:e.name});n>=0?r.databases[n]=e:r.databases.push(e),r.totalTaskCount=_.reduce(r.databases,(function(e,t){return e+t.totalTaskCount}),0),r.completedTaskCount=_.reduce(r.databases,(function(e,t){return e+t.completedTaskCount}),0),r.totalPulledRecordCount=_.reduce(r.databases,(function(e,t){return e+t.pulledRecordCount}),0),r.totalRecordsToPull=_.reduce(r.databases,(function(e,t){return e+t.totalRecordsToPull}),0),t.next(r)},error:null,complete:null};return n._pullDbData(o,e,i.promise,a)})).value();return Promise.all(a)})).then((function(){r.endTime=new Date,r.inProgress=!1,n.localKeyValueService.put(ve,r),i.resolve(r)}),i.reject),i.promise},e.prototype.pullDbData=function(e,t,n){var i=this,r=o.getAbortableDefer();return this.getDb(e).then((function(e){return i._pullDbData(e,t,r.promise,n)})).then(r.resolve,r.reject),r.promise},e.prototype.pullEntityData=function(e,t,n,i){var r=this,a=o.getAbortableDefer();return this.getDb(e).then((function(e){return r.copyDataFromRemoteDBToLocalDB(e,t,n,a.promise,i)})).then(a.resolve,a.reject),a.promise},e}();we.SERVICE_NAME="LocalDBDataPullService",we.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new we(g.\u0275\u0275inject(v.App),g.\u0275\u0275inject(z),g.\u0275\u0275inject(S),g.\u0275\u0275inject(y.NetworkService))},token:we,providedIn:"root"}),we.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],we.ctorParameters=function(){return[{type:o.App},{type:z},{type:S},{type:r.NetworkService}]},e.CONTEXT_KEY=Y,e.ChangeLogService=Q,e.LAST_PUSH_INFO_KEY=K,e.LocalDBDataPullService=we,e.LocalDBManagementService=z,e.LocalDbService=J,e.OfflineModule=fe,e.PushService=H,e.PushServiceImpl=ge,e["\u02750"]=ye,e["\u0275a"]=S,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@awesome-cordova-plugins/app-version/ngx"),require("@awesome-cordova-plugins/barcode-scanner/ngx"),require("@awesome-cordova-plugins/calendar/ngx"),require("@awesome-cordova-plugins/camera/ngx"),require("@awesome-cordova-plugins/device/ngx"),require("@awesome-cordova-plugins/media-capture/ngx"),require("@awesome-cordova-plugins/geolocation/ngx"),require("@awesome-cordova-plugins/vibration/ngx"),require("@awesome-cordova-plugins/location-accuracy/ngx"),require("@awesome-cordova-plugins/diagnostic/ngx"),require("@wm/core"),require("@wm/mobile/core"),require("@wm/mobile/offline"),require("@wm/security"),require("@wm/variables"),require("@wm/mobile/components/basic")):"function"==typeof define&&define.amd?define("@wm/mobile/variables",["exports","@angular/core","@awesome-cordova-plugins/app-version/ngx","@awesome-cordova-plugins/barcode-scanner/ngx","@awesome-cordova-plugins/calendar/ngx","@awesome-cordova-plugins/camera/ngx","@awesome-cordova-plugins/device/ngx","@awesome-cordova-plugins/media-capture/ngx","@awesome-cordova-plugins/geolocation/ngx","@awesome-cordova-plugins/vibration/ngx","@awesome-cordova-plugins/location-accuracy/ngx","@awesome-cordova-plugins/diagnostic/ngx","@wm/core","@wm/mobile/core","@wm/mobile/offline","@wm/security","@wm/variables","@wm/mobile/components/basic"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.mobile=e.wm.mobile||{},e.wm.mobile.variables={}),e.ng.core,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.wm.core,e.wm.mobile.core,e.wm.mobile.offline,e.wm.security,e.wm.variables,e.wm.mobile.components.basic)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h,m,f,g,v){"use strict";
831
831
  /*! *****************************************************************************
832
832
  Copyright (c) Microsoft Corporation.
833
833
 
@@ -870,4 +870,4 @@ var p=function(e,t){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
870
870
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
871
871
  PERFORMANCE OF THIS SOFTWARE.
872
872
  ***************************************************************************** */
873
- var Y=function(e,t){return(Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function K(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Q(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function X(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}Object.create;function J(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Z(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function ee(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var te=function(){function e(){this.fragments=0,this.fragmentsLoaded$=new l.Subject}return e.prototype.init=function(){var e=this;this.viewInit$.subscribe(o.noop,o.noop,(function(){e.isViewInitialized=!0,e.isReady()}))},e.prototype.registerFragment=function(){this.fragments++},e.prototype.resolveFragment=function(){this.fragments--,this.isReady()},e.prototype.isReady=function(){this.isViewInitialized&&!this.fragments&&(this.registerFragment=o.noop,this.resolveFragment=o.noop,this.fragmentsLoaded$.complete())},e}();te.decorators=[{type:t.Directive}],te.ctorParameters=function(){return[]};var ne={},ie=function(e){function t(){var t=e.apply(this,ee([],Z(arguments)))||this;return t.compileContent=!1,t.destroy$=new l.Subject,t.viewInit$=new l.Subject,t}return K(t,e),t.prototype.getContainerWidgetInjector=function(){return this.containerWidget.inj||this.containerWidget.injector},t.prototype.init=function(){var t=this;this.App=this.injector.get(o.App),this.containerWidget=this.injector.get(c.WidgetRef),this.i18nService=this.injector.get(o.AbstractI18nService),this.scriptLoaderService=this.injector.get(o.ScriptLoaderService),this.Viewport=this.injector.get(o.Viewport),this.getContainerWidgetInjector().view.component.registerFragment&&this.getContainerWidgetInjector().view.component.registerFragment(),this.registerExpressions(),this.initUserScript(),this.registerWidgets(),this.initVariables(),this.activePageName=this.App.activePageName,this.registerPageParams(),this.defineI18nProps(),this.viewInit$.subscribe(o.noop,o.noop,(function(){t.pageParams=t.containerWidget.partialParams})),this.spa?this.pageDirective=this.injector.get(s.SpaPageDirective,null):this.pageDirective=this.injector.get(s.PageDirective,null),this.pageDirective&&(this.registerDestroyListener(this.pageDirective.subscribe("attach",(function(e){return t.ngOnAttach(e.refreshData)}))),this.registerDestroyListener(this.pageDirective.subscribe("detach",(function(){return t.ngOnDetach()})))),e.prototype.init.call(this)},t.prototype.registerWidgets=function(){"Common"===this.partialName?this.Widgets=ne:this.Widgets=Object.create(ne),this.containerWidget.Widgets=this.Widgets},t.prototype.registerDestroyListener=function(e){this.destroy$.subscribe(o.noop,o.noop,(function(){return e()}))},t.prototype.initUserScript=function(){try{this.getContainerWidgetInjector().view.component.prefabName&&(this.getContainerWidgetInjector().view.component.Prefab?this.Prefab=this.getContainerWidgetInjector().view.component.Prefab:this.Prefab=this.getContainerWidgetInjector().view.component),this.evalUserScript(this,this.App,this.injector.get(o.UtilsService))}catch(e){console.error("Error in evaluating partial ("+this.partialName+") script\n",e)}},t.prototype.initVariables=function(){var e=this,t=this.injector.get(a.VariablesService).register(this.partialName,this.getVariables(),this);this.Variables=Object.create(this.App.Variables),this.Actions=Object.create(this.App.Actions),this.containerWidget.Variables=this.Variables,this.containerWidget.Actions=this.Actions,Object.entries(t.Variables).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Variables[i]=o})),Object.entries(t.Actions).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Actions[i]=o})),this.viewInit$.subscribe(o.noop,o.noop,(function(){o.$invokeWatchers(!0,!0),t.callback(t.Variables).catch(o.noop),t.callback(t.Actions)}))},t.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},t.prototype.registerPageParams=function(){this.pageParams=this.containerWidget.partialParams},t.prototype.defineI18nProps=function(){this.appLocale=this.i18nService.getAppLocale()},t.prototype.invokeOnReady=function(){var e;this.containerWidget.userComponentParams&&(e=this.containerWidget.userComponentParams),this.onReady(e),this.getContainerWidgetInjector().view.component.resolveFragment&&this.getContainerWidgetInjector().view.component.resolveFragment()},t.prototype.loadScripts=function(){var e=this;return new Promise((function(t){var n,i=e.partialDirective.$element.attr("scripts-to-load");i?(n=e.scriptLoaderService).load.apply(n,ee([],Z(i.split(",")))).then(t):t()}))},t.prototype.mute=function(){var e=function(e){e&&e.mute&&e.mute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.unmute=function(){var e=function(e){e&&e.unmute&&e.unmute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.ngAfterViewInit=function(){var e=this;this.loadScripts().then((function(){e.compileContent=!0,setTimeout((function(){e.viewInit$.complete(),e.fragmentsLoaded$.subscribe(o.noop,o.noop,(function(){return e.invokeOnReady()}))}),100)}))},t.prototype.ngOnDestroy=function(){this.destroy$.complete()},t.prototype.ngOnAttach=function(e){if(this.unmute(),e){var t=function(e){e&&e.startUpdate&&e.invoke&&e.invoke()};_.each(this.Variables,t),_.each(this.Actions,t)}_.each(this.Widgets,(function(e){return e&&e.ngOnAttach&&e.ngOnAttach()}))},t.prototype.ngOnDetach=function(){this.mute(),_.each(this.Widgets,(function(e){return e&&e.ngOnDetach&&e.ngOnDetach()}))},t.prototype.onReady=function(e){},t}(te);ie.decorators=[{type:t.Directive}],ie.propDecorators={partialDirective:[{type:t.ViewChild,args:[c.PartialDirective]}]};var oe="_cache_page",re="REUSE_ROUTE_STRATEGY.MAX_CACHE_SIZE",ae="REUSE_ROUTE_STRATEGY.MAX_CACHE_AGE",se=function(){function e(e,t){var n=this;this.maxCacheSize=e,this.maxCacheAge=t,this.paramsToIgnore=["wm_state",oe],this.getSize=function(e){return e?Object.keys(e).length:0},this.cache=new o.LRUCache(e,t,(function(e,t){n.currentRouteKey===e?n.cache.set(e,t):t.componentRef.destroy()}))}return e.prototype.getKey=function(e){var t=this,n=_.chain(e.queryParams).keys().filter((function(e){return!_.includes(t.paramsToIgnore,e)})).orderBy().map((function(t){return t+"="+e.queryParams[t]})).value().join("&"),i=e.params.pageName;return e.data.pageName&&""===e.routeConfig.path&&(i=e.data.pageName),i&&i+(n?"?"+n:"")},e.prototype.isSameQueryParams=function(e,t){try{var n=e.queryParams,i=t.queryParams,o=n?this.getSize(n):0,r=i?this.getSize(i):0;return 0===o&&0===r||o===r&&JSON.stringify(n)===JSON.stringify(i)}catch(e){return!1}},e.prototype.isCacheEnabled=function(e,t){var n=e.queryParams._cache_page;return _.isNil(n)?t:"true"===n||!0===n},e.prototype.shouldDetach=function(e){var t=this.getKey(e);return!!this.isCacheEnabled(e,!!e.data._cache_page)||(this.cache.delete(t),!1)},e.prototype.shouldAttach=function(e){var t=this.getKey(e);this.currentRouteKey=t;var n=this.cache.get(t);return!(!n||!this.isCacheEnabled(e,!!n._cache_page))||(this.cache.delete(t),!1)},e.prototype.store=function(e,t){if(t){var n=this.getKey(e);t._cache_page=!!e.data._cache_page,this.cache.set(n,t)}},e.prototype.retrieve=function(e){var t=this.getKey(e);return this.cache.get(t)},e.prototype.reset=function(e){var t,n,i=this;if(!e)return this.cache.clear();this.cache.delete(e);var o=e+="?",r=[];try{for(var a=J(this.cache.keys()),s=a.next();!s.done;s=a.next()){var l=s.value;l.startsWith(o)&&r.push(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}r.forEach((function(e){return i.cache.delete(e)}))},e}(),le=function(e){function t(t,n){return e.call(this,t,n)||this}return K(t,e),t.prototype.isSameRoute=function(e,t){if(e.routeConfig&&"prefab-preview"===e.routeConfig.path)return!1;var n=e.params,i=t.params,o=this.getSize(n),r=this.getSize(i);return 0===o&&0===r||o===r&&(n.pageName===i.pageName&&this.isSameQueryParams(e,t))},t.prototype.shouldReuseRoute=function(e,t){return this.isSameRoute(e,t)},t}(se);le.ctorParameters=function(){return[{type:Number,decorators:[{type:t.Inject,args:[re]}]},{type:Number,decorators:[{type:t.Inject,args:[ae]}]}]};var ce=function(e){function t(t,n){return e.call(this,t,n)||this}return K(t,e),t.prototype.isSameRoute=function(e,t){return!e.routeConfig&&!t.routeConfig||e.routeConfig===t.routeConfig&&(e.routeConfig!==t.routeConfig||(!(!e.data.layoutName||!t.data.layoutName)||this.isSameQueryParams(e,t)))},t.prototype.shouldReuseRoute=function(e,t){return this.isSameRoute(e,t)},t}(se);ce.ctorParameters=function(){return[{type:Number,decorators:[{type:t.Inject,args:[re]}]},{type:Number,decorators:[{type:t.Inject,args:[ae]}]}]};var pe=function(e){function t(){var t=e.apply(this,ee([],Z(arguments)))||this;return t.startupVariablesLoaded=!1,t.pageTransitionCompleted=!1,t.destroy$=new l.Subject,t.viewInit$=new l.Subject,t.formatsByLocale={timezone:""},t}return K(t,e),t.prototype.init=function(){o.muteWatchers(),this.App=this.injector.get(o.App),this.route=this.injector.get(n.ActivatedRoute),this.appManager=this.injector.get(j),this.navigationService=this.injector.get(o.AbstractNavigationService),this.scriptLoaderService=this.injector.get(o.ScriptLoaderService),this.i18nService=this.injector.get(o.AbstractI18nService),this.router=this.injector.get(n.Router),this.Viewport=this.injector.get(o.Viewport),this.registerExpressions(),this.initUserScript(),this.registerWidgets(),this.initVariables(),this.App.lastActivePageName=this.App.activePageName,this.App.activePageName=this.pageName,this.App.activePage=this,this.activePageName=this.pageName,this.registerPageParams(),this.defineI18nProps(),e.prototype.init.call(this)},t.prototype.registerWidgets=function(){this.Widgets=Object.create(ne),this.App.Widgets=Object.create(this.Widgets)},t.prototype.initUserScript=function(){try{this.evalUserScript(this,this.App,this.injector.get(o.UtilsService))}catch(e){console.error("Error in evaluating page ("+this.pageName+") script\n",e)}},t.prototype.registerPageParams=function(){var e=this,t=this.route.queryParams.subscribe((function(t){return e.pageParams=e.App.pageParams=_.extend({},t)}));this.registerDestroyListener((function(){return t.unsubscribe()}))},t.prototype.registerDestroyListener=function(e){this.destroy$.subscribe(o.noop,o.noop,(function(){return e()}))},t.prototype.defineI18nProps=function(){this.appLocale=this.i18nService.getAppLocale()},t.prototype.initVariables=function(){var e=this,t=this.injector.get(a.VariablesService).register(this.pageName,this.getVariables(),this);this.Variables=Object.create(this.App.Variables),this.Actions=Object.create(this.App.Actions),Object.entries(t.Variables).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Variables[i]=o})),Object.entries(t.Actions).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Actions[i]=o}));var n=this.viewInit$.subscribe(o.noop,o.noop,(function(){e.appManager.isAppVariablesFired()||(t.callback(e.App.Variables).catch(o.noop).then((function(){e.appManager.notify("app-variables-data-loaded",{pageName:e.pageName})})),t.callback(e.App.Actions),e.appManager.appVariablesReady(),e.appManager.isAppVariablesFired(!0)),t.callback(t.Variables).catch(o.noop).then((function(){e.appManager.notify("page-variables-data-loaded",{pageName:e.pageName}),e.startupVariablesLoaded=!0,setTimeout((function(){e.showPageContent=!0}),100)})),t.callback(t.Actions),n.unsubscribe()}))},t.prototype.setTimezone=function(e){this.i18nService.setTimezone(e,this)},t.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},t.prototype.runPageTransition=function(e){var n=this;e=e||this.navigationService.getPageTransition();var i=t.lastPageSnapShot;return new Promise((function(t){if(e&&!e.startsWith("none")&&i){var o=i.parent(),r=function(n){!t||n&&n.pseudoElement||(o.off("animationend",r),o.removeClass(e),o.children().first().remove(),t(),t=null)};e="page-transition page-transition-"+e,i.addClass("page-exit"),n.$page.addClass("page-entry"),o.addClass(e),o.on("animationend",r),setTimeout(r,1e3)}else t()})).then((function(){n.$page&&n.$page.removeClass("page-entry"),i&&(i.remove(),t.lastPageSnapShot=null),n.pageTransitionCompleted=!0}))},t.prototype.invokeOnReady=function(){this.onReady(),this.appManager.notify("pageReady",{name:this.pageName,instance:this}),(this.App.onPageReady||o.noop)(this.pageName,this)},t.prototype.loadScripts=function(){var e=this;return new Promise((function(t){var n,i=e.pageDirective&&e.pageDirective.$element.attr("scripts-to-load");i?(n=e.scriptLoaderService).load.apply(n,ee([],Z(i.split(",")))).then(t):t()}))},t.prototype.restoreLastPageSnapshot=function(){o.isMobileApp()&&t.lastPageSnapShot&&this.$page&&this.$page.parent().prepend(t.lastPageSnapShot)},t.prototype.savePageSnapShot=function(){t.lastPageSnapShot&&t.lastPageSnapShot.remove(),o.isMobileApp()&&this.$page&&(t.lastPageSnapShot=this.$page.clone(),this.$page.parents("app-root").prepend(t.lastPageSnapShot))},t.prototype.saveScrollPosition=function(){var e=function(t,n,i,o){void 0===i&&(i=!0),void 0===o&&(o=t),i&&t.children().each((function(t,i){return e($(i),n)}));var r=o.scrollLeft(),a=o.scrollTop();(r>0||a>0)&&t.attr(n,r+","+a)};e(this.$page,"data-scroll-position"),this.$page.attr("data-window-scroll-position",window.scrollX+","+window.scrollY)},t.prototype.restoreScrollPosition=function(){var e=function(t,n,i,o){void 0===i&&(i=!0),void 0===o&&(o=t);var r=(t.attr(n)||"").split(",");r.length>1&&(o.scrollLeft(r[0]),o.scrollTop(r[1])),t.removeAttr(n),i&&t.children().each((function(t,i){return e($(i),n)}))};e(this.$page,"data-scroll-position"),e(this.$page,"data-window-scroll-position",!1,$(window))},t.prototype.canDeactivate=function(){var e;return!1!==(e=this.onBeforePageLeave())&&(e=(this.App.onBeforePageLeave||o.noop)(this.App.activePageName,this.App.activePage)),void 0===e||e},t.prototype.ngAfterViewInit=function(){var e=this;this.route.snapshot.data._cache_page=this.canReuse(),this.pageDirective&&(this.$page=this.pageDirective.$element.parent(),o.isIos()&&this.$page.addClass("ios-page"),o.isAndroid()&&this.$page.addClass("android-page")),this.restoreLastPageSnapshot(),this.loadScripts().then((function(){e.runPageTransition().then((function(){e.compilePageContent=!0,setTimeout((function(){e.onPageContentReady=function(){e.fragmentsLoaded$.subscribe(o.noop,o.noop,(function(){e.invokeOnReady()})),o.unMuteWatchers(),e.viewInit$.complete(),e.onPageContentReady=o.noop}}),0)}))}))},t.prototype.ngOnDestroy=function(){this.savePageSnapShot(),this.destroy$.complete()},t.prototype.onReady=function(){},t.prototype.onBeforePageReady=function(){},t.prototype.onBeforePageLeave=function(){},t.prototype.onPageContentReady=function(){},t.prototype.canReuse=function(){return!(!this.pageDirective||!this.pageDirective.cache)},t.prototype.mute=function(){var e=function(e){e&&e.mute&&e.mute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.unmute=function(e){void 0===e&&(e=this);var t=function(e){e&&e.unmute&&e.unmute()};_.each(this.Widgets,t),_.each(this.Variables,t),_.each(this.Actions,t)},t.prototype.ngOnAttach=function(){var e=this;if(this.route.snapshot.data._cache_page=this.canReuse(),this.registerPageParams(),this.App.lastActivePageName=this.App.activePageName,this.App.activePageName=this.pageName,this.App.activePage=this,this.activePageName=this.pageName,this.restoreLastPageSnapshot(),this.unmute(),this.App.Widgets=Object.create(this.Widgets),this.pageDirective&&this.pageDirective.refreshdataonattach){var t=function(e){e&&e.startUpdate&&e.invoke&&e.invoke()};_.each(this.Variables,t),_.each(this.Actions,t)}this.runPageTransition().then((function(){setTimeout((function(){return e.restoreScrollPosition()}),100),_.each(e.Widgets,(function(e){return e&&e.ngOnAttach&&e.ngOnAttach()})),e.appManager.notify("pageAttach",{name:e.pageName,instance:e})}))},t.prototype.ngOnDetach=function(){this.saveScrollPosition(),this.savePageSnapShot(),this.mute(),_.each(this.Widgets,(function(e){return e&&e.ngOnDetach&&e.ngOnDetach()})),this.appManager.notify("pageDetach",{name:this.pageName,instance:this})},t.prototype.ngAfterContentInit=function(){this.onBeforePageReady()},t.clear=function(){t.lastPageSnapShot&&(t.lastPageSnapShot.remove(),t.lastPageSnapShot=null)},t}(te);pe.lastPageSnapShot=null,pe.decorators=[{type:t.Directive}],pe.propDecorators={pageDirective:[{type:t.ViewChild,args:[s.PageDirective]}],canDeactivate:[{type:t.HostListener,args:["window:beforeunload"]}]};var ue=function(e){function t(){var t=e.apply(this,ee([],Z(arguments)))||this;return t.compileContent=!1,t.destroy$=new l.Subject,t.viewInit$=new l.Subject,t}return K(t,e),t.prototype.getContainerWidgetInjector=function(){return this.containerWidget.inj||this.containerWidget.injector},t.prototype.init=function(){var t=this;this.App=this.injector.get(o.App),this.containerWidget=this.injector.get(c.WidgetRef),this.prefabMngr=this.injector.get(H),this.i18nService=this.injector.get(o.AbstractI18nService),this.scriptLoaderService=this.injector.get(o.ScriptLoaderService),this.Viewport=this.injector.get(o.Viewport),this.getContainerWidgetInjector().view.component.registerFragment&&this.getContainerWidgetInjector().view.component.registerFragment(),this.spa?this.pageDirective=this.injector.get(s.SpaPageDirective,null):this.pageDirective=this.injector.get(s.PageDirective,null),this.pageDirective&&(this.registerDestroyListener(this.pageDirective.subscribe("attach",(function(e){return t.ngOnAttach(e.refreshData)}))),this.registerDestroyListener(this.pageDirective.subscribe("detach",(function(){return t.ngOnDetach()})))),this.registerExpressions(),this.initUserScript(),this.registerWidgets(),this.initVariables(),this.registerProps(),this.defineI18nProps(),e.prototype.init.call(this)},t.prototype.registerWidgets=function(){this.Widgets={},this.Widgets={},this.containerWidget.Widgets=this.Widgets},t.prototype.initUserScript=function(){try{this.evalUserScript(this,this.App,this.injector.get(o.UtilsService))}catch(e){console.error("Error in evaluating prefab ("+this.prefabName+") script\n",e)}},t.prototype.registerChangeListeners=function(){this.containerWidget.registerPropertyChangeListener(this.onPropertyChange),this.containerWidget.registerStyleChangeListener(this.onPropertyChange)},t.prototype.registerDestroyListener=function(e){this.destroy$.subscribe(o.noop,o.noop,(function(){return e()}))},t.prototype.defineI18nProps=function(){this.appLocale=this.i18nService.getPrefabLocaleBundle(this.prefabName)},t.prototype.registerProps=function(){var e=this;this.prefabMngr.getConfig(this.prefabName).then((function(t){t&&(e.displayName=t.displayName,Object.entries(t.properties||{}).forEach((function(t){var n,i=Z(t,2),r=i[0],a=i[1],s=_.trim(a.value);_.startsWith(s,"bind:")&&(n=s.replace("bind:","")),Object.defineProperty(e,r,{get:function(){return e.containerWidget[r]},set:function(t){return e.containerWidget.widget[r]=t}}),n&&e.registerDestroyListener(o.$watch(n,e,{},(function(t){return e.containerWidget.widget[r]=t})))})),Object.entries(t.events||{}).forEach((function(t){var n=Z(t,2),i=n[0];n[1];e[i]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=i.substr(2).toLowerCase();e.containerWidget.invokeEventCallback(o,{$event:t[0],$data:t[1]})}})),Object.entries(t.methods||{}).forEach((function(t){var n=Z(t,2),i=n[0];n[1];e.containerWidget[i]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if(e[i])return e[i].apply(e,t)}catch(t){console.warn("error in executing prefab-"+e.prefabName+" method-"+i)}}}))),e.containerWidget.setProps(t),o.isIE()&&(e.containerWidget.widget=e.containerWidget.createProxy())}))},t.prototype.initVariables=function(){var e=this,t=this.injector.get(a.VariablesService).register(this.prefabName,this.getVariables(),this);this.Variables={},this.Actions={},this.containerWidget.Variables=this.Variables,this.containerWidget.Actions=this.Actions,Object.entries(t.Variables).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Variables[i]=o})),Object.entries(t.Actions).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Actions[i]=o})),this.viewInit$.subscribe(o.noop,o.noop,(function(){t.callback(t.Variables).catch(o.noop),t.callback(t.Actions)}))},t.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},t.prototype.invokeOnReady=function(){o.$invokeWatchers(!0,!0),this.onReady(),this.getContainerWidgetInjector().view.component.resolveFragment&&this.getContainerWidgetInjector().view.component.resolveFragment(),this.containerWidget.invokeEventCallback("load")},t.prototype.loadScripts=function(){var e=this;return new Promise((function(t){var n,i=e.prefabContainerDirective.$element.attr("scripts-to-load");i?(n=e.scriptLoaderService).load.apply(n,ee([],Z(i.split(",")))).then(t):t()}))},t.prototype.mute=function(){var e=function(e){e&&e.mute&&e.mute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.unmute=function(){var e=function(e){e&&e.unmute&&e.unmute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.ngOnAttach=function(e){if(this.unmute(),e){var t=function(e){e&&e.startUpdate&&e.invoke&&e.invoke()};_.each(this.Variables,t),_.each(this.Actions,t)}_.each(this.Widgets,(function(e){return e&&e.ngOnAttach&&e.ngOnAttach()}))},t.prototype.ngOnDetach=function(){this.mute(),_.each(this.Widgets,(function(e){return e&&e.ngOnDetach&&e.ngOnDetach()}))},t.prototype.ngAfterViewInit=function(){var e=this;this.loadScripts().then((function(){e.compileContent=!0,e.registerChangeListeners(),setTimeout((function(){e.viewInit$.complete(),e.fragmentsLoaded$.subscribe(o.noop,o.noop,(function(){return e.invokeOnReady()}))}),100)}))},t.prototype.ngOnDestroy=function(){this.destroy$.complete()},t.prototype.onPropertyChange=function(){},t.prototype.onReady=function(){},t}(te);ue.decorators=[{type:t.Directive}],ue.propDecorators={prefabContainerDirective:[{type:t.ViewChild,args:[p.PrefabContainerDirective]}]};var de=function(){function e(){}return e.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},e.prototype.overrideRouterOutlet=function(){var e=this,t=this.routerOutlet.attach,n=this.routerOutlet.detach;this.routerOutlet.attach=function(n){t.call(e.routerOutlet,n),n.instance.ngOnAttach()},this.routerOutlet.detach=function(){return n.call(e.routerOutlet)}},e.prototype.ngAfterViewInit=function(){var e=this;setTimeout((function(){e.overrideRouterOutlet()}),10)},e.prototype.init=function(){this.App=this.injector.get(o.App),this.App.activeLayoutName=this.layoutName,this.App.layoutPages=this.layoutPages,this.registerExpressions()},e.prototype.ngOnDestroy=function(){},e.prototype.canReuse=function(){},e.prototype.ngOnAttach=function(){},e.prototype.ngOnDetach=function(){},e.prototype.onActivate=function(e){_.extend(this,e)},e}();de.decorators=[{type:t.Directive}],de.propDecorators={routerOutlet:[{type:t.ViewChild,args:[n.RouterOutlet]}],pageDirective:[{type:t.ViewChild,args:[s.PageDirective]}]};var he,me=function(e){function t(){var t=e.apply(this,ee([],Z(arguments)))||this;return t.startupVariablesLoaded=!1,t.pageTransitionCompleted=!1,t.destroy$=new l.Subject,t.viewInit$=new l.Subject,t.formatsByLocale={timezone:""},t}return K(t,e),t.prototype.init=function(){o.muteWatchers(),this.App=this.injector.get(o.App),this.route=this.injector.get(n.ActivatedRoute),this.appManager=this.injector.get(j),this.navigationService=this.injector.get(o.AbstractNavigationService),this.scriptLoaderService=this.injector.get(o.ScriptLoaderService),this.i18nService=this.injector.get(o.AbstractI18nService),this.router=this.injector.get(n.Router),this.Viewport=this.injector.get(o.Viewport),this.layoutDirective=this.injector.get(s.LayoutDirective),this.registerExpressions(),this.initUserScript(),this.registerWidgets(),this.initVariables(),this.App.lastActivePageName=this.App.activePageName,this.App.activePageName=this.pageName,this.App.activePage=this,this.activePageName=this.pageName,this.registerPageParams(),this.defineI18nProps(),e.prototype.init.call(this)},t.prototype.registerWidgets=function(){this.Widgets=Object.create(ne),this.App.Widgets=Object.create(this.Widgets)},t.prototype.initUserScript=function(){try{this.evalUserScript(this,this.App,this.injector.get(o.UtilsService))}catch(e){console.error("Error in evaluating page ("+this.pageName+") script\n",e)}},t.prototype.registerPageParams=function(){var e=this,t=this.route.queryParams.subscribe((function(t){return e.pageParams=e.App.pageParams=_.extend({},t)}));this.registerDestroyListener((function(){return t.unsubscribe()}))},t.prototype.registerDestroyListener=function(e){this.destroy$.subscribe(o.noop,o.noop,(function(){return e()}))},t.prototype.defineI18nProps=function(){this.appLocale=this.i18nService.getAppLocale()},t.prototype.initVariables=function(){var e=this,t=this.injector.get(a.VariablesService).register(this.pageName,this.getVariables(),this);this.Variables=Object.create(this.App.Variables),this.Actions=Object.create(this.App.Actions),Object.entries(t.Variables).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Variables[i]=o})),Object.entries(t.Actions).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Actions[i]=o}));var n=this.viewInit$.subscribe(o.noop,o.noop,(function(){e.appManager.isAppVariablesFired()||(t.callback(e.App.Variables).catch(o.noop).then((function(){e.appManager.notify("app-variables-data-loaded",{pageName:e.pageName})})),t.callback(e.App.Actions),e.appManager.appVariablesReady(),e.appManager.isAppVariablesFired(!0)),t.callback(t.Variables).catch(o.noop).then((function(){e.appManager.notify("page-variables-data-loaded",{pageName:e.pageName}),e.startupVariablesLoaded=!0,setTimeout((function(){e.showPageContent=!0}),100)})),t.callback(t.Actions),n.unsubscribe()}))},t.prototype.setTimezone=function(e){this.i18nService.setTimezone(e,this)},t.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},t.prototype.runPageTransition=function(e){var n=this;e=e||this.navigationService.getPageTransition();var i=t.lastPageSnapShot;return new Promise((function(t){if(e&&!e.startsWith("none")&&i){var o=i.parent(),r=function(n){!t||n&&n.pseudoElement||(o.off("animationend",r),o.removeClass(e),o.children().first().remove(),t(),t=null)};e="page-transition page-transition-"+e,i.addClass("page-exit"),n.$page.addClass("page-entry"),o.addClass(e),o.on("animationend",r),setTimeout(r,1e3)}else t()})).then((function(){n.$page&&n.$page.removeClass("page-entry"),i&&(i.remove(),t.lastPageSnapShot=null),n.pageTransitionCompleted=!0}))},t.prototype.invokeOnReady=function(){this.onReady(),this.appManager.notify("highlightActiveLink",{pageName:this.pageName}),this.appManager.notify("pageReady",{name:this.pageName,instance:this}),(this.App.onPageReady||o.noop)(this.pageName,this)},t.prototype.loadScripts=function(){var e=this;return new Promise((function(t){var n,i=e.spaPageDirective&&e.spaPageDirective.$element.attr("scripts-to-load");i?(n=e.scriptLoaderService).load.apply(n,ee([],Z(i.split(",")))).then(t):t()}))},t.prototype.restoreLastPageSnapshot=function(){o.isMobileApp()&&t.lastPageSnapShot&&this.$page&&this.$page.parent().prepend(t.lastPageSnapShot)},t.prototype.savePageSnapShot=function(){t.lastPageSnapShot&&t.lastPageSnapShot.remove(),o.isMobileApp()&&this.$page&&(t.lastPageSnapShot=this.$page.clone(),this.$page.parents("app-root").prepend(t.lastPageSnapShot))},t.prototype.saveScrollPosition=function(){var e=function(t,n,i,o){void 0===i&&(i=!0),void 0===o&&(o=t),i&&t.children().each((function(t,i){return e($(i),n)}));var r=o.scrollLeft(),a=o.scrollTop();(r>0||a>0)&&t.attr(n,r+","+a)};e(this.$page,"data-scroll-position"),this.$page.attr("data-window-scroll-position",window.scrollX+","+window.scrollY)},t.prototype.restoreScrollPosition=function(){var e=function(t,n,i,o){void 0===i&&(i=!0),void 0===o&&(o=t);var r=(t.attr(n)||"").split(",");r.length>1&&(o.scrollLeft(r[0]),o.scrollTop(r[1])),t.removeAttr(n),i&&t.children().each((function(t,i){return e($(i),n)}))};e(this.$page,"data-scroll-position"),e(this.$page,"data-window-scroll-position",!1,$(window))},t.prototype.canDeactivate=function(){var e;return!1!==(e=this.onBeforePageLeave())&&(e=(this.App.onBeforePageLeave||o.noop)(this.App.activePageName,this.App.activePage)),void 0===e||e},t.prototype.ngAfterViewInit=function(){var e=this;this.route.snapshot.data._cache_page=this.canReuse(),this.layoutDirective&&(this.$page=this.layoutDirective.$element.parent(),o.isIos()&&this.$page.addClass("ios-page"),o.isAndroid()&&this.$page.addClass("android-page")),this.restoreLastPageSnapshot(),this.loadScripts().then((function(){e.runPageTransition().then((function(){e.compilePageContent=!0,setTimeout((function(){e.onPageContentReady=function(){e.fragmentsLoaded$.subscribe(o.noop,o.noop,(function(){e.invokeOnReady()})),o.unMuteWatchers(),e.viewInit$.complete(),e.onPageContentReady=o.noop}}),0)}))}))},t.prototype.ngOnDestroy=function(){this.savePageSnapShot(),this.destroy$.complete()},t.prototype.onReady=function(){},t.prototype.onBeforePageReady=function(){},t.prototype.onBeforePageLeave=function(){},t.prototype.onPageContentReady=function(){},t.prototype.canReuse=function(){return!(!this.spaPageDirective||!this.spaPageDirective.cache)},t.prototype.mute=function(){var e=function(e){e&&e.mute&&e.mute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.unmute=function(e){void 0===e&&(e=this);var t=function(e){e&&e.unmute&&e.unmute()};_.each(this.Widgets,t),_.each(this.Variables,t),_.each(this.Actions,t)},t.prototype.ngOnAttach=function(){var e=this;if(this.route.snapshot.data._cache_page=this.canReuse(),this.registerPageParams(),this.App.lastActivePageName=this.App.activePageName,this.App.activePageName=this.pageName,this.App.activePage=this,this.activePageName=this.pageName,this.restoreLastPageSnapshot(),this.unmute(),this.App.Widgets=Object.create(this.Widgets),this.spaPageDirective&&this.spaPageDirective.refreshdataonattach){var t=function(e){e&&e.startUpdate&&e.invoke&&e.invoke()};_.each(this.Variables,t),_.each(this.Actions,t)}this.runPageTransition().then((function(){setTimeout((function(){return e.restoreScrollPosition()}),100),_.each(e.Widgets,(function(e){return e&&e.ngOnAttach&&e.ngOnAttach()})),e.appManager.notify("pageAttach",{name:e.pageName,instance:e})})),this.appManager.notify("highlightActiveLink",{pageName:this.pageName})},t.prototype.ngOnDetach=function(){this.saveScrollPosition(),this.savePageSnapShot(),this.mute(),_.each(this.Widgets,(function(e){return e&&e.ngOnDetach&&e.ngOnDetach()})),this.appManager.notify("pageDetach",{name:this.pageName,instance:this})},t.prototype.ngAfterContentInit=function(){this.onBeforePageReady()},t.clear=function(){t.lastPageSnapShot&&(t.lastPageSnapShot.remove(),t.lastPageSnapShot=null)},t}(te);me.lastPageSnapShot=null,me.decorators=[{type:t.Directive}],me.propDecorators={spaPageDirective:[{type:t.ViewChild,args:[s.SpaPageDirective]}],canDeactivate:[{type:t.HostListener,args:["window:beforeunload"]}]},function(e){e.EVERYONE="Everyone",e.ANONYMOUS="Anonymous",e.AUTHENTICATED="Authenticated"}(he||(he={}));var fe=function(){function e(e,t,n,i){this.templateRef=e,this.viewContainerRef=t,this.securityService=n,this.inj=i,this.processed=!1;var o=this.securityService.get();this.securityEnabled=_.get(o,"securityEnabled"),this.isUserAuthenticated=_.get(o,"authenticated"),this.userRoles=_.get(o,"userInfo.userRoles")}return e.prototype.getWidgetRolesArrayFromStr=function(e){var t=/&#44;/g;return""===(e=e||"")?[]:_.split(e,",").map((function(e){return _.trim(e).replace(t,",")}))},e.prototype.matchRoles=function(e,t){return e.some((function(e){return _.includes(t,e)}))},e.prototype.hasAccessToWidget=function(e,t){return!!_.includes(e,he.EVERYONE)||(!(!_.includes(e,he.ANONYMOUS)||this.isUserAuthenticated)||(!(!_.includes(e,he.AUTHENTICATED)||!this.isUserAuthenticated)||this.isUserAuthenticated&&this.matchRoles(e,t)))},Object.defineProperty(e.prototype,"accessroles",{set:function(e){if(!this.processed){this.processed=!0;var t=this.getWidgetRolesArrayFromStr(e);!this.securityEnabled||this.hasAccessToWidget(t,this.userRoles)?this.viewContainerRef.createEmbeddedView(this.templateRef,this.inj.view.context):this.viewContainerRef.clear()}},enumerable:!1,configurable:!0}),e}();fe.decorators=[{type:t.Directive,args:[{selector:"[accessroles]"}]}],fe.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef},{type:r.SecurityService},{type:t.Injector}]},fe.propDecorators={accessroles:[{type:t.Input}]};var ge=function(){};ge.decorators=[{type:t.Component,args:[{selector:"app-spinner",template:'\n <div class="app-spinner" [ngClass]="classname" *ngIf="show">\n <div class="spinner-message">\n <i class="spinner-image animated infinite fa fa-circle-o-notch fa-spin"></i>\n <div class="spinner-messages">\n <p *ngFor="let value of spinnermessages" [textContent]="value"></p>\n </div>\n </div>\n </div>\n '}]}],ge.ctorParameters=function(){return[]},ge.propDecorators={show:[{type:t.Input}],spinnermessages:[{type:t.Input}],classname:[{type:t.Input}],arialabel:[{type:t.Input}]};var ve=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.toastrService=t,i.toastPackage=n,i.watchers=[],i.params={},i.pagename=i.message||"",i.generateParams(),i}return K(t,e),t.prototype.generateParams=function(){var e=this;_.forEach(this.options.partialParams,(function(t){_.isString(t.value)&&0===t.value.indexOf("bind:")?e.watchers.push(o.$watch(t.value.substr(5),e.options.context,{},(function(n){e.params[t.name]=n,o.$appDigest()}))):e.params[t.name]=t.value}))},t.prototype.generateDynamicComponent=function(){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(t){return e=$(".parent-custom-toast"),this.customToastRef.clear(),e[0].appendChild(this.customToastRef.createEmbeddedView(this.customToastTmpl).rootNodes[0]),[2]}))}))},t.prototype.ngAfterViewInit=function(){this.generateDynamicComponent()},t.prototype.ngOnDestroy=function(){_.forEach(this.watchers,(function(e){return e()})),e.prototype.ngOnDestroy.call(this)},t}(h.Toast);ve.decorators=[{type:t.Component,args:[{selector:"[custom-toaster-component]",template:'\n <div class="parent-custom-toast"></div>\n <ng-container #customToast></ng-container>\n <ng-template #customToastTmpl>\n <div wmContainer partialContainer content.bind="pagename">\n <div *ngFor="let param of params | keyvalue" wmParam hidden\n [name]="param.key" [value]="param.value"></div>\n </div>\n </ng-template>',preserveWhitespaces:!1}]}],ve.ctorParameters=function(){return[{type:h.ToastrService},{type:h.ToastPackage}]},ve.propDecorators={customToastRef:[{type:t.ViewChild,args:["customToast",{static:!0,read:t.ViewContainerRef}]}],customToastTmpl:[{type:t.ViewChild,args:["customToastTmpl"]}]};var ye=function(){function e(e,t,n,i,o){this.route=e,this.securityService=t,this.router=n,this.app=i,this.appManger=o}return e.prototype.ngOnInit=function(){var e=this;this.app.isPrefabType?this.router.navigate(["prefab-preview"]):this.app.isApplicationType?this.securityService.getPageByLoggedInUser().then((function(t){e.router.navigate([t])})):(this.router.navigate([o.getWmProjectProperties().homePage]),this.appManger.postAppTypeInfo())},e}();ye.decorators=[{type:t.Component,args:[{selector:"app-empty-page",template:"<div></div>"}]}],ye.ctorParameters=function(){return[{type:n.ActivatedRoute},{type:r.SecurityService},{type:n.Router},{type:o.App},{type:j}]};var be=function(t,n,i,o,r,a,s){var l=this;this.componentInstance=t,this.vcRef=n,this.elRef=i,this.prefabMngr=o,this.resolver=r,this.injector=a,this.componentRefProvider=s;var c=this.componentInstance.prefabName;this.prefabMngr.loadDependencies(c).then((function(){return Q(l,void 0,void 0,(function(){var t,n;return X(this,(function(i){switch(i.label){case 0:return[4,this.componentRefProvider.getComponentFactoryRef(c,e.ComponentType.PREFAB)];case 1:return(t=i.sent())&&(n=this.vcRef.createComponent(t,0,a),this.elRef.nativeElement.appendChild(n.location.nativeElement)),[2]}}))}))}))};be.decorators=[{type:t.Directive,args:[{selector:"[wmPrefab][prefabname]"}]}],be.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[c.WidgetRef]}]},{type:t.ViewContainerRef},{type:t.ElementRef},{type:H},{type:t.ComponentFactoryResolver},{type:t.Injector},{type:x}]};var we={DialogService:o.AbstractDialogService,i18nService:o.AbstractI18nService,statePersistence:o.StatePersistence,SpinnerService:o.AbstractSpinnerService,StatePersistenceService:o.StatePersistence,Viewport:o.Viewport,ToasterService:o.AbstractToasterService,Utils:o.UtilsService,CONSTANTS:o.ConstantService,FIELD_TYPE:o.FieldTypeService,FIELD_WIDGET:o.FieldWidgetService,DynamicComponentService:o.DynamicComponentRefProvider},Pe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},_e=function(){var e=this.httpService,t=function(t,n){var i=Array.from(arguments).slice(1);return Promise.resolve(e[t].apply(e,i))},n=function(){return t.apply(void 0,ee(["send"],Z(Array.from(arguments))))};return["get","post","head","put","delete","jsonp","patch"].forEach((function(e){return n[e]=t.bind(void 0,e)})),n},Oe=function(){function e(e,t,n,i,r,a){this.inj=e,this.i18nService=t,this.statePersistence=n,this.httpService=i,this.securityService=r,this.routeReuseStrategy=a,this.Variables={},this.Actions={},this.onAppVariablesReady=Pe,this.onBeforeAppReady=Pe,this.onSessionTimeout=Pe,this.onPageReady=Pe,this.onBeforePageLeave=Pe,this.onBeforeServiceCall=Pe,this.onServiceSuccess=Pe,this.onServiceError=Pe,this.dynamicComponentContainerRef={},this.changeLocale=this.i18nService.setSelectedLocale.bind(this.i18nService),this.getSelectedLocale=this.i18nService.getSelectedLocale.bind(this.i18nService),this.setTimezone=this.i18nService.setTimezone.bind(this.i18nService),this.setwidgetLocale=this.i18nService.setwidgetLocale.bind(this.i18nService),this._eventNotifier=new o.EventNotifier,this.landingPageName=o.getWmProjectProperties().homePage;var s=o.getWmProjectProperties();this.projectName=s.name,this.isPrefabType="PREFAB"===s.type,this.isApplicationType="APPLICATION"===s.type,this.isTemplateBundleType="TEMPLATEBUNDLE"===s.type,this.targetPlatform=s.platformType,this.httpService.registerOnSessionTimeout(this.on401.bind(this)),this.appLocale=this.i18nService.getAppLocale(),this.httpService.setLocale(this.appLocale)}return e.prototype.reload=function(){window.location.reload()},e.prototype.clearPageCache=function(e){this.routeReuseStrategy instanceof se&&this.routeReuseStrategy.reset(e)},e.prototype.notify=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this._eventNotifier.notify.apply(this._eventNotifier,arguments)},e.prototype.getDependency=function(e){if(o.isString(e)){if("HttpService"===e)return _e.call(this);var t=we[e]&&this.inj.get(we[e]);return!t&&this.inj._providers&&_.forEach(this.inj._providers,(function(n){if(_.isObject(n)&&n.__proto__.constructor.SERVICE_NAME===e)return t=n,!1})),t}return this.inj.get(e)},e.prototype.on401=function(){var e=_.get(this.securityService.get(),"userInfo");_.isEmpty(e)||this.onSessionTimeout()},e.prototype.subscribe=function(e,t){return this._eventNotifier.subscribe(e,t)},e.prototype.notifyApp=function(e,t,n){var i=_.get(this,"Actions.appNotification"),r=-1!==["PROCESS_REJECTED_IN_QUEUE"].indexOf(e);if(i){if(r)return void console.warn("App Error",e);t=t||"success",e=i.getMessage()||e,i.invoke({message:e,title:o.isDefined(n)?n:t.toUpperCase(),class:t,duration:"ERROR"===t.toUpperCase()?0:void 0})}else console.warn('The default Action "appNotification" doesn\'t exist in the app. App notified following error:\n',e)},e.prototype.registerExpressions=function(e){_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},e}();Oe.decorators=[{type:t.Injectable}],Oe.ctorParameters=function(){return[{type:t.Injector},{type:o.AbstractI18nService},{type:o.StatePersistence},{type:o.AbstractHttpService},{type:r.SecurityService},{type:n.RouteReuseStrategy}]};var Se=function(e){function t(t){var n=e.call(this)||this;return n.toaster=t,n}return K(t,e),t.prototype._showToaster=function(e,t,n,i){if(_.isNumber(i)&&(i={timeOut:i}),(i=i||{}).timeOut=o.isDefined(i.timeOut)?i.timeOut:0,i.enableHtml=o.isDefined(i.enableHtml),i.positionClass=i.positionClass||"toast-bottom-right",i.toastClass="toast",t||n){!i.bodyOutputType&&_.isObject(n)&&(n=JSON.stringify(n));var r=this.toaster[e];if(r)return r.call(this.toaster,n,t,i)}},t.prototype.success=function(e,t){return this._showToaster("success",e,t,{timeOut:5e3})},t.prototype.error=function(e,t){return this._showToaster("error",e,t,{timeOut:0})},t.prototype.info=function(e,t){return this._showToaster("info",e,t,{timeOut:0})},t.prototype.warn=function(e,t){return this._showToaster("warning",e,t,{timeOut:0})},t.prototype.show=function(e,t,n,i){return this._showToaster(e,t,n,i)},t.prototype.hide=function(e){e?this.toaster.clear(e.toastId):this.toaster.clear()},t.prototype.showCustom=function(e,t){if(e)return(t=t||{}).toastComponent=ve,t.toastClass="custom-toaster",t.timeOut=o.isDefined(t.timeOut)?t.timeOut:0,t.enableHtml=o.isDefined(t.enableHtml),t.positionClass=t.positionClass||"toast-bottom-right",t.toastClass="toast",this.toaster.show(e,"",t)},t.prototype.setToasterConfig=function(e){_.isObject(e)?_.merge(this.toaster.toastrConfig,e):console.warn("Please pass a valid options object, For Example : {maxOpened: 1, autoDismiss: true}")},t}(o.AbstractToasterService);Se.decorators=[{type:t.Injectable}],Se.ctorParameters=function(){return[{type:h.ToastrService}]};var Ee=["ar","ar-001","ar-ae","ar-bh","ar-dz","ar-eg","ar-iq","ar-jo","ar-kw","ar-lb","ar-ly","ar-ma","ar-om","ar-qa","ar-sa","ar-sd","ar-sy","ar-tn","ar-ye","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","pnb","ps","sd","ug","ur","yi"],Te=function(e){function t(t,n,i,o){var r=e.call(this)||this;return r.$http=t,r.bsLocaleService=n,r.appDefaults=i,r.inj=o,r.defaultSupportedLocale="en",r._isAngularLocaleLoaded=!1,r.formatsByLocale={timezone:"",number:""},r.appLocale={},r.prefabLocale=new Map,r}return K(t,e),Object.defineProperty(t.prototype,"app",{get:function(){return this.inj.get(o.App)},enumerable:!1,configurable:!0}),t.prototype.updateLocaleDirection=function(){var e="ltr";Ee.includes(this.selectedLocale)&&(e="rtl"),o.setCSS(document.body,"direction",e)},t.prototype.init=function(){this.messages={},Object.setPrototypeOf(this.appLocale,this.messages)},t.prototype.getSelectedLocale=function(){return this.selectedLocale},t.prototype.getDefaultSupportedLocale=function(){return this.defaultSupportedLocale},t.prototype.getAppLocale=function(){return this.appLocale},t.prototype.getPrefabLocaleBundle=function(e){return this.prefabLocale.has(e)||this.prefabLocale.set(e,Object.create(this.appLocale)),this.prefabLocale.get(e)},t.prototype.extendPrefabMessages=function(e){var t=this;e.prefabMessages&&Object.keys(e.prefabMessages).forEach((function(n){var i=t.prefabLocale.get(n);i||(i=Object.create(t.appLocale),t.prefabLocale.set(n,i)),Object.assign(i,e.prefabMessages[n])}))},t.prototype.extendMessages=function(e){Object.assign(this.messages,e)},t.prototype.loadResource=function(e){return this.$http.get(e).toPromise().catch((function(){console.warn("error loading locale resource from "+e),Promise.resolve({})}))},t.prototype.loadAppLocaleBundle=function(){var e=this;this.loadResource("resources/i18n/"+this.selectedLocale+".json").then((function(t){e.extendMessages(t.messages),e.extendPrefabMessages(t),e.appDefaults.setFormats(t.formats)}))},t.prototype.loadMomentLocaleBundle=function(e){var t=this,n=o._WM_APP_PROJECT.cdnUrl||o._WM_APP_PROJECT.ngDest;if(this.selectedLocale!==this.defaultSupportedLocale){var i=n+"locales/moment/"+e+".js";o.loadScripts([i],!0).then((function(){moment.locale(t.selectedLocale);var n=moment.localeData(e);n=n&&n._config,w.defineLocale(t.selectedLocale,n),t.bsLocaleService.use(t.getSelectedLocale()||t.defaultSupportedLocale)}))}else moment.locale(this.defaultSupportedLocale)},t.prototype.loadAngularLocaleBundle=function(e){var t=this;return new Promise((function(n){var i=o._WM_APP_PROJECT.cdnUrl||o._WM_APP_PROJECT.ngDest;if(t.selectedLocale!==t.defaultSupportedLocale){var r=i+"locales/angular/global/"+e+".js";o.loadScripts([r],!0).then((function(){t._isAngularLocaleLoaded=!0,n()}),n)}else n()}))},t.prototype.loadCalendarLocaleBundle=function(e,t){void 0===t&&(t=!1);var n,i=o._WM_APP_PROJECT.cdnUrl||o._WM_APP_PROJECT.ngDest;return e?(n=i+"locales/fullcalendar/"+e+".js",t||!o.isMobile()&&!o.isMobileApp()&&this.selectedLocale!==this.defaultSupportedLocale?o.loadScripts([n],!0):void 0):Promise.resolve()},t.prototype.loadMomentTimeZoneBundle=function(e,t){var n=this;return new Promise((function(i){var r=(o._WM_APP_PROJECT.cdnUrl||o._WM_APP_PROJECT.ngDest)+"locales/moment-timezone/moment-timezone-with-data.js";o.loadScripts([r],!0).then((function(){var o=e,r=(e=o.timezone).indexOf("+");r>-1&&(r>0&&(e=e.substr(r)),o.timezone=_.find(moment.tz.names(),(function(t){return e===moment.tz(t).format("Z")})));var a=t&&t.formatsByLocale?t.formatsByLocale:n.formatsByLocale;Object.assign(a,o),i()}),i)}))},t.prototype.loadLocaleBundles=function(e){return e.moment&&this.loadMomentLocaleBundle(e.moment),e.fullCalendar&&window.FullCalendar&&this.loadCalendarLocaleBundle(e.fullCalendar),e.angular&&this.loadAppLocaleBundle(),this.loadAngularLocaleBundle(e.angular)},t.prototype.setTimezone=function(e,t){this.loadMomentTimeZoneBundle(e,t)},t.prototype.getTimezone=function(e){var t=_.get(this.app,"activePage.formatsByLocale.timezone"),n=_.get(e,"formatsByLocale.timezone");return n||(t||this.formatsByLocale.timezone)},t.prototype.getFormatsByLocale=function(){return this.formatsByLocale},t.prototype.setSelectedLocale=function(e){var t=this;_.isObject(e)&&(e=e.datavalue);var n=o.getWmProjectProperties().supportedLanguages[e],i=Object.keys(o.getWmProjectProperties().supportedLanguages);return _.includes(i,e)&&e&&e!==this.selectedLocale?(o.setSessionStorageItem("selectedLocale",e),this.selectedLocale=e,this.init(),this.loadLocaleBundles(n).then((function(){return t.updateLocaleDirection()}))):Promise.resolve()},t.prototype.deduceAppLocale=function(){var e=this.getAcceptedLanguages(),t=o.getWmProjectProperties().defaultLanguage;e.push(t);var n=o.getWmProjectProperties().preferBrowserLang;n=!n||("true"===n||!0===n);var i,r=Object.keys(o.getWmProjectProperties().supportedLanguages)||[this.defaultSupportedLocale],s=n?void 0:t;if(a.CONSTANTS.hasCordova){var l=[];_.forEach(e,(function(e){var t=_.find(r,(function(t){return e===t}))||_.find(r,(function(t){return e.startsWith(t)}));t&&l.push(t)})),i=l[0]}var c=o.getSessionStorageItem("selectedLocale")||s||i||_.intersection(e,r)[0]||this.defaultSupportedLocale;return r=r||[c],c||r[0]},t.prototype.loadDefaultLocale=function(){var e=this.deduceAppLocale();return this.setSelectedLocale(e)},t.prototype.getLocalizedMessage=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return o.replace(this.appLocale[e],t)},t.prototype.getAcceptedLanguages=function(){var e;return e=a.CONSTANTS.hasCordova?navigator.languages||[navigator.language]:(e=decodeURIComponent(o.getWmProjectProperties().preferredLanguage||"")).split(",").map((function(e){return e.split(";")[0]})),_.map(e,_.toLower)},t.prototype.initCalendarLocale=function(){return"en"!==this.selectedLocale?this.loadCalendarLocaleBundle(this.selectedLocale,!0):Promise.resolve()},t.prototype.isAngularLocaleLoaded=function(){return this._isAngularLocaleLoaded},t.prototype.setwidgetLocale=function(e){this.formatsByLocale.number=e.number},t.prototype.getwidgetLocale=function(){return this.formatsByLocale},t}(o.AbstractI18nService);Te.decorators=[{type:t.Injectable}],Te.ctorParameters=function(){return[{type:u.HttpClient},{type:P.BsLocaleService},{type:o.AppDefaults},{type:t.Injector}]};var Re=function(e){function t(){var t=e.call(this)||this;return t.spinnerId=0,t.messageSource=new l.Subject,t.messagesByContext={},t}return K(t,e),t.prototype.getMessageSource=function(){return this.messageSource},t.prototype.showContextSpinner=function(e,t,n){var i=$('[name="'+e+'"]');if(this.messagesByContext[e]=this.messagesByContext[e]||{},0!==Object.keys(this.messagesByContext[e]).length)this.messagesByContext[e][n]=t,this.messagesByContext[e].finalMessage=this.messagesByContext[e].finalMessage+" "+this.messagesByContext[e][n],i.find(".spinner-messages-container").html(this.messagesByContext[e].finalMessage);else{var o=$('<div class="app-spinner">\n <div class="spinner-message" aria-label="loading gif">\n <i class="spinner-image animated infinite fa fa-circle-o-notch fa-spin"></i>\n <div class="spinner-messages">\n <p class="spinner-messages-container"></p>\n </div>\n </div>\n </div>');this.messagesByContext[e][n]=t,this.messagesByContext[e].finalMessage=this.messagesByContext[e][n],o.find(".spinner-messages-container").html(this.messagesByContext[e].finalMessage),i.prepend(o)}return n},t.prototype.showAppSpinner=function(e,t){this.messagesByContext.page=this.messagesByContext.page||{},this.messagesByContext.page[t]=e,this.messageSource.next({show:!0,message:e,messages:_.values(this.messagesByContext.page)})},t.prototype.hideContextSpinner=function(e,t){delete this.messagesByContext[e][t],1===Object.keys(this.messagesByContext[e]).length&&(this.messagesByContext[e]={}),$('[name="'+e+'"]').find(".app-spinner").remove()},t.prototype.show=function(e,t,n,i,o){return t=t||++this.spinnerId,i&&"page"!==i?this.showContextSpinner(i,e,t):(this.showAppSpinner(e,t),t)},t.prototype.hide=function(e){var t=_.findKey(this.messagesByContext,(function(t){return _.includes(_.keys(t),e)}))||"page";if("page"===t)if(e){delete this.messagesByContext[t][e];var n=_.values(this.messagesByContext[t]);this.messageSource.next({show:!!n.length,messages:_.values(this.messagesByContext[t])})}else this.messagesByContext[t]={};else this.hideContextSpinner(t,e)},t}(o.AbstractSpinnerService);Re.decorators=[{type:t.Injectable}],Re.ctorParameters=function(){return[]};var Ae="body >app-root",Ce=function(){function e(e,t,i){var o=this;this.app=e,this.router=t,this.zone=i,this.history=new De,this.isPageAddedToHistory=!1,this.router.events.subscribe((function(e){if(e instanceof n.NavigationStart){var t=e.url,i={},r=void 0;o.isPageAddedToHistory||(o.isPageAddedToHistory=!1,t.indexOf("?")>0?(t.substr(t.indexOf("?")+1).split("&").forEach((function(e){var t=e.split("=");i[t[0]]=t[1]})),r=t.substr(0,t.indexOf("?"))):r=t,"/"===r[0]&&(r=r.substr(1)),r&&(delete i.name,o.history.push(new Ie(r,i,o.transition))))}}))}return e.prototype.getPageTransition=function(){return _.isEmpty(this.transition)||_.isEqual("none",this.transition)?null:this.transition},e.prototype.goToPage=function(e,t){var n=this;this.transition=t.transition||"",this.history.getCurrentPage()&&(this.isPageAddedToHistory=!0),this.history.push(new Ie(e,t.urlParams,this.transition)),this.zone.run((function(){return n.router.navigate(["/"+e],{queryParams:t.urlParams})}))},e.prototype.goToPrevious=function(){this.history.getPagesCount()&&(this.transition=this.history.getCurrentPage().transition,_.isEmpty(this.transition)||(this.transition+="-exit"),this.history.pop(),this.isPageAddedToHistory=!0,window.history.back())},e.prototype.goToView=function(e,t,n){var i=this,o=(t=t||{}).pageName,r=t.transition||"",s=t.$event,l=this.app.activePage,c=n&&n._context&&n._context.prefabName;if(this.app.isPrefabType)this.goToElementView($(Ae).find('[name="'+e+'"]'),e,o,n);else if(o===l.activePageName||c)c&&this.isPrefabWithNameExists(c)?this.goToElementView($('[prefabName="'+c+'"]').find('[name="'+e+'"]'),e,o,n):o&&o!==l.activePageName?this.app.notifyApp(a.CONSTANTS.WIDGET_DOESNT_EXIST,"error"):this.goToElementView($(Ae).find('[name="'+e+'"]'),e,o,n);else if(this.isPartialWithNameExists(o))this.goToElementView($('[partialcontainer][content="'+o+'"]').find('[name="'+e+'"]'),e,o,n);else{this.goToPage(o,{viewName:e,$event:s,transition:r,urlParams:t.urlParams});var p=this.app.subscribe("pageReady",(function(t){i.goToElementView($(Ae).find('[name="'+e+'"]'),e,o,n),p()}))}},e.prototype.goToElementView=function(e,t,n,i){var o,r,a=this,s=this.app.activePage;if(e.length)switch(this.app.isPrefabType||n!==s.activePageName||(e=this.getViewElementInActivePage(e)),(o=e[0].widget).widgetType){case"wm-accordionpane":this.showAncestors(e,i),o.expand();break;case"wm-tabpane":this.showAncestors(e,i),o.select();break;case"wm-segment-content":this.showAncestors(e,i),o.navigate();break;case"wm-panel":o.expanded=!0}else r=this.showAncestorDialog(t),setTimeout((function(){r&&a.goToElementView($('[name="'+t+'"]'),t,n,i)}))},e.prototype.getViewElementInActivePage=function(e){var t;return e.length>1&&(t=_.filter(e,(function(e){if(_.isEmpty($(e).closest('[data-role = "partial"]'))&&_.isEmpty($(e).closest("[wmprefabcontainer]")))return e})))&&(e=$(t)),e},e.prototype.isPartialWithNameExists=function(e){return $('[partialcontainer][content="'+e+'"]').length},e.prototype.isPrefabWithNameExists=function(e){return $('[prefabName="'+e+'"]').length},e.prototype.showAncestors=function(e,t){e.parents('[wm-navigable-element="true"]').toArray().reverse().forEach((function(e){var t=e.widget;switch(t.widgetType){case"wm-accordionpane":t.expand();break;case"wm-tabpane":t.select();break;case"wm-segment-content":t.navigate();break;case"wm-panel":t.expanded=!0}}))},e.prototype.showAncestorDialog=function(e){var t;return $("app-root [dialogtype]").each((function(){var n=$(this);if($(n.html()).find('[name="'+e+'"]').length)return t=n.attr("name"),!1})),t},e}();Ce.decorators=[{type:t.Injectable}],Ce.ctorParameters=function(){return[{type:o.App},{type:n.Router},{type:t.NgZone}]};var Ie=function(){function e(e,t,n){this.name=e,this.urlParams=t,this.transition=n,this.transition=_.isEmpty(this.transition)?null:this.transition}return e.prototype.isEqual=function(e){return e&&e.name===this.name&&_.isEqual(e.urlParams,this.urlParams)},e}(),De=function(){function e(){this.stack=[]}return e.prototype.getCurrentPage=function(){return this.currentPage},e.prototype.getPagesCount=function(){return this.stack.length},e.prototype.isLastVisitedPage=function(e){return this.getLastPage().isEqual(e)},e.prototype.push=function(e){this.currentPage&&this.stack.push(this.currentPage),this.currentPage=e},e.prototype.pop=function(){return this.currentPage=this.stack.pop(),this.currentPage},e.prototype.getLastPage=function(){return this.stack.length>0?this.stack[this.stack.length-1]:void 0},e}(),Ne=function(){function e(){}return e.prototype.setFormats=function(e){var t=e.date,n=e.time,i=t&&n?t+" "+n:void 0,o=e.currency;this.dateFormat=t,this.timeFormat=n,this.dateTimeFormat=i,this.currencyCode=o},e}();Ne.decorators=[{type:t.Injectable}],Ne.ctorParameters=function(){return[]};var xe=!1,ke=function(){function e(e,t){this.securityService=e,this.appManager=t}return e.prototype.loadSecurityConfig=function(){return xe?Promise.resolve(!0):this.appManager.loadSecurityConfig().then((function(){return xe=!0}))},e.prototype.isAuthenticated=function(){var e=this;return this.loadSecurityConfig().then((function(){return new Promise((function(t,n){e.securityService.isAuthenticated(t,n)}))}))},e.prototype.canActivate=function(e){var t=this;return this.isAuthenticated().then((function(n){return n?Promise.resolve(!0):(t.appManager.handle401(e.routeConfig.path,{queryParams:e.queryParams}),Promise.resolve(!1))}))},e}();ke.decorators=[{type:t.Injectable}],ke.ctorParameters=function(){return[{type:r.SecurityService},{type:j}]};var Me=function(){function e(e,t,n,i,o){this.securityService=e,this.authGuard=t,this.toasterService=n,this.app=i,this.appManager=o}return e.prototype.canActivate=function(e){var t=this,n=e.data.allowedRoles;return this.authGuard.isAuthenticated().then((function(i){if(i){var o=t.securityService.get().userInfo.userRoles;return _.intersection(n,o).length>0?Promise.resolve(!0):(t.appManager.notifyApp(t.app.appLocale.LABEL_ACCESS_DENIED||"Access Denied","error"),Promise.resolve(!1))}return t.appManager.handle401(e.routeConfig.path,{queryParams:e.queryParams}),Promise.resolve(!1)}))},e}();Me.decorators=[{type:t.Injectable}],Me.ctorParameters=function(){return[{type:r.SecurityService},{type:ke},{type:o.AbstractToasterService},{type:o.App},{type:j}]};var Le=function(){function e(e,t){this.app=e,this.appManager=t}return e.prototype.canActivate=function(e){return this.appManager.notifyApp(this.app.appLocale.MESSAGE_PAGE_NOT_FOUND||"The page you are trying to reach is not available","error"),Promise.resolve(!1)},e}();Le.decorators=[{type:t.Injectable}],Le.ctorParameters=function(){return[{type:o.App},{type:j}]};var Fe=!1,je=function(){function e(e,t,n,i){this.inj=e,this.app=t,this.utilService=n,this.appJsProvider=i,this.appManager=this.inj.get(j)}return e.prototype.resolve=function(){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(t){switch(t.label){case 0:if(Fe)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.appJsProvider.getAppScriptFn()];case 2:return t.sent()(this.app,this.utilService,this.inj),[3,4];case 3:return e=t.sent(),console.warn("Error in executing app.js",e),[3,4];case 4:return Fe=!0,[2,!0]}}))}))},e}();je.decorators=[{type:t.Injectable}],je.ctorParameters=function(){return[{type:t.Injector},{type:o.App},{type:o.UtilsService},{type:M}]};var Be=!1,Ge=function(){function e(e,t,n){this.appManager=e,this.appJsProvider=t,this.customPipeManager=n}return e.prototype.resolve=function(){return!(!this.appManager.isPrefabType()&&!this.appManager.isTemplateBundleType())||(Be||(this.appJsProvider.loadFormatterConfigScript(this.loadedFormatterScript.bind(this)),Be=!0),Be)},e.prototype.loadedFormatterScript=function(e){try{var t=e;for(var n in t||console.warn("Please return valid formatter object"),t)this.customPipeManager.setCustomPipe(n,t[n])}catch(e){console.warn("Error in reading formatters.js",e)}},e}();Ge.decorators=[{type:t.Injectable}],Ge.ctorParameters=function(){return[{type:j},{type:F},{type:o.CustomPipeManager}]};var Ve=function(){function e(e){this.i18nService=e}return e.prototype.resolve=function(){return this.i18nService.loadDefaultLocale()},e}();Ve.decorators=[{type:t.Injectable}],Ve.ctorParameters=function(){return[{type:o.AbstractI18nService}]};var $e=function(){function e(e,n,r,a){var s,l=this;this.compiler=e,this.injector=n,this.domSanitizer=r,this.i18service=a,this._locale=o.getSessionStorageItem("selectedLocale")||"en",this.formatsByLocale=null===(s=this.i18service)||void 0===s?void 0:s.getwidgetLocale(),this.preparePipeMeta=function(e,t,n,i){return void 0===i&&(i=[]),{type:{reference:e,diDeps:i},name:t,pure:n}},this._pipeData=[this.preparePipeMeta(i.AsyncPipe,"async",!1,[t.ChangeDetectorRef]),this.preparePipeMeta(i.SlicePipe,"slice",!1),this.preparePipeMeta(i.PercentPipe,"percent",!0,[this._locale]),this.preparePipeMeta(i.I18nPluralPipe,"i18nPlural",!0,[i.NgLocalization]),this.preparePipeMeta(i.I18nSelectPipe,"i18nSelect",!0),this.preparePipeMeta(i.KeyValuePipe,"keyvalue",!1,[t.KeyValueDiffers]),this.preparePipeMeta(c.FileIconClassPipe,"fileIconClass",!0),this.preparePipeMeta(c.FileExtensionFromMimePipe,"fileExtensionFromMime",!0),this.preparePipeMeta(c.StateClassPipe,"stateClass",!0),this.preparePipeMeta(c.FileSizePipe,"filesize",!0),this.preparePipeMeta(c.FilterPipe,"filter",!0),this.preparePipeMeta(i.UpperCasePipe,"uppercase",!0),this.preparePipeMeta(i.LowerCasePipe,"lowercase",!0),this.preparePipeMeta(i.JsonPipe,"json",!1),this.preparePipeMeta(i.DecimalPipe,"number",!0,[this._locale]),this.preparePipeMeta(i.TitleCasePipe,"titlecase",!0),this.preparePipeMeta(i.CurrencyPipe,"currency",!0,[this._locale]),this.preparePipeMeta(i.DatePipe,"date",!0,[this._locale]),this.preparePipeMeta(c.ToDatePipe,"toDate",!0,[new i.DatePipe(this._locale)]),this.preparePipeMeta(c.ToNumberPipe,"toNumber",!0,[new i.DecimalPipe(this._locale),this.i18service]),this.preparePipeMeta(c.ToCurrencyPipe,"toCurrency",!0,[new i.DecimalPipe(this._locale),this.i18service]),this.preparePipeMeta(c.PrefixPipe,"prefix",!0),this.preparePipeMeta(c.SuffixPipe,"suffix",!0),this.preparePipeMeta(c.TimeFromNowPipe,"timeFromNow",!0),this.preparePipeMeta(c.NumberToStringPipe,"numberToString",!0,[new i.DecimalPipe(this._locale)]),this.preparePipeMeta(c.StringToNumberPipe,"stringToNumber",!0),this.preparePipeMeta(c.CustomPipe,"custom",!0,[this.injector.get(o.CustomPipeManager)]),this.preparePipeMeta(c.TrustAsPipe,"trustAs",!0,[this.domSanitizer]),this.preparePipeMeta(c.SanitizePipe,"sanitize",!0,[this.domSanitizer])],this._pipeMeta=new Map,this._pipeData.forEach((function(e){l._pipeMeta.set(e.name,e)}))}return e.prototype.unknownPipe=function(e){throw Error("The pipe '"+e+"' could not be found")},e.prototype.meta=function(e){var t=this._pipeMeta.get(e);return t||this.unknownPipe(e),t},e.prototype.getPipeNameVsIsPureMap=function(){var e=new Map;return this._pipeMeta.forEach((function(t,n){e.set(n,t.pure)})),e},e.prototype.resolveDep=function(e){return this.injector.get(e.token.identifier.reference)},e.prototype.getInstance=function(e){var t,n,i=this.meta(e).type,o=i.reference,r=i.diDeps;if(o||this.unknownPipe(e),r.length){var a=[];try{for(var s=J(r),l=s.next();!l.done;l=s.next()){var c=l.value;a.push(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return new(o.bind.apply(o,ee([void 0],Z(a))))}return new o},e}();$e.\u0275prov=C.\u0275\u0275defineInjectable({factory:function(){return new $e(C.\u0275\u0275inject(C.Compiler),C.\u0275\u0275inject(C.INJECTOR),C.\u0275\u0275inject(D.DomSanitizer),C.\u0275\u0275inject(I.AbstractI18nService))},token:$e,providedIn:"root"}),$e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],$e.ctorParameters=function(){return[{type:t.Compiler},{type:t.Injector},{type:d.DomSanitizer},{type:o.AbstractI18nService}]};var Ue=function(){function e(e,t,i,r,a,s,l,c,p,u){var d,h=this;this.elRef=i,this.oAuthService=r,this.dialogService=a,this.spinnerService=s,this.router=c,this.app=p,this.appManager=u,this.startApp=!1,this.isApplicationType=!1,this.spinner={show:!1,messages:[],arialabel:""},this.isOAuthDialogOpen=!1,o.setPipeProvider(e),o.setNgZone(l),o.setAppRef(t),this.isApplicationType="APPLICATION"===o.getWmProjectProperties().type,this.appManager.beforeAppReady(),r.getOAuthProvidersAsObservable().subscribe((function(e){h.providersConfig=e,e.length?h.showOAuthDialog():h.closeOAuthDialog()})),this.spinnerService.getMessageSource().asObservable().subscribe((function(e){setTimeout((function(){h.spinner.show=e.show,h.spinner.messages=e.messages,h.spinner.arialabel=e.messages.toString()}))})),O.setTheme("bs3");var m=o.noop;this.router.events.subscribe((function(e){if(e instanceof n.NavigationStart){var t=e.url.split("?")[0];(t=t.substring(1))||(h.app.activeLayoutName="",h.app.layoutPages=[]),d=h.app.activeLayoutName&&h.app.layoutPages&&h.app.layoutPages.length&&h.app.layoutPages.includes(t)?h.spinnerService.show("","wmRouterOutlet","","wmRouterOutlet"):h.spinnerService.show("","globalSpinner");var i=document.querySelector("app-page-outlet");i&&o.addClass(i,"page-load-in-progress");var r=Date.now();m=function(){h.spinnerService.hide(d);var e=document.querySelector("app-page-outlet");e&&o.removeClass(e,"page-load-in-progress"),m=o.noop,h.app.activePageLoadTime=Date.now()-r}}else(e instanceof n.NavigationEnd||e instanceof n.NavigationCancel||e instanceof n.NavigationError)&&setTimeout((function(){m()}),1e3)})),this.appManager.subscribe("pageReady",(function(){m()})),this.appManager.subscribe("pageAttach",(function(){m()}))}return e.prototype.showOAuthDialog=function(){this.isOAuthDialogOpen||(this.isOAuthDialogOpen=!0,this.dialogService.open("oAuthLoginDialog",this))},e.prototype.closeOAuthDialog=function(){this.isOAuthDialogOpen&&(this.isOAuthDialogOpen=!1,this.dialogService.close("oAuthLoginDialog",this))},e.prototype.start=function(){var e=this;setTimeout((function(){e.startApp=!0})),setTimeout((function(){e.app.dynamicComponentContainerRef=e.dynamicComponentContainerRef,e.overrideRouterOutlet()}),10)},e.prototype.overrideRouterOutlet=function(){var e=this,t=this.routerOutlet.attach,n=this.routerOutlet.detach;this.routerOutlet.attach=function(n){t.call(e.routerOutlet,n),n.instance.ngOnAttach()},this.routerOutlet.detach=function(){return e.app.activePage.ngOnDetach(),n.call(e.routerOutlet)}},e.prototype.ngAfterViewInit=function(){var e=this;o.hasCordova()&&!window.wmDeviceReady?document.addEventListener("wmDeviceReady",(function(){return e.start()})):this.start()},e.prototype.ngDoCheck=function(){o.$invokeWatchers()},e}();Ue.decorators=[{type:t.Component,args:[{selector:"app-root",template:'<ng-container *ngIf="startApp">\n <router-outlet></router-outlet>\n <div wmContainer partialContainer content="Common" hidden class="ng-hide" *ngIf="isApplicationType"></div>\n <app-spinner name="globalspinner" classname="global-spinner" role="alert" aria-live="assertive" [attr.aria-label]="spinner.arialabel || \'Loading\'" [show]="spinner.show" [spinnermessages]="spinner.messages"></app-spinner>\n <div wmDialog name="oAuthLoginDialog" title="Application is requesting you to sign in with"\n close.event="closeOAuthDialog()">\n <ng-template #dialogBody>\n <ul class="list-items">\n <li class="list-item" *ngFor="let provider of providersConfig">\n <button class="btn" (click)="provider.invoke()">{{provider.name}}</button>\n </li>\n </ul>\n </ng-template>\n </div>\n <div wmConfirmDialog name="_app-confirm-dialog" title.bind="title" message.bind="message" oktext.bind="oktext"\n canceltext.bind="canceltext" closable="false" iconclass.bind="iconclass"\n escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>\n <div wmAppExt></div>\n <i id="wm-mobile-display"></i>\n</ng-container>\n\x3c!--Dummy container to create the component dynamically--\x3e\n<ng-container #dynamicComponent></ng-container>\n',encapsulation:t.ViewEncapsulation.None}]}],Ue.ctorParameters=function(){return[{type:$e},{type:t.ApplicationRef},{type:t.ElementRef},{type:b.OAuthService},{type:o.AbstractDialogService},{type:o.AbstractSpinnerService},{type:t.NgZone},{type:n.Router},{type:o.App},{type:j}]},Ue.propDecorators={routerOutlet:[{type:t.ViewChild,args:[n.RouterOutlet]}],dynamicComponentContainerRef:[{type:t.ViewChild,args:["dynamicComponent",{read:t.ViewContainerRef}]}]};var We=function(){function e(){this.wmHttpRequest=new y.WmHttpRequest,this.wmHttpResponse=new y.WmHttpResponse}return e.prototype.createSubject=function(){return new l.Subject},e.prototype.intercept=function(e,t){var n,i,o=this;if(a.appManager&&a.appManager.appOnBeforeServiceCall){var r=this.wmHttpRequest.angularToWmRequest(e);(n=a.appManager.appOnBeforeServiceCall(r))&&(n=this.wmHttpRequest.wmToAngularRequest(n),e=n)}return t.handle(e).pipe(S.tap((function(e){if(e&&4===e.type&&a.appManager&&a.appManager.appOnServiceSuccess){var t=o.wmHttpResponse.angularToWmResponse(e);(i=a.appManager.appOnServiceSuccess(t.body,t))&&(i=o.wmHttpResponse.wmToAngularResponse(i),_.extend(e,i))}}),(function(t){if(t._401Subscriber=o.createSubject(),a.httpService.isPlatformSessionTimeout(t)&&a.httpService.handleSessionTimeout(e,t._401Subscriber),a.appManager&&a.appManager.appOnServiceError){var n=o.wmHttpResponse.angularToWmResponse(t);(i=a.appManager.appOnServiceError(n.message,n))&&(i=o.wmHttpResponse.wmToAngularResponse(i),_.extend(t,i))}})))},e}();We.decorators=[{type:t.Injectable}],We.ctorParameters=function(){return[]};var qe="PREFAB",ze=function(){function e(e){var t=this;this.prefabManager=e,window.addEventListener("message",(function(e){if((e.data&&e.data.context)===qe){var n=e.data.action,i=e.data.payload;"init"===n?t.init():"set-property"===n?t.setProperty(i):"get-outbound-properties"===n?t.getOutboundProps():"invoke-script"===n&&t.invokeScript(i)}}))}return e.prototype.postMessage=function(e,t){var n={context:qe,action:e,payload:t};window.top.postMessage(n,"*")},e.prototype.setupEventListeners=function(){var e=this;this.prefabInstance.invokeEventCallback=function(t,n){void 0===n&&(n={}),e.postMessage("event-log",{name:t,data:n})}},e.prototype.init=function(){var e=this;this.previewMode=!0,this.prefabInstance.readyState.subscribe((function(){}),(function(){}),(function(){e.prefabManager.getConfig("__self__").then((function(t){e.config=t,e.postMessage("config",t),e.setupEventListeners()}))}))},e.prototype.setProperty=function(e){this.prefabInstance.widget[e.name]=e.value},e.prototype.isOutBoundProp=function(e){return"out-bound"===e.bindable||"in-out-bound"===e.bindable},e.prototype.getOutboundProps=function(){var e,t,n={};try{for(var i=J(Object.entries(this.config.properties||{})),o=i.next();!o.done;o=i.next()){var r=Z(o.value,2),a=r[0],s=r[1];this.isOutBoundProp(s)&&(n[a]=this.prefabInstance.widget[a])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}this.postMessage("outbound-properties",n)},e.prototype.invokeScript=function(e){var t="\n return "+e.script+";",n=new Function("Prefab",t)(this.prefabInstance);this.postMessage("method-output",{methodName:e.methodName,output:n})},e.prototype.ngAfterViewInit=function(){this.setupEventListeners(),this.postMessage("init")},e}();ze.decorators=[{type:t.Component,args:[{selector:"wm-prefab-preview",template:'\n <div class="prefab-preview row">\n <section wmPrefab name="prefab-preview" prefabname="__self__"></section>\n </div>\n '}]}],ze.ctorParameters=function(){return[{type:H}]},ze.propDecorators={prefabInstance:[{type:t.ViewChild,args:[p.PrefabDirective,{static:!0}]}]},T.initComponentsBuildTask();var He=new Map,Ye=function(e){var n=function(){};return n.decorators=[{type:t.NgModule,args:[{declarations:[e],imports:[wt],schemas:[t.CUSTOM_ELEMENTS_SCHEMA,t.NO_ERRORS_SCHEMA]}]}],n},Ke=function(e,n,i){void 0===i&&(i="");var o={template:n,styles:[i],encapsulation:t.ViewEncapsulation.None},r=function(){};return r.decorators=[{type:t.Component,args:[Object.assign(Object.assign({},o),{selector:e})]}],r},Qe=function(){function e(e,t,n){this.app=e,this.appManager=t,this.compiler=n,this.counter=1}return e.prototype.getComponentFactoryRef=function(e,t,n){return void 0===n&&(n={}),Q(this,void 0,void 0,(function(){var i,o,r;return X(this,(function(a){return i=He.get(e),t=n.transpile?E.transpile(t).markup:t,i&&!n.noCache||(o=Ke(e,t,n.styles),r=Ye(o),i=this.compiler.compileModuleAndAllComponentsSync(r).componentFactories.filter((function(e){return e.componentType===o}))[0],He.set(e,i)),[2,i]}))}))},e.prototype.addComponent=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),Q(this,void 0,void 0,(function(){var r,a;return X(this,(function(s){switch(s.label){case 0:return i.transpile=!o.isDefined(i.transpile)||i.transpile,i.noCache=!o.isDefined(i.noCache)||i.noCache,i.selector=o.isDefined(i.selector)?i.selector:"wm-dynamic-component-"+this.counter++,[4,this.getComponentFactoryRef(i.selector,t,i)];case 1:return r=s.sent(),a=this.app.dynamicComponentContainerRef.createComponent(r,0,_.get(i,"inj")),o.extendProto(a.instance,n),e.appendChild(a.location.nativeElement),[2]}}))}))},e}();Qe.decorators=[{type:t.Injectable}],Qe.ctorParameters=function(){return[{type:o.App},{type:j},{type:t.Compiler}]};var Xe=function(){function e(){}return e.prototype.canDeactivate=function(e,t,n){return function(){var e;return!1!==(e=this.app.activePage&&this.app.activePage.onBeforePageLeave())&&(e=(this.app.onBeforePageLeave||o.noop)(this.app.activePageName,this.app.activePage)),void 0===e||e}.apply(e)},e}();Xe.decorators=[{type:t.Injectable}];var Je=function(){function e(){}return e.prototype.canDeactivate=function(e,t,n){return!e.canDeactivate||e.canDeactivate()},e}();Je.decorators=[{type:t.Injectable}];var Ze=function(){function e(){this._stylesSet=new Set}return e.prototype.addStyles=function(e){var t=this,n=new Set;e.forEach((function(e){t._stylesSet.has(e)||(t._stylesSet.add(e),n.add(e))})),this.onStylesAdded(n)},e.prototype.onStylesAdded=function(e){},e.prototype.getAllStyles=function(){return Array.from(this._stylesSet)},e}();Ze.decorators=[{type:t.Injectable}];var et=function(e){function t(t){var n=e.call(this)||this;return n._doc=t,n._hostNodes=new Map,n._hostNodes.set(t.head,[]),n}return K(t,e),t.prototype._addStylesToHost=function(e,t,n){var i,o=this,r=(null===(i=document.querySelector('meta[name="CSP-NONCE"]'))||void 0===i?void 0:i.getAttribute("content"))||"wm-csp-nonce";e.forEach((function(e){var i=o._doc.createElement("style");i.textContent=e,i.setAttribute("nonce",r),n.push(t.appendChild(i))}))},t.prototype.addHost=function(e){var t=[];this._addStylesToHost(this._stylesSet,e,t),this._hostNodes.set(e,t)},t.prototype.removeHost=function(e){var t=this._hostNodes.get(e);t&&t.forEach(tt),this._hostNodes.delete(e)},t.prototype.onStylesAdded=function(e){var t=this;this._hostNodes.forEach((function(n,i){t._addStylesToHost(e,i,n)}))},t.prototype.ngOnDestroy=function(){this._hostNodes.forEach((function(e){return e.forEach(tt)}))},t}(Ze);function tt(e){i["\u0275getDOM"]().remove(e)}et.decorators=[{type:t.Injectable}],et.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[i.DOCUMENT]}]}]};var nt={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/MathML/"},it=/%COMP%/g,ot="_nghost-%COMP%",rt="_ngcontent-%COMP%";function at(e,t,n){for(var i=0;i<t.length;i++){var o=t[i];Array.isArray(o)?at(e,o,n):(o=o.replace(it,e),n.push(o))}return n}function st(e){return function(t){if("__ngUnwrap__"===t)return e;!1===e(t)&&(t.preventDefault(),t.returnValue=!1)}}var lt=function(){function e(e,t,n){this.eventManager=e,this.sharedStylesHost=t,this.appId=n,this.rendererByCompId=new Map,this.defaultRenderer=new ct(e)}return e.prototype.createRenderer=function(e,n){if(!e||!n)return this.defaultRenderer;switch(n.encapsulation){case t.ViewEncapsulation.Emulated:var i=this.rendererByCompId.get(n.id);return i||(i=new dt(this.eventManager,this.sharedStylesHost,n,this.appId),this.rendererByCompId.set(n.id,i)),i.applyToHost(e),i;case 1:case t.ViewEncapsulation.ShadowDom:return new ht(this.eventManager,this.sharedStylesHost,e,n);default:if(!this.rendererByCompId.has(n.id)){var o=at(n.id,n.styles,[]);this.sharedStylesHost.addStyles(o),this.rendererByCompId.set(n.id,this.defaultRenderer)}return this.defaultRenderer}},e.prototype.begin=function(){},e.prototype.end=function(){},e}();lt.decorators=[{type:t.Injectable}],lt.ctorParameters=function(){return[{type:d.EventManager},{type:d["\u0275DomSharedStylesHost"]},{type:String,decorators:[{type:t.Inject,args:[t.APP_ID]}]}]};var ct=function(){function e(e){this.eventManager=e,this.data=Object.create(null),this.destroyNode=null}return e.prototype.destroy=function(){},e.prototype.createElement=function(e,t){return t?document.createElementNS(nt[t]||t,e):document.createElement(e)},e.prototype.createComment=function(e){return document.createComment(e)},e.prototype.createText=function(e){return document.createTextNode(e)},e.prototype.appendChild=function(e,t){(pt(e)?e.content:e).appendChild(t)},e.prototype.insertBefore=function(e,t,n){e&&(pt(e)?e.content:e).insertBefore(t,n)},e.prototype.removeChild=function(e,t){e&&e.removeChild(t)},e.prototype.selectRootElement=function(e,t){var n="string"==typeof e?document.querySelector(e):e;if(!n)throw new Error('The selector "'+e+'" did not match any elements');return t||(n.textContent=""),n},e.prototype.parentNode=function(e){return e.parentNode},e.prototype.nextSibling=function(e){return e.nextSibling},e.prototype.resetStyles=function(e){[].slice.call(e).forEach((function(t){e.style.removeProperty(t)}))},e.prototype.applyStyles=function(e,t){if(t)return t.split(";").forEach((function(t){var n,i,o=t.split(":");2===o.length&&(n=o[0].trim(),i=o[1].trim(),e.style[n]=i)})),t},e.prototype.setAttribute=function(e,t,n,i){if(i){t=i+":"+t;var o=nt[i];o?e.setAttributeNS(o,t,n):e.setAttribute(t,n)}else"style"===t?(this.resetStyles(e),this.applyStyles(e,n)):e.setAttribute(t,n)},e.prototype.removeAttribute=function(e,t,n){if(n){var i=nt[n];i?e.removeAttributeNS(i,t):e.removeAttribute(n+":"+t)}else e.removeAttribute(t)},e.prototype.addClass=function(e,t){e.classList.add(t)},e.prototype.removeClass=function(e,t){e.classList.remove(t)},e.prototype.setStyle=function(e,n,i,o){o&(t.RendererStyleFlags2.DashCase|t.RendererStyleFlags2.Important)?e.style.setProperty(n,i,o&t.RendererStyleFlags2.Important?"important":""):e.style[n]=i},e.prototype.removeStyle=function(e,n,i){i&t.RendererStyleFlags2.DashCase?e.style.removeProperty(n):e.style[n]=""},e.prototype.setProperty=function(e,t,n){e[t]=n},e.prototype.setValue=function(e,t){e.nodeValue=t},e.prototype.listen=function(e,t,n){return"string"==typeof e?this.eventManager.addGlobalEventListener(e,t,st(n)):this.eventManager.addEventListener(e,t,st(n))},e}();"@".charCodeAt(0);function pt(e){return"TEMPLATE"===e.tagName&&void 0!==e.content}var ut,dt=function(e){function t(t,n,i,o){var r=e.call(this,t)||this;r.component=i;var a,s=at(o+"-"+i.id,i.styles,[]);return n.addStyles(s),r.contentAttr=(a=o+"-"+i.id,rt.replace(it,a)),r.hostAttr=function(e){return ot.replace(it,e)}(o+"-"+i.id),r}return K(t,e),t.prototype.applyToHost=function(t){e.prototype.setAttribute.call(this,t,this.hostAttr,"")},t.prototype.createElement=function(t,n){var i=e.prototype.createElement.call(this,t,n);return e.prototype.setAttribute.call(this,i,this.contentAttr,""),i},t}(ct),ht=function(e){function t(t,n,i,o){var r=e.call(this,t)||this;r.sharedStylesHost=n,r.hostEl=i,r.shadowRoot=i.attachShadow({mode:"open"}),r.sharedStylesHost.addHost(r.shadowRoot);for(var a=at(o.id,o.styles,[]),s=0;s<a.length;s++){var l=document.createElement("style");l.textContent=a[s],r.shadowRoot.appendChild(l)}return r}return K(t,e),t.prototype.nodeOrShadowRoot=function(e){return e===this.hostEl?this.shadowRoot:e},t.prototype.destroy=function(){this.sharedStylesHost.removeHost(this.shadowRoot)},t.prototype.appendChild=function(t,n){return e.prototype.appendChild.call(this,this.nodeOrShadowRoot(t),n)},t.prototype.insertBefore=function(t,n,i){return e.prototype.insertBefore.call(this,this.nodeOrShadowRoot(t),n,i)},t.prototype.removeChild=function(t,n){return e.prototype.removeChild.call(this,this.nodeOrShadowRoot(t),n)},t.prototype.parentNode=function(t){return this.nodeOrShadowRoot(e.prototype.parentNode.call(this,this.nodeOrShadowRoot(t)))},t}(ct),mt=function(){o._WM_APP_PROJECT.id=o.hasCordova()?_WM_APP_PROPERTIES.displayName:location.href.split("/")[3],o._WM_APP_PROJECT.cdnUrl=document.querySelector('[name="cdnUrl"]')&&document.querySelector('[name="cdnUrl"]').getAttribute("content"),o._WM_APP_PROJECT.ngDest="ng-bundle/"};function ft(e,t){return{provide:e,useValue:t}}function gt(e,t){var n=this;return function(){return Q(n,void 0,void 0,(function(){return X(this,(function(n){switch(n.label){case 0:return mt(),[4,t.resolve()];case 1:return n.sent(),[2,e.loadDefaultLocale()]}}))}))}}function vt(e){return mt(),e.deduceAppLocale()}!function(e){e.IOS="ios",e.ANDROID="android"}(ut||(ut={}));var yt=[fe,ge,ve,be,Ue,ze,ye],bt=[f.ConfirmDialogModule,g.DesignDialogModule,m.DialogModule];$.fn.swipeAnimation.expressionEvaluator=o.$parseExpr;var wt=function(){function e(t,n,i){e.addCustomEventPolyfill(),this.getDeviceDetails().then((function(e){n.selectedViewPort={os:e.os,category:e.selectedDeviceCategory},i.update(e),n.notify("on-viewport-details",e.os)}))}return e.addCustomEventPolyfill=function(){if("function"==typeof window.CustomEvent)return!1;var e=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};e.prototype=window.Event.prototype,window.CustomEvent=e},e.forRoot=function(){return{ngModule:e,providers:[{provide:o.App,useClass:Oe},{provide:o.AbstractToasterService,useClass:Se},{provide:o.AbstractI18nService,useClass:Te},{provide:o.AbstractSpinnerService,useClass:Re},{provide:o.AbstractNavigationService,useClass:Ce},{provide:o.AppDefaults,useClass:Ne},{provide:o.DynamicComponentRefProvider,useClass:Qe},{provide:t.APP_INITIALIZER,useFactory:gt,deps:[o.AbstractI18nService,je],multi:!0},{provide:t.LOCALE_ID,useFactory:vt,deps:[o.AbstractI18nService]},{provide:u.HTTP_INTERCEPTORS,useClass:We,multi:!0},i.DecimalPipe,i.DatePipe,j,H,ke,Me,Le,Xe,je,Ge,Ve,ft(re,10),ft(ae,1800)]}},e.prototype.getDeviceDetails=function(){return new Promise((function(e,t){window.top!==window?(window.top.postMessage({key:"on-load"},"*"),window.onmessage=function(t){var n=t.data;o.isObject(n)&&"switch-device"===n.key&&e(n.device)}):o.isIphone()||o.isIpod()||o.isIpad()?e({os:ut.IOS}):e({os:ut.ANDROID})}))},e}();wt.decorators=[{type:t.NgModule,args:[{declarations:yt,imports:[i.CommonModule,n.RouterModule,u.HttpClientModule,h.ToastrModule,c.WmComponentsModule,p.PrefabModule,v.MobileRuntimeModule,o.CoreModule,r.SecurityModule,b.OAuthModule,a.VariablesModule,y.HttpServiceModule,bt],exports:[yt,i.CommonModule,c.WmComponentsModule,v.MobileRuntimeModule,o.CoreModule,r.SecurityModule,b.OAuthModule,a.VariablesModule,y.HttpServiceModule,bt],providers:[{provide:d["\u0275DomSharedStylesHost"],useClass:et},{provide:d["\u0275DomRendererFactory2"],useClass:lt}],entryComponents:[ve]}]}],wt.ctorParameters=function(){return[{type:v.MobileRuntimeModule},{type:o.App},{type:o.Viewport}]};var Pt=[c.WmComponentsModule.forRoot(),v.MobileRuntimeModule.forRoot(),o.CoreModule.forRoot(),r.SecurityModule.forRoot(),b.OAuthModule.forRoot(),a.VariablesModule.forRoot(),y.HttpServiceModule.forRoot(),wt.forRoot()],_t=!1,Ot=function(){function e(e,t){this.appManager=e,this.appVariablesProvider=t}return e.prototype.resolve=function(){var e=this;return!!_t||Promise.all([this.appManager.loadSecurityConfig(),this.appManager.loadMetadata(),this.appVariablesProvider.getAppVariables()]).then((function(t){return e.appManager.loadAppVariables(t[2])})).then((function(){return _t=!0}))},e}();Ot.\u0275prov=C.\u0275\u0275defineInjectable({factory:function(){return new Ot(C.\u0275\u0275inject(j),C.\u0275\u0275inject(L))},token:Ot,providedIn:"root"}),Ot.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Ot.ctorParameters=function(){return[{type:j},{type:L}]};var St=!1,Et=function(){function e(e){this.appManager=e}return e.prototype.resolve=function(){return St||this.appManager.loadMetadata().then((function(){return St=!0}))},e}();Et.\u0275prov=C.\u0275\u0275defineInjectable({factory:function(){return new Et(C.\u0275\u0275inject(j))},token:Et,providedIn:"root"}),Et.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Et.ctorParameters=function(){return[{type:j}]};var Tt=function(){function e(e){this.appManager=e,o.isMobileApp()||(this.loaded=this.appManager.isPrefabType()||this.appManager.isTemplateBundleType()||!o.getWmProjectProperties().securityEnabled)}return e.prototype.resolve=function(){var e=this;return this.loaded||this.appManager.loadSecurityConfig().then((function(){e.loaded=!0}))},e}();Tt.\u0275prov=C.\u0275\u0275defineInjectable({factory:function(){return new Tt(C.\u0275\u0275inject(j))},token:Tt,providedIn:"root"}),Tt.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Tt.ctorParameters=function(){return[{type:j}]},e.AccessrolesDirective=fe,e.AppComponent=Ue,e.AppDefaultsService=Ne,e.AppExtensionJSResolve=Ge,e.AppExtensionProvider=F,e.AppJSProvider=M,e.AppJSResolve=je,e.AppManagerService=j,e.AppRef=Oe,e.AppSpinnerComponent=ge,e.AppVariablesProvider=L,e.AppVariablesResolve=Ot,e.AuthGuard=ke,e.BaseLayoutComponent=de,e.BasePageComponent=pe,e.BasePartialComponent=ie,e.BasePrefabComponent=ue,e.BaseSpaPageComponent=me,e.CACHE_PAGE=oe,e.CanDeactivateNgPageGuard=Je,e.CanDeactivatePageGuard=Xe,e.ComponentRefProvider=x,e.CustomToasterComponent=ve,e.DynamicComponentRefProviderService=Qe,e.EmptyPageComponent=ye,e.FragmentMonitor=te,e.HttpCallInterceptor=We,e.I18nResolve=Ve,e.I18nServiceImpl=Te,e.InitializeApp=gt,e.MAX_CACHE_AGE=ae,e.MAX_CACHE_SIZE=re,e.MetadataResolve=Et,e.NavigationServiceImpl=Ce,e.PageNotFoundGaurd=Le,e.PipeProvider=$e,e.PrefabConfigProvider=k,e.PrefabDirective=be,e.PrefabManagerService=H,e.PrefabPreviewComponent=ze,e.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS=bt,e.RoleGuard=Me,e.RuntimeBaseModule=wt,e.SecurityConfigResolve=Tt,e.SpinnerServiceImpl=Re,e.ToasterServiceImpl=Se,e.WM_MODULES_FOR_ROOT=Pt,e.WmDefaultRouteReuseStrategy=se,e.WmNgRouteReuseStrategy=ce,e.WmRouteReuseStrategy=le,e.commonPartialWidgets=ne,e.getPrefabBaseUrl=G,e.getPrefabConfigUrl=function(e){return G(e)+"/config.json"},e.getPrefabMinJsonUrl=function(e){return G(e)+"/pages/Main/page.min.json"},e.getPrefabPartialJsonUrl=function(e,t){return G(e)+"/pages/"+t+"/page.min.json"},e.isPrefabInPreview=B,e.setAngularLocale=vt,e["\u02750"]=z,e["\u0275a"]=ft,e["\u0275b"]=Ze,e["\u0275c"]=et,e["\u0275d"]=lt,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/platform-browser-dynamic"),require("@angular/platform-browser"),require("@angular/common"),require("@angular/router"),require("@angular/common/http"),require("@angular/forms"),require("ngx-bootstrap/typeahead"),require("ngx-bootstrap/timepicker"),require("ngx-bootstrap/progressbar"),require("ngx-bootstrap/pagination"),require("ngx-bootstrap/modal"),require("ngx-bootstrap/tooltip"),require("ngx-bootstrap/datepicker"),require("ngx-bootstrap/dropdown"),require("ngx-bootstrap/popover"),require("ng-circle-progress"),require("ngx-toastr"),require("ngx-bootstrap/carousel"),require("@wm/core"),require("@wm/components/basic"),require("@wm/components/basic/progress"),require("@wm/components/basic/rich-text-editor"),require("@wm/components/basic/search"),require("@wm/components/basic/tree"),require("@wm/components/input"),require("@wm/components/input/calendar"),require("@wm/components/input/chips"),require("@wm/components/input/color-picker"),require("@wm/components/input/currency"),require("@wm/components/input/epoch"),require("@wm/components/input/file-upload"),require("@wm/components/input/rating"),require("@wm/components/input/slider"),require("@wm/mobile/runtime/dynamic"),require("@wm/components/data/card"),require("@wm/components/data/form"),require("@wm/components/data/list"),require("@wm/components/data/live-table"),require("@wm/components/data/pagination"),require("@wm/components/data/table"),require("@wm/components/chart"),require("@wm/components/containers/accordion"),require("@wm/components/containers/linear-layout"),require("@wm/components/containers/layout-grid"),require("@wm/components/containers/panel"),require("@wm/components/containers/tabs"),require("@wm/components/containers/tile"),require("@wm/components/containers/wizard"),require("@wm/components/dialogs/alert-dialog"),require("@wm/components/dialogs/iframe-dialog"),require("@wm/components/dialogs/login-dialog"),require("@wm/components/dialogs/partial-dialog"),require("@wm/components/navigation/breadcrumb"),require("@wm/components/navigation/menu"),require("@wm/components/navigation/navbar"),require("@wm/components/navigation/popover"),require("@wm/components/advanced/carousel"),require("@wm/components/advanced/login"),require("@wm/components/advanced/marquee"),require("@wm/components/page"),require("@wm/components/page/footer"),require("@wm/components/page/header"),require("@wm/components/page/left-panel"),require("@wm/components/page/right-panel"),require("@wm/components/page/top-nav"),require("@wm/components/prefab"),require("@wm/runtime/base"),require("@wm/variables"),require("@wm/security"),require("@wm/transpiler"),require("@angular/platform-browser/animations")):"function"==typeof define&&define.amd?define("@wm/runtime/dynamic",["exports","@angular/core","@angular/platform-browser-dynamic","@angular/platform-browser","@angular/common","@angular/router","@angular/common/http","@angular/forms","ngx-bootstrap/typeahead","ngx-bootstrap/timepicker","ngx-bootstrap/progressbar","ngx-bootstrap/pagination","ngx-bootstrap/modal","ngx-bootstrap/tooltip","ngx-bootstrap/datepicker","ngx-bootstrap/dropdown","ngx-bootstrap/popover","ng-circle-progress","ngx-toastr","ngx-bootstrap/carousel","@wm/core","@wm/components/basic","@wm/components/basic/progress","@wm/components/basic/rich-text-editor","@wm/components/basic/search","@wm/components/basic/tree","@wm/components/input","@wm/components/input/calendar","@wm/components/input/chips","@wm/components/input/color-picker","@wm/components/input/currency","@wm/components/input/epoch","@wm/components/input/file-upload","@wm/components/input/rating","@wm/components/input/slider","@wm/mobile/runtime/dynamic","@wm/components/data/card","@wm/components/data/form","@wm/components/data/list","@wm/components/data/live-table","@wm/components/data/pagination","@wm/components/data/table","@wm/components/chart","@wm/components/containers/accordion","@wm/components/containers/linear-layout","@wm/components/containers/layout-grid","@wm/components/containers/panel","@wm/components/containers/tabs","@wm/components/containers/tile","@wm/components/containers/wizard","@wm/components/dialogs/alert-dialog","@wm/components/dialogs/iframe-dialog","@wm/components/dialogs/login-dialog","@wm/components/dialogs/partial-dialog","@wm/components/navigation/breadcrumb","@wm/components/navigation/menu","@wm/components/navigation/navbar","@wm/components/navigation/popover","@wm/components/advanced/carousel","@wm/components/advanced/login","@wm/components/advanced/marquee","@wm/components/page","@wm/components/page/footer","@wm/components/page/header","@wm/components/page/left-panel","@wm/components/page/right-panel","@wm/components/page/top-nav","@wm/components/prefab","@wm/runtime/base","@wm/variables","@wm/security","@wm/transpiler","@angular/platform-browser/animations"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.runtime=e.wm.runtime||{},e.wm.runtime.dynamic={}),e.ng.core,e.ng.platformBrowserDynamic,e.ng.platformBrowser,e.ng.common,e.ng.router,e.ng.common.http,e.ng.forms,e["ngx-bootstrap"].typeahead,e["ngx-bootstrap"].timepicker,e["ngx-bootstrap"].progressbar,e["ngx-bootstrap"].pagination,e["ngx-bootstrap"].modal,e["ngx-bootstrap"].tooltip,e["ngx-bootstrap"].datepicker,e["ngx-bootstrap"].dropdown,e["ngx-bootstrap"].popover,e.ngCircleProgress,e.ngxToastr,e["ngx-bootstrap"].carousel,e.wm.core,e.wm.components.basic,e.wm.components.basic.progress,e.wm.components.basic.richtexteditor,e.wm.components.basic.search,e.wm.components.basic.tree,e.wm.components.input,e.wm.components.input.calendar,e.wm.components.input.chips,e.wm.components.input.colorpicker,e.wm.components.input.currency,e.wm.components.input.epoch,e.wm.components.input.fileupload,e.wm.components.input.rating,e.wm.components.input.slider,e.wm.mobile.runtime.dynamic,e.wm.components.data.card,e.wm.components.data.form,e.wm.components.data.list,e.wm.components.data.livetable,e.wm.components.data.pagination,e.wm.components.data.table,e.wm.components.chart,e.wm.components.containers.accordion,e.wm.components.containers.linearlayout,e.wm.components.containers.layoutgrid,e.wm.components.containers.panel,e.wm.components.containers.tabs,e.wm.components.containers.tile,e.wm.components.containers.wizard,e.wm.components.dialogs.alertdialog,e.wm.components.dialogs.iframedialog,e.wm.components.dialogs.logindialog,e.wm.components.dialogs.partialdialog,e.wm.components.navigation.breadcrumb,e.wm.components.navigation.menu,e.wm.components.navigation.navbar,e.wm.components.navigation.popover,e.wm.components.advanced.carousel,e.wm.components.advanced.login,e.wm.components.advanced.marquee,e.wm.components.page,e.wm.components.page.footer,e.wm.components.page.header,e.wm.components.page.leftpanel,e.wm.components.page.rightpanel,e.wm.components.page.topnav,e.wm.components.prefab,e.wm.runtime.base,e.wm.variables,e.wm.security,e.wm.transpiler,e.ng.platformBrowser.animations)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h,m,f,g,v,y,b,w,P,O,S,E,T,R,A,C,I,D,N,x,k,M,L,F,j,B,G,V,U,W,q,z,H,Y,K,Q,X,J,Z,ee,te,ne,ie,oe,re,ae,se,le,ce,pe,ue,de,he,me,fe,ge,ve,ye,be,we){"use strict";function Pe(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var _e=Pe(t),Oe=Pe(a),Se=function(e,t){return(Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function Ee(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Se(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Te(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function Re(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}Object.create;function Ae(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Ce(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var Ie=function(){function e(e,t,n,i,o,r,a,s,l,c,p,u,d){this.injector=e,this.route=t,this.vcRef=n,this.appRef=i,this.metadataService=o,this.securityService=r,this.appManager=a,this.app=s,this.ngZone=l,this.elRef=c,this.spinnerService=p,this.componentRefProvider=u,this.router=d}return e.prototype.getTargetNode=function(){return this.elRef.nativeElement},e.prototype.resetViewContainer=function(){this.vcRef.clear(),this.getTargetNode().innerHTML=""},e.prototype.renderPage=function(e){var t=this,n=this.getTargetNode();this.appManager.loadAppVariables().then((function(){return Te(t,void 0,void 0,(function(){var t,i;return Re(this,(function(o){switch(o.label){case 0:return[4,this.componentRefProvider.getComponentFactoryRef(e,ge.ComponentType.PAGE)];case 1:return(t=o.sent())?(i=this.vcRef.createComponent(t,0,this.injector),this.instance=i.instance,n.appendChild(i.location.nativeElement)):ge.BasePageComponent.clear(),this.vcRef.length>1&&this.vcRef.remove(1),[2]}}))}))}))},e.prototype.renderPrefabPreviewPage=function(){this.router.navigate(["prefab-preview"])},e.prototype.loadPage=function(e){var t=this;this.ngZone.run((function(){e&&t.renderPage(e)}))},e.prototype.ngOnInit=function(){var e=this;this.app.isPrefabType?this.renderPrefabPreviewPage():($(this.getTargetNode()).find(">div").first().remove(),this.subscription=this.route.params.subscribe((function(t){var n=t.pageName;e.loadPage(n)})))},e.prototype.ngOnDestroy=function(){this.vcRef.clear(),this.subscription&&this.subscription.unsubscribe()},e.prototype.ngOnAttach=function(){this.getTargetNode().appendChild(this.instance.$page[0]),this.instance.ngOnAttach()},e.prototype.ngOnDetach=function(){this.instance.ngOnDetach()},e}();Ie.decorators=[{type:t.Component,args:[{selector:"app-page-outlet",template:"<div></div>"}]}],Ie.ctorParameters=function(){return[{type:t.Injector},{type:r.ActivatedRoute},{type:t.ViewContainerRef},{type:t.ApplicationRef},{type:ve.MetadataService},{type:ye.SecurityService},{type:ge.AppManagerService},{type:w.App},{type:t.NgZone},{type:t.ElementRef},{type:w.AbstractSpinnerService},{type:ge.ComponentRefProvider},{type:r.Router}]};var De={securityConfig:ge.SecurityConfigResolve,metadata:ge.MetadataResolve,appMetaConfig:ge.AppExtensionJSResolve},Ne=[{path:"",pathMatch:"full",resolve:De,component:ge.EmptyPageComponent},{path:"prefab-preview",pathMatch:"full",resolve:De,component:ge.PrefabPreviewComponent},{path:":pageName",pathMatch:"full",resolve:De,component:Ie,canDeactivate:[ge.CanDeactivatePageGuard]}],xe=function(e){function t(t){var n=e.call(this)||this;return n.$http=t,n}return Ee(t,e),t.prototype.getAppScriptFn=function(){return this.$http.get("./app.js",{responseType:"text"}).toPromise().then((function(e){return new Function("App","Utils","Injector",e)}))},t}(ge.AppJSProvider);xe.\u0275prov=_e.\u0275\u0275defineInjectable({factory:function(){return new xe(_e.\u0275\u0275inject(Oe.HttpClient))},token:xe,providedIn:"root"}),xe.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],xe.ctorParameters=function(){return[{type:a.HttpClient}]};var ke=new Map,Me=function(){function e(e){this.$http=e}return e.prototype.get=function(e,t){var n=ke.get(e);return n?Promise.resolve(n):this.$http.get(e).then((function(n){return t&&ke.set(e,n),n}))},e.prototype.clearCache=function(){ke.clear()},e}();Me.decorators=[{type:t.Injectable}],Me.ctorParameters=function(){return[{type:w.AbstractHttpService}]};var Le=function(e){function t(t){var n=e.call(this)||this;return n.resourceManager=t,n}return Ee(t,e),t.prototype.getAppVariables=function(){return Te(this,void 0,void 0,(function(){return Re(this,(function(e){return[2,this.resourceManager.get("./app.variables.json")]}))}))},t}(ge.AppVariablesProvider);Le.\u0275prov=_e.\u0275\u0275defineInjectable({factory:function(){return new Le(_e.\u0275\u0275inject(Me))},token:Le,providedIn:"root"}),Le.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Le.ctorParameters=function(){return[{type:Me}]};var Fe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ee(t,e),t.prototype.loadFormatterConfigScript=function(e){try{w.appendScriptToHead(e)}catch(e){console.warn("Error while loading the formatters.js file")}},t}(ge.AppExtensionProvider);Fe.\u0275prov=_e.\u0275\u0275defineInjectable({factory:function(){return new Fe},token:Fe,providedIn:"root"}),Fe.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var je=new Map;window.resourceCache=je;var Be=new Map;Be.set(ge.ComponentType.PAGE,new Map),Be.set(ge.ComponentType.PARTIAL,new Map),Be.set(ge.ComponentType.PREFAB,new Map);var Ge=function(e){return decodeURIComponent(e.replace(/\+/g," "))},Ve=Ge,$e=function(e,t,n){return t===ge.ComponentType.PAGE||t===ge.ComponentType.PARTIAL?n&&n.prefab?ge.getPrefabPartialJsonUrl(n.prefab,e):"./pages/"+e+"/page.min.json":t===ge.ComponentType.PREFAB?ge.getPrefabMinJsonUrl(e):void 0},Ue=$e,We=new Map,qe=function(e,t,n,i,o,r){var a=We.get(t);("Partial"!==n||_.isUndefined(i.Prefab))&&a||(a=new Function(n,"App","Utils",e),We.set(t,a)),a(i,o,r)},ze=qe,He=function(){function e(){}return e.prototype.init=function(){},e}(),Ye=function(e){var n=function(){};return n.decorators=[{type:t.NgModule,args:[{declarations:[e],imports:[ge.RuntimeBaseModule],schemas:[t.CUSTOM_ELEMENTS_SCHEMA,t.NO_ERRORS_SCHEMA]}]}],n},Ke=Ye,Qe=function(e,n,i,o,r,a){var s={template:i,styles:[o],encapsulation:t.ViewEncapsulation.None},l=He,c="",p="";switch(n){case ge.ComponentType.PAGE:l=ge.BasePageComponent,c="app-page-"+e,p="Page";break;case ge.ComponentType.PARTIAL:l=ge.BasePartialComponent,c="app-partial-"+e,p="Partial";break;case ge.ComponentType.PREFAB:l=ge.BasePrefabComponent,c="app-prefab-"+e,p="Prefab"}var u=function(t){function i(i){var o=t.call(this)||this;switch(o.injector=i,n){case ge.ComponentType.PAGE:o.pageName=e;break;case ge.ComponentType.PARTIAL:o.partialName=e;break;case ge.ComponentType.PREFAB:o.prefabName=e}return t.prototype.init.call(o),o}return Ee(i,t),i.prototype.evalUserScript=function(e,t,n){qe(r,c,p,e,t,n)},i.prototype.getVariables=function(){return JSON.parse(a)},i.prototype.getExpressions=function(){return{}},i}(l);return u.decorators=[{type:t.Component,args:[Object.assign(Object.assign({},s),{selector:c,providers:[{provide:w.UserDefinedExecutionContext,useExisting:u}]})]}],u.ctorParameters=function(){return[{type:t.Injector}]},u},Xe=Qe,Je=function(e){function t(t,n,i,o){var r=e.call(this)||this;return r.resouceMngr=t,r.app=n,r.appManager=i,r.compiler=o,r}return Ee(t,e),t.prototype.loadResourcesOfFragment=function(e,t,n){var i=this,o=$e(e,t,n),r=je.get(o);return r?Promise.resolve(r):this.resouceMngr.get(o,!0).then((function(n){var i=n.markup,r=n.script,a=n.styles,s=n.variables,l={markup:be.transpile(Ge(i)).markup,script:Ge(r),styles:be.scopeComponentStyles(e,t,Ge(a)),variables:w.getValidJSON(Ge(s))};return je.set(o,l),l}),(function(e){var t=e.details.status,n={404:i.app.appLocale.MESSAGE_PAGE_NOT_FOUND||"The page you are trying to reach is not available",403:i.app.appLocale.LABEL_ACCESS_DENIED||"Access Denied"};return Promise.reject(n[t])}))},t.prototype.getComponentFactoryRef=function(e,t,n){return Te(this,void 0,void 0,(function(){var i,o,r,a=this;return Re(this,(function(s){return(i=Be.get(t))&&(r=n&&n.prefab?n.prefab+e:e,o=i.get(r))?[2,o]:[2,this.loadResourcesOfFragment(e,t,n).then((function(i){var r=i.markup,s=i.script,l=i.styles,c=i.variables,p=Qe(e,t,r,l,s,JSON.stringify(c)),u=Ye(p);o=a.compiler.compileModuleAndAllComponentsSync(u).componentFactories.filter((function(e){return e.componentType===p}))[0];var d=n&&n.prefab?n.prefab+e:e;return Be.get(t).set(d,o),o}),(function(e){if(e){var t="Error while loading page";console.log(t,e),a.appManager.notifyApp(_.isString(e)?e:t+", check browser console for error details","error")}}))]}))}))},t.prototype.clearComponentFactoryRefCache=function(){this.resouceMngr.clearCache(),je.clear(),Be.forEach((function(e){e.clear()}))},t}(ge.ComponentRefProvider);Je.decorators=[{type:t.Injectable}],Je.ctorParameters=function(){return[{type:Me},{type:w.App},{type:ge.AppManagerService},{type:t.Compiler}]};var Ze=new Map,et=function(e){function t(t){var n=e.call(this)||this;return n.resourceMngr=t,n}return Ee(t,e),t.prototype.getConfig=function(e){var t=Ze.get(e);return t?Promise.resolve(t):this.resourceMngr.get(ge.getPrefabConfigUrl(e)).then((function(t){return Ze.set(e,t),t}))},t}(ge.PrefabConfigProvider);et.decorators=[{type:t.Injectable}],et.ctorParameters=function(){return[{type:Me}]};var tt=r.RouterModule.forRoot(Ne,{useHash:!0,scrollPositionRestoration:"top"}),nt=y.ToastNoAnimationModule.forRoot({maxOpened:1,autoDismiss:!0}),it=a.HttpClientXsrfModule.withOptions({cookieName:"wm_xsrf_token",headerName:w.getWmProjectProperties().xsrf_header_name}),ot=d.ModalModule.forRoot(),rt=m.BsDatepickerModule.forRoot(),at=m.DatepickerModule.forRoot(),st=c.TimepickerModule.forRoot(),lt=f.BsDropdownModule.forRoot(),ct=u.PaginationModule.forRoot(),pt=l.TypeaheadModule.forRoot(),ut=p.ProgressbarModule.forRoot(),dt=b.CarouselModule.forRoot(),ht=g.PopoverModule.forRoot(),mt=v.NgCircleProgressModule.forRoot({}),ft=h.TooltipModule.forRoot(),gt=[m.BsDatepickerModule,m.DatepickerModule,c.TimepickerModule,f.BsDropdownModule,u.PaginationModule,l.TypeaheadModule,p.ProgressbarModule,b.CarouselModule,g.PopoverModule,v.NgCircleProgressModule,h.TooltipModule,P.BasicModule,O.ProgressModule,S.RichTextEditorModule,E.SearchModule,T.TreeModule,A.CalendarModule,C.ChipsModule,I.ColorPickerModule,D.CurrencyModule,N.EpochModule,x.FileUploadModule,R.InputModule,k.RatingModule,M.SliderModule,F.CardModule,j.FormModule,B.ListModule,G.LiveTableModule,V.PaginationModule,U.TableModule,W.ChartModule,q.AccordionModule,z.LinearLayoutModule,H.LayoutGridModule,Y.PanelModule,K.TabsModule,Q.TileModule,X.WizardModule,J.AlertDialogModule,Z.IframeDialogModule,ee.LoginDialogModule,te.PartialDialogModule,ne.BreadcrumbModule,ie.MenuModule,oe.NavbarModule,re.PopoverModule,ae.CarouselModule,se.LoginModule,le.MarqueeModule,ce.PageModule,pe.FooterModule,ue.HeaderModule,de.LeftPanelModule,he.RightPanelModule,me.TopNavModule,fe.PrefabModule];ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS.push.apply(ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS,Ce([],Ae(gt))),ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS.push.apply(ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS,Ce([],Ae(L.MOBILE_COMPONENT_MODULES_FOR_ROOT))),ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS.push(s.FormsModule,s.ReactiveFormsModule);var vt=function(e,t,n){this.app=e,this.inj=t,this.componentRefProvider=n,window.cordova&&this.app.subscribe("userLoggedOut",this.componentRefProvider.clearComponentFactoryRefCache.bind(this.componentRefProvider))};vt.decorators=[{type:t.NgModule,args:[{declarations:[Ie],imports:[i.BrowserModule,we.BrowserAnimationsModule,o.CommonModule,r.RouterModule,a.HttpClientModule,ot,rt,at,st,lt,ct,pt,ft,ut,dt,ht,mt,tt,nt,it,L.MobileRuntimeDynamicModule,ge.WM_MODULES_FOR_ROOT],providers:[Me,{provide:ge.AppJSProvider,useClass:xe},{provide:ge.AppVariablesProvider,useClass:Le},{provide:ge.AppExtensionProvider,useClass:Fe},{provide:ge.ComponentRefProvider,useClass:Je},{provide:w.PartialRefProvider,useClass:Je},{provide:ge.PrefabConfigProvider,useClass:et},{provide:r.RouteReuseStrategy,useClass:ge.WmRouteReuseStrategy}],bootstrap:[ge.AppComponent]}]}],vt.ctorParameters=function(){return[{type:w.App},{type:t.Injector},{type:ge.ComponentRefProvider}]};var yt="debugMode";"true"!==sessionStorage.getItem(yt)&&t.enableProdMode(),console.time("bootstrap"),document.addEventListener("DOMContentLoaded",(function(){new Promise((function(e){window.cordova?document.addEventListener("deviceready",e):e()})).then((function(){return n.platformBrowserDynamic().bootstrapModule(vt)})).then((function(e){var n=e.injector.get(t.ApplicationRef);window.addEventListener("unload",(function(){n.components.map((function(e){return e&&e.destroy()}))})),console.timeEnd("bootstrap")}),(function(e){return console.log(e)}))})),window.debugMode=function(e){_.isEmpty(e)&&(e=!0);var t=e?"true":"false";sessionStorage.getItem(yt)!==t&&(sessionStorage.setItem(yt,t),window.location.reload())};e.AppExtensionProviderService=Fe,e.AppJSProviderService=xe,e.AppModule=vt,e.AppResourceManagerService=Me,e.AppVariablesProviderService=Le,e.ComponentRefProviderService=Je,e.PageWrapperComponent=Ie,e.PrefabConfigProviderService=et,e.bsDatePickerModule=rt,e.bsDropdownModule=lt,e.carouselModule=dt,e.datepickerModule=at,e.httpClientXsrfModule=it,e.modalModule=ot,e.ngCircleProgressModule=mt,e.paginationModule=ct,e.popoverModule=ht,e.progressbarModule=ut,e.routerModule=tt,e.timepickerModule=st,e.toastrModule=nt,e.tooltipModule=ft,e.typeaheadModule=pt,e["\u02750"]=Ve,e["\u02751"]=Ue,e["\u02752"]=ze,e["\u02753"]=Ke,e["\u02754"]=Xe,e["\u0275a"]=Ne,Object.defineProperty(e,"__esModule",{value:!0})}));
873
+ var Y=function(e,t){return(Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function K(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Q(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function X(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}Object.create;function J(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Z(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function ee(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var te=function(){function e(){this.fragments=0,this.fragmentsLoaded$=new l.Subject}return e.prototype.init=function(){var e=this;this.viewInit$.subscribe(o.noop,o.noop,(function(){e.isViewInitialized=!0,e.isReady()}))},e.prototype.registerFragment=function(){this.fragments++},e.prototype.resolveFragment=function(){this.fragments--,this.isReady()},e.prototype.isReady=function(){this.isViewInitialized&&!this.fragments&&(this.registerFragment=o.noop,this.resolveFragment=o.noop,this.fragmentsLoaded$.complete())},e}();te.decorators=[{type:t.Directive}],te.ctorParameters=function(){return[]};var ne={},ie=function(e){function t(){var t=e.apply(this,ee([],Z(arguments)))||this;return t.compileContent=!1,t.destroy$=new l.Subject,t.viewInit$=new l.Subject,t}return K(t,e),t.prototype.getContainerWidgetInjector=function(){return this.containerWidget.inj||this.containerWidget.injector},t.prototype.init=function(){var t=this;this.App=this.injector.get(o.App),this.containerWidget=this.injector.get(c.WidgetRef),this.i18nService=this.injector.get(o.AbstractI18nService),this.scriptLoaderService=this.injector.get(o.ScriptLoaderService),this.Viewport=this.injector.get(o.Viewport),this.getContainerWidgetInjector().view.component.registerFragment&&this.getContainerWidgetInjector().view.component.registerFragment(),this.registerExpressions(),this.initUserScript(),this.registerWidgets(),this.initVariables(),this.activePageName=this.App.activePageName,this.registerPageParams(),this.defineI18nProps(),this.viewInit$.subscribe(o.noop,o.noop,(function(){t.pageParams=t.containerWidget.partialParams})),this.spa?this.pageDirective=this.injector.get(s.SpaPageDirective,null):this.pageDirective=this.injector.get(s.PageDirective,null),this.pageDirective&&(this.registerDestroyListener(this.pageDirective.subscribe("attach",(function(e){return t.ngOnAttach(e.refreshData)}))),this.registerDestroyListener(this.pageDirective.subscribe("detach",(function(){return t.ngOnDetach()})))),e.prototype.init.call(this)},t.prototype.registerWidgets=function(){"Common"===this.partialName?this.Widgets=ne:this.Widgets=Object.create(ne),this.containerWidget.Widgets=this.Widgets},t.prototype.registerDestroyListener=function(e){this.destroy$.subscribe(o.noop,o.noop,(function(){return e()}))},t.prototype.initUserScript=function(){try{this.getContainerWidgetInjector().view.component.prefabName&&(this.getContainerWidgetInjector().view.component.Prefab?this.Prefab=this.getContainerWidgetInjector().view.component.Prefab:this.Prefab=this.getContainerWidgetInjector().view.component),this.evalUserScript(this,this.App,this.injector.get(o.UtilsService))}catch(e){console.error("Error in evaluating partial ("+this.partialName+") script\n",e)}},t.prototype.initVariables=function(){var e=this,t=this.injector.get(a.VariablesService).register(this.partialName,this.getVariables(),this);this.Variables=Object.create(this.App.Variables),this.Actions=Object.create(this.App.Actions),this.containerWidget.Variables=this.Variables,this.containerWidget.Actions=this.Actions,Object.entries(t.Variables).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Variables[i]=o})),Object.entries(t.Actions).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Actions[i]=o})),this.viewInit$.subscribe(o.noop,o.noop,(function(){o.$invokeWatchers(!0,!0),t.callback(t.Variables).catch(o.noop),t.callback(t.Actions)}))},t.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},t.prototype.registerPageParams=function(){this.pageParams=this.containerWidget.partialParams},t.prototype.defineI18nProps=function(){this.appLocale=this.i18nService.getAppLocale()},t.prototype.invokeOnReady=function(){var e;this.containerWidget.userComponentParams&&(e=this.containerWidget.userComponentParams),this.onReady(e),this.getContainerWidgetInjector().view.component.resolveFragment&&this.getContainerWidgetInjector().view.component.resolveFragment()},t.prototype.loadScripts=function(){var e=this;return new Promise((function(t){var n,i=e.partialDirective.$element.attr("scripts-to-load");i?(n=e.scriptLoaderService).load.apply(n,ee([],Z(i.split(",")))).then(t):t()}))},t.prototype.mute=function(){var e=function(e){e&&e.mute&&e.mute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.unmute=function(){var e=function(e){e&&e.unmute&&e.unmute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.ngAfterViewInit=function(){var e=this;this.loadScripts().then((function(){e.compileContent=!0,setTimeout((function(){e.viewInit$.complete(),e.fragmentsLoaded$.subscribe(o.noop,o.noop,(function(){return e.invokeOnReady()}))}),100)}))},t.prototype.ngOnDestroy=function(){this.destroy$.complete()},t.prototype.ngOnAttach=function(e){if(this.unmute(),e){var t=function(e){e&&e.startUpdate&&e.invoke&&e.invoke()};_.each(this.Variables,t),_.each(this.Actions,t)}_.each(this.Widgets,(function(e){return e&&e.ngOnAttach&&e.ngOnAttach()}))},t.prototype.ngOnDetach=function(){this.mute(),_.each(this.Widgets,(function(e){return e&&e.ngOnDetach&&e.ngOnDetach()}))},t.prototype.onReady=function(e){},t}(te);ie.decorators=[{type:t.Directive}],ie.propDecorators={partialDirective:[{type:t.ViewChild,args:[c.PartialDirective]}]};var oe="_cache_page",re="REUSE_ROUTE_STRATEGY.MAX_CACHE_SIZE",ae="REUSE_ROUTE_STRATEGY.MAX_CACHE_AGE",se=function(){function e(e,t){var n=this;this.maxCacheSize=e,this.maxCacheAge=t,this.paramsToIgnore=["wm_state",oe],this.getSize=function(e){return e?Object.keys(e).length:0},this.cache=new o.LRUCache(e,t,(function(e,t){n.currentRouteKey===e?n.cache.set(e,t):t.componentRef.destroy()}))}return e.prototype.getKey=function(e){var t=this,n=_.chain(e.queryParams).keys().filter((function(e){return!_.includes(t.paramsToIgnore,e)})).orderBy().map((function(t){return t+"="+e.queryParams[t]})).value().join("&"),i=e.params.pageName;return e.data.pageName&&""===e.routeConfig.path&&(i=e.data.pageName),i&&i+(n?"?"+n:"")},e.prototype.isSameQueryParams=function(e,t){try{var n=e.queryParams,i=t.queryParams,o=n?this.getSize(n):0,r=i?this.getSize(i):0;return 0===o&&0===r||o===r&&JSON.stringify(n)===JSON.stringify(i)}catch(e){return!1}},e.prototype.isCacheEnabled=function(e,t){var n=e.queryParams._cache_page;return _.isNil(n)?t:"true"===n||!0===n},e.prototype.shouldDetach=function(e){var t=this.getKey(e);return!!this.isCacheEnabled(e,!!e.data._cache_page)||(this.cache.delete(t),!1)},e.prototype.shouldAttach=function(e){var t=this.getKey(e);this.currentRouteKey=t;var n=this.cache.get(t);return!(!n||!this.isCacheEnabled(e,!!n._cache_page))||(this.cache.delete(t),!1)},e.prototype.store=function(e,t){if(t){var n=this.getKey(e);t._cache_page=!!e.data._cache_page,this.cache.set(n,t)}},e.prototype.retrieve=function(e){var t=this.getKey(e);return this.cache.get(t)},e.prototype.reset=function(e){var t,n,i=this;if(!e)return this.cache.clear();this.cache.delete(e);var o=e+="?",r=[];try{for(var a=J(this.cache.keys()),s=a.next();!s.done;s=a.next()){var l=s.value;l.startsWith(o)&&r.push(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}r.forEach((function(e){return i.cache.delete(e)}))},e}(),le=function(e){function t(t,n){return e.call(this,t,n)||this}return K(t,e),t.prototype.isSameRoute=function(e,t){if(e.routeConfig&&"prefab-preview"===e.routeConfig.path)return!1;var n=e.params,i=t.params,o=this.getSize(n),r=this.getSize(i);return 0===o&&0===r||o===r&&(n.pageName===i.pageName&&this.isSameQueryParams(e,t))},t.prototype.shouldReuseRoute=function(e,t){return this.isSameRoute(e,t)},t}(se);le.ctorParameters=function(){return[{type:Number,decorators:[{type:t.Inject,args:[re]}]},{type:Number,decorators:[{type:t.Inject,args:[ae]}]}]};var ce=function(e){function t(t,n){return e.call(this,t,n)||this}return K(t,e),t.prototype.isSameRoute=function(e,t){return!e.routeConfig&&!t.routeConfig||e.routeConfig===t.routeConfig&&(e.routeConfig!==t.routeConfig||(!(!e.data.layoutName||!t.data.layoutName)||this.isSameQueryParams(e,t)))},t.prototype.shouldReuseRoute=function(e,t){return this.isSameRoute(e,t)},t}(se);ce.ctorParameters=function(){return[{type:Number,decorators:[{type:t.Inject,args:[re]}]},{type:Number,decorators:[{type:t.Inject,args:[ae]}]}]};var pe=function(e){function t(){var t=e.apply(this,ee([],Z(arguments)))||this;return t.startupVariablesLoaded=!1,t.pageTransitionCompleted=!1,t.destroy$=new l.Subject,t.viewInit$=new l.Subject,t.formatsByLocale={timezone:""},t}return K(t,e),t.prototype.init=function(){o.muteWatchers(),this.App=this.injector.get(o.App),this.route=this.injector.get(n.ActivatedRoute),this.appManager=this.injector.get(j),this.navigationService=this.injector.get(o.AbstractNavigationService),this.scriptLoaderService=this.injector.get(o.ScriptLoaderService),this.i18nService=this.injector.get(o.AbstractI18nService),this.router=this.injector.get(n.Router),this.Viewport=this.injector.get(o.Viewport),this.registerExpressions(),this.initUserScript(),this.registerWidgets(),this.initVariables(),this.App.lastActivePageName=this.App.activePageName,this.App.activePageName=this.pageName,this.App.activePage=this,this.activePageName=this.pageName,this.registerPageParams(),this.defineI18nProps(),e.prototype.init.call(this)},t.prototype.registerWidgets=function(){this.Widgets=Object.create(ne),this.App.Widgets=Object.create(this.Widgets)},t.prototype.initUserScript=function(){try{this.evalUserScript(this,this.App,this.injector.get(o.UtilsService))}catch(e){console.error("Error in evaluating page ("+this.pageName+") script\n",e)}},t.prototype.registerPageParams=function(){var e=this,t=this.route.queryParams.subscribe((function(t){return e.pageParams=e.App.pageParams=_.extend({},t)}));this.registerDestroyListener((function(){return t.unsubscribe()}))},t.prototype.registerDestroyListener=function(e){this.destroy$.subscribe(o.noop,o.noop,(function(){return e()}))},t.prototype.defineI18nProps=function(){this.appLocale=this.i18nService.getAppLocale()},t.prototype.initVariables=function(){var e=this,t=this.injector.get(a.VariablesService).register(this.pageName,this.getVariables(),this);this.Variables=Object.create(this.App.Variables),this.Actions=Object.create(this.App.Actions),Object.entries(t.Variables).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Variables[i]=o})),Object.entries(t.Actions).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Actions[i]=o}));var n=this.viewInit$.subscribe(o.noop,o.noop,(function(){e.appManager.isAppVariablesFired()||(t.callback(e.App.Variables).catch(o.noop).then((function(){e.appManager.notify("app-variables-data-loaded",{pageName:e.pageName})})),t.callback(e.App.Actions),e.appManager.appVariablesReady(),e.appManager.isAppVariablesFired(!0)),t.callback(t.Variables).catch(o.noop).then((function(){e.appManager.notify("page-variables-data-loaded",{pageName:e.pageName}),e.startupVariablesLoaded=!0,setTimeout((function(){e.showPageContent=!0}),100)})),t.callback(t.Actions),n.unsubscribe()}))},t.prototype.setTimezone=function(e){this.i18nService.setTimezone(e,this)},t.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},t.prototype.runPageTransition=function(e){var n=this;e=e||this.navigationService.getPageTransition();var i=t.lastPageSnapShot;return new Promise((function(t){if(e&&!e.startsWith("none")&&i){var o=i.parent(),r=function(n){!t||n&&n.pseudoElement||(o.off("animationend",r),o.removeClass(e),o.children().first().remove(),t(),t=null)};e="page-transition page-transition-"+e,i.addClass("page-exit"),n.$page.addClass("page-entry"),o.addClass(e),o.on("animationend",r),setTimeout(r,1e3)}else t()})).then((function(){n.$page&&n.$page.removeClass("page-entry"),i&&(i.remove(),t.lastPageSnapShot=null),n.pageTransitionCompleted=!0}))},t.prototype.invokeOnReady=function(){this.onReady(),this.appManager.notify("pageReady",{name:this.pageName,instance:this}),(this.App.onPageReady||o.noop)(this.pageName,this)},t.prototype.loadScripts=function(){var e=this;return new Promise((function(t){var n,i=e.pageDirective&&e.pageDirective.$element.attr("scripts-to-load");i?(n=e.scriptLoaderService).load.apply(n,ee([],Z(i.split(",")))).then(t):t()}))},t.prototype.restoreLastPageSnapshot=function(){o.isMobileApp()&&t.lastPageSnapShot&&this.$page&&this.$page.parent().prepend(t.lastPageSnapShot)},t.prototype.savePageSnapShot=function(){t.lastPageSnapShot&&t.lastPageSnapShot.remove(),o.isMobileApp()&&this.$page&&(t.lastPageSnapShot=this.$page.clone(),this.$page.parents("app-root").prepend(t.lastPageSnapShot))},t.prototype.saveScrollPosition=function(){var e=function(t,n,i,o){void 0===i&&(i=!0),void 0===o&&(o=t),i&&t.children().each((function(t,i){return e($(i),n)}));var r=o.scrollLeft(),a=o.scrollTop();(r>0||a>0)&&t.attr(n,r+","+a)};e(this.$page,"data-scroll-position"),this.$page.attr("data-window-scroll-position",window.scrollX+","+window.scrollY)},t.prototype.restoreScrollPosition=function(){var e=function(t,n,i,o){void 0===i&&(i=!0),void 0===o&&(o=t);var r=(t.attr(n)||"").split(",");r.length>1&&(o.scrollLeft(r[0]),o.scrollTop(r[1])),t.removeAttr(n),i&&t.children().each((function(t,i){return e($(i),n)}))};e(this.$page,"data-scroll-position"),e(this.$page,"data-window-scroll-position",!1,$(window))},t.prototype.canDeactivate=function(){var e;return!1!==(e=this.onBeforePageLeave())&&(e=(this.App.onBeforePageLeave||o.noop)(this.App.activePageName,this.App.activePage)),void 0===e||e},t.prototype.ngAfterViewInit=function(){var e=this;this.route.snapshot.data._cache_page=this.canReuse(),this.pageDirective&&(this.$page=this.pageDirective.$element.parent(),o.isIos()&&this.$page.addClass("ios-page"),o.isAndroid()&&this.$page.addClass("android-page")),this.restoreLastPageSnapshot(),this.loadScripts().then((function(){e.runPageTransition().then((function(){e.compilePageContent=!0,setTimeout((function(){e.onPageContentReady=function(){e.fragmentsLoaded$.subscribe(o.noop,o.noop,(function(){e.invokeOnReady()})),o.unMuteWatchers(),e.viewInit$.complete(),e.onPageContentReady=o.noop}}),0)}))}))},t.prototype.ngOnDestroy=function(){this.savePageSnapShot(),this.destroy$.complete()},t.prototype.onReady=function(){},t.prototype.onBeforePageReady=function(){},t.prototype.onBeforePageLeave=function(){},t.prototype.onPageContentReady=function(){},t.prototype.canReuse=function(){return!(!this.pageDirective||!this.pageDirective.cache)},t.prototype.mute=function(){var e=function(e){e&&e.mute&&e.mute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.unmute=function(e){void 0===e&&(e=this);var t=function(e){e&&e.unmute&&e.unmute()};_.each(this.Widgets,t),_.each(this.Variables,t),_.each(this.Actions,t)},t.prototype.ngOnAttach=function(){var e=this;if(this.route.snapshot.data._cache_page=this.canReuse(),this.registerPageParams(),this.App.lastActivePageName=this.App.activePageName,this.App.activePageName=this.pageName,this.App.activePage=this,this.activePageName=this.pageName,this.restoreLastPageSnapshot(),this.unmute(),this.App.Widgets=Object.create(this.Widgets),this.pageDirective&&this.pageDirective.refreshdataonattach){var t=function(e){e&&e.startUpdate&&e.invoke&&e.invoke()};_.each(this.Variables,t),_.each(this.Actions,t)}this.runPageTransition().then((function(){setTimeout((function(){return e.restoreScrollPosition()}),100),_.each(e.Widgets,(function(e){return e&&e.ngOnAttach&&e.ngOnAttach()})),e.appManager.notify("pageAttach",{name:e.pageName,instance:e})}))},t.prototype.ngOnDetach=function(){this.saveScrollPosition(),this.savePageSnapShot(),this.mute(),_.each(this.Widgets,(function(e){return e&&e.ngOnDetach&&e.ngOnDetach()})),this.appManager.notify("pageDetach",{name:this.pageName,instance:this})},t.prototype.ngAfterContentInit=function(){this.onBeforePageReady()},t.clear=function(){t.lastPageSnapShot&&(t.lastPageSnapShot.remove(),t.lastPageSnapShot=null)},t}(te);pe.lastPageSnapShot=null,pe.decorators=[{type:t.Directive}],pe.propDecorators={pageDirective:[{type:t.ViewChild,args:[s.PageDirective]}],canDeactivate:[{type:t.HostListener,args:["window:beforeunload"]}]};var ue=function(e){function t(){var t=e.apply(this,ee([],Z(arguments)))||this;return t.compileContent=!1,t.destroy$=new l.Subject,t.viewInit$=new l.Subject,t}return K(t,e),t.prototype.getContainerWidgetInjector=function(){return this.containerWidget.inj||this.containerWidget.injector},t.prototype.init=function(){var t=this;this.App=this.injector.get(o.App),this.containerWidget=this.injector.get(c.WidgetRef),this.prefabMngr=this.injector.get(H),this.i18nService=this.injector.get(o.AbstractI18nService),this.scriptLoaderService=this.injector.get(o.ScriptLoaderService),this.Viewport=this.injector.get(o.Viewport),this.getContainerWidgetInjector().view.component.registerFragment&&this.getContainerWidgetInjector().view.component.registerFragment(),this.spa?this.pageDirective=this.injector.get(s.SpaPageDirective,null):this.pageDirective=this.injector.get(s.PageDirective,null),this.pageDirective&&(this.registerDestroyListener(this.pageDirective.subscribe("attach",(function(e){return t.ngOnAttach(e.refreshData)}))),this.registerDestroyListener(this.pageDirective.subscribe("detach",(function(){return t.ngOnDetach()})))),this.registerExpressions(),this.initUserScript(),this.registerWidgets(),this.initVariables(),this.registerProps(),this.defineI18nProps(),e.prototype.init.call(this)},t.prototype.registerWidgets=function(){this.Widgets={},this.Widgets={},this.containerWidget.Widgets=this.Widgets},t.prototype.initUserScript=function(){try{this.evalUserScript(this,this.App,this.injector.get(o.UtilsService))}catch(e){console.error("Error in evaluating prefab ("+this.prefabName+") script\n",e)}},t.prototype.registerChangeListeners=function(){this.containerWidget.registerPropertyChangeListener(this.onPropertyChange),this.containerWidget.registerStyleChangeListener(this.onPropertyChange)},t.prototype.registerDestroyListener=function(e){this.destroy$.subscribe(o.noop,o.noop,(function(){return e()}))},t.prototype.defineI18nProps=function(){this.appLocale=this.i18nService.getPrefabLocaleBundle(this.prefabName)},t.prototype.registerProps=function(){var e=this;this.prefabMngr.getConfig(this.prefabName).then((function(t){t&&(e.displayName=t.displayName,Object.entries(t.properties||{}).forEach((function(t){var n,i=Z(t,2),r=i[0],a=i[1],s=_.trim(a.value);_.startsWith(s,"bind:")&&(n=s.replace("bind:","")),Object.defineProperty(e,r,{get:function(){return e.containerWidget[r]},set:function(t){return e.containerWidget.widget[r]=t}}),n&&e.registerDestroyListener(o.$watch(n,e,{},(function(t){return e.containerWidget.widget[r]=t})))})),Object.entries(t.events||{}).forEach((function(t){var n=Z(t,2),i=n[0];n[1];e[i]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=i.substr(2).toLowerCase();e.containerWidget.invokeEventCallback(o,{$event:t[0],$data:t[1]})}})),Object.entries(t.methods||{}).forEach((function(t){var n=Z(t,2),i=n[0];n[1];e.containerWidget[i]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if(e[i])return e[i].apply(e,t)}catch(t){console.warn("error in executing prefab-"+e.prefabName+" method-"+i)}}}))),e.containerWidget.setProps(t),o.isIE()&&(e.containerWidget.widget=e.containerWidget.createProxy())}))},t.prototype.initVariables=function(){var e=this,t=this.injector.get(a.VariablesService).register(this.prefabName,this.getVariables(),this);this.Variables={},this.Actions={},this.containerWidget.Variables=this.Variables,this.containerWidget.Actions=this.Actions,Object.entries(t.Variables).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Variables[i]=o})),Object.entries(t.Actions).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Actions[i]=o})),this.viewInit$.subscribe(o.noop,o.noop,(function(){t.callback(t.Variables).catch(o.noop),t.callback(t.Actions)}))},t.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},t.prototype.invokeOnReady=function(){o.$invokeWatchers(!0,!0),this.onReady(),this.getContainerWidgetInjector().view.component.resolveFragment&&this.getContainerWidgetInjector().view.component.resolveFragment(),this.containerWidget.invokeEventCallback("load")},t.prototype.loadScripts=function(){var e=this;return new Promise((function(t){var n,i=e.prefabContainerDirective.$element.attr("scripts-to-load");i?(n=e.scriptLoaderService).load.apply(n,ee([],Z(i.split(",")))).then(t):t()}))},t.prototype.mute=function(){var e=function(e){e&&e.mute&&e.mute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.unmute=function(){var e=function(e){e&&e.unmute&&e.unmute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.ngOnAttach=function(e){if(this.unmute(),e){var t=function(e){e&&e.startUpdate&&e.invoke&&e.invoke()};_.each(this.Variables,t),_.each(this.Actions,t)}_.each(this.Widgets,(function(e){return e&&e.ngOnAttach&&e.ngOnAttach()}))},t.prototype.ngOnDetach=function(){this.mute(),_.each(this.Widgets,(function(e){return e&&e.ngOnDetach&&e.ngOnDetach()}))},t.prototype.ngAfterViewInit=function(){var e=this;this.loadScripts().then((function(){e.compileContent=!0,e.registerChangeListeners(),setTimeout((function(){e.viewInit$.complete(),e.fragmentsLoaded$.subscribe(o.noop,o.noop,(function(){return e.invokeOnReady()}))}),100)}))},t.prototype.ngOnDestroy=function(){this.destroy$.complete()},t.prototype.onPropertyChange=function(){},t.prototype.onReady=function(){},t}(te);ue.decorators=[{type:t.Directive}],ue.propDecorators={prefabContainerDirective:[{type:t.ViewChild,args:[p.PrefabContainerDirective]}]};var de=function(){function e(){}return e.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},e.prototype.overrideRouterOutlet=function(){var e=this,t=this.routerOutlet.attach,n=this.routerOutlet.detach;this.routerOutlet.attach=function(n){t.call(e.routerOutlet,n),n.instance.ngOnAttach()},this.routerOutlet.detach=function(){return n.call(e.routerOutlet)}},e.prototype.ngAfterViewInit=function(){var e=this;setTimeout((function(){e.overrideRouterOutlet()}),10)},e.prototype.init=function(){this.App=this.injector.get(o.App),this.App.activeLayoutName=this.layoutName,this.App.layoutPages=this.layoutPages,this.registerExpressions()},e.prototype.ngOnDestroy=function(){},e.prototype.canReuse=function(){},e.prototype.ngOnAttach=function(){},e.prototype.ngOnDetach=function(){},e.prototype.onActivate=function(e){_.extend(this,e)},e}();de.decorators=[{type:t.Directive}],de.propDecorators={routerOutlet:[{type:t.ViewChild,args:[n.RouterOutlet]}],pageDirective:[{type:t.ViewChild,args:[s.PageDirective]}]};var he,me=function(e){function t(){var t=e.apply(this,ee([],Z(arguments)))||this;return t.startupVariablesLoaded=!1,t.pageTransitionCompleted=!1,t.destroy$=new l.Subject,t.viewInit$=new l.Subject,t.formatsByLocale={timezone:""},t}return K(t,e),t.prototype.init=function(){o.muteWatchers(),this.App=this.injector.get(o.App),this.route=this.injector.get(n.ActivatedRoute),this.appManager=this.injector.get(j),this.navigationService=this.injector.get(o.AbstractNavigationService),this.scriptLoaderService=this.injector.get(o.ScriptLoaderService),this.i18nService=this.injector.get(o.AbstractI18nService),this.router=this.injector.get(n.Router),this.Viewport=this.injector.get(o.Viewport),this.layoutDirective=this.injector.get(s.LayoutDirective),this.registerExpressions(),this.initUserScript(),this.registerWidgets(),this.initVariables(),this.App.lastActivePageName=this.App.activePageName,this.App.activePageName=this.pageName,this.App.activePage=this,this.activePageName=this.pageName,this.registerPageParams(),this.defineI18nProps(),e.prototype.init.call(this)},t.prototype.registerWidgets=function(){this.Widgets=Object.create(ne),this.App.Widgets=Object.create(this.Widgets)},t.prototype.initUserScript=function(){try{this.evalUserScript(this,this.App,this.injector.get(o.UtilsService))}catch(e){console.error("Error in evaluating page ("+this.pageName+") script\n",e)}},t.prototype.registerPageParams=function(){var e=this,t=this.route.queryParams.subscribe((function(t){return e.pageParams=e.App.pageParams=_.extend({},t)}));this.registerDestroyListener((function(){return t.unsubscribe()}))},t.prototype.registerDestroyListener=function(e){this.destroy$.subscribe(o.noop,o.noop,(function(){return e()}))},t.prototype.defineI18nProps=function(){this.appLocale=this.i18nService.getAppLocale()},t.prototype.initVariables=function(){var e=this,t=this.injector.get(a.VariablesService).register(this.pageName,this.getVariables(),this);this.Variables=Object.create(this.App.Variables),this.Actions=Object.create(this.App.Actions),Object.entries(t.Variables).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Variables[i]=o})),Object.entries(t.Actions).forEach((function(t){var n=Z(t,2),i=n[0],o=n[1];return e.Actions[i]=o}));var n=this.viewInit$.subscribe(o.noop,o.noop,(function(){e.appManager.isAppVariablesFired()||(t.callback(e.App.Variables).catch(o.noop).then((function(){e.appManager.notify("app-variables-data-loaded",{pageName:e.pageName})})),t.callback(e.App.Actions),e.appManager.appVariablesReady(),e.appManager.isAppVariablesFired(!0)),t.callback(t.Variables).catch(o.noop).then((function(){e.appManager.notify("page-variables-data-loaded",{pageName:e.pageName}),e.startupVariablesLoaded=!0,setTimeout((function(){e.showPageContent=!0}),100)})),t.callback(t.Actions),n.unsubscribe()}))},t.prototype.setTimezone=function(e){this.i18nService.setTimezone(e,this)},t.prototype.registerExpressions=function(){var e=this.getExpressions();_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},t.prototype.runPageTransition=function(e){var n=this;e=e||this.navigationService.getPageTransition();var i=t.lastPageSnapShot;return new Promise((function(t){if(e&&!e.startsWith("none")&&i){var o=i.parent(),r=function(n){!t||n&&n.pseudoElement||(o.off("animationend",r),o.removeClass(e),o.children().first().remove(),t(),t=null)};e="page-transition page-transition-"+e,i.addClass("page-exit"),n.$page.addClass("page-entry"),o.addClass(e),o.on("animationend",r),setTimeout(r,1e3)}else t()})).then((function(){n.$page&&n.$page.removeClass("page-entry"),i&&(i.remove(),t.lastPageSnapShot=null),n.pageTransitionCompleted=!0}))},t.prototype.invokeOnReady=function(){this.onReady(),this.appManager.notify("highlightActiveLink",{pageName:this.pageName}),this.appManager.notify("pageReady",{name:this.pageName,instance:this}),(this.App.onPageReady||o.noop)(this.pageName,this)},t.prototype.loadScripts=function(){var e=this;return new Promise((function(t){var n,i=e.spaPageDirective&&e.spaPageDirective.$element.attr("scripts-to-load");i?(n=e.scriptLoaderService).load.apply(n,ee([],Z(i.split(",")))).then(t):t()}))},t.prototype.restoreLastPageSnapshot=function(){o.isMobileApp()&&t.lastPageSnapShot&&this.$page&&this.$page.parent().prepend(t.lastPageSnapShot)},t.prototype.savePageSnapShot=function(){t.lastPageSnapShot&&t.lastPageSnapShot.remove(),o.isMobileApp()&&this.$page&&(t.lastPageSnapShot=this.$page.clone(),this.$page.parents("app-root").prepend(t.lastPageSnapShot))},t.prototype.saveScrollPosition=function(){var e=function(t,n,i,o){void 0===i&&(i=!0),void 0===o&&(o=t),i&&t.children().each((function(t,i){return e($(i),n)}));var r=o.scrollLeft(),a=o.scrollTop();(r>0||a>0)&&t.attr(n,r+","+a)};e(this.$page,"data-scroll-position"),this.$page.attr("data-window-scroll-position",window.scrollX+","+window.scrollY)},t.prototype.restoreScrollPosition=function(){var e=function(t,n,i,o){void 0===i&&(i=!0),void 0===o&&(o=t);var r=(t.attr(n)||"").split(",");r.length>1&&(o.scrollLeft(r[0]),o.scrollTop(r[1])),t.removeAttr(n),i&&t.children().each((function(t,i){return e($(i),n)}))};e(this.$page,"data-scroll-position"),e(this.$page,"data-window-scroll-position",!1,$(window))},t.prototype.canDeactivate=function(){var e;return!1!==(e=this.onBeforePageLeave())&&(e=(this.App.onBeforePageLeave||o.noop)(this.App.activePageName,this.App.activePage)),void 0===e||e},t.prototype.ngAfterViewInit=function(){var e=this;this.route.snapshot.data._cache_page=this.canReuse(),this.layoutDirective&&(this.$page=this.layoutDirective.$element.parent(),o.isIos()&&this.$page.addClass("ios-page"),o.isAndroid()&&this.$page.addClass("android-page")),this.restoreLastPageSnapshot(),this.loadScripts().then((function(){e.runPageTransition().then((function(){e.compilePageContent=!0,setTimeout((function(){e.onPageContentReady=function(){e.fragmentsLoaded$.subscribe(o.noop,o.noop,(function(){e.invokeOnReady()})),o.unMuteWatchers(),e.viewInit$.complete(),e.onPageContentReady=o.noop}}),0)}))}))},t.prototype.ngOnDestroy=function(){this.savePageSnapShot(),this.destroy$.complete()},t.prototype.onReady=function(){},t.prototype.onBeforePageReady=function(){},t.prototype.onBeforePageLeave=function(){},t.prototype.onPageContentReady=function(){},t.prototype.canReuse=function(){return!(!this.spaPageDirective||!this.spaPageDirective.cache)},t.prototype.mute=function(){var e=function(e){e&&e.mute&&e.mute()};_.each(this.Widgets,e),_.each(this.Variables,e),_.each(this.Actions,e)},t.prototype.unmute=function(e){void 0===e&&(e=this);var t=function(e){e&&e.unmute&&e.unmute()};_.each(this.Widgets,t),_.each(this.Variables,t),_.each(this.Actions,t)},t.prototype.ngOnAttach=function(){var e=this;if(this.route.snapshot.data._cache_page=this.canReuse(),this.registerPageParams(),this.App.lastActivePageName=this.App.activePageName,this.App.activePageName=this.pageName,this.App.activePage=this,this.activePageName=this.pageName,this.restoreLastPageSnapshot(),this.unmute(),this.App.Widgets=Object.create(this.Widgets),this.spaPageDirective&&this.spaPageDirective.refreshdataonattach){var t=function(e){e&&e.startUpdate&&e.invoke&&e.invoke()};_.each(this.Variables,t),_.each(this.Actions,t)}this.runPageTransition().then((function(){setTimeout((function(){return e.restoreScrollPosition()}),100),_.each(e.Widgets,(function(e){return e&&e.ngOnAttach&&e.ngOnAttach()})),e.appManager.notify("pageAttach",{name:e.pageName,instance:e})})),this.appManager.notify("highlightActiveLink",{pageName:this.pageName})},t.prototype.ngOnDetach=function(){this.saveScrollPosition(),this.savePageSnapShot(),this.mute(),_.each(this.Widgets,(function(e){return e&&e.ngOnDetach&&e.ngOnDetach()})),this.appManager.notify("pageDetach",{name:this.pageName,instance:this})},t.prototype.ngAfterContentInit=function(){this.onBeforePageReady()},t.clear=function(){t.lastPageSnapShot&&(t.lastPageSnapShot.remove(),t.lastPageSnapShot=null)},t}(te);me.lastPageSnapShot=null,me.decorators=[{type:t.Directive}],me.propDecorators={spaPageDirective:[{type:t.ViewChild,args:[s.SpaPageDirective]}],canDeactivate:[{type:t.HostListener,args:["window:beforeunload"]}]},function(e){e.EVERYONE="Everyone",e.ANONYMOUS="Anonymous",e.AUTHENTICATED="Authenticated"}(he||(he={}));var fe=function(){function e(e,t,n,i){this.templateRef=e,this.viewContainerRef=t,this.securityService=n,this.inj=i,this.processed=!1;var o=this.securityService.get();this.securityEnabled=_.get(o,"securityEnabled"),this.isUserAuthenticated=_.get(o,"authenticated"),this.userRoles=_.get(o,"userInfo.userRoles")}return e.prototype.getWidgetRolesArrayFromStr=function(e){var t=/&#44;/g;return""===(e=e||"")?[]:_.split(e,",").map((function(e){return _.trim(e).replace(t,",")}))},e.prototype.matchRoles=function(e,t){return e.some((function(e){return _.includes(t,e)}))},e.prototype.hasAccessToWidget=function(e,t){return!!_.includes(e,he.EVERYONE)||(!(!_.includes(e,he.ANONYMOUS)||this.isUserAuthenticated)||(!(!_.includes(e,he.AUTHENTICATED)||!this.isUserAuthenticated)||this.isUserAuthenticated&&this.matchRoles(e,t)))},Object.defineProperty(e.prototype,"accessroles",{set:function(e){if(!this.processed){this.processed=!0;var t=this.getWidgetRolesArrayFromStr(e);!this.securityEnabled||this.hasAccessToWidget(t,this.userRoles)?this.viewContainerRef.createEmbeddedView(this.templateRef,this.inj.view.context):this.viewContainerRef.clear()}},enumerable:!1,configurable:!0}),e}();fe.decorators=[{type:t.Directive,args:[{selector:"[accessroles]"}]}],fe.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef},{type:r.SecurityService},{type:t.Injector}]},fe.propDecorators={accessroles:[{type:t.Input}]};var ge=function(){};ge.decorators=[{type:t.Component,args:[{selector:"app-spinner",template:'\n <div class="app-spinner" [ngClass]="classname" *ngIf="show">\n <div class="spinner-message">\n <i class="spinner-image animated infinite fa fa-circle-o-notch fa-spin"></i>\n <div class="spinner-messages">\n <p *ngFor="let value of spinnermessages" [textContent]="value"></p>\n </div>\n </div>\n </div>\n '}]}],ge.ctorParameters=function(){return[]},ge.propDecorators={show:[{type:t.Input}],spinnermessages:[{type:t.Input}],classname:[{type:t.Input}],arialabel:[{type:t.Input}]};var ve=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.toastrService=t,i.toastPackage=n,i.watchers=[],i.params={},i.pagename=i.message||"",i.generateParams(),i}return K(t,e),t.prototype.generateParams=function(){var e=this;_.forEach(this.options.partialParams,(function(t){_.isString(t.value)&&0===t.value.indexOf("bind:")?e.watchers.push(o.$watch(t.value.substr(5),e.options.context,{},(function(n){e.params[t.name]=n,o.$appDigest()}))):e.params[t.name]=t.value}))},t.prototype.generateDynamicComponent=function(){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(t){return e=$(".parent-custom-toast"),this.customToastRef.clear(),e[0].appendChild(this.customToastRef.createEmbeddedView(this.customToastTmpl).rootNodes[0]),[2]}))}))},t.prototype.ngAfterViewInit=function(){this.generateDynamicComponent()},t.prototype.ngOnDestroy=function(){_.forEach(this.watchers,(function(e){return e()})),e.prototype.ngOnDestroy.call(this)},t}(h.Toast);ve.decorators=[{type:t.Component,args:[{selector:"[custom-toaster-component]",template:'\n <div class="parent-custom-toast"></div>\n <ng-container #customToast></ng-container>\n <ng-template #customToastTmpl>\n <div wmContainer partialContainer content.bind="pagename">\n <div *ngFor="let param of params | keyvalue" wmParam hidden\n [name]="param.key" [value]="param.value"></div>\n </div>\n </ng-template>',preserveWhitespaces:!1}]}],ve.ctorParameters=function(){return[{type:h.ToastrService},{type:h.ToastPackage}]},ve.propDecorators={customToastRef:[{type:t.ViewChild,args:["customToast",{static:!0,read:t.ViewContainerRef}]}],customToastTmpl:[{type:t.ViewChild,args:["customToastTmpl"]}]};var ye=function(){function e(e,t,n,i,o){this.route=e,this.securityService=t,this.router=n,this.app=i,this.appManger=o}return e.prototype.ngOnInit=function(){var e=this;this.app.isPrefabType?this.router.navigate(["prefab-preview"]):this.app.isApplicationType?this.securityService.getPageByLoggedInUser().then((function(t){e.router.navigate([t])})):(this.router.navigate([o.getWmProjectProperties().homePage]),this.appManger.postAppTypeInfo())},e}();ye.decorators=[{type:t.Component,args:[{selector:"app-empty-page",template:"<div></div>"}]}],ye.ctorParameters=function(){return[{type:n.ActivatedRoute},{type:r.SecurityService},{type:n.Router},{type:o.App},{type:j}]};var be=function(t,n,i,o,r,a,s){var l=this;this.componentInstance=t,this.vcRef=n,this.elRef=i,this.prefabMngr=o,this.resolver=r,this.injector=a,this.componentRefProvider=s;var c=this.componentInstance.prefabName;this.prefabMngr.loadDependencies(c).then((function(){return Q(l,void 0,void 0,(function(){var t,n;return X(this,(function(i){switch(i.label){case 0:return[4,this.componentRefProvider.getComponentFactoryRef(c,e.ComponentType.PREFAB)];case 1:return(t=i.sent())&&(n=this.vcRef.createComponent(t,0,a),this.elRef.nativeElement.appendChild(n.location.nativeElement)),[2]}}))}))}))};be.decorators=[{type:t.Directive,args:[{selector:"[wmPrefab][prefabname]"}]}],be.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[c.WidgetRef]}]},{type:t.ViewContainerRef},{type:t.ElementRef},{type:H},{type:t.ComponentFactoryResolver},{type:t.Injector},{type:x}]};var we={DialogService:o.AbstractDialogService,i18nService:o.AbstractI18nService,statePersistence:o.StatePersistence,SpinnerService:o.AbstractSpinnerService,StatePersistenceService:o.StatePersistence,Viewport:o.Viewport,ToasterService:o.AbstractToasterService,Utils:o.UtilsService,CONSTANTS:o.ConstantService,FIELD_TYPE:o.FieldTypeService,FIELD_WIDGET:o.FieldWidgetService,DynamicComponentService:o.DynamicComponentRefProvider},Pe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},_e=function(){var e=this.httpService,t=function(t,n){var i=Array.from(arguments).slice(1);return Promise.resolve(e[t].apply(e,i))},n=function(){return t.apply(void 0,ee(["send"],Z(Array.from(arguments))))};return["get","post","head","put","delete","jsonp","patch"].forEach((function(e){return n[e]=t.bind(void 0,e)})),n},Oe=function(){function e(e,t,n,i,r,a){this.inj=e,this.i18nService=t,this.statePersistence=n,this.httpService=i,this.securityService=r,this.routeReuseStrategy=a,this.Variables={},this.Actions={},this.onAppVariablesReady=Pe,this.onBeforeAppReady=Pe,this.onSessionTimeout=Pe,this.onPageReady=Pe,this.onBeforePageLeave=Pe,this.onBeforeServiceCall=Pe,this.onServiceSuccess=Pe,this.onServiceError=Pe,this.dynamicComponentContainerRef={},this.changeLocale=this.i18nService.setSelectedLocale.bind(this.i18nService),this.getSelectedLocale=this.i18nService.getSelectedLocale.bind(this.i18nService),this.setTimezone=this.i18nService.setTimezone.bind(this.i18nService),this.setwidgetLocale=this.i18nService.setwidgetLocale.bind(this.i18nService),this._eventNotifier=new o.EventNotifier,this.landingPageName=o.getWmProjectProperties().homePage;var s=o.getWmProjectProperties();this.projectName=s.name,this.isPrefabType="PREFAB"===s.type,this.isApplicationType="APPLICATION"===s.type,this.isTemplateBundleType="TEMPLATEBUNDLE"===s.type,this.targetPlatform=s.platformType,this.httpService.registerOnSessionTimeout(this.on401.bind(this)),this.appLocale=this.i18nService.getAppLocale(),this.httpService.setLocale(this.appLocale)}return e.prototype.reload=function(){window.location.reload()},e.prototype.clearPageCache=function(e){this.routeReuseStrategy instanceof se&&this.routeReuseStrategy.reset(e)},e.prototype.notify=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this._eventNotifier.notify.apply(this._eventNotifier,arguments)},e.prototype.getDependency=function(e){if(o.isString(e)){if("HttpService"===e)return _e.call(this);var t=we[e]&&this.inj.get(we[e]);return!t&&this.inj._providers&&_.forEach(this.inj._providers,(function(n){if(_.isObject(n)&&n.__proto__.constructor.SERVICE_NAME===e)return t=n,!1})),t}return this.inj.get(e)},e.prototype.on401=function(){var e=_.get(this.securityService.get(),"userInfo");_.isEmpty(e)||this.onSessionTimeout()},e.prototype.subscribe=function(e,t){return this._eventNotifier.subscribe(e,t)},e.prototype.notifyApp=function(e,t,n){var i=_.get(this,"Actions.appNotification"),r=-1!==["PROCESS_REJECTED_IN_QUEUE"].indexOf(e);if(i){if(r)return void console.warn("App Error",e);t=t||"success",e=i.getMessage()||e,i.invoke({message:e,title:o.isDefined(n)?n:t.toUpperCase(),class:t,duration:"ERROR"===t.toUpperCase()?0:void 0})}else console.warn('The default Action "appNotification" doesn\'t exist in the app. App notified following error:\n',e)},e.prototype.registerExpressions=function(e){_.each(e,(function(e,t){o.registerFnByExpr(t,e[0],e[1])}))},e}();Oe.decorators=[{type:t.Injectable}],Oe.ctorParameters=function(){return[{type:t.Injector},{type:o.AbstractI18nService},{type:o.StatePersistence},{type:o.AbstractHttpService},{type:r.SecurityService},{type:n.RouteReuseStrategy}]};var Se=function(e){function t(t){var n=e.call(this)||this;return n.toaster=t,n}return K(t,e),t.prototype._showToaster=function(e,t,n,i){if(_.isNumber(i)&&(i={timeOut:i}),(i=i||{}).timeOut=o.isDefined(i.timeOut)?i.timeOut:0,i.enableHtml=o.isDefined(i.enableHtml),i.positionClass=i.positionClass||"toast-bottom-right",i.toastClass="toast",t||n){!i.bodyOutputType&&_.isObject(n)&&(n=JSON.stringify(n));var r=this.toaster[e];if(r)return r.call(this.toaster,n,t,i)}},t.prototype.success=function(e,t){return this._showToaster("success",e,t,{timeOut:5e3})},t.prototype.error=function(e,t){return this._showToaster("error",e,t,{timeOut:0})},t.prototype.info=function(e,t){return this._showToaster("info",e,t,{timeOut:0})},t.prototype.warn=function(e,t){return this._showToaster("warning",e,t,{timeOut:0})},t.prototype.show=function(e,t,n,i){return this._showToaster(e,t,n,i)},t.prototype.hide=function(e){e?this.toaster.clear(e.toastId):this.toaster.clear()},t.prototype.showCustom=function(e,t){if(e)return(t=t||{}).toastComponent=ve,t.toastClass="custom-toaster",t.timeOut=o.isDefined(t.timeOut)?t.timeOut:0,t.enableHtml=o.isDefined(t.enableHtml),t.positionClass=t.positionClass||"toast-bottom-right",t.toastClass="toast",this.toaster.show(e,"",t)},t.prototype.setToasterConfig=function(e){_.isObject(e)?_.merge(this.toaster.toastrConfig,e):console.warn("Please pass a valid options object, For Example : {maxOpened: 1, autoDismiss: true}")},t}(o.AbstractToasterService);Se.decorators=[{type:t.Injectable}],Se.ctorParameters=function(){return[{type:h.ToastrService}]};var Ee=["ar","ar-001","ar-ae","ar-bh","ar-dz","ar-eg","ar-iq","ar-jo","ar-kw","ar-lb","ar-ly","ar-ma","ar-om","ar-qa","ar-sa","ar-sd","ar-sy","ar-tn","ar-ye","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","pnb","ps","sd","ug","ur","yi"],Te=function(e){function t(t,n,i,o){var r=e.call(this)||this;return r.$http=t,r.bsLocaleService=n,r.appDefaults=i,r.inj=o,r.defaultSupportedLocale="en",r._isAngularLocaleLoaded=!1,r.formatsByLocale={timezone:"",number:""},r.appLocale={},r.prefabLocale=new Map,r}return K(t,e),Object.defineProperty(t.prototype,"app",{get:function(){return this.inj.get(o.App)},enumerable:!1,configurable:!0}),t.prototype.updateLocaleDirection=function(){var e="ltr";Ee.includes(this.selectedLocale)&&(e="rtl"),o.setCSS(document.body,"direction",e)},t.prototype.init=function(){this.messages={},Object.setPrototypeOf(this.appLocale,this.messages)},t.prototype.getSelectedLocale=function(){return this.selectedLocale},t.prototype.getDefaultSupportedLocale=function(){return this.defaultSupportedLocale},t.prototype.getAppLocale=function(){return this.appLocale},t.prototype.getPrefabLocaleBundle=function(e){return this.prefabLocale.has(e)||this.prefabLocale.set(e,Object.create(this.appLocale)),this.prefabLocale.get(e)},t.prototype.extendPrefabMessages=function(e){var t=this;e.prefabMessages&&Object.keys(e.prefabMessages).forEach((function(n){var i=t.prefabLocale.get(n);i||(i=Object.create(t.appLocale),t.prefabLocale.set(n,i)),Object.assign(i,e.prefabMessages[n])}))},t.prototype.extendMessages=function(e){Object.assign(this.messages,e)},t.prototype.loadResource=function(e){return this.$http.get(e).toPromise().catch((function(){console.warn("error loading locale resource from "+e),Promise.resolve({})}))},t.prototype.loadAppLocaleBundle=function(){var e=this;this.loadResource("resources/i18n/"+this.selectedLocale+".json").then((function(t){e.extendMessages(t.messages),e.extendPrefabMessages(t),e.appDefaults.setFormats(t.formats)}))},t.prototype.loadMomentLocaleBundle=function(e){var t=this,n=o._WM_APP_PROJECT.cdnUrl||o._WM_APP_PROJECT.ngDest;if(this.selectedLocale!==this.defaultSupportedLocale){var i=n+"locales/moment/"+e+".js";o.loadScripts([i],!0).then((function(){moment.locale(t.selectedLocale);var n=moment.localeData(e);n=n&&n._config,w.defineLocale(t.selectedLocale,n),t.bsLocaleService.use(t.getSelectedLocale()||t.defaultSupportedLocale)}))}else moment.locale(this.defaultSupportedLocale)},t.prototype.loadAngularLocaleBundle=function(e){var t=this;return new Promise((function(n){var i=o._WM_APP_PROJECT.cdnUrl||o._WM_APP_PROJECT.ngDest;if(t.selectedLocale!==t.defaultSupportedLocale){var r=i+"locales/angular/global/"+e+".js";o.loadScripts([r],!0).then((function(){t._isAngularLocaleLoaded=!0,n()}),n)}else n()}))},t.prototype.loadCalendarLocaleBundle=function(e,t){void 0===t&&(t=!1);var n,i=o._WM_APP_PROJECT.cdnUrl||o._WM_APP_PROJECT.ngDest;return e?(n=i+"locales/fullcalendar/"+e+".js",t||!o.isMobile()&&!o.isMobileApp()&&this.selectedLocale!==this.defaultSupportedLocale?o.loadScripts([n],!0):void 0):Promise.resolve()},t.prototype.loadMomentTimeZoneBundle=function(e,t){var n=this;return new Promise((function(i){var r=(o._WM_APP_PROJECT.cdnUrl||o._WM_APP_PROJECT.ngDest)+"locales/moment-timezone/moment-timezone-with-data.js";o.loadScripts([r],!0).then((function(){var o=e,r=(e=o.timezone).indexOf("+");r>-1&&(r>0&&(e=e.substr(r)),o.timezone=_.find(moment.tz.names(),(function(t){return e===moment.tz(t).format("Z")})));var a=t&&t.formatsByLocale?t.formatsByLocale:n.formatsByLocale;Object.assign(a,o),i()}),i)}))},t.prototype.loadLocaleBundles=function(e){return e.moment&&this.loadMomentLocaleBundle(e.moment),e.fullCalendar&&window.FullCalendar&&this.loadCalendarLocaleBundle(e.fullCalendar),e.angular&&this.loadAppLocaleBundle(),this.loadAngularLocaleBundle(e.angular)},t.prototype.setTimezone=function(e,t){this.loadMomentTimeZoneBundle(e,t)},t.prototype.getTimezone=function(e){var t=_.get(this.app,"activePage.formatsByLocale.timezone"),n=_.get(e,"formatsByLocale.timezone");return n||(t||this.formatsByLocale.timezone)},t.prototype.getFormatsByLocale=function(){return this.formatsByLocale},t.prototype.setSelectedLocale=function(e){var t=this;_.isObject(e)&&(e=e.datavalue);var n=o.getWmProjectProperties().supportedLanguages[e],i=Object.keys(o.getWmProjectProperties().supportedLanguages);return _.includes(i,e)&&e&&e!==this.selectedLocale?(o.setSessionStorageItem("selectedLocale",e),this.selectedLocale=e,this.init(),this.loadLocaleBundles(n).then((function(){return t.updateLocaleDirection()}))):Promise.resolve()},t.prototype.deduceAppLocale=function(){var e=this.getAcceptedLanguages(),t=o.getWmProjectProperties().defaultLanguage;e.push(t);var n=o.getWmProjectProperties().preferBrowserLang;n=!n||("true"===n||!0===n);var i,r=Object.keys(o.getWmProjectProperties().supportedLanguages)||[this.defaultSupportedLocale],s=n?void 0:t;if(a.CONSTANTS.hasCordova){var l=[];_.forEach(e,(function(e){var t=_.find(r,(function(t){return e===t}))||_.find(r,(function(t){return e.startsWith(t)}));t&&l.push(t)})),i=l[0]}var c=o.getSessionStorageItem("selectedLocale")||s||i||_.intersection(e,r)[0]||this.defaultSupportedLocale;return r=r||[c],c||r[0]},t.prototype.loadDefaultLocale=function(){var e=this.deduceAppLocale();return this.setSelectedLocale(e)},t.prototype.getLocalizedMessage=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return o.replace(this.appLocale[e],t)},t.prototype.getAcceptedLanguages=function(){var e;return e=a.CONSTANTS.hasCordova?navigator.languages||[navigator.language]:(e=decodeURIComponent(o.getWmProjectProperties().preferredLanguage||"")).split(",").map((function(e){return e.split(";")[0]})),_.map(e,_.toLower)},t.prototype.initCalendarLocale=function(){return"en"!==this.selectedLocale?this.loadCalendarLocaleBundle(this.selectedLocale,!0):Promise.resolve()},t.prototype.isAngularLocaleLoaded=function(){return this._isAngularLocaleLoaded},t.prototype.setwidgetLocale=function(e){this.formatsByLocale.number=e.number},t.prototype.getwidgetLocale=function(){return this.formatsByLocale},t}(o.AbstractI18nService);Te.decorators=[{type:t.Injectable}],Te.ctorParameters=function(){return[{type:u.HttpClient},{type:P.BsLocaleService},{type:o.AppDefaults},{type:t.Injector}]};var Re=function(e){function t(){var t=e.call(this)||this;return t.spinnerId=0,t.messageSource=new l.Subject,t.messagesByContext={},t}return K(t,e),t.prototype.getMessageSource=function(){return this.messageSource},t.prototype.showContextSpinner=function(e,t,n){var i=$('[name="'+e+'"]');if(this.messagesByContext[e]=this.messagesByContext[e]||{},0!==Object.keys(this.messagesByContext[e]).length)this.messagesByContext[e][n]=t,this.messagesByContext[e].finalMessage=this.messagesByContext[e].finalMessage+" "+this.messagesByContext[e][n],i.find(".spinner-messages-container").html(this.messagesByContext[e].finalMessage);else{var o=$('<div class="app-spinner">\n <div class="spinner-message" aria-label="loading gif">\n <i class="spinner-image animated infinite fa fa-circle-o-notch fa-spin"></i>\n <div class="spinner-messages">\n <p class="spinner-messages-container"></p>\n </div>\n </div>\n </div>');this.messagesByContext[e][n]=t,this.messagesByContext[e].finalMessage=this.messagesByContext[e][n],o.find(".spinner-messages-container").html(this.messagesByContext[e].finalMessage),i.prepend(o)}return n},t.prototype.showAppSpinner=function(e,t){this.messagesByContext.page=this.messagesByContext.page||{},this.messagesByContext.page[t]=e,this.messageSource.next({show:!0,message:e,messages:_.values(this.messagesByContext.page)})},t.prototype.hideContextSpinner=function(e,t){delete this.messagesByContext[e][t],1===Object.keys(this.messagesByContext[e]).length&&(this.messagesByContext[e]={}),$('[name="'+e+'"]').find(".app-spinner").remove()},t.prototype.show=function(e,t,n,i,o){return t=t||++this.spinnerId,i&&"page"!==i?this.showContextSpinner(i,e,t):(this.showAppSpinner(e,t),t)},t.prototype.hide=function(e){var t=_.findKey(this.messagesByContext,(function(t){return _.includes(_.keys(t),e)}))||"page";if("page"===t)if(e){delete this.messagesByContext[t][e];var n=_.values(this.messagesByContext[t]);this.messageSource.next({show:!!n.length,messages:_.values(this.messagesByContext[t])})}else this.messagesByContext[t]={};else this.hideContextSpinner(t,e)},t}(o.AbstractSpinnerService);Re.decorators=[{type:t.Injectable}],Re.ctorParameters=function(){return[]};var Ae="body >app-root",Ce=function(){function e(e,t,i){var o=this;this.app=e,this.router=t,this.zone=i,this.history=new De,this.isPageAddedToHistory=!1,this.router.events.subscribe((function(e){if(e instanceof n.NavigationStart){var t=e.url,i={},r=void 0;o.isPageAddedToHistory||(o.isPageAddedToHistory=!1,t.indexOf("?")>0?(t.substr(t.indexOf("?")+1).split("&").forEach((function(e){var t=e.split("=");i[t[0]]=t[1]})),r=t.substr(0,t.indexOf("?"))):r=t,"/"===r[0]&&(r=r.substr(1)),r&&(delete i.name,o.history.push(new Ie(r,i,o.transition))))}}))}return e.prototype.getPageTransition=function(){return _.isEmpty(this.transition)||_.isEqual("none",this.transition)?null:this.transition},e.prototype.goToPage=function(e,t){var n=this;this.transition=t.transition||"",this.history.getCurrentPage()&&(this.isPageAddedToHistory=!0),this.history.push(new Ie(e,t.urlParams,this.transition)),this.zone.run((function(){return n.router.navigate(["/"+e],{queryParams:t.urlParams})}))},e.prototype.goToPrevious=function(){this.history.getPagesCount()&&(this.transition=this.history.getCurrentPage().transition,_.isEmpty(this.transition)||(this.transition+="-exit"),this.history.pop(),this.isPageAddedToHistory=!0,window.history.back())},e.prototype.goToView=function(e,t,n){var i=this,o=(t=t||{}).pageName,r=t.transition||"",s=t.$event,l=this.app.activePage,c=n&&n._context&&n._context.prefabName;if(this.app.isPrefabType)this.goToElementView($(Ae).find('[name="'+e+'"]'),e,o,n);else if(o===l.activePageName||c)c&&this.isPrefabWithNameExists(c)?this.goToElementView($('[prefabName="'+c+'"]').find('[name="'+e+'"]'),e,o,n):o&&o!==l.activePageName?this.app.notifyApp(a.CONSTANTS.WIDGET_DOESNT_EXIST,"error"):this.goToElementView($(Ae).find('[name="'+e+'"]'),e,o,n);else if(this.isPartialWithNameExists(o))this.goToElementView($('[partialcontainer][content="'+o+'"]').find('[name="'+e+'"]'),e,o,n);else{this.goToPage(o,{viewName:e,$event:s,transition:r,urlParams:t.urlParams});var p=this.app.subscribe("pageReady",(function(t){i.goToElementView($(Ae).find('[name="'+e+'"]'),e,o,n),p()}))}},e.prototype.goToElementView=function(e,t,n,i){var o,r,a=this,s=this.app.activePage;if(e.length)switch(this.app.isPrefabType||n!==s.activePageName||(e=this.getViewElementInActivePage(e)),(o=e[0].widget).widgetType){case"wm-accordionpane":this.showAncestors(e,i),o.expand();break;case"wm-tabpane":this.showAncestors(e,i),o.select();break;case"wm-segment-content":this.showAncestors(e,i),o.navigate();break;case"wm-panel":o.expanded=!0}else r=this.showAncestorDialog(t),setTimeout((function(){r&&a.goToElementView($('[name="'+t+'"]'),t,n,i)}))},e.prototype.getViewElementInActivePage=function(e){var t;return e.length>1&&(t=_.filter(e,(function(e){if(_.isEmpty($(e).closest('[data-role = "partial"]'))&&_.isEmpty($(e).closest("[wmprefabcontainer]")))return e})))&&(e=$(t)),e},e.prototype.isPartialWithNameExists=function(e){return $('[partialcontainer][content="'+e+'"]').length},e.prototype.isPrefabWithNameExists=function(e){return $('[prefabName="'+e+'"]').length},e.prototype.showAncestors=function(e,t){e.parents('[wm-navigable-element="true"]').toArray().reverse().forEach((function(e){var t=e.widget;switch(t.widgetType){case"wm-accordionpane":t.expand();break;case"wm-tabpane":t.select();break;case"wm-segment-content":t.navigate();break;case"wm-panel":t.expanded=!0}}))},e.prototype.showAncestorDialog=function(e){var t;return $("app-root [dialogtype]").each((function(){var n=$(this);if($(n.html()).find('[name="'+e+'"]').length)return t=n.attr("name"),!1})),t},e}();Ce.decorators=[{type:t.Injectable}],Ce.ctorParameters=function(){return[{type:o.App},{type:n.Router},{type:t.NgZone}]};var Ie=function(){function e(e,t,n){this.name=e,this.urlParams=t,this.transition=n,this.transition=_.isEmpty(this.transition)?null:this.transition}return e.prototype.isEqual=function(e){return e&&e.name===this.name&&_.isEqual(e.urlParams,this.urlParams)},e}(),De=function(){function e(){this.stack=[]}return e.prototype.getCurrentPage=function(){return this.currentPage},e.prototype.getPagesCount=function(){return this.stack.length},e.prototype.isLastVisitedPage=function(e){return this.getLastPage().isEqual(e)},e.prototype.push=function(e){this.currentPage&&this.stack.push(this.currentPage),this.currentPage=e},e.prototype.pop=function(){return this.currentPage=this.stack.pop(),this.currentPage},e.prototype.getLastPage=function(){return this.stack.length>0?this.stack[this.stack.length-1]:void 0},e}(),Ne=function(){function e(){}return e.prototype.setFormats=function(e){var t=e.date,n=e.time,i=t&&n?t+" "+n:void 0,o=e.currency;this.dateFormat=t,this.timeFormat=n,this.dateTimeFormat=i,this.currencyCode=o},e}();Ne.decorators=[{type:t.Injectable}],Ne.ctorParameters=function(){return[]};var xe=!1,ke=function(){function e(e,t){this.securityService=e,this.appManager=t}return e.prototype.loadSecurityConfig=function(){return xe?Promise.resolve(!0):this.appManager.loadSecurityConfig().then((function(){return xe=!0}))},e.prototype.isAuthenticated=function(){var e=this;return this.loadSecurityConfig().then((function(){return new Promise((function(t,n){e.securityService.isAuthenticated(t,n)}))}))},e.prototype.canActivate=function(e){var t=this;return this.isAuthenticated().then((function(n){return n?Promise.resolve(!0):(t.appManager.handle401(e.routeConfig.path,{queryParams:e.queryParams}),Promise.resolve(!1))}))},e}();ke.decorators=[{type:t.Injectable}],ke.ctorParameters=function(){return[{type:r.SecurityService},{type:j}]};var Me=function(){function e(e,t,n,i,o){this.securityService=e,this.authGuard=t,this.toasterService=n,this.app=i,this.appManager=o}return e.prototype.canActivate=function(e){var t=this,n=e.data.allowedRoles;return this.authGuard.isAuthenticated().then((function(i){if(i){var o=t.securityService.get().userInfo.userRoles;return _.intersection(n,o).length>0?Promise.resolve(!0):(t.appManager.notifyApp(t.app.appLocale.LABEL_ACCESS_DENIED||"Access Denied","error"),Promise.resolve(!1))}return t.appManager.handle401(e.routeConfig.path,{queryParams:e.queryParams}),Promise.resolve(!1)}))},e}();Me.decorators=[{type:t.Injectable}],Me.ctorParameters=function(){return[{type:r.SecurityService},{type:ke},{type:o.AbstractToasterService},{type:o.App},{type:j}]};var Le=function(){function e(e,t){this.app=e,this.appManager=t}return e.prototype.canActivate=function(e){return this.appManager.notifyApp(this.app.appLocale.MESSAGE_PAGE_NOT_FOUND||"The page you are trying to reach is not available","error"),Promise.resolve(!1)},e}();Le.decorators=[{type:t.Injectable}],Le.ctorParameters=function(){return[{type:o.App},{type:j}]};var Fe=!1,je=function(){function e(e,t,n,i){this.inj=e,this.app=t,this.utilService=n,this.appJsProvider=i,this.appManager=this.inj.get(j)}return e.prototype.resolve=function(){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(t){switch(t.label){case 0:if(Fe)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.appJsProvider.getAppScriptFn()];case 2:return t.sent()(this.app,this.utilService,this.inj),[3,4];case 3:return e=t.sent(),console.warn("Error in executing app.js",e),[3,4];case 4:return Fe=!0,[2,!0]}}))}))},e}();je.decorators=[{type:t.Injectable}],je.ctorParameters=function(){return[{type:t.Injector},{type:o.App},{type:o.UtilsService},{type:M}]};var Be=!1,Ge=function(){function e(e,t,n){this.appManager=e,this.appJsProvider=t,this.customPipeManager=n}return e.prototype.resolve=function(){return!(!this.appManager.isPrefabType()&&!this.appManager.isTemplateBundleType())||(Be||(this.appJsProvider.loadFormatterConfigScript(this.loadedFormatterScript.bind(this)),Be=!0),Be)},e.prototype.loadedFormatterScript=function(e){try{var t=e;for(var n in t||console.warn("Please return valid formatter object"),t)this.customPipeManager.setCustomPipe(n,t[n])}catch(e){console.warn("Error in reading formatters.js",e)}},e}();Ge.decorators=[{type:t.Injectable}],Ge.ctorParameters=function(){return[{type:j},{type:F},{type:o.CustomPipeManager}]};var Ve=function(){function e(e){this.i18nService=e}return e.prototype.resolve=function(){return this.i18nService.loadDefaultLocale()},e}();Ve.decorators=[{type:t.Injectable}],Ve.ctorParameters=function(){return[{type:o.AbstractI18nService}]};var $e=function(){function e(e,n,r,a){var s,l=this;this.compiler=e,this.injector=n,this.domSanitizer=r,this.i18service=a,this._locale=o.getSessionStorageItem("selectedLocale")||"en",this.formatsByLocale=null===(s=this.i18service)||void 0===s?void 0:s.getwidgetLocale(),this.preparePipeMeta=function(e,t,n,i){return void 0===i&&(i=[]),{type:{reference:e,diDeps:i},name:t,pure:n}},this._pipeData=[this.preparePipeMeta(i.AsyncPipe,"async",!1,[t.ChangeDetectorRef]),this.preparePipeMeta(i.SlicePipe,"slice",!1),this.preparePipeMeta(i.PercentPipe,"percent",!0,[this._locale]),this.preparePipeMeta(i.I18nPluralPipe,"i18nPlural",!0,[i.NgLocalization]),this.preparePipeMeta(i.I18nSelectPipe,"i18nSelect",!0),this.preparePipeMeta(i.KeyValuePipe,"keyvalue",!1,[t.KeyValueDiffers]),this.preparePipeMeta(c.FileIconClassPipe,"fileIconClass",!0),this.preparePipeMeta(c.FileExtensionFromMimePipe,"fileExtensionFromMime",!0),this.preparePipeMeta(c.StateClassPipe,"stateClass",!0),this.preparePipeMeta(c.FileSizePipe,"filesize",!0),this.preparePipeMeta(c.FilterPipe,"filter",!0),this.preparePipeMeta(i.UpperCasePipe,"uppercase",!0),this.preparePipeMeta(i.LowerCasePipe,"lowercase",!0),this.preparePipeMeta(i.JsonPipe,"json",!1),this.preparePipeMeta(i.DecimalPipe,"number",!0,[this._locale]),this.preparePipeMeta(i.TitleCasePipe,"titlecase",!0),this.preparePipeMeta(i.CurrencyPipe,"currency",!0,[this._locale]),this.preparePipeMeta(i.DatePipe,"date",!0,[this._locale]),this.preparePipeMeta(c.ToDatePipe,"toDate",!0,[new i.DatePipe(this._locale)]),this.preparePipeMeta(c.ToNumberPipe,"toNumber",!0,[new i.DecimalPipe(this._locale),this.i18service]),this.preparePipeMeta(c.ToCurrencyPipe,"toCurrency",!0,[new i.DecimalPipe(this._locale),this.i18service]),this.preparePipeMeta(c.PrefixPipe,"prefix",!0),this.preparePipeMeta(c.SuffixPipe,"suffix",!0),this.preparePipeMeta(c.TimeFromNowPipe,"timeFromNow",!0),this.preparePipeMeta(c.NumberToStringPipe,"numberToString",!0,[new i.DecimalPipe(this._locale)]),this.preparePipeMeta(c.StringToNumberPipe,"stringToNumber",!0),this.preparePipeMeta(c.CustomPipe,"custom",!0,[this.injector.get(o.CustomPipeManager)]),this.preparePipeMeta(c.TrustAsPipe,"trustAs",!0,[this.domSanitizer]),this.preparePipeMeta(c.SanitizePipe,"sanitize",!0,[this.domSanitizer])],this._pipeMeta=new Map,this._pipeData.forEach((function(e){l._pipeMeta.set(e.name,e)}))}return e.prototype.unknownPipe=function(e){throw Error("The pipe '"+e+"' could not be found")},e.prototype.meta=function(e){var t=this._pipeMeta.get(e);return t||this.unknownPipe(e),t},e.prototype.getPipeNameVsIsPureMap=function(){var e=new Map;return this._pipeMeta.forEach((function(t,n){e.set(n,t.pure)})),e},e.prototype.resolveDep=function(e){return this.injector.get(e.token.identifier.reference)},e.prototype.getInstance=function(e){var t,n,i=this.meta(e).type,o=i.reference,r=i.diDeps;if(o||this.unknownPipe(e),r.length){var a=[];try{for(var s=J(r),l=s.next();!l.done;l=s.next()){var c=l.value;a.push(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return new(o.bind.apply(o,ee([void 0],Z(a))))}return new o},e}();$e.\u0275prov=C.\u0275\u0275defineInjectable({factory:function(){return new $e(C.\u0275\u0275inject(C.Compiler),C.\u0275\u0275inject(C.INJECTOR),C.\u0275\u0275inject(D.DomSanitizer),C.\u0275\u0275inject(I.AbstractI18nService))},token:$e,providedIn:"root"}),$e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],$e.ctorParameters=function(){return[{type:t.Compiler},{type:t.Injector},{type:d.DomSanitizer},{type:o.AbstractI18nService}]};var Ue=function(){function e(e,t,i,r,a,s,l,c,p,u){var d,h=this;this.elRef=i,this.oAuthService=r,this.dialogService=a,this.spinnerService=s,this.router=c,this.app=p,this.appManager=u,this.startApp=!1,this.isApplicationType=!1,this.spinner={show:!1,messages:[],arialabel:""},this.isOAuthDialogOpen=!1,o.setPipeProvider(e),o.setNgZone(l),o.setAppRef(t),this.isApplicationType="APPLICATION"===o.getWmProjectProperties().type,this.appManager.beforeAppReady(),r.getOAuthProvidersAsObservable().subscribe((function(e){h.providersConfig=e,e.length?h.showOAuthDialog():h.closeOAuthDialog()})),this.spinnerService.getMessageSource().asObservable().subscribe((function(e){setTimeout((function(){h.spinner.show=e.show,h.spinner.messages=e.messages,h.spinner.arialabel=e.messages.toString()}))})),O.setTheme("bs3");var m=o.noop;this.router.events.subscribe((function(e){if(e instanceof n.NavigationStart){var t=e.url.split("?")[0];(t=t.substring(1))||(h.app.activeLayoutName="",h.app.layoutPages=[]),d=h.app.activeLayoutName&&h.app.layoutPages&&h.app.layoutPages.length&&h.app.layoutPages.includes(t)?h.spinnerService.show("","wmRouterOutlet","","wmRouterOutlet"):h.spinnerService.show("","globalSpinner");var i=document.querySelector("app-page-outlet");i&&o.addClass(i,"page-load-in-progress");var r=Date.now();m=function(){h.spinnerService.hide(d);var e=document.querySelector("app-page-outlet");e&&o.removeClass(e,"page-load-in-progress"),m=o.noop,h.app.activePageLoadTime=Date.now()-r}}else(e instanceof n.NavigationEnd||e instanceof n.NavigationCancel||e instanceof n.NavigationError)&&setTimeout((function(){m()}),1e3)})),this.appManager.subscribe("pageReady",(function(){m()})),this.appManager.subscribe("pageAttach",(function(){m()}))}return e.prototype.showOAuthDialog=function(){this.isOAuthDialogOpen||(this.isOAuthDialogOpen=!0,this.dialogService.open("oAuthLoginDialog",this))},e.prototype.closeOAuthDialog=function(){this.isOAuthDialogOpen&&(this.isOAuthDialogOpen=!1,this.dialogService.close("oAuthLoginDialog",this))},e.prototype.start=function(){var e=this;setTimeout((function(){e.startApp=!0})),setTimeout((function(){e.app.dynamicComponentContainerRef=e.dynamicComponentContainerRef,e.overrideRouterOutlet()}),10)},e.prototype.overrideRouterOutlet=function(){var e=this,t=this.routerOutlet.attach,n=this.routerOutlet.detach;this.routerOutlet.attach=function(n){t.call(e.routerOutlet,n),n.instance.ngOnAttach()},this.routerOutlet.detach=function(){return e.app.activePage.ngOnDetach(),n.call(e.routerOutlet)}},e.prototype.ngAfterViewInit=function(){var e=this;o.hasCordova()&&!window.wmDeviceReady?document.addEventListener("wmDeviceReady",(function(){return e.start()})):this.start()},e.prototype.ngDoCheck=function(){o.$invokeWatchers()},e}();Ue.decorators=[{type:t.Component,args:[{selector:"app-root",template:'<ng-container *ngIf="startApp">\n <router-outlet></router-outlet>\n <div wmContainer partialContainer content="Common" hidden class="ng-hide" *ngIf="isApplicationType"></div>\n <app-spinner name="globalspinner" classname="global-spinner" role="alert" aria-live="assertive" [attr.aria-label]="spinner.arialabel || \'Loading\'" [show]="spinner.show" [spinnermessages]="spinner.messages"></app-spinner>\n <div wmDialog name="oAuthLoginDialog" title="Application is requesting you to sign in with"\n close.event="closeOAuthDialog()">\n <ng-template #dialogBody>\n <ul class="list-items">\n <li class="list-item" *ngFor="let provider of providersConfig">\n <button class="btn" (click)="provider.invoke()">{{provider.name}}</button>\n </li>\n </ul>\n </ng-template>\n </div>\n <div wmConfirmDialog name="_app-confirm-dialog" title.bind="title" message.bind="message" oktext.bind="oktext"\n canceltext.bind="canceltext" closable="false" iconclass.bind="iconclass"\n escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>\n <div *ngIf="!isApplicationType" wmConfirmDialog name="PrefabConfirmDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"\n canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"\n escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>\n <div *ngIf="!isApplicationType" wmAlertDialog name="PrefabAlertDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"\n canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"\n escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>\n <div wmAppExt></div>\n <i id="wm-mobile-display"></i>\n</ng-container>\n\x3c!--Dummy container to create the component dynamically--\x3e\n<ng-container #dynamicComponent></ng-container>\n',encapsulation:t.ViewEncapsulation.None}]}],Ue.ctorParameters=function(){return[{type:$e},{type:t.ApplicationRef},{type:t.ElementRef},{type:b.OAuthService},{type:o.AbstractDialogService},{type:o.AbstractSpinnerService},{type:t.NgZone},{type:n.Router},{type:o.App},{type:j}]},Ue.propDecorators={routerOutlet:[{type:t.ViewChild,args:[n.RouterOutlet]}],dynamicComponentContainerRef:[{type:t.ViewChild,args:["dynamicComponent",{read:t.ViewContainerRef}]}]};var We=function(){function e(){this.wmHttpRequest=new y.WmHttpRequest,this.wmHttpResponse=new y.WmHttpResponse}return e.prototype.createSubject=function(){return new l.Subject},e.prototype.intercept=function(e,t){var n,i,o=this;if(a.appManager&&a.appManager.appOnBeforeServiceCall){var r=this.wmHttpRequest.angularToWmRequest(e);(n=a.appManager.appOnBeforeServiceCall(r))&&(n=this.wmHttpRequest.wmToAngularRequest(n),e=n)}return t.handle(e).pipe(S.tap((function(e){if(e&&4===e.type&&a.appManager&&a.appManager.appOnServiceSuccess){var t=o.wmHttpResponse.angularToWmResponse(e);(i=a.appManager.appOnServiceSuccess(t.body,t))&&(i=o.wmHttpResponse.wmToAngularResponse(i),_.extend(e,i))}}),(function(t){if(t._401Subscriber=o.createSubject(),a.httpService.isPlatformSessionTimeout(t)&&a.httpService.handleSessionTimeout(e,t._401Subscriber),a.appManager&&a.appManager.appOnServiceError){var n=o.wmHttpResponse.angularToWmResponse(t);(i=a.appManager.appOnServiceError(n.message,n))&&(i=o.wmHttpResponse.wmToAngularResponse(i),_.extend(t,i))}})))},e}();We.decorators=[{type:t.Injectable}],We.ctorParameters=function(){return[]};var qe="PREFAB",ze=function(){function e(e){var t=this;this.prefabManager=e,window.addEventListener("message",(function(e){if((e.data&&e.data.context)===qe){var n=e.data.action,i=e.data.payload;"init"===n?t.init():"set-property"===n?t.setProperty(i):"get-outbound-properties"===n?t.getOutboundProps():"invoke-script"===n&&t.invokeScript(i)}}))}return e.prototype.postMessage=function(e,t){var n={context:qe,action:e,payload:t};window.top.postMessage(n,"*")},e.prototype.setupEventListeners=function(){var e=this;this.prefabInstance.invokeEventCallback=function(t,n){void 0===n&&(n={}),e.postMessage("event-log",{name:t,data:n})}},e.prototype.init=function(){var e=this;this.previewMode=!0,this.prefabInstance.readyState.subscribe((function(){}),(function(){}),(function(){e.prefabManager.getConfig("__self__").then((function(t){e.config=t,e.postMessage("config",t),e.setupEventListeners()}))}))},e.prototype.setProperty=function(e){this.prefabInstance.widget[e.name]=e.value},e.prototype.isOutBoundProp=function(e){return"out-bound"===e.bindable||"in-out-bound"===e.bindable},e.prototype.getOutboundProps=function(){var e,t,n={};try{for(var i=J(Object.entries(this.config.properties||{})),o=i.next();!o.done;o=i.next()){var r=Z(o.value,2),a=r[0],s=r[1];this.isOutBoundProp(s)&&(n[a]=this.prefabInstance.widget[a])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}this.postMessage("outbound-properties",n)},e.prototype.invokeScript=function(e){var t="\n return "+e.script+";",n=new Function("Prefab",t)(this.prefabInstance);this.postMessage("method-output",{methodName:e.methodName,output:n})},e.prototype.ngAfterViewInit=function(){this.setupEventListeners(),this.postMessage("init")},e}();ze.decorators=[{type:t.Component,args:[{selector:"wm-prefab-preview",template:'\n <div class="prefab-preview row">\n <section wmPrefab name="prefab-preview" prefabname="__self__"></section>\n </div>\n '}]}],ze.ctorParameters=function(){return[{type:H}]},ze.propDecorators={prefabInstance:[{type:t.ViewChild,args:[p.PrefabDirective,{static:!0}]}]},T.initComponentsBuildTask();var He=new Map,Ye=function(e){var n=function(){};return n.decorators=[{type:t.NgModule,args:[{declarations:[e],imports:[wt],schemas:[t.CUSTOM_ELEMENTS_SCHEMA,t.NO_ERRORS_SCHEMA]}]}],n},Ke=function(e,n,i){void 0===i&&(i="");var o={template:n,styles:[i],encapsulation:t.ViewEncapsulation.None},r=function(){};return r.decorators=[{type:t.Component,args:[Object.assign(Object.assign({},o),{selector:e})]}],r},Qe=function(){function e(e,t,n){this.app=e,this.appManager=t,this.compiler=n,this.counter=1}return e.prototype.getComponentFactoryRef=function(e,t,n){return void 0===n&&(n={}),Q(this,void 0,void 0,(function(){var i,o,r;return X(this,(function(a){return i=He.get(e),t=n.transpile?E.transpile(t).markup:t,i&&!n.noCache||(o=Ke(e,t,n.styles),r=Ye(o),i=this.compiler.compileModuleAndAllComponentsSync(r).componentFactories.filter((function(e){return e.componentType===o}))[0],He.set(e,i)),[2,i]}))}))},e.prototype.addComponent=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),Q(this,void 0,void 0,(function(){var r,a;return X(this,(function(s){switch(s.label){case 0:return i.transpile=!o.isDefined(i.transpile)||i.transpile,i.noCache=!o.isDefined(i.noCache)||i.noCache,i.selector=o.isDefined(i.selector)?i.selector:"wm-dynamic-component-"+this.counter++,[4,this.getComponentFactoryRef(i.selector,t,i)];case 1:return r=s.sent(),a=this.app.dynamicComponentContainerRef.createComponent(r,0,_.get(i,"inj")),o.extendProto(a.instance,n),e.appendChild(a.location.nativeElement),[2]}}))}))},e}();Qe.decorators=[{type:t.Injectable}],Qe.ctorParameters=function(){return[{type:o.App},{type:j},{type:t.Compiler}]};var Xe=function(){function e(){}return e.prototype.canDeactivate=function(e,t,n){return function(){var e;return!1!==(e=this.app.activePage&&this.app.activePage.onBeforePageLeave())&&(e=(this.app.onBeforePageLeave||o.noop)(this.app.activePageName,this.app.activePage)),void 0===e||e}.apply(e)},e}();Xe.decorators=[{type:t.Injectable}];var Je=function(){function e(){}return e.prototype.canDeactivate=function(e,t,n){return!e.canDeactivate||e.canDeactivate()},e}();Je.decorators=[{type:t.Injectable}];var Ze=function(){function e(){this._stylesSet=new Set}return e.prototype.addStyles=function(e){var t=this,n=new Set;e.forEach((function(e){t._stylesSet.has(e)||(t._stylesSet.add(e),n.add(e))})),this.onStylesAdded(n)},e.prototype.onStylesAdded=function(e){},e.prototype.getAllStyles=function(){return Array.from(this._stylesSet)},e}();Ze.decorators=[{type:t.Injectable}];var et=function(e){function t(t){var n=e.call(this)||this;return n._doc=t,n._hostNodes=new Map,n._hostNodes.set(t.head,[]),n}return K(t,e),t.prototype._addStylesToHost=function(e,t,n){var i,o=this,r=(null===(i=document.querySelector('meta[name="CSP-NONCE"]'))||void 0===i?void 0:i.getAttribute("content"))||"wm-csp-nonce";e.forEach((function(e){var i=o._doc.createElement("style");i.textContent=e,i.setAttribute("nonce",r),n.push(t.appendChild(i))}))},t.prototype.addHost=function(e){var t=[];this._addStylesToHost(this._stylesSet,e,t),this._hostNodes.set(e,t)},t.prototype.removeHost=function(e){var t=this._hostNodes.get(e);t&&t.forEach(tt),this._hostNodes.delete(e)},t.prototype.onStylesAdded=function(e){var t=this;this._hostNodes.forEach((function(n,i){t._addStylesToHost(e,i,n)}))},t.prototype.ngOnDestroy=function(){this._hostNodes.forEach((function(e){return e.forEach(tt)}))},t}(Ze);function tt(e){i["\u0275getDOM"]().remove(e)}et.decorators=[{type:t.Injectable}],et.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[i.DOCUMENT]}]}]};var nt={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/MathML/"},it=/%COMP%/g,ot="_nghost-%COMP%",rt="_ngcontent-%COMP%";function at(e,t,n){for(var i=0;i<t.length;i++){var o=t[i];Array.isArray(o)?at(e,o,n):(o=o.replace(it,e),n.push(o))}return n}function st(e){return function(t){if("__ngUnwrap__"===t)return e;!1===e(t)&&(t.preventDefault(),t.returnValue=!1)}}var lt=function(){function e(e,t,n){this.eventManager=e,this.sharedStylesHost=t,this.appId=n,this.rendererByCompId=new Map,this.defaultRenderer=new ct(e)}return e.prototype.createRenderer=function(e,n){if(!e||!n)return this.defaultRenderer;switch(n.encapsulation){case t.ViewEncapsulation.Emulated:var i=this.rendererByCompId.get(n.id);return i||(i=new dt(this.eventManager,this.sharedStylesHost,n,this.appId),this.rendererByCompId.set(n.id,i)),i.applyToHost(e),i;case 1:case t.ViewEncapsulation.ShadowDom:return new ht(this.eventManager,this.sharedStylesHost,e,n);default:if(!this.rendererByCompId.has(n.id)){var o=at(n.id,n.styles,[]);this.sharedStylesHost.addStyles(o),this.rendererByCompId.set(n.id,this.defaultRenderer)}return this.defaultRenderer}},e.prototype.begin=function(){},e.prototype.end=function(){},e}();lt.decorators=[{type:t.Injectable}],lt.ctorParameters=function(){return[{type:d.EventManager},{type:d["\u0275DomSharedStylesHost"]},{type:String,decorators:[{type:t.Inject,args:[t.APP_ID]}]}]};var ct=function(){function e(e){this.eventManager=e,this.data=Object.create(null),this.destroyNode=null}return e.prototype.destroy=function(){},e.prototype.createElement=function(e,t){return t?document.createElementNS(nt[t]||t,e):document.createElement(e)},e.prototype.createComment=function(e){return document.createComment(e)},e.prototype.createText=function(e){return document.createTextNode(e)},e.prototype.appendChild=function(e,t){(pt(e)?e.content:e).appendChild(t)},e.prototype.insertBefore=function(e,t,n){e&&(pt(e)?e.content:e).insertBefore(t,n)},e.prototype.removeChild=function(e,t){e&&e.removeChild(t)},e.prototype.selectRootElement=function(e,t){var n="string"==typeof e?document.querySelector(e):e;if(!n)throw new Error('The selector "'+e+'" did not match any elements');return t||(n.textContent=""),n},e.prototype.parentNode=function(e){return e.parentNode},e.prototype.nextSibling=function(e){return e.nextSibling},e.prototype.resetStyles=function(e){[].slice.call(e).forEach((function(t){e.style.removeProperty(t)}))},e.prototype.applyStyles=function(e,t){if(t)return t.split(";").forEach((function(t){var n,i,o=t.split(":");2===o.length&&(n=o[0].trim(),i=o[1].trim(),e.style[n]=i)})),t},e.prototype.setAttribute=function(e,t,n,i){if(i){t=i+":"+t;var o=nt[i];o?e.setAttributeNS(o,t,n):e.setAttribute(t,n)}else"style"===t?(this.resetStyles(e),this.applyStyles(e,n)):e.setAttribute(t,n)},e.prototype.removeAttribute=function(e,t,n){if(n){var i=nt[n];i?e.removeAttributeNS(i,t):e.removeAttribute(n+":"+t)}else e.removeAttribute(t)},e.prototype.addClass=function(e,t){e.classList.add(t)},e.prototype.removeClass=function(e,t){e.classList.remove(t)},e.prototype.setStyle=function(e,n,i,o){o&(t.RendererStyleFlags2.DashCase|t.RendererStyleFlags2.Important)?e.style.setProperty(n,i,o&t.RendererStyleFlags2.Important?"important":""):e.style[n]=i},e.prototype.removeStyle=function(e,n,i){i&t.RendererStyleFlags2.DashCase?e.style.removeProperty(n):e.style[n]=""},e.prototype.setProperty=function(e,t,n){e[t]=n},e.prototype.setValue=function(e,t){e.nodeValue=t},e.prototype.listen=function(e,t,n){return"string"==typeof e?this.eventManager.addGlobalEventListener(e,t,st(n)):this.eventManager.addEventListener(e,t,st(n))},e}();"@".charCodeAt(0);function pt(e){return"TEMPLATE"===e.tagName&&void 0!==e.content}var ut,dt=function(e){function t(t,n,i,o){var r=e.call(this,t)||this;r.component=i;var a,s=at(o+"-"+i.id,i.styles,[]);return n.addStyles(s),r.contentAttr=(a=o+"-"+i.id,rt.replace(it,a)),r.hostAttr=function(e){return ot.replace(it,e)}(o+"-"+i.id),r}return K(t,e),t.prototype.applyToHost=function(t){e.prototype.setAttribute.call(this,t,this.hostAttr,"")},t.prototype.createElement=function(t,n){var i=e.prototype.createElement.call(this,t,n);return e.prototype.setAttribute.call(this,i,this.contentAttr,""),i},t}(ct),ht=function(e){function t(t,n,i,o){var r=e.call(this,t)||this;r.sharedStylesHost=n,r.hostEl=i,r.shadowRoot=i.attachShadow({mode:"open"}),r.sharedStylesHost.addHost(r.shadowRoot);for(var a=at(o.id,o.styles,[]),s=0;s<a.length;s++){var l=document.createElement("style");l.textContent=a[s],r.shadowRoot.appendChild(l)}return r}return K(t,e),t.prototype.nodeOrShadowRoot=function(e){return e===this.hostEl?this.shadowRoot:e},t.prototype.destroy=function(){this.sharedStylesHost.removeHost(this.shadowRoot)},t.prototype.appendChild=function(t,n){return e.prototype.appendChild.call(this,this.nodeOrShadowRoot(t),n)},t.prototype.insertBefore=function(t,n,i){return e.prototype.insertBefore.call(this,this.nodeOrShadowRoot(t),n,i)},t.prototype.removeChild=function(t,n){return e.prototype.removeChild.call(this,this.nodeOrShadowRoot(t),n)},t.prototype.parentNode=function(t){return this.nodeOrShadowRoot(e.prototype.parentNode.call(this,this.nodeOrShadowRoot(t)))},t}(ct),mt=function(){o._WM_APP_PROJECT.id=o.hasCordova()?_WM_APP_PROPERTIES.displayName:location.href.split("/")[3],o._WM_APP_PROJECT.cdnUrl=document.querySelector('[name="cdnUrl"]')&&document.querySelector('[name="cdnUrl"]').getAttribute("content"),o._WM_APP_PROJECT.ngDest="ng-bundle/"};function ft(e,t){return{provide:e,useValue:t}}function gt(e,t){var n=this;return function(){return Q(n,void 0,void 0,(function(){return X(this,(function(n){switch(n.label){case 0:return mt(),[4,t.resolve()];case 1:return n.sent(),[2,e.loadDefaultLocale()]}}))}))}}function vt(e){return mt(),e.deduceAppLocale()}!function(e){e.IOS="ios",e.ANDROID="android"}(ut||(ut={}));var yt=[fe,ge,ve,be,Ue,ze,ye],bt=[f.ConfirmDialogModule,g.DesignDialogModule,m.DialogModule];$.fn.swipeAnimation.expressionEvaluator=o.$parseExpr;var wt=function(){function e(t,n,i){e.addCustomEventPolyfill(),this.getDeviceDetails().then((function(e){n.selectedViewPort={os:e.os,category:e.selectedDeviceCategory},i.update(e),n.notify("on-viewport-details",e.os)}))}return e.addCustomEventPolyfill=function(){if("function"==typeof window.CustomEvent)return!1;var e=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};e.prototype=window.Event.prototype,window.CustomEvent=e},e.forRoot=function(){return{ngModule:e,providers:[{provide:o.App,useClass:Oe},{provide:o.AbstractToasterService,useClass:Se},{provide:o.AbstractI18nService,useClass:Te},{provide:o.AbstractSpinnerService,useClass:Re},{provide:o.AbstractNavigationService,useClass:Ce},{provide:o.AppDefaults,useClass:Ne},{provide:o.DynamicComponentRefProvider,useClass:Qe},{provide:t.APP_INITIALIZER,useFactory:gt,deps:[o.AbstractI18nService,je],multi:!0},{provide:t.LOCALE_ID,useFactory:vt,deps:[o.AbstractI18nService]},{provide:u.HTTP_INTERCEPTORS,useClass:We,multi:!0},i.DecimalPipe,i.DatePipe,j,H,ke,Me,Le,Xe,je,Ge,Ve,ft(re,10),ft(ae,1800)]}},e.prototype.getDeviceDetails=function(){return new Promise((function(e,t){window.top!==window?(window.top.postMessage({key:"on-load"},"*"),window.onmessage=function(t){var n=t.data;o.isObject(n)&&"switch-device"===n.key&&e(n.device)}):o.isIphone()||o.isIpod()||o.isIpad()?e({os:ut.IOS}):e({os:ut.ANDROID})}))},e}();wt.decorators=[{type:t.NgModule,args:[{declarations:yt,imports:[i.CommonModule,n.RouterModule,u.HttpClientModule,h.ToastrModule,c.WmComponentsModule,p.PrefabModule,v.MobileRuntimeModule,o.CoreModule,r.SecurityModule,b.OAuthModule,a.VariablesModule,y.HttpServiceModule,bt],exports:[yt,i.CommonModule,c.WmComponentsModule,v.MobileRuntimeModule,o.CoreModule,r.SecurityModule,b.OAuthModule,a.VariablesModule,y.HttpServiceModule,bt],providers:[{provide:d["\u0275DomSharedStylesHost"],useClass:et},{provide:d["\u0275DomRendererFactory2"],useClass:lt}],entryComponents:[ve]}]}],wt.ctorParameters=function(){return[{type:v.MobileRuntimeModule},{type:o.App},{type:o.Viewport}]};var Pt=[c.WmComponentsModule.forRoot(),v.MobileRuntimeModule.forRoot(),o.CoreModule.forRoot(),r.SecurityModule.forRoot(),b.OAuthModule.forRoot(),a.VariablesModule.forRoot(),y.HttpServiceModule.forRoot(),wt.forRoot()],_t=!1,Ot=function(){function e(e,t){this.appManager=e,this.appVariablesProvider=t}return e.prototype.resolve=function(){var e=this;return!!_t||Promise.all([this.appManager.loadSecurityConfig(),this.appManager.loadMetadata(),this.appVariablesProvider.getAppVariables()]).then((function(t){return e.appManager.loadAppVariables(t[2])})).then((function(){return _t=!0}))},e}();Ot.\u0275prov=C.\u0275\u0275defineInjectable({factory:function(){return new Ot(C.\u0275\u0275inject(j),C.\u0275\u0275inject(L))},token:Ot,providedIn:"root"}),Ot.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Ot.ctorParameters=function(){return[{type:j},{type:L}]};var St=!1,Et=function(){function e(e){this.appManager=e}return e.prototype.resolve=function(){return St||this.appManager.loadMetadata().then((function(){return St=!0}))},e}();Et.\u0275prov=C.\u0275\u0275defineInjectable({factory:function(){return new Et(C.\u0275\u0275inject(j))},token:Et,providedIn:"root"}),Et.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Et.ctorParameters=function(){return[{type:j}]};var Tt=function(){function e(e){this.appManager=e,o.isMobileApp()||(this.loaded=this.appManager.isPrefabType()||this.appManager.isTemplateBundleType()||!o.getWmProjectProperties().securityEnabled)}return e.prototype.resolve=function(){var e=this;return this.loaded||this.appManager.loadSecurityConfig().then((function(){e.loaded=!0}))},e}();Tt.\u0275prov=C.\u0275\u0275defineInjectable({factory:function(){return new Tt(C.\u0275\u0275inject(j))},token:Tt,providedIn:"root"}),Tt.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Tt.ctorParameters=function(){return[{type:j}]},e.AccessrolesDirective=fe,e.AppComponent=Ue,e.AppDefaultsService=Ne,e.AppExtensionJSResolve=Ge,e.AppExtensionProvider=F,e.AppJSProvider=M,e.AppJSResolve=je,e.AppManagerService=j,e.AppRef=Oe,e.AppSpinnerComponent=ge,e.AppVariablesProvider=L,e.AppVariablesResolve=Ot,e.AuthGuard=ke,e.BaseLayoutComponent=de,e.BasePageComponent=pe,e.BasePartialComponent=ie,e.BasePrefabComponent=ue,e.BaseSpaPageComponent=me,e.CACHE_PAGE=oe,e.CanDeactivateNgPageGuard=Je,e.CanDeactivatePageGuard=Xe,e.ComponentRefProvider=x,e.CustomToasterComponent=ve,e.DynamicComponentRefProviderService=Qe,e.EmptyPageComponent=ye,e.FragmentMonitor=te,e.HttpCallInterceptor=We,e.I18nResolve=Ve,e.I18nServiceImpl=Te,e.InitializeApp=gt,e.MAX_CACHE_AGE=ae,e.MAX_CACHE_SIZE=re,e.MetadataResolve=Et,e.NavigationServiceImpl=Ce,e.PageNotFoundGaurd=Le,e.PipeProvider=$e,e.PrefabConfigProvider=k,e.PrefabDirective=be,e.PrefabManagerService=H,e.PrefabPreviewComponent=ze,e.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS=bt,e.RoleGuard=Me,e.RuntimeBaseModule=wt,e.SecurityConfigResolve=Tt,e.SpinnerServiceImpl=Re,e.ToasterServiceImpl=Se,e.WM_MODULES_FOR_ROOT=Pt,e.WmDefaultRouteReuseStrategy=se,e.WmNgRouteReuseStrategy=ce,e.WmRouteReuseStrategy=le,e.commonPartialWidgets=ne,e.getPrefabBaseUrl=G,e.getPrefabConfigUrl=function(e){return G(e)+"/config.json"},e.getPrefabMinJsonUrl=function(e){return G(e)+"/pages/Main/page.min.json"},e.getPrefabPartialJsonUrl=function(e,t){return G(e)+"/pages/"+t+"/page.min.json"},e.isPrefabInPreview=B,e.setAngularLocale=vt,e["\u02750"]=z,e["\u0275a"]=ft,e["\u0275b"]=Ze,e["\u0275c"]=et,e["\u0275d"]=lt,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/platform-browser-dynamic"),require("@angular/platform-browser"),require("@angular/common"),require("@angular/router"),require("@angular/common/http"),require("@angular/forms"),require("ngx-bootstrap/typeahead"),require("ngx-bootstrap/timepicker"),require("ngx-bootstrap/progressbar"),require("ngx-bootstrap/pagination"),require("ngx-bootstrap/modal"),require("ngx-bootstrap/tooltip"),require("ngx-bootstrap/datepicker"),require("ngx-bootstrap/dropdown"),require("ngx-bootstrap/popover"),require("ng-circle-progress"),require("ngx-toastr"),require("ngx-bootstrap/carousel"),require("@wm/core"),require("@wm/components/basic"),require("@wm/components/basic/progress"),require("@wm/components/basic/rich-text-editor"),require("@wm/components/basic/search"),require("@wm/components/basic/tree"),require("@wm/components/input"),require("@wm/components/input/calendar"),require("@wm/components/input/chips"),require("@wm/components/input/color-picker"),require("@wm/components/input/currency"),require("@wm/components/input/epoch"),require("@wm/components/input/file-upload"),require("@wm/components/input/rating"),require("@wm/components/input/slider"),require("@wm/mobile/runtime/dynamic"),require("@wm/components/data/card"),require("@wm/components/data/form"),require("@wm/components/data/list"),require("@wm/components/data/live-table"),require("@wm/components/data/pagination"),require("@wm/components/data/table"),require("@wm/components/chart"),require("@wm/components/containers/accordion"),require("@wm/components/containers/linear-layout"),require("@wm/components/containers/layout-grid"),require("@wm/components/containers/panel"),require("@wm/components/containers/tabs"),require("@wm/components/containers/tile"),require("@wm/components/containers/wizard"),require("@wm/components/dialogs/alert-dialog"),require("@wm/components/dialogs/iframe-dialog"),require("@wm/components/dialogs/login-dialog"),require("@wm/components/dialogs/partial-dialog"),require("@wm/components/navigation/breadcrumb"),require("@wm/components/navigation/menu"),require("@wm/components/navigation/navbar"),require("@wm/components/navigation/popover"),require("@wm/components/advanced/carousel"),require("@wm/components/advanced/login"),require("@wm/components/advanced/marquee"),require("@wm/components/page"),require("@wm/components/page/footer"),require("@wm/components/page/header"),require("@wm/components/page/left-panel"),require("@wm/components/page/right-panel"),require("@wm/components/page/top-nav"),require("@wm/components/prefab"),require("@wm/runtime/base"),require("@wm/variables"),require("@wm/security"),require("@wm/transpiler"),require("@angular/platform-browser/animations")):"function"==typeof define&&define.amd?define("@wm/runtime/dynamic",["exports","@angular/core","@angular/platform-browser-dynamic","@angular/platform-browser","@angular/common","@angular/router","@angular/common/http","@angular/forms","ngx-bootstrap/typeahead","ngx-bootstrap/timepicker","ngx-bootstrap/progressbar","ngx-bootstrap/pagination","ngx-bootstrap/modal","ngx-bootstrap/tooltip","ngx-bootstrap/datepicker","ngx-bootstrap/dropdown","ngx-bootstrap/popover","ng-circle-progress","ngx-toastr","ngx-bootstrap/carousel","@wm/core","@wm/components/basic","@wm/components/basic/progress","@wm/components/basic/rich-text-editor","@wm/components/basic/search","@wm/components/basic/tree","@wm/components/input","@wm/components/input/calendar","@wm/components/input/chips","@wm/components/input/color-picker","@wm/components/input/currency","@wm/components/input/epoch","@wm/components/input/file-upload","@wm/components/input/rating","@wm/components/input/slider","@wm/mobile/runtime/dynamic","@wm/components/data/card","@wm/components/data/form","@wm/components/data/list","@wm/components/data/live-table","@wm/components/data/pagination","@wm/components/data/table","@wm/components/chart","@wm/components/containers/accordion","@wm/components/containers/linear-layout","@wm/components/containers/layout-grid","@wm/components/containers/panel","@wm/components/containers/tabs","@wm/components/containers/tile","@wm/components/containers/wizard","@wm/components/dialogs/alert-dialog","@wm/components/dialogs/iframe-dialog","@wm/components/dialogs/login-dialog","@wm/components/dialogs/partial-dialog","@wm/components/navigation/breadcrumb","@wm/components/navigation/menu","@wm/components/navigation/navbar","@wm/components/navigation/popover","@wm/components/advanced/carousel","@wm/components/advanced/login","@wm/components/advanced/marquee","@wm/components/page","@wm/components/page/footer","@wm/components/page/header","@wm/components/page/left-panel","@wm/components/page/right-panel","@wm/components/page/top-nav","@wm/components/prefab","@wm/runtime/base","@wm/variables","@wm/security","@wm/transpiler","@angular/platform-browser/animations"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.runtime=e.wm.runtime||{},e.wm.runtime.dynamic={}),e.ng.core,e.ng.platformBrowserDynamic,e.ng.platformBrowser,e.ng.common,e.ng.router,e.ng.common.http,e.ng.forms,e["ngx-bootstrap"].typeahead,e["ngx-bootstrap"].timepicker,e["ngx-bootstrap"].progressbar,e["ngx-bootstrap"].pagination,e["ngx-bootstrap"].modal,e["ngx-bootstrap"].tooltip,e["ngx-bootstrap"].datepicker,e["ngx-bootstrap"].dropdown,e["ngx-bootstrap"].popover,e.ngCircleProgress,e.ngxToastr,e["ngx-bootstrap"].carousel,e.wm.core,e.wm.components.basic,e.wm.components.basic.progress,e.wm.components.basic.richtexteditor,e.wm.components.basic.search,e.wm.components.basic.tree,e.wm.components.input,e.wm.components.input.calendar,e.wm.components.input.chips,e.wm.components.input.colorpicker,e.wm.components.input.currency,e.wm.components.input.epoch,e.wm.components.input.fileupload,e.wm.components.input.rating,e.wm.components.input.slider,e.wm.mobile.runtime.dynamic,e.wm.components.data.card,e.wm.components.data.form,e.wm.components.data.list,e.wm.components.data.livetable,e.wm.components.data.pagination,e.wm.components.data.table,e.wm.components.chart,e.wm.components.containers.accordion,e.wm.components.containers.linearlayout,e.wm.components.containers.layoutgrid,e.wm.components.containers.panel,e.wm.components.containers.tabs,e.wm.components.containers.tile,e.wm.components.containers.wizard,e.wm.components.dialogs.alertdialog,e.wm.components.dialogs.iframedialog,e.wm.components.dialogs.logindialog,e.wm.components.dialogs.partialdialog,e.wm.components.navigation.breadcrumb,e.wm.components.navigation.menu,e.wm.components.navigation.navbar,e.wm.components.navigation.popover,e.wm.components.advanced.carousel,e.wm.components.advanced.login,e.wm.components.advanced.marquee,e.wm.components.page,e.wm.components.page.footer,e.wm.components.page.header,e.wm.components.page.leftpanel,e.wm.components.page.rightpanel,e.wm.components.page.topnav,e.wm.components.prefab,e.wm.runtime.base,e.wm.variables,e.wm.security,e.wm.transpiler,e.ng.platformBrowser.animations)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h,m,f,g,v,y,b,w,P,O,S,E,T,R,A,C,I,D,N,x,k,M,L,F,j,B,G,V,U,W,q,z,H,Y,K,Q,X,J,Z,ee,te,ne,ie,oe,re,ae,se,le,ce,pe,ue,de,he,me,fe,ge,ve,ye,be,we){"use strict";function Pe(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var _e=Pe(t),Oe=Pe(a),Se=function(e,t){return(Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function Ee(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Se(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Te(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function Re(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}Object.create;function Ae(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Ce(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var Ie=function(){function e(e,t,n,i,o,r,a,s,l,c,p,u,d){this.injector=e,this.route=t,this.vcRef=n,this.appRef=i,this.metadataService=o,this.securityService=r,this.appManager=a,this.app=s,this.ngZone=l,this.elRef=c,this.spinnerService=p,this.componentRefProvider=u,this.router=d}return e.prototype.getTargetNode=function(){return this.elRef.nativeElement},e.prototype.resetViewContainer=function(){this.vcRef.clear(),this.getTargetNode().innerHTML=""},e.prototype.renderPage=function(e){var t=this,n=this.getTargetNode();this.appManager.loadAppVariables().then((function(){return Te(t,void 0,void 0,(function(){var t,i;return Re(this,(function(o){switch(o.label){case 0:return[4,this.componentRefProvider.getComponentFactoryRef(e,ge.ComponentType.PAGE)];case 1:return(t=o.sent())?(i=this.vcRef.createComponent(t,0,this.injector),this.instance=i.instance,n.appendChild(i.location.nativeElement)):ge.BasePageComponent.clear(),this.vcRef.length>1&&this.vcRef.remove(1),[2]}}))}))}))},e.prototype.renderPrefabPreviewPage=function(){this.router.navigate(["prefab-preview"])},e.prototype.loadPage=function(e){var t=this;this.ngZone.run((function(){e&&t.renderPage(e)}))},e.prototype.ngOnInit=function(){var e=this;this.app.isPrefabType?this.renderPrefabPreviewPage():($(this.getTargetNode()).find(">div").first().remove(),this.subscription=this.route.params.subscribe((function(t){var n=t.pageName;e.loadPage(n)})))},e.prototype.ngOnDestroy=function(){this.vcRef.clear(),this.subscription&&this.subscription.unsubscribe()},e.prototype.ngOnAttach=function(){this.getTargetNode().appendChild(this.instance.$page[0]),this.instance.ngOnAttach()},e.prototype.ngOnDetach=function(){this.instance.ngOnDetach()},e}();Ie.decorators=[{type:t.Component,args:[{selector:"app-page-outlet",template:"<div></div>"}]}],Ie.ctorParameters=function(){return[{type:t.Injector},{type:r.ActivatedRoute},{type:t.ViewContainerRef},{type:t.ApplicationRef},{type:ve.MetadataService},{type:ye.SecurityService},{type:ge.AppManagerService},{type:w.App},{type:t.NgZone},{type:t.ElementRef},{type:w.AbstractSpinnerService},{type:ge.ComponentRefProvider},{type:r.Router}]};var De={securityConfig:ge.SecurityConfigResolve,metadata:ge.MetadataResolve,appMetaConfig:ge.AppExtensionJSResolve},Ne=[{path:"",pathMatch:"full",resolve:De,component:ge.EmptyPageComponent},{path:"prefab-preview",pathMatch:"full",resolve:De,component:ge.PrefabPreviewComponent},{path:":pageName",pathMatch:"full",resolve:De,component:Ie,canDeactivate:[ge.CanDeactivatePageGuard]}],xe=function(e){function t(t){var n=e.call(this)||this;return n.$http=t,n}return Ee(t,e),t.prototype.getAppScriptFn=function(){return this.$http.get("./app.js",{responseType:"text"}).toPromise().then((function(e){return new Function("App","Utils","Injector",e)}))},t}(ge.AppJSProvider);xe.\u0275prov=_e.\u0275\u0275defineInjectable({factory:function(){return new xe(_e.\u0275\u0275inject(Oe.HttpClient))},token:xe,providedIn:"root"}),xe.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],xe.ctorParameters=function(){return[{type:a.HttpClient}]};var ke=new Map,Me=function(){function e(e){this.$http=e}return e.prototype.get=function(e,t){var n=ke.get(e);return n?Promise.resolve(n):this.$http.get(e).then((function(n){return t&&ke.set(e,n),n}))},e.prototype.clearCache=function(){ke.clear()},e}();Me.decorators=[{type:t.Injectable}],Me.ctorParameters=function(){return[{type:w.AbstractHttpService}]};var Le=function(e){function t(t){var n=e.call(this)||this;return n.resourceManager=t,n}return Ee(t,e),t.prototype.getAppVariables=function(){return Te(this,void 0,void 0,(function(){return Re(this,(function(e){return[2,this.resourceManager.get("./app.variables.json")]}))}))},t}(ge.AppVariablesProvider);Le.\u0275prov=_e.\u0275\u0275defineInjectable({factory:function(){return new Le(_e.\u0275\u0275inject(Me))},token:Le,providedIn:"root"}),Le.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Le.ctorParameters=function(){return[{type:Me}]};var Fe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ee(t,e),t.prototype.loadFormatterConfigScript=function(e){try{w.appendScriptToHead(e)}catch(e){console.warn("Error while loading the formatters.js file")}},t}(ge.AppExtensionProvider);Fe.\u0275prov=_e.\u0275\u0275defineInjectable({factory:function(){return new Fe},token:Fe,providedIn:"root"}),Fe.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var je=new Map;window.resourceCache=je;var Be=new Map;Be.set(ge.ComponentType.PAGE,new Map),Be.set(ge.ComponentType.PARTIAL,new Map),Be.set(ge.ComponentType.PREFAB,new Map);var Ge=function(e){return decodeURIComponent(e.replace(/\+/g," "))},Ve=Ge,$e=function(e,t,n){return t===ge.ComponentType.PAGE||t===ge.ComponentType.PARTIAL?n&&n.prefab?ge.getPrefabPartialJsonUrl(n.prefab,e):"./pages/"+e+"/page.min.json":t===ge.ComponentType.PREFAB?ge.getPrefabMinJsonUrl(e):void 0},Ue=$e,We=new Map,qe=function(e,t,n,i,o,r){var a=We.get(t);("Partial"!==n||_.isUndefined(i.Prefab))&&a||(a=new Function(n,"App","Utils",e),We.set(t,a)),a(i,o,r)},ze=qe,He=function(){function e(){}return e.prototype.init=function(){},e}(),Ye=function(e){var n=function(){};return n.decorators=[{type:t.NgModule,args:[{declarations:[e],imports:[ge.RuntimeBaseModule],schemas:[t.CUSTOM_ELEMENTS_SCHEMA,t.NO_ERRORS_SCHEMA]}]}],n},Ke=Ye,Qe=function(e,n,i,o,r,a){var s={template:i,styles:[o],encapsulation:t.ViewEncapsulation.None},l=He,c="",p="";switch(n){case ge.ComponentType.PAGE:l=ge.BasePageComponent,c="app-page-"+e,p="Page";break;case ge.ComponentType.PARTIAL:l=ge.BasePartialComponent,c="app-partial-"+e,p="Partial";break;case ge.ComponentType.PREFAB:l=ge.BasePrefabComponent,c="app-prefab-"+e,p="Prefab"}var u=function(t){function i(i){var o=t.call(this)||this;switch(o.injector=i,n){case ge.ComponentType.PAGE:o.pageName=e;break;case ge.ComponentType.PARTIAL:o.partialName=e;break;case ge.ComponentType.PREFAB:o.prefabName=e}return t.prototype.init.call(o),o}return Ee(i,t),i.prototype.evalUserScript=function(e,t,n){qe(r,c,p,e,t,n)},i.prototype.getVariables=function(){return JSON.parse(a)},i.prototype.getExpressions=function(){return{}},i}(l);return u.decorators=[{type:t.Component,args:[Object.assign(Object.assign({},s),{selector:c,providers:[{provide:w.UserDefinedExecutionContext,useExisting:u}]})]}],u.ctorParameters=function(){return[{type:t.Injector}]},u},Xe=Qe,Je=function(e){function t(t,n,i,o){var r=e.call(this)||this;return r.resouceMngr=t,r.app=n,r.appManager=i,r.compiler=o,r}return Ee(t,e),t.prototype.loadResourcesOfFragment=function(e,t,n){var i=this,o=$e(e,t,n),r=je.get(o);return r?Promise.resolve(r):this.resouceMngr.get(o,!0).then((function(n){var i=n.markup,r=n.script,a=n.styles,s=n.variables,l={markup:be.transpile(Ge(i)).markup,script:Ge(r),styles:be.scopeComponentStyles(e,t,Ge(a)),variables:w.getValidJSON(Ge(s))};return je.set(o,l),l}),(function(e){var t=e.details.status,n={404:i.app.appLocale.MESSAGE_PAGE_NOT_FOUND||"The page you are trying to reach is not available",403:i.app.appLocale.LABEL_ACCESS_DENIED||"Access Denied"};return Promise.reject(n[t])}))},t.prototype.getComponentFactoryRef=function(e,t,n){return Te(this,void 0,void 0,(function(){var i,o,r,a=this;return Re(this,(function(s){return(i=Be.get(t))&&(r=n&&n.prefab?n.prefab+e:e,o=i.get(r))?[2,o]:[2,this.loadResourcesOfFragment(e,t,n).then((function(i){var r=i.markup,s=i.script,l=i.styles,c=i.variables,p=Qe(e,t,r,l,s,JSON.stringify(c)),u=Ye(p);o=a.compiler.compileModuleAndAllComponentsSync(u).componentFactories.filter((function(e){return e.componentType===p}))[0];var d=n&&n.prefab?n.prefab+e:e;return Be.get(t).set(d,o),o}),(function(e){if(e){var t="Error while loading page";console.log(t,e),a.appManager.notifyApp(_.isString(e)?e:t+", check browser console for error details","error")}}))]}))}))},t.prototype.clearComponentFactoryRefCache=function(){this.resouceMngr.clearCache(),je.clear(),Be.forEach((function(e){e.clear()}))},t}(ge.ComponentRefProvider);Je.decorators=[{type:t.Injectable}],Je.ctorParameters=function(){return[{type:Me},{type:w.App},{type:ge.AppManagerService},{type:t.Compiler}]};var Ze=new Map,et=function(e){function t(t){var n=e.call(this)||this;return n.resourceMngr=t,n}return Ee(t,e),t.prototype.getConfig=function(e){var t=Ze.get(e);return t?Promise.resolve(t):this.resourceMngr.get(ge.getPrefabConfigUrl(e)).then((function(t){return Ze.set(e,t),t}))},t}(ge.PrefabConfigProvider);et.decorators=[{type:t.Injectable}],et.ctorParameters=function(){return[{type:Me}]};var tt=r.RouterModule.forRoot(Ne,{useHash:!0,scrollPositionRestoration:"top"}),nt=y.ToastNoAnimationModule.forRoot({maxOpened:1,autoDismiss:!0}),it=a.HttpClientXsrfModule.withOptions({cookieName:"wm_xsrf_token",headerName:w.getWmProjectProperties().xsrf_header_name}),ot=d.ModalModule.forRoot(),rt=m.BsDatepickerModule.forRoot(),at=m.DatepickerModule.forRoot(),st=c.TimepickerModule.forRoot(),lt=f.BsDropdownModule.forRoot(),ct=u.PaginationModule.forRoot(),pt=l.TypeaheadModule.forRoot(),ut=p.ProgressbarModule.forRoot(),dt=b.CarouselModule.forRoot(),ht=g.PopoverModule.forRoot(),mt=v.NgCircleProgressModule.forRoot({}),ft=h.TooltipModule.forRoot(),gt=[m.BsDatepickerModule,m.DatepickerModule,c.TimepickerModule,f.BsDropdownModule,u.PaginationModule,l.TypeaheadModule,p.ProgressbarModule,b.CarouselModule,g.PopoverModule,v.NgCircleProgressModule,h.TooltipModule,P.BasicModule,O.ProgressModule,S.RichTextEditorModule,E.SearchModule,T.TreeModule,A.CalendarModule,C.ChipsModule,I.ColorPickerModule,D.CurrencyModule,N.EpochModule,x.FileUploadModule,R.InputModule,k.RatingModule,M.SliderModule,F.CardModule,j.FormModule,B.ListModule,G.LiveTableModule,V.PaginationModule,U.TableModule,W.ChartModule,q.AccordionModule,z.LinearLayoutModule,H.LayoutGridModule,Y.PanelModule,K.TabsModule,Q.TileModule,X.WizardModule,J.AlertDialogModule,Z.IframeDialogModule,ee.LoginDialogModule,te.PartialDialogModule,ne.BreadcrumbModule,ie.MenuModule,oe.NavbarModule,re.PopoverModule,ae.CarouselModule,se.LoginModule,le.MarqueeModule,ce.PageModule,pe.FooterModule,ue.HeaderModule,de.LeftPanelModule,he.RightPanelModule,me.TopNavModule,fe.PrefabModule];ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS.push.apply(ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS,Ce([],Ae(gt))),ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS.push.apply(ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS,Ce([],Ae(L.MOBILE_COMPONENT_MODULES_FOR_ROOT))),ge.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS.push(s.FormsModule,s.ReactiveFormsModule);var vt=function(e,t,n){this.app=e,this.inj=t,this.componentRefProvider=n,window.cordova&&this.app.subscribe("userLoggedOut",this.componentRefProvider.clearComponentFactoryRefCache.bind(this.componentRefProvider))};vt.decorators=[{type:t.NgModule,args:[{declarations:[Ie],imports:[i.BrowserModule,we.BrowserAnimationsModule,o.CommonModule,r.RouterModule,a.HttpClientModule,ot,rt,at,st,lt,ct,pt,ft,ut,dt,ht,mt,tt,nt,it,L.MobileRuntimeDynamicModule,ge.WM_MODULES_FOR_ROOT],providers:[Me,{provide:ge.AppJSProvider,useClass:xe},{provide:ge.AppVariablesProvider,useClass:Le},{provide:ge.AppExtensionProvider,useClass:Fe},{provide:ge.ComponentRefProvider,useClass:Je},{provide:w.PartialRefProvider,useClass:Je},{provide:ge.PrefabConfigProvider,useClass:et},{provide:r.RouteReuseStrategy,useClass:ge.WmRouteReuseStrategy}],bootstrap:[ge.AppComponent]}]}],vt.ctorParameters=function(){return[{type:w.App},{type:t.Injector},{type:ge.ComponentRefProvider}]};var yt="debugMode";"true"!==sessionStorage.getItem(yt)&&t.enableProdMode(),console.time("bootstrap"),document.addEventListener("DOMContentLoaded",(function(){new Promise((function(e){window.cordova?document.addEventListener("deviceready",e):e()})).then((function(){return n.platformBrowserDynamic().bootstrapModule(vt)})).then((function(e){var n=e.injector.get(t.ApplicationRef);window.addEventListener("unload",(function(){n.components.map((function(e){return e&&e.destroy()}))})),console.timeEnd("bootstrap")}),(function(e){return console.log(e)}))})),window.debugMode=function(e){_.isEmpty(e)&&(e=!0);var t=e?"true":"false";sessionStorage.getItem(yt)!==t&&(sessionStorage.setItem(yt,t),window.location.reload())};e.AppExtensionProviderService=Fe,e.AppJSProviderService=xe,e.AppModule=vt,e.AppResourceManagerService=Me,e.AppVariablesProviderService=Le,e.ComponentRefProviderService=Je,e.PageWrapperComponent=Ie,e.PrefabConfigProviderService=et,e.bsDatePickerModule=rt,e.bsDropdownModule=lt,e.carouselModule=dt,e.datepickerModule=at,e.httpClientXsrfModule=it,e.modalModule=ot,e.ngCircleProgressModule=mt,e.paginationModule=ct,e.popoverModule=ht,e.progressbarModule=ut,e.routerModule=tt,e.timepickerModule=st,e.toastrModule=nt,e.tooltipModule=ft,e.typeaheadModule=pt,e["\u02750"]=Ve,e["\u02751"]=Ue,e["\u02752"]=ze,e["\u02753"]=Ke,e["\u02754"]=Xe,e["\u0275a"]=Ne,Object.defineProperty(e,"__esModule",{value:!0})}));