smart-webcomponents-react
Version:
[](https://jqwidgets.com/license/)
6 lines (4 loc) • 20.8 kB
JavaScript
/* Smart UI v23.0.8 (2025-05-13)
Copyright (c) 2011-2024 jQWidgets.
License: https://htmlelements.com/license/ */ //
(()=>{"use strict";const e="Smart";class t{static get moduleName(){return"BindingModule"}getBindings(e,t){const n=this;let o=0,i={},r=(e=>{if(e instanceof HTMLElement)return n.parseAttributes(e);{let t=n.parseProperty(e.data?e.data.trim():null,"textContent",e);if(t)return n.ownerElement&&e.parentNode===n.ownerElement.$.content&&(t.value=""!==n.ownerElement.$.html?n.ownerElement.$.html:void 0,n.ownerElement.innerHTML=""),{textContent:t}}})(e);r&&(i.data=r),t||(i.mapping=[],t=i),e.getAttribute&&(i.nodeId=e.getAttribute("smart-id"),t&&r&&(t.mapping[i.nodeId]=r)),i.node=e,e.firstChild&&(i.children={});for(let r=e.firstChild;r;r=r.nextSibling)i.children[o++]=n.getBindings(r,t);return i}_addRemovePropertyBinding(e,t,n,o,i){if(!e||!t||!n)return;const r=this,a=r.ownerElement.bindings,d=n.getAttribute("smart-id"),l=e.indexOf("{{")>=0;let s=!1;(e=e.replace("{{","").replace("}}","").replace("[[","").replace("]]","")).indexOf("!")>=0&&(e=e.replace("!",""),s=!0);const c=r.ownerElement._properties[e],p={name:e,reflectToAttribute:c.reflectToAttribute,twoWay:l,type:c.type,not:s};if(i&&!o){const n={},o={name:e,targetPropertyName:t,reflectToAttribute:c.reflectToAttribute,twoWay:l,type:c.type,not:s};n[e]=o,a.mapping[d]=n}const u=function(e){for(let i in e){const a=e[i];if(a.nodeId===d){a.data||(a.data={}),o?(a.data[t]=null,delete a.data[t]):a.data[t]=p;break}if(a.children)u(a.children);else if(a.node&&a.node.children&&a.node===n.parentElement){const e=a.node;if(!e.firstChild)continue;a.children={};let t=0;for(let n=e.firstChild;n;n=n.nextSibling)a.children[t++]=r.getBindings(n);u(a.children)}}};u(a.children),o?delete r.ownerElement.boundProperties[e]:r.ownerElement.boundProperties[e]=!0,r.updateBoundNodes(e)}addPropertyBinding(e,t,n,o){this._addRemovePropertyBinding(e,t,n,!1,o)}removePropertyBinding(e,t,n,o){this._addRemovePropertyBinding(e,t,n,!0,o)}parseAttributes(e){const n=this;let o;for(let i=0;i<e.attributes.length;i++){const r=e.attributes[i],a=r.name,d=r.value;t.cache["toCamelCase"+a]||(t.cache["toCamelCase"+a]=window.Smart.Utilities.Core.toCamelCase(a));const l=t.cache["toCamelCase"+a];if(a.indexOf("(")>=0){let t=a.substring(1,a.length-1);if(n.ownerElement&&!n.ownerElement.dataContext){n.ownerElement.templateListeners[e.getAttribute("smart-id")+"."+t]=d,e.removeAttribute(a);continue}{o||(o={});const e=d.substring(0,d.indexOf("("));o[l]={isEvent:!0,name:t,value:e};continue}}let s=n.parseProperty(d,a,e);s&&(o||(o={}),o[l]=s)}return o}parseProperty(e,t){if(!e||!e.length)return;const n=this;let o,i=e.length,r=0,a=0,d=0,l=!0;for(;a<i;){r=e.indexOf("{{",a);let t=e.indexOf("[[",a),n="}}";if(t>=0&&(r<0||t<r)&&(r=t,l=!1,n="]]"),d=r<0?-1:e.indexOf(n,r+2),d<0)return;o=o||{};let i=e.slice(r+2,d).trim();o.name=i,a=d+2}const s=o.name,c=n.ownerElement?n.ownerElement._properties[s]:null;if(o.twoWay=l,o.ready=!1,n.ownerElement&&(s.indexOf("::")>=0?n.ownerElement.boundProperties[s.substring(0,s.indexOf("::"))]=!0:n.ownerElement.boundProperties[s]=!0),c)o.type=c.type,o.reflectToAttribute=c.reflectToAttribute;else{["checked","selected","async","autofocus","autoplay","controls","defer","disabled","hidden","ismap","loop","multiple","open","readonly","required","scoped"].indexOf(t)>=0?o.type="boolean":o.type="string",o.reflectToAttribute=!0}return o}updateTextNodes(){const e=this;e.updateTextNode(e.ownerElement.shadowRoot||e.ownerElement,e.ownerElement.bindings,e.ownerElement)}updateTextNode(e,t,n){const o=this;if(!t)return;let i=0;for(let r=e.firstChild;r&&t.children;r=r.nextSibling)o.updateTextNode(r,t.children[i++],n);if(t&&t.data)for(let e in t.data){const o=t.data[e],i=o.name;"textContent"===e&&o.twoWay&&!o.updating&&void 0!==o.value&&(n[i]=o.value)}}updateBoundProperty(e,t){if(t.updating)return;const n=this.ownerElement;t.updating=!0,n[e]=t.value,t.updating=!1}updateBoundNodes(e){const t=this;if(t.updateBoundNode(t.ownerElement.shadowRoot||t.ownerElement,t.ownerElement.bindings,t.ownerElement,e),t.ownerElement.detachedChildren.length>0)for(let n=0;n<t.ownerElement.detachedChildren.length;n++){const o=t.ownerElement.detachedChildren[n],i=o.getAttribute("smart-id"),r=function(e){if(e.nodeId===i)return e;for(let t in e.children){const n=e.children[t];if((n.getAttribute?n.getAttribute("smart-id"):"")===i)return e;if(n.children){const e=r(n);if(e)return e}}return null},a=r(t.ownerElement.bindings);if(a)t.updateBoundNode(o,a,t.ownerElement,e,!0);else if(o.getAttribute&&t.ownerElement.bindings.mapping){const n=t.ownerElement,o=t.ownerElement.bindings;if(o)for(let i in o.mapping){const r=n.querySelector('[smart-id="'+i+'"]');if(r){const a=o.mapping[i];t.updateBoundData(r,a,n,e)}}}}}updateBoundMappedNodes(){const e=this,t=e.ownerElement.bindings,n=e.ownerElement;if(t.mapping)for(let o in t.mapping){let i=n.querySelector('[smart-id="'+o+'"]');if(n.shadowRoot&&(i=n.querySelector('[id="'+o+'"]'),i||(i=n.shadowRoot.querySelector('[id="'+o+'"]')||n.shadowRoot.querySelector('[smart-id="'+o+'"]'))),i){const r=t.mapping[o];e.updateBoundData(i,r,n)}else if(n.getAttribute("aria-controls")){let r=document.getElementById(n.getAttribute("aria-controls"));if(!r&&n.shadowRoot&&(r=n.shadowRoot.getElementById(n.getAttribute("aria-controls"))),i=r.querySelector('[smart-id="'+o+'"]'),i){const r=t.mapping[o];e.updateBoundData(i,r,n)}}}}updateBoundNode(e,t,n,o,i){const r=this;if(!t)return;let a=0;if(i){if(i&&!t.data)for(let d=e.firstChild;d&&t.children;d=d.nextSibling)if(d.getAttribute){const e=d.getAttribute("smart-id"),i=function(){for(let n in t.children)if(t.children[n].nodeId===e)return t.children[n]}();r.updateBoundNode(d,i,n,o),a++}else r.updateBoundNode(d,t.children[a++],n,o,i)}else for(let i=e.firstChild;i&&t.children;i=i.nextSibling)if(i.getAttribute){const e=i.getAttribute("smart-id"),d=function(){for(let n in t.children)if(t.children[n].nodeId===e)return t.children[n]}();r.updateBoundNode(i,d,n,o),a++}else r.updateBoundNode(i,t.children[a++],n,o);if(!t||!t.data)return;const d=t.data;r.updateBoundData(e,d,n,o)}updateBoundData(e,n,o,i){const r=this;for(let a in n){const d=n[a];let l=d.name;if(!d.updating&&(l.indexOf("::")>=0&&(l=l.substring(0,l.indexOf("::"))),void 0===i||i===l)){if(l.indexOf("(")>=0){let e=l.substring(l.indexOf("("));const t=l.substring(0,l.indexOf("("));if(e=e.substring(1,e.length-1),e=e.replace(/ /gi,""),e=e.split(","),e.length>0&&""!==e[0]){let n=[];for(let t=0;t<e.length;t++)n.push(o[e[t]]);d.value=o[t].apply(o,n)}else d.value=o[t]();d.type=typeof d.value}else d.value=o[l];if("innerHTML"===l?e[a].toString().trim()!==o[l].toString().trim()&&(d.ready||o._properties[l].defaultValue!==d.value)&&(e[a]=d.value.toString().trim()):d.not?(e[a]=!d.value,d.targetPropertyName&&(e[d.targetPropertyName]=!d.value)):(e[a]=d.value,d.targetPropertyName&&(e[d.targetPropertyName]=d.value)),e.$&&e.$.isNativeElement){t.cache["toDash"+a]||(t.cache["toDash"+a]=window.Smart.Utilities.Core.toDash(a));const n=t.cache["toDash"+a],o=e.$.getAttributeValue(n,d.type);!d.reflectToAttribute||o===d.value&&d.ready||e.$.setAttributeValue(n,d.value,d.type),d.reflectToAttribute||e.$.setAttributeValue(n,null,d.type)}if(!d.ready){if(e.$&&e.$.isCustomElement){t.cache["toDash"+a]||(t.cache["toDash"+a]=window.Smart.Utilities.Core.toDash(a));const n=t.cache["toDash"+a];e._properties||(e._beforeCreatedProperties=e._properties=e.propertyByAttributeName=[]),e._properties[a]||(e._properties[a]={attributeName:n},e._beforeCreatedProperties&&(e._beforeCreatedProperties[a]=e._properties[a]),e.propertyByAttributeName[n]=e._properties[a]);const o=e._properties[a];o.isUpdating=!0,d.reflectToAttribute&&(d.not?e.$.setAttributeValue(o.attributeName,!d.value,d.type):e.$.setAttributeValue(o.attributeName,d.value,d.type)),d.reflectToAttribute||e.$.setAttributeValue(o.attributeName,null,d.type),o.isUpdating=!1}if(d.twoWay){const n=function(n){if(d.value=n,e.$&&e.$.isNativeElement){t.cache["toDash"+a]||(t.cache["toDash"+a]=window.Smart.Utilities.Core.toDash(a));const n=t.cache["toDash"+a],o=e.$.getAttributeValue(n,d.type);d.reflectToAttribute&&o!==d.value&&e.$.setAttributeValue(n,d.value,d.type),d.reflectToAttribute||e.$.setAttributeValue(n,null,d.type)}};if(d.name.indexOf("::")>=0){const t=d.name.indexOf("::"),o=d.name.substring(t+2);r.ownerElement["$"+e.getAttribute("smart-id")].listen(o,(function(){n(e[a]);const t=d.name.substring(0,d.name.indexOf("::"));r.updateBoundProperty(t,d)}))}if(e.$&&e.$.isCustomElement){e._properties[a]&&(e._properties[a].notify=!0),t.cache["toDash"+a]||(t.cache["toDash"+a]=window.Smart.Utilities.Core.toDash(a));const o=t.cache["toDash"+a];r.ownerElement["$"+e.getAttribute("smart-id")].listen(o+"-changed",(function(e){let t=e.detail;n(t.value);const o=r.ownerElement.context;e.context!==document&&(r.ownerElement.context=r.ownerElement),r.updateBoundProperty(d.name,d),r.ownerElement.context=o}))}}}d.ready=!0}}}static clearCache(){this.cache={}}}t.cache={};class n{constructor(e){const t=this;t._id=e.id,e.id?t._appRoot=document.getElementById(t._id):t._id=window.Smart.Utilities.Core.createGUID(),e.selector&&(t._id=window.Smart.Utilities.Core.createGUID(),t._appRoot=document.querySelector(e.selector)),t._appRoot||(t._appRoot=document.body),t._appRoot.classList.add("smart-visibility-hidden");const n={};if(e.render){const t=e.render(),o=e.components;(function(){const i=document.createDocumentFragment(),r=document.implementation.createDocument("http://www.w3.org/1999/xhtml","html",null),a=document.createElementNS("http://www.w3.org/1999/xhtml","body"),d=document.createElement("div");r.documentElement.appendChild(a),a.appendChild(d),d.innerHTML=t;for(let e=0;e<o.length;e++){const t=o[e],i=t.name,a=window.Smart.Utilities.Core.toDash(i),l=r.querySelectorAll(i);t.tagName=a;for(let e=0;e<l.length;e++){const t=l[e],o=t.getAttribute("id")||window.Smart.Utilities.Core.createGUID(),r=document.createElement("div");r.id=o,d.insertBefore(r,t),n["#"+o]={name:i,properties:[],rendered:!1},t.parentNode.removeChild(t)}}i.appendChild(d);const l=document.querySelector(e.selector);l&&l.appendChild(i)})()}t._template=e.template||{},t._data=e.data||{},t._components=n;const o=function(){t._addAttributeBindings(),t._renderForBindings(),t._addModelBindings(),t._observeData(),t.render(),t._appRoot.classList.remove("smart-visibility-hidden")};"complete"===document.readyState?o():window.addEventListener("load",o)}_addAttributeBindings(e,n){const o=this,i=new t,r=e?i.getBindings(e):i.getBindings(o._appRoot);n||(n="");const a=function(e){const t=function(e){if(e.data){let t=e.node.id;t||(e.node.id=t="id"+Math.floor(65536*(1+Math.random())).toString(16).substring(1));for(let i in e.data){const r=e.data[i];if("textContent"===i&&(e.node.parentNode.id?t=e.node.parentNode.id:(e.node.id="",e.node.parentNode.id=t)),r.isEvent){const e={};e[r.name]=r.value,o._addListenerBinding(t,e)}else{const e={};e[i]=n+r.name,o._addTemplateBinding(t,e)}}}};t(e);for(let n in e.children){const o=e.children[n];o.node&&o.node.getAttribute&&o.node.getAttribute("smart-for")&&null===o.node.getAttribute("smart-for-rendered")||(t(o),o.children&&a(o))}};a(r)}get template(){return this._template}set template(e){this._template=e,this.render()}get id(){return this._id}set id(e){this._id=e}get jsonData(){return this.toJSON()}get formData(){const e=new FormData,t=this.toJSON();if(!t)return e;const n=function(t,o){for(let i in t){const r=t[i];window.Smart.Utilities.Types.isFunction(r)||("object"!=typeof r||Array.isArray(r)||n(r,i),("object"!=typeof r||Array.isArray(r))&&(""===o?e.append(i,r):e.append(o+"."+i,r)))}};return n(t,""),e}toJSON(){const e=function(t,n){for(let o in t){if(o.startsWith("_")||"notifyFn"===o||"canNotify"===o||"name"===o)continue;if("propertyName"===o||"toString"===o||"propertyIsEnumerable"===o||"valueOf"===o||"toLocaleString"===o)continue;if("hasOwnProperty"===o||"isPrototypeOf"===o)continue;const i=t[o];if("observableArray"!==i.name)if("observable"!==i.name)if("object"!=typeof i||window.Smart.Utilities.Types.isFunction(i))n[o]=i;else{const t=e(i,{},o);n[o]=t}else{const t={};for(let n in i)if(!n.startsWith("_")&&"propertyIsEnumerable"!==n&&"notifyFn"!==n&&"canNotify"!==n&&"name"!==n&&!n.startsWith("_")&&"notifyFn"!==n&&"canNotify"!==n&&"name"!==n&&"propertyName"!==n&&"toString"!==n&&"valueOf"!==n&&"toLocaleString"!==n&&"hasOwnProperty"!==n&&"isPrototypeOf"!==n)if("object"!=typeof i||"object"!=typeof i[n]||window.Smart.Utilities.Types.isFunction(i))t[n]=i[n];else{const r=e(i[n],{},o+"."+n);t[n]=r}n[o]=t}else n[o]=i.toArray()}return n};return e(this._data,{},"")}get data(){const e=this;return e._data||(e._data={}),e._data}set data(e){const t=this;t._data=e,t._observeData(),t.render()}_addTemplateBinding(e,t){const n=this;n.template["#"+e]?n.template["#"+e].bind?Object.assign(n.template["#"+e].bind,t):n.template["#"+e].bind=t:n.template["#"+e]={bind:t}}_addListenerBinding(e,t){const n=this;n.template["#"+e]?n.template["#"+e].listeners?Object.assign(n.template["#"+e].listeners,t):n.template["#"+e].listeners=t:n.template["#"+e]={listeners:t}}_updateDataFromBooleanElement(e,t){const n=this,o=t.checked,i=n._data[o];if(e.value&&"on"!==e.value)if(Array.isArray(i)||"observableArray"===i.name)if(e.checked)i.push(e.value);else{const t=i.indexOf(e.value);t>=0&&i.splice(t,1)}else"radio"!==e.type?e.checked?n._data[o]=e.value:n._data[o]="":e.checked&&(n._data[o]=e.value);else n._data[o]=e.checked}_updateDataFromNativeElement(e,t){const n=this;if("SELECT"===e.tagName&&e.addEventListener("change",(function(){const o=t.value;let i=n._data[o];if(e.__updating=!0,Array.isArray(i)||"observableArray"===i.name){if(i=new window.Smart.ObservableArray,e.selectedOptions)for(let t=0;t<e.selectedOptions.length;t++){const n=e.selectedOptions[t];i.push(n.value)}n._data[o]=i}else n._data[o]=e.value;e.__updating=!1})),"INPUT"===e.tagName||"TEXTAREA"===e.tagName){e.addEventListener("change",(function(){e.__updating=!0,o?n._updateDataFromBooleanElement(e,t):n._data.value=e.value,e.__updating=!1}));let o="checkbox"===e.type||"radio"===e.type;o||e.addEventListener("keyup",(function(){const o=t.value;n._data[o]=e.value}))}}_addModelBindings(e){const t=this,n=e?e.querySelectorAll("[smart-model]"):t._appRoot.querySelectorAll("[smart-model]");for(let e=0;e<n.length;e++){const o=n[e];let i={value:o.getAttribute("smart-model")};"list"===o.type&&(i={selectedValues:o.getAttribute("smart-model")}),"checkbox"!==o.type&&"radio"!==o.type||(i={checked:o.getAttribute("smart-model")}),o.id||(o.id="id"+window.Smart.Utilities.Core.createGUID().replace(/-/gi,"")),t._updateDataFromNativeElement(o,i),t._addTemplateBinding(o.id,i)}}_renderForBindings(e){const t=this,n=t._appRoot.querySelectorAll("[smart-for]");for(let e=0;e<n.length;e++){const o=n[e],i=o.getAttribute("smart-for"),r=t._data[i];o.id||(o.id="id"+window.Smart.Utilities.Core.createGUID().replace(/-/gi,"")),o.setAttribute("smart-for-rendered","");const a=null!==o.getAttribute("smart-for-self"),d=a?o.parentNode.querySelectorAll(".smart-for-item-"+o.id):o.querySelectorAll(".smart-for-item-"+o.id);for(let e=0;e<d.length;e++)t.template[d[e].id]&&delete t.template[d[e].id],d[e].remove();const l=a?o:o.firstElementChild,s=document.createDocumentFragment();for(let e=0;e<r.length;e++){const t=l.cloneNode(!0);t.style.display="",t.id=o.id+"_"+e,t.classList.add("smart-for-item"),t.classList.add("smart-for-item-"+o.id),t.removeAttribute("smart-for"),s.appendChild(t)}l.style.display="none",a?o.parentNode.insertBefore(s,o.nextSibling):o.appendChild(s);let c=t._appRoot.querySelectorAll(".smart-for-item-"+o.id);for(let e=0;e<c.length;e++){const n=c[e];t._addAttributeBindings(n,i+"."+e+".")}}e&&n.length>0&&t.render()}notify(e){const t=this;t.notifyFn=function(n){n.owner=t,e(n)}}_notify(e){const t=this;if("length"===e.propertyName)return;t.notifyFn&&t.notifyFn(e);let n=e.propertyName;e.object&&(n=e.object.propertyName);for(let e in t.template){const o=t.template[e];let i=null;for(let e in o.bind)if("function"!=typeof o.bind[e]&&o.bind[e].indexOf(n)>=0){i=e;break}i&&t._setPropertyFromData(o,i)}t._renderForBindings(!0)}_observeData(){const e=this;e._data=new window.Smart.Observable(e._data),e._data.canNotify=!1,e._data.notify(e._notify.bind(e));const t=function(n){n.canNotify=!1;for(let o in n){if("function"==typeof n[o]){n[o]=n[o].bind(n);continue}if(o.startsWith("_")||"notifyFn"===o||"canNotify"===o||"name"===o)continue;const i=n[o];Array.isArray(i)?(n[o]=new window.Smart.ObservableArray(n[o]),n[o].canNotify=!1,n[o].notify(e._notify.bind(e)),n[o].canNotify=!0,n[o].propertyName=o):i&&"object"==typeof i&&i.constructor===window.Smart.DataAdapter||i&&"object"==typeof i&&i instanceof Date?n[o].propertyName=o:i&&"object"==typeof i&&(n[o]=new window.Smart.Observable(n[o]),n[o].canNotify=!1,n[o].notify(e._notify.bind(e)),n[o].canNotify=!0,n[o].propertyName=o,t(n[o]))}n.canNotify=!0};for(let n in e._data){if("function"==typeof e._data[n]){e._data[n]=e._data[n].bind(e._data);continue}if(n.startsWith("_")||"notifyFn"===n||"canNotify"===n||"name"===n)continue;const o=e._data[n];Array.isArray(o)?(e._data[n]=new window.Smart.ObservableArray(e._data[n]),e._data[n].canNotify=!1,e._data[n].notify(e._notify.bind(e)),e._data[n].canNotify=!0,e._data[n].propertyName=n):"object"==typeof o&&o.constructor===window.Smart.DataAdapter||"object"==typeof o&&o instanceof Date?e._data[n].propertyName=n:"object"==typeof o&&(e._data[n]=new window.Smart.Observable(e._data[n]),e._data[n].canNotify=!1,e._data[n].notify(e._notify.bind(e)),e._data[n].canNotify=!0,e._data[n].propertyName=n,t(e._data[n]))}e._data.canNotify=!0}_setPropertyFromData(e,t){const n=this;if(e.element.__updating||!e.bind)return;const o=e.bind[t];if("function"==typeof o)return;const i=o?o.split("."):[];let r=n._data;for(let e=0;e<i.length;e++){const t=i[e];if("string"==typeof r)break;if(void 0===r[t]){r=void 0;break}r=r[t]}if(e.bind.computed){const t={item:e,name:o,value:r};e.bind.computed(t),t.value!==r&&(r=t.value)}if(e.element.__updatingProperties=!0,o&&void 0!==r){if("observableArray"===r.name)"checkbox"===e.element.type?e.element[t]=r.indexOf(e.element.value)>=0:e.element[t]=r.toArray().slice(0);else if("observable"===r.name){const n=function(e){let t=null;for(let i in e){if("function"==typeof e[i])continue;if(i.startsWith("_")||"notifyFn"===i||"canNotify"===i||"name"===i)continue;const r=e[i];if(void 0!==r&&!(r&&Array.isArray(r)||r&&"object"==typeof r&&r.constructor===window.Smart.DataAdapter)){if(r&&"object"==typeof r&&(t=n(e[i])),i===o){t=r;break}if(t)return t}}return t},i=n(r);e.element[t]=i||r}else"radio"===e.element.type?e.element.value===r?e.element[t]=!0:e.element[t]=!1:e.element[t]=r;n._components[e.selector]&&!n._components[e.selector].rendered&&(n._components[e.selector].properties[t]=r)}else e.properties&&(e.element[t]=e.properties[t],n._components[e.selector]&&!n._components[e.selector].rendered&&(n._components[e.selector].properties[t]=e.properties[t]));e.element.__updatingProperties=!1}render(){const e=this;for(let t in e.template){const n=e.template[t],o=n.element?n.element:document.querySelector(t),i=n.properties,r=n.listeners,a=n.bind;if(!o)continue;n.selector=t,n.element=o,o._properties||(o._properties=[]);for(let t in i){const i=o._properties?o._properties[t]:null;i&&(i.notify=!0),e._setPropertyFromData(n,t)}for(let t in a){const i=o._properties?o._properties[t]:null;i&&(i.notify=!0),e._setPropertyFromData(n,t)}if(e._components&&e._components[t]&&!1===e._components[t].rendered){const o=e._components[t];n.element=o.instance=new window[o.name](t,o.properties),o.rendered=!0}const d=function(t){const o=n.element;for(let n in r)o.$||(o.$=window.Smart.Utilities.Extend(o)),o.$[t](n,(function(t){const o=r[n];if(o.indexOf(".")>=0){const n=o.split(".");let i=e._data[n[0]];for(let e=1;e<n.length;e++)i=i[n[e]];void 0!==i&&i(t)}else e._data[o]&&e._data[o](t)}));for(let n in a){const i=o._properties?o._properties[n]:null;if(i){const r=function(t){if(o.__updatingProperties)return;o.__updating=!0;const i=function(e){if("radio"===o.type){const t=o.parentNode.querySelectorAll('[type="radio"]');for(let n=0;n<t.length;n++)t[n].__updating=e}};i(!0);const r=a[n];if("radio"===o.type||"toggle"===o.type||"checkbox"===o.type)e._updateDataFromBooleanElement(o,a);else{(function(e,t,n){var o;for(o=0;o<t.length-1;o++)e=e[t[o]];e[t[o]]=n})(e._data,r.split("."),t.detail.value)}o.__updating=!1,i(!1)};"textarea"===o.type&&o.$[t]("input.keyup",(function(e){const t=new CustomEvent("keyup",{detail:{originalEvent:e,value:o.$.input.value}});r(t)})),o.$[t](i.attributeName+"-changed",(function(e){r(e)}))}}};d("unlisten"),o.isAttached&&d("listen"),o.onAttached=function(){d("listen")},o.onDetached=function(){d("unlisten")}}}}window.Smart.App=n,window[e.toLowerCase()+"App"]=n,window.App=n})();