@virtualdisplay.io/client 4.0.0-alpha.34 → 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
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.VirtualdisplayClient={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),u={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`},d=`main`,f={FOCUS:`focus`,UNFOCUS:`unfocus`},p={FOCUSED:`focused`,UNFOCUSED:`unfocused`},m={AVAILABLE:`available`,VIEW_ONLY:`view_only`,HIDDEN:`hidden`};function h(e){return typeof e!=`object`||!e?null:e}var g=new Set(Object.values(u));function _(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.target!=`string`&&typeof t.type==`string`&&g.has(t.type)}function v(e){let t=h(e);return t!==null&&t.type===u.HANDSHAKE}function y(e){let t=h(e);return t!==null&&t.type===u.SESSION&&typeof t.sessionId==`string`}function b(e){let t=h(e);return t!==null&&t.type===u.APP_RESOLVED&&typeof t.appType==`string`&&t.appType!==``&&typeof t.name==`string`}function x(e){let t=h(e);return t!==null&&t.type===u.MUTATION&&typeof t.instance==`string`&&t.instance!==``&&Array.isArray(t.results)}function S(e){let t=h(e);return t!==null&&t.type===u.SNAPSHOT&&(`data`in t||`error`in t)}function C(e){let t=h(e);return t!==null&&t.type===u.CAMERA&&Array.isArray(t.transforms)}function ee(e){let t=h(e);return t!==null&&t.type===u.MAPPING&&typeof t.instance==`string`&&t.instance!==``&&Array.isArray(t.attributes)}function te(e){let t=h(e);return t!==null&&t.type===u.LOADING_INDICATOR&&typeof t.progress==`number`}function ne(e){let t=h(e);return t!==null&&t.type===u.SYNC&&typeof t.connected==`boolean`}function re(e){let t=h(e);return t!==null&&t.type===u.SELECTABLE&&typeof t.instance==`string`&&t.instance!==``&&Array.isArray(t.attributes)}function ie(e){let t=h(e);return t!==null&&t.type===u.CONFIG&&typeof t.viewerSettings==`object`}function ae(e){let t=h(e);return t!==null&&t.type===u.FOCUS&&typeof t.instance==`string`&&t.instance!==``&&typeof t.state==`string`}function oe(e){let t=h(e);return t!==null&&t.type===u.PRICING&&typeof t.instance==`string`&&t.instance!==``&&typeof t.pricing==`object`&&t.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??_,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}`)}u.CAMERA,u.LOADING_INDICATOR;var ue=class{send;instance;constructor(e,t){this.send=e,this.instance=t}setEnabled(e){this.send({type:u.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`],me=`PARAGLIDE_LOCALE`,w=[`globalVariable`,`baseLocale`],he=[],T=typeof window>`u`;globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};var E,ge=!1,D=()=>{let e=w;!T&&typeof window<`u`&&window.location?.href&&(e=Ne(window.location.href));let t=_e(e,typeof window<`u`?window.location?.href:void 0);if(t)return ge||(E=t,ge=!0,ye(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found`)};function _e(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(t===`globalVariable`&&E!==void 0)n=E;else if(Pe(t)&&A.has(t)){let e=A.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return xe(t)}}let e=O(n);if(e)return e}}var ve=e=>{e?window.location.href=e:window.location.reload()},ye=(e,t)=>{let n={reload:!0,...t},r;try{r=D()}catch{}let i=[],a=w;!T&&typeof window<`u`&&window.location?.href&&(a=Ne(window.location.href));for(let t of a)if(t===`globalVariable`)E=e;else if(t===`baseLocale`)continue;else if(Pe(t)&&A.has(t)){let n=A.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=()=>{!T&&n.reload&&window.location&&e!==r&&ve(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()},be=()=>typeof window<`u`?window.location.origin:`http://fallback.com`;function O(e){if(typeof e!=`string`)return;let t=e.toLowerCase();for(let e of pe)if(e.toLowerCase()===t)return e}function xe(e){let t=O(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${pe.join(`, `)}`)}function k(e){return e}function Se(e,t){return new fe(e,t.href)}function Ce(){return 0}function we(e){return he}function Te(e,t){return e.exec(t.href)}var Ee=me.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);RegExp(`(?:^|;\\s*)${Ee}=([^;]*)`);function De(e){return Oe(e)}function Oe(e){let t=k(typeof e==`string`?new URL(e,be()):new URL(e.href)),n=t.pathname.replace(/^\/+/,``).split(`/`);return n.length>0&&O(n[0])&&(t.pathname=`/`+n.slice(1).join(`/`)),k(t)}var ke=-1,Ae,je;function Me(e){if(he.length===0)return;let t=typeof e==`string`?e:e.href,n=Ce();if(Ae===t&&ke===n)return je;let r=k(new URL(t,`http://example.com`)),i=De(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 ke=n,Ae=t,je=o,o}function Ne(e){let t=Me(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:w}var A=new Map;function Pe(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}function Fe(e,t){return Ie(t!==void 0&&Object.hasOwn(t,e)?t[e]:void 0)??Le(e)}function Ie(e){if(e===void 0)return;for(let t of[D(),`nl`,`en`])if(Object.hasOwn(e,t)&&e[t]!==void 0)return e[t];let[t]=Object.values(e);return t}function Le(e){let t=e.replace(/([A-Z])/g,` $1`).trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}var j={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`},M=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}"`,j.VALUE_NOT_FOUND)}static parentNotFound(t){return new e(`Parent element not found: ${t}`,j.PARENT_NOT_FOUND)}static invalidParameter(t){return new e(t,j.INVALID_PARAMETER)}},Re=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 M.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,Fe(r,t));r===this.defaultValue&&e.setSelected(!0),n.set(r,e)}return n}},ze=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 Re(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}}},N=4096,P=16384,Be=[1024,256,64],Ve=20,F=[`timestamp`,`level`,`msg`,`service`,`trace_id`,`span_id`];function He(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])=>!F.includes(e)).map(([e,t])=>`${e}=${I(t,N).line}`).join(` `);return`${t} ${n} [${r}] ${i}${a?` `+a:``}`}function Ue(e){for(let t of[N,...Be]){let{line:n,truncated:r}=I(e,t);if(!r){if(n.length<=P)return n;continue}let{line:i}=I({...e,log_truncated:!0},t);if(i.length<=P)return i}let t=Object.keys(e).filter(e=>!F.includes(e)),n={...Ge(e,F),log_truncated:!0,log_dropped_count:t.length},r=I({...n,log_dropped_attrs:t.slice(0,Ve)},N);return r.line.length<=P?r.line:I(n,N).line}function I(e,t){let n=[],r=!1;return{line:JSON.stringify(e,function(e,i){if(typeof i==`string`)return i.length>t&&(r=!0),We(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 We(e,t){return e.length<=t?e:`${e.slice(0,t)}...[truncated ${e.length-t} chars]`}function Ge(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function Ke(e,t){let n=t?He(e):Ue(e);e.level===`error`?console.error(n):e.level===`warn`?console.warn(n):console.log(n)}function qe(e,t=0){let n={name:e.name,message:e.message};return e.stack!==void 0&&(n.stack=e.stack),Ye(e,n),e.cause!==void 0&&e.cause!==null&&(n.cause=e.cause instanceof Error&&t<5?qe(e.cause,t+1):String(e.cause)),n}var Je=new Set([`name`,`message`,`stack`,`cause`]);function Ye(e,t){for(let n of Object.getOwnPropertyNames(e)){if(Je.has(n))continue;let r=e[n];r!==void 0&&(t[n]=r)}}function Xe(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r instanceof Error?qe(r):r;return t}function Ze(){return new Date}function Qe(){return typeof navigator>`u`?``:navigator.userAgent}function $e(){return typeof navigator>`u`?!1:navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1}function et(){return/iPhone|iPad|iPod/i.test(Qe())||$e()}function tt(){return/Android/i.test(Qe())}function nt(){return et()||tt()}var rt=class{config;constructor(e){this.config=e}log(e,t,n={}){let r=this.config.traceProvider?.()??{};Ke({timestamp:Ze().toISOString(),level:e,msg:t,service:this.config.service,...r,...Xe(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 it(e,t){return new rt({service:e,isDev:t?.isDev===void 0?typeof process<`u`?process.env.NODE_ENV!==`production`:!0:t.isDev,traceProvider:t?.traceProvider})}function L(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 at(e){return{debug:(t,n)=>e.debug(t,L(n)),info:(t,n)=>e.info(t,L(n)),warn:(t,n)=>e.warn(t,L(n)),error:(t,n)=>e.error(t,L(n))}}var ot=!1,R=at(it(`client`,{isDev:!1}));function st(){ot=!0,R=at(it(`client`,{isDev:!0}))}function ct(){return ot}var lt=class{send;instance;onMutationFailed;registry;pendingCallbacks=[];constructor(e,t,n){this.send=e,this.instance=t,this.onMutationFailed=n}handleMappingReceived(e){R.debug(`Initializing from server mapping`,{attributeCount:e.attributes.length}),this.registry=new ze(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?R.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,t,n=!1){let r={type:u.MUTATION,instance:this.instance,mutations:e,isInitial:t,...n&&{transient:!0}};this.send(r)}replayPendingCallbacks(){for(let{name:e,callback:t}of this.pendingCallbacks){let n=this.registry?.get(e);n===void 0&&R.warn(`onChange: attribute "${e}" not found — buffered callback will not fire`),n?.onChange(t)}this.pendingCallbacks.length=0}},ut=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??[]}},dt=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 M.invalidParameter(`No camera commands to execute. Call rotate(), tilt(), or zoom() before set().`);let e={type:u.CAMERA,commands:this.commands};this.send(e),this.commands=[]}validateFiniteNumber(e,t){if(!Number.isFinite(e))throw M.invalidParameter(`${t}() requires a finite number, got ${String(e)}`)}reset(){let e={type:u.CAMERA,commands:[{action:`reset`}]};this.send(e)}},ft=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 pt(e,t){let n=e.filter(e=>mt(e,t));if(n.length===0)return;let r=Math.max(...n.map(ht)),i=n.filter(e=>ht(e)===r);return i.length===1?i[0]:void 0}function mt(e,t){return Object.entries(e.attributes).every(([e,n])=>t[e]===n)}function ht(e){return Object.keys(e.attributes).length}var gt=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=pt(this.pricing.rules,this.selection);if(e!==void 0&&e.availability!==m.HIDDEN)return{attributes:{...this.selection},reference:e.reference,price:e.priceCents,currency:this.pricing.currency,availability:e.availability}}},_t=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 M.invalidParameter(`set() requires a non-empty component name, got ${String(e)}`);this.send({type:u.FOCUS,instance:this.instance,action:f.FOCUS,component:e})}clear(){this.send({type:u.FOCUS,instance:this.instance,action:f.UNFOCUS})}onChange(e){this.changeCallbacks.push(e)}handleStateReceived(e){e.state===p.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)}},vt=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())}},yt=3e4,bt=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,t){this.validateFilename(e),R.debug(`Taking snapshot`,{filename:e});let n=new vt(e),r=setTimeout(()=>{this.pendingPhotos.delete(e),R.warn(`Snapshot timed out`,{filename:e}),n.fail(new M(`Snapshot timed out: the viewer did not respond within ${yt}ms`,j.SNAPSHOT_FAILED))},yt);return this.pendingPhotos.set(e,{photo:n,timeout:r}),this.send({type:u.SNAPSHOT,filename:e,...t!==void 0&&{subject:t}}),n}handleSnapshotResult(e){let t=this.pendingPhotos.get(e.filename);if(t===void 0){R.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 M(e.error,j.SNAPSHOT_FAILED))}clear(){if(this.pendingPhotos.size===0)return;let e=new M(`Client destroyed before snapshot completed`,j.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 M(`Filename must be a non-empty string`,j.INVALID_PARAMETER);if(!this.validExtensions.some(t=>e.toLowerCase().endsWith(t)))throw new M(`Invalid filename: "${e}". Filename must end with one of: ${this.validExtensions.join(`, `)}`,j.INVALID_PARAMETER);if(e.includes(`..`)||e.includes(`/`)||e.includes(`\\`))throw new M(`Filename cannot contain path separators or ".."`,j.INVALID_PARAMETER)}},xt=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)}}},St=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Bezig…`:n===`de`?`Läuft…`:`Working…`}),Ct=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Mislukt`:n===`de`?`Fehlgeschlagen`:`Failed`}),wt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Gelukt`:n===`de`?`Fertig`:`Done`}),Tt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Annotaties`:n===`de`?`Anmerkungen`:`Annotations`}),Et=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`AR activeren`:n===`de`?`AR aktivieren`:`Activate AR`}),Dt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Camera resetten`:n===`de`?`Kamera zurücksetzen`:`Reset camera`}),Ot=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Naar links draaien`:n===`de`?`Nach links drehen`:`Rotate left`}),kt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Naar rechts draaien`:n===`de`?`Nach rechts drehen`:`Rotate right`}),At=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Omlaag kantelen`:n===`de`?`Nach unten kippen`:`Tilt down`}),jt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Omhoog kantelen`:n===`de`?`Nach oben kippen`:`Tilt up`}),Mt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Inzoomen`:n===`de`?`Hineinzoomen`:`Zoom in`}),Nt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Uitzoomen`:n===`de`?`Herauszoomen`:`Zoom out`}),Pt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Sluiten`:n===`de`?`Schließen`:`Close`}),Ft=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Configureren`:n===`de`?`Konfigurieren`:`Configure`}),It=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Volledig scherm`:n===`de`?`Vollbild`:`Fullscreen`}),Lt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Sluiten`:n===`de`?`Schließen`:`Close`}),Rt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`QR-code`:n===`de`?`QR-Code`:`QR code`}),zt=((e={},t={})=>{let n=t.locale??D();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`}),Bt=((e={},t={})=>{let n=t.locale??D();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.`}),Vt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Scan om in AR te bekijken`:n===`de`?`Scannen für AR-Ansicht`:`Scan to view in AR`}),Ht=((e={},t={})=>{let n=t.locale??D();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:`}),Ut=((e={},t={})=>(t.locale??D(),`Screenshot`)),Wt=((e={},t={})=>{let n=t.locale??D();return n===`nl`?`Downloaden`:n===`de`?`Herunterladen`:`Downloading`}),Gt=((e={},t={})=>{let n=t.locale??D();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.`}),Kt={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},Jt=(e,t={})=>qt([`svg`,{...Kt,...t},e]),Yt=[[`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`}]],Xt=[[`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`}]],Zt=[[`path`,{d:`m6 9 6 6 6-6`}]],Qt=[[`path`,{d:`m15 18-6-6 6-6`}]],$t=[[`path`,{d:`m9 18 6-6-6-6`}]],en=[[`path`,{d:`m18 15-6-6-6 6`}]],tn=[[`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`}]],nn=[[`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`}]],rn=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],an=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],on=[[`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`}]],sn=[[`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`}]],cn=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]],ln=[[`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`}]],un=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]];function z(e,{size:t=20,strokeWidth:n=1.75}={}){return Jt(e,{width:t,height:t,"stroke-width":n})}var B={ar:e=>z(Yt,e),annotations:e=>z(nn,e),annotationsOff:e=>z(tn,e),fullscreen:e=>z(rn,e),exitFullscreen:e=>z(an,e),screenshot:e=>z(Xt,e),tiltUp:e=>z(en,e),tiltDown:e=>z(Zt,e),rotateLeft:e=>z(Qt,e),rotateRight:e=>z($t,e),zoomIn:e=>z(un,e),zoomOut:e=>z(ln,e),reset:e=>z(on,e),configurator:e=>z(sn,e),close:e=>z(cn,e)},V=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)}},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`)}}},fn=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=Jt(Zt,{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))}},pn=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}`}},H={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)`}},U={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`},W={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`}},mn=class{element;constructor(){this.element=document.createElement(`div`),Object.assign(this.element.style,{background:H.white,borderRadius:`var(--radius)`,padding:U[6],boxShadow:`0 ${U[2]} ${U[8]} oklch(0% 0 0 / 20%)`,maxWidth:`20rem`,width:`100%`})}},hn=class{options;card;backdrop;keyHandler=null;constructor(e={}){this.options=e,this.card=new mn,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:U[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}},G=W.fontFamily.sans.join(`, `),gn=`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.VirtualdisplayClient={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),u={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`},d=`main`,f={FOCUS:`focus`,UNFOCUS:`unfocus`},p={FOCUSED:`focused`,UNFOCUSED:`unfocused`},m={AVAILABLE:`available`,VIEW_ONLY:`view_only`,HIDDEN:`hidden`};function h(e){return typeof e!=`object`||!e?null:e}var g=new Set(Object.values(u));function _(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.target!=`string`&&typeof t.type==`string`&&g.has(t.type)}function v(e){let t=h(e);return t!==null&&t.type===u.HANDSHAKE}function y(e){let t=h(e);return t!==null&&t.type===u.SESSION&&typeof t.sessionId==`string`}function b(e){let t=h(e);return t!==null&&t.type===u.APP_RESOLVED&&typeof t.appType==`string`&&t.appType!==``&&typeof t.name==`string`}function x(e){let t=h(e);return t!==null&&t.type===u.PERSONALISED&&typeof t.id==`string`&&t.id!==``&&typeof t.instance==`string`&&t.instance!==``&&typeof t.zone==`string`&&typeof t.ok==`boolean`&&(t.error===void 0||typeof t.error==`string`)}function S(e){return typeof e==`number`&&Number.isFinite(e)}function C(e){let t=h(e);return t!==null&&typeof t.name==`string`&&t.name!==``&&S(t.aspect)&&S(t.widthMm)&&S(t.heightMm)}function ee(e){let t=h(e);return t!==null&&t.type===u.ZONES&&typeof t.instance==`string`&&t.instance!==``&&Array.isArray(t.zones)&&t.zones.every(C)}function te(e){let t=h(e);return t!==null&&t.type===u.MUTATION&&typeof t.instance==`string`&&t.instance!==``&&Array.isArray(t.results)}function ne(e){let t=h(e);return t!==null&&t.type===u.SNAPSHOT&&(`data`in t||`error`in t)}function re(e){let t=h(e);return t!==null&&t.type===u.CAMERA&&Array.isArray(t.transforms)}function ie(e){let t=h(e);return t!==null&&t.type===u.MAPPING&&typeof t.instance==`string`&&t.instance!==``&&Array.isArray(t.attributes)}function ae(e){let t=h(e);return t!==null&&t.type===u.LOADING_INDICATOR&&typeof t.progress==`number`}function oe(e){let t=h(e);return t!==null&&t.type===u.SYNC&&typeof t.connected==`boolean`}function se(e){let t=h(e);return t!==null&&t.type===u.SELECTABLE&&typeof t.instance==`string`&&t.instance!==``&&Array.isArray(t.attributes)}function ce(e){let t=h(e);return t!==null&&t.type===u.CONFIG&&typeof t.viewerSettings==`object`}function le(e){let t=h(e);return t!==null&&t.type===u.FOCUS&&typeof t.instance==`string`&&t.instance!==``&&typeof t.state==`string`}function ue(e){let t=h(e);return t!==null&&t.type===u.PRICING&&typeof t.instance==`string`&&t.instance!==``&&typeof t.pricing==`object`&&t.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??_,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}`)}u.CAMERA,u.LOADING_INDICATOR;var me=class{send;instance;constructor(e,t){this.send=e,this.instance=t}setEnabled(e){this.send({type:u.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`],ve=[`globalVariable`,`baseLocale`],ye=[],be=typeof window>`u`;globalThis.__paraglide=globalThis.__paraglide??{};var w,xe=!1,T=()=>{let e=!be&&ye.length>0&&typeof window<`u`?window.location?.href:void 0,t=Se(e?Be(e):ve,e);if(t)return xe||(w=t,xe=!0,we(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found`)};function Se(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(t===`globalVariable`&&w!==void 0)n=w;else if(Ve(t)&&D.has(t)){let e=D.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return ke(t)}}let e=De(n);if(e)return e}}var Ce=e=>{e?window.location.href=e:window.location.reload()},we=(e,t)=>{let n={reload:!0,...t},r;try{r=T()}catch{}let i=[],a=ve;!be&&typeof window<`u`&&window.location?.href&&(a=Be(window.location.href));for(let t of a)if(t===`globalVariable`)w=e;else if(t===`baseLocale`)continue;else if(Ve(t)&&D.has(t)){let n=D.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=()=>{!be&&n.reload&&window.location&&e!==r&&Ce(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()},Te=()=>typeof window<`u`?window.location.origin:`http://fallback.com`,Ee;function De(e){if(typeof e==`string`)return Ee??=Oe(),Ee.get(e.toLowerCase())}function Oe(){let e=new Map;for(let t of _e){let n=t.toLowerCase();e.has(n)||e.set(n,t)}return e}function ke(e){let t=De(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${_e.join(`, `)}`)}function E(e){return e}function Ae(e,t){return new ge(e,t.href)}function je(){return 0}function Me(e){return ye}function Ne(e,t){return e.exec(t.href)}function Pe(e){return Fe(e)}function Fe(e){let t=E(typeof e==`string`?new URL(e,Te()):new URL(e.href)),n=t.pathname.replace(/^\/+/,``).split(`/`);return n.length>0&&De(n[0])&&(t.pathname=`/`+n.slice(1).join(`/`)),E(t)}var Ie=-1,Le,Re;function ze(e){if(ye.length===0)return;let t=typeof e==`string`?e:e.href,n=je();if(Le===t&&Ie===n)return Re;let r=E(new URL(t,`http://example.com`)),i=Pe(r),a=i.href===r.href?[r]:[r,i],o;for(let e of a){for(let t of Me(e))if(Ne(Ae(t.match,e),e)){o=t;break}if(o)break}return Ie=n,Le=t,Re=o,o}function Be(e){let t=ze(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:ve}var D=new Map;function Ve(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}function He(e,t){return Ue(t!==void 0&&Object.hasOwn(t,e)?t[e]:void 0)??We(e)}function Ue(e){if(e===void 0)return;for(let t of[T(),`nl`,`en`])if(Object.hasOwn(e,t)&&e[t]!==void 0)return e[t];let[t]=Object.values(e);return t}function We(e){let t=e.replace(/([A-Z])/g,` $1`).trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}var O={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`},k=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}"`,O.VALUE_NOT_FOUND)}static parentNotFound(t){return new e(`Parent element not found: ${t}`,O.PARENT_NOT_FOUND)}static invalidParameter(t){return new e(t,O.INVALID_PARAMETER)}},Ge=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 k.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,He(r,t));r===this.defaultValue&&e.setSelected(!0),n.set(r,e)}return n}},Ke=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 Ge(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}}},A=4096,j=16384,qe=[1024,256,64],Je=20,M=[`timestamp`,`level`,`msg`,`service`,`trace_id`,`span_id`];function Ye(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])=>!M.includes(e)).map(([e,t])=>`${e}=${N(t,A).line}`).join(` `);return`${t} ${n} [${r}] ${i}${a?` `+a:``}`}function Xe(e){for(let t of[A,...qe]){let{line:n,truncated:r}=N(e,t);if(!r){if(n.length<=j)return n;continue}let{line:i}=N({...e,log_truncated:!0},t);if(i.length<=j)return i}let t=Object.keys(e).filter(e=>!M.includes(e)),n={...Qe(e,M),log_truncated:!0,log_dropped_count:t.length},r=N({...n,log_dropped_attrs:t.slice(0,Je)},A);return r.line.length<=j?r.line:N(n,A).line}function N(e,t){let n=[],r=!1;return{line:JSON.stringify(e,function(e,i){if(typeof i==`string`)return i.length>t&&(r=!0),Ze(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 Ze(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 $e(e,t){let n=t?Ye(e):Xe(e);e.level===`error`?console.error(n):e.level===`warn`?console.warn(n):console.log(n)}function et(e,t=0){let n={name:e.name,message:e.message};return e.stack!==void 0&&(n.stack=e.stack),nt(e,n),e.cause!==void 0&&e.cause!==null&&(n.cause=e.cause instanceof Error&&t<5?et(e.cause,t+1):String(e.cause)),n}var tt=new Set([`name`,`message`,`stack`,`cause`]);function nt(e,t){for(let n of Object.getOwnPropertyNames(e)){if(tt.has(n))continue;let r=e[n];r!==void 0&&(t[n]=r)}}function rt(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r instanceof Error?et(r):r;return t}function it(){return new Date}function at(){return typeof navigator>`u`?``:navigator.userAgent}function ot(){return typeof navigator>`u`?!1:navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1}function st(){return/iPhone|iPad|iPod/i.test(at())||ot()}function ct(){return/Android/i.test(at())}function lt(){return st()||ct()}var ut=class{config;constructor(e){this.config=e}log(e,t,n={}){let r=this.config.traceProvider?.()??{};$e({timestamp:it().toISOString(),level:e,msg:t,service:this.config.service,...r,...rt(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 dt(e,t){return new ut({service:e,isDev:t?.isDev===void 0?typeof process<`u`?process.env.NODE_ENV!==`production`:!0:t.isDev,traceProvider:t?.traceProvider})}function P(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 ft(e){return{debug:(t,n)=>e.debug(t,P(n)),info:(t,n)=>e.info(t,P(n)),warn:(t,n)=>e.warn(t,P(n)),error:(t,n)=>e.error(t,P(n))}}var pt=!1,F=ft(dt(`client`,{isDev:!1}));function mt(){pt=!0,F=ft(dt(`client`,{isDev:!0}))}function ht(){return pt}var gt=class{send;instance;onMutationFailed;registry;pendingCallbacks=[];constructor(e,t,n){this.send=e,this.instance=t,this.onMutationFailed=n}handleMappingReceived(e){F.debug(`Initializing from server mapping`,{attributeCount:e.attributes.length}),this.registry=new Ke(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?F.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,t,n=!1){let r={type:u.MUTATION,instance:this.instance,mutations:e,isInitial:t,...n&&{transient:!0}};this.send(r)}replayPendingCallbacks(){for(let{name:e,callback:t}of this.pendingCallbacks){let n=this.registry?.get(e);n===void 0&&F.warn(`onChange: attribute "${e}" not found — buffered callback will not fire`),n?.onChange(t)}this.pendingCallbacks.length=0}},_t=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??[]}},vt=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 k.invalidParameter(`No camera commands to execute. Call rotate(), tilt(), or zoom() before set().`);let e={type:u.CAMERA,commands:this.commands};this.send(e),this.commands=[]}validateFiniteNumber(e,t){if(!Number.isFinite(e))throw k.invalidParameter(`${t}() requires a finite number, got ${String(e)}`)}reset(){let e={type:u.CAMERA,commands:[{action:`reset`}]};this.send(e)}},yt=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 bt(e,t){let n=e.filter(e=>xt(e,t));if(n.length===0)return;let r=Math.max(...n.map(St)),i=n.filter(e=>St(e)===r);return i.length===1?i[0]:void 0}function xt(e,t){return Object.entries(e.attributes).every(([e,n])=>t[e]===n)}function St(e){return Object.keys(e.attributes).length}var Ct=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=bt(this.pricing.rules,this.selection);if(e!==void 0&&e.availability!==m.HIDDEN)return{attributes:{...this.selection},reference:e.reference,price:e.priceCents,currency:this.pricing.currency,availability:e.availability}}},wt=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 k.invalidParameter(`set() requires a non-empty component name, got ${String(e)}`);this.send({type:u.FOCUS,instance:this.instance,action:f.FOCUS,component:e})}clear(){this.send({type:u.FOCUS,instance:this.instance,action:f.UNFOCUS})}onChange(e){this.changeCallbacks.push(e)}handleStateReceived(e){e.state===p.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)}},Tt=3e4,Et=`Virtualdisplay: the print zone could not be personalised`,Dt=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(k.invalidParameter(`setImage() takes a zone name`)):t instanceof Blob?this.request(e,t):Promise.reject(k.invalidParameter(`setImage() takes an image as a Blob`))}clear(e){return typeof e!=`string`||e===``?Promise.reject(k.invalidParameter(`clear() takes a zone name`)):this.request(e,null)}get zones(){return this.zoneReport}onZones(e){this.zoneListeners.add(e)}place(e,t){if(typeof e!=`string`||e===``)throw k.invalidParameter(`place() takes a zone name`);if(![t.x,t.y,t.scale].every(Number.isFinite))throw k.invalidParameter(`place() takes x, y and scale as numbers`);if(typeof t.editing!=`boolean`)throw k.invalidParameter(`place() takes editing as true or false`);this.pendingPlacements.set(e,{type:u.PLACE,instance:this.instance,zone:e,x:t.x,y:t.y,scale:t.scale,editing:t.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,t){return new Promise((n,r)=>{this.sequence+=1;let i=String(this.sequence),a=setTimeout(()=>{this.expire(i,e)},Tt);this.pending.set(i,{resolve:n,reject:r,timeout:a}),this.send({type:u.PERSONALISE,id:i,instance:this.instance,zone:e,image:t})})}expire(e,t){let n=this.pending.get(e);n!==void 0&&(this.pending.delete(e),F.warn(`Personalisation timed out`,{zone:t}),n.reject(I(`Virtualdisplay: the viewer did not answer for zone "${t}"`)))}handleReplyReceived(e){let t=this.pending.get(e.id);t===void 0?F.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(I(e.error??Et)))}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(I(`Virtualdisplay: the client was destroyed before the viewer answered`));this.pending.clear()}};function I(e){return new k(e,O.PERSONALISATION_FAILED)}var Ot=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())}},kt=3e4,At=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,t){this.validateFilename(e),F.debug(`Taking snapshot`,{filename:e});let n=new Ot(e),r=setTimeout(()=>{this.pendingPhotos.delete(e),F.warn(`Snapshot timed out`,{filename:e}),n.fail(new k(`Snapshot timed out: the viewer did not respond within ${kt}ms`,O.SNAPSHOT_FAILED))},kt);return this.pendingPhotos.set(e,{photo:n,timeout:r}),this.send({type:u.SNAPSHOT,filename:e,...t!==void 0&&{subject:t}}),n}handleSnapshotResult(e){let t=this.pendingPhotos.get(e.filename);if(t===void 0){F.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 k(e.error,O.SNAPSHOT_FAILED))}clear(){if(this.pendingPhotos.size===0)return;let e=new k(`Client destroyed before snapshot completed`,O.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 k(`Filename must be a non-empty string`,O.INVALID_PARAMETER);if(!this.validExtensions.some(t=>e.toLowerCase().endsWith(t)))throw new k(`Invalid filename: "${e}". Filename must end with one of: ${this.validExtensions.join(`, `)}`,O.INVALID_PARAMETER);if(e.includes(`..`)||e.includes(`/`)||e.includes(`\\`))throw new k(`Filename cannot contain path separators or ".."`,O.INVALID_PARAMETER)}},jt=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)}}},Mt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Bezig…`:n===`de`?`Läuft…`:`Working…`}),Nt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Mislukt`:n===`de`?`Fehlgeschlagen`:`Failed`}),Pt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Gelukt`:n===`de`?`Fertig`:`Done`}),Ft=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Annotaties`:n===`de`?`Anmerkungen`:`Annotations`}),It=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`AR activeren`:n===`de`?`AR aktivieren`:`Activate AR`}),Lt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Camera resetten`:n===`de`?`Kamera zurücksetzen`:`Reset camera`}),Rt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Naar links draaien`:n===`de`?`Nach links drehen`:`Rotate left`}),zt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Naar rechts draaien`:n===`de`?`Nach rechts drehen`:`Rotate right`}),Bt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Omlaag kantelen`:n===`de`?`Nach unten kippen`:`Tilt down`}),Vt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Omhoog kantelen`:n===`de`?`Nach oben kippen`:`Tilt up`}),Ht=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Inzoomen`:n===`de`?`Hineinzoomen`:`Zoom in`}),Ut=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Uitzoomen`:n===`de`?`Herauszoomen`:`Zoom out`}),Wt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Sluiten`:n===`de`?`Schließen`:`Close`}),Gt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Configureren`:n===`de`?`Konfigurieren`:`Configure`}),Kt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Volledig scherm`:n===`de`?`Vollbild`:`Fullscreen`}),qt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Sluiten`:n===`de`?`Schließen`:`Close`}),Jt=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`QR-code`:n===`de`?`QR-Code`:`QR code`}),Yt=((e={},t={})=>{let n=t.locale??T();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`}),Xt=((e={},t={})=>{let n=t.locale??T();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??T();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??T();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:`}),$t=((e={},t={})=>(t.locale??T(),`Screenshot`)),en=((e={},t={})=>{let n=t.locale??T();return n===`nl`?`Downloaden`:n===`de`?`Herunterladen`:`Downloading`}),tn=((e={},t={})=>{let n=t.locale??T();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.`}),nn={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`},rn=([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=rn(e);r.appendChild(t)}),r},an=(e,t={})=>rn([`svg`,{...nn,...t},e]),on=[[`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`}]],sn=[[`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`}]],L=[[`path`,{d:`m6 9 6 6 6-6`}]],cn=[[`path`,{d:`m15 18-6-6 6-6`}]],ln=[[`path`,{d:`m9 18 6-6-6-6`}]],un=[[`path`,{d:`m18 15-6-6-6 6`}]],dn=[[`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`}]],fn=[[`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`}]],pn=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],mn=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],hn=[[`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`}]],gn=[[`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`}]],_n=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]],vn=[[`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`}]],yn=[[`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 R(e,{size:t=20,strokeWidth:n=1.75}={}){return an(e,{width:t,height:t,"stroke-width":n})}var z={ar:e=>R(on,e),annotations:e=>R(fn,e),annotationsOff:e=>R(dn,e),fullscreen:e=>R(pn,e),exitFullscreen:e=>R(mn,e),screenshot:e=>R(sn,e),tiltUp:e=>R(un,e),tiltDown:e=>R(L,e),rotateLeft:e=>R(cn,e),rotateRight:e=>R(ln,e),zoomIn:e=>R(vn,e),zoomOut:e=>R(yn,e),reset:e=>R(hn,e),configurator:e=>R(gn,e),close:e=>R(_n,e),expand:e=>R(L,e)},B=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 bn(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function xn(e,t,n,r,i,a){let[o,s,c]=e,l=Math.cos(t),u=Math.sin(t),d=l*o+u*c,f=-u*o+l*c,p=Math.cos(n),m=Math.sin(n),h=p*s-m*f,g=m*s+p*f,_=.55;return[r+d*a*_,i-h*a*_,g]}function Sn(e,t,n){e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(n[0],n[1]),e.lineWidth=2,e.stroke()}function Cn(e,t,n,r,i){let a=t(n),o=t(r);Sn(e,a,[a[0]+(o[0]-a[0])*i,a[1]+(o[1]-a[1])*i,a[2]])}var V=[-1,-1,1],H=[1,-1,1],U=[1,-1,-1],W=[-1,-1,-1],wn=[-1,1,1],Tn=[1,1,1],En=[1,1,-1],Dn=[-1,1,-1],On=[[V,H],[H,U],[U,W],[W,V],[V,wn],[H,Tn],[U,En],[W,Dn],[wn,Tn],[Tn,En],[En,Dn],[Dn,wn]];function kn(e){let t=e%6/6,n=On.length;return t<.35?bn(t/.35)*n:t<.55?n:t<.9?(1-bn((t-.55)/.35))*n:0}function An(e,{width:t,height:n},r,i=`#000`){let a=t/2,o=n*.44,s=Math.min(t,n)*.08,c=e=>xn(e,.785,.615,a,o,s),l=kn(r);e.shadowBlur=5,e.shadowColor=`rgba(30,30,30,0.08)`,e.strokeStyle=i;for(let t=0;t<On.length&&!(t>=l);t++){let n=On[t];if(n===void 0)continue;let r=Math.min(1,l-t);Cn(e,c,n[0],n[1],r)}e.shadowBlur=0}var jn=400,Mn=3e4,Nn=`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`;function Pn(e){let t=getComputedStyle(e).color,n=t===``?`#000`:t;return{surface:`transparent`,ink:n,danger:n}}function Fn(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:Nn});let o=document.createElement(`span`);return Object.assign(o.style,{fontSize:`13px`,color:e.ink,fontFamily:Nn}),o.textContent=t,i.appendChild(a),i.appendChild(o),n.appendChild(r),n.appendChild(i),{overlay:n,canvas:r,pctEl:a,phaseEl:o}}var In=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??Pn(e),this.text=t.text;let n=Fn(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()},jn),this.noSignalTimerId=setTimeout(()=>{this.hidden||(this.noSignalErrored=!0,this.showError(this.text.loadError()))},Mn)}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),An(this.ctx,{width:e,height:t},n,this.colours.ink)}},Ln=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`)}}},Rn=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=an(L,{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))}},zn=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`}},Bn=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%`})}},Vn=class{options;card;backdrop;keyHandler=null;constructor(e={}){this.options=e,this.card=new Bn,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(`, `),Hn=`
2
2
  :root {
3
3
  --primary: oklch(5% 0 0);
4
4
  --primary-foreground: oklch(100% 0 0);
@@ -22,7 +22,7 @@
22
22
  gap: 0.5rem;
23
23
  border: 1px solid transparent;
24
24
  border-radius: var(--radius);
25
- font-family: ${G};
25
+ font-family: ${J};
26
26
  font-size: 0.875rem;
27
27
  font-weight: 600;
28
28
  white-space: nowrap;
@@ -79,7 +79,7 @@
79
79
  border-radius: var(--radius);
80
80
  background: var(--background);
81
81
  color: var(--foreground);
82
- font-family: ${G};
82
+ font-family: ${J};
83
83
  font-size: 0.875rem;
84
84
  font-weight: 600;
85
85
  cursor: pointer;
@@ -120,7 +120,7 @@
120
120
  background: var(--background);
121
121
  appearance: none;
122
122
  color: var(--foreground);
123
- font-family: ${G};
123
+ font-family: ${J};
124
124
  font-size: 0.875rem;
125
125
  font-weight: 400;
126
126
  cursor: pointer;
@@ -158,7 +158,7 @@
158
158
 
159
159
  /* Tabular figures keep the readout and layout steady mid-drag. */
160
160
  .ui-slider-value {
161
- font-family: ${G};
161
+ font-family: ${J};
162
162
  font-size: 0.875rem;
163
163
  font-weight: 600;
164
164
  color: var(--foreground);
@@ -169,7 +169,7 @@
169
169
  .ui-slider-ends {
170
170
  display: flex;
171
171
  justify-content: space-between;
172
- font-family: ${G};
172
+ font-family: ${J};
173
173
  font-size: 0.75rem;
174
174
  color: var(--muted-foreground);
175
175
  font-variant-numeric: tabular-nums;
@@ -305,7 +305,7 @@
305
305
  border: 2px solid oklch(100% 0 0);
306
306
  background: var(--primary);
307
307
  color: var(--primary-foreground);
308
- font-family: ${G};
308
+ font-family: ${J};
309
309
  font-size: 0.8125rem;
310
310
  font-weight: 600;
311
311
  cursor: pointer;
@@ -394,7 +394,7 @@
394
394
  }
395
395
 
396
396
  .vd-annotation-popup-title {
397
- font-family: ${G};
397
+ font-family: ${J};
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: ${G};
445
+ font-family: ${J};
446
446
  font-size: 0.8125rem;
447
447
  font-weight: 400;
448
448
  line-height: 1.125rem;
@@ -481,19 +481,19 @@ button.vd-annotation-popup-title:focus-visible {
481
481
  0%, 100% { opacity: 1; }
482
482
  50% { opacity: 0.55; }
483
483
  }
484
- `,_n=!1;function vn(){if(_n||typeof document>`u`)return;_n=!0;let e=document.createElement(`style`);e.id=`vd-ui-vanilla`,e.textContent=gn,document.head.appendChild(e)}var yn=s(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),K=s((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),q=s((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),bn=s(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),xn=s(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Sn=s((e=>{var t=K().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Cn=s((e=>{var t=K().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),wn=s((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),Tn=s((e=>{var t=q(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),En=s((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Dn=s((e=>{var t=En();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),On=s(((e,t)=>{var n=Dn();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),kn=s((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),An=s((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
485
- ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),J=s((e=>{var t=kn(),n=An();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),jn=s((e=>{var t=K(),n=Tn(),r=q(),i=J(),a=kn(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Mn=s((e=>{var t=K(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Nn=s(((e,t)=>{var n=J();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Pn=s(((e,t)=>{var n=J(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Fn=s(((e,t)=>{var n=J();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),In=s(((e,t)=>{var n=J(),r=K();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
486
- Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Ln=s(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Rn=s((e=>{var t=J(),n=Nn(),r=Pn(),i=Fn(),a=In(),o=An(),s=K(),c=Ln();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
487
- Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),zn=s((e=>{var t=K(),n=q(),r=bn(),i=xn(),a=Sn(),o=Cn(),s=wn(),c=Tn(),l=On(),u=jn(),d=Mn(),f=J(),p=Rn();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
484
+ `,Un=!1;function Wn(){if(Un||typeof document>`u`)return;Un=!0;let e=document.createElement(`style`);e.id=`vd-ui-vanilla`,e.textContent=Hn,document.head.appendChild(e)}var Gn=s(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),Y=s((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),Kn=s((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),qn=s(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Jn=s(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Yn=s((e=>{var t=Y().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Xn=s((e=>{var t=Y().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Zn=s((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),Qn=s((e=>{var t=Kn(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),$n=s((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),er=s((e=>{var t=$n();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),tr=s(((e,t)=>{var n=er();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),nr=s((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),rr=s((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
485
+ ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),X=s((e=>{var t=nr(),n=rr();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),ir=s((e=>{var t=Y(),n=Qn(),r=Kn(),i=X(),a=nr(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),ar=s((e=>{var t=Y(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),or=s(((e,t)=>{var n=X();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),sr=s(((e,t)=>{var n=X(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),cr=s(((e,t)=>{var n=X();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),lr=s(((e,t)=>{var n=X(),r=Y();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
486
+ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),ur=s(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),dr=s((e=>{var t=X(),n=or(),r=sr(),i=cr(),a=lr(),o=rr(),s=Y(),c=ur();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
487
+ Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),fr=s((e=>{var t=Y(),n=Kn(),r=qn(),i=Jn(),a=Yn(),o=Xn(),s=Zn(),c=Qn(),l=tr(),u=ir(),d=ar(),f=X(),p=dr();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
488
488
  The chosen QR Code version cannot contain this amount of data.
489
489
  Minimum version required to store current data is: `+c+`.
490
- `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Bn=s((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Vn=s((e=>{var t=Bn();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o!==void 0||i&&i.getContext||(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i!==void 0||n&&n.getContext||(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Hn=s((e=>{var t=Bn();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
491
- `;return typeof a==`function`&&a(null,p),p}})),Un=s((e=>{var t=yn(),n=zn(),r=Vn(),i=Hn();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})})),Wn=W.fontFamily.sans.join(`, `),Gn=class{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),vn(),this.dialog=new hn({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.content.style,{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:U[3],fontFamily:Wn}),this.dialog.content.appendChild(this.createText(Vt(),{fontSize:W.fontSize.base,fontWeight:W.fontWeight.semibold,color:H.neutral[900]})),this.dialog.content.appendChild(this.createText(zt(),{fontSize:W.fontSize.sm,color:H.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.content.appendChild(this.qrSlot),this.dialog.content.appendChild(this.createText(Bt(),{fontSize:W.fontSize.xs,color:H.neutral[500]}));let e=new V({variant:`outline`,label:Lt(),onClick:()=>{this.hide()}});this.dialog.content.appendChild(e.element),this.dialog.open()}async update(e){let t;try{this.qrLib??=await Promise.resolve().then(()=>l(Un(),1)),t=await this.qrLib.toDataURL(e,{width:256,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000`,light:`#ffffff`}})}catch(t){throw this.showLink(e),t}return this.qrSlot!==null&&(this.qrSlot.classList.remove(`ui-qr-slot--loading`),this.qrSlot.replaceChildren(this.createQrImage(t)),!0)}showLink(e){this.qrSlot!==null&&(this.qrSlot.classList.remove(`ui-qr-slot--loading`),this.qrSlot.replaceChildren(this.createText(Ht(),{fontSize:W.fontSize.sm,color:H.neutral[600]}),this.createText(e,{fontSize:W.fontSize.xs,color:H.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=Rt(),t}};function Kn(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function qn(e,t,n,r,i,a){let[o,s,c]=e,l=Math.cos(t),u=Math.sin(t),d=l*o+u*c,f=-u*o+l*c,p=Math.cos(n),m=Math.sin(n),h=p*s-m*f,g=m*s+p*f,_=.55;return[r+d*a*_,i-h*a*_,g]}function Jn(e,t,n){e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(n[0],n[1]),e.lineWidth=2,e.stroke()}function Yn(e,t,n,r,i){let a=t(n),o=t(r);Jn(e,a,[a[0]+(o[0]-a[0])*i,a[1]+(o[1]-a[1])*i,a[2]])}var Xn=[-1,-1,1],Zn=[1,-1,1],Qn=[1,-1,-1],$n=[-1,-1,-1],er=[-1,1,1],tr=[1,1,1],nr=[1,1,-1],Y=[-1,1,-1],rr=[[Xn,Zn],[Zn,Qn],[Qn,$n],[$n,Xn],[Xn,er],[Zn,tr],[Qn,nr],[$n,Y],[er,tr],[tr,nr],[nr,Y],[Y,er]];function ir(e){let t=e%6/6,n=rr.length;return t<.35?Kn(t/.35)*n:t<.55?n:t<.9?(1-Kn((t-.55)/.35))*n:0}function ar(e,{width:t,height:n},r,i){let a=t/2,o=n*.44,s=Math.min(t,n)*.08,c=e=>qn(e,.785,.615,a,o,s),l=ir(r);e.shadowBlur=5,e.shadowColor=`rgba(30,30,30,0.08)`,e.strokeStyle=i;for(let t=0;t<rr.length&&!(t>=l);t++){let n=rr[t];if(n===void 0)continue;let r=Math.min(1,l-t);Yn(e,c,n[0],n[1],r)}e.shadowBlur=0}var or=400,sr=3e4,cr=`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`;function lr(e){let t=document.createElement(`div`);Object.assign(t.style,{position:`absolute`,inset:`0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:`transparent`,color:e,zIndex:`20`,opacity:`0`,transition:`opacity 0.3s ease-in-out`});let n=document.createElement(`canvas`);Object.assign(n.style,{width:`100%`,height:`100%`,position:`absolute`,inset:`0`});let r=document.createElement(`div`);Object.assign(r.style,{position:`absolute`,top:`56%`,left:`0`,right:`0`,textAlign:`center`,pointerEvents:`none`});let i=document.createElement(`span`);Object.assign(i.style,{fontSize:`13px`,fontWeight:`400`,fontVariantNumeric:`tabular-nums`,fontFamily:cr});let a=document.createElement(`span`);return Object.assign(a.style,{fontSize:`13px`,fontFamily:cr}),a.textContent=Wt(),r.appendChild(i),r.appendChild(a),t.appendChild(n),t.appendChild(r),{overlay:t,canvas:n,pctEl:i,phaseEl:a}}var ur=class{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;noSignalTimerId=null;startTime;textColor;hidden=!1;visible=!1;errored=!1;noSignalErrored=!1;constructor(e){this.startTime=performance.now();let t=getComputedStyle(e).color;this.textColor=t===``?`#000`:t;let n=lr(this.textColor);this.overlay=n.overlay,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()},or),this.noSignalTimerId=setTimeout(()=>{this.hidden||(this.noSignalErrored=!0,this.showError(Gt()))},sr)}viewerAlive(){this.cancelNoSignalTimer(),this.noSignalErrored&&this.recoverFromNoSignal()}recoverFromNoSignal(){this.noSignalErrored=!1,this.errored=!1,this.pctEl.textContent=``,this.phaseEl.textContent=Wt(),this.ctx!==null&&this.animationId===null&&!this.hidden&&this.tick()}updateProgress(e,t){this.cancelNoSignalTimer(),!(this.hidden||this.errored)&&(this.pctEl.textContent=`${Math.round(e)}%`,this.phaseEl.textContent=t===``?``:` \u00B7 ${t}`)}showError(e){if(this.cancelNoSignalTimer(),this.hidden=!1,this.errored=!0,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.ctx!==null){let e=Math.min(devicePixelRatio,2),t=this.canvas.width/e,n=this.canvas.height/e;this.ctx.clearRect(0,0,t,n)}this.pctEl.textContent=``,this.phaseEl.textContent=e,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`)}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),ar(this.ctx,{width:e,height:t},n,this.textColor)}},dr=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?B.exitFullscreen():B.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 V({variant:`outline`,size:`icon`,label:Et(),icon:B.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,e.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new V({variant:`outline`,size:`icon`,label:It(),icon:B.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 V({variant:`outline`,size:`icon`,label:Tt(),icon:this.annotationsShown?B.annotations():B.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?B.annotations():B.annotationsOff()),this.options.onAnnotationsToggle?.(this.annotationsShown)}destroy(){document.removeEventListener(`fullscreenchange`,this.onFullscreenChange)}},X=.5,fr=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=vr(t,n,r);n.onChange(e=>{r.targetRotation=e.rotation-r.thetaOffset,r.targetTilt=e.tilt,r.targetZoom=e.zoom,yr(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 pr(e,t){let n=e;for(;n<t;)n+=360;for(;n>=t+360;)n-=360;return n}function mr(e,t,n){let r=pr(e,t);return r<=n?r:r-n<=t+360-r?n:t}function Z(e,t,n){return new V({variant:`outline`,size:`icon`,label:e,icon:t,onClick:n})}function hr(e,t){return Math.max(e.limits?.minZoom??1,Math.min(e.limits?.maxZoom??1/0,t))}function gr(e,t){let n=e.limits?.minRotate,r=e.limits?.maxRotate;return n===void 0||r===void 0||r-n>=360?t:mr(t,n,r)}function _r(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 vr(e,t,n){let r=r=>{n.targetZoom=hr(t,n.targetZoom+r),e.zoom(n.targetZoom).set()},i=r=>{n.targetRotation=gr(t,n.targetRotation+r),e.rotate(n.targetRotation+n.thetaOffset).set()};return{zoomOut:Z(Nt(),B.zoomOut(),()=>{r(-10)}),zoomIn:Z(Mt(),B.zoomIn(),()=>{r(10)}),tiltUp:Z(jt(),B.tiltUp(),()=>{_r(e,t,n,-15)}),rotateLeft:Z(Ot(),B.rotateLeft(),()=>{i(-15)}),reset:Z(Dt(),B.reset(),()=>{n.thetaOffset=0,e.reset()}),rotateRight:Z(kt(),B.rotateRight(),()=>{i(15)}),tiltDown:Z(At(),B.tiltDown(),()=>{_r(e,t,n,15)})}}function yr(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=pr(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`},br={mm:1,cm:10,m:1e3,in:25.4},xr=3;function Sr(e){let t=e.stepMm/br[e.displayUnit];for(let e=0;e<=xr;e++){let n=t*10**e;if(Math.abs(n-Math.round(n))<1e-9)return e}return xr}function Cr(e,t,n){let r=Sr(t),i=e/br[t.displayUnit];return new Intl.NumberFormat(n,{minimumFractionDigits:r,maximumFractionDigits:r}).format(i)}function wr(e,t,n,r,i,a,o){let s=D(),c=e.values.map(e=>Cr(Number(e),t,s)),l=e.values.find(t=>n.getValue(e.name,t)?.isSelected===!0)??e.defaultValue,u=new pn(e.values,{label:e.name,labels:c,unit:t.displayUnit,...l!==void 0&&{initialSelected:l}});return u.onSelect(t=>{i(e.name,t)}),u.onSettle(t=>{r.dispatch(Q.SELECT,{attribute:e.name,value:t},!0).defaultPrevented||a(e.name,t)}),o(e.name,t=>{u.setSelected(t.value),r.dispatch(Q.SELECTED,{attribute:e.name,value:t.value})}),{element:u.element,setSelectable:()=>{}}}var Tr=5,Er=0;function Dr(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=Le(e.name),s.id=`vd-attribute-label-${Er++}`,o.appendChild(s),o.setAttribute(`role`,`group`),o.setAttribute(`aria-labelledby`,s.id);let c=e=>{o.style.display=e?`none`:``},l=e.dimension===void 0?Or(e,t,n,r,a):wr(e,e.dimension,t,n,i,r,a);return o.appendChild(l.element),{element:o,setSelectable:l.setSelectable,setHidden:c}}function Or(e,t,n,r,i){let a=e.values.find(n=>t.getValue(e.name,n)?.isSelected===!0),o=e.values.map(t=>Fe(t,e.labels)),s=e.values.length<=Tr?new dn(e.values,a,o):new fn(e.name,e.values,Le(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 kr=80,Ar=2500,jr=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 V({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=Mr(this.configuration.vatDisplay))}renderButton(){let e=this.configuration.submitEnabled;this.button.element.classList.toggle(`vd-hidden`,!e),e&&this.state===`idle`&&this.setButtonText(Mr(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!==`busy`){this.setState(`busy`,St());try{await this.configuration.submit(),this.setState(`success`,wt())}catch(e){if(e instanceof DOMException&&e.name===`AbortError`){this.setState(`idle`,Mr(this.configuration.buttonLabel));return}R.warn(`Commerce submit failed`,{error:e}),this.setState(`failed`,Ct())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state=`idle`,this.update()},Ar)}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 Mr(e){return(e??``).slice(0,kr)}function Nr(e,t){try{let n=new Intl.NumberFormat(D(),{style:`currency`,currency:t}),r=n.resolvedOptions().maximumFractionDigits??2;return n.format(e/10**r)}catch{return`${t} ${(e/100).toFixed(2)}`}}var Pr=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}},Fr=572,Ir=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 V({variant:`ghost`,size:`icon-sm`,label:Pt(),icon:B.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 V({variant:`outline`,size:`icon`,label:Ft(),icon:B.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<Fr)}),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)}},Lr=class{attach(e,t){}setVisible(e){}destroy(){}},Rr={"inframe-bottom-left":()=>new Pr,"sidebar-right":e=>new Ir(e),hidden:()=>new Lr};function zr(e,t){return(Rr[e??``]??(()=>new Pr))(t)}var Br=W.fontFamily.sans.join(`, `),$=`
490
+ `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),pr=s((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),mr=s((e=>{var t=pr();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o!==void 0||i&&i.getContext||(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i!==void 0||n&&n.getContext||(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),hr=s((e=>{var t=pr();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
491
+ `;return typeof a==`function`&&a(null,p),p}})),gr=s((e=>{var t=Gn(),n=fr(),r=mr(),i=hr();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})})),_r=q.fontFamily.sans.join(`, `),vr=class{qrLib=null;dialog=null;qrSlot=null;show(){this.hide(),Wn(),this.dialog=new Vn({onClose:()=>{this.dialog=null,this.qrSlot=null}}),Object.assign(this.dialog.content.style,{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:K[3],fontFamily:_r}),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(Yt(),{fontSize:q.fontSize.sm,color:G.neutral[600]})),this.qrSlot=this.createQrSlot(),this.dialog.content.appendChild(this.qrSlot),this.dialog.content.appendChild(this.createText(Xt(),{fontSize:q.fontSize.xs,color:G.neutral[500]}));let e=new B({variant:`outline`,label:qt(),onClick:()=>{this.hide()}});this.dialog.content.appendChild(e.element),this.dialog.open()}async update(e){let t;try{this.qrLib??=await Promise.resolve().then(()=>l(gr(),1)),t=await this.qrLib.toDataURL(e,{width:256,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000`,light:`#ffffff`}})}catch(t){throw this.showLink(e),t}return this.qrSlot!==null&&(this.qrSlot.classList.remove(`ui-qr-slot--loading`),this.qrSlot.replaceChildren(this.createQrImage(t)),!0)}showLink(e){this.qrSlot!==null&&(this.qrSlot.classList.remove(`ui-qr-slot--loading`),this.qrSlot.replaceChildren(this.createText(Qt(),{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=Jt(),t}},yr=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?z.exitFullscreen():z.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 B({variant:`outline`,size:`icon`,label:It(),icon:z.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,e.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new B({variant:`outline`,size:`icon`,label:Kt(),icon:z.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 B({variant:`outline`,size:`icon`,label:Ft(),icon:this.annotationsShown?z.annotations():z.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?z.annotations():z.annotationsOff()),this.options.onAnnotationsToggle?.(this.annotationsShown)}destroy(){document.removeEventListener(`fullscreenchange`,this.onFullscreenChange)}},Z=.5,br=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=Er(t,n,r);n.onChange(e=>{r.targetRotation=e.rotation-r.thetaOffset,r.targetTilt=e.tilt,r.targetZoom=e.zoom,Dr(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 xr(e,t){let n=e;for(;n<t;)n+=360;for(;n>=t+360;)n-=360;return n}function Sr(e,t,n){let r=xr(e,t);return r<=n?r:r-n<=t+360-r?n:t}function Q(e,t,n){return new B({variant:`outline`,size:`icon`,label:e,icon:t,onClick:n})}function Cr(e,t){return Math.max(e.limits?.minZoom??1,Math.min(e.limits?.maxZoom??1/0,t))}function wr(e,t){let n=e.limits?.minRotate,r=e.limits?.maxRotate;return n===void 0||r===void 0||r-n>=360?t:Sr(t,n,r)}function Tr(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 Er(e,t,n){let r=r=>{n.targetZoom=Cr(t,n.targetZoom+r),e.zoom(n.targetZoom).set()},i=r=>{n.targetRotation=wr(t,n.targetRotation+r),e.rotate(n.targetRotation+n.thetaOffset).set()};return{zoomOut:Q(Ut(),z.zoomOut(),()=>{r(-10)}),zoomIn:Q(Ht(),z.zoomIn(),()=>{r(10)}),tiltUp:Q(Vt(),z.tiltUp(),()=>{Tr(e,t,n,-15)}),rotateLeft:Q(Rt(),z.rotateLeft(),()=>{i(-15)}),reset:Q(Lt(),z.reset(),()=>{n.thetaOffset=0,e.reset()}),rotateRight:Q(zt(),z.rotateRight(),()=>{i(15)}),tiltDown:Q(Bt(),z.tiltDown(),()=>{Tr(e,t,n,15)})}}function Dr(e,t,n){let r=t.limits;if(r===void 0)return;e.zoomOut.element.disabled=r.minZoom!==void 0&&n.zoom<=r.minZoom+Z,e.zoomIn.element.disabled=r.maxZoom!==void 0&&n.zoom>=r.maxZoom-Z,e.tiltUp.element.disabled=r.minTilt!==void 0&&n.tilt<=r.minTilt+Z,e.tiltDown.element.disabled=r.maxTilt!==void 0&&n.tilt>=r.maxTilt-Z;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=xr(n.rotation,i);e.rotateLeft.element.disabled=o<=i+Z,e.rotateRight.element.disabled=o>=a-Z}var $={SELECT:`vd:select`,SELECTED:`vd:selected`,FOCUS_CHANGE:`vd:focus-change`,CONFIGURATION_CHANGE:`vd:configuration-change`,CONFIGURATION_SUBMIT:`vd:configuration-submit`};function Or(e,t,n,r,i,a,o){let s=e.values.find(t=>n.getValue(e.name,t)?.isSelected===!0)??e.defaultValue,c=new zn(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($.SELECT,{attribute:e.name,value:t},!0).defaultPrevented||a(e.name,t)}),o(e.name,t=>{c.setSelected(t.value),r.dispatch($.SELECTED,{attribute:e.name,value:t.value})}),{element:c.element,setSelectable:()=>{}}}var kr={mm:1,cm:10,m:1e3,in:25.4};function Ar(e,t){return e/kr[t]}var jr=3;function Mr(e){let t=Ar(e.stepMm,e.displayUnit);for(let e=0;e<=jr;e++){let n=t*10**e;if(Math.abs(n-Math.round(n))<1e-9)return e}return jr}function Nr(e,t,n){let r=Mr(t),i=Ar(e,t.displayUnit);return new Intl.NumberFormat(n,{minimumFractionDigits:r,maximumFractionDigits:r}).format(i)}function Pr(e,t,n){return{labels:e.values.map(e=>Nr(Number(e),t,n)),unit:t.displayUnit}}var Fr=20;function Ir(e,t){let n=new Intl.NumberFormat(t,{maximumFractionDigits:Fr});return{labels:e.numbers.map(e=>n.format(e)),unit:e.unit}}var Lr=5,Rr=0;function zr(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=We(e.name),s.id=`vd-attribute-label-${Rr++}`,o.appendChild(s),o.setAttribute(`role`,`group`),o.setAttribute(`aria-labelledby`,s.id);let c=e=>{o.style.display=e?`none`:``},l=Br(e),u=l===void 0?Vr(e,t,n,r,a):Or(e,l,t,n,i,r,a);return o.appendChild(u.element),{element:o,setSelectable:u.setSelectable,setHidden:c}}function Br(e){if(e.dimension!==void 0)return Pr(e,e.dimension,T());if(e.size!==void 0)return Ir(e.size,T())}function Vr(e,t,n,r,i){let a=e.values.find(n=>t.getValue(e.name,n)?.isSelected===!0),o=e.values.map(t=>He(t,e.labels)),s=e.values.length<=Lr?new Ln(e.values,a,o):new Rn(e.name,e.values,We(e.name),a,o);return s.onSelect(t=>{n.dispatch($.SELECT,{attribute:e.name,value:t},!0).defaultPrevented||r(e.name,t)}),i(e.name,t=>{s.setSelected(t.value),n.dispatch($.SELECTED,{attribute:e.name,value:t.value})}),{element:s.element,setSelectable:e=>{s.setEnabled(e)}}}var Hr=80,Ur=2500,Wr=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 B({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=Kr(e.price,e.currency),this.vatEl.textContent=Gr(this.configuration.vatDisplay))}renderButton(){let e=this.configuration.submitEnabled;this.button.element.classList.toggle(`vd-hidden`,!e),e&&this.state===`idle`&&this.setButtonText(Gr(this.configuration.buttonLabel))}async handleSubmit(){if(this.state!==`busy`){this.setState(`busy`,Mt());try{await this.configuration.submit(),this.setState(`success`,Pt())}catch(e){if(e instanceof DOMException&&e.name===`AbortError`){this.setState(`idle`,Gr(this.configuration.buttonLabel));return}F.warn(`Commerce submit failed`,{error:e}),this.setState(`failed`,Nt())}this.scheduleReset()}}scheduleReset(){this.resetTimer!==void 0&&clearTimeout(this.resetTimer),this.resetTimer=setTimeout(()=>{this.state=`idle`,this.update()},Ur)}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 Gr(e){return(e??``).slice(0,Hr)}function Kr(e,t){try{let n=new Intl.NumberFormat(T(),{style:`currency`,currency:t}),r=n.resolvedOptions().maximumFractionDigits??2;return n.format(e/10**r)}catch{return`${t} ${(e/100).toFixed(2)}`}}var qr=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}},Jr=572,Yr=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 B({variant:`ghost`,size:`icon-sm`,label:Wt(),icon:z.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 B({variant:`outline`,size:`icon`,label:Gt(),icon:z.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<Jr)}),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)}},Xr=class{attach(e,t){}setVisible(e){}destroy(){}},Zr={"inframe-bottom-left":()=>new qr,"sidebar-right":e=>new Yr(e),hidden:()=>new Xr};function Qr(e,t){return(Zr[e??``]??(()=>new qr))(t)}var $r=q.fontFamily.sans.join(`, `),ei=`
492
492
  position: absolute;
493
493
  display: flex;
494
494
  z-index: 10;
495
495
  transition: inset-inline-end 0.18s ease;
496
- `,Vr=`
496
+ `,ti=`
497
497
  /* Override browser's default black fullscreen backdrop */
498
498
  .vd-container:fullscreen {
499
499
  background: oklch(100% 0 0);
@@ -501,52 +501,52 @@ Minimum version required to store current data is: `+c+`.
501
501
 
502
502
  /* Layout slots — four corners */
503
503
  .vd-slot-top-right {
504
- ${$}
505
- inset-block-start: ${U[3]};
506
- inset-inline-end: ${U[3]};
504
+ ${ei}
505
+ inset-block-start: ${K[3]};
506
+ inset-inline-end: ${K[3]};
507
507
  flex-direction: column;
508
508
  align-items: flex-end;
509
- gap: ${U[1.5]};
509
+ gap: ${K[1.5]};
510
510
  }
511
511
 
512
512
  .vd-slot-bottom-left {
513
- ${$}
514
- inset-block-end: ${U[3]};
515
- inset-inline-start: ${U[3]};
513
+ ${ei}
514
+ inset-block-end: ${K[3]};
515
+ inset-inline-start: ${K[3]};
516
516
  flex-direction: column;
517
517
  align-items: flex-start;
518
- gap: ${U[1.5]};
518
+ gap: ${K[1.5]};
519
519
  }
520
520
 
521
521
  .vd-slot-bottom-right {
522
- ${$}
523
- inset-block-end: ${U[3]};
524
- inset-inline-end: ${U[3]};
522
+ ${ei}
523
+ inset-block-end: ${K[3]};
524
+ inset-inline-end: ${K[3]};
525
525
  flex-direction: row;
526
- gap: ${U[1.5]};
526
+ gap: ${K[1.5]};
527
527
  }
528
528
 
529
529
  /* Component styles — no positioning */
530
530
  .vd-camera-controls {
531
531
  display: flex;
532
532
  flex-direction: column;
533
- gap: ${U[1]};
534
- background: color-mix(in oklch, ${H.white} 85%, transparent);
533
+ gap: ${K[1]};
534
+ background: color-mix(in oklch, ${G.white} 85%, transparent);
535
535
  backdrop-filter: blur(8px);
536
- border-radius: ${U[2]};
537
- padding: ${U[2]};
536
+ border-radius: ${K[2]};
537
+ padding: ${K[2]};
538
538
  }
539
539
 
540
540
  .vd-zoom {
541
541
  display: flex;
542
- gap: ${U[.5]};
542
+ gap: ${K[.5]};
543
543
  }
544
544
 
545
545
  .vd-dpad {
546
546
  display: grid;
547
- grid-template-columns: repeat(3, ${U[9]});
548
- grid-template-rows: repeat(3, ${U[9]});
549
- gap: ${U[.5]};
547
+ grid-template-columns: repeat(3, ${K[9]});
548
+ grid-template-rows: repeat(3, ${K[9]});
549
+ gap: ${K[.5]};
550
550
  }
551
551
 
552
552
  .vd-dpad-up { grid-column: 2; grid-row: 1; }
@@ -558,30 +558,30 @@ Minimum version required to store current data is: `+c+`.
558
558
  .vd-attributes {
559
559
  display: flex;
560
560
  flex-direction: column;
561
- gap: ${U[3]};
562
- background: color-mix(in oklch, ${H.white} 85%, transparent);
561
+ gap: ${K[3]};
562
+ background: color-mix(in oklch, ${G.white} 85%, transparent);
563
563
  backdrop-filter: blur(8px);
564
- border: 1px solid color-mix(in oklch, ${H.neutral[900]} 8%, transparent);
565
- border-radius: ${U[3]};
566
- padding: ${U[3]};
567
- box-shadow: 0 ${U[1]} ${U[4]} color-mix(in oklch, ${H.neutral[900]} 6%, transparent);
568
- font-family: ${Br};
564
+ border: 1px solid color-mix(in oklch, ${G.neutral[900]} 8%, transparent);
565
+ border-radius: ${K[3]};
566
+ padding: ${K[3]};
567
+ box-shadow: 0 ${K[1]} ${K[4]} color-mix(in oklch, ${G.neutral[900]} 6%, transparent);
568
+ font-family: ${$r};
569
569
  }
570
570
 
571
571
  .vd-attribute {
572
572
  display: flex;
573
573
  flex-direction: column;
574
- gap: ${U[1.5]};
574
+ gap: ${K[1.5]};
575
575
  }
576
576
 
577
577
  /* Micro-label: recedes so the controls lead. */
578
578
  .vd-attribute-label {
579
- font-size: ${W.fontSize.xs};
580
- font-weight: ${W.fontWeight.medium};
581
- color: ${H.neutral[500]};
579
+ font-size: ${q.fontSize.xs};
580
+ font-weight: ${q.fontWeight.medium};
581
+ color: ${G.neutral[500]};
582
582
  text-transform: uppercase;
583
583
  letter-spacing: 0.05em;
584
- font-family: ${Br};
584
+ font-family: ${$r};
585
585
  }
586
586
 
587
587
  /* sidebar-right layout — a docked, full-height right panel */
@@ -617,10 +617,10 @@ Minimum version required to store current data is: `+c+`.
617
617
  z-index: 11;
618
618
  display: flex;
619
619
  flex-direction: column;
620
- background: color-mix(in oklch, ${H.white} 90%, transparent);
620
+ background: color-mix(in oklch, ${G.white} 90%, transparent);
621
621
  backdrop-filter: blur(10px);
622
- border-inline-start: 1px solid color-mix(in oklch, ${H.neutral[900]} 8%, transparent);
623
- box-shadow: -${U[1]} 0 ${U[4]} color-mix(in oklch, ${H.neutral[900]} 5%, transparent);
622
+ border-inline-start: 1px solid color-mix(in oklch, ${G.neutral[900]} 8%, transparent);
623
+ box-shadow: -${K[1]} 0 ${K[4]} color-mix(in oklch, ${G.neutral[900]} 5%, transparent);
624
624
  }
625
625
 
626
626
  @media (prefers-reduced-motion: no-preference) {
@@ -632,13 +632,13 @@ Minimum version required to store current data is: `+c+`.
632
632
  .vd-sidebar-header {
633
633
  display: flex;
634
634
  justify-content: flex-end;
635
- padding: ${U[1.5]} ${U[1.5]} 0;
635
+ padding: ${K[1.5]} ${K[1.5]} 0;
636
636
  }
637
637
 
638
638
  .vd-sidebar-body {
639
639
  flex: 1;
640
640
  overflow-y: auto;
641
- padding: ${U[4]};
641
+ padding: ${K[4]};
642
642
  }
643
643
 
644
644
  /* attributes inside the sidebar: flat and full-width — the panel provides the frosting */
@@ -649,38 +649,38 @@ Minimum version required to store current data is: `+c+`.
649
649
  border-radius: 0;
650
650
  padding: 0;
651
651
  box-shadow: none;
652
- gap: ${U[5]};
652
+ gap: ${K[5]};
653
653
  }
654
654
 
655
655
  /* while the panel is open, keep the corner controls clear of it */
656
- .vd-layout-sidebar-right .vd-slot-top-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${U[3]}); }
657
- .vd-layout-sidebar-right .vd-slot-bottom-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${U[3]}); }
656
+ .vd-layout-sidebar-right .vd-slot-top-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${K[3]}); }
657
+ .vd-layout-sidebar-right .vd-slot-bottom-right { inset-inline-end: calc(var(--vd-sidebar-width) + ${K[3]}); }
658
658
 
659
659
  /* Price + CTA — sit under the attribute controls, separated by a hairline */
660
660
  .vd-commerce {
661
661
  display: flex;
662
662
  flex-direction: column;
663
- gap: ${U[2]};
664
- padding-block-start: ${U[3]};
665
- border-block-start: 1px solid color-mix(in oklch, ${H.neutral[900]} 8%, transparent);
666
- font-family: ${Br};
663
+ gap: ${K[2]};
664
+ padding-block-start: ${K[3]};
665
+ border-block-start: 1px solid color-mix(in oklch, ${G.neutral[900]} 8%, transparent);
666
+ font-family: ${$r};
667
667
  }
668
668
 
669
669
  .vd-commerce-price {
670
670
  display: flex;
671
671
  align-items: baseline;
672
- gap: ${U[1.5]};
672
+ gap: ${K[1.5]};
673
673
  }
674
674
 
675
675
  .vd-price {
676
- font-size: ${W.fontSize.lg};
677
- font-weight: ${W.fontWeight.semibold};
678
- color: ${H.neutral[900]};
676
+ font-size: ${q.fontSize.lg};
677
+ font-weight: ${q.fontWeight.semibold};
678
+ color: ${G.neutral[900]};
679
679
  }
680
680
 
681
681
  .vd-vat {
682
- font-size: ${W.fontSize.xs};
683
- color: ${H.neutral[500]};
682
+ font-size: ${q.fontSize.xs};
683
+ color: ${G.neutral[500]};
684
684
  }
685
685
 
686
686
  .vd-cta {
@@ -690,9 +690,9 @@ Minimum version required to store current data is: `+c+`.
690
690
 
691
691
  /* Failed submit is the one place red belongs: a clear, recoverable error state. */
692
692
  .vd-commerce[data-submit="failed"] .vd-cta {
693
- background: ${H.semantic.error};
694
- border-color: ${H.semantic.error};
695
- color: ${H.white};
693
+ background: ${G.semantic.error};
694
+ border-color: ${G.semantic.error};
695
+ color: ${G.white};
696
696
  }
697
697
 
698
- `;function Hr(){if(vn(),document.getElementById(`vd-styles`)!==null)return;let e=document.createElement(`style`);e.id=`vd-styles`,e.textContent=Vr,document.head.appendChild(e)}function Ur(e,t){let n=document.createElement(`a`);n.href=`data:image/png;base64,${e}`,n.download=t,n.click()}var Wr=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){Hr(),this.container=e,this.loading=new ur(e),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 dr({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=>{R.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&&ye(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=Dr(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 jr(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=zr(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 fr(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 V({variant:`outline`,size:`icon`,label:Ut(),icon:B.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,Ur(t,n)}).onError(t=>{e.element.disabled=!1,R.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))}},Gr=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)&&R.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 M.parentNotFound(this.options.parent);return e}};function Kr(e){let{messenger:t}=e;t.on(u.HANDSHAKE,n=>{v(n)&&(R.info(`Server handshake received, flushing publisher queue`),t.markReady(),e.ui.viewerAlive())}),t.on(u.SESSION,t=>{y(t)&&e.onSession(t.sessionId)}),t.on(u.MUTATION,t=>{x(t)&&(e.attributes.handleMutationResult(t),e.configuration.handleSelectionChanged(e.attributes.getSelection()))}),t.on(u.SNAPSHOT,t=>{S(t)&&e.snapshot.handleSnapshotResult(t)}),t.on(u.CAMERA,t=>{C(t)&&e.cameraPosition.handlePositionUpdate(t)}),t.on(u.LOADING_INDICATOR,t=>{te(t)&&(t.error===void 0?e.ui.updateProgress(t.progress,t.phase):e.ui.showError(t.error))}),t.on(u.CONFIG,t=>{ie(t)&&e.applyConfig(t)}),t.on(u.MAPPING,t=>{ee(t)&&(e.attributes.handleMappingReceived(t),e.configuration.handleSelectionChanged(e.attributes.getSelection()),e.ui.renderModelControls(e.attributes,t.attributes),e.readyStateTracker.handleMappingReceived())}),qr(e)}function qr(e){let{messenger:t}=e;t.on(u.FOCUS,t=>{ae(t)&&e.focus.handleStateReceived(t)}),t.on(u.PRICING,t=>{oe(t)&&e.configuration.handlePricingReceived(t.pricing)}),t.on(u.SYNC,t=>{ne(t)&&e.onSync(t.connected)}),t.on(u.SELECTABLE,t=>{re(t)&&(e.selectable.handleSnapshot(t),e.ui.applySelectable(t.attributes))}),t.on(u.APP_RESOLVED,t=>{b(t)&&e.onAppResolved(t)})}var Jr=class{ready=!1;onReady;constructor(e){this.onReady=e}handleMappingReceived(){this.ready||(this.ready=!0,R.info(`Mapping received from server, client is now ready`),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}};function Yr(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 Xr(e){if(!Array.isArray(e))return{};let t=e.filter(e=>typeof e==`string`);return t.length>0?{features:t}:{}}var Zr=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 n=t??{};this.serverHost=n.serverHost,this.iframeParams=n.iframeParams,this.initializeLogging(),this.messenger=new ce(()=>this.iframe?.contentWindow??null,{onHandlerError:(e,t)=>R.error(`Error handling ${e.type}`,t),...n.messengerOptions});let r=e=>{this.messenger.send(e)};this.attributes=new lt(r,d,(e,t)=>{this.notifyMutationFailed(e,t)}),this.selectableState=new ut,this.snapshotApi=new bt(r),this.annotationsApi=new ue(r,d),this.cameraApi=new dt(r),this.cameraPositionApi=new ft,this.focusApi=new _t(r,e=>{this.dispatchFocusChange(e)},d),this.configurationApi=new gt(e=>{this.dispatchConfigurationChange(e)},e=>{this.dispatchConfigurationSubmit(e)}),this.eventBus=new xt,this.arActivation=n.createArActivation?.(r),this.syncTracker=n.createSyncTracker?.(),this.readyStateTracker=new Jr(()=>{this.notifyReady()}),this.ui=this.createStandardInterface(),this.wireIncomingMessages(),n.registerHandlers?.(this.messenger,r),this.messenger.start(),this.mountIframe()}createStandardInterface(){let e=this.arActivation;return new Wr({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,t){this.messenger.send({type:u.ANNOTATION_TOGGLE,enabled:e,...t!==void 0&&{origin:t}})}wireIncomingMessages(){Kr({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},...Xr(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=Yr(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&&R.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:u.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&st(),R.info(`Initializing Virtualdisplay client`,{...this.options.app===void 0?{model:this.options.model}:{app:this.options.app}})}mountIframe(){let e=new Gr(this.options,this.serverHost,this.iframeParams).create();this.container=e.container,this.iframe=e.iframe,this.eventBus.attach(this.container),this.ui.attach(this.container);try{let e=new URL(this.iframe.src).origin;this.messenger.setTargetOrigin(e)}catch{}}select(e,t){this.attributes.select(e,t)}getValues(e){return this.attributes.getValues(e)}getValue(e,t){return this.attributes.getValue(e,t)}onChange(e,t){this.attributes.onChange(e,t)}getAttribute(e){return this.attributes.getAttribute(e)}get isReady(){return this.readyStateTracker.isReady}onReady(e){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}},Qr=`ar.virtualdisplay.io`;function $r(e){let t=new URL(`https://${Qr}/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 ei=1500,ti=class{options;qrModal=new Gn;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(){nt()?this.options.send({type:u.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 t=$r({sessionId:e,app:this.options.app,license:this.options.license,model:this.options.model}),n;try{n=await this.qrModal.update(t)}catch(e){R.warn(`AR QR code could not be rendered`,{error:e});return}this.destroyed?this.qrModal.hide():n&&this.options.send({type:u.QR_SHOWN})}waitForSessionId(){return this.sessionId===void 0?new Promise(e=>{let t=setTimeout(()=>{this.pendingTimers.delete(t),e(void 0)},ei);this.pendingTimers.add(t),this.waiters.push(n=>{this.pendingTimers.delete(t),clearTimeout(t),e(n)})}):Promise.resolve(this.sessionId)}},ni=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)}},ri=class extends Zr{syncStatusTracker;constructor(e){let t=new ni;super(e,{createArActivation:t=>new ti({app:e.app,license:e.license,model:e.model,send:t}),createSyncTracker:()=>t}),this.syncStatusTracker=t}onSyncChange(e){this.syncStatusTracker.onChange(e)}};e.AVAILABILITY=m,e.Annotations=ue,e.Attribute=Re,e.AttributeValue=de,e.Camera=dt,e.CameraPosition=ft,e.Configuration=gt,e.ERROR_CODES=j,e.Focus=_t,e.Photo=vt,e.Snapshot=bt,e.VD_EVENTS=Q,e.VirtualdisplayClient=ri,e.VirtualdisplayError=M,e.enableDebugMode=st,e.isDebugMode=ct,Object.defineProperty(e,"logger",{enumerable:!0,get:function(){return R}})});
698
+ `;function ni(){if(Wn(),document.getElementById(`vd-styles`)!==null)return;let e=document.createElement(`style`);e.id=`vd-styles`,e.textContent=ti,document.head.appendChild(e)}function ri(e,t){let n=document.createElement(`a`);n.href=`data:image/png;base64,${e}`,n.download=t,n.click()}var ii=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){ni(),this.container=e,this.loading=new In(e,{text:{downloading:()=>en(),loadError:()=>tn()}}),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 yr({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=>{F.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&&we(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=zr(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 Wr(this.options.configuration),this.attributes.appendChild(this.commerce.element),this.layout=Qr(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 br(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 B({variant:`outline`,size:`icon`,label:$t(),icon:z.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,ri(t,n)}).onError(t=>{e.element.disabled=!1,F.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))}},ai=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)&&F.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 k.parentNotFound(this.options.parent);return e}};function oi(e){let{messenger:t}=e;t.on(u.HANDSHAKE,n=>{v(n)&&(F.info(`Server handshake received, flushing publisher queue`),t.markReady(),e.ui.viewerAlive())}),t.on(u.SESSION,t=>{y(t)&&e.onSession(t.sessionId)}),t.on(u.MUTATION,t=>{te(t)&&(e.attributes.handleMutationResult(t),e.configuration.handleSelectionChanged(e.attributes.getSelection()))}),t.on(u.SNAPSHOT,t=>{ne(t)&&e.snapshot.handleSnapshotResult(t)}),t.on(u.CAMERA,t=>{re(t)&&e.cameraPosition.handlePositionUpdate(t)}),t.on(u.LOADING_INDICATOR,t=>{ae(t)&&(t.error===void 0?e.ui.updateProgress(t.progress,t.phase):e.ui.showError(t.error))}),t.on(u.CONFIG,t=>{ce(t)&&e.applyConfig(t)}),t.on(u.MAPPING,t=>{ie(t)&&(e.attributes.handleMappingReceived(t),e.configuration.handleSelectionChanged(e.attributes.getSelection()),e.ui.renderModelControls(e.attributes,t.attributes),e.readyStateTracker.handleMappingReceived())}),si(e)}function si(e){let{messenger:t}=e;t.on(u.FOCUS,t=>{le(t)&&e.focus.handleStateReceived(t)}),t.on(u.PERSONALISED,t=>{x(t)&&e.personalisation.handleReplyReceived(t)}),t.on(u.ZONES,t=>{ee(t)&&e.personalisation.handleZonesReceived(t)}),t.on(u.PRICING,t=>{ue(t)&&e.configuration.handlePricingReceived(t.pricing)}),t.on(u.SYNC,t=>{oe(t)&&e.onSync(t.connected)}),t.on(u.SELECTABLE,t=>{se(t)&&(e.selectable.handleSnapshot(t),e.ui.applySelectable(t.attributes))}),t.on(u.APP_RESOLVED,t=>{b(t)&&e.onAppResolved(t)})}var ci=class{ready=!1;onReady;constructor(e){this.onReady=e}handleMappingReceived(){this.ready||(this.ready=!0,F.info(`Mapping received from server, client is now ready`),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}};function li(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 ui(e){if(!Array.isArray(e))return{};let t=e.filter(e=>typeof e==`string`);return t.length>0?{features:t}:{}}var di=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 n=t??{};this.serverHost=n.serverHost,this.iframeParams=n.iframeParams,this.initializeLogging(),this.messenger=new fe(()=>this.iframe?.contentWindow??null,{onHandlerError:(e,t)=>F.error(`Error handling ${e.type}`,t),...n.messengerOptions});let r=e=>{this.messenger.send(e)};this.attributes=new gt(r,d,(e,t)=>{this.notifyMutationFailed(e,t)}),this.selectableState=new _t,this.snapshotApi=new At(r),this.annotationsApi=new me(r,d),this.cameraApi=new vt(r),this.cameraPositionApi=new yt,this.focusApi=new wt(r,e=>{this.dispatchFocusChange(e)},d),this.personalisationApi=new Dt(r,d),this.configurationApi=new Ct(e=>{this.dispatchConfigurationChange(e)},e=>{this.dispatchConfigurationSubmit(e)}),this.eventBus=new jt,this.arActivation=n.createArActivation?.(r),this.syncTracker=n.createSyncTracker?.(),this.readyStateTracker=new ci(()=>{this.notifyReady()}),this.ui=this.createStandardInterface(),this.wireIncomingMessages(),n.registerHandlers?.(this.messenger,r),this.messenger.start(),this.mountIframe()}createStandardInterface(){let e=this.arActivation;return new ii({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,t){this.messenger.send({type:u.ANNOTATION_TOGGLE,enabled:e,...t!==void 0&&{origin:t}})}wireIncomingMessages(){oi({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},...ui(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($.FOCUS_CHANGE,{detail:e,bubbles:!0}))}dispatchConfigurationChange(e){this.container?.dispatchEvent(new CustomEvent($.CONFIGURATION_CHANGE,{detail:e??null,bubbles:!0}))}dispatchConfigurationSubmit(e){this.container?.dispatchEvent(new CustomEvent($.CONFIGURATION_SUBMIT,{detail:e,bubbles:!0}))}handleConfig(e){let t=e.viewerSettings,n=li(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&&F.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:u.FULLSCREEN})}initializeLogging(){this.options.debug===!0&&mt(),F.info(`Initializing Virtualdisplay client`,{...this.options.app===void 0?{model:this.options.model}:{app:this.options.app}})}mountIframe(){let e=new ai(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}},fi=`ar.virtualdisplay.io`;function pi(e){let t=new URL(`https://${fi}/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 mi=1500,hi=class{options;qrModal=new vr;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(){lt()?this.options.send({type:u.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 t=pi({sessionId:e,app:this.options.app,license:this.options.license,model:this.options.model}),n;try{n=await this.qrModal.update(t)}catch(e){F.warn(`AR QR code could not be rendered`,{error:e});return}this.destroyed?this.qrModal.hide():n&&this.options.send({type:u.QR_SHOWN})}waitForSessionId(){return this.sessionId===void 0?new Promise(e=>{let t=setTimeout(()=>{this.pendingTimers.delete(t),e(void 0)},mi);this.pendingTimers.add(t),this.waiters.push(n=>{this.pendingTimers.delete(t),clearTimeout(t),e(n)})}):Promise.resolve(this.sessionId)}},gi=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)}},_i=class extends di{syncStatusTracker;constructor(e){let t=new gi;super(e,{createArActivation:t=>new hi({app:e.app,license:e.license,model:e.model,send:t}),createSyncTracker:()=>t}),this.syncStatusTracker=t}onSyncChange(e){this.syncStatusTracker.onChange(e)}};e.AVAILABILITY=m,e.Annotations=me,e.Attribute=Ge,e.AttributeValue=he,e.Camera=vt,e.CameraPosition=yt,e.Configuration=Ct,e.ERROR_CODES=O,e.Focus=wt,e.Personalisation=Dt,e.Photo=Ot,e.Snapshot=At,e.VD_EVENTS=$,e.VirtualdisplayClient=_i,e.VirtualdisplayError=k,e.enableDebugMode=mt,e.isDebugMode=ht,Object.defineProperty(e,"logger",{enumerable:!0,get:function(){return F}})});