@virtualdisplay.io/client 4.0.0-alpha.35 → 4.0.0-alpha.36

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.
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-5iZMYShA.cjs");var t={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`,APP_RESOLVED:`app_resolved`},n=`main`,r={FOCUS:`focus`,UNFOCUS:`unfocus`},i={FOCUSED:`focused`,UNFOCUSED:`unfocused`},a={AVAILABLE:`available`,VIEW_ONLY:`view_only`,HIDDEN:`hidden`};function o(e){return typeof e!=`object`||!e?null:e}var s=new Set(Object.values(t));function c(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.target!=`string`&&typeof t.type==`string`&&s.has(t.type)}function l(e){let n=o(e);return n!==null&&n.type===t.HANDSHAKE}function u(e){let n=o(e);return n!==null&&n.type===t.SESSION&&typeof n.sessionId==`string`}function ee(e){let n=o(e);return n!==null&&n.type===t.APP_RESOLVED&&typeof n.appType==`string`&&n.appType!==``&&typeof n.name==`string`}function d(e){let n=o(e);return n!==null&&n.type===t.MUTATION&&typeof n.instance==`string`&&n.instance!==``&&Array.isArray(n.results)}function f(e){let n=o(e);return n!==null&&n.type===t.SNAPSHOT&&(`data`in n||`error`in n)}function p(e){let n=o(e);return n!==null&&n.type===t.CAMERA&&Array.isArray(n.transforms)}function te(e){let n=o(e);return n!==null&&n.type===t.MAPPING&&typeof n.instance==`string`&&n.instance!==``&&Array.isArray(n.attributes)}function ne(e){let n=o(e);return n!==null&&n.type===t.LOADING_INDICATOR&&typeof n.progress==`number`}function m(e){let n=o(e);return n!==null&&n.type===t.SYNC&&typeof n.connected==`boolean`}function re(e){let n=o(e);return n!==null&&n.type===t.SELECTABLE&&typeof n.instance==`string`&&n.instance!==``&&Array.isArray(n.attributes)}function ie(e){let n=o(e);return n!==null&&n.type===t.CONFIG&&typeof n.viewerSettings==`object`}function ae(e){let n=o(e);return n!==null&&n.type===t.FOCUS&&typeof n.instance==`string`&&n.instance!==``&&typeof n.state==`string`}function oe(e){let n=o(e);return n!==null&&n.type===t.PRICING&&typeof n.instance==`string`&&n.instance!==``&&typeof n.pricing==`object`&&n.pricing!==null}var se=class{processor;pending=[];isReady=!1;constructor(e){this.processor=e}enqueue(e){this.isReady?this.processor(e):this.pending.push(e)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;let e=[...this.pending];this.pending.length=0;for(let t of e)this.processor(t)}hasPending(e){return this.pending.some(t=>t.type===e)}clear(){this.pending.length=0}},ce=class{getTarget;handlers=new Map;publisher;consumer;listener=null;sourceId;targetOrigin;isValid;onHandlerError;constructor(e,t){this.getTarget=e,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=`*`,this.isValid=t?.isValid??c,this.onHandlerError=t?.onHandlerError??le,this.publisher=new se(e=>this.post(e)),this.consumer=new se(e=>this.routeToHandler(e)),t?.bufferIncoming!==!0&&this.consumer.markReady()}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=>{let{data:t}=e;if(!this.isValid(t)||t._source===this.sourceId)return;let n=this.getTarget();if(n!==null&&e.source!==null&&e.source!==n)return;let r=t;this.consumer.enqueue(r)},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()}post(e){let t=this.getTarget();t!==null&&t.postMessage({...e,_source:this.sourceId},this.targetOrigin)}routeToHandler(e){let t=this.handlers.get(e.type);if(t===void 0)return;let n;try{n=t(e)}catch(t){this.onHandlerError(e,t);return}n instanceof Promise&&n.catch(t=>{this.onHandlerError(e,t)})}};function le(e,t){let n=t instanceof Error?t.message:String(t);console.error(`Virtualdisplay: error handling ${e.type}: ${n}`)}t.CAMERA,t.LOADING_INDICATOR;var ue=class{send;instance;constructor(e,t){this.send=e,this.instance=t}setEnabled(e){this.send({type:t.ANNOTATION_TOGGLE,instance:this.instance,enabled:e})}},de=class{value;attribute;label;isSelectedValue=!1;constructor(e,t,n){this.value=e,this.attribute=t,this.label=n}get isSelected(){return this.isSelectedValue}setSelected(e){this.isSelectedValue=e}},fe={},pe=[`en`,`nl`,`de`],h=[`globalVariable`,`baseLocale`],g=[],_=typeof window>`u`;globalThis.__paraglide=globalThis.__paraglide??{};var v,me=!1,y=()=>{let e=!_&&g.length>0&&typeof window<`u`?window.location?.href:void 0,t=he(e?Me(e):h,e);if(t)return me||(v=t,me=!0,_e(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found`)};function he(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(t===`globalVariable`&&v!==void 0)n=v;else if(Ne(t)&&S.has(t)){let e=S.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return xe(t)}}let e=b(n);if(e)return e}}var ge=e=>{e?window.location.href=e:window.location.reload()},_e=(e,t)=>{let n={reload:!0,...t},r;try{r=y()}catch{}let i=[],a=h;!_&&typeof window<`u`&&window.location?.href&&(a=Me(window.location.href));for(let t of a)if(t===`globalVariable`)v=e;else if(t===`baseLocale`)continue;else if(Ne(t)&&S.has(t)){let n=S.get(t);if(n){let r=n.setLocale(e);r instanceof Promise&&(r=r.catch(e=>{throw Error(`Custom strategy "${t}" setLocale failed.`,{cause:e})}),i.push(r))}}let o=()=>{!_&&n.reload&&window.location&&e!==r&&ge(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()},ve=()=>typeof window<`u`?window.location.origin:`http://fallback.com`,ye;function b(e){if(typeof e==`string`)return ye??=be(),ye.get(e.toLowerCase())}function be(){let e=new Map;for(let t of pe){let n=t.toLowerCase();e.has(n)||e.set(n,t)}return e}function xe(e){let t=b(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${pe.join(`, `)}`)}function x(e){return e}function Se(e,t){return new fe(e,t.href)}function Ce(){return 0}function we(e){return g}function Te(e,t){return e.exec(t.href)}function Ee(e){return De(e)}function De(e){let t=x(typeof e==`string`?new URL(e,ve()):new URL(e.href)),n=t.pathname.replace(/^\/+/,``).split(`/`);return n.length>0&&b(n[0])&&(t.pathname=`/`+n.slice(1).join(`/`)),x(t)}var Oe=-1,ke,Ae;function je(e){if(g.length===0)return;let t=typeof e==`string`?e:e.href,n=Ce();if(ke===t&&Oe===n)return Ae;let r=x(new URL(t,`http://example.com`)),i=Ee(r),a=i.href===r.href?[r]:[r,i],o;for(let e of a){for(let t of we(e))if(Te(Se(t.match,e),e)){o=t;break}if(o)break}return Oe=n,ke=t,Ae=o,o}function Me(e){let t=je(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:h}var S=new Map;function Ne(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}function Pe(e,t){return Fe(t!==void 0&&Object.hasOwn(t,e)?t[e]:void 0)??C(e)}function Fe(e){if(e===void 0)return;for(let t of[y(),`nl`,`en`])if(Object.hasOwn(e,t)&&e[t]!==void 0)return e[t];let[t]=Object.values(e);return t}function C(e){let t=e.replace(/([A-Z])/g,` $1`).trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}var w={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`},T=class e extends Error{code;constructor(e,t){super(e),this.name=`VirtualdisplayError`,this.code=t}static valueNotFound(t,n){return new e(`Value "${n}" not found for attribute "${t}"`,w.VALUE_NOT_FOUND)}static parentNotFound(t){return new e(`Parent element not found: ${t}`,w.PARENT_NOT_FOUND)}static invalidParameter(t){return new e(t,w.INVALID_PARAMETER)}},Ie=class{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,e.labels)}select(e){if(!this.values.has(e))throw T.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(let e of this.values.values())if(e.isSelected)return e.value}onChange(e){this.onChangeCallback=e}handleResult(e){let t;for(let n of this.values.values()){let r=n.value===e;n.setSelected(r),r&&(t=n)}t!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(t)}createValues(e,t){let n=new Map;for(let r of e){let e=new de(r,this.name,Pe(r,t));r===this.defaultValue&&e.setSelected(!0),n.set(r,e)}return n}},Le=class{attributes=new Map;constructor(e,t,n){for(let n of e){let e=this.buildOptions(n,t);this.attributes.set(n.name,new Ie(e))}this.onMutationFailed=n}onMutationFailed;get(e){return this.attributes.get(e)}getSelection(){let e={};for(let[t,n]of this.attributes){let r=n.selected;r!==void 0&&(e[t]=r)}return e}handleResults(e){for(let t of e)t.success?this.get(t.name)?.handleResult(t.value):this.onMutationFailed?.(t.name,t.value)}buildOptions(e,t){let n={name:e.name,values:e.values,...e.labels!==void 0&&{labels:e.labels},onSelect:(e,n)=>{t([{name:e,value:n}],!1)}};return e.defaultValue===void 0?n:{...n,defaultValue:e.defaultValue}}},E=4096,D=16384,Re=[1024,256,64],ze=20,O=[`timestamp`,`level`,`msg`,`service`,`trace_id`,`span_id`];function Be(e){let t=new Date(e.timestamp).toLocaleTimeString(`en-GB`,{hour12:!1}),n=e.level.toUpperCase().padEnd(5),r=e.trace_id?.slice(0,8)??`--------`,i=e.msg,a=Object.entries(e).filter(([e])=>!O.includes(e)).map(([e,t])=>`${e}=${k(t,E).line}`).join(` `);return`${t} ${n} [${r}] ${i}${a?` `+a:``}`}function Ve(e){for(let t of[E,...Re]){let{line:n,truncated:r}=k(e,t);if(!r){if(n.length<=D)return n;continue}let{line:i}=k({...e,log_truncated:!0},t);if(i.length<=D)return i}let t=Object.keys(e).filter(e=>!O.includes(e)),n={...Ue(e,O),log_truncated:!0,log_dropped_count:t.length},r=k({...n,log_dropped_attrs:t.slice(0,ze)},E);return r.line.length<=D?r.line:k(n,E).line}function k(e,t){let n=[],r=!1;return{line:JSON.stringify(e,function(e,i){if(typeof i==`string`)return i.length>t&&(r=!0),He(i,t);if(typeof i==`bigint`)return i.toString();if(typeof i!=`object`||!i)return i;for(;n.length>0&&n.at(-1)!==this;)n.pop();return n.includes(i)?`[Circular]`:(n.push(i),i)}),truncated:r}}function He(e,t){return e.length<=t?e:`${e.slice(0,t)}...[truncated ${e.length-t} chars]`}function Ue(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function We(e,t){let n=t?Be(e):Ve(e);e.level===`error`?console.error(n):e.level===`warn`?console.warn(n):console.log(n)}function Ge(e,t=0){let n={name:e.name,message:e.message};return e.stack!==void 0&&(n.stack=e.stack),qe(e,n),e.cause!==void 0&&e.cause!==null&&(n.cause=e.cause instanceof Error&&t<5?Ge(e.cause,t+1):String(e.cause)),n}var Ke=new Set([`name`,`message`,`stack`,`cause`]);function qe(e,t){for(let n of Object.getOwnPropertyNames(e)){if(Ke.has(n))continue;let r=e[n];r!==void 0&&(t[n]=r)}}function Je(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r instanceof Error?Ge(r):r;return t}function Ye(){return new Date}function Xe(){return typeof navigator>`u`?``:navigator.userAgent}function Ze(){return typeof navigator>`u`?!1:navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1}function Qe(){return/iPhone|iPad|iPod/i.test(Xe())||Ze()}function $e(){return/Android/i.test(Xe())}function et(){return Qe()||$e()}var tt=class{config;constructor(e){this.config=e}log(e,t,n={}){let r=this.config.traceProvider?.()??{};We({timestamp:Ye().toISOString(),level:e,msg:t,service:this.config.service,...r,...Je(n)},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 nt(e,t){return new tt({service:e,isDev:t?.isDev===void 0?typeof process<`u`?process.env.NODE_ENV!==`production`:!0:t.isDev,traceProvider:t?.traceProvider})}function A(e){if(e!==void 0)return typeof e==`object`&&e&&!Array.isArray(e)&&!(e instanceof Error)?e:e instanceof Error?{error:e.message}:{value:e}}function rt(e){return{debug:(t,n)=>e.debug(t,A(n)),info:(t,n)=>e.info(t,A(n)),warn:(t,n)=>e.warn(t,A(n)),error:(t,n)=>e.error(t,A(n))}}var it=!1,j=rt(nt(`client`,{isDev:!1}));function at(){it=!0,j=rt(nt(`client`,{isDev:!0}))}function ot(){return it}var st=class{send;instance;onMutationFailed;registry;pendingCallbacks=[];constructor(e,t,n){this.send=e,this.instance=t,this.onMutationFailed=n}handleMappingReceived(e){j.debug(`Initializing from server mapping`,{attributeCount:e.attributes.length}),this.registry=new Le(e.attributes,(e,t)=>this.sendMutation(e,t),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(e){this.registry?.handleResults(e.results)}select(e,t){this.sendMutation([{name:e,value:t}],!1)}selectTransient(e,t){this.sendMutation([{name:e,value:t}],!1,!0)}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}let n=this.registry.get(e);n===void 0?j.warn(`onChange: attribute "${e}" not found — callback will not fire`):n.onChange(t)}getAttribute(e){return this.registry?.get(e)}getSelection(){return this.registry?.getSelection()??{}}sendMutation(e,n,r=!1){let i={type:t.MUTATION,instance:this.instance,mutations:e,isInitial:n,...r&&{transient:!0}};this.send(i)}replayPendingCallbacks(){for(let{name:e,callback:t}of this.pendingCallbacks){let n=this.registry?.get(e);n===void 0&&j.warn(`onChange: attribute "${e}" not found — buffered callback will not fire`),n?.onChange(t)}this.pendingCallbacks.length=0}},ct=class{snapshot;callbacks=[];handleSnapshot(e){this.snapshot=e.attributes;for(let 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(t=>t.name===e)?.selectable??null}get current(){return this.snapshot??[]}},lt=class{send;commands=[];constructor(e){this.send=e}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 T.invalidParameter(`No camera commands to execute. Call rotate(), tilt(), or zoom() before set().`);let e={type:t.CAMERA,commands:this.commands};this.send(e),this.commands=[]}validateFiniteNumber(e,t){if(!Number.isFinite(e))throw T.invalidParameter(`${t}() requires a finite number, got ${String(e)}`)}reset(){let e={type:t.CAMERA,commands:[{action:`reset`}]};this.send(e)}},ut=class{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;let t={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(let e of this.changeCallbacks)e(t)}handlePositionUpdate(e){this.update(e.transforms)}update(e){let t=!1;for(let n of e)switch(n.type){case`rotation`:this.state.rotation=n.value,t=!0;break;case`tilt`:this.state.tilt=n.value,t=!0;break;case`zoom`:this.state.zoom=n.value,t=!0}if(t){let e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(let t of this.changeCallbacks)t(e)}}};function dt(e,t){let n=e.filter(e=>ft(e,t));if(n.length===0)return;let r=Math.max(...n.map(pt)),i=n.filter(e=>pt(e)===r);return i.length===1?i[0]:void 0}function ft(e,t){return Object.entries(e.attributes).every(([e,n])=>t[e]===n)}function pt(e){return Object.keys(e.attributes).length}var mt=class{dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;constructor(e,t){this.dispatchChange=e,this.dispatchSubmit=t}get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){let 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||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),()=>{let t=this.renderCallbacks.indexOf(e);t!==-1&&this.renderCallbacks.splice(t,1)}}async submit(){if(!this.submittable)return;let e=this.resolved===void 0?{attributes:{...this.selection},reference:``}:{attributes:this.resolved.attributes,reference:this.resolved.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(let e of this.changeCallbacks)e(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(let e of this.renderCallbacks)e()}resolve(){if(this.pricing===void 0)return;let e=dt(this.pricing.rules,this.selection);if(e!==void 0&&e.availability!==a.HIDDEN)return{attributes:{...this.selection},reference:e.reference,price:e.priceCents,currency:this.pricing.currency,availability:e.availability}}},ht=class{send;dispatch;instance;focused=null;attributes=[];changeCallbacks=[];constructor(e,t,n){this.send=e,this.dispatch=t,this.instance=n}get current(){return this.focused}set(e){if(typeof e!=`string`||e.length===0)throw T.invalidParameter(`set() requires a non-empty component name, got ${String(e)}`);this.send({type:t.FOCUS,instance:this.instance,action:r.FOCUS,component:e})}clear(){this.send({type:t.FOCUS,instance:this.instance,action:r.UNFOCUS})}onChange(e){this.changeCallbacks.push(e)}handleStateReceived(e){e.state===i.FOCUSED&&e.component!==void 0?(this.focused=e.component,this.attributes=e.attributes??[]):(this.focused=null,this.attributes=[]);let t=this.focused===null?null:{component:this.focused,attributes:this.attributes};for(let e of this.changeCallbacks)e(t);this.dispatch(t)}},gt=class{filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;constructor(e){this.filename=e}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(e=>{e(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())}},_t=3e4,vt=class{send;validExtensions=[`.png`];pendingPhotos=new Map;constructor(e){this.send=e}take(e){return this.request(e,void 0)}takeOf(e,t){return this.request(e,t)}request(e,n){this.validateFilename(e),j.debug(`Taking snapshot`,{filename:e});let r=new gt(e),i=setTimeout(()=>{this.pendingPhotos.delete(e),j.warn(`Snapshot timed out`,{filename:e}),r.fail(new T(`Snapshot timed out: the viewer did not respond within ${_t}ms`,w.SNAPSHOT_FAILED))},_t);return this.pendingPhotos.set(e,{photo:r,timeout:i}),this.send({type:t.SNAPSHOT,filename:e,...n!==void 0&&{subject:n}}),r}handleSnapshotResult(e){let t=this.pendingPhotos.get(e.filename);if(t===void 0){j.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);let{photo:n}=t;e.error===void 0?e.data!==void 0&&n.develop({filename:e.filename,data:e.data}):n.fail(new T(e.error,w.SNAPSHOT_FAILED))}clear(){if(this.pendingPhotos.size===0)return;let e=new T(`Client destroyed before snapshot completed`,w.SNAPSHOT_FAILED);for(let{photo:t,timeout:n}of this.pendingPhotos.values())clearTimeout(n),t.fail(e);this.pendingPhotos.clear()}validateFilename(e){if(e===``||typeof e!=`string`)throw new T(`Filename must be a non-empty string`,w.INVALID_PARAMETER);if(!this.validExtensions.some(t=>e.toLowerCase().endsWith(t)))throw new T(`Invalid filename: "${e}". Filename must end with one of: ${this.validExtensions.join(`, `)}`,w.INVALID_PARAMETER);if(e.includes(`..`)||e.includes(`/`)||e.includes(`\\`))throw new T(`Filename cannot contain path separators or ".."`,w.INVALID_PARAMETER)}},yt=class{container=null;attach(e){this.container=e}dispatch(e,t,n=!1){let r=new CustomEvent(e,{detail:t,cancelable:n});return this.container?.dispatchEvent(r),r}on(e,t){let n=e=>{let n=e;t({...n.detail,preventDefault:()=>{n.preventDefault()}})};return this.container?.addEventListener(e,n),()=>{this.container?.removeEventListener(e,n)}}},bt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Bezig…`:n===`de`?`Läuft…`:`Working…`}),xt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Mislukt`:n===`de`?`Fehlgeschlagen`:`Failed`}),St=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Gelukt`:n===`de`?`Fertig`:`Done`}),Ct=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Annotaties`:n===`de`?`Anmerkungen`:`Annotations`}),wt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`AR activeren`:n===`de`?`AR aktivieren`:`Activate AR`}),Tt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Camera resetten`:n===`de`?`Kamera zurücksetzen`:`Reset camera`}),Et=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Naar links draaien`:n===`de`?`Nach links drehen`:`Rotate left`}),Dt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Naar rechts draaien`:n===`de`?`Nach rechts drehen`:`Rotate right`}),Ot=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Omlaag kantelen`:n===`de`?`Nach unten kippen`:`Tilt down`}),kt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Omhoog kantelen`:n===`de`?`Nach oben kippen`:`Tilt up`}),At=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Inzoomen`:n===`de`?`Hineinzoomen`:`Zoom in`}),jt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Uitzoomen`:n===`de`?`Herauszoomen`:`Zoom out`}),Mt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Sluiten`:n===`de`?`Schließen`:`Close`}),Nt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Configureren`:n===`de`?`Konfigurieren`:`Configure`}),Pt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Volledig scherm`:n===`de`?`Vollbild`:`Fullscreen`}),Ft=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Sluiten`:n===`de`?`Schließen`:`Close`}),It=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`QR-code`:n===`de`?`QR-Code`:`QR code`}),Lt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Gebruik de camera van je smartphone om deze QR-code te scannen`:n===`de`?`Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen`:`Use your smartphone camera to scan this QR code`}),Rt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Je telefoon opent het 3D-model in AR-modus.`:n===`de`?`Dein Telefon öffnet das 3D-Modell im AR-Modus.`:`Your phone will open the 3D model in AR mode.`}),zt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Scan om in AR te bekijken`:n===`de`?`Scannen für AR-Ansicht`:`Scan to view in AR`}),Bt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`We kunnen de QR-code nu niet tonen. Open deze link op je telefoon:`:n===`de`?`Wir können den QR-Code gerade nicht anzeigen. Öffne diesen Link auf deinem Handy:`:`We can't show the QR code right now. Open this link on your phone:`}),Vt=((e={},t={})=>(t.locale??y(),`Screenshot`)),Ht=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Downloaden`:n===`de`?`Herunterladen`:`Downloading`}),Ut=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Laden mislukt. Ververs de pagina om het opnieuw te proberen.`:n===`de`?`Laden fehlgeschlagen. Lade die Seite neu, um es erneut zu versuchen.`:`Load failed. Refresh the page to try again.`}),Wt={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`},Gt=([e,t,n])=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(t).forEach(e=>{r.setAttribute(e,String(t[e]))}),n?.length&&n.forEach(e=>{let t=Gt(e);r.appendChild(t)}),r},Kt=(e,t={})=>Gt([`svg`,{...Wt,...t},e]),qt=[[`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`}]],Jt=[[`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`}]],M=[[`path`,{d:`m6 9 6 6 6-6`}]],Yt=[[`path`,{d:`m15 18-6-6 6-6`}]],Xt=[[`path`,{d:`m9 18 6-6-6-6`}]],Zt=[[`path`,{d:`m18 15-6-6-6 6`}]],Qt=[[`path`,{d:`M12.75 7.09a3 3 0 0 1 2.16 2.16`}],[`path`,{d:`M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568`}],[`path`,{d:`m2 2 20 20`}],[`path`,{d:`M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533`}],[`path`,{d:`M9.13 9.13a3 3 0 0 0 3.74 3.74`}]],$t=[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`}],[`circle`,{cx:`12`,cy:`10`,r:`3`}]],en=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],tn=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],nn=[[`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`}]],rn=[[`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`}]],an=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]],on=[[`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`}]],sn=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]];function N(e,{size:t=20,strokeWidth:n=1.75}={}){return Kt(e,{width:t,height:t,"stroke-width":n})}var P={ar:e=>N(qt,e),annotations:e=>N($t,e),annotationsOff:e=>N(Qt,e),fullscreen:e=>N(en,e),exitFullscreen:e=>N(tn,e),screenshot:e=>N(Jt,e),tiltUp:e=>N(Zt,e),tiltDown:e=>N(M,e),rotateLeft:e=>N(Yt,e),rotateRight:e=>N(Xt,e),zoomIn:e=>N(on,e),zoomOut:e=>N(sn,e),reset:e=>N(nn,e),configurator:e=>N(rn,e),close:e=>N(an,e),expand:e=>N(M,e)},F=class{element;constructor({variant:e=`default`,size:t=`default`,label:n,icon:r,onClick:i,disabled:a=!1}={}){this.element=document.createElement(`button`),this.element.className=`ui-btn ui-btn--${e} ui-btn--size-${t}`,n!==void 0&&(this.element.setAttribute(`aria-label`,n),this.element.title=n),r===void 0?n!==void 0&&(this.element.textContent=n):this.element.appendChild(r),i&&this.element.addEventListener(`click`,i),this.element.disabled=a}setIcon(e){let t=this.element.querySelector(`svg`);t===null?this.element.appendChild(e):t.replaceWith(e)}};function cn(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function ln(e,t,n,r,i,a){let[o,s,c]=e,l=Math.cos(t),u=Math.sin(t),ee=l*o+u*c,d=-u*o+l*c,f=Math.cos(n),p=Math.sin(n),te=f*s-p*d,ne=p*s+f*d,m=.55;return[r+ee*a*m,i-te*a*m,ne]}function un(e,t,n){e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(n[0],n[1]),e.lineWidth=2,e.stroke()}function dn(e,t,n,r,i){let a=t(n),o=t(r);un(e,a,[a[0]+(o[0]-a[0])*i,a[1]+(o[1]-a[1])*i,a[2]])}var I=[-1,-1,1],L=[1,-1,1],R=[1,-1,-1],z=[-1,-1,-1],B=[-1,1,1],V=[1,1,1],H=[1,1,-1],U=[-1,1,-1],W=[[I,L],[L,R],[R,z],[z,I],[I,B],[L,V],[R,H],[z,U],[B,V],[V,H],[H,U],[U,B]];function fn(e){let t=e%6/6,n=W.length;return t<.35?cn(t/.35)*n:t<.55?n:t<.9?(1-cn((t-.55)/.35))*n:0}function pn(e,{width:t,height:n},r,i=`#000`){let a=t/2,o=n*.44,s=Math.min(t,n)*.08,c=e=>ln(e,.785,.615,a,o,s),l=fn(r);e.shadowBlur=5,e.shadowColor=`rgba(30,30,30,0.08)`,e.strokeStyle=i;for(let t=0;t<W.length&&!(t>=l);t++){let n=W[t];if(n===void 0)continue;let r=Math.min(1,l-t);dn(e,c,n[0],n[1],r)}e.shadowBlur=0}var mn=400,hn=3e4,gn=`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`;function _n(e){let t=getComputedStyle(e).color,n=t===``?`#000`:t;return{surface:`transparent`,ink:n,danger:n}}function vn(e,t){let n=document.createElement(`div`);Object.assign(n.style,{position:`absolute`,inset:`0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:e.surface,zIndex:`20`,opacity:`0`,transition:`opacity 0.3s ease-in-out`});let r=document.createElement(`canvas`);Object.assign(r.style,{width:`100%`,height:`100%`,position:`absolute`,inset:`0`});let i=document.createElement(`div`);i.setAttribute(`role`,`status`),Object.assign(i.style,{position:`absolute`,top:`56%`,left:`0`,right:`0`,textAlign:`center`,pointerEvents:`none`});let a=document.createElement(`span`);Object.assign(a.style,{fontSize:`13px`,fontWeight:`400`,color:e.ink,fontVariantNumeric:`tabular-nums`,fontFamily:gn});let o=document.createElement(`span`);return Object.assign(o.style,{fontSize:`13px`,color:e.ink,fontFamily:gn}),o.textContent=t,i.appendChild(a),i.appendChild(o),n.appendChild(r),n.appendChild(i),{overlay:n,canvas:r,pctEl:a,phaseEl:o}}var yn=class{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;noSignalTimerId=null;startTime;hidden=!1;visible=!1;errored=!1;noSignalErrored=!1;colours;text;constructor(e,t){this.startTime=performance.now(),this.colours=t.colours??_n(e),this.text=t.text;let n=vn(this.colours,this.text.downloading());this.overlay=n.overlay,t.className!==void 0&&(this.overlay.className=t.className),this.canvas=n.canvas,this.pctEl=n.pctEl,this.phaseEl=n.phaseEl,e.appendChild(this.overlay),this.ctx=this.canvas.getContext(`2d`),this.ctx!==null&&(this.sizeCanvas(),this.tick()),this.showTimerId=setTimeout(()=>{this.reveal()},mn),this.noSignalTimerId=setTimeout(()=>{this.hidden||(this.noSignalErrored=!0,this.showError(this.text.loadError()))},hn)}viewerAlive(){this.cancelNoSignalTimer(),this.noSignalErrored&&this.recoverFromNoSignal()}recoverFromNoSignal(){this.noSignalErrored=!1,this.errored=!1,this.pctEl.textContent=``,this.phaseEl.textContent=this.text.downloading(),this.phaseEl.style.color=this.colours.ink,this.ctx!==null&&this.animationId===null&&!this.hidden&&this.tick()}recolour(e){this.colours=e,this.overlay.style.background=e.surface,this.pctEl.style.color=e.ink,this.phaseEl.style.color=this.errored?e.danger:e.ink,this.errored&&this.clearCanvas()}updateProgress(e,t){this.cancelNoSignalTimer(),this.hidden||this.errored||(this.pctEl.textContent=`${Math.round(e)}%`,this.phaseEl.textContent=t===``?``:` \u00B7 ${t}`)}showError(e){this.cancelNoSignalTimer(),this.hidden=!1,this.errored=!0,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.clearCanvas(),this.pctEl.textContent=``,this.phaseEl.textContent=e,this.phaseEl.style.color=this.colours.danger,this.reveal()}hide(){this.hidden||(this.hidden=!0,this.cancelShowTimer(),this.visible?(this.overlay.style.opacity=`0`,this.overlay.addEventListener(`transitionend`,()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)):this.destroy())}destroy(){this.cancelShowTimer(),this.cancelNoSignalTimer(),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`)}clearCanvas(){if(this.ctx===null)return;let e=Math.min(devicePixelRatio,2),t=this.canvas.width/e,n=this.canvas.height/e;this.ctx.clearRect(0,0,t,n)}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}cancelNoSignalTimer(){this.noSignalTimerId!==null&&(clearTimeout(this.noSignalTimerId),this.noSignalTimerId=null)}sizeCanvas(){if(this.ctx===null)return;let e=Math.min(devicePixelRatio,2),t=this.overlay.clientWidth||440,n=this.overlay.clientHeight||360;this.canvas.width=t*e,this.canvas.height=n*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;let e=this.canvas.width/Math.min(devicePixelRatio,2),t=this.canvas.height/Math.min(devicePixelRatio,2),n=(performance.now()-this.startTime)/1e3;this.ctx.clearRect(0,0,e,t),pn(this.ctx,{width:e,height:t},n,this.colours.ink)}},bn=class{element;selectCallback=null;constructor(e,t,n){this.element=document.createElement(`div`),this.element.className=`ui-toggle-group`;for(let r=0;r<e.length;r++){let i=e[r],a=document.createElement(`button`);a.className=`ui-toggle-group-item`,a.dataset.value=i,a.textContent=n?.[r]??i,a.dataset.state=i===t?`on`:`off`,a.setAttribute(`aria-pressed`,i===t?`true`:`false`),a.addEventListener(`click`,()=>{this.selectCallback?.(i)}),this.element.appendChild(a)}}setSelected(e){for(let t of this.element.querySelectorAll(`.ui-toggle-group-item`)){let n=t.dataset.value===e;t.dataset.state=n?`on`:`off`,t.setAttribute(`aria-pressed`,n?`true`:`false`)}}onSelect(e){this.selectCallback=e}setEnabled(e){for(let t of this.element.querySelectorAll(`.ui-toggle-group-item`)){let n=e===null||e.includes(t.dataset.value??``);t.disabled=!n,t.setAttribute(`aria-disabled`,n?`false`:`true`)}}},xn=class{element;select;constructor(e,t,n,r,i){this.select=document.createElement(`select`),this.select.className=`ui-native-select`,this.select.dataset.name=e,this.select.setAttribute(`aria-label`,n);let a=document.createElement(`option`);a.value=``,a.disabled=!0,a.textContent=n,this.select.appendChild(a);let o=!1;for(let e=0;e<t.length;e++){let n=t[e],a=document.createElement(`option`);a.value=n,a.textContent=i?.[e]??n,n===r&&(a.selected=!0,o=!0),this.select.appendChild(a)}o||(a.selected=!0);let s=Kt(M,{width:16,height:16,"stroke-width":2});s.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(s)}setSelected(e){this.select.value=e}onSelect(e){this.select.addEventListener(`change`,()=>{e(this.select.value)})}setEnabled(e){for(let t of this.select.options)t.value!==``&&(t.disabled=e!==null&&!e.includes(t.value))}},Sn=class{element;input;valueText;values;options;selectCallback=null;settleCallback=null;constructor(e,t){if(e.length===0)throw Error(`Virtualdisplay: Slider needs at least one value`);this.values=e,this.options=t,this.input=document.createElement(`input`),this.input.type=`range`,this.input.className=`ui-slider-input`,this.input.min=`0`,this.input.max=String(e.length-1),this.input.step=`1`,this.input.setAttribute(`aria-label`,t.label),this.valueText=document.createElement(`span`),this.valueText.className=`ui-slider-value`,this.valueText.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`div`);n.className=`ui-slider-track`,n.appendChild(this.input),n.appendChild(this.buildEnds()),this.element=document.createElement(`div`),this.element.className=`ui-slider`,this.element.appendChild(n),this.element.appendChild(this.valueText);let r=t.initialSelected===void 0?0:e.indexOf(t.initialSelected);this.applyIndex(r===-1?0:r),this.listen()}setSelected(e){let t=this.values.indexOf(e);t!==-1&&this.applyIndex(t)}onSelect(e){this.selectCallback=e}onSettle(e){this.settleCallback=e}listen(){this.input.addEventListener(`input`,()=>{let e=this.values[this.currentIndex];e!==void 0&&(this.applyIndex(this.currentIndex),this.selectCallback?.(e))}),this.input.addEventListener(`change`,()=>{let e=this.values[this.currentIndex];e!==void 0&&this.settleCallback?.(e)})}get currentIndex(){return Number(this.input.value)}applyIndex(e){this.input.value=String(e);let t=this.displayAt(e);this.valueText.textContent=t,this.input.setAttribute(`aria-valuetext`,t);let n=this.values.length===1?100:e/(this.values.length-1)*100;this.element.style.setProperty(`--ui-slider-pct`,`${n}%`)}buildEnds(){let e=document.createElement(`div`);e.className=`ui-slider-ends`,e.setAttribute(`aria-hidden`,`true`);for(let t of[0,this.values.length-1]){let n=document.createElement(`span`);n.textContent=this.labelAt(t),e.appendChild(n)}return e}labelAt(e){return this.options.labels?.[e]??this.values[e]??``}displayAt(e){let t=this.labelAt(e);return this.options.unit===void 0?t:`${t} ${this.options.unit}`}},G={neutral:{50:`oklch(98.5% 0 0)`,100:`oklch(96.5% 0 0)`,200:`oklch(92% 0 0)`,300:`oklch(82% 0 0)`,400:`oklch(70% 0 0)`,500:`oklch(55.5% 0 0)`,600:`oklch(44.5% 0 0)`,700:`oklch(37% 0 0)`,800:`oklch(27% 0 0)`,900:`oklch(21% 0 0)`,950:`oklch(14.5% 0 0)`},white:`oklch(100% 0 0)`,semantic:{error:`oklch(47% 0.17 25)`}},K={px:`1px`,0:`0`,.5:`0.125rem`,1:`0.25rem`,1.5:`0.375rem`,2:`0.5rem`,2.5:`0.625rem`,3:`0.75rem`,3.5:`0.875rem`,4:`1rem`,5:`1.25rem`,6:`1.5rem`,7:`1.75rem`,8:`2rem`,9:`2.25rem`,10:`2.5rem`,12:`3rem`,14:`3.5rem`,16:`4rem`,20:`5rem`,24:`6rem`},q={fontFamily:{sans:[`Mona Sans`,`ui-sans-serif`,`system-ui`,`sans-serif`,`Apple Color Emoji`,`Segoe UI Emoji`,`Segoe UI Symbol`,`Noto Color Emoji`],mono:[`JetBrains Mono`,`ui-monospace`,`monospace`]},fontSize:{xs:`0.75rem`,sm:`0.875rem`,base:`1rem`,lg:`1.125rem`,xl:`1.25rem`,"2xl":`1.5rem`,"3xl":`1.875rem`,"4xl":`2.25rem`},fontWeight:{normal:`400`,medium:`500`,semibold:`600`,bold:`700`},lineHeight:{tight:`1.25`,normal:`1.5`,relaxed:`1.75`}},Cn=class{element;constructor(){this.element=document.createElement(`div`),Object.assign(this.element.style,{background:G.white,borderRadius:`var(--radius)`,padding:K[6],boxShadow:`0 ${K[2]} ${K[8]} oklch(0% 0 0 / 20%)`,maxWidth:`20rem`,width:`100%`})}},wn=class{options;card;backdrop;keyHandler=null;constructor(e={}){this.options=e,this.card=new Cn,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}get content(){return this.card.element}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(){let e=document.createElement(`div`);return Object.assign(e.style,{position:`fixed`,inset:K[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}},J=q.fontFamily.sans.join(`, `),Tn=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-5iZMYShA.cjs");var t={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`,APP_RESOLVED:`app_resolved`,PERSONALISE:`personalise`,PERSONALISED:`personalised`,ZONES:`zones`,PLACE:`place`},n=`main`,r={FOCUS:`focus`,UNFOCUS:`unfocus`},i={FOCUSED:`focused`,UNFOCUSED:`unfocused`},a={AVAILABLE:`available`,VIEW_ONLY:`view_only`,HIDDEN:`hidden`};function o(e){return typeof e!=`object`||!e?null:e}var s=new Set(Object.values(t));function c(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.target!=`string`&&typeof t.type==`string`&&s.has(t.type)}function l(e){let n=o(e);return n!==null&&n.type===t.HANDSHAKE}function u(e){let n=o(e);return n!==null&&n.type===t.SESSION&&typeof n.sessionId==`string`}function ee(e){let n=o(e);return n!==null&&n.type===t.APP_RESOLVED&&typeof n.appType==`string`&&n.appType!==``&&typeof n.name==`string`}function d(e){let n=o(e);return n!==null&&n.type===t.PERSONALISED&&typeof n.id==`string`&&n.id!==``&&typeof n.instance==`string`&&n.instance!==``&&typeof n.zone==`string`&&typeof n.ok==`boolean`&&(n.error===void 0||typeof n.error==`string`)}function f(e){return typeof e==`number`&&Number.isFinite(e)}function p(e){let t=o(e);return t!==null&&typeof t.name==`string`&&t.name!==``&&f(t.aspect)&&f(t.widthMm)&&f(t.heightMm)}function te(e){let n=o(e);return n!==null&&n.type===t.ZONES&&typeof n.instance==`string`&&n.instance!==``&&Array.isArray(n.zones)&&n.zones.every(p)}function ne(e){let n=o(e);return n!==null&&n.type===t.MUTATION&&typeof n.instance==`string`&&n.instance!==``&&Array.isArray(n.results)}function m(e){let n=o(e);return n!==null&&n.type===t.SNAPSHOT&&(`data`in n||`error`in n)}function re(e){let n=o(e);return n!==null&&n.type===t.CAMERA&&Array.isArray(n.transforms)}function ie(e){let n=o(e);return n!==null&&n.type===t.MAPPING&&typeof n.instance==`string`&&n.instance!==``&&Array.isArray(n.attributes)}function ae(e){let n=o(e);return n!==null&&n.type===t.LOADING_INDICATOR&&typeof n.progress==`number`}function oe(e){let n=o(e);return n!==null&&n.type===t.SYNC&&typeof n.connected==`boolean`}function se(e){let n=o(e);return n!==null&&n.type===t.SELECTABLE&&typeof n.instance==`string`&&n.instance!==``&&Array.isArray(n.attributes)}function ce(e){let n=o(e);return n!==null&&n.type===t.CONFIG&&typeof n.viewerSettings==`object`}function le(e){let n=o(e);return n!==null&&n.type===t.FOCUS&&typeof n.instance==`string`&&n.instance!==``&&typeof n.state==`string`}function ue(e){let n=o(e);return n!==null&&n.type===t.PRICING&&typeof n.instance==`string`&&n.instance!==``&&typeof n.pricing==`object`&&n.pricing!==null}var de=class{processor;pending=[];isReady=!1;constructor(e){this.processor=e}enqueue(e){this.isReady?this.processor(e):this.pending.push(e)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;let e=[...this.pending];this.pending.length=0;for(let t of e)this.processor(t)}hasPending(e){return this.pending.some(t=>t.type===e)}clear(){this.pending.length=0}},fe=class{getTarget;handlers=new Map;publisher;consumer;listener=null;sourceId;targetOrigin;isValid;onHandlerError;constructor(e,t){this.getTarget=e,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=`*`,this.isValid=t?.isValid??c,this.onHandlerError=t?.onHandlerError??pe,this.publisher=new de(e=>this.post(e)),this.consumer=new de(e=>this.routeToHandler(e)),t?.bufferIncoming!==!0&&this.consumer.markReady()}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=>{let{data:t}=e;if(!this.isValid(t)||t._source===this.sourceId)return;let n=this.getTarget();if(n!==null&&e.source!==null&&e.source!==n)return;let r=t;this.consumer.enqueue(r)},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()}post(e){let t=this.getTarget();t!==null&&t.postMessage({...e,_source:this.sourceId},this.targetOrigin)}routeToHandler(e){let t=this.handlers.get(e.type);if(t===void 0)return;let n;try{n=t(e)}catch(t){this.onHandlerError(e,t);return}n instanceof Promise&&n.catch(t=>{this.onHandlerError(e,t)})}};function pe(e,t){let n=t instanceof Error?t.message:String(t);console.error(`Virtualdisplay: error handling ${e.type}: ${n}`)}t.CAMERA,t.LOADING_INDICATOR;var me=class{send;instance;constructor(e,t){this.send=e,this.instance=t}setEnabled(e){this.send({type:t.ANNOTATION_TOGGLE,instance:this.instance,enabled:e})}},he=class{value;attribute;label;isSelectedValue=!1;constructor(e,t,n){this.value=e,this.attribute=t,this.label=n}get isSelected(){return this.isSelectedValue}setSelected(e){this.isSelectedValue=e}},ge={},_e=[`en`,`nl`,`de`],h=[`globalVariable`,`baseLocale`],g=[],_=typeof window>`u`;globalThis.__paraglide=globalThis.__paraglide??{};var v,ve=!1,y=()=>{let e=!_&&g.length>0&&typeof window<`u`?window.location?.href:void 0,t=ye(e?Ie(e):h,e);if(t)return ve||(v=t,ve=!0,xe(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found`)};function ye(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(t===`globalVariable`&&v!==void 0)n=v;else if(Le(t)&&S.has(t)){let e=S.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return Te(t)}}let e=b(n);if(e)return e}}var be=e=>{e?window.location.href=e:window.location.reload()},xe=(e,t)=>{let n={reload:!0,...t},r;try{r=y()}catch{}let i=[],a=h;!_&&typeof window<`u`&&window.location?.href&&(a=Ie(window.location.href));for(let t of a)if(t===`globalVariable`)v=e;else if(t===`baseLocale`)continue;else if(Le(t)&&S.has(t)){let n=S.get(t);if(n){let r=n.setLocale(e);r instanceof Promise&&(r=r.catch(e=>{throw Error(`Custom strategy "${t}" setLocale failed.`,{cause:e})}),i.push(r))}}let o=()=>{!_&&n.reload&&window.location&&e!==r&&be(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()},Se=()=>typeof window<`u`?window.location.origin:`http://fallback.com`,Ce;function b(e){if(typeof e==`string`)return Ce??=we(),Ce.get(e.toLowerCase())}function we(){let e=new Map;for(let t of _e){let n=t.toLowerCase();e.has(n)||e.set(n,t)}return e}function Te(e){let t=b(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${_e.join(`, `)}`)}function x(e){return e}function Ee(e,t){return new ge(e,t.href)}function De(){return 0}function Oe(e){return g}function ke(e,t){return e.exec(t.href)}function Ae(e){return je(e)}function je(e){let t=x(typeof e==`string`?new URL(e,Se()):new URL(e.href)),n=t.pathname.replace(/^\/+/,``).split(`/`);return n.length>0&&b(n[0])&&(t.pathname=`/`+n.slice(1).join(`/`)),x(t)}var Me=-1,Ne,Pe;function Fe(e){if(g.length===0)return;let t=typeof e==`string`?e:e.href,n=De();if(Ne===t&&Me===n)return Pe;let r=x(new URL(t,`http://example.com`)),i=Ae(r),a=i.href===r.href?[r]:[r,i],o;for(let e of a){for(let t of Oe(e))if(ke(Ee(t.match,e),e)){o=t;break}if(o)break}return Me=n,Ne=t,Pe=o,o}function Ie(e){let t=Fe(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:h}var S=new Map;function Le(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}function Re(e,t){return ze(t!==void 0&&Object.hasOwn(t,e)?t[e]:void 0)??C(e)}function ze(e){if(e===void 0)return;for(let t of[y(),`nl`,`en`])if(Object.hasOwn(e,t)&&e[t]!==void 0)return e[t];let[t]=Object.values(e);return t}function C(e){let t=e.replace(/([A-Z])/g,` $1`).trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}var w={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`,PERSONALISATION_FAILED:`PERSONALISATION_FAILED`},T=class e extends Error{code;constructor(e,t){super(e),this.name=`VirtualdisplayError`,this.code=t}static valueNotFound(t,n){return new e(`Value "${n}" not found for attribute "${t}"`,w.VALUE_NOT_FOUND)}static parentNotFound(t){return new e(`Parent element not found: ${t}`,w.PARENT_NOT_FOUND)}static invalidParameter(t){return new e(t,w.INVALID_PARAMETER)}},Be=class{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,e.labels)}select(e){if(!this.values.has(e))throw T.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(let e of this.values.values())if(e.isSelected)return e.value}onChange(e){this.onChangeCallback=e}handleResult(e){let t;for(let n of this.values.values()){let r=n.value===e;n.setSelected(r),r&&(t=n)}t!==void 0&&this.onChangeCallback!==void 0&&this.onChangeCallback(t)}createValues(e,t){let n=new Map;for(let r of e){let e=new he(r,this.name,Re(r,t));r===this.defaultValue&&e.setSelected(!0),n.set(r,e)}return n}},Ve=class{attributes=new Map;constructor(e,t,n){for(let n of e){let e=this.buildOptions(n,t);this.attributes.set(n.name,new Be(e))}this.onMutationFailed=n}onMutationFailed;get(e){return this.attributes.get(e)}getSelection(){let e={};for(let[t,n]of this.attributes){let r=n.selected;r!==void 0&&(e[t]=r)}return e}handleResults(e){for(let t of e)t.success?this.get(t.name)?.handleResult(t.value):this.onMutationFailed?.(t.name,t.value)}buildOptions(e,t){let n={name:e.name,values:e.values,...e.labels!==void 0&&{labels:e.labels},onSelect:(e,n)=>{t([{name:e,value:n}],!1)}};return e.defaultValue===void 0?n:{...n,defaultValue:e.defaultValue}}},E=4096,D=16384,He=[1024,256,64],Ue=20,O=[`timestamp`,`level`,`msg`,`service`,`trace_id`,`span_id`];function We(e){let t=new Date(e.timestamp).toLocaleTimeString(`en-GB`,{hour12:!1}),n=e.level.toUpperCase().padEnd(5),r=e.trace_id?.slice(0,8)??`--------`,i=e.msg,a=Object.entries(e).filter(([e])=>!O.includes(e)).map(([e,t])=>`${e}=${k(t,E).line}`).join(` `);return`${t} ${n} [${r}] ${i}${a?` `+a:``}`}function Ge(e){for(let t of[E,...He]){let{line:n,truncated:r}=k(e,t);if(!r){if(n.length<=D)return n;continue}let{line:i}=k({...e,log_truncated:!0},t);if(i.length<=D)return i}let t=Object.keys(e).filter(e=>!O.includes(e)),n={...qe(e,O),log_truncated:!0,log_dropped_count:t.length},r=k({...n,log_dropped_attrs:t.slice(0,Ue)},E);return r.line.length<=D?r.line:k(n,E).line}function k(e,t){let n=[],r=!1;return{line:JSON.stringify(e,function(e,i){if(typeof i==`string`)return i.length>t&&(r=!0),Ke(i,t);if(typeof i==`bigint`)return i.toString();if(typeof i!=`object`||!i)return i;for(;n.length>0&&n.at(-1)!==this;)n.pop();return n.includes(i)?`[Circular]`:(n.push(i),i)}),truncated:r}}function Ke(e,t){return e.length<=t?e:`${e.slice(0,t)}...[truncated ${e.length-t} chars]`}function qe(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function Je(e,t){let n=t?We(e):Ge(e);e.level===`error`?console.error(n):e.level===`warn`?console.warn(n):console.log(n)}function Ye(e,t=0){let n={name:e.name,message:e.message};return e.stack!==void 0&&(n.stack=e.stack),Ze(e,n),e.cause!==void 0&&e.cause!==null&&(n.cause=e.cause instanceof Error&&t<5?Ye(e.cause,t+1):String(e.cause)),n}var Xe=new Set([`name`,`message`,`stack`,`cause`]);function Ze(e,t){for(let n of Object.getOwnPropertyNames(e)){if(Xe.has(n))continue;let r=e[n];r!==void 0&&(t[n]=r)}}function Qe(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r instanceof Error?Ye(r):r;return t}function $e(){return new Date}function et(){return typeof navigator>`u`?``:navigator.userAgent}function tt(){return typeof navigator>`u`?!1:navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1}function nt(){return/iPhone|iPad|iPod/i.test(et())||tt()}function rt(){return/Android/i.test(et())}function it(){return nt()||rt()}var at=class{config;constructor(e){this.config=e}log(e,t,n={}){let r=this.config.traceProvider?.()??{};Je({timestamp:$e().toISOString(),level:e,msg:t,service:this.config.service,...r,...Qe(n)},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 ot(e,t){return new at({service:e,isDev:t?.isDev===void 0?typeof process<`u`?process.env.NODE_ENV!==`production`:!0:t.isDev,traceProvider:t?.traceProvider})}function A(e){if(e!==void 0)return typeof e==`object`&&e&&!Array.isArray(e)&&!(e instanceof Error)?e:e instanceof Error?{error:e.message}:{value:e}}function st(e){return{debug:(t,n)=>e.debug(t,A(n)),info:(t,n)=>e.info(t,A(n)),warn:(t,n)=>e.warn(t,A(n)),error:(t,n)=>e.error(t,A(n))}}var ct=!1,j=st(ot(`client`,{isDev:!1}));function lt(){ct=!0,j=st(ot(`client`,{isDev:!0}))}function ut(){return ct}var dt=class{send;instance;onMutationFailed;registry;pendingCallbacks=[];constructor(e,t,n){this.send=e,this.instance=t,this.onMutationFailed=n}handleMappingReceived(e){j.debug(`Initializing from server mapping`,{attributeCount:e.attributes.length}),this.registry=new Ve(e.attributes,(e,t)=>this.sendMutation(e,t),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(e){this.registry?.handleResults(e.results)}select(e,t){this.sendMutation([{name:e,value:t}],!1)}selectTransient(e,t){this.sendMutation([{name:e,value:t}],!1,!0)}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}let n=this.registry.get(e);n===void 0?j.warn(`onChange: attribute "${e}" not found — callback will not fire`):n.onChange(t)}getAttribute(e){return this.registry?.get(e)}getSelection(){return this.registry?.getSelection()??{}}sendMutation(e,n,r=!1){let i={type:t.MUTATION,instance:this.instance,mutations:e,isInitial:n,...r&&{transient:!0}};this.send(i)}replayPendingCallbacks(){for(let{name:e,callback:t}of this.pendingCallbacks){let n=this.registry?.get(e);n===void 0&&j.warn(`onChange: attribute "${e}" not found — buffered callback will not fire`),n?.onChange(t)}this.pendingCallbacks.length=0}},ft=class{snapshot;callbacks=[];handleSnapshot(e){this.snapshot=e.attributes;for(let 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(t=>t.name===e)?.selectable??null}get current(){return this.snapshot??[]}},pt=class{send;commands=[];constructor(e){this.send=e}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 T.invalidParameter(`No camera commands to execute. Call rotate(), tilt(), or zoom() before set().`);let e={type:t.CAMERA,commands:this.commands};this.send(e),this.commands=[]}validateFiniteNumber(e,t){if(!Number.isFinite(e))throw T.invalidParameter(`${t}() requires a finite number, got ${String(e)}`)}reset(){let e={type:t.CAMERA,commands:[{action:`reset`}]};this.send(e)}},mt=class{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;let t={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(let e of this.changeCallbacks)e(t)}handlePositionUpdate(e){this.update(e.transforms)}update(e){let t=!1;for(let n of e)switch(n.type){case`rotation`:this.state.rotation=n.value,t=!0;break;case`tilt`:this.state.tilt=n.value,t=!0;break;case`zoom`:this.state.zoom=n.value,t=!0}if(t){let e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(let t of this.changeCallbacks)t(e)}}};function ht(e,t){let n=e.filter(e=>gt(e,t));if(n.length===0)return;let r=Math.max(...n.map(_t)),i=n.filter(e=>_t(e)===r);return i.length===1?i[0]:void 0}function gt(e,t){return Object.entries(e.attributes).every(([e,n])=>t[e]===n)}function _t(e){return Object.keys(e.attributes).length}var vt=class{dispatchChange;dispatchSubmit;pricing;selection={};resolved;changeCallbacks=[];renderCallbacks=[];submitCallback;submitDefaultLabel;constructor(e,t){this.dispatchChange=e,this.dispatchSubmit=t}get current(){return this.resolved}get vatDisplay(){return this.pricing?.vatDisplay}get buttonLabel(){let 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||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),()=>{let t=this.renderCallbacks.indexOf(e);t!==-1&&this.renderCallbacks.splice(t,1)}}async submit(){if(!this.submittable)return;let e=this.resolved===void 0?{attributes:{...this.selection},reference:``}:{attributes:this.resolved.attributes,reference:this.resolved.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(let e of this.changeCallbacks)e(this.resolved);this.dispatchChange(this.resolved),this.notifyRender()}notifyRender(){for(let e of this.renderCallbacks)e()}resolve(){if(this.pricing===void 0)return;let e=ht(this.pricing.rules,this.selection);if(e!==void 0&&e.availability!==a.HIDDEN)return{attributes:{...this.selection},reference:e.reference,price:e.priceCents,currency:this.pricing.currency,availability:e.availability}}},yt=class{send;dispatch;instance;focused=null;attributes=[];changeCallbacks=[];constructor(e,t,n){this.send=e,this.dispatch=t,this.instance=n}get current(){return this.focused}set(e){if(typeof e!=`string`||e.length===0)throw T.invalidParameter(`set() requires a non-empty component name, got ${String(e)}`);this.send({type:t.FOCUS,instance:this.instance,action:r.FOCUS,component:e})}clear(){this.send({type:t.FOCUS,instance:this.instance,action:r.UNFOCUS})}onChange(e){this.changeCallbacks.push(e)}handleStateReceived(e){e.state===i.FOCUSED&&e.component!==void 0?(this.focused=e.component,this.attributes=e.attributes??[]):(this.focused=null,this.attributes=[]);let t=this.focused===null?null:{component:this.focused,attributes:this.attributes};for(let e of this.changeCallbacks)e(t);this.dispatch(t)}},bt=3e4,xt=`Virtualdisplay: the print zone could not be personalised`,St=class{send;instance;pending=new Map;zoneListeners=new Set;zoneReport=[];sequence=0;pendingPlacements=new Map;frame=null;constructor(e,t){this.send=e,this.instance=t}setImage(e,t){return typeof e!=`string`||e===``?Promise.reject(T.invalidParameter(`setImage() takes a zone name`)):t instanceof Blob?this.request(e,t):Promise.reject(T.invalidParameter(`setImage() takes an image as a Blob`))}clear(e){return typeof e!=`string`||e===``?Promise.reject(T.invalidParameter(`clear() takes a zone name`)):this.request(e,null)}get zones(){return this.zoneReport}onZones(e){this.zoneListeners.add(e)}place(e,n){if(typeof e!=`string`||e===``)throw T.invalidParameter(`place() takes a zone name`);if(![n.x,n.y,n.scale].every(Number.isFinite))throw T.invalidParameter(`place() takes x, y and scale as numbers`);if(typeof n.editing!=`boolean`)throw T.invalidParameter(`place() takes editing as true or false`);this.pendingPlacements.set(e,{type:t.PLACE,instance:this.instance,zone:e,x:n.x,y:n.y,scale:n.scale,editing:n.editing}),this.frame??=requestAnimationFrame(()=>{this.sendPlacements()})}sendPlacements(){let e=[...this.pendingPlacements.values()];this.frame=null,this.pendingPlacements.clear();for(let t of e)this.send(t)}request(e,n){return new Promise((r,i)=>{this.sequence+=1;let a=String(this.sequence),o=setTimeout(()=>{this.expire(a,e)},bt);this.pending.set(a,{resolve:r,reject:i,timeout:o}),this.send({type:t.PERSONALISE,id:a,instance:this.instance,zone:e,image:n})})}expire(e,t){let n=this.pending.get(e);n!==void 0&&(this.pending.delete(e),j.warn(`Personalisation timed out`,{zone:t}),n.reject(M(`Virtualdisplay: the viewer did not answer for zone "${t}"`)))}handleReplyReceived(e){let t=this.pending.get(e.id);t===void 0?j.info(`Personalisation reply with no call waiting`,{id:e.id,zone:e.zone}):(this.pending.delete(e.id),clearTimeout(t.timeout),e.ok?t.resolve():t.reject(M(e.error??xt)))}handleZonesReceived(e){this.zoneReport=e.zones;for(let e of this.zoneListeners)e(this.zoneReport)}destroy(){this.frame!==null&&cancelAnimationFrame(this.frame),this.frame=null,this.pendingPlacements.clear(),this.zoneListeners.clear();for(let e of this.pending.values())clearTimeout(e.timeout),e.reject(M(`Virtualdisplay: the client was destroyed before the viewer answered`));this.pending.clear()}};function M(e){return new T(e,w.PERSONALISATION_FAILED)}var Ct=class{filename;developedCallbacks=new Set;errorCallbacks=new Set;developed=!1;failed=!1;photoData=null;constructor(e){this.filename=e}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(e=>{e(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())}},wt=3e4,Tt=class{send;validExtensions=[`.png`];pendingPhotos=new Map;constructor(e){this.send=e}take(e){return this.request(e,void 0)}takeOf(e,t){return this.request(e,t)}request(e,n){this.validateFilename(e),j.debug(`Taking snapshot`,{filename:e});let r=new Ct(e),i=setTimeout(()=>{this.pendingPhotos.delete(e),j.warn(`Snapshot timed out`,{filename:e}),r.fail(new T(`Snapshot timed out: the viewer did not respond within ${wt}ms`,w.SNAPSHOT_FAILED))},wt);return this.pendingPhotos.set(e,{photo:r,timeout:i}),this.send({type:t.SNAPSHOT,filename:e,...n!==void 0&&{subject:n}}),r}handleSnapshotResult(e){let t=this.pendingPhotos.get(e.filename);if(t===void 0){j.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);let{photo:n}=t;e.error===void 0?e.data!==void 0&&n.develop({filename:e.filename,data:e.data}):n.fail(new T(e.error,w.SNAPSHOT_FAILED))}clear(){if(this.pendingPhotos.size===0)return;let e=new T(`Client destroyed before snapshot completed`,w.SNAPSHOT_FAILED);for(let{photo:t,timeout:n}of this.pendingPhotos.values())clearTimeout(n),t.fail(e);this.pendingPhotos.clear()}validateFilename(e){if(e===``||typeof e!=`string`)throw new T(`Filename must be a non-empty string`,w.INVALID_PARAMETER);if(!this.validExtensions.some(t=>e.toLowerCase().endsWith(t)))throw new T(`Invalid filename: "${e}". Filename must end with one of: ${this.validExtensions.join(`, `)}`,w.INVALID_PARAMETER);if(e.includes(`..`)||e.includes(`/`)||e.includes(`\\`))throw new T(`Filename cannot contain path separators or ".."`,w.INVALID_PARAMETER)}},Et=class{container=null;attach(e){this.container=e}dispatch(e,t,n=!1){let r=new CustomEvent(e,{detail:t,cancelable:n});return this.container?.dispatchEvent(r),r}on(e,t){let n=e=>{let n=e;t({...n.detail,preventDefault:()=>{n.preventDefault()}})};return this.container?.addEventListener(e,n),()=>{this.container?.removeEventListener(e,n)}}},Dt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Bezig…`:n===`de`?`Läuft…`:`Working…`}),Ot=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Mislukt`:n===`de`?`Fehlgeschlagen`:`Failed`}),kt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Gelukt`:n===`de`?`Fertig`:`Done`}),At=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Annotaties`:n===`de`?`Anmerkungen`:`Annotations`}),jt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`AR activeren`:n===`de`?`AR aktivieren`:`Activate AR`}),Mt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Camera resetten`:n===`de`?`Kamera zurücksetzen`:`Reset camera`}),Nt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Naar links draaien`:n===`de`?`Nach links drehen`:`Rotate left`}),Pt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Naar rechts draaien`:n===`de`?`Nach rechts drehen`:`Rotate right`}),Ft=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Omlaag kantelen`:n===`de`?`Nach unten kippen`:`Tilt down`}),It=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Omhoog kantelen`:n===`de`?`Nach oben kippen`:`Tilt up`}),Lt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Inzoomen`:n===`de`?`Hineinzoomen`:`Zoom in`}),Rt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Uitzoomen`:n===`de`?`Herauszoomen`:`Zoom out`}),zt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Sluiten`:n===`de`?`Schließen`:`Close`}),Bt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Configureren`:n===`de`?`Konfigurieren`:`Configure`}),Vt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Volledig scherm`:n===`de`?`Vollbild`:`Fullscreen`}),Ht=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Sluiten`:n===`de`?`Schließen`:`Close`}),Ut=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`QR-code`:n===`de`?`QR-Code`:`QR code`}),Wt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Gebruik de camera van je smartphone om deze QR-code te scannen`:n===`de`?`Verwende die Kamera deines Smartphones, um diesen QR-Code zu scannen`:`Use your smartphone camera to scan this QR code`}),Gt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Je telefoon opent het 3D-model in AR-modus.`:n===`de`?`Dein Telefon öffnet das 3D-Modell im AR-Modus.`:`Your phone will open the 3D model in AR mode.`}),Kt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Scan om in AR te bekijken`:n===`de`?`Scannen für AR-Ansicht`:`Scan to view in AR`}),qt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`We kunnen de QR-code nu niet tonen. Open deze link op je telefoon:`:n===`de`?`Wir können den QR-Code gerade nicht anzeigen. Öffne diesen Link auf deinem Handy:`:`We can't show the QR code right now. Open this link on your phone:`}),Jt=((e={},t={})=>(t.locale??y(),`Screenshot`)),Yt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Downloaden`:n===`de`?`Herunterladen`:`Downloading`}),Xt=((e={},t={})=>{let n=t.locale??y();return n===`nl`?`Laden mislukt. Ververs de pagina om het opnieuw te proberen.`:n===`de`?`Laden fehlgeschlagen. Lade die Seite neu, um es erneut zu versuchen.`:`Load failed. Refresh the page to try again.`}),Zt={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`},Qt=([e,t,n])=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(t).forEach(e=>{r.setAttribute(e,String(t[e]))}),n?.length&&n.forEach(e=>{let t=Qt(e);r.appendChild(t)}),r},$t=(e,t={})=>Qt([`svg`,{...Zt,...t},e]),en=[[`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`}]],tn=[[`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`}]],N=[[`path`,{d:`m6 9 6 6 6-6`}]],nn=[[`path`,{d:`m15 18-6-6 6-6`}]],rn=[[`path`,{d:`m9 18 6-6-6-6`}]],an=[[`path`,{d:`m18 15-6-6-6 6`}]],on=[[`path`,{d:`M12.75 7.09a3 3 0 0 1 2.16 2.16`}],[`path`,{d:`M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568`}],[`path`,{d:`m2 2 20 20`}],[`path`,{d:`M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533`}],[`path`,{d:`M9.13 9.13a3 3 0 0 0 3.74 3.74`}]],sn=[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`}],[`circle`,{cx:`12`,cy:`10`,r:`3`}]],cn=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],ln=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],un=[[`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`}]],dn=[[`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`}]],fn=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]],pn=[[`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`}]],mn=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]];function P(e,{size:t=20,strokeWidth:n=1.75}={}){return $t(e,{width:t,height:t,"stroke-width":n})}var F={ar:e=>P(en,e),annotations:e=>P(sn,e),annotationsOff:e=>P(on,e),fullscreen:e=>P(cn,e),exitFullscreen:e=>P(ln,e),screenshot:e=>P(tn,e),tiltUp:e=>P(an,e),tiltDown:e=>P(N,e),rotateLeft:e=>P(nn,e),rotateRight:e=>P(rn,e),zoomIn:e=>P(pn,e),zoomOut:e=>P(mn,e),reset:e=>P(un,e),configurator:e=>P(dn,e),close:e=>P(fn,e),expand:e=>P(N,e)},I=class{element;constructor({variant:e=`default`,size:t=`default`,label:n,icon:r,onClick:i,disabled:a=!1}={}){this.element=document.createElement(`button`),this.element.className=`ui-btn ui-btn--${e} ui-btn--size-${t}`,n!==void 0&&(this.element.setAttribute(`aria-label`,n),this.element.title=n),r===void 0?n!==void 0&&(this.element.textContent=n):this.element.appendChild(r),i&&this.element.addEventListener(`click`,i),this.element.disabled=a}setIcon(e){let t=this.element.querySelector(`svg`);t===null?this.element.appendChild(e):t.replaceWith(e)}};function hn(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function gn(e,t,n,r,i,a){let[o,s,c]=e,l=Math.cos(t),u=Math.sin(t),ee=l*o+u*c,d=-u*o+l*c,f=Math.cos(n),p=Math.sin(n),te=f*s-p*d,ne=p*s+f*d,m=.55;return[r+ee*a*m,i-te*a*m,ne]}function _n(e,t,n){e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(n[0],n[1]),e.lineWidth=2,e.stroke()}function vn(e,t,n,r,i){let a=t(n),o=t(r);_n(e,a,[a[0]+(o[0]-a[0])*i,a[1]+(o[1]-a[1])*i,a[2]])}var L=[-1,-1,1],R=[1,-1,1],z=[1,-1,-1],B=[-1,-1,-1],V=[-1,1,1],H=[1,1,1],U=[1,1,-1],W=[-1,1,-1],G=[[L,R],[R,z],[z,B],[B,L],[L,V],[R,H],[z,U],[B,W],[V,H],[H,U],[U,W],[W,V]];function yn(e){let t=e%6/6,n=G.length;return t<.35?hn(t/.35)*n:t<.55?n:t<.9?(1-hn((t-.55)/.35))*n:0}function bn(e,{width:t,height:n},r,i=`#000`){let a=t/2,o=n*.44,s=Math.min(t,n)*.08,c=e=>gn(e,.785,.615,a,o,s),l=yn(r);e.shadowBlur=5,e.shadowColor=`rgba(30,30,30,0.08)`,e.strokeStyle=i;for(let t=0;t<G.length&&!(t>=l);t++){let n=G[t];if(n===void 0)continue;let r=Math.min(1,l-t);vn(e,c,n[0],n[1],r)}e.shadowBlur=0}var xn=400,Sn=3e4,Cn=`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`;function wn(e){let t=getComputedStyle(e).color,n=t===``?`#000`:t;return{surface:`transparent`,ink:n,danger:n}}function Tn(e,t){let n=document.createElement(`div`);Object.assign(n.style,{position:`absolute`,inset:`0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:e.surface,zIndex:`20`,opacity:`0`,transition:`opacity 0.3s ease-in-out`});let r=document.createElement(`canvas`);Object.assign(r.style,{width:`100%`,height:`100%`,position:`absolute`,inset:`0`});let i=document.createElement(`div`);i.setAttribute(`role`,`status`),Object.assign(i.style,{position:`absolute`,top:`56%`,left:`0`,right:`0`,textAlign:`center`,pointerEvents:`none`});let a=document.createElement(`span`);Object.assign(a.style,{fontSize:`13px`,fontWeight:`400`,color:e.ink,fontVariantNumeric:`tabular-nums`,fontFamily:Cn});let o=document.createElement(`span`);return Object.assign(o.style,{fontSize:`13px`,color:e.ink,fontFamily:Cn}),o.textContent=t,i.appendChild(a),i.appendChild(o),n.appendChild(r),n.appendChild(i),{overlay:n,canvas:r,pctEl:a,phaseEl:o}}var En=class{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;noSignalTimerId=null;startTime;hidden=!1;visible=!1;errored=!1;noSignalErrored=!1;colours;text;constructor(e,t){this.startTime=performance.now(),this.colours=t.colours??wn(e),this.text=t.text;let n=Tn(this.colours,this.text.downloading());this.overlay=n.overlay,t.className!==void 0&&(this.overlay.className=t.className),this.canvas=n.canvas,this.pctEl=n.pctEl,this.phaseEl=n.phaseEl,e.appendChild(this.overlay),this.ctx=this.canvas.getContext(`2d`),this.ctx!==null&&(this.sizeCanvas(),this.tick()),this.showTimerId=setTimeout(()=>{this.reveal()},xn),this.noSignalTimerId=setTimeout(()=>{this.hidden||(this.noSignalErrored=!0,this.showError(this.text.loadError()))},Sn)}viewerAlive(){this.cancelNoSignalTimer(),this.noSignalErrored&&this.recoverFromNoSignal()}recoverFromNoSignal(){this.noSignalErrored=!1,this.errored=!1,this.pctEl.textContent=``,this.phaseEl.textContent=this.text.downloading(),this.phaseEl.style.color=this.colours.ink,this.ctx!==null&&this.animationId===null&&!this.hidden&&this.tick()}recolour(e){this.colours=e,this.overlay.style.background=e.surface,this.pctEl.style.color=e.ink,this.phaseEl.style.color=this.errored?e.danger:e.ink,this.errored&&this.clearCanvas()}updateProgress(e,t){this.cancelNoSignalTimer(),this.hidden||this.errored||(this.pctEl.textContent=`${Math.round(e)}%`,this.phaseEl.textContent=t===``?``:` \u00B7 ${t}`)}showError(e){this.cancelNoSignalTimer(),this.hidden=!1,this.errored=!0,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.clearCanvas(),this.pctEl.textContent=``,this.phaseEl.textContent=e,this.phaseEl.style.color=this.colours.danger,this.reveal()}hide(){this.hidden||(this.hidden=!0,this.cancelShowTimer(),this.visible?(this.overlay.style.opacity=`0`,this.overlay.addEventListener(`transitionend`,()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)):this.destroy())}destroy(){this.cancelShowTimer(),this.cancelNoSignalTimer(),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`)}clearCanvas(){if(this.ctx===null)return;let e=Math.min(devicePixelRatio,2),t=this.canvas.width/e,n=this.canvas.height/e;this.ctx.clearRect(0,0,t,n)}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}cancelNoSignalTimer(){this.noSignalTimerId!==null&&(clearTimeout(this.noSignalTimerId),this.noSignalTimerId=null)}sizeCanvas(){if(this.ctx===null)return;let e=Math.min(devicePixelRatio,2),t=this.overlay.clientWidth||440,n=this.overlay.clientHeight||360;this.canvas.width=t*e,this.canvas.height=n*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;let e=this.canvas.width/Math.min(devicePixelRatio,2),t=this.canvas.height/Math.min(devicePixelRatio,2),n=(performance.now()-this.startTime)/1e3;this.ctx.clearRect(0,0,e,t),bn(this.ctx,{width:e,height:t},n,this.colours.ink)}},Dn=class{element;selectCallback=null;constructor(e,t,n){this.element=document.createElement(`div`),this.element.className=`ui-toggle-group`;for(let r=0;r<e.length;r++){let i=e[r],a=document.createElement(`button`);a.className=`ui-toggle-group-item`,a.dataset.value=i,a.textContent=n?.[r]??i,a.dataset.state=i===t?`on`:`off`,a.setAttribute(`aria-pressed`,i===t?`true`:`false`),a.addEventListener(`click`,()=>{this.selectCallback?.(i)}),this.element.appendChild(a)}}setSelected(e){for(let t of this.element.querySelectorAll(`.ui-toggle-group-item`)){let n=t.dataset.value===e;t.dataset.state=n?`on`:`off`,t.setAttribute(`aria-pressed`,n?`true`:`false`)}}onSelect(e){this.selectCallback=e}setEnabled(e){for(let t of this.element.querySelectorAll(`.ui-toggle-group-item`)){let n=e===null||e.includes(t.dataset.value??``);t.disabled=!n,t.setAttribute(`aria-disabled`,n?`false`:`true`)}}},On=class{element;select;constructor(e,t,n,r,i){this.select=document.createElement(`select`),this.select.className=`ui-native-select`,this.select.dataset.name=e,this.select.setAttribute(`aria-label`,n);let a=document.createElement(`option`);a.value=``,a.disabled=!0,a.textContent=n,this.select.appendChild(a);let o=!1;for(let e=0;e<t.length;e++){let n=t[e],a=document.createElement(`option`);a.value=n,a.textContent=i?.[e]??n,n===r&&(a.selected=!0,o=!0),this.select.appendChild(a)}o||(a.selected=!0);let s=$t(N,{width:16,height:16,"stroke-width":2});s.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(s)}setSelected(e){this.select.value=e}onSelect(e){this.select.addEventListener(`change`,()=>{e(this.select.value)})}setEnabled(e){for(let t of this.select.options)t.value!==``&&(t.disabled=e!==null&&!e.includes(t.value))}},kn=class{element;input;valueText;values;options;selectCallback=null;settleCallback=null;constructor(e,t){if(e.length===0)throw Error(`Virtualdisplay: Slider needs at least one value`);this.values=e,this.options=t,this.input=document.createElement(`input`),this.input.type=`range`,this.input.className=`ui-slider-input`,this.input.min=`0`,this.input.max=String(e.length-1),this.input.step=`1`,this.input.setAttribute(`aria-label`,t.label),this.valueText=document.createElement(`span`),this.valueText.className=`ui-slider-value`,this.valueText.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`div`);n.className=`ui-slider-track`,n.appendChild(this.input),n.appendChild(this.buildEnds()),this.element=document.createElement(`div`),this.element.className=`ui-slider`,this.element.appendChild(n),this.element.appendChild(this.valueText);let r=t.initialSelected===void 0?0:e.indexOf(t.initialSelected);this.applyIndex(r===-1?0:r),this.listen()}setSelected(e){let t=this.values.indexOf(e);t!==-1&&this.applyIndex(t)}onSelect(e){this.selectCallback=e}onSettle(e){this.settleCallback=e}listen(){this.input.addEventListener(`input`,()=>{let e=this.values[this.currentIndex];e!==void 0&&(this.applyIndex(this.currentIndex),this.selectCallback?.(e))}),this.input.addEventListener(`change`,()=>{let e=this.values[this.currentIndex];e!==void 0&&this.settleCallback?.(e)})}get currentIndex(){return Number(this.input.value)}applyIndex(e){this.input.value=String(e);let t=this.displayAt(e);this.valueText.textContent=t,this.input.setAttribute(`aria-valuetext`,t);let n=this.values.length===1?100:e/(this.values.length-1)*100;this.element.style.setProperty(`--ui-slider-pct`,`${n}%`)}buildEnds(){let e=document.createElement(`div`);e.className=`ui-slider-ends`,e.setAttribute(`aria-hidden`,`true`);for(let t of[0,this.values.length-1]){let n=document.createElement(`span`);n.textContent=this.labelAt(t),e.appendChild(n)}return e}labelAt(e){return this.options.labels?.[e]??this.values[e]??``}displayAt(e){let t=this.labelAt(e);return this.options.unit===void 0?t:`${t} ${this.options.unit}`}},K={neutral:{50:`oklch(98.5% 0 0)`,100:`oklch(96.5% 0 0)`,200:`oklch(92% 0 0)`,300:`oklch(82% 0 0)`,400:`oklch(70% 0 0)`,500:`oklch(55.5% 0 0)`,600:`oklch(44.5% 0 0)`,700:`oklch(37% 0 0)`,800:`oklch(27% 0 0)`,900:`oklch(21% 0 0)`,950:`oklch(14.5% 0 0)`},white:`oklch(100% 0 0)`,semantic:{error:`oklch(47% 0.17 25)`}},q={px:`1px`,0:`0`,.5:`0.125rem`,1:`0.25rem`,1.5:`0.375rem`,2:`0.5rem`,2.5:`0.625rem`,3:`0.75rem`,3.5:`0.875rem`,4:`1rem`,5:`1.25rem`,6:`1.5rem`,7:`1.75rem`,8:`2rem`,9:`2.25rem`,10:`2.5rem`,12:`3rem`,14:`3.5rem`,16:`4rem`,20:`5rem`,24:`6rem`},J={fontFamily:{sans:[`Mona Sans`,`ui-sans-serif`,`system-ui`,`sans-serif`,`Apple Color Emoji`,`Segoe UI Emoji`,`Segoe UI Symbol`,`Noto Color Emoji`],mono:[`JetBrains Mono`,`ui-monospace`,`monospace`]},fontSize:{xs:`0.75rem`,sm:`0.875rem`,base:`1rem`,lg:`1.125rem`,xl:`1.25rem`,"2xl":`1.5rem`,"3xl":`1.875rem`,"4xl":`2.25rem`},fontWeight:{normal:`400`,medium:`500`,semibold:`600`,bold:`700`},lineHeight:{tight:`1.25`,normal:`1.5`,relaxed:`1.75`}},An=class{element;constructor(){this.element=document.createElement(`div`),Object.assign(this.element.style,{background:K.white,borderRadius:`var(--radius)`,padding:q[6],boxShadow:`0 ${q[2]} ${q[8]} oklch(0% 0 0 / 20%)`,maxWidth:`20rem`,width:`100%`})}},jn=class{options;card;backdrop;keyHandler=null;constructor(e={}){this.options=e,this.card=new An,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(this.card.element)}get content(){return this.card.element}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(){let e=document.createElement(`div`);return Object.assign(e.style,{position:`fixed`,inset:q[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}},Y=J.fontFamily.sans.join(`, `),Mn=`
2
2
  :root {
3
3
  --primary: oklch(5% 0 0);
4
4
  --primary-foreground: oklch(100% 0 0);
@@ -22,7 +22,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
22
22
  gap: 0.5rem;
23
23
  border: 1px solid transparent;
24
24
  border-radius: var(--radius);
25
- font-family: ${J};
25
+ font-family: ${Y};
26
26
  font-size: 0.875rem;
27
27
  font-weight: 600;
28
28
  white-space: nowrap;
@@ -79,7 +79,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
79
79
  border-radius: var(--radius);
80
80
  background: var(--background);
81
81
  color: var(--foreground);
82
- font-family: ${J};
82
+ font-family: ${Y};
83
83
  font-size: 0.875rem;
84
84
  font-weight: 600;
85
85
  cursor: pointer;
@@ -120,7 +120,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
120
120
  background: var(--background);
121
121
  appearance: none;
122
122
  color: var(--foreground);
123
- font-family: ${J};
123
+ font-family: ${Y};
124
124
  font-size: 0.875rem;
125
125
  font-weight: 400;
126
126
  cursor: pointer;
@@ -158,7 +158,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
158
158
 
159
159
  /* Tabular figures keep the readout and layout steady mid-drag. */
160
160
  .ui-slider-value {
161
- font-family: ${J};
161
+ font-family: ${Y};
162
162
  font-size: 0.875rem;
163
163
  font-weight: 600;
164
164
  color: var(--foreground);
@@ -169,7 +169,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
169
169
  .ui-slider-ends {
170
170
  display: flex;
171
171
  justify-content: space-between;
172
- font-family: ${J};
172
+ font-family: ${Y};
173
173
  font-size: 0.75rem;
174
174
  color: var(--muted-foreground);
175
175
  font-variant-numeric: tabular-nums;
@@ -305,7 +305,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
305
305
  border: 2px solid oklch(100% 0 0);
306
306
  background: var(--primary);
307
307
  color: var(--primary-foreground);
308
- font-family: ${J};
308
+ font-family: ${Y};
309
309
  font-size: 0.8125rem;
310
310
  font-weight: 600;
311
311
  cursor: pointer;
@@ -394,7 +394,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
394
394
  }
395
395
 
396
396
  .vd-annotation-popup-title {
397
- font-family: ${J};
397
+ font-family: ${Y};
398
398
  font-size: 0.875rem;
399
399
  font-weight: 600;
400
400
  line-height: 1.25rem;
@@ -442,7 +442,7 @@ button.vd-annotation-popup-title:focus-visible {
442
442
  }
443
443
 
444
444
  .vd-annotation-popup-description {
445
- font-family: ${J};
445
+ font-family: ${Y};
446
446
  font-size: 0.8125rem;
447
447
  font-weight: 400;
448
448
  line-height: 1.125rem;
@@ -481,12 +481,12 @@ button.vd-annotation-popup-title:focus-visible {
481
481
  0%, 100% { opacity: 1; }
482
482
  50% { opacity: 0.55; }
483
483
  }
484
- `,En=!1;function Dn(){if(En||typeof document>`u`)return;En=!0;let e=document.createElement(`style`);e.id=`vd-ui-vanilla`,e.textContent=Tn,document.head.appendChild(e)}var On=q.fontFamily.sans.join(`, `),kn=class{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),Dn(),this.dialog=new wn({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.content.style,{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:K[3],fontFamily:On}),this.dialog.content.appendChild(this.createText(zt(),{fontSize:q.fontSize.base,fontWeight:q.fontWeight.semibold,color:G.neutral[900]})),this.dialog.content.appendChild(this.createText(Lt(),{fontSize:q.fontSize.sm,color:G.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.content.appendChild(this.qrSlot),this.dialog.content.appendChild(this.createText(Rt(),{fontSize:q.fontSize.xs,color:G.neutral[500]}));let e=new F({variant:`outline`,label:Ft(),onClick:()=>{this.hide()}});this.dialog.content.appendChild(e.element),this.dialog.open()}async update(t){let n;try{this.qrLib??=await Promise.resolve().then(()=>e.n(require("./browser-7qZ1KQYo.cjs").default,1)),n=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000`,light:`#ffffff`}})}catch(e){throw this.showLink(t),e}return this.qrSlot!==null&&(this.qrSlot.classList.remove(`ui-qr-slot--loading`),this.qrSlot.replaceChildren(this.createQrImage(n)),!0)}showLink(e){this.qrSlot!==null&&(this.qrSlot.classList.remove(`ui-qr-slot--loading`),this.qrSlot.replaceChildren(this.createText(Bt(),{fontSize:q.fontSize.sm,color:G.neutral[600]}),this.createText(e,{fontSize:q.fontSize.xs,color:G.neutral[900],overflowWrap:`anywhere`,userSelect:`all`})))}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(e,t){let n=document.createElement(`p`);return n.textContent=e,Object.assign(n.style,{margin:`0`,textAlign:`center`,...t}),n}createQrSlot(){let e=document.createElement(`div`);return e.className=`ui-qr-slot ui-qr-slot--loading`,e}createQrImage(e){let t=document.createElement(`img`);return t.src=e,t.alt=It(),t}},An=class{options;element;arBtn=null;fullscreenBtn=null;annotationsBtn=null;annotationsShown=!1;onFullscreenChange;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)}setFullscreenIcon(e){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(e?P.exitFullscreen():P.fullscreen())}syncButton(e,t,n){if(t&&e===null){let e=n();return this.element.appendChild(e.element),e}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 F({variant:`outline`,size:`icon`,label:wt(),icon:P.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,e.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new F({variant:`outline`,size:`icon`,label:Pt(),icon:P.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}));let t=e.annotations===`toggle-shown`||e.annotations===`toggle-hidden`;this.annotationsBtn=this.syncButton(this.annotationsBtn,t&&this.options.onAnnotationsToggle!==void 0,()=>{this.annotationsShown=e.annotations===`toggle-shown`;let t=new F({variant:`outline`,size:`icon`,label:Ct(),icon:this.annotationsShown?P.annotations():P.annotationsOff(),onClick:()=>{this.flipAnnotations()}});return t.element.setAttribute(`aria-pressed`,String(this.annotationsShown)),t})}flipAnnotations(){this.annotationsShown=!this.annotationsShown,this.annotationsBtn?.element.setAttribute(`aria-pressed`,String(this.annotationsShown)),this.annotationsBtn?.setIcon(this.annotationsShown?P.annotations():P.annotationsOff()),this.options.onAnnotationsToggle?.(this.annotationsShown)}destroy(){document.removeEventListener(`fullscreenchange`,this.onFullscreenChange)}},Y=.5,jn=class e{element;constructor(t,n){this.element=Object.assign(document.createElement(`div`),{className:`vd-camera-controls`});let r={targetRotation:n.rotation,targetTilt:n.tilt,targetZoom:n.zoom,thetaOffset:0},i=Ln(t,n,r);n.onChange(e=>{r.targetRotation=e.rotation-r.thetaOffset,r.targetTilt=e.tilt,r.targetZoom=e.zoom,Rn(i,n,e)}),this.element.appendChild(e.buildZoom(i.zoomOut,i.zoomIn)),this.element.appendChild(e.buildDpad(i.tiltUp,i.rotateLeft,i.reset,i.rotateRight,i.tiltDown))}static buildZoom(e,t){let n=document.createElement(`div`);return n.className=`vd-zoom`,n.appendChild(e.element),n.appendChild(t.element),n}static buildDpad(e,t,n,r,i){let a=document.createElement(`div`);a.className=`vd-dpad`;for(let[o,s]of[[e,`up`],[t,`left`],[n,`center`],[r,`right`],[i,`down`]])o.element.classList.add(`vd-dpad-${s}`),a.appendChild(o.element);return a}};function Mn(e,t){let n=e;for(;n<t;)n+=360;for(;n>=t+360;)n-=360;return n}function Nn(e,t,n){let r=Mn(e,t);return r<=n?r:r-n<=t+360-r?n:t}function X(e,t,n){return new F({variant:`outline`,size:`icon`,label:e,icon:t,onClick:n})}function Pn(e,t){return Math.max(e.limits?.minZoom??1,Math.min(e.limits?.maxZoom??1/0,t))}function Fn(e,t){let n=e.limits?.minRotate,r=e.limits?.maxRotate;return n===void 0||r===void 0||r-n>=360?t:Nn(t,n,r)}function In(e,t,n,r){let i=t.limits?.minTilt,a=t.limits?.maxTilt;if(i!==void 0||a!==void 0){n.targetTilt=Math.max(i??0,Math.min(a??180,n.targetTilt+r)),e.tilt(n.targetTilt).set();return}let o=n.targetTilt+r;o>180||o<0?(n.targetTilt=o>180?360-o:-o,n.thetaOffset=(n.thetaOffset+180)%360,e.tilt(n.targetTilt).rotate(n.targetRotation+n.thetaOffset).set()):(n.targetTilt=o,e.tilt(n.targetTilt).set())}function Ln(e,t,n){let r=r=>{n.targetZoom=Pn(t,n.targetZoom+r),e.zoom(n.targetZoom).set()},i=r=>{n.targetRotation=Fn(t,n.targetRotation+r),e.rotate(n.targetRotation+n.thetaOffset).set()};return{zoomOut:X(jt(),P.zoomOut(),()=>{r(-10)}),zoomIn:X(At(),P.zoomIn(),()=>{r(10)}),tiltUp:X(kt(),P.tiltUp(),()=>{In(e,t,n,-15)}),rotateLeft:X(Et(),P.rotateLeft(),()=>{i(-15)}),reset:X(Tt(),P.reset(),()=>{n.thetaOffset=0,e.reset()}),rotateRight:X(Dt(),P.rotateRight(),()=>{i(15)}),tiltDown:X(Ot(),P.tiltDown(),()=>{In(e,t,n,15)})}}function Rn(e,t,n){let r=t.limits;if(r===void 0)return;e.zoomOut.element.disabled=r.minZoom!==void 0&&n.zoom<=r.minZoom+Y,e.zoomIn.element.disabled=r.maxZoom!==void 0&&n.zoom>=r.maxZoom-Y,e.tiltUp.element.disabled=r.minTilt!==void 0&&n.tilt<=r.minTilt+Y,e.tiltDown.element.disabled=r.maxTilt!==void 0&&n.tilt>=r.maxTilt-Y;let{minRotate:i,maxRotate:a}=r;if(i===void 0||a===void 0||a-i>=360){e.rotateLeft.element.disabled=!1,e.rotateRight.element.disabled=!1;return}let o=Mn(n.rotation,i);e.rotateLeft.element.disabled=o<=i+Y,e.rotateRight.element.disabled=o>=a-Y}var Z={SELECT:`vd:select`,SELECTED:`vd:selected`,FOCUS_CHANGE:`vd:focus-change`,CONFIGURATION_CHANGE:`vd:configuration-change`,CONFIGURATION_SUBMIT:`vd:configuration-submit`};function zn(e,t,n,r,i,a,o){let s=e.values.find(t=>n.getValue(e.name,t)?.isSelected===!0)??e.defaultValue,c=new Sn(e.values,{label:e.name,labels:t.labels,unit:t.unit,...s!==void 0&&{initialSelected:s}});return c.onSelect(t=>{i(e.name,t)}),c.onSettle(t=>{r.dispatch(Z.SELECT,{attribute:e.name,value:t},!0).defaultPrevented||a(e.name,t)}),o(e.name,t=>{c.setSelected(t.value),r.dispatch(Z.SELECTED,{attribute:e.name,value:t.value})}),{element:c.element,setSelectable:()=>{}}}var Bn={mm:1,cm:10,m:1e3,in:25.4};function Vn(e,t){return e/Bn[t]}var Hn=3;function Un(e){let t=Vn(e.stepMm,e.displayUnit);for(let e=0;e<=Hn;e++){let n=t*10**e;if(Math.abs(n-Math.round(n))<1e-9)return e}return Hn}function Wn(e,t,n){let r=Un(t),i=Vn(e,t.displayUnit);return new Intl.NumberFormat(n,{minimumFractionDigits:r,maximumFractionDigits:r}).format(i)}function Gn(e,t,n){return{labels:e.values.map(e=>Wn(Number(e),t,n)),unit:t.displayUnit}}var Kn=20;function qn(e,t){let n=new Intl.NumberFormat(t,{maximumFractionDigits:Kn});return{labels:e.numbers.map(e=>n.format(e)),unit:e.unit}}var Jn=5,Yn=0;function Xn(e,t,n,r,i,a){let o=document.createElement(`div`);o.className=`vd-attribute`,o.dataset.name=e.name;let s=document.createElement(`span`);s.className=`vd-attribute-label`,s.textContent=C(e.name),s.id=`vd-attribute-label-${Yn++}`,o.appendChild(s),o.setAttribute(`role`,`group`),o.setAttribute(`aria-labelledby`,s.id);let c=e=>{o.style.display=e?`none`:``},l=Zn(e),u=l===void 0?Qn(e,t,n,r,a):zn(e,l,t,n,i,r,a);return o.appendChild(u.element),{element:o,setSelectable:u.setSelectable,setHidden:c}}function Zn(e){if(e.dimension!==void 0)return Gn(e,e.dimension,y());if(e.size!==void 0)return qn(e.size,y())}function Qn(e,t,n,r,i){let a=e.values.find(n=>t.getValue(e.name,n)?.isSelected===!0),o=e.values.map(t=>Pe(t,e.labels)),s=e.values.length<=Jn?new bn(e.values,a,o):new xn(e.name,e.values,C(e.name),a,o);return s.onSelect(t=>{n.dispatch(Z.SELECT,{attribute:e.name,value:t},!0).defaultPrevented||r(e.name,t)}),i(e.name,t=>{s.setSelected(t.value),n.dispatch(Z.SELECTED,{attribute:e.name,value:t.value})}),{element:s.element,setSelectable:e=>{s.setEnabled(e)}}}var $n=80,er=2500,tr=class{configuration;element;priceEl;vatEl;button;unsubscribe;state=`idle`;resetTimer;constructor(e){this.configuration=e,this.element=document.createElement(`div`),this.element.className=`vd-commerce vd-hidden`;let t=document.createElement(`div`);t.className=`vd-commerce-price`,this.priceEl=document.createElement(`span`),this.priceEl.className=`vd-price`,this.vatEl=document.createElement(`span`),this.vatEl.className=`vd-vat`,t.append(this.priceEl,this.vatEl),this.button=new F({variant:`default`,onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add(`vd-cta`,`vd-hidden`),this.element.append(t,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}update(){this.renderPrice(this.configuration.current),this.renderButton();let 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){e===void 0?(this.priceEl.textContent=``,this.vatEl.textContent=``):(this.priceEl.textContent=nr(e.price,e.currency),this.vatEl.textContent=Q(this.configuration.vatDisplay))}renderButton(){let e=this.configuration.submitEnabled;this.button.element.classList.toggle(`vd-hidden`,!e),e&&this.state===`idle`&&this.setButtonText(Q(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!==`busy`){this.setState(`busy`,bt());try{await this.configuration.submit(),this.setState(`success`,St())}catch(e){if(e instanceof DOMException&&e.name===`AbortError`){this.setState(`idle`,Q(this.configuration.buttonLabel));return}j.warn(`Commerce submit failed`,{error:e}),this.setState(`failed`,xt())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state=`idle`,this.update()},er)}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 Q(e){return(e??``).slice(0,$n)}function nr(e,t){try{let n=new Intl.NumberFormat(y(),{style:`currency`,currency:t}),r=n.resolvedOptions().maximumFractionDigits??2;return n.format(e/10**r)}catch{return`${t} ${(e/100).toFixed(2)}`}}var rr=class{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}},ir=572,ar=class{actionBarSlot;element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;constructor(e){this.actionBarSlot=e}attach(e,t){this.container=e,t.classList.add(`vd-attributes-sidebar`),this.closeButton=new F({variant:`ghost`,size:`icon-sm`,label:Mt(),icon:P.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});let n=document.createElement(`div`);n.className=`vd-sidebar-header`,n.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(n,this.body),e.appendChild(this.element),this.openButton=new F({variant:`outline`,size:`icon`,label:Nt(),icon:P.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=>{let t=e[0]?.contentRect.width??0;this.setCollapsible(t>0&&t<ir)}),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;let 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)}},or=class{attach(e,t){}setVisible(e){}destroy(){}},sr={"inframe-bottom-left":()=>new rr,"sidebar-right":e=>new ar(e),hidden:()=>new or};function cr(e,t){return(sr[e??``]??(()=>new rr))(t)}var $=q.fontFamily.sans.join(`, `),lr=`
484
+ `,Nn=!1;function Pn(){if(Nn||typeof document>`u`)return;Nn=!0;let e=document.createElement(`style`);e.id=`vd-ui-vanilla`,e.textContent=Mn,document.head.appendChild(e)}var Fn=J.fontFamily.sans.join(`, `),In=class{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),Pn(),this.dialog=new jn({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.content.style,{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:q[3],fontFamily:Fn}),this.dialog.content.appendChild(this.createText(Kt(),{fontSize:J.fontSize.base,fontWeight:J.fontWeight.semibold,color:K.neutral[900]})),this.dialog.content.appendChild(this.createText(Wt(),{fontSize:J.fontSize.sm,color:K.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.content.appendChild(this.qrSlot),this.dialog.content.appendChild(this.createText(Gt(),{fontSize:J.fontSize.xs,color:K.neutral[500]}));let e=new I({variant:`outline`,label:Ht(),onClick:()=>{this.hide()}});this.dialog.content.appendChild(e.element),this.dialog.open()}async update(t){let n;try{this.qrLib??=await Promise.resolve().then(()=>e.n(require("./browser-7qZ1KQYo.cjs").default,1)),n=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000`,light:`#ffffff`}})}catch(e){throw this.showLink(t),e}return this.qrSlot!==null&&(this.qrSlot.classList.remove(`ui-qr-slot--loading`),this.qrSlot.replaceChildren(this.createQrImage(n)),!0)}showLink(e){this.qrSlot!==null&&(this.qrSlot.classList.remove(`ui-qr-slot--loading`),this.qrSlot.replaceChildren(this.createText(qt(),{fontSize:J.fontSize.sm,color:K.neutral[600]}),this.createText(e,{fontSize:J.fontSize.xs,color:K.neutral[900],overflowWrap:`anywhere`,userSelect:`all`})))}hide(){this.dialog?.close(),this.dialog=null,this.qrSlot=null}createText(e,t){let n=document.createElement(`p`);return n.textContent=e,Object.assign(n.style,{margin:`0`,textAlign:`center`,...t}),n}createQrSlot(){let e=document.createElement(`div`);return e.className=`ui-qr-slot ui-qr-slot--loading`,e}createQrImage(e){let t=document.createElement(`img`);return t.src=e,t.alt=Ut(),t}},Ln=class{options;element;arBtn=null;fullscreenBtn=null;annotationsBtn=null;annotationsShown=!1;onFullscreenChange;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)}setFullscreenIcon(e){this.fullscreenBtn!==null&&this.fullscreenBtn.setIcon(e?F.exitFullscreen():F.fullscreen())}syncButton(e,t,n){if(t&&e===null){let e=n();return this.element.appendChild(e.element),e}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 I({variant:`outline`,size:`icon`,label:jt(),icon:F.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,e.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new I({variant:`outline`,size:`icon`,label:Vt(),icon:F.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}));let t=e.annotations===`toggle-shown`||e.annotations===`toggle-hidden`;this.annotationsBtn=this.syncButton(this.annotationsBtn,t&&this.options.onAnnotationsToggle!==void 0,()=>{this.annotationsShown=e.annotations===`toggle-shown`;let t=new I({variant:`outline`,size:`icon`,label:At(),icon:this.annotationsShown?F.annotations():F.annotationsOff(),onClick:()=>{this.flipAnnotations()}});return t.element.setAttribute(`aria-pressed`,String(this.annotationsShown)),t})}flipAnnotations(){this.annotationsShown=!this.annotationsShown,this.annotationsBtn?.element.setAttribute(`aria-pressed`,String(this.annotationsShown)),this.annotationsBtn?.setIcon(this.annotationsShown?F.annotations():F.annotationsOff()),this.options.onAnnotationsToggle?.(this.annotationsShown)}destroy(){document.removeEventListener(`fullscreenchange`,this.onFullscreenChange)}},X=.5,Rn=class e{element;constructor(t,n){this.element=Object.assign(document.createElement(`div`),{className:`vd-camera-controls`});let r={targetRotation:n.rotation,targetTilt:n.tilt,targetZoom:n.zoom,thetaOffset:0},i=Wn(t,n,r);n.onChange(e=>{r.targetRotation=e.rotation-r.thetaOffset,r.targetTilt=e.tilt,r.targetZoom=e.zoom,Gn(i,n,e)}),this.element.appendChild(e.buildZoom(i.zoomOut,i.zoomIn)),this.element.appendChild(e.buildDpad(i.tiltUp,i.rotateLeft,i.reset,i.rotateRight,i.tiltDown))}static buildZoom(e,t){let n=document.createElement(`div`);return n.className=`vd-zoom`,n.appendChild(e.element),n.appendChild(t.element),n}static buildDpad(e,t,n,r,i){let a=document.createElement(`div`);a.className=`vd-dpad`;for(let[o,s]of[[e,`up`],[t,`left`],[n,`center`],[r,`right`],[i,`down`]])o.element.classList.add(`vd-dpad-${s}`),a.appendChild(o.element);return a}};function zn(e,t){let n=e;for(;n<t;)n+=360;for(;n>=t+360;)n-=360;return n}function Bn(e,t,n){let r=zn(e,t);return r<=n?r:r-n<=t+360-r?n:t}function Z(e,t,n){return new I({variant:`outline`,size:`icon`,label:e,icon:t,onClick:n})}function Vn(e,t){return Math.max(e.limits?.minZoom??1,Math.min(e.limits?.maxZoom??1/0,t))}function Hn(e,t){let n=e.limits?.minRotate,r=e.limits?.maxRotate;return n===void 0||r===void 0||r-n>=360?t:Bn(t,n,r)}function Un(e,t,n,r){let i=t.limits?.minTilt,a=t.limits?.maxTilt;if(i!==void 0||a!==void 0){n.targetTilt=Math.max(i??0,Math.min(a??180,n.targetTilt+r)),e.tilt(n.targetTilt).set();return}let o=n.targetTilt+r;o>180||o<0?(n.targetTilt=o>180?360-o:-o,n.thetaOffset=(n.thetaOffset+180)%360,e.tilt(n.targetTilt).rotate(n.targetRotation+n.thetaOffset).set()):(n.targetTilt=o,e.tilt(n.targetTilt).set())}function Wn(e,t,n){let r=r=>{n.targetZoom=Vn(t,n.targetZoom+r),e.zoom(n.targetZoom).set()},i=r=>{n.targetRotation=Hn(t,n.targetRotation+r),e.rotate(n.targetRotation+n.thetaOffset).set()};return{zoomOut:Z(Rt(),F.zoomOut(),()=>{r(-10)}),zoomIn:Z(Lt(),F.zoomIn(),()=>{r(10)}),tiltUp:Z(It(),F.tiltUp(),()=>{Un(e,t,n,-15)}),rotateLeft:Z(Nt(),F.rotateLeft(),()=>{i(-15)}),reset:Z(Mt(),F.reset(),()=>{n.thetaOffset=0,e.reset()}),rotateRight:Z(Pt(),F.rotateRight(),()=>{i(15)}),tiltDown:Z(Ft(),F.tiltDown(),()=>{Un(e,t,n,15)})}}function Gn(e,t,n){let r=t.limits;if(r===void 0)return;e.zoomOut.element.disabled=r.minZoom!==void 0&&n.zoom<=r.minZoom+X,e.zoomIn.element.disabled=r.maxZoom!==void 0&&n.zoom>=r.maxZoom-X,e.tiltUp.element.disabled=r.minTilt!==void 0&&n.tilt<=r.minTilt+X,e.tiltDown.element.disabled=r.maxTilt!==void 0&&n.tilt>=r.maxTilt-X;let{minRotate:i,maxRotate:a}=r;if(i===void 0||a===void 0||a-i>=360){e.rotateLeft.element.disabled=!1,e.rotateRight.element.disabled=!1;return}let o=zn(n.rotation,i);e.rotateLeft.element.disabled=o<=i+X,e.rotateRight.element.disabled=o>=a-X}var Q={SELECT:`vd:select`,SELECTED:`vd:selected`,FOCUS_CHANGE:`vd:focus-change`,CONFIGURATION_CHANGE:`vd:configuration-change`,CONFIGURATION_SUBMIT:`vd:configuration-submit`};function Kn(e,t,n,r,i,a,o){let s=e.values.find(t=>n.getValue(e.name,t)?.isSelected===!0)??e.defaultValue,c=new kn(e.values,{label:e.name,labels:t.labels,unit:t.unit,...s!==void 0&&{initialSelected:s}});return c.onSelect(t=>{i(e.name,t)}),c.onSettle(t=>{r.dispatch(Q.SELECT,{attribute:e.name,value:t},!0).defaultPrevented||a(e.name,t)}),o(e.name,t=>{c.setSelected(t.value),r.dispatch(Q.SELECTED,{attribute:e.name,value:t.value})}),{element:c.element,setSelectable:()=>{}}}var qn={mm:1,cm:10,m:1e3,in:25.4};function Jn(e,t){return e/qn[t]}var Yn=3;function Xn(e){let t=Jn(e.stepMm,e.displayUnit);for(let e=0;e<=Yn;e++){let n=t*10**e;if(Math.abs(n-Math.round(n))<1e-9)return e}return Yn}function Zn(e,t,n){let r=Xn(t),i=Jn(e,t.displayUnit);return new Intl.NumberFormat(n,{minimumFractionDigits:r,maximumFractionDigits:r}).format(i)}function Qn(e,t,n){return{labels:e.values.map(e=>Zn(Number(e),t,n)),unit:t.displayUnit}}var $n=20;function er(e,t){let n=new Intl.NumberFormat(t,{maximumFractionDigits:$n});return{labels:e.numbers.map(e=>n.format(e)),unit:e.unit}}var tr=5,nr=0;function rr(e,t,n,r,i,a){let o=document.createElement(`div`);o.className=`vd-attribute`,o.dataset.name=e.name;let s=document.createElement(`span`);s.className=`vd-attribute-label`,s.textContent=C(e.name),s.id=`vd-attribute-label-${nr++}`,o.appendChild(s),o.setAttribute(`role`,`group`),o.setAttribute(`aria-labelledby`,s.id);let c=e=>{o.style.display=e?`none`:``},l=ir(e),u=l===void 0?ar(e,t,n,r,a):Kn(e,l,t,n,i,r,a);return o.appendChild(u.element),{element:o,setSelectable:u.setSelectable,setHidden:c}}function ir(e){if(e.dimension!==void 0)return Qn(e,e.dimension,y());if(e.size!==void 0)return er(e.size,y())}function ar(e,t,n,r,i){let a=e.values.find(n=>t.getValue(e.name,n)?.isSelected===!0),o=e.values.map(t=>Re(t,e.labels)),s=e.values.length<=tr?new Dn(e.values,a,o):new On(e.name,e.values,C(e.name),a,o);return s.onSelect(t=>{n.dispatch(Q.SELECT,{attribute:e.name,value:t},!0).defaultPrevented||r(e.name,t)}),i(e.name,t=>{s.setSelected(t.value),n.dispatch(Q.SELECTED,{attribute:e.name,value:t.value})}),{element:s.element,setSelectable:e=>{s.setEnabled(e)}}}var or=80,sr=2500,cr=class{configuration;element;priceEl;vatEl;button;unsubscribe;state=`idle`;resetTimer;constructor(e){this.configuration=e,this.element=document.createElement(`div`),this.element.className=`vd-commerce vd-hidden`;let t=document.createElement(`div`);t.className=`vd-commerce-price`,this.priceEl=document.createElement(`span`),this.priceEl.className=`vd-price`,this.vatEl=document.createElement(`span`),this.vatEl.className=`vd-vat`,t.append(this.priceEl,this.vatEl),this.button=new I({variant:`default`,onClick:()=>{this.handleSubmit()}}),this.button.element.classList.add(`vd-cta`,`vd-hidden`),this.element.append(t,this.button.element),this.unsubscribe=this.configuration.onRender(()=>{this.update()}),this.update()}update(){this.renderPrice(this.configuration.current),this.renderButton();let 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){e===void 0?(this.priceEl.textContent=``,this.vatEl.textContent=``):(this.priceEl.textContent=lr(e.price,e.currency),this.vatEl.textContent=$(this.configuration.vatDisplay))}renderButton(){let e=this.configuration.submitEnabled;this.button.element.classList.toggle(`vd-hidden`,!e),e&&this.state===`idle`&&this.setButtonText($(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!==`busy`){this.setState(`busy`,Dt());try{await this.configuration.submit(),this.setState(`success`,kt())}catch(e){if(e instanceof DOMException&&e.name===`AbortError`){this.setState(`idle`,$(this.configuration.buttonLabel));return}j.warn(`Commerce submit failed`,{error:e}),this.setState(`failed`,Ot())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state=`idle`,this.update()},sr)}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 $(e){return(e??``).slice(0,or)}function lr(e,t){try{let n=new Intl.NumberFormat(y(),{style:`currency`,currency:t}),r=n.resolvedOptions().maximumFractionDigits??2;return n.format(e/10**r)}catch{return`${t} ${(e/100).toFixed(2)}`}}var ur=class{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}},dr=572,fr=class{actionBarSlot;element=null;body=null;openButton=null;closeButton=null;container=null;observer=null;collapsible=!1;expanded=!0;visible=!1;constructor(e){this.actionBarSlot=e}attach(e,t){this.container=e,t.classList.add(`vd-attributes-sidebar`),this.closeButton=new I({variant:`ghost`,size:`icon-sm`,label:zt(),icon:F.close({size:18}),onClick:()=>{this.expanded=!1,this.render()}});let n=document.createElement(`div`);n.className=`vd-sidebar-header`,n.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(n,this.body),e.appendChild(this.element),this.openButton=new I({variant:`outline`,size:`icon`,label:Bt(),icon:F.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=>{let t=e[0]?.contentRect.width??0;this.setCollapsible(t>0&&t<dr)}),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;let 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)}},pr=class{attach(e,t){}setVisible(e){}destroy(){}},mr={"inframe-bottom-left":()=>new ur,"sidebar-right":e=>new fr(e),hidden:()=>new pr};function hr(e,t){return(mr[e??``]??(()=>new ur))(t)}var gr=J.fontFamily.sans.join(`, `),_r=`
485
485
  position: absolute;
486
486
  display: flex;
487
487
  z-index: 10;
488
488
  transition: inset-inline-end 0.18s ease;
489
- `,ur=`
489
+ `,vr=`
490
490
  /* Override browser's default black fullscreen backdrop */
491
491
  .vd-container:fullscreen {
492
492
  background: oklch(100% 0 0);
@@ -494,52 +494,52 @@ button.vd-annotation-popup-title:focus-visible {
494
494
 
495
495
  /* Layout slots — four corners */
496
496
  .vd-slot-top-right {
497
- ${lr}
498
- inset-block-start: ${K[3]};
499
- inset-inline-end: ${K[3]};
497
+ ${_r}
498
+ inset-block-start: ${q[3]};
499
+ inset-inline-end: ${q[3]};
500
500
  flex-direction: column;
501
501
  align-items: flex-end;
502
- gap: ${K[1.5]};
502
+ gap: ${q[1.5]};
503
503
  }
504
504
 
505
505
  .vd-slot-bottom-left {
506
- ${lr}
507
- inset-block-end: ${K[3]};
508
- inset-inline-start: ${K[3]};
506
+ ${_r}
507
+ inset-block-end: ${q[3]};
508
+ inset-inline-start: ${q[3]};
509
509
  flex-direction: column;
510
510
  align-items: flex-start;
511
- gap: ${K[1.5]};
511
+ gap: ${q[1.5]};
512
512
  }
513
513
 
514
514
  .vd-slot-bottom-right {
515
- ${lr}
516
- inset-block-end: ${K[3]};
517
- inset-inline-end: ${K[3]};
515
+ ${_r}
516
+ inset-block-end: ${q[3]};
517
+ inset-inline-end: ${q[3]};
518
518
  flex-direction: row;
519
- gap: ${K[1.5]};
519
+ gap: ${q[1.5]};
520
520
  }
521
521
 
522
522
  /* Component styles — no positioning */
523
523
  .vd-camera-controls {
524
524
  display: flex;
525
525
  flex-direction: column;
526
- gap: ${K[1]};
527
- background: color-mix(in oklch, ${G.white} 85%, transparent);
526
+ gap: ${q[1]};
527
+ background: color-mix(in oklch, ${K.white} 85%, transparent);
528
528
  backdrop-filter: blur(8px);
529
- border-radius: ${K[2]};
530
- padding: ${K[2]};
529
+ border-radius: ${q[2]};
530
+ padding: ${q[2]};
531
531
  }
532
532
 
533
533
  .vd-zoom {
534
534
  display: flex;
535
- gap: ${K[.5]};
535
+ gap: ${q[.5]};
536
536
  }
537
537
 
538
538
  .vd-dpad {
539
539
  display: grid;
540
- grid-template-columns: repeat(3, ${K[9]});
541
- grid-template-rows: repeat(3, ${K[9]});
542
- gap: ${K[.5]};
540
+ grid-template-columns: repeat(3, ${q[9]});
541
+ grid-template-rows: repeat(3, ${q[9]});
542
+ gap: ${q[.5]};
543
543
  }
544
544
 
545
545
  .vd-dpad-up { grid-column: 2; grid-row: 1; }
@@ -551,30 +551,30 @@ button.vd-annotation-popup-title:focus-visible {
551
551
  .vd-attributes {
552
552
  display: flex;
553
553
  flex-direction: column;
554
- gap: ${K[3]};
555
- background: color-mix(in oklch, ${G.white} 85%, transparent);
554
+ gap: ${q[3]};
555
+ background: color-mix(in oklch, ${K.white} 85%, transparent);
556
556
  backdrop-filter: blur(8px);
557
- border: 1px solid color-mix(in oklch, ${G.neutral[900]} 8%, transparent);
558
- border-radius: ${K[3]};
559
- padding: ${K[3]};
560
- box-shadow: 0 ${K[1]} ${K[4]} color-mix(in oklch, ${G.neutral[900]} 6%, transparent);
561
- font-family: ${$};
557
+ border: 1px solid color-mix(in oklch, ${K.neutral[900]} 8%, transparent);
558
+ border-radius: ${q[3]};
559
+ padding: ${q[3]};
560
+ box-shadow: 0 ${q[1]} ${q[4]} color-mix(in oklch, ${K.neutral[900]} 6%, transparent);
561
+ font-family: ${gr};
562
562
  }
563
563
 
564
564
  .vd-attribute {
565
565
  display: flex;
566
566
  flex-direction: column;
567
- gap: ${K[1.5]};
567
+ gap: ${q[1.5]};
568
568
  }
569
569
 
570
570
  /* Micro-label: recedes so the controls lead. */
571
571
  .vd-attribute-label {
572
- font-size: ${q.fontSize.xs};
573
- font-weight: ${q.fontWeight.medium};
574
- color: ${G.neutral[500]};
572
+ font-size: ${J.fontSize.xs};
573
+ font-weight: ${J.fontWeight.medium};
574
+ color: ${K.neutral[500]};
575
575
  text-transform: uppercase;
576
576
  letter-spacing: 0.05em;
577
- font-family: ${$};
577
+ font-family: ${gr};
578
578
  }
579
579
 
580
580
  /* sidebar-right layout — a docked, full-height right panel */
@@ -610,10 +610,10 @@ button.vd-annotation-popup-title:focus-visible {
610
610
  z-index: 11;
611
611
  display: flex;
612
612
  flex-direction: column;
613
- background: color-mix(in oklch, ${G.white} 90%, transparent);
613
+ background: color-mix(in oklch, ${K.white} 90%, transparent);
614
614
  backdrop-filter: blur(10px);
615
- border-inline-start: 1px solid color-mix(in oklch, ${G.neutral[900]} 8%, transparent);
616
- box-shadow: -${K[1]} 0 ${K[4]} color-mix(in oklch, ${G.neutral[900]} 5%, transparent);
615
+ border-inline-start: 1px solid color-mix(in oklch, ${K.neutral[900]} 8%, transparent);
616
+ box-shadow: -${q[1]} 0 ${q[4]} color-mix(in oklch, ${K.neutral[900]} 5%, transparent);
617
617
  }
618
618
 
619
619
  @media (prefers-reduced-motion: no-preference) {
@@ -625,13 +625,13 @@ button.vd-annotation-popup-title:focus-visible {
625
625
  .vd-sidebar-header {
626
626
  display: flex;
627
627
  justify-content: flex-end;
628
- padding: ${K[1.5]} ${K[1.5]} 0;
628
+ padding: ${q[1.5]} ${q[1.5]} 0;
629
629
  }
630
630
 
631
631
  .vd-sidebar-body {
632
632
  flex: 1;
633
633
  overflow-y: auto;
634
- padding: ${K[4]};
634
+ padding: ${q[4]};
635
635
  }
636
636
 
637
637
  /* attributes inside the sidebar: flat and full-width — the panel provides the frosting */
@@ -642,38 +642,38 @@ button.vd-annotation-popup-title:focus-visible {
642
642
  border-radius: 0;
643
643
  padding: 0;
644
644
  box-shadow: none;
645
- gap: ${K[5]};
645
+ gap: ${q[5]};
646
646
  }
647
647
 
648
648
  /* while the panel is open, keep the corner controls clear of it */
649
- .vd-layout-sidebar-right .vd-slot-top-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${K[3]}); }
650
- .vd-layout-sidebar-right .vd-slot-bottom-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${K[3]}); }
649
+ .vd-layout-sidebar-right .vd-slot-top-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${q[3]}); }
650
+ .vd-layout-sidebar-right .vd-slot-bottom-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${q[3]}); }
651
651
 
652
652
  /* Price + CTA — sit under the attribute controls, separated by a hairline */
653
653
  .vd-commerce {
654
654
  display: flex;
655
655
  flex-direction: column;
656
- gap: ${K[2]};
657
- padding-block-start: ${K[3]};
658
- border-block-start: 1px solid color-mix(in oklch, ${G.neutral[900]} 8%, transparent);
659
- font-family: ${$};
656
+ gap: ${q[2]};
657
+ padding-block-start: ${q[3]};
658
+ border-block-start: 1px solid color-mix(in oklch, ${K.neutral[900]} 8%, transparent);
659
+ font-family: ${gr};
660
660
  }
661
661
 
662
662
  .vd-commerce-price {
663
663
  display: flex;
664
664
  align-items: baseline;
665
- gap: ${K[1.5]};
665
+ gap: ${q[1.5]};
666
666
  }
667
667
 
668
668
  .vd-price {
669
- font-size: ${q.fontSize.lg};
670
- font-weight: ${q.fontWeight.semibold};
671
- color: ${G.neutral[900]};
669
+ font-size: ${J.fontSize.lg};
670
+ font-weight: ${J.fontWeight.semibold};
671
+ color: ${K.neutral[900]};
672
672
  }
673
673
 
674
674
  .vd-vat {
675
- font-size: ${q.fontSize.xs};
676
- color: ${G.neutral[500]};
675
+ font-size: ${J.fontSize.xs};
676
+ color: ${K.neutral[500]};
677
677
  }
678
678
 
679
679
  .vd-cta {
@@ -683,9 +683,9 @@ button.vd-annotation-popup-title:focus-visible {
683
683
 
684
684
  /* Failed submit is the one place red belongs: a clear, recoverable error state. */
685
685
  .vd-commerce[data-submit="failed"] .vd-cta {
686
- background: ${G.semantic.error};
687
- border-color: ${G.semantic.error};
688
- color: ${G.white};
686
+ background: ${K.semantic.error};
687
+ border-color: ${K.semantic.error};
688
+ color: ${K.white};
689
689
  }
690
690
 
691
- `;function dr(){if(Dn(),document.getElementById(`vd-styles`)!==null)return;let e=document.createElement(`style`);e.id=`vd-styles`,e.textContent=ur,document.head.appendChild(e)}function fr(e,t){let n=document.createElement(`a`);n.href=`data:image/png;base64,${e}`,n.download=t,n.click()}var pr=class{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;ready=!1;constructor(e){this.options=e}attach(e){dr(),this.container=e,this.loading=new yn(e,{text:{downloading:()=>Ht(),loadError:()=>Ut()}}),this.slots.topRight=this.createSlot(e,`vd-slot-top-right`),this.slots.bottomRight=this.createSlot(e,`vd-slot-bottom-right`)}onReady(){this.ready=!0,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;let e=typeof this.container.requestFullscreen==`function`&&document.fullscreenEnabled!==!1;this.actionBar=new An({onAr:this.options.onAr,onFullscreen:e?()=>{this.toggleFullscreen()}:void 0,onAnnotationsToggle:this.options.onAnnotationsToggle}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement===null?(this.options.onFullscreenEnter?.(),this.container.requestFullscreen().catch(e=>{j.warn(`Fullscreen request refused`,{error:e})})):document.exitFullscreen())}updateProgress(e,t){this.loading?.updateProgress(e,t)}showError(e){this.loading?.showError(e)}viewerAlive(){this.loading?.viewerAlive()}applyViewerSettings(e){this.settings=e,e.language!==void 0&&_e(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()}renderModelControls(e,t){if(this.container!==null&&this.slots.topRight!==null&&this.slots.bottomRight!==null&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.mountCameraControls(this.slots.topRight),this.placeScreenshotButton(),t.length!==0)){this.attributes=document.createElement(`div`),this.attributes.className=`vd-attributes`,this.groupHandles=new Map;for(let n of t){let t=Xn(n,e,this.options.eventBus,this.options.onSelect,this.options.onSelectTransient,this.options.onSubscribe);this.groupHandles.set(n.name,t),this.attributes.appendChild(t.element)}this.commerce=new tr(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=cr(this.settings.configuratorLayout,this.slots.bottomRight),this.layout.attach(this.container,this.attributes),this.ready===!0&&this.layout.setVisible(!0),this.lastSelectable!==null&&this.applySelectable(this.lastSelectable)}}mountCameraControls(e){this.settings.cameraControls===!0&&(this.cameraControls=new jn(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display=this.ready?`flex`:`none`,e.appendChild(this.cameraControls.element))}applySelectable(e){this.lastSelectable=e;for(let[t,n]of this.groupHandles){let r=e.find(e=>e.name===t);n.setSelectable(r?.selectable??null),n.setHidden(r?.hidden===!0)}}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(let e of Object.values(this.slots))e?.remove();this.container=null}createSlot(e,t){let n=document.createElement(`div`);return n.className=t,e.appendChild(n),n}syncScreenshotButton(){let e=this.settings.screenshot===!0;e&&this.screenshotBtn===null&&(this.screenshotBtn=new F({variant:`outline`,size:`icon`,label:Vt(),icon:P.screenshot(),onClick:()=>{this.takeScreenshot()}})),!e&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}takeScreenshot(){let e=this.screenshotBtn;e===null||e.element.disabled||(e.element.disabled=!0,this.options.snapshotApi.take(`snapshot.png`).onDeveloped(({data:t,filename:n})=>{e.element.disabled=!1,fr(t,n)}).onError(t=>{e.element.disabled=!1,j.warn(`Screenshot failed`,{error:t})}))}placeScreenshotButton(){this.screenshotBtn!==null&&this.slots.topRight!==null&&(this.cameraControls===null?this.slots.topRight.appendChild(this.screenshotBtn.element):this.cameraControls.element.appendChild(this.screenshotBtn.element))}},mr=class{defaultServer=`https://server.virtualdisplay.io`;options;serverHost;extraParams;constructor(e,t,n){this.options=e,this.serverHost=t,this.extraParams=n}create(){let e=this.createContainer(),t=this.createIframe();return e.appendChild(t),this.attachToParent(e),{container:e,iframe:t}}createContainer(){let e=document.createElement(`div`);return e.className=`vd-container`,Object.assign(e.style,{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`}),e}createIframe(){let e=document.createElement(`iframe`);return e.src=this.buildUrl(),e.setAttribute(`allow`,`xr-spatial-tracking; fullscreen`),e}attachToParent(e){this.getParentElement().appendChild(e)}buildUrl(){let e=this.getServerUrl(),t=new URL(e);this.setAddressParams(t),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(let[e,n]of Object.entries(this.extraParams??{}))t.searchParams.set(e,n);return t.toString()}setAddressParams(e){this.options.app===void 0?(e.searchParams.set(`license`,this.options.license),e.searchParams.set(`model`,this.options.model)):(e.searchParams.set(`app`,this.options.app),(this.options.license!==void 0||this.options.model!==void 0)&&j.warn("Both `app` and `license`/`model` were supplied: `app` wins, the pair was ignored"))}getServerUrl(){return this.serverHost===void 0?this.defaultServer:this.serverHost}getParentElement(){if(typeof this.options.parent!=`string`)return this.options.parent;let e=document.querySelector(this.options.parent);if(e===null)throw T.parentNotFound(this.options.parent);return e}};function hr(e){let{messenger:n}=e;n.on(t.HANDSHAKE,t=>{l(t)&&(j.info(`Server handshake received, flushing publisher queue`),n.markReady(),e.ui.viewerAlive())}),n.on(t.SESSION,t=>{u(t)&&e.onSession(t.sessionId)}),n.on(t.MUTATION,t=>{d(t)&&(e.attributes.handleMutationResult(t),e.configuration.handleSelectionChanged(e.attributes.getSelection()))}),n.on(t.SNAPSHOT,t=>{f(t)&&e.snapshot.handleSnapshotResult(t)}),n.on(t.CAMERA,t=>{p(t)&&e.cameraPosition.handlePositionUpdate(t)}),n.on(t.LOADING_INDICATOR,t=>{ne(t)&&(t.error===void 0?e.ui.updateProgress(t.progress,t.phase):e.ui.showError(t.error))}),n.on(t.CONFIG,t=>{ie(t)&&e.applyConfig(t)}),n.on(t.MAPPING,t=>{te(t)&&(e.attributes.handleMappingReceived(t),e.configuration.handleSelectionChanged(e.attributes.getSelection()),e.ui.renderModelControls(e.attributes,t.attributes),e.readyStateTracker.handleMappingReceived())}),gr(e)}function gr(e){let{messenger:n}=e;n.on(t.FOCUS,t=>{ae(t)&&e.focus.handleStateReceived(t)}),n.on(t.PRICING,t=>{oe(t)&&e.configuration.handlePricingReceived(t.pricing)}),n.on(t.SYNC,t=>{m(t)&&e.onSync(t.connected)}),n.on(t.SELECTABLE,t=>{re(t)&&(e.selectable.handleSnapshot(t),e.ui.applySelectable(t.attributes))}),n.on(t.APP_RESOLVED,t=>{ee(t)&&e.onAppResolved(t)})}var _r=class{ready=!1;onReady;constructor(e){this.onReady=e}handleMappingReceived(){this.ready||(this.ready=!0,j.info(`Mapping received from server, client is now ready`),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}};function vr(e){if(e===void 0)return;let{annotations:t,...n}=e;return t===void 0?n:t===!0?{...n,annotations:`show`}:t===!1?{...n,annotations:`hide`}:{...n,annotations:t}}function yr(e){if(!Array.isArray(e))return{};let t=e.filter(e=>typeof e==`string`);return t.length>0?{features:t}:{}}var br=class{attributes;selectableState;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;iframeParams;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;resolvedApp;appResolvedCallbacks=[];constructor(e,t){this.options=e;let r=t??{};this.serverHost=r.serverHost,this.iframeParams=r.iframeParams,this.initializeLogging(),this.messenger=new ce(()=>this.iframe?.contentWindow??null,{onHandlerError:(e,t)=>j.error(`Error handling ${e.type}`,t),...r.messengerOptions});let i=e=>{this.messenger.send(e)};this.attributes=new st(i,n,(e,t)=>{this.notifyMutationFailed(e,t)}),this.selectableState=new ct,this.snapshotApi=new vt(i),this.annotationsApi=new ue(i,n),this.cameraApi=new lt(i),this.cameraPositionApi=new ut,this.focusApi=new ht(i,e=>{this.dispatchFocusChange(e)},n),this.configurationApi=new mt(e=>{this.dispatchConfigurationChange(e)},e=>{this.dispatchConfigurationSubmit(e)}),this.eventBus=new yt,this.arActivation=r.createArActivation?.(i),this.syncTracker=r.createSyncTracker?.(),this.readyStateTracker=new _r(()=>{this.notifyReady()}),this.ui=this.createStandardInterface(),this.wireIncomingMessages(),r.registerHandlers?.(this.messenger,i),this.messenger.start(),this.mountIframe()}createStandardInterface(){let e=this.arActivation;return new pr({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(e,t)=>this.attributes.select(e,t),onSelectTransient:(e,t)=>this.attributes.selectTransient(e,t),onSubscribe:(e,t)=>this.attributes.onChange(e,t),...e!==void 0&&{onAr:()=>{e.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()},onAnnotationsToggle:e=>{this.sendControlAnnotationToggle(e)}})}sendControlAnnotationToggle(e){this.sendAnnotationToggle(e,`control`)}sendAnnotationToggle(e,n){this.messenger.send({type:t.ANNOTATION_TOGGLE,enabled:e,...n!==void 0&&{origin:n}})}wireIncomingMessages(){hr({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)},onAppResolved:e=>{this.handleAppResolved({appType:e.appType,name:e.name,...e.slug!==void 0&&{slug:e.slug},...e.submit!==void 0&&{submit:e.submit},...yr(e.features)})}})}handleAppResolved(e){this.resolvedApp=e;for(let t of this.appResolvedCallbacks)t(e)}handleSession(e){this.viewerSessionId=e,this.arActivation?.onSession(e)}notifyMutationFailed(e,t){for(let n of this.mutationFailedCallbacks)n({attribute:e,value:t})}notifyReady(){let e=this.readyCallbacks;this.readyCallbacks=[];for(let t of e)t(this);this.ui.onReady()}dispatchFocusChange(e){this.container?.dispatchEvent(new CustomEvent(Z.FOCUS_CHANGE,{detail:e,bubbles:!0}))}dispatchConfigurationChange(e){this.container?.dispatchEvent(new CustomEvent(Z.CONFIGURATION_CHANGE,{detail:e??null,bubbles:!0}))}dispatchConfigurationSubmit(e){this.container?.dispatchEvent(new CustomEvent(Z.CONFIGURATION_SUBMIT,{detail:e,bubbles:!0}))}handleConfig(e){let t=e.viewerSettings,n=vr(this.options.viewerSettings);if(t!==void 0||n!==void 0){let e=n===void 0?t:{...t??{},...n};if(n!==void 0&&t!==void 0){let e=Object.entries(n).filter(([e,n])=>t[e]!==n).map(([e,n])=>`${e} (metadata: ${t[e]??`undefined`}, override: ${n})`);e.length>0&&j.warn(`Viewer settings override active: ${e.join(`, `)}`)}this.ui.applyViewerSettings(e),this.echoAnnotationsDifference(t?.annotations,e.annotations)}this.cameraPositionApi.applyLimits(e.cameraLimits)}echoAnnotationsDifference(e,t){t!==void 0&&t!==e&&this.sendAnnotationToggle(t===`show`||t===`toggle-shown`)}trackFullscreen(){this.messenger.send({type:t.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&at(),j.info(`Initializing Virtualdisplay client`,{...this.options.app===void 0?{model:this.options.model}:{app:this.options.app}})}mountIframe(){let e=new mr(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),this.messenger.setTargetOrigin(new URL(this.iframe.src).origin)}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){this.readyStateTracker.isReady?e(this):this.readyCallbacks.push(e)}onMutationFailed(e){this.mutationFailedCallbacks.push(e)}onSelectableChange(e){this.selectableState.onChange(e)}onAppResolved(e){this.appResolvedCallbacks.push(e),this.resolvedApp!==void 0&&e(this.resolvedApp)}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}},xr=`ar.virtualdisplay.io`;function Sr(e){let t=new URL(`https://${xr}/go`);return e.sessionId===void 0?e.app===void 0?e.license!==void 0&&e.model!==void 0&&(t.searchParams.set(`license`,e.license),t.searchParams.set(`model`,e.model)):t.searchParams.set(`app`,e.app):t.searchParams.set(`session`,e.sessionId),t.toString()}var Cr=1500,wr=class{options;qrModal=new kn;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(e){this.options=e}onSession(e){this.sessionId=e;let t=this.waiters;this.waiters=[];for(let n of t)n(e)}activate(){et()?this.options.send({type:t.AR_ACTIVATE}):this.showQrCode()}destroy(){this.destroyed=!0;for(let e of this.pendingTimers)clearTimeout(e);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();let e=await this.waitForSessionId();if(this.destroyed)return;let n=Sr({sessionId:e,app:this.options.app,license:this.options.license,model:this.options.model}),r;try{r=await this.qrModal.update(n)}catch(e){j.warn(`AR QR code could not be rendered`,{error:e});return}this.destroyed?this.qrModal.hide():r&&this.options.send({type:t.QR_SHOWN})}waitForSessionId(){return this.sessionId===void 0?new Promise(e=>{let t=setTimeout(()=>{this.pendingTimers.delete(t),e(void 0)},Cr);this.pendingTimers.add(t),this.waiters.push(n=>{this.pendingTimers.delete(t),clearTimeout(t),e(n)})}):Promise.resolve(this.sessionId)}},Tr=class{callbacks=[];lastKnown;handleSync(e){this.lastKnown=e;for(let t of this.callbacks)t(e)}onChange(e){this.callbacks.push(e),this.lastKnown!==void 0&&e(this.lastKnown)}},Er=class extends br{syncStatusTracker;constructor(e){let t=new Tr;super(e,{createArActivation:t=>new wr({app:e.app,license:e.license,model:e.model,send:t}),createSyncTracker:()=>t}),this.syncStatusTracker=t}onSyncChange(e){this.syncStatusTracker.onChange(e)}};exports.AVAILABILITY=a,exports.Annotations=ue,exports.Attribute=Ie,exports.AttributeValue=de,exports.Camera=lt,exports.CameraPosition=ut,exports.Configuration=mt,exports.ERROR_CODES=w,exports.Focus=ht,exports.Photo=gt,exports.Snapshot=vt,exports.VD_EVENTS=Z,exports.VirtualdisplayClient=Er,exports.VirtualdisplayError=T,exports.enableDebugMode=at,exports.isDebugMode=ot,Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return j}});
691
+ `;function yr(){if(Pn(),document.getElementById(`vd-styles`)!==null)return;let e=document.createElement(`style`);e.id=`vd-styles`,e.textContent=vr,document.head.appendChild(e)}function br(e,t){let n=document.createElement(`a`);n.href=`data:image/png;base64,${e}`,n.download=t,n.click()}var xr=class{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;ready=!1;constructor(e){this.options=e}attach(e){yr(),this.container=e,this.loading=new En(e,{text:{downloading:()=>Yt(),loadError:()=>Xt()}}),this.slots.topRight=this.createSlot(e,`vd-slot-top-right`),this.slots.bottomRight=this.createSlot(e,`vd-slot-bottom-right`)}onReady(){this.ready=!0,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;let e=typeof this.container.requestFullscreen==`function`&&document.fullscreenEnabled!==!1;this.actionBar=new Ln({onAr:this.options.onAr,onFullscreen:e?()=>{this.toggleFullscreen()}:void 0,onAnnotationsToggle:this.options.onAnnotationsToggle}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton()}toggleFullscreen(){this.container!==null&&(document.fullscreenElement===null?(this.options.onFullscreenEnter?.(),this.container.requestFullscreen().catch(e=>{j.warn(`Fullscreen request refused`,{error:e})})):document.exitFullscreen())}updateProgress(e,t){this.loading?.updateProgress(e,t)}showError(e){this.loading?.showError(e)}viewerAlive(){this.loading?.viewerAlive()}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()}renderModelControls(e,t){if(this.container!==null&&this.slots.topRight!==null&&this.slots.bottomRight!==null&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.teardownConfigurator(),this.mountCameraControls(this.slots.topRight),this.placeScreenshotButton(),t.length!==0)){this.attributes=document.createElement(`div`),this.attributes.className=`vd-attributes`,this.groupHandles=new Map;for(let n of t){let t=rr(n,e,this.options.eventBus,this.options.onSelect,this.options.onSelectTransient,this.options.onSubscribe);this.groupHandles.set(n.name,t),this.attributes.appendChild(t.element)}this.commerce=new cr(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=hr(this.settings.configuratorLayout,this.slots.bottomRight),this.layout.attach(this.container,this.attributes),this.ready===!0&&this.layout.setVisible(!0),this.lastSelectable!==null&&this.applySelectable(this.lastSelectable)}}mountCameraControls(e){this.settings.cameraControls===!0&&(this.cameraControls=new Rn(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display=this.ready?`flex`:`none`,e.appendChild(this.cameraControls.element))}applySelectable(e){this.lastSelectable=e;for(let[t,n]of this.groupHandles){let r=e.find(e=>e.name===t);n.setSelectable(r?.selectable??null),n.setHidden(r?.hidden===!0)}}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(let e of Object.values(this.slots))e?.remove();this.container=null}createSlot(e,t){let n=document.createElement(`div`);return n.className=t,e.appendChild(n),n}syncScreenshotButton(){let e=this.settings.screenshot===!0;e&&this.screenshotBtn===null&&(this.screenshotBtn=new I({variant:`outline`,size:`icon`,label:Jt(),icon:F.screenshot(),onClick:()=>{this.takeScreenshot()}})),!e&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}takeScreenshot(){let e=this.screenshotBtn;e===null||e.element.disabled||(e.element.disabled=!0,this.options.snapshotApi.take(`snapshot.png`).onDeveloped(({data:t,filename:n})=>{e.element.disabled=!1,br(t,n)}).onError(t=>{e.element.disabled=!1,j.warn(`Screenshot failed`,{error:t})}))}placeScreenshotButton(){this.screenshotBtn!==null&&this.slots.topRight!==null&&(this.cameraControls===null?this.slots.topRight.appendChild(this.screenshotBtn.element):this.cameraControls.element.appendChild(this.screenshotBtn.element))}},Sr=class{defaultServer=`https://server.virtualdisplay.io`;options;serverHost;extraParams;constructor(e,t,n){this.options=e,this.serverHost=t,this.extraParams=n}create(){let e=this.createContainer(),t=this.createIframe();return e.appendChild(t),this.attachToParent(e),{container:e,iframe:t}}createContainer(){let e=document.createElement(`div`);return e.className=`vd-container`,Object.assign(e.style,{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`}),e}createIframe(){let e=document.createElement(`iframe`);return e.src=this.buildUrl(),e.setAttribute(`allow`,`xr-spatial-tracking; fullscreen`),e}attachToParent(e){this.getParentElement().appendChild(e)}buildUrl(){let e=this.getServerUrl(),t=new URL(e);this.setAddressParams(t),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(let[e,n]of Object.entries(this.extraParams??{}))t.searchParams.set(e,n);return t.toString()}setAddressParams(e){this.options.app===void 0?(e.searchParams.set(`license`,this.options.license),e.searchParams.set(`model`,this.options.model)):(e.searchParams.set(`app`,this.options.app),(this.options.license!==void 0||this.options.model!==void 0)&&j.warn("Both `app` and `license`/`model` were supplied: `app` wins, the pair was ignored"))}getServerUrl(){return this.serverHost===void 0?this.defaultServer:this.serverHost}getParentElement(){if(typeof this.options.parent!=`string`)return this.options.parent;let e=document.querySelector(this.options.parent);if(e===null)throw T.parentNotFound(this.options.parent);return e}};function Cr(e){let{messenger:n}=e;n.on(t.HANDSHAKE,t=>{l(t)&&(j.info(`Server handshake received, flushing publisher queue`),n.markReady(),e.ui.viewerAlive())}),n.on(t.SESSION,t=>{u(t)&&e.onSession(t.sessionId)}),n.on(t.MUTATION,t=>{ne(t)&&(e.attributes.handleMutationResult(t),e.configuration.handleSelectionChanged(e.attributes.getSelection()))}),n.on(t.SNAPSHOT,t=>{m(t)&&e.snapshot.handleSnapshotResult(t)}),n.on(t.CAMERA,t=>{re(t)&&e.cameraPosition.handlePositionUpdate(t)}),n.on(t.LOADING_INDICATOR,t=>{ae(t)&&(t.error===void 0?e.ui.updateProgress(t.progress,t.phase):e.ui.showError(t.error))}),n.on(t.CONFIG,t=>{ce(t)&&e.applyConfig(t)}),n.on(t.MAPPING,t=>{ie(t)&&(e.attributes.handleMappingReceived(t),e.configuration.handleSelectionChanged(e.attributes.getSelection()),e.ui.renderModelControls(e.attributes,t.attributes),e.readyStateTracker.handleMappingReceived())}),wr(e)}function wr(e){let{messenger:n}=e;n.on(t.FOCUS,t=>{le(t)&&e.focus.handleStateReceived(t)}),n.on(t.PERSONALISED,t=>{d(t)&&e.personalisation.handleReplyReceived(t)}),n.on(t.ZONES,t=>{te(t)&&e.personalisation.handleZonesReceived(t)}),n.on(t.PRICING,t=>{ue(t)&&e.configuration.handlePricingReceived(t.pricing)}),n.on(t.SYNC,t=>{oe(t)&&e.onSync(t.connected)}),n.on(t.SELECTABLE,t=>{se(t)&&(e.selectable.handleSnapshot(t),e.ui.applySelectable(t.attributes))}),n.on(t.APP_RESOLVED,t=>{ee(t)&&e.onAppResolved(t)})}var Tr=class{ready=!1;onReady;constructor(e){this.onReady=e}handleMappingReceived(){this.ready||(this.ready=!0,j.info(`Mapping received from server, client is now ready`),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}};function Er(e){if(e===void 0)return;let{annotations:t,...n}=e;return t===void 0?n:t===!0?{...n,annotations:`show`}:t===!1?{...n,annotations:`hide`}:{...n,annotations:t}}function Dr(e){if(!Array.isArray(e))return{};let t=e.filter(e=>typeof e==`string`);return t.length>0?{features:t}:{}}var Or=class{attributes;selectableState;readyStateTracker;messenger;cameraApi;cameraPositionApi;focusApi;personalisationApi;configurationApi;snapshotApi;annotationsApi;eventBus;ui;options;serverHost;iframeParams;arActivation;syncTracker;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];viewerSessionId;resolvedApp;appResolvedCallbacks=[];constructor(e,t){this.options=e;let r=t??{};this.serverHost=r.serverHost,this.iframeParams=r.iframeParams,this.initializeLogging(),this.messenger=new fe(()=>this.iframe?.contentWindow??null,{onHandlerError:(e,t)=>j.error(`Error handling ${e.type}`,t),...r.messengerOptions});let i=e=>{this.messenger.send(e)};this.attributes=new dt(i,n,(e,t)=>{this.notifyMutationFailed(e,t)}),this.selectableState=new ft,this.snapshotApi=new Tt(i),this.annotationsApi=new me(i,n),this.cameraApi=new pt(i),this.cameraPositionApi=new mt,this.focusApi=new yt(i,e=>{this.dispatchFocusChange(e)},n),this.personalisationApi=new St(i,n),this.configurationApi=new vt(e=>{this.dispatchConfigurationChange(e)},e=>{this.dispatchConfigurationSubmit(e)}),this.eventBus=new Et,this.arActivation=r.createArActivation?.(i),this.syncTracker=r.createSyncTracker?.(),this.readyStateTracker=new Tr(()=>{this.notifyReady()}),this.ui=this.createStandardInterface(),this.wireIncomingMessages(),r.registerHandlers?.(this.messenger,i),this.messenger.start(),this.mountIframe()}createStandardInterface(){let e=this.arActivation;return new xr({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,configuration:this.configurationApi,onSelect:(e,t)=>this.attributes.select(e,t),onSelectTransient:(e,t)=>this.attributes.selectTransient(e,t),onSubscribe:(e,t)=>this.attributes.onChange(e,t),...e!==void 0&&{onAr:()=>{e.activate()}},onFullscreenEnter:()=>{this.trackFullscreen()},onAnnotationsToggle:e=>{this.sendControlAnnotationToggle(e)}})}sendControlAnnotationToggle(e){this.sendAnnotationToggle(e,`control`)}sendAnnotationToggle(e,n){this.messenger.send({type:t.ANNOTATION_TOGGLE,enabled:e,...n!==void 0&&{origin:n}})}wireIncomingMessages(){Cr({messenger:this.messenger,attributes:this.attributes,selectable:this.selectableState,configuration:this.configurationApi,snapshot:this.snapshotApi,cameraPosition:this.cameraPositionApi,focus:this.focusApi,personalisation:this.personalisationApi,ui:this.ui,readyStateTracker:this.readyStateTracker,applyConfig:e=>{this.handleConfig(e)},onSession:e=>{this.handleSession(e)},onSync:e=>{this.syncTracker?.handleSync(e)},onAppResolved:e=>{this.handleAppResolved({appType:e.appType,name:e.name,...e.slug!==void 0&&{slug:e.slug},...e.submit!==void 0&&{submit:e.submit},...Dr(e.features)})}})}handleAppResolved(e){this.resolvedApp=e;for(let t of this.appResolvedCallbacks)t(e)}handleSession(e){this.viewerSessionId=e,this.arActivation?.onSession(e)}notifyMutationFailed(e,t){for(let n of this.mutationFailedCallbacks)n({attribute:e,value:t})}notifyReady(){let e=this.readyCallbacks;this.readyCallbacks=[];for(let t of e)t(this);this.ui.onReady()}dispatchFocusChange(e){this.container?.dispatchEvent(new CustomEvent(Q.FOCUS_CHANGE,{detail:e,bubbles:!0}))}dispatchConfigurationChange(e){this.container?.dispatchEvent(new CustomEvent(Q.CONFIGURATION_CHANGE,{detail:e??null,bubbles:!0}))}dispatchConfigurationSubmit(e){this.container?.dispatchEvent(new CustomEvent(Q.CONFIGURATION_SUBMIT,{detail:e,bubbles:!0}))}handleConfig(e){let t=e.viewerSettings,n=Er(this.options.viewerSettings);if(t!==void 0||n!==void 0){let e=n===void 0?t:{...t??{},...n};if(n!==void 0&&t!==void 0){let e=Object.entries(n).filter(([e,n])=>t[e]!==n).map(([e,n])=>`${e} (metadata: ${t[e]??`undefined`}, override: ${n})`);e.length>0&&j.warn(`Viewer settings override active: ${e.join(`, `)}`)}this.ui.applyViewerSettings(e),this.echoAnnotationsDifference(t?.annotations,e.annotations)}this.cameraPositionApi.applyLimits(e.cameraLimits)}echoAnnotationsDifference(e,t){t!==void 0&&t!==e&&this.sendAnnotationToggle(t===`show`||t===`toggle-shown`)}trackFullscreen(){this.messenger.send({type:t.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&lt(),j.info(`Initializing Virtualdisplay client`,{...this.options.app===void 0?{model:this.options.model}:{app:this.options.app}})}mountIframe(){let e=new Sr(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),this.messenger.setTargetOrigin(new URL(this.iframe.src).origin)}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){this.readyStateTracker.isReady?e(this):this.readyCallbacks.push(e)}onMutationFailed(e){this.mutationFailedCallbacks.push(e)}onSelectableChange(e){this.selectableState.onChange(e)}onAppResolved(e){this.appResolvedCallbacks.push(e),this.resolvedApp!==void 0&&e(this.resolvedApp)}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 personalisation(){return this.personalisationApi}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.personalisationApi.destroy(),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}},kr=`ar.virtualdisplay.io`;function Ar(e){let t=new URL(`https://${kr}/go`);return e.sessionId===void 0?e.app===void 0?e.license!==void 0&&e.model!==void 0&&(t.searchParams.set(`license`,e.license),t.searchParams.set(`model`,e.model)):t.searchParams.set(`app`,e.app):t.searchParams.set(`session`,e.sessionId),t.toString()}var jr=1500,Mr=class{options;qrModal=new In;sessionId;waiters=[];pendingTimers=new Set;destroyed=!1;constructor(e){this.options=e}onSession(e){this.sessionId=e;let t=this.waiters;this.waiters=[];for(let n of t)n(e)}activate(){it()?this.options.send({type:t.AR_ACTIVATE}):this.showQrCode()}destroy(){this.destroyed=!0;for(let e of this.pendingTimers)clearTimeout(e);this.pendingTimers.clear(),this.waiters=[],this.qrModal.hide()}async showQrCode(){this.qrModal.show();let e=await this.waitForSessionId();if(this.destroyed)return;let n=Ar({sessionId:e,app:this.options.app,license:this.options.license,model:this.options.model}),r;try{r=await this.qrModal.update(n)}catch(e){j.warn(`AR QR code could not be rendered`,{error:e});return}this.destroyed?this.qrModal.hide():r&&this.options.send({type:t.QR_SHOWN})}waitForSessionId(){return this.sessionId===void 0?new Promise(e=>{let t=setTimeout(()=>{this.pendingTimers.delete(t),e(void 0)},jr);this.pendingTimers.add(t),this.waiters.push(n=>{this.pendingTimers.delete(t),clearTimeout(t),e(n)})}):Promise.resolve(this.sessionId)}},Nr=class{callbacks=[];lastKnown;handleSync(e){this.lastKnown=e;for(let t of this.callbacks)t(e)}onChange(e){this.callbacks.push(e),this.lastKnown!==void 0&&e(this.lastKnown)}},Pr=class extends Or{syncStatusTracker;constructor(e){let t=new Nr;super(e,{createArActivation:t=>new Mr({app:e.app,license:e.license,model:e.model,send:t}),createSyncTracker:()=>t}),this.syncStatusTracker=t}onSyncChange(e){this.syncStatusTracker.onChange(e)}};exports.AVAILABILITY=a,exports.Annotations=me,exports.Attribute=Be,exports.AttributeValue=he,exports.Camera=pt,exports.CameraPosition=mt,exports.Configuration=vt,exports.ERROR_CODES=w,exports.Focus=yt,exports.Personalisation=St,exports.Photo=Ct,exports.Snapshot=Tt,exports.VD_EVENTS=Q,exports.VirtualdisplayClient=Pr,exports.VirtualdisplayError=T,exports.enableDebugMode=lt,exports.isDebugMode=ut,Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return j}});