@plattar/plattar-ar-adapter 1.122.3 → 1.122.4

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.
@@ -876,6 +876,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
876
876
  var plattar_api_1 = require("@plattar/plattar-api");
877
877
 
878
878
  var product_ar_1 = require("../ar/product-ar");
879
+
880
+ var plattar_services_1 = require("@plattar/plattar-services");
881
+
882
+ var util_1 = require("../util/util");
883
+
884
+ var raw_ar_1 = require("../ar/raw-ar");
879
885
  /**
880
886
  * This tracks the current state of the Embed
881
887
  */
@@ -887,9 +893,21 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
887
893
  EmbedState[EmbedState["None"] = 0] = "None";
888
894
  EmbedState[EmbedState["SceneViewer"] = 1] = "SceneViewer";
889
895
  EmbedState[EmbedState["ProductViewer"] = 2] = "ProductViewer";
890
- EmbedState[EmbedState["ProductAR"] = 3] = "ProductAR";
891
- EmbedState[EmbedState["QRCode"] = 4] = "QRCode";
896
+ EmbedState[EmbedState["ConfiguratorViewer"] = 3] = "ConfiguratorViewer";
897
+ EmbedState[EmbedState["ProductAR"] = 4] = "ProductAR";
898
+ EmbedState[EmbedState["QRCode"] = 5] = "QRCode";
892
899
  })(EmbedState || (EmbedState = {}));
