styled-components 6.0.0-alpha.6 → 6.0.0-beta.1

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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var tslib = require('tslib');
5
6
  var React = require('react');
6
7
  require('shallowequal');
7
8
  var stylis = require('stylis');
@@ -15,8 +16,8 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
15
16
  var unitless__default = /*#__PURE__*/_interopDefaultLegacy(unitless);
16
17
  var transformDeclPairs__default = /*#__PURE__*/_interopDefaultLegacy(transformDeclPairs);
17
18
 
18
- const EMPTY_ARRAY = Object.freeze([]);
19
- const EMPTY_OBJECT = Object.freeze({});
19
+ var EMPTY_ARRAY = Object.freeze([]);
20
+ var EMPTY_OBJECT = Object.freeze({});
20
21
 
21
22
  var errorMap = {
22
23
  '1': 'Cannot create styled-component for component: %s.\n\n',
@@ -38,17 +39,21 @@ var errorMap = {
38
39
  '17': "CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",
39
40
  };
40
41
 
41
- const ERRORS = process.env.NODE_ENV !== 'production' ? errorMap : {};
42
+ var ERRORS = process.env.NODE_ENV !== 'production' ? errorMap : {};
42
43
  /**
43
44
  * super basic version of sprintf
44
45
  */
45
- function format(...args) {
46
- let a = args[0];
47
- const b = [];
48
- for (let c = 1, len = args.length; c < len; c += 1) {
46
+ function format() {
47
+ var args = [];
48
+ for (var _i = 0; _i < arguments.length; _i++) {
49
+ args[_i] = arguments[_i];
50
+ }
51
+ var a = args[0];
52
+ var b = [];
53
+ for (var c = 1, len = args.length; c < len; c += 1) {
49
54
  b.push(args[c]);
50
55
  }
51
- b.forEach(d => {
56
+ b.forEach(function (d) {
52
57
  a = a.replace(/%[a-z]/, d);
53
58
  });
54
59
  return a;
@@ -57,23 +62,27 @@ function format(...args) {
57
62
  * Create an error file out of errors.md for development and a simple web link to the full errors
58
63
  * in production mode.
59
64
  */
60
- function throwStyledComponentsError(code, ...interpolations) {
65
+ function throwStyledComponentsError(code) {
66
+ var interpolations = [];
67
+ for (var _i = 1; _i < arguments.length; _i++) {
68
+ interpolations[_i - 1] = arguments[_i];
69
+ }
61
70
  if (process.env.NODE_ENV === 'production') {
62
- return new Error(`An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#${code} for more information.${interpolations.length > 0 ? ` Args: ${interpolations.join(', ')}` : ''}`);
71
+ return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(code, " for more information.").concat(interpolations.length > 0 ? " Args: ".concat(interpolations.join(', ')) : ''));
63
72
  }
64
73
  else {
65
- return new Error(format(ERRORS[code], ...interpolations).trim());
74
+ return new Error(format.apply(void 0, tslib.__spreadArray([ERRORS[code]], interpolations, false)).trim());
66
75
  }
67
76
  }
68
77
 
69
- const SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
78
+ var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
70
79
  'data-styled';
71
- const SC_ATTR_ACTIVE = 'active';
72
- const SC_ATTR_VERSION = 'data-styled-version';
73
- const SC_VERSION = "6.0.0-alpha.6";
74
- const SPLITTER = '/*!sc*/\n';
75
- const IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
76
- const DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
80
+ var SC_ATTR_ACTIVE = 'active';
81
+ var SC_ATTR_VERSION = 'data-styled-version';
82
+ var SC_VERSION = "6.0.0-beta.1";
83
+ var SPLITTER = '/*!sc*/\n';
84
+ var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
85
+ var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
77
86
  ? SC_DISABLE_SPEEDY
78
87
  : typeof process !== 'undefined' &&
79
88
  typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' &&
@@ -90,47 +99,44 @@ const DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
90
99
  : process.env.NODE_ENV !== 'production');
91
100
 
92
101
  /** Create a GroupedTag with an underlying Tag implementation */
93
- const makeGroupedTag = (tag) => {
102
+ var makeGroupedTag = function (tag) {
94
103
  return new DefaultGroupedTag(tag);
95
104
  };
96
- const BASE_SIZE = 1 << 9;
97
- const DefaultGroupedTag = class DefaultGroupedTag {
98
- groupSizes;
99
- length;
100
- tag;
101
- constructor(tag) {
105
+ var BASE_SIZE = 1 << 9;
106
+ var DefaultGroupedTag = /** @class */ (function () {
107
+ function DefaultGroupedTag(tag) {
102
108
  this.groupSizes = new Uint32Array(BASE_SIZE);
103
109
  this.length = BASE_SIZE;
104
110
  this.tag = tag;
105
111
  }
106
- indexOfGroup(group) {
107
- let index = 0;
108
- for (let i = 0; i < group; i++) {
112
+ DefaultGroupedTag.prototype.indexOfGroup = function (group) {
113
+ var index = 0;
114
+ for (var i = 0; i < group; i++) {
109
115
  index += this.groupSizes[i];
110
116
  }
111
117
  return index;
112
- }
113
- insertRules(group, rules) {
118
+ };
119
+ DefaultGroupedTag.prototype.insertRules = function (group, rules) {
114
120
  if (group >= this.groupSizes.length) {
115
- const oldBuffer = this.groupSizes;
116
- const oldSize = oldBuffer.length;
117
- let newSize = oldSize;
121
+ var oldBuffer = this.groupSizes;
122
+ var oldSize = oldBuffer.length;
123
+ var newSize = oldSize;
118
124
  while (group >= newSize) {
119
125
  newSize <<= 1;
120
126
  if (newSize < 0) {
121
- throw throwStyledComponentsError(16, `${group}`);
127
+ throw throwStyledComponentsError(16, "".concat(group));
122
128
  }
123
129
  }
124
130
  this.groupSizes = new Uint32Array(newSize);
125
131
  this.groupSizes.set(oldBuffer);
126
132
  this.length = newSize;
127
- for (let i = oldSize; i < newSize; i++) {
133
+ for (var i = oldSize; i < newSize; i++) {
128
134
  this.groupSizes[i] = 0;
129
135
  }
130
136
  }
131
- let ruleIndex = this.indexOfGroup(group + 1);
137
+ var ruleIndex = this.indexOfGroup(group + 1);
132
138
  if (Array.isArray(rules)) {
133
- for (let i = 0, l = rules.length; i < l; i++) {
139
+ for (var i = 0, l = rules.length; i < l; i++) {
134
140
  if (this.tag.insertRule(ruleIndex, rules[i])) {
135
141
  this.groupSizes[group]++;
136
142
  ruleIndex++;
@@ -142,110 +148,115 @@ const DefaultGroupedTag = class DefaultGroupedTag {
142
148
  this.groupSizes[group]++;
143
149
  }
144
150
  }
145
- }
146
- clearGroup(group) {
151
+ };
152
+ DefaultGroupedTag.prototype.clearGroup = function (group) {
147
153
  if (group < this.length) {
148
- const length = this.groupSizes[group];
149
- const startIndex = this.indexOfGroup(group);
150
- const endIndex = startIndex + length;
154
+ var length_1 = this.groupSizes[group];
155
+ var startIndex = this.indexOfGroup(group);
156
+ var endIndex = startIndex + length_1;
151
157
  this.groupSizes[group] = 0;
152
- for (let i = startIndex; i < endIndex; i++) {
158
+ for (var i = startIndex; i < endIndex; i++) {
153
159
  this.tag.deleteRule(startIndex);
154
160
  }
155
161
  }
156
- }
157
- getGroup(group) {
158
- let css = '';
162
+ };
163
+ DefaultGroupedTag.prototype.getGroup = function (group) {
164
+ var css = '';
159
165
  if (group >= this.length || this.groupSizes[group] === 0) {
160
166
  return css;
161
167
  }
162
- const length = this.groupSizes[group];
163
- const startIndex = this.indexOfGroup(group);
164
- const endIndex = startIndex + length;
165
- for (let i = startIndex; i < endIndex; i++) {
166
- css += `${this.tag.getRule(i)}${SPLITTER}`;
168
+ var length = this.groupSizes[group];
169
+ var startIndex = this.indexOfGroup(group);
170
+ var endIndex = startIndex + length;
171
+ for (var i = startIndex; i < endIndex; i++) {
172
+ css += "".concat(this.tag.getRule(i)).concat(SPLITTER);
167
173
  }
168
174
  return css;
169
- }
170
- };
175
+ };
176
+ return DefaultGroupedTag;
177
+ }());
171
178
 
172
- const MAX_SMI = 1 << (31 - 1);
173
- let groupIDRegister = new Map();
174
- let reverseRegister = new Map();
175
- let nextFreeGroup = 1;
176
- const getGroupForId = (id) => {
179
+ var MAX_SMI = 1 << (31 - 1);
180
+ var groupIDRegister = new Map();
181
+ var reverseRegister = new Map();
182
+ var nextFreeGroup = 1;
183
+ var getGroupForId = function (id) {
177
184
  if (groupIDRegister.has(id)) {
178
185
  return groupIDRegister.get(id);
179
186
  }
180
187
  while (reverseRegister.has(nextFreeGroup)) {
181
188
  nextFreeGroup++;
182
189
  }
183
- const group = nextFreeGroup++;
190
+ var group = nextFreeGroup++;
184
191
  if (process.env.NODE_ENV !== 'production' && ((group | 0) < 0 || group > MAX_SMI)) {
185
- throw throwStyledComponentsError(16, `${group}`);
192
+ throw throwStyledComponentsError(16, "".concat(group));
186
193
  }
187
194
  groupIDRegister.set(id, group);
188
195
  reverseRegister.set(group, id);
189
196
  return group;
190
197
  };
191
- const getIdForGroup = (group) => {
198
+ var getIdForGroup = function (group) {
192
199
  return reverseRegister.get(group);
193
200
  };
194
- const setGroupForId = (id, group) => {
201
+ var setGroupForId = function (id, group) {
195
202
  groupIDRegister.set(id, group);
196
203
  reverseRegister.set(group, id);
197
204
  };
198
205
 
199
- const SELECTOR = `style[${SC_ATTR}][${SC_ATTR_VERSION}="${SC_VERSION}"]`;
200
- const MARKER_RE = new RegExp(`^${SC_ATTR}\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)`);
201
- const outputSheet = (sheet) => {
202
- const tag = sheet.getTag();
203
- const { length } = tag;
204
- let css = '';
205
- for (let group = 0; group < length; group++) {
206
- const id = getIdForGroup(group);
206
+ var SELECTOR = "style[".concat(SC_ATTR, "][").concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\"]");
207
+ var MARKER_RE = new RegExp("^".concat(SC_ATTR, "\\.g(\\d+)\\[id=\"([\\w\\d-]+)\"\\].*?\"([^\"]*)"));
208
+ var outputSheet = function (sheet) {
209
+ var tag = sheet.getTag();
210
+ var length = tag.length;
211
+ var css = '';
212
+ var _loop_1 = function (group) {
213
+ var id = getIdForGroup(group);
207
214
  if (id === undefined)
208
- continue;
209
- const names = sheet.names.get(id);
210
- const rules = tag.getGroup(group);
215
+ return "continue";
216
+ var names = sheet.names.get(id);
217
+ var rules = tag.getGroup(group);
211
218
  if (names === undefined || rules.length === 0)
212
- continue;
213
- const selector = `${SC_ATTR}.g${group}[id="${id}"]`;
214
- let content = '';
219
+ return "continue";
220
+ var selector = "".concat(SC_ATTR, ".g").concat(group, "[id=\"").concat(id, "\"]");
221
+ var content = '';
215
222
  if (names !== undefined) {
216
- names.forEach(name => {
223
+ names.forEach(function (name) {
217
224
  if (name.length > 0) {
218
- content += `${name},`;
225
+ content += "".concat(name, ",");
219
226
  }
220
227
  });
221
228
  }
222
229
  // NOTE: It's easier to collect rules and have the marker
223
230
  // after the actual rules to simplify the rehydration
224
- css += `${rules}${selector}{content:"${content}"}${SPLITTER}`;
231
+ css += "".concat(rules).concat(selector, "{content:\"").concat(content, "\"}").concat(SPLITTER);
232
+ };
233
+ for (var group = 0; group < length; group++) {
234
+ _loop_1(group);
225
235
  }
226
236
  return css;
227
237
  };
228
- const rehydrateNamesFromContent = (sheet, id, content) => {
229
- const names = content.split(',');
230
- let name;
231
- for (let i = 0, l = names.length; i < l; i++) {
238
+ var rehydrateNamesFromContent = function (sheet, id, content) {
239
+ var names = content.split(',');
240
+ var name;
241
+ for (var i = 0, l = names.length; i < l; i++) {
232
242
  // eslint-disable-next-line
233
243
  if ((name = names[i])) {
234
244
  sheet.registerName(id, name);
235
245
  }
236
246
  }
237
247
  };
238
- const rehydrateSheetFromTag = (sheet, style) => {
239
- const parts = (style.textContent ?? '').split(SPLITTER);
240
- const rules = [];
241
- for (let i = 0, l = parts.length; i < l; i++) {
242
- const part = parts[i].trim();
248
+ var rehydrateSheetFromTag = function (sheet, style) {
249
+ var _a;
250
+ var parts = ((_a = style.textContent) !== null && _a !== void 0 ? _a : '').split(SPLITTER);
251
+ var rules = [];
252
+ for (var i = 0, l = parts.length; i < l; i++) {
253
+ var part = parts[i].trim();
243
254
  if (!part)
244
255
  continue;
245
- const marker = part.match(MARKER_RE);
256
+ var marker = part.match(MARKER_RE);
246
257
  if (marker) {
247
- const group = parseInt(marker[1], 10) | 0;
248
- const id = marker[2];
258
+ var group = parseInt(marker[1], 10) | 0;
259
+ var id = marker[2];
249
260
  if (group !== 0) {
250
261
  // Rehydrate componentId to group index mapping
251
262
  setGroupForId(id, group);
@@ -261,10 +272,10 @@ const rehydrateSheetFromTag = (sheet, style) => {
261
272
  }
262
273
  }
263
274
  };
264
- const rehydrateSheet = (sheet) => {
265
- const nodes = document.querySelectorAll(SELECTOR);
266
- for (let i = 0, l = nodes.length; i < l; i++) {
267
- const node = nodes[i];
275
+ var rehydrateSheet = function (sheet) {
276
+ var nodes = document.querySelectorAll(SELECTOR);
277
+ for (var i = 0, l = nodes.length; i < l; i++) {
278
+ var node = nodes[i];
268
279
  if (node && node.getAttribute(SC_ATTR) !== SC_ATTR_ACTIVE) {
269
280
  rehydrateSheetFromTag(sheet, node);
270
281
  if (node.parentNode) {
@@ -278,13 +289,13 @@ function getNonce() {
278
289
  return typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;
279
290
  }
280
291
 
281
- const ELEMENT_TYPE = 1;
292
+ var ELEMENT_TYPE = 1;
282
293
  /* Node.ELEMENT_TYPE */
283
294
  /** Find last style element if any inside target */
284
- const findLastStyleTag = (target) => {
285
- const { childNodes } = target;
286
- for (let i = childNodes.length; i >= 0; i--) {
287
- const child = childNodes[i];
295
+ var findLastStyleTag = function (target) {
296
+ var childNodes = target.childNodes;
297
+ for (var i = childNodes.length; i >= 0; i--) {
298
+ var child = childNodes[i];
288
299
  if (child && child.nodeType === ELEMENT_TYPE && child.hasAttribute(SC_ATTR)) {
289
300
  return child;
290
301
  }
@@ -292,29 +303,29 @@ const findLastStyleTag = (target) => {
292
303
  return undefined;
293
304
  };
294
305
  /** Create a style element inside `target` or <head> after the last */
295
- const makeStyleTag = (target) => {
296
- const head = document.head;
297
- const parent = target || head;
298
- const style = document.createElement('style');
299
- const prevStyle = findLastStyleTag(parent);
300
- const nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
306
+ var makeStyleTag = function (target) {
307
+ var head = document.head;
308
+ var parent = target || head;
309
+ var style = document.createElement('style');
310
+ var prevStyle = findLastStyleTag(parent);
311
+ var nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
301
312
  style.setAttribute(SC_ATTR, SC_ATTR_ACTIVE);
302
313
  style.setAttribute(SC_ATTR_VERSION, SC_VERSION);
303
- const nonce = getNonce();
314
+ var nonce = getNonce();
304
315
  if (nonce)
305
316
  style.setAttribute('nonce', nonce);
306
317
  parent.insertBefore(style, nextSibling);
307
318
  return style;
308
319
  };
309
320
  /** Get the CSSStyleSheet instance for a given style element */
310
- const getSheet = (tag) => {
321
+ var getSheet = function (tag) {
311
322
  if (tag.sheet) {
312
323
  return tag.sheet;
313
324
  }
314
325
  // Avoid Firefox quirk where the style element might not have a sheet property
315
- const { styleSheets } = document;
316
- for (let i = 0, l = styleSheets.length; i < l; i++) {
317
- const sheet = styleSheets[i];
326
+ var styleSheets = document.styleSheets;
327
+ for (var i = 0, l = styleSheets.length; i < l; i++) {
328
+ var sheet = styleSheets[i];
318
329
  if (sheet.ownerNode === tag) {
319
330
  return sheet;
320
331
  }
@@ -323,7 +334,8 @@ const getSheet = (tag) => {
323
334
  };
324
335
 
325
336
  /** Create a CSSStyleSheet-like tag depending on the environment */
326
- const makeTag = ({ isServer, useCSSOMInjection, target }) => {
337
+ var makeTag = function (_a) {
338
+ var isServer = _a.isServer, useCSSOMInjection = _a.useCSSOMInjection, target = _a.target;
327
339
  if (isServer) {
328
340
  return new VirtualTag(target);
329
341
  }
@@ -334,18 +346,15 @@ const makeTag = ({ isServer, useCSSOMInjection, target }) => {
334
346
  return new TextTag(target);
335
347
  }
336
348
  };
337
- const CSSOMTag = class CSSOMTag {
338
- element;
339
- sheet;
340
- length;
341
- constructor(target) {
342
- const element = (this.element = makeStyleTag(target));
349
+ var CSSOMTag = /** @class */ (function () {
350
+ function CSSOMTag(target) {
351
+ var element = (this.element = makeStyleTag(target));
343
352
  // Avoid Edge bug where empty style elements don't create sheets
344
353
  element.appendChild(document.createTextNode(''));
345
354
  this.sheet = getSheet(element);
346
355
  this.length = 0;
347
356
  }
348
- insertRule(index, rule) {
357
+ CSSOMTag.prototype.insertRule = function (index, rule) {
349
358
  try {
350
359
  this.sheet.insertRule(rule, index);
351
360
  this.length++;
@@ -354,13 +363,13 @@ const CSSOMTag = class CSSOMTag {
354
363
  catch (_error) {
355
364
  return false;
356
365
  }
357
- }
358
- deleteRule(index) {
366
+ };
367
+ CSSOMTag.prototype.deleteRule = function (index) {
359
368
  this.sheet.deleteRule(index);
360
369
  this.length--;
361
- }
362
- getRule(index) {
363
- const rule = this.sheet.cssRules[index];
370
+ };
371
+ CSSOMTag.prototype.getRule = function (index) {
372
+ var rule = this.sheet.cssRules[index];
364
373
  // Avoid IE11 quirk where cssText is inaccessible on some invalid rules
365
374
  if (rule !== undefined && typeof rule.cssText === 'string') {
366
375
  return rule.cssText;
@@ -368,22 +377,20 @@ const CSSOMTag = class CSSOMTag {
368
377
  else {
369
378
  return '';
370
379
  }
371
- }
372
- };
380
+ };
381
+ return CSSOMTag;
382
+ }());
373
383
  /** A Tag that emulates the CSSStyleSheet API but uses text nodes */
374
- const TextTag = class TextTag {
375
- element;
376
- nodes;
377
- length;
378
- constructor(target) {
379
- const element = (this.element = makeStyleTag(target));
384
+ var TextTag = /** @class */ (function () {
385
+ function TextTag(target) {
386
+ var element = (this.element = makeStyleTag(target));
380
387
  this.nodes = element.childNodes;
381
388
  this.length = 0;
382
389
  }
383
- insertRule(index, rule) {
390
+ TextTag.prototype.insertRule = function (index, rule) {
384
391
  if (index <= this.length && index >= 0) {
385
- const node = document.createTextNode(rule);
386
- const refNode = this.nodes[index];
392
+ var node = document.createTextNode(rule);
393
+ var refNode = this.nodes[index];
387
394
  this.element.insertBefore(node, refNode || null);
388
395
  this.length++;
389
396
  return true;
@@ -391,29 +398,28 @@ const TextTag = class TextTag {
391
398
  else {
392
399
  return false;
393
400
  }
394
- }
395
- deleteRule(index) {
401
+ };
402
+ TextTag.prototype.deleteRule = function (index) {
396
403
  this.element.removeChild(this.nodes[index]);
397
404
  this.length--;
398
- }
399
- getRule(index) {
405
+ };
406
+ TextTag.prototype.getRule = function (index) {
400
407
  if (index < this.length) {
401
408
  return this.nodes[index].textContent;
402
409
  }
403
410
  else {
404
411
  return '';
405
412
  }
406
- }
407
- };
413
+ };
414
+ return TextTag;
415
+ }());
408
416
  /** A completely virtual (server-side) Tag that doesn't manipulate the DOM */
409
- const VirtualTag = class VirtualTag {
410
- rules;
411
- length;
412
- constructor(_target) {
417
+ var VirtualTag = /** @class */ (function () {
418
+ function VirtualTag(_target) {
413
419
  this.rules = [];
414
420
  this.length = 0;
415
421
  }
416
- insertRule(index, rule) {
422
+ VirtualTag.prototype.insertRule = function (index, rule) {
417
423
  if (index <= this.length) {
418
424
  this.rules.splice(index, 0, rule);
419
425
  this.length++;
@@ -422,42 +428,33 @@ const VirtualTag = class VirtualTag {
422
428
  else {
423
429
  return false;
424
430
  }
425
- }
426
- deleteRule(index) {
431
+ };
432
+ VirtualTag.prototype.deleteRule = function (index) {
427
433
  this.rules.splice(index, 1);
428
434
  this.length--;
429
- }
430
- getRule(index) {
435
+ };
436
+ VirtualTag.prototype.getRule = function (index) {
431
437
  if (index < this.length) {
432
438
  return this.rules[index];
433
439
  }
434
440
  else {
435
441
  return '';
436
442
  }
437
- }
438
- };
443
+ };
444
+ return VirtualTag;
445
+ }());
439
446
 
440
- let SHOULD_REHYDRATE = IS_BROWSER;
441
- const defaultOptions = {
447
+ var SHOULD_REHYDRATE = IS_BROWSER;
448
+ var defaultOptions = {
442
449
  isServer: !IS_BROWSER,
443
450
  useCSSOMInjection: !DISABLE_SPEEDY,
444
451
  };
445
452
  /** Contains the main stylesheet logic for stringification and caching */
446
- class StyleSheet {
447
- gs;
448
- names;
449
- options;
450
- server;
451
- tag;
452
- /** Register a group ID to give it an index */
453
- static registerId(id) {
454
- return getGroupForId(id);
455
- }
456
- constructor(options = EMPTY_OBJECT, globalStyles = {}, names) {
457
- this.options = {
458
- ...defaultOptions,
459
- ...options,
460
- };
453
+ var StyleSheet = /** @class */ (function () {
454
+ function StyleSheet(options, globalStyles, names) {
455
+ if (options === void 0) { options = EMPTY_OBJECT; }
456
+ if (globalStyles === void 0) { globalStyles = {}; }
457
+ this.options = tslib.__assign(tslib.__assign({}, defaultOptions), options);
461
458
  this.gs = globalStyles;
462
459
  this.names = new Map(names);
463
460
  this.server = !!options.isServer;
@@ -467,89 +464,103 @@ class StyleSheet {
467
464
  rehydrateSheet(this);
468
465
  }
469
466
  }
470
- reconstructWithOptions(options, withNames = true) {
471
- return new StyleSheet({ ...this.options, ...options }, this.gs, (withNames && this.names) || undefined);
472
- }
473
- allocateGSInstance(id) {
467
+ /** Register a group ID to give it an index */
468
+ StyleSheet.registerId = function (id) {
469
+ return getGroupForId(id);
470
+ };
471
+ StyleSheet.prototype.reconstructWithOptions = function (options, withNames) {
472
+ if (withNames === void 0) { withNames = true; }
473
+ return new StyleSheet(tslib.__assign(tslib.__assign({}, this.options), options), this.gs, (withNames && this.names) || undefined);
474
+ };
475
+ StyleSheet.prototype.allocateGSInstance = function (id) {
474
476
  return (this.gs[id] = (this.gs[id] || 0) + 1);
475
- }
477
+ };
476
478
  /** Lazily initialises a GroupedTag for when it's actually needed */
477
- getTag() {
479
+ StyleSheet.prototype.getTag = function () {
478
480
  return this.tag || (this.tag = makeGroupedTag(makeTag(this.options)));
479
- }
481
+ };
480
482
  /** Check whether a name is known for caching */
481
- hasNameForId(id, name) {
483
+ StyleSheet.prototype.hasNameForId = function (id, name) {
482
484
  return this.names.has(id) && this.names.get(id).has(name);
483
- }
485
+ };
484
486
  /** Mark a group's name as known for caching */
485
- registerName(id, name) {
487
+ StyleSheet.prototype.registerName = function (id, name) {
486
488
  getGroupForId(id);
487
489
  if (!this.names.has(id)) {
488
- const groupNames = new Set();
490
+ var groupNames = new Set();
489
491
  groupNames.add(name);
490
492
  this.names.set(id, groupNames);
491
493
  }
492
494
  else {
493
495
  this.names.get(id).add(name);
494
496
  }
495
- }
497
+ };
496
498
  /** Insert new rules which also marks the name as known */
497
- insertRules(id, name, rules) {
499
+ StyleSheet.prototype.insertRules = function (id, name, rules) {
498
500
  this.registerName(id, name);
499
501
  this.getTag().insertRules(getGroupForId(id), rules);
500
- }
502
+ };
501
503
  /** Clears all cached names for a given group ID */
502
- clearNames(id) {
504
+ StyleSheet.prototype.clearNames = function (id) {
503
505
  if (this.names.has(id)) {
504
506
  this.names.get(id).clear();
505
507
  }
506
- }
508
+ };
507
509
  /** Clears all rules for a given group ID */
508
- clearRules(id) {
510
+ StyleSheet.prototype.clearRules = function (id) {
509
511
  this.getTag().clearGroup(getGroupForId(id));
510
512
  this.clearNames(id);
511
- }
513
+ };
512
514
  /** Clears the entire tag which deletes all rules but not its names */
513
- clearTag() {
515
+ StyleSheet.prototype.clearTag = function () {
514
516
  // NOTE: This does not clear the names, since it's only used during SSR
515
517
  // so that we can continuously output only new rules
516
518
  this.tag = undefined;
517
- }
519
+ };
518
520
  /** Outputs the current sheet as a CSS string with markers for SSR */
519
- toString() {
521
+ StyleSheet.prototype.toString = function () {
520
522
  return outputSheet(this);
521
- }
522
- }
523
+ };
524
+ return StyleSheet;
525
+ }());
523
526
 
524
- const SEED = 5381;
527
+ var SEED = 5381;
525
528
  // When we have separate strings it's useful to run a progressive
526
529
  // version of djb2 where we pretend that we're still looping over
527
530
  // the same string
528
- const phash = (h, x) => {
529
- let i = x.length;
531
+ var phash = function (h, x) {
532
+ var i = x.length;
530
533
  while (i) {
531
534
  h = (h * 33) ^ x.charCodeAt(--i);
532
535
  }
533
536
  return h;
534
537
  };
535
538
  // This is a djb2 hashing function
536
- const hash = (x) => {
539
+ var hash = function (x) {
537
540
  return phash(SEED, x);
538
541
  };
539
542
 
540
- const COMMENT_REGEX = /^\s*\/\/.*$/gm;
541
- const COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
542
- function createStylisInstance({ options = EMPTY_OBJECT, plugins = EMPTY_ARRAY, } = EMPTY_OBJECT) {
543
- let _componentId;
544
- let _selector;
545
- let _selectorRegexp;
546
- let _consecutiveSelfRefRegExp;
547
- const selfReferenceReplacer = (match, offset, string) => {
543
+ var COMMENT_REGEX = /^\s*\/\/.*$/gm;
544
+ var COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
545
+ /**
546
+ * Serialize stylis output as an array of css strings. It is important that rules are
547
+ * separated when using CSSOM injection.
548
+ */
549
+ function serialize(children, callback) {
550
+ return children.map(function (c, i) { return callback(c, i, children, callback); }).filter(Boolean);
551
+ }
552
+ function createStylisInstance(_a) {
553
+ var _b = _a === void 0 ? EMPTY_OBJECT : _a, _c = _b.options, options = _c === void 0 ? EMPTY_OBJECT : _c, _d = _b.plugins, plugins = _d === void 0 ? EMPTY_ARRAY : _d;
554
+ var _componentId;
555
+ var _selector;
556
+ var _selectorRegexp;
557
+ var _consecutiveSelfRefRegExp;
558
+ var selfReferenceReplacer = function (match, offset, string) {
548
559
  if (
549
560
  // do not replace the first occurrence if it is complex (has a modifier)
550
561
  (offset === 0 ? !COMPLEX_SELECTOR_PREFIX.includes(string[_selector.length]) : true) && // no consecutive self refs (.b.b); that is a precedence boost and treated differently
551
562
  !string.match(_consecutiveSelfRefRegExp)) {
552
- return `.${_componentId}`;
563
+ return ".".concat(_componentId);
553
564
  }
554
565
  return match;
555
566
  };
@@ -565,31 +576,34 @@ function createStylisInstance({ options = EMPTY_OBJECT, plugins = EMPTY_ARRAY, }
565
576
  *
566
577
  * https://github.com/thysultan/stylis.js/tree/v4.0.2#abstract-syntax-structure
567
578
  */
568
- const selfReferenceReplacementPlugin = element => {
579
+ var selfReferenceReplacementPlugin = function (element) {
569
580
  if (element.type === stylis.RULESET && element.value.includes('&')) {
570
- const props = element.props;
581
+ var props = element.props;
571
582
  props[0] = props[0].replace(_selectorRegexp, selfReferenceReplacer);
572
583
  }
573
584
  };
574
- const stringifyRules = (css, selector = '', prefix = '', componentId = '&') => {
575
- let flatCSS = css.replace(COMMENT_REGEX, '');
585
+ var stringifyRules = function (css, selector, prefix, componentId) {
586
+ if (selector === void 0) { selector = ''; }
587
+ if (prefix === void 0) { prefix = ''; }
588
+ if (componentId === void 0) { componentId = '&'; }
589
+ var flatCSS = css.replace(COMMENT_REGEX, '');
576
590
  // stylis has no concept of state to be passed to plugins
577
591
  // but since JS is single-threaded, we can rely on that to ensure
578
592
  // these properties stay in sync with the current stylis run
579
593
  _componentId = componentId;
580
594
  _selector = selector;
581
- _selectorRegexp = new RegExp(`\\${_selector}\\b`, 'g');
582
- _consecutiveSelfRefRegExp = new RegExp(`(\\${_selector}\\b){2,}`);
583
- const middlewares = plugins.slice();
595
+ _selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
596
+ _consecutiveSelfRefRegExp = new RegExp("(\\".concat(_selector, "\\b){2,}"));
597
+ var middlewares = plugins.slice();
584
598
  if (options.prefix || options.prefix === undefined) {
585
599
  middlewares.unshift(stylis.prefixer);
586
600
  }
587
601
  middlewares.push(selfReferenceReplacementPlugin, stylis.stringify);
588
- return stylis.serialize(stylis.compile(prefix || selector ? `${prefix} ${selector} { ${flatCSS} }` : flatCSS), stylis.middleware(middlewares));
602
+ return serialize(stylis.compile(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS), stylis.middleware(middlewares));
589
603
  };
590
604
  stringifyRules.hash = plugins.length
591
605
  ? plugins
592
- .reduce((acc, plugin) => {
606
+ .reduce(function (acc, plugin) {
593
607
  if (!plugin.name) {
594
608
  throwStyledComponentsError(15);
595
609
  }
@@ -600,35 +614,36 @@ function createStylisInstance({ options = EMPTY_OBJECT, plugins = EMPTY_ARRAY, }
600
614
  return stringifyRules;
601
615
  }
602
616
 
603
- const StyleSheetContext = React__default["default"].createContext(undefined);
617
+ var StyleSheetContext = React__default["default"].createContext(undefined);
604
618
  StyleSheetContext.Consumer;
605
- const StylisContext = React__default["default"].createContext(undefined);
619
+ var StylisContext = React__default["default"].createContext(undefined);
606
620
  StylisContext.Consumer;
607
621
  new StyleSheet();
608
- const mainStylis = createStylisInstance();
622
+ var mainStylis = createStylisInstance();
609
623
 
610
- class Keyframes {
611
- id;
612
- name;
613
- rules;
614
- constructor(name, rules) {
624
+ var Keyframes = /** @class */ (function () {
625
+ function Keyframes(name, rules) {
626
+ var _this = this;
627
+ this.inject = function (styleSheet, stylisInstance) {
628
+ if (stylisInstance === void 0) { stylisInstance = mainStylis; }
629
+ var resolvedName = _this.name + stylisInstance.hash;
630
+ if (!styleSheet.hasNameForId(_this.id, resolvedName)) {
631
+ styleSheet.insertRules(_this.id, resolvedName, stylisInstance(_this.rules, resolvedName, '@keyframes'));
632
+ }
633
+ };
634
+ this.toString = function () {
635
+ throw throwStyledComponentsError(12, String(_this.name));
636
+ };
615
637
  this.name = name;
616
- this.id = `sc-keyframes-${name}`;
638
+ this.id = "sc-keyframes-".concat(name);
617
639
  this.rules = rules;
618
640
  }
619
- inject = (styleSheet, stylisInstance = mainStylis) => {
620
- const resolvedName = this.name + stylisInstance.hash;
621
- if (!styleSheet.hasNameForId(this.id, resolvedName)) {
622
- styleSheet.insertRules(this.id, resolvedName, stylisInstance(this.rules, resolvedName, '@keyframes'));
623
- }
624
- };
625
- toString = () => {
626
- throw throwStyledComponentsError(12, String(this.name));
627
- };
628
- getName(stylisInstance = mainStylis) {
641
+ Keyframes.prototype.getName = function (stylisInstance) {
642
+ if (stylisInstance === void 0) { stylisInstance = mainStylis; }
629
643
  return this.name + stylisInstance.hash;
630
- }
631
- }
644
+ };
645
+ return Keyframes;
646
+ }());
632
647
 
633
648
  // Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js
634
649
  function addUnitIfNeeded(name, value) {
@@ -637,7 +652,7 @@ function addUnitIfNeeded(name, value) {
637
652
  return '';
638
653
  }
639
654
  if (typeof value === 'number' && value !== 0 && !(name in unitless__default["default"])) {
640
- return `${value}px`; // Presumes implicit 'px' suffix for unitless numbers
655
+ return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers
641
656
  }
642
657
  return String(value).trim();
643
658
  }
@@ -653,10 +668,10 @@ function getComponentName(target) {
653
668
  * inlined version of
654
669
  * https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js
655
670
  */
656
- const uppercaseCheck = /([A-Z])/;
657
- const uppercasePattern = /([A-Z])/g;
658
- const msPattern = /^ms-/;
659
- const prefixAndLowerCase = (char) => `-${char.toLowerCase()}`;
671
+ var uppercaseCheck = /([A-Z])/;
672
+ var uppercasePattern = /([A-Z])/g;
673
+ var msPattern = /^ms-/;
674
+ var prefixAndLowerCase = function (char) { return "-".concat(char.toLowerCase()); };
660
675
  /**
661
676
  * Hyphenates a camelcased CSS property name, for example:
662
677
  *
@@ -702,33 +717,35 @@ function isStyledComponent(target) {
702
717
  /**
703
718
  * It's falsish not falsy because 0 is allowed.
704
719
  */
705
- const isFalsish = (chunk) => chunk === undefined || chunk === null || chunk === false || chunk === '';
706
- const objToCssArray = (obj, prevKey) => {
707
- const rules = [];
708
- for (const key in obj) {
720
+ var isFalsish = function (chunk) {
721
+ return chunk === undefined || chunk === null || chunk === false || chunk === '';
722
+ };
723
+ var objToCssArray = function (obj, prevKey) {
724
+ var rules = [];
725
+ for (var key in obj) {
709
726
  if (!obj.hasOwnProperty(key) || isFalsish(obj[key]))
710
727
  continue;
711
728
  if ((Array.isArray(obj[key]) && obj[key].isCss) || isFunction(obj[key])) {
712
- rules.push(`${hyphenateStyleName(key)}:`, obj[key], ';');
729
+ rules.push("".concat(hyphenateStyleName(key), ":"), obj[key], ';');
713
730
  }
714
731
  else if (isPlainObject(obj[key])) {
715
- rules.push(...objToCssArray(obj[key], key));
732
+ rules.push.apply(rules, objToCssArray(obj[key], key));
716
733
  }
717
734
  else {
718
- rules.push(`${hyphenateStyleName(key)}: ${addUnitIfNeeded(key, obj[key])};`);
735
+ rules.push("".concat(hyphenateStyleName(key), ": ").concat(addUnitIfNeeded(key, obj[key]), ";"));
719
736
  }
720
737
  }
721
- return prevKey ? [`${prevKey} {`, ...rules, '}'] : rules;
738
+ return prevKey ? tslib.__spreadArray(tslib.__spreadArray(["".concat(prevKey, " {")], rules, true), ['}'], false) : rules;
722
739
  };
723
740
  function flatten(chunk, executionContext, styleSheet, stylisInstance) {
724
741
  if (Array.isArray(chunk)) {
725
- const ruleSet = [];
726
- for (let i = 0, len = chunk.length, result; i < len; i += 1) {
742
+ var ruleSet = [];
743
+ for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
727
744
  result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
728
745
  if (result === '')
729
746
  continue;
730
747
  else if (Array.isArray(result))
731
- ruleSet.push(...result);
748
+ ruleSet.push.apply(ruleSet, result);
732
749
  else
733
750
  ruleSet.push(result);
734
751
  }
@@ -739,22 +756,22 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
739
756
  }
740
757
  /* Handle other components */
741
758
  if (isStyledComponent(chunk)) {
742
- return `.${chunk.styledComponentId}`;
759
+ return ".".concat(chunk.styledComponentId);
743
760
  }
744
761
  /* Either execute or defer the function */
745
762
  if (isFunction(chunk)) {
746
763
  if (isStatelessFunction(chunk) && executionContext) {
747
- const chunkFn = chunk;
748
- const result = chunkFn(executionContext);
764
+ var chunkFn = chunk;
765
+ var result = chunkFn(executionContext);
749
766
  if (process.env.NODE_ENV !== 'production' &&
750
767
  typeof result === 'object' &&
751
768
  !Array.isArray(result) &&
752
769
  !(result instanceof Keyframes) &&
753
770
  !isPlainObject(result)) {
754
771
  // eslint-disable-next-line no-console
755
- console.error(`${getComponentName(
772
+ console.error("".concat(getComponentName(
756
773
  // @ts-expect-error handling unexpected input
757
- chunkFn)} is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.`);
774
+ chunkFn), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details."));
758
775
  }
759
776
  return flatten(result, executionContext, styleSheet, stylisInstance);
760
777
  }
@@ -774,8 +791,8 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
774
791
  }
775
792
 
776
793
  function interleave(strings, interpolations) {
777
- const result = [strings[0]];
778
- for (let i = 0, len = interpolations.length; i < len; i += 1) {
794
+ var result = [strings[0]];
795
+ for (var i = 0, len = interpolations.length; i < len; i += 1) {
779
796
  result.push(interpolations[i], strings[i + 1]);
780
797
  }
781
798
  return result;
@@ -785,22 +802,25 @@ function interleave(strings, interpolations) {
785
802
  * Used when flattening object styles to determine if we should
786
803
  * expand an array of styles.
787
804
  */
788
- const addTag = (arg) => {
805
+ var addTag = function (arg) {
789
806
  if (Array.isArray(arg)) {
790
807
  // eslint-disable-next-line no-param-reassign
791
808
  arg.isCss = true;
792
809
  }
793
810
  return arg;
794
811
  };
795
- function css(styles, ...interpolations) {
812
+ function css(styles) {
813
+ var interpolations = [];
814
+ for (var _i = 1; _i < arguments.length; _i++) {
815
+ interpolations[_i - 1] = arguments[_i];
816
+ }
796
817
  if (isFunction(styles) || isPlainObject(styles)) {
797
- const styleFunctionOrObject = styles;
798
- return addTag(flatten(interleave(EMPTY_ARRAY, [
799
- styleFunctionOrObject,
800
- ...interpolations,
801
- ])));
818
+ var styleFunctionOrObject = styles;
819
+ return addTag(flatten(interleave(EMPTY_ARRAY, tslib.__spreadArray([
820
+ styleFunctionOrObject
821
+ ], interpolations, true))));
802
822
  }
803
- const styleStringArray = styles;
823
+ var styleStringArray = styles;
804
824
  if (interpolations.length === 0 &&
805
825
  styleStringArray.length === 1 &&
806
826
  typeof styleStringArray[0] === 'string') {
@@ -809,7 +829,8 @@ function css(styles, ...interpolations) {
809
829
  return addTag(flatten(interleave(styleStringArray, interpolations)));
810
830
  }
811
831
 
812
- function constructWithOptions(componentConstructor, tag, options = EMPTY_OBJECT) {
832
+ function constructWithOptions(componentConstructor, tag, options) {
833
+ if (options === void 0) { options = EMPTY_OBJECT; }
813
834
  // We trust that the tag is a valid component as long as it isn't falsish
814
835
  // Typically the tag here is a string or function (i.e. class or pure function component)
815
836
  // However a component may also be an object if it uses another utility, e.g. React.memo
@@ -818,30 +839,34 @@ function constructWithOptions(componentConstructor, tag, options = EMPTY_OBJECT)
818
839
  throw throwStyledComponentsError(1, tag);
819
840
  }
820
841
  /* This is callable directly as a template function */
821
- const templateFunction = (initialStyles, ...interpolations) => componentConstructor(tag, options, css(initialStyles, ...interpolations));
842
+ var templateFunction = function (initialStyles) {
843
+ var interpolations = [];
844
+ for (var _i = 1; _i < arguments.length; _i++) {
845
+ interpolations[_i - 1] = arguments[_i];
846
+ }
847
+ return componentConstructor(tag, options, css.apply(void 0, tslib.__spreadArray([initialStyles], interpolations, false)));
848
+ };
822
849
  /* Modify/inject new props at runtime */
823
- templateFunction.attrs = (attrs) => constructWithOptions(componentConstructor, tag, {
824
- ...options,
825
- attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean),
826
- });
850
+ templateFunction.attrs = function (attrs) {
851
+ return constructWithOptions(componentConstructor, tag, tslib.__assign(tslib.__assign({}, options), { attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean) }));
852
+ };
827
853
  /**
828
854
  * If config methods are called, wrap up a new template function and merge options */
829
- templateFunction.withConfig = (config) => constructWithOptions(componentConstructor, tag, {
830
- ...options,
831
- ...config,
832
- });
855
+ templateFunction.withConfig = function (config) {
856
+ return constructWithOptions(componentConstructor, tag, tslib.__assign(tslib.__assign({}, options), config));
857
+ };
833
858
  return templateFunction;
834
859
  }
835
860
 
836
- const ThemeContext = React__default["default"].createContext(undefined);
837
- const ThemeConsumer = ThemeContext.Consumer;
861
+ var ThemeContext = React__default["default"].createContext(undefined);
862
+ var ThemeConsumer = ThemeContext.Consumer;
838
863
  function mergeTheme(theme, outerTheme) {
839
864
  if (!theme) {
840
865
  throw throwStyledComponentsError(14);
841
866
  }
842
867
  if (isFunction(theme)) {
843
- const themeFn = theme;
844
- const mergedTheme = themeFn(outerTheme);
868
+ var themeFn = theme;
869
+ var mergedTheme = themeFn(outerTheme);
845
870
  if (process.env.NODE_ENV !== 'production' &&
846
871
  (mergedTheme === null || Array.isArray(mergedTheme) || typeof mergedTheme !== 'object')) {
847
872
  throw throwStyledComponentsError(7);
@@ -851,32 +876,34 @@ function mergeTheme(theme, outerTheme) {
851
876
  if (Array.isArray(theme) || typeof theme !== 'object') {
852
877
  throw throwStyledComponentsError(8);
853
878
  }
854
- return outerTheme ? { ...outerTheme, ...theme } : theme;
879
+ return outerTheme ? tslib.__assign(tslib.__assign({}, outerTheme), theme) : theme;
855
880
  }
856
881
  /**
857
882
  * Provide a theme to an entire react component tree via context
858
883
  */
859
884
  function ThemeProvider(props) {
860
- const outerTheme = React.useContext(ThemeContext);
861
- const themeContext = React.useMemo(() => mergeTheme(props.theme, outerTheme), [props.theme, outerTheme]);
885
+ var outerTheme = React.useContext(ThemeContext);
886
+ var themeContext = React.useMemo(function () { return mergeTheme(props.theme, outerTheme); }, [props.theme, outerTheme]);
862
887
  if (!props.children) {
863
888
  return null;
864
889
  }
865
890
  return React__default["default"].createElement(ThemeContext.Provider, { value: themeContext }, props.children);
866
891
  }
867
892
 
868
- function determineTheme(props, providedTheme, defaultProps = EMPTY_OBJECT) {
893
+ function determineTheme(props, providedTheme, defaultProps) {
894
+ if (defaultProps === void 0) { defaultProps = EMPTY_OBJECT; }
869
895
  return (props.theme !== defaultProps.theme && props.theme) || providedTheme || defaultProps.theme;
870
896
  }
871
897
 
872
- const hasSymbol = typeof Symbol === 'function' && Symbol.for;
898
+ var _a;
899
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
873
900
  // copied from react-is
874
- const REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
875
- const REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
901
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
902
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
876
903
  /**
877
904
  * Adapted from hoist-non-react-statics to avoid the react-is dependency.
878
905
  */
879
- const REACT_STATICS = {
906
+ var REACT_STATICS = {
880
907
  childContextTypes: true,
881
908
  contextType: true,
882
909
  contextTypes: true,
@@ -889,7 +916,7 @@ const REACT_STATICS = {
889
916
  propTypes: true,
890
917
  type: true,
891
918
  };
892
- const KNOWN_STATICS = {
919
+ var KNOWN_STATICS = {
893
920
  name: true,
894
921
  length: true,
895
922
  prototype: true,
@@ -898,14 +925,14 @@ const KNOWN_STATICS = {
898
925
  arguments: true,
899
926
  arity: true,
900
927
  };
901
- const FORWARD_REF_STATICS = {
928
+ var FORWARD_REF_STATICS = {
902
929
  $$typeof: true,
903
930
  render: true,
904
931
  defaultProps: true,
905
932
  displayName: true,
906
933
  propTypes: true,
907
934
  };
908
- const MEMO_STATICS = {
935
+ var MEMO_STATICS = {
909
936
  $$typeof: true,
910
937
  compare: true,
911
938
  defaultProps: true,
@@ -913,13 +940,13 @@ const MEMO_STATICS = {
913
940
  propTypes: true,
914
941
  type: true,
915
942
  };
916
- const TYPE_STATICS = {
917
- [REACT_FORWARD_REF_TYPE]: FORWARD_REF_STATICS,
918
- [REACT_MEMO_TYPE]: MEMO_STATICS,
919
- };
943
+ var TYPE_STATICS = (_a = {},
944
+ _a[REACT_FORWARD_REF_TYPE] = FORWARD_REF_STATICS,
945
+ _a[REACT_MEMO_TYPE] = MEMO_STATICS,
946
+ _a);
920
947
  // adapted from react-is
921
948
  function isMemo(object) {
922
- const $$typeofType = 'type' in object && object.type.$$typeof;
949
+ var $$typeofType = 'type' in object && object.type.$$typeof;
923
950
  return $$typeofType === REACT_MEMO_TYPE;
924
951
  }
925
952
  function getStatics(component) {
@@ -932,34 +959,34 @@ function getStatics(component) {
932
959
  ? TYPE_STATICS[component['$$typeof']]
933
960
  : REACT_STATICS;
934
961
  }
935
- const defineProperty = Object.defineProperty;
936
- const getOwnPropertyNames = Object.getOwnPropertyNames;
937
- const getOwnPropertySymbols = Object.getOwnPropertySymbols;
938
- const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
939
- const getPrototypeOf = Object.getPrototypeOf;
940
- const objectPrototype = Object.prototype;
962
+ var defineProperty = Object.defineProperty;
963
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
964
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
965
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
966
+ var getPrototypeOf = Object.getPrototypeOf;
967
+ var objectPrototype = Object.prototype;
941
968
  function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
942
969
  if (typeof sourceComponent !== 'string') {
943
970
  // don't hoist over string (html) components
944
971
  if (objectPrototype) {
945
- const inheritedComponent = getPrototypeOf(sourceComponent);
972
+ var inheritedComponent = getPrototypeOf(sourceComponent);
946
973
  if (inheritedComponent && inheritedComponent !== objectPrototype) {
947
974
  hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);
948
975
  }
949
976
  }
950
- let keys = getOwnPropertyNames(sourceComponent);
977
+ var keys = getOwnPropertyNames(sourceComponent);
951
978
  if (getOwnPropertySymbols) {
952
979
  keys = keys.concat(getOwnPropertySymbols(sourceComponent));
953
980
  }
954
- const targetStatics = getStatics(targetComponent);
955
- const sourceStatics = getStatics(sourceComponent);
956
- for (let i = 0; i < keys.length; ++i) {
957
- const key = keys[i];
981
+ var targetStatics = getStatics(targetComponent);
982
+ var sourceStatics = getStatics(sourceComponent);
983
+ for (var i = 0; i < keys.length; ++i) {
984
+ var key = keys[i];
958
985
  if (!(key in KNOWN_STATICS) &&
959
986
  !(excludelist && excludelist[key]) &&
960
987
  !(sourceStatics && key in sourceStatics) &&
961
988
  !(targetStatics && key in targetStatics)) {
962
- const descriptor = getOwnPropertyDescriptor(sourceComponent, key);
989
+ var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
963
990
  try {
964
991
  // Avoid failures from read-only properties
965
992
  defineProperty(targetComponent, key, descriptor);
@@ -974,31 +1001,31 @@ function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
974
1001
  }
975
1002
 
976
1003
  function withTheme(Component) {
977
- const WithTheme = React__default["default"].forwardRef((props, ref) => {
978
- const theme = React__default["default"].useContext(ThemeContext);
979
- const themeProp = determineTheme(props, theme, Component.defaultProps);
1004
+ var WithTheme = React__default["default"].forwardRef(function (props, ref) {
1005
+ var theme = React__default["default"].useContext(ThemeContext);
1006
+ var themeProp = determineTheme(props, theme, Component.defaultProps);
980
1007
  if (process.env.NODE_ENV !== 'production' && themeProp === undefined) {
981
1008
  // eslint-disable-next-line no-console
982
- console.warn(`[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "${getComponentName(Component)}"`);
1009
+ console.warn("[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class \"".concat(getComponentName(Component), "\""));
983
1010
  }
984
- return React__default["default"].createElement(Component, { ...props, theme: themeProp, ref: ref });
1011
+ return React__default["default"].createElement(Component, tslib.__assign({}, props, { theme: themeProp, ref: ref }));
985
1012
  });
986
- WithTheme.displayName = `WithTheme(${getComponentName(Component)})`;
1013
+ WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
987
1014
  return hoistNonReactStatics(WithTheme, Component);
988
1015
  }
989
1016
 
990
- const useTheme = () => React.useContext(ThemeContext);
1017
+ var useTheme = function () { return React.useContext(ThemeContext); };
991
1018
 
992
- const AD_REPLACER_R = /(a)(d)/gi;
1019
+ var AD_REPLACER_R = /(a)(d)/gi;
993
1020
  /* This is the "capacity" of our alphabet i.e. 2x26 for all letters plus their capitalised
994
1021
  * counterparts */
995
- const charsLength = 52;
1022
+ var charsLength = 52;
996
1023
  /* start at 75 for 'a' until 'z' (25) and then start at 65 for capitalised letters */
997
- const getAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
1024
+ var getAlphabeticChar = function (code) { return String.fromCharCode(code + (code > 25 ? 39 : 97)); };
998
1025
  /* input a number, usually a hash and convert it to base-52 */
999
1026
  function generateAlphabeticName(code) {
1000
- let name = '';
1001
- let x;
1027
+ var name = '';
1028
+ var x;
1002
1029
  /* get a char and divide by alphabet-length */
1003
1030
  for (x = Math.abs(code); x > charsLength; x = (x / charsLength) | 0) {
1004
1031
  name = getAlphabeticChar(x % charsLength) + name;
@@ -1010,41 +1037,41 @@ function generateComponentId(str) {
1010
1037
  return generateAlphabeticName(hash(str) >>> 0);
1011
1038
  }
1012
1039
 
1013
- let generated = {};
1040
+ var generated = {};
1014
1041
  /**
1015
1042
  * InlineStyle takes arbitrary CSS and generates a flat object
1016
1043
  */
1017
1044
  function makeInlineStyleClass(styleSheet) {
1018
- const InlineStyle = class InlineStyle {
1019
- rules;
1020
- constructor(rules) {
1045
+ var InlineStyle = /** @class */ (function () {
1046
+ function InlineStyle(rules) {
1021
1047
  this.rules = rules;
1022
1048
  }
1023
- generateStyleObject(executionContext) {
1049
+ InlineStyle.prototype.generateStyleObject = function (executionContext) {
1024
1050
  // keyframes, functions, and component selectors are not allowed for React Native
1025
- const flatCSS = flatten(this.rules, executionContext).join('');
1026
- const hash = generateComponentId(flatCSS);
1051
+ var flatCSS = flatten(this.rules, executionContext).join('');
1052
+ var hash = generateComponentId(flatCSS);
1027
1053
  if (!generated[hash]) {
1028
- const root = postcss.parse(flatCSS);
1029
- const declPairs = [];
1030
- root.each(node => {
1054
+ var root = postcss.parse(flatCSS);
1055
+ var declPairs_1 = [];
1056
+ root.each(function (node) {
1031
1057
  if (node.type === 'decl') {
1032
- declPairs.push([node.prop, node.value]);
1058
+ declPairs_1.push([node.prop, node.value]);
1033
1059
  }
1034
1060
  else if (process.env.NODE_ENV !== 'production' && node.type !== 'comment') {
1035
1061
  /* eslint-disable no-console */
1036
- console.warn(`Node of type ${node.type} not supported as an inline style`);
1062
+ console.warn("Node of type ".concat(node.type, " not supported as an inline style"));
1037
1063
  }
1038
1064
  });
1039
- const styleObject = transformDeclPairs__default["default"](declPairs);
1040
- const styles = styleSheet.create({
1065
+ var styleObject = transformDeclPairs__default["default"](declPairs_1);
1066
+ var styles = styleSheet.create({
1041
1067
  generated: styleObject,
1042
1068
  });
1043
1069
  generated[hash] = styles.generated;
1044
1070
  }
1045
1071
  return generated[hash];
1046
- }
1047
- };
1072
+ };
1073
+ return InlineStyle;
1074
+ }());
1048
1075
  return InlineStyle;
1049
1076
  }
1050
1077
 
@@ -1056,22 +1083,23 @@ function isTag(target) {
1056
1083
  }
1057
1084
 
1058
1085
  function generateDisplayName(target) {
1059
- return isTag(target) ? `styled.${target}` : `Styled(${getComponentName(target)})`;
1086
+ return isTag(target) ? "styled.".concat(target) : "Styled(".concat(getComponentName(target), ")");
1060
1087
  }
1061
1088
 
1062
- function mixinRecursively(target, source, forceMerge = false) {
1089
+ function mixinRecursively(target, source, forceMerge) {
1090
+ if (forceMerge === void 0) { forceMerge = false; }
1063
1091
  /* only merge into POJOs, Arrays, but for top level objects only
1064
1092
  * allow to merge into anything by passing forceMerge = true */
1065
1093
  if (!forceMerge && !isPlainObject(target) && !Array.isArray(target)) {
1066
1094
  return source;
1067
1095
  }
1068
1096
  if (Array.isArray(source)) {
1069
- for (let key = 0; key < source.length; key++) {
1097
+ for (var key = 0; key < source.length; key++) {
1070
1098
  target[key] = mixinRecursively(target[key], source[key]);
1071
1099
  }
1072
1100
  }
1073
1101
  else if (isPlainObject(source)) {
1074
- for (const key in source) {
1102
+ for (var key in source) {
1075
1103
  target[key] = mixinRecursively(target[key], source[key]);
1076
1104
  }
1077
1105
  }
@@ -1082,23 +1110,30 @@ function mixinRecursively(target, source, forceMerge = false) {
1082
1110
  * If target is not a POJO or an Array, it will get source properties injected via shallow merge
1083
1111
  * Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
1084
1112
  */
1085
- function mixinDeep(target = {}, ...sources) {
1086
- for (const source of sources) {
1113
+ function mixinDeep(target) {
1114
+ if (target === void 0) { target = {}; }
1115
+ var sources = [];
1116
+ for (var _i = 1; _i < arguments.length; _i++) {
1117
+ sources[_i - 1] = arguments[_i];
1118
+ }
1119
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
1120
+ var source = sources_1[_a];
1087
1121
  mixinRecursively(target, source, true);
1088
1122
  }
1089
1123
  return target;
1090
1124
  }
1091
1125
 
1092
- function useResolvedAttrs(theme = EMPTY_OBJECT, props, attrs) {
1126
+ function useResolvedAttrs(theme, props, attrs) {
1127
+ if (theme === void 0) { theme = EMPTY_OBJECT; }
1093
1128
  // NOTE: can't memoize this
1094
1129
  // returns [context, resolvedAttrs]
1095
1130
  // where resolvedAttrs is only the things injected by the attrs themselves
1096
- const context = { ...props, theme };
1097
- const resolvedAttrs = {};
1098
- attrs.forEach(attrDef => {
1131
+ var context = tslib.__assign(tslib.__assign({}, props), { theme: theme });
1132
+ var resolvedAttrs = {};
1133
+ attrs.forEach(function (attrDef) {
1099
1134
  // @ts-expect-error narrowing isn't working properly for some reason
1100
- let resolvedAttrDef = typeof attrDef === 'function' ? attrDef(context) : attrDef;
1101
- let key;
1135
+ var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(context) : attrDef;
1136
+ var key;
1102
1137
  /* eslint-disable guard-for-in */
1103
1138
  for (key in resolvedAttrDef) {
1104
1139
  // @ts-expect-error bad types
@@ -1109,21 +1144,21 @@ function useResolvedAttrs(theme = EMPTY_OBJECT, props, attrs) {
1109
1144
  return [context, resolvedAttrs];
1110
1145
  }
1111
1146
  // Validator defaults to true if not in HTML/DOM env
1112
- const validAttr = () => true;
1147
+ var validAttr = function () { return true; };
1113
1148
  function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
1114
- const { attrs: componentAttrs, inlineStyle, defaultProps, shouldForwardProp, target, } = forwardedComponent;
1149
+ var componentAttrs = forwardedComponent.attrs, inlineStyle = forwardedComponent.inlineStyle, defaultProps = forwardedComponent.defaultProps, shouldForwardProp = forwardedComponent.shouldForwardProp, target = forwardedComponent.target;
1115
1150
  // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
1116
1151
  // but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
1117
1152
  // should be an immutable value, but behave for now.
1118
- const theme = determineTheme(props, React.useContext(ThemeContext), defaultProps);
1119
- const [context, attrs] = useResolvedAttrs(theme || EMPTY_OBJECT, props, componentAttrs);
1120
- const generatedStyles = inlineStyle.generateStyleObject(context);
1121
- const refToForward = forwardedRef;
1122
- const elementToBeCreated = attrs.$as || props.$as || attrs.as || props.as || target;
1123
- const computedProps = attrs !== props ? { ...props, ...attrs } : props;
1124
- const propsForElement = {};
1153
+ var theme = determineTheme(props, React.useContext(ThemeContext), defaultProps);
1154
+ var _a = useResolvedAttrs(theme || EMPTY_OBJECT, props, componentAttrs), context = _a[0], attrs = _a[1];
1155
+ var generatedStyles = inlineStyle.generateStyleObject(context);
1156
+ var refToForward = forwardedRef;
1157
+ var elementToBeCreated = attrs.$as || props.$as || attrs.as || props.as || target;
1158
+ var computedProps = attrs !== props ? tslib.__assign(tslib.__assign({}, props), attrs) : props;
1159
+ var propsForElement = {};
1125
1160
  // eslint-disable-next-line guard-for-in
1126
- for (const key in computedProps) {
1161
+ for (var key in computedProps) {
1127
1162
  if (key[0] === '$' || key === 'as')
1128
1163
  continue;
1129
1164
  else if (key === 'forwardedAs') {
@@ -1133,9 +1168,9 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
1133
1168
  propsForElement[key] = computedProps[key];
1134
1169
  }
1135
1170
  }
1136
- propsForElement.style = React.useMemo(() => {
1171
+ propsForElement.style = React.useMemo(function () {
1137
1172
  if (typeof props.style === 'function') {
1138
- return (state) => {
1173
+ return function (state) {
1139
1174
  return [generatedStyles].concat(props.style(state));
1140
1175
  };
1141
1176
  }
@@ -1149,39 +1184,42 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
1149
1184
  propsForElement.ref = refToForward;
1150
1185
  return React.createElement(elementToBeCreated, propsForElement);
1151
1186
  }
1152
- var _StyledNativeComponent = (InlineStyle) => {
1153
- const createStyledNativeComponent = (target, options, rules) => {
1154
- const isTargetStyledComp = isStyledComponent(target);
1155
- const styledComponentTarget = target;
1156
- const { displayName = generateDisplayName(target), attrs = EMPTY_ARRAY } = options;
1187
+ var _StyledNativeComponent = (function (InlineStyle) {
1188
+ var createStyledNativeComponent = function (target, options, rules) {
1189
+ var isTargetStyledComp = isStyledComponent(target);
1190
+ var styledComponentTarget = target;
1191
+ var _a = options.displayName, displayName = _a === void 0 ? generateDisplayName(target) : _a, _b = options.attrs, attrs = _b === void 0 ? EMPTY_ARRAY : _b;
1157
1192
  // fold the underlying StyledComponent attrs up (implicit extend)
1158
- const finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
1193
+ var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
1159
1194
  ? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
1160
1195
  : attrs;
1161
1196
  // eslint-disable-next-line prefer-destructuring
1162
- let shouldForwardProp = options.shouldForwardProp;
1197
+ var shouldForwardProp = options.shouldForwardProp;
1163
1198
  if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
1164
- const shouldForwardPropFn = styledComponentTarget.shouldForwardProp;
1199
+ var shouldForwardPropFn_1 = styledComponentTarget.shouldForwardProp;
1165
1200
  if (options.shouldForwardProp) {
1166
- const passedShouldForwardPropFn = options.shouldForwardProp;
1201
+ var passedShouldForwardPropFn_1 = options.shouldForwardProp;
1167
1202
  // compose nested shouldForwardProp calls
1168
- shouldForwardProp = (prop, filterFn, elementToBeCreated) => shouldForwardPropFn(prop, filterFn, elementToBeCreated) &&
1169
- passedShouldForwardPropFn(prop, filterFn, elementToBeCreated);
1203
+ shouldForwardProp = function (prop, filterFn, elementToBeCreated) {
1204
+ return shouldForwardPropFn_1(prop, filterFn, elementToBeCreated) &&
1205
+ passedShouldForwardPropFn_1(prop, filterFn, elementToBeCreated);
1206
+ };
1170
1207
  }
1171
1208
  else {
1172
1209
  // eslint-disable-next-line prefer-destructuring
1173
- shouldForwardProp = shouldForwardPropFn;
1210
+ shouldForwardProp = shouldForwardPropFn_1;
1174
1211
  }
1175
1212
  }
1176
- const forwardRef = (props, ref) =>
1177
- // eslint-disable-next-line react-hooks/rules-of-hooks
1178
- useStyledComponentImpl(WrappedStyledComponent, props, ref);
1213
+ var forwardRef = function (props, ref) {
1214
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1215
+ return useStyledComponentImpl(WrappedStyledComponent, props, ref);
1216
+ };
1179
1217
  forwardRef.displayName = displayName;
1180
1218
  /**
1181
1219
  * forwardRef creates a new interim component, which we'll take advantage of
1182
1220
  * instead of extending ParentComponent to create _another_ interim class
1183
1221
  */
1184
- let WrappedStyledComponent = React__default["default"].forwardRef(forwardRef);
1222
+ var WrappedStyledComponent = React__default["default"].forwardRef(forwardRef);
1185
1223
  WrappedStyledComponent.attrs = finalAttrs;
1186
1224
  WrappedStyledComponent.inlineStyle = new InlineStyle(isTargetStyledComp ? styledComponentTarget.inlineStyle.rules.concat(rules) : rules);
1187
1225
  WrappedStyledComponent.displayName = displayName;
@@ -1191,17 +1229,14 @@ var _StyledNativeComponent = (InlineStyle) => {
1191
1229
  // fold the underlying StyledComponent target up since we folded the styles
1192
1230
  WrappedStyledComponent.target = isTargetStyledComp ? styledComponentTarget.target : target;
1193
1231
  WrappedStyledComponent.withComponent = function withComponent(tag) {
1194
- const newOptions = {
1195
- ...options,
1196
- attrs: finalAttrs,
1197
- };
1232
+ var newOptions = tslib.__assign(tslib.__assign({}, options), { attrs: finalAttrs });
1198
1233
  return createStyledNativeComponent(tag, newOptions, rules);
1199
1234
  };
1200
1235
  Object.defineProperty(WrappedStyledComponent, 'defaultProps', {
1201
- get() {
1236
+ get: function () {
1202
1237
  return this._foldedDefaultProps;
1203
1238
  },
1204
- set(obj) {
1239
+ set: function (obj) {
1205
1240
  this._foldedDefaultProps = isTargetStyledComp
1206
1241
  ? mixinDeep({}, styledComponentTarget.defaultProps, obj)
1207
1242
  : obj;
@@ -1219,16 +1254,18 @@ var _StyledNativeComponent = (InlineStyle) => {
1219
1254
  return WrappedStyledComponent;
1220
1255
  };
1221
1256
  return createStyledNativeComponent;
1222
- };
1257
+ });
1223
1258
 
1224
1259
  // eslint-disable-next-line @typescript-eslint/no-var-requires
1225
- const reactNative = require('react-native');
1226
- const InlineStyle = makeInlineStyleClass(reactNative.StyleSheet);
1227
- const StyledNativeComponent = _StyledNativeComponent(InlineStyle);
1228
- const baseStyled = (tag) => constructWithOptions(StyledNativeComponent, tag);
1260
+ var reactNative = require('react-native');
1261
+ var InlineStyle = makeInlineStyleClass(reactNative.StyleSheet);
1262
+ var StyledNativeComponent = _StyledNativeComponent(InlineStyle);
1263
+ var baseStyled = function (tag) {
1264
+ return constructWithOptions(StyledNativeComponent, tag);
1265
+ };
1229
1266
  /* React native lazy-requires each of these modules for some reason, so let's
1230
1267
  * assume it's for a good reason and not eagerly load them all */
1231
- const aliases = [
1268
+ var aliases = [
1232
1269
  'ActivityIndicator',
1233
1270
  'Button',
1234
1271
  'DatePickerIOS',
@@ -1254,19 +1291,21 @@ const aliases = [
1254
1291
  'View',
1255
1292
  'VirtualizedList',
1256
1293
  ];
1257
- const styled = baseStyled;
1294
+ var styled = baseStyled;
1258
1295
  /* Define a getter for each alias which simply gets the reactNative component
1259
1296
  * and passes it to styled */
1260
- aliases.forEach(alias => Object.defineProperty(styled, alias, {
1261
- enumerable: true,
1262
- configurable: false,
1263
- get() {
1264
- if (alias in reactNative && reactNative[alias]) {
1265
- return styled(reactNative[alias]);
1266
- }
1267
- throw new Error(`${alias} is not available in the currently-installed version of react-native`);
1268
- },
1269
- }));
1297
+ aliases.forEach(function (alias) {
1298
+ return Object.defineProperty(styled, alias, {
1299
+ enumerable: true,
1300
+ configurable: false,
1301
+ get: function () {
1302
+ if (alias in reactNative && reactNative[alias]) {
1303
+ return styled(reactNative[alias]);
1304
+ }
1305
+ throw new Error("".concat(alias, " is not available in the currently-installed version of react-native"));
1306
+ },
1307
+ });
1308
+ });
1270
1309
 
1271
1310
  exports.ThemeConsumer = ThemeConsumer;
1272
1311
  exports.ThemeContext = ThemeContext;