@swisspost/design-system-components 8.1.0 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/cjs/{index-a1440961.js → index-01f30442.js} +13 -0
  2. package/dist/cjs/{index-baad16da.js → index-c15bd800.js} +43 -5
  3. package/dist/cjs/index.cjs.js +19 -17
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/{package-fd539ea9.js → package-f9a656fd.js} +1 -1
  6. package/dist/cjs/{post-accordion-bebb0498.js → post-accordion-30216884.js} +2 -2
  7. package/dist/cjs/{post-accordion-item-b15bcbb9.js → post-accordion-item-4eba14e6.js} +3 -3
  8. package/dist/cjs/post-accordion-item.cjs.entry.js +4 -4
  9. package/dist/cjs/post-accordion.cjs.entry.js +3 -3
  10. package/dist/cjs/{post-alert-4a1ab7e3.js → post-alert-e305480e.js} +3 -3
  11. package/dist/cjs/post-alert.cjs.entry.js +4 -4
  12. package/dist/cjs/post-card-control-e63582f3.js +272 -0
  13. package/dist/cjs/post-card-control.cjs.entry.js +3 -3
  14. package/dist/cjs/{post-collapsible-trigger-b82b368e.js → post-collapsible-trigger-5d8b9047.js} +3 -3
  15. package/dist/cjs/post-collapsible_2.cjs.entry.js +4 -4
  16. package/dist/cjs/post-components.cjs.js +2 -2
  17. package/dist/cjs/{post-icon-36f7a65e.js → post-icon-8ab009d4.js} +3 -3
  18. package/dist/cjs/post-icon.cjs.entry.js +4 -4
  19. package/dist/cjs/post-logo-9f4c551c.js +39 -0
  20. package/dist/cjs/post-logo.cjs.entry.js +14 -0
  21. package/dist/cjs/{post-popover-eb936464.js → post-popover-3f14dab4.js} +3 -3
  22. package/dist/cjs/post-popover.cjs.entry.js +3 -3
  23. package/dist/cjs/{post-popovercontainer-ba97a4b4.js → post-popovercontainer-5f1717be.js} +4 -4
  24. package/dist/cjs/post-popovercontainer.cjs.entry.js +3 -3
  25. package/dist/cjs/{post-rating-1df2edf5.js → post-rating-b6ebb2d7.js} +3 -3
  26. package/dist/cjs/post-rating.cjs.entry.js +3 -3
  27. package/dist/cjs/{post-tab-header-52ce1af4.js → post-tab-header-ebd691dd.js} +3 -3
  28. package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
  29. package/dist/cjs/{post-tab-panel-e94c9c58.js → post-tab-panel-a15af8bb.js} +3 -3
  30. package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
  31. package/dist/cjs/{post-tabs-af38f271.js → post-tabs-d3233bc8.js} +28 -7
  32. package/dist/cjs/post-tabs.cjs.entry.js +3 -3
  33. package/dist/cjs/{post-tag-1dcddcae.js → post-tag-534251e7.js} +4 -4
  34. package/dist/cjs/post-tag.cjs.entry.js +3 -3
  35. package/dist/cjs/{post-tooltip-1e8d5f4e.js → post-tooltip-a8399659.js} +4 -4
  36. package/dist/cjs/post-tooltip.cjs.entry.js +4 -4
  37. package/dist/collection/collection-manifest.json +1 -0
  38. package/dist/collection/components/post-card-control/post-card-control.css +1 -1
  39. package/dist/collection/components/post-card-control/post-card-control.js +23 -25
  40. package/dist/collection/components/post-logo/post-logo.css +1 -0
  41. package/dist/collection/components/post-logo/post-logo.js +73 -0
  42. package/dist/collection/components/post-popover/post-popover.js +1 -1
  43. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +2 -2
  44. package/dist/collection/components/post-rating/post-rating.js +1 -1
  45. package/dist/collection/components/post-tab-header/post-tab-header.js +1 -1
  46. package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
  47. package/dist/collection/components/post-tabs/post-tabs.js +6 -5
  48. package/dist/collection/components/post-tag/post-tag.css +1 -1
  49. package/dist/collection/components/post-tag/post-tag.js +1 -1
  50. package/dist/collection/components/post-tooltip/post-tooltip.js +1 -1
  51. package/dist/collection/index.js +1 -0
  52. package/dist/collection/utils/component-on-ready.js +20 -0
  53. package/dist/collection/utils/index.js +1 -0
  54. package/dist/collection/utils/property-checkers/check-url.js +10 -0
  55. package/dist/collection/utils/property-checkers/index.js +3 -0
  56. package/dist/components/index.js +1 -0
  57. package/dist/components/index2.js +13 -1
  58. package/dist/components/package.js +1 -1
  59. package/dist/components/post-card-control2.js +21 -64
  60. package/dist/components/post-logo.d.ts +11 -0
  61. package/dist/components/post-logo.js +6 -0
  62. package/dist/components/post-logo2.js +56 -0
  63. package/dist/components/post-popover2.js +1 -1
  64. package/dist/components/post-popovercontainer2.js +2 -2
  65. package/dist/components/post-rating2.js +1 -1
  66. package/dist/components/post-tab-header2.js +1 -1
  67. package/dist/components/post-tab-panel2.js +1 -1
  68. package/dist/components/post-tabs2.js +26 -5
  69. package/dist/components/post-tag2.js +2 -2
  70. package/dist/components/post-tooltip2.js +1 -1
  71. package/dist/docs.json +64 -5
  72. package/dist/esm/{index-189d3985.js → index-0b56fc28.js} +43 -5
  73. package/dist/esm/{index-d1eba94c.js → index-f41b763f.js} +13 -1
  74. package/dist/esm/index.js +18 -17
  75. package/dist/esm/loader.js +3 -3
  76. package/dist/esm/{package-8c58ace7.js → package-f02beabb.js} +1 -1
  77. package/dist/esm/{post-accordion-6b2f2b73.js → post-accordion-f850422a.js} +2 -2
  78. package/dist/esm/{post-accordion-item-c8614cda.js → post-accordion-item-c2eaeaa7.js} +3 -3
  79. package/dist/esm/post-accordion-item.entry.js +4 -4
  80. package/dist/esm/post-accordion.entry.js +3 -3
  81. package/dist/esm/{post-alert-de5e60d3.js → post-alert-f17886df.js} +3 -3
  82. package/dist/esm/post-alert.entry.js +4 -4
  83. package/dist/esm/post-card-control-25bbcb80.js +270 -0
  84. package/dist/esm/post-card-control.entry.js +3 -3
  85. package/dist/esm/{post-collapsible-trigger-221d58c1.js → post-collapsible-trigger-49da97d7.js} +3 -3
  86. package/dist/esm/post-collapsible_2.entry.js +4 -4
  87. package/dist/esm/post-components.js +3 -3
  88. package/dist/esm/{post-icon-0f2f4f9b.js → post-icon-168d95b5.js} +3 -3
  89. package/dist/esm/post-icon.entry.js +4 -4
  90. package/dist/esm/post-logo-47744c24.js +37 -0
  91. package/dist/esm/post-logo.entry.js +6 -0
  92. package/dist/esm/{post-popover-2e6ada87.js → post-popover-594e9965.js} +3 -3
  93. package/dist/esm/post-popover.entry.js +3 -3
  94. package/dist/esm/{post-popovercontainer-0c396235.js → post-popovercontainer-89cee0fe.js} +4 -4
  95. package/dist/esm/post-popovercontainer.entry.js +3 -3
  96. package/dist/esm/{post-rating-fcf19507.js → post-rating-b87dfbdc.js} +3 -3
  97. package/dist/esm/post-rating.entry.js +3 -3
  98. package/dist/esm/{post-tab-header-75337bbc.js → post-tab-header-2c59fd6e.js} +3 -3
  99. package/dist/esm/post-tab-header.entry.js +3 -3
  100. package/dist/esm/{post-tab-panel-1ca4f5c9.js → post-tab-panel-40bf9d2d.js} +3 -3
  101. package/dist/esm/post-tab-panel.entry.js +3 -3
  102. package/dist/esm/{post-tabs-77ac9eee.js → post-tabs-264e5871.js} +28 -7
  103. package/dist/esm/post-tabs.entry.js +3 -3
  104. package/dist/esm/{post-tag-9741c642.js → post-tag-a7c63782.js} +4 -4
  105. package/dist/esm/post-tag.entry.js +3 -3
  106. package/dist/esm/{post-tooltip-c69b7162.js → post-tooltip-5d2d9e1f.js} +4 -4
  107. package/dist/esm/post-tooltip.entry.js +4 -4
  108. package/dist/post-components/index.esm.js +1 -1
  109. package/dist/post-components/p-04cb82f1.entry.js +1 -0
  110. package/dist/post-components/{p-ed2b2d33.js → p-057d7d3a.js} +1 -1
  111. package/dist/post-components/{p-38abadc5.js → p-0cca56a8.js} +2 -2
  112. package/dist/post-components/p-12f3ce0c.entry.js +1 -0
  113. package/dist/post-components/p-176b59a8.entry.js +1 -0
  114. package/dist/post-components/p-1800787b.js +1 -0
  115. package/dist/post-components/{p-d2753c4a.js → p-300eb394.js} +1 -1
  116. package/dist/post-components/{p-88fc0fa3.js → p-517f2648.js} +1 -1
  117. package/dist/post-components/p-53eb6ca5.entry.js +1 -0
  118. package/dist/post-components/p-5607b941.js +1 -0
  119. package/dist/post-components/p-5b918e0f.entry.js +1 -0
  120. package/dist/post-components/p-6069d96e.entry.js +1 -0
  121. package/dist/post-components/p-6b8378bf.js +1 -0
  122. package/dist/post-components/p-71b8ba91.entry.js +1 -0
  123. package/dist/post-components/p-78806458.entry.js +1 -0
  124. package/dist/post-components/p-851ef572.entry.js +1 -0
  125. package/dist/post-components/{p-2c424cd4.js → p-8b28c907.js} +1 -1
  126. package/dist/post-components/{p-e4acf838.js → p-90eec417.js} +1 -1
  127. package/dist/post-components/p-9f2fc85c.js +1 -0
  128. package/dist/post-components/{p-1e374a42.js → p-ac5a88be.js} +1 -1
  129. package/dist/post-components/{p-8a781b6e.js → p-aca6ea02.js} +1 -1
  130. package/dist/post-components/p-b08e169f.entry.js +1 -0
  131. package/dist/post-components/p-b6b61f13.js +1 -0
  132. package/dist/post-components/{p-32713474.js → p-b8c5020d.js} +1 -1
  133. package/dist/post-components/p-be553212.entry.js +1 -0
  134. package/dist/post-components/p-bf357eb3.entry.js +1 -0
  135. package/dist/post-components/{p-d36a5db5.js → p-c76880ff.js} +1 -1
  136. package/dist/post-components/p-d2f9de94.js +2 -0
  137. package/dist/post-components/p-d4163064.js +1 -0
  138. package/dist/post-components/p-ddab4c09.entry.js +1 -0
  139. package/dist/post-components/p-deb4131c.js +1 -0
  140. package/dist/post-components/p-e597a879.entry.js +1 -0
  141. package/dist/post-components/p-eafc65f6.entry.js +1 -0
  142. package/dist/post-components/post-components.esm.js +1 -1
  143. package/dist/types/components/post-card-control/post-card-control.d.ts +5 -7
  144. package/dist/types/components/post-logo/post-logo.d.ts +14 -0
  145. package/dist/types/components.d.ts +29 -8
  146. package/dist/types/index.d.ts +1 -0
  147. package/dist/types/utils/component-on-ready.d.ts +6 -0
  148. package/dist/types/utils/index.d.ts +1 -0
  149. package/dist/types/utils/property-checkers/check-url.d.ts +1 -0
  150. package/dist/types/utils/property-checkers/index.d.ts +2 -0
  151. package/loaders/attribute-observer.js +25 -0
  152. package/loaders/check-non-empty.js +9 -0
  153. package/loaders/check-one-of.js +6 -0
  154. package/loaders/check-type.js +14 -0
  155. package/loaders/constants.js +3 -0
  156. package/loaders/fade.js +7 -0
  157. package/loaders/heading-levels.js +3 -0
  158. package/loaders/index.d.ts +68 -0
  159. package/loaders/index.js +18 -0
  160. package/loaders/index2.js +34 -0
  161. package/loaders/package.js +3 -0
  162. package/loaders/post-accordion-item.d.ts +11 -0
  163. package/loaders/post-accordion-item.js +86 -0
  164. package/loaders/post-accordion.d.ts +11 -0
  165. package/loaders/post-accordion.js +128 -0
  166. package/loaders/post-alert.d.ts +11 -0
  167. package/loaders/post-alert.js +139 -0
  168. package/loaders/post-card-control.d.ts +11 -0
  169. package/loaders/post-card-control.js +306 -0
  170. package/loaders/post-collapsible-trigger.d.ts +11 -0
  171. package/loaders/post-collapsible-trigger.js +6 -0
  172. package/loaders/post-collapsible-trigger2.js +144 -0
  173. package/loaders/post-collapsible.d.ts +11 -0
  174. package/loaders/post-collapsible.js +6 -0
  175. package/loaders/post-collapsible2.js +103 -0
  176. package/loaders/post-icon.d.ts +11 -0
  177. package/loaders/post-icon.js +6 -0
  178. package/loaders/post-icon2.js +136 -0
  179. package/loaders/post-logo.d.ts +11 -0
  180. package/loaders/post-logo.js +59 -0
  181. package/loaders/post-popover.d.ts +11 -0
  182. package/loaders/post-popover.js +133 -0
  183. package/loaders/post-popovercontainer.d.ts +11 -0
  184. package/loaders/post-popovercontainer.js +6 -0
  185. package/loaders/post-popovercontainer2.js +2204 -0
  186. package/loaders/post-rating.d.ts +11 -0
  187. package/loaders/post-rating.js +116 -0
  188. package/loaders/post-tab-header.d.ts +11 -0
  189. package/loaders/post-tab-header.js +53 -0
  190. package/loaders/post-tab-panel.d.ts +11 -0
  191. package/loaders/post-tab-panel.js +45 -0
  192. package/loaders/post-tabs.d.ts +11 -0
  193. package/loaders/post-tabs.js +192 -0
  194. package/loaders/post-tag.d.ts +11 -0
  195. package/loaders/post-tag.js +77 -0
  196. package/loaders/post-tooltip.d.ts +11 -0
  197. package/loaders/post-tooltip.js +5000 -0
  198. package/package.json +12 -11
  199. package/dist/cjs/post-card-control-c363c793.js +0 -315
  200. package/dist/esm/post-card-control-38a302fe.js +0 -313
  201. package/dist/post-components/p-02d1f275.js +0 -1
  202. package/dist/post-components/p-28e17fd1.entry.js +0 -1
  203. package/dist/post-components/p-6dd5d5ba.entry.js +0 -1
  204. package/dist/post-components/p-726fec57.js +0 -1
  205. package/dist/post-components/p-7301b124.entry.js +0 -1
  206. package/dist/post-components/p-7bdec425.js +0 -1
  207. package/dist/post-components/p-7fc15b07.entry.js +0 -1
  208. package/dist/post-components/p-80f33a98.js +0 -1
  209. package/dist/post-components/p-8126cca3.entry.js +0 -1
  210. package/dist/post-components/p-8b86cde6.entry.js +0 -1
  211. package/dist/post-components/p-95b7403d.entry.js +0 -1
  212. package/dist/post-components/p-a0187d40.entry.js +0 -1
  213. package/dist/post-components/p-a5c8a3de.js +0 -1
  214. package/dist/post-components/p-a931e3c6.entry.js +0 -1
  215. package/dist/post-components/p-b5f7d9e5.entry.js +0 -1
  216. package/dist/post-components/p-b9176139.entry.js +0 -1
  217. package/dist/post-components/p-c0f265c8.js +0 -2
  218. package/dist/post-components/p-c88f169d.entry.js +0 -1
  219. package/dist/post-components/p-e6bc1a0c.entry.js +0 -1
  220. package/dist/post-components/p-ea2954f3.entry.js +0 -1
  221. package/dist/post-components/p-f91c0e1b.js +0 -1
