ufc-itapaje-accessibility 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.
@@ -0,0 +1,2472 @@
1
+ "use strict";
2
+ var Accessibility = (() => {
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJS = (cb, mod) => function __require() {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
+
34
+ // node_modules/regenerator-runtime/runtime.js
35
+ var require_runtime = __commonJS({
36
+ "node_modules/regenerator-runtime/runtime.js"(exports, module) {
37
+ "use strict";
38
+ var runtime = (function(exports2) {
39
+ "use strict";
40
+ var Op = Object.prototype;
41
+ var hasOwn = Op.hasOwnProperty;
42
+ var defineProperty = Object.defineProperty || function(obj, key, desc) {
43
+ obj[key] = desc.value;
44
+ };
45
+ var undefined2;
46
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
47
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
48
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
49
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
50
+ function define(obj, key, value) {
51
+ Object.defineProperty(obj, key, {
52
+ value,
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true
56
+ });
57
+ return obj[key];
58
+ }
59
+ try {
60
+ define({}, "");
61
+ } catch (err) {
62
+ define = function(obj, key, value) {
63
+ return obj[key] = value;
64
+ };
65
+ }
66
+ function wrap(innerFn, outerFn, self, tryLocsList) {
67
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
68
+ var generator = Object.create(protoGenerator.prototype);
69
+ var context = new Context(tryLocsList || []);
70
+ defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) });
71
+ return generator;
72
+ }
73
+ exports2.wrap = wrap;
74
+ function tryCatch(fn, obj, arg) {
75
+ try {
76
+ return { type: "normal", arg: fn.call(obj, arg) };
77
+ } catch (err) {
78
+ return { type: "throw", arg: err };
79
+ }
80
+ }
81
+ var GenStateSuspendedStart = "suspendedStart";
82
+ var GenStateSuspendedYield = "suspendedYield";
83
+ var GenStateExecuting = "executing";
84
+ var GenStateCompleted = "completed";
85
+ var ContinueSentinel = {};
86
+ function Generator() {
87
+ }
88
+ function GeneratorFunction() {
89
+ }
90
+ function GeneratorFunctionPrototype() {
91
+ }
92
+ var IteratorPrototype = {};
93
+ define(IteratorPrototype, iteratorSymbol, function() {
94
+ return this;
95
+ });
96
+ var getProto = Object.getPrototypeOf;
97
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
98
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
99
+ IteratorPrototype = NativeIteratorPrototype;
100
+ }
101
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
102
+ GeneratorFunction.prototype = GeneratorFunctionPrototype;
103
+ defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: true });
104
+ defineProperty(
105
+ GeneratorFunctionPrototype,
106
+ "constructor",
107
+ { value: GeneratorFunction, configurable: true }
108
+ );
109
+ GeneratorFunction.displayName = define(
110
+ GeneratorFunctionPrototype,
111
+ toStringTagSymbol,
112
+ "GeneratorFunction"
113
+ );
114
+ function defineIteratorMethods(prototype) {
115
+ ["next", "throw", "return"].forEach(function(method) {
116
+ define(prototype, method, function(arg) {
117
+ return this._invoke(method, arg);
118
+ });
119
+ });
120
+ }
121
+ exports2.isGeneratorFunction = function(genFun) {
122
+ var ctor = typeof genFun === "function" && genFun.constructor;
123
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
124
+ // do is to check its .name property.
125
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
126
+ };
127
+ exports2.mark = function(genFun) {
128
+ if (Object.setPrototypeOf) {
129
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
130
+ } else {
131
+ genFun.__proto__ = GeneratorFunctionPrototype;
132
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
133
+ }
134
+ genFun.prototype = Object.create(Gp);
135
+ return genFun;
136
+ };
137
+ exports2.awrap = function(arg) {
138
+ return { __await: arg };
139
+ };
140
+ function AsyncIterator(generator, PromiseImpl) {
141
+ function invoke(method, arg, resolve, reject) {
142
+ var record = tryCatch(generator[method], generator, arg);
143
+ if (record.type === "throw") {
144
+ reject(record.arg);
145
+ } else {
146
+ var result = record.arg;
147
+ var value = result.value;
148
+ if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
149
+ return PromiseImpl.resolve(value.__await).then(function(value2) {
150
+ invoke("next", value2, resolve, reject);
151
+ }, function(err) {
152
+ invoke("throw", err, resolve, reject);
153
+ });
154
+ }
155
+ return PromiseImpl.resolve(value).then(function(unwrapped) {
156
+ result.value = unwrapped;
157
+ resolve(result);
158
+ }, function(error) {
159
+ return invoke("throw", error, resolve, reject);
160
+ });
161
+ }
162
+ }
163
+ var previousPromise;
164
+ function enqueue(method, arg) {
165
+ function callInvokeWithMethodAndArg() {
166
+ return new PromiseImpl(function(resolve, reject) {
167
+ invoke(method, arg, resolve, reject);
168
+ });
169
+ }
170
+ return previousPromise = // If enqueue has been called before, then we want to wait until
171
+ // all previous Promises have been resolved before calling invoke,
172
+ // so that results are always delivered in the correct order. If
173
+ // enqueue has not been called before, then it is important to
174
+ // call invoke immediately, without waiting on a callback to fire,
175
+ // so that the async generator function has the opportunity to do
176
+ // any necessary setup in a predictable way. This predictability
177
+ // is why the Promise constructor synchronously invokes its
178
+ // executor callback, and why async functions synchronously
179
+ // execute code before the first await. Since we implement simple
180
+ // async functions in terms of async generators, it is especially
181
+ // important to get this right, even though it requires care.
182
+ previousPromise ? previousPromise.then(
183
+ callInvokeWithMethodAndArg,
184
+ // Avoid propagating failures to Promises returned by later
185
+ // invocations of the iterator.
186
+ callInvokeWithMethodAndArg
187
+ ) : callInvokeWithMethodAndArg();
188
+ }
189
+ defineProperty(this, "_invoke", { value: enqueue });
190
+ }
191
+ defineIteratorMethods(AsyncIterator.prototype);
192
+ define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
193
+ return this;
194
+ });
195
+ exports2.AsyncIterator = AsyncIterator;
196
+ exports2.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
197
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
198
+ var iter = new AsyncIterator(
199
+ wrap(innerFn, outerFn, self, tryLocsList),
200
+ PromiseImpl
201
+ );
202
+ return exports2.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
203
+ return result.done ? result.value : iter.next();
204
+ });
205
+ };
206
+ function makeInvokeMethod(innerFn, self, context) {
207
+ var state = GenStateSuspendedStart;
208
+ return function invoke(method, arg) {
209
+ if (state === GenStateExecuting) {
210
+ throw new Error("Generator is already running");
211
+ }
212
+ if (state === GenStateCompleted) {
213
+ if (method === "throw") {
214
+ throw arg;
215
+ }
216
+ return doneResult();
217
+ }
218
+ context.method = method;
219
+ context.arg = arg;
220
+ while (true) {
221
+ var delegate = context.delegate;
222
+ if (delegate) {
223
+ var delegateResult = maybeInvokeDelegate(delegate, context);
224
+ if (delegateResult) {
225
+ if (delegateResult === ContinueSentinel) continue;
226
+ return delegateResult;
227
+ }
228
+ }
229
+ if (context.method === "next") {
230
+ context.sent = context._sent = context.arg;
231
+ } else if (context.method === "throw") {
232
+ if (state === GenStateSuspendedStart) {
233
+ state = GenStateCompleted;
234
+ throw context.arg;
235
+ }
236
+ context.dispatchException(context.arg);
237
+ } else if (context.method === "return") {
238
+ context.abrupt("return", context.arg);
239
+ }
240
+ state = GenStateExecuting;
241
+ var record = tryCatch(innerFn, self, context);
242
+ if (record.type === "normal") {
243
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
244
+ if (record.arg === ContinueSentinel) {
245
+ continue;
246
+ }
247
+ return {
248
+ value: record.arg,
249
+ done: context.done
250
+ };
251
+ } else if (record.type === "throw") {
252
+ state = GenStateCompleted;
253
+ context.method = "throw";
254
+ context.arg = record.arg;
255
+ }
256
+ }
257
+ };
258
+ }
259
+ function maybeInvokeDelegate(delegate, context) {
260
+ var methodName = context.method;
261
+ var method = delegate.iterator[methodName];
262
+ if (method === undefined2) {
263
+ context.delegate = null;
264
+ if (methodName === "throw" && delegate.iterator["return"]) {
265
+ context.method = "return";
266
+ context.arg = undefined2;
267
+ maybeInvokeDelegate(delegate, context);
268
+ if (context.method === "throw") {
269
+ return ContinueSentinel;
270
+ }
271
+ }
272
+ if (methodName !== "return") {
273
+ context.method = "throw";
274
+ context.arg = new TypeError(
275
+ "The iterator does not provide a '" + methodName + "' method"
276
+ );
277
+ }
278
+ return ContinueSentinel;
279
+ }
280
+ var record = tryCatch(method, delegate.iterator, context.arg);
281
+ if (record.type === "throw") {
282
+ context.method = "throw";
283
+ context.arg = record.arg;
284
+ context.delegate = null;
285
+ return ContinueSentinel;
286
+ }
287
+ var info = record.arg;
288
+ if (!info) {
289
+ context.method = "throw";
290
+ context.arg = new TypeError("iterator result is not an object");
291
+ context.delegate = null;
292
+ return ContinueSentinel;
293
+ }
294
+ if (info.done) {
295
+ context[delegate.resultName] = info.value;
296
+ context.next = delegate.nextLoc;
297
+ if (context.method !== "return") {
298
+ context.method = "next";
299
+ context.arg = undefined2;
300
+ }
301
+ } else {
302
+ return info;
303
+ }
304
+ context.delegate = null;
305
+ return ContinueSentinel;
306
+ }
307
+ defineIteratorMethods(Gp);
308
+ define(Gp, toStringTagSymbol, "Generator");
309
+ define(Gp, iteratorSymbol, function() {
310
+ return this;
311
+ });
312
+ define(Gp, "toString", function() {
313
+ return "[object Generator]";
314
+ });
315
+ function pushTryEntry(locs) {
316
+ var entry = { tryLoc: locs[0] };
317
+ if (1 in locs) {
318
+ entry.catchLoc = locs[1];
319
+ }
320
+ if (2 in locs) {
321
+ entry.finallyLoc = locs[2];
322
+ entry.afterLoc = locs[3];
323
+ }
324
+ this.tryEntries.push(entry);
325
+ }
326
+ function resetTryEntry(entry) {
327
+ var record = entry.completion || {};
328
+ record.type = "normal";
329
+ delete record.arg;
330
+ entry.completion = record;
331
+ }
332
+ function Context(tryLocsList) {
333
+ this.tryEntries = [{ tryLoc: "root" }];
334
+ tryLocsList.forEach(pushTryEntry, this);
335
+ this.reset(true);
336
+ }
337
+ exports2.keys = function(val) {
338
+ var object = Object(val);
339
+ var keys = [];
340
+ for (var key in object) {
341
+ keys.push(key);
342
+ }
343
+ keys.reverse();
344
+ return function next() {
345
+ while (keys.length) {
346
+ var key2 = keys.pop();
347
+ if (key2 in object) {
348
+ next.value = key2;
349
+ next.done = false;
350
+ return next;
351
+ }
352
+ }
353
+ next.done = true;
354
+ return next;
355
+ };
356
+ };
357
+ function values(iterable) {
358
+ if (iterable != null) {
359
+ var iteratorMethod = iterable[iteratorSymbol];
360
+ if (iteratorMethod) {
361
+ return iteratorMethod.call(iterable);
362
+ }
363
+ if (typeof iterable.next === "function") {
364
+ return iterable;
365
+ }
366
+ if (!isNaN(iterable.length)) {
367
+ var i = -1, next = function next2() {
368
+ while (++i < iterable.length) {
369
+ if (hasOwn.call(iterable, i)) {
370
+ next2.value = iterable[i];
371
+ next2.done = false;
372
+ return next2;
373
+ }
374
+ }
375
+ next2.value = undefined2;
376
+ next2.done = true;
377
+ return next2;
378
+ };
379
+ return next.next = next;
380
+ }
381
+ }
382
+ throw new TypeError(typeof iterable + " is not iterable");
383
+ }
384
+ exports2.values = values;
385
+ function doneResult() {
386
+ return { value: undefined2, done: true };
387
+ }
388
+ Context.prototype = {
389
+ constructor: Context,
390
+ reset: function(skipTempReset) {
391
+ this.prev = 0;
392
+ this.next = 0;
393
+ this.sent = this._sent = undefined2;
394
+ this.done = false;
395
+ this.delegate = null;
396
+ this.method = "next";
397
+ this.arg = undefined2;
398
+ this.tryEntries.forEach(resetTryEntry);
399
+ if (!skipTempReset) {
400
+ for (var name in this) {
401
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
402
+ this[name] = undefined2;
403
+ }
404
+ }
405
+ }
406
+ },
407
+ stop: function() {
408
+ this.done = true;
409
+ var rootEntry = this.tryEntries[0];
410
+ var rootRecord = rootEntry.completion;
411
+ if (rootRecord.type === "throw") {
412
+ throw rootRecord.arg;
413
+ }
414
+ return this.rval;
415
+ },
416
+ dispatchException: function(exception) {
417
+ if (this.done) {
418
+ throw exception;
419
+ }
420
+ var context = this;
421
+ function handle(loc, caught) {
422
+ record.type = "throw";
423
+ record.arg = exception;
424
+ context.next = loc;
425
+ if (caught) {
426
+ context.method = "next";
427
+ context.arg = undefined2;
428
+ }
429
+ return !!caught;
430
+ }
431
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
432
+ var entry = this.tryEntries[i];
433
+ var record = entry.completion;
434
+ if (entry.tryLoc === "root") {
435
+ return handle("end");
436
+ }
437
+ if (entry.tryLoc <= this.prev) {
438
+ var hasCatch = hasOwn.call(entry, "catchLoc");
439
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
440
+ if (hasCatch && hasFinally) {
441
+ if (this.prev < entry.catchLoc) {
442
+ return handle(entry.catchLoc, true);
443
+ } else if (this.prev < entry.finallyLoc) {
444
+ return handle(entry.finallyLoc);
445
+ }
446
+ } else if (hasCatch) {
447
+ if (this.prev < entry.catchLoc) {
448
+ return handle(entry.catchLoc, true);
449
+ }
450
+ } else if (hasFinally) {
451
+ if (this.prev < entry.finallyLoc) {
452
+ return handle(entry.finallyLoc);
453
+ }
454
+ } else {
455
+ throw new Error("try statement without catch or finally");
456
+ }
457
+ }
458
+ }
459
+ },
460
+ abrupt: function(type, arg) {
461
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
462
+ var entry = this.tryEntries[i];
463
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
464
+ var finallyEntry = entry;
465
+ break;
466
+ }
467
+ }
468
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
469
+ finallyEntry = null;
470
+ }
471
+ var record = finallyEntry ? finallyEntry.completion : {};
472
+ record.type = type;
473
+ record.arg = arg;
474
+ if (finallyEntry) {
475
+ this.method = "next";
476
+ this.next = finallyEntry.finallyLoc;
477
+ return ContinueSentinel;
478
+ }
479
+ return this.complete(record);
480
+ },
481
+ complete: function(record, afterLoc) {
482
+ if (record.type === "throw") {
483
+ throw record.arg;
484
+ }
485
+ if (record.type === "break" || record.type === "continue") {
486
+ this.next = record.arg;
487
+ } else if (record.type === "return") {
488
+ this.rval = this.arg = record.arg;
489
+ this.method = "return";
490
+ this.next = "end";
491
+ } else if (record.type === "normal" && afterLoc) {
492
+ this.next = afterLoc;
493
+ }
494
+ return ContinueSentinel;
495
+ },
496
+ finish: function(finallyLoc) {
497
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
498
+ var entry = this.tryEntries[i];
499
+ if (entry.finallyLoc === finallyLoc) {
500
+ this.complete(entry.completion, entry.afterLoc);
501
+ resetTryEntry(entry);
502
+ return ContinueSentinel;
503
+ }
504
+ }
505
+ },
506
+ "catch": function(tryLoc) {
507
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
508
+ var entry = this.tryEntries[i];
509
+ if (entry.tryLoc === tryLoc) {
510
+ var record = entry.completion;
511
+ if (record.type === "throw") {
512
+ var thrown = record.arg;
513
+ resetTryEntry(entry);
514
+ }
515
+ return thrown;
516
+ }
517
+ }
518
+ throw new Error("illegal catch attempt");
519
+ },
520
+ delegateYield: function(iterable, resultName, nextLoc) {
521
+ this.delegate = {
522
+ iterator: values(iterable),
523
+ resultName,
524
+ nextLoc
525
+ };
526
+ if (this.method === "next") {
527
+ this.arg = undefined2;
528
+ }
529
+ return ContinueSentinel;
530
+ }
531
+ };
532
+ return exports2;
533
+ })(
534
+ // If this script is executing as a CommonJS module, use module.exports
535
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
536
+ // object. Either way, the resulting object will be used to initialize
537
+ // the regeneratorRuntime variable at the top of this file.
538
+ typeof module === "object" ? module.exports : {}
539
+ );
540
+ try {
541
+ regeneratorRuntime = runtime;
542
+ } catch (accidentalStrictMode) {
543
+ if (typeof globalThis === "object") {
544
+ globalThis.regeneratorRuntime = runtime;
545
+ } else {
546
+ Function("r", "regeneratorRuntime = r")(runtime);
547
+ }
548
+ }
549
+ }
550
+ });
551
+
552
+ // src/accessibility.ts
553
+ var accessibility_exports = {};
554
+ __export(accessibility_exports, {
555
+ Accessibility: () => main_default,
556
+ AccessibilityModulesType: () => AccessibilityModulesType,
557
+ applyTheme: () => applyTheme,
558
+ createModule: () => createModule,
559
+ createModules: () => createModules,
560
+ createThemeCss: () => createThemeCss,
561
+ default: () => accessibility_default,
562
+ ptBRLabels: () => ptBRLabels,
563
+ removeTheme: () => removeTheme
564
+ });
565
+
566
+ // src/main.ts
567
+ var import_runtime = __toESM(require_runtime());
568
+
569
+ // src/common.ts
570
+ var _Common = class _Common {
571
+ constructor() {
572
+ this.body = document.body || document.querySelector("body");
573
+ this.deployedMap = /* @__PURE__ */ new Map();
574
+ }
575
+ isIOS() {
576
+ if (typeof this._isIOS === "boolean") return this._isIOS;
577
+ const devices = ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"];
578
+ this._isIOS = !!navigator.platform && devices.some((d) => navigator.platform === d);
579
+ return this._isIOS;
580
+ }
581
+ jsonToHtml(obj) {
582
+ var _a, _b, _c;
583
+ let elm = document.createElement(obj.type);
584
+ for (let i in obj.attrs) {
585
+ elm.setAttribute(i, obj.attrs[i]);
586
+ }
587
+ for (const child of (_a = obj.children) != null ? _a : []) {
588
+ let newElem = null;
589
+ if (child.type === "#text") {
590
+ newElem = document.createTextNode((_b = child.text) != null ? _b : "");
591
+ } else {
592
+ newElem = this.jsonToHtml(child);
593
+ }
594
+ if (((_c = newElem == null ? void 0 : newElem.tagName) == null ? void 0 : _c.toLowerCase()) !== "undefined" || newElem.nodeType === 3)
595
+ elm.appendChild(newElem);
596
+ }
597
+ return elm;
598
+ }
599
+ injectStyle(css, innerOptions = {}) {
600
+ let sheet = document.createElement("style");
601
+ sheet.appendChild(document.createTextNode(css));
602
+ if (innerOptions.className) sheet.classList.add(innerOptions.className);
603
+ this.body.appendChild(sheet);
604
+ return sheet;
605
+ }
606
+ getFormattedDim(value) {
607
+ if (!value) return null;
608
+ value = String(value);
609
+ const by = (val, suffix) => ({
610
+ size: val.substring(0, val.indexOf(suffix)),
611
+ suffix
612
+ });
613
+ if (value.includes("%")) return by(value, "%");
614
+ if (value.includes("rem")) return by(value, "rem");
615
+ if (value.includes("px")) return by(value, "px");
616
+ if (value.includes("em")) return by(value, "em");
617
+ if (value.includes("pt")) return by(value, "pt");
618
+ if (value === "auto") return by(value, "");
619
+ return null;
620
+ }
621
+ extend(src, dest) {
622
+ for (let i in src) {
623
+ if (typeof src[i] === "object") {
624
+ if (dest && dest[i]) {
625
+ if (dest[i] instanceof Array) src[i] = dest[i];
626
+ else src[i] = this.extend(src[i], dest[i]);
627
+ }
628
+ } else if (typeof dest === "object" && typeof dest[i] !== "undefined") {
629
+ src[i] = dest[i];
630
+ }
631
+ }
632
+ return src;
633
+ }
634
+ injectIconsFont(urls, callback) {
635
+ if (!(urls == null ? void 0 : urls.length)) return;
636
+ let head = document.getElementsByTagName("head")[0];
637
+ let counter = 0;
638
+ let hasErrors = false;
639
+ let onload = (e) => {
640
+ if (typeof e === "string" || e.type === "error") hasErrors = true;
641
+ if (!--counter) callback(hasErrors);
642
+ };
643
+ urls.forEach((url) => {
644
+ let link = document.createElement("link");
645
+ link.type = "text/css";
646
+ link.rel = "stylesheet";
647
+ link.href = url;
648
+ link.className = `_access-font-icon-${counter++}`;
649
+ link.onload = onload;
650
+ link.onerror = onload;
651
+ this.deployedObjects.set("." + link.className, true);
652
+ head.appendChild(link);
653
+ });
654
+ }
655
+ getFixedFont(name) {
656
+ if (this.isIOS()) return name.replaceAll(" ", "+");
657
+ return name;
658
+ }
659
+ getFixedPseudoFont(name) {
660
+ if (this.isIOS()) return name.replaceAll("+", " ");
661
+ return name;
662
+ }
663
+ isFontLoaded(fontFamily, callback) {
664
+ try {
665
+ const onReady = () => callback(document.fonts.check(`1em ${fontFamily.replaceAll("+", " ")}`));
666
+ document.fonts.ready.then(onReady, onReady);
667
+ } catch (e) {
668
+ callback(true);
669
+ }
670
+ }
671
+ warn(msg) {
672
+ const prefix = "AccessibilityWidget: ";
673
+ (console.warn || console.log)(prefix + msg);
674
+ }
675
+ get deployedObjects() {
676
+ return {
677
+ get: (key) => this.deployedMap.get(key),
678
+ contains: (key) => this.deployedMap.has(key),
679
+ set: (key, val) => {
680
+ this.deployedMap.set(key, val);
681
+ },
682
+ remove: (key) => {
683
+ this.deployedMap.delete(key);
684
+ },
685
+ getAll: () => this.deployedMap
686
+ };
687
+ }
688
+ createScreenshot(url) {
689
+ return new Promise((resolve) => {
690
+ if (!this._canvas) this._canvas = document.createElement("canvas");
691
+ const img = new Image();
692
+ this._canvas.style.cssText = "position:fixed;top:0;left:0;opacity:0.05;transform:scale(0.05)";
693
+ img.crossOrigin = "anonymous";
694
+ img.onload = () => {
695
+ document.body.appendChild(this._canvas);
696
+ const ctx = this._canvas.getContext("2d");
697
+ this._canvas.width = img.naturalWidth;
698
+ this._canvas.height = img.naturalHeight;
699
+ ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
700
+ ctx.drawImage(img, 0, 0);
701
+ let res = _Common.DEFAULT_PIXEL;
702
+ try {
703
+ res = this._canvas.toDataURL("image/png");
704
+ } catch (e) {
705
+ }
706
+ resolve(res);
707
+ this._canvas.remove();
708
+ };
709
+ img.onerror = () => resolve(_Common.DEFAULT_PIXEL);
710
+ img.src = url;
711
+ });
712
+ }
713
+ getFileExtension(filename) {
714
+ return filename.substring(filename.lastIndexOf(".") + 1) || filename;
715
+ }
716
+ };
717
+ _Common.DEFAULT_PIXEL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";
718
+ var Common = _Common;
719
+
720
+ // src/interfaces/accessibility.interface.ts
721
+ var AccessibilityModulesType = /* @__PURE__ */ ((AccessibilityModulesType2) => {
722
+ AccessibilityModulesType2[AccessibilityModulesType2["increaseText"] = 1] = "increaseText";
723
+ AccessibilityModulesType2[AccessibilityModulesType2["decreaseText"] = 2] = "decreaseText";
724
+ AccessibilityModulesType2[AccessibilityModulesType2["increaseTextSpacing"] = 3] = "increaseTextSpacing";
725
+ AccessibilityModulesType2[AccessibilityModulesType2["decreaseTextSpacing"] = 4] = "decreaseTextSpacing";
726
+ AccessibilityModulesType2[AccessibilityModulesType2["increaseLineHeight"] = 5] = "increaseLineHeight";
727
+ AccessibilityModulesType2[AccessibilityModulesType2["decreaseLineHeight"] = 6] = "decreaseLineHeight";
728
+ AccessibilityModulesType2[AccessibilityModulesType2["invertColors"] = 7] = "invertColors";
729
+ AccessibilityModulesType2[AccessibilityModulesType2["grayHues"] = 8] = "grayHues";
730
+ AccessibilityModulesType2[AccessibilityModulesType2["bigCursor"] = 9] = "bigCursor";
731
+ AccessibilityModulesType2[AccessibilityModulesType2["readingGuide"] = 10] = "readingGuide";
732
+ AccessibilityModulesType2[AccessibilityModulesType2["underlineLinks"] = 11] = "underlineLinks";
733
+ AccessibilityModulesType2[AccessibilityModulesType2["textToSpeech"] = 12] = "textToSpeech";
734
+ AccessibilityModulesType2[AccessibilityModulesType2["speechToText"] = 13] = "speechToText";
735
+ AccessibilityModulesType2[AccessibilityModulesType2["disableAnimations"] = 14] = "disableAnimations";
736
+ AccessibilityModulesType2[AccessibilityModulesType2["iframeModals"] = 15] = "iframeModals";
737
+ AccessibilityModulesType2[AccessibilityModulesType2["customFunctions"] = 16] = "customFunctions";
738
+ AccessibilityModulesType2[AccessibilityModulesType2["dyslexicFont"] = 17] = "dyslexicFont";
739
+ AccessibilityModulesType2[AccessibilityModulesType2["hideImages"] = 18] = "hideImages";
740
+ return AccessibilityModulesType2;
741
+ })(AccessibilityModulesType || {});
742
+
743
+ // src/menu-interface.ts
744
+ var MenuInterface = class {
745
+ constructor(accessibility) {
746
+ this._acc = accessibility;
747
+ this.readBind = this._acc.read.bind(this._acc);
748
+ }
749
+ updateCycleButton(btn, level, max) {
750
+ if (level > 0) btn.classList.add("active");
751
+ else btn.classList.remove("active");
752
+ let indicator = btn.querySelector("._access-cycle-indicator");
753
+ if (!indicator) {
754
+ indicator = document.createElement("div");
755
+ indicator.className = "_access-cycle-indicator";
756
+ for (let i = 0; i < max; i++) indicator.appendChild(document.createElement("span"));
757
+ btn.appendChild(indicator);
758
+ }
759
+ indicator.querySelectorAll("span").forEach((span, i) => span.classList.toggle("filled", i < level));
760
+ }
761
+ refreshCycleButtons() {
762
+ const find = (action) => {
763
+ var _a;
764
+ return (_a = this._acc.menu) == null ? void 0 : _a.querySelector(`[data-access-action="${action}"]`);
765
+ };
766
+ const t = find("increaseText");
767
+ if (t) this.updateCycleButton(t, this._acc.sessionState.textSize, 3);
768
+ const s = find("increaseTextSpacing");
769
+ if (s) this.updateCycleButton(s, this._acc.sessionState.textSpace, 3);
770
+ const l = find("increaseLineHeight");
771
+ if (l) this.updateCycleButton(l, this._acc.sessionState.lineHeight, 3);
772
+ }
773
+ increaseText(_destroy, btn) {
774
+ if (this._acc.sessionState.textSize >= 3) {
775
+ this._acc.resetTextSize();
776
+ } else {
777
+ this._acc.alterTextSize(true);
778
+ }
779
+ if (btn) this.updateCycleButton(btn, this._acc.sessionState.textSize, 3);
780
+ }
781
+ decreaseText() {
782
+ this._acc.alterTextSize(false);
783
+ }
784
+ increaseTextSpacing(_destroy, btn) {
785
+ if (this._acc.sessionState.textSpace >= 3) {
786
+ this._acc.resetTextSpace();
787
+ } else {
788
+ this._acc.alterTextSpace(true);
789
+ }
790
+ if (btn) this.updateCycleButton(btn, this._acc.sessionState.textSpace, 3);
791
+ }
792
+ decreaseTextSpacing() {
793
+ this._acc.alterTextSpace(false);
794
+ }
795
+ increaseLineHeight(_destroy, btn) {
796
+ if (this._acc.sessionState.lineHeight >= 3) {
797
+ this._acc.resetLineHeight();
798
+ } else {
799
+ this._acc.alterLineHeight(true);
800
+ }
801
+ if (btn) this.updateCycleButton(btn, this._acc.sessionState.lineHeight, 3);
802
+ }
803
+ decreaseLineHeight() {
804
+ this._acc.alterLineHeight(false);
805
+ }
806
+ invertColors(destroy) {
807
+ var _a, _b;
808
+ const counterClass = "_access-invert-counter";
809
+ const removeCounter = () => {
810
+ var _a2;
811
+ return (_a2 = document.querySelector("." + counterClass)) == null ? void 0 : _a2.remove();
812
+ };
813
+ if (typeof this._acc.stateValues.html.backgroundColor === "undefined")
814
+ this._acc.stateValues.html.backgroundColor = getComputedStyle(this._acc.html).backgroundColor;
815
+ if (typeof this._acc.stateValues.html.color === "undefined")
816
+ this._acc.stateValues.html.color = getComputedStyle(this._acc.html).color;
817
+ if (destroy) {
818
+ this._acc.resetIfDefined(this._acc.stateValues.html.backgroundColor, this._acc.html.style, "backgroundColor");
819
+ this._acc.resetIfDefined(this._acc.stateValues.html.color, this._acc.html.style, "color");
820
+ if (!this._acc.options.suppressDomInjection)
821
+ (_a = this._acc.menu.querySelector('[data-access-action="invertColors"]')) == null ? void 0 : _a.classList.remove("active");
822
+ this._acc.stateValues.invertColors = false;
823
+ this._acc.sessionState.invertColors = false;
824
+ this._acc.onChange(true);
825
+ this._acc.html.style.filter = "";
826
+ removeCounter();
827
+ return;
828
+ }
829
+ if (!this._acc.options.suppressDomInjection)
830
+ (_b = this._acc.menu.querySelector('[data-access-action="invertColors"]')) == null ? void 0 : _b.classList.toggle("active");
831
+ this._acc.stateValues.invertColors = !this._acc.stateValues.invertColors;
832
+ this._acc.sessionState.invertColors = this._acc.stateValues.invertColors;
833
+ this._acc.onChange(true);
834
+ if (this._acc.stateValues.invertColors) {
835
+ if (this._acc.stateValues.grayHues) this._acc.menuInterface.grayHues(true);
836
+ this._acc.html.style.filter = "invert(1)";
837
+ this._acc.common.injectStyle("._access { filter: invert(1) !important; }", { className: counterClass });
838
+ this._acc.common.deployedObjects.set("." + counterClass, false);
839
+ if (this._acc.stateValues.textToSpeech) this._acc.textToSpeech("Colors Inverted");
840
+ } else {
841
+ this._acc.html.style.filter = "";
842
+ removeCounter();
843
+ if (this._acc.stateValues.textToSpeech) this._acc.textToSpeech("Colors Set To Normal");
844
+ }
845
+ }
846
+ grayHues(destroy) {
847
+ var _a, _b;
848
+ const overlayClass = "_access-gray-overlay";
849
+ const removeOverlay = () => {
850
+ var _a2;
851
+ (_a2 = document.querySelector("." + overlayClass)) == null ? void 0 : _a2.remove();
852
+ };
853
+ if (destroy) {
854
+ if (!this._acc.options.suppressDomInjection)
855
+ (_a = this._acc.menu.querySelector('[data-access-action="grayHues"]')) == null ? void 0 : _a.classList.remove("active");
856
+ this._acc.stateValues.grayHues = false;
857
+ this._acc.sessionState.grayHues = false;
858
+ this._acc.onChange(true);
859
+ removeOverlay();
860
+ return;
861
+ }
862
+ if (!this._acc.options.suppressDomInjection)
863
+ (_b = this._acc.menu.querySelector('[data-access-action="grayHues"]')) == null ? void 0 : _b.classList.toggle("active");
864
+ this._acc.stateValues.grayHues = !this._acc.stateValues.grayHues;
865
+ this._acc.sessionState.grayHues = this._acc.stateValues.grayHues;
866
+ this._acc.onChange(true);
867
+ if (this._acc.stateValues.grayHues) {
868
+ if (this._acc.stateValues.invertColors) this.invertColors(true);
869
+ const overlay = document.createElement("div");
870
+ overlay.className = overlayClass;
871
+ overlay.style.cssText = "position:fixed;inset:0;z-index:9998;backdrop-filter:grayscale(1);-webkit-backdrop-filter:grayscale(1);pointer-events:none;";
872
+ document.body.appendChild(overlay);
873
+ this._acc.common.deployedObjects.set("." + overlayClass, false);
874
+ if (this._acc.stateValues.textToSpeech) this._acc.textToSpeech("Gray Hues Enabled.");
875
+ } else {
876
+ removeOverlay();
877
+ if (this._acc.stateValues.textToSpeech) this._acc.textToSpeech("Gray Hues Disabled.");
878
+ }
879
+ }
880
+ underlineLinks(destroy) {
881
+ var _a, _b, _c;
882
+ const className = "_access-underline";
883
+ const remove = () => {
884
+ const style = document.querySelector("." + className);
885
+ if (style) {
886
+ style.parentElement.removeChild(style);
887
+ this._acc.common.deployedObjects.remove("." + className);
888
+ }
889
+ };
890
+ if (destroy) {
891
+ this._acc.stateValues.underlineLinks = false;
892
+ this._acc.sessionState.underlineLinks = false;
893
+ this._acc.onChange(true);
894
+ if (!this._acc.options.suppressDomInjection)
895
+ (_a = this._acc.menu.querySelector('[data-access-action="underlineLinks"]')) == null ? void 0 : _a.classList.remove("active");
896
+ return remove();
897
+ }
898
+ if (!this._acc.options.suppressDomInjection)
899
+ (_b = this._acc.menu.querySelector('[data-access-action="underlineLinks"]')) == null ? void 0 : _b.classList.toggle("active");
900
+ this._acc.stateValues.underlineLinks = !this._acc.stateValues.underlineLinks;
901
+ this._acc.sessionState.underlineLinks = this._acc.stateValues.underlineLinks;
902
+ this._acc.onChange(true);
903
+ if (this._acc.stateValues.underlineLinks) {
904
+ const parts = ((_c = this._acc.options.linkSelector) != null ? _c : "a").split(",").map((s) => s.trim());
905
+ const rules = parts.flatMap((s) => [`body ${s}`, `body ${s} *`]).join(", ");
906
+ this._acc.common.injectStyle(`${rules} { text-decoration: underline !important; }`, { className });
907
+ this._acc.common.deployedObjects.set("." + className, true);
908
+ if (this._acc.stateValues.textToSpeech) this._acc.textToSpeech("Links UnderLined");
909
+ } else {
910
+ if (this._acc.stateValues.textToSpeech) this._acc.textToSpeech("Links UnderLine Removed");
911
+ remove();
912
+ }
913
+ }
914
+ bigCursor(destroy) {
915
+ var _a, _b;
916
+ if (destroy) {
917
+ this._acc.html.classList.remove("_access_cursor");
918
+ if (!this._acc.options.suppressDomInjection)
919
+ (_a = this._acc.menu.querySelector('[data-access-action="bigCursor"]')) == null ? void 0 : _a.classList.remove("active");
920
+ this._acc.stateValues.bigCursor = false;
921
+ this._acc.sessionState.bigCursor = false;
922
+ this._acc.onChange(true);
923
+ return;
924
+ }
925
+ if (!this._acc.options.suppressDomInjection)
926
+ (_b = this._acc.menu.querySelector('[data-access-action="bigCursor"]')) == null ? void 0 : _b.classList.toggle("active");
927
+ this._acc.stateValues.bigCursor = !this._acc.stateValues.bigCursor;
928
+ this._acc.sessionState.bigCursor = this._acc.stateValues.bigCursor;
929
+ this._acc.onChange(true);
930
+ this._acc.html.classList.toggle("_access_cursor");
931
+ if (this._acc.stateValues.textToSpeech)
932
+ this._acc.textToSpeech(this._acc.stateValues.bigCursor ? "Big Cursor Enabled" : "Big Cursor Disabled");
933
+ }
934
+ readingGuide(destroy) {
935
+ var _a, _b, _c, _d;
936
+ if (destroy) {
937
+ (_a = document.getElementById("access_read_guide_bar")) == null ? void 0 : _a.remove();
938
+ if (!this._acc.options.suppressDomInjection)
939
+ (_b = this._acc.menu.querySelector('[data-access-action="readingGuide"]')) == null ? void 0 : _b.classList.remove("active");
940
+ this._acc.stateValues.readingGuide = false;
941
+ this._acc.sessionState.readingGuide = false;
942
+ this._acc.onChange(true);
943
+ document.body.removeEventListener("touchmove", this._acc.updateReadGuide, false);
944
+ document.body.removeEventListener("mousemove", this._acc.updateReadGuide, false);
945
+ return;
946
+ }
947
+ if (!this._acc.options.suppressDomInjection)
948
+ (_c = this._acc.menu.querySelector('[data-access-action="readingGuide"]')) == null ? void 0 : _c.classList.toggle("active");
949
+ this._acc.stateValues.readingGuide = !this._acc.stateValues.readingGuide;
950
+ this._acc.sessionState.readingGuide = this._acc.stateValues.readingGuide;
951
+ this._acc.onChange(true);
952
+ if (this._acc.stateValues.readingGuide) {
953
+ const read = document.createElement("div");
954
+ read.id = "access_read_guide_bar";
955
+ read.classList.add("access_read_guide_bar");
956
+ document.body.append(read);
957
+ document.body.addEventListener("touchmove", this._acc.updateReadGuide, false);
958
+ document.body.addEventListener("mousemove", this._acc.updateReadGuide, false);
959
+ } else {
960
+ (_d = document.getElementById("access_read_guide_bar")) == null ? void 0 : _d.remove();
961
+ document.body.removeEventListener("touchmove", this._acc.updateReadGuide, false);
962
+ document.body.removeEventListener("mousemove", this._acc.updateReadGuide, false);
963
+ if (this._acc.stateValues.textToSpeech) this._acc.textToSpeech("Reading Guide Disabled");
964
+ }
965
+ }
966
+ textToSpeech(destroy) {
967
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
968
+ const tSpeechList = this._acc.menu.querySelector('[data-access-action="textToSpeech"]');
969
+ if (!tSpeechList) return;
970
+ const step1 = document.getElementsByClassName("screen-reader-wrapper-step-1");
971
+ const step2 = document.getElementsByClassName("screen-reader-wrapper-step-2");
972
+ const step3 = document.getElementsByClassName("screen-reader-wrapper-step-3");
973
+ this._acc.onChange(false);
974
+ const className = "_access-text-to-speech";
975
+ const remove = () => {
976
+ var _a2;
977
+ const style = document.querySelector("." + className);
978
+ if (style) {
979
+ style.parentElement.removeChild(style);
980
+ document.removeEventListener("click", this.readBind, false);
981
+ document.removeEventListener("keyup", this.readBind, false);
982
+ this._acc.common.deployedObjects.remove("." + className);
983
+ }
984
+ (_a2 = window.speechSynthesis) == null ? void 0 : _a2.cancel();
985
+ this._acc.isReading = false;
986
+ };
987
+ if (destroy) {
988
+ tSpeechList.classList.remove("active");
989
+ (_a = step1[0]) == null ? void 0 : _a.classList.remove("active");
990
+ (_b = step2[0]) == null ? void 0 : _b.classList.remove("active");
991
+ (_c = step3[0]) == null ? void 0 : _c.classList.remove("active");
992
+ this._acc.stateValues.textToSpeech = false;
993
+ (_d = window.speechSynthesis) == null ? void 0 : _d.cancel();
994
+ return remove();
995
+ }
996
+ if (this._acc.stateValues.speechRate === 1 && !tSpeechList.classList.contains("active")) {
997
+ this._acc.stateValues.textToSpeech = true;
998
+ this._acc.textToSpeech("Screen Reader enabled. Reading Pace - Normal");
999
+ tSpeechList.classList.add("active");
1000
+ (_e = step1[0]) == null ? void 0 : _e.classList.add("active");
1001
+ (_f = step2[0]) == null ? void 0 : _f.classList.add("active");
1002
+ (_g = step3[0]) == null ? void 0 : _g.classList.add("active");
1003
+ } else if (this._acc.stateValues.speechRate === 1 && tSpeechList.classList.contains("active")) {
1004
+ this._acc.stateValues.speechRate = 1.5;
1005
+ this._acc.textToSpeech("Reading Pace - Fast");
1006
+ (_h = step1[0]) == null ? void 0 : _h.classList.remove("active");
1007
+ } else if (this._acc.stateValues.speechRate === 1.5 && tSpeechList.classList.contains("active")) {
1008
+ this._acc.stateValues.speechRate = 0.7;
1009
+ this._acc.textToSpeech("Reading Pace - Slow");
1010
+ (_i = step2[0]) == null ? void 0 : _i.classList.remove("active");
1011
+ } else {
1012
+ this._acc.stateValues.speechRate = 1;
1013
+ this._acc.textToSpeech("Screen Reader - Disabled");
1014
+ tSpeechList.classList.remove("active");
1015
+ (_j = step3[0]) == null ? void 0 : _j.classList.remove("active");
1016
+ const timeout = setInterval(() => {
1017
+ if (this._acc.isReading) return;
1018
+ this._acc.stateValues.textToSpeech = false;
1019
+ remove();
1020
+ clearTimeout(timeout);
1021
+ }, 500);
1022
+ return;
1023
+ }
1024
+ if (tSpeechList.classList.contains("active") && this._acc.stateValues.speechRate === 1) {
1025
+ this._acc.common.injectStyle("*:hover { box-shadow: 2px 2px 2px rgba(180,180,180,0.7); }", { className });
1026
+ this._acc.common.deployedObjects.set("." + className, true);
1027
+ document.addEventListener("click", this.readBind, false);
1028
+ document.addEventListener("keyup", this.readBind, false);
1029
+ }
1030
+ }
1031
+ speechToText(destroy) {
1032
+ var _a, _b;
1033
+ const sTextList = this._acc.menu.querySelector('[data-access-action="speechToText"]');
1034
+ if (!sTextList) return;
1035
+ this._acc.onChange(false);
1036
+ const className = "_access-speech-to-text";
1037
+ const remove = () => {
1038
+ var _a2, _b2, _c, _d;
1039
+ (_b2 = (_a2 = this._acc.recognition) == null ? void 0 : _a2.stop) == null ? void 0 : _b2.call(_a2);
1040
+ this._acc.body.classList.remove("_access-listening");
1041
+ (_d = (_c = document.querySelector("." + className)) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.removeChild(document.querySelector("." + className));
1042
+ this._acc.common.deployedObjects.remove("." + className);
1043
+ document.querySelectorAll("._access-mic").forEach((input) => {
1044
+ input.removeEventListener("focus", this._acc.listen.bind(this._acc), false);
1045
+ input.classList.remove("_access-mic");
1046
+ });
1047
+ sTextList.classList.remove("active");
1048
+ };
1049
+ if (destroy) {
1050
+ this._acc.stateValues.speechToText = false;
1051
+ return remove();
1052
+ }
1053
+ this._acc.stateValues.speechToText = !this._acc.stateValues.speechToText;
1054
+ if (this._acc.stateValues.speechToText) {
1055
+ const iconContent = !((_a = this._acc.options.icon) == null ? void 0 : _a.useEmojis) ? '"mic"' : 'var(--_access-menu-item-icon-mic,"\u{1F3A4}")';
1056
+ const fontFamily = !((_b = this._acc.options.icon) == null ? void 0 : _b.useEmojis) ? `font-family: var(--_access-menu-item-icon-font-family-after, ${this._acc.fixedDefaultFont});` : "";
1057
+ const css = `
1058
+ body:after {
1059
+ content: ${iconContent};
1060
+ ${fontFamily}
1061
+ position: fixed; z-index: 1100; top: 1vw; right: 1vw;
1062
+ width: 36px; height: 36px; font-size: 30px; line-height: 36px;
1063
+ border-radius: 50%; background: rgba(255,255,255,0.7);
1064
+ display: flex; justify-content: center; align-items: center;
1065
+ }
1066
+ body._access-listening:after { animation: _access-listening-animation 2s infinite ease; }
1067
+ @keyframes _access-listening-animation {
1068
+ 0% { background-color: transparent; }
1069
+ 50% { background-color: #EF9A9A; }
1070
+ }
1071
+ `;
1072
+ this._acc.common.injectStyle(css, { className });
1073
+ this._acc.common.deployedObjects.set("." + className, true);
1074
+ document.querySelectorAll('input[type="text"], input[type="email"], input[type="tel"], input[type="search"], textarea, [contenteditable]').forEach((input) => {
1075
+ input.addEventListener("blur", () => {
1076
+ var _a2, _b2;
1077
+ return (_b2 = (_a2 = this._acc.recognition) == null ? void 0 : _a2.stop) == null ? void 0 : _b2.call(_a2);
1078
+ }, false);
1079
+ input.addEventListener("focus", this._acc.listen.bind(this._acc), false);
1080
+ input.parentElement.classList.add("_access-mic");
1081
+ });
1082
+ sTextList.classList.add("active");
1083
+ } else {
1084
+ remove();
1085
+ }
1086
+ }
1087
+ disableAnimations(destroy) {
1088
+ var _a;
1089
+ const className = "_access-disable-animations";
1090
+ const autoplayStopped = "data-autoplay-stopped";
1091
+ const remove = () => {
1092
+ var _a2, _b, _c;
1093
+ if (!this._acc.options.suppressDomInjection)
1094
+ (_a2 = this._acc.menu.querySelector('[data-access-action="disableAnimations"]')) == null ? void 0 : _a2.classList.remove("active");
1095
+ this._acc.stateValues.disableAnimations = false;
1096
+ (_c = (_b = document.querySelector("." + className)) == null ? void 0 : _b.parentElement) == null ? void 0 : _c.removeChild(document.querySelector("." + className));
1097
+ this._acc.common.deployedObjects.remove("." + className);
1098
+ document.querySelectorAll("[data-org-src]").forEach((img) => {
1099
+ const screenshot = img.src;
1100
+ img.setAttribute("src", img.getAttribute("data-org-src"));
1101
+ img.setAttribute("data-org-src", screenshot);
1102
+ });
1103
+ document.querySelectorAll(`video[${autoplayStopped}]`).forEach((v) => {
1104
+ v.setAttribute("autoplay", "");
1105
+ v.removeAttribute(autoplayStopped);
1106
+ v.play();
1107
+ });
1108
+ };
1109
+ if (destroy) {
1110
+ remove();
1111
+ return;
1112
+ }
1113
+ this._acc.stateValues.disableAnimations = !this._acc.stateValues.disableAnimations;
1114
+ if (!this._acc.stateValues.disableAnimations) {
1115
+ remove();
1116
+ return;
1117
+ }
1118
+ if (!this._acc.options.suppressDomInjection)
1119
+ (_a = this._acc.menu.querySelector('[data-access-action="disableAnimations"]')) == null ? void 0 : _a.classList.add("active");
1120
+ this._acc.common.injectStyle(
1121
+ "body * { animation-duration: 0.0ms !important; transition-duration: 0.0ms !important; }",
1122
+ { className }
1123
+ );
1124
+ this._acc.common.deployedObjects.set("." + className, true);
1125
+ document.querySelectorAll("img").forEach(async (img) => {
1126
+ const ext = this._acc.common.getFileExtension(img.src);
1127
+ if ((ext == null ? void 0 : ext.toLowerCase()) === "gif") {
1128
+ let screenshot = img.getAttribute("data-org-src");
1129
+ if (!screenshot) screenshot = await this._acc.common.createScreenshot(img.src);
1130
+ img.setAttribute("data-org-src", img.src);
1131
+ img.src = screenshot;
1132
+ }
1133
+ });
1134
+ document.querySelectorAll("video[autoplay]").forEach((v) => {
1135
+ v.setAttribute(autoplayStopped, "");
1136
+ v.removeAttribute("autoplay");
1137
+ v.pause();
1138
+ });
1139
+ }
1140
+ iframeModals(destroy, button) {
1141
+ var _a, _b, _c, _d;
1142
+ if (!button) destroy = true;
1143
+ const close = () => {
1144
+ if (this._dialog) {
1145
+ this._dialog.classList.add("closing");
1146
+ setTimeout(() => {
1147
+ this._dialog.classList.remove("closing");
1148
+ this._dialog.close();
1149
+ this._dialog.remove();
1150
+ detach();
1151
+ }, 350);
1152
+ }
1153
+ button == null ? void 0 : button.classList.remove("active");
1154
+ };
1155
+ const onClose = () => close();
1156
+ const detach = () => {
1157
+ var _a2, _b2, _c2;
1158
+ (_b2 = (_a2 = this._dialog) == null ? void 0 : _a2.querySelector("button")) == null ? void 0 : _b2.removeEventListener("click", onClose, false);
1159
+ (_c2 = this._dialog) == null ? void 0 : _c2.removeEventListener("close", onClose);
1160
+ };
1161
+ if (destroy) {
1162
+ close();
1163
+ return;
1164
+ }
1165
+ button.classList.add("active");
1166
+ if (!this._dialog) this._dialog = document.createElement("dialog");
1167
+ this._dialog.classList.add("_access");
1168
+ this._dialog.innerHTML = "";
1169
+ this._dialog.appendChild(this._acc.common.jsonToHtml({
1170
+ type: "div",
1171
+ children: [
1172
+ {
1173
+ type: "div",
1174
+ children: [{
1175
+ type: "button",
1176
+ attrs: {
1177
+ role: "button",
1178
+ class: ((_a = this._acc.options.icon) == null ? void 0 : _a.useEmojis) ? "" : (_c = (_b = this._acc.options.icon) == null ? void 0 : _b.fontClass) != null ? _c : "",
1179
+ style: "position:absolute;top:5px;cursor:pointer;font-size:24px!important;font-weight:bold;background:transparent;border:none;left:5px;color:#d63c3c;padding:0;"
1180
+ },
1181
+ children: [{ type: "#text", text: ((_d = this._acc.options.icon) == null ? void 0 : _d.useEmojis) ? "X" : "close" }]
1182
+ }]
1183
+ },
1184
+ {
1185
+ type: "div",
1186
+ children: [{
1187
+ type: "iframe",
1188
+ attrs: { src: button.getAttribute("data-access-url"), style: "width:50vw;height:50vh;padding:30px;" }
1189
+ }]
1190
+ }
1191
+ ]
1192
+ }));
1193
+ document.body.appendChild(this._dialog);
1194
+ this._dialog.querySelector("button").addEventListener("click", onClose, false);
1195
+ this._dialog.addEventListener("close", onClose);
1196
+ this._dialog.showModal();
1197
+ }
1198
+ customFunctions(destroy, button) {
1199
+ if (!button) return;
1200
+ const cf = this._acc.options.customFunctions[parseInt(button.getAttribute("data-access-custom-index"))];
1201
+ if (cf.toggle && button.classList.contains("active")) destroy = true;
1202
+ if (destroy) {
1203
+ if (cf.toggle) button.classList.remove("active");
1204
+ cf.method(cf, false);
1205
+ } else {
1206
+ if (cf.toggle) button.classList.add("active");
1207
+ cf.method(cf, true);
1208
+ }
1209
+ }
1210
+ dyslexicFont(destroy) {
1211
+ var _a, _b;
1212
+ const className = "_access-dyslexic-font";
1213
+ const btn = this._acc.menu.querySelector('[data-access-action="dyslexicFont"]');
1214
+ if (destroy) {
1215
+ this._acc.stateValues.dyslexicFont = false;
1216
+ btn == null ? void 0 : btn.classList.remove("active");
1217
+ (_a = document.querySelector("." + className)) == null ? void 0 : _a.remove();
1218
+ return;
1219
+ }
1220
+ this._acc.stateValues.dyslexicFont = !this._acc.stateValues.dyslexicFont;
1221
+ btn == null ? void 0 : btn.classList.toggle("active");
1222
+ if (this._acc.stateValues.dyslexicFont) {
1223
+ this._acc.common.injectStyle(`
1224
+ @font-face {
1225
+ font-family: 'OpenDyslexic';
1226
+ src: url('https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/open-dyslexic-regular.woff2') format('woff2');
1227
+ font-weight: normal; font-style: normal;
1228
+ }
1229
+ body *:not(._access):not(._access *) { font-family: OpenDyslexic, Arial, sans-serif !important; }
1230
+ `, { className });
1231
+ this._acc.common.deployedObjects.set("." + className, false);
1232
+ } else {
1233
+ (_b = document.querySelector("." + className)) == null ? void 0 : _b.remove();
1234
+ }
1235
+ }
1236
+ hideImages(destroy) {
1237
+ var _a, _b;
1238
+ const className = "_access-hide-images";
1239
+ const btn = this._acc.menu.querySelector('[data-access-action="hideImages"]');
1240
+ if (destroy) {
1241
+ this._acc.stateValues.hideImages = false;
1242
+ btn == null ? void 0 : btn.classList.remove("active");
1243
+ (_a = document.querySelector("." + className)) == null ? void 0 : _a.remove();
1244
+ return;
1245
+ }
1246
+ this._acc.stateValues.hideImages = !this._acc.stateValues.hideImages;
1247
+ btn == null ? void 0 : btn.classList.toggle("active");
1248
+ if (this._acc.stateValues.hideImages) {
1249
+ this._acc.common.injectStyle(
1250
+ "img, picture, svg:not(._access svg) { visibility: hidden !important; } *:not(._access):not(._access *) { background-image: none !important; }",
1251
+ { className }
1252
+ );
1253
+ this._acc.common.deployedObjects.set("." + className, false);
1254
+ } else {
1255
+ (_b = document.querySelector("." + className)) == null ? void 0 : _b.remove();
1256
+ }
1257
+ }
1258
+ };
1259
+
1260
+ // src/storage.ts
1261
+ var Storage = class {
1262
+ has(key) {
1263
+ return Object.prototype.hasOwnProperty.call(window.localStorage, key);
1264
+ }
1265
+ set(key, value) {
1266
+ window.localStorage.setItem(key, JSON.stringify(value));
1267
+ }
1268
+ get(key) {
1269
+ const item = window.localStorage.getItem(key);
1270
+ try {
1271
+ return JSON.parse(item);
1272
+ } catch (e) {
1273
+ return item;
1274
+ }
1275
+ }
1276
+ clear() {
1277
+ window.localStorage.clear();
1278
+ }
1279
+ remove(key) {
1280
+ window.localStorage.removeItem(key);
1281
+ }
1282
+ isSupported() {
1283
+ const test = "_test";
1284
+ try {
1285
+ localStorage.setItem(test, test);
1286
+ localStorage.removeItem(test);
1287
+ return true;
1288
+ } catch (e) {
1289
+ return false;
1290
+ }
1291
+ }
1292
+ };
1293
+
1294
+ // src/main.ts
1295
+ var _Accessibility = class _Accessibility {
1296
+ constructor(options = {}) {
1297
+ this._isReading = false;
1298
+ var _a, _b, _c, _d;
1299
+ this._common = new Common();
1300
+ this._storage = new Storage();
1301
+ this._fixedDefaultFont = this._common.getFixedFont("Material Icons");
1302
+ this._options = this.defaultOptions;
1303
+ this.options = this._common.extend(this._options, options);
1304
+ this.addModuleOrderIfNotDefined();
1305
+ this.addDefaultOptions(options);
1306
+ this.disabledUnsupportedFeatures();
1307
+ this._onKeyDownBind = this.onKeyDown.bind(this);
1308
+ this._sessionState = {
1309
+ textSize: 0,
1310
+ textSpace: 0,
1311
+ lineHeight: 0,
1312
+ invertColors: false,
1313
+ grayHues: false,
1314
+ underlineLinks: false,
1315
+ bigCursor: false,
1316
+ readingGuide: false
1317
+ };
1318
+ if ((_a = this.options.icon) == null ? void 0 : _a.useEmojis) {
1319
+ this.fontFallback();
1320
+ this.build();
1321
+ } else {
1322
+ this._common.injectIconsFont((_c = (_b = this.options.icon) == null ? void 0 : _b.fontFaceSrc) != null ? _c : [], (hasError) => {
1323
+ var _a2;
1324
+ this.build();
1325
+ if ((_a2 = this.options.icon) == null ? void 0 : _a2.fontFamilyValidation) {
1326
+ setTimeout(() => {
1327
+ this._common.isFontLoaded(this.options.icon.fontFamilyValidation, (isLoaded) => {
1328
+ if (!isLoaded || hasError) {
1329
+ this._common.warn(`${this.options.icon.fontFamilyValidation} font not loaded, using emojis`);
1330
+ this.fontFallback();
1331
+ this.destroy();
1332
+ this.build();
1333
+ }
1334
+ });
1335
+ });
1336
+ }
1337
+ });
1338
+ }
1339
+ if ((_d = this.options.modules) == null ? void 0 : _d.speechToText) {
1340
+ window.addEventListener("beforeunload", () => {
1341
+ if (this._isReading) {
1342
+ window.speechSynthesis.cancel();
1343
+ this._isReading = false;
1344
+ }
1345
+ });
1346
+ }
1347
+ }
1348
+ get stateValues() {
1349
+ return this._stateValues;
1350
+ }
1351
+ set stateValues(value) {
1352
+ this._stateValues = value;
1353
+ }
1354
+ get html() {
1355
+ return this._html;
1356
+ }
1357
+ get body() {
1358
+ return this._body;
1359
+ }
1360
+ get menu() {
1361
+ return this._menu;
1362
+ }
1363
+ get sessionState() {
1364
+ return this._sessionState;
1365
+ }
1366
+ set sessionState(value) {
1367
+ this._sessionState = value;
1368
+ }
1369
+ get common() {
1370
+ return this._common;
1371
+ }
1372
+ get recognition() {
1373
+ return this._recognition;
1374
+ }
1375
+ get isReading() {
1376
+ return this._isReading;
1377
+ }
1378
+ set isReading(value) {
1379
+ this._isReading = value;
1380
+ }
1381
+ get fixedDefaultFont() {
1382
+ return this._fixedDefaultFont;
1383
+ }
1384
+ get defaultOptions() {
1385
+ const res = {
1386
+ icon: {
1387
+ img: "accessibility",
1388
+ fontFaceSrc: ["https://fonts.googleapis.com/icon?family=Material+Icons"],
1389
+ fontClass: "material-icons",
1390
+ useEmojis: false,
1391
+ closeIcon: "close",
1392
+ resetIcon: "refresh"
1393
+ },
1394
+ hotkeys: {
1395
+ enabled: false,
1396
+ helpTitles: true,
1397
+ keys: {
1398
+ toggleMenu: ["ctrlKey", "altKey", 65],
1399
+ invertColors: ["ctrlKey", "altKey", 73],
1400
+ grayHues: ["ctrlKey", "altKey", 71],
1401
+ underlineLinks: ["ctrlKey", "altKey", 85],
1402
+ bigCursor: ["ctrlKey", "altKey", 67],
1403
+ readingGuide: ["ctrlKey", "altKey", 82],
1404
+ textToSpeech: ["ctrlKey", "altKey", 84],
1405
+ speechToText: ["ctrlKey", "altKey", 83],
1406
+ disableAnimations: ["ctrlKey", "altKey", 81]
1407
+ }
1408
+ },
1409
+ guide: { cBorder: "#20ff69", cBackground: "#000000", height: "12px" },
1410
+ suppressCssInjection: false,
1411
+ suppressDomInjection: false,
1412
+ labels: {
1413
+ resetTitle: "Reset",
1414
+ closeTitle: "Close",
1415
+ menuTitle: "Accessibility Options",
1416
+ increaseText: "increase text size",
1417
+ decreaseText: "decrease text size",
1418
+ increaseTextSpacing: "increase text spacing",
1419
+ decreaseTextSpacing: "decrease text spacing",
1420
+ invertColors: "invert colors",
1421
+ grayHues: "gray hues",
1422
+ bigCursor: "big cursor",
1423
+ readingGuide: "reading guide",
1424
+ underlineLinks: "underline links",
1425
+ textToSpeech: "text to speech",
1426
+ speechToText: "speech to text",
1427
+ disableAnimations: "disable animations",
1428
+ increaseLineHeight: "increase line height",
1429
+ decreaseLineHeight: "decrease line height",
1430
+ hotkeyPrefix: "Hotkey: ",
1431
+ dyslexicFont: "Dyslexic font",
1432
+ hideImages: "Hide images"
1433
+ },
1434
+ textPixelMode: false,
1435
+ textEmlMode: true,
1436
+ textSizeFactor: 12.5,
1437
+ animations: { buttons: true },
1438
+ modules: {
1439
+ increaseText: true,
1440
+ decreaseText: true,
1441
+ increaseTextSpacing: true,
1442
+ decreaseTextSpacing: true,
1443
+ increaseLineHeight: true,
1444
+ decreaseLineHeight: true,
1445
+ invertColors: true,
1446
+ grayHues: true,
1447
+ bigCursor: true,
1448
+ readingGuide: true,
1449
+ underlineLinks: true,
1450
+ textToSpeech: true,
1451
+ speechToText: true,
1452
+ disableAnimations: true,
1453
+ dyslexicFont: true,
1454
+ hideImages: true
1455
+ },
1456
+ modulesOrder: [],
1457
+ session: { persistent: true },
1458
+ iframeModals: [],
1459
+ customFunctions: [],
1460
+ statement: { url: "" },
1461
+ feedback: { url: "" },
1462
+ linkSelector: "a",
1463
+ logoImage: "",
1464
+ language: { textToSpeechLang: "", speechToTextLang: "" }
1465
+ };
1466
+ Object.keys(AccessibilityModulesType).filter((k) => !isNaN(parseInt(k))).forEach((k) => {
1467
+ const n = parseInt(k);
1468
+ res.modulesOrder.push({ type: n, order: n });
1469
+ });
1470
+ return res;
1471
+ }
1472
+ initFontSize() {
1473
+ if (!this._htmlInitFS) {
1474
+ const htmlInitFS = this._common.getFormattedDim(getComputedStyle(this._html).fontSize);
1475
+ const bodyInitFS = this._common.getFormattedDim(getComputedStyle(this._body).fontSize);
1476
+ this._html.style.fontSize = htmlInitFS.size / 16 * 100 + "%";
1477
+ this._htmlOrgFontSize = this._html.style.fontSize;
1478
+ this._body.style.fontSize = bodyInitFS.size / htmlInitFS.size + "em";
1479
+ }
1480
+ }
1481
+ fontFallback() {
1482
+ this.options.icon.useEmojis = true;
1483
+ this.options.icon.img = "\u267F";
1484
+ this.options.icon.fontClass = "";
1485
+ }
1486
+ addDefaultOptions(options) {
1487
+ var _a, _b, _c, _d, _e;
1488
+ if ((_a = options.icon) == null ? void 0 : _a.closeIconElem) this.options.icon.closeIconElem = options.icon.closeIconElem;
1489
+ if ((_b = options.icon) == null ? void 0 : _b.resetIconElem) this.options.icon.resetIconElem = options.icon.resetIconElem;
1490
+ if ((_c = options.icon) == null ? void 0 : _c.imgElem) this.options.icon.imgElem = options.icon.imgElem;
1491
+ if (!this.options.icon.closeIconElem)
1492
+ this.options.icon.closeIconElem = { type: "#text", text: !this.options.icon.useEmojis ? (_d = this.options.icon.closeIcon) != null ? _d : "close" : "X" };
1493
+ if (!this.options.icon.resetIconElem)
1494
+ this.options.icon.resetIconElem = { type: "#text", text: !this.options.icon.useEmojis ? (_e = this.options.icon.resetIcon) != null ? _e : "refresh" : "\u2672" };
1495
+ if (!this.options.icon.imgElem)
1496
+ this.options.icon.imgElem = { type: "#text", text: this.options.icon.img };
1497
+ }
1498
+ addModuleOrderIfNotDefined() {
1499
+ this.defaultOptions.modulesOrder.forEach((mo) => {
1500
+ if (!this.options.modulesOrder.find((imo) => imo.type === mo.type))
1501
+ this.options.modulesOrder.push(mo);
1502
+ });
1503
+ }
1504
+ disabledUnsupportedFeatures() {
1505
+ if (!("webkitSpeechRecognition" in window) || location.protocol !== "https:") {
1506
+ this._common.warn("speech to text requires a browser with webkitSpeechRecognition and https");
1507
+ this.options.modules.speechToText = false;
1508
+ }
1509
+ const w = window;
1510
+ if (!w.SpeechSynthesisUtterance || !w.speechSynthesis) {
1511
+ this._common.warn("text to speech is not supported in this browser");
1512
+ this.options.modules.textToSpeech = false;
1513
+ }
1514
+ }
1515
+ injectCss(injectFull) {
1516
+ var _a;
1517
+ const iconTop = "7px", iconLeft = "5px";
1518
+ const useEmojis = (_a = this.options.icon) == null ? void 0 : _a.useEmojis;
1519
+ const mandatory = `
1520
+ html._access_cursor * {
1521
+ cursor: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyOS4xODhweCIgaGVpZ2h0PSI0My42MjVweCIgdmlld0JveD0iMCAwIDI5LjE4OCA0My42MjUiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI5LjE4OCA0My42MjUiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxwb2x5Z29uIGZpbGw9IiNGRkZGRkYiIHN0cm9rZT0iI0Q5REFEOSIgc3Ryb2tlLXdpZHRoPSIxLjE0MDYiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgcG9pbnRzPSIyLjgsNC41NDkgMjYuODQ3LDE5LjkwMiAxNi45NjQsMjIuNzAxIDI0LjIzOSwzNy43NDkgMTguMjc4LDQyLjAxNyA5Ljc0MSwzMC43MjQgMS4xMzgsMzUuODA5ICIvPjxnPjxnPjxnPjxwYXRoIGZpbGw9IiMyMTI2MjciIGQ9Ik0yOS4xNzUsMjEuMTU1YzAuMDcxLTAuNjEzLTAuMTY1LTEuMjUzLTAuNjM1LTEuNTczTDIuMTY1LDAuMjU4Yy0wLjQyNC0wLjMyLTAuOTg4LTAuMzQ2LTEuNDM1LTAuMDUzQzAuMjgyLDAuNDk3LDAsMS4wMywwLDEuNjE3djM0LjE3MWMwLDAuNjEzLDAuMzA2LDEuMTQ2LDAuNzc2LDEuNDM5YzAuNDcxLDAuMjY3LDEuMDU5LDAuMjEzLDEuNDgyLTAuMTZsNy40ODItNi4zNDRsNi44NDcsMTIuMTU1YzAuMjU5LDAuNDgsMC43MjksMC43NDYsMS4yLDAuNzQ2YzAuMjM1LDAsMC40OTQtMC4wOCwwLjcwNi0wLjIxM2w2Ljk4OC00LjU4NWMwLjMyOS0wLjIxMywwLjU2NS0wLjU4NiwwLjY1OS0xLjAxM2MwLjA5NC0wLjQyNiwwLjAyNC0wLjg4LTAuMTg4LTEuMjI2bC02LjM3Ni0xMS4zODJsOC42MTEtMi43NDVDMjguNzA1LDIyLjI3NCwyOS4xMDUsMjEuNzY4LDI5LjE3NSwyMS4xNTV6IE0xNi45NjQsMjIuNzAxYy0wLjQyNCwwLjEzMy0wLjc3NiwwLjUwNi0wLjk0MSwwLjk2Yy0wLjE2NSwwLjQ4LTAuMTE4LDEuMDEzLDAuMTE4LDEuNDM5bDYuNTg4LDExLjc4MWwtNC41NDEsMi45ODVsLTYuODk0LTEyLjMxNWMtMC4yMTItMC4zNzMtMC41NDEtMC42NC0wLjk0MS0wLjcyYy0wLjA5NC0wLjAyNy0wLjE2NS0wLjAyNy0wLjI1OS0wLjAyN2MtMC4zMDYsMC0wLjU4OCwwLjEwNy0wLjg0NywwLjMyTDIuOCwzMi41OVY0LjU0OWwyMS41OTksMTUuODA2TDE2Ljk2NCwyMi43MDF6Ii8+PC9nPjwvZz48L2c+PC9nPjwvc3ZnPg==),auto!important;
1522
+ }
1523
+ @keyframes _access-dialog-backdrop {
1524
+ 0% { background: var(--_access-menu-dialog-backdrop-background-start, rgba(0,0,0,0.1)); }
1525
+ 100% { background: var(--_access-menu-dialog-backdrop-background-end, rgba(0,0,0,0.5)); }
1526
+ }
1527
+ dialog._access::backdrop, dialog._access {
1528
+ transition-duration: var(--_access-menu-dialog-backdrop-transition-duration, 0.35s);
1529
+ transition-timing-function: var(--_access-menu-dialog-backdrop-transition-timing-function, ease-in-out);
1530
+ }
1531
+ dialog._access:modal { border-color: transparent; border-width: 0; padding: 0; }
1532
+ dialog._access[open]::backdrop {
1533
+ background: var(--_access-menu-dialog-backdrop-background-end, rgba(0,0,0,0.5));
1534
+ animation: _access-dialog-backdrop var(--_access-menu-dialog-backdrop-transition-duration, 0.35s) ease-in-out;
1535
+ }
1536
+ dialog._access.closing[open]::backdrop { background: var(--_access-menu-dialog-backdrop-background-start, rgba(0,0,0,0.1)); }
1537
+ dialog._access.closing[open] { opacity: 0; }
1538
+ .screen-reader-wrapper { margin: 0; position: absolute; bottom: -4px; width: calc(100% - 2px); left: 1px; }
1539
+ .screen-reader-wrapper-step-1, .screen-reader-wrapper-step-2, .screen-reader-wrapper-step-3 {
1540
+ float: left; background: var(--_access-menu-background-color, #fff);
1541
+ width: 33.33%; height: 3px; border-radius: 10px;
1542
+ }
1543
+ .screen-reader-wrapper-step-1.active, .screen-reader-wrapper-step-2.active, .screen-reader-wrapper-step-3.active {
1544
+ background: var(--_access-menu-item-button-background, #f9f9f9);
1545
+ }
1546
+ .access_read_guide_bar {
1547
+ box-sizing: border-box;
1548
+ background: var(--_access-menu-read-guide-bg, ${this.options.guide.cBackground});
1549
+ width: 100%!important; min-width: 100%!important; position: fixed!important;
1550
+ height: var(--_access-menu-read-guide-height, ${this.options.guide.height}) !important;
1551
+ border: var(--_access-menu-read-guide-border, solid 3px ${this.options.guide.cBorder});
1552
+ border-radius: 5px; top: 15px; z-index: 2147483647;
1553
+ }`;
1554
+ let css = mandatory;
1555
+ if (injectFull) {
1556
+ css = `
1557
+ ._access-scrollbar::-webkit-scrollbar-track { -webkit-box-shadow: var(--_access-scrollbar-track-box-shadow, inset 0 0 6px rgba(0,0,0,0.3)); background-color: var(--_access-scrollbar-track-background-color, #F5F5F5); }
1558
+ ._access-scrollbar::-webkit-scrollbar { width: var(--_access-scrollbar-width, 6px); background-color: var(--_access-scrollbar-background-color, #F5F5F5); }
1559
+ ._access-scrollbar::-webkit-scrollbar-thumb { background-color: var(--_access-scrollbar-thumb-background-color, #999999); }
1560
+ ._access-icon {
1561
+ position: var(--_access-icon-position, fixed);
1562
+ width: var(--_access-icon-width, 50px); height: var(--_access-icon-height, 50px);
1563
+ bottom: var(--_access-icon-bottom, 80px); top: var(--_access-icon-top, unset);
1564
+ left: var(--_access-icon-left, unset); right: var(--_access-icon-right, 10px);
1565
+ z-index: var(--_access-icon-z-index, 9999);
1566
+ font: var(--_access-icon-font, 40px / 45px "Material Icons");
1567
+ background: var(--_access-icon-bg, #4054b2); color: var(--_access-icon-color, #fff);
1568
+ background-repeat: no-repeat; background-size: contain;
1569
+ cursor: pointer; opacity: 0; transition-duration: .35s;
1570
+ user-select: none;
1571
+ ${!useEmojis ? "box-shadow: 1px 1px 5px rgba(0,0,0,.5);" : ""}
1572
+ transform: ${!useEmojis ? "scale(1)" : "skewX(14deg)"};
1573
+ border-radius: 50%;
1574
+ border: 3px solid #FFFFFF;
1575
+ text-align: var(--_access-icon-text-align, center);
1576
+ display: flex; align-items: center; justify-content: center;
1577
+ }
1578
+ .content {
1579
+ display: flex;
1580
+ flex-direction: column;
1581
+ align-items: center;
1582
+ flex: 1;
1583
+ min-height: 0;
1584
+ border-top-left-radius: 20px;
1585
+ border-top-right-radius: 20px;
1586
+ padding: 30px 0px 20px;
1587
+ background: #F3F4F6;
1588
+ overflow-y: auto;
1589
+ }
1590
+ ._access-icon:hover { transform: var(--_access-icon-transform-hover, scale(1.1)); }
1591
+ ._access-menu {
1592
+ user-select: none; position: fixed;
1593
+ width: var(--_access-menu-width, ${_Accessibility.MENU_WIDTH});
1594
+ height: var(--_access-menu-height, auto);
1595
+ padding: 0px;
1596
+ display: flex;
1597
+ flex-direction: column;
1598
+ align-items: center;
1599
+ transition-duration: var(--_access-menu-transition-duration, .35s);
1600
+ z-index: var(--_access-menu-z-index, 99991); opacity: 1;
1601
+ background-color: var(--_access-menu-background-color, #F3F4F6);
1602
+ color: var(--_access-menu-color, #000);
1603
+ border-radius: var(--_access-menu-border-radius, 3px);
1604
+ font-family: var(--_access-menu-font-family, RobotoDraft, Roboto, sans-serif, Arial);
1605
+ min-width: var(--_access-menu-min-width, 300px);
1606
+ box-shadow: var(--_access-menu-box-shadow, -2px -2px 12px rgba(0, 0, 0, 0.2));
1607
+ height: 100%;
1608
+ ${getComputedStyle(this._body).direction === "rtl" ? "text-indent: -5px" : ""}
1609
+ top: var(--_access-menu-top, unset); left: var(--_access-menu-left, unset);
1610
+ bottom: var(--_access-menu-bottom, 0); right: var(--_access-menu-right, 0);
1611
+ padding-bottom: 20px;
1612
+ word-spacing: normal; letter-spacing: normal; line-height: normal;
1613
+ overflow-y: auto;
1614
+ }
1615
+ @media (max-width: 600px) {
1616
+ ._access-menu {
1617
+ height: 100vh !important; /* For\xE7a ocupar toda a altura */
1618
+ height: 100dvh !important; /* Corre\xE7\xE3o para navegadores mobile (Safari/Chrome) */
1619
+ max-height: 100dvh !important;
1620
+ overflow-y: auto; /* Permite rolar os bot\xF5es caso sumam da tela */
1621
+ }
1622
+ }
1623
+ ._access-menu.close {
1624
+ z-index: -1; width: 0; opacity: 0; background-color: transparent;
1625
+ right: calc(-1 * var(--_access-menu-width, ${_Accessibility.MENU_WIDTH}));
1626
+ }
1627
+ ._access-menu ._text-center {
1628
+ font-size: var(--_access-menu-header-font-size, 22px);
1629
+ font-weight: var(--_access-menu-header-font-weight, bold);
1630
+ margin: var(--_access-menu-header-margin, 0px 0 -15px);
1631
+ padding: 40px 30px;
1632
+ color: var(--_access-menu-header-color, #FFFFFF);
1633
+ text-align: var(--_access-menu-header-text-align, left);
1634
+ background: #0048FF;
1635
+ width: 100%;
1636
+ display: flex;
1637
+ flex-direction: row-reverse;
1638
+ align-items: center;
1639
+ justify-content: space-between;
1640
+ gap: 8px;
1641
+
1642
+ }
1643
+
1644
+
1645
+ ._access-menu ._menu-close-btn {
1646
+
1647
+ padding: 10px;
1648
+ color: #FFFFFF;
1649
+ border-radius: 50%;
1650
+ transition: .3s ease;
1651
+ transform: rotate(0deg);
1652
+ -style: normal !important;
1653
+ background: #0d2f8a;
1654
+ blur: 1.2;
1655
+ cursor: pointer;
1656
+ font-size: 24px !important;
1657
+ font-weight: bold;
1658
+ align-self: flex-end;
1659
+ justify-self: flex-end;
1660
+ }
1661
+
1662
+ @media (max-width: 765px) {
1663
+ ._access-menu ._text-center {
1664
+ font-size: 18px;
1665
+ padding: 40px 20px;
1666
+ }
1667
+
1668
+ ._access-menu ._menu-close-btn {
1669
+ font-size: 18px;
1670
+ padding: 5px;
1671
+ }
1672
+ }
1673
+ ._access-menu ._menu-reset-btn {
1674
+ position: relative;
1675
+ width: 90%;
1676
+ padding: 15px;
1677
+ margin: 10px auto;
1678
+ background: #0048FF;
1679
+ color: #FFFFFF;
1680
+ border-radius: 10px;
1681
+ box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
1682
+ cursor: pointer;
1683
+ font-style: normal !important;
1684
+ display: flex; align-items: center; justify-content: center; gap: 6px;
1685
+ }
1686
+ ._access-menu ._menu-close-btn:hover { scale: 1.05; }
1687
+ ._access-menu ._menu-reset-btn:hover { scale: 1.03; }
1688
+
1689
+ ._access-menu ul {
1690
+ width: 90%;
1691
+ padding: 0 0 5px;
1692
+ position: relative;
1693
+ display: flex;
1694
+ flex-wrap: wrap;
1695
+ gap: 4px;
1696
+ font-size: var(--_access-menu-font-size, 18px);
1697
+ margin: 0;
1698
+ max-height: 100hv;
1699
+ background: #F3F4F6;
1700
+ }
1701
+ ${mandatory}
1702
+ ._access-menu ul li {
1703
+ width: 45%;
1704
+ min-height: 100px;
1705
+ position: relative;
1706
+ list-style-type: none;
1707
+ user-select: none;
1708
+ margin: 2px auto;
1709
+ font-size: var(--_access-menu-item-font-size, 18px) !important;
1710
+ line-height: var(--_access-menu-item-line-height, 18px) !important;
1711
+ color: var(--_access-menu-item-color, rgba(0,0,0,.8));
1712
+ }
1713
+ ._access-menu ul li button {
1714
+ display: inline-flex;
1715
+ flex-direction: column;
1716
+ align-items: center;
1717
+ justify-content: center;
1718
+ background: var(--_access-menu-item-button-background, #FFFFFF);
1719
+ padding: 10px;
1720
+ gap: 8px;
1721
+ width: 100%;
1722
+ height: 100%;
1723
+ text-align: center;
1724
+ position: relative;
1725
+ transition-duration: var(--_access-menu-item-button-transition-duration, .35s);
1726
+ box-shadow: 4px 2px 1px rgba(0, 0, 0, 0.1);
1727
+ border-radius: var(--_access-menu-item-button-border-radius, 8px);
1728
+ cursor: pointer;
1729
+ }
1730
+ ._access-menu ul li.position { display: inline-block; width: auto; }
1731
+ ._access-menu ul.before-collapse li button { opacity: var(--_access-menu-item-button-before-collapse-opacity, 0.05); }
1732
+ ._access-menu ul li button.active, ._access-menu ul li button.active:hover {
1733
+ border: 2px solid var(--_access-menu-item-button-active-border-color, #0048FF) !important;
1734
+ }
1735
+ ._access-menu div.active { color: var(--_access-menu-div-active-color, #0048FF); }
1736
+ ._access-menu ul li button.active, ._access-menu ul li button.active:hover, ._access-menu ul li button.active:before, ._access-menu ul li button.active:hover:before { color: var(--_access-menu-item-button-active-color, #0048FF); }
1737
+ ._access-menu ul li button:hover {
1738
+ color: var(--_access-menu-item-button-hover-color, #003366);
1739
+ background-color: var(--_access-menu-item-button-hover-background-color, #FFFFFF);
1740
+ scale: 1.03;
1741
+ }
1742
+ ._access-menu ul li.not-supported { display: none; }
1743
+ ._access-menu ul li button:before {
1744
+ content: ' ';
1745
+ font-family: var(--_access-menu-button-font-family-before, ${this._fixedDefaultFont});
1746
+ text-rendering: optimizeLegibility;
1747
+ font-feature-settings: "liga" 1;
1748
+ font-style: normal;
1749
+ text-transform: none;
1750
+ line-height: ${!useEmojis ? "1" : "1.1"};
1751
+ font-size: ${!useEmojis ? "24px" : "20px"} !important;
1752
+
1753
+ /* Alinhamento corrigido */
1754
+ display: flex;
1755
+ align-items: center;
1756
+ justify-content: center;
1757
+ width: 20px;
1758
+ height: 20px;
1759
+
1760
+ -webkit-font-smoothing: antialiased;
1761
+ color: var(--_access-menu-item-icon-color, rgba(0,0,0,.6));
1762
+ direction: ltr;
1763
+ text-indent: 0;
1764
+ transition-duration: .35s;
1765
+
1766
+ }
1767
+ ._access-menu ul li button svg path { fill: var(--_access-menu-item-icon-color, rgba(0,0,0,.8)); transition-duration: .35s; }
1768
+ ._access-menu ul li button:hover svg path { fill: var(--_access-menu-item-hover-icon-color, #003366); }
1769
+ ._access-menu ul li button.active svg path { fill: var(--_access-menu-item-active-icon-color, #0048FF); }
1770
+ ._access-menu ul li:hover button:before { color: var(--_access-menu-item-hover-icon-color, #003366); }
1771
+ ._access-menu ul li button[data-access-action="increaseText"]:before { content: var(--_access-menu-item-icon-increase-text, ${!useEmojis ? '"zoom_in"' : '"\u{1F53C}"'}); top: var(--_access-menu-item-icon-increase-text-top, ${iconTop}); left: var(--_access-menu-item-icon-increase-text-left, ${iconLeft}); }
1772
+ ._access-menu ul li button[data-access-action="decreaseText"]:before { content: var(--_access-menu-item-icon-decrease-text, ${!useEmojis ? '"zoom_out"' : '"\u{1F53D}"'}); top: ${iconTop}; left: ${iconLeft}; }
1773
+ ._access-menu ul li button[data-access-action="increaseTextSpacing"]:before { content: var(--_access-menu-item-icon-increase-text-spacing, ${!useEmojis ? '"unfold_more"' : '"\u{1F53C}"'}); transform: var(--_access-menu-item-icon-increase-text-spacing-transform, rotate(90deg) translate(-7px, 2px)); top: 14px; left: 0; }
1774
+ ._access-menu ul li button[data-access-action="decreaseTextSpacing"]:before { content: var(--_access-menu-item-icon-decrease-text-spacing, ${!useEmojis ? '"unfold_less"' : '"\u{1F53D}"'}); transform: var(--_access-menu-item-icon-decrease-text-spacing-transform, rotate(90deg) translate(-7px, 2px)); top: 14px; left: 0; }
1775
+ ._access-menu ul li button[data-access-action="invertColors"]:before { content: var(--_access-menu-item-icon-invert-colors, ${!useEmojis ? '"invert_colors"' : '"\u{1F386}"'}); top: ${iconTop}; left: ${iconLeft}; }
1776
+ ._access-menu ul li button[data-access-action="grayHues"]:before { content: var(--_access-menu-item-icon-gray-hues, ${!useEmojis ? '"format_color_reset"' : '"\u{1F32B}\uFE0F"'}); top: ${iconTop}; left: ${iconLeft}; }
1777
+ ._access-menu ul li button[data-access-action="underlineLinks"]:before { content: var(--_access-menu-item-icon-underline-links, ${!useEmojis ? '"format_underlined"' : '"\u{1F517}"'}); top: ${iconTop}; left: ${iconLeft}; }
1778
+ ._access-menu ul li button[data-access-action="bigCursor"]:before { content: var(--_access-menu-item-icon-big-cursor, inherit); top: ${iconTop}; left: ${iconLeft}; }
1779
+ ._access-menu ul li button[data-access-action="readingGuide"]:before { content: var(--_access-menu-item-icon-reading-guide, ${!useEmojis ? '"border_horizontal"' : '"\u2194\uFE0F"'}); top: ${iconTop}; left: ${iconLeft}; }
1780
+ ._access-menu ul li button[data-access-action="textToSpeech"]:before { content: var(--_access-menu-item-icon-text-to-speech, ${!useEmojis ? '"record_voice_over"' : '"\u23FA\uFE0F"'}); top: ${iconTop}; left: ${iconLeft}; }
1781
+ ._access-menu ul li button[data-access-action="speechToText"]:before { content: var(--_access-menu-item-icon-speech-to-text, ${!useEmojis ? '"mic"' : '"\u{1F3A4}"'}); top: ${iconTop}; left: ${iconLeft}; }
1782
+ ._access-menu ul li button[data-access-action="disableAnimations"]:before { content: var(--_access-menu-item-icon-disable-animations, ${!useEmojis ? '"animation"' : '"\u{1F3C3}\u200D\u2642\uFE0F"'}); top: ${iconTop}; left: ${iconLeft}; }
1783
+ ._access-menu ul li button[data-access-action="iframeModals"]:before { content: var(--_access-menu-item-icon-iframe-modals, ${!useEmojis ? '"policy"' : '"\u2696\uFE0F"'}); top: ${iconTop}; left: ${iconLeft}; }
1784
+ ._access-menu ul li button[data-access-action="customFunctions"]:before { content: var(--_access-menu-item-icon-custom-functions, ${!useEmojis ? '"psychology_alt"' : '"\u2753"'}); top: ${iconTop}; left: ${iconLeft}; }
1785
+ ._access-menu ul li button[data-access-action="increaseLineHeight"]:before { content: var(--_access-menu-item-icon-increase-line-height, ${!useEmojis ? '"unfold_more"' : '"\u{1F53C}"'}); top: ${iconTop}; left: ${iconLeft}; }
1786
+ ._access-menu ul li button[data-access-action="decreaseLineHeight"]:before { content: var(--_access-menu-item-icon-decrease-line-height, ${!useEmojis ? '"unfold_less"' : '"\u{1F53D}"'}); top: ${iconTop}; left: ${iconLeft}; }
1787
+ ._access-menu ul li button[data-access-action="dyslexicFont"]:before { content: var(--_access-menu-item-icon-dyslexic-font, ${!useEmojis ? '"font_download"' : '"\u{1F524}"'}); top: ${iconTop}; left: ${iconLeft}; }
1788
+ ._access-menu ul li button[data-access-action="hideImages"]:before { content: var(--_access-menu-item-icon-hide-images, ${!useEmojis ? '"hide_image"' : '"\u{1F6AB}"'}); top: ${iconTop}; left: ${iconLeft}; }
1789
+ ._access-menu-logo {
1790
+ display: block;
1791
+ max-width: 40%;
1792
+ margin: 8px auto 4px;
1793
+ object-fit: contain;
1794
+ }
1795
+ ._access-cycle-indicator { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
1796
+ ._access-cycle-indicator span { width: 16px; height: 3px; border-radius: 2px; background: #ccc; transition: background 0.2s; }
1797
+ ._access-cycle-indicator span.filled { background: #0048FF; }
1798
+ `;
1799
+ }
1800
+ this._common.injectStyle(css, { className: _Accessibility.CSS_CLASS_NAME });
1801
+ this._common.deployedObjects.set(`.${_Accessibility.CSS_CLASS_NAME}`, false);
1802
+ }
1803
+ removeCSS() {
1804
+ var _a;
1805
+ (_a = document.querySelector(`.${_Accessibility.CSS_CLASS_NAME}`)) == null ? void 0 : _a.remove();
1806
+ }
1807
+ injectIcon() {
1808
+ const className = `_access-icon ${this.options.icon.fontClass} _access`;
1809
+ const iconElem = this._common.jsonToHtml({
1810
+ type: "i",
1811
+ attrs: {
1812
+ class: className,
1813
+ title: this.options.hotkeys.enabled ? this.parseKeys(this.options.hotkeys.keys.toggleMenu) : this.options.labels.menuTitle,
1814
+ tabIndex: "0"
1815
+ },
1816
+ children: [this.options.icon.imgElem]
1817
+ });
1818
+ this._body.appendChild(iconElem);
1819
+ this._common.deployedObjects.set("._access-icon", false);
1820
+ return iconElem;
1821
+ }
1822
+ parseKeys(arr) {
1823
+ if (!this.options.hotkeys.enabled) return "";
1824
+ if (!this.options.hotkeys.helpTitles) return "";
1825
+ return this.options.labels.hotkeyPrefix + arr.map((val) => Number.isInteger(val) ? String.fromCharCode(val).toLowerCase() : val.replace("Key", "")).join("+");
1826
+ }
1827
+ injectMenu() {
1828
+ var _a;
1829
+ const labels = this.options.labels;
1830
+ const hotkeys = this.options.hotkeys;
1831
+ const mods = (_a = this.options.modules) != null ? _a : {};
1832
+ const menuItems = [
1833
+ { action: "increaseText", label: labels.increaseText },
1834
+ { action: "decreaseText", label: labels.decreaseText },
1835
+ { action: "increaseTextSpacing", label: labels.increaseTextSpacing },
1836
+ { action: "decreaseTextSpacing", label: labels.decreaseTextSpacing },
1837
+ { action: "increaseLineHeight", label: labels.increaseLineHeight },
1838
+ { action: "decreaseLineHeight", label: labels.decreaseLineHeight },
1839
+ { action: "invertColors", label: labels.invertColors, hotkey: hotkeys.keys.invertColors },
1840
+ { action: "grayHues", label: labels.grayHues, hotkey: hotkeys.keys.grayHues },
1841
+ { action: "underlineLinks", label: labels.underlineLinks, hotkey: hotkeys.keys.underlineLinks },
1842
+ { action: "bigCursor", label: labels.bigCursor, hotkey: hotkeys.keys.bigCursor },
1843
+ { action: "readingGuide", label: labels.readingGuide, hotkey: hotkeys.keys.readingGuide },
1844
+ { action: "disableAnimations", label: labels.disableAnimations, hotkey: hotkeys.keys.disableAnimations },
1845
+ { action: "dyslexicFont", label: labels.dyslexicFont },
1846
+ { action: "hideImages", label: labels.hideImages }
1847
+ ].filter(({ action }) => mods[action] !== false).map(({ action, label, hotkey }) => ({
1848
+ type: "li",
1849
+ children: [{
1850
+ type: "button",
1851
+ attrs: { "data-access-action": action, ...hotkey ? { title: this.parseKeys(hotkey) } : {} },
1852
+ children: [
1853
+ ...action === "bigCursor" ? [{ type: "div", attrs: { id: "iconBigCursor" } }] : [],
1854
+ { type: "#text", text: label }
1855
+ ]
1856
+ }]
1857
+ }));
1858
+ const json = {
1859
+ type: "div",
1860
+ attrs: { class: "_access-menu close _access" },
1861
+ children: [
1862
+ {
1863
+ type: "div",
1864
+ attrs: { class: "_text-center", role: "presentation" },
1865
+ children: [
1866
+ {
1867
+ type: "button",
1868
+ attrs: { class: `_menu-close-btn _menu-btn ${this.options.icon.fontClass}`, style: `font-family: var(--_access-menu-close-btn-font-family, ${this._fixedDefaultFont})`, title: hotkeys.enabled ? this.parseKeys(hotkeys.keys.toggleMenu) : labels.closeTitle },
1869
+ children: [this.options.icon.closeIconElem]
1870
+ },
1871
+ { type: "#text", text: labels.menuTitle }
1872
+ ]
1873
+ },
1874
+ {
1875
+ type: "div",
1876
+ attrs: { class: "content" },
1877
+ children: [
1878
+ { type: "ul", attrs: { class: "before-collapse _access-scrollbar" }, children: menuItems },
1879
+ {
1880
+ type: "button",
1881
+ attrs: { class: "_menu-reset-btn", title: labels.resetTitle },
1882
+ children: [
1883
+ { type: "span", attrs: { class: this.options.icon.fontClass, style: `font-family: var(--_access-menu-reset-btn-font-family, ${this._fixedDefaultFont}); font-size: 18px; line-height: 1;` }, children: [this.options.icon.resetIconElem] },
1884
+ { type: "span", children: [{ type: "#text", text: labels.resetTitle }] }
1885
+ ]
1886
+ }
1887
+ ]
1888
+ },
1889
+ ...this.options.logoImage ? [{
1890
+ type: "img",
1891
+ attrs: { src: this.options.logoImage, alt: "", class: "_access-menu-logo" }
1892
+ }] : []
1893
+ ]
1894
+ };
1895
+ if (this.options.iframeModals) {
1896
+ this.options.iframeModals.forEach((im, i) => {
1897
+ var _a2, _b;
1898
+ const btn = {
1899
+ type: "li",
1900
+ children: [{
1901
+ type: "button",
1902
+ attrs: { "data-access-action": "iframeModals", "data-access-url": im.iframeUrl },
1903
+ children: [{ type: "#text", text: im.buttonText }]
1904
+ }]
1905
+ };
1906
+ const icon = im.icon && !((_a2 = this.options.icon) == null ? void 0 : _a2.useEmojis) ? im.icon : im.emoji && ((_b = this.options.icon) == null ? void 0 : _b.useEmojis) ? im.emoji : null;
1907
+ if (icon) {
1908
+ btn.children[0].attrs["data-access-iframe-index"] = String(i);
1909
+ const className = "_data-access-iframe-index-" + i;
1910
+ this._common.injectStyle(`._access-menu ul li button[data-access-action="iframeModals"][data-access-iframe-index="${i}"]:before { content: "${icon}"; }`, { className });
1911
+ this._common.deployedObjects.set("." + className, false);
1912
+ }
1913
+ const ul = json.children[1].children[0];
1914
+ if (this.options.modules.textToSpeech) ul.children.splice(ul.children.length - 2, 0, btn);
1915
+ else ul.children.push(btn);
1916
+ });
1917
+ }
1918
+ if (this.options.customFunctions) {
1919
+ this.options.customFunctions.forEach((cf, i) => {
1920
+ var _a2, _b;
1921
+ const btn = {
1922
+ type: "li",
1923
+ children: [{
1924
+ type: "button",
1925
+ attrs: { "data-access-action": "customFunctions", "data-access-custom-id": cf.id, "data-access-custom-index": String(i) },
1926
+ children: [{ type: "#text", text: cf.buttonText }]
1927
+ }]
1928
+ };
1929
+ const icon = cf.icon && !((_a2 = this.options.icon) == null ? void 0 : _a2.useEmojis) ? cf.icon : cf.emoji && ((_b = this.options.icon) == null ? void 0 : _b.useEmojis) ? cf.emoji : null;
1930
+ if (icon) {
1931
+ const className = "_data-access-custom-id-" + cf.id;
1932
+ this._common.injectStyle(`._access-menu ul li button[data-access-action="customFunctions"][data-access-custom-id="${cf.id}"]:before { content: "${icon}"; }`, { className });
1933
+ this._common.deployedObjects.set("." + className, false);
1934
+ }
1935
+ const ul = json.children[1].children[0];
1936
+ if (this.options.modules.textToSpeech) ul.children.splice(ul.children.length - 2, 0, btn);
1937
+ else ul.children.push(btn);
1938
+ });
1939
+ }
1940
+ const menuElem = this._common.jsonToHtml(json);
1941
+ this._body.appendChild(menuElem);
1942
+ setTimeout(() => {
1943
+ var _a2;
1944
+ const ic = document.getElementById("iconBigCursor");
1945
+ if (ic) {
1946
+ ic.outerHTML += '<svg version="1.1" id="iconBigCursorSvg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="position:absolute;width:19px;height:19px;top:9px;left:9px" xml:space="preserve"><path d="M 423.547 323.115 l -320 -320 c -3.051 -3.051 -7.637 -3.947 -11.627 -2.304 s -6.592 5.547 -6.592 9.856 V 480 c 0 4.501 2.837 8.533 7.083 10.048 c 4.224 1.536 8.981 0.192 11.84 -3.285 l 85.205 -104.128 l 56.853 123.179 c 1.792 3.883 5.653 6.187 9.685 6.187 c 1.408 0 2.837 -0.277 4.203 -0.875 l 74.667 -32 c 2.645 -1.131 4.736 -3.285 5.76 -5.973 c 1.024 -2.688 0.939 -5.675 -0.277 -8.299 l -57.024 -123.52 h 132.672 c 4.309 0 8.213 -2.603 9.856 -6.592 C 427.515 330.752 426.598 326.187 423.547 323.115 Z"/></svg>';
1947
+ (_a2 = document.getElementById("iconBigCursor")) == null ? void 0 : _a2.remove();
1948
+ }
1949
+ }, 1);
1950
+ this._common.deployedObjects.set("._access-menu", false);
1951
+ const addToggleListener = (el, handler) => {
1952
+ el == null ? void 0 : el.addEventListener("click", () => handler(), false);
1953
+ el == null ? void 0 : el.addEventListener("keyup", (e) => {
1954
+ if (e.key === "Enter") handler();
1955
+ }, false);
1956
+ };
1957
+ addToggleListener(menuElem.querySelector("._menu-close-btn"), () => this.toggleMenu());
1958
+ addToggleListener(menuElem.querySelector("._menu-reset-btn"), () => this.resetAll());
1959
+ return menuElem;
1960
+ }
1961
+ getVoices() {
1962
+ return new Promise((resolve) => {
1963
+ const synth = window.speechSynthesis;
1964
+ const id = setInterval(() => {
1965
+ if (synth.getVoices().length !== 0) {
1966
+ resolve(synth.getVoices());
1967
+ clearInterval(id);
1968
+ }
1969
+ }, 10);
1970
+ });
1971
+ }
1972
+ async injectTts() {
1973
+ const voices = await this.getVoices();
1974
+ const targetLang = this.options.language.textToSpeechLang.toLowerCase();
1975
+ const isLngSupported = !targetLang || voices.some(
1976
+ (v) => v.lang.toLowerCase() === targetLang || v.lang.toLowerCase().startsWith(targetLang.split("-")[0])
1977
+ );
1978
+ if (!isLngSupported) return;
1979
+ const tts = this.common.jsonToHtml({
1980
+ type: "li",
1981
+ children: [{
1982
+ type: "button",
1983
+ attrs: { "data-access-action": "textToSpeech", title: this.parseKeys(this.options.hotkeys.keys.textToSpeech) },
1984
+ children: [
1985
+ { type: "#text", text: this.options.labels.textToSpeech },
1986
+ {
1987
+ type: "div",
1988
+ attrs: { class: "screen-reader-wrapper" },
1989
+ children: [
1990
+ { type: "div", attrs: { class: "screen-reader-wrapper-step-1", tabIndex: "-1" } },
1991
+ { type: "div", attrs: { class: "screen-reader-wrapper-step-2", tabIndex: "-1" } },
1992
+ { type: "div", attrs: { class: "screen-reader-wrapper-step-3", tabIndex: "-1" } }
1993
+ ]
1994
+ }
1995
+ ]
1996
+ }]
1997
+ });
1998
+ const sts = this.common.jsonToHtml({
1999
+ type: "li",
2000
+ children: [{
2001
+ type: "button",
2002
+ attrs: { "data-access-action": "speechToText", title: this.parseKeys(this.options.hotkeys.keys.speechToText) },
2003
+ children: [{ type: "#text", text: this.options.labels.speechToText }]
2004
+ }]
2005
+ });
2006
+ const ul = this._menu.querySelector("ul");
2007
+ ul.appendChild(sts);
2008
+ ul.appendChild(tts);
2009
+ }
2010
+ addListeners() {
2011
+ this._menu.querySelectorAll("ul li").forEach((li) => {
2012
+ ["click", "keyup"].forEach(
2013
+ (evt) => li.addEventListener(evt, (e) => {
2014
+ const ev = e || window.event;
2015
+ if (ev.detail === 0 && ev.key !== "Enter") return;
2016
+ const actionEl = ev.target.closest("[data-access-action]");
2017
+ if (!actionEl) return;
2018
+ this.invoke(actionEl.getAttribute("data-access-action"), actionEl);
2019
+ })
2020
+ );
2021
+ });
2022
+ [
2023
+ ...Array.from(this._menu.getElementsByClassName("screen-reader-wrapper-step-1")),
2024
+ ...Array.from(this._menu.getElementsByClassName("screen-reader-wrapper-step-2")),
2025
+ ...Array.from(this._menu.getElementsByClassName("screen-reader-wrapper-step-3"))
2026
+ ].forEach(
2027
+ (el) => el.addEventListener("click", (e) => {
2028
+ const action = e.target.parentElement.parentElement.getAttribute("data-access-action");
2029
+ this.invoke(action, e.target);
2030
+ }, false)
2031
+ );
2032
+ }
2033
+ sortModuleTypes() {
2034
+ this.options.modulesOrder.sort((a, b) => a.order - b.order);
2035
+ }
2036
+ disableUnsupportedModulesAndSort() {
2037
+ this.sortModuleTypes();
2038
+ const ul = this._menu.querySelector("ul");
2039
+ this.options.modulesOrder.forEach((item) => {
2040
+ const module = AccessibilityModulesType[item.type];
2041
+ const enabled = this.options.modules[module];
2042
+ const btn = this._menu.querySelector(`button[data-access-action="${module}"]`);
2043
+ if (btn) {
2044
+ btn.parentElement.remove();
2045
+ ul.appendChild(btn.parentElement);
2046
+ if (!enabled) btn.parentElement.classList.add("not-supported");
2047
+ }
2048
+ });
2049
+ }
2050
+ resetAll() {
2051
+ this.menuInterface.textToSpeech(true);
2052
+ this.menuInterface.speechToText(true);
2053
+ this.menuInterface.disableAnimations(true);
2054
+ this.menuInterface.underlineLinks(true);
2055
+ this.menuInterface.grayHues(true);
2056
+ this.menuInterface.invertColors(true);
2057
+ this.menuInterface.bigCursor(true);
2058
+ this.menuInterface.readingGuide(true);
2059
+ this.menuInterface.dyslexicFont(true);
2060
+ this.menuInterface.hideImages(true);
2061
+ this.resetTextSize();
2062
+ this.resetTextSpace();
2063
+ this.resetLineHeight();
2064
+ this.menuInterface.refreshCycleButtons();
2065
+ }
2066
+ resetTextSize() {
2067
+ this.resetIfDefined(this._stateValues.body.fontSize, this._body.style, "fontSize");
2068
+ if (typeof this._htmlOrgFontSize !== "undefined") this._html.style.fontSize = this._htmlOrgFontSize;
2069
+ document.querySelectorAll("[data-init-font-size]").forEach((el) => {
2070
+ el.style.fontSize = el.getAttribute("data-init-font-size");
2071
+ el.removeAttribute("data-init-font-size");
2072
+ });
2073
+ this._sessionState.textSize = 0;
2074
+ this.onChange(true);
2075
+ }
2076
+ resetLineHeight() {
2077
+ this.resetIfDefined(this._stateValues.body.lineHeight, this.body.style, "lineHeight");
2078
+ document.querySelectorAll("[data-init-line-height]").forEach((el) => {
2079
+ el.style.lineHeight = el.getAttribute("data-init-line-height");
2080
+ el.removeAttribute("data-init-line-height");
2081
+ });
2082
+ this.sessionState.lineHeight = 0;
2083
+ this.onChange(true);
2084
+ }
2085
+ resetTextSpace() {
2086
+ this.resetIfDefined(this._stateValues.body.wordSpacing, this._body.style, "wordSpacing");
2087
+ this.resetIfDefined(this._stateValues.body.letterSpacing, this._body.style, "letterSpacing");
2088
+ document.querySelectorAll("[data-init-word-spacing]").forEach((el) => {
2089
+ el.style.wordSpacing = el.getAttribute("data-init-word-spacing");
2090
+ el.removeAttribute("data-init-word-spacing");
2091
+ });
2092
+ document.querySelectorAll("[data-init-letter-spacing]").forEach((el) => {
2093
+ el.style.letterSpacing = el.getAttribute("data-init-letter-spacing");
2094
+ el.removeAttribute("data-init-letter-spacing");
2095
+ });
2096
+ this._sessionState.textSpace = 0;
2097
+ this.onChange(true);
2098
+ }
2099
+ alterTextSize(isIncrease) {
2100
+ this._sessionState.textSize += isIncrease ? 1 : -1;
2101
+ this.onChange(true);
2102
+ let factor = this.options.textSizeFactor * (isIncrease ? 1 : -1);
2103
+ if (this.options.textPixelMode) {
2104
+ const excludeSize = Array.from(document.querySelectorAll("._access *"));
2105
+ document.querySelectorAll("*:not(._access)").forEach((el) => {
2106
+ if (excludeSize.includes(el)) return;
2107
+ const fSize = getComputedStyle(el).fontSize;
2108
+ if (fSize == null ? void 0 : fSize.includes("px")) {
2109
+ if (!el.getAttribute("data-init-font-size")) el.setAttribute("data-init-font-size", fSize);
2110
+ el.style.fontSize = parseInt(fSize) + factor + "px";
2111
+ }
2112
+ });
2113
+ const bodyFs = getComputedStyle(this._body).fontSize;
2114
+ if (bodyFs == null ? void 0 : bodyFs.includes("px")) {
2115
+ if (!this._body.getAttribute("data-init-font-size")) this._body.setAttribute("data-init-font-size", bodyFs);
2116
+ this._body.style.fontSize = parseInt(bodyFs) + factor + "px";
2117
+ }
2118
+ } else if (this.options.textEmlMode) {
2119
+ const fp = this._html.style.fontSize;
2120
+ if (fp.includes("%")) this._html.style.fontSize = parseInt(fp) + factor + "%";
2121
+ else this._common.warn("textEmlMode: html element font-size is not in %.");
2122
+ } else {
2123
+ const fSize = this._common.getFormattedDim(getComputedStyle(this._body).fontSize);
2124
+ if (typeof this._stateValues.body.fontSize === "undefined")
2125
+ this._stateValues.body.fontSize = fSize.size + fSize.suffix;
2126
+ if (fSize == null ? void 0 : fSize.suffix) this._body.style.fontSize = fSize.size + factor + fSize.suffix;
2127
+ }
2128
+ if (this._stateValues.textToSpeech) this.textToSpeech(`Text Size ${isIncrease ? "Increased" : "Decreased"}`);
2129
+ }
2130
+ alterLineHeight(isIncrease) {
2131
+ this.sessionState.lineHeight += isIncrease ? 1 : -1;
2132
+ this.onChange(true);
2133
+ let factor = (isIncrease ? 1 : -1) * (this.options.textEmlMode ? 20 : 2);
2134
+ const exclude = Array.from(document.querySelectorAll("._access *"));
2135
+ document.querySelectorAll("*:not(._access)").forEach((el) => {
2136
+ if (exclude.includes(el)) return;
2137
+ if (this.options.textPixelMode) {
2138
+ const lh = getComputedStyle(el).lineHeight;
2139
+ if (lh == null ? void 0 : lh.includes("px")) {
2140
+ if (!el.getAttribute("data-init-line-height")) el.setAttribute("data-init-line-height", lh);
2141
+ el.style.lineHeight = parseInt(lh) + factor + "px";
2142
+ }
2143
+ } else if (this.options.textEmlMode) {
2144
+ let lh = getComputedStyle(el).lineHeight;
2145
+ const fs = getComputedStyle(el).fontSize;
2146
+ if (lh === "normal") lh = parseInt(fs) * 1.2 + "px";
2147
+ if (lh == null ? void 0 : lh.includes("px")) {
2148
+ const pct = parseInt(lh) * 100 / parseInt(fs);
2149
+ if (!el.getAttribute("data-init-line-height")) el.setAttribute("data-init-line-height", pct + "%");
2150
+ el.style.lineHeight = pct + factor + "%";
2151
+ }
2152
+ if (typeof this._stateValues.body.lineHeight === "undefined") this._stateValues.body.lineHeight = "";
2153
+ }
2154
+ });
2155
+ if (this._stateValues.textToSpeech) this.textToSpeech(`Line Height ${isIncrease ? "Increased" : "Decreased"}`);
2156
+ }
2157
+ alterTextSpace(isIncrease) {
2158
+ this._sessionState.textSpace += isIncrease ? 1 : -1;
2159
+ this.onChange(true);
2160
+ const factor = isIncrease ? 2 : -2;
2161
+ if (this.options.textPixelMode) {
2162
+ const exclude = Array.from(document.querySelectorAll("._access *"));
2163
+ document.querySelectorAll("*:not(._access)").forEach((el) => {
2164
+ if (exclude.includes(el)) return;
2165
+ const ws = el.style.wordSpacing;
2166
+ if (!el.getAttribute("data-init-word-spacing")) el.setAttribute("data-init-word-spacing", ws);
2167
+ el.style.wordSpacing = (ws == null ? void 0 : ws.includes("px")) ? parseInt(ws) + factor + "px" : factor + "px";
2168
+ const ls = el.style.letterSpacing;
2169
+ if (!el.getAttribute("data-init-letter-spacing")) el.setAttribute("data-init-letter-spacing", ls);
2170
+ el.style.letterSpacing = (ls == null ? void 0 : ls.includes("px")) ? parseInt(ls) + factor + "px" : factor + "px";
2171
+ });
2172
+ } else {
2173
+ const ws = this._common.getFormattedDim(getComputedStyle(this._body).wordSpacing);
2174
+ if (typeof this._stateValues.body.wordSpacing === "undefined") this._stateValues.body.wordSpacing = "";
2175
+ if (ws == null ? void 0 : ws.suffix) this._body.style.wordSpacing = ws.size * 1 + factor + ws.suffix;
2176
+ const ls = this._common.getFormattedDim(getComputedStyle(this._body).letterSpacing);
2177
+ if (typeof this._stateValues.body.letterSpacing === "undefined") this._stateValues.body.letterSpacing = "";
2178
+ if (ls == null ? void 0 : ls.suffix) this._body.style.letterSpacing = ls.size * 1 + factor + ls.suffix;
2179
+ }
2180
+ if (this._stateValues.textToSpeech) this.textToSpeech(`Text Spacing ${isIncrease ? "Increased" : "Decreased"}`);
2181
+ }
2182
+ speechToText() {
2183
+ const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
2184
+ if (!SR) return;
2185
+ this._recognition = new SR();
2186
+ this._recognition.continuous = true;
2187
+ this._recognition.interimResults = true;
2188
+ this._recognition.onstart = () => this._body.classList.add("_access-listening");
2189
+ this._recognition.onend = () => this._body.classList.remove("_access-listening");
2190
+ this._recognition.onresult = (event) => {
2191
+ if (typeof event.results === "undefined") return;
2192
+ let final = "";
2193
+ for (let i = event.resultIndex; i < event.results.length; ++i)
2194
+ if (event.results[i].isFinal) final += event.results[i][0].transcript;
2195
+ if (final && this._speechToTextTarget) {
2196
+ this._speechToTextTarget.parentElement.classList.remove("_access-listening");
2197
+ const tag = this._speechToTextTarget.tagName.toLowerCase();
2198
+ if (tag === "input" || tag === "textarea")
2199
+ this._speechToTextTarget.value = final;
2200
+ else if (this._speechToTextTarget.getAttribute("contenteditable") !== null)
2201
+ this._speechToTextTarget.innerText = final;
2202
+ }
2203
+ };
2204
+ this._recognition.lang = this.options.language.speechToTextLang;
2205
+ this._recognition.start();
2206
+ }
2207
+ textToSpeech(text) {
2208
+ const w = window;
2209
+ if (!w.SpeechSynthesisUtterance || !w.speechSynthesis) return;
2210
+ const msg = new w.SpeechSynthesisUtterance(text);
2211
+ msg.lang = this.options.language.textToSpeechLang;
2212
+ msg.rate = this._stateValues.speechRate;
2213
+ msg.onend = () => {
2214
+ this._isReading = false;
2215
+ };
2216
+ const voices = w.speechSynthesis.getVoices();
2217
+ const voice = voices.find((v) => v.lang === msg.lang);
2218
+ if (voice) msg.voice = voice;
2219
+ else this._common.warn("text to speech language not supported!");
2220
+ if (window.speechSynthesis.pending || window.speechSynthesis.speaking) window.speechSynthesis.cancel();
2221
+ window.speechSynthesis.speak(msg);
2222
+ this._isReading = true;
2223
+ }
2224
+ createScreenShot(url) {
2225
+ return this._common.createScreenshot(url);
2226
+ }
2227
+ listen() {
2228
+ var _a, _b, _c;
2229
+ (_b = (_a = this._recognition) == null ? void 0 : _a.stop) == null ? void 0 : _b.call(_a);
2230
+ this._speechToTextTarget = (_c = window.event) == null ? void 0 : _c.target;
2231
+ this.speechToText();
2232
+ }
2233
+ read(e) {
2234
+ var _a, _b, _c, _d, _e, _f, _g;
2235
+ try {
2236
+ e = window.event || e;
2237
+ (_a = e == null ? void 0 : e.preventDefault) == null ? void 0 : _a.call(e);
2238
+ (_b = e == null ? void 0 : e.stopPropagation) == null ? void 0 : _b.call(e);
2239
+ } catch (e2) {
2240
+ }
2241
+ const menuEls = Array.from(document.querySelectorAll("._access-menu *"));
2242
+ if (menuEls.includes((_c = window.event) == null ? void 0 : _c.target) && e instanceof MouseEvent) return;
2243
+ if (e instanceof KeyboardEvent && (e.shiftKey && e.key === "Tab" || e.key === "Tab")) {
2244
+ this.textToSpeech((_e = (_d = window.event) == null ? void 0 : _d.target) == null ? void 0 : _e.innerText);
2245
+ return;
2246
+ }
2247
+ if (this._isReading) {
2248
+ window.speechSynthesis.cancel();
2249
+ this._isReading = false;
2250
+ } else this.textToSpeech((_g = (_f = window.event) == null ? void 0 : _f.target) == null ? void 0 : _g.innerText);
2251
+ }
2252
+ runHotkey(name) {
2253
+ if (name === "toggleMenu") {
2254
+ this.toggleMenu();
2255
+ return;
2256
+ }
2257
+ if (typeof this.menuInterface[name] === "function" && this._options.modules[name])
2258
+ this.menuInterface[name](false);
2259
+ }
2260
+ toggleMenu() {
2261
+ const shouldClose = this._menu.classList.contains("close");
2262
+ setTimeout(() => this._menu.querySelector("ul").classList.toggle("before-collapse"), shouldClose ? 10 : 500);
2263
+ this._menu.classList.toggle("close");
2264
+ this.options.icon.tabIndex = shouldClose ? 0 : -1;
2265
+ this._menu.childNodes.forEach((child) => {
2266
+ if (child.hasChildNodes() && child.nodeType === Node.ELEMENT_NODE && child.tagName === "P")
2267
+ child.tabIndex = -1;
2268
+ });
2269
+ }
2270
+ invoke(action, button) {
2271
+ if (typeof this.menuInterface[action] === "function")
2272
+ this.menuInterface[action](void 0, button);
2273
+ }
2274
+ onKeyDown(e) {
2275
+ const act = Object.entries(this.options.hotkeys.keys).find(
2276
+ ([, keys]) => keys.every((k) => Number.isInteger(k) ? e.keyCode === k : e[k] === true)
2277
+ );
2278
+ if (act) this.runHotkey(act[0]);
2279
+ }
2280
+ build() {
2281
+ this._stateValues = { underlineLinks: false, textToSpeech: false, bigCursor: false, readingGuide: false, speechRate: 1, body: {}, html: {} };
2282
+ this._body = document.body;
2283
+ this._html = document.documentElement;
2284
+ if (this.options.textEmlMode) this.initFontSize();
2285
+ this.injectCss(!this.options.suppressCssInjection && !this.options.suppressDomInjection);
2286
+ if (!this.options.suppressDomInjection) {
2287
+ this._icon = this.injectIcon();
2288
+ this._menu = this.injectMenu();
2289
+ this.injectTts();
2290
+ setTimeout(() => {
2291
+ this.addListeners();
2292
+ this.disableUnsupportedModulesAndSort();
2293
+ }, 10);
2294
+ if (this.options.hotkeys.enabled) document.addEventListener("keydown", this._onKeyDownBind, false);
2295
+ this._icon.addEventListener("click", () => this.toggleMenu(), false);
2296
+ this._icon.addEventListener("keyup", (e) => {
2297
+ if (e.key === "Enter") this.toggleMenu();
2298
+ }, false);
2299
+ setTimeout(() => {
2300
+ this._icon.style.opacity = "1";
2301
+ }, 10);
2302
+ document.addEventListener("keydown", (e) => {
2303
+ if (e.key === "Escape" && !this._menu.classList.contains("close")) this.toggleMenu();
2304
+ }, false);
2305
+ document.addEventListener("click", (e) => {
2306
+ if (this._menu.classList.contains("close")) return;
2307
+ if (this._menu.contains(e.target) || this._icon.contains(e.target)) return;
2308
+ this.toggleMenu();
2309
+ }, false);
2310
+ }
2311
+ this.updateReadGuide = (e) => {
2312
+ const newPos = e.type === "touchmove" ? e.changedTouches[0].clientY : e.y;
2313
+ const bar = document.getElementById("access_read_guide_bar");
2314
+ if (bar) bar.style.top = newPos - (parseInt(this.options.guide.height) + 5) + "px";
2315
+ };
2316
+ this.menuInterface = new MenuInterface(this);
2317
+ if (this.options.session.persistent) this.setSessionFromCache();
2318
+ }
2319
+ updateReadGuide(e) {
2320
+ const newPos = e.type === "touchmove" ? e.changedTouches[0].clientY : e.y;
2321
+ const bar = document.getElementById("access_read_guide_bar");
2322
+ if (bar) bar.style.top = newPos - (parseInt(this.options.guide.height) + 5) + "px";
2323
+ }
2324
+ resetIfDefined(src, dest, prop) {
2325
+ if (typeof src !== "undefined") dest[prop] = src;
2326
+ }
2327
+ onChange(updateSession) {
2328
+ if (updateSession && this.options.session.persistent) this.saveSession();
2329
+ }
2330
+ saveSession() {
2331
+ this._storage.set("_accessState", this.sessionState);
2332
+ }
2333
+ setSessionFromCache() {
2334
+ const s = this._storage.get("_accessState");
2335
+ if (!s) return;
2336
+ if (s.textSize) {
2337
+ let n = s.textSize;
2338
+ if (n > 0) while (n--) this.alterTextSize(true);
2339
+ else while (n++) this.alterTextSize(false);
2340
+ }
2341
+ if (s.textSpace) {
2342
+ let n = s.textSpace;
2343
+ if (n > 0) while (n--) this.alterTextSpace(true);
2344
+ else while (n++) this.alterTextSpace(false);
2345
+ }
2346
+ if (s.lineHeight) {
2347
+ let n = s.lineHeight;
2348
+ if (n > 0) while (n--) this.alterLineHeight(true);
2349
+ else while (n++) this.alterLineHeight(false);
2350
+ }
2351
+ if (s.invertColors) this.menuInterface.invertColors();
2352
+ if (s.grayHues) this.menuInterface.grayHues();
2353
+ if (s.underlineLinks) this.menuInterface.underlineLinks();
2354
+ if (s.bigCursor) this.menuInterface.bigCursor();
2355
+ if (s.readingGuide) this.menuInterface.readingGuide();
2356
+ this.sessionState = s;
2357
+ }
2358
+ destroy() {
2359
+ this._common.deployedObjects.getAll().forEach((_, key) => {
2360
+ var _a, _b;
2361
+ (_b = (_a = document.querySelector(key)) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.removeChild(document.querySelector(key));
2362
+ });
2363
+ document.removeEventListener("keydown", this._onKeyDownBind, false);
2364
+ }
2365
+ };
2366
+ _Accessibility.CSS_CLASS_NAME = "_access-main-css";
2367
+ _Accessibility.MENU_WIDTH = "20vw";
2368
+ var Accessibility = _Accessibility;
2369
+ var main_default = Accessibility;
2370
+
2371
+ // src/theme.ts
2372
+ var VAR_MAP = {
2373
+ primaryColor: ["--_access-icon-bg", "--_access-menu-item-button-active-background-color"],
2374
+ menuBackground: "--_access-menu-background-color",
2375
+ menuColor: "--_access-menu-color",
2376
+ iconBackground: "--_access-icon-bg",
2377
+ iconColor: "--_access-icon-color",
2378
+ menuWidth: "--_access-menu-width",
2379
+ borderRadius: ["--_access-menu-border-radius", "--_access-icon-border-radius", "--_access-menu-item-button-border-radius"],
2380
+ fontFamily: "--_access-menu-font-family",
2381
+ itemColor: "--_access-menu-item-color",
2382
+ itemButtonBackground: "--_access-menu-item-button-background",
2383
+ itemButtonHoverBackground: "--_access-menu-item-button-hover-background-color",
2384
+ itemIconColor: "--_access-menu-item-icon-color",
2385
+ iconBoxShadow: "--_access-icon-box-shadow",
2386
+ menuHeight: "--_access-menu-height",
2387
+ menuMaxHeight: "--_access-menu-max-height",
2388
+ menuTop: "--_access-menu-top"
2389
+ };
2390
+ function createThemeCss(theme) {
2391
+ const declarations = [];
2392
+ for (const [key, value] of Object.entries(theme)) {
2393
+ if (!value) continue;
2394
+ const vars = VAR_MAP[key];
2395
+ if (!vars) continue;
2396
+ const varList = Array.isArray(vars) ? vars : [vars];
2397
+ varList.forEach((v) => declarations.push(` ${v}: ${value};`));
2398
+ }
2399
+ return `:root {
2400
+ ${declarations.join("\n")}
2401
+ }`;
2402
+ }
2403
+ function applyTheme(theme) {
2404
+ const css = createThemeCss(theme);
2405
+ const id = "accessibility-widget-theme";
2406
+ const existing = document.getElementById(id);
2407
+ if (existing) {
2408
+ existing.textContent = css;
2409
+ return;
2410
+ }
2411
+ const style = document.createElement("style");
2412
+ style.id = id;
2413
+ style.textContent = css;
2414
+ document.head.appendChild(style);
2415
+ }
2416
+ function removeTheme() {
2417
+ var _a;
2418
+ (_a = document.getElementById("accessibility-widget-theme")) == null ? void 0 : _a.remove();
2419
+ }
2420
+
2421
+ // src/presets/pt-br.ts
2422
+ var ptBRLabels = {
2423
+ resetTitle: "Resetar",
2424
+ closeTitle: "Fechar",
2425
+ menuTitle: "Menu de Acessibilidade",
2426
+ increaseText: "Aumentar texto",
2427
+ decreaseText: "Diminuir texto",
2428
+ increaseTextSpacing: "Aumentar espa\xE7amento",
2429
+ decreaseTextSpacing: "Diminuir espa\xE7amento",
2430
+ invertColors: "Inverter cores",
2431
+ grayHues: "Tons de cinza",
2432
+ bigCursor: "Cursor grande",
2433
+ readingGuide: "Guia de leitura",
2434
+ underlineLinks: "Sublinhar links",
2435
+ textToSpeech: "Texto para fala",
2436
+ speechToText: "Fala para texto",
2437
+ disableAnimations: "Desativar anima\xE7\xF5es",
2438
+ increaseLineHeight: "Aumentar altura de linha",
2439
+ decreaseLineHeight: "Diminuir altura de linha",
2440
+ hotkeyPrefix: "Atalho: ",
2441
+ dyslexicFont: "Fonte para dislexia",
2442
+ hideImages: "Ocultar imagens"
2443
+ };
2444
+
2445
+ // src/presets/modules.ts
2446
+ function createModule(config) {
2447
+ var _a;
2448
+ return {
2449
+ id: config.id,
2450
+ buttonText: config.label,
2451
+ icon: config.icon,
2452
+ emoji: config.emoji,
2453
+ toggle: (_a = config.toggle) != null ? _a : true,
2454
+ method: (_cf, active) => {
2455
+ var _a2;
2456
+ if (active) config.onActivate();
2457
+ else (_a2 = config.onDeactivate) == null ? void 0 : _a2.call(config);
2458
+ }
2459
+ };
2460
+ }
2461
+ function createModules(configs) {
2462
+ return configs.map(createModule);
2463
+ }
2464
+
2465
+ // src/accessibility.ts
2466
+ if (typeof window !== "undefined") {
2467
+ window.Accessibility = main_default;
2468
+ }
2469
+ var accessibility_default = main_default;
2470
+ return __toCommonJS(accessibility_exports);
2471
+ })();
2472
+ //# sourceMappingURL=index.global.js.map