xactsize-webcomponents 1.0.29 → 1.0.30
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/body-measurer.d.ts +3 -0
- package/dist/body-measurer.es.js +359 -241
- package/dist/body-measurer.umd.js +154 -47
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(S,H){typeof exports=="object"&&typeof module<"u"?H(exports):typeof define=="function"&&define.amd?define(["exports"],H):(S=typeof globalThis<"u"?globalThis:S||self,H(S.BodyMeasurer={}))})(this,function(S){"use strict";var wA;const H=(r,A,t)=>{const l=r[A];return l?typeof l=="function"?l():Promise.resolve(l):new Promise((e,p)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(p.bind(null,new Error("Unknown variable dynamic import: "+A+(A.split("/").length!==t?". Note that variables only represent file names one level deep.":""))))})};/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:DA,defineProperty:QA,getOwnPropertyDescriptor:gA,getOwnPropertyNames:BA,getOwnPropertySymbols:_A,getPrototypeOf:$A}=Object,x=globalThis,KA=x.trustedTypes,At=KA?KA.emptyScript:"",nA=x.reactiveElementPolyfillSupport,z=(r,A)=>r,B={toAttribute(r,A){switch(A){case Boolean:r=r?At:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,A){let t=r;switch(A){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},VA=(r,A)=>!DA(r,A),UA={attribute:!0,type:String,converter:B,reflect:!1,useDefault:!1,hasChanged:VA};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),x.litPropertyMetadata??(x.litPropertyMetadata=new WeakMap);let N=class extends HTMLElement{static addInitializer(A){this._$Ei(),(this.l??(this.l=[])).push(A)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(A,t=UA){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(A)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(A,t),!t.noAccessor){const l=Symbol(),e=this.getPropertyDescriptor(A,l,t);e!==void 0&&QA(this.prototype,A,e)}}static getPropertyDescriptor(A,t,l){const{get:e,set:p}=gA(this.prototype,A)??{get(){return this[t]},set(n){this[t]=n}};return{get:e,set(n){const
|
|
9
|
+
*/const{is:DA,defineProperty:QA,getOwnPropertyDescriptor:gA,getOwnPropertyNames:BA,getOwnPropertySymbols:_A,getPrototypeOf:$A}=Object,x=globalThis,KA=x.trustedTypes,At=KA?KA.emptyScript:"",nA=x.reactiveElementPolyfillSupport,z=(r,A)=>r,B={toAttribute(r,A){switch(A){case Boolean:r=r?At:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,A){let t=r;switch(A){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},VA=(r,A)=>!DA(r,A),UA={attribute:!0,type:String,converter:B,reflect:!1,useDefault:!1,hasChanged:VA};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),x.litPropertyMetadata??(x.litPropertyMetadata=new WeakMap);let N=class extends HTMLElement{static addInitializer(A){this._$Ei(),(this.l??(this.l=[])).push(A)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(A,t=UA){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(A)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(A,t),!t.noAccessor){const l=Symbol(),e=this.getPropertyDescriptor(A,l,t);e!==void 0&&QA(this.prototype,A,e)}}static getPropertyDescriptor(A,t,l){const{get:e,set:p}=gA(this.prototype,A)??{get(){return this[t]},set(n){this[t]=n}};return{get:e,set(n){const a=e==null?void 0:e.call(this);p==null||p.call(this,n),this.requestUpdate(A,a,l)},configurable:!0,enumerable:!0}}static getPropertyOptions(A){return this.elementProperties.get(A)??UA}static _$Ei(){if(this.hasOwnProperty(z("elementProperties")))return;const A=$A(this);A.finalize(),A.l!==void 0&&(this.l=[...A.l]),this.elementProperties=new Map(A.elementProperties)}static finalize(){if(this.hasOwnProperty(z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(z("properties"))){const t=this.properties,l=[...BA(t),..._A(t)];for(const e of l)this.createProperty(e,t[e])}const A=this[Symbol.metadata];if(A!==null){const t=litPropertyMetadata.get(A);if(t!==void 0)for(const[l,e]of t)this.elementProperties.set(l,e)}this._$Eh=new Map;for(const[t,l]of this.elementProperties){const e=this._$Eu(t,l);e!==void 0&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(A){const t=[];if(Array.isArray(A)){const l=new Set(A.flat(1/0).reverse());for(const e of l)t.unshift(xA(e))}else A!==void 0&&t.push(xA(A));return t}static _$Eu(A,t){const l=t.attribute;return l===!1?void 0:typeof l=="string"?l:typeof A=="string"?A.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var A;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(A=this.constructor.l)==null||A.forEach(t=>t(this))}addController(A){var t;(this._$EO??(this._$EO=new Set)).add(A),this.renderRoot!==void 0&&this.isConnected&&((t=A.hostConnected)==null||t.call(A))}removeController(A){var t;(t=this._$EO)==null||t.delete(A)}_$E_(){const A=new Map,t=this.constructor.elementProperties;for(const l of t.keys())this.hasOwnProperty(l)&&(A.set(l,this[l]),delete this[l]);A.size>0&&(this._$Ep=A)}createRenderRoot(){const A=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return CA(A,this.constructor.elementStyles),A}connectedCallback(){var A;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(A=this._$EO)==null||A.forEach(t=>{var l;return(l=t.hostConnected)==null?void 0:l.call(t)})}enableUpdating(A){}disconnectedCallback(){var A;(A=this._$EO)==null||A.forEach(t=>{var l;return(l=t.hostDisconnected)==null?void 0:l.call(t)})}attributeChangedCallback(A,t,l){this._$AK(A,l)}_$ET(A,t){var p;const l=this.constructor.elementProperties.get(A),e=this.constructor._$Eu(A,l);if(e!==void 0&&l.reflect===!0){const n=(((p=l.converter)==null?void 0:p.toAttribute)!==void 0?l.converter:B).toAttribute(t,l.type);this._$Em=A,n==null?this.removeAttribute(e):this.setAttribute(e,n),this._$Em=null}}_$AK(A,t){var p,n;const l=this.constructor,e=l._$Eh.get(A);if(e!==void 0&&this._$Em!==e){const a=l.getPropertyOptions(e),q=typeof a.converter=="function"?{fromAttribute:a.converter}:((p=a.converter)==null?void 0:p.fromAttribute)!==void 0?a.converter:B;this._$Em=e,this[e]=q.fromAttribute(t,a.type)??((n=this._$Ej)==null?void 0:n.get(e))??null,this._$Em=null}}requestUpdate(A,t,l){var e;if(A!==void 0){const p=this.constructor,n=this[A];if(l??(l=p.getPropertyOptions(A)),!((l.hasChanged??VA)(n,t)||l.useDefault&&l.reflect&&n===((e=this._$Ej)==null?void 0:e.get(A))&&!this.hasAttribute(p._$Eu(A,l))))return;this.C(A,t,l)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(A,t,{useDefault:l,reflect:e,wrapped:p},n){l&&!(this._$Ej??(this._$Ej=new Map)).has(A)&&(this._$Ej.set(A,n??t??this[A]),p!==!0||n!==void 0)||(this._$AL.has(A)||(this.hasUpdated||l||(t=void 0),this._$AL.set(A,t)),e===!0&&this._$Em!==A&&(this._$Eq??(this._$Eq=new Set)).add(A))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const A=this.scheduleUpdate();return A!=null&&await A,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var l;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[p,n]of this._$Ep)this[p]=n;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[p,n]of e){const{wrapped:a}=n,q=this[p];a!==!0||this._$AL.has(p)||q===void 0||this.C(p,void 0,n,q)}}let A=!1;const t=this._$AL;try{A=this.shouldUpdate(t),A?(this.willUpdate(t),(l=this._$EO)==null||l.forEach(e=>{var p;return(p=e.hostUpdate)==null?void 0:p.call(e)}),this.update(t)):this._$EM()}catch(e){throw A=!1,this._$EM(),e}A&&this._$AE(t)}willUpdate(A){}_$AE(A){var t;(t=this._$EO)==null||t.forEach(l=>{var e;return(e=l.hostUpdated)==null?void 0:e.call(l)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(A)),this.updated(A)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(A){return!0}update(A){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(A){}firstUpdated(A){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[z("elementProperties")]=new Map,N[z("finalized")]=new Map,nA==null||nA({ReactiveElement:N}),(x.reactiveElementVersions??(x.reactiveElementVersions=[])).push("2.1.0");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const G=globalThis,_=G.trustedTypes,vA=_?_.createPolicy("lit-html",{createHTML:r=>r}):void 0,OA="$lit$",K=`lit$${Math.random().toFixed(9).slice(2)}$`,WA="?"+K,tt=`<${WA}>`,v=document,F=()=>v.createComment(""),M=r=>r===null||typeof r!="object"&&typeof r!="function",qA=Array.isArray,lt=r=>qA(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",
|
|
14
|
-
\f\r]`,h=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bA=/-->/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const G=globalThis,_=G.trustedTypes,vA=_?_.createPolicy("lit-html",{createHTML:r=>r}):void 0,OA="$lit$",K=`lit$${Math.random().toFixed(9).slice(2)}$`,WA="?"+K,tt=`<${WA}>`,v=document,F=()=>v.createComment(""),M=r=>r===null||typeof r!="object"&&typeof r!="function",qA=Array.isArray,lt=r=>qA(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",aA=`[
|
|
14
|
+
\f\r]`,h=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bA=/-->/g,oA=/>/g,O=RegExp(`>|${aA}(?:([^\\s"'>=/]+)(${aA}*=${aA}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),fA=/'/g,LA=/"/g,PA=/^(?:script|style|textarea|title)$/i,et=r=>(A,...t)=>({_$litType$:r,strings:A,values:t}),k=et(1),W=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),mA=new WeakMap,b=v.createTreeWalker(v,129);function NA(r,A){if(!qA(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return vA!==void 0?vA.createHTML(A):A}const rt=(r,A)=>{const t=r.length-1,l=[];let e,p=A===2?"<svg>":A===3?"<math>":"",n=h;for(let a=0;a<t;a++){const q=r[a];let y,T,d=-1,i=0;for(;i<q.length&&(n.lastIndex=i,T=n.exec(q),T!==null);)i=n.lastIndex,n===h?T[1]==="!--"?n=bA:T[1]!==void 0?n=oA:T[2]!==void 0?(PA.test(T[2])&&(e=RegExp("</"+T[2],"g")),n=O):T[3]!==void 0&&(n=O):n===O?T[0]===">"?(n=e??h,d=-1):T[1]===void 0?d=-2:(d=n.lastIndex-T[2].length,y=T[1],n=T[3]===void 0?O:T[3]==='"'?LA:fA):n===LA||n===fA?n=O:n===bA||n===oA?n=h:(n=O,e=void 0);const U=n===O&&r[a+1].startsWith("/>")?" ":"";p+=n===h?q+tt:d>=0?(l.push(y),q.slice(0,d)+OA+q.slice(d)+K+U):q+K+(d===-2?a:U)}return[NA(r,p+(r[t]||"<?>")+(A===2?"</svg>":A===3?"</math>":"")),l]};class E{constructor({strings:A,_$litType$:t},l){let e;this.parts=[];let p=0,n=0;const a=A.length-1,q=this.parts,[y,T]=rt(A,t);if(this.el=E.createElement(y,l),b.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(e=b.nextNode())!==null&&q.length<a;){if(e.nodeType===1){if(e.hasAttributes())for(const d of e.getAttributeNames())if(d.endsWith(OA)){const i=T[n++],U=e.getAttribute(d).split(K),eA=/([.?@])?(.*)/.exec(i);q.push({type:1,index:p,name:eA[2],strings:U,ctor:eA[1]==="."?nt:eA[1]==="?"?Vt:eA[1]==="@"?qt:$}),e.removeAttribute(d)}else d.startsWith(K)&&(q.push({type:6,index:p}),e.removeAttribute(d));if(PA.test(e.tagName)){const d=e.textContent.split(K),i=d.length-1;if(i>0){e.textContent=_?_.emptyScript:"";for(let U=0;U<i;U++)e.append(d[U],F()),b.nextNode(),q.push({type:2,index:++p});e.append(d[i],F())}}}else if(e.nodeType===8)if(e.data===WA)q.push({type:2,index:p});else{let d=-1;for(;(d=e.data.indexOf(K,d+1))!==-1;)q.push({type:7,index:p}),d+=K.length-1}p++}}static createElement(A,t){const l=v.createElement("template");return l.innerHTML=A,l}}function Z(r,A,t=r,l){var n,a;if(A===W)return A;let e=l!==void 0?(n=t._$Co)==null?void 0:n[l]:t._$Cl;const p=M(A)?void 0:A._$litDirective$;return(e==null?void 0:e.constructor)!==p&&((a=e==null?void 0:e._$AO)==null||a.call(e,!1),p===void 0?e=void 0:(e=new p(r),e._$AT(r,t,l)),l!==void 0?(t._$Co??(t._$Co=[]))[l]=e:t._$Cl=e),e!==void 0&&(A=Z(r,e._$AS(r,A.values),e,l)),A}class pt{constructor(A,t){this._$AV=[],this._$AN=void 0,this._$AD=A,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(A){const{el:{content:t},parts:l}=this._$AD,e=((A==null?void 0:A.creationScope)??v).importNode(t,!0);b.currentNode=e;let p=b.nextNode(),n=0,a=0,q=l[0];for(;q!==void 0;){if(n===q.index){let y;q.type===2?y=new I(p,p.nextSibling,this,A):q.type===1?y=new q.ctor(p,q.name,q.strings,this,A):q.type===6&&(y=new at(p,this,A)),this._$AV.push(y),q=l[++a]}n!==(q==null?void 0:q.index)&&(p=b.nextNode(),n++)}return b.currentNode=v,e}p(A){let t=0;for(const l of this._$AV)l!==void 0&&(l.strings!==void 0?(l._$AI(A,l,t),t+=l.strings.length-2):l._$AI(A[t])),t++}}class I{get _$AU(){var A;return((A=this._$AM)==null?void 0:A._$AU)??this._$Cv}constructor(A,t,l,e){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=A,this._$AB=t,this._$AM=l,this.options=e,this._$Cv=(e==null?void 0:e.isConnected)??!0}get parentNode(){let A=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(A==null?void 0:A.nodeType)===11&&(A=t.parentNode),A}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(A,t=this){A=Z(this,A,t),M(A)?A===j||A==null||A===""?(this._$AH!==j&&this._$AR(),this._$AH=j):A!==this._$AH&&A!==W&&this._(A):A._$litType$!==void 0?this.$(A):A.nodeType!==void 0?this.T(A):lt(A)?this.k(A):this._(A)}O(A){return this._$AA.parentNode.insertBefore(A,this._$AB)}T(A){this._$AH!==A&&(this._$AR(),this._$AH=this.O(A))}_(A){this._$AH!==j&&M(this._$AH)?this._$AA.nextSibling.data=A:this.T(v.createTextNode(A)),this._$AH=A}$(A){var p;const{values:t,_$litType$:l}=A,e=typeof l=="number"?this._$AC(A):(l.el===void 0&&(l.el=E.createElement(NA(l.h,l.h[0]),this.options)),l);if(((p=this._$AH)==null?void 0:p._$AD)===e)this._$AH.p(t);else{const n=new pt(e,this),a=n.u(this.options);n.p(t),this.T(a),this._$AH=n}}_$AC(A){let t=mA.get(A.strings);return t===void 0&&mA.set(A.strings,t=new E(A)),t}k(A){qA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let l,e=0;for(const p of A)e===t.length?t.push(l=new I(this.O(F()),this.O(F()),this,this.options)):l=t[e],l._$AI(p),e++;e<t.length&&(this._$AR(l&&l._$AB.nextSibling,e),t.length=e)}_$AR(A=this._$AA.nextSibling,t){var l;for((l=this._$AP)==null?void 0:l.call(this,!1,!0,t);A&&A!==this._$AB;){const e=A.nextSibling;A.remove(),A=e}}setConnected(A){var t;this._$AM===void 0&&(this._$Cv=A,(t=this._$AP)==null||t.call(this,A))}}class ${get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(A,t,l,e,p){this.type=1,this._$AH=j,this._$AN=void 0,this.element=A,this.name=t,this._$AM=e,this.options=p,l.length>2||l[0]!==""||l[1]!==""?(this._$AH=Array(l.length-1).fill(new String),this.strings=l):this._$AH=j}_$AI(A,t=this,l,e){const p=this.strings;let n=!1;if(p===void 0)A=Z(this,A,t,0),n=!M(A)||A!==this._$AH&&A!==W,n&&(this._$AH=A);else{const a=A;let q,y;for(A=p[0],q=0;q<p.length-1;q++)y=Z(this,a[l+q],t,q),y===W&&(y=this._$AH[q]),n||(n=!M(y)||y!==this._$AH[q]),y===j?A=j:A!==j&&(A+=(y??"")+p[q+1]),this._$AH[q]=y}n&&!e&&this.j(A)}j(A){A===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,A??"")}}class nt extends ${constructor(){super(...arguments),this.type=3}j(A){this.element[this.name]=A===j?void 0:A}}class Vt extends ${constructor(){super(...arguments),this.type=4}j(A){this.element.toggleAttribute(this.name,!!A&&A!==j)}}class qt extends ${constructor(A,t,l,e,p){super(A,t,l,e,p),this.type=5}_$AI(A,t=this){if((A=Z(this,A,t,0)??j)===W)return;const l=this._$AH,e=A===j&&l!==j||A.capture!==l.capture||A.once!==l.once||A.passive!==l.passive,p=A!==j&&(l===j||e);e&&this.element.removeEventListener(this.name,this,l),p&&this.element.addEventListener(this.name,this,A),this._$AH=A}handleEvent(A){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,A):this._$AH.handleEvent(A)}}class at{constructor(A,t,l){this.element=A,this.type=6,this._$AN=void 0,this._$AM=t,this.options=l}get _$AU(){return this._$AM._$AU}_$AI(A){Z(this,A)}}const SA=G.litHtmlPolyfillSupport;SA==null||SA(E,I),(G.litHtmlVersions??(G.litHtmlVersions=[])).push("3.3.0");const St=(r,A,t)=>{const l=(t==null?void 0:t.renderBefore)??A;let e=l._$litPart$;if(e===void 0){const p=(t==null?void 0:t.renderBefore)??null;l._$litPart$=e=new I(A.insertBefore(F(),p),p,void 0,t??{})}return e._$AI(r),e};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const
|
|
19
|
+
*/const o=globalThis;let X=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const A=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=A.firstChild),A}update(A){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(A),this._$Do=St(t,this.renderRoot,this.renderOptions)}connectedCallback(){var A;super.connectedCallback(),(A=this._$Do)==null||A.setConnected(!0)}disconnectedCallback(){var A;super.disconnectedCallback(),(A=this._$Do)==null||A.setConnected(!1)}render(){return W}};X._$litElement$=!0,X.finalized=!0,(wA=o.litElementHydrateSupport)==null||wA.call(o,{LitElement:X});const dA=o.litElementPolyfillSupport;dA==null||dA({LitElement:X}),(o.litElementVersions??(o.litElementVersions=[])).push("4.2.0");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const dt={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:VA},ut=(r=dt,A,t)=>{const{kind:l,metadata:e}=t;let p=globalThis.litPropertyMetadata.get(e);if(p===void 0&&globalThis.litPropertyMetadata.set(e,p=new Map),l==="setter"&&((r=Object.create(r)).wrapped=!0),p.set(t.name,r),l==="accessor"){const{name:n}=t;return{set(
|
|
27
|
+
*/const dt={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:VA},ut=(r=dt,A,t)=>{const{kind:l,metadata:e}=t;let p=globalThis.litPropertyMetadata.get(e);if(p===void 0&&globalThis.litPropertyMetadata.set(e,p=new Map),l==="setter"&&((r=Object.create(r)).wrapped=!0),p.set(t.name,r),l==="accessor"){const{name:n}=t;return{set(a){const q=A.get.call(this);A.set.call(this,a),this.requestUpdate(n,q,r)},init(a){return a!==void 0&&this.C(n,void 0,r,a),a}}}if(l==="setter"){const{name:n}=t;return function(a){const q=this[n];A.call(this,a),this.requestUpdate(n,q,r)}}throw Error("Unsupported decorator location: "+l)};function c(r){return(A,t)=>typeof t=="object"?ut(r,A,t):((l,e,p)=>{const n=e.hasOwnProperty(p);return e.constructor.createProperty(p,l),n?Object.getOwnPropertyDescriptor(e,p):void 0})(r,A,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function
|
|
31
|
+
*/function J(r){return c({...r,state:!0,attribute:!1})}/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2021 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2021 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
-
*/class jt{constructor(A){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=A}hostConnected(){window.addEventListener(uA,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(uA,this.__litLocalizeEventHandler)}}const
|
|
47
|
+
*/class jt{constructor(A){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=A}hostConnected(){window.addEventListener(uA,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(uA,this.__litLocalizeEventHandler)}}const kt=r=>r.addController(new jt(r));/**
|
|
48
48
|
* @license
|
|
49
49
|
* Copyright 2021 Google LLC
|
|
50
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
|
-
*/const w=()=>(r,A)=>(r.addInitializer(
|
|
51
|
+
*/const w=()=>(r,A)=>(r.addInitializer(kt),r);/**
|
|
52
52
|
* @license
|
|
53
53
|
* Copyright 2020 Google LLC
|
|
54
54
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2014 Travis Webb
|
|
58
58
|
* SPDX-License-Identifier: MIT
|
|
59
|
-
*/const s=[];for(let r=0;r<256;r++)s[r]=(r>>4&15).toString(16)+(r&15).toString(16);function
|
|
59
|
+
*/const s=[];for(let r=0;r<256;r++)s[r]=(r>>4&15).toString(16)+(r&15).toString(16);function Tt(r){let A=0,t=8997,l=0,e=33826,p=0,n=40164,a=0,q=52210;for(let y=0;y<r.length;y++)t^=r.charCodeAt(y),A=t*435,l=e*435,p=n*435,a=q*435,p+=t<<8,a+=e<<8,l+=A>>>16,t=A&65535,p+=l>>>16,e=l&65535,q=a+(p>>>16)&65535,n=p&65535;return s[q>>8]+s[q&255]+s[n>>8]+s[n&255]+s[e>>8]+s[e&255]+s[t>>8]+s[t&255]}/**
|
|
60
60
|
* @license
|
|
61
61
|
* Copyright 2020 Google LLC
|
|
62
62
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
63
|
-
*/const Jt="",Xt="h",st="s";function it(r,A){return(A?Xt:st)+
|
|
63
|
+
*/const Jt="",Xt="h",st="s";function it(r,A){return(A?Xt:st)+Tt(typeof r=="string"?r:r.join(Jt))}/**
|
|
64
64
|
* @license
|
|
65
65
|
* Copyright 2021 Google LLC
|
|
66
66
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
* @license
|
|
69
69
|
* Copyright 2021 Google LLC
|
|
70
70
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
71
|
-
*/function yA(r){window.dispatchEvent(new CustomEvent(uA,{detail:r}))}let AA="",cA,MA,tA,jA,hA,
|
|
71
|
+
*/function yA(r){window.dispatchEvent(new CustomEvent(uA,{detail:r}))}let AA="",cA,MA,tA,jA,hA,f=new zA;f.resolve();let lA=0;const Ut=r=>(ct((A,t)=>xt(hA,A,t)),AA=MA=r.sourceLocale,tA=new Set(r.targetLocales),tA.add(r.sourceLocale),jA=r.loadLocale,{getLocale:vt,setLocale:Ot}),vt=()=>AA,Ot=r=>{if(r===(cA??AA))return f.promise;if(!tA||!jA)throw new Error("Internal error");if(!tA.has(r))throw new Error("Invalid locale code");lA++;const A=lA;return cA=r,f.settled&&(f=new zA),yA({status:"loading",loadingLocale:r}),(r===MA?Promise.resolve({templates:void 0}):jA(r)).then(l=>{lA===A&&(AA=r,cA=void 0,hA=l.templates,yA({status:"ready",readyLocale:r}),f.resolve())},l=>{lA===A&&(yA({status:"error",errorLocale:r,errorMessage:l.toString()}),f.reject(l))}),f.promise},EA="en",Wt=["pt-BR"];/**
|
|
72
72
|
* @license
|
|
73
73
|
* Copyright 2017 Google LLC
|
|
74
74
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
75
|
-
*/const bt={ATTRIBUTE:1},
|
|
75
|
+
*/const bt={ATTRIBUTE:1},ot=r=>(...A)=>({_$litDirective$:r,values:A});class ft{constructor(A){}get _$AU(){return this._$AM._$AU}_$AT(A,t,l){this._$Ct=A,this._$AM=t,this._$Ci=l}_$AS(A,t){return this.update(A,t)}update(A,t){return this.render(...t)}}/**
|
|
76
76
|
* @license
|
|
77
77
|
* Copyright 2018 Google LLC
|
|
78
78
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
79
|
-
*/const
|
|
79
|
+
*/const Lt=ot(class extends ft{constructor(r){var A;if(super(r),r.type!==bt.ATTRIBUTE||r.name!=="class"||((A=r.strings)==null?void 0:A.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(A=>r[A]).join(" ")+" "}update(r,[A]){var l,e;if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(p=>p!=="")));for(const p in A)A[p]&&!((l=this.nt)!=null&&l.has(p))&&this.st.add(p);return this.render(A)}const t=r.element.classList;for(const p of this.st)p in A||(t.remove(p),this.st.delete(p));for(const p in A){const n=!!A[p];n===this.st.has(p)||(e=this.nt)!=null&&e.has(p)||(n?(t.add(p),this.st.add(p)):(t.remove(p),this.st.delete(p)))}return W}});var Pt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,Y=(r,A,t,l)=>{for(var e=l>1?void 0:l?mt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&Pt(A,t,e),e};let L=class extends X{constructor(){super(...arguments),this.type="button",this.label="",this.disabled=!1,this.variant="contained"}render(){return k`
|
|
80
80
|
<div class="button-wrapper">
|
|
81
81
|
<button
|
|
82
82
|
class=${this.variant}
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
${this.label}
|
|
88
88
|
</button>
|
|
89
89
|
</div>
|
|
90
|
-
`}};
|
|
90
|
+
`}};L.styles=m`
|
|
91
91
|
:host {
|
|
92
92
|
display: block;
|
|
93
93
|
width: 100%;
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
button {
|
|
110
110
|
width: 100%;
|
|
111
111
|
padding: 14px 28px;
|
|
112
|
-
border-radius:
|
|
112
|
+
border-radius: 12px;
|
|
113
113
|
font-size: 15px;
|
|
114
114
|
font-weight: 600;
|
|
115
115
|
font-family: "Lato", sans-serif;
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
button.contained:hover {
|
|
136
|
-
background-color: #
|
|
136
|
+
background-color: #333333; /* gris oscuro */
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/* Outlined */
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
`,Y([c({type:String})],
|
|
170
|
+
`,Y([c({type:String})],L.prototype,"type",2),Y([c({type:String})],L.prototype,"label",2),Y([c({type:Boolean})],L.prototype,"disabled",2),Y([c({type:String})],L.prototype,"variant",2),L=Y([R("xact-button")],L);var Nt=Object.defineProperty,Zt=Object.getOwnPropertyDescriptor,kA=(r,A,t,l)=>{for(var e=l>1?void 0:l?Zt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&Nt(A,t,e),e};let C=class extends X{constructor(){super(...arguments),this.height=0,this.handleStart=()=>{var A;const r=this.shadowRoot.querySelector("#height-input");if(r!=null&&r.value){const t=parseInt(r.value);this.height=t,(A=this.onStartMeasurement)==null||A.call(this,t)}}}render(){return k`
|
|
171
171
|
<div class="card">
|
|
172
172
|
<div class="pill">XactSize x Canada Goose</div>
|
|
173
173
|
<h2 class="title">${V("Let's find your perfect size")}</h2>
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
${V("By using Xactsize, you agree to our Terms and Privacy Policy.")}
|
|
208
208
|
</p>
|
|
209
209
|
</div>
|
|
210
|
-
`}renderTip(r,A){return
|
|
210
|
+
`}renderTip(r,A){return k`
|
|
211
211
|
<div class="tip">
|
|
212
212
|
<span class="check">
|
|
213
213
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
@@ -283,32 +283,58 @@
|
|
|
283
283
|
|
|
284
284
|
.tip {
|
|
285
285
|
display: flex;
|
|
286
|
-
gap:
|
|
287
|
-
align-items:
|
|
286
|
+
gap: 12px;
|
|
287
|
+
align-items: center;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
|
|
291
291
|
.check {
|
|
292
|
-
width:
|
|
293
|
-
height:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
display: inline-flex;
|
|
292
|
+
width: 16px;
|
|
293
|
+
height: 16px;
|
|
294
|
+
flex-shrink: 0;
|
|
295
|
+
display: flex;
|
|
297
296
|
align-items: center;
|
|
298
297
|
justify-content: center;
|
|
299
|
-
|
|
298
|
+
animation: checkAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
|
|
300
299
|
}
|
|
301
300
|
|
|
302
301
|
.check svg {
|
|
303
|
-
width:
|
|
304
|
-
height:
|
|
305
|
-
stroke: #
|
|
302
|
+
width: 16px;
|
|
303
|
+
height: 16px;
|
|
304
|
+
stroke: #000;
|
|
306
305
|
stroke-width: 2.5;
|
|
307
306
|
fill: none;
|
|
308
307
|
stroke-linecap: round;
|
|
309
308
|
stroke-linejoin: round;
|
|
310
309
|
}
|
|
311
310
|
|
|
311
|
+
.tip:nth-child(2) .check {
|
|
312
|
+
animation-delay: 0.1s;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.tip:nth-child(3) .check {
|
|
316
|
+
animation-delay: 0.2s;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.tip:nth-child(4) .check {
|
|
320
|
+
animation-delay: 0.3s;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.tip:nth-child(5) .check {
|
|
324
|
+
animation-delay: 0.4s;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
@keyframes checkAppear {
|
|
328
|
+
0% {
|
|
329
|
+
transform: scale(0);
|
|
330
|
+
opacity: 0;
|
|
331
|
+
}
|
|
332
|
+
100% {
|
|
333
|
+
transform: scale(1);
|
|
334
|
+
opacity: 1;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
312
338
|
.tip strong {
|
|
313
339
|
display: block;
|
|
314
340
|
font-size: 14px;
|
|
@@ -368,7 +394,7 @@
|
|
|
368
394
|
grid-template-columns: 1fr;
|
|
369
395
|
}
|
|
370
396
|
}
|
|
371
|
-
`,
|
|
397
|
+
`,kA([c({type:Number})],C.prototype,"height",2),kA([c({type:Function})],C.prototype,"onStartMeasurement",2),C=kA([R("xact-step-one"),w()],C);var Rt=Object.getOwnPropertyDescriptor,Ht=(r,A,t,l)=>{for(var e=l>1?void 0:l?Rt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=n(e)||e);return e};let TA=class extends X{render(){return k`
|
|
372
398
|
<footer class="modal-footer">
|
|
373
399
|
<span>
|
|
374
400
|
<span class="powered-by">${V("Powered by")}</span>
|
|
@@ -411,7 +437,7 @@
|
|
|
411
437
|
</a>
|
|
412
438
|
</span>
|
|
413
439
|
</footer>
|
|
414
|
-
`}};
|
|
440
|
+
`}};TA.styles=m`
|
|
415
441
|
.modal-footer {
|
|
416
442
|
text-align: center;
|
|
417
443
|
font-size: 12px;
|
|
@@ -447,7 +473,7 @@
|
|
|
447
473
|
outline: 2px solid var(--brand-primary);
|
|
448
474
|
outline-offset: 2px;
|
|
449
475
|
}
|
|
450
|
-
`,
|
|
476
|
+
`,TA=Ht([R("xact-footer"),w()],TA);var zt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,D=(r,A,t,l)=>{for(var e=l>1?void 0:l?Gt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&zt(A,t,e),e};let P=class extends X{constructor(){super(...arguments),this.productName="",this.recommendedSize=""}render(){return k`
|
|
451
477
|
<div class="image-container">
|
|
452
478
|
<!-- Imagem da roupa como SVG exportado -->
|
|
453
479
|
<svg class="product-image" width="180" height="240" viewBox="0 0 180 240" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -577,7 +603,7 @@
|
|
|
577
603
|
justify-content: center;
|
|
578
604
|
}
|
|
579
605
|
}
|
|
580
|
-
`,D([c({type:String})],P.prototype,"productName",2),D([c({type:String})],P.prototype,"recommendedSize",2),D([c({type:Function})],P.prototype,"onAccept",2),D([c({type:Function})],P.prototype,"onRetry",2),P=D([R("xact-step-result"),w()],P);var Ft=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,JA=(r,A,t,l)=>{for(var e=l>1?void 0:l?Mt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&Ft(A,t,e),e};let Q=class extends X{constructor(){super(...arguments),this.height=0}render(){const r=Array.from({length:24},(A,t)=>t);return
|
|
606
|
+
`,D([c({type:String})],P.prototype,"productName",2),D([c({type:String})],P.prototype,"recommendedSize",2),D([c({type:Function})],P.prototype,"onAccept",2),D([c({type:Function})],P.prototype,"onRetry",2),P=D([R("xact-step-result"),w()],P);var Ft=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,JA=(r,A,t,l)=>{for(var e=l>1?void 0:l?Mt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&Ft(A,t,e),e};let Q=class extends X{constructor(){super(...arguments),this.height=0}render(){const r=Array.from({length:24},(A,t)=>t);return k`
|
|
581
607
|
<div class="component-content">
|
|
582
608
|
<div class="header-section">
|
|
583
609
|
<h2 class="header-text">${V("Before you begin")}</h2>
|
|
@@ -716,7 +742,7 @@
|
|
|
716
742
|
></xact-button>
|
|
717
743
|
</div>
|
|
718
744
|
<div class="snow-layer">
|
|
719
|
-
${r.map(A=>{const t=A*37%100,l=A%6*.35,e=A%5*.4;return
|
|
745
|
+
${r.map(A=>{const t=A*37%100,l=A%6*.35,e=A%5*.4;return k`<span
|
|
720
746
|
class="snowflake"
|
|
721
747
|
style="left:${t}%; animation-delay:${l}s, ${e}s;"
|
|
722
748
|
></span>`})}
|
|
@@ -912,7 +938,7 @@
|
|
|
912
938
|
50% { transform: translateX(22px); }
|
|
913
939
|
}
|
|
914
940
|
|
|
915
|
-
`,JA([c({type:Number})],Q.prototype,"height",2),JA([c({type:Function})],Q.prototype,"onStep2advancement",2),Q=JA([R("xact-step-informs"),w()],Q);const IA="data:image/svg+xml,%3csvg%20width='22'%20height='40'%20viewBox='0%200%2022%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200L0%2013.3362V0H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.339L0%2026.6724V13.3362H21.517V13.339Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.6755L0%2040.0089V26.6726H21.517V26.6755Z'%20fill='%231C28BA'/%3e%3c/svg%3e",ht="data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.00878906L0%2013.345V0.00878906H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.3478L0%2026.6812V13.345H21.517V13.3478Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2026.6843L0%2040.0176V26.6814H21.517V26.6843Z'%20fill='white'/%3e%3c/svg%3e",Et="data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.0204381L0%2013.3538V0.0175781H21.517V0.0204381Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2013.3538L0%2026.69V13.3538H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.693L0%2040.0264V26.6902H21.517V26.693Z'%20fill='white'/%3e%3c/svg%3e";var It=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,u=(r,A,t,l)=>{for(var e=l>1?void 0:l?wt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&It(A,t,e),e};const{getLocale:Yt,setLocale:XA}=Ut({sourceLocale:EA,targetLocales:Wt,loadLocale:r=>H(Object.assign({"./generated/locales/pt-BR.ts":()=>Promise.resolve().then(()=>Ct)}),`./generated/locales/${r}.ts`,4)});a.BodyMeasurer=class extends X{constructor(){super(...arguments),this.spinnerFrame=0,this.apiKey="DB8mP9gStPfvdyeYbbuCV4Zf3SH745dI",this.tenantId="1",this.productSku="123456",this.apiUrl="https://xactsize-dotnet-api-923169850574.southamerica-east1.run.app/api/measurer/measure/body",this._culture="pt-BR",this.measurerKey="",this._isLocaleLoading=!1,this.showModal=!1,this.step=1,this.height=0,this.recommendedSize="",this.measurements={},this.errorMessage="",this.instructionMessage=V("Position yourself in front of the camera"),this.shouldStartMeasurement=!1,this.isLoading=!1,this.isFetching=!1,this.videoElement=null,this.stream=null,this.poolingTimeout=null,this.instructionMessageTimeout=null,this.cameras=[],this.currentCameraId=null}firstUpdated(){this.startSpinnerAnimation()}startSpinnerAnimation(){const A=[Et,ht,IA];this.spinnerInterval=setInterval(()=>{var l;const t=(l=this.shadowRoot)==null?void 0:l.querySelector(".spinner");t&&(t.src=A[this.spinnerFrame],this.spinnerFrame=(this.spinnerFrame+1)%A.length)},300)}get culture(){return this._culture}set culture(A){const t=this._culture;this._culture=A,this.requestUpdate("culture",t),this._applyLocale(A).catch(console.error)}async _applyLocale(A){try{this._isLocaleLoading=!0,this.requestUpdate(),await XA(A)}catch(t){console.error("Failed to load locale",A,t),await XA(EA)}finally{this._isLocaleLoading=!1,this.requestUpdate()}}get errorMap(){return{ERR_RIGHT_ARM_TOO_HIGH:V("Lower your right arm",{id:"ERR_RIGHT_ARM_TOO_HIGH"}),ERR_LEFT_ARM_TOO_HIGH:V("Lower your left arm",{id:"ERR_LEFT_ARM_TOO_HIGH"}),ERR_ARMS_NOT_RAISED:V("Raise both arms to a 45-degree angle",{id:"ERR_ARMS_NOT_RAISED"}),ERR_RIGHT_ARM_NOT_RAISED:V("Raise your right arm to a 45-degree angle",{id:"ERR_RIGHT_ARM_NOT_RAISED"}),ERR_LEFT_ARM_NOT_RAISED:V("Raise your left arm to a 45-degree angle",{id:"ERR_LEFT_ARM_NOT_RAISED"}),ERR_BODY_LANDMARKS_NOT_DETECTED:V("Ensure your full body is visible in the camera",{id:"ERR_BODY_LANDMARKS_NOT_DETECTED"}),ERR_HIPS_NOT_VISIBLE:V("Adjust your position to show your hips",{id:"ERR_HIPS_NOT_VISIBLE"}),ERR_TOO_CLOSE_TO_CAMERA:V("Step back from the camera",{id:"ERR_TOO_CLOSE_TO_CAMERA"}),ERR_NOT_SIDE_VIEW:V("Turn to show your side profile",{id:"ERR_NOT_SIDE_VIEW"}),ERR_INVALID_CLOTHING_TYPE:V("This clothing type is not supported; please contact support",{id:"ERR_INVALID_CLOTHING_TYPE"}),ERR_UPPER_BODY_NOT_VISIBLE:V("Adjust your position to show your upper body",{id:"ERR_UPPER_BODY_NOT_VISIBLE"}),ERR_HEAD_TOO_CLOSE_TO_EDGE:V("Move your head away from the edge of the frame",{id:"ERR_HEAD_TOO_CLOSE_TO_EDGE"}),ERR_LOWER_BODY_NOT_VISIBLE:V("Adjust your position to show your lower body",{id:"ERR_LOWER_BODY_NOT_VISIBLE"}),ERR_FEET_TOO_CLOSE_TO_EDGE:V("Move your feet away from the edge of the frame",{id:"ERR_FEET_TOO_CLOSE_TO_EDGE"}),ERR_BODY_TOO_CLOSE_TO_EDGE:V("Move your body away from the edge of the frame",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE"}),ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_LEFT:V("Move to the left to center your body",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_LEFT"}),ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_RIGHT:V("Move to the right to center your body",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_RIGHT"}),ERR_SHOULDERS_NOT_VISIBLE:V("Adjust your position to show your shoulders",{id:"ERR_SHOULDERS_NOT_VISIBLE"}),ERR_HEIGHT_MEASUREMENT_FAILED:V("Stand straight and ensure your full body is visible",{id:"ERR_HEIGHT_MEASUREMENT_FAILED"}),ERR_HEAD_POINT_NOT_DETECTED:V("Ensure your head is fully visible in the frame",{id:"ERR_HEAD_POINT_NOT_DETECTED"}),ERR_INCORRECT_POSTURE:V("Stand straight with your shoulders back",{id:"ERR_INCORRECT_POSTURE"}),ERR_HEM_MEASUREMENT_FAILED:V("Ensure your clothing hem is visible and clear",{id:"ERR_HEM_MEASUREMENT_FAILED"}),ERR_SHOULDER_MEASUREMENT_FAILED:V("Keep your shoulders relaxed and visible",{id:"ERR_SHOULDER_MEASUREMENT_FAILED"}),ERR_ARM_NOT_STRETCHED:V("Stretch your arms fully",{id:"ERR_ARM_NOT_STRETCHED"}),ERR_LEGS_NOT_DETECTED:V("Ensure your legs are fully visible in the frame",{id:"ERR_LEGS_NOT_DETECTED"}),ERR_HIPS_MEASUREMENT_FAILED:V("Stand straight and ensure your hips are visible",{id:"ERR_HIPS_MEASUREMENT_FAILED"}),ERR_WAIST_MEASUREMENT_FAILED:V("Stand straight and ensure your waist is visible",{id:"ERR_WAIST_MEASUREMENT_FAILED"}),ERR_INVALID_MEASURE_SIDE_VIEW:V("Turn to show a clear side profile",{id:"ERR_INVALID_MEASURE_SIDE_VIEW"}),ERR_INVALID_BODY_HEIGHT_TYPE:V("Ensure your full body is visible for height measurement",{id:"ERR_INVALID_BODY_HEIGHT_TYPE"}),ERR_IMAGE_LOAD_FAILED:V("Try again later; the image could not be processed",{id:"ERR_IMAGE_LOAD_FAILED"}),ERR_HEIGHT_INVALID:V("Height must be between 50 and 300 cm",{id:"ERR_HEIGHT_INVALID"})}}getTranslatedMessage(A){const t=this.errorMap[A];return t||(console.info("Error code is missing",A),V("An unexpected error occurred"))}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleEscKey.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleEscKey.bind(this)),this.stopPolling(),clearInterval(this.spinnerInterval)}handleEscKey(A){A.key==="Escape"&&this.showModal&&this.closeModal()}openModal(){this.showModal=!0,this.step=1,this.height=0,this.instructionMessage=V("Position yourself in front of the camera")}closeModal(){this.showModal=!1,this.onMeasurementCanceled&&typeof this.onMeasurementCanceled=="function"&&this.onMeasurementCanceled(),this.stopPolling(),this.dispatchEvent(new CustomEvent("measurementCanceled",{detail:{}}))}async step2advancement(){if(this.height<50||this.height>300){this.errorMessage=this.getTranslatedMessage("ERR_HEIGHT_INVALID");return}this.step=3,this.errorMessage=""}async startMeasurement(){this.step=3,this.errorMessage="",this.shouldStartMeasurement=!0}updated(A){super.updated(A),A.has("step")&&this.step===3&&this.shouldStartMeasurement&&(this.initializeMeasurement(),this.shouldStartMeasurement=!1)}async initializeMeasurement(){this.videoElement=this.shadowRoot.querySelector("video");try{this.stream=await navigator.mediaDevices.getUserMedia({video:!0}),this.videoElement&&(this.videoElement.srcObject=this.stream,await this.videoElement.play(),await this.loadCameras(),this.startPolling())}catch{this.errorMessage=V("Error accessing webcam")}}async loadCameras(){try{const A=await navigator.mediaDevices.enumerateDevices();this.cameras=A.filter(t=>t.kind==="videoinput"),this.cameras.length>0&&(this.currentCameraId=this.cameras[0].deviceId)}catch(A){console.error("Error enumerating devices:",A)}}async flipCamera(){if(this.cameras.length<2)return;this.isLoading=!0,this.stopPolling();const t=(this.cameras.findIndex(l=>l.deviceId===this.currentCameraId)+1)%this.cameras.length;this.currentCameraId=this.cameras[t].deviceId;try{this.stream&&this.stream.getTracks().forEach(l=>l.stop()),this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:this.currentCameraId}}}),this.videoElement&&(this.videoElement.srcObject=this.stream,await this.videoElement.play(),this.startPolling())}catch{this.errorMessage=V("Error switching camera")}finally{this.isLoading=!1}}async startPolling(){const A=async()=>{if(!this.videoElement||!this.stream||this.isFetching)return;const t=document.createElement("canvas");t.width=this.videoElement.videoWidth,t.height=this.videoElement.videoHeight;const l=t.getContext("2d");l==null||l.drawImage(this.videoElement,0,0,t.width,t.height);const e=await new Promise(S=>t.toBlob(q=>S(q),"image/jpeg")),p=new File([e],"frame.jpg",{type:"image/jpeg"}),n=new FormData;n.append("image",p),n.append("height",this.height.toString()),n.append("productSku",this.productSku),this.measurerKey&&n.append("measurerKey",this.measurerKey);try{this.isFetching=!0,this.isLoading=!0,this.poolingTimeout!==null&&(clearTimeout(this.poolingTimeout),this.poolingTimeout=null),this.instructionMessageTimeout!==null&&(clearTimeout(this.instructionMessageTimeout),this.instructionMessageTimeout=null);const q=await(await fetch(this.apiUrl,{method:"POST",body:n,headers:{Accept:"application/json","Cache-Control":"no-store",Pragma:"no-cache","X-Api-Key":this.apiKey}})).json();this.isFetching=!1,this.isLoading=!1,this.errorMessage=JSON.stringify(q),q.success?(this.measurements=q.measurements,this.recommendedSize=q.chosenSize,this.instructionMessage=V("Measurement successful!"),this.stopPolling(),this.step=4):(this.instructionMessage=this.getTranslatedMessage(q.message||"UNKNOWN_ERROR"),this.instructionMessageTimeout=setTimeout(()=>{this.recommendedSize||(this.instructionMessage=V("Position yourself in front of the camera"),this.poolingTimeout=setTimeout(A,0))},2e3))}catch{this.isFetching=!1,this.isLoading=!1,this.instructionMessage=V("Error processing measurement"),this.instructionMessageTimeout=setTimeout(()=>{this.recommendedSize||(this.instructionMessage=V("Position yourself in front of the camera"),this.poolingTimeout=setTimeout(A,0))},2e3)}};A()}stopPolling(){this.poolingTimeout!==null&&(clearTimeout(this.poolingTimeout),this.poolingTimeout=null),this.instructionMessageTimeout!==null&&(clearTimeout(this.instructionMessageTimeout),this.instructionMessageTimeout=null),this.stream&&(this.stream.getTracks().forEach(A=>A.stop()),this.stream=null)}acceptMeasurement(){this.dispatchEvent(new CustomEvent("measurementAccepted",{detail:{size:this.recommendedSize}})),this.onMeasurementAccepted&&typeof this.onMeasurementAccepted=="function"&&this.onMeasurementAccepted(),this.showModal=!1,this.stopPolling()}resetMeasurement(){this.step=1,this.height=0,this.recommendedSize="",this.measurements={},this.stopPolling()}stopMeasurement(){this.resetMeasurement(),this.showModal=!1}render(){return this._isLocaleLoading?J`<div hidden></div>`:J`
|
|
941
|
+
`,JA([c({type:Number})],Q.prototype,"height",2),JA([c({type:Function})],Q.prototype,"onStep2advancement",2),Q=JA([R("xact-step-informs"),w()],Q);const IA="data:image/svg+xml,%3csvg%20width='22'%20height='40'%20viewBox='0%200%2022%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200L0%2013.3362V0H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.339L0%2026.6724V13.3362H21.517V13.339Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.6755L0%2040.0089V26.6726H21.517V26.6755Z'%20fill='%231C28BA'/%3e%3c/svg%3e",ht="data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.00878906L0%2013.345V0.00878906H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.3478L0%2026.6812V13.345H21.517V13.3478Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2026.6843L0%2040.0176V26.6814H21.517V26.6843Z'%20fill='white'/%3e%3c/svg%3e",Et="data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.0204381L0%2013.3538V0.0175781H21.517V0.0204381Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2013.3538L0%2026.69V13.3538H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.693L0%2040.0264V26.6902H21.517V26.693Z'%20fill='white'/%3e%3c/svg%3e";var It=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,u=(r,A,t,l)=>{for(var e=l>1?void 0:l?wt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&It(A,t,e),e};const{getLocale:Yt,setLocale:XA}=Ut({sourceLocale:EA,targetLocales:Wt,loadLocale:r=>H(Object.assign({"./generated/locales/pt-BR.ts":()=>Promise.resolve().then(()=>Ct)}),`./generated/locales/${r}.ts`,4)});S.BodyMeasurer=class extends X{constructor(){super(...arguments),this.spinnerFrame=0,this.apiKey="DB8mP9gStPfvdyeYbbuCV4Zf3SH745dI",this.tenantId="1",this.productSku="123456",this.apiUrl="https://xactsize-dotnet-api-923169850574.southamerica-east1.run.app/api/measurer/measure/body",this._culture="pt-BR",this.measurerKey="",this._isLocaleLoading=!1,this.showModal=!1,this.step=1,this.height=0,this.recommendedSize="",this.measurements={},this.errorMessage="",this.instructionMessage=V("Position yourself in front of the camera"),this.shouldStartMeasurement=!1,this.isLoading=!1,this.isFetching=!1,this.videoElement=null,this.stream=null,this.poolingTimeout=null,this.instructionMessageTimeout=null,this.cameras=[],this.currentCameraId=null,this.snowflakesCache=null}firstUpdated(){this.startSpinnerAnimation()}startSpinnerAnimation(){const A=[Et,ht,IA];this.spinnerInterval=setInterval(()=>{var l;const t=(l=this.shadowRoot)==null?void 0:l.querySelector(".spinner");t&&(t.src=A[this.spinnerFrame],this.spinnerFrame=(this.spinnerFrame+1)%A.length)},300)}get culture(){return this._culture}set culture(A){const t=this._culture;this._culture=A,this.requestUpdate("culture",t),this._applyLocale(A).catch(console.error)}async _applyLocale(A){try{this._isLocaleLoading=!0,this.requestUpdate(),await XA(A)}catch(t){console.error("Failed to load locale",A,t),await XA(EA)}finally{this._isLocaleLoading=!1,this.requestUpdate()}}get errorMap(){return{ERR_RIGHT_ARM_TOO_HIGH:V("Lower your right arm",{id:"ERR_RIGHT_ARM_TOO_HIGH"}),ERR_LEFT_ARM_TOO_HIGH:V("Lower your left arm",{id:"ERR_LEFT_ARM_TOO_HIGH"}),ERR_ARMS_NOT_RAISED:V("Raise both arms to a 45-degree angle",{id:"ERR_ARMS_NOT_RAISED"}),ERR_RIGHT_ARM_NOT_RAISED:V("Raise your right arm to a 45-degree angle",{id:"ERR_RIGHT_ARM_NOT_RAISED"}),ERR_LEFT_ARM_NOT_RAISED:V("Raise your left arm to a 45-degree angle",{id:"ERR_LEFT_ARM_NOT_RAISED"}),ERR_BODY_LANDMARKS_NOT_DETECTED:V("Ensure your full body is visible in the camera",{id:"ERR_BODY_LANDMARKS_NOT_DETECTED"}),ERR_HIPS_NOT_VISIBLE:V("Adjust your position to show your hips",{id:"ERR_HIPS_NOT_VISIBLE"}),ERR_TOO_CLOSE_TO_CAMERA:V("Step back from the camera",{id:"ERR_TOO_CLOSE_TO_CAMERA"}),ERR_NOT_SIDE_VIEW:V("Turn to show your side profile",{id:"ERR_NOT_SIDE_VIEW"}),ERR_INVALID_CLOTHING_TYPE:V("This clothing type is not supported; please contact support",{id:"ERR_INVALID_CLOTHING_TYPE"}),ERR_UPPER_BODY_NOT_VISIBLE:V("Adjust your position to show your upper body",{id:"ERR_UPPER_BODY_NOT_VISIBLE"}),ERR_HEAD_TOO_CLOSE_TO_EDGE:V("Move your head away from the edge of the frame",{id:"ERR_HEAD_TOO_CLOSE_TO_EDGE"}),ERR_LOWER_BODY_NOT_VISIBLE:V("Adjust your position to show your lower body",{id:"ERR_LOWER_BODY_NOT_VISIBLE"}),ERR_FEET_TOO_CLOSE_TO_EDGE:V("Move your feet away from the edge of the frame",{id:"ERR_FEET_TOO_CLOSE_TO_EDGE"}),ERR_BODY_TOO_CLOSE_TO_EDGE:V("Move your body away from the edge of the frame",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE"}),ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_LEFT:V("Move to the left to center your body",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_LEFT"}),ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_RIGHT:V("Move to the right to center your body",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_RIGHT"}),ERR_SHOULDERS_NOT_VISIBLE:V("Adjust your position to show your shoulders",{id:"ERR_SHOULDERS_NOT_VISIBLE"}),ERR_HEIGHT_MEASUREMENT_FAILED:V("Stand straight and ensure your full body is visible",{id:"ERR_HEIGHT_MEASUREMENT_FAILED"}),ERR_HEAD_POINT_NOT_DETECTED:V("Ensure your head is fully visible in the frame",{id:"ERR_HEAD_POINT_NOT_DETECTED"}),ERR_INCORRECT_POSTURE:V("Stand straight with your shoulders back",{id:"ERR_INCORRECT_POSTURE"}),ERR_HEM_MEASUREMENT_FAILED:V("Ensure your clothing hem is visible and clear",{id:"ERR_HEM_MEASUREMENT_FAILED"}),ERR_SHOULDER_MEASUREMENT_FAILED:V("Keep your shoulders relaxed and visible",{id:"ERR_SHOULDER_MEASUREMENT_FAILED"}),ERR_ARM_NOT_STRETCHED:V("Stretch your arms fully",{id:"ERR_ARM_NOT_STRETCHED"}),ERR_LEGS_NOT_DETECTED:V("Ensure your legs are fully visible in the frame",{id:"ERR_LEGS_NOT_DETECTED"}),ERR_HIPS_MEASUREMENT_FAILED:V("Stand straight and ensure your hips are visible",{id:"ERR_HIPS_MEASUREMENT_FAILED"}),ERR_WAIST_MEASUREMENT_FAILED:V("Stand straight and ensure your waist is visible",{id:"ERR_WAIST_MEASUREMENT_FAILED"}),ERR_INVALID_MEASURE_SIDE_VIEW:V("Turn to show a clear side profile",{id:"ERR_INVALID_MEASURE_SIDE_VIEW"}),ERR_INVALID_BODY_HEIGHT_TYPE:V("Ensure your full body is visible for height measurement",{id:"ERR_INVALID_BODY_HEIGHT_TYPE"}),ERR_IMAGE_LOAD_FAILED:V("Try again later; the image could not be processed",{id:"ERR_IMAGE_LOAD_FAILED"}),ERR_HEIGHT_INVALID:V("Height must be between 50 and 300 cm",{id:"ERR_HEIGHT_INVALID"})}}getTranslatedMessage(A){const t=this.errorMap[A];return t||(console.info("Error code is missing",A),V("An unexpected error occurred"))}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleEscKey.bind(this)),this.snowflakesCache=this.generateSnowflakes()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleEscKey.bind(this)),this.stopPolling(),clearInterval(this.spinnerInterval)}handleEscKey(A){A.key==="Escape"&&this.showModal&&this.closeModal()}openModal(){this.showModal=!0,this.step=1,this.height=0,this.instructionMessage=V("Position yourself in front of the camera")}closeModal(){this.showModal=!1,this.onMeasurementCanceled&&typeof this.onMeasurementCanceled=="function"&&this.onMeasurementCanceled(),this.stopPolling(),this.dispatchEvent(new CustomEvent("measurementCanceled",{detail:{}}))}async step2advancement(){if(this.height<50||this.height>300){this.errorMessage=this.getTranslatedMessage("ERR_HEIGHT_INVALID");return}this.step=3,this.errorMessage=""}async startMeasurement(){this.step=3,this.errorMessage="",this.shouldStartMeasurement=!0}updated(A){super.updated(A),A.has("step")&&this.step===3&&this.shouldStartMeasurement&&(this.initializeMeasurement(),this.shouldStartMeasurement=!1)}async initializeMeasurement(){this.videoElement=this.shadowRoot.querySelector("video");try{this.stream=await navigator.mediaDevices.getUserMedia({video:!0}),this.videoElement&&(this.videoElement.srcObject=this.stream,await this.videoElement.play(),await this.loadCameras(),this.startPolling())}catch{this.errorMessage=V("Error accessing webcam")}}async loadCameras(){try{const A=await navigator.mediaDevices.enumerateDevices();this.cameras=A.filter(t=>t.kind==="videoinput"),this.cameras.length>0&&(this.currentCameraId=this.cameras[0].deviceId)}catch(A){console.error("Error enumerating devices:",A)}}async flipCamera(){if(this.cameras.length<2)return;this.isLoading=!0,this.stopPolling();const t=(this.cameras.findIndex(l=>l.deviceId===this.currentCameraId)+1)%this.cameras.length;this.currentCameraId=this.cameras[t].deviceId;try{this.stream&&this.stream.getTracks().forEach(l=>l.stop()),this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:this.currentCameraId}}}),this.videoElement&&(this.videoElement.srcObject=this.stream,await this.videoElement.play(),this.startPolling())}catch{this.errorMessage=V("Error switching camera")}finally{this.isLoading=!1}}async startPolling(){const A=async()=>{if(!this.videoElement||!this.stream||this.isFetching)return;const t=document.createElement("canvas");t.width=this.videoElement.videoWidth,t.height=this.videoElement.videoHeight;const l=t.getContext("2d");l==null||l.drawImage(this.videoElement,0,0,t.width,t.height);const e=await new Promise(a=>t.toBlob(q=>a(q),"image/jpeg")),p=new File([e],"frame.jpg",{type:"image/jpeg"}),n=new FormData;n.append("image",p),n.append("height",this.height.toString()),n.append("productSku",this.productSku),this.measurerKey&&n.append("measurerKey",this.measurerKey);try{this.isFetching=!0,this.isLoading=!0,this.poolingTimeout!==null&&(clearTimeout(this.poolingTimeout),this.poolingTimeout=null),this.instructionMessageTimeout!==null&&(clearTimeout(this.instructionMessageTimeout),this.instructionMessageTimeout=null);const q=await(await fetch(this.apiUrl,{method:"POST",body:n,headers:{Accept:"application/json","Cache-Control":"no-store",Pragma:"no-cache","X-Api-Key":this.apiKey}})).json();this.isFetching=!1,this.isLoading=!1,this.errorMessage=JSON.stringify(q),q.success?(this.measurements=q.measurements,this.recommendedSize=q.chosenSize,this.instructionMessage=V("Measurement successful!"),this.stopPolling(),this.step=4):(this.instructionMessage=this.getTranslatedMessage(q.message||"UNKNOWN_ERROR"),this.instructionMessageTimeout=setTimeout(()=>{this.recommendedSize||(this.instructionMessage=V("Position yourself in front of the camera"),this.poolingTimeout=setTimeout(A,0))},2e3))}catch{this.isFetching=!1,this.isLoading=!1,this.instructionMessage=V("Error processing measurement"),this.instructionMessageTimeout=setTimeout(()=>{this.recommendedSize||(this.instructionMessage=V("Position yourself in front of the camera"),this.poolingTimeout=setTimeout(A,0))},2e3)}};A()}stopPolling(){this.poolingTimeout!==null&&(clearTimeout(this.poolingTimeout),this.poolingTimeout=null),this.instructionMessageTimeout!==null&&(clearTimeout(this.instructionMessageTimeout),this.instructionMessageTimeout=null),this.stream&&(this.stream.getTracks().forEach(A=>A.stop()),this.stream=null)}acceptMeasurement(){this.dispatchEvent(new CustomEvent("measurementAccepted",{detail:{size:this.recommendedSize}})),this.onMeasurementAccepted&&typeof this.onMeasurementAccepted=="function"&&this.onMeasurementAccepted(),this.showModal=!1,this.stopPolling()}resetMeasurement(){this.step=1,this.height=0,this.recommendedSize="",this.measurements={},this.stopPolling()}stopMeasurement(){this.resetMeasurement(),this.showModal=!1}generateSnowflakes(){const A=[];for(let l=0;l<80;l++){const e=Math.random()*100,p=8+Math.random()*17,n=-Math.random()*30;A.push(k`<span class="snowflake" style="left:${e}%; animation-duration:${p.toFixed(2)}s; animation-delay:${n.toFixed(2)}s;"></span>`)}return k`${A}`}renderSnowflakes(){return this.snowflakesCache||k``}render(){return this._isLocaleLoading?k`<div hidden></div>`:k`
|
|
916
942
|
<xact-button
|
|
917
943
|
class="launch-btn"
|
|
918
944
|
style="--brand-primary: #000; --text-inverse: #fff; --brand-primary-hover: #111;"
|
|
@@ -920,7 +946,7 @@
|
|
|
920
946
|
label="${V("Find your Xactsize")}"
|
|
921
947
|
></xact-button>
|
|
922
948
|
|
|
923
|
-
${this.showModal?
|
|
949
|
+
${this.showModal?k`
|
|
924
950
|
<div class="modal">
|
|
925
951
|
<div class="modal-content">
|
|
926
952
|
<div style="display: flex; justify-content: space-between" class="modal-title-container">
|
|
@@ -931,14 +957,14 @@
|
|
|
931
957
|
</span>
|
|
932
958
|
</div>
|
|
933
959
|
|
|
934
|
-
${this.step===1?
|
|
960
|
+
${this.step===1?k`
|
|
935
961
|
<xact-step-one .onStartMeasurement=${A=>{this.height=A,this.startMeasurement()}}></xact-step-one>
|
|
936
962
|
`:""}
|
|
937
|
-
${this.step===2?
|
|
963
|
+
${this.step===2?k`
|
|
938
964
|
<xact-step-informs .onStep2advancement=${()=>{this.step2advancement()}}></xact-step-informs>
|
|
939
965
|
`:""}
|
|
940
966
|
|
|
941
|
-
${this.step===3?
|
|
967
|
+
${this.step===3?k`
|
|
942
968
|
<div class="step-3">
|
|
943
969
|
|
|
944
970
|
<p>${V("Ensure your full body is visible in the camera")}</p>
|
|
@@ -950,17 +976,22 @@
|
|
|
950
976
|
<img class="spinner" src="${IA}" alt="Carregando"/>
|
|
951
977
|
</div>
|
|
952
978
|
|
|
953
|
-
<video class=${
|
|
979
|
+
<video class=${Lt({error:!this.errorMessage,success:!!this.errorMessage})} playsinline id="video" autoplay></video>
|
|
954
980
|
<button class="video-flip-icon" @click=${this.flipCamera} ?disabled=${this.cameras.length<2}>
|
|
955
981
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="white" viewBox="0 0 24 24">
|
|
956
982
|
<path d="M12 6V9L16 5L12 1V4C7.58 4 4 7.58 4 12H6C6 8.69 8.69 6 12 6ZM18 12C18 15.31 15.31 18 12 18V15L8 19L12 23V20C16.42 20 20 16.42 20 12H18Z"/>
|
|
957
|
-
</svg>
|
|
983
|
+
</svg>
|
|
958
984
|
</button>
|
|
985
|
+
|
|
986
|
+
<!-- Snow effect -->
|
|
987
|
+
<div class="snow-container">
|
|
988
|
+
${this.renderSnowflakes()}
|
|
989
|
+
</div>
|
|
959
990
|
</div>
|
|
960
991
|
</div>
|
|
961
992
|
`:""}
|
|
962
993
|
|
|
963
|
-
${this.step===4?
|
|
994
|
+
${this.step===4?k`
|
|
964
995
|
<div class="step-4">
|
|
965
996
|
<xact-step-result
|
|
966
997
|
.recommendedSize=${this.recommendedSize}
|
|
@@ -974,7 +1005,7 @@
|
|
|
974
1005
|
|
|
975
1006
|
</div>
|
|
976
1007
|
`:""}
|
|
977
|
-
`}},
|
|
1008
|
+
`}},S.BodyMeasurer.styles=m`
|
|
978
1009
|
:host {
|
|
979
1010
|
display: block;
|
|
980
1011
|
font-family: Arial, sans-serif;
|
|
@@ -1353,6 +1384,82 @@
|
|
|
1353
1384
|
100% { filter: brightness(1); }
|
|
1354
1385
|
}
|
|
1355
1386
|
|
|
1387
|
+
/* Snow effect */
|
|
1388
|
+
.snow-container {
|
|
1389
|
+
position: absolute;
|
|
1390
|
+
inset: 0;
|
|
1391
|
+
pointer-events: none;
|
|
1392
|
+
overflow: hidden;
|
|
1393
|
+
z-index: 10;
|
|
1394
|
+
border-radius: 8px;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
.snowflake {
|
|
1398
|
+
position: absolute;
|
|
1399
|
+
top: -10%;
|
|
1400
|
+
color: #fff;
|
|
1401
|
+
font-size: 1em;
|
|
1402
|
+
font-family: Arial, sans-serif;
|
|
1403
|
+
text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
|
|
1404
|
+
opacity: 0;
|
|
1405
|
+
animation: snowfall linear infinite;
|
|
1406
|
+
will-change: transform, opacity;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
.snowflake::before {
|
|
1410
|
+
content: "❅";
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
.snowflake:nth-child(2n)::before {
|
|
1414
|
+
content: "❆";
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
.snowflake:nth-child(3n)::before {
|
|
1418
|
+
content: "❄";
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
.snowflake:nth-child(odd) {
|
|
1422
|
+
font-size: 0.8em;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
.snowflake:nth-child(3n) {
|
|
1426
|
+
font-size: 1.2em;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
.snowflake:nth-child(4n) {
|
|
1430
|
+
font-size: 0.6em;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
.snowflake:nth-child(5n) {
|
|
1434
|
+
font-size: 1.1em;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
@keyframes snowfall {
|
|
1438
|
+
0% {
|
|
1439
|
+
transform: translateY(-10vh) translateX(0);
|
|
1440
|
+
opacity: 0;
|
|
1441
|
+
}
|
|
1442
|
+
5% {
|
|
1443
|
+
opacity: 1;
|
|
1444
|
+
}
|
|
1445
|
+
25% {
|
|
1446
|
+
transform: translateY(30vh) translateX(-10px);
|
|
1447
|
+
}
|
|
1448
|
+
50% {
|
|
1449
|
+
transform: translateY(60vh) translateX(10px);
|
|
1450
|
+
}
|
|
1451
|
+
75% {
|
|
1452
|
+
transform: translateY(90vh) translateX(-5px);
|
|
1453
|
+
}
|
|
1454
|
+
95% {
|
|
1455
|
+
opacity: 1;
|
|
1456
|
+
}
|
|
1457
|
+
100% {
|
|
1458
|
+
transform: translateY(110vh) translateX(0);
|
|
1459
|
+
opacity: 0;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1356
1463
|
.error-message {
|
|
1357
1464
|
color: red;
|
|
1358
1465
|
font-size: 14px;
|
|
@@ -1409,4 +1516,4 @@
|
|
|
1409
1516
|
}
|
|
1410
1517
|
|
|
1411
1518
|
|
|
1412
|
-
`,u([c({type:String,attribute:"api-key"})],
|
|
1519
|
+
`,u([c({type:String,attribute:"api-key"})],S.BodyMeasurer.prototype,"apiKey",2),u([c({type:String,attribute:"tenant-id"})],S.BodyMeasurer.prototype,"tenantId",2),u([c({type:String,attribute:"product-sku"})],S.BodyMeasurer.prototype,"productSku",2),u([c({type:String,attribute:"api-url"})],S.BodyMeasurer.prototype,"apiUrl",2),u([c({type:Function,attribute:"onmeasurementaccepted"})],S.BodyMeasurer.prototype,"onMeasurementAccepted",2),u([c({type:Function,attribute:"onmeasurementcanceled"})],S.BodyMeasurer.prototype,"onMeasurementCanceled",2),u([c({type:String})],S.BodyMeasurer.prototype,"culture",1),u([J()],S.BodyMeasurer.prototype,"errorMap",1),u([J()],S.BodyMeasurer.prototype,"measurerKey",2),u([J()],S.BodyMeasurer.prototype,"_isLocaleLoading",2),u([J()],S.BodyMeasurer.prototype,"showModal",2),u([J()],S.BodyMeasurer.prototype,"step",2),u([J()],S.BodyMeasurer.prototype,"height",2),u([J()],S.BodyMeasurer.prototype,"recommendedSize",2),u([J()],S.BodyMeasurer.prototype,"measurements",2),u([J()],S.BodyMeasurer.prototype,"errorMessage",2),u([J()],S.BodyMeasurer.prototype,"instructionMessage",2),u([J()],S.BodyMeasurer.prototype,"shouldStartMeasurement",2),u([J()],S.BodyMeasurer.prototype,"isLoading",2),u([J()],S.BodyMeasurer.prototype,"isFetching",2),u([J()],S.BodyMeasurer.prototype,"cameras",2),u([J()],S.BodyMeasurer.prototype,"currentCameraId",2),S.BodyMeasurer=u([R("body-measurer"),w()],S.BodyMeasurer);const Ct=Object.freeze(Object.defineProperty({__proto__:null,templates:{ERR_ARM_NOT_STRETCHED:"Estique seus braços completamente",ERR_ARMS_NOT_RAISED:"Levante ambos os braços em um ângulo de 45 graus",ERR_BODY_LANDMARKS_NOT_DETECTED:"Certifique-se de que seu corpo inteiro esteja visível na câmera",ERR_BODY_TOO_CLOSE_TO_EDGE:"Afaste seu corpo da borda do quadro",ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_LEFT:"Mova-se para a esquerda para centralizar seu corpo",ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_RIGHT:"Mova-se para a direita para centralizar seu corpo",ERR_FEET_TOO_CLOSE_TO_EDGE:"Afaste seus pés da borda do quadro",ERR_HEAD_POINT_NOT_DETECTED:"Certifique-se de que sua cabeça esteja totalmente visível no quadro",ERR_HEAD_TOO_CLOSE_TO_EDGE:"Afaste sua cabeça da borda do quadro",ERR_HEIGHT_INVALID:"A altura deve ser entre 50 e 300cm",ERR_HEIGHT_MEASUREMENT_FAILED:"Fique ereto e certifique-se de que seu corpo inteiro esteja visível",ERR_HEM_MEASUREMENT_FAILED:"Certifique-se de que a bainha da sua roupa esteja visível e clara",ERR_HIPS_MEASUREMENT_FAILED:"Fique ereto e certifique-se de que seus quadris estejam visíveis",ERR_HIPS_NOT_VISIBLE:"Ajuste sua posição para mostrar seus quadris",ERR_IMAGE_LOAD_FAILED:"Tente novamente mais tarde; a imagem não pôde ser processada",ERR_INCORRECT_POSTURE:"Fique ereto com os ombros para trás",ERR_INVALID_BODY_HEIGHT_TYPE:"Certifique-se de que seu corpo inteiro esteja visível para a medição de altura",ERR_INVALID_CLOTHING_TYPE:"Este tipo de roupa não é suportado; entre em contato com o suporte",ERR_INVALID_MEASURE_SIDE_VIEW:"Gire para mostrar um perfil lateral claro",ERR_LEFT_ARM_NOT_RAISED:"Levante seu braço esquerdo em um ângulo de 45 graus",ERR_LEFT_ARM_TOO_HIGH:"Abaixe seu braço esquerdo",ERR_LEGS_NOT_DETECTED:"Certifique-se de que suas pernas estejam totalmente visíveis no quadro",ERR_LOWER_BODY_NOT_VISIBLE:"Ajuste sua posição para mostrar a parte inferior do corpo",ERR_NOT_SIDE_VIEW:"Gire para mostrar seu perfil lateral",ERR_RIGHT_ARM_NOT_RAISED:"Levante seu braço direito em um ângulo de 45 graus",ERR_RIGHT_ARM_TOO_HIGH:"Abaixe seu braço direito",ERR_SHOULDER_MEASUREMENT_FAILED:"Mantenha seus ombros relaxados e visíveis",ERR_SHOULDERS_NOT_VISIBLE:"Ajuste sua posição para mostrar seus ombros",ERR_TOO_CLOSE_TO_CAMERA:"Dê um passo para trás da câmera",ERR_UPPER_BODY_NOT_VISIBLE:"Ajuste sua posição para mostrar a parte superior do corpo",ERR_WAIST_MEASUREMENT_FAILED:"Fique ereto e certifique-se de que sua cintura esteja visível",s08b0bc2feb4e0f1c:"Boa iluminação",s1dd794b3870bcae0:"Começar",s2f77566c78235d88:"Erro acessando a câmera",s322c72546e939809:"Escolha uma área bem iluminada onde você possa ver sua imagem claramente.",s34c58d3d12e5f890:"Erro ao mudar a câmera",s396efd2b23a16ac9:"Posicione-se contra um fundo simples.",s3d324b180f982d46:"Tenha certeza de que seu corpo está totalmente visível",s420e8053328b31c4:"Seu tamanho ideal",s48d094fb2ffff8fb:"Pontas",s5c91b5e06c363734:"Medição de processamento de erros",s625ff027ee7b497b:"Certifique-se de que todo o seu corpo esteja visível. O aplicativo guiará você.",s676cfe9f36657792:"Medição realizada com sucesso!",s6ad3b28b46803c43:"Aceitar sugestão",s81d43b9b25d0775b:"Roupas",s88a3f5e6a9d9945d:"Use roupas que você costuma usar no dia a dia.",s8fb9f388e75ffe11:"Enquadramento",s952ed559991cf0b4:"Desenvolvido por",sa4ad2b9cd4ea10ba:"Fundo limpo",scf8d43c4a5cb71fa:"Mantenha uma postura ereta, com os braços ligeiramente afastados do corpo",sd13d4c82d57859fc:"Posicione-se em frente a câmera",sdabfef8968aeb5fa:"Um erro inesperado aconteceu",sdf9f9c621b6316e7:"Medir novamente",se940dab2e0b7a710:"Antes de começar",sf315699feee25406:"Descubra o tamanho ideal para você",sf84b5644f7595ce5:"Com base em suas medidas e nas dimensões exatas da peça, a recomendação de tamanho fornecida é a mais precisa para um ajuste ideal.",seb66e000f03f21e0:"Let's find your perfect size",sd2259f35f330b63c:"Curated luxury. Perfect fit.",sca9b53eeb24a5865:"Avoid backlighting",s32d5e90d7ffec075:"Use a plain wall",se61735ca89853860:"Form-fitting gear",s3a09a6be4809cb50:"Full body shot",s7948656b643c5186:"Enter your height (cm)",sdde2fe5a591a828a:"Let's get started! →",s4a7b0f0c7b8b2125:"By using Xactsize, you agree to our Terms and Privacy Policy."}},Symbol.toStringTag,{value:"Module"}));S.getLocale=Yt,S.setLocale=XA,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED