!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("@angular/common"),require("immutable"),require("lodash"),require("rxjs/operators"),require("typescript-logging")):"function"==typeof define&&define.amd?define("@ngx-dino/core",["exports","@angular/core","rxjs","@angular/common","immutable","lodash","rxjs/operators","typescript-logging"],t):t(((e=e||self)["ngx-dino"]=e["ngx-dino"]||{},e["ngx-dino"].core={}),e.ng.core,e.rxjs,e.ng.common,e.immutable,e.lodash,e.rxjs.operators,e.typescriptLogging)}(this,(function(e,t,n,r,o,i,a,s){"use strict";
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */var u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function c(e,t){function n(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function l(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function f(e,t){return function(n,r){t(n,r,e)}}function d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function h(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}var v=function(){function e(){}return e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=l([t.Injectable({providedIn:"root"}),d("design:paramtypes",[])],e)}(),y=function(){function e(){}return e.prototype.ngOnInit=function(){},e=l([t.Component({selector:"dino-core",template:"\n    <p>\n      core works!\n    </p>\n  "}),d("design:paramtypes",[])],e)}(),m=function(){function e(){this.onResize=n.NEVER}return e.prototype.destroy=function(){},e}(),b=function(){function e(e){this.onResize=new t.EventEmitter,this.observer=new ResizeObserver(this.onResizeImpl.bind(this)),this.observer.observe(e.nativeElement)}return e.prototype.destroy=function(){this.observer.disconnect()},e.prototype.onResizeImpl=function(e){var t=e[0].contentRect,n=t.width,r=t.height;this.onResize.emit({width:n,height:r})},e}(),S=["absolute","relative","fixed"],I="\n  position: absolute;\n  left: -10px;\n  top: -10px;\n  right: 0;\n  bottom: 0;\n  overflow: hidden;\n  z-index: -1;\n  visibility: hidden;\n  max-width: 100%\n",w=function(){function e(e,n){var r,o,i;if(this.element=e,this.renderer=n,this.onResize=new t.EventEmitter,this.dirty=!1,this.hiddenCheck=!0,window){var a=window.getComputedStyle(e.nativeElement),s=a?a.getPropertyValue("position"):void 0;S.indexOf(s)<0&&n.setStyle(e.nativeElement,"position","relative")}var u=this.sensorElement=n.createElement("div");n.setProperty(u,"dir","ltr"),n.addClass(u,"dino-generic-resize-sensor"),n.setAttribute(u,"style",I),r=h(this.createSubSensor(n,u,"expand"),2),this.expandSensorElement=r[0],this.innerExpandSensorElement=r[1],o=h(this.createSubSensor(n,u,"shrink","width: 200%; height: 200%;"),2),this.shrinkSensorElement=o[0],this.innerShrinkSensorElement=o[1],n.appendChild(e.nativeElement,u),i=this.size=this.getSize(),this.lastWidth=i.width,this.lastHeight=i.height;var c=this.expandSensorElement,p=this.shrinkSensorElement,l=this.onScrollImpl.bind(this);n.listen(c,"scroll",l),n.listen(p,"scroll",l),this.resetImpl()}return e.prototype.destroy=function(){this.renderer.removeChild(this.element.nativeElement,this.sensorElement)},e.prototype.reset=function(){this.hiddenCheck=!0,this.resetImpl()},e.prototype.getSize=function(){var e=this.element.nativeElement;if(e.getBoundingClientRect){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return{width:Math.round(n),height:Math.round(r)}}return{width:e.offsetWidth,height:e.offsetHeight}},e.prototype.createSubSensor=function(e,t,n,r){void 0===r&&(r="");var o=e.createElement("div"),i=e.createElement("div");return e.addClass(o,"dino-generic-resize-sensor-"+n),e.setAttribute(o,"style",I),e.setAttribute(i,"style","\n  position: absolute;\n  left: 0;\n  top: 0;\n  transition: 0s;\n "+r),e.appendChild(o,i),e.appendChild(t,o),[o,i]},e.prototype.resetSensors=function(){var e=this.renderer,t=this.expandSensorElement,n=this.innerExpandSensorElement,r=this.shrinkSensorElement;e.setStyle(n,"width","100000px"),e.setStyle(n,"height","100000px"),e.setProperty(t,"scrollLeft",1e5),e.setProperty(t,"scrollTop",1e5),e.setProperty(r,"scrollLeft",1e5),e.setProperty(r,"scrollTop",1e5)},e.prototype.resetImpl=function(){var e=this;if(this.hiddenCheck){var t=this.expandSensorElement;t.scrollLeft||t.scrollTop?this.hiddenCheck=!1:(this.resetSensors(),this.resetId||(this.resetId=requestAnimationFrame((function(){e.resetId=void 0,e.resetImpl()}))))}this.resetSensors()},e.prototype.onResizeImpl=function(){var e;this.callbackId=void 0,this.dirty&&(e=this.size,this.lastWidth=e.width,this.lastHeight=e.height,this.onResize.emit(this.size))},e.prototype.onScrollImpl=function(){var e=this.size=this.getSize(),t=e.width,n=e.height;this.dirty=t!==this.lastWidth||n!==this.lastHeight,this.dirty&&!this.callbackId&&(this.callbackId=requestAnimationFrame(this.onResizeImpl.bind(this))),this.resetImpl()},e}(),L=function(){function e(e){var t=r.isPlatformBrowser(e),n="undefined"!=typeof ResizeObserver;this.sensorType=t?n?b:w:m}return e.prototype.createSensor=function(e,t){return new this.sensorType(e,t)},e.ctorParameters=function(){return[{type:String,decorators:[{type:t.Inject,args:[t.PLATFORM_ID]}]}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(t.PLATFORM_ID))},token:e,providedIn:"root"}),e=l([t.Injectable({providedIn:"root"}),f(0,t.Inject(t.PLATFORM_ID)),d("design:paramtypes",[String])],e)}(),E=function(){function e(e,t,n){this.sensor=n.createSensor(e,t),this.resize=this.sensor.onResize}return e.prototype.reset=function(){this.sensor.reset&&this.sensor.reset()},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2},{type:L}]},l([t.Output("dinoAutoResize"),d("design:type",n.Observable)],e.prototype,"resize",void 0),l([t.HostListener("document:auto-resize-reset"),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],e.prototype,"reset",null),e=l([t.Directive({selector:"[dinoAutoResize]"}),d("design:paramtypes",[t.ElementRef,t.Renderer2,L])],e)}(),x=function(){function e(){}return e=l([t.NgModule({imports:[],declarations:[y,E],exports:[y,E]})],e)}(),j=function(e,t,n,r,o){this.type="string"==typeof e?e:e.type,this.data=t,this.processed=n,this.target=r,this.sourceEvent=void 0===o&&"string"!=typeof e?e:o},C=function(){function e(){}return e.prototype.equals=function(t){return this===t||t instanceof e&&o.is(this.getCachedState(),t.getCachedState())},e.prototype.hashCode=function(){return this.getCachedState().hashCode()},e.prototype.getCachedState=function(){return this.cachedState||(this.cachedState=this.getState())},e}();function q(e,t,n){return void 0===t&&(t=[]),void 0===n&&(n=[]),e+"<"+[o.Seq.Indexed(t).map((function(e){var t=h(e,2);return t[0]+": "+t[1]})).join("|"),o.Seq.Indexed(n).map((function(e){return""+e})).join("|")].filter((function(e){return e})).join("|")+">"}var O=function(e){function t(t,n){var r=e.call(this)||this;return r.bits=t,r._name=n,r}return c(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return void 0===this._name&&(this._name=this.getNames().join("|")),"Flags<"+this._name+">"},enumerable:!0,configurable:!0}),t.combine=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(e=t.None).or.apply(e,g(n))},t.prototype.has=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.all.apply(this,g(e))},t.prototype.all=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.every((function(t){return(t.bits&e.bits)===t.bits}))},t.prototype.any=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.some((function(t){return(t.bits&e.bits)===t.bits}))},t.prototype.not=function(){return new t(~this.bits&t.All.bits)},t.prototype.or=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.reduce((function(e,t){return e|t}),e)},t.prototype.and=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.reduce((function(e,t){return e&t}),e)},t.prototype.xor=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.reduce((function(e,t){return e^t}),e)},t.prototype.getState=function(){return o.List.of(this.bits)},t.prototype.toString=function(){return this.name},t.prototype.reduce=function(e,n){return new t(n.reduce((function(t,n){return e(t,n.bits)}),this.bits))},t.prototype.withName=function(e){return new t(this.bits,e)},t.prototype.getNames=function(){var e=this;return this.bits===t.None.bits?[t.None._name]:this.bits===t.All.bits?[t.All._name]:t.FlagList.filter((function(t){return e.has(t)})).map((function(e){return e._name}))},t.Stateless=new t(1,"Stateless"),t.InputIndependent=new t(2,"InputIndependent"),t.SideEffectFree=new t(4,"SideEffectFree"),t.FlagList=[t.Stateless,t.InputIndependent,t.SideEffectFree],t.None=new t(0,"None"),t.All=t.combine.apply(t,g(t.FlagList)).withName("All"),t}(C),_=function(e){function t(t){void 0===t&&(t=O.None);var n=e.call(this)||this;return n.flags=t,n.id=i.uniqueId("operator_"),n}return c(t,e),t.prototype.setFlags=function(e){this.flags=e},t.prototype.get=function(e,t){try{return t.enter(),this.getImpl(e,t)}finally{t.exit()}},t.prototype.getState=function(){return o.List.of(this.flags,this.getStateImpl())},t}(C),F=function(){function e(){}return e.prototype.enter=function(){},e.prototype.exit=function(){},e.prototype.clear=function(){},e}(),R=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.enter=function(){},t.prototype.exit=function(){},t.prototype.get=function(e,t){return e.get(t,this)},t.prototype.clear=function(){},t}(F),P=function(e){function t(n){var r=e.call(this,n.flags)||this;return r.wrapped=n,n instanceof t?n:r}return c(t,e),t.prototype.getImpl=function(e,t){return this.wrapped.getImpl(e,t)},t.prototype.getStateImpl=function(){return this.wrapped.getStateImpl()},t.prototype.get=function(e,t){return void 0===t&&(t=new R),this.wrapped.get(e,t)},Object.defineProperty(t.prototype,"getter",{get:function(){var e=this;return void 0===this.cachedGetter&&(this.cachedGetter=function(t){return e.get(t)}),this.cachedGetter},enumerable:!0,configurable:!0}),t}(_);var k=O.combine(O.Stateless,O.SideEffectFree),z=function(e){function t(t,n){var r=e.call(this,k)||this;return r.path=t,r.defaultValue=n,r}return c(t,e),t.prototype.getImpl=function(e,t){return i.get(e,this.path,this.defaultValue)},t.prototype.getStateImpl=function(){var e=o.List(i.toPath(this.path));return o.List.of(e,this.defaultValue)},t}(_);function A(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new(e.bind.apply(e,g([void 0],t)))}function M(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new P(A.apply(void 0,g([e],t)))}var D=O.combine(O.Stateless,O.SideEffectFree),T=o.List.of({}),N=function(e){function t(){return e.call(this,D)||this}return c(t,e),t.prototype.getImpl=function(e,t){return e},t.prototype.getStateImpl=function(){return T},t}(_);var K=O.combine(O.Stateless,O.SideEffectFree),W=function(e){function t(t,n){var r=e.call(this,K)||this;return r.defaultValue=n,r.mapping=o.Map(t),r}return c(t,e),t.prototype.getImpl=function(e,t){return this.mapping.get(e,this.defaultValue)},t.prototype.getStateImpl=function(){return o.List.of(this.mapping,this.defaultValue)},t}(_);var B=O.combine(O.InputIndependent,O.SideEffectFree),V=function(e){function t(t,n){void 0===t&&(t=""),void 0===n&&(n=0);var r=e.call(this,B)||this;return r.prefix=t,r._counter=n,r}return c(t,e),Object.defineProperty(t.prototype,"counter",{get:function(){return this._counter},enumerable:!0,configurable:!0}),t.prototype.getImpl=function(e,t){return""+this.prefix+this._counter++},t.prototype.getStateImpl=function(){return o.List.of(this.id)},t}(_);var U=O.combine(O.Stateless,O.SideEffectFree,O.InputIndependent),H=function(e){function t(t){var n=e.call(this,U)||this;return n.value=t,n}return c(t,e),t.prototype.getImpl=function(e,t){return this.value},t.prototype.getStateImpl=function(){return o.List.of(this.value)},t}(_);function G(e){return e.wrapped||e}var J=o.List.of({});function Z(e){return function(e){var t=!1;return e.reduceRight((function(e,n){return t&&n.flags.has(O.SideEffectFree)||(e.push(n),t=n.flags.has(O.InputIndependent)),e}),[]).reverse()}(i.chain(e).compact().map(G).reject((function(e){return e instanceof N})).flatMap((function(e){return e instanceof X?e.operators.toArray():e})).value())}function Q(e){var t,n=e.map((function(e){return e.flags})),r=e.first(),o=r&&r.flags.has(O.InputIndependent);return(t=O.All).and.apply(t,g(n.toArray())).or(o?O.InputIndependent:O.None)}var X=function(e){function t(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.call(this)||this;return r.operators=o.List(Z(t)),e.prototype.setFlags.call(r,Q(r.operators)),r}return c(t,e),t.prototype.getImpl=function(e,t){return this.operators.reduce((function(e,n){return t.get(n,e)}),e)},t.prototype.getStateImpl=function(){return 0!==this.operators.size?this.operators:J},t}(_);function Y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return M.apply(void 0,g([X],e))}function $(e,t,n){var r=o.Map().asMutable(),a=i.cloneDeepWith(e,(function(e,i,a,s){var u=t({state:n,value:e,key:i,owner:a,stack:s}),c=u.result,p=u.remove;return void 0!==p&&p&&s?(r.update(s.get(a),(function(e){return void 0===e&&(e=o.List()),e.push(i)})),e):c}));return r.forEach((function(e,t){return function(e,t){i.isFunction(e.delete)?t.forEach(e.delete.bind(e)):t.forEach((function(t){return delete e[t]}))}(t,e)})),a}var ee=function(e){function t(t){return e.call(this,{path:t})||this}return c(t,e),t}(o.Record({path:o.List()}));function te(e){var t=e.state,n=e.value,r=e.key,a=e.owner;if(!i.isObject(n))return{};if(t.cycles.has(n))return{result:t.cycles.get(n)};var s=t.paths.get(a),u=r?s.push(r):o.List(),c=new ee(u);return t.paths.set(n,u),t.cycles.set(n,c),{}}function ne(e){var t=e.state,n=e.value;return n instanceof _?(t.flags=t.flags.and(n.flags),{result:G(n)}):{}}function re(e){var t=e.state,n=e.value;if(n instanceof _){var r=n.get(t.data,t.cache);return{result:r,remove:void 0===r}}return{}}var oe=function(e){function t(t){var n=e.call(this)||this,r={flags:O.All};return n.schema=$(t,ne,r),e.prototype.setFlags.call(n,r.flags),n}return c(t,e),t.prototype.getImpl=function(e,t){var n={data:e,cache:t};return $(this.schema,re,n)},t.prototype.getStateImpl=function(){var e={paths:o.Map().asMutable(),cycles:o.Map().asMutable()};return o.fromJS($(this.schema,te,e))},t}(_);var ie=function(e){function t(t,n){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var i=e.call(this,t)||this;return i.mapper=n,i.args=r,i.callArgs=[void 0].concat(r),i}return c(t,e),t.prototype.getImpl=function(e,t){return this.callArgs[0]=e,this.mapper.apply(void 0,this.callArgs)},t.prototype.getStateImpl=function(){return this.callArgs[0]=this.mapper,o.List(this.callArgs)},t}(_),ae=O.combine(O.Stateless,O.SideEffectFree);var se,ue=function(e){function t(t,n,r){var o=e.call(this)||this;return o.id=t,o.field=n,o.operator=r,o}return c(t,e),Object.defineProperty(t.prototype,"label",{get:function(){return this.field.label},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataType",{get:function(){return this.field.dataType},enumerable:!0,configurable:!0}),t.prototype.get=function(e,t){return this.operator.get(e,t)},Object.defineProperty(t.prototype,"getter",{get:function(){return this.operator.getter},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return q("BoundField",o.Seq.Keyed([["id",this.id],["field",this.field]]))},t.prototype.getState=function(){return o.List.of(this.id,this.field)},t}(C);(se=e.DataType||(e.DataType={})).Boolean="boolean",se.Number="number",se.String="string",se.Any="any";var ce=function(t){function n(r){var a,s,u,c=t.call(this)||this;if(a=r.id,c.id=void 0===a?i.uniqueId("field_"):a,c.label=r.label,s=r.dataType,c.dataType=void 0===s?e.DataType.Any:s,u=r.mapping,c.mapping=o.Seq.Keyed(u).map((function(e,t){return new ue(t,c,e)})).toMap(),c.mapping.has(n.defaultSymbol)){var p=c.mapping.get(n.defaultSymbol).operator,l=c.mapping.find((function(e,t){return e.operator.equals(p)&&t!==n.defaultSymbol}));void 0!==l&&(c.mapping=c.mapping.set(n.defaultSymbol,l))}return c}return c(n,t),n.prototype.getBoundFieldIds=function(){return this.mapping.keySeq().filter((function(e){return e!==n.defaultSymbol})).valueSeq()},n.prototype.getBoundField=function(e){return void 0===e&&(e=n.defaultSymbol),this.mapping.get(e)},n.prototype.toString=function(){var e=o.Seq.Keyed(this.mapping.filter((function(e,t){return t!==n.defaultSymbol})).map((function(e){return e.operator})).entrySeq().sort((function(e,t){var n,r,o=h(e,1)[0],i=h(t,1)[0];return(n=o)<(r=i)?-1:n>r?1:0})));return q("Field",o.Seq.Keyed([["id",this.id],["label",this.label],["dataType",this.dataType],["mapping",e]]))},n.prototype.getState=function(){var e=this.mapping.map((function(e){return e.operator}));return o.List.of(this.dataType,e)},n.defaultSymbol="__ngx-dino-field-default__",n}(C);function pe(e){var t,n=o.Seq.Keyed(e.mapping),r=e.defaultId,i=r&&n.get(r),a=i?((t={})[ce.defaultSymbol]=i,t):{},s=n.concat(a).toSeq(),u=p(p({},e),{mapping:s});return new ce(u)}function le(e){return i.isNumber(e)||i.isString(e)}function fe(e,t){return le(e)?e:t.get(e)}var de="__ngx-dino-datum-id__",he="__ngx-dino-datum-raw-data__";var ge=function(e,t){this[de]=e,this[he]=t},ve=function(){function e(e,t,n,r){void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===n&&(n=[]),void 0===r&&(r=[]),this.insert=e,this.remove=t,this.update=n,this.replace=r}return e.fromArray=function(t){return new e(t)},e}();function ye(e,t){return new ge(fe(t,e),t)}function me(e,t){var n=h(t,2),r=n[0],o=n[1];return new ge(fe(r,e),o)}var be=function(){function e(e,t,n,r){void 0===e&&(e=o.Seq.Indexed()),void 0===t&&(t=o.Seq.Indexed()),void 0===n&&(n=o.Seq.Indexed()),void 0===r&&(r=o.Seq.Indexed()),this.insert=e,this.remove=t,this.update=n,this.replace=r}return e.fromRawChangeSet=i.curry((function(t,n){var r=ye.bind(void 0,t),i=me.bind(void 0,t);return new e(o.Seq.Indexed(n.insert).map(r).toIndexedSeq(),o.Seq.Indexed(n.remove).map(r).toIndexedSeq(),o.Seq.Indexed(n.update).map(i).toIndexedSeq(),o.Seq.Indexed(n.replace).map(i).toIndexedSeq())})),e}();function Se(e){var t=o.Seq.Indexed(e).map((function(e){return[e[de],e]}));return o.Seq.Keyed(t)}var Ie=function(e){function t(t,n){void 0===t&&(t=!1),void 0===n&&(n=o.Map());var r=e.call(this)||this;return r.strictMode=t,r.items=n,r}return c(t,e),t.prototype.update=function(e){var n=this,r=i.bind(this.mergeInsert,this),o=i.bind(this.mergeReplace,this),a=this.items.mergeWith(r,Se(e.insert)).mergeWith(o,Se(e.replace)).withMutations((function(t){var r=i.bind(n.applyUpdate,n,t);e.update.forEach(r)})).withMutations((function(t){var r=i.bind(n.removeItem,n,t);e.remove.forEach(r)}));return new t(this.strictMode,a)},t.prototype.clear=function(){return new t(this.strictMode)},t.prototype.mergeInsert=function(e,t,n){var r="Item already inserted for key: "+n;return this.checkStrict(void 0===e,t,r)},t.prototype.mergeReplace=function(e,t){return t},t.prototype.applyUpdate=function(e,t){var n=t[de],r=e.get(n);if(void 0!==r){var o=r[he],a=t[he],s=i.assign({},o,a);e.set(n,s)}else{var u="Unable to update missing item for key: "+n;this.checkStrict(!1,void 0,u)}},t.prototype.removeItem=function(e,t){var n=t[de],r="Unable to remove missing item for key: "+n;this.checkStrict(e.has(n),e.delete(n),r)},t.prototype.checkStrict=function(e,t,n){if(this.strictMode&&!e)throw new Error(n);return t},t.prototype.getState=function(){return this.items},t}(C),we=function(){function e(e,t){var r=this;this.stream=e,this.emitStream=new n.Subject,this.cache=new Ie(t),this.cachedStream=n.merge(e.pipe(a.tap({next:function(e){return r.cache=r.cache.update(e)},complete:function(){return r.emitStream.complete()}})),this.emitStream)}return e.prototype.reemit=function(){var e=this.cache.items.valueSeq(),t=new be(void 0,void 0,void 0,e);this.emitStream.next(t)},e.prototype.clear=function(){var e=this.cache.items.valueSeq(),t=new be(void 0,e);this.cache=this.cache.clear(),this.emitStream.next(t)},e.prototype.asObservable=function(){return this.cachedStream},e}(),Le=function(){function e(e,t){this.extracted=e,this.computed=t}return e.prototype.process=function(e){var t=e[he];return this.extracted.forEach((function(n,r){e[r]=n.get(t)})),this.computed.forEach((function(t,n){e[n]=t.get(e)})),e},e}();function Ee(e,t){return new ge(e,t)}var xe=function(){function e(e,t,r,s){var u=this;void 0===t&&(t=o.Seq.Keyed()),void 0===r&&(r=o.Seq.Keyed()),void 0===s&&(s={}),this.rawCache=e,this.emitStream=new n.Subject,this.datumProcessor=new Le(t,r),this.config=i.defaults({},s,{strictMode:!1,keepAlive:!1,create:Ee});var c=i.bind(this.processChanges,this),p=e.asObservable().pipe(a.map(c),a.tap({complete:function(){return!u.config.keepAlive&&u.emitStream.complete()}}));this.processedCache=new we(n.merge(p,this.emitStream),this.config.strictMode);var l=e.cache.items.valueSeq();this.insertAll(l)}return e.prototype.updateFields=function(e,t){void 0===e&&(e=o.Seq.Keyed()),void 0===t&&(t=o.Seq.Keyed());var n=o.Map().merge(this.datumProcessor.extracted,e),r=o.Map().merge(this.datumProcessor.computed,t),i=this.rawCache.cache.items.valueSeq();return this.datumProcessor=new Le(n,r),this.processedCache.clear(),this.insertAll(i),this},e.prototype.asObservable=function(){return this.processedCache.asObservable()},e.prototype.processChanges=function(e){var t=this.processInsert(e.insert),n=this.processRemove(e.remove),r=this.processUpdate(e.update),o=this.processReplace(e.replace);return new be(t,n,void 0,o.concat(r).toIndexedSeq())},e.prototype.processInsert=function(e){var t=i.bind(this.processDatum,this);return e.map(t).toIndexedSeq()},e.prototype.processRemove=function(e){return e},e.prototype.processUpdate=function(e){var t=this,n=this.rawCache.cache.items;return e.map((function(e){var r=e[de],o=n.get(r);return t.processDatum(o)})).toIndexedSeq()},e.prototype.processReplace=function(e){var t=i.bind(this.processDatum,this);return e.map(t).toIndexedSeq()},e.prototype.processDatum=function(e){var t=e[de],n=e[he],r=this.config.create(t,n);return this.datumProcessor.process(r)},e.prototype.insertAll=function(e){var t=this,n=this.processChanges(new be(e));setTimeout((function(){return t.emitStream.next(n)}),0)},e}(),je=o.Map().asMutable();var Ce,qe,Oe,_e=function(){function e(){}return e.prototype.createProcessor=function(e,t,n,r,i){void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={});var s=function(e,t){var n=je.get(e);if(void 0===n){var r=e.pipe(a.tap({complete:function(){return je.delete(e)}}),a.map(be.fromRawChangeSet(t)));n=new we(r),je.set(e,n)}return n}(e,t),u=o.Seq.Keyed(n),c=o.Seq.Keyed(r);return new xe(s,u,c,i)},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=l([t.Injectable({providedIn:"root"}),d("design:paramtypes",[])],e)}();(Ce=e.LogLevel||(e.LogLevel={}))[Ce.Trace=0]="Trace",Ce[Ce.Debug=1]="Debug",Ce[Ce.Info=2]="Info",Ce[Ce.Warn=3]="Warn",Ce[Ce.Error=4]="Error",Ce[Ce.Fatal=5]="Fatal",Ce[Ce.Off=6]="Off",(qe=e.LogLevel_Ext||(e.LogLevel_Ext={})).fromString=function(t,n){var r=i.defaultTo(e.LogLevel[i.capitalize(t)],n);if(void 0===r)throw new Error("Unknown log level name: "+t);return r},qe.toString=function(t,n){var r=e.LogLevel[t]||n;if(void 0===r)throw new Error("Unknown log level: "+t);return r},function(e){function t(e){return i.isString(e)?{msg:e}:e}e.normalizeMessage=function(e){if(i.isFunction(e))return function(){return t(e())};var n=t(e);return function(){return n}},e.normalizeError=function(e){return i.isFunction(e)?e:function(){return e}}}(Oe||(Oe={}));var Fe,Re=new t.InjectionToken("Logger Configuration"),Pe=function(){function e(){}var n;return n=e,e.use=function(e){return{provide:n,useExisting:e}},e.prototype.createLogger=function(e,t){return new ze(e,t)},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=n=l([t.Injectable({providedIn:"root"})],e)}(),ke=function(){return new Logger_1(void 0,{name:"root"})},ze=function(){function n(t,n){this.children=[],this.name=n.name,this.parent=t||void 0,this._level=i.defaultTo(n.level,e.LogLevel.Error),t&&t.children.push(this)}var r;return r=n,Object.defineProperty(n.prototype,"parents",{get:function(){return this._parents||(this._parents=this.getAllParents())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"level",{get:function(){return this._level},enumerable:!0,configurable:!0}),n.withConfig=function(e){return{provide:Re,useValue:e}},n.create=function(){return{provide:r,useFactory:function(e,t,n){return e.createLogger(t,n)},deps:[Pe,[new t.Optional,new t.SkipSelf,r],[new t.Self,Re]]}},n.prototype.ngOnDestroy=function(){if(this.parent){var e=this.parent.children.indexOf(this);e>=0&&this.parent.children.splice(e,1)}},n.prototype.setLevel=function(e,t){void 0===t&&(t=!0),this._level=e,this.doSetLevel(e,t),t&&this.children.forEach((function(t){return t.setLevel(e,!0)}))},n.prototype.isLevelEnabled=function(t){return t>=this.level&&t!==e.LogLevel.Off},n.prototype.isTraceEnabled=function(){return this.isLevelEnabled(e.LogLevel.Trace)},n.prototype.isDebugEnabled=function(){return this.isLevelEnabled(e.LogLevel.Debug)},n.prototype.isInfoEnabled=function(){return this.isLevelEnabled(e.LogLevel.Info)},n.prototype.isWarnEnabled=function(){return this.isLevelEnabled(e.LogLevel.Warn)},n.prototype.isErrorEnabled=function(){return this.isLevelEnabled(e.LogLevel.Error)},n.prototype.isFatalEnabled=function(){return this.isLevelEnabled(e.LogLevel.Fatal)},n.prototype.log=function(t,n,r){this.isLevelEnabled(t)&&t!==e.LogLevel.Off&&this.doLog(t,Oe.normalizeMessage(n),r&&Oe.normalizeError(r))},n.prototype.trace=function(t){this.log(e.LogLevel.Trace,t)},n.prototype.debug=function(t){this.log(e.LogLevel.Debug,t)},n.prototype.info=function(t){this.log(e.LogLevel.Info,t)},n.prototype.warn=function(t){this.log(e.LogLevel.Warn,t)},n.prototype.error=function(t,n){this.log(e.LogLevel.Error,t,n)},n.prototype.fatal=function(t,n){this.log(e.LogLevel.Fatal,t,n)},n.prototype.doLog=function(e,t,n){},n.prototype.doSetLevel=function(e,t){},n.prototype.getAllParents=function(){for(var e=[],t=this.parent;t;)e.push(t),t=t.parent;return e},n.ctorParameters=function(){return[{type:n},{type:void 0,decorators:[{type:t.Inject,args:["this does not exist"]}]}]},n.ɵprov=t.ɵɵdefineInjectable({factory:ke,token:n,providedIn:"root"}),n=r=l([t.Injectable({providedIn:"root",useFactory:ke}),f(1,t.Inject("this does not exist")),d("design:paramtypes",[n,Object])],n)}();!function(e){e.createIntermediateCategories=function(e){var t=e.parents,n=t.findIndex((function(e){return e instanceof Te})),r=(n>=0?t.slice(0,n):t).map((function(e){return e.name})),o=n>=0?t[n].category:new s.Category("root");return r.reduceRight((function(e,t){return new s.Category(t,e)}),o)}}(Fe||(Fe={}));var Ae,Me,De=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return c(n,e),n.prototype.createLogger=function(e,t){return new Te(e,t)},n.prototype.configure=function(e,t,n){void 0===e&&(e=s.LoggerType.Console),void 0===t&&(t=new s.CategoryLogFormat);var r=new s.CategoryConfiguration(s.LogLevel.Trace,e,t,n||null);s.CategoryServiceFactory.setDefaultConfiguration(r,!0)},n.ngInjectableDef=void 0,n.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new n},token:n,providedIn:"root"}),n=l([t.Injectable({providedIn:"root"})],n)}(Pe),Te=function(n){function r(e,t){var r=n.call(this,e,t)||this;return r.category=new s.Category(t.name,Fe.createIntermediateCategories(r)),r}return c(r,n),r.prototype.doLog=function(t,n,r){var o=e.LogLevel_Ext.toString(t).toLowerCase(),a=t<e.LogLevel.Error?[n]:[n,r];i.invoke.apply(void 0,g([this.category,o],a))},r.ɵprov=t.ɵɵdefineInjectable({factory:ke,token:r,providedIn:"root"}),r=l([f(1,t.Inject("this does not exist")),d("design:paramtypes",[ze,Object])],r)}(ze),Ne="undefined"!=typeof Event?Event:function(e,t){this.name=e,this.options=t};(Ae=function(e){void 0===e&&(e={});var t=new Ne("auto-resize-reset",Object.assign({bubbles:!0},e));return Object.setPrototypeOf(t,Me),t}).eventName="auto-resize-reset",(Me=Ae.prototype=Object.create(Ne.prototype)).constructor=Ae;var Ke=Ae;e.AutoResizeDirective=E,e.AutoResizeResetEvent=Ke,e.BaseCache=F,e.BaseOperator=_,e.BoundField=ue,e.CachedChangeStream=we,e.ChangeCache=Ie,e.ChangeSet=be,e.CoreComponent=y,e.CoreModule=x,e.CoreService=v,e.DataProcessor=xe,e.DataProcessorService=_e,e.Datum=ge,e.DatumProcessor=Le,e.Field=ce,e.Flags=O,e.Logger=ze,e.LoggerConfig=Re,e.LoggerFactory=Pe,e.NgxDinoEvent=j,e.Operand=function(e,t){return void 0===t&&(t=!0),function(n,r){if(delete n[r]){var o=function(){return e.get(this)};if(t){var i="__MEMOIZED_"+r+"__";o=function(){if(this.hasOwnProperty(i))return this[i];var t=e.get(this);return Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:t}),t}}Object.defineProperty(n,r,{get:o,enumerable:!0,configurable:!0})}}},e.Operator=P,e.RawChangeSet=ve,e.TypescriptLogger=Te,e.TypescriptLoggerFactory=De,e.access=function(e,t){return M(z,e,t)},e.autoId=function(e,t){return M(V,e,t)},e.chain=Y,e.combine=function(e){return M(oe,e)},e.constant=function(e){return M(H,e)},e.extractId=fe,e.idSymbol=de,e.identity=function(){return M(N)},e.isDatum=function(e){return e&&le(e[de])},e.isDatumId=le,e.lookup=function(e,t){return M(W,e,t)},e.map=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i.isFunction(e[0])?M.apply(void 0,g([ie,ae],e)):M.apply(void 0,g([ie],e))},e.multiField=pe,e.prePostMultiField=function(e){var t=e.pre,n=e.post,r=e.mapping,i=o.Seq.Keyed(r).map((function(e){return Y(t,e,n)})).toSeq();return pe(p(p({},e),{mapping:i}))},e.rawDataSymbol=he,e.simpleField=function(e){var t,n,r=e.bfieldId,i=e.operator,a=r?((t={})[r]=i,t):{},s=o.Seq.Keyed((n={},n[ce.defaultSymbol]=i,n)).concat(a).toSeq(),u=p(p({},e),{mapping:s});return new ce(u)},e.ɵ0=ke,e.ɵa=E,e.ɵb=L,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-dino-core.umd.min.js.map