@virtualdisplay.io/client 4.0.0-alpha.24 → 4.0.0-alpha.25
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 +9 -0
- package/dist/index.d.ts +32 -1
- package/dist/virtualdisplay.client.cjs.js +22 -20
- package/dist/virtualdisplay.client.es.js +461 -379
- package/dist/virtualdisplay.client.umd.js +30 -28
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.0-alpha.25
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
Add `onSelectableChange(callback)` and `getSelectable(name)` to follow which
|
|
8
|
+
attribute values the buyer can still pick under the current selection. The
|
|
9
|
+
standard sidebar greys out values the selection rules out. Models without
|
|
10
|
+
exclusions behave exactly as before.
|
|
11
|
+
|
|
3
12
|
## 4.0.0-alpha.24
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ declare const MESSAGE_TYPES: {
|
|
|
21
21
|
readonly PRICING: "pricing";
|
|
22
22
|
readonly QR_SHOWN: "qr_shown";
|
|
23
23
|
readonly SYNC: "sync";
|
|
24
|
+
readonly SELECTABLE: "selectable";
|
|
24
25
|
};
|
|
25
26
|
interface MutationDto {
|
|
26
27
|
readonly name: string;
|
|
@@ -144,6 +145,23 @@ interface MappingMessage {
|
|
|
144
145
|
readonly type: typeof MESSAGE_TYPES.MAPPING;
|
|
145
146
|
readonly attributes: AttributeDefinition[];
|
|
146
147
|
}
|
|
148
|
+
/** Per selector, the values the buyer can still pick right now. */
|
|
149
|
+
interface SelectableAttribute {
|
|
150
|
+
readonly name: string;
|
|
151
|
+
readonly selectable: string[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Selectability snapshot (server → client): sent after the mapping and after
|
|
155
|
+
* every choice that changes the picture. Always the complete state, never a
|
|
156
|
+
* diff; a value not in its list is not pickable (the client greys it out).
|
|
157
|
+
* The client only renders, it never knows the exclusion rules. Named
|
|
158
|
+
* `selectable`, not availability: that word is taken by pricing
|
|
159
|
+
* (AVAILABILITY, available/view_only).
|
|
160
|
+
*/
|
|
161
|
+
interface SelectableMessage {
|
|
162
|
+
readonly type: typeof MESSAGE_TYPES.SELECTABLE;
|
|
163
|
+
readonly attributes: SelectableAttribute[];
|
|
164
|
+
}
|
|
147
165
|
/**
|
|
148
166
|
* Loading indicator (server → client): progress percentage, phase label, or error.
|
|
149
167
|
* Sent during model download and parse so the client loading indicator can update.
|
|
@@ -299,7 +317,7 @@ interface PricingMessage {
|
|
|
299
317
|
readonly type: typeof MESSAGE_TYPES.PRICING;
|
|
300
318
|
readonly pricing: PricingDocument$1;
|
|
301
319
|
}
|
|
302
|
-
type Message = HandshakeMessage | SessionMessage | MutationMessage | MutationResultMessage | CameraCommandMessage | CameraPositionMessage | SnapshotRequestMessage | SnapshotResultMessage | MappingMessage | LoadingIndicatorMessage | ArActivateMessage | FullscreenMessage | ConfigMessage | AnnotationToggleMessage | FocusMessage | FocusStateMessage | PricingMessage | QrShownMessage | SyncMessage;
|
|
320
|
+
type Message = HandshakeMessage | SessionMessage | MutationMessage | MutationResultMessage | CameraCommandMessage | CameraPositionMessage | SnapshotRequestMessage | SnapshotResultMessage | MappingMessage | LoadingIndicatorMessage | ArActivateMessage | FullscreenMessage | ConfigMessage | AnnotationToggleMessage | FocusMessage | FocusStateMessage | PricingMessage | QrShownMessage | SyncMessage | SelectableMessage;
|
|
303
321
|
type MessageCallback = (message: Message) => void | Promise<void>;
|
|
304
322
|
|
|
305
323
|
/**
|
|
@@ -439,6 +457,8 @@ declare class Annotations {
|
|
|
439
457
|
setEnabled(enabled: boolean): void;
|
|
440
458
|
}
|
|
441
459
|
|
|
460
|
+
type SelectableSnapshot = readonly SelectableAttribute[];
|
|
461
|
+
|
|
442
462
|
/**
|
|
443
463
|
* Camera control API for positioning and zoom
|
|
444
464
|
* Uses chaining pattern for building commands
|
|
@@ -976,6 +996,7 @@ interface BaseClientExtensions {
|
|
|
976
996
|
*/
|
|
977
997
|
declare class BaseClient {
|
|
978
998
|
private readonly attributes;
|
|
999
|
+
private readonly selectableState;
|
|
979
1000
|
private readonly readyStateTracker;
|
|
980
1001
|
private readonly messenger;
|
|
981
1002
|
private readonly cameraApi;
|
|
@@ -1033,6 +1054,16 @@ declare class BaseClient {
|
|
|
1033
1054
|
get isReady(): boolean;
|
|
1034
1055
|
onReady(callback: (client: this) => void): void;
|
|
1035
1056
|
onMutationFailed(callback: (event: MutationFailedEvent) => void): void;
|
|
1057
|
+
/**
|
|
1058
|
+
* Subscribe to the viewer's selectability snapshots (kiesbaarheid live):
|
|
1059
|
+
* per attribute, which values the buyer can pick right now. Fires with the
|
|
1060
|
+
* current snapshot immediately when one already arrived. A model without
|
|
1061
|
+
* exclusions never sends one: everything stays selectable and this never
|
|
1062
|
+
* fires.
|
|
1063
|
+
*/
|
|
1064
|
+
onSelectableChange(callback: (snapshot: SelectableSnapshot) => void): void;
|
|
1065
|
+
/** The selectable values for one attribute right now, or null when unrestricted. */
|
|
1066
|
+
getSelectable(name: string): readonly string[] | null;
|
|
1036
1067
|
/**
|
|
1037
1068
|
* Trigger the composed AR flow directly (ar-session-handoff task 035): a host
|
|
1038
1069
|
* page that hides the built-in corner button (`viewerSettings.ar = false`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});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_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing",QR_SHOWN:"qr_shown",SYNC:"sync"},J={FOCUS:"focus",UNFOCUS:"unfocus"},Pt={FOCUSED:"focused"},Ft={HIDDEN:"hidden"},$t=new Set(Object.values(c));function Dt(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.target=="string"?!1:typeof t.type=="string"&&$t.has(t.type)}function Bt(n){const t=_(n);return t!==null&&t.type===c.HANDSHAKE}function Ut(n){const t=_(n);return t!==null&&t.type===c.SESSION&&typeof t.sessionId=="string"}function Vt(n){const t=_(n);return t!==null&&t.type===c.MUTATION&&Array.isArray(t.results)}function jt(n){const t=_(n);return t!==null&&t.type===c.SNAPSHOT&&("data"in t||"error"in t)}function Ht(n){const t=_(n);return t!==null&&t.type===c.CAMERA&&Array.isArray(t.transforms)}function qt(n){const t=_(n);return t!==null&&t.type===c.MAPPING&&Array.isArray(t.attributes)}function Gt(n){const t=_(n);return t!==null&&t.type===c.LOADING_INDICATOR&&typeof t.progress=="number"}function Zt(n){const t=_(n);return t!==null&&t.type===c.SYNC&&typeof t.connected=="boolean"}function Wt(n){const t=_(n);return t!==null&&t.type===c.CONFIG&&typeof t.viewerSettings=="object"}function Yt(n){const t=_(n);return t!==null&&t.type===c.FOCUS&&typeof t.state=="string"}function Qt(n){const t=_(n);return t!==null&&t.type===c.PRICING&&typeof t.pricing=="object"&&t.pricing!==null}function _(n){return typeof n!="object"||n===null?null:n}class tt{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 Kt{constructor(t,e){this.getTarget=t,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin="*",this.isValid=e?.isValid??Dt,this.publisher=new tt(i=>this.post(i)),this.consumer=new tt(i=>this.routeToHandler(i)),e?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;listener=null;sourceId;targetOrigin;isValid;on(t,e){this.handlers.set(t,e)}setTargetOrigin(t){this.targetOrigin=t}send(t){this.publisher.enqueue(t)}receive(t){this.isValid(t)&&this.consumer.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(!this.isValid(e)||e._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&t.source!==null&&t.source!==i)return;const o=e;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 ht{constructor(t){this.send=t}send;setEnabled(t){this.send({type:c.ANNOTATION_TOGGLE,enabled:t})}}class mt{constructor(t,e){this.value=t,this.attribute=e}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(t){this.isSelectedValue=t}}const C={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}"`,C.VALUE_NOT_FOUND)}static parentNotFound(t){return new f(`Parent element not found: ${t}`,C.PARENT_NOT_FOUND)}static invalidParameter(t){return new f(t,C.INVALID_PARAMETER)}}class pt{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 mt(i,this.name);i===this.defaultValue&&o.setSelected(!0),e.set(i,o)}return e}}class Xt{attributes=new Map;constructor(t,e,i){for(const o of t){const s=this.buildOptions(o,e);this.attributes.set(o.name,new pt(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 N=4096,P=16384,Jt=[1024,256,64],te=20,W=["timestamp","level","msg","service","trace_id","span_id"];function ee(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=Object.entries(n).filter(([r])=>!W.includes(r)).map(([r,a])=>`${r}=${I(a,N).line}`).join(" ");return`${t} ${e} [${i}] ${o}${s?" "+s:""}`}function ne(n){for(const o of[N,...Jt]){const{line:s,truncated:r}=I(n,o);if(!r){if(s.length<=P)return s;continue}const{line:a}=I({...n,log_truncated:!0},o);if(a.length<=P)return a}const t=Object.keys(n).filter(o=>!W.includes(o)),e={...oe(n,W),log_truncated:!0,log_dropped_count:t.length},i=I({...e,log_dropped_attrs:t.slice(0,te)},N);return i.line.length<=P?i.line:I(e,N).line}function I(n,t){const e=[];let i=!1;return{line:JSON.stringify(n,function(r,a){if(typeof a=="string")return a.length>t&&(i=!0),ie(a,t);if(typeof a=="bigint")return a.toString();if(typeof a!="object"||a===null)return a;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(a)?"[Circular]":(e.push(a),a)}),truncated:i}}function ie(n,t){return n.length<=t?n:`${n.slice(0,t)}...[truncated ${n.length-t} chars]`}function oe(n,t){const e={};for(const i of t)n[i]!==void 0&&(e[i]=n[i]);return e}function se(n,t){const e=t?ee(n):ne(n);n.level==="error"?console.error(e):n.level==="warn"?console.warn(e):console.log(e)}function ft(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?ft(n.cause,t+1):String(n.cause)),e}function re(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i instanceof Error?ft(i):i;return t}function ae(){return new Date}function le(n){return n.toISOString()}function gt(){return typeof navigator>"u"?"":navigator.userAgent}function ce(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function de(){return/iPhone|iPad|iPod/i.test(gt())||ce()}function ue(){return/Android/i.test(gt())}function he(){return de()||ue()}class me{constructor(t){this.config=t}config;log(t,e,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:le(ae()),level:t,msg:e,service:this.config.service,...o,...re(i)};se(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)}}function bt(n,t){const e=t?.isDev!==void 0?t.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new me({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 vt(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 yt=!1;exports.logger=vt(bt("client",{isDev:!1}));function wt(){yt=!0,exports.logger=vt(bt("client",{isDev:!0}))}function pe(){return yt}class fe{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 Xt(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 _t=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 ge{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)}}}function be(n,t){const e=n.filter(s=>ve(s,t));if(e.length===0)return;const i=Math.max(...e.map(et)),o=e.filter(s=>et(s)===i);return o.length===1?o[0]:void 0}function ve(n,t){return Object.entries(n.attributes).every(([e,i])=>t[e]===i)}function et(n){return Object.keys(n.attributes).length}class St{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=be(this.pricing.rules,this.selection);if(!(t===void 0||t.availability===Ft.HIDDEN))return{attributes:{...this.selection},reference:t.reference,price:t.priceCents,currency:this.pricing.currency,availability:t.availability}}}class Ct{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:J.FOCUS,component:t})}clear(){this.send({type:c.FOCUS,action:J.UNFOCUS})}onChange(t){this.changeCallbacks.push(t)}handleStateReceived(t){t.state===Pt.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)}}class kt{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 nt=3e4;class At{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 kt(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 ${nt}ms`,C.SNAPSHOT_FAILED))},nt);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,C.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",C.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",C.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(", ")}`,C.INVALID_PARAMETER);if(t.includes("..")||t.includes("/")||t.includes("\\"))throw new f('Filename cannot contain path separators or ".."',C.INVALID_PARAMETER)}}class ye{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 we={},_e="en",Et=["en","nl","de"],Q=["baseLocale"],it=[],Y=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let ot=!1,u=()=>{let n=Q;!Y&&typeof window<"u"&&window.location?.href&&(n=Tt(window.location.href));const t=Se(n);if(t)return ot||(ot=!0,xt(t,{reload:!1})),t;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function Se(n,t){let e;for(const i of n){if(i==="baseLocale")e=_e;else if(Rt(i)&&L.has(i)){const s=L.get(i);if(s){const r=s.getLocale();if(r instanceof Promise)continue;if(r!==void 0)return Ae(r)}}const o=K(e);if(o)return o}}const Ce=n=>{window.location.reload()};let xt=(n,t)=>{const e={reload:!0,...t};let i;try{i=u()}catch{}const o=[];let s=Q;!Y&&typeof window<"u"&&window.location?.href&&(s=Tt(window.location.href));for(const a of s)if(a!=="baseLocale"&&Rt(a)&&L.has(a)){const h=L.get(a);if(h){let d=h.setLocale(n);d instanceof Promise&&(d=d.catch(p=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:p})}),o.push(d))}}const r=()=>{!Y&&e.reload&&window.location&&n!==i&&Ce()};if(o.length)return Promise.all(o).then(()=>{r()});r()},ke=()=>typeof window<"u"?window.location.origin:"http://fallback.com";function K(n){if(typeof n!="string")return;const t=n.toLowerCase();for(const e of Et)if(e.toLowerCase()===t)return e}function Ae(n){const t=K(n);if(t)return t;throw new Error(`Invalid locale: ${n}. Expected one of: ${Et.join(", ")}`)}function Ee(n){return xe(n)}function xe(n){const t=typeof n=="string"?new URL(n,ke()):new URL(n),e=t.pathname.split("/").filter(Boolean);return e.length>0&&K(e[0])&&(t.pathname="/"+e.slice(1).join("/")),t}let st,rt;function Te(n){if(it.length===0)return;const t=typeof n=="string"?n:n.href;if(st===t)return rt;const e=new URL(t,"http://example.com"),i=Ee(e),o=i.href===e.href?[e]:[e,i];let s;for(const r of o){for(const a of it)if(new we(a.match,r.href).exec(r.href)){s=a;break}if(s)break}return st=t,rt=s,s}function Tt(n){const t=Te(n);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:Q}const L=new Map;function Rt(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const Re=()=>"Activate AR",Ie=()=>"AR activeren",Oe=()=>"AR aktivieren",Ne=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Ie():e==="de"?Oe():Re()}),Le=()=>"Scan to view in AR",Me=()=>"Scan om in AR te bekijken",ze=()=>"Scannen für AR-Ansicht",Pe=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Me():e==="de"?ze():Le()}),Fe=()=>"Use your smartphone camera to scan this QR code",$e=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",De=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",Be=((n={},t={})=>{const e=t.locale??u();return e==="nl"?$e():e==="de"?De():Fe()}),Ue=()=>"Your phone will open the 3D model in AR mode.",Ve=()=>"Je telefoon opent het 3D-model in AR-modus.",je=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",He=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Ve():e==="de"?je():Ue()}),qe=()=>"Close",Ge=()=>"Sluiten",Ze=()=>"Schließen",We=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Ge():e==="de"?Ze():qe()}),Ye=()=>"Fullscreen",Qe=()=>"Volledig scherm",Ke=()=>"Vollbild",Xe=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Qe():e==="de"?Ke():Ye()}),Je=()=>"Downloading",tn=()=>"Downloaden",en=()=>"Herunterladen",It=((n={},t={})=>{const e=t.locale??u();return e==="nl"?tn():e==="de"?en():Je()}),nn=()=>"Rendering",on=()=>"Renderen",sn=()=>"Rendern",rn=((n={},t={})=>{const e=t.locale??u();return e==="nl"?on():e==="de"?sn():nn()}),an=()=>"Screenshot",ln=()=>"Screenshot",cn=()=>"Screenshot",dn=((n={},t={})=>{const e=t.locale??u();return e==="nl"?ln():e==="de"?cn():an()}),un=()=>"Configure",hn=()=>"Configureren",mn=()=>"Konfigurieren",pn=((n={},t={})=>{const e=t.locale??u();return e==="nl"?hn():e==="de"?mn():un()}),fn=()=>"Close",gn=()=>"Sluiten",bn=()=>"Schließen",vn=((n={},t={})=>{const e=t.locale??u();return e==="nl"?gn():e==="de"?bn():fn()}),yn=()=>"Reset camera",wn=()=>"Camera resetten",_n=()=>"Kamera zurücksetzen",Sn=((n={},t={})=>{const e=t.locale??u();return e==="nl"?wn():e==="de"?_n():yn()}),Cn=()=>"Zoom in",kn=()=>"Inzoomen",An=()=>"Hineinzoomen",En=((n={},t={})=>{const e=t.locale??u();return e==="nl"?kn():e==="de"?An():Cn()}),xn=()=>"Zoom out",Tn=()=>"Uitzoomen",Rn=()=>"Herauszoomen",In=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Tn():e==="de"?Rn():xn()}),On=()=>"Rotate left",Nn=()=>"Naar links draaien",Ln=()=>"Nach links drehen",Mn=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Nn():e==="de"?Ln():On()}),zn=()=>"Rotate right",Pn=()=>"Naar rechts draaien",Fn=()=>"Nach rechts drehen",$n=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Pn():e==="de"?Fn():zn()}),Dn=()=>"Tilt up",Bn=()=>"Omhoog kantelen",Un=()=>"Nach oben kippen",Vn=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Bn():e==="de"?Un():Dn()}),jn=()=>"Tilt down",Hn=()=>"Omlaag kantelen",qn=()=>"Nach unten kippen",Gn=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Hn():e==="de"?qn():jn()}),Zn=()=>"Working…",Wn=()=>"Bezig…",Yn=()=>"Läuft…",Qn=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Wn():e==="de"?Yn():Zn()}),Kn=()=>"Done",Xn=()=>"Gelukt",Jn=()=>"Fertig",ti=((n={},t={})=>{const e=t.locale??u();return e==="nl"?Xn():e==="de"?Jn():Kn()}),ei=()=>"Failed",ni=()=>"Mislukt",ii=()=>"Fehlgeschlagen",oi=((n={},t={})=>{const e=t.locale??u();return e==="nl"?ni():e==="de"?ii():ei()});const si={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 Ot=([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=Ot(o);i.appendChild(s)}),i},Nt=(n,t={})=>{const i={...si,...t};return Ot(["svg",i,n])};const ri=[["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 ai=[["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 Lt=[["path",{d:"m6 9 6 6 6-6"}]];const li=[["path",{d:"m15 18-6-6 6-6"}]];const ci=[["path",{d:"m9 18 6-6-6-6"}]];const di=[["path",{d:"m18 15-6-6-6 6"}]];const ui=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const hi=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const mi=[["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 pi=[["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 fi=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const gi=[["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"}]];const bi=[["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"}]];function y(n,{size:t=20,strokeWidth:e=1.75}={}){return Nt(n,{width:t,height:t,"stroke-width":e})}const g={ar:n=>y(ri,n),fullscreen:n=>y(ui,n),exitFullscreen:n=>y(hi,n),screenshot:n=>y(ai,n),tiltUp:n=>y(di,n),tiltDown:n=>y(Lt,n),rotateLeft:n=>y(li,n),rotateRight:n=>y(ci,n),zoomIn:n=>y(bi,n),zoomOut:n=>y(gi,n),reset:n=>y(mi,n),configurator:n=>y(pi,n),close:n=>y(fi,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"},l={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"};class vi{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:m.white,borderRadius:l[3],padding:l[6],boxShadow:`0 ${l[2]} ${l[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class yi{constructor(t={}){this.options=t,this.card=new vi,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:l[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 wi{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 _i{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 a=!1;for(let d=0;d<e.length;d++){const p=e[d],v=document.createElement("option");v.value=p,v.textContent=s?.[d]??p,p===o&&(v.selected=!0,a=!0),this.select.appendChild(v)}a||(r.selected=!0);const h=Nt(Lt,{width:16,height:16,"stroke-width":2});h.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(h)}setSelected(t){this.select.value=t}onSelect(t){this.select.addEventListener("change",()=>{t(this.select.value)})}}const w={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"}},E=w.fontFamily.sans.join(", "),Si=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});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_TOGGLE:"annotation_toggle",FOCUS:"focus",PRICING:"pricing",QR_SHOWN:"qr_shown",SYNC:"sync",SELECTABLE:"selectable"},J={FOCUS:"focus",UNFOCUS:"unfocus"},Pe={FOCUSED:"focused"},Fe={HIDDEN:"hidden"},$e=new Set(Object.values(c));function De(n){if(typeof n!="object"||n===null)return!1;const e=n;return typeof e.target=="string"?!1:typeof e.type=="string"&&$e.has(e.type)}function Be(n){const e=S(n);return e!==null&&e.type===c.HANDSHAKE}function Ue(n){const e=S(n);return e!==null&&e.type===c.SESSION&&typeof e.sessionId=="string"}function Ve(n){const e=S(n);return e!==null&&e.type===c.MUTATION&&Array.isArray(e.results)}function je(n){const e=S(n);return e!==null&&e.type===c.SNAPSHOT&&("data"in e||"error"in e)}function He(n){const e=S(n);return e!==null&&e.type===c.CAMERA&&Array.isArray(e.transforms)}function qe(n){const e=S(n);return e!==null&&e.type===c.MAPPING&&Array.isArray(e.attributes)}function Ge(n){const e=S(n);return e!==null&&e.type===c.LOADING_INDICATOR&&typeof e.progress=="number"}function Ze(n){const e=S(n);return e!==null&&e.type===c.SYNC&&typeof e.connected=="boolean"}function We(n){const e=S(n);return e!==null&&e.type===c.SELECTABLE&&Array.isArray(e.attributes)}function Ye(n){const e=S(n);return e!==null&&e.type===c.CONFIG&&typeof e.viewerSettings=="object"}function Qe(n){const e=S(n);return e!==null&&e.type===c.FOCUS&&typeof e.state=="string"}function Ke(n){const e=S(n);return e!==null&&e.type===c.PRICING&&typeof e.pricing=="object"&&e.pricing!==null}function S(n){return typeof n!="object"||n===null?null:n}class ee{constructor(e){this.processor=e}processor;pending=[];isReady=!1;enqueue(e){if(this.isReady){this.processor(e);return}this.pending.push(e)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;const e=[...this.pending];this.pending.length=0;for(const t of e)this.processor(t)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(e){return this.pending.some(t=>t.type===e)}clear(){this.pending.length=0}}class Xe{constructor(e,t){this.getTarget=e,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin="*",this.isValid=t?.isValid??De,this.publisher=new ee(i=>this.post(i)),this.consumer=new ee(i=>this.routeToHandler(i)),t?.bufferIncoming!==!0&&this.consumer.markReady()}getTarget;handlers=new Map;publisher;consumer;listener=null;sourceId;targetOrigin;isValid;on(e,t){this.handlers.set(e,t)}setTargetOrigin(e){this.targetOrigin=e}send(e){this.publisher.enqueue(e)}receive(e){this.isValid(e)&&this.consumer.enqueue(e)}markReady(){this.publisher.markReady()}markConsumerReady(){this.consumer.markReady()}consumerHasPending(e){return this.consumer.hasPending(e)}start(){this.listener===null&&(this.listener=e=>{const{data:t}=e;if(!this.isValid(t)||t._source===this.sourceId)return;const i=this.getTarget();if(i!==null&&e.source!==null&&e.source!==i)return;const o=t;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(e){const t=this.getTarget();t!==null&&t.postMessage({...e,_source:this.sourceId},this.targetOrigin)}routeToHandler(e){const t=this.handlers.get(e.type);if(t===void 0)return;const i=t(e);i instanceof Promise&&i.catch(o=>{const s=o instanceof Error?o.message:String(o);console.error(`Virtualdisplay: error handling ${e.type}: ${s}`)})}}class he{constructor(e){this.send=e}send;setEnabled(e){this.send({type:c.ANNOTATION_TOGGLE,enabled:e})}}class me{constructor(e,t){this.value=e,this.attribute=t}value;attribute;isSelectedValue=!1;get isSelected(){return this.isSelectedValue}setSelected(e){this.isSelectedValue=e}}const C={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(e,t){super(e),this.name="VirtualdisplayError",this.code=t}static valueNotFound(e,t){return new f(`Value "${t}" not found for attribute "${e}"`,C.VALUE_NOT_FOUND)}static parentNotFound(e){return new f(`Parent element not found: ${e}`,C.PARENT_NOT_FOUND)}static invalidParameter(e){return new f(e,C.INVALID_PARAMETER)}}class pe{name;defaultValue;values;onSelect;onChangeCallback;constructor(e){this.name=e.name,this.defaultValue=e.defaultValue,this.onSelect=e.onSelect,this.values=this.createValues(e.values)}select(e){if(!this.values.has(e))throw f.valueNotFound(this.name,e);this.onSelect(this.name,e)}getValues(){return Array.from(this.values.values())}getValue(e){return this.values.get(e)}get selected(){for(const e of this.values.values())if(e.isSelected)return e.value}onChange(e){this.onChangeCallback=e}handleResult(e){let t;for(const i of this.values.values()){const o=i.value===e;i.setSelected(o),o&&(t=i)}t!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(t)}createValues(e){const t=new Map;for(const i of e){const o=new me(i,this.name);i===this.defaultValue&&o.setSelected(!0),t.set(i,o)}return t}}class Je{attributes=new Map;constructor(e,t,i){for(const o of e){const s=this.buildOptions(o,t);this.attributes.set(o.name,new pe(s))}this.onMutationFailed=i}onMutationFailed;get(e){return this.attributes.get(e)}getSelection(){const e={};for(const[t,i]of this.attributes){const o=i.selected;o!==void 0&&(e[t]=o)}return e}handleResults(e){for(const t of e){if(!t.success){this.onMutationFailed?.(t.name,t.value);continue}this.get(t.name)?.handleResult(t.value)}}buildOptions(e,t){const i={name:e.name,values:e.values,onSelect:(o,s)=>{t([{name:o,value:s}],!1)}};return e.defaultValue!==void 0?{...i,defaultValue:e.defaultValue}:i}}const L=4096,P=16384,et=[1024,256,64],tt=20,W=["timestamp","level","msg","service","trace_id","span_id"];function nt(n){const e=new Date(n.timestamp).toLocaleTimeString("en-GB",{hour12:!1}),t=n.level.toUpperCase().padEnd(5),i=n.trace_id?.slice(0,8)??"--------",o=n.msg,s=Object.entries(n).filter(([r])=>!W.includes(r)).map(([r,a])=>`${r}=${I(a,L).line}`).join(" ");return`${e} ${t} [${i}] ${o}${s?" "+s:""}`}function it(n){for(const o of[L,...et]){const{line:s,truncated:r}=I(n,o);if(!r){if(s.length<=P)return s;continue}const{line:a}=I({...n,log_truncated:!0},o);if(a.length<=P)return a}const e=Object.keys(n).filter(o=>!W.includes(o)),t={...st(n,W),log_truncated:!0,log_dropped_count:e.length},i=I({...t,log_dropped_attrs:e.slice(0,tt)},L);return i.line.length<=P?i.line:I(t,L).line}function I(n,e){const t=[];let i=!1;return{line:JSON.stringify(n,function(r,a){if(typeof a=="string")return a.length>e&&(i=!0),ot(a,e);if(typeof a=="bigint")return a.toString();if(typeof a!="object"||a===null)return a;for(;t.length>0&&t.at(-1)!==this;)t.pop();return t.includes(a)?"[Circular]":(t.push(a),a)}),truncated:i}}function ot(n,e){return n.length<=e?n:`${n.slice(0,e)}...[truncated ${n.length-e} chars]`}function st(n,e){const t={};for(const i of e)n[i]!==void 0&&(t[i]=n[i]);return t}function rt(n,e){const t=e?nt(n):it(n);n.level==="error"?console.error(t):n.level==="warn"?console.warn(t):console.log(t)}function fe(n,e=0){const t={name:n.name,message:n.message};n.stack!==void 0&&(t.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&&(t[i]=o)}return n.cause!==void 0&&n.cause!==null&&(t.cause=n.cause instanceof Error&&e<5?fe(n.cause,e+1):String(n.cause)),t}function at(n){const e={};for(const[t,i]of Object.entries(n))e[t]=i instanceof Error?fe(i):i;return e}function lt(){return new Date}function ct(n){return n.toISOString()}function ge(){return typeof navigator>"u"?"":navigator.userAgent}function ut(){return typeof navigator>"u"?!1:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function dt(){return/iPhone|iPad|iPod/i.test(ge())||ut()}function ht(){return/Android/i.test(ge())}function mt(){return dt()||ht()}class pt{constructor(e){this.config=e}config;log(e,t,i={}){const o=this.config.traceProvider?.()??{},s={timestamp:ct(lt()),level:e,msg:t,service:this.config.service,...o,...at(i)};rt(s,this.config.isDev)}debug(e,t){this.config.isDev&&this.log("debug",e,t)}info(e,t){this.log("info",e,t)}warn(e,t){this.log("warn",e,t)}error(e,t){this.log("error",e,t)}}function be(n,e){const t=e?.isDev!==void 0?e.isDev:typeof process<"u"?process.env.NODE_ENV!=="production":!0;return new pt({service:n,isDev:t,traceProvider:e?.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 ve(n){return{debug:(e,t)=>n.debug(e,O(t)),info:(e,t)=>n.info(e,O(t)),warn:(e,t)=>n.warn(e,O(t)),error:(e,t)=>n.error(e,O(t))}}let ye=!1;exports.logger=ve(be("client",{isDev:!1}));function we(){ye=!0,exports.logger=ve(be("client",{isDev:!0}))}function ft(){return ye}class gt{constructor(e,t){this.send=e,this.onMutationFailed=t}send;onMutationFailed;registry;pendingCallbacks=[];handleMappingReceived(e){exports.logger.debug("Initializing from server mapping",{attributeCount:e.attributes.length}),this.registry=new Je(e.attributes,(t,i)=>this.sendMutation(t,i),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(e){this.registry?.handleResults(e.results)}select(e,t){this.sendMutation([{name:e,value:t}],!1)}getValues(e){return this.registry?.get(e)?.getValues()??[]}getValue(e,t){return this.registry?.get(e)?.getValue(t)}onChange(e,t){if(this.registry===void 0){this.pendingCallbacks.push({name:e,callback:t});return}const i=this.registry.get(e);if(i===void 0){exports.logger.warn(`onChange: attribute "${e}" not found — callback will not fire`);return}i.onChange(t)}getAttribute(e){return this.registry?.get(e)}getSelection(){return this.registry?.getSelection()??{}}get hasMapping(){return this.registry!==void 0}sendMutation(e,t){const i={type:c.MUTATION,mutations:e,isInitial:t};this.send(i)}replayPendingCallbacks(){for(const{name:e,callback:t}of this.pendingCallbacks){const i=this.registry?.get(e);i===void 0&&exports.logger.warn(`onChange: attribute "${e}" not found — buffered callback will not fire`),i?.onChange(t)}this.pendingCallbacks.length=0}}class bt{snapshot;callbacks=[];handleSnapshot(e){this.snapshot=e.attributes;for(const t of this.callbacks)t(e.attributes)}onChange(e){this.callbacks.push(e),this.snapshot!==void 0&&e(this.snapshot)}selectableFor(e){return this.snapshot?.find(i=>i.name===e)?.selectable??null}get current(){return this.snapshot??[]}}let Se=class{constructor(e){this.send=e}send;commands=[];rotate(e){return this.validateFiniteNumber(e,"rotate"),this.commands.push({action:"rotate",value:e}),this}tilt(e){return this.validateFiniteNumber(e,"tilt"),this.commands.push({action:"tilt",value:e}),this}zoom(e){return this.validateFiniteNumber(e,"zoom"),this.commands.push({action:"zoom",value:e}),this}set(){if(this.commands.length===0)throw f.invalidParameter("No camera commands to execute. Call rotate(), tilt(), or zoom() before set().");const e={type:c.CAMERA,commands:this.commands};this.send(e),this.commands=[]}validateFiniteNumber(e,t){if(!Number.isFinite(e))throw f.invalidParameter(`${t}() requires a finite number, got ${String(e)}`)}reset(){const e={type:c.CAMERA,commands:[{action:"reset"}]};this.send(e)}};class vt{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(e){this.changeCallbacks.push(e)}get limits(){return this.limitsState}applyLimits(e){this.limitsState=e;const t={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const i of this.changeCallbacks)i(t)}handlePositionUpdate(e){this.update(e.transforms)}update(e){let t=!1;for(const i of e)switch(i.type){case"rotation":this.state.rotation=i.value,t=!0;break;case"tilt":this.state.tilt=i.value,t=!0;break;case"zoom":this.state.zoom=i.value,t=!0;break}if(t){const i={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(const o of this.changeCallbacks)o(i)}}}function yt(n,e){const t=n.filter(s=>wt(s,e));if(t.length===0)return;const i=Math.max(...t.map(te)),o=t.filter(s=>te(s)===i);return o.length===1?o[0]:void 0}function wt(n,e){return Object.entries(n.attributes).every(([t,i])=>e[t]===i)}function te(n){return Object.keys(n.attributes).length}class _e{constructor(e,t){this.dispatchChange=e,this.dispatchSubmit=t}dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){const e=this.pricing?.buttonLabel;if(e!=null&&e!=="")return e;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(e){this.changeCallbacks.push(e)}onSubmit(e,t){this.submitCallback=e,this.submitDefaultLabel=t?.defaultLabel,this.notifyRender()}onRender(e){return this.renderCallbacks.push(e),()=>{const t=this.renderCallbacks.indexOf(e);t!==-1&&this.renderCallbacks.splice(t,1)}}async submit(){if(!this.submittable)return;const e=this.resolved!==void 0?{attributes:this.resolved.attributes,reference:this.resolved.reference}:{attributes:{...this.selection},reference:""};this.dispatchSubmit(e),await this.submitCallback?.(e)}handlePricingReceived(e){this.pricing=e,this.recompute()}handleSelectionChanged(e){this.selection=e,this.recompute()}recompute(){this.resolved=this.resolve();for(const e of this.changeCallbacks)e(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(const e of this.renderCallbacks)e()}resolve(){if(this.pricing===void 0)return;const e=yt(this.pricing.rules,this.selection);if(!(e===void 0||e.availability===Fe.HIDDEN))return{attributes:{...this.selection},reference:e.reference,price:e.priceCents,currency:this.pricing.currency,availability:e.availability}}}class Ce{constructor(e,t){this.send=e,this.dispatch=t}send;dispatch;focused=null;attributes=[];changeCallbacks=[];get current(){return this.focused}set(e){if(typeof e!="string"||e.length===0)throw f.invalidParameter(`set() requires a non-empty component name, got ${String(e)}`);this.send({type:c.FOCUS,action:J.FOCUS,component:e})}clear(){this.send({type:c.FOCUS,action:J.UNFOCUS})}onChange(e){this.changeCallbacks.push(e)}handleStateReceived(e){e.state===Pe.FOCUSED&&e.component!==void 0?(this.focused=e.component,this.attributes=e.attributes??[]):(this.focused=null,this.attributes=[]);const t=this.focused!==null?{component:this.focused,attributes:this.attributes}:null;for(const i of this.changeCallbacks)i(t);this.dispatch(t)}}class ke{constructor(e){this.filename=e}filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;onDeveloped(e){return this.developed&&this.photoData!==null?(e(this.photoData),this):(this.developedCallbacks.add(e),this)}onError(e){return this.errorCallbacks.add(e),this}getFilename(){return this.filename}develop(e){this.developed||this.failed||(this.photoData=e,this.developed=!0,this.developedCallbacks.forEach(t=>{t(this.photoData)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}fail(e){this.developed||this.failed||(this.failed=!0,this.errorCallbacks.forEach(t=>{t(e)}),this.developedCallbacks.clear(),this.errorCallbacks.clear())}}const ne=3e4;class Ae{constructor(e){this.send=e}send;validExtensions=[".png"];pendingPhotos=new Map;take(e){this.validateFilename(e),exports.logger.debug("Taking snapshot",{filename:e});const t=new ke(e),i=setTimeout(()=>{this.pendingPhotos.delete(e),exports.logger.warn("Snapshot timed out",{filename:e}),t.fail(new f(`Snapshot timed out: the viewer did not respond within ${ne}ms`,C.SNAPSHOT_FAILED))},ne);return this.pendingPhotos.set(e,{photo:t,timeout:i}),this.send({type:c.SNAPSHOT,filename:e}),t}handleSnapshotResult(e){const t=this.pendingPhotos.get(e.filename);if(t===void 0){exports.logger.warn("No pending photo found for filename",{filename:e.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}clearTimeout(t.timeout),this.pendingPhotos.delete(e.filename);const{photo:i}=t;if(e.error!==void 0){i.fail(new f(e.error,C.SNAPSHOT_FAILED));return}e.data!==void 0&&i.develop({filename:e.filename,data:e.data})}clear(){if(this.pendingPhotos.size===0)return;const e=new f("Client destroyed before snapshot completed",C.SNAPSHOT_FAILED);for(const{photo:t,timeout:i}of this.pendingPhotos.values())clearTimeout(i),t.fail(e);this.pendingPhotos.clear()}validateFilename(e){if(e===""||typeof e!="string")throw new f("Filename must be a non-empty string",C.INVALID_PARAMETER);if(!this.validExtensions.some(i=>e.toLowerCase().endsWith(i)))throw new f(`Invalid filename: "${e}". Filename must end with one of: ${this.validExtensions.join(", ")}`,C.INVALID_PARAMETER);if(e.includes("..")||e.includes("/")||e.includes("\\"))throw new f('Filename cannot contain path separators or ".."',C.INVALID_PARAMETER)}}class St{container=null;attach(e){this.container=e}dispatch(e,t,i=!1){const o=new CustomEvent(e,{detail:t,cancelable:i});return this.container?.dispatchEvent(o),o}on(e,t){const i=o=>{const s=o,r={...s.detail,preventDefault:()=>{s.preventDefault()}};t(r)};return this.container?.addEventListener(e,i),()=>{this.container?.removeEventListener(e,i)}}}const _t={},Ct="en",Ee=["en","nl","de"],Q=["baseLocale"],ie=[],Y=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let oe=!1,d=()=>{let n=Q;!Y&&typeof window<"u"&&window.location?.href&&(n=Te(window.location.href));const e=kt(n);if(e)return oe||(oe=!0,xe(e,{reload:!1})),e;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function kt(n,e){let t;for(const i of n){if(i==="baseLocale")t=Ct;else if(Re(i)&&M.has(i)){const s=M.get(i);if(s){const r=s.getLocale();if(r instanceof Promise)continue;if(r!==void 0)return xt(r)}}const o=K(t);if(o)return o}}const At=n=>{window.location.reload()};let xe=(n,e)=>{const t={reload:!0,...e};let i;try{i=d()}catch{}const o=[];let s=Q;!Y&&typeof window<"u"&&window.location?.href&&(s=Te(window.location.href));for(const a of s)if(a!=="baseLocale"&&Re(a)&&M.has(a)){const h=M.get(a);if(h){let u=h.setLocale(n);u instanceof Promise&&(u=u.catch(m=>{throw new Error(`Custom strategy "${a}" setLocale failed.`,{cause:m})}),o.push(u))}}const r=()=>{!Y&&t.reload&&window.location&&n!==i&&At()};if(o.length)return Promise.all(o).then(()=>{r()});r()},Et=()=>typeof window<"u"?window.location.origin:"http://fallback.com";function K(n){if(typeof n!="string")return;const e=n.toLowerCase();for(const t of Ee)if(t.toLowerCase()===e)return t}function xt(n){const e=K(n);if(e)return e;throw new Error(`Invalid locale: ${n}. Expected one of: ${Ee.join(", ")}`)}function Tt(n){return Rt(n)}function Rt(n){const e=typeof n=="string"?new URL(n,Et()):new URL(n),t=e.pathname.split("/").filter(Boolean);return t.length>0&&K(t[0])&&(e.pathname="/"+t.slice(1).join("/")),e}let se,re;function It(n){if(ie.length===0)return;const e=typeof n=="string"?n:n.href;if(se===e)return re;const t=new URL(e,"http://example.com"),i=Tt(t),o=i.href===t.href?[t]:[t,i];let s;for(const r of o){for(const a of ie)if(new _t(a.match,r.href).exec(r.href)){s=a;break}if(s)break}return se=e,re=s,s}function Te(n){const e=It(n);return e&&e.exclude!==!0&&Array.isArray(e.strategy)?e.strategy:Q}const M=new Map;function Re(n){return typeof n=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(n)}const Ot=()=>"Activate AR",Lt=()=>"AR activeren",Mt=()=>"AR aktivieren",Nt=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Lt():t==="de"?Mt():Ot()}),zt=()=>"Scan to view in AR",Pt=()=>"Scan om in AR te bekijken",Ft=()=>"Scannen für AR-Ansicht",$t=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Pt():t==="de"?Ft():zt()}),Dt=()=>"Use your smartphone camera to scan this QR code",Bt=()=>"Gebruik de camera van je smartphone om deze QR-code te scannen",Ut=()=>"Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen",Vt=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Bt():t==="de"?Ut():Dt()}),jt=()=>"Your phone will open the 3D model in AR mode.",Ht=()=>"Je telefoon opent het 3D-model in AR-modus.",qt=()=>"Dein Telefon öffnet das 3D-Modell im AR-Modus.",Gt=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Ht():t==="de"?qt():jt()}),Zt=()=>"Close",Wt=()=>"Sluiten",Yt=()=>"Schließen",Qt=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Wt():t==="de"?Yt():Zt()}),Kt=()=>"Fullscreen",Xt=()=>"Volledig scherm",Jt=()=>"Vollbild",en=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Xt():t==="de"?Jt():Kt()}),tn=()=>"Downloading",nn=()=>"Downloaden",on=()=>"Herunterladen",Ie=((n={},e={})=>{const t=e.locale??d();return t==="nl"?nn():t==="de"?on():tn()}),sn=()=>"Rendering",rn=()=>"Renderen",an=()=>"Rendern",ln=((n={},e={})=>{const t=e.locale??d();return t==="nl"?rn():t==="de"?an():sn()}),cn=()=>"Screenshot",un=()=>"Screenshot",dn=()=>"Screenshot",hn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?un():t==="de"?dn():cn()}),mn=()=>"Configure",pn=()=>"Configureren",fn=()=>"Konfigurieren",gn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?pn():t==="de"?fn():mn()}),bn=()=>"Close",vn=()=>"Sluiten",yn=()=>"Schließen",wn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?vn():t==="de"?yn():bn()}),Sn=()=>"Reset camera",_n=()=>"Camera resetten",Cn=()=>"Kamera zurücksetzen",kn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?_n():t==="de"?Cn():Sn()}),An=()=>"Zoom in",En=()=>"Inzoomen",xn=()=>"Hineinzoomen",Tn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?En():t==="de"?xn():An()}),Rn=()=>"Zoom out",In=()=>"Uitzoomen",On=()=>"Herauszoomen",Ln=((n={},e={})=>{const t=e.locale??d();return t==="nl"?In():t==="de"?On():Rn()}),Mn=()=>"Rotate left",Nn=()=>"Naar links draaien",zn=()=>"Nach links drehen",Pn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Nn():t==="de"?zn():Mn()}),Fn=()=>"Rotate right",$n=()=>"Naar rechts draaien",Dn=()=>"Nach rechts drehen",Bn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?$n():t==="de"?Dn():Fn()}),Un=()=>"Tilt up",Vn=()=>"Omhoog kantelen",jn=()=>"Nach oben kippen",Hn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Vn():t==="de"?jn():Un()}),qn=()=>"Tilt down",Gn=()=>"Omlaag kantelen",Zn=()=>"Nach unten kippen",Wn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Gn():t==="de"?Zn():qn()}),Yn=()=>"Working…",Qn=()=>"Bezig…",Kn=()=>"Läuft…",Xn=((n={},e={})=>{const t=e.locale??d();return t==="nl"?Qn():t==="de"?Kn():Yn()}),Jn=()=>"Done",ei=()=>"Gelukt",ti=()=>"Fertig",ni=((n={},e={})=>{const t=e.locale??d();return t==="nl"?ei():t==="de"?ti():Jn()}),ii=()=>"Failed",oi=()=>"Mislukt",si=()=>"Fehlgeschlagen",ri=((n={},e={})=>{const t=e.locale??d();return t==="nl"?oi():t==="de"?si():ii()});const ai={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 Oe=([n,e,t])=>{const i=document.createElementNS("http://www.w3.org/2000/svg",n);return Object.keys(e).forEach(o=>{i.setAttribute(o,String(e[o]))}),t?.length&&t.forEach(o=>{const s=Oe(o);i.appendChild(s)}),i},Le=(n,e={})=>{const i={...ai,...e};return Oe(["svg",i,n])};const li=[["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 ci=[["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 Me=[["path",{d:"m6 9 6 6 6-6"}]];const ui=[["path",{d:"m15 18-6-6 6-6"}]];const di=[["path",{d:"m9 18 6-6-6-6"}]];const hi=[["path",{d:"m18 15-6-6-6 6"}]];const mi=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];const pi=[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]];const fi=[["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 gi=[["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 bi=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];const vi=[["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"}]];const yi=[["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"}]];function y(n,{size:e=20,strokeWidth:t=1.75}={}){return Le(n,{width:e,height:e,"stroke-width":t})}const g={ar:n=>y(li,n),fullscreen:n=>y(mi,n),exitFullscreen:n=>y(pi,n),screenshot:n=>y(ci,n),tiltUp:n=>y(hi,n),tiltDown:n=>y(Me,n),rotateLeft:n=>y(ui,n),rotateRight:n=>y(di,n),zoomIn:n=>y(yi,n),zoomOut:n=>y(vi,n),reset:n=>y(fi,n),configurator:n=>y(gi,n),close:n=>y(bi,n)};class b{element;constructor({variant:e="default",size:t="default",label:i,icon:o,onClick:s,disabled:r=!1}={}){this.element=document.createElement("button"),this.element.className=`ui-btn ui-btn--${e} ui-btn--size-${t}`,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(e){const t=this.element.querySelector("svg");t!==null?t.replaceWith(e):this.element.appendChild(e)}}const p={semantic:{error:"#dc2626"},neutral:{500:"#737373",600:"#525252",900:"#171717"},white:"#ffffff",black:"#000000"},l={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"};class wi{element;constructor(){this.element=document.createElement("div"),Object.assign(this.element.style,{background:p.white,borderRadius:l[3],padding:l[6],boxShadow:`0 ${l[2]} ${l[8]} oklch(0% 0 0 / 20%)`,maxWidth:"20rem",width:"100%"})}}class Si{constructor(e={}){this.options=e,this.card=new wi,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}options;card;backdrop;keyHandler=null;open(){document.body.appendChild(this.backdrop),this.keyHandler=e=>{e.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 e=document.createElement("div");return Object.assign(e.style,{position:"fixed",inset:l[0],background:"oklch(0% 0 0 / 50%)",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center"}),e.addEventListener("click",t=>{t.target===e&&this.close()}),e}}class _i{element;selectCallback=null;constructor(e,t,i){this.element=document.createElement("div"),this.element.className="ui-toggle-group";for(let o=0;o<e.length;o++){const s=e[o],r=document.createElement("button");r.className="ui-toggle-group-item",r.dataset.value=s,r.textContent=i?.[o]??s,r.dataset.state=s===t?"on":"off",r.setAttribute("aria-pressed",s===t?"true":"false"),r.addEventListener("click",()=>{this.selectCallback?.(s)}),this.element.appendChild(r)}}setSelected(e){for(const t of this.element.querySelectorAll(".ui-toggle-group-item")){const i=t.dataset.value===e;t.dataset.state=i?"on":"off",t.setAttribute("aria-pressed",i?"true":"false")}}onSelect(e){this.selectCallback=e}setEnabled(e){for(const t of this.element.querySelectorAll(".ui-toggle-group-item")){const i=e===null||e.includes(t.dataset.value??"");t.disabled=!i,t.setAttribute("aria-disabled",i?"false":"true")}}}class Ci{element;select;constructor(e,t,i,o,s){this.select=document.createElement("select"),this.select.className="ui-native-select",this.select.dataset.name=e,this.select.setAttribute("aria-label",i);const r=document.createElement("option");r.value="",r.disabled=!0,r.textContent=i,this.select.appendChild(r);let a=!1;for(let u=0;u<t.length;u++){const m=t[u],v=document.createElement("option");v.value=m,v.textContent=s?.[u]??m,m===o&&(v.selected=!0,a=!0),this.select.appendChild(v)}a||(r.selected=!0);const h=Le(Me,{width:16,height:16,"stroke-width":2});h.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(h)}setSelected(e){this.select.value=e}onSelect(e){this.select.addEventListener("change",()=>{e(this.select.value)})}setEnabled(e){for(const t of this.select.options)t.value!==""&&(t.disabled=e!==null&&!e.includes(t.value))}}const w={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"}},E=w.fontFamily.sans.join(", "),ki=`
|
|
2
2
|
--primary: oklch(5% 0 0);
|
|
3
3
|
--primary-foreground: oklch(100% 0 0);
|
|
4
4
|
--secondary: oklch(92% 0 0);
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
--accent: oklch(92% 0 0);
|
|
12
12
|
--accent-foreground: oklch(5% 0 0);
|
|
13
13
|
--muted-foreground: oklch(44% 0 0);
|
|
14
|
-
`,
|
|
15
|
-
:root { ${
|
|
14
|
+
`,Ai=`
|
|
15
|
+
:root { ${ki} }
|
|
16
16
|
|
|
17
17
|
/* ── Button ──────────────────────────────────────────────── */
|
|
18
18
|
.ui-btn {
|
|
@@ -88,6 +88,8 @@
|
|
|
88
88
|
box-shadow: 0 1px 2px oklch(5% 0 0 / 8%);
|
|
89
89
|
}
|
|
90
90
|
.ui-toggle-group-item:hover { background: var(--accent); border-color: oklch(85% 0 0); }
|
|
91
|
+
.ui-toggle-group-item:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
92
|
+
.ui-toggle-group-item:disabled:hover { background: var(--background); border-color: var(--border); }
|
|
91
93
|
.ui-toggle-group-item:active { transform: scale(0.98); }
|
|
92
94
|
.ui-toggle-group-item:focus-visible {
|
|
93
95
|
outline: none;
|
|
@@ -288,12 +290,12 @@
|
|
|
288
290
|
0%, 100% { opacity: 1; }
|
|
289
291
|
50% { opacity: 0.55; }
|
|
290
292
|
}
|
|
291
|
-
`;let at=!1;function Mt(){if(at||typeof document>"u")return;at=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=Ci,document.head.appendChild(n)}const ki=w.fontFamily.sans.join(", ");class Ai{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),Mt(),this.dialog=new yi({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:l[3],fontFamily:ki}),this.dialog.card.element.appendChild(this.createText(Pe(),{fontSize:w.fontSize.base,fontWeight:w.fontWeight.semibold,color:m.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Be(),{fontSize:w.fontSize.sm,color:m.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.card.element.appendChild(this.qrSlot),this.dialog.card.element.appendChild(this.createText(He(),{fontSize:w.fontSize.xs,color:m.neutral[500]}));const t=new b({variant:"outline",label:We(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(t.element),this.dialog.open()}async update(t){this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(i=>i.browser);const e=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:m.black,light:m.white}});return this.qrSlot===null?!1:(this.qrSlot.classList.remove("ui-qr-slot--loading"),this.qrSlot.replaceChildren(this.createQrImage(e)),!0)}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(t,e){const i=document.createElement("p");return i.textContent=t,Object.assign(i.style,{margin:"0",textAlign:"center",...e}),i}createQrSlot(){const t=document.createElement("div");return t.className="ui-qr-slot ui-qr-slot--loading",t}createQrImage(t){const e=document.createElement("img");return e.src=t,e.alt="QR code",e}}function lt(n){const t=Math.max(0,Math.min(1,n));return t*t*(3-2*t)}function Ei(n,t,e,i,o,s){const[r,a,h]=n,d=Math.cos(t),p=Math.sin(t),v=d*r+p*h,A=-p*r+d*h,k=Math.cos(e),S=Math.sin(e),R=k*a-S*A,z=S*a+k*A,X=.55;return[i+v*s*X,o-R*s*X,z]}function xi(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 Ti(n,t,e,i,o){const s=t(e),r=t(i),a=[s[0]+(r[0]-s[0])*o,s[1]+(r[1]-s[1])*o,s[2]];xi(n,s,a)}const F=[-1,-1,1],$=[1,-1,1],D=[1,-1,-1],B=[-1,-1,-1],U=[-1,1,1],V=[1,1,1],j=[1,1,-1],H=[-1,1,-1],ct=[[F,$],[$,D],[D,B],[B,F],[F,U],[$,V],[D,j],[B,H],[U,V],[V,j],[j,H],[H,U]],Ri=400,dt='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function Ii(){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:dt});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:dt}),o.textContent=It(),e.appendChild(i),e.appendChild(o),n.appendChild(t),n.appendChild(e),{overlay:n,canvas:t,pctEl:i,phaseEl:o}}class Oi{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(t,e={}){this.startTime=performance.now();const i=Ii();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??Ri;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:It(),rendering:rn()}}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,a=.785,h=.615,d=S=>Ei(S,a,h,o,s,r),p=6,v=i%p/p,A=ct.length;let k;v<.35?k=lt(v/.35)*A:v<.55?k=A:v<.9?k=(1-lt((v-.55)/.35))*A:k=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let S=0;S<A&&!(S>=k);S++){const R=ct[S];if(R===void 0)continue;const z=Math.min(1,k-S);Ti(this.ctx,d,R[0],R[1],z)}this.ctx.shadowBlur=0}}class Ni{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:Ne(),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:Xe(),icon:g.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const x=.5;class M{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=Li(t,e,i);e.onChange(s=>{i.targetRotation=s.rotation-i.thetaOffset,i.targetTilt=s.tilt,i.targetZoom=s.zoom,Mi(o,e,s)}),this.element.appendChild(M.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(M.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[a,h]of[[t,"up"],[e,"left"],[i,"center"],[o,"right"],[s,"down"]])a.element.classList.add(`vd-dpad-${h}`),r.appendChild(a.element);return r}}function Li(n,t,e){const i=r=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,r)),o=r=>{const a=t.limits?.minRotate,h=t.limits?.maxRotate;return a!==void 0||h!==void 0?Math.max(a??-1/0,Math.min(h??1/0,r)):r},s=r=>{const a=t.limits?.minTilt,h=t.limits?.maxTilt;if(a!==void 0||h!==void 0){e.targetTilt=Math.max(a??0,Math.min(h??180,e.targetTilt+r)),n.tilt(e.targetTilt).set();return}const d=e.targetTilt+r;d>180||d<0?(e.targetTilt=d>180?360-d:-d,e.thetaOffset=(e.thetaOffset+180)%360,n.tilt(e.targetTilt).rotate(e.targetRotation+e.thetaOffset).set()):(e.targetTilt=d,n.tilt(e.targetTilt).set())};return{zoomOut:new b({variant:"outline",size:"icon",label:In(),icon:g.zoomOut(),onClick:()=>{e.targetZoom=i(e.targetZoom-10),n.zoom(e.targetZoom).set()}}),zoomIn:new b({variant:"outline",size:"icon",label:En(),icon:g.zoomIn(),onClick:()=>{e.targetZoom=i(e.targetZoom+10),n.zoom(e.targetZoom).set()}}),tiltUp:new b({variant:"outline",size:"icon",label:Vn(),icon:g.tiltUp(),onClick:()=>{s(-15)}}),rotateLeft:new b({variant:"outline",size:"icon",label:Mn(),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:Sn(),icon:g.reset(),onClick:()=>{e.thetaOffset=0,n.reset()}}),rotateRight:new b({variant:"outline",size:"icon",label:$n(),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:Gn(),icon:g.tiltDown(),onClick:()=>{s(15)}})}}function Mi(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 T={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"},zi=5;let Pi=0;function q(n){const t=n.replace(/([A-Z])/g," $1").trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Fi(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=q(n.name),r.id=`vd-attribute-label-${Pi++}`,s.appendChild(r),s.setAttribute("role","group"),s.setAttribute("aria-labelledby",r.id);const a=n.values.find(p=>t.getValue(n.name,p)?.isSelected===!0),h=n.values.map(q),d=n.values.length<=zi?new wi(n.values,a,h):new _i(n.name,n.values,q(n.name),a,h);return d.onSelect(p=>{e.dispatch(T.SELECT,{attribute:n.name,value:p},!0).defaultPrevented||i(n.name,p)}),o(n.name,p=>{d.setSelected(p.value),e.dispatch(T.SELECTED,{attribute:n.name,value:p.value})}),s.appendChild(d.element),s}const $i=80,Di=2500;class Bi{constructor(t,e=Di){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=Ui(t.price,t.currency),this.vatEl.textContent=ut(this.configuration.vatDisplay)}renderButton(){const t=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!t),t&&this.state==="idle"&&this.setButtonText(ut(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",Qn());try{await this.configuration.submit(),this.setState("success",ti())}catch{this.setState("failed",oi())}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 ut(n){return(n??"").slice(0,$i)}function Ui(n,t){try{const e=new Intl.NumberFormat(u(),{style:"currency",currency:t}),i=e.resolvedOptions().maximumFractionDigits??2;return e.format(n/10**i)}catch{return`${t} ${(n/100).toFixed(2)}`}}class zt{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 Vi=572;class ji{constructor(t){this.actionBarSlot=t}actionBarSlot;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:vn(),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:"icon",label:pn(),icon:g.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),this.actionBarSlot.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-permanent"),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<Vi)}),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-permanent",t&&!this.collapsible)}}class Hi{attach(t,e){}setVisible(t){}destroy(){}}const qi={"inframe-bottom-left":()=>new zt,"sidebar-right":n=>new ji(n),hidden:()=>new Hi};function Gi(n,t){return(qi[n??""]??(()=>new zt))(t)}const G=w.fontFamily.sans.join(", "),Z=`
|
|
293
|
+
`;let ae=!1;function Ne(){if(ae||typeof document>"u")return;ae=!0;const n=document.createElement("style");n.id="vd-ui-vanilla",n.textContent=Ai,document.head.appendChild(n)}const Ei=w.fontFamily.sans.join(", ");class xi{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),Ne(),this.dialog=new Si({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.card.element.style,{display:"flex",flexDirection:"column",alignItems:"center",gap:l[3],fontFamily:Ei}),this.dialog.card.element.appendChild(this.createText($t(),{fontSize:w.fontSize.base,fontWeight:w.fontWeight.semibold,color:p.neutral[900]})),this.dialog.card.element.appendChild(this.createText(Vt(),{fontSize:w.fontSize.sm,color:p.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.card.element.appendChild(this.qrSlot),this.dialog.card.element.appendChild(this.createText(Gt(),{fontSize:w.fontSize.xs,color:p.neutral[500]}));const e=new b({variant:"outline",label:Qt(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(e.element),this.dialog.open()}async update(e){this.qrLib??=await Promise.resolve().then(()=>require("./browser-DfB_An57.cjs")).then(i=>i.browser);const t=await this.qrLib.toDataURL(e,{width:256,margin:4,errorCorrectionLevel:"M",color:{dark:p.black,light:p.white}});return this.qrSlot===null?!1:(this.qrSlot.classList.remove("ui-qr-slot--loading"),this.qrSlot.replaceChildren(this.createQrImage(t)),!0)}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(e,t){const i=document.createElement("p");return i.textContent=e,Object.assign(i.style,{margin:"0",textAlign:"center",...t}),i}createQrSlot(){const e=document.createElement("div");return e.className="ui-qr-slot ui-qr-slot--loading",e}createQrImage(e){const t=document.createElement("img");return t.src=e,t.alt="QR code",t}}function le(n){const e=Math.max(0,Math.min(1,n));return e*e*(3-2*e)}function Ti(n,e,t,i,o,s){const[r,a,h]=n,u=Math.cos(e),m=Math.sin(e),v=u*r+m*h,A=-m*r+u*h,k=Math.cos(t),_=Math.sin(t),R=k*a-_*A,z=_*a+k*A,X=.55;return[i+v*s*X,o-R*s*X,z]}function Ri(n,e,t){n.beginPath(),n.moveTo(e[0],e[1]),n.lineTo(t[0],t[1]),n.strokeStyle="#000",n.lineWidth=2,n.stroke()}function Ii(n,e,t,i,o){const s=e(t),r=e(i),a=[s[0]+(r[0]-s[0])*o,s[1]+(r[1]-s[1])*o,s[2]];Ri(n,s,a)}const F=[-1,-1,1],$=[1,-1,1],D=[1,-1,-1],B=[-1,-1,-1],U=[-1,1,1],V=[1,1,1],j=[1,1,-1],H=[-1,1,-1],ce=[[F,$],[$,D],[D,B],[B,F],[F,U],[$,V],[D,j],[B,H],[U,V],[V,j],[j,H],[H,U]],Oi=400,ue='-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif';function Li(){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 e=document.createElement("canvas");Object.assign(e.style,{width:"100%",height:"100%",position:"absolute",inset:"0"});const t=document.createElement("div");Object.assign(t.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:ue});const o=document.createElement("span");return Object.assign(o.style,{fontSize:"13px",color:"#000",fontFamily:ue}),o.textContent=Ie(),t.appendChild(i),t.appendChild(o),n.appendChild(e),n.appendChild(t),{overlay:n,canvas:e,pctEl:i,phaseEl:o}}class Mi{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(e,t={}){this.startTime=performance.now();const i=Li();this.overlay=i.overlay,this.canvas=i.canvas,this.pctEl=i.pctEl,this.phaseEl=i.phaseEl,e.appendChild(this.overlay),this.ctx=this.canvas.getContext("2d"),this.ctx!==null&&(this.sizeCanvas(),this.tick());const o=t.showDelay??Oi;this.showTimerId=setTimeout(()=>{this.reveal()},o)}get loadingTexts(){return{downloading:Ie(),rendering:ln()}}updateProgress(e,t){this.hidden||(this.pctEl.textContent=`${Math.round(e)}%`,this.phaseEl.textContent=t!==""?` · ${t}`:"")}showError(e){if(this.hidden=!1,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){const t=Math.min(devicePixelRatio,2),i=this.canvas.width/t,o=this.canvas.height/t;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,i*t,o*t)}this.pctEl.textContent="",this.phaseEl.textContent=e,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 e=Math.min(devicePixelRatio,2),t=this.overlay.clientWidth||440,i=this.overlay.clientHeight||360;this.canvas.width=t*e,this.canvas.height=i*e,this.ctx.scale(e,e),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 e=this.canvas.width/Math.min(devicePixelRatio,2),t=this.canvas.height/Math.min(devicePixelRatio,2),i=(performance.now()-this.startTime)/1e3;this.ctx.fillStyle="#fff",this.ctx.fillRect(0,0,e,t);const o=e/2,s=t*.44,r=Math.min(e,t)*.08,a=.785,h=.615,u=_=>Ti(_,a,h,o,s,r),m=6,v=i%m/m,A=ce.length;let k;v<.35?k=le(v/.35)*A:v<.55?k=A:v<.9?k=(1-le((v-.55)/.35))*A:k=0,this.ctx.shadowBlur=5,this.ctx.shadowColor="rgba(30,30,30,0.08)";for(let _=0;_<A&&!(_>=k);_++){const R=ce[_];if(R===void 0)continue;const z=Math.min(1,k-_);Ii(this.ctx,u,R[0],R[1],z)}this.ctx.shadowBlur=0}}class Ni{constructor(e){this.options=e,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(e){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(e?g.exitFullscreen():g.fullscreen())}syncButton(e,t,i){if(t&&e===null){const o=i();return this.element.appendChild(o.element),o}return!t&&e!==null?(e.element.remove(),null):e}applySettings(e){this.arBtn=this.syncButton(this.arBtn,e.ar!==!1&&this.options.onAr!==void 0,()=>new b({variant:"outline",size:"icon",label:Nt(),icon:g.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,e.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new b({variant:"outline",size:"icon",label:en(),icon:g.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}}const x=.5;class N{element;constructor(e,t){this.element=Object.assign(document.createElement("div"),{className:"vd-camera-controls"});const i={targetRotation:t.rotation,targetTilt:t.tilt,targetZoom:t.zoom,thetaOffset:0},o=zi(e,t,i);t.onChange(s=>{i.targetRotation=s.rotation-i.thetaOffset,i.targetTilt=s.tilt,i.targetZoom=s.zoom,Pi(o,t,s)}),this.element.appendChild(N.buildZoom(o.zoomOut,o.zoomIn)),this.element.appendChild(N.buildDpad(o.tiltUp,o.rotateLeft,o.reset,o.rotateRight,o.tiltDown))}static buildZoom(e,t){const i=document.createElement("div");return i.className="vd-zoom",i.appendChild(e.element),i.appendChild(t.element),i}static buildDpad(e,t,i,o,s){const r=document.createElement("div");r.className="vd-dpad";for(const[a,h]of[[e,"up"],[t,"left"],[i,"center"],[o,"right"],[s,"down"]])a.element.classList.add(`vd-dpad-${h}`),r.appendChild(a.element);return r}}function zi(n,e,t){const i=r=>Math.max(e.limits?.minZoom??1,Math.min(e.limits?.maxZoom??1/0,r)),o=r=>{const a=e.limits?.minRotate,h=e.limits?.maxRotate;return a!==void 0||h!==void 0?Math.max(a??-1/0,Math.min(h??1/0,r)):r},s=r=>{const a=e.limits?.minTilt,h=e.limits?.maxTilt;if(a!==void 0||h!==void 0){t.targetTilt=Math.max(a??0,Math.min(h??180,t.targetTilt+r)),n.tilt(t.targetTilt).set();return}const u=t.targetTilt+r;u>180||u<0?(t.targetTilt=u>180?360-u:-u,t.thetaOffset=(t.thetaOffset+180)%360,n.tilt(t.targetTilt).rotate(t.targetRotation+t.thetaOffset).set()):(t.targetTilt=u,n.tilt(t.targetTilt).set())};return{zoomOut:new b({variant:"outline",size:"icon",label:Ln(),icon:g.zoomOut(),onClick:()=>{t.targetZoom=i(t.targetZoom-10),n.zoom(t.targetZoom).set()}}),zoomIn:new b({variant:"outline",size:"icon",label:Tn(),icon:g.zoomIn(),onClick:()=>{t.targetZoom=i(t.targetZoom+10),n.zoom(t.targetZoom).set()}}),tiltUp:new b({variant:"outline",size:"icon",label:Hn(),icon:g.tiltUp(),onClick:()=>{s(-15)}}),rotateLeft:new b({variant:"outline",size:"icon",label:Pn(),icon:g.rotateLeft(),onClick:()=>{t.targetRotation=o(t.targetRotation-15),n.rotate(t.targetRotation+t.thetaOffset).set()}}),reset:new b({variant:"outline",size:"icon",label:kn(),icon:g.reset(),onClick:()=>{t.thetaOffset=0,n.reset()}}),rotateRight:new b({variant:"outline",size:"icon",label:Bn(),icon:g.rotateRight(),onClick:()=>{t.targetRotation=o(t.targetRotation+15),n.rotate(t.targetRotation+t.thetaOffset).set()}}),tiltDown:new b({variant:"outline",size:"icon",label:Wn(),icon:g.tiltDown(),onClick:()=>{s(15)}})}}function Pi(n,e,t){const i=e.limits;i!==void 0&&(n.zoomOut.element.disabled=i.minZoom!==void 0&&t.zoom<=i.minZoom+x,n.zoomIn.element.disabled=i.maxZoom!==void 0&&t.zoom>=i.maxZoom-x,n.tiltUp.element.disabled=i.minTilt!==void 0&&t.tilt<=i.minTilt+x,n.tiltDown.element.disabled=i.maxTilt!==void 0&&t.tilt>=i.maxTilt-x,n.rotateLeft.element.disabled=i.minRotate!==void 0&&t.rotation<=i.minRotate+x,n.rotateRight.element.disabled=i.maxRotate!==void 0&&t.rotation>=i.maxRotate-x)}const T={SELECT:"ui:select",SELECTED:"ui:selected",FOCUS_CHANGE:"vd:focus-change",CONFIGURATION_CHANGE:"vd:configuration-change",CONFIGURATION_SUBMIT:"vd:configuration-submit"},Fi=5;let $i=0;function q(n){const e=n.replace(/([A-Z])/g," $1").trim();return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function Di(n,e,t,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=q(n.name),r.id=`vd-attribute-label-${$i++}`,s.appendChild(r),s.setAttribute("role","group"),s.setAttribute("aria-labelledby",r.id);const a=n.values.find(m=>e.getValue(n.name,m)?.isSelected===!0),h=n.values.map(q),u=n.values.length<=Fi?new _i(n.values,a,h):new Ci(n.name,n.values,q(n.name),a,h);return u.onSelect(m=>{t.dispatch(T.SELECT,{attribute:n.name,value:m},!0).defaultPrevented||i(n.name,m)}),o(n.name,m=>{u.setSelected(m.value),t.dispatch(T.SELECTED,{attribute:n.name,value:m.value})}),s.appendChild(u.element),{element:s,setSelectable:m=>{u.setEnabled(m)}}}const Bi=80,Ui=2500;class Vi{constructor(e,t=Ui){this.configuration=e,this.resetMs=t,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 e=this.configuration.current!==void 0||this.configuration.submitEnabled;this.element.classList.toggle("vd-hidden",!e)}destroy(){this.unsubscribe(),this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.element.remove()}renderPrice(e){if(e===void 0){this.priceEl.textContent="",this.vatEl.textContent="";return}this.priceEl.textContent=ji(e.price,e.currency),this.vatEl.textContent=de(this.configuration.vatDisplay)}renderButton(){const e=this.configuration.submitEnabled;this.button.element.classList.toggle("vd-hidden",!e),e&&this.state==="idle"&&this.setButtonText(de(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!=="busy"){this.setState("busy",Xn());try{await this.configuration.submit(),this.setState("success",ni())}catch{this.setState("failed",ri())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state="idle",this.update()},this.resetMs)}setState(e,t){this.state=e,this.element.dataset.submit=e,this.button.element.disabled=e==="busy",this.setButtonText(t)}setButtonText(e){this.button.element.textContent=e,this.button.element.setAttribute("aria-label",e)}}function de(n){return(n??"").slice(0,Bi)}function ji(n,e){try{const t=new Intl.NumberFormat(d(),{style:"currency",currency:e}),i=t.resolvedOptions().maximumFractionDigits??2;return t.format(n/10**i)}catch{return`${e} ${(n/100).toFixed(2)}`}}class ze{slot=null;panel=null;attach(e,t){this.panel=t,t.style.display="none",this.slot=document.createElement("div"),this.slot.className="vd-slot-bottom-left",this.slot.appendChild(t),e.appendChild(this.slot)}setVisible(e){this.panel!==null&&(this.panel.style.display=e?"flex":"none")}destroy(){this.slot?.remove(),this.slot=null,this.panel=null}}const Hi=572;class qi{constructor(e){this.actionBarSlot=e}actionBarSlot;element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;attach(e,t){this.container=e,t.classList.add("vd-attributes-sidebar"),this.closeButton=new b({variant:"ghost",size:"icon-sm",label:wn(),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(t),this.element=document.createElement("div"),this.element.className="vd-sidebar vd-hidden",this.element.append(i,this.body),e.appendChild(this.element),this.openButton=new b({variant:"outline",size:"icon",label:gn(),icon:g.configurator({size:18}),onClick:()=>{this.expanded=!0,this.render()}}),this.openButton.element.classList.add("vd-configurator-toggle","vd-hidden"),this.actionBarSlot.appendChild(this.openButton.element),this.observe()}setVisible(e){this.visible=e,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-permanent"),this.container=null}observe(){typeof ResizeObserver>"u"||this.container===null||(this.observer=new ResizeObserver(e=>{const t=e[0]?.contentRect.width??0;this.setCollapsible(t>0&&t<Hi)}),this.observer.observe(this.container))}setCollapsible(e){e!==this.collapsible&&(this.collapsible=e,this.expanded=!e,this.render())}render(){if(this.element===null||this.openButton===null||this.closeButton===null||this.container===null)return;const e=this.visible&&this.expanded,t=this.visible&&!this.expanded;this.element.classList.toggle("vd-hidden",!this.visible),this.element.classList.toggle("vd-sidebar-collapsed",t),this.openButton.element.classList.toggle("vd-hidden",!t),this.closeButton.element.style.display=this.collapsible?"":"none",this.container.classList.toggle("vd-layout-sidebar-right",e),this.container.classList.toggle("vd-layout-sidebar-permanent",e&&!this.collapsible)}}class Gi{attach(e,t){}setVisible(e){}destroy(){}}const Zi={"inframe-bottom-left":()=>new ze,"sidebar-right":n=>new qi(n),hidden:()=>new Gi};function Wi(n,e){return(Zi[n??""]??(()=>new ze))(e)}const G=w.fontFamily.sans.join(", "),Z=`
|
|
292
294
|
position: absolute;
|
|
293
295
|
display: flex;
|
|
294
296
|
z-index: 10;
|
|
295
297
|
transition: inset-inline-end 0.18s ease;
|
|
296
|
-
`,
|
|
298
|
+
`,Yi=`
|
|
297
299
|
/* Override browser's default black fullscreen backdrop */
|
|
298
300
|
.vd-container:fullscreen {
|
|
299
301
|
background: oklch(100% 0 0);
|
|
@@ -331,7 +333,7 @@
|
|
|
331
333
|
display: flex;
|
|
332
334
|
flex-direction: column;
|
|
333
335
|
gap: ${l[1]};
|
|
334
|
-
background: color-mix(in oklch, ${
|
|
336
|
+
background: color-mix(in oklch, ${p.white} 85%, transparent);
|
|
335
337
|
backdrop-filter: blur(8px);
|
|
336
338
|
border-radius: ${l[2]};
|
|
337
339
|
padding: ${l[2]};
|
|
@@ -359,12 +361,12 @@
|
|
|
359
361
|
display: flex;
|
|
360
362
|
flex-direction: column;
|
|
361
363
|
gap: ${l[3]};
|
|
362
|
-
background: color-mix(in oklch, ${
|
|
364
|
+
background: color-mix(in oklch, ${p.white} 85%, transparent);
|
|
363
365
|
backdrop-filter: blur(8px);
|
|
364
|
-
border: 1px solid color-mix(in oklch, ${
|
|
366
|
+
border: 1px solid color-mix(in oklch, ${p.neutral[900]} 8%, transparent);
|
|
365
367
|
border-radius: ${l[3]};
|
|
366
368
|
padding: ${l[3]};
|
|
367
|
-
box-shadow: 0 ${l[1]} ${l[4]} color-mix(in oklch, ${
|
|
369
|
+
box-shadow: 0 ${l[1]} ${l[4]} color-mix(in oklch, ${p.neutral[900]} 6%, transparent);
|
|
368
370
|
font-family: ${G};
|
|
369
371
|
}
|
|
370
372
|
|
|
@@ -378,7 +380,7 @@
|
|
|
378
380
|
.vd-attribute-label {
|
|
379
381
|
font-size: ${w.fontSize.xs};
|
|
380
382
|
font-weight: ${w.fontWeight.medium};
|
|
381
|
-
color: ${
|
|
383
|
+
color: ${p.neutral[500]};
|
|
382
384
|
text-transform: uppercase;
|
|
383
385
|
letter-spacing: 0.05em;
|
|
384
386
|
font-family: ${G};
|
|
@@ -417,10 +419,10 @@
|
|
|
417
419
|
z-index: 11;
|
|
418
420
|
display: flex;
|
|
419
421
|
flex-direction: column;
|
|
420
|
-
background: color-mix(in oklch, ${
|
|
422
|
+
background: color-mix(in oklch, ${p.white} 90%, transparent);
|
|
421
423
|
backdrop-filter: blur(10px);
|
|
422
|
-
border-inline-start: 1px solid color-mix(in oklch, ${
|
|
423
|
-
box-shadow: -${l[1]} 0 ${l[4]} color-mix(in oklch, ${
|
|
424
|
+
border-inline-start: 1px solid color-mix(in oklch, ${p.neutral[900]} 8%, transparent);
|
|
425
|
+
box-shadow: -${l[1]} 0 ${l[4]} color-mix(in oklch, ${p.neutral[900]} 5%, transparent);
|
|
424
426
|
}
|
|
425
427
|
|
|
426
428
|
@media (prefers-reduced-motion: no-preference) {
|
|
@@ -462,7 +464,7 @@
|
|
|
462
464
|
flex-direction: column;
|
|
463
465
|
gap: ${l[2]};
|
|
464
466
|
padding-block-start: ${l[3]};
|
|
465
|
-
border-block-start: 1px solid color-mix(in oklch, ${
|
|
467
|
+
border-block-start: 1px solid color-mix(in oklch, ${p.neutral[900]} 8%, transparent);
|
|
466
468
|
font-family: ${G};
|
|
467
469
|
}
|
|
468
470
|
|
|
@@ -475,12 +477,12 @@
|
|
|
475
477
|
.vd-price {
|
|
476
478
|
font-size: ${w.fontSize.lg};
|
|
477
479
|
font-weight: ${w.fontWeight.semibold};
|
|
478
|
-
color: ${
|
|
480
|
+
color: ${p.neutral[900]};
|
|
479
481
|
}
|
|
480
482
|
|
|
481
483
|
.vd-vat {
|
|
482
484
|
font-size: ${w.fontSize.xs};
|
|
483
|
-
color: ${
|
|
485
|
+
color: ${p.neutral[500]};
|
|
484
486
|
}
|
|
485
487
|
|
|
486
488
|
.vd-cta {
|
|
@@ -490,9 +492,9 @@
|
|
|
490
492
|
|
|
491
493
|
/* Failed submit is the one place red belongs: a clear, recoverable error state. */
|
|
492
494
|
.vd-commerce[data-submit="failed"] .vd-cta {
|
|
493
|
-
background: ${
|
|
494
|
-
border-color: ${
|
|
495
|
-
color: ${
|
|
495
|
+
background: ${p.semantic.error};
|
|
496
|
+
border-color: ${p.semantic.error};
|
|
497
|
+
color: ${p.white};
|
|
496
498
|
}
|
|
497
499
|
|
|
498
|
-
`;function Wi(){if(Mt(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=Zi,document.head.appendChild(n)}function Yi(n,t){const e=document.createElement("a");e.href=`data:image/png;base64,${n}`,e.download=t,e.click()}class Qi{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){Wi(),this.container=t,this.loading=new Oi(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 Ni({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&&xt(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.slots.bottomRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new M(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(Fi(i,t,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.commerce=new Bi(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=Gi(this.settings.configuratorLayout,this.slots.bottomRight),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:dn(),icon:g.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:e,filename:i})=>{Yi(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))}}const Ki={};class Xi{defaultServer="https://server.virtualdisplay.io";options;serverHost;extraParams;constructor(t,e,i){this.options=t,this.serverHost=e,this.extraParams=i}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(),t.setAttribute("allow","xr-spatial-tracking; fullscreen"),t}attachToParent(t){this.getParentElement().appendChild(t)}buildUrl(){const t=this.getServerUrl(),e=new URL(t);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.session!==void 0&&e.searchParams.set("session",this.options.session),this.options.debug===!0&&e.searchParams.set("debug","true"),this.options.traceparent!==void 0&&e.searchParams.set("traceparent",this.options.traceparent);for(const[i,o]of Object.entries(this.extraParams??{}))e.searchParams.set(i,o);return e.toString()}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(Ki?.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 Ji(n){const{messenger:t}=n;t.on(c.HANDSHAKE,e=>{Bt(e)&&(exports.logger.info("Server handshake received, flushing publisher queue"),t.markReady())}),t.on(c.SESSION,e=>{Ut(e)&&n.onSession(e.sessionId)}),t.on(c.MUTATION,e=>{Vt(e)&&(n.attributes.handleMutationResult(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),t.on(c.SNAPSHOT,e=>{jt(e)&&n.snapshot.handleSnapshotResult(e)}),t.on(c.CAMERA,e=>{Ht(e)&&n.cameraPosition.handlePositionUpdate(e)}),t.on(c.LOADING_INDICATOR,e=>{Gt(e)&&(e.error!==void 0?n.ui.showError(e.error):n.ui.updateProgress(e.progress,e.phase))}),t.on(c.CONFIG,e=>{Wt(e)&&n.applyConfig(e)}),t.on(c.MAPPING,e=>{qt(e)&&(n.attributes.handleMappingReceived(e),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,e.attributes),n.readyStateTracker.handleMappingReceived())}),to(n)}function to(n){const{messenger:t}=n;t.on(c.FOCUS,e=>{Yt(e)&&n.focus.handleStateReceived(e)}),t.on(c.PRICING,e=>{Qt(e)&&n.configuration.handlePricingReceived(e.pricing)}),t.on(c.SYNC,e=>{Zt(e)&&n.onSync(e.connected)})}class eo{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}}class no{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;iframeParams;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;constructor(t,e){this.options=t;const i=e??{};this.serverHost=i.serverHost,this.iframeParams=i.iframeParams,this.initializeLogging(),this.messenger=new Kt(()=>this.iframe?.contentWindow??null,i.messengerOptions);const o=r=>{this.messenger.send(r)};this.attributes=new fe(o,(r,a)=>{this.notifyMutationFailed(r,a)}),this.snapshotApi=new At(o),this.annotationsApi=new ht(o),this.cameraApi=new _t(o),this.cameraPositionApi=new ge,this.focusApi=new Ct(o,r=>{this.dispatchFocusChange(r)}),this.configurationApi=new St(r=>{this.dispatchConfigurationChange(r)},r=>{this.dispatchConfigurationSubmit(r)}),this.eventBus=new ye,this.arActivation=i.createArActivation?.(o),this.syncTracker=i.createSyncTracker?.(),this.readyStateTracker=new eo(()=>{this.notifyReady()});const s=this.arActivation;this.ui=new Qi({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(r,a)=>this.attributes.select(r,a),onSubscribe:(r,a)=>this.attributes.onChange(r,a),...s!==void 0&&{onAr:()=>{s.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()}}),this.wireIncomingMessages(),i.registerHandlers?.(this.messenger,o),this.messenger.start(),this.createAndConnectIframe()}wireIncomingMessages(){Ji({messenger:this.messenger,attributes:this.attributes,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:t=>{this.handleConfig(t)},onSession:t=>{this.handleSession(t)},onSync:t=>{this.syncTracker?.handleSync(t)}})}handleSession(t){this.viewerSessionId=t,this.arActivation?.onSession(t)}notifyMutationFailed(t,e){for(const i of this.mutationFailedCallbacks)i({attribute:t,value:e})}notifyReady(){const t=this.readyCallbacks;this.readyCallbacks=[];for(const e of t)e(this);this.ui.onReady()}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,a])=>e[r]!==a).map(([r,a])=>`${r} (metadata: ${e[r]??"undefined"}, override: ${a})`);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)}trackFullscreen(){this.messenger.send({type:c.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&wt(),exports.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const e=new Xi(this.options,this.serverHost,this.iframeParams).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)}activateAr(){this.arActivation?.activate()}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 sessionId(){return this.viewerSessionId}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.arActivation?.destroy(),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}}const io="ar.virtualdisplay.io";function oo(n){const t=new URL(`https://${io}/go`);return n.sessionId!==void 0?t.searchParams.set("session",n.sessionId):(t.searchParams.set("license",n.license),t.searchParams.set("model",n.model)),t.toString()}const so=1500;class ro{options;qrModal=new Ai;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(t){this.options=t}onSession(t){this.sessionId=t;const e=this.waiters;this.waiters=[];for(const i of e)i(t)}activate(){if(he()){this.options.send({type:c.AR_ACTIVATE});return}this.showQrCode()}destroy(){this.destroyed=!0;for(const t of this.pendingTimers)clearTimeout(t);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();const t=await this.waitForSessionId();if(this.destroyed)return;const e=oo({sessionId:t,license:this.options.license,model:this.options.model}),i=await this.qrModal.update(e);if(this.destroyed){this.qrModal.hide();return}i&&this.options.send({type:c.QR_SHOWN})}waitForSessionId(){return this.sessionId!==void 0?Promise.resolve(this.sessionId):new Promise(t=>{const e=setTimeout(()=>{this.pendingTimers.delete(e),t(void 0)},so);this.pendingTimers.add(e),this.waiters.push(i=>{this.pendingTimers.delete(e),clearTimeout(e),t(i)})})}}class ao{callbacks=[];lastKnown;handleSync(t){this.lastKnown=t;for(const e of this.callbacks)e(t)}onChange(t){this.callbacks.push(t),this.lastKnown!==void 0&&t(this.lastKnown)}}class lo extends no{syncStatusTracker;constructor(t){const e=new ao;super(t,{createArActivation:i=>new ro({license:t.license,model:t.model,send:i}),createSyncTracker:()=>e}),this.syncStatusTracker=e}onSyncChange(t){this.syncStatusTracker.onChange(t)}}exports.Annotations=ht;exports.Attribute=pt;exports.AttributeValue=mt;exports.Camera=_t;exports.Configuration=St;exports.ERROR_CODES=C;exports.Focus=Ct;exports.Photo=kt;exports.Snapshot=At;exports.VD_EVENTS=T;exports.VirtualdisplayClient=lo;exports.VirtualdisplayError=f;exports.enableDebugMode=wt;exports.isDebugMode=pe;
|
|
500
|
+
`;function Qi(){if(Ne(),document.getElementById("vd-styles")!==null)return;const n=document.createElement("style");n.id="vd-styles",n.textContent=Yi,document.head.appendChild(n)}function Ki(n,e){const t=document.createElement("a");t.href=`data:image/png;base64,${n}`,t.download=e,t.click()}class Xi{options;settings={};container=null;loading=null;slots={topRight:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;groupHandles=new Map;lastSelectable=null;layout=null;commerce=null;constructor(e){this.options=e}attach(e){Qi(),this.container=e,this.loading=new Mi(e),this.slots.topRight=this.createSlot(e,"vd-slot-top-right"),this.slots.bottomRight=this.createSlot(e,"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 e=typeof this.container.requestFullscreen=="function";this.actionBar=new Ni({onAr:this.options.onAr,onFullscreen:e?()=>{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(e,t){this.loading?.updateProgress(e,t)}showError(e){this.loading?.showError(e)}applyViewerSettings(e){this.settings=e,e.language!==void 0&&xe(e.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(e),this.cameraControls!==null&&(this.cameraControls.element.style.display=e.cameraControls===!0?"flex":"none"),this.placeScreenshotButton()}renderAttributeControls(e,t){if(!(this.container===null||this.slots.topRight===null||this.slots.bottomRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.settings.cameraControls===!0&&(this.cameraControls=new N(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display="none",this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),t.length!==0)){this.attributes=document.createElement("div"),this.attributes.className="vd-attributes",this.groupHandles=new Map;for(const i of t){const o=Di(i,e,this.options.eventBus,this.options.onSelect,this.options.onSubscribe);this.groupHandles.set(i.name,o),this.attributes.appendChild(o.element)}this.commerce=new Vi(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=Wi(this.settings.configuratorLayout,this.slots.bottomRight),this.layout.attach(this.container,this.attributes),this.lastSelectable!==null&&this.applySelectable(this.lastSelectable)}}applySelectable(e){this.lastSelectable=e;for(const[t,i]of this.groupHandles){const o=e.find(s=>s.name===t);i.setSelectable(o?.selectable??null)}}get viewerSettings(){return this.settings}teardownConfigurator(){this.commerce?.destroy(),this.commerce=null,this.attributes?.remove(),this.attributes=null,this.groupHandles=new Map,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 e of Object.values(this.slots))e?.remove();this.container=null}createSlot(e,t){const i=document.createElement("div");return i.className=t,e.appendChild(i),i}syncScreenshotButton(){const e=this.settings.screenshot===!0;e&&this.screenshotBtn===null&&(this.screenshotBtn=new b({variant:"outline",size:"icon",label:hn(),icon:g.screenshot(),onClick:()=>{this.options.snapshotApi.take("snapshot.png").onDeveloped(({data:t,filename:i})=>{Ki(t,i)})}})),!e&&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))}}const Ji={};class eo{defaultServer="https://server.virtualdisplay.io";options;serverHost;extraParams;constructor(e,t,i){this.options=e,this.serverHost=t,this.extraParams=i}create(){const e=this.createContainer(),t=this.createIframe();return e.appendChild(t),this.attachToParent(e),{container:e,iframe:t}}createContainer(){const e=document.createElement("div");return e.className="vd-container",Object.assign(e.style,{position:"relative",width:"100%",height:"100%",overflow:"hidden"}),e}createIframe(){const e=document.createElement("iframe");return e.src=this.buildUrl(),e.setAttribute("allow","xr-spatial-tracking; fullscreen"),e}attachToParent(e){this.getParentElement().appendChild(e)}buildUrl(){const e=this.getServerUrl(),t=new URL(e);t.searchParams.set("license",this.options.license),t.searchParams.set("model",this.options.model),this.options.language!==void 0&&t.searchParams.set("language",this.options.language),this.options.session!==void 0&&t.searchParams.set("session",this.options.session),this.options.debug===!0&&t.searchParams.set("debug","true"),this.options.traceparent!==void 0&&t.searchParams.set("traceparent",this.options.traceparent);for(const[i,o]of Object.entries(this.extraParams??{}))t.searchParams.set(i,o);return t.toString()}getServerUrl(){if(this.serverHost!==void 0)return this.serverHost;if(Ji?.VITE_VIRTUALDISPLAY_SERVER_HOST===void 0)return this.defaultServer}getParentElement(){if(typeof this.options.parent!="string")return this.options.parent;const e=document.querySelector(this.options.parent);if(e===null)throw f.parentNotFound(this.options.parent);return e}}function to(n){const{messenger:e}=n;e.on(c.HANDSHAKE,t=>{Be(t)&&(exports.logger.info("Server handshake received, flushing publisher queue"),e.markReady())}),e.on(c.SESSION,t=>{Ue(t)&&n.onSession(t.sessionId)}),e.on(c.MUTATION,t=>{Ve(t)&&(n.attributes.handleMutationResult(t),n.configuration.handleSelectionChanged(n.attributes.getSelection()))}),e.on(c.SNAPSHOT,t=>{je(t)&&n.snapshot.handleSnapshotResult(t)}),e.on(c.CAMERA,t=>{He(t)&&n.cameraPosition.handlePositionUpdate(t)}),e.on(c.LOADING_INDICATOR,t=>{Ge(t)&&(t.error!==void 0?n.ui.showError(t.error):n.ui.updateProgress(t.progress,t.phase))}),e.on(c.CONFIG,t=>{Ye(t)&&n.applyConfig(t)}),e.on(c.MAPPING,t=>{qe(t)&&(n.attributes.handleMappingReceived(t),n.configuration.handleSelectionChanged(n.attributes.getSelection()),n.ui.renderAttributeControls(n.attributes,t.attributes),n.readyStateTracker.handleMappingReceived())}),no(n)}function no(n){const{messenger:e}=n;e.on(c.FOCUS,t=>{Qe(t)&&n.focus.handleStateReceived(t)}),e.on(c.PRICING,t=>{Ke(t)&&n.configuration.handlePricingReceived(t.pricing)}),e.on(c.SYNC,t=>{Ze(t)&&n.onSync(t.connected)}),e.on(c.SELECTABLE,t=>{We(t)&&(n.selectable.handleSnapshot(t),n.ui.applySelectable(t.attributes))})}class io{ready=!1;onReady;constructor(e){this.onReady=e}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}}class oo{attributes;selectableState;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;iframeParams;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;constructor(e,t){this.options=e;const i=t??{};this.serverHost=i.serverHost,this.iframeParams=i.iframeParams,this.initializeLogging(),this.messenger=new Xe(()=>this.iframe?.contentWindow??null,i.messengerOptions);const o=r=>{this.messenger.send(r)};this.attributes=new gt(o,(r,a)=>{this.notifyMutationFailed(r,a)}),this.selectableState=new bt,this.snapshotApi=new Ae(o),this.annotationsApi=new he(o),this.cameraApi=new Se(o),this.cameraPositionApi=new vt,this.focusApi=new Ce(o,r=>{this.dispatchFocusChange(r)}),this.configurationApi=new _e(r=>{this.dispatchConfigurationChange(r)},r=>{this.dispatchConfigurationSubmit(r)}),this.eventBus=new St,this.arActivation=i.createArActivation?.(o),this.syncTracker=i.createSyncTracker?.(),this.readyStateTracker=new io(()=>{this.notifyReady()});const s=this.arActivation;this.ui=new Xi({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(r,a)=>this.attributes.select(r,a),onSubscribe:(r,a)=>this.attributes.onChange(r,a),...s!==void 0&&{onAr:()=>{s.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()}}),this.wireIncomingMessages(),i.registerHandlers?.(this.messenger,o),this.messenger.start(),this.createAndConnectIframe()}wireIncomingMessages(){to({messenger:this.messenger,attributes:this.attributes,selectable:this.selectableState,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:e=>{this.handleConfig(e)},onSession:e=>{this.handleSession(e)},onSync:e=>{this.syncTracker?.handleSync(e)}})}handleSession(e){this.viewerSessionId=e,this.arActivation?.onSession(e)}notifyMutationFailed(e,t){for(const i of this.mutationFailedCallbacks)i({attribute:e,value:t})}notifyReady(){const e=this.readyCallbacks;this.readyCallbacks=[];for(const t of e)t(this);this.ui.onReady()}dispatchFocusChange(e){this.container?.dispatchEvent(new CustomEvent(T.FOCUS_CHANGE,{detail:e,bubbles:!0}))}dispatchConfigurationChange(e){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_CHANGE,{detail:e??null,bubbles:!0}))}dispatchConfigurationSubmit(e){this.container?.dispatchEvent(new CustomEvent(T.CONFIGURATION_SUBMIT,{detail:e,bubbles:!0}))}handleConfig(e){const t=e.viewerSettings,i=this.options.viewerSettings;if(t!==void 0||i!==void 0){const o=i!==void 0?{...t??{},...i}:t;if(i!==void 0&&t!==void 0){const s=Object.entries(i).filter(([r,a])=>t[r]!==a).map(([r,a])=>`${r} (metadata: ${t[r]??"undefined"}, override: ${a})`);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(e.cameraLimits)}trackFullscreen(){this.messenger.send({type:c.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&we(),exports.logger.info("Initializing Virtualdisplay client",{model:this.options.model})}createAndConnectIframe(){const t=new eo(this.options,this.serverHost,this.iframeParams).create();this.container=t.container,this.iframe=t.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(e,t){this.attributes.select(e,t)}getValues(e){return this.attributes.getValues(e)}getValue(e,t){return this.attributes.getValue(e,t)}onChange(e,t){this.attributes.onChange(e,t)}getAttribute(e){return this.attributes.getAttribute(e)}get isReady(){return this.readyStateTracker.isReady}onReady(e){if(this.readyStateTracker.isReady){e(this);return}this.readyCallbacks.push(e)}onMutationFailed(e){this.mutationFailedCallbacks.push(e)}onSelectableChange(e){this.selectableState.onChange(e)}getSelectable(e){return this.selectableState.selectableFor(e)}activateAr(){this.arActivation?.activate()}on(e,t){this.eventBus.on(e,t)}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 sessionId(){return this.viewerSessionId}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.mutationFailedCallbacks.length=0,this.snapshotApi.clear(),this.messenger.destroy(),this.arActivation?.destroy(),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}}const so="ar.virtualdisplay.io";function ro(n){const e=new URL(`https://${so}/go`);return n.sessionId!==void 0?e.searchParams.set("session",n.sessionId):(e.searchParams.set("license",n.license),e.searchParams.set("model",n.model)),e.toString()}const ao=1500;class lo{options;qrModal=new xi;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(e){this.options=e}onSession(e){this.sessionId=e;const t=this.waiters;this.waiters=[];for(const i of t)i(e)}activate(){if(mt()){this.options.send({type:c.AR_ACTIVATE});return}this.showQrCode()}destroy(){this.destroyed=!0;for(const e of this.pendingTimers)clearTimeout(e);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();const e=await this.waitForSessionId();if(this.destroyed)return;const t=ro({sessionId:e,license:this.options.license,model:this.options.model}),i=await this.qrModal.update(t);if(this.destroyed){this.qrModal.hide();return}i&&this.options.send({type:c.QR_SHOWN})}waitForSessionId(){return this.sessionId!==void 0?Promise.resolve(this.sessionId):new Promise(e=>{const t=setTimeout(()=>{this.pendingTimers.delete(t),e(void 0)},ao);this.pendingTimers.add(t),this.waiters.push(i=>{this.pendingTimers.delete(t),clearTimeout(t),e(i)})})}}class co{callbacks=[];lastKnown;handleSync(e){this.lastKnown=e;for(const t of this.callbacks)t(e)}onChange(e){this.callbacks.push(e),this.lastKnown!==void 0&&e(this.lastKnown)}}class uo extends oo{syncStatusTracker;constructor(e){const t=new co;super(e,{createArActivation:i=>new lo({license:e.license,model:e.model,send:i}),createSyncTracker:()=>t}),this.syncStatusTracker=t}onSyncChange(e){this.syncStatusTracker.onChange(e)}}exports.Annotations=he;exports.Attribute=pe;exports.AttributeValue=me;exports.Camera=Se;exports.Configuration=_e;exports.ERROR_CODES=C;exports.Focus=Ce;exports.Photo=ke;exports.Snapshot=Ae;exports.VD_EVENTS=T;exports.VirtualdisplayClient=uo;exports.VirtualdisplayError=f;exports.enableDebugMode=we;exports.isDebugMode=ft;
|