@@ -0,0 +1,5000 @@
1
+ import { proxyCustomElement, HTMLElement as HTMLElement$1, h, Host } from '@stencil/core/internal/client';
2
+ import { v as version$1 } from './package.js';
3
+ import { g as getAttributeObserver } from './attribute-observer.js';
4
+ import { c as checkEmptyOrType } from './index2.js';
5
+ import { d as defineCustomElement$2 } from './post-popovercontainer2.js';
6
+
7
+ function timeout(delay) {
8
+ return new Promise(resolve => setTimeout(resolve, delay));
9
+ }
10
+
11
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
12
+
13
+ function getDefaultExportFromCjs (x) {
14
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
15
+ }
16
+
17
+ var focusable = {exports: {}};
18
+
19
+ var focusRelevant = {exports: {}};
20
+
21
+ var parents = {exports: {}};
22
+
23
+ var contextToElement = {exports: {}};
24
+
25
+ var nodeArray = {exports: {}};
26
+
27
+ (function (module, exports) {
28
+
29
+ Object.defineProperty(exports, "__esModule", {
30
+ value: true
31
+ });
32
+
33
+ exports.default = function (input) {
34
+ if (!input) {
35
+ return [];
36
+ }
37
+
38
+ if (Array.isArray(input)) {
39
+ return input;
40
+ }
41
+
42
+ // instanceof Node - does not work with iframes
43
+ if (input.nodeType !== undefined) {
44
+ return [input];
45
+ }
46
+
47
+ if (typeof input === 'string') {
48
+ input = document.querySelectorAll(input);
49
+ }
50
+
51
+ if (input.length !== undefined) {
52
+ return [].slice.call(input, 0);
53
+ }
54
+
55
+ throw new TypeError('unexpected input ' + String(input));
56
+ };
57
+
58
+ module.exports = exports['default'];
59
+ // input may be undefined, selector-tring, Node, NodeList, HTMLCollection, array of Nodes
60
+ // yes, to some extent this is a bad replica of jQuery's constructor function
61
+
62
+ }(nodeArray, nodeArray.exports));
63
+
64
+ (function (module, exports) {
65
+
66
+ Object.defineProperty(exports, "__esModule", {
67
+ value: true
68
+ });
69
+
70
+ exports.default = function (_ref) {
71
+ var context = _ref.context,
72
+ _ref$label = _ref.label,
73
+ label = _ref$label === undefined ? 'context-to-element' : _ref$label,
74
+ resolveDocument = _ref.resolveDocument,
75
+ defaultToDocument = _ref.defaultToDocument;
76
+
77
+ var element = (0, _nodeArray2.default)(context)[0];
78
+
79
+ if (resolveDocument && element && element.nodeType === Node.DOCUMENT_NODE) {
80
+ element = element.documentElement;
81
+ }
82
+
83
+ if (!element && defaultToDocument) {
84
+ return document.documentElement;
85
+ }
86
+
87
+ if (!element) {
88
+ throw new TypeError(label + ' requires valid options.context');
89
+ }
90
+
91
+ if (element.nodeType !== Node.ELEMENT_NODE && element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
92
+ throw new TypeError(label + ' requires options.context to be an Element');
93
+ }
94
+
95
+ return element;
96
+ };
97
+
98
+ var _nodeArray = nodeArray.exports;
99
+
100
+ var _nodeArray2 = _interopRequireDefault(_nodeArray);
101
+
102
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
103
+
104
+ module.exports = exports['default'];
105
+
106
+ }(contextToElement, contextToElement.exports));
107
+
108
+ (function (module, exports) {
109
+
110
+ Object.defineProperty(exports, "__esModule", {
111
+ value: true
112
+ });
113
+
114
+ exports.default = function () {
115
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
116
+ context = _ref.context;
117
+
118
+ var list = [];
119
+ var element = (0, _contextToElement2.default)({
120
+ label: 'get/parents',
121
+ context: context
122
+ });
123
+
124
+ while (element) {
125
+ list.push(element);
126
+ // IE does know support parentElement on SVGElement
127
+ element = element.parentNode;
128
+ if (element && element.nodeType !== Node.ELEMENT_NODE) {
129
+ element = null;
130
+ }
131
+ }
132
+
133
+ return list;
134
+ };
135
+
136
+ var _contextToElement = contextToElement.exports;
137
+
138
+ var _contextToElement2 = _interopRequireDefault(_contextToElement);
139
+
140
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
141
+
142
+ module.exports = exports['default'];
143
+
144
+ // [elem, elem.parent, elem.parent.parent, …, html]
145
+ // will not contain the shadowRoot (DOCUMENT_FRAGMENT_NODE) and shadowHost
146
+
147
+ }(parents, parents.exports));
148
+
149
+ var elementMatches = {exports: {}};
150
+
151
+ (function (module, exports) {
152
+
153
+ Object.defineProperty(exports, "__esModule", {
154
+ value: true
155
+ });
156
+ exports.default = elementMatches;
157
+
158
+ // Element.prototype.matches may be available at a different name
159
+ // https://developer.mozilla.org/en/docs/Web/API/Element/matches
160
+
161
+ var names = ['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector'];
162
+ var name = null;
163
+
164
+ function findMethodName(element) {
165
+ names.some(function (_name) {
166
+ if (!element[_name]) {
167
+ return false;
168
+ }
169
+
170
+ name = _name;
171
+ return true;
172
+ });
173
+ }
174
+
175
+ function elementMatches(element, selector) {
176
+ if (!name) {
177
+ findMethodName(element);
178
+ }
179
+
180
+ return element[name](selector);
181
+ }
182
+ module.exports = exports['default'];
183
+
184
+ }(elementMatches, elementMatches.exports));
185
+
186
+ var tabindexValue = {exports: {}};
187
+
188
+ var validTabindex = {exports: {}};
189
+
190
+ var supports = {exports: {}};
191
+
192
+ var detectFocus = {exports: {}};
193
+
194
+ var platform$1 = {exports: {}};
195
+
196
+ var platform = {exports: {}};
197
+
198
+ /*!
199
+ * Platform.js <https://mths.be/platform>
200
+ * Copyright 2014-2016 Benjamin Tan <https://demoneaux.github.io/>
201
+ * Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
202
+ * Available under MIT license <https://mths.be/mit>
203
+ */
204
+
205
+ (function (module, exports) {
206
+ (function() {
207
+
208
+ /** Used to determine if values are of the language type `Object`. */
209
+ var objectTypes = {
210
+ 'function': true,
211
+ 'object': true
212
+ };
213
+
214
+ /** Used as a reference to the global object. */
215
+ var root = (objectTypes[typeof window] && window) || this;
216
+
217
+ /** Backup possible global object. */
218
+ var oldRoot = root;
219
+
220
+ /** Detect free variable `exports`. */
221
+ var freeExports = exports;
222
+
223
+ /** Detect free variable `module`. */
224
+ var freeModule = module && !module.nodeType && module;
225
+
226
+ /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
227
+ var freeGlobal = freeExports && freeModule && typeof commonjsGlobal == 'object' && commonjsGlobal;
228
+ if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
229
+ root = freeGlobal;
230
+ }
231
+
232
+ /**
233
+ * Used as the maximum length of an array-like object.
234
+ * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
235
+ * for more details.
236
+ */
237
+ var maxSafeInteger = Math.pow(2, 53) - 1;
238
+
239
+ /** Regular expression to detect Opera. */
240
+ var reOpera = /\bOpera/;
241
+
242
+ /** Possible global object. */
243
+ var thisBinding = this;
244
+
245
+ /** Used for native method references. */
246
+ var objectProto = Object.prototype;
247
+
248
+ /** Used to check for own properties of an object. */
249
+ var hasOwnProperty = objectProto.hasOwnProperty;
250
+
251
+ /** Used to resolve the internal `[[Class]]` of values. */
252
+ var toString = objectProto.toString;
253
+
254
+ /*--------------------------------------------------------------------------*/
255
+
256
+ /**
257
+ * Capitalizes a string value.
258
+ *
259
+ * @private
260
+ * @param {string} string The string to capitalize.
261
+ * @returns {string} The capitalized string.
262
+ */
263
+ function capitalize(string) {
264
+ string = String(string);
265
+ return string.charAt(0).toUpperCase() + string.slice(1);
266
+ }
267
+
268
+ /**
269
+ * A utility function to clean up the OS name.
270
+ *
271
+ * @private
272
+ * @param {string} os The OS name to clean up.
273
+ * @param {string} [pattern] A `RegExp` pattern matching the OS name.
274
+ * @param {string} [label] A label for the OS.
275
+ */
276
+ function cleanupOS(os, pattern, label) {
277
+ // Platform tokens are defined at:
278
+ // http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
279
+ // http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
280
+ var data = {
281
+ '10.0': '10',
282
+ '6.4': '10 Technical Preview',
283
+ '6.3': '8.1',
284
+ '6.2': '8',
285
+ '6.1': 'Server 2008 R2 / 7',
286
+ '6.0': 'Server 2008 / Vista',
287
+ '5.2': 'Server 2003 / XP 64-bit',
288
+ '5.1': 'XP',
289
+ '5.01': '2000 SP1',
290
+ '5.0': '2000',
291
+ '4.0': 'NT',
292
+ '4.90': 'ME'
293
+ };
294
+ // Detect Windows version from platform tokens.
295
+ if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) &&
296
+ (data = data[/[\d.]+$/.exec(os)])) {
297
+ os = 'Windows ' + data;
298
+ }
299
+ // Correct character case and cleanup string.
300
+ os = String(os);
301
+
302
+ if (pattern && label) {
303
+ os = os.replace(RegExp(pattern, 'i'), label);
304
+ }
305
+
306
+ os = format(
307
+ os.replace(/ ce$/i, ' CE')
308
+ .replace(/\bhpw/i, 'web')
309
+ .replace(/\bMacintosh\b/, 'Mac OS')
310
+ .replace(/_PowerPC\b/i, ' OS')
311
+ .replace(/\b(OS X) [^ \d]+/i, '$1')
312
+ .replace(/\bMac (OS X)\b/, '$1')
313
+ .replace(/\/(\d)/, ' $1')
314
+ .replace(/_/g, '.')
315
+ .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '')
316
+ .replace(/\bx86\.64\b/gi, 'x86_64')
317
+ .replace(/\b(Windows Phone) OS\b/, '$1')
318
+ .replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1')
319
+ .split(' on ')[0]
320
+ );
321
+
322
+ return os;
323
+ }
324
+
325
+ /**
326
+ * An iteration utility for arrays and objects.
327
+ *
328
+ * @private
329
+ * @param {Array|Object} object The object to iterate over.
330
+ * @param {Function} callback The function called per iteration.
331
+ */
332
+ function each(object, callback) {
333
+ var index = -1,
334
+ length = object ? object.length : 0;
335
+
336
+ if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
337
+ while (++index < length) {
338
+ callback(object[index], index, object);
339
+ }
340
+ } else {
341
+ forOwn(object, callback);
342
+ }
343
+ }
344
+
345
+ /**
346
+ * Trim and conditionally capitalize string values.
347
+ *
348
+ * @private
349
+ * @param {string} string The string to format.
350
+ * @returns {string} The formatted string.
351
+ */
352
+ function format(string) {
353
+ string = trim(string);
354
+ return /^(?:webOS|i(?:OS|P))/.test(string)
355
+ ? string
356
+ : capitalize(string);
357
+ }
358
+
359
+ /**
360
+ * Iterates over an object's own properties, executing the `callback` for each.
361
+ *
362
+ * @private
363
+ * @param {Object} object The object to iterate over.
364
+ * @param {Function} callback The function executed per own property.
365
+ */
366
+ function forOwn(object, callback) {
367
+ for (var key in object) {
368
+ if (hasOwnProperty.call(object, key)) {
369
+ callback(object[key], key, object);
370
+ }
371
+ }
372
+ }
373
+
374
+ /**
375
+ * Gets the internal `[[Class]]` of a value.
376
+ *
377
+ * @private
378
+ * @param {*} value The value.
379
+ * @returns {string} The `[[Class]]`.
380
+ */
381
+ function getClassOf(value) {
382
+ return value == null
383
+ ? capitalize(value)
384
+ : toString.call(value).slice(8, -1);
385
+ }
386
+
387
+ /**
388
+ * Host objects can return type values that are different from their actual
389
+ * data type. The objects we are concerned with usually return non-primitive
390
+ * types of "object", "function", or "unknown".
391
+ *
392
+ * @private
393
+ * @param {*} object The owner of the property.
394
+ * @param {string} property The property to check.
395
+ * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`.
396
+ */
397
+ function isHostType(object, property) {
398
+ var type = object != null ? typeof object[property] : 'number';
399
+ return !/^(?:boolean|number|string|undefined)$/.test(type) &&
400
+ (type == 'object' ? !!object[property] : true);
401
+ }
402
+
403
+ /**
404
+ * Prepares a string for use in a `RegExp` by making hyphens and spaces optional.
405
+ *
406
+ * @private
407
+ * @param {string} string The string to qualify.
408
+ * @returns {string} The qualified string.
409
+ */
410
+ function qualify(string) {
411
+ return String(string).replace(/([ -])(?!$)/g, '$1?');
412
+ }
413
+
414
+ /**
415
+ * A bare-bones `Array#reduce` like utility function.
416
+ *
417
+ * @private
418
+ * @param {Array} array The array to iterate over.
419
+ * @param {Function} callback The function called per iteration.
420
+ * @returns {*} The accumulated result.
421
+ */
422
+ function reduce(array, callback) {
423
+ var accumulator = null;
424
+ each(array, function(value, index) {
425
+ accumulator = callback(accumulator, value, index, array);
426
+ });
427
+ return accumulator;
428
+ }
429
+
430
+ /**
431
+ * Removes leading and trailing whitespace from a string.
432
+ *
433
+ * @private
434
+ * @param {string} string The string to trim.
435
+ * @returns {string} The trimmed string.
436
+ */
437
+ function trim(string) {
438
+ return String(string).replace(/^ +| +$/g, '');
439
+ }
440
+
441
+ /*--------------------------------------------------------------------------*/
442
+
443
+ /**
444
+ * Creates a new platform object.
445
+ *
446
+ * @memberOf platform
447
+ * @param {Object|string} [ua=navigator.userAgent] The user agent string or
448
+ * context object.
449
+ * @returns {Object} A platform object.
450
+ */
451
+ function parse(ua) {
452
+
453
+ /** The environment context object. */
454
+ var context = root;
455
+
456
+ /** Used to flag when a custom context is provided. */
457
+ var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String';
458
+
459
+ // Juggle arguments.
460
+ if (isCustomContext) {
461
+ context = ua;
462
+ ua = null;
463
+ }
464
+
465
+ /** Browser navigator object. */
466
+ var nav = context.navigator || {};
467
+
468
+ /** Browser user agent string. */
469
+ var userAgent = nav.userAgent || '';
470
+
471
+ ua || (ua = userAgent);
472
+
473
+ /** Used to flag when `thisBinding` is the [ModuleScope]. */
474
+ var isModuleScope = isCustomContext || thisBinding == oldRoot;
475
+
476
+ /** Used to detect if browser is like Chrome. */
477
+ var likeChrome = isCustomContext
478
+ ? !!nav.likeChrome
479
+ : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString());
480
+
481
+ /** Internal `[[Class]]` value shortcuts. */
482
+ var objectClass = 'Object',
483
+ airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject',
484
+ enviroClass = isCustomContext ? objectClass : 'Environment',
485
+ javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java),
486
+ phantomClass = isCustomContext ? objectClass : 'RuntimeObject';
487
+
488
+ /** Detect Java environments. */
489
+ var java = /\bJava/.test(javaClass) && context.java;
490
+
491
+ /** Detect Rhino. */
492
+ var rhino = java && getClassOf(context.environment) == enviroClass;
493
+
494
+ /** A character to represent alpha. */
495
+ var alpha = java ? 'a' : '\u03b1';
496
+
497
+ /** A character to represent beta. */
498
+ var beta = java ? 'b' : '\u03b2';
499
+
500
+ /** Browser document object. */
501
+ var doc = context.document || {};
502
+
503
+ /**
504
+ * Detect Opera browser (Presto-based).
505
+ * http://www.howtocreate.co.uk/operaStuff/operaObject.html
506
+ * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini
507
+ */
508
+ var opera = context.operamini || context.opera;
509
+
510
+ /** Opera `[[Class]]`. */
511
+ var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera))
512
+ ? operaClass
513
+ : (opera = null);
514
+
515
+ /*------------------------------------------------------------------------*/
516
+
517
+ /** Temporary variable used over the script's lifetime. */
518
+ var data;
519
+
520
+ /** The CPU architecture. */
521
+ var arch = ua;
522
+
523
+ /** Platform description array. */
524
+ var description = [];
525
+
526
+ /** Platform alpha/beta indicator. */
527
+ var prerelease = null;
528
+
529
+ /** A flag to indicate that environment features should be used to resolve the platform. */
530
+ var useFeatures = ua == userAgent;
531
+
532
+ /** The browser/environment version. */
533
+ var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
534
+
535
+ /** A flag to indicate if the OS ends with "/ Version" */
536
+ var isSpecialCasedOS;
537
+
538
+ /* Detectable layout engines (order is important). */
539
+ var layout = getLayout([
540
+ { 'label': 'EdgeHTML', 'pattern': 'Edge' },
541
+ 'Trident',
542
+ { 'label': 'WebKit', 'pattern': 'AppleWebKit' },
543
+ 'iCab',
544
+ 'Presto',
545
+ 'NetFront',
546
+ 'Tasman',
547
+ 'KHTML',
548
+ 'Gecko'
549
+ ]);
550
+
551
+ /* Detectable browser names (order is important). */
552
+ var name = getName([
553
+ 'Adobe AIR',
554
+ 'Arora',
555
+ 'Avant Browser',
556
+ 'Breach',
557
+ 'Camino',
558
+ 'Epiphany',
559
+ 'Fennec',
560
+ 'Flock',
561
+ 'Galeon',
562
+ 'GreenBrowser',
563
+ 'iCab',
564
+ 'Iceweasel',
565
+ 'K-Meleon',
566
+ 'Konqueror',
567
+ 'Lunascape',
568
+ 'Maxthon',
569
+ { 'label': 'Microsoft Edge', 'pattern': 'Edge' },
570
+ 'Midori',
571
+ 'Nook Browser',
572
+ 'PaleMoon',
573
+ 'PhantomJS',
574
+ 'Raven',
575
+ 'Rekonq',
576
+ 'RockMelt',
577
+ 'SeaMonkey',
578
+ { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
579
+ 'Sleipnir',
580
+ 'SlimBrowser',
581
+ { 'label': 'SRWare Iron', 'pattern': 'Iron' },
582
+ 'Sunrise',
583
+ 'Swiftfox',
584
+ 'WebPositive',
585
+ 'Opera Mini',
586
+ { 'label': 'Opera Mini', 'pattern': 'OPiOS' },
587
+ 'Opera',
588
+ { 'label': 'Opera', 'pattern': 'OPR' },
589
+ 'Chrome',
590
+ { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
591
+ { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
592
+ { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' },
593
+ { 'label': 'IE', 'pattern': 'IEMobile' },
594
+ { 'label': 'IE', 'pattern': 'MSIE' },
595
+ 'Safari'
596
+ ]);
597
+
598
+ /* Detectable products (order is important). */
599
+ var product = getProduct([
600
+ { 'label': 'BlackBerry', 'pattern': 'BB10' },
601
+ 'BlackBerry',
602
+ { 'label': 'Galaxy S', 'pattern': 'GT-I9000' },
603
+ { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' },
604
+ { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' },
605
+ { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' },
606
+ 'Google TV',
607
+ 'Lumia',
608
+ 'iPad',
609
+ 'iPod',
610
+ 'iPhone',
611
+ 'Kindle',
612
+ { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
613
+ 'Nexus',
614
+ 'Nook',
615
+ 'PlayBook',
616
+ 'PlayStation 3',
617
+ 'PlayStation 4',
618
+ 'PlayStation Vita',
619
+ 'TouchPad',
620
+ 'Transformer',
621
+ { 'label': 'Wii U', 'pattern': 'WiiU' },
622
+ 'Wii',
623
+ 'Xbox One',
624
+ { 'label': 'Xbox 360', 'pattern': 'Xbox' },
625
+ 'Xoom'
626
+ ]);
627
+
628
+ /* Detectable manufacturers. */
629
+ var manufacturer = getManufacturer({
630
+ 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 },
631
+ 'Archos': {},
632
+ 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 },
633
+ 'Asus': { 'Transformer': 1 },
634
+ 'Barnes & Noble': { 'Nook': 1 },
635
+ 'BlackBerry': { 'PlayBook': 1 },
636
+ 'Google': { 'Google TV': 1, 'Nexus': 1 },
637
+ 'HP': { 'TouchPad': 1 },
638
+ 'HTC': {},
639
+ 'LG': {},
640
+ 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 },
641
+ 'Motorola': { 'Xoom': 1 },
642
+ 'Nintendo': { 'Wii U': 1, 'Wii': 1 },
643
+ 'Nokia': { 'Lumia': 1 },
644
+ 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 },
645
+ 'Sony': { 'PlayStation 4': 1, 'PlayStation 3': 1, 'PlayStation Vita': 1 }
646
+ });
647
+
648
+ /* Detectable operating systems (order is important). */
649
+ var os = getOS([
650
+ 'Windows Phone',
651
+ 'Android',
652
+ 'CentOS',
653
+ { 'label': 'Chrome OS', 'pattern': 'CrOS' },
654
+ 'Debian',
655
+ 'Fedora',
656
+ 'FreeBSD',
657
+ 'Gentoo',
658
+ 'Haiku',
659
+ 'Kubuntu',
660
+ 'Linux Mint',
661
+ 'OpenBSD',
662
+ 'Red Hat',
663
+ 'SuSE',
664
+ 'Ubuntu',
665
+ 'Xubuntu',
666
+ 'Cygwin',
667
+ 'Symbian OS',
668
+ 'hpwOS',
669
+ 'webOS ',
670
+ 'webOS',
671
+ 'Tablet OS',
672
+ 'Linux',
673
+ 'Mac OS X',
674
+ 'Macintosh',
675
+ 'Mac',
676
+ 'Windows 98;',
677
+ 'Windows '
678
+ ]);
679
+
680
+ /*------------------------------------------------------------------------*/
681
+
682
+ /**
683
+ * Picks the layout engine from an array of guesses.
684
+ *
685
+ * @private
686
+ * @param {Array} guesses An array of guesses.
687
+ * @returns {null|string} The detected layout engine.
688
+ */
689
+ function getLayout(guesses) {
690
+ return reduce(guesses, function(result, guess) {
691
+ return result || RegExp('\\b' + (
692
+ guess.pattern || qualify(guess)
693
+ ) + '\\b', 'i').exec(ua) && (guess.label || guess);
694
+ });
695
+ }
696
+
697
+ /**
698
+ * Picks the manufacturer from an array of guesses.
699
+ *
700
+ * @private
701
+ * @param {Array} guesses An object of guesses.
702
+ * @returns {null|string} The detected manufacturer.
703
+ */
704
+ function getManufacturer(guesses) {
705
+ return reduce(guesses, function(result, value, key) {
706
+ // Lookup the manufacturer by product or scan the UA for the manufacturer.
707
+ return result || (
708
+ value[product] ||
709
+ value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] ||
710
+ RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)
711
+ ) && key;
712
+ });
713
+ }
714
+
715
+ /**
716
+ * Picks the browser name from an array of guesses.
717
+ *
718
+ * @private
719
+ * @param {Array} guesses An array of guesses.
720
+ * @returns {null|string} The detected browser name.
721
+ */
722
+ function getName(guesses) {
723
+ return reduce(guesses, function(result, guess) {
724
+ return result || RegExp('\\b' + (
725
+ guess.pattern || qualify(guess)
726
+ ) + '\\b', 'i').exec(ua) && (guess.label || guess);
727
+ });
728
+ }
729
+
730
+ /**
731
+ * Picks the OS name from an array of guesses.
732
+ *
733
+ * @private
734
+ * @param {Array} guesses An array of guesses.
735
+ * @returns {null|string} The detected OS name.
736
+ */
737
+ function getOS(guesses) {
738
+ return reduce(guesses, function(result, guess) {
739
+ var pattern = guess.pattern || qualify(guess);
740
+ if (!result && (result =
741
+ RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua)
742
+ )) {
743
+ result = cleanupOS(result, pattern, guess.label || guess);
744
+ }
745
+ return result;
746
+ });
747
+ }
748
+
749
+ /**
750
+ * Picks the product name from an array of guesses.
751
+ *
752
+ * @private
753
+ * @param {Array} guesses An array of guesses.
754
+ * @returns {null|string} The detected product name.
755
+ */
756
+ function getProduct(guesses) {
757
+ return reduce(guesses, function(result, guess) {
758
+ var pattern = guess.pattern || qualify(guess);
759
+ if (!result && (result =
760
+ RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
761
+ RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
762
+ )) {
763
+ // Split by forward slash and append product version if needed.
764
+ if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
765
+ result[0] += ' ' + result[1];
766
+ }
767
+ // Correct character case and cleanup string.
768
+ guess = guess.label || guess;
769
+ result = format(result[0]
770
+ .replace(RegExp(pattern, 'i'), guess)
771
+ .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
772
+ .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
773
+ }
774
+ return result;
775
+ });
776
+ }
777
+
778
+ /**
779
+ * Resolves the version using an array of UA patterns.
780
+ *
781
+ * @private
782
+ * @param {Array} patterns An array of UA patterns.
783
+ * @returns {null|string} The detected version.
784
+ */
785
+ function getVersion(patterns) {
786
+ return reduce(patterns, function(result, pattern) {
787
+ return result || (RegExp(pattern +
788
+ '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
789
+ });
790
+ }
791
+
792
+ /**
793
+ * Returns `platform.description` when the platform object is coerced to a string.
794
+ *
795
+ * @name toString
796
+ * @memberOf platform
797
+ * @returns {string} Returns `platform.description` if available, else an empty string.
798
+ */
799
+ function toStringPlatform() {
800
+ return this.description || '';
801
+ }
802
+
803
+ /*------------------------------------------------------------------------*/
804
+
805
+ // Convert layout to an array so we can add extra details.
806
+ layout && (layout = [layout]);
807
+
808
+ // Detect product names that contain their manufacturer's name.
809
+ if (manufacturer && !product) {
810
+ product = getProduct([manufacturer]);
811
+ }
812
+ // Clean up Google TV.
813
+ if ((data = /\bGoogle TV\b/.exec(product))) {
814
+ product = data[0];
815
+ }
816
+ // Detect simulators.
817
+ if (/\bSimulator\b/i.test(ua)) {
818
+ product = (product ? product + ' ' : '') + 'Simulator';
819
+ }
820
+ // Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS.
821
+ if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) {
822
+ description.push('running in Turbo/Uncompressed mode');
823
+ }
824
+ // Detect IE Mobile 11.
825
+ if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) {
826
+ data = parse(ua.replace(/like iPhone OS/, ''));
827
+ manufacturer = data.manufacturer;
828
+ product = data.product;
829
+ }
830
+ // Detect iOS.
831
+ else if (/^iP/.test(product)) {
832
+ name || (name = 'Safari');
833
+ os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua))
834
+ ? ' ' + data[1].replace(/_/g, '.')
835
+ : '');
836
+ }
837
+ // Detect Kubuntu.
838
+ else if (name == 'Konqueror' && !/buntu/i.test(os)) {
839
+ os = 'Kubuntu';
840
+ }
841
+ // Detect Android browsers.
842
+ else if ((manufacturer && manufacturer != 'Google' &&
843
+ ((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) ||
844
+ (/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) {
845
+ name = 'Android Browser';
846
+ os = /\bAndroid\b/.test(os) ? os : 'Android';
847
+ }
848
+ // Detect Silk desktop/accelerated modes.
849
+ else if (name == 'Silk') {
850
+ if (!/\bMobi/i.test(ua)) {
851
+ os = 'Android';
852
+ description.unshift('desktop mode');
853
+ }
854
+ if (/Accelerated *= *true/i.test(ua)) {
855
+ description.unshift('accelerated');
856
+ }
857
+ }
858
+ // Detect PaleMoon identifying as Firefox.
859
+ else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
860
+ description.push('identifying as Firefox ' + data[1]);
861
+ }
862
+ // Detect Firefox OS and products running Firefox.
863
+ else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) {
864
+ os || (os = 'Firefox OS');
865
+ product || (product = data[1]);
866
+ }
867
+ // Detect false positives for Firefox/Safari.
868
+ else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) {
869
+ // Escape the `/` for Firefox 1.
870
+ if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) {
871
+ // Clear name of false positives.
872
+ name = null;
873
+ }
874
+ // Reassign a generic name.
875
+ if ((data = product || manufacturer || os) &&
876
+ (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) {
877
+ name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser';
878
+ }
879
+ }
880
+ // Detect non-Opera (Presto-based) versions (order is important).
881
+ if (!version) {
882
+ version = getVersion([
883
+ '(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|Silk(?!/[\\d.]+$))',
884
+ 'Version',
885
+ qualify(name),
886
+ '(?:Firefox|Minefield|NetFront)'
887
+ ]);
888
+ }
889
+ // Detect stubborn layout engines.
890
+ if ((data =
891
+ layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' ||
892
+ /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') ||
893
+ /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' ||
894
+ !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') ||
895
+ layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront'
896
+ )) {
897
+ layout = [data];
898
+ }
899
+ // Detect Windows Phone 7 desktop mode.
900
+ if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) {
901
+ name += ' Mobile';
902
+ os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x');
903
+ description.unshift('desktop mode');
904
+ }
905
+ // Detect Windows Phone 8.x desktop mode.
906
+ else if (/\bWPDesktop\b/i.test(ua)) {
907
+ name = 'IE Mobile';
908
+ os = 'Windows Phone 8.x';
909
+ description.unshift('desktop mode');
910
+ version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
911
+ }
912
+ // Detect IE 11.
913
+ else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
914
+ if (name) {
915
+ description.push('identifying as ' + name + (version ? ' ' + version : ''));
916
+ }
917
+ name = 'IE';
918
+ version = data[1];
919
+ }
920
+ // Leverage environment features.
921
+ if (useFeatures) {
922
+ // Detect server-side environments.
923
+ // Rhino has a global function while others have a global object.
924
+ if (isHostType(context, 'global')) {
925
+ if (java) {
926
+ data = java.lang.System;
927
+ arch = data.getProperty('os.arch');
928
+ os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
929
+ }
930
+ if (isModuleScope && isHostType(context, 'system') && (data = [context.system])[0]) {
931
+ os || (os = data[0].os || null);
932
+ try {
933
+ data[1] = context.require('ringo/engine').version;
934
+ version = data[1].join('.');
935
+ name = 'RingoJS';
936
+ } catch(e) {
937
+ if (data[0].global.system == context.system) {
938
+ name = 'Narwhal';
939
+ }
940
+ }
941
+ }
942
+ else if (
943
+ typeof context.process == 'object' && !context.process.browser &&
944
+ (data = context.process)
945
+ ) {
946
+ name = 'Node.js';
947
+ arch = data.arch;
948
+ os = data.platform;
949
+ version = /[\d.]+/.exec(data.version)[0];
950
+ }
951
+ else if (rhino) {
952
+ name = 'Rhino';
953
+ }
954
+ }
955
+ // Detect Adobe AIR.
956
+ else if (getClassOf((data = context.runtime)) == airRuntimeClass) {
957
+ name = 'Adobe AIR';
958
+ os = data.flash.system.Capabilities.os;
959
+ }
960
+ // Detect PhantomJS.
961
+ else if (getClassOf((data = context.phantom)) == phantomClass) {
962
+ name = 'PhantomJS';
963
+ version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch);
964
+ }
965
+ // Detect IE compatibility modes.
966
+ else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) {
967
+ // We're in compatibility mode when the Trident version + 4 doesn't
968
+ // equal the document mode.
969
+ version = [version, doc.documentMode];
970
+ if ((data = +data[1] + 4) != version[1]) {
971
+ description.push('IE ' + version[1] + ' mode');
972
+ layout && (layout[1] = '');
973
+ version[1] = data;
974
+ }
975
+ version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
976
+ }
977
+ os = os && format(os);
978
+ }
979
+ // Detect prerelease phases.
980
+ if (version && (data =
981
+ /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
982
+ /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
983
+ /\bMinefield\b/i.test(ua) && 'a'
984
+ )) {
985
+ prerelease = /b/i.test(data) ? 'beta' : 'alpha';
986
+ version = version.replace(RegExp(data + '\\+?$'), '') +
987
+ (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
988
+ }
989
+ // Detect Firefox Mobile.
990
+ if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS)\b/.test(os)) {
991
+ name = 'Firefox Mobile';
992
+ }
993
+ // Obscure Maxthon's unreliable version.
994
+ else if (name == 'Maxthon' && version) {
995
+ version = version.replace(/\.[\d.]+/, '.x');
996
+ }
997
+ // Detect Xbox 360 and Xbox One.
998
+ else if (/\bXbox\b/i.test(product)) {
999
+ os = null;
1000
+ if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) {
1001
+ description.unshift('mobile mode');
1002
+ }
1003
+ }
1004
+ // Add mobile postfix.
1005
+ else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) &&
1006
+ (os == 'Windows CE' || /Mobi/i.test(ua))) {
1007
+ name += ' Mobile';
1008
+ }
1009
+ // Detect IE platform preview.
1010
+ else if (name == 'IE' && useFeatures && context.external === null) {
1011
+ description.unshift('platform preview');
1012
+ }
1013
+ // Detect BlackBerry OS version.
1014
+ // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp
1015
+ else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data =
1016
+ (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
1017
+ version
1018
+ )) {
1019
+ data = [data, /BB10/.test(ua)];
1020
+ os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0];
1021
+ version = null;
1022
+ }
1023
+ // Detect Opera identifying/masking itself as another browser.
1024
+ // http://www.opera.com/support/kb/view/843/
1025
+ else if (this != forOwn && product != 'Wii' && (
1026
+ (useFeatures && opera) ||
1027
+ (/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) ||
1028
+ (name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) ||
1029
+ (name == 'IE' && (
1030
+ (os && !/^Win/.test(os) && version > 5.5) ||
1031
+ /\bWindows XP\b/.test(os) && version > 8 ||
1032
+ version == 8 && !/\bTrident\b/.test(ua)
1033
+ ))
1034
+ ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) {
1035
+ // When "identifying", the UA contains both Opera and the other browser's name.
1036
+ data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
1037
+ if (reOpera.test(name)) {
1038
+ if (/\bIE\b/.test(data) && os == 'Mac OS') {
1039
+ os = null;
1040
+ }
1041
+ data = 'identify' + data;
1042
+ }
1043
+ // When "masking", the UA contains only the other browser's name.
1044
+ else {
1045
+ data = 'mask' + data;
1046
+ if (operaClass) {
1047
+ name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2'));
1048
+ } else {
1049
+ name = 'Opera';
1050
+ }
1051
+ if (/\bIE\b/.test(data)) {
1052
+ os = null;
1053
+ }
1054
+ if (!useFeatures) {
1055
+ version = null;
1056
+ }
1057
+ }
1058
+ layout = ['Presto'];
1059
+ description.push(data);
1060
+ }
1061
+ // Detect WebKit Nightly and approximate Chrome/Safari versions.
1062
+ if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
1063
+ // Correct build number for numeric comparison.
1064
+ // (e.g. "532.5" becomes "532.05")
1065
+ data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data];
1066
+ // Nightly builds are postfixed with a "+".
1067
+ if (name == 'Safari' && data[1].slice(-1) == '+') {
1068
+ name = 'WebKit Nightly';
1069
+ prerelease = 'alpha';
1070
+ version = data[1].slice(0, -1);
1071
+ }
1072
+ // Clear incorrect browser versions.
1073
+ else if (version == data[1] ||
1074
+ version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
1075
+ version = null;
1076
+ }
1077
+ // Use the full Chrome version when available.
1078
+ data[1] = (/\bChrome\/([\d.]+)/i.exec(ua) || 0)[1];
1079
+ // Detect Blink layout engine.
1080
+ if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
1081
+ layout = ['Blink'];
1082
+ }
1083
+ // Detect JavaScriptCore.
1084
+ // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi
1085
+ if (!useFeatures || (!likeChrome && !data[1])) {
1086
+ layout && (layout[1] = 'like Safari');
1087
+ data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : '8');
1088
+ } else {
1089
+ layout && (layout[1] = 'like Chrome');
1090
+ data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28');
1091
+ }
1092
+ // Add the postfix of ".x" or "+" for approximate versions.
1093
+ layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+'));
1094
+ // Obscure version for some Safari 1-2 releases.
1095
+ if (name == 'Safari' && (!version || parseInt(version) > 45)) {
1096
+ version = data;
1097
+ }
1098
+ }
1099
+ // Detect Opera desktop modes.
1100
+ if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) {
1101
+ name += ' ';
1102
+ description.unshift('desktop mode');
1103
+ if (data == 'zvav') {
1104
+ name += 'Mini';
1105
+ version = null;
1106
+ } else {
1107
+ name += 'Mobile';
1108
+ }
1109
+ os = os.replace(RegExp(' *' + data + '$'), '');
1110
+ }
1111
+ // Detect Chrome desktop mode.
1112
+ else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) {
1113
+ description.unshift('desktop mode');
1114
+ name = 'Chrome Mobile';
1115
+ version = null;
1116
+
1117
+ if (/\bOS X\b/.test(os)) {
1118
+ manufacturer = 'Apple';
1119
+ os = 'iOS 4.3+';
1120
+ } else {
1121
+ os = null;
1122
+ }
1123
+ }
1124
+ // Strip incorrect OS versions.
1125
+ if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
1126
+ ua.indexOf('/' + data + '-') > -1) {
1127
+ os = trim(os.replace(data, ''));
1128
+ }
1129
+ // Add layout engine.
1130
+ if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
1131
+ /Browser|Lunascape|Maxthon/.test(name) ||
1132
+ name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) ||
1133
+ /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Sleipnir|Web)/.test(name) && layout[1])) {
1134
+ // Don't add layout details to description if they are falsey.
1135
+ (data = layout[layout.length - 1]) && description.push(data);
1136
+ }
1137
+ // Combine contextual information.
1138
+ if (description.length) {
1139
+ description = ['(' + description.join('; ') + ')'];
1140
+ }
1141
+ // Append manufacturer to description.
1142
+ if (manufacturer && product && product.indexOf(manufacturer) < 0) {
1143
+ description.push('on ' + manufacturer);
1144
+ }
1145
+ // Append product to description.
1146
+ if (product) {
1147
+ description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product);
1148
+ }
1149
+ // Parse the OS into an object.
1150
+ if (os) {
1151
+ data = / ([\d.+]+)$/.exec(os);
1152
+ isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
1153
+ os = {
1154
+ 'architecture': 32,
1155
+ 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os,
1156
+ 'version': data ? data[1] : null,
1157
+ 'toString': function() {
1158
+ var version = this.version;
1159
+ return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
1160
+ }
1161
+ };
1162
+ }
1163
+ // Add browser/OS architecture.
1164
+ if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
1165
+ if (os) {
1166
+ os.architecture = 64;
1167
+ os.family = os.family.replace(RegExp(' *' + data), '');
1168
+ }
1169
+ if (
1170
+ name && (/\bWOW64\b/i.test(ua) ||
1171
+ (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua)))
1172
+ ) {
1173
+ description.unshift('32-bit');
1174
+ }
1175
+ }
1176
+ // Chrome 39 and above on OS X is always 64-bit.
1177
+ else if (
1178
+ os && /^OS X/.test(os.family) &&
1179
+ name == 'Chrome' && parseFloat(version) >= 39
1180
+ ) {
1181
+ os.architecture = 64;
1182
+ }
1183
+
1184
+ ua || (ua = null);
1185
+
1186
+ /*------------------------------------------------------------------------*/
1187
+
1188
+ /**
1189
+ * The platform object.
1190
+ *
1191
+ * @name platform
1192
+ * @type Object
1193
+ */
1194
+ var platform = {};
1195
+
1196
+ /**
1197
+ * The platform description.
1198
+ *
1199
+ * @memberOf platform
1200
+ * @type string|null
1201
+ */
1202
+ platform.description = ua;
1203
+
1204
+ /**
1205
+ * The name of the browser's layout engine.
1206
+ *
1207
+ * @memberOf platform
1208
+ * @type string|null
1209
+ */
1210
+ platform.layout = layout && layout[0];
1211
+
1212
+ /**
1213
+ * The name of the product's manufacturer.
1214
+ *
1215
+ * @memberOf platform
1216
+ * @type string|null
1217
+ */
1218
+ platform.manufacturer = manufacturer;
1219
+
1220
+ /**
1221
+ * The name of the browser/environment.
1222
+ *
1223
+ * @memberOf platform
1224
+ * @type string|null
1225
+ */
1226
+ platform.name = name;
1227
+
1228
+ /**
1229
+ * The alpha/beta release indicator.
1230
+ *
1231
+ * @memberOf platform
1232
+ * @type string|null
1233
+ */
1234
+ platform.prerelease = prerelease;
1235
+
1236
+ /**
1237
+ * The name of the product hosting the browser.
1238
+ *
1239
+ * @memberOf platform
1240
+ * @type string|null
1241
+ */
1242
+ platform.product = product;
1243
+
1244
+ /**
1245
+ * The browser's user agent string.
1246
+ *
1247
+ * @memberOf platform
1248
+ * @type string|null
1249
+ */
1250
+ platform.ua = ua;
1251
+
1252
+ /**
1253
+ * The browser/environment version.
1254
+ *
1255
+ * @memberOf platform
1256
+ * @type string|null
1257
+ */
1258
+ platform.version = name && version;
1259
+
1260
+ /**
1261
+ * The name of the operating system.
1262
+ *
1263
+ * @memberOf platform
1264
+ * @type Object
1265
+ */
1266
+ platform.os = os || {
1267
+
1268
+ /**
1269
+ * The CPU architecture the OS is built for.
1270
+ *
1271
+ * @memberOf platform.os
1272
+ * @type number|null
1273
+ */
1274
+ 'architecture': null,
1275
+
1276
+ /**
1277
+ * The family of the OS.
1278
+ *
1279
+ * Common values include:
1280
+ * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
1281
+ * "Windows XP", "OS X", "Ubuntu", "Debian", "Fedora", "Red Hat", "SuSE",
1282
+ * "Android", "iOS" and "Windows Phone"
1283
+ *
1284
+ * @memberOf platform.os
1285
+ * @type string|null
1286
+ */
1287
+ 'family': null,
1288
+
1289
+ /**
1290
+ * The version of the OS.
1291
+ *
1292
+ * @memberOf platform.os
1293
+ * @type string|null
1294
+ */
1295
+ 'version': null,
1296
+
1297
+ /**
1298
+ * Returns the OS string.
1299
+ *
1300
+ * @memberOf platform.os
1301
+ * @returns {string} The OS string.
1302
+ */
1303
+ 'toString': function() { return 'null'; }
1304
+ };
1305
+
1306
+ platform.parse = parse;
1307
+ platform.toString = toStringPlatform;
1308
+
1309
+ if (platform.version) {
1310
+ description.unshift(version);
1311
+ }
1312
+ if (platform.name) {
1313
+ description.unshift(name);
1314
+ }
1315
+ if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) {
1316
+ description.push(product ? '(' + os + ')' : 'on ' + os);
1317
+ }
1318
+ if (description.length) {
1319
+ platform.description = description.join(' ');
1320
+ }
1321
+ return platform;
1322
+ }
1323
+
1324
+ /*--------------------------------------------------------------------------*/
1325
+
1326
+ // Export platform.
1327
+ var platform = parse();
1328
+
1329
+ // Some AMD build optimizers, like r.js, check for condition patterns like the following:
1330
+ if (freeExports && freeModule) {
1331
+ // Export for CommonJS support.
1332
+ forOwn(platform, function(value, key) {
1333
+ freeExports[key] = value;
1334
+ });
1335
+ }
1336
+ else {
1337
+ // Export to the global object.
1338
+ root.platform = platform;
1339
+ }
1340
+ }.call(commonjsGlobal));
1341
+ }(platform, platform.exports));
1342
+
1343
+ (function (module, exports) {
1344
+
1345
+ Object.defineProperty(exports, "__esModule", {
1346
+ value: true
1347
+ });
1348
+
1349
+ var _platform2 = platform.exports;
1350
+
1351
+ var _platform3 = _interopRequireDefault(_platform2);
1352
+
1353
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1354
+
1355
+ // deep clone of original platform
1356
+ var platform$1 = JSON.parse(JSON.stringify(_platform3.default));
1357
+
1358
+ // operating system
1359
+
1360
+ // sugar for https://github.com/bestiejs/platform.js
1361
+ // make sure to ALWAYS reference the layout engine,
1362
+ // even if it is not necessary for the condition,
1363
+ // as this makes grepping for this stuff simpler
1364
+
1365
+ var os = platform$1.os.family || '';
1366
+ var ANDROID = os === 'Android';
1367
+ var WINDOWS = os.slice(0, 7) === 'Windows';
1368
+ var OSX = os === 'OS X';
1369
+ var IOS = os === 'iOS';
1370
+
1371
+ // layout
1372
+ var BLINK = platform$1.layout === 'Blink';
1373
+ var GECKO = platform$1.layout === 'Gecko';
1374
+ var TRIDENT = platform$1.layout === 'Trident';
1375
+ var EDGE = platform$1.layout === 'EdgeHTML';
1376
+ var WEBKIT = platform$1.layout === 'WebKit';
1377
+
1378
+ // browser version (not layout engine version!)
1379
+ var version = parseFloat(platform$1.version);
1380
+ var majorVersion = Math.floor(version);
1381
+ platform$1.majorVersion = majorVersion;
1382
+
1383
+ platform$1.is = {
1384
+ // operating system
1385
+ ANDROID: ANDROID,
1386
+ WINDOWS: WINDOWS,
1387
+ OSX: OSX,
1388
+ IOS: IOS,
1389
+ // layout
1390
+ BLINK: BLINK, // "Chrome", "Chrome Mobile", "Opera"
1391
+ GECKO: GECKO, // "Firefox"
1392
+ TRIDENT: TRIDENT, // "Internet Explorer"
1393
+ EDGE: EDGE, // "Microsoft Edge"
1394
+ WEBKIT: WEBKIT, // "Safari"
1395
+ // INTERNET EXPLORERS
1396
+ IE9: TRIDENT && majorVersion === 9,
1397
+ IE10: TRIDENT && majorVersion === 10,
1398
+ IE11: TRIDENT && majorVersion === 11
1399
+ };
1400
+
1401
+ exports.default = platform$1;
1402
+ module.exports = exports['default'];
1403
+
1404
+ }(platform$1, platform$1.exports));
1405
+
1406
+ (function (module, exports) {
1407
+
1408
+ Object.defineProperty(exports, "__esModule", {
1409
+ value: true
1410
+ });
1411
+
1412
+ exports.default = function (tests) {
1413
+ var data = before();
1414
+
1415
+ var results = {};
1416
+ Object.keys(tests).map(function (key) {
1417
+ results[key] = test(data, tests[key]);
1418
+ });
1419
+
1420
+ after(data);
1421
+ return results;
1422
+ };
1423
+
1424
+ var _platform = platform$1.exports;
1425
+
1426
+ var _platform2 = _interopRequireDefault(_platform);
1427
+
1428
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1429
+
1430
+ function before() {
1431
+ var data = {
1432
+ // remember what had focus to restore after test
1433
+ activeElement: document.activeElement,
1434
+ // remember scroll positions to restore after test
1435
+ windowScrollTop: window.scrollTop,
1436
+ windowScrollLeft: window.scrollLeft,
1437
+ bodyScrollTop: document.body.scrollTop,
1438
+ bodyScrollLeft: document.body.scrollLeft
1439
+ };
1440
+
1441
+ // wrap tests in an element hidden from screen readers to prevent them
1442
+ // from announcing focus, which can be quite irritating to the user
1443
+ var iframe = document.createElement('iframe');
1444
+ iframe.setAttribute('style', 'position:absolute; position:fixed; top:0; left:-2px; width:1px; height:1px; overflow:hidden;');
1445
+ iframe.setAttribute('aria-live', 'off');
1446
+ iframe.setAttribute('aria-busy', 'true');
1447
+ iframe.setAttribute('aria-hidden', 'true');
1448
+ document.body.appendChild(iframe);
1449
+
1450
+ var _window = iframe.contentWindow;
1451
+ var _document = _window.document;
1452
+
1453
+ _document.open();
1454
+ _document.close();
1455
+ var wrapper = _document.createElement('div');
1456
+ _document.body.appendChild(wrapper);
1457
+
1458
+ data.iframe = iframe;
1459
+ data.wrapper = wrapper;
1460
+ data.window = _window;
1461
+ data.document = _document;
1462
+
1463
+ return data;
1464
+ }
1465
+
1466
+ // options.element:
1467
+ // {string} element name
1468
+ // {function} callback(wrapper, document) to generate an element
1469
+ // options.mutate: (optional)
1470
+ // {function} callback(element, wrapper, document) to manipulate element prior to focus-test.
1471
+ // Can return DOMElement to define focus target (default: element)
1472
+ // options.validate: (optional)
1473
+ // {function} callback(element, focusTarget, document) to manipulate test-result
1474
+ function test(data, options) {
1475
+ // make sure we operate on a clean slate
1476
+ data.wrapper.innerHTML = '';
1477
+ // create dummy element to test focusability of
1478
+ var element = typeof options.element === 'string' ? data.document.createElement(options.element) : options.element(data.wrapper, data.document);
1479
+ // allow callback to further specify dummy element
1480
+ // and optionally define element to focus
1481
+ var focus = options.mutate && options.mutate(element, data.wrapper, data.document);
1482
+ if (!focus && focus !== false) {
1483
+ focus = element;
1484
+ }
1485
+ // element needs to be part of the DOM to be focusable
1486
+ !element.parentNode && data.wrapper.appendChild(element);
1487
+ // test if the element with invalid tabindex can be focused
1488
+ focus && focus.focus && focus.focus();
1489
+ // validate test's result
1490
+ return options.validate ? options.validate(element, focus, data.document) : data.document.activeElement === focus;
1491
+ }
1492
+
1493
+ function after(data) {
1494
+ // restore focus to what it was before test and cleanup
1495
+ if (data.activeElement === document.body) {
1496
+ document.activeElement && document.activeElement.blur && document.activeElement.blur();
1497
+ if (_platform2.default.is.IE10) {
1498
+ // IE10 does not redirect focus to <body> when the activeElement is removed
1499
+ document.body.focus();
1500
+ }
1501
+ } else {
1502
+ data.activeElement && data.activeElement.focus && data.activeElement.focus();
1503
+ }
1504
+
1505
+ document.body.removeChild(data.iframe);
1506
+
1507
+ // restore scroll position
1508
+ window.scrollTop = data.windowScrollTop;
1509
+ window.scrollLeft = data.windowScrollLeft;
1510
+ document.body.scrollTop = data.bodyScrollTop;
1511
+ document.body.scrollLeft = data.bodyScrollLeft;
1512
+ }
1513
+
1514
+ module.exports = exports['default'];
1515
+
1516
+ }(detectFocus, detectFocus.exports));
1517
+
1518
+ var supportsCache = {exports: {}};
1519
+
1520
+ var version = {exports: {}};
1521
+
1522
+ (function (module, exports) {
1523
+
1524
+ Object.defineProperty(exports, "__esModule", {
1525
+ value: true
1526
+ });
1527
+
1528
+ // this file is overwritten by `npm run build:pre`
1529
+ var version = '1.4.1';
1530
+ exports.default = version;
1531
+ module.exports = exports['default'];
1532
+
1533
+ }(version, version.exports));
1534
+
1535
+ (function (module, exports) {
1536
+
1537
+ Object.defineProperty(exports, "__esModule", {
1538
+ value: true
1539
+ });
1540
+
1541
+ var _version = version.exports;
1542
+
1543
+ var _version2 = _interopRequireDefault(_version);
1544
+
1545
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1546
+
1547
+ function readLocalStorage(key) {
1548
+ // allow reading from storage to retrieve previous support results
1549
+ // even while the document does not have focus
1550
+ var data = void 0;
1551
+
1552
+ try {
1553
+ data = window.localStorage && window.localStorage.getItem(key);
1554
+ data = data ? JSON.parse(data) : {};
1555
+ } catch (e) {
1556
+ data = {};
1557
+ }
1558
+
1559
+ return data;
1560
+ } /*
1561
+ Facility to cache test results in localStorage.
1562
+
1563
+ USAGE:
1564
+ cache.get('key');
1565
+ cache.set('key', 'value');
1566
+ */
1567
+
1568
+ function writeLocalStorage(key, value) {
1569
+ if (!document.hasFocus()) {
1570
+ // if the document does not have focus when tests are executed, focus() may
1571
+ // not be handled properly and events may not be dispatched immediately.
1572
+ // This can happen when a document is reloaded while Developer Tools have focus.
1573
+ try {
1574
+ window.localStorage && window.localStorage.removeItem(key);
1575
+ } catch (e) {
1576
+ // ignore
1577
+ }
1578
+
1579
+ return;
1580
+ }
1581
+
1582
+ try {
1583
+ window.localStorage && window.localStorage.setItem(key, JSON.stringify(value));
1584
+ } catch (e) {
1585
+ // ignore
1586
+ }
1587
+ }
1588
+
1589
+ var userAgent = typeof window !== 'undefined' && window.navigator.userAgent || '';
1590
+ var cacheKey = 'ally-supports-cache';
1591
+ var cache = readLocalStorage(cacheKey);
1592
+
1593
+ // update the cache if ally or the user agent changed (newer version, etc)
1594
+ if (cache.userAgent !== userAgent || cache.version !== _version2.default) {
1595
+ cache = {};
1596
+ }
1597
+
1598
+ cache.userAgent = userAgent;
1599
+ cache.version = _version2.default;
1600
+
1601
+ exports.default = {
1602
+ get: function get() {
1603
+ return cache;
1604
+ },
1605
+ set: function set(values) {
1606
+ Object.keys(values).forEach(function (key) {
1607
+ cache[key] = values[key];
1608
+ });
1609
+
1610
+ cache.time = new Date().toISOString();
1611
+ writeLocalStorage(cacheKey, cache);
1612
+ }
1613
+ };
1614
+ module.exports = exports['default'];
1615
+
1616
+ }(supportsCache, supportsCache.exports));
1617
+
1618
+ var cssShadowPiercingDeepCombinator = {exports: {}};
1619
+
1620
+ (function (module, exports) {
1621
+
1622
+ Object.defineProperty(exports, "__esModule", {
1623
+ value: true
1624
+ });
1625
+
1626
+ exports.default = function () {
1627
+ var combinator = void 0;
1628
+
1629
+ // see https://dev.w3.org/csswg/css-scoping-1/#deep-combinator
1630
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1117572
1631
+ // https://code.google.com/p/chromium/issues/detail?id=446051
1632
+ try {
1633
+ document.querySelector('html >>> :first-child');
1634
+ combinator = '>>>';
1635
+ } catch (noArrowArrowArrow) {
1636
+ try {
1637
+ // old syntax supported at least up to Chrome 41
1638
+ // https://code.google.com/p/chromium/issues/detail?id=446051
1639
+ document.querySelector('html /deep/ :first-child');
1640
+ combinator = '/deep/';
1641
+ } catch (noDeep) {
1642
+ combinator = '';
1643
+ }
1644
+ }
1645
+
1646
+ return combinator;
1647
+ };
1648
+
1649
+ module.exports = exports['default'];
1650
+
1651
+ }(cssShadowPiercingDeepCombinator, cssShadowPiercingDeepCombinator.exports));
1652
+
1653
+ var focusAreaImgTabindex = {exports: {}};
1654
+
1655
+ var gif = {exports: {}};
1656
+
1657
+ (function (module, exports) {
1658
+
1659
+ Object.defineProperty(exports, "__esModule", {
1660
+ value: true
1661
+ });
1662
+ exports.default = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
1663
+ module.exports = exports['default'];
1664
+
1665
+ }(gif, gif.exports));
1666
+
1667
+ (function (module, exports) {
1668
+
1669
+ Object.defineProperty(exports, "__esModule", {
1670
+ value: true
1671
+ });
1672
+
1673
+ var _gif = gif.exports;
1674
+
1675
+ var _gif2 = _interopRequireDefault(_gif);
1676
+
1677
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1678
+
1679
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
1680
+ exports.default = {
1681
+ element: 'div',
1682
+ mutate: function mutate(element) {
1683
+ element.innerHTML = '<map name="image-map-tabindex-test">' + '<area shape="rect" coords="63,19,144,45"></map>' + '<img usemap="#image-map-tabindex-test" tabindex="-1" alt="" src="' + _gif2.default + '">';
1684
+
1685
+ return element.querySelector('area');
1686
+ }
1687
+ };
1688
+ module.exports = exports['default'];
1689
+
1690
+ }(focusAreaImgTabindex, focusAreaImgTabindex.exports));
1691
+
1692
+ var focusAreaTabindex = {exports: {}};
1693
+
1694
+ (function (module, exports) {
1695
+
1696
+ Object.defineProperty(exports, "__esModule", {
1697
+ value: true
1698
+ });
1699
+
1700
+ var _gif = gif.exports;
1701
+
1702
+ var _gif2 = _interopRequireDefault(_gif);
1703
+
1704
+ var _platform = platform$1.exports;
1705
+
1706
+ var _platform2 = _interopRequireDefault(_platform);
1707
+
1708
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1709
+
1710
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
1711
+ exports.default = {
1712
+ element: 'div',
1713
+ mutate: function mutate(element) {
1714
+ element.innerHTML = '<map name="image-map-tabindex-test">' + '<area href="#void" tabindex="-1" shape="rect" coords="63,19,144,45"></map>' + '<img usemap="#image-map-tabindex-test" alt="" src="' + _gif2.default + '">';
1715
+
1716
+ return false;
1717
+ },
1718
+ validate: function validate(element, focusTarget, _document) {
1719
+ if (_platform2.default.is.GECKO) {
1720
+ // fixes https://github.com/medialize/ally.js/issues/35
1721
+ // Firefox loads the DataURI asynchronously, causing a false-negative
1722
+ return true;
1723
+ }
1724
+
1725
+ var focus = element.querySelector('area');
1726
+ focus.focus();
1727
+ return _document.activeElement === focus;
1728
+ }
1729
+ };
1730
+ module.exports = exports['default'];
1731
+
1732
+ }(focusAreaTabindex, focusAreaTabindex.exports));
1733
+
1734
+ var focusAreaWithoutHref = {exports: {}};
1735
+
1736
+ (function (module, exports) {
1737
+
1738
+ Object.defineProperty(exports, "__esModule", {
1739
+ value: true
1740
+ });
1741
+
1742
+ var _gif = gif.exports;
1743
+
1744
+ var _gif2 = _interopRequireDefault(_gif);
1745
+
1746
+ var _platform = platform$1.exports;
1747
+
1748
+ var _platform2 = _interopRequireDefault(_platform);
1749
+
1750
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1751
+
1752
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
1753
+ exports.default = {
1754
+ element: 'div',
1755
+ mutate: function mutate(element) {
1756
+ element.innerHTML = '<map name="image-map-area-href-test">' + '<area shape="rect" coords="63,19,144,45"></map>' + '<img usemap="#image-map-area-href-test" alt="" src="' + _gif2.default + '">';
1757
+
1758
+ return element.querySelector('area');
1759
+ },
1760
+ validate: function validate(element, focusTarget, _document) {
1761
+ if (_platform2.default.is.GECKO) {
1762
+ // fixes https://github.com/medialize/ally.js/issues/35
1763
+ // Firefox loads the DataURI asynchronously, causing a false-negative
1764
+ return true;
1765
+ }
1766
+
1767
+ return _document.activeElement === focusTarget;
1768
+ }
1769
+ };
1770
+ module.exports = exports['default'];
1771
+
1772
+ }(focusAreaWithoutHref, focusAreaWithoutHref.exports));
1773
+
1774
+ var focusAudioWithoutControls = {exports: {}};
1775
+
1776
+ var mp3 = {exports: {}};
1777
+
1778
+ (function (module, exports) {
1779
+
1780
+ Object.defineProperty(exports, "__esModule", {
1781
+ value: true
1782
+ });
1783
+
1784
+ var _gif = gif.exports;
1785
+
1786
+ var _gif2 = _interopRequireDefault(_gif);
1787
+
1788
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1789
+
1790
+ exports.default = _gif2.default;
1791
+ // export default 'data:audio/mp3;base64,audio-focus-test';
1792
+
1793
+ module.exports = exports['default'];
1794
+
1795
+ }(mp3, mp3.exports));
1796
+
1797
+ (function (module, exports) {
1798
+
1799
+ Object.defineProperty(exports, "__esModule", {
1800
+ value: true
1801
+ });
1802
+
1803
+ var _mp = mp3.exports;
1804
+
1805
+ var _mp2 = _interopRequireDefault(_mp);
1806
+
1807
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1808
+
1809
+ exports.default = {
1810
+ name: 'can-focus-audio-without-controls',
1811
+ element: 'audio',
1812
+ mutate: function mutate(element) {
1813
+ try {
1814
+ // invalid media file can trigger warning in console, data-uri to prevent HTTP request
1815
+ element.setAttribute('src', _mp2.default);
1816
+ } catch (e) {
1817
+ // IE9 may throw "Error: Not implemented"
1818
+ }
1819
+ }
1820
+ };
1821
+ module.exports = exports['default'];
1822
+
1823
+ }(focusAudioWithoutControls, focusAudioWithoutControls.exports));
1824
+
1825
+ var focusBrokenImageMap = {exports: {}};
1826
+
1827
+ var gif_invalid = {exports: {}};
1828
+
1829
+ (function (module, exports) {
1830
+
1831
+ Object.defineProperty(exports, "__esModule", {
1832
+ value: true
1833
+ });
1834
+ exports.default = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ';
1835
+ module.exports = exports['default'];
1836
+
1837
+ }(gif_invalid, gif_invalid.exports));
1838
+
1839
+ (function (module, exports) {
1840
+
1841
+ Object.defineProperty(exports, "__esModule", {
1842
+ value: true
1843
+ });
1844
+
1845
+ var _gif = gif_invalid.exports;
1846
+
1847
+ var _gif2 = _interopRequireDefault(_gif);
1848
+
1849
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1850
+
1851
+ // NOTE: https://github.com/medialize/ally.js/issues/35
1852
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
1853
+ exports.default = {
1854
+ element: 'div',
1855
+ mutate: function mutate(element) {
1856
+ element.innerHTML = '<map name="broken-image-map-test"><area href="#void" shape="rect" coords="63,19,144,45"></map>' + '<img usemap="#broken-image-map-test" alt="" src="' + _gif2.default + '">';
1857
+
1858
+ return element.querySelector('area');
1859
+ }
1860
+ };
1861
+ module.exports = exports['default'];
1862
+
1863
+ }(focusBrokenImageMap, focusBrokenImageMap.exports));
1864
+
1865
+ var focusChildrenOfFocusableFlexbox = {exports: {}};
1866
+
1867
+ (function (module, exports) {
1868
+
1869
+ Object.defineProperty(exports, "__esModule", {
1870
+ value: true
1871
+ });
1872
+
1873
+ // Children of focusable elements with display:flex are focusable in IE10-11
1874
+ exports.default = {
1875
+ element: 'div',
1876
+ mutate: function mutate(element) {
1877
+ element.setAttribute('tabindex', '-1');
1878
+ element.setAttribute('style', 'display: -webkit-flex; display: -ms-flexbox; display: flex;');
1879
+ element.innerHTML = '<span style="display: block;">hello</span>';
1880
+ return element.querySelector('span');
1881
+ }
1882
+ };
1883
+ module.exports = exports['default'];
1884
+
1885
+ }(focusChildrenOfFocusableFlexbox, focusChildrenOfFocusableFlexbox.exports));
1886
+
1887
+ var focusFieldsetDisabled = {exports: {}};
1888
+
1889
+ (function (module, exports) {
1890
+
1891
+ Object.defineProperty(exports, "__esModule", {
1892
+ value: true
1893
+ });
1894
+
1895
+ // fieldset[tabindex=0][disabled] should not be focusable, but Blink and WebKit disagree
1896
+ // @specification https://www.w3.org/TR/html5/disabled-elements.html#concept-element-disabled
1897
+ // @browser-issue Chromium https://crbug.com/453847
1898
+ // @browser-issue WebKit https://bugs.webkit.org/show_bug.cgi?id=141086
1899
+ exports.default = {
1900
+ element: 'fieldset',
1901
+ mutate: function mutate(element) {
1902
+ element.setAttribute('tabindex', 0);
1903
+ element.setAttribute('disabled', 'disabled');
1904
+ }
1905
+ };
1906
+ module.exports = exports['default'];
1907
+
1908
+ }(focusFieldsetDisabled, focusFieldsetDisabled.exports));
1909
+
1910
+ var focusFieldset = {exports: {}};
1911
+
1912
+ (function (module, exports) {
1913
+
1914
+ Object.defineProperty(exports, "__esModule", {
1915
+ value: true
1916
+ });
1917
+ exports.default = {
1918
+ element: 'fieldset',
1919
+ mutate: function mutate(element) {
1920
+ element.innerHTML = '<legend>legend</legend><p>content</p>';
1921
+ }
1922
+ };
1923
+ module.exports = exports['default'];
1924
+
1925
+ }(focusFieldset, focusFieldset.exports));
1926
+
1927
+ var focusFlexboxContainer = {exports: {}};
1928
+
1929
+ (function (module, exports) {
1930
+
1931
+ Object.defineProperty(exports, "__esModule", {
1932
+ value: true
1933
+ });
1934
+
1935
+ // elements with display:flex are focusable in IE10-11
1936
+ exports.default = {
1937
+ element: 'span',
1938
+ mutate: function mutate(element) {
1939
+ element.setAttribute('style', 'display: -webkit-flex; display: -ms-flexbox; display: flex;');
1940
+ element.innerHTML = '<span style="display: block;">hello</span>';
1941
+ }
1942
+ };
1943
+ module.exports = exports['default'];
1944
+
1945
+ }(focusFlexboxContainer, focusFlexboxContainer.exports));
1946
+
1947
+ var focusFormDisabled = {exports: {}};
1948
+
1949
+ (function (module, exports) {
1950
+
1951
+ Object.defineProperty(exports, "__esModule", {
1952
+ value: true
1953
+ });
1954
+
1955
+ // form[tabindex=0][disabled] should be focusable as the
1956
+ // specification doesn't know the disabled attribute on the form element
1957
+ // @specification https://www.w3.org/TR/html5/forms.html#the-form-element
1958
+ exports.default = {
1959
+ element: 'form',
1960
+ mutate: function mutate(element) {
1961
+ element.setAttribute('tabindex', 0);
1962
+ element.setAttribute('disabled', 'disabled');
1963
+ }
1964
+ };
1965
+ module.exports = exports['default'];
1966
+
1967
+ }(focusFormDisabled, focusFormDisabled.exports));
1968
+
1969
+ var focusImgIsmap = {exports: {}};
1970
+
1971
+ (function (module, exports) {
1972
+
1973
+ Object.defineProperty(exports, "__esModule", {
1974
+ value: true
1975
+ });
1976
+
1977
+ var _gif = gif.exports;
1978
+
1979
+ var _gif2 = _interopRequireDefault(_gif);
1980
+
1981
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1982
+
1983
+ // NOTE: https://github.com/medialize/ally.js/issues/35
1984
+ // fixes https://github.com/medialize/ally.js/issues/20
1985
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-ismap
1986
+ exports.default = {
1987
+ element: 'a',
1988
+ mutate: function mutate(element) {
1989
+ element.href = '#void';
1990
+ element.innerHTML = '<img ismap src="' + _gif2.default + '" alt="">';
1991
+ return element.querySelector('img');
1992
+ }
1993
+ };
1994
+ module.exports = exports['default'];
1995
+
1996
+ }(focusImgIsmap, focusImgIsmap.exports));
1997
+
1998
+ var focusImgUsemapTabindex = {exports: {}};
1999
+
2000
+ (function (module, exports) {
2001
+
2002
+ Object.defineProperty(exports, "__esModule", {
2003
+ value: true
2004
+ });
2005
+
2006
+ var _gif = gif.exports;
2007
+
2008
+ var _gif2 = _interopRequireDefault(_gif);
2009
+
2010
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2011
+
2012
+ // NOTE: https://github.com/medialize/ally.js/issues/35
2013
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
2014
+ exports.default = {
2015
+ element: 'div',
2016
+ mutate: function mutate(element) {
2017
+ element.innerHTML = '<map name="image-map-tabindex-test"><area href="#void" shape="rect" coords="63,19,144,45"></map>' + '<img usemap="#image-map-tabindex-test" tabindex="-1" alt="" ' + 'src="' + _gif2.default + '">';
2018
+
2019
+ return element.querySelector('img');
2020
+ }
2021
+ };
2022
+ module.exports = exports['default'];
2023
+
2024
+ }(focusImgUsemapTabindex, focusImgUsemapTabindex.exports));
2025
+
2026
+ var focusInHiddenIframe = {exports: {}};
2027
+
2028
+ (function (module, exports) {
2029
+
2030
+ Object.defineProperty(exports, "__esModule", {
2031
+ value: true
2032
+ });
2033
+ exports.default = {
2034
+ element: function element(wrapper, _document) {
2035
+ var iframe = _document.createElement('iframe');
2036
+
2037
+ // iframe must be part of the DOM before accessing the contentWindow is possible
2038
+ wrapper.appendChild(iframe);
2039
+
2040
+ // create the iframe's default document (<html><head></head><body></body></html>)
2041
+ var iframeDocument = iframe.contentWindow.document;
2042
+ iframeDocument.open();
2043
+ iframeDocument.close();
2044
+ return iframe;
2045
+ },
2046
+ mutate: function mutate(iframe) {
2047
+ iframe.style.visibility = 'hidden';
2048
+
2049
+ var iframeDocument = iframe.contentWindow.document;
2050
+ var input = iframeDocument.createElement('input');
2051
+ iframeDocument.body.appendChild(input);
2052
+ return input;
2053
+ },
2054
+ validate: function validate(iframe) {
2055
+ var iframeDocument = iframe.contentWindow.document;
2056
+ var focus = iframeDocument.querySelector('input');
2057
+ return iframeDocument.activeElement === focus;
2058
+ }
2059
+ };
2060
+ module.exports = exports['default'];
2061
+
2062
+ }(focusInHiddenIframe, focusInHiddenIframe.exports));
2063
+
2064
+ var focusInZeroDimensionObject = {exports: {}};
2065
+
2066
+ (function (module, exports) {
2067
+
2068
+ Object.defineProperty(exports, "__esModule", {
2069
+ value: true
2070
+ });
2071
+
2072
+ exports.default = function () {
2073
+ return result;
2074
+ };
2075
+
2076
+ var _platform = platform$1.exports;
2077
+
2078
+ var _platform2 = _interopRequireDefault(_platform);
2079
+
2080
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2081
+
2082
+ var result = !_platform2.default.is.WEBKIT;
2083
+
2084
+ module.exports = exports['default'];
2085
+
2086
+ }(focusInZeroDimensionObject, focusInZeroDimensionObject.exports));
2087
+
2088
+ var focusInvalidTabindex = {exports: {}};
2089
+
2090
+ (function (module, exports) {
2091
+
2092
+ Object.defineProperty(exports, "__esModule", {
2093
+ value: true
2094
+ });
2095
+
2096
+ // Firefox allows *any* value and treats invalid values like tabindex="-1"
2097
+ // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
2098
+ exports.default = {
2099
+ element: 'div',
2100
+ mutate: function mutate(element) {
2101
+ element.setAttribute('tabindex', 'invalid-value');
2102
+ }
2103
+ };
2104
+ module.exports = exports['default'];
2105
+
2106
+ }(focusInvalidTabindex, focusInvalidTabindex.exports));
2107
+
2108
+ var focusLabelTabindex = {exports: {}};
2109
+
2110
+ (function (module, exports) {
2111
+
2112
+ Object.defineProperty(exports, "__esModule", {
2113
+ value: true
2114
+ });
2115
+ exports.default = {
2116
+ element: 'label',
2117
+ mutate: function mutate(element) {
2118
+ element.setAttribute('tabindex', '-1');
2119
+ },
2120
+ validate: function validate(element, focusTarget, _document) {
2121
+ /* eslint-enable no-unused-vars */
2122
+ element.focus();
2123
+ return _document.activeElement === element;
2124
+ }
2125
+ };
2126
+ module.exports = exports['default'];
2127
+
2128
+ }(focusLabelTabindex, focusLabelTabindex.exports));
2129
+
2130
+ var focusObjectSvgHidden = {exports: {}};
2131
+
2132
+ var svg$1 = {exports: {}};
2133
+
2134
+ (function (module, exports) {
2135
+
2136
+ Object.defineProperty(exports, "__esModule", {
2137
+ value: true
2138
+ });
2139
+ exports.default = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtb' + 'G5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBpZD0ic3ZnIj48dGV4dCB4PSIxMCIgeT0iMjAiIGlkPSJ' + 'zdmctbGluay10ZXh0Ij50ZXh0PC90ZXh0Pjwvc3ZnPg==';
2140
+ module.exports = exports['default'];
2141
+
2142
+ }(svg$1, svg$1.exports));
2143
+
2144
+ (function (module, exports) {
2145
+
2146
+ Object.defineProperty(exports, "__esModule", {
2147
+ value: true
2148
+ });
2149
+
2150
+ var _svg = svg$1.exports;
2151
+
2152
+ var _svg2 = _interopRequireDefault(_svg);
2153
+
2154
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2155
+
2156
+ // Note: IE10 on BrowserStack does not like this test
2157
+
2158
+ exports.default = {
2159
+ element: 'object',
2160
+ mutate: function mutate(element) {
2161
+ element.setAttribute('type', 'image/svg+xml');
2162
+ element.setAttribute('data', _svg2.default);
2163
+ element.setAttribute('width', '200');
2164
+ element.setAttribute('height', '50');
2165
+ element.style.visibility = 'hidden';
2166
+ }
2167
+ };
2168
+ module.exports = exports['default'];
2169
+
2170
+ }(focusObjectSvgHidden, focusObjectSvgHidden.exports));
2171
+
2172
+ var focusObjectSvg = {exports: {}};
2173
+
2174
+ (function (module, exports) {
2175
+
2176
+ Object.defineProperty(exports, "__esModule", {
2177
+ value: true
2178
+ });
2179
+
2180
+ var _svg = svg$1.exports;
2181
+
2182
+ var _svg2 = _interopRequireDefault(_svg);
2183
+
2184
+ var _platform = platform$1.exports;
2185
+
2186
+ var _platform2 = _interopRequireDefault(_platform);
2187
+
2188
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2189
+
2190
+ // Note: IE10 on BrowserStack does not like this test
2191
+
2192
+ exports.default = {
2193
+ name: 'can-focus-object-svg',
2194
+ element: 'object',
2195
+ mutate: function mutate(element) {
2196
+ element.setAttribute('type', 'image/svg+xml');
2197
+ element.setAttribute('data', _svg2.default);
2198
+ element.setAttribute('width', '200');
2199
+ element.setAttribute('height', '50');
2200
+ },
2201
+ validate: function validate(element, focusTarget, _document) {
2202
+ if (_platform2.default.is.GECKO) {
2203
+ // Firefox seems to be handling the object creation asynchronously and thereby produces a false negative test result.
2204
+ // Because we know Firefox is able to focus object elements referencing SVGs, we simply cheat by sniffing the user agent string
2205
+ return true;
2206
+ }
2207
+
2208
+ return _document.activeElement === element;
2209
+ }
2210
+ };
2211
+ module.exports = exports['default'];
2212
+
2213
+ }(focusObjectSvg, focusObjectSvg.exports));
2214
+
2215
+ var focusObjectSwf = {exports: {}};
2216
+
2217
+ (function (module, exports) {
2218
+
2219
+ Object.defineProperty(exports, "__esModule", {
2220
+ value: true
2221
+ });
2222
+
2223
+ exports.default = function () {
2224
+ return result;
2225
+ };
2226
+
2227
+ var _platform = platform$1.exports;
2228
+
2229
+ var _platform2 = _interopRequireDefault(_platform);
2230
+
2231
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2232
+
2233
+ // Every Environment except IE9 considers SWF objects focusable
2234
+ var result = !_platform2.default.is.IE9;
2235
+
2236
+ module.exports = exports['default'];
2237
+
2238
+ }(focusObjectSwf, focusObjectSwf.exports));
2239
+
2240
+ var focusRedirectImgUsemap = {exports: {}};
2241
+
2242
+ (function (module, exports) {
2243
+
2244
+ Object.defineProperty(exports, "__esModule", {
2245
+ value: true
2246
+ });
2247
+
2248
+ var _gif = gif.exports;
2249
+
2250
+ var _gif2 = _interopRequireDefault(_gif);
2251
+
2252
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2253
+
2254
+ exports.default = {
2255
+ element: 'div',
2256
+ mutate: function mutate(element) {
2257
+ element.innerHTML = '<map name="focus-redirect-img-usemap"><area href="#void" shape="rect" coords="63,19,144,45"></map>' + '<img usemap="#focus-redirect-img-usemap" alt="" ' + 'src="' + _gif2.default + '">';
2258
+
2259
+ // focus the <img>, not the <div>
2260
+ return element.querySelector('img');
2261
+ },
2262
+ validate: function validate(element, focusTarget, _document) {
2263
+ var target = element.querySelector('area');
2264
+ return _document.activeElement === target;
2265
+ }
2266
+ };
2267
+ module.exports = exports['default'];
2268
+
2269
+ }(focusRedirectImgUsemap, focusRedirectImgUsemap.exports));
2270
+
2271
+ var focusRedirectLegend = {exports: {}};
2272
+
2273
+ (function (module, exports) {
2274
+
2275
+ Object.defineProperty(exports, "__esModule", {
2276
+ value: true
2277
+ });
2278
+
2279
+ // see https://jsbin.com/nenirisage/edit?html,js,console,output
2280
+
2281
+ exports.default = {
2282
+ element: 'fieldset',
2283
+ mutate: function mutate(element) {
2284
+ element.innerHTML = '<legend>legend</legend><input tabindex="-1"><input tabindex="0">';
2285
+ // take care of focus in validate();
2286
+ return false;
2287
+ },
2288
+ validate: function validate(element, focusTarget, _document) {
2289
+ var focusable = element.querySelector('input[tabindex="-1"]');
2290
+ var tabbable = element.querySelector('input[tabindex="0"]');
2291
+
2292
+ // Firefox requires this test to focus the <fieldset> first, while this is not necessary in
2293
+ // https://jsbin.com/nenirisage/edit?html,js,console,output
2294
+ element.focus();
2295
+
2296
+ element.querySelector('legend').focus();
2297
+ return _document.activeElement === focusable && 'focusable' || _document.activeElement === tabbable && 'tabbable' || '';
2298
+ }
2299
+ };
2300
+ module.exports = exports['default'];
2301
+
2302
+ }(focusRedirectLegend, focusRedirectLegend.exports));
2303
+
2304
+ var focusScrollBody = {exports: {}};
2305
+
2306
+ (function (module, exports) {
2307
+
2308
+ Object.defineProperty(exports, "__esModule", {
2309
+ value: true
2310
+ });
2311
+
2312
+ // https://github.com/medialize/ally.js/issues/21
2313
+ exports.default = {
2314
+ element: 'div',
2315
+ mutate: function mutate(element) {
2316
+ element.setAttribute('style', 'width: 100px; height: 50px; overflow: auto;');
2317
+ element.innerHTML = '<div style="width: 500px; height: 40px;">scrollable content</div>';
2318
+ return element.querySelector('div');
2319
+ }
2320
+ };
2321
+ module.exports = exports['default'];
2322
+
2323
+ }(focusScrollBody, focusScrollBody.exports));
2324
+
2325
+ var focusScrollContainerWithoutOverflow = {exports: {}};
2326
+
2327
+ (function (module, exports) {
2328
+
2329
+ Object.defineProperty(exports, "__esModule", {
2330
+ value: true
2331
+ });
2332
+
2333
+ // https://github.com/medialize/ally.js/issues/21
2334
+ exports.default = {
2335
+ element: 'div',
2336
+ mutate: function mutate(element) {
2337
+ element.setAttribute('style', 'width: 100px; height: 50px;');
2338
+ element.innerHTML = '<div style="width: 500px; height: 40px;">scrollable content</div>';
2339
+ }
2340
+ };
2341
+ module.exports = exports['default'];
2342
+
2343
+ }(focusScrollContainerWithoutOverflow, focusScrollContainerWithoutOverflow.exports));
2344
+
2345
+ var focusScrollContainer = {exports: {}};
2346
+
2347
+ (function (module, exports) {
2348
+
2349
+ Object.defineProperty(exports, "__esModule", {
2350
+ value: true
2351
+ });
2352
+
2353
+ // https://github.com/medialize/ally.js/issues/21
2354
+ exports.default = {
2355
+ element: 'div',
2356
+ mutate: function mutate(element) {
2357
+ element.setAttribute('style', 'width: 100px; height: 50px; overflow: auto;');
2358
+ element.innerHTML = '<div style="width: 500px; height: 40px;">scrollable content</div>';
2359
+ }
2360
+ };
2361
+ module.exports = exports['default'];
2362
+
2363
+ }(focusScrollContainer, focusScrollContainer.exports));
2364
+
2365
+ var focusSummary = {exports: {}};
2366
+
2367
+ (function (module, exports) {
2368
+
2369
+ Object.defineProperty(exports, "__esModule", {
2370
+ value: true
2371
+ });
2372
+ exports.default = {
2373
+ element: 'details',
2374
+ mutate: function mutate(element) {
2375
+ element.innerHTML = '<summary>foo</summary><p>content</p>';
2376
+ return element.firstElementChild;
2377
+ }
2378
+ };
2379
+ module.exports = exports['default'];
2380
+
2381
+ }(focusSummary, focusSummary.exports));
2382
+
2383
+ var focusSvgFocusableAttribute = {exports: {}};
2384
+
2385
+ var svg = {};
2386
+
2387
+ var focus_svgForeignObjectHack = {exports: {}};
2388
+
2389
+ (function (module, exports) {
2390
+
2391
+ Object.defineProperty(exports, "__esModule", {
2392
+ value: true
2393
+ });
2394
+
2395
+ exports.default = function (element) {
2396
+ // Edge13, Edge14: foreignObject focus hack
2397
+ // https://jsbin.com/kunehinugi/edit?html,js,output
2398
+ // https://jsbin.com/fajagi/3/edit?html,js,output
2399
+ var isSvgElement = element.ownerSVGElement || element.nodeName.toLowerCase() === 'svg';
2400
+ if (!isSvgElement) {
2401
+ return false;
2402
+ }
2403
+
2404
+ // inject and focus an <input> element into the SVG element to receive focus
2405
+ var foreignObject = makeFocusableForeignObject();
2406
+ element.appendChild(foreignObject);
2407
+ var input = foreignObject.querySelector('input');
2408
+ input.focus();
2409
+
2410
+ // upon disabling the activeElement, IE and Edge
2411
+ // will not shift focus to <body> like all the other
2412
+ // browsers, but instead find the first focusable
2413
+ // ancestor and shift focus to that
2414
+ input.disabled = true;
2415
+
2416
+ // clean up
2417
+ element.removeChild(foreignObject);
2418
+ return true;
2419
+ };
2420
+
2421
+ function makeFocusableForeignObject() {
2422
+ var fragment = document.createElement('div');
2423
+ fragment.innerHTML = '<svg><foreignObject width="30" height="30">\n <input type="text"/>\n </foreignObject></svg>';
2424
+
2425
+ return fragment.firstChild.firstChild;
2426
+ }
2427
+
2428
+ module.exports = exports['default'];
2429
+
2430
+ }(focus_svgForeignObjectHack, focus_svgForeignObjectHack.exports));
2431
+
2432
+ Object.defineProperty(svg, "__esModule", {
2433
+ value: true
2434
+ });
2435
+ svg.generate = generate;
2436
+ svg.focus = focus;
2437
+ svg.validate = validate;
2438
+
2439
+ var _focus = focus_svgForeignObjectHack.exports;
2440
+
2441
+ var _focus2 = _interopRequireDefault$1(_focus);
2442
+
2443
+ function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2444
+
2445
+ function generate(element) {
2446
+ return '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' + element + '</svg>';
2447
+ }
2448
+
2449
+ function focus(element) {
2450
+ if (element.focus) {
2451
+ return;
2452
+ }
2453
+
2454
+ try {
2455
+ HTMLElement.prototype.focus.call(element);
2456
+ } catch (e) {
2457
+ (0, _focus2.default)(element);
2458
+ }
2459
+ }
2460
+
2461
+ function validate(element, focusTarget, _document) {
2462
+ focus(focusTarget);
2463
+ return _document.activeElement === focusTarget;
2464
+ }
2465
+
2466
+ (function (module, exports) {
2467
+
2468
+ Object.defineProperty(exports, "__esModule", {
2469
+ value: true
2470
+ });
2471
+
2472
+ var _svg = svg;
2473
+
2474
+ exports.default = {
2475
+ element: 'div',
2476
+ mutate: function mutate(element) {
2477
+ element.innerHTML = (0, _svg.generate)('<text focusable="true">a</text>');
2478
+ return element.querySelector('text');
2479
+ },
2480
+ validate: _svg.validate
2481
+ };
2482
+ module.exports = exports['default'];
2483
+
2484
+ }(focusSvgFocusableAttribute, focusSvgFocusableAttribute.exports));
2485
+
2486
+ var focusSvgTabindexAttribute = {exports: {}};
2487
+
2488
+ (function (module, exports) {
2489
+
2490
+ Object.defineProperty(exports, "__esModule", {
2491
+ value: true
2492
+ });
2493
+
2494
+ var _svg = svg;
2495
+
2496
+ exports.default = {
2497
+ element: 'div',
2498
+ mutate: function mutate(element) {
2499
+ element.innerHTML = (0, _svg.generate)('<text tabindex="0">a</text>');
2500
+ return element.querySelector('text');
2501
+ },
2502
+ validate: _svg.validate
2503
+ };
2504
+ module.exports = exports['default'];
2505
+
2506
+ }(focusSvgTabindexAttribute, focusSvgTabindexAttribute.exports));
2507
+
2508
+ var focusSvgNegativeTabindexAttribute = {exports: {}};
2509
+
2510
+ (function (module, exports) {
2511
+
2512
+ Object.defineProperty(exports, "__esModule", {
2513
+ value: true
2514
+ });
2515
+
2516
+ var _svg = svg;
2517
+
2518
+ exports.default = {
2519
+ element: 'div',
2520
+ mutate: function mutate(element) {
2521
+ element.innerHTML = (0, _svg.generate)('<text tabindex="-1">a</text>');
2522
+ return element.querySelector('text');
2523
+ },
2524
+ validate: _svg.validate
2525
+ };
2526
+ module.exports = exports['default'];
2527
+
2528
+ }(focusSvgNegativeTabindexAttribute, focusSvgNegativeTabindexAttribute.exports));
2529
+
2530
+ var focusSvgUseTabindex = {exports: {}};
2531
+
2532
+ (function (module, exports) {
2533
+
2534
+ Object.defineProperty(exports, "__esModule", {
2535
+ value: true
2536
+ });
2537
+
2538
+ var _svg = svg;
2539
+
2540
+ exports.default = {
2541
+ element: 'div',
2542
+ mutate: function mutate(element) {
2543
+ element.innerHTML = (0, _svg.generate)(['<g id="ally-test-target"><a xlink:href="#void"><text>link</text></a></g>', '<use xlink:href="#ally-test-target" x="0" y="0" tabindex="-1" />'].join(''));
2544
+
2545
+ return element.querySelector('use');
2546
+ },
2547
+ validate: _svg.validate
2548
+ };
2549
+ module.exports = exports['default'];
2550
+
2551
+ }(focusSvgUseTabindex, focusSvgUseTabindex.exports));
2552
+
2553
+ var focusSvgForeignobjectTabindex = {exports: {}};
2554
+
2555
+ (function (module, exports) {
2556
+
2557
+ Object.defineProperty(exports, "__esModule", {
2558
+ value: true
2559
+ });
2560
+
2561
+ var _svg = svg;
2562
+
2563
+ exports.default = {
2564
+ element: 'div',
2565
+ mutate: function mutate(element) {
2566
+ element.innerHTML = (0, _svg.generate)('<foreignObject tabindex="-1"><input type="text" /></foreignObject>');
2567
+ // Safari 8's quersSelector() can't identify foreignObject, but getElementyByTagName() can
2568
+ return element.querySelector('foreignObject') || element.getElementsByTagName('foreignObject')[0];
2569
+ },
2570
+ validate: _svg.validate
2571
+
2572
+ };
2573
+ module.exports = exports['default'];
2574
+
2575
+ }(focusSvgForeignobjectTabindex, focusSvgForeignobjectTabindex.exports));
2576
+
2577
+ var focusSvgInIframe = {exports: {}};
2578
+
2579
+ (function (module, exports) {
2580
+
2581
+ Object.defineProperty(exports, "__esModule", {
2582
+ value: true
2583
+ });
2584
+
2585
+ exports.default = function () {
2586
+ return result;
2587
+ };
2588
+
2589
+ var _platform = platform$1.exports;
2590
+
2591
+ var _platform2 = _interopRequireDefault(_platform);
2592
+
2593
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2594
+
2595
+ // Firefox seems to be handling the SVG-document-in-iframe creation asynchronously
2596
+ // and thereby produces a false negative test result. Thus the test is pointless
2597
+ // and we resort to UA sniffing once again.
2598
+ // see http://jsbin.com/vunadohoko/1/edit?js,console,output
2599
+
2600
+ var result = Boolean(_platform2.default.is.GECKO && typeof SVGElement !== 'undefined' && SVGElement.prototype.focus);
2601
+
2602
+ module.exports = exports['default'];
2603
+
2604
+ }(focusSvgInIframe, focusSvgInIframe.exports));
2605
+
2606
+ var focusSvg = {exports: {}};
2607
+
2608
+ (function (module, exports) {
2609
+
2610
+ Object.defineProperty(exports, "__esModule", {
2611
+ value: true
2612
+ });
2613
+
2614
+ var _svg = svg;
2615
+
2616
+ exports.default = {
2617
+ element: 'div',
2618
+ mutate: function mutate(element) {
2619
+ element.innerHTML = (0, _svg.generate)('');
2620
+ return element.firstChild;
2621
+ },
2622
+ validate: _svg.validate
2623
+ };
2624
+ module.exports = exports['default'];
2625
+
2626
+ }(focusSvg, focusSvg.exports));
2627
+
2628
+ var focusTabindexTrailingCharacters = {exports: {}};
2629
+
2630
+ (function (module, exports) {
2631
+
2632
+ Object.defineProperty(exports, "__esModule", {
2633
+ value: true
2634
+ });
2635
+
2636
+ // Firefox allows *any* value and treats invalid values like tabindex="-1"
2637
+ // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
2638
+ exports.default = {
2639
+ element: 'div',
2640
+ mutate: function mutate(element) {
2641
+ element.setAttribute('tabindex', '3x');
2642
+ }
2643
+ };
2644
+ module.exports = exports['default'];
2645
+
2646
+ }(focusTabindexTrailingCharacters, focusTabindexTrailingCharacters.exports));
2647
+
2648
+ var focusTable = {exports: {}};
2649
+
2650
+ (function (module, exports) {
2651
+
2652
+ Object.defineProperty(exports, "__esModule", {
2653
+ value: true
2654
+ });
2655
+ exports.default = {
2656
+ element: 'table',
2657
+ mutate: function mutate(element, wrapper, _document) {
2658
+ // IE9 has a problem replacing TBODY contents with innerHTML.
2659
+ // https://stackoverflow.com/a/8097055/515124
2660
+ // element.innerHTML = '<tr><td>cell</td></tr>';
2661
+ var fragment = _document.createDocumentFragment();
2662
+ fragment.innerHTML = '<tr><td>cell</td></tr>';
2663
+ element.appendChild(fragment);
2664
+ }
2665
+ };
2666
+ module.exports = exports['default'];
2667
+
2668
+ }(focusTable, focusTable.exports));
2669
+
2670
+ var focusVideoWithoutControls = {exports: {}};
2671
+
2672
+ var mp4 = {exports: {}};
2673
+
2674
+ (function (module, exports) {
2675
+
2676
+ Object.defineProperty(exports, "__esModule", {
2677
+ value: true
2678
+ });
2679
+
2680
+ var _gif = gif.exports;
2681
+
2682
+ var _gif2 = _interopRequireDefault(_gif);
2683
+
2684
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2685
+
2686
+ exports.default = _gif2.default;
2687
+ // export default 'data:video/mp4;base64,video-focus-test';
2688
+
2689
+ module.exports = exports['default'];
2690
+
2691
+ }(mp4, mp4.exports));
2692
+
2693
+ (function (module, exports) {
2694
+
2695
+ Object.defineProperty(exports, "__esModule", {
2696
+ value: true
2697
+ });
2698
+
2699
+ var _mp = mp4.exports;
2700
+
2701
+ var _mp2 = _interopRequireDefault(_mp);
2702
+
2703
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2704
+
2705
+ exports.default = {
2706
+ element: 'video',
2707
+ mutate: function mutate(element) {
2708
+ try {
2709
+ // invalid media file can trigger warning in console, data-uri to prevent HTTP request
2710
+ element.setAttribute('src', _mp2.default);
2711
+ } catch (e) {
2712
+ // IE9 may throw "Error: Not implemented"
2713
+ }
2714
+ }
2715
+ };
2716
+ module.exports = exports['default'];
2717
+
2718
+ }(focusVideoWithoutControls, focusVideoWithoutControls.exports));
2719
+
2720
+ var tabsequenceAreaAtImgPosition = {exports: {}};
2721
+
2722
+ (function (module, exports) {
2723
+
2724
+ Object.defineProperty(exports, "__esModule", {
2725
+ value: true
2726
+ });
2727
+
2728
+ exports.default = function () {
2729
+ return result;
2730
+ };
2731
+
2732
+ var _platform = platform$1.exports;
2733
+
2734
+ var _platform2 = _interopRequireDefault(_platform);
2735
+
2736
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2737
+
2738
+ // https://jsbin.com/vafaba/3/edit?html,js,console,output
2739
+ var result = _platform2.default.is.GECKO || _platform2.default.is.TRIDENT || _platform2.default.is.EDGE;
2740
+
2741
+ module.exports = exports['default'];
2742
+
2743
+ }(tabsequenceAreaAtImgPosition, tabsequenceAreaAtImgPosition.exports));
2744
+
2745
+ (function (module, exports) {
2746
+
2747
+ Object.defineProperty(exports, "__esModule", {
2748
+ value: true
2749
+ });
2750
+
2751
+ exports.default = function () {
2752
+ if (supportsCache$1) {
2753
+ return supportsCache$1;
2754
+ }
2755
+
2756
+ supportsCache$1 = _supportsCache2.default.get();
2757
+ if (!supportsCache$1.time) {
2758
+ _supportsCache2.default.set(executeTests());
2759
+ supportsCache$1 = _supportsCache2.default.get();
2760
+ }
2761
+
2762
+ return supportsCache$1;
2763
+ };
2764
+
2765
+ var _detectFocus = detectFocus.exports;
2766
+
2767
+ var _detectFocus2 = _interopRequireDefault(_detectFocus);
2768
+
2769
+ var _supportsCache = supportsCache.exports;
2770
+
2771
+ var _supportsCache2 = _interopRequireDefault(_supportsCache);
2772
+
2773
+ var _cssShadowPiercingDeepCombinator = cssShadowPiercingDeepCombinator.exports;
2774
+
2775
+ var _cssShadowPiercingDeepCombinator2 = _interopRequireDefault(_cssShadowPiercingDeepCombinator);
2776
+
2777
+ var _focusAreaImgTabindex = focusAreaImgTabindex.exports;
2778
+
2779
+ var _focusAreaImgTabindex2 = _interopRequireDefault(_focusAreaImgTabindex);
2780
+
2781
+ var _focusAreaTabindex = focusAreaTabindex.exports;
2782
+
2783
+ var _focusAreaTabindex2 = _interopRequireDefault(_focusAreaTabindex);
2784
+
2785
+ var _focusAreaWithoutHref = focusAreaWithoutHref.exports;
2786
+
2787
+ var _focusAreaWithoutHref2 = _interopRequireDefault(_focusAreaWithoutHref);
2788
+
2789
+ var _focusAudioWithoutControls = focusAudioWithoutControls.exports;
2790
+
2791
+ var _focusAudioWithoutControls2 = _interopRequireDefault(_focusAudioWithoutControls);
2792
+
2793
+ var _focusBrokenImageMap = focusBrokenImageMap.exports;
2794
+
2795
+ var _focusBrokenImageMap2 = _interopRequireDefault(_focusBrokenImageMap);
2796
+
2797
+ var _focusChildrenOfFocusableFlexbox = focusChildrenOfFocusableFlexbox.exports;
2798
+
2799
+ var _focusChildrenOfFocusableFlexbox2 = _interopRequireDefault(_focusChildrenOfFocusableFlexbox);
2800
+
2801
+ var _focusFieldsetDisabled = focusFieldsetDisabled.exports;
2802
+
2803
+ var _focusFieldsetDisabled2 = _interopRequireDefault(_focusFieldsetDisabled);
2804
+
2805
+ var _focusFieldset = focusFieldset.exports;
2806
+
2807
+ var _focusFieldset2 = _interopRequireDefault(_focusFieldset);
2808
+
2809
+ var _focusFlexboxContainer = focusFlexboxContainer.exports;
2810
+
2811
+ var _focusFlexboxContainer2 = _interopRequireDefault(_focusFlexboxContainer);
2812
+
2813
+ var _focusFormDisabled = focusFormDisabled.exports;
2814
+
2815
+ var _focusFormDisabled2 = _interopRequireDefault(_focusFormDisabled);
2816
+
2817
+ var _focusImgIsmap = focusImgIsmap.exports;
2818
+
2819
+ var _focusImgIsmap2 = _interopRequireDefault(_focusImgIsmap);
2820
+
2821
+ var _focusImgUsemapTabindex = focusImgUsemapTabindex.exports;
2822
+
2823
+ var _focusImgUsemapTabindex2 = _interopRequireDefault(_focusImgUsemapTabindex);
2824
+
2825
+ var _focusInHiddenIframe = focusInHiddenIframe.exports;
2826
+
2827
+ var _focusInHiddenIframe2 = _interopRequireDefault(_focusInHiddenIframe);
2828
+
2829
+ var _focusInZeroDimensionObject = focusInZeroDimensionObject.exports;
2830
+
2831
+ var _focusInZeroDimensionObject2 = _interopRequireDefault(_focusInZeroDimensionObject);
2832
+
2833
+ var _focusInvalidTabindex = focusInvalidTabindex.exports;
2834
+
2835
+ var _focusInvalidTabindex2 = _interopRequireDefault(_focusInvalidTabindex);
2836
+
2837
+ var _focusLabelTabindex = focusLabelTabindex.exports;
2838
+
2839
+ var _focusLabelTabindex2 = _interopRequireDefault(_focusLabelTabindex);
2840
+
2841
+ var _focusObjectSvgHidden = focusObjectSvgHidden.exports;
2842
+
2843
+ var _focusObjectSvgHidden2 = _interopRequireDefault(_focusObjectSvgHidden);
2844
+
2845
+ var _focusObjectSvg = focusObjectSvg.exports;
2846
+
2847
+ var _focusObjectSvg2 = _interopRequireDefault(_focusObjectSvg);
2848
+
2849
+ var _focusObjectSwf = focusObjectSwf.exports;
2850
+
2851
+ var _focusObjectSwf2 = _interopRequireDefault(_focusObjectSwf);
2852
+
2853
+ var _focusRedirectImgUsemap = focusRedirectImgUsemap.exports;
2854
+
2855
+ var _focusRedirectImgUsemap2 = _interopRequireDefault(_focusRedirectImgUsemap);
2856
+
2857
+ var _focusRedirectLegend = focusRedirectLegend.exports;
2858
+
2859
+ var _focusRedirectLegend2 = _interopRequireDefault(_focusRedirectLegend);
2860
+
2861
+ var _focusScrollBody = focusScrollBody.exports;
2862
+
2863
+ var _focusScrollBody2 = _interopRequireDefault(_focusScrollBody);
2864
+
2865
+ var _focusScrollContainerWithoutOverflow = focusScrollContainerWithoutOverflow.exports;
2866
+
2867
+ var _focusScrollContainerWithoutOverflow2 = _interopRequireDefault(_focusScrollContainerWithoutOverflow);
2868
+
2869
+ var _focusScrollContainer = focusScrollContainer.exports;
2870
+
2871
+ var _focusScrollContainer2 = _interopRequireDefault(_focusScrollContainer);
2872
+
2873
+ var _focusSummary = focusSummary.exports;
2874
+
2875
+ var _focusSummary2 = _interopRequireDefault(_focusSummary);
2876
+
2877
+ var _focusSvgFocusableAttribute = focusSvgFocusableAttribute.exports;
2878
+
2879
+ var _focusSvgFocusableAttribute2 = _interopRequireDefault(_focusSvgFocusableAttribute);
2880
+
2881
+ var _focusSvgTabindexAttribute = focusSvgTabindexAttribute.exports;
2882
+
2883
+ var _focusSvgTabindexAttribute2 = _interopRequireDefault(_focusSvgTabindexAttribute);
2884
+
2885
+ var _focusSvgNegativeTabindexAttribute = focusSvgNegativeTabindexAttribute.exports;
2886
+
2887
+ var _focusSvgNegativeTabindexAttribute2 = _interopRequireDefault(_focusSvgNegativeTabindexAttribute);
2888
+
2889
+ var _focusSvgUseTabindex = focusSvgUseTabindex.exports;
2890
+
2891
+ var _focusSvgUseTabindex2 = _interopRequireDefault(_focusSvgUseTabindex);
2892
+
2893
+ var _focusSvgForeignobjectTabindex = focusSvgForeignobjectTabindex.exports;
2894
+
2895
+ var _focusSvgForeignobjectTabindex2 = _interopRequireDefault(_focusSvgForeignobjectTabindex);
2896
+
2897
+ var _focusSvgInIframe = focusSvgInIframe.exports;
2898
+
2899
+ var _focusSvgInIframe2 = _interopRequireDefault(_focusSvgInIframe);
2900
+
2901
+ var _focusSvg = focusSvg.exports;
2902
+
2903
+ var _focusSvg2 = _interopRequireDefault(_focusSvg);
2904
+
2905
+ var _focusTabindexTrailingCharacters = focusTabindexTrailingCharacters.exports;
2906
+
2907
+ var _focusTabindexTrailingCharacters2 = _interopRequireDefault(_focusTabindexTrailingCharacters);
2908
+
2909
+ var _focusTable = focusTable.exports;
2910
+
2911
+ var _focusTable2 = _interopRequireDefault(_focusTable);
2912
+
2913
+ var _focusVideoWithoutControls = focusVideoWithoutControls.exports;
2914
+
2915
+ var _focusVideoWithoutControls2 = _interopRequireDefault(_focusVideoWithoutControls);
2916
+
2917
+ var _tabsequenceAreaAtImgPosition = tabsequenceAreaAtImgPosition.exports;
2918
+
2919
+ var _tabsequenceAreaAtImgPosition2 = _interopRequireDefault(_tabsequenceAreaAtImgPosition);
2920
+
2921
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2922
+
2923
+ var testCallbacks = {
2924
+ cssShadowPiercingDeepCombinator: _cssShadowPiercingDeepCombinator2.default,
2925
+ focusInZeroDimensionObject: _focusInZeroDimensionObject2.default,
2926
+ focusObjectSwf: _focusObjectSwf2.default,
2927
+ focusSvgInIframe: _focusSvgInIframe2.default,
2928
+ tabsequenceAreaAtImgPosition: _tabsequenceAreaAtImgPosition2.default
2929
+ };
2930
+
2931
+ var testDescriptions = {
2932
+ focusAreaImgTabindex: _focusAreaImgTabindex2.default,
2933
+ focusAreaTabindex: _focusAreaTabindex2.default,
2934
+ focusAreaWithoutHref: _focusAreaWithoutHref2.default,
2935
+ focusAudioWithoutControls: _focusAudioWithoutControls2.default,
2936
+ focusBrokenImageMap: _focusBrokenImageMap2.default,
2937
+ focusChildrenOfFocusableFlexbox: _focusChildrenOfFocusableFlexbox2.default,
2938
+ focusFieldsetDisabled: _focusFieldsetDisabled2.default,
2939
+ focusFieldset: _focusFieldset2.default,
2940
+ focusFlexboxContainer: _focusFlexboxContainer2.default,
2941
+ focusFormDisabled: _focusFormDisabled2.default,
2942
+ focusImgIsmap: _focusImgIsmap2.default,
2943
+ focusImgUsemapTabindex: _focusImgUsemapTabindex2.default,
2944
+ focusInHiddenIframe: _focusInHiddenIframe2.default,
2945
+ focusInvalidTabindex: _focusInvalidTabindex2.default,
2946
+ focusLabelTabindex: _focusLabelTabindex2.default,
2947
+ focusObjectSvg: _focusObjectSvg2.default,
2948
+ focusObjectSvgHidden: _focusObjectSvgHidden2.default,
2949
+ focusRedirectImgUsemap: _focusRedirectImgUsemap2.default,
2950
+ focusRedirectLegend: _focusRedirectLegend2.default,
2951
+ focusScrollBody: _focusScrollBody2.default,
2952
+ focusScrollContainerWithoutOverflow: _focusScrollContainerWithoutOverflow2.default,
2953
+ focusScrollContainer: _focusScrollContainer2.default,
2954
+ focusSummary: _focusSummary2.default,
2955
+ focusSvgFocusableAttribute: _focusSvgFocusableAttribute2.default,
2956
+ focusSvgTabindexAttribute: _focusSvgTabindexAttribute2.default,
2957
+ focusSvgNegativeTabindexAttribute: _focusSvgNegativeTabindexAttribute2.default,
2958
+ focusSvgUseTabindex: _focusSvgUseTabindex2.default,
2959
+ focusSvgForeignobjectTabindex: _focusSvgForeignobjectTabindex2.default,
2960
+ focusSvg: _focusSvg2.default,
2961
+ focusTabindexTrailingCharacters: _focusTabindexTrailingCharacters2.default,
2962
+ focusTable: _focusTable2.default,
2963
+ focusVideoWithoutControls: _focusVideoWithoutControls2.default
2964
+ };
2965
+
2966
+ function executeTests() {
2967
+ var results = (0, _detectFocus2.default)(testDescriptions);
2968
+ Object.keys(testCallbacks).forEach(function (key) {
2969
+ results[key] = testCallbacks[key]();
2970
+ });
2971
+
2972
+ return results;
2973
+ }
2974
+
2975
+ var supportsCache$1 = null;
2976
+
2977
+ module.exports = exports['default'];
2978
+
2979
+ }(supports, supports.exports));
2980
+
2981
+ (function (module, exports) {
2982
+
2983
+ Object.defineProperty(exports, "__esModule", {
2984
+ value: true
2985
+ });
2986
+
2987
+ exports.default = function (context) {
2988
+ if (!supports$1) {
2989
+ supports$1 = (0, _supports3.default)();
2990
+ }
2991
+
2992
+ var validIntegerPattern = supports$1.focusTabindexTrailingCharacters ? validIntegerPatternWithTrailing : validIntegerPatternNoTrailing;
2993
+
2994
+ var element = (0, _contextToElement2.default)({
2995
+ label: 'is/valid-tabindex',
2996
+ resolveDocument: true,
2997
+ context: context
2998
+ });
2999
+
3000
+ // Edge 14 has a capitalization problem on SVG elements,
3001
+ // see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9282058/
3002
+ var hasTabindex = element.hasAttribute('tabindex');
3003
+ var hasTabIndex = element.hasAttribute('tabIndex');
3004
+
3005
+ if (!hasTabindex && !hasTabIndex) {
3006
+ return false;
3007
+ }
3008
+
3009
+ // older Firefox and Internet Explorer don't support tabindex on SVG elements
3010
+ var isSvgElement = element.ownerSVGElement || element.nodeName.toLowerCase() === 'svg';
3011
+ if (isSvgElement && !supports$1.focusSvgTabindexAttribute) {
3012
+ return false;
3013
+ }
3014
+
3015
+ // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
3016
+ if (supports$1.focusInvalidTabindex) {
3017
+ return true;
3018
+ }
3019
+
3020
+ // an element matches the tabindex selector even if its value is invalid
3021
+ var tabindex = element.getAttribute(hasTabindex ? 'tabindex' : 'tabIndex');
3022
+ // IE11 parses tabindex="" as the value "-32768"
3023
+ // @browser-issue Trident https://connect.microsoft.com/IE/feedback/details/1072965
3024
+ if (tabindex === '-32768') {
3025
+ return false;
3026
+ }
3027
+
3028
+ return Boolean(tabindex && validIntegerPattern.test(tabindex));
3029
+ };
3030
+
3031
+ var _contextToElement = contextToElement.exports;
3032
+
3033
+ var _contextToElement2 = _interopRequireDefault(_contextToElement);
3034
+
3035
+ var _supports2 = supports.exports;
3036
+
3037
+ var _supports3 = _interopRequireDefault(_supports2);
3038
+
3039
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3040
+
3041
+ // determine if an element's tabindex attribute has a valid value
3042
+
3043
+ var supports$1 = void 0;
3044
+
3045
+ // https://www.w3.org/TR/html5/infrastructure.html#rules-for-parsing-integers
3046
+ // NOTE: all browsers agree to allow trailing spaces as well
3047
+ var validIntegerPatternNoTrailing = /^\s*(-|\+)?[0-9]+\s*$/;
3048
+ var validIntegerPatternWithTrailing = /^\s*(-|\+)?[0-9]+.*$/;
3049
+
3050
+ module.exports = exports['default'];
3051
+
3052
+ }(validTabindex, validTabindex.exports));
3053
+
3054
+ (function (module, exports) {
3055
+
3056
+ Object.defineProperty(exports, "__esModule", {
3057
+ value: true
3058
+ });
3059
+
3060
+ exports.default = function (element) {
3061
+ if (!(0, _validTabindex2.default)(element)) {
3062
+ return null;
3063
+ }
3064
+
3065
+ // Edge 14 has a capitalization problem on SVG elements,
3066
+ // see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9282058/
3067
+ var hasTabindex = element.hasAttribute('tabindex');
3068
+ var attributeName = hasTabindex ? 'tabindex' : 'tabIndex';
3069
+
3070
+ // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
3071
+ var tabindex = parseInt(element.getAttribute(attributeName), 10);
3072
+ return isNaN(tabindex) ? -1 : tabindex;
3073
+ };
3074
+
3075
+ var _validTabindex = validTabindex.exports;
3076
+
3077
+ var _validTabindex2 = _interopRequireDefault(_validTabindex);
3078
+
3079
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3080
+
3081
+ module.exports = exports['default'];
3082
+
3083
+ }(tabindexValue, tabindexValue.exports));
3084
+
3085
+ var is_util = {};
3086
+
3087
+ Object.defineProperty(is_util, "__esModule", {
3088
+ value: true
3089
+ });
3090
+ is_util.isUserModifyWritable = isUserModifyWritable;
3091
+ is_util.hasCssOverflowScroll = hasCssOverflowScroll;
3092
+ is_util.hasCssDisplayFlex = hasCssDisplayFlex;
3093
+ is_util.isScrollableContainer = isScrollableContainer;
3094
+
3095
+ // this is a shared utility file for focus-relevant.js and tabbable.js
3096
+ // separate testing of this file's functions is not necessary,
3097
+ // as they're implicitly tested by way of the consumers
3098
+
3099
+ function isUserModifyWritable(style) {
3100
+ // https://www.w3.org/TR/1999/WD-css3-userint-19990916#user-modify
3101
+ // https://github.com/medialize/ally.js/issues/17
3102
+ var userModify = style.webkitUserModify || '';
3103
+ return Boolean(userModify && userModify.indexOf('write') !== -1);
3104
+ }
3105
+
3106
+ function hasCssOverflowScroll(style) {
3107
+ return [style.getPropertyValue('overflow'), style.getPropertyValue('overflow-x'), style.getPropertyValue('overflow-y')].some(function (overflow) {
3108
+ return overflow === 'auto' || overflow === 'scroll';
3109
+ });
3110
+ }
3111
+
3112
+ function hasCssDisplayFlex(style) {
3113
+ return style.display.indexOf('flex') > -1;
3114
+ }
3115
+
3116
+ function isScrollableContainer(element, nodeName, parentNodeName, parentStyle) {
3117
+ if (nodeName !== 'div' && nodeName !== 'span') {
3118
+ // Internet Explorer advances scrollable containers and bodies to focusable
3119
+ // only if the scrollable container is <div> or <span> - this does *not*
3120
+ // happen for <section>, <article>, …
3121
+ return false;
3122
+ }
3123
+
3124
+ if (parentNodeName && parentNodeName !== 'div' && parentNodeName !== 'span' && !hasCssOverflowScroll(parentStyle)) {
3125
+ return false;
3126
+ }
3127
+
3128
+ return element.offsetHeight < element.scrollHeight || element.offsetWidth < element.scrollWidth;
3129
+ }
3130
+
3131
+ (function (module, exports) {
3132
+
3133
+ Object.defineProperty(exports, "__esModule", {
3134
+ value: true
3135
+ });
3136
+
3137
+ var _parents = parents.exports;
3138
+
3139
+ var _parents2 = _interopRequireDefault(_parents);
3140
+
3141
+ var _contextToElement = contextToElement.exports;
3142
+
3143
+ var _contextToElement2 = _interopRequireDefault(_contextToElement);
3144
+
3145
+ var _elementMatches = elementMatches.exports;
3146
+
3147
+ var _elementMatches2 = _interopRequireDefault(_elementMatches);
3148
+
3149
+ var _tabindexValue = tabindexValue.exports;
3150
+
3151
+ var _tabindexValue2 = _interopRequireDefault(_tabindexValue);
3152
+
3153
+ var _validTabindex = validTabindex.exports;
3154
+
3155
+ var _validTabindex2 = _interopRequireDefault(_validTabindex);
3156
+
3157
+ var _is = is_util;
3158
+
3159
+ var _supports2 = supports.exports;
3160
+
3161
+ var _supports3 = _interopRequireDefault(_supports2);
3162
+
3163
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3164
+
3165
+ var supports$1 = void 0;
3166
+ // determine if an element supports.can be focused by script regardless
3167
+ // of the element actually being focusable at the time of execution
3168
+ // i.e. <input disabled> is conisdered focus-relevant, but not focusable
3169
+
3170
+ function isFocusRelevantRules() {
3171
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3172
+ context = _ref.context,
3173
+ _ref$except = _ref.except,
3174
+ except = _ref$except === undefined ? {
3175
+ flexbox: false,
3176
+ scrollable: false,
3177
+ shadow: false
3178
+ } : _ref$except;
3179
+
3180
+ if (!supports$1) {
3181
+ supports$1 = (0, _supports3.default)();
3182
+ }
3183
+
3184
+ var element = (0, _contextToElement2.default)({
3185
+ label: 'is/focus-relevant',
3186
+ resolveDocument: true,
3187
+ context: context
3188
+ });
3189
+
3190
+ if (!except.shadow && element.shadowRoot) {
3191
+ // a ShadowDOM host receives focus when the focus moves to its content
3192
+ return true;
3193
+ }
3194
+
3195
+ var nodeName = element.nodeName.toLowerCase();
3196
+
3197
+ if (nodeName === 'input' && element.type === 'hidden') {
3198
+ // input[type="hidden"] supports.cannot be focused
3199
+ return false;
3200
+ }
3201
+
3202
+ if (nodeName === 'input' || nodeName === 'select' || nodeName === 'button' || nodeName === 'textarea') {
3203
+ return true;
3204
+ }
3205
+
3206
+ if (nodeName === 'legend' && supports$1.focusRedirectLegend) {
3207
+ // specifics filtered in is/focusable
3208
+ return true;
3209
+ }
3210
+
3211
+ if (nodeName === 'label') {
3212
+ // specifics filtered in is/focusable
3213
+ return true;
3214
+ }
3215
+
3216
+ if (nodeName === 'area') {
3217
+ // specifics filtered in is/focusable
3218
+ return true;
3219
+ }
3220
+
3221
+ if (nodeName === 'a' && element.hasAttribute('href')) {
3222
+ return true;
3223
+ }
3224
+
3225
+ if (nodeName === 'object' && element.hasAttribute('usemap')) {
3226
+ // object[usemap] is not focusable in any browser
3227
+ return false;
3228
+ }
3229
+
3230
+ if (nodeName === 'object') {
3231
+ var svgType = element.getAttribute('type');
3232
+ if (!supports$1.focusObjectSvg && svgType === 'image/svg+xml') {
3233
+ // object[type="image/svg+xml"] is not focusable in Internet Explorer
3234
+ return false;
3235
+ } else if (!supports$1.focusObjectSwf && svgType === 'application/x-shockwave-flash') {
3236
+ // object[type="application/x-shockwave-flash"] is not focusable in Internet Explorer 9
3237
+ return false;
3238
+ }
3239
+ }
3240
+
3241
+ if (nodeName === 'iframe' || nodeName === 'object') {
3242
+ // browsing context containers
3243
+ return true;
3244
+ }
3245
+
3246
+ if (nodeName === 'embed' || nodeName === 'keygen') {
3247
+ // embed is considered focus-relevant but not focusable
3248
+ // see https://github.com/medialize/ally.js/issues/82
3249
+ return true;
3250
+ }
3251
+
3252
+ if (element.hasAttribute('contenteditable')) {
3253
+ // also see CSS property user-modify below
3254
+ return true;
3255
+ }
3256
+
3257
+ if (nodeName === 'audio' && (supports$1.focusAudioWithoutControls || element.hasAttribute('controls'))) {
3258
+ return true;
3259
+ }
3260
+
3261
+ if (nodeName === 'video' && (supports$1.focusVideoWithoutControls || element.hasAttribute('controls'))) {
3262
+ return true;
3263
+ }
3264
+
3265
+ if (supports$1.focusSummary && nodeName === 'summary') {
3266
+ return true;
3267
+ }
3268
+
3269
+ var validTabindex = (0, _validTabindex2.default)(element);
3270
+
3271
+ if (nodeName === 'img' && element.hasAttribute('usemap')) {
3272
+ // Gecko, Trident and Edge do not allow an image with an image map and tabindex to be focused,
3273
+ // it appears the tabindex is overruled so focus is still forwarded to the <map>
3274
+ return validTabindex && supports$1.focusImgUsemapTabindex || supports$1.focusRedirectImgUsemap;
3275
+ }
3276
+
3277
+ if (supports$1.focusTable && (nodeName === 'table' || nodeName === 'td')) {
3278
+ // IE10-11 supports.can focus <table> and <td>
3279
+ return true;
3280
+ }
3281
+
3282
+ if (supports$1.focusFieldset && nodeName === 'fieldset') {
3283
+ // IE10-11 supports.can focus <fieldset>
3284
+ return true;
3285
+ }
3286
+
3287
+ var isSvgElement = nodeName === 'svg';
3288
+ var isSvgContent = element.ownerSVGElement;
3289
+ var focusableAttribute = element.getAttribute('focusable');
3290
+ var tabindex = (0, _tabindexValue2.default)(element);
3291
+
3292
+ if (nodeName === 'use' && tabindex !== null && !supports$1.focusSvgUseTabindex) {
3293
+ // <use> cannot be made focusable by adding a tabindex attribute anywhere but Blink and WebKit
3294
+ return false;
3295
+ }
3296
+
3297
+ if (nodeName === 'foreignobject') {
3298
+ // <use> can only be made focusable in Blink and WebKit
3299
+ return tabindex !== null && supports$1.focusSvgForeignobjectTabindex;
3300
+ }
3301
+
3302
+ if ((0, _elementMatches2.default)(element, 'svg a') && element.hasAttribute('xlink:href')) {
3303
+ return true;
3304
+ }
3305
+
3306
+ if ((isSvgElement || isSvgContent) && element.focus && !supports$1.focusSvgNegativeTabindexAttribute && tabindex < 0) {
3307
+ // Firefox 51 and 52 treat any natively tabbable SVG element with
3308
+ // tabindex="-1" as tabbable and everything else as inert
3309
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=1302340
3310
+ return false;
3311
+ }
3312
+
3313
+ if (isSvgElement) {
3314
+ return validTabindex || supports$1.focusSvg || supports$1.focusSvgInIframe
3315
+ // Internet Explorer understands the focusable attribute introduced in SVG Tiny 1.2
3316
+ || Boolean(supports$1.focusSvgFocusableAttribute && focusableAttribute && focusableAttribute === 'true');
3317
+ }
3318
+
3319
+ if (isSvgContent) {
3320
+ if (supports$1.focusSvgTabindexAttribute && validTabindex) {
3321
+ return true;
3322
+ }
3323
+
3324
+ if (supports$1.focusSvgFocusableAttribute) {
3325
+ // Internet Explorer understands the focusable attribute introduced in SVG Tiny 1.2
3326
+ return focusableAttribute === 'true';
3327
+ }
3328
+ }
3329
+
3330
+ // https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute
3331
+ if (validTabindex) {
3332
+ return true;
3333
+ }
3334
+
3335
+ var style = window.getComputedStyle(element, null);
3336
+ if ((0, _is.isUserModifyWritable)(style)) {
3337
+ return true;
3338
+ }
3339
+
3340
+ if (supports$1.focusImgIsmap && nodeName === 'img' && element.hasAttribute('ismap')) {
3341
+ // IE10-11 considers the <img> in <a href><img ismap> focusable
3342
+ // https://github.com/medialize/ally.js/issues/20
3343
+ var hasLinkParent = (0, _parents2.default)({ context: element }).some(function (parent) {
3344
+ return parent.nodeName.toLowerCase() === 'a' && parent.hasAttribute('href');
3345
+ });
3346
+
3347
+ if (hasLinkParent) {
3348
+ return true;
3349
+ }
3350
+ }
3351
+
3352
+ // https://github.com/medialize/ally.js/issues/21
3353
+ if (!except.scrollable && supports$1.focusScrollContainer) {
3354
+ if (supports$1.focusScrollContainerWithoutOverflow) {
3355
+ // Internet Explorer does will consider the scrollable area focusable
3356
+ // if the element is a <div> or a <span> and it is in fact scrollable,
3357
+ // regardless of the CSS overflow property
3358
+ if ((0, _is.isScrollableContainer)(element, nodeName)) {
3359
+ return true;
3360
+ }
3361
+ } else if ((0, _is.hasCssOverflowScroll)(style)) {
3362
+ // Firefox requires proper overflow setting, IE does not necessarily
3363
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
3364
+ return true;
3365
+ }
3366
+ }
3367
+
3368
+ if (!except.flexbox && supports$1.focusFlexboxContainer && (0, _is.hasCssDisplayFlex)(style)) {
3369
+ // elements with display:flex are focusable in IE10-11
3370
+ return true;
3371
+ }
3372
+
3373
+ var parent = element.parentElement;
3374
+ if (!except.scrollable && parent) {
3375
+ var parentNodeName = parent.nodeName.toLowerCase();
3376
+ var parentStyle = window.getComputedStyle(parent, null);
3377
+ if (supports$1.focusScrollBody && (0, _is.isScrollableContainer)(parent, nodeName, parentNodeName, parentStyle)) {
3378
+ // scrollable bodies are focusable Internet Explorer
3379
+ // https://github.com/medialize/ally.js/issues/21
3380
+ return true;
3381
+ }
3382
+
3383
+ // Children of focusable elements with display:flex are focusable in IE10-11
3384
+ if (supports$1.focusChildrenOfFocusableFlexbox) {
3385
+ if ((0, _is.hasCssDisplayFlex)(parentStyle)) {
3386
+ return true;
3387
+ }
3388
+ }
3389
+ }
3390
+
3391
+ // NOTE: elements marked as inert are not focusable,
3392
+ // but that property is not exposed to the DOM
3393
+ // https://www.w3.org/TR/html5/editing.html#inert
3394
+
3395
+ return false;
3396
+ }
3397
+
3398
+ // bind exceptions to an iterator callback
3399
+ isFocusRelevantRules.except = function () {
3400
+ var except = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3401
+
3402
+ var isFocusRelevant = function isFocusRelevant(context) {
3403
+ return isFocusRelevantRules({
3404
+ context: context,
3405
+ except: except
3406
+ });
3407
+ };
3408
+
3409
+ isFocusRelevant.rules = isFocusRelevantRules;
3410
+ return isFocusRelevant;
3411
+ };
3412
+
3413
+ // provide isFocusRelevant(context) as default iterator callback
3414
+ var isFocusRelevant = isFocusRelevantRules.except({});
3415
+ exports.default = isFocusRelevant;
3416
+ module.exports = exports['default'];
3417
+
3418
+ }(focusRelevant, focusRelevant.exports));
3419
+
3420
+ var validArea = {exports: {}};
3421
+
3422
+ var visible = {exports: {}};
3423
+
3424
+ var arrayFindIndex = {exports: {}};
3425
+
3426
+ (function (module, exports) {
3427
+
3428
+ Object.defineProperty(exports, "__esModule", {
3429
+ value: true
3430
+ });
3431
+ exports.default = findIndex;
3432
+ function findIndex(array, callback) {
3433
+ // attempt to use native or polyfilled Array#findIndex first
3434
+ if (array.findIndex) {
3435
+ return array.findIndex(callback);
3436
+ }
3437
+
3438
+ var length = array.length;
3439
+
3440
+ // shortcut if the array is empty
3441
+ if (length === 0) {
3442
+ return -1;
3443
+ }
3444
+
3445
+ // otherwise loop over array
3446
+ for (var i = 0; i < length; i++) {
3447
+ if (callback(array[i], i, array)) {
3448
+ return i;
3449
+ }
3450
+ }
3451
+
3452
+ return -1;
3453
+ }
3454
+ module.exports = exports["default"];
3455
+
3456
+ }(arrayFindIndex, arrayFindIndex.exports));
3457
+
3458
+ var getFrameElement = {exports: {}};
3459
+
3460
+ var getContentDocument = {exports: {}};
3461
+
3462
+ (function (module, exports) {
3463
+
3464
+ Object.defineProperty(exports, "__esModule", {
3465
+ value: true
3466
+ });
3467
+
3468
+ exports.default = function (node) {
3469
+ try {
3470
+ // works on <object> and <iframe>
3471
+ return node.contentDocument
3472
+ // works on <object> and <iframe>
3473
+ || node.contentWindow && node.contentWindow.document
3474
+ // works on <object> and <iframe> that contain SVG
3475
+ || node.getSVGDocument && node.getSVGDocument() || null;
3476
+ } catch (e) {
3477
+ // SecurityError: Failed to read the 'contentDocument' property from 'HTMLObjectElement'
3478
+ // also IE may throw member not found exception e.g. on <object type="image/png">
3479
+ return null;
3480
+ }
3481
+ };
3482
+
3483
+ module.exports = exports["default"];
3484
+
3485
+ }(getContentDocument, getContentDocument.exports));
3486
+
3487
+ var getWindow = {exports: {}};
3488
+
3489
+ var getDocument = {exports: {}};
3490
+
3491
+ (function (module, exports) {
3492
+
3493
+ Object.defineProperty(exports, "__esModule", {
3494
+ value: true
3495
+ });
3496
+
3497
+ exports.default = function (node) {
3498
+ if (!node) {
3499
+ return document;
3500
+ }
3501
+
3502
+ if (node.nodeType === Node.DOCUMENT_NODE) {
3503
+ return node;
3504
+ }
3505
+
3506
+ return node.ownerDocument || document;
3507
+ };
3508
+
3509
+ module.exports = exports["default"];
3510
+
3511
+ }(getDocument, getDocument.exports));
3512
+
3513
+ (function (module, exports) {
3514
+
3515
+ Object.defineProperty(exports, "__esModule", {
3516
+ value: true
3517
+ });
3518
+
3519
+ exports.default = function (node) {
3520
+ var _document = (0, _getDocument2.default)(node);
3521
+ return _document.defaultView || window;
3522
+ };
3523
+
3524
+ var _getDocument = getDocument.exports;
3525
+
3526
+ var _getDocument2 = _interopRequireDefault(_getDocument);
3527
+
3528
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3529
+
3530
+ module.exports = exports['default'];
3531
+
3532
+ }(getWindow, getWindow.exports));
3533
+
3534
+ var selectInShadows = {exports: {}};
3535
+
3536
+ (function (module, exports) {
3537
+
3538
+ Object.defineProperty(exports, "__esModule", {
3539
+ value: true
3540
+ });
3541
+
3542
+ exports.default = function (selector) {
3543
+ if (typeof shadowPrefix !== 'string') {
3544
+ var operator = (0, _cssShadowPiercingDeepCombinator2.default)();
3545
+ if (operator) {
3546
+ shadowPrefix = ', html ' + operator + ' ';
3547
+ }
3548
+ }
3549
+
3550
+ if (!shadowPrefix) {
3551
+ return selector;
3552
+ }
3553
+
3554
+ return selector + shadowPrefix + selector.replace(/\s*,\s*/g, ',').split(',').join(shadowPrefix);
3555
+ };
3556
+
3557
+ var _cssShadowPiercingDeepCombinator = cssShadowPiercingDeepCombinator.exports;
3558
+
3559
+ var _cssShadowPiercingDeepCombinator2 = _interopRequireDefault(_cssShadowPiercingDeepCombinator);
3560
+
3561
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3562
+
3563
+ var shadowPrefix = void 0;
3564
+ // convert a CSS selector so that it also pierces ShadowDOM
3565
+ // takes ".a, #b" and turns it into ".a, #b, html >>> .a, html >>> #b"
3566
+
3567
+ module.exports = exports['default'];
3568
+
3569
+ }(selectInShadows, selectInShadows.exports));
3570
+
3571
+ (function (module, exports) {
3572
+
3573
+ Object.defineProperty(exports, "__esModule", {
3574
+ value: true
3575
+ });
3576
+ exports.default = getFrameElement;
3577
+
3578
+ var _getContentDocument = getContentDocument.exports;
3579
+
3580
+ var _getContentDocument2 = _interopRequireDefault(_getContentDocument);
3581
+
3582
+ var _getWindow = getWindow.exports;
3583
+
3584
+ var _getWindow2 = _interopRequireDefault(_getWindow);
3585
+
3586
+ var _selectInShadows = selectInShadows.exports;
3587
+
3588
+ var _selectInShadows2 = _interopRequireDefault(_selectInShadows);
3589
+
3590
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3591
+
3592
+ var selector = void 0;
3593
+
3594
+ function findDocumentHostElement(_window) {
3595
+ if (!selector) {
3596
+ selector = (0, _selectInShadows2.default)('object, iframe');
3597
+ }
3598
+
3599
+ if (_window._frameElement !== undefined) {
3600
+ return _window._frameElement;
3601
+ }
3602
+
3603
+ _window._frameElement = null;
3604
+
3605
+ var potentialHosts = _window.parent.document.querySelectorAll(selector);
3606
+ [].some.call(potentialHosts, function (element) {
3607
+ var _document = (0, _getContentDocument2.default)(element);
3608
+ if (_document !== _window.document) {
3609
+ return false;
3610
+ }
3611
+
3612
+ _window._frameElement = element;
3613
+ return true;
3614
+ });
3615
+
3616
+ return _window._frameElement;
3617
+ }
3618
+
3619
+ function getFrameElement(element) {
3620
+ var _window = (0, _getWindow2.default)(element);
3621
+ if (!_window.parent || _window.parent === _window) {
3622
+ // if there is no parent browsing context,
3623
+ // we're not going to get a frameElement either way
3624
+ return null;
3625
+ }
3626
+
3627
+ try {
3628
+ // see https://developer.mozilla.org/en-US/docs/Web/API/Window/frameElement
3629
+ // does not work within <embed> anywhere, and not within in <object> in IE
3630
+ return _window.frameElement || findDocumentHostElement(_window);
3631
+ } catch (e) {
3632
+ return null;
3633
+ }
3634
+ }
3635
+ module.exports = exports['default'];
3636
+
3637
+ }(getFrameElement, getFrameElement.exports));
3638
+
3639
+ (function (module, exports) {
3640
+
3641
+ Object.defineProperty(exports, "__esModule", {
3642
+ value: true
3643
+ });
3644
+
3645
+ var _arrayFindIndex = arrayFindIndex.exports;
3646
+
3647
+ var _arrayFindIndex2 = _interopRequireDefault(_arrayFindIndex);
3648
+
3649
+ var _parents = parents.exports;
3650
+
3651
+ var _parents2 = _interopRequireDefault(_parents);
3652
+
3653
+ var _contextToElement = contextToElement.exports;
3654
+
3655
+ var _contextToElement2 = _interopRequireDefault(_contextToElement);
3656
+
3657
+ var _getFrameElement = getFrameElement.exports;
3658
+
3659
+ var _getFrameElement2 = _interopRequireDefault(_getFrameElement);
3660
+
3661
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3662
+
3663
+ // https://www.w3.org/TR/html5/rendering.html#being-rendered
3664
+ // <area> is not rendered, but we *consider* it visible to simplfiy this function's usage
3665
+
3666
+ // determine if an element is rendered
3667
+ // NOTE: that does not mean an element is visible in the viewport, see util/visible-area
3668
+
3669
+ var notRenderedElementsPattern = /^(area)$/;
3670
+
3671
+ function computedStyle(element, property) {
3672
+ return window.getComputedStyle(element, null).getPropertyValue(property);
3673
+ }
3674
+
3675
+ function notDisplayed(_path) {
3676
+ return _path.some(function (element) {
3677
+ // display:none is not visible (optimized away at layout)
3678
+ return computedStyle(element, 'display') === 'none';
3679
+ });
3680
+ }
3681
+
3682
+ function notVisible(_path) {
3683
+ // https://github.com/jquery/jquery-ui/blob/master/ui/core.js#L109-L114
3684
+ // NOTE: a nested element can reverse visibility:hidden|collapse by explicitly setting visibility:visible
3685
+ // NOTE: visibility can be ["", "visible", "hidden", "collapse"]
3686
+ var hidden = (0, _arrayFindIndex2.default)(_path, function (element) {
3687
+ var visibility = computedStyle(element, 'visibility');
3688
+ return visibility === 'hidden' || visibility === 'collapse';
3689
+ });
3690
+
3691
+ if (hidden === -1) {
3692
+ // there is no hidden element
3693
+ return false;
3694
+ }
3695
+
3696
+ var visible = (0, _arrayFindIndex2.default)(_path, function (element) {
3697
+ return computedStyle(element, 'visibility') === 'visible';
3698
+ });
3699
+
3700
+ if (visible === -1) {
3701
+ // there is no visible element (but a hidden element)
3702
+ return true;
3703
+ }
3704
+
3705
+ if (hidden < visible) {
3706
+ // there is a hidden element and it's closer than the first visible element
3707
+ return true;
3708
+ }
3709
+
3710
+ // there may be a hidden element, but the closest element is visible
3711
+ return false;
3712
+ }
3713
+
3714
+ function collapsedParent(_path) {
3715
+ var offset = 1;
3716
+ if (_path[0].nodeName.toLowerCase() === 'summary') {
3717
+ offset = 2;
3718
+ }
3719
+
3720
+ return _path.slice(offset).some(function (element) {
3721
+ // "content children" of a closed details element are not visible
3722
+ return element.nodeName.toLowerCase() === 'details' && element.open === false;
3723
+ });
3724
+ }
3725
+
3726
+ function isVisibleRules() {
3727
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3728
+ context = _ref.context,
3729
+ _ref$except = _ref.except,
3730
+ except = _ref$except === undefined ? {
3731
+ notRendered: false,
3732
+ cssDisplay: false,
3733
+ cssVisibility: false,
3734
+ detailsElement: false,
3735
+ browsingContext: false
3736
+ } : _ref$except;
3737
+
3738
+ var element = (0, _contextToElement2.default)({
3739
+ label: 'is/visible',
3740
+ resolveDocument: true,
3741
+ context: context
3742
+ });
3743
+
3744
+ var nodeName = element.nodeName.toLowerCase();
3745
+ if (!except.notRendered && notRenderedElementsPattern.test(nodeName)) {
3746
+ return true;
3747
+ }
3748
+
3749
+ var _path = (0, _parents2.default)({ context: element });
3750
+
3751
+ // in Internet Explorer <audio> has a default display: none, where others have display: inline
3752
+ // but IE allows focusing <audio style="display:none">, but not <div display:none><audio>
3753
+ // this is irrelevant to other browsers, as the controls attribute is required to make <audio> focusable
3754
+ var isAudioWithoutControls = nodeName === 'audio' && !element.hasAttribute('controls');
3755
+ if (!except.cssDisplay && notDisplayed(isAudioWithoutControls ? _path.slice(1) : _path)) {
3756
+ return false;
3757
+ }
3758
+
3759
+ if (!except.cssVisibility && notVisible(_path)) {
3760
+ return false;
3761
+ }
3762
+
3763
+ if (!except.detailsElement && collapsedParent(_path)) {
3764
+ return false;
3765
+ }
3766
+
3767
+ if (!except.browsingContext) {
3768
+ // elements within a browsing context are affected by the
3769
+ // browsing context host element's visibility and tabindex
3770
+ var frameElement = (0, _getFrameElement2.default)(element);
3771
+ var _isVisible = isVisibleRules.except(except);
3772
+ if (frameElement && !_isVisible(frameElement)) {
3773
+ return false;
3774
+ }
3775
+ }
3776
+
3777
+ return true;
3778
+ }
3779
+
3780
+ // bind exceptions to an iterator callback
3781
+ isVisibleRules.except = function () {
3782
+ var except = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3783
+
3784
+ var isVisible = function isVisible(context) {
3785
+ return isVisibleRules({
3786
+ context: context,
3787
+ except: except
3788
+ });
3789
+ };
3790
+
3791
+ isVisible.rules = isVisibleRules;
3792
+ return isVisible;
3793
+ };
3794
+
3795
+ // provide isVisible(context) as default iterator callback
3796
+ var isVisible = isVisibleRules.except({});
3797
+ exports.default = isVisible;
3798
+ module.exports = exports['default'];
3799
+
3800
+ }(visible, visible.exports));
3801
+
3802
+ var imageMap = {};
3803
+
3804
+ var css_escape = {exports: {}};
3805
+
3806
+ /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
3807
+
3808
+ (function (module, exports) {
3809
+ (function(root, factory) {
3810
+ // https://github.com/umdjs/umd/blob/master/returnExports.js
3811
+ {
3812
+ // For Node.js.
3813
+ module.exports = factory(root);
3814
+ }
3815
+ }(typeof commonjsGlobal != 'undefined' ? commonjsGlobal : commonjsGlobal, function(root) {
3816
+
3817
+ if (root.CSS && root.CSS.escape) {
3818
+ return root.CSS.escape;
3819
+ }
3820
+
3821
+ // https://drafts.csswg.org/cssom/#serialize-an-identifier
3822
+ var cssEscape = function(value) {
3823
+ if (arguments.length == 0) {
3824
+ throw new TypeError('`CSS.escape` requires an argument.');
3825
+ }
3826
+ var string = String(value);
3827
+ var length = string.length;
3828
+ var index = -1;
3829
+ var codeUnit;
3830
+ var result = '';
3831
+ var firstCodeUnit = string.charCodeAt(0);
3832
+ while (++index < length) {
3833
+ codeUnit = string.charCodeAt(index);
3834
+ // Note: there’s no need to special-case astral symbols, surrogate
3835
+ // pairs, or lone surrogates.
3836
+
3837
+ // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
3838
+ // (U+FFFD).
3839
+ if (codeUnit == 0x0000) {
3840
+ result += '\uFFFD';
3841
+ continue;
3842
+ }
3843
+
3844
+ if (
3845
+ // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
3846
+ // U+007F, […]
3847
+ (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
3848
+ // If the character is the first character and is in the range [0-9]
3849
+ // (U+0030 to U+0039), […]
3850
+ (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
3851
+ // If the character is the second character and is in the range [0-9]
3852
+ // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
3853
+ (
3854
+ index == 1 &&
3855
+ codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
3856
+ firstCodeUnit == 0x002D
3857
+ )
3858
+ ) {
3859
+ // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
3860
+ result += '\\' + codeUnit.toString(16) + ' ';
3861
+ continue;
3862
+ }
3863
+
3864
+ if (
3865
+ // If the character is the first character and is a `-` (U+002D), and
3866
+ // there is no second character, […]
3867
+ index == 0 &&
3868
+ length == 1 &&
3869
+ codeUnit == 0x002D
3870
+ ) {
3871
+ result += '\\' + string.charAt(index);
3872
+ continue;
3873
+ }
3874
+
3875
+ // If the character is not handled by one of the above rules and is
3876
+ // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
3877
+ // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
3878
+ // U+005A), or [a-z] (U+0061 to U+007A), […]
3879
+ if (
3880
+ codeUnit >= 0x0080 ||
3881
+ codeUnit == 0x002D ||
3882
+ codeUnit == 0x005F ||
3883
+ codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
3884
+ codeUnit >= 0x0041 && codeUnit <= 0x005A ||
3885
+ codeUnit >= 0x0061 && codeUnit <= 0x007A
3886
+ ) {
3887
+ // the character itself
3888
+ result += string.charAt(index);
3889
+ continue;
3890
+ }
3891
+
3892
+ // Otherwise, the escaped character.
3893
+ // https://drafts.csswg.org/cssom/#escape-a-character
3894
+ result += '\\' + string.charAt(index);
3895
+
3896
+ }
3897
+ return result;
3898
+ };
3899
+
3900
+ if (!root.CSS) {
3901
+ root.CSS = {};
3902
+ }
3903
+
3904
+ root.CSS.escape = cssEscape;
3905
+ return cssEscape;
3906
+
3907
+ }));
3908
+ }(css_escape));
3909
+
3910
+ Object.defineProperty(imageMap, "__esModule", {
3911
+ value: true
3912
+ });
3913
+ imageMap.getMapByName = getMapByName;
3914
+ imageMap.getMapOfImage = getMapOfImage;
3915
+ imageMap.getImageOfArea = getImageOfArea;
3916
+
3917
+ var _css = css_escape.exports;
3918
+
3919
+ var _css2 = _interopRequireDefault(_css);
3920
+
3921
+ var _getDocument = getDocument.exports;
3922
+
3923
+ var _getDocument2 = _interopRequireDefault(_getDocument);
3924
+
3925
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3926
+
3927
+ function getMapByName(name, _document) {
3928
+ // apparently getElementsByName() also considers id attribute in IE & opera
3929
+ // https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
3930
+ var map = _document.querySelector('map[name="' + (0, _css2.default)(name) + '"]');
3931
+ return map || null;
3932
+ }
3933
+
3934
+ function getMapOfImage(element) {
3935
+ var usemap = element.getAttribute('usemap');
3936
+ if (!usemap) {
3937
+ return null;
3938
+ }
3939
+
3940
+ var _document = (0, _getDocument2.default)(element);
3941
+ return getMapByName(usemap.slice(1), _document);
3942
+ }
3943
+
3944
+ function getImageOfArea(element) {
3945
+ var map = element.parentElement;
3946
+
3947
+ if (!map.name || map.nodeName.toLowerCase() !== 'map') {
3948
+ return null;
3949
+ }
3950
+
3951
+ // NOTE: image maps can also be applied to <object> with image content,
3952
+ // but no browser supports this at the moment
3953
+
3954
+ // HTML5 specifies HTMLMapElement.images to be an HTMLCollection of all
3955
+ // <img> and <object> referencing the <map> element, but no browser implements this
3956
+ // https://www.w3.org/TR/html5/embedded-content-0.html#the-map-element
3957
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLMapElement
3958
+ // the image must be valid and loaded for the map to take effect
3959
+ var _document = (0, _getDocument2.default)(element);
3960
+ return _document.querySelector('img[usemap="#' + (0, _css2.default)(map.name) + '"]') || null;
3961
+ }
3962
+
3963
+ (function (module, exports) {
3964
+
3965
+ Object.defineProperty(exports, "__esModule", {
3966
+ value: true
3967
+ });
3968
+
3969
+ exports.default = function (context) {
3970
+ if (!supports$1) {
3971
+ supports$1 = (0, _supports3.default)();
3972
+ }
3973
+
3974
+ var element = (0, _contextToElement2.default)({
3975
+ label: 'is/valid-area',
3976
+ context: context
3977
+ });
3978
+
3979
+ var nodeName = element.nodeName.toLowerCase();
3980
+ if (nodeName !== 'area') {
3981
+ return false;
3982
+ }
3983
+
3984
+ var hasTabindex = element.hasAttribute('tabindex');
3985
+ if (!supports$1.focusAreaTabindex && hasTabindex) {
3986
+ // Blink and WebKit do not consider <area tabindex="-1" href="#void"> focusable
3987
+ return false;
3988
+ }
3989
+
3990
+ var img = (0, _imageMap.getImageOfArea)(element);
3991
+ if (!img || !(0, _visible2.default)(img)) {
3992
+ return false;
3993
+ }
3994
+
3995
+ // Firefox only allows fully loaded images to reference image maps
3996
+ // https://stereochro.me/ideas/detecting-broken-images-js
3997
+ if (!supports$1.focusBrokenImageMap && (!img.complete || !img.naturalHeight || img.offsetWidth <= 0 || img.offsetHeight <= 0)) {
3998
+ return false;
3999
+ }
4000
+
4001
+ // Firefox supports.can focus area elements even if they don't have an href attribute
4002
+ if (!supports$1.focusAreaWithoutHref && !element.href) {
4003
+ // Internet explorer supports.can focus area elements without href if either
4004
+ // the area element or the image element has a tabindex attribute
4005
+ return supports$1.focusAreaTabindex && hasTabindex || supports$1.focusAreaImgTabindex && img.hasAttribute('tabindex');
4006
+ }
4007
+
4008
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
4009
+ var childOfInteractive = (0, _parents2.default)({ context: img }).slice(1).some(function (_element) {
4010
+ var name = _element.nodeName.toLowerCase();
4011
+ return name === 'button' || name === 'a';
4012
+ });
4013
+
4014
+ if (childOfInteractive) {
4015
+ return false;
4016
+ }
4017
+
4018
+ return true;
4019
+ };
4020
+
4021
+ var _contextToElement = contextToElement.exports;
4022
+
4023
+ var _contextToElement2 = _interopRequireDefault(_contextToElement);
4024
+
4025
+ var _visible = visible.exports;
4026
+
4027
+ var _visible2 = _interopRequireDefault(_visible);
4028
+
4029
+ var _parents = parents.exports;
4030
+
4031
+ var _parents2 = _interopRequireDefault(_parents);
4032
+
4033
+ var _imageMap = imageMap;
4034
+
4035
+ var _supports2 = supports.exports;
4036
+
4037
+ var _supports3 = _interopRequireDefault(_supports2);
4038
+
4039
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4040
+
4041
+ var supports$1 = void 0;
4042
+
4043
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map
4044
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
4045
+ // https://github.com/jquery/jquery-ui/blob/master/ui/core.js#L88-L107
4046
+
4047
+ // determine if an <area> element is being properly used by and <img> via a <map>
4048
+
4049
+ module.exports = exports['default'];
4050
+
4051
+ }(validArea, validArea.exports));
4052
+
4053
+ var disabled = {exports: {}};
4054
+
4055
+ var nativeDisabledSupported = {exports: {}};
4056
+
4057
+ (function (module, exports) {
4058
+
4059
+ Object.defineProperty(exports, "__esModule", {
4060
+ value: true
4061
+ });
4062
+
4063
+ exports.default = function (context) {
4064
+ if (!supports$1) {
4065
+ supports$1 = (0, _supports3.default)();
4066
+
4067
+ if (supports$1.focusFieldsetDisabled) {
4068
+ delete disabledElements.fieldset;
4069
+ }
4070
+
4071
+ if (supports$1.focusFormDisabled) {
4072
+ delete disabledElements.form;
4073
+ }
4074
+
4075
+ disabledElementsPattern = new RegExp('^(' + Object.keys(disabledElements).join('|') + ')$');
4076
+ }
4077
+
4078
+ var element = (0, _contextToElement2.default)({
4079
+ label: 'is/native-disabled-supported',
4080
+ context: context
4081
+ });
4082
+
4083
+ var nodeName = element.nodeName.toLowerCase();
4084
+ return Boolean(disabledElementsPattern.test(nodeName));
4085
+ };
4086
+
4087
+ var _contextToElement = contextToElement.exports;
4088
+
4089
+ var _contextToElement2 = _interopRequireDefault(_contextToElement);
4090
+
4091
+ var _supports2 = supports.exports;
4092
+
4093
+ var _supports3 = _interopRequireDefault(_supports2);
4094
+
4095
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4096
+
4097
+ // Determine if an element supports the disabled attribute
4098
+
4099
+ var supports$1 = void 0;
4100
+
4101
+ // https://www.w3.org/TR/html5/disabled-elements.html#concept-element-disabled
4102
+ var disabledElementsPattern = void 0;
4103
+ var disabledElements = {
4104
+ input: true,
4105
+ select: true,
4106
+ textarea: true,
4107
+ button: true,
4108
+ fieldset: true,
4109
+ form: true
4110
+ };
4111
+
4112
+ module.exports = exports['default'];
4113
+
4114
+ }(nativeDisabledSupported, nativeDisabledSupported.exports));
4115
+
4116
+ (function (module, exports) {
4117
+
4118
+ Object.defineProperty(exports, "__esModule", {
4119
+ value: true
4120
+ });
4121
+
4122
+ exports.default = function (context) {
4123
+ if (!supports$1) {
4124
+ supports$1 = (0, _supports3.default)();
4125
+ }
4126
+
4127
+ var element = (0, _contextToElement2.default)({
4128
+ label: 'is/disabled',
4129
+ context: context
4130
+ });
4131
+
4132
+ if (element.hasAttribute('data-ally-disabled')) {
4133
+ // treat ally's element/disabled like the DOM native element.disabled
4134
+ return true;
4135
+ }
4136
+
4137
+ if (!(0, _nativeDisabledSupported2.default)(element)) {
4138
+ // non-form elements do not support the disabled attribute
4139
+ return false;
4140
+ }
4141
+
4142
+ if (element.disabled) {
4143
+ // the element itself is disabled
4144
+ return true;
4145
+ }
4146
+
4147
+ var parents = (0, _parents2.default)({ context: element });
4148
+ if (parents.some(isDisabledFieldset)) {
4149
+ // a parental <fieldset> is disabld and inherits the state onto this element
4150
+ return true;
4151
+ }
4152
+
4153
+ if (!supports$1.focusFormDisabled && parents.some(isDisabledForm)) {
4154
+ // a parental <form> is disabld and inherits the state onto this element
4155
+ return true;
4156
+ }
4157
+
4158
+ return false;
4159
+ };
4160
+
4161
+ var _contextToElement = contextToElement.exports;
4162
+
4163
+ var _contextToElement2 = _interopRequireDefault(_contextToElement);
4164
+
4165
+ var _parents = parents.exports;
4166
+
4167
+ var _parents2 = _interopRequireDefault(_parents);
4168
+
4169
+ var _nativeDisabledSupported = nativeDisabledSupported.exports;
4170
+
4171
+ var _nativeDisabledSupported2 = _interopRequireDefault(_nativeDisabledSupported);
4172
+
4173
+ var _supports2 = supports.exports;
4174
+
4175
+ var _supports3 = _interopRequireDefault(_supports2);
4176
+
4177
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4178
+
4179
+ // Determine if an element is disabled (i.e. not editable)
4180
+
4181
+ var supports$1 = void 0;
4182
+
4183
+ function isDisabledFieldset(element) {
4184
+ var nodeName = element.nodeName.toLowerCase();
4185
+ return nodeName === 'fieldset' && element.disabled;
4186
+ }
4187
+
4188
+ function isDisabledForm(element) {
4189
+ var nodeName = element.nodeName.toLowerCase();
4190
+ return nodeName === 'form' && element.disabled;
4191
+ }
4192
+
4193
+ module.exports = exports['default'];
4194
+
4195
+ }(disabled, disabled.exports));
4196
+
4197
+ var onlyTabbable = {exports: {}};
4198
+
4199
+ (function (module, exports) {
4200
+
4201
+ Object.defineProperty(exports, "__esModule", {
4202
+ value: true
4203
+ });
4204
+
4205
+ var _visible = visible.exports;
4206
+
4207
+ var _visible2 = _interopRequireDefault(_visible);
4208
+
4209
+ var _contextToElement = contextToElement.exports;
4210
+
4211
+ var _contextToElement2 = _interopRequireDefault(_contextToElement);
4212
+
4213
+ var _getFrameElement = getFrameElement.exports;
4214
+
4215
+ var _getFrameElement2 = _interopRequireDefault(_getFrameElement);
4216
+
4217
+ var _tabindexValue = tabindexValue.exports;
4218
+
4219
+ var _tabindexValue2 = _interopRequireDefault(_tabindexValue);
4220
+
4221
+ var _platform = platform$1.exports;
4222
+
4223
+ var _platform2 = _interopRequireDefault(_platform);
4224
+
4225
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4226
+
4227
+ function isOnlyTabbableRules() {
4228
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4229
+ context = _ref.context,
4230
+ _ref$except = _ref.except,
4231
+ except = _ref$except === undefined ? {
4232
+ onlyFocusableBrowsingContext: false,
4233
+ visible: false
4234
+ } : _ref$except;
4235
+
4236
+ var element = (0, _contextToElement2.default)({
4237
+ label: 'is/only-tabbable',
4238
+ resolveDocument: true,
4239
+ context: context
4240
+ });
4241
+
4242
+ if (!except.visible && !(0, _visible2.default)(element)) {
4243
+ return false;
4244
+ }
4245
+
4246
+ if (!except.onlyFocusableBrowsingContext && (_platform2.default.is.GECKO || _platform2.default.is.TRIDENT || _platform2.default.is.EDGE)) {
4247
+ var frameElement = (0, _getFrameElement2.default)(element);
4248
+ if (frameElement) {
4249
+ if ((0, _tabindexValue2.default)(frameElement) < 0) {
4250
+ // iframe[tabindex="-1"] and object[tabindex="-1"] inherit the
4251
+ // tabbable demotion onto elements of their browsing contexts
4252
+ return false;
4253
+ }
4254
+ }
4255
+ }
4256
+
4257
+ var nodeName = element.nodeName.toLowerCase();
4258
+ var tabindex = (0, _tabindexValue2.default)(element);
4259
+
4260
+ if (nodeName === 'label' && _platform2.default.is.GECKO) {
4261
+ // Firefox cannot focus, but tab to: label[tabindex=0]
4262
+ return tabindex !== null && tabindex >= 0;
4263
+ }
4264
+
4265
+ // SVG Elements were keyboard focusable but not script focusable before Firefox 51.
4266
+ // Firefox 51 added the focus management DOM API (.focus and .blur) to SVGElement,
4267
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=778654
4268
+ if (_platform2.default.is.GECKO && element.ownerSVGElement && !element.focus) {
4269
+ if (nodeName === 'a' && element.hasAttribute('xlink:href')) {
4270
+ // any focusable child of <svg> cannot be focused, but tabbed to
4271
+ if (_platform2.default.is.GECKO) {
4272
+ return true;
4273
+ }
4274
+ }
4275
+ }
4276
+
4277
+ return false;
4278
+ }
4279
+
4280
+ // bind exceptions to an iterator callback
4281
+ isOnlyTabbableRules.except = function () {
4282
+ var except = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4283
+
4284
+ var isOnlyTabbable = function isOnlyTabbable(context) {
4285
+ return isOnlyTabbableRules({
4286
+ context: context,
4287
+ except: except
4288
+ });
4289
+ };
4290
+
4291
+ isOnlyTabbable.rules = isOnlyTabbableRules;
4292
+ return isOnlyTabbable;
4293
+ };
4294
+
4295
+ // provide isOnlyTabbable(context) as default iterator callback
4296
+ var isOnlyTabbable = isOnlyTabbableRules.except({});
4297
+ exports.default = isOnlyTabbable;
4298
+ module.exports = exports['default'];
4299
+
4300
+ }(onlyTabbable, onlyTabbable.exports));
4301
+
4302
+ (function (module, exports) {
4303
+
4304
+ Object.defineProperty(exports, "__esModule", {
4305
+ value: true
4306
+ });
4307
+
4308
+ var _focusRelevant = focusRelevant.exports;
4309
+
4310
+ var _focusRelevant2 = _interopRequireDefault(_focusRelevant);
4311
+
4312
+ var _validArea = validArea.exports;
4313
+
4314
+ var _validArea2 = _interopRequireDefault(_validArea);
4315
+
4316
+ var _visible = visible.exports;
4317
+
4318
+ var _visible2 = _interopRequireDefault(_visible);
4319
+
4320
+ var _disabled = disabled.exports;
4321
+
4322
+ var _disabled2 = _interopRequireDefault(_disabled);
4323
+
4324
+ var _onlyTabbable = onlyTabbable.exports;
4325
+
4326
+ var _onlyTabbable2 = _interopRequireDefault(_onlyTabbable);
4327
+
4328
+ var _contextToElement = contextToElement.exports;
4329
+
4330
+ var _contextToElement2 = _interopRequireDefault(_contextToElement);
4331
+
4332
+ var _getFrameElement = getFrameElement.exports;
4333
+
4334
+ var _getFrameElement2 = _interopRequireDefault(_getFrameElement);
4335
+
4336
+ var _tabindexValue = tabindexValue.exports;
4337
+
4338
+ var _tabindexValue2 = _interopRequireDefault(_tabindexValue);
4339
+
4340
+ var _supports2 = supports.exports;
4341
+
4342
+ var _supports3 = _interopRequireDefault(_supports2);
4343
+
4344
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4345
+
4346
+ var supports$1 = void 0;
4347
+ // determine if an element can be focused
4348
+
4349
+ // https://www.w3.org/TR/html5/editing.html#focus-management
4350
+
4351
+ // NOTE: The following known issues exist:
4352
+ // Gecko: `svg a[xlink|href]` is not identified as focusable (because SVGElement.prototype.focus is missing)
4353
+ // Blink, WebKit: SVGElements that have been made focusable by adding a focus event listener are not identified as focusable
4354
+
4355
+ function isOnlyFocusRelevant(element) {
4356
+ var nodeName = element.nodeName.toLowerCase();
4357
+ if (nodeName === 'embed' || nodeName === 'keygen') {
4358
+ // embed is considered focus-relevant but not focusable
4359
+ // see https://github.com/medialize/ally.js/issues/82
4360
+ return true;
4361
+ }
4362
+
4363
+ var _tabindex = (0, _tabindexValue2.default)(element);
4364
+ if (element.shadowRoot && _tabindex === null) {
4365
+ // ShadowDOM host elements *may* receive focus
4366
+ // even though they are not considered focuable
4367
+ return true;
4368
+ }
4369
+
4370
+ if (nodeName === 'label') {
4371
+ // <label tabindex="0"> is only tabbable in Firefox, not script-focusable
4372
+ // there's no way to make an element focusable other than by adding a tabindex,
4373
+ // and focus behavior of the label element seems hard-wired to ignore tabindex
4374
+ // in some browsers (like Gecko, Blink and WebKit)
4375
+ return !supports$1.focusLabelTabindex || _tabindex === null;
4376
+ }
4377
+
4378
+ if (nodeName === 'legend') {
4379
+ return _tabindex === null;
4380
+ }
4381
+
4382
+ if (supports$1.focusSvgFocusableAttribute && (element.ownerSVGElement || nodeName === 'svg')) {
4383
+ // Internet Explorer understands the focusable attribute introduced in SVG Tiny 1.2
4384
+ var focusableAttribute = element.getAttribute('focusable');
4385
+ return focusableAttribute && focusableAttribute === 'false';
4386
+ }
4387
+
4388
+ if (nodeName === 'img' && element.hasAttribute('usemap')) {
4389
+ // Gecko, Trident and Edge do not allow an image with an image map and tabindex to be focused,
4390
+ // it appears the tabindex is overruled so focus is still forwarded to the <map>
4391
+ return _tabindex === null || !supports$1.focusImgUsemapTabindex;
4392
+ }
4393
+
4394
+ if (nodeName === 'area') {
4395
+ // all <area>s are considered relevant,
4396
+ // but only the valid <area>s are focusable
4397
+ return !(0, _validArea2.default)(element);
4398
+ }
4399
+
4400
+ return false;
4401
+ }
4402
+
4403
+ function isFocusableRules() {
4404
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
4405
+ context = _ref.context,
4406
+ _ref$except = _ref.except,
4407
+ except = _ref$except === undefined ? {
4408
+ disabled: false,
4409
+ visible: false,
4410
+ onlyTabbable: false
4411
+ } : _ref$except;
4412
+
4413
+ if (!supports$1) {
4414
+ supports$1 = (0, _supports3.default)();
4415
+ }
4416
+
4417
+ var _isOnlyTabbable = _onlyTabbable2.default.rules.except({
4418
+ onlyFocusableBrowsingContext: true,
4419
+ visible: except.visible
4420
+ });
4421
+
4422
+ var element = (0, _contextToElement2.default)({
4423
+ label: 'is/focusable',
4424
+ resolveDocument: true,
4425
+ context: context
4426
+ });
4427
+
4428
+ var focusRelevant = _focusRelevant2.default.rules({
4429
+ context: element,
4430
+ except: except
4431
+ });
4432
+
4433
+ if (!focusRelevant || isOnlyFocusRelevant(element)) {
4434
+ return false;
4435
+ }
4436
+
4437
+ if (!except.disabled && (0, _disabled2.default)(element)) {
4438
+ return false;
4439
+ }
4440
+
4441
+ if (!except.onlyTabbable && _isOnlyTabbable(element)) {
4442
+ // some elements may be keyboard focusable, but not script focusable
4443
+ return false;
4444
+ }
4445
+
4446
+ // elements that are not rendered, cannot be focused
4447
+ if (!except.visible) {
4448
+ var visibilityOptions = {
4449
+ context: element,
4450
+ except: {}
4451
+ };
4452
+
4453
+ if (supports$1.focusInHiddenIframe) {
4454
+ // WebKit and Blink can focus content in hidden <iframe> and <object>
4455
+ visibilityOptions.except.browsingContext = true;
4456
+ }
4457
+
4458
+ if (supports$1.focusObjectSvgHidden) {
4459
+ // Blink allows focusing the object element, even if it has visibility: hidden;
4460
+ // @browser-issue Blink https://code.google.com/p/chromium/issues/detail?id=586191
4461
+ var _nodeName2 = element.nodeName.toLowerCase();
4462
+ if (_nodeName2 === 'object') {
4463
+ visibilityOptions.except.cssVisibility = true;
4464
+ }
4465
+ }
4466
+
4467
+ if (!_visible2.default.rules(visibilityOptions)) {
4468
+ return false;
4469
+ }
4470
+ }
4471
+
4472
+ var frameElement = (0, _getFrameElement2.default)(element);
4473
+ if (frameElement) {
4474
+ var _nodeName = frameElement.nodeName.toLowerCase();
4475
+ if (_nodeName === 'object' && !supports$1.focusInZeroDimensionObject) {
4476
+ if (!frameElement.offsetWidth || !frameElement.offsetHeight) {
4477
+ // WebKit can not focus content in <object> if it doesn't have dimensions
4478
+ return false;
4479
+ }
4480
+ }
4481
+ }
4482
+
4483
+ var nodeName = element.nodeName.toLowerCase();
4484
+ if (nodeName === 'svg' && supports$1.focusSvgInIframe && !frameElement && element.getAttribute('tabindex') === null) {
4485
+ return false;
4486
+ }
4487
+
4488
+ return true;
4489
+ }
4490
+
4491
+ // bind exceptions to an iterator callback
4492
+ isFocusableRules.except = function () {
4493
+ var except = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4494
+
4495
+ var isFocusable = function isFocusable(context) {
4496
+ return isFocusableRules({
4497
+ context: context,
4498
+ except: except
4499
+ });
4500
+ };
4501
+
4502
+ isFocusable.rules = isFocusableRules;
4503
+ return isFocusable;
4504
+ };
4505
+
4506
+ // provide isFocusRelevant(context) as default iterator callback
4507
+ var isFocusable = isFocusableRules.except({});
4508
+ exports.default = isFocusable;
4509
+ module.exports = exports['default'];
4510
+
4511
+ }(focusable, focusable.exports));
4512
+
4513
+ const isFocusable = /*@__PURE__*/getDefaultExportFromCjs(focusable.exports);
4514
+
4515
+ /*!
4516
+ * long-press-event - v@version@
4517
+ * Pure JavaScript long-press-event
4518
+ * https://github.com/john-doherty/long-press-event
4519
+ * @author John Doherty <www.johndoherty.info>
4520
+ * @license MIT
4521
+ */
4522
+ (function (window, document) {
4523
+
4524
+ // local timer object based on rAF
4525
+ var timer = null;
4526
+
4527
+ // check if we're using a touch screen
4528
+ var hasPointerEvents = (('PointerEvent' in window) || (window.navigator && 'msPointerEnabled' in window.navigator));
4529
+ var isTouch = (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
4530
+
4531
+ // switch to pointer events or touch events if using a touch screen
4532
+ var mouseDown = hasPointerEvents ? 'pointerdown' : isTouch ? 'touchstart' : 'mousedown';
4533
+ var mouseUp = hasPointerEvents ? 'pointerup' : isTouch ? 'touchend' : 'mouseup';
4534
+ var mouseMove = hasPointerEvents ? 'pointermove' : isTouch ? 'touchmove' : 'mousemove';
4535
+ var mouseLeave = hasPointerEvents ? 'pointerleave' : isTouch ? 'touchleave' : 'mouseleave';
4536
+
4537
+ // track number of pixels the mouse moves during long press
4538
+ var startX = 0; // mouse x position when timer started
4539
+ var startY = 0; // mouse y position when timer started
4540
+ var maxDiffX = 10; // max number of X pixels the mouse can move during long press before it is canceled
4541
+ var maxDiffY = 10; // max number of Y pixels the mouse can move during long press before it is canceled
4542
+
4543
+ // patch CustomEvent to allow constructor creation (IE/Chrome)
4544
+ if (typeof window.CustomEvent !== 'function') {
4545
+
4546
+ window.CustomEvent = function (event, params) {
4547
+
4548
+ params = params || { bubbles: false, cancelable: false, detail: undefined };
4549
+
4550
+ var evt = document.createEvent('CustomEvent');
4551
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
4552
+ return evt;
4553
+ };
4554
+
4555
+ window.CustomEvent.prototype = window.Event.prototype;
4556
+ }
4557
+
4558
+ // requestAnimationFrame() shim by Paul Irish
4559
+ window.requestAnimFrame = (function () {
4560
+ return window.requestAnimationFrame ||
4561
+ window.webkitRequestAnimationFrame ||
4562
+ window.mozRequestAnimationFrame ||
4563
+ window.oRequestAnimationFrame ||
4564
+ window.msRequestAnimationFrame || function (callback) {
4565
+ window.setTimeout(callback, 1000 / 60);
4566
+ };
4567
+ })();
4568
+
4569
+ /**
4570
+ * Behaves the same as setTimeout except uses requestAnimationFrame() where possible for better performance
4571
+ * @param {function} fn The callback function
4572
+ * @param {int} delay The delay in milliseconds
4573
+ * @returns {object} handle to the timeout object
4574
+ */
4575
+ function requestTimeout(fn, delay) {
4576
+
4577
+ if (!window.requestAnimationFrame && !window.webkitRequestAnimationFrame &&
4578
+ !(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
4579
+ !window.oRequestAnimationFrame && !window.msRequestAnimationFrame) return window.setTimeout(fn, delay);
4580
+
4581
+ var start = new Date().getTime();
4582
+ var handle = {};
4583
+
4584
+ var loop = function () {
4585
+ var current = new Date().getTime();
4586
+ var delta = current - start;
4587
+
4588
+ if (delta >= delay) {
4589
+ fn.call();
4590
+ }
4591
+ else {
4592
+ handle.value = requestAnimFrame(loop);
4593
+ }
4594
+ };
4595
+
4596
+ handle.value = requestAnimFrame(loop);
4597
+
4598
+ return handle;
4599
+ }
4600
+
4601
+ /**
4602
+ * Behaves the same as clearTimeout except uses cancelRequestAnimationFrame() where possible for better performance
4603
+ * @param {object} handle The callback function
4604
+ * @returns {void}
4605
+ */
4606
+ function clearRequestTimeout(handle) {
4607
+ if (handle) {
4608
+ window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
4609
+ window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
4610
+ window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
4611
+ window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
4612
+ window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) :
4613
+ window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
4614
+ clearTimeout(handle);
4615
+ }
4616
+ }
4617
+
4618
+ /**
4619
+ * Fires the 'long-press' event on element
4620
+ * @param {MouseEvent|PointerEvent|TouchEvent} originalEvent The original event being fired
4621
+ * @returns {void}
4622
+ */
4623
+ function fireLongPressEvent(originalEvent) {
4624
+
4625
+ clearLongPressTimer();
4626
+
4627
+ originalEvent = unifyEvent(originalEvent);
4628
+
4629
+ // fire the long-press event
4630
+ var allowClickEvent = this.dispatchEvent(new CustomEvent('long-press', {
4631
+ bubbles: true,
4632
+ cancelable: true,
4633
+
4634
+ // custom event data (legacy)
4635
+ detail: {
4636
+ clientX: originalEvent.clientX,
4637
+ clientY: originalEvent.clientY,
4638
+ offsetX: originalEvent.offsetX,
4639
+ offsetY: originalEvent.offsetY,
4640
+ pageX: originalEvent.pageX,
4641
+ pageY: originalEvent.pageY
4642
+ },
4643
+
4644
+ // add coordinate data that would typically acompany a touch/click event
4645
+ clientX: originalEvent.clientX,
4646
+ clientY: originalEvent.clientY,
4647
+ offsetX: originalEvent.offsetX,
4648
+ offsetY: originalEvent.offsetY,
4649
+ pageX: originalEvent.pageX,
4650
+ pageY: originalEvent.pageY,
4651
+ screenX: originalEvent.screenX,
4652
+ screenY: originalEvent.screenY
4653
+ }));
4654
+
4655
+ if (!allowClickEvent) {
4656
+ // suppress the next click event if e.preventDefault() was called in long-press handler
4657
+ document.addEventListener('click', function suppressEvent(e) {
4658
+ document.removeEventListener('click', suppressEvent, true);
4659
+ cancelEvent(e);
4660
+ }, true);
4661
+ }
4662
+ }
4663
+
4664
+ /**
4665
+ * consolidates mouse, touch, and Pointer events
4666
+ * @param {MouseEvent|PointerEvent|TouchEvent} e The original event being fired
4667
+ * @returns {MouseEvent|PointerEvent|Touch}
4668
+ */
4669
+ function unifyEvent(e) {
4670
+ if (e.changedTouches !== undefined) {
4671
+ return e.changedTouches[0];
4672
+ }
4673
+ return e;
4674
+ }
4675
+
4676
+ /**
4677
+ * method responsible for starting the long press timer
4678
+ * @param {event} e - event object
4679
+ * @returns {void}
4680
+ */
4681
+ function startLongPressTimer(e) {
4682
+
4683
+ clearLongPressTimer();
4684
+
4685
+ var el = e.target;
4686
+
4687
+ // get delay from html attribute if it exists, otherwise default to 1500
4688
+ var longPressDelayInMs = parseInt(getNearestAttribute(el, 'data-long-press-delay', '1500'), 10); // default 1500
4689
+
4690
+ // start the timer
4691
+ timer = requestTimeout(fireLongPressEvent.bind(el, e), longPressDelayInMs);
4692
+ }
4693
+
4694
+ /**
4695
+ * method responsible for clearing a pending long press timer
4696
+ * @param {event} e - event object
4697
+ * @returns {void}
4698
+ */
4699
+ function clearLongPressTimer(e) {
4700
+ clearRequestTimeout(timer);
4701
+ timer = null;
4702
+ }
4703
+
4704
+ /**
4705
+ * Cancels the current event
4706
+ * @param {object} e - browser event object
4707
+ * @returns {void}
4708
+ */
4709
+ function cancelEvent(e) {
4710
+ e.stopImmediatePropagation();
4711
+ e.preventDefault();
4712
+ e.stopPropagation();
4713
+ }
4714
+
4715
+ /**
4716
+ * Starts the timer on mouse down and logs current position
4717
+ * @param {object} e - browser event object
4718
+ * @returns {void}
4719
+ */
4720
+ function mouseDownHandler(e) {
4721
+ startX = e.clientX;
4722
+ startY = e.clientY;
4723
+ startLongPressTimer(e);
4724
+ }
4725
+
4726
+ /**
4727
+ * If the mouse moves n pixels during long-press, cancel the timer
4728
+ * @param {object} e - browser event object
4729
+ * @returns {void}
4730
+ */
4731
+ function mouseMoveHandler(e) {
4732
+
4733
+ // calculate total number of pixels the pointer has moved
4734
+ var diffX = Math.abs(startX - e.clientX);
4735
+ var diffY = Math.abs(startY - e.clientY);
4736
+
4737
+ // if pointer has moved more than allowed, cancel the long-press timer and therefore the event
4738
+ if (diffX >= maxDiffX || diffY >= maxDiffY) {
4739
+ clearLongPressTimer();
4740
+ }
4741
+ }
4742
+
4743
+ /**
4744
+ * Gets attribute off HTML element or nearest parent
4745
+ * @param {object} el - HTML element to retrieve attribute from
4746
+ * @param {string} attributeName - name of the attribute
4747
+ * @param {any} defaultValue - default value to return if no match found
4748
+ * @returns {any} attribute value or defaultValue
4749
+ */
4750
+ function getNearestAttribute(el, attributeName, defaultValue) {
4751
+
4752
+ // walk up the dom tree looking for data-action and data-trigger
4753
+ while (el && el !== document.documentElement) {
4754
+
4755
+ var attributeValue = el.getAttribute(attributeName);
4756
+
4757
+ if (attributeValue) {
4758
+ return attributeValue;
4759
+ }
4760
+
4761
+ el = el.parentNode;
4762
+ }
4763
+
4764
+ return defaultValue;
4765
+ }
4766
+
4767
+ // hook events that clear a pending long press event
4768
+ document.addEventListener(mouseUp, clearLongPressTimer, true);
4769
+ document.addEventListener(mouseLeave, clearLongPressTimer, true);
4770
+ document.addEventListener(mouseMove, mouseMoveHandler, true);
4771
+ document.addEventListener('wheel', clearLongPressTimer, true);
4772
+ document.addEventListener('scroll', clearLongPressTimer, true);
4773
+ document.addEventListener('contextmenu', clearLongPressTimer, true);
4774
+
4775
+ // hook events that can trigger a long press event
4776
+ document.addEventListener(mouseDown, mouseDownHandler, true); // <- start
4777
+
4778
+ }(window, document));
4779
+
4780
+ const postTooltipCss = ":host{--post-contrast-color:#fff;--post-bg-rgb:51, 51, 51}post-popovercontainer{padding:.25rem .5rem;max-width:13.5rem;min-height:1rem}post-popovercontainer[arrow]::after{position:absolute;content:\"\";inset:-13px;z-index:-1}";
4781
+ const PostTooltipStyle0 = postTooltipCss;
4782
+
4783
+ const OPEN_DELAY = 650; // matches HTML title delay
4784
+ /**
4785
+ * @slot default - Slot for the content of the tooltip.
4786
+ */
4787
+ /**
4788
+ * Track how many instances remain on the page. Used for removing global event listeners
4789
+ */
4790
+ let tooltipInstances = 0;
4791
+ let hideTooltipTimeout = null;
4792
+ const tooltipTargetAttribute = 'data-tooltip-target';
4793
+ const tooltipTargetAttributeSelector = `[${tooltipTargetAttribute}]`;
4794
+ /**
4795
+ * Global event listener to show tooltips. This is globalized so that triggers that are rendered
4796
+ * async will still work without the need to set listeners on the element itself
4797
+ * @param e Event
4798
+ * @returns
4799
+ */
4800
+ const globalInterestHandler = (e) => {
4801
+ const targetElement = e.target.closest(tooltipTargetAttributeSelector);
4802
+ if (!targetElement || !('getAttribute' in targetElement))
4803
+ return;
4804
+ const tooltipTarget = targetElement.getAttribute(tooltipTargetAttribute);
4805
+ if (!tooltipTarget || tooltipTarget === '')
4806
+ return;
4807
+ const tooltip = document.getElementById(tooltipTarget);
4808
+ void (tooltip === null || tooltip === void 0 ? void 0 : tooltip.show(targetElement));
4809
+ if (hideTooltipTimeout) {
4810
+ window.clearTimeout(hideTooltipTimeout);
4811
+ hideTooltipTimeout = null;
4812
+ }
4813
+ };
4814
+ /**
4815
+ * Global event listener to hide tooltips. This is globalized so that triggers that are rendered
4816
+ * async will still work without the need to set listeners on the element itself
4817
+ * @param e Event
4818
+ * @returns
4819
+ */
4820
+ const globalInterestLostHandler = (e) => {
4821
+ const targetElement = e.target.closest(tooltipTargetAttributeSelector);
4822
+ if (!targetElement || !('getAttribute' in targetElement))
4823
+ return;
4824
+ const tooltipTarget = targetElement.getAttribute(tooltipTargetAttribute);
4825
+ if (!tooltipTarget || tooltipTarget === '')
4826
+ return;
4827
+ const tooltip = document.getElementById(tooltipTarget);
4828
+ globalHideTooltip(tooltip);
4829
+ };
4830
+ /**
4831
+ * Start the hiding process through a timeout to give other interest events a chance to
4832
+ * intervene and cancel the hide event.
4833
+ * @param {HTMLPostTooltipElement} tooltip
4834
+ */
4835
+ const globalHideTooltip = (tooltip) => {
4836
+ hideTooltipTimeout = window.setTimeout(() => {
4837
+ tooltip.hide();
4838
+ hideTooltipTimeout = null;
4839
+ }, 42);
4840
+ };
4841
+ /**
4842
+ * Patch some accessibility features that are hard to remember or understand
4843
+ * @param {HTMLElement} trigger
4844
+ */
4845
+ const patchAccessibilityFeatures = (trigger) => {
4846
+ const describedBy = trigger.getAttribute('aria-describedby');
4847
+ const id = trigger.getAttribute(tooltipTargetAttribute);
4848
+ // Add tooltip to aria-describedby
4849
+ if (!(describedBy === null || describedBy === void 0 ? void 0 : describedBy.includes(id))) {
4850
+ const newDescribedBy = describedBy ? `${describedBy} ${id}` : id;
4851
+ trigger.setAttribute('aria-describedby', newDescribedBy);
4852
+ }
4853
+ // Make element focusable
4854
+ if (!isFocusable(trigger)) {
4855
+ trigger.setAttribute('tabindex', '0');
4856
+ }
4857
+ };
4858
+ // Initialize a mutation observer for patching accessibility features
4859
+ const triggerObserver = getAttributeObserver(tooltipTargetAttribute, patchAccessibilityFeatures);
4860
+ const PostTooltip$1 = /*@__PURE__*/ proxyCustomElement(class PostTooltip extends HTMLElement$1 {
4861
+ constructor() {
4862
+ super();
4863
+ this.__registerHost();
4864
+ this.__attachShadow();
4865
+ this.placement = 'top';
4866
+ this.arrow = true;
4867
+ this.delayed = false;
4868
+ }
4869
+ validateDelayed() {
4870
+ checkEmptyOrType(this.delayed, 'boolean', 'The post-tooltip "delayed" property should be a boolean.');
4871
+ }
4872
+ connectedCallback() {
4873
+ this.validateDelayed();
4874
+ }
4875
+ componentDidLoad() {
4876
+ if (!this.host.id) {
4877
+ throw new Error(
4878
+ /*prettier-ignore*/
4879
+ 'No id set: <post-tooltip> must have an id, linking it to it\'s target element using the data-tooltip-target attribute.');
4880
+ }
4881
+ }
4882
+ /**
4883
+ * Add interest event listeners, but only once, and start
4884
+ * the accessibility patcher
4885
+ */
4886
+ componentWillLoad() {
4887
+ if (tooltipInstances === 0) {
4888
+ // This is the first tooltip on the page, add event listeners
4889
+ document.addEventListener('pointerover', globalInterestHandler);
4890
+ document.addEventListener('pointerout', globalInterestLostHandler);
4891
+ document.addEventListener('focusin', globalInterestHandler);
4892
+ document.addEventListener('focusout', globalInterestLostHandler);
4893
+ document.addEventListener('long-press', globalInterestHandler);
4894
+ // Initially run the accessibility patcher on all triggers
4895
+ document.querySelectorAll('[data-tooltip-target]').forEach(patchAccessibilityFeatures);
4896
+ // Start watching for future triggers
4897
+ triggerObserver.observe(document.body, {
4898
+ subtree: true,
4899
+ childList: true,
4900
+ attributeFilter: [tooltipTargetAttribute],
4901
+ });
4902
+ }
4903
+ tooltipInstances++;
4904
+ }
4905
+ /**
4906
+ * Remove a bunch of event listeners if the tooltip gets removed from the DOM
4907
+ * and disconnect the accessibility patcher
4908
+ */
4909
+ disconnectedCallback() {
4910
+ tooltipInstances--;
4911
+ if (tooltipInstances <= 0) {
4912
+ // The last tooltip has been removed, stop listening for these kind of events
4913
+ document.removeEventListener('pointerover', globalInterestHandler);
4914
+ document.removeEventListener('pointerout', globalInterestLostHandler);
4915
+ document.removeEventListener('focusin', globalInterestHandler);
4916
+ document.removeEventListener('focusout', globalInterestLostHandler);
4917
+ document.removeEventListener('long-press', globalInterestHandler);
4918
+ triggerObserver.disconnect();
4919
+ }
4920
+ }
4921
+ /**
4922
+ * Programmatically display the tooltip
4923
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
4924
+ */
4925
+ async show(target) {
4926
+ if (this.delayed)
4927
+ await timeout(OPEN_DELAY);
4928
+ this.popoverRef.show(target);
4929
+ }
4930
+ /**
4931
+ * Programmatically hide this tooltip
4932
+ */
4933
+ async hide() {
4934
+ this.popoverRef.hide();
4935
+ }
4936
+ /**
4937
+ * Toggle tooltip display
4938
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
4939
+ * @param force Pass true to always show or false to always hide
4940
+ */
4941
+ async toggle(target, force) {
4942
+ this.popoverRef.toggle(target, force);
4943
+ }
4944
+ /**
4945
+ * Pointer or focus is on the tooltip, stop the tooltip from disappearing
4946
+ */
4947
+ handleInterest() {
4948
+ if (hideTooltipTimeout) {
4949
+ window.clearTimeout(hideTooltipTimeout);
4950
+ hideTooltipTimeout = null;
4951
+ }
4952
+ }
4953
+ /**
4954
+ * Pointer or focus left the tooltip, initiate the hiding process
4955
+ */
4956
+ handleInterestLost() {
4957
+ globalHideTooltip(this);
4958
+ }
4959
+ render() {
4960
+ const popoverClass = `${this.arrow ? ' has-arrow' : ''}`;
4961
+ return (h(Host, { key: 'f543fa8f63cc6b65e1a86e34b1a59b4ca0bb9e47', "data-version": version$1, role: "tooltip", onPointerOver: this.handleInterest, onPointerOut: this.handleInterestLost, onFocusIn: this.handleInterest, onFocusOut: this.handleInterestLost }, h("post-popovercontainer", { key: 'e920d62462d209ff25593f7989ca16f6177b7292', class: popoverClass, arrow: this.arrow, placement: this.placement, ref: (el) => (this.popoverRef = el) }, h("slot", { key: '607d7357cb201c7e6e62f9a241392bd5ef1f156e' }))));
4962
+ }
4963
+ get host() { return this; }
4964
+ static get watchers() { return {
4965
+ "delayed": ["validateDelayed"]
4966
+ }; }
4967
+ static get style() { return PostTooltipStyle0; }
4968
+ }, [1, "post-tooltip", {
4969
+ "placement": [1],
4970
+ "arrow": [4],
4971
+ "delayed": [4],
4972
+ "show": [64],
4973
+ "hide": [64],
4974
+ "toggle": [64]
4975
+ }, undefined, {
4976
+ "delayed": ["validateDelayed"]
4977
+ }]);
4978
+ function defineCustomElement$1() {
4979
+ if (typeof customElements === "undefined") {
4980
+ return;
4981
+ }
4982
+ const components = ["post-tooltip", "post-popovercontainer"];
4983
+ components.forEach(tagName => { switch (tagName) {
4984
+ case "post-tooltip":
4985
+ if (!customElements.get(tagName)) {
4986
+ customElements.define(tagName, PostTooltip$1);
4987
+ }
4988
+ break;
4989
+ case "post-popovercontainer":
4990
+ if (!customElements.get(tagName)) {
4991
+ defineCustomElement$2();
4992
+ }
4993
+ break;
4994
+ } });
4995
+ }
4996
+
4997
+ const PostTooltip = PostTooltip$1;
4998
+ const defineCustomElement = defineCustomElement$1;
4999
+
5000
+ export { PostTooltip, defineCustomElement };