{"version":3,"file":"index-CLez0wh5.js","sources":["../../ClientApp/node_modules/react/cjs/react.production.min.js","../../ClientApp/node_modules/react/index.js","../../ClientApp/node_modules/react/cjs/react-jsx-runtime.production.min.js","../../ClientApp/node_modules/react/jsx-runtime.js","../../ClientApp/node_modules/scheduler/cjs/scheduler.production.min.js","../../ClientApp/node_modules/scheduler/index.js","../../ClientApp/node_modules/react-dom/cjs/react-dom.production.min.js","../../ClientApp/node_modules/react-dom/index.js","../../ClientApp/node_modules/react-dom/client.js","../../ClientApp/src/shared/constants.ts","../../ClientApp/src/shared/models/boardConfiguration.ts","../../ClientApp/src/shared/models/module.ts","../../ClientApp/src/shared/utils/gid.ts","../../ClientApp/src/shared/utils/boardConfigurationFactory.ts","../../ClientApp/src/shared/utils/environment.ts","../../ClientApp/src/shared/utils/errorLogging.ts","../../ClientApp/src/shared/hooks/useBoardConfigurations.ts","../../ClientApp/node_modules/fast-json-patch/module/helpers.mjs","../../ClientApp/node_modules/fast-json-patch/module/core.mjs","../../ClientApp/node_modules/fast-json-patch/module/duplex.mjs","../../ClientApp/node_modules/fast-json-patch/index.mjs","../../ClientApp/src/version.ts","../../ClientApp/src/shared/utils/dateReviver.ts","../../ClientApp/src/shared/utils/isBoardEvent.ts","../../ClientApp/src/shared/hooks/useServerSentEvents.ts","../../ClientApp/src/shared/hooks/useMqtt.ts","../../ClientApp/src/shared/hooks/useBoardStates.ts","../../ClientApp/node_modules/classnames/index.js","../../ClientApp/src/shared/utils/maxFontSize.ts","../../ClientApp/src/shared/hooks/useScaledFontSize.ts","../../ClientApp/src/shared/components/DepartureOrArrivalTableLineCell.tsx","../../ClientApp/src/assets/images/spinner.svg","../../ClientApp/src/assets/images/light-theme/spinner.svg","../../ClientApp/src/assets/images/vasttrafik.svg","../../ClientApp/src/assets/images/light-theme/vasttrafik.svg","../../ClientApp/src/assets/images/traffic-situation-slight.svg","../../ClientApp/src/assets/images/traffic-situation-normal.svg","../../ClientApp/src/assets/images/traffic-situation-severe.svg","../../ClientApp/src/assets/images/wheelchair-accessible.svg","../../ClientApp/src/assets/images/light-theme/wheelchair-accessible.svg","../../ClientApp/src/assets/images/campaign.svg","../../ClientApp/src/assets/images/light-theme/campaign.svg","../../ClientApp/src/assets/images/transport-mode-tram.svg","../../ClientApp/src/assets/images/light-theme/transport-mode-tram.svg","../../ClientApp/src/assets/images/transport-mode-bus.svg","../../ClientApp/src/assets/images/light-theme/transport-mode-bus.svg","../../ClientApp/src/assets/images/transport-mode-ferry.svg","../../ClientApp/src/assets/images/light-theme/transport-mode-ferry.svg","../../ClientApp/src/assets/images/transport-mode-train.svg","../../ClientApp/src/assets/images/light-theme/transport-mode-train.svg","../../ClientApp/src/shared/components/ImageIcon.tsx","../../ClientApp/src/shared/components/DepartureOrArrivalTableTransportModeCell.tsx","../../ClientApp/src/shared/hooks/useElementSize.ts","../../ClientApp/src/shared/components/DepartureOrArrivalTableDirectionOrOriginCell.tsx","../../ClientApp/src/shared/utils/formatDepartureOrArrivalTime.ts","../../ClientApp/src/shared/utils/time.ts","../../ClientApp/src/shared/hooks/useDepartureOrArrivalDisplayTime.ts","../../ClientApp/src/shared/utils/departureOrArrival.ts","../../ClientApp/src/shared/components/DepartureOrArrivalTableDepartureOrArrivalCell.tsx","../../ClientApp/src/shared/components/DepartureOrArrivalTablePlatformCell.tsx","../../ClientApp/src/shared/hooks/usePagination.ts","../../ClientApp/src/shared/components/PageIndicator.tsx","../../ClientApp/src/shared/utils/rem.ts","../../ClientApp/src/shared/utils/departureOrArrivalRowComparer.ts","../../ClientApp/node_modules/@babel/runtime/helpers/esm/extends.js","../../ClientApp/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../ClientApp/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../ClientApp/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","../../ClientApp/node_modules/dom-helpers/esm/hasClass.js","../../ClientApp/node_modules/dom-helpers/esm/addClass.js","../../ClientApp/node_modules/dom-helpers/esm/removeClass.js","../../ClientApp/node_modules/react-transition-group/esm/config.js","../../ClientApp/node_modules/react-transition-group/esm/TransitionGroupContext.js","../../ClientApp/node_modules/react-transition-group/esm/utils/reflow.js","../../ClientApp/node_modules/react-transition-group/esm/Transition.js","../../ClientApp/node_modules/react-transition-group/esm/CSSTransition.js","../../ClientApp/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../ClientApp/node_modules/react-transition-group/esm/utils/ChildMapping.js","../../ClientApp/node_modules/react-transition-group/esm/TransitionGroup.js","../../ClientApp/src/shared/utils/exitAnimation.ts","../../ClientApp/src/shared/components/DepartureOrArrivalTablePlannedTimeCell.tsx","../../ClientApp/src/shared/components/DepartureOrArrivalTable.tsx","../../ClientApp/src/shared/components/Message.tsx","../../ClientApp/src/shared/components/LoadingPanel.tsx","../../ClientApp/src/modules/departures/components/DeparturesModule.tsx","../../ClientApp/src/modules/arrivals/components/ArrivalsModule.tsx","../../ClientApp/src/shared/components/Clock.tsx","../../ClientApp/src/shared/utils/measureTextWidth.ts","../../ClientApp/src/shared/hooks/useTextWidth.ts","../../ClientApp/src/shared/components/StopBoardHeader.tsx","../../ClientApp/node_modules/@tweenjs/tween.js/dist/tween.esm.js","../../ClientApp/src/shared/hooks/useSmoothScroll.ts","../../ClientApp/src/modules/traffic-situations/components/TrafficSituationDescription.tsx","../../ClientApp/src/modules/traffic-situations/components/TrafficSituation.tsx","../../ClientApp/src/modules/traffic-situations/components/TrafficSituationsModule.tsx","../../ClientApp/src/modules/vehicle/components/Direction.tsx","../../ClientApp/src/modules/vehicle/components/Line.tsx","../../ClientApp/src/modules/vehicle/components/Stop.tsx","../../ClientApp/src/modules/vehicle/components/Route.tsx","../../ClientApp/src/modules/vehicle/components/VehicleModule.tsx","../../ClientApp/src/shared/components/Board.tsx","../../ClientApp/src/shared/hooks/useLayoutScale.ts","../../ClientApp/src/shared/components/EnvironmentLabel.tsx","../../ClientApp/src/shared/hooks/useTitle.ts","../../ClientApp/node_modules/suncalc/suncalc.js","../../ClientApp/src/shared/hooks/useTheme.ts","../../ClientApp/src/shared/components/Boards.tsx","../../ClientApp/node_modules/@remix-run/router/dist/router.js","../../ClientApp/node_modules/react-router/dist/index.js","../../ClientApp/node_modules/react-router-dom/dist/index.js","../../ClientApp/src/shared/components/Help.tsx","../../ClientApp/src/modules/configuration/reducers/boardConfiguratorsReducer.ts","../../ClientApp/src/shared/utils/stopAreas.ts","../../ClientApp/src/shared/utils/stopArea.ts","../../ClientApp/src/modules/configuration/components/StopAreaSearch.tsx","../../ClientApp/src/modules/configuration/components/StopPointsConfigurator.tsx","../../ClientApp/src/modules/configuration/components/StopBoardConfigurator.tsx","../../ClientApp/src/modules/configuration/components/BoardConfigurator.tsx","../../ClientApp/src/modules/configuration/components/Configuration.tsx","../../ClientApp/src/App.tsx","../../ClientApp/src/main.tsx"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var z={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){z[a]=new v(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(ra,\nsa);z[b]=new v(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)});\nz.xlinkHref=new v(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Ma(a):\"\"}\nfunction Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma(\"Lazy\");case 13:return Ma(\"Suspense\");case 19:return Ma(\"SuspenseList\");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return\"\"}}\nfunction Qa(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ya:return\"Fragment\";case wa:return\"Portal\";case Aa:return\"Profiler\";case za:return\"StrictMode\";case Ea:return\"Suspense\";case Fa:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case Ca:return(a.displayName||\"Context\")+\".Consumer\";case Ba:return(a._context.displayName||\"Context\")+\".Provider\";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName||\nb.name||\"\",a=\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||\"Memo\";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null}\nfunction Ra(a){var b=a.type;switch(a.tag){case 24:return\"Cache\";case 9:return(b.displayName||\"Context\")+\".Consumer\";case 10:return(b._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return a=b.render,a=a.displayName||a.name||\"\",b.displayName||(\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return b;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return Qa(b);case 8:return b===za?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";\ncase 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(\"function\"===typeof b)return b.displayName||b.name||null;if(\"string\"===typeof b)return b}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"string\":case \"undefined\":return a;case \"object\":return a;default:return\"\"}}\nfunction Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function ab(a,b){b=b.checked;null!=b&&ta(a,\"checked\",b,!1)}\nfunction bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?cb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction db(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction cb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}var eb=Array.isArray;\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e\"+b.valueOf().toString()+\"\";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,\nzoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a]})});function rb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(\"\"+b).trim():b+\"px\"}\nfunction sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=rb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p(60));if(\"object\"!==typeof b.dangerouslySetInnerHTML||!(\"__html\"in b.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(p(62));}}\nfunction vb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}var wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(p(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;\nfunction tc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)))}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}\nfunction Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Je(c)}}function Le(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Le(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nfunction Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),\"selectionStart\"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c,\nd);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)))}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});\"function\"===typeof c.focus&&c.focus();for(c=0;c=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H)}function ag(a,b,c){if(H.current!==Vf)throw Error(p(168));G(H,b);G(Wf,c)}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p(108,Ra(a)||\"Unknown\",e));return A({},c,d)}\nfunction cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return!0}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c)}var eg=null,fg=!1,gg=!1;function hg(a){null===eg?eg=[a]:eg.push(a)}function ig(a){fg=!0;hg(a)}\nfunction jg(){if(!gg&&null!==eg){gg=!0;var a=0,b=C;try{var c=eg;for(C=1;a>=g;e-=g;rg=1<<32-oc(b)+e|c<w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x}if(w===h.length)return c(e,u),I&&tg(e,w),l;if(null===u){for(;ww?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x}if(n.done)return c(e,\nm),I&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I&&tg(e,w);return l}function J(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k=\nf.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===Ha&&Ng(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=Lg(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ya?(d=Tg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Rg(f.type,f.key,f.props,null,a.mode,h),h.ref=Lg(a,d,f),h.return=a,a=h)}return g(a);case wa:a:{for(l=f.key;null!==\nd;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=Sg(f,a.mode,h);d.return=a;a=d}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);Mg(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):\n(c(a,d),d=Qg(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(a){var b=Wg.current;E(Wg);a._currentValue=b}function bh(a,b,c){for(;null!==a;){var d=a.alternate;(a.childLanes&b)!==b?(a.childLanes|=b,null!==d&&(d.childLanes|=b)):null!==d&&(d.childLanes&b)!==b&&(d.childLanes|=b);if(a===c)break;a=a.return}}\nfunction ch(a,b){Xg=a;Zg=Yg=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(dh=!0),a.firstContext=null)}function eh(a){var b=a._currentValue;if(Zg!==a)if(a={context:a,memoizedValue:b,next:null},null===Yg){if(null===Xg)throw Error(p(308));Yg=a;Xg.dependencies={lanes:0,firstContext:a}}else Yg=Yg.next=a;return b}var fh=null;function gh(a){null===fh?fh=[a]:fh.push(a)}\nfunction hh(a,b,c,d){var e=b.interleaved;null===e?(c.next=c,gh(b)):(c.next=e.next,e.next=c);b.interleaved=c;return ih(a,d)}function ih(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}var jh=!1;function kh(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}\nfunction lh(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function mh(a,b){return{eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}}\nfunction nh(a,b,c){var d=a.updateQueue;if(null===d)return null;d=d.shared;if(0!==(K&2)){var e=d.pending;null===e?b.next=b:(b.next=e.next,e.next=b);d.pending=b;return ih(a,c)}e=d.interleaved;null===e?(b.next=b,gh(d)):(b.next=e.next,e.next=b);d.interleaved=b;return ih(a,c)}function oh(a,b,c){b=b.updateQueue;if(null!==b&&(b=b.shared,0!==(c&4194240))){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nfunction ph(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next}while(null!==c);null===f?e=f=b:f=f.next=b}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next=\nb;c.lastBaseUpdate=b}\nfunction qh(a,b,c,d){var e=a.updateQueue;jh=!1;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,l=k.next;k.next=null;null===g?f=l:g.next=l;g=k;var m=a.alternate;null!==m&&(m=m.updateQueue,h=m.lastBaseUpdate,h!==g&&(null===h?m.firstBaseUpdate=l:h.next=l,m.lastBaseUpdate=k))}if(null!==f){var q=e.baseState;g=0;m=l=k=null;h=f;do{var r=h.lane,y=h.eventTime;if((d&r)===r){null!==m&&(m=m.next={eventTime:y,lane:0,tag:h.tag,payload:h.payload,callback:h.callback,\nnext:null});a:{var n=a,t=h;r=b;y=c;switch(t.tag){case 1:n=t.payload;if(\"function\"===typeof n){q=n.call(y,q,r);break a}q=n;break a;case 3:n.flags=n.flags&-65537|128;case 0:n=t.payload;r=\"function\"===typeof n?n.call(y,q,r):n;if(null===r||void 0===r)break a;q=A({},q,r);break a;case 2:jh=!0}}null!==h.callback&&0!==h.lane&&(a.flags|=64,r=e.effects,null===r?e.effects=[h]:r.push(h))}else y={eventTime:y,lane:r,tag:h.tag,payload:h.payload,callback:h.callback,next:null},null===m?(l=m=y,k=q):m=m.next=y,g|=r;\nh=h.next;if(null===h)if(h=e.shared.pending,null===h)break;else r=h,h=r.next,r.next=null,e.lastBaseUpdate=r,e.shared.pending=null}while(1);null===m&&(k=q);e.baseState=k;e.firstBaseUpdate=l;e.lastBaseUpdate=m;b=e.shared.interleaved;if(null!==b){e=b;do g|=e.lane,e=e.next;while(e!==b)}else null===f&&(e.shared.lanes=0);rh|=g;a.lanes=g;a.memoizedState=q}}\nfunction sh(a,b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;bc?c:4;a(!0);var d=Gh.transition;Gh.transition={};try{a(!1),b()}finally{C=c,Gh.transition=d}}function wi(){return Uh().memoizedState}\nfunction xi(a,b,c){var d=yi(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,c);else if(c=hh(a,b,c,d),null!==c){var e=R();gi(c,a,d,e);Bi(c,b,d)}}\nfunction ii(a,b,c){var d=yi(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,gh(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=hh(a,b,e,d);null!==c&&(e=R(),gi(c,a,d,e),Bi(c,b,d))}}\nfunction zi(a){var b=a.alternate;return a===M||null!==b&&b===M}function Ai(a,b){Jh=Ih=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function Bi(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nvar Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(a,b){Th().memoizedState=[a,void 0===b?null:b];return a},useContext:eh,useEffect:mi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ki(4194308,\n4,pi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ki(4194308,4,a,b)},useInsertionEffect:function(a,b){return ki(4,2,a,b)},useMemo:function(a,b){var c=Th();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Th();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=xi.bind(null,M,a);return[d.memoizedState,a]},useRef:function(a){var b=\nTh();a={current:a};return b.memoizedState=a},useState:hi,useDebugValue:ri,useDeferredValue:function(a){return Th().memoizedState=a},useTransition:function(){var a=hi(!1),b=a[0];a=vi.bind(null,a[1]);Th().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=M,e=Th();if(I){if(void 0===c)throw Error(p(407));c=c()}else{c=b();if(null===Q)throw Error(p(349));0!==(Hh&30)||di(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;mi(ai.bind(null,d,\nf,a),[a]);d.flags|=2048;bi(9,ci.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=Th(),b=Q.identifierPrefix;if(I){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=Kh++;0\\x3c/script>\",a=a.removeChild(a.firstChild)):\n\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;zj(a,b,!1,!1);b.stateNode=a;a:{g=vb(c,d);switch(c){case \"dialog\":D(\"cancel\",a);D(\"close\",a);e=d;break;case \"iframe\":case \"object\":case \"embed\":D(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eGj&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304)}else{if(!d)if(a=Ch(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Dj(f,!0),null===f.tail&&\"hidden\"===f.tailMode&&!g.alternate&&!I)return S(b),null}else 2*B()-f.renderingStartTime>Gj&&1073741824!==c&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g)}if(null!==f.tail)return b=f.tail,f.rendering=\nb,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=L.current,G(L,d?c&1|2:c&1),b;S(b);return null;case 22:case 23:return Hj(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(fj&1073741824)&&(S(b),b.subtreeFlags&6&&(b.flags|=8192)):S(b),null;case 24:return null;case 25:return null}throw Error(p(156,b.tag));}\nfunction Ij(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return zh(),E(Wf),E(H),Eh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Bh(b),null;case 13:E(L);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p(340));Ig()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(b.type._context),null;case 22:case 23:return Hj(),\nnull;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj=\"function\"===typeof WeakSet?WeakSet:Set,V=null;function Lj(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){W(a,b,d)}else c.current=null}function Mj(a,b,c){try{c()}catch(d){W(a,b,d)}}var Nj=!1;\nfunction Oj(a,b){Cf=dd;a=Me();if(Ne(a)){if(\"selectionStart\"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+=\nq.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode}q=y}c=-1===h||-1===k?null:{start:h,end:k}}else c=null}c=c||{start:0,end:0}}else c=null;Df={focusedElem:a,selectionRange:c};dd=!1;for(V=b;null!==V;)if(b=V,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V=a;else for(;null!==V;){b=V;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break;\ncase 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Ci(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent=\"\":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163));}}catch(F){W(b,b.return,F)}a=b.sibling;if(null!==a){a.return=b.return;V=a;break}V=b.return}n=Nj;Nj=!1;return n}\nfunction Pj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Mj(b,c,f)}e=e.next}while(e!==d)}}function Qj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}function Rj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Sj(a){var b=a.alternate;null!==b&&(a.alternate=null,Sj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Tj(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Uj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Tj(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Vj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Vj(a,b,c),a=a.sibling;null!==a;)Vj(a,b,c),a=a.sibling}\nfunction Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling}var X=null,Xj=!1;function Yj(a,b,c){for(c=c.child;null!==c;)Zj(a,b,c),c=c.sibling}\nfunction Zj(a,b,c){if(lc&&\"function\"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c)}catch(h){}switch(c.tag){case 5:U||Lj(c,b);case 6:var d=X,e=Xj;X=null;Yj(a,b,c);X=d;Xj=e;null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X.removeChild(c.stateNode));break;case 18:null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X,c.stateNode));break;case 4:d=X;e=Xj;X=c.stateNode.containerInfo;Xj=!0;\nYj(a,b,c);X=d;Xj=e;break;case 0:case 11:case 14:case 15:if(!U&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Mj(c,b,g):0!==(f&4)&&Mj(c,b,g));e=e.next}while(e!==d)}Yj(a,b,c);break;case 1:if(!U&&(Lj(c,b),d=c.stateNode,\"function\"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount()}catch(h){W(c,b,h)}Yj(a,b,c);break;case 21:Yj(a,b,c);break;case 22:c.mode&1?(U=(d=U)||null!==\nc.memoizedState,Yj(a,b,c),U=d):Yj(a,b,c);break;default:Yj(a,b,c)}}function ak(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Kj);b.forEach(function(b){var d=bk.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction ck(a,b){var c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*lk(d/1960))-d;if(10a?16:a;if(null===wk)var d=!1;else{a=wk;wk=null;xk=0;if(0!==(K&6))throw Error(p(331));var e=K;K|=4;for(V=a.current;null!==V;){var f=V,g=f.child;if(0!==(V.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kB()-fk?Kk(a,0):rk|=c);Dk(a,b)}function Yk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=R();a=ih(a,b);null!==a&&(Ac(a,b,c),Dk(a,c))}function uj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Yk(a,c)}\nfunction bk(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p(314));}null!==d&&d.delete(b);Yk(a,c)}var Vk;\nVk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)dh=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return dh=!1,yj(a,b,c);dh=0!==(a.flags&131072)?!0:!1}else dh=!1,I&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;ij(a,b);a=b.pendingProps;var e=Yf(b,H.current);ch(b,c);e=Nh(null,b,d,a,e,c);var f=Sh();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue=\nnull,Zf(d)?(f=!0,cg(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,kh(b),e.updater=Ei,b.stateNode=e,e._reactInternals=b,Ii(b,d,a,c),b=jj(null,b,d,!0,f,c)):(b.tag=0,I&&f&&vg(b),Xi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{ij(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=Zk(d);a=Ci(d,a);switch(e){case 0:b=cj(null,b,d,a,c);break a;case 1:b=hj(null,b,d,a,c);break a;case 11:b=Yi(null,b,d,a,c);break a;case 14:b=$i(null,b,d,Ci(d.type,a),c);break a}throw Error(p(306,\nd,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),cj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),hj(a,b,d,e,c);case 3:a:{kj(b);if(null===a)throw Error(p(387));d=b.pendingProps;f=b.memoizedState;e=f.element;lh(a,b);qh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState=\nf,b.memoizedState=f,b.flags&256){e=Ji(Error(p(423)),b);b=lj(a,b,d,c,e);break a}else if(d!==e){e=Ji(Error(p(424)),b);b=lj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I=!0,zg=null,c=Vg(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{Ig();if(d===e){b=Zi(a,b,c);break a}Xi(a,b,d,c)}b=b.child}return b;case 5:return Ah(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32),\ngj(a,b),Xi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return oj(a,b,c);case 4:return yh(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Ug(b,null,d,c):Xi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),Yi(a,b,d,e,c);case 7:return Xi(a,b,b.pendingProps,c),b.child;case 8:return Xi(a,b,b.pendingProps.children,c),b.child;case 12:return Xi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps;\ng=e.value;G(Wg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=Zi(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=mh(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);bh(f.return,\nc,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);bh(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}Xi(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,ch(b,c),e=eh(e),d=d(e),b.flags|=1,Xi(a,b,d,c),\nb.child;case 14:return d=b.type,e=Ci(d,b.pendingProps),e=Ci(d.type,e),$i(a,b,d,e,c);case 15:return bj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),ij(a,b),b.tag=1,Zf(d)?(a=!0,cg(b)):a=!1,ch(b,c),Gi(b,d,e),Ii(b,d,e,c),jj(null,b,d,!0,a,c);case 19:return xj(a,b,c);case 22:return dj(a,b,c)}throw Error(p(156,b.tag));};function Fk(a,b){return ac(a,b)}\nfunction $k(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Bg(a,b,c,d){return new $k(a,b,c,d)}function aj(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction Zk(a){if(\"function\"===typeof a)return aj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2}\nfunction Pg(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction Rg(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)aj(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ya:return Tg(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return pj(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11;\nbreak a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p(130,null==a?a:typeof a,\"\"));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Tg(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function pj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:!1};return a}function Qg(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a}\nfunction Sg(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction al(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData=\nnull}function bl(a,b,c,d,e,f,g,h,k){a=new al(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};kh(f);return a}function cl(a,b,c){var d=3();\n for (const moduleCandidate of moduleCandidates) {\n if (isModule(moduleCandidate)) {\n modules.push(moduleCandidate);\n } else {\n throw new Error(\n `Invalid module ${moduleCandidate} for board ${boardId}`\n );\n }\n }\n return modules;\n }\n\n function tryCreateBoardConfiguration(): BoardConfiguration | undefined {\n const modules = getModules(boardId);\n\n if (modules.includes('departures') && modules.includes('arrivals')) {\n throw new Error(\n `Board ${boardId} cannot have both departures and arrivals modules`\n );\n }\n\n if (hasOnlyStopBoardModules(modules)) {\n const gids = urlParams.getAll(`board${boardId}Gids`);\n const stopAreaGid =\n gids.length === 1 && isStopArea(gids[0]) ? gids[0] : undefined;\n\n if (stopAreaGid) {\n return {\n id: boardId,\n type: 'stop-area',\n stopAreaGid,\n modules,\n departureSorting: getDepartureSorting(boardId),\n departurePaging: getDeparturePaging(boardId),\n departureTimeFormat: getDepartureTimeFormat(boardId),\n departureTimeSpan: getDepartureTimeSpan(boardId),\n };\n } else if (gids.length > 0 && gids.every(isStopPoint)) {\n return {\n id: boardId,\n type: 'stop-points',\n stopPointGids: gids,\n modules,\n showPlatformsInHeader: getShowPlatformsInHeader(boardId),\n departureSorting: getDepartureSorting(boardId),\n departurePaging: getDeparturePaging(boardId),\n departureTimeFormat: getDepartureTimeFormat(boardId),\n departureTimeSpan: getDepartureTimeSpan(boardId),\n };\n }\n } else if (isVehicleModule(modules)) {\n return {\n id: boardId,\n type: 'vehicle',\n modules,\n };\n }\n }\n\n function isModule(moduleCandidate: string): moduleCandidate is Module {\n return MODULES.some((module) => moduleCandidate === module);\n }\n\n function hasOnlyStopBoardModules(\n modules: Module[]\n ): modules is StopBoardModule[] {\n return modules.every(\n (module) =>\n STOP_BOARD_MODULES.find(\n (moduleCandidate) => moduleCandidate === module\n ) !== undefined\n );\n }\n\n function isVehicleModule(modules: Module[]): modules is [VehicleModule] {\n return modules.length === 1 && modules[0] === 'vehicle';\n }\n\n function getShowPlatformsInHeader(boardCounter: number): boolean | undefined {\n const showPlatformsInHeader = urlParams.get(\n `board${boardCounter}ShowPlatformsInHeader`\n );\n return showPlatformsInHeader === 'false' ? false : undefined;\n }\n\n function getDepartureSorting(\n boardCounter: number\n ): DepartureOrArrivalSorting | undefined {\n const departureSorting = urlParams.get(\n `board${boardCounter}DepartureSorting`\n );\n return departureSorting === 'time' ? departureSorting : undefined;\n }\n\n function getDeparturePaging(boardCounter: number): boolean | undefined {\n const departurePaging = urlParams.get(\n `board${boardCounter}DeparturePaging`\n );\n return departurePaging === 'false' ? false : undefined;\n }\n\n function getDepartureTimeFormat(\n boardCounter: number\n ): DepartureOrArrivalTimeFormat | undefined {\n const departureTimeFormat = urlParams.get(\n `board${boardCounter}DepartureTimeFormat`\n );\n return departureTimeFormat === 'time' ? departureTimeFormat : undefined;\n }\n\n function getDepartureTimeSpan(\n boardCounter: number\n ): DepartureTimeSpan | undefined {\n const departureTimeSpan = urlParams.get(\n `board${boardCounter}DepartureTimeSpan`\n );\n return departureTimeSpan === 'day' ? departureTimeSpan : undefined;\n }\n\n let boardId = 1;\n let hasBoardAtId = true;\n const newBoards = new Array();\n while (hasBoardAtId) {\n hasBoardAtId = false;\n const boardConfiguration = tryCreateBoardConfiguration();\n if (boardConfiguration !== undefined) {\n newBoards.push(boardConfiguration);\n hasBoardAtId = true;\n boardId++;\n }\n }\n\n // Legacy configuration for Avgångstavla\n const stopAreaGids = urlParams.getAll('stopAreaGid');\n for (const stopAreaGid of stopAreaGids) {\n newBoards.push({\n id: boardId++,\n type: 'stop-area',\n stopAreaGid,\n modules: ['departures', 'trafficSituations'],\n });\n }\n\n if (newBoards.length > MAX_NUMBER_OF_BOARDS) {\n throw new Error(`Max number of boards is ${MAX_NUMBER_OF_BOARDS}`);\n }\n\n return newBoards;\n}\n\nexport function createConfigurationQuery(\n boardConfigurations: BoardConfiguration[],\n theme: ConfigurationTheme\n): string {\n const urlParams = new URLSearchParams();\n for (const boardConfiguration of boardConfigurations) {\n if (boardConfiguration.type === 'stop-area') {\n addGid(urlParams, boardConfiguration.id, boardConfiguration.stopAreaGid);\n } else if (boardConfiguration.type === 'stop-points') {\n for (const stopPointGid of boardConfiguration.stopPointGids) {\n addGid(urlParams, boardConfiguration.id, stopPointGid);\n }\n\n if (\n boardConfiguration.showPlatformsInHeader !== undefined &&\n boardConfiguration.showPlatformsInHeader !==\n SHOW_PLATFORMS_IN_HEADER_DEFAULT\n ) {\n urlParams.set(\n `board${boardConfiguration.id}ShowPlatformsInHeader`,\n boardConfiguration.showPlatformsInHeader.toString()\n );\n }\n }\n\n for (const module of boardConfiguration.modules) {\n urlParams.append(`board${boardConfiguration.id}Modules`, module);\n }\n\n if (\n boardConfiguration.type === 'stop-area' ||\n boardConfiguration.type === 'stop-points'\n ) {\n if (\n boardConfiguration.departureSorting &&\n boardConfiguration.departureSorting !== DEPARTURE_SORTING_DEFAULT\n ) {\n urlParams.set(\n `board${boardConfiguration.id}DepartureSorting`,\n boardConfiguration.departureSorting\n );\n }\n\n if (\n boardConfiguration.departurePaging !== undefined &&\n boardConfiguration.departurePaging !== DEPARTURE_PAGING_DEFAULT\n ) {\n urlParams.set(\n `board${boardConfiguration.id}DeparturePaging`,\n boardConfiguration.departurePaging.toString()\n );\n }\n\n if (\n boardConfiguration.departureTimeFormat !== undefined &&\n boardConfiguration.departureTimeFormat !== DEPARTURE_TIME_FORMAT_DEFAULT\n ) {\n urlParams.set(\n `board${boardConfiguration.id}DepartureTimeFormat`,\n boardConfiguration.departureTimeFormat\n );\n }\n\n if (\n boardConfiguration.departureTimeSpan &&\n boardConfiguration.departureTimeSpan !== DEPARTURES_TIME_SPAN_DEFAULT\n ) {\n urlParams.set(\n `board${boardConfiguration.id}DepartureTimeSpan`,\n boardConfiguration.departureTimeSpan\n );\n }\n }\n }\n\n if (theme !== 'dark') {\n urlParams.set(`theme`, theme);\n }\n\n return urlParams.toString();\n}\n\nfunction addGid(urlParams: URLSearchParams, boardId: number, gid: string) {\n urlParams.append(`board${boardId}Gids`, gid);\n}\n","export function getEnvironment():\n | 'Development'\n | 'Feature'\n | 'Test'\n | 'UAT'\n | 'Production'\n | undefined {\n const hostName = window.location.hostname.toLowerCase();\n if (hostName.startsWith('localhost')) {\n return 'Development';\n } else if (\n hostName.startsWith('feature-gds') ||\n hostName.startsWith('avgangstavla-feature')\n ) {\n return 'Feature';\n } else if (\n hostName.startsWith('test-gds') ||\n hostName.startsWith('avgangstavla-test')\n ) {\n return 'Test';\n } else if (\n hostName.startsWith('uat-gds') ||\n hostName.startsWith('avgangstavla-uat')\n ) {\n return 'UAT';\n } else if (hostName.startsWith('gds') || hostName.startsWith('avgangstavla')) {\n return 'Production';\n }\n \n return undefined;\n}\n","import { getEnvironment } from './environment';\n\nconst environment = getEnvironment();\nconst isSupportingErrorLogging =\n environment === 'Development' ||\n environment === 'Test' ||\n environment === 'UAT';\n\nexport function logError(error: unknown): void {\n if (!isSupportingErrorLogging || error == null) {\n return;\n }\n\n const errorData = {\n error,\n configuration: window.location.search,\n };\n\n logErrorMessage(JSON.stringify(errorData));\n}\n\nfunction logErrorMessage(message: string): void {\n void fetch('/api/errors', {\n method: 'POST',\n headers: { 'Content-Type': 'text/plain' },\n body: message,\n });\n}\n","import { useEffect, useState } from 'react';\nimport { BoardConfiguration } from '../models/boardConfiguration';\nimport { createBoardConfigurations } from '../utils/boardConfigurationFactory';\nimport { logError } from '../utils/errorLogging';\n\nexport default function useBoardConfigurations() {\n const [error, setError] = useState();\n const [boardConfigurations, setBoards] = useState<\n BoardConfiguration[] | undefined\n >();\n\n useEffect(() => {\n try {\n const urlParams = new URLSearchParams(window.location.search);\n const boards = createBoardConfigurations(urlParams);\n setBoards(boards);\n } catch (error) {\n if (error instanceof Error) {\n setError(error.message);\n }\n logError(error);\n }\n }, []);\n\n return { boardConfigurations, error };\n}\n","/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2022 Joachim Wester\n * MIT licensed\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function hasOwnProperty(obj, key) {\n return _hasOwnProperty.call(obj, key);\n}\nexport function _objectKeys(obj) {\n if (Array.isArray(obj)) {\n var keys_1 = new Array(obj.length);\n for (var k = 0; k < keys_1.length; k++) {\n keys_1[k] = \"\" + k;\n }\n return keys_1;\n }\n if (Object.keys) {\n return Object.keys(obj);\n }\n var keys = [];\n for (var i in obj) {\n if (hasOwnProperty(obj, i)) {\n keys.push(i);\n }\n }\n return keys;\n}\n;\n/**\n* Deeply clone the object.\n* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)\n* @param {any} obj value to clone\n* @return {any} cloned obj\n*/\nexport function _deepClone(obj) {\n switch (typeof obj) {\n case \"object\":\n return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n case \"undefined\":\n return null; //this is how JSON.stringify behaves for array items\n default:\n return obj; //no need to clone primitives\n }\n}\n//3x faster than cached /^\\d+$/.test(str)\nexport function isInteger(str) {\n var i = 0;\n var len = str.length;\n var charCode;\n while (i < len) {\n charCode = str.charCodeAt(i);\n if (charCode >= 48 && charCode <= 57) {\n i++;\n continue;\n }\n return false;\n }\n return true;\n}\n/**\n* Escapes a json pointer path\n* @param path The raw pointer\n* @return the Escaped path\n*/\nexport function escapePathComponent(path) {\n if (path.indexOf('/') === -1 && path.indexOf('~') === -1)\n return path;\n return path.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n/**\n * Unescapes a json pointer path\n * @param path The escaped pointer\n * @return The unescaped path\n */\nexport function unescapePathComponent(path) {\n return path.replace(/~1/g, '/').replace(/~0/g, '~');\n}\nexport function _getPathRecursive(root, obj) {\n var found;\n for (var key in root) {\n if (hasOwnProperty(root, key)) {\n if (root[key] === obj) {\n return escapePathComponent(key) + '/';\n }\n else if (typeof root[key] === 'object') {\n found = _getPathRecursive(root[key], obj);\n if (found != '') {\n return escapePathComponent(key) + '/' + found;\n }\n }\n }\n }\n return '';\n}\nexport function getPath(root, obj) {\n if (root === obj) {\n return '/';\n }\n var path = _getPathRecursive(root, obj);\n if (path === '') {\n throw new Error(\"Object not found in root\");\n }\n return \"/\" + path;\n}\n/**\n* Recursively checks whether an object has any undefined values inside.\n*/\nexport function hasUndefined(obj) {\n if (obj === undefined) {\n return true;\n }\n if (obj) {\n if (Array.isArray(obj)) {\n for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {\n if (hasUndefined(obj[i_1])) {\n return true;\n }\n }\n }\n else if (typeof obj === \"object\") {\n var objKeys = _objectKeys(obj);\n var objKeysLength = objKeys.length;\n for (var i = 0; i < objKeysLength; i++) {\n if (hasUndefined(obj[objKeys[i]])) {\n return true;\n }\n }\n }\n }\n return false;\n}\nfunction patchErrorMessageFormatter(message, args) {\n var messageParts = [message];\n for (var key in args) {\n var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print\n if (typeof value !== 'undefined') {\n messageParts.push(key + \": \" + value);\n }\n }\n return messageParts.join('\\n');\n}\nvar PatchError = /** @class */ (function (_super) {\n __extends(PatchError, _super);\n function PatchError(message, name, index, operation, tree) {\n var _newTarget = this.constructor;\n var _this = _super.call(this, patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree })) || this;\n _this.name = name;\n _this.index = index;\n _this.operation = operation;\n _this.tree = tree;\n Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359\n _this.message = patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree });\n return _this;\n }\n return PatchError;\n}(Error));\nexport { PatchError };\n","import { PatchError, _deepClone, isInteger, unescapePathComponent, hasUndefined } from './helpers.mjs';\nexport var JsonPatchError = PatchError;\nexport var deepClone = _deepClone;\n/* We use a Javascript hash to store each\n function. Each hash entry (property) uses\n the operation identifiers specified in rfc6902.\n In this way, we can map each patch operation\n to its dedicated function in efficient way.\n */\n/* The operations applicable to an object */\nvar objOps = {\n add: function (obj, key, document) {\n obj[key] = this.value;\n return { newDocument: document };\n },\n remove: function (obj, key, document) {\n var removed = obj[key];\n delete obj[key];\n return { newDocument: document, removed: removed };\n },\n replace: function (obj, key, document) {\n var removed = obj[key];\n obj[key] = this.value;\n return { newDocument: document, removed: removed };\n },\n move: function (obj, key, document) {\n /* in case move target overwrites an existing value,\n return the removed value, this can be taxing performance-wise,\n and is potentially unneeded */\n var removed = getValueByPointer(document, this.path);\n if (removed) {\n removed = _deepClone(removed);\n }\n var originalValue = applyOperation(document, { op: \"remove\", path: this.from }).removed;\n applyOperation(document, { op: \"add\", path: this.path, value: originalValue });\n return { newDocument: document, removed: removed };\n },\n copy: function (obj, key, document) {\n var valueToCopy = getValueByPointer(document, this.from);\n // enforce copy by value so further operations don't affect source (see issue #177)\n applyOperation(document, { op: \"add\", path: this.path, value: _deepClone(valueToCopy) });\n return { newDocument: document };\n },\n test: function (obj, key, document) {\n return { newDocument: document, test: _areEquals(obj[key], this.value) };\n },\n _get: function (obj, key, document) {\n this.value = obj[key];\n return { newDocument: document };\n }\n};\n/* The operations applicable to an array. Many are the same as for the object */\nvar arrOps = {\n add: function (arr, i, document) {\n if (isInteger(i)) {\n arr.splice(i, 0, this.value);\n }\n else { // array props\n arr[i] = this.value;\n }\n // this may be needed when using '-' in an array\n return { newDocument: document, index: i };\n },\n remove: function (arr, i, document) {\n var removedList = arr.splice(i, 1);\n return { newDocument: document, removed: removedList[0] };\n },\n replace: function (arr, i, document) {\n var removed = arr[i];\n arr[i] = this.value;\n return { newDocument: document, removed: removed };\n },\n move: objOps.move,\n copy: objOps.copy,\n test: objOps.test,\n _get: objOps._get\n};\n/**\n * Retrieves a value from a JSON document by a JSON pointer.\n * Returns the value.\n *\n * @param document The document to get the value from\n * @param pointer an escaped JSON pointer\n * @return The retrieved value\n */\nexport function getValueByPointer(document, pointer) {\n if (pointer == '') {\n return document;\n }\n var getOriginalDestination = { op: \"_get\", path: pointer };\n applyOperation(document, getOriginalDestination);\n return getOriginalDestination.value;\n}\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the {newDocument, result} of the operation.\n * It modifies the `document` and `operation` objects - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return `{newDocument, result}` after the operation\n */\nexport function applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {\n if (validateOperation === void 0) { validateOperation = false; }\n if (mutateDocument === void 0) { mutateDocument = true; }\n if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }\n if (index === void 0) { index = 0; }\n if (validateOperation) {\n if (typeof validateOperation == 'function') {\n validateOperation(operation, 0, document, operation.path);\n }\n else {\n validator(operation, 0);\n }\n }\n /* ROOT OPERATIONS */\n if (operation.path === \"\") {\n var returnValue = { newDocument: document };\n if (operation.op === 'add') {\n returnValue.newDocument = operation.value;\n return returnValue;\n }\n else if (operation.op === 'replace') {\n returnValue.newDocument = operation.value;\n returnValue.removed = document; //document we removed\n return returnValue;\n }\n else if (operation.op === 'move' || operation.op === 'copy') { // it's a move or copy to root\n returnValue.newDocument = getValueByPointer(document, operation.from); // get the value by json-pointer in `from` field\n if (operation.op === 'move') { // report removed item\n returnValue.removed = document;\n }\n return returnValue;\n }\n else if (operation.op === 'test') {\n returnValue.test = _areEquals(document, operation.value);\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n returnValue.newDocument = document;\n return returnValue;\n }\n else if (operation.op === 'remove') { // a remove on root\n returnValue.removed = document;\n returnValue.newDocument = null;\n return returnValue;\n }\n else if (operation.op === '_get') {\n operation.value = document;\n return returnValue;\n }\n else { /* bad operation */\n if (validateOperation) {\n throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);\n }\n else {\n return returnValue;\n }\n }\n } /* END ROOT OPERATIONS */\n else {\n if (!mutateDocument) {\n document = _deepClone(document);\n }\n var path = operation.path || \"\";\n var keys = path.split('/');\n var obj = document;\n var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift\n var len = keys.length;\n var existingPathFragment = undefined;\n var key = void 0;\n var validateFunction = void 0;\n if (typeof validateOperation == 'function') {\n validateFunction = validateOperation;\n }\n else {\n validateFunction = validator;\n }\n while (true) {\n key = keys[t];\n if (key && key.indexOf('~') != -1) {\n key = unescapePathComponent(key);\n }\n if (banPrototypeModifications &&\n (key == '__proto__' ||\n (key == 'prototype' && t > 0 && keys[t - 1] == 'constructor'))) {\n throw new TypeError('JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');\n }\n if (validateOperation) {\n if (existingPathFragment === undefined) {\n if (obj[key] === undefined) {\n existingPathFragment = keys.slice(0, t).join('/');\n }\n else if (t == len - 1) {\n existingPathFragment = operation.path;\n }\n if (existingPathFragment !== undefined) {\n validateFunction(operation, 0, document, existingPathFragment);\n }\n }\n }\n t++;\n if (Array.isArray(obj)) {\n if (key === '-') {\n key = obj.length;\n }\n else {\n if (validateOperation && !isInteger(key)) {\n throw new JsonPatchError(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\", \"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\", index, operation, document);\n } // only parse key when it's an integer for `arr.prop` to work\n else if (isInteger(key)) {\n key = ~~key;\n }\n }\n if (t >= len) {\n if (validateOperation && operation.op === \"add\" && key > obj.length) {\n throw new JsonPatchError(\"The specified index MUST NOT be greater than the number of elements in the array\", \"OPERATION_VALUE_OUT_OF_BOUNDS\", index, operation, document);\n }\n var returnValue = arrOps[operation.op].call(operation, obj, key, document); // Apply patch\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return returnValue;\n }\n }\n else {\n if (t >= len) {\n var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch\n if (returnValue.test === false) {\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return returnValue;\n }\n }\n obj = obj[key];\n // If we have more keys in the path, but the next value isn't a non-null object,\n // throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.\n if (validateOperation && t < len && (!obj || typeof obj !== \"object\")) {\n throw new JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);\n }\n }\n }\n}\n/**\n * Apply a full JSON Patch array on a JSON document.\n * Returns the {newDocument, result} of the patch.\n * It modifies the `document` object and `patch` - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.\n *\n * @param document The document to patch\n * @param patch The patch to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return An array of `{newDocument, result}` after the patch\n */\nexport function applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) {\n if (mutateDocument === void 0) { mutateDocument = true; }\n if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }\n if (validateOperation) {\n if (!Array.isArray(patch)) {\n throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');\n }\n }\n if (!mutateDocument) {\n document = _deepClone(document);\n }\n var results = new Array(patch.length);\n for (var i = 0, length_1 = patch.length; i < length_1; i++) {\n // we don't need to pass mutateDocument argument because if it was true, we already deep cloned the object, we'll just pass `true`\n results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);\n document = results[i].newDocument; // in case root was replaced\n }\n results.newDocument = document;\n return results;\n}\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the updated document.\n * Suitable as a reducer.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @return The updated document\n */\nexport function applyReducer(document, operation, index) {\n var operationResult = applyOperation(document, operation);\n if (operationResult.test === false) { // failed test\n throw new JsonPatchError(\"Test operation failed\", 'TEST_OPERATION_FAILED', index, operation, document);\n }\n return operationResult.newDocument;\n}\n/**\n * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.\n * @param {object} operation - operation object (patch)\n * @param {number} index - index of operation in the sequence\n * @param {object} [document] - object where the operation is supposed to be applied\n * @param {string} [existingPathFragment] - comes along with `document`\n */\nexport function validator(operation, index, document, existingPathFragment) {\n if (typeof operation !== 'object' || operation === null || Array.isArray(operation)) {\n throw new JsonPatchError('Operation is not an object', 'OPERATION_NOT_AN_OBJECT', index, operation, document);\n }\n else if (!objOps[operation.op]) {\n throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);\n }\n else if (typeof operation.path !== 'string') {\n throw new JsonPatchError('Operation `path` property is not a string', 'OPERATION_PATH_INVALID', index, operation, document);\n }\n else if (operation.path.indexOf('/') !== 0 && operation.path.length > 0) {\n // paths that aren't empty string should start with \"/\"\n throw new JsonPatchError('Operation `path` property must start with \"/\"', 'OPERATION_PATH_INVALID', index, operation, document);\n }\n else if ((operation.op === 'move' || operation.op === 'copy') && typeof operation.from !== 'string') {\n throw new JsonPatchError('Operation `from` property is not present (applicable in `move` and `copy` operations)', 'OPERATION_FROM_REQUIRED', index, operation, document);\n }\n else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {\n throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);\n }\n else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && hasUndefined(operation.value)) {\n throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);\n }\n else if (document) {\n if (operation.op == \"add\") {\n var pathLen = operation.path.split(\"/\").length;\n var existingPathLen = existingPathFragment.split(\"/\").length;\n if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {\n throw new JsonPatchError('Cannot perform an `add` operation at the desired path', 'OPERATION_PATH_CANNOT_ADD', index, operation, document);\n }\n }\n else if (operation.op === 'replace' || operation.op === 'remove' || operation.op === '_get') {\n if (operation.path !== existingPathFragment) {\n throw new JsonPatchError('Cannot perform the operation at a path that does not exist', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);\n }\n }\n else if (operation.op === 'move' || operation.op === 'copy') {\n var existingValue = { op: \"_get\", path: operation.from, value: undefined };\n var error = validate([existingValue], document);\n if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {\n throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);\n }\n }\n }\n}\n/**\n * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.\n * If error is encountered, returns a JsonPatchError object\n * @param sequence\n * @param document\n * @returns {JsonPatchError|undefined}\n */\nexport function validate(sequence, document, externalValidator) {\n try {\n if (!Array.isArray(sequence)) {\n throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');\n }\n if (document) {\n //clone document and sequence so that we can safely try applying operations\n applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true);\n }\n else {\n externalValidator = externalValidator || validator;\n for (var i = 0; i < sequence.length; i++) {\n externalValidator(sequence[i], i, document, undefined);\n }\n }\n }\n catch (e) {\n if (e instanceof JsonPatchError) {\n return e;\n }\n else {\n throw e;\n }\n }\n}\n// based on https://github.com/epoberezkin/fast-deep-equal\n// MIT License\n// Copyright (c) 2017 Evgeny Poberezkin\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\nexport function _areEquals(a, b) {\n if (a === b)\n return true;\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;\n if (arrA && arrB) {\n length = a.length;\n if (length != b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (!_areEquals(a[i], b[i]))\n return false;\n return true;\n }\n if (arrA != arrB)\n return false;\n var keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length)\n return false;\n for (i = length; i-- !== 0;)\n if (!b.hasOwnProperty(keys[i]))\n return false;\n for (i = length; i-- !== 0;) {\n key = keys[i];\n if (!_areEquals(a[key], b[key]))\n return false;\n }\n return true;\n }\n return a !== a && b !== b;\n}\n;\n","/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2021 Joachim Wester\n * MIT license\n */\nimport { _deepClone, _objectKeys, escapePathComponent, hasOwnProperty } from './helpers.mjs';\nimport { applyPatch } from './core.mjs';\nvar beforeDict = new WeakMap();\nvar Mirror = /** @class */ (function () {\n function Mirror(obj) {\n this.observers = new Map();\n this.obj = obj;\n }\n return Mirror;\n}());\nvar ObserverInfo = /** @class */ (function () {\n function ObserverInfo(callback, observer) {\n this.callback = callback;\n this.observer = observer;\n }\n return ObserverInfo;\n}());\nfunction getMirror(obj) {\n return beforeDict.get(obj);\n}\nfunction getObserverFromMirror(mirror, callback) {\n return mirror.observers.get(callback);\n}\nfunction removeObserverFromMirror(mirror, observer) {\n mirror.observers.delete(observer.callback);\n}\n/**\n * Detach an observer from an object\n */\nexport function unobserve(root, observer) {\n observer.unobserve();\n}\n/**\n * Observes changes made to an object, which can then be retrieved using generate\n */\nexport function observe(obj, callback) {\n var patches = [];\n var observer;\n var mirror = getMirror(obj);\n if (!mirror) {\n mirror = new Mirror(obj);\n beforeDict.set(obj, mirror);\n }\n else {\n var observerInfo = getObserverFromMirror(mirror, callback);\n observer = observerInfo && observerInfo.observer;\n }\n if (observer) {\n return observer;\n }\n observer = {};\n mirror.value = _deepClone(obj);\n if (callback) {\n observer.callback = callback;\n observer.next = null;\n var dirtyCheck = function () {\n generate(observer);\n };\n var fastCheck = function () {\n clearTimeout(observer.next);\n observer.next = setTimeout(dirtyCheck);\n };\n if (typeof window !== 'undefined') { //not Node\n window.addEventListener('mouseup', fastCheck);\n window.addEventListener('keyup', fastCheck);\n window.addEventListener('mousedown', fastCheck);\n window.addEventListener('keydown', fastCheck);\n window.addEventListener('change', fastCheck);\n }\n }\n observer.patches = patches;\n observer.object = obj;\n observer.unobserve = function () {\n generate(observer);\n clearTimeout(observer.next);\n removeObserverFromMirror(mirror, observer);\n if (typeof window !== 'undefined') {\n window.removeEventListener('mouseup', fastCheck);\n window.removeEventListener('keyup', fastCheck);\n window.removeEventListener('mousedown', fastCheck);\n window.removeEventListener('keydown', fastCheck);\n window.removeEventListener('change', fastCheck);\n }\n };\n mirror.observers.set(callback, new ObserverInfo(callback, observer));\n return observer;\n}\n/**\n * Generate an array of patches from an observer\n */\nexport function generate(observer, invertible) {\n if (invertible === void 0) { invertible = false; }\n var mirror = beforeDict.get(observer.object);\n _generate(mirror.value, observer.object, observer.patches, \"\", invertible);\n if (observer.patches.length) {\n applyPatch(mirror.value, observer.patches);\n }\n var temp = observer.patches;\n if (temp.length > 0) {\n observer.patches = [];\n if (observer.callback) {\n observer.callback(temp);\n }\n }\n return temp;\n}\n// Dirty check if obj is different from mirror, generate patches and update mirror\nfunction _generate(mirror, obj, patches, path, invertible) {\n if (obj === mirror) {\n return;\n }\n if (typeof obj.toJSON === \"function\") {\n obj = obj.toJSON();\n }\n var newKeys = _objectKeys(obj);\n var oldKeys = _objectKeys(mirror);\n var changed = false;\n var deleted = false;\n //if ever \"move\" operation is implemented here, make sure this test runs OK: \"should not generate the same patch twice (move)\"\n for (var t = oldKeys.length - 1; t >= 0; t--) {\n var key = oldKeys[t];\n var oldVal = mirror[key];\n if (hasOwnProperty(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {\n var newVal = obj[key];\n if (typeof oldVal == \"object\" && oldVal != null && typeof newVal == \"object\" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {\n _generate(oldVal, newVal, patches, path + \"/\" + escapePathComponent(key), invertible);\n }\n else {\n if (oldVal !== newVal) {\n changed = true;\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(oldVal) });\n }\n patches.push({ op: \"replace\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(newVal) });\n }\n }\n }\n else if (Array.isArray(mirror) === Array.isArray(obj)) {\n if (invertible) {\n patches.push({ op: \"test\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(oldVal) });\n }\n patches.push({ op: \"remove\", path: path + \"/\" + escapePathComponent(key) });\n deleted = true; // property has been deleted\n }\n else {\n if (invertible) {\n patches.push({ op: \"test\", path: path, value: mirror });\n }\n patches.push({ op: \"replace\", path: path, value: obj });\n changed = true;\n }\n }\n if (!deleted && newKeys.length == oldKeys.length) {\n return;\n }\n for (var t = 0; t < newKeys.length; t++) {\n var key = newKeys[t];\n if (!hasOwnProperty(mirror, key) && obj[key] !== undefined) {\n patches.push({ op: \"add\", path: path + \"/\" + escapePathComponent(key), value: _deepClone(obj[key]) });\n }\n }\n}\n/**\n * Create an array of patches from the differences in two objects\n */\nexport function compare(tree1, tree2, invertible) {\n if (invertible === void 0) { invertible = false; }\n var patches = [];\n _generate(tree1, tree2, patches, '', invertible);\n return patches;\n}\n","export * from './module/core.mjs';\nexport * from './module/duplex.mjs';\nexport {\n PatchError as JsonPatchError,\n _deepClone as deepClone,\n escapePathComponent,\n unescapePathComponent\n} from './module/helpers.mjs';\n\n\n/**\n * Default export for backwards compat\n */\n\nimport * as core from './module/core.mjs';\nimport * as duplex from './module/duplex.mjs';\nimport {\n PatchError as JsonPatchError,\n _deepClone as deepClone,\n escapePathComponent,\n unescapePathComponent\n} from './module/helpers.mjs';\n\nexport default Object.assign({}, core, duplex, {\n JsonPatchError,\n deepClone,\n escapePathComponent,\n unescapePathComponent\n});","export const VERSION = '1.4.0';\n","export function dateReviver(_: string, value: unknown): unknown {\n const dateRegex = /(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})/;\n if (typeof value == 'string' && dateRegex.test(value)) {\n return new Date(value);\n }\n return value;\n}\n","export function isBoardEvent(object: unknown): object is T {\n return typeof object === 'object' && object !== null && 'board' in object;\n}\n","import * as jsonpatch from 'fast-json-patch';\nimport { useEffect, useRef, useState } from 'react';\nimport {\n DEPARTURE_PAGING_DEFAULT,\n DEPARTURE_TIME_FORMAT_DEFAULT,\n DEPARTURES_TIME_SPAN_DEFAULT,\n SECONDS_BETWEEN_ALIVE_MESSAGES,\n SECONDS_BETWEEN_EVENT_SOURCE_RECONNECTION_ATTEMPTS,\n SECONDS_OF_ERROR_BEFORE_SHOWING_ERROR_MESSAGE,\n SECONDS_OF_MAX_EXPECTED_SERVER_STARTUP_TIME,\n SECONDS_OF_MAXIMUM_EXPECTED_LATENCY,\n} from '@shared/constants';\nimport { VERSION } from '../../version';\nimport { dateReviver } from '@shared/utils/dateReviver';\nimport { BoardConfiguration } from '@shared/models/boardConfiguration';\nimport { DepartureOrArrivalRowsError } from '@shared/models/events/departureOrArrivalRowsError';\nimport { ResourcesSet } from '@shared/models/events/resourcesSet';\nimport { NewStopBoardHeader } from '@shared/models/events/newStopBoardHeader';\nimport { isBoardEvent } from '@shared/utils/isBoardEvent';\nimport { DepartureOrArrivalRowsErrorResolved } from '@shared/models/events/departureOrArrivalRowsErrorResolved';\nimport { BoardEvent } from '@shared/models/boardEvent';\nimport { ResourcesAdded } from '@shared/models/events/resourcesAdded';\nimport { ResourcesUpdated } from '@shared/models/events/resourcesUpdated';\nimport { Resource } from '@shared/models/resource';\nimport { ResourcesRemoved } from '@shared/models/events/resourcesRemoved';\nimport { BoardId } from '@shared/models/boardId';\nimport { logError } from '@shared/utils/errorLogging';\nimport { BoardState } from '@shared/models/BoardState';\n\nexport function useServerSentEvents(\n boards: BoardConfiguration[] | undefined,\n setBoardStates: React.Dispatch>>\n) {\n const hasConnectionErrorTimerId = useRef(undefined);\n const [hasConnectionError, setHasConnectionError] = useState(false);\n const [connectionErrorCount, setConnectionErrorCount] = useState(0);\n\n function setHasConnectionErrorTimer() {\n if (hasConnectionErrorTimerId.current) {\n return;\n }\n hasConnectionErrorTimerId.current = window.setTimeout(() => {\n setHasConnectionError(true);\n }, SECONDS_OF_ERROR_BEFORE_SHOWING_ERROR_MESSAGE * 1000);\n }\n\n function clearHasConnectionErrorTimer() {\n window.clearTimeout(hasConnectionErrorTimerId.current);\n hasConnectionErrorTimerId.current = undefined;\n }\n\n useEffect(() => {\n if (\n !boards ||\n boards.filter((board) => board.type !== 'vehicle').length === 0\n ) {\n return;\n }\n\n let lastAliveMessageTime = Date.now();\n\n let retryConnectionTimerId: number | undefined;\n const boardDepartureRowsErrorTimerIds = new Array();\n\n function retryConnection() {\n setConnectionErrorCount((previousErrorCount) => previousErrorCount + 1);\n }\n\n function closeWaitAndRetryConnection(error: string) {\n console.error(\n `Resetting connection in ${SECONDS_BETWEEN_EVENT_SOURCE_RECONNECTION_ATTEMPTS} seconds due to error: ${error}`\n );\n\n eventSource.close();\n\n setRetryConnectionTimer();\n }\n\n function setRetryConnectionTimer() {\n if (retryConnectionTimerId) {\n return;\n }\n\n retryConnectionTimerId = window.setTimeout(() => {\n retryConnection();\n retryConnectionTimerId = undefined;\n }, SECONDS_BETWEEN_EVENT_SOURCE_RECONNECTION_ATTEMPTS * 1000);\n }\n\n function getOrCreateBoardState(\n boardId: BoardId,\n boardStates: Map\n ): BoardState {\n let boardState = boardStates.get(boardId);\n if (!boardState) {\n boardState = { boardId: boardId, configurationId: boardId };\n boardStates.set(boardId, boardState);\n }\n\n return boardState;\n }\n\n function getEvent(data: unknown): TEvent | undefined {\n if (!data || typeof data !== 'string') {\n return undefined;\n }\n try {\n const event: unknown = JSON.parse(data, dateReviver);\n return isBoardEvent(event) ? event : undefined;\n } catch (error) {\n logError(error);\n return undefined;\n }\n }\n\n function handleBoardEvent(\n e: MessageEvent,\n eventHandler: (event: TEvent, boardState: BoardState) => void\n ): void {\n const event = getEvent(e.data);\n if (!event) {\n closeWaitAndRetryConnection('Failed to parse event');\n return;\n }\n setBoardStates((previousBoardStates) => {\n const newBoardStates = structuredClone(previousBoardStates);\n const boardState = getOrCreateBoardState(event.board, newBoardStates);\n eventHandler(event, boardState);\n return newBoardStates;\n });\n }\n\n function registerResourceEventHandlers(\n resourceName: 'departureRow' | 'arrivalRow' | 'trafficSituation',\n getResources: (\n boardState: BoardState\n ) => readonly TResource[] | undefined,\n setResources: (boardState: BoardState, newResources: TResource[]) => void\n ): void {\n eventSource.addEventListener(`${resourceName}sSet`, (e) => {\n handleBoardEvent>(e, (event, boardState) => {\n setResources(boardState, event.set);\n if (\n (resourceName === 'departureRow' ||\n resourceName === 'arrivalRow') &&\n event.error\n ) {\n boardState.departureOrArrivalRowsError = true;\n }\n });\n });\n\n eventSource.addEventListener(`${resourceName}sAdded`, (e) => {\n handleBoardEvent>(e, (event, boardState) => {\n const resources = getResources(boardState);\n if (!resources) {\n setResources(boardState, [...event.added]);\n } else {\n setResources(boardState, [...resources, ...event.added]);\n }\n });\n });\n\n eventSource.addEventListener(`${resourceName}sUpdated`, (e) => {\n handleBoardEvent(e, (event, boardState) => {\n const resources = getResources(boardState);\n if (!resources) {\n closeWaitAndRetryConnection(\n `Expected ${resourceName}s not found for board ${event.board}`\n );\n return;\n }\n\n const newResources = [...structuredClone(resources)];\n\n for (const update of event.updates) {\n const [id, patch] = update;\n const resource = newResources.find((row) => row.id === id);\n if (resource === undefined) {\n closeWaitAndRetryConnection(\n `Expected ${resourceName} not found ${id}`\n );\n return;\n }\n\n jsonpatch.applyPatch(resource, patch).newDocument;\n }\n setResources(boardState, newResources);\n });\n });\n\n eventSource.addEventListener(`${resourceName}sRemoved`, (e) => {\n handleBoardEvent(e, (event, boardState) => {\n const resources = getResources(boardState);\n if (!resources) {\n closeWaitAndRetryConnection(\n `Expected ${resourceName}s not found for board ${event.board}`\n );\n return;\n }\n\n const newResources = resources.filter(\n (resource) => !event.ids.includes(resource.id)\n );\n setResources(boardState, newResources);\n });\n });\n }\n\n function addGid(\n urlSearchParams: URLSearchParams,\n boardId: BoardId,\n gid: string\n ) {\n urlSearchParams.append(`board${boardId}Gids`, gid);\n }\n\n const checkEventsAliveIntervalId = window.setInterval(() => {\n const secondsSinceLastAliveMessage =\n (Date.now() - lastAliveMessageTime) / 1000;\n if (\n secondsSinceLastAliveMessage >=\n SECONDS_BETWEEN_ALIVE_MESSAGES + SECONDS_OF_MAXIMUM_EXPECTED_LATENCY\n ) {\n setHasConnectionErrorTimer();\n retryConnection();\n }\n }, (SECONDS_BETWEEN_ALIVE_MESSAGES / 10) * 1000);\n\n const eventsUrlSearchParams = new URLSearchParams();\n for (const board of boards) {\n if (board.type === 'stop-area') {\n addGid(eventsUrlSearchParams, board.id, board.stopAreaGid);\n } else if (board.type === 'stop-points') {\n for (const stopPointGid of board.stopPointGids) {\n addGid(eventsUrlSearchParams, board.id, stopPointGid);\n }\n }\n for (const module of board.modules) {\n eventsUrlSearchParams.append(`board${board.id}Modules`, module);\n }\n if (board.type === 'stop-area' || board.type === 'stop-points') {\n if (\n board.departurePaging !== undefined &&\n board.departurePaging !== DEPARTURE_PAGING_DEFAULT\n ) {\n eventsUrlSearchParams.append(\n `board${board.id}DeparturePaging`,\n board.departurePaging.toString()\n );\n }\n if (\n board.departureTimeFormat !== undefined &&\n board.departureTimeFormat !== DEPARTURE_TIME_FORMAT_DEFAULT\n ) {\n eventsUrlSearchParams.append(\n `board${board.id}DepartureTimeFormat`,\n board.departureTimeFormat\n );\n }\n if (\n board.departureTimeSpan !== undefined &&\n board.departureTimeSpan !== DEPARTURES_TIME_SPAN_DEFAULT\n ) {\n eventsUrlSearchParams.append(\n `board${board.id}DepartureTimeSpan`,\n board.departureTimeSpan\n );\n }\n }\n }\n\n const urlParams = new URLSearchParams(window.location.search);\n const id = urlParams.get('id');\n if (id) {\n eventsUrlSearchParams.append('id', id);\n }\n const type = urlParams.get('type');\n if (type) {\n eventsUrlSearchParams.append('type', type);\n }\n\n const eventsUrl = `api/events?${eventsUrlSearchParams.toString()}`;\n\n const eventSource = new EventSource(eventsUrl);\n\n eventSource.addEventListener('open', () => {\n lastAliveMessageTime = Date.now();\n setHasConnectionError(false);\n clearHasConnectionErrorTimer();\n });\n\n eventSource.addEventListener('error', () => {\n // Retry if the event source is closed\n // This is meant to handle 404 and 500 response returned on server issues\n // This will unfortunately also catch 400 response on bad configuration, if this turns out to be an issue we could use @microsoft/fetch-event-source instead\n if (eventSource.readyState === EventSource.CLOSED) {\n setHasConnectionErrorTimer();\n setRetryConnectionTimer();\n }\n });\n\n eventSource.addEventListener('version', (e) => {\n // Reload on non-matching version\n if (e.data !== VERSION) {\n setTimeout(() => {\n location.reload();\n }, SECONDS_OF_MAX_EXPECTED_SERVER_STARTUP_TIME * 1000);\n }\n });\n\n eventSource.addEventListener('message', () => {\n // Empty messages with no event field are used as alive message to know early if connection is lost\n lastAliveMessageTime = Date.now();\n });\n\n eventSource.addEventListener('newStopBoardHeader', (e) => {\n handleBoardEvent(e, (event, boardState) => {\n boardState.header = event.header;\n });\n });\n\n function onDepartureOrArrivalRowsError(e: MessageEvent): void {\n handleBoardEvent(e, (event) => {\n const boardId = event.board;\n const timerId = boardDepartureRowsErrorTimerIds[boardId];\n if (timerId) {\n return;\n }\n boardDepartureRowsErrorTimerIds[boardId] = window.setTimeout(() => {\n handleBoardEvent(e, (_, boardState) => {\n boardState.departureOrArrivalRowsError = true;\n });\n }, SECONDS_OF_ERROR_BEFORE_SHOWING_ERROR_MESSAGE * 1000);\n });\n }\n\n eventSource.addEventListener(\n 'departureRowsError',\n onDepartureOrArrivalRowsError\n );\n eventSource.addEventListener(\n 'arrivalRowsError',\n onDepartureOrArrivalRowsError\n );\n\n function onDeparturesOrArrivalsErrorResolved(e: MessageEvent): void {\n handleBoardEvent(\n e,\n (event, boardState) => {\n const timerId = boardDepartureRowsErrorTimerIds[event.board];\n if (timerId) {\n window.clearTimeout(timerId);\n boardDepartureRowsErrorTimerIds[event.board] = undefined;\n }\n\n boardState.departureOrArrivalRowsError = undefined;\n }\n );\n }\n\n eventSource.addEventListener(\n 'departureRowsErrorResolved',\n onDeparturesOrArrivalsErrorResolved\n );\n eventSource.addEventListener(\n 'arrivalRowsErrorResolved',\n onDeparturesOrArrivalsErrorResolved\n );\n\n registerResourceEventHandlers(\n 'departureRow',\n (boardState) => boardState.departureRows,\n (boardState, newDepartureRows) =>\n (boardState.departureRows = newDepartureRows)\n );\n registerResourceEventHandlers(\n 'arrivalRow',\n (boardState) => boardState.arrivalRows,\n (boardState, newArrivalRows) => (boardState.arrivalRows = newArrivalRows)\n );\n registerResourceEventHandlers(\n 'trafficSituation',\n (boardState) => boardState.trafficSituations,\n (boardState, newtrafficSituations) =>\n (boardState.trafficSituations = newtrafficSituations)\n );\n\n return () => {\n eventSource.close();\n window.clearTimeout(retryConnectionTimerId);\n window.clearInterval(checkEventsAliveIntervalId);\n for (const timerId of boardDepartureRowsErrorTimerIds) {\n if (!timerId) {\n continue;\n }\n window.clearTimeout(timerId);\n }\n };\n }, [boards, connectionErrorCount, setBoardStates]);\n\n return { hasConnectionError };\n}\n","import { BoardConfiguration } from '@shared/models/boardConfiguration';\nimport { BoardState } from '@shared/models/BoardState';\nimport { useEffect } from 'react';\nimport { ServiceJourney } from 'src/modules/vehicle/models/serviceJourney';\n\nexport function useMqtt(\n boards: BoardConfiguration[] | undefined,\n setBoardStates: React.Dispatch>>\n) {\n useEffect(() => {\n if (\n boards === undefined ||\n !boards.some((board) => board.type === 'vehicle')\n ) {\n return;\n }\n\n function createMockServiceJourney(): ServiceJourney {\n return {\n id: '1',\n line: {\n shortName: '1337',\n backgroundColor: '#0000FF',\n foregroundColor: '#FFFF00',\n },\n direction: {\n name: 'The Moon',\n },\n stops: [\n {\n stopPointGid: '0',\n name: 'Hjalmar Brantingsplatsen',\n departureTime: new Date(Date.now() + 1000 * 60 * 1),\n },\n {\n stopPointGid: '1',\n name: 'Tanum Shoppingscenter',\n plannedArrivalTime: new Date(Date.now() + 1000 * 60 * 5),\n },\n {\n stopPointGid: '1',\n name: 'Andra försenade stoppet',\n plannedArrivalTime: new Date(Date.now() + 1000 * 60 * 7),\n arrivalTime: new Date(Date.now() + 1000 * 60 * 8),\n },\n {\n stopPointGid: '2',\n name: 'Tredje inställda stoppet',\n plannedArrivalTime: new Date(Date.now() + 1000 * 60 * 10),\n isCancelled: true,\n },\n {\n stopPointGid: '3',\n name: 'Fjärde stoppet',\n plannedArrivalTime: new Date(Date.now() + 1000 * 60 * 15),\n },\n {\n stopPointGid: '4',\n name: 'Femte stoppet',\n plannedArrivalTime: new Date(Date.now() + 1000 * 60 * 20),\n },\n {\n stopPointGid: '5',\n name: 'Ändhållplats',\n plannedArrivalTime: new Date(Date.now() + 1000 * 60 * 25),\n },\n ],\n currentStopIndex: 0,\n isAtStop: false,\n };\n }\n\n function moveCurrentStop(): void {\n setBoardStates((previousBoardStates) => {\n const newBoardStates = structuredClone(previousBoardStates);\n newBoardStates.forEach((boardState) => {\n if (boardState.serviceJourney !== undefined) {\n const previousStopIndex =\n boardState.serviceJourney.currentStopIndex;\n const previousStop =\n boardState.serviceJourney.stops[previousStopIndex];\n if (previousStop) {\n previousStop.arrivalTime =\n previousStop.arrivalTime ??\n previousStop.plannedArrivalTime ??\n previousStop.departureTime;\n previousStop.departureTime = undefined;\n previousStop.plannedArrivalTime = undefined;\n }\n\n boardState.serviceJourney.currentStopIndex =\n (boardState.serviceJourney.currentStopIndex + 1) %\n boardState.serviceJourney.stops.length;\n\n const currentStop =\n boardState.serviceJourney.stops[\n boardState.serviceJourney.currentStopIndex\n ];\n if (currentStop?.isCancelled) {\n currentStop.arrivalTime = currentStop.plannedArrivalTime;\n boardState.serviceJourney.currentStopIndex =\n (boardState.serviceJourney.currentStopIndex + 1) %\n boardState.serviceJourney.stops.length;\n }\n\n if (boardState.serviceJourney.currentStopIndex === 0) {\n boardState.serviceJourney = createMockServiceJourney();\n }\n }\n });\n return newBoardStates;\n });\n }\n\n const moveStopIntervalId = window.setInterval(moveCurrentStop, 2000);\n\n const vehicleBoardIds = boards\n .filter((board) => board.type === 'vehicle')\n .map((board) => board.id);\n\n setBoardStates((previousBoardStates) => {\n const newBoardStates = new Map(previousBoardStates);\n\n vehicleBoardIds.forEach((boardId) => {\n newBoardStates.set(boardId, {\n boardId: boardId,\n configurationId: boardId,\n serviceJourney: createMockServiceJourney(),\n });\n });\n\n return newBoardStates;\n });\n\n return () => {\n window.clearInterval(moveStopIntervalId);\n setBoardStates((previousBoardStates) => {\n const newBoardStates = new Map(previousBoardStates);\n\n vehicleBoardIds.forEach((boardId) => {\n newBoardStates.delete(boardId);\n });\n\n return newBoardStates;\n });\n };\n }, [boards, setBoardStates]);\n}\n","import { useEffect, useState } from 'react';\nimport { BoardConfiguration } from '../models/boardConfiguration';\nimport { BoardId } from '../models/boardId';\nimport { useServerSentEvents } from './useServerSentEvents';\nimport { BoardState } from '@shared/models/BoardState';\nimport { useMqtt } from './useMqtt';\n\nexport function useBoardStates(boards: BoardConfiguration[] | undefined) {\n const [boardStates, setBoardStates] = useState(\n new Map()\n );\n\n useEffect(() => {\n setBoardStates(new Map());\n }, [boards]);\n\n const { hasConnectionError } = useServerSentEvents(boards, setBoardStates);\n useMqtt(boards, setBoardStates);\n\n return { hasConnectionError, boardStates: [...boardStates.values()] };\n}\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","/**\n * Sets the maximum font size for a text to fit in a container.\n *\n * @param container The container to fit text for.\n * @param singleLine Controls if line breaks between words are allowed or not.\n */\nexport function setMaxFontSize(\n container: HTMLElement,\n singleLine: boolean,\n reservedSpace?: number\n): void {\n const computedStyle = window.getComputedStyle(container);\n const fontFamily = computedStyle.getPropertyValue('font-family');\n const fontWeight = computedStyle.getPropertyValue('font-weight');\n const containerPaddingLeft = parseFloat(\n computedStyle.getPropertyValue('padding-left')\n );\n const containerPaddingRight = parseFloat(\n computedStyle.getPropertyValue('padding-right')\n );\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return;\n }\n const defaultFontSize = parseFloat(\n computedStyle.getPropertyValue('font-size')\n );\n ctx.font = `${fontWeight} ${defaultFontSize}px ${fontFamily}`;\n if (!container.textContent) {\n return;\n }\n const texts = singleLine\n ? [container.textContent]\n : container.textContent.split(' ');\n let widest = texts\n .map((textToMeasure) => {\n return {\n text: textToMeasure,\n width: ctx.measureText(textToMeasure).width,\n };\n })\n .sort((first, second) => second.width - first.width)[0];\n if (!widest) {\n return;\n }\n const containerWidth =\n container.getBoundingClientRect().width -\n (containerPaddingLeft + containerPaddingRight);\n\n const fullTextWidth = ctx.measureText(container.textContent).width;\n if (fullTextWidth <= containerWidth) {\n widest = {\n text: container.textContent,\n width: fullTextWidth,\n };\n }\n\n const availableWidth = containerWidth - (reservedSpace ?? 0);\n\n // Only use 99% of theoretically available space to take rounding errors into consideration\n const maxFontSize = (availableWidth / widest.width) * defaultFontSize * 0.99;\n let fontSize = Math.min(defaultFontSize, maxFontSize);\n\n // In Firefox for small sizes of fonts where there are large discrete jumps between sizes we might still end up with a font-size that is too large\n let fontFits = false;\n do {\n ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;\n const widthInFontSize = ctx.measureText(widest.text).width;\n fontFits = widthInFontSize + 1 <= availableWidth;\n if (!fontFits) {\n fontSize -= 1;\n }\n } while (!fontFits && fontSize > 1);\n\n container.style.setProperty('font-size', `${fontSize}px`);\n}\n","import { RefObject, useEffect } from 'react';\nimport { setMaxFontSize } from '../utils/maxFontSize';\n\ninterface ScaledFontSizeOptions {\n /** Controls if line breaks between words are allowed or not. Default is false. */\n singleLine?: boolean;\n\n /** Controls if the scaling should happen at all, for conditional cases */\n enabled?: boolean;\n\n /** Reserved space for other elements */\n reservedSpace?: number;\n}\n\n/**\n * Handles automatic text scale-to-fit for an element.\n *\n * @param elementReference A reference to the element.\n */\nexport function useScaledFontSize(\n elementReference: RefObject,\n { singleLine, enabled, reservedSpace }: ScaledFontSizeOptions = {}\n): void {\n useEffect(() => {\n if (enabled === false || elementReference.current === null) {\n return;\n }\n\n trySetMaxFontSize();\n\n const resizeObserver = new ResizeObserver(() => {\n requestAnimationFrame(() => {\n trySetMaxFontSize();\n });\n });\n resizeObserver.observe(elementReference.current);\n\n const rootStyleObserver = new MutationObserver(trySetMaxFontSize);\n rootStyleObserver.observe(document.documentElement, {\n attributeFilter: ['style'],\n });\n\n const classObserver = new MutationObserver(trySetMaxFontSize);\n classObserver.observe(elementReference.current, {\n attributeFilter: ['class'],\n });\n\n function trySetMaxFontSize(): void {\n if (!elementReference.current) {\n return;\n }\n\n // Reset potential font size set by setMaxFontSize\n elementReference.current.style.fontSize = '';\n\n setMaxFontSize(\n elementReference.current,\n singleLine ?? false,\n reservedSpace\n );\n }\n\n return () => {\n resizeObserver.disconnect();\n rootStyleObserver.disconnect();\n classObserver.disconnect();\n };\n }, [elementReference, singleLine, enabled, reservedSpace]);\n}\n","import { useRef } from 'react';\nimport { useScaledFontSize } from '@shared/hooks/useScaledFontSize';\nimport { Line } from '@shared/models/line';\nimport styles from './DepartureOrArrivalTableLineCell.module.scss';\n\ninterface DepartureOrArrivalTableLineCellProps {\n line: Line;\n}\n\nexport default function DepartureOrArrivalTableLineCell({\n line,\n}: DepartureOrArrivalTableLineCellProps) {\n const lineNameRef = useRef(null);\n useScaledFontSize(lineNameRef);\n\n return (\n \n \n {line.shortName}\n \n \n );\n}\n","export default \"data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='46px'%20height='46px'%20viewBox='0%200%2046%2046'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3c!--%20Generator:%20Sketch%2055.2%20(78181)%20-%20https://sketchapp.com%20--%3e%3ctitle%3eOval%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cg%20id='Page-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M23,43%20C28.3616631,43%2033.230552,40.8901828%2036.8217419,37.4554731%20C40.6288512,33.8142523%2043,28.6840319%2043,23%20C43,11.954305%2034.045695,3%2023,3%20C11.954305,3%203,11.954305%203,23'%20id='Oval'%20stroke='%23FFFFFF'%20stroke-width='5'%20transform='translate(23.000000,%2023.000000)%20rotate(-45.000000)%20translate(-23.000000,%20-23.000000)%20'%3e%3c/path%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='46px'%20height='46px'%20viewBox='0%200%2046%2046'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3c!--%20Generator:%20Sketch%2055.2%20(78181)%20-%20https://sketchapp.com%20--%3e%3ctitle%3eOval%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cg%20id='Page-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M23,43%20C28.3616631,43%2033.230552,40.8901828%2036.8217419,37.4554731%20C40.6288512,33.8142523%2043,28.6840319%2043,23%20C43,11.954305%2034.045695,3%2023,3%20C11.954305,3%203,11.954305%203,23'%20id='Oval'%20stroke='%232F3942'%20stroke-width='5'%20transform='translate(23.000000,%2023.000000)%20rotate(-45.000000)%20translate(-23.000000,%20-23.000000)%20'%3e%3c/path%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20id='Lager_1'%20data-name='Lager%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20380.19%2074.92'%3e%3cdefs%3e%3cstyle%3e.cls-1{fill:%23fff;}.cls-2{fill:none;}%3c/style%3e%3c/defs%3e%3ctitle%3evt_logo_vit_space%3c/title%3e%3cpath%20class='cls-1'%20d='M346.25,134.23h9.35L360.24,159h0.13l4.84-24.79h9l-9.09,33H355Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M397.95,121.61v7.06h-7.26v-7.06h7.26Zm-11.58,0v7.06h-7.26v-7.06h7.26ZM383.88,157c0,2.35.39,5.23,3.4,5.23,5.43,0,4.58-7.33,4.58-10.92C387.28,151.5,383.88,151.11,383.88,157Zm17,4.12c0,2,.26,4.12.46,6.15h-8.57l-0.39-4.38h-0.13a9.15,9.15,0,0,1-8.63,5c-6.41,0-8.76-4.78-8.76-10.53,0-10.92,8.44-11.38,17-11.25v-2.55c0-2.81-.39-4.84-3.73-4.84s-3.47,2.42-3.47,5h-9c0-4,1.24-6.54,3.4-8s5.1-2.16,8.63-2.16c11.71,0,13.21,5,13.21,11.05v16.48Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M413.13,156.67a9.45,9.45,0,0,0,.46,4c0.52,1,1.5,1.57,3.34,1.57a3.22,3.22,0,0,0,3.4-3.4c0-7-16.22-5.43-16.22-16,0-7.13,7.06-9.29,13-9.29,6.28,0,12,3,11.45,10.14h-9c0-2.29-.26-3.66-0.92-4.25a3.1,3.1,0,0,0-2.35-.72c-2,0-3.14,1.31-3.14,3.53,0,5.23,16.22,5,16.22,15.57,0,5.76-4.71,10.07-12.36,10.07-8,0-13.41-2-12.89-11.25h9Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M430.27,134.23H434V129l9.22-4.12v9.35H448v5.69h-4.78v17.66c0,2.49-.07,4.12,2.94,4.12a6.33,6.33,0,0,0,1.63-.13v5.69a37.78,37.78,0,0,1-4.78.33c-8,0-9-5.3-9-7.33V139.92h-3.73v-5.69Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M447.87,134.23h3.73V129l9.22-4.12v9.35h4.78v5.69h-4.78v17.66c0,2.49-.06,4.12,2.94,4.12a6.33,6.33,0,0,0,1.64-.13v5.69a37.81,37.81,0,0,1-4.78.33c-8,0-9-5.3-9-7.33V139.92h-3.73v-5.69Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M477.93,134.23v4.25h0.13c1.7-3.79,4.84-4.91,8.57-4.91v8.24c-8.11-.52-8.24,4.19-8.24,7.46v18h-9.22v-33h8.77Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M513,161.12c0,2,.26,4.12.46,6.15h-8.57l-0.39-4.38h-0.13a9.15,9.15,0,0,1-8.63,5c-6.41,0-8.76-4.78-8.76-10.53,0-10.92,8.44-11.38,17-11.25v-2.55c0-2.81-.39-4.84-3.73-4.84s-3.47,2.42-3.47,5h-9c0-4,1.24-6.54,3.4-8s5.1-2.16,8.63-2.16c11.71,0,13.21,5,13.21,11.05v16.48ZM496,157c0,2.35.39,5.23,3.4,5.23,5.43,0,4.58-7.33,4.58-10.92C499.38,151.5,496,151.11,496,157Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M532.4,128.89c-3.93,0-4.37.43-4.37,2.95v2.36h4.37v6H528v27.08h-9.24V140.19h-4.16v-6h4.16c-0.06-9.49-.76-12.9,10.49-12.9,1.11,0,2,.07,3.12.14v7.45Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M545.4,167.27h-9.22v-33h9.22v33Zm0-45.63v7.26h-9.22v-7.26h9.22Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M550.21,167.27l0-45.68h9.28v26.58h0.13l8.31-13.93h9.62L568.13,149l10.4,18.32h-10.4l-8.57-18h-0.13v18h-9.22Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M342,134c-21,1.36-35.13,15.61-35.13,15.61A101.53,101.53,0,0,0,298.1,142,67.13,67.13,0,0,0,304,118.46s14.66,2.91,21.57,16.88q2.21-.53,4.61-0.89a36.74,36.74,0,0,0-61.83-7.56c-15.88-4.26-27.2-1.79-27.2-1.79,49.11,10,65.56,51,65.56,51,7-16.49,14.94-26.69,21.54-32.91a39.59,39.59,0,0,1,.8,6.53s0.65,11.63-7.59,20.75a31.69,31.69,0,0,1-24.54,11.41,32.07,32.07,0,0,1-25.49-12.5s9-3.66,17.55-13.41q-1.81-1.71-3.63-3.32a54.09,54.09,0,0,1-16.47,12.73,32.05,32.05,0,0,1-2-26.79q-2-1.33-4-2.53a36.76,36.76,0,1,0,69.31,3.72C338,135.25,342,134,342,134Zm-68.86-5.7c4.71-5.22,13-11.22,26.11-10.56a58.36,58.36,0,0,1-5.2,21.21A83.67,83.67,0,0,0,273.16,128.35Z'%20transform='translate(-241.16%20-111.87)'/%3e%3crect%20class='cls-2'%20x='0.19'%20width='380'%20height='74.92'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20id='Lager_1'%20data-name='Lager%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20380.19%2074.92'%3e%3cdefs%3e%3cstyle%3e.cls-1{fill:%23000;}.cls-2{fill:none;}%3c/style%3e%3c/defs%3e%3ctitle%3evt_logo_vit_space%3c/title%3e%3cpath%20class='cls-1'%20d='M346.25,134.23h9.35L360.24,159h0.13l4.84-24.79h9l-9.09,33H355Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M397.95,121.61v7.06h-7.26v-7.06h7.26Zm-11.58,0v7.06h-7.26v-7.06h7.26ZM383.88,157c0,2.35.39,5.23,3.4,5.23,5.43,0,4.58-7.33,4.58-10.92C387.28,151.5,383.88,151.11,383.88,157Zm17,4.12c0,2,.26,4.12.46,6.15h-8.57l-0.39-4.38h-0.13a9.15,9.15,0,0,1-8.63,5c-6.41,0-8.76-4.78-8.76-10.53,0-10.92,8.44-11.38,17-11.25v-2.55c0-2.81-.39-4.84-3.73-4.84s-3.47,2.42-3.47,5h-9c0-4,1.24-6.54,3.4-8s5.1-2.16,8.63-2.16c11.71,0,13.21,5,13.21,11.05v16.48Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M413.13,156.67a9.45,9.45,0,0,0,.46,4c0.52,1,1.5,1.57,3.34,1.57a3.22,3.22,0,0,0,3.4-3.4c0-7-16.22-5.43-16.22-16,0-7.13,7.06-9.29,13-9.29,6.28,0,12,3,11.45,10.14h-9c0-2.29-.26-3.66-0.92-4.25a3.1,3.1,0,0,0-2.35-.72c-2,0-3.14,1.31-3.14,3.53,0,5.23,16.22,5,16.22,15.57,0,5.76-4.71,10.07-12.36,10.07-8,0-13.41-2-12.89-11.25h9Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M430.27,134.23H434V129l9.22-4.12v9.35H448v5.69h-4.78v17.66c0,2.49-.07,4.12,2.94,4.12a6.33,6.33,0,0,0,1.63-.13v5.69a37.78,37.78,0,0,1-4.78.33c-8,0-9-5.3-9-7.33V139.92h-3.73v-5.69Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M447.87,134.23h3.73V129l9.22-4.12v9.35h4.78v5.69h-4.78v17.66c0,2.49-.06,4.12,2.94,4.12a6.33,6.33,0,0,0,1.64-.13v5.69a37.81,37.81,0,0,1-4.78.33c-8,0-9-5.3-9-7.33V139.92h-3.73v-5.69Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M477.93,134.23v4.25h0.13c1.7-3.79,4.84-4.91,8.57-4.91v8.24c-8.11-.52-8.24,4.19-8.24,7.46v18h-9.22v-33h8.77Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M513,161.12c0,2,.26,4.12.46,6.15h-8.57l-0.39-4.38h-0.13a9.15,9.15,0,0,1-8.63,5c-6.41,0-8.76-4.78-8.76-10.53,0-10.92,8.44-11.38,17-11.25v-2.55c0-2.81-.39-4.84-3.73-4.84s-3.47,2.42-3.47,5h-9c0-4,1.24-6.54,3.4-8s5.1-2.16,8.63-2.16c11.71,0,13.21,5,13.21,11.05v16.48ZM496,157c0,2.35.39,5.23,3.4,5.23,5.43,0,4.58-7.33,4.58-10.92C499.38,151.5,496,151.11,496,157Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M532.4,128.89c-3.93,0-4.37.43-4.37,2.95v2.36h4.37v6H528v27.08h-9.24V140.19h-4.16v-6h4.16c-0.06-9.49-.76-12.9,10.49-12.9,1.11,0,2,.07,3.12.14v7.45Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M545.4,167.27h-9.22v-33h9.22v33Zm0-45.63v7.26h-9.22v-7.26h9.22Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M550.21,167.27l0-45.68h9.28v26.58h0.13l8.31-13.93h9.62L568.13,149l10.4,18.32h-10.4l-8.57-18h-0.13v18h-9.22Z'%20transform='translate(-241.16%20-111.87)'/%3e%3cpath%20class='cls-1'%20d='M342,134c-21,1.36-35.13,15.61-35.13,15.61A101.53,101.53,0,0,0,298.1,142,67.13,67.13,0,0,0,304,118.46s14.66,2.91,21.57,16.88q2.21-.53,4.61-0.89a36.74,36.74,0,0,0-61.83-7.56c-15.88-4.26-27.2-1.79-27.2-1.79,49.11,10,65.56,51,65.56,51,7-16.49,14.94-26.69,21.54-32.91a39.59,39.59,0,0,1,.8,6.53s0.65,11.63-7.59,20.75a31.69,31.69,0,0,1-24.54,11.41,32.07,32.07,0,0,1-25.49-12.5s9-3.66,17.55-13.41q-1.81-1.71-3.63-3.32a54.09,54.09,0,0,1-16.47,12.73,32.05,32.05,0,0,1-2-26.79q-2-1.33-4-2.53a36.76,36.76,0,1,0,69.31,3.72C338,135.25,342,134,342,134Zm-68.86-5.7c4.71-5.22,13-11.22,26.11-10.56a58.36,58.36,0,0,1-5.2,21.21A83.67,83.67,0,0,0,273.16,128.35Z'%20transform='translate(-241.16%20-111.87)'/%3e%3crect%20class='cls-2'%20x='0.19'%20width='380'%20height='74.92'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M25%2047.5C37.4264%2047.5%2047.5%2037.4264%2047.5%2025C47.5%2012.5736%2037.4264%202.5%2025%202.5C12.5736%202.5%202.5%2012.5736%202.5%2025C2.5%2037.4264%2012.5736%2047.5%2025%2047.5Z'%20fill='%230079B4'/%3e%3cpath%20d='M25%204C29.1534%204%2033.2135%205.23163%2036.667%207.53914C40.1204%209.84665%2042.812%2013.1264%2044.4015%2016.9636C45.9909%2020.8009%2046.4068%2025.0233%2045.5965%2029.0969C44.7862%2033.1705%2042.7861%2036.9123%2039.8492%2039.8492C36.9123%2042.7861%2033.1705%2044.7862%2029.0969%2045.5965C25.0233%2046.4068%2020.8009%2045.9909%2016.9637%2044.4015C13.1264%2042.812%209.84666%2040.1204%207.53915%2036.667C5.23164%2033.2135%204.00001%2029.1534%204.00001%2025C4.00001%2019.4304%206.2125%2014.089%2010.1508%2010.1508C14.089%206.21249%2019.4305%204%2025%204ZM25%201C20.2533%201%2015.6131%202.40758%2011.6663%205.04473C7.71954%207.68188%204.6434%2011.4302%202.8269%2015.8156C1.0104%2020.201%200.535119%2025.0266%201.46116%2029.6822C2.38721%2034.3377%204.67299%2038.6141%208.02945%2041.9706C11.3859%2045.327%2015.6623%2047.6128%2020.3178%2048.5388C24.9734%2049.4649%2029.799%2048.9896%2034.1844%2047.1731C38.5698%2045.3566%2042.3181%2042.2805%2044.9553%2038.3337C47.5924%2034.3869%2049%2029.7467%2049%2025C49%2018.6348%2046.4714%2012.5303%2041.9706%208.02944C37.4697%203.52856%2031.3652%201%2025%201V1Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M32.0057%2038.1252C32.0057%2038.356%2031.9141%2038.5773%2031.7509%2038.7404C31.5878%2038.9036%2031.3665%2038.9952%2031.1357%2038.9952H18.8957C18.7829%2038.9993%2018.6705%2038.9805%2018.5651%2038.9401C18.4597%2038.8997%2018.3635%2038.8385%2018.2823%2038.7601C18.2011%2038.6817%2018.1365%2038.5877%2018.0924%2038.4838C18.0483%2038.3799%2018.0257%2038.2681%2018.0257%2038.1552V33.7452C18.0297%2033.5131%2018.1246%2033.2919%2018.2902%2033.1291C18.4557%2032.9664%2018.6786%2032.8752%2018.9107%2032.8752H21.5207V24.1302H18.8807C18.6536%2024.1305%2018.4351%2024.0435%2018.2703%2023.8871C18.1056%2023.7308%2018.0073%2023.5171%2017.9957%2023.2902V18.8802C17.9937%2018.7635%2018.0152%2018.6475%2018.059%2018.5392C18.1027%2018.4309%2018.1678%2018.3325%2018.2504%2018.2499C18.333%2018.1673%2018.4314%2018.1022%2018.5397%2018.0585C18.648%2018.0147%2018.764%2017.9932%2018.8807%2017.9952H27.6257C27.7413%2017.9952%2027.8556%2018.0182%2027.9622%2018.0629C28.0687%2018.1075%2028.1653%2018.173%2028.2463%2018.2553C28.3273%2018.3377%2028.391%2018.4354%2028.4339%2018.5427C28.4767%2018.65%2028.4977%2018.7647%2028.4957%2018.8802V32.8752H31.1207C31.2362%2032.8733%2031.351%2032.8943%2031.4583%2032.9371C31.5656%2032.9799%2031.6633%2033.0437%2031.7456%2033.1247C31.828%2033.2057%2031.8934%2033.3023%2031.9381%2033.4088C31.9828%2033.5154%2032.0058%2033.6297%2032.0057%2033.7452V38.1252Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M28.4945%2013.6299C28.4965%2013.7422%2028.4764%2013.8537%2028.4352%2013.9582C28.3941%2014.0627%2028.3328%2014.1581%2028.2548%2014.2389C28.1767%2014.3197%2028.0836%2014.3843%2027.9806%2014.4291C27.8776%2014.4739%2027.7668%2014.4979%2027.6545%2014.4999H22.3895C22.2767%2014.5039%2022.1643%2014.4852%2022.0589%2014.4448C21.9535%2014.4044%2021.8573%2014.3431%2021.7761%2014.2647C21.6949%2014.1863%2021.6303%2014.0923%2021.5862%2013.9884C21.5421%2013.8845%2021.5195%2013.7728%2021.5195%2013.6599V9.24988C21.5195%209.01914%2021.6112%208.79786%2021.7743%208.6347C21.9375%208.47154%2022.1588%208.37988%2022.3895%208.37988H27.6395C27.7538%208.37988%2027.8669%208.40239%2027.9725%208.44611C28.078%208.48983%2028.1739%208.55391%2028.2547%208.6347C28.3355%208.71549%2028.3996%208.81139%2028.4433%208.91695C28.487%209.0225%2028.5095%209.13563%2028.5095%209.24988L28.4945%2013.6299Z'%20fill='white'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.72376%2045.125V46.5625C5.55257%2046.5442%204.43329%2046.0096%203.60153%2045.0712C2.76977%2044.1328%202.2904%2042.8638%202.26434%2041.5313C2.24869%2040.5088%202.50882%2039.5054%203.00968%2038.6563L21.2137%205.76627C21.6279%205.05287%2022.1906%204.46699%2022.8518%204.06071C23.513%203.65444%2024.2522%203.44036%2025.0036%203.43753C25.8343%203.43453%2026.6488%203.69863%2027.3533%204.1994C27.8947%204.61037%2028.3515%205.1498%2028.6924%205.78065L47.0859%2038.6419C47.6877%2039.7862%2047.8816%2041.1492%2047.6279%2042.4511C47.3742%2043.753%2046.692%2044.895%2045.7216%2045.6425L45.5826%2045.7431C44.8901%2046.2576%2044.085%2046.5414%2043.2582%2046.5625H6.72376V45.125Z'%20fill='%23E76B18'/%3e%3cpath%20d='M26.5193%2033.9268H23.5004C22.74%2033.9268%2022.1235%2034.6283%2022.1235%2035.4936V39.1449C22.1235%2040.0102%2022.74%2040.7118%2023.5004%2040.7118H26.5193C27.2797%2040.7118%2027.8962%2040.0102%2027.8962%2039.1449V35.4936C27.8962%2034.6283%2027.2797%2033.9268%2026.5193%2033.9268Z'%20fill='white'/%3e%3cpath%20d='M23.5004%2031.1234L22.1235%2023.0159V18.5884C22.1235%2018.5884%2022.1235%2017.4097%2025.0035%2017.4097C27.8835%2017.4097%2027.8835%2018.5884%2027.8835%2018.5884V22.9009L26.5067%2031.0084H23.5004V31.1234Z'%20fill='white'/%3e%3cpath%20d='M25.0034%204.87501C25.6015%204.87329%2026.188%205.06254%2026.6962%205.42126C27.0661%205.72016%2027.3833%206.09566%2027.631%206.52814L46.0246%2039.375C46.4519%2040.2007%2046.5866%2041.1808%2046.4012%2042.1155C46.2158%2043.0503%2045.7242%2043.8695%2045.0266%2044.4063H44.9508C44.4408%2044.8055%2043.839%2045.0255%2043.22%2045.0388H6.72355C5.8925%2045.0177%205.09966%2044.6375%204.50604%2043.9753C3.91241%2043.3132%203.56252%2042.4188%203.52743%2041.4738C3.51116%2040.7288%203.69638%2039.9962%204.05801%2039.375L22.3126%206.52814C22.6104%206.02581%2023.0108%205.61304%2023.4794%205.32515C23.948%205.03726%2024.4709%204.88281%2025.0034%204.87501ZM25.0034%202.00002C24.06%201.99989%2023.1308%202.26168%2022.2965%202.76268C21.4621%203.26368%2020.7478%203.98876%2020.2155%204.87501L1.93568%2037.8369C1.30687%2038.9291%200.981161%2040.2113%201.00084%2041.5169C1.02699%2043.232%201.63909%2044.8681%202.70739%2046.0783C3.7757%2047.2886%205.21621%2047.9778%206.72355%2048H43.22C44.3319%2047.9791%2045.4151%2047.5949%2046.3404%2046.8931C47.6014%2045.9573%2048.4976%2044.5053%2048.8433%2042.838C49.1891%2041.1708%2048.9578%2039.416%2048.1974%2037.9375L29.766%204.99001C29.3437%204.21968%2028.7843%203.5586%2028.1237%203.04939C27.1954%202.3619%2026.111%201.99723%2025.0034%202.00002Z'%20fill='white'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M16.7255%2046.5624C15.6809%2046.5622%2014.6555%2046.2768%2013.7557%2045.7358C12.8559%2045.1949%2012.1146%2044.4181%2011.6087%2043.4861L3.16523%2027.8749C2.68635%2026.9954%202.43506%2026.006%202.43506%2024.9999C2.43506%2023.9939%202.68635%2023.0045%203.16523%2022.1249L11.6228%206.51374C12.1275%205.58394%2012.8666%204.80853%2013.7637%204.2677C14.6608%203.72687%2015.6833%203.44026%2016.7255%203.4375H33.274C34.3185%203.43769%2035.344%203.7231%2036.2438%204.26406C37.1436%204.80502%2037.8849%205.58181%2038.3908%206.51374L46.8483%2022.1249C47.3272%2023.0045%2047.5785%2023.9939%2047.5785%2024.9999C47.5785%2026.006%2047.3272%2026.9954%2046.8483%2027.8749L38.3908%2043.4861C37.8849%2044.4181%2037.1436%2045.1949%2036.2438%2045.7358C35.344%2046.2768%2034.3185%2046.5622%2033.274%2046.5624H16.7255Z'%20fill='%23D0021B'/%3e%3cpath%20d='M33.2743%204.87505C34.0655%204.87443%2034.8425%205.09013%2035.5242%205.4997C36.206%205.90926%2036.7676%206.49772%2037.1507%207.20379L45.6082%2022.815C45.9586%2023.4775%2046.142%2024.2185%2046.142%2024.9712C46.142%2025.724%2045.9586%2026.465%2045.6082%2027.1275L37.1507%2042.7387C36.775%2043.4555%2036.2166%2044.0556%2035.5343%2044.4756C34.852%2044.8956%2034.0712%2045.1199%2033.2743%2045.125H16.7257C15.9345%2045.1256%2015.1575%2044.9099%2014.4758%2044.5003C13.794%2044.0907%2013.2324%2043.5023%2012.8494%2042.7962L4.39183%2027.185C4.04145%2026.5225%203.85801%2025.7815%203.85801%2025.0288C3.85801%2024.276%204.04145%2023.535%204.39183%2022.8725L12.8494%207.26129C13.225%206.5445%2013.7834%205.94442%2014.4657%205.52442C15.148%205.10441%2015.9288%204.88006%2016.7257%204.87505H33.2743ZM33.2743%202.00006H16.7257C15.4297%202.00061%2014.1576%202.35565%2013.0419%203.0282C11.9262%203.70074%2011.0079%204.66615%2010.3826%205.8238L1.92505%2021.435C1.31862%2022.5318%201%2023.7696%201%2025.0288C1%2026.2879%201.31862%2027.5257%201.92505%2028.6225L10.3826%2044.2337C11.0152%2045.3806%2011.9367%2046.3345%2013.0519%2046.9966C14.167%2047.6587%2015.4353%2048.0051%2016.7257%2047.9999H33.2743C34.5703%2047.9994%2035.8424%2047.6443%2036.9581%2046.9718C38.0738%2046.2993%2038.9921%2045.3339%2039.6174%2044.1762L48.075%2028.565C48.6814%2027.4682%2049%2026.2304%2049%2024.9712C49%2023.7121%2048.6814%2022.4743%2048.075%2021.3775L39.6174%205.7663C38.9848%204.61936%2038.0633%203.66554%2036.9481%203.00342C35.833%202.3413%2034.5647%201.99491%2033.2743%202.00006Z'%20fill='white'/%3e%3cpath%20d='M26.691%2029.4274H23.3221C22.4735%2029.4274%2021.7856%2030.1289%2021.7856%2030.9942V34.6455C21.7856%2035.5108%2022.4735%2036.2124%2023.3221%2036.2124H26.691C27.5396%2036.2124%2028.2275%2035.5108%2028.2275%2034.6455V30.9942C28.2275%2030.1289%2027.5396%2029.4274%2026.691%2029.4274Z'%20fill='white'/%3e%3cpath%20d='M23.3221%2026.6247L21.7856%2018.5172V14.0898C21.7856%2014.0898%2021.7856%2012.911%2024.9995%2012.911C28.2134%2012.911%2028.2134%2014.0898%2028.2134%2014.0898V18.4022L26.6769%2026.4378H23.3221V26.6247Z'%20fill='white'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_200_953)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M24.0169%2031.3289C24.2498%2032.5182%2024.1578%2033.7483%2023.7505%2034.8897C23.3431%2036.0312%2022.6356%2037.0417%2021.7023%2037.815C20.7691%2038.5883%2019.6446%2039.0957%2018.4472%2039.2838C17.2498%2039.472%2016.0238%2039.3339%2014.8983%2038.8841C13.7728%2038.4344%2012.7894%2037.6895%2012.0515%2036.7281C11.3137%2035.7666%2010.8487%2034.624%2010.7055%2033.4206C10.5624%2032.2171%2010.7463%2030.9974%2011.238%2029.8897C11.7297%2028.7819%2012.511%2027.8272%2013.4996%2027.1261L12.7826%2022.2089C10.9043%2023.041%209.28582%2024.3651%208.09819%2026.0413C6.91056%2027.7174%206.19793%2029.6832%206.03564%2031.7309C5.87334%2033.7786%206.26741%2035.8321%207.17619%2037.6743C8.08496%2039.5166%209.47468%2041.079%2011.1984%2042.1966C12.9222%2043.3142%2014.9159%2043.9453%2016.9688%2044.0233C19.0217%2044.1012%2021.0576%2043.6231%2022.8611%2042.6395C24.6647%2041.6559%2026.1689%2040.2033%2027.2148%2038.4353C28.2607%2036.6674%2028.8095%2034.6496%2028.803%2032.5955C28.784%2032.1713%2028.7417%2031.7484%2028.6763%2031.3289H24.0169Z'%20fill='%23B1B5B9'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M41.4537%2032.9299L38.92%2033.8749L33.7995%2024.9322C33.6482%2024.5867%2033.4004%2024.2922%2033.0858%2024.0841C32.7712%2023.876%2032.4031%2023.7632%2032.0259%2023.7593L20.6447%2023.7339L20.2798%2021.2006H26.2694C26.9414%2021.2006%2027.5858%2020.9337%2028.061%2020.4586C28.5362%2019.9835%2028.8031%2019.3391%2028.8031%2018.6673C28.8031%2017.9954%2028.5362%2017.351%2028.061%2016.8759C27.5858%2016.4008%2026.9414%2016.1339%2026.2694%2016.1339H19.5451L19.1751%2013.6006C19.6655%2013.4972%2020.1288%2013.2924%2020.5352%2012.9993C20.9417%2012.7062%2021.2823%2012.3313%2021.5352%2011.8988C21.7881%2011.4662%2021.9478%2010.9856%2022.0039%2010.4877C22.0599%209.98975%2022.0112%209.48562%2021.8608%209.00766C21.6038%207.98334%2020.9556%207.10049%2020.0552%206.54832C19.1549%205.99616%2018.074%205.81863%2017.0443%206.05379C16.0917%206.1878%2015.2192%206.66057%2014.5868%207.38546C13.9544%208.11035%2013.6045%209.03882%2013.6011%2010.0007C13.6027%2010.2044%2013.6196%2010.4076%2013.6517%2010.6087L16.0638%2027.197C16.1256%2027.642%2016.3465%2028.0495%2016.6856%2028.3443C17.0246%2028.6391%2017.459%2028.8012%2017.9083%2028.8006H30.3233L35.2437%2038.103C35.546%2038.4975%2035.9721%2038.779%2036.4535%2038.9026C36.935%2039.0262%2037.444%2038.9846%2037.899%2038.7845L42.713%2037.0111C45.1959%2036.0865%2043.6884%2032.1801%2041.4461%2032.9426'%20fill='%23B1B5B9'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_200_953'%3e%3crect%20width='38'%20height='38'%20fill='white'%20transform='translate(6%206.00183)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_200_1023)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M24.0169%2031.327C24.2498%2032.5164%2024.1578%2033.7465%2023.7505%2034.8879C23.3431%2036.0293%2022.6356%2037.0399%2021.7023%2037.8131C20.7691%2038.5864%2019.6446%2039.0938%2018.4472%2039.282C17.2498%2039.4701%2016.0238%2039.3321%2014.8983%2038.8823C13.7728%2038.4325%2012.7894%2037.6877%2012.0515%2036.7262C11.3137%2035.7647%2010.8487%2034.6222%2010.7055%2033.4187C10.5624%2032.2153%2010.7463%2030.9955%2011.238%2029.8878C11.7297%2028.7801%2012.511%2027.8254%2013.4996%2027.1242L12.7826%2022.207C10.9043%2023.0392%209.28582%2024.3633%208.09819%2026.0394C6.91056%2027.7155%206.19793%2029.6814%206.03564%2031.7291C5.87334%2033.7768%206.26741%2035.8303%207.17619%2037.6725C8.08496%2039.5147%209.47468%2041.0772%2011.1984%2042.1948C12.9222%2043.3124%2014.9159%2043.9435%2016.9688%2044.0214C19.0217%2044.0994%2021.0576%2043.6213%2022.8611%2042.6377C24.6647%2041.6541%2026.1689%2040.2015%2027.2148%2038.4335C28.2607%2036.6655%2028.8095%2034.6478%2028.803%2032.5937C28.784%2032.1695%2028.7417%2031.7466%2028.6763%2031.327H24.0169Z'%20fill='%236D747D'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M41.4537%2032.9281L38.92%2033.873L33.7995%2024.9304C33.6482%2024.5848%2033.4004%2024.2903%2033.0858%2024.0823C32.7712%2023.8742%2032.4031%2023.7614%2032.0259%2023.7574L20.6447%2023.7321L20.2798%2021.1988H26.2694C26.9414%2021.1988%2027.5858%2020.9319%2028.061%2020.4568C28.5362%2019.9817%2028.8031%2019.3373%2028.8031%2018.6654C28.8031%2017.9935%2028.5362%2017.3492%2028.061%2016.8741C27.5858%2016.399%2026.9414%2016.1321%2026.2694%2016.1321H19.5451L19.1751%2013.5988C19.6655%2013.4953%2020.1288%2013.2905%2020.5352%2012.9974C20.9417%2012.7044%2021.2823%2012.3295%2021.5352%2011.8969C21.7881%2011.4644%2021.9478%2010.9837%2022.0039%2010.4858C22.0599%209.98792%2022.0112%209.48379%2021.8608%209.00582C21.6038%207.98151%2020.9556%207.09866%2020.0552%206.54649C19.1549%205.99433%2018.074%205.8168%2017.0443%206.05196C16.0917%206.18597%2015.2192%206.65874%2014.5868%207.38363C13.9544%208.10852%2013.6045%209.03699%2013.6011%209.99889C13.6027%2010.2025%2013.6196%2010.4058%2013.6517%2010.6069L16.0638%2027.1952C16.1256%2027.6401%2016.3465%2028.0477%2016.6856%2028.3425C17.0246%2028.6373%2017.459%2028.7994%2017.9083%2028.7988H30.3233L35.2437%2038.1012C35.546%2038.4956%2035.9721%2038.7772%2036.4535%2038.9008C36.935%2039.0243%2037.444%2038.9827%2037.899%2038.7826L42.713%2037.0093C45.1959%2036.0846%2043.6884%2032.1782%2041.4461%2032.9408'%20fill='%236D747D'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_200_1023'%3e%3crect%20width='38'%20height='38'%20fill='white'%20transform='translate(6%206)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='58'%20height='58'%20viewBox='0%200%2058%2058'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_296_2370'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='58'%20height='58'%3e%3crect%20width='58'%20height='58'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_296_2370)'%3e%3cpath%20d='M43.5006%2031.4165V26.5832H53.1673V31.4165H43.5006ZM46.4007%2048.3332L38.6673%2042.5332L41.5673%2038.6665L49.3006%2044.4665L46.4007%2048.3332ZM41.5673%2019.3332L38.6673%2015.4665L46.4007%209.6665L49.3006%2013.5332L41.5673%2019.3332ZM12.084%2045.9165V36.2498H9.66732C8.33815%2036.2498%207.2003%2035.7766%206.25378%2034.83C5.30725%2033.8835%204.83398%2032.7457%204.83398%2031.4165V26.5832C4.83398%2025.254%205.30725%2024.1162%206.25378%2023.1696C7.2003%2022.2231%208.33815%2021.7498%209.66732%2021.7498H19.334L31.4173%2014.4998V43.4998L19.334%2036.2498H16.9173V45.9165H12.084ZM26.584%2034.9207V23.079L20.6632%2026.5832H9.66732V31.4165H20.6632L26.584%2034.9207ZM33.834%2037.0957V20.904C34.9215%2021.8707%2035.7975%2023.0488%2036.4621%2024.4384C37.1267%2025.828%2037.459%2027.3484%2037.459%2028.9998C37.459%2030.6512%2037.1267%2032.1717%2036.4621%2033.5613C35.7975%2034.9509%2034.9215%2036.129%2033.834%2037.0957Z'%20fill='%2399DEFF'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='58'%20height='58'%20viewBox='0%200%2058%2058'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_296_1661'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='58'%20height='58'%3e%3crect%20width='58'%20height='58'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_296_1661)'%3e%3cpath%20d='M43.5006%2031.4165V26.5832H53.1673V31.4165H43.5006ZM46.4007%2048.3332L38.6673%2042.5332L41.5673%2038.6665L49.3006%2044.4665L46.4007%2048.3332ZM41.5673%2019.3332L38.6673%2015.4665L46.4007%209.6665L49.3006%2013.5332L41.5673%2019.3332ZM12.084%2045.9165V36.2498H9.66732C8.33815%2036.2498%207.2003%2035.7766%206.25378%2034.83C5.30725%2033.8835%204.83398%2032.7457%204.83398%2031.4165V26.5832C4.83398%2025.254%205.30725%2024.1162%206.25378%2023.1696C7.2003%2022.2231%208.33815%2021.7498%209.66732%2021.7498H19.334L31.4173%2014.4998V43.4998L19.334%2036.2498H16.9173V45.9165H12.084ZM26.584%2034.9207V23.079L20.6632%2026.5832H9.66732V31.4165H20.6632L26.584%2034.9207ZM33.834%2037.0957V20.904C34.9215%2021.8707%2035.7975%2023.0488%2036.4621%2024.4384C37.1267%2025.828%2037.459%2027.3484%2037.459%2028.9998C37.459%2030.6512%2037.1267%2032.1717%2036.4621%2033.5613C35.7975%2034.9509%2034.9215%2036.129%2033.834%2037.0957Z'%20fill='%230079B4'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M15.986%2021.9998H12.071L9.035%2024.3998H6L9.145%2021.8838C8.4707%2021.6968%207.87627%2021.294%207.45274%2020.737C7.02921%2020.18%206.79993%2019.4995%206.8%2018.7998V9.1998C6.8%208.35111%207.13714%207.53718%207.73726%206.93706C8.33737%206.33695%209.15131%205.9998%2010%205.9998H12.256L10.211%205.0618C10.161%205.03875%2010.1187%205.00187%2010.0891%204.95553C10.0594%204.90919%2010.0437%204.85532%2010.0437%204.8003C10.0437%204.74529%2010.0594%204.69142%2010.0891%204.64508C10.1187%204.59874%2010.161%204.56186%2010.211%204.5388L14%202.7998L17.789%204.5378C17.839%204.56086%2017.8813%204.59774%2017.9109%204.64408C17.9406%204.69042%2017.9563%204.74429%2017.9563%204.7993C17.9563%204.85432%2017.9406%204.90819%2017.9109%204.95453C17.8813%205.00087%2017.839%205.03775%2017.789%205.0608L15.744%205.9998H18C18.8487%205.9998%2019.6626%206.33695%2020.2627%206.93706C20.8629%207.53718%2021.2%208.35111%2021.2%209.1998V18.7998C21.2001%2019.4995%2020.9708%2020.18%2020.5473%2020.737C20.1237%2021.294%2019.5293%2021.6968%2018.855%2021.8838L22%2024.3998H18.993L15.986%2021.9998ZM13.986%205.9998H14.02L16.633%204.7998L14%203.5918L11.367%204.7998L13.986%205.9998ZM18.258%2015.5998C18.4428%2015.5997%2018.622%2015.5356%2018.7649%2015.4184C18.9078%2015.3012%2019.0057%2015.1381%2019.042%2014.9568L19.68%2011.7568C19.7033%2011.6406%2019.7004%2011.5207%2019.6717%2011.4057C19.6429%2011.2908%2019.589%2011.1836%2019.5138%2011.0921C19.4386%2011.0005%2019.3439%2010.9268%2019.2368%2010.8762C19.1296%2010.8257%2019.0125%2010.7996%2018.894%2010.7998H9.351C9.23258%2010.7997%209.11562%2010.8259%209.00856%2010.8765C8.9015%2010.9271%208.80701%2011.0009%208.73191%2011.0924C8.65681%2011.184%208.60297%2011.2911%208.57428%2011.406C8.54559%2011.5209%208.54276%2011.6407%208.566%2011.7568L9.205%2014.9568C9.24128%2015.1381%209.3392%2015.3012%209.48212%2015.4184C9.62505%2015.5356%209.80415%2015.5997%209.989%2015.5998H18.258ZM9.2%207.5998C8.98783%207.5998%208.78434%207.68409%208.63431%207.83412C8.48429%207.98415%208.4%208.18763%208.4%208.3998C8.4%208.61198%208.48429%208.81546%208.63431%208.96549C8.78434%209.11552%208.98783%209.1998%209.2%209.1998H18.8C18.9051%209.1998%2019.0091%209.17911%2019.1061%209.13891C19.2032%209.0987%2019.2914%209.03978%2019.3657%208.96549C19.44%208.8912%2019.4989%208.80301%2019.5391%208.70595C19.5793%208.60889%2019.6%208.50486%2019.6%208.3998C19.6%208.29475%2019.5793%208.19072%2019.5391%208.09366C19.4989%207.9966%2019.44%207.90841%2019.3657%207.83412C19.2914%207.75983%2019.2032%207.7009%2019.1061%207.6607C19.0091%207.6205%2018.9051%207.5998%2018.8%207.5998H9.2ZM14%2020.3998C14.3165%2020.3998%2014.6258%2020.306%2014.8889%2020.1302C15.152%2019.9543%2015.3571%2019.7045%2015.4782%2019.4121C15.5993%2019.1197%2015.631%2018.798%2015.5693%2018.4877C15.5075%2018.1773%2015.3551%2017.8922%2015.1314%2017.6684C14.9076%2017.4447%2014.6225%2017.2923%2014.3121%2017.2305C14.0018%2017.1688%2013.6801%2017.2005%2013.3877%2017.3216C13.0953%2017.4427%2012.8455%2017.6478%2012.6696%2017.9109C12.4938%2018.174%2012.4%2018.4834%2012.4%2018.7998C12.4%2019.2242%2012.5686%2019.6311%2012.8686%2019.9312C13.1687%2020.2312%2013.5757%2020.3998%2014%2020.3998Z'%20fill='white'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M15.986%2021.9998H12.071L9.035%2024.3998H6L9.145%2021.8838C8.4707%2021.6968%207.87627%2021.294%207.45274%2020.737C7.02921%2020.18%206.79993%2019.4995%206.8%2018.7998V9.1998C6.8%208.35111%207.13714%207.53718%207.73726%206.93706C8.33737%206.33695%209.15131%205.9998%2010%205.9998H12.256L10.211%205.0618C10.161%205.03875%2010.1187%205.00187%2010.0891%204.95553C10.0594%204.90919%2010.0437%204.85532%2010.0437%204.8003C10.0437%204.74529%2010.0594%204.69142%2010.0891%204.64508C10.1187%204.59874%2010.161%204.56186%2010.211%204.5388L14%202.7998L17.789%204.5378C17.839%204.56086%2017.8813%204.59774%2017.9109%204.64408C17.9406%204.69042%2017.9563%204.74429%2017.9563%204.7993C17.9563%204.85432%2017.9406%204.90819%2017.9109%204.95453C17.8813%205.00087%2017.839%205.03775%2017.789%205.0608L15.744%205.9998H18C18.8487%205.9998%2019.6626%206.33695%2020.2627%206.93706C20.8629%207.53718%2021.2%208.35111%2021.2%209.1998V18.7998C21.2001%2019.4995%2020.9708%2020.18%2020.5473%2020.737C20.1237%2021.294%2019.5293%2021.6968%2018.855%2021.8838L22%2024.3998H18.993L15.986%2021.9998ZM13.986%205.9998H14.02L16.633%204.7998L14%203.5918L11.367%204.7998L13.986%205.9998ZM18.258%2015.5998C18.4428%2015.5997%2018.622%2015.5356%2018.7649%2015.4184C18.9078%2015.3012%2019.0057%2015.1381%2019.042%2014.9568L19.68%2011.7568C19.7033%2011.6406%2019.7004%2011.5207%2019.6717%2011.4057C19.6429%2011.2908%2019.589%2011.1836%2019.5138%2011.0921C19.4386%2011.0005%2019.3439%2010.9268%2019.2368%2010.8762C19.1296%2010.8257%2019.0125%2010.7996%2018.894%2010.7998H9.351C9.23258%2010.7997%209.11562%2010.8259%209.00856%2010.8765C8.9015%2010.9271%208.80701%2011.0009%208.73191%2011.0924C8.65681%2011.184%208.60297%2011.2911%208.57428%2011.406C8.54559%2011.5209%208.54276%2011.6407%208.566%2011.7568L9.205%2014.9568C9.24128%2015.1381%209.3392%2015.3012%209.48212%2015.4184C9.62505%2015.5356%209.80415%2015.5997%209.989%2015.5998H18.258ZM9.2%207.5998C8.98783%207.5998%208.78434%207.68409%208.63431%207.83412C8.48429%207.98415%208.4%208.18763%208.4%208.3998C8.4%208.61198%208.48429%208.81546%208.63431%208.96549C8.78434%209.11552%208.98783%209.1998%209.2%209.1998H18.8C18.9051%209.1998%2019.0091%209.17911%2019.1061%209.13891C19.2032%209.0987%2019.2914%209.03978%2019.3657%208.96549C19.44%208.8912%2019.4989%208.80301%2019.5391%208.70595C19.5793%208.60889%2019.6%208.50486%2019.6%208.3998C19.6%208.29475%2019.5793%208.19072%2019.5391%208.09366C19.4989%207.9966%2019.44%207.90841%2019.3657%207.83412C19.2914%207.75983%2019.2032%207.7009%2019.1061%207.6607C19.0091%207.6205%2018.9051%207.5998%2018.8%207.5998H9.2ZM14%2020.3998C14.3165%2020.3998%2014.6258%2020.306%2014.8889%2020.1302C15.152%2019.9543%2015.3571%2019.7045%2015.4782%2019.4121C15.5993%2019.1197%2015.631%2018.798%2015.5693%2018.4877C15.5075%2018.1773%2015.3551%2017.8922%2015.1314%2017.6684C14.9076%2017.4447%2014.6225%2017.2923%2014.3121%2017.2305C14.0018%2017.1688%2013.6801%2017.2005%2013.3877%2017.3216C13.0953%2017.4427%2012.8455%2017.6478%2012.6696%2017.9109C12.4938%2018.174%2012.4%2018.4834%2012.4%2018.7998C12.4%2019.2242%2012.5686%2019.6311%2012.8686%2019.9312C13.1687%2020.2312%2013.5757%2020.3998%2014%2020.3998Z'%20fill='%23111111'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_329_834'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='6'%20y='3'%20width='16'%20height='22'%3e%3cpath%20d='M22%203.77734H6V24.2213H22V3.77734Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_329_834)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M18.444%203.77734H9.556C8.61289%203.77734%207.70841%204.15199%207.04153%204.81887C6.37465%205.48575%206%206.39023%206%207.33334L6%2017.9993C6.00008%2018.6233%206.16443%2019.2363%206.47654%2019.7766C6.78865%2020.3169%207.23752%2020.7655%207.778%2021.0773V23.3303C7.778%2023.5661%207.87166%2023.7922%208.03838%2023.959C8.2051%2024.1257%208.43122%2024.2193%208.667%2024.2193H10.444C10.5608%2024.2195%2010.6764%2024.1966%2010.7844%2024.1519C10.8923%2024.1073%2010.9903%2024.0418%2011.0729%2023.9593C11.1555%2023.8767%2011.221%2023.7786%2011.2656%2023.6707C11.3102%2023.5628%2011.3331%2023.4471%2011.333%2023.3303V21.5553H16.666V23.3333C16.666%2023.5691%2016.7597%2023.7952%2016.9264%2023.962C17.0931%2024.1287%2017.3192%2024.2223%2017.555%2024.2223H19.333C19.4498%2024.2225%2019.5654%2024.1996%2019.6734%2024.1549C19.7813%2024.1103%2019.8793%2024.0448%2019.9619%2023.9623C20.0445%2023.8797%2020.11%2023.7816%2020.1546%2023.6737C20.1992%2023.5658%2020.2221%2023.4501%2020.222%2023.3333V21.0773C20.7626%2020.7657%2021.2116%2020.3171%2021.5237%2019.7768C21.8359%2019.2364%2022.0001%2018.6234%2022%2017.9993V7.33334C22.0001%206.86633%2021.9082%206.40386%2021.7296%205.97237C21.5509%205.54087%2021.289%205.14881%2020.9588%204.81858C20.6285%204.48835%2020.2365%204.22642%2019.805%204.04776C19.3735%203.8691%2018.911%203.77721%2018.444%203.77734ZM11.333%205.55534H16.666C16.9018%205.55534%2017.1279%205.64901%2017.2946%205.81573C17.4613%205.98245%2017.555%206.20857%2017.555%206.44434C17.555%206.68012%2017.4613%206.90624%2017.2946%207.07296C17.1279%207.23968%2016.9018%207.33334%2016.666%207.33334H11.333C11.0972%207.33334%2010.8711%207.23968%2010.7044%207.07296C10.5377%206.90624%2010.444%206.68012%2010.444%206.44434C10.444%206.20857%2010.5377%205.98245%2010.7044%205.81573C10.8711%205.64901%2011.0972%205.55534%2011.333%205.55534ZM10%2019.3333C9.73636%2019.3333%209.47864%2019.2552%209.25942%2019.1087C9.04021%2018.9622%208.86936%2018.754%208.76847%2018.5105C8.66758%2018.2669%208.64118%2017.9989%208.69261%2017.7403C8.74405%2017.4817%208.871%2017.2442%209.05743%2017.0578C9.24385%2016.8713%209.48137%2016.7444%209.73994%2016.693C9.99852%2016.6415%2010.2665%2016.6679%2010.5101%2016.7688C10.7537%2016.8697%2010.9619%2017.0406%2011.1083%2017.2598C11.2548%2017.479%2011.333%2017.7367%2011.333%2018.0003C11.333%2018.1754%2011.2985%2018.3487%2011.2315%2018.5105C11.1645%2018.6722%2011.0664%2018.8191%2010.9426%2018.9429C10.8188%2019.0667%2010.6718%2019.1649%2010.5101%2019.2319C10.3484%2019.2989%2010.1751%2019.3333%2010%2019.3333ZM18%2019.3333C17.7364%2019.3333%2017.4786%2019.2552%2017.2594%2019.1087C17.0402%2018.9622%2016.8694%2018.754%2016.7685%2018.5105C16.6676%2018.2669%2016.6412%2017.9989%2016.6926%2017.7403C16.744%2017.4817%2016.871%2017.2442%2017.0574%2017.0578C17.2438%2016.8713%2017.4814%2016.7444%2017.7399%2016.693C17.9985%2016.6415%2018.2665%2016.6679%2018.5101%2016.7688C18.7537%2016.8697%2018.9619%2017.0406%2019.1083%2017.2598C19.2548%2017.479%2019.333%2017.7367%2019.333%2018.0003C19.333%2018.3539%2019.1926%2018.6929%2018.9426%2018.9429C18.6926%2019.1929%2018.3535%2019.3333%2018%2019.3333ZM19.632%2015.3333H8.666C8.54922%2015.3335%208.43356%2015.3106%208.32564%2015.2659C8.21772%2015.2213%208.11967%2015.1558%208.03709%2015.0733C7.95451%2014.9907%207.88903%2014.8926%207.8444%2014.7847C7.79977%2014.6768%207.77687%2014.5611%207.777%2014.4443V14.4193L7.9%209.97734C7.90651%209.7461%208.0029%209.5265%208.1687%209.36517C8.3345%209.20385%208.55666%209.11351%208.788%209.11334H19.482C19.7134%209.1135%2019.9357%209.20381%2020.1017%209.36511C20.2676%209.52641%2020.3642%209.74601%2020.371%209.97734L20.495%2014.4213C20.5017%2014.657%2020.4146%2014.8856%2020.2528%2015.057C20.0909%2015.2284%2019.8676%2015.3285%2019.632%2015.3353'%20fill='white'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_329_827'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='6'%20y='3'%20width='16'%20height='22'%3e%3cpath%20d='M22%203.77734H6V24.2213H22V3.77734Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_329_827)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M18.444%203.77734H9.556C8.61289%203.77734%207.70841%204.15199%207.04153%204.81887C6.37465%205.48575%206%206.39023%206%207.33334L6%2017.9993C6.00008%2018.6233%206.16443%2019.2363%206.47654%2019.7766C6.78865%2020.3169%207.23752%2020.7655%207.778%2021.0773V23.3303C7.778%2023.5661%207.87166%2023.7922%208.03838%2023.959C8.2051%2024.1257%208.43122%2024.2193%208.667%2024.2193H10.444C10.5608%2024.2195%2010.6764%2024.1966%2010.7844%2024.1519C10.8923%2024.1073%2010.9903%2024.0418%2011.0729%2023.9593C11.1555%2023.8767%2011.221%2023.7786%2011.2656%2023.6707C11.3102%2023.5628%2011.3331%2023.4471%2011.333%2023.3303V21.5553H16.666V23.3333C16.666%2023.5691%2016.7597%2023.7952%2016.9264%2023.962C17.0931%2024.1287%2017.3192%2024.2223%2017.555%2024.2223H19.333C19.4498%2024.2225%2019.5654%2024.1996%2019.6734%2024.1549C19.7813%2024.1103%2019.8793%2024.0448%2019.9619%2023.9623C20.0445%2023.8797%2020.11%2023.7816%2020.1546%2023.6737C20.1992%2023.5658%2020.2221%2023.4501%2020.222%2023.3333V21.0773C20.7626%2020.7657%2021.2116%2020.3171%2021.5237%2019.7768C21.8359%2019.2364%2022.0001%2018.6234%2022%2017.9993V7.33334C22.0001%206.86633%2021.9082%206.40386%2021.7296%205.97237C21.5509%205.54087%2021.289%205.14881%2020.9588%204.81858C20.6285%204.48835%2020.2365%204.22642%2019.805%204.04776C19.3735%203.8691%2018.911%203.77721%2018.444%203.77734ZM11.333%205.55534H16.666C16.9018%205.55534%2017.1279%205.64901%2017.2946%205.81573C17.4613%205.98245%2017.555%206.20857%2017.555%206.44434C17.555%206.68012%2017.4613%206.90624%2017.2946%207.07296C17.1279%207.23968%2016.9018%207.33334%2016.666%207.33334H11.333C11.0972%207.33334%2010.8711%207.23968%2010.7044%207.07296C10.5377%206.90624%2010.444%206.68012%2010.444%206.44434C10.444%206.20857%2010.5377%205.98245%2010.7044%205.81573C10.8711%205.64901%2011.0972%205.55534%2011.333%205.55534ZM10%2019.3333C9.73636%2019.3333%209.47864%2019.2552%209.25942%2019.1087C9.04021%2018.9622%208.86936%2018.754%208.76847%2018.5105C8.66758%2018.2669%208.64118%2017.9989%208.69261%2017.7403C8.74405%2017.4817%208.871%2017.2442%209.05743%2017.0578C9.24385%2016.8713%209.48137%2016.7444%209.73994%2016.693C9.99852%2016.6415%2010.2665%2016.6679%2010.5101%2016.7688C10.7537%2016.8697%2010.9619%2017.0406%2011.1083%2017.2598C11.2548%2017.479%2011.333%2017.7367%2011.333%2018.0003C11.333%2018.1754%2011.2985%2018.3487%2011.2315%2018.5105C11.1645%2018.6722%2011.0664%2018.8191%2010.9426%2018.9429C10.8188%2019.0667%2010.6718%2019.1649%2010.5101%2019.2319C10.3484%2019.2989%2010.1751%2019.3333%2010%2019.3333ZM18%2019.3333C17.7364%2019.3333%2017.4786%2019.2552%2017.2594%2019.1087C17.0402%2018.9622%2016.8694%2018.754%2016.7685%2018.5105C16.6676%2018.2669%2016.6412%2017.9989%2016.6926%2017.7403C16.744%2017.4817%2016.871%2017.2442%2017.0574%2017.0578C17.2438%2016.8713%2017.4814%2016.7444%2017.7399%2016.693C17.9985%2016.6415%2018.2665%2016.6679%2018.5101%2016.7688C18.7537%2016.8697%2018.9619%2017.0406%2019.1083%2017.2598C19.2548%2017.479%2019.333%2017.7367%2019.333%2018.0003C19.333%2018.3539%2019.1926%2018.6929%2018.9426%2018.9429C18.6926%2019.1929%2018.3535%2019.3333%2018%2019.3333ZM19.632%2015.3333H8.666C8.54922%2015.3335%208.43356%2015.3106%208.32564%2015.2659C8.21772%2015.2213%208.11967%2015.1558%208.03709%2015.0733C7.95451%2014.9907%207.88903%2014.8926%207.8444%2014.7847C7.79977%2014.6768%207.77687%2014.5611%207.777%2014.4443V14.4193L7.9%209.97734C7.90651%209.7461%208.0029%209.5265%208.1687%209.36517C8.3345%209.20385%208.55666%209.11351%208.788%209.11334H19.482C19.7134%209.1135%2019.9357%209.20381%2020.1017%209.36511C20.2676%209.52641%2020.3642%209.74601%2020.371%209.97734L20.495%2014.4213C20.5017%2014.657%2020.4146%2014.8856%2020.2528%2015.057C20.0909%2015.2284%2019.8676%2015.3285%2019.632%2015.3353'%20fill='%23111111'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M19.547%2012.576L14.212%2010.276C14.1403%2010.2446%2014.0628%2010.2284%2013.9845%2010.2284C13.9062%2010.2284%2013.8287%2010.2446%2013.757%2010.276L8.369%2012.565V10.47C8.36659%2010.3054%208.42956%2010.1465%208.54409%2010.0282C8.65862%209.90994%208.81538%209.84189%208.98%209.839H9.78V7.016C9.79356%206.84427%209.87124%206.68392%209.99759%206.56683C10.1239%206.44974%2010.2897%206.38447%2010.462%206.384H12.686L13.012%205H14.9L15.227%206.385H17.302C17.4743%206.38568%2017.6401%206.45099%2017.7666%206.56802C17.893%206.68504%2017.971%206.84526%2017.985%207.017V9.84H18.93C19.0947%209.8429%2019.2516%209.91091%2019.3663%2010.0292C19.481%2010.1474%2019.5441%2010.3063%2019.542%2010.471L19.547%2012.576ZM21.988%2021.688L23%2022.732C22.76%2022.887%2022.529%2023.052%2022.324%2023.166C21.7324%2023.5544%2021.0486%2023.7793%2020.342%2023.818C19.7004%2023.8019%2019.074%2023.6196%2018.524%2023.289C18.1163%2023.0363%2017.6494%2022.8953%2017.17%2022.88C16.7578%2022.8825%2016.3558%2023.0086%2016.016%2023.242C15.4104%2023.6189%2014.7113%2023.8187%2013.998%2023.8187C13.2847%2023.8187%2012.5856%2023.6189%2011.98%2023.242C11.6401%2023.0088%2011.2382%2022.8827%2010.826%2022.88C10.325%2022.8978%209.83706%2023.0441%209.409%2023.305C8.8764%2023.62%208.2734%2023.7967%207.655%2023.819C6.98598%2023.7805%206.34075%2023.5572%205.791%2023.174C5.555%2023.037%205.281%2022.826%205%2022.645L6%2021.619C6.177%2021.711%206.344%2021.806%206.5%2021.896C6.84094%2022.1462%207.24166%2022.3024%207.662%2022.349C8.06173%2022.3222%208.44875%2022.1975%208.789%2021.986C9.41069%2021.6244%2010.114%2021.4266%2010.833%2021.411C11.4834%2021.4138%2012.1197%2021.6011%2012.668%2021.951C13.0653%2022.2109%2013.5297%2022.3494%2014.0045%2022.3494C14.4793%2022.3494%2014.9437%2022.2109%2015.341%2021.951C15.8893%2021.6011%2016.5256%2021.4138%2017.176%2021.411C17.8774%2021.4238%2018.5634%2021.6185%2019.167%2021.976C19.5218%2022.2003%2019.9287%2022.3288%2020.348%2022.349C20.8173%2022.3024%2021.2672%2022.1379%2021.656%2021.871C21.766%2021.811%2021.879%2021.75%2021.995%2021.689M7.655%2020.748C6.97388%2020.7053%206.31992%2020.4652%205.773%2020.057C5.555%2019.921%205.299%2019.717%205.037%2019.537L6.03%2018.512C6.201%2018.612%206.361%2018.706%206.509%2018.799C6.83974%2019.0604%207.2357%2019.2264%207.654%2019.279C7.98097%2019.2653%208.29988%2019.1734%208.584%2019.011C8.33039%2018.3052%207.96434%2017.645%207.5%2017.056L6.8%2016C6.235%2015.161%206.067%2014.874%207.395%2014.31L13.981%2011.5C14.346%2011.662%2019.518%2013.89%2021%2014.528C21.8%2014.962%2021.611%2015.273%2021.126%2015.997L20.426%2017.057C19.9644%2017.6412%2019.5985%2018.295%2019.342%2018.994C19.6483%2019.1717%2019.9941%2019.27%2020.348%2019.28C20.8034%2019.238%2021.2392%2019.0747%2021.61%2018.807C21.729%2018.74%2021.852%2018.67%2021.978%2018.602L22.984%2019.638C22.741%2019.801%2022.506%2019.976%2022.303%2020.092C21.7239%2020.4861%2021.0476%2020.7134%2020.348%2020.749C19.7065%2020.7325%2019.0802%2020.5503%2018.53%2020.22C18.1226%2019.9666%2017.6555%2019.8252%2017.176%2019.81C16.7639%2019.813%2016.362%2019.939%2016.022%2020.172C15.4164%2020.5489%2014.7173%2020.7487%2014.004%2020.7487C13.2907%2020.7487%2012.5916%2020.5489%2011.986%2020.172C11.6459%2019.9391%2011.2441%2019.8131%2010.832%2019.81C10.331%2019.8278%209.84306%2019.9741%209.415%2020.235C8.8824%2020.55%208.2794%2020.7267%207.661%2020.749M11.545%207.455C11.4376%207.455%2011.3312%207.47616%2011.232%207.51727C11.1327%207.55837%2011.0425%207.61863%2010.9666%207.69459C10.8906%207.77055%2010.8304%207.86072%2010.7893%207.95996C10.7482%208.05921%2010.727%208.16558%2010.727%208.273C10.727%208.38042%2010.7482%208.48679%2010.7893%208.58604C10.8304%208.68528%2010.8906%208.77545%2010.9666%208.85141C11.0425%208.92737%2011.1327%208.98762%2011.232%209.02873C11.3312%209.06984%2011.4376%209.091%2011.545%209.091H16.454C16.5614%209.091%2016.6678%209.06984%2016.767%209.02873C16.8663%208.98762%2016.9565%208.92737%2017.0324%208.85141C17.1084%208.77545%2017.1686%208.68528%2017.2097%208.58604C17.2508%208.48679%2017.272%208.38042%2017.272%208.273C17.272%208.16558%2017.2508%208.05921%2017.2097%207.95996C17.1686%207.86072%2017.1084%207.77055%2017.0324%207.69459C16.9565%207.61863%2016.8663%207.55837%2016.767%207.51727C16.6678%207.47616%2016.5614%207.455%2016.454%207.455H11.545Z'%20fill='white'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M19.547%2012.576L14.212%2010.276C14.1403%2010.2446%2014.0628%2010.2284%2013.9845%2010.2284C13.9062%2010.2284%2013.8287%2010.2446%2013.757%2010.276L8.369%2012.565V10.47C8.36659%2010.3054%208.42956%2010.1465%208.54409%2010.0282C8.65862%209.90994%208.81538%209.84189%208.98%209.839H9.78V7.016C9.79356%206.84427%209.87124%206.68392%209.99759%206.56683C10.1239%206.44974%2010.2897%206.38447%2010.462%206.384H12.686L13.012%205H14.9L15.227%206.385H17.302C17.4743%206.38568%2017.6401%206.45099%2017.7666%206.56802C17.893%206.68504%2017.971%206.84526%2017.985%207.017V9.84H18.93C19.0947%209.8429%2019.2516%209.91091%2019.3663%2010.0292C19.481%2010.1474%2019.5441%2010.3063%2019.542%2010.471L19.547%2012.576ZM21.988%2021.688L23%2022.732C22.76%2022.887%2022.529%2023.052%2022.324%2023.166C21.7324%2023.5544%2021.0486%2023.7793%2020.342%2023.818C19.7004%2023.8019%2019.074%2023.6196%2018.524%2023.289C18.1163%2023.0363%2017.6494%2022.8953%2017.17%2022.88C16.7578%2022.8825%2016.3558%2023.0086%2016.016%2023.242C15.4104%2023.6189%2014.7113%2023.8187%2013.998%2023.8187C13.2847%2023.8187%2012.5856%2023.6189%2011.98%2023.242C11.6401%2023.0088%2011.2382%2022.8827%2010.826%2022.88C10.325%2022.8978%209.83706%2023.0441%209.409%2023.305C8.8764%2023.62%208.2734%2023.7967%207.655%2023.819C6.98598%2023.7805%206.34075%2023.5572%205.791%2023.174C5.555%2023.037%205.281%2022.826%205%2022.645L6%2021.619C6.177%2021.711%206.344%2021.806%206.5%2021.896C6.84094%2022.1462%207.24166%2022.3024%207.662%2022.349C8.06173%2022.3222%208.44875%2022.1975%208.789%2021.986C9.41069%2021.6244%2010.114%2021.4266%2010.833%2021.411C11.4834%2021.4138%2012.1197%2021.6011%2012.668%2021.951C13.0653%2022.2109%2013.5297%2022.3494%2014.0045%2022.3494C14.4793%2022.3494%2014.9437%2022.2109%2015.341%2021.951C15.8893%2021.6011%2016.5256%2021.4138%2017.176%2021.411C17.8774%2021.4238%2018.5634%2021.6185%2019.167%2021.976C19.5218%2022.2003%2019.9287%2022.3288%2020.348%2022.349C20.8173%2022.3024%2021.2672%2022.1379%2021.656%2021.871C21.766%2021.811%2021.879%2021.75%2021.995%2021.689M7.655%2020.748C6.97388%2020.7053%206.31992%2020.4652%205.773%2020.057C5.555%2019.921%205.299%2019.717%205.037%2019.537L6.03%2018.512C6.201%2018.612%206.361%2018.706%206.509%2018.799C6.83974%2019.0604%207.2357%2019.2264%207.654%2019.279C7.98097%2019.2653%208.29988%2019.1734%208.584%2019.011C8.33039%2018.3052%207.96434%2017.645%207.5%2017.056L6.8%2016C6.235%2015.161%206.067%2014.874%207.395%2014.31L13.981%2011.5C14.346%2011.662%2019.518%2013.89%2021%2014.528C21.8%2014.962%2021.611%2015.273%2021.126%2015.997L20.426%2017.057C19.9644%2017.6412%2019.5985%2018.295%2019.342%2018.994C19.6483%2019.1717%2019.9941%2019.27%2020.348%2019.28C20.8034%2019.238%2021.2392%2019.0747%2021.61%2018.807C21.729%2018.74%2021.852%2018.67%2021.978%2018.602L22.984%2019.638C22.741%2019.801%2022.506%2019.976%2022.303%2020.092C21.7239%2020.4861%2021.0476%2020.7134%2020.348%2020.749C19.7065%2020.7325%2019.0802%2020.5503%2018.53%2020.22C18.1226%2019.9666%2017.6555%2019.8252%2017.176%2019.81C16.7639%2019.813%2016.362%2019.939%2016.022%2020.172C15.4164%2020.5489%2014.7173%2020.7487%2014.004%2020.7487C13.2907%2020.7487%2012.5916%2020.5489%2011.986%2020.172C11.6459%2019.9391%2011.2441%2019.8131%2010.832%2019.81C10.331%2019.8278%209.84306%2019.9741%209.415%2020.235C8.8824%2020.55%208.2794%2020.7267%207.661%2020.749M11.545%207.455C11.4376%207.455%2011.3312%207.47616%2011.232%207.51727C11.1327%207.55837%2011.0425%207.61863%2010.9666%207.69459C10.8906%207.77055%2010.8304%207.86072%2010.7893%207.95996C10.7482%208.05921%2010.727%208.16558%2010.727%208.273C10.727%208.38042%2010.7482%208.48679%2010.7893%208.58604C10.8304%208.68528%2010.8906%208.77545%2010.9666%208.85141C11.0425%208.92737%2011.1327%208.98762%2011.232%209.02873C11.3312%209.06984%2011.4376%209.091%2011.545%209.091H16.454C16.5614%209.091%2016.6678%209.06984%2016.767%209.02873C16.8663%208.98762%2016.9565%208.92737%2017.0324%208.85141C17.1084%208.77545%2017.1686%208.68528%2017.2097%208.58604C17.2508%208.48679%2017.272%208.38042%2017.272%208.273C17.272%208.16558%2017.2508%208.05921%2017.2097%207.95996C17.1686%207.86072%2017.1084%207.77055%2017.0324%207.69459C16.9565%207.61863%2016.8663%207.55837%2016.767%207.51727C16.6678%207.47616%2016.5614%207.455%2016.454%207.455H11.545Z'%20fill='%23111111'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M18.855%2020.6838C19.5293%2020.4968%2020.1237%2020.094%2020.5473%2019.537C20.9708%2018.98%2021.2001%2018.2995%2021.2%2017.5998V7.9998C21.2%207.15111%2020.8629%206.33718%2020.2627%205.73706C19.6626%205.13695%2018.8487%204.7998%2018%204.7998H10C9.15131%204.7998%208.33737%205.13695%207.73726%205.73706C7.13714%206.33718%206.8%207.15111%206.8%207.9998V17.5998C6.79993%2018.2995%207.02921%2018.98%207.45274%2019.537C7.87627%2020.094%208.4707%2020.4968%209.145%2020.6838L6%2023.1998H9.035L12.07%2020.7998H15.985L18.993%2023.1998H22L18.855%2020.6838ZM10.4%2017.9998C10.1627%2017.9998%209.93065%2017.9294%209.73332%2017.7976C9.53598%2017.6657%209.38217%2017.4783%209.29134%2017.259C9.20052%2017.0398%209.17676%2016.7985%209.22306%2016.5657C9.26936%2016.3329%209.38365%2016.1191%209.55147%2015.9513C9.7193%2015.7835%209.93311%2015.6692%2010.1659%2015.6229C10.3987%2015.5766%2010.6399%2015.6003%2010.8592%2015.6911C11.0785%2015.782%2011.2659%2015.9358%2011.3978%2016.1331C11.5296%2016.3305%2011.6%2016.5625%2011.6%2016.7998C11.6%2016.9574%2011.569%2017.1134%2011.5087%2017.259C11.4483%2017.4046%2011.36%2017.5369%2011.2485%2017.6483C11.1371%2017.7598%2011.0048%2017.8482%2010.8592%2017.9085C10.7136%2017.9688%2010.5576%2017.9998%2010.4%2017.9998ZM10.023%2013.5998C9.83132%2013.5997%209.64603%2013.5309%209.50085%2013.4057C9.35568%2013.2805%209.26027%2013.1074%209.232%2012.9178L8.514%208.1178C8.49839%208.01386%208.50343%207.90785%208.52881%207.80585C8.55419%207.70385%208.59942%207.60785%208.66193%207.52334C8.72443%207.43883%208.80297%207.36747%208.89306%207.31332C8.98316%207.25918%209.08304%207.22333%209.187%207.2078C9.22444%207.20258%209.2622%207.19991%209.3%207.1998H13.2V13.5998H10.023ZM14%2018.3998C13.6835%2018.3998%2013.3742%2018.306%2013.1111%2018.1302C12.848%2017.9543%2012.6429%2017.7045%2012.5218%2017.4121C12.4007%2017.1197%2012.369%2016.798%2012.4307%2016.4877C12.4925%2016.1773%2012.6449%2015.8922%2012.8686%2015.6684C13.0924%2015.4447%2013.3775%2015.2923%2013.6879%2015.2305C13.9982%2015.1688%2014.3199%2015.2005%2014.6123%2015.3216C14.9047%2015.4427%2015.1545%2015.6478%2015.3304%2015.9109C15.5062%2016.174%2015.6%2016.4834%2015.6%2016.7998C15.6%2017.2242%2015.4314%2017.6311%2015.1314%2017.9312C14.8313%2018.2312%2014.4243%2018.3998%2014%2018.3998ZM14.8%2013.5998V7.1998H18.94C19.0451%207.1998%2019.1491%207.2205%2019.2461%207.2607C19.3432%207.3009%2019.4314%207.35983%2019.5057%207.43412C19.58%207.50841%2019.6389%207.5966%2019.6791%207.69366C19.7193%207.79072%2019.74%207.89475%2019.74%207.9998C19.7397%208.03926%2019.7371%208.07867%2019.732%208.1178L19.014%2012.9178C18.9857%2013.1076%2018.8902%2013.2808%2018.7448%2013.406C18.5994%2013.5312%2018.4139%2013.6%2018.222%2013.5998H14.8ZM17.6%2017.9998C17.3627%2017.9998%2017.1307%2017.9294%2016.9333%2017.7976C16.736%2017.6657%2016.5822%2017.4783%2016.4913%2017.259C16.4005%2017.0398%2016.3768%2016.7985%2016.4231%2016.5657C16.4694%2016.3329%2016.5836%2016.1191%2016.7515%2015.9513C16.9193%2015.7835%2017.1331%2015.6692%2017.3659%2015.6229C17.5987%2015.5766%2017.8399%2015.6003%2018.0592%2015.6911C18.2785%2015.782%2018.4659%2015.9358%2018.5978%2016.1331C18.7296%2016.3305%2018.8%2016.5625%2018.8%2016.7998C18.8%2017.1181%2018.6736%2017.4233%2018.4485%2017.6483C18.2235%2017.8734%2017.9183%2017.9998%2017.6%2017.9998Z'%20fill='white'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M18.855%2020.6838C19.5293%2020.4968%2020.1237%2020.094%2020.5473%2019.537C20.9708%2018.98%2021.2001%2018.2995%2021.2%2017.5998V7.9998C21.2%207.15111%2020.8629%206.33718%2020.2627%205.73706C19.6626%205.13695%2018.8487%204.7998%2018%204.7998H10C9.15131%204.7998%208.33737%205.13695%207.73726%205.73706C7.13714%206.33718%206.8%207.15111%206.8%207.9998V17.5998C6.79993%2018.2995%207.02921%2018.98%207.45274%2019.537C7.87627%2020.094%208.4707%2020.4968%209.145%2020.6838L6%2023.1998H9.035L12.07%2020.7998H15.985L18.993%2023.1998H22L18.855%2020.6838ZM10.4%2017.9998C10.1627%2017.9998%209.93065%2017.9294%209.73332%2017.7976C9.53598%2017.6657%209.38217%2017.4783%209.29134%2017.259C9.20052%2017.0398%209.17676%2016.7985%209.22306%2016.5657C9.26936%2016.3329%209.38365%2016.1191%209.55147%2015.9513C9.7193%2015.7835%209.93311%2015.6692%2010.1659%2015.6229C10.3987%2015.5766%2010.6399%2015.6003%2010.8592%2015.6911C11.0785%2015.782%2011.2659%2015.9358%2011.3978%2016.1331C11.5296%2016.3305%2011.6%2016.5625%2011.6%2016.7998C11.6%2016.9574%2011.569%2017.1134%2011.5087%2017.259C11.4483%2017.4046%2011.36%2017.5369%2011.2485%2017.6483C11.1371%2017.7598%2011.0048%2017.8482%2010.8592%2017.9085C10.7136%2017.9688%2010.5576%2017.9998%2010.4%2017.9998ZM10.023%2013.5998C9.83132%2013.5997%209.64603%2013.5309%209.50085%2013.4057C9.35568%2013.2805%209.26027%2013.1074%209.232%2012.9178L8.514%208.1178C8.49839%208.01386%208.50343%207.90785%208.52881%207.80585C8.55419%207.70385%208.59942%207.60785%208.66193%207.52334C8.72443%207.43883%208.80297%207.36747%208.89306%207.31332C8.98316%207.25918%209.08304%207.22333%209.187%207.2078C9.22444%207.20258%209.2622%207.19991%209.3%207.1998H13.2V13.5998H10.023ZM14%2018.3998C13.6835%2018.3998%2013.3742%2018.306%2013.1111%2018.1302C12.848%2017.9543%2012.6429%2017.7045%2012.5218%2017.4121C12.4007%2017.1197%2012.369%2016.798%2012.4307%2016.4877C12.4925%2016.1773%2012.6449%2015.8922%2012.8686%2015.6684C13.0924%2015.4447%2013.3775%2015.2923%2013.6879%2015.2305C13.9982%2015.1688%2014.3199%2015.2005%2014.6123%2015.3216C14.9047%2015.4427%2015.1545%2015.6478%2015.3304%2015.9109C15.5062%2016.174%2015.6%2016.4834%2015.6%2016.7998C15.6%2017.2242%2015.4314%2017.6311%2015.1314%2017.9312C14.8313%2018.2312%2014.4243%2018.3998%2014%2018.3998ZM14.8%2013.5998V7.1998H18.94C19.0451%207.1998%2019.1491%207.2205%2019.2461%207.2607C19.3432%207.3009%2019.4314%207.35983%2019.5057%207.43412C19.58%207.50841%2019.6389%207.5966%2019.6791%207.69366C19.7193%207.79072%2019.74%207.89475%2019.74%207.9998C19.7397%208.03926%2019.7371%208.07867%2019.732%208.1178L19.014%2012.9178C18.9857%2013.1076%2018.8902%2013.2808%2018.7448%2013.406C18.5994%2013.5312%2018.4139%2013.6%2018.222%2013.5998H14.8ZM17.6%2017.9998C17.3627%2017.9998%2017.1307%2017.9294%2016.9333%2017.7976C16.736%2017.6657%2016.5822%2017.4783%2016.4913%2017.259C16.4005%2017.0398%2016.3768%2016.7985%2016.4231%2016.5657C16.4694%2016.3329%2016.5836%2016.1191%2016.7515%2015.9513C16.9193%2015.7835%2017.1331%2015.6692%2017.3659%2015.6229C17.5987%2015.5766%2017.8399%2015.6003%2018.0592%2015.6911C18.2785%2015.782%2018.4659%2015.9358%2018.5978%2016.1331C18.7296%2016.3305%2018.8%2016.5625%2018.8%2016.7998C18.8%2017.1181%2018.6736%2017.4233%2018.4485%2017.6483C18.2235%2017.8734%2017.9183%2017.9998%2017.6%2017.9998Z'%20fill='%23111111'/%3e%3c/svg%3e\"","import { Theme } from '../models/theme';\nimport styles from './ImageIcon.module.scss';\nimport spinnerImage from '@assets/images/spinner.svg';\nimport spinnerLightThemeImage from '@assets/images/light-theme/spinner.svg';\nimport brandingImage from '@assets/images/vasttrafik.svg';\nimport brandingLightThemeImage from '@assets/images/light-theme/vasttrafik.svg';\nimport trafficSituationSlightImage from '@assets/images/traffic-situation-slight.svg';\nimport trafficSituationNormalImage from '@assets/images/traffic-situation-normal.svg';\nimport trafficSituationSevereImage from '@assets/images/traffic-situation-severe.svg';\nimport wheelcharAccessibleImage from '@assets/images/wheelchair-accessible.svg';\nimport wheelcharAccessibleLightThemeImage from '@assets/images/light-theme/wheelchair-accessible.svg';\nimport campaignImage from '@assets/images/campaign.svg';\nimport campaignLightThemeImage from '@assets/images/light-theme/campaign.svg';\nimport transportModeTramImage from '@assets/images/transport-mode-tram.svg';\nimport transportModeTramLightThemeImage from '@assets/images/light-theme/transport-mode-tram.svg';\nimport transportModeBusImage from '@assets/images/transport-mode-bus.svg';\nimport transportModeBusLightThemeImage from '@assets/images/light-theme/transport-mode-bus.svg';\nimport transportModeFerryImage from '@assets/images/transport-mode-ferry.svg';\nimport transportModeFerryLightThemeImage from '@assets/images/light-theme/transport-mode-ferry.svg';\nimport transportModeTrainImage from '@assets/images/transport-mode-train.svg';\nimport transportModeTrainLightThemeImage from '@assets/images/light-theme/transport-mode-train.svg';\nimport { forwardRef, LegacyRef, useContext } from 'react';\nimport { ThemeContext } from './Boards';\n\nexport type Icon =\n | 'branding'\n | 'spinner'\n | 'traffic-situation-slight'\n | 'traffic-situation-normal'\n | 'traffic-situation-severe'\n | 'wheelchair-accessible'\n | 'campaign'\n | 'transport-mode-tram'\n | 'transport-mode-bus'\n | 'transport-mode-ferry'\n | 'transport-mode-train';\n\ninterface ImageIconProps {\n type: Icon;\n alt: string;\n className?: string;\n}\n\nconst ImageIcon = forwardRef(\n (\n { type, alt, className }: ImageIconProps,\n ref: LegacyRef\n ) => {\n const theme = useContext(ThemeContext);\n\n function getImageSource(theme: Theme): string {\n switch (type) {\n case 'spinner':\n return theme === 'light' ? spinnerLightThemeImage : spinnerImage;\n case 'branding':\n return theme === 'light' ? brandingLightThemeImage : brandingImage;\n case 'traffic-situation-slight':\n return trafficSituationSlightImage;\n case 'traffic-situation-normal':\n return trafficSituationNormalImage;\n case 'traffic-situation-severe':\n return trafficSituationSevereImage;\n case 'wheelchair-accessible':\n return theme === 'light'\n ? wheelcharAccessibleLightThemeImage\n : wheelcharAccessibleImage;\n case 'campaign':\n return theme === 'light' ? campaignLightThemeImage : campaignImage;\n case 'transport-mode-tram':\n return theme === 'light'\n ? transportModeTramLightThemeImage\n : transportModeTramImage;\n case 'transport-mode-bus':\n return theme === 'light'\n ? transportModeBusLightThemeImage\n : transportModeBusImage;\n case 'transport-mode-ferry':\n return theme === 'light'\n ? transportModeFerryLightThemeImage\n : transportModeFerryImage;\n case 'transport-mode-train':\n return theme === 'light'\n ? transportModeTrainLightThemeImage\n : transportModeTrainImage;\n }\n }\n\n return (\n \n );\n }\n);\n\nImageIcon.displayName = 'ImageIcon';\n\nexport default ImageIcon;\n","import { TransportMode } from '@shared/models/transportMode';\nimport styles from './DepartureOrArrivalTableTransportModeCell.module.scss';\nimport ImageIcon from '@shared/components/ImageIcon';\n\ninterface DepartureOrArrivalTableTransportModeCellProps {\n transportMode: TransportMode | undefined;\n}\n\nexport default function DepartureOrArrivalTableTransportModeCell({\n transportMode,\n}: DepartureOrArrivalTableTransportModeCellProps) {\n function getTransportModeText(\n transportMode: TransportMode | undefined\n ): string {\n switch (transportMode) {\n case 'tram':\n return 'Spårvagn';\n\n case 'bus':\n return 'Buss';\n\n case 'ferry':\n return 'Färja';\n\n case 'train':\n return 'Tåg';\n\n default:\n return '';\n }\n }\n\n return (\n \n {transportMode && (\n \n )}\n \n );\n}\n","import { RefObject, useEffect, useState } from 'react';\n\ninterface UseElementSizeOptions {\n /** If the ref object is currently being rendered. Default true. */\n renderRef?: boolean;\n\n /** The box sizing to use for the element size. Default is 'border-box'. */\n boxSizing?: 'content-box' | 'border-box';\n\n /** If margins should be included in size. Default false. */\n includeMargin?: boolean;\n}\n\ninterface ElementSize {\n width: number | undefined;\n height: number | undefined;\n}\n\nexport default function useElementSize(\n ref: RefObject,\n { renderRef, boxSizing, includeMargin }: UseElementSizeOptions = {}\n) {\n const [size, setSize] = useState({\n width: undefined,\n height: undefined,\n });\n\n useEffect(() => {\n if (renderRef) {\n onResize();\n }\n\n function getSize(ref: RefObject): ElementSize {\n if (!ref.current) {\n return { width: undefined, height: undefined };\n }\n const bounds = ref.current.getBoundingClientRect();\n\n let width = bounds.width;\n let height = bounds.height;\n\n if (boxSizing === 'content-box') {\n const style = window.getComputedStyle(ref.current);\n width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);\n height -=\n parseFloat(style.paddingTop) + parseFloat(style.paddingBottom);\n }\n\n if (includeMargin) {\n const style = window.getComputedStyle(ref.current);\n width += parseFloat(style.marginLeft) + parseFloat(style.marginRight);\n height += parseFloat(style.marginTop) + parseFloat(style.marginBottom);\n }\n\n return {\n width,\n height,\n };\n }\n\n function onResize() {\n setSize(getSize(ref));\n }\n\n const resizeObserver = new ResizeObserver(onResize);\n if (ref.current) {\n resizeObserver.observe(ref.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [boxSizing, includeMargin, ref, renderRef]);\n\n return size;\n}\n","import { useRef } from 'react';\nimport { Direction } from '@shared/models/direction';\nimport styles from './DepartureOrArrivalTableDirectionCell.module.scss';\nimport { useScaledFontSize } from '@shared/hooks/useScaledFontSize';\nimport ImageIcon from '@shared/components/ImageIcon';\nimport { DepartureOrArrivalTimeFormat } from '@shared/models/departureOrArrivalTimeFormat';\nimport useElementSize from '@shared/hooks/useElementSize';\n\ninterface DepartureOrArrivalTableDirectionCellProps {\n directionOrOrigin: Direction | string;\n tags?: string[];\n timeFormat: DepartureOrArrivalTimeFormat;\n headerWidth?: number;\n}\n\nexport default function DepartureOrArrivalTableDirectionOrOriginCell({\n directionOrOrigin,\n tags,\n timeFormat,\n headerWidth,\n}: DepartureOrArrivalTableDirectionCellProps) {\n const wheelchairAccessibleRef = useRef(null);\n const wheelCharAccessibleSize = useElementSize(wheelchairAccessibleRef, {\n includeMargin: true,\n });\n\n const directionNameRef = useRef(null);\n useScaledFontSize(directionNameRef, {\n reservedSpace: wheelCharAccessibleSize.width,\n });\n\n const directionViaRef = useRef(null);\n useScaledFontSize(directionViaRef);\n return (\n \n
\n \n {typeof directionOrOrigin === 'string'\n ? directionOrOrigin\n : directionOrOrigin.name}\n \n {timeFormat === 'time' && (\n \n )}\n
\n\n {typeof directionOrOrigin !== 'string' && directionOrOrigin.via && (\n
\n via {directionOrOrigin.via}\n
\n )}\n {tags?.map((tag, tagIndex) => (\n \n {tag}\n {tagIndex !== tags.length - 1 && , }\n \n ))}\n \n );\n}\n","export function formatDepartureTimeCountdown(\n estimatedOtherwisePlannedTime: Date\n): string | number {\n const now = new Date();\n const difference = estimatedOtherwisePlannedTime.getTime() - now.getTime();\n const minutesToDeparture = Math.round(difference / 1000 / 60);\n return minutesToDeparture <= 0 ? 'nu' : minutesToDeparture;\n}\n","export function dateToClockFormat(date: Date): string {\n return Intl.DateTimeFormat('sv-SE', {\n hour: 'numeric',\n minute: 'numeric',\n timeZone: 'Europe/Stockholm',\n }).format(date);\n}\n","import { useEffect, useState } from 'react';\nimport { formatDepartureTimeCountdown } from '../utils/formatDepartureOrArrivalTime';\nimport { DepartureOrArrival } from '@shared/models/departureOrArrival';\nimport { DepartureOrArrivalTimeFormat } from '@shared/models/departureOrArrivalTimeFormat';\nimport { dateToClockFormat } from '@shared/utils/time';\n\nexport function useDepartureDisplayTime(\n departureOrArrival: DepartureOrArrival | undefined,\n format: DepartureOrArrivalTimeFormat\n) {\n const [displayTime, setDisplayTime] = useState();\n\n useEffect(() => {\n function getDisplayTime(\n departureOrArrival: DepartureOrArrival | undefined\n ): number | string | undefined {\n if (!departureOrArrival) {\n return undefined;\n }\n\n if (departureOrArrival.isCancelled) {\n return 'Inställd';\n }\n\n if (format === 'time') {\n return dateToClockFormat(\n departureOrArrival.estimatedOtherwisePlannedTime\n );\n }\n\n return formatDepartureTimeCountdown(\n departureOrArrival.estimatedOtherwisePlannedTime\n );\n }\n\n setDisplayTime(getDisplayTime(departureOrArrival));\n\n const intervalId = setInterval(() => {\n setDisplayTime(getDisplayTime(departureOrArrival));\n }, 1000);\n\n return () => {\n clearInterval(intervalId);\n };\n }, [departureOrArrival, format]);\n\n return displayTime;\n}\n","import { DepartureOrArrival } from '@shared/models/departureOrArrival';\nimport { dateToClockFormat } from '@shared/utils/time';\n\nexport function getHasChangedPlannedClockTime(\n departure: DepartureOrArrival\n): boolean {\n const plannedTimeClock = dateToClockFormat(\n departure.plannedTime ?? new Date()\n );\n const estimatedOtherwisePlannedTimeClock = dateToClockFormat(\n departure.estimatedOtherwisePlannedTime\n );\n\n return (\n departure.isCancelled ||\n plannedTimeClock !== estimatedOtherwisePlannedTimeClock\n );\n}\n","import classNames from 'classnames';\nimport { DepartureOrArrival } from '@shared/models/departureOrArrival';\nimport ImageIcon, { Icon } from '@shared/components/ImageIcon';\nimport { useDepartureDisplayTime } from '@shared/hooks/useDepartureOrArrivalDisplayTime';\nimport styles from './DepartureOrArrivalTableDepartureOrArrivalCell.module.scss';\nimport { DepartureOrArrivalTimeFormat } from '@shared/models/departureOrArrivalTimeFormat';\nimport { getHasChangedPlannedClockTime } from '@shared/utils/departureOrArrival';\n\ninterface DepartureOrArrivalTableDepartureCellProps {\n departureOrArrival: DepartureOrArrival | undefined;\n compact: boolean;\n format: DepartureOrArrivalTimeFormat;\n hasDepartureOrArrivalWithTrafficSituation: boolean;\n headerWidth?: number;\n}\n\nexport default function DepartureOrArrivalTableDepartureCell({\n departureOrArrival,\n compact,\n format,\n hasDepartureOrArrivalWithTrafficSituation,\n headerWidth,\n}: DepartureOrArrivalTableDepartureCellProps) {\n const departureDisplayTime = useDepartureDisplayTime(\n departureOrArrival,\n format\n );\n\n const trafficSituationIconType: Icon | undefined =\n departureOrArrival?.trafficSituationSeverity\n ? `traffic-situation-${departureOrArrival.trafficSituationSeverity}`\n : undefined;\n\n const displayInformation =\n format === 'countdown' ||\n (departureOrArrival && getHasChangedPlannedClockTime(departureOrArrival));\n\n const renderWheelchairAccessible =\n format === 'countdown' &&\n !departureOrArrival?.isCancelled &&\n departureOrArrival?.isWheelchairAccessible;\n\n return (\n \n {displayInformation && (\n \n {trafficSituationIconType && (\n \n )}\n {departureDisplayTime && (\n \n {departureDisplayTime}\n \n )}\n {departureDisplayTime && typeof departureDisplayTime === 'number' && (\n minuter\n )}\n {renderWheelchairAccessible && (\n \n )}\n \n )}\n \n );\n}\n","import { useRef } from 'react';\nimport styles from './DepartureOrArrivalTablePlatformCell.module.scss';\nimport { useScaledFontSize } from '@shared/hooks/useScaledFontSize';\n\ninterface DepartureOrArrivalTablePlatformCellProps {\n platform?: string;\n headerWidth?: number;\n}\n\nexport default function DepartureOrArrivalTablePlatformCell({\n platform,\n headerWidth,\n}: DepartureOrArrivalTablePlatformCellProps) {\n const textRef = useRef(null);\n useScaledFontSize(textRef, {\n enabled: platform !== undefined && platform.length > 1,\n });\n return (\n \n {platform && (\n \n \n {platform}\n \n \n )}\n \n );\n}\n","import { useEffect, useMemo, useState } from 'react';\n\ntype ItemId = string;\n\nexport interface PaginationOptions {\n /** The direction elements will be added in, defaults to vertical. */\n elementFlow?: 'vertical' | 'horizontal';\n\n /** If order can be ignored to pack pages with items. */\n ignoreItemOrderToPackPages?: boolean;\n\n /** If items in multi page scenarios should directly be replaced with most current item with same id. */\n directlyUpdateItemsWithMostCurrentItems?: boolean;\n\n /** Sets if only the first page should be handled and following pages discarded */\n singlePage?: boolean;\n\n /** Function to be used to re-sort items when changing page. */\n pageChangeSortingFunction?: (first: TItem, second: TItem) => number;\n}\n\nexport default function usePagination<\n TItem extends object,\n TElement extends HTMLElement\n>(\n availableSize: number | undefined,\n mostCurrentItems: TItem[],\n itemElementsById: Map,\n idPropertyName: keyof TItem,\n {\n elementFlow,\n ignoreItemOrderToPackPages,\n directlyUpdateItemsWithMostCurrentItems,\n singlePage,\n pageChangeSortingFunction,\n }: PaginationOptions = {}\n) {\n const [items, setItems] = useState(\n structuredClone(mostCurrentItems)\n );\n const itemsById = useMemo(() => {\n return new Map(\n items.map((item) => [item[idPropertyName] as ItemId, item])\n );\n }, [idPropertyName, items]);\n const [currentPageIndex, setCurrentPageIndex] = useState(0);\n const [itemIdPages, setItemIdPages] = useState>([[]]);\n const [itemIdsShown, setItemIdsShown] = useState([]);\n const pages = itemIdPages.length;\n const [paginationItemIdSuffix, setPaginationItemIdSuffix] = useState(0); // Pagination item id suffix is used as suffix because items might move from last page to first, which would mess up animations as the item would already be present on first page at start\n const itemsForCurrentPage = useMemo(() => {\n const idsForCurrentPage = itemIdPages[currentPageIndex];\n if (idsForCurrentPage === undefined) {\n return [];\n }\n return idsForCurrentPage.reduce((acc, itemId) => {\n const item = itemsById.get(itemId);\n if (item) {\n acc.push([item, itemId + paginationItemIdSuffix.toString()]);\n }\n return acc;\n }, new Array<[TItem, string]>());\n }, [currentPageIndex, itemIdPages, itemsById, paginationItemIdSuffix]);\n\n useEffect(() => {\n if (pages <= 1) {\n setItems(structuredClone(mostCurrentItems));\n } else if (directlyUpdateItemsWithMostCurrentItems) {\n setItems((items) => {\n const newItems = structuredClone(items);\n newItems.forEach((item, itemIndex) => {\n const mostCurrentItem = mostCurrentItems.find(\n (mostCurrentItemCandidate) =>\n mostCurrentItemCandidate[idPropertyName] === item[idPropertyName]\n );\n if (!mostCurrentItem) {\n return;\n }\n\n newItems[itemIndex] = structuredClone(mostCurrentItem);\n });\n return newItems;\n });\n }\n }, [\n directlyUpdateItemsWithMostCurrentItems,\n idPropertyName,\n mostCurrentItems,\n pages,\n ]);\n\n useEffect(() => {\n const itemElementsResizeObserver = new ResizeObserver(() => {\n recalculatePagination();\n });\n for (const itemElement of itemElementsById.values()) {\n itemElementsResizeObserver.observe(itemElement);\n }\n\n recalculatePagination();\n\n function recalculatePagination(): void {\n if (availableSize === undefined || !itemsAndElementsAreSynced()) {\n return;\n }\n\n const newItemIdsPages = new Array();\n let itemIds = items.map((item) => getItemId(item));\n while (itemIds.length > 0) {\n const newPage = new Array();\n let availableSizeLeft: number = availableSize;\n\n for (const itemId of itemIds) {\n const itemElement = itemElementsById.get(itemId);\n\n if (!itemElement) {\n throw new Error(\n `Could not find element for item with id ${itemId}, items and elements are expected to be in sync.`\n );\n }\n\n const itemElementSize = itemElement.getBoundingClientRect();\n const nextItemSize =\n !elementFlow || elementFlow === 'vertical'\n ? itemElementSize.height\n : itemElementSize.width;\n\n // Experienced rounding issue for percentage sizes while zoomed without the 0.1 marginal\n if (\n availableSizeLeft < nextItemSize - 0.1 &&\n availableSizeLeft != availableSize\n ) {\n if (ignoreItemOrderToPackPages) {\n continue;\n } else {\n break;\n }\n }\n\n let elementGap = 0;\n if (itemElement.parentElement) {\n const gapPropertyName =\n !elementFlow || elementFlow === 'vertical'\n ? 'row-gap'\n : 'column-gap';\n const elementGapValue = window\n .getComputedStyle(itemElement.parentElement)\n .getPropertyValue(gapPropertyName);\n elementGap =\n elementGapValue && elementGapValue !== 'normal'\n ? parseFloat(elementGapValue)\n : 0;\n }\n\n availableSizeLeft -= nextItemSize + elementGap;\n newPage.push(itemId);\n }\n\n newItemIdsPages.push(newPage);\n\n if (singlePage) {\n break;\n }\n\n itemIds = itemIds.filter((itemId) => !newPage.includes(itemId));\n }\n\n let newPageIndex = 0;\n\n // Skip already shown pages\n if (newItemIdsPages.length > 1 && itemIdsShown.length > 0) {\n for (\n let pageIndex = 0;\n pageIndex < newItemIdsPages.length;\n pageIndex++\n ) {\n const itemIdsForPage = newItemIdsPages[pageIndex];\n if (\n itemIdsForPage !== undefined &&\n itemIdsForPage.length > 0 &&\n itemIdsForPage.every((pageItemId) =>\n itemIdsShown.includes(pageItemId)\n )\n ) {\n newPageIndex++;\n } else {\n break;\n }\n }\n }\n\n setItemIdPages(newItemIdsPages);\n\n setCurrentPageIndex(newPageIndex);\n }\n\n function itemsAndElementsAreSynced(): boolean {\n if (items.length !== itemElementsById.size) {\n return false;\n }\n\n for (const item of items) {\n const itemId = getItemId(item);\n if (!itemElementsById.get(itemId)) {\n return false;\n }\n }\n\n return true;\n }\n\n function getItemId(item: TItem): string {\n const itemId = item[idPropertyName];\n if (typeof itemId !== 'string') {\n throw new Error(`Item id property is expected to be of string type.`);\n }\n if (!itemId) {\n throw new Error(\n `Encountered an item without id property for ${idPropertyName.toString()}.`\n );\n }\n return itemId;\n }\n\n return () => {\n itemElementsResizeObserver.disconnect();\n };\n }, [\n availableSize,\n elementFlow,\n idPropertyName,\n ignoreItemOrderToPackPages,\n itemElementsById,\n itemIdsShown,\n items,\n singlePage,\n ]);\n\n function nextPage() {\n if (currentPageIndex + 1 >= itemIdPages.length) {\n // Only re-calculate if more than one page\n if (pages > 1) {\n returnToFirstPage();\n }\n } else {\n if (pageChangeSortingFunction) {\n setItemIdPages((itemIdPages) => {\n const newItemIdPages = structuredClone(itemIdPages);\n const itemIdsForNextPage = newItemIdPages[currentPageIndex + 1];\n if (itemIdsForNextPage) {\n itemIdsForNextPage.sort((firstId, secondId) => {\n const firstItem = itemsById.get(firstId);\n const secondItem = itemsById.get(secondId);\n\n if (!firstItem || !secondItem) {\n throw new Error('Expected items not found.');\n }\n\n return pageChangeSortingFunction(firstItem, secondItem);\n });\n }\n\n return newItemIdPages;\n });\n const newItemIdsOrder = new Array().concat(...itemIdPages);\n setItems(\n newItemIdsOrder.map((itemId) => {\n const item = itemsById.get(itemId);\n if (!item) {\n throw new Error('Expected item not found.');\n }\n return item;\n })\n );\n }\n\n setItemIdsShown((itemIdsShown) => {\n const itemIdsForCurrentPage = itemIdPages[currentPageIndex] ?? [];\n return itemIdsShown.concat(itemIdsForCurrentPage);\n });\n setCurrentPageIndex(currentPageIndex + 1);\n }\n }\n\n function returnToFirstPage(): void {\n setCurrentPageIndex(0);\n\n setPaginationItemIdSuffix(\n (paginationItemIdSuffix) => (paginationItemIdSuffix + 1) % 2\n );\n\n setItems(structuredClone(mostCurrentItems));\n\n setItemIdsShown([]);\n }\n\n return {\n items,\n itemsForCurrentPage,\n itemIdPages,\n currentPageIndex,\n pages,\n nextPage,\n };\n}\n","import classNames from 'classnames';\nimport styles from './PageIndicator.module.scss';\n\ninterface PageIndicatorProps {\n currentPagePaginationTime: number;\n currentPageIndex: number;\n pages: number;\n paging: () => void;\n}\n\nexport default function PageIndicator({\n currentPagePaginationTime,\n currentPageIndex,\n pages,\n paging,\n}: PageIndicatorProps) {\n return (\n
\n {[...Array(pages)].map((_, pageIndex) => {\n return (\n \n {pageIndex === currentPageIndex && (\n \n )}\n \n );\n })}\n
\n );\n}\n","export function getRemPropertyPixelSize(\n element: HTMLElement,\n propertyName: string\n): number {\n const rootFontSize = parseFloat(\n getComputedStyle(document.documentElement).getPropertyValue('font-size')\n );\n const fontSizeRem = parseFloat(\n window.getComputedStyle(element).getPropertyValue(propertyName)\n );\n return fontSizeRem * rootFontSize;\n}\n","import { DepartureRow } from 'src/modules/departures/models/departureRow';\nimport { DepartureOrArrivalSorting } from '@shared/models/departureOrArrivalSorting';\nimport { ArrivalRow } from 'src/modules/arrivals/models/arrivalRow';\n\nexport function compareRows(\n first: DepartureRow | ArrivalRow,\n second: DepartureRow | ArrivalRow,\n sorting: DepartureOrArrivalSorting\n): number {\n function getComparisonTime(\n row: DepartureRow | ArrivalRow\n ): number | undefined {\n if (!row.next.isCancelled) {\n return row.next.estimatedOtherwisePlannedTime.getTime();\n }\n\n if (row.thereafter && !row.thereafter.isCancelled) {\n return row.thereafter.estimatedOtherwisePlannedTime.getTime();\n }\n\n return undefined;\n }\n\n if (sorting === 'time') {\n const firstTime = getComparisonTime(first);\n const secondTime = getComparisonTime(second);\n\n if (\n firstTime !== undefined &&\n firstTime === secondTime &&\n first.next.isCancelled !== second.next.isCancelled\n ) {\n return first.next.isCancelled ? -1 : 1;\n }\n\n if (\n firstTime !== undefined &&\n secondTime !== undefined &&\n firstTime !== secondTime\n ) {\n return firstTime - secondTime;\n }\n\n if (firstTime && secondTime === undefined) {\n return -1;\n }\n\n if (firstTime === undefined && secondTime) {\n return 1;\n }\n }\n\n const firstNumeric = parseInt(first.line.shortName, 10);\n const secondNumeric = parseInt(second.line.shortName, 10);\n if (!Number.isNaN(firstNumeric) && Number.isNaN(secondNumeric)) {\n return -1;\n }\n\n if (Number.isNaN(firstNumeric) && !Number.isNaN(secondNumeric)) {\n return 1;\n }\n\n if (\n !Number.isNaN(firstNumeric) &&\n !Number.isNaN(secondNumeric) &&\n firstNumeric !== secondNumeric\n ) {\n return firstNumeric - secondNumeric;\n }\n\n if ('origin' in first && 'origin' in second) {\n return (\n first.line.shortName.localeCompare(second.line.shortName) ||\n first.origin.localeCompare(second.origin)\n );\n }\n\n if ('direction' in first && 'direction' in second) {\n return (\n first.line.shortName.localeCompare(second.line.shortName) ||\n first.direction.name.localeCompare(second.direction.name) ||\n (first.direction.via == null && second.direction.via != null ? -1 : 0) ||\n (first.direction.via != null && second.direction.via != null\n ? first.direction.via.localeCompare(second.direction.via)\n : 0)\n );\n }\n\n return -1;\n}\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (e.includes(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nexport { _objectWithoutPropertiesLoose as default };","function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nexport { _setPrototypeOf as default };","import setPrototypeOf from \"./setPrototypeOf.js\";\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, setPrototypeOf(t, o);\n}\nexport { _inheritsLoose as default };","/**\n * Checks if a given element has a CSS class.\n * \n * @param element the element\n * @param className the CSS class name\n */\nexport default function hasClass(element, className) {\n if (element.classList) return !!className && element.classList.contains(className);\n return (\" \" + (element.className.baseVal || element.className) + \" \").indexOf(\" \" + className + \" \") !== -1;\n}","import hasClass from './hasClass';\n/**\n * Adds a CSS class to a given element.\n * \n * @param element the element\n * @param className the CSS class name\n */\n\nexport default function addClass(element, className) {\n if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + \" \" + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + \" \" + className);\n}","function replaceClassName(origClass, classToRemove) {\n return origClass.replace(new RegExp(\"(^|\\\\s)\" + classToRemove + \"(?:\\\\s|$)\", 'g'), '$1').replace(/\\s+/g, ' ').replace(/^\\s*|\\s*$/g, '');\n}\n/**\n * Removes a CSS class from a given element.\n * \n * @param element the element\n * @param className the CSS class name\n */\n\n\nexport default function removeClass(element, className) {\n if (element.classList) {\n element.classList.remove(className);\n } else if (typeof element.className === 'string') {\n element.className = replaceClassName(element.className, className);\n } else {\n element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));\n }\n}","export default {\n disabled: false\n};","import React from 'react';\nexport default React.createContext(null);","export var forceReflow = function forceReflow(node) {\n return node.scrollTop;\n};","import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport config from './config';\nimport { timeoutsShape } from './utils/PropTypes';\nimport TransitionGroupContext from './TransitionGroupContext';\nimport { forceReflow } from './utils/reflow';\nexport var UNMOUNTED = 'unmounted';\nexport var EXITED = 'exited';\nexport var ENTERING = 'entering';\nexport var ENTERED = 'entered';\nexport var EXITING = 'exiting';\n/**\n * The Transition component lets you describe a transition from one component\n * state to another _over time_ with a simple declarative API. Most commonly\n * it's used to animate the mounting and unmounting of a component, but can also\n * be used to describe in-place transition states as well.\n *\n * ---\n *\n * **Note**: `Transition` is a platform-agnostic base component. If you're using\n * transitions in CSS, you'll probably want to use\n * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)\n * instead. It inherits all the features of `Transition`, but contains\n * additional features necessary to play nice with CSS transitions (hence the\n * name of the component).\n *\n * ---\n *\n * By default the `Transition` component does not alter the behavior of the\n * component it renders, it only tracks \"enter\" and \"exit\" states for the\n * components. It's up to you to give meaning and effect to those states. For\n * example we can add styles to a component when it enters or exits:\n *\n * ```jsx\n * import { Transition } from 'react-transition-group';\n *\n * const duration = 300;\n *\n * const defaultStyle = {\n * transition: `opacity ${duration}ms ease-in-out`,\n * opacity: 0,\n * }\n *\n * const transitionStyles = {\n * entering: { opacity: 1 },\n * entered: { opacity: 1 },\n * exiting: { opacity: 0 },\n * exited: { opacity: 0 },\n * };\n *\n * const Fade = ({ in: inProp }) => (\n * \n * {state => (\n *
\n * I'm a fade Transition!\n *
\n * )}\n *
\n * );\n * ```\n *\n * There are 4 main states a Transition can be in:\n * - `'entering'`\n * - `'entered'`\n * - `'exiting'`\n * - `'exited'`\n *\n * Transition state is toggled via the `in` prop. When `true` the component\n * begins the \"Enter\" stage. During this stage, the component will shift from\n * its current transition state, to `'entering'` for the duration of the\n * transition and then to the `'entered'` stage once it's complete. Let's take\n * the following example (we'll use the\n * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):\n *\n * ```jsx\n * function App() {\n * const [inProp, setInProp] = useState(false);\n * return (\n *
\n * \n * {state => (\n * // ...\n * )}\n * \n * \n *
\n * );\n * }\n * ```\n *\n * When the button is clicked the component will shift to the `'entering'` state\n * and stay there for 500ms (the value of `timeout`) before it finally switches\n * to `'entered'`.\n *\n * When `in` is `false` the same thing happens except the state moves from\n * `'exiting'` to `'exited'`.\n */\n\nvar Transition = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(Transition, _React$Component);\n\n function Transition(props, context) {\n var _this;\n\n _this = _React$Component.call(this, props, context) || this;\n var parentGroup = context; // In the context of a TransitionGroup all enters are really appears\n\n var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;\n var initialStatus;\n _this.appearStatus = null;\n\n if (props.in) {\n if (appear) {\n initialStatus = EXITED;\n _this.appearStatus = ENTERING;\n } else {\n initialStatus = ENTERED;\n }\n } else {\n if (props.unmountOnExit || props.mountOnEnter) {\n initialStatus = UNMOUNTED;\n } else {\n initialStatus = EXITED;\n }\n }\n\n _this.state = {\n status: initialStatus\n };\n _this.nextCallback = null;\n return _this;\n }\n\n Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {\n var nextIn = _ref.in;\n\n if (nextIn && prevState.status === UNMOUNTED) {\n return {\n status: EXITED\n };\n }\n\n return null;\n } // getSnapshotBeforeUpdate(prevProps) {\n // let nextStatus = null\n // if (prevProps !== this.props) {\n // const { status } = this.state\n // if (this.props.in) {\n // if (status !== ENTERING && status !== ENTERED) {\n // nextStatus = ENTERING\n // }\n // } else {\n // if (status === ENTERING || status === ENTERED) {\n // nextStatus = EXITING\n // }\n // }\n // }\n // return { nextStatus }\n // }\n ;\n\n var _proto = Transition.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n this.updateStatus(true, this.appearStatus);\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n var nextStatus = null;\n\n if (prevProps !== this.props) {\n var status = this.state.status;\n\n if (this.props.in) {\n if (status !== ENTERING && status !== ENTERED) {\n nextStatus = ENTERING;\n }\n } else {\n if (status === ENTERING || status === ENTERED) {\n nextStatus = EXITING;\n }\n }\n }\n\n this.updateStatus(false, nextStatus);\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.cancelNextCallback();\n };\n\n _proto.getTimeouts = function getTimeouts() {\n var timeout = this.props.timeout;\n var exit, enter, appear;\n exit = enter = appear = timeout;\n\n if (timeout != null && typeof timeout !== 'number') {\n exit = timeout.exit;\n enter = timeout.enter; // TODO: remove fallback for next major\n\n appear = timeout.appear !== undefined ? timeout.appear : enter;\n }\n\n return {\n exit: exit,\n enter: enter,\n appear: appear\n };\n };\n\n _proto.updateStatus = function updateStatus(mounting, nextStatus) {\n if (mounting === void 0) {\n mounting = false;\n }\n\n if (nextStatus !== null) {\n // nextStatus will always be ENTERING or EXITING.\n this.cancelNextCallback();\n\n if (nextStatus === ENTERING) {\n if (this.props.unmountOnExit || this.props.mountOnEnter) {\n var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749\n // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.\n // To make the animation happen, we have to separate each rendering and avoid being processed as batched.\n\n if (node) forceReflow(node);\n }\n\n this.performEnter(mounting);\n } else {\n this.performExit();\n }\n } else if (this.props.unmountOnExit && this.state.status === EXITED) {\n this.setState({\n status: UNMOUNTED\n });\n }\n };\n\n _proto.performEnter = function performEnter(mounting) {\n var _this2 = this;\n\n var enter = this.props.enter;\n var appearing = this.context ? this.context.isMounting : mounting;\n\n var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing],\n maybeNode = _ref2[0],\n maybeAppearing = _ref2[1];\n\n var timeouts = this.getTimeouts();\n var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED\n // if we are mounting and running this it means appear _must_ be set\n\n if (!mounting && !enter || config.disabled) {\n this.safeSetState({\n status: ENTERED\n }, function () {\n _this2.props.onEntered(maybeNode);\n });\n return;\n }\n\n this.props.onEnter(maybeNode, maybeAppearing);\n this.safeSetState({\n status: ENTERING\n }, function () {\n _this2.props.onEntering(maybeNode, maybeAppearing);\n\n _this2.onTransitionEnd(enterTimeout, function () {\n _this2.safeSetState({\n status: ENTERED\n }, function () {\n _this2.props.onEntered(maybeNode, maybeAppearing);\n });\n });\n });\n };\n\n _proto.performExit = function performExit() {\n var _this3 = this;\n\n var exit = this.props.exit;\n var timeouts = this.getTimeouts();\n var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED\n\n if (!exit || config.disabled) {\n this.safeSetState({\n status: EXITED\n }, function () {\n _this3.props.onExited(maybeNode);\n });\n return;\n }\n\n this.props.onExit(maybeNode);\n this.safeSetState({\n status: EXITING\n }, function () {\n _this3.props.onExiting(maybeNode);\n\n _this3.onTransitionEnd(timeouts.exit, function () {\n _this3.safeSetState({\n status: EXITED\n }, function () {\n _this3.props.onExited(maybeNode);\n });\n });\n });\n };\n\n _proto.cancelNextCallback = function cancelNextCallback() {\n if (this.nextCallback !== null) {\n this.nextCallback.cancel();\n this.nextCallback = null;\n }\n };\n\n _proto.safeSetState = function safeSetState(nextState, callback) {\n // This shouldn't be necessary, but there are weird race conditions with\n // setState callbacks and unmounting in testing, so always make sure that\n // we can cancel any pending setState callbacks after we unmount.\n callback = this.setNextCallback(callback);\n this.setState(nextState, callback);\n };\n\n _proto.setNextCallback = function setNextCallback(callback) {\n var _this4 = this;\n\n var active = true;\n\n this.nextCallback = function (event) {\n if (active) {\n active = false;\n _this4.nextCallback = null;\n callback(event);\n }\n };\n\n this.nextCallback.cancel = function () {\n active = false;\n };\n\n return this.nextCallback;\n };\n\n _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {\n this.setNextCallback(handler);\n var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);\n var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;\n\n if (!node || doesNotHaveTimeoutOrListener) {\n setTimeout(this.nextCallback, 0);\n return;\n }\n\n if (this.props.addEndListener) {\n var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],\n maybeNode = _ref3[0],\n maybeNextCallback = _ref3[1];\n\n this.props.addEndListener(maybeNode, maybeNextCallback);\n }\n\n if (timeout != null) {\n setTimeout(this.nextCallback, timeout);\n }\n };\n\n _proto.render = function render() {\n var status = this.state.status;\n\n if (status === UNMOUNTED) {\n return null;\n }\n\n var _this$props = this.props,\n children = _this$props.children,\n _in = _this$props.in,\n _mountOnEnter = _this$props.mountOnEnter,\n _unmountOnExit = _this$props.unmountOnExit,\n _appear = _this$props.appear,\n _enter = _this$props.enter,\n _exit = _this$props.exit,\n _timeout = _this$props.timeout,\n _addEndListener = _this$props.addEndListener,\n _onEnter = _this$props.onEnter,\n _onEntering = _this$props.onEntering,\n _onEntered = _this$props.onEntered,\n _onExit = _this$props.onExit,\n _onExiting = _this$props.onExiting,\n _onExited = _this$props.onExited,\n _nodeRef = _this$props.nodeRef,\n childProps = _objectWithoutPropertiesLoose(_this$props, [\"children\", \"in\", \"mountOnEnter\", \"unmountOnExit\", \"appear\", \"enter\", \"exit\", \"timeout\", \"addEndListener\", \"onEnter\", \"onEntering\", \"onEntered\", \"onExit\", \"onExiting\", \"onExited\", \"nodeRef\"]);\n\n return (\n /*#__PURE__*/\n // allows for nested Transitions\n React.createElement(TransitionGroupContext.Provider, {\n value: null\n }, typeof children === 'function' ? children(status, childProps) : React.cloneElement(React.Children.only(children), childProps))\n );\n };\n\n return Transition;\n}(React.Component);\n\nTransition.contextType = TransitionGroupContext;\nTransition.propTypes = process.env.NODE_ENV !== \"production\" ? {\n /**\n * A React reference to DOM element that need to transition:\n * https://stackoverflow.com/a/51127130/4671932\n *\n * - When `nodeRef` prop is used, `node` is not passed to callback functions\n * (e.g. `onEnter`) because user already has direct access to the node.\n * - When changing `key` prop of `Transition` in a `TransitionGroup` a new\n * `nodeRef` need to be provided to `Transition` with changed `key` prop\n * (see\n * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).\n */\n nodeRef: PropTypes.shape({\n current: typeof Element === 'undefined' ? PropTypes.any : function (propValue, key, componentName, location, propFullName, secret) {\n var value = propValue[key];\n return PropTypes.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);\n }\n }),\n\n /**\n * A `function` child can be used instead of a React element. This function is\n * called with the current transition status (`'entering'`, `'entered'`,\n * `'exiting'`, `'exited'`), which can be used to apply context\n * specific props to a component.\n *\n * ```jsx\n * \n * {state => (\n * \n * )}\n * \n * ```\n */\n children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,\n\n /**\n * Show the component; triggers the enter or exit states\n */\n in: PropTypes.bool,\n\n /**\n * By default the child component is mounted immediately along with\n * the parent `Transition` component. If you want to \"lazy mount\" the component on the\n * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay\n * mounted, even on \"exited\", unless you also specify `unmountOnExit`.\n */\n mountOnEnter: PropTypes.bool,\n\n /**\n * By default the child component stays mounted after it reaches the `'exited'` state.\n * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.\n */\n unmountOnExit: PropTypes.bool,\n\n /**\n * By default the child component does not perform the enter transition when\n * it first mounts, regardless of the value of `in`. If you want this\n * behavior, set both `appear` and `in` to `true`.\n *\n * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop\n * > only adds an additional enter transition. However, in the\n * > `` component that first enter transition does result in\n * > additional `.appear-*` classes, that way you can choose to style it\n * > differently.\n */\n appear: PropTypes.bool,\n\n /**\n * Enable or disable enter transitions.\n */\n enter: PropTypes.bool,\n\n /**\n * Enable or disable exit transitions.\n */\n exit: PropTypes.bool,\n\n /**\n * The duration of the transition, in milliseconds.\n * Required unless `addEndListener` is provided.\n *\n * You may specify a single timeout for all transitions:\n *\n * ```jsx\n * timeout={500}\n * ```\n *\n * or individually:\n *\n * ```jsx\n * timeout={{\n * appear: 500,\n * enter: 300,\n * exit: 500,\n * }}\n * ```\n *\n * - `appear` defaults to the value of `enter`\n * - `enter` defaults to `0`\n * - `exit` defaults to `0`\n *\n * @type {number | { enter?: number, exit?: number, appear?: number }}\n */\n timeout: function timeout(props) {\n var pt = timeoutsShape;\n if (!props.addEndListener) pt = pt.isRequired;\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return pt.apply(void 0, [props].concat(args));\n },\n\n /**\n * Add a custom transition end trigger. Called with the transitioning\n * DOM node and a `done` callback. Allows for more fine grained transition end\n * logic. Timeouts are still used as a fallback if provided.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * ```jsx\n * addEndListener={(node, done) => {\n * // use the css transitionend event to mark the finish of a transition\n * node.addEventListener('transitionend', done, false);\n * }}\n * ```\n */\n addEndListener: PropTypes.func,\n\n /**\n * Callback fired before the \"entering\" status is applied. An extra parameter\n * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool) -> void\n */\n onEnter: PropTypes.func,\n\n /**\n * Callback fired after the \"entering\" status is applied. An extra parameter\n * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool)\n */\n onEntering: PropTypes.func,\n\n /**\n * Callback fired after the \"entered\" status is applied. An extra parameter\n * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool) -> void\n */\n onEntered: PropTypes.func,\n\n /**\n * Callback fired before the \"exiting\" status is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement) -> void\n */\n onExit: PropTypes.func,\n\n /**\n * Callback fired after the \"exiting\" status is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement) -> void\n */\n onExiting: PropTypes.func,\n\n /**\n * Callback fired after the \"exited\" status is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed\n *\n * @type Function(node: HtmlElement) -> void\n */\n onExited: PropTypes.func\n} : {}; // Name the function so it is clearer in the documentation\n\nfunction noop() {}\n\nTransition.defaultProps = {\n in: false,\n mountOnEnter: false,\n unmountOnExit: false,\n appear: false,\n enter: true,\n exit: true,\n onEnter: noop,\n onEntering: noop,\n onEntered: noop,\n onExit: noop,\n onExiting: noop,\n onExited: noop\n};\nTransition.UNMOUNTED = UNMOUNTED;\nTransition.EXITED = EXITED;\nTransition.ENTERING = ENTERING;\nTransition.ENTERED = ENTERED;\nTransition.EXITING = EXITING;\nexport default Transition;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport PropTypes from 'prop-types';\nimport addOneClass from 'dom-helpers/addClass';\nimport removeOneClass from 'dom-helpers/removeClass';\nimport React from 'react';\nimport Transition from './Transition';\nimport { classNamesShape } from './utils/PropTypes';\nimport { forceReflow } from './utils/reflow';\n\nvar _addClass = function addClass(node, classes) {\n return node && classes && classes.split(' ').forEach(function (c) {\n return addOneClass(node, c);\n });\n};\n\nvar removeClass = function removeClass(node, classes) {\n return node && classes && classes.split(' ').forEach(function (c) {\n return removeOneClass(node, c);\n });\n};\n/**\n * A transition component inspired by the excellent\n * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should\n * use it if you're using CSS transitions or animations. It's built upon the\n * [`Transition`](https://reactcommunity.org/react-transition-group/transition)\n * component, so it inherits all of its props.\n *\n * `CSSTransition` applies a pair of class names during the `appear`, `enter`,\n * and `exit` states of the transition. The first class is applied and then a\n * second `*-active` class in order to activate the CSS transition. After the\n * transition, matching `*-done` class names are applied to persist the\n * transition state.\n *\n * ```jsx\n * function App() {\n * const [inProp, setInProp] = useState(false);\n * return (\n *
\n * \n *
\n * {\"I'll receive my-node-* classes\"}\n *
\n *
\n * \n *
\n * );\n * }\n * ```\n *\n * When the `in` prop is set to `true`, the child component will first receive\n * the class `example-enter`, then the `example-enter-active` will be added in\n * the next tick. `CSSTransition` [forces a\n * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)\n * between before adding the `example-enter-active`. This is an important trick\n * because it allows us to transition between `example-enter` and\n * `example-enter-active` even though they were added immediately one after\n * another. Most notably, this is what makes it possible for us to animate\n * _appearance_.\n *\n * ```css\n * .my-node-enter {\n * opacity: 0;\n * }\n * .my-node-enter-active {\n * opacity: 1;\n * transition: opacity 200ms;\n * }\n * .my-node-exit {\n * opacity: 1;\n * }\n * .my-node-exit-active {\n * opacity: 0;\n * transition: opacity 200ms;\n * }\n * ```\n *\n * `*-active` classes represent which styles you want to animate **to**, so it's\n * important to add `transition` declaration only to them, otherwise transitions\n * might not behave as intended! This might not be obvious when the transitions\n * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in\n * the example above (minus `transition`), but it becomes apparent in more\n * complex transitions.\n *\n * **Note**: If you're using the\n * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)\n * prop, make sure to define styles for `.appear-*` classes as well.\n */\n\n\nvar CSSTransition = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(CSSTransition, _React$Component);\n\n function CSSTransition() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;\n _this.appliedClasses = {\n appear: {},\n enter: {},\n exit: {}\n };\n\n _this.onEnter = function (maybeNode, maybeAppearing) {\n var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),\n node = _this$resolveArgument[0],\n appearing = _this$resolveArgument[1];\n\n _this.removeClasses(node, 'exit');\n\n _this.addClass(node, appearing ? 'appear' : 'enter', 'base');\n\n if (_this.props.onEnter) {\n _this.props.onEnter(maybeNode, maybeAppearing);\n }\n };\n\n _this.onEntering = function (maybeNode, maybeAppearing) {\n var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),\n node = _this$resolveArgument2[0],\n appearing = _this$resolveArgument2[1];\n\n var type = appearing ? 'appear' : 'enter';\n\n _this.addClass(node, type, 'active');\n\n if (_this.props.onEntering) {\n _this.props.onEntering(maybeNode, maybeAppearing);\n }\n };\n\n _this.onEntered = function (maybeNode, maybeAppearing) {\n var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),\n node = _this$resolveArgument3[0],\n appearing = _this$resolveArgument3[1];\n\n var type = appearing ? 'appear' : 'enter';\n\n _this.removeClasses(node, type);\n\n _this.addClass(node, type, 'done');\n\n if (_this.props.onEntered) {\n _this.props.onEntered(maybeNode, maybeAppearing);\n }\n };\n\n _this.onExit = function (maybeNode) {\n var _this$resolveArgument4 = _this.resolveArguments(maybeNode),\n node = _this$resolveArgument4[0];\n\n _this.removeClasses(node, 'appear');\n\n _this.removeClasses(node, 'enter');\n\n _this.addClass(node, 'exit', 'base');\n\n if (_this.props.onExit) {\n _this.props.onExit(maybeNode);\n }\n };\n\n _this.onExiting = function (maybeNode) {\n var _this$resolveArgument5 = _this.resolveArguments(maybeNode),\n node = _this$resolveArgument5[0];\n\n _this.addClass(node, 'exit', 'active');\n\n if (_this.props.onExiting) {\n _this.props.onExiting(maybeNode);\n }\n };\n\n _this.onExited = function (maybeNode) {\n var _this$resolveArgument6 = _this.resolveArguments(maybeNode),\n node = _this$resolveArgument6[0];\n\n _this.removeClasses(node, 'exit');\n\n _this.addClass(node, 'exit', 'done');\n\n if (_this.props.onExited) {\n _this.props.onExited(maybeNode);\n }\n };\n\n _this.resolveArguments = function (maybeNode, maybeAppearing) {\n return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`\n : [maybeNode, maybeAppearing];\n };\n\n _this.getClassNames = function (type) {\n var classNames = _this.props.classNames;\n var isStringClassNames = typeof classNames === 'string';\n var prefix = isStringClassNames && classNames ? classNames + \"-\" : '';\n var baseClassName = isStringClassNames ? \"\" + prefix + type : classNames[type];\n var activeClassName = isStringClassNames ? baseClassName + \"-active\" : classNames[type + \"Active\"];\n var doneClassName = isStringClassNames ? baseClassName + \"-done\" : classNames[type + \"Done\"];\n return {\n baseClassName: baseClassName,\n activeClassName: activeClassName,\n doneClassName: doneClassName\n };\n };\n\n return _this;\n }\n\n var _proto = CSSTransition.prototype;\n\n _proto.addClass = function addClass(node, type, phase) {\n var className = this.getClassNames(type)[phase + \"ClassName\"];\n\n var _this$getClassNames = this.getClassNames('enter'),\n doneClassName = _this$getClassNames.doneClassName;\n\n if (type === 'appear' && phase === 'done' && doneClassName) {\n className += \" \" + doneClassName;\n } // This is to force a repaint,\n // which is necessary in order to transition styles when adding a class name.\n\n\n if (phase === 'active') {\n if (node) forceReflow(node);\n }\n\n if (className) {\n this.appliedClasses[type][phase] = className;\n\n _addClass(node, className);\n }\n };\n\n _proto.removeClasses = function removeClasses(node, type) {\n var _this$appliedClasses$ = this.appliedClasses[type],\n baseClassName = _this$appliedClasses$.base,\n activeClassName = _this$appliedClasses$.active,\n doneClassName = _this$appliedClasses$.done;\n this.appliedClasses[type] = {};\n\n if (baseClassName) {\n removeClass(node, baseClassName);\n }\n\n if (activeClassName) {\n removeClass(node, activeClassName);\n }\n\n if (doneClassName) {\n removeClass(node, doneClassName);\n }\n };\n\n _proto.render = function render() {\n var _this$props = this.props,\n _ = _this$props.classNames,\n props = _objectWithoutPropertiesLoose(_this$props, [\"classNames\"]);\n\n return /*#__PURE__*/React.createElement(Transition, _extends({}, props, {\n onEnter: this.onEnter,\n onEntered: this.onEntered,\n onEntering: this.onEntering,\n onExit: this.onExit,\n onExiting: this.onExiting,\n onExited: this.onExited\n }));\n };\n\n return CSSTransition;\n}(React.Component);\n\nCSSTransition.defaultProps = {\n classNames: ''\n};\nCSSTransition.propTypes = process.env.NODE_ENV !== \"production\" ? _extends({}, Transition.propTypes, {\n /**\n * The animation classNames applied to the component as it appears, enters,\n * exits or has finished the transition. A single name can be provided, which\n * will be suffixed for each stage, e.g. `classNames=\"fade\"` applies:\n *\n * - `fade-appear`, `fade-appear-active`, `fade-appear-done`\n * - `fade-enter`, `fade-enter-active`, `fade-enter-done`\n * - `fade-exit`, `fade-exit-active`, `fade-exit-done`\n *\n * A few details to note about how these classes are applied:\n *\n * 1. They are _joined_ with the ones that are already defined on the child\n * component, so if you want to add some base styles, you can use\n * `className` without worrying that it will be overridden.\n *\n * 2. If the transition component mounts with `in={false}`, no classes are\n * applied yet. You might be expecting `*-exit-done`, but if you think\n * about it, a component cannot finish exiting if it hasn't entered yet.\n *\n * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This\n * allows you to define different behavior for when appearing is done and\n * when regular entering is done, using selectors like\n * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply\n * an epic entrance animation when element first appears in the DOM using\n * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can\n * simply use `fade-enter-done` for defining both cases.\n *\n * Each individual classNames can also be specified independently like:\n *\n * ```js\n * classNames={{\n * appear: 'my-appear',\n * appearActive: 'my-active-appear',\n * appearDone: 'my-done-appear',\n * enter: 'my-enter',\n * enterActive: 'my-active-enter',\n * enterDone: 'my-done-enter',\n * exit: 'my-exit',\n * exitActive: 'my-active-exit',\n * exitDone: 'my-done-exit',\n * }}\n * ```\n *\n * If you want to set these classes using CSS Modules:\n *\n * ```js\n * import styles from './styles.css';\n * ```\n *\n * you might want to use camelCase in your CSS file, that way could simply\n * spread them instead of listing them one by one:\n *\n * ```js\n * classNames={{ ...styles }}\n * ```\n *\n * @type {string | {\n * appear?: string,\n * appearActive?: string,\n * appearDone?: string,\n * enter?: string,\n * enterActive?: string,\n * enterDone?: string,\n * exit?: string,\n * exitActive?: string,\n * exitDone?: string,\n * }}\n */\n classNames: classNamesShape,\n\n /**\n * A `` callback fired immediately after the 'enter' or 'appear' class is\n * applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool)\n */\n onEnter: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'enter-active' or\n * 'appear-active' class is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool)\n */\n onEntering: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'enter' or\n * 'appear' classes are **removed** and the `done` class is added to the DOM node.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool)\n */\n onEntered: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'exit' class is\n * applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed\n *\n * @type Function(node: HtmlElement)\n */\n onExit: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'exit-active' is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed\n *\n * @type Function(node: HtmlElement)\n */\n onExiting: PropTypes.func,\n\n /**\n * A `` callback fired immediately after the 'exit' classes\n * are **removed** and the `exit-done` class is added to the DOM node.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed\n *\n * @type Function(node: HtmlElement)\n */\n onExited: PropTypes.func\n}) : {};\nexport default CSSTransition;","function _assertThisInitialized(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n}\nexport { _assertThisInitialized as default };","import { Children, cloneElement, isValidElement } from 'react';\n/**\n * Given `this.props.children`, return an object mapping key to child.\n *\n * @param {*} children `this.props.children`\n * @return {object} Mapping of key to child\n */\n\nexport function getChildMapping(children, mapFn) {\n var mapper = function mapper(child) {\n return mapFn && isValidElement(child) ? mapFn(child) : child;\n };\n\n var result = Object.create(null);\n if (children) Children.map(children, function (c) {\n return c;\n }).forEach(function (child) {\n // run the map function here instead so that the key is the computed one\n result[child.key] = mapper(child);\n });\n return result;\n}\n/**\n * When you're adding or removing children some may be added or removed in the\n * same render pass. We want to show *both* since we want to simultaneously\n * animate elements in and out. This function takes a previous set of keys\n * and a new set of keys and merges them with its best guess of the correct\n * ordering. In the future we may expose some of the utilities in\n * ReactMultiChild to make this easy, but for now React itself does not\n * directly have this concept of the union of prevChildren and nextChildren\n * so we implement it here.\n *\n * @param {object} prev prev children as returned from\n * `ReactTransitionChildMapping.getChildMapping()`.\n * @param {object} next next children as returned from\n * `ReactTransitionChildMapping.getChildMapping()`.\n * @return {object} a key set that contains all keys in `prev` and all keys\n * in `next` in a reasonable order.\n */\n\nexport function mergeChildMappings(prev, next) {\n prev = prev || {};\n next = next || {};\n\n function getValueForKey(key) {\n return key in next ? next[key] : prev[key];\n } // For each key of `next`, the list of keys to insert before that key in\n // the combined list\n\n\n var nextKeysPending = Object.create(null);\n var pendingKeys = [];\n\n for (var prevKey in prev) {\n if (prevKey in next) {\n if (pendingKeys.length) {\n nextKeysPending[prevKey] = pendingKeys;\n pendingKeys = [];\n }\n } else {\n pendingKeys.push(prevKey);\n }\n }\n\n var i;\n var childMapping = {};\n\n for (var nextKey in next) {\n if (nextKeysPending[nextKey]) {\n for (i = 0; i < nextKeysPending[nextKey].length; i++) {\n var pendingNextKey = nextKeysPending[nextKey][i];\n childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);\n }\n }\n\n childMapping[nextKey] = getValueForKey(nextKey);\n } // Finally, add the keys which didn't appear before any key in `next`\n\n\n for (i = 0; i < pendingKeys.length; i++) {\n childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);\n }\n\n return childMapping;\n}\n\nfunction getProp(child, prop, props) {\n return props[prop] != null ? props[prop] : child.props[prop];\n}\n\nexport function getInitialChildMapping(props, onExited) {\n return getChildMapping(props.children, function (child) {\n return cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: true,\n appear: getProp(child, 'appear', props),\n enter: getProp(child, 'enter', props),\n exit: getProp(child, 'exit', props)\n });\n });\n}\nexport function getNextChildMapping(nextProps, prevChildMapping, onExited) {\n var nextChildMapping = getChildMapping(nextProps.children);\n var children = mergeChildMappings(prevChildMapping, nextChildMapping);\n Object.keys(children).forEach(function (key) {\n var child = children[key];\n if (!isValidElement(child)) return;\n var hasPrev = (key in prevChildMapping);\n var hasNext = (key in nextChildMapping);\n var prevChild = prevChildMapping[key];\n var isLeaving = isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)\n\n if (hasNext && (!hasPrev || isLeaving)) {\n // console.log('entering', key)\n children[key] = cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: true,\n exit: getProp(child, 'exit', nextProps),\n enter: getProp(child, 'enter', nextProps)\n });\n } else if (!hasNext && hasPrev && !isLeaving) {\n // item is old (exiting)\n // console.log('leaving', key)\n children[key] = cloneElement(child, {\n in: false\n });\n } else if (hasNext && hasPrev && isValidElement(prevChild)) {\n // item hasn't changed transition states\n // copy over the last transition props;\n // console.log('unchanged', key)\n children[key] = cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: prevChild.props.in,\n exit: getProp(child, 'exit', nextProps),\n enter: getProp(child, 'enter', nextProps)\n });\n }\n });\n return children;\n}","import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport TransitionGroupContext from './TransitionGroupContext';\nimport { getChildMapping, getInitialChildMapping, getNextChildMapping } from './utils/ChildMapping';\n\nvar values = Object.values || function (obj) {\n return Object.keys(obj).map(function (k) {\n return obj[k];\n });\n};\n\nvar defaultProps = {\n component: 'div',\n childFactory: function childFactory(child) {\n return child;\n }\n};\n/**\n * The `` component manages a set of transition components\n * (`` and ``) in a list. Like with the transition\n * components, `` is a state machine for managing the mounting\n * and unmounting of components over time.\n *\n * Consider the example below. As items are removed or added to the TodoList the\n * `in` prop is toggled automatically by the ``.\n *\n * Note that `` does not define any animation behavior!\n * Exactly _how_ a list item animates is up to the individual transition\n * component. This means you can mix and match animations across different list\n * items.\n */\n\nvar TransitionGroup = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(TransitionGroup, _React$Component);\n\n function TransitionGroup(props, context) {\n var _this;\n\n _this = _React$Component.call(this, props, context) || this;\n\n var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear\n\n\n _this.state = {\n contextValue: {\n isMounting: true\n },\n handleExited: handleExited,\n firstRender: true\n };\n return _this;\n }\n\n var _proto = TransitionGroup.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n this.mounted = true;\n this.setState({\n contextValue: {\n isMounting: false\n }\n });\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.mounted = false;\n };\n\n TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {\n var prevChildMapping = _ref.children,\n handleExited = _ref.handleExited,\n firstRender = _ref.firstRender;\n return {\n children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),\n firstRender: false\n };\n } // node is `undefined` when user provided `nodeRef` prop\n ;\n\n _proto.handleExited = function handleExited(child, node) {\n var currentChildMapping = getChildMapping(this.props.children);\n if (child.key in currentChildMapping) return;\n\n if (child.props.onExited) {\n child.props.onExited(node);\n }\n\n if (this.mounted) {\n this.setState(function (state) {\n var children = _extends({}, state.children);\n\n delete children[child.key];\n return {\n children: children\n };\n });\n }\n };\n\n _proto.render = function render() {\n var _this$props = this.props,\n Component = _this$props.component,\n childFactory = _this$props.childFactory,\n props = _objectWithoutPropertiesLoose(_this$props, [\"component\", \"childFactory\"]);\n\n var contextValue = this.state.contextValue;\n var children = values(this.state.children).map(childFactory);\n delete props.appear;\n delete props.enter;\n delete props.exit;\n\n if (Component === null) {\n return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {\n value: contextValue\n }, children);\n }\n\n return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {\n value: contextValue\n }, /*#__PURE__*/React.createElement(Component, props, children));\n };\n\n return TransitionGroup;\n}(React.Component);\n\nTransitionGroup.propTypes = process.env.NODE_ENV !== \"production\" ? {\n /**\n * `` renders a `
` by default. You can change this\n * behavior by providing a `component` prop.\n * If you use React v16+ and would like to avoid a wrapping `
` element\n * you can pass in `component={null}`. This is useful if the wrapping div\n * borks your css styles.\n */\n component: PropTypes.any,\n\n /**\n * A set of `` components, that are toggled `in` and out as they\n * leave. the `` will inject specific transition props, so\n * remember to spread them through if you are wrapping the `` as\n * with our `` example.\n *\n * While this component is meant for multiple `Transition` or `CSSTransition`\n * children, sometimes you may want to have a single transition child with\n * content that you want to be transitioned out and in when you change it\n * (e.g. routes, images etc.) In that case you can change the `key` prop of\n * the transition child as you change its content, this will cause\n * `TransitionGroup` to transition the child out and back in.\n */\n children: PropTypes.node,\n\n /**\n * A convenience prop that enables or disables appear animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n appear: PropTypes.bool,\n\n /**\n * A convenience prop that enables or disables enter animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n enter: PropTypes.bool,\n\n /**\n * A convenience prop that enables or disables exit animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n exit: PropTypes.bool,\n\n /**\n * You may need to apply reactive updates to a child as it is exiting.\n * This is generally done by using `cloneElement` however in the case of an exiting\n * child the element has already been removed and not accessible to the consumer.\n *\n * If you do need to update a child as it leaves you can provide a `childFactory`\n * to wrap every child, even the ones that are leaving.\n *\n * @type Function(child: ReactElement) -> ReactElement\n */\n childFactory: PropTypes.func\n} : {};\nTransitionGroup.defaultProps = defaultProps;\nexport default TransitionGroup;","import { RefObject } from 'react';\n\nexport function preparePageExitAnimations(\n currentPageElementRefs: React.MutableRefObject<\n Map>\n >\n): void {\n for (const currentPageElementRef of currentPageElementRefs.current.values()) {\n prepareExitAnimation(currentPageElementRef);\n }\n}\n\nexport function prepareExitAnimation(elementRef: RefObject): void {\n if (!elementRef.current) {\n return;\n }\n const containerClientRect = elementRef.current.getBoundingClientRect();\n elementRef.current.style.setProperty(\n '--exit-left',\n `${containerClientRect.left}px`\n );\n elementRef.current.style.setProperty(\n '--exit-top',\n `${containerClientRect.top}px`\n );\n\n elementRef.current.style.setProperty(\n '--exit-width',\n `${containerClientRect.width}px`\n );\n elementRef.current.style.setProperty(\n '--exit-height',\n `${containerClientRect.height}px`\n );\n}\n","import classNames from 'classnames';\nimport { dateToClockFormat } from '@shared/utils/time';\nimport { DepartureOrArrival } from '@shared/models/departureOrArrival';\nimport styles from './DepartureOrArrivalTablePlannedTimeCell.module.scss';\nimport { getHasChangedPlannedClockTime } from '@shared/utils/departureOrArrival';\n\ninterface DepartureOrArrivalTablePlannedTimeCellProps {\n departureOrArrival: DepartureOrArrival;\n headerWidth?: number;\n}\n\nexport default function DepartureOrArrivalTablePlannedTimeCell({\n departureOrArrival,\n headerWidth,\n}: DepartureOrArrivalTablePlannedTimeCellProps) {\n const plannedTimeClock = dateToClockFormat(\n departureOrArrival.plannedTime ?? new Date()\n );\n\n const hasChangedPlannedClockTime =\n getHasChangedPlannedClockTime(departureOrArrival);\n\n return (\n \n \n {plannedTimeClock}\n \n \n );\n}\n","import { DepartureRow } from 'src/modules/departures/models/departureRow';\nimport { ArrivalRow } from 'src/modules/arrivals/models/arrivalRow';\nimport classNames from 'classnames';\nimport DepartureOrArrivalTableLineCell from './DepartureOrArrivalTableLineCell';\nimport DepartureOrArrivalTableTransportModeCell from './DepartureOrArrivalTableTransportModeCell';\nimport DepartureOrArrivalTableDirectionOrOriginCell from './DepartureOrArrivalTableDirectionOrOriginCell';\nimport DepartureOrArrivalTableDepartureCell from './DepartureOrArrivalTableDepartureOrArrivalCell';\nimport DepartureOrArrivalTablePlatformCell from './DepartureOrArrivalTablePlatformCell';\nimport styles from './DepartureOrArrivalTable.module.scss';\nimport {\n createRef,\n CSSProperties,\n RefObject,\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport usePagination from '@shared/hooks/usePagination';\nimport useElementSize from '@shared/hooks/useElementSize';\nimport {\n PAGINATION_TIME_IN_SECONDS,\n SECONDS_BETWEEN_DEPARTURES_OR_ARRIVALS_PAGE_CHANGE,\n} from '@shared/constants';\nimport PageIndicator from '@shared/components/PageIndicator';\nimport { getRemPropertyPixelSize } from '@shared/utils/rem';\nimport { compareRows } from '@shared/utils/departureOrArrivalRowComparer';\nimport { DepartureOrArrivalSorting } from '@shared/models/departureOrArrivalSorting';\nimport { CSSTransition, TransitionGroup } from 'react-transition-group';\nimport {\n prepareExitAnimation,\n preparePageExitAnimations,\n} from '@shared/utils/exitAnimation';\nimport { DepartureOrArrivalTimeFormat } from '@shared/models/departureOrArrivalTimeFormat';\nimport DepartureOrArrivalTablePlannedTimeCell from './DepartureOrArrivalTablePlannedTimeCell';\nimport { getHasChangedPlannedClockTime } from '@shared/utils/departureOrArrival';\n\ninterface DepartureOrArrivalTableProps {\n departureRows?: DepartureRow[];\n arrivalRows?: ArrivalRow[];\n sorting: DepartureOrArrivalSorting;\n timeFormat: DepartureOrArrivalTimeFormat;\n paging: boolean;\n showPlatform: boolean;\n}\n\nexport default function DepartureOrArrivalTable({\n departureRows,\n arrivalRows,\n sorting,\n timeFormat,\n paging,\n showPlatform,\n}: DepartureOrArrivalTableProps) {\n const departuresOrArrivalsType: 'departures' | 'arrivals' = useMemo(() => {\n if (departureRows !== undefined) {\n return 'departures';\n }\n\n return 'arrivals';\n }, [departureRows]);\n const departureOrArrivalRows: (DepartureRow | ArrivalRow)[] = useMemo(() => {\n if (departureRows !== undefined) {\n return departureRows;\n }\n\n if (arrivalRows !== undefined) {\n return arrivalRows;\n }\n\n return [];\n }, [departureRows, arrivalRows]);\n const containerRef = useRef(null);\n const containerSize = useElementSize(containerRef);\n const tableHeadRef = useRef(null);\n const tableHeadSize = useElementSize(tableHeadRef);\n const pageIndicatorRef = useRef(null);\n const pageIndicatorSize = useElementSize(pageIndicatorRef);\n const availableHeight =\n containerSize.height && tableHeadSize.height\n ? containerSize.height -\n tableHeadSize.height -\n (pageIndicatorSize.height ?? 0)\n : undefined;\n const allElementRefs = useRef>(new Map());\n const currentPageElementRefs = useRef<\n Map>\n >(new Map());\n function getOrCreateCurrentRowElementRef(paginationId: string) {\n const existingRef = currentPageElementRefs.current.get(paginationId);\n if (existingRef) {\n return existingRef;\n } else {\n const newRef = createRef();\n currentPageElementRefs.current.set(paginationId, newRef);\n return newRef;\n }\n }\n function removeCurrentRowElementRef(paginationId: string) {\n currentPageElementRefs.current.delete(paginationId);\n }\n\n const sortedDepartureOrArrivalRows = useMemo(\n () =>\n [...departureOrArrivalRows].sort((first, second) =>\n compareRows(first, second, sorting)\n ),\n [departureOrArrivalRows, sorting]\n );\n\n const pageChangeSortingFunction = useCallback(() => {\n if (sorting === 'time') {\n return (\n first: DepartureRow | ArrivalRow,\n second: DepartureRow | ArrivalRow\n ) => compareRows(first, second, sorting);\n }\n\n return undefined;\n }, [sorting]);\n\n const { items, itemsForCurrentPage, currentPageIndex, pages, nextPage } =\n usePagination(\n availableHeight,\n sortedDepartureOrArrivalRows,\n allElementRefs.current,\n 'id',\n {\n directlyUpdateItemsWithMostCurrentItems: true,\n singlePage: !paging,\n pageChangeSortingFunction: pageChangeSortingFunction(),\n }\n );\n\n const renderDepartureOrArrivalColumn =\n timeFormat === 'countdown' ||\n itemsForCurrentPage.some(([departureOrArrivalRow]) =>\n getHasChangedPlannedClockTime(departureOrArrivalRow.next)\n );\n const renderPlannedTimeColumn = timeFormat === 'time';\n const hasThereafter = departureOrArrivalRows.some(\n (departureOrArrivalRow) => departureOrArrivalRow.thereafter !== undefined\n );\n const renderThereafterColumn = hasThereafter;\n const hasDeparturesOrArrivalsWithPlatform = departureOrArrivalRows.some(\n (departureOrArrivalRow) => departureOrArrivalRow.platform !== undefined\n );\n const renderPlatformColumn =\n showPlatform && hasDeparturesOrArrivalsWithPlatform;\n\n const directionHeaderRef = useRef(null);\n const directionHeaderSize = useElementSize(directionHeaderRef);\n\n const plannedTimeHeaderRef = useRef(null);\n const plannedTimeHeaderSize = useElementSize(plannedTimeHeaderRef, {\n renderRef: renderPlannedTimeColumn,\n });\n\n const nextHeaderRef = useRef(null);\n const nextHeaderSize = useElementSize(nextHeaderRef);\n\n const thereafterHeaderRef = useRef(null);\n const thereafterHeaderSize = useElementSize(thereafterHeaderRef, {\n renderRef: renderThereafterColumn,\n });\n\n const platformHeaderRef = useRef(null);\n const platformHeaderSize = useElementSize(platformHeaderRef, {\n renderRef: renderPlatformColumn,\n });\n\n const hasNextWithTrafficSituation = items.some(\n (departureOrArrivalRow) =>\n departureOrArrivalRow.next.trafficSituationSeverity !== undefined\n );\n const hasThereafterWithTrafficSituation = items.some(\n (departureOrArrivalRow) =>\n departureOrArrivalRow.thereafter?.trafficSituationSeverity !== undefined\n );\n function getExpandDirectionWidth(): boolean {\n if (!containerRef.current || containerSize.width === undefined) {\n return false;\n }\n const directionTextWidth =\n getRemPropertyPixelSize(containerRef.current, '--heading-2-font-size') *\n 12;\n const directionWidthRatio = directionTextWidth / containerSize.width;\n return directionWidthRatio > 0.5;\n }\n const expandDirectionWidth = getExpandDirectionWidth();\n\n const prepareAnimationsAndGoToNextPage = useCallback(() => {\n preparePageExitAnimations(currentPageElementRefs);\n\n nextPage();\n }, [nextPage]);\n\n const dividerWidth =\n tableHeadSize.width !== undefined ? `${tableHeadSize.width}px` : undefined;\n\n return (\n \n \n \n \n \n \n \n {departuresOrArrivalsType === 'departures' && (\n Mot\n )}\n {departuresOrArrivalsType === 'arrivals' && 'Från'}\n \n {renderDepartureOrArrivalColumn && (\n \n )}\n {renderPlannedTimeColumn && (\n \n Tid\n \n )}\n {renderThereafterColumn && (\n \n Därefter\n \n )}\n {renderPlatformColumn && (\n \n Läge\n \n )}\n \n \n \n {departureOrArrivalRows.map((departureOrArrivalRow) => (\n {\n if (rowElement) {\n allElementRefs.current.set(\n departureOrArrivalRow.id,\n rowElement\n );\n } else {\n allElementRefs.current.delete(departureOrArrivalRow.id);\n }\n }}\n >\n \n \n \n {renderDepartureOrArrivalColumn && (\n \n )}\n {renderPlannedTimeColumn && (\n \n )}\n {renderThereafterColumn && (\n \n )}\n {renderPlatformColumn && (\n \n )}\n \n ))}\n \n
\n Linje\n \n Fordonstyp\n \n {timeFormat === 'countdown' && (\n <>\n {departuresOrArrivalsType === 'arrivals'\n ? 'Ankommer om'\n : 'Nästa'}\n (min)\n \n )}\n {timeFormat === 'time' && <>Ny tid}\n
\n \n \n {itemsForCurrentPage.map(\n ([departureOrArrivalRow, paginationId], index) => (\n {\n if (pages <= 1) {\n prepareExitAnimation(\n getOrCreateCurrentRowElementRef(paginationId)\n );\n }\n }}\n onExited={() => {\n removeCurrentRowElementRef(paginationId);\n }}\n >\n \n \n \n \n {renderDepartureOrArrivalColumn && (\n \n )}\n {renderPlannedTimeColumn && (\n \n )}\n {renderThereafterColumn && (\n \n )}\n {renderPlatformColumn && (\n \n )}\n \n \n )\n )}\n \n \n {paging && (\n \n {pages > 1 && (\n \n )}\n
\n )}\n
\n );\n}\n","import styles from './Message.module.scss';\n\ninterface MessageProps {\n title: string;\n text?: string;\n}\n\nexport default function Message({ title, text }: MessageProps) {\n return (\n
\n
\n

{title}

\n {text &&

{text}

}\n
\n
\n );\n}\n","import ImageIcon from './ImageIcon';\nimport styles from './LoadingPanel.module.scss';\n\nexport default function LoadingPanel() {\n return (\n
\n \n
\n );\n}\n","import {\n DEPARTURE_PAGING_DEFAULT,\n DEPARTURE_SORTING_DEFAULT,\n DEPARTURE_TIME_FORMAT_DEFAULT,\n} from '@shared/constants';\nimport { StopBoardConfiguration } from '@shared/models/boardConfiguration';\nimport { DepartureRow } from 'src/modules/departures/models/departureRow';\nimport DepartureOrArrivalTable from '@shared/components/DepartureOrArrivalTable';\nimport Message from '@shared/components/Message';\nimport LoadingPanel from '@shared/components/LoadingPanel';\n\ninterface DeparturesModuleProps {\n boardConfiguration: StopBoardConfiguration;\n departureRows?: DepartureRow[];\n departureRowsError?: boolean;\n}\n\nexport default function DeparturesModule({\n boardConfiguration,\n departureRows,\n departureRowsError,\n}: DeparturesModuleProps) {\n if (departureRowsError) {\n return (\n \n );\n } else if (departureRows === undefined) {\n return ;\n } else if (departureRows.length > 0) {\n return (\n 1\n }\n />\n );\n } else {\n const messageTitle =\n boardConfiguration.departureTimeSpan === 'day'\n ? 'Det går inga avgångar härifrån det närmsta dygnet'\n : 'Det går inga avgångar härifrån den närmsta timmen';\n const messageText =\n boardConfiguration.departureTimeSpan === 'day'\n ? 'Det är minst ett dygn kvar till nästa tur avgår. Sök alternativa resor i appen Västtrafik To Go eller på vasttrafik.se'\n : 'Det är minst en timme kvar till nästa tur avgår. Sök alternativa resor i appen Västtrafik To Go eller på vasttrafik.se';\n return ;\n }\n}\n","import {\n ARRIVAL_PAGING_DEFAULT,\n ARRIVAL_SORTING_DEFAULT,\n ARRIVAL_TIME_FORMAT_DEFAULT,\n} from '@shared/constants';\nimport { StopBoardConfiguration } from '@shared/models/boardConfiguration';\nimport Message from '@shared/components/Message';\nimport LoadingPanel from '@shared/components/LoadingPanel';\nimport DepartureOrArrivalTable from '@shared/components/DepartureOrArrivalTable';\nimport { ArrivalRow } from '../models/arrivalRow';\n\ninterface ArrivalsModuleProps {\n boardConfiguration: StopBoardConfiguration;\n arrivals?: ArrivalRow[];\n arrivalRowsError?: boolean;\n}\n\nexport default function DeparturesModule({\n boardConfiguration,\n arrivals,\n arrivalRowsError,\n}: ArrivalsModuleProps) {\n if (arrivalRowsError) {\n return (\n \n );\n } else if (arrivals === undefined) {\n return ;\n } else if (arrivals.length > 0) {\n return (\n 1\n }\n />\n );\n } else {\n return ;\n }\n}\n","import { useEffect, useState } from 'react';\nimport { dateToClockFormat } from '../utils/time';\n\nexport default function Clock() {\n const [currentTime, setCurrentTime] = useState(dateToClockFormat(new Date()));\n\n useEffect(() => {\n const intervalId = window.setInterval(() => {\n setCurrentTime(dateToClockFormat(new Date()));\n }, 1000);\n return () => {\n window.clearInterval(intervalId);\n };\n });\n\n return <>{currentTime};\n}\n","import { getRemPropertyPixelSize } from './rem';\n\n/**\n * Returns the text width for a specific font.\n *\n * @param text The text to measure.\n * @param font The name of the font, defined with the \"define-font\" mixin, to use when measuring.\n * @returns The width of the text rendered with the font.\n */\nexport function measureTextWidth(text: string, font: string): number {\n const fontWeight = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(`--${font}-font-weight`);\n const fontSize = getRemPropertyPixelSize(\n document.documentElement,\n `--${font}-font-size`\n );\n const fontFamily = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue('--font-family');\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Failed to get 2d context from canvas');\n }\n ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;\n return ctx.measureText(text).width;\n}\n","import { useEffect, useState } from 'react';\nimport { measureTextWidth } from '../utils/measureTextWidth';\n\n/**\n * Returns the text width for a specific font.\n *\n * @param text The text to measure.\n * @param font The name of the font, defined with the \"define-font\" mixin, to use when measuring.\n * @returns The width of the text rendered with the font.\n */\nexport default function useTextWidth(text: string, fontName: string): number {\n const [width, setWidth] = useState(measureTextWidth(text, fontName));\n\n useEffect(() => {\n setWidth(measureTextWidth(text, fontName));\n\n function onStyleChange(): void {\n setWidth(measureTextWidth(text, fontName));\n }\n const rootStyleObserver = new MutationObserver(onStyleChange);\n rootStyleObserver.observe(document.documentElement, {\n attributeFilter: ['style'],\n });\n\n return () => {\n rootStyleObserver.disconnect();\n };\n }, [fontName, text]);\n\n return width;\n}\n","import classNames from 'classnames';\nimport type { StopBoardHeader } from '../models/stopBoardHeader';\nimport styles from './StopBoardHeader.module.scss';\nimport Clock from './Clock';\nimport { useContext, useMemo, useRef } from 'react';\nimport { BoardContext } from './Boards';\nimport { useScaledFontSize } from '../hooks/useScaledFontSize';\nimport useElementSize from '../hooks/useElementSize';\nimport useTextWidth from '../hooks/useTextWidth';\n\ninterface StopBoardHeaderProps {\n header?: StopBoardHeader;\n showPlatforms: boolean;\n showingArrivals: boolean;\n}\n\nexport default function StopBoardHeader({\n header,\n showPlatforms,\n showingArrivals,\n}: StopBoardHeaderProps) {\n const stopAreaNameRef = useRef(null);\n const singleLineStopAreaName =\n header?.platforms !== undefined && header.platforms.length > 1;\n useScaledFontSize(stopAreaNameRef, {\n singleLine: singleLineStopAreaName,\n });\n const hasSinglePlatform = header?.platforms?.length === 1;\n const platformsTextRef = useRef(null);\n useScaledFontSize(platformsTextRef, { enabled: hasSinglePlatform });\n const platformsText = header?.platforms?.join(', ');\n const boardContext = useContext(BoardContext);\n\n const stopAreaRef = useRef(null);\n const stopAreaSize = useElementSize(stopAreaRef);\n const stopAreaPlatformsRef = useRef(null);\n const hasPlatforms = showPlatforms && platformsText !== undefined;\n const stopAreaPlatformsSize = useElementSize(stopAreaPlatformsRef, {\n renderRef: hasPlatforms,\n });\n const stopAreaNameTextWidth = useTextWidth(\n header?.stopAreaName ?? '',\n 'heading-1'\n );\n const stopAreaNameExceedsSize =\n header !== undefined &&\n stopAreaPlatformsSize.width !== undefined &&\n stopAreaSize.width !== undefined &&\n stopAreaNameTextWidth + stopAreaPlatformsSize.width >= stopAreaSize.width;\n\n const stopAreaName = useMemo(() => {\n if (!header?.stopAreaName) {\n return '';\n }\n\n let stopAreaName = header.stopAreaName;\n if (showingArrivals) {\n stopAreaName += ' (ankomster)';\n }\n\n return stopAreaName;\n }, [header?.stopAreaName, showingArrivals]);\n return (\n
\n \n \n {stopAreaName}\n \n {hasPlatforms && (\n \n \n \n {platformsText}\n \n \n \n )}\n \n \n \n \n
\n );\n}\n","/**\n * The Ease class provides a collection of easing functions for use with tween.js.\n */\nvar Easing = Object.freeze({\n Linear: Object.freeze({\n None: function (amount) {\n return amount;\n },\n In: function (amount) {\n return amount;\n },\n Out: function (amount) {\n return amount;\n },\n InOut: function (amount) {\n return amount;\n },\n }),\n Quadratic: Object.freeze({\n In: function (amount) {\n return amount * amount;\n },\n Out: function (amount) {\n return amount * (2 - amount);\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount;\n }\n return -0.5 * (--amount * (amount - 2) - 1);\n },\n }),\n Cubic: Object.freeze({\n In: function (amount) {\n return amount * amount * amount;\n },\n Out: function (amount) {\n return --amount * amount * amount + 1;\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount * amount;\n }\n return 0.5 * ((amount -= 2) * amount * amount + 2);\n },\n }),\n Quartic: Object.freeze({\n In: function (amount) {\n return amount * amount * amount * amount;\n },\n Out: function (amount) {\n return 1 - --amount * amount * amount * amount;\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount * amount * amount;\n }\n return -0.5 * ((amount -= 2) * amount * amount * amount - 2);\n },\n }),\n Quintic: Object.freeze({\n In: function (amount) {\n return amount * amount * amount * amount * amount;\n },\n Out: function (amount) {\n return --amount * amount * amount * amount * amount + 1;\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return 0.5 * amount * amount * amount * amount * amount;\n }\n return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);\n },\n }),\n Sinusoidal: Object.freeze({\n In: function (amount) {\n return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);\n },\n Out: function (amount) {\n return Math.sin((amount * Math.PI) / 2);\n },\n InOut: function (amount) {\n return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));\n },\n }),\n Exponential: Object.freeze({\n In: function (amount) {\n return amount === 0 ? 0 : Math.pow(1024, amount - 1);\n },\n Out: function (amount) {\n return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);\n },\n InOut: function (amount) {\n if (amount === 0) {\n return 0;\n }\n if (amount === 1) {\n return 1;\n }\n if ((amount *= 2) < 1) {\n return 0.5 * Math.pow(1024, amount - 1);\n }\n return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);\n },\n }),\n Circular: Object.freeze({\n In: function (amount) {\n return 1 - Math.sqrt(1 - amount * amount);\n },\n Out: function (amount) {\n return Math.sqrt(1 - --amount * amount);\n },\n InOut: function (amount) {\n if ((amount *= 2) < 1) {\n return -0.5 * (Math.sqrt(1 - amount * amount) - 1);\n }\n return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);\n },\n }),\n Elastic: Object.freeze({\n In: function (amount) {\n if (amount === 0) {\n return 0;\n }\n if (amount === 1) {\n return 1;\n }\n return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);\n },\n Out: function (amount) {\n if (amount === 0) {\n return 0;\n }\n if (amount === 1) {\n return 1;\n }\n return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;\n },\n InOut: function (amount) {\n if (amount === 0) {\n return 0;\n }\n if (amount === 1) {\n return 1;\n }\n amount *= 2;\n if (amount < 1) {\n return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);\n }\n return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;\n },\n }),\n Back: Object.freeze({\n In: function (amount) {\n var s = 1.70158;\n return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);\n },\n Out: function (amount) {\n var s = 1.70158;\n return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;\n },\n InOut: function (amount) {\n var s = 1.70158 * 1.525;\n if ((amount *= 2) < 1) {\n return 0.5 * (amount * amount * ((s + 1) * amount - s));\n }\n return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);\n },\n }),\n Bounce: Object.freeze({\n In: function (amount) {\n return 1 - Easing.Bounce.Out(1 - amount);\n },\n Out: function (amount) {\n if (amount < 1 / 2.75) {\n return 7.5625 * amount * amount;\n }\n else if (amount < 2 / 2.75) {\n return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;\n }\n else if (amount < 2.5 / 2.75) {\n return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;\n }\n else {\n return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;\n }\n },\n InOut: function (amount) {\n if (amount < 0.5) {\n return Easing.Bounce.In(amount * 2) * 0.5;\n }\n return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;\n },\n }),\n generatePow: function (power) {\n if (power === void 0) { power = 4; }\n power = power < Number.EPSILON ? Number.EPSILON : power;\n power = power > 10000 ? 10000 : power;\n return {\n In: function (amount) {\n return Math.pow(amount, power);\n },\n Out: function (amount) {\n return 1 - Math.pow((1 - amount), power);\n },\n InOut: function (amount) {\n if (amount < 0.5) {\n return Math.pow((amount * 2), power) / 2;\n }\n return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5;\n },\n };\n },\n});\n\nvar now = function () { return performance.now(); };\n\n/**\n * Controlling groups of tweens\n *\n * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.\n * In these cases, you may want to create your own smaller groups of tween\n */\nvar Group = /** @class */ (function () {\n function Group() {\n var tweens = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n tweens[_i] = arguments[_i];\n }\n this._tweens = {};\n this._tweensAddedDuringUpdate = {};\n this.add.apply(this, tweens);\n }\n Group.prototype.getAll = function () {\n var _this = this;\n return Object.keys(this._tweens).map(function (tweenId) { return _this._tweens[tweenId]; });\n };\n Group.prototype.removeAll = function () {\n this._tweens = {};\n };\n Group.prototype.add = function () {\n var _a;\n var tweens = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n tweens[_i] = arguments[_i];\n }\n for (var _b = 0, tweens_1 = tweens; _b < tweens_1.length; _b++) {\n var tween = tweens_1[_b];\n // Remove from any other group first, a tween can only be in one group at a time.\n // @ts-expect-error library internal access\n (_a = tween._group) === null || _a === void 0 ? void 0 : _a.remove(tween);\n // @ts-expect-error library internal access\n tween._group = this;\n this._tweens[tween.getId()] = tween;\n this._tweensAddedDuringUpdate[tween.getId()] = tween;\n }\n };\n Group.prototype.remove = function () {\n var tweens = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n tweens[_i] = arguments[_i];\n }\n for (var _a = 0, tweens_2 = tweens; _a < tweens_2.length; _a++) {\n var tween = tweens_2[_a];\n // @ts-expect-error library internal access\n tween._group = undefined;\n delete this._tweens[tween.getId()];\n delete this._tweensAddedDuringUpdate[tween.getId()];\n }\n };\n /** Return true if all tweens in the group are not paused or playing. */\n Group.prototype.allStopped = function () {\n return this.getAll().every(function (tween) { return !tween.isPlaying(); });\n };\n Group.prototype.update = function (time, preserve) {\n if (time === void 0) { time = now(); }\n if (preserve === void 0) { preserve = true; }\n var tweenIds = Object.keys(this._tweens);\n if (tweenIds.length === 0)\n return;\n // Tweens are updated in \"batches\". If you add a new tween during an\n // update, then the new tween will be updated in the next batch.\n // If you remove a tween during an update, it may or may not be updated.\n // However, if the removed tween was added during the current batch,\n // then it will not be updated.\n while (tweenIds.length > 0) {\n this._tweensAddedDuringUpdate = {};\n for (var i = 0; i < tweenIds.length; i++) {\n var tween = this._tweens[tweenIds[i]];\n var autoStart = !preserve;\n if (tween && tween.update(time, autoStart) === false && !preserve)\n this.remove(tween);\n }\n tweenIds = Object.keys(this._tweensAddedDuringUpdate);\n }\n };\n return Group;\n}());\n\n/**\n *\n */\nvar Interpolation = {\n Linear: function (v, k) {\n var m = v.length - 1;\n var f = m * k;\n var i = Math.floor(f);\n var fn = Interpolation.Utils.Linear;\n if (k < 0) {\n return fn(v[0], v[1], f);\n }\n if (k > 1) {\n return fn(v[m], v[m - 1], m - f);\n }\n return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);\n },\n Bezier: function (v, k) {\n var b = 0;\n var n = v.length - 1;\n var pw = Math.pow;\n var bn = Interpolation.Utils.Bernstein;\n for (var i = 0; i <= n; i++) {\n b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);\n }\n return b;\n },\n CatmullRom: function (v, k) {\n var m = v.length - 1;\n var f = m * k;\n var i = Math.floor(f);\n var fn = Interpolation.Utils.CatmullRom;\n if (v[0] === v[m]) {\n if (k < 0) {\n i = Math.floor((f = m * (1 + k)));\n }\n return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);\n }\n else {\n if (k < 0) {\n return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);\n }\n if (k > 1) {\n return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);\n }\n return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i);\n }\n },\n Utils: {\n Linear: function (p0, p1, t) {\n return (p1 - p0) * t + p0;\n },\n Bernstein: function (n, i) {\n var fc = Interpolation.Utils.Factorial;\n return fc(n) / fc(i) / fc(n - i);\n },\n Factorial: (function () {\n var a = [1];\n return function (n) {\n var s = 1;\n if (a[n]) {\n return a[n];\n }\n for (var i = n; i > 1; i--) {\n s *= i;\n }\n a[n] = s;\n return s;\n };\n })(),\n CatmullRom: function (p0, p1, p2, p3, t) {\n var v0 = (p2 - p0) * 0.5;\n var v1 = (p3 - p1) * 0.5;\n var t2 = t * t;\n var t3 = t * t2;\n return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;\n },\n },\n};\n\n/**\n * Utils\n */\nvar Sequence = /** @class */ (function () {\n function Sequence() {\n }\n Sequence.nextId = function () {\n return Sequence._nextId++;\n };\n Sequence._nextId = 0;\n return Sequence;\n}());\n\nvar mainGroup = new Group();\n\n/**\n * Tween.js - Licensed under the MIT license\n * https://github.com/tweenjs/tween.js\n * ----------------------------------------------\n *\n * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.\n * Thank you all, you're awesome!\n */\nvar Tween = /** @class */ (function () {\n function Tween(object, group) {\n this._isPaused = false;\n this._pauseStart = 0;\n this._valuesStart = {};\n this._valuesEnd = {};\n this._valuesStartRepeat = {};\n this._duration = 1000;\n this._isDynamic = false;\n this._initialRepeat = 0;\n this._repeat = 0;\n this._yoyo = false;\n this._isPlaying = false;\n this._reversed = false;\n this._delayTime = 0;\n this._startTime = 0;\n this._easingFunction = Easing.Linear.None;\n this._interpolationFunction = Interpolation.Linear;\n // eslint-disable-next-line\n this._chainedTweens = [];\n this._onStartCallbackFired = false;\n this._onEveryStartCallbackFired = false;\n this._id = Sequence.nextId();\n this._isChainStopped = false;\n this._propertiesAreSetUp = false;\n this._goToEnd = false;\n this._object = object;\n if (typeof group === 'object') {\n this._group = group;\n group.add(this);\n }\n // Use \"true\" to restore old behavior (will be removed in future release).\n else if (group === true) {\n this._group = mainGroup;\n mainGroup.add(this);\n }\n }\n Tween.prototype.getId = function () {\n return this._id;\n };\n Tween.prototype.isPlaying = function () {\n return this._isPlaying;\n };\n Tween.prototype.isPaused = function () {\n return this._isPaused;\n };\n Tween.prototype.getDuration = function () {\n return this._duration;\n };\n Tween.prototype.to = function (target, duration) {\n if (duration === void 0) { duration = 1000; }\n if (this._isPlaying)\n throw new Error('Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.');\n this._valuesEnd = target;\n this._propertiesAreSetUp = false;\n this._duration = duration < 0 ? 0 : duration;\n return this;\n };\n Tween.prototype.duration = function (duration) {\n if (duration === void 0) { duration = 1000; }\n this._duration = duration < 0 ? 0 : duration;\n return this;\n };\n Tween.prototype.dynamic = function (dynamic) {\n if (dynamic === void 0) { dynamic = false; }\n this._isDynamic = dynamic;\n return this;\n };\n Tween.prototype.start = function (time, overrideStartingValues) {\n if (time === void 0) { time = now(); }\n if (overrideStartingValues === void 0) { overrideStartingValues = false; }\n if (this._isPlaying) {\n return this;\n }\n this._repeat = this._initialRepeat;\n if (this._reversed) {\n // If we were reversed (f.e. using the yoyo feature) then we need to\n // flip the tween direction back to forward.\n this._reversed = false;\n for (var property in this._valuesStartRepeat) {\n this._swapEndStartRepeatValues(property);\n this._valuesStart[property] = this._valuesStartRepeat[property];\n }\n }\n this._isPlaying = true;\n this._isPaused = false;\n this._onStartCallbackFired = false;\n this._onEveryStartCallbackFired = false;\n this._isChainStopped = false;\n this._startTime = time;\n this._startTime += this._delayTime;\n if (!this._propertiesAreSetUp || overrideStartingValues) {\n this._propertiesAreSetUp = true;\n // If dynamic is not enabled, clone the end values instead of using the passed-in end values.\n if (!this._isDynamic) {\n var tmp = {};\n for (var prop in this._valuesEnd)\n tmp[prop] = this._valuesEnd[prop];\n this._valuesEnd = tmp;\n }\n this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);\n }\n return this;\n };\n Tween.prototype.startFromCurrentValues = function (time) {\n return this.start(time, true);\n };\n Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {\n for (var property in _valuesEnd) {\n var startValue = _object[property];\n var startValueIsArray = Array.isArray(startValue);\n var propType = startValueIsArray ? 'array' : typeof startValue;\n var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);\n // If `to()` specifies a property that doesn't exist in the source object,\n // we should not set that property in the object\n if (propType === 'undefined' || propType === 'function') {\n continue;\n }\n // Check if an Array was provided as property value\n if (isInterpolationList) {\n var endValues = _valuesEnd[property];\n if (endValues.length === 0) {\n continue;\n }\n // Handle an array of relative values.\n // Creates a local copy of the Array with the start value at the front\n var temp = [startValue];\n for (var i = 0, l = endValues.length; i < l; i += 1) {\n var value = this._handleRelativeValue(startValue, endValues[i]);\n if (isNaN(value)) {\n isInterpolationList = false;\n console.warn('Found invalid interpolation list. Skipping.');\n break;\n }\n temp.push(value);\n }\n if (isInterpolationList) {\n // if (_valuesStart[property] === undefined) { // handle end values only the first time. NOT NEEDED? setupProperties is now guarded by _propertiesAreSetUp.\n _valuesEnd[property] = temp;\n // }\n }\n }\n // handle the deepness of the values\n if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) {\n _valuesStart[property] = startValueIsArray ? [] : {};\n var nestedObject = startValue;\n for (var prop in nestedObject) {\n _valuesStart[property][prop] = nestedObject[prop];\n }\n // TODO? repeat nested values? And yoyo? And array values?\n _valuesStartRepeat[property] = startValueIsArray ? [] : {};\n var endValues = _valuesEnd[property];\n // If dynamic is not enabled, clone the end values instead of using the passed-in end values.\n if (!this._isDynamic) {\n var tmp = {};\n for (var prop in endValues)\n tmp[prop] = endValues[prop];\n _valuesEnd[property] = endValues = tmp;\n }\n this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);\n }\n else {\n // Save the starting value, but only once unless override is requested.\n if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) {\n _valuesStart[property] = startValue;\n }\n if (!startValueIsArray) {\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n _valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings\n }\n if (isInterpolationList) {\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n _valuesStartRepeat[property] = _valuesEnd[property].slice().reverse();\n }\n else {\n _valuesStartRepeat[property] = _valuesStart[property] || 0;\n }\n }\n }\n };\n Tween.prototype.stop = function () {\n if (!this._isChainStopped) {\n this._isChainStopped = true;\n this.stopChainedTweens();\n }\n if (!this._isPlaying) {\n return this;\n }\n this._isPlaying = false;\n this._isPaused = false;\n if (this._onStopCallback) {\n this._onStopCallback(this._object);\n }\n return this;\n };\n Tween.prototype.end = function () {\n this._goToEnd = true;\n this.update(this._startTime + this._duration);\n return this;\n };\n Tween.prototype.pause = function (time) {\n if (time === void 0) { time = now(); }\n if (this._isPaused || !this._isPlaying) {\n return this;\n }\n this._isPaused = true;\n this._pauseStart = time;\n return this;\n };\n Tween.prototype.resume = function (time) {\n if (time === void 0) { time = now(); }\n if (!this._isPaused || !this._isPlaying) {\n return this;\n }\n this._isPaused = false;\n this._startTime += time - this._pauseStart;\n this._pauseStart = 0;\n return this;\n };\n Tween.prototype.stopChainedTweens = function () {\n for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {\n this._chainedTweens[i].stop();\n }\n return this;\n };\n Tween.prototype.group = function (group) {\n if (!group) {\n console.warn('tween.group() without args has been removed, use group.add(tween) instead.');\n return this;\n }\n group.add(this);\n return this;\n };\n /**\n * Removes the tween from whichever group it is in.\n */\n Tween.prototype.remove = function () {\n var _a;\n (_a = this._group) === null || _a === void 0 ? void 0 : _a.remove(this);\n return this;\n };\n Tween.prototype.delay = function (amount) {\n if (amount === void 0) { amount = 0; }\n this._delayTime = amount;\n return this;\n };\n Tween.prototype.repeat = function (times) {\n if (times === void 0) { times = 0; }\n this._initialRepeat = times;\n this._repeat = times;\n return this;\n };\n Tween.prototype.repeatDelay = function (amount) {\n this._repeatDelayTime = amount;\n return this;\n };\n Tween.prototype.yoyo = function (yoyo) {\n if (yoyo === void 0) { yoyo = false; }\n this._yoyo = yoyo;\n return this;\n };\n Tween.prototype.easing = function (easingFunction) {\n if (easingFunction === void 0) { easingFunction = Easing.Linear.None; }\n this._easingFunction = easingFunction;\n return this;\n };\n Tween.prototype.interpolation = function (interpolationFunction) {\n if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; }\n this._interpolationFunction = interpolationFunction;\n return this;\n };\n // eslint-disable-next-line\n Tween.prototype.chain = function () {\n var tweens = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n tweens[_i] = arguments[_i];\n }\n this._chainedTweens = tweens;\n return this;\n };\n Tween.prototype.onStart = function (callback) {\n this._onStartCallback = callback;\n return this;\n };\n Tween.prototype.onEveryStart = function (callback) {\n this._onEveryStartCallback = callback;\n return this;\n };\n Tween.prototype.onUpdate = function (callback) {\n this._onUpdateCallback = callback;\n return this;\n };\n Tween.prototype.onRepeat = function (callback) {\n this._onRepeatCallback = callback;\n return this;\n };\n Tween.prototype.onComplete = function (callback) {\n this._onCompleteCallback = callback;\n return this;\n };\n Tween.prototype.onStop = function (callback) {\n this._onStopCallback = callback;\n return this;\n };\n /**\n * @returns true if the tween is still playing after the update, false\n * otherwise (calling update on a paused tween still returns true because\n * it is still playing, just paused).\n *\n * @param autoStart - When true, calling update will implicitly call start()\n * as well. Note, if you stop() or end() the tween, but are still calling\n * update(), it will start again!\n */\n Tween.prototype.update = function (time, autoStart) {\n var _this = this;\n var _a;\n if (time === void 0) { time = now(); }\n if (autoStart === void 0) { autoStart = Tween.autoStartOnUpdate; }\n if (this._isPaused)\n return true;\n var property;\n if (!this._goToEnd && !this._isPlaying) {\n if (autoStart)\n this.start(time, true);\n else\n return false;\n }\n this._goToEnd = false;\n if (time < this._startTime) {\n return true;\n }\n if (this._onStartCallbackFired === false) {\n if (this._onStartCallback) {\n this._onStartCallback(this._object);\n }\n this._onStartCallbackFired = true;\n }\n if (this._onEveryStartCallbackFired === false) {\n if (this._onEveryStartCallback) {\n this._onEveryStartCallback(this._object);\n }\n this._onEveryStartCallbackFired = true;\n }\n var elapsedTime = time - this._startTime;\n var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);\n var totalTime = this._duration + this._repeat * durationAndDelay;\n var calculateElapsedPortion = function () {\n if (_this._duration === 0)\n return 1;\n if (elapsedTime > totalTime) {\n return 1;\n }\n var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);\n var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;\n // TODO use %?\n // const timeIntoCurrentRepeat = elapsedTime % durationAndDelay\n var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);\n if (portion === 0 && elapsedTime === _this._duration) {\n return 1;\n }\n return portion;\n };\n var elapsed = calculateElapsedPortion();\n var value = this._easingFunction(elapsed);\n // properties transformations\n this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);\n if (this._onUpdateCallback) {\n this._onUpdateCallback(this._object, elapsed);\n }\n if (this._duration === 0 || elapsedTime >= this._duration) {\n if (this._repeat > 0) {\n var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);\n if (isFinite(this._repeat)) {\n this._repeat -= completeCount;\n }\n // Reassign starting values, restart by making startTime = now\n for (property in this._valuesStartRepeat) {\n if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {\n this._valuesStartRepeat[property] =\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);\n }\n if (this._yoyo) {\n this._swapEndStartRepeatValues(property);\n }\n this._valuesStart[property] = this._valuesStartRepeat[property];\n }\n if (this._yoyo) {\n this._reversed = !this._reversed;\n }\n this._startTime += durationAndDelay * completeCount;\n if (this._onRepeatCallback) {\n this._onRepeatCallback(this._object);\n }\n this._onEveryStartCallbackFired = false;\n return true;\n }\n else {\n if (this._onCompleteCallback) {\n this._onCompleteCallback(this._object);\n }\n for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {\n // Make the chained tweens start exactly at the time they should,\n // even if the `update()` method was called way past the duration of the tween\n this._chainedTweens[i].start(this._startTime + this._duration, false);\n }\n this._isPlaying = false;\n return false;\n }\n }\n return true;\n };\n Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {\n for (var property in _valuesEnd) {\n // Don't update properties that do not exist in the source object\n if (_valuesStart[property] === undefined) {\n continue;\n }\n var start = _valuesStart[property] || 0;\n var end = _valuesEnd[property];\n var startIsArray = Array.isArray(_object[property]);\n var endIsArray = Array.isArray(end);\n var isInterpolationList = !startIsArray && endIsArray;\n if (isInterpolationList) {\n _object[property] = this._interpolationFunction(end, value);\n }\n else if (typeof end === 'object' && end) {\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n this._updateProperties(_object[property], start, end, value);\n }\n else {\n // Parses relative end values with start as base (e.g.: +10, -3)\n end = this._handleRelativeValue(start, end);\n // Protect against non numeric properties.\n if (typeof end === 'number') {\n // eslint-disable-next-line\n // @ts-ignore FIXME?\n _object[property] = start + (end - start) * value;\n }\n }\n }\n };\n Tween.prototype._handleRelativeValue = function (start, end) {\n if (typeof end !== 'string') {\n return end;\n }\n if (end.charAt(0) === '+' || end.charAt(0) === '-') {\n return start + parseFloat(end);\n }\n return parseFloat(end);\n };\n Tween.prototype._swapEndStartRepeatValues = function (property) {\n var tmp = this._valuesStartRepeat[property];\n var endValue = this._valuesEnd[property];\n if (typeof endValue === 'string') {\n this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);\n }\n else {\n this._valuesStartRepeat[property] = this._valuesEnd[property];\n }\n this._valuesEnd[property] = tmp;\n };\n Tween.autoStartOnUpdate = false;\n return Tween;\n}());\n\nvar VERSION = '25.0.0';\n\n/**\n * Tween.js - Licensed under the MIT license\n * https://github.com/tweenjs/tween.js\n * ----------------------------------------------\n *\n * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.\n * Thank you all, you're awesome!\n */\nvar nextId = Sequence.nextId;\n/**\n * Controlling groups of tweens\n *\n * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.\n * In these cases, you may want to create your own smaller groups of tweens.\n */\nvar TWEEN = mainGroup;\n// This is the best way to export things in a way that's compatible with both ES\n// Modules and CommonJS, without build hacks, and so as not to break the\n// existing API.\n// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881\n/**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\nvar getAll = TWEEN.getAll.bind(TWEEN);\n/**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\nvar removeAll = TWEEN.removeAll.bind(TWEEN);\n/**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\nvar add = TWEEN.add.bind(TWEEN);\n/**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\nvar remove = TWEEN.remove.bind(TWEEN);\n/**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\nvar update = TWEEN.update.bind(TWEEN);\nvar exports = {\n Easing: Easing,\n Group: Group,\n Interpolation: Interpolation,\n now: now,\n Sequence: Sequence,\n nextId: nextId,\n Tween: Tween,\n VERSION: VERSION,\n /**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\n getAll: getAll,\n /**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\n removeAll: removeAll,\n /**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\n add: add,\n /**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\n remove: remove,\n /**\n * @deprecated The global TWEEN Group will be removed in a following major\n * release. To migrate, create a `new Group()` instead of using `TWEEN` as a\n * group.\n *\n * Old code:\n *\n * ```js\n * import * as TWEEN from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new TWEEN.Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * TWEEN.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n *\n * New code:\n *\n * ```js\n * import {Tween, Group} from '@tweenjs/tween.js'\n *\n * //...\n *\n * const tween = new Tween(obj)\n * const tween2 = new TWEEN.Tween(obj2)\n *\n * //...\n *\n * const group = new Group()\n * group.add(tween)\n * group.add(tween2)\n *\n * //...\n *\n * requestAnimationFrame(function loop(time) {\n * group.update(time)\n * requestAnimationFrame(loop)\n * })\n * ```\n */\n update: update,\n};\n\nexport { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, exports as default, getAll, nextId, now, remove, removeAll, update };\n","import { SCROLL_TIME_IN_SECONDS } from '@shared/constants';\nimport { Easing, Group, Tween } from '@tweenjs/tween.js';\nimport { RefObject, useEffect } from 'react';\n\nexport default function useSmoothScroll(\n scrollElementRef: RefObject,\n scrollTop: number,\n onBeginScroll?: () => void,\n onFinishScroll?: () => void\n): void {\n useEffect(() => {\n const scrollElement = scrollElementRef.current;\n if (!scrollElement) {\n return;\n }\n\n onBeginScroll?.();\n const group = new Group();\n const position = { scrollTop: scrollElement.scrollTop };\n const tween = new Tween(position)\n .to({ scrollTop }, SCROLL_TIME_IN_SECONDS * 1000)\n .easing(Easing.Quadratic.Out)\n .onUpdate(() => {\n scrollElement.scrollTop = position.scrollTop;\n })\n .onComplete(() => {\n animating = false;\n onFinishScroll?.();\n })\n .start();\n group.add(tween);\n\n let animating = true;\n function animate(time: number) {\n if (!animating) {\n return;\n }\n group.update(time);\n requestAnimationFrame(animate);\n }\n requestAnimationFrame(animate);\n\n return () => {\n animating = false;\n };\n }, [onBeginScroll, onFinishScroll, scrollElementRef, scrollTop]);\n}\n","import classNames from 'classnames';\nimport styles from './TrafficSituationDescription.module.scss';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport {\n CHARACTERS_READ_PER_SECOND,\n MINIMUM_TIME_IN_SECONDS_TO_READ_TEXT,\n} from '@shared/constants';\nimport useElementSize from '@shared/hooks/useElementSize';\nimport useSmoothScroll from '@shared/hooks/useSmoothScroll';\n\ninterface TrafficSituationDescriptionProps {\n availableHeight: number | undefined;\n text: string;\n timeToReadTitleInSeconds: number;\n viewTimeUpdated?: (newViewTime: number) => void;\n}\n\nexport default function TrafficSituationDescription({\n availableHeight,\n text,\n timeToReadTitleInSeconds,\n viewTimeUpdated,\n}: TrafficSituationDescriptionProps) {\n const descriptionRef = useRef(null);\n const descriptionTextRef = useRef(null);\n const descriptionTextSize = useElementSize(descriptionTextRef);\n const pagingRef = useRef(null);\n const pagingSize = useElementSize(pagingRef, { includeMargin: true });\n\n const [page, setPage] = useState(0);\n const lineHeight = descriptionRef.current\n ? parseFloat(\n window\n .getComputedStyle(descriptionRef.current)\n .getPropertyValue('line-height')\n )\n : 0;\n\n const heightAvailableForDescriptionText =\n availableHeight && pagingSize.height\n ? availableHeight - pagingSize.height\n : undefined;\n\n // Adding 1 to height to avoid rounding errors\n const pagingStepHeight =\n lineHeight > 0 && heightAvailableForDescriptionText !== undefined\n ? Math.max(\n Math.floor((heightAvailableForDescriptionText + 1) / lineHeight) *\n lineHeight,\n lineHeight\n )\n : 1;\n const useFading = pagingStepHeight > lineHeight;\n\n const fadingHeight = lineHeight * 0.5; // The multiplier should be in sync with multiplier for --traffic-situation-description-fade-height'\n\n function getPageDisplayTimes(): number[] {\n const newPageDisplayTimes = new Array();\n if (\n !descriptionRef.current ||\n !descriptionTextRef.current ||\n descriptionTextSize.height === undefined\n ) {\n return newPageDisplayTimes;\n }\n\n let remainingHeight = descriptionTextSize.height;\n while (remainingHeight >= 1) {\n const pageIsOneLineOrLess = remainingHeight <= lineHeight + 1;\n const pageHeight = Math.min(remainingHeight, pagingStepHeight);\n remainingHeight -= pageHeight;\n // Assume evenly distributed text per line\n let pageDisplayTime =\n MINIMUM_TIME_IN_SECONDS_TO_READ_TEXT +\n ((pageHeight / descriptionTextSize.height) * text.length) /\n CHARACTERS_READ_PER_SECOND;\n // Add title read time to first page\n if (newPageDisplayTimes.length === 0) {\n pageDisplayTime += timeToReadTitleInSeconds;\n }\n // Allow for one line of overflow in no-paging scenarios\n if (newPageDisplayTimes.length === 1 && pageIsOneLineOrLess) {\n const firstPageDisplayTime = newPageDisplayTimes[0];\n if (!firstPageDisplayTime) {\n break;\n }\n newPageDisplayTimes[0] = firstPageDisplayTime + pageDisplayTime;\n break;\n }\n newPageDisplayTimes.push(pageDisplayTime);\n }\n\n return newPageDisplayTimes;\n }\n const pageDisplayTimes = getPageDisplayTimes();\n const previousViewTime = useRef();\n useEffect(() => {\n if (viewTimeUpdated) {\n const newDisplayTime = pageDisplayTimes.reduce((a, b) => a + b, 0);\n if (newDisplayTime !== 0 && newDisplayTime !== previousViewTime.current) {\n previousViewTime.current = newDisplayTime;\n viewTimeUpdated(newDisplayTime);\n }\n }\n }, [pageDisplayTimes, viewTimeUpdated]);\n\n const isPaginated = pageDisplayTimes.length > 1;\n const hasPreviousPage = isPaginated && page > 0;\n const hasNextPage = pageDisplayTimes.length > page + 1;\n const scrollTop =\n page * pagingStepHeight -\n (useFading && hasPreviousPage && hasNextPage ? fadingHeight : 0);\n\n useSmoothScroll(descriptionRef, scrollTop);\n\n const onPaginationAnimationEnd = useCallback(() => {\n if (!descriptionRef.current || pageDisplayTimes.length <= 1) {\n return;\n }\n\n if (page + 1 >= pageDisplayTimes.length) {\n setPage(0);\n } else {\n setPage(page + 1);\n }\n }, [page, pageDisplayTimes]);\n\n return (\n <>\n \n
\n

\n {text}\n

\n
\n \n \n {pageDisplayTimes.length > 1 &&\n pageDisplayTimes.map((pageDisplayTime, pageIndex) => (\n \n pageIndex && styles['page-progress--filled']\n )}\n style={{ animationDuration: `${pageDisplayTime}s` }}\n onAnimationEnd={onPaginationAnimationEnd}\n >\n \n ))}\n \n \n );\n}\n","import classNames from 'classnames';\nimport type { TrafficSituation } from '../models/trafficSituation';\nimport ImageIcon from '@shared/components/ImageIcon';\nimport TrafficSituationDescription from './TrafficSituationDescription';\nimport {\n CHARACTERS_READ_PER_SECOND,\n MINIMUM_TIME_IN_SECONDS_TO_READ_TEXT,\n} from '@shared/constants';\nimport styles from './TrafficSituation.module.scss';\nimport { useCallback, useEffect, useRef } from 'react';\nimport useElementSize from '@shared/hooks/useElementSize';\n\ninterface TrafficSituationProps {\n trafficSituation: TrafficSituation;\n viewTimeUpdated?: (trafficSituationId: string, newViewTime: number) => void;\n}\n\nexport default function TrafficSituation({\n trafficSituation,\n viewTimeUpdated,\n}: TrafficSituationProps) {\n const trafficSituationRef = useRef(null);\n const trafficSituationSize = useElementSize(trafficSituationRef, {\n boxSizing: 'content-box',\n });\n const headerRef = useRef(null);\n const headerSize = useElementSize(headerRef);\n const availableDescriptionHeight =\n trafficSituationSize.height && headerSize.height\n ? trafficSituationSize.height - headerSize.height\n : undefined;\n\n const onViewTimeUpdated = useCallback(\n (newViewTime: number) => {\n viewTimeUpdated?.(trafficSituation.id, newViewTime);\n },\n [trafficSituation.id, viewTimeUpdated]\n );\n\n useEffect(() => {\n if (viewTimeUpdated && !trafficSituation.description) {\n viewTimeUpdated(trafficSituation.id, getTitleViewTime());\n }\n\n function getTitleViewTime(): number {\n let timeToRead = MINIMUM_TIME_IN_SECONDS_TO_READ_TEXT;\n\n if (trafficSituation.title) {\n timeToRead +=\n trafficSituation.title.length / CHARACTERS_READ_PER_SECOND;\n }\n\n return timeToRead;\n }\n }, [\n trafficSituation.description,\n trafficSituation.id,\n trafficSituation.title,\n viewTimeUpdated,\n ]);\n\n function getIconAltText(): string {\n switch (trafficSituation.severity) {\n case 'normal':\n return 'Störning';\n\n case 'severe':\n return 'Alvarlig störning';\n\n default:\n return '';\n }\n }\n\n return (\n \n
\n

\n \n {trafficSituation.title && {trafficSituation.title}}\n

\n
\n {trafficSituation.description && (\n \n )}\n \n );\n}\n","import classNames from 'classnames';\nimport type { TrafficSituation as TrafficSituationModel } from '../models/trafficSituation';\nimport TrafficSituation from './TrafficSituation';\nimport styles from './TrafficSituationsModule.module.scss';\nimport usePagination from '@shared/hooks/usePagination';\nimport {\n createRef,\n CSSProperties,\n RefObject,\n useCallback,\n useContext,\n useRef,\n useState,\n} from 'react';\nimport useElementSize from '@shared/hooks/useElementSize';\nimport { LayoutContext } from '@shared/components/Board';\nimport {\n PAGINATION_TIME_IN_SECONDS,\n TRAFFIC_SITUATION_MINIMUM_NUMBER_OF_CHARACTERS,\n} from '@shared/constants';\nimport { getRemPropertyPixelSize } from '@shared/utils/rem';\nimport PageIndicator from '@shared/components/PageIndicator';\nimport { CSSTransition, TransitionGroup } from 'react-transition-group';\nimport { preparePageExitAnimations } from '@shared/utils/exitAnimation';\n\ninterface TrafficSituationsModuleProps {\n trafficSituations: TrafficSituationModel[];\n}\n\nexport default function TrafficSituationsModule({\n trafficSituations,\n}: TrafficSituationsModuleProps) {\n const layout =\n useContext(LayoutContext) === 'horizontal' ? 'vertical' : 'horizontal';\n\n const trafficSituationContainerRefs = useRef>(\n new Map()\n );\n const [viewTimes, setViewTimes] = useState>(new Map());\n const maxViewTime = Math.max(...viewTimes.values());\n\n const trafficSituationsContainerRef = useRef(null);\n const trafficSituationsAvailableSize = useElementSize(\n trafficSituationsContainerRef\n );\n\n const currentPageElementRefs = useRef<\n Map>\n >(new Map());\n function getOrCreateCurrentPageElementRef(paginationId: string) {\n const existingRef = currentPageElementRefs.current.get(paginationId);\n if (existingRef) {\n return existingRef;\n } else {\n const newRef = createRef();\n currentPageElementRefs.current.set(paginationId, newRef);\n return newRef;\n }\n }\n function removeCurrentPageElementRef(paginationId: string) {\n currentPageElementRefs.current.delete(paginationId);\n }\n\n const pageIndicatorRef = useRef(null);\n const pageIndicatorSize = useElementSize(pageIndicatorRef);\n\n function getAvailableSize(): number | undefined {\n if (layout === 'vertical') {\n return trafficSituationsAvailableSize.height !== undefined &&\n pageIndicatorSize.height !== undefined\n ? trafficSituationsAvailableSize.height - pageIndicatorSize.height\n : undefined;\n }\n\n return trafficSituationsAvailableSize.width;\n }\n\n const availableSize = getAvailableSize();\n\n const { itemsForCurrentPage, currentPageIndex, pages, nextPage } =\n usePagination(\n availableSize,\n trafficSituations,\n trafficSituationContainerRefs.current,\n 'id',\n {\n elementFlow: layout,\n ignoreItemOrderToPackPages: true,\n }\n );\n\n const onViewTimeUpdated = useCallback(\n (trafficSituationId: string, newViewTime: number) => {\n setViewTimes((previousViewTimes) => {\n const newViewTimes = new Map(\n [...previousViewTimes.entries()].filter(([trafficSituationId]) =>\n itemsForCurrentPage.some(\n ([trafficSituation]) => trafficSituation.id === trafficSituationId\n )\n )\n );\n newViewTimes.set(trafficSituationId, newViewTime);\n return newViewTimes;\n });\n },\n [itemsForCurrentPage]\n );\n\n function getMaxItems(): number | undefined {\n if (\n layout === 'vertical' ||\n !trafficSituationsContainerRef.current ||\n availableSize === undefined\n ) {\n return undefined;\n }\n\n const trafficSituationFontSize = getRemPropertyPixelSize(\n trafficSituationsContainerRef.current,\n '--bread-font-size'\n );\n return Math.max(\n 1,\n Math.ceil(\n availableSize /\n (trafficSituationFontSize *\n TRAFFIC_SITUATION_MINIMUM_NUMBER_OF_CHARACTERS)\n )\n );\n }\n\n const prepareAnimationsAndGoToNextPage = useCallback(() => {\n preparePageExitAnimations(currentPageElementRefs);\n\n nextPage();\n }, [nextPage]);\n\n return (\n \n \n {itemsForCurrentPage.map(([trafficSituation, paginationId]) => (\n {\n removeCurrentPageElementRef(paginationId);\n }}\n >\n \n \n \n
\n ))}\n
\n \n {pages > 1 && (\n \n )}\n \n \n {trafficSituations.map((trafficSituation) => (\n {\n if (trafficSituationContainerElement) {\n trafficSituationContainerRefs.current.set(\n trafficSituation.id,\n trafficSituationContainerElement\n );\n } else {\n trafficSituationContainerRefs.current.delete(\n trafficSituation.id\n );\n }\n }}\n key={trafficSituation.id}\n className={styles['traffic-situation']}\n >\n \n \n ))}\n \n \n );\n}\n","import { useRef } from 'react';\nimport type { Direction } from '@shared/models/direction';\nimport styles from './Direction.module.scss';\nimport { useScaledFontSize } from '@shared/hooks/useScaledFontSize';\n\ninterface DirectionProps {\n direction: Direction;\n}\n\nexport default function Direction({ direction }: DirectionProps) {\n const directionNameRef = useRef(null);\n useScaledFontSize(directionNameRef);\n\n const directionViaRef = useRef(null);\n useScaledFontSize(directionViaRef);\n return (\n
\n
\n {direction.name}\n
\n\n {direction.via && (\n
\n via {direction.via}\n
\n )}\n
\n );\n}\n","import { useRef } from 'react';\nimport { useScaledFontSize } from '@shared/hooks/useScaledFontSize';\nimport type { Line } from '@shared/models/line';\nimport styles from './Line.module.scss';\n\ninterface LineProps {\n line: Line;\n}\n\nexport default function Line({ line }: LineProps) {\n const lineNameRef = useRef(null);\n useScaledFontSize(lineNameRef);\n\n return (\n
\n \n {line.shortName}\n
\n \n );\n}\n","import classNames from 'classnames';\nimport { Stop as StopModel } from '../models/stop';\nimport styles from './Stop.module.scss';\nimport { dateToClockFormat } from '@shared/utils/time';\nimport { useRef } from 'react';\nimport { useScaledFontSize } from '@shared/hooks/useScaledFontSize';\n\nexport interface StopParams {\n id: string;\n stop: StopModel;\n isCurrent: boolean;\n isPrevious: boolean;\n isPassed: boolean;\n isLast: boolean;\n isAtStop: boolean;\n hasCollapsedStops: boolean;\n isScrolling: boolean;\n}\n\nexport default function Stop({\n id,\n stop,\n isCurrent,\n isPrevious,\n isPassed,\n isLast,\n isAtStop,\n hasCollapsedStops,\n isScrolling,\n}: StopParams) {\n const stopNameRef = useRef(null);\n useScaledFontSize(stopNameRef, {\n singleLine: true,\n });\n\n function isTimeChanged(stop: StopModel) {\n return (\n stop.plannedArrivalTime &&\n stop.arrivalTime &&\n stop.arrivalTime.getTime() !== stop.plannedArrivalTime.getTime()\n );\n }\n\n return (\n \n
\n {!isLast && (\n
\n )}\n \n {isLast && hasCollapsedStops && !isScrolling && (\n \n )}\n \n \n {stop.name}\n \n
\n {stop.departureTime && (\n \n Avgår\n \n {dateToClockFormat(stop.departureTime)}\n \n \n )}\n\n {stop.isCancelled && !isPassed && (\n Inställd\n )}\n\n {stop.arrivalTime && (\n \n {dateToClockFormat(stop.arrivalTime)}\n \n )}\n\n {stop.plannedArrivalTime && !isPassed && (\n \n {dateToClockFormat(stop.plannedArrivalTime)}\n \n )}\n
\n \n );\n}\n","import type { ServiceJourney } from '../models/serviceJourney';\nimport Direction from './Direction';\nimport Line from './Line';\nimport styles from './Route.module.scss';\nimport Stop from './Stop';\nimport { Stop as StopModel } from '../models/stop';\nimport {\n CSSProperties,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport useElementSize from '@shared/hooks/useElementSize';\nimport classNames from 'classnames';\nimport useSmoothScroll from '@shared/hooks/useSmoothScroll';\n\ninterface RouteProps {\n serviceJourney: ServiceJourney;\n}\n\nexport default function Route({ serviceJourney }: RouteProps) {\n const routeRef = useRef(null);\n const routeSize = useElementSize(routeRef);\n const headerRef = useRef(null);\n const headerSize = useElementSize(headerRef);\n const availableHeight =\n routeSize.height !== undefined\n ? routeSize.height - (headerSize.height ?? 0)\n : undefined;\n const stopsMaxHeight =\n availableHeight !== undefined ? `${availableHeight}px` : undefined;\n\n const stopsRef = useRef(null);\n const [scrollTop, setScrollTop] = useState(0);\n const isShowingAllStops =\n availableHeight !== undefined &&\n stopsRef.current !== null &&\n availableHeight >= stopsRef.current.scrollHeight;\n const [hasCollapsedStops, setHasCollapsedStops] = useState(false);\n\n function getId(stop: StopModel, stopIndex: number): string {\n return `${stopIndex}-${stop.stopPointGid}`;\n }\n\n useEffect(() => {\n const scrollElement = stopsRef.current;\n const currentStop = serviceJourney.stops[serviceJourney.currentStopIndex];\n if (!scrollElement || !availableHeight || !currentStop) {\n return;\n }\n\n const currentStopId = getId(currentStop, serviceJourney.currentStopIndex);\n const scrollToElement = scrollElement.querySelector(\n `[data-id=\"${currentStopId}\"]`\n );\n\n function tryUpdateScrollTop(): void {\n if (!scrollToElement || !availableHeight) {\n return;\n }\n\n const newScrollTop = Math.max(\n scrollToElement.offsetTop +\n scrollToElement.clientHeight -\n availableHeight,\n 0\n );\n\n setScrollTop(newScrollTop);\n\n if (newScrollTop > 0) {\n setHasCollapsedStops(true);\n }\n }\n\n tryUpdateScrollTop();\n\n const resizeObserver = new ResizeObserver(tryUpdateScrollTop);\n resizeObserver.observe(stopsRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [availableHeight, serviceJourney]);\n\n const [isScrolling, setIsScrolling] = useState(false);\n const onBeginScroll = useCallback(() => {\n setIsScrolling(true);\n }, []);\n const onFinishedScroll = useCallback(() => {\n setHasCollapsedStops(\n !isShowingAllStops &&\n stopsRef.current !== null &&\n stopsRef.current.scrollTop > 0\n );\n setIsScrolling(false);\n }, [isShowingAllStops]);\n\n useSmoothScroll(stopsRef, scrollTop, onBeginScroll, onFinishedScroll);\n\n const stopGap = useMemo(() => {\n if (!stopsRef.current || !availableHeight || isShowingAllStops) {\n return undefined;\n }\n\n const stopElementsHeights = [...stopsRef.current.children].map(\n (element) => element.clientHeight\n );\n const currentStopElementHeight = Math.max(...stopElementsHeights);\n const otherStopElementHeight = Math.min(...stopElementsHeights);\n\n const otherElementsCount = Math.floor(\n (availableHeight - currentStopElementHeight) / otherStopElementHeight\n );\n const remainingHeight =\n availableHeight -\n currentStopElementHeight -\n otherStopElementHeight * otherElementsCount;\n\n return `${remainingHeight / otherElementsCount}px`;\n }, [availableHeight, isShowingAllStops]);\n\n return (\n
\n {serviceJourney.line && serviceJourney.direction && (\n
\n \n \n
\n )}\n \n {[...serviceJourney.stops].reverse().map((stop, reversedStopIndex) => {\n const stopIndex = serviceJourney.stops.length - reversedStopIndex - 1;\n return (\n \n );\n })}\n
\n \n );\n}\n","import type { ServiceJourney } from '../models/serviceJourney';\nimport Route from './Route';\n\ninterface VehicleModuleProps {\n serviceJourney: ServiceJourney | undefined;\n}\n\nexport default function VehicleModule({ serviceJourney }: VehicleModuleProps) {\n return <>{serviceJourney && };\n}\n","import { BoardConfiguration } from '../models/boardConfiguration';\nimport DeparturesModule from '../../modules/departures/components/DeparturesModule';\nimport ArrivalsModule from '../../modules/arrivals/components/ArrivalsModule';\nimport StopBoardHeader from './StopBoardHeader';\nimport TrafficSituationsModule from '../../modules/traffic-situations/components/TrafficSituationsModule';\nimport styles from './Board.module.scss';\nimport classNames from 'classnames';\nimport ImageIcon from './ImageIcon';\nimport { BoardContext } from './Boards';\nimport { createContext, useContext, useRef } from 'react';\nimport { Layout } from '../models/layout';\nimport {\n HORIZONTAL_BOARD_MINIMUM_ASPECT_RATIO,\n SHOW_PLATFORMS_IN_HEADER_DEFAULT,\n} from '../constants';\nimport useElementSize from '../hooks/useElementSize';\nimport { TrafficSituation } from '../../modules/traffic-situations/models/trafficSituation';\nimport VehicleModule from '../../modules/vehicle/components/VehicleModule';\nimport { BoardState } from '@shared/models/BoardState';\n\ninterface BoardProps {\n hasConnectionError: boolean;\n boardConfiguration: BoardConfiguration;\n boardState?: BoardState;\n}\n\nexport const LayoutContext = createContext('horizontal');\n\nexport default function Board({\n hasConnectionError,\n boardConfiguration,\n boardState,\n}: BoardProps) {\n const boardRef = useRef(null);\n const boardSize = useElementSize(boardRef);\n const layout =\n boardSize.width === undefined ||\n boardSize.height === undefined ||\n boardSize.width > boardSize.height * HORIZONTAL_BOARD_MINIMUM_ASPECT_RATIO\n ? 'horizontal'\n : 'vertical';\n\n const renderHeader =\n boardConfiguration.type === 'stop-area' ||\n boardConfiguration.type === 'stop-points';\n const renderDeparturesModule =\n (boardConfiguration.type === 'stop-area' ||\n boardConfiguration.type === 'stop-points') &&\n boardConfiguration.modules.includes('departures');\n const renderArrivalsModule =\n (boardConfiguration.type === 'stop-area' ||\n boardConfiguration.type === 'stop-points') &&\n boardConfiguration.modules.includes('arrivals');\n const renderVehicleModule = boardConfiguration.type === 'vehicle';\n const boardContext = useContext(BoardContext);\n const renderBranding =\n boardContext.isLast && boardConfiguration.type !== 'vehicle';\n const showPlatformsInHeader =\n boardConfiguration.type === 'stop-points' &&\n (boardConfiguration.showPlatformsInHeader ??\n SHOW_PLATFORMS_IN_HEADER_DEFAULT);\n\n function shouldRenderTrafficSituationsModule(\n trafficSituations: TrafficSituation[] | undefined\n ): trafficSituations is TrafficSituation[] {\n return (\n (boardConfiguration.type === 'vehicle' ||\n boardConfiguration.modules.includes('trafficSituations')) &&\n trafficSituations !== undefined &&\n trafficSituations.length > 0\n );\n }\n\n return (\n \n \n {renderHeader && (\n
\n \n
\n )}\n\n {renderDeparturesModule && (\n
\n \n
\n )}\n\n {renderArrivalsModule && (\n
\n \n
\n )}\n\n {renderVehicleModule && (\n
\n \n
\n )}\n\n {shouldRenderTrafficSituationsModule(boardState?.trafficSituations) && (\n
\n \n
\n )}\n\n {renderBranding && (\n
\n \n
\n )}\n \n
\n );\n}\n","import { useEffect } from 'react';\n\nexport default function useLayoutScale(boardConfigurations?: number): void {\n useEffect(() => {\n function shownInIframe() {\n try {\n return window.self !== window.top;\n } catch (e) {\n return true;\n }\n }\n\n const isShownInIframe = shownInIframe();\n const isGecko = navigator.userAgent.includes('Gecko/');\n\n function getSmallestSize(): number {\n // Gecko/Firefox adjusts windows sizes with zoom level while also adjusting window.devicePixelRatio, making it impossible to correctly set a initial scale for high pixel density screens while still allowing the user to zoom\n if ((isGecko && !isShownInIframe) || !boardConfigurations) {\n return 720;\n }\n\n const widthScaleValue = 0.8; // Scale down UI for width as most information is shown horizontally\n const isPortrait = window.innerHeight >= window.innerWidth;\n const widthMultiplier = isPortrait\n ? widthScaleValue\n : widthScaleValue / boardConfigurations;\n const heightMultiplier = isPortrait ? 1 / boardConfigurations : 1;\n return isShownInIframe\n ? Math.min(\n window.innerWidth * widthMultiplier,\n window.innerHeight * heightMultiplier\n )\n : Math.min(\n window.outerWidth * widthMultiplier,\n window.outerHeight * heightMultiplier\n );\n }\n\n function updateRemScale(): void {\n const smallestSize = getSmallestSize();\n const scale = smallestSize / 1080;\n const fontSize = `${scale * 16}px`;\n document.documentElement.style.fontSize = fontSize;\n document.documentElement.style.setProperty('--root-font-size', fontSize);\n }\n\n updateRemScale();\n\n const resizeObserver = new ResizeObserver(updateRemScale);\n resizeObserver.observe(document.documentElement);\n\n () => {\n resizeObserver.disconnect();\n };\n }, [boardConfigurations]);\n}\n","import { getEnvironment } from '../utils/environment';\nimport { VERSION } from '../../version';\nimport styles from './EnvironmentLabel.module.scss';\n\nexport default function EnvironmentLabel() {\n const environment = getEnvironment();\n if (environment !== 'Test' && environment !== 'UAT') {\n return undefined;\n }\n return (\n
\n Körs i \n {environment}\n med version \n {VERSION}\n
\n );\n}\n","import { useEffect } from 'react';\n\nexport function useTitle(title: string) {\n useEffect(() => {\n document.title = title;\n }, [title]);\n}\n","/*\n (c) 2011-2015, Vladimir Agafonkin\n SunCalc is a JavaScript library for calculating sun/moon position and light phases.\n https://github.com/mourner/suncalc\n*/\n\n(function () { 'use strict';\n\n// shortcuts for easier to read formulas\n\nvar PI = Math.PI,\n sin = Math.sin,\n cos = Math.cos,\n tan = Math.tan,\n asin = Math.asin,\n atan = Math.atan2,\n acos = Math.acos,\n rad = PI / 180;\n\n// sun calculations are based on http://aa.quae.nl/en/reken/zonpositie.html formulas\n\n\n// date/time constants and conversions\n\nvar dayMs = 1000 * 60 * 60 * 24,\n J1970 = 2440588,\n J2000 = 2451545;\n\nfunction toJulian(date) { return date.valueOf() / dayMs - 0.5 + J1970; }\nfunction fromJulian(j) { return new Date((j + 0.5 - J1970) * dayMs); }\nfunction toDays(date) { return toJulian(date) - J2000; }\n\n\n// general calculations for position\n\nvar e = rad * 23.4397; // obliquity of the Earth\n\nfunction rightAscension(l, b) { return atan(sin(l) * cos(e) - tan(b) * sin(e), cos(l)); }\nfunction declination(l, b) { return asin(sin(b) * cos(e) + cos(b) * sin(e) * sin(l)); }\n\nfunction azimuth(H, phi, dec) { return atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi)); }\nfunction altitude(H, phi, dec) { return asin(sin(phi) * sin(dec) + cos(phi) * cos(dec) * cos(H)); }\n\nfunction siderealTime(d, lw) { return rad * (280.16 + 360.9856235 * d) - lw; }\n\nfunction astroRefraction(h) {\n if (h < 0) // the following formula works for positive altitudes only.\n h = 0; // if h = -0.08901179 a div/0 would occur.\n\n // formula 16.4 of \"Astronomical Algorithms\" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.\n // 1.02 / tan(h + 10.26 / (h + 5.10)) h in degrees, result in arc minutes -> converted to rad:\n return 0.0002967 / Math.tan(h + 0.00312536 / (h + 0.08901179));\n}\n\n// general sun calculations\n\nfunction solarMeanAnomaly(d) { return rad * (357.5291 + 0.98560028 * d); }\n\nfunction eclipticLongitude(M) {\n\n var C = rad * (1.9148 * sin(M) + 0.02 * sin(2 * M) + 0.0003 * sin(3 * M)), // equation of center\n P = rad * 102.9372; // perihelion of the Earth\n\n return M + C + P + PI;\n}\n\nfunction sunCoords(d) {\n\n var M = solarMeanAnomaly(d),\n L = eclipticLongitude(M);\n\n return {\n dec: declination(L, 0),\n ra: rightAscension(L, 0)\n };\n}\n\n\nvar SunCalc = {};\n\n\n// calculates sun position for a given date and latitude/longitude\n\nSunCalc.getPosition = function (date, lat, lng) {\n\n var lw = rad * -lng,\n phi = rad * lat,\n d = toDays(date),\n\n c = sunCoords(d),\n H = siderealTime(d, lw) - c.ra;\n\n return {\n azimuth: azimuth(H, phi, c.dec),\n altitude: altitude(H, phi, c.dec)\n };\n};\n\n\n// sun times configuration (angle, morning name, evening name)\n\nvar times = SunCalc.times = [\n [-0.833, 'sunrise', 'sunset' ],\n [ -0.3, 'sunriseEnd', 'sunsetStart' ],\n [ -6, 'dawn', 'dusk' ],\n [ -12, 'nauticalDawn', 'nauticalDusk'],\n [ -18, 'nightEnd', 'night' ],\n [ 6, 'goldenHourEnd', 'goldenHour' ]\n];\n\n// adds a custom time to the times config\n\nSunCalc.addTime = function (angle, riseName, setName) {\n times.push([angle, riseName, setName]);\n};\n\n\n// calculations for sun times\n\nvar J0 = 0.0009;\n\nfunction julianCycle(d, lw) { return Math.round(d - J0 - lw / (2 * PI)); }\n\nfunction approxTransit(Ht, lw, n) { return J0 + (Ht + lw) / (2 * PI) + n; }\nfunction solarTransitJ(ds, M, L) { return J2000 + ds + 0.0053 * sin(M) - 0.0069 * sin(2 * L); }\n\nfunction hourAngle(h, phi, d) { return acos((sin(h) - sin(phi) * sin(d)) / (cos(phi) * cos(d))); }\nfunction observerAngle(height) { return -2.076 * Math.sqrt(height) / 60; }\n\n// returns set time for the given sun altitude\nfunction getSetJ(h, lw, phi, dec, n, M, L) {\n\n var w = hourAngle(h, phi, dec),\n a = approxTransit(w, lw, n);\n return solarTransitJ(a, M, L);\n}\n\n\n// calculates sun times for a given date, latitude/longitude, and, optionally,\n// the observer height (in meters) relative to the horizon\n\nSunCalc.getTimes = function (date, lat, lng, height) {\n\n height = height || 0;\n\n var lw = rad * -lng,\n phi = rad * lat,\n\n dh = observerAngle(height),\n\n d = toDays(date),\n n = julianCycle(d, lw),\n ds = approxTransit(0, lw, n),\n\n M = solarMeanAnomaly(ds),\n L = eclipticLongitude(M),\n dec = declination(L, 0),\n\n Jnoon = solarTransitJ(ds, M, L),\n\n i, len, time, h0, Jset, Jrise;\n\n\n var result = {\n solarNoon: fromJulian(Jnoon),\n nadir: fromJulian(Jnoon - 0.5)\n };\n\n for (i = 0, len = times.length; i < len; i += 1) {\n time = times[i];\n h0 = (time[0] + dh) * rad;\n\n Jset = getSetJ(h0, lw, phi, dec, n, M, L);\n Jrise = Jnoon - (Jset - Jnoon);\n\n result[time[1]] = fromJulian(Jrise);\n result[time[2]] = fromJulian(Jset);\n }\n\n return result;\n};\n\n\n// moon calculations, based on http://aa.quae.nl/en/reken/hemelpositie.html formulas\n\nfunction moonCoords(d) { // geocentric ecliptic coordinates of the moon\n\n var L = rad * (218.316 + 13.176396 * d), // ecliptic longitude\n M = rad * (134.963 + 13.064993 * d), // mean anomaly\n F = rad * (93.272 + 13.229350 * d), // mean distance\n\n l = L + rad * 6.289 * sin(M), // longitude\n b = rad * 5.128 * sin(F), // latitude\n dt = 385001 - 20905 * cos(M); // distance to the moon in km\n\n return {\n ra: rightAscension(l, b),\n dec: declination(l, b),\n dist: dt\n };\n}\n\nSunCalc.getMoonPosition = function (date, lat, lng) {\n\n var lw = rad * -lng,\n phi = rad * lat,\n d = toDays(date),\n\n c = moonCoords(d),\n H = siderealTime(d, lw) - c.ra,\n h = altitude(H, phi, c.dec),\n // formula 14.1 of \"Astronomical Algorithms\" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.\n pa = atan(sin(H), tan(phi) * cos(c.dec) - sin(c.dec) * cos(H));\n\n h = h + astroRefraction(h); // altitude correction for refraction\n\n return {\n azimuth: azimuth(H, phi, c.dec),\n altitude: h,\n distance: c.dist,\n parallacticAngle: pa\n };\n};\n\n\n// calculations for illumination parameters of the moon,\n// based on http://idlastro.gsfc.nasa.gov/ftp/pro/astro/mphase.pro formulas and\n// Chapter 48 of \"Astronomical Algorithms\" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.\n\nSunCalc.getMoonIllumination = function (date) {\n\n var d = toDays(date || new Date()),\n s = sunCoords(d),\n m = moonCoords(d),\n\n sdist = 149598000, // distance from Earth to Sun in km\n\n phi = acos(sin(s.dec) * sin(m.dec) + cos(s.dec) * cos(m.dec) * cos(s.ra - m.ra)),\n inc = atan(sdist * sin(phi), m.dist - sdist * cos(phi)),\n angle = atan(cos(s.dec) * sin(s.ra - m.ra), sin(s.dec) * cos(m.dec) -\n cos(s.dec) * sin(m.dec) * cos(s.ra - m.ra));\n\n return {\n fraction: (1 + cos(inc)) / 2,\n phase: 0.5 + 0.5 * inc * (angle < 0 ? -1 : 1) / Math.PI,\n angle: angle\n };\n};\n\n\nfunction hoursLater(date, h) {\n return new Date(date.valueOf() + h * dayMs / 24);\n}\n\n// calculations for moon rise/set times are based on http://www.stargazing.net/kepler/moonrise.html article\n\nSunCalc.getMoonTimes = function (date, lat, lng, inUTC) {\n var t = new Date(date);\n if (inUTC) t.setUTCHours(0, 0, 0, 0);\n else t.setHours(0, 0, 0, 0);\n\n var hc = 0.133 * rad,\n h0 = SunCalc.getMoonPosition(t, lat, lng).altitude - hc,\n h1, h2, rise, set, a, b, xe, ye, d, roots, x1, x2, dx;\n\n // go in 2-hour chunks, each time seeing if a 3-point quadratic curve crosses zero (which means rise or set)\n for (var i = 1; i <= 24; i += 2) {\n h1 = SunCalc.getMoonPosition(hoursLater(t, i), lat, lng).altitude - hc;\n h2 = SunCalc.getMoonPosition(hoursLater(t, i + 1), lat, lng).altitude - hc;\n\n a = (h0 + h2) / 2 - h1;\n b = (h2 - h0) / 2;\n xe = -b / (2 * a);\n ye = (a * xe + b) * xe + h1;\n d = b * b - 4 * a * h1;\n roots = 0;\n\n if (d >= 0) {\n dx = Math.sqrt(d) / (Math.abs(a) * 2);\n x1 = xe - dx;\n x2 = xe + dx;\n if (Math.abs(x1) <= 1) roots++;\n if (Math.abs(x2) <= 1) roots++;\n if (x1 < -1) x1 = x2;\n }\n\n if (roots === 1) {\n if (h0 < 0) rise = i + x1;\n else set = i + x1;\n\n } else if (roots === 2) {\n rise = i + (ye < 0 ? x2 : x1);\n set = i + (ye < 0 ? x1 : x2);\n }\n\n if (rise && set) break;\n\n h0 = h2;\n }\n\n var result = {};\n\n if (rise) result.rise = hoursLater(t, rise);\n if (set) result.set = hoursLater(t, set);\n\n if (!rise && !set) result[ye > 0 ? 'alwaysUp' : 'alwaysDown'] = true;\n\n return result;\n};\n\n\n// export as Node module / AMD module / browser variable\nif (typeof exports === 'object' && typeof module !== 'undefined') module.exports = SunCalc;\nelse if (typeof define === 'function' && define.amd) define(SunCalc);\nelse window.SunCalc = SunCalc;\n\n}());\n","import { Theme } from '../models/theme';\nimport { useEffect, useState } from 'react';\nimport SunCalc from 'suncalc';\n\nconst DEFAULT_TIME_BETWEEN_SUN_BASED_THEME_UPDATES = 10 * 60 * 1000;\n\nexport default function useTheme(theme?: Theme) {\n const [activeTheme, setActiveTheme] = useState(theme ?? 'dark');\n\n function setTheme(theme: Theme) {\n document.documentElement.classList.remove('theme--light');\n document.documentElement.classList.remove('theme--dark');\n document.documentElement.classList.add(`theme--${theme}`);\n\n setActiveTheme(theme);\n }\n\n useEffect(() => {\n if (theme !== undefined) {\n setTheme(theme);\n return;\n }\n\n const queryParams = new URLSearchParams(location.search);\n const themeQueryParam = queryParams.get('theme');\n\n let sunBasedThemeTimerId: number;\n\n if (themeQueryParam === 'light') {\n setTheme('light');\n } else if (themeQueryParam === 'sun-based') {\n updateSunBasedTheme();\n } else {\n setTheme('dark');\n }\n\n function getTimeToNextUpdate(\n now: Date,\n times: SunCalc.GetTimesResult\n ): number {\n const timeUntilSunrise = times.sunrise.getTime() - now.getTime();\n if (\n timeUntilSunrise >= 0 &&\n timeUntilSunrise < DEFAULT_TIME_BETWEEN_SUN_BASED_THEME_UPDATES\n ) {\n return timeUntilSunrise;\n }\n\n const timeUntilSunset = times.sunset.getTime() - now.getTime();\n if (\n timeUntilSunset >= 0 &&\n timeUntilSunset < DEFAULT_TIME_BETWEEN_SUN_BASED_THEME_UPDATES\n ) {\n return timeUntilSunset;\n }\n\n return DEFAULT_TIME_BETWEEN_SUN_BASED_THEME_UPDATES;\n }\n\n function updateSunBasedTheme() {\n const now = new Date();\n const times = SunCalc.getTimes(now, 57.708467, 11.973423);\n\n if (now >= times.sunrise && now < times.sunset) {\n setTheme('light');\n } else {\n setTheme('dark');\n }\n\n const timeToNextUpdate = getTimeToNextUpdate(now, times);\n\n sunBasedThemeTimerId = window.setTimeout(\n updateSunBasedTheme,\n timeToNextUpdate\n );\n }\n\n return () => {\n window.clearTimeout(sunBasedThemeTimerId);\n };\n }, [theme]);\n\n return activeTheme;\n}\n","import { createContext, useRef } from 'react';\nimport useBoardConfigurations from '../hooks/useBoardConfigurations';\nimport { useBoardStates } from '../hooks/useBoardStates';\nimport Board from './Board';\nimport styles from './Boards.module.scss';\nimport useLayoutScale from '../hooks/useLayoutScale';\nimport EnvironmentLabel from './EnvironmentLabel';\nimport { StopBoardHeader } from '../models/stopBoardHeader';\nimport { useTitle } from '../hooks/useTitle';\nimport useTheme from '../hooks/useTheme';\nimport { Theme } from '../models/theme';\n\nexport interface BoardContextState {\n isFirst: boolean;\n isLast: boolean;\n}\n\nexport const BoardContext = createContext({\n isFirst: false,\n isLast: false,\n});\n\nexport const ThemeContext = createContext('dark');\n\nexport default function Boards() {\n const theme = useTheme();\n\n const { boardConfigurations, error } = useBoardConfigurations();\n const { hasConnectionError, boardStates } =\n useBoardStates(boardConfigurations);\n\n const redirecting = useRef(false);\n if (\n !redirecting.current &&\n boardConfigurations?.length === 0 &&\n error === undefined\n ) {\n alert('Måste ange en konfiguration');\n window.location.href =\n 'https://www.vasttrafik.se/reseplanering/mer-om-reseplanering/avgangstavla/';\n redirecting.current = true;\n }\n\n useLayoutScale(boardConfigurations?.length);\n\n function getTitle() {\n const boardDisplayNames = boardStates\n .map((boardState) => getDisplayName(boardState.header))\n .filter((displayName) => displayName !== undefined);\n\n if (boardDisplayNames.length === 0) {\n return 'GDS';\n }\n\n return boardDisplayNames.join(' & ');\n }\n\n function getDisplayName(\n header: StopBoardHeader | undefined\n ): string | undefined {\n if (!header) {\n return undefined;\n }\n\n if (!header.platforms || header.platforms.length === 0) {\n return header.stopAreaName;\n }\n\n return `${header.stopAreaName} ${header.platforms.join(', ')}`;\n }\n const title = getTitle();\n useTitle(title);\n\n return (\n \n
\n {boardConfigurations &&\n boardConfigurations.map(\n (boardConfiguration, boardConfigurationIndex) => {\n const boardState = boardStates.find(\n (boardStateCandidate) =>\n boardStateCandidate.configurationId === boardConfiguration.id\n );\n\n return (\n \n \n \n );\n }\n )}\n {error &&
{error}
}\n \n
\n
\n );\n}\n","/**\n * @remix-run/router v1.19.1\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Actions represent the type of change to a location value.\n */\nvar Action;\n(function (Action) {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Action[\"Pop\"] = \"POP\";\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Action[\"Push\"] = \"PUSH\";\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\nconst PopStateEventType = \"popstate\";\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n let {\n initialEntries = [\"/\"],\n initialIndex,\n v5Compat = false\n } = options;\n let entries; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : undefined));\n let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n let action = Action.Pop;\n let listener = null;\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation() {\n return entries[index];\n }\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n let history = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\"\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\n }\n };\n return history;\n}\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createBrowserLocation(window, globalHistory) {\n let {\n pathname,\n search,\n hash\n } = window.location;\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route () since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n function validateHashLocation(location, to) {\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\n return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience, so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location, index) {\n return {\n usr: location.state,\n key: location.key,\n idx: index\n };\n}\n/**\n * Creates a Location object with a unique key from the given Path\n */\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = _extends({\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\"\n }, typeof to === \"string\" ? parsePath(to) : to, {\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: to && to.key || key || createKey()\n });\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nfunction createPath(_ref) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = _ref;\n if (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nfunction parsePath(path) {\n let parsedPath = {};\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n if (path) {\n parsedPath.pathname = path;\n }\n }\n return parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\n let {\n window = document.defaultView,\n v5Compat = false\n } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener = null;\n let index = getIndex();\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\n }\n }\n function push(to, state) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\n }\n }\n function replace(to, state) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\n }\n }\n function createURL(to) {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base = window.location.origin !== \"null\" ? window.location.origin : window.location.href;\n let href = typeof to === \"string\" ? to : createPath(to);\n // Treating this as a full URL will strip any trailing spaces so we need to\n // pre-encode them since they might be part of a matching splat param from\n // an ancestor route\n href = href.replace(/ $/, \"%20\");\n invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n let history = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n }\n };\n return history;\n}\n//#endregion\n\nvar ResultType;\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\nconst immutableRouteKeys = new Set([\"lazy\", \"caseSensitive\", \"path\", \"id\", \"index\", \"children\"]);\nfunction isIndexRoute(route) {\n return route.index === true;\n}\n// Walk the route tree generating unique IDs where necessary, so we are working\n// solely with AgnosticDataRouteObject's within the Router\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n if (manifest === void 0) {\n manifest = {};\n }\n return routes.map((route, index) => {\n let treePath = [...parentPath, String(index)];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(route.index !== true || !route.children, \"Cannot specify children on an index route\");\n invariant(!manifest[id], \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, mapRouteProperties(route), {\n id\n });\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {\n id,\n children: undefined\n });\n manifest[id] = pathOrLayoutRoute;\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);\n }\n return pathOrLayoutRoute;\n }\n });\n}\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n return matchRoutesImpl(routes, locationArg, basename, false);\n}\nfunction matchRoutesImpl(routes, locationArg, basename, allowPartial) {\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n if (pathname == null) {\n return null;\n }\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n for (let i = 0; matches == null && i < branches.length; ++i) {\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n let decoded = decodePath(pathname);\n matches = matchRouteBranch(branches[i], decoded, allowPartial);\n }\n return matches;\n}\nfunction convertRouteMatchToUiMatch(match, loaderData) {\n let {\n route,\n pathname,\n params\n } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id],\n handle: route.handle\n };\n}\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n if (parentPath === void 0) {\n parentPath = \"\";\n }\n let flattenRoute = (route, index, relativePath) => {\n let meta = {\n relativePath: relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(meta.relativePath.startsWith(parentPath), \"Absolute route path \\\"\" + meta.relativePath + \"\\\" nested under path \" + (\"\\\"\" + parentPath + \"\\\" is not valid. An absolute child route path \") + \"must start with the combined path of all its parent routes.\");\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n // Add the children before adding this route to the array, so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\"));\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n routes.forEach((route, index) => {\n var _route$path;\n // coarse-grain check for optional params\n if (route.path === \"\" || !((_route$path = route.path) != null && _route$path.includes(\"?\"))) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n return branches;\n}\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments;\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = [];\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children, so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explode _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n // Then, if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n // for absolute paths, ensure `/` instead of empty segment\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first\n : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));\n}\nconst paramRe = /^:[\\w-]+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = s => s === \"*\";\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n if (index) {\n initialScore += indexRouteValue;\n }\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n return siblings ?\n // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1] :\n // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\nfunction matchRouteBranch(branch, pathname, allowPartial) {\n if (allowPartial === void 0) {\n allowPartial = false;\n }\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end\n }, remainingPathname);\n let route = meta.route;\n if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {\n match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end: false\n }, remainingPathname);\n }\n if (!match) {\n return null;\n }\n Object.assign(matchedParams, match.params);\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n route\n });\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/utils/generate-path\n */\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n let path = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(false, \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n path = path.replace(/\\*$/, \"/*\");\n }\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n const stringify = p => p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n const segments = path.split(/\\/+/).map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\";\n // Apply the splat\n return stringify(params[star]);\n }\n const keyMatch = segment.match(/^:([\\w-]+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key];\n invariant(optional === \"?\" || param != null, \"Missing \\\":\" + key + \"\\\" param\");\n return stringify(param);\n }\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter(segment => !!segment);\n return prefix + segments.join(\"/\");\n}\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/utils/match-path\n */\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n let match = pathname.match(matcher);\n if (!match) return null;\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params = compiledParams.reduce((memo, _ref, index) => {\n let {\n paramName,\n isOptional\n } = _ref;\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\\/+$/, \"$1\");\n }\n const value = captureGroups[index];\n if (isOptional && !value) {\n memo[paramName] = undefined;\n } else {\n memo[paramName] = (value || \"\").replace(/%2F/g, \"/\");\n }\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n if (end === void 0) {\n end = true;\n }\n warning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n let params = [];\n let regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^${}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:([\\w-]+)(\\?)?/g, (_, paramName, isOptional) => {\n params.push({\n paramName,\n isOptional: isOptional != null\n });\n return isOptional ? \"/?([^\\\\/]+)?\" : \"/([^\\\\/]+)\";\n });\n if (path.endsWith(\"*\")) {\n params.push({\n paramName: \"*\"\n });\n regexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex, so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else ;\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, params];\n}\nfunction decodePath(value) {\n try {\n return value.split(\"/\").map(v => decodeURIComponent(v).replace(/\\//g, \"%2F\")).join(\"/\");\n } catch (error) {\n warning(false, \"The URL path \\\"\" + value + \"\\\" could not be decoded because it is is a \" + \"malformed URL segment. This is probably due to a bad percent \" + (\"encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n return pathname.slice(startIndex) || \"/\";\n}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/utils/resolve-path\n */\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\"\n } = typeof to === \"string\" ? parsePath(to) : to;\n let pathname = toPathname ? toPathname.startsWith(\"/\") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash)\n };\n}\nfunction resolvePathname(relativePath, fromPathname) {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n relativeSegments.forEach(segment => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n return \"Cannot include a '\" + char + \"' character in a manually specified \" + (\"`to.\" + field + \"` field [\" + JSON.stringify(path) + \"]. Please separate it out to the \") + (\"`to.\" + dest + \"` field. Alternatively you may provide the full path as \") + \"a string in and the router will parse it for you.\";\n}\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \n */\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n// Return the array of pathnames for the current route matches - used to\n// generate the routePathnames input for resolveTo()\nfunction getResolveToMatches(matches, v7_relativeSplatPath) {\n let pathMatches = getPathContributingMatches(matches);\n // When v7_relativeSplatPath is enabled, use the full pathname for the leaf\n // match so we include splat values for \".\" links. See:\n // https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329\n if (v7_relativeSplatPath) {\n return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);\n }\n return pathMatches.map(match => match.pathnameBase);\n}\n/**\n * @private\n */\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n let to;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = _extends({}, toArg);\n invariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n invariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n invariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n }\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from;\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n // With relative=\"route\" (the default), each leading .. segment means\n // \"go up one route\" instead of \"go up one URL segment\". This is a key\n // difference from how works and a major reason we call this a\n // \"to\" value instead of a \"href\".\n if (!isPathRelative && toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n to.pathname = toSegments.join(\"/\");\n }\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n let path = resolvePath(to, from);\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n return path;\n}\n/**\n * @private\n */\nfunction getToPathname(to) {\n // Empty strings should be treated the same as / paths\n return to === \"\" || to.pathname === \"\" ? \"/\" : typeof to === \"string\" ? parsePath(to).pathname : to.pathname;\n}\n/**\n * @private\n */\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n */\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n return new Response(JSON.stringify(data), _extends({}, responseInit, {\n headers\n }));\n};\nclass DataWithResponseInit {\n constructor(data, init) {\n this.type = \"DataWithResponseInit\";\n this.data = data;\n this.init = init || null;\n }\n}\n/**\n * Create \"responses\" that contain `status`/`headers` without forcing\n * serialization into an actual `Response` - used by Remix single fetch\n */\nfunction data(data, init) {\n return new DataWithResponseInit(data, typeof init === \"number\" ? {\n status: init\n } : init);\n}\nclass AbortedDeferredError extends Error {}\nclass DeferredData {\n constructor(data, responseInit) {\n this.pendingKeysSet = new Set();\n this.subscribers = new Set();\n this.deferredKeys = [];\n invariant(data && typeof data === \"object\" && !Array.isArray(data), \"defer() only accepts plain objects\");\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n this.init = responseInit;\n }\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, undefined, data), error => this.onSettle(promise, key, error));\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\n onSettle(promise, key, error, data) {\n if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n return Promise.reject(error);\n }\n this.pendingKeysSet.delete(key);\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n // If the promise was resolved/rejected with undefined, we'll throw an error as you\n // should always resolve with a value or null\n if (error === undefined && data === undefined) {\n let undefinedError = new Error(\"Deferred data for key \\\"\" + key + \"\\\" resolved/rejected with `undefined`, \" + \"you must resolve/reject with a value or `null`.\");\n Object.defineProperty(promise, \"_error\", {\n get: () => undefinedError\n });\n this.emit(false, key);\n return Promise.reject(undefinedError);\n }\n if (data === undefined) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n async resolveData(signal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n get unwrappedData() {\n invariant(this.data !== null && this.done, \"Can only unwrap data on initialized and settled deferreds\");\n return Object.entries(this.data).reduce((acc, _ref3) => {\n let [key, value] = _ref3;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n return new DeferredData(data, responseInit);\n};\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n return new Response(null, _extends({}, responseInit, {\n headers\n }));\n};\n/**\n * A redirect response that will force a document reload to the new location.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirectDocument = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Reload-Document\", \"true\");\n return response;\n};\n/**\n * A redirect response that will perform a `history.replaceState` instead of a\n * `history.pushState` for client-side navigation redirects.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst replace = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Replace\", \"true\");\n return response;\n};\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n *\n * We don't export the class for public use since it's an implementation\n * detail, but we export the interface above so folks can build their own\n * abstractions around instances via isRouteErrorResponse()\n */\nclass ErrorResponseImpl {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nfunction isRouteErrorResponse(error) {\n return error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\n\nconst validMutationMethodsArr = [\"post\", \"put\", \"patch\", \"delete\"];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"get\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_BLOCKER = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined\n};\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst defaultMapRouteProperties = route => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary)\n});\nconst TRANSITIONS_STORAGE_KEY = \"remix-router-transitions\";\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a router and listen to history POP navigations\n */\nfunction createRouter(init) {\n const routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : undefined;\n const isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let mapRouteProperties;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Routes keyed by ID\n let manifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest);\n let inFlightDataRoutes;\n let basename = init.basename || \"/\";\n let dataStrategyImpl = init.unstable_dataStrategy || defaultDataStrategy;\n let patchRoutesOnNavigationImpl = init.unstable_patchRoutesOnNavigation;\n // Config driven behavior flags\n let future = _extends({\n v7_fetcherPersist: false,\n v7_normalizeFormMethod: false,\n v7_partialHydration: false,\n v7_prependBasename: false,\n v7_relativeSplatPath: false,\n v7_skipActionErrorRevalidation: false\n }, init.future);\n // Cleanup function for history\n let unlistenHistory = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // FIFO queue of previously discovered routes to prevent re-calling on\n // subsequent navigations to the same path\n let discoveredRoutesMaxSize = 1000;\n let discoveredRoutes = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialErrors = null;\n if (initialMatches == null && !patchRoutesOnNavigationImpl) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname\n });\n let {\n matches,\n route\n } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = {\n [route.id]: error\n };\n }\n // In SPA apps, if the user provided a patchRoutesOnNavigation implementation and\n // our initial match is a splat route, clear them out so we run through lazy\n // discovery on hydration in case there's a more accurate lazy route match.\n // In SSR apps (with `hydrationData`), we expect that the server will send\n // up the proper matched routes so we don't want to run lazy discovery on\n // initial hydration and want to hydrate into the splat route.\n if (initialMatches && !init.hydrationData) {\n let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active) {\n initialMatches = null;\n }\n }\n let initialized;\n if (!initialMatches) {\n initialized = false;\n initialMatches = [];\n // If partial hydration and fog of war is enabled, we will be running\n // `patchRoutesOnNavigation` during hydration so include any partial matches as\n // the initial matches so we can properly render `HydrateFallback`'s\n if (future.v7_partialHydration) {\n let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n initialMatches = fogOfWar.matches;\n }\n }\n } else if (initialMatches.some(m => m.route.lazy)) {\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n initialized = false;\n } else if (!initialMatches.some(m => m.route.loader)) {\n // If we've got no loaders to run, then we're good to go\n initialized = true;\n } else if (future.v7_partialHydration) {\n // If partial hydration is enabled, we're initialized so long as we were\n // provided with hydrationData for every route with a loader, and no loaders\n // were marked for explicit hydration\n let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;\n let errors = init.hydrationData ? init.hydrationData.errors : null;\n let isRouteInitialized = m => {\n // No loader, nothing to initialize\n if (!m.route.loader) {\n return true;\n }\n // Explicitly opting-in to running on hydration\n if (typeof m.route.loader === \"function\" && m.route.loader.hydrate === true) {\n return false;\n }\n // Otherwise, initialized if hydrated with data or an error\n return loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined;\n };\n // If errors exist, don't consider routes below the boundary\n if (errors) {\n let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined);\n initialized = initialMatches.slice(0, idx + 1).every(isRouteInitialized);\n } else {\n initialized = initialMatches.every(isRouteInitialized);\n }\n } else {\n // Without partial hydration - we're initialized if we were provided any\n // hydrationData - which is expected to be complete\n initialized = init.hydrationData != null;\n }\n let router;\n let state = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: init.hydrationData && init.hydrationData.loaderData || {},\n actionData: init.hydrationData && init.hydrationData.actionData || null,\n errors: init.hydrationData && init.hydrationData.errors || initialErrors,\n fetchers: new Map(),\n blockers: new Map()\n };\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction = Action.Pop;\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n // AbortController for the active navigation\n let pendingNavigationController;\n // Should the current navigation enable document.startViewTransition?\n let pendingViewTransitionEnabled = false;\n // Store applied view transitions so we can apply them on POP\n let appliedViewTransitions = new Map();\n // Cleanup function for persisting applied transitions to sessionStorage\n let removePageHideEventListener = null;\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes = [];\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads = new Set();\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n // Ref-count mounted fetchers so we know when it's ok to clean them up\n let activeFetchers = new Map();\n // Fetchers that have requested a delete when using v7_fetcherPersist,\n // they'll be officially removed after they return to idle\n let deletedFetchers = new Set();\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n // Map of pending patchRoutesOnNavigation() promises (keyed by path/matches) so\n // that we only kick them off once for a given combo\n let pendingPatchRoutes = new Map();\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let ignoreNextHistoryUpdate = false;\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(_ref => {\n let {\n action: historyAction,\n location,\n delta\n } = _ref;\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (ignoreNextHistoryUpdate) {\n ignoreNextHistoryUpdate = false;\n return;\n }\n warning(blockerFunctions.size === 0 || delta != null, \"You are trying to use a blocker on a POP navigation to a location \" + \"that was not created by @remix-run/router. This will fail silently in \" + \"production. This can happen if you are navigating outside the router \" + \"via `window.history.pushState`/`window.location.hash` instead of using \" + \"router navigation APIs. This can also happen if you are using \" + \"createHashRouter and the user manually changes the URL.\");\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction\n });\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n ignoreNextHistoryUpdate = true;\n init.history.go(delta * -1);\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n });\n // Re-do the same POP navigation we just blocked\n init.history.go(delta);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return startNavigation(historyAction, location);\n });\n if (isBrowser) {\n // FIXME: This feels gross. How can we cleanup the lines between\n // scrollRestoration/appliedTransitions persistance?\n restoreAppliedTransitions(routerWindow, appliedViewTransitions);\n let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);\n routerWindow.addEventListener(\"pagehide\", _saveAppliedTransitions);\n removePageHideEventListener = () => routerWindow.removeEventListener(\"pagehide\", _saveAppliedTransitions);\n }\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location, {\n initialHydration: true\n });\n }\n return router;\n }\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n if (removePageHideEventListener) {\n removePageHideEventListener();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n // Subscribe to state updates for the router\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n // Update our state and notify the calling context of the change\n function updateState(newState, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state = _extends({}, state, newState);\n // Prep fetcher cleanup so we can tell the UI which fetcher data entries\n // can be removed\n let completedFetchers = [];\n let deletedFetchersKeys = [];\n if (future.v7_fetcherPersist) {\n state.fetchers.forEach((fetcher, key) => {\n if (fetcher.state === \"idle\") {\n if (deletedFetchers.has(key)) {\n // Unmounted from the UI and can be totally removed\n deletedFetchersKeys.push(key);\n } else {\n // Returned to idle but still mounted in the UI, so semi-remains for\n // revalidations and such\n completedFetchers.push(key);\n }\n }\n });\n }\n // Iterate over a local copy so that if flushSync is used and we end up\n // removing and adding a new subscriber due to the useCallback dependencies,\n // we don't get ourselves into a loop calling the new subscriber immediately\n [...subscribers].forEach(subscriber => subscriber(state, {\n deletedFetchers: deletedFetchersKeys,\n unstable_viewTransitionOpts: opts.viewTransitionOpts,\n unstable_flushSync: opts.flushSync === true\n }));\n // Remove idle fetchers from state since we only care about in-flight fetchers.\n if (future.v7_fetcherPersist) {\n completedFetchers.forEach(key => state.fetchers.delete(key));\n deletedFetchersKeys.forEach(key => deleteFetcher(key));\n }\n }\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(location, newState, _temp) {\n var _location$state, _location$state2;\n let {\n flushSync\n } = _temp === void 0 ? {} : _temp;\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;\n let actionData;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n let blockers = state.blockers;\n if (blockers.size > 0) {\n blockers = new Map(blockers);\n blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n }\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;\n // Commit any in-flight routes at the end of the HMR revalidation \"navigation\"\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === Action.Replace) {\n init.history.replace(location, location.state);\n }\n let viewTransitionOpts;\n // On POP, enable transitions if they were enabled on the original navigation\n if (pendingAction === Action.Pop) {\n // Forward takes precedence so they behave like the original navigation\n let priorPaths = appliedViewTransitions.get(state.location.pathname);\n if (priorPaths && priorPaths.has(location.pathname)) {\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n } else if (appliedViewTransitions.has(location.pathname)) {\n // If we don't have a previous forward nav, assume we're popping back to\n // the new location and enable if that location previously enabled\n viewTransitionOpts = {\n currentLocation: location,\n nextLocation: state.location\n };\n }\n } else if (pendingViewTransitionEnabled) {\n // Store the applied transition on PUSH/REPLACE\n let toPaths = appliedViewTransitions.get(state.location.pathname);\n if (toPaths) {\n toPaths.add(location.pathname);\n } else {\n toPaths = new Set([location.pathname]);\n appliedViewTransitions.set(state.location.pathname, toPaths);\n }\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n }\n updateState(_extends({}, newState, {\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),\n preventScrollReset,\n blockers\n }), {\n viewTransitionOpts,\n flushSync: flushSync === true\n });\n // Reset stateful navigation vars\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n pendingViewTransitionEnabled = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n }\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n if (userReplace === true) {\n historyAction = Action.Replace;\n } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = Action.Replace;\n }\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let flushSync = (opts && opts.unstable_flushSync) === true;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace,\n enableViewTransition: opts && opts.unstable_viewTransition,\n flushSync\n });\n }\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\n });\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\n }\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation\n });\n }\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(historyAction, location, opts) {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = matchRoutes(routesToUse, location, basename);\n let flushSync = (opts && opts.flushSync) === true;\n let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n }, {\n flushSync\n });\n return;\n }\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial load will always\n // be \"same hash\". For example, on /page#hash and submit a
\n // which will default to a navigation to /page\n if (state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n completeNavigation(location, {\n matches\n }, {\n flushSync\n });\n return;\n }\n // Create a controller/Request for this navigation\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n let pendingActionResult;\n if (opts && opts.pendingError) {\n // If we have a pendingError, it means the user attempted a GET submission\n // with binary FormData so assign here and skip to handleLoaders. That\n // way we handle calling loaders above the boundary etc. It's not really\n // different from an actionError in that sense.\n pendingActionResult = [findNearestBoundary(matches).route.id, {\n type: ResultType.error,\n error: opts.pendingError\n }];\n } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n // Call action if we received an action submission\n let actionResult = await handleAction(request, location, opts.submission, matches, fogOfWar.active, {\n replace: opts.replace,\n flushSync\n });\n if (actionResult.shortCircuited) {\n return;\n }\n // If we received a 404 from handleAction, it's because we couldn't lazily\n // discover the destination route so we don't want to call loaders\n if (actionResult.pendingActionResult) {\n let [routeId, result] = actionResult.pendingActionResult;\n if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {\n pendingNavigationController = null;\n completeNavigation(location, {\n matches: actionResult.matches,\n loaderData: {},\n errors: {\n [routeId]: result.error\n }\n });\n return;\n }\n }\n matches = actionResult.matches || matches;\n pendingActionResult = actionResult.pendingActionResult;\n loadingNavigation = getLoadingNavigation(location, opts.submission);\n flushSync = false;\n // No need to do fog of war matching again on loader execution\n fogOfWar.active = false;\n // Create a GET request for the loaders\n request = createClientSideRequest(init.history, request.url, request.signal);\n }\n // Call loaders\n let {\n shortCircuited,\n matches: updatedMatches,\n loaderData,\n errors\n } = await handleLoaders(request, location, matches, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult);\n if (shortCircuited) {\n return;\n }\n // Clean up now that the action/loaders have completed. Don't clean up if\n // we short circuited because pendingNavigationController will have already\n // been assigned to a new controller for the next navigation\n pendingNavigationController = null;\n completeNavigation(location, _extends({\n matches: updatedMatches || matches\n }, getActionDataForCommit(pendingActionResult), {\n loaderData,\n errors\n }));\n }\n // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n async function handleAction(request, location, submission, matches, isFogOfWar, opts) {\n if (opts === void 0) {\n opts = {};\n }\n interruptActiveLoads();\n // Put us in a submitting state\n let navigation = getSubmittingNavigation(location, submission);\n updateState({\n navigation\n }, {\n flushSync: opts.flushSync === true\n });\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let {\n boundaryId,\n error\n } = handleDiscoverRouteError(location.pathname, discoverResult);\n return {\n matches: discoverResult.partialMatches,\n pendingActionResult: [boundaryId, {\n type: ResultType.error,\n error\n }]\n };\n } else if (!discoverResult.matches) {\n let {\n notFoundMatches,\n error,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n pendingActionResult: [route.id, {\n type: ResultType.error,\n error\n }]\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n // Call our action and get the result\n let result;\n let actionMatch = getTargetMatch(matches, location);\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n result = {\n type: ResultType.error,\n error: getInternalRouterError(405, {\n method: request.method,\n pathname: location.pathname,\n routeId: actionMatch.route.id\n })\n };\n } else {\n let results = await callDataStrategy(\"action\", request, [actionMatch], matches);\n result = results[0];\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n }\n if (isRedirectResult(result)) {\n let replace;\n if (opts && opts.replace != null) {\n replace = opts.replace;\n } else {\n // If the user didn't explicity indicate replace behavior, replace if\n // we redirected to the exact same location we're currently at to avoid\n // double back-buttons\n let location = normalizeRedirectLocation(result.response.headers.get(\"Location\"), new URL(request.url), basename);\n replace = location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(request, result, {\n submission,\n replace\n });\n return {\n shortCircuited: true\n };\n }\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n // By default, all submissions to the current location are REPLACE\n // navigations, but if the action threw an error that'll be rendered in\n // an errorElement, we fall back to PUSH so that the user can use the\n // back button to get back to the pre-submission form location to try\n // again\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n return {\n matches,\n pendingActionResult: [boundaryMatch.route.id, result]\n };\n }\n return {\n matches,\n pendingActionResult: [actionMatch.route.id, result]\n };\n }\n // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n async function handleLoaders(request, location, matches, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionResult) {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);\n // If this was a redirect from an action we don't have a \"submission\" but\n // we have it on the loading navigation so use that if available\n let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);\n // If this is an uninterrupted revalidation, we remain in our current idle\n // state. If not, we need to switch to our loading state and load data,\n // preserving any new action data or existing action data (in the case of\n // a revalidation interrupting an actionReload)\n // If we have partialHydration enabled, then don't update the state for the\n // initial data load since it's not a \"navigation\"\n let shouldUpdateNavigationState = !isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration);\n // When fog of war is enabled, we enter our `loading` state earlier so we\n // can discover new routes during the `loading` state. We skip this if\n // we've already run actions since we would have done our matching already.\n // If the children() function threw then, we want to proceed with the\n // partial matches it discovered.\n if (isFogOfWar) {\n if (shouldUpdateNavigationState) {\n let actionData = getUpdatedActionData(pendingActionResult);\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData !== undefined ? {\n actionData\n } : {}), {\n flushSync\n });\n }\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let {\n boundaryId,\n error\n } = handleDiscoverRouteError(location.pathname, discoverResult);\n return {\n matches: discoverResult.partialMatches,\n loaderData: {},\n errors: {\n [boundaryId]: error\n }\n };\n } else if (!discoverResult.matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult);\n // Cancel pending deferreds for no-longer-matched routes or routes we're\n // about to reload. Note that if this is an action reload we would have\n // already cancelled all pending deferreds so this would be a no-op\n cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId));\n pendingNavigationLoadId = ++incrementingLoadId;\n // Short circuit if we have no loaders to run\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n let updatedFetchers = markFetchRedirectsDone();\n completeNavigation(location, _extends({\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null\n }, getActionDataForCommit(pendingActionResult), updatedFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {}), {\n flushSync\n });\n return {\n shortCircuited: true\n };\n }\n if (shouldUpdateNavigationState) {\n let updates = {};\n if (!isFogOfWar) {\n // Only update navigation/actionNData if we didn't already do it above\n updates.navigation = loadingNavigation;\n let actionData = getUpdatedActionData(pendingActionResult);\n if (actionData !== undefined) {\n updates.actionData = actionData;\n }\n }\n if (revalidatingFetchers.length > 0) {\n updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers);\n }\n updateState(updates, {\n flushSync\n });\n }\n revalidatingFetchers.forEach(rf => {\n if (fetchControllers.has(rf.key)) {\n abortFetcher(rf.key);\n }\n if (rf.controller) {\n // Fetchers use an independent AbortController so that aborting a fetcher\n // (via deleteFetcher) does not abort the triggering navigation that\n // triggered the revalidation\n fetchControllers.set(rf.key, rf.controller);\n }\n });\n // Proxy navigation abort through to revalidation fetchers\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key));\n if (pendingNavigationController) {\n pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, request);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n // Clean up _after_ loaders have completed. Don't clean up if we short\n // circuited because fetchControllers would have been aborted and\n // reassigned to new controllers for the next navigation\n if (pendingNavigationController) {\n pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key));\n // If any loaders returned a redirect Response, start a new REPLACE navigation\n let redirect = findRedirect([...loaderResults, ...fetcherResults]);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n await startRedirectNavigation(request, redirect.result, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, matchesToLoad, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Wire up subscribers to update loaderData as promises settle\n activeDeferreds.forEach((deferredData, routeId) => {\n deferredData.subscribe(aborted => {\n // Note: No need to updateState here since the TrackedPromise on\n // loaderData is stable across resolve/reject\n // Remove this instance if we were aborted or if promises have settled\n if (aborted || deferredData.done) {\n activeDeferreds.delete(routeId);\n }\n });\n });\n // During partial hydration, preserve SSR errors for routes that don't re-run\n if (future.v7_partialHydration && initialHydration && state.errors) {\n Object.entries(state.errors).filter(_ref2 => {\n let [id] = _ref2;\n return !matchesToLoad.some(m => m.route.id === id);\n }).forEach(_ref3 => {\n let [routeId, error] = _ref3;\n errors = Object.assign(errors || {}, {\n [routeId]: error\n });\n });\n }\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n return _extends({\n matches,\n loaderData,\n errors\n }, shouldUpdateFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {});\n }\n function getUpdatedActionData(pendingActionResult) {\n if (pendingActionResult && !isErrorResult(pendingActionResult[1])) {\n // This is cast to `any` currently because `RouteData`uses any and it\n // would be a breaking change to use any.\n // TODO: v7 - change `RouteData` to use `unknown` instead of `any`\n return {\n [pendingActionResult[0]]: pendingActionResult[1].data\n };\n } else if (state.actionData) {\n if (Object.keys(state.actionData).length === 0) {\n return null;\n } else {\n return state.actionData;\n }\n }\n }\n function getUpdatedRevalidatingFetchers(revalidatingFetchers) {\n revalidatingFetchers.forEach(rf => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = getLoadingFetcher(undefined, fetcher ? fetcher.data : undefined);\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n return new Map(state.fetchers);\n }\n // Trigger a fetcher load/submit for the given fetcher key\n function fetch(key, routeId, href, opts) {\n if (isServer) {\n throw new Error(\"router.fetch() was called during the server render, but it shouldn't be. \" + \"You are likely calling a useFetcher() method in the body of your component. \" + \"Try moving it to a useEffect or a callback.\");\n }\n if (fetchControllers.has(key)) abortFetcher(key);\n let flushSync = (opts && opts.unstable_flushSync) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative);\n let matches = matchRoutes(routesToUse, normalizedPath, basename);\n let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n if (!matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: normalizedPath\n }), {\n flushSync\n });\n return;\n }\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts);\n if (error) {\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return;\n }\n let match = getTargetMatch(matches, path);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, submission);\n return;\n }\n // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n fetchLoadMatches.set(key, {\n routeId,\n path\n });\n handleFetcherLoader(key, routeId, path, match, matches, fogOfWar.active, flushSync, submission);\n }\n // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n async function handleFetcherAction(key, routeId, path, match, requestMatches, isFogOfWar, flushSync, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n function detectAndHandle405Error(m) {\n if (!m.route.action && !m.route.lazy) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId\n });\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return true;\n }\n return false;\n }\n if (!isFogOfWar && detectAndHandle405Error(match)) {\n return;\n }\n // Put this fetcher into it's submitting state\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(requestMatches, path, fetchRequest.signal);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n let {\n error\n } = handleDiscoverRouteError(path, discoverResult);\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n requestMatches = discoverResult.matches;\n match = getTargetMatch(requestMatches, path);\n if (detectAndHandle405Error(match)) {\n return;\n }\n }\n }\n // Call the action for the fetcher\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let actionResults = await callDataStrategy(\"action\", fetchRequest, [match], requestMatches);\n let actionResult = actionResults[0];\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by our own fetcher\n // re-submit which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n return;\n }\n // When using v7_fetcherPersist, we don't want errors bubbling up to the UI\n // or redirects processed for unmounted fetchers so we just revert them to\n // idle\n if (future.v7_fetcherPersist && deletedFetchers.has(key)) {\n if (isRedirectResult(actionResult) || isErrorResult(actionResult)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // Let SuccessResult's fall through for revalidation\n } else {\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our action started, so that\n // should take precedence over this redirect navigation. We already\n // set isRevalidationRequired so all loaders for the new route should\n // fire unless opted out via shouldRevalidate\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n updateFetcherState(key, getLoadingFetcher(submission));\n return startRedirectNavigation(fetchRequest, actionResult, {\n fetcherSubmission: submission\n });\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(actionResult)) {\n setFetcherError(key, routeId, actionResult.error);\n return;\n }\n }\n if (isDeferredResult(actionResult)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let matches = state.navigation.state !== \"idle\" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;\n invariant(matches, \"Didn't find any matches after fetcher action\");\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n let loadFetcher = getLoadingFetcher(submission, actionResult.data);\n state.fetchers.set(key, loadFetcher);\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]);\n // Put all revalidating fetchers into the loading state, except for the\n // current fetcher which we want to keep in it's current loading state which\n // contains it's action submission info + action data\n revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = getLoadingFetcher(undefined, existingFetcher ? existingFetcher.data : undefined);\n state.fetchers.set(staleKey, revalidatingFetcher);\n if (fetchControllers.has(staleKey)) {\n abortFetcher(staleKey);\n }\n if (rf.controller) {\n fetchControllers.set(staleKey, rf.controller);\n }\n });\n updateState({\n fetchers: new Map(state.fetchers)\n });\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key));\n abortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);\n if (abortController.signal.aborted) {\n return;\n }\n abortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach(r => fetchControllers.delete(r.key));\n let redirect = findRedirect([...loaderResults, ...fetcherResults]);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n return startRedirectNavigation(revalidationRequest, redirect.result);\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, state.matches, matchesToLoad, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Since we let revalidations complete even if the submitting fetcher was\n // deleted, only put it back to idle if it hasn't been deleted\n if (state.fetchers.has(key)) {\n let doneFetcher = getDoneFetcher(actionResult.data);\n state.fetchers.set(key, doneFetcher);\n }\n abortStaleFetchLoads(loadId);\n // If we are currently in a navigation loading state and this fetcher is\n // more recent than the navigation, we want the newer data so abort the\n // navigation and complete it with the fetcher data\n if (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n invariant(pendingAction, \"Expected pending action\");\n pendingNavigationController && pendingNavigationController.abort();\n completeNavigation(state.navigation.location, {\n matches,\n loaderData,\n errors,\n fetchers: new Map(state.fetchers)\n });\n } else {\n // otherwise just update with the fetcher data, preserving any existing\n // loaderData for loaders that did not need to reload. We have to\n // manually merge here since we aren't going through completeNavigation\n updateState({\n errors,\n loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),\n fetchers: new Map(state.fetchers)\n });\n isRevalidationRequired = false;\n }\n }\n // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n async function handleFetcherLoader(key, routeId, path, match, matches, isFogOfWar, flushSync, submission) {\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, path, fetchRequest.signal);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n let {\n error\n } = handleDiscoverRouteError(path, discoverResult);\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n matches = discoverResult.matches;\n match = getTargetMatch(matches, path);\n }\n }\n // Call the loader for this fetcher route match\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let results = await callDataStrategy(\"loader\", fetchRequest, [match], matches);\n let result = results[0];\n // Deferred isn't supported for fetcher loads, await everything and treat it\n // as a normal load. resolveDeferredData will return undefined if this\n // fetcher gets aborted, so we just leave result untouched and short circuit\n // below if that happens\n if (isDeferredResult(result)) {\n result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result;\n }\n // We can delete this so long as we weren't aborted by our our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n if (fetchRequest.signal.aborted) {\n return;\n }\n // We don't want errors bubbling up or redirects followed for unmounted\n // fetchers, so short circuit here if it was removed from the UI\n if (deletedFetchers.has(key)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // If the loader threw a redirect Response, start a new REPLACE navigation\n if (isRedirectResult(result)) {\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our loader started, so that\n // should take precedence over this redirect navigation\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n await startRedirectNavigation(fetchRequest, result);\n return;\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(result)) {\n setFetcherError(key, routeId, result.error);\n return;\n }\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\");\n // Put the fetcher back into an idle state\n updateFetcherState(key, getDoneFetcher(result.data));\n }\n /**\n * Utility function to handle redirects returned from an action or loader.\n * Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n * example:\n *\n * - user is on /a\n * - user clicks a link to /b\n * - loader for /b redirects to /c\n *\n * In a non-JS app the browser would track the in-flight navigation to /b and\n * then replace it with /c when it encountered the redirect response. In\n * the end it would only ever update the URL bar with /c.\n *\n * In client-side routing using pushState/replaceState, we aim to emulate\n * this behavior and we also do not update history until the end of the\n * navigation (including processed redirects). This means that we never\n * actually touch history until we've processed redirects, so we just use\n * the history action from the original navigation (PUSH or REPLACE).\n */\n async function startRedirectNavigation(request, redirect, _temp2) {\n let {\n submission,\n fetcherSubmission,\n replace\n } = _temp2 === void 0 ? {} : _temp2;\n if (redirect.response.headers.has(\"X-Remix-Revalidate\")) {\n isRevalidationRequired = true;\n }\n let location = redirect.response.headers.get(\"Location\");\n invariant(location, \"Expected a Location header on the redirect Response\");\n location = normalizeRedirectLocation(location, new URL(request.url), basename);\n let redirectLocation = createLocation(state.location, location, {\n _isRedirect: true\n });\n if (isBrowser) {\n let isDocumentReload = false;\n if (redirect.response.headers.has(\"X-Remix-Reload-Document\")) {\n // Hard reload if the response contained X-Remix-Reload-Document\n isDocumentReload = true;\n } else if (ABSOLUTE_URL_REGEX.test(location)) {\n const url = init.history.createURL(location);\n isDocumentReload =\n // Hard reload if it's an absolute URL to a new origin\n url.origin !== routerWindow.location.origin ||\n // Hard reload if it's an absolute URL that does not match our basename\n stripBasename(url.pathname, basename) == null;\n }\n if (isDocumentReload) {\n if (replace) {\n routerWindow.location.replace(location);\n } else {\n routerWindow.location.assign(location);\n }\n return;\n }\n }\n // There's no need to abort on redirects, since we don't detect the\n // redirect until the action/loaders have settled\n pendingNavigationController = null;\n let redirectHistoryAction = replace === true || redirect.response.headers.has(\"X-Remix-Replace\") ? Action.Replace : Action.Push;\n // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n let {\n formMethod,\n formAction,\n formEncType\n } = state.navigation;\n if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) {\n submission = getSubmissionFromNavigation(state.navigation);\n }\n // If this was a 307/308 submission we want to preserve the HTTP method and\n // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the\n // redirected location\n let activeSubmission = submission || fetcherSubmission;\n if (redirectPreserveMethodStatusCodes.has(redirect.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: _extends({}, activeSubmission, {\n formAction: location\n }),\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n } else {\n // If we have a navigation submission, we will preserve it through the\n // redirect navigation\n let overrideNavigation = getLoadingNavigation(redirectLocation, submission);\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation,\n // Send fetcher submissions through for shouldRevalidate\n fetcherSubmission,\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n }\n }\n // Utility wrapper for calling dataStrategy client-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, request, matchesToLoad, matches) {\n try {\n let results = await callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, manifest, mapRouteProperties);\n return await Promise.all(results.map((result, i) => {\n if (isRedirectHandlerResult(result)) {\n let response = result.result;\n return {\n type: ResultType.redirect,\n response: normalizeRelativeRoutingRedirectResponse(response, request, matchesToLoad[i].route.id, matches, basename, future.v7_relativeSplatPath)\n };\n }\n return convertHandlerResultToDataResult(result);\n }));\n } catch (e) {\n // If the outer dataStrategy method throws, just return the error for all\n // matches - and it'll naturally bubble to the root\n return matchesToLoad.map(() => ({\n type: ResultType.error,\n error: e\n }));\n }\n }\n async function callLoadersAndMaybeResolveData(currentMatches, matches, matchesToLoad, fetchersToLoad, request) {\n let [loaderResults, ...fetcherResults] = await Promise.all([matchesToLoad.length ? callDataStrategy(\"loader\", request, matchesToLoad, matches) : [], ...fetchersToLoad.map(f => {\n if (f.matches && f.match && f.controller) {\n let fetcherRequest = createClientSideRequest(init.history, f.path, f.controller.signal);\n return callDataStrategy(\"loader\", fetcherRequest, [f.match], f.matches).then(r => r[0]);\n } else {\n return Promise.resolve({\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n });\n }\n })]);\n await Promise.all([resolveDeferredResults(currentMatches, matchesToLoad, loaderResults, loaderResults.map(() => request.signal), false, state.loaderData), resolveDeferredResults(currentMatches, fetchersToLoad.map(f => f.match), fetcherResults, fetchersToLoad.map(f => f.controller ? f.controller.signal : null), true)]);\n return {\n loaderResults,\n fetcherResults\n };\n }\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true;\n // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n cancelledDeferredRoutes.push(...cancelActiveDeferreds());\n // Abort in-flight fetcher loads\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.add(key);\n abortFetcher(key);\n }\n });\n }\n function updateFetcherState(key, fetcher, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state.fetchers.set(key, fetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function setFetcherError(key, routeId, error, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n deleteFetcher(key);\n updateState({\n errors: {\n [boundaryMatch.route.id]: error\n },\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function getFetcher(key) {\n if (future.v7_fetcherPersist) {\n activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1);\n // If this fetcher was previously marked for deletion, unmark it since we\n // have a new instance\n if (deletedFetchers.has(key)) {\n deletedFetchers.delete(key);\n }\n }\n return state.fetchers.get(key) || IDLE_FETCHER;\n }\n function deleteFetcher(key) {\n let fetcher = state.fetchers.get(key);\n // Don't abort the controller if this is a deletion of a fetcher.submit()\n // in it's loading phase since - we don't want to abort the corresponding\n // revalidation and want them to complete and land\n if (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) {\n abortFetcher(key);\n }\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n deletedFetchers.delete(key);\n cancelledFetcherLoads.delete(key);\n state.fetchers.delete(key);\n }\n function deleteFetcherAndUpdateState(key) {\n if (future.v7_fetcherPersist) {\n let count = (activeFetchers.get(key) || 0) - 1;\n if (count <= 0) {\n activeFetchers.delete(key);\n deletedFetchers.add(key);\n } else {\n activeFetchers.set(key, count);\n }\n } else {\n deleteFetcher(key);\n }\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n invariant(controller, \"Expected fetch controller: \" + key);\n controller.abort();\n fetchControllers.delete(key);\n }\n function markFetchersDone(keys) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = getDoneFetcher(fetcher.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n function markFetchRedirectsDone() {\n let doneKeys = [];\n let updatedFetchers = false;\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n updatedFetchers = true;\n }\n }\n markFetchersDone(doneKeys);\n return updatedFetchers;\n }\n function abortStaleFetchLoads(landedId) {\n let yeetedKeys = [];\n for (let [key, id] of fetchReloadIds) {\n if (id < landedId) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n function getBlocker(key, fn) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n return blocker;\n }\n function deleteBlocker(key) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n }\n // Utility function to update blockers, ensuring valid state transitions\n function updateBlocker(key, newBlocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n invariant(blocker.state === \"unblocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"proceeding\" || blocker.state === \"blocked\" && newBlocker.state === \"unblocked\" || blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\", \"Invalid blocker state transition: \" + blocker.state + \" -> \" + newBlocker.state);\n let blockers = new Map(state.blockers);\n blockers.set(key, newBlocker);\n updateState({\n blockers\n });\n }\n function shouldBlockNavigation(_ref4) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref4;\n if (blockerFunctions.size === 0) {\n return;\n }\n // We ony support a single active blocker at the moment since we don't have\n // any compelling use cases for multi-blocker yet\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n if (blocker && blocker.state === \"proceeding\") {\n // If the blocker is currently proceeding, we don't need to re-check\n // it and can let this navigation continue\n return;\n }\n // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n if (blockerFunction({\n currentLocation,\n nextLocation,\n historyAction\n })) {\n return blockerKey;\n }\n }\n function handleNavigational404(pathname) {\n let error = getInternalRouterError(404, {\n pathname\n });\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let {\n matches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n return {\n notFoundMatches: matches,\n route,\n error\n };\n }\n function handleDiscoverRouteError(pathname, discoverResult) {\n return {\n boundaryId: findNearestBoundary(discoverResult.partialMatches).route.id,\n error: getInternalRouterError(400, {\n type: \"route-discovery\",\n pathname,\n message: discoverResult.error != null && \"message\" in discoverResult.error ? discoverResult.error : String(discoverResult.error)\n })\n };\n }\n function cancelActiveDeferreds(predicate) {\n let cancelledRouteIds = [];\n activeDeferreds.forEach((dfd, routeId) => {\n if (!predicate || predicate(routeId)) {\n // Cancel the deferred - but do not remove from activeDeferreds here -\n // we rely on the subscribers to do that so our tests can assert proper\n // cleanup via _internalActiveDeferreds\n dfd.cancel();\n cancelledRouteIds.push(routeId);\n activeDeferreds.delete(routeId);\n }\n });\n return cancelledRouteIds;\n }\n // Opt in to capturing and reporting scroll positions during navigations,\n // used by the component\n function enableScrollRestoration(positions, getPosition, getKey) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n getScrollRestorationKey = getKey || null;\n // Perform initial hydration scroll restoration, since we miss the boat on\n // the initial updateState() because we've not yet rendered \n // and therefore have no savedScrollPositions available\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n if (y != null) {\n updateState({\n restoreScrollPosition: y\n });\n }\n }\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n function getScrollKey(location, matches) {\n if (getScrollRestorationKey) {\n let key = getScrollRestorationKey(location, matches.map(m => convertRouteMatchToUiMatch(m, state.loaderData)));\n return key || location.key;\n }\n return location.key;\n }\n function saveScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollPosition) {\n let key = getScrollKey(location, matches);\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n function getSavedScrollPosition(location, matches) {\n if (savedScrollPositions) {\n let key = getScrollKey(location, matches);\n let y = savedScrollPositions[key];\n if (typeof y === \"number\") {\n return y;\n }\n }\n return null;\n }\n function checkFogOfWar(matches, routesToUse, pathname) {\n if (patchRoutesOnNavigationImpl) {\n // Don't bother re-calling patchRouteOnMiss for a path we've already\n // processed. the last execution would have patched the route tree\n // accordingly so `matches` here are already accurate.\n if (discoveredRoutes.has(pathname)) {\n return {\n active: false,\n matches\n };\n }\n if (!matches) {\n let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: fogMatches || []\n };\n } else {\n if (Object.keys(matches[0].params).length > 0) {\n // If we matched a dynamic param or a splat, it might only be because\n // we haven't yet discovered other routes that would match with a\n // higher score. Call patchRoutesOnNavigation just to be sure\n let partialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: partialMatches\n };\n }\n }\n }\n return {\n active: false,\n matches: null\n };\n }\n async function discoverRoutes(matches, pathname, signal) {\n let partialMatches = matches;\n while (true) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n try {\n await loadLazyRouteChildren(patchRoutesOnNavigationImpl, pathname, partialMatches, routesToUse, manifest, mapRouteProperties, pendingPatchRoutes, signal);\n } catch (e) {\n return {\n type: \"error\",\n error: e,\n partialMatches\n };\n } finally {\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity so when we `updateState` at the end of\n // this navigation/fetch `router.routes` will be a new identity and\n // trigger a re-run of memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR) {\n dataRoutes = [...dataRoutes];\n }\n }\n if (signal.aborted) {\n return {\n type: \"aborted\"\n };\n }\n let newMatches = matchRoutes(routesToUse, pathname, basename);\n if (newMatches) {\n addToFifoQueue(pathname, discoveredRoutes);\n return {\n type: \"success\",\n matches: newMatches\n };\n }\n let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n // Avoid loops if the second pass results in the same partial matches\n if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every((m, i) => m.route.id === newPartialMatches[i].route.id)) {\n addToFifoQueue(pathname, discoveredRoutes);\n return {\n type: \"success\",\n matches: null\n };\n }\n partialMatches = newPartialMatches;\n }\n }\n function addToFifoQueue(path, queue) {\n if (queue.size >= discoveredRoutesMaxSize) {\n let first = queue.values().next().value;\n queue.delete(first);\n }\n queue.add(path);\n }\n function _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\n }\n function patchRoutes(routeId, children) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties);\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity and trigger a reflow via `updateState`\n // to re-run memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR) {\n dataRoutes = [...dataRoutes];\n updateState({});\n }\n }\n router = {\n get basename() {\n return basename;\n },\n get future() {\n return future;\n },\n get state() {\n return state;\n },\n get routes() {\n return dataRoutes;\n },\n get window() {\n return routerWindow;\n },\n initialize,\n subscribe,\n enableScrollRestoration,\n navigate,\n fetch,\n revalidate,\n // Passthrough to history-aware createHref used by useHref so we get proper\n // hash-aware URLs in DOM paths\n createHref: to => init.history.createHref(to),\n encodeLocation: to => init.history.encodeLocation(to),\n getFetcher,\n deleteFetcher: deleteFetcherAndUpdateState,\n dispose,\n getBlocker,\n deleteBlocker,\n patchRoutes,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds,\n // TODO: Remove setRoutes, it's temporary to avoid dealing with\n // updating the tree while validating the update algorithm.\n _internalSetRoutes\n };\n return router;\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\nconst UNSAFE_DEFERRED_SYMBOL = Symbol(\"deferred\");\nfunction createStaticHandler(routes, opts) {\n invariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n let manifest = {};\n let basename = (opts ? opts.basename : null) || \"/\";\n let mapRouteProperties;\n if (opts != null && opts.mapRouteProperties) {\n mapRouteProperties = opts.mapRouteProperties;\n } else if (opts != null && opts.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = opts.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Config driven behavior flags\n let future = _extends({\n v7_relativeSplatPath: false,\n v7_throwAbortReason: false\n }, opts ? opts.future : null);\n let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);\n /**\n * The query() method is intended for document requests, in which we want to\n * call an optional action and potentially multiple loaders for all nested\n * routes. It returns a StaticHandlerContext object, which is very similar\n * to the router state (location, loaderData, actionData, errors, etc.) and\n * also adds SSR-specific information such as the statusCode and headers\n * from action/loaders Responses.\n *\n * It _should_ never throw and should report all errors through the\n * returned context.errors object, properly associating errors to their error\n * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be\n * used to emulate React error boundaries during SSr by performing a second\n * pass only down to the boundaryId.\n *\n * The one exception where we do not return a StaticHandlerContext is when a\n * redirect response is returned or thrown from any action/loader. We\n * propagate that out and return the raw Response so the HTTP server can\n * return it directly.\n *\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n * - `opts.skipLoaderErrorBubbling` is an optional parameter that will prevent\n * the bubbling of errors which allows single-fetch-type implementations\n * where the client will handle the bubbling and we may need to return data\n * for the handling route\n */\n async function query(request, _temp3) {\n let {\n requestContext,\n skipLoaderErrorBubbling,\n unstable_dataStrategy\n } = _temp3 === void 0 ? {} : _temp3;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\") {\n let error = getInternalRouterError(405, {\n method\n });\n let {\n matches: methodNotAllowedMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: methodNotAllowedMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n } else if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: notFoundMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n let result = await queryImpl(request, location, matches, requestContext, unstable_dataStrategy || null, skipLoaderErrorBubbling === true, null);\n if (isResponse(result)) {\n return result;\n }\n // When returning StaticHandlerContext, we patch back in the location here\n // since we need it for React Context. But this helps keep our submit and\n // loadRouteData operating on a Request instead of a Location\n return _extends({\n location,\n basename\n }, result);\n }\n /**\n * The queryRoute() method is intended for targeted route requests, either\n * for fetch ?_data requests or resource route requests. In this case, we\n * are only ever calling a single action or loader, and we are returning the\n * returned value directly. In most cases, this will be a Response returned\n * from the action/loader, but it may be a primitive or other value as well -\n * and in such cases the calling context should handle that accordingly.\n *\n * We do respect the throw/return differentiation, so if an action/loader\n * throws, then this method will throw the value. This is important so we\n * can do proper boundary identification in Remix where a thrown Response\n * must go to the Catch Boundary but a returned Response is happy-path.\n *\n * One thing to note is that any Router-initiated Errors that make sense\n * to associate with a status code will be thrown as an ErrorResponse\n * instance which include the raw Error, such that the calling context can\n * serialize the error as they see fit while including the proper response\n * code. Examples here are 404 and 405 errors that occur prior to reaching\n * any user-defined loaders.\n *\n * - `opts.routeId` allows you to specify the specific route handler to call.\n * If not provided the handler will determine the proper route by matching\n * against `request.url`\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n */\n async function queryRoute(request, _temp4) {\n let {\n routeId,\n requestContext,\n unstable_dataStrategy\n } = _temp4 === void 0 ? {} : _temp4;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") {\n throw getInternalRouterError(405, {\n method\n });\n } else if (!matches) {\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location);\n if (routeId && !match) {\n throw getInternalRouterError(403, {\n pathname: location.pathname,\n routeId\n });\n } else if (!match) {\n // This should never hit I don't think?\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let result = await queryImpl(request, location, matches, requestContext, unstable_dataStrategy || null, false, match);\n if (isResponse(result)) {\n return result;\n }\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n if (error !== undefined) {\n // If we got back result.errors, that means the loader/action threw\n // _something_ that wasn't a Response, but it's not guaranteed/required\n // to be an `instanceof Error` either, so we have to use throw here to\n // preserve the \"error\" state outside of queryImpl.\n throw error;\n }\n // Pick off the right state value to return\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n if (result.loaderData) {\n var _result$activeDeferre;\n let data = Object.values(result.loaderData)[0];\n if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n return data;\n }\n return undefined;\n }\n async function queryImpl(request, location, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch) {\n invariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch);\n return isResponse(result) ? result : _extends({}, result, {\n actionData: null,\n actionHeaders: {}\n });\n } catch (e) {\n // If the user threw/returned a Response in callLoaderOrAction for a\n // `queryRoute` call, we throw the `HandlerResult` to bail out early\n // and then return or throw the raw Response here accordingly\n if (isHandlerResult(e) && isResponse(e.result)) {\n if (e.type === ResultType.error) {\n throw e.result;\n }\n return e.result;\n }\n // Redirects are always returned since they don't propagate to catch\n // boundaries\n if (isRedirectResponse(e)) {\n return e;\n }\n throw e;\n }\n }\n async function submit(request, matches, actionMatch, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, isRouteRequest) {\n let result;\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n } else {\n let results = await callDataStrategy(\"action\", request, [actionMatch], matches, isRouteRequest, requestContext, unstable_dataStrategy);\n result = results[0];\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n }\n if (isRedirectResult(result)) {\n // Uhhhh - this should never happen, we should always throw these from\n // callLoaderOrAction, but the type narrowing here keeps TS happy and we\n // can get back on the \"throw all redirect responses\" train here should\n // this ever happen :/\n throw new Response(null, {\n status: result.response.status,\n headers: {\n Location: result.response.headers.get(\"Location\")\n }\n });\n }\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, {\n type: \"defer-action\"\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n }\n if (isRouteRequest) {\n // Note: This should only be non-Response values if we get here, since\n // isRouteRequest should throw any Response received in callLoaderOrAction\n if (isErrorResult(result)) {\n throw result.error;\n }\n return {\n matches: [actionMatch],\n loaderData: {},\n actionData: {\n [actionMatch.route.id]: result.data\n },\n errors: null,\n // Note: statusCode + headers are unused here since queryRoute will\n // return the raw Response or value\n statusCode: 200,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n // Create a GET request for the loaders\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal\n });\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);\n let context = await loadRouteData(loaderRequest, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, null, [boundaryMatch.route.id, result]);\n // action status codes take precedence over loader status codes\n return _extends({}, context, {\n statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,\n actionData: null,\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n let context = await loadRouteData(loaderRequest, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, null);\n return _extends({}, context, {\n actionData: {\n [actionMatch.route.id]: result.data\n }\n }, result.statusCode ? {\n statusCode: result.statusCode\n } : {}, {\n actionHeaders: result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {}\n });\n }\n async function loadRouteData(request, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch, pendingActionResult) {\n let isRouteRequest = routeMatch != null;\n // Short circuit if we have no loaders to run (queryRoute())\n if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) {\n throw getInternalRouterError(400, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: routeMatch == null ? void 0 : routeMatch.route.id\n });\n }\n let requestMatches = routeMatch ? [routeMatch] : pendingActionResult && isErrorResult(pendingActionResult[1]) ? getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]) : matches;\n let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy);\n // Short circuit if we have no loaders to run (query())\n if (matchesToLoad.length === 0) {\n return {\n matches,\n // Add a null for all matched routes for proper revalidation on the client\n loaderData: matches.reduce((acc, m) => Object.assign(acc, {\n [m.route.id]: null\n }), {}),\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null\n };\n }\n let results = await callDataStrategy(\"loader\", request, matchesToLoad, matches, isRouteRequest, requestContext, unstable_dataStrategy);\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n // Process and commit output from loaders\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(matches, matchesToLoad, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling);\n // Add a null for any non-loader matches for proper revalidation on the client\n let executedLoaders = new Set(matchesToLoad.map(match => match.route.id));\n matches.forEach(match => {\n if (!executedLoaders.has(match.route.id)) {\n context.loaderData[match.route.id] = null;\n }\n });\n return _extends({}, context, {\n matches,\n activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null\n });\n }\n // Utility wrapper for calling dataStrategy server-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, request, matchesToLoad, matches, isRouteRequest, requestContext, unstable_dataStrategy) {\n let results = await callDataStrategyImpl(unstable_dataStrategy || defaultDataStrategy, type, request, matchesToLoad, matches, manifest, mapRouteProperties, requestContext);\n return await Promise.all(results.map((result, i) => {\n if (isRedirectHandlerResult(result)) {\n let response = result.result;\n // Throw redirects and let the server handle them with an HTTP redirect\n throw normalizeRelativeRoutingRedirectResponse(response, request, matchesToLoad[i].route.id, matches, basename, future.v7_relativeSplatPath);\n }\n if (isResponse(result.result) && isRouteRequest) {\n // For SSR single-route requests, we want to hand Responses back\n // directly without unwrapping\n throw result;\n }\n return convertHandlerResultToDataResult(result);\n }));\n }\n return {\n dataRoutes,\n query,\n queryRoute\n };\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Given an existing StaticHandlerContext and an error thrown at render time,\n * provide an updated StaticHandlerContext suitable for a second SSR render\n */\nfunction getStaticContextFromError(routes, context, error) {\n let newContext = _extends({}, context, {\n statusCode: isRouteErrorResponse(error) ? error.status : 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error\n }\n });\n return newContext;\n}\nfunction throwStaticHandlerAbortedError(request, isRouteRequest, future) {\n if (future.v7_throwAbortReason && request.signal.reason !== undefined) {\n throw request.signal.reason;\n }\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted: \" + request.method + \" \" + request.url);\n}\nfunction isSubmissionNavigation(opts) {\n return opts != null && (\"formData\" in opts && opts.formData != null || \"body\" in opts && opts.body !== undefined);\n}\nfunction normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) {\n let contextualMatches;\n let activeRouteMatch;\n if (fromRouteId) {\n // Grab matches up to the calling route so our route-relative logic is\n // relative to the correct source route\n contextualMatches = [];\n for (let match of matches) {\n contextualMatches.push(match);\n if (match.route.id === fromRouteId) {\n activeRouteMatch = match;\n break;\n }\n }\n } else {\n contextualMatches = matches;\n activeRouteMatch = matches[matches.length - 1];\n }\n // Resolve the relative path\n let path = resolveTo(to ? to : \".\", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n // When `to` is not specified we inherit search/hash from the current\n // location, unlike when to=\".\" and we just inherit the path.\n // See https://github.com/remix-run/remix/issues/927\n if (to == null) {\n path.search = location.search;\n path.hash = location.hash;\n }\n // Add an ?index param for matched index routes if we don't already have one\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch && activeRouteMatch.route.index && !hasNakedIndexQuery(path.search)) {\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n }\n // If we're operating within a basename, prepend it to the pathname. If\n // this is a root navigation, then just use the raw basename which allows\n // the basename to have full control over the presence of a trailing slash\n // on root actions\n if (prependBasename && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\nfunction normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {\n // Return location verbatim on non-submission navigations\n if (!opts || !isSubmissionNavigation(opts)) {\n return {\n path\n };\n }\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, {\n method: opts.formMethod\n })\n };\n }\n let getInvalidBodyError = () => ({\n path,\n error: getInternalRouterError(400, {\n type: \"invalid-body\"\n })\n });\n // Create a Submission on non-GET navigations\n let rawFormMethod = opts.formMethod || \"get\";\n let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase();\n let formAction = stripHashFromPath(path);\n if (opts.body !== undefined) {\n if (opts.formEncType === \"text/plain\") {\n // text only support POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n let text = typeof opts.body === \"string\" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data\n Array.from(opts.body.entries()).reduce((acc, _ref5) => {\n let [name, value] = _ref5;\n return \"\" + acc + name + \"=\" + value + \"\\n\";\n }, \"\") : String(opts.body);\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json: undefined,\n text\n }\n };\n } else if (opts.formEncType === \"application/json\") {\n // json only supports POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n try {\n let json = typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json,\n text: undefined\n }\n };\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n }\n invariant(typeof FormData === \"function\", \"FormData is not available in this environment\");\n let searchParams;\n let formData;\n if (opts.formData) {\n searchParams = convertFormDataToSearchParams(opts.formData);\n formData = opts.formData;\n } else if (opts.body instanceof FormData) {\n searchParams = convertFormDataToSearchParams(opts.body);\n formData = opts.body;\n } else if (opts.body instanceof URLSearchParams) {\n searchParams = opts.body;\n formData = convertSearchParamsToFormData(searchParams);\n } else if (opts.body == null) {\n searchParams = new URLSearchParams();\n formData = new FormData();\n } else {\n try {\n searchParams = new URLSearchParams(opts.body);\n formData = convertSearchParamsToFormData(searchParams);\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n let submission = {\n formMethod,\n formAction,\n formEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n formData,\n json: undefined,\n text: undefined\n };\n if (isMutationMethod(submission.formMethod)) {\n return {\n path,\n submission\n };\n }\n // Flatten submission onto URLSearchParams for GET submissions\n let parsedPath = parsePath(path);\n // On GET navigation submissions we can drop the ?index param from the\n // resulting location since all loaders will run. But fetcher GET submissions\n // only run a single loader so we need to preserve any incoming ?index params\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n parsedPath.search = \"?\" + searchParams;\n return {\n path: createPath(parsedPath),\n submission\n };\n}\n// Filter out all routes below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId) {\n let boundaryMatches = matches;\n if (boundaryId) {\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n boundaryMatches = matches.slice(0, index);\n }\n }\n return boundaryMatches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, isInitialLoad, skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) {\n let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : undefined;\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n // Pick navigation matches that are net-new or qualify for revalidation\n let boundaryId = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[0] : undefined;\n let boundaryMatches = boundaryId ? getLoaderMatchesUntilBoundary(matches, boundaryId) : matches;\n // Don't revalidate loaders by default after action 4xx/5xx responses\n // when the flag is enabled. They can still opt-into revalidation via\n // `shouldRevalidate` via `actionResult`\n let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : undefined;\n let shouldSkipRevalidation = skipActionErrorRevalidation && actionStatus && actionStatus >= 400;\n let navigationMatches = boundaryMatches.filter((match, index) => {\n let {\n route\n } = match;\n if (route.lazy) {\n // We haven't loaded this route yet so we don't know if it's got a loader!\n return true;\n }\n if (route.loader == null) {\n return false;\n }\n if (isInitialLoad) {\n if (typeof route.loader !== \"function\" || route.loader.hydrate) {\n return true;\n }\n return state.loaderData[route.id] === undefined && (\n // Don't re-run if the loader ran and threw an error\n !state.errors || state.errors[route.id] === undefined);\n }\n // Always call the loader on new route instances and pending defer cancellations\n if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) {\n return true;\n }\n // This is the default implementation for when we revalidate. If the route\n // provides it's own implementation, then we give them full control but\n // provide this value so they can leverage it if needed after they check\n // their own specific use cases\n let currentRouteMatch = state.matches[index];\n let nextRouteMatch = match;\n return shouldRevalidateLoader(match, _extends({\n currentUrl,\n currentParams: currentRouteMatch.params,\n nextUrl,\n nextParams: nextRouteMatch.params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false :\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search ||\n // Search params affect all loaders\n currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)\n }));\n });\n // Pick fetcher.loads that need to be revalidated\n let revalidatingFetchers = [];\n fetchLoadMatches.forEach((f, key) => {\n // Don't revalidate:\n // - on initial load (shouldn't be any fetchers then anyway)\n // - if fetcher won't be present in the subsequent render\n // - no longer matches the URL (v7_fetcherPersist=false)\n // - was unmounted but persisted due to v7_fetcherPersist=true\n if (isInitialLoad || !matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) {\n return;\n }\n let fetcherMatches = matchRoutes(routesToUse, f.path, basename);\n // If the fetcher path no longer matches, push it in with null matches so\n // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is\n // currently only a use-case for Remix HMR where the route tree can change\n // at runtime and remove a route previously loaded via a fetcher\n if (!fetcherMatches) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: null,\n match: null,\n controller: null\n });\n return;\n }\n // Revalidating fetchers are decoupled from the route matches since they\n // load from a static href. They revalidate based on explicit revalidation\n // (submission, useRevalidator, or X-Remix-Revalidate)\n let fetcher = state.fetchers.get(key);\n let fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n let shouldRevalidate = false;\n if (fetchRedirectIds.has(key)) {\n // Never trigger a revalidation of an actively redirecting fetcher\n shouldRevalidate = false;\n } else if (cancelledFetcherLoads.has(key)) {\n // Always mark for revalidation if the fetcher was cancelled\n cancelledFetcherLoads.delete(key);\n shouldRevalidate = true;\n } else if (fetcher && fetcher.state !== \"idle\" && fetcher.data === undefined) {\n // If the fetcher hasn't ever completed loading yet, then this isn't a\n // revalidation, it would just be a brand new load if an explicit\n // revalidation is required\n shouldRevalidate = isRevalidationRequired;\n } else {\n // Otherwise fall back on any user-defined shouldRevalidate, defaulting\n // to explicit revalidations only\n shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({\n currentUrl,\n currentParams: state.matches[state.matches.length - 1].params,\n nextUrl,\n nextParams: matches[matches.length - 1].params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired\n }));\n }\n if (shouldRevalidate) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController()\n });\n }\n });\n return [navigationMatches, revalidatingFetchers];\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n let isNew =\n // [a] -> [a, b]\n !currentMatch ||\n // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id;\n // Handle the case that we don't have data for a re-used route, potentially\n // from a prior error or from a cancelled pending deferred\n let isMissingData = currentLoaderData[match.route.id] === undefined;\n // Always load if this is a net-new route or we don't yet have data\n return isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n let currentPath = currentMatch.route.path;\n return (\n // param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname ||\n // splat param changed, which is not present in match.path\n // e.g. /files/images/avatar.jpg -> files/finances.xls\n currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"]\n );\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n return arg.defaultShouldRevalidate;\n}\n/**\n * Idempotent utility to execute patchRoutesOnNavigation() to lazily load route\n * definitions and update the routes/routeManifest\n */\nasync function loadLazyRouteChildren(patchRoutesOnNavigationImpl, path, matches, routes, manifest, mapRouteProperties, pendingRouteChildren, signal) {\n let key = [path, ...matches.map(m => m.route.id)].join(\"-\");\n try {\n let pending = pendingRouteChildren.get(key);\n if (!pending) {\n pending = patchRoutesOnNavigationImpl({\n path,\n matches,\n patch: (routeId, children) => {\n if (!signal.aborted) {\n patchRoutesImpl(routeId, children, routes, manifest, mapRouteProperties);\n }\n }\n });\n pendingRouteChildren.set(key, pending);\n }\n if (pending && isPromise(pending)) {\n await pending;\n }\n } finally {\n pendingRouteChildren.delete(key);\n }\n}\nfunction patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties) {\n if (routeId) {\n var _route$children;\n let route = manifest[routeId];\n invariant(route, \"No route found to patch children into: routeId = \" + routeId);\n let dataChildren = convertRoutesToDataRoutes(children, mapRouteProperties, [routeId, \"patch\", String(((_route$children = route.children) == null ? void 0 : _route$children.length) || \"0\")], manifest);\n if (route.children) {\n route.children.push(...dataChildren);\n } else {\n route.children = dataChildren;\n }\n } else {\n let dataChildren = convertRoutesToDataRoutes(children, mapRouteProperties, [\"patch\", String(routesToUse.length || \"0\")], manifest);\n routesToUse.push(...dataChildren);\n }\n}\n/**\n * Execute route.lazy() methods to lazily load route modules (loader, action,\n * shouldRevalidate) and update the routeManifest in place which shares objects\n * with dataRoutes so those get updated as well.\n */\nasync function loadLazyRouteModule(route, mapRouteProperties, manifest) {\n if (!route.lazy) {\n return;\n }\n let lazyRoute = await route.lazy();\n // If the lazy route function was executed and removed by another parallel\n // call then we can return - first lazy() to finish wins because the return\n // value of lazy is expected to be static\n if (!route.lazy) {\n return;\n }\n let routeToUpdate = manifest[route.id];\n invariant(routeToUpdate, \"No route found in manifest\");\n // Update the route in place. This should be safe because there's no way\n // we could yet be sitting on this route as we can't get there without\n // resolving lazy() first.\n //\n // This is different than the HMR \"update\" use-case where we may actively be\n // on the route being updated. The main concern boils down to \"does this\n // mutation affect any ongoing navigations or any current state.matches\n // values?\". If not, it should be safe to update in place.\n let routeUpdates = {};\n for (let lazyRouteProperty in lazyRoute) {\n let staticRouteValue = routeToUpdate[lazyRouteProperty];\n let isPropertyStaticallyDefined = staticRouteValue !== undefined &&\n // This property isn't static since it should always be updated based\n // on the route updates\n lazyRouteProperty !== \"hasErrorBoundary\";\n warning(!isPropertyStaticallyDefined, \"Route \\\"\" + routeToUpdate.id + \"\\\" has a static property \\\"\" + lazyRouteProperty + \"\\\" \" + \"defined but its lazy function is also returning a value for this property. \" + (\"The lazy route property \\\"\" + lazyRouteProperty + \"\\\" will be ignored.\"));\n if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) {\n routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];\n }\n }\n // Mutate the route with the provided updates. Do this first so we pass\n // the updated version to mapRouteProperties\n Object.assign(routeToUpdate, routeUpdates);\n // Mutate the `hasErrorBoundary` property on the route based on the route\n // updates and remove the `lazy` function so we don't resolve the lazy\n // route again.\n Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {\n lazy: undefined\n }));\n}\n// Default implementation of `dataStrategy` which fetches all loaders in parallel\nfunction defaultDataStrategy(opts) {\n return Promise.all(opts.matches.map(m => m.resolve()));\n}\nasync function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, manifest, mapRouteProperties, requestContext) {\n let routeIdsToLoad = matchesToLoad.reduce((acc, m) => acc.add(m.route.id), new Set());\n let loadedMatches = new Set();\n // Send all matches here to allow for a middleware-type implementation.\n // handler will be a no-op for unneeded routes and we filter those results\n // back out below.\n let results = await dataStrategyImpl({\n matches: matches.map(match => {\n let shouldLoad = routeIdsToLoad.has(match.route.id);\n // `resolve` encapsulates the route.lazy, executing the\n // loader/action, and mapping return values/thrown errors to a\n // HandlerResult. Users can pass a callback to take fine-grained control\n // over the execution of the loader/action\n let resolve = handlerOverride => {\n loadedMatches.add(match.route.id);\n return shouldLoad ? callLoaderOrAction(type, request, match, manifest, mapRouteProperties, handlerOverride, requestContext) : Promise.resolve({\n type: ResultType.data,\n result: undefined\n });\n };\n return _extends({}, match, {\n shouldLoad,\n resolve\n });\n }),\n request,\n params: matches[0].params,\n context: requestContext\n });\n // Throw if any loadRoute implementations not called since they are what\n // ensures a route is fully loaded\n matches.forEach(m => invariant(loadedMatches.has(m.route.id), \"`match.resolve()` was not called for route id \\\"\" + m.route.id + \"\\\". \" + \"You must call `match.resolve()` on every match passed to \" + \"`dataStrategy` to ensure all routes are properly loaded.\"));\n // Filter out any middleware-only matches for which we didn't need to run handlers\n return results.filter((_, i) => routeIdsToLoad.has(matches[i].route.id));\n}\n// Default logic for calling a loader/action is the user has no specified a dataStrategy\nasync function callLoaderOrAction(type, request, match, manifest, mapRouteProperties, handlerOverride, staticContext) {\n let result;\n let onReject;\n let runHandler = handler => {\n // Setup a promise we can race against so that abort signals short circuit\n let reject;\n // This will never resolve so safe to type it as Promise to\n // satisfy the function return value\n let abortPromise = new Promise((_, r) => reject = r);\n onReject = () => reject();\n request.signal.addEventListener(\"abort\", onReject);\n let actualHandler = ctx => {\n if (typeof handler !== \"function\") {\n return Promise.reject(new Error(\"You cannot call the handler for a route which defines a boolean \" + (\"\\\"\" + type + \"\\\" [routeId: \" + match.route.id + \"]\")));\n }\n return handler({\n request,\n params: match.params,\n context: staticContext\n }, ...(ctx !== undefined ? [ctx] : []));\n };\n let handlerPromise;\n if (handlerOverride) {\n handlerPromise = handlerOverride(ctx => actualHandler(ctx));\n } else {\n handlerPromise = (async () => {\n try {\n let val = await actualHandler();\n return {\n type: \"data\",\n result: val\n };\n } catch (e) {\n return {\n type: \"error\",\n result: e\n };\n }\n })();\n }\n return Promise.race([handlerPromise, abortPromise]);\n };\n try {\n let handler = match.route[type];\n if (match.route.lazy) {\n if (handler) {\n // Run statically defined handler in parallel with lazy()\n let handlerError;\n let [value] = await Promise.all([\n // If the handler throws, don't let it immediately bubble out,\n // since we need to let the lazy() execution finish so we know if this\n // route has a boundary that can handle the error\n runHandler(handler).catch(e => {\n handlerError = e;\n }), loadLazyRouteModule(match.route, mapRouteProperties, manifest)]);\n if (handlerError !== undefined) {\n throw handlerError;\n }\n result = value;\n } else {\n // Load lazy route module, then run any returned handler\n await loadLazyRouteModule(match.route, mapRouteProperties, manifest);\n handler = match.route[type];\n if (handler) {\n // Handler still runs even if we got interrupted to maintain consistency\n // with un-abortable behavior of handler execution on non-lazy or\n // previously-lazy-loaded routes\n result = await runHandler(handler);\n } else if (type === \"action\") {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(405, {\n method: request.method,\n pathname,\n routeId: match.route.id\n });\n } else {\n // lazy() route has no loader to run. Short circuit here so we don't\n // hit the invariant below that errors on returning undefined.\n return {\n type: ResultType.data,\n result: undefined\n };\n }\n }\n } else if (!handler) {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(404, {\n pathname\n });\n } else {\n result = await runHandler(handler);\n }\n invariant(result.result !== undefined, \"You defined \" + (type === \"action\" ? \"an action\" : \"a loader\") + \" for route \" + (\"\\\"\" + match.route.id + \"\\\" but didn't return anything from your `\" + type + \"` \") + \"function. Please return a value or `null`.\");\n } catch (e) {\n // We should already be catching and converting normal handler executions to\n // HandlerResults and returning them, so anything that throws here is an\n // unexpected error we still need to wrap\n return {\n type: ResultType.error,\n result: e\n };\n } finally {\n if (onReject) {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n }\n return result;\n}\nasync function convertHandlerResultToDataResult(handlerResult) {\n let {\n result,\n type\n } = handlerResult;\n if (isResponse(result)) {\n let data;\n try {\n let contentType = result.headers.get(\"Content-Type\");\n // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n if (result.body == null) {\n data = null;\n } else {\n data = await result.json();\n }\n } else {\n data = await result.text();\n }\n } catch (e) {\n return {\n type: ResultType.error,\n error: e\n };\n }\n if (type === ResultType.error) {\n return {\n type: ResultType.error,\n error: new ErrorResponseImpl(result.status, result.statusText, data),\n statusCode: result.status,\n headers: result.headers\n };\n }\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers\n };\n }\n if (type === ResultType.error) {\n if (isDataWithResponseInit(result)) {\n var _result$init2;\n if (result.data instanceof Error) {\n var _result$init;\n return {\n type: ResultType.error,\n error: result.data,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status\n };\n }\n // Convert thrown unstable_data() to ErrorResponse instances\n result = new ErrorResponseImpl(((_result$init2 = result.init) == null ? void 0 : _result$init2.status) || 500, undefined, result.data);\n }\n return {\n type: ResultType.error,\n error: result,\n statusCode: isRouteErrorResponse(result) ? result.status : undefined\n };\n }\n if (isDeferredData(result)) {\n var _result$init3, _result$init4;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init3 = result.init) == null ? void 0 : _result$init3.status,\n headers: ((_result$init4 = result.init) == null ? void 0 : _result$init4.headers) && new Headers(result.init.headers)\n };\n }\n if (isDataWithResponseInit(result)) {\n var _result$init5, _result$init6;\n return {\n type: ResultType.data,\n data: result.data,\n statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,\n headers: (_result$init6 = result.init) != null && _result$init6.headers ? new Headers(result.init.headers) : undefined\n };\n }\n return {\n type: ResultType.data,\n data: result\n };\n}\n// Support relative routing in internal redirects\nfunction normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, v7_relativeSplatPath) {\n let location = response.headers.get(\"Location\");\n invariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n let trimmedMatches = matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1);\n location = normalizeTo(new URL(request.url), trimmedMatches, basename, true, location, v7_relativeSplatPath);\n response.headers.set(\"Location\", location);\n }\n return response;\n}\nfunction normalizeRedirectLocation(location, currentUrl, basename) {\n if (ABSOLUTE_URL_REGEX.test(location)) {\n // Strip off the protocol+origin for same-origin + same-basename absolute redirects\n let normalizedLocation = location;\n let url = normalizedLocation.startsWith(\"//\") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);\n let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n return url.pathname + url.search + url.hash;\n }\n }\n return location;\n}\n// Utility method for creating the Request instances for loaders/actions during\n// client-side navigations and fetches. During SSR we will always have a\n// Request instance from the static handler (query/queryRoute)\nfunction createClientSideRequest(history, location, signal, submission) {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init = {\n signal\n };\n if (submission && isMutationMethod(submission.formMethod)) {\n let {\n formMethod,\n formEncType\n } = submission;\n // Didn't think we needed this but it turns out unlike other methods, patch\n // won't be properly normalized to uppercase and results in a 405 error.\n // See: https://fetch.spec.whatwg.org/#concept-method\n init.method = formMethod.toUpperCase();\n if (formEncType === \"application/json\") {\n init.headers = new Headers({\n \"Content-Type\": formEncType\n });\n init.body = JSON.stringify(submission.json);\n } else if (formEncType === \"text/plain\") {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.text;\n } else if (formEncType === \"application/x-www-form-urlencoded\" && submission.formData) {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = convertFormDataToSearchParams(submission.formData);\n } else {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.formData;\n }\n }\n return new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n let searchParams = new URLSearchParams();\n for (let [key, value] of formData.entries()) {\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n searchParams.append(key, typeof value === \"string\" ? value : value.name);\n }\n return searchParams;\n}\nfunction convertSearchParamsToFormData(searchParams) {\n let formData = new FormData();\n for (let [key, value] of searchParams.entries()) {\n formData.append(key, value);\n }\n return formData;\n}\nfunction processRouteLoaderData(matches, matchesToLoad, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling) {\n // Fill in loaderData/errors from our loaders\n let loaderData = {};\n let errors = null;\n let statusCode;\n let foundError = false;\n let loaderHeaders = {};\n let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : undefined;\n // Process loader results into state.loaderData/state.errors\n results.forEach((result, index) => {\n let id = matchesToLoad[index].route.id;\n invariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n if (isErrorResult(result)) {\n let error = result.error;\n // If we have a pending action error, we report it at the highest-route\n // that throws a loader error, and then clear it out to indicate that\n // it was consumed\n if (pendingError !== undefined) {\n error = pendingError;\n pendingError = undefined;\n }\n errors = errors || {};\n if (skipLoaderErrorBubbling) {\n errors[id] = error;\n } else {\n // Look upwards from the matched route for the closest ancestor error\n // boundary, defaulting to the root match. Prefer higher error values\n // if lower errors bubble to the same boundary\n let boundaryMatch = findNearestBoundary(matches, id);\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n }\n }\n // Clear our any prior loaderData for the throwing route\n loaderData[id] = undefined;\n // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n if (isDeferredResult(result)) {\n activeDeferreds.set(id, result.deferredData);\n loaderData[id] = result.deferredData.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode != null && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n loaderData[id] = result.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n }\n }\n });\n // If we didn't consume the pending action error (i.e., all loaders\n // resolved), then consume it here. Also clear out any loaderData for the\n // throwing route\n if (pendingError !== undefined && pendingActionResult) {\n errors = {\n [pendingActionResult[0]]: pendingError\n };\n loaderData[pendingActionResult[0]] = undefined;\n }\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders\n };\n}\nfunction processLoaderData(state, matches, matchesToLoad, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, matchesToLoad, results, pendingActionResult, activeDeferreds, false // This method is only called client side so we always want to bubble\n );\n // Process results from our revalidating fetchers\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n match,\n controller\n } = revalidatingFetchers[index];\n invariant(fetcherResults !== undefined && fetcherResults[index] !== undefined, \"Did not find corresponding fetcher result\");\n let result = fetcherResults[index];\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n continue;\n } else if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id);\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = _extends({}, errors, {\n [boundaryMatch.route.id]: result.error\n });\n }\n state.fetchers.delete(key);\n } else if (isRedirectResult(result)) {\n // Should never get here, redirects should get processed above, but we\n // keep this to type narrow to a success result in the else\n invariant(false, \"Unhandled fetcher revalidation redirect\");\n } else if (isDeferredResult(result)) {\n // Should never get here, deferred data should be awaited for fetchers\n // in resolveDeferredResults\n invariant(false, \"Unhandled fetcher deferred data\");\n } else {\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n return {\n loaderData,\n errors\n };\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n let mergedLoaderData = _extends({}, newLoaderData);\n for (let match of matches) {\n let id = match.route.id;\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n }\n } else if (loaderData[id] !== undefined && match.route.loader) {\n // Preserve existing keys not included in newLoaderData and where a loader\n // wasn't removed by HMR\n mergedLoaderData[id] = loaderData[id];\n }\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n return mergedLoaderData;\n}\nfunction getActionDataForCommit(pendingActionResult) {\n if (!pendingActionResult) {\n return {};\n }\n return isErrorResult(pendingActionResult[1]) ? {\n // Clear out prior actionData on errors\n actionData: {}\n } : {\n actionData: {\n [pendingActionResult[0]]: pendingActionResult[1].data\n }\n };\n}\n// Find the nearest error boundary, looking upwards from the leaf route (or the\n// route specified by routeId) for the closest ancestor error boundary,\n// defaulting to the root match\nfunction findNearestBoundary(matches, routeId) {\n let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches];\n return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = routes.length === 1 ? routes[0] : routes.find(r => r.index || !r.path || r.path === \"/\") || {\n id: \"__shim-error-route__\"\n };\n return {\n matches: [{\n params: {},\n pathname: \"\",\n pathnameBase: \"\",\n route\n }],\n route\n };\n}\nfunction getInternalRouterError(status, _temp5) {\n let {\n pathname,\n routeId,\n method,\n type,\n message\n } = _temp5 === void 0 ? {} : _temp5;\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n if (status === 400) {\n statusText = \"Bad Request\";\n if (type === \"route-discovery\") {\n errorMessage = \"Unable to match URL \\\"\" + pathname + \"\\\" - the `unstable_patchRoutesOnNavigation()` \" + (\"function threw the following error:\\n\" + message);\n } else if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide a `loader` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (type === \"defer-action\") {\n errorMessage = \"defer() is not supported in actions\";\n } else if (type === \"invalid-body\") {\n errorMessage = \"Unable to encode submission body\";\n }\n } else if (status === 403) {\n statusText = \"Forbidden\";\n errorMessage = \"Route \\\"\" + routeId + \"\\\" does not match URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 404) {\n statusText = \"Not Found\";\n errorMessage = \"No route matches URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 405) {\n statusText = \"Method Not Allowed\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method.toUpperCase() + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide an `action` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (method) {\n errorMessage = \"Invalid request method \\\"\" + method.toUpperCase() + \"\\\"\";\n }\n }\n return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);\n}\n// Find any returned redirect errors, starting from the lowest match\nfunction findRedirect(results) {\n for (let i = results.length - 1; i >= 0; i--) {\n let result = results[i];\n if (isRedirectResult(result)) {\n return {\n result,\n idx: i\n };\n }\n }\n}\nfunction stripHashFromPath(path) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath(_extends({}, parsedPath, {\n hash: \"\"\n }));\n}\nfunction isHashChangeOnly(a, b) {\n if (a.pathname !== b.pathname || a.search !== b.search) {\n return false;\n }\n if (a.hash === \"\") {\n // /page -> /page#hash\n return b.hash !== \"\";\n } else if (a.hash === b.hash) {\n // /page#hash -> /page#hash\n return true;\n } else if (b.hash !== \"\") {\n // /page#hash -> /page#other\n return true;\n }\n // If the hash is removed the browser will re-perform a request to the server\n // /page#hash -> /page\n return false;\n}\nfunction isPromise(val) {\n return typeof val === \"object\" && val != null && \"then\" in val;\n}\nfunction isHandlerResult(result) {\n return result != null && typeof result === \"object\" && \"type\" in result && \"result\" in result && (result.type === ResultType.data || result.type === ResultType.error);\n}\nfunction isRedirectHandlerResult(result) {\n return isResponse(result.result) && redirectStatusCodes.has(result.result.status);\n}\nfunction isDeferredResult(result) {\n return result.type === ResultType.deferred;\n}\nfunction isErrorResult(result) {\n return result.type === ResultType.error;\n}\nfunction isRedirectResult(result) {\n return (result && result.type) === ResultType.redirect;\n}\nfunction isDataWithResponseInit(value) {\n return typeof value === \"object\" && value != null && \"type\" in value && \"data\" in value && \"init\" in value && value.type === \"DataWithResponseInit\";\n}\nfunction isDeferredData(value) {\n let deferred = value;\n return deferred && typeof deferred === \"object\" && typeof deferred.data === \"object\" && typeof deferred.subscribe === \"function\" && typeof deferred.cancel === \"function\" && typeof deferred.resolveData === \"function\";\n}\nfunction isResponse(value) {\n return value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectResponse(result) {\n if (!isResponse(result)) {\n return false;\n }\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\nfunction isValidMethod(method) {\n return validRequestMethods.has(method.toLowerCase());\n}\nfunction isMutationMethod(method) {\n return validMutationMethods.has(method.toLowerCase());\n}\nasync function resolveDeferredResults(currentMatches, matchesToLoad, results, signals, isFetcher, currentLoaderData) {\n for (let index = 0; index < results.length; index++) {\n let result = results[index];\n let match = matchesToLoad[index];\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n let currentMatch = currentMatches.find(m => m.route.id === match.route.id);\n let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined;\n if (isDeferredResult(result) && (isFetcher || isRevalidatingLoader)) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n let signal = signals[index];\n invariant(signal, \"Expected an AbortSignal for revalidating fetcher deferred result\");\n await resolveDeferredData(result, signal, isFetcher).then(result => {\n if (result) {\n results[index] = result || results[index];\n }\n });\n }\n }\n}\nasync function resolveDeferredData(result, signal, unwrap) {\n if (unwrap === void 0) {\n unwrap = false;\n }\n let aborted = await result.deferredData.resolveData(signal);\n if (aborted) {\n return;\n }\n if (unwrap) {\n try {\n return {\n type: ResultType.data,\n data: result.deferredData.unwrappedData\n };\n } catch (e) {\n // Handle any TrackedPromise._error values encountered while unwrapping\n return {\n type: ResultType.error,\n error: e\n };\n }\n }\n return {\n type: ResultType.data,\n data: result.deferredData.data\n };\n}\nfunction hasNakedIndexQuery(search) {\n return new URLSearchParams(search).getAll(\"index\").some(v => v === \"\");\n}\nfunction getTargetMatch(matches, location) {\n let search = typeof location === \"string\" ? parsePath(location).search : location.search;\n if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) {\n // Return the leaf index route when index is present\n return matches[matches.length - 1];\n }\n // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n}\nfunction getSubmissionFromNavigation(navigation) {\n let {\n formMethod,\n formAction,\n formEncType,\n text,\n formData,\n json\n } = navigation;\n if (!formMethod || !formAction || !formEncType) {\n return;\n }\n if (text != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json: undefined,\n text\n };\n } else if (formData != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData,\n json: undefined,\n text: undefined\n };\n } else if (json !== undefined) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json,\n text: undefined\n };\n }\n}\nfunction getLoadingNavigation(location, submission) {\n if (submission) {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n } else {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n };\n return navigation;\n }\n}\nfunction getSubmittingNavigation(location, submission) {\n let navigation = {\n state: \"submitting\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n}\nfunction getLoadingFetcher(submission, data) {\n if (submission) {\n let fetcher = {\n state: \"loading\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data\n };\n return fetcher;\n } else {\n let fetcher = {\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n }\n}\nfunction getSubmittingFetcher(submission, existingFetcher) {\n let fetcher = {\n state: \"submitting\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data: existingFetcher ? existingFetcher.data : undefined\n };\n return fetcher;\n}\nfunction getDoneFetcher(data) {\n let fetcher = {\n state: \"idle\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n}\nfunction restoreAppliedTransitions(_window, transitions) {\n try {\n let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);\n if (sessionPositions) {\n let json = JSON.parse(sessionPositions);\n for (let [k, v] of Object.entries(json || {})) {\n if (v && Array.isArray(v)) {\n transitions.set(k, new Set(v || []));\n }\n }\n }\n } catch (e) {\n // no-op, use default empty object\n }\n}\nfunction persistAppliedTransitions(_window, transitions) {\n if (transitions.size > 0) {\n let json = {};\n for (let [k, v] of transitions) {\n json[k] = [...v];\n }\n try {\n _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json));\n } catch (error) {\n warning(false, \"Failed to save applied view transitions in sessionStorage (\" + error + \").\");\n }\n }\n}\n//#endregion\n\nexport { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, decodePath as UNSAFE_decodePath, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, isDataWithResponseInit, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, replace, resolvePath, resolveTo, stripBasename, data as unstable_data };\n//# sourceMappingURL=router.js.map\n","/**\n * React Router v6.26.1\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_decodePath, UNSAFE_getResolveToMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, UNSAFE_convertRouteMatchToUiMatch, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';\nexport { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, resolvePath } from '@remix-run/router';\n\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n// Create react-specific types from the agnostic types in @remix-run/router to\n// export from react-router\nconst DataRouterContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterContext.displayName = \"DataRouter\";\n}\nconst DataRouterStateContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\nconst AwaitContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n AwaitContext.displayName = \"Await\";\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level `` API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\n\nconst NavigationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\nconst LocationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\nconst RouteContext = /*#__PURE__*/React.createContext({\n outlet: null,\n matches: [],\n isDataRoute: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\nconst RouteErrorContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n RouteErrorContext.displayName = \"RouteError\";\n}\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/hooks/use-href\n */\nfunction useHref(to, _temp) {\n let {\n relative\n } = _temp === void 0 ? {} : _temp;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useHref() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to, {\n relative\n });\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n return navigator.createHref({\n pathname: joinedPathname,\n search,\n hash\n });\n}\n\n/**\n * Returns true if this component is a descendant of a ``.\n *\n * @see https://reactrouter.com/hooks/use-in-router-context\n */\nfunction useInRouterContext() {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/hooks/use-location\n */\nfunction useLocation() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useLocation() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/hooks/use-navigation-type\n */\nfunction useNavigationType() {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * ``.\n *\n * @see https://reactrouter.com/hooks/use-match\n */\nfunction useMatch(pattern) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useMatch() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n pathname\n } = useLocation();\n return React.useMemo(() => matchPath(pattern, UNSAFE_decodePath(pathname)), [pathname, pattern]);\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\n\nconst navigateEffectWarning = \"You should call navigate() in a React.useEffect(), not when \" + \"your component is first rendered.\";\n\n// Mute warnings for calls to useNavigate in SSR environments\nfunction useIsomorphicLayoutEffect(cb) {\n let isStatic = React.useContext(NavigationContext).static;\n if (!isStatic) {\n // We should be able to get rid of this once react 18.3 is released\n // See: https://github.com/facebook/react/pull/26395\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(cb);\n }\n}\n\n/**\n * Returns an imperative method for changing the location. Used by ``s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/hooks/use-navigate\n */\nfunction useNavigate() {\n let {\n isDataRoute\n } = React.useContext(RouteContext);\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isDataRoute ? useNavigateStable() : useNavigateUnstable();\n}\nfunction useNavigateUnstable() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useNavigate() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let dataRouterContext = React.useContext(DataRouterContext);\n let {\n basename,\n future,\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our history listener yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\");\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history (but only if we're not in a data router,\n // otherwise it'll prepend the basename inside of the router).\n // If this is a root navigation, then we navigate to the raw basename\n // which allows the basename to have full control over the presence of a\n // trailing slash on root links\n if (dataRouterContext == null && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/hooks/use-outlet-context\n */\nfunction useOutletContext() {\n return React.useContext(OutletContext);\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by `` to render child routes.\n *\n * @see https://reactrouter.com/hooks/use-outlet\n */\nfunction useOutlet(context) {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return /*#__PURE__*/React.createElement(OutletContext.Provider, {\n value: context\n }, outlet);\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/hooks/use-params\n */\nfunction useParams() {\n let {\n matches\n } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? routeMatch.params : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/hooks/use-resolved-path\n */\nfunction useResolvedPath(to, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n future\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [to, routePathnamesJson, locationPathname, relative]);\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an `` to render their child route's\n * element.\n *\n * @see https://reactrouter.com/hooks/use-routes\n */\nfunction useRoutes(routes, locationArg) {\n return useRoutesImpl(routes, locationArg);\n}\n\n// Internal implementation with accept optional param for RouterProvider usage\nfunction useRoutesImpl(routes, locationArg, dataRouterState, future) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useRoutes() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches: parentMatches\n } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n if (process.env.NODE_ENV !== \"production\") {\n // You won't get a warning about 2 different under a \n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // \n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // } />\n // } />\n // \n //\n // function Blog() {\n // return (\n // \n // } />\n // \n // );\n // }\n let parentPath = parentRoute && parentRoute.path || \"\";\n warningOnce(parentPathname, !parentRoute || parentPath.endsWith(\"*\"), \"You rendered descendant (or called `useRoutes()`) at \" + (\"\\\"\" + parentPathname + \"\\\" (under ) but the \") + \"parent route path has no trailing \\\"*\\\". This means if you navigate \" + \"deeper, the parent won't match anymore and therefore the child \" + \"routes will never render.\\n\\n\" + (\"Please change the parent to .\"));\n }\n let locationFromContext = useLocation();\n let location;\n if (locationArg) {\n var _parsedLocationArg$pa;\n let parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n !(parentPathnameBase === \"/\" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"When overriding the location using `` or `useRoutes(routes, location)`, \" + \"the location pathname must begin with the portion of the URL pathname that was \" + (\"matched by all parent routes. The current pathname base is \\\"\" + parentPathnameBase + \"\\\" \") + (\"but pathname \\\"\" + parsedLocationArg.pathname + \"\\\" was given in the `location` prop.\")) : UNSAFE_invariant(false) : void 0;\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n let pathname = location.pathname || \"/\";\n let remainingPathname = pathname;\n if (parentPathnameBase !== \"/\") {\n // Determine the remaining pathname by removing the # of URL segments the\n // parentPathnameBase has, instead of removing based on character count.\n // This is because we can't guarantee that incoming/outgoing encodings/\n // decodings will match exactly.\n // We decode paths before matching on a per-segment basis with\n // decodeURIComponent(), but we re-encode pathnames via `new URL()` so they\n // match what `window.location.pathname` would reflect. Those don't 100%\n // align when it comes to encoded URI characters such as % and &.\n //\n // So we may end up with:\n // pathname: \"/descendant/a%25b/match\"\n // parentPathnameBase: \"/descendant/a%b\"\n //\n // And the direct substring removal approach won't work :/\n let parentSegments = parentPathnameBase.replace(/^\\//, \"\").split(\"/\");\n let segments = pathname.replace(/^\\//, \"\").split(\"/\");\n remainingPathname = \"/\" + segments.slice(parentSegments.length).join(\"/\");\n }\n let matches = matchRoutes(routes, {\n pathname: remainingPathname\n });\n if (process.env.NODE_ENV !== \"production\") {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(parentRoute || matches != null, \"No routes matched location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \") : void 0;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, \"Matched leaf route at location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \" + \"does not have an element or Component. This means it will render an with a \" + \"null value by default resulting in an \\\"empty\\\" page.\") : void 0;\n }\n let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])\n })), parentMatches, dataRouterState, future);\n\n // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n if (locationArg && renderedMatches) {\n return /*#__PURE__*/React.createElement(LocationContext.Provider, {\n value: {\n location: _extends({\n pathname: \"/\",\n search: \"\",\n hash: \"\",\n state: null,\n key: \"default\"\n }, location),\n navigationType: Action.Pop\n }\n }, renderedMatches);\n }\n return renderedMatches;\n}\nfunction DefaultErrorComponent() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error) ? error.status + \" \" + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = {\n padding: \"0.5rem\",\n backgroundColor: lightgrey\n };\n let codeStyles = {\n padding: \"2px 4px\",\n backgroundColor: lightgrey\n };\n let devInfo = null;\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Error handled by React Router default ErrorBoundary:\", error);\n devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", null, \"\\uD83D\\uDCBF Hey developer \\uD83D\\uDC4B\"), /*#__PURE__*/React.createElement(\"p\", null, \"You can provide a way better UX than this when your app throws errors by providing your own \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"ErrorBoundary\"), \" or\", \" \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"errorElement\"), \" prop on your route.\"));\n }\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"h2\", null, \"Unexpected Application Error!\"), /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n fontStyle: \"italic\"\n }\n }, message), stack ? /*#__PURE__*/React.createElement(\"pre\", {\n style: preStyles\n }, stack) : null, devInfo);\n}\nconst defaultErrorElement = /*#__PURE__*/React.createElement(DefaultErrorComponent, null);\nclass RenderErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n location: props.location,\n revalidation: props.revalidation,\n error: props.error\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error: error\n };\n }\n static getDerivedStateFromProps(props, state) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location || state.revalidation !== \"idle\" && props.revalidation === \"idle\") {\n return {\n error: props.error,\n location: props.location,\n revalidation: props.revalidation\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error !== undefined ? props.error : state.error,\n location: state.location,\n revalidation: props.revalidation || state.revalidation\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"React Router caught the following error during render\", error, errorInfo);\n }\n render() {\n return this.state.error !== undefined ? /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: this.props.routeContext\n }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {\n value: this.state.error,\n children: this.props.component\n })) : this.props.children;\n }\n}\nfunction RenderedRoute(_ref) {\n let {\n routeContext,\n match,\n children\n } = _ref;\n let dataRouterContext = React.useContext(DataRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n return /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: routeContext\n }, children);\n}\nfunction _renderMatches(matches, parentMatches, dataRouterState, future) {\n var _dataRouterState;\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n if (dataRouterState === void 0) {\n dataRouterState = null;\n }\n if (future === void 0) {\n future = null;\n }\n if (matches == null) {\n var _future;\n if (!dataRouterState) {\n return null;\n }\n if (dataRouterState.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else if ((_future = future) != null && _future.v7_partialHydration && parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {\n // Don't bail if we're initializing with partial hydration and we have\n // router matches. That means we're actively running `patchRoutesOnNavigation`\n // so we should render down the partial matches to the appropriate\n // `HydrateFallback`. We only do this if `parentMatches` is empty so it\n // only impacts the root matches for `RouterProvider` and no descendant\n // ``\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = (_dataRouterState = dataRouterState) == null ? void 0 : _dataRouterState.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== undefined);\n !(errorIndex >= 0) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"Could not find a matching route for errors on route IDs: \" + Object.keys(errors).join(\",\")) : UNSAFE_invariant(false) : void 0;\n renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n }\n\n // If we're in a partial hydration mode, detect if we need to render down to\n // a given HydrateFallback while we load the rest of the hydration data\n let renderFallback = false;\n let fallbackIndex = -1;\n if (dataRouterState && future && future.v7_partialHydration) {\n for (let i = 0; i < renderedMatches.length; i++) {\n let match = renderedMatches[i];\n // Track the deepest fallback up until the first route without data\n if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {\n fallbackIndex = i;\n }\n if (match.route.id) {\n let {\n loaderData,\n errors\n } = dataRouterState;\n let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);\n if (match.route.lazy || needsToRunLoader) {\n // We found the first route that's not ready to render (waiting on\n // lazy, or has a loader that hasn't run yet). Flag that we need to\n // render a fallback and render up until the appropriate fallback\n renderFallback = true;\n if (fallbackIndex >= 0) {\n renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);\n } else {\n renderedMatches = [renderedMatches[0]];\n }\n break;\n }\n }\n }\n }\n return renderedMatches.reduceRight((outlet, match, index) => {\n // Only data routers handle errors/fallbacks\n let error;\n let shouldRenderHydrateFallback = false;\n let errorElement = null;\n let hydrateFallbackElement = null;\n if (dataRouterState) {\n error = errors && match.route.id ? errors[match.route.id] : undefined;\n errorElement = match.route.errorElement || defaultErrorElement;\n if (renderFallback) {\n if (fallbackIndex < 0 && index === 0) {\n warningOnce(\"route-fallback\", false, \"No `HydrateFallback` element provided to render during initial hydration\");\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = null;\n } else if (fallbackIndex === index) {\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = match.route.hydrateFallbackElement || null;\n }\n }\n }\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n let getChildren = () => {\n let children;\n if (error) {\n children = errorElement;\n } else if (shouldRenderHydrateFallback) {\n children = hydrateFallbackElement;\n } else if (match.route.Component) {\n // Note: This is a de-optimized path since React won't re-use the\n // ReactElement since it's identity changes with each new\n // React.createElement call. We keep this so folks can use\n // `` in `` but generally `Component`\n // usage is only advised in `RouterProvider` when we can convert it to\n // `element` ahead of time.\n children = /*#__PURE__*/React.createElement(match.route.Component, null);\n } else if (match.route.element) {\n children = match.route.element;\n } else {\n children = outlet;\n }\n return /*#__PURE__*/React.createElement(RenderedRoute, {\n match: match,\n routeContext: {\n outlet,\n matches,\n isDataRoute: dataRouterState != null\n },\n children: children\n });\n };\n // Only wrap in an error boundary within data router usages when we have an\n // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to\n // an ancestor ErrorBoundary/errorElement\n return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {\n location: dataRouterState.location,\n revalidation: dataRouterState.revalidation,\n component: errorElement,\n error: error,\n children: getChildren(),\n routeContext: {\n outlet: null,\n matches,\n isDataRoute: true\n }\n }) : getChildren();\n }, null);\n}\nvar DataRouterHook = /*#__PURE__*/function (DataRouterHook) {\n DataRouterHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterHook[\"UseNavigateStable\"] = \"useNavigate\";\n return DataRouterHook;\n}(DataRouterHook || {});\nvar DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {\n DataRouterStateHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterStateHook[\"UseLoaderData\"] = \"useLoaderData\";\n DataRouterStateHook[\"UseActionData\"] = \"useActionData\";\n DataRouterStateHook[\"UseRouteError\"] = \"useRouteError\";\n DataRouterStateHook[\"UseNavigation\"] = \"useNavigation\";\n DataRouterStateHook[\"UseRouteLoaderData\"] = \"useRouteLoaderData\";\n DataRouterStateHook[\"UseMatches\"] = \"useMatches\";\n DataRouterStateHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterStateHook[\"UseNavigateStable\"] = \"useNavigate\";\n DataRouterStateHook[\"UseRouteId\"] = \"useRouteId\";\n return DataRouterStateHook;\n}(DataRouterStateHook || {});\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\nfunction useRouteContext(hookName) {\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return route;\n}\n\n// Internal version with hookName-aware debugging\nfunction useCurrentRouteId(hookName) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n !thisRoute.route.id ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, hookName + \" can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n return thisRoute.route.id;\n}\n\n/**\n * Returns the ID for the nearest contextual route\n */\nfunction useRouteId() {\n return useCurrentRouteId(DataRouterStateHook.UseRouteId);\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nfunction useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nfunction useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return React.useMemo(() => ({\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation\n }), [dataRouterContext.router.revalidate, state.revalidation]);\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nfunction useMatches() {\n let {\n matches,\n loaderData\n } = useDataRouterState(DataRouterStateHook.UseMatches);\n return React.useMemo(() => matches.map(m => UNSAFE_convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nfunction useLoaderData() {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n if (state.errors && state.errors[routeId] != null) {\n console.error(\"You cannot `useLoaderData` in an errorElement (routeId: \" + routeId + \")\");\n return undefined;\n }\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nfunction useRouteLoaderData(routeId) {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nfunction useActionData() {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n return state.actionData ? state.actionData[routeId] : undefined;\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * ErrorBoundary/errorElement to display a proper error message.\n */\nfunction useRouteError() {\n var _state$errors;\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error !== undefined) {\n return error;\n }\n\n // Otherwise look for errors from our data router state\n return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor `` value\n */\nfunction useAsyncValue() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._data;\n}\n\n/**\n * Returns the error from the nearest ancestor `` value\n */\nfunction useAsyncError() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._error;\n}\nlet blockerId = 0;\n\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\nfunction useBlocker(shouldBlock) {\n let {\n router,\n basename\n } = useDataRouterContext(DataRouterHook.UseBlocker);\n let state = useDataRouterState(DataRouterStateHook.UseBlocker);\n let [blockerKey, setBlockerKey] = React.useState(\"\");\n let blockerFunction = React.useCallback(arg => {\n if (typeof shouldBlock !== \"function\") {\n return !!shouldBlock;\n }\n if (basename === \"/\") {\n return shouldBlock(arg);\n }\n\n // If they provided us a function and we've got an active basename, strip\n // it from the locations we expose to the user to match the behavior of\n // useLocation\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = arg;\n return shouldBlock({\n currentLocation: _extends({}, currentLocation, {\n pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname\n }),\n nextLocation: _extends({}, nextLocation, {\n pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname\n }),\n historyAction\n });\n }, [basename, shouldBlock]);\n\n // This effect is in charge of blocker key assignment and deletion (which is\n // tightly coupled to the key)\n React.useEffect(() => {\n let key = String(++blockerId);\n setBlockerKey(key);\n return () => router.deleteBlocker(key);\n }, [router]);\n\n // This effect handles assigning the blockerFunction. This is to handle\n // unstable blocker function identities, and happens only after the prior\n // effect so we don't get an orphaned blockerFunction in the router with a\n // key of \"\". Until then we just have the IDLE_BLOCKER.\n React.useEffect(() => {\n if (blockerKey !== \"\") {\n router.getBlocker(blockerKey, blockerFunction);\n }\n }, [router, blockerKey, blockerFunction]);\n\n // Prefer the blocker from `state` not `router.state` since DataRouterContext\n // is memoized so this ensures we update on blocker state updates\n return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;\n}\n\n/**\n * Stable version of useNavigate that is used when we are in the context of\n * a RouterProvider.\n */\nfunction useNavigateStable() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseNavigateStable);\n let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our router subscriber yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n router.navigate(to);\n } else {\n router.navigate(to, _extends({\n fromRouteId: id\n }, options));\n }\n }, [router, id]);\n return navigate;\n}\nconst alreadyWarned = {};\nfunction warningOnce(key, cond, message) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, message) : void 0;\n }\n}\n\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n let [state, setStateImpl] = React.useState(router.state);\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n if (v7_startTransition && startTransitionImpl) {\n startTransitionImpl(() => setStateImpl(newState));\n } else {\n setStateImpl(newState);\n }\n }, [setStateImpl, v7_startTransition]);\n\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/)\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n React.useEffect(() => {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, \"`` is deprecated when using \" + \"`v7_partialHydration`, use a `HydrateFallback` component instead\") : void 0;\n // Only log this once on initial mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a