900
+ /**
901
+ * This tracks the current embed type
902
+ */
903
+
904
+
905
+ var EmbedType;
906
+
907
+ (function (EmbedType) {
908
+ EmbedType[EmbedType["Viewer"] = 0] = "Viewer";
909
+ EmbedType[EmbedType["Configurator"] = 1] = "Configurator";
910
+ })(EmbedType || (EmbedType = {}));
893
911
  /**
894
912
  * This is the primary <plattar-embed /> node that allows easy embedding
895
913
  * of Plattar related content
@@ -908,7 +926,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
908
926
 
909
927
  _this10 = _super6.call(this); // this is the current state of the embed, none by default
910
928
 
911
- _this10._currentState = EmbedState.None;
929
+ _this10._currentState = EmbedState.None; // this is the current embed type, viewer by default
930
+
931
+ _this10._currentType = EmbedType.Viewer;
912
932
  _this10._qrCodeOptions = {
913
933
  color: "#101721",
914
934
  qrType: "default",
@@ -935,6 +955,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
935
955
  value: function connectedCallback() {
936
956
  var _this11 = this;
937
957
 
958
+ var embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "viewer";
959
+
960
+ if (embedType) {
961
+ switch (embedType.toLowerCase()) {
962
+ case "viewer":
963
+ this._currentType = EmbedType.Viewer;
964
+ break;
965
+
966
+ case "configurator":
967
+ this._currentType = EmbedType.Configurator;
968
+ break;
969
+
970
+ default:
971
+ this._currentType = EmbedType.Viewer;
972
+ }
973
+ }
974
+
938
975
  var observer = new MutationObserver(function (mutations) {
939
976
  mutations.forEach(function (mutation) {
940
977
  if (mutation.type === "attributes") {
@@ -1018,21 +1055,89 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1018
1055
  return new Promise(function (accept, reject) {
1019
1056
  if (!_this12._isReady) {
1020
1057
  return reject(new Error("PlattarEmbed.initAR() - cannot execute as page has not loaded yet"));
1021
- } // if scene is not set but product is, then use ProductAR
1058
+ }
1059
+
1060
+ if (!util_1.Util.canAugment()) {
1061
+ return reject(new Error("PlattarEmbed.initAR() - cannot proceed as AR not available in context"));
1062
+ }
1063
+
1064
+ if (_this12._currentType === EmbedType.Viewer) {
1065
+ // if scene is not set but product is, then use ProductAR
1066
+ if (!_this12._sceneID && _this12._productID) {
1067
+ var product = new product_ar_1.ProductAR(_this12._productID, _this12._variationID);
1068
+ return product.init().then(accept)["catch"](reject);
1069
+ } // If Product is set (under any scenario) then use ProductAR
1070
+ // NOTE: At some point this should check for Scenes when SceneAR
1071
+ // is implemented
1072
+
1073
+
1074
+ if (_this12._productID) {
1075
+ var _product = new product_ar_1.ProductAR(_this12._productID, _this12._variationID);
1076
+
1077
+ return _product.init().then(accept)["catch"](reject);
1078
+ }
1079
+ }
1080
+
1081
+ if (_this12._currentType === EmbedType.Configurator) {
1082
+ // if scene ID is available and the state is a configurator viewer
1083
+ // we can use the real-time configurator state to launch the AR view
1084
+ var viewer = _this12.viewer;
1085
+
1086
+ if (viewer && _this12._sceneID && _this12._currentState === EmbedState.ConfiguratorViewer) {
1087
+ var output = "glb";
1088
+
1089
+ if (util_1.Util.isSafari() || util_1.Util.isChromeOnIOS()) {
1090
+ output = "usdz";
1091
+ }
1092
+
1093
+ viewer.messenger.getARFile(output).then(function (result) {
1094
+ var rawAR = new raw_ar_1.RawAR(result.filename);
1095
+ return rawAR.init().then(accept)["catch"](reject);
1096
+ })["catch"](reject);
1097
+ }
1098
+
1099
+ var configState = _this12.hasAttribute("config-state") ? _this12.getAttribute("config-state") : null; // otherwise scene ID is available to the viewer is not launched
1100
+ // we can use the static configuration state to launch the AR view
1022
1101
 
1102
+ if (_this12._sceneID && configState) {
1103
+ try {
1104
+ var decodedb64State = atob(configState);
1105
+ var state = JSON.parse(decodedb64State);
1106
+
1107
+ if (state.meta) {
1108
+ var sceneProductIndex = state.meta.scene_product_index || 0;
1109
+ var variationIndex = state.meta.product_variation_index || 1;
1110
+ var states = state.states || [];
1111
+
1112
+ if (states.length > 0) {
1113
+ var configurator = new plattar_services_1.Configurator();
1114
+ states.forEach(function (productState) {
1115
+ configurator.addSceneProduct(productState[sceneProductIndex], productState[variationIndex]);
1116
+ });
1117
+
1118
+ if (util_1.Util.isSafari() || util_1.Util.isChromeOnIOS()) {
1119
+ configurator.output = "usdz";
1120
+ }
1023
1121
 
1024
- if (!_this12._sceneID && _this12._productID) {
1025
- var product = new product_ar_1.ProductAR(_this12._productID, _this12._variationID);
1026
- return product.init().then(accept)["catch"](reject);
1027
- } // If Product is set (under any scenario) then use ProductAR
1028
- // NOTE: At some point this should check for Scenes when SceneAR
1029
- // is implemented
1122
+ if (util_1.Util.canSceneViewer()) {
1123
+ configurator.output = "glb";
1124
+ }
1030
1125
 
1126
+ configurator.server = _this12._server;
1127
+ return configurator.get().then(function (result) {
1128
+ var rawAR = new raw_ar_1.RawAR(result.filename);
1129
+ rawAR.init().then(accept)["catch"](reject);
1130
+ })["catch"](reject);
1131
+ }
1031
1132
 
1032
- if (_this12._productID) {
1033
- var _product = new product_ar_1.ProductAR(_this12._productID, _this12._variationID);
1133
+ return reject(new Error("PlattarEmbed.initAR() - invalid config-state does not have any product states"));
1134
+ }
1034
1135
 
1035
- return _product.init().then(accept)["catch"](reject);
1136
+ return reject(new Error("PlattarEmbed.initAR() - invalid config-state for configurator"));
1137
+ } catch (err) {
1138
+ return reject(err);
1139
+ }
1140
+ }
1036
1141
  } // otherwise, scene was set so use SceneAR
1037
1142
 
1038
1143
 
@@ -1073,10 +1178,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1073
1178
  _this14._viewer.remove();
1074
1179
 
1075
1180
  _this14._viewer = null;
1076
- } // if scene is set, we use <plattar-viewer /> node from plattar-web
1181
+ } // if scene is set and embed is a viewer type, we use <plattar-viewer /> node from plattar-web
1077
1182
 
1078
1183
 
1079
- if (_this14._sceneID) {
1184
+ if (_this14._sceneID && _this14._currentType === EmbedType.Viewer) {
1080
1185
  var viewer = document.createElement("plattar-viewer");
1081
1186
  viewer.setAttribute("width", _this14._width);
1082
1187
  viewer.setAttribute("height", _this14._height);
@@ -1103,11 +1208,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1103
1208
  _this14._viewer = viewer;
1104
1209
  _this14._currentState = EmbedState.SceneViewer;
1105
1210
  return;
1106
- } // if product is set, we use <plattar-product /> node from plattar-web
1211
+ } // if scene is set and embed is a configurator type, we use <plattar-configurator /> node from plattar-web
1107
1212
 
1108
1213
 
1109
- if (_this14._productID) {
1110
- var _viewer = document.createElement("plattar-product");
1214
+ if (_this14._sceneID && _this14._currentType === EmbedType.Configurator) {
1215
+ var _viewer = document.createElement("plattar-configurator");
1111
1216
 
1112
1217
  _viewer.setAttribute("width", _this14._width);
1113
1218
 
@@ -1115,10 +1220,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1115
1220
 
1116
1221
  _viewer.setAttribute("server", _this14._server);
1117
1222
 
1118
- _viewer.setAttribute("product-id", _this14._productID);
1223
+ _viewer.setAttribute("scene-id", _this14._sceneID);
1119
1224
 
1120
- if (_this14._variationID) {
1121
- _viewer.setAttribute("variation-id", _this14._variationID);
1225
+ var configState = _this14.hasAttribute("config-state") ? _this14.getAttribute("config-state") : null;
1226
+ var showAR = _this14.hasAttribute("show-ar") ? _this14.getAttribute("show-ar") : null;
1227
+
1228
+ if (configState) {
1229
+ _viewer.setAttribute("config-state", configState);
1230
+ }
1231
+
1232
+ if (showAR) {
1233
+ _viewer.setAttribute("show-ar", showAR);
1122
1234
  }
1123
1235
 
1124
1236
  _viewer.onload = function () {
@@ -1132,6 +1244,37 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1132
1244
  _shadow.append(_viewer);
1133
1245
 
1134
1246
  _this14._viewer = _viewer;
1247
+ _this14._currentState = EmbedState.ConfiguratorViewer;
1248
+ return;
1249
+ } // if product is set, we use <plattar-product /> node from plattar-web
1250
+
1251
+
1252
+ if (_this14._productID) {
1253
+ var _viewer2 = document.createElement("plattar-product");
1254
+
1255
+ _viewer2.setAttribute("width", _this14._width);
1256
+
1257
+ _viewer2.setAttribute("height", _this14._height);
1258
+
1259
+ _viewer2.setAttribute("server", _this14._server);
1260
+
1261
+ _viewer2.setAttribute("product-id", _this14._productID);
1262
+
1263
+ if (_this14._variationID) {
1264
+ _viewer2.setAttribute("variation-id", _this14._variationID);
1265
+ }
1266
+
1267
+ _viewer2.onload = function () {
1268
+ return accept(_viewer2);
1269
+ };
1270
+
1271
+ var _shadow2 = _this14.shadowRoot || _this14.attachShadow({
1272
+ mode: 'open'
1273
+ });
1274
+
1275
+ _shadow2.append(_viewer2);
1276
+
1277
+ _this14._viewer = _viewer2;
1135
1278
  _this14._currentState = EmbedState.ProductViewer;
1136
1279
  return;
1137
1280
  }
@@ -1158,10 +1301,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1158
1301
  _this15._viewer.remove();
1159
1302
 
1160
1303
  _this15._viewer = null;
1161
- } // if scene is set, we embed a QR code that takes us to viewer.html
1304
+ } // if scene is set and embed type is viewer
1305
+ // we embed a QR code that takes us to viewer.html
1162
1306
 
1163
1307
 
1164
- if (_this15._sceneID) {
1308
+ if (_this15._sceneID && _this15._currentType == EmbedType.Viewer) {
1165
1309
  var viewer = document.createElement("plattar-qrcode");
1166
1310
  viewer.setAttribute("width", _this15._width);
1167
1311
  viewer.setAttribute("height", _this15._height);
@@ -1188,7 +1332,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1188
1332
  dst += "&variationId=" + _this15._variationID;
1189
1333
  }
1190
1334
 
1191
- viewer.setAttribute("url", dst);
1335
+ viewer.setAttribute("url", opt.url || dst);
1192
1336
 
1193
1337
  viewer.onload = function () {
1194
1338
  return accept(viewer);
@@ -1202,47 +1346,98 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1202
1346
  _this15._viewer = viewer;
1203
1347
  _this15._currentState = EmbedState.QRCode;
1204
1348
  return;
1349
+ } // if scene is set and embed type is configurator
1350
+ // we embed a QR code that takes us to configurator.html
1351
+
1352
+
1353
+ if (_this15._sceneID && _this15._currentType == EmbedType.Configurator) {
1354
+ var _viewer3 = document.createElement("plattar-qrcode");
1355
+
1356
+ _viewer3.setAttribute("width", _this15._width);
1357
+
1358
+ _viewer3.setAttribute("height", _this15._height);
1359
+
1360
+ if (opt.color) {
1361
+ _viewer3.setAttribute("color", opt.color);
1362
+ }
1363
+
1364
+ if (opt.margin) {
1365
+ _viewer3.setAttribute("margin", "" + opt.margin);
1366
+ }
1367
+
1368
+ if (opt.qrType) {
1369
+ _viewer3.setAttribute("qr-type", opt.qrType);
1370
+ }
1371
+
1372
+ var _dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + _this15._sceneID;
1373
+
1374
+ var configState = _this15.hasAttribute("config-state") ? _this15.getAttribute("config-state") : null;
1375
+ var showAR = _this15.hasAttribute("show-ar") ? _this15.getAttribute("show-ar") : null;
1376
+
1377
+ if (configState) {
1378
+ _dst += "&config_state=" + configState;
1379
+ }
1380
+
1381
+ if (showAR) {
1382
+ _dst += "&show_ar=" + showAR;
1383
+ }
1384
+
1385
+ _viewer3.setAttribute("url", opt.url || _dst);
1386
+
1387
+ _viewer3.onload = function () {
1388
+ return accept(_viewer3);
1389
+ };
1390
+
1391
+ var _shadow3 = _this15.shadowRoot || _this15.attachShadow({
1392
+ mode: 'open'
1393
+ });
1394
+
1395
+ _shadow3.append(_viewer3);
1396
+
1397
+ _this15._viewer = _viewer3;
1398
+ _this15._currentState = EmbedState.QRCode;
1399
+ return;
1205
1400
  } // if product is set, we embed a QR code that takes us to product.html
1206
1401
 
1207
1402
 
1208
1403
  if (_this15._productID) {
1209
- var _viewer2 = document.createElement("plattar-qrcode");
1404
+ var _viewer4 = document.createElement("plattar-qrcode");
1210
1405
 
1211
- _viewer2.setAttribute("width", _this15._width);
1406
+ _viewer4.setAttribute("width", _this15._width);
1212
1407
 
1213
- _viewer2.setAttribute("height", _this15._height);
1408
+ _viewer4.setAttribute("height", _this15._height);
1214
1409
 
1215
1410
  if (opt.color) {
1216
- _viewer2.setAttribute("color", opt.color);
1411
+ _viewer4.setAttribute("color", opt.color);
1217
1412
  }
1218
1413
 
1219
1414
  if (opt.margin) {
1220
- _viewer2.setAttribute("margin", "" + opt.margin);
1415
+ _viewer4.setAttribute("margin", "" + opt.margin);
1221
1416
  }
1222
1417
 
1223
1418
  if (opt.qrType) {
1224
- _viewer2.setAttribute("qr-type", opt.qrType);
1419
+ _viewer4.setAttribute("qr-type", opt.qrType);
1225
1420
  }
1226
1421
 
1227
- var _dst = plattar_api_1.Server.location().base + "renderer/product.html?product_id=" + _this15._productID;
1422
+ var _dst2 = plattar_api_1.Server.location().base + "renderer/product.html?product_id=" + _this15._productID;
1228
1423
 
1229
1424
  if (_this15._variationID) {
1230
- _dst += "&variation_id=" + _this15._variationID;
1425
+ _dst2 += "&variation_id=" + _this15._variationID;
1231
1426
  }
1232
1427
 
1233
- _viewer2.setAttribute("url", _dst);
1428
+ _viewer4.setAttribute("url", opt.url || _dst2);
1234
1429
 
1235
- _viewer2.onload = function () {
1236
- return accept(_viewer2);
1430
+ _viewer4.onload = function () {
1431
+ return accept(_viewer4);
1237
1432
  };
1238
1433
 
1239
- var _shadow2 = _this15.shadowRoot || _this15.attachShadow({
1434
+ var _shadow4 = _this15.shadowRoot || _this15.attachShadow({
1240
1435
  mode: 'open'
1241
1436
  });
1242
1437
 
1243
- _shadow2.append(_viewer2);
1438
+ _shadow4.append(_viewer4);
1244
1439
 
1245
- _this15._viewer = _viewer2;
1440
+ _this15._viewer = _viewer4;
1246
1441
  _this15._currentState = EmbedState.QRCode;
1247
1442
  return;
1248
1443
  }
@@ -1259,7 +1454,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1259
1454
  key: "_OnAttributesUpdated",
1260
1455
  value: function _OnAttributesUpdated() {
1261
1456
  // nothing to update in these scenarios
1262
- if (this._currentState === EmbedState.None || this._currentState === EmbedState.ProductAR) {
1457
+ if (this._currentState === EmbedState.None || this._currentState === EmbedState.ProductAR || this._currentState === EmbedState.ConfiguratorViewer) {
1263
1458
  return;
1264
1459
  } // re-render the QR Code when attributes have changed
1265
1460
 
@@ -1281,10 +1476,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1281
1476
  }
1282
1477
 
1283
1478
  if (this._currentState === EmbedState.ProductViewer) {
1284
- var _viewer3 = this.viewer;
1479
+ var _viewer5 = this.viewer;
1285
1480
 
1286
- if (_viewer3) {
1287
- _viewer3.messenger.selectVariation(this._variationID);
1481
+ if (_viewer5) {
1482
+ _viewer5.messenger.selectVariation(this._variationID);
1288
1483
  }
1289
1484
 
1290
1485
  return;
@@ -1298,7 +1493,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1298
1493
  exports["default"] = PlattarEmbed;
1299
1494
  }, {
1300
1495
  "../ar/product-ar": 4,
1301
- "@plattar/plattar-api": 36
1496
+ "../ar/raw-ar": 5,
1497
+ "../util/util": 9,
1498
+ "@plattar/plattar-api": 36,
1499
+ "@plattar/plattar-services": 107
1302
1500
  }],
1303
1501
  8: [function (require, module, exports) {
1304
1502
  "use strict";
@@ -1426,7 +1624,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1426
1624
  "./util/util": 9,
1427
1625
  "./version": 10,
1428
1626
  "@plattar/plattar-qrcode": 102,
1429
- "@plattar/plattar-web": 116
1627
+ "@plattar/plattar-web": 121
1430
1628
  }],
1431
1629
  9: [function (require, module, exports) {
1432
1630
  "use strict";
@@ -1558,7 +1756,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1558
1756
  Object.defineProperty(exports, "__esModule", {
1559
1757
  value: true
1560
1758
  });
1561
- exports["default"] = "1.122.3";
1759
+ exports["default"] = "1.122.4";
1562
1760
  }, {}],
1563
1761
  11: [function (require, module, exports) {
1564
1762
  "use strict";
@@ -4319,7 +4517,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4319
4517
  module.exports = PlattarQuery;
4320
4518
  }, {
4321
4519
  "../util/plattar-util.js": 98,
4322
- "node-fetch": 119
4520
+ "node-fetch": 124
4323
4521
  }],
4324
4522
  38: [function (require, module, exports) {
4325
4523
  (function (process) {
@@ -4543,8 +4741,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4543
4741
  }).call(this);
4544
4742
  }).call(this, require('_process'));
4545
4743
  }, {
4546
- "_process": 120,
4547
- "node-fetch": 119
4744
+ "_process": 126,
4745
+ "node-fetch": 124
4548
4746
  }],
4549
4747
  39: [function (require, module, exports) {
4550
4748
  var PlattarBase = require("./interfaces/plattar-base.js");
@@ -7300,7 +7498,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7300
7498
 
7301
7499
  module.exports = BaseElement;
7302
7500
  }, {
7303
- "qr-code-styling": 121
7501
+ "qr-code-styling": 127
7304
7502
  }],
7305
7503
  101: [function (require, module, exports) {
7306
7504
  var BaseElement = require("./base/base-element.js");
@@ -7343,602 +7541,699 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7343
7541
  module.exports = "1.120.3";
7344
7542
  }, {}],
7345
7543
  104: [function (require, module, exports) {
7346
- var ElementController = require("../controllers/element-controller");
7544
+ "use strict";
7347
7545
 
7348
- var BaseElement = /*#__PURE__*/function (_HTMLElement3) {
7349
- _inherits(BaseElement, _HTMLElement3);
7546
+ var __importDefault = this && this.__importDefault || function (mod) {
7547
+ return mod && mod.__esModule ? mod : {
7548
+ "default": mod
7549
+ };
7550
+ };
7350
7551
 
7351
- var _super69 = _createSuper(BaseElement);
7552
+ Object.defineProperty(exports, "__esModule", {
7553
+ value: true
7554
+ });
7555
+ exports.Configurator = void 0;
7352
7556
 
7353
- function BaseElement() {
7354
- _classCallCheck(this, BaseElement);
7557
+ var plattar_api_1 = require("@plattar/plattar-api");
7355
7558
 
7356
- return _super69.call(this);
7559
+ var object_hash_1 = __importDefault(require("object-hash"));
7560
+
7561
+ var remote_request_1 = require("./remote-request");
7562
+
7563
+ var Configurator = /*#__PURE__*/function () {
7564
+ function Configurator() {
7565
+ _classCallCheck(this, Configurator);
7566
+
7567
+ this.quality = 100;
7568
+ this.output = "glb";
7569
+ this.server = "production";
7570
+ this.retry = 0;
7571
+ this._maps = [];
7572
+ this._attrHash = [];
7357
7573
  }
7358
7574
 
7359
- _createClass(BaseElement, [{
7360
- key: "connectedCallback",
7361
- value: function connectedCallback() {
7362
- this._controller = new ElementController(this);
7575
+ _createClass(Configurator, [{
7576
+ key: "add",
7577
+ value: function add() {
7578
+ var sceneProduct = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
7579
+ var productVariation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
7580
+ this.addSceneProduct(sceneProduct, productVariation);
7363
7581
  }
7364
7582
  }, {
7365
- key: "onready",
7366
- set: function set(callback) {
7367
- if (this._controller) {
7368
- this._controller.onload = callback;
7583
+ key: "addSceneProduct",
7584
+ value: function addSceneProduct() {
7585
+ var sceneProduct = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
7586
+ var productVariation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
7587
+
7588
+ if (!sceneProduct) {
7589
+ throw new Error("Configurator.addSceneProduct() - sceneProduct input was null or undefined");
7590
+ }
7591
+
7592
+ if (!productVariation) {
7593
+ throw new Error("Configurator.addSceneProduct() - productVariation input was null or undefined");
7594
+ }
7595
+
7596
+ var map = {
7597
+ sceneproduct: null,
7598
+ productvariation: null
7599
+ };
7600
+
7601
+ if (sceneProduct instanceof plattar_api_1.SceneProduct && productVariation instanceof plattar_api_1.ProductVariation) {
7602
+ map.sceneproduct = sceneProduct.id;
7603
+ map.productvariation = productVariation.id;
7604
+
7605
+ this._maps.push(map);
7606
+
7369
7607
  return;
7370
7608
  }
7371
7609
 
7372
- throw new Error("set BaseElement.onready - cannot use as element not connected");
7373
- }
7374
- }, {
7375
- key: "messenger",
7376
- get: function get() {
7377
- return this._controller ? this._controller.messenger : undefined;
7378
- }
7379
- }, {
7380
- key: "context",
7381
- get: function get() {
7382
- return this._controller ? this._controller.context : undefined;
7383
- }
7384
- }, {
7385
- key: "element",
7386
- get: function get() {
7387
- return this._controller;
7388
- }
7389
- }, {
7390
- key: "ready",
7391
- get: function get() {
7392
- return this._controller ? true : false;
7393
- }
7394
- }, {
7395
- key: "allowDragDrop",
7396
- get: function get() {
7397
- return this._controller ? this._controller.controller.allowDragDrop : false;
7398
- },
7399
- set: function set(value) {
7400
- if (this._controller) {
7401
- this._controller.controller.allowDragDrop = value;
7610
+ if ((typeof sceneProduct === "string" || sceneProduct instanceof String) && (typeof productVariation === "string" || productVariation instanceof String)) {
7611
+ map.sceneproduct = sceneProduct;
7612
+ map.productvariation = productVariation;
7613
+
7614
+ this._maps.push(map);
7615
+
7402
7616
  return;
7403
7617
  }
7404
7618
 
7405
- throw new Error("set BaseElement.allowDragDrop - cannot use as element not connected");
7406
- }
7407
- }, {
7408
- key: "permissions",
7409
- get: function get() {
7410
- return [];
7411
- }
7412
- }, {
7413
- key: "coreAttributes",
7414
- get: function get() {
7415
- return [{
7416
- key: "scene-id",
7417
- map: "scene_id"
7418
- }];
7619
+ throw new Error("Configurator.addSceneProduct() - mismatched instance types for inputs");
7419
7620
  }
7420
7621
  }, {
7421
- key: "usesCoreAttribute",
7422
- value: function usesCoreAttribute(key) {
7423
- var attr = this.coreAttributes;
7424
- var length = attr.length;
7622
+ key: "addProduct",
7623
+ value: function addProduct() {
7624
+ var product = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
7625
+ var productVariation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
7425
7626
 
7426
- for (var i = 0; i < length; i++) {
7427
- if (attr[i].key === key) {
7428
- return true;
7429
- }
7627
+ if (!product) {
7628
+ throw new Error("Configurator.addProduct() - product input was null or undefined");
7430
7629
  }
7431
7630
 
7432
- return false;
7433
- }
7434
- }, {
7435
- key: "optionalAttributes",
7436
- get: function get() {
7437
- return [];
7631
+ if (!productVariation) {
7632
+ throw new Error("Configurator.addProduct() - productVariation input was null or undefined");
7633
+ }
7634
+
7635
+ var map = {
7636
+ productvariation: null,
7637
+ product: null
7638
+ };
7639
+
7640
+ if (product instanceof plattar_api_1.Product && productVariation instanceof plattar_api_1.ProductVariation) {
7641
+ map.product = product.id;
7642
+ map.productvariation = productVariation.id;
7643
+
7644
+ this._maps.push(map);
7645
+
7646
+ return;
7647
+ }
7648
+
7649
+ if ((typeof product === "string" || product instanceof String) && (typeof productVariation === "string" || productVariation instanceof String)) {
7650
+ map.product = product;
7651
+ map.productvariation = productVariation;
7652
+
7653
+ this._maps.push(map);
7654
+
7655
+ return;
7656
+ }
7657
+
7658
+ throw new Error("Configurator.addProduct() - mismatched instance types for inputs");
7438
7659
  }
7439
7660
  }, {
7440
- key: "hasAllCoreAttributes",
7441
- get: function get() {
7442
- var attr = this.coreAttributes;
7443
- var length = attr.length;
7661
+ key: "addModel",
7662
+ value: function addModel() {
7663
+ var sceneModel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
7444
7664
 
7445
- for (var i = 0; i < length; i++) {
7446
- if (!this.hasAttribute(attr[i].key)) {
7447
- return false;
7448
- }
7665
+ if (!sceneModel) {
7666
+ throw new Error("Configurator.addModel() - sceneModel input was null or undefined");
7449
7667
  }
7450
7668
 
7451
- return true;
7669
+ var map = {
7670
+ scenemodel: null
7671
+ };
7672
+
7673
+ if (sceneModel instanceof plattar_api_1.SceneModel) {
7674
+ map.scenemodel = sceneModel.id;
7675
+
7676
+ this._maps.push(map);
7677
+
7678
+ return;
7679
+ }
7680
+
7681
+ if (typeof sceneModel === "string") {
7682
+ map.scenemodel = sceneModel;
7683
+
7684
+ this._maps.push(map);
7685
+
7686
+ return;
7687
+ }
7688
+
7689
+ throw new Error("Configurator.addModel() - mismatched instance types for inputs");
7452
7690
  }
7453
7691
  }, {
7454
- key: "allMappedAttributes",
7455
- get: function get() {
7692
+ key: "get",
7693
+ value: function get() {
7456
7694
  var _this43 = this;
7457
7695
 
7458
- var map = new Map();
7459
- var coreAttr = this.coreAttributes;
7460
- var optAttr = this.optionalAttributes;
7461
- coreAttr.forEach(function (ele) {
7462
- if (_this43.hasAttribute(ele.key)) {
7463
- map.set(ele.map, _this43.getAttribute(ele.key));
7464
- }
7465
- });
7466
- optAttr.forEach(function (ele) {
7467
- if (_this43.hasAttribute(ele.key)) {
7468
- map.set(ele.map, _this43.getAttribute(ele.key));
7469
- }
7696
+ return new Promise(function (accept, reject) {
7697
+ _this43._CalculateHash().then(function () {
7698
+ remote_request_1.RemoteRequest.request(_this43._GetPayload(), _this43.retry < 0 ? 0 : _this43.retry).then(accept)["catch"](reject);
7699
+ })["catch"](function (_err) {
7700
+ reject(new Error("Configurator.get() - one of the objects does not exist in Plattar API"));
7701
+ });
7470
7702
  });
7471
- return map;
7472
7703
  }
7473
7704
  }, {
7474
- key: "allMappedAttributesQuery",
7475
- get: function get() {
7476
- var attr = this.allMappedAttributes;
7477
- var queryStr = "";
7478
- var first = true;
7705
+ key: "_CalculateHash",
7706
+ value: function _CalculateHash() {
7707
+ var _this44 = this;
7479
7708
 
7480
- var _iterator7 = _createForOfIteratorHelper(attr.entries()),
7481
- _step7;
7709
+ return new Promise(function (accept, reject) {
7710
+ var promises = [];
7711
+ var oldOrigin = plattar_api_1.Server["default"]().originLocation.type;
7712
+ plattar_api_1.Server.create(plattar_api_1.Server.match(_this44.server));
7482
7713
 
7483
- try {
7484
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7485
- var _step7$value = _slicedToArray(_step7.value, 2),
7486
- key = _step7$value[0],
7487
- value = _step7$value[1];
7714
+ _this44._maps.forEach(function (map) {
7715
+ if (map.productvariation) {
7716
+ promises.push(new plattar_api_1.ProductVariation(map.productvariation).get());
7717
+ }
7488
7718
 
7489
- queryStr += first ? "?" + key + "=" + value : "&" + key + "=" + value;
7490
- first = false;
7491
- }
7492
- } catch (err) {
7493
- _iterator7.e(err);
7494
- } finally {
7495
- _iterator7.f();
7496
- }
7719
+ if (map.sceneproduct) {
7720
+ promises.push(new plattar_api_1.SceneProduct(map.sceneproduct).get());
7721
+ }
7497
7722
 
7498
- return queryStr;
7723
+ if (map.scenemodel) {
7724
+ promises.push(new plattar_api_1.SceneModel(map.scenemodel).get());
7725
+ }
7726
+
7727
+ if (map.product) {
7728
+ promises.push(new plattar_api_1.Product(map.product).get());
7729
+ }
7730
+ });
7731
+
7732
+ Promise.all(promises).then(function (values) {
7733
+ values.forEach(function (value) {
7734
+ _this44._attrHash.push(value.attributes);
7735
+ }); // reset server back
7736
+
7737
+ plattar_api_1.Server.create(plattar_api_1.Server.match(oldOrigin));
7738
+ accept();
7739
+ })["catch"](function () {
7740
+ // reset server back
7741
+ plattar_api_1.Server.create(plattar_api_1.Server.match(oldOrigin));
7742
+ reject(new Error("Configurator._CalculateHash() - unexpected error"));
7743
+ });
7744
+ });
7499
7745
  }
7500
7746
  }, {
7501
- key: "elementType",
7502
- get: function get() {
7503
- return "none";
7747
+ key: "_GetPayload",
7748
+ value: function _GetPayload() {
7749
+ var converter = this.output === "vto" ? "config_to_reality" : "config_to_model";
7750
+ var load = {
7751
+ options: {
7752
+ converter: converter,
7753
+ quality: this.quality,
7754
+ output: this.output,
7755
+ server: this.server
7756
+ },
7757
+ data: {
7758
+ maps: this._maps
7759
+ }
7760
+ };
7761
+
7762
+ if (this._attrHash.length > 0) {
7763
+ load.options.hash = object_hash_1["default"].MD5(this._attrHash) + object_hash_1["default"].MD5(load);
7764
+ } else {
7765
+ load.options.hash = object_hash_1["default"].MD5(load);
7766
+ }
7767
+
7768
+ return load;
7504
7769
  }
7505
7770
  }]);
7506
7771
 
7507
- return BaseElement;
7508
- }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
7772
+ return Configurator;
7773
+ }();
7509
7774
 
7510
- module.exports = BaseElement;
7775
+ exports.Configurator = Configurator;
7511
7776
  }, {
7512
- "../controllers/element-controller": 106
7777
+ "./remote-request": 106,
7778
+ "@plattar/plattar-api": 36,
7779
+ "object-hash": 125
7513
7780
  }],
7514
7781
  105: [function (require, module, exports) {
7515
- var BaseElement = require("./base/base-element.js");
7782
+ "use strict";
7516
7783
 
7517
- var ConfiguratorElement = /*#__PURE__*/function (_BaseElement2) {
7518
- _inherits(ConfiguratorElement, _BaseElement2);
7784
+ var __importDefault = this && this.__importDefault || function (mod) {
7785
+ return mod && mod.__esModule ? mod : {
7786
+ "default": mod
7787
+ };
7788
+ };
7519
7789
 
7520
- var _super70 = _createSuper(ConfiguratorElement);
7790
+ Object.defineProperty(exports, "__esModule", {
7791
+ value: true
7792
+ });
7793
+ exports.ModelConverter = void 0;
7521
7794
 
7522
- function ConfiguratorElement() {
7523
- _classCallCheck(this, ConfiguratorElement);
7795
+ var plattar_api_1 = require("@plattar/plattar-api");
7524
7796
 
7525
- return _super70.call(this);
7797
+ var object_hash_1 = __importDefault(require("object-hash"));
7798
+
7799
+ var remote_request_1 = require("./remote-request");
7800
+
7801
+ var ModelConverter = /*#__PURE__*/function () {
7802
+ function ModelConverter() {
7803
+ _classCallCheck(this, ModelConverter);
7804
+
7805
+ this._model = null;
7806
+ this.quality = 100;
7807
+ this.output = "glb";
7808
+ this.server = "production";
7809
+ this.retry = 0;
7810
+ this._attrHash = [];
7526
7811
  }
7527
7812
 
7528
- _createClass(ConfiguratorElement, [{
7529
- key: "permissions",
7813
+ _createClass(ModelConverter, [{
7814
+ key: "model",
7530
7815
  get: function get() {
7531
- return ["autoplay"];
7816
+ return this._model;
7817
+ },
7818
+ set: function set(newModel) {
7819
+ if (!newModel) {
7820
+ return;
7821
+ }
7822
+
7823
+ if (newModel instanceof plattar_api_1.FileModel) {
7824
+ this._model = newModel.id;
7825
+
7826
+ this._attrHash.push(object_hash_1["default"].MD5(newModel.attributes));
7827
+
7828
+ return;
7829
+ }
7830
+
7831
+ this._model = newModel;
7532
7832
  }
7533
7833
  }, {
7534
- key: "elementType",
7535
- get: function get() {
7536
- return "configurator";
7834
+ key: "get",
7835
+ value: function get() {
7836
+ var _this45 = this;
7837
+
7838
+ return new Promise(function (accept, reject) {
7839
+ if (!_this45._model) {
7840
+ return reject(new Error("ModelConverter.get() - required .model attribute was not set"));
7841
+ }
7842
+
7843
+ remote_request_1.RemoteRequest.request(_this45._Payload, _this45.retry < 0 ? 0 : _this45.retry).then(accept)["catch"](reject);
7844
+ });
7537
7845
  }
7538
7846
  }, {
7539
- key: "optionalAttributes",
7847
+ key: "_Payload",
7540
7848
  get: function get() {
7541
- return [{
7542
- key: "config-state",
7543
- map: "config_state"
7544
- }, {
7545
- key: "show-ar",
7546
- map: "show_ar"
7547
- }];
7849
+ var load = {
7850
+ options: {
7851
+ converter: "gltf_to_model",
7852
+ quality: this.quality,
7853
+ output: this.output,
7854
+ server: this.server
7855
+ },
7856
+ data: {
7857
+ model: this._model
7858
+ }
7859
+ };
7860
+
7861
+ if (this._attrHash.length > 0) {
7862
+ load.options.hash = object_hash_1["default"].MD5(this._attrHash) + object_hash_1["default"].MD5(load);
7863
+ } else {
7864
+ load.options.hash = object_hash_1["default"].MD5(load);
7865
+ }
7866
+
7867
+ return load;
7548
7868
  }
7549
7869
  }]);
7550
7870
 
7551
- return ConfiguratorElement;
7552
- }(BaseElement);
7871
+ return ModelConverter;
7872
+ }();
7553
7873
 
7554
- module.exports = ConfiguratorElement;
7874
+ exports.ModelConverter = ModelConverter;
7555
7875
  }, {
7556
- "./base/base-element.js": 104
7876
+ "./remote-request": 106,
7877
+ "@plattar/plattar-api": 36,
7878
+ "object-hash": 125
7557
7879
  }],
7558
7880
  106: [function (require, module, exports) {
7559
- var Util = require("../../util/util.js");
7560
-
7561
- var _require = require("@plattar/context-messenger"),
7562
- messenger = _require.messenger;
7563
-
7564
- var IFrameController = require("./iframe-controller.js");
7565
-
7566
- var ElementController = /*#__PURE__*/function () {
7567
- function ElementController(element) {
7568
- var _this44 = this;
7569
-
7570
- _classCallCheck(this, ElementController);
7571
-
7572
- this._element = element; // observe the changes in scene-id
7881
+ "use strict";
7573
7882
 
7574
- var callback = function callback(mutationsList) {
7575
- var _iterator8 = _createForOfIteratorHelper(mutationsList),
7576
- _step8;
7883
+ var __importDefault = this && this.__importDefault || function (mod) {
7884
+ return mod && mod.__esModule ? mod : {
7885
+ "default": mod
7886
+ };
7887
+ };
7577
7888
 
7578
- try {
7579
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7580
- var mutation = _step8.value;
7889
+ Object.defineProperty(exports, "__esModule", {
7890
+ value: true
7891
+ });
7892
+ exports.RemoteRequest = void 0;
7581
7893
 
7582
- if (mutation.type === 'attributes' && element.usesCoreAttribute(mutation.attributeName)) {
7583
- if (element.hasAllCoreAttributes) {
7584
- _this44._load();
7585
- }
7586
- }
7587
- }
7588
- } catch (err) {
7589
- _iterator8.e(err);
7590
- } finally {
7591
- _iterator8.f();
7592
- }
7593
- };
7894
+ var node_fetch_1 = __importDefault(require("node-fetch"));
7895
+ /**
7896
+ * This is used by the core types to perform remote requests
7897
+ */
7594
7898
 
7595
- var observer = new MutationObserver(callback);
7596
- observer.observe(this._element, {
7597
- attributes: true
7598
- }); // load initially if all core attributes are set
7599
7899
 
7600
- if (element.hasAllCoreAttributes) {
7601
- this._load();
7602
- }
7900
+ var RemoteRequest = /*#__PURE__*/function () {
7901
+ function RemoteRequest() {
7902
+ _classCallCheck(this, RemoteRequest);
7603
7903
  }
7604
7904
 
7605
- _createClass(ElementController, [{
7606
- key: "_load",
7607
- value: function _load() {
7608
- if (this._controller) {
7609
- this._controller._destroy();
7610
-
7611
- this._controller = undefined;
7612
- }
7613
-
7614
- var element = this._element;
7615
- this._server = element.hasAttribute("server") ? element.getAttribute("server") : "production";
7616
- var serverLocation = Util.getServerLocation(this._server);
7617
-
7618
- if (serverLocation === undefined) {
7619
- throw new Error("ElementController - attribute \"server\" must be one of \"production\", \"staging\" or \"dev\"");
7620
- }
7621
-
7622
- var embedLocation = Util.getElementLocation(element.elementType);
7623
-
7624
- if (embedLocation === undefined) {
7625
- throw new Error("ElementController - element named \"" + elementType + "\" is invalid");
7626
- }
7905
+ _createClass(RemoteRequest, null, [{
7906
+ key: "request",
7907
+ value: function request(payload) {
7908
+ var retry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
7909
+ return new Promise(function (accept, reject) {
7910
+ if (retry >= 0) {
7911
+ RemoteRequest._send(payload).then(accept)["catch"](function (err) {
7912
+ var newretry = retry - 1;
7627
7913
 
7628
- var source = serverLocation + embedLocation + element.allMappedAttributesQuery; // ensure iframe ID is randomly generated as we could have multiple iframes
7629
- // with same Scene ID - such as viewer and editor running on same page
7914
+ if (newretry < 0) {
7915
+ return reject(err);
7916
+ }
7630
7917
 
7631
- this._messengerID = "element_" + Util.id();
7632
- this._controller = new IFrameController(element, source, this._messengerID, function (node) {
7633
- // for cross-origin messenger setup, we need to setup manually
7634
- // this might require additional iterations
7635
- messenger.addChild(node);
7918
+ console.error("RemoteRequest.request() - retry number " + newretry);
7919
+ console.error(err);
7920
+ setTimeout(function () {
7921
+ RemoteRequest.request(payload, newretry).then(accept)["catch"](reject);
7922
+ }, 500);
7923
+ });
7924
+ } else {
7925
+ return reject(new Error("RemoteRequest.request() - attempted all retries without success"));
7926
+ }
7636
7927
  });
7637
7928
  }
7638
7929
  }, {
7639
- key: "onload",
7640
- set: function set(callback) {
7641
- if (!callback) {
7642
- return;
7643
- }
7930
+ key: "_send",
7931
+ value: function _send(payload) {
7932
+ return new Promise(function (accept, reject) {
7933
+ var endpoint = payload.options.server === "dev" ? "http://localhost:9000/2015-03-31/functions/function/invocations" : "https://3gbnq7wuw2.execute-api.ap-southeast-2.amazonaws.com/main/xrutils";
7934
+ var reqopts = {
7935
+ method: "POST",
7936
+ headers: {
7937
+ 'Accept': 'application/json',
7938
+ 'Content-Type': 'application/json'
7939
+ },
7940
+ body: JSON.stringify(payload)
7941
+ };
7942
+ (0, node_fetch_1["default"])(endpoint, reqopts).then(function (res) {
7943
+ if (res.ok) {
7944
+ try {
7945
+ return res.json();
7946
+ } catch (err) {
7947
+ return new Error("RemoteRequest.request() - critical error occured, cannot proceed");
7948
+ }
7949
+ }
7644
7950
 
7645
- if (this.messenger) {
7646
- callback();
7647
- } else {
7648
- messenger.onload(this._messengerID, function () {
7649
- callback();
7951
+ return new Error("RemoteRequest.request() - unexpected error occured, cannot proceed. error message is " + res.statusText);
7952
+ }).then(function (json) {
7953
+ if (json instanceof Error) {
7954
+ reject(json);
7955
+ } else {
7956
+ accept(json);
7957
+ }
7650
7958
  });
7651
- }
7652
- }
7653
- }, {
7654
- key: "messenger",
7655
- get: function get() {
7656
- return messenger[this._messengerID];
7657
- }
7658
- }, {
7659
- key: "context",
7660
- get: function get() {
7661
- return messenger.self;
7662
- }
7663
- }, {
7664
- key: "controller",
7665
- get: function get() {
7666
- return this._controller;
7959
+ });
7667
7960
  }
7668
7961
  }]);
7669
7962
 
7670
- return ElementController;
7963
+ return RemoteRequest;
7671
7964
  }();
7672
7965
 
7673
- module.exports = ElementController;
7966
+ exports.RemoteRequest = RemoteRequest;
7674
7967
  }, {
7675
- "../../util/util.js": 117,
7676
- "./iframe-controller.js": 107,
7677
- "@plattar/context-messenger": 15
7968
+ "node-fetch": 124
7678
7969
  }],
7679
7970
  107: [function (require, module, exports) {
7680
- var Util = require("../../util/util.js");
7681
-
7682
- var IFrameController = /*#__PURE__*/function () {
7683
- function IFrameController(element, src, id) {
7684
- var _this45 = this;
7685
-
7686
- var onelemload = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
7971
+ "use strict";
7687
7972
 
7688
- _classCallCheck(this, IFrameController);
7973
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
7974
+ if (k2 === undefined) k2 = k;
7975
+ Object.defineProperty(o, k2, {
7976
+ enumerable: true,
7977
+ get: function get() {
7978
+ return m[k];
7979
+ }
7980
+ });
7981
+ } : function (o, m, k, k2) {
7982
+ if (k2 === undefined) k2 = k;
7983
+ o[k2] = m[k];
7984
+ });
7689
7985
 
7690
- this._iframe = document.createElement("iframe");
7691
- this._isDraggable = false; // check the onload functionality if cross-origin is defined
7986
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
7987
+ Object.defineProperty(o, "default", {
7988
+ enumerable: true,
7989
+ value: v
7990
+ });
7991
+ } : function (o, v) {
7992
+ o["default"] = v;
7993
+ });
7692
7994
 
7693
- if (!element.hasAttribute("sameorigin")) {
7694
- this._iframe.onload = function () {
7695
- if (onelemload) {
7696
- onelemload(_this45._iframe);
7697
- }
7698
- };
7699
- }
7995
+ var __importStar = this && this.__importStar || function (mod) {
7996
+ if (mod && mod.__esModule) return mod;
7997
+ var result = {};
7998
+ if (mod != null) for (var k in mod) {
7999
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
8000
+ }
7700
8001
 
7701
- this._iframe.setAttribute("id", id);
8002
+ __setModuleDefault(result, mod);
7702
8003
 
7703
- this._iframe.setAttribute("width", element.hasAttribute("width") ? element.getAttribute("width") : "500px");
8004
+ return result;
8005
+ };
7704
8006
 
7705
- this._iframe.setAttribute("height", element.hasAttribute("height") ? element.getAttribute("height") : "500px");
8007
+ var __importDefault = this && this.__importDefault || function (mod) {
8008
+ return mod && mod.__esModule ? mod : {
8009
+ "default": mod
8010
+ };
8011
+ };
7706
8012
 
7707
- this._iframe.setAttribute("src", src);
8013
+ Object.defineProperty(exports, "__esModule", {
8014
+ value: true
8015
+ });
8016
+ exports.version = exports.ModelConverter = exports.Configurator = void 0;
7708
8017
 
7709
- this._iframe.setAttribute("frameBorder", "0");
8018
+ var configurator_1 = require("./core/configurator");
7710
8019
 
7711
- var permissions = Util.getPermissionString(element.permissions);
8020
+ Object.defineProperty(exports, "Configurator", {
8021
+ enumerable: true,
8022
+ get: function get() {
8023
+ return configurator_1.Configurator;
8024
+ }
8025
+ });
7712
8026
 
7713
- if (permissions) {
7714
- this._iframe.setAttribute("allow", permissions);
7715
- }
8027
+ var model_converter_1 = require("./core/model-converter");
7716
8028
 
7717
- var shadow = element.shadowRoot || element.attachShadow({
7718
- mode: 'open'
7719
- });
7720
- this.allowDragging = false;
7721
- shadow.append(this._iframe);
8029
+ Object.defineProperty(exports, "ModelConverter", {
8030
+ enumerable: true,
8031
+ get: function get() {
8032
+ return model_converter_1.ModelConverter;
8033
+ }
8034
+ });
8035
+ exports.version = __importStar(require("./version"));
7722
8036
 
7723
- if (element.hasAttribute("fullscreen")) {
7724
- var style = document.createElement('style');
7725
- style.textContent = "\n ._PlattarFullScreen {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n }\n ";
7726
- this._iframe.className = "_PlattarFullScreen";
7727
- shadow.append(style);
7728
- this._fsStyle = style;
7729
- }
8037
+ var version_1 = __importDefault(require("./version"));
8038
+
8039
+ console.log("using @plattar/plattar-services v" + version_1["default"]);
8040
+ }, {
8041
+ "./core/configurator": 104,
8042
+ "./core/model-converter": 105,
8043
+ "./version": 108
8044
+ }],
8045
+ 108: [function (require, module, exports) {
8046
+ "use strict";
8047
+
8048
+ Object.defineProperty(exports, "__esModule", {
8049
+ value: true
8050
+ });
8051
+ exports["default"] = "1.120.1";
8052
+ }, {}],
8053
+ 109: [function (require, module, exports) {
8054
+ var ElementController = require("../controllers/element-controller");
8055
+
8056
+ var BaseElement = /*#__PURE__*/function (_HTMLElement3) {
8057
+ _inherits(BaseElement, _HTMLElement3);
8058
+
8059
+ var _super69 = _createSuper(BaseElement);
8060
+
8061
+ function BaseElement() {
8062
+ _classCallCheck(this, BaseElement);
8063
+
8064
+ return _super69.call(this);
7730
8065
  }
7731
8066
 
7732
- _createClass(IFrameController, [{
7733
- key: "allowDragDrop",
7734
- get: function get() {
7735
- return this._isDraggable;
7736
- },
7737
- set: function set(value) {
7738
- if (value) {
7739
- this._isDraggable = true;
7740
- this._iframe.style.pointerEvents = "none";
7741
- } else {
7742
- this._isDraggable = false;
7743
- this._iframe.style.pointerEvents = "auto";
7744
- }
8067
+ _createClass(BaseElement, [{
8068
+ key: "connectedCallback",
8069
+ value: function connectedCallback() {
8070
+ this._controller = new ElementController(this);
7745
8071
  }
7746
8072
  }, {
7747
- key: "_destroy",
7748
- value: function _destroy() {
7749
- if (this._iframe) {
7750
- this._iframe.remove();
7751
- }
7752
-
7753
- if (this._fsStyle) {
7754
- this._fsStyle.remove();
8073
+ key: "onready",
8074
+ set: function set(callback) {
8075
+ if (this._controller) {
8076
+ this._controller.onload = callback;
8077
+ return;
7755
8078
  }
7756
8079
 
7757
- this._iframe = undefined;
7758
- this._fsStyle = undefined;
8080
+ throw new Error("set BaseElement.onready - cannot use as element not connected");
7759
8081
  }
7760
8082
  }, {
7761
- key: "width",
8083
+ key: "messenger",
7762
8084
  get: function get() {
7763
- return this._iframe.getAttribute("width");
7764
- },
7765
- set: function set(value) {
7766
- this._iframe.setAttribute("width", value);
8085
+ return this._controller ? this._controller.messenger : undefined;
7767
8086
  }
7768
8087
  }, {
7769
- key: "child",
8088
+ key: "context",
7770
8089
  get: function get() {
7771
- return this._iframe;
8090
+ return this._controller ? this._controller.context : undefined;
7772
8091
  }
7773
8092
  }, {
7774
- key: "height",
8093
+ key: "element",
7775
8094
  get: function get() {
7776
- return this._iframe.getAttribute("height");
7777
- },
7778
- set: function set(value) {
7779
- this._iframe.setAttribute("height", value);
8095
+ return this._controller;
7780
8096
  }
7781
8097
  }, {
7782
- key: "id",
8098
+ key: "ready",
7783
8099
  get: function get() {
7784
- return this._iframe.id;
8100
+ return this._controller ? true : false;
7785
8101
  }
7786
- }]);
7787
-
7788
- return IFrameController;
7789
- }();
7790
-
7791
- module.exports = IFrameController;
7792
- }, {
7793
- "../../util/util.js": 117
7794
- }],
7795
- 108: [function (require, module, exports) {
7796
- var BaseElement = require("./base/base-element.js");
7797
-
7798
- var EditorElement = /*#__PURE__*/function (_BaseElement3) {
7799
- _inherits(EditorElement, _BaseElement3);
7800
-
7801
- var _super71 = _createSuper(EditorElement);
7802
-
7803
- function EditorElement() {
7804
- _classCallCheck(this, EditorElement);
7805
-
7806
- return _super71.call(this);
7807
- }
8102
+ }, {
8103
+ key: "allowDragDrop",
8104
+ get: function get() {
8105
+ return this._controller ? this._controller.controller.allowDragDrop : false;
8106
+ },
8107
+ set: function set(value) {
8108
+ if (this._controller) {
8109
+ this._controller.controller.allowDragDrop = value;
8110
+ return;
8111
+ }
7808
8112
 
7809
- _createClass(EditorElement, [{
8113
+ throw new Error("set BaseElement.allowDragDrop - cannot use as element not connected");
8114
+ }
8115
+ }, {
7810
8116
  key: "permissions",
7811
8117
  get: function get() {
7812
- return ["autoplay"];
8118
+ return [];
7813
8119
  }
7814
8120
  }, {
7815
- key: "elementType",
8121
+ key: "coreAttributes",
7816
8122
  get: function get() {
7817
- return "editor";
8123
+ return [{
8124
+ key: "scene-id",
8125
+ map: "scene_id"
8126
+ }];
7818
8127
  }
7819
- }]);
7820
-
7821
- return EditorElement;
7822
- }(BaseElement);
7823
-
7824
- module.exports = EditorElement;
7825
- }, {
7826
- "./base/base-element.js": 104
7827
- }],
7828
- 109: [function (require, module, exports) {
7829
- var BaseElement = require("./base/base-element.js");
7830
-
7831
- var EWallElement = /*#__PURE__*/function (_BaseElement4) {
7832
- _inherits(EWallElement, _BaseElement4);
7833
-
7834
- var _super72 = _createSuper(EWallElement);
7835
-
7836
- function EWallElement() {
7837
- var _this46;
7838
-
7839
- _classCallCheck(this, EWallElement);
7840
-
7841
- _this46 = _super72.call(this);
7842
- var tag = document.createElement("script");
7843
- tag.src = "https://cdn.8thwall.com/web/iframe/iframe.js";
7844
- tag.defer = true;
7845
- return _this46;
7846
- }
7847
-
7848
- _createClass(EWallElement, [{
7849
- key: "connectedCallback",
7850
- value: function connectedCallback() {
7851
- _get2(_getPrototypeOf(EWallElement.prototype), "connectedCallback", this).call(this); // this is the iframe ID
7852
-
7853
-
7854
- var id = this.element.controller.id;
8128
+ }, {
8129
+ key: "usesCoreAttribute",
8130
+ value: function usesCoreAttribute(key) {
8131
+ var attr = this.coreAttributes;
8132
+ var length = attr.length;
7855
8133
 
7856
- var onLoad = function onLoad() {
7857
- if (window.XRIFrame) {
7858
- window.XRIFrame.registerXRIFrame(id);
8134
+ for (var i = 0; i < length; i++) {
8135
+ if (attr[i].key === key) {
8136
+ return true;
7859
8137
  }
7860
- };
8138
+ }
7861
8139
 
7862
- window.addEventListener('load', onLoad, false);
8140
+ return false;
7863
8141
  }
7864
8142
  }, {
7865
- key: "permissions",
8143
+ key: "optionalAttributes",
7866
8144
  get: function get() {
7867
- return ["camera", "autoplay", "xr-spatial-tracking", "gyroscope", "accelerometer"];
8145
+ return [];
7868
8146
  }
7869
8147
  }, {
7870
- key: "elementType",
8148
+ key: "hasAllCoreAttributes",
7871
8149
  get: function get() {
7872
- return "ewall";
7873
- }
7874
- }]);
7875
-
7876
- return EWallElement;
7877
- }(BaseElement);
8150
+ var attr = this.coreAttributes;
8151
+ var length = attr.length;
7878
8152
 
7879
- module.exports = EWallElement;
7880
- }, {
7881
- "./base/base-element.js": 104
7882
- }],
7883
- 110: [function (require, module, exports) {
7884
- var BaseElement = require("./base/base-element.js");
8153
+ for (var i = 0; i < length; i++) {
8154
+ if (!this.hasAttribute(attr[i].key)) {
8155
+ return false;
8156
+ }
8157
+ }
7885
8158
 
7886
- var FaceARElement = /*#__PURE__*/function (_BaseElement5) {
7887
- _inherits(FaceARElement, _BaseElement5);
8159
+ return true;
8160
+ }
8161
+ }, {
8162
+ key: "allMappedAttributes",
8163
+ get: function get() {
8164
+ var _this46 = this;
7888
8165
 
7889
- var _super73 = _createSuper(FaceARElement);
8166
+ var map = new Map();
8167
+ var coreAttr = this.coreAttributes;
8168
+ var optAttr = this.optionalAttributes;
8169
+ coreAttr.forEach(function (ele) {
8170
+ if (_this46.hasAttribute(ele.key)) {
8171
+ map.set(ele.map, _this46.getAttribute(ele.key));
8172
+ }
8173
+ });
8174
+ optAttr.forEach(function (ele) {
8175
+ if (_this46.hasAttribute(ele.key)) {
8176
+ map.set(ele.map, _this46.getAttribute(ele.key));
8177
+ }
8178
+ });
8179
+ return map;
8180
+ }
8181
+ }, {
8182
+ key: "allMappedAttributesQuery",
8183
+ get: function get() {
8184
+ var attr = this.allMappedAttributes;
8185
+ var queryStr = "";
8186
+ var first = true;
7890
8187
 
7891
- function FaceARElement() {
7892
- _classCallCheck(this, FaceARElement);
8188
+ var _iterator7 = _createForOfIteratorHelper(attr.entries()),
8189
+ _step7;
7893
8190
 
7894
- return _super73.call(this);
7895
- }
8191
+ try {
8192
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
8193
+ var _step7$value = _slicedToArray(_step7.value, 2),
8194
+ key = _step7$value[0],
8195
+ value = _step7$value[1];
7896
8196
 
7897
- _createClass(FaceARElement, [{
7898
- key: "permissions",
7899
- get: function get() {
7900
- return ["camera", "autoplay"];
8197
+ queryStr += first ? "?" + key + "=" + value : "&" + key + "=" + value;
8198
+ first = false;
8199
+ }
8200
+ } catch (err) {
8201
+ _iterator7.e(err);
8202
+ } finally {
8203
+ _iterator7.f();
8204
+ }
8205
+
8206
+ return queryStr;
7901
8207
  }
7902
8208
  }, {
7903
8209
  key: "elementType",
7904
8210
  get: function get() {
7905
- return "facear";
7906
- }
7907
- }, {
7908
- key: "optionalAttributes",
7909
- get: function get() {
7910
- return [{
7911
- key: "variation-id",
7912
- map: "variationId"
7913
- }, {
7914
- key: "product-id",
7915
- map: "productId"
7916
- }];
8211
+ return "none";
7917
8212
  }
7918
8213
  }]);
7919
8214
 
7920
- return FaceARElement;
7921
- }(BaseElement);
8215
+ return BaseElement;
8216
+ }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
7922
8217
 
7923
- module.exports = FaceARElement;
8218
+ module.exports = BaseElement;
7924
8219
  }, {
7925
- "./base/base-element.js": 104
8220
+ "../controllers/element-controller": 111
7926
8221
  }],
7927
- 111: [function (require, module, exports) {
8222
+ 110: [function (require, module, exports) {
7928
8223
  var BaseElement = require("./base/base-element.js");
7929
8224
 
7930
- var ModelElement = /*#__PURE__*/function (_BaseElement6) {
7931
- _inherits(ModelElement, _BaseElement6);
8225
+ var ConfiguratorElement = /*#__PURE__*/function (_BaseElement2) {
8226
+ _inherits(ConfiguratorElement, _BaseElement2);
7932
8227
 
7933
- var _super74 = _createSuper(ModelElement);
8228
+ var _super70 = _createSuper(ConfiguratorElement);
7934
8229
 
7935
- function ModelElement() {
7936
- _classCallCheck(this, ModelElement);
8230
+ function ConfiguratorElement() {
8231
+ _classCallCheck(this, ConfiguratorElement);
7937
8232
 
7938
- return _super74.call(this);
8233
+ return _super70.call(this);
7939
8234
  }
7940
8235
 
7941
- _createClass(ModelElement, [{
8236
+ _createClass(ConfiguratorElement, [{
7942
8237
  key: "permissions",
7943
8238
  get: function get() {
7944
8239
  return ["autoplay"];
@@ -7946,130 +8241,376 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7946
8241
  }, {
7947
8242
  key: "elementType",
7948
8243
  get: function get() {
7949
- return "model";
8244
+ return "configurator";
7950
8245
  }
7951
8246
  }, {
7952
- key: "coreAttributes",
8247
+ key: "optionalAttributes",
7953
8248
  get: function get() {
7954
8249
  return [{
7955
- key: "model-id",
7956
- map: "model_id"
8250
+ key: "config-state",
8251
+ map: "config_state"
8252
+ }, {
8253
+ key: "show-ar",
8254
+ map: "show_ar"
7957
8255
  }];
7958
8256
  }
7959
8257
  }]);
7960
8258
 
7961
- return ModelElement;
8259
+ return ConfiguratorElement;
7962
8260
  }(BaseElement);
7963
8261
 
7964
- module.exports = ModelElement;
8262
+ module.exports = ConfiguratorElement;
7965
8263
  }, {
7966
- "./base/base-element.js": 104
8264
+ "./base/base-element.js": 109
7967
8265
  }],
7968
- 112: [function (require, module, exports) {
7969
- var BaseElement = require("./base/base-element.js");
8266
+ 111: [function (require, module, exports) {
8267
+ var Util = require("../../util/util.js");
7970
8268
 
7971
- var ProductElement = /*#__PURE__*/function (_BaseElement7) {
7972
- _inherits(ProductElement, _BaseElement7);
8269
+ var _require = require("@plattar/context-messenger"),
8270
+ messenger = _require.messenger;
7973
8271
 
7974
- var _super75 = _createSuper(ProductElement);
8272
+ var IFrameController = require("./iframe-controller.js");
7975
8273
 
7976
- function ProductElement() {
7977
- _classCallCheck(this, ProductElement);
8274
+ var ElementController = /*#__PURE__*/function () {
8275
+ function ElementController(element) {
8276
+ var _this47 = this;
7978
8277
 
7979
- return _super75.call(this);
8278
+ _classCallCheck(this, ElementController);
8279
+
8280
+ this._element = element; // observe the changes in scene-id
8281
+
8282
+ var callback = function callback(mutationsList) {
8283
+ var _iterator8 = _createForOfIteratorHelper(mutationsList),
8284
+ _step8;
8285
+
8286
+ try {
8287
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
8288
+ var mutation = _step8.value;
8289
+
8290
+ if (mutation.type === 'attributes' && element.usesCoreAttribute(mutation.attributeName)) {
8291
+ if (element.hasAllCoreAttributes) {
8292
+ _this47._load();
8293
+ }
8294
+ }
8295
+ }
8296
+ } catch (err) {
8297
+ _iterator8.e(err);
8298
+ } finally {
8299
+ _iterator8.f();
8300
+ }
8301
+ };
8302
+
8303
+ var observer = new MutationObserver(callback);
8304
+ observer.observe(this._element, {
8305
+ attributes: true
8306
+ }); // load initially if all core attributes are set
8307
+
8308
+ if (element.hasAllCoreAttributes) {
8309
+ this._load();
8310
+ }
7980
8311
  }
7981
8312
 
7982
- _createClass(ProductElement, [{
7983
- key: "permissions",
7984
- get: function get() {
7985
- return ["autoplay"];
8313
+ _createClass(ElementController, [{
8314
+ key: "_load",
8315
+ value: function _load() {
8316
+ if (this._controller) {
8317
+ this._controller._destroy();
8318
+
8319
+ this._controller = undefined;
8320
+ }
8321
+
8322
+ var element = this._element;
8323
+ this._server = element.hasAttribute("server") ? element.getAttribute("server") : "production";
8324
+ var serverLocation = Util.getServerLocation(this._server);
8325
+
8326
+ if (serverLocation === undefined) {
8327
+ throw new Error("ElementController - attribute \"server\" must be one of \"production\", \"staging\" or \"dev\"");
8328
+ }
8329
+
8330
+ var embedLocation = Util.getElementLocation(element.elementType);
8331
+
8332
+ if (embedLocation === undefined) {
8333
+ throw new Error("ElementController - element named \"" + elementType + "\" is invalid");
8334
+ }
8335
+
8336
+ var source = serverLocation + embedLocation + element.allMappedAttributesQuery; // ensure iframe ID is randomly generated as we could have multiple iframes
8337
+ // with same Scene ID - such as viewer and editor running on same page
8338
+
8339
+ this._messengerID = "element_" + Util.id();
8340
+ this._controller = new IFrameController(element, source, this._messengerID, function (node) {
8341
+ // for cross-origin messenger setup, we need to setup manually
8342
+ // this might require additional iterations
8343
+ messenger.addChild(node);
8344
+ });
7986
8345
  }
7987
8346
  }, {
7988
- key: "elementType",
8347
+ key: "onload",
8348
+ set: function set(callback) {
8349
+ if (!callback) {
8350
+ return;
8351
+ }
8352
+
8353
+ if (this.messenger) {
8354
+ callback();
8355
+ } else {
8356
+ messenger.onload(this._messengerID, function () {
8357
+ callback();
8358
+ });
8359
+ }
8360
+ }
8361
+ }, {
8362
+ key: "messenger",
7989
8363
  get: function get() {
7990
- return "product";
8364
+ return messenger[this._messengerID];
7991
8365
  }
7992
8366
  }, {
7993
- key: "coreAttributes",
8367
+ key: "context",
7994
8368
  get: function get() {
7995
- return [{
7996
- key: "product-id",
7997
- map: "product_id"
7998
- }];
8369
+ return messenger.self;
7999
8370
  }
8000
8371
  }, {
8001
- key: "optionalAttributes",
8372
+ key: "controller",
8002
8373
  get: function get() {
8003
- return [{
8004
- key: "variation-id",
8005
- map: "variation_id"
8006
- }];
8374
+ return this._controller;
8007
8375
  }
8008
8376
  }]);
8009
8377
 
8010
- return ProductElement;
8011
- }(BaseElement);
8378
+ return ElementController;
8379
+ }();
8012
8380
 
8013
- module.exports = ProductElement;
8381
+ module.exports = ElementController;
8014
8382
  }, {
8015
- "./base/base-element.js": 104
8383
+ "../../util/util.js": 122,
8384
+ "./iframe-controller.js": 112,
8385
+ "@plattar/context-messenger": 15
8016
8386
  }],
8017
- 113: [function (require, module, exports) {
8018
- var BaseElement = require("./base/base-element.js");
8387
+ 112: [function (require, module, exports) {
8388
+ var Util = require("../../util/util.js");
8019
8389
 
8020
- var StudioElement = /*#__PURE__*/function (_BaseElement8) {
8021
- _inherits(StudioElement, _BaseElement8);
8390
+ var IFrameController = /*#__PURE__*/function () {
8391
+ function IFrameController(element, src, id) {
8392
+ var _this48 = this;
8022
8393
 
8023
- var _super76 = _createSuper(StudioElement);
8394
+ var onelemload = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
8024
8395
 
8025
- function StudioElement() {
8026
- _classCallCheck(this, StudioElement);
8396
+ _classCallCheck(this, IFrameController);
8027
8397
 
8028
- return _super76.call(this);
8029
- }
8398
+ this._iframe = document.createElement("iframe");
8399
+ this._isDraggable = false; // check the onload functionality if cross-origin is defined
8030
8400
 
8031
- _createClass(StudioElement, [{
8032
- key: "permissions",
8033
- get: function get() {
8034
- return ["autoplay"];
8035
- }
8036
- }, {
8037
- key: "elementType",
8038
- get: function get() {
8039
- return "studio";
8401
+ if (!element.hasAttribute("sameorigin")) {
8402
+ this._iframe.onload = function () {
8403
+ if (onelemload) {
8404
+ onelemload(_this48._iframe);
8405
+ }
8406
+ };
8040
8407
  }
8041
- }]);
8042
8408
 
8043
- return StudioElement;
8409
+ this._iframe.setAttribute("id", id);
8410
+
8411
+ this._iframe.setAttribute("width", element.hasAttribute("width") ? element.getAttribute("width") : "500px");
8412
+
8413
+ this._iframe.setAttribute("height", element.hasAttribute("height") ? element.getAttribute("height") : "500px");
8414
+
8415
+ this._iframe.setAttribute("src", src);
8416
+
8417
+ this._iframe.setAttribute("frameBorder", "0");
8418
+
8419
+ var permissions = Util.getPermissionString(element.permissions);
8420
+
8421
+ if (permissions) {
8422
+ this._iframe.setAttribute("allow", permissions);
8423
+ }
8424
+
8425
+ var shadow = element.shadowRoot || element.attachShadow({
8426
+ mode: 'open'
8427
+ });
8428
+ this.allowDragging = false;
8429
+ shadow.append(this._iframe);
8430
+
8431
+ if (element.hasAttribute("fullscreen")) {
8432
+ var style = document.createElement('style');
8433
+ style.textContent = "\n ._PlattarFullScreen {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n }\n ";
8434
+ this._iframe.className = "_PlattarFullScreen";
8435
+ shadow.append(style);
8436
+ this._fsStyle = style;
8437
+ }
8438
+ }
8439
+
8440
+ _createClass(IFrameController, [{
8441
+ key: "allowDragDrop",
8442
+ get: function get() {
8443
+ return this._isDraggable;
8444
+ },
8445
+ set: function set(value) {
8446
+ if (value) {
8447
+ this._isDraggable = true;
8448
+ this._iframe.style.pointerEvents = "none";
8449
+ } else {
8450
+ this._isDraggable = false;
8451
+ this._iframe.style.pointerEvents = "auto";
8452
+ }
8453
+ }
8454
+ }, {
8455
+ key: "_destroy",
8456
+ value: function _destroy() {
8457
+ if (this._iframe) {
8458
+ this._iframe.remove();
8459
+ }
8460
+
8461
+ if (this._fsStyle) {
8462
+ this._fsStyle.remove();
8463
+ }
8464
+
8465
+ this._iframe = undefined;
8466
+ this._fsStyle = undefined;
8467
+ }
8468
+ }, {
8469
+ key: "width",
8470
+ get: function get() {
8471
+ return this._iframe.getAttribute("width");
8472
+ },
8473
+ set: function set(value) {
8474
+ this._iframe.setAttribute("width", value);
8475
+ }
8476
+ }, {
8477
+ key: "child",
8478
+ get: function get() {
8479
+ return this._iframe;
8480
+ }
8481
+ }, {
8482
+ key: "height",
8483
+ get: function get() {
8484
+ return this._iframe.getAttribute("height");
8485
+ },
8486
+ set: function set(value) {
8487
+ this._iframe.setAttribute("height", value);
8488
+ }
8489
+ }, {
8490
+ key: "id",
8491
+ get: function get() {
8492
+ return this._iframe.id;
8493
+ }
8494
+ }]);
8495
+
8496
+ return IFrameController;
8497
+ }();
8498
+
8499
+ module.exports = IFrameController;
8500
+ }, {
8501
+ "../../util/util.js": 122
8502
+ }],
8503
+ 113: [function (require, module, exports) {
8504
+ var BaseElement = require("./base/base-element.js");
8505
+
8506
+ var EditorElement = /*#__PURE__*/function (_BaseElement3) {
8507
+ _inherits(EditorElement, _BaseElement3);
8508
+
8509
+ var _super71 = _createSuper(EditorElement);
8510
+
8511
+ function EditorElement() {
8512
+ _classCallCheck(this, EditorElement);
8513
+
8514
+ return _super71.call(this);
8515
+ }
8516
+
8517
+ _createClass(EditorElement, [{
8518
+ key: "permissions",
8519
+ get: function get() {
8520
+ return ["autoplay"];
8521
+ }
8522
+ }, {
8523
+ key: "elementType",
8524
+ get: function get() {
8525
+ return "editor";
8526
+ }
8527
+ }]);
8528
+
8529
+ return EditorElement;
8044
8530
  }(BaseElement);
8045
8531
 
8046
- module.exports = StudioElement;
8532
+ module.exports = EditorElement;
8047
8533
  }, {
8048
- "./base/base-element.js": 104
8534
+ "./base/base-element.js": 109
8049
8535
  }],
8050
8536
  114: [function (require, module, exports) {
8051
8537
  var BaseElement = require("./base/base-element.js");
8052
8538
 
8053
- var ViewerElement = /*#__PURE__*/function (_BaseElement9) {
8054
- _inherits(ViewerElement, _BaseElement9);
8539
+ var EWallElement = /*#__PURE__*/function (_BaseElement4) {
8540
+ _inherits(EWallElement, _BaseElement4);
8055
8541
 
8056
- var _super77 = _createSuper(ViewerElement);
8542
+ var _super72 = _createSuper(EWallElement);
8057
8543
 
8058
- function ViewerElement() {
8059
- _classCallCheck(this, ViewerElement);
8544
+ function EWallElement() {
8545
+ var _this49;
8060
8546
 
8061
- return _super77.call(this);
8547
+ _classCallCheck(this, EWallElement);
8548
+
8549
+ _this49 = _super72.call(this);
8550
+ var tag = document.createElement("script");
8551
+ tag.src = "https://cdn.8thwall.com/web/iframe/iframe.js";
8552
+ tag.defer = true;
8553
+ return _this49;
8062
8554
  }
8063
8555
 
8064
- _createClass(ViewerElement, [{
8556
+ _createClass(EWallElement, [{
8557
+ key: "connectedCallback",
8558
+ value: function connectedCallback() {
8559
+ _get2(_getPrototypeOf(EWallElement.prototype), "connectedCallback", this).call(this); // this is the iframe ID
8560
+
8561
+
8562
+ var id = this.element.controller.id;
8563
+
8564
+ var onLoad = function onLoad() {
8565
+ if (window.XRIFrame) {
8566
+ window.XRIFrame.registerXRIFrame(id);
8567
+ }
8568
+ };
8569
+
8570
+ window.addEventListener('load', onLoad, false);
8571
+ }
8572
+ }, {
8065
8573
  key: "permissions",
8066
8574
  get: function get() {
8067
- return ["autoplay"];
8575
+ return ["camera", "autoplay", "xr-spatial-tracking", "gyroscope", "accelerometer"];
8068
8576
  }
8069
8577
  }, {
8070
8578
  key: "elementType",
8071
8579
  get: function get() {
8072
- return "viewer";
8580
+ return "ewall";
8581
+ }
8582
+ }]);
8583
+
8584
+ return EWallElement;
8585
+ }(BaseElement);
8586
+
8587
+ module.exports = EWallElement;
8588
+ }, {
8589
+ "./base/base-element.js": 109
8590
+ }],
8591
+ 115: [function (require, module, exports) {
8592
+ var BaseElement = require("./base/base-element.js");
8593
+
8594
+ var FaceARElement = /*#__PURE__*/function (_BaseElement5) {
8595
+ _inherits(FaceARElement, _BaseElement5);
8596
+
8597
+ var _super73 = _createSuper(FaceARElement);
8598
+
8599
+ function FaceARElement() {
8600
+ _classCallCheck(this, FaceARElement);
8601
+
8602
+ return _super73.call(this);
8603
+ }
8604
+
8605
+ _createClass(FaceARElement, [{
8606
+ key: "permissions",
8607
+ get: function get() {
8608
+ return ["camera", "autoplay"];
8609
+ }
8610
+ }, {
8611
+ key: "elementType",
8612
+ get: function get() {
8613
+ return "facear";
8073
8614
  }
8074
8615
  }, {
8075
8616
  key: "optionalAttributes",
@@ -8084,260 +8625,1699 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
8084
8625
  }
8085
8626
  }]);
8086
8627
 
8087
- return ViewerElement;
8628
+ return FaceARElement;
8088
8629
  }(BaseElement);
8089
8630
 
8090
- module.exports = ViewerElement;
8631
+ module.exports = FaceARElement;
8091
8632
  }, {
8092
- "./base/base-element.js": 104
8633
+ "./base/base-element.js": 109
8093
8634
  }],
8094
- 115: [function (require, module, exports) {
8635
+ 116: [function (require, module, exports) {
8095
8636
  var BaseElement = require("./base/base-element.js");
8096
8637
 
8097
- var WebXRElement = /*#__PURE__*/function (_BaseElement10) {
8098
- _inherits(WebXRElement, _BaseElement10);
8638
+ var ModelElement = /*#__PURE__*/function (_BaseElement6) {
8639
+ _inherits(ModelElement, _BaseElement6);
8099
8640
 
8100
- var _super78 = _createSuper(WebXRElement);
8641
+ var _super74 = _createSuper(ModelElement);
8101
8642
 
8102
- function WebXRElement() {
8103
- _classCallCheck(this, WebXRElement);
8643
+ function ModelElement() {
8644
+ _classCallCheck(this, ModelElement);
8645
+
8646
+ return _super74.call(this);
8647
+ }
8648
+
8649
+ _createClass(ModelElement, [{
8650
+ key: "permissions",
8651
+ get: function get() {
8652
+ return ["autoplay"];
8653
+ }
8654
+ }, {
8655
+ key: "elementType",
8656
+ get: function get() {
8657
+ return "model";
8658
+ }
8659
+ }, {
8660
+ key: "coreAttributes",
8661
+ get: function get() {
8662
+ return [{
8663
+ key: "model-id",
8664
+ map: "model_id"
8665
+ }];
8666
+ }
8667
+ }]);
8668
+
8669
+ return ModelElement;
8670
+ }(BaseElement);
8671
+
8672
+ module.exports = ModelElement;
8673
+ }, {
8674
+ "./base/base-element.js": 109
8675
+ }],
8676
+ 117: [function (require, module, exports) {
8677
+ var BaseElement = require("./base/base-element.js");
8678
+
8679
+ var ProductElement = /*#__PURE__*/function (_BaseElement7) {
8680
+ _inherits(ProductElement, _BaseElement7);
8681
+
8682
+ var _super75 = _createSuper(ProductElement);
8683
+
8684
+ function ProductElement() {
8685
+ _classCallCheck(this, ProductElement);
8686
+
8687
+ return _super75.call(this);
8688
+ }
8689
+
8690
+ _createClass(ProductElement, [{
8691
+ key: "permissions",
8692
+ get: function get() {
8693
+ return ["autoplay"];
8694
+ }
8695
+ }, {
8696
+ key: "elementType",
8697
+ get: function get() {
8698
+ return "product";
8699
+ }
8700
+ }, {
8701
+ key: "coreAttributes",
8702
+ get: function get() {
8703
+ return [{
8704
+ key: "product-id",
8705
+ map: "product_id"
8706
+ }];
8707
+ }
8708
+ }, {
8709
+ key: "optionalAttributes",
8710
+ get: function get() {
8711
+ return [{
8712
+ key: "variation-id",
8713
+ map: "variation_id"
8714
+ }];
8715
+ }
8716
+ }]);
8717
+
8718
+ return ProductElement;
8719
+ }(BaseElement);
8720
+
8721
+ module.exports = ProductElement;
8722
+ }, {
8723
+ "./base/base-element.js": 109
8724
+ }],
8725
+ 118: [function (require, module, exports) {
8726
+ var BaseElement = require("./base/base-element.js");
8727
+
8728
+ var StudioElement = /*#__PURE__*/function (_BaseElement8) {
8729
+ _inherits(StudioElement, _BaseElement8);
8730
+
8731
+ var _super76 = _createSuper(StudioElement);
8732
+
8733
+ function StudioElement() {
8734
+ _classCallCheck(this, StudioElement);
8735
+
8736
+ return _super76.call(this);
8737
+ }
8738
+
8739
+ _createClass(StudioElement, [{
8740
+ key: "permissions",
8741
+ get: function get() {
8742
+ return ["autoplay"];
8743
+ }
8744
+ }, {
8745
+ key: "elementType",
8746
+ get: function get() {
8747
+ return "studio";
8748
+ }
8749
+ }]);
8750
+
8751
+ return StudioElement;
8752
+ }(BaseElement);
8753
+
8754
+ module.exports = StudioElement;
8755
+ }, {
8756
+ "./base/base-element.js": 109
8757
+ }],
8758
+ 119: [function (require, module, exports) {
8759
+ var BaseElement = require("./base/base-element.js");
8760
+
8761
+ var ViewerElement = /*#__PURE__*/function (_BaseElement9) {
8762
+ _inherits(ViewerElement, _BaseElement9);
8763
+
8764
+ var _super77 = _createSuper(ViewerElement);
8765
+
8766
+ function ViewerElement() {
8767
+ _classCallCheck(this, ViewerElement);
8768
+
8769
+ return _super77.call(this);
8770
+ }
8771
+
8772
+ _createClass(ViewerElement, [{
8773
+ key: "permissions",
8774
+ get: function get() {
8775
+ return ["autoplay"];
8776
+ }
8777
+ }, {
8778
+ key: "elementType",
8779
+ get: function get() {
8780
+ return "viewer";
8781
+ }
8782
+ }, {
8783
+ key: "optionalAttributes",
8784
+ get: function get() {
8785
+ return [{
8786
+ key: "variation-id",
8787
+ map: "variationId"
8788
+ }, {
8789
+ key: "product-id",
8790
+ map: "productId"
8791
+ }];
8792
+ }
8793
+ }]);
8794
+
8795
+ return ViewerElement;
8796
+ }(BaseElement);
8797
+
8798
+ module.exports = ViewerElement;
8799
+ }, {
8800
+ "./base/base-element.js": 109
8801
+ }],
8802
+ 120: [function (require, module, exports) {
8803
+ var BaseElement = require("./base/base-element.js");
8804
+
8805
+ var WebXRElement = /*#__PURE__*/function (_BaseElement10) {
8806
+ _inherits(WebXRElement, _BaseElement10);
8807
+
8808
+ var _super78 = _createSuper(WebXRElement);
8809
+
8810
+ function WebXRElement() {
8811
+ _classCallCheck(this, WebXRElement);
8812
+
8813
+ return _super78.call(this);
8814
+ }
8815
+
8816
+ _createClass(WebXRElement, [{
8817
+ key: "permissions",
8818
+ get: function get() {
8819
+ return ["camera", "autoplay", "xr-spatial-tracking"];
8820
+ }
8821
+ }, {
8822
+ key: "elementType",
8823
+ get: function get() {
8824
+ return "webxr";
8825
+ }
8826
+ }]);
8827
+
8828
+ return WebXRElement;
8829
+ }(BaseElement);
8830
+
8831
+ module.exports = WebXRElement;
8832
+ }, {
8833
+ "./base/base-element.js": 109
8834
+ }],
8835
+ 121: [function (require, module, exports) {
8836
+ "use strict";
8837
+
8838
+ var WebXRElement = require("./elements/webxr-element.js");
8839
+
8840
+ var ViewerElement = require("./elements/viewer-element.js");
8841
+
8842
+ var ProductElement = require("./elements/product-element.js");
8843
+
8844
+ var EWallElement = require("./elements/ewall-element.js");
8845
+
8846
+ var FaceARElement = require("./elements/facear-element.js");
8847
+
8848
+ var EditorElement = require("./elements/editor-element.js");
8849
+
8850
+ var StudioElement = require("./elements/studio-element.js");
8851
+
8852
+ var ModelElement = require("./elements/model-element.js");
8853
+
8854
+ var ConfiguratorElement = require("./elements/configurator-element.js");
8855
+
8856
+ var Version = require("./version");
8857
+
8858
+ if (customElements.get("plattar-webxr") === undefined) {
8859
+ customElements.define("plattar-webxr", WebXRElement);
8860
+ }
8861
+
8862
+ if (customElements.get("plattar-viewer") === undefined) {
8863
+ customElements.define("plattar-viewer", ViewerElement);
8864
+ }
8865
+
8866
+ if (customElements.get("plattar-product") === undefined) {
8867
+ customElements.define("plattar-product", ProductElement);
8868
+ }
8869
+
8870
+ if (customElements.get("plattar-editor") === undefined) {
8871
+ customElements.define("plattar-editor", EditorElement);
8872
+ }
8873
+
8874
+ if (customElements.get("plattar-facear") === undefined) {
8875
+ customElements.define("plattar-facear", FaceARElement);
8876
+ }
8877
+
8878
+ if (customElements.get("plattar-8wall") === undefined) {
8879
+ customElements.define("plattar-8wall", EWallElement);
8880
+ }
8881
+
8882
+ if (customElements.get("plattar-studio") === undefined) {
8883
+ customElements.define("plattar-studio", StudioElement);
8884
+ }
8885
+
8886
+ if (customElements.get("plattar-model") === undefined) {
8887
+ customElements.define("plattar-model", ModelElement);
8888
+ }
8889
+
8890
+ if (customElements.get("plattar-configurator") === undefined) {
8891
+ customElements.define("plattar-configurator", ConfiguratorElement);
8892
+ }
8893
+
8894
+ console.log("using @plattar/plattar-web v" + Version);
8895
+ module.exports = {
8896
+ version: Version
8897
+ };
8898
+ }, {
8899
+ "./elements/configurator-element.js": 110,
8900
+ "./elements/editor-element.js": 113,
8901
+ "./elements/ewall-element.js": 114,
8902
+ "./elements/facear-element.js": 115,
8903
+ "./elements/model-element.js": 116,
8904
+ "./elements/product-element.js": 117,
8905
+ "./elements/studio-element.js": 118,
8906
+ "./elements/viewer-element.js": 119,
8907
+ "./elements/webxr-element.js": 120,
8908
+ "./version": 123
8909
+ }],
8910
+ 122: [function (require, module, exports) {
8911
+ var Util = /*#__PURE__*/function () {
8912
+ function Util() {
8913
+ _classCallCheck(this, Util);
8914
+ }
8915
+
8916
+ _createClass(Util, null, [{
8917
+ key: "getServerLocation",
8918
+ value: function getServerLocation(server) {
8919
+ switch (server) {
8920
+ case "production":
8921
+ return "https://app.plattar.com/renderer/";
8922
+
8923
+ case "staging":
8924
+ return "https://staging.plattar.space/renderer/";
8925
+
8926
+ case "dev":
8927
+ return "https://localhost/renderer/";
8928
+
8929
+ default:
8930
+ return undefined;
8931
+ }
8932
+ }
8933
+ }, {
8934
+ key: "getElementLocation",
8935
+ value: function getElementLocation(etype) {
8936
+ var isValid = Util.isValidType(etype);
8937
+
8938
+ if (isValid) {
8939
+ return etype + ".html";
8940
+ }
8941
+
8942
+ return undefined;
8943
+ }
8944
+ }, {
8945
+ key: "getElementBundleLocation",
8946
+ value: function getElementBundleLocation(etype, server) {
8947
+ var location = Util.getServerLocation(server);
8948
+
8949
+ if (!location) {
8950
+ return undefined;
8951
+ }
8952
+
8953
+ var isValid = Util.isValidType(etype);
8954
+
8955
+ if (isValid) {
8956
+ var isMinified = location === "dev" ? false : true;
8957
+ return isMinified ? etype + "-bundle.min.js" : etype + "-bundle.js";
8958
+ }
8959
+
8960
+ return undefined;
8961
+ }
8962
+ }, {
8963
+ key: "isValidType",
8964
+ value: function isValidType(etype) {
8965
+ switch (etype) {
8966
+ case "viewer":
8967
+ case "editor":
8968
+ case "ewall":
8969
+ case "facear":
8970
+ case "studio":
8971
+ case "product":
8972
+ case "model":
8973
+ case "configurator":
8974
+ case "webxr":
8975
+ return true;
8976
+
8977
+ default:
8978
+ return false;
8979
+ }
8980
+ }
8981
+ }, {
8982
+ key: "id",
8983
+ value: function id() {
8984
+ return Math.abs(Math.floor(Math.random() * 10000000000000));
8985
+ }
8986
+ }, {
8987
+ key: "getPermissionString",
8988
+ value: function getPermissionString(permissions) {
8989
+ if (permissions && permissions.length > 0) {
8990
+ var permissionString = permissions[0];
8991
+
8992
+ for (var i = 1; i < permissions.length; i++) {
8993
+ permissionString += "; " + permissions[i];
8994
+ }
8995
+
8996
+ return permissionString;
8997
+ }
8998
+
8999
+ return undefined;
9000
+ }
9001
+ }]);
9002
+
9003
+ return Util;
9004
+ }();
9005
+
9006
+ module.exports = Util;
9007
+ }, {}],
9008
+ 123: [function (require, module, exports) {
9009
+ module.exports = "1.122.3";
9010
+ }, {}],
9011
+ 124: [function (require, module, exports) {
9012
+ (function (global) {
9013
+ (function () {
9014
+ "use strict"; // ref: https://github.com/tc39/proposal-global
9015
+
9016
+ var getGlobal = function getGlobal() {
9017
+ // the only reliable means to get the global object is
9018
+ // `Function('return this')()`
9019
+ // However, this causes CSP violations in Chrome apps.
9020
+ if (typeof self !== 'undefined') {
9021
+ return self;
9022
+ }
9023
+
9024
+ if (typeof window !== 'undefined') {
9025
+ return window;
9026
+ }
9027
+
9028
+ if (typeof global !== 'undefined') {
9029
+ return global;
9030
+ }
9031
+
9032
+ throw new Error('unable to locate global object');
9033
+ };
9034
+
9035
+ var global = getGlobal();
9036
+ module.exports = exports = global.fetch; // Needed for TypeScript and Webpack.
9037
+
9038
+ if (global.fetch) {
9039
+ exports["default"] = global.fetch.bind(global);
9040
+ }
9041
+
9042
+ exports.Headers = global.Headers;
9043
+ exports.Request = global.Request;
9044
+ exports.Response = global.Response;
9045
+ }).call(this);
9046
+ }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
9047
+ }, {}],
9048
+ 125: [function (require, module, exports) {
9049
+ (function (global) {
9050
+ (function () {
9051
+ !function (e) {
9052
+ var t;
9053
+ "object" == _typeof(exports) ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : ("undefined" != typeof window ? t = window : "undefined" != typeof global ? t = global : "undefined" != typeof self && (t = self), t.objectHash = e());
9054
+ }(function () {
9055
+ return function o(i, u, a) {
9056
+ function s(n, e) {
9057
+ if (!u[n]) {
9058
+ if (!i[n]) {
9059
+ var t = "function" == typeof require && require;
9060
+ if (!e && t) return t(n, !0);
9061
+ if (f) return f(n, !0);
9062
+ throw new Error("Cannot find module '" + n + "'");
9063
+ }
9064
+
9065
+ var r = u[n] = {
9066
+ exports: {}
9067
+ };
9068
+ i[n][0].call(r.exports, function (e) {
9069
+ var t = i[n][1][e];
9070
+ return s(t || e);
9071
+ }, r, r.exports, o, i, u, a);
9072
+ }
9073
+
9074
+ return u[n].exports;
9075
+ }
9076
+
9077
+ for (var f = "function" == typeof require && require, e = 0; e < a.length; e++) {
9078
+ s(a[e]);
9079
+ }
9080
+
9081
+ return s;
9082
+ }({
9083
+ 1: [function (w, b, m) {
9084
+ (function (e, t, f, n, r, o, i, u, a) {
9085
+ "use strict";
9086
+
9087
+ var s = w("crypto");
9088
+
9089
+ function c(e, t) {
9090
+ return function (e, t) {
9091
+ var n;
9092
+ n = "passthrough" !== t.algorithm ? s.createHash(t.algorithm) : new y();
9093
+ void 0 === n.write && (n.write = n.update, n.end = n.update);
9094
+ g(t, n).dispatch(e), n.update || n.end("");
9095
+ if (n.digest) return n.digest("buffer" === t.encoding ? void 0 : t.encoding);
9096
+ var r = n.read();
9097
+ return "buffer" !== t.encoding ? r.toString(t.encoding) : r;
9098
+ }(e, t = h(e, t));
9099
+ }
9100
+
9101
+ (m = b.exports = c).sha1 = function (e) {
9102
+ return c(e);
9103
+ }, m.keys = function (e) {
9104
+ return c(e, {
9105
+ excludeValues: !0,
9106
+ algorithm: "sha1",
9107
+ encoding: "hex"
9108
+ });
9109
+ }, m.MD5 = function (e) {
9110
+ return c(e, {
9111
+ algorithm: "md5",
9112
+ encoding: "hex"
9113
+ });
9114
+ }, m.keysMD5 = function (e) {
9115
+ return c(e, {
9116
+ algorithm: "md5",
9117
+ encoding: "hex",
9118
+ excludeValues: !0
9119
+ });
9120
+ };
9121
+ var l = s.getHashes ? s.getHashes().slice() : ["sha1", "md5"];
9122
+ l.push("passthrough");
9123
+ var d = ["buffer", "hex", "binary", "base64"];
9124
+
9125
+ function h(e, t) {
9126
+ t = t || {};
9127
+ var n = {};
9128
+ if (n.algorithm = t.algorithm || "sha1", n.encoding = t.encoding || "hex", n.excludeValues = !!t.excludeValues, n.algorithm = n.algorithm.toLowerCase(), n.encoding = n.encoding.toLowerCase(), n.ignoreUnknown = !0 === t.ignoreUnknown, n.respectType = !1 !== t.respectType, n.respectFunctionNames = !1 !== t.respectFunctionNames, n.respectFunctionProperties = !1 !== t.respectFunctionProperties, n.unorderedArrays = !0 === t.unorderedArrays, n.unorderedSets = !1 !== t.unorderedSets, n.unorderedObjects = !1 !== t.unorderedObjects, n.replacer = t.replacer || void 0, n.excludeKeys = t.excludeKeys || void 0, void 0 === e) throw new Error("Object argument required.");
9129
+
9130
+ for (var r = 0; r < l.length; ++r) {
9131
+ l[r].toLowerCase() === n.algorithm.toLowerCase() && (n.algorithm = l[r]);
9132
+ }
9133
+
9134
+ if (-1 === l.indexOf(n.algorithm)) throw new Error('Algorithm "' + n.algorithm + '" not supported. supported values: ' + l.join(", "));
9135
+ if (-1 === d.indexOf(n.encoding) && "passthrough" !== n.algorithm) throw new Error('Encoding "' + n.encoding + '" not supported. supported values: ' + d.join(", "));
9136
+ return n;
9137
+ }
9138
+
9139
+ function p(e) {
9140
+ if ("function" == typeof e) {
9141
+ return null != /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e));
9142
+ }
9143
+ }
9144
+
9145
+ function g(u, t, a) {
9146
+ a = a || [];
9147
+
9148
+ function s(e) {
9149
+ return t.update ? t.update(e, "utf8") : t.write(e, "utf8");
9150
+ }
9151
+
9152
+ return {
9153
+ dispatch: function dispatch(e) {
9154
+ return u.replacer && (e = u.replacer(e)), this["_" + (null === e ? "null" : _typeof(e))](e);
9155
+ },
9156
+ _object: function _object(t) {
9157
+ var e = Object.prototype.toString.call(t),
9158
+ n = /\[object (.*)\]/i.exec(e);
9159
+ n = (n = n ? n[1] : "unknown:[" + e + "]").toLowerCase();
9160
+ var r;
9161
+ if (0 <= (r = a.indexOf(t))) return this.dispatch("[CIRCULAR:" + r + "]");
9162
+ if (a.push(t), void 0 !== f && f.isBuffer && f.isBuffer(t)) return s("buffer:"), s(t);
9163
+
9164
+ if ("object" === n || "function" === n || "asyncfunction" === n) {
9165
+ var o = Object.keys(t);
9166
+ u.unorderedObjects && (o = o.sort()), !1 === u.respectType || p(t) || o.splice(0, 0, "prototype", "__proto__", "constructor"), u.excludeKeys && (o = o.filter(function (e) {
9167
+ return !u.excludeKeys(e);
9168
+ })), s("object:" + o.length + ":");
9169
+ var i = this;
9170
+ return o.forEach(function (e) {
9171
+ i.dispatch(e), s(":"), u.excludeValues || i.dispatch(t[e]), s(",");
9172
+ });
9173
+ }
9174
+
9175
+ if (!this["_" + n]) {
9176
+ if (u.ignoreUnknown) return s("[" + n + "]");
9177
+ throw new Error('Unknown object type "' + n + '"');
9178
+ }
9179
+
9180
+ this["_" + n](t);
9181
+ },
9182
+ _array: function _array(e, t) {
9183
+ t = void 0 !== t ? t : !1 !== u.unorderedArrays;
9184
+ var n = this;
9185
+ if (s("array:" + e.length + ":"), !t || e.length <= 1) return e.forEach(function (e) {
9186
+ return n.dispatch(e);
9187
+ });
9188
+ var r = [],
9189
+ o = e.map(function (e) {
9190
+ var t = new y(),
9191
+ n = a.slice();
9192
+ return g(u, t, n).dispatch(e), r = r.concat(n.slice(a.length)), t.read().toString();
9193
+ });
9194
+ return a = a.concat(r), o.sort(), this._array(o, !1);
9195
+ },
9196
+ _date: function _date(e) {
9197
+ return s("date:" + e.toJSON());
9198
+ },
9199
+ _symbol: function _symbol(e) {
9200
+ return s("symbol:" + e.toString());
9201
+ },
9202
+ _error: function _error(e) {
9203
+ return s("error:" + e.toString());
9204
+ },
9205
+ _boolean: function _boolean(e) {
9206
+ return s("bool:" + e.toString());
9207
+ },
9208
+ _string: function _string(e) {
9209
+ s("string:" + e.length + ":"), s(e.toString());
9210
+ },
9211
+ _function: function _function(e) {
9212
+ s("fn:"), p(e) ? this.dispatch("[native]") : this.dispatch(e.toString()), !1 !== u.respectFunctionNames && this.dispatch("function-name:" + String(e.name)), u.respectFunctionProperties && this._object(e);
9213
+ },
9214
+ _number: function _number(e) {
9215
+ return s("number:" + e.toString());
9216
+ },
9217
+ _xml: function _xml(e) {
9218
+ return s("xml:" + e.toString());
9219
+ },
9220
+ _null: function _null() {
9221
+ return s("Null");
9222
+ },
9223
+ _undefined: function _undefined() {
9224
+ return s("Undefined");
9225
+ },
9226
+ _regexp: function _regexp(e) {
9227
+ return s("regex:" + e.toString());
9228
+ },
9229
+ _uint8array: function _uint8array(e) {
9230
+ return s("uint8array:"), this.dispatch(Array.prototype.slice.call(e));
9231
+ },
9232
+ _uint8clampedarray: function _uint8clampedarray(e) {
9233
+ return s("uint8clampedarray:"), this.dispatch(Array.prototype.slice.call(e));
9234
+ },
9235
+ _int8array: function _int8array(e) {
9236
+ return s("uint8array:"), this.dispatch(Array.prototype.slice.call(e));
9237
+ },
9238
+ _uint16array: function _uint16array(e) {
9239
+ return s("uint16array:"), this.dispatch(Array.prototype.slice.call(e));
9240
+ },
9241
+ _int16array: function _int16array(e) {
9242
+ return s("uint16array:"), this.dispatch(Array.prototype.slice.call(e));
9243
+ },
9244
+ _uint32array: function _uint32array(e) {
9245
+ return s("uint32array:"), this.dispatch(Array.prototype.slice.call(e));
9246
+ },
9247
+ _int32array: function _int32array(e) {
9248
+ return s("uint32array:"), this.dispatch(Array.prototype.slice.call(e));
9249
+ },
9250
+ _float32array: function _float32array(e) {
9251
+ return s("float32array:"), this.dispatch(Array.prototype.slice.call(e));
9252
+ },
9253
+ _float64array: function _float64array(e) {
9254
+ return s("float64array:"), this.dispatch(Array.prototype.slice.call(e));
9255
+ },
9256
+ _arraybuffer: function _arraybuffer(e) {
9257
+ return s("arraybuffer:"), this.dispatch(new Uint8Array(e));
9258
+ },
9259
+ _url: function _url(e) {
9260
+ return s("url:" + e.toString());
9261
+ },
9262
+ _map: function _map(e) {
9263
+ s("map:");
9264
+ var t = Array.from(e);
9265
+ return this._array(t, !1 !== u.unorderedSets);
9266
+ },
9267
+ _set: function _set(e) {
9268
+ s("set:");
9269
+ var t = Array.from(e);
9270
+ return this._array(t, !1 !== u.unorderedSets);
9271
+ },
9272
+ _file: function _file(e) {
9273
+ return s("file:"), this.dispatch([e.name, e.size, e.type, e.lastModfied]);
9274
+ },
9275
+ _blob: function _blob() {
9276
+ if (u.ignoreUnknown) return s("[blob]");
9277
+ throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n');
9278
+ },
9279
+ _domwindow: function _domwindow() {
9280
+ return s("domwindow");
9281
+ },
9282
+ _bigint: function _bigint(e) {
9283
+ return s("bigint:" + e.toString());
9284
+ },
9285
+ _process: function _process() {
9286
+ return s("process");
9287
+ },
9288
+ _timer: function _timer() {
9289
+ return s("timer");
9290
+ },
9291
+ _pipe: function _pipe() {
9292
+ return s("pipe");
9293
+ },
9294
+ _tcp: function _tcp() {
9295
+ return s("tcp");
9296
+ },
9297
+ _udp: function _udp() {
9298
+ return s("udp");
9299
+ },
9300
+ _tty: function _tty() {
9301
+ return s("tty");
9302
+ },
9303
+ _statwatcher: function _statwatcher() {
9304
+ return s("statwatcher");
9305
+ },
9306
+ _securecontext: function _securecontext() {
9307
+ return s("securecontext");
9308
+ },
9309
+ _connection: function _connection() {
9310
+ return s("connection");
9311
+ },
9312
+ _zlib: function _zlib() {
9313
+ return s("zlib");
9314
+ },
9315
+ _context: function _context() {
9316
+ return s("context");
9317
+ },
9318
+ _nodescript: function _nodescript() {
9319
+ return s("nodescript");
9320
+ },
9321
+ _httpparser: function _httpparser() {
9322
+ return s("httpparser");
9323
+ },
9324
+ _dataview: function _dataview() {
9325
+ return s("dataview");
9326
+ },
9327
+ _signal: function _signal() {
9328
+ return s("signal");
9329
+ },
9330
+ _fsevent: function _fsevent() {
9331
+ return s("fsevent");
9332
+ },
9333
+ _tlswrap: function _tlswrap() {
9334
+ return s("tlswrap");
9335
+ }
9336
+ };
9337
+ }
9338
+
9339
+ function y() {
9340
+ return {
9341
+ buf: "",
9342
+ write: function write(e) {
9343
+ this.buf += e;
9344
+ },
9345
+ end: function end(e) {
9346
+ this.buf += e;
9347
+ },
9348
+ read: function read() {
9349
+ return this.buf;
9350
+ }
9351
+ };
9352
+ }
9353
+
9354
+ m.writeToStream = function (e, t, n) {
9355
+ return void 0 === n && (n = t, t = {}), g(t = h(e, t), n).dispatch(e);
9356
+ };
9357
+ }).call(this, w("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, w("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/fake_7eac155c.js", "/");
9358
+ }, {
9359
+ buffer: 3,
9360
+ crypto: 5,
9361
+ lYpoI2: 10
9362
+ }],
9363
+ 2: [function (e, t, f) {
9364
+ (function (e, t, n, r, o, i, u, a, s) {
9365
+ !function (e) {
9366
+ "use strict";
9367
+
9368
+ var f = "undefined" != typeof Uint8Array ? Uint8Array : Array,
9369
+ n = "+".charCodeAt(0),
9370
+ r = "/".charCodeAt(0),
9371
+ o = "0".charCodeAt(0),
9372
+ i = "a".charCodeAt(0),
9373
+ u = "A".charCodeAt(0),
9374
+ a = "-".charCodeAt(0),
9375
+ s = "_".charCodeAt(0);
9376
+
9377
+ function c(e) {
9378
+ var t = e.charCodeAt(0);
9379
+ return t === n || t === a ? 62 : t === r || t === s ? 63 : t < o ? -1 : t < o + 10 ? t - o + 26 + 26 : t < u + 26 ? t - u : t < i + 26 ? t - i + 26 : void 0;
9380
+ }
9381
+
9382
+ e.toByteArray = function (e) {
9383
+ var t, n;
9384
+ if (0 < e.length % 4) throw new Error("Invalid string. Length must be a multiple of 4");
9385
+ var r = e.length,
9386
+ o = "=" === e.charAt(r - 2) ? 2 : "=" === e.charAt(r - 1) ? 1 : 0,
9387
+ i = new f(3 * e.length / 4 - o),
9388
+ u = 0 < o ? e.length - 4 : e.length,
9389
+ a = 0;
9390
+
9391
+ function s(e) {
9392
+ i[a++] = e;
9393
+ }
9394
+
9395
+ for (t = 0; t < u; t += 4, 0) {
9396
+ s((16711680 & (n = c(e.charAt(t)) << 18 | c(e.charAt(t + 1)) << 12 | c(e.charAt(t + 2)) << 6 | c(e.charAt(t + 3)))) >> 16), s((65280 & n) >> 8), s(255 & n);
9397
+ }
9398
+
9399
+ return 2 == o ? s(255 & (n = c(e.charAt(t)) << 2 | c(e.charAt(t + 1)) >> 4)) : 1 == o && (s((n = c(e.charAt(t)) << 10 | c(e.charAt(t + 1)) << 4 | c(e.charAt(t + 2)) >> 2) >> 8 & 255), s(255 & n)), i;
9400
+ }, e.fromByteArray = function (e) {
9401
+ var t,
9402
+ n,
9403
+ r,
9404
+ o,
9405
+ i = e.length % 3,
9406
+ u = "";
9407
+
9408
+ function a(e) {
9409
+ return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e);
9410
+ }
9411
+
9412
+ for (t = 0, r = e.length - i; t < r; t += 3) {
9413
+ n = (e[t] << 16) + (e[t + 1] << 8) + e[t + 2], u += a((o = n) >> 18 & 63) + a(o >> 12 & 63) + a(o >> 6 & 63) + a(63 & o);
9414
+ }
9415
+
9416
+ switch (i) {
9417
+ case 1:
9418
+ u += a((n = e[e.length - 1]) >> 2), u += a(n << 4 & 63), u += "==";
9419
+ break;
9420
+
9421
+ case 2:
9422
+ u += a((n = (e[e.length - 2] << 8) + e[e.length - 1]) >> 10), u += a(n >> 4 & 63), u += a(n << 2 & 63), u += "=";
9423
+ }
9424
+
9425
+ return u;
9426
+ };
9427
+ }(void 0 === f ? this.base64js = {} : f);
9428
+ }).call(this, e("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, e("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js", "/node_modules/gulp-browserify/node_modules/base64-js/lib");
9429
+ }, {
9430
+ buffer: 3,
9431
+ lYpoI2: 10
9432
+ }],
9433
+ 3: [function (O, e, H) {
9434
+ (function (e, t, g, n, r, o, i, u, a) {
9435
+ var s = O("base64-js"),
9436
+ f = O("ieee754");
9437
+
9438
+ function g(e, t, n) {
9439
+ if (!(this instanceof g)) return new g(e, t, n);
9440
+
9441
+ var r,
9442
+ o,
9443
+ i,
9444
+ u,
9445
+ a,
9446
+ s = _typeof(e);
9447
+
9448
+ if ("base64" === t && "string" == s) for (e = (r = e).trim ? r.trim() : r.replace(/^\s+|\s+$/g, ""); e.length % 4 != 0;) {
9449
+ e += "=";
9450
+ }
9451
+ if ("number" == s) o = x(e);else if ("string" == s) o = g.byteLength(e, t);else {
9452
+ if ("object" != s) throw new Error("First argument needs to be a number, array or string.");
9453
+ o = x(e.length);
9454
+ }
9455
+ if (g._useTypedArrays ? i = g._augment(new Uint8Array(o)) : ((i = this).length = o, i._isBuffer = !0), g._useTypedArrays && "number" == typeof e.byteLength) i._set(e);else if (S(a = e) || g.isBuffer(a) || a && "object" == _typeof(a) && "number" == typeof a.length) for (u = 0; u < o; u++) {
9456
+ g.isBuffer(e) ? i[u] = e.readUInt8(u) : i[u] = e[u];
9457
+ } else if ("string" == s) i.write(e, 0, t);else if ("number" == s && !g._useTypedArrays && !n) for (u = 0; u < o; u++) {
9458
+ i[u] = 0;
9459
+ }
9460
+ return i;
9461
+ }
9462
+
9463
+ function y(e, t, n, r) {
9464
+ return g._charsWritten = T(function (e) {
9465
+ for (var t = [], n = 0; n < e.length; n++) {
9466
+ t.push(255 & e.charCodeAt(n));
9467
+ }
9468
+
9469
+ return t;
9470
+ }(t), e, n, r);
9471
+ }
9472
+
9473
+ function w(e, t, n, r) {
9474
+ return g._charsWritten = T(function (e) {
9475
+ for (var t, n, r, o = [], i = 0; i < e.length; i++) {
9476
+ t = e.charCodeAt(i), n = t >> 8, r = t % 256, o.push(r), o.push(n);
9477
+ }
9478
+
9479
+ return o;
9480
+ }(t), e, n, r);
9481
+ }
9482
+
9483
+ function c(e, t, n) {
9484
+ var r = "";
9485
+ n = Math.min(e.length, n);
9486
+
9487
+ for (var o = t; o < n; o++) {
9488
+ r += String.fromCharCode(e[o]);
9489
+ }
9490
+
9491
+ return r;
9492
+ }
9493
+
9494
+ function l(e, t, n, r) {
9495
+ r || (D("boolean" == typeof n, "missing or invalid endian"), D(null != t, "missing offset"), D(t + 1 < e.length, "Trying to read beyond buffer length"));
9496
+ var o,
9497
+ i = e.length;
9498
+ if (!(i <= t)) return n ? (o = e[t], t + 1 < i && (o |= e[t + 1] << 8)) : (o = e[t] << 8, t + 1 < i && (o |= e[t + 1])), o;
9499
+ }
9500
+
9501
+ function d(e, t, n, r) {
9502
+ r || (D("boolean" == typeof n, "missing or invalid endian"), D(null != t, "missing offset"), D(t + 3 < e.length, "Trying to read beyond buffer length"));
9503
+ var o,
9504
+ i = e.length;
9505
+ if (!(i <= t)) return n ? (t + 2 < i && (o = e[t + 2] << 16), t + 1 < i && (o |= e[t + 1] << 8), o |= e[t], t + 3 < i && (o += e[t + 3] << 24 >>> 0)) : (t + 1 < i && (o = e[t + 1] << 16), t + 2 < i && (o |= e[t + 2] << 8), t + 3 < i && (o |= e[t + 3]), o += e[t] << 24 >>> 0), o;
9506
+ }
9507
+
9508
+ function h(e, t, n, r) {
9509
+ if (r || (D("boolean" == typeof n, "missing or invalid endian"), D(null != t, "missing offset"), D(t + 1 < e.length, "Trying to read beyond buffer length")), !(e.length <= t)) {
9510
+ var o = l(e, t, n, !0);
9511
+ return 32768 & o ? -1 * (65535 - o + 1) : o;
9512
+ }
9513
+ }
9514
+
9515
+ function p(e, t, n, r) {
9516
+ if (r || (D("boolean" == typeof n, "missing or invalid endian"), D(null != t, "missing offset"), D(t + 3 < e.length, "Trying to read beyond buffer length")), !(e.length <= t)) {
9517
+ var o = d(e, t, n, !0);
9518
+ return 2147483648 & o ? -1 * (4294967295 - o + 1) : o;
9519
+ }
9520
+ }
9521
+
9522
+ function b(e, t, n, r) {
9523
+ return r || (D("boolean" == typeof n, "missing or invalid endian"), D(t + 3 < e.length, "Trying to read beyond buffer length")), f.read(e, t, n, 23, 4);
9524
+ }
9525
+
9526
+ function m(e, t, n, r) {
9527
+ return r || (D("boolean" == typeof n, "missing or invalid endian"), D(t + 7 < e.length, "Trying to read beyond buffer length")), f.read(e, t, n, 52, 8);
9528
+ }
9529
+
9530
+ function v(e, t, n, r, o) {
9531
+ o || (D(null != t, "missing value"), D("boolean" == typeof r, "missing or invalid endian"), D(null != n, "missing offset"), D(n + 1 < e.length, "trying to write beyond buffer length"), N(t, 65535));
9532
+ var i = e.length;
9533
+ if (!(i <= n)) for (var u = 0, a = Math.min(i - n, 2); u < a; u++) {
9534
+ e[n + u] = (t & 255 << 8 * (r ? u : 1 - u)) >>> 8 * (r ? u : 1 - u);
9535
+ }
9536
+ }
9537
+
9538
+ function _(e, t, n, r, o) {
9539
+ o || (D(null != t, "missing value"), D("boolean" == typeof r, "missing or invalid endian"), D(null != n, "missing offset"), D(n + 3 < e.length, "trying to write beyond buffer length"), N(t, 4294967295));
9540
+ var i = e.length;
9541
+ if (!(i <= n)) for (var u = 0, a = Math.min(i - n, 4); u < a; u++) {
9542
+ e[n + u] = t >>> 8 * (r ? u : 3 - u) & 255;
9543
+ }
9544
+ }
9545
+
9546
+ function E(e, t, n, r, o) {
9547
+ o || (D(null != t, "missing value"), D("boolean" == typeof r, "missing or invalid endian"), D(null != n, "missing offset"), D(n + 1 < e.length, "Trying to write beyond buffer length"), Y(t, 32767, -32768)), e.length <= n || v(e, 0 <= t ? t : 65535 + t + 1, n, r, o);
9548
+ }
9549
+
9550
+ function I(e, t, n, r, o) {
9551
+ o || (D(null != t, "missing value"), D("boolean" == typeof r, "missing or invalid endian"), D(null != n, "missing offset"), D(n + 3 < e.length, "Trying to write beyond buffer length"), Y(t, 2147483647, -2147483648)), e.length <= n || _(e, 0 <= t ? t : 4294967295 + t + 1, n, r, o);
9552
+ }
9553
+
9554
+ function A(e, t, n, r, o) {
9555
+ o || (D(null != t, "missing value"), D("boolean" == typeof r, "missing or invalid endian"), D(null != n, "missing offset"), D(n + 3 < e.length, "Trying to write beyond buffer length"), F(t, 34028234663852886e22, -34028234663852886e22)), e.length <= n || f.write(e, t, n, r, 23, 4);
9556
+ }
9557
+
9558
+ function B(e, t, n, r, o) {
9559
+ o || (D(null != t, "missing value"), D("boolean" == typeof r, "missing or invalid endian"), D(null != n, "missing offset"), D(n + 7 < e.length, "Trying to write beyond buffer length"), F(t, 17976931348623157e292, -17976931348623157e292)), e.length <= n || f.write(e, t, n, r, 52, 8);
9560
+ }
9561
+
9562
+ H.Buffer = g, H.SlowBuffer = g, H.INSPECT_MAX_BYTES = 50, g.poolSize = 8192, g._useTypedArrays = function () {
9563
+ try {
9564
+ var e = new ArrayBuffer(0),
9565
+ t = new Uint8Array(e);
9566
+ return t.foo = function () {
9567
+ return 42;
9568
+ }, 42 === t.foo() && "function" == typeof t.subarray;
9569
+ } catch (e) {
9570
+ return !1;
9571
+ }
9572
+ }(), g.isEncoding = function (e) {
9573
+ switch (String(e).toLowerCase()) {
9574
+ case "hex":
9575
+ case "utf8":
9576
+ case "utf-8":
9577
+ case "ascii":
9578
+ case "binary":
9579
+ case "base64":
9580
+ case "raw":
9581
+ case "ucs2":
9582
+ case "ucs-2":
9583
+ case "utf16le":
9584
+ case "utf-16le":
9585
+ return !0;
9586
+
9587
+ default:
9588
+ return !1;
9589
+ }
9590
+ }, g.isBuffer = function (e) {
9591
+ return !(null == e || !e._isBuffer);
9592
+ }, g.byteLength = function (e, t) {
9593
+ var n;
9594
+
9595
+ switch (e += "", t || "utf8") {
9596
+ case "hex":
9597
+ n = e.length / 2;
9598
+ break;
9599
+
9600
+ case "utf8":
9601
+ case "utf-8":
9602
+ n = C(e).length;
9603
+ break;
9604
+
9605
+ case "ascii":
9606
+ case "binary":
9607
+ case "raw":
9608
+ n = e.length;
9609
+ break;
9610
+
9611
+ case "base64":
9612
+ n = k(e).length;
9613
+ break;
9614
+
9615
+ case "ucs2":
9616
+ case "ucs-2":
9617
+ case "utf16le":
9618
+ case "utf-16le":
9619
+ n = 2 * e.length;
9620
+ break;
9621
+
9622
+ default:
9623
+ throw new Error("Unknown encoding");
9624
+ }
9625
+
9626
+ return n;
9627
+ }, g.concat = function (e, t) {
9628
+ if (D(S(e), "Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."), 0 === e.length) return new g(0);
9629
+ if (1 === e.length) return e[0];
9630
+ if ("number" != typeof t) for (o = t = 0; o < e.length; o++) {
9631
+ t += e[o].length;
9632
+ }
9633
+
9634
+ for (var n = new g(t), r = 0, o = 0; o < e.length; o++) {
9635
+ var i = e[o];
9636
+ i.copy(n, r), r += i.length;
9637
+ }
9638
+
9639
+ return n;
9640
+ }, g.prototype.write = function (e, t, n, r) {
9641
+ var o;
9642
+ isFinite(t) ? isFinite(n) || (r = n, n = void 0) : (o = r, r = t, t = n, n = o), t = Number(t) || 0;
9643
+ var i,
9644
+ u,
9645
+ a,
9646
+ s,
9647
+ f,
9648
+ c,
9649
+ l,
9650
+ d,
9651
+ h,
9652
+ p = this.length - t;
9653
+
9654
+ switch ((!n || p < (n = Number(n))) && (n = p), r = String(r || "utf8").toLowerCase()) {
9655
+ case "hex":
9656
+ i = function (e, t, n, r) {
9657
+ n = Number(n) || 0;
9658
+ var o = e.length - n;
9659
+ (!r || o < (r = Number(r))) && (r = o);
9660
+ var i = t.length;
9661
+ D(i % 2 == 0, "Invalid hex string"), i / 2 < r && (r = i / 2);
9662
+
9663
+ for (var u = 0; u < r; u++) {
9664
+ var a = parseInt(t.substr(2 * u, 2), 16);
9665
+ D(!isNaN(a), "Invalid hex string"), e[n + u] = a;
9666
+ }
9667
+
9668
+ return g._charsWritten = 2 * u, u;
9669
+ }(this, e, t, n);
9670
+
9671
+ break;
9672
+
9673
+ case "utf8":
9674
+ case "utf-8":
9675
+ c = this, l = e, d = t, h = n, i = g._charsWritten = T(C(l), c, d, h);
9676
+ break;
9677
+
9678
+ case "ascii":
9679
+ case "binary":
9680
+ i = y(this, e, t, n);
9681
+ break;
9682
+
9683
+ case "base64":
9684
+ u = this, a = e, s = t, f = n, i = g._charsWritten = T(k(a), u, s, f);
9685
+ break;
9686
+
9687
+ case "ucs2":
9688
+ case "ucs-2":
9689
+ case "utf16le":
9690
+ case "utf-16le":
9691
+ i = w(this, e, t, n);
9692
+ break;
9693
+
9694
+ default:
9695
+ throw new Error("Unknown encoding");
9696
+ }
9697
+
9698
+ return i;
9699
+ }, g.prototype.toString = function (e, t, n) {
9700
+ var r,
9701
+ o,
9702
+ i,
9703
+ u,
9704
+ a = this;
9705
+ if (e = String(e || "utf8").toLowerCase(), t = Number(t) || 0, (n = void 0 !== n ? Number(n) : n = a.length) === t) return "";
9706
+
9707
+ switch (e) {
9708
+ case "hex":
9709
+ r = function (e, t, n) {
9710
+ var r = e.length;
9711
+ (!t || t < 0) && (t = 0);
9712
+ (!n || n < 0 || r < n) && (n = r);
9713
+
9714
+ for (var o = "", i = t; i < n; i++) {
9715
+ o += j(e[i]);
9716
+ }
9717
+
9718
+ return o;
9719
+ }(a, t, n);
9720
+
9721
+ break;
9722
+
9723
+ case "utf8":
9724
+ case "utf-8":
9725
+ r = function (e, t, n) {
9726
+ var r = "",
9727
+ o = "";
9728
+ n = Math.min(e.length, n);
9729
+
9730
+ for (var i = t; i < n; i++) {
9731
+ e[i] <= 127 ? (r += M(o) + String.fromCharCode(e[i]), o = "") : o += "%" + e[i].toString(16);
9732
+ }
9733
+
9734
+ return r + M(o);
9735
+ }(a, t, n);
9736
+
9737
+ break;
9738
+
9739
+ case "ascii":
9740
+ case "binary":
9741
+ r = c(a, t, n);
9742
+ break;
9743
+
9744
+ case "base64":
9745
+ o = a, u = n, r = 0 === (i = t) && u === o.length ? s.fromByteArray(o) : s.fromByteArray(o.slice(i, u));
9746
+ break;
9747
+
9748
+ case "ucs2":
9749
+ case "ucs-2":
9750
+ case "utf16le":
9751
+ case "utf-16le":
9752
+ r = function (e, t, n) {
9753
+ for (var r = e.slice(t, n), o = "", i = 0; i < r.length; i += 2) {
9754
+ o += String.fromCharCode(r[i] + 256 * r[i + 1]);
9755
+ }
9756
+
9757
+ return o;
9758
+ }(a, t, n);
9759
+
9760
+ break;
9761
+
9762
+ default:
9763
+ throw new Error("Unknown encoding");
9764
+ }
9765
+
9766
+ return r;
9767
+ }, g.prototype.toJSON = function () {
9768
+ return {
9769
+ type: "Buffer",
9770
+ data: Array.prototype.slice.call(this._arr || this, 0)
9771
+ };
9772
+ }, g.prototype.copy = function (e, t, n, r) {
9773
+ if (n = n || 0, r || 0 === r || (r = this.length), t = t || 0, r !== n && 0 !== e.length && 0 !== this.length) {
9774
+ D(n <= r, "sourceEnd < sourceStart"), D(0 <= t && t < e.length, "targetStart out of bounds"), D(0 <= n && n < this.length, "sourceStart out of bounds"), D(0 <= r && r <= this.length, "sourceEnd out of bounds"), r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n);
9775
+ var o = r - n;
9776
+ if (o < 100 || !g._useTypedArrays) for (var i = 0; i < o; i++) {
9777
+ e[i + t] = this[i + n];
9778
+ } else e._set(this.subarray(n, n + o), t);
9779
+ }
9780
+ }, g.prototype.slice = function (e, t) {
9781
+ var n = this.length;
9782
+ if (e = U(e, n, 0), t = U(t, n, n), g._useTypedArrays) return g._augment(this.subarray(e, t));
9783
+
9784
+ for (var r = t - e, o = new g(r, void 0, !0), i = 0; i < r; i++) {
9785
+ o[i] = this[i + e];
9786
+ }
9787
+
9788
+ return o;
9789
+ }, g.prototype.get = function (e) {
9790
+ return console.log(".get() is deprecated. Access using array indexes instead."), this.readUInt8(e);
9791
+ }, g.prototype.set = function (e, t) {
9792
+ return console.log(".set() is deprecated. Access using array indexes instead."), this.writeUInt8(e, t);
9793
+ }, g.prototype.readUInt8 = function (e, t) {
9794
+ if (t || (D(null != e, "missing offset"), D(e < this.length, "Trying to read beyond buffer length")), !(e >= this.length)) return this[e];
9795
+ }, g.prototype.readUInt16LE = function (e, t) {
9796
+ return l(this, e, !0, t);
9797
+ }, g.prototype.readUInt16BE = function (e, t) {
9798
+ return l(this, e, !1, t);
9799
+ }, g.prototype.readUInt32LE = function (e, t) {
9800
+ return d(this, e, !0, t);
9801
+ }, g.prototype.readUInt32BE = function (e, t) {
9802
+ return d(this, e, !1, t);
9803
+ }, g.prototype.readInt8 = function (e, t) {
9804
+ if (t || (D(null != e, "missing offset"), D(e < this.length, "Trying to read beyond buffer length")), !(e >= this.length)) return 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e];
9805
+ }, g.prototype.readInt16LE = function (e, t) {
9806
+ return h(this, e, !0, t);
9807
+ }, g.prototype.readInt16BE = function (e, t) {
9808
+ return h(this, e, !1, t);
9809
+ }, g.prototype.readInt32LE = function (e, t) {
9810
+ return p(this, e, !0, t);
9811
+ }, g.prototype.readInt32BE = function (e, t) {
9812
+ return p(this, e, !1, t);
9813
+ }, g.prototype.readFloatLE = function (e, t) {
9814
+ return b(this, e, !0, t);
9815
+ }, g.prototype.readFloatBE = function (e, t) {
9816
+ return b(this, e, !1, t);
9817
+ }, g.prototype.readDoubleLE = function (e, t) {
9818
+ return m(this, e, !0, t);
9819
+ }, g.prototype.readDoubleBE = function (e, t) {
9820
+ return m(this, e, !1, t);
9821
+ }, g.prototype.writeUInt8 = function (e, t, n) {
9822
+ n || (D(null != e, "missing value"), D(null != t, "missing offset"), D(t < this.length, "trying to write beyond buffer length"), N(e, 255)), t >= this.length || (this[t] = e);
9823
+ }, g.prototype.writeUInt16LE = function (e, t, n) {
9824
+ v(this, e, t, !0, n);
9825
+ }, g.prototype.writeUInt16BE = function (e, t, n) {
9826
+ v(this, e, t, !1, n);
9827
+ }, g.prototype.writeUInt32LE = function (e, t, n) {
9828
+ _(this, e, t, !0, n);
9829
+ }, g.prototype.writeUInt32BE = function (e, t, n) {
9830
+ _(this, e, t, !1, n);
9831
+ }, g.prototype.writeInt8 = function (e, t, n) {
9832
+ n || (D(null != e, "missing value"), D(null != t, "missing offset"), D(t < this.length, "Trying to write beyond buffer length"), Y(e, 127, -128)), t >= this.length || (0 <= e ? this.writeUInt8(e, t, n) : this.writeUInt8(255 + e + 1, t, n));
9833
+ }, g.prototype.writeInt16LE = function (e, t, n) {
9834
+ E(this, e, t, !0, n);
9835
+ }, g.prototype.writeInt16BE = function (e, t, n) {
9836
+ E(this, e, t, !1, n);
9837
+ }, g.prototype.writeInt32LE = function (e, t, n) {
9838
+ I(this, e, t, !0, n);
9839
+ }, g.prototype.writeInt32BE = function (e, t, n) {
9840
+ I(this, e, t, !1, n);
9841
+ }, g.prototype.writeFloatLE = function (e, t, n) {
9842
+ A(this, e, t, !0, n);
9843
+ }, g.prototype.writeFloatBE = function (e, t, n) {
9844
+ A(this, e, t, !1, n);
9845
+ }, g.prototype.writeDoubleLE = function (e, t, n) {
9846
+ B(this, e, t, !0, n);
9847
+ }, g.prototype.writeDoubleBE = function (e, t, n) {
9848
+ B(this, e, t, !1, n);
9849
+ }, g.prototype.fill = function (e, t, n) {
9850
+ if (e = e || 0, t = t || 0, n = n || this.length, "string" == typeof e && (e = e.charCodeAt(0)), D("number" == typeof e && !isNaN(e), "value is not a number"), D(t <= n, "end < start"), n !== t && 0 !== this.length) {
9851
+ D(0 <= t && t < this.length, "start out of bounds"), D(0 <= n && n <= this.length, "end out of bounds");
9852
+
9853
+ for (var r = t; r < n; r++) {
9854
+ this[r] = e;
9855
+ }
9856
+ }
9857
+ }, g.prototype.inspect = function () {
9858
+ for (var e = [], t = this.length, n = 0; n < t; n++) {
9859
+ if (e[n] = j(this[n]), n === H.INSPECT_MAX_BYTES) {
9860
+ e[n + 1] = "...";
9861
+ break;
9862
+ }
9863
+ }
9864
+
9865
+ return "<Buffer " + e.join(" ") + ">";
9866
+ }, g.prototype.toArrayBuffer = function () {
9867
+ if ("undefined" == typeof Uint8Array) throw new Error("Buffer.toArrayBuffer not supported in this browser");
9868
+ if (g._useTypedArrays) return new g(this).buffer;
9869
+
9870
+ for (var e = new Uint8Array(this.length), t = 0, n = e.length; t < n; t += 1) {
9871
+ e[t] = this[t];
9872
+ }
9873
+
9874
+ return e.buffer;
9875
+ };
9876
+ var L = g.prototype;
9877
+
9878
+ function U(e, t, n) {
9879
+ return "number" != typeof e ? n : t <= (e = ~~e) ? t : 0 <= e || 0 <= (e += t) ? e : 0;
9880
+ }
9881
+
9882
+ function x(e) {
9883
+ return (e = ~~Math.ceil(+e)) < 0 ? 0 : e;
9884
+ }
9885
+
9886
+ function S(e) {
9887
+ return (Array.isArray || function (e) {
9888
+ return "[object Array]" === Object.prototype.toString.call(e);
9889
+ })(e);
9890
+ }
9891
+
9892
+ function j(e) {
9893
+ return e < 16 ? "0" + e.toString(16) : e.toString(16);
9894
+ }
9895
+
9896
+ function C(e) {
9897
+ for (var t = [], n = 0; n < e.length; n++) {
9898
+ var r = e.charCodeAt(n);
9899
+ if (r <= 127) t.push(e.charCodeAt(n));else {
9900
+ var o = n;
9901
+ 55296 <= r && r <= 57343 && n++;
8104
9902
 
8105
- return _super78.call(this);
8106
- }
9903
+ for (var i = encodeURIComponent(e.slice(o, n + 1)).substr(1).split("%"), u = 0; u < i.length; u++) {
9904
+ t.push(parseInt(i[u], 16));
9905
+ }
9906
+ }
9907
+ }
8107
9908
 
8108
- _createClass(WebXRElement, [{
8109
- key: "permissions",
8110
- get: function get() {
8111
- return ["camera", "autoplay", "xr-spatial-tracking"];
8112
- }
8113
- }, {
8114
- key: "elementType",
8115
- get: function get() {
8116
- return "webxr";
8117
- }
8118
- }]);
9909
+ return t;
9910
+ }
8119
9911
 
8120
- return WebXRElement;
8121
- }(BaseElement);
9912
+ function k(e) {
9913
+ return s.toByteArray(e);
9914
+ }
8122
9915
 
8123
- module.exports = WebXRElement;
8124
- }, {
8125
- "./base/base-element.js": 104
8126
- }],
8127
- 116: [function (require, module, exports) {
8128
- "use strict";
9916
+ function T(e, t, n, r) {
9917
+ for (var o = 0; o < r && !(o + n >= t.length || o >= e.length); o++) {
9918
+ t[o + n] = e[o];
9919
+ }
8129
9920
 
8130
- var WebXRElement = require("./elements/webxr-element.js");
9921
+ return o;
9922
+ }
8131
9923
 
8132
- var ViewerElement = require("./elements/viewer-element.js");
9924
+ function M(e) {
9925
+ try {
9926
+ return decodeURIComponent(e);
9927
+ } catch (e) {
9928
+ return String.fromCharCode(65533);
9929
+ }
9930
+ }
8133
9931
 
8134
- var ProductElement = require("./elements/product-element.js");
9932
+ function N(e, t) {
9933
+ D("number" == typeof e, "cannot write a non-number as a number"), D(0 <= e, "specified a negative value for writing an unsigned value"), D(e <= t, "value is larger than maximum value for type"), D(Math.floor(e) === e, "value has a fractional component");
9934
+ }
8135
9935
 
8136
- var EWallElement = require("./elements/ewall-element.js");
9936
+ function Y(e, t, n) {
9937
+ D("number" == typeof e, "cannot write a non-number as a number"), D(e <= t, "value larger than maximum allowed value"), D(n <= e, "value smaller than minimum allowed value"), D(Math.floor(e) === e, "value has a fractional component");
9938
+ }
8137
9939
 
8138
- var FaceARElement = require("./elements/facear-element.js");
9940
+ function F(e, t, n) {
9941
+ D("number" == typeof e, "cannot write a non-number as a number"), D(e <= t, "value larger than maximum allowed value"), D(n <= e, "value smaller than minimum allowed value");
9942
+ }
8139
9943
 
8140
- var EditorElement = require("./elements/editor-element.js");
9944
+ function D(e, t) {
9945
+ if (!e) throw new Error(t || "Failed assertion");
9946
+ }
8141
9947
 
8142
- var StudioElement = require("./elements/studio-element.js");
9948
+ g._augment = function (e) {
9949
+ return e._isBuffer = !0, e._get = e.get, e._set = e.set, e.get = L.get, e.set = L.set, e.write = L.write, e.toString = L.toString, e.toLocaleString = L.toString, e.toJSON = L.toJSON, e.copy = L.copy, e.slice = L.slice, e.readUInt8 = L.readUInt8, e.readUInt16LE = L.readUInt16LE, e.readUInt16BE = L.readUInt16BE, e.readUInt32LE = L.readUInt32LE, e.readUInt32BE = L.readUInt32BE, e.readInt8 = L.readInt8, e.readInt16LE = L.readInt16LE, e.readInt16BE = L.readInt16BE, e.readInt32LE = L.readInt32LE, e.readInt32BE = L.readInt32BE, e.readFloatLE = L.readFloatLE, e.readFloatBE = L.readFloatBE, e.readDoubleLE = L.readDoubleLE, e.readDoubleBE = L.readDoubleBE, e.writeUInt8 = L.writeUInt8, e.writeUInt16LE = L.writeUInt16LE, e.writeUInt16BE = L.writeUInt16BE, e.writeUInt32LE = L.writeUInt32LE, e.writeUInt32BE = L.writeUInt32BE, e.writeInt8 = L.writeInt8, e.writeInt16LE = L.writeInt16LE, e.writeInt16BE = L.writeInt16BE, e.writeInt32LE = L.writeInt32LE, e.writeInt32BE = L.writeInt32BE, e.writeFloatLE = L.writeFloatLE, e.writeFloatBE = L.writeFloatBE, e.writeDoubleLE = L.writeDoubleLE, e.writeDoubleBE = L.writeDoubleBE, e.fill = L.fill, e.inspect = L.inspect, e.toArrayBuffer = L.toArrayBuffer, e;
9950
+ };
9951
+ }).call(this, O("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, O("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/buffer/index.js", "/node_modules/gulp-browserify/node_modules/buffer");
9952
+ }, {
9953
+ "base64-js": 2,
9954
+ buffer: 3,
9955
+ ieee754: 11,
9956
+ lYpoI2: 10
9957
+ }],
9958
+ 4: [function (l, d, e) {
9959
+ (function (e, t, u, n, r, o, i, a, s) {
9960
+ var u = l("buffer").Buffer,
9961
+ f = 4,
9962
+ c = new u(f);
9963
+ c.fill(0);
9964
+ d.exports = {
9965
+ hash: function hash(e, t, n, r) {
9966
+ return u.isBuffer(e) || (e = new u(e)), function (e, t, n) {
9967
+ for (var r = new u(t), o = n ? r.writeInt32BE : r.writeInt32LE, i = 0; i < e.length; i++) {
9968
+ o.call(r, e[i], 4 * i, !0);
9969
+ }
8143
9970
 
8144
- var ModelElement = require("./elements/model-element.js");
9971
+ return r;
9972
+ }(t(function (e, t) {
9973
+ var n;
9974
+ e.length % f != 0 && (n = e.length + (f - e.length % f), e = u.concat([e, c], n));
8145
9975
 
8146
- var ConfiguratorElement = require("./elements/configurator-element.js");
9976
+ for (var r = [], o = t ? e.readInt32BE : e.readInt32LE, i = 0; i < e.length; i += f) {
9977
+ r.push(o.call(e, i));
9978
+ }
8147
9979
 
8148
- var Version = require("./version");
9980
+ return r;
9981
+ }(e, r), 8 * e.length), n, r);
9982
+ }
9983
+ };
9984
+ }).call(this, l("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, l("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
9985
+ }, {
9986
+ buffer: 3,
9987
+ lYpoI2: 10
9988
+ }],
9989
+ 5: [function (w, e, b) {
9990
+ (function (e, t, a, n, r, o, i, u, s) {
9991
+ var a = w("buffer").Buffer,
9992
+ f = w("./sha"),
9993
+ c = w("./sha256"),
9994
+ l = w("./rng"),
9995
+ d = {
9996
+ sha1: f,
9997
+ sha256: c,
9998
+ md5: w("./md5")
9999
+ },
10000
+ h = 64,
10001
+ p = new a(h);
10002
+
10003
+ function g(e, r) {
10004
+ var o = d[e = e || "sha1"],
10005
+ i = [];
10006
+ return o || y("algorithm:", e, "is not yet supported"), {
10007
+ update: function update(e) {
10008
+ return a.isBuffer(e) || (e = new a(e)), i.push(e), e.length, this;
10009
+ },
10010
+ digest: function digest(e) {
10011
+ var t = a.concat(i),
10012
+ n = r ? function (e, t, n) {
10013
+ a.isBuffer(t) || (t = new a(t)), a.isBuffer(n) || (n = new a(n)), t.length > h ? t = e(t) : t.length < h && (t = a.concat([t, p], h));
8149
10014
 
8150
- if (customElements.get("plattar-webxr") === undefined) {
8151
- customElements.define("plattar-webxr", WebXRElement);
8152
- }
10015
+ for (var r = new a(h), o = new a(h), i = 0; i < h; i++) {
10016
+ r[i] = 54 ^ t[i], o[i] = 92 ^ t[i];
10017
+ }
8153
10018
 
8154
- if (customElements.get("plattar-viewer") === undefined) {
8155
- customElements.define("plattar-viewer", ViewerElement);
8156
- }
10019
+ var u = e(a.concat([r, n]));
10020
+ return e(a.concat([o, u]));
10021
+ }(o, r, t) : o(t);
10022
+ return i = null, e ? n.toString(e) : n;
10023
+ }
10024
+ };
10025
+ }
8157
10026
 
8158
- if (customElements.get("plattar-product") === undefined) {
8159
- customElements.define("plattar-product", ProductElement);
8160
- }
10027
+ function y() {
10028
+ var e = [].slice.call(arguments).join(" ");
10029
+ throw new Error([e, "we accept pull requests", "http://github.com/dominictarr/crypto-browserify"].join("\n"));
10030
+ }
8161
10031
 
8162
- if (customElements.get("plattar-editor") === undefined) {
8163
- customElements.define("plattar-editor", EditorElement);
8164
- }
10032
+ p.fill(0), b.createHash = function (e) {
10033
+ return g(e);
10034
+ }, b.createHmac = g, b.randomBytes = function (e, t) {
10035
+ if (!t || !t.call) return new a(l(e));
8165
10036
 
8166
- if (customElements.get("plattar-facear") === undefined) {
8167
- customElements.define("plattar-facear", FaceARElement);
8168
- }
10037
+ try {
10038
+ t.call(this, void 0, new a(l(e)));
10039
+ } catch (e) {
10040
+ t(e);
10041
+ }
10042
+ }, function (e, t) {
10043
+ for (var n in e) {
10044
+ t(e[n], n);
10045
+ }
10046
+ }(["createCredentials", "createCipher", "createCipheriv", "createDecipher", "createDecipheriv", "createSign", "createVerify", "createDiffieHellman", "pbkdf2"], function (e) {
10047
+ b[e] = function () {
10048
+ y("sorry,", e, "is not implemented yet");
10049
+ };
10050
+ });
10051
+ }).call(this, w("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, w("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
10052
+ }, {
10053
+ "./md5": 6,
10054
+ "./rng": 7,
10055
+ "./sha": 8,
10056
+ "./sha256": 9,
10057
+ buffer: 3,
10058
+ lYpoI2: 10
10059
+ }],
10060
+ 6: [function (w, b, e) {
10061
+ (function (e, t, n, r, o, i, u, a, s) {
10062
+ var f = w("./helpers");
10063
+
10064
+ function c(e, t) {
10065
+ e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t;
10066
+
10067
+ for (var n = 1732584193, r = -271733879, o = -1732584194, i = 271733878, u = 0; u < e.length; u += 16) {
10068
+ var a = n,
10069
+ s = r,
10070
+ f = o,
10071
+ c = i,
10072
+ n = d(n, r, o, i, e[u + 0], 7, -680876936),
10073
+ i = d(i, n, r, o, e[u + 1], 12, -389564586),
10074
+ o = d(o, i, n, r, e[u + 2], 17, 606105819),
10075
+ r = d(r, o, i, n, e[u + 3], 22, -1044525330);
10076
+ n = d(n, r, o, i, e[u + 4], 7, -176418897), i = d(i, n, r, o, e[u + 5], 12, 1200080426), o = d(o, i, n, r, e[u + 6], 17, -1473231341), r = d(r, o, i, n, e[u + 7], 22, -45705983), n = d(n, r, o, i, e[u + 8], 7, 1770035416), i = d(i, n, r, o, e[u + 9], 12, -1958414417), o = d(o, i, n, r, e[u + 10], 17, -42063), r = d(r, o, i, n, e[u + 11], 22, -1990404162), n = d(n, r, o, i, e[u + 12], 7, 1804603682), i = d(i, n, r, o, e[u + 13], 12, -40341101), o = d(o, i, n, r, e[u + 14], 17, -1502002290), n = h(n, r = d(r, o, i, n, e[u + 15], 22, 1236535329), o, i, e[u + 1], 5, -165796510), i = h(i, n, r, o, e[u + 6], 9, -1069501632), o = h(o, i, n, r, e[u + 11], 14, 643717713), r = h(r, o, i, n, e[u + 0], 20, -373897302), n = h(n, r, o, i, e[u + 5], 5, -701558691), i = h(i, n, r, o, e[u + 10], 9, 38016083), o = h(o, i, n, r, e[u + 15], 14, -660478335), r = h(r, o, i, n, e[u + 4], 20, -405537848), n = h(n, r, o, i, e[u + 9], 5, 568446438), i = h(i, n, r, o, e[u + 14], 9, -1019803690), o = h(o, i, n, r, e[u + 3], 14, -187363961), r = h(r, o, i, n, e[u + 8], 20, 1163531501), n = h(n, r, o, i, e[u + 13], 5, -1444681467), i = h(i, n, r, o, e[u + 2], 9, -51403784), o = h(o, i, n, r, e[u + 7], 14, 1735328473), n = p(n, r = h(r, o, i, n, e[u + 12], 20, -1926607734), o, i, e[u + 5], 4, -378558), i = p(i, n, r, o, e[u + 8], 11, -2022574463), o = p(o, i, n, r, e[u + 11], 16, 1839030562), r = p(r, o, i, n, e[u + 14], 23, -35309556), n = p(n, r, o, i, e[u + 1], 4, -1530992060), i = p(i, n, r, o, e[u + 4], 11, 1272893353), o = p(o, i, n, r, e[u + 7], 16, -155497632), r = p(r, o, i, n, e[u + 10], 23, -1094730640), n = p(n, r, o, i, e[u + 13], 4, 681279174), i = p(i, n, r, o, e[u + 0], 11, -358537222), o = p(o, i, n, r, e[u + 3], 16, -722521979), r = p(r, o, i, n, e[u + 6], 23, 76029189), n = p(n, r, o, i, e[u + 9], 4, -640364487), i = p(i, n, r, o, e[u + 12], 11, -421815835), o = p(o, i, n, r, e[u + 15], 16, 530742520), n = g(n, r = p(r, o, i, n, e[u + 2], 23, -995338651), o, i, e[u + 0], 6, -198630844), i = g(i, n, r, o, e[u + 7], 10, 1126891415), o = g(o, i, n, r, e[u + 14], 15, -1416354905), r = g(r, o, i, n, e[u + 5], 21, -57434055), n = g(n, r, o, i, e[u + 12], 6, 1700485571), i = g(i, n, r, o, e[u + 3], 10, -1894986606), o = g(o, i, n, r, e[u + 10], 15, -1051523), r = g(r, o, i, n, e[u + 1], 21, -2054922799), n = g(n, r, o, i, e[u + 8], 6, 1873313359), i = g(i, n, r, o, e[u + 15], 10, -30611744), o = g(o, i, n, r, e[u + 6], 15, -1560198380), r = g(r, o, i, n, e[u + 13], 21, 1309151649), n = g(n, r, o, i, e[u + 4], 6, -145523070), i = g(i, n, r, o, e[u + 11], 10, -1120210379), o = g(o, i, n, r, e[u + 2], 15, 718787259), r = g(r, o, i, n, e[u + 9], 21, -343485551), n = y(n, a), r = y(r, s), o = y(o, f), i = y(i, c);
10077
+ }
8169
10078
 
8170
- if (customElements.get("plattar-8wall") === undefined) {
8171
- customElements.define("plattar-8wall", EWallElement);
8172
- }
10079
+ return Array(n, r, o, i);
10080
+ }
8173
10081
 
8174
- if (customElements.get("plattar-studio") === undefined) {
8175
- customElements.define("plattar-studio", StudioElement);
8176
- }
10082
+ function l(e, t, n, r, o, i) {
10083
+ return y((u = y(y(t, e), y(r, i))) << (a = o) | u >>> 32 - a, n);
10084
+ var u, a;
10085
+ }
8177
10086
 
8178
- if (customElements.get("plattar-model") === undefined) {
8179
- customElements.define("plattar-model", ModelElement);
8180
- }
10087
+ function d(e, t, n, r, o, i, u) {
10088
+ return l(t & n | ~t & r, e, t, o, i, u);
10089
+ }
8181
10090
 
8182
- if (customElements.get("plattar-configurator") === undefined) {
8183
- customElements.define("plattar-configurator", ConfiguratorElement);
8184
- }
10091
+ function h(e, t, n, r, o, i, u) {
10092
+ return l(t & r | n & ~r, e, t, o, i, u);
10093
+ }
8185
10094
 
8186
- console.log("using @plattar/plattar-web v" + Version);
8187
- module.exports = {
8188
- version: Version
8189
- };
8190
- }, {
8191
- "./elements/configurator-element.js": 105,
8192
- "./elements/editor-element.js": 108,
8193
- "./elements/ewall-element.js": 109,
8194
- "./elements/facear-element.js": 110,
8195
- "./elements/model-element.js": 111,
8196
- "./elements/product-element.js": 112,
8197
- "./elements/studio-element.js": 113,
8198
- "./elements/viewer-element.js": 114,
8199
- "./elements/webxr-element.js": 115,
8200
- "./version": 118
8201
- }],
8202
- 117: [function (require, module, exports) {
8203
- var Util = /*#__PURE__*/function () {
8204
- function Util() {
8205
- _classCallCheck(this, Util);
8206
- }
10095
+ function p(e, t, n, r, o, i, u) {
10096
+ return l(t ^ n ^ r, e, t, o, i, u);
10097
+ }
8207
10098
 
8208
- _createClass(Util, null, [{
8209
- key: "getServerLocation",
8210
- value: function getServerLocation(server) {
8211
- switch (server) {
8212
- case "production":
8213
- return "https://app.plattar.com/renderer/";
10099
+ function g(e, t, n, r, o, i, u) {
10100
+ return l(n ^ (t | ~r), e, t, o, i, u);
10101
+ }
8214
10102
 
8215
- case "staging":
8216
- return "https://staging.plattar.space/renderer/";
10103
+ function y(e, t) {
10104
+ var n = (65535 & e) + (65535 & t);
10105
+ return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n;
10106
+ }
8217
10107
 
8218
- case "dev":
8219
- return "https://localhost/renderer/";
10108
+ b.exports = function (e) {
10109
+ return f.hash(e, c, 16);
10110
+ };
10111
+ }).call(this, w("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, w("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
10112
+ }, {
10113
+ "./helpers": 4,
10114
+ buffer: 3,
10115
+ lYpoI2: 10
10116
+ }],
10117
+ 7: [function (e, l, t) {
10118
+ (function (e, t, n, r, o, i, u, a, s) {
10119
+ var f, c;
10120
+ c = function c(e) {
10121
+ for (var t, n = new Array(e), r = 0; r < e; r++) {
10122
+ 0 == (3 & r) && (t = 4294967296 * Math.random()), n[r] = t >>> ((3 & r) << 3) & 255;
10123
+ }
8220
10124
 
8221
- default:
8222
- return undefined;
8223
- }
8224
- }
8225
- }, {
8226
- key: "getElementLocation",
8227
- value: function getElementLocation(etype) {
8228
- var isValid = Util.isValidType(etype);
10125
+ return n;
10126
+ }, l.exports = f || c;
10127
+ }).call(this, e("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, e("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
10128
+ }, {
10129
+ buffer: 3,
10130
+ lYpoI2: 10
10131
+ }],
10132
+ 8: [function (l, d, e) {
10133
+ (function (e, t, n, r, o, i, u, a, s) {
10134
+ var f = l("./helpers");
10135
+
10136
+ function c(e, t) {
10137
+ e[t >> 5] |= 128 << 24 - t % 32, e[15 + (t + 64 >> 9 << 4)] = t;
10138
+
10139
+ for (var n, r, o, i, u, a = Array(80), s = 1732584193, f = -271733879, c = -1732584194, l = 271733878, d = -1009589776, h = 0; h < e.length; h += 16) {
10140
+ for (var p = s, g = f, y = c, w = l, b = d, m = 0; m < 80; m++) {
10141
+ a[m] = m < 16 ? e[h + m] : E(a[m - 3] ^ a[m - 8] ^ a[m - 14] ^ a[m - 16], 1);
10142
+
10143
+ var v = _(_(E(s, 5), (o = f, i = c, u = l, (r = m) < 20 ? o & i | ~o & u : !(r < 40) && r < 60 ? o & i | o & u | i & u : o ^ i ^ u)), _(_(d, a[m]), (n = m) < 20 ? 1518500249 : n < 40 ? 1859775393 : n < 60 ? -1894007588 : -899497514)),
10144
+ d = l,
10145
+ l = c,
10146
+ c = E(f, 30),
10147
+ f = s,
10148
+ s = v;
10149
+ }
8229
10150
 
8230
- if (isValid) {
8231
- return etype + ".html";
8232
- }
10151
+ s = _(s, p), f = _(f, g), c = _(c, y), l = _(l, w), d = _(d, b);
10152
+ }
8233
10153
 
8234
- return undefined;
8235
- }
8236
- }, {
8237
- key: "getElementBundleLocation",
8238
- value: function getElementBundleLocation(etype, server) {
8239
- var location = Util.getServerLocation(server);
10154
+ return Array(s, f, c, l, d);
10155
+ }
8240
10156
 
8241
- if (!location) {
8242
- return undefined;
8243
- }
10157
+ function _(e, t) {
10158
+ var n = (65535 & e) + (65535 & t);
10159
+ return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n;
10160
+ }
8244
10161
 
8245
- var isValid = Util.isValidType(etype);
10162
+ function E(e, t) {
10163
+ return e << t | e >>> 32 - t;
10164
+ }
8246
10165
 
8247
- if (isValid) {
8248
- var isMinified = location === "dev" ? false : true;
8249
- return isMinified ? etype + "-bundle.min.js" : etype + "-bundle.js";
8250
- }
10166
+ d.exports = function (e) {
10167
+ return f.hash(e, c, 20, !0);
10168
+ };
10169
+ }).call(this, l("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, l("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
10170
+ }, {
10171
+ "./helpers": 4,
10172
+ buffer: 3,
10173
+ lYpoI2: 10
10174
+ }],
10175
+ 9: [function (l, d, e) {
10176
+ (function (e, t, n, r, o, i, u, a, s) {
10177
+ function B(e, t) {
10178
+ var n = (65535 & e) + (65535 & t);
10179
+ return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n;
10180
+ }
8251
10181
 
8252
- return undefined;
8253
- }
8254
- }, {
8255
- key: "isValidType",
8256
- value: function isValidType(etype) {
8257
- switch (etype) {
8258
- case "viewer":
8259
- case "editor":
8260
- case "ewall":
8261
- case "facear":
8262
- case "studio":
8263
- case "product":
8264
- case "model":
8265
- case "configurator":
8266
- case "webxr":
8267
- return true;
10182
+ function L(e, t) {
10183
+ return e >>> t | e << 32 - t;
10184
+ }
8268
10185
 
8269
- default:
8270
- return false;
8271
- }
8272
- }
8273
- }, {
8274
- key: "id",
8275
- value: function id() {
8276
- return Math.abs(Math.floor(Math.random() * 10000000000000));
8277
- }
8278
- }, {
8279
- key: "getPermissionString",
8280
- value: function getPermissionString(permissions) {
8281
- if (permissions && permissions.length > 0) {
8282
- var permissionString = permissions[0];
10186
+ function f(e, t) {
10187
+ var n,
10188
+ r,
10189
+ o,
10190
+ i,
10191
+ u,
10192
+ a,
10193
+ s,
10194
+ f,
10195
+ c,
10196
+ l,
10197
+ d = new Array(1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298),
10198
+ h = new Array(1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225),
10199
+ p = new Array(64);
10200
+ e[t >> 5] |= 128 << 24 - t % 32, e[15 + (t + 64 >> 9 << 4)] = t;
8283
10201
 
8284
- for (var i = 1; i < permissions.length; i++) {
8285
- permissionString += "; " + permissions[i];
8286
- }
10202
+ for (var g, y, w, b, m, v, _, E, I = 0; I < e.length; I += 16) {
10203
+ n = h[0], r = h[1], o = h[2], i = h[3], u = h[4], a = h[5], s = h[6], f = h[7];
8287
10204
 
8288
- return permissionString;
8289
- }
10205
+ for (var A = 0; A < 64; A++) {
10206
+ p[A] = A < 16 ? e[A + I] : B(B(B((E = p[A - 2], L(E, 17) ^ L(E, 19) ^ E >>> 10), p[A - 7]), (_ = p[A - 15], L(_, 7) ^ L(_, 18) ^ _ >>> 3)), p[A - 16]), c = B(B(B(B(f, L(v = u, 6) ^ L(v, 11) ^ L(v, 25)), (m = u) & a ^ ~m & s), d[A]), p[A]), l = B(L(b = n, 2) ^ L(b, 13) ^ L(b, 22), (g = n) & (y = r) ^ g & (w = o) ^ y & w), f = s, s = a, a = u, u = B(i, c), i = o, o = r, r = n, n = B(c, l);
10207
+ }
8290
10208
 
8291
- return undefined;
8292
- }
8293
- }]);
10209
+ h[0] = B(n, h[0]), h[1] = B(r, h[1]), h[2] = B(o, h[2]), h[3] = B(i, h[3]), h[4] = B(u, h[4]), h[5] = B(a, h[5]), h[6] = B(s, h[6]), h[7] = B(f, h[7]);
10210
+ }
8294
10211
 
8295
- return Util;
8296
- }();
10212
+ return h;
10213
+ }
8297
10214
 
8298
- module.exports = Util;
8299
- }, {}],
8300
- 118: [function (require, module, exports) {
8301
- module.exports = "1.122.3";
8302
- }, {}],
8303
- 119: [function (require, module, exports) {
8304
- (function (global) {
8305
- (function () {
8306
- "use strict"; // ref: https://github.com/tc39/proposal-global
10215
+ var c = l("./helpers");
8307
10216
 
8308
- var getGlobal = function getGlobal() {
8309
- // the only reliable means to get the global object is
8310
- // `Function('return this')()`
8311
- // However, this causes CSP violations in Chrome apps.
8312
- if (typeof self !== 'undefined') {
8313
- return self;
8314
- }
10217
+ d.exports = function (e) {
10218
+ return c.hash(e, f, 32, !0);
10219
+ };
10220
+ }).call(this, l("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, l("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
10221
+ }, {
10222
+ "./helpers": 4,
10223
+ buffer: 3,
10224
+ lYpoI2: 10
10225
+ }],
10226
+ 10: [function (e, c, t) {
10227
+ (function (e, t, n, r, o, i, u, a, s) {
10228
+ function f() {}
10229
+
10230
+ (e = c.exports = {}).nextTick = function () {
10231
+ var e = "undefined" != typeof window && window.setImmediate,
10232
+ t = "undefined" != typeof window && window.postMessage && window.addEventListener;
10233
+ if (e) return function (e) {
10234
+ return window.setImmediate(e);
10235
+ };
8315
10236
 
8316
- if (typeof window !== 'undefined') {
8317
- return window;
8318
- }
10237
+ if (t) {
10238
+ var n = [];
10239
+ return window.addEventListener("message", function (e) {
10240
+ var t = e.source;
10241
+ t !== window && null !== t || "process-tick" !== e.data || (e.stopPropagation(), 0 < n.length && n.shift()());
10242
+ }, !0), function (e) {
10243
+ n.push(e), window.postMessage("process-tick", "*");
10244
+ };
10245
+ }
8319
10246
 
8320
- if (typeof global !== 'undefined') {
8321
- return global;
8322
- }
10247
+ return function (e) {
10248
+ setTimeout(e, 0);
10249
+ };
10250
+ }(), e.title = "browser", e.browser = !0, e.env = {}, e.argv = [], e.on = f, e.addListener = f, e.once = f, e.off = f, e.removeListener = f, e.removeAllListeners = f, e.emit = f, e.binding = function (e) {
10251
+ throw new Error("process.binding is not supported");
10252
+ }, e.cwd = function () {
10253
+ return "/";
10254
+ }, e.chdir = function (e) {
10255
+ throw new Error("process.chdir is not supported");
10256
+ };
10257
+ }).call(this, e("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, e("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/process/browser.js", "/node_modules/gulp-browserify/node_modules/process");
10258
+ }, {
10259
+ buffer: 3,
10260
+ lYpoI2: 10
10261
+ }],
10262
+ 11: [function (e, t, f) {
10263
+ (function (e, t, n, r, o, i, u, a, s) {
10264
+ f.read = function (e, t, n, r, o) {
10265
+ var i,
10266
+ u,
10267
+ a = 8 * o - r - 1,
10268
+ s = (1 << a) - 1,
10269
+ f = s >> 1,
10270
+ c = -7,
10271
+ l = n ? o - 1 : 0,
10272
+ d = n ? -1 : 1,
10273
+ h = e[t + l];
10274
+
10275
+ for (l += d, i = h & (1 << -c) - 1, h >>= -c, c += a; 0 < c; i = 256 * i + e[t + l], l += d, c -= 8) {
10276
+ ;
10277
+ }
8323
10278
 
8324
- throw new Error('unable to locate global object');
8325
- };
10279
+ for (u = i & (1 << -c) - 1, i >>= -c, c += r; 0 < c; u = 256 * u + e[t + l], l += d, c -= 8) {
10280
+ ;
10281
+ }
8326
10282
 
8327
- var global = getGlobal();
8328
- module.exports = exports = global.fetch; // Needed for TypeScript and Webpack.
10283
+ if (0 === i) i = 1 - f;else {
10284
+ if (i === s) return u ? NaN : 1 / 0 * (h ? -1 : 1);
10285
+ u += Math.pow(2, r), i -= f;
10286
+ }
10287
+ return (h ? -1 : 1) * u * Math.pow(2, i - r);
10288
+ }, f.write = function (e, t, n, r, o, i) {
10289
+ var u,
10290
+ a,
10291
+ s,
10292
+ f = 8 * i - o - 1,
10293
+ c = (1 << f) - 1,
10294
+ l = c >> 1,
10295
+ d = 23 === o ? Math.pow(2, -24) - Math.pow(2, -77) : 0,
10296
+ h = r ? 0 : i - 1,
10297
+ p = r ? 1 : -1,
10298
+ g = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
10299
+
10300
+ for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0, u = c) : (u = Math.floor(Math.log(t) / Math.LN2), t * (s = Math.pow(2, -u)) < 1 && (u--, s *= 2), 2 <= (t += 1 <= u + l ? d / s : d * Math.pow(2, 1 - l)) * s && (u++, s /= 2), c <= u + l ? (a = 0, u = c) : 1 <= u + l ? (a = (t * s - 1) * Math.pow(2, o), u += l) : (a = t * Math.pow(2, l - 1) * Math.pow(2, o), u = 0)); 8 <= o; e[n + h] = 255 & a, h += p, a /= 256, o -= 8) {
10301
+ ;
10302
+ }
8329
10303
 
8330
- if (global.fetch) {
8331
- exports["default"] = global.fetch.bind(global);
8332
- }
10304
+ for (u = u << o | a, f += o; 0 < f; e[n + h] = 255 & u, h += p, u /= 256, f -= 8) {
10305
+ ;
10306
+ }
8333
10307
 
8334
- exports.Headers = global.Headers;
8335
- exports.Request = global.Request;
8336
- exports.Response = global.Response;
10308
+ e[n + h - p] |= 128 * g;
10309
+ };
10310
+ }).call(this, e("lYpoI2"), "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, e("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/ieee754/index.js", "/node_modules/ieee754");
10311
+ }, {
10312
+ buffer: 3,
10313
+ lYpoI2: 10
10314
+ }]
10315
+ }, {}, [1])(1);
10316
+ });
8337
10317
  }).call(this);
8338
10318
  }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
8339
10319
  }, {}],
8340
- 120: [function (require, module, exports) {
10320
+ 126: [function (require, module, exports) {
8341
10321
  // shim for using process in browser
8342
10322
  var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
8343
10323
  // don't break things. But we need to wrap it in a try catch in case it is
@@ -8547,7 +10527,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
8547
10527
  return 0;
8548
10528
  };
8549
10529
  }, {}],
8550
- 121: [function (require, module, exports) {
10530
+ 127: [function (require, module, exports) {
8551
10531
  !function (t, e) {
8552
10532
  "object" == _typeof(exports) && "object" == _typeof(module) ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == _typeof(exports) ? exports.QRCodeStyling = e() : t.QRCodeStyling = e();
8553
10533
  }(self, function () {