@rentman/rm-core 1.0.28 → 1.0.30
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.
- package/changelog.md +10 -0
- package/dist/definitions/src/classes/ApiFormatter.d.ts +2 -2
- package/dist/definitions/src/classes/ApiRequestService.d.ts +4 -4
- package/dist/definitions/src/classes/ApiResponseProcessor.d.ts +2 -2
- package/dist/definitions/src/classes/BatchStatus.d.ts +4 -5
- package/dist/definitions/src/classes/ChangesCompiler.d.ts +3 -4
- package/dist/definitions/src/classes/ChangesProcessor.d.ts +9 -14
- package/dist/definitions/src/classes/CollectionCache.d.ts +3 -4
- package/dist/definitions/src/classes/CollectionEntryService.d.ts +4 -4
- package/dist/definitions/src/classes/CollectionHandler.d.ts +14 -21
- package/dist/definitions/src/classes/CollectionResourceService.d.ts +2 -2
- package/dist/definitions/src/classes/ColumnCache.d.ts +2 -2
- package/dist/definitions/src/classes/ColumnExpansion.d.ts +4 -4
- package/dist/definitions/src/classes/ColumnHandler.d.ts +4 -6
- package/dist/definitions/src/classes/ColumnSet.d.ts +3 -3
- package/dist/definitions/src/classes/ColumnUtil.d.ts +2 -2
- package/dist/definitions/src/classes/CreateRequest.d.ts +5 -5
- package/dist/definitions/src/classes/ItemAdministrator.d.ts +15 -22
- package/dist/definitions/src/classes/ItemCache.d.ts +4 -4
- package/dist/definitions/src/classes/ItemEntryService.d.ts +5 -5
- package/dist/definitions/src/classes/ItemHandler.d.ts +12 -19
- package/dist/definitions/src/classes/ItemRequestService.d.ts +10 -14
- package/dist/definitions/src/classes/ItemResourceService.d.ts +2 -2
- package/dist/definitions/src/classes/KeyService.d.ts +1 -1
- package/dist/definitions/src/classes/LocalCache.d.ts +12 -21
- package/dist/definitions/src/classes/LockService.d.ts +4 -6
- package/dist/definitions/src/classes/ModuleChangesCompiler.d.ts +5 -5
- package/dist/definitions/src/classes/QueryMatcher.d.ts +2 -2
- package/dist/definitions/src/classes/QueryParser.d.ts +1 -1
- package/dist/definitions/src/classes/QueryService.d.ts +1 -1
- package/dist/definitions/src/classes/RequestColumnExpansion.d.ts +2 -2
- package/dist/definitions/src/classes/SocketMessageHandler.d.ts +7 -11
- package/dist/definitions/src/classes/index.d.ts +32 -0
- package/dist/definitions/src/factories/ApiResponseProcessorFactory.d.ts +2 -3
- package/dist/definitions/src/factories/BatchStatusFactory.d.ts +4 -4
- package/dist/definitions/src/factories/ChangesCompilerFactory.d.ts +3 -5
- package/dist/definitions/src/factories/ChangesProcessorFactory.d.ts +7 -15
- package/dist/definitions/src/factories/CollectionCacheFactory.d.ts +3 -3
- package/dist/definitions/src/factories/CollectionEntryFactory.d.ts +4 -9
- package/dist/definitions/src/factories/CollectionResourceFactory.d.ts +6 -10
- package/dist/definitions/src/factories/ColumnExpansionFactory.d.ts +3 -5
- package/dist/definitions/src/factories/ColumnSetFactory.d.ts +2 -4
- package/dist/definitions/src/factories/CreateRequestFactory.d.ts +3 -6
- package/dist/definitions/src/factories/ItemCacheFactory.d.ts +3 -4
- package/dist/definitions/src/factories/ItemEntryFactory.d.ts +2 -3
- package/dist/definitions/src/factories/ItemResourceFactory.d.ts +5 -14
- package/dist/definitions/src/factories/LocalCacheFactory.d.ts +8 -16
- package/dist/definitions/src/factories/ModuleChangesCompilerFactory.d.ts +3 -6
- package/dist/definitions/src/factories/QueryMatcherFactory.d.ts +2 -3
- package/dist/definitions/src/factories/QueryParserFactory.d.ts +2 -2
- package/dist/definitions/src/factories/RequestColumnExpansionFactory.d.ts +2 -3
- package/dist/definitions/src/factories/index.d.ts +18 -0
- package/dist/definitions/src/index.d.ts +7 -81
- package/dist/definitions/src/interfaces/ApiRequestServiceInterface.d.ts +1 -1
- package/dist/definitions/src/interfaces/AuthInterface.d.ts +1 -1
- package/dist/definitions/src/interfaces/ErrorHandlerInterface.d.ts +1 -1
- package/dist/definitions/src/interfaces/LocalCacheManagerInterface.d.ts +2 -3
- package/dist/definitions/src/interfaces/PromiseInterface.d.ts +1 -1
- package/dist/definitions/src/interfaces/SocketMessageInterface.d.ts +1 -1
- package/dist/definitions/src/interfaces/index.d.ts +6 -0
- package/dist/definitions/src/main.d.ts +44 -0
- package/dist/definitions/src/models/CollectionEditResource.d.ts +6 -9
- package/dist/definitions/src/models/CollectionEntry.d.ts +6 -11
- package/dist/definitions/src/models/CollectionResource.d.ts +5 -5
- package/dist/definitions/src/models/CollectionViewResource.d.ts +6 -9
- package/dist/definitions/src/models/EditResource.d.ts +4 -9
- package/dist/definitions/src/models/ItemEntry.d.ts +2 -2
- package/dist/definitions/src/models/ItemResource.d.ts +3 -3
- package/dist/definitions/src/models/ViewResource.d.ts +3 -3
- package/dist/definitions/src/models/index.d.ts +8 -0
- package/dist/definitions/src/types/ItemTypesCollection.d.ts +1 -4
- package/dist/rm-core.js +5303 -5181
- package/dist/rm-core.min.js +1 -1
- package/package.json +3 -5
package/dist/rm-core.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("moment")):"function"==typeof define&&define.amd?define(["moment"],t):"object"==typeof exports?exports.RmCore=t(require("moment")):e.RmCore=t(e.moment)}(window,function(e){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var i=r(0);function n(e,t){if(void 0===e)return t;var r={};for(var i in t)r[i]=void 0===e[i]?t[i]:e[i];return r}function o(e){for(var t in e)return!0;return!1}function s(e){if("object"!=typeof e)return null;for(var t in e)return t;return null}function c(e,t){for(var r=0,i=t;r<i.length;r++){if(e==i[r])return!0}return!1}function a(e,t){if(void 0===e)return!1;for(var r=0,i=t;r<i.length;r++){var n=i[r];if(void 0===e[n])return!1;e=e[n]}return!0}function u(e,t,r){for(var i=0;i<t.length;i++){var n=t[i];void 0===e[n]&&(e[n]=r[i]),e=e[n]}return e}function l(e,t,r){if(void 0===r&&(r=!1),void 0!==e){for(var i=0,n=t;i<n.length;i++){if(void 0===(e=e[n[i]])&&!r)return}return e}}function h(e,t,r){for(var i=0,n=t.length;i<n;++i){var o=t[i];if(m(o)||v(o))for(var s=Object.keys(o),c=0,a=s.length;c<a;c++){var u=s[c],l=o[u];r&&m(l)?d(l)?e[u]=new Date(l.valueOf()):y(l)?e[u]=new RegExp(l):l.nodeName?e[u]=l.cloneNode(!0):(p=l)&&(p.nodeName||p.prop&&p.attr&&p.find)?e[u]=l.clone():(m(e[u])||(e[u]=f(l)?[]:{}),h(e[u],[l],!0)):e[u]=l}}var p;return e}function p(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return h(e,t,!1)}function m(e){return null!==e&&"object"==typeof e}function d(e){return"[object Date]"===toString.call(e)}var f=Array.isArray;function v(e){return"function"==typeof e}function y(e){return"[object RegExp]"===toString.call(e)}function g(e){return e&&e.window===e}function S(e){return void 0!==e}function C(e,t){if(e===t)return!0;if(null===e||null===t)return!1;if(e!=e&&t!=t)return!0;var r,i,n,o,s,c=typeof e;if(c===typeof t&&"object"===c){if(!f(e)){if(d(e))return!!d(t)&&(o=e.getTime(),s=t.getTime(),o===s||o!=o&&s!=s);if(y(e))return!!y(t)&&e.toString()===t.toString();if(g(e)||g(t)||f(t)||d(t)||y(t))return!1;for(i in n=Object.create(null),e)if(!v(e[i])){if(!C(e[i],t[i]))return!1;n[i]=!0}for(i in t)if(!(i in n)&&S(t[i])&&!v(t[i]))return!1;return!0}if(!f(t))return!1;if(r=e.length,e.length===t.length){for(i=0;i<r;i++)if(!C(e[i],t[i]))return!1;return!0}}return!1}function I(e,t,r){var i=[],n=[];if(r=function(e){return"number"==typeof e&&e>0}(r)?r:NaN,t){if(e===t)throw new Error("Can't copy! Source and destination are identical.");if(f(t))t.length=0;else for(var o in t)delete t[o];return i.push(e),n.push(t),s(e,t,r)}return c(e,r);function s(e,t,r){if(--r<0)return"...";if(f(e))for(var i=0,n=e.length;i<n;i++)t.push(c(e[i],r));else if(null===(s=e)||"object"!=typeof s||Object.getPrototypeOf(s))if(e&&"function"==typeof e.hasOwnProperty)for(var o in e)e.hasOwnProperty(o)&&(t[o]=c(e[o],r));else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=c(e[o],r));else for(var o in e)t[o]=c(e[o],r);var s;return t}function c(e,t){if(void 0===t&&(t=5),!m(e))return e;var r=i.indexOf(e);if(-1!==r)return n[r];if(g(e))throw new Error("Can't copy! Making copies of Window instances is not supported.");var o=!1,a=function(e){switch(toString.call(e)){case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Float32Array]":case"[object Float64Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return new e.constructor(c(e.buffer),e.byteOffset,e.length);case"[object ArrayBuffer]":if(!e.slice){var t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}return e.slice(0);case"[object Boolean]":case"[object Number]":case"[object String]":case"[object Date]":return new e.constructor(e.valueOf());case"[object RegExp]":var r=new RegExp(e._source,e.toString().match(/[^/]*$/)[0]);return r.lastIndex=e.lastIndex,r;case"[object Blob]":return new e.constructor([e],{type:e.type})}if(v(e.cloneNode))return e.cloneNode(!0)}(e);return void 0===a&&(a=f(e)?[]:Object.create(Object.getPrototypeOf(e)),o=!0),i.push(e),n.push(a),o?s(e,a,t):a}}var E,R=function(){function e(){this.MOMENT_INVALID="Invalid date",this.SERVER_DATETIME_FORMAT="YYYY-MM-DD[T]HH:mm:ssZ",this.SERVER_TIME_FORMAT="HH:mm:ss",this.SERVER_DATE_FORMAT="YYYY-MM-DD"}return e.prototype.formatResponse=function(e,t){for(var r=0,i=t;r<i.length;r++){var n=i[r];e[n.path]=this.formatResponseValue(n.apiColumn.type,e[n.path])}},e.prototype.expandResponse=function(e,t,r){for(var i=0,n=r;i<n.length;i++){var o=n[i];e[o.path]=this.formatResponseValue(o.apiColumn.type,t[o.path])}},e.prototype.formatRequest=function(e,t,r){for(var i={},n=0,o=r;n<o.length;n++){var s=o[n],c=s.id,a=s.apiColumn;a.readOnly||(this.compareFields(a.type,e[c],t[c])||(i[c]=this.formatRequestValue(s.apiColumn.type,t[c])))}return i},e.prototype.hasChanges=function(e,t,r){for(var i=0,n=r;i<n.length;i++){var o=n[i],s=o.id,c=o.apiColumn;if(!c.readOnly&&!this.compareFields(c.type,e[s],t[s]))return!0}return!1},e.prototype.getChanges=function(e,t,r){for(var i=[],n=0,o=r;n<o.length;n++){var s=o[n],c=s.id,a=s.apiColumn;a.readOnly||(this.compareFields(a.type,e[c],t[c])||i.push({oldValue:e[c],newValue:t[c],column:s.apiColumn}))}return i},e.prototype.copyFields=function(e,t,r){for(var i=0,n=r;i<n.length;i++){var o=n[i],s=o.path;t[s]=this.clone(o.apiColumn.type,e[s])}return t},e.prototype.shallowCopyFields=function(e,t,r,i){for(var n=0,o=i;n<o.length;n++){var s=o[n],c=s.path;r[c]=void 0!==e[c]?e[c]:this.clone(s.apiColumn.type,t[c])}return r},e.prototype.setDefaultValues=function(e,t){for(var r=0,i=t;r<i.length;r++){var n=i[r];e[n.id]=this.getDefaultValue(n.apiColumn.type)}return e},e.prototype.compareFields=function(e,t,r){if(void 0===t)return void 0===r;if(void 0===r)return!1;switch(e){case"date":case"time":case"datetime":return this.compareMomentObjects(t,r);case"duration":return this.compareDurations(t,r);case"id":case"item":case"link":case"child":case"sibling":return t==r;case"current":case"dimension":case"distance":case"double":case"filesize":case"number":case"power":case"quantity":case"volume":case"weight":case"coordinate":case"price":case"percentage":return this.compareFloats(t,r);case"int":case"bool":case"enum":case"email":case"phone":case"url":case"text":case"longtext":case"color":return t===r;default:return C(t,r)}},e.prototype.compareFloats=function(e,t){var r=Math.abs(e),i=Math.abs(t),n=Math.abs(e-t);return e===t||(0===e||0===t||n<Number.MIN_VALUE?n<1.19e-7*Number.MIN_VALUE:n/Math.min(r+i,Number.MAX_VALUE)<1.19e-7)},e.prototype.compareMomentObjects=function(e,t){return e.isValid()?!!t.isValid()&&e.isSame(t):!t.isValid()},e.prototype.compareDurations=function(e,t){return e.asMilliseconds()===t.asMilliseconds()},e.prototype.formatResponseValue=function(e,t){switch(e){case"datetime":case"date":return this.formatResponseDate(t);case"color":return this.formatResponseColor(t);case"duration":return this.formatResponseDuration(t);case"json":return"string"==typeof t&&""!==t?JSON.parse(t):t;case"number":return 0===t?null:t;case"filesize":return t/1e6;default:return t}},e.prototype.formatRequestValue=function(e,t){switch(e){case"datetime":return this.formatRequestDateTime(t);case"date":return this.formatRequestDate(t);case"color":return this.formatRequestColor(t);case"duration":return this.formatRequestDuration(t);case"number":return 0===t?null:t;default:return t}},e.prototype.formatResponseDate=function(e){return null===e?i.invalid():i(e)},e.prototype.formatResponseDuration=function(e){return i.duration(null===e?0:e,"seconds")},e.prototype.formatResponseColor=function(e){return"#"===e.charAt(0)?e:"#"+e},e.prototype.formatRequestDateTime=function(e){return e.isValid()?e.format(this.SERVER_DATETIME_FORMAT):null},e.prototype.formatRequestDate=function(e){return e.isValid()?e.format(this.SERVER_DATE_FORMAT):null},e.prototype.formatRequestDuration=function(e){return e.asSeconds()},e.prototype.formatRequestColor=function(e){return"#"===e.charAt(0)?e.substring(1):e},e.prototype.getDefaultValue=function(e){switch(e){case"int":case"double":case"percentage":case"price":return 0;case"item":case"link":case"child":case"sibling":return null;case"bool":return!1;case"enum":return"0";case"date":case"datetime":case"time":return i.invalid();case"duration":return i.duration();case"text":case"longtext":return"";case"color":return"#000000";default:return""}},e.prototype.isDefaultValue=function(e,t){return this.compareFields(e,t,this.getDefaultValue(e))},e.prototype.clone=function(e,t){switch(e){case"duration":return this.cloneDuration(t);case"date":case"datetime":return i(t);case"json":return I(t);default:return t}},e.prototype.getCloneFunction=function(e){switch(e){case"duration":return this.cloneDuration;case"date":case"datetime":return this.cloneDate;default:return this.identity}},e.prototype.cloneDuration=function(e){return i.duration(e)},e.prototype.cloneDate=function(e){return e.clone()},e.prototype.identity=function(e){return e},e}(),q=function(){function e(e,t){this.externalApiRequestService=e,this.apiResponseProcessorFactory=t}return e.prototype.template=function(e,t){return this.processResponse(this.externalApiRequestService.template(e,t))},e.prototype.create=function(e,t,r,i,n){return this.processResponse(this.externalApiRequestService.create(e,t,r,i,n))},e.prototype.delete=function(e,t){return this.processResponse(this.externalApiRequestService.delete(e,t))},e.prototype.updateItems=function(e,t,r){return this.processResponse(this.externalApiRequestService.updateItems(e,t,r))},e.prototype.requestSkeleton=function(e,t){return this.processResponse(this.externalApiRequestService.requestSkeleton(e,t))},e.prototype.moveItems=function(e,t,r){return this.processResponse(this.externalApiRequestService.moveItems(e,t,r))},e.prototype.columns=function(e,t,r){return this.processResponse(this.externalApiRequestService.columns(e,t,r))},e.prototype.query=function(e,t,r,i,n){return this.processResponse(this.externalApiRequestService.query(e,t,r,i,n))},e.prototype.processResponse=function(e){var t=this;return e.then(function(e){return t.apiResponseProcessorFactory.construct(e)})},e}(),F=function(){function e(e,t){this.queryParserFactory=e,this.queryService=t}return e.prototype.processOptions=function(e){return n(e,{columns:[],query:null,queryItemType:null,queryParams:{},parent:null,deferRequest:!1,limit:null,entryKey:"",addLocalItems:!1})},e.prototype.createQuery=function(e){var t,r=e.parent;if(null===r)t=e.query;else{var i={linkedTo:r.itemType,query:{id:"&parentId"}};e.queryParams.parentId=r.itemId,t=null===e.query?i:this.queryService.addAndCondition(e.query,i)}var n=this.queryParserFactory.construct(t,e.queryParams).parse();return{object:n[0],string:n[1]}},e.prototype.getIdArray=function(e,t){void 0===t&&(t=[]);for(var r=0,i=e;r<i.length;r++){var n=i[r];t.push(n.itemId)}return t},e.prototype.filterArray=function(e,t){for(var r=[],i=[],n=0,o=e;n<o.length;n++){var s=o[n];t(s)?r.push(s):i.push(s)}if(0===i.length)return i;e.length=r.length;for(var c=0;c<e.length;c++)e[c]=r[c];return i},e}();!function(e){e.CACHED="cached",e.PROMISED="promised",e.EXPAND="expand",e.PROMISED_EXPAND="promised-expand",e.RESOLVE="resolve",e.LOCAL="local"}(E||(E={}));var b,O=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m){this.errorHandler=e,this.itemRequestService=t,this.itemHandler=r,this.columnHandler=i,this.collectionEntryFactory=n,this.collectionCacheFactory=o,this.queryParserFactory=s,this.collectionEntryService=c,this.columnSetFactory=a,this.itemEntryService=u,this.keyService=l,this.promiseService=h,this.queryService=p,this.columnUtil=m,this.entries=this.collectionCacheFactory.construct()}return e.prototype.getPromises=function(e){var t=e[E.PROMISED],r=e[E.PROMISED_EXPAND],i=[];for(var n in t)i.push(t[n]);for(var n in r)i.push(r[n]);return i},e.prototype.getRequestIds=function(e){var t=[];for(var r in e[E.RESOLVE])t.push(r);for(var r in e[E.EXPAND])t.push(r);return t},e.prototype.removeFromAndAddToCollections=function(e,t){for(var r in e){var i=e[r],n=i.collection;n.removeItems(i.notfitting,null,!0),n.addItems(i.fitting,null,!0),i.maybe.length>0&&n.extend(_e,null,!0,t)}},e.prototype.removeFromCollections=function(e,t,r){var i;for(var n in void 0===r&&(r=null),e){for(var o=e[n],s=o.fitting,c=o.maybe,a=o.collection,u=[],l=0,h=s;l<h.length;l++){var p=h[l];u.push(p.itemId)}for(var m=0,d=c;m<d.length;m++){var f=d[m];u.push(f)}null!==r&&a===r.entry?i=a.removeItems(u,r,t):a.removeItems(u,null,t)}return i},e.prototype.addItemsToCollections=function(e){return this.addToCollections(this.createCollectionMap(e),!1)},e.prototype.addToCollections=function(e,t,r){var i;for(var n in void 0===r&&(r=null),e){var o=e[n],s=o.collection;s.isDeferred()||(null!==r&&s===r.entry?i=s.addItems(o.fitting,r,t):s.addItems(o.fitting,null,t),t&&o.maybe.length>0&&s.extend(_e,null,!0,t))}return i},e.prototype.batchExpand=function(e,t,r,i){var n=this;if(0===i.length)return this.promiseService.when(r);var o=[],s=[];for(var c in r)o.push(c),s=s.concat(r[c].entry.items);return this.itemRequestService.requestLinkItems(e,o,t,null,i).then(function(e){for(var c=n.itemRequestService.processExpansion(i,e,t,s),a=0,u=o;a<u.length;a++){var l=u[a];r[l].entry.updateColumns(c)}return r})},e.prototype.batchExtend=function(e,t,r,i,n,s){var c=this;if(void 0===s&&(s=!1),!o(n))return this.promiseService.when({});var a=[],u=[];for(var l in r.queryParams=i(r.queryParams),n){var h=n[l].entry;h.extendQuery(i),a.push(l),u=u.concat(h.getIdArray())}return this.itemRequestService.requestLinkItems(e,a,t,this.queryService.addAndCondition(this.collectionEntryService.createQuery(r).object,this.queryService.createNotIn(u)),r.columns).then(function(i){return c.itemRequestService.processLinkResponse(i,e,a,t,r)},this.errorHandler.reject).then(function(e){for(var t={},r=0,i=a;r<i.length;r++){var o=i[r],c=n[o],u=c.entry.addItems(e.items[o],c);t[o]=s?c.items:u}return t},this.errorHandler.reject)},e.prototype.batchFetch=function(e,t,r,i,n){var s=this,c=this.createStatusResource(e,t,r,i,n);return this.promiseService.all(this.getPromises(c)).then(function(){var t=s.getRequestIds(c);return t.length>0?s.itemRequestService.requestLinkItems(e,t,r,null===i.query?null:s.queryParserFactory.construct(i.query,i.queryParams).parse()[0],i.columns).then(function(n){return s.itemRequestService.processLinkResponse(n,e,t,r,i)},s.errorHandler.reject).then(function(e){return s.handleBatchResponse(c,e)},s.errorHandler.reject):o(c[E.LOCAL])?s.columnHandler.fetch(r,i.columns).then(function(e){return s.handleBatchResponse(c,{columns:s.columnSetFactory.construct(r,i.columns,e,!1)})},s.errorHandler.reject):c[E.CACHED]},this.errorHandler.reject)},e.prototype.clone=function(e,t,r){void 0===r&&(r={});var i=e.itemType,n=e.items,o=[];void 0===r[i]&&(r[i]={});for(var s=r[i],c=0,a=n;c<a.length;c++){s[a[c].itemId]=this.keyService.getLocalId()}for(var u=0,l=n;u<l.length;u++){var h=l[u],p=this.itemHandler.cloneItem(s[h.itemId],h,r);null!==t.parent&&(p.parent=t.parent),o.push(p)}return this.create(i,t,e.columns,o)},e.prototype.create=function(e,t,r,i){return this.entries.add(this.collectionEntryFactory.construct(e,t)).resolve({columns:r,items:i})},e.prototype.createCollectionMap=function(e){for(var t={},r=0,i=e;r<i.length;r++){var n=i[r];this.expandCollectionMap(n,t)}return t},e.prototype.createStatusResource=function(e,t,r,i,n){var o={};for(var s in E)o[E[s]]={};for(var c=0,a=t;c<a.length;c++){var u,l=a[c],h=this.collectionEntryService.processOptions(i);h.parent={itemType:e,itemId:l},o[(u=this.getEntryStatus(r,h,n)).status][l]=u.entry}return o},e.prototype.expandCollectionMap=function(e,t,r){void 0===r&&(r=this.entries);var i=null!==e.parent?e.parent:{},n=r.getByFittingItem(i.itemType,i.itemId,e.itemType,this.itemEntryService.getFields(e));for(var o in n)for(var s=0,c=n[o];s<c.length;s++){var a=c[s],u=a.id;void 0===t[u]&&(t[u]={collection:a,fitting:[],notfitting:[],maybe:[]}),t[u][o].push("fitting"===o?e:e.itemId)}},e.prototype.fetch=function(e,t,r,i){var n=this.getEntryStatus(e,t,i),o=n.entry;switch(n.status){case E.CACHED:return this.promiseService.when(o);case E.PROMISED:return o.promise;case E.EXPAND:return o.expand(t.columns);case E.PROMISED_EXPAND:return o.promise.then(function(){return o.expand(t.columns)},this.errorHandler.reject);case E.RESOLVE:return this.resolveRemote(o,r);case E.LOCAL:return this.resolveLocal(o,r)}},e.prototype.getDeferredEntryStatus=function(e,t){var r=e.options,i=r.columns,n=!1;return e.reloadQueued?(e.reloadQueued=!1,r.columns=this.columnUtil.mergeRequestColumns(t.columns,i).merged,{entry:e,status:e.isLocal()?E.LOCAL:E.RESOLVE}):(!0===i?(console.warn("Columns: true for collections is deprecated!"),n=!0):n=this.columnUtil.isColumnSubset(t.columns,i,!1),{entry:e,status:n?E.PROMISED:E.PROMISED_EXPAND})},e.prototype.getEntryStatus=function(e,t,r){var i=this.collectionEntryService.createQuery(t),n=this.entries.getByQuery(e,i);return null===n?this.getNewEntryStatus(e,i,t,r):n.isDeferred()?this.getDeferredEntryStatus(n,t):{entry:n,status:this.columnUtil.isColumnSubset(t.columns,n.columns.request,n.columns.true)?E.CACHED:E.EXPAND}},e.prototype.getNewEntryStatus=function(e,t,r,i){var n,o;if(r.deferRequest){if(null===(n=i.getByQuery(e,t)))return{entry:i.add(this.collectionEntryFactory.construct(e,r)),status:E.PROMISED};(o=n.options).columns=this.columnUtil.mergeRequestColumns(o.columns,r.columns).merged}else n=this.collectionEntryFactory.construct(e,r);return this.entries.add(n),{entry:n,status:n.isLocal()?E.LOCAL:E.RESOLVE}},e.prototype.handleBatchResponse=function(e,t){var r={};for(var i in e.cached)r[i]=e.cached[i];for(var i in e.resolve)r[i]=e.resolve[i].resolve({items:t.items[i],columns:t.columns});for(var i in e.expand){(n=e.expand[i]).updateColumns(t.columnExpansion),r[i]=n}for(var i in e.local){var n=e.local[i];r[i]=n.resolve({items:this.itemHandler.entries.getByParent(n.parent.itemType,i,n.itemType),columns:t.columns})}return r},e.prototype.removeItemsFromAndAddItemsToCollections=function(e){return this.removeFromAndAddToCollections(this.createCollectionMap(e),!1)},e.prototype.removeItemsFromCollections=function(e){return this.removeFromCollections(this.createCollectionMap(e),!1)},e.prototype.resolveLocal=function(e,t){var r=this,i=e.itemType,n=e.options.columns;return this.columnHandler.fetch(i,n).then(function(o){return e.resolve({items:t.getByQuery(i,e.query),columns:r.columnSetFactory.construct(i,n,o,!1)})},this.errorHandler.reject)},e.prototype.resolveRemote=function(e,t){var r,i=this,n=e.itemType,o=e.options;return this.itemRequestService.requestItems(e).then(function(t){return r=i.columnSetFactory.construct(n,o.columns,t.fetchColumnsObject()),i.itemRequestService.processResponse(t,t.links[n],e.parent,r)},this.errorHandler.reject).then(function(i){return e.resolve({items:i.concat(o.addLocalItems?t.getLocalByQuery(n,e.query):[]),columns:r})},this.errorHandler.reject)},e}(),H=function(){function e(){}return e.prototype.processOptions=function(e){return n(e,{editItems:!1,editCollection:!1,modInstant:!1,enableSave:!0,onItemsCreated:Ue,onChange:Ue,onAdd:Ue,onRemove:Ue,onAddInitial:Ue,onRemoveInitial:Ue,onDeactiveateItem:Ue,onDeactivateCollection:Ue,resourceKey:null,clearOnTabChange:!0,clearOnSubTabChange:!0,custom:null})},e.prototype.getIdArray=function(e){for(var t=[],r=0,i=e;r<i.length;r++){var n=i[r];t.push(n.entry.itemId)}return t},e}(),T=function(){function e(e){this.columnUtil=e,this.cache={},this.allColumns={}}return e.prototype.setColumn=function(e,t){void 0===this.cache[e]&&(this.cache[e]={});var r=this.cache[e],i=t.id;return void 0===r[i]&&(r[i]=t),r[i]},e.prototype.setColumns=function(e,t,r){var i={};for(var n in r){var o=r[n];for(var s in i[n]={},o)i[n][s]=this.setColumn(n,o[s])}return!0===t&&(this.allColumns[e]=!0),i},e.prototype.retrieve=function(e,t){if(!0===t)return this.containsAll(e)?{cached:this.getColumns(e),missing:[]}:{cached:{},missing:!0};var r={},i=[];return this.retrieveColumns(e,t,i,r),{missing:i,cached:r}},e.prototype.containsAll=function(e){return!0===this.allColumns[e]},e.prototype.getColumns=function(e){var t=void 0===this.cache[e]?[]:this.cache[e],r={};return r[e]=t,r},e.prototype.retrieveColumns=function(e,t,r,i){this.retrieveColumn(e,"id",r,i);for(var n=0,o=t;n<o.length;n++){var s=o[n];this.retrieveColumn(e,s,r,i)}},e.prototype.retrieveColumn=function(e,t,r,i){var n=this.columnUtil.parseRequestColumn(t),o=this.getColumn(e,n.id);if(void 0!==o){if(void 0===i[e]&&(i[e]={}),i[e][n.id]=o,0!==n.children.length){var s=[];if(this.retrieveColumns(o.itemType,n.children,s,i),0!==s.length){var c={};c[n.id]=s,r.push(c)}}}else r.push(t)},e.prototype.getColumn=function(e,t){if(void 0!==this.cache[e])return this.cache[e][t]},e}(),k=function(){function e(e,t,r,i,n){this.apiRequestService=e,this.errorHandler=t,this.promiseService=r,this.cache=i,this.columnUtil=n}return e.prototype.setColumn=function(e,t){return this.cache.setColumn(e,t)},e.prototype.setColumns=function(e,t,r){return this.cache.setColumns(e,t,r)},e.prototype.fetchItemTypeTranslations=function(e){for(var t=[],r={},i=0,n=e;i<n.length;i++){var o=n[i],s=t.push(this.fetch(o,["id"]));r[o]=s-1}return this.promiseService.all(t).then(function(e){for(var t={},i=0;i<e.length;i++){var n=r[i];t[n]=e[n][n].id.name}return t},this.errorHandler.reject)},e.prototype.request=function(e,t,r){var i=this;void 0===r&&(r={});var n,o=((n={})[e]=t,n);return this.apiRequestService.columns(e,o,r).then(function(r){return i.cache.setColumns(e,t,r.fetchColumnsObject())},this.errorHandler.reject)},e.prototype.fetch=function(e,t,r){var i=this;void 0===r&&(r={});var n=this.cache.retrieve(e,t);return!0!==n.missing&&0===n.missing.length?this.promiseService.when(n.cached):this.request(e,n.missing,r).then(function(e){return i.columnUtil.mergeResponseColumns(e,n.cached).merged})},e.prototype.fetchAll=function(e){return this.cache.containsAll(e)?this.promiseService.when(this.cache.getColumns(e)):this.request(e,!0)},e}(),M=function(){function e(){}return e.prototype.getColumnPath=function(e,t){for(var r="",i="",n=0,o=e;n<o.length;n++){i+=r+o[n].id,r=">"}return null!==t&&(i+=":"+t),i},e.prototype.getDateFormatOptions=function(e){var t=i(),r={"J-M-Y":t.format("DD-MM-YYYY"),"J-M":t.format("DD-MM"),"j+F+Y":t.format("D MMM YYYY"),"D+j+F+Y":t.format("dddd D MMM YYYY"),F:t.format("MMM"),f:t.format("MMMM"),D:t.format("dddd"),d:t.format("ddd")};return"datetime"===e&&p(r,{"J-M-Y+H:i":t.format("DD-MM-YYYY HH:mm"),"J-M+H:i":t.format("DD-MM HH:mm"),"j+F+Y+H:i":t.format("DD MMMM Y HH:mm"),"D+j+F+Y+H:i":t.format("dddd DD MMM Y HH:mm"),"H:i":t.format("HH:mm")}),r},e.prototype.isStringColumn=function(e){switch(e.type){case"email":case"phone":case"url":case"text":case"longtext":case"textreplace":return!0;default:return!1}},e.prototype.isFloatColumn=function(e){switch(e.type){case"double":case"volume":case"weight":case"distance":case"dimension":case"power":case"current":case"price":case"percentage":return!0;default:return!1}},e.prototype.isIntColumn=function(e){switch(e.type){case"int":case"number":case"quantity":return!0;default:return!1}},e.prototype.isNumberColumn=function(e){return this.isFloatColumn(e)||this.isIntColumn(e)},e.prototype.isCustomColumn=function(e){return"customfield"===e.fieldtype},e.prototype.isItemColumn=function(e,t){switch(void 0===t&&(t=!0),e.type){case"id":return t;case"item":case"child":case"sibling":case"link":return!0;default:return!1}},e.prototype.isDateColumn=function(e){switch(e.type){case"datetime":case"date":return!0;default:return!1}},e.prototype.isRenderedColumn=function(e){switch(e.type){case"datetime":case"date":case"duration":return!0;default:return!1}},e.prototype.isFilteredColumn=function(e){if("staffel"===e.id)return!0;if(void 0!==e.generator)return!0;switch(e.type){case"price":case"bool":case"enum":case"volume":case"weight":case"distance":case"dimension":case"quantity":case"email":case"url":case"datetime":case"date":case"time":case"duration":case"html":case"textreplace":case"longtext":case"percentage":return!0;default:return!1}},e.prototype.isFormattedColumn=function(e){switch(e.type){case"datetime":case"date":case"time":case"duration":case"color":case"json":case"number":case"filesize":return!0;default:return!1}},e.prototype.isSelectableColumn=function(e){switch(e.type){case"blob":case"coordinate":case"forceupdate":case"id":case"json":case"order":case"parentid":case"parenttype":case"password":case"token":return!1}return!0},e.prototype.hasLocationProperty=function(e,t){return 0!=(t&e.location)},e.prototype.isEditableColumn=function(e){if(e.readOnly)return!1;switch(e.type){case"date":case"datetime":case"duration":return!1}return!0},e.prototype.isSearchableColumn=function(e){switch(e.type){case"email":case"phone":case"text":case"longtext":case"html":return!0;default:return!1}},e.prototype.getDefaultWeight=function(e){switch(e.type){case"double":case"price":case"bool":case"int":case"percentage":case"color":case"number":case"power":case"current":return.5;case"url":case"enum":case"email":case"text":case"item":case"link":return 1.5;case"longtext":case"html":case"textreplace":return 2;case"date":case"datetime":case"time":case"duration":default:return 1}},e.prototype.getComparators=function(e){switch(e.type){case"dimension":case"weight":case"price":return["=",">","<"];case"date":case"datetime":case"time":case"duration":return[">","<"];default:return["=","!="]}},e.prototype.isColumnSubset=function(e,t,r){if(!0===e)return r;for(var i=0,n=e;i<n.length;i++){var o=n[i];if(!this.containsColumn(o,t))return!1}return!0},e.prototype.containsColumn=function(e,t){var r=this.parseRequestColumn(e),i=this.findColumn(r.id,t);if(-1===i)return!1;if(0===r.children.length)return!0;if("string"==typeof t[i])return!1;for(var n=0,o=r.children;n<o.length;n++){var s=o[n];if(!this.containsColumn(s,t[i][r.id]))return!1}return!0},e.prototype.responseColumnsAvailable=function(e,t,r){for(var i=0,n=t;i<n.length;i++){var o,s=n[i],c=this.parseRequestColumn(s),a=c.children,u=r[e];if(void 0===u)return!1;if(void 0===(o=u[c.id]))return!1;if(a.length>0&&!this.responseColumnsAvailable(o.itemType,a,r))return!1}return!0},e.prototype.mergeRequestColumns=function(e,t){if(!0===e)return{merged:!0,difference:[]};if(!0===t)return{merged:!0,difference:!0};for(var r=I(e),i=[],n=0,o=t;n<o.length;n++){var s=o[n],c=this.mergeRequestColumn(s,r);null!==c&&i.push(c)}return{merged:r,difference:i}},e.prototype.mergeRequestColumn=function(e,t){var r=this.parseRequestColumn(e),i=this.findColumn(r.id,t);if(-1===i)return t.push(e),e;if(0===r.children.length)return null;"string"==typeof t[i]&&(t[i]=((n={})[r.id]=[],n));for(var n,o,s=[],c=0,a=r.children;c<a.length;c++){var u=a[c],l=this.mergeRequestColumn(u,t[i][r.id]);null!==l&&s.push(l)}return 0===s.length?null:((o={})[r.id]=s,o)},e.prototype.parseRequestColumn=function(e){var t="string"==typeof e,r=t?e:s(e);return{id:r,children:t?[]:e[r]}},e.prototype.mergeResponseColumns=function(e,t){var r={},i={};for(var n in e)if(void 0!==t[n]){var o=this.mergeResponseColumnMap(e[n],t[n]);r[n]=o.merged,i[n]=o.difference}else r[n]=e[n];for(var n in t)void 0===e[n]&&(r[n]=t[n],i[n]=t[n]);return{merged:r,difference:i}},e.prototype.mergeResponseColumnMap=function(e,t){var r={},i={};for(var n in e)r[n]=e[n];for(var n in t)S(e[n])||(r[n]=t[n],i[n]=t[n]);return{merged:r,difference:i}},e.prototype.isLocalColumnId=function(e){return"__"===e.substring(0,2)},e.prototype.processConfigColumns=function(e){for(var t=[],r=0,i=e;r<i.length;r++){var n=i[r];this.isLocalColumnId(n)||this.processConfigColumn(this.parseConfigColumn(n),t)}return t},e.prototype.processLocalConfigColumns=function(e,t,r,i){for(var n={},o=0,s=t;o<s.length;o++){var c=s[o];n[c.id]=c}for(var a=0,u=e;a<u.length;a++){var l=u[a],h=l.split(":"),p=h[0];this.isLocalColumnId(p)?void 0!==n[p]&&(i(l,n[p]),delete n[p]):r(l,p,h[1])}},e.prototype.consolidateColumns=function(e,t,r){var i=this,n=[],o=I(r);return this.processLocalConfigColumns(e,t,function(e,t){i.processConfigColumn(t.split(">"),o)},function(e,t){n.push(t),o=i.mergeRequestColumns(o,t.valueOptions.requestColumns).merged}),{request:o,local:n}},e.prototype.parseConfigColumn=function(e){return e.split(":")[0].split(">")},e.prototype.processConfigColumn=function(e,t){var r=e[0];if(1===e.length)-1===t.indexOf(r)&&t.push(r);else{var i,n=this.findColumnObject(r,t);-1===n&&(n=t.push(((i={})[r]=[],i))-1),this.processConfigColumn(e.slice(1),t[n][r])}},e.prototype.findColumnObject=function(e,t){for(var r=0;r<t.length;r++)if(s(t[r])===e)return r;return-1},e.prototype.findColumn=function(e,t){for(var r=0;r<t.length;r++){var i=t[r];if("string"!=typeof i){if(s(i)===e)return r}else if(i===e)return r}return-1},e}(),j=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m,d){this.apiRequestService=e,this.localCacheManager=t,this.authInterface=r,this.errorHandler=i,this.itemHandler=n,this.collectionHandler=o,this.columnSetFactory=s,this.itemRequestService=c,this.localCacheFactory=a,this.moduleChangesCompilerFactory=u,this.collectionEntryService=l,this.collectionResourceService=h,this.itemEntryService=p,this.keyService=m,this.queryService=d}return e.prototype.getItemDefinition=function(e,t,r){var i=this.keyService.parseStateKey(t),n={itemType:e,options:r,itemId:t};if(null!==i){switch(i.type){case"new":n.itemId=this.keyService.getLocalId();break;case"duplicate":r.duplicate=i.itemId,void 0===r.templateOptions&&(r.templateOptions={}),void 0===r.templateOptions.item&&(r.templateOptions.item=i.itemId),n.itemId=this.keyService.getLocalDuplicateId()}return n}return n.itemId=t,n},e.prototype.createCollectionMap=function(e,t){for(var r=this.getLocalCache(),i=r.collections,n={},o=0,s=e;o<s.length;o++){var c=s[o];t&&r.addSingleItem(c,{},!1),this.collectionHandler.expandCollectionMap(c,n,i)}return n},e.prototype.getItemById=function(e,t,r){var i=this;return this.itemHandler.fetchItem(e,t,this.itemEntryService.processOptions(r)).then(function(e){if(void 0!==e.itemType)return i.addSingleItem(e,r,!1)},this.errorHandler.reject)},e.prototype.getItemsById=function(e,t,r){var i=this;return this.itemHandler.fetchItems(e,t,this.itemEntryService.processOptions(r)).then(function(e){return i.addSingleItems(e,r)},this.errorHandler.reject)},e.prototype.getItemsByQuery=function(e,t,r){var i=this,n=this.itemEntryService.processOptions(r),o={};return o[e]=n.columns,this.apiRequestService.query(e,this.queryService.addParentCondition(t,n.parent),o).then(function(t){return i.itemRequestService.processResponse(t,t.links[e],n.parent,i.columnSetFactory.construct(e,n.columns,t.fetchColumnsObject()))},this.errorHandler.reject).then(function(e){return i.addSingleItems(e,r)},this.errorHandler.reject)},e.prototype.getDuplicateById=function(e,t,r){void 0===r&&(r={}),r.edit=!0;var i=this.getItemDefinition(e,this.keyService.getDuplicateStateKey(t),r);return this.getItemByDef(i,!1)},e.prototype.getNewResource=function(e,t,r,i){var n=this;return void 0===t&&(t={}),t.edit=!0,void 0===i&&(i=!1),this.itemHandler.fetchItem(e,this.keyService.getLocalId(),this.itemEntryService.processOptions(t)).then(function(e){var o=n.addSingleItem(e.main,t,i),s=n.processLinkedItems(e.linked,t,!0);return r?{main:o,linked:s}:o},this.errorHandler.reject)},e.prototype.getCollectionDef=function(e,t){return{itemType:e,options:{entry:this.collectionEntryService.processOptions(t),resource:this.collectionResourceService.processOptions(t)}}},e.prototype.getLinkCollectionsDef=function(e,t,r,i,n){return{itemType:r,linkType:e,linkIdArray:t,linkField:i,options:{entry:this.collectionEntryService.processOptions(n),resource:this.collectionResourceService.processOptions(n)}}},e.prototype.getCollection=function(e,t){var r=this,i=this.getLocalCache();return this.collectionHandler.fetch(e,this.collectionEntryService.processOptions(t),i.items,i.deferredCollections).then(function(e){return r.addCollection(e,t)},this.errorHandler.reject)},e.prototype.getCollectionFromDef=function(e){var t=this,r=this.getLocalCache();return this.collectionHandler.fetch(e.itemType,e.options.entry,r.items,r.deferredCollections).then(function(r){return t.addCollection(r,e.options.resource,!1)},this.errorHandler.reject)},e.prototype.getLinkCollection=function(e,t,r,i){var n=this,o=this.getLocalCache(),s=this.collectionEntryService.processOptions(i);return s.parent={itemType:e,itemId:t},this.collectionHandler.fetch(r,s,o.items,o.deferredCollections).then(function(e){return n.addCollection(e,i)},this.errorHandler.reject)},e.prototype.getLinkCollections=function(e,t,r,i){var n=this;return this.collectionHandler.batchFetch(e,t,r,this.collectionEntryService.processOptions(i),this.getLocalCache().deferredCollections).then(function(e){return n.addCollections(e,n.collectionResourceService.processOptions(i))},this.errorHandler.reject)},e.prototype.getLinkCollectionsFromDef=function(e){var t=this;return this.collectionHandler.batchFetch(e.linkType,e.linkIdArray,e.itemType,e.options.entry,this.getLocalCache().deferredCollections).then(function(r){return t.addCollections(r,e.options.resource)},this.errorHandler.reject)},e.prototype.getAllLinkCollections=function(e,t,r){var i=this;return this.apiRequestService.query(e,{},{}).then(function(n){return i.getLinkCollections(e,n.links[e],t,r)},this.errorHandler.reject)},e.prototype.getItemByDef=function(e,t){var r=this;return this.itemHandler.fetchItem(e.itemType,e.itemId,this.itemEntryService.processOptions(e.options)).then(function(i){var n;return void 0!==i.linked?(r.processLinkedItems(i.linked,e.options,!1),n=i.main):n=i,r.addSingleItem(n,e.options,t)},this.errorHandler.reject)},e.prototype.cloneItem=function(e,t,r){return this.addSingleItem(this.itemHandler.cloneItem(e,t.entry),r)},e.prototype.cloneCollection=function(e,t,r){return this.addCollection(this.collectionHandler.clone(e.entry,this.collectionEntryService.processOptions(t),r),t)},e.prototype.saveCurrentLocalCache=function(e,t,r,i,n){return void 0===r&&(r=!1),void 0===n&&(n=!1),this.getLocalCache().save(e,t,r,i)},e.prototype.getCurrentCollections=function(){return this.getLocalCache().collections},e.prototype.getCurrentItems=function(){return this.getLocalCache().items},e.prototype.getCurrentChanges=function(){var e=this.getLocalCache();if(void 0===e.rootItem)throw new Error("itemAdministrator: No root item!");return this.moduleChangesCompilerFactory.construct(e.rootItem,e.items,e.collections).process()},e.prototype.addSingleItem=function(e,t,r){return this.getLocalCache().addSingleItem(e,t,r)},e.prototype.addSingleItems=function(e,t){for(var r=this.getLocalCache(),i=[],n=0,o=e;n<o.length;n++){var s=o[n];i.push(r.addSingleItem(s,t,!1))}return i},e.prototype.addCollection=function(e,t,r){return void 0===r&&(r=!0),this.getLocalCache().addCollection(e,r?this.collectionResourceService.processOptions(t):t)},e.prototype.addCollections=function(e,t){var r=this.getLocalCache(),i={};for(var n in e)i[n]=r.addCollection(e[n],t);return i},e.prototype.processLinkedItems=function(e,t,r){for(var i=this.getLocalCache(),n=i.collections,o={},s=0,c=e;s<c.length;s++){var a=c[s],l=a.itemType,h=a.itemEntries,p={};o[l]=[];for(var m=0,d=h;m<d.length;m++){var f=d[m];o[l].push(i.addSingleItem(f,t,!1)),r&&this.collectionHandler.expandCollectionMap(f,p,n),"Projectnotitie"===l&&u(i.tabRequestParameters,[f.itemType,f.itemId],[{},{no_notification:!0}])}r&&this.collectionHandler.addToCollections(p,!1)}return o},e.prototype.getLocalCache=function(){return this.localCacheManager.getCacheManager(this.authInterface.getUniqueUserId())},e.prototype.resetLocalCache=function(){var e=this.getLocalCache(),t=this.localCacheFactory.construct();e.clearResources(),this.localCacheManager.setCacheManager(this.authInterface.getUniqueUserId(),t)},e.prototype.addToCollections=function(e,t){return this.collectionHandler.addToCollections(this.createCollectionMap(e,!0),!1,t)},e.prototype.removeFromCollections=function(e,t){return this.collectionHandler.removeFromCollections(this.createCollectionMap(e,!1),!1,t)},e.prototype.updateItemIdMap=function(e,t){if(void 0!==t)for(var r in t){var i=t[r];void 0!==e[r]&&(e[i]=e[r],delete e[r])}},e.prototype.createCollectionResource=function(e,t,r){return this.addCollection(e,t,r)},e.prototype.createItemResource=function(e,t,r){return this.addSingleItem(e,t,r)},e.prototype.createItemResources=function(e,t){return this.addSingleItems(e,t)},e.prototype.onBeforeSave=function(e,t){return this.getLocalCache().registerCallback("onBeforeSave",e,t)},e.prototype.onSaveSuccess=function(e,t){return this.getLocalCache().registerCallback("onSaveSuccess",e,t)},e.prototype.onSaveWithoutClosing=function(e,t){return this.getLocalCache().registerCallback("onSaveWithoutClosing",e,t)},e}(),w=function(){function e(e,t,r){this.apiFormatter=e,this.keyService=t,this.promiseService=r,this.undefinedItemError="Het opgevraagde item bestaat niet / Je hebt niet voldoende rechten om dit item te bekijken",this.ALL_PERMISSIONS=7}return e.prototype.resetDerived=function(e,t){for(var r=[],i=0,n=e.columns.root;i<n.length;i++){var o=n[i];-1!==t.indexOf(o.id)&&r.push(o)}!function t(r){for(var i=0,n=r;i<n.length;i++){var o=n[i];o.isLeaf||t(o.children),delete e.derived[o.path]}}(r)},e.prototype.defer=function(e,t){return e.deferred=this.promiseService.defer(),e.deferRequest=t,e},e.prototype.resolve=function(e){var t=e.deferred;return delete e.deferred,delete e.deferRequest,t.resolve(e),e},e.prototype.reject=function(e,t){return void 0===t&&(t=this.undefinedItemError),e.deferred.reject(t),delete e.deferred,delete e.deferRequest,e},e.prototype.clearResources=function(e){e.resources=[]},e.prototype.deactivateResources=function(e){for(var t=0,r=e.resources;t<r.length;t++){r[t].deactivate()}},e.prototype.getFields=function(e){return void 0!==e.modified?e.modified:e.initial},e.prototype.expand=function(e,t,r,i){var n=i.difference;return e.columns=i.merged,this.apiFormatter.expandResponse(e.initial,t,n.main),this.apiFormatter.expandResponse(e.derived,r,n.derived),void 0===e.modified?e:(this.apiFormatter.expandResponse(e.modified,t,n.main),e)},e.prototype.processOptions=function(e){return n(e,{columns:!0,parent:null,templateOptions:{},templateColumns:{},deferRequest:!1})},e.prototype.getConversionValue=function(e,t,r){if(void 0!==r[e])return r[e][t]},e.prototype.updateFields=function(e,t,r){void 0===r&&(r=!0);var i=e.columns.main,n=e.columns.formatted.main,o=e.initial,s=e.modified;if(void 0!==s){for(var c=0,a=i;c<a.length;c++){var u=(p=a[c]).id;(r||this.apiFormatter.compareFields(p.apiColumn.type,o[u],s[u]))&&(s[u]=t[u])}this.apiFormatter.formatResponse(s,n)}for(var l=0,h=i;l<h.length;l++){var p;o[u=(p=h[l]).id]=t[u]}return this.apiFormatter.formatResponse(o,n),e},e.prototype.updateItemValue=function(e,t,r,i){var n,o=r.id,s=t[o];"link"===r.type&&void 0===s?null!==e.parent&&(n=e.parent.itemId):n=this.getConversionValue(r.itemType,s,i),void 0!==n&&(t[o]=n)},e.prototype.updateItemFields=function(e,t){for(var r=e.columns.item,i=e.initial,n=e.modified,o=0,s=r;o<s.length;o++){var c=s[o].apiColumn;this.updateItemValue(e,i,c,t),void 0!==n&&this.updateItemValue(e,n,c,t)}},e.prototype.process=function(e){var t=e.columns.formatted;return this.apiFormatter.formatResponse(e.initial,t.main),this.apiFormatter.formatResponse(e.derived,t.derived),e},e.prototype.formatRequest=function(e){return void 0===e.modified?{}:this.apiFormatter.formatRequest(this.keyService.isLocalId(e.itemId)?{}:e.initial,e.modified,e.columns.main)},e.prototype.setDisplayName=function(e){if(void 0!==e.modified){var t=this.getDisplayName(e);t&&(e.modified.displayname=t)}},e.prototype.getDisplayName=function(e){var t=void 0===e.modified?e.initial:e.modified;switch(e.itemType){case"Contact":return"bedrijf"===t.type?t.bedrijf:this.getFullName(t.voornaam,t.tussenvoegsel,t.naam);case"Medewerker":case"Person":return this.getFullName(t.voornaam,t.tussenvoegsel,t.achternaam);case"Reparatie":return e.derived["materiaal>naam"];default:return t[this.getTitleField(e.itemType)]}},e.prototype.getFullName=function(e,t,r){return e.trim().concat(" ",t).trim().concat(" ",r)},e.prototype.getTitleField=function(e){switch(e){case"Exemplaar":return"serienummer";case"Factuur":return"nummer";case"Files":return"friendlyname";case"Functie":case"Standaardfunctie":return"naamintern";case"Voorraadmutatie":return"omschrijving";case"Barcode":return"code";case"Betaalmiddel":case"Betalingsconditie":case"Briefpapier":case"TaxClass":case"TaxSchema":case"Condition":case"Factuurmoment":case"Functiegroep":case"Grootboek":case"Inhuur":case"Inhuurgroep":case"Inhuurmateriaal":case"Materiaal":case"MateriaalCat":case"Medewerkertarief":case"Notitie":case"Planningmateriaal":case"Project":case"Staffelgroep":case"Subproject":case"Taak":case"Tag":case"Template":case"Tijd":case"Titel":case"Type":case"Voertuig":return"naam";default:return"displayname"}},e.prototype.getChanges=function(e,t){return void 0!==e.modified||t?this.apiFormatter.getChanges(e.initial,t?{}:e.modified,e.columns.main):[]},e.prototype.isLocal=function(e){return this.keyService.isLocalId(e.itemId)},e.prototype.isLockable=function(e){if(this.isLocal(e))return!1;switch(e.itemType){case"Project":case"Materiaal":case"Contact":case"Medewerker":case"Voertuig":case"Template":return!0;default:return!1}},e.prototype.hasChanges=function(e){return void 0!==e.modified&&this.apiFormatter.hasChanges(e.initial,e.modified,e.columns.main)},e.prototype.resetModified=function(e){var t=e.columns.main;if(void 0!==e.modified)for(var r=0,i=t;r<i.length;r++){var n=i[r];e.modified[n.id]=this.apiFormatter.clone(n.apiColumn.type,e.initial[n.id])}},e.prototype.setInitial=function(e,t,r){var i;for(var n in t)e.initial[n]=t[n];if(void 0===e.modified)return r&&this.callOnChange(e,this.apiFormatter.copyFields(e.initial,{},e.columns.main)),e;for(var n in i=this.apiFormatter.copyFields(e.modified,{},e.columns.main),t)e.modified[n]=t[n];return r&&this.callOnChange(e,i),e},e.prototype.setModified=function(e,t){var r=e.columns,i=r.response[e.itemType];if(void 0===e.modified){var n=e.resources,o=e.initial,s=e.modified={};if(void 0===t)this.apiFormatter.copyFields(o,s,r.main);else for(var c in this.apiFormatter.shallowCopyFields(t,o,s,r.main),t)void 0===i[c]&&(s[c]=t[c]);for(var a=0,u=n;a<u.length;a++){u[a].fields=s}return e}if(void 0===t)return e;for(var c in t)e.modified[c]=t[c];return e},e.prototype.setDerived=function(e,t){for(var r in t)e.derived[r]=t[r];return e},e.prototype.processLocal=function(e,t,r,n,o){return e.initial={permissions:this.ALL_PERMISSIONS},this.updateFields(e,t),this.updateItemFields(e,o),this.setModified(e,r),e.modified.created=i(),e.derived=n,e},e.prototype.setParent=function(e,t,r){return e.parent={itemType:t,itemId:r},e},e.prototype.callOnChange=function(e,t){for(var r=0,i=e.resources.length;r<i;r++){var n=e.resources[r];null!==n&&n.options.onChange(n,t)}},e}(),D=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m){this.apiRequestService=e,this.authInterface=t,this.errorHandler=r,this.itemEntryFactory=i,this.columnHandler=n,this.itemCacheFactory=o,this.batchStatusFactory=s,this.columnExpansionFactory=c,this.columnSetFactory=a,this.itemEntryService=u,this.apiFormatter=l,this.keyService=h,this.promiseService=p,this.columnUtil=m,this.templates={},this.entries=this.itemCacheFactory.construct()}return e.prototype.getItemId=function(e){return e.itemId},e.prototype.getPromise=function(e){return e.deferred.promise},e.prototype.fetchItem=function(e,t,r){var i=this,n=this.getEntryStatus(e,t,r),o=n.entry,s=n.status;return s===E.LOCAL?this.fetchTemplate(e,r.templateOptions,r.templateColumns).then(function(e){return i.resolveLocal(o,r.parent,e)},function(e){return i.itemEntryService.reject(o,e),i.errorHandler.reject(e)}):this.resolveCached(o,s,r)},e.prototype.fetchItems=function(e,t,r){for(var i=this,n=this.batchStatusFactory.construct(function(e){return i.getItemId(e)},function(e){return i.getPromise(e)}),o={},s=0,c=t;s<c.length;s++){var a=c[s];n.add(this.getEntryStatus(e,a,r))}return o.entries=n.getPromises(),n.hasRequests()&&(o.requests=this.requestItem(e,n.getRequestIds(),r.columns)),n.hasEntries([E.LOCAL])&&(o.template=this.fetchTemplate(e,r.templateOptions,r.templateColumns)),this.promiseService.all(o).then(function(t){return i.batchResolve(e,n,r.columns,t)},this.errorHandler.reject)},e.prototype.resolveCached=function(e,t,r){var i=this,n=e.itemType,o=e.itemId,s=e.columns.request;switch(t){case E.CACHED:return this.promiseService.when(e);case E.PROMISED:return e.deferred.promise;case E.PROMISED_EXPAND:return e.deferred.promise.then(function(){return i.resolveCached(e,i.getCachedEntryStatus(e,r),r)},this.errorHandler.reject)}if(t===E.EXPAND){var c=this.columnUtil.mergeRequestColumns(s,r.columns).difference;this.requestItem(n,o,c).then(function(t){i.resolveExpansion(e,i.columnExpansionFactory.construct(n,c,t.fetchColumnsObject()),t)},function(t){i.itemEntryService.reject(e,t)})}else this.requestItem(n,o,s).then(function(t){i.resolveRemote(e,i.columnSetFactory.construct(n,s,t.fetchColumnsObject()),t)},function(t){i.itemEntryService.reject(e,t)});return e.deferred.promise},e.prototype.resolveLocal=function(e,t,r){var i=e.itemType,n=e.itemId,o=this.createConversionMap(i,n,!0,r.response);return e.columns=r.columns,null!==t&&this.itemEntryService.setParent(e,t.itemType,t.itemId),this.itemEntryService.processLocal(e,r.fields,{},{},o),this.setCreator(e),this.itemEntryService.resolve(e),{main:e,linked:this.createLocalEntries(i,n,r,o)}},e.prototype.resolveExpansion=function(e,t,r){var i=e.itemType,n=e.itemId,o=t.run(e.columns,!0);return null===o?e:(this.itemEntryService.expand(e,r.fetchObject(i,n),r.fetchDerivedObject(i,n,o.difference.root),o),this.itemEntryService.resolve(e))},e.prototype.resolveRemote=function(e,t,r){var i=e.itemType,n=e.itemId,o=r.fetchObject(i,n);return void 0===o?(this.itemEntryService.reject(e),this.entries.clear(e),null):this.resolveDeferredEntry(e,o,r.fetchDerivedObject(i,n,t.root),t)},e.prototype.fetchTemplate=function(e,t,r){var i=this;void 0===t&&(t={}),void 0===r&&(r={});var n=o(t),c=s(r);if(!n){var a=this.templates[e];if(void 0!==a&&(null===c||this.columnUtil.responseColumnsAvailable(c,r[c],a.responseColumns)))return this.promiseService.when(a)}return this.promiseService.all([this.apiRequestService.template(e,t),null===c?{}:this.columnHandler.fetch(c,r[c])]).then(function(t){var r=t[0],o=i.columnUtil.mergeResponseColumns(r.fetchColumnsObject(),t[1]).merged,s={fields:r.fetchObject(e,r.links[e][0]),columns:i.columnSetFactory.construct(e,!0,o),response:r,responseColumns:o};return!n&&r.cacheable&&(i.templates[e]=s),s},this.errorHandler.reject)},e.prototype.getEntryStatus=function(e,t,r){var i=this.entries.get(e,t);return void 0===i?this.keyService.isLocalId(t)?{entry:this.createDeferredEntry(e,t,!0,!1),status:E.LOCAL}:{entry:this.createDeferredEntry(e,t,r.columns,r.deferRequest),status:r.deferRequest?E.PROMISED:E.RESOLVE}:{entry:i,status:this.getCachedEntryStatus(i,r)}},e.prototype.getCachedEntryStatus=function(e,t){var r=e.columns,i=this.itemEntryService.isLocal(e)||this.columnUtil.isColumnSubset(t.columns,r.request,r.true);return void 0!==e.deferred?e.deferRequest?(r.request=this.columnUtil.mergeRequestColumns(r.request,t.columns).merged,E.RESOLVE):i?E.PROMISED:E.PROMISED_EXPAND:i?E.CACHED:(this.itemEntryService.defer(e,!1),E.EXPAND)},e.prototype.createDeferredEntry=function(e,t,r,i){var n=this.createEntryStub(e,t);return n.columns={itemType:e,request:r,true:!0===r},this.itemEntryService.defer(n,i)},e.prototype.createEntryStub=function(e,t){return this.entries.add(this.itemEntryFactory.construct(e,t))},e.prototype.createEntry=function(e,t,r,i){return this.itemEntryService.process(this.entries.add(this.itemEntryFactory.construct(i.itemType,e,i,t,r)))},e.prototype.resolveDeferredEntry=function(e,t,r,i){return e.columns=i,e.initial=t,e.derived=r,this.itemEntryService.process(e),this.itemEntryService.resolve(e)},e.prototype.batchResolve=function(e,t,r,i){var n=this,o=i.requests,s=[E.EXPAND,E.PROMISED_EXPAND],c=[E.RESOLVE],a=!0;if(t.hasEntries(s)){var u=this.columnExpansionFactory.construct(e,r,o.fetchColumnsObject());t.forEachEntry(s,function(e){n.resolveExpansion(e,u,o)})}if(t.hasEntries(c)){var l=this.columnSetFactory.construct(e,r,o.fetchColumnsObject());t.forEachEntry(c,function(e){null===n.resolveRemote(e,l,o)&&(a=!1)})}return t.forEachEntry([E.LOCAL],function(e){n.resolveLocal(e,null,i.template)}),a?t.getArray():this.errorHandler.reject({message:this.itemEntryService.undefinedItemError})},e.prototype.cloneItem=function(e,t,r){var i=t.columns,n=t.parent;void 0===r&&((o={})[t.itemType]=((s={})[t.itemId]=e,s),r=o);var o,s,c=this.createEntry(e,this.apiFormatter.copyFields(this.itemEntryService.getFields(t),{},i.main),this.apiFormatter.copyFields(t.derived,{},i.derived),i);return this.itemEntryService.updateItemFields(c,r),c.modified=this.apiFormatter.copyFields(c.initial,{},i.main),n?this.itemEntryService.setParent(c,n.itemType,n.itemId):c},e.prototype.createConversionMap=function(e,t,r,i){var n,o,s=i.links[e][0],c=((n={})[e]=((o={})[s]=t,o),n);return r&&this.extendConversionMap(c,i.items[e][s].links,i),c},e.prototype.createLocalEntries=function(e,t,r,i){var n=this,o=this,s=r.response,c={},a={},u=[];for(var l in s.items)l!==e&&(c[l]=this.columnSetFactory.construct(l,!0,r.responseColumns));var h=function(e,t,r){var l={itemType:e,itemId:t},p=s.items[e][r].links;for(var m in p){var d=p[m];void 0===a[m]&&u.push({itemType:m,itemEntries:a[m]=[]});for(var f=0,v=d;f<v.length;f++){var y=v[f],g=i[m][y],S=o.createEntryStub(m,g);S.columns=c[m],S.parent=l,n.itemEntryService.processLocal(S,s.fetchObject(m,y),{},{},i),n.setCreator(S),a[m].push(S),h(m,g,y)}}};return h(e,t,s.links[e][0]),u},e.prototype.createLocalEntry=function(e,t,r,i,n){void 0===n&&(n=null);var o=t.columns.itemType,s=this.createEntryStub(o,e);return s.columns=t.columns,null!==n&&(s.parent=n),this.itemEntryService.processLocal(s,t.fields,r,i,this.createConversionMap(o,e,!1,t.response)),this.setCreator(s),s},e.prototype.extendConversionMap=function(e,t,r){for(var i in t){var n=t[i];void 0===e[i]&&(e[i]={});for(var o=0,s=n;o<s.length;o++){var c=s[o];e[i][c]=this.keyService.getLocalId(),this.extendConversionMap(e,r.items[i][c].links,r)}}},e.prototype.fetchTitle=function(e,t,r){void 0===r&&(r=!0);var i=this.itemEntryService.getTitleField(e);return this.fetchItem(e,t,this.itemEntryService.processOptions({columns:[i],deferRequest:r})).then(function(e){return void 0!==e.main?e.main.initial[i]:void 0!==e.modified?e.modified[i]:e.initial[i]},this.errorHandler.reject)},e.prototype.requestItem=function(e,t,r){var i,n=((i={})[e]=r,i);return this.apiRequestService.query(e,{id:t},n)},e.prototype.updateItemId=function(e,t){var r=e.itemId;return e.itemId=t,this.entries.updateItemId(e,r)},e.prototype.setCreator=function(e){e.modified.creator=this.authInterface.getUserId(),e.derived["creator>displayname"]=this.authInterface.getUserDisplayname()},e}(),x=function(){function e(e,t,r,i,n,o,s,c,a){this.apiRequestService=e,this.errorHandler=t,this.itemHandler=r,this.columnHandler=i,this.columnExpansionFactory=n,this.columnSetFactory=o,this.itemEntryService=s,this.queryService=c,this.promiseService=a}return e.prototype.requestItem=function(e,t,r){var i,n=((i={})[e]=r,i);return this.apiRequestService.query(e,{id:t},n)},e.prototype.requestItems=function(e,t,r){void 0===t&&(t=e.query.object),void 0===r&&(r=e.options.columns);var i,n=e.options,o={requestType:"query",columns:((i={})[e.itemType]=r,i),query:t,itemType:"",allLinkIds:!1,limit:null};return null===n.queryItemType?o.itemType=e.itemType:(o.itemType=n.queryItemType,o.allLinkIds=!0),null!==n.limit&&(o.limit=n.limit),this.apiRequestService.requestSkeleton(o)},e.prototype.requestLinkItems=function(e,t,r,i,n){var o,s=((o={})[r]=n,o);return null===i?this.apiRequestService.query(e,{id:t},s):this.apiRequestService.query(r,this.queryService.addAndCondition(i,{linkedTo:e,query:{id:t}}),s)},e.prototype.processExpansion=function(e,t,r,i){for(var n=this.columnExpansionFactory.construct(r,e,t.fetchColumnsObject()),o=0,s=i;o<s.length;o++){var c=s[o];this.itemEntryService.isLocal(c)||this.handleCachedItem(c,t,n)}return n},e.prototype.processResponse=function(e,t,r,i,n){var o=this;void 0===n&&(n=this.columnExpansionFactory.construct(i.itemType,!!i.true||i.request,i.response));for(var s=i.itemType,c=i.root,a=[],u=[],l=0,h=t;l<h.length;l++){var p=h[l],m=this.itemHandler.entries.get(s,p);void 0===m?(m=this.itemHandler.createEntry(p,e.fetchObject(s,p),e.fetchDerivedObject(s,p,c),i),a.push(m)):void 0!==m.deferred?m.deferRequest?a.push(this.itemHandler.resolveDeferredEntry(m,e.fetchObject(s,p),e.fetchDerivedObject(s,p,c),i)):u.push(m.deferred.promise):a.push(this.handleCachedItem(m,e,n)),null!==r&&(m.parent=r)}return this.promiseService.all(u).then(function(t){for(var r=0,i=t;r<i.length;r++){var s=i[r];a.push(o.handleCachedItem(s,e,n))}return a},this.errorHandler.reject)},e.prototype.handleCachedItem=function(e,t,r){var i=r.run(e.columns,!0);return null===i?e:this.itemEntryService.expand(e,t.fetchObject(e.itemType,e.itemId),t.fetchDerivedObject(e.itemType,e.itemId,i.difference.root),i)},e.prototype.processLinkResponse=function(e,t,r,i,n){for(var o=e.fetchColumnsObject(),s=this.columnSetFactory.construct(i,n.columns,o),c=this.columnExpansionFactory.construct(i,n.columns,o),u=e.items[t],l={},h=0,p=r;h<p.length;h++){var m=p[h];l[m]=a(u,[m,"links",i])?this.processResponse(e,u[m].links[i],{itemType:t,itemId:m},s,c):[]}return this.promiseService.all(l).then(function(e){return{items:e,columns:s,columnExpansion:c}},this.errorHandler.reject)},e}(),L=function(){function e(){}return e.prototype.processOptions=function(e){return n(e,{edit:!1,onChange:Ue,onDeactivate:Ue})},e.prototype.compareOptions=function(e,t){for(var r in e)if(e[r]!==t[r])return!1;return!0},e.prototype.isNewResource=function(e){return e.isLocal()&&void 0===e.transactions},e}(),P=function(){function e(){this.NEW_PREFIX="-1",this.DUPLICATE_PREFIX="-2",this.NEW_KEYWORD="new-",this.DUPLICATE_KEYWORD="dup-",this.seperator=":"}return e.prototype.getSingleKey=function(e,t){return e.concat(this.seperator,String(t))},e.prototype.getCollectionCacheKey=function(e,t,r){return e.concat(this.seperator,String(t),this.seperator,r)},e.prototype.getCssKey=function(){return Array.prototype.join.call(arguments,"_")},e.prototype.parseStateKey=function(e){return 0===(e=e.toString()).indexOf(this.NEW_KEYWORD)?{type:"new",template:e.substring(this.NEW_KEYWORD.length)}:0===e.indexOf(this.DUPLICATE_KEYWORD)?{type:"duplicate",itemId:e.substring(this.DUPLICATE_KEYWORD.length)}:null},e.prototype.getDuplicateStateKey=function(e){return this.DUPLICATE_KEYWORD.concat(String(e))},e.prototype.getNewStateKey=function(e){return this.NEW_KEYWORD.concat(e)},e.prototype.getLocalId=function(){return parseInt(this.NEW_PREFIX.concat(this.getRandomString()),10)},e.prototype.getLocalDuplicateId=function(){return parseInt(this.DUPLICATE_PREFIX.concat(this.getRandomString()),10)},e.prototype.getRandomString=function(){return Math.random().toString().split(".")[1].substr(0,8)},e.prototype.isLocalId=function(e){return void 0!==e&&(this.isNewId(e)||this.isDuplicateId(e))},e.prototype.isNewId=function(e){return 0===e.toString().indexOf(this.NEW_PREFIX)||e===this.NEW_KEYWORD},e.prototype.isDuplicateId=function(e){return 0===e.toString().indexOf(this.DUPLICATE_PREFIX)||e===this.DUPLICATE_KEYWORD},e}(),A=function(){function e(e,t,r,i){this.apiRequestService=e,this.errorHandler=t,this.keyService=r,this.promiseService=i,this.lockItems={},this.promises={}}return e.prototype.getValue=function(e,t){var r=e.itemType;if(void 0!==t[r])return t[r][e.itemId]},e.prototype.setValue=function(e,t,r){return u(r,[e.itemType,e.itemId],[{},t])},e.prototype.getLocks=function(){return this.lockItems},e.prototype.hasLock=function(e){for(var t in this.lockItems)for(var r in this.lockItems[t]){var i=this.lockItems[t][r];if(!i.isForeign&&i.id==e)return!0}return!1},e.prototype.isLocked=function(e){var t=this.getValue(e,this.lockItems);return void 0!==t&&t.isForeign},e.prototype.getMessage=function(e){var t=this.getValue(e,this.lockItems);if(void 0!==t&&t.isForeign)return t.message},e.prototype.fetchCachedLock=function(e){var t=this.getValue(e,this.lockItems);if(void 0!==t)return this.promiseService.when(t);var r=this.getValue(e,this.promises);return void 0!==r?r:this.promiseService.when()},e.prototype.fetchLock=function(e){var t=this;return this.fetchCachedLock(e).then(function(r){return void 0!==r?r:t.requestLock(e)},this.errorHandler.reject).then(function(e){return e.isForeign?t.errorHandler.reject(e.message):e.token},this.errorHandler.reject)},e.prototype.requestLock=function(e){var t=this,r=e.itemType,i=e.itemId,n=this.apiRequestService.create("Locktoken",this.keyService.getLocalId(),{itemtype:r,item:i}).then(function(n){return delete t.promises[r][i],t.setValue(e,n.fetchObject("Locktoken",n.links.Locktoken[0]),t.lockItems)},function(n){return delete t.promises[r][i],301===n.code?t.setValue(e,{isForeign:!0,message:n.message},t.lockItems):t.errorHandler.reject(n)});return this.setValue(e,n,this.promises)},e.prototype.deleteLock=function(e){var t=this;return this.fetchCachedLock(e).then(function(r){if(void 0!==r){if(!r.isForeign)return t.apiRequestService.delete("Locktoken",r.id).then(function(){t.clearLock(e)},t.errorHandler.reject);t.clearLock(e)}},this.errorHandler.reject)},e.prototype.clearLock=function(e){var t=e.itemType;return void 0!==this.lockItems[t]&&delete this.lockItems[t][e.itemId]},e}(),U=function(){function e(){}return e.prototype.addAndCondition=function(e,t){return void 0===e.conditions||"or"===e.operator?{conditions:[e,t]}:{conditions:e.conditions.concat(t)}},e.prototype.addOrCondition=function(e,t){return"or"===e.operator?{conditions:e.conditions.concat(t)}:{conditions:[e,t],operator:"or"}},e.prototype.addParentCondition=function(e,t){var r;return null===t?e:(r={linkedTo:t.itemType,query:t.itemId},null===e?r:this.addAndCondition(e,r))},e.prototype.createNotIn=function(e){return{comparator:"NOT IN",key:"id",value:e}},e}(),_=function(){function e(e,t,r,i,n,o,s,c,a,u){this.promiseService=e,this.apiRequestService=t,this.itemHandler=r,this.itemEntryService=i,this.collectionHandler=n,this.columnSetFactory=o,this.columnExpansionFactory=s,this.requestColumnExpansionFactory=c,this.apiFormatter=a,this.errorHandler=u}return e.prototype.onMessageReceived=function(e){switch(e.body.eventType){case"update":return this.handleUpdate(e);case"create":return this.handleCreate(e);case"delete":return this.handleDelete(e);case"linkTo":return this.handleLinkMove(e)}},e.prototype.formatMessageValues=function(e,t){var r={};for(var i in t)r[i]=this.apiFormatter.formatResponseValue(t[i].type,e[i]);return r},e.prototype.createCollectionMap=function(e,t,r){var i={};for(var n in t){var o=t[n],s=null!==o.parent?o.parent:{};i[n]=this.collectionHandler.entries.getByFittingItem(s.itemType,s.itemId,e,this.formatMessageValues(o.values,r))}return i},e.prototype.groupByCollectionId=function(e,t){var r={};for(var i in t){var n=t[i];for(var o in n)for(var s=0,c=n[o];s<c.length;s++){var a=c[s],u=a.id;void 0===r[u]&&(r[u]={collection:a,fitting:[],notfitting:[],maybe:[]}),r[u][o].push("fitting"===o?this.itemHandler.entries.get(e,i):i)}}return r},e.prototype.getRequestColumns=function(e,t){var r=this.requestColumnExpansionFactory.construct();for(var i in t){for(var n=t[i].fitting,o=this.itemHandler.entries.get(e,i),s=0,c=n;s<c.length;s++){var a=c[s];r.expand(a.columns)}void 0!==o&&r.expand(o.columns)}return r.get()},e.prototype.deferEntry=function(e){var t=e.deferred;return void 0===t?this.itemEntryService.defer(e,!1):t.promise.then(this.deferEntry.bind(this),this.errorHandler.reject)},e.prototype.processMessage=function(e){var t=this,r=e.itemType,i=this.createCollectionMap(r,e.items[r],e.columns[r]),n=this.getRequestColumns(r,i),o=[],s=[];for(var c in i){var a=this.itemHandler.entries.get(r,c);void 0===a?0!==i[c].fitting.length&&(this.itemHandler.createDeferredEntry(r,parseInt(c,10),n[r],!1),s.push(c)):(o.push(this.deferEntry(a)),s.push(c))}return 0===s.length?this.promiseService.when(this.groupByCollectionId(r,i)):this.promiseService.all(o).then(function(){return t.apiRequestService.query(r,{id:s},n)},this.errorHandler.reject).then(function(e){return t.handleResponse(r,s,n[r],e,i)},this.errorHandler.reject)},e.prototype.processFunctionChangesResolve=function(e){var t=this,r=e.items.FunctionChangesResolve,i=[],n=[];for(var o in r){var s=r[o].parent.itemId,c=this.itemHandler.entries.get("Functie",s);void 0!==c&&void 0!==c.columns.response.Functie.newchanges&&(i.push(this.deferEntry(c)),n.push(s))}if(0!==n.length)return this.promiseService.all(i).then(function(){return t.apiRequestService.query("Functie",{id:n},{Functie:["newchanges"]})},this.errorHandler.reject).then(function(e){for(var r=0,i=e.links.Functie;r<i.length;r++){var n=i[r],o=t.itemHandler.entries.get("Functie",n),s=t.apiFormatter.copyFields(t.itemEntryService.getFields(o),{},o.columns.main),c=e.fetchValue("Functie",n,"newchanges");if(c===s.newchanges)return;t.itemEntryService.setInitial(o,{newchanges:c},!0),t.itemEntryService.callOnChange(o,s),t.itemEntryService.resolve(o)}},this.errorHandler.reject).catch(this.errorHandler.notifyError)},e.prototype.handleResponse=function(e,t,r,i,n){for(var o=i.fetchColumnsObject(),s=this.columnSetFactory.construct(e,r,o),c=this.columnExpansionFactory.construct(e,r,o),a=0,u=t;a<u.length;a++){var l=u[a],h=this.itemHandler.entries.get(e,l),p=void 0===h.initial,m=i.fetchObject(e,l);if(void 0!==m){var d=i.fetchDerivedObject(e,l,s.root);if(p)this.itemHandler.resolveDeferredEntry(h,m,d,s);else{var f=c.run(h.columns,!0),v=this.apiFormatter.copyFields(this.itemEntryService.getFields(h),{},h.columns.main);null!==f&&this.itemEntryService.expand(h,m,d,f),this.itemEntryService.setDerived(h,d),this.itemEntryService.updateFields(h,m,!1),this.itemEntryService.callOnChange(h,v),this.itemEntryService.resolve(h)}}else this.itemEntryService.reject(h),p&&this.itemHandler.entries.clear(h),delete n[l]}return this.groupByCollectionId(e,n)},e.prototype.handleCreate=function(e){var t=this,r=e.body;return"FunctionChangesResolve"===r.itemType?this.processFunctionChangesResolve(r):this.processMessage(r).then(function(e){return t.collectionHandler.addToCollections(e,!0)},this.errorHandler.reject).catch(this.errorHandler.notifyError)},e.prototype.handleUpdate=function(e){var t=this;return this.processMessage(e.body).then(function(e){return t.collectionHandler.removeFromAndAddToCollections(e,!0)},this.errorHandler.reject).catch(this.errorHandler.notifyError)},e.prototype.handleDelete=function(e){for(var t=e.body,r={},i=0,n=t.items;i<n.length;i++)for(var o=n[i],s=0,c=this.collectionHandler.entries.getByContainingItem(t.itemType,o);s<c.length;s++){var a=c[s];void 0===r[u=a.id]&&(r[u]={collection:a,items:[]}),r[u].items.push(o)}for(var u in r){var l=r[u];l.collection.removeItems(l.items,null,!0)}return this.promiseService.when()},e.prototype.handleLinkMove=function(e){return this.promiseService.when()},e}(),V=function(){function e(e,t){this.apiFormatter=e,this.response=t,this.columnIndexMap={},this.columnMap={},this.columns=t.columns,this.items=t.items,this.links=t.links,this.cacheable=t.cacheable,this.map=t.map,this.createColumnMaps()}return e.prototype.createColumnMaps=function(){for(var e in this.columns){this.columnIndexMap[e]={},this.columnMap[e]={};for(var t=0;t<this.columns[e].length;t++){var r=this.columns[e][t];this.columnIndexMap[e][r.id]=t,this.columnMap[e][r.id]=r}}},e.prototype.fetchValue=function(e,t,r){if(void 0!==this.items[e][t])return this.items[e][t].data[this.columnIndexMap[e][r]]},e.prototype.fetchDerivedObject=function(e,t,r){for(var i={},n=0,o=r;n<o.length;n++){var s=o[n];this.fetchDerivedValues(this.fetchValue(e,t,s.id),s,i)}return i},e.prototype.fetchDerivedValues=function(e,t,r){for(var i=0,n=t.children;i<n.length;i++){var o=n[i],s=void 0;null===e?(s=null,r[o.path]=this.apiFormatter.getDefaultValue(o.apiColumn.type)):(s=this.fetchValue(t.itemType,e,o.id),r[o.path]=s),o.isLeaf||this.fetchDerivedValues(s,o,r)}},e.prototype.fetchObject=function(e,t,r){if((void 0===r&&(r=!1),void 0!==this.items[e])&&void 0!==this.items[e][t]){for(var i=this.items[e][t].data,n={},o=0;o<i.length;o++)n[this.columns[e][o].id]=i[o];if(r){var s=this.items[e][t].links;for(var c in n.__links={},s)n.__links[c]=this.fetchObjectArray(c,r,s[c])}return n}},e.prototype.fetchObjectArray=function(e,t,r){var i=[];if(null===r){for(var n in this.items[e])i.push(this.fetchObject(e,n,t));return i}void 0===r&&(r=this.links[e]);for(var o=0;o<r.length;o++)i.push(this.fetchObject(e,r[o],t));return i},e.prototype.fetchObjectMap=function(e,t,r,i){var n=this.columnIndexMap[e][t],o={},s=[];for(var c in this.items[e]){var a=this.items[e][c].data[n];s.push(a),o[a]=this.fetchObject(e,c,r)}return i?{result:o,keys:s}:o},e.prototype.fetchFieldMap=function(e,t){var r=this.columnIndexMap[e][t],i={};for(var n in this.items[e])i[n]=this.items[e][n].data[r];return i},e.prototype.fetchColumnArray=function(e){for(var t=[],r=0;r<this.columns[e].length;r++)t.push(this.columns[e][r]);return t},e.prototype.fetchColumnObject=function(e){return this.columnMap[e]},e.prototype.fetchColumnsObject=function(){return this.columnMap},e.prototype.createResource=function(e,t){return{object:this.fetchObject(e,t),links:this.items[e][t].links}},e.prototype.hasItems=function(e){for(var t in this.items[e])return!0;return!1},e.prototype.getIdArray=function(e){var t=[];for(var r in this.items[e])t.push(r);return t},e}(),N=function(){function e(e){this.apiFormatter=e}return e.prototype.construct=function(e){return new V(this.apiFormatter,e)},e}(),B=function(){function e(e,t,r){for(var i in this.promiseService=e,this.getItemId=t,this.getPromise=r,this.entries={},E)this.entries[E[i]]=[]}return e.prototype.add=function(e){var t=e.status;void 0===this.entries[t]&&(this.entries[t]=[]),this.entries[t].push(e.entry)},e.prototype.hasEntries=function(e){for(var t=0,r=e;t<r.length;t++){var i=r[t];if(this.entries[i].length>0)return!0}return!1},e.prototype.hasRequests=function(){return this.hasEntries([E.RESOLVE,E.EXPAND,E.PROMISED_EXPAND])},e.prototype.forEachEntry=function(e,t){for(var r=0,i=e;r<i.length;r++)for(var n=i[r],o=0,s=this.entries[n];o<s.length;o++){t(s[o])}},e.prototype.getPromises=function(){var e=this,t=[];return this.forEachEntry([E.PROMISED,E.PROMISED_EXPAND],function(r){t.push(e.getPromise(r))}),this.promiseService.all(t)},e.prototype.getRequestIds=function(){var e=this,t=[];return this.forEachEntry([E.RESOLVE,E.EXPAND,E.PROMISED_EXPAND],function(r){t.push(e.getItemId(r))}),t},e.prototype.getArray=function(){var e=[];for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){var n=i[r];e.push(n)}return e},e}(),Q=function(){function e(e){this.promiseService=e}return e.prototype.construct=function(e,t){return new B(this.promiseService,e,t)},e}(),Y=function(){function e(e,t,r,i){this.itemEntryService=e,this.singleItems=t,this.collections=r,this.collectionOptions=i,this.compilation={create:{},delete:{},update:{},move:{}},this.moveArray=[],this.deleteMap={},this.processSingleItems(),this.processCollections(),this.postProcess()}return e.prototype.getParent=function(e){return null!==e.parent?e.parent:{itemType:"Void",itemId:0}},e.prototype.addMoveEntry=function(e){this.moveArray.push(e)},e.prototype.addDeleteEntry=function(e,t,r){u(this.deleteMap,[e.itemType,e.itemId],[{},{parentId:t,item:e,parentType:r}])},e.prototype.addUpdateEntry=function(e){u(this.compilation.update,[e.itemType,e.itemId],[{},e])},e.prototype.addCreateEntry=function(e){var t=this.getParent(e);u(this.compilation.create,[t.itemType,t.itemId,e.itemType,e.itemId],[{},{},{},e])},e.prototype.postProcess=function(){for(var e=0,t=this.moveArray;e<t.length;e++){var r=(c=t[e]).itemId,i=this.deleteMap[c.itemType];if(void 0!==i&&void 0!==i[r]){var n=c.parent;(s=u(this.compilation.move,[n.itemType,n.itemId],[{},[]])).push(i[r]),delete i[r]}}for(var o in this.deleteMap)for(var r in this.deleteMap[o]){var s,c=this.deleteMap[o][r].item;void 0===(s=this.compilation.delete)[o]&&(s[o]=[]),s[o].push(c)}},e.prototype.processSingleItems=function(){for(var e=0,t=this.singleItems;e<t.length;e++){var r=t[e];this.itemEntryService.isLocal(r)?this.addCreateEntry(r):this.itemEntryService.hasChanges(r)&&this.addUpdateEntry(r)}},e.prototype.isEditableCollection=function(e){return void 0===this.collectionOptions||this.collectionOptions[e.id].edit},e.prototype.hasEditableItems=function(e){return void 0===this.collectionOptions||this.collectionOptions[e.id].editItems},e.prototype.processCollections=function(){for(var e=0,t=this.collections;e<t.length;e++){var r=t[e];if(!r.isDeferred()){var i=r.parent,n=null!==i?i.itemId:0;if(this.isEditableCollection(r)){var o=void 0,s=void 0;r.isLocal()?(o=r.items,s=[]):(o=r.getAddedItems(),s=r.getRemovedItems());for(var c=0,a=o;c<a.length;c++){var u=a[c];this.itemEntryService.isLocal(u)?this.addCreateEntry(u):this.addMoveEntry(u)}for(var l=0,h=s;l<h.length;l++){var p=h[l];this.addDeleteEntry(p,n,i.itemType)}}if(this.hasEditableItems(r))for(var m=0,d=r.getUpdatedItems();m<d.length;m++){var f=d[m];this.addUpdateEntry(f)}}}},e}(),W=function(){function e(e){this.itemEntryService=e}return e.prototype.construct=function(e,t,r){return new Y(this.itemEntryService,e,t,r)},e}(),X=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p){this.apiRequestService=e,this.itemHandler=t,this.errorHandler=r,this.collectionHandler=i,this.columnHandler=n,this.changesCompilerFactory=o,this.createRequestFactory=s,this.columnExpansionFactory=c,this.requestColumnExpansionFactory=a,this.collectionEntryService=u,this.itemEntryService=l,this.apiFormatter=h,this.promiseService=p}return e.prototype.getItemTypeUpdatePriority=function(e){switch(e){case"Factuurregelbedrag":return 0;case"Factuurregel":case"Minfactuur":return 1;default:return 2}},e.prototype.buildMoveRequest=function(e){for(var t={},r=0,i=e;r<i.length;r++){var n=i[r].item,o=n.itemType;void 0===t[o]&&(t[o]=[]),t[o].push(n.itemId)}return t},e.prototype.getMapValue=function(e,t,r){if(void 0!==r&&void 0!==r[e])return r[e][t]},e.prototype.execute=function(e,t,r,i,n,o){return void 0===r&&(r=!1),this.executeRequests(this.changesCompilerFactory.construct(e,t,n),i,r,o)},e.prototype.executeCreateRequests=function(e,t,r,i,n){for(var o=[],s=0,c=this.createRequestFactory.construct(e,t,i).run();s<c.length;s++){var a=c[s];o.push(this.executeCreateRequest(a,r).then(u))}return this.promiseService.all(o).then(function(){return r},this.errorHandler.reject);function u(e){return v(n)&&n(r),e}},e.prototype.executeCreateRequest=function(e,t){var r=this;return this.apiRequestService.requestSkeleton(e.request).then(function(i){var n=i.map,o=i.fetchColumnsObject(),s=e.items;for(var c in s){var a=r.columnExpansionFactory.construct(c,e.request.columns[c],o);for(var u in s[c]){var l=s[c][u],h=r.getMapValue(c,u,n);if(void 0!==h){r.itemHandler.updateItemId(l,h);var p=i.fetchObject(c,h),m=a.run(l.columns,!0);r.itemEntryService.updateFields(l,p),null!==m&&r.itemEntryService.expand(l,p,i.fetchDerivedObject(c,h,m.difference.root),m)}else console.warn("Create failed!",l)}}for(var c in r.collectionHandler.addToCollections(e.collections,!0),n)for(var u in void 0===t[c]&&(t[c]={}),n[c])t[c][u]=n[c][u]},this.errorHandler.reject)},e.prototype.prioritizeUpdateRequests=function(e,t){var r=[[],[],[]],i=this.promiseService.when();for(var n in e)r[this.getItemTypeUpdatePriority(n)].push(n);for(var o=0,s=r;o<s.length;o++){var c=s[o];0!==c.length&&(i=i.then(this.executeUpdateRequests(c,e,t),this.errorHandler.reject))}return i},e.prototype.executeUpdateRequests=function(e,t,r){var i=this;return function(){for(var n=[],o=0,s=e;o<s.length;o++){var c=s[o];n.push(i.executeUpdateRequest(c,t[c],r))}return i.promiseService.all(n)}},e.prototype.executeUpdateRequest=function(e,t,r){var i=this,n={},o=this.requestColumnExpansionFactory.construct(),s={};for(var c in n[e]={},t){var a=t[c],u=n[e][c]={},h=l(r,[e,c]);u.values=this.itemEntryService.formatRequest(a),void 0!==h&&(u.parameters=h),o.expand(a.columns),this.collectionHandler.expandCollectionMap(a,s)}for(var p in s){var m=s[p];m.fitting.length>0&&o.expand(m.collection.columns)}return this.apiRequestService.updateItems(e,n,o.get()).then(function(r){var n=i.columnExpansionFactory.construct(e,o.get(),r.fetchColumnsObject());for(var c in t){var a=t[c],u=r.fetchObject(e,c);if(void 0!==u){var l=i.apiFormatter.copyFields(a.initial,{},a.columns.main);i.itemEntryService.setDerived(a,r.fetchDerivedObject(e,c,a.columns.root)),i.itemEntryService.updateFields(a,u),i.itemEntryService.callOnChange(a,l);var h=n.run(a.columns,!0);null!==h&&i.itemEntryService.expand(a,u,r.fetchDerivedObject(e,c,h.difference.root),h)}else console.warn("Update failed!",a)}i.collectionHandler.removeFromAndAddToCollections(s)},this.errorHandler.reject)},e.prototype.executeDeleteRequests=function(e){var t=[];for(var r in e)t.push(this.executeDeleteRequest(r,e[r]));return this.promiseService.all(t)},e.prototype.executeDeleteRequest=function(e,t){for(var r=this,i=[],n=0,o=t;n<o.length;n++){var s=o[n];i.push(s.itemId)}return this.apiRequestService.delete(e,i).then(function(e){for(var i=e.items,n={},o=0,s=t;o<s.length;o++){var a=s[o];c(a.itemId,i)||console.warn("Delete failed!",a),r.collectionHandler.expandCollectionMap(a,n)}r.collectionHandler.removeFromCollections(n,!0)},this.errorHandler.reject)},e.prototype.executeMoveRequests=function(e,t){var r=this,i=[];for(var n in e)for(var o in e[n])s(n,o);return this.promiseService.all(i);function s(n,o){var s=e[n][o],c=this.getMapValue(n,o,t);i.push(r.apiRequestService.moveItems(n,void 0!==c?c:o,this.buildMoveRequest(s)).then(function(e){r.processMoveResponse(e,s)},r.errorHandler.reject))}},e.prototype.processMoveResponse=function(e,t){for(var r=[],i={},n={},o=0,s=t;o<s.length;o++){var c=s[o],a=c.item;this.addCollectionMapEntry(i,c.parentId,a,a.itemId),this.addCollectionMapEntry(n,a.parent.itemId,a,a),r.push(a)}this.forEachCollection(i,"removeItems"),this.forEachCollection(n,"addItems")},e.prototype.addCollectionMapEntry=function(e,t,r,i){u(e,[r.parent.itemType,t,r.itemType],[{},{},[]]).push(i)},e.prototype.forEachCollection=function(e,t){for(var r in e)for(var i in e[r])for(var n in e[r][i])this.collectionHandler.entries.getByParent(r,i,n)[t](e[r][i][n],null,!0)},e.prototype.onItemsCreated=function(e,t,r){var i=this;if(o(e)){for(var n=0,s=r;n<s.length;n++){var c=s[n],a=c.parent,u=c.getUpdatedItemColumns(e);if(null!==a)void 0!==(p=this.getMapValue(a.itemType,a.itemId,e))&&(a.itemId=p),c.query=this.collectionEntryService.createQuery(c.options);o(u)&&(void 0!==u.id&&c.onItemsCreated(e[c.itemType]),c.forEach(function(t){i.itemEntryService.updateItemFields(t,e)}))}for(var l=0,h=t;l<h.length;l++){var p,m=h[l],d=m.parent;if(this.itemEntryService.updateItemFields(m,e),null!==d)void 0!==(p=this.getMapValue(d.itemType,d.itemId,e))&&(d.itemId=p)}}},e.prototype.executeRequests=function(e,t,r,i){var n=this,o=e.compilation,s=e.singleItems,c=e.collections,a={};return this.executeCreateRequests(o.create,t,a,r,i).then(function(){return n.onItemsCreated(a,s,c),n.executeMoveRequests(o.move,a)},function(e){return n.onItemsCreated(a,s,c),n.errorHandler.reject(e)}).then(function(){return n.executeDeleteRequests(o.delete)},this.errorHandler.reject).then(function(){return n.prioritizeUpdateRequests(o.update,t)},this.errorHandler.reject).then(function(){return a},this.errorHandler.reject)},e}(),K=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p){this.apiRequestService=e,this.errorHandler=t,this.itemHandler=r,this.collectionHandler=i,this.columnHandler=n,this.changesCompilerFactory=o,this.createRequestFactory=s,this.columnExpansionFactory=c,this.requestColumnExpansionFactory=a,this.collectionEntryService=u,this.itemEntryService=l,this.apiFormatter=h,this.promiseService=p}return e.prototype.construct=function(){return new X(this.apiRequestService,this.itemHandler,this.errorHandler,this.collectionHandler,this.columnHandler,this.changesCompilerFactory,this.createRequestFactory,this.columnExpansionFactory,this.requestColumnExpansionFactory,this.collectionEntryService,this.itemEntryService,this.apiFormatter,this.promiseService)},e}();!function(e){e.MAYBE="maybe"}(b||(b={}));var J,z,G=function(){function e(e){this.queryMatcherFactory=e,this.entries={}}return e.prototype.contains=function(e){for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){if(e===i[r])return!0}return!1},e.prototype.some=function(e){for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){if(e(i[r]))return!0}return!1},e.prototype.forEach=function(e){for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){e(i[r])}},e.prototype.toArray=function(){var e=[];for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){var n=i[r];e.push(n)}return e},e.prototype.add=function(e){var t=e.itemType;return void 0===this.entries[t]&&(this.entries[t]=[]),this.entries[t].push(e),e},e.prototype.clear=function(e){if(void 0===e)return this.entries={},!0;var t=e.itemType;if(void 0===this.entries[t])return!1;var r=this.entries[t].indexOf(e);return-1!==r&&(this.entries[t].splice(r,1),!0)},e.prototype.getByItemType=function(e){return void 0===this.entries[e]?[]:this.entries[e].slice()},e.prototype.getByParent=function(e,t,r){if(void 0===this.entries[r])return null;for(var i=0,n=this.entries[r];i<n.length;i++){var o=n[i];if(o.matchParent(e,t))return o}return null},e.prototype.getResourceByParent=function(e,t,r){var i=this.getByParent(e,t,r);return null===i?null:i.getCurrentResource()},e.prototype.getCollectionsByParent=function(e,t){var r=[];for(var i in this.entries)for(var n=0,o=this.entries[i];n<o.length;n++){var s=o[n];s.matchParent(e,t)&&r.push(s)}return r},e.prototype.getByContainingItem=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i=0,n=this.entries[e];i<n.length;i++){var o=n[i];void 0!==o.getItemById(t)&&r.push(o)}return r},e.prototype.getByFittingItem=function(e,t,r,i){var n=[],o=[],s=[],c={fitting:n,notfitting:s,maybe:o};if(void 0===this.entries[r])return c;for(var a=this.queryMatcherFactory.construct(e,t,i,r),u=0,l=this.entries[r];u<l.length;u++){var h=l[u],p=a.matchQuery(h.query.object);!0===p?n.push(h):p===b.MAYBE?o.push(h):s.push(h)}return c},e.prototype.getByQuery=function(e,t){if(void 0===this.entries[e])return null;for(var r=0,i=this.entries[e];r<i.length;r++){var n=i[r];if(n.query.string===t.string)return n}return null},e.prototype.getByKey=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i=0,n=this.entries[e];i<n.length;i++){var o=n[i];o.options.entryKey===t&&r.push(o)}return r},e.prototype.getResourceByKey=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i=0,n=this.entries[e];i<n.length;i++)for(var o=0,s=n[i].resources;o<s.length;o++){var c=s[o];null!==c&&(c.options.resourceKey===t&&r.push(c))}return r},e}(),Z=function(){function e(e){this.queryMatcherFactory=e}return e.prototype.construct=function(){return new G(this.queryMatcherFactory)},e}(),$=0,ee=function(){function e(e,t,r,i,n,o,s,c,a){this.errorHandler=e,this.collectionEntryService=t,this.itemRequestService=r,this.itemEntryService=i,this.keyService=n,this.queryService=o,this.promiseService=s,this.itemType=c,this.options=a,this.id=$++,this.parent=null,this.initial=[],this.items=[],this.resources=[],this.reloadQueued=!1,this.deferred=this.promiseService.defer(),this.promise=this.deferred.promise,this.itemType=c,this.parent=a.parent,this.query=t.createQuery(a)}return e.prototype.isDeferred=function(){return void 0!==this.promise},e.prototype.resolve=function(e){var t=this.deferred;return this.columns=e.columns,this.initial=e.items,this.items=e.items.slice(),delete this.deferred,delete this.promise,t.resolve(this),this},e.prototype.isLocal=function(){var e=this.parent;return null!==e&&this.keyService.isLocalId(e.itemId)},e.prototype.matchParent=function(e,t){var r=this.parent;return null!==r&&(r.itemType===e&&r.itemId==t)},e.prototype.forEach=function(e){for(var t=0,r=this.items;t<r.length;t++){e(r[t])}},e.prototype.getItemById=function(e){for(var t=0,r=this.items;t<r.length;t++){var i=r[t];if(i.itemId===e)return i}},e.prototype.getIdArray=function(e){return void 0===e&&(e=[]),this.collectionEntryService.getIdArray(this.items,e)},e.prototype.addItems=function(e,t,r,i){if(void 0===r&&(r=!1),void 0===i&&(i=!0),0===e.length)return[];var n=this.resources,o=this.parent,s=this.columns.link;if(r){for(var c=this.initial,a=[],u=0,l=e;u<l.length;u++){var h=l[u];-1===c.indexOf(h)&&(c.push(h),a.push(h))}if(a.length>0)for(var p=0,m=n;p<m.length;p++){(I=m[p]).options.onAddInitial(a,this)}}for(var d=this.items,f=[],v=0,y=e;v<y.length;v++){h=y[v];-1===d.indexOf(h)&&(null!==o&&(h.parent=o,null!==s&&void 0!==h.modified&&(h.modified[s.id]=o.itemId)),d.push(h),f.push(h))}if(f.length>0){for(var g=void 0,S=0,C=n;S<C.length;S++){var I,E=(I=C[S]).addItemResources(f);I===t?(g=E,i&&I.callOnAdd(E)):I.callOnAdd(E)}return g}return null===t?null:[]},e.prototype.removeItems=function(e,t,r,i){return 0===e.length?[]:this.handleRemovedItems(function(t){return c(t.itemId,e)},t,r,i)},e.prototype.clear=function(e,t,r){return this.handleRemovedItems(function(){return!1},e,t,r)},e.prototype.handleRemovedItems=function(e,t,r,i){void 0===i&&(i=!0);var n,o=this.resources,s=this.collectionEntryService.filterArray(this.items,e),c=r?this.collectionEntryService.filterArray(this.initial,e):[];if(c.length>0)for(var a=0,u=o;a<u.length;a++){(f=u[a]).options.onRemoveInitial(c,this)}if(0===s.length)return null===t?null:[];for(var l=0,h=s;l<h.length;l++){var p=h[l];this.itemEntryService.deactivateResources(p)}for(var m=0,d=o;m<d.length;m++){var f,v=(f=d[m]).removeItemResources(s);f===t?(n=v,i&&f.callOnRemove(v)):f.callOnRemove(v)}return n},e.prototype.expand=function(e){var t=this,r=this.itemType;return 0===e.length?this.promiseService.when(this):(this.promise=this.itemRequestService.requestItems(this,void 0,e).then(function(i){var n=i.items[r],o=t.itemRequestService.processExpansion(e,i,r,t.items);return t.handleRemovedItems.call(t,function(e){return void 0!==n[e.itemId]||t.itemEntryService.isLocal(e)},null,!0,!0),t.updateColumns(o),delete t.promise,t},this.errorHandler.reject),this.promise)},e.prototype.extendQuery=function(e){var t=this.options;return void 0===e?this.query:(t.queryParams=e(t.queryParams),this.query=this.collectionEntryService.createQuery(t))},e.prototype.extend=function(e,t,r,i){var n=this,o=this.extendQuery(e).object,s=this.queryService.addAndCondition(o,this.queryService.createNotIn(this.getIdArray())),c=this.itemRequestService.requestItems(this,null!==this.options.limit?o:s).then(function(e){return n.itemRequestService.processResponse(e,e.links[n.itemType],n.parent,n.columns)},this.errorHandler.reject).then(function(e){return delete n.promise,n.addItems(e,t,i,r)},this.errorHandler.reject);return this.promise=c.then(function(){return n},this.errorHandler.reject),c},e.prototype.queueReload=function(){this.reloadQueued=!0,this.deferred=this.promiseService.defer(),this.promise=this.deferred.promise},e.prototype.updateColumns=function(e){var t=e.run(this.columns,!1);this.options.columns=t.request,this.columns=t},e.prototype.getAddedItems=function(e){void 0===e&&(e=!1);for(var t=this.initial,r=[],i=0,n=this.items;i<n.length;i++){var o=n[i];-1===t.indexOf(o)&&r.push(e?o.itemId:o)}return r},e.prototype.getRemovedItems=function(e){void 0===e&&(e=!1);for(var t=this.initial,r=this.items,i=[],n=0,o=t;n<o.length;n++){var s=o[n];-1===r.indexOf(s)&&i.push(e?s.itemId:s)}return i},e.prototype.getUpdatedItems=function(){for(var e=[],t=0,r=this.items;t<r.length;t++){var i=r[t];!this.itemEntryService.isLocal(i)&&this.itemEntryService.hasChanges(i)&&e.push(i)}return e},e.prototype.hasAddedItems=function(){return this.items.length>this.initial.length},e.prototype.hasRemovedItems=function(){return this.initial.length>this.items.length},e.prototype.hasUpdatedItems=function(){for(var e=0,t=this.items;e<t.length;e++){var r=t[e];if(this.itemEntryService.hasChanges(r))return!0}return!1},e.prototype.getCurrentResource=function(){var e=this.resources;return e[e.length-1]},e.prototype.clearResources=function(e){void 0===e&&(e=!1);for(var t=this.items,r=this.resources,i=[],n=0,o=t;n<o.length;n++){var s=o[n];this.itemEntryService.clearResources(s)}for(var c=0,a=r;c<a.length;c++){var u=a[c];if(!u.options[e?"clearOnSubTabChange":"clearOnTabChange"]){i.push(u);for(var l=0,h=u.items;l<h.length;l++){var p=h[l];p.entry.resources.push(p)}}}this.resources=i},e.prototype.revertChanges=function(){for(var e=this.resources,t=this.getRemovedItems(),r=this.getAddedItems(!0),i=0,n=e;i<n.length;i++){var o=n[i];o.addItemResources(t),o.removeItemResources(r)}this.items=this.initial.slice()},e.prototype.onItemsCreated=function(e){for(var t=0,r=this.resources;t<r.length;t++){var i=r[t];i.rebuildMap(),i.options.onItemsCreated(e)}},e.prototype.getUpdatedItemColumns=function(e){for(var t={},r=0,i=this.columns.item;r<i.length;r++){var n=i[r];void 0!==e[n.apiColumn.itemType]&&(t[n.id]=n)}return t},e}(),te=function(){function e(e,t,r,i,n,o,s){this.errorHandler=e,this.collectionEntryService=t,this.itemRequestService=r,this.itemEntryService=i,this.keyService=n,this.queryService=o,this.promiseService=s}return e.prototype.construct=function(e,t){return t=this.collectionEntryService.processOptions(t),new ee(this.errorHandler,this.collectionEntryService,this.itemRequestService,this.itemEntryService,this.keyService,this.queryService,this.promiseService,e,t)},e}(),re=function(){function e(e,t,r){this.itemResourceFactory=e,this.entry=t,this.options=r,this.itemIdMap={},this.columns=t.columns.response,this.itemIdMap={},this.items=[],t.resources.push(this),this.addItemResources(t.items)}return e.prototype.getItemById=function(e){return this.itemIdMap[e]},e.prototype.rebuildMap=function(){for(var e={},t=0,r=this.items;t<r.length;t++){var i=r[t];e[i.entry.itemId]=i}this.itemIdMap=e},e.prototype.addItemResources=function(e){if(0===e.length)return[];for(var t=[],r=this.options,i=this.items,n=this.itemIdMap,o=this.itemResourceFactory.getConstructor({edit:r.editItems,onChange:r.onChange,onDeactivate:r.onDeactivateItem}),s=0,c=e;s<c.length;s++){var a=c[s],u=a.itemId,l=void 0;void 0===n[u]?(l=o(a),i.push(l),n[u]=l):l=n[u],t.push(l)}return t},e.prototype.removeItemResources=function(e){var t=this,r=[];return function(e,t){for(var r=[],i=0,n=e;i<n.length;i++){var o=n[i];t(o)&&r.push(o)}if(r.length===e.length)return!1;e.splice(0);for(var s=0,c=r;s<c.length;s++){var a=c[s];e.push(a)}}(this.items,function(i){for(var n=0,o=e;n<o.length;n++){var s=o[n];if(i.entry===s)return r.push(i),delete t.itemIdMap[s.itemId],!1}return!0}),r},e.prototype.callOnAdd=function(e){this.options.onAdd(e,this)},e.prototype.callOnRemove=function(e){this.options.onRemove(e,this)},e.prototype.forEach=function(e){for(var t=0,r=this.items;t<r.length;t++){e(r[t])}},e.prototype.filter=function(e){for(var t=[],r=0,i=this.items;r<i.length;r++){var n=i[r];e(n)&&t.push(n)}return t},e.prototype.first=function(e){for(var t=0,r=this.items;t<r.length;t++){var i=r[t];if(e(i))return i}return null},e.prototype.some=function(e){return null!==this.first(e)},e.prototype.groupBy=function(e){var t=this.items,r={};if("string"==typeof e)for(var i=0,n=t;i<n.length;i++){void 0===r[a=(c=n[i]).fields[e]]&&(r[a]=[]),r[a].push(c)}if("function"==typeof e)for(var o=0,s=t;o<s.length;o++){var c,a;null!==(a=e(c=s[o]))&&(void 0===r[a]&&(r[a]=[]),r[a].push(c))}return r},e.prototype.map=function(e){var t=this.items,r=t.length,i=new Array(r);if("string"==typeof e)for(var n=0;n<r;n++)i[n]=t[n].fields[e];if("function"==typeof e)for(n=0;n<r;n++)i[n]=e(t[n]);return i},e.prototype.reduce=function(e,t){for(var r=0,i=this.items;r<i.length;r++){t=e(i[r],t)}return t},e.prototype.extend=function(e,t,r){var i=this;return void 0===r&&(r=!0),this.entry.extend(e,this,r).then(function(e){return t?i.items:e})},e.prototype.deactivate=function(){this.options.onDeactivateCollection(this)},e.prototype.clearResource=function(){var e=this.entry.resources,t=this.items,r=e.indexOf(this);-1!==r&&e.splice(r,1);for(var i=0,n=t;i<n.length;i++){n[i].clearResource()}},e}(),ie=(J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}J(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),ne=function(e){function t(t,r,i,n,o,s,c,a){var u=e.call(this,i,c,a)||this;return u.errorHandler=t,u.itemHandler=r,u.changesProcessorFactory=n,u.keyService=o,u.promiseService=s,u}return ie(t,e),t.prototype.save=function(){if(!this.options.enableSave)throw new Error("collectionResourceService: Saving disabled");var e=this.entry,t=e.parent;return null!==t&&this.keyService.isLocalId(t.itemId)?this.promiseService.when():this.changesProcessorFactory.construct().execute([],[e])},t.prototype.moveItems=function(e,t,r){var i=this.entry,n=this.options;if(n.enableSave||n.modInstant)throw new Error("collectionResourceService: Cannot move items: saving enabled");if(i.itemType!==t.entry.itemType)throw new Error("collectionResourceService: Cannot move items: itemType mismatch");for(var o=i.removeItems(e,this,!1,r),s=[],c=0,a=o;c<a.length;c++){var u=a[c];s.push(u.entry)}return t.entry.addItems(s,t,!1,r),o},t.prototype.removeItems=function(e,t){var r=this;void 0===t&&(t=!0);var i=this.entry.removeItems(e,this,!1,!1);return this.options.modInstant?this.save().then(function(){return t&&r.callOnRemove(i),i}):(t&&this.callOnRemove(i),this.promiseService.when(i))},t.prototype.removeItem=function(e,t){return this.removeItems([e],t).then(function(e){return e[0]},this.errorHandler.reject)},t.prototype.addItems=function(e,t){var r=this;return void 0===t&&(t=!0),this.itemHandler.fetchTemplate(this.entry.itemType).then(function(i){for(var n,o=[],s=0,c=e;s<c.length;s++){var a=c[s];o.push(r.itemHandler.createLocalEntry(r.keyService.getLocalId(),i,a.fields,a.derived))}return n=r.entry.addItems(o,r,!1,!1),r.options.modInstant?r.save().then(function(e){return t&&r.callOnAdd(n),n},r.errorHandler.reject):(t&&r.callOnAdd(n),n)},this.errorHandler.reject)},t.prototype.addItem=function(e,t){return this.addItems([e],t).then(function(e){return e[0]},this.errorHandler.reject)},t.prototype.clear=function(e){return this.entry.clear(this,!1,e)},t}(re),oe=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),se=function(e){function t(t,r,i,n,o,s,c,a){var u=e.call(this,i,c,a)||this;return u.errorHandler=t,u.itemHandler=r,u.changesProcessorFactory=n,u.keyService=o,u.promiseService=s,u}return oe(t,e),t}(re),ce=function(){function e(e,t,r,i,n,o,s){this.errorHandler=e,this.itemHandler=t,this.itemResourceFactory=r,this.changesProcessorFactory=i,this.keyService=n,this.promiseService=o,this.collectionResourceService=s}return e.prototype.construct=function(e,t){return new((t=this.collectionResourceService.processOptions(t)).editCollection?ne:se)(this.errorHandler,this.itemHandler,this.itemResourceFactory,this.changesProcessorFactory,this.keyService,this.promiseService,e,t)},e}(),ae=function(){function e(e,t,r,i,n,o){if(this.columnHandler=e,this.columnSetFactory=t,this.columnUtil=r,this.itemType=i,this.requestColumns=n,this.responseColumns=o,this.expansionMap={},!0===n)for(var s in this.requestColumnsTrue=!0,this.requestColumns=[],o[i])this.requestColumns.push(s);else this.requestColumnsTrue=!1}return e.prototype.run=function(e,t){var r=e.id;return void 0!==this.expansionMap[r]?t?this.expansionMap[r]:this.expansionMap[r].merged:this.columnUtil.isColumnSubset(this.requestColumns,e.request,e.true)?t?null:e:(this.expansionMap[r]=this.expandColumnInfo(e),t?this.expansionMap[r]:this.expansionMap[r].merged)},e.prototype.expandColumnInfo=function(e){var t=this.columnUtil.mergeRequestColumns(e.request,this.requestColumns),r=this.columnUtil.mergeResponseColumns(e.response,this.responseColumns).merged,i=this.columnSetFactory.construct(this.itemType,t.merged,r),n=this.columnSetFactory.construct(this.itemType,t.difference,r,!1,!1);return i.true=this.requestColumnsTrue||e.true,{merged:i,difference:n}},e}(),ue=function(){function e(e,t,r){this.columnHandler=e,this.columnSetFactory=t,this.columnUtil=r}return e.prototype.construct=function(e,t,r){return new ae(this.columnHandler,this.columnSetFactory,this.columnUtil,e,t,r)},e}(),le=0,he=function(){function e(e,t,r,i,n,o,s){void 0===o&&(o=!0),void 0===s&&(s=!0),this.columnHandler=e,this.columnUtil=t,this.itemType=r,this.requestColumns=i,this.responseColumns=n,this.enableCaching=o,this.includeIdColumn=s,this.id=++le,this.link=null,this.main=[],this.derived=[],this.root=[],this.leaf=[],this.formatted={main:[],derived:[]},this.filtered=[],this.custom=[],this.searchable=[],this.item=[],this.notItem=[],this.request=[],this.response={},this.true=!0===i,!0===i?this.processResponseColumns():this.processRequestColumns()}return e.prototype.processResponseColumns=function(){for(var e in this.request=[],this.response=this.enableCaching?this.columnHandler.setColumns(this.itemType,!0,this.responseColumns):this.responseColumns,this.responseColumns[this.itemType])this.main.push(this.getColumnInfo(this.responseColumns[this.itemType][e],[],null)),this.request.push(e)},e.prototype.processRequestColumns=function(){if(this.request=this.requestColumns,this.response={},0!==this.requestColumns.length){for(var e=0,t=this.requestColumns;e<t.length;e++){var r=t[e],i=this.getRequestColumnInfo(r,this.itemType,null);null!==i&&(this.main.push(i),i.isLeaf||this.root.push(i))}this.includeIdColumn&&void 0===this.response[this.itemType].id&&this.main.push(this.getRequestColumnInfo("id",this.itemType,null))}},e.prototype.getRequestColumnInfo=function(e,t,r){var i,n=this.columnUtil.parseRequestColumn(e),o=n.id;if(void 0!==this.responseColumns[t]&&(i=this.responseColumns[t][o]),void 0===i)return console.warn("No api column for request column",o,"for itemType",t),null;this.enableCaching&&(i=this.columnHandler.setColumn(t,i));var s=this.response;return void 0===s[t]&&(s[t]={}),void 0===s[t][o]&&(s[t][o]=i),this.getColumnInfo(i,n.children,r)},e.prototype.getColumnInfo=function(e,t,r){var i=null!==r,n=e.id,o={id:n,path:i?r.path.concat(">",n):n,apiColumn:e,level:i?r.level+1:0,isLeaf:0===t.length,itemType:"",children:[],parent:null,tailPath:null};if(i?(this.derived.push(o),o.parent=r,o.tailPath=r.level>0?r.tailPath.concat(">",n):n):this[this.columnUtil.isItemColumn(e)?"item":"notItem"].push(o),this.columnUtil.isFormattedColumn(e)&&this.formatted[i?"derived":"main"].push(o),this.columnUtil.isFilteredColumn(e)&&this.filtered.push(o),this.columnUtil.isSearchableColumn(e)&&this.searchable.push(o),this.columnUtil.isCustomColumn(e)&&this.custom.push(o),"link"===e.type&&(this.link=e),0===t.length)return this.leaf.push(o),o;void 0===e.itemType&&console.warn("itemType undefined in column",e),o.itemType=e.itemType,o.children=[];for(var s=0,c=t;s<c.length;s++){var a=c[s],u=this.getRequestColumnInfo(a,o.itemType,o);null!==u&&o.children.push(u)}return o},e}(),pe=function(){function e(e,t){this.columnHandler=e,this.columnUtil=t}return e.prototype.construct=function(e,t,r,i,n){return void 0===i&&(i=!0),void 0===n&&(n=!0),new he(this.columnHandler,this.columnUtil,e,t,r,i,n)},e}(),me=function(){function e(e,t,r,i,n,o,s){void 0===s&&(s=!1),this.collectionHandler=e,this.requestColumnExpansionFactory=t,this.itemEntryService=r,this.keyService=i,this.compilation=n,this.parameterMap=o,this.breakupByParent=s,this.requests=[]}return e.prototype.finalizeRequest=function(e){var t=e.collections,r=e.columns;for(var i in t){var n=t[i];n.fitting.length>0&&r.expand(n.collection.columns)}return e.request.columns=r.get(),e},e.prototype.setRequestParent=function(e,t){var r=t.request;return"Void"!==e&&(r.parentType=e,r.parentId={},!0)},e.prototype.run=function(){if(this.breakupByParent)for(var e in this.compilation){var t=this.compilation[e];for(var r in t)if(!this.keyService.isLocalId(r)){var i=this.initializeRequest();this.extendRequest(t[r],this.setRequestParent(e,i)?r:null,i),this.requests.push(this.finalizeRequest(i))}}else for(var e in this.compilation){t=this.compilation[e],i=this.initializeRequest();var n=this.setRequestParent(e,i),o=!1;for(var r in t)this.keyService.isLocalId(r)||(this.extendRequest(t[r],n?r:null,i),o=!0);o&&this.requests.push(this.finalizeRequest(i))}return this.requests},e.prototype.initializeRequest=function(){return{request:{requestType:"create",items:{}},columns:this.requestColumnExpansionFactory.construct(),items:{},collections:{}}},e.prototype.extendRequest=function(e,t,r){var i=r.request,n=r.items;for(var o in e)for(var s in void 0===i.itemType&&(i.itemType=o),void 0===n[o]&&(n[o]={},i.items[o]={}),e[o]){var c=e[o][s],a=l(this.compilation,[o,s]),u=i.items[o][s]={},h=l(this.parameterMap,[o,s]),p=void 0;if(null!==t&&(i.parentId[s]=t),r.columns.expand(c.columns),this.collectionHandler.expandCollectionMap(c,r.collections),n[o][s]=c,u.values=this.itemEntryService.formatRequest(c),u.parameters=h,void 0!==a){for(var m in p=u.links={},a)for(var d in p[m]=[],a[m])p[m].push(d);this.extendRequest(a,null,r)}}},e}(),de=function(){function e(e,t,r,i){this.collectionHandler=e,this.requestColumnExpansionFactory=t,this.itemEntryService=r,this.keyService=i}return e.prototype.construct=function(e,t,r){return void 0===r&&(r=!1),new me(this.collectionHandler,this.requestColumnExpansionFactory,this.itemEntryService,this.keyService,e,t,r)},e}(),fe=function(){function e(e,t){this.queryMatcherFactory=e,this.itemEntryService=t,this.entries={}}return e.prototype.some=function(e){for(var t in this.entries)for(var r in this.entries[t])if(e(this.entries[t][r]))return!0;return!1},e.prototype.getByItemType=function(e){var t=[];if(void 0===this.entries[e])return t;for(var r in this.entries[e])t.push(this.entries[e][r]);return t},e.prototype.getByQuery=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i in this.entries[e]){var n=this.entries[e][i];this.matchQuery(n,t)&&r.push(n)}return r},e.prototype.getLocalByQuery=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i in this.entries[e]){var n=this.entries[e][i];this.itemEntryService.isLocal(n)&&(this.matchQuery(n,t)&&r.push(n))}return r},e.prototype.forEach=function(e){for(var t in this.entries)for(var r in this.entries[t])e(this.entries[t][r])},e.prototype.toArray=function(){var e=[];for(var t in this.entries)for(var r in this.entries[t])e.push(this.entries[t][r]);return e},e.prototype.add=function(e){var t=e.itemType;return void 0===this.entries[t]&&(this.entries[t]={}),this.entries[t][e.itemId]=e},e.prototype.get=function(e,t){return void 0===this.entries[e]?void 0:this.entries[e][t]},e.prototype.getByParent=function(e,t,r){var i=[];if(void 0===this.entries[r])return i;for(var n in this.entries[r]){var o=this.entries[r][n],s=o.parent;null!==s&&(e===s.itemType&&t==s.itemId&&i.push(o))}return i},e.prototype.contains=function(e,t){return void 0!==this.entries[e]&&void 0!==this.entries[e][t]},e.prototype.updateItemId=function(e,t){var r=this.entries[e.itemType];return delete r[t],r[e.itemId]=e},e.prototype.clear=function(e){return void 0===e?(this.entries={},!0):void 0!==this.entries[e.itemType]&&delete this.entries[e.itemType][e.itemId]},e.prototype.matchQuery=function(e,t){var r=null!==e.parent?e.parent:{};return!0===this.queryMatcherFactory.construct(r.itemType,r.itemId,this.itemEntryService.getFields(e)).matchQuery(t.object)},e}(),ve=function(){function e(e,t){this.queryMatcherFactory=e,this.itemEntryService=t}return e.prototype.construct=function(){return new fe(this.queryMatcherFactory,this.itemEntryService)},e}(),ye=0,ge=function(){return function(e,t,r,i,n,o){void 0===n&&(n={}),void 0===o&&(o=[]),this.itemType=e,this.itemId=t,this.columns=r,this.initial=i,this.derived=n,this.resources=o,this.id=++ye,this.parent=null,this.deferRequest=!1}}(),Se=function(){function e(){}return e.prototype.construct=function(e,t,r,i,n,o){return new ge(e,t,r,i,n,o)},e}(),Ce=function(){function e(e,t,r){this.itemEntryService=e,this.entry=t,this.options=r,this.derived=t.derived,this.columns=t.columns.response[t.columns.itemType],t.resources.push(this)}return e.prototype.isNewResource=function(e){return this.itemEntryService.isLocal(e.entry)&&void 0===e.transactions},e.prototype.isLocal=function(){return this.itemEntryService.isLocal(this.entry)},e.prototype.clearResource=function(){var e=this.entry.resources,t=e.indexOf(this);-1!==t&&e.splice(t,1)},e.prototype.deactivate=function(){this.options.onDeactivate(this)},e}(),Ie=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),Ee=function(e){function t(t,r,i,n,o,s,c,a,u){var l=e.call(this,t,r,i)||this;return l.apiFormatter=n,l.lockService=o,l.changesProcessor=s,l.collectionHandler=c,l.errorHandler=a,l.promiseService=u,l.localCopies=[],t.setModified(r),l.fields=r.modified,l}return Ie(t,e),t.prototype.start=function(){void 0===this.localCopies&&(this.localCopies=[]),this.localCopies.push(this.copyFields())},t.prototype.rollback=function(){var e=this.entry;this.apiFormatter.copyFields(this.localCopies.pop(),e.modified,e.columns.main),this.isNewResource(this)&&0===this.localCopies.length&&this.deactivate()},t.prototype.commit=function(e){e||this.localCopies.pop(),void 0===this.transactions&&(this.transactions=0),this.transactions++},t.prototype.getLocalCopy=function(){var e=this.localCopies;return void 0===e?null:0===e.length?null:e[e.length-1]},t.prototype.copyFields=function(e){var t=this.entry;return void 0===e&&(e={}),this.apiFormatter.copyFields(t.modified,e,t.columns.main)},t.prototype.setFields=function(e,t){var r=this.columns,i=this.fields;for(var n in void 0===t&&(t=!0),t&&this.copyFields(),e){var o=r[n];void 0!==o?this.apiFormatter.compareFields(o.type,i[n],e[n])||(i[n]=e[n],this.hasChanges=!0):console.warn("setFields: no column found for",n)}return this},t.prototype.callOnChange=function(e){this.itemEntryService.callOnChange(this.entry,e)},t.prototype.save=function(e){var t=this,r=this.entry,i={};return void 0!==e&&u(i,[r.itemType,r.itemId],[{},e]),(this.itemEntryService.isLockable(r)?this.lockService.fetchLock(r):this.promiseService.when()).then(function(e){return t.changesProcessor.execute([r],[],!1,i)},this.errorHandler.reject).then(function(){return t},this.errorHandler.reject)},t.prototype.saveLocal=function(){var e=this.entry;return this.itemEntryService.setDisplayName(e),this.collectionHandler.addItemsToCollections([e]),this.promiseService.when(this)},t}(Ce),Re=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),qe=function(e){function t(t,r,i){var n=e.call(this,t,r,i)||this;return n.fields=void 0===r.modified?r.initial:r.modified,n}return Re(t,e),t}(Ce),Fe=function(){function e(e,t,r,i,n,o,s,c){this.itemEntryService=e,this.itemResourceService=t,this.apiFormatter=r,this.lockService=i,this.changesProcessor=n,this.collectionHandler=o,this.errorHandler=s,this.promiseService=c}return e.prototype.getConstructor=function(e){var t=this;return e=this.itemResourceService.processOptions(e),function(r){return e.edit?new Ee(t.itemEntryService,r,e,t.apiFormatter,t.lockService,t.changesProcessor,t.collectionHandler,t.errorHandler,t.promiseService):new qe(t.itemEntryService,r,e)}},e.prototype.construct=function(e,t){return(t=this.itemResourceService.processOptions(t)).edit?new Ee(this.itemEntryService,e,t,this.apiFormatter,this.lockService,this.changesProcessor,this.collectionHandler,this.errorHandler,this.promiseService):new qe(this.itemEntryService,e,t)},e}(),be={},Oe=function(){function e(e,t,r,i){this.itemEntryService=e,this.rootItemEntry=t,this.singleItemCache=r,this.collectionCache=i,this.parentMap={},this.destination={}}return e.prototype.process=function(){return this.parentMap=this.createParentMap(this.singleItemCache),this.processItems(this.rootItemEntry.itemType,[this.rootItemEntry],{}),{itemType:this.rootItemEntry.itemType,itemId:this.rootItemEntry.itemId,items:this.destination}},e.prototype.createParentMap=function(e){var t={};return e.forEach(function(e){var r=e.itemType,i=e.parent;if(null!==i){var n=i.itemType,o=i.itemId;void 0===t[n]&&(t[n]={});var s=t[n];void 0===s[o]&&(s[o]={}),void 0===(s=s[o])[r]&&(s[r]=[]),s[r].push(e)}}),t},e.prototype.processItems=function(e,t,r){void 0===this.destination[e]&&(this.destination[e]={}),void 0===r[e]&&(r[e]=[]);for(var i=0,n=t;i<n.length;i++){var o=n[i],s=o.itemId;void 0===this.destination[e][s]&&(r[e].push(s),this.destination[e][s]=this.processItem(o))}},e.prototype.processItem=function(e){var t=e.itemType,r=e.itemId,i=this.getItemsByParent(t,r),n=this.collectionCache.getCollectionsByParent(t,r),s=this.itemEntryService.formatRequest(e),c={};for(var a in i)this.processItems(a,i[a],c);for(var u=0,l=n;u<l.length;u++){var h=l[u];null===h.options.query&&this.processItems(h.itemType,h.items,c)}var p=o(s),m=o(c);return p&&m?{values:s,links:c}:p?{values:s}:m?{links:c}:be},e.prototype.getItemsByParent=function(e,t){var r=this.parentMap[e];return void 0===r?{}:void 0===r[t]?{}:r[t]},e}(),He=function(){function e(e){this.itemEntryService=e}return e.prototype.construct=function(e,t,r){return new Oe(this.itemEntryService,e,t,r)},e}(),Te="maybe",ke=function(){function e(e,t,r,i,n){this.apiFormatter=e,this.parentType=t,this.parentId=r,this.fields=i,this.itemType=n}return e.prototype.compareValues=function(e,t){return i.isMoment(t)?this.apiFormatter.compareMomentObjects(t,e):i.isDuration(t)?this.apiFormatter.compareDurations(t,e):t==e},e.prototype.matchQuery=function(e){if(void 0!==e.search)return Te;if(void 0!==e.custom)return Te;if(void 0!==e.linkedTo)return this.matchLinkedToQuery(e);if(void 0!==e.conditions)return this.matchComplexQuery(e);if(void 0!==e.key)return this.matchSimpleQuery(this.fields[e.key],e);if(!o(e))return!0;throw new Error("queryMatcher: Unsupported query! Parsed?")},e.prototype.matchLinkedToQuery=function(e){return e.reverse?Te:(t=e.linkedTo===this.parentType&&this.matchSimpleQuery(this.parentId,e.query))===Te?Te:e.not?!t:t;var t},e.prototype.matchComplexQuery=function(e){var t,r,i=e.conditions;switch(e.operator){case"AND":t=!0,r=!1;break;case"OR":t=!1,r=!0;break;default:throw new Error("queryMatcher: Unsupported operator")}for(var n=0,o=i;n<o.length;n++){var s=o[n],c=this.matchQuery(s);if(c===r)return r;c===Te&&(t=Te)}return t},e.prototype.matchSimpleQuery=function(e,t){var r=t.key,n=t.value;if(!o(t))return!0;if(void 0===e)return console.warn("Required field",r,"not found for",this.itemType),Te;switch("NOW"===n&&(n=i()),t.comparator){case"=":return this.compareValues(e,n);case"!=":return!this.compareValues(e,n);case"<":return e<n;case"<=":return e<=n;case">":return e>n;case">=":return e>=n;case"IN":return c(e,n);case"NOT IN":return!c(e,n);default:throw new Error("queryMatcher: Unsupported comparator: "+t.comparator+" in query "+t)}},e}(),Me=function(){function e(e){this.apiFormatter=e}return e.prototype.construct=function(e,t,r,i){return new ke(this.apiFormatter,e,t,r,i)},e}();!function(e){e[e.OBJ=0]="OBJ",e[e.STR=1]="STR",e.SEP=":"}(z||(z={}));var je=function(){function e(e,t){this.query=e,this.parameters=t}return e.prototype.processValue=function(e){return Array.isArray(e)?e.slice().sort():i.isMoment(e)?i(e):i.isDuration(e)?i.duration(e):e},e.prototype.compareParsedQueries=function(e,t){return e[z.STR]===t[z.STR]?0:e[z.STR]>t[z.STR]?1:-1},e.prototype.parse=function(e){if(void 0===e&&(e=this.query),void 0!==e.linkedTo)return this.parseLinkedToQuery(e.linkedTo,e.query,e.reverse,e.not);if(void 0!==e.not)throw new Error('queryParser: "Not" not supported');if(void 0!==e.custom)return this.parseCustomQuery(e.custom,e.parameters);if(void 0!==e.search)return this.parseSearchQuery(e.search);if(void 0!==e.conditions)return this.parseComplexQuery(e.conditions,e.operator);if(void 0!==e.key)return this.parseSimpleQuery(e.key,e.value,e.comparator);if(!o(e))return[{},"{}"];var t=s(e);return this.parseSimpleQuery(t,e[t])},e.prototype.parseSearchQuery=function(e){return[{search:(e=this.formatValue(e))[z.OBJ]},"[search"+z.SEP+e[z.STR]+"]"]},e.prototype.parseCustomQuery=function(e,t){if(void 0===t)return[{custom:e},"["+e+"]"];var r=this.parseCustomParameters(t);return[{custom:e,parameters:r[z.OBJ]},"["+e+z.SEP+r[z.STR]+"]"]},e.prototype.parseCustomParameters=function(e){for(var t=Object.keys(e).sort(),r={},i="",n=0;n<t.length;n++){var o=t[n],s=this.formatValue(e[o]);r[o]=s[z.OBJ],n>0&&(i+=z.SEP),i+=s[z.STR]}return[r,i]},e.prototype.parseSimpleQuery=function(e,t,r){return t=this.formatValue(t),void 0===r&&(r=Array.isArray(t[z.OBJ])?"IN":"="),[{key:e,value:t[z.OBJ],comparator:r},"["+r+z.SEP+e+z.SEP+t[z.STR]+"]"]},e.prototype.parseLinkedToQuery=function(e,t,r,i){void 0===t&&(t={}),void 0===r&&(r=!1),void 0===i&&(i=!1);var n=this.parse(t);return[{linkedTo:e,query:n[z.OBJ],reverse:r,not:i},"[linkedTo"+z.SEP+e+z.SEP+n[z.STR]+z.SEP+r+z.SEP+i+"]"]},e.prototype.parseComplexQuery=function(e,t){t=void 0===t?"AND":t.toUpperCase();var r=this.parseConditions(e);return[{conditions:r[z.OBJ],operator:t},"["+t+r[z.STR]+"]"]},e.prototype.parseConditions=function(e){for(var t=this,r=[],i=[],n="",o=0,s=e;o<s.length;o++){var c=s[o];r.push(this.parse(c))}for(var a=0,u=r=r.sort(function(e,r){return t.compareParsedQueries(e,r)});a<u.length;a++){var l=u[a];i.push(l[z.OBJ]),n+=l[z.STR]}return[i,n]},e.prototype.formatValue=function(e){var t;if("string"==typeof e&&"&"===e.charAt(0)){var r=e.substring(1);if(void 0===(e=this.parameters[r]))throw new Error("queryParser: Undefined template parameter '"+r+"'");return[t=this.processValue(e),r+">"+e]}return[t=this.processValue(e),""+t]},e}(),we=function(){function e(){}return e.prototype.construct=function(e,t){return new je(e,t)},e}(),De=function(){function e(e){this.columnUtil=e,this.columns={},this.columnInfoIdMap={}}return e.prototype.expand=function(e){if(!this.columnInfoIdMap[e.id]){var t=e.itemType;void 0===this.columns[t]&&(this.columns[t]=[]),this.columns[t]=this.columnUtil.mergeRequestColumns(this.columns[t],e.request).merged,this.columnInfoIdMap[e.id]=!0}},e.prototype.get=function(){return this.columns},e}(),xe=function(){function e(e){this.columnUtil=e}return e.prototype.construct=function(){return new De(this.columnUtil)},e}(),Le=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m){this.apiRequestService=e,this.errorHandler=t,this.itemHandler=r,this.collectionHandler=i,this.columnHandler=n,this.lockService=o,this.itemResourceFactory=s,this.collectionCacheFactory=c,this.changesProcessorFactory=a,this.itemCacheFactory=u,this.collectionResourceFactory=l,this.itemEntryService=h,this.itemResourceService=p,this.promiseService=m,this.collectionOptions={},this.tabRequestParameters={},this.callbacks={onBeforeSave:{},onSaveSuccess:{},onSaveWithoutClosing:{}},this.changesInterval=null,this.hasChanges=!1,this.collections=this.collectionCacheFactory.construct(),this.deferredCollections=this.collectionCacheFactory.construct(),this.items=this.itemCacheFactory.construct()}return e.prototype.addSingleItem=function(e,t,r){var i=this;return r&&(this.rootItem=e),this.items.contains(e.itemType,e.itemId)||this.items.add(e),(t=this.itemResourceService.processOptions(t)).onDeactivate=function(e){return i.clearItem(e)},this.itemResourceFactory.construct(e,t)},e.prototype.addCollection=function(e,t){var r=this;this.collections.contains(e)||this.collections.add(e);var i=e.id;if(void 0===this.collectionOptions[i])this.collectionOptions[i]={edit:t.editCollection,editItems:t.editItems};else{var n=this.collectionOptions[i];n.edit=n.edit||t.editCollection,n.editItems=n.editItems||t.editItems}return t.onDeactivateItem=function(e){return r.clearItem(e)},t.onDeactivateCollection=function(e){return r.clearCollection(e)},this.collectionResourceFactory.construct(e,t)},e.prototype.clearCollection=function(e){var t=e.entry;this.collections.clear(t),t.clearResources()},e.prototype.clearItem=function(e){var t=e.entry;this.items.clear(t),this.itemEntryService.clearResources(t)},e.prototype.clearResources=function(e){var t=this;void 0===e&&(e=!1),this.items.forEach(function(e){t.itemEntryService.clearResources(e)}),this.collections.forEach(function(t){t.clearResources(e)}),e||this.collections.clear()},e.prototype.updateSingleItems=function(e){for(var t in e)for(var r in e[t]){var i=this.items.get(t,r);void 0!==i&&this.items.updateItemId(i,r)}},e.prototype.revertChanges=function(){var e=this;return this.items.forEach(function(t){return e.itemEntryService.resetModified(t)}),this.collections.forEach(function(t){return e.resetCollection(t)}),this.hasChanges=!1,this.isLockable()?this.lockService.deleteLock(this.rootItem):this.promiseService.when()},e.prototype.resetCollection=function(e){var t=this.collectionOptions[e.id];if(t.edit&&e.revertChanges(),t.editItems)for(var r=0,i=e.items;r<i.length;r++){var n=i[r];this.itemEntryService.resetModified(n)}},e.prototype._hasChanges=function(){return this.hasChanges||(this.hasChanges=this.detectChanges()),this.hasChanges},e.prototype.detectChanges=function(){var e=this;return!!this.items.some(function(t){return e.itemEntryService.hasChanges(t)})||this.collections.some(function(t){e.collectionHasChanges(t)})},e.prototype.collectionHasChanges=function(e){var t=this.collectionOptions[e.id];return!(!t.edit||!e.hasAddedItems()&&!e.hasRemovedItems())||t.editItems&&e.hasUpdatedItems()},e.prototype.isLockable=function(){return void 0!==this.rootItem&&this.itemEntryService.isLockable(this.rootItem)},e.prototype.save=function(e,t,r,i){var n=this;return void 0===e&&(e=!1),(this.isLockable()?this.lockService.fetchLock(this.rootItem):this.promiseService.when()).then(function(t){return n.executeCallbacks("onBeforeSave",e)},this.errorHandler.reject).then(function(){var e=p({},n.tabRequestParameters,t);return n.tabRequestParameters={},n.changesProcessorFactory.construct().execute(n.items.toArray(),n.collections.toArray(),r,e,n.collectionOptions,i)},this.errorHandler.reject).then(function(t){return n.isLockable()&&n.lockService.clearLock(n.rootItem),n.hasChanges=!1,e||n.updateSingleItems(t),n.executeCallbacks("onSaveSuccess",t).then(function(){return e||n.executeCallbacks("onSaveWithoutClosing",t,!0),t},n.errorHandler.reject)},this.errorHandler.reject)},e.prototype.executeCallbacks=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var i={};for(var n in this.callbacks[e])i[n]=this.callbacks[e][n].apply(void 0,t);return this.promiseService.all(i)},e.prototype.enableChangesWatcher=function(){var e=this;null!==this.changesInterval&&(console.warn("Changes watcher already running!",this),this.disableChangesWatcher()),this.changesInterval=setInterval(function(){e.hasChanges&&(e.disableChangesWatcher(),e.isLockable()&&e.lockService.fetchLock(e.rootItem))},3e3)},e.prototype.enableWatcher=function(){this.enableChangesWatcher()},e.prototype.disableChangesWatcher=function(){clearInterval(this.changesInterval),this.changesInterval=null},e.prototype.disableWatcher=function(){this.disableChangesWatcher()},e.prototype.registerCallback=function(e,t,r){var i=this;return this.callbacks[e][t]=r,function(){delete i.callbacks[e][t]}},e}(),Pe=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m){this.apiRequestService=e,this.errorHandler=t,this.itemHandler=r,this.collectionHandler=i,this.columnHandler=n,this.lockService=o,this.itemResourceFactory=s,this.collectionCacheFactory=c,this.changesProcessorFactory=a,this.itemCacheFactory=u,this.collectionResourceFactory=l,this.itemEntryService=h,this.itemResourceService=p,this.promiseService=m}return e.prototype.construct=function(){return new Le(this.apiRequestService,this.errorHandler,this.itemHandler,this.collectionHandler,this.columnHandler,this.lockService,this.itemResourceFactory,this.collectionCacheFactory,this.changesProcessorFactory,this.itemCacheFactory,this.collectionResourceFactory,this.itemEntryService,this.itemResourceService,this.promiseService)},e}();r.d(t,"noop",function(){return Ue}),r.d(t,"identity",function(){return _e});var Ae=function(){return function(e,t,r,i,n){this.version="1.0.28",this.apiFormatter=new R,this.keyService=new P,this.queryService=new U,this.columnUtil=new M,this.apiResponseProcessorFactory=new N(this.apiFormatter),this.apiRequestService=new q(e,this.apiResponseProcessorFactory),this.itemEntryService=new w(this.apiFormatter,this.keyService,n),this.itemResourceService=new L,this.lockService=new A(this.apiRequestService,i,this.keyService,n),this.queryMatcherFactory=new Me(this.apiFormatter),this.itemCacheFactory=new ve(this.queryMatcherFactory,this.itemEntryService),this.batchStatusFactory=new Q(n),this.columnCache=new T(this.columnUtil),this.columnHandler=new k(this.apiRequestService,i,n,this.columnCache,this.columnUtil),this.columnSetFactory=new pe(this.columnHandler,this.columnUtil),this.columnExpansionFactory=new ue(this.columnHandler,this.columnSetFactory,this.columnUtil),this.itemEntryFactory=new Se,this.itemHandler=new D(this.apiRequestService,r,i,this.itemEntryFactory,this.columnHandler,this.itemCacheFactory,this.batchStatusFactory,this.columnExpansionFactory,this.columnSetFactory,this.itemEntryService,this.apiFormatter,this.keyService,n,this.columnUtil),this.itemRequestService=new x(this.apiRequestService,i,this.itemHandler,this.columnHandler,this.columnExpansionFactory,this.columnSetFactory,this.itemEntryService,this.queryService,n),this.queryParserFactory=new we,this.collectionEntryService=new F(this.queryParserFactory,this.queryService),this.collectionResourceService=new H,this.collectionEntryFactory=new te(i,this.collectionEntryService,this.itemRequestService,this.itemEntryService,this.keyService,this.queryService,n),this.collectionCacheFactory=new Z(this.queryMatcherFactory),this.collectionHandler=new O(i,this.itemRequestService,this.itemHandler,this.columnHandler,this.collectionEntryFactory,this.collectionCacheFactory,this.queryParserFactory,this.collectionEntryService,this.columnSetFactory,this.itemEntryService,this.keyService,n,this.queryService,this.columnUtil),this.requestColumnExpansionFactory=new xe(this.columnUtil),this.createRequestFactory=new de(this.collectionHandler,this.requestColumnExpansionFactory,this.itemEntryService,this.keyService),this.changesCompilerFactory=new W(this.itemEntryService),this.changesProcessorFactory=new K(this.apiRequestService,i,this.itemHandler,this.collectionHandler,this.columnHandler,this.changesCompilerFactory,this.createRequestFactory,this.columnExpansionFactory,this.requestColumnExpansionFactory,this.collectionEntryService,this.itemEntryService,this.apiFormatter,n),this.itemResourceFactory=new Fe(this.itemEntryService,this.itemResourceService,this.apiFormatter,this.lockService,this.changesProcessorFactory.construct(),this.collectionHandler,i,n),this.collectionResourceFactory=new ce(i,this.itemHandler,this.itemResourceFactory,this.changesProcessorFactory,this.keyService,n,this.collectionResourceService),this.localCacheFactory=new Pe(this.apiRequestService,i,this.itemHandler,this.collectionHandler,this.columnHandler,this.lockService,this.itemResourceFactory,this.collectionCacheFactory,this.changesProcessorFactory,this.itemCacheFactory,this.collectionResourceFactory,this.itemEntryService,this.itemResourceService,n),this.moduleChangesCompilerFactory=new He(this.itemEntryService),this.itemAdministrator=new j(this.apiRequestService,t,r,i,this.itemHandler,this.collectionHandler,this.columnSetFactory,this.itemRequestService,this.localCacheFactory,this.moduleChangesCompilerFactory,this.collectionEntryService,this.collectionResourceService,this.itemEntryService,this.keyService,this.queryService),this.socketMessageHandler=new _(n,this.apiRequestService,this.itemHandler,this.itemEntryService,this.collectionHandler,this.columnSetFactory,this.columnExpansionFactory,this.requestColumnExpansionFactory,this.apiFormatter,i)}}();t.default=Ae;function Ue(){}function _e(e){return e}}])});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("moment")):"function"==typeof define&&define.amd?define(["moment"],t):"object"==typeof exports?exports.RmCore=t(require("moment")):e.RmCore=t(e.moment)}(window,function(e){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var i=r(0);function n(e,t){if(void 0===e)return t;var r={};for(var i in t)r[i]=void 0===e[i]?t[i]:e[i];return r}function o(e){for(var t in e)return!0;return!1}function s(e){if("object"!=typeof e)return null;for(var t in e)return t;return null}function c(e,t){for(var r=0,i=t;r<i.length;r++){if(e==i[r])return!0}return!1}function a(e,t){for(var r=[],i=0,n=e;i<n.length;i++){var o=n[i];t(o)&&r.push(o)}if(r.length===e.length)return!1;u(e);for(var s=0,c=r;s<c.length;s++){var a=c[s];e.push(a)}return!0}function u(e){e.splice(0)}function l(e,t){if(void 0===e)return!1;for(var r=0,i=t;r<i.length;r++){var n=i[r];if(void 0===e[n])return!1;e=e[n]}return!0}function h(e,t,r){for(var i=0;i<t.length;i++){var n=t[i];void 0===e[n]&&(e[n]=r[i]),e=e[n]}return e}function p(e,t,r){if(void 0===r&&(r=!1),void 0!==e){for(var i=0,n=t;i<n.length;i++){if(void 0===(e=e[n[i]])&&!r)return}return e}}function m(e,t,r){for(var i=0,n=t.length;i<n;++i){var o=t[i];if(v(o)||E(o))for(var s=Object.keys(o),c=0,a=s.length;c<a;c++){var u=s[c],l=o[u];r&&v(l)?S(l)?e[u]=new Date(l.valueOf()):R(l)?e[u]=new RegExp(l):l.nodeName?e[u]=l.cloneNode(!0):q(l)?e[u]=l.clone():(v(e[u])||(e[u]=I(l)?[]:{}),m(e[u],[l],!0)):e[u]=l}}return e}function d(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return m(e,t,!1)}function f(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return m(e,t,!0)}function v(e){return null!==e&&"object"==typeof e}function y(e){return null!==e&&"object"==typeof e&&!Object.getPrototypeOf(e)}function g(e){return"string"==typeof e}function C(e){return"number"==typeof e}function S(e){return"[object Date]"===toString.call(e)}var I=Array.isArray;function E(e){return"function"==typeof e}function R(e){return"[object RegExp]"===toString.call(e)}function F(e){return"boolean"==typeof e}function q(e){return!(!e||!(e.nodeName||e.prop&&e.attr&&e.find))}function b(e){return e&&e.window===e}function O(e){return void 0!==e}function H(e,t){if(e===t)return!0;if(null===e||null===t)return!1;if(e!=e&&t!=t)return!0;var r,i,n,o,s,c=typeof e;if(c===typeof t&&"object"===c){if(!I(e)){if(S(e))return!!S(t)&&(o=e.getTime(),s=t.getTime(),o===s||o!=o&&s!=s);if(R(e))return!!R(t)&&e.toString()===t.toString();if(b(e)||b(t)||I(t)||S(t)||R(t))return!1;for(i in n=Object.create(null),e)if(!E(e[i])){if(!H(e[i],t[i]))return!1;n[i]=!0}for(i in t)if(!(i in n)&&O(t[i])&&!E(t[i]))return!1;return!0}if(!I(t))return!1;if(r=e.length,e.length===t.length){for(i=0;i<r;i++)if(!H(e[i],t[i]))return!1;return!0}}return!1}function T(e,t,r){var i=[],n=[];if(r=function(e){return C(e)&&e>0}(r)?r:NaN,t){if(e===t)throw new Error("Can't copy! Source and destination are identical.");if(I(t))t.length=0;else for(var o in t)delete t[o];return i.push(e),n.push(t),s(e,t,r)}return c(e,r);function s(e,t,r){if(--r<0)return"...";if(I(e))for(var i=0,n=e.length;i<n;i++)t.push(c(e[i],r));else if(y(e))for(var o in e)t[o]=c(e[o],r);else if(e&&"function"==typeof e.hasOwnProperty)for(var o in e)e.hasOwnProperty(o)&&(t[o]=c(e[o],r));else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=c(e[o],r));return t}function c(e,t){if(void 0===t&&(t=5),!v(e))return e;var r=i.indexOf(e);if(-1!==r)return n[r];if(b(e))throw new Error("Can't copy! Making copies of Window instances is not supported.");var o=!1,a=function(e){switch(toString.call(e)){case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Float32Array]":case"[object Float64Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return new e.constructor(c(e.buffer),e.byteOffset,e.length);case"[object ArrayBuffer]":if(!e.slice){var t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}return e.slice(0);case"[object Boolean]":case"[object Number]":case"[object String]":case"[object Date]":return new e.constructor(e.valueOf());case"[object RegExp]":var r=new RegExp(e._source,e.toString().match(/[^/]*$/)[0]);return r.lastIndex=e.lastIndex,r;case"[object Blob]":return new e.constructor([e],{type:e.type})}if(E(e.cloneNode))return e.cloneNode(!0)}(e);return void 0===a&&(a=I(e)?[]:Object.create(Object.getPrototypeOf(e)),o=!0),i.push(e),n.push(a),o?s(e,a,t):a}}var k,M=function(){function e(){this.MOMENT_INVALID="Invalid date",this.SERVER_DATETIME_FORMAT="YYYY-MM-DD[T]HH:mm:ssZ",this.SERVER_TIME_FORMAT="HH:mm:ss",this.SERVER_DATE_FORMAT="YYYY-MM-DD"}return e.prototype.formatResponse=function(e,t){for(var r=0,i=t;r<i.length;r++){var n=i[r];e[n.path]=this.formatResponseValue(n.apiColumn.type,e[n.path])}},e.prototype.expandResponse=function(e,t,r){for(var i=0,n=r;i<n.length;i++){var o=n[i];e[o.path]=this.formatResponseValue(o.apiColumn.type,t[o.path])}},e.prototype.formatRequest=function(e,t,r){for(var i={},n=0,o=r;n<o.length;n++){var s=o[n],c=s.id,a=s.apiColumn;a.readOnly||(this.compareFields(a.type,e[c],t[c])||(i[c]=this.formatRequestValue(s.apiColumn.type,t[c])))}return i},e.prototype.hasChanges=function(e,t,r){for(var i=0,n=r;i<n.length;i++){var o=n[i],s=o.id,c=o.apiColumn;if(!c.readOnly&&!this.compareFields(c.type,e[s],t[s]))return!0}return!1},e.prototype.getChanges=function(e,t,r){for(var i=[],n=0,o=r;n<o.length;n++){var s=o[n],c=s.id,a=s.apiColumn;a.readOnly||(this.compareFields(a.type,e[c],t[c])||i.push({oldValue:e[c],newValue:t[c],column:s.apiColumn}))}return i},e.prototype.copyFields=function(e,t,r){for(var i=0,n=r;i<n.length;i++){var o=n[i],s=o.path;t[s]=this.clone(o.apiColumn.type,e[s])}return t},e.prototype.shallowCopyFields=function(e,t,r,i){for(var n=0,o=i;n<o.length;n++){var s=o[n],c=s.path;r[c]=void 0!==e[c]?e[c]:this.clone(s.apiColumn.type,t[c])}return r},e.prototype.setDefaultValues=function(e,t){for(var r=0,i=t;r<i.length;r++){var n=i[r];e[n.id]=this.getDefaultValue(n.apiColumn.type)}return e},e.prototype.compareFields=function(e,t,r){if(void 0===t)return void 0===r;if(void 0===r)return!1;switch(e){case"date":case"time":case"datetime":return this.compareMomentObjects(t,r);case"duration":return this.compareDurations(t,r);case"id":case"item":case"link":case"child":case"sibling":return t==r;case"current":case"dimension":case"distance":case"double":case"filesize":case"number":case"power":case"quantity":case"volume":case"weight":case"coordinate":case"price":case"percentage":return this.compareFloats(t,r);case"int":case"bool":case"enum":case"email":case"phone":case"url":case"text":case"longtext":case"color":return t===r;default:return H(t,r)}},e.prototype.compareFloats=function(e,t){var r=Math.abs(e),i=Math.abs(t),n=Math.abs(e-t);return e===t||(0===e||0===t||n<Number.MIN_VALUE?n<1.19e-7*Number.MIN_VALUE:n/Math.min(r+i,Number.MAX_VALUE)<1.19e-7)},e.prototype.compareMomentObjects=function(e,t){return e.isValid()?!!t.isValid()&&e.isSame(t):!t.isValid()},e.prototype.compareDurations=function(e,t){return e.asMilliseconds()===t.asMilliseconds()},e.prototype.formatResponseValue=function(e,t){switch(e){case"datetime":case"date":return this.formatResponseDate(t);case"color":return this.formatResponseColor(t);case"duration":return this.formatResponseDuration(t);case"json":return"string"==typeof t&&""!==t?JSON.parse(t):t;case"number":return 0===t?null:t;case"filesize":return t/1e6;default:return t}},e.prototype.formatRequestValue=function(e,t){switch(e){case"datetime":return this.formatRequestDateTime(t);case"date":return this.formatRequestDate(t);case"color":return this.formatRequestColor(t);case"duration":return this.formatRequestDuration(t);case"number":return 0===t?null:t;default:return t}},e.prototype.formatResponseDate=function(e){return null===e?i.invalid():i(e)},e.prototype.formatResponseDuration=function(e){return i.duration(null===e?0:e,"seconds")},e.prototype.formatResponseColor=function(e){return"#"===e.charAt(0)?e:"#"+e},e.prototype.formatRequestDateTime=function(e){return e.isValid()?e.format(this.SERVER_DATETIME_FORMAT):null},e.prototype.formatRequestDate=function(e){return e.isValid()?e.format(this.SERVER_DATE_FORMAT):null},e.prototype.formatRequestDuration=function(e){return e.asSeconds()},e.prototype.formatRequestColor=function(e){return"#"===e.charAt(0)?e.substring(1):e},e.prototype.getDefaultValue=function(e){switch(e){case"int":case"double":case"percentage":case"price":return 0;case"item":case"link":case"child":case"sibling":return null;case"bool":return!1;case"enum":return"0";case"date":case"datetime":case"time":return i.invalid();case"duration":return i.duration();case"text":case"longtext":return"";case"color":return"#000000";default:return""}},e.prototype.isDefaultValue=function(e,t){return this.compareFields(e,t,this.getDefaultValue(e))},e.prototype.clone=function(e,t){switch(e){case"duration":return this.cloneDuration(t);case"date":case"datetime":return i(t);case"json":return T(t);default:return t}},e.prototype.getCloneFunction=function(e){switch(e){case"duration":return this.cloneDuration;case"date":case"datetime":return this.cloneDate;default:return this.identity}},e.prototype.cloneDuration=function(e){return i.duration(e)},e.prototype.cloneDate=function(e){return e.clone()},e.prototype.identity=function(e){return e},e}(),w=function(){function e(e,t){this.externalApiRequestService=e,this.apiResponseProcessorFactory=t}return e.prototype.template=function(e,t){return this.processResponse(this.externalApiRequestService.template(e,t))},e.prototype.create=function(e,t,r,i,n){return this.processResponse(this.externalApiRequestService.create(e,t,r,i,n))},e.prototype.delete=function(e,t){return this.processResponse(this.externalApiRequestService.delete(e,t))},e.prototype.updateItems=function(e,t,r){return this.processResponse(this.externalApiRequestService.updateItems(e,t,r))},e.prototype.requestSkeleton=function(e,t){return this.processResponse(this.externalApiRequestService.requestSkeleton(e,t))},e.prototype.moveItems=function(e,t,r){return this.processResponse(this.externalApiRequestService.moveItems(e,t,r))},e.prototype.columns=function(e,t,r){return this.processResponse(this.externalApiRequestService.columns(e,t,r))},e.prototype.query=function(e,t,r,i,n){return this.processResponse(this.externalApiRequestService.query(e,t,r,i,n))},e.prototype.processResponse=function(e){var t=this;return e.then(function(e){return t.apiResponseProcessorFactory.construct(e)})},e}(),j=function(){function e(e,t){this.apiFormatter=e,this.response=t,this.columnIndexMap={},this.columnMap={},this.columns=t.columns,this.items=t.items,this.links=t.links,this.cacheable=t.cacheable,this.map=t.map,this.createColumnMaps()}return e.prototype.createColumnMaps=function(){for(var e in this.columns){this.columnIndexMap[e]={},this.columnMap[e]={};for(var t=0;t<this.columns[e].length;t++){var r=this.columns[e][t];this.columnIndexMap[e][r.id]=t,this.columnMap[e][r.id]=r}}},e.prototype.fetchValue=function(e,t,r){if(void 0!==this.items[e][t])return this.items[e][t].data[this.columnIndexMap[e][r]]},e.prototype.fetchDerivedObject=function(e,t,r){for(var i={},n=0,o=r;n<o.length;n++){var s=o[n];this.fetchDerivedValues(this.fetchValue(e,t,s.id),s,i)}return i},e.prototype.fetchDerivedValues=function(e,t,r){for(var i=0,n=t.children;i<n.length;i++){var o=n[i],s=void 0;null===e?(s=null,r[o.path]=this.apiFormatter.getDefaultValue(o.apiColumn.type)):(s=this.fetchValue(t.itemType,e,o.id),r[o.path]=s),o.isLeaf||this.fetchDerivedValues(s,o,r)}},e.prototype.fetchObject=function(e,t,r){if((void 0===r&&(r=!1),void 0!==this.items[e])&&void 0!==this.items[e][t]){for(var i=this.items[e][t].data,n={},o=0;o<i.length;o++)n[this.columns[e][o].id]=i[o];if(r){var s=this.items[e][t].links;for(var c in n.__links={},s)n.__links[c]=this.fetchObjectArray(c,r,s[c])}return n}},e.prototype.fetchObjectArray=function(e,t,r){var i=[];if(null===r){for(var n in this.items[e])i.push(this.fetchObject(e,n,t));return i}void 0===r&&(r=this.links[e]);for(var o=0;o<r.length;o++)i.push(this.fetchObject(e,r[o],t));return i},e.prototype.fetchObjectMap=function(e,t,r,i){var n=this.columnIndexMap[e][t],o={},s=[];for(var c in this.items[e]){var a=this.items[e][c].data[n];s.push(a),o[a]=this.fetchObject(e,c,r)}return i?{result:o,keys:s}:o},e.prototype.fetchFieldMap=function(e,t){var r=this.columnIndexMap[e][t],i={};for(var n in this.items[e])i[n]=this.items[e][n].data[r];return i},e.prototype.fetchColumnArray=function(e){for(var t=[],r=0;r<this.columns[e].length;r++)t.push(this.columns[e][r]);return t},e.prototype.fetchColumnObject=function(e){return this.columnMap[e]},e.prototype.fetchColumnsObject=function(){return this.columnMap},e.prototype.createResource=function(e,t){return{object:this.fetchObject(e,t),links:this.items[e][t].links}},e.prototype.hasItems=function(e){for(var t in this.items[e])return!0;return!1},e.prototype.getIdArray=function(e){var t=[];for(var r in this.items[e])t.push(r);return t},e}();!function(e){e.CACHED="cached",e.PROMISED="promised",e.EXPAND="expand",e.PROMISED_EXPAND="promised-expand",e.RESOLVE="resolve",e.LOCAL="local"}(k||(k={}));var x,D=function(){function e(e,t,r){for(var i in this.promiseService=e,this.getItemId=t,this.getPromise=r,this.entries={},k)this.entries[k[i]]=[]}return e.prototype.add=function(e){var t=e.status;void 0===this.entries[t]&&(this.entries[t]=[]),this.entries[t].push(e.entry)},e.prototype.hasEntries=function(e){for(var t=0,r=e;t<r.length;t++){var i=r[t];if(this.entries[i].length>0)return!0}return!1},e.prototype.hasRequests=function(){return this.hasEntries([k.RESOLVE,k.EXPAND,k.PROMISED_EXPAND])},e.prototype.forEachEntry=function(e,t){for(var r=0,i=e;r<i.length;r++)for(var n=i[r],o=0,s=this.entries[n];o<s.length;o++){t(s[o])}},e.prototype.getPromises=function(){var e=this,t=[];return this.forEachEntry([k.PROMISED,k.PROMISED_EXPAND],function(r){t.push(e.getPromise(r))}),this.promiseService.all(t)},e.prototype.getRequestIds=function(){var e=this,t=[];return this.forEachEntry([k.RESOLVE,k.EXPAND,k.PROMISED_EXPAND],function(r){t.push(e.getItemId(r))}),t},e.prototype.getArray=function(){var e=[];for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){var n=i[r];e.push(n)}return e},e}(),P=function(){function e(e,t,r,i){this.itemEntryService=e,this.singleItems=t,this.collections=r,this.collectionOptions=i,this.compilation={create:{},delete:{},update:{},move:{}},this.moveArray=[],this.deleteMap={},this.processSingleItems(),this.processCollections(),this.postProcess()}return e.prototype.getParent=function(e){return null!==e.parent?e.parent:{itemType:"Void",itemId:0}},e.prototype.addMoveEntry=function(e){this.moveArray.push(e)},e.prototype.addDeleteEntry=function(e,t,r){h(this.deleteMap,[e.itemType,e.itemId],[{},{parentId:t,item:e,parentType:r}])},e.prototype.addUpdateEntry=function(e){h(this.compilation.update,[e.itemType,e.itemId],[{},e])},e.prototype.addCreateEntry=function(e){var t=this.getParent(e);h(this.compilation.create,[t.itemType,t.itemId,e.itemType,e.itemId],[{},{},{},e])},e.prototype.postProcess=function(){for(var e=0,t=this.moveArray;e<t.length;e++){var r=(c=t[e]).itemId,i=this.deleteMap[c.itemType];if(void 0!==i&&void 0!==i[r]){var n=c.parent;(s=h(this.compilation.move,[n.itemType,n.itemId],[{},[]])).push(i[r]),delete i[r]}}for(var o in this.deleteMap)for(var r in this.deleteMap[o]){var s,c=this.deleteMap[o][r].item;void 0===(s=this.compilation.delete)[o]&&(s[o]=[]),s[o].push(c)}},e.prototype.processSingleItems=function(){for(var e=0,t=this.singleItems;e<t.length;e++){var r=t[e];this.itemEntryService.isLocal(r)?this.addCreateEntry(r):this.itemEntryService.hasChanges(r)&&this.addUpdateEntry(r)}},e.prototype.isEditableCollection=function(e){return void 0===this.collectionOptions||this.collectionOptions[e.id].edit},e.prototype.hasEditableItems=function(e){return void 0===this.collectionOptions||this.collectionOptions[e.id].editItems},e.prototype.processCollections=function(){for(var e=0,t=this.collections;e<t.length;e++){var r=t[e];if(!r.isDeferred()){var i=r.parent,n=null!==i?i.itemId:0;if(this.isEditableCollection(r)){var o=void 0,s=void 0;r.isLocal()?(o=r.items,s=[]):(o=r.getAddedItems(),s=r.getRemovedItems());for(var c=0,a=o;c<a.length;c++){var u=a[c];this.itemEntryService.isLocal(u)?this.addCreateEntry(u):this.addMoveEntry(u)}for(var l=0,h=s;l<h.length;l++){var p=h[l];this.addDeleteEntry(p,n,i.itemType)}}if(this.hasEditableItems(r))for(var m=0,d=r.getUpdatedItems();m<d.length;m++){var f=d[m];this.addUpdateEntry(f)}}}},e}(),L=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p){this.apiRequestService=e,this.itemHandler=t,this.errorHandler=r,this.collectionHandler=i,this.columnHandler=n,this.changesCompilerFactory=o,this.createRequestFactory=s,this.columnExpansionFactory=c,this.requestColumnExpansionFactory=a,this.collectionEntryService=u,this.itemEntryService=l,this.apiFormatter=h,this.promiseService=p}return e.prototype.getItemTypeUpdatePriority=function(e){switch(e){case"Factuurregelbedrag":return 0;case"Factuurregel":case"Minfactuur":return 1;default:return 2}},e.prototype.buildMoveRequest=function(e){for(var t={},r=0,i=e;r<i.length;r++){var n=i[r].item,o=n.itemType;void 0===t[o]&&(t[o]=[]),t[o].push(n.itemId)}return t},e.prototype.getMapValue=function(e,t,r){if(void 0!==r&&void 0!==r[e])return r[e][t]},e.prototype.execute=function(e,t,r,i,n,o){return void 0===r&&(r=!1),this.executeRequests(this.changesCompilerFactory.construct(e,t,n),i,r,o)},e.prototype.executeCreateRequests=function(e,t,r,i,n){for(var o=[],s=0,c=this.createRequestFactory.construct(e,t,i).run();s<c.length;s++){var a=c[s];o.push(this.executeCreateRequest(a,r).then(u))}return this.promiseService.all(o).then(function(){return r},this.errorHandler.reject);function u(e){return E(n)&&n(r),e}},e.prototype.executeCreateRequest=function(e,t){var r=this;return this.apiRequestService.requestSkeleton(e.request).then(function(i){var n=i.map,o=i.fetchColumnsObject(),s=e.items;for(var c in s){var a=r.columnExpansionFactory.construct(c,e.request.columns[c],o);for(var u in s[c]){var l=s[c][u],h=r.getMapValue(c,u,n);if(void 0!==h){r.itemHandler.updateItemId(l,h);var p=i.fetchObject(c,h),m=a.run(l.columns,!0);r.itemEntryService.updateFields(l,p),null!==m&&r.itemEntryService.expand(l,p,i.fetchDerivedObject(c,h,m.difference.root),m)}else console.warn("Create failed!",l)}}for(var c in r.collectionHandler.addToCollections(e.collections,!0),n)for(var u in void 0===t[c]&&(t[c]={}),n[c])t[c][u]=n[c][u]},this.errorHandler.reject)},e.prototype.prioritizeUpdateRequests=function(e,t){var r=[[],[],[]],i=this.promiseService.when();for(var n in e)r[this.getItemTypeUpdatePriority(n)].push(n);for(var o=0,s=r;o<s.length;o++){var c=s[o];0!==c.length&&(i=i.then(this.executeUpdateRequests(c,e,t),this.errorHandler.reject))}return i},e.prototype.executeUpdateRequests=function(e,t,r){var i=this;return function(){for(var n=[],o=0,s=e;o<s.length;o++){var c=s[o];n.push(i.executeUpdateRequest(c,t[c],r))}return i.promiseService.all(n)}},e.prototype.executeUpdateRequest=function(e,t,r){var i=this,n={},o=this.requestColumnExpansionFactory.construct(),s={};for(var c in n[e]={},t){var a=t[c],u=n[e][c]={},l=p(r,[e,c]);u.values=this.itemEntryService.formatRequest(a),void 0!==l&&(u.parameters=l),o.expand(a.columns),this.collectionHandler.expandCollectionMap(a,s)}for(var h in s){var m=s[h];m.fitting.length>0&&o.expand(m.collection.columns)}return this.apiRequestService.updateItems(e,n,o.get()).then(function(r){var n=i.columnExpansionFactory.construct(e,o.get(),r.fetchColumnsObject());for(var c in t){var a=t[c],u=r.fetchObject(e,c);if(void 0!==u){var l=i.apiFormatter.copyFields(a.initial,{},a.columns.main);i.itemEntryService.setDerived(a,r.fetchDerivedObject(e,c,a.columns.root)),i.itemEntryService.updateFields(a,u),i.itemEntryService.callOnChange(a,l);var h=n.run(a.columns,!0);null!==h&&i.itemEntryService.expand(a,u,r.fetchDerivedObject(e,c,h.difference.root),h)}else console.warn("Update failed!",a)}i.collectionHandler.removeFromAndAddToCollections(s)},this.errorHandler.reject)},e.prototype.executeDeleteRequests=function(e){var t=[];for(var r in e)t.push(this.executeDeleteRequest(r,e[r]));return this.promiseService.all(t)},e.prototype.executeDeleteRequest=function(e,t){for(var r=this,i=[],n=0,o=t;n<o.length;n++){var s=o[n];i.push(s.itemId)}return this.apiRequestService.delete(e,i).then(function(e){for(var i=e.items,n={},o=0,s=t;o<s.length;o++){var a=s[o];c(a.itemId,i)||console.warn("Delete failed!",a),r.collectionHandler.expandCollectionMap(a,n)}r.collectionHandler.removeFromCollections(n,!0)},this.errorHandler.reject)},e.prototype.executeMoveRequests=function(e,t){var r=this,i=[];for(var n in e)for(var o in e[n])s(n,o);return this.promiseService.all(i);function s(n,o){var s=e[n][o],c=this.getMapValue(n,o,t);i.push(r.apiRequestService.moveItems(n,void 0!==c?c:o,this.buildMoveRequest(s)).then(function(e){r.processMoveResponse(e,s)},r.errorHandler.reject))}},e.prototype.processMoveResponse=function(e,t){for(var r=[],i={},n={},o=0,s=t;o<s.length;o++){var c=s[o],a=c.item;this.addCollectionMapEntry(i,c.parentId,a,a.itemId),this.addCollectionMapEntry(n,a.parent.itemId,a,a),r.push(a)}this.forEachCollection(i,"removeItems"),this.forEachCollection(n,"addItems")},e.prototype.addCollectionMapEntry=function(e,t,r,i){h(e,[r.parent.itemType,t,r.itemType],[{},{},[]]).push(i)},e.prototype.forEachCollection=function(e,t){for(var r in e)for(var i in e[r])for(var n in e[r][i])this.collectionHandler.entries.getByParent(r,i,n)[t](e[r][i][n],null,!0)},e.prototype.onItemsCreated=function(e,t,r){var i=this;if(o(e)){for(var n=0,s=r;n<s.length;n++){var c=s[n],a=c.parent,u=c.getUpdatedItemColumns(e);if(null!==a)void 0!==(p=this.getMapValue(a.itemType,a.itemId,e))&&(a.itemId=p),c.query=this.collectionEntryService.createQuery(c.options);o(u)&&(void 0!==u.id&&c.onItemsCreated(e[c.itemType]),c.forEach(function(t){i.itemEntryService.updateItemFields(t,e)}))}for(var l=0,h=t;l<h.length;l++){var p,m=h[l],d=m.parent;if(this.itemEntryService.updateItemFields(m,e),null!==d)void 0!==(p=this.getMapValue(d.itemType,d.itemId,e))&&(d.itemId=p)}}},e.prototype.executeRequests=function(e,t,r,i){var n=this,o=e.compilation,s=e.singleItems,c=e.collections,a={};return this.executeCreateRequests(o.create,t,a,r,i).then(function(){return n.onItemsCreated(a,s,c),n.executeMoveRequests(o.move,a)},function(e){return n.onItemsCreated(a,s,c),n.errorHandler.reject(e)}).then(function(){return n.executeDeleteRequests(o.delete)},this.errorHandler.reject).then(function(){return n.prioritizeUpdateRequests(o.update,t)},this.errorHandler.reject).then(function(){return a},this.errorHandler.reject)},e}();!function(e){e.MAYBE="maybe"}(x||(x={}));var A,_=function(){function e(e){this.queryMatcherFactory=e,this.entries={}}return e.prototype.contains=function(e){for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){if(e===i[r])return!0}return!1},e.prototype.some=function(e){for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){if(e(i[r]))return!0}return!1},e.prototype.forEach=function(e){for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){e(i[r])}},e.prototype.toArray=function(){var e=[];for(var t in this.entries)for(var r=0,i=this.entries[t];r<i.length;r++){var n=i[r];e.push(n)}return e},e.prototype.add=function(e){var t=e.itemType;return void 0===this.entries[t]&&(this.entries[t]=[]),this.entries[t].push(e),e},e.prototype.clear=function(e){if(void 0===e)return this.entries={},!0;var t=e.itemType;if(void 0===this.entries[t])return!1;var r=this.entries[t].indexOf(e);return-1!==r&&(this.entries[t].splice(r,1),!0)},e.prototype.getByItemType=function(e){return void 0===this.entries[e]?[]:this.entries[e].slice()},e.prototype.getByParent=function(e,t,r){if(void 0===this.entries[r])return null;for(var i=0,n=this.entries[r];i<n.length;i++){var o=n[i];if(o.matchParent(e,t))return o}return null},e.prototype.getResourceByParent=function(e,t,r){var i=this.getByParent(e,t,r);return null===i?null:i.getCurrentResource()},e.prototype.getCollectionsByParent=function(e,t){var r=[];for(var i in this.entries)for(var n=0,o=this.entries[i];n<o.length;n++){var s=o[n];s.matchParent(e,t)&&r.push(s)}return r},e.prototype.getByContainingItem=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i=0,n=this.entries[e];i<n.length;i++){var o=n[i];void 0!==o.getItemById(t)&&r.push(o)}return r},e.prototype.getByFittingItem=function(e,t,r,i){var n=[],o=[],s=[],c={fitting:n,notfitting:s,maybe:o};if(void 0===this.entries[r])return c;for(var a=this.queryMatcherFactory.construct(e,t,i,r),u=0,l=this.entries[r];u<l.length;u++){var h=l[u],p=a.matchQuery(h.query.object);!0===p?n.push(h):p===x.MAYBE?o.push(h):s.push(h)}return c},e.prototype.getByQuery=function(e,t){if(void 0===this.entries[e])return null;for(var r=0,i=this.entries[e];r<i.length;r++){var n=i[r];if(n.query.string===t.string)return n}return null},e.prototype.getByKey=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i=0,n=this.entries[e];i<n.length;i++){var o=n[i];o.options.entryKey===t&&r.push(o)}return r},e.prototype.getResourceByKey=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i=0,n=this.entries[e];i<n.length;i++)for(var o=0,s=n[i].resources;o<s.length;o++){var c=s[o];null!==c&&(c.options.resourceKey===t&&r.push(c))}return r},e}(),U=function(){function e(e,t){this.queryParserFactory=e,this.queryService=t}return e.prototype.processOptions=function(e){return n(e,{columns:[],query:null,queryItemType:null,queryParams:{},parent:null,deferRequest:!1,limit:null,entryKey:"",addLocalItems:!1})},e.prototype.createQuery=function(e){var t,r=e.parent;if(null===r)t=e.query;else{var i={linkedTo:r.itemType,query:{id:"&parentId"}};e.queryParams.parentId=r.itemId,t=null===e.query?i:this.queryService.addAndCondition(e.query,i)}var n=this.queryParserFactory.construct(t,e.queryParams).parse();return{object:n[0],string:n[1]}},e.prototype.getIdArray=function(e,t){void 0===t&&(t=[]);for(var r=0,i=e;r<i.length;r++){var n=i[r];t.push(n.itemId)}return t},e.prototype.filterArray=function(e,t){for(var r=[],i=[],n=0,o=e;n<o.length;n++){var s=o[n];t(s)?r.push(s):i.push(s)}if(0===i.length)return i;e.length=r.length;for(var c=0;c<e.length;c++)e[c]=r[c];return i},e}(),V=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m){this.errorHandler=e,this.itemRequestService=t,this.itemHandler=r,this.columnHandler=i,this.collectionEntryFactory=n,this.collectionCacheFactory=o,this.queryParserFactory=s,this.collectionEntryService=c,this.columnSetFactory=a,this.itemEntryService=u,this.keyService=l,this.promiseService=h,this.queryService=p,this.columnUtil=m,this.entries=this.collectionCacheFactory.construct()}return e.prototype.getPromises=function(e){var t=e[k.PROMISED],r=e[k.PROMISED_EXPAND],i=[];for(var n in t)i.push(t[n]);for(var n in r)i.push(r[n]);return i},e.prototype.getRequestIds=function(e){var t=[];for(var r in e[k.RESOLVE])t.push(r);for(var r in e[k.EXPAND])t.push(r);return t},e.prototype.removeFromAndAddToCollections=function(e,t){for(var r in e){var i=e[r],n=i.collection;n.removeItems(i.notfitting,null,!0),n.addItems(i.fitting,null,!0),i.maybe.length>0&&n.extend(Ke,null,!0,t)}},e.prototype.removeFromCollections=function(e,t,r){var i;for(var n in void 0===r&&(r=null),e){for(var o=e[n],s=o.fitting,c=o.maybe,a=o.collection,u=[],l=0,h=s;l<h.length;l++){var p=h[l];u.push(p.itemId)}for(var m=0,d=c;m<d.length;m++){var f=d[m];u.push(f)}null!==r&&a===r.entry?i=a.removeItems(u,r,t):a.removeItems(u,null,t)}return i},e.prototype.addItemsToCollections=function(e){return this.addToCollections(this.createCollectionMap(e),!1)},e.prototype.addToCollections=function(e,t,r){var i;for(var n in void 0===r&&(r=null),e){var o=e[n],s=o.collection;s.isDeferred()||(null!==r&&s===r.entry?i=s.addItems(o.fitting,r,t):s.addItems(o.fitting,null,t),t&&o.maybe.length>0&&s.extend(Ke,null,!0,t))}return i},e.prototype.batchExpand=function(e,t,r,i){var n=this;if(0===i.length)return this.promiseService.when(r);var o=[],s=[];for(var c in r)o.push(c),s=s.concat(r[c].entry.items);return this.itemRequestService.requestLinkItems(e,o,t,null,i).then(function(e){for(var c=n.itemRequestService.processExpansion(i,e,t,s),a=0,u=o;a<u.length;a++){var l=u[a];r[l].entry.updateColumns(c)}return r})},e.prototype.batchExtend=function(e,t,r,i,n,s){var c=this;if(void 0===s&&(s=!1),!o(n))return this.promiseService.when({});var a=[],u=[];for(var l in r.queryParams=i(r.queryParams),n){var h=n[l].entry;h.extendQuery(i),a.push(l),u=u.concat(h.getIdArray())}return this.itemRequestService.requestLinkItems(e,a,t,this.queryService.addAndCondition(this.collectionEntryService.createQuery(r).object,this.queryService.createNotIn(u)),r.columns).then(function(i){return c.itemRequestService.processLinkResponse(i,e,a,t,r)},this.errorHandler.reject).then(function(e){for(var t={},r=0,i=a;r<i.length;r++){var o=i[r],c=n[o],u=c.entry.addItems(e.items[o],c);t[o]=s?c.items:u}return t},this.errorHandler.reject)},e.prototype.batchFetch=function(e,t,r,i,n){var s=this,c=this.createStatusResource(e,t,r,i,n);return this.promiseService.all(this.getPromises(c)).then(function(){var t=s.getRequestIds(c);return t.length>0?s.itemRequestService.requestLinkItems(e,t,r,null===i.query?null:s.queryParserFactory.construct(i.query,i.queryParams).parse()[0],i.columns).then(function(n){return s.itemRequestService.processLinkResponse(n,e,t,r,i)},s.errorHandler.reject).then(function(e){return s.handleBatchResponse(c,e)},s.errorHandler.reject):o(c[k.LOCAL])?s.columnHandler.fetch(r,i.columns).then(function(e){return s.handleBatchResponse(c,{columns:s.columnSetFactory.construct(r,i.columns,e,!1)})},s.errorHandler.reject):c[k.CACHED]},this.errorHandler.reject)},e.prototype.clone=function(e,t,r){void 0===r&&(r={});var i=e.itemType,n=e.items,o=[];void 0===r[i]&&(r[i]={});for(var s=r[i],c=0,a=n;c<a.length;c++){s[a[c].itemId]=this.keyService.getLocalId()}for(var u=0,l=n;u<l.length;u++){var h=l[u],p=this.itemHandler.cloneItem(s[h.itemId],h,r);null!==t.parent&&(p.parent=t.parent),o.push(p)}return this.create(i,t,e.columns,o)},e.prototype.create=function(e,t,r,i){return this.entries.add(this.collectionEntryFactory.construct(e,t)).resolve({columns:r,items:i})},e.prototype.createCollectionMap=function(e){for(var t={},r=0,i=e;r<i.length;r++){var n=i[r];this.expandCollectionMap(n,t)}return t},e.prototype.createStatusResource=function(e,t,r,i,n){var o={};for(var s in k)o[k[s]]={};for(var c=0,a=t;c<a.length;c++){var u,l=a[c],h=this.collectionEntryService.processOptions(i);h.parent={itemType:e,itemId:l},o[(u=this.getEntryStatus(r,h,n)).status][l]=u.entry}return o},e.prototype.expandCollectionMap=function(e,t,r){void 0===r&&(r=this.entries);var i=null!==e.parent?e.parent:{},n=r.getByFittingItem(i.itemType,i.itemId,e.itemType,this.itemEntryService.getFields(e));for(var o in n)for(var s=0,c=n[o];s<c.length;s++){var a=c[s],u=a.id;void 0===t[u]&&(t[u]={collection:a,fitting:[],notfitting:[],maybe:[]}),t[u][o].push("fitting"===o?e:e.itemId)}},e.prototype.fetch=function(e,t,r,i){var n=this.getEntryStatus(e,t,i),o=n.entry;switch(n.status){case k.CACHED:return this.promiseService.when(o);case k.PROMISED:return o.promise;case k.EXPAND:return o.expand(t.columns);case k.PROMISED_EXPAND:return o.promise.then(function(){return o.expand(t.columns)},this.errorHandler.reject);case k.RESOLVE:return this.resolveRemote(o,r);case k.LOCAL:return this.resolveLocal(o,r)}},e.prototype.getDeferredEntryStatus=function(e,t){var r=e.options,i=r.columns,n=!1;return e.reloadQueued?(e.reloadQueued=!1,r.columns=this.columnUtil.mergeRequestColumns(t.columns,i).merged,{entry:e,status:e.isLocal()?k.LOCAL:k.RESOLVE}):(!0===i?(console.warn("Columns: true for collections is deprecated!"),n=!0):n=this.columnUtil.isColumnSubset(t.columns,i,!1),{entry:e,status:n?k.PROMISED:k.PROMISED_EXPAND})},e.prototype.getEntryStatus=function(e,t,r){var i=this.collectionEntryService.createQuery(t),n=this.entries.getByQuery(e,i);return null===n?this.getNewEntryStatus(e,i,t,r):n.isDeferred()?this.getDeferredEntryStatus(n,t):{entry:n,status:this.columnUtil.isColumnSubset(t.columns,n.columns.request,n.columns.true)?k.CACHED:k.EXPAND}},e.prototype.getNewEntryStatus=function(e,t,r,i){var n,o;if(r.deferRequest){if(null===(n=i.getByQuery(e,t)))return{entry:i.add(this.collectionEntryFactory.construct(e,r)),status:k.PROMISED};(o=n.options).columns=this.columnUtil.mergeRequestColumns(o.columns,r.columns).merged}else n=this.collectionEntryFactory.construct(e,r);return this.entries.add(n),{entry:n,status:n.isLocal()?k.LOCAL:k.RESOLVE}},e.prototype.handleBatchResponse=function(e,t){var r={};for(var i in e.cached)r[i]=e.cached[i];for(var i in e.resolve)r[i]=e.resolve[i].resolve({items:t.items[i],columns:t.columns});for(var i in e.expand){(n=e.expand[i]).updateColumns(t.columnExpansion),r[i]=n}for(var i in e.local){var n=e.local[i];r[i]=n.resolve({items:this.itemHandler.entries.getByParent(n.parent.itemType,i,n.itemType),columns:t.columns})}return r},e.prototype.removeItemsFromAndAddItemsToCollections=function(e){return this.removeFromAndAddToCollections(this.createCollectionMap(e),!1)},e.prototype.removeItemsFromCollections=function(e){return this.removeFromCollections(this.createCollectionMap(e),!1)},e.prototype.resolveLocal=function(e,t){var r=this,i=e.itemType,n=e.options.columns;return this.columnHandler.fetch(i,n).then(function(o){return e.resolve({items:t.getByQuery(i,e.query),columns:r.columnSetFactory.construct(i,n,o,!1)})},this.errorHandler.reject)},e.prototype.resolveRemote=function(e,t){var r,i=this,n=e.itemType,o=e.options;return this.itemRequestService.requestItems(e).then(function(t){return r=i.columnSetFactory.construct(n,o.columns,t.fetchColumnsObject()),i.itemRequestService.processResponse(t,t.links[n],e.parent,r)},this.errorHandler.reject).then(function(i){return e.resolve({items:i.concat(o.addLocalItems?t.getLocalByQuery(n,e.query):[]),columns:r})},this.errorHandler.reject)},e}(),N=function(){function e(){}return e.prototype.processOptions=function(e){return n(e,{editItems:!1,editCollection:!1,modInstant:!1,enableSave:!0,onItemsCreated:Xe,onChange:Xe,onAdd:Xe,onRemove:Xe,onAddInitial:Xe,onRemoveInitial:Xe,onDeactiveateItem:Xe,onDeactivateCollection:Xe,resourceKey:null,clearOnTabChange:!0,clearOnSubTabChange:!0,custom:null})},e.prototype.getIdArray=function(e){for(var t=[],r=0,i=e;r<i.length;r++){var n=i[r];t.push(n.entry.itemId)}return t},e}(),B=function(){function e(e){this.columnUtil=e,this.cache={},this.allColumns={}}return e.prototype.setColumn=function(e,t){void 0===this.cache[e]&&(this.cache[e]={});var r=this.cache[e],i=t.id;return void 0===r[i]&&(r[i]=t),r[i]},e.prototype.setColumns=function(e,t,r){var i={};for(var n in r){var o=r[n];for(var s in i[n]={},o)i[n][s]=this.setColumn(n,o[s])}return!0===t&&(this.allColumns[e]=!0),i},e.prototype.retrieve=function(e,t){if(!0===t)return this.containsAll(e)?{cached:this.getColumns(e),missing:[]}:{cached:{},missing:!0};var r={},i=[];return this.retrieveColumns(e,t,i,r),{missing:i,cached:r}},e.prototype.containsAll=function(e){return!0===this.allColumns[e]},e.prototype.getColumns=function(e){var t=void 0===this.cache[e]?[]:this.cache[e],r={};return r[e]=t,r},e.prototype.retrieveColumns=function(e,t,r,i){this.retrieveColumn(e,"id",r,i);for(var n=0,o=t;n<o.length;n++){var s=o[n];this.retrieveColumn(e,s,r,i)}},e.prototype.retrieveColumn=function(e,t,r,i){var n=this.columnUtil.parseRequestColumn(t),o=this.getColumn(e,n.id);if(void 0!==o){if(void 0===i[e]&&(i[e]={}),i[e][n.id]=o,0!==n.children.length){var s=[];if(this.retrieveColumns(o.itemType,n.children,s,i),0!==s.length){var c={};c[n.id]=s,r.push(c)}}}else r.push(t)},e.prototype.getColumn=function(e,t){if(void 0!==this.cache[e])return this.cache[e][t]},e}(),Q=function(){function e(e,t,r,i,n,o){if(this.columnHandler=e,this.columnSetFactory=t,this.columnUtil=r,this.itemType=i,this.requestColumns=n,this.responseColumns=o,this.expansionMap={},!0===n)for(var s in this.requestColumnsTrue=!0,this.requestColumns=[],o[i])this.requestColumns.push(s);else this.requestColumnsTrue=!1}return e.prototype.run=function(e,t){var r=e.id;return void 0!==this.expansionMap[r]?t?this.expansionMap[r]:this.expansionMap[r].merged:this.columnUtil.isColumnSubset(this.requestColumns,e.request,e.true)?t?null:e:(this.expansionMap[r]=this.expandColumnInfo(e),t?this.expansionMap[r]:this.expansionMap[r].merged)},e.prototype.expandColumnInfo=function(e){var t=this.columnUtil.mergeRequestColumns(e.request,this.requestColumns),r=this.columnUtil.mergeResponseColumns(e.response,this.responseColumns).merged,i=this.columnSetFactory.construct(this.itemType,t.merged,r),n=this.columnSetFactory.construct(this.itemType,t.difference,r,!1,!1);return i.true=this.requestColumnsTrue||e.true,{merged:i,difference:n}},e}(),Y=function(){function e(e,t,r,i,n){this.apiRequestService=e,this.errorHandler=t,this.promiseService=r,this.cache=i,this.columnUtil=n}return e.prototype.setColumn=function(e,t){return this.cache.setColumn(e,t)},e.prototype.setColumns=function(e,t,r){return this.cache.setColumns(e,t,r)},e.prototype.fetchItemTypeTranslations=function(e){for(var t=[],r={},i=0,n=e;i<n.length;i++){var o=n[i],s=t.push(this.fetch(o,["id"]));r[o]=s-1}return this.promiseService.all(t).then(function(e){for(var t={},i=0;i<e.length;i++){var n=r[i];t[n]=e[n][n].id.name}return t},this.errorHandler.reject)},e.prototype.request=function(e,t,r){var i=this;void 0===r&&(r={});var n,o=((n={})[e]=t,n);return this.apiRequestService.columns(e,o,r).then(function(r){return i.cache.setColumns(e,t,r.fetchColumnsObject())},this.errorHandler.reject)},e.prototype.fetch=function(e,t,r){var i=this;void 0===r&&(r={});var n=this.cache.retrieve(e,t);return!0!==n.missing&&0===n.missing.length?this.promiseService.when(n.cached):this.request(e,n.missing,r).then(function(e){return i.columnUtil.mergeResponseColumns(e,n.cached).merged})},e.prototype.fetchAll=function(e){return this.cache.containsAll(e)?this.promiseService.when(this.cache.getColumns(e)):this.request(e,!0)},e}(),W=0,X=function(){function e(e,t,r,i,n,o,s){void 0===o&&(o=!0),void 0===s&&(s=!0),this.columnHandler=e,this.columnUtil=t,this.itemType=r,this.requestColumns=i,this.responseColumns=n,this.enableCaching=o,this.includeIdColumn=s,this.id=++W,this.link=null,this.main=[],this.derived=[],this.root=[],this.leaf=[],this.formatted={main:[],derived:[]},this.filtered=[],this.custom=[],this.searchable=[],this.item=[],this.notItem=[],this.request=[],this.response={},this.true=!0===i,!0===i?this.processResponseColumns():this.processRequestColumns()}return e.prototype.processResponseColumns=function(){for(var e in this.request=[],this.response=this.enableCaching?this.columnHandler.setColumns(this.itemType,!0,this.responseColumns):this.responseColumns,this.responseColumns[this.itemType])this.main.push(this.getColumnInfo(this.responseColumns[this.itemType][e],[],null)),this.request.push(e)},e.prototype.processRequestColumns=function(){if(this.request=this.requestColumns,this.response={},0!==this.requestColumns.length){for(var e=0,t=this.requestColumns;e<t.length;e++){var r=t[e],i=this.getRequestColumnInfo(r,this.itemType,null);null!==i&&(this.main.push(i),i.isLeaf||this.root.push(i))}this.includeIdColumn&&void 0===this.response[this.itemType].id&&this.main.push(this.getRequestColumnInfo("id",this.itemType,null))}},e.prototype.getRequestColumnInfo=function(e,t,r){var i,n=this.columnUtil.parseRequestColumn(e),o=n.id;if(void 0!==this.responseColumns[t]&&(i=this.responseColumns[t][o]),void 0===i)return console.warn("No api column for request column",o,"for itemType",t),null;this.enableCaching&&(i=this.columnHandler.setColumn(t,i));var s=this.response;return void 0===s[t]&&(s[t]={}),void 0===s[t][o]&&(s[t][o]=i),this.getColumnInfo(i,n.children,r)},e.prototype.getColumnInfo=function(e,t,r){var i=null!==r,n=e.id,o={id:n,path:i?r.path.concat(">",n):n,apiColumn:e,level:i?r.level+1:0,isLeaf:0===t.length,itemType:"",children:[],parent:null,tailPath:null};if(i?(this.derived.push(o),o.parent=r,o.tailPath=r.level>0?r.tailPath.concat(">",n):n):this[this.columnUtil.isItemColumn(e)?"item":"notItem"].push(o),this.columnUtil.isFormattedColumn(e)&&this.formatted[i?"derived":"main"].push(o),this.columnUtil.isFilteredColumn(e)&&this.filtered.push(o),this.columnUtil.isSearchableColumn(e)&&this.searchable.push(o),this.columnUtil.isCustomColumn(e)&&this.custom.push(o),"link"===e.type&&(this.link=e),0===t.length)return this.leaf.push(o),o;void 0===e.itemType&&console.warn("itemType undefined in column",e),o.itemType=e.itemType,o.children=[];for(var s=0,c=t;s<c.length;s++){var a=c[s],u=this.getRequestColumnInfo(a,o.itemType,o);null!==u&&o.children.push(u)}return o},e}(),K=function(){function e(){}return e.prototype.getColumnPath=function(e,t){for(var r="",i="",n=0,o=e;n<o.length;n++){i+=r+o[n].id,r=">"}return null!==t&&(i+=":"+t),i},e.prototype.getDateFormatOptions=function(e){var t=i(),r={"J-M-Y":t.format("DD-MM-YYYY"),"J-M":t.format("DD-MM"),"j+F+Y":t.format("D MMM YYYY"),"D+j+F+Y":t.format("dddd D MMM YYYY"),F:t.format("MMM"),f:t.format("MMMM"),D:t.format("dddd"),d:t.format("ddd")};return"datetime"===e&&d(r,{"J-M-Y+H:i":t.format("DD-MM-YYYY HH:mm"),"J-M+H:i":t.format("DD-MM HH:mm"),"j+F+Y+H:i":t.format("DD MMMM Y HH:mm"),"D+j+F+Y+H:i":t.format("dddd DD MMM Y HH:mm"),"H:i":t.format("HH:mm")}),r},e.prototype.isStringColumn=function(e){switch(e.type){case"email":case"phone":case"url":case"text":case"longtext":case"textreplace":return!0;default:return!1}},e.prototype.isFloatColumn=function(e){switch(e.type){case"double":case"volume":case"weight":case"distance":case"dimension":case"power":case"current":case"price":case"percentage":return!0;default:return!1}},e.prototype.isIntColumn=function(e){switch(e.type){case"int":case"number":case"quantity":return!0;default:return!1}},e.prototype.isNumberColumn=function(e){return this.isFloatColumn(e)||this.isIntColumn(e)},e.prototype.isCustomColumn=function(e){return"customfield"===e.fieldtype},e.prototype.isItemColumn=function(e,t){switch(void 0===t&&(t=!0),e.type){case"id":return t;case"item":case"child":case"sibling":case"link":return!0;default:return!1}},e.prototype.isDateColumn=function(e){switch(e.type){case"datetime":case"date":return!0;default:return!1}},e.prototype.isRenderedColumn=function(e){switch(e.type){case"datetime":case"date":case"duration":return!0;default:return!1}},e.prototype.isFilteredColumn=function(e){if("staffel"===e.id)return!0;if(void 0!==e.generator)return!0;switch(e.type){case"price":case"bool":case"enum":case"volume":case"weight":case"distance":case"dimension":case"quantity":case"email":case"url":case"datetime":case"date":case"time":case"duration":case"html":case"textreplace":case"longtext":case"percentage":return!0;default:return!1}},e.prototype.isFormattedColumn=function(e){switch(e.type){case"datetime":case"date":case"time":case"duration":case"color":case"json":case"number":case"filesize":return!0;default:return!1}},e.prototype.isSelectableColumn=function(e){switch(e.type){case"blob":case"coordinate":case"forceupdate":case"id":case"json":case"order":case"parentid":case"parenttype":case"password":case"token":return!1}return!0},e.prototype.hasLocationProperty=function(e,t){return 0!=(t&e.location)},e.prototype.isEditableColumn=function(e){if(e.readOnly)return!1;switch(e.type){case"date":case"datetime":case"duration":return!1}return!0},e.prototype.isSearchableColumn=function(e){switch(e.type){case"email":case"phone":case"text":case"longtext":case"html":return!0;default:return!1}},e.prototype.getDefaultWeight=function(e){switch(e.type){case"double":case"price":case"bool":case"int":case"percentage":case"color":case"number":case"power":case"current":return.5;case"url":case"enum":case"email":case"text":case"item":case"link":return 1.5;case"longtext":case"html":case"textreplace":return 2;case"date":case"datetime":case"time":case"duration":default:return 1}},e.prototype.getComparators=function(e){switch(e.type){case"dimension":case"weight":case"price":return["=",">","<"];case"date":case"datetime":case"time":case"duration":return[">","<"];default:return["=","!="]}},e.prototype.isColumnSubset=function(e,t,r){if(!0===e)return r;for(var i=0,n=e;i<n.length;i++){var o=n[i];if(!this.containsColumn(o,t))return!1}return!0},e.prototype.containsColumn=function(e,t){var r=this.parseRequestColumn(e),i=this.findColumn(r.id,t);if(-1===i)return!1;if(0===r.children.length)return!0;if("string"==typeof t[i])return!1;for(var n=0,o=r.children;n<o.length;n++){var s=o[n];if(!this.containsColumn(s,t[i][r.id]))return!1}return!0},e.prototype.responseColumnsAvailable=function(e,t,r){for(var i=0,n=t;i<n.length;i++){var o,s=n[i],c=this.parseRequestColumn(s),a=c.children,u=r[e];if(void 0===u)return!1;if(void 0===(o=u[c.id]))return!1;if(a.length>0&&!this.responseColumnsAvailable(o.itemType,a,r))return!1}return!0},e.prototype.mergeRequestColumns=function(e,t){if(!0===e)return{merged:!0,difference:[]};if(!0===t)return{merged:!0,difference:!0};for(var r=T(e),i=[],n=0,o=t;n<o.length;n++){var s=o[n],c=this.mergeRequestColumn(s,r);null!==c&&i.push(c)}return{merged:r,difference:i}},e.prototype.mergeRequestColumn=function(e,t){var r=this.parseRequestColumn(e),i=this.findColumn(r.id,t);if(-1===i)return t.push(e),e;if(0===r.children.length)return null;"string"==typeof t[i]&&(t[i]=((n={})[r.id]=[],n));for(var n,o,s=[],c=0,a=r.children;c<a.length;c++){var u=a[c],l=this.mergeRequestColumn(u,t[i][r.id]);null!==l&&s.push(l)}return 0===s.length?null:((o={})[r.id]=s,o)},e.prototype.parseRequestColumn=function(e){var t="string"==typeof e,r=t?e:s(e);return{id:r,children:t?[]:e[r]}},e.prototype.mergeResponseColumns=function(e,t){var r={},i={};for(var n in e)if(void 0!==t[n]){var o=this.mergeResponseColumnMap(e[n],t[n]);r[n]=o.merged,i[n]=o.difference}else r[n]=e[n];for(var n in t)void 0===e[n]&&(r[n]=t[n],i[n]=t[n]);return{merged:r,difference:i}},e.prototype.mergeResponseColumnMap=function(e,t){var r={},i={};for(var n in e)r[n]=e[n];for(var n in t)O(e[n])||(r[n]=t[n],i[n]=t[n]);return{merged:r,difference:i}},e.prototype.isLocalColumnId=function(e){return"__"===e.substring(0,2)},e.prototype.processConfigColumns=function(e){for(var t=[],r=0,i=e;r<i.length;r++){var n=i[r];this.isLocalColumnId(n)||this.processConfigColumn(this.parseConfigColumn(n),t)}return t},e.prototype.processLocalConfigColumns=function(e,t,r,i){for(var n={},o=0,s=t;o<s.length;o++){var c=s[o];n[c.id]=c}for(var a=0,u=e;a<u.length;a++){var l=u[a],h=l.split(":"),p=h[0];this.isLocalColumnId(p)?void 0!==n[p]&&(i(l,n[p]),delete n[p]):r(l,p,h[1])}},e.prototype.consolidateColumns=function(e,t,r){var i=this,n=[],o=T(r);return this.processLocalConfigColumns(e,t,function(e,t){i.processConfigColumn(t.split(">"),o)},function(e,t){n.push(t),o=i.mergeRequestColumns(o,t.valueOptions.requestColumns).merged}),{request:o,local:n}},e.prototype.parseConfigColumn=function(e){return e.split(":")[0].split(">")},e.prototype.processConfigColumn=function(e,t){var r=e[0];if(1===e.length)-1===t.indexOf(r)&&t.push(r);else{var i,n=this.findColumnObject(r,t);-1===n&&(n=t.push(((i={})[r]=[],i))-1),this.processConfigColumn(e.slice(1),t[n][r])}},e.prototype.findColumnObject=function(e,t){for(var r=0;r<t.length;r++)if(s(t[r])===e)return r;return-1},e.prototype.findColumn=function(e,t){for(var r=0;r<t.length;r++){var i=t[r];if("string"!=typeof i){if(s(i)===e)return r}else if(i===e)return r}return-1},e}(),J=function(){function e(e,t,r,i,n,o,s){void 0===s&&(s=!1),this.collectionHandler=e,this.requestColumnExpansionFactory=t,this.itemEntryService=r,this.keyService=i,this.compilation=n,this.parameterMap=o,this.breakupByParent=s,this.requests=[]}return e.prototype.finalizeRequest=function(e){var t=e.collections,r=e.columns;for(var i in t){var n=t[i];n.fitting.length>0&&r.expand(n.collection.columns)}return e.request.columns=r.get(),e},e.prototype.setRequestParent=function(e,t){var r=t.request;return"Void"!==e&&(r.parentType=e,r.parentId={},!0)},e.prototype.run=function(){if(this.breakupByParent)for(var e in this.compilation){var t=this.compilation[e];for(var r in t)if(!this.keyService.isLocalId(r)){var i=this.initializeRequest();this.extendRequest(t[r],this.setRequestParent(e,i)?r:null,i),this.requests.push(this.finalizeRequest(i))}}else for(var e in this.compilation){t=this.compilation[e],i=this.initializeRequest();var n=this.setRequestParent(e,i),o=!1;for(var r in t)this.keyService.isLocalId(r)||(this.extendRequest(t[r],n?r:null,i),o=!0);o&&this.requests.push(this.finalizeRequest(i))}return this.requests},e.prototype.initializeRequest=function(){return{request:{requestType:"create",items:{}},columns:this.requestColumnExpansionFactory.construct(),items:{},collections:{}}},e.prototype.extendRequest=function(e,t,r){var i=r.request,n=r.items;for(var o in e)for(var s in void 0===i.itemType&&(i.itemType=o),void 0===n[o]&&(n[o]={},i.items[o]={}),e[o]){var c=e[o][s],a=p(this.compilation,[o,s]),u=i.items[o][s]={},l=p(this.parameterMap,[o,s]),h=void 0;if(null!==t&&(i.parentId[s]=t),r.columns.expand(c.columns),this.collectionHandler.expandCollectionMap(c,r.collections),n[o][s]=c,u.values=this.itemEntryService.formatRequest(c),u.parameters=l,void 0!==a){for(var m in h=u.links={},a)for(var d in h[m]=[],a[m])h[m].push(d);this.extendRequest(a,null,r)}}},e}(),z=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m,d){this.apiRequestService=e,this.localCacheManager=t,this.authInterface=r,this.errorHandler=i,this.itemHandler=n,this.collectionHandler=o,this.columnSetFactory=s,this.itemRequestService=c,this.localCacheFactory=a,this.moduleChangesCompilerFactory=u,this.collectionEntryService=l,this.collectionResourceService=h,this.itemEntryService=p,this.keyService=m,this.queryService=d}return e.prototype.getItemDefinition=function(e,t,r){var i=this.keyService.parseStateKey(t),n={itemType:e,options:r,itemId:t};if(null!==i){switch(i.type){case"new":n.itemId=this.keyService.getLocalId();break;case"duplicate":r.duplicate=i.itemId,void 0===r.templateOptions&&(r.templateOptions={}),void 0===r.templateOptions.item&&(r.templateOptions.item=i.itemId),n.itemId=this.keyService.getLocalDuplicateId()}return n}return n.itemId=t,n},e.prototype.createCollectionMap=function(e,t){for(var r=this.getLocalCache(),i=r.collections,n={},o=0,s=e;o<s.length;o++){var c=s[o];t&&r.addSingleItem(c,{},!1),this.collectionHandler.expandCollectionMap(c,n,i)}return n},e.prototype.getItemById=function(e,t,r){var i=this;return this.itemHandler.fetchItem(e,t,this.itemEntryService.processOptions(r)).then(function(e){if(void 0!==e.itemType)return i.addSingleItem(e,r,!1)},this.errorHandler.reject)},e.prototype.getItemsById=function(e,t,r){var i=this;return this.itemHandler.fetchItems(e,t,this.itemEntryService.processOptions(r)).then(function(e){return i.addSingleItems(e,r)},this.errorHandler.reject)},e.prototype.getItemsByQuery=function(e,t,r){var i=this,n=this.itemEntryService.processOptions(r),o={};return o[e]=n.columns,this.apiRequestService.query(e,this.queryService.addParentCondition(t,n.parent),o).then(function(t){return i.itemRequestService.processResponse(t,t.links[e],n.parent,i.columnSetFactory.construct(e,n.columns,t.fetchColumnsObject()))},this.errorHandler.reject).then(function(e){return i.addSingleItems(e,r)},this.errorHandler.reject)},e.prototype.getDuplicateById=function(e,t,r){void 0===r&&(r={}),r.edit=!0;var i=this.getItemDefinition(e,this.keyService.getDuplicateStateKey(t),r);return this.getItemByDef(i,!1)},e.prototype.getNewResource=function(e,t,r,i){var n=this;return void 0===t&&(t={}),t.edit=!0,void 0===i&&(i=!1),this.itemHandler.fetchItem(e,this.keyService.getLocalId(),this.itemEntryService.processOptions(t)).then(function(e){var o=n.addSingleItem(e.main,t,i),s=n.processLinkedItems(e.linked,t,!0);return r?{main:o,linked:s}:o},this.errorHandler.reject)},e.prototype.getCollectionDef=function(e,t){return{itemType:e,options:{entry:this.collectionEntryService.processOptions(t),resource:this.collectionResourceService.processOptions(t)}}},e.prototype.getLinkCollectionsDef=function(e,t,r,i,n){return{itemType:r,linkType:e,linkIdArray:t,linkField:i,options:{entry:this.collectionEntryService.processOptions(n),resource:this.collectionResourceService.processOptions(n)}}},e.prototype.getCollection=function(e,t){var r=this,i=this.getLocalCache();return this.collectionHandler.fetch(e,this.collectionEntryService.processOptions(t),i.items,i.deferredCollections).then(function(e){return r.addCollection(e,t)},this.errorHandler.reject)},e.prototype.getCollectionFromDef=function(e){var t=this,r=this.getLocalCache();return this.collectionHandler.fetch(e.itemType,e.options.entry,r.items,r.deferredCollections).then(function(r){return t.addCollection(r,e.options.resource,!1)},this.errorHandler.reject)},e.prototype.getLinkCollection=function(e,t,r,i){var n=this,o=this.getLocalCache(),s=this.collectionEntryService.processOptions(i);return s.parent={itemType:e,itemId:t},this.collectionHandler.fetch(r,s,o.items,o.deferredCollections).then(function(e){return n.addCollection(e,i)},this.errorHandler.reject)},e.prototype.getLinkCollections=function(e,t,r,i){var n=this;return this.collectionHandler.batchFetch(e,t,r,this.collectionEntryService.processOptions(i),this.getLocalCache().deferredCollections).then(function(e){return n.addCollections(e,n.collectionResourceService.processOptions(i))},this.errorHandler.reject)},e.prototype.getLinkCollectionsFromDef=function(e){var t=this;return this.collectionHandler.batchFetch(e.linkType,e.linkIdArray,e.itemType,e.options.entry,this.getLocalCache().deferredCollections).then(function(r){return t.addCollections(r,e.options.resource)},this.errorHandler.reject)},e.prototype.getAllLinkCollections=function(e,t,r){var i=this;return this.apiRequestService.query(e,{},{}).then(function(n){return i.getLinkCollections(e,n.links[e],t,r)},this.errorHandler.reject)},e.prototype.getItemByDef=function(e,t){var r=this;return this.itemHandler.fetchItem(e.itemType,e.itemId,this.itemEntryService.processOptions(e.options)).then(function(i){var n;return void 0!==i.linked?(r.processLinkedItems(i.linked,e.options,!1),n=i.main):n=i,r.addSingleItem(n,e.options,t)},this.errorHandler.reject)},e.prototype.cloneItem=function(e,t,r){return this.addSingleItem(this.itemHandler.cloneItem(e,t.entry),r)},e.prototype.cloneCollection=function(e,t,r){return this.addCollection(this.collectionHandler.clone(e.entry,this.collectionEntryService.processOptions(t),r),t)},e.prototype.saveCurrentLocalCache=function(e,t,r,i,n){return void 0===r&&(r=!1),void 0===n&&(n=!1),this.getLocalCache().save(e,t,r,i)},e.prototype.getCurrentCollections=function(){return this.getLocalCache().collections},e.prototype.getCurrentItems=function(){return this.getLocalCache().items},e.prototype.getCurrentChanges=function(){var e=this.getLocalCache();if(void 0===e.rootItem)throw new Error("itemAdministrator: No root item!");return this.moduleChangesCompilerFactory.construct(e.rootItem,e.items,e.collections).process()},e.prototype.addSingleItem=function(e,t,r){return this.getLocalCache().addSingleItem(e,t,r)},e.prototype.addSingleItems=function(e,t){for(var r=this.getLocalCache(),i=[],n=0,o=e;n<o.length;n++){var s=o[n];i.push(r.addSingleItem(s,t,!1))}return i},e.prototype.addCollection=function(e,t,r){return void 0===r&&(r=!0),this.getLocalCache().addCollection(e,r?this.collectionResourceService.processOptions(t):t)},e.prototype.addCollections=function(e,t){var r=this.getLocalCache(),i={};for(var n in e)i[n]=r.addCollection(e[n],t);return i},e.prototype.processLinkedItems=function(e,t,r){for(var i=this.getLocalCache(),n=i.collections,o={},s=0,c=e;s<c.length;s++){var a=c[s],u=a.itemType,l=a.itemEntries,p={};o[u]=[];for(var m=0,d=l;m<d.length;m++){var f=d[m];o[u].push(i.addSingleItem(f,t,!1)),r&&this.collectionHandler.expandCollectionMap(f,p,n),"Projectnotitie"===u&&h(i.tabRequestParameters,[f.itemType,f.itemId],[{},{no_notification:!0}])}r&&this.collectionHandler.addToCollections(p,!1)}return o},e.prototype.getLocalCache=function(){return this.localCacheManager.getCacheManager(this.authInterface.getUniqueUserId())},e.prototype.resetLocalCache=function(){var e=this.getLocalCache(),t=this.localCacheFactory.construct();e.clearResources(),this.localCacheManager.setCacheManager(this.authInterface.getUniqueUserId(),t)},e.prototype.addToCollections=function(e,t){return this.collectionHandler.addToCollections(this.createCollectionMap(e,!0),!1,t)},e.prototype.removeFromCollections=function(e,t){return this.collectionHandler.removeFromCollections(this.createCollectionMap(e,!1),!1,t)},e.prototype.updateItemIdMap=function(e,t){if(void 0!==t)for(var r in t){var i=t[r];void 0!==e[r]&&(e[i]=e[r],delete e[r])}},e.prototype.createCollectionResource=function(e,t,r){return this.addCollection(e,t,r)},e.prototype.createItemResource=function(e,t,r){return this.addSingleItem(e,t,r)},e.prototype.createItemResources=function(e,t){return this.addSingleItems(e,t)},e.prototype.onBeforeSave=function(e,t){return this.getLocalCache().registerCallback("onBeforeSave",e,t)},e.prototype.onSaveSuccess=function(e,t){return this.getLocalCache().registerCallback("onSaveSuccess",e,t)},e.prototype.onSaveWithoutClosing=function(e,t){return this.getLocalCache().registerCallback("onSaveWithoutClosing",e,t)},e}(),G=function(){function e(e,t){this.queryMatcherFactory=e,this.itemEntryService=t,this.entries={}}return e.prototype.some=function(e){for(var t in this.entries)for(var r in this.entries[t])if(e(this.entries[t][r]))return!0;return!1},e.prototype.getByItemType=function(e){var t=[];if(void 0===this.entries[e])return t;for(var r in this.entries[e])t.push(this.entries[e][r]);return t},e.prototype.getByQuery=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i in this.entries[e]){var n=this.entries[e][i];this.matchQuery(n,t)&&r.push(n)}return r},e.prototype.getLocalByQuery=function(e,t){var r=[];if(void 0===this.entries[e])return r;for(var i in this.entries[e]){var n=this.entries[e][i];this.itemEntryService.isLocal(n)&&(this.matchQuery(n,t)&&r.push(n))}return r},e.prototype.forEach=function(e){for(var t in this.entries)for(var r in this.entries[t])e(this.entries[t][r])},e.prototype.toArray=function(){var e=[];for(var t in this.entries)for(var r in this.entries[t])e.push(this.entries[t][r]);return e},e.prototype.add=function(e){var t=e.itemType;return void 0===this.entries[t]&&(this.entries[t]={}),this.entries[t][e.itemId]=e},e.prototype.get=function(e,t){return void 0===this.entries[e]?void 0:this.entries[e][t]},e.prototype.getByParent=function(e,t,r){var i=[];if(void 0===this.entries[r])return i;for(var n in this.entries[r]){var o=this.entries[r][n],s=o.parent;null!==s&&(e===s.itemType&&t==s.itemId&&i.push(o))}return i},e.prototype.contains=function(e,t){return void 0!==this.entries[e]&&void 0!==this.entries[e][t]},e.prototype.updateItemId=function(e,t){var r=this.entries[e.itemType];return delete r[t],r[e.itemId]=e},e.prototype.clear=function(e){return void 0===e?(this.entries={},!0):void 0!==this.entries[e.itemType]&&delete this.entries[e.itemType][e.itemId]},e.prototype.matchQuery=function(e,t){var r=null!==e.parent?e.parent:{};return!0===this.queryMatcherFactory.construct(r.itemType,r.itemId,this.itemEntryService.getFields(e)).matchQuery(t.object)},e}(),Z=function(){function e(e,t,r){this.apiFormatter=e,this.keyService=t,this.promiseService=r,this.undefinedItemError="Het opgevraagde item bestaat niet / Je hebt niet voldoende rechten om dit item te bekijken",this.ALL_PERMISSIONS=7}return e.prototype.resetDerived=function(e,t){for(var r=[],i=0,n=e.columns.root;i<n.length;i++){var o=n[i];-1!==t.indexOf(o.id)&&r.push(o)}!function t(r){for(var i=0,n=r;i<n.length;i++){var o=n[i];o.isLeaf||t(o.children),delete e.derived[o.path]}}(r)},e.prototype.defer=function(e,t){return e.deferred=this.promiseService.defer(),e.deferRequest=t,e},e.prototype.resolve=function(e){var t=e.deferred;return delete e.deferred,delete e.deferRequest,t.resolve(e),e},e.prototype.reject=function(e,t){return void 0===t&&(t=this.undefinedItemError),e.deferred.reject(t),delete e.deferred,delete e.deferRequest,e},e.prototype.clearResources=function(e){e.resources=[]},e.prototype.deactivateResources=function(e){for(var t=0,r=e.resources;t<r.length;t++){r[t].deactivate()}},e.prototype.getFields=function(e){return void 0!==e.modified?e.modified:e.initial},e.prototype.expand=function(e,t,r,i){var n=i.difference;return e.columns=i.merged,this.apiFormatter.expandResponse(e.initial,t,n.main),this.apiFormatter.expandResponse(e.derived,r,n.derived),void 0===e.modified?e:(this.apiFormatter.expandResponse(e.modified,t,n.main),e)},e.prototype.processOptions=function(e){return n(e,{columns:!0,parent:null,templateOptions:{},templateColumns:{},deferRequest:!1})},e.prototype.getConversionValue=function(e,t,r){if(void 0!==r[e])return r[e][t]},e.prototype.updateFields=function(e,t,r){void 0===r&&(r=!0);var i=e.columns.main,n=e.columns.formatted.main,o=e.initial,s=e.modified;if(void 0!==s){for(var c=0,a=i;c<a.length;c++){var u=(p=a[c]).id;(r||this.apiFormatter.compareFields(p.apiColumn.type,o[u],s[u]))&&(s[u]=t[u])}this.apiFormatter.formatResponse(s,n)}for(var l=0,h=i;l<h.length;l++){var p;o[u=(p=h[l]).id]=t[u]}return this.apiFormatter.formatResponse(o,n),e},e.prototype.updateItemValue=function(e,t,r,i){var n,o=r.id,s=t[o];"link"===r.type&&void 0===s?null!==e.parent&&(n=e.parent.itemId):n=this.getConversionValue(r.itemType,s,i),void 0!==n&&(t[o]=n)},e.prototype.updateItemFields=function(e,t){for(var r=e.columns.item,i=e.initial,n=e.modified,o=0,s=r;o<s.length;o++){var c=s[o].apiColumn;this.updateItemValue(e,i,c,t),void 0!==n&&this.updateItemValue(e,n,c,t)}},e.prototype.process=function(e){var t=e.columns.formatted;return this.apiFormatter.formatResponse(e.initial,t.main),this.apiFormatter.formatResponse(e.derived,t.derived),e},e.prototype.formatRequest=function(e){return void 0===e.modified?{}:this.apiFormatter.formatRequest(this.keyService.isLocalId(e.itemId)?{}:e.initial,e.modified,e.columns.main)},e.prototype.setDisplayName=function(e){if(void 0!==e.modified){var t=this.getDisplayName(e);t&&(e.modified.displayname=t)}},e.prototype.getDisplayName=function(e){var t=void 0===e.modified?e.initial:e.modified;switch(e.itemType){case"Contact":return"bedrijf"===t.type?t.bedrijf:this.getFullName(t.voornaam,t.tussenvoegsel,t.naam);case"Medewerker":case"Person":return this.getFullName(t.voornaam,t.tussenvoegsel,t.achternaam);case"Reparatie":return e.derived["materiaal>naam"];default:return t[this.getTitleField(e.itemType)]}},e.prototype.getFullName=function(e,t,r){return e.trim().concat(" ",t).trim().concat(" ",r)},e.prototype.getTitleField=function(e){switch(e){case"Exemplaar":return"serienummer";case"Factuur":return"nummer";case"Files":return"friendlyname";case"Functie":case"Standaardfunctie":return"naamintern";case"Voorraadmutatie":return"omschrijving";case"Barcode":return"code";case"Betaalmiddel":case"Betalingsconditie":case"Briefpapier":case"TaxClass":case"TaxSchema":case"Condition":case"Factuurmoment":case"Functiegroep":case"Grootboek":case"Inhuur":case"Inhuurgroep":case"Inhuurmateriaal":case"Materiaal":case"MateriaalCat":case"Medewerkertarief":case"Notitie":case"Planningmateriaal":case"Project":case"Staffelgroep":case"Subproject":case"Taak":case"Tag":case"Template":case"Tijd":case"Titel":case"Type":case"Voertuig":return"naam";default:return"displayname"}},e.prototype.getChanges=function(e,t){return void 0!==e.modified||t?this.apiFormatter.getChanges(e.initial,t?{}:e.modified,e.columns.main):[]},e.prototype.isLocal=function(e){return this.keyService.isLocalId(e.itemId)},e.prototype.isLockable=function(e){if(this.isLocal(e))return!1;switch(e.itemType){case"Project":case"Materiaal":case"Contact":case"Medewerker":case"Voertuig":case"Template":return!0;default:return!1}},e.prototype.hasChanges=function(e){return void 0!==e.modified&&this.apiFormatter.hasChanges(e.initial,e.modified,e.columns.main)},e.prototype.resetModified=function(e){var t=e.columns.main;if(void 0!==e.modified)for(var r=0,i=t;r<i.length;r++){var n=i[r];e.modified[n.id]=this.apiFormatter.clone(n.apiColumn.type,e.initial[n.id])}},e.prototype.setInitial=function(e,t,r){var i;for(var n in t)e.initial[n]=t[n];if(void 0===e.modified)return r&&this.callOnChange(e,this.apiFormatter.copyFields(e.initial,{},e.columns.main)),e;for(var n in i=this.apiFormatter.copyFields(e.modified,{},e.columns.main),t)e.modified[n]=t[n];return r&&this.callOnChange(e,i),e},e.prototype.setModified=function(e,t){var r=e.columns,i=r.response[e.itemType];if(void 0===e.modified){var n=e.resources,o=e.initial,s=e.modified={};if(void 0===t)this.apiFormatter.copyFields(o,s,r.main);else for(var c in this.apiFormatter.shallowCopyFields(t,o,s,r.main),t)void 0===i[c]&&(s[c]=t[c]);for(var a=0,u=n;a<u.length;a++){u[a].fields=s}return e}if(void 0===t)return e;for(var c in t)e.modified[c]=t[c];return e},e.prototype.setDerived=function(e,t){for(var r in t)e.derived[r]=t[r];return e},e.prototype.processLocal=function(e,t,r,n,o){return e.initial={permissions:this.ALL_PERMISSIONS},this.updateFields(e,t),this.updateItemFields(e,o),this.setModified(e,r),e.modified.created=i(),e.derived=n,e},e.prototype.setParent=function(e,t,r){return e.parent={itemType:t,itemId:r},e},e.prototype.callOnChange=function(e,t){for(var r=0,i=e.resources.length;r<i;r++){var n=e.resources[r];null!==n&&n.options.onChange(n,t)}},e}(),$=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m){this.apiRequestService=e,this.authInterface=t,this.errorHandler=r,this.itemEntryFactory=i,this.columnHandler=n,this.itemCacheFactory=o,this.batchStatusFactory=s,this.columnExpansionFactory=c,this.columnSetFactory=a,this.itemEntryService=u,this.apiFormatter=l,this.keyService=h,this.promiseService=p,this.columnUtil=m,this.templates={},this.entries=this.itemCacheFactory.construct()}return e.prototype.getItemId=function(e){return e.itemId},e.prototype.getPromise=function(e){return e.deferred.promise},e.prototype.fetchItem=function(e,t,r){var i=this,n=this.getEntryStatus(e,t,r),o=n.entry,s=n.status;return s===k.LOCAL?this.fetchTemplate(e,r.templateOptions,r.templateColumns).then(function(e){return i.resolveLocal(o,r.parent,e)},function(e){return i.itemEntryService.reject(o,e),i.errorHandler.reject(e)}):this.resolveCached(o,s,r)},e.prototype.fetchItems=function(e,t,r){for(var i=this,n=this.batchStatusFactory.construct(function(e){return i.getItemId(e)},function(e){return i.getPromise(e)}),o={},s=0,c=t;s<c.length;s++){var a=c[s];n.add(this.getEntryStatus(e,a,r))}return o.entries=n.getPromises(),n.hasRequests()&&(o.requests=this.requestItem(e,n.getRequestIds(),r.columns)),n.hasEntries([k.LOCAL])&&(o.template=this.fetchTemplate(e,r.templateOptions,r.templateColumns)),this.promiseService.all(o).then(function(t){return i.batchResolve(e,n,r.columns,t)},this.errorHandler.reject)},e.prototype.resolveCached=function(e,t,r){var i=this,n=e.itemType,o=e.itemId,s=e.columns.request;switch(t){case k.CACHED:return this.promiseService.when(e);case k.PROMISED:return e.deferred.promise;case k.PROMISED_EXPAND:return e.deferred.promise.then(function(){return i.resolveCached(e,i.getCachedEntryStatus(e,r),r)},this.errorHandler.reject)}if(t===k.EXPAND){var c=this.columnUtil.mergeRequestColumns(s,r.columns).difference;this.requestItem(n,o,c).then(function(t){i.resolveExpansion(e,i.columnExpansionFactory.construct(n,c,t.fetchColumnsObject()),t)},function(t){i.itemEntryService.reject(e,t)})}else this.requestItem(n,o,s).then(function(t){i.resolveRemote(e,i.columnSetFactory.construct(n,s,t.fetchColumnsObject()),t)},function(t){i.itemEntryService.reject(e,t)});return e.deferred.promise},e.prototype.resolveLocal=function(e,t,r){var i=e.itemType,n=e.itemId,o=this.createConversionMap(i,n,!0,r.response);return e.columns=r.columns,null!==t&&this.itemEntryService.setParent(e,t.itemType,t.itemId),this.itemEntryService.processLocal(e,r.fields,{},{},o),this.setCreator(e),this.itemEntryService.resolve(e),{main:e,linked:this.createLocalEntries(i,n,r,o)}},e.prototype.resolveExpansion=function(e,t,r){var i=e.itemType,n=e.itemId,o=t.run(e.columns,!0);return null===o?e:(this.itemEntryService.expand(e,r.fetchObject(i,n),r.fetchDerivedObject(i,n,o.difference.root),o),this.itemEntryService.resolve(e))},e.prototype.resolveRemote=function(e,t,r){var i=e.itemType,n=e.itemId,o=r.fetchObject(i,n);return void 0===o?(this.itemEntryService.reject(e),this.entries.clear(e),null):this.resolveDeferredEntry(e,o,r.fetchDerivedObject(i,n,t.root),t)},e.prototype.fetchTemplate=function(e,t,r){var i=this;void 0===t&&(t={}),void 0===r&&(r={});var n=o(t),c=s(r);if(!n){var a=this.templates[e];if(void 0!==a&&(null===c||this.columnUtil.responseColumnsAvailable(c,r[c],a.responseColumns)))return this.promiseService.when(a)}return this.promiseService.all([this.apiRequestService.template(e,t),null===c?{}:this.columnHandler.fetch(c,r[c])]).then(function(t){var r=t[0],o=i.columnUtil.mergeResponseColumns(r.fetchColumnsObject(),t[1]).merged,s={fields:r.fetchObject(e,r.links[e][0]),columns:i.columnSetFactory.construct(e,!0,o),response:r,responseColumns:o};return!n&&r.cacheable&&(i.templates[e]=s),s},this.errorHandler.reject)},e.prototype.getEntryStatus=function(e,t,r){var i=this.entries.get(e,t);return void 0===i?this.keyService.isLocalId(t)?{entry:this.createDeferredEntry(e,t,!0,!1),status:k.LOCAL}:{entry:this.createDeferredEntry(e,t,r.columns,r.deferRequest),status:r.deferRequest?k.PROMISED:k.RESOLVE}:{entry:i,status:this.getCachedEntryStatus(i,r)}},e.prototype.getCachedEntryStatus=function(e,t){var r=e.columns,i=this.itemEntryService.isLocal(e)||this.columnUtil.isColumnSubset(t.columns,r.request,r.true);return void 0!==e.deferred?e.deferRequest?(r.request=this.columnUtil.mergeRequestColumns(r.request,t.columns).merged,k.RESOLVE):i?k.PROMISED:k.PROMISED_EXPAND:i?k.CACHED:(this.itemEntryService.defer(e,!1),k.EXPAND)},e.prototype.createDeferredEntry=function(e,t,r,i){var n=this.createEntryStub(e,t);return n.columns={itemType:e,request:r,true:!0===r},this.itemEntryService.defer(n,i)},e.prototype.createEntryStub=function(e,t){return this.entries.add(this.itemEntryFactory.construct(e,t))},e.prototype.createEntry=function(e,t,r,i){return this.itemEntryService.process(this.entries.add(this.itemEntryFactory.construct(i.itemType,e,i,t,r)))},e.prototype.resolveDeferredEntry=function(e,t,r,i){return e.columns=i,e.initial=t,e.derived=r,this.itemEntryService.process(e),this.itemEntryService.resolve(e)},e.prototype.batchResolve=function(e,t,r,i){var n=this,o=i.requests,s=[k.EXPAND,k.PROMISED_EXPAND],c=[k.RESOLVE],a=!0;if(t.hasEntries(s)){var u=this.columnExpansionFactory.construct(e,r,o.fetchColumnsObject());t.forEachEntry(s,function(e){n.resolveExpansion(e,u,o)})}if(t.hasEntries(c)){var l=this.columnSetFactory.construct(e,r,o.fetchColumnsObject());t.forEachEntry(c,function(e){null===n.resolveRemote(e,l,o)&&(a=!1)})}return t.forEachEntry([k.LOCAL],function(e){n.resolveLocal(e,null,i.template)}),a?t.getArray():this.errorHandler.reject({message:this.itemEntryService.undefinedItemError})},e.prototype.cloneItem=function(e,t,r){var i=t.columns,n=t.parent;void 0===r&&((o={})[t.itemType]=((s={})[t.itemId]=e,s),r=o);var o,s,c=this.createEntry(e,this.apiFormatter.copyFields(this.itemEntryService.getFields(t),{},i.main),this.apiFormatter.copyFields(t.derived,{},i.derived),i);return this.itemEntryService.updateItemFields(c,r),c.modified=this.apiFormatter.copyFields(c.initial,{},i.main),n?this.itemEntryService.setParent(c,n.itemType,n.itemId):c},e.prototype.createConversionMap=function(e,t,r,i){var n,o,s=i.links[e][0],c=((n={})[e]=((o={})[s]=t,o),n);return r&&this.extendConversionMap(c,i.items[e][s].links,i),c},e.prototype.createLocalEntries=function(e,t,r,i){var n=this,o=this,s=r.response,c={},a={},u=[];for(var l in s.items)l!==e&&(c[l]=this.columnSetFactory.construct(l,!0,r.responseColumns));var h=function(e,t,r){var l={itemType:e,itemId:t},p=s.items[e][r].links;for(var m in p){var d=p[m];void 0===a[m]&&u.push({itemType:m,itemEntries:a[m]=[]});for(var f=0,v=d;f<v.length;f++){var y=v[f],g=i[m][y],C=o.createEntryStub(m,g);C.columns=c[m],C.parent=l,n.itemEntryService.processLocal(C,s.fetchObject(m,y),{},{},i),n.setCreator(C),a[m].push(C),h(m,g,y)}}};return h(e,t,s.links[e][0]),u},e.prototype.createLocalEntry=function(e,t,r,i,n){void 0===n&&(n=null);var o=t.columns.itemType,s=this.createEntryStub(o,e);return s.columns=t.columns,null!==n&&(s.parent=n),this.itemEntryService.processLocal(s,t.fields,r,i,this.createConversionMap(o,e,!1,t.response)),this.setCreator(s),s},e.prototype.extendConversionMap=function(e,t,r){for(var i in t){var n=t[i];void 0===e[i]&&(e[i]={});for(var o=0,s=n;o<s.length;o++){var c=s[o];e[i][c]=this.keyService.getLocalId(),this.extendConversionMap(e,r.items[i][c].links,r)}}},e.prototype.fetchTitle=function(e,t,r){void 0===r&&(r=!0);var i=this.itemEntryService.getTitleField(e);return this.fetchItem(e,t,this.itemEntryService.processOptions({columns:[i],deferRequest:r})).then(function(e){return void 0!==e.main?e.main.initial[i]:void 0!==e.modified?e.modified[i]:e.initial[i]},this.errorHandler.reject)},e.prototype.requestItem=function(e,t,r){var i,n=((i={})[e]=r,i);return this.apiRequestService.query(e,{id:t},n)},e.prototype.updateItemId=function(e,t){var r=e.itemId;return e.itemId=t,this.entries.updateItemId(e,r)},e.prototype.setCreator=function(e){e.modified.creator=this.authInterface.getUserId(),e.derived["creator>displayname"]=this.authInterface.getUserDisplayname()},e}(),ee=function(){function e(e,t,r,i,n,o,s,c,a){this.apiRequestService=e,this.errorHandler=t,this.itemHandler=r,this.columnHandler=i,this.columnExpansionFactory=n,this.columnSetFactory=o,this.itemEntryService=s,this.queryService=c,this.promiseService=a}return e.prototype.requestItem=function(e,t,r){var i,n=((i={})[e]=r,i);return this.apiRequestService.query(e,{id:t},n)},e.prototype.requestItems=function(e,t,r){void 0===t&&(t=e.query.object),void 0===r&&(r=e.options.columns);var i,n=e.options,o={requestType:"query",columns:((i={})[e.itemType]=r,i),query:t,itemType:"",allLinkIds:!1,limit:null};return null===n.queryItemType?o.itemType=e.itemType:(o.itemType=n.queryItemType,o.allLinkIds=!0),null!==n.limit&&(o.limit=n.limit),this.apiRequestService.requestSkeleton(o)},e.prototype.requestLinkItems=function(e,t,r,i,n){var o,s=((o={})[r]=n,o);return null===i?this.apiRequestService.query(e,{id:t},s):this.apiRequestService.query(r,this.queryService.addAndCondition(i,{linkedTo:e,query:{id:t}}),s)},e.prototype.processExpansion=function(e,t,r,i){for(var n=this.columnExpansionFactory.construct(r,e,t.fetchColumnsObject()),o=0,s=i;o<s.length;o++){var c=s[o];this.itemEntryService.isLocal(c)||this.handleCachedItem(c,t,n)}return n},e.prototype.processResponse=function(e,t,r,i,n){var o=this;void 0===n&&(n=this.columnExpansionFactory.construct(i.itemType,!!i.true||i.request,i.response));for(var s=i.itemType,c=i.root,a=[],u=[],l=0,h=t;l<h.length;l++){var p=h[l],m=this.itemHandler.entries.get(s,p);void 0===m?(m=this.itemHandler.createEntry(p,e.fetchObject(s,p),e.fetchDerivedObject(s,p,c),i),a.push(m)):void 0!==m.deferred?m.deferRequest?a.push(this.itemHandler.resolveDeferredEntry(m,e.fetchObject(s,p),e.fetchDerivedObject(s,p,c),i)):u.push(m.deferred.promise):a.push(this.handleCachedItem(m,e,n)),null!==r&&(m.parent=r)}return this.promiseService.all(u).then(function(t){for(var r=0,i=t;r<i.length;r++){var s=i[r];a.push(o.handleCachedItem(s,e,n))}return a},this.errorHandler.reject)},e.prototype.handleCachedItem=function(e,t,r){var i=r.run(e.columns,!0);return null===i?e:this.itemEntryService.expand(e,t.fetchObject(e.itemType,e.itemId),t.fetchDerivedObject(e.itemType,e.itemId,i.difference.root),i)},e.prototype.processLinkResponse=function(e,t,r,i,n){for(var o=e.fetchColumnsObject(),s=this.columnSetFactory.construct(i,n.columns,o),c=this.columnExpansionFactory.construct(i,n.columns,o),a=e.items[t],u={},h=0,p=r;h<p.length;h++){var m=p[h];u[m]=l(a,[m,"links",i])?this.processResponse(e,a[m].links[i],{itemType:t,itemId:m},s,c):[]}return this.promiseService.all(u).then(function(e){return{items:e,columns:s,columnExpansion:c}},this.errorHandler.reject)},e}(),te=function(){function e(){}return e.prototype.processOptions=function(e){return n(e,{edit:!1,onChange:Xe,onDeactivate:Xe})},e.prototype.compareOptions=function(e,t){for(var r in e)if(e[r]!==t[r])return!1;return!0},e.prototype.isNewResource=function(e){return e.isLocal()&&void 0===e.transactions},e}(),re=function(){function e(){this.NEW_PREFIX="-1",this.DUPLICATE_PREFIX="-2",this.NEW_KEYWORD="new-",this.DUPLICATE_KEYWORD="dup-",this.seperator=":"}return e.prototype.getSingleKey=function(e,t){return e.concat(this.seperator,String(t))},e.prototype.getCollectionCacheKey=function(e,t,r){return e.concat(this.seperator,String(t),this.seperator,r)},e.prototype.getCssKey=function(){return Array.prototype.join.call(arguments,"_")},e.prototype.parseStateKey=function(e){return 0===(e=e.toString()).indexOf(this.NEW_KEYWORD)?{type:"new",template:e.substring(this.NEW_KEYWORD.length)}:0===e.indexOf(this.DUPLICATE_KEYWORD)?{type:"duplicate",itemId:e.substring(this.DUPLICATE_KEYWORD.length)}:null},e.prototype.getDuplicateStateKey=function(e){return this.DUPLICATE_KEYWORD.concat(String(e))},e.prototype.getNewStateKey=function(e){return this.NEW_KEYWORD.concat(e)},e.prototype.getLocalId=function(){return parseInt(this.NEW_PREFIX.concat(this.getRandomString()),10)},e.prototype.getLocalDuplicateId=function(){return parseInt(this.DUPLICATE_PREFIX.concat(this.getRandomString()),10)},e.prototype.getRandomString=function(){return Math.random().toString().split(".")[1].substr(0,8)},e.prototype.isLocalId=function(e){return void 0!==e&&(this.isNewId(e)||this.isDuplicateId(e))},e.prototype.isNewId=function(e){return 0===e.toString().indexOf(this.NEW_PREFIX)||e===this.NEW_KEYWORD},e.prototype.isDuplicateId=function(e){return 0===e.toString().indexOf(this.DUPLICATE_PREFIX)||e===this.DUPLICATE_KEYWORD},e}(),ie=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m){this.apiRequestService=e,this.errorHandler=t,this.itemHandler=r,this.collectionHandler=i,this.columnHandler=n,this.lockService=o,this.itemResourceFactory=s,this.collectionCacheFactory=c,this.changesProcessorFactory=a,this.itemCacheFactory=u,this.collectionResourceFactory=l,this.itemEntryService=h,this.itemResourceService=p,this.promiseService=m,this.collectionOptions={},this.tabRequestParameters={},this.callbacks={onBeforeSave:{},onSaveSuccess:{},onSaveWithoutClosing:{}},this.changesInterval=null,this.hasChanges=!1,this.collections=this.collectionCacheFactory.construct(),this.deferredCollections=this.collectionCacheFactory.construct(),this.items=this.itemCacheFactory.construct()}return e.prototype.addSingleItem=function(e,t,r){var i=this;return r&&(this.rootItem=e),this.items.contains(e.itemType,e.itemId)||this.items.add(e),(t=this.itemResourceService.processOptions(t)).onDeactivate=function(e){return i.clearItem(e)},this.itemResourceFactory.construct(e,t)},e.prototype.addCollection=function(e,t){var r=this;this.collections.contains(e)||this.collections.add(e);var i=e.id;if(void 0===this.collectionOptions[i])this.collectionOptions[i]={edit:t.editCollection,editItems:t.editItems};else{var n=this.collectionOptions[i];n.edit=n.edit||t.editCollection,n.editItems=n.editItems||t.editItems}return t.onDeactivateItem=function(e){return r.clearItem(e)},t.onDeactivateCollection=function(e){return r.clearCollection(e)},this.collectionResourceFactory.construct(e,t)},e.prototype.clearCollection=function(e){var t=e.entry;this.collections.clear(t),t.clearResources()},e.prototype.clearItem=function(e){var t=e.entry;this.items.clear(t),this.itemEntryService.clearResources(t)},e.prototype.clearResources=function(e){var t=this;void 0===e&&(e=!1),this.items.forEach(function(e){t.itemEntryService.clearResources(e)}),this.collections.forEach(function(t){t.clearResources(e)}),e||this.collections.clear()},e.prototype.updateSingleItems=function(e){for(var t in e)for(var r in e[t]){var i=this.items.get(t,r);void 0!==i&&this.items.updateItemId(i,r)}},e.prototype.revertChanges=function(){var e=this;return this.items.forEach(function(t){return e.itemEntryService.resetModified(t)}),this.collections.forEach(function(t){return e.resetCollection(t)}),this.hasChanges=!1,this.isLockable()?this.lockService.deleteLock(this.rootItem):this.promiseService.when()},e.prototype.resetCollection=function(e){var t=this.collectionOptions[e.id];if(t.edit&&e.revertChanges(),t.editItems)for(var r=0,i=e.items;r<i.length;r++){var n=i[r];this.itemEntryService.resetModified(n)}},e.prototype._hasChanges=function(){return this.hasChanges||(this.hasChanges=this.detectChanges()),this.hasChanges},e.prototype.detectChanges=function(){var e=this;return!!this.items.some(function(t){return e.itemEntryService.hasChanges(t)})||this.collections.some(function(t){e.collectionHasChanges(t)})},e.prototype.collectionHasChanges=function(e){var t=this.collectionOptions[e.id];return!(!t.edit||!e.hasAddedItems()&&!e.hasRemovedItems())||t.editItems&&e.hasUpdatedItems()},e.prototype.isLockable=function(){return void 0!==this.rootItem&&this.itemEntryService.isLockable(this.rootItem)},e.prototype.save=function(e,t,r,i){var n=this;return void 0===e&&(e=!1),(this.isLockable()?this.lockService.fetchLock(this.rootItem):this.promiseService.when()).then(function(t){return n.executeCallbacks("onBeforeSave",e)},this.errorHandler.reject).then(function(){var e=d({},n.tabRequestParameters,t);return n.tabRequestParameters={},n.changesProcessorFactory.construct().execute(n.items.toArray(),n.collections.toArray(),r,e,n.collectionOptions,i)},this.errorHandler.reject).then(function(t){return n.isLockable()&&n.lockService.clearLock(n.rootItem),n.hasChanges=!1,e||n.updateSingleItems(t),n.executeCallbacks("onSaveSuccess",t).then(function(){return e||n.executeCallbacks("onSaveWithoutClosing",t,!0),t},n.errorHandler.reject)},this.errorHandler.reject)},e.prototype.executeCallbacks=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var i={};for(var n in this.callbacks[e])i[n]=this.callbacks[e][n].apply(void 0,t);return this.promiseService.all(i)},e.prototype.enableChangesWatcher=function(){var e=this;null!==this.changesInterval&&(console.warn("Changes watcher already running!",this),this.disableChangesWatcher()),this.changesInterval=setInterval(function(){e.hasChanges&&(e.disableChangesWatcher(),e.isLockable()&&e.lockService.fetchLock(e.rootItem))},3e3)},e.prototype.enableWatcher=function(){this.enableChangesWatcher()},e.prototype.disableChangesWatcher=function(){clearInterval(this.changesInterval),this.changesInterval=null},e.prototype.disableWatcher=function(){this.disableChangesWatcher()},e.prototype.registerCallback=function(e,t,r){var i=this;return this.callbacks[e][t]=r,function(){delete i.callbacks[e][t]}},e}(),ne=function(){function e(e,t,r,i){this.apiRequestService=e,this.errorHandler=t,this.keyService=r,this.promiseService=i,this.lockItems={},this.promises={}}return e.prototype.getValue=function(e,t){var r=e.itemType;if(void 0!==t[r])return t[r][e.itemId]},e.prototype.setValue=function(e,t,r){return h(r,[e.itemType,e.itemId],[{},t])},e.prototype.getLocks=function(){return this.lockItems},e.prototype.hasLock=function(e){for(var t in this.lockItems)for(var r in this.lockItems[t]){var i=this.lockItems[t][r];if(!i.isForeign&&i.id==e)return!0}return!1},e.prototype.isLocked=function(e){var t=this.getValue(e,this.lockItems);return void 0!==t&&t.isForeign},e.prototype.getMessage=function(e){var t=this.getValue(e,this.lockItems);if(void 0!==t&&t.isForeign)return t.message},e.prototype.fetchCachedLock=function(e){var t=this.getValue(e,this.lockItems);if(void 0!==t)return this.promiseService.when(t);var r=this.getValue(e,this.promises);return void 0!==r?r:this.promiseService.when()},e.prototype.fetchLock=function(e){var t=this;return this.fetchCachedLock(e).then(function(r){return void 0!==r?r:t.requestLock(e)},this.errorHandler.reject).then(function(e){return e.isForeign?t.errorHandler.reject(e.message):e.token},this.errorHandler.reject)},e.prototype.requestLock=function(e){var t=this,r=e.itemType,i=e.itemId,n=this.apiRequestService.create("Locktoken",this.keyService.getLocalId(),{itemtype:r,item:i}).then(function(n){return delete t.promises[r][i],t.setValue(e,n.fetchObject("Locktoken",n.links.Locktoken[0]),t.lockItems)},function(n){return delete t.promises[r][i],301===n.code?t.setValue(e,{isForeign:!0,message:n.message},t.lockItems):t.errorHandler.reject(n)});return this.setValue(e,n,this.promises)},e.prototype.deleteLock=function(e){var t=this;return this.fetchCachedLock(e).then(function(r){if(void 0!==r){if(!r.isForeign)return t.apiRequestService.delete("Locktoken",r.id).then(function(){t.clearLock(e)},t.errorHandler.reject);t.clearLock(e)}},this.errorHandler.reject)},e.prototype.clearLock=function(e){var t=e.itemType;return void 0!==this.lockItems[t]&&delete this.lockItems[t][e.itemId]},e}(),oe={},se=function(){function e(e,t,r,i){this.itemEntryService=e,this.rootItemEntry=t,this.singleItemCache=r,this.collectionCache=i,this.parentMap={},this.destination={}}return e.prototype.process=function(){return this.parentMap=this.createParentMap(this.singleItemCache),this.processItems(this.rootItemEntry.itemType,[this.rootItemEntry],{}),{itemType:this.rootItemEntry.itemType,itemId:this.rootItemEntry.itemId,items:this.destination}},e.prototype.createParentMap=function(e){var t={};return e.forEach(function(e){var r=e.itemType,i=e.parent;if(null!==i){var n=i.itemType,o=i.itemId;void 0===t[n]&&(t[n]={});var s=t[n];void 0===s[o]&&(s[o]={}),void 0===(s=s[o])[r]&&(s[r]=[]),s[r].push(e)}}),t},e.prototype.processItems=function(e,t,r){void 0===this.destination[e]&&(this.destination[e]={}),void 0===r[e]&&(r[e]=[]);for(var i=0,n=t;i<n.length;i++){var o=n[i],s=o.itemId;void 0===this.destination[e][s]&&(r[e].push(s),this.destination[e][s]=this.processItem(o))}},e.prototype.processItem=function(e){var t=e.itemType,r=e.itemId,i=this.getItemsByParent(t,r),n=this.collectionCache.getCollectionsByParent(t,r),s=this.itemEntryService.formatRequest(e),c={};for(var a in i)this.processItems(a,i[a],c);for(var u=0,l=n;u<l.length;u++){var h=l[u];null===h.options.query&&this.processItems(h.itemType,h.items,c)}var p=o(s),m=o(c);return p&&m?{values:s,links:c}:p?{values:s}:m?{links:c}:oe},e.prototype.getItemsByParent=function(e,t){var r=this.parentMap[e];return void 0===r?{}:void 0===r[t]?{}:r[t]},e}(),ce="maybe",ae=function(){function e(e,t,r,i,n){this.apiFormatter=e,this.parentType=t,this.parentId=r,this.fields=i,this.itemType=n}return e.prototype.compareValues=function(e,t){return i.isMoment(t)?this.apiFormatter.compareMomentObjects(t,e):i.isDuration(t)?this.apiFormatter.compareDurations(t,e):t==e},e.prototype.matchQuery=function(e){if(void 0!==e.search)return ce;if(void 0!==e.custom)return ce;if(void 0!==e.linkedTo)return this.matchLinkedToQuery(e);if(void 0!==e.conditions)return this.matchComplexQuery(e);if(void 0!==e.key)return this.matchSimpleQuery(this.fields[e.key],e);if(!o(e))return!0;throw new Error("queryMatcher: Unsupported query! Parsed?")},e.prototype.matchLinkedToQuery=function(e){return e.reverse?ce:(t=e.linkedTo===this.parentType&&this.matchSimpleQuery(this.parentId,e.query))===ce?ce:e.not?!t:t;var t},e.prototype.matchComplexQuery=function(e){var t,r,i=e.conditions;switch(e.operator){case"AND":t=!0,r=!1;break;case"OR":t=!1,r=!0;break;default:throw new Error("queryMatcher: Unsupported operator")}for(var n=0,o=i;n<o.length;n++){var s=o[n],c=this.matchQuery(s);if(c===r)return r;c===ce&&(t=ce)}return t},e.prototype.matchSimpleQuery=function(e,t){var r=t.key,n=t.value;if(!o(t))return!0;if(void 0===e)return console.warn("Required field",r,"not found for",this.itemType),ce;switch("NOW"===n&&(n=i()),t.comparator){case"=":return this.compareValues(e,n);case"!=":return!this.compareValues(e,n);case"<":return e<n;case"<=":return e<=n;case">":return e>n;case">=":return e>=n;case"IN":return c(e,n);case"NOT IN":return!c(e,n);default:throw new Error("queryMatcher: Unsupported comparator: "+t.comparator+" in query "+t)}},e}();!function(e){e[e.OBJ=0]="OBJ",e[e.STR=1]="STR",e.SEP=":"}(A||(A={}));var ue,le=function(){function e(e,t){this.query=e,this.parameters=t}return e.prototype.processValue=function(e){return Array.isArray(e)?e.slice().sort():i.isMoment(e)?i(e):i.isDuration(e)?i.duration(e):e},e.prototype.compareParsedQueries=function(e,t){return e[A.STR]===t[A.STR]?0:e[A.STR]>t[A.STR]?1:-1},e.prototype.parse=function(e){if(void 0===e&&(e=this.query),void 0!==e.linkedTo)return this.parseLinkedToQuery(e.linkedTo,e.query,e.reverse,e.not);if(void 0!==e.not)throw new Error('queryParser: "Not" not supported');if(void 0!==e.custom)return this.parseCustomQuery(e.custom,e.parameters);if(void 0!==e.search)return this.parseSearchQuery(e.search);if(void 0!==e.conditions)return this.parseComplexQuery(e.conditions,e.operator);if(void 0!==e.key)return this.parseSimpleQuery(e.key,e.value,e.comparator);if(!o(e))return[{},"{}"];var t=s(e);return this.parseSimpleQuery(t,e[t])},e.prototype.parseSearchQuery=function(e){return[{search:(e=this.formatValue(e))[A.OBJ]},"[search"+A.SEP+e[A.STR]+"]"]},e.prototype.parseCustomQuery=function(e,t){if(void 0===t)return[{custom:e},"["+e+"]"];var r=this.parseCustomParameters(t);return[{custom:e,parameters:r[A.OBJ]},"["+e+A.SEP+r[A.STR]+"]"]},e.prototype.parseCustomParameters=function(e){for(var t=Object.keys(e).sort(),r={},i="",n=0;n<t.length;n++){var o=t[n],s=this.formatValue(e[o]);r[o]=s[A.OBJ],n>0&&(i+=A.SEP),i+=s[A.STR]}return[r,i]},e.prototype.parseSimpleQuery=function(e,t,r){return t=this.formatValue(t),void 0===r&&(r=Array.isArray(t[A.OBJ])?"IN":"="),[{key:e,value:t[A.OBJ],comparator:r},"["+r+A.SEP+e+A.SEP+t[A.STR]+"]"]},e.prototype.parseLinkedToQuery=function(e,t,r,i){void 0===t&&(t={}),void 0===r&&(r=!1),void 0===i&&(i=!1);var n=this.parse(t);return[{linkedTo:e,query:n[A.OBJ],reverse:r,not:i},"[linkedTo"+A.SEP+e+A.SEP+n[A.STR]+A.SEP+r+A.SEP+i+"]"]},e.prototype.parseComplexQuery=function(e,t){t=void 0===t?"AND":t.toUpperCase();var r=this.parseConditions(e);return[{conditions:r[A.OBJ],operator:t},"["+t+r[A.STR]+"]"]},e.prototype.parseConditions=function(e){for(var t=this,r=[],i=[],n="",o=0,s=e;o<s.length;o++){var c=s[o];r.push(this.parse(c))}for(var a=0,u=r=r.sort(function(e,r){return t.compareParsedQueries(e,r)});a<u.length;a++){var l=u[a];i.push(l[A.OBJ]),n+=l[A.STR]}return[i,n]},e.prototype.formatValue=function(e){var t;if("string"==typeof e&&"&"===e.charAt(0)){var r=e.substring(1);if(void 0===(e=this.parameters[r]))throw new Error("queryParser: Undefined template parameter '"+r+"'");return[t=this.processValue(e),r+">"+e]}return[t=this.processValue(e),""+t]},e}(),he=function(){function e(){}return e.prototype.addAndCondition=function(e,t){return void 0===e.conditions||"or"===e.operator?{conditions:[e,t]}:{conditions:e.conditions.concat(t)}},e.prototype.addOrCondition=function(e,t){return"or"===e.operator?{conditions:e.conditions.concat(t)}:{conditions:[e,t],operator:"or"}},e.prototype.addParentCondition=function(e,t){var r;return null===t?e:(r={linkedTo:t.itemType,query:t.itemId},null===e?r:this.addAndCondition(e,r))},e.prototype.createNotIn=function(e){return{comparator:"NOT IN",key:"id",value:e}},e}(),pe=function(){function e(e){this.columnUtil=e,this.columns={},this.columnInfoIdMap={}}return e.prototype.expand=function(e){if(!this.columnInfoIdMap[e.id]){var t=e.itemType;void 0===this.columns[t]&&(this.columns[t]=[]),this.columns[t]=this.columnUtil.mergeRequestColumns(this.columns[t],e.request).merged,this.columnInfoIdMap[e.id]=!0}},e.prototype.get=function(){return this.columns},e}(),me=function(){function e(e,t,r,i,n,o,s,c,a,u){this.promiseService=e,this.apiRequestService=t,this.itemHandler=r,this.itemEntryService=i,this.collectionHandler=n,this.columnSetFactory=o,this.columnExpansionFactory=s,this.requestColumnExpansionFactory=c,this.apiFormatter=a,this.errorHandler=u}return e.prototype.onMessageReceived=function(e){switch(e.body.eventType){case"update":return this.handleUpdate(e);case"create":return this.handleCreate(e);case"delete":return this.handleDelete(e);case"linkTo":return this.handleLinkMove(e)}},e.prototype.formatMessageValues=function(e,t){var r={};for(var i in t)r[i]=this.apiFormatter.formatResponseValue(t[i].type,e[i]);return r},e.prototype.createCollectionMap=function(e,t,r){var i={};for(var n in t){var o=t[n],s=null!==o.parent?o.parent:{};i[n]=this.collectionHandler.entries.getByFittingItem(s.itemType,s.itemId,e,this.formatMessageValues(o.values,r))}return i},e.prototype.groupByCollectionId=function(e,t){var r={};for(var i in t){var n=t[i];for(var o in n)for(var s=0,c=n[o];s<c.length;s++){var a=c[s],u=a.id;void 0===r[u]&&(r[u]={collection:a,fitting:[],notfitting:[],maybe:[]}),r[u][o].push("fitting"===o?this.itemHandler.entries.get(e,i):i)}}return r},e.prototype.getRequestColumns=function(e,t){var r=this.requestColumnExpansionFactory.construct();for(var i in t){for(var n=t[i].fitting,o=this.itemHandler.entries.get(e,i),s=0,c=n;s<c.length;s++){var a=c[s];r.expand(a.columns)}void 0!==o&&r.expand(o.columns)}return r.get()},e.prototype.deferEntry=function(e){var t=e.deferred;return void 0===t?this.itemEntryService.defer(e,!1):t.promise.then(this.deferEntry.bind(this),this.errorHandler.reject)},e.prototype.processMessage=function(e){var t=this,r=e.itemType,i=this.createCollectionMap(r,e.items[r],e.columns[r]),n=this.getRequestColumns(r,i),o=[],s=[];for(var c in i){var a=this.itemHandler.entries.get(r,c);void 0===a?0!==i[c].fitting.length&&(this.itemHandler.createDeferredEntry(r,parseInt(c,10),n[r],!1),s.push(c)):(o.push(this.deferEntry(a)),s.push(c))}return 0===s.length?this.promiseService.when(this.groupByCollectionId(r,i)):this.promiseService.all(o).then(function(){return t.apiRequestService.query(r,{id:s},n)},this.errorHandler.reject).then(function(e){return t.handleResponse(r,s,n[r],e,i)},this.errorHandler.reject)},e.prototype.processFunctionChangesResolve=function(e){var t=this,r=e.items.FunctionChangesResolve,i=[],n=[];for(var o in r){var s=r[o].parent.itemId,c=this.itemHandler.entries.get("Functie",s);void 0!==c&&void 0!==c.columns.response.Functie.newchanges&&(i.push(this.deferEntry(c)),n.push(s))}if(0!==n.length)return this.promiseService.all(i).then(function(){return t.apiRequestService.query("Functie",{id:n},{Functie:["newchanges"]})},this.errorHandler.reject).then(function(e){for(var r=0,i=e.links.Functie;r<i.length;r++){var n=i[r],o=t.itemHandler.entries.get("Functie",n),s=t.apiFormatter.copyFields(t.itemEntryService.getFields(o),{},o.columns.main),c=e.fetchValue("Functie",n,"newchanges");if(c===s.newchanges)return;t.itemEntryService.setInitial(o,{newchanges:c},!0),t.itemEntryService.callOnChange(o,s),t.itemEntryService.resolve(o)}},this.errorHandler.reject).catch(this.errorHandler.notifyError)},e.prototype.handleResponse=function(e,t,r,i,n){for(var o=i.fetchColumnsObject(),s=this.columnSetFactory.construct(e,r,o),c=this.columnExpansionFactory.construct(e,r,o),a=0,u=t;a<u.length;a++){var l=u[a],h=this.itemHandler.entries.get(e,l),p=void 0===h.initial,m=i.fetchObject(e,l);if(void 0!==m){var d=i.fetchDerivedObject(e,l,s.root);if(p)this.itemHandler.resolveDeferredEntry(h,m,d,s);else{var f=c.run(h.columns,!0),v=this.apiFormatter.copyFields(this.itemEntryService.getFields(h),{},h.columns.main);null!==f&&this.itemEntryService.expand(h,m,d,f),this.itemEntryService.setDerived(h,d),this.itemEntryService.updateFields(h,m,!1),this.itemEntryService.callOnChange(h,v),this.itemEntryService.resolve(h)}}else this.itemEntryService.reject(h),p&&this.itemHandler.entries.clear(h),delete n[l]}return this.groupByCollectionId(e,n)},e.prototype.handleCreate=function(e){var t=this,r=e.body;return"FunctionChangesResolve"===r.itemType?this.processFunctionChangesResolve(r):this.processMessage(r).then(function(e){return t.collectionHandler.addToCollections(e,!0)},this.errorHandler.reject).catch(this.errorHandler.notifyError)},e.prototype.handleUpdate=function(e){var t=this;return this.processMessage(e.body).then(function(e){return t.collectionHandler.removeFromAndAddToCollections(e,!0)},this.errorHandler.reject).catch(this.errorHandler.notifyError)},e.prototype.handleDelete=function(e){for(var t=e.body,r={},i=0,n=t.items;i<n.length;i++)for(var o=n[i],s=0,c=this.collectionHandler.entries.getByContainingItem(t.itemType,o);s<c.length;s++){var a=c[s];void 0===r[u=a.id]&&(r[u]={collection:a,items:[]}),r[u].items.push(o)}for(var u in r){var l=r[u];l.collection.removeItems(l.items,null,!0)}return this.promiseService.when()},e.prototype.handleLinkMove=function(e){return this.promiseService.when()},e}(),de=function(){function e(e){this.apiFormatter=e}return e.prototype.construct=function(e){return new j(this.apiFormatter,e)},e}(),fe=function(){function e(e){this.promiseService=e}return e.prototype.construct=function(e,t){return new D(this.promiseService,e,t)},e}(),ve=function(){function e(e){this.itemEntryService=e}return e.prototype.construct=function(e,t,r){return new P(this.itemEntryService,e,t,r)},e}(),ye=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p){this.apiRequestService=e,this.errorHandler=t,this.itemHandler=r,this.collectionHandler=i,this.columnHandler=n,this.changesCompilerFactory=o,this.createRequestFactory=s,this.columnExpansionFactory=c,this.requestColumnExpansionFactory=a,this.collectionEntryService=u,this.itemEntryService=l,this.apiFormatter=h,this.promiseService=p}return e.prototype.construct=function(){return new L(this.apiRequestService,this.itemHandler,this.errorHandler,this.collectionHandler,this.columnHandler,this.changesCompilerFactory,this.createRequestFactory,this.columnExpansionFactory,this.requestColumnExpansionFactory,this.collectionEntryService,this.itemEntryService,this.apiFormatter,this.promiseService)},e}(),ge=function(){function e(e){this.queryMatcherFactory=e}return e.prototype.construct=function(){return new _(this.queryMatcherFactory)},e}(),Ce=function(){function e(e,t,r){this.itemEntryService=e,this.entry=t,this.options=r,this.derived=t.derived,this.columns=t.columns.response[t.columns.itemType],t.resources.push(this)}return e.prototype.isNewResource=function(e){return this.itemEntryService.isLocal(e.entry)&&void 0===e.transactions},e.prototype.isLocal=function(){return this.itemEntryService.isLocal(this.entry)},e.prototype.clearResource=function(){var e=this.entry.resources,t=e.indexOf(this);-1!==t&&e.splice(t,1)},e.prototype.deactivate=function(){this.options.onDeactivate(this)},e}(),Se=(ue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}ue(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Ie=function(e){function t(t,r,i){var n=e.call(this,t,r,i)||this;return n.fields=void 0===r.modified?r.initial:r.modified,n}return Se(t,e),t}(Ce),Ee=function(){function e(e,t,r){this.itemResourceFactory=e,this.entry=t,this.options=r,this.itemIdMap={},this.columns=t.columns.response,this.itemIdMap={},this.items=[],t.resources.push(this),this.addItemResources(t.items)}return e.prototype.getItemById=function(e){return this.itemIdMap[e]},e.prototype.rebuildMap=function(){for(var e={},t=0,r=this.items;t<r.length;t++){var i=r[t];e[i.entry.itemId]=i}this.itemIdMap=e},e.prototype.addItemResources=function(e){if(0===e.length)return[];for(var t=[],r=this.options,i=this.items,n=this.itemIdMap,o=this.itemResourceFactory.getConstructor({edit:r.editItems,onChange:r.onChange,onDeactivate:r.onDeactivateItem}),s=0,c=e;s<c.length;s++){var a=c[s],u=a.itemId,l=void 0;void 0===n[u]?(l=o(a),i.push(l),n[u]=l):l=n[u],t.push(l)}return t},e.prototype.removeItemResources=function(e){var t=this,r=[];return a(this.items,function(i){for(var n=0,o=e;n<o.length;n++){var s=o[n];if(i.entry===s)return r.push(i),delete t.itemIdMap[s.itemId],!1}return!0}),r},e.prototype.callOnAdd=function(e){this.options.onAdd(e,this)},e.prototype.callOnRemove=function(e){this.options.onRemove(e,this)},e.prototype.forEach=function(e){for(var t=0,r=this.items;t<r.length;t++){e(r[t])}},e.prototype.filter=function(e){for(var t=[],r=0,i=this.items;r<i.length;r++){var n=i[r];e(n)&&t.push(n)}return t},e.prototype.first=function(e){for(var t=0,r=this.items;t<r.length;t++){var i=r[t];if(e(i))return i}return null},e.prototype.some=function(e){return null!==this.first(e)},e.prototype.groupBy=function(e){var t=this.items,r={};if("string"==typeof e)for(var i=0,n=t;i<n.length;i++){void 0===r[a=(c=n[i]).fields[e]]&&(r[a]=[]),r[a].push(c)}if("function"==typeof e)for(var o=0,s=t;o<s.length;o++){var c,a;null!==(a=e(c=s[o]))&&(void 0===r[a]&&(r[a]=[]),r[a].push(c))}return r},e.prototype.map=function(e){var t=this.items,r=t.length,i=new Array(r);if("string"==typeof e)for(var n=0;n<r;n++)i[n]=t[n].fields[e];if("function"==typeof e)for(n=0;n<r;n++)i[n]=e(t[n]);return i},e.prototype.reduce=function(e,t){for(var r=0,i=this.items;r<i.length;r++){t=e(i[r],t)}return t},e.prototype.extend=function(e,t,r){var i=this;return void 0===r&&(r=!0),this.entry.extend(e,this,r).then(function(e){return t?i.items:e})},e.prototype.deactivate=function(){this.options.onDeactivateCollection(this)},e.prototype.clearResource=function(){var e=this.entry.resources,t=this.items,r=e.indexOf(this);-1!==r&&e.splice(r,1);for(var i=0,n=t;i<n.length;i++){n[i].clearResource()}},e}(),Re=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),Fe=function(e){function t(t,r,i,n,o,s,c,a){var u=e.call(this,i,c,a)||this;return u.errorHandler=t,u.itemHandler=r,u.changesProcessorFactory=n,u.keyService=o,u.promiseService=s,u}return Re(t,e),t.prototype.save=function(){if(!this.options.enableSave)throw new Error("collectionResourceService: Saving disabled");var e=this.entry,t=e.parent;return null!==t&&this.keyService.isLocalId(t.itemId)?this.promiseService.when():this.changesProcessorFactory.construct().execute([],[e])},t.prototype.moveItems=function(e,t,r){var i=this.entry,n=this.options;if(n.enableSave||n.modInstant)throw new Error("collectionResourceService: Cannot move items: saving enabled");if(i.itemType!==t.entry.itemType)throw new Error("collectionResourceService: Cannot move items: itemType mismatch");for(var o=i.removeItems(e,this,!1,r),s=[],c=0,a=o;c<a.length;c++){var u=a[c];s.push(u.entry)}return t.entry.addItems(s,t,!1,r),o},t.prototype.removeItems=function(e,t){var r=this;void 0===t&&(t=!0);var i=this.entry.removeItems(e,this,!1,!1);return this.options.modInstant?this.save().then(function(){return t&&r.callOnRemove(i),i}):(t&&this.callOnRemove(i),this.promiseService.when(i))},t.prototype.removeItem=function(e,t){return this.removeItems([e],t).then(function(e){return e[0]},this.errorHandler.reject)},t.prototype.addItems=function(e,t){var r=this;return void 0===t&&(t=!0),this.itemHandler.fetchTemplate(this.entry.itemType).then(function(i){for(var n,o=[],s=0,c=e;s<c.length;s++){var a=c[s];o.push(r.itemHandler.createLocalEntry(r.keyService.getLocalId(),i,a.fields,a.derived))}return n=r.entry.addItems(o,r,!1,!1),r.options.modInstant?r.save().then(function(e){return t&&r.callOnAdd(n),n},r.errorHandler.reject):(t&&r.callOnAdd(n),n)},this.errorHandler.reject)},t.prototype.addItem=function(e,t){return this.addItems([e],t).then(function(e){return e[0]},this.errorHandler.reject)},t.prototype.clear=function(e){return this.entry.clear(this,!1,e)},t}(Ee),qe=0,be=function(){function e(e,t,r,i,n,o,s,c,a){this.errorHandler=e,this.collectionEntryService=t,this.itemRequestService=r,this.itemEntryService=i,this.keyService=n,this.queryService=o,this.promiseService=s,this.itemType=c,this.options=a,this.id=qe++,this.parent=null,this.initial=[],this.items=[],this.resources=[],this.reloadQueued=!1,this.deferred=this.promiseService.defer(),this.promise=this.deferred.promise,this.itemType=c,this.parent=a.parent,this.query=t.createQuery(a)}return e.prototype.isDeferred=function(){return void 0!==this.promise},e.prototype.resolve=function(e){var t=this.deferred;return this.columns=e.columns,this.initial=e.items,this.items=e.items.slice(),delete this.deferred,delete this.promise,t.resolve(this),this},e.prototype.isLocal=function(){var e=this.parent;return null!==e&&this.keyService.isLocalId(e.itemId)},e.prototype.matchParent=function(e,t){var r=this.parent;return null!==r&&(r.itemType===e&&r.itemId==t)},e.prototype.forEach=function(e){for(var t=0,r=this.items;t<r.length;t++){e(r[t])}},e.prototype.getItemById=function(e){for(var t=0,r=this.items;t<r.length;t++){var i=r[t];if(i.itemId===e)return i}},e.prototype.getIdArray=function(e){return void 0===e&&(e=[]),this.collectionEntryService.getIdArray(this.items,e)},e.prototype.addItems=function(e,t,r,i){if(void 0===r&&(r=!1),void 0===i&&(i=!0),0===e.length)return[];var n=this.resources,o=this.parent,s=this.columns.link;if(r){for(var c=this.initial,a=[],u=0,l=e;u<l.length;u++){var h=l[u];-1===c.indexOf(h)&&(c.push(h),a.push(h))}if(a.length>0)for(var p=0,m=n;p<m.length;p++){(I=m[p]).options.onAddInitial(a,this)}}for(var d=this.items,f=[],v=0,y=e;v<y.length;v++){h=y[v];-1===d.indexOf(h)&&(null!==o&&(h.parent=o,null!==s&&void 0!==h.modified&&(h.modified[s.id]=o.itemId)),d.push(h),f.push(h))}if(f.length>0){for(var g=void 0,C=0,S=n;C<S.length;C++){var I,E=(I=S[C]).addItemResources(f);I===t?(g=E,i&&I.callOnAdd(E)):I.callOnAdd(E)}return g}return null===t?null:[]},e.prototype.removeItems=function(e,t,r,i){return 0===e.length?[]:this.handleRemovedItems(function(t){return!c(t.itemId,e)},t,r,i)},e.prototype.clear=function(e,t,r){return this.handleRemovedItems(function(){return!1},e,t,r)},e.prototype.handleRemovedItems=function(e,t,r,i){void 0===i&&(i=!0);var n,o=this.resources,s=this.collectionEntryService.filterArray(this.items,e),c=r?this.collectionEntryService.filterArray(this.initial,e):[];if(c.length>0)for(var a=0,u=o;a<u.length;a++){(f=u[a]).options.onRemoveInitial(c,this)}if(0===s.length)return null===t?null:[];for(var l=0,h=s;l<h.length;l++){var p=h[l];this.itemEntryService.deactivateResources(p)}for(var m=0,d=o;m<d.length;m++){var f,v=(f=d[m]).removeItemResources(s);f===t?(n=v,i&&f.callOnRemove(v)):f.callOnRemove(v)}return n},e.prototype.expand=function(e){var t=this,r=this.itemType;return 0===e.length?this.promiseService.when(this):(this.promise=this.itemRequestService.requestItems(this,void 0,e).then(function(i){var n=i.items[r],o=t.itemRequestService.processExpansion(e,i,r,t.items);return t.handleRemovedItems.call(t,function(e){return void 0!==n[e.itemId]||t.itemEntryService.isLocal(e)},null,!0,!0),t.updateColumns(o),delete t.promise,t},this.errorHandler.reject),this.promise)},e.prototype.extendQuery=function(e){var t=this.options;return void 0===e?this.query:(t.queryParams=e(t.queryParams),this.query=this.collectionEntryService.createQuery(t))},e.prototype.extend=function(e,t,r,i){var n=this,o=this.extendQuery(e).object,s=this.queryService.addAndCondition(o,this.queryService.createNotIn(this.getIdArray())),c=this.itemRequestService.requestItems(this,null!==this.options.limit?o:s).then(function(e){return n.itemRequestService.processResponse(e,e.links[n.itemType],n.parent,n.columns)},this.errorHandler.reject).then(function(e){return delete n.promise,n.addItems(e,t,i,r)},this.errorHandler.reject);return this.promise=c.then(function(){return n},this.errorHandler.reject),c},e.prototype.queueReload=function(){this.reloadQueued=!0,this.deferred=this.promiseService.defer(),this.promise=this.deferred.promise},e.prototype.updateColumns=function(e){var t=e.run(this.columns,!1);this.options.columns=t.request,this.columns=t},e.prototype.getAddedItems=function(e){void 0===e&&(e=!1);for(var t=this.initial,r=[],i=0,n=this.items;i<n.length;i++){var o=n[i];-1===t.indexOf(o)&&r.push(e?o.itemId:o)}return r},e.prototype.getRemovedItems=function(e){void 0===e&&(e=!1);for(var t=this.initial,r=this.items,i=[],n=0,o=t;n<o.length;n++){var s=o[n];-1===r.indexOf(s)&&i.push(e?s.itemId:s)}return i},e.prototype.getUpdatedItems=function(){for(var e=[],t=0,r=this.items;t<r.length;t++){var i=r[t];!this.itemEntryService.isLocal(i)&&this.itemEntryService.hasChanges(i)&&e.push(i)}return e},e.prototype.hasAddedItems=function(){return this.items.length>this.initial.length},e.prototype.hasRemovedItems=function(){return this.initial.length>this.items.length},e.prototype.hasUpdatedItems=function(){for(var e=0,t=this.items;e<t.length;e++){var r=t[e];if(this.itemEntryService.hasChanges(r))return!0}return!1},e.prototype.getCurrentResource=function(){var e=this.resources;return e[e.length-1]},e.prototype.clearResources=function(e){void 0===e&&(e=!1);for(var t=this.items,r=this.resources,i=[],n=0,o=t;n<o.length;n++){var s=o[n];this.itemEntryService.clearResources(s)}for(var c=0,a=r;c<a.length;c++){var u=a[c];if(!u.options[e?"clearOnSubTabChange":"clearOnTabChange"]){i.push(u);for(var l=0,h=u.items;l<h.length;l++){var p=h[l];p.entry.resources.push(p)}}}this.resources=i},e.prototype.revertChanges=function(){for(var e=this.resources,t=this.getRemovedItems(),r=this.getAddedItems(!0),i=0,n=e;i<n.length;i++){var o=n[i];o.addItemResources(t),o.removeItemResources(r)}this.items=this.initial.slice()},e.prototype.onItemsCreated=function(e){for(var t=0,r=this.resources;t<r.length;t++){var i=r[t];i.rebuildMap(),i.options.onItemsCreated(e)}},e.prototype.getUpdatedItemColumns=function(e){for(var t={},r=0,i=this.columns.item;r<i.length;r++){var n=i[r];void 0!==e[n.apiColumn.itemType]&&(t[n.id]=n)}return t},e}(),Oe=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),He=function(e){function t(t,r,i,n,o,s,c,a){var u=e.call(this,i,c,a)||this;return u.errorHandler=t,u.itemHandler=r,u.changesProcessorFactory=n,u.keyService=o,u.promiseService=s,u}return Oe(t,e),t}(Ee),Te=0,ke=function(){return function(e,t,r,i,n,o){void 0===n&&(n={}),void 0===o&&(o=[]),this.itemType=e,this.itemId=t,this.columns=r,this.initial=i,this.derived=n,this.resources=o,this.id=++Te,this.parent=null,this.deferRequest=!1}}(),Me=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),we=function(e){function t(t,r,i,n,o,s,c,a,u){var l=e.call(this,t,r,i)||this;return l.apiFormatter=n,l.lockService=o,l.changesProcessor=s,l.collectionHandler=c,l.errorHandler=a,l.promiseService=u,l.localCopies=[],t.setModified(r),l.fields=r.modified,l}return Me(t,e),t.prototype.start=function(){void 0===this.localCopies&&(this.localCopies=[]),this.localCopies.push(this.copyFields())},t.prototype.rollback=function(){var e=this.entry;this.apiFormatter.copyFields(this.localCopies.pop(),e.modified,e.columns.main),this.isNewResource(this)&&0===this.localCopies.length&&this.deactivate()},t.prototype.commit=function(e){e||this.localCopies.pop(),void 0===this.transactions&&(this.transactions=0),this.transactions++},t.prototype.getLocalCopy=function(){var e=this.localCopies;return void 0===e?null:0===e.length?null:e[e.length-1]},t.prototype.copyFields=function(e){var t=this.entry;return void 0===e&&(e={}),this.apiFormatter.copyFields(t.modified,e,t.columns.main)},t.prototype.setFields=function(e,t){var r=this.columns,i=this.fields;for(var n in void 0===t&&(t=!0),t&&this.copyFields(),e){var o=r[n];void 0!==o?this.apiFormatter.compareFields(o.type,i[n],e[n])||(i[n]=e[n],this.hasChanges=!0):console.warn("setFields: no column found for",n)}return this},t.prototype.callOnChange=function(e){this.itemEntryService.callOnChange(this.entry,e)},t.prototype.save=function(e){var t=this,r=this.entry,i={};return void 0!==e&&h(i,[r.itemType,r.itemId],[{},e]),(this.itemEntryService.isLockable(r)?this.lockService.fetchLock(r):this.promiseService.when()).then(function(e){return t.changesProcessor.execute([r],[],!1,i)},this.errorHandler.reject).then(function(){return t},this.errorHandler.reject)},t.prototype.saveLocal=function(){var e=this.entry;return this.itemEntryService.setDisplayName(e),this.collectionHandler.addItemsToCollections([e]),this.promiseService.when(this)},t}(Ce),je=function(){function e(e,t,r,i,n,o,s){this.errorHandler=e,this.collectionEntryService=t,this.itemRequestService=r,this.itemEntryService=i,this.keyService=n,this.queryService=o,this.promiseService=s}return e.prototype.construct=function(e,t){return t=this.collectionEntryService.processOptions(t),new be(this.errorHandler,this.collectionEntryService,this.itemRequestService,this.itemEntryService,this.keyService,this.queryService,this.promiseService,e,t)},e}(),xe=function(){function e(e,t,r,i,n,o,s){this.errorHandler=e,this.itemHandler=t,this.itemResourceFactory=r,this.changesProcessorFactory=i,this.keyService=n,this.promiseService=o,this.collectionResourceService=s}return e.prototype.construct=function(e,t){return new((t=this.collectionResourceService.processOptions(t)).editCollection?Fe:He)(this.errorHandler,this.itemHandler,this.itemResourceFactory,this.changesProcessorFactory,this.keyService,this.promiseService,e,t)},e}(),De=function(){function e(e,t,r){this.columnHandler=e,this.columnSetFactory=t,this.columnUtil=r}return e.prototype.construct=function(e,t,r){return new Q(this.columnHandler,this.columnSetFactory,this.columnUtil,e,t,r)},e}(),Pe=function(){function e(e,t){this.columnHandler=e,this.columnUtil=t}return e.prototype.construct=function(e,t,r,i,n){return void 0===i&&(i=!0),void 0===n&&(n=!0),new X(this.columnHandler,this.columnUtil,e,t,r,i,n)},e}(),Le=function(){function e(e,t,r,i){this.collectionHandler=e,this.requestColumnExpansionFactory=t,this.itemEntryService=r,this.keyService=i}return e.prototype.construct=function(e,t,r){return void 0===r&&(r=!1),new J(this.collectionHandler,this.requestColumnExpansionFactory,this.itemEntryService,this.keyService,e,t,r)},e}(),Ae=function(){function e(e,t){this.queryMatcherFactory=e,this.itemEntryService=t}return e.prototype.construct=function(){return new G(this.queryMatcherFactory,this.itemEntryService)},e}(),_e=function(){function e(){}return e.prototype.construct=function(e,t,r,i,n,o){return new ke(e,t,r,i,n,o)},e}(),Ue=function(){function e(e,t,r,i,n,o,s,c){this.itemEntryService=e,this.itemResourceService=t,this.apiFormatter=r,this.lockService=i,this.changesProcessor=n,this.collectionHandler=o,this.errorHandler=s,this.promiseService=c}return e.prototype.getConstructor=function(e){var t=this;return e=this.itemResourceService.processOptions(e),function(r){return e.edit?new we(t.itemEntryService,r,e,t.apiFormatter,t.lockService,t.changesProcessor,t.collectionHandler,t.errorHandler,t.promiseService):new Ie(t.itemEntryService,r,e)}},e.prototype.construct=function(e,t){return(t=this.itemResourceService.processOptions(t)).edit?new we(this.itemEntryService,e,t,this.apiFormatter,this.lockService,this.changesProcessor,this.collectionHandler,this.errorHandler,this.promiseService):new Ie(this.itemEntryService,e,t)},e}(),Ve=function(){function e(e,t,r,i,n,o,s,c,a,u,l,h,p,m){this.apiRequestService=e,this.errorHandler=t,this.itemHandler=r,this.collectionHandler=i,this.columnHandler=n,this.lockService=o,this.itemResourceFactory=s,this.collectionCacheFactory=c,this.changesProcessorFactory=a,this.itemCacheFactory=u,this.collectionResourceFactory=l,this.itemEntryService=h,this.itemResourceService=p,this.promiseService=m}return e.prototype.construct=function(){return new ie(this.apiRequestService,this.errorHandler,this.itemHandler,this.collectionHandler,this.columnHandler,this.lockService,this.itemResourceFactory,this.collectionCacheFactory,this.changesProcessorFactory,this.itemCacheFactory,this.collectionResourceFactory,this.itemEntryService,this.itemResourceService,this.promiseService)},e}(),Ne=function(){function e(e){this.itemEntryService=e}return e.prototype.construct=function(e,t,r){return new se(this.itemEntryService,e,t,r)},e}(),Be=function(){function e(e){this.apiFormatter=e}return e.prototype.construct=function(e,t,r,i){return new ae(this.apiFormatter,e,t,r,i)},e}(),Qe=function(){function e(){}return e.prototype.construct=function(e,t){return new le(e,t)},e}(),Ye=function(){function e(e){this.columnUtil=e}return e.prototype.construct=function(){return new pe(this.columnUtil)},e}(),We=function(){return function(e,t,r,i,n){this.version="1.0.30",this.apiFormatter=new M,this.keyService=new re,this.queryService=new he,this.columnUtil=new K,this.apiResponseProcessorFactory=new de(this.apiFormatter),this.apiRequestService=new w(e,this.apiResponseProcessorFactory),this.itemEntryService=new Z(this.apiFormatter,this.keyService,n),this.itemResourceService=new te,this.lockService=new ne(this.apiRequestService,i,this.keyService,n),this.queryMatcherFactory=new Be(this.apiFormatter),this.itemCacheFactory=new Ae(this.queryMatcherFactory,this.itemEntryService),this.batchStatusFactory=new fe(n),this.columnCache=new B(this.columnUtil),this.columnHandler=new Y(this.apiRequestService,i,n,this.columnCache,this.columnUtil),this.columnSetFactory=new Pe(this.columnHandler,this.columnUtil),this.columnExpansionFactory=new De(this.columnHandler,this.columnSetFactory,this.columnUtil),this.itemEntryFactory=new _e,this.itemHandler=new $(this.apiRequestService,r,i,this.itemEntryFactory,this.columnHandler,this.itemCacheFactory,this.batchStatusFactory,this.columnExpansionFactory,this.columnSetFactory,this.itemEntryService,this.apiFormatter,this.keyService,n,this.columnUtil),this.itemRequestService=new ee(this.apiRequestService,i,this.itemHandler,this.columnHandler,this.columnExpansionFactory,this.columnSetFactory,this.itemEntryService,this.queryService,n),this.queryParserFactory=new Qe,this.collectionEntryService=new U(this.queryParserFactory,this.queryService),this.collectionResourceService=new N,this.collectionEntryFactory=new je(i,this.collectionEntryService,this.itemRequestService,this.itemEntryService,this.keyService,this.queryService,n),this.collectionCacheFactory=new ge(this.queryMatcherFactory),this.collectionHandler=new V(i,this.itemRequestService,this.itemHandler,this.columnHandler,this.collectionEntryFactory,this.collectionCacheFactory,this.queryParserFactory,this.collectionEntryService,this.columnSetFactory,this.itemEntryService,this.keyService,n,this.queryService,this.columnUtil),this.requestColumnExpansionFactory=new Ye(this.columnUtil),this.createRequestFactory=new Le(this.collectionHandler,this.requestColumnExpansionFactory,this.itemEntryService,this.keyService),this.changesCompilerFactory=new ve(this.itemEntryService),this.changesProcessorFactory=new ye(this.apiRequestService,i,this.itemHandler,this.collectionHandler,this.columnHandler,this.changesCompilerFactory,this.createRequestFactory,this.columnExpansionFactory,this.requestColumnExpansionFactory,this.collectionEntryService,this.itemEntryService,this.apiFormatter,n),this.itemResourceFactory=new Ue(this.itemEntryService,this.itemResourceService,this.apiFormatter,this.lockService,this.changesProcessorFactory.construct(),this.collectionHandler,i,n),this.collectionResourceFactory=new xe(i,this.itemHandler,this.itemResourceFactory,this.changesProcessorFactory,this.keyService,n,this.collectionResourceService),this.localCacheFactory=new Ve(this.apiRequestService,i,this.itemHandler,this.collectionHandler,this.columnHandler,this.lockService,this.itemResourceFactory,this.collectionCacheFactory,this.changesProcessorFactory,this.itemCacheFactory,this.collectionResourceFactory,this.itemEntryService,this.itemResourceService,n),this.moduleChangesCompilerFactory=new Ne(this.itemEntryService),this.itemAdministrator=new z(this.apiRequestService,t,r,i,this.itemHandler,this.collectionHandler,this.columnSetFactory,this.itemRequestService,this.localCacheFactory,this.moduleChangesCompilerFactory,this.collectionEntryService,this.collectionResourceService,this.itemEntryService,this.keyService,this.queryService),this.socketMessageHandler=new me(n,this.apiRequestService,this.itemHandler,this.itemEntryService,this.collectionHandler,this.columnSetFactory,this.columnExpansionFactory,this.requestColumnExpansionFactory,this.apiFormatter,i)}}();function Xe(){}function Ke(e){return e}r.d(t,"RmCore",function(){return We}),r.d(t,"noop",function(){return Xe}),r.d(t,"identity",function(){return Ke}),r.d(t,"ENTRY_STATUS",function(){return k}),r.d(t,"COLUMN_SEPERATOR",function(){return">"}),r.d(t,"RENDER_AS_SEPERATOR",function(){return":"}),r.d(t,"ViewResource",function(){return Ie}),r.d(t,"CollectionEditResource",function(){return Fe}),r.d(t,"CollectionEntry",function(){return be}),r.d(t,"CollectionResource",function(){return Ee}),r.d(t,"CollectionViewResource",function(){return He}),r.d(t,"ItemEntry",function(){return ke}),r.d(t,"ItemResource",function(){return Ce}),r.d(t,"EditResource",function(){return we}),r.d(t,"ApiFormatter",function(){return M}),r.d(t,"ApiRequestService",function(){return w}),r.d(t,"ApiResponseProcessor",function(){return j}),r.d(t,"BatchStatus",function(){return D}),r.d(t,"ChangesCompiler",function(){return P}),r.d(t,"ChangesProcessor",function(){return L}),r.d(t,"CollectionCache",function(){return _}),r.d(t,"CollectionEntryService",function(){return U}),r.d(t,"CollectionHandler",function(){return V}),r.d(t,"CollectionResourceService",function(){return N}),r.d(t,"ColumnCache",function(){return B}),r.d(t,"ColumnExpansion",function(){return Q}),r.d(t,"ColumnHandler",function(){return Y}),r.d(t,"ColumnSet",function(){return X}),r.d(t,"ColumnUtil",function(){return K}),r.d(t,"CreateRequest",function(){return J}),r.d(t,"ItemAdministrator",function(){return z}),r.d(t,"ItemCache",function(){return G}),r.d(t,"ItemEntryService",function(){return Z}),r.d(t,"ItemHandler",function(){return $}),r.d(t,"ItemRequestService",function(){return ee}),r.d(t,"ItemResourceService",function(){return te}),r.d(t,"KeyService",function(){return re}),r.d(t,"LocalCache",function(){return ie}),r.d(t,"LockService",function(){return ne}),r.d(t,"ModuleChangesCompiler",function(){return se}),r.d(t,"QueryMatcher",function(){return ae}),r.d(t,"QueryParser",function(){return le}),r.d(t,"QueryService",function(){return he}),r.d(t,"RequestColumnExpansion",function(){return pe}),r.d(t,"SocketMessageHandler",function(){return me}),r.d(t,"shallowMerge",function(){return n}),r.d(t,"hasProperties",function(){return o}),r.d(t,"getFirstProperty",function(){return s}),r.d(t,"inArray",function(){return c}),r.d(t,"filterArray",function(){return a}),r.d(t,"emptyArray",function(){return u}),r.d(t,"pathExists",function(){return l}),r.d(t,"createPath",function(){return h}),r.d(t,"getPath",function(){return p}),r.d(t,"extend",function(){return d}),r.d(t,"merge",function(){return f}),r.d(t,"isObject",function(){return v}),r.d(t,"isBlankObject",function(){return y}),r.d(t,"isString",function(){return g}),r.d(t,"isNumber",function(){return C}),r.d(t,"isDate",function(){return S}),r.d(t,"isArray",function(){return I}),r.d(t,"isFunction",function(){return E}),r.d(t,"isRegExp",function(){return R}),r.d(t,"isBoolean",function(){return F}),r.d(t,"isElement",function(){return q}),r.d(t,"isWindow",function(){return b}),r.d(t,"isDefined",function(){return O}),r.d(t,"equals",function(){return H}),r.d(t,"copy",function(){return T}),r.d(t,"ApiResponseProcessorFactory",function(){return de}),r.d(t,"BatchStatusFactory",function(){return fe}),r.d(t,"ChangesCompilerFactory",function(){return ve}),r.d(t,"ChangesProcessorFactory",function(){return ye}),r.d(t,"CollectionCacheFactory",function(){return ge}),r.d(t,"CollectionEntryFactory",function(){return je}),r.d(t,"CollectionResourceFactory",function(){return xe}),r.d(t,"ColumnExpansionFactory",function(){return De}),r.d(t,"ColumnSetFactory",function(){return Pe}),r.d(t,"CreateRequestFactory",function(){return Le}),r.d(t,"ItemCacheFactory",function(){return Ae}),r.d(t,"ItemEntryFactory",function(){return _e}),r.d(t,"ItemResourceFactory",function(){return Ue}),r.d(t,"LocalCacheFactory",function(){return Ve}),r.d(t,"ModuleChangesCompilerFactory",function(){return Ne}),r.d(t,"QueryMatcherFactory",function(){return Be}),r.d(t,"QueryParserFactory",function(){return Qe}),r.d(t,"RequestColumnExpansionFactory",function(){return Ye})}])});
|