!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@lcu/common"),require("dot-object"),require("@angular/http"),require("@angular/material"),require("@angular/material/dialog"),require("@angular/material/snack-bar"),require("@angular/core"),require("rxjs"),require("@angular/router"),require("@lcu/core"),require("@lcu/api"),require("@lcu/enterprises")):"function"==typeof define&&define.amd?define("@lcu/daf-common",["exports","@lcu/common","dot-object","@angular/http","@angular/material","@angular/material/dialog","@angular/material/snack-bar","@angular/core","rxjs","@angular/router","@lcu/core","@lcu/api","@lcu/enterprises"],e):e((t.lcu=t.lcu||{},t.lcu["daf-common"]={}),t.common,t.DotObject,t.ng.http,t.ng.material,t.ng.material.dialog,t.ng.material["snack-bar"],t.ng.core,t.rxjs,t.ng.router,t.core,t.api,t.i1$2)}(this,function(t,r,e,a,n,o,i,u,l,s,p,c,f){"use strict";var d=function(t,e){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function g(t,e){function n(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var h=function(){return(h=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function v(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(o=i.next()).done;)a.push(o.value)}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i["return"])&&n.call(i)}finally{if(r)throw r.error}}return a}function b(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(v(arguments[e]));return t}var y=function(){function t(t,e){this.DSConfig=t,this.dbSvc=e,this.changes=[],this.dataCol=[],this.data=new l.BehaviorSubject([]),this.Data=this.data.asObservable(),this.error=new l.BehaviorSubject(null),this.Error=this.error.asObservable(),this.loading=new l.BehaviorSubject(!1),this.Loading=this.loading.asObservable(),this.winAny=window,this.load()}return Object.defineProperty(t.prototype,"AppID",{get:function(){return this.winAny.ViewBag.ApplicationID},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"BasePath",{get:function(){return document.getElementsByTagName("base")[0].href},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"CurrentPath",{get:function(){var t=window.location.href.replace(this.BasePath,"");return"/"+(t=t.replace(location.search,""))},enumerable:!0,configurable:!0}),t.prototype.ClearChanges=function(){this.changes=[]},t.prototype.Get=function(e){return this.dataCol.find(function(t){return t.id==e||t.ID==e})},t.prototype.Insert=function(t){var e=this;this.ensureArray(t).forEach(function(t){e.dataCol.push(t),e.addChange("I",t)}),this.data.next(this.dataCol)},t.prototype.LoadChanges=function(){return this.changes},t.prototype.Remove=function(t){var n=this,e=this.ensureArray(t).every(function(t){if(t){var e=n.dataCol.indexOf(t);0<=e&&(n.dataCol.splice(e,1),n.addChange("R",t))}return!0});return this.data.next(this.dataCol),e},t.prototype.Reconfigure=function(t){this.DSConfig=t,this.load()},t.prototype.Reset=function(t){var e;this.dataCol=[],(e=this.dataCol).push.apply(e,b(t)),this.ClearChanges(),this.data.next(this.dataCol)},t.prototype.Sync=function(){var e=this;return new l.Observable(function(t){e.loading.next(!0),e.error.next(null),e.dbSvc.SyncDB(e.DSConfig,e.LoadChanges(),e.AppID,e.CurrentPath).subscribe(function(t){p.isResultSuccess(t)?e.Reset(t.Model):(e.error.next(t.Status),e.loading.next(!1))},function(t){},function(){e.loading.next(!1),t.next({Code:0,Message:"Success"}),t.complete()})})},t.prototype.Update=function(t){var o=this;this.ensureArray(t).forEach(function(t){var e=o.Get(t.ID),n=o.dataCol.indexOf(e);0<=n&&o.dataCol.splice(n,1,t),o.addChange("U",t)}),this.data.next(this.dataCol)},t.prototype.Save=function(t){var e=this.ensureArray(t),n=e.filter(function(t){return!t.ID||t.ID==r.Guid.Empty}),o=e.filter(function(t){return t.ID&&t.ID!=r.Guid.Empty});this.Insert(n),this.Update(o)},t.prototype.addChange=function(t,e){this.changes.push({name:"",obj:e,operation:t})},t.prototype.ensureArray=function(t){return Array.isArray(t)||(t=[t]),t},t.prototype.load=function(){this.Sync().subscribe()},t}(),S=function(){function t(t,e){this.DBConfig=t,this.dbSvc=e,this.applyingChanges=new l.BehaviorSubject(!1),this.ApplyingChanges=this.applyingChanges.asObservable(),this.configured=new l.BehaviorSubject(!1),this.Configured=this.configured.asObservable(),this.error=new l.BehaviorSubject(null),this.Error=this.error.asObservable(),this.hasChanges=new l.BehaviorSubject(!1),this.HasChanges=this.hasChanges.asObservable(),this.loading=new l.BehaviorSubject(!1),this.Loading=this.loading.asObservable(),this.winAny=window,this.Load()}return Object.defineProperty(t.prototype,"AppID",{get:function(){return this.winAny.ViewBag.ApplicationID},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"BasePath",{get:function(){return document.getElementsByTagName("base")[0].href},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"CurrentPath",{get:function(){var t=window.location.href.replace(this.BasePath,"");return"/"+(t=t.replace(location.search,""))},enumerable:!0,configurable:!0}),t.prototype.GetCollection=function(t){return this.loki.getCollection(t.Type)||this.loki.addCollection(t.Type,{autoupdate:!0,disableChangesApi:!1})},t.prototype.Load=function(t){void 0===t&&(t=null),this.loading.next(!0),t?this.DBConfig=t:t=this.DBConfig,this.loki=this.dbSvc.BuildDatabase(this.DBConfig),this.setupChangeHandling(),this.loading.next(!1),this.configured.next(!0)},t.prototype.LoadChanges=function(t){return this.loki.generateChangesNotification(t)},t.prototype.Save=function(){},t.prototype.Sync=function(t,e){return this.error.next(null),this.dbSvc.SyncDB(t,e,this.AppID,this.CurrentPath)},t.prototype.WithLoki=function(t){return t(this.loki)},t.prototype.handleChanges=function(){},t.prototype.setupChangeHandling=function(){var t=this;setInterval(function(){t.handleChanges()},this.DBConfig.SyncSeconds)},t}(),C=function(){function t(t,e){this.dsConfigKey=t,this.dbCtxt=e,this.data=new l.BehaviorSubject([]),this.Data=this.data.asObservable(),this.error=new l.BehaviorSubject(null),this.Error=this.error.asObservable(),this.loading=new l.BehaviorSubject(!1),this.Loading=this.loading.asObservable(),this.load()}return Object.defineProperty(t.prototype,"DSConfig",{get:function(){return this.dbCtxt.DBConfig.DataSets[this.dsConfigKey]},enumerable:!0,configurable:!0}),t.prototype.ClearChanges=function(){this.WithCollection(function(t){t.flushChanges()})},t.prototype.Get=function(e){return this.WithCollection(function(t){return t.get(e)})},t.prototype.Insert=function(e){return this.WithCollection(function(t){return t.insert(e)})},t.prototype.LoadChanges=function(){var n=this;return this.WithCollection(function(t){var e=n.dbCtxt.LoadChanges([t.name]);return e.forEach(function(t){delete t.obj.$loki}),e})},t.prototype.Remove=function(e){return this.WithCollection(function(t){return t.remove(e)})},t.prototype.Reset=function(e){var n=this;this.WithCollection(function(t){t.clear(),n.Insert(e),n.ClearChanges()})},t.prototype.Sync=function(){var e=this;return new l.Observable(function(t){e.loading.next(!0),e.error.next(null),e.dbCtxt.Sync(e.DSConfig,e.LoadChanges()).subscribe(function(t){p.isResultSuccess(t)?e.Reset(t.Model):(e.error.next(t.Status),e.loading.next(!1))},function(t){},function(){e.loading.next(!1),t.next({Code:0,Message:"Success"}),t.complete()})})},t.prototype.Update=function(e){return this.WithCollection(function(t){return t.update(e)})},t.prototype.Save=function(t){var e=this;Array.isArray(t)||(t=[t]),t.forEach(function(t){t.$loki?e.Update(t):e.Insert(t)})},t.prototype.WithCollection=function(t){var e=this.dbCtxt.GetCollection(this.DSConfig),n=t(e),o=this.DSConfig.Sorting?e.chain().simplesort(this.DSConfig.Sorting.BasicSort,this.DSConfig.Sorting.IsDesc).data():e.data;return this.data.next(o),this.dbCtxt.Save(),n},t.prototype.initCollection=function(){var t=this.dbCtxt.GetCollection(this.DSConfig);return this.data.next(t.data),this.Sync().subscribe(),t},t.prototype.load=function(){this.initCollection()},t}(),I=function(){function t(){}return t.prototype.CreateWorkerBlob=function(t){return""},t.prototype.CreateWorker=function(t){return new Worker(t)},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t},token:t,providedIn:"root"}),t}(),j=function(o){function t(t,e){var n=o.call(this,t)||this;return n.injector=t,n.workerSvc=e,n.rootPath="/forge-api/data-flow",n}return g(t,o),t.prototype.BuildDatabase=function(t){return this.dbConfig="string"==typeof t?{DBName:t,AutoSave:!0}:t,{}},t.prototype.InitializeOnWorker=function(){this.workerSvc.CreateWorkerBlob(["("+this.BuildDatabase+")()"])},t.prototype.LoadCSS=function(t,e,n){return this.post(t,this.rootPath+"/app-page-data/"+e+"/css?pagePath="+encodeURIComponent(n))},t.prototype.LoadDBConfig=function(t,e){return this.get(this.rootPath+"/app-page-data/"+t+"/config?pagePath="+encodeURIComponent(e))},t.prototype.LoadEventsConfig=function(t,e){return this.get(this.rootPath+"/app-page-data/"+t+"/events?pagePath="+encodeURIComponent(e))},t.prototype.SaveDBConfig=function(t,e,n){return this.post(t,this.rootPath+"/app-page-data/"+e+"/config?pagePath="+encodeURIComponent(n))},t.prototype.SaveEventsConfig=function(t,e,n){return this.post(t,this.rootPath+"/app-page-data/"+e+"/events?pagePath="+encodeURIComponent(n))},t.prototype.SyncDB=function(t,e,n,o){return this.post({DSConfig:t,Changes:e},this.rootPath+"/app-page-data/"+n+"/sync?pagePath="+encodeURIComponent(o))},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.Injector},{type:I}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(u.INJECTOR),u.inject(I))},token:t,providedIn:"root"}),t}(c.DAFService),m=function(n){function t(t){var e=n.call(this,t)||this;return e.configSvc=t,e}return g(t,n),t.prototype.loadConfigKey=function(){return"PageSettings-"+this.AppID+"-"+this.CurrentPath},t.prototype.loadDefaultConfig=function(){return{Theme:{Style:"",Details:{}}}},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:f.SingletonService}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(f.SingletonService))},token:t,providedIn:"root"}),t}(f.BaseConfigContext),D=function(n){function t(t){var e=n.call(this,t)||this;return e.configSvc=t,e}return g(t,n),t.prototype.loadConfigKey=function(){return"PointersConfig-"+this.AppID},t.prototype.loadDefaultConfig=function(){return{Pointers:{}}},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:f.SingletonService}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(f.SingletonService))},token:t,providedIn:"root"}),t}(f.BaseConfigContext),x=function(n){function t(t){var e=n.call(this,t)||this;return e.configSvc=t,e}return g(t,n),t.prototype.loadConfigKey=function(){return"ForgeSettings-"+this.AppID},t.prototype.loadDefaultConfig=function(){return{Platforms:[{Details:{},Lookup:"",Name:""}],Theme:{Details:{},Style:""}}},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:f.SingletonService}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(f.SingletonService))},token:t,providedIn:"root"}),t}(f.BaseConfigContext),w=function(c){function t(t,e,n,o,r,i,a){var s=c.call(this,t)||this;return s.injector=t,s.router=e,s.pageSettings=n,s.dbSvc=o,s.route=r,s.pointersConfig=i,s.forgeSettings=a,s.cssPath=new l.BehaviorSubject(null),s.CSSPath=s.cssPath.asObservable(),s.DataChange=new u.EventEmitter,s.error=new l.BehaviorSubject({Code:-1,Message:"Initialized"}),s.Error=s.error.asObservable(),s.loaded=new l.BehaviorSubject(!1),s.Loaded=s.loaded.asObservable(),s.loading=new l.BehaviorSubject(!1),s.Loading=s.loading.asObservable(),s.winAny=window,s.forgeSettings.Context.subscribe(function(t){s.ForgeSettings=t,s.LoadPageCSS(s.Elements)}),s.forgeSettings.Loading.subscribe(function(t){s.loading.next(t)}),s.pageSettings.Context.subscribe(function(t){s.Settings=t,s.Settings&&(s.loadedSettingsCheck=JSON.stringify(s.Settings)),s.LoadPageCSS(s.Elements)}),s.pageSettings.Loading.subscribe(function(t){s.loading.next(t)}),s.pointersConfig.Context.subscribe(function(t){s.PointersConfig=t,s.LoadPageCSS(s.Elements)}),s.pointersConfig.Loading.subscribe(function(t){s.loading.next(t)}),s}return g(t,c),Object.defineProperty(t.prototype,"appId",{get:function(){return this.winAny.ViewBag.ApplicationID},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"HasChanges",{get:function(){return this.loadedElementsCheck!=JSON.stringify(this.Elements)||this.loadedSettingsCheck!=JSON.stringify(this.Settings)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"NextOrder",{get:function(){return this.Elements&&0!=this.Elements.length?this.Elements.reduce(function(t,e){return t.Order>e.Order?t:e}).Order:0},enumerable:!0,configurable:!0}),t.prototype.AddPageElement=function(t){t=t||{Order:5e5,Title:"New Tile",PageLookup:this.Lookup},this.elsCtxt.Insert([t]),this.elsCtxt.Sync().subscribe()},t.prototype.FireEvent=function(t,e){this.Events&&this.Events[t]&&this.events[t].next(e)},t.prototype.LoadPageCSS=function(t){var o=this;return new l.Observable(function(n){t&&0<t.length&&(o.loading.next(!0),o.dbSvc.LoadCSS({Elements:t,PointersConfig:o.PointersConfig,ForgeSettings:o.ForgeSettings,PageSettings:o.Settings},o.appId,o.Lookup).subscribe(function(t){if(p.isResultSuccess(t)){var e=new Blob([t.Model],{type:"text/css"});o.cssPath.next(URL.createObjectURL(e)),n.next({Code:0,Message:"Success"}),n.complete()}else n.error(t.Status),n.complete()},function(t){},function(){o.loading.next(!1)}))})},t.prototype.LoadPageData=function(){var r=this;return new l.Observable(function(o){r.dbSvc.LoadDBConfig(r.appId,r.Lookup).subscribe(function(t){if(p.isResultSuccess(t)){if(r.Data={},t.Model&&t.Model.DataSets)for(var e in t.Model.DataSets)r.Data[e]?r.Data[e].Reconfigure(t.Model.DataSets[e]):r.Data[e]=r.buildDataFlowContext(t.Model,e);var n={Code:0,Message:"Success"};r.DataChange.emit(n),o.next(n),o.complete()}else o.error(t.Status),o.complete()})})},t.prototype.LoadPageEvents=function(){var o=this;return new l.Observable(function(n){o.dbSvc.LoadEventsConfig(o.appId,o.Lookup).subscribe(function(t){if(p.isResultSuccess(t)){if(o.events={},o.Events={},t.Model&&t.Model.Events)for(var e in t.Model.Events)o.events[e]=new l.BehaviorSubject({Status:{Code:-1,Message:"Initialized"}}),o.Events[e]=o.events[e].asObservable();n.next({Code:0,Message:"Success"}),n.complete()}else n.error(t.Status),n.complete()})})},t.prototype.RefreshSettings=function(t){var n=this;return this.Lookup=t,new l.Observable(function(e){n.loading.next(!0),n.error.next({Code:-1,Message:"Initialized"});n.Lookup.replace("/","-");n.elsCtxt=new y({Query:{Where:"d.PageLookup = '"+n.Lookup+"' "},Sorting:{BasicSort:"Order",IsDesc:!1},Type:"PageElement-"+n.appId},n.dbSvc),n.elsCtxtLoading&&n.elsCtxtLoading.unsubscribe(),n.elsCtxtLoading=n.elsCtxt.Loading.subscribe(function(t){return n.loading.next(t)}),n.elsCtxt.Data.subscribe(function(t){t&&0<t.length?n.LoadPageCSS(t).subscribe(function(){n.Elements=t,n.Elements.forEach(function(t){return t.PageSave=!0}),n.Elements=n.Elements.sort(function(t,e){return t.Order<e.Order?-1:t.Order>e.Order?1:0}),n.Elements&&0!=n.Elements.length||(n.loadedElementsCheck=JSON.stringify(n.Elements)),n.loaded.next(!0)}):n.Elements=[]}),l.forkJoin(n.LoadPageData()).subscribe(function(t){n.loading.next(!1),n.loaded.next(!0),e.next({Code:0,Message:"Success"}),e.complete()})})},t.prototype.RemovePageElement=function(t){return this.elsCtxt.Remove([t])},t.prototype.UpdatePageElement=function(t){return Array.isArray(t)||(t=[t]),this.elsCtxt.Save(t)},t.prototype.Save=function(){var n=this;return new l.Observable(function(e){n.loading.next(!0),n.error.next({Code:-1,Message:"Initialized"});n.Lookup.replace("/","-");n.Elements.forEach(function(t,e){t.Order=500*e}),n.UpdatePageElement(n.Elements),l.forkJoin(n.elsCtxt.Sync(),n.pageSettings.Save(n.Settings)).subscribe(function(t){n.loading.next(!1),e.next(t[0]),e.complete()})})},t.prototype.SavePointersConfig=function(){var t=this;return new l.Observable(function(e){t.pointersConfig.Save(t.PointersConfig).subscribe(function(t){e.next(t),e.complete()})})},t.prototype.buildDataFlowContext=function(t,e){if(t&&e){var n=t.DataSets[e];return new y(n,this.dbSvc)}return null},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.Injector},{type:s.Router},{type:m},{type:j},{type:s.ActivatedRoute},{type:D},{type:x}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(u.INJECTOR),u.inject(s.Router),u.inject(m),u.inject(j),u.inject(s.ActivatedRoute),u.inject(D),u.inject(x))},token:t,providedIn:"root"}),t}(c.DAFService),O=function(r){function t(t,e,n){var o=r.call(this,t,!0)||this;return o.configSvc=t,o.dbSvc=e,o.pgSvc=n,o.load(),o}return g(t,r),t.prototype.Load=function(){var n=this;return new l.Observable(function(e){n.loading(!0),n.error.next(null),n.dbSvc.LoadDBConfig(n.AppID,n.loadConfigKey()).subscribe(function(t){p.isResultSuccess(t)?(n.subject.next(t.Model),e.next(t.Status)):2==t.Status.Code?(n.subject.next(n.loadDefaultConfig()),e.next({Code:0,Message:"Success"})):(n.error.next(t.Status),e.next(t.Status))},function(t){n.error.next(t),e.next({Code:1,Message:t})},function(){n.loading(!1),e.complete()})})},t.prototype.Save=function(t){var n=this;return new l.Observable(function(e){n.loading(!0),n.error.next(null),n.dbSvc.SaveDBConfig(t,n.AppID,n.loadConfigKey()).subscribe(function(t){p.isResultSuccess(t)?n.load():(n.error.next(t.Status),n.loading(!1)),e.next(t.Status)},function(t){n.error.next(t),n.loading(!1),e.next({Code:1,Message:t})},function(){e.complete()})})},t.prototype.loadConfigKey=function(){if(!this.pgSvc.Lookup)throw new Error("No lookup set yet...");return this.pgSvc.Lookup},t.prototype.loadDefaultConfig=function(){return{DataSets:{}}},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:f.SingletonService},{type:j},{type:w}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(f.SingletonService),u.inject(j),u.inject(w))},token:t,providedIn:"root"}),t}(f.BaseConfigContext),P=function(o){function t(t,e){var n=o.call(this,e,!0)||this;return n.configSvc=e,n.deviceType=t,n.load(),n}return g(t,o),t.prototype.loadConfigKey=function(){return"ForgeDeviceTypeConfig-"+this.deviceType},t.prototype.loadDefaultConfig=function(){return{DefaultRefreshRate:15,QAQCColumnsToDisplay:[],DeviceType:this.deviceType}},t}(f.BaseConfigContext),L="ForgeDevicesConfig",U=function(n){function t(t){var e=n.call(this)||this;return e.singletonSvc=t,e.Load(),e}return g(t,n),t.prototype.Load=function(){var e=this;this.loading(!0),this.singletonSvc.Get(L).subscribe(function(t){p.isResultSuccess(t)?(e.Config=t.Model,e.subject.next(e.Config)):2==t.Status.Code?(e.Config=e.defaultValue(),e.subject.next(e.Config)):e.subject.error(t.Status)},function(t){return e.subject.error(t)},function(){e.loading(!1)})},t.prototype.Save=function(t){var e=this;this.loading(!0),this.singletonSvc.Save(L,t).subscribe(function(t){p.isResultSuccess(t)?e.Load():(e.subject.error(t.Status),e.loading(!1))},function(t){e.subject.error(t),e.loading(!1)})},t.prototype.defaultValue=function(){return{DeviceTypes:[]}},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:f.SingletonService}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(f.SingletonService))},token:t,providedIn:"root"}),t}(c.ObservableContextService),k=function(n){function t(t){var e=n.call(this,t)||this;return e.configSvc=t,e}return g(t,n),t.prototype.loadConfigKey=function(){return"Pages-"+this.AppID},t.prototype.loadDefaultConfig=function(){return{Configs:[]}},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:f.SingletonService}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(f.SingletonService))},token:t,providedIn:"root"}),t}(f.BaseConfigContext),R=function(n){function t(t){var e=n.call(this,t)||this;return e.injector=t,e.rootUrl="/forge-api/provisioning",e}return g(t,n),t.prototype.Save=function(t){return this.post(t,""+this.rootUrl)},t.prototype.Get=function(){return this.get(""+this.rootUrl)},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.Injector}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(u.INJECTOR))},token:t,providedIn:"root"}),t}(c.DAFService),B=function(n){function t(t){var e=n.call(this)||this;return e.provSvc=t,e.load(),e}return g(t,n),t.prototype.Load=function(){var n=this;return new l.Observable(function(e){n.loading(!0),n.provSvc.Get().subscribe(function(t){p.isResultSuccess(t)?(n.subject.next(t.Model),e.next(t.Status)):2==t.Status.Code?(n.subject.next({}),e.next({Code:0,Message:"Success"})):e.next(t.Status)},function(t){e.next({Code:1,Message:t})},function(){n.loading(!1),e.complete()})})},t.prototype.Save=function(t){var n=this;return new l.Observable(function(e){n.loading(!0),n.provSvc.Save(t).subscribe(function(t){p.isResultSuccess(t)&&n.Load().subscribe(),e.next(t.Status)},function(t){e.next({Code:1,Message:t})},function(){n.loading(!1),e.complete()})})},t.prototype.load=function(){this.Load().subscribe()},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:R}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(R))},token:t,providedIn:"root"}),t}(c.ObservableContextService),E=function(n){function t(t){var e=n.call(this,t)||this;return e.configSvc=t,e}return g(t,n),t.prototype.loadConfigKey=function(){return"ForgeReportingConfig"},t.prototype.loadDefaultConfig=function(){return{PowerBIConfigs:{}}},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:f.SingletonService}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(f.SingletonService))},token:t,providedIn:"root"}),t}(f.BaseConfigContext),A=function(n){function t(t){var e=n.call(this,t)||this;return e.configSvc=t,e}return g(t,n),t.prototype.loadConfigKey=function(){return"Solutions"},t.prototype.loadDefaultConfig=function(){return{Configs:[]}},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:f.SingletonService}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(f.SingletonService))},token:t,providedIn:"root"}),t}(f.BaseConfigContext),M=function(o){function t(t,e){var n=o.call(this,t)||this;return n.injector=t,n.domainSvc=e,n.rootUrl="/forge-api/apps",n}return g(t,o),t.prototype.Delete=function(t){return this["delete"](this.rootUrl+"/"+t)},t.prototype.ListApps=function(t,e,n){return this.get(this.rootUrl+"/list/"+e+"/"+n+"?host="+t)},t.prototype.ListFabricApplicationServices=function(){return this.get(this.rootUrl+"/fabric/app/services")},t.prototype.ListHosts=function(){return this.get(this.rootUrl+"/hosts")},t.prototype.Save=function(t){return this.post(t,""+this.rootUrl)},t.prototype.SaveAll=function(t){return this.post(t,this.rootUrl+"/save-all")},t.prototype.SetAppBuilder=function(t){return this.post({Builder:t},this.rootUrl+"/app-builder")},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.Injector},{type:f.DomainService}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(u.INJECTOR),u.inject(f.DomainService))},token:t,providedIn:"root"}),t}(c.DAFService),N=function(){function t(){this.mapper=new e}return t.prototype.Map=function(t,e,n){var o=b(e),r=[];switch(t.MapType){case"Flow":r=this.executeFlow(t.Details,o,n);break;case"Mapped":r=this.executeMapped(t.Details,o,n);break;case"Ordered":r=this.executeOrdered(o,n);break;case"ShowHide":r=this.executeShowHide(t.Details,o,n)}return r},t.prototype.executeFlow=function(t,e,n){return this.executeOrdered(e,n)},t.prototype.executeMapped=function(i,t,a){var s=this,e=[];return i&&i.Map&&(e=t.map(function(n){var o={},t=Object.keys(i.Map),r={};return t.forEach(function(t){var e=s.resolveInput(n,a,i.Map[t]);o[t]=i.Map[t].Output,e&&s.processInput(e,o,r)}),r})),e},t.prototype.executeOrdered=function(t,e){return[Object.assign({},t)]},t.prototype.executeShowHide=function(s,t,c){var u=this,e=[];return s&&s.Left&&s.Right&&(e=t.map(function(t){var e={Hide:!1};if(s.Left.Output||s.Right.Output)if(s.Left.Output&&s.Right.Output){var n=u.resolveInput(t,c,s.Left),o=u.resolveInput(t,c,s.Right),r={};r[s.Left.Output]="Value";var i=u.processInput(n,r);r[s.Right.Output]="Value";var a=u.processInput(o,r);e.Hide=i.Value!==a.Value}else e.Hide=!0;else e.Hide=!1;return e})),e},t.prototype.processInput=function(t,e,n){if(!n)return this.mapper.transform(e,t);this.mapper.transform(e,t,n)},t.prototype.resolveInput=function(t,e,n){var o={};switch(n.Reference){case"Context":o=t;break;case"Data":o=e[n.DataKey];break;case"0":case"1":case"2":case"3":o=t[n.Reference]}return o},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t},token:t,providedIn:"root"}),t}(),T=function(n){function t(t){var e=n.call(this,t)||this;return e.injector=t,e.rootUrl="/forge-api/schema/json",e}return g(t,n),t.prototype.Delete=function(t){return this["delete"](this.rootUrl+"/"+t)},t.prototype.Get=function(t){return this.get(this.rootUrl+"/"+t)},t.prototype.List=function(t,e){return this.get(this.rootUrl+"/list/"+t+"/"+e)},t.prototype.Save=function(t){return this.post(t,""+this.rootUrl)},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.Injector}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(u.INJECTOR))},token:t,providedIn:"root"}),t}(c.DAFService),F=function(n){function t(t){var e=n.call(this,t)||this;return e.injector=t,e.rootUrl="/forge-api/identity",e}return g(t,n),t.prototype.DeleteClaim=function(t,e){return this["delete"](this.rootUrl+"/users/"+t+"/claims/"+encodeURIComponent(e))},t.prototype.ListAccessConfigs=function(t,e){return this.get(this.rootUrl+"/access-configs/list/"+t+"/"+e)},t.prototype.ListAccessRights=function(t,e){return this.get(this.rootUrl+"/access-rights/list/"+t+"/"+e)},t.prototype.ListClaims=function(t,e,n){return this.get(this.rootUrl+"/users/"+t+"/claims/list/"+e+"/"+n)},t.prototype.ListUsers=function(t,e){return this.get(this.rootUrl+"/users/list/"+t+"/"+e)},t.prototype.GetProvider=function(t){return this.get(this.rootUrl+"/providers/"+t)},t.prototype.SaveClaims=function(t,e){return this.post(e,this.rootUrl+"/users/"+t+"/claims")},t.prototype.SaveProvider=function(t,e,n,o){var r=h({Name:t,Description:e,Type:n},o);return this.post(r,this.rootUrl+"/providers")},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.Injector}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(u.INJECTOR))},token:t,providedIn:"root"}),t}(c.DAFService),H=function(n){function t(t){var e=n.call(this,t)||this;return e.injector=t,e.rootUrl="/forge-api/org",e}return g(t,n),t.prototype.Configure=function(t){return this.post({Host:t},this.rootUrl+"/configure")},t.prototype.Get=function(){return this.get(""+this.rootUrl)},t.prototype.List=function(t,e){return this.get(this.rootUrl+"/list/"+t+"/"+e)},t.prototype.ListFabricApplicationServices=function(){return this.get(this.rootUrl+"/fabric/app/services")},t.prototype.ListHosts=function(){return this.get(this.rootUrl+"/hosts")},t.prototype.LoadAppPageCSS=function(t,e){return this.get(this.rootUrl+"/app-page-css/"+t+"?pagePath="+encodeURIComponent(e))},t.prototype.RefreshApps=function(){return this.get(this.rootUrl+"/refresh-apps")},t.prototype.Save=function(t){return this.post(t,""+this.rootUrl)},t.prototype.SetAppBuilder=function(t){return this.post({Builder:t},this.rootUrl+"/app-builder")},t.prototype.SetHasApps=function(){return this.post({},this.rootUrl+"/has-apps")},t.prototype.Secure=function(t,e){return this.get(this.rootUrl+"/secure/"+t+"?orgId="+e)},t.prototype.SecureHost=function(t){return this.post({Host:t},this.rootUrl+"/secure/host")},t.prototype.UploadApplicationPackage=function(t,e,n){var o=new FormData;o.append("fileKey",t,t.name);var r=new a.Headers({appId:e,filesPath:n}),i=new a.RequestOptions({headers:r});return this.http.post(this.rootUrl+"/app-package",o,i).pipe(this.map(),this.catchError())},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.Injector}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(u.INJECTOR))},token:t,providedIn:"root"}),t}(c.DAFService),J=function(){function t(t,e){var i=this;this.dialog=t,this.snackBar=e,this.Dialog={Open:function(t,e,n,o){void 0===n&&(n=null),void 0===o&&(o=null);var r=i.dialog.open(t,{width:o||"300px",data:e});return n&&r.afterClosed().subscribe(function(t){return n(t)}),r}},this.Notify={Open:function(t,e,n,o){var r=i.snackBar.open(t,e,o);return n&&r.afterDismissed().subscribe(function(t){return n(t.dismissedByAction)}),r},Signal:function(t,e){return void 0===e&&(e=2750),i.snackBar.open(t,null,{duration:e})}},this.SideNav={Close:function(){i.sideNav&&i.sideNav.close()},Open:function(){i.sideNav&&i.sideNav.open()},Set:function(t){i.sideNav=t},Toggle:function(){i.sideNav&&i.sideNav.toggle()}}}return t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:n.MatDialog},{type:n.MatSnackBar}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(o.MatDialog),u.inject(i.MatSnackBar))},token:t,providedIn:"root"}),t}(),G=function(n){function t(t){var e=n.call(this,t)||this;return e.injector=t,e.handleNewReportUrl="new",e.listDashboardsUrl="dashboard/list",e.listDatasetsUrl="dataset/list",e.listReportsUrl="report/list",e.listTilesUrl="tile/list",e.loadDashboardConfigUrl="/dashboard/config",e.loadReportConfigUrl="/report/config",e.loadTileConfigUrl="/tile/config",e.rootUrl="/forge-api/embed",e}return g(t,n),t.prototype.HandleNewReport=function(t){return this.get(this.rootUrl+"/"+this.handleNewReportUrl+"?datasetLookup="+t)},t.prototype.ListDashboards=function(){return this.get(this.rootUrl+"/"+this.listDashboardsUrl)},t.prototype.ListDatasets=function(){return this.get(this.rootUrl+"/"+this.listDatasetsUrl)},t.prototype.ListReports=function(){return this.get(this.rootUrl+"/"+this.listReportsUrl)},t.prototype.ListTiles=function(t){return this.get(this.rootUrl+"/"+this.listTilesUrl+"?dashboardLookup="+t)},t.prototype.LoadDashboardConfig=function(t){return this.get(this.rootUrl+"/"+this.loadDashboardConfigUrl+"/"+t)},t.prototype.LoadReportConfig=function(t){return this.get(this.rootUrl+"/"+this.loadReportConfigUrl+"/"+t)},t.prototype.LoadTileConfig=function(t,e){return this.get(this.rootUrl+"/"+this.loadTileConfigUrl+"/"+t+"?dashboardLookup="+e)},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.Injector}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(u.INJECTOR))},token:t,providedIn:"root"}),t}(c.DAFService),W=function(i){function t(t,e,n,o){var r=i.call(this,t)||this;return r.injector=t,r.router=e,r.configSvc=n,r.route=o,r.error=new l.BehaviorSubject({Code:-1,Message:"Initialized"}),r.Error=r.error.asObservable(),r.loaded=new l.BehaviorSubject(!1),r.Loaded=r.loaded.asObservable(),r.loading=new l.BehaviorSubject(!1),r.Loading=r.loading.asObservable(),r.winAny=window,r}return g(t,i),Object.defineProperty(t.prototype,"HasChanges",{get:function(){return this.loadedSolutionCheck!=JSON.stringify(this.Solution)},enumerable:!0,configurable:!0}),t.prototype.RefreshSettings=function(t){var n=this;return this.Lookup=t,new l.Observable(function(e){n.loading.next(!0),n.error.next({Code:-1,Message:"Initialized"}),n.configSvc.Get("SolutionElement-"+n.Lookup).subscribe(function(t){p.isResultSuccess(t)?n.Solution=t.Model:2==t.Status.Code?n.Solution={}:n.error.next(t.Status),n.Solution&&(n.loadedSolutionCheck=JSON.stringify(n.Solution),n.loading.next(!1),n.loaded.next(!0),e.next({Code:0,Message:"Success"}),e.complete())})})},t.prototype.Save=function(){var n=this;return new l.Observable(function(e){n.loading.next(!0),n.error.next({Code:-1,Message:"Initialized"}),n.configSvc.Save("SolutionElement-"+n.Lookup,n.Solution).subscribe(function(t){p.isResultSuccess(t)?(n.loading.next(!1),e.next(t.Status)):(n.loading.next(!1),n.error.next(t.Status),e.next({Code:0,Message:"Success"})),e.complete()},function(t){n.loading.next(!1),e.next({Code:0,Message:"Success"}),e.complete()})})},t.decorators=[{type:u.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.Injector},{type:s.Router},{type:f.SingletonService},{type:s.ActivatedRoute}]},t.ngInjectableDef=u.defineInjectable({factory:function(){return new t(u.inject(u.INJECTOR),u.inject(s.Router),u.inject(f.SingletonService),u.inject(s.ActivatedRoute))},token:t,providedIn:"root"}),t}(c.DAFService);t.DataFlowContext=y,t.DatabaseContext=S,t.DataSetContext=C,t.DBConfigContext=O,t.DeviceTypeContext=P,t.DEVICES_CONFIG_TYPE=L,t.DevicesConfigContext=U,t.ForgeSettingsContext=x,t.PageSettingsContext=m,t.PagesSetupContext=k,t.PointersConfigContext=D,t.ProvisioningConfigContext=B,t.ReportingConfigContext=E,t.SolutionsSetupContext=A,t.ForgeApplicationsService=M,t.DataMapperService=N,t.DatabaseService=j,t.ForgeJSONSchemaService=T,t.ForgeOrganizationIdentityService=F,t.ForgeOrganizationService=H,t.PageUIService=J,t.ForgePageService=w,t.ProvisioningService=R,t.ReportingService=G,t.ForgeSolutionService=W,t.WorkerService=I,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=lcu-daf-common.umd.min.js.map