@sbb-esta/lyne-elements-experimental-dev 5.4.0-dev.1785707719 → 5.4.0-dev.1785757652

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,4 +9,4 @@ import{miniButtonStyle as e}from"@sbb-esta/lyne-elements/button.pure.js";import{
9
9
  <span class="sbb-autocomplete-grid-row">
10
10
  <slot></slot>
11
11
  </span>
12
- `}};let k=0;const A=c;var j=class extends _{constructor(){super(...arguments),this.overlayId=`sbb-autocomplete-grid-${++k}`,this.panelRole=`grid`,this._activeColumnIndex=0}static{this.elementName=`sbb-autocomplete-grid`}static{this.role=A?`grid`:null}get options(){return Array.from(this.querySelectorAll?.(`sbb-autocomplete-grid-option`)??[])}syncNegative(){this.querySelectorAll?.(`sbb-divider, sbb-autocomplete-grid-button, sbb-option-hint`).forEach(e=>e.negative=this.negative),this.querySelectorAll?.(`sbb-autocomplete-grid-row, sbb-autocomplete-grid-option, sbb-autocomplete-grid-optgroup`).forEach(e=>u(e).toggle(`negative`,this.negative))}openedPanelKeyboardInteraction(e){if(this.isOpen)switch(e.key){case`Enter`:this.selectByKeyboard(e);break;case`ArrowDown`:case`ArrowUp`:this.setNextActiveOption(e);break;case`ArrowRight`:case`ArrowLeft`:this._setNextHorizontalActiveElement(e);break}}selectByKeyboard(e){this.activeOption&&(e.preventDefault(),this._activeColumnIndex===0?this.activeOption.selectViaUserInteraction(!0):this.activeOption.closest(`sbb-autocomplete-grid-row`)?.querySelectorAll(`sbb-autocomplete-grid-button`)[this._activeColumnIndex-1]?.click())}setNextActiveOption(e){let t=this.options.filter(e=>!e.matches(`:is(:state(disabled),[state--disabled])`));if(this.activeOption?.setActive(!1),this.triggerElement.ariaActiveDescendantElement=null,Array.from(this.querySelectorAll?.(`sbb-autocomplete-grid-row :is(:state(focus-visible),[state--focus-visible])`)??[]).forEach(e=>u(e).delete(`focus-visible`)),this._activeColumnIndex=0,!t.length){this.activeOption=null;return}let n=o(e,this.activeOption?t.indexOf(this.activeOption):-1,t.length);this.activeOption=t[n],this.activeOption.setActive(!0),this.triggerElement.ariaActiveDescendantElement=this.activeOption,this.activeOption.scrollIntoView({block:`nearest`}),e&&e.preventDefault(),this.autoSelectActiveOption&&e&&this.setPendingSelection(this.activeOption)}_setNextHorizontalActiveElement(e){if(!this.activeOption)return;let t=Array.from(this.activeOption?.closest(`sbb-autocomplete-grid-row`)?.querySelectorAll(`sbb-autocomplete-grid-option, sbb-autocomplete-grid-button`)??[])?.filter(e=>!e.matches(`:is(:state(disabled),[state--disabled])`));if(!t.length)return;let n=o(e,this._activeColumnIndex,t.length),r=t[n];r instanceof T?r.setActive(!0):u(r).add(`focus-visible`);let i=t[this._activeColumnIndex];i instanceof T?i.setActive(!1):u(i).delete(`focus-visible`),this.triggerElement.ariaActiveDescendantElement=r,r.scrollIntoView({block:`nearest`}),this._activeColumnIndex=n}resetActiveElement(){this._activeColumnIndex!==0&&this.activeOption?.closest(`sbb-autocomplete-grid-row`)?.querySelectorAll(`sbb-autocomplete-grid-button`).forEach(e=>u(e).delete(`focus-visible`)),this.activeOption?.setActive(!1),this.activeOption=null,this._activeColumnIndex=0,this.triggerElement&&(this.triggerElement.ariaActiveDescendantElement=null)}setTriggerAttributes(e){l(e,A?this.id:this.overlayId,!1,`grid`)}};export{y as SbbAutocompleteGridButtonElement,x as SbbAutocompleteGridCellElement,j as SbbAutocompleteGridElement,S as SbbAutocompleteGridOptgroupElement,T as SbbAutocompleteGridOptionElement,O as SbbAutocompleteGridRowElement,w as autocompleteGridOptionId};
12
+ `}};let k=0;const A=c;var j=class extends _{constructor(){super(...arguments),this.overlayId=`sbb-autocomplete-grid-${++k}`,this.panelRole=`grid`,this._activeColumnIndex=0}static{this.elementName=`sbb-autocomplete-grid`}static{this.role=A?`grid`:null}get options(){return Array.from(this.querySelectorAll?.(`sbb-autocomplete-grid-option`)??[])}syncNegative(){this.querySelectorAll?.(`sbb-divider, sbb-autocomplete-grid-button, sbb-option-hint`).forEach(e=>e.negative=this.negative),this.querySelectorAll?.(`sbb-autocomplete-grid-row, sbb-autocomplete-grid-option, sbb-autocomplete-grid-optgroup`).forEach(e=>u(e).toggle(`negative`,this.negative))}openedPanelKeyboardInteraction(e){if(this.isOpen)switch(e.key){case`Enter`:this.selectByKeyboard(e);break;case`ArrowDown`:case`ArrowUp`:this.setNextActiveOption(e);break;case`ArrowRight`:case`ArrowLeft`:this._setNextHorizontalActiveElement(e)}}selectByKeyboard(e){this.activeOption&&(e.preventDefault(),this._activeColumnIndex===0?this.activeOption.selectViaUserInteraction(!0):this.activeOption.closest(`sbb-autocomplete-grid-row`)?.querySelectorAll(`sbb-autocomplete-grid-button`)[this._activeColumnIndex-1]?.click())}setNextActiveOption(e){let t=this.options.filter(e=>!e.matches(`:is(:state(disabled),[state--disabled])`));if(this.activeOption?.setActive(!1),this.triggerElement.ariaActiveDescendantElement=null,Array.from(this.querySelectorAll?.(`sbb-autocomplete-grid-row :is(:state(focus-visible),[state--focus-visible])`)??[]).forEach(e=>u(e).delete(`focus-visible`)),this._activeColumnIndex=0,!t.length){this.activeOption=null;return}let n=this.activeOption?t.indexOf(this.activeOption):-1,r=o(e,n,t.length);this.activeOption=t[r],this.activeOption.setActive(!0),this.triggerElement.ariaActiveDescendantElement=this.activeOption,this.activeOption.scrollIntoView({block:`nearest`}),e&&e.preventDefault(),this.autoSelectActiveOption&&e&&this.setPendingSelection(this.activeOption)}_setNextHorizontalActiveElement(e){if(!this.activeOption)return;let t=Array.from(this.activeOption?.closest(`sbb-autocomplete-grid-row`)?.querySelectorAll(`sbb-autocomplete-grid-option, sbb-autocomplete-grid-button`)??[])?.filter(e=>!e.matches(`:is(:state(disabled),[state--disabled])`));if(!t.length)return;let n=o(e,this._activeColumnIndex,t.length),r=t[n];r instanceof T?r.setActive(!0):u(r).add(`focus-visible`);let i=t[this._activeColumnIndex];i instanceof T?i.setActive(!1):u(i).delete(`focus-visible`),this.triggerElement.ariaActiveDescendantElement=r,r.scrollIntoView({block:`nearest`}),this._activeColumnIndex=n}resetActiveElement(){this._activeColumnIndex!==0&&this.activeOption?.closest(`sbb-autocomplete-grid-row`)?.querySelectorAll(`sbb-autocomplete-grid-button`).forEach(e=>u(e).delete(`focus-visible`)),this.activeOption?.setActive(!1),this.activeOption=null,this._activeColumnIndex=0,this.triggerElement&&(this.triggerElement.ariaActiveDescendantElement=null)}setTriggerAttributes(e){l(e,A?this.id:this.overlayId,!1,`grid`)}};export{y as SbbAutocompleteGridButtonElement,x as SbbAutocompleteGridCellElement,j as SbbAutocompleteGridElement,S as SbbAutocompleteGridOptgroupElement,T as SbbAutocompleteGridOptionElement,O as SbbAutocompleteGridRowElement,w as autocompleteGridOptionId};
package/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import{i18nDurationDay as e,i18nDurationHour as t,i18nDurationMinute as n,i18nWalkingDistanceArrival as r,i18nWalkingDistanceDeparture as i}from"@sbb-esta/lyne-elements/core.js";import{html as a,nothing as o}from"lit";import"@sbb-esta/lyne-elements/icon.pure.js";const s=6e4,c=36e5,l=Symbol.for(`constructDateFrom`);function u(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&l in e?e[l](t):e instanceof Date?new e.constructor(t):new Date(t)}function d(e,t){return u(t||e,e)}function f(e,t,n){let r=d(e,n?.in);return isNaN(t)?u(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function p(e,t,n){return u(n?.in||e,+d(e)+t)}function m(e,t,n){return p(e,t*c,n)}function h(e){let t=d(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function g(e,...t){let n=u.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function _(e,t){let n=d(e,t?.in);return n.setHours(0,0,0,0),n}function v(e,t,n){let[r,i]=g(n?.in,e,t),a=_(r),o=_(i),s=+a-h(a),c=+o-h(o);return Math.round((s-c)/864e5)}function y(e,t,n){let r=d(e,n?.in);return r.setTime(r.getTime()+t*s),r}function b(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function x(e){return!(!b(e)&&typeof e!=`number`||isNaN(+d(e)))}function S(e,t,n){let[r,i]=g(n?.in,e,t),a=C(r,i),o=Math.abs(v(r,i));r.setDate(r.getDate()-a*o);let s=a*(o-Number(C(r,i)===-a));return s===0?0:s}function C(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function w(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function T(e,t,n){let[r,i]=g(n?.in,e,t),a=(r-+i)/c;return w(n?.roundingMethod)(a)}function E(e,t){return d(e)-+d(t)}function D(e,t,n){let r=E(e,t)/s;return w(n?.roundingMethod)(r)}function O(e,t,n){return f(e,-t,n)}function k(e,t){let n=()=>u(t?.in,NaN),r=t?.additionalDigits??2,i=ne(e),a;if(i.date){let e=re(i.date,r);a=M(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=P(i.time),isNaN(s)))return n();if(i.timezone){if(c=I(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=d(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return d(o+s+c,t?.in)}const A={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},j=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ee=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,te=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ne(e){let t={},n=e.split(A.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],A.timeZoneDelimiter.test(t.date)&&(t.date=e.split(A.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=A.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function re(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function M(e,t){if(t===null)return new Date(NaN);let n=e.match(j);if(!n)return new Date(NaN);let r=!!n[4],i=N(n[1]),a=N(n[2])-1,o=N(n[3]),s=N(n[4]),c=N(n[5])-1;if(r)return H(t,s,c)?L(t,s,c):new Date(NaN);{let e=new Date(0);return!B(t,a,o)||!V(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function N(e){return e?parseInt(e):1}function P(e){let t=e.match(ee);if(!t)return NaN;let n=F(t[1]),r=F(t[2]),i=F(t[3]);return U(n,r,i)?n*c+r*s+i*1e3:NaN}function F(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function I(e){if(e===`Z`)return 0;let t=e.match(te);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return W(r,i)?n*(r*c+i*s):NaN}function L(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}const R=[31,null,31,30,31,30,31,31,30,31,30,31];function z(e){return e%400==0||e%4==0&&e%100!=0}function B(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(R[t]||(z(e)?29:28))}function V(e,t){return t>=1&&t<=(z(e)?366:365)}function H(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function U(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function W(e,t){return t>=0&&t<=59}function G(e,t,n){return m(e,-t,n)}function K(e){if(e&&x(k(e))){if(e.includes(`Z`))return new Date(e.replace(`Z`,``));if(e.includes(`T`)){let t=e.split(`T`);if(t[1]&&(t[1].includes(`+`)||t[1].includes(`-`)))return new Date(`${t[0]}T${t[1].split(/[+-]/)[0]}`)}return new Date(e)}}const q=(r,i)=>{let a=[],o=[],s=y(0,r),c=S(s,0);c>0&&(a.push(`${c} d`),i&&o.push(`${c} ${c>1?e.multiple.long[i]:e.single.long[i]}`),s=O(s,c));let l=T(s,0);l>0&&(a.push(`${l} h`),i&&o.push(`${l} ${l>1?t.multiple.long[i]:t.single.long[i]}`),s=G(s,l));let u=D(s,0);return u>0&&(a.push(`${u} min`),i&&o.push(`${u} ${u>1?n.multiple.long[i]:n.single.long[i]}`)),{short:a.join(` `),long:o.join(` `)}},J=e=>e?.__typename===`PTRideLeg`,Y=e=>e?.__typename===`PTConnectionLeg`,X=e=>{let t=e?.text?.template&&e.text.template.indexOf(`(`)+1,n=e?.text?.template?.substring(t||0,e?.text?.template.indexOf(`)`));return{duration:n&&+n.substring(0,n.length-1)||0,text:e?.text?.template?.split(`(`)[0]||``}};function Z(e,t){let n=Y(e)?e:null,r=n?n?.notices?.filter(e=>t.includes(e.name))[0]:null;return r?{duration:n?.duration||0,text:r?.text?.template||``,icon:`walk-small`}:null}function ie(e,t,n,r){let a=J(e)?e?.serviceJourney?.notices?.filter(e=>[`CI`].includes(e.name))[0]:null,o=a&&X(a);return a?{duration:(o?.duration||0)+(t||0),text:n?i[r]:o?.text||``,icon:n?`wheelchair-small`:`sa-${a?.name?.toLowerCase()}`}:null}function ae(e,t,n,i){let a=J(e)?e?.serviceJourney?.notices?.filter(e=>[`CO`].includes(e.name))[0]:null,o=a&&X(a);return a?{duration:(o?.duration||0)+(t||0),text:n?r[i]:o?.text||``,icon:n?`wheelchair-small`:`sa-${a?.name?.toLowerCase()}`}:null}function Q(e,t,n,s,c){return a`
1
+ import{i18nDurationDay as e,i18nDurationHour as t,i18nDurationMinute as n,i18nWalkingDistanceArrival as r,i18nWalkingDistanceDeparture as i}from"@sbb-esta/lyne-elements/core.js";import{html as a,nothing as o}from"lit";import"@sbb-esta/lyne-elements/icon.pure.js";const s=6e4,c=36e5,l=Symbol.for(`constructDateFrom`);function u(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&l in e?e[l](t):e instanceof Date?new e.constructor(t):new Date(t)}function d(e,t){return u(t||e,e)}function f(e,t,n){let r=d(e,n?.in);return isNaN(t)?u(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function p(e,t,n){return u(n?.in||e,+d(e)+t)}function m(e,t,n){return p(e,t*c,n)}function h(e){let t=d(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function g(e,...t){let n=u.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function _(e,t){let n=d(e,t?.in);return n.setHours(0,0,0,0),n}function v(e,t,n){let[r,i]=g(n?.in,e,t),a=_(r),o=_(i),s=+a-h(a),c=+o-h(o);return Math.round((s-c)/864e5)}function y(e,t,n){let r=d(e,n?.in);return r.setTime(r.getTime()+t*s),r}function b(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function x(e){return!(!b(e)&&typeof e!=`number`||isNaN(+d(e)))}function S(e,t,n){let[r,i]=g(n?.in,e,t),a=C(r,i),o=Math.abs(v(r,i));r.setDate(r.getDate()-a*o);let s=a*(o-Number(C(r,i)===-a));return s===0?0:s}function C(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function w(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function T(e,t,n){let[r,i]=g(n?.in,e,t),a=(r-+i)/c;return w(n?.roundingMethod)(a)}function E(e,t){return d(e)-+d(t)}function D(e,t,n){let r=E(e,t)/s;return w(n?.roundingMethod)(r)}function O(e,t,n){return f(e,-t,n)}function k(e,t){let n=()=>u(t?.in,NaN),r=t?.additionalDigits??2,i=ne(e),a;if(i.date){let e=re(i.date,r);a=M(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=P(i.time),isNaN(s)))return n();if(i.timezone){if(c=I(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=d(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return d(o+s+c,t?.in)}const A={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},j=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ee=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,te=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ne(e){let t={},n=e.split(A.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],A.timeZoneDelimiter.test(t.date)&&(t.date=e.split(A.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=A.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function re(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function M(e,t){if(t===null)return new Date(NaN);let n=e.match(j);if(!n)return new Date(NaN);let r=!!n[4],i=N(n[1]),a=N(n[2])-1,o=N(n[3]),s=N(n[4]),c=N(n[5])-1;if(r)return H(t,s,c)?L(t,s,c):new Date(NaN);{let e=new Date(0);return!B(t,a,o)||!V(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function N(e){return e?parseInt(e):1}function P(e){let t=e.match(ee);if(!t)return NaN;let n=F(t[1]),r=F(t[2]),i=F(t[3]);return U(n,r,i)?n*c+r*s+i*1e3:NaN}function F(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function I(e){if(e===`Z`)return 0;let t=e.match(te);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return W(r,i)?n*(r*c+i*s):NaN}function L(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}const R=[31,null,31,30,31,30,31,31,30,31,30,31];function z(e){return e%400==0||e%4==0&&e%100!=0}function B(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(R[t]||(z(e)?29:28))}function V(e,t){return t>=1&&t<=(z(e)?366:365)}function H(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function U(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function W(e,t){return t>=0&&t<=59}function G(e,t,n){return m(e,-t,n)}function K(e){if(!(!e||!x(k(e)))){if(e.includes(`Z`))return new Date(e.replace(`Z`,``));if(e.includes(`T`)){let t=e.split(`T`);if(t[1]&&(t[1].includes(`+`)||t[1].includes(`-`)))return new Date(`${t[0]}T${t[1].split(/[+-]/)[0]}`)}return new Date(e)}}const q=(r,i)=>{let a=[],o=[],s=y(0,r),c=S(s,0);c>0&&(a.push(`${c} d`),i&&o.push(`${c} ${c>1?e.multiple.long[i]:e.single.long[i]}`),s=O(s,c));let l=T(s,0);l>0&&(a.push(`${l} h`),i&&o.push(`${l} ${l>1?t.multiple.long[i]:t.single.long[i]}`),s=G(s,l));let u=D(s,0);return u>0&&(a.push(`${u} min`),i&&o.push(`${u} ${u>1?n.multiple.long[i]:n.single.long[i]}`)),{short:a.join(` `),long:o.join(` `)}},J=e=>e?.__typename===`PTRideLeg`,Y=e=>e?.__typename===`PTConnectionLeg`,X=e=>{let t=e?.text?.template&&e.text.template.indexOf(`(`)+1,n=e?.text?.template?.substring(t||0,e?.text?.template.indexOf(`)`));return{duration:n&&+n.substring(0,n.length-1)||0,text:e?.text?.template?.split(`(`)[0]||``}};function Z(e,t){let n=Y(e)?e:null,r=n?n?.notices?.filter(e=>t.includes(e.name))[0]:null;return r?{duration:n?.duration||0,text:r?.text?.template||``,icon:`walk-small`}:null}function ie(e,t,n,r){let a=J(e)?e?.serviceJourney?.notices?.filter(e=>[`CI`].includes(e.name))[0]:null,o=a&&X(a);return a?{duration:(o?.duration||0)+(t||0),text:n?i[r]:o?.text||``,icon:n?`wheelchair-small`:`sa-${a?.name?.toLowerCase()}`}:null}function ae(e,t,n,i){let a=J(e)?e?.serviceJourney?.notices?.filter(e=>[`CO`].includes(e.name))[0]:null,o=a&&X(a);return a?{duration:(o?.duration||0)+(t||0),text:n?r[i]:o?.text||``,icon:n?`wheelchair-small`:`sa-${a?.name?.toLowerCase()}`}:null}function Q(e,t,n,s,c){return a`
2
2
  <span class="sbb-pearl-chain__time-transfer sbb-pearl-chain__time-transfer--${t}-${c}">
3
3
  <sbb-icon name=${t}></sbb-icon>
4
4
  <time datetime=${e+`M`}>
@@ -260,9 +260,7 @@ var SbbAutocompleteGridElement = class extends SbbAutocompleteBaseElement {
260
260
  this.setNextActiveOption(event);
261
261
  break;
262
262
  case "ArrowRight":
263
- case "ArrowLeft":
264
- this._setNextHorizontalActiveElement(event);
265
- break;
263
+ case "ArrowLeft": this._setNextHorizontalActiveElement(event);
266
264
  }
267
265
  }
268
266
  /**
@@ -289,7 +287,8 @@ var SbbAutocompleteGridElement = class extends SbbAutocompleteBaseElement {
289
287
  this.activeOption = null;
290
288
  return;
291
289
  }
292
- const next = getNextElementIndex(event, this.activeOption ? enabledOptions.indexOf(this.activeOption) : -1, enabledOptions.length);
290
+ const activeItemIndex = this.activeOption ? enabledOptions.indexOf(this.activeOption) : -1;
291
+ const next = getNextElementIndex(event, activeItemIndex, enabledOptions.length);
293
292
  this.activeOption = enabledOptions[next];
294
293
  this.activeOption.setActive(true);
295
294
  this.triggerElement.ariaActiveDescendantElement = this.activeOption;
@@ -990,7 +990,8 @@ function subHours(date, amount, options) {
990
990
  */
991
991
  function removeTimezoneFromISOTimeString(isoTime) {
992
992
  if (!isoTime) return;
993
- if (!isValid(parseISO(isoTime))) return;
993
+ const parsedDate = parseISO(isoTime);
994
+ if (!isValid(parsedDate)) return;
994
995
  if (isoTime.includes("Z")) return new Date(isoTime.replace("Z", ""));
995
996
  if (isoTime.includes("T")) {
996
997
  const dateTime = isoTime.split("T");
@@ -354,7 +354,7 @@ let SbbEasterEggElement = (() => {
354
354
  x: 0,
355
355
  y: 0
356
356
  };
357
- this._snakePresence = new Uint8Array(ROWS * ROWS);
357
+ this._snakePresence = /* @__PURE__ */ new Uint8Array(256);
358
358
  this._foodPixel = [5, 5];
359
359
  this._currentFoodIndex = 0;
360
360
  this._currentSpeed = START_SPEED;
@@ -530,17 +530,17 @@ let SbbEasterEggElement = (() => {
530
530
  corner: Direction.HORIZONTAL
531
531
  },
532
532
  {
533
- x: mid - 1,
533
+ x: 9,
534
534
  y: mid,
535
535
  corner: Direction.HORIZONTAL
536
536
  },
537
537
  {
538
- x: mid - 2,
538
+ x: 8,
539
539
  y: mid,
540
540
  corner: Direction.HORIZONTAL
541
541
  }
542
542
  ];
543
- this._snakePresence = new Uint8Array(ROWS * ROWS);
543
+ this._snakePresence = /* @__PURE__ */ new Uint8Array(256);
544
544
  for (const cell of this._snake) this._snakePresence[this._idx(cell.x, cell.y)] = 1;
545
545
  this._foodPixel = [5, 5];
546
546
  this._currentFoodIndex = 0;
@@ -1437,7 +1437,8 @@ const lightFormatters = {
1437
1437
  S(date, token) {
1438
1438
  const numberOfDigits = token.length;
1439
1439
  const milliseconds = date.getMilliseconds();
1440
- return addLeadingZeros(Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3)), token.length);
1440
+ const fractionalSeconds = Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3));
1441
+ return addLeadingZeros(fractionalSeconds, token.length);
1441
1442
  }
1442
1443
  };
1443
1444
 
@@ -1475,15 +1476,20 @@ const formatters = {
1475
1476
  Y: function(date, token, localize, options) {
1476
1477
  const signedWeekYear = getWeekYear(date, options);
1477
1478
  const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
1478
- if (token === "YY") return addLeadingZeros(weekYear % 100, 2);
1479
+ if (token === "YY") {
1480
+ const twoDigitYear = weekYear % 100;
1481
+ return addLeadingZeros(twoDigitYear, 2);
1482
+ }
1479
1483
  if (token === "Yo") return localize.ordinalNumber(weekYear, { unit: "year" });
1480
1484
  return addLeadingZeros(weekYear, token.length);
1481
1485
  },
1482
1486
  R: function(date, token) {
1483
- return addLeadingZeros(getISOWeekYear(date), token.length);
1487
+ const isoWeekYear = getISOWeekYear(date);
1488
+ return addLeadingZeros(isoWeekYear, token.length);
1484
1489
  },
1485
1490
  u: function(date, token) {
1486
- return addLeadingZeros(date.getFullYear(), token.length);
1491
+ const year = date.getFullYear();
1492
+ return addLeadingZeros(year, token.length);
1487
1493
  },
1488
1494
  Q: function(date, token, localize) {
1489
1495
  const quarter = Math.ceil((date.getMonth() + 1) / 3);
@@ -1826,7 +1832,8 @@ const formatters = {
1826
1832
  }
1827
1833
  },
1828
1834
  t: function(date, token, _localize) {
1829
- return addLeadingZeros(Math.trunc(+date / 1e3), token.length);
1835
+ const timestamp = Math.trunc(+date / 1e3);
1836
+ return addLeadingZeros(timestamp, token.length);
1830
1837
  },
1831
1838
  T: function(date, token, _localize) {
1832
1839
  return addLeadingZeros(+date, token.length);
@@ -1886,9 +1893,7 @@ const dateTimeLongFormatter = (pattern, formatLong) => {
1886
1893
  case "PPP":
1887
1894
  dateTimeFormat = formatLong.dateTime({ width: "long" });
1888
1895
  break;
1889
- default:
1890
- dateTimeFormat = formatLong.dateTime({ width: "full" });
1891
- break;
1896
+ default: dateTimeFormat = formatLong.dateTime({ width: "full" });
1892
1897
  }
1893
1898
  return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong));
1894
1899
  };
@@ -1436,7 +1436,8 @@ const lightFormatters = {
1436
1436
  S(date, token) {
1437
1437
  const numberOfDigits = token.length;
1438
1438
  const milliseconds = date.getMilliseconds();
1439
- return addLeadingZeros(Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3)), token.length);
1439
+ const fractionalSeconds = Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3));
1440
+ return addLeadingZeros(fractionalSeconds, token.length);
1440
1441
  }
1441
1442
  };
1442
1443
 
@@ -1474,15 +1475,20 @@ const formatters = {
1474
1475
  Y: function(date, token, localize, options) {
1475
1476
  const signedWeekYear = getWeekYear(date, options);
1476
1477
  const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
1477
- if (token === "YY") return addLeadingZeros(weekYear % 100, 2);
1478
+ if (token === "YY") {
1479
+ const twoDigitYear = weekYear % 100;
1480
+ return addLeadingZeros(twoDigitYear, 2);
1481
+ }
1478
1482
  if (token === "Yo") return localize.ordinalNumber(weekYear, { unit: "year" });
1479
1483
  return addLeadingZeros(weekYear, token.length);
1480
1484
  },
1481
1485
  R: function(date, token) {
1482
- return addLeadingZeros(getISOWeekYear(date), token.length);
1486
+ const isoWeekYear = getISOWeekYear(date);
1487
+ return addLeadingZeros(isoWeekYear, token.length);
1483
1488
  },
1484
1489
  u: function(date, token) {
1485
- return addLeadingZeros(date.getFullYear(), token.length);
1490
+ const year = date.getFullYear();
1491
+ return addLeadingZeros(year, token.length);
1486
1492
  },
1487
1493
  Q: function(date, token, localize) {
1488
1494
  const quarter = Math.ceil((date.getMonth() + 1) / 3);
@@ -1825,7 +1831,8 @@ const formatters = {
1825
1831
  }
1826
1832
  },
1827
1833
  t: function(date, token, _localize) {
1828
- return addLeadingZeros(Math.trunc(+date / 1e3), token.length);
1834
+ const timestamp = Math.trunc(+date / 1e3);
1835
+ return addLeadingZeros(timestamp, token.length);
1829
1836
  },
1830
1837
  T: function(date, token, _localize) {
1831
1838
  return addLeadingZeros(+date, token.length);
@@ -1885,9 +1892,7 @@ const dateTimeLongFormatter = (pattern, formatLong) => {
1885
1892
  case "PPP":
1886
1893
  dateTimeFormat = formatLong.dateTime({ width: "long" });
1887
1894
  break;
1888
- default:
1889
- dateTimeFormat = formatLong.dateTime({ width: "full" });
1890
- break;
1895
+ default: dateTimeFormat = formatLong.dateTime({ width: "full" });
1891
1896
  }
1892
1897
  return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong));
1893
1898
  };
@@ -500,7 +500,8 @@ let SbbPearlChainElement = (() => {
500
500
  _getProgress(now, start, end) {
501
501
  if (!start?.time || !end?.time) return 0;
502
502
  const startWithDelay = addMinutes(start.time, start.delay ?? 0);
503
- const total = differenceInMinutes(addMinutes(end.time, end.delay ?? 0), startWithDelay);
503
+ const endWithDelay = addMinutes(end.time, end.delay ?? 0);
504
+ const total = differenceInMinutes(endWithDelay, startWithDelay);
504
505
  const progress = differenceInMinutes(now, startWithDelay);
505
506
  return total && progress / total * 100;
506
507
  }
@@ -14029,7 +14029,8 @@ let SbbSeatReservationPlaceControlElement = (() => {
14029
14029
  return `PLACE_${type}_${state}`;
14030
14030
  }
14031
14031
  _getTitleDescriptionPlace(rotation) {
14032
- let description = getI18nSeatReservation("PLACE_CONTROL_" + this.type + "_" + this.state, this._language.current, [this.text]);
14032
+ const translationKey = "PLACE_CONTROL_" + this.type + "_" + this.state;
14033
+ let description = getI18nSeatReservation(translationKey, this._language.current, [this.text]);
14033
14034
  const relativeTravelDirection = this._getRelativeTravelDirection(rotation);
14034
14035
  if (this.propertyIds.length || relativeTravelDirection) {
14035
14036
  description += ". " + getI18nSeatReservation("PLACE_PROPERTY", this._language.current).concat(": ");
@@ -14824,13 +14825,10 @@ let SeatReservationBaseElement = (() => {
14824
14825
  this._navigateToPlaceByKeyboard(pressedUpKeyMapping);
14825
14826
  }
14826
14827
  break;
14827
- case this.keyboardNavigationEvents.ArrowDown:
14828
- {
14829
- const pressedDownKeyMapping = this.alignVertical ? this.keyboardNavigationEvents.ArrowRight : pressedKey;
14830
- this._navigateToPlaceByKeyboard(pressedDownKeyMapping);
14831
- }
14832
- break;
14833
- default: break;
14828
+ case this.keyboardNavigationEvents.ArrowDown: {
14829
+ const pressedDownKeyMapping = this.alignVertical ? this.keyboardNavigationEvents.ArrowRight : pressedKey;
14830
+ this._navigateToPlaceByKeyboard(pressedDownKeyMapping);
14831
+ }
14834
14832
  }
14835
14833
  }
14836
14834
  }
@@ -15243,7 +15241,8 @@ let SeatReservationBaseElement = (() => {
15243
15241
  this.selectedSeatReservationPlaces.bicycles = [];
15244
15242
  this.seatReservations?.forEach((seatReservation, coachDeckIndex) => seatReservation.coachItems.map((coach, coachIndex) => {
15245
15243
  coach.places?.filter((place) => place.state === "SELECTED")?.forEach((place) => {
15246
- const preselectedPlaceSelection = mapPlaceInfosToPlaceSelection(place, this.getPlaceElementId(coachDeckIndex, coachIndex, place.number), seatReservation.deckCoachIndex, coachIndex);
15244
+ const placeId = this.getPlaceElementId(coachDeckIndex, coachIndex, place.number);
15245
+ const preselectedPlaceSelection = mapPlaceInfosToPlaceSelection(place, placeId, seatReservation.deckCoachIndex, coachIndex);
15247
15246
  const seatReservationPlaceSelection = this._getSeatReservationPlaceSelection(preselectedPlaceSelection, coachDeckIndex);
15248
15247
  if (seatReservationPlaceSelection) if (seatReservationPlaceSelection.placeType === "SEAT") this.selectedSeatReservationPlaces.seats.push(seatReservationPlaceSelection);
15249
15248
  else this.selectedSeatReservationPlaces.bicycles.push(seatReservationPlaceSelection);
@@ -15273,7 +15272,8 @@ let SeatReservationBaseElement = (() => {
15273
15272
  _getSeatReservationSelectedCoach(coachIndex) {
15274
15273
  if (!this.seatReservations[this.currSelectedDeckIndex].coachItems[coachIndex]) return null;
15275
15274
  const coach = this.seatReservations[this.currSelectedDeckIndex].coachItems[coachIndex];
15276
- return mapCoachInfosToCoachSelection(coachIndex, coach, this.getAvailableFreePlacesNumFromCoach(coach.places));
15275
+ const coachNumberOfFreePlaces = this.getAvailableFreePlacesNumFromCoach(coach.places);
15276
+ return mapCoachInfosToCoachSelection(coachIndex, coach, coachNumberOfFreePlaces);
15277
15277
  }
15278
15278
  _setCurrSelectedPlaceElementId(place) {
15279
15279
  this.currSelectedPlaceElementId = place ? this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, place.number) : null;
@@ -15660,7 +15660,8 @@ var SbbSeatReservationElement = class extends SeatReservationBaseElement {
15660
15660
  _renderDeckLabels() {
15661
15661
  if (!this.hasMultipleDecks) return null;
15662
15662
  return this.seatReservations.map((seatReservation) => {
15663
- return html`<b aria-hidden="true">${getI18nSeatReservation(seatReservation.deckCoachLevel, this._language.current)}</b>`;
15663
+ const deckDescription = getI18nSeatReservation(seatReservation.deckCoachLevel, this._language.current);
15664
+ return html`<b aria-hidden="true">${deckDescription}</b>`;
15664
15665
  });
15665
15666
  }
15666
15667
  _renderNavigationControlButton(btnDirection) {
@@ -15690,9 +15691,10 @@ var SbbSeatReservationElement = class extends SeatReservationBaseElement {
15690
15691
  _renderTravelDirection() {
15691
15692
  if (!this.hasTravelDirection()) return null;
15692
15693
  const labelText = getI18nSeatReservation("SEAT_RESERVATION_TRAVEL_DIRECTION", this._language.current);
15694
+ const iconName = `arrow-${this.alignVertical ? this.travelDirection === "RIGHT" ? "down" : "up" : this.travelDirection === "RIGHT" ? "right" : "left"}-small`;
15693
15695
  return html`<div class="sbb-sr-travel-direction-wrapper">
15694
15696
  <div class="sbb-sr__travel-direction--arrow">
15695
- <sbb-icon slot="icon" name="${`arrow-${this.alignVertical ? this.travelDirection === "RIGHT" ? "down" : "up" : this.travelDirection === "RIGHT" ? "right" : "left"}-small`}"></sbb-icon>
15697
+ <sbb-icon slot="icon" name="${iconName}"></sbb-icon>
15696
15698
  </div>
15697
15699
  <div class="sbb-sr__travel-direction--label">${labelText}</div>
15698
15700
  </div>`;
@@ -1438,7 +1438,8 @@ const lightFormatters = {
1438
1438
  S(date, token) {
1439
1439
  const numberOfDigits = token.length;
1440
1440
  const milliseconds = date.getMilliseconds();
1441
- return addLeadingZeros(Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3)), token.length);
1441
+ const fractionalSeconds = Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3));
1442
+ return addLeadingZeros(fractionalSeconds, token.length);
1442
1443
  }
1443
1444
  };
1444
1445
 
@@ -1476,15 +1477,20 @@ const formatters = {
1476
1477
  Y: function(date, token, localize, options) {
1477
1478
  const signedWeekYear = getWeekYear(date, options);
1478
1479
  const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
1479
- if (token === "YY") return addLeadingZeros(weekYear % 100, 2);
1480
+ if (token === "YY") {
1481
+ const twoDigitYear = weekYear % 100;
1482
+ return addLeadingZeros(twoDigitYear, 2);
1483
+ }
1480
1484
  if (token === "Yo") return localize.ordinalNumber(weekYear, { unit: "year" });
1481
1485
  return addLeadingZeros(weekYear, token.length);
1482
1486
  },
1483
1487
  R: function(date, token) {
1484
- return addLeadingZeros(getISOWeekYear(date), token.length);
1488
+ const isoWeekYear = getISOWeekYear(date);
1489
+ return addLeadingZeros(isoWeekYear, token.length);
1485
1490
  },
1486
1491
  u: function(date, token) {
1487
- return addLeadingZeros(date.getFullYear(), token.length);
1492
+ const year = date.getFullYear();
1493
+ return addLeadingZeros(year, token.length);
1488
1494
  },
1489
1495
  Q: function(date, token, localize) {
1490
1496
  const quarter = Math.ceil((date.getMonth() + 1) / 3);
@@ -1827,7 +1833,8 @@ const formatters = {
1827
1833
  }
1828
1834
  },
1829
1835
  t: function(date, token, _localize) {
1830
- return addLeadingZeros(Math.trunc(+date / 1e3), token.length);
1836
+ const timestamp = Math.trunc(+date / 1e3);
1837
+ return addLeadingZeros(timestamp, token.length);
1831
1838
  },
1832
1839
  T: function(date, token, _localize) {
1833
1840
  return addLeadingZeros(+date, token.length);
@@ -1887,9 +1894,7 @@ const dateTimeLongFormatter = (pattern, formatLong) => {
1887
1894
  case "PPP":
1888
1895
  dateTimeFormat = formatLong.dateTime({ width: "long" });
1889
1896
  break;
1890
- default:
1891
- dateTimeFormat = formatLong.dateTime({ width: "full" });
1892
- break;
1897
+ default: dateTimeFormat = formatLong.dateTime({ width: "full" });
1893
1898
  }
1894
1899
  return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong));
1895
1900
  };
@@ -1,4 +1,4 @@
1
- import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbElement as n,SbbLanguageController as r,defaultDateAdapter as i,forceType as a,i18nTripDuration as o,screenReaderOnlyStyles as s}from"@sbb-esta/lyne-elements/core.js";import{SbbDividerElement as c}from"@sbb-esta/lyne-elements/divider.pure.js";import{SbbJourneyHeaderElement as l}from"@sbb-esta/lyne-elements/journey-header.pure.js";import{html as u,nothing as d,unsafeCSS as f}from"lit";import{property as p}from"lit/decorators.js";import{durationToTime as m,removeTimezoneFromISOTimeString as ee}from"./core.js";import{SbbPearlChainTimeElement as te}from"./pearl-chain-time.pure.js";const h=6048e5,g=Symbol.for(`constructDateFrom`);function _(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&g in e?e[g](t):e instanceof Date?new e.constructor(t):new Date(t)}function v(e,t){return _(t||e,e)}let y={};function b(){return y}function x(e,t){let n=b(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=v(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function S(e,t){return x(e,{...t,weekStartsOn:1})}function C(e,t){let n=v(e,t?.in),r=n.getFullYear(),i=_(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=S(i),o=_(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=S(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function w(e){let t=v(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function T(e,...t){let n=_.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function E(e,t){let n=v(e,t?.in);return n.setHours(0,0,0,0),n}function D(e,t,n){let[r,i]=T(n?.in,e,t),a=E(r),o=E(i),s=+a-w(a),c=+o-w(o);return Math.round((s-c)/864e5)}function O(e,t){let n=C(e,t),r=_(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),S(r)}function k(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function A(e){return!(!k(e)&&typeof e!=`number`||isNaN(+v(e)))}function j(e,t){let n=v(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const M={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},N=(e,t,n)=>{let r,i=M[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function P(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const F={date:P({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:P({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:P({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},I={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},ne=(e,t,n,r)=>I[e];function L(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const R={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:L({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:L({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:L({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:L({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:L({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function z(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?ie(s,e=>e.test(o)):re(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function re(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ie(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ae(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}const oe={code:`en-US`,formatDistance:N,formatLong:F,formatRelative:ne,localize:R,match:{ordinalNumber:ae({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:z({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:z({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:z({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:z({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:z({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function B(e,t){let n=v(e,t?.in);return D(n,j(n))+1}function se(e,t){let n=v(e,t?.in),r=S(n)-+O(n);return Math.round(r/h)+1}function V(e,t){let n=v(e,t?.in),r=n.getFullYear(),i=b(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=_(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=x(o,t),c=_(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=x(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function H(e,t){let n=b(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=V(e,t),a=_(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),x(a,t)}function U(e,t){let n=v(e,t?.in),r=x(n,t)-+H(n,t);return Math.round(r/h)+1}function W(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}const G={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return W(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):W(n+1,2)},d(e,t){return W(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return W(e.getHours()%12||12,t.length)},H(e,t){return W(e.getHours(),t.length)},m(e,t){return W(e.getMinutes(),t.length)},s(e,t){return W(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return W(Math.trunc(r*10**(n-3)),t.length)}},K={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},q={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return G.y(e,t)},Y:function(e,t,n,r){let i=V(e,r),a=i>0?i:1-i;return t===`YY`?W(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):W(a,t.length)},R:function(e,t){return W(C(e),t.length)},u:function(e,t){return W(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return W(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return W(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return G.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return W(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=U(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):W(i,t.length)},I:function(e,t,n){let r=se(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):W(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):G.d(e,t)},D:function(e,t,n){let r=B(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):W(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return W(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return W(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return W(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?K.noon:r===0?K.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?K.evening:r>=12?K.afternoon:r>=4?K.morning:K.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return G.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):G.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):W(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):W(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):G.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):G.s(e,t)},S:function(e,t){return G.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return Y(r);case`XXXX`:case`XX`:return X(r);default:return X(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return Y(r);case`xxxx`:case`xx`:return X(r);default:return X(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+J(r,`:`);default:return`GMT`+X(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+J(r,`:`);default:return`GMT`+X(r,`:`)}},t:function(e,t,n){return W(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return W(+e,t.length)}};function J(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+W(a,2)}function Y(e,t){return e%60==0?(e>0?`-`:`+`)+W(Math.abs(e)/60,2):X(e,t)}function X(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=W(Math.trunc(r/60),2),a=W(r%60,2);return n+i+t+a}const Z=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},Q=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},ce={p:Q,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Z(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,Z(r,t)).replace(`{{time}}`,Q(i,t))}},le=/^D+$/,ue=/^Y+$/,de=[`D`,`DD`,`YY`,`YYYY`];function fe(e){return le.test(e)}function pe(e){return ue.test(e)}function me(e,t,n){let r=he(e,t,n);if(console.warn(r),de.includes(e))throw RangeError(r)}function he(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ge=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ve=/^'([^]*?)'?$/,ye=/''/g,be=/[a-zA-Z]/;function $(e,t,n){let r=b(),i=n?.locale??r.locale??oe,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=v(e,n?.in);if(!A(s))throw RangeError(`Invalid time value`);let c=t.match(_e).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=ce[t];return n(e,i.formatLong)}return e}).join(``).match(ge).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:xe(e)};if(q[t])return{isToken:!0,value:e};if(t.match(be))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&pe(a)||!n?.useAdditionalDayOfYearTokens&&fe(a))&&me(a,t,String(e));let o=q[a[0]];return o(s,a,i.localize,l)}).join(``)}function xe(e){let t=e.match(ve);return t?t[1].replace(ye,`'`):e}var Se=`:host{display:block}.sbb-journey-summary{--sbb-text-font-size:var(--sbb-text-font-size-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);color:var(--sbb-color-4);flex-direction:column;display:flex}.sbb-journey-summary__via-block{display:flex}.sbb-journey-summary__vias{white-space:nowrap;text-overflow:ellipsis;margin-block:0;padding-inline-start:var(--sbb-spacing-fixed-1x);overflow:hidden}.sbb-journey-summary__date{margin-block-end:var(--sbb-spacing-fixed-2x)}.sbb-journey-summary__via{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.sbb-journey-summary__divider{margin-block:var(--sbb-spacing-fixed-6x)}ul li{list-style:none;display:inline}
1
+ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbElement as n,SbbLanguageController as r,defaultDateAdapter as i,forceType as a,i18nTripDuration as o,screenReaderOnlyStyles as s}from"@sbb-esta/lyne-elements/core.js";import{SbbDividerElement as c}from"@sbb-esta/lyne-elements/divider.pure.js";import{SbbJourneyHeaderElement as l}from"@sbb-esta/lyne-elements/journey-header.pure.js";import{html as u,nothing as d,unsafeCSS as f}from"lit";import{property as p}from"lit/decorators.js";import{durationToTime as m,removeTimezoneFromISOTimeString as ee}from"./core.js";import{SbbPearlChainTimeElement as te}from"./pearl-chain-time.pure.js";const h=6048e5,g=Symbol.for(`constructDateFrom`);function _(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&g in e?e[g](t):e instanceof Date?new e.constructor(t):new Date(t)}function v(e,t){return _(t||e,e)}let y={};function b(){return y}function x(e,t){let n=b(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=v(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function S(e,t){return x(e,{...t,weekStartsOn:1})}function C(e,t){let n=v(e,t?.in),r=n.getFullYear(),i=_(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=S(i),o=_(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=S(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function w(e){let t=v(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function T(e,...t){let n=_.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function E(e,t){let n=v(e,t?.in);return n.setHours(0,0,0,0),n}function D(e,t,n){let[r,i]=T(n?.in,e,t),a=E(r),o=E(i),s=+a-w(a),c=+o-w(o);return Math.round((s-c)/864e5)}function O(e,t){let n=C(e,t),r=_(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),S(r)}function k(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function A(e){return!(!k(e)&&typeof e!=`number`||isNaN(+v(e)))}function j(e,t){let n=v(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const M={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},N=(e,t,n)=>{let r,i=M[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function P(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const F={date:P({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:P({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:P({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},I={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},ne=(e,t,n,r)=>I[e];function L(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const R={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:L({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:L({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:L({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:L({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:L({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function z(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?ie(s,e=>e.test(o)):re(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function re(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ie(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ae(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}const oe={code:`en-US`,formatDistance:N,formatLong:F,formatRelative:ne,localize:R,match:{ordinalNumber:ae({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:z({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:z({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:z({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:z({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:z({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function B(e,t){let n=v(e,t?.in);return D(n,j(n))+1}function se(e,t){let n=v(e,t?.in),r=S(n)-+O(n);return Math.round(r/h)+1}function V(e,t){let n=v(e,t?.in),r=n.getFullYear(),i=b(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=_(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=x(o,t),c=_(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=x(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function H(e,t){let n=b(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=V(e,t),a=_(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),x(a,t)}function U(e,t){let n=v(e,t?.in),r=x(n,t)-+H(n,t);return Math.round(r/h)+1}function W(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}const G={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return W(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):W(n+1,2)},d(e,t){return W(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return W(e.getHours()%12||12,t.length)},H(e,t){return W(e.getHours(),t.length)},m(e,t){return W(e.getMinutes(),t.length)},s(e,t){return W(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return W(Math.trunc(r*10**(n-3)),t.length)}},K={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},q={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return G.y(e,t)},Y:function(e,t,n,r){let i=V(e,r),a=i>0?i:1-i;return t===`YY`?W(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):W(a,t.length)},R:function(e,t){return W(C(e),t.length)},u:function(e,t){return W(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return W(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return W(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return G.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return W(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=U(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):W(i,t.length)},I:function(e,t,n){let r=se(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):W(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):G.d(e,t)},D:function(e,t,n){let r=B(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):W(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return W(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return W(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return W(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?K.noon:r===0?K.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?K.evening:r>=12?K.afternoon:r>=4?K.morning:K.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return G.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):G.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):W(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):W(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):G.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):G.s(e,t)},S:function(e,t){return G.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return Y(r);case`XXXX`:case`XX`:return X(r);default:return X(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return Y(r);case`xxxx`:case`xx`:return X(r);default:return X(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+J(r,`:`);default:return`GMT`+X(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+J(r,`:`);default:return`GMT`+X(r,`:`)}},t:function(e,t,n){return W(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return W(+e,t.length)}};function J(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+W(a,2)}function Y(e,t){return e%60==0?(e>0?`-`:`+`)+W(Math.abs(e)/60,2):X(e,t)}function X(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=W(Math.trunc(r/60),2),a=W(r%60,2);return n+i+t+a}const Z=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},Q=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},ce={p:Q,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Z(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`})}return a.replace(`{{date}}`,Z(r,t)).replace(`{{time}}`,Q(i,t))}},le=/^D+$/,ue=/^Y+$/,de=[`D`,`DD`,`YY`,`YYYY`];function fe(e){return le.test(e)}function pe(e){return ue.test(e)}function me(e,t,n){let r=he(e,t,n);if(console.warn(r),de.includes(e))throw RangeError(r)}function he(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ge=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ve=/^'([^]*?)'?$/,ye=/''/g,be=/[a-zA-Z]/;function $(e,t,n){let r=b(),i=n?.locale??r.locale??oe,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=v(e,n?.in);if(!A(s))throw RangeError(`Invalid time value`);let c=t.match(_e).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=ce[t];return n(e,i.formatLong)}return e}).join(``).match(ge).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:xe(e)};if(q[t])return{isToken:!0,value:e};if(t.match(be))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&pe(a)||!n?.useAdditionalDayOfYearTokens&&fe(a))&&me(a,t,String(e));let o=q[a[0]];return o(s,a,i.localize,l)}).join(``)}function xe(e){let t=e.match(ve);return t?t[1].replace(ye,`'`):e}var Se=`:host{display:block}.sbb-journey-summary{--sbb-text-font-size:var(--sbb-text-font-size-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);color:var(--sbb-color-4);flex-direction:column;display:flex}.sbb-journey-summary__via-block{display:flex}.sbb-journey-summary__vias{white-space:nowrap;text-overflow:ellipsis;margin-block:0;padding-inline-start:var(--sbb-spacing-fixed-1x);overflow:hidden}.sbb-journey-summary__date{margin-block-end:var(--sbb-spacing-fixed-2x)}.sbb-journey-summary__via{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.sbb-journey-summary__divider{margin-block:var(--sbb-spacing-fixed-6x)}ul li{list-style:none;display:inline}
2
2
  `;let Ce=(()=>{let h=n,g=[],_,v=[],y=[],b,x=[],S=[],C,w=[],T=[],E,D=[],O=[],k,j=[],M=[],N,P=[],F=[],I;return class extends h{constructor(){super(...arguments),this.#e=(t(this,g),t(this,v,null)),this.#t=(t(this,y),t(this,x,null)),this.#n=(t(this,S),t(this,w,!1)),this.#r=(t(this,T),t(this,D,`3`)),this.#i=(t(this,O),t(this,j,!1)),this.#a=(t(this,M),t(this,P,!1)),this._now=(t(this,F),null),this._hasContentSlot=!1,this._language=new r(this)}static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;_=[p({type:Object})],b=[p({attribute:`trip-back`,type:Object})],C=[a(),p({attribute:`round-trip`,type:Boolean})],E=[p({attribute:`header-level`})],k=[a(),p({attribute:`disable-animation`,type:Boolean})],N=[a(),p({attribute:`a11y-footpath`,type:Boolean})],I=[p()],e(this,null,_,{kind:`accessor`,name:`trip`,static:!1,private:!1,access:{has:e=>`trip`in e,get:e=>e.trip,set:(e,t)=>{e.trip=t}},metadata:t},v,y),e(this,null,b,{kind:`accessor`,name:`tripBack`,static:!1,private:!1,access:{has:e=>`tripBack`in e,get:e=>e.tripBack,set:(e,t)=>{e.tripBack=t}},metadata:t},x,S),e(this,null,C,{kind:`accessor`,name:`roundTrip`,static:!1,private:!1,access:{has:e=>`roundTrip`in e,get:e=>e.roundTrip,set:(e,t)=>{e.roundTrip=t}},metadata:t},w,T),e(this,null,E,{kind:`accessor`,name:`headerLevel`,static:!1,private:!1,access:{has:e=>`headerLevel`in e,get:e=>e.headerLevel,set:(e,t)=>{e.headerLevel=t}},metadata:t},D,O),e(this,null,k,{kind:`accessor`,name:`disableAnimation`,static:!1,private:!1,access:{has:e=>`disableAnimation`in e,get:e=>e.disableAnimation,set:(e,t)=>{e.disableAnimation=t}},metadata:t},j,M),e(this,null,N,{kind:`accessor`,name:`a11yFootpath`,static:!1,private:!1,access:{has:e=>`a11yFootpath`in e,get:e=>e.a11yFootpath,set:(e,t)=>{e.a11yFootpath=t}},metadata:t},P,F),e(this,null,I,{kind:`setter`,name:`now`,static:!1,private:!1,access:{has:e=>`now`in e,set:(e,t)=>{e.now=t}},metadata:t},null,g),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-journey-summary`}static{this.elementDependencies=[c,l,te]}static{this.styles=[s,f(Se)]}#e;get trip(){return this.#e}set trip(e){this.#e=e}#t;get tripBack(){return this.#t}set tripBack(e){this.#t=e}#n;get roundTrip(){return this.#n}set roundTrip(e){this.#n=e}#r;get headerLevel(){return this.#r}set headerLevel(e){this.#r=e}#i;get disableAnimation(){return this.#i}set disableAnimation(e){this.#i=e}#a;get a11yFootpath(){return this.#a}set a11yFootpath(e){this.#a=e}set now(e){this._now=i.getValidDateOrNull(i.deserialize(e))}get now(){return this._now??new Date}connectedCallback(){super.connectedCallback(),this._hasContentSlot=!!this.querySelector?.(`[slot="content"]`)}_renderJourneyStart(e,t){let n=i,r=t?m(t,this._language.current):null;if(A(e))return u`
3
3
  <time datetime=${$(e,`d`)+` `+$(e,`M`)}>
4
4
  ${n.format(e).replace(`,`,`.`)}</time
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sbb-esta/lyne-elements-experimental-dev",
3
- "version": "5.4.0-dev.1785707719",
3
+ "version": "5.4.0-dev.1785757652",
4
4
  "description": "Lyne Design System",
5
5
  "keywords": [
6
6
  "design system",
7
7
  "web components",
8
8
  "lit",
9
- "https://github.com/sbb-design-systems/lyne-components/commit/28e65ee9a47ca79f70c9c3ea173256826b6929d6"
9
+ "https://github.com/sbb-design-systems/lyne-components/commit/da4d7ad781e56fdab834037416107a2c4ec4971e"
10
10
  ],
11
11
  "type": "module",
12
12
  "exports": {
@@ -1,4 +1,4 @@
1
- import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbElement as n,SbbLanguageController as r,defaultDateAdapter as i,forceType as a,i18nArrival as o,i18nDeparture as s,i18nTransferProcedures as c,screenReaderOnlyStyles as l}from"@sbb-esta/lyne-elements/core.js";import{SbbIconElement as u}from"@sbb-esta/lyne-elements/icon.pure.js";import{html as d,nothing as f,unsafeCSS as ee}from"lit";import{property as p}from"lit/decorators.js";import{getDepartureArrivalTimeAttribute as te,isRideLeg as ne,removeTimezoneFromISOTimeString as m}from"./core.js";import{SbbPearlChainElement as re}from"./pearl-chain.pure.js";const h=6048e5,g=Symbol.for(`constructDateFrom`);function _(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&g in e?e[g](t):e instanceof Date?new e.constructor(t):new Date(t)}function v(e,t){return _(t||e,e)}let y={};function b(){return y}function x(e,t){let n=b(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=v(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function S(e,t){return x(e,{...t,weekStartsOn:1})}function C(e,t){let n=v(e,t?.in),r=n.getFullYear(),i=_(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=S(i),o=_(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=S(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function w(e){let t=v(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function T(e,...t){let n=_.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function E(e,t){let n=v(e,t?.in);return n.setHours(0,0,0,0),n}function D(e,t,n){let[r,i]=T(n?.in,e,t),a=E(r),o=E(i),s=+a-w(a),c=+o-w(o);return Math.round((s-c)/864e5)}function O(e,t){let n=C(e,t),r=_(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),S(r)}function k(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function A(e){return!(!k(e)&&typeof e!=`number`||isNaN(+v(e)))}function j(e,t){let n=v(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const M={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},N=(e,t,n)=>{let r,i=M[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function P(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const F={date:P({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:P({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:P({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},I={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},L=(e,t,n,r)=>I[e];function R(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const ie={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:R({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:R({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:R({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:R({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:R({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function z(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?oe(s,e=>e.test(o)):ae(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function ae(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function oe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function se(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}const ce={code:`en-US`,formatDistance:N,formatLong:F,formatRelative:L,localize:ie,match:{ordinalNumber:se({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:z({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:z({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:z({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:z({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:z({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function le(e,t){let n=v(e,t?.in);return D(n,j(n))+1}function ue(e,t){let n=v(e,t?.in),r=S(n)-+O(n);return Math.round(r/h)+1}function B(e,t){let n=v(e,t?.in),r=n.getFullYear(),i=b(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=_(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=x(o,t),c=_(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=x(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function V(e,t){let n=b(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=B(e,t),a=_(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),x(a,t)}function H(e,t){let n=v(e,t?.in),r=x(n,t)-+V(n,t);return Math.round(r/h)+1}function U(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}const W={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return U(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):U(n+1,2)},d(e,t){return U(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return U(e.getHours()%12||12,t.length)},H(e,t){return U(e.getHours(),t.length)},m(e,t){return U(e.getMinutes(),t.length)},s(e,t){return U(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return U(Math.trunc(r*10**(n-3)),t.length)}},G={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},K={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return W.y(e,t)},Y:function(e,t,n,r){let i=B(e,r),a=i>0?i:1-i;return t===`YY`?U(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):U(a,t.length)},R:function(e,t){return U(C(e),t.length)},u:function(e,t){return U(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return U(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return U(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return W.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return U(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=H(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):U(i,t.length)},I:function(e,t,n){let r=ue(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):U(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):W.d(e,t)},D:function(e,t,n){let r=le(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):U(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return U(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return U(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return U(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?G.noon:r===0?G.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?G.evening:r>=12?G.afternoon:r>=4?G.morning:G.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return W.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):W.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):U(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):U(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):W.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):W.s(e,t)},S:function(e,t){return W.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return J(r);case`XXXX`:case`XX`:return Y(r);default:return Y(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return J(r);case`xxxx`:case`xx`:return Y(r);default:return Y(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+q(r,`:`);default:return`GMT`+Y(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+q(r,`:`);default:return`GMT`+Y(r,`:`)}},t:function(e,t,n){return U(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return U(+e,t.length)}};function q(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+U(a,2)}function J(e,t){return e%60==0?(e>0?`-`:`+`)+U(Math.abs(e)/60,2):Y(e,t)}function Y(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=U(Math.trunc(r/60),2),a=U(r%60,2);return n+i+t+a}const X=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},Z=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},de={p:Z,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return X(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,X(r,t)).replace(`{{time}}`,Z(i,t))}},fe=/^D+$/,pe=/^Y+$/,me=[`D`,`DD`,`YY`,`YYYY`];function he(e){return fe.test(e)}function ge(e){return pe.test(e)}function _e(e,t,n){let r=ve(e,t,n);if(console.warn(r),me.includes(e))throw RangeError(r)}function ve(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ye=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Q=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,be=/^'([^]*?)'?$/,xe=/''/g,Se=/[a-zA-Z]/;function $(e,t,n){let r=b(),i=n?.locale??r.locale??ce,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=v(e,n?.in);if(!A(s))throw RangeError(`Invalid time value`);let c=t.match(Q).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=de[t];return n(e,i.formatLong)}return e}).join(``).match(ye).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Ce(e)};if(K[t])return{isToken:!0,value:e};if(t.match(Se))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&ge(a)||!n?.useAdditionalDayOfYearTokens&&he(a))&&_e(a,t,String(e));let o=K[a[0]];return o(s,a,i.localize,l)}).join(``)}function Ce(e){let t=e.match(be);return t?t[1].replace(xe,`'`):e}var we=`:host{--sbb-pearl-chain-time-height:auto;display:block}@media (width>=37.5rem){:host{--sbb-pearl-chain-time-height:1.5625rem}}@media (width>=64rem){:host{--sbb-pearl-chain-time-height:1.75rem}}.sbb-pearl-chain__time{height:var(--sbb-pearl-chain-time-height);flex-wrap:wrap;justify-content:space-between;align-items:center;display:flex}.sbb-pearl-chain__time-walktime,.sbb-pearl-chain__time-transfer{--sbb-text-font-size:var(--sbb-text-font-size-xxs);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);align-items:center;display:inline-flex}.sbb-pearl-chain__time-walktime--walk-small-left{margin-inline-end:calc(var(--sbb-spacing-fixed-2x) - .4375rem);transform:translate(-.4375rem)}.sbb-pearl-chain__time-walktime--walk-small-right{margin-inline-start:calc(var(--sbb-spacing-fixed-2x) - .25rem)}.sbb-pearl-chain__time-walktime--wheelchair-small-left{margin-inline-end:calc(var(--sbb-spacing-fixed-2x) - .4375rem);transform:translate(-.375rem)}.sbb-pearl-chain__time-walktime--wheelchair-small-right{margin-inline-start:calc(var(--sbb-spacing-fixed-2x) - .25rem)}.sbb-pearl-chain__time-walktime-prime-symbol{float:right}.sbb-pearl-chain__time-transfer{gap:var(--sbb-spacing-fixed-1x)}.sbb-pearl-chain__time-transfer--sa-ci-departure{margin-inline-end:var(--sbb-spacing-fixed-2x)}.sbb-pearl-chain__time-transfer--sa-ci-arrival{margin-inline-start:calc(var(--sbb-spacing-fixed-2x) - .25rem)}.sbb-pearl-chain__time-chain{margin-inline:var(--sbb-spacing-fixed-3x);flex:auto;align-self:center}.sbb-pearl-chain__time-time{--sbb-text-font-size:var(--sbb-text-font-size-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);color:var(--sbb-color-2);font-weight:700}
1
+ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbElement as n,SbbLanguageController as r,defaultDateAdapter as i,forceType as a,i18nArrival as o,i18nDeparture as s,i18nTransferProcedures as c,screenReaderOnlyStyles as l}from"@sbb-esta/lyne-elements/core.js";import{SbbIconElement as u}from"@sbb-esta/lyne-elements/icon.pure.js";import{html as d,nothing as f,unsafeCSS as ee}from"lit";import{property as p}from"lit/decorators.js";import{getDepartureArrivalTimeAttribute as te,isRideLeg as ne,removeTimezoneFromISOTimeString as m}from"./core.js";import{SbbPearlChainElement as re}from"./pearl-chain.pure.js";const h=6048e5,g=Symbol.for(`constructDateFrom`);function _(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&g in e?e[g](t):e instanceof Date?new e.constructor(t):new Date(t)}function v(e,t){return _(t||e,e)}let y={};function b(){return y}function x(e,t){let n=b(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=v(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function S(e,t){return x(e,{...t,weekStartsOn:1})}function C(e,t){let n=v(e,t?.in),r=n.getFullYear(),i=_(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=S(i),o=_(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=S(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function w(e){let t=v(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function T(e,...t){let n=_.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function E(e,t){let n=v(e,t?.in);return n.setHours(0,0,0,0),n}function D(e,t,n){let[r,i]=T(n?.in,e,t),a=E(r),o=E(i),s=+a-w(a),c=+o-w(o);return Math.round((s-c)/864e5)}function O(e,t){let n=C(e,t),r=_(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),S(r)}function k(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function A(e){return!(!k(e)&&typeof e!=`number`||isNaN(+v(e)))}function j(e,t){let n=v(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const M={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},N=(e,t,n)=>{let r,i=M[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function P(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const F={date:P({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:P({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:P({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},I={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},L=(e,t,n,r)=>I[e];function R(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const ie={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:R({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:R({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:R({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:R({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:R({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function z(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?oe(s,e=>e.test(o)):ae(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function ae(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function oe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function se(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}const ce={code:`en-US`,formatDistance:N,formatLong:F,formatRelative:L,localize:ie,match:{ordinalNumber:se({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:z({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:z({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:z({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:z({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:z({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function le(e,t){let n=v(e,t?.in);return D(n,j(n))+1}function ue(e,t){let n=v(e,t?.in),r=S(n)-+O(n);return Math.round(r/h)+1}function B(e,t){let n=v(e,t?.in),r=n.getFullYear(),i=b(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=_(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=x(o,t),c=_(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=x(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function V(e,t){let n=b(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=B(e,t),a=_(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),x(a,t)}function H(e,t){let n=v(e,t?.in),r=x(n,t)-+V(n,t);return Math.round(r/h)+1}function U(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}const W={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return U(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):U(n+1,2)},d(e,t){return U(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return U(e.getHours()%12||12,t.length)},H(e,t){return U(e.getHours(),t.length)},m(e,t){return U(e.getMinutes(),t.length)},s(e,t){return U(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return U(Math.trunc(r*10**(n-3)),t.length)}},G={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},K={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return W.y(e,t)},Y:function(e,t,n,r){let i=B(e,r),a=i>0?i:1-i;return t===`YY`?U(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):U(a,t.length)},R:function(e,t){return U(C(e),t.length)},u:function(e,t){return U(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return U(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return U(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return W.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return U(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=H(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):U(i,t.length)},I:function(e,t,n){let r=ue(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):U(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):W.d(e,t)},D:function(e,t,n){let r=le(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):U(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return U(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return U(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return U(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?G.noon:r===0?G.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?G.evening:r>=12?G.afternoon:r>=4?G.morning:G.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return W.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):W.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):U(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):U(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):W.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):W.s(e,t)},S:function(e,t){return W.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return J(r);case`XXXX`:case`XX`:return Y(r);default:return Y(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return J(r);case`xxxx`:case`xx`:return Y(r);default:return Y(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+q(r,`:`);default:return`GMT`+Y(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+q(r,`:`);default:return`GMT`+Y(r,`:`)}},t:function(e,t,n){return U(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return U(+e,t.length)}};function q(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+U(a,2)}function J(e,t){return e%60==0?(e>0?`-`:`+`)+U(Math.abs(e)/60,2):Y(e,t)}function Y(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=U(Math.trunc(r/60),2),a=U(r%60,2);return n+i+t+a}const X=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},Z=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},de={p:Z,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return X(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`})}return a.replace(`{{date}}`,X(r,t)).replace(`{{time}}`,Z(i,t))}},fe=/^D+$/,pe=/^Y+$/,me=[`D`,`DD`,`YY`,`YYYY`];function he(e){return fe.test(e)}function ge(e){return pe.test(e)}function _e(e,t,n){let r=ve(e,t,n);if(console.warn(r),me.includes(e))throw RangeError(r)}function ve(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ye=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Q=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,be=/^'([^]*?)'?$/,xe=/''/g,Se=/[a-zA-Z]/;function $(e,t,n){let r=b(),i=n?.locale??r.locale??ce,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=v(e,n?.in);if(!A(s))throw RangeError(`Invalid time value`);let c=t.match(Q).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=de[t];return n(e,i.formatLong)}return e}).join(``).match(ye).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Ce(e)};if(K[t])return{isToken:!0,value:e};if(t.match(Se))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&ge(a)||!n?.useAdditionalDayOfYearTokens&&he(a))&&_e(a,t,String(e));let o=K[a[0]];return o(s,a,i.localize,l)}).join(``)}function Ce(e){let t=e.match(be);return t?t[1].replace(xe,`'`):e}var we=`:host{--sbb-pearl-chain-time-height:auto;display:block}@media (width>=37.5rem){:host{--sbb-pearl-chain-time-height:1.5625rem}}@media (width>=64rem){:host{--sbb-pearl-chain-time-height:1.75rem}}.sbb-pearl-chain__time{height:var(--sbb-pearl-chain-time-height);flex-wrap:wrap;justify-content:space-between;align-items:center;display:flex}.sbb-pearl-chain__time-walktime,.sbb-pearl-chain__time-transfer{--sbb-text-font-size:var(--sbb-text-font-size-xxs);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);align-items:center;display:inline-flex}.sbb-pearl-chain__time-walktime--walk-small-left{margin-inline-end:calc(var(--sbb-spacing-fixed-2x) - .4375rem);transform:translate(-.4375rem)}.sbb-pearl-chain__time-walktime--walk-small-right{margin-inline-start:calc(var(--sbb-spacing-fixed-2x) - .25rem)}.sbb-pearl-chain__time-walktime--wheelchair-small-left{margin-inline-end:calc(var(--sbb-spacing-fixed-2x) - .4375rem);transform:translate(-.375rem)}.sbb-pearl-chain__time-walktime--wheelchair-small-right{margin-inline-start:calc(var(--sbb-spacing-fixed-2x) - .25rem)}.sbb-pearl-chain__time-walktime-prime-symbol{float:right}.sbb-pearl-chain__time-transfer{gap:var(--sbb-spacing-fixed-1x)}.sbb-pearl-chain__time-transfer--sa-ci-departure{margin-inline-end:var(--sbb-spacing-fixed-2x)}.sbb-pearl-chain__time-transfer--sa-ci-arrival{margin-inline-start:calc(var(--sbb-spacing-fixed-2x) - .25rem)}.sbb-pearl-chain__time-chain{margin-inline:var(--sbb-spacing-fixed-3x);flex:auto;align-self:center}.sbb-pearl-chain__time-time{--sbb-text-font-size:var(--sbb-text-font-size-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);color:var(--sbb-color-2);font-weight:700}
2
2
  `;let Te=(()=>{let h=n,g=[],_,v=[],y=[],b,x=[],S=[],C,w=[],T=[],E,D=[],O=[],k,A=[],j=[],M,N=[],P=[],F,I=[],L=[],R;return class extends h{constructor(){super(...arguments),this.#e=(t(this,g),t(this,v,[])),this.#t=(t(this,y),t(this,x,``)),this.#n=(t(this,S),t(this,w,``)),this.#r=(t(this,T),t(this,D,NaN)),this.#i=(t(this,O),t(this,A,NaN)),this.#a=(t(this,j),t(this,N,!1)),this.#o=(t(this,P),t(this,I,!1)),this._now=(t(this,L),null),this._language=new r(this)}static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;_=[p({type:Array})],b=[a(),p({attribute:`departure-time`})],C=[a(),p({attribute:`arrival-time`})],E=[a(),p({attribute:`departure-walk`,type:Number})],k=[a(),p({attribute:`arrival-walk`,type:Number})],M=[a(),p({attribute:`disable-animation`,type:Boolean})],F=[a(),p({attribute:`a11y-footpath`,type:Boolean})],R=[p()],e(this,null,_,{kind:`accessor`,name:`legs`,static:!1,private:!1,access:{has:e=>`legs`in e,get:e=>e.legs,set:(e,t)=>{e.legs=t}},metadata:t},v,y),e(this,null,b,{kind:`accessor`,name:`departureTime`,static:!1,private:!1,access:{has:e=>`departureTime`in e,get:e=>e.departureTime,set:(e,t)=>{e.departureTime=t}},metadata:t},x,S),e(this,null,C,{kind:`accessor`,name:`arrivalTime`,static:!1,private:!1,access:{has:e=>`arrivalTime`in e,get:e=>e.arrivalTime,set:(e,t)=>{e.arrivalTime=t}},metadata:t},w,T),e(this,null,E,{kind:`accessor`,name:`departureWalk`,static:!1,private:!1,access:{has:e=>`departureWalk`in e,get:e=>e.departureWalk,set:(e,t)=>{e.departureWalk=t}},metadata:t},D,O),e(this,null,k,{kind:`accessor`,name:`arrivalWalk`,static:!1,private:!1,access:{has:e=>`arrivalWalk`in e,get:e=>e.arrivalWalk,set:(e,t)=>{e.arrivalWalk=t}},metadata:t},A,j),e(this,null,M,{kind:`accessor`,name:`disableAnimation`,static:!1,private:!1,access:{has:e=>`disableAnimation`in e,get:e=>e.disableAnimation,set:(e,t)=>{e.disableAnimation=t}},metadata:t},N,P),e(this,null,F,{kind:`accessor`,name:`a11yFootpath`,static:!1,private:!1,access:{has:e=>`a11yFootpath`in e,get:e=>e.a11yFootpath,set:(e,t)=>{e.a11yFootpath=t}},metadata:t},I,L),e(this,null,R,{kind:`setter`,name:`now`,static:!1,private:!1,access:{has:e=>`now`in e,set:(e,t)=>{e.now=t}},metadata:t},null,g),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-pearl-chain-time`}static{this.elementDependencies=[u,re]}static{this.styles=[l,ee(we)]}#e;get legs(){return this.#e}set legs(e){this.#e=e}#t;get departureTime(){return this.#t}set departureTime(e){this.#t=e}#n;get arrivalTime(){return this.#n}set arrivalTime(e){this.#n=e}#r;get departureWalk(){return this.#r}set departureWalk(e){this.#r=e}#i;get arrivalWalk(){return this.#i}set arrivalWalk(e){this.#i=e}#a;get disableAnimation(){return this.#a}set disableAnimation(e){this.#a=e}#o;get a11yFootpath(){return this.#o}set a11yFootpath(e){this.#o=e}set now(e){this._now=i.getValidDateOrNull(i.deserialize(e))}get now(){return this._now??new Date}render(){let e=this.departureTime?m(this.departureTime):void 0,t=this.arrivalTime?m(this.arrivalTime):void 0,{renderDepartureTimeAttribute:n,renderArrivalTimeAttribute:r}=te(this.legs,this.departureWalk||0,this.arrivalWalk||0,this._language.current,this.a11yFootpath),i=this.legs?.filter(e=>ne(e));return d`
3
3
  <div class="sbb-pearl-chain__time">
4
4
  ${n()}
@@ -13,8 +13,8 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbElement as
13
13
  <span
14
14
  class="sbb-pearl-chain__bullet ${g} ${c} ${p}"
15
15
  ></span>
16
- ${t?.map((n,r)=>{let{stopPoints:i,serviceAlteration:a}=n?.serviceJourney||{},c=this._getRelativeDuration(t,n),l=f(n.departure?.time),d=f(n.arrival?.time),p=i&&i[i.length-1]?.stopStatus===`NOT_SERVICED`,m=i&&i[i.length-1]?.stopStatus===`PLANNED`,h=i&&i[0]?.stopStatus===`NOT_SERVICED`,g=r>0&&t[r-1].serviceJourney.stopPoints,_=g&&g[g.length-1]?.stopStatus===`NOT_SERVICED`,v=p||h&&m?`sbb-pearl-chain__leg--skipped`:``,y=h||_?`sbb-pearl-chain__stop--departure-skipped`:``,b=a?.cancelled||a?.partiallyCancelled?`sbb-pearl-chain__leg--disruption`:``,x=n.serviceJourney?.serviceAlteration?.cancelledExpected?`sbb-pearl-chain__leg--cancelled-expected`:``,S={time:l,delay:n.departure?.delay??0},C={time:d,delay:n.arrival?.delay??0},w=this._getStatus(e,S,C);return o` <div
17
- class="sbb-pearl-chain__leg ${!b&&!v&&`sbb-pearl-chain__leg--`+w||``} ${b} ${v} ${x}"
16
+ ${t?.map((n,r)=>{let{stopPoints:i,serviceAlteration:a}=n?.serviceJourney||{},c=this._getRelativeDuration(t,n),l=f(n.departure?.time),d=f(n.arrival?.time),p=i&&i[i.length-1]?.stopStatus===`NOT_SERVICED`,m=i&&i[i.length-1]?.stopStatus===`PLANNED`,h=i&&i[0]?.stopStatus===`NOT_SERVICED`,g=r>0&&t[r-1].serviceJourney.stopPoints,_=g&&g[g.length-1]?.stopStatus===`NOT_SERVICED`,v=p||h&&m?`sbb-pearl-chain__leg--skipped`:``,y=h||_?`sbb-pearl-chain__stop--departure-skipped`:``,b=a?.cancelled||a?.partiallyCancelled?`sbb-pearl-chain__leg--disruption`:``,x=n.serviceJourney?.serviceAlteration?.cancelledExpected?`sbb-pearl-chain__leg--cancelled-expected`:``,S={time:l,delay:n.departure?.delay??0},C={time:d,delay:n.arrival?.delay??0},w=this._getStatus(e,S,C),T=!b&&!v&&`sbb-pearl-chain__leg--`+w;return o` <div
17
+ class="sbb-pearl-chain__leg ${T||``} ${b} ${v} ${x}"
18
18
  style=${u({"--sbb-pearl-chain-leg-width":`${c}%`,...w===`progress`&&!b&&!v&&!x?{"--sbb-pearl-chain-leg-status":`${this._getProgress(e,S,C)}%`}:{}})}
19
19
  >
20
20
  ${r>0&&r<t.length?o`<span class="sbb-pearl-chain__stop ${y}"></span>`:s}
@@ -290,8 +290,8 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
290
290
  .name=${e}
291
291
  ></sbb-seat-reservation-graphic>
292
292
  <span ${this.text??p} class="sbb-sr-place-ctrl__text">${r} </span>
293
- </div>`}_getPlaceSvg(e,t){return`PLACE_${e}_${t}`}_getTitleDescriptionPlace(e){let t=I(`PLACE_CONTROL_`+this.type+`_`+this.state,this._language.current,[this.text]),n=this._getRelativeTravelDirection(e);return(this.propertyIds.length||n)&&(t+=`. `+I(`PLACE_PROPERTY`,this._language.current).concat(`: `),t+=[n,...this.propertyIds].map(e=>I(`PLACE_PROPERTIES.`+e,this._language.current)).filter(e=>e).join(`, `)),t}_getRelativeTravelDirection(e){if(!this.travelDirection||this.travelDirection===`NONE`||this.placeType!==`SEAT`||!e)return;let t=Number(e);if(t===90||t===270)return`TRAVEL_DIRECTION_TRANSVERSELY`;if(t===0&&this.travelDirection===`RIGHT`||t===180&&this.travelDirection===`LEFT`)return`TRAVEL_DIRECTION_IN_DIRECTION`;if(t===0||t===180)return`TRAVEL_DIRECTION_IN_OPPOSITE_DIRECTION`}_selectPlace(){if((this.state===`FREE`||this.state===`SELECTED`)&&!this.preventClick){this.state=this.state===`FREE`?`SELECTED`:`FREE`;let e={id:this.id,deckIndex:this.deckIndex,coachIndex:this.coachIndex,number:this.text,state:this.state,placeType:this.placeType};this.dispatchEvent(new q(e))}}}})();var Y=`:host{--sbb-seat-reservation-scoped-width:0;--sbb-seat-reservation-scoped-height:0;width:calc(var(--sbb-seat-reservation-scoped-width) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:calc(var(--sbb-seat-reservation-scoped-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));display:block}
294
- `,X=class extends r{static{this.elementName=`sbb-seat-reservation-scoped`}static{this.styles=[m(Y)]}render(){return d`<slot></slot>`}},Z;(function(e){e.right=`right`,e.left=`left`})(Z||={});const ee=[`sa-vo`,`sa-rs`,`sa-abteilkinderwagen`,`sa-wr`,`sa-fa`,`sa-bz`,`sa-rz`];var te=class extends Event{get detail(){return this._detail}constructor(e){super(`selectedplaces`,{bubbles:!0,composed:!0}),this._detail=e}},ne=class extends Event{get detail(){return this._detail}constructor(e){super(`selectedcoach`,{bubbles:!0,composed:!0}),this._detail=e}};let Q=(()=>{let n=r,i=[],a,c=[],l=[],u,d=[],p=[],m,v=[],y=[],b,x=[],S=[],C,w=[],T=[],E,D=[],O=[],k,N=[],F=[],I,L=[],R=[],z,B=[],V=[],H,U=[],W=[],G,K=[],q=[],J,Y=[],X=[],Q,$=[],re=[],ie,ae=[],oe=[],se;return class extends n{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;a=[g({attribute:`seat-reservations`,type:Array})],u=[g({attribute:`travel-direction`,type:String})],m=[o(),g({attribute:`has-navigation`,type:Boolean})],b=[o(),g({attribute:`align-vertical`,type:Boolean,reflect:!0,useDefault:!0})],C=[o(),g({attribute:`base-grid-size`,type:Number})],E=[o(),g({attribute:`height`,type:Number})],k=[o(),g({attribute:`max-seat-reservations`,type:Number})],I=[o(),g({attribute:`max-bicycle-reservations`,type:Number})],z=[o(),g({attribute:`prevent-place-click`,type:Boolean})],H=[o(),g({attribute:`preselect-coach-index`,type:Number})],G=[o(),g({attribute:`show-title-info`,type:Boolean})],J=[_()],Q=[_()],ie=[_()],se=[h({passive:!0})],e(this,null,a,{kind:`accessor`,name:`seatReservations`,static:!1,private:!1,access:{has:e=>`seatReservations`in e,get:e=>e.seatReservations,set:(e,t)=>{e.seatReservations=t}},metadata:t},c,l),e(this,null,u,{kind:`accessor`,name:`travelDirection`,static:!1,private:!1,access:{has:e=>`travelDirection`in e,get:e=>e.travelDirection,set:(e,t)=>{e.travelDirection=t}},metadata:t},d,p),e(this,null,m,{kind:`accessor`,name:`hasNavigation`,static:!1,private:!1,access:{has:e=>`hasNavigation`in e,get:e=>e.hasNavigation,set:(e,t)=>{e.hasNavigation=t}},metadata:t},v,y),e(this,null,b,{kind:`accessor`,name:`alignVertical`,static:!1,private:!1,access:{has:e=>`alignVertical`in e,get:e=>e.alignVertical,set:(e,t)=>{e.alignVertical=t}},metadata:t},x,S),e(this,null,C,{kind:`accessor`,name:`baseGridSize`,static:!1,private:!1,access:{has:e=>`baseGridSize`in e,get:e=>e.baseGridSize,set:(e,t)=>{e.baseGridSize=t}},metadata:t},w,T),e(this,null,E,{kind:`accessor`,name:`height`,static:!1,private:!1,access:{has:e=>`height`in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:t},D,O),e(this,null,k,{kind:`accessor`,name:`maxSeatReservations`,static:!1,private:!1,access:{has:e=>`maxSeatReservations`in e,get:e=>e.maxSeatReservations,set:(e,t)=>{e.maxSeatReservations=t}},metadata:t},N,F),e(this,null,I,{kind:`accessor`,name:`maxBicycleReservations`,static:!1,private:!1,access:{has:e=>`maxBicycleReservations`in e,get:e=>e.maxBicycleReservations,set:(e,t)=>{e.maxBicycleReservations=t}},metadata:t},L,R),e(this,null,z,{kind:`accessor`,name:`preventPlaceClick`,static:!1,private:!1,access:{has:e=>`preventPlaceClick`in e,get:e=>e.preventPlaceClick,set:(e,t)=>{e.preventPlaceClick=t}},metadata:t},B,V),e(this,null,H,{kind:`accessor`,name:`preselectCoachIndex`,static:!1,private:!1,access:{has:e=>`preselectCoachIndex`in e,get:e=>e.preselectCoachIndex,set:(e,t)=>{e.preselectCoachIndex=t}},metadata:t},U,W),e(this,null,G,{kind:`accessor`,name:`showTitleInfo`,static:!1,private:!1,access:{has:e=>`showTitleInfo`in e,get:e=>e.showTitleInfo,set:(e,t)=>{e.showTitleInfo=t}},metadata:t},K,q),e(this,null,J,{kind:`accessor`,name:`selectedCoachIndex`,static:!1,private:!1,access:{has:e=>`selectedCoachIndex`in e,get:e=>e.selectedCoachIndex,set:(e,t)=>{e.selectedCoachIndex=t}},metadata:t},Y,X),e(this,null,Q,{kind:`accessor`,name:`focusedCoachIndex`,static:!1,private:!1,access:{has:e=>`focusedCoachIndex`in e,get:e=>e.focusedCoachIndex,set:(e,t)=>{e.focusedCoachIndex=t}},metadata:t},$,re),e(this,null,ie,{kind:`accessor`,name:`hoveredCoachIndex`,static:!1,private:!1,access:{has:e=>`hoveredCoachIndex`in e,get:e=>e.hoveredCoachIndex,set:(e,t)=>{e.hoveredCoachIndex=t}},metadata:t},ae,oe),e(this,null,se,{kind:`method`,name:`coachAreaScrollend`,static:!1,private:!1,access:{has:e=>`coachAreaScrollend`in e,get:e=>e.coachAreaScrollend},metadata:t},null,i),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.events={selectedplaces:`selectedplaces`,selectedcoach:`selectedcoach`}}#e;get seatReservations(){return this.#e}set seatReservations(e){this.#e=e}#t;get travelDirection(){return this.#t}set travelDirection(e){this.#t=e}#n;get hasNavigation(){return this.#n}set hasNavigation(e){this.#n=e}#r;get alignVertical(){return this.#r}set alignVertical(e){this.#r=e}#i;get baseGridSize(){return this.#i}set baseGridSize(e){this.#i=e}#a;get height(){return this.#a}set height(e){this.#a=e}#o;get maxSeatReservations(){return this.#o}set maxSeatReservations(e){this.#o=e}#s;get maxBicycleReservations(){return this.#s}set maxBicycleReservations(e){this.#s=e}#c;get preventPlaceClick(){return this.#c}set preventPlaceClick(e){this.#c=e}#l;get preselectCoachIndex(){return this.#l}set preselectCoachIndex(e){this.#l=e}#u;get showTitleInfo(){return this.#u}set showTitleInfo(e){this.#u=e}#d;get selectedCoachIndex(){return this.#d}set selectedCoachIndex(e){this.#d=e}#f;get focusedCoachIndex(){return this.#f}set focusedCoachIndex(e){this.#f=e}#p;get hoveredCoachIndex(){return this.#p}set hoveredCoachIndex(e){this.#p=e}constructor(){super(),this.#e=(t(this,i),t(this,c,null)),this.#t=(t(this,l),t(this,d,`NONE`)),this.#n=(t(this,p),t(this,v,!0)),this.#r=(t(this,y),t(this,x,!1)),this.#i=(t(this,S),t(this,w,16)),this.#a=(t(this,T),t(this,D,null)),this.#o=(t(this,O),t(this,N,-1)),this.#s=(t(this,F),t(this,L,-1)),this.#c=(t(this,R),t(this,B,!1)),this.#l=(t(this,V),t(this,U,-1)),this.#u=(t(this,W),t(this,K,!1)),this.#d=(t(this,q),t(this,Y,-1)),this.#f=(t(this,X),t(this,$,-1)),this.#p=(t(this,re),t(this,ae,-1)),this.coachBorderPadding=(t(this,oe),6),this.gapBetweenCoaches=4,this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.gapBetweenCoachDecks=48,this.coachNavButtonDim=0,this.globalAreaIconDim={w:2,h:2},this.globalAreaIconPadding=.8,this.coachItemDetailsElements=[],this.currScrollDirection=Z.right,this.maxCalcCoachesWidth=0,this.scrollCoachesAreaWidth=0,this.scrollNavigationAreaDim=0,this.triggerCoachPositionsCollection=[],this.navigationScrollArea=null,this.coachScrollArea=null,this.currSelectedPlace=null,this.currSelectedPlaceElementId=null,this.currSelectedCoachIndex=-1,this.currSelectedDeckIndex=0,this.preventCoachScrollByPlaceClick=!1,this.selectedSeatReservationPlaces={seats:[],bicycles:[]},this.seatReservationWithoutNavigationHasFocus=!1,this.isCoachGridFocusable=!1,this.isAutoScrolling=!1,this.isKeyboardNavigation=!1,this.hasMultipleDecks=!1,this.hasSeatReservationNativeFocus=!1,this.keyboardNavigationEvents={ArrowLeft:`ArrowLeft`,ArrowRight:`ArrowRight`,ArrowUp:`ArrowUp`,ArrowDown:`ArrowDown`,Tab:`Tab`,Enter:`Enter`},this.seatReservationStructure={decks:[]},this.notFixedRotatableAreaIcons=[`ENTRY_EXIT`],this.notAreaElements=[`DRIVER_AREA`,`DRIVER_AREA_NO_VERTICAL_WALL`,`COACH_PASSAGE`,`COACH_WALL_NO_PASSAGE`,`COMPARTMENT_PASSAGE`,`COMPARTMENT_PASSAGE_HIGH`,`COMPARTMENT_PASSAGE_MIDDLE`,`COMPARTMENT_PASSAGE_LOW`,`COMPARTMENT_WALL`],this.middleBorderDockingElements=[`DRIVER_AREA`,`DRIVER_AREA_NO_VERTICAL_WALL`,`COACH_PASSAGE`,`COACH_WALL_NO_PASSAGE`],this._isRunningInitPreselectCoachIndex=!1,this._lastStartScrollPos=-1,this._prepareServiceIconsNavigation=e=>e&&e?.map(function(e){return{pId:e,svgName:P[e]?.svgName?P[e]?.svgName:``}}).filter(e=>ee.indexOf(e.svgName)!==-1).filter((e,t,n)=>n.map(e=>e.svgName).indexOf(e.svgName)===t).map(e=>e.pId).slice(0,3)||[],this.addEventListener(`blur`,()=>this._onLeaveSeatReservationComponent())}willUpdate(e){if(super.willUpdate(e),e.has(`seatReservations`)&&(this.hasMultipleDecks=this.seatReservations?.length>1,this._initPrepareSeatReservationData(),this._initSeatReservationPlaceSelection(),this.initNavigationSelectionByScrollEvent()),e.has(`baseGridSize`)&&(this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.style?.setProperty(`--sbb-seat-reservation-grid-size`,`${this.baseGridSize}px`),this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent()),e.has(`height`)&&this.height){let e=this.seatReservations[this.currSelectedDeckIndex]||null;e?.coachItems.length&&(this.baseGridSize=this.height/e.coachItems[0].dimension.h,this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.style?.setProperty(`--sbb-seat-reservation-grid-size`,`${this.baseGridSize}px`),this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent())}e.has(`alignVertical`)&&(this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent()),e.has(`preselectCoachIndex`)&&(this._isRunningInitPreselectCoachIndex=!0,setTimeout(()=>this.scrollToSelectedNavCoach(this.preselectCoachIndex),1))}navigateByDirectionBtn(e){this.unfocusPlaceElement();let t=this.currSelectedCoachIndex;e==`DIRECTION_LEFT`&&t>0?t=this.currSelectedCoachIndex==-1?0:this.currSelectedCoachIndex-1:e==`DIRECTION_RIGHT`&&t<this.seatReservations[this.currSelectedDeckIndex]?.coachItems.length-1&&(t=this.currSelectedCoachIndex==-1?0:this.currSelectedCoachIndex+1),this.scrollToSelectedNavCoach(t)}_initPrepareSeatReservationData(){this._determineBaseFontSize(),this.hasMultipleDecks&&this._initEmptyCoachDeckOffsets(),this._prepareCoachItemDetailsData(),this._prepareSeatReservationStructureInformation(),this._prepareOptimizeAreaIconDimensionByMedian()}initNavigationSelectionByScrollEvent(){this.coachScrollArea=this.shadowRoot?.querySelector(`#sbb-sr__wrapper-scrollarea`),this.navigationScrollArea=this.shadowRoot?.querySelector(`#sbb-sr__navigation-list-coaches`);let e=this.seatReservations?this.seatReservations[this.currSelectedDeckIndex]:null;if(e&&e.coachItems.length>0){let t=e.coachItems[0].dimension.h*this.baseGridSize+this.coachBorderPadding,n=(this.seatReservations.length-1)*this.gapBetweenCoachDecks;this.style?.setProperty(`--sbb-seat-reservation-height`,`${t*this.seatReservations.length+n}`),this.style?.setProperty(`--sbb-seat-reservation-decks`,`${this.seatReservations.length}`)}if(this.navigationScrollArea){this.scrollNavigationAreaDim=this.alignVertical?this.navigationScrollArea.getBoundingClientRect().height:this.navigationScrollArea.getBoundingClientRect().width;let e=this.navigationScrollArea.querySelector(`ul > li`);if(e){let t=e?.getBoundingClientRect();this.coachNavButtonDim=this.alignVertical?t.height:t.width}}if(this.coachScrollArea&&e){let t=0;this.scrollCoachesAreaWidth=this.alignVertical?this.coachScrollArea.getBoundingClientRect().height:this.coachScrollArea.getBoundingClientRect().width,this.triggerCoachPositionsCollection=e.coachItems.map((e,n)=>{let r=this.seatReservationStructure.decks[this.currSelectedDeckIndex].deckCoaches[n],i=t;return t+=r.width+(r.hasOverhangingElements?2*this.gapBetweenCoaches:this.gapBetweenCoaches),{start:i,end:t,width:r.width}}),this.maxCalcCoachesWidth=t-this.gapBetweenCoaches}}coachAreaScrollend(){this._scrollTimeout&&clearTimeout(this._scrollTimeout),this._scrollTimeout=setTimeout(()=>this._handleCoachAreaScrollendEvent(),150)}onFocusTableCoachAndPreselectPlace(e){!this.seatReservationWithoutNavigationHasFocus&&!this.hasNavigation&&(this.seatReservationWithoutNavigationHasFocus=!0,this.currSelectedCoachIndex=e===0?this.getNextAvailableCoachIndex(-1):this.getPrevAvailableCoachIndex(e),this.preselectPlaceInCoach())}onFocusNavDirectionButton(){this.focusedCoachIndex=-1}onKeyNavigationNavCoachButton(e,t){if(e.key===this.keyboardNavigationEvents.Tab){this._handleTabKeyNavigation(e,`navigation`,t);return}s(e)&&this.keyboardSeatmapEventHandling(e)}_handleTabKeyNavigation(e,t,n){let r=e.key,i=e.shiftKey;r===this.keyboardNavigationEvents.Tab&&(t==`navigation`?(n==this.currSelectedCoachIndex?!this.currSelectedPlace||!i||this.coachItemDetailsElements[n].isDriverArea||this.focusedCoachIndex==-1?this.focusedCoachIndex=n:i&&this.currSelectedPlace&&(this.focusedCoachIndex=-1,this.focusPlaceElement(this.currSelectedPlace)):this.focusedCoachIndex=n,this._scrollToSelectedNavigationButton(n)):t==`seatmap`&&(e.preventDefault(),i?this._navigateCoachNavigationByKeyboard(`PREV_TAB`):this._navigateCoachNavigationByKeyboard(`NEXT_TAB`)))}keyboardSeatmapEventHandling(e){let t=e.key===this.keyboardNavigationEvents.Tab,n=e.shiftKey&&t;if(!this.hasNavigation&&this.currSelectedCoachIndex===0&&n||this.currSelectedCoachIndex===this.coachItemDetailsElements.length-1&&t)return;let r=e.key;if(this.preventCoachScrollByPlaceClick=!1,!this.hasSeatReservationNativeFocus&&(t||n)&&(this.hasSeatReservationNativeFocus=!0),t){this._handleTabKeyNavigation(e,`seatmap`);return}if(this.currSelectedCoachIndex!==-1&&s(e))switch(e.preventDefault(),r){case this.keyboardNavigationEvents.ArrowLeft:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowDown:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowRight:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowUp:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowUp:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowLeft:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowDown:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowRight:r;this._navigateToPlaceByKeyboard(e)}break;default:break}}preselectPlaceInCoach(){if(this.isAutoScrolling){if(this._isRunningInitPreselectCoachIndex){this._isRunningInitPreselectCoachIndex=!1;return}if(this.coachItemDetailsElements[this.currSelectedCoachIndex]&&this.coachItemDetailsElements[this.currSelectedCoachIndex].isDriverArea){this._setFocusToSelectedCoachGrid();return}if(this.isKeyboardNavigation&&this.isAutoScrolling){let e=this._getClosestPlaceByKeyDirection();e?(this.unfocusPlaceElement(),this.focusPlaceElement(e),this.focusedCoachIndex=-1):this._setFocusToSelectedCoachGrid()}else this.unfocusPlaceElement(),this.isCoachGridFocusable=!0,this._setFocusToSelectedCoachGrid()}}scrollToSelectedNavCoach(e){if(this._isValidCoachIndex(e)&&e!==this.currSelectedCoachIndex){this.hoveredCoachIndex=e,this.isAutoScrolling=!0,this.isCoachGridFocusable=!0,this.currSelectedCoachIndex=e,this.currSelectedDeckIndex=this._getExistingCoachDeckIndex(),this._setScrollDirectionByCoachIndex();let t=this._getCoachScrollPositionX();(this.selectedCoachIndex!==-1||this.currSelectedCoachIndex>0)&&this._isScrollableToSelectedCoach()?(this._lastStartScrollPos=this.coachScrollArea.scrollLeft,this.coachScrollArea.scrollTo({top:this.alignVertical?t:0,left:this.alignVertical?0:t,behavior:`smooth`})):this.updateCurrentSelectedCoach(),this._scrollToSelectedNavigationButton(e)}}focusPlaceElement(e){if(this.unfocusPlaceElement(),e){this.currSelectedPlace=e,this._setCurrSelectedPlaceElementId(e);let t=this._getPlaceHtmlElement();if(t){t.setAttribute(`keyfocus`,`focus`);let n=setTimeout(()=>{let t=this.getPlaceElementId(this.currSelectedDeckIndex,this.currSelectedCoachIndex,e.number);this._scrollPlaceIntoNearestViewport(t),clearTimeout(n)},0)}}}unfocusPlaceElement(){let e=this._getPlaceHtmlElement();e&&(e.setAttribute(`keyfocus`,`unfocus`),this._setCurrSelectedPlaceElementId(null),this.currSelectedPlace=null)}getCalculatedDimension(e,t,n,r){return t&&!n&&(e.h+=this.coachBorderOffset*2),r&&(e.h+=this.coachBorderOffset),{w:Math.round(this.baseGridSize*e.w),h:Math.round(this.baseGridSize*e.h)}}getCalculatedPosition(e,t,n,r){if(n&&t){let i=r?n.h:n.h+this.coachBorderOffset;e.y===0?e.y-=this.coachBorderOffset:e.y+t.h===i&&(e.y+=this.coachBorderOffset)}return{x:Math.round(this.baseGridSize*e.x),y:Math.round(this.baseGridSize*e.y),z:e.z}}isElementDirectlyOnBorder(e,t){return e.position.y===0||e.position.y+e.dimension.h===t.h}getAvailableFreePlacesNumFromCoach(e){let t={seats:0,bicycles:0};return e?.reduce((e,t)=>(t.state===`FREE`&&(t.type===`SEAT`?e.seats++:e.bicycles++),e),t)||t}hasTravelDirection(){return this.travelDirection&&this.travelDirection!==`NONE`}_handleCoachAreaScrollendEvent(){let e=this.isAutoScrolling?this.currSelectedCoachIndex:this._getCoachIndexByScrollTriggerPosition();if(this.preventCoachScrollByPlaceClick){Math.abs(this._lastStartScrollPos-this.coachScrollArea.scrollLeft)>this.baseGridSize*2&&(this.selectedCoachIndex=e),this.preventCoachScrollByPlaceClick=!1;return}this._lastStartScrollPos=this.coachScrollArea.scrollLeft,this.hoveredCoachIndex=-1,this.currSelectedCoachIndex===-1&&(this.currSelectedCoachIndex=e),this._isScrollableToSelectedCoach()?this.currSelectedCoachIndex=e:this.currSelectedCoachIndex=e<this.currSelectedCoachIndex?this.currSelectedCoachIndex:e,this.isAutoScrolling||this._scrollToSelectedNavigationButton(e),this.preventCoachScrollByPlaceClick=!1,this.updateCurrentSelectedCoach(),this.hasNavigation||(this.preselectPlaceInCoach(),this.isAutoScrolling=!1)}_scrollToSelectedNavigationButton(e){setTimeout(()=>{if(this.hasNavigation&&this.navigationScrollArea){let t=this.scrollNavigationAreaDim/2,n=e*this.coachNavButtonDim-t+this.coachNavButtonDim;this.navigationScrollArea.scrollTo({top:this.alignVertical?n:0,left:this.alignVertical?0:n,behavior:`smooth`})}},10)}_setScrollDirectionByCoachIndex(){this.currScrollDirection=this.currSelectedCoachIndex>this.selectedCoachIndex?Z.right:Z.left}_getCoachScrollPositionX(){let e=this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];return this.isKeyboardNavigation&&this.currScrollDirection===Z.left&&e.width>this.scrollCoachesAreaWidth?e.end-this.scrollCoachesAreaWidth:e.start}_setFocusToSelectedCoachGrid(){if(this.isCoachGridFocusable&&this.hasSeatReservationNativeFocus){this.isCoachGridFocusable=!1;let e=this.shadowRoot?.querySelector(`#sbb-sr-coach-caption-`+this.currSelectedCoachIndex);e&&e.focus()}}_isScrollableToSelectedCoach(){let e=this.alignVertical?this.coachScrollArea.scrollTop:this.coachScrollArea.scrollLeft,t=this.alignVertical?this.coachScrollArea.getBoundingClientRect().height:this.coachScrollArea.getBoundingClientRect().width,n=this.maxCalcCoachesWidth-t,r=this.triggerCoachPositionsCollection[this.currSelectedCoachIndex],i=e===this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;return(e<n||e>r.start)&&!i}_getCoachIndexByScrollTriggerPosition(){let e=(this.alignVertical?this.coachScrollArea.scrollTop:this.coachScrollArea.scrollLeft)+this.scrollCoachesAreaWidth/2;return this.triggerCoachPositionsCollection.findIndex(t=>e>=t.start&&e<=t.end)}_getFirstPlaceInSelectedCoach(){let e=null,t=this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex],n=`cell-`+this.currSelectedDeckIndex+`-`+this.currSelectedCoachIndex+`-0-0`,r=this.shadowRoot?.querySelector(`#`+n)?.querySelector(`sbb-seat-reservation-place-control`)?.getAttribute(`text`)||null;return t&&r&&(e=t.places?.find(e=>e.number===r)||null),e}_getSwitchedCoachDeckIndexByKeyNavigation(e,t){return!this.currSelectedPlace||e===this.keyboardNavigationEvents.ArrowRight||e===this.keyboardNavigationEvents.ArrowLeft?null:e===this.keyboardNavigationEvents.ArrowDown&&this.currSelectedPlace.position.y+2===t.dimension.h&&this.seatReservations[this.currSelectedDeckIndex+1]?this.currSelectedDeckIndex+1:e===this.keyboardNavigationEvents.ArrowUp&&this.currSelectedPlace.position.y===0&&this.seatReservations[this.currSelectedDeckIndex-1]?this.currSelectedDeckIndex-1:null}_getClosestPlaceByKeyDirection(e){let t=this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex],n=null,r=t.places,i=null;if(r){if(!this.currSelectedPlaceElementId)return this._getFirstPlaceInSelectedCoach();if(this.currSelectedPlace){let a={...this.currSelectedPlace.position};e&&(i=this._getSwitchedCoachDeckIndexByKeyNavigation(e,t),i!==null&&(r=this.seatReservations[i].coachItems[this.currSelectedCoachIndex].places||[],a.y=i<this.currSelectedDeckIndex?t.dimension.h:-1));for(let t of r)e?t.number!==this.currSelectedPlace?.number&&(e===this.keyboardNavigationEvents.ArrowRight&&(t.position.y===a.y||t.position.y===a.y-1)&&t.position.x>a.x&&(!n||t.position.x<n.position.x)||e===this.keyboardNavigationEvents.ArrowDown&&(t.position.x===a.x||t.position.x===a.x+1)&&t.position.y>a.y&&(!n||t.position.y<n.position.y)||e===this.keyboardNavigationEvents.ArrowLeft&&(t.position.y===a.y||t.position.y===a.y+1)&&t.position.x<a.x&&(!n||t.position.x>n.position.x)||e===this.keyboardNavigationEvents.ArrowUp&&(t.position.x===a.x||t.position.x===a.x-1)&&t.position.y<a.y&&(!n||t.position.y>n.position.y))&&(n=t):(this.currScrollDirection===Z.right&&t.position.y===a.y&&(!n||t.position.x<n.position.x)||this.currScrollDirection===Z.left&&t.position.y===a.y&&(!n||t.position.x>n.position.x))&&(n=t);i!==null&&n&&(this.currSelectedDeckIndex=i)}}return n}_navigateCoachNavigationByKeyboard(e){let t=this.focusedCoachIndex===-1?this.currSelectedCoachIndex===-1?0:this.currSelectedCoachIndex:this.focusedCoachIndex,n=e===`NEXT_TAB`?this.getNextAvailableCoachIndex(t):this.getPrevAvailableCoachIndex(t);if(this.hasNavigation){let r=this._getPlaceHtmlElement(),i=r?r.getAttribute(`keyfocus`)===`focus`:!1;if(e===`PREV_TAB`&&this.selectedCoachIndex===t)if(i||this.currSelectedPlace!==null){this.focusedCoachIndex=t,this.unfocusPlaceElement();return}else t===0?this._refocusCurrentFocusedNavCoach(t):this.focusedCoachIndex=n;else n===this.currSelectedCoachIndex?e===`NEXT_TAB`&&n===this.coachItemDetailsElements.length-1?this._refocusCurrentFocusedNavCoach(t):(this.focusedCoachIndex=-1,this.selectedCoachIndex=n,i?this.focusPlaceElement(this.currSelectedPlace):(this.isCoachGridFocusable=!0,this._setFocusToSelectedCoachGrid())):this.focusedCoachIndex=n;this._scrollToSelectedNavigationButton(n)}else this.scrollToSelectedNavCoach(n)}_refocusCurrentFocusedNavCoach(e){this.focusedCoachIndex=-1,setTimeout(()=>this.focusedCoachIndex=e,0)}_navigateToPlaceByKeyboard(e){if(this.isKeyboardNavigation=!0,this.focusedCoachIndex!==-1&&(this.focusedCoachIndex=-1),!this.preventPlaceClick){let t=this._getClosestPlaceByKeyDirection(e);if(t)this.focusPlaceElement(t);else if(e===this.keyboardNavigationEvents.ArrowRight||e===this.keyboardNavigationEvents.ArrowLeft||this.alignVertical&&(e===this.keyboardNavigationEvents.ArrowUp||e===this.keyboardNavigationEvents.ArrowDown)){let t=e===this.keyboardNavigationEvents.ArrowRight?this.getNextAvailableCoachIndex():this.getPrevAvailableCoachIndex();this.scrollToSelectedNavCoach(t)}}}getNextAvailableCoachIndex(e){let t=e??this.currSelectedCoachIndex;return t<this.seatReservations[this.currSelectedDeckIndex].coachItems.length-1?t+1:t}getPrevAvailableCoachIndex(e){let t=e??this.currSelectedCoachIndex;return t>0?t-1:t}updateSelectedSeatReservationPlaces(e){let t=e.placeType===`SEAT`?`seats`:`bicycles`,n=e.placeType===`SEAT`?this.maxSeatReservations:this.maxBicycleReservations,r=this.selectedSeatReservationPlaces[t];this.selectedSeatReservationPlaces[t]=this._updateSelectedSeatReservationPlaces(r,n,e);let i=this.selectedSeatReservationPlaces;this.dispatchEvent(new te(i))}_updateSelectedSeatReservationPlaces(e,t,n){if(n.state===`SELECTED`){let t=this._getDeckIndexByPlaceId(n.id),r=this._getSeatReservationPlaceSelection(n,t);r&&e.push(r)}else e=e.filter(e=>e.id!==n.id);if(t>-1&&e.length>t){let r=t>0?n:void 0;e=this._resetAllPlaceSelections(e,r)}return e}updateCurrentSelectedPlaceInCoach(e){let t=this._getDeckIndexByPlaceId(e.id),n=e.coachIndex;if(t===null)return;let r=this.seatReservations[t].coachItems[n].places?.find(t=>t.number==e.number);if(!r)return;this.currSelectedDeckIndex=t,this.currSelectedCoachIndex=n,this.currSelectedPlace=r,this.currSelectedCoachIndex!==this.selectedCoachIndex&&this.updateCurrentSelectedCoach(),this._setCurrSelectedPlaceElementId(r);let i=setTimeout(()=>{this._scrollPlaceIntoNearestViewport(e.id),clearTimeout(i)},0)}updateCurrentSelectedCoach(){if(this.currSelectedCoachIndex==this.selectedCoachIndex)return;this.focusedCoachIndex!=-1&&(this.focusedCoachIndex=this.currSelectedCoachIndex),this.selectedCoachIndex=this.currSelectedCoachIndex;let e=this._getSeatReservationSelectedCoach(this.selectedCoachIndex);e&&this.dispatchEvent(new ne(e))}getPlaceElementId(e,t,n){return`seat-reservation__place-button-`+e+`-`+t+`-`+n}_initEmptyCoachDeckOffsets(){let e=Array(this.seatReservations.length-1).fill(0);this.seatReservations[this.seatReservations.length-1].coachItems.forEach(t=>{for(let n=0;n<this.seatReservations.length-1;n++){let r=this.seatReservations[n].coachItems[e[n]];if(t.id!=r?.id){let r={...t,places:void 0,propertyIds:void 0,graphicElements:void 0,serviceElements:void 0,travelClass:[]};this.seatReservations[n].coachItems.splice(e[n],0,r)}e[n]++}})}_initSeatReservationPlaceSelection(){this.selectedSeatReservationPlaces.seats=[],this.selectedSeatReservationPlaces.bicycles=[],this.seatReservations?.forEach((e,t)=>e.coachItems.map((n,r)=>{n.places?.filter(e=>e.state===`SELECTED`)?.forEach(n=>{let i=A(n,this.getPlaceElementId(t,r,n.number),e.deckCoachIndex,r),a=this._getSeatReservationPlaceSelection(i,t);a&&(a.placeType===`SEAT`?this.selectedSeatReservationPlaces.seats.push(a):this.selectedSeatReservationPlaces.bicycles.push(a))})}))}_resetAllPlaceSelections(e,t){for(let n of e)if(!t||t.id!==n.id){let e=this.shadowRoot?.getElementById(n.id);e&&e.setAttribute(`state`,`FREE`)}return e=t?e.filter(e=>e.id===t.id):[],e}_getSeatReservationPlaceSelection(e,t){if(t===null)return null;let n=this.seatReservations[t].coachItems[e.coachIndex],r=n.places?.find(t=>t.number===e.number);return r?j(r,n,e.id,e.deckIndex,e.coachIndex):null}_getSeatReservationSelectedCoach(e){if(!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])return null;let t=this.seatReservations[this.currSelectedDeckIndex].coachItems[e];return M(e,t,this.getAvailableFreePlacesNumFromCoach(t.places))}_setCurrSelectedPlaceElementId(e){this.currSelectedPlaceElementId=e?this.getPlaceElementId(this.currSelectedDeckIndex,this.currSelectedCoachIndex,e.number):null}_determineBaseFontSize(){if(!f){let e=1/parseInt(window.getComputedStyle(document.body).fontSize,10);this.style?.setProperty(`--sbb-seat-reservation-one-px-rem`,`${e+`rem`}`)}}_prepareCoachItemDetailsData(){if(this.seatReservations){let e=this.seatReservations[this.seatReservations.length-1].coachItems;this.coachItemDetailsElements=[],e.forEach((e,t)=>{let n=[],r=[],i=[];this.seatReservations.map(e=>e.coachItems[t]).forEach(e=>{n.push(...e.travelClass),r.push(...e.propertyIds?e.propertyIds:[]),i.push(...e.places?e.places:[])}),this.coachItemDetailsElements.push({id:e.id,travelClass:this._prepareTravelClassNavigation(n),propertyIds:this._prepareServiceIconsNavigation(r),isDriverArea:!e.places||e.places.length===0,isLocomotive:this._isLocomotive(e),driverAreaSide:this._prepareDriverAreaSideNavigation(e),freePlaces:this.getAvailableFreePlacesNumFromCoach(i)})})}}_prepareOptimizeAreaIconDimensionByMedian(){if(this.seatReservations){let e=[];if(this.seatReservations.forEach(t=>t.coachItems.forEach(t=>t.serviceElements?.forEach(t=>e.push(t.dimension)))),e.length){e.sort((e,t)=>{if(e&&t){let n=e.w+e.h,r=t.w+t.h;return n>r?1:n<r?-1:0}return 0});let t=e[Math.floor(e.length/2)];this.globalAreaIconDim=this.getCalculatedDimension(t)}else{let e=this.seatReservations.flatMap(e=>e.coachItems.map(e=>e.dimension.h)).reduce((e,t)=>Math.max(e,t),0),t=Math.floor(e*.2);this.globalAreaIconDim=this.getCalculatedDimension({w:t,h:t})}}}_prepareTravelClassNavigation(e){return e.indexOf(`FIRST`)===-1?e.indexOf(`SECOND`)===-1?`ANY_CLASS`:`SECOND`:`FIRST`}_prepareDriverAreaSideNavigation(e){let t=e.graphicElements?.filter(e=>e.icon===`DRIVER_AREA`);if(t&&t.length>0){let e=t.find(e=>e.position.x===0)||!1,n=t.find(e=>e.position.x>0)||!1;return{left:!!e,right:!!n}}}_prepareSeatReservationStructureInformation(){this.seatReservations&&(this.seatReservationStructure={decks:[]},this.seatReservations.forEach((e,t)=>{let n={deckIndex:t,deckCoaches:[]};e?.coachItems?.forEach(e=>{let t=(e.graphicElements?.filter(e=>e.icon&&!this.notAreaElements.includes(e.icon)))?.concat(e.serviceElements||[]).concat(e.places||[])||[],r=this._isOverhangingElementsPresent(e.dimension.w,t),i=e.graphicElements?.filter(e=>!this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`AREA`)),a=e.graphicElements?.filter(e=>this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`OTHER`)),o=e.serviceElements?.map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`SERVICE`)),s=this._getCalculatedMiddleBorderElement(e),c=this.getCalculatedDimension({...e.dimension}),l={width:c.w,height:c.h,otherElements:a||[],serviceElements:o||[],areaElements:i||[],borderMiddleElement:s,hasOverhangingElements:r};n.deckCoaches.push(l)}),this.seatReservationStructure.decks.push(n)}))}_getCalculatedMiddleBorderElement(e){let t=(e.dimension.h+this.coachBorderOffset*2)*this.baseGridSize,n=0,r=e.dimension.w;if(e.graphicElements){let t=this._getFirstLastDockingElements(e.graphicElements);if(t?.length==2){let i=t[0],a=t[1],o=i.position.x==0?a.dimension.w:i.dimension.w;n=i.position.x==0?i.dimension.w:a.dimension.w,r=e.dimension.w-o-n}else if(t?.length==1){let i=t[0];i.position.x===0?(n=i.dimension.w,r=e.dimension.w-i.dimension.w):i.position.x!==0&&(r=e.dimension.w-i.dimension.w)}}let i=this.coachBorderPadding*-1;return{position:{x:Math.floor(n*this.baseGridSize)-1,y:i,z:0},dimension:{w:Math.floor(r*this.baseGridSize)+2,h:t}}}_getFirstLastDockingElements(e){let t=(e.filter(e=>this.middleBorderDockingElements.includes(e.icon))||[]).sort((e,t)=>{let n=e.position.x,r=t.position.x;return n>r?1:n<r?-1:0});return t.filter((e,n)=>n==0||n==t.length-1)}_getCalculatedDimensionPositionElement(e,t,n){let r={...e.dimension},i={...e.position},a=e.rotation||0,o=this.notAreaElements.concat(this.notFixedRotatableAreaIcons).indexOf(e.icon)===-1,s=this.alignVertical&&o?a-90:a,c=null;if(n===`AREA`){let n=e.icon?.indexOf(`TABLE`)===-1,a=e.icon&&n?e.icon:null,o=this.isElementDirectlyOnBorder(e,t)&&a!==`ENTRY_EXIT`;e.position.y===0?(c=`upper-border`,i.y-=this.coachBorderOffset-this.coachBorderOffset/3):e.position.y+e.dimension.h===t.h&&(c=`lower-border`,o||(i.y+=this.coachBorderOffset-this.coachBorderOffset/3)),o&&(r.h+=this.coachBorderOffset-this.coachBorderOffset/3)}else n===`OTHER`&&(e.position.y===0&&(i.y-=this.coachBorderOffset),t.h===e.position.y+e.dimension.h&&(r.h+=this.coachBorderOffset*2));return r.w=Math.floor(r.w*this.baseGridSize),r.h=Math.floor(r.h*this.baseGridSize),i.x=Math.floor(i.x*this.baseGridSize),i.y=Math.floor(i.y*this.baseGridSize),{icon:e.icon&&e.icon.endsWith(`DRIVER_AREA`)?e.icon?.concat(`_`,this.seatReservations[this.currSelectedDeckIndex].vehicleType):e.icon,rotation:s,dimension:r,position:i,mounting:c}}_getPlaceHtmlElement(){return this.currSelectedPlaceElementId&&this.shadowRoot?.getElementById(this.currSelectedPlaceElementId)||null}_getDeckIndexByPlaceId(e){let t=this.shadowRoot?.querySelector(`#`+e)?.getAttribute(`data-deck-index`);return t&&!isNaN(+t)?+t:null}_isValidCoachIndex(e){return e>=0&&e<=this.seatReservations[this.seatReservations.length-1].coachItems.length}_getExistingCoachDeckIndex(){if(this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex].places!==void 0)return this.currSelectedDeckIndex;let e=this.seatReservations.findIndex(e=>e.coachItems[this.currSelectedCoachIndex].places!==void 0);return this.currSelectedDeckIndex>=e?this.currSelectedDeckIndex:e}_scrollPlaceIntoNearestViewport(e){this.shadowRoot?.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`})}_isOverhangingElementsPresent(e,t){return t?.some(t=>t.position.x===0||t.position.x+t.dimension.w>=e)??!1}_isLocomotive(e){return e?.graphicElements?.find(e=>e.icon===`DRIVER_AREA_NO_VERTICAL_WALL`)!==void 0}_onLeaveSeatReservationComponent(){this.hasNavigation&&(this.focusedCoachIndex=-1),this.unfocusPlaceElement()}}})();var $=`:host{--sbb-seat-reservation-grid-size:16px;--sbb-seat-reservation-height:0;--sbb-seat-reservation-decks:1;height:inherit;display:block}:host ::part(coach-floor){fill:var(--sbb-background-color-2)}@media (forced-colors:active){:host ::part(coach-floor){fill:#0000}}:host(:dir(rtl)) :not(.sbb-sr-place-ctrl--type-bicycle,.sbb-sr-place-ctrl--orientation-90,.sbb-sr-place-ctrl--orientation-270,.sbb-sr-place-ctrl--state-selected) ::part(coach-floor){rotate:180deg}.sbb-sr-popover{margin-block:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}:host([align-vertical]) .sbb-sr__component{justify-content:flex-end;gap:calc(22 * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:inherit;flex-direction:row-reverse}@media (width>=37.5rem){:host([align-vertical]) .sbb-sr__component{gap:calc(54 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}}:host([align-vertical]) .sbb-sr__component--has-travel-direction{padding-block-start:calc(36 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation,:host([align-vertical]) .sbb-sr__component ul.sbb-sr-navigation__list-coaches{flex-direction:column}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation{padding:calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) 0}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button{left:calc(1 * var(--sbb-seat-reservation-one-px-rem,.0625rem));top:0;rotate:90deg}@media (width>=64rem){:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button{left:calc(-1 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches{max-width:initial;padding:calc(5 * var(--sbb-seat-reservation-one-px-rem,.0625rem));overflow:hidden scroll}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches li{display:flex}:host([align-vertical]) .sbb-sr__wrapper-coach-decks{flex-direction:column}:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels{width:calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:initial;flex-direction:column-reverse}:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b{inline-size:calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));block-size:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-bottom:calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));rotate:initial;writing-mode:initial}:host([align-vertical]) .sbb-sr__wrapper-scrollarea{width:calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:100%;overflow:hidden scroll}:host([align-vertical]) .sbb-sr__wrapper-scrollarea .sbb-sr__parent{rotate:90deg}:host([align-vertical]) .sbb-sr-travel-direction-wrapper{width:calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block-start:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));position:absolute}.sbb-sr-navigation{gap:calc(3 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr-navigation .sbb-sr__navigation-control-button{top:calc(2 * var(--sbb-seat-reservation-one-px-rem,.0625rem));position:relative}@media (width>=64rem){.sbb-sr-navigation .sbb-sr__navigation-control-button{top:0}}.sbb-sr__component{gap:calc(64 * var(--sbb-seat-reservation-one-px-rem,.0625rem) - 16px);flex-direction:column;display:flex}.sbb-sr-travel-direction-wrapper{justify-content:center;align-items:center;column-gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));font-size:var(--sbb-text-font-size-s);display:flex}.sbb-sr-travel-direction-wrapper .sbb-sr__travel-direction--arrow{align-items:center;display:flex}.sbb-sr-navigation-wrapper{display:flex}.sbb-sr-navigation{justify-content:center;width:100%;padding-inline:16px;display:flex}.sbb-sr-navigation__list-coaches{gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));padding:calc(6 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(5 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) 0;--sbb-scrollbar-color:transparent;flex-wrap:nowrap;max-width:856px;display:flex;position:relative;overflow:scroll hidden}.sbb-sr__wrapper-coach-decks{height:inherit;display:flex;overflow:hidden}.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels{height:calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));writing-mode:vertical-lr;justify-content:space-between;display:flex}.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b{height:calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));width:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));text-align:center;line-height:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block-end:16px;rotate:180deg}.sbb-sr__wrapper-scrollarea{padding-block:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));overflow:scroll hidden}.sbb-sr__wrapper-scrollarea .sbb-sr__parent{flex-direction:column;display:flex;position:relative}.sbb-sr__list-decks{flex-direction:column;display:flex}.sbb-sr__list-decks--gap{gap:calc(48 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr__list-item-deck{position:relative}.sbb-sr__list-coaches{gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));display:flex}.sbb-sr__list-decks:has(.sbb-sr-coach-has-overhanging-elements) .sbb-sr__list-coaches{gap:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr__item-coach{position:relative}.sbb-sr-coach-wrapper__table{outline:0}
293
+ </div>`}_getPlaceSvg(e,t){return`PLACE_${e}_${t}`}_getTitleDescriptionPlace(e){let t=`PLACE_CONTROL_`+this.type+`_`+this.state,n=I(t,this._language.current,[this.text]),r=this._getRelativeTravelDirection(e);return(this.propertyIds.length||r)&&(n+=`. `+I(`PLACE_PROPERTY`,this._language.current).concat(`: `),n+=[r,...this.propertyIds].map(e=>I(`PLACE_PROPERTIES.`+e,this._language.current)).filter(e=>e).join(`, `)),n}_getRelativeTravelDirection(e){if(!this.travelDirection||this.travelDirection===`NONE`||this.placeType!==`SEAT`||!e)return;let t=Number(e);if(t===90||t===270)return`TRAVEL_DIRECTION_TRANSVERSELY`;if(t===0&&this.travelDirection===`RIGHT`||t===180&&this.travelDirection===`LEFT`)return`TRAVEL_DIRECTION_IN_DIRECTION`;if(t===0||t===180)return`TRAVEL_DIRECTION_IN_OPPOSITE_DIRECTION`}_selectPlace(){if((this.state===`FREE`||this.state===`SELECTED`)&&!this.preventClick){this.state=this.state===`FREE`?`SELECTED`:`FREE`;let e={id:this.id,deckIndex:this.deckIndex,coachIndex:this.coachIndex,number:this.text,state:this.state,placeType:this.placeType};this.dispatchEvent(new q(e))}}}})();var Y=`:host{--sbb-seat-reservation-scoped-width:0;--sbb-seat-reservation-scoped-height:0;width:calc(var(--sbb-seat-reservation-scoped-width) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:calc(var(--sbb-seat-reservation-scoped-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));display:block}
294
+ `,X=class extends r{static{this.elementName=`sbb-seat-reservation-scoped`}static{this.styles=[m(Y)]}render(){return d`<slot></slot>`}},Z;(function(e){e.right=`right`,e.left=`left`})(Z||={});const ee=[`sa-vo`,`sa-rs`,`sa-abteilkinderwagen`,`sa-wr`,`sa-fa`,`sa-bz`,`sa-rz`];var te=class extends Event{get detail(){return this._detail}constructor(e){super(`selectedplaces`,{bubbles:!0,composed:!0}),this._detail=e}},ne=class extends Event{get detail(){return this._detail}constructor(e){super(`selectedcoach`,{bubbles:!0,composed:!0}),this._detail=e}};let Q=(()=>{let n=r,i=[],a,c=[],l=[],u,d=[],p=[],m,v=[],y=[],b,x=[],S=[],C,w=[],T=[],E,D=[],O=[],k,N=[],F=[],I,L=[],R=[],z,B=[],V=[],H,U=[],W=[],G,K=[],q=[],J,Y=[],X=[],Q,$=[],re=[],ie,ae=[],oe=[],se;return class extends n{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;a=[g({attribute:`seat-reservations`,type:Array})],u=[g({attribute:`travel-direction`,type:String})],m=[o(),g({attribute:`has-navigation`,type:Boolean})],b=[o(),g({attribute:`align-vertical`,type:Boolean,reflect:!0,useDefault:!0})],C=[o(),g({attribute:`base-grid-size`,type:Number})],E=[o(),g({attribute:`height`,type:Number})],k=[o(),g({attribute:`max-seat-reservations`,type:Number})],I=[o(),g({attribute:`max-bicycle-reservations`,type:Number})],z=[o(),g({attribute:`prevent-place-click`,type:Boolean})],H=[o(),g({attribute:`preselect-coach-index`,type:Number})],G=[o(),g({attribute:`show-title-info`,type:Boolean})],J=[_()],Q=[_()],ie=[_()],se=[h({passive:!0})],e(this,null,a,{kind:`accessor`,name:`seatReservations`,static:!1,private:!1,access:{has:e=>`seatReservations`in e,get:e=>e.seatReservations,set:(e,t)=>{e.seatReservations=t}},metadata:t},c,l),e(this,null,u,{kind:`accessor`,name:`travelDirection`,static:!1,private:!1,access:{has:e=>`travelDirection`in e,get:e=>e.travelDirection,set:(e,t)=>{e.travelDirection=t}},metadata:t},d,p),e(this,null,m,{kind:`accessor`,name:`hasNavigation`,static:!1,private:!1,access:{has:e=>`hasNavigation`in e,get:e=>e.hasNavigation,set:(e,t)=>{e.hasNavigation=t}},metadata:t},v,y),e(this,null,b,{kind:`accessor`,name:`alignVertical`,static:!1,private:!1,access:{has:e=>`alignVertical`in e,get:e=>e.alignVertical,set:(e,t)=>{e.alignVertical=t}},metadata:t},x,S),e(this,null,C,{kind:`accessor`,name:`baseGridSize`,static:!1,private:!1,access:{has:e=>`baseGridSize`in e,get:e=>e.baseGridSize,set:(e,t)=>{e.baseGridSize=t}},metadata:t},w,T),e(this,null,E,{kind:`accessor`,name:`height`,static:!1,private:!1,access:{has:e=>`height`in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:t},D,O),e(this,null,k,{kind:`accessor`,name:`maxSeatReservations`,static:!1,private:!1,access:{has:e=>`maxSeatReservations`in e,get:e=>e.maxSeatReservations,set:(e,t)=>{e.maxSeatReservations=t}},metadata:t},N,F),e(this,null,I,{kind:`accessor`,name:`maxBicycleReservations`,static:!1,private:!1,access:{has:e=>`maxBicycleReservations`in e,get:e=>e.maxBicycleReservations,set:(e,t)=>{e.maxBicycleReservations=t}},metadata:t},L,R),e(this,null,z,{kind:`accessor`,name:`preventPlaceClick`,static:!1,private:!1,access:{has:e=>`preventPlaceClick`in e,get:e=>e.preventPlaceClick,set:(e,t)=>{e.preventPlaceClick=t}},metadata:t},B,V),e(this,null,H,{kind:`accessor`,name:`preselectCoachIndex`,static:!1,private:!1,access:{has:e=>`preselectCoachIndex`in e,get:e=>e.preselectCoachIndex,set:(e,t)=>{e.preselectCoachIndex=t}},metadata:t},U,W),e(this,null,G,{kind:`accessor`,name:`showTitleInfo`,static:!1,private:!1,access:{has:e=>`showTitleInfo`in e,get:e=>e.showTitleInfo,set:(e,t)=>{e.showTitleInfo=t}},metadata:t},K,q),e(this,null,J,{kind:`accessor`,name:`selectedCoachIndex`,static:!1,private:!1,access:{has:e=>`selectedCoachIndex`in e,get:e=>e.selectedCoachIndex,set:(e,t)=>{e.selectedCoachIndex=t}},metadata:t},Y,X),e(this,null,Q,{kind:`accessor`,name:`focusedCoachIndex`,static:!1,private:!1,access:{has:e=>`focusedCoachIndex`in e,get:e=>e.focusedCoachIndex,set:(e,t)=>{e.focusedCoachIndex=t}},metadata:t},$,re),e(this,null,ie,{kind:`accessor`,name:`hoveredCoachIndex`,static:!1,private:!1,access:{has:e=>`hoveredCoachIndex`in e,get:e=>e.hoveredCoachIndex,set:(e,t)=>{e.hoveredCoachIndex=t}},metadata:t},ae,oe),e(this,null,se,{kind:`method`,name:`coachAreaScrollend`,static:!1,private:!1,access:{has:e=>`coachAreaScrollend`in e,get:e=>e.coachAreaScrollend},metadata:t},null,i),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.events={selectedplaces:`selectedplaces`,selectedcoach:`selectedcoach`}}#e;get seatReservations(){return this.#e}set seatReservations(e){this.#e=e}#t;get travelDirection(){return this.#t}set travelDirection(e){this.#t=e}#n;get hasNavigation(){return this.#n}set hasNavigation(e){this.#n=e}#r;get alignVertical(){return this.#r}set alignVertical(e){this.#r=e}#i;get baseGridSize(){return this.#i}set baseGridSize(e){this.#i=e}#a;get height(){return this.#a}set height(e){this.#a=e}#o;get maxSeatReservations(){return this.#o}set maxSeatReservations(e){this.#o=e}#s;get maxBicycleReservations(){return this.#s}set maxBicycleReservations(e){this.#s=e}#c;get preventPlaceClick(){return this.#c}set preventPlaceClick(e){this.#c=e}#l;get preselectCoachIndex(){return this.#l}set preselectCoachIndex(e){this.#l=e}#u;get showTitleInfo(){return this.#u}set showTitleInfo(e){this.#u=e}#d;get selectedCoachIndex(){return this.#d}set selectedCoachIndex(e){this.#d=e}#f;get focusedCoachIndex(){return this.#f}set focusedCoachIndex(e){this.#f=e}#p;get hoveredCoachIndex(){return this.#p}set hoveredCoachIndex(e){this.#p=e}constructor(){super(),this.#e=(t(this,i),t(this,c,null)),this.#t=(t(this,l),t(this,d,`NONE`)),this.#n=(t(this,p),t(this,v,!0)),this.#r=(t(this,y),t(this,x,!1)),this.#i=(t(this,S),t(this,w,16)),this.#a=(t(this,T),t(this,D,null)),this.#o=(t(this,O),t(this,N,-1)),this.#s=(t(this,F),t(this,L,-1)),this.#c=(t(this,R),t(this,B,!1)),this.#l=(t(this,V),t(this,U,-1)),this.#u=(t(this,W),t(this,K,!1)),this.#d=(t(this,q),t(this,Y,-1)),this.#f=(t(this,X),t(this,$,-1)),this.#p=(t(this,re),t(this,ae,-1)),this.coachBorderPadding=(t(this,oe),6),this.gapBetweenCoaches=4,this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.gapBetweenCoachDecks=48,this.coachNavButtonDim=0,this.globalAreaIconDim={w:2,h:2},this.globalAreaIconPadding=.8,this.coachItemDetailsElements=[],this.currScrollDirection=Z.right,this.maxCalcCoachesWidth=0,this.scrollCoachesAreaWidth=0,this.scrollNavigationAreaDim=0,this.triggerCoachPositionsCollection=[],this.navigationScrollArea=null,this.coachScrollArea=null,this.currSelectedPlace=null,this.currSelectedPlaceElementId=null,this.currSelectedCoachIndex=-1,this.currSelectedDeckIndex=0,this.preventCoachScrollByPlaceClick=!1,this.selectedSeatReservationPlaces={seats:[],bicycles:[]},this.seatReservationWithoutNavigationHasFocus=!1,this.isCoachGridFocusable=!1,this.isAutoScrolling=!1,this.isKeyboardNavigation=!1,this.hasMultipleDecks=!1,this.hasSeatReservationNativeFocus=!1,this.keyboardNavigationEvents={ArrowLeft:`ArrowLeft`,ArrowRight:`ArrowRight`,ArrowUp:`ArrowUp`,ArrowDown:`ArrowDown`,Tab:`Tab`,Enter:`Enter`},this.seatReservationStructure={decks:[]},this.notFixedRotatableAreaIcons=[`ENTRY_EXIT`],this.notAreaElements=[`DRIVER_AREA`,`DRIVER_AREA_NO_VERTICAL_WALL`,`COACH_PASSAGE`,`COACH_WALL_NO_PASSAGE`,`COMPARTMENT_PASSAGE`,`COMPARTMENT_PASSAGE_HIGH`,`COMPARTMENT_PASSAGE_MIDDLE`,`COMPARTMENT_PASSAGE_LOW`,`COMPARTMENT_WALL`],this.middleBorderDockingElements=[`DRIVER_AREA`,`DRIVER_AREA_NO_VERTICAL_WALL`,`COACH_PASSAGE`,`COACH_WALL_NO_PASSAGE`],this._isRunningInitPreselectCoachIndex=!1,this._lastStartScrollPos=-1,this._prepareServiceIconsNavigation=e=>e&&e?.map(function(e){return{pId:e,svgName:P[e]?.svgName?P[e]?.svgName:``}}).filter(e=>ee.indexOf(e.svgName)!==-1).filter((e,t,n)=>n.map(e=>e.svgName).indexOf(e.svgName)===t).map(e=>e.pId).slice(0,3)||[],this.addEventListener(`blur`,()=>this._onLeaveSeatReservationComponent())}willUpdate(e){if(super.willUpdate(e),e.has(`seatReservations`)&&(this.hasMultipleDecks=this.seatReservations?.length>1,this._initPrepareSeatReservationData(),this._initSeatReservationPlaceSelection(),this.initNavigationSelectionByScrollEvent()),e.has(`baseGridSize`)&&(this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.style?.setProperty(`--sbb-seat-reservation-grid-size`,`${this.baseGridSize}px`),this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent()),e.has(`height`)&&this.height){let e=this.seatReservations[this.currSelectedDeckIndex]||null;e?.coachItems.length&&(this.baseGridSize=this.height/e.coachItems[0].dimension.h,this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.style?.setProperty(`--sbb-seat-reservation-grid-size`,`${this.baseGridSize}px`),this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent())}e.has(`alignVertical`)&&(this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent()),e.has(`preselectCoachIndex`)&&(this._isRunningInitPreselectCoachIndex=!0,setTimeout(()=>this.scrollToSelectedNavCoach(this.preselectCoachIndex),1))}navigateByDirectionBtn(e){this.unfocusPlaceElement();let t=this.currSelectedCoachIndex;e==`DIRECTION_LEFT`&&t>0?t=this.currSelectedCoachIndex==-1?0:this.currSelectedCoachIndex-1:e==`DIRECTION_RIGHT`&&t<this.seatReservations[this.currSelectedDeckIndex]?.coachItems.length-1&&(t=this.currSelectedCoachIndex==-1?0:this.currSelectedCoachIndex+1),this.scrollToSelectedNavCoach(t)}_initPrepareSeatReservationData(){this._determineBaseFontSize(),this.hasMultipleDecks&&this._initEmptyCoachDeckOffsets(),this._prepareCoachItemDetailsData(),this._prepareSeatReservationStructureInformation(),this._prepareOptimizeAreaIconDimensionByMedian()}initNavigationSelectionByScrollEvent(){this.coachScrollArea=this.shadowRoot?.querySelector(`#sbb-sr__wrapper-scrollarea`),this.navigationScrollArea=this.shadowRoot?.querySelector(`#sbb-sr__navigation-list-coaches`);let e=this.seatReservations?this.seatReservations[this.currSelectedDeckIndex]:null;if(e&&e.coachItems.length>0){let t=e.coachItems[0].dimension.h*this.baseGridSize+this.coachBorderPadding,n=(this.seatReservations.length-1)*this.gapBetweenCoachDecks;this.style?.setProperty(`--sbb-seat-reservation-height`,`${t*this.seatReservations.length+n}`),this.style?.setProperty(`--sbb-seat-reservation-decks`,`${this.seatReservations.length}`)}if(this.navigationScrollArea){this.scrollNavigationAreaDim=this.alignVertical?this.navigationScrollArea.getBoundingClientRect().height:this.navigationScrollArea.getBoundingClientRect().width;let e=this.navigationScrollArea.querySelector(`ul > li`);if(e){let t=e?.getBoundingClientRect();this.coachNavButtonDim=this.alignVertical?t.height:t.width}}if(this.coachScrollArea&&e){let t=0;this.scrollCoachesAreaWidth=this.alignVertical?this.coachScrollArea.getBoundingClientRect().height:this.coachScrollArea.getBoundingClientRect().width,this.triggerCoachPositionsCollection=e.coachItems.map((e,n)=>{let r=this.seatReservationStructure.decks[this.currSelectedDeckIndex].deckCoaches[n],i=t;return t+=r.width+(r.hasOverhangingElements?2*this.gapBetweenCoaches:this.gapBetweenCoaches),{start:i,end:t,width:r.width}}),this.maxCalcCoachesWidth=t-this.gapBetweenCoaches}}coachAreaScrollend(){this._scrollTimeout&&clearTimeout(this._scrollTimeout),this._scrollTimeout=setTimeout(()=>this._handleCoachAreaScrollendEvent(),150)}onFocusTableCoachAndPreselectPlace(e){!this.seatReservationWithoutNavigationHasFocus&&!this.hasNavigation&&(this.seatReservationWithoutNavigationHasFocus=!0,this.currSelectedCoachIndex=e===0?this.getNextAvailableCoachIndex(-1):this.getPrevAvailableCoachIndex(e),this.preselectPlaceInCoach())}onFocusNavDirectionButton(){this.focusedCoachIndex=-1}onKeyNavigationNavCoachButton(e,t){if(e.key===this.keyboardNavigationEvents.Tab){this._handleTabKeyNavigation(e,`navigation`,t);return}s(e)&&this.keyboardSeatmapEventHandling(e)}_handleTabKeyNavigation(e,t,n){let r=e.key,i=e.shiftKey;r===this.keyboardNavigationEvents.Tab&&(t==`navigation`?(n==this.currSelectedCoachIndex?!this.currSelectedPlace||!i||this.coachItemDetailsElements[n].isDriverArea||this.focusedCoachIndex==-1?this.focusedCoachIndex=n:i&&this.currSelectedPlace&&(this.focusedCoachIndex=-1,this.focusPlaceElement(this.currSelectedPlace)):this.focusedCoachIndex=n,this._scrollToSelectedNavigationButton(n)):t==`seatmap`&&(e.preventDefault(),i?this._navigateCoachNavigationByKeyboard(`PREV_TAB`):this._navigateCoachNavigationByKeyboard(`NEXT_TAB`)))}keyboardSeatmapEventHandling(e){let t=e.key===this.keyboardNavigationEvents.Tab,n=e.shiftKey&&t;if(!this.hasNavigation&&this.currSelectedCoachIndex===0&&n||this.currSelectedCoachIndex===this.coachItemDetailsElements.length-1&&t)return;let r=e.key;if(this.preventCoachScrollByPlaceClick=!1,!this.hasSeatReservationNativeFocus&&(t||n)&&(this.hasSeatReservationNativeFocus=!0),t){this._handleTabKeyNavigation(e,`seatmap`);return}if(this.currSelectedCoachIndex!==-1&&s(e))switch(e.preventDefault(),r){case this.keyboardNavigationEvents.ArrowLeft:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowDown:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowRight:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowUp:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowUp:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowLeft:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowDown:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowRight:r;this._navigateToPlaceByKeyboard(e)}}}preselectPlaceInCoach(){if(this.isAutoScrolling){if(this._isRunningInitPreselectCoachIndex){this._isRunningInitPreselectCoachIndex=!1;return}if(this.coachItemDetailsElements[this.currSelectedCoachIndex]&&this.coachItemDetailsElements[this.currSelectedCoachIndex].isDriverArea){this._setFocusToSelectedCoachGrid();return}if(this.isKeyboardNavigation&&this.isAutoScrolling){let e=this._getClosestPlaceByKeyDirection();e?(this.unfocusPlaceElement(),this.focusPlaceElement(e),this.focusedCoachIndex=-1):this._setFocusToSelectedCoachGrid()}else this.unfocusPlaceElement(),this.isCoachGridFocusable=!0,this._setFocusToSelectedCoachGrid()}}scrollToSelectedNavCoach(e){if(this._isValidCoachIndex(e)&&e!==this.currSelectedCoachIndex){this.hoveredCoachIndex=e,this.isAutoScrolling=!0,this.isCoachGridFocusable=!0,this.currSelectedCoachIndex=e,this.currSelectedDeckIndex=this._getExistingCoachDeckIndex(),this._setScrollDirectionByCoachIndex();let t=this._getCoachScrollPositionX();(this.selectedCoachIndex!==-1||this.currSelectedCoachIndex>0)&&this._isScrollableToSelectedCoach()?(this._lastStartScrollPos=this.coachScrollArea.scrollLeft,this.coachScrollArea.scrollTo({top:this.alignVertical?t:0,left:this.alignVertical?0:t,behavior:`smooth`})):this.updateCurrentSelectedCoach(),this._scrollToSelectedNavigationButton(e)}}focusPlaceElement(e){if(this.unfocusPlaceElement(),e){this.currSelectedPlace=e,this._setCurrSelectedPlaceElementId(e);let t=this._getPlaceHtmlElement();if(t){t.setAttribute(`keyfocus`,`focus`);let n=setTimeout(()=>{let t=this.getPlaceElementId(this.currSelectedDeckIndex,this.currSelectedCoachIndex,e.number);this._scrollPlaceIntoNearestViewport(t),clearTimeout(n)},0)}}}unfocusPlaceElement(){let e=this._getPlaceHtmlElement();e&&(e.setAttribute(`keyfocus`,`unfocus`),this._setCurrSelectedPlaceElementId(null),this.currSelectedPlace=null)}getCalculatedDimension(e,t,n,r){return t&&!n&&(e.h+=this.coachBorderOffset*2),r&&(e.h+=this.coachBorderOffset),{w:Math.round(this.baseGridSize*e.w),h:Math.round(this.baseGridSize*e.h)}}getCalculatedPosition(e,t,n,r){if(n&&t){let i=r?n.h:n.h+this.coachBorderOffset;e.y===0?e.y-=this.coachBorderOffset:e.y+t.h===i&&(e.y+=this.coachBorderOffset)}return{x:Math.round(this.baseGridSize*e.x),y:Math.round(this.baseGridSize*e.y),z:e.z}}isElementDirectlyOnBorder(e,t){return e.position.y===0||e.position.y+e.dimension.h===t.h}getAvailableFreePlacesNumFromCoach(e){let t={seats:0,bicycles:0};return e?.reduce((e,t)=>(t.state===`FREE`&&(t.type===`SEAT`?e.seats++:e.bicycles++),e),t)||t}hasTravelDirection(){return this.travelDirection&&this.travelDirection!==`NONE`}_handleCoachAreaScrollendEvent(){let e=this.isAutoScrolling?this.currSelectedCoachIndex:this._getCoachIndexByScrollTriggerPosition();if(this.preventCoachScrollByPlaceClick){Math.abs(this._lastStartScrollPos-this.coachScrollArea.scrollLeft)>this.baseGridSize*2&&(this.selectedCoachIndex=e),this.preventCoachScrollByPlaceClick=!1;return}this._lastStartScrollPos=this.coachScrollArea.scrollLeft,this.hoveredCoachIndex=-1,this.currSelectedCoachIndex===-1&&(this.currSelectedCoachIndex=e),this.currSelectedCoachIndex=this._isScrollableToSelectedCoach()?e:e<this.currSelectedCoachIndex?this.currSelectedCoachIndex:e,this.isAutoScrolling||this._scrollToSelectedNavigationButton(e),this.preventCoachScrollByPlaceClick=!1,this.updateCurrentSelectedCoach(),this.hasNavigation||(this.preselectPlaceInCoach(),this.isAutoScrolling=!1)}_scrollToSelectedNavigationButton(e){setTimeout(()=>{if(this.hasNavigation&&this.navigationScrollArea){let t=this.scrollNavigationAreaDim/2,n=e*this.coachNavButtonDim-t+this.coachNavButtonDim;this.navigationScrollArea.scrollTo({top:this.alignVertical?n:0,left:this.alignVertical?0:n,behavior:`smooth`})}},10)}_setScrollDirectionByCoachIndex(){this.currScrollDirection=this.currSelectedCoachIndex>this.selectedCoachIndex?Z.right:Z.left}_getCoachScrollPositionX(){let e=this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];return this.isKeyboardNavigation&&this.currScrollDirection===Z.left&&e.width>this.scrollCoachesAreaWidth?e.end-this.scrollCoachesAreaWidth:e.start}_setFocusToSelectedCoachGrid(){if(this.isCoachGridFocusable&&this.hasSeatReservationNativeFocus){this.isCoachGridFocusable=!1;let e=this.shadowRoot?.querySelector(`#sbb-sr-coach-caption-`+this.currSelectedCoachIndex);e&&e.focus()}}_isScrollableToSelectedCoach(){let e=this.alignVertical?this.coachScrollArea.scrollTop:this.coachScrollArea.scrollLeft,t=this.alignVertical?this.coachScrollArea.getBoundingClientRect().height:this.coachScrollArea.getBoundingClientRect().width,n=this.maxCalcCoachesWidth-t,r=this.triggerCoachPositionsCollection[this.currSelectedCoachIndex],i=e===this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;return(e<n||e>r.start)&&!i}_getCoachIndexByScrollTriggerPosition(){let e=(this.alignVertical?this.coachScrollArea.scrollTop:this.coachScrollArea.scrollLeft)+this.scrollCoachesAreaWidth/2;return this.triggerCoachPositionsCollection.findIndex(t=>e>=t.start&&e<=t.end)}_getFirstPlaceInSelectedCoach(){let e=null,t=this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex],n=`cell-`+this.currSelectedDeckIndex+`-`+this.currSelectedCoachIndex+`-0-0`,r=this.shadowRoot?.querySelector(`#`+n)?.querySelector(`sbb-seat-reservation-place-control`)?.getAttribute(`text`)||null;return t&&r&&(e=t.places?.find(e=>e.number===r)||null),e}_getSwitchedCoachDeckIndexByKeyNavigation(e,t){return!this.currSelectedPlace||e===this.keyboardNavigationEvents.ArrowRight||e===this.keyboardNavigationEvents.ArrowLeft?null:e===this.keyboardNavigationEvents.ArrowDown&&this.currSelectedPlace.position.y+2===t.dimension.h&&this.seatReservations[this.currSelectedDeckIndex+1]?this.currSelectedDeckIndex+1:e===this.keyboardNavigationEvents.ArrowUp&&this.currSelectedPlace.position.y===0&&this.seatReservations[this.currSelectedDeckIndex-1]?this.currSelectedDeckIndex-1:null}_getClosestPlaceByKeyDirection(e){let t=this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex],n=null,r=t.places,i=null;if(r){if(!this.currSelectedPlaceElementId)return this._getFirstPlaceInSelectedCoach();if(this.currSelectedPlace){let a={...this.currSelectedPlace.position};e&&(i=this._getSwitchedCoachDeckIndexByKeyNavigation(e,t),i!==null&&(r=this.seatReservations[i].coachItems[this.currSelectedCoachIndex].places||[],a.y=i<this.currSelectedDeckIndex?t.dimension.h:-1));for(let t of r)e?t.number!==this.currSelectedPlace?.number&&(e===this.keyboardNavigationEvents.ArrowRight&&(t.position.y===a.y||t.position.y===a.y-1)&&t.position.x>a.x&&(!n||t.position.x<n.position.x)||e===this.keyboardNavigationEvents.ArrowDown&&(t.position.x===a.x||t.position.x===a.x+1)&&t.position.y>a.y&&(!n||t.position.y<n.position.y)||e===this.keyboardNavigationEvents.ArrowLeft&&(t.position.y===a.y||t.position.y===a.y+1)&&t.position.x<a.x&&(!n||t.position.x>n.position.x)||e===this.keyboardNavigationEvents.ArrowUp&&(t.position.x===a.x||t.position.x===a.x-1)&&t.position.y<a.y&&(!n||t.position.y>n.position.y))&&(n=t):(this.currScrollDirection===Z.right&&t.position.y===a.y&&(!n||t.position.x<n.position.x)||this.currScrollDirection===Z.left&&t.position.y===a.y&&(!n||t.position.x>n.position.x))&&(n=t);i!==null&&n&&(this.currSelectedDeckIndex=i)}}return n}_navigateCoachNavigationByKeyboard(e){let t=this.focusedCoachIndex===-1?this.currSelectedCoachIndex===-1?0:this.currSelectedCoachIndex:this.focusedCoachIndex,n=e===`NEXT_TAB`?this.getNextAvailableCoachIndex(t):this.getPrevAvailableCoachIndex(t);if(this.hasNavigation){let r=this._getPlaceHtmlElement(),i=r?r.getAttribute(`keyfocus`)===`focus`:!1;if(e===`PREV_TAB`&&this.selectedCoachIndex===t)if(i||this.currSelectedPlace!==null){this.focusedCoachIndex=t,this.unfocusPlaceElement();return}else t===0?this._refocusCurrentFocusedNavCoach(t):this.focusedCoachIndex=n;else n===this.currSelectedCoachIndex?e===`NEXT_TAB`&&n===this.coachItemDetailsElements.length-1?this._refocusCurrentFocusedNavCoach(t):(this.focusedCoachIndex=-1,this.selectedCoachIndex=n,i?this.focusPlaceElement(this.currSelectedPlace):(this.isCoachGridFocusable=!0,this._setFocusToSelectedCoachGrid())):this.focusedCoachIndex=n;this._scrollToSelectedNavigationButton(n)}else this.scrollToSelectedNavCoach(n)}_refocusCurrentFocusedNavCoach(e){this.focusedCoachIndex=-1,setTimeout(()=>this.focusedCoachIndex=e,0)}_navigateToPlaceByKeyboard(e){if(this.isKeyboardNavigation=!0,this.focusedCoachIndex!==-1&&(this.focusedCoachIndex=-1),!this.preventPlaceClick){let t=this._getClosestPlaceByKeyDirection(e);if(t)this.focusPlaceElement(t);else if(e===this.keyboardNavigationEvents.ArrowRight||e===this.keyboardNavigationEvents.ArrowLeft||this.alignVertical&&(e===this.keyboardNavigationEvents.ArrowUp||e===this.keyboardNavigationEvents.ArrowDown)){let t=e===this.keyboardNavigationEvents.ArrowRight?this.getNextAvailableCoachIndex():this.getPrevAvailableCoachIndex();this.scrollToSelectedNavCoach(t)}}}getNextAvailableCoachIndex(e){let t=e??this.currSelectedCoachIndex;return t<this.seatReservations[this.currSelectedDeckIndex].coachItems.length-1?t+1:t}getPrevAvailableCoachIndex(e){let t=e??this.currSelectedCoachIndex;return t>0?t-1:t}updateSelectedSeatReservationPlaces(e){let t=e.placeType===`SEAT`?`seats`:`bicycles`,n=e.placeType===`SEAT`?this.maxSeatReservations:this.maxBicycleReservations,r=this.selectedSeatReservationPlaces[t];this.selectedSeatReservationPlaces[t]=this._updateSelectedSeatReservationPlaces(r,n,e);let i=this.selectedSeatReservationPlaces;this.dispatchEvent(new te(i))}_updateSelectedSeatReservationPlaces(e,t,n){if(n.state===`SELECTED`){let t=this._getDeckIndexByPlaceId(n.id),r=this._getSeatReservationPlaceSelection(n,t);r&&e.push(r)}else e=e.filter(e=>e.id!==n.id);if(t>-1&&e.length>t){let r=t>0?n:void 0;e=this._resetAllPlaceSelections(e,r)}return e}updateCurrentSelectedPlaceInCoach(e){let t=this._getDeckIndexByPlaceId(e.id),n=e.coachIndex;if(t===null)return;let r=this.seatReservations[t].coachItems[n].places?.find(t=>t.number==e.number);if(!r)return;this.currSelectedDeckIndex=t,this.currSelectedCoachIndex=n,this.currSelectedPlace=r,this.currSelectedCoachIndex!==this.selectedCoachIndex&&this.updateCurrentSelectedCoach(),this._setCurrSelectedPlaceElementId(r);let i=setTimeout(()=>{this._scrollPlaceIntoNearestViewport(e.id),clearTimeout(i)},0)}updateCurrentSelectedCoach(){if(this.currSelectedCoachIndex==this.selectedCoachIndex)return;this.focusedCoachIndex!=-1&&(this.focusedCoachIndex=this.currSelectedCoachIndex),this.selectedCoachIndex=this.currSelectedCoachIndex;let e=this._getSeatReservationSelectedCoach(this.selectedCoachIndex);e&&this.dispatchEvent(new ne(e))}getPlaceElementId(e,t,n){return`seat-reservation__place-button-`+e+`-`+t+`-`+n}_initEmptyCoachDeckOffsets(){let e=Array(this.seatReservations.length-1).fill(0);this.seatReservations[this.seatReservations.length-1].coachItems.forEach(t=>{for(let n=0;n<this.seatReservations.length-1;n++){let r=this.seatReservations[n].coachItems[e[n]];if(t.id!=r?.id){let r={...t,places:void 0,propertyIds:void 0,graphicElements:void 0,serviceElements:void 0,travelClass:[]};this.seatReservations[n].coachItems.splice(e[n],0,r)}e[n]++}})}_initSeatReservationPlaceSelection(){this.selectedSeatReservationPlaces.seats=[],this.selectedSeatReservationPlaces.bicycles=[],this.seatReservations?.forEach((e,t)=>e.coachItems.map((n,r)=>{n.places?.filter(e=>e.state===`SELECTED`)?.forEach(n=>{let i=this.getPlaceElementId(t,r,n.number),a=A(n,i,e.deckCoachIndex,r),o=this._getSeatReservationPlaceSelection(a,t);o&&(o.placeType===`SEAT`?this.selectedSeatReservationPlaces.seats.push(o):this.selectedSeatReservationPlaces.bicycles.push(o))})}))}_resetAllPlaceSelections(e,t){for(let n of e)if(!t||t.id!==n.id){let e=this.shadowRoot?.getElementById(n.id);e&&e.setAttribute(`state`,`FREE`)}return e=t?e.filter(e=>e.id===t.id):[],e}_getSeatReservationPlaceSelection(e,t){if(t===null)return null;let n=this.seatReservations[t].coachItems[e.coachIndex],r=n.places?.find(t=>t.number===e.number);return r?j(r,n,e.id,e.deckIndex,e.coachIndex):null}_getSeatReservationSelectedCoach(e){if(!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])return null;let t=this.seatReservations[this.currSelectedDeckIndex].coachItems[e],n=this.getAvailableFreePlacesNumFromCoach(t.places);return M(e,t,n)}_setCurrSelectedPlaceElementId(e){this.currSelectedPlaceElementId=e?this.getPlaceElementId(this.currSelectedDeckIndex,this.currSelectedCoachIndex,e.number):null}_determineBaseFontSize(){if(!f){let e=1/parseInt(window.getComputedStyle(document.body).fontSize,10);this.style?.setProperty(`--sbb-seat-reservation-one-px-rem`,`${e+`rem`}`)}}_prepareCoachItemDetailsData(){if(this.seatReservations){let e=this.seatReservations[this.seatReservations.length-1].coachItems;this.coachItemDetailsElements=[],e.forEach((e,t)=>{let n=[],r=[],i=[];this.seatReservations.map(e=>e.coachItems[t]).forEach(e=>{n.push(...e.travelClass),r.push(...e.propertyIds?e.propertyIds:[]),i.push(...e.places?e.places:[])}),this.coachItemDetailsElements.push({id:e.id,travelClass:this._prepareTravelClassNavigation(n),propertyIds:this._prepareServiceIconsNavigation(r),isDriverArea:!e.places||e.places.length===0,isLocomotive:this._isLocomotive(e),driverAreaSide:this._prepareDriverAreaSideNavigation(e),freePlaces:this.getAvailableFreePlacesNumFromCoach(i)})})}}_prepareOptimizeAreaIconDimensionByMedian(){if(this.seatReservations){let e=[];if(this.seatReservations.forEach(t=>t.coachItems.forEach(t=>t.serviceElements?.forEach(t=>e.push(t.dimension)))),e.length){e.sort((e,t)=>{if(e&&t){let n=e.w+e.h,r=t.w+t.h;return n>r?1:n<r?-1:0}return 0});let t=e[Math.floor(e.length/2)];this.globalAreaIconDim=this.getCalculatedDimension(t)}else{let e=this.seatReservations.flatMap(e=>e.coachItems.map(e=>e.dimension.h)).reduce((e,t)=>Math.max(e,t),0),t=Math.floor(e*.2);this.globalAreaIconDim=this.getCalculatedDimension({w:t,h:t})}}}_prepareTravelClassNavigation(e){return e.indexOf(`FIRST`)===-1?e.indexOf(`SECOND`)===-1?`ANY_CLASS`:`SECOND`:`FIRST`}_prepareDriverAreaSideNavigation(e){let t=e.graphicElements?.filter(e=>e.icon===`DRIVER_AREA`);if(t&&t.length>0){let e=t.find(e=>e.position.x===0)||!1,n=t.find(e=>e.position.x>0)||!1;return{left:!!e,right:!!n}}}_prepareSeatReservationStructureInformation(){this.seatReservations&&(this.seatReservationStructure={decks:[]},this.seatReservations.forEach((e,t)=>{let n={deckIndex:t,deckCoaches:[]};e?.coachItems?.forEach(e=>{let t=(e.graphicElements?.filter(e=>e.icon&&!this.notAreaElements.includes(e.icon)))?.concat(e.serviceElements||[]).concat(e.places||[])||[],r=this._isOverhangingElementsPresent(e.dimension.w,t),i=e.graphicElements?.filter(e=>!this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`AREA`)),a=e.graphicElements?.filter(e=>this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`OTHER`)),o=e.serviceElements?.map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`SERVICE`)),s=this._getCalculatedMiddleBorderElement(e),c=this.getCalculatedDimension({...e.dimension}),l={width:c.w,height:c.h,otherElements:a||[],serviceElements:o||[],areaElements:i||[],borderMiddleElement:s,hasOverhangingElements:r};n.deckCoaches.push(l)}),this.seatReservationStructure.decks.push(n)}))}_getCalculatedMiddleBorderElement(e){let t=(e.dimension.h+this.coachBorderOffset*2)*this.baseGridSize,n=0,r=e.dimension.w;if(e.graphicElements){let t=this._getFirstLastDockingElements(e.graphicElements);if(t?.length==2){let i=t[0],a=t[1],o=i.position.x==0?a.dimension.w:i.dimension.w;n=i.position.x==0?i.dimension.w:a.dimension.w,r=e.dimension.w-o-n}else if(t?.length==1){let i=t[0];i.position.x===0?(n=i.dimension.w,r=e.dimension.w-i.dimension.w):i.position.x!==0&&(r=e.dimension.w-i.dimension.w)}}let i=this.coachBorderPadding*-1;return{position:{x:Math.floor(n*this.baseGridSize)-1,y:i,z:0},dimension:{w:Math.floor(r*this.baseGridSize)+2,h:t}}}_getFirstLastDockingElements(e){let t=(e.filter(e=>this.middleBorderDockingElements.includes(e.icon))||[]).sort((e,t)=>{let n=e.position.x,r=t.position.x;return n>r?1:n<r?-1:0});return t.filter((e,n)=>n==0||n==t.length-1)}_getCalculatedDimensionPositionElement(e,t,n){let r={...e.dimension},i={...e.position},a=e.rotation||0,o=this.notAreaElements.concat(this.notFixedRotatableAreaIcons).indexOf(e.icon)===-1,s=this.alignVertical&&o?a-90:a,c=null;if(n===`AREA`){let n=e.icon?.indexOf(`TABLE`)===-1,a=e.icon&&n?e.icon:null,o=this.isElementDirectlyOnBorder(e,t)&&a!==`ENTRY_EXIT`;e.position.y===0?(c=`upper-border`,i.y-=this.coachBorderOffset-this.coachBorderOffset/3):e.position.y+e.dimension.h===t.h&&(c=`lower-border`,o||(i.y+=this.coachBorderOffset-this.coachBorderOffset/3)),o&&(r.h+=this.coachBorderOffset-this.coachBorderOffset/3)}else n===`OTHER`&&(e.position.y===0&&(i.y-=this.coachBorderOffset),t.h===e.position.y+e.dimension.h&&(r.h+=this.coachBorderOffset*2));return r.w=Math.floor(r.w*this.baseGridSize),r.h=Math.floor(r.h*this.baseGridSize),i.x=Math.floor(i.x*this.baseGridSize),i.y=Math.floor(i.y*this.baseGridSize),{icon:e.icon&&e.icon.endsWith(`DRIVER_AREA`)?e.icon?.concat(`_`,this.seatReservations[this.currSelectedDeckIndex].vehicleType):e.icon,rotation:s,dimension:r,position:i,mounting:c}}_getPlaceHtmlElement(){return this.currSelectedPlaceElementId&&this.shadowRoot?.getElementById(this.currSelectedPlaceElementId)||null}_getDeckIndexByPlaceId(e){let t=this.shadowRoot?.querySelector(`#`+e)?.getAttribute(`data-deck-index`);return t&&!isNaN(+t)?+t:null}_isValidCoachIndex(e){return e>=0&&e<=this.seatReservations[this.seatReservations.length-1].coachItems.length}_getExistingCoachDeckIndex(){if(this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex].places!==void 0)return this.currSelectedDeckIndex;let e=this.seatReservations.findIndex(e=>e.coachItems[this.currSelectedCoachIndex].places!==void 0);return this.currSelectedDeckIndex>=e?this.currSelectedDeckIndex:e}_scrollPlaceIntoNearestViewport(e){this.shadowRoot?.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`})}_isOverhangingElementsPresent(e,t){return t?.some(t=>t.position.x===0||t.position.x+t.dimension.w>=e)??!1}_isLocomotive(e){return e?.graphicElements?.find(e=>e.icon===`DRIVER_AREA_NO_VERTICAL_WALL`)!==void 0}_onLeaveSeatReservationComponent(){this.hasNavigation&&(this.focusedCoachIndex=-1),this.unfocusPlaceElement()}}})();var $=`:host{--sbb-seat-reservation-grid-size:16px;--sbb-seat-reservation-height:0;--sbb-seat-reservation-decks:1;height:inherit;display:block}:host ::part(coach-floor){fill:var(--sbb-background-color-2)}@media (forced-colors:active){:host ::part(coach-floor){fill:#0000}}:host(:dir(rtl)) :not(.sbb-sr-place-ctrl--type-bicycle,.sbb-sr-place-ctrl--orientation-90,.sbb-sr-place-ctrl--orientation-270,.sbb-sr-place-ctrl--state-selected) ::part(coach-floor){rotate:180deg}.sbb-sr-popover{margin-block:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}:host([align-vertical]) .sbb-sr__component{justify-content:flex-end;gap:calc(22 * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:inherit;flex-direction:row-reverse}@media (width>=37.5rem){:host([align-vertical]) .sbb-sr__component{gap:calc(54 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}}:host([align-vertical]) .sbb-sr__component--has-travel-direction{padding-block-start:calc(36 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation,:host([align-vertical]) .sbb-sr__component ul.sbb-sr-navigation__list-coaches{flex-direction:column}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation{padding:calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) 0}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button{left:calc(1 * var(--sbb-seat-reservation-one-px-rem,.0625rem));top:0;rotate:90deg}@media (width>=64rem){:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button{left:calc(-1 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches{max-width:initial;padding:calc(5 * var(--sbb-seat-reservation-one-px-rem,.0625rem));overflow:hidden scroll}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches li{display:flex}:host([align-vertical]) .sbb-sr__wrapper-coach-decks{flex-direction:column}:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels{width:calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:initial;flex-direction:column-reverse}:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b{inline-size:calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));block-size:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-bottom:calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));rotate:initial;writing-mode:initial}:host([align-vertical]) .sbb-sr__wrapper-scrollarea{width:calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:100%;overflow:hidden scroll}:host([align-vertical]) .sbb-sr__wrapper-scrollarea .sbb-sr__parent{rotate:90deg}:host([align-vertical]) .sbb-sr-travel-direction-wrapper{width:calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block-start:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));position:absolute}.sbb-sr-navigation{gap:calc(3 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr-navigation .sbb-sr__navigation-control-button{top:calc(2 * var(--sbb-seat-reservation-one-px-rem,.0625rem));position:relative}@media (width>=64rem){.sbb-sr-navigation .sbb-sr__navigation-control-button{top:0}}.sbb-sr__component{gap:calc(64 * var(--sbb-seat-reservation-one-px-rem,.0625rem) - 16px);flex-direction:column;display:flex}.sbb-sr-travel-direction-wrapper{justify-content:center;align-items:center;column-gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));font-size:var(--sbb-text-font-size-s);display:flex}.sbb-sr-travel-direction-wrapper .sbb-sr__travel-direction--arrow{align-items:center;display:flex}.sbb-sr-navigation-wrapper{display:flex}.sbb-sr-navigation{justify-content:center;width:100%;padding-inline:16px;display:flex}.sbb-sr-navigation__list-coaches{gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));padding:calc(6 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(5 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) 0;--sbb-scrollbar-color:transparent;flex-wrap:nowrap;max-width:856px;display:flex;position:relative;overflow:scroll hidden}.sbb-sr__wrapper-coach-decks{height:inherit;display:flex;overflow:hidden}.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels{height:calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));writing-mode:vertical-lr;justify-content:space-between;display:flex}.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b{height:calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));width:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));text-align:center;line-height:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block-end:16px;rotate:180deg}.sbb-sr__wrapper-scrollarea{padding-block:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));overflow:scroll hidden}.sbb-sr__wrapper-scrollarea .sbb-sr__parent{flex-direction:column;display:flex;position:relative}.sbb-sr__list-decks{flex-direction:column;display:flex}.sbb-sr__list-decks--gap{gap:calc(48 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr__list-item-deck{position:relative}.sbb-sr__list-coaches{gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));display:flex}.sbb-sr__list-decks:has(.sbb-sr-coach-has-overhanging-elements) .sbb-sr__list-coaches{gap:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr__item-coach{position:relative}.sbb-sr-coach-wrapper__table{outline:0}
295
295
  `,re=class extends Q{constructor(){super(...arguments),this._language=new i(this)}static{this.elementName=`sbb-seat-reservation`}static{this.elementDependencies=[x,S,R,B,J,G,X]}static{this.styles=[c,u,l,m($)]}willUpdate(e){super.willUpdate(e),e.has(`hasNavigation`)&&(this.hasNavigation?this.shadowRoot?.querySelectorAll(`table`).forEach(e=>e.removeAttribute(`tabindex`)):this.shadowRoot?.querySelectorAll(`table`).forEach(e=>e.setAttribute(`tabindex`,`0`)))}firstUpdated(e){super.firstUpdated(e),this.updateComplete.then(()=>{this.initNavigationSelectionByScrollEvent()})}render(){return this._initVehicleSeatReservationConstruction(),this._coachesHtmlTemplate||null}_initVehicleSeatReservationConstruction(){this._coachesHtmlTemplate=d`
296
296
  ${this._renderTravelDirection()}
297
297
  <div
@@ -323,7 +323,7 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
323
323
  </div>
324
324
  </div>
325
325
  </div>
326
- `}_renderDeckLabels(){return this.hasMultipleDecks?this.seatReservations.map(e=>d`<b aria-hidden="true">${I(e.deckCoachLevel,this._language.current)}</b>`):null}_renderNavigationControlButton(e){if(!this.hasNavigation||!this.seatReservations)return null;let t=e==`DIRECTION_RIGHT`?`sbb-sr-navigation__wrapper-button-direction--right`:`sbb-sr-navigation__wrapper-button-direction--left`,n=e==`DIRECTION_RIGHT`?`chevron-small-right-small`:`chevron-small-left-small`,r=I(e==`DIRECTION_RIGHT`?`SEAT_RESERVATION_END`:`SEAT_RESERVATION_BEGIN`,this._language.current),i=!0;return(e==`DIRECTION_LEFT`&&this.selectedCoachIndex>0||e==`DIRECTION_RIGHT`&&this.selectedCoachIndex<this.coachItemDetailsElements.length-1)&&(i=!1),d`<div class="sbb-sr-navigation__wrapper-button-direction">
326
+ `}_renderDeckLabels(){return this.hasMultipleDecks?this.seatReservations.map(e=>{let t=I(e.deckCoachLevel,this._language.current);return d`<b aria-hidden="true">${t}</b>`}):null}_renderNavigationControlButton(e){if(!this.hasNavigation||!this.seatReservations)return null;let t=e==`DIRECTION_RIGHT`?`sbb-sr-navigation__wrapper-button-direction--right`:`sbb-sr-navigation__wrapper-button-direction--left`,n=e==`DIRECTION_RIGHT`?`chevron-small-right-small`:`chevron-small-left-small`,r=I(e==`DIRECTION_RIGHT`?`SEAT_RESERVATION_END`:`SEAT_RESERVATION_BEGIN`,this._language.current),i=!0;return(e==`DIRECTION_LEFT`&&this.selectedCoachIndex>0||e==`DIRECTION_RIGHT`&&this.selectedCoachIndex<this.coachItemDetailsElements.length-1)&&(i=!1),d`<div class="sbb-sr-navigation__wrapper-button-direction">
327
327
  <sbb-secondary-button
328
328
  @click="${()=>this.navigateByDirectionBtn(e)}"
329
329
  @focus="${()=>this.onFocusNavDirectionButton()}"
@@ -337,9 +337,9 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
337
337
  .disabledInteractive="${i||p}"
338
338
  .disabled="${i||p}"
339
339
  ></sbb-secondary-button>
340
- </div>`}_renderTravelDirection(){if(!this.hasTravelDirection())return null;let e=I(`SEAT_RESERVATION_TRAVEL_DIRECTION`,this._language.current);return d`<div class="sbb-sr-travel-direction-wrapper">
340
+ </div>`}_renderTravelDirection(){if(!this.hasTravelDirection())return null;let e=I(`SEAT_RESERVATION_TRAVEL_DIRECTION`,this._language.current),t=`arrow-${this.alignVertical?this.travelDirection===`RIGHT`?`down`:`up`:this.travelDirection===`RIGHT`?`right`:`left`}-small`;return d`<div class="sbb-sr-travel-direction-wrapper">
341
341
  <div class="sbb-sr__travel-direction--arrow">
342
- <sbb-icon slot="icon" name="${`arrow-${this.alignVertical?this.travelDirection===`RIGHT`?`down`:`up`:this.travelDirection===`RIGHT`?`right`:`left`}-small`}"></sbb-icon>
342
+ <sbb-icon slot="icon" name="${t}"></sbb-icon>
343
343
  </div>
344
344
  <div class="sbb-sr__travel-direction--label">${e}</div>
345
345
  </div>`}_renderNavigation(){return f||!this.hasNavigation||!this.seatReservations?null:d`<div class="sbb-sr-navigation-wrapper">
@@ -1,4 +1,4 @@
1
- import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbCardBadgeElement as n,SbbCardButtonElement as r,SbbCardElement as i}from"@sbb-esta/lyne-elements/card.pure.js";import{SbbElement as a,SbbLanguageController as o,defaultDateAdapter as s,forceType as c,i18nArrival as l,i18nClass as u,i18nDeparture as ee,i18nDirection as te,i18nFromPlatform as d,i18nMeansOfTransport as f,i18nNew as ne,i18nOccupancy as p,i18nRealTimeInfo as re,i18nSupersaver as ie,i18nTransferProcedure as m,i18nTransferProcedures as ae,i18nTravelhints as oe,i18nTripDuration as se,i18nTripQuayChange as h,listResetStyles as g,screenReaderOnlyStyles as _}from"@sbb-esta/lyne-elements/core.js";import{SbbIconElement as v}from"@sbb-esta/lyne-elements/icon.pure.js";import{SbbTimetableOccupancyElement as y}from"@sbb-esta/lyne-elements/timetable-occupancy.pure.js";import{html as b,nothing as x,unsafeCSS as ce}from"lit";import{property as S}from"lit/decorators.js";import{durationToTime as le,getDepartureArrivalTimeAttribute as ue,isRideLeg as C,removeTimezoneFromISOTimeString as de}from"./core.js";import{SbbPearlChainTimeElement as fe}from"./pearl-chain-time.pure.js";const w=6048e5,T=Symbol.for(`constructDateFrom`);function E(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&T in e?e[T](t):e instanceof Date?new e.constructor(t):new Date(t)}function D(e,t){return E(t||e,e)}let O={};function k(){return O}function A(e,t){let n=k(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=D(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function j(e,t){return A(e,{...t,weekStartsOn:1})}function M(e,t){let n=D(e,t?.in),r=n.getFullYear(),i=E(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=j(i),o=E(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=j(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function N(e){let t=D(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function P(e,...t){let n=E.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function F(e,t){let n=D(e,t?.in);return n.setHours(0,0,0,0),n}function I(e,t,n){let[r,i]=P(n?.in,e,t),a=F(r),o=F(i),s=+a-N(a),c=+o-N(o);return Math.round((s-c)/864e5)}function L(e,t){let n=M(e,t),r=E(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),j(r)}function R(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function z(e){return!(!R(e)&&typeof e!=`number`||isNaN(+D(e)))}function B(e,t){let n=D(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const V={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},H=(e,t,n)=>{let r,i=V[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function U(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const W={date:U({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:U({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:U({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},G={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},K=(e,t,n,r)=>G[e];function q(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const pe={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:q({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:q({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:q({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:q({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:q({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function J(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?he(s,e=>e.test(o)):me(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function me(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function he(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ge(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}const _e={code:`en-US`,formatDistance:H,formatLong:W,formatRelative:K,localize:pe,match:{ordinalNumber:ge({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:J({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:J({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:J({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:J({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:J({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function ve(e,t){let n=D(e,t?.in);return I(n,B(n))+1}function ye(e,t){let n=D(e,t?.in),r=j(n)-+L(n);return Math.round(r/w)+1}function be(e,t){let n=D(e,t?.in),r=n.getFullYear(),i=k(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=E(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=A(o,t),c=E(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=A(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function xe(e,t){let n=k(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=be(e,t),a=E(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),A(a,t)}function Se(e,t){let n=D(e,t?.in),r=A(n,t)-+xe(n,t);return Math.round(r/w)+1}function Y(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}const X={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Y(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Y(n+1,2)},d(e,t){return Y(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Y(e.getHours()%12||12,t.length)},H(e,t){return Y(e.getHours(),t.length)},m(e,t){return Y(e.getMinutes(),t.length)},s(e,t){return Y(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Y(Math.trunc(r*10**(n-3)),t.length)}},Z={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},Ce={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return X.y(e,t)},Y:function(e,t,n,r){let i=be(e,r),a=i>0?i:1-i;return t===`YY`?Y(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Y(a,t.length)},R:function(e,t){return Y(M(e),t.length)},u:function(e,t){return Y(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Y(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Y(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return X.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Y(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Se(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Y(i,t.length)},I:function(e,t,n){let r=ye(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Y(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):X.d(e,t)},D:function(e,t,n){let r=ve(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Y(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Y(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Y(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Y(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?Z.noon:r===0?Z.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?Z.evening:r>=12?Z.afternoon:r>=4?Z.morning:Z.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return X.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):X.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Y(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Y(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):X.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):X.s(e,t)},S:function(e,t){return X.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return Te(r);case`XXXX`:case`XX`:return Q(r);default:return Q(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return Te(r);case`xxxx`:case`xx`:return Q(r);default:return Q(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+we(r,`:`);default:return`GMT`+Q(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+we(r,`:`);default:return`GMT`+Q(r,`:`)}},t:function(e,t,n){return Y(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Y(+e,t.length)}};function we(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Y(a,2)}function Te(e,t){return e%60==0?(e>0?`-`:`+`)+Y(Math.abs(e)/60,2):Q(e,t)}function Q(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Y(Math.trunc(r/60),2),a=Y(r%60,2);return n+i+t+a}const Ee=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},De=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},Oe={p:De,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Ee(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,Ee(r,t)).replace(`{{time}}`,De(i,t))}},ke=/^D+$/,Ae=/^Y+$/,je=[`D`,`DD`,`YY`,`YYYY`];function Me(e){return ke.test(e)}function Ne(e){return Ae.test(e)}function Pe(e,t,n){let r=Fe(e,t,n);if(console.warn(r),je.includes(e))throw RangeError(r)}function Fe(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Ie=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Le=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Re=/^'([^]*?)'?$/,ze=/''/g,Be=/[a-zA-Z]/;function Ve(e,t,n){let r=k(),i=n?.locale??r.locale??_e,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=D(e,n?.in);if(!z(s))throw RangeError(`Invalid time value`);let c=t.match(Le).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=Oe[t];return n(e,i.formatLong)}return e}).join(``).match(Ie).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:He(e)};if(Ce[t])return{isToken:!0,value:e};if(t.match(Be))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&Ne(a)||!n?.useAdditionalDayOfYearTokens&&Me(a))&&Pe(a,t,String(e));let o=Ce[a[0]];return o(s,a,i.localize,l)}).join(``)}function He(e){let t=e.match(Re);return t?t[1].replace(ze,`'`):e}var Ue=`:host{--sbb-timetable-row-gap:var(--sbb-spacing-fixed-2x);--sbb-timetable-row-height:1.5625rem;--sbb-timetable-row-height-header:1.25rem;--sbb-timetable-row-height-footer:1rem;--sbb-timetable-row-skeleton-pulse-duration:1.8s;display:block}:host([disable-animation]){--sbb-timetable-row-skeleton-pulse-duration:0}.sbb-timetable__row-transport-icon{--sbb-icon-svg-width:1.25rem;--sbb-icon-svg-height:1.25rem}.sbb-travel-hints__item{--sbb-icon-svg-height:.875rem}.sbb-timetable__row--quay{margin-inline-end:var(--sbb-spacing-fixed-1x)}.sbb-timetable__row--quay-type{float:left}ul{display:inline-flex}li,.sbb-timetable__row-transport{align-self:center;display:inline-flex}.sbb-timetable__row-transportnumber,.sbb-timetable__row-time{--sbb-text-font-size:var(--sbb-text-font-size-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);font-weight:700;line-height:unset;white-space:nowrap;align-self:center}.sbb-timetable__row{--sbb-text-font-size:var(--sbb-text-font-size-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);gap:var(--sbb-timetable-row-gap);flex-direction:column;display:flex}.sbb-timetable__row-header,.sbb-timetable__row-footer{animation:none}.sbb-timetable__row-card{--sbb-card-padding-block:var(--sbb-card-with-badge-padding-block)}.sbb-timetable__row-header{gap:var(--sbb-spacing-fixed-2x);line-height:var(--sbb-timetable-row-height-header);align-items:center;display:flex}.sbb-timetable__row-details,.sbb-timetable__row-hints{gap:var(--sbb-spacing-fixed-1x);align-items:center;display:inline-flex}.sbb-timetable__row-header p{white-space:nowrap;text-overflow:ellipsis;align-self:center;margin:0;overflow:hidden}.sbb-timetable__row-footer{justify-content:space-between;align-items:center;gap:var(--sbb-spacing-fixed-2x);line-height:var(--sbb-timetable-row-height-footer);flex-wrap:wrap;display:flex}.sbb-timetable__row-footer>span{align-self:center}.sbb-timetable__row-footer :only-child{margin-inline-start:auto}.sbb-timetable__row-quay--changed{color:var(--sbb-color-primary)}.sbb-timetable__row-transport-wrapper,.sbb-timetable__row-warning{display:inline-flex}.sbb-loading{pointer-events:none}.sbb-loading__wrapper{gap:var(--sbb-spacing-fixed-2x);flex-direction:column;display:flex}.sbb-loading__row{border-radius:var(--sbb-border-radius-1x);width:100%;height:var(--sbb-timetable-row-height)}@media (width>=64rem){.sbb-loading__row{height:1.75rem}}@media (forced-colors:active){.sbb-loading__row{border:var(--sbb-border-width-1x) solid ButtonBorder!important}}.sbb-loading__row,.sbb-loading__badge{background:var(--sbb-background-color-4);animation:skeleton-pulse var(--sbb-timetable-row-skeleton-pulse-duration) ease-out infinite}.sbb-loading__row:first-of-type{height:var(--sbb-timetable-row-height-header);width:50%}.sbb-loading__row:last-of-type{height:var(--sbb-timetable-row-height-footer)}.sbb-loading__badge{margin-inline:auto calc(var(--sbb-spacing-fixed-3x) * -1);transform:var(--sbb-card-badge-skew);border-end-start-radius:var(--sbb-card-badge-border-radius);width:7.1875rem;height:1.25rem;padding-inline-end:var(--sbb-spacing-fixed-6x)}@keyframes skeleton-pulse{0%{background:var(--sbb-background-color-4)}17%{background:var(--sbb-background-color-4)}50%{background:var(--sbb-background-color-3)}67%{background:var(--sbb-background-color-3)}to{background:var(--sbb-background-color-4)}}
1
+ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbCardBadgeElement as n,SbbCardButtonElement as r,SbbCardElement as i}from"@sbb-esta/lyne-elements/card.pure.js";import{SbbElement as a,SbbLanguageController as o,defaultDateAdapter as s,forceType as c,i18nArrival as l,i18nClass as u,i18nDeparture as ee,i18nDirection as te,i18nFromPlatform as d,i18nMeansOfTransport as f,i18nNew as ne,i18nOccupancy as p,i18nRealTimeInfo as re,i18nSupersaver as ie,i18nTransferProcedure as m,i18nTransferProcedures as ae,i18nTravelhints as oe,i18nTripDuration as se,i18nTripQuayChange as h,listResetStyles as g,screenReaderOnlyStyles as _}from"@sbb-esta/lyne-elements/core.js";import{SbbIconElement as v}from"@sbb-esta/lyne-elements/icon.pure.js";import{SbbTimetableOccupancyElement as y}from"@sbb-esta/lyne-elements/timetable-occupancy.pure.js";import{html as b,nothing as x,unsafeCSS as ce}from"lit";import{property as S}from"lit/decorators.js";import{durationToTime as le,getDepartureArrivalTimeAttribute as ue,isRideLeg as C,removeTimezoneFromISOTimeString as de}from"./core.js";import{SbbPearlChainTimeElement as fe}from"./pearl-chain-time.pure.js";const w=6048e5,T=Symbol.for(`constructDateFrom`);function E(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&T in e?e[T](t):e instanceof Date?new e.constructor(t):new Date(t)}function D(e,t){return E(t||e,e)}let O={};function k(){return O}function A(e,t){let n=k(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=D(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function j(e,t){return A(e,{...t,weekStartsOn:1})}function M(e,t){let n=D(e,t?.in),r=n.getFullYear(),i=E(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=j(i),o=E(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=j(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function N(e){let t=D(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function P(e,...t){let n=E.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function F(e,t){let n=D(e,t?.in);return n.setHours(0,0,0,0),n}function I(e,t,n){let[r,i]=P(n?.in,e,t),a=F(r),o=F(i),s=+a-N(a),c=+o-N(o);return Math.round((s-c)/864e5)}function L(e,t){let n=M(e,t),r=E(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),j(r)}function R(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function z(e){return!(!R(e)&&typeof e!=`number`||isNaN(+D(e)))}function B(e,t){let n=D(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const V={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},H=(e,t,n)=>{let r,i=V[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function U(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const W={date:U({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:U({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:U({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},G={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},K=(e,t,n,r)=>G[e];function q(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const pe={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:q({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:q({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:q({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:q({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:q({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function J(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?he(s,e=>e.test(o)):me(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function me(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function he(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ge(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}const _e={code:`en-US`,formatDistance:H,formatLong:W,formatRelative:K,localize:pe,match:{ordinalNumber:ge({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:J({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:J({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:J({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:J({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:J({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function ve(e,t){let n=D(e,t?.in);return I(n,B(n))+1}function ye(e,t){let n=D(e,t?.in),r=j(n)-+L(n);return Math.round(r/w)+1}function be(e,t){let n=D(e,t?.in),r=n.getFullYear(),i=k(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=E(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=A(o,t),c=E(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=A(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function xe(e,t){let n=k(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=be(e,t),a=E(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),A(a,t)}function Se(e,t){let n=D(e,t?.in),r=A(n,t)-+xe(n,t);return Math.round(r/w)+1}function Y(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}const X={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Y(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Y(n+1,2)},d(e,t){return Y(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Y(e.getHours()%12||12,t.length)},H(e,t){return Y(e.getHours(),t.length)},m(e,t){return Y(e.getMinutes(),t.length)},s(e,t){return Y(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Y(Math.trunc(r*10**(n-3)),t.length)}},Z={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},Ce={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return X.y(e,t)},Y:function(e,t,n,r){let i=be(e,r),a=i>0?i:1-i;return t===`YY`?Y(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Y(a,t.length)},R:function(e,t){return Y(M(e),t.length)},u:function(e,t){return Y(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Y(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Y(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return X.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Y(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Se(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Y(i,t.length)},I:function(e,t,n){let r=ye(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Y(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):X.d(e,t)},D:function(e,t,n){let r=ve(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Y(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Y(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Y(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Y(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?Z.noon:r===0?Z.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?Z.evening:r>=12?Z.afternoon:r>=4?Z.morning:Z.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return X.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):X.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Y(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Y(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):X.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):X.s(e,t)},S:function(e,t){return X.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return Te(r);case`XXXX`:case`XX`:return Q(r);default:return Q(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return Te(r);case`xxxx`:case`xx`:return Q(r);default:return Q(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+we(r,`:`);default:return`GMT`+Q(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+we(r,`:`);default:return`GMT`+Q(r,`:`)}},t:function(e,t,n){return Y(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Y(+e,t.length)}};function we(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Y(a,2)}function Te(e,t){return e%60==0?(e>0?`-`:`+`)+Y(Math.abs(e)/60,2):Q(e,t)}function Q(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Y(Math.trunc(r/60),2),a=Y(r%60,2);return n+i+t+a}const Ee=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},De=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},Oe={p:De,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Ee(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`})}return a.replace(`{{date}}`,Ee(r,t)).replace(`{{time}}`,De(i,t))}},ke=/^D+$/,Ae=/^Y+$/,je=[`D`,`DD`,`YY`,`YYYY`];function Me(e){return ke.test(e)}function Ne(e){return Ae.test(e)}function Pe(e,t,n){let r=Fe(e,t,n);if(console.warn(r),je.includes(e))throw RangeError(r)}function Fe(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Ie=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Le=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Re=/^'([^]*?)'?$/,ze=/''/g,Be=/[a-zA-Z]/;function Ve(e,t,n){let r=k(),i=n?.locale??r.locale??_e,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=D(e,n?.in);if(!z(s))throw RangeError(`Invalid time value`);let c=t.match(Le).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=Oe[t];return n(e,i.formatLong)}return e}).join(``).match(Ie).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:He(e)};if(Ce[t])return{isToken:!0,value:e};if(t.match(Be))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&Ne(a)||!n?.useAdditionalDayOfYearTokens&&Me(a))&&Pe(a,t,String(e));let o=Ce[a[0]];return o(s,a,i.localize,l)}).join(``)}function He(e){let t=e.match(Re);return t?t[1].replace(ze,`'`):e}var Ue=`:host{--sbb-timetable-row-gap:var(--sbb-spacing-fixed-2x);--sbb-timetable-row-height:1.5625rem;--sbb-timetable-row-height-header:1.25rem;--sbb-timetable-row-height-footer:1rem;--sbb-timetable-row-skeleton-pulse-duration:1.8s;display:block}:host([disable-animation]){--sbb-timetable-row-skeleton-pulse-duration:0}.sbb-timetable__row-transport-icon{--sbb-icon-svg-width:1.25rem;--sbb-icon-svg-height:1.25rem}.sbb-travel-hints__item{--sbb-icon-svg-height:.875rem}.sbb-timetable__row--quay{margin-inline-end:var(--sbb-spacing-fixed-1x)}.sbb-timetable__row--quay-type{float:left}ul{display:inline-flex}li,.sbb-timetable__row-transport{align-self:center;display:inline-flex}.sbb-timetable__row-transportnumber,.sbb-timetable__row-time{--sbb-text-font-size:var(--sbb-text-font-size-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);font-weight:700;line-height:unset;white-space:nowrap;align-self:center}.sbb-timetable__row{--sbb-text-font-size:var(--sbb-text-font-size-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-text);letter-spacing:var(--sbb-typo-letter-spacing-text);font-size:var(--sbb-text-font-size);gap:var(--sbb-timetable-row-gap);flex-direction:column;display:flex}.sbb-timetable__row-header,.sbb-timetable__row-footer{animation:none}.sbb-timetable__row-card{--sbb-card-padding-block:var(--sbb-card-with-badge-padding-block)}.sbb-timetable__row-header{gap:var(--sbb-spacing-fixed-2x);line-height:var(--sbb-timetable-row-height-header);align-items:center;display:flex}.sbb-timetable__row-details,.sbb-timetable__row-hints{gap:var(--sbb-spacing-fixed-1x);align-items:center;display:inline-flex}.sbb-timetable__row-header p{white-space:nowrap;text-overflow:ellipsis;align-self:center;margin:0;overflow:hidden}.sbb-timetable__row-footer{justify-content:space-between;align-items:center;gap:var(--sbb-spacing-fixed-2x);line-height:var(--sbb-timetable-row-height-footer);flex-wrap:wrap;display:flex}.sbb-timetable__row-footer>span{align-self:center}.sbb-timetable__row-footer :only-child{margin-inline-start:auto}.sbb-timetable__row-quay--changed{color:var(--sbb-color-primary)}.sbb-timetable__row-transport-wrapper,.sbb-timetable__row-warning{display:inline-flex}.sbb-loading{pointer-events:none}.sbb-loading__wrapper{gap:var(--sbb-spacing-fixed-2x);flex-direction:column;display:flex}.sbb-loading__row{border-radius:var(--sbb-border-radius-1x);width:100%;height:var(--sbb-timetable-row-height)}@media (width>=64rem){.sbb-loading__row{height:1.75rem}}@media (forced-colors:active){.sbb-loading__row{border:var(--sbb-border-width-1x) solid ButtonBorder!important}}.sbb-loading__row,.sbb-loading__badge{background:var(--sbb-background-color-4);animation:skeleton-pulse var(--sbb-timetable-row-skeleton-pulse-duration) ease-out infinite}.sbb-loading__row:first-of-type{height:var(--sbb-timetable-row-height-header);width:50%}.sbb-loading__row:last-of-type{height:var(--sbb-timetable-row-height-footer)}.sbb-loading__badge{margin-inline:auto calc(var(--sbb-spacing-fixed-3x) * -1);transform:var(--sbb-card-badge-skew);border-end-start-radius:var(--sbb-card-badge-border-radius);width:7.1875rem;height:1.25rem;padding-inline-end:var(--sbb-spacing-fixed-6x)}@keyframes skeleton-pulse{0%{background:var(--sbb-background-color-4)}17%{background:var(--sbb-background-color-4)}50%{background:var(--sbb-background-color-3)}67%{background:var(--sbb-background-color-3)}to{background:var(--sbb-background-color-4)}}
2
2
  `;const We=(e,t)=>b`<span class="sbb-timetable__row-transport">
3
3
  <sbb-icon name=${e}></sbb-icon>
4
4
  <span class="sbb-screen-reader-only">${t}</span>