Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

data-tier

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-tier - npm Package Compare versions

Comparing version 0.6.13 to 0.6.14

346

dist/data-tier-wo-oo.js

@@ -113,36 +113,16 @@ (() => {

const namespace = this || window,
processors = {};
controllers = {};
if (!namespace.DataTier) {
throw new Error('data-tier framework was not properly initialized');
}
function DataProcessor(name, options) {
function Controller(name, options) {
Reflect.defineProperty(this, 'name', {value: name});
Reflect.defineProperty(this, 'toView', {value: options.toView});
Reflect.defineProperty(this, 'toData', {value: typeof options.toData === 'function' ? options.toData : defaultToData});
Reflect.defineProperty(this, 'changeDOMEventType', {value: typeof options.changeDOMEventType === 'string' ? options.changeDOMEventType : null});
Reflect.defineProperty(this, 'parseParam', {value: typeof options.parseParam === 'function' ? options.parseParam : defaultParseParam});
Reflect.defineProperty(this, 'isChangedPathRelevant', {value: typeof options.isChangedPathRelevant === 'function' ? options.isChangedPathRelevant : defaultIsChangedPathRelevant});
Object.assign(this, options);
}
function defaultParseParam(param) {
let tieName = '', dataPath = [];
if (param) {
dataPath = param.trim().split('.');
tieName = dataPath.shift();
}
return {
tieName: tieName,
dataPath: dataPath
};
}
Controller.prototype.toData = defaultToData;
Controller.prototype.parseParam = defaultParseParam;
Controller.prototype.isChangedPathRelevant = defaultIsChangedPathRelevant;
function defaultIsChangedPathRelevant(changedPath, viewedPath) {
return viewedPath.startsWith(changedPath);
}
Reflect.defineProperty(Controller.prototype, 'parseParam', {value: defaultParseParam});
Reflect.defineProperty(Controller.prototype, 'isChangedPathRelevant', {value: defaultIsChangedPathRelevant});
Reflect.defineProperty(DataProcessor.prototype, 'parseParam', {value: defaultParseParam});
Reflect.defineProperty(DataProcessor.prototype, 'isChangedPathRelevant', {value: defaultIsChangedPathRelevant});
function add(name, configuration) {

@@ -152,4 +132,4 @@ if (typeof name !== 'string' || !name) {

}
if (processors[name]) {
throw new Error('data processor "' + name + '" already exists; you may want to reconfigure the existing one');
if (controllers[name]) {
throw new Error('data controller "' + name + '" already exists; you may want to reconfigure the existing one');
}

@@ -163,8 +143,8 @@ if (typeof configuration !== 'object' || !configuration) {

processors[name] = new DataProcessor(name, configuration);
namespace.DataTier.views.applyProcessor(processors[name]);
controllers[name] = new Controller(name, configuration);
namespace.DataTier.views.applyController(controllers[name]);
}
function get(name) {
return processors[name];
return controllers[name];
}

@@ -177,3 +157,3 @@

return delete processors[name];
return delete controllers[name];
}

@@ -185,5 +165,5 @@

Object.keys(element.dataset)
.filter(key => key in processors)
.map(key => processors[key])
.forEach(processor => result.push(processor));
.filter(key => key in controllers)
.map(key => controllers[key])
.forEach(controller => result.push(controller));
}

@@ -197,2 +177,18 @@ return result;

function defaultParseParam(param) {
let tieName = '', dataPath = [];
if (param) {
dataPath = param.trim().split('.');
tieName = dataPath.shift();
}
return {
tieName: tieName,
dataPath: dataPath
};
}
function defaultIsChangedPathRelevant(changedPath, viewedPath) {
return viewedPath.startsWith(changedPath);
}
function setPath(ref, path, value) {

@@ -207,3 +203,3 @@ let i;

Reflect.defineProperty(namespace.DataTier, 'processors', {
Reflect.defineProperty(namespace.DataTier, 'controllers', {
value: {

@@ -227,7 +223,7 @@ get get() { return get; },

const ties = namespace.DataTier.ties,
processors = namespace.DataTier.processors,
controllers = namespace.DataTier.controllers,
views = {},
nlvs = {};
// TODO: this is similar to setPath in processors-service - unify
// TODO: this is similar to setPath in controllers-service - unify
function getPath(ref, path) {

@@ -244,11 +240,11 @@ if (!ref) return;

let target = event.target,
relevantProcessors = processors.getApplicable(target),
processor, processorParam, tie, i;
i = relevantProcessors.length;
relevantControllers = controllers.getApplicable(target),
controller, controllerParam, tie, i;
i = relevantControllers.length;
while (i--) {
processor = relevantProcessors[i];
if (event.type === processor.changeDOMEventType) {
processorParam = processor.parseParam(target.dataset[processor.name]);
tie = ties.get(processorParam.tieName);
if (!processorParam.dataPath) {
controller = relevantControllers[i];
if (event.type === controller.changeDOMEventType) {
controllerParam = controller.parseParam(target.dataset[controller.name]);
tie = ties.get(controllerParam.tieName);
if (!controllerParam.dataPath) {
console.error('path to data not available');

@@ -258,7 +254,7 @@ return;

if (!tie) {
console.error('tie "' + processorParam.tieName + '" not found');
console.error('tie "' + controllerParam.tieName + '" not found');
return;
}
processor.toData({data: tie.data, path: processorParam.dataPath, view: target});
controller.toData({data: tie.data, path: controllerParam.dataPath, view: target});
}

@@ -286,3 +282,3 @@ }

let keys = Object.keys(view.dataset), key,
processor, processorParam, pathString,
controller, controllerParam, pathString,
tieViews, procViews, pathViews, i;

@@ -293,8 +289,8 @@ i = keys.length;

if (!key.startsWith('tie')) continue;
processor = processors.get(key);
if (processor) {
processorParam = processor.parseParam(view.dataset[processor.name]);
pathString = processorParam.dataPath.join('.');
tieViews = views[processorParam.tieName] || (views[processorParam.tieName] = {});
procViews = tieViews[processor.name] || (tieViews[processor.name] = {});
controller = controllers.get(key);
if (controller) {
controllerParam = controller.parseParam(view.dataset[controller.name]);
pathString = controllerParam.dataPath.join('.');
tieViews = views[controllerParam.tieName] || (views[controllerParam.tieName] = {});
procViews = tieViews[controller.name] || (tieViews[controller.name] = {});
pathViews = procViews[pathString] || (procViews[pathString] = []);

@@ -304,9 +300,9 @@

pathViews.push(view);
update(view, processor.name);
if (processor.changeDOMEventType) {
addChangeListener(view, processor.changeDOMEventType);
update(view, controller.name);
if (controller.changeDOMEventType) {
addChangeListener(view, controller.changeDOMEventType);
}
}
} else {
// collect potentially future processor's element and put them into some tracking storage
// collect potentially future controller's element and put them into some tracking storage
if (!nlvs[key]) nlvs[key] = [];

@@ -319,6 +315,6 @@ nlvs[key].push(view);

function update(view, processorName) {
function update(view, controllerName) {
let r, p, t, data;
r = processors.get(processorName);
p = r.parseParam(view.dataset[processorName]);
r = controllers.get(controllerName);
p = r.parseParam(view.dataset[controllerName]);
t = ties.get(p.tieName);

@@ -349,3 +345,3 @@ if (t) {

let list = rootElement.getElementsByTagName('*'),
element, tmpProcs, processor, i, l, i1,
element, tmpCtrls, controller, i, l, i1,
param, pathViews, index;

@@ -355,13 +351,13 @@ for (i = 0, l = list.length; i <= l; i++) {

if (!element.dataset || !element.dataset.length) continue;
tmpProcs = processors.getApplicable(element);
i1 = tmpProcs.length;
tmpCtrls = controllers.getApplicable(element);
i1 = tmpCtrls.length;
while (i1--) {
processor = tmpProcs[i1];
param = processor.parseParam(element.dataset[processor.name]);
pathViews = views[param.tieName][processor.name][param.dataPath.join('.')];
controller = tmpCtrls[i1];
param = controller.parseParam(element.dataset[controller.name]);
pathViews = views[param.tieName][controller.name][param.dataPath.join('.')];
index = pathViews.indexOf(element);
if (index >= 0) {
pathViews.splice(index, 1);
if (processor.changeDOMEventType) {
delChangeListener(element, processor.changeDOMEventType);
if (controller.changeDOMEventType) {
delChangeListener(element, controller.changeDOMEventType);
}

@@ -374,12 +370,12 @@ }

function move(view, processorName, oldParam, newParam) {
let processor, processorParam, pathViews, i = -1;
function move(view, controllerName, oldParam, newParam) {
let controller, controllerParam, pathViews, i = -1;
processor = processors.get(processorName);
if (!processor) return;
processorParam = processors.get(processorName).parseParam(oldParam);
controller = controllers.get(controllerName);
if (!controller) return;
controllerParam = controllers.get(controllerName).parseParam(oldParam);
// delete old path
if (views[processorParam.tieName] && views[processorParam.tieName][processorName]) {
pathViews = views[processorParam.tieName][processorName][processorParam.dataPath];
if (views[controllerParam.tieName] && views[controllerParam.tieName][controllerName]) {
pathViews = views[controllerParam.tieName][controllerName][controllerParam.dataPath];
if (pathViews) i = pathViews.indexOf(view);

@@ -392,8 +388,8 @@ if (i >= 0) {

// add new path
processorParam = processors.get(processorName).parseParam(newParam);
if (!views[processorParam.tieName]) views[processorParam.tieName] = {};
if (!views[processorParam.tieName][processorName]) views[processorParam.tieName][processorName] = {};
if (!views[processorParam.tieName][processorName][processorParam.dataPath]) views[processorParam.tieName][processorName][processorParam.dataPath] = [];
views[processorParam.tieName][processorName][processorParam.dataPath].push(view);
update(view, processorName);
controllerParam = controllers.get(controllerName).parseParam(newParam);
if (!views[controllerParam.tieName]) views[controllerParam.tieName] = {};
if (!views[controllerParam.tieName][controllerName]) views[controllerParam.tieName][controllerName] = {};
if (!views[controllerParam.tieName][controllerName][controllerParam.dataPath]) views[controllerParam.tieName][controllerName][controllerParam.dataPath] = [];
views[controllerParam.tieName][controllerName][controllerParam.dataPath].push(view);
update(view, controllerName);
}

@@ -403,3 +399,3 @@

let tieViews = views[tieName], change, changedPath,
procNames, procName, processor, viewedPaths, viewedPath, procViews, pathViews,
ctrlNames, ctrlName, controller, viewedPaths, viewedPath, ctrlViews, pathViews,
i, i1, i2, i3;

@@ -411,18 +407,18 @@ if (tieViews) {

changedPath = change.path ? change.path.join('.') : null;
procNames = Object.keys(tieViews);
i1 = procNames.length;
ctrlNames = Object.keys(tieViews);
i1 = ctrlNames.length;
while (i1--) {
procName = procNames[i1];
procViews = tieViews[procName];
if (procViews) {
processor = processors.get(procName);
viewedPaths = Object.keys(procViews);
ctrlName = ctrlNames[i1];
ctrlViews = tieViews[ctrlName];
if (ctrlViews) {
controller = controllers.get(ctrlName);
viewedPaths = Object.keys(ctrlViews);
i2 = viewedPaths.length;
while (i2--) {
viewedPath = viewedPaths[i2];
if (processor.isChangedPathRelevant(changedPath, viewedPath)) {
pathViews = procViews[viewedPath];
if (controller.isChangedPathRelevant(changedPath, viewedPath)) {
pathViews = ctrlViews[viewedPath];
i3 = pathViews.length;
while (i3--) {
update(pathViews[i3], procName);
update(pathViews[i3], ctrlName);
}

@@ -437,7 +433,7 @@ }

function applyProcessor(processor) {
function applyController(controller) {
// apply on a pending views
if (nlvs[processor.name]) {
nlvs[processor.name].forEach(add);
delete nlvs[processor.name];
if (nlvs[controller.name]) {
nlvs[controller.name].forEach(add);
delete nlvs[controller.name];
}

@@ -523,3 +519,3 @@ }

get processChanges() { return processChanges; },
get applyProcessor() { return applyProcessor; },
get applyController() { return applyController; },
get updateView() { return update; }

@@ -536,8 +532,4 @@ }

const namespace = this || window,
add = namespace.DataTier.processors.add;
add = namespace.DataTier.controllers.add;
if (!namespace.DataTier) {
throw new Error('data-tier framework was not properly initialized');
}
add('tieValue', {

@@ -585,3 +577,3 @@ toView: function(data, view) {

add('tieHRef', {
add('tieHref', {
toView: function(data, view) {

@@ -592,14 +584,2 @@ view.href = typeof data !== 'undefined' && data !== null ? data : '';

add('tieDateValue', {
toView: function(data, view) {
view.value = typeof data !== 'undefined' && data !== null ? data.toLocaleString() : '';
}
});
add('tieDateText', {
toView: function(data, view) {
view.textContent = typeof data !== 'undefined' && data !== null ? data.toLocaleString() : '';
}
});
add('tieClasses', {

@@ -626,21 +606,108 @@ isChangedPathRelevant: function(changedPath, viewedPath) {

})();
(() => {
(() => {
'use strict';
const namespace = this || window,
add = namespace.DataTier.processors.add,
viewsService = namespace.DataTier.views;
add = namespace.DataTier.controllers.add;
if (!namespace.DataTier) {
throw new Error('data-tier framework was not properly initialized');
// deprecated
add('tieDateValue', {
toView: function(data, view) {
view.value = typeof data !== 'undefined' && data !== null ? data.toLocaleString() : '';
}
});
// deprecated
add('tieDateText', {
toView: function(data, view) {
view.textContent = typeof data !== 'undefined' && data !== null ? data.toLocaleString() : '';
}
});
add('tieDatetimeText', new DateTimeTextController());
add('tieDatetimeValue', new DateTimeValueController());
function DateTimeTextController(visualizationProperty) {
let visProp = visualizationProperty || 'textContent';
this.format = 'dd/MM/yyyy hh:mm:ss';
this.toView = function(data, view) {
let formattedDate = data;
if (!data) {
formattedDate = '';
} else if (data instanceof Date) {
formattedDate = formatDate(data, this.format);
} else {
try {
let tmpDate = new Date(data);
if (tmpDate instanceof Date) {
formattedDate = formatDate(tmpDate, this.format);
}
} catch (e) {
console.error('failed to parse "' + data + '" as date', e);
}
}
view[visProp] = formattedDate;
};
}
function signTemplate(template, sign) {
let children = template.content.childNodes;
for (let i = 0, l = children.length; i < l; i++) {
children[i].dataset.dtListItemAid = sign;
function DateTimeValueController() {
DateTimeTextController.call(this, 'value');
this.toData = function(changeEvent) {
console.warn('yet to be implemented, react on ' + changeEvent);
};
}
DateTimeValueController.prototype = Object.create(DateTimeTextController.prototype);
DateTimeValueController.prototype.constructor = DateTimeValueController;
let supportedTokens = {
d: function(date, len) { return date.getDate().toString().padStart(len, '0'); },
M: function(date, len) { return (date.getMonth() + 1).toString().padStart(len, '0'); },
y: function(date, len) {
let tmpY = date.getFullYear().toString();
if (tmpY.length > len) return tmpY.substr(tmpY.length - len);
else return tmpY.padStart(len, '0');
},
h: function(date, len) { return date.getHours().toString().padStart(len, '0'); },
m: function(date, len) { return date.getMinutes().toString().padStart(len, '0'); },
s: function(date, len) { return date.getSeconds().toString().padStart(len, '0'); },
f: function(date, len) { return date.getMilliseconds().toString().padStart(len, '0'); }
};
function formatDate(date, format) {
let result = '';
if (!format) {
result = date.toLocaleString();
} else {
let char, cnt;
for (let i = 0, l = format.length; i < l; i++) {
char = format.charAt(i);
if (supportedTokens[char]) {
cnt = 1;
while (i < l - 1 && format.charAt(i + 1) === char) {
cnt++;
i++;
}
result += supportedTokens[char](date, cnt);
} else {
result += char;
}
}
}
return result;
}
function extractProcessorParameters(paramValue) {
})();
(() => {
'use strict';
const namespace = this || window,
add = namespace.DataTier.controllers.add,
viewsService = namespace.DataTier.views;
function extractControllerParameters(paramValue) {
let procParam;

@@ -680,9 +747,9 @@ if (paramValue) {

function insertNewContent(container, template, processorParameters, from, to) {
let result, optimizationMap, tmpContent, tmpTemplate, index = from, i, i1, tmp,
prefix = processorParameters[0] + '.', optTmpIdx,
function insertNewContent(container, template, controllerParameters, from, to) {
let result = null, optimizationMap, tmpContent, tmpTemplate, index = from, i, i1, tmp,
prefix = controllerParameters[0] + '.', optTmpIdx,
views, view,
pairs, key;
tmpContent = template.content;
optimizationMap = prepareOptimizationMap(template, processorParameters[2]);
optimizationMap = prepareOptimizationMap(template, controllerParameters[2]);
optTmpIdx = optimizationMap.index;

@@ -756,2 +823,3 @@

let container = template.parentNode, ruleData,
fceDataSet,
templateItemAid,

@@ -763,10 +831,11 @@ desiredListLength = tiedValue.length;

}
if (!template.content.childElementCount) {
throw new Error('tieList\'s TEMPLATE MUST HAVE at least one child element');
if (template.content.childElementCount !== 1) {
throw new Error('tieList\'s TEMPLATE element MUST HAVE exactly one direct child element');
}
templateItemAid = template.content.firstChild.dataset.dtListItemAid;
fceDataSet = template.content.firstElementChild.dataset;
templateItemAid = fceDataSet.dtListItemAid;
if (!templateItemAid) {
templateItemAid = new Date().getTime();
signTemplate(template, templateItemAid);
fceDataSet.dtListItemAid = templateItemAid;
}

@@ -786,3 +855,3 @@

if (existingListLength < desiredListLength) {
ruleData = extractProcessorParameters(template.dataset.tieList);
ruleData = extractControllerParameters(template.dataset.tieList);
insertNewContent(container, template, ruleData, existingListLength, desiredListLength);

@@ -792,3 +861,2 @@ }

});
})();

@@ -1,1 +0,1 @@

(()=>{"use strict";function e(e){return a[e]}function t(e,t,n){if(function(e){if(!e||"string"!=typeof e)throw new Error("tie name MUST be a non-empty string");if(/\W/.test(e))throw new Error("tie name MUST consist of alphanumerics or underlines ([a-zA-Z0-9_]) ONLY")}(e),a[e])throw new Error("existing tie ("+e+") MAY NOT be re-created, use the tie's own APIs to reconfigure it");return new function(e,t,n){function i(t){r.DataTier.views.processChanges(e,t)}let l;Reflect.defineProperty(this,"name",{value:e}),Reflect.defineProperty(this,"data",{get:function(){return l},set:function(t){let n=l,a=o(t);l&&l.revoke(),(l=a)&&l.observe(i),r.DataTier.views.processChanges(e,[{type:"update",value:l,oldValue:n,path:[]}])}}),a[e]=this,this.data=t,Object.seal(this)}(e,o(t),n)}function n(e){e&&a[e]&&(a[e].observable.revoke(),delete a[e])}function o(e){if(void 0===e||null===e)return e;if("object"!=typeof e)throw new Error(e+" is not of type Observable and not an object");if("function"==typeof e.observe&&"function"==typeof e.unobserve&&"function"==typeof e.revoke)return e;if(r.Observable){if("function"==typeof e.observe||"function"==typeof e.unobserve||"function"==typeof e.revoke)throw new Error(e+" is not of type Observable and can not be transformed into Observable (some of its functions already implemented?)");return r.Observable.from(e)}throw new Error(e+" is not of type Observable and no embedded Observable implementation found")}(()=>{let e=window,t=Symbol.for("data-tier");for(;e.parent!==e;)e=e.parent;if(e[t])throw new Error("data-tier found to already being running within this application, cancelling current execution");e[t]=!0})();const r=this||window,a={};Reflect.defineProperty(r,"DataTier",{value:{}}),Reflect.defineProperty(r.DataTier,"ties",{value:{get get(){return e},get create(){return t},get remove(){return n}}})})(),(()=>{"use strict";function e(e,o){Reflect.defineProperty(this,"name",{value:e}),Reflect.defineProperty(this,"toView",{value:o.toView}),Reflect.defineProperty(this,"toData",{value:"function"==typeof o.toData?o.toData:function(e){!function(e,t,n){let o;if(!e)return;for(o=0;o<t.length-1;o++)e=e[t[o]]&&"object"==typeof e[t[o]]?e[t[o]]:e[t[o]]={};e[t[o]]=n}(e.data,e.path,e.view.value)}}),Reflect.defineProperty(this,"changeDOMEventType",{value:"string"==typeof o.changeDOMEventType?o.changeDOMEventType:null}),Reflect.defineProperty(this,"parseParam",{value:"function"==typeof o.parseParam?o.parseParam:t}),Reflect.defineProperty(this,"isChangedPathRelevant",{value:"function"==typeof o.isChangedPathRelevant?o.isChangedPathRelevant:n})}function t(e){let t="",n=[];return e&&(t=(n=e.trim().split(".")).shift()),{tieName:t,dataPath:n}}function n(e,t){return t.startsWith(e)}function o(t,n){if("string"!=typeof t||!t)throw new Error("name MUST be a non-empty string");if(s[t])throw new Error('data processor "'+t+'" already exists; you may want to reconfigure the existing one');if("object"!=typeof n||!n)throw new Error("configuration MUST be a non-null object");if("function"!=typeof n.toView)throw new Error('configuration MUST have a "toView" function defined');s[t]=new e(t,n),l.DataTier.views.applyProcessor(s[t])}function r(e){return s[e]}function a(e){if("string"!=typeof e||!e)throw new Error("controller name MUST be a non-empty string");return delete s[e]}function i(e){let t=[];return e&&e.dataset&&Object.keys(e.dataset).filter(e=>e in s).map(e=>s[e]).forEach(e=>t.push(e)),t}const l=this||window,s={};if(!l.DataTier)throw new Error("data-tier framework was not properly initialized");Reflect.defineProperty(e.prototype,"parseParam",{value:t}),Reflect.defineProperty(e.prototype,"isChangedPathRelevant",{value:n}),Reflect.defineProperty(l.DataTier,"processors",{value:{get get(){return r},get add(){return o},get remove(){return a},get getApplicable(){return i}}})})(),(()=>{"use strict";function e(e){let t,n,o,r,a=e.target,i=p.getApplicable(a);for(r=i.length;r--;)if(t=i[r],e.type===t.changeDOMEventType){if(n=t.parseParam(a.dataset[t.name]),o=h.get(n.tieName),!n.dataPath)return void console.error("path to data not available");if(!o)return void console.error('tie "'+n.tieName+'" not found');t.toData({data:o.data,path:n.dataPath,view:a})}}function t(t,n){t.addEventListener(n,e)}function n(t,n){t.removeEventListener(n,e)}function o(e){if("IFRAME"===e.nodeName)d(e.contentDocument),e.addEventListener("load",function(){d(this.contentDocument),a(this.contentDocument)}),a(e.contentDocument);else if(e.dataset){let n,o,a,i,l,s,c,f,d=Object.keys(e.dataset);for(f=d.length;f--;)(n=d[f]).startsWith("tie")&&((o=p.get(n))?(i=(a=o.parseParam(e.dataset[o.name])).dataPath.join("."),(c=(s=(l=m[a.tieName]||(m[a.tieName]={}))[o.name]||(l[o.name]={}))[i]||(s[i]=[])).indexOf(e)<0&&(c.push(e),r(e,o.name),o.changeDOMEventType&&t(e,o.changeDOMEventType))):(g[n]||(g[n]=[]),g[n].push(e)))}}function r(e,t){let n,o,r,a;o=(n=p.get(t)).parseParam(e.dataset[t]),(r=h.get(o.tieName))&&(a=function(e,t){if(e){for(let n=0,o=t.length;n<o;n++){if(!(t[n]in e))return;e=e[t[n]]}return e}}(r.data,o.dataPath),n.toView(a,e))}function a(e){if(e&&(e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.ELEMENT_NODE)){let t,n;for(t="IFRAME"===e.nodeName?e.contentDocument.getElementsByTagName("*"):e.getElementsByTagName("*"),o(e),n=t.length;n--;)o(t[n])}}function i(e){if(e&&e.getElementsByTagName){let t,o,r,a,i,l,s,c,f,d=e.getElementsByTagName("*");for(a=0,i=d.length;a<=i;a++)if((t=a<i?d[a]:e).dataset&&t.dataset.length)for(l=(o=p.getApplicable(t)).length;l--;)s=(r=o[l]).parseParam(t.dataset[r.name]),(f=(c=m[s.tieName][r.name][s.dataPath.join(".")]).indexOf(t))>=0&&(c.splice(f,1),r.changeDOMEventType&&n(t,r.changeDOMEventType))}}function l(e,t,n,o){let a,i,l,s=-1;(a=p.get(t))&&(i=p.get(t).parseParam(n),m[i.tieName]&&m[i.tieName][t]&&((l=m[i.tieName][t][i.dataPath])&&(s=l.indexOf(e)),s>=0&&l.splice(s,1)),i=p.get(t).parseParam(o),m[i.tieName]||(m[i.tieName]={}),m[i.tieName][t]||(m[i.tieName][t]={}),m[i.tieName][t][i.dataPath]||(m[i.tieName][t][i.dataPath]=[]),m[i.tieName][t][i.dataPath].push(e),r(e,t))}function s(e,t){let n,o,a,i,l,s,c,f,d,u,h,g,y,w=m[e];if(w)for(u=t.length;u--;)for(o=(n=t[u]).path?n.path.join("."):null,h=(a=Object.keys(w)).length;h--;)if(i=a[h],f=w[i])for(l=p.get(i),g=(s=Object.keys(f)).length;g--;)if(c=s[g],l.isChangedPathRelevant(o,c))for(y=(d=f[c]).length;y--;)r(d[y],i)}function c(e){g[e.name]&&(g[e.name].forEach(o),delete g[e.name])}function f(e){let t,n=2,o=e.split("-");for(t=o[1];n<o.length;)t+=o[n][0].toUpperCase()+o[n++].substr(1);return t}function d(e){new MutationObserver(function(e){let t,n,o,r,s,c,u,h;for(t=e.length;t--;)if(r=e[t],"attributes"===(s=r.type)){let e=r.target,t=r.attributeName;if(e.nodeType!==Node.DOCUMENT_NODE&&e.nodeType!==Node.ELEMENT_NODE)continue;0===t.indexOf("data-tie")?l(e,f(t),r.oldValue,e.getAttribute(t)):"src"===t&&"IFRAME"===e.nodeName&&i(e.contentDocument)}else if("childList"===s){for(n=(c=r.addedNodes).length;n--;)(h=c[n]).nodeType!==Node.DOCUMENT_NODE&&h.nodeType!==Node.ELEMENT_NODE||("IFRAME"===h.nodeName?(h.contentDocument&&(d(h.contentDocument),a(h.contentDocument)),h.addEventListener("load",function(){d(this.contentDocument),a(this.contentDocument)})):a(h));for(o=(u=r.removedNodes).length;o--;)(h=u[o]).nodeType!==Node.DOCUMENT_NODE&&h.nodeType!==Node.ELEMENT_NODE||i("IFRAME"===h.nodeName?h.contentDocument:h)}}).observe(e,{childList:!0,attributes:!0,characterData:!1,subtree:!0,attributeOldValue:!0,characterDataOldValue:!1})}const u=this||window;if(!u.DataTier)throw new Error("data-tier framework was not properly initialized");const h=u.DataTier.ties,p=u.DataTier.processors,m={},g={};Reflect.defineProperty(u.DataTier,"views",{value:{get processChanges(){return s},get applyProcessor(){return c},get updateView(){return r}}}),d(document),a(document)})(),(()=>{"use strict";const e=this||window,t=e.DataTier.processors.add;if(!e.DataTier)throw new Error("data-tier framework was not properly initialized");t("tieValue",{toView:function(e,t){"checkbox"===t.type?t.checked=e:t.value=void 0!==e&&null!==e?e:""},changeDOMEventType:"change"}),t("tieInput",{toView:function(e,t){t.value=void 0!==e&&null!==e?e:""},changeDOMEventType:"input"}),t("tieText",{toView:function(e,t){t.textContent=void 0!==e&&null!==e?e:""}}),t("tiePlaceholder",{toView:function(e,t){t.placeholder=void 0!==e&&null!==e?e:""}}),t("tieTooltip",{toView:function(e,t){t.title=void 0!==e&&null!==e?e:""}}),t("tieSrc",{toView:function(e,t){t.src=void 0!==e&&null!==e?e:""}}),t("tieHRef",{toView:function(e,t){t.href=void 0!==e&&null!==e?e:""}}),t("tieDateValue",{toView:function(e,t){t.value=void 0!==e&&null!==e?e.toLocaleString():""}}),t("tieDateText",{toView:function(e,t){t.textContent=void 0!==e&&null!==e?e.toLocaleString():""}}),t("tieClasses",{isChangedPathRelevant:function(e,t){let n=e.replace(t,"").split(".");return this.constructor.prototype.isChangedPathRelevant(e,t)||1===n.length||2===n.length&&""===n[0]},toView:function(e,t){e&&"object"==typeof e&&Object.keys(e).forEach(function(n){e[n]?t.classList.add(n):t.classList.remove(n)})}})})(),(()=>{"use strict";function e(e,t,n,o,r){let a,i,l,s,c,f,d,u,h,p,m,g,y=o,w=n[0]+".";for(l=t.content,u=(i=function(e,t){let n,o,r,a,i,l,s={index:[]},c=e.content.querySelectorAll("*"),f=c.length;for(;f--;)if((n=c[f]).nodeType===Node.DOCUMENT_NODE||n.nodeType===Node.ELEMENT_NODE){for(r=(o=Object.keys(n.dataset)).length,l=[];r--;)a=o[r],i=n.dataset[a],a.startsWith("tie")&&i.startsWith(t)&&l.push([a,i.replace(t,"")]);l.length&&(s[f]=l,s.index.push(f))}return s}(t,n[2])).index;y<r;y++){for(h=(s=l.cloneNode(!0)).querySelectorAll("*"),c=u.length;c--;)for(p=h[d=u[c]],f=(m=i[d]).length;f--;)g=m[f][0],p.dataset[g]=w+y+m[f][1];y===o?a=s:a.appendChild(s)}e.appendChild(a)}const t=this||window,n=t.DataTier.processors.add,o=t.DataTier.views;if(!t.DataTier)throw new Error("data-tier framework was not properly initialized");n("tieList",{parseParam:function(e){return this.constructor.prototype.parseParam(e.split(/\s*=>\s*/)[0])},isChangedPathRelevant:function(e,t){if(!e)return!0;let n=e.replace(t,"").split(".");return this.constructor.prototype.isChangedPathRelevant(e,t)||1===n.length||2===n.length&&""===n[0]},toView:function(t,n){if(!Array.isArray(t)||!n)return;let r,a,i=n.parentNode,l=t.length;if("TEMPLATE"!==n.nodeName)throw new Error("tieList may be defined on template elements only");if(!n.content.childElementCount)throw new Error("tieList's TEMPLATE MUST HAVE at least one child element");(a=n.content.firstChild.dataset.dtListItemAid)||function(e,t){let n=e.content.childNodes;for(let e=0,o=n.length;e<o;e++)n[e].dataset.dtListItemAid=t}(n,a=(new Date).getTime());let s=i.querySelectorAll('[data-dt-list-item-aid="'+a+'"]'),c=s.length;if(c>l)for(;c>l;)i.removeChild(s[--c]);!function(e,t,n){let r,a=e.content.querySelectorAll("*"),i=[];for(r=a.length;r--;)i[r]=Object.keys(a[r].dataset).filter(e=>e.startsWith("tie"));let l,s,c,f,d,u,h=0;for(r=0;h<n;)if((c=t.childNodes[r++])!==e&&(c.nodeType===Node.DOCUMENT_NODE||c.nodeType===Node.ELEMENT_NODE)&&c.dataset.dtListItemAid){for(f=c.querySelectorAll("*"),l=i.length;l--;)for(d=l?f[l-1]:c,s=(u=i[l]).length;s--;)o.updateView(d,u[s]);h++}}(n,i,c),c<l&&e(i,n,r=function(e){let t;if(e&&(!(t=e.trim().split(/\s+/))||3!==t.length||"=>"!==t[1]))throw new Error('invalid parameter for "tieList" rule specified');return t}(n.dataset.tieList),c,l)}})})();
(()=>{"use strict";function e(e){return i[e]}function t(e,t,n){if(function(e){if(!e||"string"!=typeof e)throw new Error("tie name MUST be a non-empty string");if(/\W/.test(e))throw new Error("tie name MUST consist of alphanumerics or underlines ([a-zA-Z0-9_]) ONLY")}(e),i[e])throw new Error("existing tie ("+e+") MAY NOT be re-created, use the tie's own APIs to reconfigure it");return new function(e,t,n){function a(t){r.DataTier.views.processChanges(e,t)}let l;Reflect.defineProperty(this,"name",{value:e}),Reflect.defineProperty(this,"data",{get:function(){return l},set:function(t){let n=l,i=o(t);l&&l.revoke(),(l=i)&&l.observe(a),r.DataTier.views.processChanges(e,[{type:"update",value:l,oldValue:n,path:[]}])}}),i[e]=this,this.data=t,Object.seal(this)}(e,o(t),n)}function n(e){e&&i[e]&&(i[e].observable.revoke(),delete i[e])}function o(e){if(void 0===e||null===e)return e;if("object"!=typeof e)throw new Error(e+" is not of type Observable and not an object");if("function"==typeof e.observe&&"function"==typeof e.unobserve&&"function"==typeof e.revoke)return e;if(r.Observable){if("function"==typeof e.observe||"function"==typeof e.unobserve||"function"==typeof e.revoke)throw new Error(e+" is not of type Observable and can not be transformed into Observable (some of its functions already implemented?)");return r.Observable.from(e)}throw new Error(e+" is not of type Observable and no embedded Observable implementation found")}(()=>{let e=window,t=Symbol.for("data-tier");for(;e.parent!==e;)e=e.parent;if(e[t])throw new Error("data-tier found to already being running within this application, cancelling current execution");e[t]=!0})();const r=this||window,i={};Reflect.defineProperty(r,"DataTier",{value:{}}),Reflect.defineProperty(r.DataTier,"ties",{value:{get get(){return e},get create(){return t},get remove(){return n}}})})(),(()=>{"use strict";function e(e,t){Reflect.defineProperty(this,"name",{value:e}),Object.assign(this,t)}function t(t,n){if("string"!=typeof t||!t)throw new Error("name MUST be a non-empty string");if(s[t])throw new Error('data controller "'+t+'" already exists; you may want to reconfigure the existing one');if("object"!=typeof n||!n)throw new Error("configuration MUST be a non-null object");if("function"!=typeof n.toView)throw new Error('configuration MUST have a "toView" function defined');s[t]=new e(t,n),l.DataTier.views.applyController(s[t])}function n(e){return s[e]}function o(e){if("string"!=typeof e||!e)throw new Error("controller name MUST be a non-empty string");return delete s[e]}function r(e){let t=[];return e&&e.dataset&&Object.keys(e.dataset).filter(e=>e in s).map(e=>s[e]).forEach(e=>t.push(e)),t}function i(e){let t="",n=[];return e&&(t=(n=e.trim().split(".")).shift()),{tieName:t,dataPath:n}}function a(e,t){return t.startsWith(e)}const l=this||window,s={};e.prototype.toData=function(e){!function(e,t,n){let o;if(e){for(o=0;o<t.length-1;o++)e=e[t[o]]&&"object"==typeof e[t[o]]?e[t[o]]:e[t[o]]={};e[t[o]]=n}}(e.data,e.path,e.view.value)},e.prototype.parseParam=i,e.prototype.isChangedPathRelevant=a,Reflect.defineProperty(e.prototype,"parseParam",{value:i}),Reflect.defineProperty(e.prototype,"isChangedPathRelevant",{value:a}),Reflect.defineProperty(l.DataTier,"controllers",{value:{get get(){return n},get add(){return t},get remove(){return o},get getApplicable(){return r}}})})(),(()=>{"use strict";function e(e){let t,n,o,r,i=e.target,a=p.getApplicable(i);for(r=a.length;r--;)if(t=a[r],e.type===t.changeDOMEventType){if(n=t.parseParam(i.dataset[t.name]),o=h.get(n.tieName),!n.dataPath)return void console.error("path to data not available");if(!o)return void console.error('tie "'+n.tieName+'" not found');t.toData({data:o.data,path:n.dataPath,view:i})}}function t(t,n){t.addEventListener(n,e)}function n(t,n){t.removeEventListener(n,e)}function o(e){if("IFRAME"===e.nodeName)f(e.contentDocument),e.addEventListener("load",function(){f(this.contentDocument),i(this.contentDocument)}),i(e.contentDocument);else if(e.dataset){let n,o,i,a,l,s,c,u,f=Object.keys(e.dataset);for(u=f.length;u--;)(n=f[u]).startsWith("tie")&&((o=p.get(n))?(a=(i=o.parseParam(e.dataset[o.name])).dataPath.join("."),(c=(s=(l=g[i.tieName]||(g[i.tieName]={}))[o.name]||(l[o.name]={}))[a]||(s[a]=[])).indexOf(e)<0&&(c.push(e),r(e,o.name),o.changeDOMEventType&&t(e,o.changeDOMEventType))):(m[n]||(m[n]=[]),m[n].push(e)))}}function r(e,t){let n,o,r,i;o=(n=p.get(t)).parseParam(e.dataset[t]),(r=h.get(o.tieName))&&(i=function(e,t){if(e){for(let n=0,o=t.length;n<o;n++){if(!(t[n]in e))return;e=e[t[n]]}return e}}(r.data,o.dataPath),n.toView(i,e))}function i(e){if(e&&(e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.ELEMENT_NODE)){let t,n;for(t="IFRAME"===e.nodeName?e.contentDocument.getElementsByTagName("*"):e.getElementsByTagName("*"),o(e),n=t.length;n--;)o(t[n])}}function a(e){if(e&&e.getElementsByTagName){let t,o,r,i,a,l,s,c,u,f=e.getElementsByTagName("*");for(i=0,a=f.length;i<=a;i++)if((t=i<a?f[i]:e).dataset&&t.dataset.length)for(l=(o=p.getApplicable(t)).length;l--;)s=(r=o[l]).parseParam(t.dataset[r.name]),(u=(c=g[s.tieName][r.name][s.dataPath.join(".")]).indexOf(t))>=0&&(c.splice(u,1),r.changeDOMEventType&&n(t,r.changeDOMEventType))}}function l(e,t,n,o){let i,a,l,s=-1;(i=p.get(t))&&(a=p.get(t).parseParam(n),g[a.tieName]&&g[a.tieName][t]&&((l=g[a.tieName][t][a.dataPath])&&(s=l.indexOf(e)),s>=0&&l.splice(s,1)),a=p.get(t).parseParam(o),g[a.tieName]||(g[a.tieName]={}),g[a.tieName][t]||(g[a.tieName][t]={}),g[a.tieName][t][a.dataPath]||(g[a.tieName][t][a.dataPath]=[]),g[a.tieName][t][a.dataPath].push(e),r(e,t))}function s(e,t){let n,o,i,a,l,s,c,u,f,d,h,m,y,w=g[e];if(w)for(d=t.length;d--;)for(o=(n=t[d]).path?n.path.join("."):null,h=(i=Object.keys(w)).length;h--;)if(a=i[h],u=w[a])for(l=p.get(a),m=(s=Object.keys(u)).length;m--;)if(c=s[m],l.isChangedPathRelevant(o,c))for(y=(f=u[c]).length;y--;)r(f[y],a)}function c(e){m[e.name]&&(m[e.name].forEach(o),delete m[e.name])}function u(e){let t,n=2,o=e.split("-");for(t=o[1];n<o.length;)t+=o[n][0].toUpperCase()+o[n++].substr(1);return t}function f(e){new MutationObserver(function(e){let t,n,o,r,s,c,d,h;for(t=e.length;t--;)if(r=e[t],"attributes"===(s=r.type)){let e=r.target,t=r.attributeName;if(e.nodeType!==Node.DOCUMENT_NODE&&e.nodeType!==Node.ELEMENT_NODE)continue;0===t.indexOf("data-tie")?l(e,u(t),r.oldValue,e.getAttribute(t)):"src"===t&&"IFRAME"===e.nodeName&&a(e.contentDocument)}else if("childList"===s){for(n=(c=r.addedNodes).length;n--;)(h=c[n]).nodeType!==Node.DOCUMENT_NODE&&h.nodeType!==Node.ELEMENT_NODE||("IFRAME"===h.nodeName?(h.contentDocument&&(f(h.contentDocument),i(h.contentDocument)),h.addEventListener("load",function(){f(this.contentDocument),i(this.contentDocument)})):i(h));for(o=(d=r.removedNodes).length;o--;)(h=d[o]).nodeType!==Node.DOCUMENT_NODE&&h.nodeType!==Node.ELEMENT_NODE||a("IFRAME"===h.nodeName?h.contentDocument:h)}}).observe(e,{childList:!0,attributes:!0,characterData:!1,subtree:!0,attributeOldValue:!0,characterDataOldValue:!1})}const d=this||window;if(!d.DataTier)throw new Error("data-tier framework was not properly initialized");const h=d.DataTier.ties,p=d.DataTier.controllers,g={},m={};Reflect.defineProperty(d.DataTier,"views",{value:{get processChanges(){return s},get applyController(){return c},get updateView(){return r}}}),f(document),i(document)})(),(()=>{"use strict";const e=(this||window).DataTier.controllers.add;e("tieValue",{toView:function(e,t){"checkbox"===t.type?t.checked=e:t.value=void 0!==e&&null!==e?e:""},changeDOMEventType:"change"}),e("tieInput",{toView:function(e,t){t.value=void 0!==e&&null!==e?e:""},changeDOMEventType:"input"}),e("tieText",{toView:function(e,t){t.textContent=void 0!==e&&null!==e?e:""}}),e("tiePlaceholder",{toView:function(e,t){t.placeholder=void 0!==e&&null!==e?e:""}}),e("tieTooltip",{toView:function(e,t){t.title=void 0!==e&&null!==e?e:""}}),e("tieSrc",{toView:function(e,t){t.src=void 0!==e&&null!==e?e:""}}),e("tieHref",{toView:function(e,t){t.href=void 0!==e&&null!==e?e:""}}),e("tieClasses",{isChangedPathRelevant:function(e,t){let n=e.replace(t,"").split(".");return this.constructor.prototype.isChangedPathRelevant(e,t)||1===n.length||2===n.length&&""===n[0]},toView:function(e,t){e&&"object"==typeof e&&Object.keys(e).forEach(function(n){e[n]?t.classList.add(n):t.classList.remove(n)})}})})(),(()=>{"use strict";function e(e){let t=e||"textContent";this.format="dd/MM/yyyy hh:mm:ss",this.toView=function(e,o){let r=e;if(e)if(e instanceof Date)r=n(e,this.format);else try{let t=new Date(e);t instanceof Date&&(r=n(t,this.format))}catch(t){console.error('failed to parse "'+e+'" as date',t)}else r="";o[t]=r}}function t(){e.call(this,"value"),this.toData=function(e){console.warn("yet to be implemented, react on "+e)}}function n(e,t){let n="";if(t){let o,i;for(let a=0,l=t.length;a<l;a++)if(o=t.charAt(a),r[o]){for(i=1;a<l-1&&t.charAt(a+1)===o;)i++,a++;n+=r[o](e,i)}else n+=o}else n=e.toLocaleString();return n}const o=(this||window).DataTier.controllers.add;o("tieDateValue",{toView:function(e,t){t.value=void 0!==e&&null!==e?e.toLocaleString():""}}),o("tieDateText",{toView:function(e,t){t.textContent=void 0!==e&&null!==e?e.toLocaleString():""}}),o("tieDatetimeText",new e),o("tieDatetimeValue",new t),(t.prototype=Object.create(e.prototype)).constructor=t;let r={d:function(e,t){return e.getDate().toString().padStart(t,"0")},M:function(e,t){return(e.getMonth()+1).toString().padStart(t,"0")},y:function(e,t){let n=e.getFullYear().toString();return n.length>t?n.substr(n.length-t):n.padStart(t,"0")},h:function(e,t){return e.getHours().toString().padStart(t,"0")},m:function(e,t){return e.getMinutes().toString().padStart(t,"0")},s:function(e,t){return e.getSeconds().toString().padStart(t,"0")},f:function(e,t){return e.getMilliseconds().toString().padStart(t,"0")}}})(),(()=>{"use strict";function e(e,t,n,o,r){let i,a,l,s,c,u,f,d,h,p,g,m=null,y=o,w=n[0]+".";for(a=t.content,f=(i=function(e,t){let n,o,r,i,a,l,s={index:[]},c=e.content.querySelectorAll("*"),u=c.length;for(;u--;)if((n=c[u]).nodeType===Node.DOCUMENT_NODE||n.nodeType===Node.ELEMENT_NODE){for(r=(o=Object.keys(n.dataset)).length,l=[];r--;)i=o[r],a=n.dataset[i],i.startsWith("tie")&&a.startsWith(t)&&l.push([i,a.replace(t,"")]);l.length&&(s[u]=l,s.index.push(u))}return s}(t,n[2])).index;y<r;y++){for(d=(l=a.cloneNode(!0)).querySelectorAll("*"),s=f.length;s--;)for(h=d[u=f[s]],c=(p=i[u]).length;c--;)g=p[c][0],h.dataset[g]=w+y+p[c][1];y===o?m=l:m.appendChild(l)}e.appendChild(m)}const t=this||window,n=t.DataTier.controllers.add,o=t.DataTier.views;n("tieList",{parseParam:function(e){return this.constructor.prototype.parseParam(e.split(/\s*=>\s*/)[0])},isChangedPathRelevant:function(e,t){if(!e)return!0;let n=e.replace(t,"").split(".");return this.constructor.prototype.isChangedPathRelevant(e,t)||1===n.length||2===n.length&&""===n[0]},toView:function(t,n){if(!Array.isArray(t)||!n)return;let r,i,a,l=n.parentNode,s=t.length;if("TEMPLATE"!==n.nodeName)throw new Error("tieList may be defined on template elements only");if(1!==n.content.childElementCount)throw new Error("tieList's TEMPLATE element MUST HAVE exactly one direct child element");(a=(i=n.content.firstElementChild.dataset).dtListItemAid)||(a=(new Date).getTime(),i.dtListItemAid=a);let c=l.querySelectorAll('[data-dt-list-item-aid="'+a+'"]'),u=c.length;if(u>s)for(;u>s;)l.removeChild(c[--u]);!function(e,t,n){let r,i=e.content.querySelectorAll("*"),a=[];for(r=i.length;r--;)a[r]=Object.keys(i[r].dataset).filter(e=>e.startsWith("tie"));let l,s,c,u,f,d,h=0;for(r=0;h<n;)if((c=t.childNodes[r++])!==e&&(c.nodeType===Node.DOCUMENT_NODE||c.nodeType===Node.ELEMENT_NODE)&&c.dataset.dtListItemAid){for(u=c.querySelectorAll("*"),l=a.length;l--;)for(f=l?u[l-1]:c,s=(d=a[l]).length;s--;)o.updateView(f,d[s]);h++}}(n,l,u),u<s&&e(l,n,r=function(e){let t;if(e&&(!(t=e.trim().split(/\s+/))||3!==t.length||"=>"!==t[1]))throw new Error('invalid parameter for "tieList" rule specified');return t}(n.dataset.tieList),u,s)}})})();

@@ -610,36 +610,16 @@ (() => {

const namespace = this || window,
processors = {};
controllers = {};
if (!namespace.DataTier) {
throw new Error('data-tier framework was not properly initialized');
}
function DataProcessor(name, options) {
function Controller(name, options) {
Reflect.defineProperty(this, 'name', {value: name});
Reflect.defineProperty(this, 'toView', {value: options.toView});
Reflect.defineProperty(this, 'toData', {value: typeof options.toData === 'function' ? options.toData : defaultToData});
Reflect.defineProperty(this, 'changeDOMEventType', {value: typeof options.changeDOMEventType === 'string' ? options.changeDOMEventType : null});
Reflect.defineProperty(this, 'parseParam', {value: typeof options.parseParam === 'function' ? options.parseParam : defaultParseParam});
Reflect.defineProperty(this, 'isChangedPathRelevant', {value: typeof options.isChangedPathRelevant === 'function' ? options.isChangedPathRelevant : defaultIsChangedPathRelevant});
Object.assign(this, options);
}
function defaultParseParam(param) {
let tieName = '', dataPath = [];
if (param) {
dataPath = param.trim().split('.');
tieName = dataPath.shift();
}
return {
tieName: tieName,
dataPath: dataPath
};
}
Controller.prototype.toData = defaultToData;
Controller.prototype.parseParam = defaultParseParam;
Controller.prototype.isChangedPathRelevant = defaultIsChangedPathRelevant;
function defaultIsChangedPathRelevant(changedPath, viewedPath) {
return viewedPath.startsWith(changedPath);
}
Reflect.defineProperty(Controller.prototype, 'parseParam', {value: defaultParseParam});
Reflect.defineProperty(Controller.prototype, 'isChangedPathRelevant', {value: defaultIsChangedPathRelevant});
Reflect.defineProperty(DataProcessor.prototype, 'parseParam', {value: defaultParseParam});
Reflect.defineProperty(DataProcessor.prototype, 'isChangedPathRelevant', {value: defaultIsChangedPathRelevant});
function add(name, configuration) {

@@ -649,4 +629,4 @@ if (typeof name !== 'string' || !name) {

}
if (processors[name]) {
throw new Error('data processor "' + name + '" already exists; you may want to reconfigure the existing one');
if (controllers[name]) {
throw new Error('data controller "' + name + '" already exists; you may want to reconfigure the existing one');
}

@@ -660,8 +640,8 @@ if (typeof configuration !== 'object' || !configuration) {

processors[name] = new DataProcessor(name, configuration);
namespace.DataTier.views.applyProcessor(processors[name]);
controllers[name] = new Controller(name, configuration);
namespace.DataTier.views.applyController(controllers[name]);
}
function get(name) {
return processors[name];
return controllers[name];
}

@@ -674,3 +654,3 @@

return delete processors[name];
return delete controllers[name];
}

@@ -682,5 +662,5 @@

Object.keys(element.dataset)
.filter(key => key in processors)
.map(key => processors[key])
.forEach(processor => result.push(processor));
.filter(key => key in controllers)
.map(key => controllers[key])
.forEach(controller => result.push(controller));
}

@@ -694,2 +674,18 @@ return result;

function defaultParseParam(param) {
let tieName = '', dataPath = [];
if (param) {
dataPath = param.trim().split('.');
tieName = dataPath.shift();
}
return {
tieName: tieName,
dataPath: dataPath
};
}
function defaultIsChangedPathRelevant(changedPath, viewedPath) {
return viewedPath.startsWith(changedPath);
}
function setPath(ref, path, value) {

@@ -704,3 +700,3 @@ let i;

Reflect.defineProperty(namespace.DataTier, 'processors', {
Reflect.defineProperty(namespace.DataTier, 'controllers', {
value: {

@@ -724,7 +720,7 @@ get get() { return get; },

const ties = namespace.DataTier.ties,
processors = namespace.DataTier.processors,
controllers = namespace.DataTier.controllers,
views = {},
nlvs = {};
// TODO: this is similar to setPath in processors-service - unify
// TODO: this is similar to setPath in controllers-service - unify
function getPath(ref, path) {

@@ -741,11 +737,11 @@ if (!ref) return;

let target = event.target,
relevantProcessors = processors.getApplicable(target),
processor, processorParam, tie, i;
i = relevantProcessors.length;
relevantControllers = controllers.getApplicable(target),
controller, controllerParam, tie, i;
i = relevantControllers.length;
while (i--) {
processor = relevantProcessors[i];
if (event.type === processor.changeDOMEventType) {
processorParam = processor.parseParam(target.dataset[processor.name]);
tie = ties.get(processorParam.tieName);
if (!processorParam.dataPath) {
controller = relevantControllers[i];
if (event.type === controller.changeDOMEventType) {
controllerParam = controller.parseParam(target.dataset[controller.name]);
tie = ties.get(controllerParam.tieName);
if (!controllerParam.dataPath) {
console.error('path to data not available');

@@ -755,7 +751,7 @@ return;

if (!tie) {
console.error('tie "' + processorParam.tieName + '" not found');
console.error('tie "' + controllerParam.tieName + '" not found');
return;
}
processor.toData({data: tie.data, path: processorParam.dataPath, view: target});
controller.toData({data: tie.data, path: controllerParam.dataPath, view: target});
}

@@ -783,3 +779,3 @@ }

let keys = Object.keys(view.dataset), key,
processor, processorParam, pathString,
controller, controllerParam, pathString,
tieViews, procViews, pathViews, i;

@@ -790,8 +786,8 @@ i = keys.length;

if (!key.startsWith('tie')) continue;
processor = processors.get(key);
if (processor) {
processorParam = processor.parseParam(view.dataset[processor.name]);
pathString = processorParam.dataPath.join('.');
tieViews = views[processorParam.tieName] || (views[processorParam.tieName] = {});
procViews = tieViews[processor.name] || (tieViews[processor.name] = {});
controller = controllers.get(key);
if (controller) {
controllerParam = controller.parseParam(view.dataset[controller.name]);
pathString = controllerParam.dataPath.join('.');
tieViews = views[controllerParam.tieName] || (views[controllerParam.tieName] = {});
procViews = tieViews[controller.name] || (tieViews[controller.name] = {});
pathViews = procViews[pathString] || (procViews[pathString] = []);

@@ -801,9 +797,9 @@

pathViews.push(view);
update(view, processor.name);
if (processor.changeDOMEventType) {
addChangeListener(view, processor.changeDOMEventType);
update(view, controller.name);
if (controller.changeDOMEventType) {
addChangeListener(view, controller.changeDOMEventType);
}
}
} else {
// collect potentially future processor's element and put them into some tracking storage
// collect potentially future controller's element and put them into some tracking storage
if (!nlvs[key]) nlvs[key] = [];

@@ -816,6 +812,6 @@ nlvs[key].push(view);

function update(view, processorName) {
function update(view, controllerName) {
let r, p, t, data;
r = processors.get(processorName);
p = r.parseParam(view.dataset[processorName]);
r = controllers.get(controllerName);
p = r.parseParam(view.dataset[controllerName]);
t = ties.get(p.tieName);

@@ -846,3 +842,3 @@ if (t) {

let list = rootElement.getElementsByTagName('*'),
element, tmpProcs, processor, i, l, i1,
element, tmpCtrls, controller, i, l, i1,
param, pathViews, index;

@@ -852,13 +848,13 @@ for (i = 0, l = list.length; i <= l; i++) {

if (!element.dataset || !element.dataset.length) continue;
tmpProcs = processors.getApplicable(element);
i1 = tmpProcs.length;
tmpCtrls = controllers.getApplicable(element);
i1 = tmpCtrls.length;
while (i1--) {
processor = tmpProcs[i1];
param = processor.parseParam(element.dataset[processor.name]);
pathViews = views[param.tieName][processor.name][param.dataPath.join('.')];
controller = tmpCtrls[i1];
param = controller.parseParam(element.dataset[controller.name]);
pathViews = views[param.tieName][controller.name][param.dataPath.join('.')];
index = pathViews.indexOf(element);
if (index >= 0) {
pathViews.splice(index, 1);
if (processor.changeDOMEventType) {
delChangeListener(element, processor.changeDOMEventType);
if (controller.changeDOMEventType) {
delChangeListener(element, controller.changeDOMEventType);
}

@@ -871,12 +867,12 @@ }

function move(view, processorName, oldParam, newParam) {
let processor, processorParam, pathViews, i = -1;
function move(view, controllerName, oldParam, newParam) {
let controller, controllerParam, pathViews, i = -1;
processor = processors.get(processorName);
if (!processor) return;
processorParam = processors.get(processorName).parseParam(oldParam);
controller = controllers.get(controllerName);
if (!controller) return;
controllerParam = controllers.get(controllerName).parseParam(oldParam);
// delete old path
if (views[processorParam.tieName] && views[processorParam.tieName][processorName]) {
pathViews = views[processorParam.tieName][processorName][processorParam.dataPath];
if (views[controllerParam.tieName] && views[controllerParam.tieName][controllerName]) {
pathViews = views[controllerParam.tieName][controllerName][controllerParam.dataPath];
if (pathViews) i = pathViews.indexOf(view);

@@ -889,8 +885,8 @@ if (i >= 0) {

// add new path
processorParam = processors.get(processorName).parseParam(newParam);
if (!views[processorParam.tieName]) views[processorParam.tieName] = {};
if (!views[processorParam.tieName][processorName]) views[processorParam.tieName][processorName] = {};
if (!views[processorParam.tieName][processorName][processorParam.dataPath]) views[processorParam.tieName][processorName][processorParam.dataPath] = [];
views[processorParam.tieName][processorName][processorParam.dataPath].push(view);
update(view, processorName);
controllerParam = controllers.get(controllerName).parseParam(newParam);
if (!views[controllerParam.tieName]) views[controllerParam.tieName] = {};
if (!views[controllerParam.tieName][controllerName]) views[controllerParam.tieName][controllerName] = {};
if (!views[controllerParam.tieName][controllerName][controllerParam.dataPath]) views[controllerParam.tieName][controllerName][controllerParam.dataPath] = [];
views[controllerParam.tieName][controllerName][controllerParam.dataPath].push(view);
update(view, controllerName);
}

@@ -900,3 +896,3 @@

let tieViews = views[tieName], change, changedPath,
procNames, procName, processor, viewedPaths, viewedPath, procViews, pathViews,
ctrlNames, ctrlName, controller, viewedPaths, viewedPath, ctrlViews, pathViews,
i, i1, i2, i3;

@@ -908,18 +904,18 @@ if (tieViews) {

changedPath = change.path ? change.path.join('.') : null;
procNames = Object.keys(tieViews);
i1 = procNames.length;
ctrlNames = Object.keys(tieViews);
i1 = ctrlNames.length;
while (i1--) {
procName = procNames[i1];
procViews = tieViews[procName];
if (procViews) {
processor = processors.get(procName);
viewedPaths = Object.keys(procViews);
ctrlName = ctrlNames[i1];
ctrlViews = tieViews[ctrlName];
if (ctrlViews) {
controller = controllers.get(ctrlName);
viewedPaths = Object.keys(ctrlViews);
i2 = viewedPaths.length;
while (i2--) {
viewedPath = viewedPaths[i2];
if (processor.isChangedPathRelevant(changedPath, viewedPath)) {
pathViews = procViews[viewedPath];
if (controller.isChangedPathRelevant(changedPath, viewedPath)) {
pathViews = ctrlViews[viewedPath];
i3 = pathViews.length;
while (i3--) {
update(pathViews[i3], procName);
update(pathViews[i3], ctrlName);
}

@@ -934,7 +930,7 @@ }

function applyProcessor(processor) {
function applyController(controller) {
// apply on a pending views
if (nlvs[processor.name]) {
nlvs[processor.name].forEach(add);
delete nlvs[processor.name];
if (nlvs[controller.name]) {
nlvs[controller.name].forEach(add);
delete nlvs[controller.name];
}

@@ -1020,3 +1016,3 @@ }

get processChanges() { return processChanges; },
get applyProcessor() { return applyProcessor; },
get applyController() { return applyController; },
get updateView() { return update; }

@@ -1033,8 +1029,4 @@ }

const namespace = this || window,
add = namespace.DataTier.processors.add;
add = namespace.DataTier.controllers.add;
if (!namespace.DataTier) {
throw new Error('data-tier framework was not properly initialized');
}
add('tieValue', {

@@ -1082,3 +1074,3 @@ toView: function(data, view) {

add('tieHRef', {
add('tieHref', {
toView: function(data, view) {

@@ -1089,14 +1081,2 @@ view.href = typeof data !== 'undefined' && data !== null ? data : '';

add('tieDateValue', {
toView: function(data, view) {
view.value = typeof data !== 'undefined' && data !== null ? data.toLocaleString() : '';
}
});
add('tieDateText', {
toView: function(data, view) {
view.textContent = typeof data !== 'undefined' && data !== null ? data.toLocaleString() : '';
}
});
add('tieClasses', {

@@ -1123,21 +1103,108 @@ isChangedPathRelevant: function(changedPath, viewedPath) {

})();
(() => {
(() => {
'use strict';
const namespace = this || window,
add = namespace.DataTier.processors.add,
viewsService = namespace.DataTier.views;
add = namespace.DataTier.controllers.add;
if (!namespace.DataTier) {
throw new Error('data-tier framework was not properly initialized');
// deprecated
add('tieDateValue', {
toView: function(data, view) {
view.value = typeof data !== 'undefined' && data !== null ? data.toLocaleString() : '';
}
});
// deprecated
add('tieDateText', {
toView: function(data, view) {
view.textContent = typeof data !== 'undefined' && data !== null ? data.toLocaleString() : '';
}
});
add('tieDatetimeText', new DateTimeTextController());
add('tieDatetimeValue', new DateTimeValueController());
function DateTimeTextController(visualizationProperty) {
let visProp = visualizationProperty || 'textContent';
this.format = 'dd/MM/yyyy hh:mm:ss';
this.toView = function(data, view) {
let formattedDate = data;
if (!data) {
formattedDate = '';
} else if (data instanceof Date) {
formattedDate = formatDate(data, this.format);
} else {
try {
let tmpDate = new Date(data);
if (tmpDate instanceof Date) {
formattedDate = formatDate(tmpDate, this.format);
}
} catch (e) {
console.error('failed to parse "' + data + '" as date', e);
}
}
view[visProp] = formattedDate;
};
}
function signTemplate(template, sign) {
let children = template.content.childNodes;
for (let i = 0, l = children.length; i < l; i++) {
children[i].dataset.dtListItemAid = sign;
function DateTimeValueController() {
DateTimeTextController.call(this, 'value');
this.toData = function(changeEvent) {
console.warn('yet to be implemented, react on ' + changeEvent);
};
}
DateTimeValueController.prototype = Object.create(DateTimeTextController.prototype);
DateTimeValueController.prototype.constructor = DateTimeValueController;
let supportedTokens = {
d: function(date, len) { return date.getDate().toString().padStart(len, '0'); },
M: function(date, len) { return (date.getMonth() + 1).toString().padStart(len, '0'); },
y: function(date, len) {
let tmpY = date.getFullYear().toString();
if (tmpY.length > len) return tmpY.substr(tmpY.length - len);
else return tmpY.padStart(len, '0');
},
h: function(date, len) { return date.getHours().toString().padStart(len, '0'); },
m: function(date, len) { return date.getMinutes().toString().padStart(len, '0'); },
s: function(date, len) { return date.getSeconds().toString().padStart(len, '0'); },
f: function(date, len) { return date.getMilliseconds().toString().padStart(len, '0'); }
};
function formatDate(date, format) {
let result = '';
if (!format) {
result = date.toLocaleString();
} else {
let char, cnt;
for (let i = 0, l = format.length; i < l; i++) {
char = format.charAt(i);
if (supportedTokens[char]) {
cnt = 1;
while (i < l - 1 && format.charAt(i + 1) === char) {
cnt++;
i++;
}
result += supportedTokens[char](date, cnt);
} else {
result += char;
}
}
}
return result;
}
function extractProcessorParameters(paramValue) {
})();
(() => {
'use strict';
const namespace = this || window,
add = namespace.DataTier.controllers.add,
viewsService = namespace.DataTier.views;
function extractControllerParameters(paramValue) {
let procParam;

@@ -1177,9 +1244,9 @@ if (paramValue) {

function insertNewContent(container, template, processorParameters, from, to) {
let result, optimizationMap, tmpContent, tmpTemplate, index = from, i, i1, tmp,
prefix = processorParameters[0] + '.', optTmpIdx,
function insertNewContent(container, template, controllerParameters, from, to) {
let result = null, optimizationMap, tmpContent, tmpTemplate, index = from, i, i1, tmp,
prefix = controllerParameters[0] + '.', optTmpIdx,
views, view,
pairs, key;
tmpContent = template.content;
optimizationMap = prepareOptimizationMap(template, processorParameters[2]);
optimizationMap = prepareOptimizationMap(template, controllerParameters[2]);
optTmpIdx = optimizationMap.index;

@@ -1253,2 +1320,3 @@

let container = template.parentNode, ruleData,
fceDataSet,
templateItemAid,

@@ -1260,10 +1328,11 @@ desiredListLength = tiedValue.length;

}
if (!template.content.childElementCount) {
throw new Error('tieList\'s TEMPLATE MUST HAVE at least one child element');
if (template.content.childElementCount !== 1) {
throw new Error('tieList\'s TEMPLATE element MUST HAVE exactly one direct child element');
}
templateItemAid = template.content.firstChild.dataset.dtListItemAid;
fceDataSet = template.content.firstElementChild.dataset;
templateItemAid = fceDataSet.dtListItemAid;
if (!templateItemAid) {
templateItemAid = new Date().getTime();
signTemplate(template, templateItemAid);
fceDataSet.dtListItemAid = templateItemAid;
}

@@ -1283,3 +1352,3 @@

if (existingListLength < desiredListLength) {
ruleData = extractProcessorParameters(template.dataset.tieList);
ruleData = extractControllerParameters(template.dataset.tieList);
insertNewContent(container, template, ruleData, existingListLength, desiredListLength);

@@ -1289,3 +1358,2 @@ }

});
})();

@@ -1,1 +0,1 @@

(()=>{"use strict";function e(e){return d.indexOf(e.constructor.name)>=0}function t(e,t){let n,o=u.get(e),a=p.get(o.root);return n="pop"===t?function(){let n,r,i;return n=e.length-1,(r=Reflect.apply(e[t],e,arguments))&&"object"==typeof r&&(r=c.get(r),u.get(r).revoke()),i=[new s(o.path.concat(n),r)],a.notify(i),r}:"push"===t?function(){let n,l,s,f=[];n=Array.from(arguments),s=e.length;for(let e,t=0,a=n.length;t<a;t++)(e=n[t])&&"object"==typeof e&&(n[t]=new r(e,s+t,o).proxy),f.push(new i(o.path.concat(s+t),e));return l=Reflect.apply(e[t],e,n),a.notify(f),l}:"shift"===t?function(){let n,r,i;(n=Reflect.apply(e[t],e,arguments))&&"object"==typeof n&&(n=c.get(n),u.get(n).revoke());for(let t,n=0,o=e.length;n<o;n++)(t=e[n])&&"object"==typeof t&&((i=u.get(c.get(t)))?i.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));return r=[new s(o.path.concat(0),n)],a.notify(r),n}:"unshift"===t?function(){let n,l,s,f=[];(n=Array.from(arguments)).forEach(function(e,t){e&&"object"==typeof e&&(n[t]=new r(e,t,o).proxy)}),l=Reflect.apply(e[t],e,n);for(let t,n=0,o=e.length;n<o;n++)(t=e[n])&&"object"==typeof t&&((s=u.get(c.get(t)))?s.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));for(let t=0,r=n.length;t<r;t++)f.push(new i(o.path.concat(t),e[t]));return a.notify(f),l}:"reverse"===t?function(){let n,o;Reflect.apply(e[t],e,arguments);for(let t,n=0,r=e.length;n<r;n++)(t=e[n])&&"object"==typeof t&&((o=u.get(c.get(t)))?o.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));return n=[new function(){Object.defineProperties(this,{type:{value:"reverse"}})}],a.notify(n),this}:"sort"===t?function(){let n,o;Reflect.apply(e[t],e,arguments);for(let t,n=0,r=e.length;n<r;n++)(t=e[n])&&"object"==typeof t&&((o=u.get(c.get(t)))?o.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));return n=[new function(){Object.defineProperties(this,{type:{value:"shuffle"}})}],a.notify(n),this}:"fill"===t?function(){let n,s,f,p=[],d=arguments.length,h=e.length;n=d<2?0:arguments[1]<0?h+arguments[1]:arguments[1],s=d<3?h:arguments[2]<0?h+arguments[2]:arguments[2],f=e.slice(),Reflect.apply(e[t],e,arguments);for(let t,a=n;a<s;a++)(t=e[a])&&"object"==typeof t&&(e[a]=new r(t,a,o).proxy),f.hasOwnProperty(a)?(p.push(new l(o.path.concat(a),e[a],f[a]&&"object"==typeof f[a]?c.get(f[a]):f[a])),f[a]&&"object"==typeof f[a]&&u.get(c.get(f[a])).revoke()):p.push(new i(o.path.concat(a),e[a]));return a.notify(p),this}:"splice"===t?function(){let n,f,p,d,h,y,g,v,w=[],b=e.length;v=(n=Array.from(arguments)).length;for(let e,t=0;t<v;t++)e=n[t],t>1&&e&&"object"==typeof e&&(n[t]=new r(e,t,o).proxy);h=0===v?0:n[0]<0?b+n[0]:n[0],y=v<2?b-h:n[1],g=Math.max(v-2,0),f=Reflect.apply(e[t],e,n);for(let t,n=0;n<b;n++)(t=e[n])&&"object"==typeof t&&((p=u.get(c.get(t)))?p.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));for(let e,t=0,n=f.length;t<n;t++)e=f[t],y&&"object"==typeof y&&(e=c.get(y),u.get(e).revoke());for(d=0;d<y;d++)d<g?w.push(new l(o.path.concat(h+d),e[h+d],f[d])):w.push(new s(o.path.concat(h+d),f[d]));for(;d<g;d++)w.push(new i(o.path.concat(h+d),e[h+d]));return a.notify(w),f}:Reflect.get(e,t)}function n(t,n,o){let a,s=t.hasOwnProperty(n),f=t[n],d=u.get(t),h=p.get(d.root);if((a=o&&"object"==typeof o&&!e(o)?Reflect.set(t,n,new r(o,n,d).proxy):Reflect.set(t,n,o))&&(c.has(f)&&(u.get(c.get(f)).revoke(),c.delete(f)),h.hasListeners)){let e=d.path.concat(n),t=[s?new l(e,o,f):new i(e,o)];d.preventCallbacks||h.notify(t)}return a}function o(e,t){let n,o=e[t],r=u.get(e),a=p.get(r.root);if((n=Reflect.deleteProperty(e,t))&&(c.has(o)&&(u.get(c.get(o)).revoke(),c.delete(o)),a.hasListeners)){let e=[new s(r.path.concat(t),o)];r.preventCallbacks||a.notify(e)}return n}function r(a,i,l){let s,f;if(!a||"object"!=typeof a)throw new Error("Observed MUST be created from a non null object origin");if(l&&(void 0===i||null===i))throw new Error("any non-root (parent-less) Observed MUST have an own path; now parent is "+l+"; key is "+i);if(l&&!(l instanceof r))throw new Error("parent, when supplied, MUST be an instance of Observed");s=function(e){return Array.isArray(e)?e.slice():Object.assign(new e.constructor,e)}(a),Array.isArray(s)?(!function(t,n){for(let o,a=0,i=t.length;a<i;a++)(o=t[a])&&"object"==typeof o&&!e(o)&&(t[a]=new r(o,a,n).proxy)}(s,this),f=Proxy.revocable(s,{set:n,get:t,deleteProperty:o})):(!function(t,n){let o=Object.keys(t);for(let a,i,l=0,s=o.length;l<s;l++)(i=t[a=o[l]])&&"object"==typeof i&&!e(i)&&(t[a]=new r(i,a,n).proxy)}(s,this),f=Proxy.revocable(s,{set:n,deleteProperty:o})),u.set(s,this),c.set(f.proxy,s),Object.defineProperties(this,{revokable:{value:f},proxy:{value:f.proxy},parent:{value:l},ownKey:{value:i,writable:!0}})}function a(e){let t=!1,n=[];Object.defineProperties(e.proxy,{observe:{value:function(e){if(t)throw new TypeError("revoked Observable MAY NOT be observed anymore");if("function"!=typeof e)throw new Error("observer (callback) parameter MUST be a function");n.indexOf(e)<0?n.push(e):console.info("observer (callback) may be bound to an observable only once")}},unobserve:{value:function(){if(t)throw new TypeError("revoked Observable MAY NOT be unobserved amymore");if(arguments.length)for(let e,t=0,o=arguments.length;t<o;t++)(e=n.indexOf(arguments[t]))>=0&&n.splice(e,1);else n.splice(0,n.length)}},revoke:{value:function(){t?console.log("revokation of Observable have an effect only once"):(t=!0,e.revoke())}}}),Object.defineProperties(this,{hasListeners:{value:function(){return n.length>0}},notify:{value:function(e){for(let t,o=0,r=n.length;o<r;o++){t=n[o];try{t(e)}catch(e){console.error(e)}}}}})}function i(e,t){Object.defineProperties(this,{type:{value:"insert"},path:{value:e},value:{value:t}})}function l(e,t,n){Object.defineProperties(this,{type:{value:"update"},path:{value:e},value:{value:t},oldValue:{value:n}})}function s(e,t){Object.defineProperties(this,{type:{value:"delete"},path:{value:e},oldValue:{value:t}})}const f=this||window,c=new Map,u=new Map,p=new Map,d=["Date","Blob","Number","String","Boolean","Error","SyntaxError","TypeError","URIError","Function","Promise","RegExp"];Object.defineProperty(r.prototype,"root",{get:function(){let e=this;for(;e.parent;)e=e.parent;return e}}),Object.defineProperty(r.prototype,"path",{get:function(){let e=[],t=this;for(;void 0!==t.ownKey;)e.push(t.ownKey),t=t.parent;return e.reverse()}}),Object.defineProperty(r.prototype,"revoke",{value:function(){let e=this.proxy,t=Object.keys(e);for(let n,o,r=0,a=t.length;r<a;r++)o=e[n=t[r]],c.has(o)&&(u.get(c.get(o)).revoke(),c.get(e)[n]=c.get(o));this.revokable.revoke()}}),Object.defineProperty(a,"from",{value:function(t){if(!t||"object"!=typeof t)throw new Error("observable MAY ONLY be created from non-null object only");if("observe"in t||"unobserve"in t||"revoke"in t)throw new Error('target object MUST NOT have nor own neither inherited properties from the following list: "observe", "unobserve", "revoke"');if(e(t))throw new Error(t+" found to be one of non-observable object types: "+d);let n=new r(t),o=new a(n);return p.set(n,o),n.proxy}}),Object.defineProperty(f,"Observable",{value:a})})(),(()=>{"use strict";function e(e){return a[e]}function t(e,t,n){if(function(e){if(!e||"string"!=typeof e)throw new Error("tie name MUST be a non-empty string");if(/\W/.test(e))throw new Error("tie name MUST consist of alphanumerics or underlines ([a-zA-Z0-9_]) ONLY")}(e),a[e])throw new Error("existing tie ("+e+") MAY NOT be re-created, use the tie's own APIs to reconfigure it");return new function(e,t,n){function i(t){r.DataTier.views.processChanges(e,t)}let l;Reflect.defineProperty(this,"name",{value:e}),Reflect.defineProperty(this,"data",{get:function(){return l},set:function(t){let n=l,a=o(t);l&&l.revoke(),(l=a)&&l.observe(i),r.DataTier.views.processChanges(e,[{type:"update",value:l,oldValue:n,path:[]}])}}),a[e]=this,this.data=t,Object.seal(this)}(e,o(t),n)}function n(e){e&&a[e]&&(a[e].observable.revoke(),delete a[e])}function o(e){if(void 0===e||null===e)return e;if("object"!=typeof e)throw new Error(e+" is not of type Observable and not an object");if("function"==typeof e.observe&&"function"==typeof e.unobserve&&"function"==typeof e.revoke)return e;if(r.Observable){if("function"==typeof e.observe||"function"==typeof e.unobserve||"function"==typeof e.revoke)throw new Error(e+" is not of type Observable and can not be transformed into Observable (some of its functions already implemented?)");return r.Observable.from(e)}throw new Error(e+" is not of type Observable and no embedded Observable implementation found")}(()=>{let e=window,t=Symbol.for("data-tier");for(;e.parent!==e;)e=e.parent;if(e[t])throw new Error("data-tier found to already being running within this application, cancelling current execution");e[t]=!0})();const r=this||window,a={};Reflect.defineProperty(r,"DataTier",{value:{}}),Reflect.defineProperty(r.DataTier,"ties",{value:{get get(){return e},get create(){return t},get remove(){return n}}})})(),(()=>{"use strict";function e(e,o){Reflect.defineProperty(this,"name",{value:e}),Reflect.defineProperty(this,"toView",{value:o.toView}),Reflect.defineProperty(this,"toData",{value:"function"==typeof o.toData?o.toData:function(e){!function(e,t,n){let o;if(!e)return;for(o=0;o<t.length-1;o++)e=e[t[o]]&&"object"==typeof e[t[o]]?e[t[o]]:e[t[o]]={};e[t[o]]=n}(e.data,e.path,e.view.value)}}),Reflect.defineProperty(this,"changeDOMEventType",{value:"string"==typeof o.changeDOMEventType?o.changeDOMEventType:null}),Reflect.defineProperty(this,"parseParam",{value:"function"==typeof o.parseParam?o.parseParam:t}),Reflect.defineProperty(this,"isChangedPathRelevant",{value:"function"==typeof o.isChangedPathRelevant?o.isChangedPathRelevant:n})}function t(e){let t="",n=[];return e&&(t=(n=e.trim().split(".")).shift()),{tieName:t,dataPath:n}}function n(e,t){return t.startsWith(e)}function o(t,n){if("string"!=typeof t||!t)throw new Error("name MUST be a non-empty string");if(s[t])throw new Error('data processor "'+t+'" already exists; you may want to reconfigure the existing one');if("object"!=typeof n||!n)throw new Error("configuration MUST be a non-null object");if("function"!=typeof n.toView)throw new Error('configuration MUST have a "toView" function defined');s[t]=new e(t,n),l.DataTier.views.applyProcessor(s[t])}function r(e){return s[e]}function a(e){if("string"!=typeof e||!e)throw new Error("controller name MUST be a non-empty string");return delete s[e]}function i(e){let t=[];return e&&e.dataset&&Object.keys(e.dataset).filter(e=>e in s).map(e=>s[e]).forEach(e=>t.push(e)),t}const l=this||window,s={};if(!l.DataTier)throw new Error("data-tier framework was not properly initialized");Reflect.defineProperty(e.prototype,"parseParam",{value:t}),Reflect.defineProperty(e.prototype,"isChangedPathRelevant",{value:n}),Reflect.defineProperty(l.DataTier,"processors",{value:{get get(){return r},get add(){return o},get remove(){return a},get getApplicable(){return i}}})})(),(()=>{"use strict";function e(e){let t,n,o,r,a=e.target,i=h.getApplicable(a);for(r=i.length;r--;)if(t=i[r],e.type===t.changeDOMEventType){if(n=t.parseParam(a.dataset[t.name]),o=d.get(n.tieName),!n.dataPath)return void console.error("path to data not available");if(!o)return void console.error('tie "'+n.tieName+'" not found');t.toData({data:o.data,path:n.dataPath,view:a})}}function t(t,n){t.addEventListener(n,e)}function n(t,n){t.removeEventListener(n,e)}function o(e){if("IFRAME"===e.nodeName)u(e.contentDocument),e.addEventListener("load",function(){u(this.contentDocument),a(this.contentDocument)}),a(e.contentDocument);else if(e.dataset){let n,o,a,i,l,s,f,c,u=Object.keys(e.dataset);for(c=u.length;c--;)(n=u[c]).startsWith("tie")&&((o=h.get(n))?(i=(a=o.parseParam(e.dataset[o.name])).dataPath.join("."),(f=(s=(l=y[a.tieName]||(y[a.tieName]={}))[o.name]||(l[o.name]={}))[i]||(s[i]=[])).indexOf(e)<0&&(f.push(e),r(e,o.name),o.changeDOMEventType&&t(e,o.changeDOMEventType))):(g[n]||(g[n]=[]),g[n].push(e)))}}function r(e,t){let n,o,r,a;o=(n=h.get(t)).parseParam(e.dataset[t]),(r=d.get(o.tieName))&&(a=function(e,t){if(e){for(let n=0,o=t.length;n<o;n++){if(!(t[n]in e))return;e=e[t[n]]}return e}}(r.data,o.dataPath),n.toView(a,e))}function a(e){if(e&&(e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.ELEMENT_NODE)){let t,n;for(t="IFRAME"===e.nodeName?e.contentDocument.getElementsByTagName("*"):e.getElementsByTagName("*"),o(e),n=t.length;n--;)o(t[n])}}function i(e){if(e&&e.getElementsByTagName){let t,o,r,a,i,l,s,f,c,u=e.getElementsByTagName("*");for(a=0,i=u.length;a<=i;a++)if((t=a<i?u[a]:e).dataset&&t.dataset.length)for(l=(o=h.getApplicable(t)).length;l--;)s=(r=o[l]).parseParam(t.dataset[r.name]),(c=(f=y[s.tieName][r.name][s.dataPath.join(".")]).indexOf(t))>=0&&(f.splice(c,1),r.changeDOMEventType&&n(t,r.changeDOMEventType))}}function l(e,t,n,o){let a,i,l,s=-1;(a=h.get(t))&&(i=h.get(t).parseParam(n),y[i.tieName]&&y[i.tieName][t]&&((l=y[i.tieName][t][i.dataPath])&&(s=l.indexOf(e)),s>=0&&l.splice(s,1)),i=h.get(t).parseParam(o),y[i.tieName]||(y[i.tieName]={}),y[i.tieName][t]||(y[i.tieName][t]={}),y[i.tieName][t][i.dataPath]||(y[i.tieName][t][i.dataPath]=[]),y[i.tieName][t][i.dataPath].push(e),r(e,t))}function s(e,t){let n,o,a,i,l,s,f,c,u,p,d,g,v,w=y[e];if(w)for(p=t.length;p--;)for(o=(n=t[p]).path?n.path.join("."):null,d=(a=Object.keys(w)).length;d--;)if(i=a[d],c=w[i])for(l=h.get(i),g=(s=Object.keys(c)).length;g--;)if(f=s[g],l.isChangedPathRelevant(o,f))for(v=(u=c[f]).length;v--;)r(u[v],i)}function f(e){g[e.name]&&(g[e.name].forEach(o),delete g[e.name])}function c(e){let t,n=2,o=e.split("-");for(t=o[1];n<o.length;)t+=o[n][0].toUpperCase()+o[n++].substr(1);return t}function u(e){new MutationObserver(function(e){let t,n,o,r,s,f,p,d;for(t=e.length;t--;)if(r=e[t],"attributes"===(s=r.type)){let e=r.target,t=r.attributeName;if(e.nodeType!==Node.DOCUMENT_NODE&&e.nodeType!==Node.ELEMENT_NODE)continue;0===t.indexOf("data-tie")?l(e,c(t),r.oldValue,e.getAttribute(t)):"src"===t&&"IFRAME"===e.nodeName&&i(e.contentDocument)}else if("childList"===s){for(n=(f=r.addedNodes).length;n--;)(d=f[n]).nodeType!==Node.DOCUMENT_NODE&&d.nodeType!==Node.ELEMENT_NODE||("IFRAME"===d.nodeName?(d.contentDocument&&(u(d.contentDocument),a(d.contentDocument)),d.addEventListener("load",function(){u(this.contentDocument),a(this.contentDocument)})):a(d));for(o=(p=r.removedNodes).length;o--;)(d=p[o]).nodeType!==Node.DOCUMENT_NODE&&d.nodeType!==Node.ELEMENT_NODE||i("IFRAME"===d.nodeName?d.contentDocument:d)}}).observe(e,{childList:!0,attributes:!0,characterData:!1,subtree:!0,attributeOldValue:!0,characterDataOldValue:!1})}const p=this||window;if(!p.DataTier)throw new Error("data-tier framework was not properly initialized");const d=p.DataTier.ties,h=p.DataTier.processors,y={},g={};Reflect.defineProperty(p.DataTier,"views",{value:{get processChanges(){return s},get applyProcessor(){return f},get updateView(){return r}}}),u(document),a(document)})(),(()=>{"use strict";const e=this||window,t=e.DataTier.processors.add;if(!e.DataTier)throw new Error("data-tier framework was not properly initialized");t("tieValue",{toView:function(e,t){"checkbox"===t.type?t.checked=e:t.value=void 0!==e&&null!==e?e:""},changeDOMEventType:"change"}),t("tieInput",{toView:function(e,t){t.value=void 0!==e&&null!==e?e:""},changeDOMEventType:"input"}),t("tieText",{toView:function(e,t){t.textContent=void 0!==e&&null!==e?e:""}}),t("tiePlaceholder",{toView:function(e,t){t.placeholder=void 0!==e&&null!==e?e:""}}),t("tieTooltip",{toView:function(e,t){t.title=void 0!==e&&null!==e?e:""}}),t("tieSrc",{toView:function(e,t){t.src=void 0!==e&&null!==e?e:""}}),t("tieHRef",{toView:function(e,t){t.href=void 0!==e&&null!==e?e:""}}),t("tieDateValue",{toView:function(e,t){t.value=void 0!==e&&null!==e?e.toLocaleString():""}}),t("tieDateText",{toView:function(e,t){t.textContent=void 0!==e&&null!==e?e.toLocaleString():""}}),t("tieClasses",{isChangedPathRelevant:function(e,t){let n=e.replace(t,"").split(".");return this.constructor.prototype.isChangedPathRelevant(e,t)||1===n.length||2===n.length&&""===n[0]},toView:function(e,t){e&&"object"==typeof e&&Object.keys(e).forEach(function(n){e[n]?t.classList.add(n):t.classList.remove(n)})}})})(),(()=>{"use strict";function e(e,t,n,o,r){let a,i,l,s,f,c,u,p,d,h,y,g,v=o,w=n[0]+".";for(l=t.content,p=(i=function(e,t){let n,o,r,a,i,l,s={index:[]},f=e.content.querySelectorAll("*"),c=f.length;for(;c--;)if((n=f[c]).nodeType===Node.DOCUMENT_NODE||n.nodeType===Node.ELEMENT_NODE){for(r=(o=Object.keys(n.dataset)).length,l=[];r--;)a=o[r],i=n.dataset[a],a.startsWith("tie")&&i.startsWith(t)&&l.push([a,i.replace(t,"")]);l.length&&(s[c]=l,s.index.push(c))}return s}(t,n[2])).index;v<r;v++){for(d=(s=l.cloneNode(!0)).querySelectorAll("*"),f=p.length;f--;)for(h=d[u=p[f]],c=(y=i[u]).length;c--;)g=y[c][0],h.dataset[g]=w+v+y[c][1];v===o?a=s:a.appendChild(s)}e.appendChild(a)}const t=this||window,n=t.DataTier.processors.add,o=t.DataTier.views;if(!t.DataTier)throw new Error("data-tier framework was not properly initialized");n("tieList",{parseParam:function(e){return this.constructor.prototype.parseParam(e.split(/\s*=>\s*/)[0])},isChangedPathRelevant:function(e,t){if(!e)return!0;let n=e.replace(t,"").split(".");return this.constructor.prototype.isChangedPathRelevant(e,t)||1===n.length||2===n.length&&""===n[0]},toView:function(t,n){if(!Array.isArray(t)||!n)return;let r,a,i=n.parentNode,l=t.length;if("TEMPLATE"!==n.nodeName)throw new Error("tieList may be defined on template elements only");if(!n.content.childElementCount)throw new Error("tieList's TEMPLATE MUST HAVE at least one child element");(a=n.content.firstChild.dataset.dtListItemAid)||function(e,t){let n=e.content.childNodes;for(let e=0,o=n.length;e<o;e++)n[e].dataset.dtListItemAid=t}(n,a=(new Date).getTime());let s=i.querySelectorAll('[data-dt-list-item-aid="'+a+'"]'),f=s.length;if(f>l)for(;f>l;)i.removeChild(s[--f]);!function(e,t,n){let r,a=e.content.querySelectorAll("*"),i=[];for(r=a.length;r--;)i[r]=Object.keys(a[r].dataset).filter(e=>e.startsWith("tie"));let l,s,f,c,u,p,d=0;for(r=0;d<n;)if((f=t.childNodes[r++])!==e&&(f.nodeType===Node.DOCUMENT_NODE||f.nodeType===Node.ELEMENT_NODE)&&f.dataset.dtListItemAid){for(c=f.querySelectorAll("*"),l=i.length;l--;)for(u=l?c[l-1]:f,s=(p=i[l]).length;s--;)o.updateView(u,p[s]);d++}}(n,i,f),f<l&&e(i,n,r=function(e){let t;if(e&&(!(t=e.trim().split(/\s+/))||3!==t.length||"=>"!==t[1]))throw new Error('invalid parameter for "tieList" rule specified');return t}(n.dataset.tieList),f,l)}})})();
(()=>{"use strict";function e(e){return d.indexOf(e.constructor.name)>=0}function t(e,t){let n,o=u.get(e),a=p.get(o.root);return n="pop"===t?function(){let n,r,i;return n=e.length-1,(r=Reflect.apply(e[t],e,arguments))&&"object"==typeof r&&(r=f.get(r),u.get(r).revoke()),i=[new c(o.path.concat(n),r)],a.notify(i),r}:"push"===t?function(){let n,l,c,s=[];n=Array.from(arguments),c=e.length;for(let e,t=0,a=n.length;t<a;t++)(e=n[t])&&"object"==typeof e&&(n[t]=new r(e,c+t,o).proxy),s.push(new i(o.path.concat(c+t),e));return l=Reflect.apply(e[t],e,n),a.notify(s),l}:"shift"===t?function(){let n,r,i;(n=Reflect.apply(e[t],e,arguments))&&"object"==typeof n&&(n=f.get(n),u.get(n).revoke());for(let t,n=0,o=e.length;n<o;n++)(t=e[n])&&"object"==typeof t&&((i=u.get(f.get(t)))?i.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));return r=[new c(o.path.concat(0),n)],a.notify(r),n}:"unshift"===t?function(){let n,l,c,s=[];(n=Array.from(arguments)).forEach(function(e,t){e&&"object"==typeof e&&(n[t]=new r(e,t,o).proxy)}),l=Reflect.apply(e[t],e,n);for(let t,n=0,o=e.length;n<o;n++)(t=e[n])&&"object"==typeof t&&((c=u.get(f.get(t)))?c.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));for(let t=0,r=n.length;t<r;t++)s.push(new i(o.path.concat(t),e[t]));return a.notify(s),l}:"reverse"===t?function(){let n,o;Reflect.apply(e[t],e,arguments);for(let t,n=0,r=e.length;n<r;n++)(t=e[n])&&"object"==typeof t&&((o=u.get(f.get(t)))?o.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));return n=[new function(){Object.defineProperties(this,{type:{value:"reverse"}})}],a.notify(n),this}:"sort"===t?function(){let n,o;Reflect.apply(e[t],e,arguments);for(let t,n=0,r=e.length;n<r;n++)(t=e[n])&&"object"==typeof t&&((o=u.get(f.get(t)))?o.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));return n=[new function(){Object.defineProperties(this,{type:{value:"shuffle"}})}],a.notify(n),this}:"fill"===t?function(){let n,c,s,p=[],d=arguments.length,h=e.length;n=d<2?0:arguments[1]<0?h+arguments[1]:arguments[1],c=d<3?h:arguments[2]<0?h+arguments[2]:arguments[2],s=e.slice(),Reflect.apply(e[t],e,arguments);for(let t,a=n;a<c;a++)(t=e[a])&&"object"==typeof t&&(e[a]=new r(t,a,o).proxy),s.hasOwnProperty(a)?(p.push(new l(o.path.concat(a),e[a],s[a]&&"object"==typeof s[a]?f.get(s[a]):s[a])),s[a]&&"object"==typeof s[a]&&u.get(f.get(s[a])).revoke()):p.push(new i(o.path.concat(a),e[a]));return a.notify(p),this}:"splice"===t?function(){let n,s,p,d,h,y,g,v,b=[],w=e.length;v=(n=Array.from(arguments)).length;for(let e,t=0;t<v;t++)e=n[t],t>1&&e&&"object"==typeof e&&(n[t]=new r(e,t,o).proxy);h=0===v?0:n[0]<0?w+n[0]:n[0],y=v<2?w-h:n[1],g=Math.max(v-2,0),s=Reflect.apply(e[t],e,n);for(let t,n=0;n<w;n++)(t=e[n])&&"object"==typeof t&&((p=u.get(f.get(t)))?p.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));for(let e,t=0,n=s.length;t<n;t++)e=s[t],y&&"object"==typeof y&&(e=f.get(y),u.get(e).revoke());for(d=0;d<y;d++)d<g?b.push(new l(o.path.concat(h+d),e[h+d],s[d])):b.push(new c(o.path.concat(h+d),s[d]));for(;d<g;d++)b.push(new i(o.path.concat(h+d),e[h+d]));return a.notify(b),s}:Reflect.get(e,t)}function n(t,n,o){let a,c=t.hasOwnProperty(n),s=t[n],d=u.get(t),h=p.get(d.root);if((a=o&&"object"==typeof o&&!e(o)?Reflect.set(t,n,new r(o,n,d).proxy):Reflect.set(t,n,o))&&(f.has(s)&&(u.get(f.get(s)).revoke(),f.delete(s)),h.hasListeners)){let e=d.path.concat(n),t=[c?new l(e,o,s):new i(e,o)];d.preventCallbacks||h.notify(t)}return a}function o(e,t){let n,o=e[t],r=u.get(e),a=p.get(r.root);if((n=Reflect.deleteProperty(e,t))&&(f.has(o)&&(u.get(f.get(o)).revoke(),f.delete(o)),a.hasListeners)){let e=[new c(r.path.concat(t),o)];r.preventCallbacks||a.notify(e)}return n}function r(a,i,l){let c,s;if(!a||"object"!=typeof a)throw new Error("Observed MUST be created from a non null object origin");if(l&&(void 0===i||null===i))throw new Error("any non-root (parent-less) Observed MUST have an own path; now parent is "+l+"; key is "+i);if(l&&!(l instanceof r))throw new Error("parent, when supplied, MUST be an instance of Observed");c=function(e){return Array.isArray(e)?e.slice():Object.assign(new e.constructor,e)}(a),Array.isArray(c)?(!function(t,n){for(let o,a=0,i=t.length;a<i;a++)(o=t[a])&&"object"==typeof o&&!e(o)&&(t[a]=new r(o,a,n).proxy)}(c,this),s=Proxy.revocable(c,{set:n,get:t,deleteProperty:o})):(!function(t,n){let o=Object.keys(t);for(let a,i,l=0,c=o.length;l<c;l++)(i=t[a=o[l]])&&"object"==typeof i&&!e(i)&&(t[a]=new r(i,a,n).proxy)}(c,this),s=Proxy.revocable(c,{set:n,deleteProperty:o})),u.set(c,this),f.set(s.proxy,c),Object.defineProperties(this,{revokable:{value:s},proxy:{value:s.proxy},parent:{value:l},ownKey:{value:i,writable:!0}})}function a(e){let t=!1,n=[];Object.defineProperties(e.proxy,{observe:{value:function(e){if(t)throw new TypeError("revoked Observable MAY NOT be observed anymore");if("function"!=typeof e)throw new Error("observer (callback) parameter MUST be a function");n.indexOf(e)<0?n.push(e):console.info("observer (callback) may be bound to an observable only once")}},unobserve:{value:function(){if(t)throw new TypeError("revoked Observable MAY NOT be unobserved amymore");if(arguments.length)for(let e,t=0,o=arguments.length;t<o;t++)(e=n.indexOf(arguments[t]))>=0&&n.splice(e,1);else n.splice(0,n.length)}},revoke:{value:function(){t?console.log("revokation of Observable have an effect only once"):(t=!0,e.revoke())}}}),Object.defineProperties(this,{hasListeners:{value:function(){return n.length>0}},notify:{value:function(e){for(let t,o=0,r=n.length;o<r;o++){t=n[o];try{t(e)}catch(e){console.error(e)}}}}})}function i(e,t){Object.defineProperties(this,{type:{value:"insert"},path:{value:e},value:{value:t}})}function l(e,t,n){Object.defineProperties(this,{type:{value:"update"},path:{value:e},value:{value:t},oldValue:{value:n}})}function c(e,t){Object.defineProperties(this,{type:{value:"delete"},path:{value:e},oldValue:{value:t}})}const s=this||window,f=new Map,u=new Map,p=new Map,d=["Date","Blob","Number","String","Boolean","Error","SyntaxError","TypeError","URIError","Function","Promise","RegExp"];Object.defineProperty(r.prototype,"root",{get:function(){let e=this;for(;e.parent;)e=e.parent;return e}}),Object.defineProperty(r.prototype,"path",{get:function(){let e=[],t=this;for(;void 0!==t.ownKey;)e.push(t.ownKey),t=t.parent;return e.reverse()}}),Object.defineProperty(r.prototype,"revoke",{value:function(){let e=this.proxy,t=Object.keys(e);for(let n,o,r=0,a=t.length;r<a;r++)o=e[n=t[r]],f.has(o)&&(u.get(f.get(o)).revoke(),f.get(e)[n]=f.get(o));this.revokable.revoke()}}),Object.defineProperty(a,"from",{value:function(t){if(!t||"object"!=typeof t)throw new Error("observable MAY ONLY be created from non-null object only");if("observe"in t||"unobserve"in t||"revoke"in t)throw new Error('target object MUST NOT have nor own neither inherited properties from the following list: "observe", "unobserve", "revoke"');if(e(t))throw new Error(t+" found to be one of non-observable object types: "+d);let n=new r(t),o=new a(n);return p.set(n,o),n.proxy}}),Object.defineProperty(s,"Observable",{value:a})})(),(()=>{"use strict";function e(e){return a[e]}function t(e,t,n){if(function(e){if(!e||"string"!=typeof e)throw new Error("tie name MUST be a non-empty string");if(/\W/.test(e))throw new Error("tie name MUST consist of alphanumerics or underlines ([a-zA-Z0-9_]) ONLY")}(e),a[e])throw new Error("existing tie ("+e+") MAY NOT be re-created, use the tie's own APIs to reconfigure it");return new function(e,t,n){function i(t){r.DataTier.views.processChanges(e,t)}let l;Reflect.defineProperty(this,"name",{value:e}),Reflect.defineProperty(this,"data",{get:function(){return l},set:function(t){let n=l,a=o(t);l&&l.revoke(),(l=a)&&l.observe(i),r.DataTier.views.processChanges(e,[{type:"update",value:l,oldValue:n,path:[]}])}}),a[e]=this,this.data=t,Object.seal(this)}(e,o(t),n)}function n(e){e&&a[e]&&(a[e].observable.revoke(),delete a[e])}function o(e){if(void 0===e||null===e)return e;if("object"!=typeof e)throw new Error(e+" is not of type Observable and not an object");if("function"==typeof e.observe&&"function"==typeof e.unobserve&&"function"==typeof e.revoke)return e;if(r.Observable){if("function"==typeof e.observe||"function"==typeof e.unobserve||"function"==typeof e.revoke)throw new Error(e+" is not of type Observable and can not be transformed into Observable (some of its functions already implemented?)");return r.Observable.from(e)}throw new Error(e+" is not of type Observable and no embedded Observable implementation found")}(()=>{let e=window,t=Symbol.for("data-tier");for(;e.parent!==e;)e=e.parent;if(e[t])throw new Error("data-tier found to already being running within this application, cancelling current execution");e[t]=!0})();const r=this||window,a={};Reflect.defineProperty(r,"DataTier",{value:{}}),Reflect.defineProperty(r.DataTier,"ties",{value:{get get(){return e},get create(){return t},get remove(){return n}}})})(),(()=>{"use strict";function e(e,t){Reflect.defineProperty(this,"name",{value:e}),Object.assign(this,t)}function t(t,n){if("string"!=typeof t||!t)throw new Error("name MUST be a non-empty string");if(c[t])throw new Error('data controller "'+t+'" already exists; you may want to reconfigure the existing one');if("object"!=typeof n||!n)throw new Error("configuration MUST be a non-null object");if("function"!=typeof n.toView)throw new Error('configuration MUST have a "toView" function defined');c[t]=new e(t,n),l.DataTier.views.applyController(c[t])}function n(e){return c[e]}function o(e){if("string"!=typeof e||!e)throw new Error("controller name MUST be a non-empty string");return delete c[e]}function r(e){let t=[];return e&&e.dataset&&Object.keys(e.dataset).filter(e=>e in c).map(e=>c[e]).forEach(e=>t.push(e)),t}function a(e){let t="",n=[];return e&&(t=(n=e.trim().split(".")).shift()),{tieName:t,dataPath:n}}function i(e,t){return t.startsWith(e)}const l=this||window,c={};e.prototype.toData=function(e){!function(e,t,n){let o;if(e){for(o=0;o<t.length-1;o++)e=e[t[o]]&&"object"==typeof e[t[o]]?e[t[o]]:e[t[o]]={};e[t[o]]=n}}(e.data,e.path,e.view.value)},e.prototype.parseParam=a,e.prototype.isChangedPathRelevant=i,Reflect.defineProperty(e.prototype,"parseParam",{value:a}),Reflect.defineProperty(e.prototype,"isChangedPathRelevant",{value:i}),Reflect.defineProperty(l.DataTier,"controllers",{value:{get get(){return n},get add(){return t},get remove(){return o},get getApplicable(){return r}}})})(),(()=>{"use strict";function e(e){let t,n,o,r,a=e.target,i=h.getApplicable(a);for(r=i.length;r--;)if(t=i[r],e.type===t.changeDOMEventType){if(n=t.parseParam(a.dataset[t.name]),o=d.get(n.tieName),!n.dataPath)return void console.error("path to data not available");if(!o)return void console.error('tie "'+n.tieName+'" not found');t.toData({data:o.data,path:n.dataPath,view:a})}}function t(t,n){t.addEventListener(n,e)}function n(t,n){t.removeEventListener(n,e)}function o(e){if("IFRAME"===e.nodeName)u(e.contentDocument),e.addEventListener("load",function(){u(this.contentDocument),a(this.contentDocument)}),a(e.contentDocument);else if(e.dataset){let n,o,a,i,l,c,s,f,u=Object.keys(e.dataset);for(f=u.length;f--;)(n=u[f]).startsWith("tie")&&((o=h.get(n))?(i=(a=o.parseParam(e.dataset[o.name])).dataPath.join("."),(s=(c=(l=y[a.tieName]||(y[a.tieName]={}))[o.name]||(l[o.name]={}))[i]||(c[i]=[])).indexOf(e)<0&&(s.push(e),r(e,o.name),o.changeDOMEventType&&t(e,o.changeDOMEventType))):(g[n]||(g[n]=[]),g[n].push(e)))}}function r(e,t){let n,o,r,a;o=(n=h.get(t)).parseParam(e.dataset[t]),(r=d.get(o.tieName))&&(a=function(e,t){if(e){for(let n=0,o=t.length;n<o;n++){if(!(t[n]in e))return;e=e[t[n]]}return e}}(r.data,o.dataPath),n.toView(a,e))}function a(e){if(e&&(e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.ELEMENT_NODE)){let t,n;for(t="IFRAME"===e.nodeName?e.contentDocument.getElementsByTagName("*"):e.getElementsByTagName("*"),o(e),n=t.length;n--;)o(t[n])}}function i(e){if(e&&e.getElementsByTagName){let t,o,r,a,i,l,c,s,f,u=e.getElementsByTagName("*");for(a=0,i=u.length;a<=i;a++)if((t=a<i?u[a]:e).dataset&&t.dataset.length)for(l=(o=h.getApplicable(t)).length;l--;)c=(r=o[l]).parseParam(t.dataset[r.name]),(f=(s=y[c.tieName][r.name][c.dataPath.join(".")]).indexOf(t))>=0&&(s.splice(f,1),r.changeDOMEventType&&n(t,r.changeDOMEventType))}}function l(e,t,n,o){let a,i,l,c=-1;(a=h.get(t))&&(i=h.get(t).parseParam(n),y[i.tieName]&&y[i.tieName][t]&&((l=y[i.tieName][t][i.dataPath])&&(c=l.indexOf(e)),c>=0&&l.splice(c,1)),i=h.get(t).parseParam(o),y[i.tieName]||(y[i.tieName]={}),y[i.tieName][t]||(y[i.tieName][t]={}),y[i.tieName][t][i.dataPath]||(y[i.tieName][t][i.dataPath]=[]),y[i.tieName][t][i.dataPath].push(e),r(e,t))}function c(e,t){let n,o,a,i,l,c,s,f,u,p,d,g,v,b=y[e];if(b)for(p=t.length;p--;)for(o=(n=t[p]).path?n.path.join("."):null,d=(a=Object.keys(b)).length;d--;)if(i=a[d],f=b[i])for(l=h.get(i),g=(c=Object.keys(f)).length;g--;)if(s=c[g],l.isChangedPathRelevant(o,s))for(v=(u=f[s]).length;v--;)r(u[v],i)}function s(e){g[e.name]&&(g[e.name].forEach(o),delete g[e.name])}function f(e){let t,n=2,o=e.split("-");for(t=o[1];n<o.length;)t+=o[n][0].toUpperCase()+o[n++].substr(1);return t}function u(e){new MutationObserver(function(e){let t,n,o,r,c,s,p,d;for(t=e.length;t--;)if(r=e[t],"attributes"===(c=r.type)){let e=r.target,t=r.attributeName;if(e.nodeType!==Node.DOCUMENT_NODE&&e.nodeType!==Node.ELEMENT_NODE)continue;0===t.indexOf("data-tie")?l(e,f(t),r.oldValue,e.getAttribute(t)):"src"===t&&"IFRAME"===e.nodeName&&i(e.contentDocument)}else if("childList"===c){for(n=(s=r.addedNodes).length;n--;)(d=s[n]).nodeType!==Node.DOCUMENT_NODE&&d.nodeType!==Node.ELEMENT_NODE||("IFRAME"===d.nodeName?(d.contentDocument&&(u(d.contentDocument),a(d.contentDocument)),d.addEventListener("load",function(){u(this.contentDocument),a(this.contentDocument)})):a(d));for(o=(p=r.removedNodes).length;o--;)(d=p[o]).nodeType!==Node.DOCUMENT_NODE&&d.nodeType!==Node.ELEMENT_NODE||i("IFRAME"===d.nodeName?d.contentDocument:d)}}).observe(e,{childList:!0,attributes:!0,characterData:!1,subtree:!0,attributeOldValue:!0,characterDataOldValue:!1})}const p=this||window;if(!p.DataTier)throw new Error("data-tier framework was not properly initialized");const d=p.DataTier.ties,h=p.DataTier.controllers,y={},g={};Reflect.defineProperty(p.DataTier,"views",{value:{get processChanges(){return c},get applyController(){return s},get updateView(){return r}}}),u(document),a(document)})(),(()=>{"use strict";const e=(this||window).DataTier.controllers.add;e("tieValue",{toView:function(e,t){"checkbox"===t.type?t.checked=e:t.value=void 0!==e&&null!==e?e:""},changeDOMEventType:"change"}),e("tieInput",{toView:function(e,t){t.value=void 0!==e&&null!==e?e:""},changeDOMEventType:"input"}),e("tieText",{toView:function(e,t){t.textContent=void 0!==e&&null!==e?e:""}}),e("tiePlaceholder",{toView:function(e,t){t.placeholder=void 0!==e&&null!==e?e:""}}),e("tieTooltip",{toView:function(e,t){t.title=void 0!==e&&null!==e?e:""}}),e("tieSrc",{toView:function(e,t){t.src=void 0!==e&&null!==e?e:""}}),e("tieHref",{toView:function(e,t){t.href=void 0!==e&&null!==e?e:""}}),e("tieClasses",{isChangedPathRelevant:function(e,t){let n=e.replace(t,"").split(".");return this.constructor.prototype.isChangedPathRelevant(e,t)||1===n.length||2===n.length&&""===n[0]},toView:function(e,t){e&&"object"==typeof e&&Object.keys(e).forEach(function(n){e[n]?t.classList.add(n):t.classList.remove(n)})}})})(),(()=>{"use strict";function e(e){let t=e||"textContent";this.format="dd/MM/yyyy hh:mm:ss",this.toView=function(e,o){let r=e;if(e)if(e instanceof Date)r=n(e,this.format);else try{let t=new Date(e);t instanceof Date&&(r=n(t,this.format))}catch(t){console.error('failed to parse "'+e+'" as date',t)}else r="";o[t]=r}}function t(){e.call(this,"value"),this.toData=function(e){console.warn("yet to be implemented, react on "+e)}}function n(e,t){let n="";if(t){let o,a;for(let i=0,l=t.length;i<l;i++)if(o=t.charAt(i),r[o]){for(a=1;i<l-1&&t.charAt(i+1)===o;)a++,i++;n+=r[o](e,a)}else n+=o}else n=e.toLocaleString();return n}const o=(this||window).DataTier.controllers.add;o("tieDateValue",{toView:function(e,t){t.value=void 0!==e&&null!==e?e.toLocaleString():""}}),o("tieDateText",{toView:function(e,t){t.textContent=void 0!==e&&null!==e?e.toLocaleString():""}}),o("tieDatetimeText",new e),o("tieDatetimeValue",new t),(t.prototype=Object.create(e.prototype)).constructor=t;let r={d:function(e,t){return e.getDate().toString().padStart(t,"0")},M:function(e,t){return(e.getMonth()+1).toString().padStart(t,"0")},y:function(e,t){let n=e.getFullYear().toString();return n.length>t?n.substr(n.length-t):n.padStart(t,"0")},h:function(e,t){return e.getHours().toString().padStart(t,"0")},m:function(e,t){return e.getMinutes().toString().padStart(t,"0")},s:function(e,t){return e.getSeconds().toString().padStart(t,"0")},f:function(e,t){return e.getMilliseconds().toString().padStart(t,"0")}}})(),(()=>{"use strict";function e(e,t,n,o,r){let a,i,l,c,s,f,u,p,d,h,y,g=null,v=o,b=n[0]+".";for(i=t.content,u=(a=function(e,t){let n,o,r,a,i,l,c={index:[]},s=e.content.querySelectorAll("*"),f=s.length;for(;f--;)if((n=s[f]).nodeType===Node.DOCUMENT_NODE||n.nodeType===Node.ELEMENT_NODE){for(r=(o=Object.keys(n.dataset)).length,l=[];r--;)a=o[r],i=n.dataset[a],a.startsWith("tie")&&i.startsWith(t)&&l.push([a,i.replace(t,"")]);l.length&&(c[f]=l,c.index.push(f))}return c}(t,n[2])).index;v<r;v++){for(p=(l=i.cloneNode(!0)).querySelectorAll("*"),c=u.length;c--;)for(d=p[f=u[c]],s=(h=a[f]).length;s--;)y=h[s][0],d.dataset[y]=b+v+h[s][1];v===o?g=l:g.appendChild(l)}e.appendChild(g)}const t=this||window,n=t.DataTier.controllers.add,o=t.DataTier.views;n("tieList",{parseParam:function(e){return this.constructor.prototype.parseParam(e.split(/\s*=>\s*/)[0])},isChangedPathRelevant:function(e,t){if(!e)return!0;let n=e.replace(t,"").split(".");return this.constructor.prototype.isChangedPathRelevant(e,t)||1===n.length||2===n.length&&""===n[0]},toView:function(t,n){if(!Array.isArray(t)||!n)return;let r,a,i,l=n.parentNode,c=t.length;if("TEMPLATE"!==n.nodeName)throw new Error("tieList may be defined on template elements only");if(1!==n.content.childElementCount)throw new Error("tieList's TEMPLATE element MUST HAVE exactly one direct child element");(i=(a=n.content.firstElementChild.dataset).dtListItemAid)||(i=(new Date).getTime(),a.dtListItemAid=i);let s=l.querySelectorAll('[data-dt-list-item-aid="'+i+'"]'),f=s.length;if(f>c)for(;f>c;)l.removeChild(s[--f]);!function(e,t,n){let r,a=e.content.querySelectorAll("*"),i=[];for(r=a.length;r--;)i[r]=Object.keys(a[r].dataset).filter(e=>e.startsWith("tie"));let l,c,s,f,u,p,d=0;for(r=0;d<n;)if((s=t.childNodes[r++])!==e&&(s.nodeType===Node.DOCUMENT_NODE||s.nodeType===Node.ELEMENT_NODE)&&s.dataset.dtListItemAid){for(f=s.querySelectorAll("*"),l=i.length;l--;)for(u=l?f[l-1]:s,c=(p=i[l]).length;c--;)o.updateView(u,p[c]);d++}}(n,l,f),f<c&&e(l,n,r=function(e){let t;if(e&&(!(t=e.trim().split(/\s+/))||3!==t.length||"=>"!==t[1]))throw new Error('invalid parameter for "tieList" rule specified');return t}(n.dataset.tieList),f,c)}})})();
{
"name": "data-tier",
"version": "0.6.13",
"version": "0.6.14",
"main": "dist/data-tier.js",

@@ -5,0 +5,0 @@ "files": [

@@ -11,3 +11,3 @@ [![npm version](https://badge.fury.io/js/data-tier.svg)](https://badge.fury.io/js/data-tier)

#### Support matrix: ![CHROME](tools/browser_icons/chrome.png) <sub>49+</sub>, ![FIREFOX](tools/browser_icons/firefox.png) <sub>44+</sub>, ![EDGE](tools/browser_icons/explorer.png) <sub>13+</sub>
#### Support matrix: ![CHROME](tools/browser_icons/chrome.png) <sub>49+</sub>, ![FIREFOX](tools/browser_icons/firefox.png) <sub>44+</sub>, ![EDGE](tools/browser_icons/edge.png) <sub>13+</sub>
Support matrix is currently as wide as that of [`object-observer`](https://github.com/gullerya/object-observer-js), assuming that in most of the cases consumers will not provide their own object observer, but will use an embedded one.

@@ -18,4 +18,8 @@ `data-tier` supports custom elements as well, obviously this functionality is available only on supporting environments.

__0.6.14__
- Fixed defect in `tie-list` controller when text nodes present in the `template` element
- Added `tie-datetime-text` OOTB controller
__0.6.13__
- Added `tie-input` OTB processor in other to track an immediate changes in input elements supporting `input` event (types: `text`, `password` of `input` element, `textarea` element).
- Added `tie-input` OOTB controller in other to track an immediate changes in input elements supporting `input` event (types: `text`, `password` of `input` element, `textarea` element).

@@ -22,0 +26,0 @@ __0.6.12__

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc