@virtualdisplay.io/client 3.7.0 → 4.0.0-alpha.10

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.
Files changed (79) hide show
  1. package/CHANGELOG.md +106 -76
  2. package/LICENSE +1 -1
  3. package/README.md +322 -31
  4. package/dist/browser-CDLfpTNV.cjs +8 -0
  5. package/dist/browser-DxtIwHNu.js +1227 -0
  6. package/dist/chunk-BcutgqC9.cjs +1 -0
  7. package/dist/chunk-C_CI6nMA.js +13 -0
  8. package/dist/src/annotations/annotations.d.ts +20 -0
  9. package/dist/src/annotations/annotations.d.ts.map +1 -0
  10. package/dist/src/annotations/index.d.ts +2 -0
  11. package/dist/src/annotations/index.d.ts.map +1 -0
  12. package/dist/src/attributes/attribute.d.ts +38 -0
  13. package/dist/src/attributes/attribute.d.ts.map +1 -0
  14. package/dist/src/attributes/attributes.d.ts +43 -0
  15. package/dist/src/attributes/attributes.d.ts.map +1 -0
  16. package/dist/src/attributes/selections.d.ts +16 -0
  17. package/dist/src/attributes/selections.d.ts.map +1 -0
  18. package/dist/src/attributes/value.d.ts +13 -0
  19. package/dist/src/attributes/value.d.ts.map +1 -0
  20. package/dist/src/camera/camera.d.ts +40 -0
  21. package/dist/src/camera/camera.d.ts.map +1 -0
  22. package/dist/src/camera/index.d.ts +4 -0
  23. package/dist/src/camera/index.d.ts.map +1 -0
  24. package/dist/src/camera/position.d.ts +56 -0
  25. package/dist/src/camera/position.d.ts.map +1 -0
  26. package/dist/src/client/client.d.ts +51 -0
  27. package/dist/src/client/client.d.ts.map +1 -0
  28. package/dist/src/client/error.d.ts +26 -0
  29. package/dist/src/client/error.d.ts.map +1 -0
  30. package/dist/src/client/iframe-builder.d.ts +27 -0
  31. package/dist/src/client/iframe-builder.d.ts.map +1 -0
  32. package/dist/src/client/options.d.ts +19 -0
  33. package/dist/src/client/options.d.ts.map +1 -0
  34. package/dist/src/client/ready-state-tracker.d.ts +13 -0
  35. package/dist/src/client/ready-state-tracker.d.ts.map +1 -0
  36. package/dist/src/client/types.d.ts +19 -0
  37. package/dist/src/client/types.d.ts.map +1 -0
  38. package/dist/src/index.d.ts +12 -0
  39. package/dist/src/index.d.ts.map +1 -0
  40. package/dist/src/snapshot/index.d.ts +3 -0
  41. package/dist/src/snapshot/index.d.ts.map +1 -0
  42. package/dist/src/snapshot/photo.d.ts +47 -0
  43. package/dist/src/snapshot/photo.d.ts.map +1 -0
  44. package/dist/src/snapshot/snapshot.d.ts +30 -0
  45. package/dist/src/snapshot/snapshot.d.ts.map +1 -0
  46. package/dist/src/ui/action-bar.d.ts +18 -0
  47. package/dist/src/ui/action-bar.d.ts.map +1 -0
  48. package/dist/src/ui/camera-controls.d.ts +8 -0
  49. package/dist/src/ui/camera-controls.d.ts.map +1 -0
  50. package/dist/src/ui/controls/attribute-group.d.ts +6 -0
  51. package/dist/src/ui/controls/attribute-group.d.ts.map +1 -0
  52. package/dist/src/ui/event-bus.d.ts +12 -0
  53. package/dist/src/ui/event-bus.d.ts.map +1 -0
  54. package/dist/src/ui/loading.d.ts +43 -0
  55. package/dist/src/ui/loading.d.ts.map +1 -0
  56. package/dist/src/ui/standard-interface.d.ts +42 -0
  57. package/dist/src/ui/standard-interface.d.ts.map +1 -0
  58. package/dist/src/ui/styles.d.ts +3 -0
  59. package/dist/src/ui/styles.d.ts.map +1 -0
  60. package/dist/src/utils/logger.d.ts +11 -0
  61. package/dist/src/utils/logger.d.ts.map +1 -0
  62. package/dist/virtualdisplay.client.cjs.js +311 -8
  63. package/dist/virtualdisplay.client.es.js +2218 -8018
  64. package/dist/virtualdisplay.client.umd.js +318 -8
  65. package/package.json +15 -99
  66. package/README.npm.md +0 -78
  67. package/dist/index.d.ts +0 -821
  68. package/dist/virtualdisplay.client.cjs.js.map +0 -1
  69. package/dist/virtualdisplay.client.es.js.map +0 -1
  70. package/dist/virtualdisplay.client.umd.js.map +0 -1
  71. package/node_modules/@virtualdisplay-io/logger/CHANGELOG.md +0 -82
  72. package/node_modules/@virtualdisplay-io/logger/LICENSE +0 -21
  73. package/node_modules/@virtualdisplay-io/logger/README.md +0 -314
  74. package/node_modules/@virtualdisplay-io/logger/dist/index.d.ts +0 -167
  75. package/node_modules/@virtualdisplay-io/logger/dist/virtualdisplay.logger.cjs.js +0 -4
  76. package/node_modules/@virtualdisplay-io/logger/dist/virtualdisplay.logger.cjs.js.map +0 -1
  77. package/node_modules/@virtualdisplay-io/logger/dist/virtualdisplay.logger.es.js +0 -377
  78. package/node_modules/@virtualdisplay-io/logger/dist/virtualdisplay.logger.es.js.map +0 -1
  79. package/node_modules/@virtualdisplay-io/logger/package.json +0 -79
