starti.app 1.1.7-alpha.2 → 1.2.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/dist/app.d.ts CHANGED
@@ -8,6 +8,11 @@ declare type AppEvents = {
8
8
  appInForeground: CustomEvent<never>;
9
9
  navigatingPage: CustomEvent<NavigatingPageEvent>;
10
10
  };
11
+ declare type SpinnerOptions = {
12
+ afterMilliseconds?: number;
13
+ show?: boolean;
14
+ color?: string;
15
+ };
11
16
  export interface IApp extends EventTargetMethods<AppEvents> {
12
17
  /** Request the user reviews the app. */
13
18
  requestReview: () => void;
@@ -49,5 +54,7 @@ export interface IApp extends EventTargetMethods<AppEvents> {
49
54
  removeExternalDomains(...domains: RegExp[]): void;
50
55
  /** Get external domains */
51
56
  getExternalDomains(): Promise<ExternalDomain[]>;
57
+ /** Sets options for the navigation spinner */
58
+ setSpinner(options: SpinnerOptions): void;
52
59
  }
53
60
  export {};
package/dist/app.js CHANGED
@@ -9,7 +9,7 @@ class AppClass extends EventHandlerWithTypes_1.EventTargetWithType {
9
9
  this.startiappIsLoaded = false;
10
10
  }
11
11
  get appIntegration() {
12
- return (0, getIntegration_1.getIntegration)('AppIntegration');
12
+ return (0, getIntegration_1.getIntegration)("AppIntegration");
13
13
  }
14
14
  setStartiappIsLoaded() {
15
15
  this.startiappIsLoaded = true;
@@ -68,6 +68,15 @@ class AppClass extends EventHandlerWithTypes_1.EventTargetWithType {
68
68
  setStatusBar(options) {
69
69
  this.appIntegration.setStatusBar(options);
70
70
  }
71
+ setSpinner(options) {
72
+ if (!this.appIntegration.setNavigationSpinner)
73
+ return console.warn("setNavigationSpinner not implemented, please update your app to the latest version");
74
+ this.appIntegration.setNavigationSpinner({
75
+ color: options.color,
76
+ delay: options.afterMilliseconds,
77
+ show: options.show,
78
+ });
79
+ }
71
80
  setSafeAreaBackgroundColor(color) {
72
81
  return new Promise((resolve, reject) => {
73
82
  this.resolveSetSafeAreaBackgroundColor = resolve;
@@ -81,16 +90,16 @@ class AppClass extends EventHandlerWithTypes_1.EventTargetWithType {
81
90
  this.appIntegration.enableScreenRotation();
82
91
  }
83
92
  addExternalDomains(...domains) {
84
- let domainObjects = domains.map(m => ({
93
+ let domainObjects = domains.map((m) => ({
85
94
  pattern: m.source,
86
- flags: m.flags
95
+ flags: m.flags,
87
96
  }));
88
97
  this.appIntegration.addExternalDomains(domainObjects);
89
98
  }
90
99
  removeExternalDomains(...domains) {
91
- let domainObjects = domains.map(m => ({
100
+ let domainObjects = domains.map((m) => ({
92
101
  pattern: m.source,
93
- flags: m.flags
102
+ flags: m.flags,
94
103
  }));
95
104
  this.appIntegration.removeExternalDomains(domainObjects);
96
105
  }
@@ -105,7 +114,7 @@ class AppClass extends EventHandlerWithTypes_1.EventTargetWithType {
105
114
  this.resolveExternalDomains = null;
106
115
  }
107
116
  appInForegroundEventRecievedEvent() {
108
- this.dispatchEvent(new CustomEvent('appInForeground'));
117
+ this.dispatchEvent(new CustomEvent("appInForeground"));
109
118
  }
110
119
  brandIdResult(result) {
111
120
  this.resolveBrandId(result);
@@ -124,12 +133,11 @@ class AppClass extends EventHandlerWithTypes_1.EventTargetWithType {
124
133
  this.resolveSetSafeAreaBackgroundColor = null;
125
134
  }
126
135
  navigatingPageEvent(result) {
127
- this.dispatchEvent(new CustomEvent('navigatingPage', { detail: result }));
136
+ this.dispatchEvent(new CustomEvent("navigatingPage", { detail: result }));
128
137
  }
129
138
  getInternalDomainsResult(result) {
130
139
  this.resolveGetInternalDomains(result);
131
140
  this.resolveGetInternalDomains = null;
132
141
  }
133
142
  }
134
- ;
135
143
  exports.App = new AppClass();
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ declare class StartiappClass extends EventTarget {
5
5
  setAppUrl(url: string): void;
6
6
  resetAppUrl(): void;
7
7
  webAppIsReady(): void;
8
+ setNavigationSpinner(options: NavigationSpinnerOptions): void;
8
9
  addExternalDomains(domains: ExternalDomain[]): void;
9
10
  removeExternalDomains(domains: ExternalDomain[]): void;
10
11
  getExternalDomains(): void;
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ const biometrics_1 = require("./biometrics");
5
5
  const clientUser_1 = require("./clientUser");
6
6
  const device_1 = require("./device");
7
7
  const getIntegration_1 = require("./getIntegration");
8
+ const SmartBanner_1 = require("./lib/SmartBanner");
8
9
  const ViewportMetatag_1 = require("./lib/ViewportMetatag");
9
10
  const nfc_1 = require("./nfc");
10
11
  const pushnotification_1 = require("./pushnotification");
@@ -52,8 +53,9 @@ class StartiappClass extends EventTarget {
52
53
  }
53
54
  /** Call this method to initialize the starti.app API integration. This method should be called AFTER all integrations are ready (see onIntegrationsAreReady). */
54
55
  initialize(options) {
55
- if (this.isRunningInApp())
56
- ui_service_1.AppUI.setOptions(options);
56
+ if (!this.isRunningInApp())
57
+ return;
58
+ ui_service_1.AppUI.setOptions(options);
57
59
  this.appIntegration.webAppIsReady();
58
60
  }
59
61
  /** Call this method to check if the app is running in the starti.app app. */
@@ -80,6 +82,8 @@ else {
80
82
  function documentBodyExists(observer) {
81
83
  if (!document.body)
82
84
  return;
85
+ const smartBanner = new SmartBanner_1.SmartBanner();
86
+ smartBanner.initialize();
83
87
  if (startiapp.isRunningInApp()) {
84
88
  document.body.setAttribute("startiapp", "");
85
89
  }
@@ -0,0 +1,13 @@
1
+ export declare class SmartBanner {
2
+ constructor();
3
+ private _storageBucket;
4
+ private marginTop;
5
+ private getSmartBannerDataUrl;
6
+ private getSmartBannerData;
7
+ private getSmartBannerClosed;
8
+ private setSmartBannerClosed;
9
+ initialize(): Promise<void>;
10
+ private createIosBannerContent;
11
+ private createAndroidBannerContent;
12
+ private createContent;
13
+ }
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SmartBanner = void 0;
13
+ const __1 = require("..");
14
+ const getMobileOS = () => {
15
+ const ua = navigator.userAgent;
16
+ if (/android/i.test(ua)) {
17
+ return "Android";
18
+ }
19
+ else if (/iPad|iPhone|iPod/.test(ua)) {
20
+ return "iOS";
21
+ }
22
+ return "Other";
23
+ };
24
+ class SmartBanner {
25
+ constructor() {
26
+ this._storageBucket = "startiapp-admin-1fac2.appspot.com";
27
+ this.marginTop = "72px";
28
+ }
29
+ getSmartBannerDataUrl() {
30
+ const host = window.location.host;
31
+ const parts = host.split(".");
32
+ const domain = parts.slice(parts.length - 2).join(".");
33
+ return `https://storage.googleapis.com/${this._storageBucket}/smartbanner/${encodeURIComponent(domain)}.json`;
34
+ }
35
+ getSmartBannerData() {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ try {
38
+ const result = yield fetch(this.getSmartBannerDataUrl());
39
+ const data = yield result.json();
40
+ return data;
41
+ }
42
+ catch (error) {
43
+ if (!(error instanceof SyntaxError))
44
+ console.error("SmartBanner error", error);
45
+ return {
46
+ enabled: false,
47
+ appName: "",
48
+ appIcon: "",
49
+ appleAppId: "",
50
+ googePlayAppId: "",
51
+ };
52
+ }
53
+ });
54
+ }
55
+ getSmartBannerClosed() {
56
+ const smartBannerClosedAt = localStorage.getItem("startiapp-smart-banner-closed-at");
57
+ if (smartBannerClosedAt &&
58
+ Date.now() - parseInt(smartBannerClosedAt) < 604800000 // 7 days
59
+ )
60
+ return true;
61
+ return false;
62
+ }
63
+ setSmartBannerClosed(extended = false) {
64
+ // Extended should extends the closed time to 1 month
65
+ localStorage.setItem("startiapp-smart-banner-closed-at", extended ? Date.now() + 2592000000 + "" : Date.now().toString());
66
+ }
67
+ initialize() {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ // Smart banner should never be shown in the app
70
+ if (__1.default.isRunningInApp())
71
+ return;
72
+ const platform = getMobileOS();
73
+ if (platform === "Other")
74
+ return;
75
+ const htmlElement = document.querySelector("html");
76
+ if (!htmlElement)
77
+ return;
78
+ const smartBannerClosed = this.getSmartBannerClosed();
79
+ if (smartBannerClosed)
80
+ return;
81
+ // Get the smart banner data
82
+ const smartBannerData = yield this.getSmartBannerData();
83
+ if (!smartBannerData.enabled)
84
+ return;
85
+ // Add margin for the smart banner
86
+ htmlElement.style.setProperty("margin-top", this.marginTop, "important");
87
+ // Add the smart banner
88
+ const smartBanner = document.createElement("div");
89
+ smartBanner.id = "startiapp-smart-banner-wrapper";
90
+ smartBanner.style.setProperty("position", "fixed", "important");
91
+ smartBanner.style.setProperty("top", "0", "important");
92
+ smartBanner.style.setProperty("left", "0", "important");
93
+ smartBanner.style.setProperty("right", "0", "important");
94
+ smartBanner.style.setProperty("height", this.marginTop, "important");
95
+ smartBanner.style.setProperty("width", "100%", "important");
96
+ smartBanner.style.setProperty("background-color", "#f2f1f6", "important");
97
+ smartBanner.style.setProperty("z-index", "999999999", "important");
98
+ smartBanner.style.setProperty("border-bottom", "1px solid #dadade", "important");
99
+ switch (platform) {
100
+ case "iOS":
101
+ yield this.createIosBannerContent(smartBannerData, smartBanner);
102
+ break;
103
+ case "Android":
104
+ yield this.createAndroidBannerContent(smartBannerData, smartBanner);
105
+ break;
106
+ default:
107
+ console.warn("Unknown platform", platform);
108
+ return;
109
+ }
110
+ document.body.appendChild(smartBanner);
111
+ });
112
+ }
113
+ createIosBannerContent(options, smartBanner) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ this.createContent(options.appName, options.appIcon, `https://apps.apple.com/us/app/id${options.appleAppId}`, "App Store", smartBanner, options.appDetails);
116
+ });
117
+ }
118
+ createAndroidBannerContent(options, smartBanner) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ this.createContent(options.appName, options.appIcon, `market://details?id=${options.googePlayAppId}`, "Play Store", smartBanner, options.appDetails);
121
+ });
122
+ }
123
+ createContent(appName, appIcon, storeLink, storeName, smartBanner, appDetails) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ if ((appDetails === null || appDetails === void 0 ? void 0 : appDetails.length) === 0)
126
+ appDetails = undefined;
127
+ const grid = document.createElement("div");
128
+ grid.style.setProperty("display", "grid", "important");
129
+ grid.id = "startiapp-smart-banner-grid";
130
+ grid.style.setProperty("grid-template-columns", "30px auto auto", "important");
131
+ grid.style.setProperty("height", "100%", "important");
132
+ grid.style.setProperty("width", "100%", "important");
133
+ grid.style.setProperty("font-family", "sans-serif", "important");
134
+ const closeButtonDiv = document.createElement("div");
135
+ closeButtonDiv.id = "startiapp-smart-banner-close-button";
136
+ closeButtonDiv.style.setProperty("grid-column", "1");
137
+ closeButtonDiv.style.setProperty("grid-row", "1");
138
+ closeButtonDiv.style.setProperty("height", "100%");
139
+ closeButtonDiv.style.setProperty("width", "100%");
140
+ closeButtonDiv.style.setProperty("display", "flex");
141
+ closeButtonDiv.style.setProperty("justify-content", "center");
142
+ closeButtonDiv.style.setProperty("align-items", "center");
143
+ closeButtonDiv.onclick = () => {
144
+ var _a, _b;
145
+ smartBanner.remove();
146
+ (_a = document
147
+ .querySelector("html")) === null || _a === void 0 ? void 0 : _a.style.setProperty("transition", "margin-top 0.3s ease-in-out");
148
+ (_b = document.querySelector("html")) === null || _b === void 0 ? void 0 : _b.style.removeProperty("margin-top");
149
+ this.setSmartBannerClosed();
150
+ };
151
+ const closeButtonSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
152
+ closeButtonSvg.setAttribute("id", "close-smart-banner");
153
+ closeButtonSvg.setAttribute("style", "height: 16px; width: 16px;");
154
+ closeButtonSvg.setAttribute("viewBox", "0 0 24 24");
155
+ closeButtonSvg.setAttribute("fill", "none");
156
+ closeButtonSvg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
157
+ closeButtonSvg.innerHTML = `
158
+ <path d="M18 6L6 18" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
159
+ <path d="M6 6L18 18" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
160
+ `;
161
+ closeButtonDiv.appendChild(closeButtonSvg);
162
+ const imageDiv = document.createElement("div");
163
+ imageDiv.id = "startiapp-smart-banner-image";
164
+ imageDiv.style.setProperty("grid-column", "2");
165
+ imageDiv.style.setProperty("grid-row", "1");
166
+ imageDiv.style.setProperty("height", "100%");
167
+ imageDiv.style.setProperty("width", "100%");
168
+ imageDiv.style.setProperty("display", "flex");
169
+ imageDiv.style.setProperty("justify-content", "start");
170
+ imageDiv.style.setProperty("align-items", "center");
171
+ const image = document.createElement("img");
172
+ image.id = "startiapp-smart-banner-app-icon";
173
+ image.src = appIcon;
174
+ image.style.setProperty("height", "54px");
175
+ image.style.setProperty("width", "54px");
176
+ image.style.setProperty("object-fit", "scale-down");
177
+ const appNameDiv = document.createElement("div");
178
+ appNameDiv.id = "startiapp-smart-banner-app-name-container";
179
+ appNameDiv.style.setProperty("display", "flex");
180
+ appNameDiv.style.setProperty("flex-direction", "column");
181
+ const appNameSpan = document.createElement("span");
182
+ appNameSpan.id = "startiapp-smart-banner-app-name";
183
+ appNameSpan.style.setProperty("margin-left", "8px");
184
+ appNameSpan.style.setProperty("font-size", "16px");
185
+ appNameSpan.style.setProperty("font-weight", "500");
186
+ appNameSpan.textContent = appName;
187
+ const appDetailsSpan = document.createElement("span");
188
+ appDetailsSpan.id = "startiapp-smart-banner-app-details";
189
+ appDetailsSpan.style.setProperty("margin-left", "8px");
190
+ appDetailsSpan.style.setProperty("font-size", "16px");
191
+ appDetailsSpan.style.setProperty("font-weight", "500");
192
+ appDetailsSpan.textContent = appDetails !== null && appDetails !== void 0 ? appDetails : `GET — on the ${storeName}`;
193
+ appNameDiv.appendChild(appNameSpan);
194
+ appNameDiv.appendChild(appDetailsSpan);
195
+ imageDiv.appendChild(image);
196
+ imageDiv.appendChild(appNameDiv);
197
+ const downloadButtonDiv = document.createElement("div");
198
+ downloadButtonDiv.style.setProperty("grid-column", "3");
199
+ downloadButtonDiv.style.setProperty("grid-row", "1");
200
+ downloadButtonDiv.style.setProperty("height", "100%");
201
+ downloadButtonDiv.style.setProperty("width", "100%");
202
+ downloadButtonDiv.style.setProperty("display", "flex");
203
+ downloadButtonDiv.style.setProperty("justify-content", "center");
204
+ downloadButtonDiv.style.setProperty("align-items", "center");
205
+ const downloadButtonLink = document.createElement("a");
206
+ downloadButtonLink.href = storeLink;
207
+ downloadButtonLink.target = "_blank";
208
+ downloadButtonLink.textContent = "View";
209
+ downloadButtonLink.style.setProperty("text-decoration", "none");
210
+ downloadButtonLink.style.setProperty("color", "#000");
211
+ downloadButtonLink.style.setProperty("font-size", "16px");
212
+ downloadButtonLink.style.setProperty("font-weight", "500");
213
+ downloadButtonDiv.appendChild(downloadButtonLink);
214
+ grid.appendChild(closeButtonDiv);
215
+ grid.appendChild(imageDiv);
216
+ grid.appendChild(downloadButtonDiv);
217
+ smartBanner.appendChild(grid);
218
+ });
219
+ }
220
+ }
221
+ exports.SmartBanner = SmartBanner;
@@ -11,16 +11,22 @@ class UI {
11
11
  allowHighligt: false,
12
12
  allowZoom: false,
13
13
  allowScrollBounce: false,
14
+ allowRotation: false,
15
+ spinner: {
16
+ show: false,
17
+ color: "#000",
18
+ delay: 250,
19
+ },
14
20
  statusBar: {
15
21
  removeSafeArea: true,
16
22
  hideText: false,
17
23
  safeAreaBackgroundColor: "#000000",
18
24
  darkContent: false,
19
- }
25
+ },
20
26
  };
21
27
  }
