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.12 to 0.6.13

75

dist/data-tier-wo-oo.js

@@ -391,3 +391,3 @@ (() => {

change = changes[i];
changedPath = change.path.join('.');
changedPath = change.path ? change.path.join('.') : null;
procNames = Object.keys(tieViews);

@@ -433,4 +433,2 @@ i1 = procNames.length;

let viewsToSkip = new Map();
function initDocumentObserver(document) {

@@ -462,6 +460,2 @@ function processDomChanges(changes) {

if (node.nodeType !== Node.DOCUMENT_NODE && node.nodeType !== Node.ELEMENT_NODE) continue;
if (viewsToSkip.has(node)) {
viewsToSkip.delete(node);
continue;
}
if (node.nodeName === 'IFRAME') {

@@ -487,6 +481,2 @@ if (node.contentDocument) {

if (node.nodeType !== Node.DOCUMENT_NODE && node.nodeType !== Node.ELEMENT_NODE) continue;
if (viewsToSkip.has(node)) {
viewsToSkip.delete(node);
continue;
}
if (node.nodeName === 'IFRAME') {

@@ -517,4 +507,3 @@ discard(node.contentDocument);

get applyProcessor() { return applyProcessor; },
get updateView() { return update;},
get viewsToSkip() {return viewsToSkip;}
get updateView() { return update; }
}

@@ -547,2 +536,9 @@ });

add('tieInput', {
toView: function(data, view) {
view.value = typeof data !== 'undefined' && data !== null ? data : '';
},
changeDOMEventType: 'input'
});
add('tieText', {

@@ -664,14 +660,17 @@ toView: function(data, view) {

function prepareNewItems(template, itemId, prefix, from, to) {
let result, optimizationMap, tmpTemplate, index = from, i, i1, tmp,
function insertNewContent(container, template, processorParameters, from, to) {
let result, optimizationMap, tmpContent, tmpTemplate, index = from, i, i1, tmp,
prefix = processorParameters[0] + '.', optTmpIdx,
views, view,
pairs, key;
optimizationMap = prepareOptimizationMap(template, itemId);
tmpContent = template.content;
optimizationMap = prepareOptimizationMap(template, processorParameters[2]);
optTmpIdx = optimizationMap.index;
for (; index < to; index++) {
tmpTemplate = template.content.cloneNode(true);
tmpTemplate = tmpContent.cloneNode(true);
views = tmpTemplate.querySelectorAll('*');
i = optimizationMap.index.length;
i = optTmpIdx.length;
while (i--) {
tmp = optimizationMap.index[i];
tmp = optTmpIdx[i];
view = views[tmp];

@@ -683,3 +682,2 @@ pairs = optimizationMap[tmp];

view.dataset[key] = prefix + index + pairs[i1][1];
viewsService.updateView(view, key);
}

@@ -689,14 +687,17 @@ }

}
return result;
container.appendChild(result);
}
function updateListContent(template, container, required) {
function updateExistingContent(template, container, required) {
let allBluePrintElements = template.content.querySelectorAll('*'),
tieProcsMap = [], keys, i;
tieProcsMap = [], i;
i = allBluePrintElements.length;
while (i--) {
tieProcsMap[i] = Object.keys(allBluePrintElements[i].dataset);
tieProcsMap[i] = Object.keys(allBluePrintElements[i].dataset).filter(key => key.startsWith('tie'));
}
let done = 0, i1, i2, child, descendants;
let done = 0, i1, i2, child,
descendants, descendant,
keys;
i = 0;

@@ -706,12 +707,10 @@ while (done < required) {

if (child !== template && (child.nodeType === Node.DOCUMENT_NODE || child.nodeType === Node.ELEMENT_NODE) && child.dataset.dtListItemAid) {
descendants = Array.prototype.concat([child], Array.from(child.querySelectorAll('*')));
descendants = child.querySelectorAll('*');
i1 = tieProcsMap.length;
while (i1--) {
viewsService.viewsToSkip.set(descendants[i1], null);
descendant = i1 ? descendants[i1 - 1] : child;
keys = tieProcsMap[i1];
i2 = keys.length;
while (i2--) {
if (keys[i2].startsWith('tie')) {
viewsService.updateView(descendants[i1], keys[i2]);
}
viewsService.updateView(descendant, keys[i2]);
}

@@ -729,2 +728,4 @@ }

isChangedPathRelevant: function(changedPath, viewedPath) {
if (!changedPath) return true;
let subPath = changedPath.replace(viewedPath, '').split('.');

@@ -758,12 +759,14 @@ return this.constructor.prototype.isChangedPathRelevant(changedPath, viewedPath) ||

existingListLength = existingList.length;
if (existingListLength > desiredListLength) {
while (existingListLength > desiredListLength) container.removeChild(existingList[--existingListLength]);
} else if (existingListLength < desiredListLength) {
}
// run update on the whole list (in future attempt to get the change's content and optimize this one)
updateExistingContent(template, container, existingListLength);
if (existingListLength < desiredListLength) {
ruleData = extractProcessorParameters(template.dataset.tieList);
let newItemsDOM = prepareNewItems(template, ruleData[2], ruleData[0] + '.', existingListLength, desiredListLength);
container.appendChild(newItemsDOM);
insertNewContent(container, template, ruleData, existingListLength, desiredListLength);
}
// run update on the whole list (in future attempt to get the
updateListContent(template, container, existingListLength);
}

@@ -770,0 +773,0 @@ });

@@ -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 s;Reflect.defineProperty(this,"name",{value:e}),Reflect.defineProperty(this,"data",{get:function(){return s},set:function(t){let n=s,a=o(t);s&&s.revoke(),(s=a)&&s.observe(i),r.DataTier.views.processChanges(e,[{type:"update",value:s,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(l[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');l[t]=new e(t,n),s.DataTier.views.applyProcessor(l[t])}function r(e){return l[e]}function a(e){if("string"!=typeof e||!e)throw new Error("controller name MUST be a non-empty string");return delete l[e]}function i(e){let t=[];return e&&e.dataset&&Object.keys(e.dataset).filter(e=>e in l).map(e=>l[e]).forEach(e=>t.push(e)),t}const s=this||window,l={};if(!s.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(s.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=p.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,s,l,c,f,d=Object.keys(e.dataset);for(f=d.length;f--;)(n=d[f]).startsWith("tie")&&((o=h.get(n))?(i=(a=o.parseParam(e.dataset[o.name])).dataPath.join("."),(c=(l=(s=m[a.tieName]||(m[a.tieName]={}))[o.name]||(s[o.name]={}))[i]||(l[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=h.get(t)).parseParam(e.dataset[t]),(r=p.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,s,l,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(s=(o=h.getApplicable(t)).length;s--;)l=(r=o[s]).parseParam(t.dataset[r.name]),(f=(c=m[l.tieName][r.name][l.dataPath.join(".")]).indexOf(t))>=0&&(c.splice(f,1),r.changeDOMEventType&&n(t,r.changeDOMEventType))}}function s(e,t,n,o){let a,i,s,l=-1;(a=h.get(t))&&(i=h.get(t).parseParam(n),m[i.tieName]&&m[i.tieName][t]&&((s=m[i.tieName][t][i.dataPath])&&(l=s.indexOf(e)),l>=0&&s.splice(l,1)),i=h.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 l(e,t){let n,o,a,i,s,l,c,f,d,u,p,g,y,w=m[e];if(w)for(u=t.length;u--;)for(o=(n=t[u]).path.join("."),p=(a=Object.keys(w)).length;p--;)if(i=a[p],f=w[i])for(s=h.get(i),g=(l=Object.keys(f)).length;g--;)if(c=l[g],s.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,l,c,u,p;for(t=e.length;t--;)if(r=e[t],"attributes"===(l=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")?s(e,f(t),r.oldValue,e.getAttribute(t)):"src"===t&&"IFRAME"===e.nodeName&&i(e.contentDocument)}else if("childList"===l){for(n=(c=r.addedNodes).length;n--;)(p=c[n]).nodeType!==Node.DOCUMENT_NODE&&p.nodeType!==Node.ELEMENT_NODE||(y.has(p)?y.delete(p):"IFRAME"===p.nodeName?(p.contentDocument&&(d(p.contentDocument),a(p.contentDocument)),p.addEventListener("load",function(){d(this.contentDocument),a(this.contentDocument)})):a(p));for(o=(u=r.removedNodes).length;o--;)(p=u[o]).nodeType!==Node.DOCUMENT_NODE&&p.nodeType!==Node.ELEMENT_NODE||(y.has(p)?y.delete(p):i("IFRAME"===p.nodeName?p.contentDocument:p))}}).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 p=u.DataTier.ties,h=u.DataTier.processors,m={},g={};let y=new Map;Reflect.defineProperty(u.DataTier,"views",{value:{get processChanges(){return l},get applyProcessor(){return c},get updateView(){return r},get viewsToSkip(){return y}}}),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("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,r,a){let i,s,l,c,f,d,u,p,h,m,g=r;for(s=function(e,t){let n,o,r,a,i,s,l={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,s=[];r--;)a=o[r],i=n.dataset[a],a.startsWith("tie")&&i.startsWith(t)&&s.push([a,i.replace(t,"")]);s.length&&(l[f]=s,l.index.push(f))}return l}(e,t);g<a;g++){for(u=(l=e.content.cloneNode(!0)).querySelectorAll("*"),c=s.index.length;c--;)for(p=u[d=s.index[c]],f=(h=s[d]).length;f--;)m=h[f][0],p.dataset[m]=n+g+h[f][1],o.updateView(p,m);g===r?i=l:i.appendChild(l)}return i}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){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,s=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 l=i.querySelectorAll('[data-dt-list-item-aid="'+a+'"]'),c=l.length;if(c>s)for(;c>s;)i.removeChild(l[--c]);else if(c<s){let t=e(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))[2],r[0]+".",c,s);i.appendChild(t)}!function(e,t,n){let r,a,i=e.content.querySelectorAll("*"),s=[];for(a=i.length;a--;)s[a]=Object.keys(i[a].dataset);let l,c,f,d,u=0;for(a=0;u<n;)if((f=t.childNodes[a++])!==e&&(f.nodeType===Node.DOCUMENT_NODE||f.nodeType===Node.ELEMENT_NODE)&&f.dataset.dtListItemAid){for(d=Array.prototype.concat([f],Array.from(f.querySelectorAll("*"))),l=s.length;l--;)for(o.viewsToSkip.set(d[l],null),c=(r=s[l]).length;c--;)r[c].startsWith("tie")&&o.updateView(d[l],r[c]);u++}}(n,i,c)}})})();
(()=>{"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)}})})();

@@ -888,3 +888,3 @@ (() => {

change = changes[i];
changedPath = change.path.join('.');
changedPath = change.path ? change.path.join('.') : null;
procNames = Object.keys(tieViews);

@@ -930,4 +930,2 @@ i1 = procNames.length;

let viewsToSkip = new Map();
function initDocumentObserver(document) {

@@ -959,6 +957,2 @@ function processDomChanges(changes) {

if (node.nodeType !== Node.DOCUMENT_NODE && node.nodeType !== Node.ELEMENT_NODE) continue;
if (viewsToSkip.has(node)) {
viewsToSkip.delete(node);
continue;
}
if (node.nodeName === 'IFRAME') {

@@ -984,6 +978,2 @@ if (node.contentDocument) {

if (node.nodeType !== Node.DOCUMENT_NODE && node.nodeType !== Node.ELEMENT_NODE) continue;
if (viewsToSkip.has(node)) {
viewsToSkip.delete(node);
continue;
}
if (node.nodeName === 'IFRAME') {

@@ -1014,4 +1004,3 @@ discard(node.contentDocument);

get applyProcessor() { return applyProcessor; },
get updateView() { return update;},
get viewsToSkip() {return viewsToSkip;}
get updateView() { return update; }
}

@@ -1044,2 +1033,9 @@ });

add('tieInput', {
toView: function(data, view) {
view.value = typeof data !== 'undefined' && data !== null ? data : '';
},
changeDOMEventType: 'input'
});
add('tieText', {

@@ -1161,14 +1157,17 @@ toView: function(data, view) {

function prepareNewItems(template, itemId, prefix, from, to) {
let result, optimizationMap, tmpTemplate, index = from, i, i1, tmp,
function insertNewContent(container, template, processorParameters, from, to) {
let result, optimizationMap, tmpContent, tmpTemplate, index = from, i, i1, tmp,
prefix = processorParameters[0] + '.', optTmpIdx,
views, view,
pairs, key;
optimizationMap = prepareOptimizationMap(template, itemId);
tmpContent = template.content;
optimizationMap = prepareOptimizationMap(template, processorParameters[2]);
optTmpIdx = optimizationMap.index;
for (; index < to; index++) {
tmpTemplate = template.content.cloneNode(true);
tmpTemplate = tmpContent.cloneNode(true);
views = tmpTemplate.querySelectorAll('*');
i = optimizationMap.index.length;
i = optTmpIdx.length;
while (i--) {
tmp = optimizationMap.index[i];
tmp = optTmpIdx[i];
view = views[tmp];

@@ -1180,3 +1179,2 @@ pairs = optimizationMap[tmp];

view.dataset[key] = prefix + index + pairs[i1][1];
viewsService.updateView(view, key);
}

@@ -1186,14 +1184,17 @@ }

}
return result;
container.appendChild(result);
}
function updateListContent(template, container, required) {
function updateExistingContent(template, container, required) {
let allBluePrintElements = template.content.querySelectorAll('*'),
tieProcsMap = [], keys, i;
tieProcsMap = [], i;
i = allBluePrintElements.length;
while (i--) {
tieProcsMap[i] = Object.keys(allBluePrintElements[i].dataset);
tieProcsMap[i] = Object.keys(allBluePrintElements[i].dataset).filter(key => key.startsWith('tie'));
}
let done = 0, i1, i2, child, descendants;
let done = 0, i1, i2, child,
descendants, descendant,
keys;
i = 0;

@@ -1203,12 +1204,10 @@ while (done < required) {

if (child !== template && (child.nodeType === Node.DOCUMENT_NODE || child.nodeType === Node.ELEMENT_NODE) && child.dataset.dtListItemAid) {
descendants = Array.prototype.concat([child], Array.from(child.querySelectorAll('*')));
descendants = child.querySelectorAll('*');
i1 = tieProcsMap.length;
while (i1--) {
viewsService.viewsToSkip.set(descendants[i1], null);
descendant = i1 ? descendants[i1 - 1] : child;
keys = tieProcsMap[i1];
i2 = keys.length;
while (i2--) {
if (keys[i2].startsWith('tie')) {
viewsService.updateView(descendants[i1], keys[i2]);
}
viewsService.updateView(descendant, keys[i2]);
}

@@ -1226,2 +1225,4 @@ }

isChangedPathRelevant: function(changedPath, viewedPath) {
if (!changedPath) return true;
let subPath = changedPath.replace(viewedPath, '').split('.');

@@ -1255,12 +1256,14 @@ return this.constructor.prototype.isChangedPathRelevant(changedPath, viewedPath) ||

existingListLength = existingList.length;
if (existingListLength > desiredListLength) {
while (existingListLength > desiredListLength) container.removeChild(existingList[--existingListLength]);
} else if (existingListLength < desiredListLength) {
}
// run update on the whole list (in future attempt to get the change's content and optimize this one)
updateExistingContent(template, container, existingListLength);
if (existingListLength < desiredListLength) {
ruleData = extractProcessorParameters(template.dataset.tieList);
let newItemsDOM = prepareNewItems(template, ruleData[2], ruleData[0] + '.', existingListLength, desiredListLength);
container.appendChild(newItemsDOM);
insertNewContent(container, template, ruleData, existingListLength, desiredListLength);
}
// run update on the whole list (in future attempt to get the
updateListContent(template, container, existingListLength);
}

@@ -1267,0 +1270,0 @@ });

@@ -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=f.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,c=[];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),c.push(new i(o.path.concat(s+t),e));return l=Reflect.apply(e[t],e,n),a.notify(c),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 s(o.path.concat(0),n)],a.notify(r),n}:"unshift"===t?function(){let n,l,s,c=[];(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(f.get(t)))?s.ownKey=n:console.error("failed to resolve proxy -> target -> observed"));for(let t=0,r=n.length;t<r;t++)c.push(new i(o.path.concat(t),e[t]));return a.notify(c),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,s,c,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],c=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),c.hasOwnProperty(a)?(p.push(new l(o.path.concat(a),e[a],c[a]&&"object"==typeof c[a]?f.get(c[a]):c[a])),c[a]&&"object"==typeof c[a]&&u.get(f.get(c[a])).revoke()):p.push(new i(o.path.concat(a),e[a]));return a.notify(p),this}:"splice"===t?function(){let n,c,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),c=Reflect.apply(e[t],e,n);for(let t,n=0;n<b;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=c.length;t<n;t++)e=c[t],y&&"object"==typeof y&&(e=f.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],c[d])):w.push(new s(o.path.concat(h+d),c[d]));for(;d<g;d++)w.push(new i(o.path.concat(h+d),e[h+d]));return a.notify(w),c}:Reflect.get(e,t)}function n(t,n,o){let a,s=t.hasOwnProperty(n),c=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(c)&&(u.get(f.get(c)).revoke(),f.delete(c)),h.hasListeners)){let e=d.path.concat(n),t=[s?new l(e,o,c):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 s(r.path.concat(t),o)];r.preventCallbacks||a.notify(e)}return n}function r(a,i,l){let s,c;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),c=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),c=Proxy.revocable(s,{set:n,deleteProperty:o})),u.set(s,this),f.set(c.proxy,s),Object.defineProperties(this,{revokable:{value:c},proxy:{value:c.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 c=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(c,"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,c,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("."),(c=(s=(l=y[a.tieName]||(y[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=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,c,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--;)s=(r=o[l]).parseParam(t.dataset[r.name]),(f=(c=y[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=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,c,f,u,p,d,g,v,w=y[e];if(w)for(p=t.length;p--;)for(o=(n=t[p]).path.join("."),d=(a=Object.keys(w)).length;d--;)if(i=a[d],f=w[i])for(l=h.get(i),g=(s=Object.keys(f)).length;g--;)if(c=s[g],l.isChangedPathRelevant(o,c))for(v=(u=f[c]).length;v--;)r(u[v],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 u(e){new MutationObserver(function(e){let t,n,o,r,s,c,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,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--;)(d=c[n]).nodeType!==Node.DOCUMENT_NODE&&d.nodeType!==Node.ELEMENT_NODE||(v.has(d)?v.delete(d):"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||(v.has(d)?v.delete(d):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={};let v=new Map;Reflect.defineProperty(p.DataTier,"views",{value:{get processChanges(){return s},get applyProcessor(){return c},get updateView(){return r},get viewsToSkip(){return v}}}),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("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,r,a){let i,l,s,c,f,u,p,d,h,y,g=r;for(l=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}(e,t);g<a;g++){for(p=(s=e.content.cloneNode(!0)).querySelectorAll("*"),c=l.index.length;c--;)for(d=p[u=l.index[c]],f=(h=l[u]).length;f--;)y=h[f][0],d.dataset[y]=n+g+h[f][1],o.updateView(d,y);g===r?i=s:i.appendChild(s)}return i}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){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]);else if(c<l){let t=e(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))[2],r[0]+".",c,l);i.appendChild(t)}!function(e,t,n){let r,a,i=e.content.querySelectorAll("*"),l=[];for(a=i.length;a--;)l[a]=Object.keys(i[a].dataset);let s,c,f,u,p=0;for(a=0;p<n;)if((f=t.childNodes[a++])!==e&&(f.nodeType===Node.DOCUMENT_NODE||f.nodeType===Node.ELEMENT_NODE)&&f.dataset.dtListItemAid){for(u=Array.prototype.concat([f],Array.from(f.querySelectorAll("*"))),s=l.length;s--;)for(o.viewsToSkip.set(u[s],null),c=(r=l[s]).length;c--;)r[c].startsWith("tie")&&o.updateView(u[s],r[c]);p++}}(n,i,c)}})})();
(()=>{"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)}})})();
{
"name": "data-tier",
"version": "0.6.12",
"version": "0.6.13",
"main": "dist/data-tier.js",

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

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

__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).
__0.6.12__

@@ -19,0 +22,0 @@ - Fixed [issue no. 10](https://github.com/gullerya/data-tier/issues/10)

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