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AI,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,GAAsB,CAAA;AAChF,CAAC,CAAA;AAED,OAAO,EACL,cAAc,IAAI,cAAc,EACjC,CAAA\",\"sourcesContent\":[\"'use strict'\\n\\nimport { ShadowFunction } from '../shadowFunction/index'\\nimport { getObjectType } from '../objectType/index'\\n\\nconst DOCUMENT = document\\nlet constructorId = 0\\n\\n// ShadowDocument\\nclass ShadowDocument {\\n  public run: Function = () => null\\n  private constructorId: number = 0\\n  private TREE: object\\n  private SHADOWTREE: object\\n  private o: number = 0\\n  private log: Function | undefined\\n  private sandbox: Sandbox\\n  private shadowWindow: ShadowWindow\\n  private shadowDocumentBody: HTMLElement\\n  private ShadowObject: ObjectConstructor\\n  private ShadowNode: Node\\n  private ShadowElement: Element\\n  private shadowFunction: any\\n  private shadowGetAttribute: Function\\n  private allowTagName = {\\n    'DIV': true,\\n    'B': true,\\n    'P': true,\\n    'H1': true,\\n    'H2': true,\\n    'H3': true,\\n    'H4': true,\\n    'H5': true,\\n    'DL': true,\\n    'DT': true,\\n    'DD': true,\\n    'EM': true,\\n    'HR': true,\\n    'UL': true,\\n    'LI': true,\\n    'OL': true,\\n    'TD': true,\\n    'TH': true,\\n    'TR': true,\\n    'TT': true,\\n    'NAV': true,\\n    'SUP': true,\\n    'SUB': true,\\n    'SPAN': true,\\n    'FONT': true,\\n    'BR': true,\\n    'STYLE': true,\\n    'SMALL': true,\\n    'LABEL': true,\\n    'TABLE': true,\\n    'TBODY': true,\\n    'THEAD': true,\\n    'TFOOT': true,\\n    'BUTTON': true,\\n    'FOOTER': true,\\n    'HEADER': true,\\n    'STRONG': true\\n  }\\n  private tracker = (e: object) => {\\n    if (typeof (this.log) === 'function') {\\n      this.log(e)\\n    } else {\\n      console.log('Event Log:', e)\\n    }\\n  }\\n\\n  constructor (root: any, template: string, setting = [{}, {}], log?: (e: object) => void) {\\n    this.TREE = {\\n      0: root.attachShadow ? root.attachShadow({ mode: 'open' }) : root\\n    }\\n    this.SHADOWTREE = {}\\n    Object.assign(this.allowTagName, setting[0] || setting)\\n    this.log = log\\n    this.constructorId = constructorId++\\n    this.shadowFunction = new ShadowFunction(setting[1] || {}, undefined, log)\\n    this.shadowFunction = this.shadowFunction(this.injection())(this.empowerment())\\n    this.sandbox = this.shadowFunction.sandbox\\n    this.shadowWindow = this.sandbox.shadowWindow\\n    this.shadowDocumentBody = this.shadowWindow.document.body\\n    this.ShadowObject = this.shadowWindow.Object\\n    this.ShadowNode = this.shadowWindow.Node\\n    this.ShadowElement = this.shadowWindow.Element\\n    this.shadowGetAttribute = this.ShadowElement['prototype'].getAttribute\\n\\n    this.setShadowObserver()\\n    this.write(template)\\n\\n    this.run = this.shadowFunction.run.bind(this)\\n  }\\n\\n  private getRealElement = (element: Element) => {\\n    return this.TREE[element['uuid']] as HTMLElement || new Error(`ShadowFunction: Cannot synchronously read compiled style. Async read after the rendering ends / or use '<HTMLElement>.oncomputed = () => { element.offsetTop }'！`)\\n  }\\n\\n  private empowerment () {\\n    return {\\n      getShadowElement: (element: Element) => {\\n        return this.getRealElement(element)\\n      },\\n      getShadowElementProps: (element: Element, propsName: string) => {\\n        return this.getRealElement(element)[propsName]\\n      },\\n      getComputedStyle: (element: Element, pseudoElt = null) => {\\n        return getComputedStyle(this.getRealElement(element), pseudoElt)\\n      },\\n      setShadowEventListener: (listener: string, type: string, callback: Function, opt: boolean | AddEventListenerOptions | undefined) => {\\n        let target: EventTarget | null = null\\n        let eventName = 'on-shadow-' + type + '-' + this.constructorId\\n        switch (listener) {\\n          case '[object Window]':\\n            target = window\\n            break\\n          case '[object HTMLDocument]':\\n            target = document\\n            break\\n          case '[object HTMLBodyElement]':\\n            target = document.body\\n            break\\n          case '[object HTMLHtmlElement]':\\n            target = document.documentElement\\n            break\\n        }\\n        if (!target) return\\n        if (!callback) return target.removeEventListener(type, target[eventName])\\n        Object.defineProperty(target, eventName, {\\n          enumerable: false,\\n          configurable: true,\\n          writable: false,\\n          value: (e: object) => {\\n            callback.apply(callback, [this.createShadowEventObject(e)])\\n          }\\n        })\\n\\n        target.addEventListener(type, target[eventName], opt)\\n      }\\n    }\\n  }\\n\\n  private isElementObject (value: any): boolean {\\n    if (/HTML(\\\\w+)?Element/.exec(getObjectType(value))) return true\\n    return false\\n  }\\n\\n  private createShadowEventObject (originEvent: object) {\\n    const target = {}\\n    for (let key in originEvent) {\\n      let value = originEvent[key]\\n      switch (typeof value) {\\n        case 'string':\\n        case 'number':\\n        case 'boolean':\\n        case 'undefined':\\n          target[key] = value\\n          break\\n        case 'function':\\n          target[key] = value.bind(originEvent)\\n          break\\n        case 'object':\\n          switch (key) {\\n            case 'changedTouches':\\n            case 'sourceCapabilities':\\n            case 'targetTouches':\\n            case 'touches':\\n              target[key] = this.createShadowEventObject(value)\\n              break\\n            case 'srcElement':\\n            case 'target':\\n            case 'toElement':\\n              if (this.isElementObject(value)) target[key] = this.SHADOWTREE[value.uuid]\\n              break\\n            default:\\n              if (!isNaN(Number(key))) {\\n                target[key] = this.createShadowEventObject(value)\\n              } else {\\n                target[key] = value\\n              }\\n              break\\n          }\\n          break\\n      }\\n    }\\n\\n    return target\\n  }\\n\\n  private injection () {\\n    return `\\n      window.addEventListener = EventTarget.prototype.addEventListener = function (type, callback, options) {\\n        var target = this\\n        var targetTypeName = Object.prototype.toString.call(target)\\n        if (!target['onShadowEventNames']) {\\n          Object.defineProperty(target, 'onShadowEventNames', {\\n            enumerable: false,\\n            configurable: true,\\n            writable: true,\\n            value: [type]\\n          })\\n        } else {\\n          target['onShadowEventNames'].push(type)\\n        }\\n        if (!target['onshadow' + type]) {\\n          Object.defineProperty(target, 'onshadow' + type, {\\n            enumerable: false,\\n            configurable: true,\\n            writable: true,\\n            value: {\\n              type: type,\\n              options: options,\\n              callback: [callback]\\n            }\\n          })\\n          setShadowEventListener(targetTypeName, type, function () {\\n            var args = arguments\\n            target['onshadow' + type].callback.map(function (fn) {\\n              fn.apply(target, args)\\n            })\\n          }, options)\\n        } else {\\n          target['onshadow' + type].callback.push(callback)\\n        }\\n      }\\n      window.removeEventListener = EventTarget.prototype.removeEventListener = function (type, callback, options) {\\n        var target = this\\n        var targetTypeName = Object.prototype.toString.call(target)\\n        var callbackIndex = this['onshadow' + type].callback.indexOf(callback)\\n        var eventNameIndex = this['onShadowEventNames'].indexOf(type)\\n        if (eventNameIndex !== -1) {\\n          this['onShadowEventNames'].splice(eventNameIndex, 1)\\n        }\\n        if (callbackIndex !== -1) {\\n          this['onshadow' + type].callback.splice(callbackIndex, 1)\\n        }\\n        if (this['onshadow' + type].callback.length === 0) {\\n          setShadowEventListener(targetTypeName, type)\\n        }\\n      }\\n      shadowWindow.Object.defineProperties(shadowWindow.HTMLElement.prototype, {\\n        'offsetHeight': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetHeight')\\n          }\\n        },\\n        'offsetWidth': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetWidth')\\n          }\\n        },\\n        'offsetTop': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetTop')\\n          }\\n        },\\n        'offsetLeft': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetLeft')\\n          }\\n        },\\n        'offsetParent': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetParent')\\n          }\\n        },\\n        'ref': {\\n          get () {\\n            return getShadowElement(this)\\n          }\\n        }\\n      })\\n    `\\n  }\\n\\n  private setShadowObserver () {\\n    new MutationObserver((records) => {\\n      for (let record of records) {\\n        let target = record.target\\n        switch (record.type) {\\n          case 'attributes':\\n            this.setAttribute(record.attributeName as string, target)\\n            break\\n          case 'characterData':\\n            this.setCharacterData(target)\\n            break\\n          case 'childList':\\n            Array.prototype.forEach.call(record.removedNodes, (node: Node) => {\\n              this.walker(this.iterator(node), target, true)\\n            })\\n            Array.prototype.forEach.call(record.addedNodes, (node: Node) => {\\n              this.walker(this.iterator(node), target)\\n            })\\n            break\\n        }\\n      }\\n    }).observe(this.shadowDocumentBody, {\\n      subtree: true,\\n      attributes: true,\\n      childList: true,\\n      characterData: true,\\n      attributeOldValue: true,\\n      characterDataOldValue: true\\n    })\\n  }\\n\\n  private write (template: string) {\\n    this.shadowDocumentBody.innerHTML = `<div>${template}</div>`\\n  }\\n\\n  private uuid (node: any, uuid?: number | string) {\\n    uuid = parseInt(node.parentNode ? node.parentNode.uuid || 0 : 0, 10)\\n    uuid++\\n    this.o++\\n    uuid = uuid + '.' + this.o\\n    if (!node.uuid) {\\n      this.ShadowObject.defineProperty(node, 'uuid', {\\n        configurable: false,\\n        enumerable: false,\\n        value: uuid\\n      })\\n      this.SHADOWTREE[uuid] = node\\n    }\\n    return uuid\\n  }\\n\\n  private iterator (nodes: any) {\\n    if (nodes.nextNode) return nodes\\n    return DOCUMENT.createNodeIterator(nodes, NodeFilter.SHOW_ALL, null)\\n  }\\n\\n  private walker (nodes: TreeWalker, target: Node, del = false) {\\n    let node = nodes.nextNode() as Element\\n    while (node) {\\n      this.uuid(node)\\n      switch (node.nodeType) {\\n        case Node.ELEMENT_NODE:\\n          if (del) {\\n            this.removeElement(node, target)\\n          } else {\\n            this.createElement(node, target)\\n          }\\n          break\\n        case Node.TEXT_NODE:\\n          if (del) {\\n            this.removeTextNode(node, target)\\n          } else {\\n            this.createTextNode(node, target)\\n          }\\n          break\\n      }\\n      node = nodes.nextNode() as Element\\n      if (!node) break\\n    }\\n  }\\n\\n  private getParentId (node: Node, target: Node) {\\n    return (node.parentNode ? node.parentNode['uuid'] : target['uuid']) || 0\\n  }\\n\\n  private createElement (node: Element, target: Node) {\\n    let uuid = node['uuid']\\n    let name = this.ShadowNode['prototype'].cloneNode.call(node).nodeName\\n    let puuid = this.getParentId(node, target)\\n\\n    if (this.TREE[uuid]) return\\n\\n    switch (name) {\\n      case this.allowTagName[name] ? name : null:\\n        this.TREE[uuid] = DOCUMENT.createElement(name)\\n        this.TREE[uuid].uuid = uuid\\n        break\\n      default:\\n        this.tracker({\\n          tagName: name,\\n          action: 'createElement'\\n        })\\n        throw new Error(`ShadowFunction: The tag name provided ('${name}') is not a valid name of whitelist.`)\\n    }\\n\\n    for (let i = 0; i < node.attributes.length; i++) {\\n      this.setAttribute(node.attributes[i].name, node)\\n    }\\n\\n    node['completedState'] = 'complete'\\n    this.TREE[puuid].appendChild(this.TREE[uuid])\\n    this.createEvent(node)\\n    this.shadowFunction.run(`\\n      typeof computed === 'function' && computed(el)\\n    `)({\\n      el: this.TREE[uuid],\\n      computed: node['oncomputed']\\n    })\\n  }\\n\\n  private removeElement (node: Node, target: Node) {\\n    let uuid = node['uuid']\\n    let puuid = this.getParentId(node, target)\\n\\n    if (this.TREE[puuid] && this.TREE[uuid]) {\\n      this.TREE[puuid].removeChild(this.TREE[uuid])\\n    }\\n    delete this.TREE[uuid]\\n  }\\n\\n  private createTextNode (node: Node, target: Node) {\\n    let uuid = node['uuid']\\n    let puuid = this.getParentId(node, target)\\n    let text = node.textContent || ''\\n\\n    if (this.TREE[uuid]) return\\n\\n    this.TREE[uuid] = DOCUMENT.createTextNode(text)\\n    this.TREE[uuid].uuid = uuid\\n    if (this.TREE[puuid]) {\\n      this.TREE[puuid].appendChild(this.TREE[uuid])\\n    }\\n  }\\n\\n  private removeTextNode (node: Node, target: Node) {\\n    let uuid = node['uuid']\\n    let puuid = this.getParentId(node, target)\\n\\n    if (this.TREE[puuid] && this.TREE[uuid]) {\\n      this.TREE[puuid].removeChild(this.TREE[uuid])\\n    }\\n    delete this.TREE[uuid]\\n  }\\n\\n  private createEvent (node: Node) {\\n    let onEvent = node['onShadowEventNames']\\n    if (!onEvent) return\\n    onEvent.map((type: string) => {\\n      let shadowEvent = node['onshadow' + type]\\n      if (shadowEvent) {\\n        this.TREE[node['uuid']].addEventListener(shadowEvent.type, (event: object) => {\\n          event = this.createShadowEventObject(event)\\n          this.shadowFunction.run(`\\n            for (let i = 0; i < events.length; i++) {\\n              typeof(events[i]) === 'function' && events[i].apply(node, args)\\n            }\\n          `)({ events: shadowEvent.callback.map((fn: Function) => fn.bind(node)), node, args: [event] })\\n        }, shadowEvent.options)\\n      }\\n    })\\n  }\\n\\n  private setAttribute (name: string, node: Node) {\\n    let whiteNode = this.TREE[node['uuid']]\\n    let shadowNode = this.ShadowNode['prototype'].cloneNode.call(node)\\n    let tagName = shadowNode.tagName\\n    let allow = this.allowTagName[tagName]\\n    let value = this.shadowGetAttribute.call(shadowNode, name)\\n    let safeAttr = false\\n\\n    if (!whiteNode) return\\n\\n    switch (name) {\\n      case 'id':\\n      case 'name':\\n      case 'style':\\n      case 'class':\\n      case 'width':\\n      case 'height':\\n        safeAttr = true\\n        break\\n      default:\\n        if (typeof(allow) === 'function' && allow(name, value)) {\\n          safeAttr = true\\n        } else {\\n          this.tracker({\\n            tagName,\\n            attributeName: name,\\n            action: 'setAttribute',\\n            value\\n          })\\n          throw new Error(`ShadowFunction: The attribute name provided ('${name} in <${tagName.toLocaleLowerCase()} />') is not a valid name of whitelist.`)\\n        }\\n        break\\n    }\\n\\n    if (whiteNode && safeAttr) whiteNode.setAttribute(name, value)\\n  }\\n\\n  private setCharacterData (node: any) {\\n    let char = this.TREE[node.uuid]\\n    if (char) char.textContent = node.textContent\\n  }\\n}\\n\\nconst shadowDocument = (root: any, template: string, setting = [{}, {}], log?: (e: object) => void) => {\\n  return new ShadowDocument(root, template, setting, log).run as unknown as void\\n}\\n\\nexport {\\n  shadowDocument as ShadowDocument\\n}\\n\"]}","code":"'use strict';\r\nimport { ShadowFunction } from '../shadowFunction/index';\r\nimport { getObjectType } from '../objectType/index';\r\nvar DOCUMENT = document;\r\nvar constructorId = 0;\r\n// ShadowDocument\r\nvar ShadowDocument = /** @class */ (function () {\r\n    function ShadowDocument(root, template, setting, log) {\r\n        if (setting === void 0) { setting = [{}, {}]; }\r\n        var _this = this;\r\n        this.run = function () { return null; };\r\n        this.constructorId = 0;\r\n        this.o = 0;\r\n        this.allowTagName = {\r\n            'DIV': true,\r\n            'B': true,\r\n            'P': true,\r\n            'H1': true,\r\n            'H2': true,\r\n            'H3': true,\r\n            'H4': true,\r\n            'H5': true,\r\n            'DL': true,\r\n            'DT': true,\r\n            'DD': true,\r\n            'EM': true,\r\n            'HR': true,\r\n            'UL': true,\r\n            'LI': true,\r\n            'OL': true,\r\n            'TD': true,\r\n            'TH': true,\r\n            'TR': true,\r\n            'TT': true,\r\n            'NAV': true,\r\n            'SUP': true,\r\n            'SUB': true,\r\n            'SPAN': true,\r\n            'FONT': true,\r\n            'BR': true,\r\n            'STYLE': true,\r\n            'SMALL': true,\r\n            'LABEL': true,\r\n            'TABLE': true,\r\n            'TBODY': true,\r\n            'THEAD': true,\r\n            'TFOOT': true,\r\n            'BUTTON': true,\r\n            'FOOTER': true,\r\n            'HEADER': true,\r\n            'STRONG': true\r\n        };\r\n        this.tracker = function (e) {\r\n            if (typeof (_this.log) === 'function') {\r\n                _this.log(e);\r\n            }\r\n            else {\r\n                console.log('Event Log:', e);\r\n            }\r\n        };\r\n        this.getRealElement = function (element) {\r\n            return _this.TREE[element['uuid']] || new Error(\"ShadowFunction: Cannot synchronously read compiled style. Async read after the rendering ends / or use '<HTMLElement>.oncomputed = () => { element.offsetTop }'\\uFF01\");\r\n        };\r\n        this.TREE = {\r\n            0: root.attachShadow ? root.attachShadow({ mode: 'open' }) : root\r\n        };\r\n        this.SHADOWTREE = {};\r\n        Object.assign(this.allowTagName, setting[0] || setting);\r\n        this.log = log;\r\n        this.constructorId = constructorId++;\r\n        this.shadowFunction = new ShadowFunction(setting[1] || {}, undefined, log);\r\n        this.shadowFunction = this.shadowFunction(this.injection())(this.empowerment());\r\n        this.sandbox = this.shadowFunction.sandbox;\r\n        this.shadowWindow = this.sandbox.shadowWindow;\r\n        this.shadowDocumentBody = this.shadowWindow.document.body;\r\n        this.ShadowObject = this.shadowWindow.Object;\r\n        this.ShadowNode = this.shadowWindow.Node;\r\n        this.ShadowElement = this.shadowWindow.Element;\r\n        this.shadowGetAttribute = this.ShadowElement['prototype'].getAttribute;\r\n        this.setShadowObserver();\r\n        this.write(template);\r\n        this.run = this.shadowFunction.run.bind(this);\r\n    }\r\n    ShadowDocument.prototype.empowerment = function () {\r\n        var _this = this;\r\n        return {\r\n            getShadowElement: function (element) {\r\n                return _this.getRealElement(element);\r\n            },\r\n            getShadowElementProps: function (element, propsName) {\r\n                return _this.getRealElement(element)[propsName];\r\n            },\r\n            getComputedStyle: function (element, pseudoElt) {\r\n                if (pseudoElt === void 0) { pseudoElt = null; }\r\n                return getComputedStyle(_this.getRealElement(element), pseudoElt);\r\n            },\r\n            setShadowEventListener: function (listener, type, callback, opt) {\r\n                var target = null;\r\n                var eventName = 'on-shadow-' + type + '-' + _this.constructorId;\r\n                switch (listener) {\r\n                    case '[object Window]':\r\n                        target = window;\r\n                        break;\r\n                    case '[object HTMLDocument]':\r\n                        target = document;\r\n                        break;\r\n                    case '[object HTMLBodyElement]':\r\n                        target = document.body;\r\n                        break;\r\n                    case '[object HTMLHtmlElement]':\r\n                        target = document.documentElement;\r\n                        break;\r\n                }\r\n                if (!target)\r\n                    return;\r\n                if (!callback)\r\n                    return target.removeEventListener(type, target[eventName]);\r\n                Object.defineProperty(target, eventName, {\r\n                    enumerable: false,\r\n                    configurable: true,\r\n                    writable: false,\r\n                    value: function (e) {\r\n                        callback.apply(callback, [_this.createShadowEventObject(e)]);\r\n                    }\r\n                });\r\n                target.addEventListener(type, target[eventName], opt);\r\n            }\r\n        };\r\n    };\r\n    ShadowDocument.prototype.isElementObject = function (value) {\r\n        if (/HTML(\\w+)?Element/.exec(getObjectType(value)))\r\n            return true;\r\n        return false;\r\n    };\r\n    ShadowDocument.prototype.createShadowEventObject = function (originEvent) {\r\n        var target = {};\r\n        for (var key in originEvent) {\r\n            var value = originEvent[key];\r\n            switch (typeof value) {\r\n                case 'string':\r\n                case 'number':\r\n                case 'boolean':\r\n                case 'undefined':\r\n                    target[key] = value;\r\n                    break;\r\n                case 'function':\r\n                    target[key] = value.bind(originEvent);\r\n                    break;\r\n                case 'object':\r\n                    switch (key) {\r\n                        case 'changedTouches':\r\n                        case 'sourceCapabilities':\r\n                        case 'targetTouches':\r\n                        case 'touches':\r\n                            target[key] = this.createShadowEventObject(value);\r\n                            break;\r\n                        case 'srcElement':\r\n                        case 'target':\r\n                        case 'toElement':\r\n                            if (this.isElementObject(value))\r\n                                target[key] = this.SHADOWTREE[value.uuid];\r\n                            break;\r\n                        default:\r\n                            if (!isNaN(Number(key))) {\r\n                                target[key] = this.createShadowEventObject(value);\r\n                            }\r\n                            else {\r\n                                target[key] = value;\r\n                            }\r\n                            break;\r\n                    }\r\n                    break;\r\n            }\r\n        }\r\n        return target;\r\n    };\r\n    ShadowDocument.prototype.injection = function () {\r\n        return \"\\n      window.addEventListener = EventTarget.prototype.addEventListener = function (type, callback, options) {\\n        var target = this\\n        var targetTypeName = Object.prototype.toString.call(target)\\n        if (!target['onShadowEventNames']) {\\n          Object.defineProperty(target, 'onShadowEventNames', {\\n            enumerable: false,\\n            configurable: true,\\n            writable: true,\\n            value: [type]\\n          })\\n        } else {\\n          target['onShadowEventNames'].push(type)\\n        }\\n        if (!target['onshadow' + type]) {\\n          Object.defineProperty(target, 'onshadow' + type, {\\n            enumerable: false,\\n            configurable: true,\\n            writable: true,\\n            value: {\\n              type: type,\\n              options: options,\\n              callback: [callback]\\n            }\\n          })\\n          setShadowEventListener(targetTypeName, type, function () {\\n            var args = arguments\\n            target['onshadow' + type].callback.map(function (fn) {\\n              fn.apply(target, args)\\n            })\\n          }, options)\\n        } else {\\n          target['onshadow' + type].callback.push(callback)\\n        }\\n      }\\n      window.removeEventListener = EventTarget.prototype.removeEventListener = function (type, callback, options) {\\n        var target = this\\n        var targetTypeName = Object.prototype.toString.call(target)\\n        var callbackIndex = this['onshadow' + type].callback.indexOf(callback)\\n        var eventNameIndex = this['onShadowEventNames'].indexOf(type)\\n        if (eventNameIndex !== -1) {\\n          this['onShadowEventNames'].splice(eventNameIndex, 1)\\n        }\\n        if (callbackIndex !== -1) {\\n          this['onshadow' + type].callback.splice(callbackIndex, 1)\\n        }\\n        if (this['onshadow' + type].callback.length === 0) {\\n          setShadowEventListener(targetTypeName, type)\\n        }\\n      }\\n      shadowWindow.Object.defineProperties(shadowWindow.HTMLElement.prototype, {\\n        'offsetHeight': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetHeight')\\n          }\\n        },\\n        'offsetWidth': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetWidth')\\n          }\\n        },\\n        'offsetTop': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetTop')\\n          }\\n        },\\n        'offsetLeft': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetLeft')\\n          }\\n        },\\n        'offsetParent': {\\n          get () {\\n            return getShadowElementProps(this, 'offsetParent')\\n          }\\n        },\\n        'ref': {\\n          get () {\\n            return getShadowElement(this)\\n          }\\n        }\\n      })\\n    \";\r\n    };\r\n    ShadowDocument.prototype.setShadowObserver = function () {\r\n        var _this = this;\r\n        new MutationObserver(function (records) {\r\n            var _loop_1 = function (record) {\r\n                var target = record.target;\r\n                switch (record.type) {\r\n                    case 'attributes':\r\n                        _this.setAttribute(record.attributeName, target);\r\n                        break;\r\n                    case 'characterData':\r\n                        _this.setCharacterData(target);\r\n                        break;\r\n                    case 'childList':\r\n                        Array.prototype.forEach.call(record.removedNodes, function (node) {\r\n                            _this.walker(_this.iterator(node), target, true);\r\n                        });\r\n                        Array.prototype.forEach.call(record.addedNodes, function (node) {\r\n                            _this.walker(_this.iterator(node), target);\r\n                        });\r\n                        break;\r\n                }\r\n            };\r\n            for (var _i = 0, records_1 = records; _i < records_1.length; _i++) {\r\n                var record = records_1[_i];\r\n                _loop_1(record);\r\n            }\r\n        }).observe(this.shadowDocumentBody, {\r\n            subtree: true,\r\n            attributes: true,\r\n            childList: true,\r\n            characterData: true,\r\n            attributeOldValue: true,\r\n            characterDataOldValue: true\r\n        });\r\n    };\r\n    ShadowDocument.prototype.write = function (template) {\r\n        this.shadowDocumentBody.innerHTML = \"<div>\" + template + \"</div>\";\r\n    };\r\n    ShadowDocument.prototype.uuid = function (node, uuid) {\r\n        uuid = parseInt(node.parentNode ? node.parentNode.uuid || 0 : 0, 10);\r\n        uuid++;\r\n        this.o++;\r\n        uuid = uuid + '.' + this.o;\r\n        if (!node.uuid) {\r\n            this.ShadowObject.defineProperty(node, 'uuid', {\r\n                configurable: false,\r\n                enumerable: false,\r\n                value: uuid\r\n            });\r\n            this.SHADOWTREE[uuid] = node;\r\n        }\r\n        return uuid;\r\n    };\r\n    ShadowDocument.prototype.iterator = function (nodes) {\r\n        if (nodes.nextNode)\r\n            return nodes;\r\n        return DOCUMENT.createNodeIterator(nodes, NodeFilter.SHOW_ALL, null);\r\n    };\r\n    ShadowDocument.prototype.walker = function (nodes, target, del) {\r\n        if (del === void 0) { del = false; }\r\n        var node = nodes.nextNode();\r\n        while (node) {\r\n            this.uuid(node);\r\n            switch (node.nodeType) {\r\n                case Node.ELEMENT_NODE:\r\n                    if (del) {\r\n                        this.removeElement(node, target);\r\n                    }\r\n                    else {\r\n                        this.createElement(node, target);\r\n                    }\r\n                    break;\r\n                case Node.TEXT_NODE:\r\n                    if (del) {\r\n                        this.removeTextNode(node, target);\r\n                    }\r\n                    else {\r\n                        this.createTextNode(node, target);\r\n                    }\r\n                    break;\r\n            }\r\n            node = nodes.nextNode();\r\n            if (!node)\r\n                break;\r\n        }\r\n    };\r\n    ShadowDocument.prototype.getParentId = function (node, target) {\r\n        return (node.parentNode ? node.parentNode['uuid'] : target['uuid']) || 0;\r\n    };\r\n    ShadowDocument.prototype.createElement = function (node, target) {\r\n        var uuid = node['uuid'];\r\n        var name = this.ShadowNode['prototype'].cloneNode.call(node).nodeName;\r\n        var puuid = this.getParentId(node, target);\r\n        if (this.TREE[uuid])\r\n            return;\r\n        switch (name) {\r\n            case this.allowTagName[name] ? name : null:\r\n                this.TREE[uuid] = DOCUMENT.createElement(name);\r\n                this.TREE[uuid].uuid = uuid;\r\n                break;\r\n            default:\r\n                this.tracker({\r\n                    tagName: name,\r\n                    action: 'createElement'\r\n                });\r\n                throw new Error(\"ShadowFunction: The tag name provided ('\" + name + \"') is not a valid name of whitelist.\");\r\n        }\r\n        for (var i = 0; i < node.attributes.length; i++) {\r\n            this.setAttribute(node.attributes[i].name, node);\r\n        }\r\n        node['completedState'] = 'complete';\r\n        this.TREE[puuid].appendChild(this.TREE[uuid]);\r\n        this.createEvent(node);\r\n        this.shadowFunction.run(\"\\n      typeof computed === 'function' && computed(el)\\n    \")({\r\n            el: this.TREE[uuid],\r\n            computed: node['oncomputed']\r\n        });\r\n    };\r\n    ShadowDocument.prototype.removeElement = function (node, target) {\r\n        var uuid = node['uuid'];\r\n        var puuid = this.getParentId(node, target);\r\n        if (this.TREE[puuid] && this.TREE[uuid]) {\r\n            this.TREE[puuid].removeChild(this.TREE[uuid]);\r\n        }\r\n        delete this.TREE[uuid];\r\n    };\r\n    ShadowDocument.prototype.createTextNode = function (node, target) {\r\n        var uuid = node['uuid'];\r\n        var puuid = this.getParentId(node, target);\r\n        var text = node.textContent || '';\r\n        if (this.TREE[uuid])\r\n            return;\r\n        this.TREE[uuid] = DOCUMENT.createTextNode(text);\r\n        this.TREE[uuid].uuid = uuid;\r\n        if (this.TREE[puuid]) {\r\n            this.TREE[puuid].appendChild(this.TREE[uuid]);\r\n        }\r\n    };\r\n    ShadowDocument.prototype.removeTextNode = function (node, target) {\r\n        var uuid = node['uuid'];\r\n        var puuid = this.getParentId(node, target);\r\n        if (this.TREE[puuid] && this.TREE[uuid]) {\r\n            this.TREE[puuid].removeChild(this.TREE[uuid]);\r\n        }\r\n        delete this.TREE[uuid];\r\n    };\r\n    ShadowDocument.prototype.createEvent = function (node) {\r\n        var _this = this;\r\n        var onEvent = node['onShadowEventNames'];\r\n        if (!onEvent)\r\n            return;\r\n        onEvent.map(function (type) {\r\n            var shadowEvent = node['onshadow' + type];\r\n            if (shadowEvent) {\r\n                _this.TREE[node['uuid']].addEventListener(shadowEvent.type, function (event) {\r\n                    event = _this.createShadowEventObject(event);\r\n                    _this.shadowFunction.run(\"\\n            for (let i = 0; i < events.length; i++) {\\n              typeof(events[i]) === 'function' && events[i].apply(node, args)\\n            }\\n          \")({ events: shadowEvent.callback.map(function (fn) { return fn.bind(node); }), node: node, args: [event] });\r\n                }, shadowEvent.options);\r\n            }\r\n        });\r\n    };\r\n    ShadowDocument.prototype.setAttribute = function (name, node) {\r\n        var whiteNode = this.TREE[node['uuid']];\r\n        var shadowNode = this.ShadowNode['prototype'].cloneNode.call(node);\r\n        var tagName = shadowNode.tagName;\r\n        var allow = this.allowTagName[tagName];\r\n        var value = this.shadowGetAttribute.call(shadowNode, name);\r\n        var safeAttr = false;\r\n        if (!whiteNode)\r\n            return;\r\n        switch (name) {\r\n            case 'id':\r\n            case 'name':\r\n            case 'style':\r\n            case 'class':\r\n            case 'width':\r\n            case 'height':\r\n                safeAttr = true;\r\n                break;\r\n            default:\r\n                if (typeof (allow) === 'function' && allow(name, value)) {\r\n                    safeAttr = true;\r\n                }\r\n                else {\r\n                    this.tracker({\r\n                        tagName: tagName,\r\n                        attributeName: name,\r\n                        action: 'setAttribute',\r\n                        value: value\r\n                    });\r\n                    throw new Error(\"ShadowFunction: The attribute name provided ('\" + name + \" in <\" + tagName.toLocaleLowerCase() + \" />') is not a valid name of whitelist.\");\r\n                }\r\n                break;\r\n        }\r\n        if (whiteNode && safeAttr)\r\n            whiteNode.setAttribute(name, value);\r\n    };\r\n    ShadowDocument.prototype.setCharacterData = function (node) {\r\n        var char = this.TREE[node.uuid];\r\n        if (char)\r\n            char.textContent = node.textContent;\r\n    };\r\n    return ShadowDocument;\r\n}());\r\nvar shadowDocument = function (root, template, setting, log) {\r\n    if (setting === void 0) { setting = [{}, {}]; }\r\n    return new ShadowDocument(root, template, setting, log).run;\r\n};\r\nexport { shadowDocument as ShadowDocument };\r\n//# sourceMappingURL=index.js.map","dts":{"name":"/Users/ioing/libdev/shadow-function/dist/typings/shadowDocument/index.d.ts","writeByteOrderMark":false,"text":"declare const shadowDocument: (root: any, template: string, setting?: {}[], log?: ((e: object) => void) | undefined) => void;\r\nexport { shadowDocument as ShadowDocument };\r\n"}}
