@wral/studio.mods.auth 0.3.7 → 1.0.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/README.md +39 -47
- package/bitbucket-pipelines.yml +25 -1
- package/dist/auth.cjs.js +326 -1467
- package/dist/auth.es.js +1081 -3093
- package/dist/lib.cjs.js +1 -1
- package/dist/lib.es.js +13 -7
- package/eslint.config.mjs +41 -34
- package/index.html +83 -18
- package/jest.config.mjs +24 -0
- package/jest.setup.mjs +5 -0
- package/package.json +15 -28
- package/src/auth.mjs +204 -69
- package/src/auth.test.mjs +97 -0
- package/src/components/auth-app.mjs +26 -0
- package/src/components/forgot-password-form.mjs +217 -0
- package/src/components/login-form.mjs +288 -0
- package/src/config.mjs +27 -0
- package/src/helper.mjs +31 -0
- package/src/helper.test.mjs +44 -0
- package/src/index.mjs +17 -0
- package/src/login-layout.mjs +32 -0
- package/src/login.mjs +20 -0
- package/src/routes/change-password.mjs +158 -0
- package/src/routes/dashboard.mjs +17 -0
- package/src/routes/index.mjs +15 -0
- package/src/state.mjs +61 -0
- package/src/state.test.mjs +58 -0
- package/src/styles.mjs +9 -0
- package/src/token.mjs +40 -0
- package/src/utils.mjs +3 -0
- package/vellum-fixture.mjs +86 -0
- package/vite.config.mjs +12 -0
- package/components.html +0 -43
- package/development.md +0 -41
- package/src/components/mod-auth-login-form.mjs +0 -133
- package/src/components/studio-change-password.mjs +0 -84
- package/src/components/studio-login.mjs +0 -94
- package/src/components/studio-profile-view.mjs +0 -56
- package/src/components/studio-reset-password.mjs +0 -110
- package/src/lib.mjs +0 -16
- package/src/tool-dummy.mjs +0 -84
- package/src/util.mjs +0 -194
- package/src/util.test.mjs +0 -171
- package/vite.config.js +0 -12
- package/web-test-runner.config.mjs +0 -28
package/dist/auth.es.js
CHANGED
|
@@ -1,345 +1,261 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function mt(o) {
|
|
5
|
-
return {
|
|
6
|
-
// Underlying mechanism to use the REST URLs directly.
|
|
7
|
-
api: (t, e) => O(o, t, e),
|
|
8
|
-
mintToken: ({ username: t, password: e }) => ge({ config: o, username: t, password: e }),
|
|
9
|
-
refreshToken: ({ token: t }) => ve({ config: o, token: t }),
|
|
10
|
-
pubkey: () => ye({ config: o }),
|
|
11
|
-
updatePassword: ({ token: t, currentPassword: e, newPassword: r }) => we({ config: o, token: t, currentPassword: e, newPassword: r }),
|
|
12
|
-
triggerResetPassword: ({ username: t }) => _e({ config: o, username: t }),
|
|
13
|
-
confirmResetPassword: ({ username: t, newPassword: e, confirmationCode: r }) => $e({ config: o, username: t, newPassword: e, confirmationCode: r })
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function ge({ config: o, username: t, password: e }) {
|
|
17
|
-
return O(o, "/v1/user/login", {
|
|
18
|
-
method: "POST",
|
|
19
|
-
body: {
|
|
20
|
-
username: t,
|
|
21
|
-
password: e
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function ve({ config: o, token: t }) {
|
|
26
|
-
return O(o, "/v1/refresh", {
|
|
27
|
-
method: "POST",
|
|
28
|
-
body: {
|
|
29
|
-
token: t
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function ye({ config: o }) {
|
|
34
|
-
return O(o, "/v1/pubkey", {
|
|
35
|
-
method: "GET"
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function we({ config: o, token: t, currentPassword: e, newPassword: r }) {
|
|
39
|
-
return O(o, "/v1/user/password", {
|
|
40
|
-
method: "PUT",
|
|
41
|
-
body: {
|
|
42
|
-
currentPassword: e,
|
|
43
|
-
newPassword: r
|
|
44
|
-
},
|
|
45
|
-
headers: {
|
|
46
|
-
Authorization: `Bearer ${t}`
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function _e({ config: o, username: t }) {
|
|
51
|
-
return O(o, "/v1/user/password/reset", {
|
|
52
|
-
method: "POST",
|
|
53
|
-
body: {
|
|
54
|
-
username: t
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function $e({ config: o, username: t, newPassword: e, confirmationCode: r }) {
|
|
59
|
-
return O(o, "/v1/user/password/reset/confirm", {
|
|
60
|
-
method: "POST",
|
|
61
|
-
body: {
|
|
62
|
-
username: t,
|
|
63
|
-
newPassword: e,
|
|
64
|
-
confirmationCode: r
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
async function O(o, t, e) {
|
|
69
|
-
var c;
|
|
70
|
-
const r = o.baseUrl.endsWith("/") ? o.baseUrl : `${o.baseUrl}/`, s = t.startsWith("/") ? t.substring(1) : t, i = new URL(s, r), d = Object.assign({}, e, {
|
|
71
|
-
headers: Object.assign({}, {
|
|
72
|
-
"Content-Type": "application/json"
|
|
73
|
-
}, e == null ? void 0 : e.headers),
|
|
74
|
-
body: e != null && e.body ? JSON.stringify(e.body) : void 0
|
|
75
|
-
}), l = await fetch(i.toString(), d);
|
|
76
|
-
if (!l.ok) {
|
|
77
|
-
const b = new Error("API request failed.");
|
|
78
|
-
if (b.status = l.status, b.statusText = l.statusText, b.url = i.toString(), b.headers = l.headers, b.bodyUsed = l.bodyUsed, (c = l.headers.get("Content-Type")) != null && c.includes("application/json"))
|
|
79
|
-
try {
|
|
80
|
-
b.body = await l.json();
|
|
81
|
-
} catch {
|
|
82
|
-
b.body = "Failed to parse response body.";
|
|
83
|
-
}
|
|
84
|
-
throw b;
|
|
85
|
-
}
|
|
86
|
-
if (l.status !== 204)
|
|
87
|
-
return await l.json();
|
|
1
|
+
import { getToken as Y } from "./lib.es.js";
|
|
2
|
+
function k(r, ...e) {
|
|
3
|
+
return (...t) => r(...e, ...t);
|
|
88
4
|
}
|
|
89
5
|
/**
|
|
90
6
|
* @license
|
|
91
7
|
* Copyright 2019 Google LLC
|
|
92
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
93
9
|
*/
|
|
94
|
-
const
|
|
95
|
-
let
|
|
96
|
-
constructor(
|
|
97
|
-
if (this._$cssResult$ = !0,
|
|
98
|
-
this.cssText =
|
|
10
|
+
const F = globalThis, V = F.ShadowRoot && (F.ShadyCSS === void 0 || F.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Q = Symbol(), Z = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
let ce = class {
|
|
12
|
+
constructor(e, t, s) {
|
|
13
|
+
if (this._$cssResult$ = !0, s !== Q) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
14
|
+
this.cssText = e, this.t = t;
|
|
99
15
|
}
|
|
100
16
|
get styleSheet() {
|
|
101
|
-
let
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
const
|
|
105
|
-
|
|
17
|
+
let e = this.o;
|
|
18
|
+
const t = this.t;
|
|
19
|
+
if (V && e === void 0) {
|
|
20
|
+
const s = t !== void 0 && t.length === 1;
|
|
21
|
+
s && (e = Z.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), s && Z.set(t, e));
|
|
106
22
|
}
|
|
107
|
-
return
|
|
23
|
+
return e;
|
|
108
24
|
}
|
|
109
25
|
toString() {
|
|
110
26
|
return this.cssText;
|
|
111
27
|
}
|
|
112
28
|
};
|
|
113
|
-
const
|
|
114
|
-
const
|
|
29
|
+
const be = (r) => new ce(typeof r == "string" ? r : r + "", void 0, Q), q = (r, ...e) => {
|
|
30
|
+
const t = r.length === 1 ? r[0] : e.reduce((s, o, i) => s + ((n) => {
|
|
115
31
|
if (n._$cssResult$ === !0) return n.cssText;
|
|
116
32
|
if (typeof n == "number") return n;
|
|
117
33
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
118
|
-
})(
|
|
119
|
-
return new
|
|
120
|
-
},
|
|
121
|
-
if (
|
|
122
|
-
else for (const
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
let
|
|
128
|
-
for (const
|
|
129
|
-
return
|
|
130
|
-
})(
|
|
34
|
+
})(o) + r[i + 1], r[0]);
|
|
35
|
+
return new ce(t, r, Q);
|
|
36
|
+
}, ve = (r, e) => {
|
|
37
|
+
if (V) r.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
38
|
+
else for (const t of e) {
|
|
39
|
+
const s = document.createElement("style"), o = F.litNonce;
|
|
40
|
+
o !== void 0 && s.setAttribute("nonce", o), s.textContent = t.cssText, r.appendChild(s);
|
|
41
|
+
}
|
|
42
|
+
}, X = V ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((e) => {
|
|
43
|
+
let t = "";
|
|
44
|
+
for (const s of e.cssRules) t += s.cssText;
|
|
45
|
+
return be(t);
|
|
46
|
+
})(r) : r;
|
|
131
47
|
/**
|
|
132
48
|
* @license
|
|
133
49
|
* Copyright 2017 Google LLC
|
|
134
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
135
51
|
*/
|
|
136
|
-
const { is:
|
|
137
|
-
switch (
|
|
52
|
+
const { is: _e, defineProperty: Ae, getOwnPropertyDescriptor: Ee, getOwnPropertyNames: Pe, getOwnPropertySymbols: Se, getPrototypeOf: Ce } = Object, w = globalThis, ee = w.trustedTypes, xe = ee ? ee.emptyScript : "", z = w.reactiveElementPolyfillSupport, U = (r, e) => r, G = { toAttribute(r, e) {
|
|
53
|
+
switch (e) {
|
|
138
54
|
case Boolean:
|
|
139
|
-
|
|
55
|
+
r = r ? xe : null;
|
|
140
56
|
break;
|
|
141
57
|
case Object:
|
|
142
58
|
case Array:
|
|
143
|
-
|
|
59
|
+
r = r == null ? r : JSON.stringify(r);
|
|
144
60
|
}
|
|
145
|
-
return
|
|
146
|
-
}, fromAttribute(
|
|
147
|
-
let
|
|
148
|
-
switch (
|
|
61
|
+
return r;
|
|
62
|
+
}, fromAttribute(r, e) {
|
|
63
|
+
let t = r;
|
|
64
|
+
switch (e) {
|
|
149
65
|
case Boolean:
|
|
150
|
-
|
|
66
|
+
t = r !== null;
|
|
151
67
|
break;
|
|
152
68
|
case Number:
|
|
153
|
-
|
|
69
|
+
t = r === null ? null : Number(r);
|
|
154
70
|
break;
|
|
155
71
|
case Object:
|
|
156
72
|
case Array:
|
|
157
73
|
try {
|
|
158
|
-
|
|
74
|
+
t = JSON.parse(r);
|
|
159
75
|
} catch {
|
|
160
|
-
|
|
76
|
+
t = null;
|
|
161
77
|
}
|
|
162
78
|
}
|
|
163
|
-
return
|
|
164
|
-
} },
|
|
165
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
166
|
-
class
|
|
167
|
-
static addInitializer(
|
|
168
|
-
this._$Ei(), (this.l ?? (this.l = [])).push(
|
|
79
|
+
return t;
|
|
80
|
+
} }, de = (r, e) => !_e(r, e), te = { attribute: !0, type: String, converter: G, reflect: !1, hasChanged: de };
|
|
81
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), w.litPropertyMetadata ?? (w.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
82
|
+
class P extends HTMLElement {
|
|
83
|
+
static addInitializer(e) {
|
|
84
|
+
this._$Ei(), (this.l ?? (this.l = [])).push(e);
|
|
169
85
|
}
|
|
170
86
|
static get observedAttributes() {
|
|
171
87
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
172
88
|
}
|
|
173
|
-
static createProperty(
|
|
174
|
-
if (
|
|
175
|
-
const
|
|
176
|
-
|
|
89
|
+
static createProperty(e, t = te) {
|
|
90
|
+
if (t.state && (t.attribute = !1), this._$Ei(), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
91
|
+
const s = Symbol(), o = this.getPropertyDescriptor(e, s, t);
|
|
92
|
+
o !== void 0 && Ae(this.prototype, e, o);
|
|
177
93
|
}
|
|
178
94
|
}
|
|
179
|
-
static getPropertyDescriptor(
|
|
180
|
-
const { get:
|
|
181
|
-
return this[
|
|
95
|
+
static getPropertyDescriptor(e, t, s) {
|
|
96
|
+
const { get: o, set: i } = Ee(this.prototype, e) ?? { get() {
|
|
97
|
+
return this[t];
|
|
182
98
|
}, set(n) {
|
|
183
|
-
this[
|
|
99
|
+
this[t] = n;
|
|
184
100
|
} };
|
|
185
101
|
return { get() {
|
|
186
|
-
return
|
|
102
|
+
return o == null ? void 0 : o.call(this);
|
|
187
103
|
}, set(n) {
|
|
188
|
-
const
|
|
189
|
-
i.call(this, n), this.requestUpdate(
|
|
104
|
+
const l = o == null ? void 0 : o.call(this);
|
|
105
|
+
i.call(this, n), this.requestUpdate(e, l, s);
|
|
190
106
|
}, configurable: !0, enumerable: !0 };
|
|
191
107
|
}
|
|
192
|
-
static getPropertyOptions(
|
|
193
|
-
return this.elementProperties.get(
|
|
108
|
+
static getPropertyOptions(e) {
|
|
109
|
+
return this.elementProperties.get(e) ?? te;
|
|
194
110
|
}
|
|
195
111
|
static _$Ei() {
|
|
196
|
-
if (this.hasOwnProperty(
|
|
197
|
-
const
|
|
198
|
-
|
|
112
|
+
if (this.hasOwnProperty(U("elementProperties"))) return;
|
|
113
|
+
const e = Ce(this);
|
|
114
|
+
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
199
115
|
}
|
|
200
116
|
static finalize() {
|
|
201
|
-
if (this.hasOwnProperty(
|
|
202
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
203
|
-
const
|
|
204
|
-
for (const
|
|
117
|
+
if (this.hasOwnProperty(U("finalized"))) return;
|
|
118
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(U("properties"))) {
|
|
119
|
+
const t = this.properties, s = [...Pe(t), ...Se(t)];
|
|
120
|
+
for (const o of s) this.createProperty(o, t[o]);
|
|
205
121
|
}
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
122
|
+
const e = this[Symbol.metadata];
|
|
123
|
+
if (e !== null) {
|
|
124
|
+
const t = litPropertyMetadata.get(e);
|
|
125
|
+
if (t !== void 0) for (const [s, o] of t) this.elementProperties.set(s, o);
|
|
210
126
|
}
|
|
211
127
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
212
|
-
for (const [
|
|
213
|
-
const
|
|
214
|
-
|
|
128
|
+
for (const [t, s] of this.elementProperties) {
|
|
129
|
+
const o = this._$Eu(t, s);
|
|
130
|
+
o !== void 0 && this._$Eh.set(o, t);
|
|
215
131
|
}
|
|
216
132
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
217
133
|
}
|
|
218
|
-
static finalizeStyles(
|
|
219
|
-
const
|
|
220
|
-
if (Array.isArray(
|
|
221
|
-
const
|
|
222
|
-
for (const
|
|
223
|
-
} else
|
|
224
|
-
return
|
|
134
|
+
static finalizeStyles(e) {
|
|
135
|
+
const t = [];
|
|
136
|
+
if (Array.isArray(e)) {
|
|
137
|
+
const s = new Set(e.flat(1 / 0).reverse());
|
|
138
|
+
for (const o of s) t.unshift(X(o));
|
|
139
|
+
} else e !== void 0 && t.push(X(e));
|
|
140
|
+
return t;
|
|
225
141
|
}
|
|
226
|
-
static _$Eu(
|
|
227
|
-
const
|
|
228
|
-
return
|
|
142
|
+
static _$Eu(e, t) {
|
|
143
|
+
const s = t.attribute;
|
|
144
|
+
return s === !1 ? void 0 : typeof s == "string" ? s : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
229
145
|
}
|
|
230
146
|
constructor() {
|
|
231
147
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
232
148
|
}
|
|
233
149
|
_$Ev() {
|
|
234
|
-
var t;
|
|
235
|
-
this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
|
|
236
|
-
}
|
|
237
|
-
addController(t) {
|
|
238
150
|
var e;
|
|
239
|
-
|
|
151
|
+
this._$ES = new Promise((t) => this.enableUpdating = t), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (e = this.constructor.l) == null || e.forEach((t) => t(this));
|
|
240
152
|
}
|
|
241
|
-
|
|
242
|
-
var
|
|
243
|
-
(
|
|
153
|
+
addController(e) {
|
|
154
|
+
var t;
|
|
155
|
+
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(e), this.renderRoot !== void 0 && this.isConnected && ((t = e.hostConnected) == null || t.call(e));
|
|
156
|
+
}
|
|
157
|
+
removeController(e) {
|
|
158
|
+
var t;
|
|
159
|
+
(t = this._$EO) == null || t.delete(e);
|
|
244
160
|
}
|
|
245
161
|
_$E_() {
|
|
246
|
-
const
|
|
247
|
-
for (const
|
|
248
|
-
|
|
162
|
+
const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
163
|
+
for (const s of t.keys()) this.hasOwnProperty(s) && (e.set(s, this[s]), delete this[s]);
|
|
164
|
+
e.size > 0 && (this._$Ep = e);
|
|
249
165
|
}
|
|
250
166
|
createRenderRoot() {
|
|
251
|
-
const
|
|
252
|
-
return
|
|
167
|
+
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
168
|
+
return ve(e, this.constructor.elementStyles), e;
|
|
253
169
|
}
|
|
254
170
|
connectedCallback() {
|
|
255
|
-
var
|
|
256
|
-
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (
|
|
257
|
-
var
|
|
258
|
-
return (
|
|
171
|
+
var e;
|
|
172
|
+
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((t) => {
|
|
173
|
+
var s;
|
|
174
|
+
return (s = t.hostConnected) == null ? void 0 : s.call(t);
|
|
259
175
|
});
|
|
260
176
|
}
|
|
261
|
-
enableUpdating(
|
|
177
|
+
enableUpdating(e) {
|
|
262
178
|
}
|
|
263
179
|
disconnectedCallback() {
|
|
264
|
-
var
|
|
265
|
-
(
|
|
266
|
-
var
|
|
267
|
-
return (
|
|
180
|
+
var e;
|
|
181
|
+
(e = this._$EO) == null || e.forEach((t) => {
|
|
182
|
+
var s;
|
|
183
|
+
return (s = t.hostDisconnected) == null ? void 0 : s.call(t);
|
|
268
184
|
});
|
|
269
185
|
}
|
|
270
|
-
attributeChangedCallback(
|
|
271
|
-
this._$AK(
|
|
186
|
+
attributeChangedCallback(e, t, s) {
|
|
187
|
+
this._$AK(e, s);
|
|
272
188
|
}
|
|
273
|
-
_$EC(
|
|
189
|
+
_$EC(e, t) {
|
|
274
190
|
var i;
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
const n = (((i =
|
|
278
|
-
this._$Em =
|
|
191
|
+
const s = this.constructor.elementProperties.get(e), o = this.constructor._$Eu(e, s);
|
|
192
|
+
if (o !== void 0 && s.reflect === !0) {
|
|
193
|
+
const n = (((i = s.converter) == null ? void 0 : i.toAttribute) !== void 0 ? s.converter : G).toAttribute(t, s.type);
|
|
194
|
+
this._$Em = e, n == null ? this.removeAttribute(o) : this.setAttribute(o, n), this._$Em = null;
|
|
279
195
|
}
|
|
280
196
|
}
|
|
281
|
-
_$AK(
|
|
197
|
+
_$AK(e, t) {
|
|
282
198
|
var i;
|
|
283
|
-
const
|
|
284
|
-
if (
|
|
285
|
-
const n =
|
|
286
|
-
this._$Em =
|
|
199
|
+
const s = this.constructor, o = s._$Eh.get(e);
|
|
200
|
+
if (o !== void 0 && this._$Em !== o) {
|
|
201
|
+
const n = s.getPropertyOptions(o), l = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((i = n.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? n.converter : G;
|
|
202
|
+
this._$Em = o, this[o] = l.fromAttribute(t, n.type), this._$Em = null;
|
|
287
203
|
}
|
|
288
204
|
}
|
|
289
|
-
requestUpdate(
|
|
290
|
-
if (
|
|
291
|
-
if (
|
|
292
|
-
this.P(
|
|
205
|
+
requestUpdate(e, t, s) {
|
|
206
|
+
if (e !== void 0) {
|
|
207
|
+
if (s ?? (s = this.constructor.getPropertyOptions(e)), !(s.hasChanged ?? de)(this[e], t)) return;
|
|
208
|
+
this.P(e, t, s);
|
|
293
209
|
}
|
|
294
210
|
this.isUpdatePending === !1 && (this._$ES = this._$ET());
|
|
295
211
|
}
|
|
296
|
-
P(
|
|
297
|
-
this._$AL.has(
|
|
212
|
+
P(e, t, s) {
|
|
213
|
+
this._$AL.has(e) || this._$AL.set(e, t), s.reflect === !0 && this._$Em !== e && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(e);
|
|
298
214
|
}
|
|
299
215
|
async _$ET() {
|
|
300
216
|
this.isUpdatePending = !0;
|
|
301
217
|
try {
|
|
302
218
|
await this._$ES;
|
|
303
|
-
} catch (
|
|
304
|
-
Promise.reject(
|
|
219
|
+
} catch (t) {
|
|
220
|
+
Promise.reject(t);
|
|
305
221
|
}
|
|
306
|
-
const
|
|
307
|
-
return
|
|
222
|
+
const e = this.scheduleUpdate();
|
|
223
|
+
return e != null && await e, !this.isUpdatePending;
|
|
308
224
|
}
|
|
309
225
|
scheduleUpdate() {
|
|
310
226
|
return this.performUpdate();
|
|
311
227
|
}
|
|
312
228
|
performUpdate() {
|
|
313
|
-
var
|
|
229
|
+
var s;
|
|
314
230
|
if (!this.isUpdatePending) return;
|
|
315
231
|
if (!this.hasUpdated) {
|
|
316
232
|
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
|
317
233
|
for (const [i, n] of this._$Ep) this[i] = n;
|
|
318
234
|
this._$Ep = void 0;
|
|
319
235
|
}
|
|
320
|
-
const
|
|
321
|
-
if (
|
|
236
|
+
const o = this.constructor.elementProperties;
|
|
237
|
+
if (o.size > 0) for (const [i, n] of o) n.wrapped !== !0 || this._$AL.has(i) || this[i] === void 0 || this.P(i, this[i], n);
|
|
322
238
|
}
|
|
323
|
-
let
|
|
324
|
-
const
|
|
239
|
+
let e = !1;
|
|
240
|
+
const t = this._$AL;
|
|
325
241
|
try {
|
|
326
|
-
|
|
242
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), (s = this._$EO) == null || s.forEach((o) => {
|
|
327
243
|
var i;
|
|
328
|
-
return (i =
|
|
329
|
-
}), this.update(
|
|
330
|
-
} catch (
|
|
331
|
-
throw
|
|
244
|
+
return (i = o.hostUpdate) == null ? void 0 : i.call(o);
|
|
245
|
+
}), this.update(t)) : this._$EU();
|
|
246
|
+
} catch (o) {
|
|
247
|
+
throw e = !1, this._$EU(), o;
|
|
332
248
|
}
|
|
333
|
-
|
|
249
|
+
e && this._$AE(t);
|
|
334
250
|
}
|
|
335
|
-
willUpdate(
|
|
251
|
+
willUpdate(e) {
|
|
336
252
|
}
|
|
337
|
-
_$AE(
|
|
338
|
-
var
|
|
339
|
-
(
|
|
340
|
-
var
|
|
341
|
-
return (
|
|
342
|
-
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(
|
|
253
|
+
_$AE(e) {
|
|
254
|
+
var t;
|
|
255
|
+
(t = this._$EO) == null || t.forEach((s) => {
|
|
256
|
+
var o;
|
|
257
|
+
return (o = s.hostUpdated) == null ? void 0 : o.call(s);
|
|
258
|
+
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
343
259
|
}
|
|
344
260
|
_$EU() {
|
|
345
261
|
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
@@ -350,89 +266,89 @@ class I extends HTMLElement {
|
|
|
350
266
|
getUpdateComplete() {
|
|
351
267
|
return this._$ES;
|
|
352
268
|
}
|
|
353
|
-
shouldUpdate(
|
|
269
|
+
shouldUpdate(e) {
|
|
354
270
|
return !0;
|
|
355
271
|
}
|
|
356
|
-
update(
|
|
357
|
-
this._$Ej && (this._$Ej = this._$Ej.forEach((
|
|
272
|
+
update(e) {
|
|
273
|
+
this._$Ej && (this._$Ej = this._$Ej.forEach((t) => this._$EC(t, this[t]))), this._$EU();
|
|
358
274
|
}
|
|
359
|
-
updated(
|
|
275
|
+
updated(e) {
|
|
360
276
|
}
|
|
361
|
-
firstUpdated(
|
|
277
|
+
firstUpdated(e) {
|
|
362
278
|
}
|
|
363
279
|
}
|
|
364
|
-
|
|
280
|
+
P.elementStyles = [], P.shadowRootOptions = { mode: "open" }, P[U("elementProperties")] = /* @__PURE__ */ new Map(), P[U("finalized")] = /* @__PURE__ */ new Map(), z == null || z({ ReactiveElement: P }), (w.reactiveElementVersions ?? (w.reactiveElementVersions = [])).push("2.0.4");
|
|
365
281
|
/**
|
|
366
282
|
* @license
|
|
367
283
|
* Copyright 2017 Google LLC
|
|
368
284
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
369
285
|
*/
|
|
370
|
-
const
|
|
371
|
-
\f\r]`,
|
|
372
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
373
|
-
function
|
|
374
|
-
if (!
|
|
375
|
-
return
|
|
286
|
+
const R = globalThis, M = R.trustedTypes, re = M ? M.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, he = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, ue = "?" + $, ke = `<${ue}>`, A = document, O = () => A.createComment(""), N = (r) => r === null || typeof r != "object" && typeof r != "function", J = Array.isArray, Te = (r) => J(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", j = `[
|
|
287
|
+
\f\r]`, T = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, se = /-->/g, oe = />/g, v = RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
|
|
288
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ie = /'/g, ne = /"/g, pe = /^(?:script|style|textarea|title)$/i, Ue = (r) => (e, ...t) => ({ _$litType$: r, strings: e, values: t }), c = Ue(1), S = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), ae = /* @__PURE__ */ new WeakMap(), _ = A.createTreeWalker(A, 129);
|
|
289
|
+
function me(r, e) {
|
|
290
|
+
if (!J(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
291
|
+
return re !== void 0 ? re.createHTML(e) : e;
|
|
376
292
|
}
|
|
377
|
-
const
|
|
378
|
-
const
|
|
379
|
-
let
|
|
380
|
-
for (let
|
|
381
|
-
const
|
|
382
|
-
let
|
|
383
|
-
for (;
|
|
384
|
-
const
|
|
385
|
-
i += n ===
|
|
386
|
-
}
|
|
387
|
-
return [
|
|
293
|
+
const Re = (r, e) => {
|
|
294
|
+
const t = r.length - 1, s = [];
|
|
295
|
+
let o, i = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = T;
|
|
296
|
+
for (let l = 0; l < t; l++) {
|
|
297
|
+
const a = r[l];
|
|
298
|
+
let u, d, h = -1, m = 0;
|
|
299
|
+
for (; m < a.length && (n.lastIndex = m, d = n.exec(a), d !== null); ) m = n.lastIndex, n === T ? d[1] === "!--" ? n = se : d[1] !== void 0 ? n = oe : d[2] !== void 0 ? (pe.test(d[2]) && (o = RegExp("</" + d[2], "g")), n = v) : d[3] !== void 0 && (n = v) : n === v ? d[0] === ">" ? (n = o ?? T, h = -1) : d[1] === void 0 ? h = -2 : (h = n.lastIndex - d[2].length, u = d[1], n = d[3] === void 0 ? v : d[3] === '"' ? ne : ie) : n === ne || n === ie ? n = v : n === se || n === oe ? n = T : (n = v, o = void 0);
|
|
300
|
+
const f = n === v && r[l + 1].startsWith("/>") ? " " : "";
|
|
301
|
+
i += n === T ? a + ke : h >= 0 ? (s.push(u), a.slice(0, h) + he + a.slice(h) + $ + f) : a + $ + (h === -2 ? l : f);
|
|
302
|
+
}
|
|
303
|
+
return [me(r, i + (r[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
388
304
|
};
|
|
389
|
-
class
|
|
390
|
-
constructor({ strings:
|
|
391
|
-
let
|
|
305
|
+
class H {
|
|
306
|
+
constructor({ strings: e, _$litType$: t }, s) {
|
|
307
|
+
let o;
|
|
392
308
|
this.parts = [];
|
|
393
309
|
let i = 0, n = 0;
|
|
394
|
-
const
|
|
395
|
-
if (this.el =
|
|
396
|
-
const
|
|
397
|
-
|
|
310
|
+
const l = e.length - 1, a = this.parts, [u, d] = Re(e, t);
|
|
311
|
+
if (this.el = H.createElement(u, s), _.currentNode = this.el.content, t === 2 || t === 3) {
|
|
312
|
+
const h = this.el.content.firstChild;
|
|
313
|
+
h.replaceWith(...h.childNodes);
|
|
398
314
|
}
|
|
399
|
-
for (; (
|
|
400
|
-
if (
|
|
401
|
-
if (
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
} else
|
|
405
|
-
if (
|
|
406
|
-
const
|
|
407
|
-
if (
|
|
408
|
-
|
|
409
|
-
for (let
|
|
410
|
-
|
|
315
|
+
for (; (o = _.nextNode()) !== null && a.length < l; ) {
|
|
316
|
+
if (o.nodeType === 1) {
|
|
317
|
+
if (o.hasAttributes()) for (const h of o.getAttributeNames()) if (h.endsWith(he)) {
|
|
318
|
+
const m = d[n++], f = o.getAttribute(h).split($), L = /([.?@])?(.*)/.exec(m);
|
|
319
|
+
a.push({ type: 1, index: i, name: L[2], strings: f, ctor: L[1] === "." ? Ne : L[1] === "?" ? He : L[1] === "@" ? qe : I }), o.removeAttribute(h);
|
|
320
|
+
} else h.startsWith($) && (a.push({ type: 6, index: i }), o.removeAttribute(h));
|
|
321
|
+
if (pe.test(o.tagName)) {
|
|
322
|
+
const h = o.textContent.split($), m = h.length - 1;
|
|
323
|
+
if (m > 0) {
|
|
324
|
+
o.textContent = M ? M.emptyScript : "";
|
|
325
|
+
for (let f = 0; f < m; f++) o.append(h[f], O()), _.nextNode(), a.push({ type: 2, index: ++i });
|
|
326
|
+
o.append(h[m], O());
|
|
411
327
|
}
|
|
412
328
|
}
|
|
413
|
-
} else if (
|
|
329
|
+
} else if (o.nodeType === 8) if (o.data === ue) a.push({ type: 2, index: i });
|
|
414
330
|
else {
|
|
415
|
-
let
|
|
416
|
-
for (; (
|
|
331
|
+
let h = -1;
|
|
332
|
+
for (; (h = o.data.indexOf($, h + 1)) !== -1; ) a.push({ type: 7, index: i }), h += $.length - 1;
|
|
417
333
|
}
|
|
418
334
|
i++;
|
|
419
335
|
}
|
|
420
336
|
}
|
|
421
|
-
static createElement(
|
|
422
|
-
const
|
|
423
|
-
return
|
|
337
|
+
static createElement(e, t) {
|
|
338
|
+
const s = A.createElement("template");
|
|
339
|
+
return s.innerHTML = e, s;
|
|
424
340
|
}
|
|
425
341
|
}
|
|
426
|
-
function
|
|
427
|
-
var n,
|
|
428
|
-
if (
|
|
429
|
-
let
|
|
430
|
-
const i =
|
|
431
|
-
return (
|
|
342
|
+
function C(r, e, t = r, s) {
|
|
343
|
+
var n, l;
|
|
344
|
+
if (e === S) return e;
|
|
345
|
+
let o = s !== void 0 ? (n = t._$Co) == null ? void 0 : n[s] : t._$Cl;
|
|
346
|
+
const i = N(e) ? void 0 : e._$litDirective$;
|
|
347
|
+
return (o == null ? void 0 : o.constructor) !== i && ((l = o == null ? void 0 : o._$AO) == null || l.call(o, !1), i === void 0 ? o = void 0 : (o = new i(r), o._$AT(r, t, s)), s !== void 0 ? (t._$Co ?? (t._$Co = []))[s] = o : t._$Cl = o), o !== void 0 && (e = C(r, o._$AS(r, e.values), o, s)), e;
|
|
432
348
|
}
|
|
433
|
-
class
|
|
434
|
-
constructor(
|
|
435
|
-
this._$AV = [], this._$AN = void 0, this._$AD =
|
|
349
|
+
class Oe {
|
|
350
|
+
constructor(e, t) {
|
|
351
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
436
352
|
}
|
|
437
353
|
get parentNode() {
|
|
438
354
|
return this._$AM.parentNode;
|
|
@@ -440,36 +356,36 @@ class Ve {
|
|
|
440
356
|
get _$AU() {
|
|
441
357
|
return this._$AM._$AU;
|
|
442
358
|
}
|
|
443
|
-
u(
|
|
444
|
-
const { el: { content:
|
|
445
|
-
|
|
446
|
-
let i =
|
|
447
|
-
for (;
|
|
448
|
-
if (n ===
|
|
449
|
-
let
|
|
450
|
-
|
|
359
|
+
u(e) {
|
|
360
|
+
const { el: { content: t }, parts: s } = this._$AD, o = ((e == null ? void 0 : e.creationScope) ?? A).importNode(t, !0);
|
|
361
|
+
_.currentNode = o;
|
|
362
|
+
let i = _.nextNode(), n = 0, l = 0, a = s[0];
|
|
363
|
+
for (; a !== void 0; ) {
|
|
364
|
+
if (n === a.index) {
|
|
365
|
+
let u;
|
|
366
|
+
a.type === 2 ? u = new D(i, i.nextSibling, this, e) : a.type === 1 ? u = new a.ctor(i, a.name, a.strings, this, e) : a.type === 6 && (u = new De(i, this, e)), this._$AV.push(u), a = s[++l];
|
|
451
367
|
}
|
|
452
|
-
n !== (
|
|
368
|
+
n !== (a == null ? void 0 : a.index) && (i = _.nextNode(), n++);
|
|
453
369
|
}
|
|
454
|
-
return
|
|
370
|
+
return _.currentNode = A, o;
|
|
455
371
|
}
|
|
456
|
-
p(
|
|
457
|
-
let
|
|
458
|
-
for (const
|
|
372
|
+
p(e) {
|
|
373
|
+
let t = 0;
|
|
374
|
+
for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(e, s, t), t += s.strings.length - 2) : s._$AI(e[t])), t++;
|
|
459
375
|
}
|
|
460
376
|
}
|
|
461
|
-
class
|
|
377
|
+
class D {
|
|
462
378
|
get _$AU() {
|
|
463
|
-
var
|
|
464
|
-
return ((
|
|
379
|
+
var e;
|
|
380
|
+
return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
|
|
465
381
|
}
|
|
466
|
-
constructor(
|
|
467
|
-
this.type = 2, this._$AH =
|
|
382
|
+
constructor(e, t, s, o) {
|
|
383
|
+
this.type = 2, this._$AH = p, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = s, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0;
|
|
468
384
|
}
|
|
469
385
|
get parentNode() {
|
|
470
|
-
let
|
|
471
|
-
const
|
|
472
|
-
return
|
|
386
|
+
let e = this._$AA.parentNode;
|
|
387
|
+
const t = this._$AM;
|
|
388
|
+
return t !== void 0 && (e == null ? void 0 : e.nodeType) === 11 && (e = t.parentNode), e;
|
|
473
389
|
}
|
|
474
390
|
get startNode() {
|
|
475
391
|
return this._$AA;
|
|
@@ -477,2903 +393,975 @@ class G {
|
|
|
477
393
|
get endNode() {
|
|
478
394
|
return this._$AB;
|
|
479
395
|
}
|
|
480
|
-
_$AI(
|
|
481
|
-
|
|
396
|
+
_$AI(e, t = this) {
|
|
397
|
+
e = C(this, e, t), N(e) ? e === p || e == null || e === "" ? (this._$AH !== p && this._$AR(), this._$AH = p) : e !== this._$AH && e !== S && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Te(e) ? this.k(e) : this._(e);
|
|
482
398
|
}
|
|
483
|
-
O(
|
|
484
|
-
return this._$AA.parentNode.insertBefore(
|
|
399
|
+
O(e) {
|
|
400
|
+
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
485
401
|
}
|
|
486
|
-
T(
|
|
487
|
-
this._$AH !==
|
|
402
|
+
T(e) {
|
|
403
|
+
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
488
404
|
}
|
|
489
|
-
_(
|
|
490
|
-
this._$AH !==
|
|
405
|
+
_(e) {
|
|
406
|
+
this._$AH !== p && N(this._$AH) ? this._$AA.nextSibling.data = e : this.T(A.createTextNode(e)), this._$AH = e;
|
|
491
407
|
}
|
|
492
|
-
$(
|
|
408
|
+
$(e) {
|
|
493
409
|
var i;
|
|
494
|
-
const { values:
|
|
495
|
-
if (((i = this._$AH) == null ? void 0 : i._$AD) ===
|
|
410
|
+
const { values: t, _$litType$: s } = e, o = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = H.createElement(me(s.h, s.h[0]), this.options)), s);
|
|
411
|
+
if (((i = this._$AH) == null ? void 0 : i._$AD) === o) this._$AH.p(t);
|
|
496
412
|
else {
|
|
497
|
-
const n = new
|
|
498
|
-
n.p(
|
|
413
|
+
const n = new Oe(o, this), l = n.u(this.options);
|
|
414
|
+
n.p(t), this.T(l), this._$AH = n;
|
|
499
415
|
}
|
|
500
416
|
}
|
|
501
|
-
_$AC(
|
|
502
|
-
let
|
|
503
|
-
return
|
|
504
|
-
}
|
|
505
|
-
k(
|
|
506
|
-
|
|
507
|
-
const
|
|
508
|
-
let
|
|
509
|
-
for (const i of
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
_$AR(
|
|
513
|
-
var
|
|
514
|
-
for ((
|
|
515
|
-
const
|
|
516
|
-
|
|
417
|
+
_$AC(e) {
|
|
418
|
+
let t = ae.get(e.strings);
|
|
419
|
+
return t === void 0 && ae.set(e.strings, t = new H(e)), t;
|
|
420
|
+
}
|
|
421
|
+
k(e) {
|
|
422
|
+
J(this._$AH) || (this._$AH = [], this._$AR());
|
|
423
|
+
const t = this._$AH;
|
|
424
|
+
let s, o = 0;
|
|
425
|
+
for (const i of e) o === t.length ? t.push(s = new D(this.O(O()), this.O(O()), this, this.options)) : s = t[o], s._$AI(i), o++;
|
|
426
|
+
o < t.length && (this._$AR(s && s._$AB.nextSibling, o), t.length = o);
|
|
427
|
+
}
|
|
428
|
+
_$AR(e = this._$AA.nextSibling, t) {
|
|
429
|
+
var s;
|
|
430
|
+
for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, t); e && e !== this._$AB; ) {
|
|
431
|
+
const o = e.nextSibling;
|
|
432
|
+
e.remove(), e = o;
|
|
517
433
|
}
|
|
518
434
|
}
|
|
519
|
-
setConnected(
|
|
520
|
-
var
|
|
521
|
-
this._$AM === void 0 && (this.
|
|
435
|
+
setConnected(e) {
|
|
436
|
+
var t;
|
|
437
|
+
this._$AM === void 0 && (this._$Cv = e, (t = this._$AP) == null || t.call(this, e));
|
|
522
438
|
}
|
|
523
439
|
}
|
|
524
|
-
class
|
|
440
|
+
class I {
|
|
525
441
|
get tagName() {
|
|
526
442
|
return this.element.tagName;
|
|
527
443
|
}
|
|
528
444
|
get _$AU() {
|
|
529
445
|
return this._$AM._$AU;
|
|
530
446
|
}
|
|
531
|
-
constructor(
|
|
532
|
-
this.type = 1, this._$AH =
|
|
447
|
+
constructor(e, t, s, o, i) {
|
|
448
|
+
this.type = 1, this._$AH = p, this._$AN = void 0, this.element = e, this.name = t, this._$AM = o, this.options = i, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = p;
|
|
533
449
|
}
|
|
534
|
-
_$AI(
|
|
450
|
+
_$AI(e, t = this, s, o) {
|
|
535
451
|
const i = this.strings;
|
|
536
452
|
let n = !1;
|
|
537
|
-
if (i === void 0)
|
|
453
|
+
if (i === void 0) e = C(this, e, t, 0), n = !N(e) || e !== this._$AH && e !== S, n && (this._$AH = e);
|
|
538
454
|
else {
|
|
539
|
-
const
|
|
540
|
-
let
|
|
541
|
-
for (
|
|
455
|
+
const l = e;
|
|
456
|
+
let a, u;
|
|
457
|
+
for (e = i[0], a = 0; a < i.length - 1; a++) u = C(this, l[s + a], t, a), u === S && (u = this._$AH[a]), n || (n = !N(u) || u !== this._$AH[a]), u === p ? e = p : e !== p && (e += (u ?? "") + i[a + 1]), this._$AH[a] = u;
|
|
542
458
|
}
|
|
543
|
-
n && !
|
|
459
|
+
n && !o && this.j(e);
|
|
544
460
|
}
|
|
545
|
-
j(
|
|
546
|
-
|
|
461
|
+
j(e) {
|
|
462
|
+
e === p ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
547
463
|
}
|
|
548
464
|
}
|
|
549
|
-
class
|
|
465
|
+
class Ne extends I {
|
|
550
466
|
constructor() {
|
|
551
467
|
super(...arguments), this.type = 3;
|
|
552
468
|
}
|
|
553
|
-
j(
|
|
554
|
-
this.element[this.name] =
|
|
469
|
+
j(e) {
|
|
470
|
+
this.element[this.name] = e === p ? void 0 : e;
|
|
555
471
|
}
|
|
556
472
|
}
|
|
557
|
-
class
|
|
473
|
+
class He extends I {
|
|
558
474
|
constructor() {
|
|
559
475
|
super(...arguments), this.type = 4;
|
|
560
476
|
}
|
|
561
|
-
j(
|
|
562
|
-
this.element.toggleAttribute(this.name, !!
|
|
477
|
+
j(e) {
|
|
478
|
+
this.element.toggleAttribute(this.name, !!e && e !== p);
|
|
563
479
|
}
|
|
564
480
|
}
|
|
565
|
-
class
|
|
566
|
-
constructor(
|
|
567
|
-
super(
|
|
481
|
+
class qe extends I {
|
|
482
|
+
constructor(e, t, s, o, i) {
|
|
483
|
+
super(e, t, s, o, i), this.type = 5;
|
|
568
484
|
}
|
|
569
|
-
_$AI(
|
|
570
|
-
if ((
|
|
571
|
-
const
|
|
572
|
-
|
|
485
|
+
_$AI(e, t = this) {
|
|
486
|
+
if ((e = C(this, e, t, 0) ?? p) === S) return;
|
|
487
|
+
const s = this._$AH, o = e === p && s !== p || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, i = e !== p && (s === p || o);
|
|
488
|
+
o && this.element.removeEventListener(this.name, this, s), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
573
489
|
}
|
|
574
|
-
handleEvent(
|
|
575
|
-
var
|
|
576
|
-
typeof this._$AH == "function" ? this._$AH.call(((
|
|
490
|
+
handleEvent(e) {
|
|
491
|
+
var t;
|
|
492
|
+
typeof this._$AH == "function" ? this._$AH.call(((t = this.options) == null ? void 0 : t.host) ?? this.element, e) : this._$AH.handleEvent(e);
|
|
577
493
|
}
|
|
578
494
|
}
|
|
579
|
-
class
|
|
580
|
-
constructor(
|
|
581
|
-
this.element =
|
|
495
|
+
class De {
|
|
496
|
+
constructor(e, t, s) {
|
|
497
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
|
|
582
498
|
}
|
|
583
499
|
get _$AU() {
|
|
584
500
|
return this._$AM._$AU;
|
|
585
501
|
}
|
|
586
|
-
_$AI(
|
|
587
|
-
|
|
502
|
+
_$AI(e) {
|
|
503
|
+
C(this, e);
|
|
588
504
|
}
|
|
589
505
|
}
|
|
590
|
-
const
|
|
591
|
-
|
|
592
|
-
const
|
|
593
|
-
const
|
|
594
|
-
let
|
|
595
|
-
if (
|
|
596
|
-
const i = (
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
return
|
|
506
|
+
const W = R.litHtmlPolyfillSupport;
|
|
507
|
+
W == null || W(H, D), (R.litHtmlVersions ?? (R.litHtmlVersions = [])).push("3.2.1");
|
|
508
|
+
const Le = (r, e, t) => {
|
|
509
|
+
const s = (t == null ? void 0 : t.renderBefore) ?? e;
|
|
510
|
+
let o = s._$litPart$;
|
|
511
|
+
if (o === void 0) {
|
|
512
|
+
const i = (t == null ? void 0 : t.renderBefore) ?? null;
|
|
513
|
+
s._$litPart$ = o = new D(e.insertBefore(O(), i), i, void 0, t ?? {});
|
|
514
|
+
}
|
|
515
|
+
return o._$AI(r), o;
|
|
600
516
|
};
|
|
601
517
|
/**
|
|
602
518
|
* @license
|
|
603
519
|
* Copyright 2017 Google LLC
|
|
604
520
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
605
521
|
*/
|
|
606
|
-
class
|
|
522
|
+
class b extends P {
|
|
607
523
|
constructor() {
|
|
608
|
-
super(...arguments), this.renderOptions = { host: this }, this.
|
|
524
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
609
525
|
}
|
|
610
526
|
createRenderRoot() {
|
|
611
|
-
var
|
|
612
|
-
const
|
|
613
|
-
return (
|
|
527
|
+
var t;
|
|
528
|
+
const e = super.createRenderRoot();
|
|
529
|
+
return (t = this.renderOptions).renderBefore ?? (t.renderBefore = e.firstChild), e;
|
|
614
530
|
}
|
|
615
|
-
update(
|
|
616
|
-
const
|
|
617
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(
|
|
531
|
+
update(e) {
|
|
532
|
+
const t = this.render();
|
|
533
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Le(t, this.renderRoot, this.renderOptions);
|
|
618
534
|
}
|
|
619
535
|
connectedCallback() {
|
|
620
|
-
var
|
|
621
|
-
super.connectedCallback(), (
|
|
536
|
+
var e;
|
|
537
|
+
super.connectedCallback(), (e = this._$Do) == null || e.setConnected(!0);
|
|
622
538
|
}
|
|
623
539
|
disconnectedCallback() {
|
|
624
|
-
var
|
|
625
|
-
super.disconnectedCallback(), (
|
|
540
|
+
var e;
|
|
541
|
+
super.disconnectedCallback(), (e = this._$Do) == null || e.setConnected(!1);
|
|
626
542
|
}
|
|
627
543
|
render() {
|
|
628
|
-
return
|
|
544
|
+
return S;
|
|
629
545
|
}
|
|
630
546
|
}
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
display: flex;
|
|
648
|
-
flex-direction: column;
|
|
649
|
-
background-color: var(--sl-panel-background-color);
|
|
650
|
-
box-shadow: var(--sl-shadow-x-small);
|
|
651
|
-
border: solid var(--border-width) var(--border-color);
|
|
652
|
-
border-radius: var(--border-radius);
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
.card__image {
|
|
656
|
-
display: flex;
|
|
657
|
-
border-top-left-radius: var(--border-radius);
|
|
658
|
-
border-top-right-radius: var(--border-radius);
|
|
659
|
-
margin: calc(-1 * var(--border-width));
|
|
660
|
-
overflow: hidden;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
.card__image::slotted(img) {
|
|
664
|
-
display: block;
|
|
665
|
-
width: 100%;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
.card:not(.card--has-image) .card__image {
|
|
669
|
-
display: none;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
.card__header {
|
|
673
|
-
display: block;
|
|
674
|
-
border-bottom: solid var(--border-width) var(--border-color);
|
|
675
|
-
padding: calc(var(--padding) / 2) var(--padding);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
.card:not(.card--has-header) .card__header {
|
|
679
|
-
display: none;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
.card:not(.card--has-image) .card__header {
|
|
683
|
-
border-top-left-radius: var(--border-radius);
|
|
684
|
-
border-top-right-radius: var(--border-radius);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
.card__body {
|
|
688
|
-
display: block;
|
|
689
|
-
padding: var(--padding);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
.card--has-footer .card__footer {
|
|
693
|
-
display: block;
|
|
694
|
-
border-top: solid var(--border-width) var(--border-color);
|
|
695
|
-
padding: var(--padding);
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
.card:not(.card--has-footer) .card__footer {
|
|
699
|
-
display: none;
|
|
700
|
-
}
|
|
701
|
-
`, St = class {
|
|
702
|
-
constructor(o, ...t) {
|
|
703
|
-
this.slotNames = [], this.handleSlotChange = (e) => {
|
|
704
|
-
const r = e.target;
|
|
705
|
-
(this.slotNames.includes("[default]") && !r.name || r.name && this.slotNames.includes(r.name)) && this.host.requestUpdate();
|
|
706
|
-
}, (this.host = o).addController(this), this.slotNames = t;
|
|
707
|
-
}
|
|
708
|
-
hasDefaultSlot() {
|
|
709
|
-
return [...this.host.childNodes].some((o) => {
|
|
710
|
-
if (o.nodeType === o.TEXT_NODE && o.textContent.trim() !== "")
|
|
711
|
-
return !0;
|
|
712
|
-
if (o.nodeType === o.ELEMENT_NODE) {
|
|
713
|
-
const t = o;
|
|
714
|
-
if (t.tagName.toLowerCase() === "sl-visually-hidden")
|
|
715
|
-
return !1;
|
|
716
|
-
if (!t.hasAttribute("slot"))
|
|
717
|
-
return !0;
|
|
718
|
-
}
|
|
719
|
-
return !1;
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
hasNamedSlot(o) {
|
|
723
|
-
return this.host.querySelector(`:scope > [slot="${o}"]`) !== null;
|
|
724
|
-
}
|
|
725
|
-
test(o) {
|
|
726
|
-
return o === "[default]" ? this.hasDefaultSlot() : this.hasNamedSlot(o);
|
|
727
|
-
}
|
|
728
|
-
hostConnected() {
|
|
729
|
-
this.host.shadowRoot.addEventListener("slotchange", this.handleSlotChange);
|
|
730
|
-
}
|
|
731
|
-
hostDisconnected() {
|
|
732
|
-
this.host.shadowRoot.removeEventListener("slotchange", this.handleSlotChange);
|
|
733
|
-
}
|
|
734
|
-
}, Q = $`
|
|
735
|
-
:host {
|
|
736
|
-
box-sizing: border-box;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
:host *,
|
|
740
|
-
:host *::before,
|
|
741
|
-
:host *::after {
|
|
742
|
-
box-sizing: inherit;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
[hidden] {
|
|
746
|
-
display: none !important;
|
|
747
|
-
}
|
|
748
|
-
`, ee = Object.defineProperty, He = Object.defineProperties, je = Object.getOwnPropertyDescriptor, qe = Object.getOwnPropertyDescriptors, Ft = Object.getOwnPropertySymbols, We = Object.prototype.hasOwnProperty, Ke = Object.prototype.propertyIsEnumerable, Ht = (o, t, e) => t in o ? ee(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, X = (o, t) => {
|
|
749
|
-
for (var e in t || (t = {}))
|
|
750
|
-
We.call(t, e) && Ht(o, e, t[e]);
|
|
751
|
-
if (Ft)
|
|
752
|
-
for (var e of Ft(t))
|
|
753
|
-
Ke.call(t, e) && Ht(o, e, t[e]);
|
|
754
|
-
return o;
|
|
755
|
-
}, oe = (o, t) => He(o, qe(t)), a = (o, t, e, r) => {
|
|
756
|
-
for (var s = r > 1 ? void 0 : r ? je(t, e) : t, i = o.length - 1, n; i >= 0; i--)
|
|
757
|
-
(n = o[i]) && (s = (r ? n(t, e, s) : n(s)) || s);
|
|
758
|
-
return r && s && ee(t, e, s), s;
|
|
759
|
-
};
|
|
760
|
-
/**
|
|
761
|
-
* @license
|
|
762
|
-
* Copyright 2017 Google LLC
|
|
763
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
764
|
-
*/
|
|
765
|
-
const Ze = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged: Ct }, Ye = (o = Ze, t, e) => {
|
|
766
|
-
const { kind: r, metadata: s } = e;
|
|
767
|
-
let i = globalThis.litPropertyMetadata.get(s);
|
|
768
|
-
if (i === void 0 && globalThis.litPropertyMetadata.set(s, i = /* @__PURE__ */ new Map()), i.set(e.name, o), r === "accessor") {
|
|
769
|
-
const { name: n } = e;
|
|
770
|
-
return { set(d) {
|
|
771
|
-
const l = t.get.call(this);
|
|
772
|
-
t.set.call(this, d), this.requestUpdate(n, l, o);
|
|
773
|
-
}, init(d) {
|
|
774
|
-
return d !== void 0 && this.P(n, void 0, o), d;
|
|
775
|
-
} };
|
|
776
|
-
}
|
|
777
|
-
if (r === "setter") {
|
|
778
|
-
const { name: n } = e;
|
|
779
|
-
return function(d) {
|
|
780
|
-
const l = this[n];
|
|
781
|
-
t.call(this, d), this.requestUpdate(n, l, o);
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
throw Error("Unsupported decorator location: " + r);
|
|
785
|
-
};
|
|
786
|
-
function u(o) {
|
|
787
|
-
return (t, e) => typeof e == "object" ? Ye(o, t, e) : ((r, s, i) => {
|
|
788
|
-
const n = s.hasOwnProperty(i);
|
|
789
|
-
return s.constructor.createProperty(i, n ? { ...r, wrapped: !0 } : r), n ? Object.getOwnPropertyDescriptor(s, i) : void 0;
|
|
790
|
-
})(o, t, e);
|
|
547
|
+
var le;
|
|
548
|
+
b._$litElement$ = !0, b.finalized = !0, (le = globalThis.litElementHydrateSupport) == null || le.call(globalThis, { LitElement: b });
|
|
549
|
+
const B = globalThis.litElementPolyfillSupport;
|
|
550
|
+
B == null || B({ LitElement: b });
|
|
551
|
+
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
|
|
552
|
+
function x(r) {
|
|
553
|
+
return {
|
|
554
|
+
// Underlying mechanism to use the REST URLs directly.
|
|
555
|
+
api: (e, t) => E(r, e, t),
|
|
556
|
+
mintToken: ({ username: e, password: t }) => Fe({ config: r, username: e, password: t }),
|
|
557
|
+
refreshToken: ({ token: e }) => Me({ config: r, token: e }),
|
|
558
|
+
pubkey: () => Ie({ config: r }),
|
|
559
|
+
updatePassword: ({ token: e, currentPassword: t, newPassword: s }) => ze({ config: r, token: e, currentPassword: t, newPassword: s }),
|
|
560
|
+
triggerResetPassword: ({ username: e }) => je({ config: r, username: e }),
|
|
561
|
+
confirmResetPassword: ({ username: e, newPassword: t, confirmationCode: s }) => We({ config: r, username: e, newPassword: t, confirmationCode: s })
|
|
562
|
+
};
|
|
791
563
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
564
|
+
function Fe({ config: r, username: e, password: t }) {
|
|
565
|
+
return E(r, "/v1/user/login", {
|
|
566
|
+
method: "POST",
|
|
567
|
+
body: {
|
|
568
|
+
username: e,
|
|
569
|
+
password: t
|
|
570
|
+
}
|
|
571
|
+
});
|
|
799
572
|
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
* @license
|
|
808
|
-
* Copyright 2017 Google LLC
|
|
809
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
810
|
-
*/
|
|
811
|
-
function re(o, t) {
|
|
812
|
-
return (e, r, s) => {
|
|
813
|
-
const i = (n) => {
|
|
814
|
-
var d;
|
|
815
|
-
return ((d = n.renderRoot) == null ? void 0 : d.querySelector(o)) ?? null;
|
|
816
|
-
};
|
|
817
|
-
return Je(e, r, { get() {
|
|
818
|
-
return i(this);
|
|
819
|
-
} });
|
|
820
|
-
};
|
|
573
|
+
function Me({ config: r, token: e }) {
|
|
574
|
+
return E(r, "/v1/refresh", {
|
|
575
|
+
method: "POST",
|
|
576
|
+
body: {
|
|
577
|
+
token: e
|
|
578
|
+
}
|
|
579
|
+
});
|
|
821
580
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
581
|
+
function Ie({ config: r }) {
|
|
582
|
+
return E(r, "/v1/pubkey", {
|
|
583
|
+
method: "GET"
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
function ze({ config: r, token: e, currentPassword: t, newPassword: s }) {
|
|
587
|
+
return E(r, "/v1/user/password", {
|
|
588
|
+
method: "PUT",
|
|
589
|
+
body: {
|
|
590
|
+
currentPassword: t,
|
|
591
|
+
newPassword: s
|
|
592
|
+
},
|
|
593
|
+
headers: {
|
|
594
|
+
Authorization: `Bearer ${e}`
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function je({ config: r, username: e }) {
|
|
599
|
+
return E(r, "/v1/user/password/reset", {
|
|
600
|
+
method: "POST",
|
|
601
|
+
body: {
|
|
602
|
+
username: e
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
function We({ config: r, username: e, newPassword: t, confirmationCode: s }) {
|
|
607
|
+
return E(r, "/v1/user/password/reset/confirm", {
|
|
608
|
+
method: "POST",
|
|
609
|
+
body: {
|
|
610
|
+
username: e,
|
|
611
|
+
newPassword: t,
|
|
612
|
+
confirmationCode: s
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
async function E(r, e, t) {
|
|
617
|
+
var u;
|
|
618
|
+
const s = r.baseUrl.endsWith("/") ? r.baseUrl : `${r.baseUrl}/`, o = e.startsWith("/") ? e.substring(1) : e, i = new URL(o, s), l = Object.assign({}, t, {
|
|
619
|
+
headers: Object.assign({}, {
|
|
620
|
+
"Content-Type": "application/json"
|
|
621
|
+
}, t == null ? void 0 : t.headers),
|
|
622
|
+
body: t != null && t.body ? JSON.stringify(t.body) : void 0
|
|
623
|
+
}), a = await fetch(i.toString(), l);
|
|
624
|
+
if (!a.ok) {
|
|
625
|
+
const d = new Error("API request failed.");
|
|
626
|
+
if (d.status = a.status, d.statusText = a.statusText, d.url = i.toString(), d.headers = a.headers, d.bodyUsed = a.bodyUsed, (u = a.headers.get("Content-Type")) != null && u.includes("application/json"))
|
|
841
627
|
try {
|
|
842
|
-
|
|
628
|
+
d.body = await a.json();
|
|
843
629
|
} catch {
|
|
844
|
-
|
|
845
|
-
}, e);
|
|
630
|
+
d.body = "Failed to parse response body.";
|
|
846
631
|
}
|
|
847
|
-
|
|
848
|
-
}
|
|
849
|
-
let s = " (unknown version)", i = s;
|
|
850
|
-
"version" in t && t.version && (s = " v" + t.version), "version" in r && r.version && (i = " v" + r.version), !(s && i && s === i) && console.warn(
|
|
851
|
-
`Attempted to register <${o}>${s}, but <${o}>${i} has already been registered.`
|
|
852
|
-
);
|
|
853
|
-
}
|
|
854
|
-
};
|
|
855
|
-
k.version = "2.16.0";
|
|
856
|
-
k.dependencies = {};
|
|
857
|
-
a([
|
|
858
|
-
u()
|
|
859
|
-
], k.prototype, "dir", 2);
|
|
860
|
-
a([
|
|
861
|
-
u()
|
|
862
|
-
], k.prototype, "lang", 2);
|
|
863
|
-
/**
|
|
864
|
-
* @license
|
|
865
|
-
* Copyright 2017 Google LLC
|
|
866
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
867
|
-
*/
|
|
868
|
-
const T = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, se = (o) => (...t) => ({ _$litDirective$: o, values: t });
|
|
869
|
-
class ie {
|
|
870
|
-
constructor(t) {
|
|
632
|
+
throw d;
|
|
871
633
|
}
|
|
872
|
-
|
|
873
|
-
return
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
634
|
+
if (a.status !== 204)
|
|
635
|
+
return await a.json();
|
|
636
|
+
}
|
|
637
|
+
function fe({ api: r }, e) {
|
|
638
|
+
const t = x({
|
|
639
|
+
baseUrl: r
|
|
640
|
+
});
|
|
641
|
+
return console.log("sending credentials to API", r), t.mintToken(e);
|
|
642
|
+
}
|
|
643
|
+
const g = Object.freeze({
|
|
644
|
+
REQUEST: "request",
|
|
645
|
+
CONFIRM: "confirm",
|
|
646
|
+
FINISHED: "finished"
|
|
647
|
+
});
|
|
648
|
+
class Be extends b {
|
|
649
|
+
static get properties() {
|
|
650
|
+
return {
|
|
651
|
+
api: { type: String, attribute: "api" },
|
|
652
|
+
confirmation: { type: "String", attribute: "confirmation" }
|
|
653
|
+
};
|
|
880
654
|
}
|
|
881
|
-
|
|
882
|
-
return
|
|
655
|
+
static get styles() {
|
|
656
|
+
return q`
|
|
657
|
+
:host {
|
|
658
|
+
display: block;
|
|
659
|
+
font-family: Arial, sans-serif;
|
|
660
|
+
}
|
|
661
|
+
form input[type="text"],
|
|
662
|
+
form input[type="password"] {
|
|
663
|
+
width: 100%;
|
|
664
|
+
margin: 5px 0 15px 0;
|
|
665
|
+
padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
|
|
666
|
+
box-sizing: border-box;
|
|
667
|
+
border: 1px solid var(--color-gray-300, #ccc);
|
|
668
|
+
border-radius: var(--radius-sm, 5px);
|
|
669
|
+
color: var(--color-gray-9, #333);
|
|
670
|
+
background-color: var(--color-gray-0, transparent);
|
|
671
|
+
}
|
|
672
|
+
form input[type="submit"] {
|
|
673
|
+
background-color:var(--color-primary, inherit);
|
|
674
|
+
color: var(--color-gray-0, #fff);
|
|
675
|
+
border: none;
|
|
676
|
+
padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
|
|
677
|
+
border-radius: var(--radius-dynamic, 5px);
|
|
678
|
+
width: 200px;
|
|
679
|
+
display: block;
|
|
680
|
+
margin: var(--spacing-md, 1rem) auto;
|
|
681
|
+
cursor: pointer;
|
|
682
|
+
}
|
|
683
|
+
form label {
|
|
684
|
+
font-size: 14px;
|
|
685
|
+
color: var(--color-gray-9, #333);
|
|
686
|
+
font-weight: bold;
|
|
687
|
+
margin-bottom: var(--spacing-sm, 0.5rem);
|
|
688
|
+
}
|
|
689
|
+
.error {
|
|
690
|
+
color: var(--color-danger, red);
|
|
691
|
+
font-size: 12px;
|
|
692
|
+
}
|
|
693
|
+
`;
|
|
883
694
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
* @license
|
|
887
|
-
* Copyright 2018 Google LLC
|
|
888
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
889
|
-
*/
|
|
890
|
-
const it = se(class extends ie {
|
|
891
|
-
constructor(o) {
|
|
892
|
-
var t;
|
|
893
|
-
if (super(o), o.type !== T.ATTRIBUTE || o.name !== "class" || ((t = o.strings) == null ? void 0 : t.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
695
|
+
constructor() {
|
|
696
|
+
super(), this.errors = {}, this.stage = g.REQUEST;
|
|
894
697
|
}
|
|
895
|
-
|
|
896
|
-
|
|
698
|
+
connectedCallback() {
|
|
699
|
+
console.log("[auth]", "[forgot-password]", { confirmation: this.confirmation }), super.connectedCallback(), this.confirmation && this.stage !== g.FINISHED && (this.stage = g.CONFIRM), this.requestUpdate();
|
|
700
|
+
}
|
|
701
|
+
handleSubmitRequest(e) {
|
|
702
|
+
e.preventDefault();
|
|
703
|
+
const t = e.target.username.value;
|
|
704
|
+
this.username = t, x({
|
|
705
|
+
baseUrl: this.api
|
|
706
|
+
}).triggerResetPassword({ username: t }).then(() => {
|
|
707
|
+
console.log("[auth]", "triggered reset password for ", t), this.stage = g.CONFIRM;
|
|
708
|
+
}).catch((o) => {
|
|
709
|
+
console.error("[auth] error triggering reset password", o), this.errors.general = o.message || "Unable to send password reset request. Please try again later.";
|
|
710
|
+
}).finally(() => {
|
|
711
|
+
this.requestUpdate();
|
|
712
|
+
});
|
|
897
713
|
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
return
|
|
714
|
+
handleSubmitConfirm(e) {
|
|
715
|
+
e.preventDefault();
|
|
716
|
+
const t = e.target.password.value, s = e.target["confirm-password"].value;
|
|
717
|
+
if (t !== s) {
|
|
718
|
+
this.errors["confirm-password"] = "Passwords do not match.", this.requestUpdate();
|
|
719
|
+
return;
|
|
904
720
|
}
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
n === this.st.has(i) || (s = this.nt) != null && s.has(i) || (n ? (e.add(i), this.st.add(i)) : (e.remove(i), this.st.delete(i)));
|
|
721
|
+
const o = this.confirmation || e.target.confirmation.value;
|
|
722
|
+
if (!o) {
|
|
723
|
+
this.errors.general = "Confirmation code is required.", this.requestUpdate();
|
|
724
|
+
return;
|
|
910
725
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
})
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
726
|
+
x({
|
|
727
|
+
baseUrl: this.api
|
|
728
|
+
}).confirmResetPassword({
|
|
729
|
+
username: this.username,
|
|
730
|
+
newPassword: t,
|
|
731
|
+
confirmationCode: o
|
|
732
|
+
}).then(() => fe(this, { username: this.username, password: t }).then(({ token: n }) => {
|
|
733
|
+
this.dispatchEvent(new CustomEvent("login-success", {
|
|
734
|
+
detail: { token: n },
|
|
735
|
+
composed: !0,
|
|
736
|
+
bubbles: !0
|
|
737
|
+
}));
|
|
738
|
+
})).catch((n) => {
|
|
739
|
+
console.error("[auth][forgot-password-form]", n), this.errors.general = "Unable to reset password. Please try again later.";
|
|
740
|
+
}).finally(() => {
|
|
741
|
+
this.requestUpdate();
|
|
742
|
+
});
|
|
917
743
|
}
|
|
918
744
|
render() {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
<slot part="body" class="card__body"></slot>
|
|
932
|
-
<slot name="footer" part="footer" class="card__footer"></slot>
|
|
933
|
-
</div>
|
|
934
|
-
`;
|
|
745
|
+
switch (this.stage) {
|
|
746
|
+
case g.CONFIRM:
|
|
747
|
+
return this.renderConfirmForm();
|
|
748
|
+
case g.FINISHED:
|
|
749
|
+
return c`<p>Your password has been reset.</p>`;
|
|
750
|
+
case g.REQUEST_SENT:
|
|
751
|
+
return c`<p>A email has been sent with instructions to finish
|
|
752
|
+
resetting your password.</p>`;
|
|
753
|
+
case g.REQUEST:
|
|
754
|
+
default:
|
|
755
|
+
return this.renderRequestForm();
|
|
756
|
+
}
|
|
935
757
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
758
|
+
renderRequestForm() {
|
|
759
|
+
return c`<form @submit=${this.handleSubmitRequest}>
|
|
760
|
+
<label for="username">Username/Email</label>
|
|
761
|
+
<input
|
|
762
|
+
type="text"
|
|
763
|
+
name="username"
|
|
764
|
+
placeholder="Email or Username"
|
|
765
|
+
required
|
|
766
|
+
/>
|
|
767
|
+
<p class="error">${this.errors.general}</p>
|
|
768
|
+
<input type="submit" value="Request password reset" />
|
|
769
|
+
</form>`;
|
|
770
|
+
}
|
|
771
|
+
renderConfirmForm() {
|
|
772
|
+
return c`<form @submit=${this.handleSubmitConfirm}>
|
|
773
|
+
<p>You should have received a confirmation code to reset your password</p>
|
|
774
|
+
|
|
775
|
+
${this.confirmation ? "" : c`<label for="confirmation">Confirmation Code</label>
|
|
776
|
+
<input
|
|
777
|
+
type="text"
|
|
778
|
+
name="confirmation"
|
|
779
|
+
placeholder="Confirmation Code"
|
|
780
|
+
required
|
|
781
|
+
/>`}
|
|
782
|
+
|
|
783
|
+
<label for="password">New Password</label>
|
|
784
|
+
<input
|
|
785
|
+
type="password"
|
|
786
|
+
name="password"
|
|
787
|
+
placeholder="Password"
|
|
788
|
+
required
|
|
789
|
+
/>
|
|
790
|
+
${this.errors.password ? c`<p class="error">${this.errors.password}</p>` : ""}
|
|
791
|
+
|
|
792
|
+
<label for="confirm-password">Confirm Password</label>
|
|
793
|
+
<input
|
|
794
|
+
type="password"
|
|
795
|
+
name="confirm-password"
|
|
796
|
+
placeholder="Confirm Password"
|
|
797
|
+
required
|
|
798
|
+
/>
|
|
799
|
+
${this.errors["confirm-password"] ? c`<p class="error">${this.errors["confirm-password"]}</p>` : ""}
|
|
800
|
+
|
|
801
|
+
${this.errors.general ? c`<p class="error">${this.errors.general}</p>` : ""}
|
|
802
|
+
<input type="submit" value="Reset Password" />
|
|
803
|
+
</form>`;
|
|
942
804
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
position: relative;
|
|
950
|
-
width: 100%;
|
|
951
|
-
font-family: var(--sl-input-font-family);
|
|
952
|
-
font-weight: var(--sl-input-font-weight);
|
|
953
|
-
letter-spacing: var(--sl-input-letter-spacing);
|
|
954
|
-
vertical-align: middle;
|
|
955
|
-
overflow: hidden;
|
|
956
|
-
cursor: text;
|
|
957
|
-
transition:
|
|
958
|
-
var(--sl-transition-fast) color,
|
|
959
|
-
var(--sl-transition-fast) border,
|
|
960
|
-
var(--sl-transition-fast) box-shadow,
|
|
961
|
-
var(--sl-transition-fast) background-color;
|
|
805
|
+
}
|
|
806
|
+
class y extends b {
|
|
807
|
+
static get properties() {
|
|
808
|
+
return {
|
|
809
|
+
api: { type: String, attribute: "api" }
|
|
810
|
+
};
|
|
962
811
|
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
812
|
+
static get styles() {
|
|
813
|
+
return q`
|
|
814
|
+
:host {
|
|
815
|
+
display: block;
|
|
816
|
+
font-family: Arial, sans-serif;
|
|
817
|
+
}
|
|
818
|
+
.login-form {
|
|
819
|
+
background-color: var(--color-gray-0, #fff);
|
|
820
|
+
padding: var(--spacing-xl, 3rem);
|
|
821
|
+
border-radius: var(--radius-md, 5px);
|
|
822
|
+
box-shadow: var(--drop-shadow-md, none);
|
|
823
|
+
}
|
|
824
|
+
form input[type="text"],
|
|
825
|
+
form input[type="password"] {
|
|
826
|
+
width: 100%;
|
|
827
|
+
margin: 5px 0 15px 0;
|
|
828
|
+
padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
|
|
829
|
+
box-sizing: border-box;
|
|
830
|
+
border: 1px solid var(--color-gray-300, #ccc);
|
|
831
|
+
border-radius: var(--radius-sm, 5px);
|
|
832
|
+
color: var(--color-gray-9, #333);
|
|
833
|
+
background-color: var(--color-gray-0, transparent);
|
|
834
|
+
}
|
|
835
|
+
form input[type="submit"] {
|
|
836
|
+
background-color: var(--color-primary, inherit);
|
|
837
|
+
color: var(--color-gray-0, #fff);
|
|
838
|
+
border: none;
|
|
839
|
+
padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
|
|
840
|
+
border-radius: var(--radius-dynamic, 5px);
|
|
841
|
+
width: 200px;
|
|
842
|
+
display: block;
|
|
843
|
+
margin: var(--spacing-md, 1rem) auto;
|
|
844
|
+
cursor: pointer;
|
|
845
|
+
}
|
|
846
|
+
form label {
|
|
847
|
+
font-size: 14px;
|
|
848
|
+
color: var(--color-gray-9, #333);
|
|
849
|
+
font-weight: bold;
|
|
850
|
+
margin-bottom: var(--spacing-sm, 0.5rem);
|
|
851
|
+
}
|
|
852
|
+
a.forgot {
|
|
853
|
+
color: var(--color-primary, inherit);
|
|
854
|
+
text-decoration: none;
|
|
855
|
+
font-size: 12px;
|
|
856
|
+
font-weight: bold;
|
|
857
|
+
}
|
|
858
|
+
.error {
|
|
859
|
+
color: var(--color-error, red);
|
|
860
|
+
font-size: 12px;
|
|
861
|
+
margin-top: var(--spacing-sm, 0.5rem);
|
|
862
|
+
}
|
|
863
|
+
.header {
|
|
864
|
+
display: flex;
|
|
865
|
+
flex-direction: column;
|
|
866
|
+
align-items: center;
|
|
867
|
+
}
|
|
868
|
+
.header .intro {
|
|
869
|
+
width: 200px;
|
|
870
|
+
margin-bottom: 0;
|
|
871
|
+
color: var(--color-gray-3);
|
|
872
|
+
}
|
|
873
|
+
.header .brand {
|
|
874
|
+
font-size: 32px;
|
|
875
|
+
min-width: 200px;
|
|
876
|
+
margin-bottom: var(--spacing-lg, 2rem);
|
|
877
|
+
}
|
|
878
|
+
.header .brand em {
|
|
879
|
+
text-transform: uppercase;
|
|
880
|
+
font-weight: bold;
|
|
881
|
+
font-style: normal;
|
|
882
|
+
}
|
|
883
|
+
`;
|
|
884
|
+
}
|
|
885
|
+
static get states() {
|
|
886
|
+
return {
|
|
887
|
+
DEFAULT: "DEFAULT",
|
|
888
|
+
FORGOT: "FORGOT",
|
|
889
|
+
CHALLENGE_CHANGE_PW: "CHALLENGE_CHANGE_PW"
|
|
890
|
+
};
|
|
968
891
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
892
|
+
constructor() {
|
|
893
|
+
super(), this.formState = y.states.DEFAULT, this.username = "", this.password = "", this.token = void 0, this.errors = [];
|
|
894
|
+
}
|
|
895
|
+
onSubmit(e) {
|
|
896
|
+
e.preventDefault();
|
|
897
|
+
const t = e.explicitOriginalTarget.parentElement;
|
|
898
|
+
console.log(t);
|
|
899
|
+
const s = new FormData(t).entries().reduce((o, [i, n]) => (o[i] = n, o), {});
|
|
900
|
+
fe(this, s).then(({ token: o, challenge: i }) => {
|
|
901
|
+
if (i && i.name === "NEW_PASSWORD_REQUIRED") {
|
|
902
|
+
this.token = o, this.username = s.username, this.password = s.password, this.setState(y.states.CHALLENGE_CHANGE_PW);
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
this.dispatchEvent(new CustomEvent("login-success", {
|
|
906
|
+
detail: { token: o }
|
|
907
|
+
}));
|
|
908
|
+
}).catch((o) => {
|
|
909
|
+
console.log(o), this.errors = [o.message], this.requestUpdate();
|
|
910
|
+
});
|
|
973
911
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
912
|
+
onSubmitChangePasswordChallenge(e) {
|
|
913
|
+
e.preventDefault();
|
|
914
|
+
const t = e.explicitOriginalTarget, s = new FormData(t).entries().reduce((l, [a, u]) => (l[a] = u, l), {}), o = s.password, i = s["confirm-password"];
|
|
915
|
+
if (o !== i) {
|
|
916
|
+
this.errors = ["Passwords do not match."], this.requestUpdate();
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
x({
|
|
920
|
+
baseUrl: this.api
|
|
921
|
+
}).updatePassword({
|
|
922
|
+
token: this.token,
|
|
923
|
+
currentPassword: this.password,
|
|
924
|
+
newPassword: o
|
|
925
|
+
}).then(() => {
|
|
926
|
+
this.dispatchEvent(new CustomEvent("login-success", {
|
|
927
|
+
detail: { token: this.token }
|
|
928
|
+
}));
|
|
929
|
+
}).catch((l) => {
|
|
930
|
+
console.log(l), this.errors = [l.message], this.requestUpdate();
|
|
931
|
+
});
|
|
979
932
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
color: var(--sl-input-color-focus);
|
|
933
|
+
setState(e) {
|
|
934
|
+
e !== this.formState && (this.formState = e, this.errors = [], this.requestUpdate());
|
|
983
935
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
936
|
+
render() {
|
|
937
|
+
return c`<div class="login-form">
|
|
938
|
+
${this.renderHeader()}
|
|
939
|
+
${this.formState === y.states.FORGOT ? this.renderForgotPasswordForm() : ""}
|
|
940
|
+
${this.formState === y.states.CHALLENGE_CHANGE_PW ? this.renderChangePasswordForm() : ""}
|
|
941
|
+
${this.formState === y.states.DEFAULT ? this.renderLoginForm() : ""}
|
|
942
|
+
</div>`;
|
|
990
943
|
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
944
|
+
/**
|
|
945
|
+
* TODO: accept the header as a slot
|
|
946
|
+
*/
|
|
947
|
+
renderHeader() {
|
|
948
|
+
return c`<div class="header">
|
|
949
|
+
<div class="intro">
|
|
950
|
+
Welcome to
|
|
951
|
+
</div>
|
|
952
|
+
<div class="brand">
|
|
953
|
+
<em>WRAL</em>.studio
|
|
954
|
+
</div>
|
|
955
|
+
</div>`;
|
|
994
956
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
957
|
+
renderLoginForm() {
|
|
958
|
+
return c`
|
|
959
|
+
<form>
|
|
960
|
+
<label for="username">User</label>
|
|
961
|
+
<input
|
|
962
|
+
type="text"
|
|
963
|
+
name="username"
|
|
964
|
+
placeholder="Email or Username"
|
|
965
|
+
required
|
|
966
|
+
/>
|
|
967
|
+
|
|
968
|
+
<label for="password">Password</label>
|
|
969
|
+
<input
|
|
970
|
+
type="password"
|
|
971
|
+
name="password"
|
|
972
|
+
placeholder="Password"
|
|
973
|
+
required
|
|
974
|
+
/>
|
|
975
|
+
<div>
|
|
976
|
+
<a href="#" class="forgot"
|
|
977
|
+
@click=${() => {
|
|
978
|
+
this.setState(y.states.FORGOT);
|
|
979
|
+
}}
|
|
980
|
+
>Forgot password</a>
|
|
981
|
+
</div>
|
|
982
|
+
|
|
983
|
+
${this.errors ? this.errors.map((e) => c`<p class="error">${e}</p>`) : ""}
|
|
984
|
+
<input type="submit" value="Log in" @click=${this.onSubmit} />
|
|
985
|
+
|
|
986
|
+
</form>`;
|
|
987
|
+
}
|
|
988
|
+
renderForgotPasswordForm() {
|
|
989
|
+
return c`
|
|
990
|
+
<auth-forgot-password-form
|
|
991
|
+
api=${this.api}>
|
|
992
|
+
</auth-forgot-password-form>
|
|
993
|
+
`;
|
|
994
|
+
}
|
|
995
|
+
renderChangePasswordForm() {
|
|
996
|
+
return c`
|
|
997
|
+
<p>You have logged in successfully, but you must change your password.</p>
|
|
998
|
+
<form @submit=${this.onSubmitChangePasswordChallenge}>
|
|
999
|
+
<input type="hidden" name="username" value="${this.username}" />
|
|
1000
|
+
<label for="password">New Password</label>
|
|
1001
|
+
<input
|
|
1002
|
+
type="password"
|
|
1003
|
+
name="password"
|
|
1004
|
+
placeholder="Password"
|
|
1005
|
+
required
|
|
1006
|
+
/>
|
|
1007
|
+
<label for="confirm-password">Confirm Password</label>
|
|
1008
|
+
<input
|
|
1009
|
+
type="password"
|
|
1010
|
+
name="confirm-password"
|
|
1011
|
+
placeholder="Confirm Password"
|
|
1012
|
+
required
|
|
1013
|
+
/>
|
|
1014
|
+
${this.errors ? this.errors.map((e) => c`<p class="error">${e}</p>`) : ""}
|
|
1015
|
+
<input type="submit" value="Change Password" />
|
|
1016
|
+
</form>
|
|
1017
|
+
`;
|
|
998
1018
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1019
|
+
}
|
|
1020
|
+
customElements.define("auth-login-form", y);
|
|
1021
|
+
customElements.define("auth-forgot-password-form", Be);
|
|
1022
|
+
function Ge() {
|
|
1023
|
+
return function(r) {
|
|
1024
|
+
const e = q`
|
|
1025
|
+
.login-layout {
|
|
1026
|
+
display: flex;
|
|
1027
|
+
flex-direction: column;
|
|
1028
|
+
gap: 1rem;
|
|
1029
|
+
justify-content: center;
|
|
1030
|
+
align-items: center;
|
|
1031
|
+
min-height: 100vh;
|
|
1032
|
+
background-color: var(--color-gray-100, #f5f5f5);
|
|
1033
|
+
}
|
|
1034
|
+
.login-layout > * {
|
|
1035
|
+
max-width: 400px;
|
|
1036
|
+
}
|
|
1037
|
+
`;
|
|
1038
|
+
return c`
|
|
1039
|
+
<style>${e}</style>
|
|
1040
|
+
<div class="login-layout">
|
|
1041
|
+
${r.main}
|
|
1042
|
+
</div>
|
|
1043
|
+
`;
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
function Ve(r) {
|
|
1047
|
+
return JSON.parse(window.atob(r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/")));
|
|
1048
|
+
}
|
|
1049
|
+
function Qe(r, e = 300, t = Date.now()) {
|
|
1050
|
+
return Ve(r).exp * 1e3 - e < t;
|
|
1051
|
+
}
|
|
1052
|
+
function ge(r) {
|
|
1053
|
+
return (r.startsWith("/") ? r : `/${r}`).replace(/\/{2,}/g, "/").replace(new RegExp("(?<=.)\\/$"), "");
|
|
1054
|
+
}
|
|
1055
|
+
function ye(r, e, t) {
|
|
1056
|
+
const s = Ke(r, t);
|
|
1057
|
+
e.pushState(t, t.title, s), r.requestRender(t);
|
|
1058
|
+
}
|
|
1059
|
+
function Je(r, e) {
|
|
1060
|
+
const { mount: t } = r.config, { history: s } = r.config.toolkit.element.ownerDocument.defaultView;
|
|
1061
|
+
return e.startsWith(t) ? {
|
|
1062
|
+
path: ge(e.slice(t.length)),
|
|
1063
|
+
push: (o) => ye(r, s, o)
|
|
1064
|
+
} : null;
|
|
1065
|
+
}
|
|
1066
|
+
function Ke(r, e) {
|
|
1067
|
+
const { mount: t } = r.config;
|
|
1068
|
+
return ge(`${t}/${e.path}`);
|
|
1069
|
+
}
|
|
1070
|
+
function Ye(r, e) {
|
|
1071
|
+
const { history: t } = e.config.toolkit.element.ownerDocument.defaultView;
|
|
1072
|
+
return c`
|
|
1073
|
+
<h1>Auth Dashboard</h1>
|
|
1074
|
+
<ul>
|
|
1075
|
+
<li><a href="#" @click=${((o, i) => () => {
|
|
1076
|
+
ye(e, t, { path: o, title: i });
|
|
1077
|
+
})("/change-password")}>Change Password</a></li>
|
|
1078
|
+
<li><a href="#" @click=${e.handleDestroyAuth}>Logout</a></li>
|
|
1079
|
+
</ul>
|
|
1080
|
+
`;
|
|
1081
|
+
}
|
|
1082
|
+
function Ze(r, e) {
|
|
1083
|
+
return c`
|
|
1084
|
+
<auth-change-password-form .auth=${e}></auth-change-password-form>
|
|
1085
|
+
`;
|
|
1086
|
+
}
|
|
1087
|
+
class Xe extends b {
|
|
1088
|
+
static get styles() {
|
|
1089
|
+
return q`
|
|
1090
|
+
:host {
|
|
1091
|
+
color: var(--color-text);
|
|
1092
|
+
display: block;
|
|
1093
|
+
font-family: var(--font-body);
|
|
1094
|
+
}
|
|
1095
|
+
h1,h2,h3,h4,h5,h6,label { font-family: var(--font-heading) }
|
|
1096
|
+
label {
|
|
1097
|
+
display: block;
|
|
1098
|
+
font-size: var(--font-size-base);
|
|
1099
|
+
margin-top: var(--spacing-md, 0.5rem);
|
|
1100
|
+
}
|
|
1101
|
+
input[type="text"],
|
|
1102
|
+
input[type="password"] {
|
|
1103
|
+
width: 100%;
|
|
1104
|
+
margin: 5px 0 15px 0;
|
|
1105
|
+
padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
|
|
1106
|
+
box-sizing: border-box;
|
|
1107
|
+
border: 1px solid var(--color-gray-300, #ccc);
|
|
1108
|
+
border-radius: var(--radius-sm, 5px);
|
|
1109
|
+
color: var(--color-gray-9, #333);
|
|
1110
|
+
background-color: var(--color-gray-0, transparent);
|
|
1111
|
+
}
|
|
1112
|
+
input[type="submit"] {
|
|
1113
|
+
background-color: var(--color-primary, inherit);
|
|
1114
|
+
color: var(--color-gray-0, #fff);
|
|
1115
|
+
border: none;
|
|
1116
|
+
padding: var(--spacing-sm, 0.5rem) var(--spacing-md, 1rem);
|
|
1117
|
+
border-radius: var(--radius-dynamic, 5px);
|
|
1118
|
+
width: 200px;
|
|
1119
|
+
cursor: pointer;
|
|
1120
|
+
}
|
|
1121
|
+
.error {
|
|
1122
|
+
color: var(--color-error);
|
|
1123
|
+
}
|
|
1124
|
+
`;
|
|
1125
|
+
}
|
|
1126
|
+
static get properties() {
|
|
1127
|
+
return {
|
|
1128
|
+
auth: { type: Object }
|
|
1129
|
+
};
|
|
1005
1130
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
background-color: var(--sl-input-filled-background-color-hover);
|
|
1131
|
+
constructor() {
|
|
1132
|
+
super(), this.errors = {}, this.success = null;
|
|
1009
1133
|
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
background-color: var(--sl-input-filled-background-color-focus);
|
|
1013
|
-
outline: var(--sl-focus-ring);
|
|
1014
|
-
outline-offset: var(--sl-focus-ring-offset);
|
|
1134
|
+
connectedCallback() {
|
|
1135
|
+
super.connectedCallback(), Y(this);
|
|
1015
1136
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1137
|
+
async onSubmit(e) {
|
|
1138
|
+
if (e.preventDefault(), e.target.newPassword.value !== e.target.confirmPassword.value) {
|
|
1139
|
+
this.errors.confirmPassword = "Passwords do not match", this.requestUpdate();
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
if (e.target.newPassword.value === e.target.currentPassword.value) {
|
|
1143
|
+
this.errors.newPassword = "The new password is the same as your current password.", this.requestUpdate();
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
await Y(this), await x({
|
|
1147
|
+
baseUrl: this.auth.config.api
|
|
1148
|
+
}).updatePassword({
|
|
1149
|
+
currentPassword: e.target.currentPassword.value,
|
|
1150
|
+
newPassword: e.target.newPassword.value
|
|
1151
|
+
}).then(() => {
|
|
1152
|
+
this.errors = {}, this.success = "Password changed.", this.requestUpdate();
|
|
1153
|
+
}).catch((s) => {
|
|
1154
|
+
this.errors.submit = s.message, this.requestUpdate();
|
|
1155
|
+
});
|
|
1021
1156
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1157
|
+
render() {
|
|
1158
|
+
return c`
|
|
1159
|
+
<h1>Change your password</h1>
|
|
1160
|
+
<p>Enter your current password and choose a new password.</p>
|
|
1161
|
+
<form @submit=${this.onSubmit}>
|
|
1162
|
+
<div class="field">
|
|
1163
|
+
<label for="currentPassword">Current Password</label>
|
|
1164
|
+
<input
|
|
1165
|
+
type="password"
|
|
1166
|
+
name="currentPassword"
|
|
1167
|
+
placeholder="Current Password"
|
|
1168
|
+
required
|
|
1169
|
+
/>
|
|
1170
|
+
${this.errors.currentPassword ? c`<p class="error">${this.errors.currentPassword}</p>` : ""}
|
|
1171
|
+
</div>
|
|
1172
|
+
<div class="field">
|
|
1173
|
+
<label for="newPassword">New Password</label>
|
|
1174
|
+
<input
|
|
1175
|
+
type="password"
|
|
1176
|
+
name="newPassword"
|
|
1177
|
+
placeholder="New Password"
|
|
1178
|
+
required
|
|
1179
|
+
/>
|
|
1180
|
+
${this.errors.newPassword ? c`<p class="error">${this.errors.newPassword}</p>` : ""}
|
|
1181
|
+
</div>
|
|
1182
|
+
<div class="field">
|
|
1183
|
+
<label for="confirmPassword">Confirm Password</label>
|
|
1184
|
+
<input
|
|
1185
|
+
type="password"
|
|
1186
|
+
name="confirmPassword"
|
|
1187
|
+
placeholder="Confirm Password"
|
|
1188
|
+
required
|
|
1189
|
+
/>
|
|
1190
|
+
${this.errors.confirmPassword ? c`<p class="error">${this.errors.confirmPassword}</p>` : ""}
|
|
1191
|
+
</div>
|
|
1192
|
+
<input type="submit" value="Change Password" />
|
|
1193
|
+
${this.errors.submit ? c`<p class="error">${this.errors.submit}</p>` : ""}
|
|
1194
|
+
${this.success ? c`<p class="success">${this.success}</p>` : ""}
|
|
1195
|
+
</form>
|
|
1196
|
+
`;
|
|
1038
1197
|
}
|
|
1198
|
+
}
|
|
1199
|
+
customElements.get("auth-change-password-form") || customElements.define("auth-change-password-form", Xe);
|
|
1200
|
+
const et = [
|
|
1201
|
+
{ path: "/", render: Ye },
|
|
1202
|
+
{ path: "/change-password", render: Ze }
|
|
1203
|
+
];
|
|
1204
|
+
function tt(r, e) {
|
|
1205
|
+
const { path: t } = r, s = et.find((o) => o.path === t);
|
|
1206
|
+
if (s)
|
|
1207
|
+
return s.render(r, e);
|
|
1208
|
+
}
|
|
1209
|
+
const rt = q`
|
|
1210
|
+
:host {
|
|
1039
1211
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1212
|
+
}
|
|
1213
|
+
`;
|
|
1214
|
+
class st extends b {
|
|
1215
|
+
static get styles() {
|
|
1216
|
+
return [rt];
|
|
1217
|
+
}
|
|
1218
|
+
static get properties() {
|
|
1219
|
+
return {
|
|
1220
|
+
state: { type: Object },
|
|
1221
|
+
auth: { type: Object }
|
|
1222
|
+
};
|
|
1045
1223
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
.input__control:-webkit-autofill:focus,
|
|
1050
|
-
.input__control:-webkit-autofill:active {
|
|
1051
|
-
box-shadow: 0 0 0 var(--sl-input-height-large) var(--sl-input-background-color-hover) inset !important;
|
|
1052
|
-
-webkit-text-fill-color: var(--sl-color-primary-500);
|
|
1053
|
-
caret-color: var(--sl-input-color);
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
.input--filled .input__control:-webkit-autofill,
|
|
1057
|
-
.input--filled .input__control:-webkit-autofill:hover,
|
|
1058
|
-
.input--filled .input__control:-webkit-autofill:focus,
|
|
1059
|
-
.input--filled .input__control:-webkit-autofill:active {
|
|
1060
|
-
box-shadow: 0 0 0 var(--sl-input-height-large) var(--sl-input-filled-background-color) inset !important;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
.input__control::placeholder {
|
|
1064
|
-
color: var(--sl-input-placeholder-color);
|
|
1065
|
-
user-select: none;
|
|
1066
|
-
-webkit-user-select: none;
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
.input:hover:not(.input--disabled) .input__control {
|
|
1070
|
-
color: var(--sl-input-color-hover);
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
.input__control:focus {
|
|
1074
|
-
outline: none;
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
.input__prefix,
|
|
1078
|
-
.input__suffix {
|
|
1079
|
-
display: inline-flex;
|
|
1080
|
-
flex: 0 0 auto;
|
|
1081
|
-
align-items: center;
|
|
1082
|
-
cursor: default;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
.input__prefix ::slotted(sl-icon),
|
|
1086
|
-
.input__suffix ::slotted(sl-icon) {
|
|
1087
|
-
color: var(--sl-input-icon-color);
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
/*
|
|
1091
|
-
* Size modifiers
|
|
1092
|
-
*/
|
|
1093
|
-
|
|
1094
|
-
.input--small {
|
|
1095
|
-
border-radius: var(--sl-input-border-radius-small);
|
|
1096
|
-
font-size: var(--sl-input-font-size-small);
|
|
1097
|
-
height: var(--sl-input-height-small);
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
.input--small .input__control {
|
|
1101
|
-
height: calc(var(--sl-input-height-small) - var(--sl-input-border-width) * 2);
|
|
1102
|
-
padding: 0 var(--sl-input-spacing-small);
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
.input--small .input__clear,
|
|
1106
|
-
.input--small .input__password-toggle {
|
|
1107
|
-
width: calc(1em + var(--sl-input-spacing-small) * 2);
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
.input--small .input__prefix ::slotted(*) {
|
|
1111
|
-
margin-inline-start: var(--sl-input-spacing-small);
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
.input--small .input__suffix ::slotted(*) {
|
|
1115
|
-
margin-inline-end: var(--sl-input-spacing-small);
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
.input--medium {
|
|
1119
|
-
border-radius: var(--sl-input-border-radius-medium);
|
|
1120
|
-
font-size: var(--sl-input-font-size-medium);
|
|
1121
|
-
height: var(--sl-input-height-medium);
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
.input--medium .input__control {
|
|
1125
|
-
height: calc(var(--sl-input-height-medium) - var(--sl-input-border-width) * 2);
|
|
1126
|
-
padding: 0 var(--sl-input-spacing-medium);
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
.input--medium .input__clear,
|
|
1130
|
-
.input--medium .input__password-toggle {
|
|
1131
|
-
width: calc(1em + var(--sl-input-spacing-medium) * 2);
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
.input--medium .input__prefix ::slotted(*) {
|
|
1135
|
-
margin-inline-start: var(--sl-input-spacing-medium);
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
.input--medium .input__suffix ::slotted(*) {
|
|
1139
|
-
margin-inline-end: var(--sl-input-spacing-medium);
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
.input--large {
|
|
1143
|
-
border-radius: var(--sl-input-border-radius-large);
|
|
1144
|
-
font-size: var(--sl-input-font-size-large);
|
|
1145
|
-
height: var(--sl-input-height-large);
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
.input--large .input__control {
|
|
1149
|
-
height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);
|
|
1150
|
-
padding: 0 var(--sl-input-spacing-large);
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
.input--large .input__clear,
|
|
1154
|
-
.input--large .input__password-toggle {
|
|
1155
|
-
width: calc(1em + var(--sl-input-spacing-large) * 2);
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
.input--large .input__prefix ::slotted(*) {
|
|
1159
|
-
margin-inline-start: var(--sl-input-spacing-large);
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
.input--large .input__suffix ::slotted(*) {
|
|
1163
|
-
margin-inline-end: var(--sl-input-spacing-large);
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
/*
|
|
1167
|
-
* Pill modifier
|
|
1168
|
-
*/
|
|
1169
|
-
|
|
1170
|
-
.input--pill.input--small {
|
|
1171
|
-
border-radius: var(--sl-input-height-small);
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
.input--pill.input--medium {
|
|
1175
|
-
border-radius: var(--sl-input-height-medium);
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
.input--pill.input--large {
|
|
1179
|
-
border-radius: var(--sl-input-height-large);
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
/*
|
|
1183
|
-
* Clearable + Password Toggle
|
|
1184
|
-
*/
|
|
1185
|
-
|
|
1186
|
-
.input__clear,
|
|
1187
|
-
.input__password-toggle {
|
|
1188
|
-
display: inline-flex;
|
|
1189
|
-
align-items: center;
|
|
1190
|
-
justify-content: center;
|
|
1191
|
-
font-size: inherit;
|
|
1192
|
-
color: var(--sl-input-icon-color);
|
|
1193
|
-
border: none;
|
|
1194
|
-
background: none;
|
|
1195
|
-
padding: 0;
|
|
1196
|
-
transition: var(--sl-transition-fast) color;
|
|
1197
|
-
cursor: pointer;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
.input__clear:hover,
|
|
1201
|
-
.input__password-toggle:hover {
|
|
1202
|
-
color: var(--sl-input-icon-color-hover);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
.input__clear:focus,
|
|
1206
|
-
.input__password-toggle:focus {
|
|
1207
|
-
outline: none;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
/* Don't show the browser's password toggle in Edge */
|
|
1211
|
-
::-ms-reveal {
|
|
1212
|
-
display: none;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
/* Hide the built-in number spinner */
|
|
1216
|
-
.input--no-spin-buttons input[type='number']::-webkit-outer-spin-button,
|
|
1217
|
-
.input--no-spin-buttons input[type='number']::-webkit-inner-spin-button {
|
|
1218
|
-
-webkit-appearance: none;
|
|
1219
|
-
display: none;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
.input--no-spin-buttons input[type='number'] {
|
|
1223
|
-
-moz-appearance: textfield;
|
|
1224
|
-
}
|
|
1225
|
-
`, Qe = (o = "value") => (t, e) => {
|
|
1226
|
-
const r = t.constructor, s = r.prototype.attributeChangedCallback;
|
|
1227
|
-
r.prototype.attributeChangedCallback = function(i, n, d) {
|
|
1228
|
-
var l;
|
|
1229
|
-
const c = r.getPropertyOptions(o), b = typeof c.attribute == "string" ? c.attribute : o;
|
|
1230
|
-
if (i === b) {
|
|
1231
|
-
const p = c.converter || R, y = (typeof p == "function" ? p : (l = p == null ? void 0 : p.fromAttribute) != null ? l : R.fromAttribute)(d, c.type);
|
|
1232
|
-
this[o] !== y && (this[e] = y);
|
|
1233
|
-
}
|
|
1234
|
-
s.call(this, i, n, d);
|
|
1235
|
-
};
|
|
1236
|
-
}, Xe = $`
|
|
1237
|
-
.form-control .form-control__label {
|
|
1238
|
-
display: none;
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
.form-control .form-control__help-text {
|
|
1242
|
-
display: none;
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
/* Label */
|
|
1246
|
-
.form-control--has-label .form-control__label {
|
|
1247
|
-
display: inline-block;
|
|
1248
|
-
color: var(--sl-input-label-color);
|
|
1249
|
-
margin-bottom: var(--sl-spacing-3x-small);
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
.form-control--has-label.form-control--small .form-control__label {
|
|
1253
|
-
font-size: var(--sl-input-label-font-size-small);
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
.form-control--has-label.form-control--medium .form-control__label {
|
|
1257
|
-
font-size: var(--sl-input-label-font-size-medium);
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
.form-control--has-label.form-control--large .form-control__label {
|
|
1261
|
-
font-size: var(--sl-input-label-font-size-large);
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
:host([required]) .form-control--has-label .form-control__label::after {
|
|
1265
|
-
content: var(--sl-input-required-content);
|
|
1266
|
-
margin-inline-start: var(--sl-input-required-content-offset);
|
|
1267
|
-
color: var(--sl-input-required-content-color);
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
/* Help text */
|
|
1271
|
-
.form-control--has-help-text .form-control__help-text {
|
|
1272
|
-
display: block;
|
|
1273
|
-
color: var(--sl-input-help-text-color);
|
|
1274
|
-
margin-top: var(--sl-spacing-3x-small);
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
.form-control--has-help-text.form-control--small .form-control__help-text {
|
|
1278
|
-
font-size: var(--sl-input-help-text-font-size-small);
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
.form-control--has-help-text.form-control--medium .form-control__help-text {
|
|
1282
|
-
font-size: var(--sl-input-help-text-font-size-medium);
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
.form-control--has-help-text.form-control--large .form-control__help-text {
|
|
1286
|
-
font-size: var(--sl-input-help-text-font-size-large);
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
.form-control--has-help-text.form-control--radio-group .form-control__help-text {
|
|
1290
|
-
margin-top: var(--sl-spacing-2x-small);
|
|
1291
|
-
}
|
|
1292
|
-
`, D = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakSet(), et = /* @__PURE__ */ new WeakMap(), ae = class {
|
|
1293
|
-
constructor(o, t) {
|
|
1294
|
-
this.handleFormData = (e) => {
|
|
1295
|
-
const r = this.options.disabled(this.host), s = this.options.name(this.host), i = this.options.value(this.host), n = this.host.tagName.toLowerCase() === "sl-button";
|
|
1296
|
-
this.host.isConnected && !r && !n && typeof s == "string" && s.length > 0 && typeof i < "u" && (Array.isArray(i) ? i.forEach((d) => {
|
|
1297
|
-
e.formData.append(s, d.toString());
|
|
1298
|
-
}) : e.formData.append(s, i.toString()));
|
|
1299
|
-
}, this.handleFormSubmit = (e) => {
|
|
1300
|
-
var r;
|
|
1301
|
-
const s = this.options.disabled(this.host), i = this.options.reportValidity;
|
|
1302
|
-
this.form && !this.form.noValidate && ((r = D.get(this.form)) == null || r.forEach((n) => {
|
|
1303
|
-
this.setUserInteracted(n, !0);
|
|
1304
|
-
})), this.form && !this.form.noValidate && !s && !i(this.host) && (e.preventDefault(), e.stopImmediatePropagation());
|
|
1305
|
-
}, this.handleFormReset = () => {
|
|
1306
|
-
this.options.setValue(this.host, this.options.defaultValue(this.host)), this.setUserInteracted(this.host, !1), et.set(this.host, []);
|
|
1307
|
-
}, this.handleInteraction = (e) => {
|
|
1308
|
-
const r = et.get(this.host);
|
|
1309
|
-
r.includes(e.type) || r.push(e.type), r.length === this.options.assumeInteractionOn.length && this.setUserInteracted(this.host, !0);
|
|
1310
|
-
}, this.checkFormValidity = () => {
|
|
1311
|
-
if (this.form && !this.form.noValidate) {
|
|
1312
|
-
const e = this.form.querySelectorAll("*");
|
|
1313
|
-
for (const r of e)
|
|
1314
|
-
if (typeof r.checkValidity == "function" && !r.checkValidity())
|
|
1315
|
-
return !1;
|
|
1316
|
-
}
|
|
1317
|
-
return !0;
|
|
1318
|
-
}, this.reportFormValidity = () => {
|
|
1319
|
-
if (this.form && !this.form.noValidate) {
|
|
1320
|
-
const e = this.form.querySelectorAll("*");
|
|
1321
|
-
for (const r of e)
|
|
1322
|
-
if (typeof r.reportValidity == "function" && !r.reportValidity())
|
|
1323
|
-
return !1;
|
|
1324
|
-
}
|
|
1325
|
-
return !0;
|
|
1326
|
-
}, (this.host = o).addController(this), this.options = X({
|
|
1327
|
-
form: (e) => {
|
|
1328
|
-
const r = e.form;
|
|
1329
|
-
if (r) {
|
|
1330
|
-
const i = e.getRootNode().querySelector(`#${r}`);
|
|
1331
|
-
if (i)
|
|
1332
|
-
return i;
|
|
1333
|
-
}
|
|
1334
|
-
return e.closest("form");
|
|
1335
|
-
},
|
|
1336
|
-
name: (e) => e.name,
|
|
1337
|
-
value: (e) => e.value,
|
|
1338
|
-
defaultValue: (e) => e.defaultValue,
|
|
1339
|
-
disabled: (e) => {
|
|
1340
|
-
var r;
|
|
1341
|
-
return (r = e.disabled) != null ? r : !1;
|
|
1342
|
-
},
|
|
1343
|
-
reportValidity: (e) => typeof e.reportValidity == "function" ? e.reportValidity() : !0,
|
|
1344
|
-
checkValidity: (e) => typeof e.checkValidity == "function" ? e.checkValidity() : !0,
|
|
1345
|
-
setValue: (e, r) => e.value = r,
|
|
1346
|
-
assumeInteractionOn: ["sl-input"]
|
|
1347
|
-
}, t);
|
|
1348
|
-
}
|
|
1349
|
-
hostConnected() {
|
|
1350
|
-
const o = this.options.form(this.host);
|
|
1351
|
-
o && this.attachForm(o), et.set(this.host, []), this.options.assumeInteractionOn.forEach((t) => {
|
|
1352
|
-
this.host.addEventListener(t, this.handleInteraction);
|
|
1353
|
-
});
|
|
1354
|
-
}
|
|
1355
|
-
hostDisconnected() {
|
|
1356
|
-
this.detachForm(), et.delete(this.host), this.options.assumeInteractionOn.forEach((o) => {
|
|
1357
|
-
this.host.removeEventListener(o, this.handleInteraction);
|
|
1358
|
-
});
|
|
1359
|
-
}
|
|
1360
|
-
hostUpdated() {
|
|
1361
|
-
const o = this.options.form(this.host);
|
|
1362
|
-
o || this.detachForm(), o && this.form !== o && (this.detachForm(), this.attachForm(o)), this.host.hasUpdated && this.setValidity(this.host.validity.valid);
|
|
1363
|
-
}
|
|
1364
|
-
attachForm(o) {
|
|
1365
|
-
o ? (this.form = o, D.has(this.form) ? D.get(this.form).add(this.host) : D.set(this.form, /* @__PURE__ */ new Set([this.host])), this.form.addEventListener("formdata", this.handleFormData), this.form.addEventListener("submit", this.handleFormSubmit), this.form.addEventListener("reset", this.handleFormReset), F.has(this.form) || (F.set(this.form, this.form.reportValidity), this.form.reportValidity = () => this.reportFormValidity()), H.has(this.form) || (H.set(this.form, this.form.checkValidity), this.form.checkValidity = () => this.checkFormValidity())) : this.form = void 0;
|
|
1366
|
-
}
|
|
1367
|
-
detachForm() {
|
|
1368
|
-
if (!this.form)
|
|
1369
|
-
return;
|
|
1370
|
-
const o = D.get(this.form);
|
|
1371
|
-
o && (o.delete(this.host), o.size <= 0 && (this.form.removeEventListener("formdata", this.handleFormData), this.form.removeEventListener("submit", this.handleFormSubmit), this.form.removeEventListener("reset", this.handleFormReset), F.has(this.form) && (this.form.reportValidity = F.get(this.form), F.delete(this.form)), H.has(this.form) && (this.form.checkValidity = H.get(this.form), H.delete(this.form)), this.form = void 0));
|
|
1372
|
-
}
|
|
1373
|
-
setUserInteracted(o, t) {
|
|
1374
|
-
t ? ht.add(o) : ht.delete(o), o.requestUpdate();
|
|
1375
|
-
}
|
|
1376
|
-
doAction(o, t) {
|
|
1377
|
-
if (this.form) {
|
|
1378
|
-
const e = document.createElement("button");
|
|
1379
|
-
e.type = o, e.style.position = "absolute", e.style.width = "0", e.style.height = "0", e.style.clipPath = "inset(50%)", e.style.overflow = "hidden", e.style.whiteSpace = "nowrap", t && (e.name = t.name, e.value = t.value, ["formaction", "formenctype", "formmethod", "formnovalidate", "formtarget"].forEach((r) => {
|
|
1380
|
-
t.hasAttribute(r) && e.setAttribute(r, t.getAttribute(r));
|
|
1381
|
-
})), this.form.append(e), e.click(), e.remove();
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
/** Returns the associated `<form>` element, if one exists. */
|
|
1385
|
-
getForm() {
|
|
1386
|
-
var o;
|
|
1387
|
-
return (o = this.form) != null ? o : null;
|
|
1388
|
-
}
|
|
1389
|
-
/** Resets the form, restoring all the control to their default value */
|
|
1390
|
-
reset(o) {
|
|
1391
|
-
this.doAction("reset", o);
|
|
1392
|
-
}
|
|
1393
|
-
/** Submits the form, triggering validation and form data injection. */
|
|
1394
|
-
submit(o) {
|
|
1395
|
-
this.doAction("submit", o);
|
|
1396
|
-
}
|
|
1397
|
-
/**
|
|
1398
|
-
* Synchronously sets the form control's validity. Call this when you know the future validity but need to update
|
|
1399
|
-
* the host element immediately, i.e. before Lit updates the component in the next update.
|
|
1400
|
-
*/
|
|
1401
|
-
setValidity(o) {
|
|
1402
|
-
const t = this.host, e = !!ht.has(t), r = !!t.required;
|
|
1403
|
-
t.toggleAttribute("data-required", r), t.toggleAttribute("data-optional", !r), t.toggleAttribute("data-invalid", !o), t.toggleAttribute("data-valid", o), t.toggleAttribute("data-user-invalid", !o && e), t.toggleAttribute("data-user-valid", o && e);
|
|
1404
|
-
}
|
|
1405
|
-
/**
|
|
1406
|
-
* Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything
|
|
1407
|
-
* that affects constraint validation changes so the component receives the correct validity states.
|
|
1408
|
-
*/
|
|
1409
|
-
updateValidity() {
|
|
1410
|
-
const o = this.host;
|
|
1411
|
-
this.setValidity(o.validity.valid);
|
|
1412
|
-
}
|
|
1413
|
-
/**
|
|
1414
|
-
* Dispatches a non-bubbling, cancelable custom event of type `sl-invalid`.
|
|
1415
|
-
* If the `sl-invalid` event will be cancelled then the original `invalid`
|
|
1416
|
-
* event (which may have been passed as argument) will also be cancelled.
|
|
1417
|
-
* If no original `invalid` event has been passed then the `sl-invalid`
|
|
1418
|
-
* event will be cancelled before being dispatched.
|
|
1419
|
-
*/
|
|
1420
|
-
emitInvalidEvent(o) {
|
|
1421
|
-
const t = new CustomEvent("sl-invalid", {
|
|
1422
|
-
bubbles: !1,
|
|
1423
|
-
composed: !1,
|
|
1424
|
-
cancelable: !0,
|
|
1425
|
-
detail: {}
|
|
1426
|
-
});
|
|
1427
|
-
o || t.preventDefault(), this.host.dispatchEvent(t) || o == null || o.preventDefault();
|
|
1428
|
-
}
|
|
1429
|
-
}, Et = Object.freeze({
|
|
1430
|
-
badInput: !1,
|
|
1431
|
-
customError: !1,
|
|
1432
|
-
patternMismatch: !1,
|
|
1433
|
-
rangeOverflow: !1,
|
|
1434
|
-
rangeUnderflow: !1,
|
|
1435
|
-
stepMismatch: !1,
|
|
1436
|
-
tooLong: !1,
|
|
1437
|
-
tooShort: !1,
|
|
1438
|
-
typeMismatch: !1,
|
|
1439
|
-
valid: !0,
|
|
1440
|
-
valueMissing: !1
|
|
1441
|
-
});
|
|
1442
|
-
Object.freeze(oe(X({}, Et), {
|
|
1443
|
-
valid: !1,
|
|
1444
|
-
valueMissing: !0
|
|
1445
|
-
}));
|
|
1446
|
-
Object.freeze(oe(X({}, Et), {
|
|
1447
|
-
valid: !1,
|
|
1448
|
-
customError: !0
|
|
1449
|
-
}));
|
|
1450
|
-
const gt = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Map();
|
|
1451
|
-
let z, Pt = "ltr", Tt = "en";
|
|
1452
|
-
const le = typeof MutationObserver < "u" && typeof document < "u" && typeof document.documentElement < "u";
|
|
1453
|
-
if (le) {
|
|
1454
|
-
const o = new MutationObserver(de);
|
|
1455
|
-
Pt = document.documentElement.dir || "ltr", Tt = document.documentElement.lang || navigator.language, o.observe(document.documentElement, {
|
|
1456
|
-
attributes: !0,
|
|
1457
|
-
attributeFilter: ["dir", "lang"]
|
|
1458
|
-
});
|
|
1459
|
-
}
|
|
1460
|
-
function ue(...o) {
|
|
1461
|
-
o.map((t) => {
|
|
1462
|
-
const e = t.$code.toLowerCase();
|
|
1463
|
-
V.has(e) ? V.set(e, Object.assign(Object.assign({}, V.get(e)), t)) : V.set(e, t), z || (z = t);
|
|
1464
|
-
}), de();
|
|
1465
|
-
}
|
|
1466
|
-
function de() {
|
|
1467
|
-
le && (Pt = document.documentElement.dir || "ltr", Tt = document.documentElement.lang || navigator.language), [...gt.keys()].map((o) => {
|
|
1468
|
-
typeof o.requestUpdate == "function" && o.requestUpdate();
|
|
1469
|
-
});
|
|
1470
|
-
}
|
|
1471
|
-
let to = class {
|
|
1472
|
-
constructor(t) {
|
|
1473
|
-
this.host = t, this.host.addController(this);
|
|
1474
|
-
}
|
|
1475
|
-
hostConnected() {
|
|
1476
|
-
gt.add(this.host);
|
|
1477
|
-
}
|
|
1478
|
-
hostDisconnected() {
|
|
1479
|
-
gt.delete(this.host);
|
|
1480
|
-
}
|
|
1481
|
-
dir() {
|
|
1482
|
-
return `${this.host.dir || Pt}`.toLowerCase();
|
|
1483
|
-
}
|
|
1484
|
-
lang() {
|
|
1485
|
-
return `${this.host.lang || Tt}`.toLowerCase();
|
|
1486
|
-
}
|
|
1487
|
-
getTranslationData(t) {
|
|
1488
|
-
var e, r;
|
|
1489
|
-
const s = new Intl.Locale(t.replace(/_/g, "-")), i = s == null ? void 0 : s.language.toLowerCase(), n = (r = (e = s == null ? void 0 : s.region) === null || e === void 0 ? void 0 : e.toLowerCase()) !== null && r !== void 0 ? r : "", d = V.get(`${i}-${n}`), l = V.get(i);
|
|
1490
|
-
return { locale: s, language: i, region: n, primary: d, secondary: l };
|
|
1491
|
-
}
|
|
1492
|
-
exists(t, e) {
|
|
1493
|
-
var r;
|
|
1494
|
-
const { primary: s, secondary: i } = this.getTranslationData((r = e.lang) !== null && r !== void 0 ? r : this.lang());
|
|
1495
|
-
return e = Object.assign({ includeFallback: !1 }, e), !!(s && s[t] || i && i[t] || e.includeFallback && z && z[t]);
|
|
1496
|
-
}
|
|
1497
|
-
term(t, ...e) {
|
|
1498
|
-
const { primary: r, secondary: s } = this.getTranslationData(this.lang());
|
|
1499
|
-
let i;
|
|
1500
|
-
if (r && r[t])
|
|
1501
|
-
i = r[t];
|
|
1502
|
-
else if (s && s[t])
|
|
1503
|
-
i = s[t];
|
|
1504
|
-
else if (z && z[t])
|
|
1505
|
-
i = z[t];
|
|
1506
|
-
else
|
|
1507
|
-
return console.error(`No translation found for: ${String(t)}`), String(t);
|
|
1508
|
-
return typeof i == "function" ? i(...e) : i;
|
|
1509
|
-
}
|
|
1510
|
-
date(t, e) {
|
|
1511
|
-
return t = new Date(t), new Intl.DateTimeFormat(this.lang(), e).format(t);
|
|
1512
|
-
}
|
|
1513
|
-
number(t, e) {
|
|
1514
|
-
return t = Number(t), isNaN(t) ? "" : new Intl.NumberFormat(this.lang(), e).format(t);
|
|
1515
|
-
}
|
|
1516
|
-
relativeTime(t, e, r) {
|
|
1517
|
-
return new Intl.RelativeTimeFormat(this.lang(), r).format(t, e);
|
|
1518
|
-
}
|
|
1519
|
-
};
|
|
1520
|
-
var ce = {
|
|
1521
|
-
$code: "en",
|
|
1522
|
-
$name: "English",
|
|
1523
|
-
$dir: "ltr",
|
|
1524
|
-
carousel: "Carousel",
|
|
1525
|
-
clearEntry: "Clear entry",
|
|
1526
|
-
close: "Close",
|
|
1527
|
-
copied: "Copied",
|
|
1528
|
-
copy: "Copy",
|
|
1529
|
-
currentValue: "Current value",
|
|
1530
|
-
error: "Error",
|
|
1531
|
-
goToSlide: (o, t) => `Go to slide ${o} of ${t}`,
|
|
1532
|
-
hidePassword: "Hide password",
|
|
1533
|
-
loading: "Loading",
|
|
1534
|
-
nextSlide: "Next slide",
|
|
1535
|
-
numOptionsSelected: (o) => o === 0 ? "No options selected" : o === 1 ? "1 option selected" : `${o} options selected`,
|
|
1536
|
-
previousSlide: "Previous slide",
|
|
1537
|
-
progress: "Progress",
|
|
1538
|
-
remove: "Remove",
|
|
1539
|
-
resize: "Resize",
|
|
1540
|
-
scrollToEnd: "Scroll to end",
|
|
1541
|
-
scrollToStart: "Scroll to start",
|
|
1542
|
-
selectAColorFromTheScreen: "Select a color from the screen",
|
|
1543
|
-
showPassword: "Show password",
|
|
1544
|
-
slideNum: (o) => `Slide ${o}`,
|
|
1545
|
-
toggleColorFormat: "Toggle color format"
|
|
1546
|
-
};
|
|
1547
|
-
ue(ce);
|
|
1548
|
-
var eo = ce, zt = class extends to {
|
|
1549
|
-
};
|
|
1550
|
-
ue(eo);
|
|
1551
|
-
var vt = "";
|
|
1552
|
-
function jt(o) {
|
|
1553
|
-
vt = o;
|
|
1554
|
-
}
|
|
1555
|
-
function oo(o = "") {
|
|
1556
|
-
if (!vt) {
|
|
1557
|
-
const t = [...document.getElementsByTagName("script")], e = t.find((r) => r.hasAttribute("data-shoelace"));
|
|
1558
|
-
if (e)
|
|
1559
|
-
jt(e.getAttribute("data-shoelace"));
|
|
1560
|
-
else {
|
|
1561
|
-
const r = t.find((i) => /shoelace(\.min)?\.js($|\?)/.test(i.src) || /shoelace-autoloader(\.min)?\.js($|\?)/.test(i.src));
|
|
1562
|
-
let s = "";
|
|
1563
|
-
r && (s = r.getAttribute("src")), jt(s.split("/").slice(0, -1).join("/"));
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
return vt.replace(/\/$/, "") + (o ? `/${o.replace(/^\//, "")}` : "");
|
|
1567
|
-
}
|
|
1568
|
-
var ro = {
|
|
1569
|
-
name: "default",
|
|
1570
|
-
resolver: (o) => oo(`assets/icons/${o}.svg`)
|
|
1571
|
-
}, so = ro, qt = {
|
|
1572
|
-
caret: `
|
|
1573
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1574
|
-
<polyline points="6 9 12 15 18 9"></polyline>
|
|
1575
|
-
</svg>
|
|
1576
|
-
`,
|
|
1577
|
-
check: `
|
|
1578
|
-
<svg part="checked-icon" class="checkbox__icon" viewBox="0 0 16 16">
|
|
1579
|
-
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
|
|
1580
|
-
<g stroke="currentColor">
|
|
1581
|
-
<g transform="translate(3.428571, 3.428571)">
|
|
1582
|
-
<path d="M0,5.71428571 L3.42857143,9.14285714"></path>
|
|
1583
|
-
<path d="M9.14285714,0 L3.42857143,9.14285714"></path>
|
|
1584
|
-
</g>
|
|
1585
|
-
</g>
|
|
1586
|
-
</g>
|
|
1587
|
-
</svg>
|
|
1588
|
-
`,
|
|
1589
|
-
"chevron-down": `
|
|
1590
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16">
|
|
1591
|
-
<path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/>
|
|
1592
|
-
</svg>
|
|
1593
|
-
`,
|
|
1594
|
-
"chevron-left": `
|
|
1595
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-left" viewBox="0 0 16 16">
|
|
1596
|
-
<path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/>
|
|
1597
|
-
</svg>
|
|
1598
|
-
`,
|
|
1599
|
-
"chevron-right": `
|
|
1600
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16">
|
|
1601
|
-
<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
|
|
1602
|
-
</svg>
|
|
1603
|
-
`,
|
|
1604
|
-
copy: `
|
|
1605
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-copy" viewBox="0 0 16 16">
|
|
1606
|
-
<path fill-rule="evenodd" d="M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V2Zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H6ZM2 5a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1H2Z"/>
|
|
1607
|
-
</svg>
|
|
1608
|
-
`,
|
|
1609
|
-
eye: `
|
|
1610
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
|
|
1611
|
-
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
|
|
1612
|
-
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
|
|
1613
|
-
</svg>
|
|
1614
|
-
`,
|
|
1615
|
-
"eye-slash": `
|
|
1616
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye-slash" viewBox="0 0 16 16">
|
|
1617
|
-
<path d="M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7.028 7.028 0 0 0-2.79.588l.77.771A5.944 5.944 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.134 13.134 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-.517.486l.708.709z"/>
|
|
1618
|
-
<path d="M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829l.822.822zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829z"/>
|
|
1619
|
-
<path d="M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7.029 7.029 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709zm10.296 8.884-12-12 .708-.708 12 12-.708.708z"/>
|
|
1620
|
-
</svg>
|
|
1621
|
-
`,
|
|
1622
|
-
eyedropper: `
|
|
1623
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eyedropper" viewBox="0 0 16 16">
|
|
1624
|
-
<path d="M13.354.646a1.207 1.207 0 0 0-1.708 0L8.5 3.793l-.646-.647a.5.5 0 1 0-.708.708L8.293 5l-7.147 7.146A.5.5 0 0 0 1 12.5v1.793l-.854.853a.5.5 0 1 0 .708.707L1.707 15H3.5a.5.5 0 0 0 .354-.146L11 7.707l1.146 1.147a.5.5 0 0 0 .708-.708l-.647-.646 3.147-3.146a1.207 1.207 0 0 0 0-1.708l-2-2zM2 12.707l7-7L10.293 7l-7 7H2v-1.293z"></path>
|
|
1625
|
-
</svg>
|
|
1626
|
-
`,
|
|
1627
|
-
"grip-vertical": `
|
|
1628
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-grip-vertical" viewBox="0 0 16 16">
|
|
1629
|
-
<path d="M7 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM7 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM7 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"></path>
|
|
1630
|
-
</svg>
|
|
1631
|
-
`,
|
|
1632
|
-
indeterminate: `
|
|
1633
|
-
<svg part="indeterminate-icon" class="checkbox__icon" viewBox="0 0 16 16">
|
|
1634
|
-
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
|
|
1635
|
-
<g stroke="currentColor" stroke-width="2">
|
|
1636
|
-
<g transform="translate(2.285714, 6.857143)">
|
|
1637
|
-
<path d="M10.2857143,1.14285714 L1.14285714,1.14285714"></path>
|
|
1638
|
-
</g>
|
|
1639
|
-
</g>
|
|
1640
|
-
</g>
|
|
1641
|
-
</svg>
|
|
1642
|
-
`,
|
|
1643
|
-
"person-fill": `
|
|
1644
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16">
|
|
1645
|
-
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
|
|
1646
|
-
</svg>
|
|
1647
|
-
`,
|
|
1648
|
-
"play-fill": `
|
|
1649
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-play-fill" viewBox="0 0 16 16">
|
|
1650
|
-
<path d="m11.596 8.697-6.363 3.692c-.54.313-1.233-.066-1.233-.697V4.308c0-.63.692-1.01 1.233-.696l6.363 3.692a.802.802 0 0 1 0 1.393z"></path>
|
|
1651
|
-
</svg>
|
|
1652
|
-
`,
|
|
1653
|
-
"pause-fill": `
|
|
1654
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pause-fill" viewBox="0 0 16 16">
|
|
1655
|
-
<path d="M5.5 3.5A1.5 1.5 0 0 1 7 5v6a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 1.5-1.5zm5 0A1.5 1.5 0 0 1 12 5v6a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 1.5-1.5z"></path>
|
|
1656
|
-
</svg>
|
|
1657
|
-
`,
|
|
1658
|
-
radio: `
|
|
1659
|
-
<svg part="checked-icon" class="radio__icon" viewBox="0 0 16 16">
|
|
1660
|
-
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
1661
|
-
<g fill="currentColor">
|
|
1662
|
-
<circle cx="8" cy="8" r="3.42857143"></circle>
|
|
1663
|
-
</g>
|
|
1664
|
-
</g>
|
|
1665
|
-
</svg>
|
|
1666
|
-
`,
|
|
1667
|
-
"star-fill": `
|
|
1668
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star-fill" viewBox="0 0 16 16">
|
|
1669
|
-
<path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/>
|
|
1670
|
-
</svg>
|
|
1671
|
-
`,
|
|
1672
|
-
"x-lg": `
|
|
1673
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">
|
|
1674
|
-
<path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"/>
|
|
1675
|
-
</svg>
|
|
1676
|
-
`,
|
|
1677
|
-
"x-circle-fill": `
|
|
1678
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle-fill" viewBox="0 0 16 16">
|
|
1679
|
-
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z"></path>
|
|
1680
|
-
</svg>
|
|
1681
|
-
`
|
|
1682
|
-
}, io = {
|
|
1683
|
-
name: "system",
|
|
1684
|
-
resolver: (o) => o in qt ? `data:image/svg+xml,${encodeURIComponent(qt[o])}` : ""
|
|
1685
|
-
}, no = io, ao = [so, no], yt = [];
|
|
1686
|
-
function lo(o) {
|
|
1687
|
-
yt.push(o);
|
|
1688
|
-
}
|
|
1689
|
-
function uo(o) {
|
|
1690
|
-
yt = yt.filter((t) => t !== o);
|
|
1691
|
-
}
|
|
1692
|
-
function Wt(o) {
|
|
1693
|
-
return ao.find((t) => t.name === o);
|
|
1694
|
-
}
|
|
1695
|
-
var co = $`
|
|
1696
|
-
:host {
|
|
1697
|
-
display: inline-block;
|
|
1698
|
-
width: 1em;
|
|
1699
|
-
height: 1em;
|
|
1700
|
-
box-sizing: content-box !important;
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
svg {
|
|
1704
|
-
display: block;
|
|
1705
|
-
height: 100%;
|
|
1706
|
-
width: 100%;
|
|
1707
|
-
}
|
|
1708
|
-
`;
|
|
1709
|
-
function M(o, t) {
|
|
1710
|
-
const e = X({
|
|
1711
|
-
waitUntilFirstUpdate: !1
|
|
1712
|
-
}, t);
|
|
1713
|
-
return (r, s) => {
|
|
1714
|
-
const { update: i } = r, n = Array.isArray(o) ? o : [o];
|
|
1715
|
-
r.update = function(d) {
|
|
1716
|
-
n.forEach((l) => {
|
|
1717
|
-
const c = l;
|
|
1718
|
-
if (d.has(c)) {
|
|
1719
|
-
const b = d.get(c), p = this[c];
|
|
1720
|
-
b !== p && (!e.waitUntilFirstUpdate || this.hasUpdated) && this[s](b, p);
|
|
1721
|
-
}
|
|
1722
|
-
}), i.call(this, d);
|
|
1723
|
-
};
|
|
1724
|
-
};
|
|
1725
|
-
}
|
|
1726
|
-
/**
|
|
1727
|
-
* @license
|
|
1728
|
-
* Copyright 2020 Google LLC
|
|
1729
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1730
|
-
*/
|
|
1731
|
-
const ho = (o, t) => (o == null ? void 0 : o._$litType$) !== void 0, po = (o) => o.strings === void 0, bo = {}, fo = (o, t = bo) => o._$AH = t;
|
|
1732
|
-
var j = Symbol(), ot = Symbol(), pt, bt = /* @__PURE__ */ new Map(), x = class extends k {
|
|
1733
|
-
constructor() {
|
|
1734
|
-
super(...arguments), this.initialRender = !1, this.svg = null, this.label = "", this.library = "default";
|
|
1735
|
-
}
|
|
1736
|
-
/** Given a URL, this function returns the resulting SVG element or an appropriate error symbol. */
|
|
1737
|
-
async resolveIcon(o, t) {
|
|
1738
|
-
var e;
|
|
1739
|
-
let r;
|
|
1740
|
-
if (t != null && t.spriteSheet) {
|
|
1741
|
-
this.svg = v`<svg part="svg">
|
|
1742
|
-
<use part="use" href="${o}"></use>
|
|
1743
|
-
</svg>`, await this.updateComplete;
|
|
1744
|
-
const s = this.shadowRoot.querySelector("[part='svg']");
|
|
1745
|
-
return typeof t.mutator == "function" && t.mutator(s), this.svg;
|
|
1746
|
-
}
|
|
1747
|
-
try {
|
|
1748
|
-
if (r = await fetch(o, { mode: "cors" }), !r.ok)
|
|
1749
|
-
return r.status === 410 ? j : ot;
|
|
1750
|
-
} catch {
|
|
1751
|
-
return ot;
|
|
1752
|
-
}
|
|
1753
|
-
try {
|
|
1754
|
-
const s = document.createElement("div");
|
|
1755
|
-
s.innerHTML = await r.text();
|
|
1756
|
-
const i = s.firstElementChild;
|
|
1757
|
-
if (((e = i == null ? void 0 : i.tagName) == null ? void 0 : e.toLowerCase()) !== "svg")
|
|
1758
|
-
return j;
|
|
1759
|
-
pt || (pt = new DOMParser());
|
|
1760
|
-
const d = pt.parseFromString(i.outerHTML, "text/html").body.querySelector("svg");
|
|
1761
|
-
return d ? (d.part.add("svg"), document.adoptNode(d)) : j;
|
|
1762
|
-
} catch {
|
|
1763
|
-
return j;
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
connectedCallback() {
|
|
1767
|
-
super.connectedCallback(), lo(this);
|
|
1768
|
-
}
|
|
1769
|
-
firstUpdated() {
|
|
1770
|
-
this.initialRender = !0, this.setIcon();
|
|
1771
|
-
}
|
|
1772
|
-
disconnectedCallback() {
|
|
1773
|
-
super.disconnectedCallback(), uo(this);
|
|
1774
|
-
}
|
|
1775
|
-
getIconSource() {
|
|
1776
|
-
const o = Wt(this.library);
|
|
1777
|
-
return this.name && o ? {
|
|
1778
|
-
url: o.resolver(this.name),
|
|
1779
|
-
fromLibrary: !0
|
|
1780
|
-
} : {
|
|
1781
|
-
url: this.src,
|
|
1782
|
-
fromLibrary: !1
|
|
1783
|
-
};
|
|
1784
|
-
}
|
|
1785
|
-
handleLabelChange() {
|
|
1786
|
-
typeof this.label == "string" && this.label.length > 0 ? (this.setAttribute("role", "img"), this.setAttribute("aria-label", this.label), this.removeAttribute("aria-hidden")) : (this.removeAttribute("role"), this.removeAttribute("aria-label"), this.setAttribute("aria-hidden", "true"));
|
|
1787
|
-
}
|
|
1788
|
-
async setIcon() {
|
|
1789
|
-
var o;
|
|
1790
|
-
const { url: t, fromLibrary: e } = this.getIconSource(), r = e ? Wt(this.library) : void 0;
|
|
1791
|
-
if (!t) {
|
|
1792
|
-
this.svg = null;
|
|
1793
|
-
return;
|
|
1794
|
-
}
|
|
1795
|
-
let s = bt.get(t);
|
|
1796
|
-
if (s || (s = this.resolveIcon(t, r), bt.set(t, s)), !this.initialRender)
|
|
1797
|
-
return;
|
|
1798
|
-
const i = await s;
|
|
1799
|
-
if (i === ot && bt.delete(t), t === this.getIconSource().url) {
|
|
1800
|
-
if (ho(i)) {
|
|
1801
|
-
this.svg = i;
|
|
1802
|
-
return;
|
|
1803
|
-
}
|
|
1804
|
-
switch (i) {
|
|
1805
|
-
case ot:
|
|
1806
|
-
case j:
|
|
1807
|
-
this.svg = null, this.emit("sl-error");
|
|
1808
|
-
break;
|
|
1809
|
-
default:
|
|
1810
|
-
this.svg = i.cloneNode(!0), (o = r == null ? void 0 : r.mutator) == null || o.call(r, this.svg), this.emit("sl-load");
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
}
|
|
1814
|
-
render() {
|
|
1815
|
-
return this.svg;
|
|
1816
|
-
}
|
|
1817
|
-
};
|
|
1818
|
-
x.styles = [Q, co];
|
|
1819
|
-
a([
|
|
1820
|
-
at()
|
|
1821
|
-
], x.prototype, "svg", 2);
|
|
1822
|
-
a([
|
|
1823
|
-
u({ reflect: !0 })
|
|
1824
|
-
], x.prototype, "name", 2);
|
|
1825
|
-
a([
|
|
1826
|
-
u()
|
|
1827
|
-
], x.prototype, "src", 2);
|
|
1828
|
-
a([
|
|
1829
|
-
u()
|
|
1830
|
-
], x.prototype, "label", 2);
|
|
1831
|
-
a([
|
|
1832
|
-
u({ reflect: !0 })
|
|
1833
|
-
], x.prototype, "library", 2);
|
|
1834
|
-
a([
|
|
1835
|
-
M("label")
|
|
1836
|
-
], x.prototype, "handleLabelChange", 1);
|
|
1837
|
-
a([
|
|
1838
|
-
M(["name", "src", "library"])
|
|
1839
|
-
], x.prototype, "setIcon", 1);
|
|
1840
|
-
/**
|
|
1841
|
-
* @license
|
|
1842
|
-
* Copyright 2018 Google LLC
|
|
1843
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1844
|
-
*/
|
|
1845
|
-
const m = (o) => o ?? g;
|
|
1846
|
-
/**
|
|
1847
|
-
* @license
|
|
1848
|
-
* Copyright 2020 Google LLC
|
|
1849
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1850
|
-
*/
|
|
1851
|
-
const mo = se(class extends ie {
|
|
1852
|
-
constructor(o) {
|
|
1853
|
-
if (super(o), o.type !== T.PROPERTY && o.type !== T.ATTRIBUTE && o.type !== T.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
|
|
1854
|
-
if (!po(o)) throw Error("`live` bindings can only contain a single expression");
|
|
1855
|
-
}
|
|
1856
|
-
render(o) {
|
|
1857
|
-
return o;
|
|
1858
|
-
}
|
|
1859
|
-
update(o, [t]) {
|
|
1860
|
-
if (t === w || t === g) return t;
|
|
1861
|
-
const e = o.element, r = o.name;
|
|
1862
|
-
if (o.type === T.PROPERTY) {
|
|
1863
|
-
if (t === e[r]) return w;
|
|
1864
|
-
} else if (o.type === T.BOOLEAN_ATTRIBUTE) {
|
|
1865
|
-
if (!!t === e.hasAttribute(r)) return w;
|
|
1866
|
-
} else if (o.type === T.ATTRIBUTE && e.getAttribute(r) === t + "") return w;
|
|
1867
|
-
return fo(o), t;
|
|
1868
|
-
}
|
|
1869
|
-
});
|
|
1870
|
-
var h = class extends k {
|
|
1871
|
-
constructor() {
|
|
1872
|
-
super(...arguments), this.formControlController = new ae(this, {
|
|
1873
|
-
assumeInteractionOn: ["sl-blur", "sl-input"]
|
|
1874
|
-
}), this.hasSlotController = new St(this, "help-text", "label"), this.localize = new zt(this), this.hasFocus = !1, this.title = "", this.__numberInput = Object.assign(document.createElement("input"), { type: "number" }), this.__dateInput = Object.assign(document.createElement("input"), { type: "date" }), this.type = "text", this.name = "", this.value = "", this.defaultValue = "", this.size = "medium", this.filled = !1, this.pill = !1, this.label = "", this.helpText = "", this.clearable = !1, this.disabled = !1, this.placeholder = "", this.readonly = !1, this.passwordToggle = !1, this.passwordVisible = !1, this.noSpinButtons = !1, this.form = "", this.required = !1, this.spellcheck = !0;
|
|
1875
|
-
}
|
|
1876
|
-
//
|
|
1877
|
-
// NOTE: We use an in-memory input for these getters/setters instead of the one in the template because the properties
|
|
1878
|
-
// can be set before the component is rendered.
|
|
1879
|
-
//
|
|
1880
|
-
/**
|
|
1881
|
-
* Gets or sets the current value as a `Date` object. Returns `null` if the value can't be converted. This will use the native `<input type="{{type}}">` implementation and may result in an error.
|
|
1882
|
-
*/
|
|
1883
|
-
get valueAsDate() {
|
|
1884
|
-
var o;
|
|
1885
|
-
return this.__dateInput.type = this.type, this.__dateInput.value = this.value, ((o = this.input) == null ? void 0 : o.valueAsDate) || this.__dateInput.valueAsDate;
|
|
1886
|
-
}
|
|
1887
|
-
set valueAsDate(o) {
|
|
1888
|
-
this.__dateInput.type = this.type, this.__dateInput.valueAsDate = o, this.value = this.__dateInput.value;
|
|
1889
|
-
}
|
|
1890
|
-
/** Gets or sets the current value as a number. Returns `NaN` if the value can't be converted. */
|
|
1891
|
-
get valueAsNumber() {
|
|
1892
|
-
var o;
|
|
1893
|
-
return this.__numberInput.value = this.value, ((o = this.input) == null ? void 0 : o.valueAsNumber) || this.__numberInput.valueAsNumber;
|
|
1894
|
-
}
|
|
1895
|
-
set valueAsNumber(o) {
|
|
1896
|
-
this.__numberInput.valueAsNumber = o, this.value = this.__numberInput.value;
|
|
1897
|
-
}
|
|
1898
|
-
/** Gets the validity state object */
|
|
1899
|
-
get validity() {
|
|
1900
|
-
return this.input.validity;
|
|
1901
|
-
}
|
|
1902
|
-
/** Gets the validation message */
|
|
1903
|
-
get validationMessage() {
|
|
1904
|
-
return this.input.validationMessage;
|
|
1905
|
-
}
|
|
1906
|
-
firstUpdated() {
|
|
1907
|
-
this.formControlController.updateValidity();
|
|
1908
|
-
}
|
|
1909
|
-
handleBlur() {
|
|
1910
|
-
this.hasFocus = !1, this.emit("sl-blur");
|
|
1911
|
-
}
|
|
1912
|
-
handleChange() {
|
|
1913
|
-
this.value = this.input.value, this.emit("sl-change");
|
|
1914
|
-
}
|
|
1915
|
-
handleClearClick(o) {
|
|
1916
|
-
o.preventDefault(), this.value !== "" && (this.value = "", this.emit("sl-clear"), this.emit("sl-input"), this.emit("sl-change")), this.input.focus();
|
|
1917
|
-
}
|
|
1918
|
-
handleFocus() {
|
|
1919
|
-
this.hasFocus = !0, this.emit("sl-focus");
|
|
1920
|
-
}
|
|
1921
|
-
handleInput() {
|
|
1922
|
-
this.value = this.input.value, this.formControlController.updateValidity(), this.emit("sl-input");
|
|
1923
|
-
}
|
|
1924
|
-
handleInvalid(o) {
|
|
1925
|
-
this.formControlController.setValidity(!1), this.formControlController.emitInvalidEvent(o);
|
|
1926
|
-
}
|
|
1927
|
-
handleKeyDown(o) {
|
|
1928
|
-
const t = o.metaKey || o.ctrlKey || o.shiftKey || o.altKey;
|
|
1929
|
-
o.key === "Enter" && !t && setTimeout(() => {
|
|
1930
|
-
!o.defaultPrevented && !o.isComposing && this.formControlController.submit();
|
|
1931
|
-
});
|
|
1932
|
-
}
|
|
1933
|
-
handlePasswordToggle() {
|
|
1934
|
-
this.passwordVisible = !this.passwordVisible;
|
|
1935
|
-
}
|
|
1936
|
-
handleDisabledChange() {
|
|
1937
|
-
this.formControlController.setValidity(this.disabled);
|
|
1938
|
-
}
|
|
1939
|
-
handleStepChange() {
|
|
1940
|
-
this.input.step = String(this.step), this.formControlController.updateValidity();
|
|
1941
|
-
}
|
|
1942
|
-
async handleValueChange() {
|
|
1943
|
-
await this.updateComplete, this.formControlController.updateValidity();
|
|
1944
|
-
}
|
|
1945
|
-
/** Sets focus on the input. */
|
|
1946
|
-
focus(o) {
|
|
1947
|
-
this.input.focus(o);
|
|
1948
|
-
}
|
|
1949
|
-
/** Removes focus from the input. */
|
|
1950
|
-
blur() {
|
|
1951
|
-
this.input.blur();
|
|
1952
|
-
}
|
|
1953
|
-
/** Selects all the text in the input. */
|
|
1954
|
-
select() {
|
|
1955
|
-
this.input.select();
|
|
1956
|
-
}
|
|
1957
|
-
/** Sets the start and end positions of the text selection (0-based). */
|
|
1958
|
-
setSelectionRange(o, t, e = "none") {
|
|
1959
|
-
this.input.setSelectionRange(o, t, e);
|
|
1960
|
-
}
|
|
1961
|
-
/** Replaces a range of text with a new string. */
|
|
1962
|
-
setRangeText(o, t, e, r = "preserve") {
|
|
1963
|
-
const s = t ?? this.input.selectionStart, i = e ?? this.input.selectionEnd;
|
|
1964
|
-
this.input.setRangeText(o, s, i, r), this.value !== this.input.value && (this.value = this.input.value);
|
|
1965
|
-
}
|
|
1966
|
-
/** Displays the browser picker for an input element (only works if the browser supports it for the input type). */
|
|
1967
|
-
showPicker() {
|
|
1968
|
-
"showPicker" in HTMLInputElement.prototype && this.input.showPicker();
|
|
1969
|
-
}
|
|
1970
|
-
/** Increments the value of a numeric input type by the value of the step attribute. */
|
|
1971
|
-
stepUp() {
|
|
1972
|
-
this.input.stepUp(), this.value !== this.input.value && (this.value = this.input.value);
|
|
1973
|
-
}
|
|
1974
|
-
/** Decrements the value of a numeric input type by the value of the step attribute. */
|
|
1975
|
-
stepDown() {
|
|
1976
|
-
this.input.stepDown(), this.value !== this.input.value && (this.value = this.input.value);
|
|
1977
|
-
}
|
|
1978
|
-
/** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
1979
|
-
checkValidity() {
|
|
1980
|
-
return this.input.checkValidity();
|
|
1981
|
-
}
|
|
1982
|
-
/** Gets the associated form, if one exists. */
|
|
1983
|
-
getForm() {
|
|
1984
|
-
return this.formControlController.getForm();
|
|
1985
|
-
}
|
|
1986
|
-
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
1987
|
-
reportValidity() {
|
|
1988
|
-
return this.input.reportValidity();
|
|
1989
|
-
}
|
|
1990
|
-
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
1991
|
-
setCustomValidity(o) {
|
|
1992
|
-
this.input.setCustomValidity(o), this.formControlController.updateValidity();
|
|
1993
|
-
}
|
|
1994
|
-
render() {
|
|
1995
|
-
const o = this.hasSlotController.test("label"), t = this.hasSlotController.test("help-text"), e = this.label ? !0 : !!o, r = this.helpText ? !0 : !!t, i = this.clearable && !this.disabled && !this.readonly && (typeof this.value == "number" || this.value.length > 0);
|
|
1996
|
-
return v`
|
|
1997
|
-
<div
|
|
1998
|
-
part="form-control"
|
|
1999
|
-
class=${it({
|
|
2000
|
-
"form-control": !0,
|
|
2001
|
-
"form-control--small": this.size === "small",
|
|
2002
|
-
"form-control--medium": this.size === "medium",
|
|
2003
|
-
"form-control--large": this.size === "large",
|
|
2004
|
-
"form-control--has-label": e,
|
|
2005
|
-
"form-control--has-help-text": r
|
|
2006
|
-
})}
|
|
2007
|
-
>
|
|
2008
|
-
<label
|
|
2009
|
-
part="form-control-label"
|
|
2010
|
-
class="form-control__label"
|
|
2011
|
-
for="input"
|
|
2012
|
-
aria-hidden=${e ? "false" : "true"}
|
|
2013
|
-
>
|
|
2014
|
-
<slot name="label">${this.label}</slot>
|
|
2015
|
-
</label>
|
|
2016
|
-
|
|
2017
|
-
<div part="form-control-input" class="form-control-input">
|
|
2018
|
-
<div
|
|
2019
|
-
part="base"
|
|
2020
|
-
class=${it({
|
|
2021
|
-
input: !0,
|
|
2022
|
-
// Sizes
|
|
2023
|
-
"input--small": this.size === "small",
|
|
2024
|
-
"input--medium": this.size === "medium",
|
|
2025
|
-
"input--large": this.size === "large",
|
|
2026
|
-
// States
|
|
2027
|
-
"input--pill": this.pill,
|
|
2028
|
-
"input--standard": !this.filled,
|
|
2029
|
-
"input--filled": this.filled,
|
|
2030
|
-
"input--disabled": this.disabled,
|
|
2031
|
-
"input--focused": this.hasFocus,
|
|
2032
|
-
"input--empty": !this.value,
|
|
2033
|
-
"input--no-spin-buttons": this.noSpinButtons
|
|
2034
|
-
})}
|
|
2035
|
-
>
|
|
2036
|
-
<span part="prefix" class="input__prefix">
|
|
2037
|
-
<slot name="prefix"></slot>
|
|
2038
|
-
</span>
|
|
2039
|
-
|
|
2040
|
-
<input
|
|
2041
|
-
part="input"
|
|
2042
|
-
id="input"
|
|
2043
|
-
class="input__control"
|
|
2044
|
-
type=${this.type === "password" && this.passwordVisible ? "text" : this.type}
|
|
2045
|
-
title=${this.title}
|
|
2046
|
-
name=${m(this.name)}
|
|
2047
|
-
?disabled=${this.disabled}
|
|
2048
|
-
?readonly=${this.readonly}
|
|
2049
|
-
?required=${this.required}
|
|
2050
|
-
placeholder=${m(this.placeholder)}
|
|
2051
|
-
minlength=${m(this.minlength)}
|
|
2052
|
-
maxlength=${m(this.maxlength)}
|
|
2053
|
-
min=${m(this.min)}
|
|
2054
|
-
max=${m(this.max)}
|
|
2055
|
-
step=${m(this.step)}
|
|
2056
|
-
.value=${mo(this.value)}
|
|
2057
|
-
autocapitalize=${m(this.autocapitalize)}
|
|
2058
|
-
autocomplete=${m(this.autocomplete)}
|
|
2059
|
-
autocorrect=${m(this.autocorrect)}
|
|
2060
|
-
?autofocus=${this.autofocus}
|
|
2061
|
-
spellcheck=${this.spellcheck}
|
|
2062
|
-
pattern=${m(this.pattern)}
|
|
2063
|
-
enterkeyhint=${m(this.enterkeyhint)}
|
|
2064
|
-
inputmode=${m(this.inputmode)}
|
|
2065
|
-
aria-describedby="help-text"
|
|
2066
|
-
@change=${this.handleChange}
|
|
2067
|
-
@input=${this.handleInput}
|
|
2068
|
-
@invalid=${this.handleInvalid}
|
|
2069
|
-
@keydown=${this.handleKeyDown}
|
|
2070
|
-
@focus=${this.handleFocus}
|
|
2071
|
-
@blur=${this.handleBlur}
|
|
2072
|
-
/>
|
|
2073
|
-
|
|
2074
|
-
${i ? v`
|
|
2075
|
-
<button
|
|
2076
|
-
part="clear-button"
|
|
2077
|
-
class="input__clear"
|
|
2078
|
-
type="button"
|
|
2079
|
-
aria-label=${this.localize.term("clearEntry")}
|
|
2080
|
-
@click=${this.handleClearClick}
|
|
2081
|
-
tabindex="-1"
|
|
2082
|
-
>
|
|
2083
|
-
<slot name="clear-icon">
|
|
2084
|
-
<sl-icon name="x-circle-fill" library="system"></sl-icon>
|
|
2085
|
-
</slot>
|
|
2086
|
-
</button>
|
|
2087
|
-
` : ""}
|
|
2088
|
-
${this.passwordToggle && !this.disabled ? v`
|
|
2089
|
-
<button
|
|
2090
|
-
part="password-toggle-button"
|
|
2091
|
-
class="input__password-toggle"
|
|
2092
|
-
type="button"
|
|
2093
|
-
aria-label=${this.localize.term(this.passwordVisible ? "hidePassword" : "showPassword")}
|
|
2094
|
-
@click=${this.handlePasswordToggle}
|
|
2095
|
-
tabindex="-1"
|
|
2096
|
-
>
|
|
2097
|
-
${this.passwordVisible ? v`
|
|
2098
|
-
<slot name="show-password-icon">
|
|
2099
|
-
<sl-icon name="eye-slash" library="system"></sl-icon>
|
|
2100
|
-
</slot>
|
|
2101
|
-
` : v`
|
|
2102
|
-
<slot name="hide-password-icon">
|
|
2103
|
-
<sl-icon name="eye" library="system"></sl-icon>
|
|
2104
|
-
</slot>
|
|
2105
|
-
`}
|
|
2106
|
-
</button>
|
|
2107
|
-
` : ""}
|
|
2108
|
-
|
|
2109
|
-
<span part="suffix" class="input__suffix">
|
|
2110
|
-
<slot name="suffix"></slot>
|
|
2111
|
-
</span>
|
|
2112
|
-
</div>
|
|
2113
|
-
</div>
|
|
2114
|
-
|
|
2115
|
-
<div
|
|
2116
|
-
part="form-control-help-text"
|
|
2117
|
-
id="help-text"
|
|
2118
|
-
class="form-control__help-text"
|
|
2119
|
-
aria-hidden=${r ? "false" : "true"}
|
|
2120
|
-
>
|
|
2121
|
-
<slot name="help-text">${this.helpText}</slot>
|
|
2122
|
-
</div>
|
|
2123
|
-
</div>
|
|
2124
|
-
`;
|
|
2125
|
-
}
|
|
2126
|
-
};
|
|
2127
|
-
h.styles = [Q, Xe, Ge];
|
|
2128
|
-
h.dependencies = { "sl-icon": x };
|
|
2129
|
-
a([
|
|
2130
|
-
re(".input__control")
|
|
2131
|
-
], h.prototype, "input", 2);
|
|
2132
|
-
a([
|
|
2133
|
-
at()
|
|
2134
|
-
], h.prototype, "hasFocus", 2);
|
|
2135
|
-
a([
|
|
2136
|
-
u()
|
|
2137
|
-
], h.prototype, "title", 2);
|
|
2138
|
-
a([
|
|
2139
|
-
u({ reflect: !0 })
|
|
2140
|
-
], h.prototype, "type", 2);
|
|
2141
|
-
a([
|
|
2142
|
-
u()
|
|
2143
|
-
], h.prototype, "name", 2);
|
|
2144
|
-
a([
|
|
2145
|
-
u()
|
|
2146
|
-
], h.prototype, "value", 2);
|
|
2147
|
-
a([
|
|
2148
|
-
Qe()
|
|
2149
|
-
], h.prototype, "defaultValue", 2);
|
|
2150
|
-
a([
|
|
2151
|
-
u({ reflect: !0 })
|
|
2152
|
-
], h.prototype, "size", 2);
|
|
2153
|
-
a([
|
|
2154
|
-
u({ type: Boolean, reflect: !0 })
|
|
2155
|
-
], h.prototype, "filled", 2);
|
|
2156
|
-
a([
|
|
2157
|
-
u({ type: Boolean, reflect: !0 })
|
|
2158
|
-
], h.prototype, "pill", 2);
|
|
2159
|
-
a([
|
|
2160
|
-
u()
|
|
2161
|
-
], h.prototype, "label", 2);
|
|
2162
|
-
a([
|
|
2163
|
-
u({ attribute: "help-text" })
|
|
2164
|
-
], h.prototype, "helpText", 2);
|
|
2165
|
-
a([
|
|
2166
|
-
u({ type: Boolean })
|
|
2167
|
-
], h.prototype, "clearable", 2);
|
|
2168
|
-
a([
|
|
2169
|
-
u({ type: Boolean, reflect: !0 })
|
|
2170
|
-
], h.prototype, "disabled", 2);
|
|
2171
|
-
a([
|
|
2172
|
-
u()
|
|
2173
|
-
], h.prototype, "placeholder", 2);
|
|
2174
|
-
a([
|
|
2175
|
-
u({ type: Boolean, reflect: !0 })
|
|
2176
|
-
], h.prototype, "readonly", 2);
|
|
2177
|
-
a([
|
|
2178
|
-
u({ attribute: "password-toggle", type: Boolean })
|
|
2179
|
-
], h.prototype, "passwordToggle", 2);
|
|
2180
|
-
a([
|
|
2181
|
-
u({ attribute: "password-visible", type: Boolean })
|
|
2182
|
-
], h.prototype, "passwordVisible", 2);
|
|
2183
|
-
a([
|
|
2184
|
-
u({ attribute: "no-spin-buttons", type: Boolean })
|
|
2185
|
-
], h.prototype, "noSpinButtons", 2);
|
|
2186
|
-
a([
|
|
2187
|
-
u({ reflect: !0 })
|
|
2188
|
-
], h.prototype, "form", 2);
|
|
2189
|
-
a([
|
|
2190
|
-
u({ type: Boolean, reflect: !0 })
|
|
2191
|
-
], h.prototype, "required", 2);
|
|
2192
|
-
a([
|
|
2193
|
-
u()
|
|
2194
|
-
], h.prototype, "pattern", 2);
|
|
2195
|
-
a([
|
|
2196
|
-
u({ type: Number })
|
|
2197
|
-
], h.prototype, "minlength", 2);
|
|
2198
|
-
a([
|
|
2199
|
-
u({ type: Number })
|
|
2200
|
-
], h.prototype, "maxlength", 2);
|
|
2201
|
-
a([
|
|
2202
|
-
u()
|
|
2203
|
-
], h.prototype, "min", 2);
|
|
2204
|
-
a([
|
|
2205
|
-
u()
|
|
2206
|
-
], h.prototype, "max", 2);
|
|
2207
|
-
a([
|
|
2208
|
-
u()
|
|
2209
|
-
], h.prototype, "step", 2);
|
|
2210
|
-
a([
|
|
2211
|
-
u()
|
|
2212
|
-
], h.prototype, "autocapitalize", 2);
|
|
2213
|
-
a([
|
|
2214
|
-
u()
|
|
2215
|
-
], h.prototype, "autocorrect", 2);
|
|
2216
|
-
a([
|
|
2217
|
-
u()
|
|
2218
|
-
], h.prototype, "autocomplete", 2);
|
|
2219
|
-
a([
|
|
2220
|
-
u({ type: Boolean })
|
|
2221
|
-
], h.prototype, "autofocus", 2);
|
|
2222
|
-
a([
|
|
2223
|
-
u()
|
|
2224
|
-
], h.prototype, "enterkeyhint", 2);
|
|
2225
|
-
a([
|
|
2226
|
-
u({
|
|
2227
|
-
type: Boolean,
|
|
2228
|
-
converter: {
|
|
2229
|
-
// Allow "true|false" attribute values but keep the property boolean
|
|
2230
|
-
fromAttribute: (o) => !(!o || o === "false"),
|
|
2231
|
-
toAttribute: (o) => o ? "true" : "false"
|
|
2232
|
-
}
|
|
2233
|
-
})
|
|
2234
|
-
], h.prototype, "spellcheck", 2);
|
|
2235
|
-
a([
|
|
2236
|
-
u()
|
|
2237
|
-
], h.prototype, "inputmode", 2);
|
|
2238
|
-
a([
|
|
2239
|
-
M("disabled", { waitUntilFirstUpdate: !0 })
|
|
2240
|
-
], h.prototype, "handleDisabledChange", 1);
|
|
2241
|
-
a([
|
|
2242
|
-
M("step", { waitUntilFirstUpdate: !0 })
|
|
2243
|
-
], h.prototype, "handleStepChange", 1);
|
|
2244
|
-
a([
|
|
2245
|
-
M("value", { waitUntilFirstUpdate: !0 })
|
|
2246
|
-
], h.prototype, "handleValueChange", 1);
|
|
2247
|
-
h.define("sl-input");
|
|
2248
|
-
var go = $`
|
|
2249
|
-
:host {
|
|
2250
|
-
--track-width: 2px;
|
|
2251
|
-
--track-color: rgb(128 128 128 / 25%);
|
|
2252
|
-
--indicator-color: var(--sl-color-primary-600);
|
|
2253
|
-
--speed: 2s;
|
|
2254
|
-
|
|
2255
|
-
display: inline-flex;
|
|
2256
|
-
width: 1em;
|
|
2257
|
-
height: 1em;
|
|
2258
|
-
flex: none;
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
.spinner {
|
|
2262
|
-
flex: 1 1 auto;
|
|
2263
|
-
height: 100%;
|
|
2264
|
-
width: 100%;
|
|
2265
|
-
}
|
|
2266
|
-
|
|
2267
|
-
.spinner__track,
|
|
2268
|
-
.spinner__indicator {
|
|
2269
|
-
fill: none;
|
|
2270
|
-
stroke-width: var(--track-width);
|
|
2271
|
-
r: calc(0.5em - var(--track-width) / 2);
|
|
2272
|
-
cx: 0.5em;
|
|
2273
|
-
cy: 0.5em;
|
|
2274
|
-
transform-origin: 50% 50%;
|
|
2275
|
-
}
|
|
2276
|
-
|
|
2277
|
-
.spinner__track {
|
|
2278
|
-
stroke: var(--track-color);
|
|
2279
|
-
transform-origin: 0% 0%;
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
.spinner__indicator {
|
|
2283
|
-
stroke: var(--indicator-color);
|
|
2284
|
-
stroke-linecap: round;
|
|
2285
|
-
stroke-dasharray: 150% 75%;
|
|
2286
|
-
animation: spin var(--speed) linear infinite;
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
@keyframes spin {
|
|
2290
|
-
0% {
|
|
2291
|
-
transform: rotate(0deg);
|
|
2292
|
-
stroke-dasharray: 0.05em, 3em;
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
50% {
|
|
2296
|
-
transform: rotate(450deg);
|
|
2297
|
-
stroke-dasharray: 1.375em, 1.375em;
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
100% {
|
|
2301
|
-
transform: rotate(1080deg);
|
|
2302
|
-
stroke-dasharray: 0.05em, 3em;
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
`, he = class extends k {
|
|
2306
|
-
constructor() {
|
|
2307
|
-
super(...arguments), this.localize = new zt(this);
|
|
2308
|
-
}
|
|
2309
|
-
render() {
|
|
2310
|
-
return v`
|
|
2311
|
-
<svg part="base" class="spinner" role="progressbar" aria-label=${this.localize.term("loading")}>
|
|
2312
|
-
<circle class="spinner__track"></circle>
|
|
2313
|
-
<circle class="spinner__indicator"></circle>
|
|
2314
|
-
</svg>
|
|
2315
|
-
`;
|
|
2316
|
-
}
|
|
2317
|
-
};
|
|
2318
|
-
he.styles = [Q, go];
|
|
2319
|
-
var vo = $`
|
|
2320
|
-
:host {
|
|
2321
|
-
display: inline-block;
|
|
2322
|
-
position: relative;
|
|
2323
|
-
width: auto;
|
|
2324
|
-
cursor: pointer;
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
.button {
|
|
2328
|
-
display: inline-flex;
|
|
2329
|
-
align-items: stretch;
|
|
2330
|
-
justify-content: center;
|
|
2331
|
-
width: 100%;
|
|
2332
|
-
border-style: solid;
|
|
2333
|
-
border-width: var(--sl-input-border-width);
|
|
2334
|
-
font-family: var(--sl-input-font-family);
|
|
2335
|
-
font-weight: var(--sl-font-weight-semibold);
|
|
2336
|
-
text-decoration: none;
|
|
2337
|
-
user-select: none;
|
|
2338
|
-
-webkit-user-select: none;
|
|
2339
|
-
white-space: nowrap;
|
|
2340
|
-
vertical-align: middle;
|
|
2341
|
-
padding: 0;
|
|
2342
|
-
transition:
|
|
2343
|
-
var(--sl-transition-x-fast) background-color,
|
|
2344
|
-
var(--sl-transition-x-fast) color,
|
|
2345
|
-
var(--sl-transition-x-fast) border,
|
|
2346
|
-
var(--sl-transition-x-fast) box-shadow;
|
|
2347
|
-
cursor: inherit;
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
.button::-moz-focus-inner {
|
|
2351
|
-
border: 0;
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
.button:focus {
|
|
2355
|
-
outline: none;
|
|
2356
|
-
}
|
|
2357
|
-
|
|
2358
|
-
.button:focus-visible {
|
|
2359
|
-
outline: var(--sl-focus-ring);
|
|
2360
|
-
outline-offset: var(--sl-focus-ring-offset);
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
.button--disabled {
|
|
2364
|
-
opacity: 0.5;
|
|
2365
|
-
cursor: not-allowed;
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
/* When disabled, prevent mouse events from bubbling up from children */
|
|
2369
|
-
.button--disabled * {
|
|
2370
|
-
pointer-events: none;
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
.button__prefix,
|
|
2374
|
-
.button__suffix {
|
|
2375
|
-
flex: 0 0 auto;
|
|
2376
|
-
display: flex;
|
|
2377
|
-
align-items: center;
|
|
2378
|
-
pointer-events: none;
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
.button__label {
|
|
2382
|
-
display: inline-block;
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
.button__label::slotted(sl-icon) {
|
|
2386
|
-
vertical-align: -2px;
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
/*
|
|
2390
|
-
* Standard buttons
|
|
2391
|
-
*/
|
|
2392
|
-
|
|
2393
|
-
/* Default */
|
|
2394
|
-
.button--standard.button--default {
|
|
2395
|
-
background-color: var(--sl-color-neutral-0);
|
|
2396
|
-
border-color: var(--sl-input-border-color);
|
|
2397
|
-
color: var(--sl-color-neutral-700);
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
.button--standard.button--default:hover:not(.button--disabled) {
|
|
2401
|
-
background-color: var(--sl-color-primary-50);
|
|
2402
|
-
border-color: var(--sl-color-primary-300);
|
|
2403
|
-
color: var(--sl-color-primary-700);
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
|
-
.button--standard.button--default:active:not(.button--disabled) {
|
|
2407
|
-
background-color: var(--sl-color-primary-100);
|
|
2408
|
-
border-color: var(--sl-color-primary-400);
|
|
2409
|
-
color: var(--sl-color-primary-700);
|
|
2410
|
-
}
|
|
2411
|
-
|
|
2412
|
-
/* Primary */
|
|
2413
|
-
.button--standard.button--primary {
|
|
2414
|
-
background-color: var(--sl-color-primary-600);
|
|
2415
|
-
border-color: var(--sl-color-primary-600);
|
|
2416
|
-
color: var(--sl-color-neutral-0);
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2419
|
-
.button--standard.button--primary:hover:not(.button--disabled) {
|
|
2420
|
-
background-color: var(--sl-color-primary-500);
|
|
2421
|
-
border-color: var(--sl-color-primary-500);
|
|
2422
|
-
color: var(--sl-color-neutral-0);
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
.button--standard.button--primary:active:not(.button--disabled) {
|
|
2426
|
-
background-color: var(--sl-color-primary-600);
|
|
2427
|
-
border-color: var(--sl-color-primary-600);
|
|
2428
|
-
color: var(--sl-color-neutral-0);
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
|
-
/* Success */
|
|
2432
|
-
.button--standard.button--success {
|
|
2433
|
-
background-color: var(--sl-color-success-600);
|
|
2434
|
-
border-color: var(--sl-color-success-600);
|
|
2435
|
-
color: var(--sl-color-neutral-0);
|
|
2436
|
-
}
|
|
2437
|
-
|
|
2438
|
-
.button--standard.button--success:hover:not(.button--disabled) {
|
|
2439
|
-
background-color: var(--sl-color-success-500);
|
|
2440
|
-
border-color: var(--sl-color-success-500);
|
|
2441
|
-
color: var(--sl-color-neutral-0);
|
|
2442
|
-
}
|
|
2443
|
-
|
|
2444
|
-
.button--standard.button--success:active:not(.button--disabled) {
|
|
2445
|
-
background-color: var(--sl-color-success-600);
|
|
2446
|
-
border-color: var(--sl-color-success-600);
|
|
2447
|
-
color: var(--sl-color-neutral-0);
|
|
2448
|
-
}
|
|
2449
|
-
|
|
2450
|
-
/* Neutral */
|
|
2451
|
-
.button--standard.button--neutral {
|
|
2452
|
-
background-color: var(--sl-color-neutral-600);
|
|
2453
|
-
border-color: var(--sl-color-neutral-600);
|
|
2454
|
-
color: var(--sl-color-neutral-0);
|
|
2455
|
-
}
|
|
2456
|
-
|
|
2457
|
-
.button--standard.button--neutral:hover:not(.button--disabled) {
|
|
2458
|
-
background-color: var(--sl-color-neutral-500);
|
|
2459
|
-
border-color: var(--sl-color-neutral-500);
|
|
2460
|
-
color: var(--sl-color-neutral-0);
|
|
2461
|
-
}
|
|
2462
|
-
|
|
2463
|
-
.button--standard.button--neutral:active:not(.button--disabled) {
|
|
2464
|
-
background-color: var(--sl-color-neutral-600);
|
|
2465
|
-
border-color: var(--sl-color-neutral-600);
|
|
2466
|
-
color: var(--sl-color-neutral-0);
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
/* Warning */
|
|
2470
|
-
.button--standard.button--warning {
|
|
2471
|
-
background-color: var(--sl-color-warning-600);
|
|
2472
|
-
border-color: var(--sl-color-warning-600);
|
|
2473
|
-
color: var(--sl-color-neutral-0);
|
|
2474
|
-
}
|
|
2475
|
-
.button--standard.button--warning:hover:not(.button--disabled) {
|
|
2476
|
-
background-color: var(--sl-color-warning-500);
|
|
2477
|
-
border-color: var(--sl-color-warning-500);
|
|
2478
|
-
color: var(--sl-color-neutral-0);
|
|
2479
|
-
}
|
|
2480
|
-
|
|
2481
|
-
.button--standard.button--warning:active:not(.button--disabled) {
|
|
2482
|
-
background-color: var(--sl-color-warning-600);
|
|
2483
|
-
border-color: var(--sl-color-warning-600);
|
|
2484
|
-
color: var(--sl-color-neutral-0);
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
/* Danger */
|
|
2488
|
-
.button--standard.button--danger {
|
|
2489
|
-
background-color: var(--sl-color-danger-600);
|
|
2490
|
-
border-color: var(--sl-color-danger-600);
|
|
2491
|
-
color: var(--sl-color-neutral-0);
|
|
2492
|
-
}
|
|
2493
|
-
|
|
2494
|
-
.button--standard.button--danger:hover:not(.button--disabled) {
|
|
2495
|
-
background-color: var(--sl-color-danger-500);
|
|
2496
|
-
border-color: var(--sl-color-danger-500);
|
|
2497
|
-
color: var(--sl-color-neutral-0);
|
|
2498
|
-
}
|
|
2499
|
-
|
|
2500
|
-
.button--standard.button--danger:active:not(.button--disabled) {
|
|
2501
|
-
background-color: var(--sl-color-danger-600);
|
|
2502
|
-
border-color: var(--sl-color-danger-600);
|
|
2503
|
-
color: var(--sl-color-neutral-0);
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
/*
|
|
2507
|
-
* Outline buttons
|
|
2508
|
-
*/
|
|
2509
|
-
|
|
2510
|
-
.button--outline {
|
|
2511
|
-
background: none;
|
|
2512
|
-
border: solid 1px;
|
|
2513
|
-
}
|
|
2514
|
-
|
|
2515
|
-
/* Default */
|
|
2516
|
-
.button--outline.button--default {
|
|
2517
|
-
border-color: var(--sl-input-border-color);
|
|
2518
|
-
color: var(--sl-color-neutral-700);
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
-
.button--outline.button--default:hover:not(.button--disabled),
|
|
2522
|
-
.button--outline.button--default.button--checked:not(.button--disabled) {
|
|
2523
|
-
border-color: var(--sl-color-primary-600);
|
|
2524
|
-
background-color: var(--sl-color-primary-600);
|
|
2525
|
-
color: var(--sl-color-neutral-0);
|
|
2526
|
-
}
|
|
2527
|
-
|
|
2528
|
-
.button--outline.button--default:active:not(.button--disabled) {
|
|
2529
|
-
border-color: var(--sl-color-primary-700);
|
|
2530
|
-
background-color: var(--sl-color-primary-700);
|
|
2531
|
-
color: var(--sl-color-neutral-0);
|
|
2532
|
-
}
|
|
2533
|
-
|
|
2534
|
-
/* Primary */
|
|
2535
|
-
.button--outline.button--primary {
|
|
2536
|
-
border-color: var(--sl-color-primary-600);
|
|
2537
|
-
color: var(--sl-color-primary-600);
|
|
2538
|
-
}
|
|
2539
|
-
|
|
2540
|
-
.button--outline.button--primary:hover:not(.button--disabled),
|
|
2541
|
-
.button--outline.button--primary.button--checked:not(.button--disabled) {
|
|
2542
|
-
background-color: var(--sl-color-primary-600);
|
|
2543
|
-
color: var(--sl-color-neutral-0);
|
|
2544
|
-
}
|
|
2545
|
-
|
|
2546
|
-
.button--outline.button--primary:active:not(.button--disabled) {
|
|
2547
|
-
border-color: var(--sl-color-primary-700);
|
|
2548
|
-
background-color: var(--sl-color-primary-700);
|
|
2549
|
-
color: var(--sl-color-neutral-0);
|
|
2550
|
-
}
|
|
2551
|
-
|
|
2552
|
-
/* Success */
|
|
2553
|
-
.button--outline.button--success {
|
|
2554
|
-
border-color: var(--sl-color-success-600);
|
|
2555
|
-
color: var(--sl-color-success-600);
|
|
2556
|
-
}
|
|
2557
|
-
|
|
2558
|
-
.button--outline.button--success:hover:not(.button--disabled),
|
|
2559
|
-
.button--outline.button--success.button--checked:not(.button--disabled) {
|
|
2560
|
-
background-color: var(--sl-color-success-600);
|
|
2561
|
-
color: var(--sl-color-neutral-0);
|
|
2562
|
-
}
|
|
2563
|
-
|
|
2564
|
-
.button--outline.button--success:active:not(.button--disabled) {
|
|
2565
|
-
border-color: var(--sl-color-success-700);
|
|
2566
|
-
background-color: var(--sl-color-success-700);
|
|
2567
|
-
color: var(--sl-color-neutral-0);
|
|
2568
|
-
}
|
|
2569
|
-
|
|
2570
|
-
/* Neutral */
|
|
2571
|
-
.button--outline.button--neutral {
|
|
2572
|
-
border-color: var(--sl-color-neutral-600);
|
|
2573
|
-
color: var(--sl-color-neutral-600);
|
|
2574
|
-
}
|
|
2575
|
-
|
|
2576
|
-
.button--outline.button--neutral:hover:not(.button--disabled),
|
|
2577
|
-
.button--outline.button--neutral.button--checked:not(.button--disabled) {
|
|
2578
|
-
background-color: var(--sl-color-neutral-600);
|
|
2579
|
-
color: var(--sl-color-neutral-0);
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
|
-
.button--outline.button--neutral:active:not(.button--disabled) {
|
|
2583
|
-
border-color: var(--sl-color-neutral-700);
|
|
2584
|
-
background-color: var(--sl-color-neutral-700);
|
|
2585
|
-
color: var(--sl-color-neutral-0);
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
/* Warning */
|
|
2589
|
-
.button--outline.button--warning {
|
|
2590
|
-
border-color: var(--sl-color-warning-600);
|
|
2591
|
-
color: var(--sl-color-warning-600);
|
|
2592
|
-
}
|
|
2593
|
-
|
|
2594
|
-
.button--outline.button--warning:hover:not(.button--disabled),
|
|
2595
|
-
.button--outline.button--warning.button--checked:not(.button--disabled) {
|
|
2596
|
-
background-color: var(--sl-color-warning-600);
|
|
2597
|
-
color: var(--sl-color-neutral-0);
|
|
2598
|
-
}
|
|
2599
|
-
|
|
2600
|
-
.button--outline.button--warning:active:not(.button--disabled) {
|
|
2601
|
-
border-color: var(--sl-color-warning-700);
|
|
2602
|
-
background-color: var(--sl-color-warning-700);
|
|
2603
|
-
color: var(--sl-color-neutral-0);
|
|
2604
|
-
}
|
|
2605
|
-
|
|
2606
|
-
/* Danger */
|
|
2607
|
-
.button--outline.button--danger {
|
|
2608
|
-
border-color: var(--sl-color-danger-600);
|
|
2609
|
-
color: var(--sl-color-danger-600);
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
|
-
.button--outline.button--danger:hover:not(.button--disabled),
|
|
2613
|
-
.button--outline.button--danger.button--checked:not(.button--disabled) {
|
|
2614
|
-
background-color: var(--sl-color-danger-600);
|
|
2615
|
-
color: var(--sl-color-neutral-0);
|
|
2616
|
-
}
|
|
2617
|
-
|
|
2618
|
-
.button--outline.button--danger:active:not(.button--disabled) {
|
|
2619
|
-
border-color: var(--sl-color-danger-700);
|
|
2620
|
-
background-color: var(--sl-color-danger-700);
|
|
2621
|
-
color: var(--sl-color-neutral-0);
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
@media (forced-colors: active) {
|
|
2625
|
-
.button.button--outline.button--checked:not(.button--disabled) {
|
|
2626
|
-
outline: solid 2px transparent;
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
|
|
2630
|
-
/*
|
|
2631
|
-
* Text buttons
|
|
2632
|
-
*/
|
|
2633
|
-
|
|
2634
|
-
.button--text {
|
|
2635
|
-
background-color: transparent;
|
|
2636
|
-
border-color: transparent;
|
|
2637
|
-
color: var(--sl-color-primary-600);
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
|
-
.button--text:hover:not(.button--disabled) {
|
|
2641
|
-
background-color: transparent;
|
|
2642
|
-
border-color: transparent;
|
|
2643
|
-
color: var(--sl-color-primary-500);
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
|
-
.button--text:focus-visible:not(.button--disabled) {
|
|
2647
|
-
background-color: transparent;
|
|
2648
|
-
border-color: transparent;
|
|
2649
|
-
color: var(--sl-color-primary-500);
|
|
2650
|
-
}
|
|
2651
|
-
|
|
2652
|
-
.button--text:active:not(.button--disabled) {
|
|
2653
|
-
background-color: transparent;
|
|
2654
|
-
border-color: transparent;
|
|
2655
|
-
color: var(--sl-color-primary-700);
|
|
2656
|
-
}
|
|
2657
|
-
|
|
2658
|
-
/*
|
|
2659
|
-
* Size modifiers
|
|
2660
|
-
*/
|
|
2661
|
-
|
|
2662
|
-
.button--small {
|
|
2663
|
-
height: auto;
|
|
2664
|
-
min-height: var(--sl-input-height-small);
|
|
2665
|
-
font-size: var(--sl-button-font-size-small);
|
|
2666
|
-
line-height: calc(var(--sl-input-height-small) - var(--sl-input-border-width) * 2);
|
|
2667
|
-
border-radius: var(--sl-input-border-radius-small);
|
|
2668
|
-
}
|
|
2669
|
-
|
|
2670
|
-
.button--medium {
|
|
2671
|
-
height: auto;
|
|
2672
|
-
min-height: var(--sl-input-height-medium);
|
|
2673
|
-
font-size: var(--sl-button-font-size-medium);
|
|
2674
|
-
line-height: calc(var(--sl-input-height-medium) - var(--sl-input-border-width) * 2);
|
|
2675
|
-
border-radius: var(--sl-input-border-radius-medium);
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
.button--large {
|
|
2679
|
-
height: auto;
|
|
2680
|
-
min-height: var(--sl-input-height-large);
|
|
2681
|
-
font-size: var(--sl-button-font-size-large);
|
|
2682
|
-
line-height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);
|
|
2683
|
-
border-radius: var(--sl-input-border-radius-large);
|
|
2684
|
-
}
|
|
2685
|
-
|
|
2686
|
-
/*
|
|
2687
|
-
* Pill modifier
|
|
2688
|
-
*/
|
|
2689
|
-
|
|
2690
|
-
.button--pill.button--small {
|
|
2691
|
-
border-radius: var(--sl-input-height-small);
|
|
2692
|
-
}
|
|
2693
|
-
|
|
2694
|
-
.button--pill.button--medium {
|
|
2695
|
-
border-radius: var(--sl-input-height-medium);
|
|
2696
|
-
}
|
|
2697
|
-
|
|
2698
|
-
.button--pill.button--large {
|
|
2699
|
-
border-radius: var(--sl-input-height-large);
|
|
2700
|
-
}
|
|
2701
|
-
|
|
2702
|
-
/*
|
|
2703
|
-
* Circle modifier
|
|
2704
|
-
*/
|
|
2705
|
-
|
|
2706
|
-
.button--circle {
|
|
2707
|
-
padding-left: 0;
|
|
2708
|
-
padding-right: 0;
|
|
2709
|
-
}
|
|
2710
|
-
|
|
2711
|
-
.button--circle.button--small {
|
|
2712
|
-
width: var(--sl-input-height-small);
|
|
2713
|
-
border-radius: 50%;
|
|
2714
|
-
}
|
|
2715
|
-
|
|
2716
|
-
.button--circle.button--medium {
|
|
2717
|
-
width: var(--sl-input-height-medium);
|
|
2718
|
-
border-radius: 50%;
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
.button--circle.button--large {
|
|
2722
|
-
width: var(--sl-input-height-large);
|
|
2723
|
-
border-radius: 50%;
|
|
2724
|
-
}
|
|
2725
|
-
|
|
2726
|
-
.button--circle .button__prefix,
|
|
2727
|
-
.button--circle .button__suffix,
|
|
2728
|
-
.button--circle .button__caret {
|
|
2729
|
-
display: none;
|
|
2730
|
-
}
|
|
2731
|
-
|
|
2732
|
-
/*
|
|
2733
|
-
* Caret modifier
|
|
2734
|
-
*/
|
|
2735
|
-
|
|
2736
|
-
.button--caret .button__suffix {
|
|
2737
|
-
display: none;
|
|
2738
|
-
}
|
|
2739
|
-
|
|
2740
|
-
.button--caret .button__caret {
|
|
2741
|
-
height: auto;
|
|
2742
|
-
}
|
|
2743
|
-
|
|
2744
|
-
/*
|
|
2745
|
-
* Loading modifier
|
|
2746
|
-
*/
|
|
2747
|
-
|
|
2748
|
-
.button--loading {
|
|
2749
|
-
position: relative;
|
|
2750
|
-
cursor: wait;
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
.button--loading .button__prefix,
|
|
2754
|
-
.button--loading .button__label,
|
|
2755
|
-
.button--loading .button__suffix,
|
|
2756
|
-
.button--loading .button__caret {
|
|
2757
|
-
visibility: hidden;
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
|
-
.button--loading sl-spinner {
|
|
2761
|
-
--indicator-color: currentColor;
|
|
2762
|
-
position: absolute;
|
|
2763
|
-
font-size: 1em;
|
|
2764
|
-
height: 1em;
|
|
2765
|
-
width: 1em;
|
|
2766
|
-
top: calc(50% - 0.5em);
|
|
2767
|
-
left: calc(50% - 0.5em);
|
|
2768
|
-
}
|
|
2769
|
-
|
|
2770
|
-
/*
|
|
2771
|
-
* Badges
|
|
2772
|
-
*/
|
|
2773
|
-
|
|
2774
|
-
.button ::slotted(sl-badge) {
|
|
2775
|
-
position: absolute;
|
|
2776
|
-
top: 0;
|
|
2777
|
-
right: 0;
|
|
2778
|
-
translate: 50% -50%;
|
|
2779
|
-
pointer-events: none;
|
|
2780
|
-
}
|
|
2781
|
-
|
|
2782
|
-
.button--rtl ::slotted(sl-badge) {
|
|
2783
|
-
right: auto;
|
|
2784
|
-
left: 0;
|
|
2785
|
-
translate: -50% -50%;
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
|
-
/*
|
|
2789
|
-
* Button spacing
|
|
2790
|
-
*/
|
|
2791
|
-
|
|
2792
|
-
.button--has-label.button--small .button__label {
|
|
2793
|
-
padding: 0 var(--sl-spacing-small);
|
|
2794
|
-
}
|
|
2795
|
-
|
|
2796
|
-
.button--has-label.button--medium .button__label {
|
|
2797
|
-
padding: 0 var(--sl-spacing-medium);
|
|
2798
|
-
}
|
|
2799
|
-
|
|
2800
|
-
.button--has-label.button--large .button__label {
|
|
2801
|
-
padding: 0 var(--sl-spacing-large);
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
.button--has-prefix.button--small {
|
|
2805
|
-
padding-inline-start: var(--sl-spacing-x-small);
|
|
2806
|
-
}
|
|
2807
|
-
|
|
2808
|
-
.button--has-prefix.button--small .button__label {
|
|
2809
|
-
padding-inline-start: var(--sl-spacing-x-small);
|
|
2810
|
-
}
|
|
2811
|
-
|
|
2812
|
-
.button--has-prefix.button--medium {
|
|
2813
|
-
padding-inline-start: var(--sl-spacing-small);
|
|
2814
|
-
}
|
|
2815
|
-
|
|
2816
|
-
.button--has-prefix.button--medium .button__label {
|
|
2817
|
-
padding-inline-start: var(--sl-spacing-small);
|
|
2818
|
-
}
|
|
2819
|
-
|
|
2820
|
-
.button--has-prefix.button--large {
|
|
2821
|
-
padding-inline-start: var(--sl-spacing-small);
|
|
2822
|
-
}
|
|
2823
|
-
|
|
2824
|
-
.button--has-prefix.button--large .button__label {
|
|
2825
|
-
padding-inline-start: var(--sl-spacing-small);
|
|
2826
|
-
}
|
|
2827
|
-
|
|
2828
|
-
.button--has-suffix.button--small,
|
|
2829
|
-
.button--caret.button--small {
|
|
2830
|
-
padding-inline-end: var(--sl-spacing-x-small);
|
|
2831
|
-
}
|
|
2832
|
-
|
|
2833
|
-
.button--has-suffix.button--small .button__label,
|
|
2834
|
-
.button--caret.button--small .button__label {
|
|
2835
|
-
padding-inline-end: var(--sl-spacing-x-small);
|
|
2836
|
-
}
|
|
2837
|
-
|
|
2838
|
-
.button--has-suffix.button--medium,
|
|
2839
|
-
.button--caret.button--medium {
|
|
2840
|
-
padding-inline-end: var(--sl-spacing-small);
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
.button--has-suffix.button--medium .button__label,
|
|
2844
|
-
.button--caret.button--medium .button__label {
|
|
2845
|
-
padding-inline-end: var(--sl-spacing-small);
|
|
2846
|
-
}
|
|
2847
|
-
|
|
2848
|
-
.button--has-suffix.button--large,
|
|
2849
|
-
.button--caret.button--large {
|
|
2850
|
-
padding-inline-end: var(--sl-spacing-small);
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
.button--has-suffix.button--large .button__label,
|
|
2854
|
-
.button--caret.button--large .button__label {
|
|
2855
|
-
padding-inline-end: var(--sl-spacing-small);
|
|
2856
|
-
}
|
|
2857
|
-
|
|
2858
|
-
/*
|
|
2859
|
-
* Button groups support a variety of button types (e.g. buttons with tooltips, buttons as dropdown triggers, etc.).
|
|
2860
|
-
* This means buttons aren't always direct descendants of the button group, thus we can't target them with the
|
|
2861
|
-
* ::slotted selector. To work around this, the button group component does some magic to add these special classes to
|
|
2862
|
-
* buttons and we style them here instead.
|
|
2863
|
-
*/
|
|
2864
|
-
|
|
2865
|
-
:host([data-sl-button-group__button--first]:not([data-sl-button-group__button--last])) .button {
|
|
2866
|
-
border-start-end-radius: 0;
|
|
2867
|
-
border-end-end-radius: 0;
|
|
2868
|
-
}
|
|
2869
|
-
|
|
2870
|
-
:host([data-sl-button-group__button--inner]) .button {
|
|
2871
|
-
border-radius: 0;
|
|
2872
|
-
}
|
|
2873
|
-
|
|
2874
|
-
:host([data-sl-button-group__button--last]:not([data-sl-button-group__button--first])) .button {
|
|
2875
|
-
border-start-start-radius: 0;
|
|
2876
|
-
border-end-start-radius: 0;
|
|
2877
|
-
}
|
|
2878
|
-
|
|
2879
|
-
/* All except the first */
|
|
2880
|
-
:host([data-sl-button-group__button]:not([data-sl-button-group__button--first])) {
|
|
2881
|
-
margin-inline-start: calc(-1 * var(--sl-input-border-width));
|
|
2882
|
-
}
|
|
2883
|
-
|
|
2884
|
-
/* Add a visual separator between solid buttons */
|
|
2885
|
-
:host(
|
|
2886
|
-
[data-sl-button-group__button]:not(
|
|
2887
|
-
[data-sl-button-group__button--first],
|
|
2888
|
-
[data-sl-button-group__button--radio],
|
|
2889
|
-
[variant='default']
|
|
2890
|
-
):not(:hover)
|
|
2891
|
-
)
|
|
2892
|
-
.button:after {
|
|
2893
|
-
content: '';
|
|
2894
|
-
position: absolute;
|
|
2895
|
-
top: 0;
|
|
2896
|
-
inset-inline-start: 0;
|
|
2897
|
-
bottom: 0;
|
|
2898
|
-
border-left: solid 1px rgb(128 128 128 / 33%);
|
|
2899
|
-
mix-blend-mode: multiply;
|
|
2900
|
-
}
|
|
2901
|
-
|
|
2902
|
-
/* Bump hovered, focused, and checked buttons up so their focus ring isn't clipped */
|
|
2903
|
-
:host([data-sl-button-group__button--hover]) {
|
|
2904
|
-
z-index: 1;
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
|
-
/* Focus and checked are always on top */
|
|
2908
|
-
:host([data-sl-button-group__button--focus]),
|
|
2909
|
-
:host([data-sl-button-group__button][checked]) {
|
|
2910
|
-
z-index: 2;
|
|
2911
|
-
}
|
|
2912
|
-
`;
|
|
2913
|
-
/**
|
|
2914
|
-
* @license
|
|
2915
|
-
* Copyright 2020 Google LLC
|
|
2916
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2917
|
-
*/
|
|
2918
|
-
const pe = Symbol.for(""), yo = (o) => {
|
|
2919
|
-
if ((o == null ? void 0 : o.r) === pe) return o == null ? void 0 : o._$litStatic$;
|
|
2920
|
-
}, Kt = (o, ...t) => ({ _$litStatic$: t.reduce((e, r, s) => e + ((i) => {
|
|
2921
|
-
if (i._$litStatic$ !== void 0) return i._$litStatic$;
|
|
2922
|
-
throw Error(`Value passed to 'literal' function must be a 'literal' result: ${i}. Use 'unsafeStatic' to pass non-literal values, but
|
|
2923
|
-
take care to ensure page security.`);
|
|
2924
|
-
})(r) + o[s + 1], o[0]), r: pe }), Zt = /* @__PURE__ */ new Map(), wo = (o) => (t, ...e) => {
|
|
2925
|
-
const r = e.length;
|
|
2926
|
-
let s, i;
|
|
2927
|
-
const n = [], d = [];
|
|
2928
|
-
let l, c = 0, b = !1;
|
|
2929
|
-
for (; c < r; ) {
|
|
2930
|
-
for (l = t[c]; c < r && (i = e[c], (s = yo(i)) !== void 0); ) l += s + t[++c], b = !0;
|
|
2931
|
-
c !== r && d.push(i), n.push(l), c++;
|
|
2932
|
-
}
|
|
2933
|
-
if (c === r && n.push(t[r]), b) {
|
|
2934
|
-
const p = n.join("$$lit$$");
|
|
2935
|
-
(t = Zt.get(p)) === void 0 && (n.raw = n, Zt.set(p, t = n)), e = d;
|
|
2936
|
-
}
|
|
2937
|
-
return o(t, ...e);
|
|
2938
|
-
}, ft = wo(v);
|
|
2939
|
-
var f = class extends k {
|
|
2940
|
-
constructor() {
|
|
2941
|
-
super(...arguments), this.formControlController = new ae(this, {
|
|
2942
|
-
assumeInteractionOn: ["click"]
|
|
2943
|
-
}), this.hasSlotController = new St(this, "[default]", "prefix", "suffix"), this.localize = new zt(this), this.hasFocus = !1, this.invalid = !1, this.title = "", this.variant = "default", this.size = "medium", this.caret = !1, this.disabled = !1, this.loading = !1, this.outline = !1, this.pill = !1, this.circle = !1, this.type = "button", this.name = "", this.value = "", this.href = "", this.rel = "noreferrer noopener";
|
|
2944
|
-
}
|
|
2945
|
-
/** Gets the validity state object */
|
|
2946
|
-
get validity() {
|
|
2947
|
-
return this.isButton() ? this.button.validity : Et;
|
|
2948
|
-
}
|
|
2949
|
-
/** Gets the validation message */
|
|
2950
|
-
get validationMessage() {
|
|
2951
|
-
return this.isButton() ? this.button.validationMessage : "";
|
|
2952
|
-
}
|
|
2953
|
-
firstUpdated() {
|
|
2954
|
-
this.isButton() && this.formControlController.updateValidity();
|
|
2955
|
-
}
|
|
2956
|
-
handleBlur() {
|
|
2957
|
-
this.hasFocus = !1, this.emit("sl-blur");
|
|
2958
|
-
}
|
|
2959
|
-
handleFocus() {
|
|
2960
|
-
this.hasFocus = !0, this.emit("sl-focus");
|
|
2961
|
-
}
|
|
2962
|
-
handleClick() {
|
|
2963
|
-
this.type === "submit" && this.formControlController.submit(this), this.type === "reset" && this.formControlController.reset(this);
|
|
2964
|
-
}
|
|
2965
|
-
handleInvalid(o) {
|
|
2966
|
-
this.formControlController.setValidity(!1), this.formControlController.emitInvalidEvent(o);
|
|
2967
|
-
}
|
|
2968
|
-
isButton() {
|
|
2969
|
-
return !this.href;
|
|
2970
|
-
}
|
|
2971
|
-
isLink() {
|
|
2972
|
-
return !!this.href;
|
|
2973
|
-
}
|
|
2974
|
-
handleDisabledChange() {
|
|
2975
|
-
this.isButton() && this.formControlController.setValidity(this.disabled);
|
|
2976
|
-
}
|
|
2977
|
-
/** Simulates a click on the button. */
|
|
2978
|
-
click() {
|
|
2979
|
-
this.button.click();
|
|
2980
|
-
}
|
|
2981
|
-
/** Sets focus on the button. */
|
|
2982
|
-
focus(o) {
|
|
2983
|
-
this.button.focus(o);
|
|
2984
|
-
}
|
|
2985
|
-
/** Removes focus from the button. */
|
|
2986
|
-
blur() {
|
|
2987
|
-
this.button.blur();
|
|
2988
|
-
}
|
|
2989
|
-
/** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
2990
|
-
checkValidity() {
|
|
2991
|
-
return this.isButton() ? this.button.checkValidity() : !0;
|
|
2992
|
-
}
|
|
2993
|
-
/** Gets the associated form, if one exists. */
|
|
2994
|
-
getForm() {
|
|
2995
|
-
return this.formControlController.getForm();
|
|
2996
|
-
}
|
|
2997
|
-
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
2998
|
-
reportValidity() {
|
|
2999
|
-
return this.isButton() ? this.button.reportValidity() : !0;
|
|
3000
|
-
}
|
|
3001
|
-
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
3002
|
-
setCustomValidity(o) {
|
|
3003
|
-
this.isButton() && (this.button.setCustomValidity(o), this.formControlController.updateValidity());
|
|
3004
|
-
}
|
|
3005
|
-
render() {
|
|
3006
|
-
const o = this.isLink(), t = o ? Kt`a` : Kt`button`;
|
|
3007
|
-
return ft`
|
|
3008
|
-
<${t}
|
|
3009
|
-
part="base"
|
|
3010
|
-
class=${it({
|
|
3011
|
-
button: !0,
|
|
3012
|
-
"button--default": this.variant === "default",
|
|
3013
|
-
"button--primary": this.variant === "primary",
|
|
3014
|
-
"button--success": this.variant === "success",
|
|
3015
|
-
"button--neutral": this.variant === "neutral",
|
|
3016
|
-
"button--warning": this.variant === "warning",
|
|
3017
|
-
"button--danger": this.variant === "danger",
|
|
3018
|
-
"button--text": this.variant === "text",
|
|
3019
|
-
"button--small": this.size === "small",
|
|
3020
|
-
"button--medium": this.size === "medium",
|
|
3021
|
-
"button--large": this.size === "large",
|
|
3022
|
-
"button--caret": this.caret,
|
|
3023
|
-
"button--circle": this.circle,
|
|
3024
|
-
"button--disabled": this.disabled,
|
|
3025
|
-
"button--focused": this.hasFocus,
|
|
3026
|
-
"button--loading": this.loading,
|
|
3027
|
-
"button--standard": !this.outline,
|
|
3028
|
-
"button--outline": this.outline,
|
|
3029
|
-
"button--pill": this.pill,
|
|
3030
|
-
"button--rtl": this.localize.dir() === "rtl",
|
|
3031
|
-
"button--has-label": this.hasSlotController.test("[default]"),
|
|
3032
|
-
"button--has-prefix": this.hasSlotController.test("prefix"),
|
|
3033
|
-
"button--has-suffix": this.hasSlotController.test("suffix")
|
|
3034
|
-
})}
|
|
3035
|
-
?disabled=${m(o ? void 0 : this.disabled)}
|
|
3036
|
-
type=${m(o ? void 0 : this.type)}
|
|
3037
|
-
title=${this.title}
|
|
3038
|
-
name=${m(o ? void 0 : this.name)}
|
|
3039
|
-
value=${m(o ? void 0 : this.value)}
|
|
3040
|
-
href=${m(o ? this.href : void 0)}
|
|
3041
|
-
target=${m(o ? this.target : void 0)}
|
|
3042
|
-
download=${m(o ? this.download : void 0)}
|
|
3043
|
-
rel=${m(o ? this.rel : void 0)}
|
|
3044
|
-
role=${m(o ? void 0 : "button")}
|
|
3045
|
-
aria-disabled=${this.disabled ? "true" : "false"}
|
|
3046
|
-
tabindex=${this.disabled ? "-1" : "0"}
|
|
3047
|
-
@blur=${this.handleBlur}
|
|
3048
|
-
@focus=${this.handleFocus}
|
|
3049
|
-
@invalid=${this.isButton() ? this.handleInvalid : null}
|
|
3050
|
-
@click=${this.handleClick}
|
|
3051
|
-
>
|
|
3052
|
-
<slot name="prefix" part="prefix" class="button__prefix"></slot>
|
|
3053
|
-
<slot part="label" class="button__label"></slot>
|
|
3054
|
-
<slot name="suffix" part="suffix" class="button__suffix"></slot>
|
|
3055
|
-
${this.caret ? ft` <sl-icon part="caret" class="button__caret" library="system" name="caret"></sl-icon> ` : ""}
|
|
3056
|
-
${this.loading ? ft`<sl-spinner part="spinner"></sl-spinner>` : ""}
|
|
3057
|
-
</${t}>
|
|
3058
|
-
`;
|
|
3059
|
-
}
|
|
3060
|
-
};
|
|
3061
|
-
f.styles = [Q, vo];
|
|
3062
|
-
f.dependencies = {
|
|
3063
|
-
"sl-icon": x,
|
|
3064
|
-
"sl-spinner": he
|
|
3065
|
-
};
|
|
3066
|
-
a([
|
|
3067
|
-
re(".button")
|
|
3068
|
-
], f.prototype, "button", 2);
|
|
3069
|
-
a([
|
|
3070
|
-
at()
|
|
3071
|
-
], f.prototype, "hasFocus", 2);
|
|
3072
|
-
a([
|
|
3073
|
-
at()
|
|
3074
|
-
], f.prototype, "invalid", 2);
|
|
3075
|
-
a([
|
|
3076
|
-
u()
|
|
3077
|
-
], f.prototype, "title", 2);
|
|
3078
|
-
a([
|
|
3079
|
-
u({ reflect: !0 })
|
|
3080
|
-
], f.prototype, "variant", 2);
|
|
3081
|
-
a([
|
|
3082
|
-
u({ reflect: !0 })
|
|
3083
|
-
], f.prototype, "size", 2);
|
|
3084
|
-
a([
|
|
3085
|
-
u({ type: Boolean, reflect: !0 })
|
|
3086
|
-
], f.prototype, "caret", 2);
|
|
3087
|
-
a([
|
|
3088
|
-
u({ type: Boolean, reflect: !0 })
|
|
3089
|
-
], f.prototype, "disabled", 2);
|
|
3090
|
-
a([
|
|
3091
|
-
u({ type: Boolean, reflect: !0 })
|
|
3092
|
-
], f.prototype, "loading", 2);
|
|
3093
|
-
a([
|
|
3094
|
-
u({ type: Boolean, reflect: !0 })
|
|
3095
|
-
], f.prototype, "outline", 2);
|
|
3096
|
-
a([
|
|
3097
|
-
u({ type: Boolean, reflect: !0 })
|
|
3098
|
-
], f.prototype, "pill", 2);
|
|
3099
|
-
a([
|
|
3100
|
-
u({ type: Boolean, reflect: !0 })
|
|
3101
|
-
], f.prototype, "circle", 2);
|
|
3102
|
-
a([
|
|
3103
|
-
u()
|
|
3104
|
-
], f.prototype, "type", 2);
|
|
3105
|
-
a([
|
|
3106
|
-
u()
|
|
3107
|
-
], f.prototype, "name", 2);
|
|
3108
|
-
a([
|
|
3109
|
-
u()
|
|
3110
|
-
], f.prototype, "value", 2);
|
|
3111
|
-
a([
|
|
3112
|
-
u()
|
|
3113
|
-
], f.prototype, "href", 2);
|
|
3114
|
-
a([
|
|
3115
|
-
u()
|
|
3116
|
-
], f.prototype, "target", 2);
|
|
3117
|
-
a([
|
|
3118
|
-
u()
|
|
3119
|
-
], f.prototype, "rel", 2);
|
|
3120
|
-
a([
|
|
3121
|
-
u()
|
|
3122
|
-
], f.prototype, "download", 2);
|
|
3123
|
-
a([
|
|
3124
|
-
u()
|
|
3125
|
-
], f.prototype, "form", 2);
|
|
3126
|
-
a([
|
|
3127
|
-
u({ attribute: "formaction" })
|
|
3128
|
-
], f.prototype, "formAction", 2);
|
|
3129
|
-
a([
|
|
3130
|
-
u({ attribute: "formenctype" })
|
|
3131
|
-
], f.prototype, "formEnctype", 2);
|
|
3132
|
-
a([
|
|
3133
|
-
u({ attribute: "formmethod" })
|
|
3134
|
-
], f.prototype, "formMethod", 2);
|
|
3135
|
-
a([
|
|
3136
|
-
u({ attribute: "formnovalidate", type: Boolean })
|
|
3137
|
-
], f.prototype, "formNoValidate", 2);
|
|
3138
|
-
a([
|
|
3139
|
-
u({ attribute: "formtarget" })
|
|
3140
|
-
], f.prototype, "formTarget", 2);
|
|
3141
|
-
a([
|
|
3142
|
-
M("disabled", { waitUntilFirstUpdate: !0 })
|
|
3143
|
-
], f.prototype, "handleDisabledChange", 1);
|
|
3144
|
-
f.define("sl-button");
|
|
3145
|
-
class wt extends S {
|
|
3146
|
-
constructor() {
|
|
3147
|
-
super(), this.username = "", this.password = "", this.disabled = !1;
|
|
3148
|
-
}
|
|
3149
|
-
handleSubmit(t) {
|
|
3150
|
-
t.preventDefault(), this.dispatchEvent(
|
|
3151
|
-
new CustomEvent("login-attempt", {
|
|
3152
|
-
detail: {
|
|
3153
|
-
username: this.username,
|
|
3154
|
-
password: this.password
|
|
3155
|
-
},
|
|
3156
|
-
bubbles: !0,
|
|
3157
|
-
composed: !0
|
|
3158
|
-
})
|
|
3159
|
-
);
|
|
3160
|
-
}
|
|
3161
|
-
handleInputChange(t) {
|
|
3162
|
-
const { name: e, value: r } = t.target;
|
|
3163
|
-
this[e] = r;
|
|
3164
|
-
}
|
|
3165
|
-
render() {
|
|
3166
|
-
return v`
|
|
3167
|
-
<sl-card>
|
|
3168
|
-
<form @submit="${this.handleSubmit}">
|
|
3169
|
-
<sl-input
|
|
3170
|
-
name="username"
|
|
3171
|
-
placeholder="Username or Email"
|
|
3172
|
-
.value="${this.username}"
|
|
3173
|
-
autocomplete="username"
|
|
3174
|
-
@sl-change="${this.handleInputChange}">
|
|
3175
|
-
</sl-input>
|
|
3176
|
-
<sl-input
|
|
3177
|
-
type="password"
|
|
3178
|
-
name="password"
|
|
3179
|
-
placeholder="Password"
|
|
3180
|
-
.value="${this.password}"
|
|
3181
|
-
autocomplete="current-password"
|
|
3182
|
-
@sl-change="${this.handleInputChange}">
|
|
3183
|
-
</sl-input>
|
|
3184
|
-
<sl-button type="submit" ?disabled="${this.disabled}">Login</sl-button>
|
|
3185
|
-
</form>
|
|
3186
|
-
</sl-card>
|
|
3187
|
-
`;
|
|
1224
|
+
render() {
|
|
1225
|
+
const { state: e, auth: t } = this;
|
|
1226
|
+
return tt(e, t);
|
|
3188
1227
|
}
|
|
3189
1228
|
}
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
--box-shadow: var(--sl-card-shadow);
|
|
3204
|
-
}
|
|
3205
|
-
sl-input, sl-button {
|
|
3206
|
-
width: 100%;
|
|
3207
|
-
margin-bottom: 10px;
|
|
3208
|
-
}
|
|
3209
|
-
`), E(wt, "properties", {
|
|
3210
|
-
username: { type: String },
|
|
3211
|
-
password: { type: String },
|
|
3212
|
-
disabled: { type: Boolean, reflect: !0 }
|
|
3213
|
-
});
|
|
3214
|
-
customElements.define("studio-login", wt);
|
|
3215
|
-
class _t extends S {
|
|
3216
|
-
constructor() {
|
|
3217
|
-
super(), this.currentPassword = "", this.newPassword = "", this.confirmPassword = "";
|
|
3218
|
-
}
|
|
3219
|
-
render() {
|
|
3220
|
-
return v`
|
|
3221
|
-
<form @submit="${this.handleSubmit}">
|
|
3222
|
-
<input type="password" name="currentPassword"
|
|
3223
|
-
autocomplete="current-password"
|
|
3224
|
-
placeholder="Current Password"
|
|
3225
|
-
.value="${this.currentPassword}"
|
|
3226
|
-
@input="${this.updateProperty("currentPassword")}"
|
|
3227
|
-
>
|
|
3228
|
-
<input type="password" name="newPassword"
|
|
3229
|
-
placeholder="New Password"
|
|
3230
|
-
.value="${this.newPassword}"
|
|
3231
|
-
@input="${this.updateProperty("newPassword")}"
|
|
3232
|
-
>
|
|
3233
|
-
<input type="password" name="confirmPassword"
|
|
3234
|
-
placeholder="Confirm New Password"
|
|
3235
|
-
.value="${this.confirmPassword}"
|
|
3236
|
-
@input="${this.updateProperty("confirmPassword")}"
|
|
3237
|
-
>
|
|
3238
|
-
<button type="submit">Change Password</button>
|
|
3239
|
-
</form>
|
|
3240
|
-
`;
|
|
3241
|
-
}
|
|
3242
|
-
updateProperty(t) {
|
|
3243
|
-
return (e) => {
|
|
3244
|
-
this[t] = e.target.value;
|
|
3245
|
-
};
|
|
3246
|
-
}
|
|
3247
|
-
handleSubmit(t) {
|
|
3248
|
-
t.preventDefault(), this.newPassword === this.confirmPassword ? this.dispatchEvent(new CustomEvent("change-password", {
|
|
1229
|
+
customElements.get("auth-app") || customElements.define("auth-app", st);
|
|
1230
|
+
function pt(r) {
|
|
1231
|
+
const e = {
|
|
1232
|
+
config: r,
|
|
1233
|
+
log: (...t) => console.log("[auth]", ...t)
|
|
1234
|
+
};
|
|
1235
|
+
return e.mount = k(ot, e), e.handleTokenRequest = nt(e), e.handleDestroyAuth = at(e), e.presentLoginForm = k(lt, e), e.getToken = k(we, e), e.saveToken = k(ct, e), e.getFreshToken = k(dt, e), e.requestRender = (t) => $e(e, t), e;
|
|
1236
|
+
}
|
|
1237
|
+
function ot(r) {
|
|
1238
|
+
const e = r.config.toolkit.element.ownerDocument.defaultView;
|
|
1239
|
+
[
|
|
1240
|
+
{
|
|
1241
|
+
type: "action:register",
|
|
3249
1242
|
detail: {
|
|
3250
|
-
|
|
3251
|
-
|
|
1243
|
+
actionType: "auth:requestToken",
|
|
1244
|
+
handler: r.handleTokenRequest,
|
|
1245
|
+
modName: "auth"
|
|
3252
1246
|
}
|
|
3253
|
-
}
|
|
3254
|
-
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
type: "action:register",
|
|
1250
|
+
detail: {
|
|
1251
|
+
actionType: "auth:destroy",
|
|
1252
|
+
handler: r.handleDestroyAuth,
|
|
1253
|
+
modName: "auth"
|
|
1254
|
+
}
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
type: "layout:register",
|
|
1258
|
+
detail: {
|
|
1259
|
+
name: "auth:login",
|
|
1260
|
+
slots: ["main"],
|
|
1261
|
+
templateFn: Ge()
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
].forEach((t) => r.config.toolkit.dispatchAction(t)), e.addEventListener("popstate", it(r));
|
|
3255
1265
|
}
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
1266
|
+
function $e(r, e) {
|
|
1267
|
+
const t = r.config.toolkit.element.ownerDocument.defaultView;
|
|
1268
|
+
let s = e;
|
|
1269
|
+
s || (s = Je(r, t.location.pathname)), s && r.config.toolkit.dispatchAction({
|
|
1270
|
+
type: "layout:slot:replace",
|
|
1271
|
+
detail: {
|
|
1272
|
+
layout: "menu-main-task-layout",
|
|
1273
|
+
slot: "main",
|
|
1274
|
+
content: c`<auth-app .state=${s} .auth=${r}></auth-app>`
|
|
3260
1275
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
function it(r) {
|
|
1279
|
+
return (e) => {
|
|
1280
|
+
r.log("onpopstate", e), $e(r);
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
function nt(r) {
|
|
1284
|
+
let e = [], t = !1;
|
|
1285
|
+
const s = (o) => {
|
|
1286
|
+
e.forEach((i) => {
|
|
1287
|
+
i(o);
|
|
1288
|
+
}), e = [];
|
|
1289
|
+
};
|
|
1290
|
+
return async ({ callback: o }) => {
|
|
1291
|
+
let i;
|
|
1292
|
+
try {
|
|
1293
|
+
i = await r.getFreshToken(), o(i);
|
|
1294
|
+
} catch (n) {
|
|
1295
|
+
e.push(o), t || (r.presentLoginForm({ onLogin: s }), t = !0), r.log(n);
|
|
3266
1296
|
}
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
constructor() {
|
|
3275
|
-
super(), this.apibaseurl = "", this.error = "", this.isAwaiting = !1, this.lastResult = void 0, this.forceChangePassword = !1, this.handleLogin = this.handleLogin.bind(this), this.handleLoginResult = this.handleLoginResult.bind(this), this.handleLoginError = this.handleLoginError.bind(this), this.renderPasswordChangeForm = this.renderPasswordChangeForm.bind(this);
|
|
3276
|
-
}
|
|
3277
|
-
handleLogin(t) {
|
|
3278
|
-
this.isAwaiting = !0;
|
|
3279
|
-
const { username: e, password: r } = t.detail, s = mt({ baseUrl: this.apibaseurl });
|
|
3280
|
-
this.requestUpdate(), s.mintToken({ username: e, password: r }).then(this.handleLoginResult).catch(this.handleLoginError);
|
|
3281
|
-
}
|
|
3282
|
-
handleLoginResult(t) {
|
|
3283
|
-
var e;
|
|
3284
|
-
this.error = "", this.isAwaiting = !1, this.lastResult = t, ((e = t.challenge) == null ? void 0 : e.name) === "NEW_PASSWORD_REQUIRED" ? (this.forceChangePassword = !0, this.error = "You must set a new password to continue.") : this.dispatchEvent(new CustomEvent("login-success", { detail: t })), this.requestUpdate();
|
|
3285
|
-
}
|
|
3286
|
-
handleLoginError(t) {
|
|
3287
|
-
var e, r;
|
|
3288
|
-
console.error("Error logging in:", t), this.error = ((r = (e = t == null ? void 0 : t.body) == null ? void 0 : e.error) == null ? void 0 : r.message) || "Invalid username or password", this.isAwaiting = !1, this.requestUpdate();
|
|
3289
|
-
}
|
|
3290
|
-
handleChangePassword(t) {
|
|
3291
|
-
const { currentPassword: e, newPassword: r } = t.detail, { token: s } = this.lastResult, i = mt({ baseUrl: this.apibaseurl });
|
|
3292
|
-
this.requestUpdate(), i.updatePassword({ token: s, currentPassword: e, newPassword: r }).then(() => {
|
|
3293
|
-
this.forceChangePassword = !1, this.error = "Login with your new password.", this.isAwaiting = !1, this.requestUpdate();
|
|
3294
|
-
}).catch((n) => {
|
|
3295
|
-
var d, l;
|
|
3296
|
-
this.error = ((l = (d = n == null ? void 0 : n.body) == null ? void 0 : d.error) == null ? void 0 : l.message) || n.message, this.isAwaiting = !1, this.requestUpdate();
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
function at(r) {
|
|
1300
|
+
return () => {
|
|
1301
|
+
const e = K(r);
|
|
1302
|
+
window.localStorage.removeItem(e), r.config.toolkit.dispatchAction({
|
|
1303
|
+
type: "layout:pop"
|
|
3297
1304
|
});
|
|
3298
|
-
}
|
|
3299
|
-
renderPasswordChangeForm() {
|
|
3300
|
-
return v`
|
|
3301
|
-
<div>
|
|
3302
|
-
${this.error ? v`<div class="error">${this.error}</div>` : null}
|
|
3303
|
-
<studio-change-password @change-password=${this.handleChangePassword}>
|
|
3304
|
-
</studio-change-password>
|
|
3305
|
-
</div>
|
|
3306
|
-
`;
|
|
3307
|
-
}
|
|
3308
|
-
renderLoginForm() {
|
|
3309
|
-
return v`
|
|
3310
|
-
${this.error ? v`<div class="error">${this.error}</div>` : null}
|
|
3311
|
-
<studio-login
|
|
3312
|
-
@login-attempt=${this.handleLogin}
|
|
3313
|
-
?disabled=${this.isAwaiting}
|
|
3314
|
-
></studio-login>
|
|
3315
|
-
`;
|
|
3316
|
-
}
|
|
3317
|
-
render() {
|
|
3318
|
-
return this.forceChangePassword ? this.renderPasswordChangeForm() : this.renderLoginForm();
|
|
3319
|
-
}
|
|
1305
|
+
};
|
|
3320
1306
|
}
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
:
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
1307
|
+
function lt(r, { onLogin: e }) {
|
|
1308
|
+
const { toolkit: t } = r.config, o = new URLSearchParams(
|
|
1309
|
+
t.element.ownerDocument.defaultView.location.search
|
|
1310
|
+
).get("password_reset_confirmation"), i = (n) => {
|
|
1311
|
+
r.log("login success", { event: n });
|
|
1312
|
+
const { token: l } = n.detail;
|
|
1313
|
+
r.log("Login form dismissed", { args: [l] }), t.dispatchAction({
|
|
1314
|
+
type: "layout:pop"
|
|
1315
|
+
}), r.saveToken({ token: l }), e({ token: l });
|
|
1316
|
+
};
|
|
1317
|
+
t.dispatchAction({
|
|
1318
|
+
type: "layout:push",
|
|
1319
|
+
detail: {
|
|
1320
|
+
layout: "auth:login"
|
|
3329
1321
|
}
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
1322
|
+
}), t.dispatchAction({
|
|
1323
|
+
type: "layout:slot:push",
|
|
1324
|
+
detail: {
|
|
1325
|
+
layout: "auth:login",
|
|
1326
|
+
slot: "main",
|
|
1327
|
+
content: c`<auth-login-form
|
|
1328
|
+
api=${r.config.api}
|
|
1329
|
+
confirmation="${o}"
|
|
1330
|
+
@login-success=${i}>
|
|
1331
|
+
</auth-login-form>`
|
|
3340
1332
|
}
|
|
3341
|
-
const i = (l) => (window.sessionStorage.setItem(K(), l), l);
|
|
3342
|
-
let n;
|
|
3343
|
-
const d = (l) => {
|
|
3344
|
-
const { token: c } = l.detail;
|
|
3345
|
-
i(c), e(c), o.pub("system::workspace", "dismiss", n);
|
|
3346
|
-
};
|
|
3347
|
-
n = v`<mod-auth-login-form
|
|
3348
|
-
id="login"
|
|
3349
|
-
apibaseurl=${t.apibaseurl}
|
|
3350
|
-
@login-success=${d}></mod-auth-login-form>`, o.pub("system::workspace", "present", n);
|
|
3351
1333
|
});
|
|
3352
1334
|
}
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
function $o({ studio: o }) {
|
|
3358
|
-
window.sessionStorage.removeItem(K());
|
|
1335
|
+
function ct(r, { token: e }) {
|
|
1336
|
+
r.log("saving token", { args: [e] });
|
|
1337
|
+
const t = K(r);
|
|
1338
|
+
window.localStorage.setItem(t, e);
|
|
3359
1339
|
}
|
|
3360
|
-
function
|
|
3361
|
-
|
|
1340
|
+
function we(r) {
|
|
1341
|
+
const e = K(r);
|
|
1342
|
+
return window.localStorage.getItem(e);
|
|
3362
1343
|
}
|
|
3363
|
-
function
|
|
3364
|
-
|
|
1344
|
+
async function dt(r) {
|
|
1345
|
+
const e = we(r);
|
|
1346
|
+
if (!e || e.length < 1)
|
|
1347
|
+
throw new Error("No token found");
|
|
1348
|
+
return Qe(e) ? (r.log("refreshing token", { args: [e] }), await x({
|
|
1349
|
+
baseUrl: r.config.api
|
|
1350
|
+
}).refreshToken({ token: e }).then(({ token: s }) => s)) : e;
|
|
3365
1351
|
}
|
|
3366
|
-
function K() {
|
|
3367
|
-
return
|
|
3368
|
-
}
|
|
3369
|
-
function Eo(o, t) {
|
|
3370
|
-
o.sub("studio.wral::mod-auth", "token-request", ({ state: e }) => {
|
|
3371
|
-
const { callback: r } = e.value;
|
|
3372
|
-
r ? be({ studio: o, config: t }).then((s) => r(s)).catch((s) => r(null, s)) : console.warn("No token callback defined");
|
|
3373
|
-
}), o.sub("studio.wral::mod-auth", "logout", () => {
|
|
3374
|
-
$o({ studio: o });
|
|
3375
|
-
});
|
|
1352
|
+
function K({ storageKey: r = "token" }) {
|
|
1353
|
+
return r;
|
|
3376
1354
|
}
|
|
3377
1355
|
export {
|
|
3378
|
-
|
|
1356
|
+
dt as getFreshToken,
|
|
1357
|
+
we as getToken,
|
|
1358
|
+
K as getTokenStorageKey,
|
|
1359
|
+
it as historyStateHandler,
|
|
1360
|
+
at as loginDestroyHandler,
|
|
1361
|
+
pt as makeAuth,
|
|
1362
|
+
ot as mount,
|
|
1363
|
+
lt as presentLoginForm,
|
|
1364
|
+
$e as renderApp,
|
|
1365
|
+
ct as saveToken,
|
|
1366
|
+
nt as tokenRequestHandler
|
|
3379
1367
|
};
|