/* snabbdom module extension used to register Messages as event listeners
542935
function updateEventListeners(oldVnode, vnode) {
  const oldEvents = oldVnode.data.events
  const events = vnode.data.events

  if (!events) return

  const listeners = oldEvents ? oldEvents.listeners : {}
  events.listeners = listeners

  for (name in events) {
    const message = events[name]
    const oldMessage = oldEvents && oldEvents[name]

    if (message && message !== oldMessage) {

      if (oldMessage && isSameMessageAndPayload(message, oldMessage)) continue

      if (listeners[name])
        vnode.elm.removeEventListener(name, listeners[name])

      listeners[name] = evt => _sendToElement(evt.currentTarget, message(evt))
      vnode.elm.addEventListener(name, listeners[name])
    }
  }

  if (!oldEvents) return

  for (name in oldEvents) {
    if (events[name] === undefined)
      vnode.elm.removeEventListener(name, listeners[name])
  }
}
867243
function createTag(impl, conf, innerHTML) {
      if ( impl === void 0 ) impl = {};
      if ( conf === void 0 ) conf = {};

      var tag = conf.context || {};
      var opts = extend({}, conf.opts);
      var parent = conf.parent;
      var isLoop = conf.isLoop;
      var isAnonymous = !!conf.isAnonymous;
      var skipAnonymous = settings.skipAnonymousTags && isAnonymous;
      var item = conf.item;
      // available only for the looped nodes
      var index = conf.index;
      // All attributes on the Tag when it's first parsed
      var instAttrs = [];
      // expressions on this type of Tag
      var implAttrs = [];
      var expressions = [];
      var root = conf.root;
      var tagName = conf.tagName || getName(root);
      var isVirtual = tagName === 'virtual';
      var isInline = !isVirtual && !impl.tmpl;
      var dom;

      // make this tag observable
      if (!skipAnonymous) { observable(tag); }
      // only call unmount if we have a valid __TAG_IMPL (has name property)
      if (impl.name && root._tag) { root._tag.unmount(true); }

      // not yet mounted
      define(tag, 'isMounted', false);

      define(tag, '__', {
        impl: impl,
        root: root,
        skipAnonymous: skipAnonymous,
        implAttrs: implAttrs,
        isAnonymous: isAnonymous,
        instAttrs: instAttrs,
        innerHTML: innerHTML,
        tagName: tagName,
        index: index,
        isLoop: isLoop,
        isInline: isInline,
        item: item,
        parent: parent,
        // tags having event listeners
        // it would be better to use weak maps here but we can not introduce breaking changes now
        listeners: [],
        // these vars will be needed only for the virtual tags
        virts: [],
        wasCreated: false,
        tail: null,
        head: null
      });

      // create a unique id to this tag
      // it could be handy to use it also to improve the virtual dom rendering speed
      define(tag, '_riot_id', uid()); // base 1 allows test !t._riot_id
      define(tag, 'root', root);
      extend(tag, { opts: opts }, item);
      // protect the "tags" and "refs" property from being overridden
      define(tag, 'parent', parent || null);
      define(tag, 'tags', {});
      define(tag, 'refs', {});

      if (isInline || isLoop && isAnonymous) {
        dom = root;
      } else {
        if (!isVirtual) { root.innerHTML = ''; }
        dom = mkdom(impl.tmpl, innerHTML, isSvg(root));
      }

      define(tag, 'update', function (data) { return componentUpdate(tag, data, expressions); });
      define(tag, 'mixin', function () {
        var mixins = [], len = arguments.length;
        while ( len-- ) mixins[ len ] = arguments[ len ];

        return componentMixin.apply(void 0, [ tag ].concat( mixins ));
      });
      define(tag, 'mount', function () { return componentMount(tag, dom, expressions, opts); });
      define(tag, 'unmount', function (mustKeepRoot) { return tagUnmount(tag, mustKeepRoot, expressions); });

      return tag
    }
955588
function modAddDefinedListener( id, listener, lowPriority ) {
        if ( modIsDefined( id ) ) {
            listener( id );
            return;
        }

        var listeners = modDefinedListener[ id ];
        if ( !listeners ) {
            listeners = modDefinedListener[ id ] = [];
        }

        lowPriority
            ? listeners.unshift( listener )
            : listeners.push( listener );
    }
1175400
function cacheAndNotify(tag, s, propName) {
        if (! tag.hasOwnProperty(propName)) {
            Object.defineProperty(tag, propName, {
                enumerable: true, value: s
            });
        }
        tag.emit('discover', tag[propName]);
    }
706507
function(moduleId) {
		var scriptEl = document.createElement('script');
		scriptEl.type = 'text/javascript';
		scriptEl.src = resolveModuleUri(moduleId);

		var useStandard = !!scriptEl.addEventListener,
			timeoutHandle;

		var errorFunc = function() {
			postLoadFunc(false);
		};

		var loadFunc = function() {
			if (useStandard || (scriptEl.readyState == 'complete' || scriptEl.readyState == 'loaded')) {
				postLoadFunc(getModule(moduleId).defined);
			}
		};

		var postLoadFunc = function(loaded) {
			clearTimeout(timeoutHandle);

			if (useStandard) {
				scriptEl.removeEventListener('load', loadFunc, false);
				scriptEl.removeEventListener('error', errorFunc, false);
			}
			else {
				scriptEl.detachEvent('onreadystatechange', loadFunc);
			}

			if (!loaded) {
				var module = getModule(moduleId);
				if (!module.defined) {
					module.defined = module.error = true;
					fireCallbacks();
				}
			}
		};

		if (useStandard) {
			scriptEl.addEventListener('load', loadFunc, false);
			scriptEl.addEventListener('error', errorFunc, false);
		}
		else {
			scriptEl.attachEvent('onreadystatechange', loadFunc);
		}

		timeoutHandle = setTimeout(errorFunc, _timeoutLength);

		head.appendChild(scriptEl);
	}
307923
def event_handler(msg: EventMsgDict) -> Event:
    """"""
    e = create_event_from_msg(msg)
    if e.currentTarget is None:
        if e.type not in ['mount', 'unmount']:
            id = msg['currentTarget']['id']
            logger.warning('No such element: wdom_id={}'.format(id))
        return e
    e.currentTarget.on_event_pre(e)
    e.currentTarget.dispatchEvent(e)
    return e
1094563
function endOfSnapshot(itemName) {
		var message, id = getIdFromItemName(itemName);
		message = proto.writeEndOfSnapshot(id, itemName);
		notify(message);
		return that;
	}
800655
function log(...messages) {
  console.log(...messages);
  const p = document.createElement('p');
  p.innerText = messages.join(' ');
  logElement.appendChild(p);
}
72220
function registerCurrentItemEvents (params) {
          // Destructuring:
          var item = params.item;
          var $ul = params.$ul;
          var $li = params.$li;
          var $scope = params.$scope;
          var modelValue = params.modelValue;
          var level = params.level;
          var event = params.event;
          var text = params.text;
          var nestedMenu = params.nestedMenu;
          var enabled = params.enabled;
          var orientation = String(params.orientation).toLowerCase();
          var customClass = params.customClass;

          if (enabled) {
            var openNestedMenu = function ($event) {
              removeContextMenus(level + 1);
              /*
               * The object here needs to be constructed and filled with data
               * on an "as needed" basis. Copying the data from event directly
               * or cloning the event results in unpredictable behavior.
               */
              /// adding the original event in the object to use the attributes of the mouse over event in the promises
              var ev = {
                pageX: orientation === 'left' ? event.pageX - $ul[0].offsetWidth + 1 : event.pageX + $ul[0].offsetWidth - 1,
                pageY: $ul[0].offsetTop + $li[0].offsetTop - 3,
                // eslint-disable-next-line angular/window-service
                view: event.view || window,
                target: event.target,
                event: $event
              };

              /*
               * At this point, nestedMenu can only either be an Array or a promise.
               * Regardless, passing them to `when` makes the implementation singular.
               */
              $q.when(nestedMenu).then(function(promisedNestedMenu) {
                if (angular.isFunction(promisedNestedMenu)) {
                  //  support for dynamic subitems
                  promisedNestedMenu = promisedNestedMenu.call($scope, $scope, event, modelValue, text, $li);
                }
                var nestedParam = {
                  $scope : $scope,
                  event : ev,
                  options : promisedNestedMenu,
                  modelValue : modelValue,
                  level : level + 1,
                  orientation: orientation,
                  customClass: customClass
                };
                renderContextMenu(nestedParam);
              });
            };

            $li.on('click', function ($event) {
              if($event.which == 1) {
                $event.preventDefault();
                $scope.$apply(function () {

                  var cleanupFunction = function () {
                    $(event.currentTarget).removeClass('context');
                    removeAllContextMenus();
                  };
                  var clickFunction = angular.isFunction(item.click)
                    ? item.click
                    : (angular.isFunction(item[1])
                      ? item[1]
                      : null);

                  if (clickFunction) {
                    var res = clickFunction.call($scope, $scope, event, modelValue, text, $li);
                    if(res === undefined || res) {
                      cleanupFunction();
                    }
                  } else {
                    cleanupFunction();
                  }
                });
              }
            });

            $li.on('mouseover', function ($event) {
              $scope.$apply(function () {
                if (nestedMenu) {
                  openNestedMenu($event);
                } else {
                  removeContextMenus(level + 1);
                }
              });
            });
          } else {
            setElementDisabled($li);
          }
        }
