OpenC3/cosmos

View on GitHub
openc3-cosmos-init/plugins/openc3-tool-base/public/js/import-map-overrides-3.1.1.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/* import-map-overrides@3.1.1 */
!function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){l(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e,t,n){return c=d()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o},c.apply(null,arguments)}function p(e){var t="function"==typeof Map?new Map:void 0;return p=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return c(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)},p(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){var t=d();return function(){var n,r=u(e);if(t){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}(this,n)}}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,l,a=[],u=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return a}}(e,t)||h(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function b(e,t){if(Array.isArray(e)){for(var r=0;r<e.length;r++)if(e[r]===t)return!0;return!1}if("string"==typeof e)return e.indexOf(t)>=0;throw Error("Can't call includes on ".concat(n(e)))}var y,w="import-map-override:",x="import-map-overrides-disabled",k="import-map-overrides-external-maps",M="data-is-importmap-override",O="import-map-overrides-domains",E="allowlist:",N="denylist:",S=document.querySelector('meta[name="importmap-type"]'),C=document.querySelector('meta[name="'.concat(O,'"]')),U={},I=S?S.getAttribute("content"):"importmap";if(C){var P=C.getAttribute("content");P||console.warn("Invalid ".concat(O," meta element - content required."));var j=function(e){return new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e).replace("\\*",".+")).test(window.location.hostname)};0===P.indexOf(E)?y=!P.slice(10).split(",").some(j):0===P.indexOf(N)?y=P.slice(9).split(",").some(j):console.log("Invalid ".concat(O," meta content attribute - must start with ").concat(E," or ").concat(N))}else y=!1;function D(e,t){return Object.entries(e).reduce((function(e,n){var r=v(n,2),o=r[0],i=r[1];return e[o]=function(e,t){try{return new URL(e,t).href}catch(t){return e}}(i,t),e}),{})}(function(){try{return localStorage.getItem("test"),!0}catch(e){return!1}})()||(console.warn("Disabling import-map-overrides, since local storage is not readable"),y=!0),y||function(){var e,t=!!S&&S.hasAttribute("server-cookie"),n=!!S&&S.hasAttribute("server-only");window.importMapOverrides={addOverride:function(e,n){/^\d+$/g.test(n)&&(n=r.getUrlFromPort(e,n));var o=w+e;return localStorage.setItem(o,n),t&&(document.cookie="".concat(o,"=").concat(n)),i(),r.getOverrideMap()},getOverrideMap:function(){for(var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t={imports:{},scopes:{}},n=r.getDisabledOverrides(),o=function(r,o){!e&&n.indexOf(r)>=0||(t.imports[r]=o)},i=0;i<localStorage.length;i++){var l=localStorage.key(i);0===l.indexOf(w)&&o(l.slice(20),localStorage.getItem(l))}var a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.href;e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}("imo",window.location!=window.parent.location?document.referrer:window.location.href);if(a){var u;try{u=JSON.parse(a)}catch(e){throw Error("Invalid importMap query param - text content must be json")}Object.keys(u.imports).forEach((function(e){o(e,u.imports[e])}))}return t},removeOverride:function(e){var n=w+e,o=null!==localStorage.getItem(n);return localStorage.removeItem(n),t&&(document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;")),r.enableOverride(e),i(),o},resetOverrides:function(){return Object.keys(r.getOverrideMap(!0).imports).forEach((function(e){r.removeOverride(e)})),localStorage.removeItem(x),localStorage.removeItem(k),i(),r.getOverrideMap()},hasOverrides:function(){return Object.keys(r.getOverrideMap().imports).length>0},getUrlFromPort:function(e,t){var n=e.replace(/@/g,"").replace(/\//g,"-");return"//localhost:".concat(t,"/").concat(n,".js")},enableUI:function(){var e="import-map-overrides-full",t="show-when-local-storage",n=document.querySelector(e);n||((n=document.createElement(e)).setAttribute(t,"true"),document.body.appendChild(n));var r=n.getAttribute(t);r&&(localStorage.setItem(r,!0),n.renderWithPreact())},mergeImportMap:function(e,t){var n={imports:{},scopes:{}};for(var r in e.imports)n.imports[r]=e.imports[r];for(var o in t.imports)n.imports[o]=t.imports[o];for(var i in e.scopes)n.scopes[i]=e.scopes[i];for(var l in t.scopes)n.scopes[l]=t.scopes[l];return n},getDefaultMap:function(){return e||(e=Array.prototype.reduce.call(document.querySelectorAll('script[type="'.concat(I,'"], script[type="overridable-importmap"]')),(function(e,t){return t.hasAttribute(M)?e:(n=t.src?f(t.src):Promise.resolve(JSON.parse(t.textContent)),Promise.all([e,n]).then((function(e){var t=v(e,2),n=t[0],o=t[1];return r.mergeImportMap(n,o)})));var n}),Promise.resolve({imports:{},scopes:{}})))},getCurrentPageMap:function(){return Promise.all([r.getDefaultMap(),r.getExternalOverrideMap(r.getCurrentPageExternalOverrides())]).then((function(e){var t=v(e,2),n=t[0],o=t[1];return r.mergeImportMap(r.mergeImportMap(n,o),u)}))},getCurrentPageExternalOverrides:function(){var e=[];return document.querySelectorAll("[".concat(M,']:not([id="import-map-overrides"])')).forEach((function(t){e.push(t.src)})),e},getNextPageMap:function(){return Promise.all([r.getDefaultMap(),r.getExternalOverrideMap()]).then((function(e){var t=v(e,2),n=t[0],o=t[1];return r.mergeImportMap(r.mergeImportMap(n,o),r.getOverrideMap())}))},disableOverride:function(e){var t=r.getDisabledOverrides();return!b(t,e)&&(localStorage.setItem(x,JSON.stringify(t.concat(e))),i(),!0)},enableOverride:function(e){var t=r.getDisabledOverrides(),n=t.indexOf(e);return n>=0&&(t.splice(n,1),localStorage.setItem(x,JSON.stringify(t)),i(),!0)},getDisabledOverrides:function(){var e=localStorage.getItem(x);return e?JSON.parse(e):[]},isDisabled:function(e){return b(r.getDisabledOverrides(),e)},getExternalOverrides:function(){var e=localStorage.getItem(k);return e?JSON.parse(e).sort():[]},addExternalOverride:function(e){e=new URL(e,document.baseURI).href;var t=r.getExternalOverrides();return!b(t,e)&&(localStorage.setItem(k,JSON.stringify(t.concat(e))),i(),!0)},removeExternalOverride:function(e){var t=r.getExternalOverrides();return!!b(t,e)&&(localStorage.setItem(k,JSON.stringify(t.filter((function(t){return t!==e})))),i(),!0)},getExternalOverrideMap:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.getExternalOverrides()).reduce((function(e,t){var n=U[t]||(U[t]=f(t));return Promise.all([e,n]).then((function(e){var t=v(e,2),n=t[0],o=t[1];return r.mergeImportMap(n,o)}))}),Promise.resolve({imports:{},scopes:{}}))},isExternalMapValid:function(e){return(U[e]||(U[e]=f(e))).then((function(){return!b(r.invalidExternalMaps,e)}))},invalidExternalMaps:[]};var r=window.importMapOverrides,o=!0;try{CustomEvent?new CustomEvent("a"):o=!1}catch(e){o=!1}function i(){l("change")}function l(e){setTimeout((function(){var t="import-map-overrides:".concat(e),n=o?new CustomEvent(t):document.createEvent("CustomEvent");o||n.initCustomEvent(t,!0,!0,null),window.dispatchEvent(n)}))}var a,u=r.getOverrideMap(),s=r.getExternalOverrides();if(!n){var d=document.querySelector('script[type="overridable-importmap"]');if(!(a=d)){var c=document.querySelectorAll('script[type="'.concat(I,'"]'));a=c?c[c.length-1]:null}if(d){if(d.src)throw Error('import-map-overrides: external import maps with type="overridable-importmap" are not supported');var p;try{p=JSON.parse(d.textContent)}catch(e){throw Error('Invalid <script type="overridable-importmap"> - text content must be json')}a=m(r.mergeImportMap(p,u),"import-map-overrides",a),h()}else h(),Object.keys(u.imports).length>0&&(a=m(u,"import-map-overrides",a))}function m(e,t,n){var r=document.createElement("script");return r.type=I,r.id=t,r.setAttribute(M,""),"string"==typeof e?r.src=e:r.textContent=JSON.stringify(e,null,2),n?n.insertAdjacentElement("afterend",r):document.head.appendChild(r),r}function f(e){return fetch(e).then((function(e){return e.ok?e.json().catch((function(t){return console.warn(Error("External override import map contained invalid json, at url ".concat(e.url,". ").concat(t))),r.invalidExternalMaps.push(e.url),{imports:{},scopes:{}}})):(console.warn(Error("Unable to download external override import map from url ".concat(e.url,". Server responded with status ").concat(e.status))),r.invalidExternalMaps.push(e.url),{imports:{},scopes:{}})}),(function(){return console.warn(Error("Unable to download external import map at url '".concat(e,"'"))),r.invalidExternalMaps.push(new URL(e,document.baseURI).href),{imports:{},scopes:{}}})).then((function(t){return function(e,t){return{imports:D(e.imports||{},t),scopes:Object.keys(e.scopes||{}).reduce((function(n,r){return n[r]=D(e.scopes[r],t),n}),{})}}(t,e)}))}function h(){s.length>0&&s.forEach((function(e,t){a=m(e,"import-map-overrides-external-".concat(t))}))}l("init")}();var A=".imo-unstyled {\n  border: none;\n  padding: 0;\n  width: auto;\n  overflow: visible;\n  background: transparent;\n  color: inherit;\n  font: inherit;\n  line-height: normal;\n  cursor: pointer;\n  -webkit-font-smoothing: inherit;\n  -moz-osx-font-smoothing: inherit;\n  -webkit-appearance: none;\n}\n\n.imo-unstyled::-moz-focus-inner {\n  border: 0;\n  padding: 0;\n}\n\n.imo-trigger {\n  position: fixed;\n  margin: 10px;\n  border-radius: 5px;\n  background-color: navajowhite;\n  height: 50px;\n  width: 50px;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  font-size: 18px;\n  font-family: sans-serif;\n  z-index: 10500;\n}\n\n.imo-trigger-bottom-right {\n  bottom: 0;\n  right: 0;\n}\n\n.imo-trigger-bottom-left {\n  bottom: 0;\n  left: 0;\n}\n\n.imo-trigger-top-right {\n  top: 0;\n  right: 0;\n}\n\n.imo-trigger-top-left {\n  top: 0;\n  left: 0;\n}\n\n.imo-popup {\n  box-sizing: border-box;\n  position: fixed;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  height: 50%;\n  z-index: 10000;\n  background-color: black;\n  color: white;\n  font-family: sans-serif;\n  padding: 24px;\n  overflow-y: auto;\n}\n\n.imo-popup a:visited,\n.imo-popup a {\n  color: white;\n}\n\n.imo-popup .imo-module-dialog {\n  left: calc(50% - 200px);\n}\n\n.imo-header {\n  display: flex;\n  justify-content: space-between;\n  align-items: flex-start;\n}\n\n.imo-list {\n  margin-left: 16px;\n}\n\n.imo-list > *:not(:last-child) {\n  margin-bottom: 8px;\n}\n\n.imo-list-container *,\n.imo-modal-container * {\n  font-family: sans-serif;\n  box-sizing: border-box;\n}\n\n.imo-module-dialog {\n  position: fixed;\n  z-index: 30000000;\n  top: 30%;\n  max-width: 600px;\n  margin: 0 auto;\n  border: 4px solid navajowhite;\n  background-color: white;\n  padding: 1em;\n  left: 50%;\n  right: auto;\n  transform: translateX(-50%);\n}\n\n.imo-module-dialog input {\n  width: 100%;\n  font-size: 16px;\n  box-sizing: border-box;\n  padding-right: 20px;\n}\n\n.imo-module-dialog table {\n  margin-bottom: 16px;\n}\n\n.imo-module-dialog table td:first-child {\n  text-align: right;\n  padding-right: 16px;\n  word-break: keep-all;\n}\n\n.imo-module-dialog table td {\n  word-break: break-all;\n}\n\n.imo-module-dialog.imo-overridden {\n  border: 4px solid salmon;\n}\n\n.imo-table-header-actions {\n  display: flex;\n  align-items: center;\n}\n\n.imo-overrides-table {\n  border-collapse: collapse;\n  margin-top: 32px;\n}\n\n.imo-overrides-table tr td:first-child {\n  display: flex;\n  align-items: center;\n  padding-right: 32px;\n  position: relative;\n}\n\n.imo-needs-refresh {\n  position: absolute;\n  right: 8px;\n  width: 20px;\n  height: 20px;\n  /* base64 encoded 27F2 svg */\n  background-image: url(\"data:image/svg+xml;charset=utf8,%3Csvg width='261' height='216' xmlns='http://www.w3.org/2000/svg' stroke='%23ffffff' stroke-linecap='square' stroke-miterlimit='10' shape-rendering='auto' stroke-opacity='1' fill='%23ffffff' stroke-dasharray='none' stroke-width='1' stroke-linejoin='miter' stroke-dashoffset='0'%3E%3Cg%3E%3Cpath fill='%23ffffff' d='m152.5625,214.0625q-27.5625,0 -49.6406,-11.8125q-22.0781,-11.8125 -34.7344,-28.4062l12.6563,-11.5313q10.6874,15.1875 31.0781,25.0313q20.3906,9.8437 40.6406,9.8437q21.375,0 44.1563,-11.5313q22.7812,-11.5312 34.3124,-34.3124q11.5313,-22.7813 11.5313,-44.1563q0,-21.375 -11.5313,-44.1563q-11.5312,-22.7812 -34.3124,-34.3124q-22.7813,-11.5313 -44.1563,-11.5313q-19.9687,0 -39.6563,9.1406q-19.6874,9.1407 -30.9374,24.1875q-11.25,15.0469 -16.7344,35.7188l42.3281,-34.7344l-54,91.6875l-54,-91.6875l47.25,38.8125q3.9375,-24.4687 17.4375,-44.5781q13.5,-20.1094 36.9844,-32.7656q23.4844,-12.6563 51.3281,-12.6563q29.25,0 54,14.0625q24.75,14.0625 38.8125,38.8125q14.0625,24.75 14.0625,54q0,29.25 -14.0625,54q-14.0625,24.75 -38.8125,38.8125q-24.75,14.0625 -54,14.0625z' /%3E%3C/g%3E%3C/svg%3E\");\n  background-size: contain;\n  background-repeat: no-repeat;\n  background-position: center;\n}\n\n.imo-status {\n  height: 16px;\n  width: 16px;\n  border-radius: 8px;\n  border: 1px solid white;\n  margin-right: 8px;\n}\n\n.imo-disabled-override {\n  background-color: lightblue;\n}\n\n.imo-next-override {\n  background-color: darkred;\n}\n\n.imo-current-override {\n  background-color: salmon;\n}\n\n.imo-default-module {\n  background-color: lightgoldenrodyellow;\n}\n\n.imo-external-override {\n  background-color: orange;\n}\n\n.imo-next-default {\n  background-color: darkgoldenrod;\n}\n\n.imo-dev-lib-override {\n  background-color: lightpink;\n}\n\n.imo-overrides-table tbody tr:hover {\n  cursor: pointer;\n  background-color: #404040;\n}\n\n.imo-overrides-table td,\n.imo-overrides-table th {\n  line-height: 18px;\n  padding: 16px;\n  border: 1px solid white;\n}\n\n.imo-add-new {\n  margin-left: 16px;\n}\n\n.imo-add-new button {\n  color: black;\n}\n\n.imo-clear-input {\n  position: absolute;\n  top: 0;\n  right: 4px;\n  cursor: pointer;\n  display: flex;\n  align-items: center;\n  height: 100%;\n}\n\n.imo-modal-container {\n  font-family: sans-serif;\n}\n\n.imo-modal {\n  background-color: rgba(61, 70, 77, 0.6);\n  position: fixed;\n  width: 100vw;\n  height: 100vh;\n  top: 0;\n  left: 0;\n  z-index: 20000000;\n}\n\n.imo-list-search,\n.imo-list-container button,\n.imo-modal-container button {\n  font-size: 14px;\n  height: 27px;\n  line-height: 27px;\n}\n\n.imo-list-search {\n  line-height: 22px;\n  border: none;\n  padding: 5px;\n  color: black;\n}\n";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(A);var R,L,q,T,F,W,z={},J=[],$=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function B(e,t){for(var n in t)e[n]=t[n];return e}function V(e){var t=e.parentNode;t&&t.removeChild(e)}function H(e,t,n){var r,o,i,l={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:l[i]=t[i];if(arguments.length>2&&(l.children=arguments.length>3?R.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===l[i]&&(l[i]=e.defaultProps[i]);return G(e,l,r,o,null)}function G(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++q:o};return null!=L.vnode&&L.vnode(i),i}function X(e){return e.children}function K(e,t){this.props=e,this.context=t}function Q(e,t){if(null==t)return e.__?Q(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Q(e):null}function Y(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return Y(e)}}function Z(e){(!e.__d&&(e.__d=!0)&&T.push(e)&&!ee.__r++||W!==L.debounceRendering)&&((W=L.debounceRendering)||F)(ee)}function ee(){for(var e;ee.__r=T.length;)e=T.sort((function(e,t){return e.__v.__b-t.__v.__b})),T=[],e.some((function(e){var t,n,r,o,i,l;e.__d&&(i=(o=(t=e).__v).__e,(l=t.__P)&&(n=[],(r=B({},o)).__v=o.__v+1,ue(l,o,r,t.__n,void 0!==l.ownerSVGElement,null!=o.__h?[i]:null,n,null==i?Q(o):i,o.__h),se(n,o),o.__e!=i&&Y(o)))}))}function te(e,t,n,r,o,i,l,a,u,s){var d,c,p,m,f,v,h,g=r&&r.__k||J,_=g.length;for(n.__k=[],d=0;d<t.length;d++)if(null!=(m=n.__k[d]=null==(m=t[d])||"boolean"==typeof m?null:"string"==typeof m||"number"==typeof m||"bigint"==typeof m?G(null,m,null,null,m):Array.isArray(m)?G(X,{children:m},null,null,null):m.__b>0?G(m.type,m.props,m.key,null,m.__v):m)){if(m.__=n,m.__b=n.__b+1,null===(p=g[d])||p&&m.key==p.key&&m.type===p.type)g[d]=void 0;else for(c=0;c<_;c++){if((p=g[c])&&m.key==p.key&&m.type===p.type){g[c]=void 0;break}p=null}ue(e,m,p=p||z,o,i,l,a,u,s),f=m.__e,(c=m.ref)&&p.ref!=c&&(h||(h=[]),p.ref&&h.push(p.ref,null,m),h.push(c,m.__c||f,m)),null!=f?(null==v&&(v=f),"function"==typeof m.type&&null!=m.__k&&m.__k===p.__k?m.__d=u=ne(m,u,e):u=re(e,m,p,g,f,u),s||"option"!==n.type?"function"==typeof n.type&&(n.__d=u):e.value=""):u&&p.__e==u&&u.parentNode!=e&&(u=Q(p))}for(n.__e=v,d=_;d--;)null!=g[d]&&("function"==typeof n.type&&null!=g[d].__e&&g[d].__e==n.__d&&(n.__d=Q(r,d+1)),pe(g[d],g[d]));if(h)for(d=0;d<h.length;d++)ce(h[d],h[++d],h[++d])}function ne(e,t,n){var r,o;for(r=0;r<e.__k.length;r++)(o=e.__k[r])&&(o.__=e,t="function"==typeof o.type?ne(o,t,n):re(n,o,o,e.__k,o.__e,t));return t}function re(e,t,n,r,o,i){var l,a,u;if(void 0!==t.__d)l=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),l=null;else{for(a=i,u=0;(a=a.nextSibling)&&u<r.length;u+=2)if(a==o)break e;e.insertBefore(o,i),l=i}return void 0!==l?l:o.nextSibling}function oe(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||$.test(t)?n:n+"px"}function ie(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||oe(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||oe(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?ae:le,i):e.removeEventListener(t,i?ae:le,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null!=n&&(!1!==n||"a"===t[0]&&"r"===t[1])?e.setAttribute(t,n):e.removeAttribute(t))}}function le(e){this.l[e.type+!1](L.event?L.event(e):e)}function ae(e){this.l[e.type+!0](L.event?L.event(e):e)}function ue(e,t,n,r,o,i,l,a,u){var s,d,c,p,m,f,v,h,g,_,b,y=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(u=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(s=L.__b)&&s(t);try{e:if("function"==typeof y){if(h=t.props,g=(s=y.contextType)&&r[s.__c],_=s?g?g.props.value:s.__:r,n.__c?v=(d=t.__c=n.__c).__=d.__E:("prototype"in y&&y.prototype.render?t.__c=d=new y(h,_):(t.__c=d=new K(h,_),d.constructor=y,d.render=me),g&&g.sub(d),d.props=h,d.state||(d.state={}),d.context=_,d.__n=r,c=d.__d=!0,d.__h=[]),null==d.__s&&(d.__s=d.state),null!=y.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=B({},d.__s)),B(d.__s,y.getDerivedStateFromProps(h,d.__s))),p=d.props,m=d.state,c)null==y.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==y.getDerivedStateFromProps&&h!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(h,_),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(h,d.__s,_)||t.__v===n.__v){d.props=h,d.state=d.__s,t.__v!==n.__v&&(d.__d=!1),d.__v=t,t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),d.__h.length&&l.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(h,d.__s,_),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(p,m,f)}))}d.context=_,d.props=h,d.state=d.__s,(s=L.__r)&&s(t),d.__d=!1,d.__v=t,d.__P=e,s=d.render(d.props,d.state,d.context),d.state=d.__s,null!=d.getChildContext&&(r=B(B({},r),d.getChildContext())),c||null==d.getSnapshotBeforeUpdate||(f=d.getSnapshotBeforeUpdate(p,m)),b=null!=s&&s.type===X&&null==s.key?s.props.children:s,te(e,Array.isArray(b)?b:[b],t,n,r,o,i,l,a,u),d.base=t.__e,t.__h=null,d.__h.length&&l.push(d),v&&(d.__E=d.__=null),d.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=de(n.__e,t,n,r,o,i,l,u);(s=L.diffed)&&s(t)}catch(e){t.__v=null,(u||null!=i)&&(t.__e=a,t.__h=!!u,i[i.indexOf(a)]=null),L.__e(e,t,n)}}function se(e,t){L.__c&&L.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){L.__e(e,t.__v)}}))}function de(e,t,n,r,o,i,l,a){var u,s,d,c=n.props,p=t.props,m=t.type,f=0;if("svg"===m&&(o=!0),null!=i)for(;f<i.length;f++)if((u=i[f])&&(u===e||(m?u.localName==m:3==u.nodeType))){e=u,i[f]=null;break}if(null==e){if(null===m)return document.createTextNode(p);e=o?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,p.is&&p),i=null,a=!1}if(null===m)c===p||a&&e.data===p||(e.data=p);else{if(i=i&&R.call(e.childNodes),s=(c=n.props||z).dangerouslySetInnerHTML,d=p.dangerouslySetInnerHTML,!a){if(null!=i)for(c={},f=0;f<e.attributes.length;f++)c[e.attributes[f].name]=e.attributes[f].value;(d||s)&&(d&&(s&&d.__html==s.__html||d.__html===e.innerHTML)||(e.innerHTML=d&&d.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||ie(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||ie(e,i,t[i],n[i],r)}(e,p,c,o,a),d)t.__k=[];else if(f=t.props.children,te(e,Array.isArray(f)?f:[f],t,n,r,o&&"foreignObject"!==m,i,l,i?i[0]:n.__k&&Q(n,0),a),null!=i)for(f=i.length;f--;)null!=i[f]&&V(i[f]);a||("value"in p&&void 0!==(f=p.value)&&(f!==e.value||"progress"===m&&!f)&&ie(e,"value",f,c.value,!1),"checked"in p&&void 0!==(f=p.checked)&&f!==e.checked&&ie(e,"checked",f,c.checked,!1))}return e}function ce(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){L.__e(e,n)}}function pe(e,t,n){var r,o;if(L.unmount&&L.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ce(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){L.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&pe(r[o],t,"function"!=typeof e.type);n||null==e.__e||V(e.__e),e.__e=e.__d=void 0}function me(e,t,n){return this.constructor(e,n)}function fe(e,t,n){var r,o,i;L.__&&L.__(e,t),o=(r="function"==typeof n)?null:n&&n.__k||t.__k,i=[],ue(t,e=(!r&&n||t).__k=H(X,null,[e]),o||z,z,void 0!==t.ownerSVGElement,!r&&n?[n]:o?null:t.firstChild?R.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r),se(i,e)}R=J.slice,L={__e:function(e,t){for(var n,r,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},q=0,K.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=B({},this.state),"function"==typeof e&&(e=e(B({},n),this.props)),e&&B(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),Z(this))},K.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Z(this))},K.prototype.render=X,T=[],F="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ee.__r=0;var ve=function(e){a(n,e);var t=f(n);function n(){var e;r(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return l(m(e=t.call.apply(t,[this].concat(i))),"getInitialOverrideUrl",(function(){var t=new RegExp("//localhost:([0-9]+)/").exec(e.props.module.overrideUrl);return t&&e.props.module.overrideUrl===window.importMapOverrides.getUrlFromPort(e.props.module.moduleName,t[1])?t[1]:e.props.module.overrideUrl?e.props.module.overrideUrl:""})),l(m(e),"state",{overrideUrl:e.getInitialOverrideUrl(),moduleName:""}),l(m(e),"inputEl",null),l(m(e),"moduleNameEl",null),l(m(e),"handleInputRef",(function(t){e.inputEl=t})),l(m(e),"handleModuleNameRef",(function(t){e.moduleNameEl=t})),l(m(e),"dialogRef",(function(t){e.dialogEl=t})),l(m(e),"handleSubmit",(function(t){t.preventDefault(),e.props.module.moduleName&&window.importMapOverrides.isDisabled(e.props.module.moduleName)&&window.importMapOverrides.enableOverride(e.props.module.moduleName),e.props.module.isNew?e.props.addNewModule(e.state.moduleName,e.state.overrideUrl):e.props.updateModuleUrl(e.state.overrideUrl)})),l(m(e),"getDerivedUrl",(function(){var t=e.props.module.isNew?e.state.moduleName:e.props.module.moduleName;return he.test(e.state.overrideUrl)?window.importMapOverrides.getUrlFromPort(t,e.state.overrideUrl):e.state.overrideUrl})),l(m(e),"keyDown",(function(t){"Escape"===t.key&&(t.stopPropagation(),e.props.cancel())})),l(m(e),"focusFirstInput",(function(){(e.moduleNameEl||e.inputEl).select()})),l(m(e),"clearModuleName",(function(){e.setState({moduleName:""},(function(){e.focusFirstInput()}))})),l(m(e),"clearInput",(function(){e.setState({overrideUrl:""},(function(){e.focusFirstInput()}))})),e}return i(n,[{key:"componentDidMount",value:function(){this.focusFirstInput(),this.dialogEl.addEventListener("keydown",this.keyDown)}},{key:"componentDidUpdate",value:function(e,t){var n=this;this.props.module!==e.module&&this.setState({overrideUrl:this.props.module.overrideUrl||""},(function(){n.focusFirstInput()}))}},{key:"componentWillUnmount",value:function(){this.dialogEl.removeEventListener("keydown",this.keyDown)}},{key:"render",value:function(e){var t=this,n=e.module;return H("div",{className:"imo-modal-container"},H("div",{className:"imo-modal"}),H("dialog",{className:"imo-module-dialog ".concat(this.state.overrideUrl.length>0?"imo-overridden":"imo-default"),open:!0,ref:this.dialogRef},H("form",{method:"dialog",onSubmit:this.handleSubmit},H("h3",{style:{marginTop:0}},n.moduleName),H("table",null,H("tbody",null,!n.isNew&&H("tr",null,H("td",null,"Default URL:"),H("td",null,n.defaultUrl)),n.isNew&&H("tr",null,H("td",null,H("span",{id:"module-name-label"},"Module Name:")),H("td",{style:{position:"relative"}},H("input",{type:"text",tabIndex:1,value:this.state.moduleName,"aria-labelledby":"module-name-label",onInput:function(e){return t.setState({moduleName:e.target.value})},ref:this.handleModuleNameRef,required:!0}),H("div",{role:"button",tabIndex:3,className:"imo-clear-input",onClick:this.clearModuleName},H("div",null,"ⓧ")))),H("tr",null,H("td",null,H("span",{id:"override-url-label"},"Override URL:")),H("td",{style:{position:"relative"}},H("input",{ref:this.handleInputRef,type:"text",value:this.state.overrideUrl,"aria-labelledby":"override-url-label",tabIndex:2,onInput:function(e){return t.setState({overrideUrl:e.target.value})}}),H("div",{role:"button",tabIndex:4,className:"imo-clear-input",onClick:this.clearInput},H("div",null,"ⓧ")))),he.test(this.state.overrideUrl)&&H("tr",null,H("td",null,"Derived url:"),H("td",null,this.getDerivedUrl())))),H("div",{className:"imo-dialog-actions"},H("button",{type:"button",tabIndex:5,onClick:this.props.cancel,style:{marginRight:"16px"}},"Cancel"),this.props.module.overrideUrl&&!this.props.module.disabled&&H("button",{type:"button",onClick:function(){t.props.module.disabled?window.importMapOverrides.enableOverride(t.props.module.moduleName):window.importMapOverrides.disableOverride(t.props.module.moduleName),t.props.cancel()},tabIndex:6,style:{marginRight:"16px"}},this.props.module.disabled?"Enable":"Disable"," Override"),H("button",{type:"submit",tabIndex:7,className:this.state.overrideUrl?"imo-overridden":"imo-default"},this.state.overrideUrl?"Apply override":"Reset to default")))))}}]),n}(K),he=/^\d+$/,ge=function(e){a(n,e);var t=f(n);function n(){var e;r(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return l(m(e=t.call.apply(t,[this].concat(i))),"state",{url:e.props.dialogExternalMap.isNew?"":e.props.dialogExternalMap.url}),l(m(e),"inputEl",null),l(m(e),"handleSubmit",(function(t){t.preventDefault(),e.props.dialogExternalMap.isNew||window.importMapOverrides.removeExternalOverride(e.props.dialogExternalMap.url),e.state.url&&window.importMapOverrides.addExternalOverride(e.state.url),e.props.cancel()})),l(m(e),"keyDown",(function(t){"Escape"===t.key&&(t.stopPropagation(),e.props.cancel())})),e}return i(n,[{key:"componentDidMount",value:function(){this.inputEl.focus(),this.dialogEl.addEventListener("keydown",this.keyDown)}},{key:"componentWillUnmount",value:function(){this.dialogEl.removeEventListener("keydown",this.keyDown)}},{key:"render",value:function(){var e=this;return H("div",{className:"imo-modal-container"},H("div",{className:"imo-modal"}),H("dialog",{className:"imo-module-dialog",open:!0,ref:function(t){return e.dialogEl=t}},H("form",{method:"dialog",onSubmit:this.handleSubmit},H("h3",{style:{marginTop:0}},this.props.dialogExternalMap.isNew?"Add External Import Map":"Edit External Import Map"),H("div",{style:{marginBottom:"20px"}},H("label",{htmlFor:"external-importmap-url"},"URL to import map:"),H("span",{style:{position:"relative"}},H("input",{id:"external-importmap-url",type:"text",value:this.state.url,onInput:function(t){return e.setState({url:t.target.value})},ref:function(t){return e.inputEl=t},required:this.props.dialogExternalMap.isNew}),H("div",{role:"button",tabIndex:0,className:"imo-clear-input",onClick:function(){return e.setState({url:""})}},H("div",null,"ⓧ")))),H("div",{className:"imo-dialog-actions"},H("button",{type:"button",onClick:this.props.cancel,style:{marginRight:"16px"}},"Cancel"),H("button",{type:"submit",className:this.state.url?"imo-overridden":"imo-default"},this.state.url||this.props.dialogExternalMap.isNew?"Apply override":"Remove override")))))}}]),n}(K),_e=function(e){a(n,e);var t=f(n);function n(){return r(this,n),t.apply(this,arguments)}return i(n,[{key:"componentDidMount",value:function(){window.importMapOverrides.getCurrentPageMap().then(we)}},{key:"render",value:function(){return null}}]),n}(K),be=function(e){return e.replace(".min.js",".js")},ye={react:function(e){return e.replace("production.min","development")},"react-dom":function(e){return e.replace("production.min","development")},"single-spa":function(e){return e.replace("single-spa.min.js","single-spa.dev.js")},vue:be,"vue-router":be,"@angular/core":be,"@angular/common":be,"@angular/router":be,"@angular/platform-browser":be};function we(e){Object.keys(e.imports).filter((function(e){return ye[e]})).forEach((function(t){window.importMapOverrides.addOverride(t,ye[t](e.imports[t]))}))}var xe=function(e){a(o,e);var n=f(o);function o(){var e;r(this,o);for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];return l(m(e=n.call.apply(n,[this].concat(i))),"state",{notOverriddenMap:{imports:{}},currentPageMap:{imports:{}},nextPageMap:{imports:{}},dialogModule:null,dialogExternalMap:null,searchVal:""}),l(m(e),"reload",(function(e){e.stopPropagation(),window.location.reload()})),l(m(e),"cancel",(function(){e.setState({dialogModule:null,dialogExternalMap:null})})),l(m(e),"updateModuleUrl",(function(t){null===(t=t||null)?window.importMapOverrides.removeOverride(e.state.dialogModule.moduleName):window.importMapOverrides.addOverride(e.state.dialogModule.moduleName,t),e.setState({dialogModule:null})})),l(m(e),"doUpdate",(function(){e.forceUpdate(),window.importMapOverrides.getNextPageMap().then((function(t){e.setState({nextPageMap:t})}))})),l(m(e),"addNewModule",(function(t,n){t&&n&&window.importMapOverrides.addOverride(t,n),e.setState({dialogModule:null})})),l(m(e),"filterModuleNames",(function(t){return!(e.state.searchVal.trim().length>0)||b(t,e.state.searchVal)})),e}return i(o,[{key:"componentDidMount",value:function(){var e=this;window.importMapOverrides.getDefaultMap().then((function(t){e.setState({notOverriddenMap:t})})),window.importMapOverrides.getCurrentPageMap().then((function(t){e.setState({currentPageMap:t})})),window.importMapOverrides.getNextPageMap().then((function(t){e.setState({nextPageMap:t})})),window.addEventListener("import-map-overrides:change",this.doUpdate),this.inputRef.focus()}},{key:"componentWillUnmount",value:function(){window.removeEventListener("import-map-overrides:change",this.doUpdate)}},{key:"componentDidUpdate",value:function(e,t){!t.dialogModule&&this.state.dialogModule?(this.dialogContainer=document.createElement("div"),document.body.appendChild(this.dialogContainer),fe(H(ve,{module:this.state.dialogModule,cancel:this.cancel,updateModuleUrl:this.updateModuleUrl,addNewModule:this.addNewModule}),this.dialogContainer)):t.dialogModule&&!this.state.dialogModule&&(fe(null,this.dialogContainer),this.dialogContainer.remove(),delete this.dialogContainer),!t.dialogExternalMap&&this.state.dialogExternalMap?(this.dialogContainer=document.createElement("div"),document.body.appendChild(this.dialogContainer),fe(H(ge,{dialogExternalMap:this.state.dialogExternalMap,cancel:this.cancel}),this.dialogContainer)):t.dialogExternalMap&&!this.state.dialogExternalMap&&(fe(null,this.dialogContainer),this.dialogContainer.remove(),delete this.dialogContainer)}},{key:"render",value:function(){var e=this,n=[],r=[],o=[],i=[],l=[],a=[],u=[],s=window.importMapOverrides.getOverrideMap(!0).imports,d=Object.keys(this.state.notOverriddenMap.imports),c=window.importMapOverrides.getDisabledOverrides();d.filter(this.filterModuleNames).forEach((function(d){var p={moduleName:d,defaultUrl:e.state.notOverriddenMap.imports[d],overrideUrl:s[d],disabled:b(c,d)};p.disabled?o.push(p):s[d]?e.state.currentPageMap.imports[d]===s[d]?ye[d]&&ye[d](e.state.currentPageMap.imports[d])===s[d]?u.push(p):n.push(p):r.push(p):e.state.notOverriddenMap.imports[d]===e.state.currentPageMap.imports[d]?i.push(p):e.state.notOverriddenMap.imports[d]===e.state.nextPageMap.imports[d]?a.push(p):l.push(t(t({},p),{},{overrideUrl:e.state.currentPageMap.imports[d]}))})),Object.keys(s).filter(this.filterModuleNames).forEach((function(t){if(!b(d,t)){var i={moduleName:t,defaultUrl:null,overrideUrl:s[t],disabled:b(c,t)};i.disabled?o.push(i):e.state.currentPageMap.imports[t]===s[t]?n.push(i):r.push(i)}})),n.sort(ke),i.sort(ke),r.sort(ke);var p=function(){var e,t=window.importMapOverrides.getExternalOverrides(),n=window.importMapOverrides.getCurrentPageExternalOverrides(),r=[],o=[],i=[],l=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=h(e))){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){a=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(a)throw i}}}}(t);try{for(l.s();!(e=l.n()).done;){var a=e.value;b(window.importMapOverrides.invalidExternalMaps,a)?r.push(a):b(n,a)?o.push(a):i.push(a)}}catch(e){l.e(e)}finally{l.f()}return{brokenMaps:r,workingCurrentPageMaps:o,workingNextPageMaps:i}}(),m=p.brokenMaps,f=p.workingCurrentPageMaps,v=p.workingNextPageMaps;return H("div",{className:"imo-list-container"},H("div",{className:"imo-table-header-actions"},H("input",{className:"imo-list-search","aria-label":"Search modules",placeholder:"Search modules",value:this.state.searchVal,onInput:function(t){return e.setState({searchVal:t.target.value})},ref:function(t){return e.inputRef=t}}),H("div",{className:"imo-add-new"},H("button",{onClick:function(){return e.setState({dialogModule:{moduleName:"New module",isNew:!0}})}},"Add new module")),H("div",{className:"imo-add-new"},H("button",{onClick:function(){e.setState({dialogExternalMap:{url:"",isNew:!0}})}},"Add import map")),H("div",{className:"imo-add-new"},H("button",{onClick:function(){return window.importMapOverrides.resetOverrides()}},"Reset all overrides"))),H("table",{className:"imo-overrides-table"},H("thead",null,H("tr",null,H("th",null,"Module Status"),H("th",null,"Module Name"),H("th",null,"Domain"),H("th",null,"Filename"))),H("tbody",null,r.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogModule:t})},key:t.moduleName},H("td",{onClick:e.reload,role:"button",tabIndex:0},H("div",{className:"imo-status imo-next-override"}),H("div",null,"Inline Override"),H("div",{className:"imo-needs-refresh"})),H("td",null,t.moduleName),H("td",null,Oe(t)),H("td",null,Ee(t)))})),a.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogModule:t})},key:t.moduleName},H("td",{style:{position:"relative"}},H("div",{className:"imo-status imo-next-default"}),H("div",null,"Default"),H("div",{className:"imo-needs-refresh"})),H("td",null,t.moduleName),H("td",null,Oe(t)),H("td",null,Ee(t)))})),o.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogModule:t})},key:t.moduleName},H("td",null,H("div",{className:"imo-status imo-disabled-override"}),H("div",null,"Override disabled")),H("td",null,t.moduleName),H("td",null,Oe(t)),H("td",null,Ee(t)))})),n.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogModule:t})},key:t.moduleName},H("td",null,H("div",{className:"imo-status imo-current-override"}),H("div",null,"Inline Override")),H("td",null,t.moduleName),H("td",null,Oe(t)),H("td",null,Ee(t)))})),l.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogModule:t})},key:t.moduleName},H("td",null,H("div",{className:"imo-status imo-external-override"}),H("div",null,"External Override")),H("td",null,t.moduleName),H("td",null,Oe(t)),H("td",null,Ee(t)))})),u.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogModule:t})},key:t.moduleName,title:"Automatically use dev version of certain npm libs"},H("td",null,H("div",{className:"imo-status imo-dev-lib-override"}),H("div",null,"Dev Lib Override")),H("td",null,t.moduleName),H("td",null,Oe(t)),H("td",null,Ee(t)))})),i.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogModule:t})},key:t.moduleName},H("td",null,H("div",{className:"imo-status imo-default-module"}),H("div",null,"Default")),H("td",null,t.moduleName),H("td",null,Oe(t)),H("td",null,Ee(t)))})))),(m.length>0||f.length>0||v.length>0)&&H("table",{className:"imo-overrides-table"},H("thead",null,H("th",null,"Import Map Status"),H("th",null,"URL")),H("tbody",null,m.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogExternalMap:{isNew:!1,url:t}})},key:t},H("td",null,H("div",{className:"imo-status imo-disabled-override"}),H("div",null,"Invalid")),H("td",null,t))})),v.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogExternalMap:{isNew:!1,url:t}})},key:t},H("td",null,H("div",{className:"imo-status imo-next-override"}),H("div",null,"Pending refresh")),H("td",null,t))})),f.map((function(t){return H("tr",{role:"button",tabIndex:0,onClick:function(){return e.setState({dialogExternalMap:{isNew:!1,url:t}})},key:t},H("td",null,H("div",{className:"imo-status imo-current-override"}),H("div",null,"Override")),H("td",null,t))})))))}}]),o}(K);function ke(e,t){return e.moduleName>t.moduleName}var Me=document.querySelector("base")&&document.querySelector("base").href||location.origin+"/";function Oe(e){var t=Ne(e),n=Se(t);return n?n.host:t}function Ee(e){var t=Ne(e),n=Se(t);return n?n.pathname.slice(n.pathname.lastIndexOf("/")+1):t}function Ne(e){return e.overrideUrl||e.defaultUrl}function Se(e){try{return new URL(e,Me)}catch(e){return null}}var Ce=function(e){a(n,e);var t=f(n);function n(){var e;r(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return l(m(e=t.call.apply(t,[this].concat(i))),"doUpdate",(function(){return e.forceUpdate()})),l(m(e),"keydownListener",(function(t){"Escape"===t.key&&e.props.close&&e.props.close()})),e}return i(n,[{key:"componentDidMount",value:function(){window.addEventListener("keydown",this.keydownListener),window.addEventListener("import-map-overrides:change",this.doUpdate)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("keydown",this.keydownListener),window.removeEventListener("import-map-overrides:change",this.doUpdate)}},{key:"render",value:function(e){return H("div",{className:"imo-popup"},H("div",{className:"imo-header"},H("div",null,H("h1",null,"Import Map Overrides"),H("p",null,"This developer tool allows you to view and override your import maps. Start by clicking on a module that you'd like to override."," ",H("a",{target:"_blank",href:"https://github.com/joeldenning/import-map-overrides"},"See documentation for more info"),".")),H("button",{className:"imo-unstyled",onClick:e.close},"ⓧ")),H(xe,{importMapChanged:this.props.importMapChanged}))}}]),n}(K),Ue=function(e){a(n,e);var t=f(n);function n(){var e;r(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return l(m(e=t.call.apply(t,[this].concat(i))),"state",{showingPopup:!1}),l(m(e),"doUpdate",(function(){return e.forceUpdate()})),l(m(e),"toggleTrigger",(function(){e.setState((function(e){return{showingPopup:!e.showingPopup}}))})),l(m(e),"importMapChanged",(function(){e.forceUpdate()})),l(m(e),"useDevLibs",(function(){var t=localStorage.getItem("import-map-overrides-dev-libs");return t?"true"===t:e.props.customElement.hasAttribute("dev-libs")})),l(m(e),"atLeastOneOverride",(function(){return e.useDevLibs()?Object.keys(window.importMapOverrides.getOverrideMap().imports).filter((function(e){return!ye[e]})).length>0:Object.keys(window.importMapOverrides.getOverrideMap().imports).length>0})),e}return i(n,[{key:"componentDidMount",value:function(){window.addEventListener("import-map-overrides:change",this.doUpdate)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("import-map-overrides:change",this.doUpdate)}},{key:"render",value:function(e,t){var n,r=!e.customElement.hasAttribute("show-when-local-storage")||"true"===localStorage.getItem(e.customElement.getAttribute("show-when-local-storage")),o=(n=e.customElement.getAttribute("trigger-position"),["top-left","top-right","bottom-left","bottom-right"].indexOf(n)>=0?n:"bottom-right");return r?H("div",null,H("button",{onClick:this.toggleTrigger,className:"imo-unstyled imo-trigger imo-trigger-".concat(o," ").concat(this.atLeastOneOverride()?"imo-current-override":"")},"{···}"),this.useDevLibs()&&H(_e,null),t.showingPopup&&H(Ce,{close:this.toggleTrigger,importMapChanged:this.importMapChanged})):null}}]),n}(K);function Ie(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return function(n){a(l,n);var o=f(l);function l(){return r(this,l),o.apply(this,arguments)}return i(l,[{key:"connectedCallback",value:function(){this.renderWithPreact()}},{key:"disconnectedCallback",value:function(){fe(null,this),this.renderedEl=null}},{key:"attributeChangedCallback",value:function(){this.renderWithPreact()}},{key:"renderWithPreact",value:function(){if(this.shadowRoot)this.shadow=this.shadowRoot;else{this.shadow=this.attachShadow({mode:"open"});var t=document.createElement("style");t.textContent=A.toString(),this.shadow.appendChild(t)}this.renderedEl=fe(H(e,{customElement:this}),this.shadow,this.renderedEl)}}],[{key:"observedAttributes",get:function(){return t}}]),l}(p(HTMLElement))}window.customElements&&!y&&(window.customElements.define("import-map-overrides-full",Ie(Ue,["show-when-local-storage","trigger-position"])),window.customElements.define("import-map-overrides-popup",Ie(Ce)),window.customElements.define("import-map-overrides-list",Ie(xe)))}();
//# sourceMappingURL=import-map-overrides.js.map