artlabs-viewer
Version:
Web viewer SDK for artlas Platform
166 lines • 71.4 kB
JavaScript
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
const isCEPolyfill="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,removeNodes=function(container,start,end){for(void 0===end&&(end=null);start!==end;){const n=start.nextSibling;container.removeChild(start),start=n}},marker=`{{lit-${(Math.random()+"").slice(2)}}}`,nodeMarker=`\x3c!--${marker}--\x3e`,markerRegex=RegExp(`${marker}|${nodeMarker}`);class Template{constructor(result,element){this.parts=[],this.element=element;const nodesToRemove=[],stack=[],walker=document.createTreeWalker(element.content,133,null,!1);let lastPartIndex=0,index=-1,partIndex=0;const{strings:strings,values:{length:length}}=result;for(;length>partIndex;){const node=walker.nextNode();if(null!==node){if(index++,1===node.nodeType){if(node.hasAttributes()){const attributes=node.attributes,{length:length}=attributes;let count=0;for(let i=0;length>i;i++)endsWith(attributes[i].name,"$lit$")&&count++;for(;count-- >0;){const name=lastAttributeNameRegex.exec(strings[partIndex])[2],attributeLookupName=name.toLowerCase()+"$lit$",attributeValue=node.getAttribute(attributeLookupName);node.removeAttribute(attributeLookupName);const statics=attributeValue.split(markerRegex);this.parts.push({type:"attribute",index:index,name:name,strings:statics}),partIndex+=statics.length-1}}"TEMPLATE"===node.tagName&&(stack.push(node),walker.currentNode=node.content)}else if(3===node.nodeType){const data=node.data;if(data.indexOf(marker)>=0){const parent=node.parentNode,strings=data.split(markerRegex),lastIndex=strings.length-1;for(let i=0;lastIndex>i;i++){let insert,s=strings[i];if(""===s)insert=createMarker();else{const match=lastAttributeNameRegex.exec(s);null!==match&&endsWith(match[2],"$lit$")&&(s=s.slice(0,match.index)+match[1]+match[2].slice(0,-5)+match[3]),insert=document.createTextNode(s)}parent.insertBefore(insert,node),this.parts.push({type:"node",index:++index})}""===strings[lastIndex]?(parent.insertBefore(createMarker(),node),nodesToRemove.push(node)):node.data=strings[lastIndex],partIndex+=lastIndex}}else if(8===node.nodeType)if(node.data===marker){const parent=node.parentNode;null!==node.previousSibling&&index!==lastPartIndex||(index++,parent.insertBefore(createMarker(),node)),lastPartIndex=index,this.parts.push({type:"node",index:index}),null===node.nextSibling?node.data="":(nodesToRemove.push(node),index--),partIndex++}else{let i=-1;for(;-1!==(i=node.data.indexOf(marker,i+1));)this.parts.push({type:"node",index:-1}),partIndex++}}else walker.currentNode=stack.pop()}for(const n of nodesToRemove)n.parentNode.removeChild(n)}}const endsWith=(str,suffix)=>{const index=str.length-suffix.length;return index>=0&&str.slice(index)===suffix},isTemplatePartActive=part=>-1!==part.index,createMarker=()=>document.createComment(""),lastAttributeNameRegex=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function removeNodesFromTemplate(template,nodesToRemove){const{element:{content:content},parts:parts}=template,walker=document.createTreeWalker(content,133,null,!1);let partIndex=nextActiveIndexInTemplateParts(parts),part=parts[partIndex],nodeIndex=-1,removeCount=0;const nodesToRemoveInTemplate=[];let currentRemovingNode=null;for(;walker.nextNode();){nodeIndex++;const node=walker.currentNode;for(node.previousSibling===currentRemovingNode&&(currentRemovingNode=null),nodesToRemove.has(node)&&(nodesToRemoveInTemplate.push(node),null===currentRemovingNode&&(currentRemovingNode=node)),null!==currentRemovingNode&&removeCount++;void 0!==part&&part.index===nodeIndex;)part.index=null!==currentRemovingNode?-1:part.index-removeCount,partIndex=nextActiveIndexInTemplateParts(parts,partIndex),part=parts[partIndex]}nodesToRemoveInTemplate.forEach((n=>n.parentNode.removeChild(n)))}const countNodes=node=>{let count=11===node.nodeType?0:1;const walker=document.createTreeWalker(node,133,null,!1);for(;walker.nextNode();)count++;return count},nextActiveIndexInTemplateParts=function(parts,startIndex){void 0===startIndex&&(startIndex=-1);for(let i=startIndex+1;parts.length>i;i++)if(isTemplatePartActive(parts[i]))return i;return-1},directives=new WeakMap,isDirective=o=>"function"==typeof o&&directives.has(o),noChange={},nothing={};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
class TemplateInstance{constructor(template,processor,options){this.__parts=[],this.template=template,this.processor=processor,this.options=options}update(values){let i=0;for(const part of this.__parts)void 0!==part&&part.setValue(values[i]),i++;for(const part of this.__parts)void 0!==part&&part.commit()}_clone(){const fragment=isCEPolyfill?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),stack=[],parts=this.template.parts,walker=document.createTreeWalker(fragment,133,null,!1);let part,partIndex=0,nodeIndex=0,node=walker.nextNode();for(;parts.length>partIndex;)if(part=parts[partIndex],isTemplatePartActive(part)){for(;part.index>nodeIndex;)nodeIndex++,"TEMPLATE"===node.nodeName&&(stack.push(node),walker.currentNode=node.content),null===(node=walker.nextNode())&&(walker.currentNode=stack.pop(),node=walker.nextNode());if("node"===part.type){const part=this.processor.handleTextExpression(this.options);part.insertAfterNode(node.previousSibling),this.__parts.push(part)}else this.__parts.push(...this.processor.handleAttributeExpressions(node,part.name,part.strings,this.options));partIndex++}else this.__parts.push(void 0),partIndex++;return isCEPolyfill&&(document.adoptNode(fragment),customElements.upgrade(fragment)),fragment}}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/const policy=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:s=>s}),commentMarker=` ${marker} `;class TemplateResult{constructor(strings,values,type,processor){this.strings=strings,this.values=values,this.type=type,this.processor=processor}getHTML(){const l=this.strings.length-1;let html="",isCommentBinding=!1;for(let i=0;l>i;i++){const s=this.strings[i],commentOpen=s.lastIndexOf("\x3c!--");isCommentBinding=(commentOpen>-1||isCommentBinding)&&-1===s.indexOf("--\x3e",commentOpen+1);const attributeMatch=lastAttributeNameRegex.exec(s);html+=null===attributeMatch?s+(isCommentBinding?commentMarker:nodeMarker):s.substr(0,attributeMatch.index)+attributeMatch[1]+attributeMatch[2]+"$lit$"+attributeMatch[3]+marker}return html+=this.strings[l],html}getTemplateElement(){const template=document.createElement("template");let value=this.getHTML();return void 0!==policy&&(value=policy.createHTML(value)),template.innerHTML=value,template}}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/const isPrimitive=value=>null===value||!("object"==typeof value||"function"==typeof value),isIterable=value=>Array.isArray(value)||!(!value||!value[Symbol.iterator]);class AttributeCommitter{constructor(element,name,strings){this.dirty=!0,this.element=element,this.name=name,this.strings=strings,this.parts=[];for(let i=0;strings.length-1>i;i++)this.parts[i]=this._createPart()}_createPart(){return new AttributePart(this)}_getValue(){const strings=this.strings,l=strings.length-1,parts=this.parts;if(1===l&&""===strings[0]&&""===strings[1]){const v=parts[0].value;if("symbol"==typeof v)return v+"";if("string"==typeof v||!isIterable(v))return v}let text="";for(let i=0;l>i;i++){text+=strings[i];const part=parts[i];if(void 0!==part){const v=part.value;if(isPrimitive(v)||!isIterable(v))text+="string"==typeof v?v:v+"";else for(const t of v)text+="string"==typeof t?t:t+""}}return text+=strings[l],text}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class AttributePart{constructor(committer){this.value=void 0,this.committer=committer}setValue(value){value===noChange||isPrimitive(value)&&value===this.value||(this.value=value,isDirective(value)||(this.committer.dirty=!0))}commit(){for(;isDirective(this.value);){const directive=this.value;this.value=noChange,directive(this)}this.value!==noChange&&this.committer.commit()}}class NodePart{constructor(options){this.value=void 0,this.__pendingValue=void 0,this.options=options}appendInto(container){this.startNode=container.appendChild(createMarker()),this.endNode=container.appendChild(createMarker())}insertAfterNode(ref){this.startNode=ref,this.endNode=ref.nextSibling}appendIntoPart(part){part.__insert(this.startNode=createMarker()),part.__insert(this.endNode=createMarker())}insertAfterPart(ref){ref.__insert(this.startNode=createMarker()),this.endNode=ref.endNode,ref.endNode=this.startNode}setValue(value){this.__pendingValue=value}commit(){if(null===this.startNode.parentNode)return;for(;isDirective(this.__pendingValue);){const directive=this.__pendingValue;this.__pendingValue=noChange,directive(this)}const value=this.__pendingValue;value!==noChange&&(isPrimitive(value)?value!==this.value&&this.__commitText(value):value instanceof TemplateResult?this.__commitTemplateResult(value):value instanceof Node?this.__commitNode(value):isIterable(value)?this.__commitIterable(value):value===nothing?(this.value=nothing,this.clear()):this.__commitText(value))}__insert(node){this.endNode.parentNode.insertBefore(node,this.endNode)}__commitNode(value){this.value!==value&&(this.clear(),this.__insert(value),this.value=value)}__commitText(value){const node=this.startNode.nextSibling,valueAsString="string"==typeof(value=null==value?"":value)?value:value+"";node===this.endNode.previousSibling&&3===node.nodeType?node.data=valueAsString:this.__commitNode(document.createTextNode(valueAsString)),this.value=value}__commitTemplateResult(value){const template=this.options.templateFactory(value);if(this.value instanceof TemplateInstance&&this.value.template===template)this.value.update(value.values);else{const instance=new TemplateInstance(template,value.processor,this.options),fragment=instance._clone();instance.update(value.values),this.__commitNode(fragment),this.value=instance}}__commitIterable(value){Array.isArray(this.value)||(this.value=[],this.clear());const itemParts=this.value;let itemPart,partIndex=0;for(const item of value)itemPart=itemParts[partIndex],void 0===itemPart&&(itemPart=new NodePart(this.options),itemParts.push(itemPart),0===partIndex?itemPart.appendIntoPart(this):itemPart.insertAfterPart(itemParts[partIndex-1])),itemPart.setValue(item),itemPart.commit(),partIndex++;itemParts.length>partIndex&&(itemParts.length=partIndex,this.clear(itemPart&&itemPart.endNode))}clear(startNode){void 0===startNode&&(startNode=this.startNode),removeNodes(this.startNode.parentNode,startNode.nextSibling,this.endNode)}}class BooleanAttributePart{constructor(element,name,strings){if(this.value=void 0,this.__pendingValue=void 0,2!==strings.length||""!==strings[0]||""!==strings[1])throw Error("Boolean attributes can only contain a single expression");this.element=element,this.name=name,this.strings=strings}setValue(value){this.__pendingValue=value}commit(){for(;isDirective(this.__pendingValue);){const directive=this.__pendingValue;this.__pendingValue=noChange,directive(this)}if(this.__pendingValue===noChange)return;const value=!!this.__pendingValue;this.value!==value&&(value?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=value),this.__pendingValue=noChange}}class PropertyCommitter extends AttributeCommitter{constructor(element,name,strings){super(element,name,strings),this.single=2===strings.length&&""===strings[0]&&""===strings[1]}_createPart(){return new PropertyPart(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class PropertyPart extends AttributePart{}let eventOptionsSupported=!1;(()=>{try{const options={get capture(){return eventOptionsSupported=!0,!1}};window.addEventListener("test",options,options),window.removeEventListener("test",options,options)}catch(_e){}})();class EventPart{constructor(element,eventName,eventContext){this.value=void 0,this.__pendingValue=void 0,this.element=element,this.eventName=eventName,this.eventContext=eventContext,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(value){this.__pendingValue=value}commit(){for(;isDirective(this.__pendingValue);){const directive=this.__pendingValue;this.__pendingValue=noChange,directive(this)}if(this.__pendingValue===noChange)return;const newListener=this.__pendingValue,oldListener=this.value,shouldRemoveListener=null==newListener||null!=oldListener&&(newListener.capture!==oldListener.capture||newListener.once!==oldListener.once||newListener.passive!==oldListener.passive),shouldAddListener=null!=newListener&&(null==oldListener||shouldRemoveListener);shouldRemoveListener&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),shouldAddListener&&(this.__options=getOptions(newListener),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=newListener,this.__pendingValue=noChange}handleEvent(event){"function"==typeof this.value?this.value.call(this.eventContext||this.element,event):this.value.handleEvent(event)}}const getOptions=o=>o&&(eventOptionsSupported?{capture:o.capture,passive:o.passive,once:o.once}:o.capture)
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/;function templateFactory(result){let templateCache=templateCaches.get(result.type);void 0===templateCache&&(templateCache={stringsArray:new WeakMap,keyString:new Map},templateCaches.set(result.type,templateCache));let template=templateCache.stringsArray.get(result.strings);if(void 0!==template)return template;const key=result.strings.join(marker);return template=templateCache.keyString.get(key),void 0===template&&(template=new Template(result,result.getTemplateElement()),templateCache.keyString.set(key,template)),templateCache.stringsArray.set(result.strings,template),template}const templateCaches=new Map,parts=new WeakMap,defaultTemplateProcessor=new
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
class{handleAttributeExpressions(element,name,strings,options){const prefix=name[0];return"."===prefix?new PropertyCommitter(element,name.slice(1),strings).parts:"@"===prefix?[new EventPart(element,name.slice(1),options.eventContext)]:"?"===prefix?[new BooleanAttributePart(element,name.slice(1),strings)]:new AttributeCommitter(element,name,strings).parts}handleTextExpression(options){return new NodePart(options)}};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");const html=function(strings){for(var _len=arguments.length,values=Array(_len>1?_len-1:0),_key=1;_len>_key;_key++)values[_key-1]=arguments[_key];return new TemplateResult(strings,values,"html",defaultTemplateProcessor)},getTemplateCacheKey=(type,scopeName)=>`${type}--${scopeName}`;
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/let compatibleShadyCSSVersion=!0;void 0===window.ShadyCSS?compatibleShadyCSSVersion=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),compatibleShadyCSSVersion=!1);const shadyTemplateFactory=scopeName=>result=>{const cacheKey=getTemplateCacheKey(result.type,scopeName);let templateCache=templateCaches.get(cacheKey);void 0===templateCache&&(templateCache={stringsArray:new WeakMap,keyString:new Map},templateCaches.set(cacheKey,templateCache));let template=templateCache.stringsArray.get(result.strings);if(void 0!==template)return template;const key=result.strings.join(marker);if(template=templateCache.keyString.get(key),void 0===template){const element=result.getTemplateElement();compatibleShadyCSSVersion&&window.ShadyCSS.prepareTemplateDom(element,scopeName),template=new Template(result,element),templateCache.keyString.set(key,template)}return templateCache.stringsArray.set(result.strings,template),template},TEMPLATE_TYPES=["html","svg"],shadyRenderSet=new Set;window.JSCompiler_renameProperty=(prop,_obj)=>prop;const defaultConverter={toAttribute(value,type){switch(type){case Boolean:return value?"":null;case Object:case Array:return null==value?value:JSON.stringify(value)}return value},fromAttribute(value,type){switch(type){case Boolean:return null!==value;case Number:return null===value?null:Number(value);case Object:case Array:return JSON.parse(value)}return value}},notEqual=(value,old)=>old!==value&&(old==old||value==value),defaultPropertyDeclaration={attribute:!0,type:String,converter:defaultConverter,reflect:!1,hasChanged:notEqual};class UpdatingElement extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const attributes=[];return this._classProperties.forEach(((v,p)=>{const attr=this._attributeNameForProperty(p,v);void 0!==attr&&(this._attributeToPropertyMap.set(attr,p),attributes.push(attr))})),attributes}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const superProperties=Object.getPrototypeOf(this)._classProperties;void 0!==superProperties&&superProperties.forEach(((v,k)=>this._classProperties.set(k,v)))}}static createProperty(name,options){if(void 0===options&&(options=defaultPropertyDeclaration),this._ensureClassProperties(),this._classProperties.set(name,options),options.noAccessor||this.prototype.hasOwnProperty(name))return;const key="symbol"==typeof name?Symbol():"__"+name,descriptor=this.getPropertyDescriptor(name,key,options);void 0!==descriptor&&Object.defineProperty(this.prototype,name,descriptor)}static getPropertyDescriptor(name,key,options){return{get(){return this[key]},set(value){const oldValue=this[name];this[key]=value,this.requestUpdateInternal(name,oldValue,options)},configurable:!0,enumerable:!0}}static getPropertyOptions(name){return this._classProperties&&this._classProperties.get(name)||defaultPropertyDeclaration}static finalize(){const superCtor=Object.getPrototypeOf(this);if(superCtor.hasOwnProperty("finalized")||superCtor.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const props=this.properties,propKeys=[...Object.getOwnPropertyNames(props),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(props):[]];for(const p of propKeys)this.createProperty(p,props[p])}}static _attributeNameForProperty(name,options){const attribute=options.attribute;return!1===attribute?void 0:"string"==typeof attribute?attribute:"string"==typeof name?name.toLowerCase():void 0}static _valueHasChanged(value,old,hasChanged){return void 0===hasChanged&&(hasChanged=notEqual),hasChanged(value,old)}static _propertyValueFromAttribute(value,options){const converter=options.converter||defaultConverter,fromAttribute="function"==typeof converter?converter:converter.fromAttribute;return fromAttribute?fromAttribute(value,options.type):value}static _propertyValueToAttribute(value,options){if(void 0===options.reflect)return;const converter=options.converter;return(converter&&converter.toAttribute||defaultConverter.toAttribute)(value,options.type)}initialize(){this._updateState=0,this._updatePromise=new Promise((res=>this._enableUpdatingResolver=res)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((_v,p)=>{if(this.hasOwnProperty(p)){const value=this[p];delete this[p],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(p,value)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((v,p)=>this[p]=v)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(name,old,value){old!==value&&this._attributeToProperty(name,value)}_propertyToAttribute(name,value,options){void 0===options&&(options=defaultPropertyDeclaration);const ctor=this.constructor,attr=ctor._attributeNameForProperty(name,options);if(void 0!==attr){const attrValue=ctor._propertyValueToAttribute(value,options);if(void 0===attrValue)return;this._updateState=8|this._updateState,null==attrValue?this.removeAttribute(attr):this.setAttribute(attr,attrValue),this._updateState=-9&this._updateState}}_attributeToProperty(name,value){if(8&this._updateState)return;const ctor=this.constructor,propName=ctor._attributeToPropertyMap.get(name);if(void 0!==propName){const options=ctor.getPropertyOptions(propName);this._updateState=16|this._updateState,this[propName]=ctor._propertyValueFromAttribute(value,options),this._updateState=-17&this._updateState}}requestUpdateInternal(name,oldValue,options){let shouldRequestUpdate=!0;if(void 0!==name){const ctor=this.constructor;options=options||ctor.getPropertyOptions(name),ctor._valueHasChanged(this[name],oldValue,options.hasChanged)?(this._changedProperties.has(name)||this._changedProperties.set(name,oldValue),!0!==options.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(name,options))):shouldRequestUpdate=!1}!this._hasRequestedUpdate&&shouldRequestUpdate&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(name,oldValue){return this.requestUpdateInternal(name,oldValue),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const result=this.performUpdate();return null!=result&&await result,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let shouldUpdate=!1;const changedProperties=this._changedProperties;try{shouldUpdate=this.shouldUpdate(changedProperties),shouldUpdate?this.update(changedProperties):this._markUpdated()}catch(e){throw shouldUpdate=!1,this._markUpdated(),e}shouldUpdate&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(changedProperties)),this.updated(changedProperties))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(_changedProperties){return!0}update(_changedProperties){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((v,k)=>this._propertyToAttribute(k,this[k],v))),this._reflectingProperties=void 0),this._markUpdated()}updated(_changedProperties){}firstUpdated(_changedProperties){}}UpdatingElement.finalized=!0;
/**
@license
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
part of the polymer project is also subject to an additional IP rights grant
found at http://polymer.github.io/PATENTS.txt
*/
const supportsAdoptingStyleSheets=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,constructionToken=Symbol();class CSSResult{constructor(cssText,safeToken){if(safeToken!==constructionToken)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=cssText}get styleSheet(){return void 0===this._styleSheet&&(supportsAdoptingStyleSheets?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const renderNotImplemented={};class LitElement extends UpdatingElement{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const userStyles=this.getStyles();if(Array.isArray(userStyles)){const addStyles=(styles,set)=>styles.reduceRight(((set,s)=>Array.isArray(s)?addStyles(s,set):(set.add(s),set)),set),set=addStyles(userStyles,new Set),styles=[];set.forEach((v=>styles.unshift(v))),this._styles=styles}else this._styles=void 0===userStyles?[]:[userStyles];this._styles=this._styles.map((s=>{if(s instanceof CSSStyleSheet&&!supportsAdoptingStyleSheets){const cssText=[].slice.call(s.cssRules).reduce(((css,rule)=>css+rule.cssText),"");return new CSSResult(cssText+"",constructionToken)}return s}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const styles=this.constructor._styles;0!==styles.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?supportsAdoptingStyleSheets?this.renderRoot.adoptedStyleSheets=styles.map((s=>s instanceof CSSStyleSheet?s:s.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(styles.map((s=>s.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(changedProperties){const templateResult=this.render();super.update(changedProperties),templateResult!==renderNotImplemented&&this.constructor.render(templateResult,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((s=>{const style=document.createElement("style");style.textContent=s.cssText,this.renderRoot.appendChild(style)})))}render(){return renderNotImplemented}}function getDefaultExportFromCjs(x){return x&&x.__esModule&&{}.hasOwnProperty.call(x,"default")?x.default:x}function createCommonjsModule(fn){var module={exports:{}};return fn(module,module.exports),module.exports}function commonjsRequire(target){throw Error('Could not dynamically require "'+target+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}LitElement.finalized=!0,LitElement.render=(result,container,options)=>{if(!options||"object"!=typeof options||!options.scopeName)throw Error("The `scopeName` option is required.");const scopeName=options.scopeName,hasRendered=parts.has(container),needsScoping=compatibleShadyCSSVersion&&11===container.nodeType&&!!container.host,firstScopeRender=needsScoping&&!shadyRenderSet.has(scopeName),renderContainer=firstScopeRender?document.createDocumentFragment():container;if(((result,container,options)=>{let part=parts.get(container);void 0===part&&(removeNodes(container,container.firstChild),parts.set(container,part=new NodePart(Object.assign({templateFactory:templateFactory},options))),part.appendInto(container)),part.setValue(result),part.commit()})(result,renderContainer,Object.assign({templateFactory:shadyTemplateFactory(scopeName)},options)),firstScopeRender){const part=parts.get(renderContainer);parts.delete(renderContainer),((scopeName,renderedDOM,template)=>{shadyRenderSet.add(scopeName);const templateElement=template?template.element:document.createElement("template"),styles=renderedDOM.querySelectorAll("style"),{length:length}=styles;if(0===length)return void window.ShadyCSS.prepareTemplateStyles(templateElement,scopeName);const condensedStyle=document.createElement("style");for(let i=0;length>i;i++){const style=styles[i];style.parentNode.removeChild(style),condensedStyle.textContent+=style.textContent}(scopeName=>{TEMPLATE_TYPES.forEach((type=>{const templates=templateCaches.get(getTemplateCacheKey(type,scopeName));void 0!==templates&&templates.keyString.forEach((template=>{const{element:{content:content}}=template,styles=new Set;Array.from(content.querySelectorAll("style")).forEach((s=>{styles.add(s)})),removeNodesFromTemplate(template,styles)}))}))})(scopeName);const content=templateElement.content;template?function(template,node,refNode){void 0===refNode&&(refNode=null);const{element:{content:content},parts:parts}=template;if(null==refNode)return void content.appendChild(node);const walker=document.createTreeWalker(content,133,null,!1);let partIndex=nextActiveIndexInTemplateParts(parts),insertCount=0,walkerIndex=-1;for(;walker.nextNode();)for(walkerIndex++,walker.currentNode===refNode&&(insertCount=countNodes(node),refNode.parentNode.insertBefore(node,refNode));-1!==partIndex&&parts[partIndex].index===walkerIndex;){if(insertCount>0){for(;-1!==partIndex;)parts[partIndex].index+=insertCount,partIndex=nextActiveIndexInTemplateParts(parts,partIndex);return}partIndex=nextActiveIndexInTemplateParts(parts,partIndex)}}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/(template,condensedStyle,content.firstChild):content.insertBefore(condensedStyle,content.firstChild),window.ShadyCSS.prepareTemplateStyles(templateElement,scopeName);const style=content.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==style)renderedDOM.insertBefore(style.cloneNode(!0),renderedDOM.firstChild);else if(template){content.insertBefore(condensedStyle,content.firstChild);const removes=new Set;removes.add(condensedStyle),removeNodesFromTemplate(template,removes)}})(scopeName,renderContainer,part.value instanceof TemplateInstance?part.value.template:void 0),removeNodes(container,container.firstChild),container.appendChild(renderContainer),parts.set(container,part)}!hasRendered&&needsScoping&&window.ShadyCSS.styleElement(container.host)},"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self,createCommonjsModule((function(module,exports){!function(){function applyFocusVisiblePolyfill(scope){var hadKeyboardEvent=!0,hadFocusVisibleRecently=!1,hadFocusVisibleRecentlyTimeout=null,inputTypesAllowlist={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function isValidFocusTarget(el){return!!(el&&el!==document&&"HTML"!==el.nodeName&&"BODY"!==el.nodeName&&"classList"in el&&"contains"in el.classList)}function addFocusVisibleClass(el){el.classList.contains("focus-visible")||(el.classList.add("focus-visible"),el.setAttribute("data-focus-visible-added",""))}function onPointerDown(e){hadKeyboardEvent=!1}function addInitialPointerMoveListeners(){document.addEventListener("mousemove",onInitialPointerMove),document.addEventListener("mousedown",onInitialPointerMove),document.addEventListener("mouseup",onInitialPointerMove),document.addEventListener("pointermove",onInitialPointerMove),document.addEventListener("pointerdown",onInitialPointerMove),document.addEventListener("pointerup",onInitialPointerMove),document.addEventListener("touchmove",onInitialPointerMove),document.addEventListener("touchstart",onInitialPointerMove),document.addEventListener("touchend",onInitialPointerMove)}function onInitialPointerMove(e){e.target.nodeName&&"html"===e.target.nodeName.toLowerCase()||(hadKeyboardEvent=!1,document.removeEventListener("mousemove",onInitialPointerMove),document.removeEventListener("mousedown",onInitialPointerMove),document.removeEventListener("mouseup",onInitialPointerMove),document.removeEventListener("pointermove",onInitialPointerMove),document.removeEventListener("pointerdown",onInitialPointerMove),document.removeEventListener("pointerup",onInitialPointerMove),document.removeEventListener("touchmove",onInitialPointerMove),document.removeEventListener("touchstart",onInitialPointerMove),document.removeEventListener("touchend",onInitialPointerMove))}document.addEventListener("keydown",(function(e){e.metaKey||e.altKey||e.ctrlKey||(isValidFocusTarget(scope.activeElement)&&addFocusVisibleClass(scope.activeElement),hadKeyboardEvent=!0)}),!0),document.addEventListener("mousedown",onPointerDown,!0),document.addEventListener("pointerdown",onPointerDown,!0),document.addEventListener("touchstart",onPointerDown,!0),document.addEventListener("visibilitychange",(function(e){"hidden"===document.visibilityState&&(hadFocusVisibleRecently&&(hadKeyboardEvent=!0),addInitialPointerMoveListeners())}),!0),addInitialPointerMoveListeners(),scope.addEventListener("focus",(function(e){var el,tagName;isValidFocusTarget(e.target)&&(hadKeyboardEvent||"INPUT"===(tagName=(el=e.target).tagName)&&inputTypesAllowlist[el.type]&&!el.readOnly||"TEXTAREA"===tagName&&!el.readOnly||el.isContentEditable)&&addFocusVisibleClass(e.target)}),!0),scope.addEventListener("blur",(function(e){var el;isValidFocusTarget(e.target)&&(e.target.classList.contains("focus-visible")||e.target.hasAttribute("data-focus-visible-added"))&&(hadFocusVisibleRecently=!0,window.clearTimeout(hadFocusVisibleRecentlyTimeout),hadFocusVisibleRecentlyTimeout=window.setTimeout((function(){hadFocusVisibleRecently=!1}),100),(el=e.target).hasAttribute("data-focus-visible-added")&&(el.classList.remove("focus-visible"),el.removeAttribute("data-focus-visible-added")))}),!0),scope.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&scope.host?scope.host.setAttribute("data-js-focus-visible",""):scope.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if("undefined"!=typeof window&&"undefined"!=typeof document){var event;window.applyFocusVisiblePolyfill=applyFocusVisiblePolyfill;try{event=new CustomEvent("focus-visible-polyfill-ready")}catch(error){(event=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(event)}"undefined"!=typeof document&&applyFocusVisiblePolyfill(document)}()}));const viewerStyle="\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nmodel-viewer {\n width: 100%;\n height: 100%;\n --progress-mask: transparent;\n --poster-color: transparent;\n}\n\nmodel-viewer > button:focus {\n outline: none;\n}\n\n.meshkraft-ar-button {\n background-color: transparent;\n border: none;\n position: absolute;\n bottom: 16px;\n right: 16px;\n cursor: pointer;\n}\n\n.meshkraft-ar-button img {\n width: 140px;\n}\n\n.meshkraft-dimension-button {\n background-color: rgba(0, 0, 0, 0.5);\n border: none;\n position: absolute;\n bottom: 64px;\n right: 22px;\n padding: 5px;\n border-radius: 8px;\n cursor: pointer;\n line-height: 10px;\n}\n\n.meshkraft-dimension-button img {\n width: 25px;\n filter: invert(100%);\n}\n\n.meshkraft-zoom-button {\n background-color: rgba(0, 0, 0, 0.5);\n border: none;\n position: absolute;\n bottom: 16px;\n padding: 8px;\n border-radius: 8px;\n width: 40px;\n cursor: pointer;\n}\n\n.meshkraft-zoom-in {\n left: 70px;\n}\n\n.meshkraft-zoom-out {\n left: 22px;\n}\n\n.meshkraft-zoom-button span {\n color: #FFF;\n font-size: 20px;\n}\n\n.dimension {\n transition: all 0.25s;\n transition-behavior: allow-discrete;\n}\n\n.dimension-dot {\n border: none;\n display: none;\n width: 30px;\n height: 30px;\n border-radius: 50%;\n background: #FFF;\n --min-hotspot-opacity: 0;\n}\n\n.dimension-dim {\n border: none;\n border-radius: 4px;\n background: transparent;\n color: #000;\n display: block;\n font-family: Futura, Helvetica Neue, sans-serif;\n font-size: 14px;\n font-weight: 500;\n max-width: 100px;\n overflow-wrap: break-word;\n padding: 0.2em 0.5em;\n position: absolute;\n width: max-content;\n height: max-content;\n --min-hotspot-opacity: 0;\n}\n\n.dim-x {\n transform: translate3d(-60%, 70%, 0);\n}\n\n.dim-y {\n transform: translate3d(-80%, -120%, 0);\n}\n\n.dim-z {\n transform: translate3d(-100%, 0%, 0);\n}\n\n.dimensionLineContainer {\n pointer-events: none;\n display: block;\n}\n\n.dimensionLine {\n stroke: rgba(0, 0, 0, 0.5);\n stroke-width: 1;\n}\n\n.show {\n --min-hotspot-opacity: 1;\n}\n\n.hide {\n display: none;\n opacity: 0;\n}\n\n.artlabs-loader {\n width: 96px;\n height: 96px;\n display: inline-block;\n position: relative;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.artlabs-loader::after,\n.artlabs-loader::before {\n content: ''; \n box-sizing: border-box;\n width: 96px;\n height: 96px;\n border-radius: 50%;\n border: 2px solid #000;\n position: absolute;\n left: 0;\n top: 0;\n animation: artlabsanimloader 2s linear infinite;\n}\n.artlabs-loader::after {\n animation-delay: 1s;\n}\n\n@keyframes artlabsanimloader {\n 0% {\n transform: scale(0);\n opacity: 1;\n }\n 100% {\n transform: scale(1);\n opacity: 0;\n }\n}\n";null!=navigator.xr&&null!=self.XRSession&&navigator;const IS_MOBILE=(()=>{const userAgent=navigator.userAgent||navigator.vendor||self.opera;let check=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0,4)))&&(check=!0),check})();navigator;const IS_ANDROID=/android/i.test(navigator.userAgent),IS_IOS=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;navigator;const IS_FIREFOX=/firefox/i.test(navigator.userAgent),IS_OCULUS=/OculusBrowser/.test(navigator.userAgent);IS_IOS&&navigator;const IS_WKWEBVIEW=!(!window.webkit||!window.webkit.messageHandlers),IS_SCENEVIEWER_CANDIDATE=IS_ANDROID&&!IS_FIREFOX&&!IS_OCULUS,IS_AR_QUICKLOOK_CANDIDATE=(()=>{if(IS_IOS){if(IS_WKWEBVIEW)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const tempAnchor=document.createElement("a");return!!(tempAnchor.relList&&tempAnchor.relList.supports&&tempAnchor.relList.supports("ar"))}}return!1})();let AR_ANCHOR;function drawLine(svgLine,dotHotspot1,dotHotspot2,dimensionHotspot){dotHotspot1&&dotHotspot2&&(svgLine.setAttribute("x1",dotHotspot1.canvasPosition.x),svgLine.setAttribute("y1",dotHotspot1.canvasPosition.y),svgLine.setAttribute("x2",dotHotspot2.canvasPosition.x),svgLine.setAttribute("y2",dotHotspot2.canvasPosition.y),dimensionHotspot&&!dimensionHotspot.facingCamera?svgLine.classList.add("hide"):svgLine.classList.remove("hide"))}function parseOrgId(){const scriptElement=document.querySelector("[data-artlabs-key]");if(!scriptElement)return console.warn("ERR :: MeshkraftViewer :: Missing Meshkraft ID"),!1;const{artlabsKey:artlabsKey,artlabsDrafts:artlabsDrafts}=scriptElement.dataset;return artlabsKey?{artlabsKey:artlabsKey,artlabsDrafts:artlabsDrafts}:(console.warn("ERR :: MeshkraftViewer :: Missing Meshkraft ID"),!1)}function fetchProduct(sku,orgKey,showDrafts){if(sku&&orgKey){const apiHeaders=new Headers;return apiHeaders.append("Content-Type","application/json"),fetch(`https://api.artlabs.ai/product/${sku}?token=${orgKey}${showDrafts?"&drafts=true":""}`,{cache:"no-cache",headers:apiHeaders}).then((response=>{if(!response.ok)throw Error(response.statusText);return response.json()})).catch((error=>(console.error("Error:",error),null)))}return Promise.resolve(null)}
/**
* @license
* Copyright (c) 2021 ART Labs. All rights reserved.
* Code distributed by ART Labs as part of the artlabs project is also
* subject to an additional IP rights
*/
const _style=document.createElement("style");_style.innerHTML=viewerStyle,document.head.append(_style);let modelViewerLoaded=!1;class ArtlabsViewer extends LitElement{static get styles(){return viewerStyle}static get properties(){return{sku:{type:String},glb:{type:String},usdz:{type:String},product:{type:Object},width:{type:String,reflect:!0},height:{type:String},"auto-rotate":{type:Boolean,reflect:!0},"disable-interaction-prompt":{type:Boolean,reflect:!0},"show-zoom-buttons":{type:Boolean,reflect:!0},reveal:{type:String},config:{type:Object},extra:{type:Object},"show-banner":{type:Boolean,reflect:!0},"banner-type":{type:String},"show-dimensions":{type:Boolean,reflect:!0},"custom-dimensions":{type:Object},"show-wireframe":{type:Boolean,reflect:!0},"viewer-style":{type:Object},"shadow-style":{type:String},"disable-ar":{type:Boolean,reflect:!0},"disable-poster":{type:Boolean,reflect:!0},"disable-zoom":{type:Boolean,reflect:!0},"show-annotations":{type:Boolean,reflect:!0},annotations:{type:Object}}}get sku(){return this._sku}set sku(sku){this._sku=sku,sku&&this._fetchProduct()}constructor(){super(),this.orgKey=null,this.sku=this.getAttribute("sku")||null,this.product=null,this.showDrafts=!1,this["show-dimensions"]=!1,this["custom-dimensions"]=null,this["show-wireframe"]=!1,this["show-banner"]=!1,this["banner-type"]="default",this["viewer-style"]=null,this["shadow-style"]=null,this["show-annotations"]=!1,this.width="100%",this.height="300px",this.reveal="auto",this["auto-rotate"]=!1,this["disable-interaction-prompt"]=!1,this["show-zoom-buttons"]=!1,this["disable-zoom"]=!1,this["disable-ar"]=!1,this["disable-poster"]=!1,this.annotations=null,this.viewerNode=null}connectedCallback(){super.connectedCallback();const{artlabsKey:artlabsKey,artlabsDrafts:artlabsDrafts}=parseOrgId();this.orgKey=artlabsKey,this.showDrafts=artlabsDrafts,async function(){modelViewerLoaded||(await import("./model-viewer.3bb99d20.js"),modelViewerLoaded=!0)}().then((()=>{this.viewerNode=document.createElement("model-viewer"),this.viewerNode.setAttribute("camera-controls","true"),this.viewerNode.setAttribute("interaction-prompt-style","wiggle"),this.viewerNode.setAttribute("autoplay","true"),this.viewerNode.setAttribute("shadow-intensity","1"),this.viewerNode.setAttribute("ar","false"),this.viewerNode.setAttribute("max-field-of-view","60deg"),this.viewerNode.setAttribute("interpolation-decay","100"),this.requestUpdate(),this.orgKey&&this._fetchProduct()}))}render(){return!this.viewerNode||this._gettingData?html`<div class="artlabs-loader"></div>`:this.viewerNode}createRenderRoot(){return this}async _fetchProduct(){if(this.sku&&this.orgKey){if(this._gettingData)return;this._gettingData=!0;try{var _product$hotspots;const product=await fetchProduct(this.sku,this.orgKey,this.showDrafts),{dispatchEvent:dispatchEvent}=this;if(this._gettingData=!1,this.product=product,!product.models||!product.models.length)return void console.warn("No Model found in Product.");if(product.images&&product.images.length&&!this["disable-poster"