1092234
function(ndefMessageAsString) {
    "use strict";
    var ndefMessage = JSON.parse(ndefMessageAsString);
    cordova.fireDocumentEvent("ndef", {
        type: "ndef",
        tag: {
            ndefMessage: ndefMessage
        }
    });
}
1091513
function MessageEvent (type, eventInitDict) {
  Object.defineProperty(this, 'type', { writable: false, value: type, enumerable: true })
  for (var f in eventInitDict) {
    if (eventInitDict.hasOwnProperty(f)) {
      Object.defineProperty(this, f, { writable: false, value: eventInitDict[f], enumerable: true })
    }
  }
}
375133
function _onGetDocument(event, res) {
        Inspector.DOMDebugger.setDOMBreakpoint(res.root.nodeId, "subtree-modified");
        _load.resolve();
    }
91582
function VKI_addListener(elem, type, func, cap) {
    if (elem.addEventListener) {
      elem.addEventListener(type, function(e) { func.call(elem, e); }, cap);
    } else if (elem.attachEvent)
      elem.attachEvent('on' + type, function() { func.call(elem); });
  }
495242
function($el) {
    // Reaction to socket.io messages
    $myelements.socket.on("message", function onMessage(message) {
      if ($el.data().templateScope === message.event) {
        // Update element scope (maybe re-render)
        var scope = {};
        scope[message.event] = message.data;
        $myelements.updateElementScope($el.get(0), scope);
      }

      // we forward socket.io's message as a jQuery event on the $el.
      $myelements.debug("forwarding backend message '%s' as jQuery event '%s' to element %s with data: %j", message.event, message.event, $el.get(0), message.data);
      // Kludge: If jQuery's trigger received an array as second parameters
      // it assumes you're trying to send multiple parameters to the event handlers,
      // so we enclose message.data in another array if message.data is an array
      // sent from the backend 
      if ($.isArray(message.data)) {
        $el.trigger(message.event, [message.data]);
      } else {
        $el.trigger(message.event, message.data);
      }
    });
    // Reaction on local events triggered on the element by jQuery
    $el.on("message", function onElementMessageEvent(jQueryEvent, message) {
      if (message.event === undefined || message.data === undefined) {
        $myelements.debug("event key or data not present in second argument to trigger()", message.event, message.data);
        console.error("myelements.jquery: $.fn.trigger('message') must be called with an object having the keys 'event' and 'data' as second argument.  ");
        return;
      }
      $myelements.debug("Sending message '%s' to backend with data: %j", message.event, message.data);
      $myelements.socket.send(message);
    });
  }
