@virtualdisplay.io/client 4.0.0-alpha.17 → 4.0.0-alpha.19

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.0-alpha.19
4
+
5
+ ### Patch Changes
6
+
7
+ Fix the AR and fullscreen buttons being hidden behind the configurator open button when the sidebar layout collapses on narrow embeds.
8
+
9
+ ## 4.0.0-alpha.18
10
+
11
+ ### Patch Changes
12
+
13
+ Internal improvements.
14
+
3
15
  ## 4.0.0-alpha.17
4
16
 
5
17
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ declare const MESSAGE_TYPES$1: {
14
14
  readonly SNAPSHOT: "snapshot";
15
15
  readonly MAPPING: "mapping";
16
16
  readonly AR_ACTIVATE: "ar_activate";
17
+ readonly FULLSCREEN: "fullscreen";
17
18
  readonly CONFIG: "config";
18
19
  readonly ANNOTATION_PLACE_MODE: "annotation_place_mode";
19
20
  readonly ANNOTATION_PLACED: "annotation_placed";
@@ -120,6 +121,14 @@ interface LoadingIndicatorMessage$1 {
120
121
  interface ArActivateMessage$1 {
121
122
  readonly type: typeof MESSAGE_TYPES$1.AR_ACTIVATE;
122
123
  }
124
+ /**
125
+ * Fullscreen (client → server): the user entered fullscreen via the client's
126
+ * toolbar button. Fullscreen itself is handled client-side; this only lets the
127
+ * server record the engagement against the tracking session it owns.
128
+ */
129
+ interface FullscreenMessage$1 {
130
+ readonly type: typeof MESSAGE_TYPES$1.FULLSCREEN;
131
+ }
123
132
  /**
124
133
  * Config (server → client): viewer settings and camera limits from model metadata.
125
134
  * Sent early — before MAPPING — so the client can show/hide controls and disable
@@ -262,7 +271,7 @@ interface PricingMessage$1 {
262
271
  readonly type: typeof MESSAGE_TYPES$1.PRICING;
263
272
  readonly pricing: PricingDocument$1;
264
273
  }
265
- type Message$1 = HandshakeMessage$1 | SessionMessage$1 | MutationMessage$1 | MutationResultMessage$1 | CameraCommandMessage$1 | CameraPositionMessage$1 | SnapshotRequestMessage$1 | SnapshotResultMessage$1 | MappingMessage$1 | LoadingIndicatorMessage$1 | ArActivateMessage$1 | ConfigMessage$1 | AnnotationPlaceModeMessage$1 | AnnotationPlacedMessage$1 | AnnotationToggleMessage$1 | FocusMessage$1 | FocusStateMessage$1 | PricingMessage$1;
274
+ type Message$1 = HandshakeMessage$1 | SessionMessage$1 | MutationMessage$1 | MutationResultMessage$1 | CameraCommandMessage$1 | CameraPositionMessage$1 | SnapshotRequestMessage$1 | SnapshotResultMessage$1 | MappingMessage$1 | LoadingIndicatorMessage$1 | ArActivateMessage$1 | FullscreenMessage$1 | ConfigMessage$1 | AnnotationPlaceModeMessage$1 | AnnotationPlacedMessage$1 | AnnotationToggleMessage$1 | FocusMessage$1 | FocusStateMessage$1 | PricingMessage$1;
266
275
  type MessageCallback = (message: Message$1) => void | Promise<void>;
267
276
 
268
277
  /**
@@ -753,6 +762,7 @@ declare const MESSAGE_TYPES: {
753
762
  readonly SNAPSHOT: "snapshot";
754
763
  readonly MAPPING: "mapping";
755
764
  readonly AR_ACTIVATE: "ar_activate";
765
+ readonly FULLSCREEN: "fullscreen";
756
766
  readonly CONFIG: "config";
757
767
  readonly ANNOTATION_PLACE_MODE: "annotation_place_mode";
758
768
  readonly ANNOTATION_PLACED: "annotation_placed";
@@ -859,6 +869,14 @@ interface LoadingIndicatorMessage {
859
869
  interface ArActivateMessage {
860
870
  readonly type: typeof MESSAGE_TYPES.AR_ACTIVATE;
861
871
  }
872
+ /**
873
+ * Fullscreen (client → server): the user entered fullscreen via the client's
874
+ * toolbar button. Fullscreen itself is handled client-side; this only lets the
875
+ * server record the engagement against the tracking session it owns.
876
+ */
877
+ interface FullscreenMessage {
878
+ readonly type: typeof MESSAGE_TYPES.FULLSCREEN;
879
+ }
862
880
  /**
863
881
  * Config (server → client): viewer settings and camera limits from model metadata.
864
882
  * Sent early — before MAPPING — so the client can show/hide controls and disable
@@ -1001,7 +1019,7 @@ interface PricingMessage {
1001
1019
  readonly type: typeof MESSAGE_TYPES.PRICING;
1002
1020
  readonly pricing: PricingDocument;
1003
1021
  }
1004
- type Message = HandshakeMessage | SessionMessage | MutationMessage | MutationResultMessage | CameraCommandMessage | CameraPositionMessage | SnapshotRequestMessage | SnapshotResultMessage | MappingMessage | LoadingIndicatorMessage | ArActivateMessage | ConfigMessage | AnnotationPlaceModeMessage | AnnotationPlacedMessage | AnnotationToggleMessage | FocusMessage | FocusStateMessage | PricingMessage;
1022
+ type Message = HandshakeMessage | SessionMessage | MutationMessage | MutationResultMessage | CameraCommandMessage | CameraPositionMessage | SnapshotRequestMessage | SnapshotResultMessage | MappingMessage | LoadingIndicatorMessage | ArActivateMessage | FullscreenMessage | ConfigMessage | AnnotationPlaceModeMessage | AnnotationPlacedMessage | AnnotationToggleMessage | FocusMessage | FocusStateMessage | PricingMessage;
1005
1023
 
1006
1024
  type SendFn = (message: Message) => void;
1007
1025
  type PlacedCallback = (position: AnnotationPosition) => void;
@@ -1064,6 +1082,8 @@ declare class VirtualdisplayClient {
1064
1082
  private dispatchConfigurationSubmit;
1065
1083
  private handleConfig;
1066
1084
  private activateAr;
1085
+ /** Tell the viewer the user entered fullscreen, so it records the engagement. */
1086
+ private trackFullscreen;
1067
1087
  private initializeLogging;
1068
1088
  private createAndConnectIframe;
1069
1089
  select(name: string, value: string): void;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k={NO_MAPPING:"NO_MAPPING",ATTRIBUTE_NOT_FOUND:"ATTRIBUTE_NOT_FOUND",VALUE_NOT_FOUND:"VALUE_NOT_FOUND",PARENT_NOT_FOUND:"PARENT_NOT_FOUND",INVALID_PARAMETER:"INVALID_PARAMETER",SNAPSHOT_FAILED:"SNAPSHOT_FAILED"};class f extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static valueNotFound(t,e){return new f(`Value "${e}" not found for attribute "${t}"`,k.VALUE_NOT_FOUND)}static parentNotFound(t){return new f(`Parent element not found: ${t}`,k.PARENT_NOT_FOUND)}static invalidParameter(t){return new f(t,k.INVALID_PARAMETER)}}const It={};class Lt{defaultServer="https://server.virtualdisplay.io";options;constructor(t){this.options=t}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),Object.assign(t.style,{width:"100%",height:"100%",border:"none",display:"block"}),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);return e.searchParams.set("license",this.options.license),e.searchParams.set("model",this.options.model),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(It?.VITE_VIRTUALDISPLAY_SERVER_HOST===void 0)return this.defaultServer}getParentElement(){if(typeof this.options.parent!="string")return this.options.parent;const t=document.querySelector(this.options.parent);if(t===null)throw f.parentNotFound(this.options.parent);return t}}function Mt(n){const t=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),e=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,s=["timestamp","level","msg","service","trace_id","span_id"],r=Object.entries(n).filter(([l])=>!s.includes(l)).map(([l,d])=>`${l}=${JSON.stringify(d)}`).join(" ");return`${t} ${e} [${i}] ${o}${r?" "+r:""}`}function zt(n){return JSON.stringify(n)}function Pt(n,t){const e=t?Mt(n):zt(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function lt(n,t=0){const e={name:n.name,message:n.message};n.stack!==void 0&&(e.stack=n.stack);for(const i of Object.getOwnPropertyNames(n)){if(i==="name"||i==="message"||i==="stack"||i==="cause")continue;const o=n[i];o!==void 0&&(e[i]=o)}return n.cause!==void 0&&n.cause!==null&&(e.cause=n.cause instanceof Error&&t<5?lt(n.cause,t+1):String(n.cause)),e}function Ft(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?lt(i):i;return t}function Dt(){return new Date}function $t(n){return n.toISOString()}function ct(){return typeof navigator>"u"?"":navigator.userAgent}function Bt(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Ut(){return/iPhone|iPad|iPod/i.test(ct())||Bt()}function Vt(){return/Android/i.test(ct())}function jt(){return Ut()||Vt()}class q{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:$t(Dt()),level:t,msg:e,service:this.config.service,...o,...Ft(i)};Pt(s,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}with(t){const e=new q(this.config);return e.log=((i,o,s={})=>{this.log(i,o,{...t,...s})}).bind(this),e}}function ut(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new q({service:n,isDev:e,traceProvider:t?.traceProvider})}function O(n){if(n!==void 0)return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof Error)?n:n instanceof Error?{error:n.message}:{value:n}}function dt(n){return{debug:(t,e)=>n.debug(t,O(e)),info:(t,e)=>n.info(t,O(e)),warn:(t,e)=>n.warn(t,O(e)),error:(t,e)=>n.error(t,O(e))}}let ht=!1;exports.logger=dt(ut("client",{isDev:!1}));function mt(){ht=!0,exports.logger=dt(ut("client",{isDev:!0}))}function Ht(){return ht}class Gt{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,exports.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}const T={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"};class pt{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}class ft{name;defaultValue;values;onSelect;onChangeCallback;constructor(t){this.name=t.name,this.defaultValue=t.defaultValue,this.onSelect=t.onSelect,this.values=this.createValues(t.values)}select(t){if(!this.values.has(t))throw f.valueNotFound(this.name,t);this.onSelect(this.name,t)}getValues(){return Array.from(this.values.values())}getValue(t){return this.values.get(t)}get selected(){for(const t of this.values.values())if(t.isSelected)return t.value}onChange(t){this.onChangeCallback=t}handleResult(t){let e;for(const i of this.values.values()){const o=i.value===t;i.setSelected(o),o&&(e=i)}e!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(e)}createValues(t){const e=new Map;for(const i of t){const o=new pt(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class qt{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new ft(s))}this.onMutationFailed=i}onMutationFailed;get(t){return this.attributes.get(t)}getSelection(){const t={};for(const[e,i]of this.attributes){const o=i.selected;o!==void 0&&(t[e]=o)}return t}handleResults(t){for(const e of t){if(!e.success){this.onMutationFailed?.(e.name,e.value);continue}this.get(e.name)?.handleResult(e.value)}}buildOptions(t,e){const i={name:t.name,values:t.values,onSelect:(o,s)=>{e([{name:o,value:s}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}const c={HANDSHAKE:"handshake",SESSION:"session",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",CONFIG:"config",ANNOTATION_PLACE_MODE:"annotation_place_mode",ANNOTATION_PLACED:"annotation_placed",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing"},Y={FOCUS:"focus",UNFOCUS:"unfocus"},Zt={FOCUSED:"focused"},Wt={HIDDEN:"hidden"},Yt=new Set(Object.values(c));function Xt(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Yt.has(t.type)}function Kt(n){const t=C(n);return t!==null&&t.type===c.HANDSHAKE}function Qt(n){const t=C(n);return t!==null&&t.type===c.SESSION&&typeof t.sessionId=="string"}function Jt(n){const t=C(n);return t!==null&&t.type===c.MUTATION&&Array.isArray(t.results)}function te(n){const t=C(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function ee(n){const t=C(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function ne(n){const t=C(n);return t!==null&&t.type===c.MAPPING&&Array.isArray(t.attributes)}function ie(n){const t=C(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function oe(n){const t=C(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function se(n){const t=C(n);return t!==null&&t.type===c.ANNOTATION_PLACED&&typeof t.position=="object"&&t.position!==null}function re(n){const t=C(n);return t!==null&&t.type===c.FOCUS&&typeof t.state=="string"}function ae(n){const t=C(n);return t!==null&&t.type===c.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function C(n){return typeof n!="object"||n===null?null:n}class X{constructor(t){this.processor=t}processor;pending=[];isReady=!1;enqueue(t){if(this.isReady){this.processor(t);return}this.pending.push(t)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;const t=[...this.pending];this.pending.length=0;for(const e of t)this.processor(e)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(t){return this.pending.some(e=>e.type===t)}clear(){this.pending.length=0}}class le{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.publisher=new X(i=>this.post(i)),this.consumer=new X(i=>this.routeToHandler(i)),this.shouldBuffer=e?.shouldBuffer??null,e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;on(t,e){this.handlers.set(t,e)}off(t){this.handlers.delete(t)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!Xt(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;if(this.shouldBuffer!==null&&!this.shouldBuffer(o)){this.routeToHandler(o);return}this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const s=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${s}`)})}}class ce{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){exports.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new qt(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){exports.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:c.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&exports.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let gt=class{constructor(t){this.send=t}send;commands=[];rotate(t){return this.validateFiniteNumber(t,"rotate"),this.commands.push({action:"rotate",value:t}),this}tilt(t){return this.validateFiniteNumber(t,"tilt"),this.commands.push({action:"tilt",value:t}),this}zoom(t){return this.validateFiniteNumber(t,"zoom"),this.commands.push({action:"zoom",value:t}),this}set(){if(this.commands.length===0)throw f.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:c.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw f.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:c.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class ue{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(t){this.changeCallbacks.push(t)}get limits(){return this.limitsState}applyLimits(t){this.limitsState=t;const e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(e)}handlePositionUpdate(t){this.update(t.transforms)}update(t){let e=!1;for(const i of t)switch(i.type){case"rotation":this.state.rotation=i.value,e=!0;break;case"tilt":this.state.tilt=i.value,e=!0;break;case"zoom":this.state.zoom=i.value,e=!0;break}if(e){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}class bt{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw f.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:c.FOCUS,action:Y.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,action:Y.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Zt.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}function de(n,t){const e=n.filter(s=>he(s,t));if(e.length===0)return;const i=Math.max(...e.map(K)),o=e.filter(s=>K(s)===i);return o.length===1?o[0]:void 0}function he(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function K(n){return Object.keys(n.attributes).length}class vt{constructor(t,e){this.dispatchChange=t,this.dispatchSubmit=e}dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){const t=this.pricing?.buttonLabel;if(t!=null&&t!=="")return t;if(this.submitDefaultLabel!==void 0&&this.submitDefaultLabel!=="")return this.submitDefaultLabel}get submittable(){return this.submitCallback===void 0?!1:this.pricing===void 0?!0:this.resolved?.availability==="available"}get submitEnabled(){return this.submittable&&this.buttonLabel!==void 0}onChange(t){this.changeCallbacks.push(t)}onSubmit(t,e){this.submitCallback=t,this.submitDefaultLabel=e?.defaultLabel,this.notifyRender()}onRender(t){return this.renderCallbacks.push(t),()=>{const e=this.renderCallbacks.indexOf(t);e!==-1&&this.renderCallbacks.splice(e,1)}}async submit(){if(!this.submittable)return;const t=this.resolved!==void 0?{attributes:this.resolved.attributes,reference:this.resolved.reference}:{attributes:{...this.selection},reference:""};this.dispatchSubmit(t),await this.submitCallback?.(t)}handlePricingReceived(t){this.pricing=t,this.recompute()}handleSelectionChanged(t){this.selection=t,this.recompute()}recompute(){this.resolved=this.resolve();for(const t of this.changeCallbacks)t(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(const t of this.renderCallbacks)t()}resolve(){if(this.pricing===void 0)return;const t=de(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===Wt.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class yt{constructor(t){this.filename=t}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(t){return this.developed&&this.photoData!==null?(t(this.photoData),this):(this.developedCallbacks.add(t),this)}onError(t){return this.errorCallbacks.add(t),this}getFilename(){return this.filename}develop(t){this.developed||this.failed||(this.photoData=t,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(t){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(e=>{e(t)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}const Q=3e4;class _t{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),exports.logger.debug("Taking snapshot",{filename:t});const e=new yt(t),i=setTimeout(()=>{this.pendingPhotos.delete(t),exports.logger.warn("Snapshot timed out",{filename:t}),e.fail(new f(`Snapshot timed out: the viewer did not respond within ${Q}ms`,k.SNAPSHOT_FAILED))},Q);return this.pendingPhotos.set(t,{photo:e,timeout:i}),this.send({type:c.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){exports.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}clearTimeout(e.timeout),this.pendingPhotos.delete(t.filename);const{photo:i}=e;if(t.error!==void 0){i.fail(new f(t.error,k.SNAPSHOT_FAILED));return}t.data!==void 0&&i.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new f("Client destroyed before snapshot completed",k.SNAPSHOT_FAILED);for(const{photo:e,timeout:i}of this.pendingPhotos.values())clearTimeout(i),e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new f("Filename must be a non-empty string",k.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new f(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,k.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new f('Filename cannot contain path separators or ".."',k.INVALID_PARAMETER)}}class me{container=null;attach(t){this.container=t}dispatch(t,e,i=!1){const o=new CustomEvent(t,{detail:e,cancelable:i});return this.container?.dispatchEvent(o),o}on(t,e){const i=o=>{const s=o,r={...s.detail,preventDefault:()=>{s.preventDefault()}};e(r)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const pe={},fe="en",Ct=["en","nl","de"],Z=["baseLocale"],J=[];let tt,et;function ge(n){if(J.length===0)return;const t=typeof n=="string"?n:n.href;if(tt===t)return et;const e=new URL(t,"http://dummy.com");let i;for(const o of J)if(new pe(o.match,e.href).exec(e.href)){i=o;break}return tt=t,et=i,i}function wt(n){const t=ge(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:Z}const G=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let nt=!1,h=()=>{let n=Z;!G&&typeof window<"u"&&window.location?.href&&(n=wt(window.location.href));const t=be(n);if(t)return nt||(nt=!0,kt(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function be(n,t){let e;for(const i of n){if(i==="baseLocale")e=fe;else if(At(i)&&N.has(i)){const s=N.get(i);if(s){const r=s.getLocale();if(r instanceof Promise)continue;if(r!==void 0)return ye(r)}}const o=St(e);if(o)return o}}const ve=n=>{window.location.reload()};let kt=(n,t)=>{const e={reload:!0,...t};let i;try{i=h()}catch{}const o=[];let s=Z;!G&&typeof window<"u"&&window.location?.href&&(s=wt(window.location.href));for(const l of s)if(l!=="baseLocale"&&At(l)&&N.has(l)){const d=N.get(l);if(d){let u=d.setLocale(n);u instanceof Promise&&(u=u.catch(p=>{throw new Error(`Custom strategy "${l}" setLocale failed.`,{cause:p})}),o.push(u))}}const r=()=>{!G&&e.reload&&window.location&&n!==i&&ve()};if(o.length)return Promise.all(o).then(()=>{r()});r()};function St(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of Ct)if(e.toLowerCase()===t)return e}function ye(n){const t=St(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${Ct.join(", ")}`)}const N=new Map;function At(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const _e=()=>"Activate AR",Ce=()=>"AR activeren",we=()=>"AR aktivieren",ke=((n={},t={})=>{const e=t.locale??h();return e==="en"?_e():e==="nl"?Ce():we()}),Se=()=>"Scan to view in AR",Ae=()=>"Scan om in AR te bekijken",Ee=()=>"Scannen für AR-Ansicht",xe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Se():e==="nl"?Ae():Ee()}),Te=()=>"Use your smartphone camera to scan this QR code",Re=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",Oe=()=>"Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen",Ne=((n={},t={})=>{const e=t.locale??h();return e==="en"?Te():e==="nl"?Re():Oe()}),Ie=()=>"Your phone will open the 3D model in AR mode.",Le=()=>"Je telefoon opent het 3D-model in AR-modus.",Me=()=>"Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet",ze=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ie():e==="nl"?Le():Me()}),Pe=()=>"Close",Fe=()=>"Sluiten",De=()=>"Schließen",$e=((n={},t={})=>{const e=t.locale??h();return e==="en"?Pe():e==="nl"?Fe():De()}),Be=()=>"Fullscreen",Ue=()=>"Volledig scherm",Ve=()=>"Vollbild",je=((n={},t={})=>{const e=t.locale??h();return e==="en"?Be():e==="nl"?Ue():Ve()}),He=()=>"Downloading",Ge=()=>"Downloaden",qe=()=>"Herunterladen",Et=((n={},t={})=>{const e=t.locale??h();return e==="en"?He():e==="nl"?Ge():qe()}),Ze=()=>"Rendering",We=()=>"Renderen",Ye=()=>"Rendern",Xe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ze():e==="nl"?We():Ye()}),Ke=()=>"Screenshot",Qe=()=>"Screenshot",Je=()=>"Screenshot",tn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ke():e==="nl"?Qe():Je()}),en=()=>"Configure",nn=()=>"Configureren",on=()=>"Konfigurieren",sn=((n={},t={})=>{const e=t.locale??h();return e==="en"?en():e==="nl"?nn():on()}),rn=()=>"Close",an=()=>"Sluiten",ln=()=>"Schließen",cn=((n={},t={})=>{const e=t.locale??h();return e==="en"?rn():e==="nl"?an():ln()}),un=()=>"Reset camera",dn=()=>"Camera resetten",hn=()=>"Kamera zurücksetzen",mn=((n={},t={})=>{const e=t.locale??h();return e==="en"?un():e==="nl"?dn():hn()}),pn=()=>"Zoom in",fn=()=>"Inzoomen",gn=()=>"Hineinzoomen",bn=((n={},t={})=>{const e=t.locale??h();return e==="en"?pn():e==="nl"?fn():gn()}),vn=()=>"Zoom out",yn=()=>"Uitzoomen",_n=()=>"Herauszoomen",Cn=((n={},t={})=>{const e=t.locale??h();return e==="en"?vn():e==="nl"?yn():_n()}),wn=()=>"Rotate left",kn=()=>"Naar links draaien",Sn=()=>"Nach links drehen",An=((n={},t={})=>{const e=t.locale??h();return e==="en"?wn():e==="nl"?kn():Sn()}),En=()=>"Rotate right",xn=()=>"Naar rechts draaien",Tn=()=>"Nach rechts drehen",Rn=((n={},t={})=>{const e=t.locale??h();return e==="en"?En():e==="nl"?xn():Tn()}),On=()=>"Tilt up",Nn=()=>"Omhoog kantelen",In=()=>"Nach oben kippen",Ln=((n={},t={})=>{const e=t.locale??h();return e==="en"?On():e==="nl"?Nn():In()}),Mn=()=>"Tilt down",zn=()=>"Omlaag kantelen",Pn=()=>"Nach unten kippen",Fn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Mn():e==="nl"?zn():Pn()}),Dn=()=>"Working…",$n=()=>"Bezig…",Bn=()=>"Läuft…",Un=((n={},t={})=>{const e=t.locale??h();return e==="en"?Dn():e==="nl"?$n():Bn()}),Vn=()=>"Done",jn=()=>"Gelukt",Hn=()=>"Fertig",Gn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Vn():e==="nl"?jn():Hn()}),qn=()=>"Failed",Zn=()=>"Mislukt",Wn=()=>"Fehlgeschlagen",Yn=((n={},t={})=>{const e=t.locale??h();return e==="en"?qn():e==="nl"?Zn():Wn()});const Xn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const xt=([n,t,e])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(t).forEach(o=>{i.setAttribute(o,String(t[o]))}),e?.length&&e.forEach(o=>{const s=xt(o);i.appendChild(s)}),i},Tt=(n,t={})=>{const i={...Xn,...t};return xt(["svg",i,n])};const Kn=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];const Qn=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];const Rt=[["path",{d:"m6 9 6 6 6-6"}]];const Jn=[["path",{d:"m15 18-6-6 6-6"}]];const ti=[["path",{d:"m9 18 6-6-6-6"}]];const ei=[["path",{d:"m18 15-6-6-6 6"}]];const ni=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const ii=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const oi=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const si=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const ri=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const ai=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];const li=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];function y(n,{size:t=20,strokeWidth:e=1.75}={}){return Tt(n,{width:t,height:t,"stroke-width":e})}const g={ar:n=>y(Kn,n),fullscreen:n=>y(ni,n),exitFullscreen:n=>y(ii,n),screenshot:n=>y(Qn,n),tiltUp:n=>y(ei,n),tiltDown:n=>y(Rt,n),rotateLeft:n=>y(Jn,n),rotateRight:n=>y(ti,n),zoomIn:n=>y(ai,n),zoomOut:n=>y(li,n),reset:n=>y(oi,n),configurator:n=>y(si,n),close:n=>y(ri,n)};class b{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:s,disabled:r=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${t} ui-btn--size-${e}`,i!==void 0&&(this.element.setAttribute("aria-label",i),this.element.title=i),o!==void 0?this.element.appendChild(o):i!==void 0&&(this.element.textContent=i),s&&this.element.addEventListener("click",s),this.element.disabled=r}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const m={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},a={0:"0",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",9:"2.25rem",24:"6rem"};class ci{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:m.white,borderRadius:a[3],padding:a[6],boxShadow:`0 ${a[2]} ${a[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class ui{constructor(t={}){this.options=t,this.card=new ci,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}options;card;backdrop;keyHandler=null;open(){document.body.appendChild(this.backdrop),this.keyHandler=t=>{t.key==="Escape"&&this.close()},document.addEventListener("keydown",this.keyHandler)}close(){this.backdrop.remove(),this.keyHandler!==null&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null),this.options.onClose?.()}createBackdrop(){const t=document.createElement("div");return Object.assign(t.style,{position:"fixed",inset:a[0],background:"oklch(0% 0 0 / 50%)",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center"}),t.addEventListener("click",e=>{e.target===t&&this.close()}),t}}class di{element;selectCallback=null;constructor(t,e,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<t.length;o++){const s=t[o],r=document.createElement("button");r.className="ui-toggle-group-item",r.dataset.value=s,r.textContent=i?.[o]??s,r.dataset.state=s===e?"on":"off",r.setAttribute("aria-pressed",s===e?"true":"false"),r.addEventListener("click",()=>{this.selectCallback?.(s)}),this.element.appendChild(r)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class hi{element;select;constructor(t,e,i,o,s){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const r=document.createElement("option");r.value="",r.disabled=!0,r.textContent=i,this.select.appendChild(r);let l=!1;for(let u=0;u<e.length;u++){const p=e[u],v=document.createElement("option");v.value=p,v.textContent=s?.[u]??p,p===o&&(v.selected=!0,l=!0),this.select.appendChild(v)}l||(r.selected=!0);const d=Tt(Rt,{width:16,height:16,"stroke-width":2});d.classList.add("ui-native-select-icon"),this.element=document.createElement("div"),this.element.className="ui-native-select-wrap",this.element.appendChild(this.select),this.element.appendChild(d)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const _={fontFamily:{sans:["Mona Sans","ui-sans-serif","system-ui","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"]},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem"},fontWeight:{medium:"500",semibold:"600"}},mi=_.fontFamily.sans.join(", ");class pi{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(o=>o.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});this.dialog=new ui({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:a[3],fontFamily:mi}),this.dialog.card.element.appendChild(this.createText(xe(),{fontSize:_.fontSize.base,fontWeight:_.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Ne(),{fontSize:_.fontSize.sm,color:m.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(e)),this.dialog.card.element.appendChild(this.createText(ze(),{fontSize:_.fontSize.xs,color:m.neutral[500]}));const i=new b({variant:"outline",label:$e(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(i.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",Object.assign(e.style,{width:a[24],height:a[24],borderRadius:a[1]}),e}}const E=_.fontFamily.sans.join(", "),fi=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k={NO_MAPPING:"NO_MAPPING",ATTRIBUTE_NOT_FOUND:"ATTRIBUTE_NOT_FOUND",VALUE_NOT_FOUND:"VALUE_NOT_FOUND",PARENT_NOT_FOUND:"PARENT_NOT_FOUND",INVALID_PARAMETER:"INVALID_PARAMETER",SNAPSHOT_FAILED:"SNAPSHOT_FAILED"};class f extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static valueNotFound(t,e){return new f(`Value "${e}" not found for attribute "${t}"`,k.VALUE_NOT_FOUND)}static parentNotFound(t){return new f(`Parent element not found: ${t}`,k.PARENT_NOT_FOUND)}static invalidParameter(t){return new f(t,k.INVALID_PARAMETER)}}const It={};class Lt{defaultServer="https://server.virtualdisplay.io";options;constructor(t){this.options=t}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),Object.assign(t.style,{width:"100%",height:"100%",border:"none",display:"block"}),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);return e.searchParams.set("license",this.options.license),e.searchParams.set("model",this.options.model),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(It?.VITE_VIRTUALDISPLAY_SERVER_HOST===void 0)return this.defaultServer}getParentElement(){if(typeof this.options.parent!="string")return this.options.parent;const t=document.querySelector(this.options.parent);if(t===null)throw f.parentNotFound(this.options.parent);return t}}function Mt(n){const t=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),e=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,s=["timestamp","level","msg","service","trace_id","span_id"],r=Object.entries(n).filter(([l])=>!s.includes(l)).map(([l,d])=>`${l}=${JSON.stringify(d)}`).join(" ");return`${t} ${e} [${i}] ${o}${r?" "+r:""}`}function zt(n){return JSON.stringify(n)}function Pt(n,t){const e=t?Mt(n):zt(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function lt(n,t=0){const e={name:n.name,message:n.message};n.stack!==void 0&&(e.stack=n.stack);for(const i of Object.getOwnPropertyNames(n)){if(i==="name"||i==="message"||i==="stack"||i==="cause")continue;const o=n[i];o!==void 0&&(e[i]=o)}return n.cause!==void 0&&n.cause!==null&&(e.cause=n.cause instanceof Error&&t<5?lt(n.cause,t+1):String(n.cause)),e}function Ft(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?lt(i):i;return t}function $t(){return new Date}function Dt(n){return n.toISOString()}function ct(){return typeof navigator>"u"?"":navigator.userAgent}function Bt(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Ut(){return/iPhone|iPad|iPod/i.test(ct())||Bt()}function Vt(){return/Android/i.test(ct())}function jt(){return Ut()||Vt()}class q{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:Dt($t()),level:t,msg:e,service:this.config.service,...o,...Ft(i)};Pt(s,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}with(t){const e=new q(this.config);return e.log=((i,o,s={})=>{this.log(i,o,{...t,...s})}).bind(this),e}}function ut(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new q({service:n,isDev:e,traceProvider:t?.traceProvider})}function O(n){if(n!==void 0)return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof Error)?n:n instanceof Error?{error:n.message}:{value:n}}function dt(n){return{debug:(t,e)=>n.debug(t,O(e)),info:(t,e)=>n.info(t,O(e)),warn:(t,e)=>n.warn(t,O(e)),error:(t,e)=>n.error(t,O(e))}}let ht=!1;exports.logger=dt(ut("client",{isDev:!1}));function mt(){ht=!0,exports.logger=dt(ut("client",{isDev:!0}))}function Ht(){return ht}class Gt{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,exports.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}const T={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"};class pt{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}class ft{name;defaultValue;values;onSelect;onChangeCallback;constructor(t){this.name=t.name,this.defaultValue=t.defaultValue,this.onSelect=t.onSelect,this.values=this.createValues(t.values)}select(t){if(!this.values.has(t))throw f.valueNotFound(this.name,t);this.onSelect(this.name,t)}getValues(){return Array.from(this.values.values())}getValue(t){return this.values.get(t)}get selected(){for(const t of this.values.values())if(t.isSelected)return t.value}onChange(t){this.onChangeCallback=t}handleResult(t){let e;for(const i of this.values.values()){const o=i.value===t;i.setSelected(o),o&&(e=i)}e!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(e)}createValues(t){const e=new Map;for(const i of t){const o=new pt(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class qt{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new ft(s))}this.onMutationFailed=i}onMutationFailed;get(t){return this.attributes.get(t)}getSelection(){const t={};for(const[e,i]of this.attributes){const o=i.selected;o!==void 0&&(t[e]=o)}return t}handleResults(t){for(const e of t){if(!e.success){this.onMutationFailed?.(e.name,e.value);continue}this.get(e.name)?.handleResult(e.value)}}buildOptions(t,e){const i={name:t.name,values:t.values,onSelect:(o,s)=>{e([{name:o,value:s}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}const c={HANDSHAKE:"handshake",SESSION:"session",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",FULLSCREEN:"fullscreen",CONFIG:"config",ANNOTATION_PLACE_MODE:"annotation_place_mode",ANNOTATION_PLACED:"annotation_placed",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing"},Y={FOCUS:"focus",UNFOCUS:"unfocus"},Zt={FOCUSED:"focused"},Wt={HIDDEN:"hidden"},Yt=new Set(Object.values(c));function Xt(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Yt.has(t.type)}function Kt(n){const t=C(n);return t!==null&&t.type===c.HANDSHAKE}function Qt(n){const t=C(n);return t!==null&&t.type===c.SESSION&&typeof t.sessionId=="string"}function Jt(n){const t=C(n);return t!==null&&t.type===c.MUTATION&&Array.isArray(t.results)}function te(n){const t=C(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function ee(n){const t=C(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function ne(n){const t=C(n);return t!==null&&t.type===c.MAPPING&&Array.isArray(t.attributes)}function ie(n){const t=C(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function oe(n){const t=C(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function se(n){const t=C(n);return t!==null&&t.type===c.ANNOTATION_PLACED&&typeof t.position=="object"&&t.position!==null}function re(n){const t=C(n);return t!==null&&t.type===c.FOCUS&&typeof t.state=="string"}function ae(n){const t=C(n);return t!==null&&t.type===c.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function C(n){return typeof n!="object"||n===null?null:n}class X{constructor(t){this.processor=t}processor;pending=[];isReady=!1;enqueue(t){if(this.isReady){this.processor(t);return}this.pending.push(t)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;const t=[...this.pending];this.pending.length=0;for(const e of t)this.processor(e)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(t){return this.pending.some(e=>e.type===t)}clear(){this.pending.length=0}}class le{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.publisher=new X(i=>this.post(i)),this.consumer=new X(i=>this.routeToHandler(i)),this.shouldBuffer=e?.shouldBuffer??null,e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;on(t,e){this.handlers.set(t,e)}off(t){this.handlers.delete(t)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!Xt(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;if(this.shouldBuffer!==null&&!this.shouldBuffer(o)){this.routeToHandler(o);return}this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const s=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${s}`)})}}class ce{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){exports.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new qt(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){exports.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:c.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&exports.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let gt=class{constructor(t){this.send=t}send;commands=[];rotate(t){return this.validateFiniteNumber(t,"rotate"),this.commands.push({action:"rotate",value:t}),this}tilt(t){return this.validateFiniteNumber(t,"tilt"),this.commands.push({action:"tilt",value:t}),this}zoom(t){return this.validateFiniteNumber(t,"zoom"),this.commands.push({action:"zoom",value:t}),this}set(){if(this.commands.length===0)throw f.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:c.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw f.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:c.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class ue{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(t){this.changeCallbacks.push(t)}get limits(){return this.limitsState}applyLimits(t){this.limitsState=t;const e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(e)}handlePositionUpdate(t){this.update(t.transforms)}update(t){let e=!1;for(const i of t)switch(i.type){case"rotation":this.state.rotation=i.value,e=!0;break;case"tilt":this.state.tilt=i.value,e=!0;break;case"zoom":this.state.zoom=i.value,e=!0;break}if(e){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}class bt{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw f.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:c.FOCUS,action:Y.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,action:Y.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Zt.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}function de(n,t){const e=n.filter(s=>he(s,t));if(e.length===0)return;const i=Math.max(...e.map(K)),o=e.filter(s=>K(s)===i);return o.length===1?o[0]:void 0}function he(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function K(n){return Object.keys(n.attributes).length}class vt{constructor(t,e){this.dispatchChange=t,this.dispatchSubmit=e}dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){const t=this.pricing?.buttonLabel;if(t!=null&&t!=="")return t;if(this.submitDefaultLabel!==void 0&&this.submitDefaultLabel!=="")return this.submitDefaultLabel}get submittable(){return this.submitCallback===void 0?!1:this.pricing===void 0?!0:this.resolved?.availability==="available"}get submitEnabled(){return this.submittable&&this.buttonLabel!==void 0}onChange(t){this.changeCallbacks.push(t)}onSubmit(t,e){this.submitCallback=t,this.submitDefaultLabel=e?.defaultLabel,this.notifyRender()}onRender(t){return this.renderCallbacks.push(t),()=>{const e=this.renderCallbacks.indexOf(t);e!==-1&&this.renderCallbacks.splice(e,1)}}async submit(){if(!this.submittable)return;const t=this.resolved!==void 0?{attributes:this.resolved.attributes,reference:this.resolved.reference}:{attributes:{...this.selection},reference:""};this.dispatchSubmit(t),await this.submitCallback?.(t)}handlePricingReceived(t){this.pricing=t,this.recompute()}handleSelectionChanged(t){this.selection=t,this.recompute()}recompute(){this.resolved=this.resolve();for(const t of this.changeCallbacks)t(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(const t of this.renderCallbacks)t()}resolve(){if(this.pricing===void 0)return;const t=de(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===Wt.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class yt{constructor(t){this.filename=t}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(t){return this.developed&&this.photoData!==null?(t(this.photoData),this):(this.developedCallbacks.add(t),this)}onError(t){return this.errorCallbacks.add(t),this}getFilename(){return this.filename}develop(t){this.developed||this.failed||(this.photoData=t,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(t){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(e=>{e(t)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}const Q=3e4;class _t{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),exports.logger.debug("Taking snapshot",{filename:t});const e=new yt(t),i=setTimeout(()=>{this.pendingPhotos.delete(t),exports.logger.warn("Snapshot timed out",{filename:t}),e.fail(new f(`Snapshot timed out: the viewer did not respond within ${Q}ms`,k.SNAPSHOT_FAILED))},Q);return this.pendingPhotos.set(t,{photo:e,timeout:i}),this.send({type:c.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){exports.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}clearTimeout(e.timeout),this.pendingPhotos.delete(t.filename);const{photo:i}=e;if(t.error!==void 0){i.fail(new f(t.error,k.SNAPSHOT_FAILED));return}t.data!==void 0&&i.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new f("Client destroyed before snapshot completed",k.SNAPSHOT_FAILED);for(const{photo:e,timeout:i}of this.pendingPhotos.values())clearTimeout(i),e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new f("Filename must be a non-empty string",k.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new f(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,k.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new f('Filename cannot contain path separators or ".."',k.INVALID_PARAMETER)}}class me{container=null;attach(t){this.container=t}dispatch(t,e,i=!1){const o=new CustomEvent(t,{detail:e,cancelable:i});return this.container?.dispatchEvent(o),o}on(t,e){const i=o=>{const s=o,r={...s.detail,preventDefault:()=>{s.preventDefault()}};e(r)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const pe={},fe="en",Ct=["en","nl","de"],Z=["baseLocale"],J=[];let tt,et;function ge(n){if(J.length===0)return;const t=typeof n=="string"?n:n.href;if(tt===t)return et;const e=new URL(t,"http://dummy.com");let i;for(const o of J)if(new pe(o.match,e.href).exec(e.href)){i=o;break}return tt=t,et=i,i}function wt(n){const t=ge(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:Z}const G=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let nt=!1,h=()=>{let n=Z;!G&&typeof window<"u"&&window.location?.href&&(n=wt(window.location.href));const t=be(n);if(t)return nt||(nt=!0,kt(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function be(n,t){let e;for(const i of n){if(i==="baseLocale")e=fe;else if(At(i)&&N.has(i)){const s=N.get(i);if(s){const r=s.getLocale();if(r instanceof Promise)continue;if(r!==void 0)return ye(r)}}const o=St(e);if(o)return o}}const ve=n=>{window.location.reload()};let kt=(n,t)=>{const e={reload:!0,...t};let i;try{i=h()}catch{}const o=[];let s=Z;!G&&typeof window<"u"&&window.location?.href&&(s=wt(window.location.href));for(const l of s)if(l!=="baseLocale"&&At(l)&&N.has(l)){const d=N.get(l);if(d){let u=d.setLocale(n);u instanceof Promise&&(u=u.catch(p=>{throw new Error(`Custom strategy "${l}" setLocale failed.`,{cause:p})}),o.push(u))}}const r=()=>{!G&&e.reload&&window.location&&n!==i&&ve()};if(o.length)return Promise.all(o).then(()=>{r()});r()};function St(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of Ct)if(e.toLowerCase()===t)return e}function ye(n){const t=St(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${Ct.join(", ")}`)}const N=new Map;function At(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const _e=()=>"Activate AR",Ce=()=>"AR activeren",we=()=>"AR aktivieren",ke=((n={},t={})=>{const e=t.locale??h();return e==="en"?_e():e==="nl"?Ce():we()}),Se=()=>"Scan to view in AR",Ae=()=>"Scan om in AR te bekijken",Ee=()=>"Scannen für AR-Ansicht",xe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Se():e==="nl"?Ae():Ee()}),Te=()=>"Use your smartphone camera to scan this QR code",Re=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",Oe=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",Ne=((n={},t={})=>{const e=t.locale??h();return e==="en"?Te():e==="nl"?Re():Oe()}),Ie=()=>"Your phone will open the 3D model in AR mode.",Le=()=>"Je telefoon opent het 3D-model in AR-modus.",Me=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",ze=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ie():e==="nl"?Le():Me()}),Pe=()=>"Close",Fe=()=>"Sluiten",$e=()=>"Schließen",De=((n={},t={})=>{const e=t.locale??h();return e==="en"?Pe():e==="nl"?Fe():$e()}),Be=()=>"Fullscreen",Ue=()=>"Volledig scherm",Ve=()=>"Vollbild",je=((n={},t={})=>{const e=t.locale??h();return e==="en"?Be():e==="nl"?Ue():Ve()}),He=()=>"Downloading",Ge=()=>"Downloaden",qe=()=>"Herunterladen",Et=((n={},t={})=>{const e=t.locale??h();return e==="en"?He():e==="nl"?Ge():qe()}),Ze=()=>"Rendering",We=()=>"Renderen",Ye=()=>"Rendern",Xe=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ze():e==="nl"?We():Ye()}),Ke=()=>"Screenshot",Qe=()=>"Screenshot",Je=()=>"Screenshot",tn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Ke():e==="nl"?Qe():Je()}),en=()=>"Configure",nn=()=>"Configureren",on=()=>"Konfigurieren",sn=((n={},t={})=>{const e=t.locale??h();return e==="en"?en():e==="nl"?nn():on()}),rn=()=>"Close",an=()=>"Sluiten",ln=()=>"Schließen",cn=((n={},t={})=>{const e=t.locale??h();return e==="en"?rn():e==="nl"?an():ln()}),un=()=>"Reset camera",dn=()=>"Camera resetten",hn=()=>"Kamera zurücksetzen",mn=((n={},t={})=>{const e=t.locale??h();return e==="en"?un():e==="nl"?dn():hn()}),pn=()=>"Zoom in",fn=()=>"Inzoomen",gn=()=>"Hineinzoomen",bn=((n={},t={})=>{const e=t.locale??h();return e==="en"?pn():e==="nl"?fn():gn()}),vn=()=>"Zoom out",yn=()=>"Uitzoomen",_n=()=>"Herauszoomen",Cn=((n={},t={})=>{const e=t.locale??h();return e==="en"?vn():e==="nl"?yn():_n()}),wn=()=>"Rotate left",kn=()=>"Naar links draaien",Sn=()=>"Nach links drehen",An=((n={},t={})=>{const e=t.locale??h();return e==="en"?wn():e==="nl"?kn():Sn()}),En=()=>"Rotate right",xn=()=>"Naar rechts draaien",Tn=()=>"Nach rechts drehen",Rn=((n={},t={})=>{const e=t.locale??h();return e==="en"?En():e==="nl"?xn():Tn()}),On=()=>"Tilt up",Nn=()=>"Omhoog kantelen",In=()=>"Nach oben kippen",Ln=((n={},t={})=>{const e=t.locale??h();return e==="en"?On():e==="nl"?Nn():In()}),Mn=()=>"Tilt down",zn=()=>"Omlaag kantelen",Pn=()=>"Nach unten kippen",Fn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Mn():e==="nl"?zn():Pn()}),$n=()=>"Working…",Dn=()=>"Bezig…",Bn=()=>"Läuft…",Un=((n={},t={})=>{const e=t.locale??h();return e==="en"?$n():e==="nl"?Dn():Bn()}),Vn=()=>"Done",jn=()=>"Gelukt",Hn=()=>"Fertig",Gn=((n={},t={})=>{const e=t.locale??h();return e==="en"?Vn():e==="nl"?jn():Hn()}),qn=()=>"Failed",Zn=()=>"Mislukt",Wn=()=>"Fehlgeschlagen",Yn=((n={},t={})=>{const e=t.locale??h();return e==="en"?qn():e==="nl"?Zn():Wn()});const Xn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const xt=([n,t,e])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(t).forEach(o=>{i.setAttribute(o,String(t[o]))}),e?.length&&e.forEach(o=>{const s=xt(o);i.appendChild(s)}),i},Tt=(n,t={})=>{const i={...Xn,...t};return xt(["svg",i,n])};const Kn=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];const Qn=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];const Rt=[["path",{d:"m6 9 6 6 6-6"}]];const Jn=[["path",{d:"m15 18-6-6 6-6"}]];const ti=[["path",{d:"m9 18 6-6-6-6"}]];const ei=[["path",{d:"m18 15-6-6-6 6"}]];const ni=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const ii=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const oi=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const si=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const ri=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const ai=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];const li=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];function y(n,{size:t=20,strokeWidth:e=1.75}={}){return Tt(n,{width:t,height:t,"stroke-width":e})}const g={ar:n=>y(Kn,n),fullscreen:n=>y(ni,n),exitFullscreen:n=>y(ii,n),screenshot:n=>y(Qn,n),tiltUp:n=>y(ei,n),tiltDown:n=>y(Rt,n),rotateLeft:n=>y(Jn,n),rotateRight:n=>y(ti,n),zoomIn:n=>y(ai,n),zoomOut:n=>y(li,n),reset:n=>y(oi,n),configurator:n=>y(si,n),close:n=>y(ri,n)};class b{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:s,disabled:r=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${t} ui-btn--size-${e}`,i!==void 0&&(this.element.setAttribute("aria-label",i),this.element.title=i),o!==void 0?this.element.appendChild(o):i!==void 0&&(this.element.textContent=i),s&&this.element.addEventListener("click",s),this.element.disabled=r}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const m={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},a={0:"0",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",9:"2.25rem",24:"6rem"};class ci{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:m.white,borderRadius:a[3],padding:a[6],boxShadow:`0 ${a[2]} ${a[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class ui{constructor(t={}){this.options=t,this.card=new ci,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}options;card;backdrop;keyHandler=null;open(){document.body.appendChild(this.backdrop),this.keyHandler=t=>{t.key==="Escape"&&this.close()},document.addEventListener("keydown",this.keyHandler)}close(){this.backdrop.remove(),this.keyHandler!==null&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null),this.options.onClose?.()}createBackdrop(){const t=document.createElement("div");return Object.assign(t.style,{position:"fixed",inset:a[0],background:"oklch(0% 0 0 / 50%)",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center"}),t.addEventListener("click",e=>{e.target===t&&this.close()}),t}}class di{element;selectCallback=null;constructor(t,e,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<t.length;o++){const s=t[o],r=document.createElement("button");r.className="ui-toggle-group-item",r.dataset.value=s,r.textContent=i?.[o]??s,r.dataset.state=s===e?"on":"off",r.setAttribute("aria-pressed",s===e?"true":"false"),r.addEventListener("click",()=>{this.selectCallback?.(s)}),this.element.appendChild(r)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class hi{element;select;constructor(t,e,i,o,s){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const r=document.createElement("option");r.value="",r.disabled=!0,r.textContent=i,this.select.appendChild(r);let l=!1;for(let u=0;u<e.length;u++){const p=e[u],v=document.createElement("option");v.value=p,v.textContent=s?.[u]??p,p===o&&(v.selected=!0,l=!0),this.select.appendChild(v)}l||(r.selected=!0);const d=Tt(Rt,{width:16,height:16,"stroke-width":2});d.classList.add("ui-native-select-icon"),this.element=document.createElement("div"),this.element.className="ui-native-select-wrap",this.element.appendChild(this.select),this.element.appendChild(d)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const _={fontFamily:{sans:["Mona Sans","ui-sans-serif","system-ui","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"]},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem"},fontWeight:{medium:"500",semibold:"600"}},mi=_.fontFamily.sans.join(", ");class pi{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(o=>o.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});this.dialog=new ui({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:a[3],fontFamily:mi}),this.dialog.card.element.appendChild(this.createText(xe(),{fontSize:_.fontSize.base,fontWeight:_.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Ne(),{fontSize:_.fontSize.sm,color:m.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(e)),this.dialog.card.element.appendChild(this.createText(ze(),{fontSize:_.fontSize.xs,color:m.neutral[500]}));const i=new b({variant:"outline",label:De(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(i.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",Object.assign(e.style,{width:a[24],height:a[24],borderRadius:a[1]}),e}}const E=_.fontFamily.sans.join(", "),fi=`
2
2
  --primary: oklch(5% 0 0);
3
3
  --primary-foreground: oklch(100% 0 0);
4
4
  --secondary: oklch(92% 0 0);
@@ -256,12 +256,12 @@
256
256
  color: var(--muted-foreground);
257
257
  margin-block-start: 0.25rem;
258
258
  }
259
- `;let it=!1;function bi(){if(it||typeof document>"u")return;it=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=gi,document.head.appendChild(n)}function ot(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function vi(n,t,e,i,o,s){const[r,l,d]=n,u=Math.cos(t),p=Math.sin(t),v=u*r+p*d,A=-p*r+u*d,S=Math.cos(e),w=Math.sin(e),R=S*l-w*A,L=w*l+S*A,W=.55;return[i+v*s*W,o-R*s*W,L]}function yi(n,t,e){n.beginPath(),n.moveTo(t[0],t[1]),n.lineTo(e[0],e[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function _i(n,t,e,i,o){const s=t(e),r=t(i),l=[s[0]+(r[0]-s[0])*o,s[1]+(r[1]-s[1])*o,s[2]];yi(n,s,l)}const M=[-1,-1,1],z=[1,-1,1],P=[1,-1,-1],F=[-1,-1,-1],D=[-1,1,1],$=[1,1,1],B=[1,1,-1],U=[-1,1,-1],st=[[M,z],[z,P],[P,F],[F,M],[M,D],[z,$],[P,B],[F,U],[D,$],[$,B],[B,U],[U,D]],Ci=400,rt='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function wi(){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fff",zIndex:"20",opacity:"0",transition:"opacity 0.3s ease-in-out"});const t=document.createElement("canvas");Object.assign(t.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const e=document.createElement("div");Object.assign(e.style,{position:"absolute",top:"56%",left:"0",right:"0",textAlign:"center",pointerEvents:"none"});const i=document.createElement("span");Object.assign(i.style,{fontSize:"13px",fontWeight:"400",color:"#000",fontVariantNumeric:"tabular-nums",fontFamily:rt});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:rt}),o.textContent=Et(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class ki{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=wi();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,t.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=e.showDelay??Ci;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Et(),rendering:Xe()}}updateProgress(t,e){this.hidden||(this.pctEl.textContent=`${Math.round(t)}%`,this.phaseEl.textContent=e!==""?` · ${e}`:"")}showError(t){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const e=Math.min(devicePixelRatio,2),i=this.canvas.width/e,o=this.canvas.height/e;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*e,o*e)}this.pctEl.textContent="",this.phaseEl.textContent=t,this.phaseEl.style.color="#b91c1c",this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity="0",this.overlay.addEventListener("transitionend",()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity="1")}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;const t=Math.min(devicePixelRatio,2),e=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=e*t,this.canvas.height=i*t,this.ctx.scale(t,t),this.ctx.lineCap="round",this.ctx.lineJoin="round"}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;const t=this.canvas.width/Math.min(devicePixelRatio,2),e=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,t,e);const o=t/2,s=e*.44,r=Math.min(t,e)*.08,l=.785,d=.615,u=w=>vi(w,l,d,o,s,r),p=6,v=i%p/p,A=st.length;let S;v<.35?S=ot(v/.35)*A:v<.55?S=A:v<.9?S=(1-ot((v-.55)/.35))*A:S=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let w=0;w<A&&!(w>=S);w++){const R=st[w];if(R===void 0)continue;const L=Math.min(1,S-w);_i(this.ctx,u,R[0],R[1],L)}this.ctx.shadowBlur=0}}class Si{constructor(t){this.options=t,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"flex",gap:"0.375rem"}),this.onFullscreenChange=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener("fullscreenchange",this.onFullscreenChange)}options;element;arBtn=null;fullscreenBtn=null;onFullscreenChange;setFullscreenIcon(t){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(t?g.exitFullscreen():g.fullscreen())}syncButton(t,e,i){if(e&&t===null){const o=i();return this.element.appendChild(o.element),o}return!e&&t!==null?(t.element.remove(),null):t}applySettings(t){this.arBtn=this.syncButton(this.arBtn,t.ar!==!1&&this.options.onAr!==void 0,()=>new b({variant:"outline",size:"icon",label:ke(),icon:g.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new b({variant:"outline",size:"icon",label:je(),icon:g.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const x=.5;class I{element;constructor(t,e){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:e.rotation,targetTilt:e.tilt,targetZoom:e.zoom,thetaOffset:0},o=Ai(t,e,i);e.onChange(s=>{i.targetRotation=s.rotation-i.thetaOffset,i.targetTilt=s.tilt,i.targetZoom=s.zoom,Ei(o,e,s)}),this.element.appendChild(I.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(I.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(t,e){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(t.element),i.appendChild(e.element),i}static buildDpad(t,e,i,o,s){const r=document.createElement("div");r.className="vd-dpad";for(const[l,d]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[s,"down"]])l.element.classList.add(`vd-dpad-${d}`),r.appendChild(l.element);return r}}function Ai(n,t,e){const i=r=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,r)),o=r=>{const l=t.limits?.minRotate,d=t.limits?.maxRotate;return l!==void 0||d!==void 0?Math.max(l??-1/0,Math.min(d??1/0,r)):r},s=r=>{const l=t.limits?.minTilt,d=t.limits?.maxTilt;if(l!==void 0||d!==void 0){e.targetTilt=Math.max(l??0,Math.min(d??180,e.targetTilt+r)),n.tilt(e.targetTilt).set();return}const u=e.targetTilt+r;u>180||u<0?(e.targetTilt=u>180?360-u:-u,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=u,n.tilt(e.targetTilt).set())};return{zoomOut:new b({variant:"outline",size:"icon",label:Cn(),icon:g.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new b({variant:"outline",size:"icon",label:bn(),icon:g.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new b({variant:"outline",size:"icon",label:Ln(),icon:g.tiltUp(),onClick:()=>{s(-15)}}),rotateLeft:new b({variant:"outline",size:"icon",label:An(),icon:g.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new b({variant:"outline",size:"icon",label:mn(),icon:g.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new b({variant:"outline",size:"icon",label:Rn(),icon:g.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new b({variant:"outline",size:"icon",label:Fn(),icon:g.tiltDown(),onClick:()=>{s(15)}})}}function Ei(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+x,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-x,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+x,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-x,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+x,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-x)}const xi=5;let Ti=0;function V(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Ri(n,t,e,i,o){const s=document.createElement("div");s.className="vd-attribute",s.dataset.name=n.name;const r=document.createElement("span");r.className="vd-attribute-label",r.textContent=V(n.name),r.id=`vd-attribute-label-${Ti++}`,s.appendChild(r),s.setAttribute("role","group"),s.setAttribute("aria-labelledby",r.id);const l=n.values.find(p=>t.getValue(n.name,p)?.isSelected===!0),d=n.values.map(V),u=n.values.length<=xi?new di(n.values,l,d):new hi(n.name,n.values,V(n.name),l,d);return u.onSelect(p=>{e.dispatch(T.SELECT,{attribute:n.name,value:p},!0).defaultPrevented||i(n.name,p)}),o(n.name,p=>{u.setSelected(p.value),e.dispatch(T.SELECTED,{attribute:n.name,value:p.value})}),s.appendChild(u.element),s}const Oi=80,Ni=2500;class Ii{constructor(t,e=Ni){this.configuration=t,this.resetMs=e,this.element=document.createElement("div"),this.element.className="vd-commerce vd-hidden";const i=document.createElement("div");i.className="vd-commerce-price",this.priceEl=document.createElement("span"),this.priceEl.className="vd-price",this.vatEl=document.createElement("span"),this.vatEl.className="vd-vat",i.append(this.priceEl,this.vatEl),this.button=new b({variant:"default",onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add("vd-cta","vd-hidden"),this.element.append(i,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}configuration;resetMs;element;priceEl;vatEl;button;unsubscribe;state="idle";resetTimer;update(){this.renderPrice(this.configuration.current),this.renderButton();const t=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!t)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(t){if(t===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=Li(t.price,t.currency),this.vatEl.textContent=at(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(at(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",Un());try{await this.configuration.submit(),this.setState("success",Gn())}catch{this.setState("failed",Yn())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(t,e){this.state=t,this.element.dataset.submit=t,this.button.element.disabled=t==="busy",this.setButtonText(e)}setButtonText(t){this.button.element.textContent=t,this.button.element.setAttribute("aria-label",t)}}function at(n){return(n??"").slice(0,Oi)}function Li(n,t){try{const e=new Intl.NumberFormat(h(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Ot{slot=null;panel=null;attach(t,e){this.panel=e,e.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(e),t.appendChild(this.slot)}setVisible(t){this.panel!==null&&(this.panel.style.display=t?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const Mi=572;class zi{element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new b({variant:"ghost",size:"icon-sm",label:cn(),icon:g.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});const i=document.createElement("div");i.className="vd-sidebar-header",i.appendChild(this.closeButton.element),this.body=document.createElement("div"),this.body.className="vd-sidebar-body",this.body.appendChild(e),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),t.appendChild(this.element),this.openButton=new b({variant:"outline",size:"default",label:sn(),icon:g.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),t.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<Mi)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",this.visible&&!this.expanded),this.openButton.element.classList.toggle("vd-hidden",!(this.visible&&!this.expanded)),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t)}}class Pi{attach(t,e){}setVisible(t){}destroy(){}}const Fi={"inframe-bottom-left":()=>new Ot,"sidebar-right":()=>new zi,hidden:()=>new Pi};function Di(n){return(Fi[n??""]??(()=>new Ot))()}const j=_.fontFamily.sans.join(", "),H=`
259
+ `;let it=!1;function bi(){if(it||typeof document>"u")return;it=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=gi,document.head.appendChild(n)}function ot(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function vi(n,t,e,i,o,s){const[r,l,d]=n,u=Math.cos(t),p=Math.sin(t),v=u*r+p*d,A=-p*r+u*d,S=Math.cos(e),w=Math.sin(e),R=S*l-w*A,L=w*l+S*A,W=.55;return[i+v*s*W,o-R*s*W,L]}function yi(n,t,e){n.beginPath(),n.moveTo(t[0],t[1]),n.lineTo(e[0],e[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function _i(n,t,e,i,o){const s=t(e),r=t(i),l=[s[0]+(r[0]-s[0])*o,s[1]+(r[1]-s[1])*o,s[2]];yi(n,s,l)}const M=[-1,-1,1],z=[1,-1,1],P=[1,-1,-1],F=[-1,-1,-1],$=[-1,1,1],D=[1,1,1],B=[1,1,-1],U=[-1,1,-1],st=[[M,z],[z,P],[P,F],[F,M],[M,$],[z,D],[P,B],[F,U],[$,D],[D,B],[B,U],[U,$]],Ci=400,rt='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function wi(){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fff",zIndex:"20",opacity:"0",transition:"opacity 0.3s ease-in-out"});const t=document.createElement("canvas");Object.assign(t.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const e=document.createElement("div");Object.assign(e.style,{position:"absolute",top:"56%",left:"0",right:"0",textAlign:"center",pointerEvents:"none"});const i=document.createElement("span");Object.assign(i.style,{fontSize:"13px",fontWeight:"400",color:"#000",fontVariantNumeric:"tabular-nums",fontFamily:rt});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:rt}),o.textContent=Et(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class ki{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=wi();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,t.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=e.showDelay??Ci;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Et(),rendering:Xe()}}updateProgress(t,e){this.hidden||(this.pctEl.textContent=`${Math.round(t)}%`,this.phaseEl.textContent=e!==""?` · ${e}`:"")}showError(t){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const e=Math.min(devicePixelRatio,2),i=this.canvas.width/e,o=this.canvas.height/e;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*e,o*e)}this.pctEl.textContent="",this.phaseEl.textContent=t,this.phaseEl.style.color="#b91c1c",this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity="0",this.overlay.addEventListener("transitionend",()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity="1")}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;const t=Math.min(devicePixelRatio,2),e=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=e*t,this.canvas.height=i*t,this.ctx.scale(t,t),this.ctx.lineCap="round",this.ctx.lineJoin="round"}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;const t=this.canvas.width/Math.min(devicePixelRatio,2),e=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,t,e);const o=t/2,s=e*.44,r=Math.min(t,e)*.08,l=.785,d=.615,u=w=>vi(w,l,d,o,s,r),p=6,v=i%p/p,A=st.length;let S;v<.35?S=ot(v/.35)*A:v<.55?S=A:v<.9?S=(1-ot((v-.55)/.35))*A:S=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let w=0;w<A&&!(w>=S);w++){const R=st[w];if(R===void 0)continue;const L=Math.min(1,S-w);_i(this.ctx,u,R[0],R[1],L)}this.ctx.shadowBlur=0}}class Si{constructor(t){this.options=t,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"flex",gap:"0.375rem"}),this.onFullscreenChange=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener("fullscreenchange",this.onFullscreenChange)}options;element;arBtn=null;fullscreenBtn=null;onFullscreenChange;setFullscreenIcon(t){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(t?g.exitFullscreen():g.fullscreen())}syncButton(t,e,i){if(e&&t===null){const o=i();return this.element.appendChild(o.element),o}return!e&&t!==null?(t.element.remove(),null):t}applySettings(t){this.arBtn=this.syncButton(this.arBtn,t.ar!==!1&&this.options.onAr!==void 0,()=>new b({variant:"outline",size:"icon",label:ke(),icon:g.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new b({variant:"outline",size:"icon",label:je(),icon:g.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const x=.5;class I{element;constructor(t,e){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:e.rotation,targetTilt:e.tilt,targetZoom:e.zoom,thetaOffset:0},o=Ai(t,e,i);e.onChange(s=>{i.targetRotation=s.rotation-i.thetaOffset,i.targetTilt=s.tilt,i.targetZoom=s.zoom,Ei(o,e,s)}),this.element.appendChild(I.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(I.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(t,e){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(t.element),i.appendChild(e.element),i}static buildDpad(t,e,i,o,s){const r=document.createElement("div");r.className="vd-dpad";for(const[l,d]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[s,"down"]])l.element.classList.add(`vd-dpad-${d}`),r.appendChild(l.element);return r}}function Ai(n,t,e){const i=r=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,r)),o=r=>{const l=t.limits?.minRotate,d=t.limits?.maxRotate;return l!==void 0||d!==void 0?Math.max(l??-1/0,Math.min(d??1/0,r)):r},s=r=>{const l=t.limits?.minTilt,d=t.limits?.maxTilt;if(l!==void 0||d!==void 0){e.targetTilt=Math.max(l??0,Math.min(d??180,e.targetTilt+r)),n.tilt(e.targetTilt).set();return}const u=e.targetTilt+r;u>180||u<0?(e.targetTilt=u>180?360-u:-u,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=u,n.tilt(e.targetTilt).set())};return{zoomOut:new b({variant:"outline",size:"icon",label:Cn(),icon:g.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new b({variant:"outline",size:"icon",label:bn(),icon:g.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new b({variant:"outline",size:"icon",label:Ln(),icon:g.tiltUp(),onClick:()=>{s(-15)}}),rotateLeft:new b({variant:"outline",size:"icon",label:An(),icon:g.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new b({variant:"outline",size:"icon",label:mn(),icon:g.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new b({variant:"outline",size:"icon",label:Rn(),icon:g.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new b({variant:"outline",size:"icon",label:Fn(),icon:g.tiltDown(),onClick:()=>{s(15)}})}}function Ei(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+x,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-x,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+x,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-x,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+x,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-x)}const xi=5;let Ti=0;function V(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Ri(n,t,e,i,o){const s=document.createElement("div");s.className="vd-attribute",s.dataset.name=n.name;const r=document.createElement("span");r.className="vd-attribute-label",r.textContent=V(n.name),r.id=`vd-attribute-label-${Ti++}`,s.appendChild(r),s.setAttribute("role","group"),s.setAttribute("aria-labelledby",r.id);const l=n.values.find(p=>t.getValue(n.name,p)?.isSelected===!0),d=n.values.map(V),u=n.values.length<=xi?new di(n.values,l,d):new hi(n.name,n.values,V(n.name),l,d);return u.onSelect(p=>{e.dispatch(T.SELECT,{attribute:n.name,value:p},!0).defaultPrevented||i(n.name,p)}),o(n.name,p=>{u.setSelected(p.value),e.dispatch(T.SELECTED,{attribute:n.name,value:p.value})}),s.appendChild(u.element),s}const Oi=80,Ni=2500;class Ii{constructor(t,e=Ni){this.configuration=t,this.resetMs=e,this.element=document.createElement("div"),this.element.className="vd-commerce vd-hidden";const i=document.createElement("div");i.className="vd-commerce-price",this.priceEl=document.createElement("span"),this.priceEl.className="vd-price",this.vatEl=document.createElement("span"),this.vatEl.className="vd-vat",i.append(this.priceEl,this.vatEl),this.button=new b({variant:"default",onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add("vd-cta","vd-hidden"),this.element.append(i,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}configuration;resetMs;element;priceEl;vatEl;button;unsubscribe;state="idle";resetTimer;update(){this.renderPrice(this.configuration.current),this.renderButton();const t=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!t)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(t){if(t===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=Li(t.price,t.currency),this.vatEl.textContent=at(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(at(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",Un());try{await this.configuration.submit(),this.setState("success",Gn())}catch{this.setState("failed",Yn())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(t,e){this.state=t,this.element.dataset.submit=t,this.button.element.disabled=t==="busy",this.setButtonText(e)}setButtonText(t){this.button.element.textContent=t,this.button.element.setAttribute("aria-label",t)}}function at(n){return(n??"").slice(0,Oi)}function Li(n,t){try{const e=new Intl.NumberFormat(h(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Ot{slot=null;panel=null;attach(t,e){this.panel=e,e.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(e),t.appendChild(this.slot)}setVisible(t){this.panel!==null&&(this.panel.style.display=t?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const Mi=572;class zi{element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new b({variant:"ghost",size:"icon-sm",label:cn(),icon:g.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});const i=document.createElement("div");i.className="vd-sidebar-header",i.appendChild(this.closeButton.element),this.body=document.createElement("div"),this.body.className="vd-sidebar-body",this.body.appendChild(e),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),t.appendChild(this.element),this.openButton=new b({variant:"outline",size:"default",label:sn(),icon:g.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),t.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right","vd-layout-sidebar-collapsed"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<Mi)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-collapsed",e)}}class Pi{attach(t,e){}setVisible(t){}destroy(){}}const Fi={"inframe-bottom-left":()=>new Ot,"sidebar-right":()=>new zi,hidden:()=>new Pi};function $i(n){return(Fi[n??""]??(()=>new Ot))()}const j=_.fontFamily.sans.join(", "),H=`
260
260
  position: absolute;
261
261
  display: flex;
262
262
  z-index: 10;
263
263
  transition: inset-inline-end 0.18s ease;
264
- `,$i=`
264
+ `,Di=`
265
265
  /* Override browser's default black fullscreen backdrop */
266
266
  .vd-container:fullscreen {
267
267
  background: oklch(100% 0 0);
@@ -412,6 +412,13 @@
412
412
  .vd-layout-sidebar-right .vd-slot-top-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${a[3]}); }
