@mjhls/mjh-framework 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var Form = _interopDefault(require('react-bootstrap/Form'));
20
20
  var FormControl = _interopDefault(require('react-bootstrap/FormControl'));
21
21
  var Button = _interopDefault(require('react-bootstrap/Button'));
22
22
  var PropTypes = _interopDefault(require('prop-types'));
23
+ var reactBootstrap = require('react-bootstrap');
23
24
 
24
25
  /*! *****************************************************************************
25
26
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1456,6 +1457,126 @@ var NavNormal = function NavNormal(props) {
1456
1457
  );
1457
1458
  };
1458
1459
 
1460
+ var NavDvm = function NavDvm(props) {
1461
+ var logo = props.logo,
1462
+ dataObject = props.dataObject,
1463
+ subNavHeads = props.subNavHeads;
1464
+
1465
+
1466
+ return React__default.createElement(
1467
+ 'section',
1468
+ null,
1469
+ React__default.createElement(
1470
+ Navbar,
1471
+ { expand: 'md', className: 'header-container', style: { background: '#151F5D' } },
1472
+ React__default.createElement(
1473
+ Container,
1474
+ { className: 'd-flex px-0' },
1475
+ React__default.createElement(
1476
+ 'div',
1477
+ { className: 'd-flex' },
1478
+ React__default.createElement('img', { src: logo, className: 'h-100' }),
1479
+ React__default.createElement('div', { className: ' ml-4' })
1480
+ ),
1481
+ React__default.createElement(
1482
+ 'div',
1483
+ { className: 'login-right-wrapper w-50 my-3', style: { background: 'linear-gradient(to right,#104676,#01ABB5)' } },
1484
+ React__default.createElement(
1485
+ 'div',
1486
+ { className: 'row' },
1487
+ subNavHeads && subNavHeads.map(function (item, index) {
1488
+ return React__default.createElement(
1489
+ 'div',
1490
+ { key: index, className: 'col-3 py-1', style: { fontSize: '12px' } },
1491
+ React__default.createElement(
1492
+ 'span',
1493
+ { style: { color: '#fff' } },
1494
+ item.name,
1495
+ ' '
1496
+ )
1497
+ );
1498
+ })
1499
+ )
1500
+ )
1501
+ )
1502
+ ),
1503
+ React__default.createElement(
1504
+ Navbar,
1505
+ { variant: 'dark', className: 'dvm-nav p-0', style: { background: 'linear-gradient(to right,#FFB71C,#ED4303,#EB3300)' } },
1506
+ React__default.createElement(
1507
+ Container,
1508
+ null,
1509
+ React__default.createElement(Navbar.Toggle, { 'aria-controls': 'basic-navbar-nav' }),
1510
+ React__default.createElement(
1511
+ Navbar.Collapse,
1512
+ { id: 'basic-navbar-nav' },
1513
+ React__default.createElement(
1514
+ Nav,
1515
+ { className: 'mr-auto' },
1516
+ dataObject && dataObject.map(function (row, index) {
1517
+ if (row.subQuery.length > 1) {
1518
+ return React__default.createElement(
1519
+ NavDropdown,
1520
+ { key: index, title: row.name, id: 'basic-nav-dropdown' },
1521
+ row.subQuery && row.subQuery.map(function (ddRow, ddItems, subIndex) {
1522
+ if (ddRow.type === 'divider') {
1523
+ return React__default.createElement(NavDropdown.Divider, { key: subIndex });
1524
+ } else {
1525
+ return React__default.createElement(
1526
+ Link,
1527
+ { href: ddRow.url },
1528
+ React__default.createElement(
1529
+ 'a',
1530
+ { key: subIndex, className: 'dropdown-item' },
1531
+ ddRow.name
1532
+ )
1533
+ );
1534
+ }
1535
+ })
1536
+ );
1537
+ } else {
1538
+ return React__default.createElement(
1539
+ Link,
1540
+ { href: row.url },
1541
+ React__default.createElement(
1542
+ 'a',
1543
+ { key: index, className: 'nav-link' },
1544
+ row.name
1545
+ )
1546
+ );
1547
+ }
1548
+ })
1549
+ ),
1550
+ React__default.createElement(
1551
+ 'div',
1552
+ { className: 'login-subscibe', style: { fontSize: '12px' } },
1553
+ React__default.createElement(
1554
+ 'span',
1555
+ { style: { color: '#FFDC3F' } },
1556
+ '>> ',
1557
+ React__default.createElement(
1558
+ 'span',
1559
+ { style: { color: '#fff' } },
1560
+ ' Login'
1561
+ )
1562
+ ),
1563
+ React__default.createElement(
1564
+ 'span',
1565
+ { style: { color: '#FFDC3F' } },
1566
+ '>> ',
1567
+ React__default.createElement(
1568
+ 'span',
1569
+ { style: { color: '#fff' } },
1570
+ ' Register'
1571
+ )
1572
+ )
1573
+ )
1574
+ )
1575
+ )
1576
+ )
1577
+ );
1578
+ };
1579
+
1459
1580
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1460
1581
 
1461
1582
  function unwrapExports (x) {
@@ -3184,6 +3305,8 @@ var TemplateNormal = function TemplateNormal(props) {
3184
3305
  return React__default.createElement(NavMagazine, { logo: website.logo, dataObject: config.navItems });
3185
3306
  case 'native':
3186
3307
  return React__default.createElement(NavNative, { logo: website.logo, dataObject: config.navItems });
3308
+ case 'dvm':
3309
+ return React__default.createElement(NavDvm, { logo: website.logo, dataObject: config.navItems });
3187
3310
  default:
3188
3311
  return React__default.createElement('noNav', null);
3189
3312
  }
@@ -3251,6 +3374,46 @@ var AD300x250x600 = function AD300x250x600(_ref) {
3251
3374
  });
3252
3375
  };
3253
3376
 
3377
+ var FigureComponent = function FigureComponent(_ref) {
3378
+ var caption = _ref.caption,
3379
+ url = _ref.url;
3380
+
3381
+ return React__default.createElement(
3382
+ 'div',
3383
+ { style: { textAlign: 'center', marginTop: '1em', marginBottom: '1em' } },
3384
+ React__default.createElement(
3385
+ reactBootstrap.Figure,
3386
+ null,
3387
+ React__default.createElement(reactBootstrap.Figure.Image, { alt: caption, src: url }),
3388
+ React__default.createElement(
3389
+ reactBootstrap.Figure.Caption,
3390
+ null,
3391
+ caption
3392
+ )
3393
+ )
3394
+ );
3395
+ };
3396
+
3397
+ var Slideshow = function Slideshow(_ref) {
3398
+ var slides = _ref.slides;
3399
+
3400
+ return React__default.createElement(
3401
+ 'div',
3402
+ { style: { marginTop: '1em', marginBottom: '1em' } },
3403
+ React__default.createElement(
3404
+ reactBootstrap.Carousel,
3405
+ null,
3406
+ slides && slides.map(function (slide) {
3407
+ return React__default.createElement(
3408
+ reactBootstrap.Carousel.Item,
3409
+ { key: slide._key },
3410
+ React__default.createElement('img', { style: { width: '100%' }, src: slide.url, alt: slide.asset.originalFilename })
3411
+ );
3412
+ })
3413
+ )
3414
+ );
3415
+ };
3416
+
3254
3417
  var getYoutubeId = createCommonjsModule(function (module, exports) {
3255
3418
  (function (root, factory) {
3256
3419
  {
@@ -5916,15 +6079,578 @@ YouTube.PlayerState = {
5916
6079
  CUED: 5
5917
6080
  };
5918
6081
 
5919
- var getSerializers = function getSerializers() {
6082
+ var YouTubePlayer$1 = function YouTubePlayer(_ref) {
6083
+ var url = _ref.url;
6084
+
6085
+ var id = getYoutubeId(url);
6086
+ return React__default.createElement(YouTube, { videoId: id, opts: { width: '100%' } });
6087
+ };
6088
+
6089
+ var parseAssetId_1 = createCommonjsModule(function (module, exports) {
6090
+ Object.defineProperty(exports, "__esModule", { value: true });
6091
+ var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
6092
+ function parseAssetId(ref) {
6093
+ var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
6094
+ if (!id || !dimensionString || !format) {
6095
+ throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
6096
+ }
6097
+ var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
6098
+ var width = +imgWidthStr;
6099
+ var height = +imgHeightStr;
6100
+ var isValidAssetId = isFinite(width) && isFinite(height);
6101
+ if (!isValidAssetId) {
6102
+ throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
6103
+ }
6104
+ return { id: id, width: width, height: height, format: format };
6105
+ }
6106
+ exports.default = parseAssetId;
6107
+
6108
+ });
6109
+
6110
+ unwrapExports(parseAssetId_1);
6111
+
6112
+ var parseSource_1 = createCommonjsModule(function (module, exports) {
6113
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
6114
+ __assign = Object.assign || function(t) {
6115
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6116
+ s = arguments[i];
6117
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6118
+ t[p] = s[p];
6119
+ }
6120
+ return t;
6121
+ };
6122
+ return __assign.apply(this, arguments);
6123
+ };
6124
+ Object.defineProperty(exports, "__esModule", { value: true });
6125
+ var isRef = function (src) {
6126
+ var source = src;
6127
+ return source ? typeof source._ref === 'string' : false;
6128
+ };
6129
+ var isAsset = function (src) {
6130
+ var source = src;
6131
+ return source ? typeof source._id === 'string' : false;
6132
+ };
6133
+ var isAssetStub = function (src) {
6134
+ var source = src;
6135
+ return source && source.asset ? typeof source.asset.url === 'string' : false;
6136
+ };
6137
+ // Convert an asset-id, asset or image to an image record suitable for processing
6138
+ // eslint-disable-next-line complexity
6139
+ function parseSource(source) {
6140
+ if (!source) {
6141
+ return null;
6142
+ }
6143
+ var image;
6144
+ if (typeof source === 'string' && isUrl(source)) {
6145
+ // Someone passed an existing image url?
6146
+ image = {
6147
+ asset: { _ref: urlToId(source) }
6148
+ };
6149
+ }
6150
+ else if (typeof source === 'string') {
6151
+ // Just an asset id
6152
+ image = {
6153
+ asset: { _ref: source }
6154
+ };
6155
+ }
6156
+ else if (isRef(source)) {
6157
+ // We just got passed an asset directly
6158
+ image = {
6159
+ asset: source
6160
+ };
6161
+ }
6162
+ else if (isAsset(source)) {
6163
+ // If we were passed an image asset document
6164
+ image = {
6165
+ asset: {
6166
+ _ref: source._id || ''
6167
+ }
6168
+ };
6169
+ }
6170
+ else if (isAssetStub(source)) {
6171
+ // If we were passed a partial asset (`url`, but no `_id`)
6172
+ image = {
6173
+ asset: {
6174
+ _ref: urlToId(source.asset.url)
6175
+ }
6176
+ };
6177
+ }
6178
+ else if (typeof source.asset === 'object') {
6179
+ // Probably an actual image with materialized asset
6180
+ image = source;
6181
+ }
6182
+ else {
6183
+ // We got something that does not look like an image, or it is an image
6184
+ // that currently isn't sporting an asset.
6185
+ return null;
6186
+ }
6187
+ var img = source;
6188
+ if (img.crop) {
6189
+ image.crop = img.crop;
6190
+ }
6191
+ if (img.hotspot) {
6192
+ image.hotspot = img.hotspot;
6193
+ }
6194
+ return applyDefaults(image);
6195
+ }
6196
+ exports.default = parseSource;
6197
+ function isUrl(url) {
6198
+ return /^https?:\/\//.test("" + url);
6199
+ }
6200
+ function urlToId(url) {
6201
+ var parts = url.split('/').slice(-1);
6202
+ return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
6203
+ }
6204
+ // Mock crop and hotspot if image lacks it
6205
+ function applyDefaults(image) {
6206
+ if (image.crop && image.hotspot) {
6207
+ return image;
6208
+ }
6209
+ // We need to pad in default values for crop or hotspot
6210
+ var result = __assign({}, image);
6211
+ if (!result.crop) {
6212
+ result.crop = {
6213
+ left: 0,
6214
+ top: 0,
6215
+ bottom: 0,
6216
+ right: 0
6217
+ };
6218
+ }
6219
+ if (!result.hotspot) {
6220
+ result.hotspot = {
6221
+ x: 0.5,
6222
+ y: 0.5,
6223
+ height: 1.0,
6224
+ width: 1.0
6225
+ };
6226
+ }
6227
+ return result;
6228
+ }
6229
+
6230
+ });
6231
+
6232
+ unwrapExports(parseSource_1);
6233
+
6234
+ var urlForImage_1 = createCommonjsModule(function (module, exports) {
6235
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
6236
+ __assign = Object.assign || function(t) {
6237
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6238
+ s = arguments[i];
6239
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6240
+ t[p] = s[p];
6241
+ }
6242
+ return t;
6243
+ };
6244
+ return __assign.apply(this, arguments);
6245
+ };
6246
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
6247
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6248
+ };
6249
+ Object.defineProperty(exports, "__esModule", { value: true });
6250
+ var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
6251
+ var parseSource_1$$1 = __importDefault(parseSource_1);
6252
+ exports.parseSource = parseSource_1$$1.default;
6253
+ exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
6254
+ ['width', 'w'],
6255
+ ['height', 'h'],
6256
+ ['format', 'fm'],
6257
+ ['download', 'dl'],
6258
+ ['blur', 'blur'],
6259
+ ['sharpen', 'sharp'],
6260
+ ['invert', 'invert'],
6261
+ ['orientation', 'or'],
6262
+ ['minHeight', 'min-h'],
6263
+ ['maxHeight', 'max-h'],
6264
+ ['minWidth', 'min-w'],
6265
+ ['maxWidth', 'max-w'],
6266
+ ['quality', 'q'],
6267
+ ['fit', 'fit'],
6268
+ ['crop', 'crop'],
6269
+ ['auto', 'auto'],
6270
+ ['dpr', 'dpr']
6271
+ ];
6272
+ function urlForImage(options) {
6273
+ var spec = __assign({}, (options || {}));
6274
+ var source = spec.source;
6275
+ delete spec.source;
6276
+ var image = parseSource_1$$1.default(source);
6277
+ if (!image) {
6278
+ return null;
6279
+ }
6280
+ var id = image.asset._ref || image.asset._id || '';
6281
+ var asset = parseAssetId_1$$1.default(id);
6282
+ // Compute crop rect in terms of pixel coordinates in the raw source image
6283
+ var cropLeft = Math.round(image.crop.left * asset.width);
6284
+ var cropTop = Math.round(image.crop.top * asset.height);
6285
+ var crop = {
6286
+ left: cropLeft,
6287
+ top: cropTop,
6288
+ width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
6289
+ height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
6290
+ };
6291
+ // Compute hot spot rect in terms of pixel coordinates
6292
+ var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
6293
+ var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
6294
+ var hotSpotCenterX = image.hotspot.x * asset.width;
6295
+ var hotSpotCenterY = image.hotspot.y * asset.height;
6296
+ var hotspot = {
6297
+ left: hotSpotCenterX - hotSpotHorizontalRadius,
6298
+ top: hotSpotCenterY - hotSpotVerticalRadius,
6299
+ right: hotSpotCenterX + hotSpotHorizontalRadius,
6300
+ bottom: hotSpotCenterY + hotSpotVerticalRadius
6301
+ };
6302
+ // If irrelevant, or if we are requested to: don't perform crop/fit based on
6303
+ // the crop/hotspot.
6304
+ if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
6305
+ spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
6306
+ }
6307
+ return specToImageUrl(__assign({}, spec, { asset: asset }));
6308
+ }
6309
+ exports.default = urlForImage;
6310
+ // eslint-disable-next-line complexity
6311
+ function specToImageUrl(spec) {
6312
+ var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
6313
+ var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
6314
+ var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
6315
+ var params = [];
6316
+ if (spec.rect) {
6317
+ // Only bother url with a crop if it actually crops anything
6318
+ var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
6319
+ var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
6320
+ if (isEffectiveCrop) {
6321
+ params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
6322
+ }
6323
+ }
6324
+ if (spec.bg) {
6325
+ params.push("bg=" + spec.bg);
6326
+ }
6327
+ if (spec.focalPoint) {
6328
+ params.push("fp-x=" + spec.focalPoint.x);
6329
+ params.push("fp-x=" + spec.focalPoint.y);
6330
+ }
6331
+ var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
6332
+ if (flip) {
6333
+ params.push("flip=" + flip);
6334
+ }
6335
+ // Map from spec name to url param name, and allow using the actual param name as an alternative
6336
+ exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
6337
+ var specName = mapping[0], param = mapping[1];
6338
+ if (typeof spec[specName] !== 'undefined') {
6339
+ params.push(param + "=" + encodeURIComponent(spec[specName]));
6340
+ }
6341
+ else if (typeof spec[param] !== 'undefined') {
6342
+ params.push(param + "=" + encodeURIComponent(spec[param]));
6343
+ }
6344
+ });
6345
+ if (params.length === 0) {
6346
+ return baseUrl;
6347
+ }
6348
+ return baseUrl + "?" + params.join('&');
6349
+ }
6350
+ function fit(source, spec) {
6351
+ var cropRect;
6352
+ var imgWidth = spec.width;
6353
+ var imgHeight = spec.height;
6354
+ // If we are not constraining the aspect ratio, we'll just use the whole crop
6355
+ if (!(imgWidth && imgHeight)) {
6356
+ return { width: imgWidth, height: imgHeight, rect: source.crop };
6357
+ }
6358
+ var crop = source.crop;
6359
+ var hotspot = source.hotspot;
6360
+ // If we are here, that means aspect ratio is locked and fitting will be a bit harder
6361
+ var desiredAspectRatio = imgWidth / imgHeight;
6362
+ var cropAspectRatio = crop.width / crop.height;
6363
+ if (cropAspectRatio > desiredAspectRatio) {
6364
+ // The crop is wider than the desired aspect ratio. That means we are cutting from the sides
6365
+ var height = crop.height;
6366
+ var width = height * desiredAspectRatio;
6367
+ var top_2 = crop.top;
6368
+ // Center output horizontally over hotspot
6369
+ var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
6370
+ var left = hotspotXCenter - width / 2;
6371
+ // Keep output within crop
6372
+ if (left < crop.left) {
6373
+ left = crop.left;
6374
+ }
6375
+ else if (left + width > crop.left + crop.width) {
6376
+ left = crop.left + crop.width - width;
6377
+ }
6378
+ cropRect = {
6379
+ left: Math.round(left),
6380
+ top: Math.round(top_2),
6381
+ width: Math.round(width),
6382
+ height: Math.round(height)
6383
+ };
6384
+ }
6385
+ else {
6386
+ // The crop is taller than the desired ratio, we are cutting from top and bottom
6387
+ var width = crop.width;
6388
+ var height = width / desiredAspectRatio;
6389
+ var left = crop.left;
6390
+ // Center output vertically over hotspot
6391
+ var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
6392
+ var top_3 = hotspotYCenter - height / 2;
6393
+ // Keep output rect within crop
6394
+ if (top_3 < crop.top) {
6395
+ top_3 = crop.top;
6396
+ }
6397
+ else if (top_3 + height > crop.top + crop.height) {
6398
+ top_3 = crop.top + crop.height - height;
6399
+ }
6400
+ cropRect = {
6401
+ left: Math.max(0, Math.floor(left)),
6402
+ top: Math.max(0, Math.floor(top_3)),
6403
+ width: Math.round(width),
6404
+ height: Math.round(height)
6405
+ };
6406
+ }
6407
+ return {
6408
+ width: imgWidth,
6409
+ height: imgHeight,
6410
+ rect: cropRect
6411
+ };
6412
+ }
6413
+
6414
+ });
6415
+
6416
+ unwrapExports(urlForImage_1);
6417
+ var urlForImage_2 = urlForImage_1.parseSource;
6418
+ var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
6419
+
6420
+ var builder = createCommonjsModule(function (module, exports) {
6421
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
6422
+ __assign = Object.assign || function(t) {
6423
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6424
+ s = arguments[i];
6425
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6426
+ t[p] = s[p];
6427
+ }
6428
+ return t;
6429
+ };
6430
+ return __assign.apply(this, arguments);
6431
+ };
6432
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
6433
+ if (mod && mod.__esModule) return mod;
6434
+ var result = {};
6435
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6436
+ result["default"] = mod;
6437
+ return result;
6438
+ };
6439
+ Object.defineProperty(exports, "__esModule", { value: true });
6440
+ var urlForImage_1$$1 = __importStar(urlForImage_1);
6441
+ var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
6442
+ var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
6443
+ var validAutoModes = ['format'];
6444
+ function isSanityClient(client) {
6445
+ return client ? typeof client.clientConfig === 'object' : false;
6446
+ }
6447
+ function rewriteSpecName(key) {
6448
+ var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
6449
+ for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
6450
+ var entry = specs_1[_i];
6451
+ var specName = entry[0], param = entry[1];
6452
+ if (key === specName || key === param) {
6453
+ return specName;
6454
+ }
6455
+ }
6456
+ return key;
6457
+ }
6458
+ function urlBuilder(options) {
6459
+ // Did we get a SanityClient?
6460
+ var client = options;
6461
+ if (isSanityClient(client)) {
6462
+ // Inherit config from client
6463
+ var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
6464
+ return new ImageUrlBuilder(null, {
6465
+ baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
6466
+ projectId: projectId,
6467
+ dataset: dataset
6468
+ });
6469
+ }
6470
+ // Or just accept the options as given
6471
+ return new ImageUrlBuilder(null, options);
6472
+ }
6473
+ exports.default = urlBuilder;
6474
+ var ImageUrlBuilder = /** @class */ (function () {
6475
+ function ImageUrlBuilder(parent, options) {
6476
+ this.options = parent
6477
+ ? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
6478
+ }
6479
+ ImageUrlBuilder.prototype.withOptions = function (options) {
6480
+ var baseUrl = options.baseUrl || '';
6481
+ var newOptions = { baseUrl: baseUrl };
6482
+ for (var key in options) {
6483
+ if (options.hasOwnProperty(key)) {
6484
+ var specKey = rewriteSpecName(key);
6485
+ newOptions[specKey] = options[key];
6486
+ }
6487
+ }
6488
+ return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
6489
+ };
6490
+ // The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
6491
+ // _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
6492
+ // studio, the 'image'-document must be provided.
6493
+ ImageUrlBuilder.prototype.image = function (source) {
6494
+ return this.withOptions({ source: source });
6495
+ };
6496
+ // Specify the dataset
6497
+ ImageUrlBuilder.prototype.dataset = function (dataset) {
6498
+ return this.withOptions({ dataset: dataset });
6499
+ };
6500
+ // Specify the projectId
6501
+ ImageUrlBuilder.prototype.projectId = function (projectId) {
6502
+ return this.withOptions({ projectId: projectId });
6503
+ };
6504
+ // Specify background color
6505
+ ImageUrlBuilder.prototype.bg = function (bg) {
6506
+ return this.withOptions({ bg: bg });
6507
+ };
6508
+ // Set DPR scaling factor
6509
+ ImageUrlBuilder.prototype.dpr = function (dpr) {
6510
+ return this.withOptions({ dpr: dpr });
6511
+ };
6512
+ // Specify the width of the image in pixels
6513
+ ImageUrlBuilder.prototype.width = function (width) {
6514
+ return this.withOptions({ width: width });
6515
+ };
6516
+ // Specify the height of the image in pixels
6517
+ ImageUrlBuilder.prototype.height = function (height) {
6518
+ return this.withOptions({ height: height });
6519
+ };
6520
+ // Specify focal point in fraction of image dimensions. Each component 0.0-1.0
6521
+ ImageUrlBuilder.prototype.focalPoint = function (x, y) {
6522
+ return this.withOptions({ focalPoint: { x: x, y: y } });
6523
+ };
6524
+ ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
6525
+ return this.withOptions({ maxWidth: maxWidth });
6526
+ };
6527
+ ImageUrlBuilder.prototype.minWidth = function (minWidth) {
6528
+ return this.withOptions({ minWidth: minWidth });
6529
+ };
6530
+ ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
6531
+ return this.withOptions({ maxHeight: maxHeight });
6532
+ };
6533
+ ImageUrlBuilder.prototype.minHeight = function (minHeight) {
6534
+ return this.withOptions({ minHeight: minHeight });
6535
+ };
6536
+ // Specify width and height in pixels
6537
+ ImageUrlBuilder.prototype.size = function (width, height) {
6538
+ return this.withOptions({ width: width, height: height });
6539
+ };
6540
+ // Specify blur between 0 and 100
6541
+ ImageUrlBuilder.prototype.blur = function (blur) {
6542
+ return this.withOptions({ blur: blur });
6543
+ };
6544
+ ImageUrlBuilder.prototype.sharpen = function (sharpen) {
6545
+ return this.withOptions({ sharpen: sharpen });
6546
+ };
6547
+ // Specify the desired rectangle of the image
6548
+ ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
6549
+ return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
6550
+ };
6551
+ // Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
6552
+ ImageUrlBuilder.prototype.format = function (format) {
6553
+ return this.withOptions({ format: format });
6554
+ };
6555
+ ImageUrlBuilder.prototype.invert = function (invert) {
6556
+ return this.withOptions({ invert: invert });
6557
+ };
6558
+ // Rotation in degrees 0, 90, 180, 270
6559
+ ImageUrlBuilder.prototype.orientation = function (orientation) {
6560
+ return this.withOptions({ orientation: orientation });
6561
+ };
6562
+ // Compression quality 0-100
6563
+ ImageUrlBuilder.prototype.quality = function (quality) {
6564
+ return this.withOptions({ quality: quality });
6565
+ };
6566
+ // Make it a download link. Parameter is default filename.
6567
+ ImageUrlBuilder.prototype.forceDownload = function (download) {
6568
+ return this.withOptions({ download: download });
6569
+ };
6570
+ // Flip image horizontally
6571
+ ImageUrlBuilder.prototype.flipHorizontal = function () {
6572
+ return this.withOptions({ flipHorizontal: true });
6573
+ };
6574
+ // Flip image verically
6575
+ ImageUrlBuilder.prototype.flipVertical = function () {
6576
+ return this.withOptions({ flipVertical: true });
6577
+ };
6578
+ // Ignore crop/hotspot from image record, even when present
6579
+ ImageUrlBuilder.prototype.ignoreImageParams = function () {
6580
+ return this.withOptions({ ignoreImageParams: true });
6581
+ };
6582
+ ImageUrlBuilder.prototype.fit = function (value) {
6583
+ if (validFits.indexOf(value) === -1) {
6584
+ throw new Error("Invalid fit mode \"" + value + "\"");
6585
+ }
6586
+ return this.withOptions({ fit: value });
6587
+ };
6588
+ ImageUrlBuilder.prototype.crop = function (value) {
6589
+ if (validCrops.indexOf(value) === -1) {
6590
+ throw new Error("Invalid crop mode \"" + value + "\"");
6591
+ }
6592
+ return this.withOptions({ crop: value });
6593
+ };
6594
+ ImageUrlBuilder.prototype.auto = function (value) {
6595
+ if (validAutoModes.indexOf(value) === -1) {
6596
+ throw new Error("Invalid auto mode \"" + value + "\"");
6597
+ }
6598
+ return this.withOptions({ auto: value });
6599
+ };
6600
+ // Gets the url based on the submitted parameters
6601
+ ImageUrlBuilder.prototype.url = function () {
6602
+ return urlForImage_1$$1.default(this.options);
6603
+ };
6604
+ // Synonym for url()
6605
+ ImageUrlBuilder.prototype.toString = function () {
6606
+ return this.url();
6607
+ };
6608
+ return ImageUrlBuilder;
6609
+ }());
6610
+
6611
+ });
6612
+
6613
+ unwrapExports(builder);
6614
+
6615
+ var node$1 = createCommonjsModule(function (module) {
6616
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
6617
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6618
+ };
6619
+ var builder_1 = __importDefault(builder);
6620
+ module.exports = builder_1.default;
6621
+
6622
+ });
6623
+
6624
+ var imageUrlBuilder = unwrapExports(node$1);
6625
+
6626
+ var urlFor = function urlFor(source, client) {
6627
+ return imageUrlBuilder(client).image(source);
6628
+ };
6629
+
6630
+ var getSerializers = function getSerializers(client) {
5920
6631
  return {
5921
6632
  types: {
5922
6633
  youtube: function youtube(_ref) {
5923
6634
  var node = _ref.node;
5924
6635
  var url = node.url;
5925
6636
 
5926
- var id = getYoutubeId(url);
5927
- return React__default.createElement(YouTube, { videoId: id, className: 'youtube' });
6637
+ return React__default.createElement(YouTubePlayer$1, { url: url });
6638
+ },
6639
+ figure: function figure(_ref2) {
6640
+ var node = _ref2.node;
6641
+ var asset = node.asset,
6642
+ caption = node.caption;
6643
+
6644
+ var url = urlFor(asset, client).url();
6645
+ return React__default.createElement(FigureComponent, { caption: caption, url: url });
6646
+ },
6647
+ slideshow: function slideshow(_ref3) {
6648
+ var node = _ref3.node;
6649
+
6650
+ var slides = node.slides && node.slides.map(function (slide) {
6651
+ return Object.assign(slide, { url: urlFor(slide.asset, client).url() });
6652
+ });
6653
+ return React__default.createElement(Slideshow, { slides: slides });
5928
6654
  }
5929
6655
  }
5930
6656
  };
@@ -5940,6 +6666,7 @@ exports.LeftNav = LeftNav;
5940
6666
  exports.NavMagazine = NavMagazine;
5941
6667
  exports.NavNative = NavNative;
5942
6668
  exports.NavNormal = NavNormal;
6669
+ exports.NavDvm = NavDvm;
5943
6670
  exports.TemplateNormal = TemplateNormal;
5944
6671
  exports.AD300x250 = AD300x250;
5945
6672
  exports.AD300x250x600 = AD300x250x600;