!function(e){if("function"==typeof define&&define.amd)define([],e);else if("object"==typeof module&&module.exports)module.exports=e();else{var t=e();for(var n in t)this[n]=t[n]}}(function(){var e={};e=function(){return e.Datum.apply(this,arguments)};var n,i,t=function(){function e(t,n,i){this.model=t,this.originalPop=t.pop;var r=this;t.pop=function(){var e=r.originalPop.apply(this,arguments);return function(e,t,n){var i=n.pop();i&&i.removeBinding();for(var r=0;r<t.length;r++)t[r].removeLast();e.subscribableLength=e.length,e.indexOf()}(t,n,i),e}}return e.prototype.unbind=function(){this.model.pop=this.originalPop},e}(),r=function(){function e(e,t){this.property=e,this.propertyType=t,e&&this.isBinding(e)?this.binding=e:e instanceof Array?this.binding=t.createArrayBinding(e):e&&"object"==typeof e&&(this.binding=t.createViewModel(e))}return e.prototype.isBinding=function(e){return e&&e.applyBinding&&e.removeBinding},e.prototype.applyBinding=function(e,t,n){this.binding&&this.binding.applyBinding(e,t,n)},e.prototype.removeBinding=function(){this.binding&&this.binding.removeBinding()},e.prototype.isOlderThan=function(e){return("object"==typeof this.property||"object"==typeof e)&&(e&&this.property!==e)},e}(),o=function(l){function e(n,i,r,o){this.model=n,this.originalPush=n.push;var s=this;n.push=function(){s.originalPush.apply(this,arguments);for(var e=0;e<arguments.length;e++){var t=new l(arguments[e],o);p(n,r,i,t)}n.subscribableLength=n.length,n.indexOf()}}function p(e,t,n,i){t.push(i);for(var r=0;r<n.length;r++){var o=n[r].append();i.applyBinding(o,e)}}return e.prototype.unbind=function(){this.model.push=this.originalPush},e}(r),s=function(){function e(e,t,n){this.model=e,this.originalReverse=e.reverse;var i=this;e.reverse=function(){i.originalReverse.apply(this,arguments),function(e,t){for(var n=0;n<e.length;n++){var i=e[n],r=i.removeChildren();i.appendChildren(r.reverse())}t.reverse()}(t,n),e.indexOf()}}return e.prototype.unbind=function(){this.model.reverse=this.originalReverse},e}(),l=function(){function e(t,n,i){this.model=t,this.originalShift=t.shift;var r=this;t.shift=function(){var e=r.originalShift.apply(this,arguments);return function(e,t,n){var i=n.shift();i&&i.removeBinding();for(var r=0;r<t.length;r++)t[r].removeFirst();e.subscribableLength=e.length,e.indexOf()}(t,n,i),e}}return e.prototype.unbind=function(){this.model.shift=this.originalShift},e}(),p=function(){function e(t,n,i){this.model=t,this.originalSort=t.sort,t.sort=function(e){o(t,n,i,e||r),t.indexOf()}}function r(e,t){return t<e?1:e<t?-1:0}function o(e,t,n,i){var r=function(e,t,n){for(var i=function(e){for(var t=[],n=0;n<e.length;n++)for(var i=e[n].removeChildren(),r=0;r<i.length;r++)t[r]||(t[r]=[]),t[r][n]=i[r];return t}(t),r=[],o=0;o<e.length;o++)r.push({model:e[o],property:n[o],children:i[o]});return r}(e,t,n);r.sort(function(e,t){return i(e.model,t.model)}),function(e,t,n,i){for(var r=0;r<e.length;r++){e[r]=i[r].model,n[r]=i[r].property;for(var o=0;o<t.length;o++)t[o].appendChild(i[r].children[o])}}(e,t,n,r)}return e.prototype.unbind=function(){this.model.sort=this.originalSort},e}(),u=function(c){function e(r,o,s,l){this.model=r,this.originalSplice=r.splice;var p=this;r.splice=function(e,t){e=function(e,t){t<0&&(t=e+t);return t=Math.min(e,t),t=Math.max(0,t)}(r.length,e);var n=[].slice.call(arguments,2);!function(e,t,n,i,r){for(var o=0;o<t.length;o++){for(var s=t[o],l=Math.min(i+r,e.length)-1,p=l;i<=p;p--)s.removeAtIndex(p);n.splice(i,r)}}(r,o,s,e,t),function(e,t,n,i,r,o){for(var s=o.length-1;0<=s;s--){var l=new c(o[s],i);n.splice(r,0,l);for(var p=0;p<t.length;p++){var u=t[p],h=u.insertAtIndex(r);l.applyBinding(h,e)}}}(r,o,s,l,e,n);var i=p.originalSplice.apply(this,arguments);return r.subscribableLength=r.length,r.indexOf(),i}}return e.prototype.unbind=function(){this.model.splice=this.originalSplice},e}(r),h=function(l){function e(n,i,r,o){this.model=n,this.originalUnshift=n.unshift;var s=this;n.unshift=function(){s.originalUnshift.apply(this,arguments);for(var e=arguments.length-1;0<=e;e--){var t=new l(arguments[e],o);p(n,i,r,t)}n.subscribableLength=n.length,n.indexOf()}}function p(e,t,n,i){n.unshift(i);for(var r=0;r<t.length;r++){var o=t[r].prepend();i.applyBinding(o,e)}}return e.prototype.unbind=function(){this.model.unshift=this.originalUnshift},e}(r),c=function(){function e(){this.elements=[]}return e.prototype.add=function(e){this.elements.push(e)},e.prototype.removeOld=function(){for(var e=[],t=this.elements.length-1;0<=t;t--){var n=this.elements[t];n.removedFromDocument()&&(this.elements.splice(t,1),e.push(n))}return e},e.prototype.getElementEqualTo=function(e){for(var t=0;t<this.elements.length;t++)if(this.elements[t].equals(e))return this.elements[t]},e.prototype.contains=function(e){for(var t=0;t<this.elements.length;t++)if(this.elements[t].equals(e))return!0;return!1},e.prototype.empty=function(){var e=this.elements;return this.elements=[],e},e.prototype.get=function(){return this.elements},e}(),a=function(){var n=[],i=!1;function e(){}return e.prototype.registerUpdaterAssigner=function(e){i&&n.push(e)},e.prototype.requestRegistrations=function(){n=[],i=!0},e.prototype.assignUpdater=function(e){for(var t=0;t<n.length;t++)n[t](e);i=!1},e}();e.Datum=(n=c,i=a,function(e){var t={datum:e,dependants:new n,registry:new i};return function(e){if(function(e){return void 0===e||e instanceof Node}(e))return function(){var t=this;return this.registry.registerUpdaterAssigner(function(e){t.dependants.add(e)}),this.datum}.call(t);(function(e){this.datum=e,this.dependants.removeOld(),function(e){for(var t=this.dependants.get(),n=0;n<t.length;n++)t[n].call(e)}.call(this,e)}).call(t,e)}});var d,f,m,y,v,g,b,E,w,B,C,P,k,O,x,A,T,j,q,_,D,U,M,I,N,R,S,L,F,V,J=function(r,o,s,t,n,i,l,p,u,h){function e(n,i){var e,t;this.properties=new Array(n.length),this.model=n,this.propertyType=i,this.boundElements=new r,this.methods=[],function(e){for(var t=0;t<n.length;t++)e.properties[t]=new o(n[t],i)}(this),function(){if(void 0===n.subscribableLength){var t=new s(n.length);Object.defineProperty(n,"subscribableLength",{get:function(){return t()},set:function(e){t(e)}})}}(),e=new s,t=n.indexOf,n.indexOf=function(){return arguments.length?e():e(!0),t.apply(n,arguments)}}return e.prototype.applyBinding=function(e,t,n){var i=this.boundElements.removeOld();this.resetElements(i),this.methods.length||(this.methods=this.createArrayMethods()),e.get()&&this.bindElements(e,t,n)},e.prototype.createArrayMethods=function(){var e=this.boundElements.get();return[new t(this.model,e,this.properties,this.propertyType),new n(this.model,e,this.properties),new i(this.model,e,this.properties),new l(this.model,e,this.properties,this.propertyType),new p(this.model,e,this.properties),new u(this.model,e,this.properties),new h(this.model,e,this.properties,this.propertyType)]},e.prototype.bindElements=function(e,t,n){this.boundElements.contains(e)||this.boundElements.add(e.toArrayElement(this.model.length));for(var i=this.boundElements.getElementEqualTo(e),r=t[n],o=0;o<this.properties.length;o++)this.properties[o].applyBinding(i.getChildAtIndex(o),r)},e.prototype.removeBinding=function(){for(var e=0;e<this.methods.length;e++)this.methods[e].unbind();this.methods=[];var t=this.boundElements.empty();this.resetElements(t)},e.prototype.resetElements=function(e){for(var t=0;t<e.length;t++)e[t].reset()},e}(c,r,e.Datum,o,t,l,h,s,p,u),z=function(l){function e(e,s){e.createRebinder(function(){}),this.domElement=e,this.element=e.get(),this.children=new Array(s),function(e){var t=e.element.children.length;if(1==t){var n=e.element.children[0];e.element.removeChild(n),e.child=new l(n);for(var i=0;i<s;i++){var r=e.child.clone();e.children[i]=r,e.element.appendChild(r)}}else{if(t!=s)throw new Error("Cannot bind array of length "+s+" to "+t+" elements.");e.child=new l(e.element.children[0]);for(var o=0;o<s;o++)e.children[o]=e.child.clone(),e.element.children[o].__DATUM__REBIND=function(){}}}(this)}return e.prototype.append=function(){var e=this.child.clone();return this.children.push(e),this.element.appendChild(e),this.domElement.createElement(e)},e.prototype.prepend=function(){var e=this.child.clone();return this.children.unshift(e),this.element.insertBefore(e,this.element.firstChild),this.domElement.createElement(e)},e.prototype.insertAtIndex=function(e){var t=this.child.clone();return this.element.insertBefore(t,this.children[e]),this.children.splice(e,0,t),this.domElement.createElement(t)},e.prototype.removeFirst=function(){this.element.firstElementChild&&(this.children.shift(),this.element.removeChild(this.element.firstElementChild))},e.prototype.removeLast=function(){this.element.lastElementChild&&(this.children.pop(),this.element.removeChild(this.element.lastElementChild))},e.prototype.removeAtIndex=function(e){var t=this.children.splice(e,1);this.element.removeChild(t[0])},e.prototype.removeChildren=function(){var e=this.children;for(this.children=[];this.element.lastChild;)this.element.removeChild(this.element.lastChild);return e},e.prototype.appendChildren=function(e){for(var t=0;t<e.length;t++){var n=e[t];this.children.push(n),this.element.appendChild(n)}},e.prototype.appendChild=function(e){this.children.push(e),this.element.appendChild(e)},e.prototype.reset=function(){for(this.children=[];this.element.lastChild;)this.element.removeChild(this.element.lastChild);this.element.appendChild(this.child.get())},e.prototype.getChildAtIndex=function(e){return this.domElement.createElement(this.children[e])},e.prototype.removedFromDocument=function(){return this.domElement.removedFromDocument()},e.prototype.equals=function(e){return e.hasEqual(this.element)},e.prototype.hasEqual=function(e){return this.element===e},e.prototype.get=function(){return this.domElement},e}(function(){function e(e){this.element=e,this.index=0}return e.prototype.clone=function(){var e=this.element.cloneNode(!0);return this.number(e,this.index++),e},e.prototype.number=function(e,t){if(e.id&&(e.id=e.id+"_"+t),e.hasAttribute("name")){var n=e.getAttribute("name")+"_"+t;e.setAttribute("name",n)}for(var i=0;i<e.children.length;i++)this.number(e.children[i],t)},e.prototype.get=function(){return this.element},e}()),G=function(){function e(e,t,n){this.callback=e,this.binding=t,this.element=n}return e.prototype.call=function(e){this.callback(e)},e.prototype.removedFromDocument=function(){return this.element.removedFromDocument()},e.prototype.equals=function(e){return e.hasEqual(this.binding,this.element)},e.prototype.hasEqual=function(e,t){return this.binding===e&&this.element.equals(t)},e}(),H=(d=c,f=G,m=a,function(n){var i=new d;function e(){return n.test(this)}return e.applyBinding=function(e,t){!function(e,t){for(var n=t.removeOld(),i=0;i<n.length;i++){var r=n[i].get();r&&e.resetElement(r)}}(n,i),function(e,t,n,i){e.get()&&!i.contains(e)&&(n.setUpElement(t,e.get()),(new m).requestRegistrations(),n.updateElement(t,e.get()),function(t,n,i){var r=!1;(new m).assignUpdater(new f(function(e){r||(r=!0,i.updateElement(t,n.get(),e),r=!1)},i,n))}(t,e,n),i.add(e))}(e,t,n,i)},e.removeBinding=function(){!function(e,t){for(var n=t.empty(),i=0;i<n.length;i++){var r=n[i].get();r&&e.resetElement(r)}}(n,i)},e}),K=function(){function e(e){this.callbacks=e}return e.prototype.setUpElement=function(){},e.prototype.updateElement=function(e,t){var n=this.splitClasses(t);for(var i in this.callbacks){var r=n.indexOf(i);this.callbacks[i].call(e,t)?r<0&&n.push(i):r+1&&n.splice(r,1)}t.className=n.join(" ")},e.prototype.splitClasses=function(e){return e.className?e.className.split(" "):[]},e.prototype.resetElement=function(){},e.prototype.test=function(e){var t={classes:{}};for(var n in this.callbacks)t.classes[n]=this.callbacks[n].bind(e);return t},e}(),Q=function(){function e(e){this.destroy=e}return e.prototype.setUpElement=function(e){this.parentModel=e},e.prototype.updateElement=function(){},e.prototype.resetElement=function(e){this.destroy.call(this.parentModel,e)},e.prototype.test=function(e){return{destroy:this.destroy.bind(e)}},e}(),W=function(){function e(e){this.callbacks=e,this.listeners=[]}return e.prototype.setUpElement=function(e,t){for(var n in this.callbacks){var i=this.callbacks[n],r=this.createListener(e,t,i);this.listeners.push({key:n,element:t,listener:r}),t.addEventListener(n,r)}},e.prototype.createListener=function(t,n,i){return function(e){i.call(t,e,n)}},e.prototype.updateElement=function(){},e.prototype.resetElement=function(e){for(var t=0;t<this.listeners.length;t++){var n=this.listeners[t];if(n.element===e){e.removeEventListener(n.key,n.listener);break}}this.listeners.splice(t,1)},e.prototype.test=function(e){var t={events:{}};for(var n in this.callbacks)t.events[n]=this.callbacks[n].bind(e);return this.callbacks.click&&(t.click=this.callbacks.click.bind(e)),t},e}(),X=function(){function e(e){this.init=e}return e.prototype.setUpElement=function(e,t){this.init.call(e,t)},e.prototype.updateElement=function(){},e.prototype.resetElement=function(){},e.prototype.test=function(e){return{init:this.init.bind(e)}},e}(),Y=function(){function e(e){this.text=e}return e.prototype.setUpElement=function(){},e.prototype.updateElement=function(e,t){t.textContent=this.text.call(e,t)},e.prototype.resetElement=function(e){e.textContent=""},e.prototype.test=function(e){return{text:this.text.bind(e)}},e}(),Z=function(){function e(e){this.update=e}return e.prototype.setUpElement=function(){},e.prototype.updateElement=function(e,t){this.update.call(e,t)},e.prototype.resetElement=function(){},e.prototype.test=function(e){return{update:this.update.bind(e)}},e}(),$=function(){function e(e){this.value=e,this.listeners=[]}return e.prototype.setUpElement=function(t,n){var i=this;function e(e){i.value.call(t,e.target.value,n)}this.listeners.push({element:n,listener:e}),n.addEventListener("change",e)},e.prototype.updateElement=function(e,t){var n=this.value.call(e,void 0,t);void 0!==n&&(t.value=n)},e.prototype.resetElement=function(e){for(var t=0;t<this.listeners.length;t++){var n=this.listeners[t];if(n.element===e){e.removeEventListener("change",n.listener),e.value="";break}}this.listeners.splice(t,1)},e.prototype.test=function(e){return{value:this.value.bind(e)}},e}(),ee=function(){function e(e){this.visible=e}return e.prototype.setUpElement=function(){},e.prototype.updateElement=function(e,t){this.visible.call(e,t)?t.style.display=null:t.style.display="none"},e.prototype.resetElement=function(e){e.style.display=null},e.prototype.test=function(e){return{visible:this.visible.bind(e)}},e}();e.Binding=(y=H,v=Y,g=$,b=W,E=X,w=Z,B=ee,C=Q,P=K,function(e){var i=[];function t(){return function(e,t){for(var n={},i=0;i<e.length;i++){var r=e[i].call(t);for(var o in r)n[o]=r[o]}return n}(i,this)}return e.text&&i.push(new y(new v(e.text))),e.value&&i.push(new y(new g(e.value))),e.click&&i.push(new y(new b({click:e.click}))),e.events&&i.push(new y(new b(e.events))),e.init&&i.push(new y(new E(e.init))),e.update&&i.push(new y(new w(e.update))),e.destroy&&i.push(new y(new C(e.destroy))),e.visible&&i.push(new y(new B(e.visible))),e.classes&&i.push(new y(new P(e.classes))),t.applyBinding=function(e,t){for(var n=0;n<i.length;n++)i[n].applyBinding(e,t)},t.removeBinding=function(){for(var e=0;e<i.length;e++)i[e].removeBinding()},t}),e.Classes=(k=K,O=H,function(e){return new O(new k(e))}),e.Click=(x=W,A=H,function(e){return new A(new x({click:e}))}),e.Destroy=(T=Q,j=H,function(e){return new j(new T(e))}),e.Events=(q=W,_=H,function(e){return new _(new q(e))}),e.Init=(D=X,U=H,function(e){return new U(new D(e))}),e.Text=(M=Y,I=H,function(e){return new I(new M(e))}),e.Update=(N=Z,R=H,function(e){return new R(new N(e))}),e.Value=(S=$,L=H,function(e){return new L(new S(e))}),e.Visible=(F=ee,V=H,function(e){return new V(new F(e))});var te,ne,ie,re,oe=function(e,t){function o(e){this.element=e}return o.prototype.isInScope=function(e){return function e(t,n){var i=t.parentElement;return!!i&&(i===n||!i.__DATUM__REBIND&&e(i,n))}(this.element,e)},o.prototype.removedFromDocument=function(){return!document.body.contains(this.element)},o.prototype.getMatchingElements=function(e){for(var t=this.element.querySelectorAll("[data-bind="+e+"]"),n=[],i=0;i<t.length;i++){var r=new o(t[i]);r.isInScope(this.element)&&n.push(r)}return this.element.dataset.bind===e&&n.push(new o(this.element)),n},o.prototype.createRebinder=function(e){this.element.__DATUM__REBIND=e},o.prototype.rebind=function(){this.element.__DATUM__REBIND()},o.prototype.callBindingCallback=function(e){e.onBind&&e.onBind(this.element)},o.prototype.equals=function(e){return e.hasEqual(this.element)},o.prototype.hasEqual=function(e){return this.element===e},o.prototype.toObjectElement=function(){return new e(this.element)},o.prototype.toArrayElement=function(e){return new t(this,e)},o.prototype.get=function(){return this.element},o.prototype.createElement=function(e){return new o(e)},o}(function(){function e(e){this.element=e,this.children=[].slice.call(e.childNodes)}return e.prototype.removeChildren=function(){for(var e=this.element.childNodes,t=e.length-1;0<=t;t--)this.element.removeChild(e[t])},e.prototype.replaceChildren=function(){for(var e=0;e<this.children.length;e++)this.element.appendChild(this.children[e])},e.prototype.removedFromDocument=function(){return!document.contains(this.element)},e.prototype.equals=function(e){return e.hasEqual(this.element)},e.prototype.hasEqual=function(e){return this.element===e},e}(),z),se=function(){function t(){}return t.prototype.isInScope=function(){return!0},t.prototype.removedFromDocument=function(){return!0},t.prototype.getMatchingElements=function(){return[]},t.prototype.createRebinder=function(){},t.prototype.rebind=function(){},t.prototype.callBindingCallback=function(){},t.prototype.equals=function(e){return e instanceof t},t.prototype.hasEqual=function(){return!1},t.prototype.get=function(){return null},t}(),le=function(t,i,r){function e(e){this.scope=e,this.removed=!1,this.boundElements=new t}return e.prototype.applyBinding=function(e,t,n){for(var i=this.boundElements.removeOld(),r=0;r<i.length;r++)i[r].replaceChildren();e.get()&&this.bindElements(e,t,n)},e.prototype.bindElements=function(e,t,n){this.boundElements.contains(e)?this.updateElement(e,t&&t[n]):(this.boundElements.add(e.toObjectElement()),(new i).requestRegistrations(),this.updateElement(e,t&&t[n]),this.createCallback(this.scope,e))},e.prototype.updateElement=function(e,t){var n=this.boundElements.getElementEqualTo(e);t?this.removed&&(this.removed=!1,n.replaceChildren()):(this.removed=!0,n.removeChildren())},e.prototype.createCallback=function(e,t){var n=!1;(new i).assignUpdater(new r(function(){n||(n=!0,e.rebind(),n=!1)},this,t))},e.prototype.removeBinding=function(){for(var e=this.boundElements.empty(),t=0;t<e.length;t++)e[t].replaceChildren()},e}(c,a,G),pe=function(t,n,i,r,e,o){function s(e){this.model=e,this.boundElements=new t,this.transientProperties={},this.permanentProperties={},new n(e)}return s.prototype.applyBinding=function(e){this.boundElements.removeOld(),this.unbindOldProperties(),this.boundElements.contains(e)||(this.boundElements.add(e),this.createRebinder(e),e.callBindingCallback(this.model)),this.createPermanentProperties(e),this.createTransientProperties(),this.bindProperties(e)},s.prototype.createRebinder=function(e){var t=this;e.createRebinder(function(){s.prototype.applyBinding.call(t,e)})},s.prototype.unbindOldProperties=function(){for(var e in this.transientProperties)this.model[e]||(this.transientProperties[e].removeBinding(),delete this.transientProperties[e])},s.prototype.createPermanentProperties=function(e){for(var t in this.model)this.permanentProperties[t]&&this.permanentProperties[t].hasScope(e)||(this.permanentProperties[t]=new r(this.model[t],this.createPropertyType(),e))},s.prototype.createTransientProperties=function(){for(var e in this.model)this.isNew(e)&&(this.transientProperties[e]&&this.transientProperties[e].removeBinding(),this.transientProperties[e]=new i(this.model[e],this.createPropertyType()))},s.prototype.isNew=function(e){var t=this.transientProperties[e];return!t||t.isOlderThan(this.model[e])},s.prototype.createPropertyType=function(){return new e(function(e){return new s(e)})},s.prototype.bindProperties=function(e){for(var t in this.permanentProperties)for(var n=this.getElements(e,t),i=0;i<n.length;i++){var r=n[i];this.permanentProperties[t].applyBinding(r,this.model,t),this.transientProperties[t].applyBinding(r,this.model,t)}},s.prototype.getElements=function(e,t){var n=e.getMatchingElements(t);return n.length?n:[new o]},s.prototype.removeBinding=function(){for(var e in this.permanentProperties)this.permanentProperties[e].removeBinding(),this.transientProperties[e].removeBinding()},s}(c,function(e){e.toJSON||(e.toJSON=function(){return function(e){var t={};for(var n in e instanceof Array&&(t=[]),e){var i=e[n];i&&i.toJSON&&"object"==typeof i&&(!i.applyBinding||i instanceof Array)&&(t[n]=i.toJSON()),(!i||"object"!=typeof i&&"function"!=typeof i)&&(t[n]=i)}return t}(e)})},r,function(){function e(e,t,n){this.scope=n,this.property=e,this.propertyType=t,this.propertyInjected=!1,"object"!=typeof e||this.isBinding(e)||(this.objectBinding=t.createObjectBinding(n))}return e.prototype.applyBinding=function(e,t,n){"function"==typeof this.property||this.isBinding(this.property)||this.propertyInjected||(this.propertyType.injectProperty(this.property,t,n),this.propertyInjected=!0),this.objectBinding&&this.objectBinding.applyBinding(e,t,n)},e.prototype.isBinding=function(e){return e&&e.applyBinding&&e.removeBinding},e.prototype.removeBinding=function(){this.objectBinding&&this.objectBinding.removeBinding()},e.prototype.hasScope=function(e){return this.scope.equals(e)},e}(),function(r,t,n){function e(e){this.createViewModelCallback=e}return e.prototype.injectProperty=function(e,t,n){var i=new r(e);Object.defineProperty(t,n,{get:function(){return i()},set:function(e){i(e)}})},e.prototype.createViewModel=function(e){return this.createViewModelCallback(e)},e.prototype.createObjectBinding=function(e){return new t(e)},e.prototype.createArrayBinding=function(e){return new n(e,this)},e}(e.Datum,le,J),se),ue=function(){function e(e){var t=this;this.observer=new MutationObserver(function(){return function(e){for(var t=0;t<e.length;t++){var n=e[t],i=n.target.children.length;if(i){var r=n.target;this.rebindElement(r)}}}.apply(t,arguments)}),this.observer.observe(e,{childList:!0,subtree:!0})}return e.prototype.rebindElement=function(e){e&&e.__DATUM__REBIND?e.__DATUM__REBIND():e&&this.rebindElement(e.parentElement)},e.prototype.disconnect=function(){this.observer.disconnect()},e}();return e.BindingRoot=(te=pe,ne=ue,ie=oe,re=!1,function(e){!function(){if("object"!=typeof e)throw new Error("The binding root must be an object.");if(e instanceof Array)throw new Error("The binding root cannot be an array.")}(),function(){if(re)throw new Error("The binding root is unique and cannot be instantiated multiple times.");re=!0}();var t=new te(e);t.applyBinding(new ie(document.body));var n=new ne(document.body);return{disconnect:function(){t.removeBinding(),n.disconnect(),re=!1}}}),e});