@sbb-esta/lyne-elements-experimental 5.1.0 → 5.3.0
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.
- package/core.js +1 -1
- package/development/core.js +124 -124
- package/development/journey-summary.pure.js +307 -307
- package/development/pearl-chain-time.pure.js +303 -303
- package/development/pearl-chain-vertical-item.pure.js +8 -8
- package/development/pearl-chain.pure.js +9 -9
- package/development/seat-reservation.pure.js +27 -27
- package/development/timetable-row.pure.js +338 -338
- package/journey-summary.pure.js +19 -19
- package/package.json +3 -4
- package/pearl-chain-time.pure.js +13 -13
- package/pearl-chain-vertical-item.pure.js +8 -8
- package/pearl-chain.pure.js +1 -1
- package/seat-reservation.pure.js +28 -28
- package/timetable-row.pure.js +54 -54
package/seat-reservation.pure.js
CHANGED
|
@@ -221,10 +221,10 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
|
|
|
221
221
|
class="${y({"sbb-sr-icon":!!e.svgName,"sbb-sr-graphic":!!e.svg})}"
|
|
222
222
|
>
|
|
223
223
|
${e.svgName?d` <sbb-icon
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
name="${e.svgName||``}"
|
|
225
|
+
aria-hidden="false"
|
|
226
|
+
aria-label="${I(e.svgName,this._language.current)}"
|
|
227
|
+
></sbb-icon>`:d`${this._getSvgElement(e.svg)}`}
|
|
228
228
|
</span>`}_getSvgElement(e){if(!f){let t=new DOMParser,n=e||`<svg></svg>`,r=t.parseFromString(n,`image/svg+xml`).firstElementChild;return this.stretch&&r?.nodeName.toLowerCase()===`svg`&&r.setAttribute(`preserveAspectRatio`,`none`),r}return null}}})();var V=`.sbb-sr-navigation__signs{justify-content:center;gap:var(--sbb-spacing-fixed-2x);color:light-dark(var(--sbb-color-granite),var(--sbb-color-graphite));flex-direction:row;line-height:normal;display:flex;overflow:hidden}.sbb-sr-navigation__signs:has(:nth-child(n+3 of .auto-width)):has([name^=SILENCE],[name^=BUSINESS]){gap:calc(6 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr-navigation__signs:has(:nth-child(n+3 of .auto-width)):has([name^=SILENCE],[name^=BUSINESS]):has([name^=BICYCLE]){gap:calc(3 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}:host([vertical]) .sbb-sr-navigation__signs{flex-direction:column;height:100%}
|
|
229
229
|
`;let H=(()=>{let n=r,a,s=[],c=[],u,f=[],h=[],_,v=[],y=[];return class extends n{constructor(){super(...arguments),this.#e=t(this,s,[]),this.#t=(t(this,c),t(this,f,!1)),this.#n=(t(this,h),t(this,v,!1)),this._language=(t(this,y),new i(this))}static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;a=[g({attribute:`property-ids`,type:Array})],u=[o(),g({type:Boolean,reflect:!0,useDefault:!0})],_=[o(),g({type:Boolean})],e(this,null,a,{kind:`accessor`,name:`propertyIds`,static:!1,private:!1,access:{has:e=>`propertyIds`in e,get:e=>e.propertyIds,set:(e,t)=>{e.propertyIds=t}},metadata:t},s,c),e(this,null,u,{kind:`accessor`,name:`vertical`,static:!1,private:!1,access:{has:e=>`vertical`in e,get:e=>e.vertical,set:(e,t)=>{e.vertical=t}},metadata:t},f,h),e(this,null,_,{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},v,y),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-seat-reservation-navigation-services`}static{this.elementDependencies=[B]}static{this.styles=[l,m(V)]}#e;get propertyIds(){return this.#e}set propertyIds(e){this.#e=e}#t;get vertical(){return this.#t}set vertical(e){this.#t=e}#n;get showTitleInfo(){return this.#n}set showTitleInfo(e){this.#n=e}render(){let e=this.propertyIds?.length?this._getServiceLabelDescription():null;return d` <div class="sbb-sr-navigation__signs">
|
|
230
230
|
<span
|
|
@@ -247,10 +247,10 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
|
|
|
247
247
|
>
|
|
248
248
|
${this._getNavigationButton()}
|
|
249
249
|
${this.coachItemDetails.propertyIds?.length?d`<sbb-seat-reservation-navigation-services
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
250
|
+
?vertical="${this.vertical}"
|
|
251
|
+
.propertyIds="${this.coachItemDetails.propertyIds}"
|
|
252
|
+
?showTitleInfo="${this.showTitleInfo}"
|
|
253
|
+
></sbb-seat-reservation-navigation-services>`:p}
|
|
254
254
|
</div>
|
|
255
255
|
`}_getNavigationButton(){let e=this._getCoachServiceClassNumber(),t=this._getTitleDescriptionNavCoachButton(e),n=this._getAriaDescriptionCoachServices();return d` <button
|
|
256
256
|
@click=${()=>this._selectNavCoach(this.index)}
|
|
@@ -268,17 +268,17 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
|
|
|
268
268
|
</button>`}_getBtnInformation(e){return this.coachItemDetails.isDriverArea?null:d`
|
|
269
269
|
${e===1?d`<span class="sbb-sr-navigation--first-class"></span>`:p}
|
|
270
270
|
${this.coachItemDetails.travelClass?.length>0||this.coachItemDetails.id?d`<div class="sbb-sr-navigation__additional-information">
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
271
|
+
${this.coachItemDetails.id?d`<div class="sbb-sr-navigation__item-coach-number" aria-hidden="true">
|
|
272
|
+
${this.coachItemDetails.id}
|
|
273
|
+
</div>`:p}
|
|
274
|
+
<div
|
|
275
|
+
${e??p}
|
|
276
|
+
class="sbb-sr-navigation__item-coach-travelclass"
|
|
277
|
+
aria-hidden="true"
|
|
278
|
+
>
|
|
279
|
+
${e}
|
|
280
|
+
</div>
|
|
281
|
+
</div>`:p}
|
|
282
282
|
`}_getTitleDescriptionNavCoachButton(e){if(this.coachItemDetails.isDriverArea&&!this.coachItemDetails.isLocomotive)return I(`NAVIGATE_COACH_BLOCKED`,this._language.current,[this.coachItemDetails.id]);if(this.coachItemDetails.isLocomotive)return I(`COACH_LOCOMOTIVE`,this._language.current);let t=I(`NAVIGATE_TO_COACH`,this._language.current,[this.coachItemDetails.id]);if(e){let n=I(e===1?`SERVICE_CLASS_FIRST`:`SERVICE_CLASS_SECOND`,this._language.current),r=I(`NAVIGATE_TO_COACH_SERVICE_CLASS_SUB`,this._language.current,[n]);t=t.concat(r)}let n=I(`COACH_AVAILABLE_NUMBER_OF_PLACES`,this._language.current,[this.coachItemDetails.freePlaces?.seats,this.coachItemDetails.freePlaces?.bicycles]);return t=t.concat(`. `).concat(n),t}_getAriaDescriptionCoachServices(){let e=null;return this.coachItemDetails.propertyIds?.length&&(e=I(`COACH_AVAILABLE_SERVICES`,this._language.current)+`: `,e+=this.coachItemDetails.propertyIds.map(e=>I(e,this._language.current)).join()+`.`),e}_selectNavCoach(e){this.dispatchEvent(new W(e))}_getCoachServiceClassNumber(){return this.coachItemDetails.travelClass?.includes(`FIRST`)?1:this.coachItemDetails.travelClass?.includes(`SECOND`)?2:null}}})();var K=`:host{--sbb-seat-reservation-place-control-text-scale-value:1;--sbb-seat-reservation-place-control-width:16;--sbb-seat-reservation-place-control-height:16;--sbb-seat-reservation-place-control-top:0;--sbb-seat-reservation-place-control-left:0;--sbb-seat-reservation-place-control-rotation:0;--sbb-seat-reservation-place-control-text-rotation:0;--sbb-seat-reservation-place-control-text-size:calc(var(--sbb-seat-reservation-place-control-text-scale-value,1) * .5);--sbb-seat-reservation-place-control-default-text:light-dark(var(--sbb-color-black),var(--sbb-color-white));--sbb-seat-reservation-place-control-hover-text:light-dark(var(--sbb-color-iron),var(--sbb-color-silver));--sbb-seat-reservation-place-control-focus-text:light-dark(var(--sbb-color-anthracite),var(--sbb-color-graphite));--sbb-seat-reservation-place-control-allocated-text:light-dark(var(--sbb-color-smoke),var(--sbb-color-metal));--sbb-seat-reservation-place-control-free-background-default:var(--sbb-background-color-2);--sbb-seat-reservation-place-control-free-background-hover:light-dark(var(--sbb-color-cloud),var(--sbb-color-midnight));--sbb-seat-reservation-place-control-free-background-focus:light-dark(var(--sbb-color-silver),var(--sbb-color-black));--sbb-seat-reservation-place-control-free-backrest-background-default:light-dark(var(--sbb-color-black),var(--sbb-color-white));--sbb-seat-reservation-place-control-free-backrest-background-hover:light-dark(var(--sbb-color-black),var(--sbb-color-white));--sbb-seat-reservation-place-control-free-backrest-background-focus:light-dark(var(--sbb-color-black),var(--sbb-color-white));--sbb-seat-reservation-place-control-selected-background-default:var(--sbb-color-primary);--sbb-seat-reservation-place-control-selected-background-hover:var(--sbb-color-primary125);--sbb-seat-reservation-place-control-selected-background-focus:var(--sbb-color-primary150);--sbb-seat-reservation-place-control-selected-backrest-background-default:var(--sbb-color-primary150);--sbb-seat-reservation-place-control-selected-backrest-background-hover:#7d000f;--sbb-seat-reservation-place-control-selected-backrest-background-focus:#5a000b;--sbb-seat-reservation-place-control-allocated-background-default:light-dark(var(--sbb-color-milk),var(--sbb-color-midnight));--sbb-seat-reservation-place-control-free-backrest-high-contrast:CanvasText;--sbb-seat-reservation-place-control-free-background-high-contrast:Canvas;--sbb-seat-reservation-place-control-free-text-high-contrast:ButtonText;--sbb-seat-reservation-place-control-free-icon-high-contrast:CanvasText;--sbb-seat-reservation-place-control-allocated-backrest-high-contrast:GrayText;--sbb-seat-reservation-place-control-allocated-background-high-contrast:Canvas;--sbb-seat-reservation-place-control-allocated-text-high-contrast:GrayText;--sbb-seat-reservation-place-control-allocated-icon-high-contrast:GrayText;width:calc(var(--sbb-seat-reservation-place-control-width) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:calc(var(--sbb-seat-reservation-place-control-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));cursor:var(--sbb-cursor-pointer);font-weight:300;position:absolute;inset-block-start:calc(var(--sbb-seat-reservation-place-control-top) * var(--sbb-seat-reservation-one-px-rem,.0625rem));inset-inline-start:calc(var(--sbb-seat-reservation-place-control-left) * var(--sbb-seat-reservation-one-px-rem,.0625rem))}:host(:hover) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-free-background-hover)}:host(:hover) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-free-backrest-background-hover)}:host(:hover) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) .sbb-sr-place-ctrl__text{background-color:var(--sbb-seat-reservation-place-control-free-background-hover);color:var(--sbb-seat-reservation-place-control-free-text)}@media (forced-colors:active){:host(:hover) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-free-background-high-contrast)}:host(:hover) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-free-backrest-high-contrast)}:host(:hover) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-icon){fill:var(--sbb-seat-reservation-place-control-free-icon-high-contrast)}:host(:hover) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-seatline){stroke:var(--sbb-seat-reservation-place-control-free-backrest-high-contrast)}:host(:hover) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) .sbb-sr-place-ctrl__text{forced-color-adjust:none;background-color:var(--sbb-seat-reservation-place-control-free-background-high-contrast);color:var(--sbb-seat-reservation-place-control-free-text-high-contrast)}}:host(:hover) .sbb-sr-place-ctrl--state-selected:not(.sbb-reservation-place-control--disabled) ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-selected-background-hover)}:host(:hover) .sbb-sr-place-ctrl--state-selected:not(.sbb-reservation-place-control--disabled) ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-selected-backrest-background-hover)}:host(:hover) .sbb-sr-place-ctrl--state-selected:not(.sbb-reservation-place-control--disabled) .sbb-sr-place-ctrl__text{background-color:var(--sbb-seat-reservation-place-control-selected-background-hover);color:var(--sbb-seat-reservation-place-control-selected-text)}:host(:focus-visible) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-free-background-focus)}:host(:focus-visible) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-free-backrest-background-focus)}:host(:focus-visible) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) .sbb-sr-place-ctrl__text{background-color:var(--sbb-seat-reservation-place-control-free-background-focus);color:var(--sbb-seat-reservation-place-control-free-text)}@media (forced-colors:active){:host(:focus-visible) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-free-background-high-contrast)}:host(:focus-visible) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-free-backrest-high-contrast)}:host(:focus-visible) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-icon){fill:var(--sbb-seat-reservation-place-control-free-icon-high-contrast)}:host(:focus-visible) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) ::part(svg-seatline){stroke:var(--sbb-seat-reservation-place-control-free-backrest-high-contrast)}:host(:focus-visible) .sbb-sr-place-ctrl--state-free:not(.sbb-reservation-place-control--disabled) .sbb-sr-place-ctrl__text{forced-color-adjust:none;background-color:var(--sbb-seat-reservation-place-control-free-background-high-contrast);color:var(--sbb-seat-reservation-place-control-free-text-high-contrast)}}:host(:active) .sbb-sr-place-ctrl--state-selected:not(.sbb-reservation-place-control--disabled) ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-selected-background-focus)}:host(:active) .sbb-sr-place-ctrl--state-selected:not(.sbb-reservation-place-control--disabled) ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-selected-backrest-background-focus)}:host(:active) .sbb-sr-place-ctrl--state-selected:not(.sbb-reservation-place-control--disabled) .sbb-sr-place-ctrl__text{background-color:var(--sbb-seat-reservation-place-control-selected-background-focus);color:var(--sbb-seat-reservation-place-control-selected-text)}: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(svg-place){rotate:180deg}.sbb-sr-place-ctrl{width:max-content;font-size:calc(var(--sbb-seat-reservation-place-control-text-size) * var(--sbb-seat-reservation-one-px-rem,.0625rem));position:relative}.sbb-sr-place-ctrl--state-free ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-free-background-default)}.sbb-sr-place-ctrl--state-free ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-free-backrest-background-default)}.sbb-sr-place-ctrl--state-free .sbb-sr-place-ctrl__text{background-color:var(--sbb-seat-reservation-place-control-free-background-default);color:var(--sbb-seat-reservation-place-control-free-text)}@media (forced-colors:active){.sbb-sr-place-ctrl--state-free ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-free-background-high-contrast)}.sbb-sr-place-ctrl--state-free ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-free-backrest-high-contrast)}.sbb-sr-place-ctrl--state-free ::part(svg-icon){fill:var(--sbb-seat-reservation-place-control-free-icon-high-contrast)}.sbb-sr-place-ctrl--state-free ::part(svg-seatline){stroke:var(--sbb-seat-reservation-place-control-free-backrest-high-contrast)}.sbb-sr-place-ctrl--state-free .sbb-sr-place-ctrl__text{forced-color-adjust:none;background-color:var(--sbb-seat-reservation-place-control-free-background-high-contrast);color:var(--sbb-seat-reservation-place-control-free-text-high-contrast)}}.sbb-sr-place-ctrl--state-selected ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-selected-background-default)}.sbb-sr-place-ctrl--state-selected ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-selected-backrest-background-default)}.sbb-sr-place-ctrl--state-selected .sbb-sr-place-ctrl__text{background-color:var(--sbb-seat-reservation-place-control-selected-background-default);color:var(--sbb-seat-reservation-place-control-selected-text)}.sbb-sr-place-ctrl--state-allocated ::part(svg-place),.sbb-sr-place-ctrl--state-restricted ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-allocated-background-default)}.sbb-sr-place-ctrl--state-allocated ::part(svg-backrest),.sbb-sr-place-ctrl--state-restricted ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-allocated-backrest-background-default)}.sbb-sr-place-ctrl--state-allocated .sbb-sr-place-ctrl__text,.sbb-sr-place-ctrl--state-restricted .sbb-sr-place-ctrl__text{background-color:var(--sbb-seat-reservation-place-control-allocated-background-default);color:var(--sbb-seat-reservation-place-control-allocated-text)}@media (forced-colors:active){.sbb-sr-place-ctrl--state-allocated ::part(svg-place),.sbb-sr-place-ctrl--state-restricted ::part(svg-place){fill:var(--sbb-seat-reservation-place-control-allocated-background-high-contrast)}.sbb-sr-place-ctrl--state-allocated ::part(svg-backrest),.sbb-sr-place-ctrl--state-restricted ::part(svg-backrest){fill:var(--sbb-seat-reservation-place-control-allocated-backrest-high-contrast)}.sbb-sr-place-ctrl--state-allocated ::part(svg-icon),.sbb-sr-place-ctrl--state-restricted ::part(svg-icon){fill:var(--sbb-seat-reservation-place-control-allocated-icon-high-contrast)}.sbb-sr-place-ctrl--state-allocated ::part(svg-seatline),.sbb-sr-place-ctrl--state-restricted ::part(svg-seatline){stroke:var(--sbb-seat-reservation-place-control-allocated-backrest-high-contrast)}.sbb-sr-place-ctrl--state-allocated .sbb-sr-place-ctrl__text,.sbb-sr-place-ctrl--state-restricted .sbb-sr-place-ctrl__text{forced-color-adjust:none;background-color:var(--sbb-seat-reservation-place-control-allocated-background-high-contrast);color:var(--sbb-seat-reservation-place-control-allocated-text-high-contrast)}}.sbb-sr-place-ctrl--state-allocated,.sbb-sr-place-ctrl--state-restricted{cursor:not-allowed}.sbb-sr-place-ctrl__text{translate:-50% -50%;rotate:calc(var(--sbb-seat-reservation-place-control-text-rotation) * 1deg);font-family:var(--sbb-typo-font-family);font-size:.75em;line-height:initial;display:none;position:absolute;inset-block-start:50%;overflow:hidden}.sbb-sr-place-ctrl--state-free .sbb-sr-place-ctrl__text,.sbb-sr-place-ctrl--state-allocated .sbb-sr-place-ctrl__text{display:block}.sbb-sr-place-ctrl--type-bicycle .sbb-sr-place-ctrl__text{transform-origin:50% 16%;font-size:.6875em;inset-block-start:65%;inset-inline-start:50%}.sbb-sr-place-ctrl--orientation-0.sbb-sr-place-ctrl--type-seat .sbb-sr-place-ctrl__text{inset-inline-start:45%}.sbb-sr-place-ctrl--orientation-90.sbb-sr-place-ctrl--type-seat .sbb-sr-place-ctrl__text{inset-block-start:46%;inset-inline-start:50%}.sbb-sr-place-ctrl--orientation-180.sbb-sr-place-ctrl--type-seat .sbb-sr-place-ctrl__text{inset-inline-start:55%}.sbb-sr-place-ctrl--orientation-270.sbb-sr-place-ctrl--type-seat .sbb-sr-place-ctrl__text{inset-block-start:52%;inset-inline-start:52%}:host(:dir(rtl)) .sbb-sr-place-ctrl--orientation-0 .sbb-sr-place-ctrl__text{inset-inline-start:3%}:host(:dir(rtl)) .sbb-sr-place-ctrl--orientation-90 .sbb-sr-place-ctrl__text,:host(:dir(rtl)) .sbb-sr-place-ctrl--orientation-180 .sbb-sr-place-ctrl__text{inset-inline-start:10%}:host(:dir(rtl)) .sbb-sr-place-ctrl--orientation-270 .sbb-sr-place-ctrl__text{inset-inline-start:5%}:host(:dir(rtl)) .sbb-sr-place-ctrl--type-bicycle .sbb-sr-place-ctrl__text{inset-inline-start:-10%}
|
|
283
283
|
`,q=class extends Event{get detail(){return this._detail}constructor(e){super(`selectplace`,{bubbles:!0,composed:!0}),this._detail=e}};let J=(()=>{let r=n,a,s=[],c=[],l,u=[],f=[],h,_=[],v=[],y,x=[],S=[],C,w=[],T=[],E,D=[],O=[],k,A=[],j=[],M,N=[],P=[],F,L=[],R=[],z,V=[],H=[];return class extends r{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;a=[o(),g({attribute:`type`})],l=[o(),g({attribute:`state`,reflect:!0})],h=[g({attribute:`travel-direction`})],y=[g({attribute:`propertyIds`,type:Array})],C=[o(),g({attribute:`text`})],E=[o(),g({attribute:`deck-index`,type:Number})],k=[o(),g({attribute:`coach-index`,type:Number})],M=[o(),g({attribute:`prevent-click`,type:Boolean})],F=[o(),g({attribute:`keyfocus`})],z=[o(),g({type:Boolean,useDefault:!0})],e(this,null,a,{kind:`accessor`,name:`placeType`,static:!1,private:!1,access:{has:e=>`placeType`in e,get:e=>e.placeType,set:(e,t)=>{e.placeType=t}},metadata:t},s,c),e(this,null,l,{kind:`accessor`,name:`state`,static:!1,private:!1,access:{has:e=>`state`in e,get:e=>e.state,set:(e,t)=>{e.state=t}},metadata:t},u,f),e(this,null,h,{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},_,v),e(this,null,y,{kind:`accessor`,name:`propertyIds`,static:!1,private:!1,access:{has:e=>`propertyIds`in e,get:e=>e.propertyIds,set:(e,t)=>{e.propertyIds=t}},metadata:t},x,S),e(this,null,C,{kind:`accessor`,name:`text`,static:!1,private:!1,access:{has:e=>`text`in e,get:e=>e.text,set:(e,t)=>{e.text=t}},metadata:t},w,T),e(this,null,E,{kind:`accessor`,name:`deckIndex`,static:!1,private:!1,access:{has:e=>`deckIndex`in e,get:e=>e.deckIndex,set:(e,t)=>{e.deckIndex=t}},metadata:t},D,O),e(this,null,k,{kind:`accessor`,name:`coachIndex`,static:!1,private:!1,access:{has:e=>`coachIndex`in e,get:e=>e.coachIndex,set:(e,t)=>{e.coachIndex=t}},metadata:t},A,j),e(this,null,M,{kind:`accessor`,name:`preventClick`,static:!1,private:!1,access:{has:e=>`preventClick`in e,get:e=>e.preventClick,set:(e,t)=>{e.preventClick=t}},metadata:t},N,P),e(this,null,F,{kind:`accessor`,name:`keyfocus`,static:!1,private:!1,access:{has:e=>`keyfocus`in e,get:e=>e.keyfocus,set:(e,t)=>{e.keyfocus=t}},metadata:t},L,R),e(this,null,z,{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},V,H),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-seat-reservation-place-control`}static{this.elementDependencies=[B]}static{this.styles=[m(K)]}static{this.events={selectplace:`selectplace`}}#e;get placeType(){return this.#e}set placeType(e){this.#e=e}#t;get state(){return this.#t}set state(e){this.#t=e}#n;get travelDirection(){return this.#n}set travelDirection(e){this.#n=e}#r;get propertyIds(){return this.#r}set propertyIds(e){this.#r=e}#i;get text(){return this.#i}set text(e){this.#i=e}#a;get deckIndex(){return this.#a}set deckIndex(e){this.#a=e}#o;get coachIndex(){return this.#o}set coachIndex(e){this.#o=e}#s;get preventClick(){return this.#s}set preventClick(e){this.#s=e}#c;get keyfocus(){return this.#c}set keyfocus(e){this.#c=e}#l;get showTitleInfo(){return this.#l}set showTitleInfo(e){this.#l=e}constructor(){super(),this.#e=t(this,s,`SEAT`),this.#t=(t(this,c),t(this,u,`FREE`)),this.#n=(t(this,f),t(this,_,`NONE`)),this.#r=(t(this,v),t(this,x,[])),this.#i=(t(this,S),t(this,w,``)),this.#a=(t(this,T),t(this,D,null)),this.#o=(t(this,O),t(this,A,null)),this.#s=(t(this,j),t(this,N,!1)),this.#c=(t(this,P),t(this,L,`unfocus`)),this.#l=(t(this,R),t(this,V,!1)),this._language=(t(this,H),new i(this)),this.addEventListener(`click`,()=>this._selectPlace())}willUpdate(e){super.willUpdate(e),e.has(`keyfocus`)&&this.keyfocus===`focus`&&this.focus()}render(){let e=this._getPlaceSvg(this.placeType,this.state),t=this.type.toLowerCase(),n=this.state.toLowerCase(),r=this.text,i=this.style?.getPropertyValue(`--sbb-seat-reservation-place-control-width`),a=this.style?.getPropertyValue(`--sbb-seat-reservation-place-control-height`),o=this.style?.getPropertyValue(`--sbb-seat-reservation-place-control-rotation`),s=this.style?.getPropertyValue(`--sbb-seat-reservation-place-control-text-rotation`),c=Number(s)-Number(o),l=this.preventClick?`sbb-reservation-place-control--disabled`:null,u=this._getTitleDescriptionPlace(o);return this.showTitleInfo?(this.title=u,this.internals.ariaLabel=null):(this.internals.ariaLabel=u,this.removeAttribute(`title`)),this.tabIndex=-1,d` <div
|
|
284
284
|
part="sbb-sr-place-part"
|
|
@@ -291,7 +291,7 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
|
|
|
291
291
|
></sbb-seat-reservation-graphic>
|
|
292
292
|
<span ${this.text??p} class="sbb-sr-place-ctrl__text">${r} </span>
|
|
293
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}_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:!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,!0)),a=e.graphicElements?.filter(e=>this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,!1)),o=e.serviceElements?.map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,!0)),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){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 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 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))}.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}
|
|
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}_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,!0)),a=e.graphicElements?.filter(e=>this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,!1)),o=e.serviceElements?.map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,!0)),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){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 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 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))}.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 class="sbb-sr__component">
|
|
@@ -441,14 +441,14 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
|
|
|
441
441
|
aria-hidden="true"
|
|
442
442
|
>
|
|
443
443
|
${a?d`
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
444
|
+
<sbb-seat-reservation-graphic
|
|
445
|
+
style=${b({"--sbb-seat-reservation-graphic-max-width":this.globalAreaIconDim.w,"--sbb-seat-reservation-graphic-max-height":this.globalAreaIconDim.h,"--sbb-seat-reservation-graphic-width":n.dimension.w,"--sbb-seat-reservation-graphic-height":n.dimension.h,"--sbb-seat-reservation-graphic-rotation":n.rotation,"--sbb-seat-reservation-graphic-padding-percent":a===`ENTRY_EXIT`?1:this.globalAreaIconPadding})}
|
|
446
|
+
name=${a}
|
|
447
|
+
role="img"
|
|
448
|
+
aria-hidden="true"
|
|
449
|
+
class="sbb-sr-graphic__dimension--square-dim"
|
|
450
|
+
></sbb-seat-reservation-graphic>
|
|
451
|
+
`:p}
|
|
452
452
|
</sbb-seat-reservation-area>
|
|
453
453
|
${a?this._popover(r,o):p}
|
|
454
454
|
`})}_getRenderedServiceElements(e,t){return this.seatReservationStructure.decks[e].deckCoaches[t].serviceElements.map(n=>{let r=`popover-trigger-${e}-${t}-${n.position.x}-${n.position.y}`,i=n.icon?I(n.icon,this._language.current):null;return d`
|