22
28
  setOptions(options) {
23
- this.options = Object.assign(this.options, options);
29
+ this.options = Object.assign(Object.assign({}, this.options), options);
24
30
  this.updateUI();
25
31
  }
26
32
  getOptions() {
@@ -88,6 +94,13 @@ class UI {
88
94
  styleElement.setAttribute("id", config_1.styleTagId);
89
95
  document.body.appendChild(styleElement);
90
96
  __1.default.App.setStatusBar(this.options.statusBar);
97
+ __1.default.App.setSpinner(this.options.spinner);
98
+ if (this.options.allowRotation) {
99
+ __1.default.App.enableScreenRotation();
100
+ }
101
+ else {
102
+ __1.default.App.disableScreenRotation();
103
+ }
91
104
  }
92
105
  }
93
106
  exports.AppUI = new UI();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starti.app",
3
- "version": "1.1.7-alpha.2",
3
+ "version": "1.2.0",
4
4
  "description": "Use this package for easy communication with the starti.app API.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/umd/main.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see main.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(()=>{return e={466:function(e){e.exports=function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function n(e){return"function"==typeof e}function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function s(e,t){return null!=e&&"object"==typeof e&&t in e}var i=RegExp.prototype.test;var o=/\S/;function a(e){return!function(e,t){return i.call(e,t)}(o,e)}var c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};var l=/\s*/,u=/\s+/,p=/\s*=/,d=/\s*\}/,h=/#|\^|\/|>|\{|&|=|!/;function g(e){this.string=e,this.tail=e,this.pos=0}function v(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function f(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}g.prototype.eos=function(){return""===this.tail},g.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},g.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},v.prototype.push=function(e){return new v(e,this)},v.prototype.lookup=function(e){var t,r,i,o=this.cache;if(o.hasOwnProperty(e))t=o[e];else{for(var a,c,l,u=this,p=!1;u;){if(e.indexOf(".")>0)for(a=u.view,c=e.split("."),l=0;null!=a&&l<c.length;)l===c.length-1&&(p=s(a,c[l])||(r=a,i=c[l],null!=r&&"object"!=typeof r&&r.hasOwnProperty&&r.hasOwnProperty(i))),a=a[c[l++]];else a=u.view[e],p=s(u.view,e);if(p){t=a;break}u=u.parent}o[e]=t}return n(t)&&(t=t.call(this.view)),t},f.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},f.prototype.parse=function(e,n){var s=this.templateCache,i=e+":"+(n||m.tags).join(":"),o=void 0!==s,c=o?s.get(i):void 0;return null==c&&(c=function(e,n){if(!e)return[];var s,i,o,c=!1,v=[],f=[],w=[],b=!1,S=!1,I="",y=0;function E(){if(b&&!S)for(;w.length;)delete f[w.pop()];else w=[];b=!1,S=!1}function T(e){if("string"==typeof e&&(e=e.split(u,2)),!t(e)||2!==e.length)throw new Error("Invalid tags: "+e);s=new RegExp(r(e[0])+"\\s*"),i=new RegExp("\\s*"+r(e[1])),o=new RegExp("\\s*"+r("}"+e[1]))}T(n||m.tags);for(var C,A,P,N,R,x,_=new g(e);!_.eos();){if(C=_.pos,P=_.scanUntil(s))for(var O=0,U=P.length;O<U;++O)a(N=P.charAt(O))?(w.push(f.length),I+=N):(S=!0,c=!0,I+=" "),f.push(["text",N,C,C+1]),C+=1,"\n"===N&&(E(),I="",y=0,c=!1);if(!_.scan(s))break;if(b=!0,A=_.scan(h)||"name",_.scan(l),"="===A?(P=_.scanUntil(p),_.scan(p),_.scanUntil(i)):"{"===A?(P=_.scanUntil(o),_.scan(d),_.scanUntil(i),A="&"):P=_.scanUntil(i),!_.scan(i))throw new Error("Unclosed tag at "+_.pos);if(R=">"==A?[A,P,C,_.pos,I,y,c]:[A,P,C,_.pos],y++,f.push(R),"#"===A||"^"===A)v.push(R);else if("/"===A){if(!(x=v.pop()))throw new Error('Unopened section "'+P+'" at '+C);if(x[1]!==P)throw new Error('Unclosed section "'+x[1]+'" at '+C)}else"name"===A||"{"===A||"&"===A?S=!0:"="===A&&T(P)}if(E(),x=v.pop())throw new Error('Unclosed section "'+x[1]+'" at '+_.pos);return function(e){for(var t,n=[],r=n,s=[],i=0,o=e.length;i<o;++i)switch((t=e[i])[0]){case"#":case"^":r.push(t),s.push(t),r=t[4]=[];break;case"/":s.pop()[5]=t[2],r=s.length>0?s[s.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],s=0,i=e.length;s<i;++s)(t=e[s])&&("text"===t[0]&&n&&"text"===n[0]?(n[1]+=t[1],n[3]=t[3]):(r.push(t),n=t));return r}(f))}(e,n),o&&s.set(i,c)),c},f.prototype.render=function(e,t,n,r){var s=this.getConfigTags(r),i=this.parse(e,s),o=t instanceof v?t:new v(t,void 0);return this.renderTokens(i,o,n,e,r)},f.prototype.renderTokens=function(e,t,n,r,s){for(var i,o,a,c="",l=0,u=e.length;l<u;++l)a=void 0,"#"===(o=(i=e[l])[0])?a=this.renderSection(i,t,n,r,s):"^"===o?a=this.renderInverted(i,t,n,r,s):">"===o?a=this.renderPartial(i,t,n,s):"&"===o?a=this.unescapedValue(i,t):"name"===o?a=this.escapedValue(i,t,s):"text"===o&&(a=this.rawValue(i)),void 0!==a&&(c+=a);return c},f.prototype.renderSection=function(e,r,s,i,o){var a=this,c="",l=r.lookup(e[1]);if(l){if(t(l))for(var u=0,p=l.length;u<p;++u)c+=this.renderTokens(e[4],r.push(l[u]),s,i,o);else if("object"==typeof l||"string"==typeof l||"number"==typeof l)c+=this.renderTokens(e[4],r.push(l),s,i,o);else if(n(l)){if("string"!=typeof i)throw new Error("Cannot use higher-order sections without the original template");null!=(l=l.call(r.view,i.slice(e[3],e[5]),(function(e){return a.render(e,r,s,o)})))&&(c+=l)}else c+=this.renderTokens(e[4],r,s,i,o);return c}},f.prototype.renderInverted=function(e,n,r,s,i){var o=n.lookup(e[1]);if(!o||t(o)&&0===o.length)return this.renderTokens(e[4],n,r,s,i)},f.prototype.indentPartial=function(e,t,n){for(var r=t.replace(/[^ \t]/g,""),s=e.split("\n"),i=0;i<s.length;i++)s[i].length&&(i>0||!n)&&(s[i]=r+s[i]);return s.join("\n")},f.prototype.renderPartial=function(e,t,r,s){if(r){var i=this.getConfigTags(s),o=n(r)?r(e[1]):r[e[1]];if(null!=o){var a=e[6],c=e[5],l=e[4],u=o;0==c&&l&&(u=this.indentPartial(o,l,a));var p=this.parse(u,i);return this.renderTokens(p,t,r,u,s)}}},f.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},f.prototype.escapedValue=function(e,t,n){var r=this.getConfigEscape(n)||m.escape,s=t.lookup(e[1]);if(null!=s)return"number"==typeof s&&r===m.escape?String(s):r(s)},f.prototype.rawValue=function(e){return e[1]},f.prototype.getConfigTags=function(e){return t(e)?e:e&&"object"==typeof e?e.tags:void 0},f.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!t(e)?e.escape:void 0};var m={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){w.templateCache=e},get templateCache(){return w.templateCache}},w=new f;return m.clearCache=function(){return w.clearCache()},m.parse=function(e,t){return w.parse(e,t)},m.render=function(e,n,r,s){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+((t(i=e)?"array":typeof i)+'" was given as the first argument for mustache#render(template, view, partials)'));var i;return w.render(e,n,r,s)},m.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return c[e]}))},m.Scanner=g,m.Context=v,m.Writer=f,m}()},715:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetWithType=void 0;class n extends EventTarget{addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}t.EventTargetWithType=n},752:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{constructor(){super(...arguments),this.startiappIsLoaded=!1}get appIntegration(){return(0,s.getIntegration)("AppIntegration")}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){this.appIntegration.setAppUrl(e)}resetAppUrl(){this.appIntegration.resetAppUrl()}openExternalBrowser(e){this.appIntegration.openBrowser(e)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,this.appIntegration.brandId()}))}requestReview(){this.appIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,this.appIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,this.appIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,this.appIntegration.getInternalDomains()}))}addInternalDomain(e){this.appIntegration.addInternalDomain(e)}removeInternalDomain(e){this.appIntegration.removeInternalDomain(e)}showStatusBar(){this.appIntegration.showStatusBar()}hideStatusBar(){this.appIntegration.hideStatusBar()}setStatusBar(e){this.appIntegration.setStatusBar(e)}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,this.appIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){this.appIntegration.disableScreenRotation()}enableScreenRotation(){this.appIntegration.enableScreenRotation()}addExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.addExternalDomains(t)}removeExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.removeExternalDomains(t)}getExternalDomains(){return new Promise(((e,t)=>{this.resolveExternalDomains=e,this.appIntegration.getExternalDomains()}))}getExternalDomainsResult(e){this.resolveExternalDomains(e),this.resolveExternalDomains=null}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e),this.resolveBrandId=null}versionResult(e){this.resolveVersion(e),this.resolveVersion=null}deviceIdResult(e){this.resolveDeviceId(e),this.resolveDeviceId=null}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e),this.resolveSetSafeAreaBackgroundColor=null}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e),this.resolveGetInternalDomains=null}}t.App=new i},1:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{constructor(){super(...arguments),this.SECURED_CONTENT_KEY="STARTI_APP_BIOMETRIC_CONTENT",this.SECURED_LOGIN_KEY="STARTI_APP_BIOMETRIC_LOGIN_CONTENT",this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}get biometricIntegration(){return(0,s.getIntegration)("BiometricIntegration")}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveScan=n,this.biometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,this.biometricIntegration.getAuthenticationType()}))}setSecuredContent(e){this.biometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveGetContent=n,this.biometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,this.biometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){this.biometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){this.biometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){this.biometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,this.biometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveGetUsernamePassword=n,this.biometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.result);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}this.resolveGetUsernamePassword=null}hasSecuredContentResult({result:e,key:t}){if(t===this.SECURED_LOGIN_KEY)return this.resolveHasUsernameAndPassword(e),void(this.resolveHasUsernameAndPassword=null);this.resolveHasSecureContent(e),this.resolveHasSecureContent=null}getAuthenticationTypeResult(e){this.resolveAuthType(e),this.resolveAuthType=null}startScanningResult(e){this.resolveScan(e),this.resolveScan=null}getSecuredContentResult(e){if(e.key!==this.SECURED_LOGIN_KEY){try{const t=JSON.parse(e.result);this.resolveGetContent(t)}catch(t){this.resolveGetContent(e.result)}this.resolveGetContent=null}else this.handleResolveGetUsernamePassword(e)}}t.Biometrics=new i},495:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const s=n(715),i=n(913),o=n(607);class a extends s.EventTargetWithType{registerId(e){return r(this,void 0,void 0,(function*(){const t=yield o.default.App.brandId(),n=yield o.default.App.deviceId(),r=yield o.default.PushNotification.getToken();if(!r||0===r.length)throw console.warn("Failed to register logged in client user",e,"No FCM token"),new Error(`Failed to register logged in client user ${e}: No FCM token`);const s={brandId:t,clientUserId:e,deviceId:n,fcmToken:r},a=yield fetch(i.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw console.warn("Failed to register logged in client user",e,s),new Error(`Failed to register logged in client user ${e}: Firebase returned statuscode ${a.status}`)}))}unregisterId(){return r(this,void 0,void 0,(function*(){const e={brandId:yield o.default.App.brandId(),deviceId:yield o.default.App.deviceId()},t=yield fetch(i.baseUrl+"/ClientUser-unregisterId",{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok)throw console.warn("Failed to unregister logged in client user",e),new Error(`Failed to unregister logged in client user: Firebase returned statuscode ${t.status}`)}))}}t.ClientUser=new a},913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.styleTagId=t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net",t.styleTagId="startiapp-styling"},955:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get deviceIntegration(){return(0,s.getIntegration)("DeviceIntegration")}startAccelerometer(){this.deviceIntegration.startAccelerometer()}stopAccelerometer(){this.deviceIntegration.stopAccelerometer()}isAccelerometerStarted(){return new Promise(((e,t)=>{this.deviceIntegration.isAccelerometerStarted(),this.resolveIsAccelerometerStarted=e}))}isAccelerometerStartedResult(e){this.resolveIsAccelerometerStarted(e),this.resolveIsAccelerometerStarted=null}onShakeEvent(){this.dispatchEvent(new CustomEvent("shake"))}}t.Device=new i},900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getIntegration=void 0;let n={};t.getIntegration=function(e){if(n[e])return n[e];let t=window[e],r=0;for(;!t&&r<5;)t=window.parent[e],r++;if(!t)throw new Error(`Could not find integration ${e}`);return n[e]=t,t}},607:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(752),s=n(1),i=n(495),o=n(955),a=n(900),c=n(240),l=n(983),u=n(681),p=n(952),d=n(716),h=n(634),g=window;g.appIntegrationsAreReady=()=>{r.App.setStartiappIsLoaded(),f.dispatchEvent(new CustomEvent("ready"))},g.startiappDevice=o.Device,g.startiappApp=r.App,g.startiappUser=i.ClientUser,g.startiappQrScanner=p.QrScanner,g.startiappPushNotification=u.PushNotification,g.startiappNFC=l.NFC,g.startiappShare=h.Share,g.startiappBiometric=s.Biometrics,g.appErrorEvent=e=>{f.dispatchEvent(new CustomEvent("error",{detail:e}))};class v extends EventTarget{constructor(){super(...arguments),this.App=r.App,this.Device=o.Device,this.Biometrics=s.Biometrics,this.User=i.ClientUser,this.NfcScanner=l.NFC,this.PushNotification=u.PushNotification,this.QrScanner=p.QrScanner,this.Share=h.Share}get appIntegration(){return(0,a.getIntegration)("AppIntegration")}initialize(e){this.isRunningInApp()&&d.AppUI.setOptions(e),this.appIntegration.webAppIsReady()}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}const f=new v;if(document.body)m();else{const e=new MutationObserver((()=>m(e)));e.observe(document.documentElement,{childList:!0})}function m(e){if(!document.body)return;if(f.isRunningInApp()?document.body.setAttribute("startiapp",""):document.body.removeAttribute("startiapp"),!document.head)return;const t=document.createElement("style");if(t.innerHTML="body:not([startiapp]) .startiapp-hide-in-browser,body:not([startiapp]) .startiapp-show-in-app,body[startiapp] .startiapp-hide-in-app,body[startiapp] .startiapp-show-in-browser{display:none!important}",document.head.appendChild(t),f.isRunningInApp()){const e={width:"device-width","viewport-fit":"cover"},t=document.querySelector("meta[name=viewport]");if(t){const n=(0,c.parseViewportMeta)(t.content);t.content=(0,c.serializeViewportMeta)(Object.assign(Object.assign({},n),e))}else{const t=document.createElement("meta");t.name="viewport",t.content=(0,c.serializeViewportMeta)(e),document.head.appendChild(t)}}e&&e.disconnect()}t.default=f,g.startiapp=f},240:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.serializeViewportMeta=t.parseViewportMeta=void 0,t.parseViewportMeta=function(e){const t={},n=e.split(",");for(const e of n){const[n,r]=e.trim().split("=");switch(n.trim()){case"width":case"height":case"initial-scale":case"minimum-scale":case"maximum-scale":case"user-scalable":case"viewport-fit":t[n.trim()]=r.trim()}}return t},t.serializeViewportMeta=function(e){const t=[];for(const[n,r]of Object.entries(e))r&&t.push(`${n}=${r}`);return t.join(", ")}},983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get NFCIntegration(){return(0,s.getIntegration)("NFCIntegration")}isNfcSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e,this.NFCIntegration.isNFCSupported()}))}startNfcScanner(){return new Promise((e=>{this.resolveStartNFCReader=e,this.NFCIntegration.startListening()}))}stopNfcScanner(){return new Promise((e=>{this.resolveStopNFCReader=e,this.NFCIntegration.stopListening()}))}nfcTagScannedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}stopListeningResult(e){this.resolveStopNFCReader(e),this.resolveStopNFCReader=null}isNFCSupportedResult(e){this.resolveNFCSupported(e),this.resolveNFCSupported=null}startListeningResult(e){this.resolveStartNFCReader(e),this.resolveStartNFCReader=null}}t.NFC=new i},681:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=t.Topic=void 0;const s=n(466),i=n(715),o=n(913),a=n(900),c=n(607);class l extends i.EventTargetWithType{get pushNotificationIntegration(){return(0,a.getIntegration)("PushNotificationIntegration")}requestAccess(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,this.pushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,this.pushNotificationIntegration.getFCMToken()}))}getTopics(){return r(this,void 0,void 0,(function*(){const e={brand:yield c.default.App.brandId()},t=yield fetch(o.baseUrl+"/Topics-getTopics?"+new URLSearchParams(Object.assign({},e)));if(!t.ok)throw new Error("Failed to get topics");const n=yield t.json(),r=this.getSubscribedTopics();return n.map((({name:e,topic:t})=>new u(t,e,r.includes(t))))}))}renderTopics(){return r(this,void 0,void 0,(function*(){const e=yield this.getTopics(),t=document.getElementById("startiapp-topics-template");if(!t||"SCRIPT"!==t.tagName)throw new Error("Template element not found");if("x-tmpl-mustache"!==t.type)throw new Error('Template element must have type="x-tmpl-mustache"');const n=document.getElementById("startiapp-topics-target");if(!n||"DIV"!==n.tagName)throw new Error("Template target element not found");const i=t.innerHTML,o=(0,s.render)(i,{topics:e});n.innerHTML=o,n.querySelectorAll('input[type="checkbox"]').forEach((e=>{e.dataset.startiappTopic&&e.addEventListener("change",(t=>r(this,void 0,void 0,(function*(){if(!(yield this.requestAccess()))return t.target.checked=!1,void t.preventDefault();e.checked?this.subscribeToTopics([e.dataset.startiappTopic]):this.unsubscribeFromTopics([e.dataset.startiappTopic])}))))}))}))}subscribeToTopics(e){return r(this,void 0,void 0,(function*(){if(!(yield c.default.PushNotification.requestAccess()))throw console.warn("Push notification permissions denied"),new Error("Push notification permissions denied");const[t,n,r]=yield Promise.all([c.default.PushNotification.getToken(),c.default.App.brandId(),c.default.App.deviceId()]),s=[];e.forEach((e=>{const i={brandId:n,topic:e,fcmToken:t,deviceId:r},a=fetch(o.baseUrl+"/Topics-subscribeToTopic",{body:JSON.stringify(i),method:"POST",headers:{"Content-Type":"application/json"}});s.push(a)})),(yield Promise.all(s)).forEach(((t,n)=>{t.ok?this.updateSubscribedTopics(e[n],!0):console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return r(this,void 0,void 0,(function*(){const[t,n,r]=yield Promise.all([c.default.PushNotification.getToken(),c.default.App.brandId(),c.default.App.deviceId()]),s=[];e.forEach((e=>{const i={brandId:n,topic:e,fcmToken:t,deviceId:r},a=fetch(o.baseUrl+"/Topics-unsubscribeFromTopic",{body:JSON.stringify(i),method:"POST",headers:{"Content-Type":"application/json"}});s.push(a)})),(yield Promise.all(s)).forEach(((t,n)=>{t.ok?this.updateSubscribedTopics(e[n],!1):console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e),this.resolveRequestAccess=null}getFCMTokenResult(e){this.resolveFCMToken(e),this.resolveFCMToken=null}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}updateSubscribedTopics(e,t){const n=localStorage.getItem("startiapp-subscribed-topics")?JSON.parse(localStorage.getItem("startiapp-subscribed-topics")):[];t?n.includes(e)||n.push(e):n.includes(e)&&n.splice(n.indexOf(e),1),localStorage.setItem("startiapp-subscribed-topics",JSON.stringify(n))}getSubscribedTopics(){return localStorage.getItem("startiapp-subscribed-topics")?JSON.parse(localStorage.getItem("startiapp-subscribed-topics")):[]}}class u{constructor(e,t,n=!1){this.topic=e,this.name=t,this.subscribed=n}toJSON(){return{topic:this.topic,name:this.name,subscribed:this.subscribed}}subscribe(){t.PushNotification.subscribeToTopics([this.topic])}unsubscribe(){t.PushNotification.unsubscribeFromTopics([this.topic])}}t.Topic=u,t.PushNotification=new l},952:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get qrScannerIntegration(){return(0,s.getIntegration)("QrScannerIntegration")}scan(){return new Promise(((e,t)=>{this.resolveScan=e,this.qrScannerIntegration.startQrCodeScanner()}))}isCameraAccessGranted(){return new Promise(((e,t)=>{this.resolveCameraAccessGranted=e,this.qrScannerIntegration.isCameraAccessGranted()}))}requestCameraAccess(){return new Promise(((e,t)=>{this.resolveRequestCameraAccess=e,this.qrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e),this.resolveRequestCameraAccess=null}startQrCodeScannerResult(e){this.resolveScan(e),this.resolveScan=null}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e),this.resolveCameraAccessGranted=null}}t.QrScanner=new i},716:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const r=n(607),s=n(913),i=n(240);t.AppUI=new class{constructor(){this.options={allowDrag:!1,allowHighligt:!1,allowZoom:!1,allowScrollBounce:!1,statusBar:{removeSafeArea:!0,hideText:!1,safeAreaBackgroundColor:"#000000",darkContent:!1}}}setOptions(e){this.options=Object.assign(this.options,e),this.updateUI()}getOptions(){return this.options}updateViewportMeta(e){const t=document.querySelector("meta[name=viewport]");if(t){const n=(0,i.parseViewportMeta)(t.content);t.content=(0,i.serializeViewportMeta)(Object.assign(Object.assign({},n),e))}else{const t=document.createElement("meta");t.setAttribute("name","viewport"),t.setAttribute("content",(0,i.serializeViewportMeta)(e)),document.head.appendChild(t)}}updateUI(){this.styleString="";const e=document.getElementById(s.styleTagId);e&&e.remove();const t=document.getElementsByTagName("img"),n=document.getElementsByTagName("a");this.options.allowDrag?[...t,...n].forEach((e=>{e.removeAttribute("draggable")})):[...t,...n].forEach((e=>{e.setAttribute("draggable","false")})),this.options.allowHighligt||(this.styleString+="\n body {\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -o-user-select: none;\n user-select: none;\n }\n "),this.options.allowScrollBounce||(this.styleString+="\n html {\n overscroll-behavior: none;\n }\n "),this.options.allowZoom||(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",this.updateViewportMeta({"user-scalable":"no"}));const i=document.createElement("style");i.textContent=this.styleString,i.setAttribute("id",s.styleTagId),document.body.appendChild(i),r.default.App.setStatusBar(this.options.statusBar)}}},634:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Share=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get shareIntegration(){return(0,s.getIntegration)("ShareIntegration")}shareFile(e,t){return new Promise(((n,r)=>{this.resolveShareFile=n,this.shareIntegration.shareFile(e,t)}))}shareText(e){return new Promise(((t,n)=>{this.resolveShareText=t,this.shareIntegration.shareText(e)}))}downloadFile(e,t){return new Promise(((n,r)=>{this.resolveDownloadText=n,this.shareIntegration.downloadFile(e,t)}))}shareFileResult(e){this.resolveShareFile(e),this.resolveShareFile=null}shareTextResult(e){this.resolveShareText(e),this.resolveShareText=null}downloadFileResult(e){this.resolveDownloadText(e),this.resolveDownloadText=null}}t.Share=new i}},t={},function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(607);var e,t}));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(()=>{return e={466:function(e){e.exports=function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function n(e){return"function"==typeof e}function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function s(e,t){return null!=e&&"object"==typeof e&&t in e}var i=RegExp.prototype.test;var o=/\S/;function a(e){return!function(e,t){return i.call(e,t)}(o,e)}var c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};var l=/\s*/,p=/\s+/,d=/\s*=/,u=/\s*\}/,h=/#|\^|\/|>|\{|&|=|!/;function g(e){this.string=e,this.tail=e,this.pos=0}function m(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function v(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}g.prototype.eos=function(){return""===this.tail},g.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},g.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},m.prototype.push=function(e){return new m(e,this)},m.prototype.lookup=function(e){var t,r,i,o=this.cache;if(o.hasOwnProperty(e))t=o[e];else{for(var a,c,l,p=this,d=!1;p;){if(e.indexOf(".")>0)for(a=p.view,c=e.split("."),l=0;null!=a&&l<c.length;)l===c.length-1&&(d=s(a,c[l])||(r=a,i=c[l],null!=r&&"object"!=typeof r&&r.hasOwnProperty&&r.hasOwnProperty(i))),a=a[c[l++]];else a=p.view[e],d=s(p.view,e);if(d){t=a;break}p=p.parent}o[e]=t}return n(t)&&(t=t.call(this.view)),t},v.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},v.prototype.parse=function(e,n){var s=this.templateCache,i=e+":"+(n||f.tags).join(":"),o=void 0!==s,c=o?s.get(i):void 0;return null==c&&(c=function(e,n){if(!e)return[];var s,i,o,c=!1,m=[],v=[],y=[],w=!1,b=!1,S="",I=0;function C(){if(w&&!b)for(;y.length;)delete v[y.pop()];else y=[];w=!1,b=!1}function P(e){if("string"==typeof e&&(e=e.split(p,2)),!t(e)||2!==e.length)throw new Error("Invalid tags: "+e);s=new RegExp(r(e[0])+"\\s*"),i=new RegExp("\\s*"+r(e[1])),o=new RegExp("\\s*"+r("}"+e[1]))}P(n||f.tags);for(var E,T,A,x,N,R,_=new g(e);!_.eos();){if(E=_.pos,A=_.scanUntil(s))for(var k=0,O=A.length;k<O;++k)a(x=A.charAt(k))?(y.push(v.length),S+=x):(b=!0,c=!0,S+=" "),v.push(["text",x,E,E+1]),E+=1,"\n"===x&&(C(),S="",I=0,c=!1);if(!_.scan(s))break;if(w=!0,T=_.scan(h)||"name",_.scan(l),"="===T?(A=_.scanUntil(d),_.scan(d),_.scanUntil(i)):"{"===T?(A=_.scanUntil(o),_.scan(u),_.scanUntil(i),T="&"):A=_.scanUntil(i),!_.scan(i))throw new Error("Unclosed tag at "+_.pos);if(N=">"==T?[T,A,E,_.pos,S,I,c]:[T,A,E,_.pos],I++,v.push(N),"#"===T||"^"===T)m.push(N);else if("/"===T){if(!(R=m.pop()))throw new Error('Unopened section "'+A+'" at '+E);if(R[1]!==A)throw new Error('Unclosed section "'+R[1]+'" at '+E)}else"name"===T||"{"===T||"&"===T?b=!0:"="===T&&P(A)}if(C(),R=m.pop())throw new Error('Unclosed section "'+R[1]+'" at '+_.pos);return function(e){for(var t,n=[],r=n,s=[],i=0,o=e.length;i<o;++i)switch((t=e[i])[0]){case"#":case"^":r.push(t),s.push(t),r=t[4]=[];break;case"/":s.pop()[5]=t[2],r=s.length>0?s[s.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],s=0,i=e.length;s<i;++s)(t=e[s])&&("text"===t[0]&&n&&"text"===n[0]?(n[1]+=t[1],n[3]=t[3]):(r.push(t),n=t));return r}(v))}(e,n),o&&s.set(i,c)),c},v.prototype.render=function(e,t,n,r){var s=this.getConfigTags(r),i=this.parse(e,s),o=t instanceof m?t:new m(t,void 0);return this.renderTokens(i,o,n,e,r)},v.prototype.renderTokens=function(e,t,n,r,s){for(var i,o,a,c="",l=0,p=e.length;l<p;++l)a=void 0,"#"===(o=(i=e[l])[0])?a=this.renderSection(i,t,n,r,s):"^"===o?a=this.renderInverted(i,t,n,r,s):">"===o?a=this.renderPartial(i,t,n,s):"&"===o?a=this.unescapedValue(i,t):"name"===o?a=this.escapedValue(i,t,s):"text"===o&&(a=this.rawValue(i)),void 0!==a&&(c+=a);return c},v.prototype.renderSection=function(e,r,s,i,o){var a=this,c="",l=r.lookup(e[1]);if(l){if(t(l))for(var p=0,d=l.length;p<d;++p)c+=this.renderTokens(e[4],r.push(l[p]),s,i,o);else if("object"==typeof l||"string"==typeof l||"number"==typeof l)c+=this.renderTokens(e[4],r.push(l),s,i,o);else if(n(l)){if("string"!=typeof i)throw new Error("Cannot use higher-order sections without the original template");null!=(l=l.call(r.view,i.slice(e[3],e[5]),(function(e){return a.render(e,r,s,o)})))&&(c+=l)}else c+=this.renderTokens(e[4],r,s,i,o);return c}},v.prototype.renderInverted=function(e,n,r,s,i){var o=n.lookup(e[1]);if(!o||t(o)&&0===o.length)return this.renderTokens(e[4],n,r,s,i)},v.prototype.indentPartial=function(e,t,n){for(var r=t.replace(/[^ \t]/g,""),s=e.split("\n"),i=0;i<s.length;i++)s[i].length&&(i>0||!n)&&(s[i]=r+s[i]);return s.join("\n")},v.prototype.renderPartial=function(e,t,r,s){if(r){var i=this.getConfigTags(s),o=n(r)?r(e[1]):r[e[1]];if(null!=o){var a=e[6],c=e[5],l=e[4],p=o;0==c&&l&&(p=this.indentPartial(o,l,a));var d=this.parse(p,i);return this.renderTokens(d,t,r,p,s)}}},v.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},v.prototype.escapedValue=function(e,t,n){var r=this.getConfigEscape(n)||f.escape,s=t.lookup(e[1]);if(null!=s)return"number"==typeof s&&r===f.escape?String(s):r(s)},v.prototype.rawValue=function(e){return e[1]},v.prototype.getConfigTags=function(e){return t(e)?e:e&&"object"==typeof e?e.tags:void 0},v.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!t(e)?e.escape:void 0};var f={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){y.templateCache=e},get templateCache(){return y.templateCache}},y=new v;return f.clearCache=function(){return y.clearCache()},f.parse=function(e,t){return y.parse(e,t)},f.render=function(e,n,r,s){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+((t(i=e)?"array":typeof i)+'" was given as the first argument for mustache#render(template, view, partials)'));var i;return y.render(e,n,r,s)},f.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return c[e]}))},f.Scanner=g,f.Context=m,f.Writer=v,f}()},715:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetWithType=void 0;class n extends EventTarget{addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}t.EventTargetWithType=n},752:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{constructor(){super(...arguments),this.startiappIsLoaded=!1}get appIntegration(){return(0,s.getIntegration)("AppIntegration")}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){this.appIntegration.setAppUrl(e)}resetAppUrl(){this.appIntegration.resetAppUrl()}openExternalBrowser(e){this.appIntegration.openBrowser(e)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,this.appIntegration.brandId()}))}requestReview(){this.appIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,this.appIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,this.appIntegration.version()}))}getInternalDomains(){return new Promise(((e,t)=>{this.resolveGetInternalDomains=e,this.appIntegration.getInternalDomains()}))}addInternalDomain(e){this.appIntegration.addInternalDomain(e)}removeInternalDomain(e){this.appIntegration.removeInternalDomain(e)}showStatusBar(){this.appIntegration.showStatusBar()}hideStatusBar(){this.appIntegration.hideStatusBar()}setStatusBar(e){this.appIntegration.setStatusBar(e)}setSpinner(e){if(!this.appIntegration.setNavigationSpinner)return console.warn("setNavigationSpinner not implemented, please update your app to the latest version");this.appIntegration.setNavigationSpinner({color:e.color,delay:e.afterMilliseconds,show:e.show})}setSafeAreaBackgroundColor(e){return new Promise(((t,n)=>{this.resolveSetSafeAreaBackgroundColor=t,this.appIntegration.setSafeAreaBackgroundColor(e)}))}disableScreenRotation(){this.appIntegration.disableScreenRotation()}enableScreenRotation(){this.appIntegration.enableScreenRotation()}addExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.addExternalDomains(t)}removeExternalDomains(...e){let t=e.map((e=>({pattern:e.source,flags:e.flags})));this.appIntegration.removeExternalDomains(t)}getExternalDomains(){return new Promise(((e,t)=>{this.resolveExternalDomains=e,this.appIntegration.getExternalDomains()}))}getExternalDomainsResult(e){this.resolveExternalDomains(e),this.resolveExternalDomains=null}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}brandIdResult(e){this.resolveBrandId(e),this.resolveBrandId=null}versionResult(e){this.resolveVersion(e),this.resolveVersion=null}deviceIdResult(e){this.resolveDeviceId(e),this.resolveDeviceId=null}setSafeAreaBackgroundColorResult(e){this.resolveSetSafeAreaBackgroundColor(e),this.resolveSetSafeAreaBackgroundColor=null}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}getInternalDomainsResult(e){this.resolveGetInternalDomains(e),this.resolveGetInternalDomains=null}}t.App=new i},1:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{constructor(){super(...arguments),this.SECURED_CONTENT_KEY="STARTI_APP_BIOMETRIC_CONTENT",this.SECURED_LOGIN_KEY="STARTI_APP_BIOMETRIC_LOGIN_CONTENT",this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}get biometricIntegration(){return(0,s.getIntegration)("BiometricIntegration")}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveScan=n,this.biometricIntegration.startScanning(e,t)}))}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e,this.biometricIntegration.getAuthenticationType()}))}setSecuredContent(e){this.biometricIntegration.setSecuredContent(this.SECURED_CONTENT_KEY,JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveGetContent=n,this.biometricIntegration.getSecuredContent(this.SECURED_CONTENT_KEY,e,t)}))}hasSecuredContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e,this.biometricIntegration.hasSecuredContent(this.SECURED_CONTENT_KEY)}))}removeSecuredContent(){this.biometricIntegration.removeSecuredContent(this.SECURED_CONTENT_KEY)}setUsernameAndPassword(e,t){this.biometricIntegration.setSecuredContent(this.SECURED_LOGIN_KEY,JSON.stringify({username:e,password:t}))}removeUsernameAndPassword(){this.biometricIntegration.removeSecuredContent(this.SECURED_LOGIN_KEY)}hasUsernameAndPassword(){return new Promise(((e,t)=>{this.resolveHasUsernameAndPassword=e,this.biometricIntegration.hasSecuredContent(this.SECURED_LOGIN_KEY)}))}getUsernameAndPassword(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,r)=>{this.resolveGetUsernamePassword=n,this.biometricIntegration.getSecuredContent(this.SECURED_LOGIN_KEY,e,t)}))}handleResolveGetUsernamePassword(e){try{const t=JSON.parse(e.result);this.resolveGetUsernamePassword(t)}catch(e){this.resolveGetUsernamePassword(null)}this.resolveGetUsernamePassword=null}hasSecuredContentResult({result:e,key:t}){if(t===this.SECURED_LOGIN_KEY)return this.resolveHasUsernameAndPassword(e),void(this.resolveHasUsernameAndPassword=null);this.resolveHasSecureContent(e),this.resolveHasSecureContent=null}getAuthenticationTypeResult(e){this.resolveAuthType(e),this.resolveAuthType=null}startScanningResult(e){this.resolveScan(e),this.resolveScan=null}getSecuredContentResult(e){if(e.key!==this.SECURED_LOGIN_KEY){try{const t=JSON.parse(e.result);this.resolveGetContent(t)}catch(t){this.resolveGetContent(e.result)}this.resolveGetContent=null}else this.handleResolveGetUsernamePassword(e)}}t.Biometrics=new i},495:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const s=n(715),i=n(913),o=n(607);class a extends s.EventTargetWithType{registerId(e){return r(this,void 0,void 0,(function*(){const t=yield o.default.App.brandId(),n=yield o.default.App.deviceId(),r=yield o.default.PushNotification.getToken();if(!r||0===r.length)throw console.warn("Failed to register logged in client user",e,"No FCM token"),new Error(`Failed to register logged in client user ${e}: No FCM token`);const s={brandId:t,clientUserId:e,deviceId:n,fcmToken:r},a=yield fetch(i.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw console.warn("Failed to register logged in client user",e,s),new Error(`Failed to register logged in client user ${e}: Firebase returned statuscode ${a.status}`)}))}unregisterId(){return r(this,void 0,void 0,(function*(){const e={brandId:yield o.default.App.brandId(),deviceId:yield o.default.App.deviceId()},t=yield fetch(i.baseUrl+"/ClientUser-unregisterId",{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok)throw console.warn("Failed to unregister logged in client user",e),new Error(`Failed to unregister logged in client user: Firebase returned statuscode ${t.status}`)}))}}t.ClientUser=new a},913:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.styleTagId=t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net",t.styleTagId="startiapp-styling"},955:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Device=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get deviceIntegration(){return(0,s.getIntegration)("DeviceIntegration")}startAccelerometer(){this.deviceIntegration.startAccelerometer()}stopAccelerometer(){this.deviceIntegration.stopAccelerometer()}isAccelerometerStarted(){return new Promise(((e,t)=>{this.deviceIntegration.isAccelerometerStarted(),this.resolveIsAccelerometerStarted=e}))}isAccelerometerStartedResult(e){this.resolveIsAccelerometerStarted(e),this.resolveIsAccelerometerStarted=null}onShakeEvent(){this.dispatchEvent(new CustomEvent("shake"))}}t.Device=new i},900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getIntegration=void 0;let n={};t.getIntegration=function(e){if(n[e])return n[e];let t=window[e],r=0;for(;!t&&r<5;)t=window.parent[e],r++;if(!t)throw new Error(`Could not find integration ${e}`);return n[e]=t,t}},607:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(752),s=n(1),i=n(495),o=n(955),a=n(900),c=n(666),l=n(240),p=n(983),d=n(681),u=n(952),h=n(716),g=n(634),m=window;m.appIntegrationsAreReady=()=>{r.App.setStartiappIsLoaded(),f.dispatchEvent(new CustomEvent("ready"))},m.startiappDevice=o.Device,m.startiappApp=r.App,m.startiappUser=i.ClientUser,m.startiappQrScanner=u.QrScanner,m.startiappPushNotification=d.PushNotification,m.startiappNFC=p.NFC,m.startiappShare=g.Share,m.startiappBiometric=s.Biometrics,m.appErrorEvent=e=>{f.dispatchEvent(new CustomEvent("error",{detail:e}))};class v extends EventTarget{constructor(){super(...arguments),this.App=r.App,this.Device=o.Device,this.Biometrics=s.Biometrics,this.User=i.ClientUser,this.NfcScanner=p.NFC,this.PushNotification=d.PushNotification,this.QrScanner=u.QrScanner,this.Share=g.Share}get appIntegration(){return(0,a.getIntegration)("AppIntegration")}initialize(e){this.isRunningInApp()&&(h.AppUI.setOptions(e),this.appIntegration.webAppIsReady())}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}}const f=new v;if(document.body)y();else{const e=new MutationObserver((()=>y(e)));e.observe(document.documentElement,{childList:!0})}function y(e){if(!document.body)return;if((new c.SmartBanner).initialize(),f.isRunningInApp()?document.body.setAttribute("startiapp",""):document.body.removeAttribute("startiapp"),!document.head)return;const t=document.createElement("style");if(t.innerHTML="body:not([startiapp]) .startiapp-hide-in-browser,body:not([startiapp]) .startiapp-show-in-app,body[startiapp] .startiapp-hide-in-app,body[startiapp] .startiapp-show-in-browser{display:none!important}",document.head.appendChild(t),f.isRunningInApp()){const e={width:"device-width","viewport-fit":"cover"},t=document.querySelector("meta[name=viewport]");if(t){const n=(0,l.parseViewportMeta)(t.content);t.content=(0,l.serializeViewportMeta)(Object.assign(Object.assign({},n),e))}else{const t=document.createElement("meta");t.name="viewport",t.content=(0,l.serializeViewportMeta)(e),document.head.appendChild(t)}}e&&e.disconnect()}t.default=f,m.startiapp=f},666:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SmartBanner=void 0;const s=n(607);t.SmartBanner=class{constructor(){this._storageBucket="startiapp-admin-1fac2.appspot.com",this.marginTop="72px"}getSmartBannerDataUrl(){const e=window.location.host.split("."),t=e.slice(e.length-2).join(".");return`https://storage.googleapis.com/${this._storageBucket}/smartbanner/${encodeURIComponent(t)}.json`}getSmartBannerData(){return r(this,void 0,void 0,(function*(){try{const e=yield fetch(this.getSmartBannerDataUrl());return yield e.json()}catch(e){return e instanceof SyntaxError||console.error("SmartBanner error",e),{enabled:!1,appName:"",appIcon:"",appleAppId:"",googePlayAppId:""}}}))}getSmartBannerClosed(){const e=localStorage.getItem("startiapp-smart-banner-closed-at");return!!(e&&Date.now()-parseInt(e)<6048e5)}setSmartBannerClosed(e=!1){localStorage.setItem("startiapp-smart-banner-closed-at",e?Date.now()+2592e6+"":Date.now().toString())}initialize(){return r(this,void 0,void 0,(function*(){if(s.default.isRunningInApp())return;const e=(()=>{const e=navigator.userAgent;return/android/i.test(e)?"Android":/iPad|iPhone|iPod/.test(e)?"iOS":"Other"})();if("Other"===e)return;const t=document.querySelector("html");if(!t)return;if(this.getSmartBannerClosed())return;const n=yield this.getSmartBannerData();if(!n.enabled)return;t.style.setProperty("margin-top",this.marginTop,"important");const r=document.createElement("div");switch(r.id="startiapp-smart-banner-wrapper",r.style.setProperty("position","fixed","important"),r.style.setProperty("top","0","important"),r.style.setProperty("left","0","important"),r.style.setProperty("right","0","important"),r.style.setProperty("height",this.marginTop,"important"),r.style.setProperty("width","100%","important"),r.style.setProperty("background-color","#f2f1f6","important"),r.style.setProperty("z-index","999999999","important"),r.style.setProperty("border-bottom","1px solid #dadade","important"),e){case"iOS":yield this.createIosBannerContent(n,r);break;case"Android":yield this.createAndroidBannerContent(n,r);break;default:return void console.warn("Unknown platform",e)}document.body.appendChild(r)}))}createIosBannerContent(e,t){return r(this,void 0,void 0,(function*(){this.createContent(e.appName,e.appIcon,`https://apps.apple.com/us/app/id${e.appleAppId}`,"App Store",t,e.appDetails)}))}createAndroidBannerContent(e,t){return r(this,void 0,void 0,(function*(){this.createContent(e.appName,e.appIcon,`market://details?id=${e.googePlayAppId}`,"Play Store",t,e.appDetails)}))}createContent(e,t,n,s,i,o){return r(this,void 0,void 0,(function*(){0===(null==o?void 0:o.length)&&(o=void 0);const r=document.createElement("div");r.style.setProperty("display","grid","important"),r.id="startiapp-smart-banner-grid",r.style.setProperty("grid-template-columns","30px auto auto","important"),r.style.setProperty("height","100%","important"),r.style.setProperty("width","100%","important"),r.style.setProperty("font-family","sans-serif","important");const a=document.createElement("div");a.id="startiapp-smart-banner-close-button",a.style.setProperty("grid-column","1"),a.style.setProperty("grid-row","1"),a.style.setProperty("height","100%"),a.style.setProperty("width","100%"),a.style.setProperty("display","flex"),a.style.setProperty("justify-content","center"),a.style.setProperty("align-items","center"),a.onclick=()=>{var e,t;i.remove(),null===(e=document.querySelector("html"))||void 0===e||e.style.setProperty("transition","margin-top 0.3s ease-in-out"),null===(t=document.querySelector("html"))||void 0===t||t.style.removeProperty("margin-top"),this.setSmartBannerClosed()};const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("id","close-smart-banner"),c.setAttribute("style","height: 16px; width: 16px;"),c.setAttribute("viewBox","0 0 24 24"),c.setAttribute("fill","none"),c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.innerHTML='\n\t\t\t<path d="M18 6L6 18" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t<path d="M6 6L18 18" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t',a.appendChild(c);const l=document.createElement("div");l.id="startiapp-smart-banner-image",l.style.setProperty("grid-column","2"),l.style.setProperty("grid-row","1"),l.style.setProperty("height","100%"),l.style.setProperty("width","100%"),l.style.setProperty("display","flex"),l.style.setProperty("justify-content","start"),l.style.setProperty("align-items","center");const p=document.createElement("img");p.id="startiapp-smart-banner-app-icon",p.src=t,p.style.setProperty("height","54px"),p.style.setProperty("width","54px"),p.style.setProperty("object-fit","scale-down");const d=document.createElement("div");d.id="startiapp-smart-banner-app-name-container",d.style.setProperty("display","flex"),d.style.setProperty("flex-direction","column");const u=document.createElement("span");u.id="startiapp-smart-banner-app-name",u.style.setProperty("margin-left","8px"),u.style.setProperty("font-size","16px"),u.style.setProperty("font-weight","500"),u.textContent=e;const h=document.createElement("span");h.id="startiapp-smart-banner-app-details",h.style.setProperty("margin-left","8px"),h.style.setProperty("font-size","16px"),h.style.setProperty("font-weight","500"),h.textContent=null!=o?o:`GET — on the ${s}`,d.appendChild(u),d.appendChild(h),l.appendChild(p),l.appendChild(d);const g=document.createElement("div");g.style.setProperty("grid-column","3"),g.style.setProperty("grid-row","1"),g.style.setProperty("height","100%"),g.style.setProperty("width","100%"),g.style.setProperty("display","flex"),g.style.setProperty("justify-content","center"),g.style.setProperty("align-items","center");const m=document.createElement("a");m.href=n,m.target="_blank",m.textContent="View",m.style.setProperty("text-decoration","none"),m.style.setProperty("color","#000"),m.style.setProperty("font-size","16px"),m.style.setProperty("font-weight","500"),g.appendChild(m),r.appendChild(a),r.appendChild(l),r.appendChild(g),i.appendChild(r)}))}}},240:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.serializeViewportMeta=t.parseViewportMeta=void 0,t.parseViewportMeta=function(e){const t={},n=e.split(",");for(const e of n){const[n,r]=e.trim().split("=");switch(n.trim()){case"width":case"height":case"initial-scale":case"minimum-scale":case"maximum-scale":case"user-scalable":case"viewport-fit":t[n.trim()]=r.trim()}}return t},t.serializeViewportMeta=function(e){const t=[];for(const[n,r]of Object.entries(e))r&&t.push(`${n}=${r}`);return t.join(", ")}},983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get NFCIntegration(){return(0,s.getIntegration)("NFCIntegration")}isNfcSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e,this.NFCIntegration.isNFCSupported()}))}startNfcScanner(){return new Promise((e=>{this.resolveStartNFCReader=e,this.NFCIntegration.startListening()}))}stopNfcScanner(){return new Promise((e=>{this.resolveStopNFCReader=e,this.NFCIntegration.stopListening()}))}nfcTagScannedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}stopListeningResult(e){this.resolveStopNFCReader(e),this.resolveStopNFCReader=null}isNFCSupportedResult(e){this.resolveNFCSupported(e),this.resolveNFCSupported=null}startListeningResult(e){this.resolveStartNFCReader(e),this.resolveStartNFCReader=null}}t.NFC=new i},681:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=t.Topic=void 0;const s=n(466),i=n(715),o=n(913),a=n(900),c=n(607);class l extends i.EventTargetWithType{get pushNotificationIntegration(){return(0,a.getIntegration)("PushNotificationIntegration")}requestAccess(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,this.pushNotificationIntegration.requestAccess()}))}))}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,this.pushNotificationIntegration.getFCMToken()}))}getTopics(){return r(this,void 0,void 0,(function*(){const e={brand:yield c.default.App.brandId()},t=yield fetch(o.baseUrl+"/Topics-getTopics?"+new URLSearchParams(Object.assign({},e)));if(!t.ok)throw new Error("Failed to get topics");const n=yield t.json(),r=this.getSubscribedTopics();return n.map((({name:e,topic:t})=>new p(t,e,r.includes(t))))}))}renderTopics(){return r(this,void 0,void 0,(function*(){const e=yield this.getTopics(),t=document.getElementById("startiapp-topics-template");if(!t||"SCRIPT"!==t.tagName)throw new Error("Template element not found");if("x-tmpl-mustache"!==t.type)throw new Error('Template element must have type="x-tmpl-mustache"');const n=document.getElementById("startiapp-topics-target");if(!n||"DIV"!==n.tagName)throw new Error("Template target element not found");const i=t.innerHTML,o=(0,s.render)(i,{topics:e});n.innerHTML=o,n.querySelectorAll('input[type="checkbox"]').forEach((e=>{e.dataset.startiappTopic&&e.addEventListener("change",(t=>r(this,void 0,void 0,(function*(){if(!(yield this.requestAccess()))return t.target.checked=!1,void t.preventDefault();e.checked?this.subscribeToTopics([e.dataset.startiappTopic]):this.unsubscribeFromTopics([e.dataset.startiappTopic])}))))}))}))}subscribeToTopics(e){return r(this,void 0,void 0,(function*(){if(!(yield c.default.PushNotification.requestAccess()))throw console.warn("Push notification permissions denied"),new Error("Push notification permissions denied");const[t,n,r]=yield Promise.all([c.default.PushNotification.getToken(),c.default.App.brandId(),c.default.App.deviceId()]),s=[];e.forEach((e=>{const i={brandId:n,topic:e,fcmToken:t,deviceId:r},a=fetch(o.baseUrl+"/Topics-subscribeToTopic",{body:JSON.stringify(i),method:"POST",headers:{"Content-Type":"application/json"}});s.push(a)})),(yield Promise.all(s)).forEach(((t,n)=>{t.ok?this.updateSubscribedTopics(e[n],!0):console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return r(this,void 0,void 0,(function*(){const[t,n,r]=yield Promise.all([c.default.PushNotification.getToken(),c.default.App.brandId(),c.default.App.deviceId()]),s=[];e.forEach((e=>{const i={brandId:n,topic:e,fcmToken:t,deviceId:r},a=fetch(o.baseUrl+"/Topics-unsubscribeFromTopic",{body:JSON.stringify(i),method:"POST",headers:{"Content-Type":"application/json"}});s.push(a)})),(yield Promise.all(s)).forEach(((t,n)=>{t.ok?this.updateSubscribedTopics(e[n],!1):console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}requestAccessResult(e){this.resolveRequestAccess(e),this.resolveRequestAccess=null}getFCMTokenResult(e){this.resolveFCMToken(e),this.resolveFCMToken=null}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}updateSubscribedTopics(e,t){const n=localStorage.getItem("startiapp-subscribed-topics")?JSON.parse(localStorage.getItem("startiapp-subscribed-topics")):[];t?n.includes(e)||n.push(e):n.includes(e)&&n.splice(n.indexOf(e),1),localStorage.setItem("startiapp-subscribed-topics",JSON.stringify(n))}getSubscribedTopics(){return localStorage.getItem("startiapp-subscribed-topics")?JSON.parse(localStorage.getItem("startiapp-subscribed-topics")):[]}}class p{constructor(e,t,n=!1){this.topic=e,this.name=t,this.subscribed=n}toJSON(){return{topic:this.topic,name:this.name,subscribed:this.subscribed}}subscribe(){t.PushNotification.subscribeToTopics([this.topic])}unsubscribe(){t.PushNotification.unsubscribeFromTopics([this.topic])}}t.Topic=p,t.PushNotification=new l},952:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get qrScannerIntegration(){return(0,s.getIntegration)("QrScannerIntegration")}scan(){return new Promise(((e,t)=>{this.resolveScan=e,this.qrScannerIntegration.startQrCodeScanner()}))}isCameraAccessGranted(){return new Promise(((e,t)=>{this.resolveCameraAccessGranted=e,this.qrScannerIntegration.isCameraAccessGranted()}))}requestCameraAccess(){return new Promise(((e,t)=>{this.resolveRequestCameraAccess=e,this.qrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e),this.resolveRequestCameraAccess=null}startQrCodeScannerResult(e){this.resolveScan(e),this.resolveScan=null}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e),this.resolveCameraAccessGranted=null}}t.QrScanner=new i},716:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppUI=void 0;const r=n(607),s=n(913),i=n(240);t.AppUI=new class{constructor(){this.options={allowDrag:!1,allowHighligt:!1,allowZoom:!1,allowScrollBounce:!1,allowRotation:!1,spinner:{show:!1,color:"#000",delay:250},statusBar:{removeSafeArea:!0,hideText:!1,safeAreaBackgroundColor:"#000000",darkContent:!1}}}setOptions(e){this.options=Object.assign(Object.assign({},this.options),e),this.updateUI()}getOptions(){return this.options}updateViewportMeta(e){const t=document.querySelector("meta[name=viewport]");if(t){const n=(0,i.parseViewportMeta)(t.content);t.content=(0,i.serializeViewportMeta)(Object.assign(Object.assign({},n),e))}else{const t=document.createElement("meta");t.setAttribute("name","viewport"),t.setAttribute("content",(0,i.serializeViewportMeta)(e)),document.head.appendChild(t)}}updateUI(){this.styleString="";const e=document.getElementById(s.styleTagId);e&&e.remove();const t=document.getElementsByTagName("img"),n=document.getElementsByTagName("a");this.options.allowDrag?[...t,...n].forEach((e=>{e.removeAttribute("draggable")})):[...t,...n].forEach((e=>{e.setAttribute("draggable","false")})),this.options.allowHighligt||(this.styleString+="\n body {\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -o-user-select: none;\n user-select: none;\n }\n "),this.options.allowScrollBounce||(this.styleString+="\n html {\n overscroll-behavior: none;\n }\n "),this.options.allowZoom||(this.styleString+="\n body {\n touch-action: pan-x pan-y;\n }\n ",this.updateViewportMeta({"user-scalable":"no"}));const i=document.createElement("style");i.textContent=this.styleString,i.setAttribute("id",s.styleTagId),document.body.appendChild(i),r.default.App.setStatusBar(this.options.statusBar),r.default.App.setSpinner(this.options.spinner),this.options.allowRotation?r.default.App.enableScreenRotation():r.default.App.disableScreenRotation()}}},634:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Share=void 0;const r=n(715),s=n(900);class i extends r.EventTargetWithType{get shareIntegration(){return(0,s.getIntegration)("ShareIntegration")}shareFile(e,t){return new Promise(((n,r)=>{this.resolveShareFile=n,this.shareIntegration.shareFile(e,t)}))}shareText(e){return new Promise(((t,n)=>{this.resolveShareText=t,this.shareIntegration.shareText(e)}))}downloadFile(e,t){return new Promise(((n,r)=>{this.resolveDownloadText=n,this.shareIntegration.downloadFile(e,t)}))}shareFileResult(e){this.resolveShareFile(e),this.resolveShareFile=null}shareTextResult(e){this.resolveShareText(e),this.resolveShareText=null}downloadFileResult(e){this.resolveDownloadText(e),this.resolveDownloadText=null}}t.Share=new i}},t={},function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(607);var e,t}));