@londondynamics/pericles-webcomponent 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configurator.cjs +3 -3
- package/dist/configurator.d.cts +1 -0
- package/dist/configurator.d.ts +1 -0
- package/dist/configurator.js +42 -33
- package/package.json +1 -1
package/dist/configurator.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const T=globalThis,J=T.ShadowRoot&&(T.ShadyCSS===void 0||T.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,q=Symbol(),F=new WeakMap;let it=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(J&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=F.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&F.set(e,t))}return t}toString(){return this.cssText}};const pt=i=>new it(typeof i=="string"?i:i+"",void 0,q),ct=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,r,n)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[n+1],i[0]);return new it(e,i,q)},ut=(i,t)=>{if(J)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),r=T.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=e.cssText,i.appendChild(s)}},V=J?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return pt(e)})(i):i;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const Ot={attribute:!0,type:String,converter:H,reflect:!1,hasChanged:W},Rt=(i=Ot,t,e)=>{const{kind:s,metadata:r}=e;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(e.name,i),s==="accessor"){const{name:o}=e;return{set(p){const a=t.get.call(this);t.set.call(this,p),this.requestUpdate(o,a,i)},init(p){return p!==void 0&&this.P(o,void 0,i),p}}}if(s==="setter"){const{name:o}=e;return function(p){const a=this[o];t.call(this,p),this.requestUpdate(o,a,i)}}throw Error("Unsupported decorator location: "+s)};function l(i){return(t,e)=>typeof e=="object"?Rt(i,t,e):((s,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...s,wrapped:!0}:s),o?Object.getOwnPropertyDescriptor(r,n):void 0})(i,t,e)}const Nt=["allow-partial-match","ar-placement","background-color","camera-orbit-sensitivity","camera-transition-duration","disable-retries","disable-scroll-wheel","enable-dark-mode","highlight-color","interaction-prompt-style","lights","list-bullet-alignment","list-bullet-leading-zeros","list-bullet-style","qr-url-pattern","rotation","ruler-unit","shadow-intensity","shadow-softness","show-ar-button","show-ar-button-label","show-configurator","show-contexts","show-configurator-mobile","show-hotspots","show-interaction-prompt","show-light-switch","show-ruler-button","show-pivot-button","show-presets","start-frame","tone-mapping","zoom-type"],
|
|
27
|
+
*/const Ot={attribute:!0,type:String,converter:H,reflect:!1,hasChanged:W},Rt=(i=Ot,t,e)=>{const{kind:s,metadata:r}=e;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(e.name,i),s==="accessor"){const{name:o}=e;return{set(p){const a=t.get.call(this);t.set.call(this,p),this.requestUpdate(o,a,i)},init(p){return p!==void 0&&this.P(o,void 0,i),p}}}if(s==="setter"){const{name:o}=e;return function(p){const a=this[o];t.call(this,p),this.requestUpdate(o,a,i)}}throw Error("Unsupported decorator location: "+s)};function l(i){return(t,e)=>typeof e=="object"?Rt(i,t,e):((s,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...s,wrapped:!0}:s),o?Object.getOwnPropertyDescriptor(r,n):void 0})(i,t,e)}const Nt=["allow-partial-match","ar-placement","background-color","camera-orbit-sensitivity","camera-transition-duration","disable-retries","disable-scroll-wheel","enable-dark-mode","highlight-color","interaction-prompt-style","lights","list-bullet-alignment","list-bullet-leading-zeros","list-bullet-style","qr-url-pattern","rotation","ruler-unit","shadow-intensity","shadow-softness","show-ar-button","show-ar-button-label","show-configurator","show-contexts","show-configurator-mobile","show-hotspots","show-interaction-prompt","show-light-switch","show-ruler-button","show-pivot-button","show-presets","start-frame","token","tone-mapping","zoom-type"],kt=i=>i.replace(/([-_]\w)/g,t=>t[1].toUpperCase()),Tt=i=>{const t=kt(i);return t.includes("showAr")?t.replace("showAr","showAR"):t},Ht=i=>{let t=new URLSearchParams;return Nt.forEach(e=>{if(i.hasAttribute(e)){let s=i.getAttribute(e);if(!s)return;s==="yes"&&(s="true"),s==="no"&&(s="false"),t.append(Tt(e),s)}}),t};var It=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,h=(i,t,e,s)=>{for(var r=s>1?void 0:s?Lt(t,e):t,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=(s?o(t,e,r):o(r))||r);return s&&r&&It(t,e,r),r};const jt="{host}{viewer}/by_scene_id/{scene_id}",Dt="{host}{viewer}/by_product_id/{customer_id}/{product_id}",zt="{host}{viewer}/by_product_id/{customer_id}/{sku}",Bt="{host}{viewer}/by_hash/{customer_id}/{hash}";function k(i,t){var e=new RegExp(Object.keys(t).join("|"),"gi");return i.replace(e,function(s){return t[s.toLowerCase()]})}exports.Configurator=class extends M{constructor(){super(...arguments),this.customerId=void 0,this.viewer="realtime",this.host="https://configurator.v2.londondynamics.com",this.defaultSelection={},this.getCurrentSelection=t=>this._pingpongPostMessage({type:"currentValues"},t),this._emit=(t,e)=>{this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))},this._pingpongPostMessage=(t,e)=>new Promise((s,r)=>{var a,d;const n={...t,messageId:Date.now()},o=u=>{if(u.origin===this.host&&u.data.messageId===n.messageId&&u.data.type===n.type){try{e?e(JSON.parse(u.data.result)):s(JSON.parse(u.data.result))}catch(c){c instanceof Error?e?e({},c.message):r(c.message):e?e({},"Unknown error"):r("Unknown error")}window.removeEventListener("message",o)}},p=(a=this.shadowRoot)==null?void 0:a.querySelector("iframe");p&&(window.addEventListener("message",o),(d=p.contentWindow)==null||d.postMessage(n,"*"))}),this._handleMessage=t=>{var e;if(t.origin===this.host&&(e=t==null?void 0:t.data)!=null&&e.type)switch(t.data.type){case"ready":this._emit("ready",{options:JSON.parse(t.data.options),presets:JSON.parse(t.data.presets),scene:JSON.parse(t.data.scene)});break;case"load":this._emit("load",JSON.parse(t.data.values));break;case"error":this._emit("error",JSON.parse(t.data.values));break;case"change":this._emit("change",JSON.parse(t.data.values));break;case"cameraChange":this._emit("camerachange",JSON.parse(t.data.values));break;case"log":const{logType:s,logData:r}=t.data;this._emit(s,JSON.parse(r));break}}}getCurrentConfiguration(t){return this._pingpongPostMessage({type:"currentConfig"},t)}getCurrentScene(t){return this._pingpongPostMessage({type:"currentScene"},t)}getCurrentHash(t){return this._pingpongPostMessage({type:"currentHash"},t)}getCurrentSource(t){return this._pingpongPostMessage({type:"currentSource"},t)}getCurrentARSource(t){return this._pingpongPostMessage({type:"currentARSource"},t)}getDataURL(t){return this._pingpongPostMessage({type:"dataURL"},t)}getFrame(t,e,s){return this._pingpongPostMessage({type:"getFrame",index:t,options:e},s)}setFeature(t,e){this._postMessage({type:"setFeature",featureId:t,variantId:e,allowPartialMatch:this.allowPartialMatch})}setSelection(t,e){this._postMessage({type:"setSelection",selection:t,resetBeforeUpdate:e,allowPartialMatch:this.allowPartialMatch})}setContext(t){this._postMessage({type:"setPreset",presetId:t})}resetCamera(){this._postMessage({type:"resetCamera"})}toggleLights(t){this._postMessage({type:"toggleLights",value:t})}toggleGroup(t){this._postMessage({type:"toggleGroup",value:t})}toggleHotspot(t){this._postMessage({type:"toggleGroup",groupId:t})}setRotation(t=[0,0,0],e="deg"){this._postMessage({type:"setRotation",rotation:t,angularUnit:e})}setCamera(t={},e={}){this._postMessage({type:"setCamera",...t,...e})}_postMessage(t){var s,r;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("iframe");e&&((r=e.contentWindow)==null||r.postMessage(t,"*"))}connectedCallback(){super.connectedCallback();const t=this.querySelector('script[type="application/json"]');if(t&&t.textContent)try{this.defaultSelection=JSON.parse(t.textContent)}catch(e){typeof e=="object"&&e instanceof Error?console.warn(`Error parsing selection: ${e.message}. Using default selection instead.`):console.warn("Error parsing selection. Using default selection instead.")}window.addEventListener("message",this._handleMessage)}disconnectedCallback(){window.removeEventListener("message",this._handleMessage),super.disconnectedCallback()}render(){let t=null,e=null;if(this.host?this.customerId?this.hash?e=k(Bt,{"{viewer}":"","{host}":this.host,"{customer_id}":this.customerId,"{hash}":this.hash}):this.sceneId?e=k(jt,{"{viewer}":this.viewer==="360"?"/360":"","{host}":this.host,"{customer_id}":this.customerId,"{scene_id}":this.sceneId}):this.sku?e=k(zt,{"{viewer}":this.viewer==="360"?"/360":"","{host}":this.host,"{customer_id}":this.customerId,"{sku}":this.sku}):this.productId?e=k(Dt,{"{viewer}":this.viewer==="360"?"/360":"","{host}":this.host,"{customer_id}":this.customerId,"{product_id}":this.productId}):t="Missing property: sku, scene-id, or hash":t="Missing property: customer-id":t="Missing property: host",t)return et`<div>${t}</div>`;const s=Ht(this);for(const[r,n]of Object.entries(this.defaultSelection))n&&s.append(r,n);return s.size&&(e+="?"+s),et`<iframe
|
|
28
28
|
src="${e}"
|
|
29
29
|
width="100%"
|
|
30
30
|
height="100%"
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
width: 100%;
|
|
45
45
|
height: 100%;
|
|
46
46
|
}
|
|
47
|
-
`;h([l({type:String,attribute:"customer-id"})],exports.Configurator.prototype,"customerId",2);h([l({type:String,attribute:"product-id"})],exports.Configurator.prototype,"productId",2);h([l({type:String})],exports.Configurator.prototype,"sku",2);h([l({type:String,attribute:"scene-id"})],exports.Configurator.prototype,"sceneId",2);h([l({type:String})],exports.Configurator.prototype,"hash",2);h([l({type:String})],exports.Configurator.prototype,"viewer",2);h([l({type:String})],exports.Configurator.prototype,"host",2);h([l({type:String,attribute:"allow-partial-match"})],exports.Configurator.prototype,"allowPartialMatch",2);h([l({type:String,attribute:"ar-placement"})],exports.Configurator.prototype,"arPlacement",2);h([l({type:String,attribute:"background-color"})],exports.Configurator.prototype,"backgroundColor",2);h([l({type:String,attribute:"disable-retries"})],exports.Configurator.prototype,"disableRetries",2);h([l({type:String,attribute:"disable-scroll-wheel"})],exports.Configurator.prototype,"disableScrollWheel",2);h([l({type:String,attribute:"enable-darkmode"})],exports.Configurator.prototype,"enableDarkMode",2);h([l({type:String,attribute:"interaction-prompt-style"})],exports.Configurator.prototype,"interactionPromptStyle",2);h([l({type:String,attribute:"lights"})],exports.Configurator.prototype,"lights",2);h([l({type:String,attribute:"qr-url-pattern"})],exports.Configurator.prototype,"qrUrlPattern",2);h([l({type:String,attribute:"rotation"})],exports.Configurator.prototype,"rotation",2);h([l({type:String,attribute:"ruler-unit"})],exports.Configurator.prototype,"rulerUnit",2);h([l({type:String,attribute:"shadow-intensity"})],exports.Configurator.prototype,"shadowIntensity",2);h([l({type:String,attribute:"shadow-softness"})],exports.Configurator.prototype,"shadowSoftness",2);h([l({type:String,attribute:"show-ar-button"})],exports.Configurator.prototype,"showARButton",2);h([l({type:String,attribute:"show-ar-button-label"})],exports.Configurator.prototype,"showARButtonLabel",2);h([l({type:String,attribute:"show-configurator"})],exports.Configurator.prototype,"showConfigurator",2);h([l({type:String,attribute:"show-contexts"})],exports.Configurator.prototype,"showContexts",2);h([l({type:String,attribute:"show-hotspots"})],exports.Configurator.prototype,"showHotspots",2);h([l({type:String,attribute:"show-interaction-prompt"})],exports.Configurator.prototype,"showInteractionPrompt",2);h([l({type:String,attribute:"show-light-switch"})],exports.Configurator.prototype,"showLightSwitch",2);h([l({type:String,attribute:"show-ruler-button"})],exports.Configurator.prototype,"showRulerButton",2);h([l({type:String,attribute:"show-pivot-button"})],exports.Configurator.prototype,"showPivotButton",2);h([l({type:String,attribute:"show-presets"})],exports.Configurator.prototype,"showPresets",2);h([l({type:String,attribute:"start-frame"})],exports.Configurator.prototype,"startFrame",2);h([l({type:String,attribute:"tone-mapping"})],exports.Configurator.prototype,"toneMapping",2);h([l({type:String,attribute:"zoom-type"})],exports.Configurator.prototype,"zoomType",2);exports.Configurator=h([xt("ld-configurator")],exports.Configurator);
|
|
47
|
+
`;h([l({type:String,attribute:"customer-id"})],exports.Configurator.prototype,"customerId",2);h([l({type:String,attribute:"product-id"})],exports.Configurator.prototype,"productId",2);h([l({type:String})],exports.Configurator.prototype,"sku",2);h([l({type:String,attribute:"scene-id"})],exports.Configurator.prototype,"sceneId",2);h([l({type:String})],exports.Configurator.prototype,"hash",2);h([l({type:String})],exports.Configurator.prototype,"viewer",2);h([l({type:String})],exports.Configurator.prototype,"host",2);h([l({type:String})],exports.Configurator.prototype,"token",2);h([l({type:String,attribute:"allow-partial-match"})],exports.Configurator.prototype,"allowPartialMatch",2);h([l({type:String,attribute:"ar-placement"})],exports.Configurator.prototype,"arPlacement",2);h([l({type:String,attribute:"background-color"})],exports.Configurator.prototype,"backgroundColor",2);h([l({type:String,attribute:"disable-retries"})],exports.Configurator.prototype,"disableRetries",2);h([l({type:String,attribute:"disable-scroll-wheel"})],exports.Configurator.prototype,"disableScrollWheel",2);h([l({type:String,attribute:"enable-darkmode"})],exports.Configurator.prototype,"enableDarkMode",2);h([l({type:String,attribute:"interaction-prompt-style"})],exports.Configurator.prototype,"interactionPromptStyle",2);h([l({type:String,attribute:"lights"})],exports.Configurator.prototype,"lights",2);h([l({type:String,attribute:"qr-url-pattern"})],exports.Configurator.prototype,"qrUrlPattern",2);h([l({type:String,attribute:"rotation"})],exports.Configurator.prototype,"rotation",2);h([l({type:String,attribute:"ruler-unit"})],exports.Configurator.prototype,"rulerUnit",2);h([l({type:String,attribute:"shadow-intensity"})],exports.Configurator.prototype,"shadowIntensity",2);h([l({type:String,attribute:"shadow-softness"})],exports.Configurator.prototype,"shadowSoftness",2);h([l({type:String,attribute:"show-ar-button"})],exports.Configurator.prototype,"showARButton",2);h([l({type:String,attribute:"show-ar-button-label"})],exports.Configurator.prototype,"showARButtonLabel",2);h([l({type:String,attribute:"show-configurator"})],exports.Configurator.prototype,"showConfigurator",2);h([l({type:String,attribute:"show-contexts"})],exports.Configurator.prototype,"showContexts",2);h([l({type:String,attribute:"show-hotspots"})],exports.Configurator.prototype,"showHotspots",2);h([l({type:String,attribute:"show-interaction-prompt"})],exports.Configurator.prototype,"showInteractionPrompt",2);h([l({type:String,attribute:"show-light-switch"})],exports.Configurator.prototype,"showLightSwitch",2);h([l({type:String,attribute:"show-ruler-button"})],exports.Configurator.prototype,"showRulerButton",2);h([l({type:String,attribute:"show-pivot-button"})],exports.Configurator.prototype,"showPivotButton",2);h([l({type:String,attribute:"show-presets"})],exports.Configurator.prototype,"showPresets",2);h([l({type:String,attribute:"start-frame"})],exports.Configurator.prototype,"startFrame",2);h([l({type:String,attribute:"tone-mapping"})],exports.Configurator.prototype,"toneMapping",2);h([l({type:String,attribute:"zoom-type"})],exports.Configurator.prototype,"zoomType",2);exports.Configurator=h([xt("ld-configurator")],exports.Configurator);
|
package/dist/configurator.d.cts
CHANGED
package/dist/configurator.d.ts
CHANGED
package/dist/configurator.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const H = globalThis,
|
|
6
|
+
const H = globalThis, q = H.ShadowRoot && (H.ShadyCSS === void 0 || H.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, W = Symbol(), V = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
let ot = class {
|
|
8
8
|
constructor(t, e, i) {
|
|
9
9
|
if (this._$cssResult$ = !0, i !== W)
|
|
@@ -13,7 +13,7 @@ let ot = class {
|
|
|
13
13
|
get styleSheet() {
|
|
14
14
|
let t = this.o;
|
|
15
15
|
const e = this.t;
|
|
16
|
-
if (
|
|
16
|
+
if (q && t === void 0) {
|
|
17
17
|
const i = e !== void 0 && e.length === 1;
|
|
18
18
|
i && (t = V.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && V.set(e, t));
|
|
19
19
|
}
|
|
@@ -33,14 +33,14 @@ const ct = (s) => new ot(typeof s == "string" ? s : s + "", void 0, W), dt = (s,
|
|
|
33
33
|
})(r) + s[n + 1], s[0]);
|
|
34
34
|
return new ot(e, s, W);
|
|
35
35
|
}, ut = (s, t) => {
|
|
36
|
-
if (
|
|
36
|
+
if (q)
|
|
37
37
|
s.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
38
38
|
else
|
|
39
39
|
for (const e of t) {
|
|
40
40
|
const i = document.createElement("style"), r = H.litNonce;
|
|
41
41
|
r !== void 0 && i.setAttribute("nonce", r), i.textContent = e.cssText, s.appendChild(i);
|
|
42
42
|
}
|
|
43
|
-
}, G =
|
|
43
|
+
}, G = q ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => {
|
|
44
44
|
let e = "";
|
|
45
45
|
for (const i of t.cssRules)
|
|
46
46
|
e += i.cssText;
|
|
@@ -51,7 +51,7 @@ const ct = (s) => new ot(typeof s == "string" ? s : s + "", void 0, W), dt = (s,
|
|
|
51
51
|
* Copyright 2017 Google LLC
|
|
52
52
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
53
53
|
*/
|
|
54
|
-
const { is: gt, defineProperty: yt, getOwnPropertyDescriptor: _t, getOwnPropertyNames:
|
|
54
|
+
const { is: gt, defineProperty: yt, getOwnPropertyDescriptor: _t, getOwnPropertyNames: mt, getOwnPropertySymbols: $t, getPrototypeOf: ft } = Object, f = globalThis, K = f.trustedTypes, wt = K ? K.emptyScript : "", j = f.reactiveElementPolyfillSupport, C = (s, t) => s, I = { toAttribute(s, t) {
|
|
55
55
|
switch (t) {
|
|
56
56
|
case Boolean:
|
|
57
57
|
s = s ? wt : null;
|
|
@@ -80,7 +80,7 @@ const { is: gt, defineProperty: yt, getOwnPropertyDescriptor: _t, getOwnProperty
|
|
|
80
80
|
}
|
|
81
81
|
return e;
|
|
82
82
|
} }, F = (s, t) => !gt(s, t), Q = { attribute: !0, type: String, converter: I, reflect: !1, hasChanged: F };
|
|
83
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
83
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), f.litPropertyMetadata ?? (f.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
84
84
|
class A extends HTMLElement {
|
|
85
85
|
static addInitializer(t) {
|
|
86
86
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
@@ -113,14 +113,14 @@ class A extends HTMLElement {
|
|
|
113
113
|
static _$Ei() {
|
|
114
114
|
if (this.hasOwnProperty(C("elementProperties")))
|
|
115
115
|
return;
|
|
116
|
-
const t =
|
|
116
|
+
const t = ft(this);
|
|
117
117
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
118
118
|
}
|
|
119
119
|
static finalize() {
|
|
120
120
|
if (this.hasOwnProperty(C("finalized")))
|
|
121
121
|
return;
|
|
122
122
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
|
|
123
|
-
const e = this.properties, i = [...
|
|
123
|
+
const e = this.properties, i = [...mt(e), ...$t(e)];
|
|
124
124
|
for (const r of i)
|
|
125
125
|
this.createProperty(r, e[r]);
|
|
126
126
|
}
|
|
@@ -292,13 +292,13 @@ class A extends HTMLElement {
|
|
|
292
292
|
firstUpdated(t) {
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, A[C("elementProperties")] = /* @__PURE__ */ new Map(), A[C("finalized")] = /* @__PURE__ */ new Map(), j == null || j({ ReactiveElement: A }), (
|
|
295
|
+
A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, A[C("elementProperties")] = /* @__PURE__ */ new Map(), A[C("finalized")] = /* @__PURE__ */ new Map(), j == null || j({ ReactiveElement: A }), (f.reactiveElementVersions ?? (f.reactiveElementVersions = [])).push("2.0.4");
|
|
296
296
|
/**
|
|
297
297
|
* @license
|
|
298
298
|
* Copyright 2017 Google LLC
|
|
299
299
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
300
300
|
*/
|
|
301
|
-
const M = globalThis, L = M.trustedTypes, Z = L ? L.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, nt = "$lit$",
|
|
301
|
+
const M = globalThis, L = M.trustedTypes, Z = L ? L.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, nt = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, at = "?" + $, bt = `<${at}>`, S = document, x = () => S.createComment(""), O = (s) => s === null || typeof s != "object" && typeof s != "function", ht = Array.isArray, St = (s) => ht(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", z = `[
|
|
302
302
|
\f\r]`, P = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, X = /-->/g, Y = />/g, w = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
|
|
303
303
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), tt = /'/g, et = /"/g, lt = /^(?:script|style|textarea|title)$/i, At = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), st = At(1), v = Symbol.for("lit-noChange"), y = Symbol.for("lit-nothing"), it = /* @__PURE__ */ new WeakMap(), b = S.createTreeWalker(S, 129);
|
|
304
304
|
function pt(s, t) {
|
|
@@ -314,8 +314,8 @@ const vt = (s, t) => {
|
|
|
314
314
|
let d, g, u = -1, _ = 0;
|
|
315
315
|
for (; _ < a.length && (o.lastIndex = _, g = o.exec(a), g !== null); )
|
|
316
316
|
_ = o.lastIndex, o === P ? g[1] === "!--" ? o = X : g[1] !== void 0 ? o = Y : g[2] !== void 0 ? (lt.test(g[2]) && (r = RegExp("</" + g[2], "g")), o = w) : g[3] !== void 0 && (o = w) : o === w ? g[0] === ">" ? (o = r ?? P, u = -1) : g[1] === void 0 ? u = -2 : (u = o.lastIndex - g[2].length, d = g[1], o = g[3] === void 0 ? w : g[3] === '"' ? et : tt) : o === et || o === tt ? o = w : o === X || o === Y ? o = P : (o = w, r = void 0);
|
|
317
|
-
const
|
|
318
|
-
n += o === P ? a + bt : u >= 0 ? (i.push(d), a.slice(0, u) + nt + a.slice(u) +
|
|
317
|
+
const m = o === w && s[c + 1].startsWith("/>") ? " " : "";
|
|
318
|
+
n += o === P ? a + bt : u >= 0 ? (i.push(d), a.slice(0, u) + nt + a.slice(u) + $ + m) : a + $ + (u === -2 ? c : m);
|
|
319
319
|
}
|
|
320
320
|
return [pt(s, n + (s[e] || "<?>") + (t === 2 ? "</svg>" : "")), i];
|
|
321
321
|
};
|
|
@@ -334,16 +334,16 @@ class R {
|
|
|
334
334
|
if (r.hasAttributes())
|
|
335
335
|
for (const u of r.getAttributeNames())
|
|
336
336
|
if (u.endsWith(nt)) {
|
|
337
|
-
const _ = g[o++],
|
|
338
|
-
a.push({ type: 1, index: n, name: k[2], strings:
|
|
337
|
+
const _ = g[o++], m = r.getAttribute(u).split($), k = /([.?@])?(.*)/.exec(_);
|
|
338
|
+
a.push({ type: 1, index: n, name: k[2], strings: m, ctor: k[1] === "." ? Pt : k[1] === "?" ? Ct : k[1] === "@" ? Mt : D }), r.removeAttribute(u);
|
|
339
339
|
} else
|
|
340
|
-
u.startsWith(
|
|
340
|
+
u.startsWith($) && (a.push({ type: 6, index: n }), r.removeAttribute(u));
|
|
341
341
|
if (lt.test(r.tagName)) {
|
|
342
|
-
const u = r.textContent.split(
|
|
342
|
+
const u = r.textContent.split($), _ = u.length - 1;
|
|
343
343
|
if (_ > 0) {
|
|
344
344
|
r.textContent = L ? L.emptyScript : "";
|
|
345
|
-
for (let
|
|
346
|
-
r.append(u[
|
|
345
|
+
for (let m = 0; m < _; m++)
|
|
346
|
+
r.append(u[m], x()), b.nextNode(), a.push({ type: 2, index: ++n });
|
|
347
347
|
r.append(u[_], x());
|
|
348
348
|
}
|
|
349
349
|
}
|
|
@@ -352,8 +352,8 @@ class R {
|
|
|
352
352
|
a.push({ type: 2, index: n });
|
|
353
353
|
else {
|
|
354
354
|
let u = -1;
|
|
355
|
-
for (; (u = r.data.indexOf(
|
|
356
|
-
a.push({ type: 7, index: n }), u +=
|
|
355
|
+
for (; (u = r.data.indexOf($, u + 1)) !== -1; )
|
|
356
|
+
a.push({ type: 7, index: n }), u += $.length - 1;
|
|
357
357
|
}
|
|
358
358
|
n++;
|
|
359
359
|
}
|
|
@@ -577,8 +577,8 @@ class U extends A {
|
|
|
577
577
|
}
|
|
578
578
|
var rt;
|
|
579
579
|
U._$litElement$ = !0, U.finalized = !0, (rt = globalThis.litElementHydrateSupport) == null || rt.call(globalThis, { LitElement: U });
|
|
580
|
-
const
|
|
581
|
-
|
|
580
|
+
const J = globalThis.litElementPolyfillSupport;
|
|
581
|
+
J == null || J({ LitElement: U });
|
|
582
582
|
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.5");
|
|
583
583
|
/**
|
|
584
584
|
* @license
|
|
@@ -654,25 +654,29 @@ const kt = [
|
|
|
654
654
|
"show-pivot-button",
|
|
655
655
|
"show-presets",
|
|
656
656
|
"start-frame",
|
|
657
|
+
"token",
|
|
657
658
|
"tone-mapping",
|
|
658
659
|
"zoom-type"
|
|
659
660
|
], Tt = (s) => s.replace(/([-_]\w)/g, (t) => t[1].toUpperCase()), Ht = (s) => {
|
|
661
|
+
const t = Tt(s);
|
|
662
|
+
return t.includes("showAr") ? t.replace("showAr", "showAR") : t;
|
|
663
|
+
}, It = (s) => {
|
|
660
664
|
let t = new URLSearchParams();
|
|
661
665
|
return kt.forEach((e) => {
|
|
662
666
|
if (s.hasAttribute(e)) {
|
|
663
667
|
let i = s.getAttribute(e);
|
|
664
668
|
if (!i)
|
|
665
669
|
return;
|
|
666
|
-
i === "yes" && (i = "true"), i === "no" && (i = "false"), t.append(
|
|
670
|
+
i === "yes" && (i = "true"), i === "no" && (i = "false"), t.append(Ht(e), i);
|
|
667
671
|
}
|
|
668
672
|
}), t;
|
|
669
673
|
};
|
|
670
|
-
var
|
|
671
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
674
|
+
var Lt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, l = (s, t, e, i) => {
|
|
675
|
+
for (var r = i > 1 ? void 0 : i ? Dt(t, e) : t, n = s.length - 1, o; n >= 0; n--)
|
|
672
676
|
(o = s[n]) && (r = (i ? o(t, e, r) : o(r)) || r);
|
|
673
|
-
return i && r &&
|
|
677
|
+
return i && r && Lt(t, e, r), r;
|
|
674
678
|
};
|
|
675
|
-
const
|
|
679
|
+
const jt = "{host}{viewer}/by_scene_id/{scene_id}", zt = "{host}{viewer}/by_product_id/{customer_id}/{product_id}", Bt = "{host}{viewer}/by_product_id/{customer_id}/{sku}", Jt = "{host}{viewer}/by_hash/{customer_id}/{hash}";
|
|
676
680
|
function T(s, t) {
|
|
677
681
|
var e = new RegExp(Object.keys(t).join("|"), "gi");
|
|
678
682
|
return s.replace(e, function(i) {
|
|
@@ -992,30 +996,32 @@ let h = class extends U {
|
|
|
992
996
|
}
|
|
993
997
|
render() {
|
|
994
998
|
let s = null, t = null;
|
|
995
|
-
if (
|
|
999
|
+
if (this.host ? this.customerId ? this.hash ? t = T(Jt, {
|
|
996
1000
|
"{viewer}": "",
|
|
997
1001
|
"{host}": this.host,
|
|
998
1002
|
"{customer_id}": this.customerId,
|
|
999
1003
|
"{hash}": this.hash
|
|
1000
|
-
}) : this.sceneId ? t = T(
|
|
1004
|
+
}) : this.sceneId ? t = T(jt, {
|
|
1001
1005
|
"{viewer}": this.viewer === "360" ? "/360" : "",
|
|
1002
1006
|
"{host}": this.host,
|
|
1003
1007
|
"{customer_id}": this.customerId,
|
|
1004
1008
|
"{scene_id}": this.sceneId
|
|
1005
|
-
}) : this.sku ? t = T(
|
|
1009
|
+
}) : this.sku ? t = T(Bt, {
|
|
1006
1010
|
"{viewer}": this.viewer === "360" ? "/360" : "",
|
|
1007
1011
|
"{host}": this.host,
|
|
1008
1012
|
"{customer_id}": this.customerId,
|
|
1009
1013
|
"{sku}": this.sku
|
|
1010
|
-
}) : this.productId ? t = T(
|
|
1014
|
+
}) : this.productId ? t = T(zt, {
|
|
1011
1015
|
"{viewer}": this.viewer === "360" ? "/360" : "",
|
|
1012
1016
|
"{host}": this.host,
|
|
1013
1017
|
"{customer_id}": this.customerId,
|
|
1014
1018
|
"{product_id}": this.productId
|
|
1015
1019
|
}) : s = "Missing property: sku, scene-id, or hash" : s = "Missing property: customer-id" : s = "Missing property: host", s)
|
|
1016
1020
|
return st`<div>${s}</div>`;
|
|
1017
|
-
|
|
1018
|
-
|
|
1021
|
+
const e = It(this);
|
|
1022
|
+
for (const [i, r] of Object.entries(this.defaultSelection))
|
|
1023
|
+
r && e.append(i, r);
|
|
1024
|
+
return e.size && (t += "?" + e), st`<iframe
|
|
1019
1025
|
src="${t}"
|
|
1020
1026
|
width="100%"
|
|
1021
1027
|
height="100%"
|
|
@@ -1060,6 +1066,9 @@ l([
|
|
|
1060
1066
|
l([
|
|
1061
1067
|
p({ type: String })
|
|
1062
1068
|
], h.prototype, "host", 2);
|
|
1069
|
+
l([
|
|
1070
|
+
p({ type: String })
|
|
1071
|
+
], h.prototype, "token", 2);
|
|
1063
1072
|
l([
|
|
1064
1073
|
p({ type: String, attribute: "allow-partial-match" })
|
|
1065
1074
|
], h.prototype, "allowPartialMatch", 2);
|