@sbb-esta/lyne-elements-experimental 5.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sbb-esta/lyne-elements-experimental",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "Lyne Design System",
5
5
  "keywords": [
6
6
  "design system",
@@ -142,7 +142,7 @@
142
142
  },
143
143
  "customElements": "custom-elements.json",
144
144
  "peerDependencies": {
145
- "@sbb-esta/lyne-elements": "5.2.0"
145
+ "@sbb-esta/lyne-elements": "5.3.0"
146
146
  },
147
147
  "dependencies": {
148
148
  "lit": "^3.3.3",
@@ -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">