text: define(["exports"],function(_exports){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});_exports.toArray=toArray;_exports.log=log;_exports.logValue=logValue;_exports.ensureRoute=ensureRoute;_exports.ensureRoutes=ensureRoutes;_exports.loadBundle=loadBundle;_exports.fireRouterEvent=fireRouterEvent;_exports.isObject=isObject;_exports.isFunction=isFunction;_exports.isString=isString;_exports.getNotFoundError=getNotFoundError;_exports.notFoundResult=void 0;function toArray(objectOrArray){objectOrArray=objectOrArray||[];return Array.isArray(objectOrArray)?objectOrArray:[objectOrArray]}function log(msg){return"[Vaadin.Router] ".concat(msg)}function logValue(value){if("object"!==babelHelpers.typeof(value)){return value+""}var stringType=Object.prototype.toString.call(value).match(/ (.*)\]$/)[1];if("Object"===stringType||"Array"===stringType){return"".concat(stringType," ").concat(JSON.stringify(value))}else{return stringType}}var MODULE="module",NOMODULE="nomodule",bundleKeys=[MODULE,NOMODULE];function ensureBundle(src){if(!src.match(/.+\.[m]?js$/)){throw new Error(log("Unsupported type for bundle \"".concat(src,"\": .js or .mjs expected.")))}}function ensureRoute(route){if(!route||!isString(route.path)){throw new Error(log("Expected route config to be an object with a \"path\" string property, or an array of such objects"))}var bundle=route.bundle,stringKeys=["component","redirect","bundle"];if(!isFunction(route.action)&&!Array.isArray(route.children)&&!isFunction(route.children)&&!isObject(bundle)&&!stringKeys.some(function(key){return isString(route[key])})){throw new Error(log("Expected route config \"".concat(route.path,"\" to include either \"").concat(stringKeys.join("\", \""),"\" ")+"or \"action\" function but none found."))}if(bundle){if(isString(bundle)){ensureBundle(bundle)}else if(!bundleKeys.some(function(key){return key in bundle})){throw new Error(log("Expected route bundle to include either \""+NOMODULE+"\" or \""+MODULE+"\" keys, or both"))}else{bundleKeys.forEach(function(key){return key in bundle&&ensureBundle(bundle[key])})}}if(route.redirect){["bundle","component"].forEach(function(overriddenProp){if(overriddenProp in route){console.warn(log("Route config \"".concat(route.path,"\" has both \"redirect\" and \"").concat(overriddenProp,"\" properties, ")+"and \"redirect\" will always override the latter. Did you mean to only use \"".concat(overriddenProp,"\"?")))}})}}function ensureRoutes(routes){toArray(routes).forEach(function(route){return ensureRoute(route)})}function loadScript(src,key){var script=document.head.querySelector("script[src=\""+src+"\"][async]");if(!script){script=document.createElement("script");script.setAttribute("src",src);if(key===MODULE){script.setAttribute("type",MODULE)}else if(key===NOMODULE){script.setAttribute(NOMODULE,"")}script.async=!0}return new Promise(function(resolve,reject){script.onreadystatechange=script.onload=function(e){script.__dynamicImportLoaded=!0;resolve(e)};script.onerror=function(e){if(script.parentNode){script.parentNode.removeChild(script)}reject(e)};if(null===script.parentNode){document.head.appendChild(script)}else if(script.__dynamicImportLoaded){resolve()}})}function loadBundle(bundle){if(isString(bundle)){return loadScript(bundle)}else{return Promise.race(bundleKeys.filter(function(key){return key in bundle}).map(function(key){return loadScript(bundle[key],key)}))}}function fireRouterEvent(type,detail){return!window.dispatchEvent(new CustomEvent("vaadin-router-".concat(type),{cancelable:"go"===type,detail:detail}))}function isObject(o){// guard against null passing the typeof check
  return"object"===babelHelpers.typeof(o)&&!!o}function isFunction(f){return"function"===typeof f}function isString(s){return"string"===typeof s}function getNotFoundError(context){var error=new Error(log("Page not found (".concat(context.pathname,")")));error.context=context;error.code=404;return error}var notFoundResult=new function NotFoundResult(){babelHelpers.classCallCheck(this,NotFoundResult)};_exports.notFoundResult=notFoundResult});