1131587
private void injectTagsToEvent(GobblinTrackingEvent event) {
    Map<String, String> originalMetadata = event.getMetadata();
    Map<String, Object> tags = getTagMap();
    Map<String, String> newMetadata = Maps.newHashMap();
    for(Map.Entry<String, Object> entry : tags.entrySet()) {
      newMetadata.put(entry.getKey(), entry.getValue().toString());
    }
    newMetadata.putAll(originalMetadata);
    event.setMetadata(newMetadata);
  }
924907
function registerDeclarativeRoutes(app, config, routes, serviceLoader, auth, logger) {

    _.forEach(_.keys(routes), function (routePath) {
        //routePath should be of form "<method> path"
        var parts = _.split(routePath, ' ');
        if (parts.length !== 2) {
            return logger.warn('Invalid route path "%s"', routePath);
        }

        var methods = ['get', 'post', 'put', 'delete', 'all'];

        if (!_.includes(methods, parts[0])) {
            return logger.warn('Invalid method "%s" on route "%s"', parts[0], parts[1]);
        }

        var handler = routes[routePath].handler;
        if (!handler) {
            return logger.warn('Missing handler for route "%s"', parts[1]);
        }

        //handler is something like foo.bar where there's a foo.js handler module which exports bar
        var handlerParts = _.split(handler, '.');

        if (handlerParts.length !== 2) {
            return logger.warn('Invalid handler reference "%s"', parts[1]);
        }

        var handlerMod = serviceLoader.getConsumer('handlers', handlerParts[0]);
        if (!handlerMod) {
            return logger.warn('Could not find handler module named "%s".', handlerParts[0]);
        }

        var handlerFunc = handlerMod[handlerParts[1]];
        if (!handlerFunc) {
            return logger.warn('Could not find handler function "%s" for module "%s"',
                handlerParts[1], handlerParts[0]);
        }

        //Some other projects have defined their own auth scheme.
        //As a temporary workaround, we ignore auth if the auth field is using their scheme,
        //which is an object instead of a string or array.
        var middleware = [];
        if (routes[routePath].auth && !_.isPlainObject(routes[routePath].auth)) {
            middleware = auth.getAuthMiddleware(routes[routePath].auth);
        } else if (!routes[routePath].auth) { //at least set up global auth if it's available
            middleware = auth.getAuthMiddleware();
        } else {
            logger.debug('Ignoring auth');
        }

        //Set up custom validator function on the route
        if (routes[routePath].validate) {
            logger.warn('Using experimental validators.  This might change in the future.');
            var expression = routes[routePath].validate;
            middleware.push(auth.validate(expression));
        }

        middleware.push(handlerFunc);

        //register the route and handler function with express
        app[parts[0]].call(app, parts[1], middleware);
    });

}
814031
function(parentModule, kbox, id, app, callback) {

  if (typeof callback === 'undefined' && typeof app === 'function') {
    callback = app;
    app = undefined;
  }

  // Try to load module from node_module directories.
  return requireFromNodeModules(parentModule, id)
  // If module was not found in node_module directories, try to load
  // from other directories.
  .then(function(mod) {
    if (mod) {
      return mod;
    } else {
      return requireFromOtherDirs(kbox, id, app);
    }
  })
  // Return.
  .nodeify(callback);

}