@digital-blueprint/checkin-app
Version:
[GitHub Repository](https://github.com/digital-blueprint/checkin-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/checkin-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/checkin-app/) | [Checkin Bundle](https://github
456 lines (411 loc) • 34.9 kB
JavaScript
let t,e,i,n,s,a,r,o,c,h,l,d,u,p=t=>t;function g(){return g=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},g.apply(this,arguments)}
/*!
* License: LGPL-2.1-or-later
* Dependencies:
*
* @webcomponents/scoped-custom-element-registry: 0.0.9 (BSD-3-Clause)
* @dbp-toolkit/app-shell: 0.3.4 (LGPL-2.1-or-later)
* @dbp-toolkit/language-select: 0.3.2 (LGPL-2.1-or-later)
* @dbp-toolkit/common: 0.3.5 (LGPL-2.1-or-later)
* @dbp-toolkit/auth: 0.3.2 (LGPL-2.1-or-later)
* event-target-shim: 6.0.2 (MIT)
* @dbp-toolkit/notification: 0.3.2 (LGPL-2.1-or-later)
* @dbp-toolkit/theme-switcher: 0.0.6 (LGPL-2.1-or-later)
* path-to-regexp: 6.2.0 (MIT)
* universal-router: 9.1.0 (MIT)
* generateUrls: 9.1.0 (MIT)
* @dbp-toolkit/matomo: 0.2.7 (LGPL-2.1-or-later)
* @dbp-toolkit/qr-code-scanner: 0.3.3 (LGPL-2.1-or-later)
* async-mutex: 0.4.0 (MIT)
*/import{D as m,c as b,A as v,g as y}from"./shared/activity.pxR99eKk.es.js";import{D as w,i as k,g as _,b as f,d as $,x as S,c as C,S as x,I,M as R,m as q,f as E,r as M,n as P,o as Q,L as N,s as H,p as D,l as O,k as B}from"./shared/notification.fWOMSAA9.es.js";import{T as A}from"./shared/textswitch.UQb80iHx.es.js";import{C as W,p as T,e as j}from"./shared/check-in-place-select.6YIWD7RZ.es.js";import"./shared/utils.uVgKQcsS.es.js";class L extends w{constructor(){super(),this.type="",this.summary="",this.body=""}static get properties(){return{type:{type:String},summary:{type:String},body:{type:String}}}connectedCallback(){super.connectedCallback()}static get styles(){return k(t||(t=p`
${0}
${0}
${0}
.notification:not(:last-child) {
margin-bottom: 1.5rem;
}
.notification h3 {
font-weight: bold;
margin-bottom: 3px;
}
.notification h3 {
margin: 0 0 3px 0;
font: inherit;
font-weight: bold;
}
`),_(),f(),$())}createBodyHtml(){return document.createRange().createContextualFragment(`<slot name="body">${this.body}</slot>`)}render(){const t=this.createBodyHtml();return S(e||(e=p`
<div class="columns">
<div class="column">
<div
id="inline-notification"
class="notification is-${0}">
${0}
${0}
</div>
</div>
</div>
`),""!==this.type?this.type:"info",""!==this.summary?S(i||(i=p`
<h3>${0}</h3>
`),this.summary):"",t)}}var U={"back-camera":"Rückseitige Kamera",camera:"Kamera ","check-access":"Bitte stellen Sie sicher, dass eine Webcam oder Kamera aktiviert ist und überprüfen Sie ob Ihr Browser die notwendigen Berechtigungen besitzt.",data:"Inhalt","front-camera":"Vordere Kamera","loading-video":"Video laden ...","no-camera-access":"Zugriff auf Kamera nicht möglich.","no-ios-support":"Ihr Browser unterstützt keine Videoaufnahmen. Bitte verwenden Sie Safari.","no-qr-detected":"Kein QR-Code erkannt.","no-support":"Ihr Browser unterstützt keine Videoaufnahmen.","start-scan":"Scannen starten","stop-scan":"Scannen stoppen"},z={"back-camera":"Backcamera",camera:"Camera ","check-access":"Please make sure that a webcam or camera is activated and check whether your browser has the necessary authorizations.",data:"Data","front-camera":"Frontcamera","loading-video":"⌛ Loading video...","no-camera-access":"Unable to access video stream.","no-ios-support":"Your browser does not support video recording. Please use Safari.","no-qr-detected":"No QR code detected.","no-support":"Your browser does not support video recording.","start-scan":"Start scan","stop-scan":"Stop scan"};const V=new Error("request for lock canceled");var F=function(t,e,i,n){return new(i||(i=Promise))((function(s,a){function r(t){try{c(n.next(t))}catch(t){a(t)}}function o(t){try{c(n.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,o)}c((n=n.apply(t,e||[])).next())}))};class K{constructor(t,e=V){this._value=t,this._cancelError=e,this._weightedQueues=[],this._weightedWaiters=[]}acquire(t=1){if(t<=0)throw new Error(`invalid weight ${t}: must be positive`);return new Promise(((e,i)=>{this._weightedQueues[t-1]||(this._weightedQueues[t-1]=[]),this._weightedQueues[t-1].push({resolve:e,reject:i}),this._dispatch()}))}runExclusive(t,e=1){return F(this,void 0,void 0,(function*(){const[i,n]=yield this.acquire(e);try{return yield t(i)}finally{n()}}))}waitForUnlock(t=1){if(t<=0)throw new Error(`invalid weight ${t}: must be positive`);return new Promise((e=>{this._weightedWaiters[t-1]||(this._weightedWaiters[t-1]=[]),this._weightedWaiters[t-1].push(e),this._dispatch()}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(t){this._value=t,this._dispatch()}release(t=1){if(t<=0)throw new Error(`invalid weight ${t}: must be positive`);this._value+=t,this._dispatch()}cancel(){this._weightedQueues.forEach((t=>t.forEach((t=>t.reject(this._cancelError))))),this._weightedQueues=[]}_dispatch(){var t;for(let e=this._value;e>0;e--){const i=null===(t=this._weightedQueues[e-1])||void 0===t?void 0:t.shift();if(!i)continue;const n=this._value,s=e;this._value-=e,e=this._value+1,i.resolve([n,this._newReleaser(s)])}this._drainUnlockWaiters()}_newReleaser(t){let e=!1;return()=>{e||(e=!0,this.release(t))}}_drainUnlockWaiters(){for(let t=this._value;t>0;t--)this._weightedWaiters[t-1]&&(this._weightedWaiters[t-1].forEach((t=>t())),this._weightedWaiters[t-1]=[])}}var Y=function(t,e,i,n){return new(i||(i=Promise))((function(s,a){function r(t){try{c(n.next(t))}catch(t){a(t)}}function o(t){try{c(n.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,o)}c((n=n.apply(t,e||[])).next())}))};class G{constructor(t){this._semaphore=new K(1,t)}acquire(){return Y(this,void 0,void 0,(function*(){const[,t]=yield this._semaphore.acquire();return t}))}runExclusive(t){return this._semaphore.runExclusive((()=>t()))}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class Z{constructor(){this.data=null,this.cornerPoints=null}}class J{constructor(){this._engine=null,this._canvas=document.createElement("canvas"),this._scanner=null}async scanImage(t,e=null){null===this._scanner&&(this._scanner=(await import("./shared/qr-scanner.min.GO0xfeSl.es.js")).default),null===this._engine&&(this._engine=await this._scanner.createQrEngine());try{let i=await this._scanner.scanImage(t,{scanRegion:null!=e?e:null,qrEngine:this._engine,canvas:this._canvas}),n=new Z;return n.data=i.data,n.cornerPoints=i.cornerPoints,n}catch(t){return null}}}class X extends(x(w)){constructor(){super(),this._i18n=C({en:z,de:U},"de","en"),this.lang=this._i18n.language,this._askPermission=!1,this._loading=!1,this.showOutput=!1,this.stopScan=!1,this._activeCamera="",this._devices=new Map,this._requestID=null,this._loadingMessage="",this.matchRegex=".*",this._videoElement=null,this._outputData=null,this._videoRunning=!1,this._lock=new G}static get scopedElements(){return{"dbp-icon":I,"dbp-mini-spinner":R}}static get properties(){return{lang:{type:String},showOutput:{type:Boolean,attribute:"show-output"},stopScan:{type:Boolean,attribute:"stop-scan"},matchRegex:{type:String,attribute:"match-regex"},_activeCamera:{type:String,attribute:!1},_loading:{type:Boolean,attribute:!1},_devices:{type:Map,attribute:!1},_loadingMessage:{type:String,attribute:!1},_outputData:{type:String,attribute:!1},_askPermission:{type:Boolean,attribute:!1},_videoRunning:{type:Boolean,attribute:!1}}}async connectedCallback(){super.connectedCallback();let t=await async function(t){let e=new Map;if(navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&navigator.mediaDevices.getUserMedia){let i;try{i=await navigator.mediaDevices.enumerateDevices()}catch(t){return console.log(t.name+": "+t.message),e}for(let n of i)if("videoinput"===n.kind){let i=n.deviceId;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?(e.set("environment",t.t("back-camera")),e.set("user",t.t("front-camera"))):e.set(i||!0,n.label||t.t("camera")+(e.size+1))}return e}return e}(this._i18n);this._activeCamera=function(t){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&t.has("environment")?"environment":t.size?Array.from(t)[0][0]:null}(t)||"",this._devices=t,this.stopScan||await this.startScanning()}async disconnectedCallback(){await this.stopScanning(),super.disconnectedCallback()}updated(t){t.get("stopScan")&&!this.stopScan?this.startScanning():!t.get("stopScan")&&this.stopScan&&this.stopScanning()}update(t){t.forEach(((t,e)=>{if("lang"===e)this._i18n.changeLanguage(this.lang)})),super.update(t)}async startScanning(){await this.stopScanning();const t=await this._lock.acquire();try{await this._startScanning()}finally{t()}}async _startScanning(){const t=this._i18n;console.assert(this._lock.isLocked()),await this.updateComplete;let e=this._("#canvas"),i=this._("#video"),s=document.createElement("canvas"),a=!1;this._askPermission=!0,this._loadingMessage=S(n||(n=p`
${0}
<br />
${0}
`),t.t("no-camera-access"),t.t("check-access"));let r=await async function(t){let e=t,i={video:{deviceId:e}};"environment"===e||""===e?(console.log("vid:",e),i={video:{facingMode:"environment"}}):"user"===e&&(console.log("vid2:",e),i={video:{facingMode:"user",mirrored:!0}});let n=null;try{n=await navigator.mediaDevices.getUserMedia(i)}catch(t){console.log(t)}if(null!==n){let t=document.createElement("video");return t.srcObject=n,t}return null}(this._activeCamera);null!==r&&i.appendChild(r),this._askPermission=!1;let o=null,c=null,h=new J,l=!1;const d=()=>{if(this._requestID=null,r.readyState===r.HAVE_ENOUGH_DATA){this._loading=!1,s.height=r.videoHeight,s.width=r.videoWidth;let t=s.getContext("2d");t.drawImage(r,0,0,s.width,s.height);let i=s.width,n=s.height,d=0,u=0,p=s.width>s.height?s.height/4*3:s.width/4*3;console.assert(p<=s.width&&p<=s.height),i=p,n=p,d=s.width/2-i/2,u=s.height/2-n/2;let g=r;l||(l=!0,h.scanImage(s,{x:d,y:u,width:i,height:n}).then((t=>{if(l=!1,g===this._videoElement)if(o=t,t){let e=t.data;c!==e&&(this._outputData=e,this.dispatchEvent(new CustomEvent("code-detected",{bubbles:!0,composed:!0,detail:{code:e}}))),c=e}else this._outputData=null,c=null})));let m=!!o&&null!==o.data.match(this.matchRegex);if(t.beginPath(),t.fillStyle="#0000006e",t.moveTo(0,0),t.lineTo(0,s.height),t.lineTo(s.width,s.height),t.lineTo(s.width,0),t.rect(d,u,i,n),t.fill(),t.beginPath(),o){let e=getComputedStyle(this).getPropertyValue("--dbp-success"),i=getComputedStyle(this).getPropertyValue("--dbp-danger");t.fillStyle=m?e:i}else t.fillStyle="white";let b=Math.max(i,n)/50;t.moveTo(d,u),t.rect(d,u,i/3,b),t.rect(d,u,b,n/3),t.rect(d+i/3*2,u,i/3,b),t.rect(d+i-b,u,b,n/3),t.rect(d,u+n-b,i/3,b),t.rect(d,u+n/3*2,b,n/3),t.rect(d+i/3*2,u+n-b,i/3,b),t.rect(d+i-b,u+n/3*2,b,n/3),t.fill(),e.height=s.height,e.width=s.width,e.getContext("2d").drawImage(s,0,0),a||(this.dispatchEvent(new CustomEvent("scan-started",{bubbles:!0,composed:!0})),a=!0)}console.assert(null===this._requestID),this._requestID=requestAnimationFrame(d)};null!==r&&(r.setAttribute("playsinline",!0),r.play(),this._videoRunning=!0,console.assert(null===this._requestID),this._videoElement=r,this._loading=!0,this._loadingMessage=t.t("loading-video"),this._requestID=requestAnimationFrame(d))}async _onUpdateSource(t){this._activeCamera=t.srcElement.value,await this.stopScanning(),await this.startScanning(),console.log("Changed Media")}async stopScanning(){const t=await this._lock.acquire();try{if(null!==this._videoElement){this._videoElement.srcObject.getTracks().forEach((function(t){t.stop()})),this._videoElement=null}null!==this._requestID&&(cancelAnimationFrame(this._requestID),this._requestID=null),this._askPermission=!1,this._videoRunning=!1,this._loading=!1,this._loadingMessage=""}finally{t()}}static get styles(){return k(s||(s=p`
${0}
${0}
${0}
${0}
#loadingMessage {
text-align: center;
padding: 40px;
}
.wrapper-msg {
width: 100%;
display: flex;
justify-content: center;
align-items: baseline;
}
#canvas {
margin-top: 2rem;
max-height: calc(100vh - 100px);
max-width: 100%;
}
.output {
margin-top: 20px;
background: var(--dbp-muted-surface);
color: var(--dbp-on-muted-surface);
border: var(--dbp-border);
border-color: var(--dbp-muted-surface-border-color);
padding: 10px;
padding-bottom: 0;
}
.output div {
padding-bottom: 10px;
word-wrap: break-word;
}
.spinner {
margin-right: 10px;
font-size: 0.7em;
}
#videoSource {
padding-bottom: calc(0.375em - 2px);
padding-left: 0.75em;
padding-right: 1.75em;
padding-top: calc(0.375em - 2px);
background-position-x: calc(100% - 0.4rem);
font-size: inherit;
}
#videoSource:hover {
background: calc(100% - 0.2rem) center no-repeat
url('${0}');
color: var(--dbp-content);
background-position-x: calc(100% - 0.4rem);
background-size: auto 45%;
}
select:not(.select)#videoSource {
background-size: auto 45%;
}
.border {
margin-top: 2rem;
padding-top: 2rem;
border-top: var(--dbp-border);
}
#video video,
#video {
height: 0px;
width: 0px;
opacity: 0;
}
only screen and (orientation: portrait) and (max-width: 768px) {
.button-wrapper {
display: flex;
justify-content: space-between;
}
}
`),_(),f(),q(),E(),M(P("chevron-down")))}render(){const t=this._i18n;let e=this._devices.size>0,i=this._videoRunning&&!this._askPermission&&!this._loading,n=(this._devices,/(iPhone|iPad|iPod).*(CriOS|FxiOS|OPT|EdgiOS|YaBrowser|AlohaBrowser)/i.test(navigator.userAgent)?t.t("no-ios-support"):t.t("no-support"));return S(a||(a=p`
<div class="columns">
<div class="column">
<div class="${0}">
<div class="button-wrapper">
<button
class="start button is-primary ${0}"
="${0}"
title="${0}">
${0}
</button>
<button
class="stop button is-primary ${0}"
="${0}"
title="${0}">
${0}
</button>
<select id="videoSource" class="button" =${0}>
${0}
</select>
</div>
<div id="loadingMessage" class="${0}">
<div class="wrapper-msg">
<dbp-mini-spinner
class="spinner ${0}"></dbp-mini-spinner>
<div class="loadingMsg">${0}</div>
</div>
</div>
<canvas id="canvas" class="${0}"></canvas>
<div id="video"></div>
<div class="output ${0}">
${0}
</div>
</div>
<div class="${0}">${0}</div>
</div>
</div>
`),Q({hidden:!e}),Q({hidden:this._videoRunning}),(()=>this.startScanning()),t.t("start-scan"),t.t("start-scan"),Q({hidden:!this._videoRunning}),(()=>this.stopScanning()),t.t("stop-scan"),t.t("stop-scan"),this._onUpdateSource,Array.from(this._devices).map((t=>S(r||(r=p`
<option value="${0}">${0}</option>
`),t[0],t[1]))),Q({hidden:i}),Q({hidden:!this._loading}),this._loadingMessage,Q({hidden:!i}),Q({hidden:!(this.showOutput&&i)}),null!==this._outputData?S(o||(o=p`
<div>
<b>${0}:</b>
<span>${0}</span>
</div>
`),t.t("data"),this._outputData):S(c||(c=p`
<div>${0}</div>
`),t.t("no-qr-detected")),Q({hidden:e}),n)}}var tt={element:"dbp-check-in-request",module_src:"dbp-check-in-request.js",routing_name:"check-in-request",name:{de:"An Ort anmelden",en:"Check-in at a place"},short_name:{de:"An Ort anmelden",en:"Check-in at a place"},description:{de:"Meldet den eingeloggten User an einem Ort an.",en:"Logs the logged in user in one place."},subscribe:"lang,entry-point-url,search-hash-string,auth,html-overrides"};class et extends(x(m)){constructor(){super(),this._i18n=b(),this.lang=this._i18n.language,this.activity=new v(tt),this.entryPointUrl="",this.locationHash="",this.seatNr="",this.isCheckedIn=!1,this.checkedInRoom="",this.checkedInSeat=null,this.checkedInEndTime="",this.identifier="",this.agent="",this.showManuallyContainer=!1,this.showQrContainer=!1,this.searchHashString="",this.wrongHash=[],this.wrongQR=[],this.isRoomSelected=!1,this.roomCapacity=0,this._checkInInProgress=!1,this.checkinCount=0,this.loading=!1,this.loadingMsg="",this.status=null,this.resetWrongQr=!1,this.resetWrongHash=!1}static get scopedElements(){return{"dbp-icon":I,"dbp-mini-spinner":R,"dbp-loading-button":N,"dbp-textswitch":A,"dbp-qr-code-scanner":X,"dbp-check-in-place-select":W,"dbp-inline-notification":L}}static get properties(){return g({},super.properties,{lang:{type:String},entryPointUrl:{type:String,attribute:"entry-point-url"},locationHash:{type:String,attribute:!1},seatNr:{type:Number,attribute:!1},isCheckedIn:{type:Boolean,attribute:!1},showManuallyContainer:{type:Boolean,attribute:!1},showQrContainer:{type:Boolean,attribute:!1},isRoomSelected:{type:Boolean,attribute:!1},roomCapacity:{type:Number,attribute:!1},checkedInStartTime:{type:String,attribute:!1},checkinCount:{type:Number,attribute:!1},checkedInEndTime:{type:String,attribute:!1},loadingMsg:{type:String,attribute:!1},searchHashString:{type:String,attribute:"search-hash-string"},loading:{type:Boolean,attribute:!1},status:{type:Object,attribute:!1},wrongQR:{type:Array,attribute:!1},wrongHash:{type:Array,attribute:!1}})}connectedCallback(){super.connectedCallback()}update(t){let e=this;t.forEach(((t,i)=>{switch(i){case"lang":this._i18n.changeLanguage(this.lang);break;case"status":void 0!==t&&setTimeout((function(){e._("#notification-wrapper").scrollIntoView({behavior:"smooth",block:"end"})}),10)}})),super.update(t)}async tryCheckOut(t,e){let i,n=0;for(;4!==n;){let s=Math.pow(5,n);if(i=await this.sendCheckOutRequest(t,e),201===i.status)return i;await new Promise((t=>setTimeout(t,s))),n++}return i}resetCheckin(t){t.isCheckedIn=!1,t.locationHash="",t.seatNr="",t.checkedInRoom="",t.checkedInSeat="",t.checkedInEndTime="",t.isRoomSelected=!1;let e=t.shadowRoot.querySelector(t.getScopedTagName("dbp-check-in-place-select"));null!==e&&e.clear()}async doCheckOut(t){let e,i=t.target;i.start();try{e=await this.tryCheckOut(this.locationHash,this.seatNr)}finally{i.stop()}return await this.checkCheckoutResponse(e,this.locationHash,this.seatNr,this.checkedInRoom,"CheckInRequest",this,this.resetCheckin),e}async doCheckInWithQR(t){let e=t.detail.code;if(t.stopPropagation(),!this._checkInInProgress){this._checkInInProgress=!0;try{await this.decodeUrl(e)&&(null===this.roomCapacity&&this.seatNr>=0&&(this.seatNr=""),await this.doCheckIn(this.locationHash,this.seatNr,this.checkedInRoom,"CheckInRequest",!1,!0))}finally{this._checkInInProgress=!1,this.loading=!1,this.loadingMsg=""}}}async doCheckInManually(t){let e=t.target;if(!e.disabled)try{e.start(),null===this.roomCapacity&&this.seatNr>=0&&(this.seatNr=""),await this.doCheckIn(this.locationHash,this.seatNr,this.checkedInRoom,"CheckInRequest",!1,!0)}finally{e.stop()}}stopQRReader(){this._("#qr-scanner")?(this._("#qr-scanner").stopScan=!0,this.showManuallyContainer=!1,this.showQrContainer=!1):console.log("error: qr scanner is not available. Is it already stopped?")}async decodeUrl(t){const e=this._i18n;let i,n;try{[i,n]=T(t,this.searchHashString)}catch(i){if(await this.wrongQR.includes(t)){const t=this;return this.resetWrongQr||(this.resetWrongQr=!0,setTimeout((function(){t.wrongQR.splice(0,t.wrongQR.length),t.wrongQR.length=0,t.resetWrongQr=!1}),3e3)),!1}return this.wrongQR.push(t),H({summary:e.t("check-in.qr-false-title"),body:e.t("check-in.qr-false-body"),type:"danger",timeout:5}),!1}this.locationHash=i,this.seatNr=null===n?"":n;let s=this.locationHash+"-"+this.seatNr,a=await this.wrongHash.includes(s);if(a){const t=this;this.resetWrongHash||(this.resetWrongHash=!0,setTimeout((function(){t.wrongHash.splice(0,t.wrongHash.length),t.wrongHash.length=0,t.resetWrongHash=!1}),3e3))}return!a}showQrReader(){this.showQrContainer=!0,this.showManuallyContainer=!1,this._("#qr-scanner")&&(this._("#qr-scanner").stopScan=!1)}showRoomSelector(){this._("#qr-scanner").stopScan=!0,this.showManuallyContainer=!0,this.showQrContainer=!1,this._("#roomselectorwrapper").scrollIntoView({behavior:"smooth",block:"start"});const t=this;this._("#manual-select").addEventListener("keypress",(function(e){"Enter"===e.key&&(null===this.roomCapacity&&this.seatNr>=0&&(this.seatNr=""),t.doCheckIn(this.locationHash,this.seatNr,this.checkedInRoom,"CheckInRequest",!1,!0))}))}processSelectedPlaceInformation(t){this.isRoomSelected=!0,this.roomCapacity=t.detail.capacity,this.locationHash=t.detail.room}setSeatNumber(t){let e=parseInt(this._("#select-seat").value);e=isNaN(e)?"":e,this.seatNr=Math.min(this.roomCapacity,e),this._("#select-seat").value=this.seatNr}checkinSwitch(t){"manual"===t?this.showRoomSelector():this.showQrReader()}async doRefreshSession(t){let e=t.target;e.start();try{await this.refreshSession(this.locationHash,this.seatNr,this.checkedInRoom,"CheckInRequest",!0)}finally{e.stop()}}static get styles(){return k(h||(h=p`
${0}
${0}
${0}
${0}
${0}
${0}
#btn-container {
margin-top: 1.5rem;
margin-bottom: 2rem;
}
.btn {
display: contents;
}
.element {
margin-top: 1.5rem;
}
.border {
margin-top: 2rem;
border-top: var(--dbp-border);
}
.grid-container {
margin-top: 2rem;
padding-top: 2rem;
flex-flow: column;
}
#text-switch {
display: block;
width: 50%;
}
#select-seat {
padding-left: 8px;
font-weight: 300;
color: inherit;
border: var(--dbp-border);
border-color: var(--dbp-muted);
line-height: 100%;
margin-bottom: 0.75rem;
height: 28px;
}
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type='number'] {
-moz-appearance: textfield;
}
.checkins {
display: grid;
grid-template-columns: repeat(3, max-content);
column-gap: 15px;
row-gap: 1.5em;
align-items: center;
}
.header {
display: grid;
align-items: center;
}
.inline-notification {
margin-top: 2rem;
display: block;
}
only screen and (orientation: portrait) and (max-width: 768px) {
.header {
margin-bottom: 0.5rem;
}
.btn {
display: flex;
flex-direction: column;
text-align: center;
}
.logout {
width: 100%;
box-sizing: border-box;
}
#text-switch {
display: block;
width: 100%;
}
#select-seat {
width: 100%;
}
#refresh-btn {
margin-top: 0.5rem;
}
.loading {
justify-content: center;
}
.checkins {
display: block;
}
}
`),_(),f(!1),$(),D(),y(),O())}_onScanStarted(t){requestAnimationFrame((()=>{setTimeout((()=>{this._("#qr-scanner").scrollIntoView({behavior:"smooth",block:"start"})}),0)}))}render(){const t=".*"+j(this.searchHashString)+".*",e=this._i18n;return S(l||(l=p`
<div
class="notification is-warning ${0}">
${0}
</div>
<div class="control ${0}">
<span class="loading">
<dbp-mini-spinner
text=${0}></dbp-mini-spinner>
</span>
</div>
<div class="${0}">
<h2>${0}</h2>
<div>
<p class="subheadline">
<slot name="description">${0}</slot>
</p>
<slot name="additional-information">
<p>${0}</p>
<p>${0}</p>
</slot>
</div>
<div id="btn-container" class="${0}">
<dbp-textswitch
id="text-switch"
name1="qr-reader"
name2="manual"
name="${0} || ${0}"
class="switch"
value1="${0}"
value2="${0}"
=${0}></dbp-textswitch>
</div>
<div class="grid-container border ${0}">
<div class="checkins">
<span class="header">
<strong>${0}</strong>
${0}
${0}
${0}
</span>
<div>
<div class="btn">
<dbp-loading-button
type="is-primary"
?disabled="${0}"
value="${0}"
="${0}"
title="${0}"></dbp-loading-button>
</div>
</div>
<div>
<div class="btn">
<dbp-loading-button
id="refresh-btn"
?disabled="${0}"
value="${0}"
="${0}"
title="${0}"></dbp-loading-button>
</div>
</div>
</div>
${0}
<div class="control ${0}">
<span class="loading">
<dbp-mini-spinner text=${0}></dbp-mini-spinner>
</span>
</div>
</div>
<div id="notification-wrapper"></div>
<div id="roomselectorwrapper"></div>
<div
class="border ${0}">
<div
class="element ${0}">
<dbp-qr-code-scanner
id="qr-scanner"
lang="${0}"
stop-scan
match-regex="${0}"
-started="${0}"
-detected="${0}"></dbp-qr-code-scanner>
</div>
<div
class="element ${0}">
<div class="container" id="manual-select">
<p>${0}</p>
<div class="field">
<label class="label">${0}</label>
<div class="control">
<dbp-check-in-place-select
subscribe="auth"
lang="${0}"
entry-point-url="${0}"
="${0}"></dbp-check-in-place-select>
</div>
</div>
<div
class="field ${0}">
<label class="label">${0}</label>
<div class="control">
<input
class="input"
id="select-seat"
type="number"
.value="${0}"
name="seat-number"
min="1"
max="${0}"
placeholder="1-${0}"
maxlength="4"
inputmode="numeric"
pattern="[0-9]*"
?disabled=${0}
="${0}" />
</div>
</div>
<div class="btn">
<dbp-loading-button
id="do-manually-checkin"
type="is-primary"
value="${0}"
="${0}"
title="${0}"
?disabled=${0}></dbp-loading-button>
</div>
</div>
</div>
<div class="control ${0}">
<span class="loading">
<dbp-mini-spinner text=${0}></dbp-mini-spinner>
</span>
</div>
</div>
</div>
`),Q({hidden:this.isLoggedIn()||this.isLoading()}),e.t("error-login-message"),Q({hidden:this.isLoggedIn()||!this.isLoading()}),e.t("check-out.loading-message"),Q({hidden:!this.isLoggedIn()||this.isLoading()}),this.activity.getName(this.lang),this.activity.getDescription(this.lang),e.t("check-in.how-to"),e.t("check-in.data-protection"),Q({hidden:this.isCheckedIn}),e.t("check-in.qr-button-text"),e.t("check-in.manually-button-text"),e.t("check-in.qr-button-text"),e.t("check-in.manually-button-text"),(t=>this.checkinSwitch(t.target.name)),Q({hidden:!this.isCheckedIn}),this.checkedInRoom,null!==this.checkedInSeat?S(d||(d=p`
${0}: ${0}
<br />
`),e.t("check-in.seatNr"),this.checkedInSeat):"",e.t("check-out.checkin-until"),this.getReadableDate(this.checkedInEndTime),this.loading,e.t("check-out.button-text"),(t=>{this.doCheckOut(t)}),e.t("check-out.button-text"),this.loading,e.t("check-in.refresh-button-text"),(t=>{this.doRefreshSession(t)}),e.t("check-in.refresh-button-text"),this.status?S(u||(u=p`
<dbp-inline-notification
class="inline-notification"
type="${0}"
summary="${0}"
body="${0}"></dbp-inline-notification>
`),this.status.type,e.t(this.status.summary),e.t(this.status.body,this.status.options)):"",Q({hidden:!this.loading}),this.loadingMsg,Q({hidden:!(this.showQrContainer||this.showManuallyContainer)}),Q({hidden:this.isCheckedIn&&!this.showQrContainer||this.showManuallyContainer||this.loading}),this.lang,t,this._onScanStarted,(t=>{this.doCheckInWithQR(t)}),Q({hidden:this.isCheckedIn&&!this.showManuallyContainer||this.showQrContainer||this.loading}),e.t("check-in.manual-checkin"),e.t("check-in.manually-place"),this.lang,this.entryPointUrl,(t=>{this.processSelectedPlaceInformation(t)}),Q({hidden:!this.isRoomSelected||null===this.roomCapacity}),e.t("check-in.manually-seat"),this.seatNr,this.roomCapacity,this.roomCapacity,!this.isRoomSelected,(t=>{this.setSeatNumber(t)}),e.t("check-in.manually-checkin-button-text"),this.doCheckInManually,e.t("check-in.manually-checkin-button-text"),!this.isRoomSelected||this.isRoomSelected&&null!==this.roomCapacity&&this.seatNr<=0,Q({hidden:!this.loading}),this.loadingMsg)}}B("dbp-check-in-request",et);
//# sourceMappingURL=dbp-check-in-request.js.map