413
413
  .vd-layout-sidebar-right .vd-slot-bottom-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${a[3]}); }
414
414
 
415
+ /* while collapsed on a narrow embed, lift the bottom-right controls above the
416
+ floating toggle so the AR/fullscreen buttons aren't hidden behind the
417
+ "open configurator" button (spacing[9] = the default toggle button height) */
418
+ .vd-layout-sidebar-collapsed .vd-slot-bottom-right {
419
+ inset-block-end: calc(${a[3]} + ${a[9]} + ${a[1.5]});
420
+ }
421
+
415
422
  /* Price + CTA — sit under the attribute controls, separated by a hairline */
416
423
  .vd-commerce {
417
424
  display: flex;
@@ -451,4 +458,4 @@
451
458
  color: ${m.white};
452
459
  }
453
460
 
454
- `;function Bi(){if(bi(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=$i,document.head.appendChild(n)}function Ui(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class Vi{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){Bi(),this.container=t,this.loading=new ki(t),this.slots.topRight=this.createSlot(t,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(t,"vd-slot-bottom-right")}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display="flex"),this.layout?.setVisible(!0)}mountToolbar(){if(this.actionBar!==null||this.slots.bottomRight===null||this.container===null)return;const t=typeof this.container.requestFullscreen=="function";this.actionBar=new Si({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement!==null?document.exitFullscreen():this.container.requestFullscreen())}updateProgress(t,e){this.loading?.updateProgress(t,e)}showError(t){this.loading?.showError(t)}applyViewerSettings(t){this.settings=t,t.language!==void 0&&kt(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new I(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes";for(const i of e)this.attributes.appendChild(Ri(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new Ii(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=Di(this.settings.configuratorLayout),this.layout.attach(this.container,this.attributes)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new b({variant:"outline",size:"icon",label:tn(),icon:g.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{Ui(e,i)})}})),!t&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls!==null?this.cameraControls.element.appendChild(this.screenshotBtn.element):this.slots.topRight.appendChild(this.screenshotBtn.element))}}class Nt{constructor(t){this.send=t}send;placedCallbacks=[];setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,enabled:t})}startPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(t){this.placedCallbacks.push(t)}handlePlaced(t){for(const e of this.placedCallbacks)e(t)}}class ji{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;qrModal;options;iframe;container;viewerSessionId;readyCallbacks=[];mutationFailedCallbacks=[];constructor(t){this.options=t,this.initializeLogging(),this.messenger=new le(()=>this.iframe?.contentWindow??null);const e=i=>{this.messenger.send(i)};this.attributes=new ce(e,(i,o)=>{for(const s of this.mutationFailedCallbacks)s({attribute:i,value:o})}),this.snapshotApi=new _t(e),this.annotationsApi=new Nt(e),this.cameraApi=new gt(e),this.cameraPositionApi=new ue,this.focusApi=new bt(e,i=>{this.dispatchFocusChange(i)}),this.configurationApi=new vt(i=>{this.dispatchConfigurationChange(i)},i=>{this.dispatchConfigurationSubmit(i)}),this.eventBus=new me,this.qrModal=new pi,this.readyStateTracker=new Gt(()=>{const i=this.readyCallbacks;this.readyCallbacks=[];for(const o of i)o(this);this.ui.onReady()}),this.ui=new Vi({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(i,o)=>this.attributes.select(i,o),onSubscribe:(i,o)=>this.attributes.onChange(i,o),onAr:()=>{this.activateAr()}}),this.registerHandlers(),this.messenger.start(),this.createAndConnectIframe()}registerHandlers(){this.registerLifecycleHandlers(),this.messenger.on(c.MUTATION,t=>{Jt(t)&&(this.attributes.handleMutationResult(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()))}),this.messenger.on(c.SNAPSHOT,t=>{te(t)&&this.snapshotApi.handleSnapshotResult(t)}),this.messenger.on(c.CAMERA,t=>{ee(t)&&this.cameraPositionApi.handlePositionUpdate(t)}),this.messenger.on(c.LOADING_INDICATOR,t=>{ie(t)&&(t.error!==void 0?this.ui.showError(t.error):this.ui.updateProgress(t.progress,t.phase))}),this.messenger.on(c.CONFIG,t=>{oe(t)&&this.handleConfig(t)}),this.messenger.on(c.ANNOTATION_PLACED,t=>{se(t)&&this.annotationsApi.handlePlaced(t.position)}),this.messenger.on(c.MAPPING,t=>{ne(t)&&(this.attributes.handleMappingReceived(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()),this.ui.renderAttributeControls(this.attributes,t.attributes),this.readyStateTracker.handleMappingReceived())}),this.registerFacadeStateHandlers()}registerLifecycleHandlers(){this.messenger.on(c.HANDSHAKE,t=>{Kt(t)&&(exports.logger.info("Server handshake received, flushing publisher queue"),this.messenger.markReady())}),this.messenger.on(c.SESSION,t=>{Qt(t)&&(this.viewerSessionId=t.sessionId)})}registerFacadeStateHandlers(){this.messenger.on(c.FOCUS,t=>{re(t)&&this.focusApi.handleStateReceived(t)}),this.messenger.on(c.PRICING,t=>{ae(t)&&this.configurationApi.handlePricingReceived(t.pricing)})}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(T.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=this.options.viewerSettings;if(e!==void 0||i!==void 0){const o=i!==void 0?{...e??{},...i}:e;if(i!==void 0&&e!==void 0){const s=Object.entries(i).filter(([r,l])=>e[r]!==l).map(([r,l])=>`${r} (metadata: ${e[r]??"undefined"}, override: ${l})`);s.length>0&&exports.logger.warn(`Viewer settings override active: ${s.join(", ")}`)}this.ui.applyViewerSettings(o),this.annotationsApi.setEnabled(o.annotations!==!1)}this.cameraPositionApi.applyLimits(t.cameraLimits)}activateAr(){if(jt()){this.messenger.send({type:c.AR_ACTIVATE});return}this.qrModal.show(this.iframe?.src??"")}initializeLogging(){this.options.debug===!0&&mt(),exports.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new Lt(this.options).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get viewerSettings(){return this.ui.viewerSettings}get sessionId(){return this.viewerSessionId}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.qrModal.hide(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}}exports.Annotations=Nt;exports.Attribute=ft;exports.AttributeValue=pt;exports.Camera=gt;exports.Configuration=vt;exports.ERROR_CODES=k;exports.Focus=bt;exports.Photo=yt;exports.Snapshot=_t;exports.VD_EVENTS=T;exports.VirtualdisplayClient=ji;exports.VirtualdisplayError=f;exports.enableDebugMode=mt;exports.isDebugMode=Ht;
461
+ `;function Bi(){if(bi(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=Di,document.head.appendChild(n)}function Ui(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class Vi{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){Bi(),this.container=t,this.loading=new ki(t),this.slots.topRight=this.createSlot(t,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(t,"vd-slot-bottom-right")}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display="flex"),this.layout?.setVisible(!0)}mountToolbar(){if(this.actionBar!==null||this.slots.bottomRight===null||this.container===null)return;const t=typeof this.container.requestFullscreen=="function";this.actionBar=new Si({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement!==null?document.exitFullscreen():(this.options.onFullscreenEnter?.(),this.container.requestFullscreen()))}updateProgress(t,e){this.loading?.updateProgress(t,e)}showError(t){this.loading?.showError(t)}applyViewerSettings(t){this.settings=t,t.language!==void 0&&kt(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new I(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes";for(const i of e)this.attributes.appendChild(Ri(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new Ii(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=$i(this.settings.configuratorLayout),this.layout.attach(this.container,this.attributes)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new b({variant:"outline",size:"icon",label:tn(),icon:g.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{Ui(e,i)})}})),!t&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls!==null?this.cameraControls.element.appendChild(this.screenshotBtn.element):this.slots.topRight.appendChild(this.screenshotBtn.element))}}class Nt{constructor(t){this.send=t}send;placedCallbacks=[];setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,enabled:t})}startPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:c.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(t){this.placedCallbacks.push(t)}handlePlaced(t){for(const e of this.placedCallbacks)e(t)}}class ji{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;qrModal;options;iframe;container;viewerSessionId;readyCallbacks=[];mutationFailedCallbacks=[];constructor(t){this.options=t,this.initializeLogging(),this.messenger=new le(()=>this.iframe?.contentWindow??null);const e=i=>{this.messenger.send(i)};this.attributes=new ce(e,(i,o)=>{for(const s of this.mutationFailedCallbacks)s({attribute:i,value:o})}),this.snapshotApi=new _t(e),this.annotationsApi=new Nt(e),this.cameraApi=new gt(e),this.cameraPositionApi=new ue,this.focusApi=new bt(e,i=>{this.dispatchFocusChange(i)}),this.configurationApi=new vt(i=>{this.dispatchConfigurationChange(i)},i=>{this.dispatchConfigurationSubmit(i)}),this.eventBus=new me,this.qrModal=new pi,this.readyStateTracker=new Gt(()=>{const i=this.readyCallbacks;this.readyCallbacks=[];for(const o of i)o(this);this.ui.onReady()}),this.ui=new Vi({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(i,o)=>this.attributes.select(i,o),onSubscribe:(i,o)=>this.attributes.onChange(i,o),onAr:()=>{this.activateAr()},onFullscreenEnter:()=>{this.trackFullscreen()}}),this.registerHandlers(),this.messenger.start(),this.createAndConnectIframe()}registerHandlers(){this.registerLifecycleHandlers(),this.messenger.on(c.MUTATION,t=>{Jt(t)&&(this.attributes.handleMutationResult(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()))}),this.messenger.on(c.SNAPSHOT,t=>{te(t)&&this.snapshotApi.handleSnapshotResult(t)}),this.messenger.on(c.CAMERA,t=>{ee(t)&&this.cameraPositionApi.handlePositionUpdate(t)}),this.messenger.on(c.LOADING_INDICATOR,t=>{ie(t)&&(t.error!==void 0?this.ui.showError(t.error):this.ui.updateProgress(t.progress,t.phase))}),this.messenger.on(c.CONFIG,t=>{oe(t)&&this.handleConfig(t)}),this.messenger.on(c.ANNOTATION_PLACED,t=>{se(t)&&this.annotationsApi.handlePlaced(t.position)}),this.messenger.on(c.MAPPING,t=>{ne(t)&&(this.attributes.handleMappingReceived(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()),this.ui.renderAttributeControls(this.attributes,t.attributes),this.readyStateTracker.handleMappingReceived())}),this.registerFacadeStateHandlers()}registerLifecycleHandlers(){this.messenger.on(c.HANDSHAKE,t=>{Kt(t)&&(exports.logger.info("Server handshake received, flushing publisher queue"),this.messenger.markReady())}),this.messenger.on(c.SESSION,t=>{Qt(t)&&(this.viewerSessionId=t.sessionId)})}registerFacadeStateHandlers(){this.messenger.on(c.FOCUS,t=>{re(t)&&this.focusApi.handleStateReceived(t)}),this.messenger.on(c.PRICING,t=>{ae(t)&&this.configurationApi.handlePricingReceived(t.pricing)})}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(T.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=this.options.viewerSettings;if(e!==void 0||i!==void 0){const o=i!==void 0?{...e??{},...i}:e;if(i!==void 0&&e!==void 0){const s=Object.entries(i).filter(([r,l])=>e[r]!==l).map(([r,l])=>`${r} (metadata: ${e[r]??"undefined"}, override: ${l})`);s.length>0&&exports.logger.warn(`Viewer settings override active: ${s.join(", ")}`)}this.ui.applyViewerSettings(o),this.annotationsApi.setEnabled(o.annotations!==!1)}this.cameraPositionApi.applyLimits(t.cameraLimits)}activateAr(){if(jt()){this.messenger.send({type:c.AR_ACTIVATE});return}this.qrModal.show(this.iframe?.src??"")}trackFullscreen(){this.messenger.send({type:c.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&mt(),exports.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new Lt(this.options).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get viewerSettings(){return this.ui.viewerSettings}get sessionId(){return this.viewerSessionId}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.qrModal.hide(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}}exports.Annotations=Nt;exports.Attribute=ft;exports.AttributeValue=pt;exports.Camera=gt;exports.Configuration=vt;exports.ERROR_CODES=k;exports.Focus=bt;exports.Photo=yt;exports.Snapshot=_t;exports.VD_EVENTS=T;exports.VirtualdisplayClient=ji;exports.VirtualdisplayError=f;exports.enableDebugMode=mt;exports.isDebugMode=Ht;
@@ -359,6 +359,7 @@ const c = {
359
359
  SNAPSHOT: "snapshot",
360
360
  MAPPING: "mapping",
361
361
  AR_ACTIVATE: "ar_activate",
362
+ FULLSCREEN: "fullscreen",
362
363
  CONFIG: "config",
363
364
  ANNOTATION_PLACE_MODE: "annotation_place_mode",
364
365
  ANNOTATION_PLACED: "annotation_placed",
@@ -1331,7 +1332,7 @@ const ye = (
1331
1332
  /** @type {(inputs: Controls_Qr_Modaldescription1Inputs) => LocalizedString} */
1332
1333
  () => (
1333
1334
  /** @type {LocalizedString} */
1334
- "Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen"
1335
+ "Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen"
1335
1336
  )
1336
1337
  ), Oe = (
1337
1338
  /** @type {((inputs?: Controls_Qr_Modaldescription1Inputs, options?: { locale?: "en" | "nl" | "de" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Controls_Qr_Modaldescription1Inputs, { locale?: "en" | "nl" | "de" }, {}>} */
@@ -1355,7 +1356,7 @@ const ye = (
1355
1356
  /** @type {(inputs: Controls_Qr_Modalinstructions1Inputs) => LocalizedString} */
1356
1357
  () => (
1357
1358
  /** @type {LocalizedString} */
1358
- "Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet"
1359
+ "Dein Telefon öffnet das 3D-Modell im AR-Modus."
1359
1360
  )
1360
1361
  ), Me = (
1361
1362
  /** @type {((inputs?: Controls_Qr_Modalinstructions1Inputs, options?: { locale?: "en" | "nl" | "de" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Controls_Qr_Modalinstructions1Inputs, { locale?: "en" | "nl" | "de" }, {}>} */
@@ -2785,7 +2786,7 @@ class Mi {
2785
2786
  this.visible = t, this.render();
2786
2787
  }
2787
2788
  destroy() {
2788
- this.observer?.disconnect(), this.observer = null, this.openButton?.element.remove(), this.element?.remove(), this.container?.classList.remove("vd-layout-sidebar-right"), this.container = null;
2789
+ this.observer?.disconnect(), this.observer = null, this.openButton?.element.remove(), this.element?.remove(), this.container?.classList.remove("vd-layout-sidebar-right", "vd-layout-sidebar-collapsed"), this.container = null;
2789
2790
  }
2790
2791
  observe() {
2791
2792
  typeof ResizeObserver > "u" || this.container === null || (this.observer = new ResizeObserver((t) => {
@@ -2799,8 +2800,8 @@ class Mi {
2799
2800
  render() {
2800
2801
  if (this.element === null || this.openButton === null || this.closeButton === null || this.container === null)
2801
2802
  return;
2802
- const t = this.visible && this.expanded;
2803
- this.element.classList.toggle("vd-hidden", !this.visible), this.element.classList.toggle("vd-sidebar-collapsed", this.visible && !this.expanded), this.openButton.element.classList.toggle("vd-hidden", !(this.visible && !this.expanded)), this.closeButton.element.style.display = this.collapsible ? "" : "none", this.container.classList.toggle("vd-layout-sidebar-right", t);
2803
+ const t = this.visible && this.expanded, e = this.visible && !this.expanded;
2804
+ this.element.classList.toggle("vd-hidden", !this.visible), this.element.classList.toggle("vd-sidebar-collapsed", e), this.openButton.element.classList.toggle("vd-hidden", !e), this.closeButton.element.style.display = this.collapsible ? "" : "none", this.container.classList.toggle("vd-layout-sidebar-right", t), this.container.classList.toggle("vd-layout-sidebar-collapsed", e);
2804
2805
  }
2805
2806
  }
2806
2807
  class zi {
@@ -2975,6 +2976,13 @@ const H = _.fontFamily.sans.join(", "), G = `
2975
2976
  .vd-layout-sidebar-right .vd-slot-top-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${a[3]}); }
2976
2977
  .vd-layout-sidebar-right .vd-slot-bottom-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${a[3]}); }
2977
2978
 
2979
+ /* while collapsed on a narrow embed, lift the bottom-right controls above the
2980
+ floating toggle so the AR/fullscreen buttons aren't hidden behind the
2981
+ "open configurator" button (spacing[9] = the default toggle button height) */
2982
+ .vd-layout-sidebar-collapsed .vd-slot-bottom-right {
2983
+ inset-block-end: calc(${a[3]} + ${a[9]} + ${a[1.5]});
2984
+ }
2985
+
2978
2986
  /* Price + CTA — sit under the attribute controls, separated by a hairline */
2979
2987
  .vd-commerce {
2980
2988
  display: flex;
@@ -3058,7 +3066,7 @@ class Ui {
3058
3066
  }), this.actionBar.applySettings(this.settings), this.slots.bottomRight.appendChild(this.actionBar.element), this.syncScreenshotButton(), this.placeScreenshotButton();
3059
3067
  }
3060
3068
  toggleFullscreen() {
3061
- this.container !== null && (document.fullscreenElement !== null ? document.exitFullscreen() : this.container.requestFullscreen());
3069
+ this.container !== null && (document.fullscreenElement !== null ? document.exitFullscreen() : (this.options.onFullscreenEnter?.(), this.container.requestFullscreen()));
3062
3070
  }
3063
3071
  updateProgress(t, e) {
3064
3072
  this.loading?.updateProgress(t, e);
@@ -3203,6 +3211,9 @@ class Gi {
3203
3211
  onSubscribe: (i, o) => this.attributes.onChange(i, o),
3204
3212
  onAr: () => {
3205
3213
  this.activateAr();
3214
+ },
3215
+ onFullscreenEnter: () => {
3216
+ this.trackFullscreen();
3206
3217
  }
3207
3218
  }), this.registerHandlers(), this.messenger.start(), this.createAndConnectIframe();
3208
3219
  }
@@ -3282,6 +3293,10 @@ class Gi {
3282
3293
  }
3283
3294
  this.qrModal.show(this.iframe?.src ?? "");
3284
3295
  }
3296
+ /** Tell the viewer the user entered fullscreen, so it records the engagement. */
3297
+ trackFullscreen() {
3298
+ this.messenger.send({ type: c.FULLSCREEN });
3299
+ }
3285
3300
  initializeLogging() {
3286
3301
  this.options.debug === !0 && Pt(), C.info("Initializing Virtualdisplay client", { model: this.options.model });
3287
3302
  }
@@ -1,4 +1,4 @@
1
- (function(M,et){typeof exports=="object"&&typeof module<"u"?et(exports):typeof define=="function"&&define.amd?define(["exports"],et):(M=typeof globalThis<"u"?globalThis:M||self,et(M.VirtualdisplayClient={}))})(this,(function(M){"use strict";function et(n,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in n)){const r=Object.getOwnPropertyDescriptor(i,o);r&&Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const V={NO_MAPPING:"NO_MAPPING",ATTRIBUTE_NOT_FOUND:"ATTRIBUTE_NOT_FOUND",VALUE_NOT_FOUND:"VALUE_NOT_FOUND",PARENT_NOT_FOUND:"PARENT_NOT_FOUND",INVALID_PARAMETER:"INVALID_PARAMETER",SNAPSHOT_FAILED:"SNAPSHOT_FAILED"};class x extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static valueNotFound(t,e){return new x(`Value "${e}" not found for attribute "${t}"`,V.VALUE_NOT_FOUND)}static parentNotFound(t){return new x(`Parent element not found: ${t}`,V.PARENT_NOT_FOUND)}static invalidParameter(t){return new x(t,V.INVALID_PARAMETER)}}const bn={};class vn{defaultServer="https://server.virtualdisplay.io";options;constructor(t){this.options=t}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),Object.assign(t.style,{width:"100%",height:"100%",border:"none",display:"block"}),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);return e.searchParams.set("license",this.options.license),e.searchParams.set("model",this.options.model),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(bn?.VITE_VIRTUALDISPLAY_SERVER_HOST===void 0)return this.defaultServer}getParentElement(){if(typeof this.options.parent!="string")return this.options.parent;const t=document.querySelector(this.options.parent);if(t===null)throw x.parentNotFound(this.options.parent);return t}}function yn(n){const t=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),e=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,r=["timestamp","level","msg","service","trace_id","span_id"],s=Object.entries(n).filter(([a])=>!r.includes(a)).map(([a,l])=>`${a}=${JSON.stringify(l)}`).join(" ");return`${t} ${e} [${i}] ${o}${s?" "+s:""}`}function wn(n){return JSON.stringify(n)}function Cn(n,t){const e=t?yn(n):wn(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function Wt(n,t=0){const e={name:n.name,message:n.message};n.stack!==void 0&&(e.stack=n.stack);for(const i of Object.getOwnPropertyNames(n)){if(i==="name"||i==="message"||i==="stack"||i==="cause")continue;const o=n[i];o!==void 0&&(e[i]=o)}return n.cause!==void 0&&n.cause!==null&&(e.cause=n.cause instanceof Error&&t<5?Wt(n.cause,t+1):String(n.cause)),e}function En(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?Wt(i):i;return t}function _n(){return new Date}function Sn(n){return n.toISOString()}function Qt(){return typeof navigator>"u"?"":navigator.userAgent}function An(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function kn(){return/iPhone|iPad|iPod/i.test(Qt())||An()}function Tn(){return/Android/i.test(Qt())}function Rn(){return kn()||Tn()}class ct{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},r={timestamp:Sn(_n()),level:t,msg:e,service:this.config.service,...o,...En(i)};Cn(r,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}with(t){const e=new ct(this.config);return e.log=((i,o,r={})=>{this.log(i,o,{...t,...r})}).bind(this),e}}function Xt(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new ct({service:n,isDev:e,traceProvider:t?.traceProvider})}function ot(n){if(n!==void 0)return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof Error)?n:n instanceof Error?{error:n.message}:{value:n}}function te(n){return{debug:(t,e)=>n.debug(t,ot(e)),info:(t,e)=>n.info(t,ot(e)),warn:(t,e)=>n.warn(t,ot(e)),error:(t,e)=>n.error(t,ot(e))}}let ee=!1;M.logger=te(Xt("client",{isDev:!1}));function ne(){ee=!0,M.logger=te(Xt("client",{isDev:!0}))}function Nn(){return ee}class In{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,M.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}const Z={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"};class ie{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}class oe{name;defaultValue;values;onSelect;onChangeCallback;constructor(t){this.name=t.name,this.defaultValue=t.defaultValue,this.onSelect=t.onSelect,this.values=this.createValues(t.values)}select(t){if(!this.values.has(t))throw x.valueNotFound(this.name,t);this.onSelect(this.name,t)}getValues(){return Array.from(this.values.values())}getValue(t){return this.values.get(t)}get selected(){for(const t of this.values.values())if(t.isSelected)return t.value}onChange(t){this.onChangeCallback=t}handleResult(t){let e;for(const i of this.values.values()){const o=i.value===t;i.setSelected(o),o&&(e=i)}e!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(e)}createValues(t){const e=new Map;for(const i of t){const o=new ie(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class Mn{attributes=new Map;constructor(t,e,i){for(const o of t){const r=this.buildOptions(o,e);this.attributes.set(o.name,new oe(r))}this.onMutationFailed=i}onMutationFailed;get(t){return this.attributes.get(t)}getSelection(){const t={};for(const[e,i]of this.attributes){const o=i.selected;o!==void 0&&(t[e]=o)}return t}handleResults(t){for(const e of t){if(!e.success){this.onMutationFailed?.(e.name,e.value);continue}this.get(e.name)?.handleResult(e.value)}}buildOptions(t,e){const i={name:t.name,values:t.values,onSelect:(o,r)=>{e([{name:o,value:r}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}const I={HANDSHAKE:"handshake",SESSION:"session",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",CONFIG:"config",ANNOTATION_PLACE_MODE:"annotation_place_mode",ANNOTATION_PLACED:"annotation_placed",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing"},re={FOCUS:"focus",UNFOCUS:"unfocus"},Pn={FOCUSED:"focused"},Bn={HIDDEN:"hidden"},Ln=new Set(Object.values(I));function On(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Ln.has(t.type)}function xn(n){const t=$(n);return t!==null&&t.type===I.HANDSHAKE}function Dn(n){const t=$(n);return t!==null&&t.type===I.SESSION&&typeof t.sessionId=="string"}function zn(n){const t=$(n);return t!==null&&t.type===I.MUTATION&&Array.isArray(t.results)}function Fn(n){const t=$(n);return t!==null&&t.type===I.SNAPSHOT&&("data"in t||"error"in t)}function Un(n){const t=$(n);return t!==null&&t.type===I.CAMERA&&Array.isArray(t.transforms)}function $n(n){const t=$(n);return t!==null&&t.type===I.MAPPING&&Array.isArray(t.attributes)}function Vn(n){const t=$(n);return t!==null&&t.type===I.LOADING_INDICATOR&&typeof t.progress=="number"}function qn(n){const t=$(n);return t!==null&&t.type===I.CONFIG&&typeof t.viewerSettings=="object"}function jn(n){const t=$(n);return t!==null&&t.type===I.ANNOTATION_PLACED&&typeof t.position=="object"&&t.position!==null}function Hn(n){const t=$(n);return t!==null&&t.type===I.FOCUS&&typeof t.state=="string"}function Gn(n){const t=$(n);return t!==null&&t.type===I.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function $(n){return typeof n!="object"||n===null?null:n}class se{constructor(t){this.processor=t}processor;pending=[];isReady=!1;enqueue(t){if(this.isReady){this.processor(t);return}this.pending.push(t)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;const t=[...this.pending];this.pending.length=0;for(const e of t)this.processor(e)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(t){return this.pending.some(e=>e.type===t)}clear(){this.pending.length=0}}class Kn{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.publisher=new se(i=>this.post(i)),this.consumer=new se(i=>this.routeToHandler(i)),this.shouldBuffer=e?.shouldBuffer??null,e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;on(t,e){this.handlers.set(t,e)}off(t){this.handlers.delete(t)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!On(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;if(this.shouldBuffer!==null&&!this.shouldBuffer(o)){this.routeToHandler(o);return}this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const r=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${r}`)})}}class Yn{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){M.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new Mn(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){M.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:I.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&M.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let ae=class{constructor(t){this.send=t}send;commands=[];rotate(t){return this.validateFiniteNumber(t,"rotate"),this.commands.push({action:"rotate",value:t}),this}tilt(t){return this.validateFiniteNumber(t,"tilt"),this.commands.push({action:"tilt",value:t}),this}zoom(t){return this.validateFiniteNumber(t,"zoom"),this.commands.push({action:"zoom",value:t}),this}set(){if(this.commands.length===0)throw x.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:I.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw x.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:I.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class Jn{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(t){this.changeCallbacks.push(t)}get limits(){return this.limitsState}applyLimits(t){this.limitsState=t;const e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(e)}handlePositionUpdate(t){this.update(t.transforms)}update(t){let e=!1;for(const i of t)switch(i.type){case"rotation":this.state.rotation=i.value,e=!0;break;case"tilt":this.state.tilt=i.value,e=!0;break;case"zoom":this.state.zoom=i.value,e=!0;break}if(e){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}class le{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw x.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:I.FOCUS,action:re.FOCUS,component:t})}clear(){this.send({type:I.FOCUS,action:re.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Pn.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}function Zn(n,t){const e=n.filter(r=>Wn(r,t));if(e.length===0)return;const i=Math.max(...e.map(ce)),o=e.filter(r=>ce(r)===i);return o.length===1?o[0]:void 0}function Wn(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function ce(n){return Object.keys(n.attributes).length}class ue{constructor(t,e){this.dispatchChange=t,this.dispatchSubmit=e}dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){const t=this.pricing?.buttonLabel;if(t!=null&&t!=="")return t;if(this.submitDefaultLabel!==void 0&&this.submitDefaultLabel!=="")return this.submitDefaultLabel}get submittable(){return this.submitCallback===void 0?!1:this.pricing===void 0?!0:this.resolved?.availability==="available"}get submitEnabled(){return this.submittable&&this.buttonLabel!==void 0}onChange(t){this.changeCallbacks.push(t)}onSubmit(t,e){this.submitCallback=t,this.submitDefaultLabel=e?.defaultLabel,this.notifyRender()}onRender(t){return this.renderCallbacks.push(t),()=>{const e=this.renderCallbacks.indexOf(t);e!==-1&&this.renderCallbacks.splice(e,1)}}async submit(){if(!this.submittable)return;const t=this.resolved!==void 0?{attributes:this.resolved.attributes,reference:this.resolved.reference}:{attributes:{...this.selection},reference:""};this.dispatchSubmit(t),await this.submitCallback?.(t)}handlePricingReceived(t){this.pricing=t,this.recompute()}handleSelectionChanged(t){this.selection=t,this.recompute()}recompute(){this.resolved=this.resolve();for(const t of this.changeCallbacks)t(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(const t of this.renderCallbacks)t()}resolve(){if(this.pricing===void 0)return;const t=Zn(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===Bn.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class de{constructor(t){this.filename=t}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(t){return this.developed&&this.photoData!==null?(t(this.photoData),this):(this.developedCallbacks.add(t),this)}onError(t){return this.errorCallbacks.add(t),this}getFilename(){return this.filename}develop(t){this.developed||this.failed||(this.photoData=t,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(t){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(e=>{e(t)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}const he=3e4;class fe{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),M.logger.debug("Taking snapshot",{filename:t});const e=new de(t),i=setTimeout(()=>{this.pendingPhotos.delete(t),M.logger.warn("Snapshot timed out",{filename:t}),e.fail(new x(`Snapshot timed out: the viewer did not respond within ${he}ms`,V.SNAPSHOT_FAILED))},he);return this.pendingPhotos.set(t,{photo:e,timeout:i}),this.send({type:I.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){M.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}clearTimeout(e.timeout),this.pendingPhotos.delete(t.filename);const{photo:i}=e;if(t.error!==void 0){i.fail(new x(t.error,V.SNAPSHOT_FAILED));return}t.data!==void 0&&i.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new x("Client destroyed before snapshot completed",V.SNAPSHOT_FAILED);for(const{photo:e,timeout:i}of this.pendingPhotos.values())clearTimeout(i),e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new x("Filename must be a non-empty string",V.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new x(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,V.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new x('Filename cannot contain path separators or ".."',V.INVALID_PARAMETER)}}class Qn{container=null;attach(t){this.container=t}dispatch(t,e,i=!1){const o=new CustomEvent(t,{detail:e,cancelable:i});return this.container?.dispatchEvent(o),o}on(t,e){const i=o=>{const r=o,s={...r.detail,preventDefault:()=>{r.preventDefault()}};e(s)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const Xn={},ti="en",ge=["en","nl","de"],ut=["baseLocale"],me=[];let pe,be;function ei(n){if(me.length===0)return;const t=typeof n=="string"?n:n.href;if(pe===t)return be;const e=new URL(t,"http://dummy.com");let i;for(const o of me)if(new Xn(o.match,e.href).exec(e.href)){i=o;break}return pe=t,be=i,i}function ve(n){const t=ei(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:ut}const dt=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let ye=!1,P=()=>{let n=ut;!dt&&typeof window<"u"&&window.location?.href&&(n=ve(window.location.href));const t=ni(n);if(t)return ye||(ye=!0,we(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function ni(n,t){let e;for(const i of n){if(i==="baseLocale")e=ti;else if(Ee(i)&&rt.has(i)){const r=rt.get(i);if(r){const s=r.getLocale();if(s instanceof Promise)continue;if(s!==void 0)return oi(s)}}const o=Ce(e);if(o)return o}}const ii=n=>{window.location.reload()};let we=(n,t)=>{const e={reload:!0,...t};let i;try{i=P()}catch{}const o=[];let r=ut;!dt&&typeof window<"u"&&window.location?.href&&(r=ve(window.location.href));for(const a of r)if(a!=="baseLocale"&&Ee(a)&&rt.has(a)){const l=rt.get(a);if(l){let c=l.setLocale(n);c instanceof Promise&&(c=c.catch(u=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:u})}),o.push(c))}}const s=()=>{!dt&&e.reload&&window.location&&n!==i&&ii()};if(o.length)return Promise.all(o).then(()=>{s()});s()};function Ce(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of ge)if(e.toLowerCase()===t)return e}function oi(n){const t=Ce(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${ge.join(", ")}`)}const rt=new Map;function Ee(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const ri=()=>"Activate AR",si=()=>"AR activeren",ai=()=>"AR aktivieren",li=((n={},t={})=>{const e=t.locale??P();return e==="en"?ri():e==="nl"?si():ai()}),ci=()=>"Scan to view in AR",ui=()=>"Scan om in AR te bekijken",di=()=>"Scannen für AR-Ansicht",hi=((n={},t={})=>{const e=t.locale??P();return e==="en"?ci():e==="nl"?ui():di()}),fi=()=>"Use your smartphone camera to scan this QR code",gi=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",mi=()=>"Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen",pi=((n={},t={})=>{const e=t.locale??P();return e==="en"?fi():e==="nl"?gi():mi()}),bi=()=>"Your phone will open the 3D model in AR mode.",vi=()=>"Je telefoon opent het 3D-model in AR-modus.",yi=()=>"Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet",wi=((n={},t={})=>{const e=t.locale??P();return e==="en"?bi():e==="nl"?vi():yi()}),Ci=()=>"Close",Ei=()=>"Sluiten",_i=()=>"Schließen",Si=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ci():e==="nl"?Ei():_i()}),Ai=()=>"Fullscreen",ki=()=>"Volledig scherm",Ti=()=>"Vollbild",Ri=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ai():e==="nl"?ki():Ti()}),Ni=()=>"Downloading",Ii=()=>"Downloaden",Mi=()=>"Herunterladen",_e=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ni():e==="nl"?Ii():Mi()}),Pi=()=>"Rendering",Bi=()=>"Renderen",Li=()=>"Rendern",Oi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Pi():e==="nl"?Bi():Li()}),xi=()=>"Screenshot",Di=()=>"Screenshot",zi=()=>"Screenshot",Fi=((n={},t={})=>{const e=t.locale??P();return e==="en"?xi():e==="nl"?Di():zi()}),Ui=()=>"Configure",$i=()=>"Configureren",Vi=()=>"Konfigurieren",qi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ui():e==="nl"?$i():Vi()}),ji=()=>"Close",Hi=()=>"Sluiten",Gi=()=>"Schließen",Ki=((n={},t={})=>{const e=t.locale??P();return e==="en"?ji():e==="nl"?Hi():Gi()}),Yi=()=>"Reset camera",Ji=()=>"Camera resetten",Zi=()=>"Kamera zurücksetzen",Wi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Yi():e==="nl"?Ji():Zi()}),Qi=()=>"Zoom in",Xi=()=>"Inzoomen",to=()=>"Hineinzoomen",eo=((n={},t={})=>{const e=t.locale??P();return e==="en"?Qi():e==="nl"?Xi():to()}),no=()=>"Zoom out",io=()=>"Uitzoomen",oo=()=>"Herauszoomen",ro=((n={},t={})=>{const e=t.locale??P();return e==="en"?no():e==="nl"?io():oo()}),so=()=>"Rotate left",ao=()=>"Naar links draaien",lo=()=>"Nach links drehen",co=((n={},t={})=>{const e=t.locale??P();return e==="en"?so():e==="nl"?ao():lo()}),uo=()=>"Rotate right",ho=()=>"Naar rechts draaien",fo=()=>"Nach rechts drehen",go=((n={},t={})=>{const e=t.locale??P();return e==="en"?uo():e==="nl"?ho():fo()}),mo=()=>"Tilt up",po=()=>"Omhoog kantelen",bo=()=>"Nach oben kippen",vo=((n={},t={})=>{const e=t.locale??P();return e==="en"?mo():e==="nl"?po():bo()}),yo=()=>"Tilt down",wo=()=>"Omlaag kantelen",Co=()=>"Nach unten kippen",Eo=((n={},t={})=>{const e=t.locale??P();return e==="en"?yo():e==="nl"?wo():Co()}),_o=()=>"Working…",So=()=>"Bezig…",Ao=()=>"Läuft…",ko=((n={},t={})=>{const e=t.locale??P();return e==="en"?_o():e==="nl"?So():Ao()}),To=()=>"Done",Ro=()=>"Gelukt",No=()=>"Fertig",Io=((n={},t={})=>{const e=t.locale??P();return e==="en"?To():e==="nl"?Ro():No()}),Mo=()=>"Failed",Po=()=>"Mislukt",Bo=()=>"Fehlgeschlagen",Lo=((n={},t={})=>{const e=t.locale??P();return e==="en"?Mo():e==="nl"?Po():Bo()});const Oo={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Se=([n,t,e])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(t).forEach(o=>{i.setAttribute(o,String(t[o]))}),e?.length&&e.forEach(o=>{const r=Se(o);i.appendChild(r)}),i},Ae=(n,t={})=>{const i={...Oo,...t};return Se(["svg",i,n])};const xo=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];const Do=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];const ke=[["path",{d:"m6 9 6 6 6-6"}]];const zo=[["path",{d:"m15 18-6-6 6-6"}]];const Fo=[["path",{d:"m9 18 6-6-6-6"}]];const Uo=[["path",{d:"m18 15-6-6-6 6"}]];const $o=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const Vo=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const qo=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const jo=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const Ho=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const Go=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];const Ko=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];function F(n,{size:t=20,strokeWidth:e=1.75}={}){return Ae(n,{width:t,height:t,"stroke-width":e})}const D={ar:n=>F(xo,n),fullscreen:n=>F($o,n),exitFullscreen:n=>F(Vo,n),screenshot:n=>F(Do,n),tiltUp:n=>F(Uo,n),tiltDown:n=>F(ke,n),rotateLeft:n=>F(zo,n),rotateRight:n=>F(Fo,n),zoomIn:n=>F(Go,n),zoomOut:n=>F(Ko,n),reset:n=>F(qo,n),configurator:n=>F(jo,n),close:n=>F(Ho,n)};class z{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:r,disabled:s=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${t} ui-btn--size-${e}`,i!==void 0&&(this.element.setAttribute("aria-label",i),this.element.title=i),o!==void 0?this.element.appendChild(o):i!==void 0&&(this.element.textContent=i),r&&this.element.addEventListener("click",r),this.element.disabled=s}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const L={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},_={0:"0",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",9:"2.25rem",24:"6rem"};class Yo{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:L.white,borderRadius:_[3],padding:_[6],boxShadow:`0 ${_[2]} ${_[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class Jo{constructor(t={}){this.options=t,this.card=new Yo,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}options;card;backdrop;keyHandler=null;open(){document.body.appendChild(this.backdrop),this.keyHandler=t=>{t.key==="Escape"&&this.close()},document.addEventListener("keydown",this.keyHandler)}close(){this.backdrop.remove(),this.keyHandler!==null&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null),this.options.onClose?.()}createBackdrop(){const t=document.createElement("div");return Object.assign(t.style,{position:"fixed",inset:_[0],background:"oklch(0% 0 0 / 50%)",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center"}),t.addEventListener("click",e=>{e.target===t&&this.close()}),t}}class Zo{element;selectCallback=null;constructor(t,e,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<t.length;o++){const r=t[o],s=document.createElement("button");s.className="ui-toggle-group-item",s.dataset.value=r,s.textContent=i?.[o]??r,s.dataset.state=r===e?"on":"off",s.setAttribute("aria-pressed",r===e?"true":"false"),s.addEventListener("click",()=>{this.selectCallback?.(r)}),this.element.appendChild(s)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class Wo{element;select;constructor(t,e,i,o,r){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const s=document.createElement("option");s.value="",s.disabled=!0,s.textContent=i,this.select.appendChild(s);let a=!1;for(let c=0;c<e.length;c++){const u=e[c],h=document.createElement("option");h.value=u,h.textContent=r?.[c]??u,u===o&&(h.selected=!0,a=!0),this.select.appendChild(h)}a||(s.selected=!0);const l=Ae(ke,{width:16,height:16,"stroke-width":2});l.classList.add("ui-native-select-icon"),this.element=document.createElement("div"),this.element.className="ui-native-select-wrap",this.element.appendChild(this.select),this.element.appendChild(l)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const U={fontFamily:{sans:["Mona Sans","ui-sans-serif","system-ui","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"]},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem"},fontWeight:{medium:"500",semibold:"600"}},Qo=U.fontFamily.sans.join(", ");class Xo{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>Zr);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:L.black,light:L.white}});this.dialog=new Jo({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:_[3],fontFamily:Qo}),this.dialog.card.element.appendChild(this.createText(hi(),{fontSize:U.fontSize.base,fontWeight:U.fontWeight.semibold,color:L.neutral[900]})),this.dialog.card.element.appendChild(this.createText(pi(),{fontSize:U.fontSize.sm,color:L.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(e)),this.dialog.card.element.appendChild(this.createText(wi(),{fontSize:U.fontSize.xs,color:L.neutral[500]}));const i=new z({variant:"outline",label:Si(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(i.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",Object.assign(e.style,{width:_[24],height:_[24],borderRadius:_[1]}),e}}const W=U.fontFamily.sans.join(", "),tr=`
1
+ (function(M,et){typeof exports=="object"&&typeof module<"u"?et(exports):typeof define=="function"&&define.amd?define(["exports"],et):(M=typeof globalThis<"u"?globalThis:M||self,et(M.VirtualdisplayClient={}))})(this,(function(M){"use strict";function et(n,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in n)){const r=Object.getOwnPropertyDescriptor(i,o);r&&Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const V={NO_MAPPING:"NO_MAPPING",ATTRIBUTE_NOT_FOUND:"ATTRIBUTE_NOT_FOUND",VALUE_NOT_FOUND:"VALUE_NOT_FOUND",PARENT_NOT_FOUND:"PARENT_NOT_FOUND",INVALID_PARAMETER:"INVALID_PARAMETER",SNAPSHOT_FAILED:"SNAPSHOT_FAILED"};class x extends Error{code;constructor(t,e){super(t),this.name="VirtualdisplayError",this.code=e}static valueNotFound(t,e){return new x(`Value "${e}" not found for attribute "${t}"`,V.VALUE_NOT_FOUND)}static parentNotFound(t){return new x(`Parent element not found: ${t}`,V.PARENT_NOT_FOUND)}static invalidParameter(t){return new x(t,V.INVALID_PARAMETER)}}const bn={};class vn{defaultServer="https://server.virtualdisplay.io";options;constructor(t){this.options=t}create(){const t=this.createContainer(),e=this.createIframe();return t.appendChild(e),this.attachToParent(t),{container:t,iframe:e}}createContainer(){const t=document.createElement("div");return t.className="vd-container",Object.assign(t.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),t}createIframe(){const t=document.createElement("iframe");return t.src=this.buildUrl(),Object.assign(t.style,{width:"100%",height:"100%",border:"none",display:"block"}),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);return e.searchParams.set("license",this.options.license),e.searchParams.set("model",this.options.model),this.options.language!==void 0&&e.searchParams.set("language",this.options.language),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent),e.toString()}getServerUrl(){if(bn?.VITE_VIRTUALDISPLAY_SERVER_HOST===void 0)return this.defaultServer}getParentElement(){if(typeof this.options.parent!="string")return this.options.parent;const t=document.querySelector(this.options.parent);if(t===null)throw x.parentNotFound(this.options.parent);return t}}function yn(n){const t=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),e=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,r=["timestamp","level","msg","service","trace_id","span_id"],s=Object.entries(n).filter(([a])=>!r.includes(a)).map(([a,l])=>`${a}=${JSON.stringify(l)}`).join(" ");return`${t} ${e} [${i}] ${o}${s?" "+s:""}`}function wn(n){return JSON.stringify(n)}function Cn(n,t){const e=t?yn(n):wn(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function Wt(n,t=0){const e={name:n.name,message:n.message};n.stack!==void 0&&(e.stack=n.stack);for(const i of Object.getOwnPropertyNames(n)){if(i==="name"||i==="message"||i==="stack"||i==="cause")continue;const o=n[i];o!==void 0&&(e[i]=o)}return n.cause!==void 0&&n.cause!==null&&(e.cause=n.cause instanceof Error&&t<5?Wt(n.cause,t+1):String(n.cause)),e}function En(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?Wt(i):i;return t}function _n(){return new Date}function Sn(n){return n.toISOString()}function Qt(){return typeof navigator>"u"?"":navigator.userAgent}function An(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function kn(){return/iPhone|iPad|iPod/i.test(Qt())||An()}function Tn(){return/Android/i.test(Qt())}function Rn(){return kn()||Tn()}class ct{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},r={timestamp:Sn(_n()),level:t,msg:e,service:this.config.service,...o,...En(i)};Cn(r,this.config.isDev)}debug(t,e){this.config.isDev&&this.log("debug",t,e)}info(t,e){this.log("info",t,e)}warn(t,e){this.log("warn",t,e)}error(t,e){this.log("error",t,e)}with(t){const e=new ct(this.config);return e.log=((i,o,r={})=>{this.log(i,o,{...t,...r})}).bind(this),e}}function Xt(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new ct({service:n,isDev:e,traceProvider:t?.traceProvider})}function ot(n){if(n!==void 0)return typeof n=="object"&&n!==null&&!Array.isArray(n)&&!(n instanceof Error)?n:n instanceof Error?{error:n.message}:{value:n}}function te(n){return{debug:(t,e)=>n.debug(t,ot(e)),info:(t,e)=>n.info(t,ot(e)),warn:(t,e)=>n.warn(t,ot(e)),error:(t,e)=>n.error(t,ot(e))}}let ee=!1;M.logger=te(Xt("client",{isDev:!1}));function ne(){ee=!0,M.logger=te(Xt("client",{isDev:!0}))}function Nn(){return ee}class In{ready=!1;onReady;constructor(t){this.onReady=t}handleMappingReceived(){this.ready||(this.ready=!0,M.logger.info("Mapping received from server, client is now ready"),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}}const Z={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"};class ie{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}class oe{name;defaultValue;values;onSelect;onChangeCallback;constructor(t){this.name=t.name,this.defaultValue=t.defaultValue,this.onSelect=t.onSelect,this.values=this.createValues(t.values)}select(t){if(!this.values.has(t))throw x.valueNotFound(this.name,t);this.onSelect(this.name,t)}getValues(){return Array.from(this.values.values())}getValue(t){return this.values.get(t)}get selected(){for(const t of this.values.values())if(t.isSelected)return t.value}onChange(t){this.onChangeCallback=t}handleResult(t){let e;for(const i of this.values.values()){const o=i.value===t;i.setSelected(o),o&&(e=i)}e!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(e)}createValues(t){const e=new Map;for(const i of t){const o=new ie(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class Mn{attributes=new Map;constructor(t,e,i){for(const o of t){const r=this.buildOptions(o,e);this.attributes.set(o.name,new oe(r))}this.onMutationFailed=i}onMutationFailed;get(t){return this.attributes.get(t)}getSelection(){const t={};for(const[e,i]of this.attributes){const o=i.selected;o!==void 0&&(t[e]=o)}return t}handleResults(t){for(const e of t){if(!e.success){this.onMutationFailed?.(e.name,e.value);continue}this.get(e.name)?.handleResult(e.value)}}buildOptions(t,e){const i={name:t.name,values:t.values,onSelect:(o,r)=>{e([{name:o,value:r}],!1)}};return t.defaultValue!==void 0?{...i,defaultValue:t.defaultValue}:i}}const I={HANDSHAKE:"handshake",SESSION:"session",MUTATION:"mutation",STATE:"state",LOADING_INDICATOR:"loading_indicator",CAMERA:"camera",SNAPSHOT:"snapshot",MAPPING:"mapping",AR_ACTIVATE:"ar_activate",FULLSCREEN:"fullscreen",CONFIG:"config",ANNOTATION_PLACE_MODE:"annotation_place_mode",ANNOTATION_PLACED:"annotation_placed",ANNOTATION_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing"},re={FOCUS:"focus",UNFOCUS:"unfocus"},Pn={FOCUSED:"focused"},Bn={HIDDEN:"hidden"},Ln=new Set(Object.values(I));function On(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&Ln.has(t.type)}function xn(n){const t=$(n);return t!==null&&t.type===I.HANDSHAKE}function Dn(n){const t=$(n);return t!==null&&t.type===I.SESSION&&typeof t.sessionId=="string"}function Fn(n){const t=$(n);return t!==null&&t.type===I.MUTATION&&Array.isArray(t.results)}function zn(n){const t=$(n);return t!==null&&t.type===I.SNAPSHOT&&("data"in t||"error"in t)}function Un(n){const t=$(n);return t!==null&&t.type===I.CAMERA&&Array.isArray(t.transforms)}function $n(n){const t=$(n);return t!==null&&t.type===I.MAPPING&&Array.isArray(t.attributes)}function Vn(n){const t=$(n);return t!==null&&t.type===I.LOADING_INDICATOR&&typeof t.progress=="number"}function qn(n){const t=$(n);return t!==null&&t.type===I.CONFIG&&typeof t.viewerSettings=="object"}function jn(n){const t=$(n);return t!==null&&t.type===I.ANNOTATION_PLACED&&typeof t.position=="object"&&t.position!==null}function Hn(n){const t=$(n);return t!==null&&t.type===I.FOCUS&&typeof t.state=="string"}function Gn(n){const t=$(n);return t!==null&&t.type===I.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function $(n){return typeof n!="object"||n===null?null:n}class se{constructor(t){this.processor=t}processor;pending=[];isReady=!1;enqueue(t){if(this.isReady){this.processor(t);return}this.pending.push(t)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;const t=[...this.pending];this.pending.length=0;for(const e of t)this.processor(e)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(t){return this.pending.some(e=>e.type===t)}clear(){this.pending.length=0}}class Kn{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=e?.targetOrigin??"*",this.publisher=new se(i=>this.post(i)),this.consumer=new se(i=>this.routeToHandler(i)),this.shouldBuffer=e?.shouldBuffer??null,e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;on(t,e){this.handlers.set(t,e)}off(t){this.handlers.delete(t)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(t){return this.consumer.hasPending(t)}start(){this.listener===null&&(this.listener=t=>{const{data:e}=t;if(!On(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;if(this.shouldBuffer!==null&&!this.shouldBuffer(o)){this.routeToHandler(o);return}this.consumer.enqueue(o)},window.addEventListener("message",this.listener))}destroy(){this.listener!==null&&(window.removeEventListener("message",this.listener),this.listener=null),this.publisher.clear(),this.consumer.clear(),this.handlers.clear()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}post(t){const e=this.getTarget();e!==null&&e.postMessage({...t,_source:this.sourceId},this.targetOrigin)}routeToHandler(t){const e=this.handlers.get(t.type);if(e===void 0)return;const i=e(t);i instanceof Promise&&i.catch(o=>{const r=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${t.type}: ${r}`)})}}class Yn{constructor(t,e){this.send=t,this.onMutationFailed=e}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(t){M.logger.debug("Initializing from server mapping",{attributeCount:t.attributes.length}),this.registry=new Mn(t.attributes,(e,i)=>this.sendMutation(e,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(t){this.registry?.handleResults(t.results)}select(t,e){this.sendMutation([{name:t,value:e}],!1)}getValues(t){return this.registry?.get(t)?.getValues()??[]}getValue(t,e){return this.registry?.get(t)?.getValue(e)}onChange(t,e){if(this.registry===void 0){this.pendingCallbacks.push({name:t,callback:e});return}const i=this.registry.get(t);if(i===void 0){M.logger.warn(`onChange: attribute "${t}" not found — callback will not fire`);return}i.onChange(e)}getAttribute(t){return this.registry?.get(t)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(t,e){const i={type:I.MUTATION,mutations:t,isInitial:e};this.send(i)}replayPendingCallbacks(){for(const{name:t,callback:e}of this.pendingCallbacks){const i=this.registry?.get(t);i===void 0&&M.logger.warn(`onChange: attribute "${t}" not found — buffered callback will not fire`),i?.onChange(e)}this.pendingCallbacks.length=0}}let ae=class{constructor(t){this.send=t}send;commands=[];rotate(t){return this.validateFiniteNumber(t,"rotate"),this.commands.push({action:"rotate",value:t}),this}tilt(t){return this.validateFiniteNumber(t,"tilt"),this.commands.push({action:"tilt",value:t}),this}zoom(t){return this.validateFiniteNumber(t,"zoom"),this.commands.push({action:"zoom",value:t}),this}set(){if(this.commands.length===0)throw x.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const t={type:I.CAMERA,commands:this.commands};this.send(t),this.commands=[]}validateFiniteNumber(t,e){if(!Number.isFinite(t))throw x.invalidParameter(`${e}() requires a finite number, got ${String(t)}`)}reset(){const t={type:I.CAMERA,commands:[{action:"reset"}]};this.send(t)}};class Jn{state;limitsState;changeCallbacks=[];constructor(){this.state={rotation:0,tilt:0,zoom:100}}get rotation(){return this.state.rotation}get tilt(){return this.state.tilt}get zoom(){return this.state.zoom}onChange(t){this.changeCallbacks.push(t)}get limits(){return this.limitsState}applyLimits(t){this.limitsState=t;const e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(e)}handlePositionUpdate(t){this.update(t.transforms)}update(t){let e=!1;for(const i of t)switch(i.type){case"rotation":this.state.rotation=i.value,e=!0;break;case"tilt":this.state.tilt=i.value,e=!0;break;case"zoom":this.state.zoom=i.value,e=!0;break}if(e){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}class le{constructor(t,e){this.send=t,this.dispatch=e}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(t){if(typeof t!="string"||t.length===0)throw x.invalidParameter(`set() requires a non-empty component name, got ${String(t)}`);this.send({type:I.FOCUS,action:re.FOCUS,component:t})}clear(){this.send({type:I.FOCUS,action:re.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Pn.FOCUSED&&t.component!==void 0?(this.focused=t.component,this.attributes=t.attributes??[]):(this.focused=null,this.attributes=[]);const e=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(e);this.dispatch(e)}}function Zn(n,t){const e=n.filter(r=>Wn(r,t));if(e.length===0)return;const i=Math.max(...e.map(ce)),o=e.filter(r=>ce(r)===i);return o.length===1?o[0]:void 0}function Wn(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function ce(n){return Object.keys(n.attributes).length}class ue{constructor(t,e){this.dispatchChange=t,this.dispatchSubmit=e}dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){const t=this.pricing?.buttonLabel;if(t!=null&&t!=="")return t;if(this.submitDefaultLabel!==void 0&&this.submitDefaultLabel!=="")return this.submitDefaultLabel}get submittable(){return this.submitCallback===void 0?!1:this.pricing===void 0?!0:this.resolved?.availability==="available"}get submitEnabled(){return this.submittable&&this.buttonLabel!==void 0}onChange(t){this.changeCallbacks.push(t)}onSubmit(t,e){this.submitCallback=t,this.submitDefaultLabel=e?.defaultLabel,this.notifyRender()}onRender(t){return this.renderCallbacks.push(t),()=>{const e=this.renderCallbacks.indexOf(t);e!==-1&&this.renderCallbacks.splice(e,1)}}async submit(){if(!this.submittable)return;const t=this.resolved!==void 0?{attributes:this.resolved.attributes,reference:this.resolved.reference}:{attributes:{...this.selection},reference:""};this.dispatchSubmit(t),await this.submitCallback?.(t)}handlePricingReceived(t){this.pricing=t,this.recompute()}handleSelectionChanged(t){this.selection=t,this.recompute()}recompute(){this.resolved=this.resolve();for(const t of this.changeCallbacks)t(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(const t of this.renderCallbacks)t()}resolve(){if(this.pricing===void 0)return;const t=Zn(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===Bn.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class de{constructor(t){this.filename=t}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(t){return this.developed&&this.photoData!==null?(t(this.photoData),this):(this.developedCallbacks.add(t),this)}onError(t){return this.errorCallbacks.add(t),this}getFilename(){return this.filename}develop(t){this.developed||this.failed||(this.photoData=t,this.developed=!0,this.developedCallbacks.forEach(e=>{e(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(t){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(e=>{e(t)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}const he=3e4;class fe{constructor(t){this.send=t}send;validExtensions=[".png"];pendingPhotos=new Map;take(t){this.validateFilename(t),M.logger.debug("Taking snapshot",{filename:t});const e=new de(t),i=setTimeout(()=>{this.pendingPhotos.delete(t),M.logger.warn("Snapshot timed out",{filename:t}),e.fail(new x(`Snapshot timed out: the viewer did not respond within ${he}ms`,V.SNAPSHOT_FAILED))},he);return this.pendingPhotos.set(t,{photo:e,timeout:i}),this.send({type:I.SNAPSHOT,filename:t}),e}handleSnapshotResult(t){const e=this.pendingPhotos.get(t.filename);if(e===void 0){M.logger.warn("No pending photo found for filename",{filename:t.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}clearTimeout(e.timeout),this.pendingPhotos.delete(t.filename);const{photo:i}=e;if(t.error!==void 0){i.fail(new x(t.error,V.SNAPSHOT_FAILED));return}t.data!==void 0&&i.develop({filename:t.filename,data:t.data})}clear(){if(this.pendingPhotos.size===0)return;const t=new x("Client destroyed before snapshot completed",V.SNAPSHOT_FAILED);for(const{photo:e,timeout:i}of this.pendingPhotos.values())clearTimeout(i),e.fail(t);this.pendingPhotos.clear()}validateFilename(t){if(t===""||typeof t!="string")throw new x("Filename must be a non-empty string",V.INVALID_PARAMETER);if(!this.validExtensions.some(i=>t.toLowerCase().endsWith(i)))throw new x(`Invalid filename: "${t}". Filename must end with one of: ${this.validExtensions.join(", ")}`,V.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new x('Filename cannot contain path separators or ".."',V.INVALID_PARAMETER)}}class Qn{container=null;attach(t){this.container=t}dispatch(t,e,i=!1){const o=new CustomEvent(t,{detail:e,cancelable:i});return this.container?.dispatchEvent(o),o}on(t,e){const i=o=>{const r=o,s={...r.detail,preventDefault:()=>{r.preventDefault()}};e(s)};return this.container?.addEventListener(t,i),()=>{this.container?.removeEventListener(t,i)}}}const Xn={},ti="en",ge=["en","nl","de"],ut=["baseLocale"],me=[];let pe,be;function ei(n){if(me.length===0)return;const t=typeof n=="string"?n:n.href;if(pe===t)return be;const e=new URL(t,"http://dummy.com");let i;for(const o of me)if(new Xn(o.match,e.href).exec(e.href)){i=o;break}return pe=t,be=i,i}function ve(n){const t=ei(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:ut}const dt=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let ye=!1,P=()=>{let n=ut;!dt&&typeof window<"u"&&window.location?.href&&(n=ve(window.location.href));const t=ni(n);if(t)return ye||(ye=!0,we(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function ni(n,t){let e;for(const i of n){if(i==="baseLocale")e=ti;else if(Ee(i)&&rt.has(i)){const r=rt.get(i);if(r){const s=r.getLocale();if(s instanceof Promise)continue;if(s!==void 0)return oi(s)}}const o=Ce(e);if(o)return o}}const ii=n=>{window.location.reload()};let we=(n,t)=>{const e={reload:!0,...t};let i;try{i=P()}catch{}const o=[];let r=ut;!dt&&typeof window<"u"&&window.location?.href&&(r=ve(window.location.href));for(const a of r)if(a!=="baseLocale"&&Ee(a)&&rt.has(a)){const l=rt.get(a);if(l){let c=l.setLocale(n);c instanceof Promise&&(c=c.catch(u=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:u})}),o.push(c))}}const s=()=>{!dt&&e.reload&&window.location&&n!==i&&ii()};if(o.length)return Promise.all(o).then(()=>{s()});s()};function Ce(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of ge)if(e.toLowerCase()===t)return e}function oi(n){const t=Ce(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${ge.join(", ")}`)}const rt=new Map;function Ee(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const ri=()=>"Activate AR",si=()=>"AR activeren",ai=()=>"AR aktivieren",li=((n={},t={})=>{const e=t.locale??P();return e==="en"?ri():e==="nl"?si():ai()}),ci=()=>"Scan to view in AR",ui=()=>"Scan om in AR te bekijken",di=()=>"Scannen für AR-Ansicht",hi=((n={},t={})=>{const e=t.locale??P();return e==="en"?ci():e==="nl"?ui():di()}),fi=()=>"Use your smartphone camera to scan this QR code",gi=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",mi=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",pi=((n={},t={})=>{const e=t.locale??P();return e==="en"?fi():e==="nl"?gi():mi()}),bi=()=>"Your phone will open the 3D model in AR mode.",vi=()=>"Je telefoon opent het 3D-model in AR-modus.",yi=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",wi=((n={},t={})=>{const e=t.locale??P();return e==="en"?bi():e==="nl"?vi():yi()}),Ci=()=>"Close",Ei=()=>"Sluiten",_i=()=>"Schließen",Si=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ci():e==="nl"?Ei():_i()}),Ai=()=>"Fullscreen",ki=()=>"Volledig scherm",Ti=()=>"Vollbild",Ri=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ai():e==="nl"?ki():Ti()}),Ni=()=>"Downloading",Ii=()=>"Downloaden",Mi=()=>"Herunterladen",_e=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ni():e==="nl"?Ii():Mi()}),Pi=()=>"Rendering",Bi=()=>"Renderen",Li=()=>"Rendern",Oi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Pi():e==="nl"?Bi():Li()}),xi=()=>"Screenshot",Di=()=>"Screenshot",Fi=()=>"Screenshot",zi=((n={},t={})=>{const e=t.locale??P();return e==="en"?xi():e==="nl"?Di():Fi()}),Ui=()=>"Configure",$i=()=>"Configureren",Vi=()=>"Konfigurieren",qi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Ui():e==="nl"?$i():Vi()}),ji=()=>"Close",Hi=()=>"Sluiten",Gi=()=>"Schließen",Ki=((n={},t={})=>{const e=t.locale??P();return e==="en"?ji():e==="nl"?Hi():Gi()}),Yi=()=>"Reset camera",Ji=()=>"Camera resetten",Zi=()=>"Kamera zurücksetzen",Wi=((n={},t={})=>{const e=t.locale??P();return e==="en"?Yi():e==="nl"?Ji():Zi()}),Qi=()=>"Zoom in",Xi=()=>"Inzoomen",to=()=>"Hineinzoomen",eo=((n={},t={})=>{const e=t.locale??P();return e==="en"?Qi():e==="nl"?Xi():to()}),no=()=>"Zoom out",io=()=>"Uitzoomen",oo=()=>"Herauszoomen",ro=((n={},t={})=>{const e=t.locale??P();return e==="en"?no():e==="nl"?io():oo()}),so=()=>"Rotate left",ao=()=>"Naar links draaien",lo=()=>"Nach links drehen",co=((n={},t={})=>{const e=t.locale??P();return e==="en"?so():e==="nl"?ao():lo()}),uo=()=>"Rotate right",ho=()=>"Naar rechts draaien",fo=()=>"Nach rechts drehen",go=((n={},t={})=>{const e=t.locale??P();return e==="en"?uo():e==="nl"?ho():fo()}),mo=()=>"Tilt up",po=()=>"Omhoog kantelen",bo=()=>"Nach oben kippen",vo=((n={},t={})=>{const e=t.locale??P();return e==="en"?mo():e==="nl"?po():bo()}),yo=()=>"Tilt down",wo=()=>"Omlaag kantelen",Co=()=>"Nach unten kippen",Eo=((n={},t={})=>{const e=t.locale??P();return e==="en"?yo():e==="nl"?wo():Co()}),_o=()=>"Working…",So=()=>"Bezig…",Ao=()=>"Läuft…",ko=((n={},t={})=>{const e=t.locale??P();return e==="en"?_o():e==="nl"?So():Ao()}),To=()=>"Done",Ro=()=>"Gelukt",No=()=>"Fertig",Io=((n={},t={})=>{const e=t.locale??P();return e==="en"?To():e==="nl"?Ro():No()}),Mo=()=>"Failed",Po=()=>"Mislukt",Bo=()=>"Fehlgeschlagen",Lo=((n={},t={})=>{const e=t.locale??P();return e==="en"?Mo():e==="nl"?Po():Bo()});const Oo={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Se=([n,t,e])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(t).forEach(o=>{i.setAttribute(o,String(t[o]))}),e?.length&&e.forEach(o=>{const r=Se(o);i.appendChild(r)}),i},Ae=(n,t={})=>{const i={...Oo,...t};return Se(["svg",i,n])};const xo=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];const Do=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];const ke=[["path",{d:"m6 9 6 6 6-6"}]];const Fo=[["path",{d:"m15 18-6-6 6-6"}]];const zo=[["path",{d:"m9 18 6-6-6-6"}]];const Uo=[["path",{d:"m18 15-6-6-6 6"}]];const $o=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const Vo=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const qo=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];const jo=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];const Ho=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const Go=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];const Ko=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];function z(n,{size:t=20,strokeWidth:e=1.75}={}){return Ae(n,{width:t,height:t,"stroke-width":e})}const D={ar:n=>z(xo,n),fullscreen:n=>z($o,n),exitFullscreen:n=>z(Vo,n),screenshot:n=>z(Do,n),tiltUp:n=>z(Uo,n),tiltDown:n=>z(ke,n),rotateLeft:n=>z(Fo,n),rotateRight:n=>z(zo,n),zoomIn:n=>z(Go,n),zoomOut:n=>z(Ko,n),reset:n=>z(qo,n),configurator:n=>z(jo,n),close:n=>z(Ho,n)};class F{element;constructor({variant:t="default",size:e="default",label:i,icon:o,onClick:r,disabled:s=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${t} ui-btn--size-${e}`,i!==void 0&&(this.element.setAttribute("aria-label",i),this.element.title=i),o!==void 0?this.element.appendChild(o):i!==void 0&&(this.element.textContent=i),r&&this.element.addEventListener("click",r),this.element.disabled=s}setIcon(t){const e=this.element.querySelector("svg");e!==null?e.replaceWith(t):this.element.appendChild(t)}}const L={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},w={0:"0",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",9:"2.25rem",24:"6rem"};class Yo{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:L.white,borderRadius:w[3],padding:w[6],boxShadow:`0 ${w[2]} ${w[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class Jo{constructor(t={}){this.options=t,this.card=new Yo,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}options;card;backdrop;keyHandler=null;open(){document.body.appendChild(this.backdrop),this.keyHandler=t=>{t.key==="Escape"&&this.close()},document.addEventListener("keydown",this.keyHandler)}close(){this.backdrop.remove(),this.keyHandler!==null&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null),this.options.onClose?.()}createBackdrop(){const t=document.createElement("div");return Object.assign(t.style,{position:"fixed",inset:w[0],background:"oklch(0% 0 0 / 50%)",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center"}),t.addEventListener("click",e=>{e.target===t&&this.close()}),t}}class Zo{element;selectCallback=null;constructor(t,e,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<t.length;o++){const r=t[o],s=document.createElement("button");s.className="ui-toggle-group-item",s.dataset.value=r,s.textContent=i?.[o]??r,s.dataset.state=r===e?"on":"off",s.setAttribute("aria-pressed",r===e?"true":"false"),s.addEventListener("click",()=>{this.selectCallback?.(r)}),this.element.appendChild(s)}}setSelected(t){for(const e of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e.dataset.value===t;e.dataset.state=i?"on":"off",e.setAttribute("aria-pressed",i?"true":"false")}}onSelect(t){this.selectCallback=t}}class Wo{element;select;constructor(t,e,i,o,r){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=t,this.select.setAttribute("aria-label",i);const s=document.createElement("option");s.value="",s.disabled=!0,s.textContent=i,this.select.appendChild(s);let a=!1;for(let c=0;c<e.length;c++){const u=e[c],h=document.createElement("option");h.value=u,h.textContent=r?.[c]??u,u===o&&(h.selected=!0,a=!0),this.select.appendChild(h)}a||(s.selected=!0);const l=Ae(ke,{width:16,height:16,"stroke-width":2});l.classList.add("ui-native-select-icon"),this.element=document.createElement("div"),this.element.className="ui-native-select-wrap",this.element.appendChild(this.select),this.element.appendChild(l)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const U={fontFamily:{sans:["Mona Sans","ui-sans-serif","system-ui","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"]},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem"},fontWeight:{medium:"500",semibold:"600"}},Qo=U.fontFamily.sans.join(", ");class Xo{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>Zr);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:L.black,light:L.white}});this.dialog=new Jo({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:w[3],fontFamily:Qo}),this.dialog.card.element.appendChild(this.createText(hi(),{fontSize:U.fontSize.base,fontWeight:U.fontWeight.semibold,color:L.neutral[900]})),this.dialog.card.element.appendChild(this.createText(pi(),{fontSize:U.fontSize.sm,color:L.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(e)),this.dialog.card.element.appendChild(this.createText(wi(),{fontSize:U.fontSize.xs,color:L.neutral[500]}));const i=new F({variant:"outline",label:Si(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(i.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",Object.assign(e.style,{width:w[24],height:w[24],borderRadius:w[1]}),e}}const W=U.fontFamily.sans.join(", "),tr=`
2
2
  :root {
3
3
  --primary: oklch(5% 0 0);
4
4
  --primary-foreground: oklch(100% 0 0);
@@ -256,7 +256,7 @@
256
256
  color: var(--muted-foreground);
257
257
  margin-block-start: 0.25rem;
258
258
  }
259
- `;let Te=!1;function er(){if(Te||typeof document>"u")return;Te=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=tr,document.head.appendChild(n)}function Re(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function nr(n,t,e,i,o,r){const[s,a,l]=n,c=Math.cos(t),u=Math.sin(t),h=c*s+u*l,f=-u*s+c*l,d=Math.cos(e),p=Math.sin(e),k=d*a-p*f,B=p*a+d*f,E=.55;return[i+h*r*E,o-k*r*E,B]}function ir(n,t,e){n.beginPath(),n.moveTo(t[0],t[1]),n.lineTo(e[0],e[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function or(n,t,e,i,o){const r=t(e),s=t(i),a=[r[0]+(s[0]-r[0])*o,r[1]+(s[1]-r[1])*o,r[2]];ir(n,r,a)}const ht=[-1,-1,1],ft=[1,-1,1],gt=[1,-1,-1],mt=[-1,-1,-1],pt=[-1,1,1],bt=[1,1,1],vt=[1,1,-1],yt=[-1,1,-1],Ne=[[ht,ft],[ft,gt],[gt,mt],[mt,ht],[ht,pt],[ft,bt],[gt,vt],[mt,yt],[pt,bt],[bt,vt],[vt,yt],[yt,pt]],rr=400,Ie='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function sr(){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fff",zIndex:"20",opacity:"0",transition:"opacity 0.3s ease-in-out"});const t=document.createElement("canvas");Object.assign(t.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const e=document.createElement("div");Object.assign(e.style,{position:"absolute",top:"56%",left:"0",right:"0",textAlign:"center",pointerEvents:"none"});const i=document.createElement("span");Object.assign(i.style,{fontSize:"13px",fontWeight:"400",color:"#000",fontVariantNumeric:"tabular-nums",fontFamily:Ie});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:Ie}),o.textContent=_e(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class ar{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=sr();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,t.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=e.showDelay??rr;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:_e(),rendering:Oi()}}updateProgress(t,e){this.hidden||(this.pctEl.textContent=`${Math.round(t)}%`,this.phaseEl.textContent=e!==""?` · ${e}`:"")}showError(t){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const e=Math.min(devicePixelRatio,2),i=this.canvas.width/e,o=this.canvas.height/e;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*e,o*e)}this.pctEl.textContent="",this.phaseEl.textContent=t,this.phaseEl.style.color="#b91c1c",this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity="0",this.overlay.addEventListener("transitionend",()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity="1")}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;const t=Math.min(devicePixelRatio,2),e=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=e*t,this.canvas.height=i*t,this.ctx.scale(t,t),this.ctx.lineCap="round",this.ctx.lineJoin="round"}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;const t=this.canvas.width/Math.min(devicePixelRatio,2),e=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,t,e);const o=t/2,r=e*.44,s=Math.min(t,e)*.08,a=.785,l=.615,c=p=>nr(p,a,l,o,r,s),u=6,h=i%u/u,f=Ne.length;let d;h<.35?d=Re(h/.35)*f:h<.55?d=f:h<.9?d=(1-Re((h-.55)/.35))*f:d=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let p=0;p<f&&!(p>=d);p++){const k=Ne[p];if(k===void 0)continue;const B=Math.min(1,d-p);or(this.ctx,c,k[0],k[1],B)}this.ctx.shadowBlur=0}}class lr{constructor(t){this.options=t,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"flex",gap:"0.375rem"}),this.onFullscreenChange=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener("fullscreenchange",this.onFullscreenChange)}options;element;arBtn=null;fullscreenBtn=null;onFullscreenChange;setFullscreenIcon(t){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(t?D.exitFullscreen():D.fullscreen())}syncButton(t,e,i){if(e&&t===null){const o=i();return this.element.appendChild(o.element),o}return!e&&t!==null?(t.element.remove(),null):t}applySettings(t){this.arBtn=this.syncButton(this.arBtn,t.ar!==!1&&this.options.onAr!==void 0,()=>new z({variant:"outline",size:"icon",label:li(),icon:D.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new z({variant:"outline",size:"icon",label:Ri(),icon:D.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const Q=.5;class st{element;constructor(t,e){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:e.rotation,targetTilt:e.tilt,targetZoom:e.zoom,thetaOffset:0},o=cr(t,e,i);e.onChange(r=>{i.targetRotation=r.rotation-i.thetaOffset,i.targetTilt=r.tilt,i.targetZoom=r.zoom,ur(o,e,r)}),this.element.appendChild(st.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(st.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(t,e){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(t.element),i.appendChild(e.element),i}static buildDpad(t,e,i,o,r){const s=document.createElement("div");s.className="vd-dpad";for(const[a,l]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[r,"down"]])a.element.classList.add(`vd-dpad-${l}`),s.appendChild(a.element);return s}}function cr(n,t,e){const i=s=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,s)),o=s=>{const a=t.limits?.minRotate,l=t.limits?.maxRotate;return a!==void 0||l!==void 0?Math.max(a??-1/0,Math.min(l??1/0,s)):s},r=s=>{const a=t.limits?.minTilt,l=t.limits?.maxTilt;if(a!==void 0||l!==void 0){e.targetTilt=Math.max(a??0,Math.min(l??180,e.targetTilt+s)),n.tilt(e.targetTilt).set();return}const c=e.targetTilt+s;c>180||c<0?(e.targetTilt=c>180?360-c:-c,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=c,n.tilt(e.targetTilt).set())};return{zoomOut:new z({variant:"outline",size:"icon",label:ro(),icon:D.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new z({variant:"outline",size:"icon",label:eo(),icon:D.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new z({variant:"outline",size:"icon",label:vo(),icon:D.tiltUp(),onClick:()=>{r(-15)}}),rotateLeft:new z({variant:"outline",size:"icon",label:co(),icon:D.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new z({variant:"outline",size:"icon",label:Wi(),icon:D.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new z({variant:"outline",size:"icon",label:go(),icon:D.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new z({variant:"outline",size:"icon",label:Eo(),icon:D.tiltDown(),onClick:()=>{r(15)}})}}function ur(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+Q,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-Q,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+Q,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-Q,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+Q,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-Q)}const dr=5;let hr=0;function wt(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function fr(n,t,e,i,o){const r=document.createElement("div");r.className="vd-attribute",r.dataset.name=n.name;const s=document.createElement("span");s.className="vd-attribute-label",s.textContent=wt(n.name),s.id=`vd-attribute-label-${hr++}`,r.appendChild(s),r.setAttribute("role","group"),r.setAttribute("aria-labelledby",s.id);const a=n.values.find(u=>t.getValue(n.name,u)?.isSelected===!0),l=n.values.map(wt),c=n.values.length<=dr?new Zo(n.values,a,l):new Wo(n.name,n.values,wt(n.name),a,l);return c.onSelect(u=>{e.dispatch(Z.SELECT,{attribute:n.name,value:u},!0).defaultPrevented||i(n.name,u)}),o(n.name,u=>{c.setSelected(u.value),e.dispatch(Z.SELECTED,{attribute:n.name,value:u.value})}),r.appendChild(c.element),r}const gr=80,mr=2500;class pr{constructor(t,e=mr){this.configuration=t,this.resetMs=e,this.element=document.createElement("div"),this.element.className="vd-commerce vd-hidden";const i=document.createElement("div");i.className="vd-commerce-price",this.priceEl=document.createElement("span"),this.priceEl.className="vd-price",this.vatEl=document.createElement("span"),this.vatEl.className="vd-vat",i.append(this.priceEl,this.vatEl),this.button=new z({variant:"default",onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add("vd-cta","vd-hidden"),this.element.append(i,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}configuration;resetMs;element;priceEl;vatEl;button;unsubscribe;state="idle";resetTimer;update(){this.renderPrice(this.configuration.current),this.renderButton();const t=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!t)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(t){if(t===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=br(t.price,t.currency),this.vatEl.textContent=Me(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(Me(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",ko());try{await this.configuration.submit(),this.setState("success",Io())}catch{this.setState("failed",Lo())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(t,e){this.state=t,this.element.dataset.submit=t,this.button.element.disabled=t==="busy",this.setButtonText(e)}setButtonText(t){this.button.element.textContent=t,this.button.element.setAttribute("aria-label",t)}}function Me(n){return(n??"").slice(0,gr)}function br(n,t){try{const e=new Intl.NumberFormat(P(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Pe{slot=null;panel=null;attach(t,e){this.panel=e,e.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(e),t.appendChild(this.slot)}setVisible(t){this.panel!==null&&(this.panel.style.display=t?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const vr=572;class yr{element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new z({variant:"ghost",size:"icon-sm",label:Ki(),icon:D.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});const i=document.createElement("div");i.className="vd-sidebar-header",i.appendChild(this.closeButton.element),this.body=document.createElement("div"),this.body.className="vd-sidebar-body",this.body.appendChild(e),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),t.appendChild(this.element),this.openButton=new z({variant:"outline",size:"default",label:qi(),icon:D.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),t.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<vr)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",this.visible&&!this.expanded),this.openButton.element.classList.toggle("vd-hidden",!(this.visible&&!this.expanded)),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t)}}class wr{attach(t,e){}setVisible(t){}destroy(){}}const Cr={"inframe-bottom-left":()=>new Pe,"sidebar-right":()=>new yr,hidden:()=>new wr};function Er(n){return(Cr[n??""]??(()=>new Pe))()}const Ct=U.fontFamily.sans.join(", "),Et=`
259
+ `;let Te=!1;function er(){if(Te||typeof document>"u")return;Te=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=tr,document.head.appendChild(n)}function Re(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function nr(n,t,e,i,o,r){const[s,a,l]=n,c=Math.cos(t),u=Math.sin(t),h=c*s+u*l,f=-u*s+c*l,d=Math.cos(e),p=Math.sin(e),k=d*a-p*f,B=p*a+d*f,_=.55;return[i+h*r*_,o-k*r*_,B]}function ir(n,t,e){n.beginPath(),n.moveTo(t[0],t[1]),n.lineTo(e[0],e[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function or(n,t,e,i,o){const r=t(e),s=t(i),a=[r[0]+(s[0]-r[0])*o,r[1]+(s[1]-r[1])*o,r[2]];ir(n,r,a)}const ht=[-1,-1,1],ft=[1,-1,1],gt=[1,-1,-1],mt=[-1,-1,-1],pt=[-1,1,1],bt=[1,1,1],vt=[1,1,-1],yt=[-1,1,-1],Ne=[[ht,ft],[ft,gt],[gt,mt],[mt,ht],[ht,pt],[ft,bt],[gt,vt],[mt,yt],[pt,bt],[bt,vt],[vt,yt],[yt,pt]],rr=400,Ie='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function sr(){const n=document.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fff",zIndex:"20",opacity:"0",transition:"opacity 0.3s ease-in-out"});const t=document.createElement("canvas");Object.assign(t.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const e=document.createElement("div");Object.assign(e.style,{position:"absolute",top:"56%",left:"0",right:"0",textAlign:"center",pointerEvents:"none"});const i=document.createElement("span");Object.assign(i.style,{fontSize:"13px",fontWeight:"400",color:"#000",fontVariantNumeric:"tabular-nums",fontFamily:Ie});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:Ie}),o.textContent=_e(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class ar{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=sr();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,t.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=e.showDelay??rr;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:_e(),rendering:Oi()}}updateProgress(t,e){this.hidden||(this.pctEl.textContent=`${Math.round(t)}%`,this.phaseEl.textContent=e!==""?` · ${e}`:"")}showError(t){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const e=Math.min(devicePixelRatio,2),i=this.canvas.width/e,o=this.canvas.height/e;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*e,o*e)}this.pctEl.textContent="",this.phaseEl.textContent=t,this.phaseEl.style.color="#b91c1c",this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity="0",this.overlay.addEventListener("transitionend",()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity="1")}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;const t=Math.min(devicePixelRatio,2),e=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=e*t,this.canvas.height=i*t,this.ctx.scale(t,t),this.ctx.lineCap="round",this.ctx.lineJoin="round"}tick=()=>{this.hidden||(this.drawFrame(),this.animationId=requestAnimationFrame(this.tick))};drawFrame(){if(this.ctx===null)return;const t=this.canvas.width/Math.min(devicePixelRatio,2),e=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,t,e);const o=t/2,r=e*.44,s=Math.min(t,e)*.08,a=.785,l=.615,c=p=>nr(p,a,l,o,r,s),u=6,h=i%u/u,f=Ne.length;let d;h<.35?d=Re(h/.35)*f:h<.55?d=f:h<.9?d=(1-Re((h-.55)/.35))*f:d=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let p=0;p<f&&!(p>=d);p++){const k=Ne[p];if(k===void 0)continue;const B=Math.min(1,d-p);or(this.ctx,c,k[0],k[1],B)}this.ctx.shadowBlur=0}}class lr{constructor(t){this.options=t,this.element=document.createElement("div"),Object.assign(this.element.style,{display:"flex",gap:"0.375rem"}),this.onFullscreenChange=()=>{this.setFullscreenIcon(document.fullscreenElement!==null)},document.addEventListener("fullscreenchange",this.onFullscreenChange)}options;element;arBtn=null;fullscreenBtn=null;onFullscreenChange;setFullscreenIcon(t){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(t?D.exitFullscreen():D.fullscreen())}syncButton(t,e,i){if(e&&t===null){const o=i();return this.element.appendChild(o.element),o}return!e&&t!==null?(t.element.remove(),null):t}applySettings(t){this.arBtn=this.syncButton(this.arBtn,t.ar!==!1&&this.options.onAr!==void 0,()=>new F({variant:"outline",size:"icon",label:li(),icon:D.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,t.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new F({variant:"outline",size:"icon",label:Ri(),icon:D.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const Q=.5;class st{element;constructor(t,e){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:e.rotation,targetTilt:e.tilt,targetZoom:e.zoom,thetaOffset:0},o=cr(t,e,i);e.onChange(r=>{i.targetRotation=r.rotation-i.thetaOffset,i.targetTilt=r.tilt,i.targetZoom=r.zoom,ur(o,e,r)}),this.element.appendChild(st.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(st.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(t,e){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(t.element),i.appendChild(e.element),i}static buildDpad(t,e,i,o,r){const s=document.createElement("div");s.className="vd-dpad";for(const[a,l]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[r,"down"]])a.element.classList.add(`vd-dpad-${l}`),s.appendChild(a.element);return s}}function cr(n,t,e){const i=s=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,s)),o=s=>{const a=t.limits?.minRotate,l=t.limits?.maxRotate;return a!==void 0||l!==void 0?Math.max(a??-1/0,Math.min(l??1/0,s)):s},r=s=>{const a=t.limits?.minTilt,l=t.limits?.maxTilt;if(a!==void 0||l!==void 0){e.targetTilt=Math.max(a??0,Math.min(l??180,e.targetTilt+s)),n.tilt(e.targetTilt).set();return}const c=e.targetTilt+s;c>180||c<0?(e.targetTilt=c>180?360-c:-c,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=c,n.tilt(e.targetTilt).set())};return{zoomOut:new F({variant:"outline",size:"icon",label:ro(),icon:D.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new F({variant:"outline",size:"icon",label:eo(),icon:D.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new F({variant:"outline",size:"icon",label:vo(),icon:D.tiltUp(),onClick:()=>{r(-15)}}),rotateLeft:new F({variant:"outline",size:"icon",label:co(),icon:D.rotateLeft(),onClick:()=>{e.targetRotation=o(e.targetRotation-15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),reset:new F({variant:"outline",size:"icon",label:Wi(),icon:D.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new F({variant:"outline",size:"icon",label:go(),icon:D.rotateRight(),onClick:()=>{e.targetRotation=o(e.targetRotation+15),n.rotate(e.targetRotation+e.thetaOffset).set()}}),tiltDown:new F({variant:"outline",size:"icon",label:Eo(),icon:D.tiltDown(),onClick:()=>{r(15)}})}}function ur(n,t,e){const i=t.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&e.zoom<=i.minZoom+Q,n.zoomIn.element.disabled=i.maxZoom!==void 0&&e.zoom>=i.maxZoom-Q,n.tiltUp.element.disabled=i.minTilt!==void 0&&e.tilt<=i.minTilt+Q,n.tiltDown.element.disabled=i.maxTilt!==void 0&&e.tilt>=i.maxTilt-Q,n.rotateLeft.element.disabled=i.minRotate!==void 0&&e.rotation<=i.minRotate+Q,n.rotateRight.element.disabled=i.maxRotate!==void 0&&e.rotation>=i.maxRotate-Q)}const dr=5;let hr=0;function wt(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function fr(n,t,e,i,o){const r=document.createElement("div");r.className="vd-attribute",r.dataset.name=n.name;const s=document.createElement("span");s.className="vd-attribute-label",s.textContent=wt(n.name),s.id=`vd-attribute-label-${hr++}`,r.appendChild(s),r.setAttribute("role","group"),r.setAttribute("aria-labelledby",s.id);const a=n.values.find(u=>t.getValue(n.name,u)?.isSelected===!0),l=n.values.map(wt),c=n.values.length<=dr?new Zo(n.values,a,l):new Wo(n.name,n.values,wt(n.name),a,l);return c.onSelect(u=>{e.dispatch(Z.SELECT,{attribute:n.name,value:u},!0).defaultPrevented||i(n.name,u)}),o(n.name,u=>{c.setSelected(u.value),e.dispatch(Z.SELECTED,{attribute:n.name,value:u.value})}),r.appendChild(c.element),r}const gr=80,mr=2500;class pr{constructor(t,e=mr){this.configuration=t,this.resetMs=e,this.element=document.createElement("div"),this.element.className="vd-commerce vd-hidden";const i=document.createElement("div");i.className="vd-commerce-price",this.priceEl=document.createElement("span"),this.priceEl.className="vd-price",this.vatEl=document.createElement("span"),this.vatEl.className="vd-vat",i.append(this.priceEl,this.vatEl),this.button=new F({variant:"default",onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add("vd-cta","vd-hidden"),this.element.append(i,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}configuration;resetMs;element;priceEl;vatEl;button;unsubscribe;state="idle";resetTimer;update(){this.renderPrice(this.configuration.current),this.renderButton();const t=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!t)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(t){if(t===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=br(t.price,t.currency),this.vatEl.textContent=Me(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(Me(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",ko());try{await this.configuration.submit(),this.setState("success",Io())}catch{this.setState("failed",Lo())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(t,e){this.state=t,this.element.dataset.submit=t,this.button.element.disabled=t==="busy",this.setButtonText(e)}setButtonText(t){this.button.element.textContent=t,this.button.element.setAttribute("aria-label",t)}}function Me(n){return(n??"").slice(0,gr)}function br(n,t){try{const e=new Intl.NumberFormat(P(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class Pe{slot=null;panel=null;attach(t,e){this.panel=e,e.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(e),t.appendChild(this.slot)}setVisible(t){this.panel!==null&&(this.panel.style.display=t?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const vr=572;class yr{element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(t,e){this.container=t,e.classList.add("vd-attributes-sidebar"),this.closeButton=new F({variant:"ghost",size:"icon-sm",label:Ki(),icon:D.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});const i=document.createElement("div");i.className="vd-sidebar-header",i.appendChild(this.closeButton.element),this.body=document.createElement("div"),this.body.className="vd-sidebar-body",this.body.appendChild(e),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),t.appendChild(this.element),this.openButton=new F({variant:"outline",size:"default",label:qi(),icon:D.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),t.appendChild(this.openButton.element),this.observe()}setVisible(t){this.visible=t,this.render()}destroy(){this.observer?.disconnect(),this.observer=null,this.openButton?.element.remove(),this.element?.remove(),this.container?.classList.remove("vd-layout-sidebar-right","vd-layout-sidebar-collapsed"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(t=>{const e=t[0]?.contentRect.width??0;this.setCollapsible(e>0&&e<vr)}),this.observer.observe(this.container))}setCollapsible(t){t!==this.collapsible&&(this.collapsible=t,this.expanded=!t,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const t=this.visible&&this.expanded,e=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",e),this.openButton.element.classList.toggle("vd-hidden",!e),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",t),this.container.classList.toggle("vd-layout-sidebar-collapsed",e)}}class wr{attach(t,e){}setVisible(t){}destroy(){}}const Cr={"inframe-bottom-left":()=>new Pe,"sidebar-right":()=>new yr,hidden:()=>new wr};function Er(n){return(Cr[n??""]??(()=>new Pe))()}const Ct=U.fontFamily.sans.join(", "),Et=`
260
260
  position: absolute;
261
261
  display: flex;
262
262
  z-index: 10;
@@ -270,51 +270,51 @@
270
270
  /* Layout slots — four corners */
271
271
  .vd-slot-top-right {
272
272
  ${Et}
273
- inset-block-start: ${_[3]};
274
- inset-inline-end: ${_[3]};
273
+ inset-block-start: ${w[3]};
274
+ inset-inline-end: ${w[3]};
275
275
  flex-direction: column;
276
276
  align-items: flex-end;
277
- gap: ${_[1.5]};
277
+ gap: ${w[1.5]};
278
278
  }
279
279
 
280
280
  .vd-slot-bottom-left {
281
281
  ${Et}
282
- inset-block-end: ${_[3]};
283
- inset-inline-start: ${_[3]};
282
+ inset-block-end: ${w[3]};
283
+ inset-inline-start: ${w[3]};
284
284
  flex-direction: column;
285
285
  align-items: flex-start;
286
- gap: ${_[1.5]};
286
+ gap: ${w[1.5]};
287
287
  }
288
288
 
289
289
  .vd-slot-bottom-right {
290
290
  ${Et}
291
- inset-block-end: ${_[3]};
292
- inset-inline-end: ${_[3]};
291
+ inset-block-end: ${w[3]};
292
+ inset-inline-end: ${w[3]};
293
293
  flex-direction: row;
294
- gap: ${_[1.5]};
294
+ gap: ${w[1.5]};
295
295
  }
296
296
 
297
297
  /* Component styles — no positioning */
298
298
  .vd-camera-controls {
299
299
  display: flex;
300
300
  flex-direction: column;
301
- gap: ${_[1]};
301
+ gap: ${w[1]};
302
302
  background: color-mix(in oklch, ${L.white} 85%, transparent);
303
303
  backdrop-filter: blur(8px);
304
- border-radius: ${_[2]};
305
- padding: ${_[2]};
304
+ border-radius: ${w[2]};
305
+ padding: ${w[2]};
306
306
  }
307
307
 
308
308
  .vd-zoom {
309
309
  display: flex;
310
- gap: ${_[.5]};
310
+ gap: ${w[.5]};
311
311
  }
312
312
 
313
313
  .vd-dpad {
314
314
  display: grid;
315
- grid-template-columns: repeat(3, ${_[9]});
316
- grid-template-rows: repeat(3, ${_[9]});
317
- gap: ${_[.5]};
315
+ grid-template-columns: repeat(3, ${w[9]});
316
+ grid-template-rows: repeat(3, ${w[9]});
317
+ gap: ${w[.5]};
318
318
  }
319
319
 
320
320
  .vd-dpad-up { grid-column: 2; grid-row: 1; }
@@ -326,20 +326,20 @@
326
326
  .vd-attributes {
327
327
  display: flex;
328
328
  flex-direction: column;
329
- gap: ${_[3]};
329
+ gap: ${w[3]};
330
330
  background: color-mix(in oklch, ${L.white} 85%, transparent);
331
331
  backdrop-filter: blur(8px);
332
332
  border: 1px solid color-mix(in oklch, ${L.neutral[900]} 8%, transparent);
333
- border-radius: ${_[3]};
334
- padding: ${_[3]};
335
- box-shadow: 0 ${_[1]} ${_[4]} color-mix(in oklch, ${L.neutral[900]} 6%, transparent);
333
+ border-radius: ${w[3]};
334
+ padding: ${w[3]};
335
+ box-shadow: 0 ${w[1]} ${w[4]} color-mix(in oklch, ${L.neutral[900]} 6%, transparent);
336
336
  font-family: ${Ct};
337
337
  }
338
338
 
339
339
  .vd-attribute {
340
340
  display: flex;
341
341
  flex-direction: column;
342
- gap: ${_[1.5]};
342
+ gap: ${w[1.5]};
343
343
  }
344
344
 
345
345
  /* Micro-label: recedes so the controls lead. */
@@ -368,7 +368,7 @@
368
368
  background: color-mix(in oklch, ${L.white} 90%, transparent);
369
369
  backdrop-filter: blur(10px);
370
370
  border-inline-start: 1px solid color-mix(in oklch, ${L.neutral[900]} 8%, transparent);
371
- box-shadow: -${_[1]} 0 ${_[4]} color-mix(in oklch, ${L.neutral[900]} 5%, transparent);
371
+ box-shadow: -${w[1]} 0 ${w[4]} color-mix(in oklch, ${L.neutral[900]} 5%, transparent);
372
372
  }
373
373
 
374
374
  @media (prefers-reduced-motion: no-preference) {
@@ -380,13 +380,13 @@
380
380
  .vd-sidebar-header {
381
381
  display: flex;
382
382
  justify-content: flex-end;
383
- padding: ${_[1.5]} ${_[1.5]} 0;
383
+ padding: ${w[1.5]} ${w[1.5]} 0;
384
384
  }
385
385
 
386
386
  .vd-sidebar-body {
387
387
  flex: 1;
388
388
  overflow-y: auto;
389
- padding: ${_[4]};
389
+ padding: ${w[4]};
390
390
  }
391
391
 
392
392
  /* attributes inside the sidebar: flat and full-width — the panel provides the frosting */
@@ -397,27 +397,34 @@
397
397
  border-radius: 0;
398
398
  padding: 0;
399
399
  box-shadow: none;
400
- gap: ${_[5]};
400
+ gap: ${w[5]};
401
401
  }
402
402
 
403
403
  /* floating toggle, shown when the sidebar is collapsed on narrow embeds */
404
404
  .vd-configurator-toggle {
405
405
  position: absolute;
406
- inset-block-end: ${_[3]};
407
- inset-inline-end: ${_[3]};
406
+ inset-block-end: ${w[3]};
407
+ inset-inline-end: ${w[3]};
408
408
  z-index: 12;
409
409
  }
410
410
 
411
411
  /* while the panel is open, keep the corner controls clear of it */
412
- .vd-layout-sidebar-right .vd-slot-top-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${_[3]}); }
413
- .vd-layout-sidebar-right .vd-slot-bottom-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${_[3]}); }
412
+ .vd-layout-sidebar-right .vd-slot-top-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${w[3]}); }
413
+ .vd-layout-sidebar-right .vd-slot-bottom-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${w[3]}); }
414
+
415
+ /* while collapsed on a narrow embed, lift the bottom-right controls above the
416
+ floating toggle so the AR/fullscreen buttons aren't hidden behind the
417
+ "open configurator" button (spacing[9] = the default toggle button height) */
418
+ .vd-layout-sidebar-collapsed .vd-slot-bottom-right {
419
+ inset-block-end: calc(${w[3]} + ${w[9]} + ${w[1.5]});
420
+ }
414
421
 
415
422
  /* Price + CTA — sit under the attribute controls, separated by a hairline */
416
423
  .vd-commerce {
417
424
  display: flex;
418
425
  flex-direction: column;
419
- gap: ${_[2]};
420
- padding-block-start: ${_[3]};
426
+ gap: ${w[2]};
427
+ padding-block-start: ${w[3]};
421
428
  border-block-start: 1px solid color-mix(in oklch, ${L.neutral[900]} 8%, transparent);
422
429
  font-family: ${Ct};
423
430
  }
@@ -425,7 +432,7 @@
425
432
  .vd-commerce-price {
426
433
  display: flex;
427
434
  align-items: baseline;
428
- gap: ${_[1.5]};
435
+ gap: ${w[1.5]};
429
436
  }
430
437
 
431
438
  .vd-price {
@@ -451,11 +458,11 @@
451
458
  color: ${L.white};
452
459
  }
453
460
 
454
- `;function Sr(){if(er(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=_r,document.head.appendChild(n)}function Ar(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class kr{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){Sr(),this.container=t,this.loading=new ar(t),this.slots.topRight=this.createSlot(t,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(t,"vd-slot-bottom-right")}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display="flex"),this.layout?.setVisible(!0)}mountToolbar(){if(this.actionBar!==null||this.slots.bottomRight===null||this.container===null)return;const t=typeof this.container.requestFullscreen=="function";this.actionBar=new lr({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement!==null?document.exitFullscreen():this.container.requestFullscreen())}updateProgress(t,e){this.loading?.updateProgress(t,e)}showError(t){this.loading?.showError(t)}applyViewerSettings(t){this.settings=t,t.language!==void 0&&we(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new st(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes";for(const i of e)this.attributes.appendChild(fr(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new pr(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=Er(this.settings.configuratorLayout),this.layout.attach(this.container,this.attributes)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new z({variant:"outline",size:"icon",label:Fi(),icon:D.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{Ar(e,i)})}})),!t&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls!==null?this.cameraControls.element.appendChild(this.screenshotBtn.element):this.slots.topRight.appendChild(this.screenshotBtn.element))}}class Be{constructor(t){this.send=t}send;placedCallbacks=[];setEnabled(t){this.send({type:I.ANNOTATION_TOGGLE,enabled:t})}startPlacing(){this.send({type:I.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:I.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(t){this.placedCallbacks.push(t)}handlePlaced(t){for(const e of this.placedCallbacks)e(t)}}class Tr{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;qrModal;options;iframe;container;viewerSessionId;readyCallbacks=[];mutationFailedCallbacks=[];constructor(t){this.options=t,this.initializeLogging(),this.messenger=new Kn(()=>this.iframe?.contentWindow??null);const e=i=>{this.messenger.send(i)};this.attributes=new Yn(e,(i,o)=>{for(const r of this.mutationFailedCallbacks)r({attribute:i,value:o})}),this.snapshotApi=new fe(e),this.annotationsApi=new Be(e),this.cameraApi=new ae(e),this.cameraPositionApi=new Jn,this.focusApi=new le(e,i=>{this.dispatchFocusChange(i)}),this.configurationApi=new ue(i=>{this.dispatchConfigurationChange(i)},i=>{this.dispatchConfigurationSubmit(i)}),this.eventBus=new Qn,this.qrModal=new Xo,this.readyStateTracker=new In(()=>{const i=this.readyCallbacks;this.readyCallbacks=[];for(const o of i)o(this);this.ui.onReady()}),this.ui=new kr({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(i,o)=>this.attributes.select(i,o),onSubscribe:(i,o)=>this.attributes.onChange(i,o),onAr:()=>{this.activateAr()}}),this.registerHandlers(),this.messenger.start(),this.createAndConnectIframe()}registerHandlers(){this.registerLifecycleHandlers(),this.messenger.on(I.MUTATION,t=>{zn(t)&&(this.attributes.handleMutationResult(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()))}),this.messenger.on(I.SNAPSHOT,t=>{Fn(t)&&this.snapshotApi.handleSnapshotResult(t)}),this.messenger.on(I.CAMERA,t=>{Un(t)&&this.cameraPositionApi.handlePositionUpdate(t)}),this.messenger.on(I.LOADING_INDICATOR,t=>{Vn(t)&&(t.error!==void 0?this.ui.showError(t.error):this.ui.updateProgress(t.progress,t.phase))}),this.messenger.on(I.CONFIG,t=>{qn(t)&&this.handleConfig(t)}),this.messenger.on(I.ANNOTATION_PLACED,t=>{jn(t)&&this.annotationsApi.handlePlaced(t.position)}),this.messenger.on(I.MAPPING,t=>{$n(t)&&(this.attributes.handleMappingReceived(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()),this.ui.renderAttributeControls(this.attributes,t.attributes),this.readyStateTracker.handleMappingReceived())}),this.registerFacadeStateHandlers()}registerLifecycleHandlers(){this.messenger.on(I.HANDSHAKE,t=>{xn(t)&&(M.logger.info("Server handshake received, flushing publisher queue"),this.messenger.markReady())}),this.messenger.on(I.SESSION,t=>{Dn(t)&&(this.viewerSessionId=t.sessionId)})}registerFacadeStateHandlers(){this.messenger.on(I.FOCUS,t=>{Hn(t)&&this.focusApi.handleStateReceived(t)}),this.messenger.on(I.PRICING,t=>{Gn(t)&&this.configurationApi.handlePricingReceived(t.pricing)})}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(Z.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(Z.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(Z.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=this.options.viewerSettings;if(e!==void 0||i!==void 0){const o=i!==void 0?{...e??{},...i}:e;if(i!==void 0&&e!==void 0){const r=Object.entries(i).filter(([s,a])=>e[s]!==a).map(([s,a])=>`${s} (metadata: ${e[s]??"undefined"}, override: ${a})`);r.length>0&&M.logger.warn(`Viewer settings override active: ${r.join(", ")}`)}this.ui.applyViewerSettings(o),this.annotationsApi.setEnabled(o.annotations!==!1)}this.cameraPositionApi.applyLimits(t.cameraLimits)}activateAr(){if(Rn()){this.messenger.send({type:I.AR_ACTIVATE});return}this.qrModal.show(this.iframe?.src??"")}initializeLogging(){this.options.debug===!0&&ne(),M.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new vn(this.options).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get viewerSettings(){return this.ui.viewerSettings}get sessionId(){return this.viewerSessionId}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.qrModal.hide(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}}function Rr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var X={},_t,Le;function Nr(){return Le||(Le=1,_t=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),_t}var St={},G={},Oe;function Y(){if(Oe)return G;Oe=1;let n;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return G.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},G.getSymbolTotalCodewords=function(i){return t[i]},G.getBCHDigit=function(e){let i=0;for(;e!==0;)i++,e>>>=1;return i},G.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');n=i},G.isKanjiModeEnabled=function(){return typeof n<"u"},G.toSJIS=function(i){return n(i)},G}var At={},xe;function kt(){return xe||(xe=1,(function(n){n.L={bit:1},n.M={bit:0},n.Q={bit:3},n.H={bit:2};function t(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return n.L;case"m":case"medium":return n.M;case"q":case"quartile":return n.Q;case"h":case"high":return n.H;default:throw new Error("Unknown EC Level: "+e)}}n.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},n.from=function(i,o){if(n.isValid(i))return i;try{return t(i)}catch{return o}}})(At)),At}var Tt,De;function Ir(){if(De)return Tt;De=1;function n(){this.buffer=[],this.length=0}return n.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let i=0;i<e;i++)this.putBit((t>>>e-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},Tt=n,Tt}var Rt,ze;function Mr(){if(ze)return Rt;ze=1;function n(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return n.prototype.set=function(t,e,i,o){const r=t*this.size+e;this.data[r]=i,o&&(this.reservedBit[r]=!0)},n.prototype.get=function(t,e){return this.data[t*this.size+e]},n.prototype.xor=function(t,e,i){this.data[t*this.size+e]^=i},n.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},Rt=n,Rt}var Nt={},Fe;function Pr(){return Fe||(Fe=1,(function(n){const t=Y().getSymbolSize;n.getRowColCoords=function(i){if(i===1)return[];const o=Math.floor(i/7)+2,r=t(i),s=r===145?26:Math.ceil((r-13)/(2*o-2))*2,a=[r-7];for(let l=1;l<o-1;l++)a[l]=a[l-1]-s;return a.push(6),a.reverse()},n.getPositions=function(i){const o=[],r=n.getRowColCoords(i),s=r.length;for(let a=0;a<s;a++)for(let l=0;l<s;l++)a===0&&l===0||a===0&&l===s-1||a===s-1&&l===0||o.push([r[a],r[l]]);return o}})(Nt)),Nt}var It={},Ue;function Br(){if(Ue)return It;Ue=1;const n=Y().getSymbolSize,t=7;return It.getPositions=function(i){const o=n(i);return[[0,0],[o-t,0],[0,o-t]]},It}var Mt={},$e;function Lr(){return $e||($e=1,(function(n){n.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};n.isValid=function(o){return o!=null&&o!==""&&!isNaN(o)&&o>=0&&o<=7},n.from=function(o){return n.isValid(o)?parseInt(o,10):void 0},n.getPenaltyN1=function(o){const r=o.size;let s=0,a=0,l=0,c=null,u=null;for(let h=0;h<r;h++){a=l=0,c=u=null;for(let f=0;f<r;f++){let d=o.get(h,f);d===c?a++:(a>=5&&(s+=t.N1+(a-5)),c=d,a=1),d=o.get(f,h),d===u?l++:(l>=5&&(s+=t.N1+(l-5)),u=d,l=1)}a>=5&&(s+=t.N1+(a-5)),l>=5&&(s+=t.N1+(l-5))}return s},n.getPenaltyN2=function(o){const r=o.size;let s=0;for(let a=0;a<r-1;a++)for(let l=0;l<r-1;l++){const c=o.get(a,l)+o.get(a,l+1)+o.get(a+1,l)+o.get(a+1,l+1);(c===4||c===0)&&s++}return s*t.N2},n.getPenaltyN3=function(o){const r=o.size;let s=0,a=0,l=0;for(let c=0;c<r;c++){a=l=0;for(let u=0;u<r;u++)a=a<<1&2047|o.get(c,u),u>=10&&(a===1488||a===93)&&s++,l=l<<1&2047|o.get(u,c),u>=10&&(l===1488||l===93)&&s++}return s*t.N3},n.getPenaltyN4=function(o){let r=0;const s=o.data.length;for(let l=0;l<s;l++)r+=o.data[l];return Math.abs(Math.ceil(r*100/s/5)-10)*t.N4};function e(i,o,r){switch(i){case n.Patterns.PATTERN000:return(o+r)%2===0;case n.Patterns.PATTERN001:return o%2===0;case n.Patterns.PATTERN010:return r%3===0;case n.Patterns.PATTERN011:return(o+r)%3===0;case n.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(r/3))%2===0;case n.Patterns.PATTERN101:return o*r%2+o*r%3===0;case n.Patterns.PATTERN110:return(o*r%2+o*r%3)%2===0;case n.Patterns.PATTERN111:return(o*r%3+(o+r)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}n.applyMask=function(o,r){const s=r.size;for(let a=0;a<s;a++)for(let l=0;l<s;l++)r.isReserved(l,a)||r.xor(l,a,e(o,l,a))},n.getBestMask=function(o,r){const s=Object.keys(n.Patterns).length;let a=0,l=1/0;for(let c=0;c<s;c++){r(c),n.applyMask(c,o);const u=n.getPenaltyN1(o)+n.getPenaltyN2(o)+n.getPenaltyN3(o)+n.getPenaltyN4(o);n.applyMask(c,o),u<l&&(l=u,a=c)}return a}})(Mt)),Mt}var at={},Ve;function qe(){if(Ve)return at;Ve=1;const n=kt(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],e=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return at.getBlocksCount=function(o,r){switch(r){case n.L:return t[(o-1)*4+0];case n.M:return t[(o-1)*4+1];case n.Q:return t[(o-1)*4+2];case n.H:return t[(o-1)*4+3];default:return}},at.getTotalCodewordsCount=function(o,r){switch(r){case n.L:return e[(o-1)*4+0];case n.M:return e[(o-1)*4+1];case n.Q:return e[(o-1)*4+2];case n.H:return e[(o-1)*4+3];default:return}},at}var Pt={},nt={},je;function Or(){if(je)return nt;je=1;const n=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let o=0;o<255;o++)n[o]=i,t[i]=o,i<<=1,i&256&&(i^=285);for(let o=255;o<512;o++)n[o]=n[o-255]})(),nt.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},nt.exp=function(i){return n[i]},nt.mul=function(i,o){return i===0||o===0?0:n[t[i]+t[o]]},nt}var He;function xr(){return He||(He=1,(function(n){const t=Or();n.mul=function(i,o){const r=new Uint8Array(i.length+o.length-1);for(let s=0;s<i.length;s++)for(let a=0;a<o.length;a++)r[s+a]^=t.mul(i[s],o[a]);return r},n.mod=function(i,o){let r=new Uint8Array(i);for(;r.length-o.length>=0;){const s=r[0];for(let l=0;l<o.length;l++)r[l]^=t.mul(o[l],s);let a=0;for(;a<r.length&&r[a]===0;)a++;r=r.slice(a)}return r},n.generateECPolynomial=function(i){let o=new Uint8Array([1]);for(let r=0;r<i;r++)o=n.mul(o,new Uint8Array([1,t.exp(r)]));return o}})(Pt)),Pt}var Bt,Ge;function Dr(){if(Ge)return Bt;Ge=1;const n=xr();function t(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=n.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(i.length+this.degree);o.set(i);const r=n.mod(o,this.genPoly),s=this.degree-r.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(r,s),a}return r},Bt=t,Bt}var Lt={},Ot={},xt={},Ke;function Ye(){return Ke||(Ke=1,xt.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),xt}var q={},Je;function Ze(){if(Je)return q;Je=1;const n="[0-9]+",t="[A-Z $%*+\\-./:]+";let e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";e=e.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+e+`)(?:.|[\r
455
- ]))+`;q.KANJI=new RegExp(e,"g"),q.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),q.BYTE=new RegExp(i,"g"),q.NUMERIC=new RegExp(n,"g"),q.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+e+"$"),r=new RegExp("^"+n+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return q.testKanji=function(l){return o.test(l)},q.testNumeric=function(l){return r.test(l)},q.testAlphanumeric=function(l){return s.test(l)},q}var We;function J(){return We||(We=1,(function(n){const t=Ye(),e=Ze();n.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},n.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},n.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},n.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},n.MIXED={bit:-1},n.getCharCountIndicator=function(r,s){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?r.ccBits[0]:s<27?r.ccBits[1]:r.ccBits[2]},n.getBestModeForData=function(r){return e.testNumeric(r)?n.NUMERIC:e.testAlphanumeric(r)?n.ALPHANUMERIC:e.testKanji(r)?n.KANJI:n.BYTE},n.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},n.isValid=function(r){return r&&r.bit&&r.ccBits};function i(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return n.NUMERIC;case"alphanumeric":return n.ALPHANUMERIC;case"kanji":return n.KANJI;case"byte":return n.BYTE;default:throw new Error("Unknown mode: "+o)}}n.from=function(r,s){if(n.isValid(r))return r;try{return i(r)}catch{return s}}})(Ot)),Ot}var Qe;function zr(){return Qe||(Qe=1,(function(n){const t=Y(),e=qe(),i=kt(),o=J(),r=Ye(),s=7973,a=t.getBCHDigit(s);function l(f,d,p){for(let k=1;k<=40;k++)if(d<=n.getCapacity(k,p,f))return k}function c(f,d){return o.getCharCountIndicator(f,d)+4}function u(f,d){let p=0;return f.forEach(function(k){const B=c(k.mode,d);p+=B+k.getBitsLength()}),p}function h(f,d){for(let p=1;p<=40;p++)if(u(f,p)<=n.getCapacity(p,d,o.MIXED))return p}n.from=function(d,p){return r.isValid(d)?parseInt(d,10):p},n.getCapacity=function(d,p,k){if(!r.isValid(d))throw new Error("Invalid QR Code version");typeof k>"u"&&(k=o.BYTE);const B=t.getSymbolTotalCodewords(d),E=e.getTotalCodewordsCount(d,p),N=(B-E)*8;if(k===o.MIXED)return N;const T=N-c(k,d);switch(k){case o.NUMERIC:return Math.floor(T/10*3);case o.ALPHANUMERIC:return Math.floor(T/11*2);case o.KANJI:return Math.floor(T/13);case o.BYTE:default:return Math.floor(T/8)}},n.getBestVersionForData=function(d,p){let k;const B=i.from(p,i.M);if(Array.isArray(d)){if(d.length>1)return h(d,B);if(d.length===0)return 1;k=d[0]}else k=d;return l(k.mode,k.getLength(),B)},n.getEncodedBits=function(d){if(!r.isValid(d)||d<7)throw new Error("Invalid QR Code version");let p=d<<12;for(;t.getBCHDigit(p)-a>=0;)p^=s<<t.getBCHDigit(p)-a;return d<<12|p}})(Lt)),Lt}var Dt={},Xe;function Fr(){if(Xe)return Dt;Xe=1;const n=Y(),t=1335,e=21522,i=n.getBCHDigit(t);return Dt.getEncodedBits=function(r,s){const a=r.bit<<3|s;let l=a<<10;for(;n.getBCHDigit(l)-i>=0;)l^=t<<n.getBCHDigit(l)-i;return(a<<10|l)^e},Dt}var zt={},Ft,tn;function Ur(){if(tn)return Ft;tn=1;const n=J();function t(e){this.mode=n.NUMERIC,this.data=e.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let o,r,s;for(o=0;o+3<=this.data.length;o+=3)r=this.data.substr(o,3),s=parseInt(r,10),i.put(s,10);const a=this.data.length-o;a>0&&(r=this.data.substr(o),s=parseInt(r,10),i.put(s,a*3+1))},Ft=t,Ft}var Ut,en;function $r(){if(en)return Ut;en=1;const n=J(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function e(i){this.mode=n.ALPHANUMERIC,this.data=i}return e.getBitsLength=function(o){return 11*Math.floor(o/2)+6*(o%2)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(o){let r;for(r=0;r+2<=this.data.length;r+=2){let s=t.indexOf(this.data[r])*45;s+=t.indexOf(this.data[r+1]),o.put(s,11)}this.data.length%2&&o.put(t.indexOf(this.data[r]),6)},Ut=e,Ut}var $t,nn;function Vr(){if(nn)return $t;nn=1;const n=J();function t(e){this.mode=n.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(e){for(let i=0,o=this.data.length;i<o;i++)e.put(this.data[i],8)},$t=t,$t}var Vt,on;function qr(){if(on)return Vt;on=1;const n=J(),t=Y();function e(i){this.mode=n.KANJI,this.data=i}return e.getBitsLength=function(o){return o*13},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(i){let o;for(o=0;o<this.data.length;o++){let r=t.toSJIS(this.data[o]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[o]+`
456
- Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),i.put(r,13)}},Vt=e,Vt}var qt={exports:{}},rn;function jr(){return rn||(rn=1,(function(n){var t={single_source_shortest_paths:function(e,i,o){var r={},s={};s[i]=0;var a=t.PriorityQueue.make();a.push(i,0);for(var l,c,u,h,f,d,p,k,B;!a.empty();){l=a.pop(),c=l.value,h=l.cost,f=e[c]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],p=h+d,k=s[u],B=typeof s[u]>"u",(B||k>p)&&(s[u]=p,a.push(u,p),r[u]=c))}if(typeof o<"u"&&typeof s[o]>"u"){var E=["Could not find a path from ",i," to ",o,"."].join("");throw new Error(E)}return r},extract_shortest_path_from_predecessor_list:function(e,i){for(var o=[],r=i;r;)o.push(r),e[r],r=e[r];return o.reverse(),o},find_path:function(e,i,o){var r=t.single_source_shortest_paths(e,i,o);return t.extract_shortest_path_from_predecessor_list(r,o)},PriorityQueue:{make:function(e){var i=t.PriorityQueue,o={},r;e=e||{};for(r in i)i.hasOwnProperty(r)&&(o[r]=i[r]);return o.queue=[],o.sorter=e.sorter||i.default_sorter,o},default_sorter:function(e,i){return e.cost-i.cost},push:function(e,i){var o={value:e,cost:i};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};n.exports=t})(qt)),qt.exports}var sn;function Hr(){return sn||(sn=1,(function(n){const t=J(),e=Ur(),i=$r(),o=Vr(),r=qr(),s=Ze(),a=Y(),l=jr();function c(E){return unescape(encodeURIComponent(E)).length}function u(E,N,T){const S=[];let O;for(;(O=E.exec(T))!==null;)S.push({data:O[0],index:O.index,mode:N,length:O[0].length});return S}function h(E){const N=u(s.NUMERIC,t.NUMERIC,E),T=u(s.ALPHANUMERIC,t.ALPHANUMERIC,E);let S,O;return a.isKanjiModeEnabled()?(S=u(s.BYTE,t.BYTE,E),O=u(s.KANJI,t.KANJI,E)):(S=u(s.BYTE_KANJI,t.BYTE,E),O=[]),N.concat(T,S,O).sort(function(w,y){return w.index-y.index}).map(function(w){return{data:w.data,mode:w.mode,length:w.length}})}function f(E,N){switch(N){case t.NUMERIC:return e.getBitsLength(E);case t.ALPHANUMERIC:return i.getBitsLength(E);case t.KANJI:return r.getBitsLength(E);case t.BYTE:return o.getBitsLength(E)}}function d(E){return E.reduce(function(N,T){const S=N.length-1>=0?N[N.length-1]:null;return S&&S.mode===T.mode?(N[N.length-1].data+=T.data,N):(N.push(T),N)},[])}function p(E){const N=[];for(let T=0;T<E.length;T++){const S=E[T];switch(S.mode){case t.NUMERIC:N.push([S,{data:S.data,mode:t.ALPHANUMERIC,length:S.length},{data:S.data,mode:t.BYTE,length:S.length}]);break;case t.ALPHANUMERIC:N.push([S,{data:S.data,mode:t.BYTE,length:S.length}]);break;case t.KANJI:N.push([S,{data:S.data,mode:t.BYTE,length:c(S.data)}]);break;case t.BYTE:N.push([{data:S.data,mode:t.BYTE,length:c(S.data)}])}}return N}function k(E,N){const T={},S={start:{}};let O=["start"];for(let m=0;m<E.length;m++){const w=E[m],y=[];for(let g=0;g<w.length;g++){const A=w[g],b=""+m+g;y.push(b),T[b]={node:A,lastCount:0},S[b]={};for(let C=0;C<O.length;C++){const v=O[C];T[v]&&T[v].node.mode===A.mode?(S[v][b]=f(T[v].lastCount+A.length,A.mode)-f(T[v].lastCount,A.mode),T[v].lastCount+=A.length):(T[v]&&(T[v].lastCount=A.length),S[v][b]=f(A.length,A.mode)+4+t.getCharCountIndicator(A.mode,N))}}O=y}for(let m=0;m<O.length;m++)S[O[m]].end=0;return{map:S,table:T}}function B(E,N){let T;const S=t.getBestModeForData(E);if(T=t.from(N,S),T!==t.BYTE&&T.bit<S.bit)throw new Error('"'+E+'" cannot be encoded with mode '+t.toString(T)+`.
457
- Suggested mode is: `+t.toString(S));switch(T===t.KANJI&&!a.isKanjiModeEnabled()&&(T=t.BYTE),T){case t.NUMERIC:return new e(E);case t.ALPHANUMERIC:return new i(E);case t.KANJI:return new r(E);case t.BYTE:return new o(E)}}n.fromArray=function(N){return N.reduce(function(T,S){return typeof S=="string"?T.push(B(S,null)):S.data&&T.push(B(S.data,S.mode)),T},[])},n.fromString=function(N,T){const S=h(N,a.isKanjiModeEnabled()),O=p(S),m=k(O,T),w=l.find_path(m.map,"start","end"),y=[];for(let g=1;g<w.length-1;g++)y.push(m.table[w[g]].node);return n.fromArray(d(y))},n.rawSplit=function(N){return n.fromArray(h(N,a.isKanjiModeEnabled()))}})(zt)),zt}var an;function Gr(){if(an)return St;an=1;const n=Y(),t=kt(),e=Ir(),i=Mr(),o=Pr(),r=Br(),s=Lr(),a=qe(),l=Dr(),c=zr(),u=Fr(),h=J(),f=Hr();function d(m,w){const y=m.size,g=r.getPositions(w);for(let A=0;A<g.length;A++){const b=g[A][0],C=g[A][1];for(let v=-1;v<=7;v++)if(!(b+v<=-1||y<=b+v))for(let R=-1;R<=7;R++)C+R<=-1||y<=C+R||(v>=0&&v<=6&&(R===0||R===6)||R>=0&&R<=6&&(v===0||v===6)||v>=2&&v<=4&&R>=2&&R<=4?m.set(b+v,C+R,!0,!0):m.set(b+v,C+R,!1,!0))}}function p(m){const w=m.size;for(let y=8;y<w-8;y++){const g=y%2===0;m.set(y,6,g,!0),m.set(6,y,g,!0)}}function k(m,w){const y=o.getPositions(w);for(let g=0;g<y.length;g++){const A=y[g][0],b=y[g][1];for(let C=-2;C<=2;C++)for(let v=-2;v<=2;v++)C===-2||C===2||v===-2||v===2||C===0&&v===0?m.set(A+C,b+v,!0,!0):m.set(A+C,b+v,!1,!0)}}function B(m,w){const y=m.size,g=c.getEncodedBits(w);let A,b,C;for(let v=0;v<18;v++)A=Math.floor(v/3),b=v%3+y-8-3,C=(g>>v&1)===1,m.set(A,b,C,!0),m.set(b,A,C,!0)}function E(m,w,y){const g=m.size,A=u.getEncodedBits(w,y);let b,C;for(b=0;b<15;b++)C=(A>>b&1)===1,b<6?m.set(b,8,C,!0):b<8?m.set(b+1,8,C,!0):m.set(g-15+b,8,C,!0),b<8?m.set(8,g-b-1,C,!0):b<9?m.set(8,15-b-1+1,C,!0):m.set(8,15-b-1,C,!0);m.set(g-8,8,1,!0)}function N(m,w){const y=m.size;let g=-1,A=y-1,b=7,C=0;for(let v=y-1;v>0;v-=2)for(v===6&&v--;;){for(let R=0;R<2;R++)if(!m.isReserved(A,v-R)){let K=!1;C<w.length&&(K=(w[C]>>>b&1)===1),m.set(A,v-R,K),b--,b===-1&&(C++,b=7)}if(A+=g,A<0||y<=A){A-=g,g=-g;break}}}function T(m,w,y){const g=new e;y.forEach(function(R){g.put(R.mode.bit,4),g.put(R.getLength(),h.getCharCountIndicator(R.mode,m)),R.write(g)});const A=n.getSymbolTotalCodewords(m),b=a.getTotalCodewordsCount(m,w),C=(A-b)*8;for(g.getLengthInBits()+4<=C&&g.put(0,4);g.getLengthInBits()%8!==0;)g.putBit(0);const v=(C-g.getLengthInBits())/8;for(let R=0;R<v;R++)g.put(R%2?17:236,8);return S(g,m,w)}function S(m,w,y){const g=n.getSymbolTotalCodewords(w),A=a.getTotalCodewordsCount(w,y),b=g-A,C=a.getBlocksCount(w,y),v=g%C,R=C-v,K=Math.floor(g/C),it=Math.floor(b/C),Wr=it+1,gn=K-it,Qr=new l(gn);let Kt=0;const lt=new Array(C),mn=new Array(C);let Yt=0;const Xr=new Uint8Array(m.buffer);for(let tt=0;tt<C;tt++){const Zt=tt<R?it:Wr;lt[tt]=Xr.slice(Kt,Kt+Zt),mn[tt]=Qr.encode(lt[tt]),Kt+=Zt,Yt=Math.max(Yt,Zt)}const Jt=new Uint8Array(g);let pn=0,j,H;for(j=0;j<Yt;j++)for(H=0;H<C;H++)j<lt[H].length&&(Jt[pn++]=lt[H][j]);for(j=0;j<gn;j++)for(H=0;H<C;H++)Jt[pn++]=mn[H][j];return Jt}function O(m,w,y,g){let A;if(Array.isArray(m))A=f.fromArray(m);else if(typeof m=="string"){let K=w;if(!K){const it=f.rawSplit(m);K=c.getBestVersionForData(it,y)}A=f.fromString(m,K||40)}else throw new Error("Invalid data");const b=c.getBestVersionForData(A,y);if(!b)throw new Error("The amount of data is too big to be stored in a QR Code");if(!w)w=b;else if(w<b)throw new Error(`
461
+ `;function Sr(){if(er(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=_r,document.head.appendChild(n)}function Ar(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class kr{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;layout=null;commerce=null;constructor(t){this.options=t}attach(t){Sr(),this.container=t,this.loading=new ar(t),this.slots.topRight=this.createSlot(t,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(t,"vd-slot-bottom-right")}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display="flex"),this.layout?.setVisible(!0)}mountToolbar(){if(this.actionBar!==null||this.slots.bottomRight===null||this.container===null)return;const t=typeof this.container.requestFullscreen=="function";this.actionBar=new lr({onAr:this.options.onAr,onFullscreen:t?()=>{this.toggleFullscreen()}:void 0}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement!==null?document.exitFullscreen():(this.options.onFullscreenEnter?.(),this.container.requestFullscreen()))}updateProgress(t,e){this.loading?.updateProgress(t,e)}showError(t){this.loading?.showError(t)}applyViewerSettings(t){this.settings=t,t.language!==void 0&&we(t.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(t),this.cameraControls!==null&&(this.cameraControls.element.style.display=t.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(t,e){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new st(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),e.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes";for(const i of e)this.attributes.appendChild(fr(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new pr(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=Er(this.settings.configuratorLayout),this.layout.attach(this.container,this.attributes)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.layout?.destroy(),this.layout=null}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.teardownConfigurator();for(const t of Object.values(this.slots))t?.remove();this.container=null}createSlot(t,e){const i=document.createElement("div");return i.className=e,t.appendChild(i),i}syncScreenshotButton(){const t=this.settings.screenshot===!0;t&&this.screenshotBtn===null&&(this.screenshotBtn=new F({variant:"outline",size:"icon",label:zi(),icon:D.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{Ar(e,i)})}})),!t&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}placeScreenshotButton(){this.screenshotBtn===null||this.slots.topRight===null||(this.cameraControls!==null?this.cameraControls.element.appendChild(this.screenshotBtn.element):this.slots.topRight.appendChild(this.screenshotBtn.element))}}class Be{constructor(t){this.send=t}send;placedCallbacks=[];setEnabled(t){this.send({type:I.ANNOTATION_TOGGLE,enabled:t})}startPlacing(){this.send({type:I.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:I.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(t){this.placedCallbacks.push(t)}handlePlaced(t){for(const e of this.placedCallbacks)e(t)}}class Tr{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;qrModal;options;iframe;container;viewerSessionId;readyCallbacks=[];mutationFailedCallbacks=[];constructor(t){this.options=t,this.initializeLogging(),this.messenger=new Kn(()=>this.iframe?.contentWindow??null);const e=i=>{this.messenger.send(i)};this.attributes=new Yn(e,(i,o)=>{for(const r of this.mutationFailedCallbacks)r({attribute:i,value:o})}),this.snapshotApi=new fe(e),this.annotationsApi=new Be(e),this.cameraApi=new ae(e),this.cameraPositionApi=new Jn,this.focusApi=new le(e,i=>{this.dispatchFocusChange(i)}),this.configurationApi=new ue(i=>{this.dispatchConfigurationChange(i)},i=>{this.dispatchConfigurationSubmit(i)}),this.eventBus=new Qn,this.qrModal=new Xo,this.readyStateTracker=new In(()=>{const i=this.readyCallbacks;this.readyCallbacks=[];for(const o of i)o(this);this.ui.onReady()}),this.ui=new kr({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(i,o)=>this.attributes.select(i,o),onSubscribe:(i,o)=>this.attributes.onChange(i,o),onAr:()=>{this.activateAr()},onFullscreenEnter:()=>{this.trackFullscreen()}}),this.registerHandlers(),this.messenger.start(),this.createAndConnectIframe()}registerHandlers(){this.registerLifecycleHandlers(),this.messenger.on(I.MUTATION,t=>{Fn(t)&&(this.attributes.handleMutationResult(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()))}),this.messenger.on(I.SNAPSHOT,t=>{zn(t)&&this.snapshotApi.handleSnapshotResult(t)}),this.messenger.on(I.CAMERA,t=>{Un(t)&&this.cameraPositionApi.handlePositionUpdate(t)}),this.messenger.on(I.LOADING_INDICATOR,t=>{Vn(t)&&(t.error!==void 0?this.ui.showError(t.error):this.ui.updateProgress(t.progress,t.phase))}),this.messenger.on(I.CONFIG,t=>{qn(t)&&this.handleConfig(t)}),this.messenger.on(I.ANNOTATION_PLACED,t=>{jn(t)&&this.annotationsApi.handlePlaced(t.position)}),this.messenger.on(I.MAPPING,t=>{$n(t)&&(this.attributes.handleMappingReceived(t),this.configurationApi.handleSelectionChanged(this.attributes.getSelection()),this.ui.renderAttributeControls(this.attributes,t.attributes),this.readyStateTracker.handleMappingReceived())}),this.registerFacadeStateHandlers()}registerLifecycleHandlers(){this.messenger.on(I.HANDSHAKE,t=>{xn(t)&&(M.logger.info("Server handshake received, flushing publisher queue"),this.messenger.markReady())}),this.messenger.on(I.SESSION,t=>{Dn(t)&&(this.viewerSessionId=t.sessionId)})}registerFacadeStateHandlers(){this.messenger.on(I.FOCUS,t=>{Hn(t)&&this.focusApi.handleStateReceived(t)}),this.messenger.on(I.PRICING,t=>{Gn(t)&&this.configurationApi.handlePricingReceived(t.pricing)})}dispatchFocusChange(t){this.container?.dispatchEvent(new CustomEvent(Z.FOCUS_CHANGE,{detail:t,bubbles:!0}))}dispatchConfigurationChange(t){this.container?.dispatchEvent(new CustomEvent(Z.CONFIGURATION_CHANGE,{detail:t??null,bubbles:!0}))}dispatchConfigurationSubmit(t){this.container?.dispatchEvent(new CustomEvent(Z.CONFIGURATION_SUBMIT,{detail:t,bubbles:!0}))}handleConfig(t){const e=t.viewerSettings,i=this.options.viewerSettings;if(e!==void 0||i!==void 0){const o=i!==void 0?{...e??{},...i}:e;if(i!==void 0&&e!==void 0){const r=Object.entries(i).filter(([s,a])=>e[s]!==a).map(([s,a])=>`${s} (metadata: ${e[s]??"undefined"}, override: ${a})`);r.length>0&&M.logger.warn(`Viewer settings override active: ${r.join(", ")}`)}this.ui.applyViewerSettings(o),this.annotationsApi.setEnabled(o.annotations!==!1)}this.cameraPositionApi.applyLimits(t.cameraLimits)}activateAr(){if(Rn()){this.messenger.send({type:I.AR_ACTIVATE});return}this.qrModal.show(this.iframe?.src??"")}trackFullscreen(){this.messenger.send({type:I.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&ne(),M.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new vn(this.options).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{const i=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(i)}catch{}}select(t,e){this.attributes.select(t,e)}getValues(t){return this.attributes.getValues(t)}getValue(t,e){return this.attributes.getValue(t,e)}onChange(t,e){this.attributes.onChange(t,e)}getAttribute(t){return this.attributes.getAttribute(t)}get isReady(){return this.readyStateTracker.isReady}onReady(t){if(this.readyStateTracker.isReady){t(this);return}this.readyCallbacks.push(t)}onMutationFailed(t){this.mutationFailedCallbacks.push(t)}on(t,e){this.eventBus.on(t,e)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get focus(){return this.focusApi}get configuration(){return this.configurationApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get viewerSettings(){return this.ui.viewerSettings}get sessionId(){return this.viewerSessionId}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.qrModal.hide(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}}function Rr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var X={},_t,Le;function Nr(){return Le||(Le=1,_t=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),_t}var St={},G={},Oe;function Y(){if(Oe)return G;Oe=1;let n;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return G.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},G.getSymbolTotalCodewords=function(i){return t[i]},G.getBCHDigit=function(e){let i=0;for(;e!==0;)i++,e>>>=1;return i},G.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');n=i},G.isKanjiModeEnabled=function(){return typeof n<"u"},G.toSJIS=function(i){return n(i)},G}var At={},xe;function kt(){return xe||(xe=1,(function(n){n.L={bit:1},n.M={bit:0},n.Q={bit:3},n.H={bit:2};function t(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return n.L;case"m":case"medium":return n.M;case"q":case"quartile":return n.Q;case"h":case"high":return n.H;default:throw new Error("Unknown EC Level: "+e)}}n.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},n.from=function(i,o){if(n.isValid(i))return i;try{return t(i)}catch{return o}}})(At)),At}var Tt,De;function Ir(){if(De)return Tt;De=1;function n(){this.buffer=[],this.length=0}return n.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let i=0;i<e;i++)this.putBit((t>>>e-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},Tt=n,Tt}var Rt,Fe;function Mr(){if(Fe)return Rt;Fe=1;function n(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return n.prototype.set=function(t,e,i,o){const r=t*this.size+e;this.data[r]=i,o&&(this.reservedBit[r]=!0)},n.prototype.get=function(t,e){return this.data[t*this.size+e]},n.prototype.xor=function(t,e,i){this.data[t*this.size+e]^=i},n.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},Rt=n,Rt}var Nt={},ze;function Pr(){return ze||(ze=1,(function(n){const t=Y().getSymbolSize;n.getRowColCoords=function(i){if(i===1)return[];const o=Math.floor(i/7)+2,r=t(i),s=r===145?26:Math.ceil((r-13)/(2*o-2))*2,a=[r-7];for(let l=1;l<o-1;l++)a[l]=a[l-1]-s;return a.push(6),a.reverse()},n.getPositions=function(i){const o=[],r=n.getRowColCoords(i),s=r.length;for(let a=0;a<s;a++)for(let l=0;l<s;l++)a===0&&l===0||a===0&&l===s-1||a===s-1&&l===0||o.push([r[a],r[l]]);return o}})(Nt)),Nt}var It={},Ue;function Br(){if(Ue)return It;Ue=1;const n=Y().getSymbolSize,t=7;return It.getPositions=function(i){const o=n(i);return[[0,0],[o-t,0],[0,o-t]]},It}var Mt={},$e;function Lr(){return $e||($e=1,(function(n){n.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};n.isValid=function(o){return o!=null&&o!==""&&!isNaN(o)&&o>=0&&o<=7},n.from=function(o){return n.isValid(o)?parseInt(o,10):void 0},n.getPenaltyN1=function(o){const r=o.size;let s=0,a=0,l=0,c=null,u=null;for(let h=0;h<r;h++){a=l=0,c=u=null;for(let f=0;f<r;f++){let d=o.get(h,f);d===c?a++:(a>=5&&(s+=t.N1+(a-5)),c=d,a=1),d=o.get(f,h),d===u?l++:(l>=5&&(s+=t.N1+(l-5)),u=d,l=1)}a>=5&&(s+=t.N1+(a-5)),l>=5&&(s+=t.N1+(l-5))}return s},n.getPenaltyN2=function(o){const r=o.size;let s=0;for(let a=0;a<r-1;a++)for(let l=0;l<r-1;l++){const c=o.get(a,l)+o.get(a,l+1)+o.get(a+1,l)+o.get(a+1,l+1);(c===4||c===0)&&s++}return s*t.N2},n.getPenaltyN3=function(o){const r=o.size;let s=0,a=0,l=0;for(let c=0;c<r;c++){a=l=0;for(let u=0;u<r;u++)a=a<<1&2047|o.get(c,u),u>=10&&(a===1488||a===93)&&s++,l=l<<1&2047|o.get(u,c),u>=10&&(l===1488||l===93)&&s++}return s*t.N3},n.getPenaltyN4=function(o){let r=0;const s=o.data.length;for(let l=0;l<s;l++)r+=o.data[l];return Math.abs(Math.ceil(r*100/s/5)-10)*t.N4};function e(i,o,r){switch(i){case n.Patterns.PATTERN000:return(o+r)%2===0;case n.Patterns.PATTERN001:return o%2===0;case n.Patterns.PATTERN010:return r%3===0;case n.Patterns.PATTERN011:return(o+r)%3===0;case n.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(r/3))%2===0;case n.Patterns.PATTERN101:return o*r%2+o*r%3===0;case n.Patterns.PATTERN110:return(o*r%2+o*r%3)%2===0;case n.Patterns.PATTERN111:return(o*r%3+(o+r)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}n.applyMask=function(o,r){const s=r.size;for(let a=0;a<s;a++)for(let l=0;l<s;l++)r.isReserved(l,a)||r.xor(l,a,e(o,l,a))},n.getBestMask=function(o,r){const s=Object.keys(n.Patterns).length;let a=0,l=1/0;for(let c=0;c<s;c++){r(c),n.applyMask(c,o);const u=n.getPenaltyN1(o)+n.getPenaltyN2(o)+n.getPenaltyN3(o)+n.getPenaltyN4(o);n.applyMask(c,o),u<l&&(l=u,a=c)}return a}})(Mt)),Mt}var at={},Ve;function qe(){if(Ve)return at;Ve=1;const n=kt(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],e=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return at.getBlocksCount=function(o,r){switch(r){case n.L:return t[(o-1)*4+0];case n.M:return t[(o-1)*4+1];case n.Q:return t[(o-1)*4+2];case n.H:return t[(o-1)*4+3];default:return}},at.getTotalCodewordsCount=function(o,r){switch(r){case n.L:return e[(o-1)*4+0];case n.M:return e[(o-1)*4+1];case n.Q:return e[(o-1)*4+2];case n.H:return e[(o-1)*4+3];default:return}},at}var Pt={},nt={},je;function Or(){if(je)return nt;je=1;const n=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let o=0;o<255;o++)n[o]=i,t[i]=o,i<<=1,i&256&&(i^=285);for(let o=255;o<512;o++)n[o]=n[o-255]})(),nt.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},nt.exp=function(i){return n[i]},nt.mul=function(i,o){return i===0||o===0?0:n[t[i]+t[o]]},nt}var He;function xr(){return He||(He=1,(function(n){const t=Or();n.mul=function(i,o){const r=new Uint8Array(i.length+o.length-1);for(let s=0;s<i.length;s++)for(let a=0;a<o.length;a++)r[s+a]^=t.mul(i[s],o[a]);return r},n.mod=function(i,o){let r=new Uint8Array(i);for(;r.length-o.length>=0;){const s=r[0];for(let l=0;l<o.length;l++)r[l]^=t.mul(o[l],s);let a=0;for(;a<r.length&&r[a]===0;)a++;r=r.slice(a)}return r},n.generateECPolynomial=function(i){let o=new Uint8Array([1]);for(let r=0;r<i;r++)o=n.mul(o,new Uint8Array([1,t.exp(r)]));return o}})(Pt)),Pt}var Bt,Ge;function Dr(){if(Ge)return Bt;Ge=1;const n=xr();function t(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=n.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(i.length+this.degree);o.set(i);const r=n.mod(o,this.genPoly),s=this.degree-r.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(r,s),a}return r},Bt=t,Bt}var Lt={},Ot={},xt={},Ke;function Ye(){return Ke||(Ke=1,xt.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),xt}var q={},Je;function Ze(){if(Je)return q;Je=1;const n="[0-9]+",t="[A-Z $%*+\\-./:]+";let e="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";e=e.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+e+`)(?:.|[\r
462
+ ]))+`;q.KANJI=new RegExp(e,"g"),q.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),q.BYTE=new RegExp(i,"g"),q.NUMERIC=new RegExp(n,"g"),q.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+e+"$"),r=new RegExp("^"+n+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return q.testKanji=function(l){return o.test(l)},q.testNumeric=function(l){return r.test(l)},q.testAlphanumeric=function(l){return s.test(l)},q}var We;function J(){return We||(We=1,(function(n){const t=Ye(),e=Ze();n.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},n.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},n.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},n.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},n.MIXED={bit:-1},n.getCharCountIndicator=function(r,s){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?r.ccBits[0]:s<27?r.ccBits[1]:r.ccBits[2]},n.getBestModeForData=function(r){return e.testNumeric(r)?n.NUMERIC:e.testAlphanumeric(r)?n.ALPHANUMERIC:e.testKanji(r)?n.KANJI:n.BYTE},n.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},n.isValid=function(r){return r&&r.bit&&r.ccBits};function i(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return n.NUMERIC;case"alphanumeric":return n.ALPHANUMERIC;case"kanji":return n.KANJI;case"byte":return n.BYTE;default:throw new Error("Unknown mode: "+o)}}n.from=function(r,s){if(n.isValid(r))return r;try{return i(r)}catch{return s}}})(Ot)),Ot}var Qe;function Fr(){return Qe||(Qe=1,(function(n){const t=Y(),e=qe(),i=kt(),o=J(),r=Ye(),s=7973,a=t.getBCHDigit(s);function l(f,d,p){for(let k=1;k<=40;k++)if(d<=n.getCapacity(k,p,f))return k}function c(f,d){return o.getCharCountIndicator(f,d)+4}function u(f,d){let p=0;return f.forEach(function(k){const B=c(k.mode,d);p+=B+k.getBitsLength()}),p}function h(f,d){for(let p=1;p<=40;p++)if(u(f,p)<=n.getCapacity(p,d,o.MIXED))return p}n.from=function(d,p){return r.isValid(d)?parseInt(d,10):p},n.getCapacity=function(d,p,k){if(!r.isValid(d))throw new Error("Invalid QR Code version");typeof k>"u"&&(k=o.BYTE);const B=t.getSymbolTotalCodewords(d),_=e.getTotalCodewordsCount(d,p),N=(B-_)*8;if(k===o.MIXED)return N;const T=N-c(k,d);switch(k){case o.NUMERIC:return Math.floor(T/10*3);case o.ALPHANUMERIC:return Math.floor(T/11*2);case o.KANJI:return Math.floor(T/13);case o.BYTE:default:return Math.floor(T/8)}},n.getBestVersionForData=function(d,p){let k;const B=i.from(p,i.M);if(Array.isArray(d)){if(d.length>1)return h(d,B);if(d.length===0)return 1;k=d[0]}else k=d;return l(k.mode,k.getLength(),B)},n.getEncodedBits=function(d){if(!r.isValid(d)||d<7)throw new Error("Invalid QR Code version");let p=d<<12;for(;t.getBCHDigit(p)-a>=0;)p^=s<<t.getBCHDigit(p)-a;return d<<12|p}})(Lt)),Lt}var Dt={},Xe;function zr(){if(Xe)return Dt;Xe=1;const n=Y(),t=1335,e=21522,i=n.getBCHDigit(t);return Dt.getEncodedBits=function(r,s){const a=r.bit<<3|s;let l=a<<10;for(;n.getBCHDigit(l)-i>=0;)l^=t<<n.getBCHDigit(l)-i;return(a<<10|l)^e},Dt}var Ft={},zt,tn;function Ur(){if(tn)return zt;tn=1;const n=J();function t(e){this.mode=n.NUMERIC,this.data=e.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let o,r,s;for(o=0;o+3<=this.data.length;o+=3)r=this.data.substr(o,3),s=parseInt(r,10),i.put(s,10);const a=this.data.length-o;a>0&&(r=this.data.substr(o),s=parseInt(r,10),i.put(s,a*3+1))},zt=t,zt}var Ut,en;function $r(){if(en)return Ut;en=1;const n=J(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function e(i){this.mode=n.ALPHANUMERIC,this.data=i}return e.getBitsLength=function(o){return 11*Math.floor(o/2)+6*(o%2)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(o){let r;for(r=0;r+2<=this.data.length;r+=2){let s=t.indexOf(this.data[r])*45;s+=t.indexOf(this.data[r+1]),o.put(s,11)}this.data.length%2&&o.put(t.indexOf(this.data[r]),6)},Ut=e,Ut}var $t,nn;function Vr(){if(nn)return $t;nn=1;const n=J();function t(e){this.mode=n.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(e){for(let i=0,o=this.data.length;i<o;i++)e.put(this.data[i],8)},$t=t,$t}var Vt,on;function qr(){if(on)return Vt;on=1;const n=J(),t=Y();function e(i){this.mode=n.KANJI,this.data=i}return e.getBitsLength=function(o){return o*13},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(i){let o;for(o=0;o<this.data.length;o++){let r=t.toSJIS(this.data[o]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[o]+`
463
+ Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),i.put(r,13)}},Vt=e,Vt}var qt={exports:{}},rn;function jr(){return rn||(rn=1,(function(n){var t={single_source_shortest_paths:function(e,i,o){var r={},s={};s[i]=0;var a=t.PriorityQueue.make();a.push(i,0);for(var l,c,u,h,f,d,p,k,B;!a.empty();){l=a.pop(),c=l.value,h=l.cost,f=e[c]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],p=h+d,k=s[u],B=typeof s[u]>"u",(B||k>p)&&(s[u]=p,a.push(u,p),r[u]=c))}if(typeof o<"u"&&typeof s[o]>"u"){var _=["Could not find a path from ",i," to ",o,"."].join("");throw new Error(_)}return r},extract_shortest_path_from_predecessor_list:function(e,i){for(var o=[],r=i;r;)o.push(r),e[r],r=e[r];return o.reverse(),o},find_path:function(e,i,o){var r=t.single_source_shortest_paths(e,i,o);return t.extract_shortest_path_from_predecessor_list(r,o)},PriorityQueue:{make:function(e){var i=t.PriorityQueue,o={},r;e=e||{};for(r in i)i.hasOwnProperty(r)&&(o[r]=i[r]);return o.queue=[],o.sorter=e.sorter||i.default_sorter,o},default_sorter:function(e,i){return e.cost-i.cost},push:function(e,i){var o={value:e,cost:i};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};n.exports=t})(qt)),qt.exports}var sn;function Hr(){return sn||(sn=1,(function(n){const t=J(),e=Ur(),i=$r(),o=Vr(),r=qr(),s=Ze(),a=Y(),l=jr();function c(_){return unescape(encodeURIComponent(_)).length}function u(_,N,T){const S=[];let O;for(;(O=_.exec(T))!==null;)S.push({data:O[0],index:O.index,mode:N,length:O[0].length});return S}function h(_){const N=u(s.NUMERIC,t.NUMERIC,_),T=u(s.ALPHANUMERIC,t.ALPHANUMERIC,_);let S,O;return a.isKanjiModeEnabled()?(S=u(s.BYTE,t.BYTE,_),O=u(s.KANJI,t.KANJI,_)):(S=u(s.BYTE_KANJI,t.BYTE,_),O=[]),N.concat(T,S,O).sort(function(C,y){return C.index-y.index}).map(function(C){return{data:C.data,mode:C.mode,length:C.length}})}function f(_,N){switch(N){case t.NUMERIC:return e.getBitsLength(_);case t.ALPHANUMERIC:return i.getBitsLength(_);case t.KANJI:return r.getBitsLength(_);case t.BYTE:return o.getBitsLength(_)}}function d(_){return _.reduce(function(N,T){const S=N.length-1>=0?N[N.length-1]:null;return S&&S.mode===T.mode?(N[N.length-1].data+=T.data,N):(N.push(T),N)},[])}function p(_){const N=[];for(let T=0;T<_.length;T++){const S=_[T];switch(S.mode){case t.NUMERIC:N.push([S,{data:S.data,mode:t.ALPHANUMERIC,length:S.length},{data:S.data,mode:t.BYTE,length:S.length}]);break;case t.ALPHANUMERIC:N.push([S,{data:S.data,mode:t.BYTE,length:S.length}]);break;case t.KANJI:N.push([S,{data:S.data,mode:t.BYTE,length:c(S.data)}]);break;case t.BYTE:N.push([{data:S.data,mode:t.BYTE,length:c(S.data)}])}}return N}function k(_,N){const T={},S={start:{}};let O=["start"];for(let m=0;m<_.length;m++){const C=_[m],y=[];for(let g=0;g<C.length;g++){const A=C[g],b=""+m+g;y.push(b),T[b]={node:A,lastCount:0},S[b]={};for(let E=0;E<O.length;E++){const v=O[E];T[v]&&T[v].node.mode===A.mode?(S[v][b]=f(T[v].lastCount+A.length,A.mode)-f(T[v].lastCount,A.mode),T[v].lastCount+=A.length):(T[v]&&(T[v].lastCount=A.length),S[v][b]=f(A.length,A.mode)+4+t.getCharCountIndicator(A.mode,N))}}O=y}for(let m=0;m<O.length;m++)S[O[m]].end=0;return{map:S,table:T}}function B(_,N){let T;const S=t.getBestModeForData(_);if(T=t.from(N,S),T!==t.BYTE&&T.bit<S.bit)throw new Error('"'+_+'" cannot be encoded with mode '+t.toString(T)+`.
464
+ Suggested mode is: `+t.toString(S));switch(T===t.KANJI&&!a.isKanjiModeEnabled()&&(T=t.BYTE),T){case t.NUMERIC:return new e(_);case t.ALPHANUMERIC:return new i(_);case t.KANJI:return new r(_);case t.BYTE:return new o(_)}}n.fromArray=function(N){return N.reduce(function(T,S){return typeof S=="string"?T.push(B(S,null)):S.data&&T.push(B(S.data,S.mode)),T},[])},n.fromString=function(N,T){const S=h(N,a.isKanjiModeEnabled()),O=p(S),m=k(O,T),C=l.find_path(m.map,"start","end"),y=[];for(let g=1;g<C.length-1;g++)y.push(m.table[C[g]].node);return n.fromArray(d(y))},n.rawSplit=function(N){return n.fromArray(h(N,a.isKanjiModeEnabled()))}})(Ft)),Ft}var an;function Gr(){if(an)return St;an=1;const n=Y(),t=kt(),e=Ir(),i=Mr(),o=Pr(),r=Br(),s=Lr(),a=qe(),l=Dr(),c=Fr(),u=zr(),h=J(),f=Hr();function d(m,C){const y=m.size,g=r.getPositions(C);for(let A=0;A<g.length;A++){const b=g[A][0],E=g[A][1];for(let v=-1;v<=7;v++)if(!(b+v<=-1||y<=b+v))for(let R=-1;R<=7;R++)E+R<=-1||y<=E+R||(v>=0&&v<=6&&(R===0||R===6)||R>=0&&R<=6&&(v===0||v===6)||v>=2&&v<=4&&R>=2&&R<=4?m.set(b+v,E+R,!0,!0):m.set(b+v,E+R,!1,!0))}}function p(m){const C=m.size;for(let y=8;y<C-8;y++){const g=y%2===0;m.set(y,6,g,!0),m.set(6,y,g,!0)}}function k(m,C){const y=o.getPositions(C);for(let g=0;g<y.length;g++){const A=y[g][0],b=y[g][1];for(let E=-2;E<=2;E++)for(let v=-2;v<=2;v++)E===-2||E===2||v===-2||v===2||E===0&&v===0?m.set(A+E,b+v,!0,!0):m.set(A+E,b+v,!1,!0)}}function B(m,C){const y=m.size,g=c.getEncodedBits(C);let A,b,E;for(let v=0;v<18;v++)A=Math.floor(v/3),b=v%3+y-8-3,E=(g>>v&1)===1,m.set(A,b,E,!0),m.set(b,A,E,!0)}function _(m,C,y){const g=m.size,A=u.getEncodedBits(C,y);let b,E;for(b=0;b<15;b++)E=(A>>b&1)===1,b<6?m.set(b,8,E,!0):b<8?m.set(b+1,8,E,!0):m.set(g-15+b,8,E,!0),b<8?m.set(8,g-b-1,E,!0):b<9?m.set(8,15-b-1+1,E,!0):m.set(8,15-b-1,E,!0);m.set(g-8,8,1,!0)}function N(m,C){const y=m.size;let g=-1,A=y-1,b=7,E=0;for(let v=y-1;v>0;v-=2)for(v===6&&v--;;){for(let R=0;R<2;R++)if(!m.isReserved(A,v-R)){let K=!1;E<C.length&&(K=(C[E]>>>b&1)===1),m.set(A,v-R,K),b--,b===-1&&(E++,b=7)}if(A+=g,A<0||y<=A){A-=g,g=-g;break}}}function T(m,C,y){const g=new e;y.forEach(function(R){g.put(R.mode.bit,4),g.put(R.getLength(),h.getCharCountIndicator(R.mode,m)),R.write(g)});const A=n.getSymbolTotalCodewords(m),b=a.getTotalCodewordsCount(m,C),E=(A-b)*8;for(g.getLengthInBits()+4<=E&&g.put(0,4);g.getLengthInBits()%8!==0;)g.putBit(0);const v=(E-g.getLengthInBits())/8;for(let R=0;R<v;R++)g.put(R%2?17:236,8);return S(g,m,C)}function S(m,C,y){const g=n.getSymbolTotalCodewords(C),A=a.getTotalCodewordsCount(C,y),b=g-A,E=a.getBlocksCount(C,y),v=g%E,R=E-v,K=Math.floor(g/E),it=Math.floor(b/E),Wr=it+1,gn=K-it,Qr=new l(gn);let Kt=0;const lt=new Array(E),mn=new Array(E);let Yt=0;const Xr=new Uint8Array(m.buffer);for(let tt=0;tt<E;tt++){const Zt=tt<R?it:Wr;lt[tt]=Xr.slice(Kt,Kt+Zt),mn[tt]=Qr.encode(lt[tt]),Kt+=Zt,Yt=Math.max(Yt,Zt)}const Jt=new Uint8Array(g);let pn=0,j,H;for(j=0;j<Yt;j++)for(H=0;H<E;H++)j<lt[H].length&&(Jt[pn++]=lt[H][j]);for(j=0;j<gn;j++)for(H=0;H<E;H++)Jt[pn++]=mn[H][j];return Jt}function O(m,C,y,g){let A;if(Array.isArray(m))A=f.fromArray(m);else if(typeof m=="string"){let K=C;if(!K){const it=f.rawSplit(m);K=c.getBestVersionForData(it,y)}A=f.fromString(m,K||40)}else throw new Error("Invalid data");const b=c.getBestVersionForData(A,y);if(!b)throw new Error("The amount of data is too big to be stored in a QR Code");if(!C)C=b;else if(C<b)throw new Error(`
458
465
  The chosen QR Code version cannot contain this amount of data.
459
466
  Minimum version required to store current data is: `+b+`.
460
- `);const C=T(w,y,A),v=n.getSymbolSize(w),R=new i(v);return d(R,w),p(R),k(R,w),E(R,y,0),w>=7&&B(R,w),N(R,C),isNaN(g)&&(g=s.getBestMask(R,E.bind(null,R,y))),s.applyMask(g,R),E(R,y,g),{modules:R,version:w,errorCorrectionLevel:y,maskPattern:g,segments:A}}return St.create=function(w,y){if(typeof w>"u"||w==="")throw new Error("No input text");let g=t.M,A,b;return typeof y<"u"&&(g=t.from(y.errorCorrectionLevel,t.M),A=c.from(y.version),b=s.from(y.maskPattern),y.toSJISFunc&&n.setToSJISFunction(y.toSJISFunc)),O(w,A,g,b)},St}var jt={},Ht={},ln;function cn(){return ln||(ln=1,(function(n){function t(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let i=e.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+e);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(r){return[r,r]}))),i.length===6&&i.push("F","F");const o=parseInt(i.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+i.slice(0,6).join("")}}n.getOptions=function(i){i||(i={}),i.color||(i.color={});const o=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,r=i.width&&i.width>=21?i.width:void 0,s=i.scale||4;return{width:r,scale:r?4:s,margin:o,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},n.getScale=function(i,o){return o.width&&o.width>=i+o.margin*2?o.width/(i+o.margin*2):o.scale},n.getImageWidth=function(i,o){const r=n.getScale(i,o);return Math.floor((i+o.margin*2)*r)},n.qrToImageData=function(i,o,r){const s=o.modules.size,a=o.modules.data,l=n.getScale(s,r),c=Math.floor((s+r.margin*2)*l),u=r.margin*l,h=[r.color.light,r.color.dark];for(let f=0;f<c;f++)for(let d=0;d<c;d++){let p=(f*c+d)*4,k=r.color.light;if(f>=u&&d>=u&&f<c-u&&d<c-u){const B=Math.floor((f-u)/l),E=Math.floor((d-u)/l);k=h[a[B*s+E]?1:0]}i[p++]=k.r,i[p++]=k.g,i[p++]=k.b,i[p]=k.a}}})(Ht)),Ht}var un;function Kr(){return un||(un=1,(function(n){const t=cn();function e(o,r,s){o.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=s,r.width=s,r.style.height=s+"px",r.style.width=s+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}n.render=function(r,s,a){let l=a,c=s;typeof l>"u"&&(!s||!s.getContext)&&(l=s,s=void 0),s||(c=i()),l=t.getOptions(l);const u=t.getImageWidth(r.modules.size,l),h=c.getContext("2d"),f=h.createImageData(u,u);return t.qrToImageData(f.data,r,l),e(h,c,u),h.putImageData(f,0,0),c},n.renderToDataURL=function(r,s,a){let l=a;typeof l>"u"&&(!s||!s.getContext)&&(l=s,s=void 0),l||(l={});const c=n.render(r,s,l),u=l.type||"image/png",h=l.rendererOpts||{};return c.toDataURL(u,h.quality)}})(jt)),jt}var Gt={},dn;function Yr(){if(dn)return Gt;dn=1;const n=cn();function t(o,r){const s=o.a/255,a=r+'="'+o.hex+'"';return s<1?a+" "+r+'-opacity="'+s.toFixed(2).slice(1)+'"':a}function e(o,r,s){let a=o+r;return typeof s<"u"&&(a+=" "+s),a}function i(o,r,s){let a="",l=0,c=!1,u=0;for(let h=0;h<o.length;h++){const f=Math.floor(h%r),d=Math.floor(h/r);!f&&!c&&(c=!0),o[h]?(u++,h>0&&f>0&&o[h-1]||(a+=c?e("M",f+s,.5+d+s):e("m",l,0),l=0,c=!1),f+1<r&&o[h+1]||(a+=e("h",u),u=0)):l++}return a}return Gt.render=function(r,s,a){const l=n.getOptions(s),c=r.modules.size,u=r.modules.data,h=c+l.margin*2,f=l.color.light.a?"<path "+t(l.color.light,"fill")+' d="M0 0h'+h+"v"+h+'H0z"/>':"",d="<path "+t(l.color.dark,"stroke")+' d="'+i(u,c,l.margin)+'"/>',p='viewBox="0 0 '+h+" "+h+'"',B='<svg xmlns="http://www.w3.org/2000/svg" '+(l.width?'width="'+l.width+'" height="'+l.width+'" ':"")+p+' shape-rendering="crispEdges">'+f+d+`</svg>
467
+ `);const E=T(C,y,A),v=n.getSymbolSize(C),R=new i(v);return d(R,C),p(R),k(R,C),_(R,y,0),C>=7&&B(R,C),N(R,E),isNaN(g)&&(g=s.getBestMask(R,_.bind(null,R,y))),s.applyMask(g,R),_(R,y,g),{modules:R,version:C,errorCorrectionLevel:y,maskPattern:g,segments:A}}return St.create=function(C,y){if(typeof C>"u"||C==="")throw new Error("No input text");let g=t.M,A,b;return typeof y<"u"&&(g=t.from(y.errorCorrectionLevel,t.M),A=c.from(y.version),b=s.from(y.maskPattern),y.toSJISFunc&&n.setToSJISFunction(y.toSJISFunc)),O(C,A,g,b)},St}var jt={},Ht={},ln;function cn(){return ln||(ln=1,(function(n){function t(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let i=e.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+e);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(r){return[r,r]}))),i.length===6&&i.push("F","F");const o=parseInt(i.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+i.slice(0,6).join("")}}n.getOptions=function(i){i||(i={}),i.color||(i.color={});const o=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,r=i.width&&i.width>=21?i.width:void 0,s=i.scale||4;return{width:r,scale:r?4:s,margin:o,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},n.getScale=function(i,o){return o.width&&o.width>=i+o.margin*2?o.width/(i+o.margin*2):o.scale},n.getImageWidth=function(i,o){const r=n.getScale(i,o);return Math.floor((i+o.margin*2)*r)},n.qrToImageData=function(i,o,r){const s=o.modules.size,a=o.modules.data,l=n.getScale(s,r),c=Math.floor((s+r.margin*2)*l),u=r.margin*l,h=[r.color.light,r.color.dark];for(let f=0;f<c;f++)for(let d=0;d<c;d++){let p=(f*c+d)*4,k=r.color.light;if(f>=u&&d>=u&&f<c-u&&d<c-u){const B=Math.floor((f-u)/l),_=Math.floor((d-u)/l);k=h[a[B*s+_]?1:0]}i[p++]=k.r,i[p++]=k.g,i[p++]=k.b,i[p]=k.a}}})(Ht)),Ht}var un;function Kr(){return un||(un=1,(function(n){const t=cn();function e(o,r,s){o.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=s,r.width=s,r.style.height=s+"px",r.style.width=s+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}n.render=function(r,s,a){let l=a,c=s;typeof l>"u"&&(!s||!s.getContext)&&(l=s,s=void 0),s||(c=i()),l=t.getOptions(l);const u=t.getImageWidth(r.modules.size,l),h=c.getContext("2d"),f=h.createImageData(u,u);return t.qrToImageData(f.data,r,l),e(h,c,u),h.putImageData(f,0,0),c},n.renderToDataURL=function(r,s,a){let l=a;typeof l>"u"&&(!s||!s.getContext)&&(l=s,s=void 0),l||(l={});const c=n.render(r,s,l),u=l.type||"image/png",h=l.rendererOpts||{};return c.toDataURL(u,h.quality)}})(jt)),jt}var Gt={},dn;function Yr(){if(dn)return Gt;dn=1;const n=cn();function t(o,r){const s=o.a/255,a=r+'="'+o.hex+'"';return s<1?a+" "+r+'-opacity="'+s.toFixed(2).slice(1)+'"':a}function e(o,r,s){let a=o+r;return typeof s<"u"&&(a+=" "+s),a}function i(o,r,s){let a="",l=0,c=!1,u=0;for(let h=0;h<o.length;h++){const f=Math.floor(h%r),d=Math.floor(h/r);!f&&!c&&(c=!0),o[h]?(u++,h>0&&f>0&&o[h-1]||(a+=c?e("M",f+s,.5+d+s):e("m",l,0),l=0,c=!1),f+1<r&&o[h+1]||(a+=e("h",u),u=0)):l++}return a}return Gt.render=function(r,s,a){const l=n.getOptions(s),c=r.modules.size,u=r.modules.data,h=c+l.margin*2,f=l.color.light.a?"<path "+t(l.color.light,"fill")+' d="M0 0h'+h+"v"+h+'H0z"/>':"",d="<path "+t(l.color.dark,"stroke")+' d="'+i(u,c,l.margin)+'"/>',p='viewBox="0 0 '+h+" "+h+'"',B='<svg xmlns="http://www.w3.org/2000/svg" '+(l.width?'width="'+l.width+'" height="'+l.width+'" ':"")+p+' shape-rendering="crispEdges">'+f+d+`</svg>
461
468
  `;return typeof a=="function"&&a(null,B),B},Gt}var hn;function Jr(){if(hn)return X;hn=1;const n=Nr(),t=Gr(),e=Kr(),i=Yr();function o(r,s,a,l,c){const u=[].slice.call(arguments,1),h=u.length,f=typeof u[h-1]=="function";if(!f&&!n())throw new Error("Callback required as last argument");if(f){if(h<2)throw new Error("Too few arguments provided");h===2?(c=a,a=s,s=l=void 0):h===3&&(s.getContext&&typeof c>"u"?(c=l,l=void 0):(c=l,l=a,a=s,s=void 0))}else{if(h<1)throw new Error("Too few arguments provided");return h===1?(a=s,s=l=void 0):h===2&&!s.getContext&&(l=a,a=s,s=void 0),new Promise(function(d,p){try{const k=t.create(a,l);d(r(k,s,l))}catch(k){p(k)}})}try{const d=t.create(a,l);c(null,r(d,s,l))}catch(d){c(d)}}return X.create=t.create,X.toCanvas=o.bind(null,e.render),X.toDataURL=o.bind(null,e.renderToDataURL),X.toString=o.bind(null,function(r,s,a){return i.render(r,a)}),X}var fn=Jr();const Zr=et({__proto__:null,default:Rr(fn)},[fn]);M.Annotations=Be,M.Attribute=oe,M.AttributeValue=ie,M.Camera=ae,M.Configuration=ue,M.ERROR_CODES=V,M.Focus=le,M.Photo=de,M.Snapshot=fe,M.VD_EVENTS=Z,M.VirtualdisplayClient=Tr,M.VirtualdisplayError=x,M.enableDebugMode=ne,M.isDebugMode=Nn,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@virtualdisplay.io/client",
3
3
  "description": "TypeScript-first 3D model integration library with iframe-based architecture",
4
- "version": "4.0.0-alpha.17",
4
+ "version": "4.0.0-alpha.19",
5
5
  "author": "Virtualdisplay <support@virtualdisplay.io>",
6
6
  "homepage": "https://virtualdisplay.io",
7
7
  "license": "MIT",