@@ -1,8 +1,311 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={NO_MAPPING:"NO_MAPPING",ATTRIBUTE_NOT_FOUND:"ATTRIBUTE_NOT_FOUND",VALUE_NOT_FOUND:"VALUE_NOT_FOUND",INVALID_MAPPING:"INVALID_MAPPING",PARENT_NOT_FOUND:"PARENT_NOT_FOUND",INVALID_MUTATIONS:"INVALID_MUTATIONS",INVALID_PARAMETER:"INVALID_PARAMETER"};class t extends Error{code;constructor(e,r){super(e),this.name="VirtualdisplayError",this.code=r,void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,t)}static noMapping(){return new t("No mapping configured. Call setMapping() first.",e.NO_MAPPING)}static attributeNotFound(r){return new t(`Attribute "${r}" not found in mapping`,e.ATTRIBUTE_NOT_FOUND)}static valueNotFound(r,s){return new t(`Value "${s}" not found for attribute "${r}"`,e.VALUE_NOT_FOUND)}static invalidMapping(r){return new t(void 0!==r?`Invalid mapping configuration: ${r}`:"Invalid mapping configuration",e.INVALID_MAPPING)}static parentNotFound(r){return new t(`Parent element not found: ${r}`,e.PARENT_NOT_FOUND)}static invalidMutations(r){return new t(void 0!==r?`Invalid mutations: ${r}`:"Invalid mutations array",e.INVALID_MUTATIONS)}}const r={IFRAME_READY:"iframe:ready",MUTATION_MESSAGE:"mutation:message",CONFIG_MESSAGE:"config:message",CAMERA_MESSAGE:"camera:message",MESSAGE_RECEIVED:"message:received",STATE_CHANGED:"state:changed",INITIAL_STATE_RECEIVED:"state:initial-received",SNAPSHOT_MESSAGE:"snapshot:take"},s=Object.freeze({debug:0,info:1,warn:2,error:3});class n{name="console";colorMap={info:"color: #007bff;",warn:"color: #ffc107;",error:"color: #dc3545;",debug:"color: #28a745;"};emojiMap={info:"📘",warn:"⚠️",error:"❌",debug:"🐛"};constructor(e={}){}log(e){const t=this.createStackTrace(),r=this.emojiMap[e.level],s=this.colorMap[e.level],n=e.prefix?`%c[${e.prefix}] ${r} ${e.message}`:`%c${r} ${e.message}`,o=[s];try{if(this.supportsGroupedLogging()){const r=console;r.groupCollapsed(n,...o);const s=this.getConsoleMethod(e.level);s(`Origin: ${t}`),s("Arguments: ",...e.args??[]),r.groupEnd()}else{const t=e.prefix?`[${e.prefix}] ${r} ${e.message}`:`${r} ${e.message}`;this.getConsoleMethod(e.level)(t,...e.args??[])}}catch{try{const t=e.prefix?`[${e.prefix}] ${e.level.toUpperCase()}: ${e.message}`:`${e.level.toUpperCase()}: ${e.message}`;console.log(t,...e.args??[])}catch{}}}createStackTrace(){const e=(new Error).stack;if(!e)return"unknown location";const t=e.split("\n").find(e=>!e.includes("console-transport.ts")&&!e.includes("logger.ts")&&e.includes("at"));return t?t.trim().replace(/^at\s+/,""):"unknown location"}getConsoleMethod(e){switch(e){case"debug":default:return console.log;case"info":return console.info;case"warn":return console.warn;case"error":return console.error}}supportsGroupedLogging(){try{return!this.isTestEnvironment()&&("function"==typeof console.groupCollapsed&&"function"==typeof console.groupEnd)}catch{return!1}}isTestEnvironment(){return typeof window<"u"&&(void 0!==window.__WTR_CONFIG__||void 0!==window.__karma__)||!!(typeof process<"u"&&process.env)&&("test"===process.env.NODE_ENV||void 0!==process.env.JEST_WORKER_ID||"true"===process.env.VITEST)}}const o=Object.freeze(Object.defineProperty({__proto__:null,ConsoleTransport:n,MemoryTransport:class{name="memory";logs=[];maxSize;constructor(e={}){this.maxSize=e.maxSize??1e3}log(e){this.logs.push({...e}),this.logs.length>this.maxSize&&this.logs.shift()}getLogs(){return[...this.logs]}clear(){this.logs.length=0}getLogsByLevel(e){return this.logs.filter(t=>t.level===e)}getLogsAfter(e){return this.logs.filter(t=>t.timestamp>e)}getLogsBefore(e){return this.logs.filter(t=>t.timestamp<e)}getLogsBetween(e,t){return this.logs.filter(r=>r.timestamp>=e&&r.timestamp<=t)}search(e){const t="string"==typeof e?new RegExp(e,"i"):e;return this.logs.filter(e=>t.test(e.message))}toJSON(){return JSON.stringify(this.logs,null,2)}toCSV(){const e=this.logs.map(e=>[e.timestamp.toISOString(),e.level,e.prefix??"",e.message,JSON.stringify(e.context??{})]);return[["timestamp","level","prefix","message","context"].join(","),...e.map(e=>e.map(e=>`"${e}"`).join(","))].join("\n")}}},Symbol.toStringTag,{value:"Module"}));class a{static instance;static mute=!1;prefix;enabled;level;context;transports;formatters;isRoot;constructor(e={},t=!0){if(this.prefix=e.prefix,this.enabled=e.enabled??!0,this.level=e.level??"info",this.context=e.context??{},this.transports=new Map,this.formatters=new Map,this.isRoot=t,this.isRoot){const t=new n({colors:e.colors??!0,timestamp:e.timestamp??!1});this.addTransport(t)}e.transports?.forEach(e=>this.addTransport(e)),e.formatters?.forEach(e=>this.addFormatter(e))}static getInstance(e){return a.instance??=new a(e),a.instance}static setMute(e){a.mute=e}static isMuted(){return a.mute}static exportLogs(){return a.getInstance().exportLogs()}static exportLogsCSV(){return a.getInstance().exportLogsCSV()}static getRecentErrors(e){return a.getInstance().getRecentErrors(e)}static searchLogs(e){return a.getInstance().searchLogs(e)}static clearLogs(){a.getInstance().clearLogs()}static enableMemoryLogging(e){return a.getInstance().enableMemoryLogging(e)}debug(e,...t){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)}child(e={}){const t={prefix:e.prefix??this.prefix,enabled:e.enabled??this.enabled,level:e.level??this.level,context:{...this.context,...e.context},transports:Array.from(this.transports.values()),formatters:Array.from(this.formatters.values())};return new a(t,!1)}setLevel(e){this.level=e}getLevel(){return this.level}isEnabled(){return this.enabled&&!a.mute}setEnabled(e){this.enabled=e}addTransport(e){this.transports.set(e.name,e)}removeTransport(e){this.transports.delete(e)}addFormatter(e){this.formatters.set(e.name,e)}removeFormatter(e){this.formatters.delete(e)}getTransport(e){return this.transports.get(e)}getFormatter(e){return this.formatters.get(e)}exportLogs(){const e=this.getMemoryTransport();return e?e.toJSON():JSON.stringify({error:"No memory transport found. Logs are not being stored."})}exportLogsCSV(){const e=this.getMemoryTransport();return e?e.toCSV():"Error: No memory transport found. Logs are not being stored."}getRecentErrors(e=30){const t=this.getMemoryTransport();if(!t)return[];const r=new Date(Date.now()-60*e*1e3);return[...t.getLogsAfter(r).filter(e=>"error"===e.level)]}searchLogs(e){const t=this.getMemoryTransport();return t?[...t.search(e)]:[]}clearLogs(){const e=this.getMemoryTransport();e?(e.clear(),console.log("🗑️ Logger memory cleared")):console.log("ℹ️ No memory transport found to clear")}enableMemoryLogging(e=1e3){return Promise.resolve().then(()=>o).then(({MemoryTransport:t})=>{const r=new t({maxSize:e});this.addTransport(r),console.log(`📝 Memory logging enabled (max ${e} entries)`),console.log("💡 Use logger.exportLogs() to get logs as JSON"),console.log("💡 Use logger.exportLogsCSV() to get logs as CSV"),console.log("💡 Use logger.getRecentErrors() to get recent errors"),console.log("💡 Use logger.clearLogs() to clear stored logs")})}getMemoryTransport(){return this.transports.get("memory")}log(e,t,...r){if(!this.shouldLog(e))return;let s={level:e,message:t,timestamp:new Date,context:this.context,args:r,prefix:this.prefix};for(const o of this.formatters.values())s=o.format(s);for(const o of this.transports.values())try{o.log(s)}catch(n){this.isRoot&&console.error("Logger transport error:",n)}}shouldLog(e){if(!this.isEnabled())return!1;const t=s[this.level];return s[e]>=t}}a.getInstance(),a.enableMemoryLogging.bind(a);const i=a.getInstance().child({prefix:"Client",level:"warn"});function c(){i.setLevel("debug"),i.debug("Debug mode enabled")}const u={};class l{constructor(e,t){this.eventBus=t,this.options=e}defaultServer="https://server.virtualdisplay.io";options;create(){const e=this.createIframe();return this.attachToParent(e),e}createIframe(){const e=document.createElement("iframe");return e.src=this.buildUrl(),Object.assign(e.style,{width:"100%",height:"100%",border:"none"}),e.setAttribute("allow","xr-spatial-tracking; fullscreen"),e.addEventListener("load",()=>{i.info("Virtualdisplay iframe loaded"),this.eventBus.emit(r.IFRAME_READY,{})}),e}attachToParent(e){this.getParentElement().appendChild(e)}buildUrl(){const e=this.getServerUrl(),t=new URL(e);return t.searchParams.set("license",this.options.license),t.searchParams.set("model",this.options.model),!0===this.options.debug&&t.searchParams.set("debug","true"),void 0!==this.options.language&&t.searchParams.set("language",this.options.language),t.toString()}getServerUrl(){if(void 0===u?.VITE_VIRTUALDISPLAY_SERVER_HOST)return this.defaultServer}getParentElement(){if("string"!=typeof this.options.parent)return this.options.parent;const e=document.querySelector(this.options.parent);if(null===e)throw t.parentNotFound(this.options.parent);return e}}class d{attributeService;attributeName;constructor(e,t){this.attributeService=e,this.attributeName=t}select(e){const r=this.getAttribute(this.attributeName);if(void 0===r)throw t.attributeNotFound(this.attributeName);if(!r.hasValue(e))throw t.valueNotFound(this.attributeName,e);return this.attributeService.selectAttributeValue(this.attributeName,e),this}get name(){return this.attributeName}get currentValue(){const e=this.getAttribute(this.attributeName);return e?.currentSelection}get availableValues(){const e=this.getAttribute(this.attributeName);return void 0===e?[]:e.getAllValues().map(e=>e.value)}onChange(e){return this.getValues().forEach(t=>{t.setOnChange(()=>e())}),this}getValues(){const e=this.getAttribute(this.attributeName);return void 0===e?[]:e.getAllValues()}getValue(e){return this.getValues().find(t=>t.value===e)}getAttribute(e){return this.attributeService.getAttribute(e)}}class h{attributeName;values=new Map;constructor(e){this.attributeName=e}addValue(e){this.values.set(e.value,e)}getDefaultMutations(){return Array.from(this.values.values()).flatMap(e=>e.getMutations())}getCurrentValue(){return Array.from(this.values.values()).find(e=>e.isSelected)}getValue(e){return this.values.get(e)}getAllValues(){return Array.from(this.values.values())}hasValue(e){return this.values.has(e)}get name(){return this.attributeName}get currentSelection(){return this.getCurrentValue()?.value}clear(){this.values.clear()}}const f={SHOW:"show",HIDE:"hide"};class p{type;nodeId;constructor(e,t){this.type=e,this.nodeId=t}static show(e){return new p(f.SHOW,e)}static hide(e){return new p(f.HIDE,e)}inverse(){const e=this.type===f.SHOW?f.HIDE:f.SHOW;return new p(e,this.nodeId)}equals(e){return this.type===e.type&&this.nodeId===e.nodeId}toDto(){return{type:this.type,nodeId:this.nodeId}}}class m{attributeValue;nodeIds;selected;onChange;constructor(e,t,r=!1){this.attributeValue=e,this.nodeIds=[...t],this.selected=r}getMutations(){return this.nodeIds.map(e=>this.selected?p.show(e):p.hide(e))}setSelected(e){this.selected=e,void 0!==this.onChange&&this.onChange()}get value(){return this.attributeValue}get nodeList(){return[...this.nodeIds]}hasNode(e){return this.nodeIds.includes(e)}get isSelected(){return this.selected}setOnChange(e){this.onChange=e}}function g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var y,v={exports:{}},$={},b={},w={},_={},E={},S={};function P(){return y||(y=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class s extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function n(e,...t){const r=[e[0]];let n=0;for(;n<t.length;)i(r,t[n]),r.push(e[++n]);return new s(r)}e._Code=s,e.nil=new s(""),e._=n;const o=new s("+");function a(e,...t){const r=[u(e[0])];let n=0;for(;n<t.length;)r.push(o),i(r,t[n]),r.push(o,u(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===o){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new s(r)}function i(e,t){var n;t instanceof s?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:u(Array.isArray(n)?n.join(","):n))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=i,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},e.stringify=function(e){return new s(u(e))},e.safeStringify=u,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new s(`.${t}`):n`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new s(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new s(e.toString())}}(S)),S}var N,I,k={};function C(){return N||(N=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=P();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var s,n;(n=s||(e.UsedValueState=s={}))[n.Started=0]="Started",n[n.Completed=1]="Completed",e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}e.Scope=o;class a extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:s}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${s}]`}}e.ValueScopeName=a;const i=t._`\n`;e.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?i:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const s=this.toName(e),{prefix:n}=s,o=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[n];if(a){const e=a.get(o);if(e)return e}else a=this._values[n]=new Map;a.set(o,s);const i=this._scope[n]||(this._scope[n]=[]),c=i.length;return i[c]=t.ref,s.setValue(t,{property:n,itemIndex:c}),s}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(n,o,a={},i){let c=t.nil;for(const u in n){const l=n[u];if(!l)continue;const d=a[u]=a[u]||new Map;l.forEach(n=>{if(d.has(n))return;d.set(n,s.Started);let a=o(n);if(a){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${n} = ${a};${this.opts._n}`}else{if(!(a=null==i?void 0:i(n)))throw new r(n);c=t._`${c}${a}${this.opts._n}`}d.set(n,s.Completed)})}return c}}}(k)),k}function A(){return I||(I=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=P(),r=C();var s=P();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return s.Name}});var n=C();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,t){return this}}class a extends o{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const s=e?r.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${s} ${this.name}${n};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=T(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends o{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=T(this.rhs,e,r),this}get names(){return A(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends i{constructor(e,t,r,s){super(e,r,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class l extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class d extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends o{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=T(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class f extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let s=r.length;for(;s--;){const n=r[s];n.optimizeNames(e,t)||(O(e,n.names),r.splice(s,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>k(e,t.names),{})}}class p extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends f{}class g extends p{}g.kind="else";class y extends p{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof y?t:t.nodes:this.nodes.length?this:new y(j(e),t instanceof y?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=T(this.condition,e,t),this}get names(){const e=super.names;return A(e,this.condition),this.else&&k(e,this.else.names),e}}y.kind="if";class v extends p{}v.kind="for";class $ extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=T(this.iteration,e,t),this}get names(){return k(super.names,this.iteration.names)}}class b extends v{constructor(e,t,r,s){super(),this.varKind=e,this.name=t,this.from=r,this.to=s}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:s,from:n,to:o}=this;return`for(${t} ${s}=${n}; ${s}<${o}; ${s}++)`+super.render(e)}get names(){const e=A(super.names,this.from);return A(e,this.to)}}class w extends v{constructor(e,t,r,s){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=T(this.iterable,e,t),this}get names(){return k(super.names,this.iterable.names)}}class _ extends p{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}_.kind="func";class E extends f{render(e){return"return "+super.render(e)}}E.kind="return";class S extends p{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,s;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(s=this.finally)||void 0===s||s.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&k(e,this.catch.names),this.finally&&k(e,this.finally.names),e}}class N extends p{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}N.kind="catch";class I extends p{render(e){return"finally"+super.render(e)}}I.kind="finally";function k(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function A(e,r){return r instanceof t._CodeOrName?k(e,r.names):e}function T(e,r,s){return e instanceof t.Name?o(e):(n=e)instanceof t._Code&&n._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==s[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=o(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var n;function o(e){const t=s[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function O(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function j(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${V(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){const n=this._scope.toName(t);return void 0!==r&&s&&(this._constants[n.str]=r),this._leafNode(new a(e,n,r)),n}const(e,t,s){return this._def(r.varKinds.const,e,t,s)}let(e,t,s){return this._def(r.varKinds.let,e,t,s)}var(e,t,s){return this._def(r.varKinds.var,e,t,s)}assign(e,t,r){return this._leafNode(new i(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new h(e)),this}object(...e){const r=["{"];for(const[s,n]of e)r.length>1&&r.push(","),r.push(s),(s!==n||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,n));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new y(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(y,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new $(e),t)}forRange(e,t,s,n,o=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const a=this._scope.toName(e);return this._for(new b(o,a,t,s),()=>n(a))}forOf(e,s,n,o=r.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=s instanceof t.Name?s:this.var("_arr",s);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(a,t._`${e}[${r}]`),n(a)})}return this._for(new w("of",o,a,s),()=>n(a))}forIn(e,s,n,o=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${s})`,n);const a=this._scope.toName(e);return this._for(new w("in",o,a,s),()=>n(a))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new l(e))}return(e){const t=new E;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new S;if(this._blockNode(s),this.code(e),t){const e=this.name("e");this._currNode=s.catch=new N(e),t(e)}return r&&(this._currNode=s.finally=new I,this.code(r)),this._endBlockNode(N,I)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,s,n){return this._blockNode(new _(e,r,s)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(_)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=j;const M=R(e.operators.AND);e.and=function(...e){return e.reduce(M)};const x=R(e.operators.OR);function R(e){return(r,s)=>r===t.nil?s:s===t.nil?r:t._`${V(r)} ${e} ${V(s)}`}function V(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(x)}}(E)),E}var T,O={};function j(){if(T)return O;T=1,Object.defineProperty(O,"__esModule",{value:!0}),O.checkStrictMode=O.getErrorPath=O.Type=O.useFunc=O.setEvaluated=O.evaluatedPropsToName=O.mergeEvaluated=O.eachItem=O.unescapeJsonPointer=O.escapeJsonPointer=O.escapeFragment=O.unescapeFragment=O.schemaRefOrVal=O.schemaHasRulesButRef=O.schemaHasRules=O.checkUnknownRules=O.alwaysValidSchema=O.toHash=void 0;const e=A(),t=P();function r(e,t=e.schema){const{opts:r,self:s}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const n=s.RULES.keywords;for(const o in t)n[o]||h(e,`unknown keyword: "${o}"`)}function s(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function n(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function o(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function a({mergeNames:t,mergeToName:r,mergeValues:s,resultToName:n}){return(o,a,i,c)=>{const u=void 0===i?a:i instanceof e.Name?(a instanceof e.Name?t(o,a,i):r(o,a,i),i):a instanceof e.Name?(r(o,i,a),a):s(a,i);return c!==e.Name||u instanceof e.Name?u:n(o,u)}}function i(t,r){if(!0===r)return t.var("props",!0);const s=t.var("props",e._`{}`);return void 0!==r&&c(t,s,r),s}function c(t,r,s){Object.keys(s).forEach(s=>t.assign(e._`${r}${(0,e.getProperty)(s)}`,!0))}O.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},O.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!s(t,e.self.RULES.all))},O.checkUnknownRules=r,O.schemaHasRules=s,O.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},O.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},s,n,o){if(!o){if("number"==typeof s||"boolean"==typeof s)return s;if("string"==typeof s)return e._`${s}`}return e._`${t}${r}${(0,e.getProperty)(n)}`},O.unescapeFragment=function(e){return o(decodeURIComponent(e))},O.escapeFragment=function(e){return encodeURIComponent(n(e))},O.escapeJsonPointer=n,O.unescapeJsonPointer=o,O.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},O.mergeEvaluated={props:a({mergeNames:(t,r,s)=>t.if(e._`${s} !== true && ${r} !== undefined`,()=>{t.if(e._`${r} === true`,()=>t.assign(s,!0),()=>t.assign(s,e._`${s} || {}`).code(e._`Object.assign(${s}, ${r})`))}),mergeToName:(t,r,s)=>t.if(e._`${s} !== true`,()=>{!0===r?t.assign(s,!0):(t.assign(s,e._`${s} || {}`),c(t,s,r))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:i}),items:a({mergeNames:(t,r,s)=>t.if(e._`${s} !== true && ${r} !== undefined`,()=>t.assign(s,e._`${r} === true ? true : ${s} > ${r} ? ${s} : ${r}`)),mergeToName:(t,r,s)=>t.if(e._`${s} !== true`,()=>t.assign(s,!0===r||e._`${s} > ${r} ? ${s} : ${r}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},O.evaluatedPropsToName=i,O.setEvaluated=c;const u={};var l,d;function h(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}return O.useFunc=function(e,r){return e.scopeValue("func",{ref:r,code:u[r.code]||(u[r.code]=new t._Code(r.code))})},(d=l||(O.Type=l={}))[d.Num=0]="Num",d[d.Str=1]="Str",O.getErrorPath=function(t,r,s){if(t instanceof e.Name){const n=r===l.Num;return s?n?e._`"[" + ${t} + "]"`:e._`"['" + ${t} + "']"`:n?e._`"/" + ${t}`:e._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return s?(0,e.getProperty)(t).toString():"/"+n(t)},O.checkStrictMode=h,O}var M,x,R,V={};function D(){if(M)return V;M=1,Object.defineProperty(V,"__esModule",{value:!0});const e=A(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return V.default=t,V}function L(){return x||(x=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=A(),r=j(),s=D();function n(e,r){const n=e.const("err",r);e.if(t._`${s.default.vErrors} === null`,()=>e.assign(s.default.vErrors,t._`[${n}]`),t._`${s.default.vErrors}.push(${n})`),e.code(t._`${s.default.errors}++`)}function o(e,r){const{gen:s,validateName:n,schemaEnv:o}=e;o.$async?s.throw(t._`new ${e.ValidationError}(${r})`):(s.assign(t._`${n}.errors`,r),s.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,s=e.keywordError,a,c){const{it:u}=r,{gen:l,compositeRule:d,allErrors:h}=u,f=i(r,s,a);(null!=c?c:d||h)?n(l,f):o(u,t._`[${f}]`)},e.reportExtraError=function(t,r=e.keywordError,a){const{it:c}=t,{gen:u,compositeRule:l,allErrors:d}=c;n(u,i(t,r,a)),l||d||o(c,s.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(s.default.errors,r),e.if(t._`${s.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${s.default.vErrors}.length`,r),()=>e.assign(s.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:n,data:o,errsCount:a,it:i}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,s.default.errors,a=>{e.const(c,t._`${s.default.vErrors}[${a}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(s.default.instancePath,i.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${i.errSchemaPath}/${r}`),i.opts.verbose&&(e.assign(t._`${c}.schema`,n),e.assign(t._`${c}.data`,o))})};const a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function i(e,r,n){const{createErrors:o}=e.it;return!1===o?t._`{}`:function(e,r,n={}){const{gen:o,it:i}=e,l=[c(i,n),u(e,n)];return function(e,{params:r,message:n},o){const{keyword:i,data:c,schemaValue:u,it:l}=e,{opts:d,propertyName:h,topSchemaRef:f,schemaPath:p}=l;o.push([a.keyword,i],[a.params,"function"==typeof r?r(e):r||t._`{}`]),d.messages&&o.push([a.message,"function"==typeof n?n(e):n]);d.verbose&&o.push([a.schema,u],[a.parentSchema,t._`${f}${p}`],[s.default.data,c]);h&&o.push([a.propertyName,h])}(e,r,l),o.object(...l)}(e,r,n)}function c({errorPath:e},{instancePath:n}){const o=n?t.str`${e}${(0,r.getErrorPath)(n,r.Type.Str)}`:e;return[s.default.instancePath,(0,t.strConcat)(s.default.instancePath,o)]}function u({keyword:e,it:{errSchemaPath:s}},{schemaPath:n,parentSchema:o}){let i=o?s:t.str`${s}/${e}`;return n&&(i=t.str`${i}${(0,r.getErrorPath)(n,r.Type.Str)}`),[a.schemaPath,i]}}(_)),_}var U,z={},F={};function q(){if(U)return F;U=1,Object.defineProperty(F,"__esModule",{value:!0}),F.getRules=F.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return F.isJSONType=function(t){return"string"==typeof t&&e.has(t)},F.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}},F}var G,K,B={};function H(){if(G)return B;function e(e,r){return r.rules.some(r=>t(e,r))}function t(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}return G=1,Object.defineProperty(B,"__esModule",{value:!0}),B.shouldUseRule=B.shouldUseGroup=B.schemaHasRulesForType=void 0,B.schemaHasRulesForType=function({schema:t,self:r},s){const n=r.RULES.types[s];return n&&!0!==n&&e(t,n)},B.shouldUseGroup=e,B.shouldUseRule=t,B}function J(){if(K)return z;K=1,Object.defineProperty(z,"__esModule",{value:!0}),z.reportTypeError=z.checkDataTypes=z.checkDataType=z.coerceAndCheckDataType=z.getJSONTypes=z.getSchemaTypes=z.DataType=void 0;const e=q(),t=H(),r=L(),s=A(),n=j();var o,a;function i(t){const r=Array.isArray(t)?t:t?[t]:[];if(r.every(e.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=o||(z.DataType=o={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",z.getSchemaTypes=function(e){const t=i(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},z.getJSONTypes=i,z.coerceAndCheckDataType=function(e,r){const{gen:n,data:a,opts:i}=e,u=function(e,t){return t?e.filter(e=>c.has(e)||"array"===t&&"array"===e):[]}(r,i.coerceTypes),d=r.length>0&&!(0===u.length&&1===r.length&&(0,t.schemaHasRulesForType)(e,r[0]));if(d){const t=l(r,a,i.strictNumbers,o.Wrong);n.if(t,()=>{u.length?function(e,t,r){const{gen:n,data:o,opts:a}=e,i=n.let("dataType",s._`typeof ${o}`),u=n.let("coerced",s._`undefined`);"array"===a.coerceTypes&&n.if(s._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,s._`${o}[0]`).assign(i,s._`typeof ${o}`).if(l(t,o,a.strictNumbers),()=>n.assign(u,o)));n.if(s._`${u} !== undefined`);for(const s of r)(c.has(s)||"array"===s&&"array"===a.coerceTypes)&&d(s);function d(e){switch(e){case"string":return void n.elseIf(s._`${i} == "number" || ${i} == "boolean"`).assign(u,s._`"" + ${o}`).elseIf(s._`${o} === null`).assign(u,s._`""`);case"number":return void n.elseIf(s._`${i} == "boolean" || ${o} === null
2
- || (${i} == "string" && ${o} && ${o} == +${o})`).assign(u,s._`+${o}`);case"integer":return void n.elseIf(s._`${i} === "boolean" || ${o} === null
3
- || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(u,s._`+${o}`);case"boolean":return void n.elseIf(s._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(u,!1).elseIf(s._`${o} === "true" || ${o} === 1`).assign(u,!0);case"null":return n.elseIf(s._`${o} === "" || ${o} === 0 || ${o} === false`),void n.assign(u,null);case"array":n.elseIf(s._`${i} === "string" || ${i} === "number"
4
- || ${i} === "boolean" || ${o} === null`).assign(u,s._`[${o}]`)}}n.else(),h(e),n.endIf(),n.if(s._`${u} !== undefined`,()=>{n.assign(o,u),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(s._`${t} !== undefined`,()=>e.assign(s._`${t}[${r}]`,n))}(e,u)})}(e,r,u):h(e)})}return d};const c=new Set(["string","number","integer","boolean","null"]);function u(e,t,r,n=o.Correct){const a=n===o.Correct?s.operators.EQ:s.operators.NEQ;let i;switch(e){case"null":return s._`${t} ${a} null`;case"array":i=s._`Array.isArray(${t})`;break;case"object":i=s._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=c(s._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=c();break;default:return s._`typeof ${t} ${a} ${e}`}return n===o.Correct?i:(0,s.not)(i);function c(e=s.nil){return(0,s.and)(s._`typeof ${t} == "number"`,e,r?s._`isFinite(${t})`:s.nil)}}function l(e,t,r,o){if(1===e.length)return u(e[0],t,r,o);let a;const i=(0,n.toHash)(e);if(i.array&&i.object){const e=s._`typeof ${t} != "object"`;a=i.null?e:s._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else a=s.nil;i.number&&delete i.integer;for(const n in i)a=(0,s.and)(a,u(n,t,r,o));return a}z.checkDataType=u,z.checkDataTypes=l;const d={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?s._`{type: ${e}}`:s._`{type: ${t}}`};function h(e){const t=function(e){const{gen:t,data:r,schema:s}=e,o=(0,n.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:o,schemaValue:o,parentSchema:s,params:{},it:e}}(e);(0,r.reportError)(t,d)}return z.reportTypeError=h,z}var W,Y={};var Q,X,Z={},ee={};function te(){if(Q)return ee;Q=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.validateUnion=ee.validateArray=ee.usePattern=ee.callValidateCode=ee.schemaProperties=ee.allSchemaProperties=ee.noPropertyInData=ee.propertyInData=ee.isOwnProperty=ee.hasPropFunc=ee.reportMissingProp=ee.checkMissingProp=ee.checkReportMissingProp=void 0;const e=A(),t=j(),r=D(),s=j();function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function o(t,r,s){return e._`${n(t)}.call(${r}, ${s})`}function a(t,r,s,n){const a=e._`${r}${(0,e.getProperty)(s)} === undefined`;return n?(0,e.or)(a,(0,e.not)(o(t,r,s))):a}function i(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}ee.checkReportMissingProp=function(t,r){const{gen:s,data:n,it:o}=t;s.if(a(s,n,r,o.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},ee.checkMissingProp=function({gen:t,data:r,it:{opts:s}},n,o){return(0,e.or)(...n.map(n=>(0,e.and)(a(t,r,n,s.ownProperties),e._`${o} = ${n}`)))},ee.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},ee.hasPropFunc=n,ee.isOwnProperty=o,ee.propertyInData=function(t,r,s,n){const a=e._`${r}${(0,e.getProperty)(s)} !== undefined`;return n?e._`${a} && ${o(t,r,s)}`:a},ee.noPropertyInData=a,ee.allSchemaProperties=i,ee.schemaProperties=function(e,r){return i(r).filter(s=>!(0,t.alwaysValidSchema)(e,r[s]))},ee.callValidateCode=function({schemaCode:t,data:s,it:{gen:n,topSchemaRef:o,schemaPath:a,errorPath:i},it:c},u,l,d){const h=d?e._`${t}, ${s}, ${o}${a}`:s,f=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,i)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&f.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const p=e._`${h}, ${n.object(...f)}`;return l!==e.nil?e._`${u}.call(${l}, ${p})`:e._`${u}(${p})`};const c=e._`new RegExp`;return ee.usePattern=function({gen:t,it:{opts:r}},n){const o=r.unicodeRegExp?"u":"",{regExp:a}=r.code,i=a(n,o);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:e._`${"new RegExp"===a.code?c:(0,s.useFunc)(t,a)}(${n}, ${o})`})},ee.validateArray=function(r){const{gen:s,data:n,keyword:o,it:a}=r,i=s.name("valid");if(a.allErrors){const e=s.let("valid",!0);return c(()=>s.assign(e,!1)),e}return s.var(i,!0),c(()=>s.break()),i;function c(a){const c=s.const("len",e._`${n}.length`);s.forRange("i",0,c,n=>{r.subschema({keyword:o,dataProp:n,dataPropType:t.Type.Num},i),s.if((0,e.not)(i),a)})}},ee.validateUnion=function(r){const{gen:s,schema:n,keyword:o,it:a}=r;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(e=>(0,t.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;const i=s.let("valid",!1),c=s.name("_valid");s.block(()=>n.forEach((t,n)=>{const a=r.subschema({keyword:o,schemaProp:n,compositeRule:!0},c);s.assign(i,e._`${i} || ${c}`);r.mergeValidEvaluated(a,c)||s.if((0,e.not)(i))})),r.result(i,()=>r.reset(),()=>r.error(!0))},ee}function re(){if(X)return Z;X=1,Object.defineProperty(Z,"__esModule",{value:!0}),Z.validateKeywordUsage=Z.validSchemaType=Z.funcKeywordCode=Z.macroKeywordCode=void 0;const e=A(),t=D(),r=te(),s=L();function n(t){const{gen:r,data:s,it:n}=t;r.if(n.parentData,()=>r.assign(s,e._`${n.parentData}[${n.parentDataProperty}]`))}function o(t,r,s){if(void 0===s)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof s?{ref:s}:{ref:s,code:(0,e.stringify)(s)})}return Z.macroKeywordCode=function(t,r){const{gen:s,keyword:n,schema:a,parentSchema:i,it:c}=t,u=r.macro.call(c.self,a,i,c),l=o(s,n,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);const d=s.name("valid");t.subschema({schema:u,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},d),t.pass(d,()=>t.error(!0))},Z.funcKeywordCode=function(a,i){var c;const{gen:u,keyword:l,schema:d,parentSchema:h,$data:f,it:p}=a;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(p,i);const m=!f&&i.compile?i.compile.call(p.self,d,h,p):i.validate,g=o(u,l,m),y=u.let("valid");function v(s=(i.async?e._`await `:e.nil)){const n=p.opts.passContext?t.default.this:t.default.self,o=!("compile"in i&&!f||!1===i.schema);u.assign(y,e._`${s}${(0,r.callValidateCode)(a,g,n,o)}`,i.modifying)}function $(t){var r;u.if((0,e.not)(null!==(r=i.valid)&&void 0!==r?r:y),t)}a.block$data(y,function(){if(!1===i.errors)v(),i.modifying&&n(a),$(()=>a.error());else{const r=i.async?function(){const t=u.let("ruleErrs",null);return u.try(()=>v(e._`await `),r=>u.assign(y,!1).if(e._`${r} instanceof ${p.ValidationError}`,()=>u.assign(t,e._`${r}.errors`),()=>u.throw(r))),t}():function(){const t=e._`${g}.errors`;return u.assign(t,null),v(e.nil),t}();i.modifying&&n(a),$(()=>function(r,n){const{gen:o}=r;o.if(e._`Array.isArray(${n})`,()=>{o.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${n} : ${t.default.vErrors}.concat(${n})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,s.extendErrors)(r)},()=>r.error())}(a,r))}}),a.ok(null!==(c=i.valid)&&void 0!==c?c:y)},Z.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},Z.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:s},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");const a=n.dependencies;if(null==a?void 0:a.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[o])){const e=`keyword "${o}" value is invalid at path "${s}": `+r.errorsText(n.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},Z}var se,ne={};var oe,ae,ie={};function ce(){return ae?oe:(ae=1,oe=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var s,n,o;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(n=s;0!==n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(o=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=s;0!==n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=s;0!==n--;){var a=o[n];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r})}var ue,le,de,he={exports:{}};function fe(){if(ue)return he.exports;ue=1;var e=he.exports=function(e,r,s){"function"==typeof r&&(s=r,r={}),t(r,"function"==typeof(s=r.cb||s)?s:s.pre||function(){},s.post||function(){},e,"",e)};function t(s,n,o,a,i,c,u,l,d,h){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var f in n(a,i,c,u,l,d,h),a){var p=a[f];if(Array.isArray(p)){if(f in e.arrayKeywords)for(var m=0;m<p.length;m++)t(s,n,o,p[m],i+"/"+f+"/"+m,c,i,f,a,m)}else if(f in e.propsKeywords){if(p&&"object"==typeof p)for(var g in p)t(s,n,o,p[g],i+"/"+f+"/"+r(g),c,i,f,a,g)}else(f in e.keywords||s.allKeys&&!(f in e.skipKeywords))&&t(s,n,o,p,i+"/"+f,c,i,f,a)}o(a,i,c,u,l,d,h)}}function r(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}return e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},he.exports}function pe(){if(le)return ie;le=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.getSchemaRefs=ie.resolveUrl=ie.normalizeId=ie._getFullPath=ie.getFullPath=ie.inlineRef=void 0;const e=j(),t=ce(),r=fe(),s=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);ie.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!o(e):!!t&&a(e)<=t)};const n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function o(e){for(const t in e){if(n.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(o))return!0;if("object"==typeof r&&o(r))return!0}return!1}function a(t){let r=0;for(const n in t){if("$ref"===n)return 1/0;if(r++,!s.has(n)&&("object"==typeof t[n]&&(0,e.eachItem)(t[n],e=>r+=a(e)),r===1/0))return 1/0}return r}function i(e,t="",r){!1!==r&&(t=l(t));const s=e.parse(t);return c(e,s)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}ie.getFullPath=i,ie._getFullPath=c;const u=/#\/?$/;function l(e){return e?e.replace(u,""):""}ie.normalizeId=l,ie.resolveUrl=function(e,t,r){return r=l(r),e.resolve(t,r)};const d=/^[a-z_][-a-z0-9._]*$/i;return ie.getSchemaRefs=function(e,s){if("boolean"==typeof e)return{};const{schemaId:n,uriResolver:o}=this.opts,a=l(e[n]||s),c={"":a},u=i(o,a,!1),h={},f=new Set;return r(e,{allKeys:!0},(e,t,r,s)=>{if(void 0===s)return;const o=u+t;let a=c[s];function i(t){const r=this.opts.uriResolver.resolve;if(t=l(a?r(a,t):t),f.has(t))throw m(t);f.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?p(e,s.schema,t):t!==l(o)&&("#"===t[0]?(p(e,h[t],t),h[t]=e):this.refs[t]=o),t}function g(e){if("string"==typeof e){if(!d.test(e))throw new Error(`invalid anchor "${e}"`);i.call(this,`#${e}`)}}"string"==typeof e[n]&&(a=i.call(this,e[n])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),c[t]=a}),h;function p(e,r,s){if(void 0!==r&&!t(e,r))throw m(s)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}},ie}function me(){if(de)return b;de=1,Object.defineProperty(b,"__esModule",{value:!0}),b.getData=b.KeywordCxt=b.validateFunctionCode=void 0;const e=function(){if(R)return w;R=1,Object.defineProperty(w,"__esModule",{value:!0}),w.boolOrEmptySchema=w.topBoolOrEmptySchema=void 0;const e=L(),t=A(),r=D(),s={message:"boolean schema is false"};function n(t,r){const{gen:n,data:o}=t,a={gen:n,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(a,s,void 0,r)}return w.topBoolOrEmptySchema=function(e){const{gen:s,schema:o,validateName:a}=e;!1===o?n(e,!1):"object"==typeof o&&!0===o.$async?s.return(r.default.data):(s.assign(t._`${a}.errors`,null),s.return(!0))},w.boolOrEmptySchema=function(e,t){const{gen:r,schema:s}=e;!1===s?(r.var(t,!1),n(e)):r.var(t,!0)},w}(),t=J(),r=H(),s=J(),n=function(){if(W)return Y;W=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.assignDefaults=void 0;const e=A(),t=j();function r(r,s,n){const{gen:o,compositeRule:a,data:i,opts:c}=r;if(void 0===n)return;const u=e._`${i}${(0,e.getProperty)(s)}`;if(a)return void(0,t.checkStrictMode)(r,`default is ignored for: ${u}`);let l=e._`${u} === undefined`;"empty"===c.useDefaults&&(l=e._`${l} || ${u} === null || ${u} === ""`),o.if(l,e._`${u} = ${(0,e.stringify)(n)}`)}return Y.assignDefaults=function(e,t){const{properties:s,items:n}=e.schema;if("object"===t&&s)for(const o in s)r(e,o,s[o].default);else"array"===t&&Array.isArray(n)&&n.forEach((t,s)=>r(e,s,t.default))},Y}(),o=re(),a=function(){if(se)return ne;se=1,Object.defineProperty(ne,"__esModule",{value:!0}),ne.extendSubschemaMode=ne.extendSubschemaData=ne.getSubschema=void 0;const e=A(),t=j();return ne.getSubschema=function(r,{keyword:s,schemaProp:n,schema:o,schemaPath:a,errSchemaPath:i,topSchemaRef:c}){if(void 0!==s&&void 0!==o)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==s){const o=r.schema[s];return void 0===n?{schema:o,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(s)}`,errSchemaPath:`${r.errSchemaPath}/${s}`}:{schema:o[n],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(s)}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${s}/${(0,t.escapeFragment)(n)}`}}if(void 0!==o){if(void 0===a||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:a,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},ne.extendSubschemaData=function(r,s,{dataProp:n,dataPropType:o,data:a,dataTypes:i,propertyName:c}){if(void 0!==a&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=s;if(void 0!==n){const{errorPath:a,dataPathArr:i,opts:c}=s;l(u.let("data",e._`${s.data}${(0,e.getProperty)(n)}`,!0)),r.errorPath=e.str`${a}${(0,t.getErrorPath)(n,o,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${n}`,r.dataPathArr=[...i,r.parentDataProperty]}function l(e){r.data=e,r.dataLevel=s.dataLevel+1,r.dataTypes=[],s.definedProperties=new Set,r.parentData=s.data,r.dataNames=[...s.dataNames,e]}void 0!==a&&(l(a instanceof e.Name?a:u.let("data",a,!0)),void 0!==c&&(r.propertyName=c)),i&&(r.dataTypes=i)},ne.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:n,allErrors:o}){void 0!==s&&(e.compositeRule=s),void 0!==n&&(e.createErrors=n),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r},ne}(),i=A(),c=D(),u=pe(),l=j(),d=L();function h({gen:e,validateName:t,schema:r,schemaEnv:s,opts:n},o){n.code.es5?e.func(t,i._`${c.default.data}, ${c.default.valCxt}`,s.$async,()=>{e.code(i._`"use strict"; ${f(r,n)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,i._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,i._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,i._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,i._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,i._`""`),e.var(c.default.parentData,i._`undefined`),e.var(c.default.parentDataProperty,i._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`{}`)})}(e,n),e.code(o)}):e.func(t,i._`${c.default.data}, ${function(e){return i._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?i._`, ${c.default.dynamicAnchors}={}`:i.nil}}={}`}(n)}`,s.$async,()=>e.code(f(r,n)).code(o))}function f(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?i._`/*# sourceURL=${r} */`:i.nil}function p(t,r){g(t)&&(y(t),m(t))?function(e,t){const{schema:r,gen:s,opts:n}=e;n.$comment&&r.$comment&&$(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=s.const("_errs",c.default.errors);v(e,o),s.var(t,i._`${o} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function m({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function g(e){return"boolean"!=typeof e.schema}function y(e){(0,l.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:s,self:n}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,r){if(e.opts.jtd)return _(e,[],!1,r);const s=(0,t.getSchemaTypes)(e.schema);_(e,s,!(0,t.coerceAndCheckDataType)(e,s),r)}function $({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:n}){const o=r.$comment;if(!0===n.$comment)e.code(i._`${c.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){const r=i.str`${s}/$comment`,n=e.scopeValue("root",{ref:t.root});e.code(i._`${c.default.self}.opts.$comment(${o}, ${r}, ${n}.schema)`)}}function _(e,t,n,o){const{gen:a,schema:u,data:d,allErrors:h,opts:f,self:p}=e,{RULES:m}=p;function g(l){(0,r.shouldUseGroup)(u,l)&&(l.type?(a.if((0,s.checkDataType)(l.type,d,f.strictNumbers)),E(e,l),1===t.length&&t[0]===l.type&&n&&(a.else(),(0,s.reportTypeError)(e)),a.endIf()):E(e,l),h||a.if(i._`${c.default.errors} === ${o||0}`))}!u.$ref||!f.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(u,m)?(f.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach(t=>{P(e.dataTypes,t)||N(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const s of e.dataTypes)P(t,s)?r.push(s):t.includes("integer")&&"number"===s&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&N(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const s=e.self.RULES.all;for(const n in s){const o=s[n];if("object"==typeof o&&(0,r.shouldUseRule)(e.schema,o)){const{type:r}=o.definition;r.length&&!r.some(e=>S(t,e))&&N(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes)}(e,t),a.block(()=>{for(const e of m.rules)g(e);g(m.post)})):a.block(()=>k(e,"$ref",m.all.$ref.definition))}function E(e,t){const{gen:s,schema:o,opts:{useDefaults:a}}=e;a&&(0,n.assignDefaults)(e,t.type),s.block(()=>{for(const s of t.rules)(0,r.shouldUseRule)(o,s)&&k(e,s.keyword,s.definition,t.type)})}function S(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function P(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function N(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,l.checkStrictMode)(e,t,e.opts.strictTypes)}b.validateFunctionCode=function(t){g(t)&&(y(t),m(t))?function(e){const{schema:t,opts:r,gen:s}=e;h(e,()=>{r.$comment&&t.$comment&&$(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,l.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(c.default.vErrors,null),s.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",i._`${r}.evaluated`),t.if(i._`${e.evaluated}.dynamicProps`,()=>t.assign(i._`${e.evaluated}.props`,i._`undefined`)),t.if(i._`${e.evaluated}.dynamicItems`,()=>t.assign(i._`${e.evaluated}.items`,i._`undefined`))}(e),v(e),function(e){const{gen:t,schemaEnv:r,validateName:s,ValidationError:n,opts:o}=e;r.$async?t.if(i._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(i._`new ${n}(${c.default.vErrors})`)):(t.assign(i._`${s}.errors`,c.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:r,items:s}){r instanceof i.Name&&e.assign(i._`${t}.props`,r);s instanceof i.Name&&e.assign(i._`${t}.items`,s)}(e),t.return(i._`${c.default.errors} === 0`))}(e)})}(t):h(t,()=>(0,e.topBoolOrEmptySchema)(t))};class I{constructor(e,t,r){if((0,o.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,l.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",O(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,i.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,i.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(i._`${t} !== undefined && (${(0,i.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?d.reportExtraError:d.reportError)(this,this.def.error,t)}$dataError(){(0,d.reportError)(this,this.def.$dataError||d.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,d.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=i.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=i.nil,t=i.nil){if(!this.$data)return;const{gen:r,schemaCode:s,schemaType:n,def:o}=this;r.if((0,i.or)(i._`${s} === undefined`,t)),e!==i.nil&&r.assign(e,!0),(n.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==i.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return(0,i.or)(function(){if(r.length){if(!(t instanceof i.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return i._`${(0,s.checkDataTypes)(e,t,o.opts.strictNumbers,s.DataType.Wrong)}`}return i.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return i._`!${r}(${t})`}return i.nil}())}subschema(e,t){const r=(0,a.getSubschema)(this.it,e);(0,a.extendSubschemaData)(r,this.it,e),(0,a.extendSubschemaMode)(r,e);const s={...this.it,...r,items:void 0,props:void 0};return p(s,t),s}mergeEvaluated(e,t){const{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=l.mergeEvaluated.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=l.mergeEvaluated.items(s,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:s}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return s.if(t,()=>this.mergeEvaluated(e,i.Name)),!0}}function k(e,t,r,s){const n=new I(e,r,t);"code"in r?r.code(n,s):n.$data&&r.validate?(0,o.funcKeywordCode)(n,r):"macro"in r?(0,o.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,o.funcKeywordCode)(n,r)}b.KeywordCxt=I;const C=/^\/(?:[^~]|~0|~1)*$/,T=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let n,o;if(""===e)return c.default.rootData;if("/"===e[0]){if(!C.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,o=c.default.rootData}else{const a=T.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+a[1];if(n=a[2],"#"===n){if(i>=t)throw new Error(d("property/index",i));return s[t-i]}if(i>t)throw new Error(d("data",i));if(o=r[t-i],!n)return o}let a=o;const u=n.split("/");for(const c of u)c&&(o=i._`${o}${(0,i.getProperty)((0,l.unescapeJsonPointer)(c))}`,a=i._`${a} && ${o}`);return a;function d(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return b.getData=O,b}var ge,ye={};function ve(){if(ge)return ye;ge=1,Object.defineProperty(ye,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return ye.default=e,ye}var $e,be={};function we(){if($e)return be;$e=1,Object.defineProperty(be,"__esModule",{value:!0});const e=pe();class t extends Error{constructor(t,r,s,n){super(n||`can't resolve reference ${s} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,s),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return be.default=t,be}var _e,Ee={};function Se(){if(_e)return Ee;_e=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.resolveSchema=Ee.getCompilingSchema=Ee.resolveRef=Ee.compileSchema=Ee.SchemaEnv=void 0;const e=A(),t=ve(),r=D(),s=pe(),n=j(),o=me();class a{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,s.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function i(n){const a=u.call(this,n);if(a)return a;const i=(0,s.getFullPath)(this.opts.uriResolver,n.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:d}=this.opts,h=new e.CodeGen(this.scope,{es5:c,lines:l,ownProperties:d});let f;n.$async&&(f=h.scopeValue("Error",{ref:t.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));const p=h.scopeName("validate");n.validateName=p;const m={gen:h,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:n.schema,code:(0,e.stringify)(n.schema)}:{ref:n.schema}),validateName:p,ValidationError:f,schema:n.schema,schemaEnv:n,rootId:i,baseId:n.baseId||i,schemaPath:e.nil,errSchemaPath:n.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(n),(0,o.validateFunctionCode)(m),h.optimize(this.opts.code.optimize);const t=h.toString();g=`${h.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,n));const s=new Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(p,{ref:s}),s.errors=null,s.schema=n.schema,s.schemaEnv=n,n.$async&&(s.$async=!0),!0===this.opts.code.source&&(s.source={validateName:p,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){const{props:t,items:r}=m;s.evaluated={props:t instanceof e.Name?void 0:t,items:r instanceof e.Name?void 0:r,dynamicProps:t instanceof e.Name,dynamicItems:r instanceof e.Name},s.source&&(s.source.evaluated=(0,e.stringify)(s.evaluated))}return n.validate=s,n}catch(y){throw delete n.validate,delete n.validateName,g&&this.logger.error("Error compiling schema, function code:",g),y}finally{this._compilations.delete(n)}}function c(e){return(0,s.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:i.call(this,e)}function u(e){for(const t of this._compilations)if(l(t,e))return t}function l(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function d(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){const r=this.opts.uriResolver.parse(t),n=(0,s._getFullPath)(this.opts.uriResolver,r);let o=(0,s.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return p.call(this,r,e);const c=(0,s.normalizeId)(n),u=this.refs[c]||this.schemas[c];if("string"==typeof u){const t=h.call(this,e,u);if("object"!=typeof(null==t?void 0:t.schema))return;return p.call(this,r,t)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||i.call(this,u),c===(0,s.normalizeId)(t)){const{schema:t}=u,{schemaId:r}=this.opts,n=t[r];return n&&(o=(0,s.resolveUrl)(this.opts.uriResolver,o,n)),new a({schema:t,schemaId:r,root:e,baseId:o})}return p.call(this,r,u)}}Ee.SchemaEnv=a,Ee.compileSchema=i,Ee.resolveRef=function(e,t,r){var n;r=(0,s.resolveUrl)(this.opts.uriResolver,t,r);const o=e.refs[r];if(o)return o;let i=d.call(this,e,r);if(void 0===i){const s=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:o}=this.opts;s&&(i=new a({schema:s,schemaId:o,root:e,baseId:t}))}return void 0!==i?e.refs[r]=c.call(this,i):void 0},Ee.getCompilingSchema=u,Ee.resolveSchema=h;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function p(e,{baseId:t,schema:r,root:o}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,n.unescapeFragment)(a)];if(void 0===e)return;const o="object"==typeof(r=e)&&r[this.opts.schemaId];!f.has(a)&&o&&(t=(0,s.resolveUrl)(this.opts.uriResolver,t,o))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){const e=(0,s.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=h.call(this,o,e)}const{schemaId:u}=this.opts;return c=c||new a({schema:r,schemaId:u,root:o,baseId:t}),c.schema!==c.root.schema?c:void 0}return Ee}const Pe={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var Ne,Ie,ke,Ce,Ae,Te,Oe,je,Me,xe={},Re={exports:{}};function Ve(){if(Ce)return ke;Ce=1;const{HEX:e}=Ie?Ne:(Ie=1,Ne={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}}),t=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function r(e){if(a(e,".")<3)return{host:e,isIPV4:!1};const r=e.match(t)||[],[s]=r;return s?{host:o(s,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function s(t,r=!1){let s="",n=!0;for(const o of t){if(void 0===e[o])return;"0"!==o&&!0===n&&(n=!1),n||(s+=o)}return r&&0===s.length&&(s="0"),s}function n(e){if(a(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},n=[],o=[];let a=!1,i=!1,c=!1;function u(){if(o.length){if(!1===a){const e=s(o);if(void 0===e)return r.error=!0,!1;n.push(e)}o.length=0}return!0}for(let s=0;s<e.length;s++){const l=e[s];if("["!==l&&"]"!==l)if(":"!==l)if("%"===l){if(!u())break;a=!0}else o.push(l);else{if(!0===i&&(c=!0),!u())break;if(t++,n.push(":"),t>7){r.error=!0;break}s-1>=0&&":"===e[s-1]&&(i=!0)}}return o.length&&(a?r.zone=o.join(""):c?n.push(o.join("")):n.push(s(o))),r.address=n.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,escapedHost:r,isIPV6:!0}}}function o(e,t){let r="",s=!0;const n=e.length;for(let o=0;o<n;o++){const a=e[o];"0"===a&&s?(o+1<=n&&e[o+1]===t||o+1===n)&&(r+=a,s=!1):(s=a===t,r+=a)}return r}function a(e,t){let r=0;for(let s=0;s<e.length;s++)e[s]===t&&r++;return r}const i=/^\.\.?\//u,c=/^\/\.(?:\/|$)/u,u=/^\/\.\.(?:\/|$)/u,l=/^\/?(?:.|\n)*?(?=\/|$)/u;return ke={recomposeAuthority:function(e){const t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let s=unescape(e.host);const o=r(s);if(o.isIPV4)s=o.host;else{const t=n(o.host);s=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(s)}return"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){const r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){const t=[];for(;e.length;)if(e.match(i))e=e.replace(i,"");else if(e.match(c))e=e.replace(c,"/");else if(e.match(u))e=e.replace(u,"/"),t.pop();else if("."===e||".."===e)e="";else{const r=e.match(l);if(!r)throw new Error("Unexpected dot segment condition");{const s=r[0];e=e.slice(s.length),t.push(s)}}return t.join("")},normalizeIPv4:r,normalizeIPv6:n,stringArrayToHexStripped:s}}function De(){if(Oe)return Re.exports;Oe=1;const{normalizeIPv6:e,normalizeIPv4:t,removeDotSegments:r,recomposeAuthority:s,normalizeComponentEncoding:n}=Ve(),o=function(){if(Te)return Ae;Te=1;const e=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function s(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function n(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const o={scheme:"http",domainHost:!0,parse:s,serialize:n},a={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=r(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(r(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},i={http:o,https:{scheme:"https",domainHost:o.domainHost,parse:s,serialize:n},ws:a,wss:{scheme:"wss",domainHost:a.domainHost,parse:a.parse,serialize:a.serialize},urn:{scheme:"urn",parse:function(e,r){if(!e.path)return e.error="URN can not be parsed",e;const s=e.path.match(t);if(s){const t=r.scheme||e.scheme||"urn";e.nid=s[1].toLowerCase(),e.nss=s[2];const n=`${t}:${r.nid||e.nid}`,o=i[n];e.path=void 0,o&&(e=o.parse(e,r))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){const r=t.scheme||e.scheme||"urn",s=e.nid.toLowerCase(),n=`${r}:${t.nid||s}`,o=i[n];o&&(e=o.serialize(e,t));const a=e,c=e.nss;return a.path=`${s||t.nid}:${c}`,t.skipEscape=!0,a},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){const s=t;return s.uuid=s.nss,s.nss=void 0,r.tolerant||s.uuid&&e.test(s.uuid)||(s.error=s.error||"UUID is not valid."),s},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};return Ae=i}();function a(e,t,s,n){const o={};return n||(e=l(i(e,s),s),t=l(i(t,s),s)),!(s=s||{}).tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=r(t.path||""),o.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=r(t.path||""),o.query=t.query):(t.path?("/"===t.path.charAt(0)?o.path=r(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path:o.path="/"+t.path,o.path=r(o.path)),o.query=t.query):(o.path=e.path,void 0!==t.query?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function i(e,t){const n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},a=Object.assign({},t),i=[],c=o[(a.scheme||n.scheme||"").toLowerCase()];c&&c.serialize&&c.serialize(n,a),void 0!==n.path&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==a.reference&&n.scheme&&i.push(n.scheme,":");const u=s(n);if(void 0!==u&&("suffix"!==a.reference&&i.push("//"),i.push(u),n.path&&"/"!==n.path.charAt(0)&&i.push("/")),void 0!==n.path){let e=n.path;a.absolutePath||c&&c.absolutePath||(e=r(e)),void 0===u&&(e=e.replace(/^\/\//u,"/%2F")),i.push(e)}return void 0!==n.query&&i.push("?",n.query),void 0!==n.fragment&&i.push("#",n.fragment),i.join("")}const c=Array.from({length:127},(e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)));const u=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function l(r,s){const n=Object.assign({},s),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=-1!==r.indexOf("%");let l=!1;"suffix"===n.reference&&(r=(n.scheme?n.scheme+":":"")+"//"+r);const d=r.match(u);if(d){if(a.scheme=d[1],a.userinfo=d[3],a.host=d[4],a.port=parseInt(d[5],10),a.path=d[6]||"",a.query=d[7],a.fragment=d[8],isNaN(a.port)&&(a.port=d[5]),a.host){const r=t(a.host);if(!1===r.isIPV4){const t=e(r.host);a.host=t.host.toLowerCase(),l=t.isIPV6}else a.host=r.host,l=!0}void 0!==a.scheme||void 0!==a.userinfo||void 0!==a.host||void 0!==a.port||void 0!==a.query||a.path?void 0===a.scheme?a.reference="relative":void 0===a.fragment?a.reference="absolute":a.reference="uri":a.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==a.reference&&(a.error=a.error||"URI is not a "+n.reference+" reference.");const r=o[(n.scheme||a.scheme||"").toLowerCase()];if(!(n.unicodeSupport||r&&r.unicodeSupport)&&a.host&&(n.domainHost||r&&r.domainHost)&&!1===l&&function(e){let t=0;for(let r=0,s=e.length;r<s;++r)if(t=e.charCodeAt(r),t>126||c[t])return!0;return!1}(a.host))try{a.host=URL.domainToASCII(a.host.toLowerCase())}catch(h){a.error=a.error||"Host's domain name can not be converted to ASCII: "+h}(!r||r&&!r.skipNormalize)&&(i&&void 0!==a.scheme&&(a.scheme=unescape(a.scheme)),i&&void 0!==a.host&&(a.host=unescape(a.host)),a.path&&(a.path=escape(unescape(a.path))),a.fragment&&(a.fragment=encodeURI(decodeURIComponent(a.fragment)))),r&&r.parse&&r.parse(a,n)}else a.error=a.error||"URI can not be parsed.";return a}const d={SCHEMES:o,normalize:function(e,t){return"string"==typeof e?e=i(l(e,t),t):"object"==typeof e&&(e=l(i(e,t),t)),e},resolve:function(e,t,r){const s=Object.assign({scheme:"null"},r);return i(a(l(e,s),l(t,s),s,!0),{...s,skipEscape:!0})},resolveComponents:a,equal:function(e,t,r){return"string"==typeof e?(e=unescape(e),e=i(n(l(e,r),!0),{...r,skipEscape:!0})):"object"==typeof e&&(e=i(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=i(n(l(t,r),!0),{...r,skipEscape:!0})):"object"==typeof t&&(t=i(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:i,parse:l};return Re.exports=d,Re.exports.default=d,Re.exports.fastUri=d,Re.exports}function Le(){return Me||(Me=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=me();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=A();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const s=ve(),n=we(),o=q(),a=Se(),i=A(),c=pe(),u=J(),l=j(),d=Pe,h=function(){if(je)return xe;je=1,Object.defineProperty(xe,"__esModule",{value:!0});const e=De();return e.code='require("ajv/dist/runtime/uri").default',xe.default=e,xe}(),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";const p=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function v(e){var t,r,s,n,o,a,i,c,u,l,d,p,m,g,y,v,$,b,w,_,E,S,P,N,I;const k=e.strict,C=null===(t=e.code)||void 0===t?void 0:t.optimize,A=!0===C||void 0===C?1:C||0,T=null!==(s=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==s?s:f,O=null!==(n=e.uriResolver)&&void 0!==n?n:h.default;return{strictSchema:null===(a=null!==(o=e.strictSchema)&&void 0!==o?o:k)||void 0===a||a,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:k)||void 0===c||c,strictTypes:null!==(l=null!==(u=e.strictTypes)&&void 0!==u?u:k)&&void 0!==l?l:"log",strictTuples:null!==(p=null!==(d=e.strictTuples)&&void 0!==d?d:k)&&void 0!==p?p:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:k)&&void 0!==g&&g,code:e.code?{...e.code,optimize:A,regExp:T}:{optimize:A,regExp:T},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(v=e.loopEnum)&&void 0!==v?v:200,meta:null===($=e.meta)||void 0===$||$,messages:null===(b=e.messages)||void 0===b||b,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(_=e.schemaId)&&void 0!==_?_:"$id",addUsedSchema:null===(E=e.addUsedSchema)||void 0===E||E,validateSchema:null===(S=e.validateSchema)||void 0===S||S,validateFormats:null===(P=e.validateFormats)||void 0===P||P,unicodeRegExp:null===(N=e.unicodeRegExp)||void 0===N||N,int32range:null===(I=e.int32range)||void 0===I||I,uriResolver:O}}class ${constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return N;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),b.call(this,g,e,"NOT SUPPORTED"),b.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=P.call(this),e.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&S.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),_.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let s=d;"id"===r&&(s={...d},s.id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const s=r(t);return"$async"in r||(this.errors=r.errors),s}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return s.call(this,e,t);async function s(e,t){await o.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function o(e){e&&!this.getSchema(e)&&await s.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),a.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await u.call(this,e);this.refs[e]||await o.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,s);return this}let n;if("object"==typeof e){const{schemaId:t}=this.opts;if(n=e[t],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,s,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const s=this.validate(r,e);if(!s&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=w.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,s=new a.SchemaEnv({schema:{},schemaId:r});if(t=a.resolveSchema.call(this,s,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=w.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(k.call(this,r,t),!t)return(0,l.eachItem)(r,e=>C.call(this,e)),this;O.call(this,t);const s={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,l.eachItem)(r,0===s.type.length?e=>C.call(this,e,s):e=>s.type.forEach(t=>C.call(this,e,s,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const s of t){const t=s.split("/").slice(1);let n=e;for(const e of t)n=n[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:s}=t.definition,o=n[e];s&&o&&(n[e]=x(o))}}return e}_removeAllSchemas(e,t){for(const r in e){const s=e[r];t&&!t.test(r)||("string"==typeof s?delete e[r]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[r]))}}_addSchema(e,t,r,s=this.opts.validateSchema,n=this.opts.addUsedSchema){let o;const{schemaId:i}=this.opts;if("object"==typeof e)o=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let u=this._cache.get(e);if(void 0!==u)return u;r=(0,c.normalizeId)(o||r);const l=c.getSchemaRefs.call(this,e,r);return u=new a.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:l}),this._cache.set(u.schema,u),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=u),s&&this.validateSchema(e,!0),u}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}function b(e,t,r,s="error"){for(const n in e){const o=n;o in t&&this.logger[s](`${r}: option ${n}. ${e[o]}`)}}function w(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function _(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function E(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function S(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function P(){const e={...this.opts};for(const t of p)delete e[t];return e}$.ValidationError=s.default,$.MissingRefError=n.default,e.default=$;const N={log(){},warn(){},error(){}};const I=/^[a-z_$][a-z0-9_$:-]*$/i;function k(e,t){const{RULES:r}=this;if((0,l.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!I.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function C(e,t,r){var s;const n=null==t?void 0:t.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let a=n?o.post:o.rules.find(({type:e})=>e===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?T.call(this,a,i,t.before):a.rules.push(i),o.all[e]=i,null===(s=t.implements)||void 0===s||s.forEach(e=>this.addKeyword(e))}function T(e,t,r){const s=e.rules.findIndex(e=>e.keyword===r);s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function O(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=x(t)),e.validateSchema=this.compile(t,!0))}const M={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function x(e){return{anyOf:[e,M]}}}($)),$}var Ue,ze={},Fe={},qe={};var Ge,Ke,Be={};function He(){if(Ke)return Fe;Ke=1,Object.defineProperty(Fe,"__esModule",{value:!0});const e=function(){if(Ue)return qe;Ue=1,Object.defineProperty(qe,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return qe.default=e,qe}(),t=function(){if(Ge)return Be;Ge=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.callRef=Be.getValidate=void 0;const e=we(),t=te(),r=A(),s=D(),n=Se(),o=j(),a={keyword:"$ref",schemaType:"string",code(t){const{gen:s,schema:o,it:a}=t,{baseId:u,schemaEnv:l,validateName:d,opts:h,self:f}=a,{root:p}=l;if(("#"===o||"#/"===o)&&u===p.baseId)return function(){if(l===p)return c(t,d,l,l.$async);const e=s.scopeValue("root",{ref:p});return c(t,r._`${e}.validate`,p,p.$async)}();const m=n.resolveRef.call(f,p,u,o);if(void 0===m)throw new e.default(a.opts.uriResolver,u,o);return m instanceof n.SchemaEnv?function(e){const r=i(t,e);c(t,r,e,e.$async)}(m):function(e){const n=s.scopeValue("schema",!0===h.code.source?{ref:e,code:(0,r.stringify)(e)}:{ref:e}),a=s.name("valid"),i=t.subschema({schema:e,dataTypes:[],schemaPath:r.nil,topSchemaRef:n,errSchemaPath:o},a);t.mergeEvaluated(i),t.ok(a)}(m)}};function i(e,t){const{gen:s}=e;return t.validate?s.scopeValue("validate",{ref:t.validate}):r._`${s.scopeValue("wrapper",{ref:t})}.validate`}function c(e,n,a,i){const{gen:c,it:u}=e,{allErrors:l,schemaEnv:d,opts:h}=u,f=h.passContext?s.default.this:r.nil;function p(e){const t=r._`${e}.errors`;c.assign(s.default.vErrors,r._`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`),c.assign(s.default.errors,r._`${s.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;const s=null===(t=null==a?void 0:a.validate)||void 0===t?void 0:t.evaluated;if(!0!==u.props)if(s&&!s.dynamicProps)void 0!==s.props&&(u.props=o.mergeEvaluated.props(c,s.props,u.props));else{const t=c.var("props",r._`${e}.evaluated.props`);u.props=o.mergeEvaluated.props(c,t,u.props,r.Name)}if(!0!==u.items)if(s&&!s.dynamicItems)void 0!==s.items&&(u.items=o.mergeEvaluated.items(c,s.items,u.items));else{const t=c.var("items",r._`${e}.evaluated.items`);u.items=o.mergeEvaluated.items(c,t,u.items,r.Name)}}i?function(){if(!d.$async)throw new Error("async schema referenced by sync schema");const s=c.let("valid");c.try(()=>{c.code(r._`await ${(0,t.callValidateCode)(e,n,f)}`),m(n),l||c.assign(s,!0)},e=>{c.if(r._`!(${e} instanceof ${u.ValidationError})`,()=>c.throw(e)),p(e),l||c.assign(s,!1)}),e.ok(s)}():e.result((0,t.callValidateCode)(e,n,f),()=>m(n),()=>p(n))}return Be.getValidate=i,Be.callRef=c,Be.default=a,Be}(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return Fe.default=r,Fe}var Je,We={},Ye={};var Qe,Xe={};var Ze,et,tt={},rt={};function st(){if(et)return tt;et=1,Object.defineProperty(tt,"__esModule",{value:!0});const e=A(),t=j(),r=function(){if(Ze)return rt;function e(e){const t=e.length;let r,s=0,n=0;for(;n<t;)s++,r=e.charCodeAt(n++),r>=55296&&r<=56319&&n<t&&(r=e.charCodeAt(n),56320==(64512&r)&&n++);return s}return Ze=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',rt}(),s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const s="maxLength"===t?"more":"fewer";return e.str`must NOT have ${s} than ${r} characters`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(s){const{keyword:n,data:o,schemaCode:a,it:i}=s,c="maxLength"===n?e.operators.GT:e.operators.LT,u=!1===i.opts.unicode?e._`${o}.length`:e._`${(0,t.useFunc)(s.gen,r.default)}(${o})`;s.fail$data(e._`${u} ${c} ${a}`)}};return tt.default=s,tt}var nt,ot={};var at,it={};var ct,ut={};function lt(){if(ct)return ut;ct=1,Object.defineProperty(ut,"__esModule",{value:!0});const e=te(),t=A(),r=j(),s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>t.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>t._`{missingProperty: ${e}}`},code(s){const{gen:n,schema:o,schemaCode:a,data:i,$data:c,it:u}=s,{opts:l}=u;if(!c&&0===o.length)return;const d=o.length>=l.loopRequired;if(u.allErrors?function(){if(d||c)s.block$data(t.nil,h);else for(const t of o)(0,e.checkReportMissingProp)(s,t)}():function(){const r=n.let("missing");if(d||c){const o=n.let("valid",!0);s.block$data(o,()=>function(r,o){s.setParams({missingProperty:r}),n.forOf(r,a,()=>{n.assign(o,(0,e.propertyInData)(n,i,r,l.ownProperties)),n.if((0,t.not)(o),()=>{s.error(),n.break()})},t.nil)}(r,o)),s.ok(o)}else n.if((0,e.checkMissingProp)(s,o,r)),(0,e.reportMissingProp)(s,r),n.else()}(),l.strictRequired){const e=s.parentSchema.properties,{definedProperties:t}=s.it;for(const s of o)if(void 0===(null==e?void 0:e[s])&&!t.has(s)){const e=`required property "${s}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(u,e,u.opts.strictRequired)}}function h(){n.forOf("prop",a,t=>{s.setParams({missingProperty:t}),n.if((0,e.noPropertyInData)(n,i,t,l.ownProperties),()=>s.error())})}}};return ut.default=s,ut}var dt,ht={};var ft,pt,mt={},gt={};function yt(){if(ft)return gt;ft=1,Object.defineProperty(gt,"__esModule",{value:!0});const e=ce();return e.code='require("ajv/dist/runtime/equal").default',gt.default=e,gt}function vt(){if(pt)return mt;pt=1,Object.defineProperty(mt,"__esModule",{value:!0});const e=J(),t=A(),r=j(),s=yt(),n={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:r}})=>t.str`must NOT have duplicate items (items ## ${r} and ${e} are identical)`,params:({params:{i:e,j:r}})=>t._`{i: ${e}, j: ${r}}`},code(n){const{gen:o,data:a,$data:i,schema:c,parentSchema:u,schemaCode:l,it:d}=n;if(!i&&!c)return;const h=o.let("valid"),f=u.items?(0,e.getSchemaTypes)(u.items):[];function p(r,s){const i=o.name("item"),c=(0,e.checkDataTypes)(f,i,d.opts.strictNumbers,e.DataType.Wrong),u=o.const("indices",t._`{}`);o.for(t._`;${r}--;`,()=>{o.let(i,t._`${a}[${r}]`),o.if(c,t._`continue`),f.length>1&&o.if(t._`typeof ${i} == "string"`,t._`${i} += "_"`),o.if(t._`typeof ${u}[${i}] == "number"`,()=>{o.assign(s,t._`${u}[${i}]`),n.error(),o.assign(h,!1).break()}).code(t._`${u}[${i}] = ${r}`)})}function m(e,i){const c=(0,r.useFunc)(o,s.default),u=o.name("outer");o.label(u).for(t._`;${e}--;`,()=>o.for(t._`${i} = ${e}; ${i}--;`,()=>o.if(t._`${c}(${a}[${e}], ${a}[${i}])`,()=>{n.error(),o.assign(h,!1).break(u)})))}n.block$data(h,function(){const e=o.let("i",t._`${a}.length`),r=o.let("j");n.setParams({i:e,j:r}),o.assign(h,!0),o.if(t._`${e} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?p:m)(e,r))},t._`${l} === false`),n.ok(h)}};return mt.default=n,mt}var $t,bt={};var wt,_t,Et={};function St(){if(wt)return Et;wt=1,Object.defineProperty(Et,"__esModule",{value:!0});const e=A(),t=j(),r=yt(),s={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>e._`{allowedValues: ${t}}`},code(s){const{gen:n,data:o,$data:a,schema:i,schemaCode:c,it:u}=s;if(!a&&0===i.length)throw new Error("enum must have non-empty array");const l=i.length>=u.opts.loopEnum;let d;const h=()=>null!=d?d:d=(0,t.useFunc)(n,r.default);let f;if(l||a)f=n.let("valid"),s.block$data(f,function(){n.assign(f,!1),n.forOf("v",c,t=>n.if(e._`${h()}(${o}, ${t})`,()=>n.assign(f,!0).break()))});else{if(!Array.isArray(i))throw new Error("ajv implementation error");const t=n.const("vSchema",c);f=(0,e.or)(...i.map((r,s)=>function(t,r){const s=i[r];return"object"==typeof s&&null!==s?e._`${h()}(${o}, ${t}[${r}])`:e._`${o} === ${s}`}(t,s)))}s.pass(f)}};return Et.default=s,Et}function Pt(){if(_t)return We;_t=1,Object.defineProperty(We,"__esModule",{value:!0});const e=function(){if(Je)return Ye;Je=1,Object.defineProperty(Ye,"__esModule",{value:!0});const e=A(),t=e.operators,r={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},s={message:({keyword:t,schemaCode:s})=>e.str`must be ${r[t].okStr} ${s}`,params:({keyword:t,schemaCode:s})=>e._`{comparison: ${r[t].okStr}, limit: ${s}}`},n={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:s,code(t){const{keyword:s,data:n,schemaCode:o}=t;t.fail$data(e._`${n} ${r[s].fail} ${o} || isNaN(${n})`)}};return Ye.default=n,Ye}(),t=function(){if(Qe)return Xe;Qe=1,Object.defineProperty(Xe,"__esModule",{value:!0});const e=A(),t={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>e.str`must be multiple of ${t}`,params:({schemaCode:t})=>e._`{multipleOf: ${t}}`},code(t){const{gen:r,data:s,schemaCode:n,it:o}=t,a=o.opts.multipleOfPrecision,i=r.let("res"),c=a?e._`Math.abs(Math.round(${i}) - ${i}) > 1e-${a}`:e._`${i} !== parseInt(${i})`;t.fail$data(e._`(${n} === 0 || (${i} = ${s}/${n}, ${c}))`)}};return Xe.default=t,Xe}(),r=st(),s=function(){if(nt)return ot;nt=1,Object.defineProperty(ot,"__esModule",{value:!0});const e=te(),t=A(),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>t.str`must match pattern "${e}"`,params:({schemaCode:e})=>t._`{pattern: ${e}}`},code(r){const{data:s,$data:n,schema:o,schemaCode:a,it:i}=r,c=i.opts.unicodeRegExp?"u":"",u=n?t._`(new RegExp(${a}, ${c}))`:(0,e.usePattern)(r,o);r.fail$data(t._`!${u}.test(${s})`)}};return ot.default=r,ot}(),n=function(){if(at)return it;at=1,Object.defineProperty(it,"__esModule",{value:!0});const e=A(),t={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const s="maxProperties"===t?"more":"fewer";return e.str`must NOT have ${s} than ${r} properties`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(t){const{keyword:r,data:s,schemaCode:n}=t,o="maxProperties"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`Object.keys(${s}).length ${o} ${n}`)}};return it.default=t,it}(),o=lt(),a=function(){if(dt)return ht;dt=1,Object.defineProperty(ht,"__esModule",{value:!0});const e=A(),t={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const s="maxItems"===t?"more":"fewer";return e.str`must NOT have ${s} than ${r} items`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(t){const{keyword:r,data:s,schemaCode:n}=t,o="maxItems"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`${s}.length ${o} ${n}`)}};return ht.default=t,ht}(),i=vt(),c=function(){if($t)return bt;$t=1,Object.defineProperty(bt,"__esModule",{value:!0});const e=A(),t=j(),r=yt(),s={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>e._`{allowedValue: ${t}}`},code(s){const{gen:n,data:o,$data:a,schemaCode:i,schema:c}=s;a||c&&"object"==typeof c?s.fail$data(e._`!${(0,t.useFunc)(n,r.default)}(${o}, ${i})`):s.fail(e._`${c} !== ${o}`)}};return bt.default=s,bt}(),u=St(),l=[e.default,t.default,r.default,s.default,n.default,o.default,a.default,i.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default];return We.default=l,We}var Nt,It={},kt={};function Ct(){if(Nt)return kt;Nt=1,Object.defineProperty(kt,"__esModule",{value:!0}),kt.validateAdditionalItems=void 0;const e=A(),t=j(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{parentSchema:r,it:n}=e,{items:o}=r;Array.isArray(o)?s(e,o):(0,t.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function s(r,s){const{gen:n,schema:o,data:a,keyword:i,it:c}=r;c.items=!0;const u=n.const("len",e._`${a}.length`);if(!1===o)r.setParams({len:s.length}),r.pass(e._`${u} <= ${s.length}`);else if("object"==typeof o&&!(0,t.alwaysValidSchema)(c,o)){const o=n.var("valid",e._`${u} <= ${s.length}`);n.if((0,e.not)(o),()=>function(o){n.forRange("i",s.length,u,s=>{r.subschema({keyword:i,dataProp:s,dataPropType:t.Type.Num},o),c.allErrors||n.if((0,e.not)(o),()=>n.break())})}(o)),r.ok(o)}}return kt.validateAdditionalItems=s,kt.default=r,kt}var At,Tt,Ot={},jt={};function Mt(){if(At)return jt;At=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.validateTuple=void 0;const e=A(),t=j(),r=te(),s={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:s,it:o}=e;if(Array.isArray(s))return n(e,"additionalItems",s);o.items=!0,(0,t.alwaysValidSchema)(o,s)||e.ok((0,r.validateArray)(e))}};function n(r,s,n=r.schema){const{gen:o,parentSchema:a,data:i,keyword:c,it:u}=r;!function(e){const{opts:r,errSchemaPath:o}=u,a=n.length,i=a===e.minItems&&(a===e.maxItems||!1===e[s]);if(r.strictTuples&&!i){const e=`"${c}" is ${a}-tuple, but minItems or maxItems/${s} are not specified or different at path "${o}"`;(0,t.checkStrictMode)(u,e,r.strictTuples)}}(a),u.opts.unevaluated&&n.length&&!0!==u.items&&(u.items=t.mergeEvaluated.items(o,n.length,u.items));const l=o.name("valid"),d=o.const("len",e._`${i}.length`);n.forEach((s,n)=>{(0,t.alwaysValidSchema)(u,s)||(o.if(e._`${d} > ${n}`,()=>r.subschema({keyword:c,schemaProp:n,dataProp:n},l)),r.ok(l))})}return jt.validateTuple=n,jt.default=s,jt}var xt,Rt={};var Vt,Dt={};function Lt(){if(Vt)return Dt;Vt=1,Object.defineProperty(Dt,"__esModule",{value:!0});const e=A(),t=j(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:r}})=>void 0===r?e.str`must contain at least ${t} valid item(s)`:e.str`must contain at least ${t} and no more than ${r} valid item(s)`,params:({params:{min:t,max:r}})=>void 0===r?e._`{minContains: ${t}}`:e._`{minContains: ${t}, maxContains: ${r}}`},code(r){const{gen:s,schema:n,parentSchema:o,data:a,it:i}=r;let c,u;const{minContains:l,maxContains:d}=o;i.opts.next?(c=void 0===l?1:l,u=d):c=1;const h=s.const("len",e._`${a}.length`);if(r.setParams({min:c,max:u}),void 0===u&&0===c)return void(0,t.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==u&&c>u)return(0,t.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),void r.fail();if((0,t.alwaysValidSchema)(i,n)){let t=e._`${h} >= ${c}`;return void 0!==u&&(t=e._`${t} && ${h} <= ${u}`),void r.pass(t)}i.items=!0;const f=s.name("valid");function p(){const t=s.name("_valid"),r=s.let("count",0);m(t,()=>s.if(t,()=>function(t){s.code(e._`${t}++`),void 0===u?s.if(e._`${t} >= ${c}`,()=>s.assign(f,!0).break()):(s.if(e._`${t} > ${u}`,()=>s.assign(f,!1).break()),1===c?s.assign(f,!0):s.if(e._`${t} >= ${c}`,()=>s.assign(f,!0)))}(r)))}function m(e,n){s.forRange("i",0,h,s=>{r.subschema({keyword:"contains",dataProp:s,dataPropType:t.Type.Num,compositeRule:!0},e),n()})}void 0===u&&1===c?m(f,()=>s.if(f,()=>s.break())):0===c?(s.let(f,!0),void 0!==u&&s.if(e._`${a}.length > 0`,p)):(s.let(f,!1),p()),r.result(f,()=>r.reset())}};return Dt.default=r,Dt}var Ut,zt={};function Ft(){return Ut||(Ut=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=A(),r=j(),s=te();e.error={message:({params:{property:e,depsCount:r,deps:s}})=>{const n=1===r?"property":"properties";return t.str`must have ${n} ${s} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:s,missingProperty:n}})=>t._`{property: ${e},
5
- missingProperty: ${n},
6
- depsCount: ${r},
7
- deps: ${s}}`};const n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const s in e){if("__proto__"===s)continue;(Array.isArray(e[s])?t:r)[s]=e[s]}return[t,r]}(e);o(e,t),a(e,r)}};function o(e,r=e.schema){const{gen:n,data:o,it:a}=e;if(0===Object.keys(r).length)return;const i=n.let("missing");for(const c in r){const u=r[c];if(0===u.length)continue;const l=(0,s.propertyInData)(n,o,c,a.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")}),a.allErrors?n.if(l,()=>{for(const t of u)(0,s.checkReportMissingProp)(e,t)}):(n.if(t._`${l} && (${(0,s.checkMissingProp)(e,u,i)})`),(0,s.reportMissingProp)(e,i),n.else())}}function a(e,t=e.schema){const{gen:n,data:o,keyword:a,it:i}=e,c=n.name("valid");for(const u in t)(0,r.alwaysValidSchema)(i,t[u])||(n.if((0,s.propertyInData)(n,o,u,i.opts.ownProperties),()=>{const t=e.subschema({keyword:a,schemaProp:u},c);e.mergeValidEvaluated(t,c)},()=>n.var(c,!0)),e.ok(c))}e.validatePropertyDeps=o,e.validateSchemaDeps=a,e.default=n}(zt)),zt}var qt,Gt={};var Kt,Bt={};function Ht(){if(Kt)return Bt;Kt=1,Object.defineProperty(Bt,"__esModule",{value:!0});const e=te(),t=A(),r=D(),s=j(),n={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>t._`{additionalProperty: ${e.additionalProperty}}`},code(n){const{gen:o,schema:a,parentSchema:i,data:c,errsCount:u,it:l}=n;if(!u)throw new Error("ajv implementation error");const{allErrors:d,opts:h}=l;if(l.props=!0,"all"!==h.removeAdditional&&(0,s.alwaysValidSchema)(l,a))return;const f=(0,e.allSchemaProperties)(i.properties),p=(0,e.allSchemaProperties)(i.patternProperties);function m(e){o.code(t._`delete ${c}[${e}]`)}function g(e){if("all"===h.removeAdditional||h.removeAdditional&&!1===a)m(e);else{if(!1===a)return n.setParams({additionalProperty:e}),n.error(),void(d||o.break());if("object"==typeof a&&!(0,s.alwaysValidSchema)(l,a)){const r=o.name("valid");"failing"===h.removeAdditional?(y(e,r,!1),o.if((0,t.not)(r),()=>{n.reset(),m(e)})):(y(e,r),d||o.if((0,t.not)(r),()=>o.break()))}}}function y(e,t,r){const o={keyword:"additionalProperties",dataProp:e,dataPropType:s.Type.Str};!1===r&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),n.subschema(o,t)}o.forIn("key",c,r=>{f.length||p.length?o.if(function(r){let a;if(f.length>8){const t=(0,s.schemaRefOrVal)(l,i.properties,"properties");a=(0,e.isOwnProperty)(o,t,r)}else a=f.length?(0,t.or)(...f.map(e=>t._`${r} === ${e}`)):t.nil;return p.length&&(a=(0,t.or)(a,...p.map(s=>t._`${(0,e.usePattern)(n,s)}.test(${r})`))),(0,t.not)(a)}(r),()=>g(r)):g(r)}),n.ok(t._`${u} === ${r.default.errors}`)}};return Bt.default=n,Bt}var Jt,Wt={};var Yt,Qt={};var Xt,Zt={};var er,tr={};var rr,sr={};var nr,or={};var ar,ir={};var cr,ur,lr={};function dr(){if(ur)return It;ur=1,Object.defineProperty(It,"__esModule",{value:!0});const e=Ct(),t=function(){if(Tt)return Ot;Tt=1,Object.defineProperty(Ot,"__esModule",{value:!0});const e=Mt(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return Ot.default=t,Ot}(),r=Mt(),s=function(){if(xt)return Rt;xt=1,Object.defineProperty(Rt,"__esModule",{value:!0});const e=A(),t=j(),r=te(),s=Ct(),n={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{schema:n,parentSchema:o,it:a}=e,{prefixItems:i}=o;a.items=!0,(0,t.alwaysValidSchema)(a,n)||(i?(0,s.validateAdditionalItems)(e,i):e.ok((0,r.validateArray)(e)))}};return Rt.default=n,Rt}(),n=Lt(),o=Ft(),a=function(){if(qt)return Gt;qt=1,Object.defineProperty(Gt,"__esModule",{value:!0});const e=A(),t=j(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>e._`{propertyName: ${t.propertyName}}`},code(r){const{gen:s,schema:n,data:o,it:a}=r;if((0,t.alwaysValidSchema)(a,n))return;const i=s.name("valid");s.forIn("key",o,t=>{r.setParams({propertyName:t}),r.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},i),s.if((0,e.not)(i),()=>{r.error(!0),a.allErrors||s.break()})}),r.ok(i)}};return Gt.default=r,Gt}(),i=Ht(),c=function(){if(Jt)return Wt;Jt=1,Object.defineProperty(Wt,"__esModule",{value:!0});const e=me(),t=te(),r=j(),s=Ht(),n={keyword:"properties",type:"object",schemaType:"object",code(n){const{gen:o,schema:a,parentSchema:i,data:c,it:u}=n;"all"===u.opts.removeAdditional&&void 0===i.additionalProperties&&s.default.code(new e.KeywordCxt(u,s.default,"additionalProperties"));const l=(0,t.allSchemaProperties)(a);for(const e of l)u.definedProperties.add(e);u.opts.unevaluated&&l.length&&!0!==u.props&&(u.props=r.mergeEvaluated.props(o,(0,r.toHash)(l),u.props));const d=l.filter(e=>!(0,r.alwaysValidSchema)(u,a[e]));if(0===d.length)return;const h=o.name("valid");for(const e of d)f(e)?p(e):(o.if((0,t.propertyInData)(o,c,e,u.opts.ownProperties)),p(e),u.allErrors||o.else().var(h,!0),o.endIf()),n.it.definedProperties.add(e),n.ok(h);function f(e){return u.opts.useDefaults&&!u.compositeRule&&void 0!==a[e].default}function p(e){n.subschema({keyword:"properties",schemaProp:e,dataProp:e},h)}}};return Wt.default=n,Wt}(),u=function(){if(Yt)return Qt;Yt=1,Object.defineProperty(Qt,"__esModule",{value:!0});const e=te(),t=A(),r=j(),s=j(),n={keyword:"patternProperties",type:"object",schemaType:"object",code(n){const{gen:o,schema:a,data:i,parentSchema:c,it:u}=n,{opts:l}=u,d=(0,e.allSchemaProperties)(a),h=d.filter(e=>(0,r.alwaysValidSchema)(u,a[e]));if(0===d.length||h.length===d.length&&(!u.opts.unevaluated||!0===u.props))return;const f=l.strictSchema&&!l.allowMatchingProperties&&c.properties,p=o.name("valid");!0===u.props||u.props instanceof t.Name||(u.props=(0,s.evaluatedPropsToName)(o,u.props));const{props:m}=u;function g(e){for(const t in f)new RegExp(e).test(t)&&(0,r.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(r){o.forIn("key",i,a=>{o.if(t._`${(0,e.usePattern)(n,r)}.test(${a})`,()=>{const e=h.includes(r);e||n.subschema({keyword:"patternProperties",schemaProp:r,dataProp:a,dataPropType:s.Type.Str},p),u.opts.unevaluated&&!0!==m?o.assign(t._`${m}[${a}]`,!0):e||u.allErrors||o.if((0,t.not)(p),()=>o.break())})})}!function(){for(const e of d)f&&g(e),u.allErrors?y(e):(o.var(p,!0),y(e),o.if(p))}()}};return Qt.default=n,Qt}(),l=function(){if(Xt)return Zt;Xt=1,Object.defineProperty(Zt,"__esModule",{value:!0});const e=j(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:r,schema:s,it:n}=t;if((0,e.alwaysValidSchema)(n,s))return void t.fail();const o=r.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};return Zt.default=t,Zt}(),d=function(){if(er)return tr;er=1,Object.defineProperty(tr,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:te().validateUnion,error:{message:"must match a schema in anyOf"}};return tr.default=e,tr}(),h=function(){if(rr)return sr;rr=1,Object.defineProperty(sr,"__esModule",{value:!0});const e=A(),t=j(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>e._`{passingSchemas: ${t.passing}}`},code(r){const{gen:s,schema:n,parentSchema:o,it:a}=r;if(!Array.isArray(n))throw new Error("ajv implementation error");if(a.opts.discriminator&&o.discriminator)return;const i=n,c=s.let("valid",!1),u=s.let("passing",null),l=s.name("_valid");r.setParams({passing:u}),s.block(function(){i.forEach((n,o)=>{let i;(0,t.alwaysValidSchema)(a,n)?s.var(l,!0):i=r.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},l),o>0&&s.if(e._`${l} && ${c}`).assign(c,!1).assign(u,e._`[${u}, ${o}]`).else(),s.if(l,()=>{s.assign(c,!0),s.assign(u,o),i&&r.mergeEvaluated(i,e.Name)})})}),r.result(c,()=>r.reset(),()=>r.error(!0))}};return sr.default=r,sr}(),f=function(){if(nr)return or;nr=1,Object.defineProperty(or,"__esModule",{value:!0});const e=j(),t={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:s,it:n}=t;if(!Array.isArray(s))throw new Error("ajv implementation error");const o=r.name("valid");s.forEach((r,s)=>{if((0,e.alwaysValidSchema)(n,r))return;const a=t.subschema({keyword:"allOf",schemaProp:s},o);t.ok(o),t.mergeEvaluated(a)})}};return or.default=t,or}(),p=function(){if(ar)return ir;ar=1,Object.defineProperty(ir,"__esModule",{value:!0});const e=A(),t=j(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>e.str`must match "${t.ifClause}" schema`,params:({params:t})=>e._`{failingKeyword: ${t.ifClause}}`},code(r){const{gen:n,parentSchema:o,it:a}=r;void 0===o.then&&void 0===o.else&&(0,t.checkStrictMode)(a,'"if" without "then" and "else" is ignored');const i=s(a,"then"),c=s(a,"else");if(!i&&!c)return;const u=n.let("valid",!0),l=n.name("_valid");if(function(){const e=r.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);r.mergeEvaluated(e)}(),r.reset(),i&&c){const e=n.let("ifClause");r.setParams({ifClause:e}),n.if(l,d("then",e),d("else",e))}else i?n.if(l,d("then")):n.if((0,e.not)(l),d("else"));function d(t,s){return()=>{const o=r.subschema({keyword:t},l);n.assign(u,l),r.mergeValidEvaluated(o,u),s?n.assign(s,e._`${t}`):r.setParams({ifClause:t})}}r.pass(u,()=>r.error(!0))}};function s(e,r){const s=e.schema[r];return void 0!==s&&!(0,t.alwaysValidSchema)(e,s)}return ir.default=r,ir}(),m=function(){if(cr)return lr;cr=1,Object.defineProperty(lr,"__esModule",{value:!0});const e=j(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:s}){void 0===r.if&&(0,e.checkStrictMode)(s,`"${t}" without "if" is ignored`)}};return lr.default=t,lr}();return It.default=function(g=!1){const y=[l.default,d.default,h.default,f.default,p.default,m.default,a.default,i.default,o.default,c.default,u.default];return g?y.push(t.default,s.default):y.push(e.default,r.default),y.push(n.default),y},It}var hr,fr,pr={},mr={};function gr(){if(fr)return pr;fr=1,Object.defineProperty(pr,"__esModule",{value:!0});const e=function(){if(hr)return mr;hr=1,Object.defineProperty(mr,"__esModule",{value:!0});const e=A(),t={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>e.str`must match format "${t}"`,params:({schemaCode:t})=>e._`{format: ${t}}`},code(t,r){const{gen:s,data:n,$data:o,schema:a,schemaCode:i,it:c}=t,{opts:u,errSchemaPath:l,schemaEnv:d,self:h}=c;u.validateFormats&&(o?function(){const o=s.scopeValue("formats",{ref:h.formats,code:u.code.formats}),a=s.const("fDef",e._`${o}[${i}]`),c=s.let("fType"),l=s.let("format");s.if(e._`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>s.assign(c,e._`${a}.type || "string"`).assign(l,e._`${a}.validate`),()=>s.assign(c,e._`"string"`).assign(l,a)),t.fail$data((0,e.or)(!1===u.strictSchema?e.nil:e._`${i} && !${l}`,function(){const t=d.$async?e._`(${a}.async ? await ${l}(${n}) : ${l}(${n}))`:e._`${l}(${n})`,s=e._`(typeof ${l} == "function" ? ${t} : ${l}.test(${n}))`;return e._`${l} && ${l} !== true && ${c} === ${r} && !${s}`}()))}():function(){const o=h.formats[a];if(!o)return void function(){if(!1!==u.strictSchema)throw new Error(e());function e(){return`unknown format "${a}" ignored in schema at path "${l}"`}h.logger.warn(e())}();if(!0===o)return;const[i,c,f]=function(t){const r=t instanceof RegExp?(0,e.regexpCode)(t):u.code.formats?e._`${u.code.formats}${(0,e.getProperty)(a)}`:void 0,n=s.scopeValue("formats",{key:a,ref:t,code:r});return"object"!=typeof t||t instanceof RegExp?["string",t,n]:[t.type||"string",t.validate,e._`${n}.validate`]}(o);i===r&&t.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!d.$async)throw new Error("async format in sync schema");return e._`await ${f}(${n})`}return"function"==typeof c?e._`${f}(${n})`:e._`${f}.test(${n})`}())}())}};return mr.default=t,mr}(),t=[e.default];return pr.default=t,pr}var yr,vr,$r={};function br(){if(vr)return ze;vr=1,Object.defineProperty(ze,"__esModule",{value:!0});const e=He(),t=Pt(),r=dr(),s=gr(),n=(yr||(yr=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.contentVocabulary=$r.metadataVocabulary=void 0,$r.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],$r.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),$r),o=[e.default,t.default,(0,r.default)(),s.default,n.metadataVocabulary,n.contentVocabulary];return ze.default=o,ze}var wr,_r,Er={},Sr={};function Pr(){if(_r)return Er;_r=1,Object.defineProperty(Er,"__esModule",{value:!0});const e=A(),t=(wr||(wr=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.DiscrError=void 0,(s=r||(Sr.DiscrError=r={})).Tag="tag",s.Mapping="mapping"),Sr);var r,s;const n=Se(),o=we(),a=j(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:r}})=>e===t.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:r,tagName:s}})=>e._`{error: ${t}, tag: ${s}, tagValue: ${r}}`},code(r){const{gen:s,data:i,schema:c,parentSchema:u,it:l}=r,{oneOf:d}=u;if(!l.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=c.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!d)throw new Error("discriminator: requires oneOf keyword");const f=s.let("valid",!1),p=s.const("tag",e._`${i}${(0,e.getProperty)(h)}`);function m(t){const n=s.name("valid"),o=r.subschema({keyword:"oneOf",schemaProp:t},n);return r.mergeEvaluated(o,e.Name),n}s.if(e._`typeof ${p} == "string"`,()=>function(){const i=function(){var e;const t={},r=i(u);let s=!0;for(let u=0;u<d.length;u++){let t=d[u];if((null==t?void 0:t.$ref)&&!(0,a.schemaHasRulesButRef)(t,l.self.RULES)){const e=t.$ref;if(t=n.resolveRef.call(l.self,l.schemaEnv.root,l.baseId,e),t instanceof n.SchemaEnv&&(t=t.schema),void 0===t)throw new o.default(l.opts.uriResolver,l.baseId,e)}const f=null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e[h];if("object"!=typeof f)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);s=s&&(r||i(t)),c(f,u)}if(!s)throw new Error(`discriminator: "${h}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(h)}function c(e,t){if(e.const)f(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const r of e.enum)f(r,t)}}function f(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${h}" values must be unique strings`);t[e]=r}}();s.if(!1);for(const t in i)s.elseIf(e._`${p} === ${t}`),s.assign(f,m(i[t]));s.else(),r.error(!1,{discrError:t.DiscrError.Mapping,tag:p,tagName:h}),s.endIf()}(),()=>r.error(!1,{discrError:t.DiscrError.Tag,tag:p,tagName:h})),r.ok(f)}};return Er.default=i,Er}const Nr={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};var Ir;const kr=g((Ir||(Ir=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const r=Le(),s=br(),n=Pr(),o=Nr,a=["/properties"],i="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=me();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=A();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var d=ve();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var h=we();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}(v,v.exports)),v.exports)),Cr={$schema:"http://json-schema.org/draft-07/schema#",title:"Virtualdisplay mapping configuration",description:"Schema for attribute-based 3D model configuration",type:"object",required:["attributes"],definitions:{attribute:{type:"object",description:"A configurable attribute with multiple possible values",required:["name","values"],properties:{name:{type:"string",description:"Unique attribute name (e.g., 'Color', 'Size')",minLength:1,pattern:"^\\S.*\\S$|^\\S$"},values:{type:"array",description:"Possible values for this attribute",minItems:1,items:{$ref:"#/definitions/attributeValue"}}}},attributeValue:{type:"object",description:"A single value option for an attribute",required:["value","nodeIds"],properties:{value:{type:"string",description:"Display value (e.g., 'Red', 'Large')",minLength:1,pattern:"^\\S.*\\S$|^\\S$"},nodeIds:{type:"array",description:"3D model node IDs controlled by this value",items:{type:"string",description:"Node ID in the 3D model"}},isSelected:{type:"boolean",description:"Whether this value is selected by default",default:!1}}}},properties:{attributes:{type:"array",description:"List of all configurable attributes",minItems:1,items:{$ref:"#/definitions/attribute"}}}};class Ar{static ajv=new kr({allErrors:!0,verbose:!0});static validateFn=this.ajv.compile(Cr);static validate(e){if(null==e)throw t.invalidMapping("Mapping configuration cannot be null or undefined");if(this.containsDynamicValues(e))this.validateBasicStructure(e);else if(!this.validateFn(e)){const e=this.validateFn.errors.map(e=>e.message).join(", ");throw t.invalidMapping(e)}}static containsDynamicValues(e){return!(void 0===e.attributes||!Array.isArray(e.attributes))&&e.attributes.some(e=>"function"==typeof e.values||!!Array.isArray(e.values)&&e.values.some(e=>"function"==typeof e.value||"function"==typeof e.nodeIds||"function"==typeof e.isSelected))}static validateBasicStructure(e){if(void 0===e.attributes||!Array.isArray(e.attributes))throw t.invalidMapping("attributes must be an array");if(0===e.attributes.length)throw t.invalidMapping("attributes array must not be empty");e.attributes.forEach((e,r)=>{if(void 0===e.name||""===e.name||"string"!=typeof e.name)throw t.invalidMapping(`attribute at index ${r} must have a name`);if(void 0===e.values)throw t.invalidMapping(`attribute '${e.name}' must have values`)})}}const Tr={MUTATION:"mutation",STATE:"state",CONFIG:"config",CAMERA:"camera",SNAPSHOT:"snapshot"};function Or(e){if(!Array.isArray(e))throw t.invalidMutations("must be an array");return{type:Tr.MUTATION,mutations:e.map(e=>e.toDto())}}function jr(e){return Mr(e)||function(e){if("object"!=typeof e||null===e)return!1;const t=e;return t.type===Tr.SNAPSHOT&&"string"==typeof t.filename&&"string"==typeof t.data}(e)}function Mr(e){if("object"!=typeof e||null===e)return!1;const t=e;return t.type===Tr.STATE&&Array.isArray(t.nodes)}class xr{attributes=new Map;eventBus;isInitialized=!1;mappingConfig=null;selections=new Map;currentState=new Map;constructor(e){this.eventBus=e,this.eventBus.on(r.STATE_CHANGED,e=>{this.syncStateWithAttributes(e.nodes)})}loadMapping(e){Ar.validate(e),this.mappingConfig=e,this.isInitialized&&(this.attributes.clear(),this.selections.clear(),this.currentState.clear()),this.attributes=this.evaluateMapping(),this.initializeSelections(),this.updateCurrentState(),this.isInitialized=!0;const t=this.getInitialMutations();if(t.length>0){const e=Or(t);this.eventBus.emit(r.MUTATION_MESSAGE,{message:e})}}selectAttributeValue(e,t){const s=this.attributes.get(e);if(void 0===s)return void i.warn("Attribute not found",{attributeName:e});if(!s.hasValue(t))return void i.warn("Value not found in attribute",{attributeName:e,value:t});this.selections.set(e,t);const n=new Map(this.currentState);this.hasDynamicMapping()&&(this.attributes=this.evaluateMapping()),this.updateCurrentState();const o=this.calculateMutations(n,this.currentState);o.length>0&&this.eventBus.emit(r.MUTATION_MESSAGE,{message:Or(o)})}getAttribute(e){return this.attributes.get(e)}getAllAttributes(){return Array.from(this.attributes.values())}get initialized(){return this.isInitialized}syncStateWithAttributes(e){if(!this.isInitialized)return;const t=new Map;for(const r of e)t.set(r.id,r.isVisible);for(const r of this.attributes.values())for(const e of r.getAllValues()){const r=e.nodeList.every(e=>t.get(e)??!1);e.setSelected(r)}}clear(){this.attributes.clear(),this.selections.clear(),this.currentState.clear(),this.mappingConfig=null,this.isInitialized=!1}createContext(){return{getValue:e=>this.selections.get(e),getAllValues:()=>new Map(this.selections)}}evaluateProperty(e,t){return"function"==typeof e?e(t):e}evaluateMapping(){if(null===this.mappingConfig)return new Map;const e=this.createContext(),t=new Map;for(const r of this.mappingConfig.attributes){const s=this.createAttributeFromConfig(r,e);t.set(s.name,s)}return t}createAttributeFromConfig(e,t){const r=new h(e.name),s=this.evaluateProperty(e.values,t);for(const n of s){const s=this.evaluateProperty(n.value,t),o=this.evaluateProperty(n.nodeIds,t),a=this.evaluateProperty(n.isSelected??!1,t),c=this.selections.get(e.name),u=new m(s,o,void 0!==c?c===s:a);r.addValue(u),i.debug("Created attribute value",u)}return r}initializeSelections(){for(const[e,t]of this.attributes){const r=t.getCurrentValue();void 0!==r&&this.selections.set(e,r.value)}}hasDynamicMapping(){return null!==this.mappingConfig&&Ar.containsDynamicValues(this.mappingConfig)}updateCurrentState(){this.currentState.clear();for(const[e,t]of this.attributes){const r=this.getVisibleNodesForAttribute(e,t);this.currentState.set(e,r)}}getVisibleNodesForAttribute(e,t){const r=new Set,s=this.selections.get(e);if(void 0===s)return r;const n=t.getValue(s);return void 0!==n&&n.nodeList.forEach(e=>r.add(e)),r}getInitialMutations(){const e=[];for(const t of this.attributes.values())e.push(...t.getDefaultMutations());return e}calculateMutations(e,t){const r=[],s=new Set;e.forEach(e=>e.forEach(e=>s.add(e))),t.forEach(e=>e.forEach(e=>s.add(e)));for(const n of s){const s=this.isNodeVisible(n,e),o=this.isNodeVisible(n,t);s&&!o&&r.push(p.hide(n)),!s&&o&&r.push(p.show(n))}return r}isNodeVisible(e,t){for(const r of t.values())if(r.has(e))return!0;return!1}}class Rr{constructor(e){this.eventBus=e}commands=[];rotate(e){return this.commands.push({action:"rotate",value:e}),this}tilt(e){return this.commands.push({action:"tilt",value:e}),this}zoom(e){return this.commands.push({action:"zoom",value:e}),this}set(){if(0===this.commands.length)return;const e={type:Tr.CAMERA,commands:this.commands};this.eventBus.emit(r.CAMERA_MESSAGE,{message:e}),this.commands=[]}reset(){const e={type:Tr.CAMERA,commands:[{action:"reset"}]};this.eventBus.emit(r.CAMERA_MESSAGE,{message:e})}}class Vr{listeners=new Map;on(e,t){const r=this.listeners.get(e)??[];r.push(t),this.listeners.set(e,r)}emit(e,t){const r=this.listeners.get(e);if(void 0===r||0===r.length)return;[...r].forEach(e=>{e(t)})}once(e,t){const r=s=>{this.off(e,r),t(s)};this.on(e,r)}off(e,t){const r=this.listeners.get(e);if(void 0===r)return;const s=r.indexOf(t);-1!==s&&r.splice(s,1)}}class Dr{eventBus;iframe;isReady=!1;queue=[];constructor(e){this.eventBus=e,this.setupIncomingMessages(),this.setupOutgoingMessages(),this.setupReadyListener()}setIframe(e){this.iframe=e}destroy(){window.removeEventListener("message",this.handleWindowMessage),this.queue.length=0,this.isReady=!1}queueOrSend(e){this.isReady?this.send(e):this.queue.push(e)}send(e){if(!this.canSend())return void i.warn("Cannot send message - iframe not ready",{type:e.type,hasIframe:void 0!==this.iframe,hasContentWindow:null!==this.iframe?.contentWindow});i.debug("Sending message to server",{type:e.type,targetOrigin:"*",payload:e}),this.iframe.contentWindow.postMessage(e,"*"),i.debug("Message sent to server",e)}canSend(){return null!==this.iframe?.contentWindow&&void 0!==this.iframe?.contentWindow}processQueue(){const e=[...this.queue];this.queue.length=0,e.forEach(e=>{this.send(e)})}handleWindowMessage=e=>{if(!jr(e.data))return;const t=e.data;i.info("Valid message received from server",{type:t.type,payload:t,origin:e.origin}),this.eventBus.emit(r.MESSAGE_RECEIVED,{message:t})};setupIncomingMessages(){window.addEventListener("message",this.handleWindowMessage)}setupOutgoingMessages(){[r.MUTATION_MESSAGE,r.CONFIG_MESSAGE,r.CAMERA_MESSAGE,r.SNAPSHOT_MESSAGE].forEach(e=>{this.eventBus.on(e,e=>{const t=e;this.queueOrSend(t.message)})})}setupReadyListener(){this.eventBus.once(r.IFRAME_READY,()=>{this.isReady||(this.isReady=!0,this.processQueue())})}}class Lr{eventBus;stateService;nodeId;constructor(e,t,r){this.eventBus=e,this.stateService=t,this.nodeId=r}show(){i.debug(`Showing node: ${this.nodeId}`);const e=p.show(this.nodeId);this.emitMutation(e)}hide(){i.debug(`Hiding node: ${this.nodeId}`);const e=p.hide(this.nodeId);this.emitMutation(e)}toggle(){const e=this.getNode();void 0!==e?e.isVisible?this.hide():this.show():i.warn(`Cannot toggle node ${this.nodeId}: node not found`)}get id(){return this.nodeId}get isVisible(){const e=this.getNode();return e?.isVisible??!1}getNode(){return this.stateService.getNode(this.nodeId)}get type(){return this.getNode()?.type}get name(){return this.getNode()?.name}emitMutation(e){const t=Or([e]);this.eventBus.emit(r.MUTATION_MESSAGE,{message:t})}}class Ur{id;name;type;visible;onChange;constructor(e){this.id=e.id,this.name=e.name,this.type=e.type,this.visible=e.visible}get isVisible(){return this.visible}show(){this.visible=!0}hide(){this.visible=!1}}class zr{nodes=new Map;eventBus;hasReceivedInitialSync=!1;constructor(e){this.eventBus=e,this.eventBus.on(r.MESSAGE_RECEIVED,e=>{this.handleMessage(e.message)})}handleMessage(e){i.debug("Handling message in StateService",{type:e.type,currentNodeCount:this.nodeCount}),Mr(e)&&this.updateState(e.nodes,e.isInitial)}updateState(e,t){i.debug("Updating state with nodes from server",{incomingNodes:e.length,isInitialState:t,currentNodes:this.nodeCount});for(const r of e){(!t||!this.nodes.has(r.id))&&this.updateOrCreateNode(r)}this.eventBus.emit(r.STATE_CHANGED,{nodes:this.getAllNodes()}),i.info("State updated",{totalNodes:this.nodeCount,wasInitialState:t}),t&&!this.hasReceivedInitialSync&&(this.hasReceivedInitialSync=!0,i.info("Initial state received - client is now ready"),this.eventBus.emit(r.INITIAL_STATE_RECEIVED,{}))}updateOrCreateNode(e){const t=this.nodes.get(e.id);if(void 0===t)return void this.createNewNode(e);const r=t.isVisible;t[e.visible?"show":"hide"](),r!==t.isVisible&&void 0!==t.onChange&&t.onChange(),i.debug("Updated existing node",{id:t.id,name:t.name,type:t.type,visible:t.isVisible})}createNewNode(e){const t=new Ur({id:e.id,name:e.name,type:e.type,visible:e.visible});this.nodes.set(t.id,t),i.debug("Created new node",{id:t.id,name:t.name,type:t.type,visible:t.isVisible})}getNode(e){return this.nodes.get(e)}getAllNodes(){return Array.from(this.nodes.values())}get isReady(){return this.hasReceivedInitialSync}get nodeCount(){return this.nodes.size}clear(){this.nodes.clear(),this.hasReceivedInitialSync=!1}}class Fr{constructor(e){this.filename=e}callbacks=new Set;developed=!1;photoData=null;onDeveloped(e){return this.developed&&null!==this.photoData?(e(this.photoData),this):(this.callbacks.add(e),this)}getFilename(){return this.filename}develop(e){this.developed||(this.photoData=e,this.developed=!0,this.callbacks.forEach(e=>{e(this.photoData)}),this.callbacks.clear())}}class qr{constructor(e){this.eventBus=e,i.debug("SnapshotMessageHandler initialized"),this.setupMessageListener()}pendingPhotos=new Map;registerPhoto(e){i.debug("Registering photo for development",{filename:e.getFilename()}),this.pendingPhotos.set(e.getFilename(),e),i.debug("Pending photos count",{count:this.pendingPhotos.size})}setupMessageListener(){i.debug("Setting up message listener for snapshot messages"),this.eventBus.on(r.MESSAGE_RECEIVED,e=>{const{message:t}=e;t.type===Tr.SNAPSHOT&&(i.debug("Processing snapshot message"),this.handleSnapshotDeveloped(t))})}handleSnapshotDeveloped(e){i.debug("Handling snapshot developed message",{filename:e.filename,dataLength:e.data.length,pendingCount:this.pendingPhotos.size});const t=this.pendingPhotos.get(e.filename);if(void 0!==t){i.debug("Found pending photo, developing...",{filename:e.filename});const r={filename:e.filename,data:e.data};return t.develop(r),this.pendingPhotos.delete(e.filename),void i.debug("Photo developed and removed from pending",{filename:e.filename,remainingCount:this.pendingPhotos.size})}i.warn("No pending photo found for filename",{filename:e.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())})}}class Gr{constructor(e){this.eventBus=e,this.messageHandler=new qr(e)}validExtensions=[".png",".jpg",".jpeg",".webp"];messageHandler;take(e){this.validateFilename(e),i.debug("Taking snapshot",{filename:e});const t=new Fr(e);return this.messageHandler.registerPhoto(t),this.eventBus.emit(r.SNAPSHOT_MESSAGE,{message:{type:Tr.SNAPSHOT,filename:e}}),t}validateFilename(r){if(""===r||"string"!=typeof r)throw new t("Filename must be a non-empty string",e.INVALID_PARAMETER);if(!this.validExtensions.some(e=>r.toLowerCase().endsWith(e)))throw new t(`Invalid filename: "${r}". Filename must end with one of: ${this.validExtensions.join(", ")}`,e.INVALID_PARAMETER);if(r.includes("..")||r.includes("/")||r.includes("\\"))throw new t('Filename cannot contain path separators or ".."',e.INVALID_PARAMETER)}}class Kr{eventBus;constructor(e){this.eventBus=e}sendInitialConfig(e){const t=this.buildUIConfig(e),r=this.buildViewerConfig(t,e.camera);void 0!==r&&this.sendConfig(r)}buildUIConfig(e){const t=this.extractUIValues(e);if(Object.values(t).some(e=>void 0!==e))return{...void 0!==t.arEnabled&&{arEnabled:t.arEnabled},...void 0!==t.fullscreenEnabled&&{fullscreenEnabled:t.fullscreenEnabled},...void 0!==t.loadingIndicatorEnabled&&{loadingIndicatorEnabled:t.loadingIndicatorEnabled}}}extractUIValues(e){return{arEnabled:e.arEnabled??e.ui?.arEnabled,fullscreenEnabled:e.fullscreenEnabled??e.ui?.fullscreenEnabled,loadingIndicatorEnabled:e.loadingIndicatorEnabled??e.ui?.loadingIndicatorEnabled}}buildViewerConfig(e,t){if(void 0!==e||void 0!==t)return{...void 0!==e&&{ui:e},...void 0!==t&&{camera:t}}}setArEnabled(e){i.debug(`Setting AR button enabled: ${e}`),this.updateUIConfig({arEnabled:e})}setFullscreenEnabled(e){i.debug(`Setting fullscreen button enabled: ${e}`),this.updateUIConfig({fullscreenEnabled:e})}setLoadingIndicatorEnabled(e){i.debug(`Setting loading indicator enabled: ${e}`),this.updateUIConfig({loadingIndicatorEnabled:e})}updateUIConfig(e){i.debug("Updating UI configuration",e),Object.keys(e).length>0&&this.sendConfig({ui:e})}hideAllUI(){i.debug("Hiding all UI elements"),this.sendUIConfig({arEnabled:!1,fullscreenEnabled:!1,loadingIndicatorEnabled:!1})}showAllUI(){i.debug("Showing all UI elements"),this.sendUIConfig({arEnabled:!0,fullscreenEnabled:!0,loadingIndicatorEnabled:!0})}sendUIConfig(e){this.sendConfig({ui:e})}sendConfig(e){const t={type:Tr.CONFIG,config:e};i.debug("Sending config",t),this.eventBus.emit(r.CONFIG_MESSAGE,{message:t})}}exports.AttributeSelector=d,exports.Camera=Rr,exports.ERROR_CODES=e,exports.EVENT_NAMES=r,exports.MESSAGE_TYPES=Tr,exports.MUTATION_TYPES=f,exports.MappingValidator=Ar,exports.ModelNode=Ur,exports.Mutation=p,exports.NODE_TYPES={MESH:"mesh",VARIANT:"variant"},exports.NodeSelector=Lr,exports.Photo=Fr,exports.Snapshot=Gr,exports.VirtualdisplayClient=class{eventBus;attributeService;stateService;messageHandler;viewerService;cameraApi;snapshotApi;options;iframe;constructor(e){this.options=e,this.eventBus=new Vr,this.attributeService=new xr(this.eventBus),this.stateService=new zr(this.eventBus),this.messageHandler=new Dr(this.eventBus),this.viewerService=new Kr(this.eventBus),this.cameraApi=new Rr(this.eventBus),this.snapshotApi=new Gr(this.eventBus),this.initializeLogging(),this.createAndConnectIframe(),this.setupInitialConfig()}initializeLogging(){!0===this.options.debug&&c(),i.info("Initializing Virtualdisplay client",{model:this.options.model,debug:this.options.debug,language:this.options.language})}createAndConnectIframe(){i.debug("Creating iframe for Virtualdisplay viewer");const e=new l(this.options,this.eventBus);this.iframe=e.create(),i.debug("Iframe created, setting up messaging"),this.messageHandler.setIframe(this.iframe)}setupInitialConfig(){this.eventBus.once(r.IFRAME_READY,()=>{this.viewerService.sendInitialConfig(this.options)})}setMapping(e){i.debug("Setting attribute mapping configuration",{attributeCount:e.attributes.length}),this.attributeService.loadMapping(e)}getAttribute(e){if(!this.attributeService.initialized)throw t.noMapping();if(void 0===this.attributeService.getAttribute(e))throw t.attributeNotFound(e);return i.debug(`Getting attribute selector for: ${e}`),new d(this.attributeService,e)}getNodeSelector(e){if(void 0!==this.stateService.getNode(e))return new Lr(this.eventBus,this.stateService,e);i.warn(`Node not found: ${e}`)}getNode(e){return this.stateService.getNode(e)}getNodes(){return this.stateService.getAllNodes()}get isReady(){return this.stateService.isReady}onReady(e){this.stateService.isReady?e():this.eventBus.once(r.INITIAL_STATE_RECEIVED,e)}get viewer(){return this.viewerService}get camera(){return this.cameraApi}get snapshot(){return this.snapshotApi}destroy(){i.info("Destroying Virtualdisplay client"),this.attributeService.clear(),this.stateService.clear(),this.messageHandler.destroy(),null!==this.iframe?.parentElement&&void 0!==this.iframe?.parentElement&&this.iframe.parentElement.removeChild(this.iframe),this.iframe=void 0,i.debug("Virtualdisplay client destroyed")}},exports.VirtualdisplayError=t,exports.VirtualdisplayViewerService=Kr,exports.enableDebugMode=c,exports.isDebugMode=function(){return"debug"===i.getLevel()},exports.logger=i,exports.mappingSchema=Cr;
8
- //# sourceMappingURL=virtualdisplay.client.cjs.js.map
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-BcutgqC9.cjs`);var t={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`},n=class e extends Error{code;constructor(e,t){super(e),this.name=`VirtualdisplayError`,this.code=t}static noMapping(){return new e(`No attributes available. Waiting for server metadata.`,t.NO_MAPPING)}static attributeNotFound(n){return new e(`Attribute "${n}" not found in mapping`,t.ATTRIBUTE_NOT_FOUND)}static valueNotFound(n,r){return new e(`Value "${r}" not found for attribute "${n}"`,t.VALUE_NOT_FOUND)}static parentNotFound(n){return new e(`Parent element not found: ${n}`,t.PARENT_NOT_FOUND)}static invalidParameter(n){return new e(n,t.INVALID_PARAMETER)}static snapshotFailed(n,r){return new e(`Snapshot failed for "${n}": ${r}`,t.SNAPSHOT_FAILED)}},r=class{defaultServer=`https://server.virtualdisplay.io`;options;constructor(e){this.options=e}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(),Object.assign(e.style,{width:`100%`,height:`100%`,border:`none`,display:`block`}),e.setAttribute(`allow`,`xr-spatial-tracking; fullscreen`),e}attachToParent(e){this.getParentElement().appendChild(e)}buildUrl(){let e=this.getServerUrl(),t=new URL(e);return t.searchParams.set(`license`,this.options.license),t.searchParams.set(`model`,this.options.model),this.options.language!==void 0&&t.searchParams.set(`language`,this.options.language),this.options.debug===!0&&t.searchParams.set(`debug`,`true`),this.options.traceparent!==void 0&&t.searchParams.set(`traceparent`,this.options.traceparent),t.toString()}getServerUrl(){return this.defaultServer}getParentElement(){if(typeof this.options.parent!=`string`)return this.options.parent;let e=document.querySelector(this.options.parent);if(e===null)throw n.parentNotFound(this.options.parent);return e}};function i(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=[`timestamp`,`level`,`msg`,`service`,`trace_id`,`span_id`],o=Object.entries(e).filter(([e])=>!a.includes(e)).map(([e,t])=>`${e}=${JSON.stringify(t)}`).join(` `);return`${t} ${n} [${r}] ${i}${o?` `+o:``}`}function a(e){return JSON.stringify(e)}function o(e,t){let n=t?i(e):a(e);e.level===`error`?console.error(n):e.level===`warn`?console.warn(n):console.log(n)}function s(e,t=0){let n={name:e.name,message:e.message};e.stack!==void 0&&(n.stack=e.stack);for(let t of Object.getOwnPropertyNames(e)){if(t===`name`||t===`message`||t===`stack`||t===`cause`)continue;let r=e[t];r!==void 0&&(n[t]=r)}return e.cause!==void 0&&e.cause!==null&&(n.cause=e.cause instanceof Error&&t<5?s(e.cause,t+1):String(e.cause)),n}function c(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r instanceof Error?s(r):r;return t}function l(){return new Date}function u(e){return e.toISOString()}function d(){return typeof navigator>`u`?``:navigator.userAgent}function f(){return typeof navigator>`u`?!1:navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1}function p(){return/iPhone|iPad|iPod/i.test(d())||f()}function m(){return/Android/i.test(d())}function h(){return p()||m()}var g=class e{constructor(e){this.config=e}log(e,t,n={}){let r=this.config.traceProvider?.()??{};o({timestamp:u(l()),level:e,msg:t,service:this.config.service,...r,...c(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)}with(t){let n=new e(this.config);return n.log=((e,n,r={})=>{this.log(e,n,{...t,...r})}).bind(this),n}};function _(e,t){return new g({service:e,isDev:t?.isDev===void 0?typeof process<`u`?process.env.NODE_ENV!==`production`:!0:t.isDev,traceProvider:t?.traceProvider})}function v(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 ee(e){return{debug:(t,n)=>e.debug(t,v(n)),info:(t,n)=>e.info(t,v(n)),warn:(t,n)=>e.warn(t,v(n)),error:(t,n)=>e.error(t,v(n))}}var te=!1,y=ee(_(`client`,{isDev:!1}));function ne(){te=!0,y=ee(_(`client`,{isDev:!0}))}function re(){return te}var ie=class{ready=!1;onReady;constructor(e){this.onReady=e}handleMappingReceived(){this.ready||(this.ready=!0,y.info(`Mapping received from server, client is now ready`),this.onReady?.())}get isReady(){return this.ready}clear(){this.ready=!1}},b={HANDSHAKE:`handshake`,MUTATION:`mutation`,STATE:`state`,LOADING_INDICATOR:`loading_indicator`,CAMERA:`camera`,SNAPSHOT:`snapshot`,MAPPING:`mapping`,AR_ACTIVATE:`ar_activate`,CONFIG:`config`,INTERACTION:`interaction`,ANNOTATION_PLACE_MODE:`annotation_place_mode`,ANNOTATION_PLACED:`annotation_placed`,ANNOTATION_TOGGLE:`annotation_toggle`},ae=new Set(Object.values(b));function oe(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.target==`string`?!1:typeof t.type==`string`&&ae.has(t.type)}function se(e){let t=x(e);return t!==null&&t.type===b.HANDSHAKE}function ce(e){let t=x(e);return t!==null&&t.type===b.MUTATION&&Array.isArray(t.results)}function le(e){let t=x(e);return t!==null&&t.type===b.SNAPSHOT&&(`data`in t||`error`in t)}function ue(e){let t=x(e);return t!==null&&t.type===b.CAMERA&&Array.isArray(t.transforms)}function de(e){let t=x(e);return t!==null&&t.type===b.MAPPING&&Array.isArray(t.attributes)}function fe(e){let t=x(e);return t!==null&&t.type===b.LOADING_INDICATOR&&typeof t.progress==`number`}function pe(e){let t=x(e);return t!==null&&t.type===b.CONFIG&&typeof t.viewerSettings==`object`}function me(e){let t=x(e);return t!==null&&t.type===b.ANNOTATION_PLACED&&typeof t.position==`object`&&t.position!==null}function x(e){return typeof e!=`object`||!e?null:e}var he=class{pending=[];isReady=!1;constructor(e){this.processor=e}enqueue(e){if(this.isReady){this.processor(e);return}this.pending.push(e)}markReady(){if(this.isReady||(this.isReady=!0,this.pending.length===0))return;let e=[...this.pending];this.pending.length=0;for(let t of e)this.processor(t)}get ready(){return this.isReady}get pendingCount(){return this.pending.length}hasPending(e){return this.pending.some(t=>t.type===e)}clear(){this.pending.length=0}},ge=class{handlers=new Map;publisher;consumer;shouldBuffer;listener=null;sourceId;targetOrigin;constructor(e,t){this.getTarget=e,this.sourceId=`vd-${Math.random().toString(36).slice(2,8)}`,this.targetOrigin=t?.targetOrigin??`*`,this.publisher=new he(e=>this.post(e)),this.consumer=new he(e=>this.routeToHandler(e)),this.shouldBuffer=t?.shouldBuffer??null,t?.bufferIncoming!==!0&&this.consumer.markReady()}on(e,t){this.handlers.set(e,t)}off(e){this.handlers.delete(e)}setTargetOrigin(e){this.targetOrigin=e}send(e){this.publisher.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(!oe(t)||t._source===this.sourceId)return;let n=this.getTarget();if(n!==null&&e.source!==null&&e.source!==n)return;let r=t;if(this.shouldBuffer!==null&&!this.shouldBuffer(r)){this.routeToHandler(r);return}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()}get ready(){return this.publisher.ready}get pendingCount(){return this.publisher.pendingCount}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=t(e);n instanceof Promise&&n.catch(t=>{let n=t instanceof Error?t.message:String(t);console.error(`Virtualdisplay: error handling ${e.type}: ${n}`)})}};new Set([b.CAMERA]);var S=class{placedCallbacks=[];constructor(e){this.send=e}setEnabled(e){this.send({type:b.ANNOTATION_TOGGLE,enabled:e})}startPlacing(){this.send({type:b.ANNOTATION_PLACE_MODE,enabled:!0})}stopPlacing(){this.send({type:b.ANNOTATION_PLACE_MODE,enabled:!1})}onPlaced(e){this.placedCallbacks.push(e)}handlePlaced(e){for(let t of this.placedCallbacks)t(e)}},C=class{isSelectedValue=!1;constructor(e,t){this.value=e,this.attribute=t}get isSelected(){return this.isSelectedValue}setSelected(e){this.isSelectedValue=e}},_e=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)}select(e){if(!this.values.has(e))throw n.valueNotFound(this.name,e);this.onSelect(this.name,e)}getValues(){return Array.from(this.values.values())}getValue(e){return this.values.get(e)}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){let t=new Map;for(let n of e){let e=new C(n,this.name);n===this.defaultValue&&e.setSelected(!0),t.set(n,e)}return t}},ve=class{attributes=new Map;constructor(e,t,n){for(let n of e){let e=this.buildOptions(n,t);this.attributes.set(n.name,new _e(e))}this.onMutationFailed=n}onMutationFailed;get(e){return this.attributes.get(e)}defaults(){let e=[];for(let t of this.attributes.values())t.defaultValue!==void 0&&e.push({name:t.name,value:t.defaultValue});return e}handleResults(e){for(let t of e){if(!t.success){this.onMutationFailed?.(t.name,t.value);continue}this.get(t.name)?.handleResult(t.value)}}buildOptions(e,t){let n={name:e.name,values:e.values,onSelect:(e,n)=>{t([{name:e,value:n}],!1)}};return e.defaultValue===void 0?n:{...n,defaultValue:e.defaultValue}}},ye=class{registry;pendingCallbacks=[];constructor(e,t){this.send=e,this.onMutationFailed=t}handleMappingReceived(e){y.debug(`Initializing from server mapping`,{attributeCount:e.attributes.length}),this.registry=new ve(e.attributes,(e,t)=>this.sendMutation(e,t),this.onMutationFailed),this.replayPendingCallbacks()}handleMutationResult(e){this.registry?.handleResults(e.results)}select(e,t){this.sendMutation([{name:e,value:t}],!1)}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);if(n===void 0){y.warn(`onChange: attribute "${e}" not found — callback will not fire`);return}n.onChange(t)}getAttribute(e){return this.registry?.get(e)}get hasMapping(){return this.registry!==void 0}sendMutation(e,t){let n={type:b.MUTATION,mutations:e,isInitial:t};this.send(n)}replayPendingCallbacks(){for(let{name:e,callback:t}of this.pendingCallbacks){let n=this.registry?.get(e);n===void 0&&y.warn(`onChange: attribute "${e}" not found — buffered callback will not fire`),n?.onChange(t)}this.pendingCallbacks.length=0}},be=class{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 n.invalidParameter(`No camera commands to execute. Call rotate(), tilt(), or zoom() before set().`);let e={type:b.CAMERA,commands:this.commands};this.send(e),this.commands=[]}validateFiniteNumber(e,t){if(!Number.isFinite(e))throw n.invalidParameter(`${t}() requires a finite number, got ${String(e)}`)}reset(){let e={type:b.CAMERA,commands:[{action:`reset`}]};this.send(e)}},xe=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;break;default:break}if(t){let e={rotation:this.rotation,tilt:this.tilt,zoom:this.zoom};for(let t of this.changeCallbacks)t(e)}}},Se=class{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())}},Ce=class{validExtensions=[`.png`];pendingPhotos=new Map;constructor(e){this.send=e}take(e){this.validateFilename(e),y.debug(`Taking snapshot`,{filename:e});let t=new Se(e);return this.pendingPhotos.set(t.getFilename(),t),this.send({type:b.SNAPSHOT,filename:e}),t}handleSnapshotResult(e){let r=this.pendingPhotos.get(e.filename);if(r===void 0){y.warn(`No pending photo found for filename`,{filename:e.filename,pendingFilenames:Array.from(this.pendingPhotos.keys())});return}if(this.pendingPhotos.delete(e.filename),e.error!==void 0){r.fail(new n(e.error,t.SNAPSHOT_FAILED));return}e.data!==void 0&&r.develop({filename:e.filename,data:e.data})}validateFilename(e){if(e===``||typeof e!=`string`)throw new n(`Filename must be a non-empty string`,t.INVALID_PARAMETER);if(!this.validExtensions.some(t=>e.toLowerCase().endsWith(t)))throw new n(`Invalid filename: "${e}". Filename must end with one of: ${this.validExtensions.join(`, `)}`,t.INVALID_PARAMETER);if(e.includes(`..`)||e.includes(`/`)||e.includes(`\\`))throw new n(`Filename cannot contain path separators or ".."`,t.INVALID_PARAMETER)}},we=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)}}},Te={},Ee=[`en`,`nl`,`de`],w=[`baseLocale`],De=[],Oe,ke;function Ae(e){if(De.length===0)return;let t=typeof e==`string`?e:e.href;if(Oe===t)return ke;let n=new URL(t,`http://dummy.com`),r;for(let e of De)if(new Te(e.match,n.href).exec(n.href)){r=e;break}return Oe=t,ke=r,r}function je(e){let t=Ae(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:w}var Me=void 0,T=typeof window>`u`;globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};var E=!1,D=()=>{if(Me){let e=Me?.getStore()?.locale;if(e)return e}let e=w;!T&&typeof window<`u`&&window.location?.href&&(e=je(window.location.href));let t=Ne(e,typeof window<`u`?window.location?.href:void 0);if(t)return E||(E=!0,O(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found`)};function Ne(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(j(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 Fe(t)}}let e=k(n);if(e)return e}}var Pe=e=>{e?window.location.href=e:window.location.reload()},O=(e,t)=>{let n={reload:!0,...t},r;try{r=D()}catch{}let i=[],a=w;!T&&typeof window<`u`&&window.location?.href&&(a=je(window.location.href));for(let t of a)if(t===`baseLocale`)continue;else if(j(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&&Pe(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()};function k(e){if(typeof e!=`string`)return;let t=e.toLowerCase();for(let e of Ee)if(e.toLowerCase()===t)return e}function Fe(e){let t=k(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${Ee.join(`, `)}`)}var A=new Map;function j(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}var Ie=()=>`Activate AR`,Le=()=>`AR activeren`,Re=()=>`AR aktivieren`,ze=((e={},t={})=>{let n=t.locale??D();return n===`en`?Ie(e):n===`nl`?Le(e):Re(e)}),Be=()=>`Scan to view in AR`,Ve=()=>`Scan om in AR te bekijken`,He=()=>`Scannen für AR-Ansicht`,Ue=((e={},t={})=>{let n=t.locale??D();return n===`en`?Be(e):n===`nl`?Ve(e):He(e)}),We=()=>`Use your smartphone camera to scan this QR code`,Ge=()=>`Gebruik de camera van je smartphone om deze QR-code te scannen`,Ke=()=>`Verwenden Sie die Kamera Ihres Smartphones, um diesen QR-Code zu scannen`,qe=((e={},t={})=>{let n=t.locale??D();return n===`en`?We(e):n===`nl`?Ge(e):Ke(e)}),Je=()=>`The 3D model will open in your phone's AR mode`,Ye=()=>`Het 3D-model wordt geopend in de AR-modus van je telefoon`,Xe=()=>`Das 3D-Modell wird im AR-Modus Ihres Telefons geöffnet`,Ze=((e={},t={})=>{let n=t.locale??D();return n===`en`?Je(e):n===`nl`?Ye(e):Xe(e)}),Qe=()=>`Close`,$e=()=>`Sluiten`,et=()=>`Schließen`,tt=((e={},t={})=>{let n=t.locale??D();return n===`en`?Qe(e):n===`nl`?$e(e):et(e)}),nt=()=>`Toggle fullscreen`,rt=()=>`Volledig scherm`,it=()=>`Vollbild umschalten`,at=((e={},t={})=>{let n=t.locale??D();return n===`en`?nt(e):n===`nl`?rt(e):it(e)}),ot=()=>`Downloading`,st=()=>`Downloaden`,ct=()=>`Herunterladen`,M=((e={},t={})=>{let n=t.locale??D();return n===`en`?ot(e):n===`nl`?st(e):ct(e)}),lt=()=>`Rendering`,ut=()=>`Renderen`,dt=()=>`Rendern`,ft=((e={},t={})=>{let n=t.locale??D();return n===`en`?lt(e):n===`nl`?ut(e):dt(e)}),pt=()=>`Screenshot`,mt=()=>`Screenshot`,ht=()=>`Screenshot`,gt=((e={},t={})=>{let n=t.locale??D();return n===`en`?pt(e):n===`nl`?mt(e):ht(e)}),_t=()=>`Reset camera`,vt=()=>`Camera resetten`,yt=()=>`Kamera zurücksetzen`,bt=((e={},t={})=>{let n=t.locale??D();return n===`en`?_t(e):n===`nl`?vt(e):yt(e)}),xt=()=>`Zoom in`,St=()=>`Inzoomen`,Ct=()=>`Hineinzoomen`,wt=((e={},t={})=>{let n=t.locale??D();return n===`en`?xt(e):n===`nl`?St(e):Ct(e)}),Tt=()=>`Zoom out`,Et=()=>`Uitzoomen`,Dt=()=>`Herauszoomen`,Ot=((e={},t={})=>{let n=t.locale??D();return n===`en`?Tt(e):n===`nl`?Et(e):Dt(e)}),kt=()=>`Rotate left`,At=()=>`Naar links draaien`,jt=()=>`Nach links drehen`,Mt=((e={},t={})=>{let n=t.locale??D();return n===`en`?kt(e):n===`nl`?At(e):jt(e)}),Nt=()=>`Rotate right`,Pt=()=>`Naar rechts draaien`,Ft=()=>`Nach rechts drehen`,It=((e={},t={})=>{let n=t.locale??D();return n===`en`?Nt(e):n===`nl`?Pt(e):Ft(e)}),Lt=()=>`Tilt up`,Rt=()=>`Omhoog kantelen`,zt=()=>`Nach oben kippen`,Bt=((e={},t={})=>{let n=t.locale??D();return n===`en`?Lt(e):n===`nl`?Rt(e):zt(e)}),Vt=()=>`Tilt down`,Ht=()=>`Omlaag kantelen`,Ut=()=>`Nach unten kippen`,Wt=((e={},t={})=>{let n=t.locale??D();return n===`en`?Vt(e):n===`nl`?Ht(e):Ut(e)}),Gt={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`},N=([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=N(e);r.appendChild(t)}),r},P=(e,t={})=>N([`svg`,{...Gt,...t},e]),Kt=[[`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`}]],qt=[[`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`}]],F=[[`path`,{d:`m6 9 6 6 6-6`}]],Jt=[[`path`,{d:`m15 18-6-6 6-6`}]],Yt=[[`path`,{d:`m9 18 6-6-6-6`}]],Xt=[[`path`,{d:`m18 15-6-6-6 6`}]],Zt=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],Qt=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],$t=[[`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`}]],en=[[`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`}]],tn=[[`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 I(e,{size:t=20,strokeWidth:n=1.75}={}){return P(e,{width:t,height:t,"stroke-width":n})}var L={ar:e=>I(Kt,e),fullscreen:e=>I(Zt,e),exitFullscreen:e=>I(Qt,e),screenshot:e=>I(qt,e),tiltUp:e=>I(Xt,e),tiltDown:e=>I(F,e),rotateLeft:e=>I(Jt,e),rotateRight:e=>I(Yt,e),zoomIn:e=>I(en,e),zoomOut:e=>I(tn,e),reset:e=>I($t,e)},R=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)}},z={brand:{DEFAULT:`#171717`,primary:`#171717`,hover:`#262626`,light:`#f5f5f5`,50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},semantic:{success:`#16a34a`,warning:`#ca8a04`,error:`#dc2626`,info:`#0891b2`},neutral:{50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},white:`#ffffff`,black:`#000000`},B={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`};B[1],B[2],B[4],B[6],B[8],B[12];var nn=class{element;constructor(){this.element=document.createElement(`div`),Object.assign(this.element.style,{background:z.white,borderRadius:B[3],padding:B[6],boxShadow:`0 ${B[2]} ${B[8]} oklch(0% 0 0 / 20%)`,maxWidth:`20rem`,width:`100%`})}},rn=class{card;backdrop;keyHandler=null;constructor(e={}){this.options=e,this.card=new nn,this.backdrop=this.createBackdrop(),this.backdrop.appendChild(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:B[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}},an=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.addEventListener(`click`,()=>{this.selectCallback?.(i)}),this.element.appendChild(a)}}setSelected(e){for(let t of this.element.querySelectorAll(`.ui-toggle-group-item`))t.dataset.state=t.dataset.value===e?`on`:`off`}onSelect(e){this.selectCallback=e}},on=class{element;select;constructor(e,t,n,r,i){this.select=document.createElement(`select`),this.select.className=`ui-native-select`,this.select.dataset.name=e;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=P(F,{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)})}},V={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`}},sn=V.fontFamily.sans.join(`, `),cn=class{qrLib=null;dialog=null;async show(t){this.hide(),this.qrLib??=await Promise.resolve().then(()=>e.n(require(`./browser-CDLfpTNV.cjs`).default,1));let n=await this.qrLib.toDataURL(t,{width:256,margin:4,errorCorrectionLevel:`M`,color:{dark:z.black,light:z.white}});this.dialog=new rn({onClose:()=>{this.dialog=null}}),Object.assign(this.dialog.card.element.style,{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:B[3],fontFamily:sn}),this.dialog.card.element.appendChild(this.createText(Ue(),{fontSize:V.fontSize.base,fontWeight:V.fontWeight.semibold,color:z.neutral[900]})),this.dialog.card.element.appendChild(this.createText(qe(),{fontSize:V.fontSize.sm,color:z.neutral[600]})),this.dialog.card.element.appendChild(this.createQrImage(n)),this.dialog.card.element.appendChild(this.createText(Ze(),{fontSize:V.fontSize.xs,color:z.neutral[500]}));let r=new R({variant:`outline`,label:tt(),onClick:()=>{this.hide()}});this.dialog.card.element.appendChild(r.element),this.dialog.open()}hide(){this.dialog?.close(),this.dialog=null}createText(e,t){let n=document.createElement(`p`);return n.textContent=e,Object.assign(n.style,{margin:`0`,textAlign:`center`,...t}),n}createQrImage(e){let t=document.createElement(`img`);return t.src=e,t.alt=`QR code`,Object.assign(t.style,{width:B[24],height:B[24],borderRadius:B[1]}),t}},H=V.fontFamily.sans.join(`, `),ln=`
2
+ :root {
3
+ --primary: oklch(5% 0 0);
4
+ --primary-foreground: oklch(100% 0 0);
5
+ --secondary: oklch(92% 0 0);
6
+ --secondary-foreground: oklch(5% 0 0);
7
+ --background: oklch(100% 0 0);
8
+ --foreground: oklch(5% 0 0);
9
+ --border: oklch(92% 0 0);
10
+ --ring: oklch(44% 0 0);
11
+ --radius: 0.625rem;
12
+ --accent: oklch(92% 0 0);
13
+ --accent-foreground: oklch(5% 0 0);
14
+ --muted-foreground: oklch(44% 0 0);
15
+ }
16
+
17
+ /* ── Button ──────────────────────────────────────────────── */
18
+ .ui-btn {
19
+ display: inline-flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ gap: 0.5rem;
23
+ border: 1px solid transparent;
24
+ border-radius: var(--radius);
25
+ font-family: ${H};
26
+ font-size: 0.875rem;
27
+ font-weight: 600;
28
+ white-space: nowrap;
29
+ cursor: pointer;
30
+ transition: all 200ms;
31
+ flex-shrink: 0;
32
+ }
33
+ .ui-btn:active { transform: scale(0.98); }
34
+ .ui-btn:disabled { opacity: 0.5; pointer-events: none; }
35
+ .ui-btn svg { inline-size: 1rem; block-size: 1rem; pointer-events: none; flex-shrink: 0; }
36
+
37
+ .ui-btn--default {
38
+ background: var(--primary);
39
+ color: var(--primary-foreground);
40
+ box-shadow: 0 1px 3px oklch(5% 0 0 / 20%);
41
+ }
42
+ .ui-btn--default:hover { background: oklch(10% 0 0); }
43
+
44
+ .ui-btn--outline {
45
+ background: var(--background);
46
+ color: var(--foreground);
47
+ border-color: var(--border);
48
+ box-shadow: 0 1px 2px oklch(5% 0 0 / 8%);
49
+ }
50
+ .ui-btn--outline:hover { background: var(--accent); border-color: oklch(85% 0 0); }
51
+
52
+ .ui-btn--secondary {
53
+ background: var(--secondary);
54
+ color: var(--secondary-foreground);
55
+ box-shadow: 0 1px 2px oklch(5% 0 0 / 8%);
56
+ }
57
+ .ui-btn--secondary:hover { background: oklch(88% 0 0); }
58
+
59
+ .ui-btn--ghost { background: transparent; color: var(--foreground); }
60
+ .ui-btn--ghost:hover { background: var(--accent); }
61
+
62
+ .ui-btn--size-default { block-size: 2.25rem; padding: 0 1rem; }
63
+ .ui-btn--size-sm { block-size: 2rem; padding: 0 0.75rem; border-radius: calc(var(--radius) - 0.125rem); }
64
+ .ui-btn--size-lg { block-size: 2.5rem; padding: 0 1.5rem; }
65
+ .ui-btn--size-icon { inline-size: 2.25rem; block-size: 2.25rem; padding: 0; }
66
+ .ui-btn--size-icon-sm { inline-size: 2rem; block-size: 2rem; padding: 0; }
67
+ .ui-btn--size-icon-lg { inline-size: 2.5rem; block-size: 2.5rem; padding: 0; }
68
+
69
+ /* ── Toggle group ────────────────────────────────────────── */
70
+ .ui-toggle-group { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }
71
+
72
+ .ui-toggle-group-item {
73
+ display: inline-flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ block-size: 2rem;
77
+ padding: 0 0.75rem;
78
+ border: 1px solid var(--border);
79
+ border-radius: var(--radius);
80
+ background: var(--background);
81
+ color: var(--foreground);
82
+ font-family: ${H};
83
+ font-size: 0.875rem;
84
+ font-weight: 600;
85
+ cursor: pointer;
86
+ white-space: nowrap;
87
+ transition: all 200ms;
88
+ box-shadow: 0 1px 2px oklch(5% 0 0 / 8%);
89
+ }
90
+ .ui-toggle-group-item:hover { background: var(--accent); border-color: oklch(85% 0 0); }
91
+ .ui-toggle-group-item:active { transform: scale(0.98); }
92
+ .ui-toggle-group-item[data-state="on"] {
93
+ background: var(--primary);
94
+ color: var(--primary-foreground);
95
+ border-color: var(--primary);
96
+ }
97
+ .ui-toggle-group-item[data-state="on"]:hover { background: oklch(10% 0 0); }
98
+
99
+ /* ── Native select ───────────────────────────────────────── */
100
+ .ui-native-select-wrap {
101
+ position: relative;
102
+ display: inline-flex;
103
+ min-inline-size: 8rem;
104
+ }
105
+
106
+ .ui-native-select {
107
+ display: block;
108
+ inline-size: 100%;
109
+ block-size: 2.25rem;
110
+ padding: 0 2.25rem 0 0.75rem;
111
+ border: 1px solid var(--border);
112
+ border-radius: var(--radius);
113
+ background: var(--background);
114
+ appearance: none;
115
+ color: var(--foreground);
116
+ font-family: ${H};
117
+ font-size: 0.875rem;
118
+ font-weight: 400;
119
+ cursor: pointer;
120
+ transition: color 200ms, box-shadow 200ms, border-color 200ms;
121
+ box-shadow: 0 1px 2px oklch(5% 0 0 / 8%);
122
+ }
123
+ .ui-native-select:hover { border-color: oklch(85% 0 0); }
124
+ .ui-native-select:focus-visible {
125
+ outline: none;
126
+ border-color: var(--ring);
127
+ box-shadow: 0 0 0 3px oklch(5% 0 0 / 12%);
128
+ }
129
+
130
+ .ui-native-select-icon {
131
+ position: absolute;
132
+ inset-block-start: 50%;
133
+ inset-inline-end: 0.625rem;
134
+ transform: translateY(-50%);
135
+ color: var(--muted-foreground);
136
+ pointer-events: none;
137
+ }
138
+
139
+ /* ── Annotation layer ───────────────────────────────────── */
140
+ .vd-annotations-layer {
141
+ position: absolute;
142
+ inset-block-start: 0;
143
+ inset-inline-start: 0;
144
+ inline-size: 100%;
145
+ block-size: 100%;
146
+ pointer-events: none;
147
+ overflow: visible !important; /* override CSS2DRenderer inline style */
148
+ }
149
+
150
+ .vd-annotation-marker {
151
+ display: flex;
152
+ align-items: center;
153
+ justify-content: center;
154
+ inline-size: 1.75rem;
155
+ block-size: 1.75rem;
156
+ border-radius: 50%;
157
+ border: 2px solid oklch(100% 0 0);
158
+ background: var(--primary);
159
+ color: var(--primary-foreground);
160
+ font-family: ${H};
161
+ font-size: 0.8125rem;
162
+ font-weight: 600;
163
+ cursor: pointer;
164
+ pointer-events: auto;
165
+ box-shadow: 0 2px 8px oklch(5% 0 0 / 20%);
166
+ transition: transform 100ms ease;
167
+ position: relative;
168
+ }
169
+ .vd-annotation-marker:hover { transform: scale(1.1); }
170
+
171
+ .vd-annotation-popup {
172
+ position: absolute;
173
+ inset-block-end: calc(100% + 0.5rem);
174
+ inset-inline-start: 50%;
175
+ transform: translateX(-50%);
176
+ background: var(--background);
177
+ color: var(--foreground);
178
+ border: 1px solid var(--border);
179
+ border-radius: var(--radius);
180
+ padding: 0.75rem 1rem;
181
+ max-inline-size: 15rem;
182
+ box-shadow: 0 4px 6px oklch(5% 0 0 / 8%), 0 2px 4px oklch(5% 0 0 / 6%);
183
+ pointer-events: auto;
184
+ white-space: normal;
185
+ }
186
+
187
+ @media (prefers-reduced-motion: no-preference) {
188
+ .vd-annotation-popup {
189
+ animation: vd-popup-in 150ms ease;
190
+ }
191
+ }
192
+
193
+ @keyframes vd-popup-in {
194
+ from { opacity: 0; transform: translateX(-50%) translateY(4px); }
195
+ to { opacity: 1; transform: translateX(-50%) translateY(0); }
196
+ }
197
+
198
+ .vd-annotation-popup-title {
199
+ font-family: ${H};
200
+ font-size: 0.875rem;
201
+ font-weight: 600;
202
+ line-height: 1.25rem;
203
+ }
204
+
205
+ .vd-annotation-popup-description {
206
+ font-family: ${H};
207
+ font-size: 0.8125rem;
208
+ font-weight: 400;
209
+ line-height: 1.125rem;
210
+ color: var(--muted-foreground);
211
+ margin-block-start: 0.25rem;
212
+ }
213
+ `,un=!1;function dn(){if(un||typeof document>`u`)return;un=!0;let e=document.createElement(`style`);e.id=`vd-ui-vanilla`,e.textContent=ln,document.head.appendChild(e)}function fn(e){let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)}function pn(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 mn(e,t,n){e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(n[0],n[1]),e.strokeStyle=`#000`,e.lineWidth=2,e.stroke()}function hn(e,t,n,r,i){let a=t(n),o=t(r);mn(e,a,[a[0]+(o[0]-a[0])*i,a[1]+(o[1]-a[1])*i,a[2]])}var U=[-1,-1,1],W=[1,-1,1],G=[1,-1,-1],K=[-1,-1,-1],q=[-1,1,1],J=[1,1,1],Y=[1,1,-1],X=[-1,1,-1],gn=[[U,W],[W,G],[G,K],[K,U],[U,q],[W,J],[G,Y],[K,X],[q,J],[J,Y],[Y,X],[X,q]],_n=400,vn=`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`;function yn(){let e=document.createElement(`div`);Object.assign(e.style,{position:`absolute`,inset:`0`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:`#fff`,zIndex:`20`,opacity:`0`,transition:`opacity 0.3s ease-in-out`});let t=document.createElement(`canvas`);Object.assign(t.style,{width:`100%`,height:`100%`,position:`absolute`,inset:`0`});let n=document.createElement(`div`);Object.assign(n.style,{position:`absolute`,top:`56%`,left:`0`,right:`0`,textAlign:`center`,pointerEvents:`none`});let r=document.createElement(`span`);Object.assign(r.style,{fontSize:`13px`,fontWeight:`400`,color:`#000`,fontVariantNumeric:`tabular-nums`,fontFamily:vn});let i=document.createElement(`span`);return Object.assign(i.style,{fontSize:`13px`,color:`#000`,fontFamily:vn}),i.textContent=M(),n.appendChild(r),n.appendChild(i),e.appendChild(t),e.appendChild(n),{overlay:e,canvas:t,pctEl:r,phaseEl:i}}var bn=class{overlay;canvas;ctx;pctEl;phaseEl;animationId=null;showTimerId=null;startTime;hidden=!1;visible=!1;constructor(e,t={}){this.startTime=performance.now();let n=yn();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());let r=t.showDelay??_n;this.showTimerId=setTimeout(()=>{this.reveal()},r)}get loadingTexts(){return{downloading:M(),rendering:ft()}}updateProgress(e,t){this.hidden||(this.pctEl.textContent=`${Math.round(e)}%`,this.phaseEl.textContent=t===``?``:` \u00B7 ${t}`)}showError(e){if(this.hidden=!1,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.fillStyle=`#fff`,this.ctx.fillRect(0,0,t*e,n*e)}this.pctEl.textContent=``,this.phaseEl.textContent=e,this.phaseEl.style.color=`#b91c1c`,this.reveal()}hide(){if(!this.hidden){if(this.hidden=!0,this.cancelShowTimer(),!this.visible){this.destroy();return}this.overlay.style.opacity=`0`,this.overlay.addEventListener(`transitionend`,()=>{this.destroy()},{once:!0}),setTimeout(()=>{this.destroy()},500)}}destroy(){this.cancelShowTimer(),this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.overlay.remove()}reveal(){this.hidden||this.visible||(this.visible=!0,this.overlay.style.opacity=`1`)}cancelShowTimer(){this.showTimerId!==null&&(clearTimeout(this.showTimerId),this.showTimerId=null)}sizeCanvas(){if(this.ctx===null)return;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.fillStyle=`#fff`,this.ctx.fillRect(0,0,e,t);let r=e/2,i=t*.44,a=Math.min(e,t)*.08,o=e=>pn(e,.785,.615,r,i,a),s=n%6/6,c=gn.length,l;l=s<.35?fn(s/.35)*c:s<.55?c:s<.9?(1-fn((s-.55)/.35))*c:0,this.ctx.shadowBlur=5,this.ctx.shadowColor=`rgba(30,30,30,0.08)`;for(let e=0;e<c&&!(e>=l);e++){let t=gn[e];if(t===void 0)continue;let n=Math.min(1,l-e);hn(this.ctx,o,t[0],t[1],n)}this.ctx.shadowBlur=0}},xn=class{element;arBtn=null;fullscreenBtn=null;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?L.exitFullscreen():L.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 R({variant:`outline`,size:`icon`,label:ze(),icon:L.ar(),onClick:()=>{this.options.onAr?.()}})),this.fullscreenBtn=this.syncButton(this.fullscreenBtn,e.fullscreen!==!1&&this.options.onFullscreen!==void 0,()=>new R({variant:`outline`,size:`icon`,label:at(),icon:L.fullscreen(),onClick:()=>{this.options.onFullscreen?.()}}))}destroy(){document.removeEventListener(`fullscreenchange`,this.onFullscreenChange)}},Z=.5,Sn=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=Cn(t,n,r);n.onChange(e=>{r.targetRotation=e.rotation-r.thetaOffset,r.targetTilt=e.tilt,r.targetZoom=e.zoom,wn(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 Cn(e,t,n){let r=e=>Math.max(t.limits?.minZoom??1,Math.min(t.limits?.maxZoom??1/0,e)),i=e=>{let n=t.limits?.minRotate,r=t.limits?.maxRotate;return n!==void 0||r!==void 0?Math.max(n??-1/0,Math.min(r??1/0,e)):e},a=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())};return{zoomOut:new R({variant:`outline`,size:`icon`,label:Ot(),icon:L.zoomOut(),onClick:()=>{n.targetZoom=r(n.targetZoom-10),e.zoom(n.targetZoom).set()}}),zoomIn:new R({variant:`outline`,size:`icon`,label:wt(),icon:L.zoomIn(),onClick:()=>{n.targetZoom=r(n.targetZoom+10),e.zoom(n.targetZoom).set()}}),tiltUp:new R({variant:`outline`,size:`icon`,label:Bt(),icon:L.tiltUp(),onClick:()=>{a(-15)}}),rotateLeft:new R({variant:`outline`,size:`icon`,label:Mt(),icon:L.rotateLeft(),onClick:()=>{n.targetRotation=i(n.targetRotation-15),e.rotate(n.targetRotation+n.thetaOffset).set()}}),reset:new R({variant:`outline`,size:`icon`,label:bt(),icon:L.reset(),onClick:()=>{n.thetaOffset=0,e.reset()}}),rotateRight:new R({variant:`outline`,size:`icon`,label:It(),icon:L.rotateRight(),onClick:()=>{n.targetRotation=i(n.targetRotation+15),e.rotate(n.targetRotation+n.thetaOffset).set()}}),tiltDown:new R({variant:`outline`,size:`icon`,label:Wt(),icon:L.tiltDown(),onClick:()=>{a(15)}})}}function wn(e,t,n){let r=t.limits;r!==void 0&&(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,e.rotateLeft.element.disabled=r.minRotate!==void 0&&n.rotation<=r.minRotate+Z,e.rotateRight.element.disabled=r.maxRotate!==void 0&&n.rotation>=r.maxRotate-Z)}var Tn=5;function Q(e){let t=e.replace(/([A-Z])/g,` $1`).trim();return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function En(e,t,n,r,i){let a=document.createElement(`div`);a.className=`vd-attribute`,a.dataset.name=e.name;let o=document.createElement(`span`);o.className=`vd-attribute-label`,o.textContent=Q(e.name),a.appendChild(o);let s=e.values.find(n=>t.getValue(e.name,n)?.isSelected===!0),c=e.values.map(Q),l=e.values.length<=Tn?new an(e.values,s,c):new on(e.name,e.values,Q(e.name),s,c);return l.onSelect(t=>{n.dispatch(`ui:select`,{attribute:e.name,value:t},!0).defaultPrevented||r(e.name,t)}),i(e.name,t=>{l.setSelected(t.value),n.dispatch(`ui:selected`,{attribute:e.name,value:t.value})}),a.appendChild(l.element),a}var Dn=V.fontFamily.sans.join(`, `),$=`
214
+ position: absolute;
215
+ display: flex;
216
+ z-index: 10;
217
+ `,On=`
218
+ /* Override browser's default black fullscreen backdrop */
219
+ .vd-container:fullscreen {
220
+ background: oklch(100% 0 0);
221
+ }
222
+
223
+ /* Pseudo-fullscreen fallback for iPhone Safari, which lacks the Fullscreen API on non-video elements */
224
+ .vd-container.vd-pseudo-fullscreen {
225
+ position: fixed;
226
+ inset: 0;
227
+ z-index: 2147483647;
228
+ background: oklch(100% 0 0);
229
+ }
230
+
231
+ /* Layout slots — four corners */
232
+ .vd-slot-top-right {
233
+ ${$}
234
+ inset-block-start: ${B[3]};
235
+ inset-inline-end: ${B[3]};
236
+ flex-direction: column;
237
+ align-items: flex-end;
238
+ gap: ${B[1.5]};
239
+ }
240
+
241
+ .vd-slot-bottom-left {
242
+ ${$}
243
+ inset-block-end: ${B[3]};
244
+ inset-inline-start: ${B[3]};
245
+ flex-direction: column;
246
+ align-items: flex-start;
247
+ gap: ${B[1.5]};
248
+ }
249
+
250
+ .vd-slot-bottom-right {
251
+ ${$}
252
+ inset-block-end: ${B[3]};
253
+ inset-inline-end: ${B[3]};
254
+ flex-direction: row;
255
+ gap: ${B[1.5]};
256
+ }
257
+
258
+ /* Component styles — no positioning */
259
+ .vd-camera-controls {
260
+ display: flex;
261
+ flex-direction: column;
262
+ gap: ${B[1]};
263
+ background: color-mix(in oklch, ${z.white} 85%, transparent);
264
+ backdrop-filter: blur(8px);
265
+ border-radius: ${B[2]};
266
+ padding: ${B[2]};
267
+ }
268
+
269
+ .vd-zoom {
270
+ display: flex;
271
+ gap: ${B[.5]};
272
+ }
273
+
274
+ .vd-dpad {
275
+ display: grid;
276
+ grid-template-columns: repeat(3, ${B[9]});
277
+ grid-template-rows: repeat(3, ${B[9]});
278
+ gap: ${B[.5]};
279
+ }
280
+
281
+ .vd-dpad-up { grid-column: 2; grid-row: 1; }
282
+ .vd-dpad-left { grid-column: 1; grid-row: 2; }
283
+ .vd-dpad-center { grid-column: 2; grid-row: 2; }
284
+ .vd-dpad-right { grid-column: 3; grid-row: 2; }
285
+ .vd-dpad-down { grid-column: 2; grid-row: 3; }
286
+
287
+ .vd-attributes {
288
+ display: flex;
289
+ flex-direction: column;
290
+ gap: ${B[2]};
291
+ background: color-mix(in oklch, ${z.white} 85%, transparent);
292
+ backdrop-filter: blur(8px);
293
+ border-radius: ${B[2]};
294
+ padding: ${B[2]};
295
+ font-family: ${Dn};
296
+ }
297
+
298
+ .vd-attribute {
299
+ display: flex;
300
+ flex-direction: column;
301
+ gap: ${B[1]};
302
+ }
303
+
304
+ .vd-attribute-label {
305
+ font-size: ${V.fontSize.xs};
306
+ font-weight: ${V.fontWeight.medium};
307
+ color: ${z.neutral[900]};
308
+ font-family: ${Dn};
309
+ }
310
+
311
+ `;function kn(){if(dn(),document.getElementById(`vd-styles`)!==null)return;let e=document.createElement(`style`);e.id=`vd-styles`,e.textContent=On,document.head.appendChild(e)}function An(e,t){let n=document.createElement(`a`);n.href=`data:image/png;base64,${e}`,n.download=t,n.click()}var jn=class{options;settings={};container=null;loading=null;slots={topRight:null,bottomLeft:null,bottomRight:null};screenshotBtn=null;actionBar=null;cameraControls=null;attributes=null;constructor(e){this.options=e}attach(e){kn(),this.container=e,this.loading=new bn(e),this.slots.topRight=this.createSlot(e,`vd-slot-top-right`),this.slots.bottomLeft=this.createSlot(e,`vd-slot-bottom-left`),this.slots.bottomRight=this.createSlot(e,`vd-slot-bottom-right`)}onReady(){this.loading?.hide(),this.loading=null,this.mountToolbar(),this.cameraControls!==null&&(this.cameraControls.element.style.display=`flex`),this.attributes!==null&&(this.attributes.style.display=`flex`)}pseudoFullscreen=!1;mountToolbar(){this.actionBar!==null||this.slots.bottomRight===null||(this.actionBar=new xn({onAr:this.options.onAr,onFullscreen:()=>{this.toggleFullscreen()}}),this.actionBar.applySettings(this.settings),this.slots.bottomRight.appendChild(this.actionBar.element),this.syncScreenshotButton(),this.placeScreenshotButton())}toggleFullscreen(){if(this.container!==null){if(typeof this.container.requestFullscreen==`function`){document.fullscreenElement===null?this.container.requestFullscreen():document.exitFullscreen();return}this.pseudoFullscreen=!this.pseudoFullscreen,this.container.classList.toggle(`vd-pseudo-fullscreen`,this.pseudoFullscreen),this.actionBar?.setFullscreenIcon(this.pseudoFullscreen)}}updateProgress(e,t){this.loading?.updateProgress(e,t)}showError(e){this.loading?.showError(e)}applyViewerSettings(e){this.settings=e,e.language!==void 0&&O(e.language,{reload:!1}),this.syncScreenshotButton(),this.actionBar?.applySettings(e),this.cameraControls!==null&&(this.cameraControls.element.style.display=e.cameraControls===!0?`flex`:`none`),this.placeScreenshotButton()}renderAttributeControls(e,t){if(!(this.container===null||this.slots.topRight===null)&&(this.cameraControls?.element.remove(),this.cameraControls=null,this.attributes?.remove(),this.attributes=null,this.settings.cameraControls===!0&&(this.cameraControls=new Sn(this.options.cameraApi,this.options.cameraPositionApi),this.cameraControls.element.style.display=`none`,this.slots.topRight.appendChild(this.cameraControls.element)),this.placeScreenshotButton(),!(t.length===0||this.settings.attributeControls===!1))){this.attributes=document.createElement(`div`),this.attributes.className=`vd-attributes`,this.attributes.style.display=`none`;for(let n of t)this.attributes.appendChild(En(n,e,this.options.eventBus,this.options.onSelect,this.options.onSubscribe));this.slots.bottomLeft.appendChild(this.attributes)}}get viewerSettings(){return this.settings}destroy(){this.loading?.destroy(),this.screenshotBtn?.element.remove(),this.actionBar?.destroy(),this.actionBar?.element.remove(),this.cameraControls?.element.remove(),this.attributes?.remove();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 R({variant:`outline`,size:`icon`,label:gt(),icon:L.screenshot(),onClick:()=>{this.options.snapshotApi.take(`snapshot.png`).onDeveloped(({data:e,filename:t})=>{An(e,t)})}})),!e&&this.screenshotBtn!==null&&(this.screenshotBtn.element.remove(),this.screenshotBtn=null)}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))}},Mn=class{attributes;readyStateTracker;messenger;cameraApi;cameraPositionApi;snapshotApi;annotationsApi;eventBus;ui;qrModal;options;iframe;container;readyCallbacks=[];mutationFailedCallbacks=[];constructor(e){this.options=e,this.initializeLogging(),this.messenger=new ge(()=>this.iframe?.contentWindow??null);let t=e=>{this.messenger.send(e)};this.attributes=new ye(t,(e,t)=>{for(let n of this.mutationFailedCallbacks)n({attribute:e,value:t})}),this.snapshotApi=new Ce(t),this.annotationsApi=new S(t),this.cameraApi=new be(t),this.cameraPositionApi=new xe,this.eventBus=new we,this.qrModal=new cn,this.readyStateTracker=new ie(()=>{let e=this.readyCallbacks;this.readyCallbacks=[];for(let t of e)t(this);this.ui.onReady()}),this.ui=new jn({snapshotApi:this.snapshotApi,cameraApi:this.cameraApi,cameraPositionApi:this.cameraPositionApi,eventBus:this.eventBus,onSelect:(e,t)=>this.attributes.select(e,t),onSubscribe:(e,t)=>this.attributes.onChange(e,t),onAr:()=>{this.activateAr()}}),this.registerHandlers(),this.messenger.start(),this.createAndConnectIframe()}registerHandlers(){this.messenger.on(b.HANDSHAKE,e=>{se(e)&&(y.info(`Server handshake received, flushing publisher queue`),this.messenger.markReady())}),this.messenger.on(b.MUTATION,e=>{ce(e)&&this.attributes.handleMutationResult(e)}),this.messenger.on(b.SNAPSHOT,e=>{le(e)&&this.snapshotApi.handleSnapshotResult(e)}),this.messenger.on(b.CAMERA,e=>{ue(e)&&this.cameraPositionApi.handlePositionUpdate(e)}),this.messenger.on(b.LOADING_INDICATOR,e=>{fe(e)&&(e.error===void 0?this.ui.updateProgress(e.progress,e.phase):this.ui.showError(e.error))}),this.messenger.on(b.CONFIG,e=>{pe(e)&&this.handleConfig(e)}),this.messenger.on(b.ANNOTATION_PLACED,e=>{me(e)&&this.annotationsApi.handlePlaced(e.position)}),this.messenger.on(b.MAPPING,e=>{de(e)&&(this.attributes.handleMappingReceived(e),this.ui.renderAttributeControls(this.attributes,e.attributes),this.readyStateTracker.handleMappingReceived())})}handleConfig(e){let t=e.viewerSettings,n=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&&y.warn(`Viewer settings override active: ${e.join(`, `)}`)}this.ui.applyViewerSettings(e),this.annotationsApi.setEnabled(e.annotations!==!1)}this.cameraPositionApi.applyLimits(e.cameraLimits)}activateAr(){if(h()){this.messenger.send({type:b.AR_ACTIVATE});return}this.qrModal.show(this.iframe?.src??``)}initializeLogging(){this.options.debug===!0&&ne(),y.info(`Initializing Virtualdisplay client`,{model:this.options.model})}createAndConnectIframe(){let e=new r(this.options).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){if(this.readyStateTracker.isReady){e(this);return}this.readyCallbacks.push(e)}onMutationFailed(e){this.mutationFailedCallbacks.push(e)}on(e,t){this.eventBus.on(e,t)}get annotations(){return this.annotationsApi}get camera(){return this.cameraApi}get cameraPosition(){return this.cameraPositionApi}get snapshot(){return this.snapshotApi}get viewerSettings(){return this.ui.viewerSettings}destroy(){this.readyStateTracker.clear(),this.readyCallbacks=[],this.messenger.destroy(),this.qrModal.hide(),this.ui.destroy(),this.container?.parentElement!==null&&this.container?.parentElement!==void 0&&this.container.parentElement.removeChild(this.container),this.container=void 0,this.iframe=void 0}};exports.Annotations=S,exports.Attribute=_e,exports.AttributeValue=C,exports.Camera=be,exports.ERROR_CODES=t,exports.Photo=Se,exports.Snapshot=Ce,exports.VirtualdisplayClient=Mn,exports.VirtualdisplayError=n,exports.enableDebugMode=ne,exports.isDebugMode=re,Object.defineProperty(exports,`logger`,{enumerable:!0,get:function(){return y}});