@fugood/bricks-cli 2.25.0-beta.62 → 2.25.0-beta.64

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 (85) hide show
  1. package/lib/1010.js +1 -0
  2. package/lib/1178.js +1 -0
  3. package/lib/1215.js +1 -0
  4. package/lib/1708.js +9 -0
  5. package/lib/1759.js +1 -0
  6. package/lib/1936.js +1 -0
  7. package/lib/2151.js +1 -0
  8. package/lib/{209.js → 2209.js} +3 -3
  9. package/lib/2247.js +1 -0
  10. package/lib/2486.js +1 -0
  11. package/lib/2557.js +1 -0
  12. package/lib/{223.js → 3223.js} +1 -1
  13. package/lib/3332.js +13 -0
  14. package/lib/3690.js +1 -0
  15. package/lib/3774.js +44 -0
  16. package/lib/3976.js +14 -0
  17. package/lib/4305.js +1 -0
  18. package/lib/4456.js +3 -0
  19. package/lib/{192.js → 4479.js} +4 -4
  20. package/lib/4530.js +22 -0
  21. package/lib/4642.js +9 -0
  22. package/lib/4685.js +1202 -0
  23. package/lib/5212.js +1 -0
  24. package/lib/{658.js → 5658.js} +1 -1
  25. package/lib/5785.js +1 -0
  26. package/lib/6194.js +3 -0
  27. package/lib/6370.js +1 -0
  28. package/lib/6645.js +1 -0
  29. package/lib/6818.js +1 -0
  30. package/lib/7111.js +2 -0
  31. package/lib/7456.js +1 -0
  32. package/lib/7511.js +1 -0
  33. package/lib/7574.js +1 -0
  34. package/lib/7648.js +1 -0
  35. package/lib/8026.js +1 -0
  36. package/lib/{117.js → 8117.js} +2 -2
  37. package/lib/8166.js +1 -0
  38. package/lib/853.js +1 -0
  39. package/lib/915.js +4 -4
  40. package/lib/9320.js +3 -0
  41. package/lib/{387.js → 9387.js} +1 -1
  42. package/lib/9405.js +1 -0
  43. package/lib/9430.js +1 -0
  44. package/lib/{583.js → 9583.js} +1 -1
  45. package/lib/9663.js +1 -0
  46. package/lib/{866.js → 9866.js} +1 -1
  47. package/lib/9940.js +19 -0
  48. package/lib/index.js +17 -17
  49. package/lib/simulator-host-bridge.cjs +1 -0
  50. package/lib/simulator-main.mjs +3 -3
  51. package/package.json +5 -5
  52. package/lib/10.js +0 -1
  53. package/lib/111.js +0 -2
  54. package/lib/166.js +0 -1
  55. package/lib/178.js +0 -1
  56. package/lib/212.js +0 -1
  57. package/lib/215.js +0 -1
  58. package/lib/247.js +0 -1
  59. package/lib/274.js +0 -16
  60. package/lib/305.js +0 -1
  61. package/lib/306.js +0 -1
  62. package/lib/320.js +0 -3
  63. package/lib/332.js +0 -13
  64. package/lib/358.js +0 -1
  65. package/lib/370.js +0 -1
  66. package/lib/405.js +0 -1
  67. package/lib/430.js +0 -1
  68. package/lib/456.js +0 -3
  69. package/lib/479.js +0 -1231
  70. package/lib/486.js +0 -1
  71. package/lib/511.js +0 -1
  72. package/lib/557.js +0 -1
  73. package/lib/574.js +0 -1
  74. package/lib/645.js +0 -1
  75. package/lib/648.js +0 -1
  76. package/lib/663.js +0 -1
  77. package/lib/690.js +0 -1
  78. package/lib/708.js +0 -9
  79. package/lib/75.js +0 -1
  80. package/lib/759.js +0 -1
  81. package/lib/785.js +0 -1
  82. package/lib/818.js +0 -1
  83. package/lib/917.js +0 -1
  84. package/lib/936.js +0 -1
  85. package/lib/940.js +0 -19
@@ -1,4 +1,4 @@
1
- export const __rspack_esm_id=866;export const __rspack_esm_ids=[866];export const __webpack_modules__={11601(e,t,r){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;let a=r(65319),s=r(2431),o=r(11672),i=r(33928),n=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends a.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(i,n):i;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=r(96223);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=r(17898);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=r(95031);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=r(85748);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})},83277(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class a extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=a;class s extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof a&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){let r=[e[0]],a=0;for(;a<t.length;)l(r,t[a]),r.push(e[++a]);return new s(r)}t._Code=s,t.nil=new s(""),t._=o;let i=new s("+");function n(e,...t){let r=[c(e[0])],o=0;for(;o<t.length;)r.push(i),l(r,t[o]),r.push(i,c(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===i){var r,s;let o=(r=e[t-1],'""'===(s=e[t+1])?r:'""'===r?s:"string"==typeof r?s instanceof a||'"'!==r[r.length-1]?void 0:"string"!=typeof s?`${r.slice(0,-1)}${s}"`:'"'===s[0]?r.slice(0,-1)+s.slice(1):void 0:"string"!=typeof s||'"'!==s[0]||r instanceof a?void 0:`"${r}${s.slice(1)}`);if(void 0!==o){e.splice(t-1,3,o);continue}e[t++]="+"}t++}}(r),new s(r)}function l(e,t){var r;t instanceof s?e.push(...t._items):t instanceof a?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:c(Array.isArray(r)?r.join(","):r))}function c(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=n,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:n`${e}${t}`},t.stringify=function(e){return new s(c(e))},t.safeStringify=c,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new s(`.${e}`):o`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new s(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new s(e.toString())}},17898(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let a=r(83277),s=r(76930);var o=r(83277);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var i=r(76930);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new a._Code(">"),GTE:new a._Code(">="),LT:new a._Code("<"),LTE:new a._Code("<="),EQ:new a._Code("==="),NEQ:new a._Code("!=="),NOT:new a._Code("!"),OR:new a._Code("||"),AND:new a._Code("&&"),ADD:new a._Code("+")};class n{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends n{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?s.varKinds.var:this.varKind,a=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${a};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof a._CodeOrName?this.rhs.names:{}}}class c extends n{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,t){if(!(this.lhs instanceof a.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,t),this}get names(){return T(this.lhs instanceof a.Name?{}:{...this.lhs.names},this.rhs)}}class u extends c{constructor(e,t,r,a){super(e,r,a),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class f extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class h extends n{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends n{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=I(this.code,e,t),this}get names(){return this.code instanceof a._CodeOrName?this.code.names:{}}}class m extends n{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let 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){let{nodes:r}=this,a=r.length;for(;a--;){let s=r[a];s.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,s.names),r.splice(a,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>x(e,t.names),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class $ extends m{}class g extends y{}g.kind="else";class v extends y{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();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof v?t:t.nodes:this.nodes.length?this:new v(R(e),t instanceof v?[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.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){let e=super.names;return T(e,this.condition),this.else&&x(e,this.else.names),e}}v.kind="if";class _ extends y{}_.kind="for";class w extends _{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=I(this.iteration,e,t),this}get names(){return x(super.names,this.iteration.names)}}class b extends _{constructor(e,t,r,a){super(),this.varKind=e,this.name=t,this.from=r,this.to=a}render(e){let t=e.es5?s.varKinds.var:this.varKind,{name:r,from:a,to:o}=this;return`for(${t} ${r}=${a}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){let e=T(super.names,this.from);return T(e,this.to)}}class E extends _{constructor(e,t,r,a){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=a}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=I(this.iterable,e,t),this}get names(){return x(super.names,this.iterable.names)}}class S extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}S.kind="func";class k extends m{render(e){return"return "+super.render(e)}}k.kind="return";class P extends y{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)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,a;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(a=this.finally)||a.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&x(e,this.catch.names),this.finally&&x(e,this.finally.names),e}}class N extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}N.kind="catch";class j extends y{render(e){return"finally"+super.render(e)}}function x(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function T(e,t){return t instanceof a._CodeOrName?x(e,t.names):e}function I(e,t,r){var s;if(e instanceof a.Name)return o(e);if(!((s=e)instanceof a._Code&&s._items.some(e=>e instanceof a.Name&&1===t[e.str]&&void 0!==r[e.str])))return e;return new a._Code(e._items.reduce((e,t)=>(t instanceof a.Name&&(t=o(t)),t instanceof a._Code?e.push(...t._items):e.push(t),e),[]));function o(e){let a=r[e.str];return void 0===a||1!==t[e.str]?e:(delete t[e.str],a)}}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,a._)`!${D(e)}`}j.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new s.Scope({parent:e}),this._nodes=[new $]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let 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,a){let s=this._scope.toName(t);return void 0!==r&&a&&(this._constants[s.str]=r),this._leafNode(new l(e,s,r)),s}const(e,t,r){return this._def(s.varKinds.const,e,t,r)}let(e,t,r){return this._def(s.varKinds.let,e,t,r)}var(e,t,r){return this._def(s.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new c(e,t,r))}add(e,r){return this._leafNode(new u(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==a.nil&&this._leafNode(new p(e)),this}object(...e){let t=["{"];for(let[r,s]of e)t.length>1&&t.push(","),t.push(r),(r!==s||this.opts.es5)&&(t.push(":"),(0,a.addCodeArg)(t,s));return t.push("}"),new a._Code(t)}if(e,t,r){if(this._blockNode(new v(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new v(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(v,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,a,o=this.opts.es5?s.varKinds.var:s.varKinds.let){let i=this._scope.toName(e);return this._for(new b(o,i,t,r),()=>a(i))}forOf(e,t,r,o=s.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let e=t instanceof a.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,a._)`${e}.length`,t=>{this.var(i,(0,a._)`${e}[${t}]`),r(i)})}return this._for(new E("of",o,i,t),()=>r(i))}forIn(e,t,r,o=this.opts.es5?s.varKinds.var:s.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,a._)`Object.keys(${t})`,r);let i=this._scope.toName(e);return this._for(new E("in",o,i,t),()=>r(i))}endFor(){return this._endBlockNode(_)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new f(e))}return(e){let t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let a=new P;if(this._blockNode(a),this.code(e),t){let e=this.name("e");this._currNode=a.catch=new N(e),t(e)}return r&&(this._currNode=a.finally=new j,this.code(r)),this._endBlockNode(N,j)}throw(e){return this._leafNode(new h(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=a.nil,r,s){return this._blockNode(new S(e,t,r)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(S)}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){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}},t.not=R;let O=A(t.operators.AND);t.and=function(...e){return e.reduce(O)};let C=A(t.operators.OR);function A(e){return(t,r)=>t===a.nil?r:r===a.nil?t:(0,a._)`${D(t)} ${e} ${D(r)}`}function D(e){return e instanceof a.Name?e:(0,a._)`(${e})`}t.or=function(...e){return e.reduce(C)}},76930(e,t,r){var a,s;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let o=r(83277);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}(s=a||(t.UsedValueState=a={}))[s.Started=0]="Started",s[s.Completed=1]="Completed",t.varKinds={const:new o.Name("const"),let:new o.Name("let"),var:new o.Name("var")};class n{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof o.Name?e:this.name(e)}name(e){return new o.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=n;class l extends o.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0,o._)`.${new o.Name(t)}[${r}]`}}t.ValueScopeName=l;let c=(0,o._)`\n`;t.ValueScope=class extends n{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?c:o.nil}}get(){return this._scope}name(e){return new l(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let a=this.toName(e),{prefix:s}=a,o=null!=(r=t.key)?r:t.ref,i=this._values[s];if(i){let e=i.get(o);if(e)return e}else i=this._values[s]=new Map;i.set(o,a);let n=this._scope[s]||(this._scope[s]=[]),l=n.length;return n[l]=t.ref,a.setValue(t,{property:s,itemIndex:l}),a}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,o._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,s={},n){let l=o.nil;for(let c in e){let u=e[c];if(!u)continue;let d=s[c]=s[c]||new Map;u.forEach(e=>{if(d.has(e))return;d.set(e,a.Started);let s=r(e);if(s){let r=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,o._)`${l}${r} ${e} = ${s};${this.opts._n}`}else if(s=null==n?void 0:n(e))l=(0,o._)`${l}${s}${this.opts._n}`;else throw new i(e);d.set(e,a.Completed)})}return l}}},49409(e,t,r){t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.y=void 0;let a=r(17898),s=r(50458),o=r(63036);function i(e,t){let r=e.const("err",t);e.if((0,a._)`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,(0,a._)`[${r}]`),(0,a._)`${o.default.vErrors}.push(${r})`),e.code((0,a._)`${o.default.errors}++`)}function n(e,t){let{gen:r,validateName:s,schemaEnv:o}=e;o.$async?r.throw((0,a._)`new ${e.ValidationError}(${t})`):(r.assign((0,a._)`${s}.errors`,t),r.return(!1))}t.y={message:({keyword:e})=>(0,a.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,a.str)`"${e}" keyword must be ${t} ($data)`:(0,a.str)`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.y,s,o){let{it:l}=e,{gen:u,compositeRule:d,allErrors:f}=l,h=c(e,r,s);(null!=o?o:d||f)?i(u,h):n(l,(0,a._)`[${h}]`)},t.reportExtraError=function(e,r=t.y,a){let{it:s}=e,{gen:l,compositeRule:u,allErrors:d}=s;i(l,c(e,r,a)),u||d||n(s,o.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if((0,a._)`${o.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,a._)`${o.default.vErrors}.length`,t),()=>e.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:s,errsCount:i,it:n}){if(void 0===i)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",i,o.default.errors,i=>{e.const(l,(0,a._)`${o.default.vErrors}[${i}]`),e.if((0,a._)`${l}.instancePath === undefined`,()=>e.assign((0,a._)`${l}.instancePath`,(0,a.strConcat)(o.default.instancePath,n.errorPath))),e.assign((0,a._)`${l}.schemaPath`,(0,a.str)`${n.errSchemaPath}/${t}`),n.opts.verbose&&(e.assign((0,a._)`${l}.schema`,r),e.assign((0,a._)`${l}.data`,s))})};let l={keyword:new a.Name("keyword"),schemaPath:new a.Name("schemaPath"),params:new a.Name("params"),propertyName:new a.Name("propertyName"),message:new a.Name("message"),schema:new a.Name("schema"),parentSchema:new a.Name("parentSchema")};function c(e,t,r){let{createErrors:i}=e.it;return!1===i?(0,a._)`{}`:function(e,t,r={}){let{gen:i,it:n}=e,c=[function({errorPath:e},{instancePath:t}){let r=t?(0,a.str)`${e}${(0,s.getErrorPath)(t,s.Type.Str)}`:e;return[o.default.instancePath,(0,a.strConcat)(o.default.instancePath,r)]}(n,r),function({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let i=o?t:(0,a.str)`${t}/${e}`;return r&&(i=(0,a.str)`${i}${(0,s.getErrorPath)(r,s.Type.Str)}`),[l.schemaPath,i]}(e,r)];return function(e,{params:t,message:r},s){let{keyword:i,data:n,schemaValue:c,it:u}=e,{opts:d,propertyName:f,topSchemaRef:h,schemaPath:p}=u;s.push([l.keyword,i],[l.params,"function"==typeof t?t(e):t||(0,a._)`{}`]),d.messages&&s.push([l.message,"function"==typeof r?r(e):r]),d.verbose&&s.push([l.schema,c],[l.parentSchema,(0,a._)`${h}${p}`],[o.default.data,n]),f&&s.push([l.propertyName,f])}(e,t,c),i.object(...c)}(e,t,r)}},49392(e,t,r){t.resolveSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let a=r(17898),s=r(95031),o=r(63036),i=r(14856),n=r(50458),l=r(96223);class c{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)?t:(0,i.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 u(e){let t,r,n=f.call(this,e);if(n)return n;let c=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:u,lines:d}=this.opts.code,{ownProperties:h}=this.opts,p=new a.CodeGen(this.scope,{es5:u,lines:d,ownProperties:h});e.$async&&(t=p.scopeValue("Error",{ref:s.default,code:(0,a._)`require("ajv/dist/runtime/validation_error").default`}));let m=p.scopeName("validate");e.validateName=m;let y={gen:p,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[a.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,a.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:c,baseId:e.baseId||c,schemaPath:a.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,a._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(y),p.optimize(this.opts.code.optimize);let t=p.toString();r=`${p.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(r=this.opts.code.process(r,e));let s=Function(`${o.default.self}`,`${o.default.scope}`,r)(this,this.scope.get());if(this.scope.value(m,{ref:s}),s.errors=null,s.schema=e.schema,s.schemaEnv=e,e.$async&&(s.$async=!0),!0===this.opts.code.source&&(s.source={validateName:m,validateCode:t,scopeValues:p._values}),this.opts.unevaluated){let{props:e,items:t}=y;s.evaluated={props:e instanceof a.Name?void 0:e,items:t instanceof a.Name?void 0:t,dynamicProps:e instanceof a.Name,dynamicItems:t instanceof a.Name},s.source&&(s.source.evaluated=(0,a.stringify)(s.evaluated))}return e.validate=s,e}catch(t){throw delete e.validate,delete e.validateName,r&&this.logger.error("Error compiling schema, function code:",r),t}finally{this._compilations.delete(e)}}function d(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function f(e){for(let a of this._compilations){var t,r;if(t=a,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return a}}function h(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){let r=this.opts.uriResolver.parse(t),a=(0,i._getFullPath)(this.opts.uriResolver,r),s=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===s)return y.call(this,r,e);let o=(0,i.normalizeId)(a),n=this.refs[o]||this.schemas[o];if("string"==typeof n){let t=p.call(this,e,n);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==n?void 0:n.schema)){if(n.validate||u.call(this,n),o===(0,i.normalizeId)(t)){let{schema:t}=n,{schemaId:r}=this.opts,a=t[r];return a&&(s=(0,i.resolveUrl)(this.opts.uriResolver,s,a)),new c({schema:t,schemaId:r,root:e,baseId:s})}return y.call(this,r,n)}}t.SchemaEnv=c,t.compileSchema=u,t.resolveRef=function(e,t,r){var a;r=(0,i.resolveUrl)(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let o=h.call(this,e,r);if(void 0===o){let s=null==(a=e.localRefs)?void 0:a[r],{schemaId:i}=this.opts;s&&(o=new c({schema:s,schemaId:i,root:e,baseId:t}))}if(void 0!==o)return e.refs[r]=d.call(this,o)},t.resolveSchema=p;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:r,root:a}){var s;let o;if((null==(s=e.fragment)?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,n.unescapeFragment)(a)];if(void 0===e)return;let s="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(a)&&s&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,s))}if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=p.call(this,a,e)}let{schemaId:l}=this.opts;if((o=o||new c({schema:r,schemaId:l,root:a,baseId:t})).schema!==o.root.schema)return o}},63036(e,t,r){let a=r(17898);t.default={data:new a.Name("data"),valCxt:new a.Name("valCxt"),instancePath:new a.Name("instancePath"),parentData:new a.Name("parentData"),parentDataProperty:new a.Name("parentDataProperty"),rootData:new a.Name("rootData"),dynamicAnchors:new a.Name("dynamicAnchors"),vErrors:new a.Name("vErrors"),errors:new a.Name("errors"),this:new a.Name("this"),self:new a.Name("self"),scope:new a.Name("scope"),json:new a.Name("json"),jsonPos:new a.Name("jsonPos"),jsonLen:new a.Name("jsonLen"),jsonPart:new a.Name("jsonPart")}},85748(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(14856);t.default=class extends Error{constructor(e,t,r,s){super(s||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,a.resolveUrl)(e,t,r),this.missingSchema=(0,a.normalizeId)((0,a.getFullPath)(e,this.missingRef))}}},14856(e,t,r){t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let a=r(50458),s=r(38792),o=r(1645),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!function e(t){for(let r in t){if(n.has(r))return!0;let a=t[r];if(Array.isArray(a)&&a.some(e)||"object"==typeof a&&e(a))return!0}return!1}(e):!!t&&function e(t){let r=0;for(let s in t)if("$ref"===s||(r++,!i.has(s)&&("object"==typeof t[s]&&(0,a.eachItem)(t[s],t=>r+=e(t)),r===1/0)))return 1/0;return r}(e)<=t)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e,t="",r){!1!==r&&(t=d(t));let a=e.parse(t);return c(e,a)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=c;let u=/#\/?$/;function d(e){return e?e.replace(u,""):""}t.normalizeId=d,t.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};let f=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:r,uriResolver:a}=this.opts,i=d(e[r]||t),n={"":i},c=l(a,i,!1),u={},h=new Set;return o(e,{allKeys:!0},(e,t,a,s)=>{if(void 0===s)return;let o=c+t,i=n[s];function l(t){let r=this.opts.uriResolver.resolve;if(t=d(i?r(i,t):t),h.has(t))throw m(t);h.add(t);let a=this.refs[t];return"string"==typeof a&&(a=this.refs[a]),"object"==typeof a?p(e,a.schema,t):t!==d(o)&&("#"===t[0]?(p(e,u[t],t),u[t]=e):this.refs[t]=o),t}function y(e){if("string"==typeof e){if(!f.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(i=l.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),n[t]=i}),u;function p(e,t,r){if(void 0!==t&&!s(e,t))throw m(r)}function m(e){return Error(`reference "${e}" resolves to more than one schema`)}}},90383(e,t){t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){let 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:{}}}},50458(e,t,r){var a,s;t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let o=r(17898),i=r(83277);function n(e,t=e.schema){let{opts:r,self:a}=e;if(!r.strictSchema||"boolean"==typeof t)return;let s=a.RULES.keywords;for(let r in t)s[r]||p(e,`unknown keyword: "${r}"`)}function l(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(s,i,n,l)=>{let c=void 0===n?i:n instanceof o.Name?(i instanceof o.Name?e(s,i,n):t(s,i,n),n):i instanceof o.Name?(t(s,n,i),i):r(i,n);return l!==o.Name||c instanceof o.Name?c:a(s,c)}}function d(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,o._)`{}`);return void 0!==t&&f(e,r,t),r}function f(e,t,r){Object.keys(r).forEach(r=>e.assign((0,o._)`${t}${(0,o.getProperty)(r)}`,!0))}t.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(n(e,t),!function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}(t,e.self.RULES.all))},t.checkUnknownRules=n,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,a,s){if(!s){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,o._)`${r}`}return(0,o._)`${e}${t}${(0,o.getProperty)(a)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(l(e))},t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},t.mergeEvaluated={props:u({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,o._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,o._)`${r} || {}`).code((0,o._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,o._)`${r} || {}`),f(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:d}),items:u({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,o._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>e.assign(r,!0===t||(0,o._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=d;let h={};function p(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:h[t.code]||(h[t.code]=new i._Code(t.code))})},(s=a||(t.Type=a={}))[s.Num=0]="Num",s[s.Str=1]="Str",t.getErrorPath=function(e,t,r){if(e instanceof o.Name){let s=t===a.Num;return r?s?(0,o._)`"[" + ${e} + "]"`:(0,o._)`"['" + ${e} + "']"`:s?(0,o._)`"/" + ${e}`:(0,o._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,o.getProperty)(e).toString():"/"+l(e)},t.checkStrictMode=p},74758(e,t){function r(e,t){return t.rules.some(t=>a(e,t))}function a(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},a){let s=t.RULES.types[a];return s&&!0!==s&&r(e,s)},t.shouldUseGroup=r,t.shouldUseRule=a},15948(e,t,r){t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let a=r(49409),s=r(17898),o=r(63036),i={message:"boolean schema is false"};function n(e,t){let{gen:r,data:s}=e;(0,a.reportError)({gen:r,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},i,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:r,validateName:a}=e;!1===r?n(e,!1):"object"==typeof r&&!0===r.$async?t.return(o.default.data):(t.assign((0,s._)`${a}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:r,schema:a}=e;!1===a?(r.var(t,!1),n(e)):r.var(t,!0)}},69003(e,t,r){var a,s;t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let o=r(90383),i=r(74758),n=r(49409),l=r(17898),c=r(50458);function u(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(o.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(s=a||(t.DataType=a={}))[s.Correct=0]="Correct",s[s.Wrong=1]="Wrong",t.getSchemaTypes=function(e){let t=u(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=u,t.coerceAndCheckDataType=function(e,t){var r,s;let{gen:o,data:n,opts:c}=e,u=(r=t,(s=c.coerceTypes)?r.filter(e=>d.has(e)||"array"===s&&"array"===e):[]),f=t.length>0&&!(0===u.length&&1===t.length&&(0,i.schemaHasRulesForType)(e,t[0]));if(f){let r=h(t,n,c.strictNumbers,a.Wrong);o.if(r,()=>{u.length?function(e,t,r){let{gen:a,data:s,opts:o}=e,i=a.let("dataType",(0,l._)`typeof ${s}`),n=a.let("coerced",(0,l._)`undefined`);for(let e of("array"===o.coerceTypes&&a.if((0,l._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>a.assign(s,(0,l._)`${s}[0]`).assign(i,(0,l._)`typeof ${s}`).if(h(t,s,o.strictNumbers),()=>a.assign(n,s))),a.if((0,l._)`${n} !== undefined`),r))(d.has(e)||"array"===e&&"array"===o.coerceTypes)&&function(e){switch(e){case"string":a.elseIf((0,l._)`${i} == "number" || ${i} == "boolean"`).assign(n,(0,l._)`"" + ${s}`).elseIf((0,l._)`${s} === null`).assign(n,(0,l._)`""`);return;case"number":a.elseIf((0,l._)`${i} == "boolean" || ${s} === null
1
+ export const __rspack_esm_id=9866;export const __rspack_esm_ids=[9866];export const __webpack_modules__={11601(e,t,r){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;let a=r(65319),s=r(2431),o=r(11672),i=r(33928),n=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends a.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(i,n):i;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=r(96223);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=r(17898);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=r(95031);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=r(85748);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})},83277(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class a extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=a;class s extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof a&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){let r=[e[0]],a=0;for(;a<t.length;)l(r,t[a]),r.push(e[++a]);return new s(r)}t._Code=s,t.nil=new s(""),t._=o;let i=new s("+");function n(e,...t){let r=[c(e[0])],o=0;for(;o<t.length;)r.push(i),l(r,t[o]),r.push(i,c(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===i){var r,s;let o=(r=e[t-1],'""'===(s=e[t+1])?r:'""'===r?s:"string"==typeof r?s instanceof a||'"'!==r[r.length-1]?void 0:"string"!=typeof s?`${r.slice(0,-1)}${s}"`:'"'===s[0]?r.slice(0,-1)+s.slice(1):void 0:"string"!=typeof s||'"'!==s[0]||r instanceof a?void 0:`"${r}${s.slice(1)}`);if(void 0!==o){e.splice(t-1,3,o);continue}e[t++]="+"}t++}}(r),new s(r)}function l(e,t){var r;t instanceof s?e.push(...t._items):t instanceof a?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:c(Array.isArray(r)?r.join(","):r))}function c(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=n,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:n`${e}${t}`},t.stringify=function(e){return new s(c(e))},t.safeStringify=c,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new s(`.${e}`):o`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new s(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new s(e.toString())}},17898(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let a=r(83277),s=r(76930);var o=r(83277);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var i=r(76930);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new a._Code(">"),GTE:new a._Code(">="),LT:new a._Code("<"),LTE:new a._Code("<="),EQ:new a._Code("==="),NEQ:new a._Code("!=="),NOT:new a._Code("!"),OR:new a._Code("||"),AND:new a._Code("&&"),ADD:new a._Code("+")};class n{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends n{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?s.varKinds.var:this.varKind,a=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${a};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof a._CodeOrName?this.rhs.names:{}}}class c extends n{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,t){if(!(this.lhs instanceof a.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,t),this}get names(){return T(this.lhs instanceof a.Name?{}:{...this.lhs.names},this.rhs)}}class u extends c{constructor(e,t,r,a){super(e,r,a),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class f extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class h extends n{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends n{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=I(this.code,e,t),this}get names(){return this.code instanceof a._CodeOrName?this.code.names:{}}}class m extends n{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let 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){let{nodes:r}=this,a=r.length;for(;a--;){let s=r[a];s.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,s.names),r.splice(a,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>x(e,t.names),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class $ extends m{}class g extends y{}g.kind="else";class v extends y{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();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof v?t:t.nodes:this.nodes.length?this:new v(R(e),t instanceof v?[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.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){let e=super.names;return T(e,this.condition),this.else&&x(e,this.else.names),e}}v.kind="if";class _ extends y{}_.kind="for";class w extends _{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=I(this.iteration,e,t),this}get names(){return x(super.names,this.iteration.names)}}class b extends _{constructor(e,t,r,a){super(),this.varKind=e,this.name=t,this.from=r,this.to=a}render(e){let t=e.es5?s.varKinds.var:this.varKind,{name:r,from:a,to:o}=this;return`for(${t} ${r}=${a}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){let e=T(super.names,this.from);return T(e,this.to)}}class E extends _{constructor(e,t,r,a){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=a}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=I(this.iterable,e,t),this}get names(){return x(super.names,this.iterable.names)}}class S extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}S.kind="func";class k extends m{render(e){return"return "+super.render(e)}}k.kind="return";class P extends y{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)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,a;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(a=this.finally)||a.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&x(e,this.catch.names),this.finally&&x(e,this.finally.names),e}}class N extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}N.kind="catch";class j extends y{render(e){return"finally"+super.render(e)}}function x(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function T(e,t){return t instanceof a._CodeOrName?x(e,t.names):e}function I(e,t,r){var s;if(e instanceof a.Name)return o(e);if(!((s=e)instanceof a._Code&&s._items.some(e=>e instanceof a.Name&&1===t[e.str]&&void 0!==r[e.str])))return e;return new a._Code(e._items.reduce((e,t)=>(t instanceof a.Name&&(t=o(t)),t instanceof a._Code?e.push(...t._items):e.push(t),e),[]));function o(e){let a=r[e.str];return void 0===a||1!==t[e.str]?e:(delete t[e.str],a)}}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,a._)`!${D(e)}`}j.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new s.Scope({parent:e}),this._nodes=[new $]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let 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,a){let s=this._scope.toName(t);return void 0!==r&&a&&(this._constants[s.str]=r),this._leafNode(new l(e,s,r)),s}const(e,t,r){return this._def(s.varKinds.const,e,t,r)}let(e,t,r){return this._def(s.varKinds.let,e,t,r)}var(e,t,r){return this._def(s.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new c(e,t,r))}add(e,r){return this._leafNode(new u(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==a.nil&&this._leafNode(new p(e)),this}object(...e){let t=["{"];for(let[r,s]of e)t.length>1&&t.push(","),t.push(r),(r!==s||this.opts.es5)&&(t.push(":"),(0,a.addCodeArg)(t,s));return t.push("}"),new a._Code(t)}if(e,t,r){if(this._blockNode(new v(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new v(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(v,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,a,o=this.opts.es5?s.varKinds.var:s.varKinds.let){let i=this._scope.toName(e);return this._for(new b(o,i,t,r),()=>a(i))}forOf(e,t,r,o=s.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let e=t instanceof a.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,a._)`${e}.length`,t=>{this.var(i,(0,a._)`${e}[${t}]`),r(i)})}return this._for(new E("of",o,i,t),()=>r(i))}forIn(e,t,r,o=this.opts.es5?s.varKinds.var:s.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,a._)`Object.keys(${t})`,r);let i=this._scope.toName(e);return this._for(new E("in",o,i,t),()=>r(i))}endFor(){return this._endBlockNode(_)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new f(e))}return(e){let t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let a=new P;if(this._blockNode(a),this.code(e),t){let e=this.name("e");this._currNode=a.catch=new N(e),t(e)}return r&&(this._currNode=a.finally=new j,this.code(r)),this._endBlockNode(N,j)}throw(e){return this._leafNode(new h(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=a.nil,r,s){return this._blockNode(new S(e,t,r)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(S)}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){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof v))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}},t.not=R;let O=A(t.operators.AND);t.and=function(...e){return e.reduce(O)};let C=A(t.operators.OR);function A(e){return(t,r)=>t===a.nil?r:r===a.nil?t:(0,a._)`${D(t)} ${e} ${D(r)}`}function D(e){return e instanceof a.Name?e:(0,a._)`(${e})`}t.or=function(...e){return e.reduce(C)}},76930(e,t,r){var a,s;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let o=r(83277);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}(s=a||(t.UsedValueState=a={}))[s.Started=0]="Started",s[s.Completed=1]="Completed",t.varKinds={const:new o.Name("const"),let:new o.Name("let"),var:new o.Name("var")};class n{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof o.Name?e:this.name(e)}name(e){return new o.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=n;class l extends o.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0,o._)`.${new o.Name(t)}[${r}]`}}t.ValueScopeName=l;let c=(0,o._)`\n`;t.ValueScope=class extends n{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?c:o.nil}}get(){return this._scope}name(e){return new l(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let a=this.toName(e),{prefix:s}=a,o=null!=(r=t.key)?r:t.ref,i=this._values[s];if(i){let e=i.get(o);if(e)return e}else i=this._values[s]=new Map;i.set(o,a);let n=this._scope[s]||(this._scope[s]=[]),l=n.length;return n[l]=t.ref,a.setValue(t,{property:s,itemIndex:l}),a}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,o._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,s={},n){let l=o.nil;for(let c in e){let u=e[c];if(!u)continue;let d=s[c]=s[c]||new Map;u.forEach(e=>{if(d.has(e))return;d.set(e,a.Started);let s=r(e);if(s){let r=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,o._)`${l}${r} ${e} = ${s};${this.opts._n}`}else if(s=null==n?void 0:n(e))l=(0,o._)`${l}${s}${this.opts._n}`;else throw new i(e);d.set(e,a.Completed)})}return l}}},49409(e,t,r){t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.y=void 0;let a=r(17898),s=r(50458),o=r(63036);function i(e,t){let r=e.const("err",t);e.if((0,a._)`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,(0,a._)`[${r}]`),(0,a._)`${o.default.vErrors}.push(${r})`),e.code((0,a._)`${o.default.errors}++`)}function n(e,t){let{gen:r,validateName:s,schemaEnv:o}=e;o.$async?r.throw((0,a._)`new ${e.ValidationError}(${t})`):(r.assign((0,a._)`${s}.errors`,t),r.return(!1))}t.y={message:({keyword:e})=>(0,a.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,a.str)`"${e}" keyword must be ${t} ($data)`:(0,a.str)`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.y,s,o){let{it:l}=e,{gen:u,compositeRule:d,allErrors:f}=l,h=c(e,r,s);(null!=o?o:d||f)?i(u,h):n(l,(0,a._)`[${h}]`)},t.reportExtraError=function(e,r=t.y,a){let{it:s}=e,{gen:l,compositeRule:u,allErrors:d}=s;i(l,c(e,r,a)),u||d||n(s,o.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if((0,a._)`${o.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,a._)`${o.default.vErrors}.length`,t),()=>e.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:s,errsCount:i,it:n}){if(void 0===i)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",i,o.default.errors,i=>{e.const(l,(0,a._)`${o.default.vErrors}[${i}]`),e.if((0,a._)`${l}.instancePath === undefined`,()=>e.assign((0,a._)`${l}.instancePath`,(0,a.strConcat)(o.default.instancePath,n.errorPath))),e.assign((0,a._)`${l}.schemaPath`,(0,a.str)`${n.errSchemaPath}/${t}`),n.opts.verbose&&(e.assign((0,a._)`${l}.schema`,r),e.assign((0,a._)`${l}.data`,s))})};let l={keyword:new a.Name("keyword"),schemaPath:new a.Name("schemaPath"),params:new a.Name("params"),propertyName:new a.Name("propertyName"),message:new a.Name("message"),schema:new a.Name("schema"),parentSchema:new a.Name("parentSchema")};function c(e,t,r){let{createErrors:i}=e.it;return!1===i?(0,a._)`{}`:function(e,t,r={}){let{gen:i,it:n}=e,c=[function({errorPath:e},{instancePath:t}){let r=t?(0,a.str)`${e}${(0,s.getErrorPath)(t,s.Type.Str)}`:e;return[o.default.instancePath,(0,a.strConcat)(o.default.instancePath,r)]}(n,r),function({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let i=o?t:(0,a.str)`${t}/${e}`;return r&&(i=(0,a.str)`${i}${(0,s.getErrorPath)(r,s.Type.Str)}`),[l.schemaPath,i]}(e,r)];return function(e,{params:t,message:r},s){let{keyword:i,data:n,schemaValue:c,it:u}=e,{opts:d,propertyName:f,topSchemaRef:h,schemaPath:p}=u;s.push([l.keyword,i],[l.params,"function"==typeof t?t(e):t||(0,a._)`{}`]),d.messages&&s.push([l.message,"function"==typeof r?r(e):r]),d.verbose&&s.push([l.schema,c],[l.parentSchema,(0,a._)`${h}${p}`],[o.default.data,n]),f&&s.push([l.propertyName,f])}(e,t,c),i.object(...c)}(e,t,r)}},49392(e,t,r){t.resolveSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let a=r(17898),s=r(95031),o=r(63036),i=r(14856),n=r(50458),l=r(96223);class c{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)?t:(0,i.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 u(e){let t,r,n=f.call(this,e);if(n)return n;let c=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:u,lines:d}=this.opts.code,{ownProperties:h}=this.opts,p=new a.CodeGen(this.scope,{es5:u,lines:d,ownProperties:h});e.$async&&(t=p.scopeValue("Error",{ref:s.default,code:(0,a._)`require("ajv/dist/runtime/validation_error").default`}));let m=p.scopeName("validate");e.validateName=m;let y={gen:p,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[a.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,a.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:c,baseId:e.baseId||c,schemaPath:a.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,a._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(y),p.optimize(this.opts.code.optimize);let t=p.toString();r=`${p.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(r=this.opts.code.process(r,e));let s=Function(`${o.default.self}`,`${o.default.scope}`,r)(this,this.scope.get());if(this.scope.value(m,{ref:s}),s.errors=null,s.schema=e.schema,s.schemaEnv=e,e.$async&&(s.$async=!0),!0===this.opts.code.source&&(s.source={validateName:m,validateCode:t,scopeValues:p._values}),this.opts.unevaluated){let{props:e,items:t}=y;s.evaluated={props:e instanceof a.Name?void 0:e,items:t instanceof a.Name?void 0:t,dynamicProps:e instanceof a.Name,dynamicItems:t instanceof a.Name},s.source&&(s.source.evaluated=(0,a.stringify)(s.evaluated))}return e.validate=s,e}catch(t){throw delete e.validate,delete e.validateName,r&&this.logger.error("Error compiling schema, function code:",r),t}finally{this._compilations.delete(e)}}function d(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function f(e){for(let a of this._compilations){var t,r;if(t=a,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return a}}function h(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){let r=this.opts.uriResolver.parse(t),a=(0,i._getFullPath)(this.opts.uriResolver,r),s=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===s)return y.call(this,r,e);let o=(0,i.normalizeId)(a),n=this.refs[o]||this.schemas[o];if("string"==typeof n){let t=p.call(this,e,n);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==n?void 0:n.schema)){if(n.validate||u.call(this,n),o===(0,i.normalizeId)(t)){let{schema:t}=n,{schemaId:r}=this.opts,a=t[r];return a&&(s=(0,i.resolveUrl)(this.opts.uriResolver,s,a)),new c({schema:t,schemaId:r,root:e,baseId:s})}return y.call(this,r,n)}}t.SchemaEnv=c,t.compileSchema=u,t.resolveRef=function(e,t,r){var a;r=(0,i.resolveUrl)(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let o=h.call(this,e,r);if(void 0===o){let s=null==(a=e.localRefs)?void 0:a[r],{schemaId:i}=this.opts;s&&(o=new c({schema:s,schemaId:i,root:e,baseId:t}))}if(void 0!==o)return e.refs[r]=d.call(this,o)},t.resolveSchema=p;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:r,root:a}){var s;let o;if((null==(s=e.fragment)?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,n.unescapeFragment)(a)];if(void 0===e)return;let s="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(a)&&s&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,s))}if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=p.call(this,a,e)}let{schemaId:l}=this.opts;if((o=o||new c({schema:r,schemaId:l,root:a,baseId:t})).schema!==o.root.schema)return o}},63036(e,t,r){let a=r(17898);t.default={data:new a.Name("data"),valCxt:new a.Name("valCxt"),instancePath:new a.Name("instancePath"),parentData:new a.Name("parentData"),parentDataProperty:new a.Name("parentDataProperty"),rootData:new a.Name("rootData"),dynamicAnchors:new a.Name("dynamicAnchors"),vErrors:new a.Name("vErrors"),errors:new a.Name("errors"),this:new a.Name("this"),self:new a.Name("self"),scope:new a.Name("scope"),json:new a.Name("json"),jsonPos:new a.Name("jsonPos"),jsonLen:new a.Name("jsonLen"),jsonPart:new a.Name("jsonPart")}},85748(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(14856);t.default=class extends Error{constructor(e,t,r,s){super(s||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,a.resolveUrl)(e,t,r),this.missingSchema=(0,a.normalizeId)((0,a.getFullPath)(e,this.missingRef))}}},14856(e,t,r){t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let a=r(50458),s=r(38792),o=r(1645),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!function e(t){for(let r in t){if(n.has(r))return!0;let a=t[r];if(Array.isArray(a)&&a.some(e)||"object"==typeof a&&e(a))return!0}return!1}(e):!!t&&function e(t){let r=0;for(let s in t)if("$ref"===s||(r++,!i.has(s)&&("object"==typeof t[s]&&(0,a.eachItem)(t[s],t=>r+=e(t)),r===1/0)))return 1/0;return r}(e)<=t)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e,t="",r){!1!==r&&(t=d(t));let a=e.parse(t);return c(e,a)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=c;let u=/#\/?$/;function d(e){return e?e.replace(u,""):""}t.normalizeId=d,t.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};let f=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:r,uriResolver:a}=this.opts,i=d(e[r]||t),n={"":i},c=l(a,i,!1),u={},h=new Set;return o(e,{allKeys:!0},(e,t,a,s)=>{if(void 0===s)return;let o=c+t,i=n[s];function l(t){let r=this.opts.uriResolver.resolve;if(t=d(i?r(i,t):t),h.has(t))throw m(t);h.add(t);let a=this.refs[t];return"string"==typeof a&&(a=this.refs[a]),"object"==typeof a?p(e,a.schema,t):t!==d(o)&&("#"===t[0]?(p(e,u[t],t),u[t]=e):this.refs[t]=o),t}function y(e){if("string"==typeof e){if(!f.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(i=l.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),n[t]=i}),u;function p(e,t,r){if(void 0!==t&&!s(e,t))throw m(r)}function m(e){return Error(`reference "${e}" resolves to more than one schema`)}}},90383(e,t){t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){let 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:{}}}},50458(e,t,r){var a,s;t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let o=r(17898),i=r(83277);function n(e,t=e.schema){let{opts:r,self:a}=e;if(!r.strictSchema||"boolean"==typeof t)return;let s=a.RULES.keywords;for(let r in t)s[r]||p(e,`unknown keyword: "${r}"`)}function l(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(s,i,n,l)=>{let c=void 0===n?i:n instanceof o.Name?(i instanceof o.Name?e(s,i,n):t(s,i,n),n):i instanceof o.Name?(t(s,n,i),i):r(i,n);return l!==o.Name||c instanceof o.Name?c:a(s,c)}}function d(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,o._)`{}`);return void 0!==t&&f(e,r,t),r}function f(e,t,r){Object.keys(r).forEach(r=>e.assign((0,o._)`${t}${(0,o.getProperty)(r)}`,!0))}t.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(n(e,t),!function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}(t,e.self.RULES.all))},t.checkUnknownRules=n,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,a,s){if(!s){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,o._)`${r}`}return(0,o._)`${e}${t}${(0,o.getProperty)(a)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(l(e))},t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},t.mergeEvaluated={props:u({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,o._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,o._)`${r} || {}`).code((0,o._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,o._)`${r} || {}`),f(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:d}),items:u({mergeNames:(e,t,r)=>e.if((0,o._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,o._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,o._)`${r} !== true`,()=>e.assign(r,!0===t||(0,o._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=d;let h={};function p(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:h[t.code]||(h[t.code]=new i._Code(t.code))})},(s=a||(t.Type=a={}))[s.Num=0]="Num",s[s.Str=1]="Str",t.getErrorPath=function(e,t,r){if(e instanceof o.Name){let s=t===a.Num;return r?s?(0,o._)`"[" + ${e} + "]"`:(0,o._)`"['" + ${e} + "']"`:s?(0,o._)`"/" + ${e}`:(0,o._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,o.getProperty)(e).toString():"/"+l(e)},t.checkStrictMode=p},74758(e,t){function r(e,t){return t.rules.some(t=>a(e,t))}function a(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},a){let s=t.RULES.types[a];return s&&!0!==s&&r(e,s)},t.shouldUseGroup=r,t.shouldUseRule=a},15948(e,t,r){t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let a=r(49409),s=r(17898),o=r(63036),i={message:"boolean schema is false"};function n(e,t){let{gen:r,data:s}=e;(0,a.reportError)({gen:r,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},i,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:r,validateName:a}=e;!1===r?n(e,!1):"object"==typeof r&&!0===r.$async?t.return(o.default.data):(t.assign((0,s._)`${a}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:r,schema:a}=e;!1===a?(r.var(t,!1),n(e)):r.var(t,!0)}},69003(e,t,r){var a,s;t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let o=r(90383),i=r(74758),n=r(49409),l=r(17898),c=r(50458);function u(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(o.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(s=a||(t.DataType=a={}))[s.Correct=0]="Correct",s[s.Wrong=1]="Wrong",t.getSchemaTypes=function(e){let t=u(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=u,t.coerceAndCheckDataType=function(e,t){var r,s;let{gen:o,data:n,opts:c}=e,u=(r=t,(s=c.coerceTypes)?r.filter(e=>d.has(e)||"array"===s&&"array"===e):[]),f=t.length>0&&!(0===u.length&&1===t.length&&(0,i.schemaHasRulesForType)(e,t[0]));if(f){let r=h(t,n,c.strictNumbers,a.Wrong);o.if(r,()=>{u.length?function(e,t,r){let{gen:a,data:s,opts:o}=e,i=a.let("dataType",(0,l._)`typeof ${s}`),n=a.let("coerced",(0,l._)`undefined`);for(let e of("array"===o.coerceTypes&&a.if((0,l._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>a.assign(s,(0,l._)`${s}[0]`).assign(i,(0,l._)`typeof ${s}`).if(h(t,s,o.strictNumbers),()=>a.assign(n,s))),a.if((0,l._)`${n} !== undefined`),r))(d.has(e)||"array"===e&&"array"===o.coerceTypes)&&function(e){switch(e){case"string":a.elseIf((0,l._)`${i} == "number" || ${i} == "boolean"`).assign(n,(0,l._)`"" + ${s}`).elseIf((0,l._)`${s} === null`).assign(n,(0,l._)`""`);return;case"number":a.elseIf((0,l._)`${i} == "boolean" || ${s} === null
2
2
  || (${i} == "string" && ${s} && ${s} == +${s})`).assign(n,(0,l._)`+${s}`);return;case"integer":a.elseIf((0,l._)`${i} === "boolean" || ${s} === null
3
3
  || (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(n,(0,l._)`+${s}`);return;case"boolean":a.elseIf((0,l._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(n,!1).elseIf((0,l._)`${s} === "true" || ${s} === 1`).assign(n,!0);return;case"null":a.elseIf((0,l._)`${s} === "" || ${s} === 0 || ${s} === false`),a.assign(n,null);return;case"array":a.elseIf((0,l._)`${i} === "string" || ${i} === "number"
4
4
  || ${i} === "boolean" || ${s} === null`).assign(n,(0,l._)`[${s}]`)}}(e);a.else(),m(e),a.endIf(),a.if((0,l._)`${n} !== undefined`,()=>{a.assign(s,n),function({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,l._)`${t} !== undefined`,()=>e.assign((0,l._)`${t}[${r}]`,a))}(e,n)})}(e,t,u):m(e)})}return f};let d=new Set(["string","number","integer","boolean","null"]);function f(e,t,r,s=a.Correct){let o,i=s===a.Correct?l.operators.EQ:l.operators.NEQ;switch(e){case"null":return(0,l._)`${t} ${i} null`;case"array":o=(0,l._)`Array.isArray(${t})`;break;case"object":o=(0,l._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=n((0,l._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=n();break;default:return(0,l._)`typeof ${t} ${i} ${e}`}return s===a.Correct?o:(0,l.not)(o);function n(e=l.nil){return(0,l.and)((0,l._)`typeof ${t} == "number"`,e,r?(0,l._)`isFinite(${t})`:l.nil)}}function h(e,t,r,a){let s;if(1===e.length)return f(e[0],t,r,a);let o=(0,c.toHash)(e);if(o.array&&o.object){let e=(0,l._)`typeof ${t} != "object"`;s=o.null?e:(0,l._)`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else s=l.nil;for(let e in o.number&&delete o.integer,o)s=(0,l.and)(s,f(e,t,r,a));return s}t.checkDataType=f,t.checkDataTypes=h;let p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,l._)`{type: ${e}}`:(0,l._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:a}=e,s=(0,c.schemaRefOrVal)(e,a,"type");return{gen:t,keyword:"type",data:r,schema:a.type,schemaCode:s,schemaValue:s,parentSchema:a,params:{},it:e}}(e);(0,n.reportError)(t,p)}t.reportTypeError=m},96841(e,t,r){t.assignDefaults=void 0;let a=r(17898),s=r(50458);function o(e,t,r){let{gen:o,compositeRule:i,data:n,opts:l}=e;if(void 0===r)return;let c=(0,a._)`${n}${(0,a.getProperty)(t)}`;if(i)return void(0,s.checkStrictMode)(e,`default is ignored for: ${c}`);let u=(0,a._)`${c} === undefined`;"empty"===l.useDefaults&&(u=(0,a._)`${u} || ${c} === null || ${c} === ""`),o.if(u,(0,a._)`${c} = ${(0,a.stringify)(r)}`)}t.assignDefaults=function(e,t){let{properties:r,items:a}=e.schema;if("object"===t&&r)for(let t in r)o(e,t,r[t].default);else"array"===t&&Array.isArray(a)&&a.forEach((t,r)=>o(e,r,t.default))}},96223(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let a=r(15948),s=r(69003),o=r(74758),i=r(69003),n=r(96841),l=r(49348),c=r(53322),u=r(17898),d=r(63036),f=r(14856),h=r(50458),p=r(49409);function m({gen:e,validateName:t,schema:r,schemaEnv:a,opts:s},o){var i;s.code.es5?e.func(t,(0,u._)`${d.default.data}, ${d.default.valCxt}`,a.$async,()=>{var t,a;e.code((0,u._)`"use strict"; ${y(r,s)}`),t=e,a=s,t.if(d.default.valCxt,()=>{t.var(d.default.instancePath,(0,u._)`${d.default.valCxt}.${d.default.instancePath}`),t.var(d.default.parentData,(0,u._)`${d.default.valCxt}.${d.default.parentData}`),t.var(d.default.parentDataProperty,(0,u._)`${d.default.valCxt}.${d.default.parentDataProperty}`),t.var(d.default.rootData,(0,u._)`${d.default.valCxt}.${d.default.rootData}`),a.dynamicRef&&t.var(d.default.dynamicAnchors,(0,u._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)},()=>{t.var(d.default.instancePath,(0,u._)`""`),t.var(d.default.parentData,(0,u._)`undefined`),t.var(d.default.parentDataProperty,(0,u._)`undefined`),t.var(d.default.rootData,d.default.data),a.dynamicRef&&t.var(d.default.dynamicAnchors,(0,u._)`{}`)}),e.code(o)}):e.func(t,(0,u._)`${d.default.data}, ${(i=s,(0,u._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${i.dynamicRef?(0,u._)`, ${d.default.dynamicAnchors}={}`:u.nil}}={}`)}`,a.$async,()=>e.code(y(r,s)).code(o))}function y(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,u._)`/*# sourceURL=${r} */`:u.nil}function $({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function g(e){return"boolean"!=typeof e.schema}function v(e){(0,h.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:a,self:s}=e;t.$ref&&a.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function _(e,t){if(e.opts.jtd)return b(e,[],!1,t);let r=(0,s.getSchemaTypes)(e.schema),a=(0,s.coerceAndCheckDataType)(e,r);b(e,r,!a,t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:a,opts:s}){let o=r.$comment;if(!0===s.$comment)e.code((0,u._)`${d.default.self}.logger.log(${o})`);else if("function"==typeof s.$comment){let r=(0,u.str)`${a}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,u._)`${d.default.self}.opts.$comment(${o}, ${r}, ${s}.schema)`)}}function b(e,t,r,a){var s,n,l,c;let{gen:f,schema:p,data:m,allErrors:y,opts:$,self:g}=e,{RULES:v}=g;if(p.$ref&&($.ignoreKeywordsWithRef||!(0,h.schemaHasRulesButRef)(p,v)))return void f.block(()=>N(e,"$ref",v.all.$ref.definition));function _(s){(0,o.shouldUseGroup)(p,s)&&(s.type?(f.if((0,i.checkDataType)(s.type,m,$.strictNumbers)),E(e,s),1===t.length&&t[0]===s.type&&r&&(f.else(),(0,i.reportTypeError)(e)),f.endIf()):E(e,s),y||f.if((0,u._)`${d.default.errors} === ${a||0}`))}$.jtd||(s=e,n=t,!s.schemaEnv.meta&&s.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{S(e.dataTypes,t)||k(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let a of e.dataTypes)S(t,a)?r.push(a):t.includes("integer")&&"number"===a&&r.push("integer");e.dataTypes=r}(e,t)}}(s,n),s.opts.allowUnionTypes||(l=s,(c=n).length>1&&!(2===c.length&&c.includes("null"))&&k(l,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let a in r){let s=r[a];if("object"==typeof s&&(0,o.shouldUseRule)(e.schema,s)){let{type:r}=s.definition;r.length&&!r.some(e=>{var r,a;return r=t,a=e,r.includes(a)||"number"===a&&r.includes("integer")})&&k(e,`missing type "${r.join(",")}" for keyword "${a}"`)}}}(s,s.dataTypes))),f.block(()=>{for(let e of v.rules)_(e);_(v.post)})}function E(e,t){let{gen:r,schema:a,opts:{useDefaults:s}}=e;s&&(0,n.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,o.shouldUseRule)(a,r)&&N(e,r.keyword,r.definition,t.type)})}function S(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function k(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,h.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){g(e)&&(v(e),$(e))?function(e){let{schema:t,opts:r,gen:a}=e;m(e,()=>{r.$comment&&t.$comment&&w(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,h.checkStrictMode)(e,"default is ignored in the schema root")}(e),a.let(d.default.vErrors,null),a.let(d.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,u._)`${r}.evaluated`),t.if((0,u._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,u._)`${e.evaluated}.props`,(0,u._)`undefined`)),t.if((0,u._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,u._)`${e.evaluated}.items`,(0,u._)`undefined`))}(e),_(e),function(e){let{gen:t,schemaEnv:r,validateName:a,ValidationError:s,opts:o}=e;r.$async?t.if((0,u._)`${d.default.errors} === 0`,()=>t.return(d.default.data),()=>t.throw((0,u._)`new ${s}(${d.default.vErrors})`)):(t.assign((0,u._)`${a}.errors`,d.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:r,items:a}){r instanceof u.Name&&e.assign((0,u._)`${t}.props`,r),a instanceof u.Name&&e.assign((0,u._)`${t}.items`,a)}(e),t.return((0,u._)`${d.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,a.topBoolOrEmptySchema)(e))};class P{constructor(e,t,r){if((0,l.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,h.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",T(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",d.default.errors))}result(e,t,r){this.failResult((0,u.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,u.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,u._)`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?p.reportExtraError:p.reportError)(this,this.def.error,t)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,p.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=u.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=u.nil,t=u.nil){if(!this.$data)return;let{gen:r,schemaCode:a,schemaType:s,def:o}=this;r.if((0,u.or)((0,u._)`${a} === undefined`,t)),e!==u.nil&&r.assign(e,!0),(s.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==u.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:a,it:s}=this;return(0,u.or)(function(){if(r.length){if(!(t instanceof u.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,u._)`${(0,i.checkDataTypes)(e,t,s.opts.strictNumbers,i.DataType.Wrong)}`}return u.nil}(),function(){if(a.validateSchema){let r=e.scopeValue("validate$data",{ref:a.validateSchema});return(0,u._)`!${r}(${t})`}return u.nil}())}subschema(e,t){let r=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(r,this.it,e),(0,c.extendSubschemaMode)(r,e);let s={...this.it,...r,items:void 0,props:void 0};return!function(e,t){if(g(e)&&(v(e),$(e)))return function(e,t){var r;let a,{schema:s,gen:o,opts:i}=e;i.$comment&&s.$comment&&w(e),(a=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,f.resolveUrl)(r.opts.uriResolver,r.baseId,a)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let n=o.const("_errs",d.default.errors);_(e,n),o.var(t,(0,u._)`${n} === ${d.default.errors}`)}(e,t);(0,a.boolOrEmptySchema)(e,t)}(s,t),s}mergeEvaluated(e,t){let{it:r,gen:a}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=h.mergeEvaluated.props(a,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=h.mergeEvaluated.items(a,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:a}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return a.if(t,()=>this.mergeEvaluated(e,u.Name)),!0}}function N(e,t,r,a){let s=new P(e,r,t);"code"in r?r.code(s,a):s.$data&&r.validate?(0,l.funcKeywordCode)(s,r):"macro"in r?(0,l.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,l.funcKeywordCode)(s,r)}t.KeywordCxt=P;let j=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T(e,{dataLevel:t,dataNames:r,dataPathArr:a}){let s,o;if(""===e)return d.default.rootData;if("/"===e[0]){if(!j.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=d.default.rootData}else{let i=x.exec(e);if(!i)throw Error(`Invalid JSON-pointer: ${e}`);let l=+i[1];if("#"===(s=i[2])){if(l>=t)throw Error(n("property/index",l));return a[t-l]}if(l>t)throw Error(n("data",l));if(o=r[t-l],!s)return o}let i=o;for(let e of s.split("/"))e&&(o=(0,u._)`${o}${(0,u.getProperty)((0,h.unescapeJsonPointer)(e))}`,i=(0,u._)`${i} && ${o}`);return i;function n(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=T},49348(e,t,r){t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let a=r(17898),s=r(63036),o=r(94450),i=r(49409);function n(e){let{gen:t,data:r,it:s}=e;t.if(s.parentData,()=>t.assign(r,(0,a._)`${s.parentData}[${s.parentDataProperty}]`))}function l(e,t,r){if(void 0===r)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,a.stringify)(r)})}t.macroKeywordCode=function(e,t){let{gen:r,keyword:s,schema:o,parentSchema:i,it:n}=e,c=t.macro.call(n.self,o,i,n),u=l(r,s,c);!1!==n.opts.validateSchema&&n.self.validateSchema(c,!0);let d=r.name("valid");e.subschema({schema:c,schemaPath:a.nil,errSchemaPath:`${n.errSchemaPath}/${s}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;let{gen:c,keyword:u,schema:d,parentSchema:f,$data:h,it:p}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(p,t);let m=l(c,u,!h&&t.compile?t.compile.call(p.self,d,f,p):t.validate),y=c.let("valid");function $(r=t.async?(0,a._)`await `:a.nil){let i=p.opts.passContext?s.default.this:s.default.self,n=!("compile"in t&&!h||!1===t.schema);c.assign(y,(0,a._)`${r}${(0,o.callValidateCode)(e,m,i,n)}`,t.modifying)}function g(e){var r;c.if((0,a.not)(null!=(r=t.valid)?r:y),e)}e.block$data(y,function(){if(!1===t.errors)$(),t.modifying&&n(e),g(()=>e.error());else{let r,o,l=t.async?(r=c.let("ruleErrs",null),c.try(()=>$((0,a._)`await `),e=>c.assign(y,!1).if((0,a._)`${e} instanceof ${p.ValidationError}`,()=>c.assign(r,(0,a._)`${e}.errors`),()=>c.throw(e))),r):(o=(0,a._)`${m}.errors`,c.assign(o,null),$(a.nil),o);t.modifying&&n(e),g(()=>(function(e,t){let{gen:r}=e;r.if((0,a._)`Array.isArray(${t})`,()=>{r.assign(s.default.vErrors,(0,a._)`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`).assign(s.default.errors,(0,a._)`${s.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(r=t.valid)?r:y)},t.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)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:a},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw Error("ajv implementation error");let i=s.dependencies;if(null==i?void 0:i.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){let e=`keyword "${o}" value is invalid at path "${a}": `+r.errorsText(s.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}},53322(e,t,r){t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let a=r(17898),s=r(50458);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:o,schemaPath:i,errSchemaPath:n,topSchemaRef:l}){if(void 0!==t&&void 0!==o)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){let o=e.schema[t];return void 0===r?{schema:o,schemaPath:(0,a._)`${e.schemaPath}${(0,a.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:o[r],schemaPath:(0,a._)`${e.schemaPath}${(0,a.getProperty)(t)}${(0,a.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,s.escapeFragment)(r)}`}}if(void 0!==o){if(void 0===i||void 0===n||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:i,topSchemaRef:l,errSchemaPath:n}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:o,data:i,dataTypes:n,propertyName:l}){if(void 0!==i&&void 0!==r)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=t;if(void 0!==r){let{errorPath:i,dataPathArr:n,opts:l}=t;u(c.let("data",(0,a._)`${t.data}${(0,a.getProperty)(r)}`,!0)),e.errorPath=(0,a.str)`${i}${(0,s.getErrorPath)(r,o,l.jsPropertySyntax)}`,e.parentDataProperty=(0,a._)`${r}`,e.dataPathArr=[...n,e.parentDataProperty]}function u(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==i&&(u(i instanceof a.Name?i:c.let("data",i,!0)),void 0!==l&&(e.propertyName=l)),n&&(e.dataTypes=n)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:a,createErrors:s,allErrors:o}){void 0!==a&&(e.compositeRule=a),void 0!==s&&(e.createErrors=s),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}},65319(e,t,r){r(96223),r(17898);let a=r(95031),s=r(85748),o=r(90383),i=r(49392),n=r(17898),l=r(14856),c=r(69003),u=r(50458),d=r(93770),f=r(7903),h=(e,t)=>new RegExp(e,t);h.code="new RegExp";let p=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={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."},$={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};class g{constructor(e={}){var t,r,a,s,i,l,c,u,d,p,g,_,P,N,j,x,T,I,R,O,C,A,D,V,M,z;let q,U,K,F,L;this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...(q=(t=e).strict,K=!0===(U=null==(r=t.code)?void 0:r.optimize)||void 0===U?1:U||0,F=null!=(s=null==(a=t.code)?void 0:a.regExp)?s:h,L=null!=(i=t.uriResolver)?i:f.default,{strictSchema:null==(c=null!=(l=t.strictSchema)?l:q)||c,strictNumbers:null==(d=null!=(u=t.strictNumbers)?u:q)||d,strictTypes:null!=(g=null!=(p=t.strictTypes)?p:q)?g:"log",strictTuples:null!=(P=null!=(_=t.strictTuples)?_:q)?P:"log",strictRequired:null!=(j=null!=(N=t.strictRequired)?N:q)&&j,code:t.code?{...t.code,optimize:K,regExp:F}:{optimize:K,regExp:F},loopRequired:null!=(x=t.loopRequired)?x:200,loopEnum:null!=(T=t.loopEnum)?T:200,meta:null==(I=t.meta)||I,messages:null==(R=t.messages)||R,inlineRefs:null==(O=t.inlineRefs)||O,schemaId:null!=(C=t.schemaId)?C:"$id",addUsedSchema:null==(A=t.addUsedSchema)||A,validateSchema:null==(D=t.validateSchema)||D,validateFormats:null==(V=t.validateFormats)||V,unicodeRegExp:null==(M=t.unicodeRegExp)||M,int32range:null==(z=t.int32range)||z,uriResolver:L})};let{es5:G,lines:H}=this.opts.code;this.scope=new n.ValueScope({scope:{},prefixes:m,es5:G,lines:H}),this.logger=function(e){if(!1===e)return k;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);let J=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),v.call(this,y,e,"NOT SUPPORTED"),v.call(this,$,e,"DEPRECATED","warn"),this._metaOpts=S.call(this),e.formats&&b.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=J}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,a=d;"id"===r&&((a={...d}).id=a.$id,delete a.$id),t&&e&&this.addMetaSchema(a,a[r],!1)}defaultMeta(){let{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)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let a=r(t);return"$async"in r||(this.errors=r.errors),a}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return a.call(this,e,t);async function a(e,t){await o.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||i.call(this,r)}async function o(e){e&&!this.getSchema(e)&&await a.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof s.default))throw t;return n.call(this,t),await l.call(this,t.missingSchema),i.call(this,e)}}function n({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await c.call(this,e);this.refs[e]||await o.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function c(e){let 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,a=this.opts.validateSchema){let s;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,a);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(s=e[t])&&"string"!=typeof s)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,a,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let a=this.validate(r,e);if(!a&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return a}getSchema(e){let t;for(;"string"==typeof(t=_.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,a=new i.SchemaEnv({schema:{},schemaId:r});if(!(t=i.resolveSchema.call(this,a,e)))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":{let t=_.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,l.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let 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){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(N.call(this,r,t),!t)return(0,u.eachItem)(r,e=>j.call(this,e)),this;T.call(this,t);let a={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===a.type.length?e=>j.call(this,e,a):e=>a.type.forEach(t=>j.call(this,e,a,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let 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){let r=this.RULES.all;for(let a of(e=JSON.parse(JSON.stringify(e)),t)){let t=a.split("/").slice(1),s=e;for(let e of t)s=s[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:a}=t.definition,o=s[e];a&&o&&(s[e]=R(o))}}return e}_removeAllSchemas(e,t){for(let r in e){let a=e[r];(!t||t.test(r))&&("string"==typeof a?delete e[r]:a&&!a.meta&&(this._cache.delete(a.schema),delete e[r]))}}_addSchema(e,t,r,a=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:n}=this.opts;if("object"==typeof e)o=e[n];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let c=this._cache.get(e);if(void 0!==c)return c;r=(0,l.normalizeId)(o||r);let u=l.getSchemaRefs.call(this,e,r);return c=new i.SchemaEnv({schema:e,schemaId:n,meta:t,baseId:r,localRefs:u}),this._cache.set(c.schema,c),s&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=c),a&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):i.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,e)}finally{this.opts=t}}}function v(e,t,r,a="error"){for(let s in e)s in t&&this.logger[a](`${r}: option ${s}. ${e[s]}`)}function _(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function b(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function S(){let e={...this.opts};for(let t of p)delete e[t];return e}g.ValidationError=a.default,g.MissingRefError=s.default,t.default=g;let k={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function N(e,t){let{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!P.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function j(e,t,r){var a;let s=null==t?void 0:t.post;if(r&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:e})=>e===r);if(i||(i={type:r,rules:[]},o.rules.push(i)),o.keywords[e]=!0,!t)return;let n={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?x.call(this,i,n,t.before):i.rules.push(n),o.all[e]=n,null==(a=t.implements)||a.forEach(e=>this.addKeyword(e))}function x(e,t,r){let a=e.rules.findIndex(e=>e.keyword===r);a>=0?e.rules.splice(a,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function T(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}let I={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,I]}}},72725(e,t,r){let a=r(38792);a.code='require("ajv/dist/runtime/equal").default',t.default=a},26308(e,t){function r(e){let t,r=e.length,a=0,s=0;for(;s<r;)a++,(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<r&&(64512&(t=e.charCodeAt(s)))==56320&&s++;return a}t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},7903(e,t,r){let a=r(84800);a.code='require("ajv/dist/runtime/uri").default',t.default=a},95031(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}},93426(e,t,r){t.validateAdditionalItems=void 0;let a=r(17898),s=r(50458);function o(e,t){let{gen:r,schema:o,data:i,keyword:n,it:l}=e;l.items=!0;let c=r.const("len",(0,a._)`${i}.length`);if(!1===o)e.setParams({len:t.length}),e.pass((0,a._)`${c} <= ${t.length}`);else if("object"==typeof o&&!(0,s.alwaysValidSchema)(l,o)){let o=r.var("valid",(0,a._)`${c} <= ${t.length}`);r.if((0,a.not)(o),()=>{var i;return i=o,void r.forRange("i",t.length,c,t=>{e.subschema({keyword:n,dataProp:t,dataPropType:s.Type.Num},i),l.allErrors||r.if((0,a.not)(i),()=>r.break())})}),e.ok(o)}}t.validateAdditionalItems=o,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,a.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,a._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;Array.isArray(a)?o(e,a):(0,s.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}}},92697(e,t,r){let a=r(94450),s=r(17898),o=r(63036),i=r(50458);t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,s._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:t,schema:r,parentSchema:n,data:l,errsCount:c,it:u}=e;if(!c)throw Error("ajv implementation error");let{allErrors:d,opts:f}=u;if(u.props=!0,"all"!==f.removeAdditional&&(0,i.alwaysValidSchema)(u,r))return;let h=(0,a.allSchemaProperties)(n.properties),p=(0,a.allSchemaProperties)(n.patternProperties);function m(e){t.code((0,s._)`delete ${l}[${e}]`)}function y(a){if("all"===f.removeAdditional||f.removeAdditional&&!1===r)return void m(a);if(!1===r){e.setParams({additionalProperty:a}),e.error(),d||t.break();return}if("object"==typeof r&&!(0,i.alwaysValidSchema)(u,r)){let r=t.name("valid");"failing"===f.removeAdditional?($(a,r,!1),t.if((0,s.not)(r),()=>{e.reset(),m(a)})):($(a,r),d||t.if((0,s.not)(r),()=>t.break()))}}function $(t,r,a){let s={keyword:"additionalProperties",dataProp:t,dataPropType:i.Type.Str};!1===a&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(s,r)}t.forIn("key",l,r=>{h.length||p.length?t.if(function(r){let o;if(h.length>8){let e=(0,i.schemaRefOrVal)(u,n.properties,"properties");o=(0,a.isOwnProperty)(t,e,r)}else o=h.length?(0,s.or)(...h.map(e=>(0,s._)`${r} === ${e}`)):s.nil;return p.length&&(o=(0,s.or)(o,...p.map(t=>(0,s._)`${(0,a.usePattern)(e,t)}.test(${r})`))),(0,s.not)(o)}(r),()=>y(r)):y(r)}),e.ok((0,s._)`${c} === ${o.default.errors}`)}}},79355(e,t,r){let a=r(50458);t.default={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let o=t.name("valid");r.forEach((t,r)=>{if((0,a.alwaysValidSchema)(s,t))return;let i=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(i)})}}},19430(e,t,r){t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(94450).validateUnion,error:{message:"must match a schema in anyOf"}}},35724(e,t,r){let a=r(17898),s=r(50458);t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?(0,a.str)`must contain at least ${e} valid item(s)`:(0,a.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?(0,a._)`{minContains: ${e}}`:(0,a._)`{minContains: ${e}, maxContains: ${t}}`},code(e){let t,r,{gen:o,schema:i,parentSchema:n,data:l,it:c}=e,{minContains:u,maxContains:d}=n;c.opts.next?(t=void 0===u?1:u,r=d):t=1;let f=o.const("len",(0,a._)`${l}.length`);if(e.setParams({min:t,max:r}),void 0===r&&0===t)return void(0,s.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==r&&t>r){(0,s.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,s.alwaysValidSchema)(c,i)){let s=(0,a._)`${f} >= ${t}`;void 0!==r&&(s=(0,a._)`${s} && ${f} <= ${r}`),e.pass(s);return}c.items=!0;let h=o.name("valid");function p(){let e=o.name("_valid"),s=o.let("count",0);m(e,()=>o.if(e,()=>{var e;return e=s,void(o.code((0,a._)`${e}++`),void 0===r?o.if((0,a._)`${e} >= ${t}`,()=>o.assign(h,!0).break()):(o.if((0,a._)`${e} > ${r}`,()=>o.assign(h,!1).break()),1===t?o.assign(h,!0):o.if((0,a._)`${e} >= ${t}`,()=>o.assign(h,!0))))}))}function m(t,r){o.forRange("i",0,f,a=>{e.subschema({keyword:"contains",dataProp:a,dataPropType:s.Type.Num,compositeRule:!0},t),r()})}void 0===r&&1===t?m(h,()=>o.if(h,()=>o.break())):0===t?(o.let(h,!0),void 0!==r&&o.if((0,a._)`${l}.length > 0`,p)):(o.let(h,!1),p()),e.result(h,()=>e.reset())}}},99868(e,t,r){t.z3=void 0;let a=r(17898),s=r(50458),o=r(94450);t.z3={message:({params:{property:e,depsCount:t,deps:r}})=>(0,a.str)`must have ${1===t?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:s}})=>(0,a._)`{property: ${e},
package/lib/9940.js ADDED
@@ -0,0 +1,19 @@
1
+ import*as e from"ink";import*as r from"react";import{Fragment as t,jsx as l,jsxs as n}from"react/jsx-runtime";export const __rspack_esm_id=9940;export const __rspack_esm_ids=[9940];export const __webpack_modules__={8498(r){r.exports=e},51649(e){e.exports=r},92319(e,r,i){i.r(r),i.d(r,{AppList:()=>L,CONTROL_ACTIONS:()=>g,MainMenu:()=>E,Header:()=>T,ModuleDetail:()=>M,ONLINE_THRESHOLD_MS:()=>p,ShortEditEditor:()=>K,MediaFileList:()=>G,App:()=>ea,DeviceDetail:()=>C,VIEWS:()=>m,runInteractiveMode:()=>ed,DeviceList:()=>B,MediaBoxList:()=>j,Loading:()=>_,DeviceControl:()=>k,ProjectInitView:()=>eo,GroupDetail:()=>U,ModuleList:()=>P,MediaBoxDetail:()=>$,GroupList:()=>R,Footer:()=>b,DeviceStatus:()=>D,AppDetail:()=>O,DeviceScreenshot:()=>w,MediaFileDetail:()=>F});var o,a=i(99436),c=i(51649),d=i(8498),s=i(68832),u=i(85382),h=i(47988),f=i(60450),m={MAIN:"main",DEVICES:"devices",DEVICE_DETAIL:"device_detail",DEVICE_CONTROL:"device_control",DEVICE_SCREENSHOT:"device_screenshot",APPS:"apps",APP_DETAIL:"app_detail",APP_SHORT_EDIT:"app_short_edit",APP_PROJECT_INIT:"app_project_init",MODULES:"modules",MODULE_DETAIL:"module_detail",MODULE_SHORT_EDIT:"module_short_edit",MODULE_PROJECT_INIT:"module_project_init",GROUPS:"groups",GROUP_DETAIL:"group_detail",MEDIA_BOXES:"media_boxes",MEDIA_BOX_DETAIL:"media_box_detail",MEDIA_FILES:"media_files",MEDIA_FILE_DETAIL:"media_file_detail",ACTIVITY_LOG:"activity_log"},g=[{label:"Refresh Application",value:"refresh"},{label:"Clear Cache",value:"clear-cache"},{label:"Take Screenshot",value:"take-screenshot"},{label:"Open System Menu",value:"system-menu-open"},{label:"Close System Menu",value:"system-menu-close"},{label:"Open Debug Panel",value:"debug-panel-open"},{label:"Close Debug Panel",value:"debug-panel-close"},{label:"Enable Logging",value:"logging-on"},{label:"Disable Logging",value:"logging-off"},{label:"← Back",value:"back"}],p=3e5,x=i(47882),y=(e,r=!0)=>{var t=Math.floor(60),l=s((0,c.useState)(t),2),n=l[0],i=l[1],o=s((0,c.useState)(null),2),a=o[0],d=o[1],u=(0,c.useRef)(e);(0,c.useEffect)(()=>{u.current=e},[e]);var h=(0,c.useCallback)(()=>{i(t),d(Date.now())},[t]);return(0,c.useEffect)(()=>{if(r){var e=setInterval(()=>{i(e=>e<=1?(u.current?.(),d(Date.now()),t):e-1)},1e3);return()=>clearInterval(e)}},[r,t]),(0,c.useEffect)(()=>{r&&(i(t),d(Date.now()))},[r,t]),{countdown:n,lastRefreshTime:a,resetCountdown:h}},v=({countdown:e,lastRefreshTime:r})=>l(d.Box,{children:n(d.Text,{color:"gray",children:["Next refresh in ",n(d.Text,{color:"cyan",children:[e,"s"]}),r&&n(d.Text,{color:"gray",children:[" (last: ",r?new Date(r).toLocaleTimeString():null,")"]})]})}),T=({workspace:e,view:r})=>n(d.Box,{flexDirection:"column",marginBottom:1,children:[n(d.Box,{children:[l(d.Text,{bold:!0,color:"cyan",children:"BRICKS CLI"}),l(d.Text,{color:"gray",children:" - Interactive Mode"})]}),n(d.Box,{children:[l(d.Text,{color:"gray",children:"Workspace: "}),l(d.Text,{color:"green",children:e?.name||"Not connected"}),l(d.Text,{color:"gray",children:" | View: "}),l(d.Text,{color:"yellow",children:r})]}),l(d.Text,{color:"gray",children:"─".repeat(60)})]}),b=()=>n(d.Box,{marginTop:1,flexDirection:"column",children:[l(d.Text,{color:"gray",children:"─".repeat(60)}),n(d.Text,{color:"gray",children:["Press ",l(d.Text,{color:"cyan",children:"q"})," to quit, ",l(d.Text,{color:"cyan",children:"Esc"})," to go back"]})]}),_=({text:e})=>n(d.Box,{children:[l(d.Text,{color:"green",children:l(x.A,{type:"dots"})}),n(d.Text,{children:[" ",e||"Loading..."]})]}),D=({lastAliveTime:e})=>{if(!e)return l(d.Text,{color:"gray",children:"○ Unknown"});var r=Date.now()-new Date(e).getTime();if(r<=p)return l(d.Text,{color:"green",children:"● Online"});var t=Math.floor(r/6e4);if(t<60)return n(d.Text,{color:"yellow",children:["○ Offline (",t,"m ago)"]});var i=Math.floor(t/60);if(i<24)return n(d.Text,{color:"red",children:["○ Offline (",i,"h ago)"]});var o=Math.floor(i/24);return n(d.Text,{color:"red",children:["○ Offline (",o,"d ago)"]})},S=i(48724),E=({onSelect:e,mediaEnabled:r,activityLogEnabled:t})=>{var i=[{label:"Devices",value:m.DEVICES},{label:"Applications",value:m.APPS},{label:"Modules",value:m.MODULES},{label:"Device Groups",value:m.GROUPS},...r?[{label:"Media Flow",value:m.MEDIA_BOXES}]:[],...t?[{label:"Activity Log",value:m.ACTIVITY_LOG}]:[],{label:"Exit",value:"exit"}];return n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,marginBottom:1,children:"Main Menu"}),l(S.Ay,{items:i,onSelect:e})]})},I="1"===process.env.BRICKS_CLI_DISTRIBUTION,A=e=>{var r=s((0,c.useState)(null),2),t=r[0],n=r[1];return((0,c.useEffect)(()=>{if(!I){var e=!0;return i.e(8166).then(i.bind(i,29557)).then(r=>{e&&n(()=>r.default)}).catch(()=>{e&&n(!1)}),()=>{e=!1}}},[]),I||!1===t)?l(d.Text,{color:"gray",children:"Image preview is not available in this CLI build."}):t?l(t,{...e}):l(_,{text:"Preparing image preview..."})},B=({devices:e,loading:r,onSelect:t,countdown:i,lastRefreshTime:o})=>{if(r)return l(_,{text:"Loading devices..."});if(!e?.length)return n(d.Box,{flexDirection:"column",children:[l(d.Text,{color:"yellow",children:"No devices found"}),l(v,{countdown:i,lastRefreshTime:o})]});var a=[...e.map(e=>{var r=(e=>{if(!e)return"○ Unknown";var r=Date.now()-new Date(e).getTime();if(r<=p)return"● Online";var t=Math.floor(r/6e4);if(t<60)return`○ ${t}m ago`;var l=Math.floor(t/60);if(l<24)return`○ ${l}h ago`;var n=Math.floor(l/24);return`○ ${n}d ago`})(e.entry_detail?.watch_dog_timer?.last_alive_time);return{label:`${r} - ${e.name||e.device_name}`,value:e._id,device:e}}),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return n(d.Box,{flexDirection:"column",children:[n(d.Box,{marginBottom:1,children:[n(d.Text,{bold:!0,children:["Devices (",e.length,")"]}),l(d.Text,{color:"gray",children:" - "}),l(v,{countdown:i,lastRefreshTime:o})]}),l(S.Ay,{items:a,onSelect:t})]})},C=({device:e,loading:r,error:t,onSelect:i,mediaEnabled:o,countdown:a,lastRefreshTime:c})=>{if(r)return l(_,{text:"Loading device..."});if(t)return n(d.Box,{flexDirection:"column",children:[n(d.Text,{color:"red",children:["Error: ",t]}),l(S.Ay,{items:[{label:"← Back",value:"back"}],onSelect:i})]});if(!e)return l(d.Text,{color:"red",children:"Device not found"});var s=[{label:"Control Device",value:"control"},...o?[{label:"View Screenshot",value:"screenshot"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],u=e.entry_detail,h=u?.screen,f=u?.update,m=u?.local_sync;return n(d.Box,{flexDirection:"column",children:[n(d.Box,{children:[l(d.Text,{bold:!0,color:"cyan",children:e.name||e.device_name}),l(d.Text,{color:"gray",children:" - "}),l(v,{countdown:a,lastRefreshTime:c})]}),e.description&&l(d.Text,{color:"gray",children:e.description}),n(d.Box,{marginY:1,flexDirection:"column",children:[n(d.Box,{children:[l(d.Text,{color:"gray",children:"Status: "}),l(D,{lastAliveTime:u?.watch_dog_timer?.last_alive_time})]}),n(d.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&n(d.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),u?.application&&n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Application"}),n(d.Text,{color:"gray",children:[" Name: ",u.application.name]}),n(d.Text,{color:"gray",children:[" Mode: ",u.operation_mode||"N/A"]})]}),h&&n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Screen"}),h.resolution&&n(d.Text,{color:"gray",children:[" ","Resolution: ",h.resolution.width,"x",h.resolution.height,h.resolution.scale&&` @${h.resolution.scale}x`]}),h.orientation&&n(d.Text,{color:"gray",children:[" Orientation: ",h.orientation]}),h.touch&&n(d.Text,{color:"gray",children:[" ","Touch:"," ",h.touch.available?`Yes (${h.touch.touch_point} points)`:"No"]})]}),(u?.memory_usage||u?.disk_usage)&&n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"System"}),u.memory_usage&&n(d.Text,{color:"gray",children:[" Memory: ",Math.round(100*u.memory_usage),"%"]}),u.disk_usage&&n(d.Text,{color:"gray",children:[" Disk: ",Math.round(100*u.disk_usage),"%"]})]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Capabilities"}),n(d.Text,{color:"gray",children:[" ","Sound: ",u?.sound?.available?"✓":"✗"," | ","Camera: ",u?.camera?.available?"✓":"✗"," | ","Audio In: ",u?.audio_in?.available?"✓":"✗"]})]}),m&&n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Local Sync"}),n(d.Text,{color:"gray",children:[" ","Role: ",m.is_main?"Main":"Peer",m.peer_count>0&&` | Peers: ${m.peer_count}`,m.mean_latency&&` | Latency: ${m.mean_latency}ms`]})]}),f&&n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Update"}),n(d.Text,{color:f.need_update?"yellow":"gray",children:[" ","Status: ",f.need_update?"⚠ Update available":"✓ Up to date"]}),f.current_version&&n(d.Text,{color:"gray",children:[" Version: ",f.current_version]})]})]}),l(S.Ay,{items:s,onSelect:i})]})},k=({device:e,onSelect:r,controlling:t,controlResult:i})=>n(d.Box,{flexDirection:"column",children:[n(d.Text,{bold:!0,color:"cyan",children:["Control: ",e?.name||e?.device_name]}),t&&l(_,{text:"Sending command..."}),i&&l(d.Text,{color:i.success?"green":"red",children:i.message}),l(d.Box,{marginTop:1,children:l(S.Ay,{items:g,onSelect:r})})]}),w=({device:e,screenshot:r,loading:t,error:i,onSelect:o})=>{var a=r?.file?.meta,c=a?.originalWidth!=null&&a?.originalHeight!=null,s=a?.originalFileSize!=null;return n(d.Box,{flexDirection:"column",children:[n(d.Text,{bold:!0,color:"cyan",children:["Screenshot: ",e?.name||e?.device_name||"Unknown"]}),t&&l(_,{text:"Loading screenshot..."}),i&&l(d.Box,{marginY:1,children:l(d.Text,{color:"red",children:String(i)})}),!t&&!i&&r&&n(d.Box,{flexDirection:"column",children:[l(d.Box,{height:30,children:l(A,{src:r.path,width:80,alt:"Device screenshot"})}),n(d.Box,{marginY:1,flexDirection:"column",children:[l(d.Text,{bold:!0,color:"white",children:"Screenshot Details"}),n(d.Box,{marginY:1,children:[l(d.Text,{color:"green",children:"Screenshot saved to: "}),l(d.Text,{color:"cyan",children:String(r.path||"")})]}),c&&n(d.Text,{color:"gray",children:["Size: ",String(a.originalWidth),"x",String(a.originalHeight)]}),s&&n(d.Text,{color:"gray",children:["File: ",(Number(a.originalFileSize)/1024).toFixed(1)," KB"]}),r.file?.updatedAt&&n(d.Text,{color:"gray",children:["Updated: ",new Date(r.file.updatedAt).toLocaleString()]})]})]}),!t&&!i&&!r&&l(d.Box,{marginY:1,children:l(d.Text,{color:"yellow",children:"No screenshot available. Try taking a new one."})}),l(d.Box,{marginTop:1,children:l(S.Ay,{items:[{label:"Take New Screenshot",value:"take"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:o})})]})},L=({apps:e,loading:r,onSelect:t})=>{if(r)return l(_,{text:"Loading applications..."});if(!e?.length)return l(d.Text,{color:"yellow",children:"No applications found"});var i=[...e.map(e=>({label:`${e.has_unreleased_changes?"●":"○"} ${e.name}`,value:e._id,app:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return n(d.Box,{flexDirection:"column",children:[n(d.Text,{bold:!0,marginBottom:1,children:["Applications (",e.length,")"]}),l(S.Ay,{items:i,onSelect:t})]})},O=({app:e,loading:r,error:t,onSelect:i})=>{if(r)return l(_,{text:"Loading application..."});if(t)return n(d.Box,{flexDirection:"column",children:[n(d.Text,{color:"red",children:["Error: ",t]}),l(S.Ay,{items:[{label:"← Back",value:"back"}],onSelect:i})]});if(!e)return l(d.Text,{color:"red",children:"Application not found"});var o=[{label:"⚡ Initialize Project",value:"project_init"},...e.short_edit?.enabled&&e.short_edit.ref_map?[{label:"Short Edit",value:"short_edit"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],a=e.devices?.length||0,c=e.devices?.filter(e=>"online"===e.status)?.length||0;return n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&l(d.Text,{color:"gray",children:e.description}),n(d.Box,{marginY:1,flexDirection:"column",children:[n(d.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&n(d.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Version"}),n(d.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),n(d.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]}),e.current_version_details&&n(d.Text,{color:"gray",children:[" ","Released: v",e.current_version_details.version||"N/A"]})]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Devices"}),n(d.Text,{color:"gray",children:[" ","Total: ",a,a>0&&` (${c} online)`]})]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Features"}),n(d.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]}),n(d.Text,{color:"gray",children:[" ","Canvas Control: ",e.canvas_control?.enabled?"✓ Enabled":"✗ Disabled"]}),n(d.Text,{color:"gray",children:[" ","Device Control: ",e.device_control?.enabled?"✓ Enabled":"✗ Disabled"]}),n(d.Text,{color:e.lock?.enabled?"yellow":"gray",children:[" ","Lock: ",e.lock?.enabled?"\uD83D\uDD12 Locked":"\uD83D\uDD13 Unlocked"]})]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&n(d.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&n(d.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),l(S.Ay,{items:o,onSelect:i})]})},P=({modules:e,loading:r,onSelect:t})=>{if(r)return l(_,{text:"Loading modules..."});var i=[...(e||[]).map(e=>({label:`${e.current_version?"●":"○"} ${e.name}`,value:e._id,module:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return n(d.Box,{flexDirection:"column",children:[n(d.Text,{bold:!0,marginBottom:1,children:["Modules (",e?.length||0,")"]}),!e?.length&&l(d.Text,{color:"yellow",children:"No modules found"}),l(S.Ay,{items:i,onSelect:t})]})},M=({module:e,loading:r,error:t,onSelect:i})=>{if(r)return l(_,{text:"Loading module..."});if(t)return n(d.Box,{flexDirection:"column",children:[n(d.Text,{color:"red",children:["Error: ",t]}),l(S.Ay,{items:[{label:"← Back",value:"back"}],onSelect:i})]});if(!e)return l(d.Text,{color:"red",children:"Module not found"});var o=[{label:"⚡ Initialize Project",value:"project_init"},...e.short_edit?.enabled&&e.short_edit.ref_map?[{label:"Short Edit",value:"short_edit"}]:[],{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,color:"cyan",children:e.name}),e.description&&l(d.Text,{color:"gray",children:e.description}),n(d.Box,{marginY:1,flexDirection:"column",children:[n(d.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&n(d.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Version"}),n(d.Text,{color:"gray",children:[" ","Current: ",e.current_version?`v${e.current_version}`:"N/A"]}),n(d.Text,{color:e.has_unreleased_changes?"yellow":"gray",children:[" ","Changes:"," ",e.has_unreleased_changes?"● Unreleased changes":"○ No pending changes"]})]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Usage"}),n(d.Text,{color:"gray",children:[" ","Used in: ",e.use_count?.total_count||0," application(s)"]})]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Settings"}),n(d.Text,{color:"gray",children:[" ","Public: ",e.is_public?"✓ Yes":"✗ No"]}),n(d.Text,{color:"gray",children:[" ","Modifiable: ",e.is_allow_modify?"✓ Yes":"✗ No"]}),n(d.Text,{color:"gray",children:[" ","Short Edit: ",e.short_edit?.enabled?"✓ Enabled":"✗ Disabled"]})]}),e.expose_properties?.length>0&&n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Exposed Properties"}),n(d.Text,{color:"gray",children:[" ",e.expose_properties.length," properties exposed"]})]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&n(d.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&n(d.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),l(S.Ay,{items:o,onSelect:i})]})},R=({groups:e,loading:r,onSelect:t,countdown:i,lastRefreshTime:o})=>{if(r)return l(_,{text:"Loading device groups..."});var a=[...(e||[]).map(e=>({label:`📁 ${e.name} (${e.devices?.length||0} devices)`,value:e._id,group:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return n(d.Box,{flexDirection:"column",children:[n(d.Box,{marginBottom:1,children:[n(d.Text,{bold:!0,children:["Device Groups (",e?.length||0,")"]}),l(d.Text,{color:"gray",children:" - "}),l(v,{countdown:i,lastRefreshTime:o})]}),!e?.length&&l(d.Text,{color:"yellow",children:"No device groups found"}),l(S.Ay,{items:a,onSelect:t})]})},N=({loading:e,groupDevices:r})=>e?l(_,{text:"Loading devices..."}):r?.length?n(t,{children:[r.slice(0,10).map(e=>n(d.Box,{children:[l(d.Text,{color:"gray",children:" "}),l(D,{lastAliveTime:e.entry_detail?.watch_dog_timer?.last_alive_time}),n(d.Text,{color:"gray",children:[" ",e.name||e.device_name]}),e.device_target_name&&n(d.Text,{color:"gray",dimColor:!0,children:[" ","(",e.device_target_name,")"]})]},e._id)),r.length>10&&n(d.Text,{color:"gray",dimColor:!0,children:[" ","... and ",r.length-10," more"]})]}):l(d.Text,{color:"gray",children:" No devices in this group"}),U=({group:e,groupDevices:r,loading:t,error:i,onSelect:o,countdown:a,lastRefreshTime:c})=>t&&!e?l(_,{text:"Loading device group..."}):i?n(d.Box,{flexDirection:"column",children:[n(d.Text,{color:"red",children:["Error: ",i]}),l(S.Ay,{items:[{label:"← Back",value:"back"}],onSelect:o})]}):e?n(d.Box,{flexDirection:"column",children:[n(d.Box,{children:[l(d.Text,{bold:!0,color:"cyan",children:e.name}),l(d.Text,{color:"gray",children:" - "}),l(v,{countdown:a,lastRefreshTime:c})]}),e.description&&l(d.Text,{color:"gray",children:e.description}),n(d.Box,{marginY:1,flexDirection:"column",children:[n(d.Text,{color:"gray",children:["ID: ",e._id]}),e.tags?.length>0&&n(d.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[n(d.Text,{bold:!0,color:"white",children:["Devices (",e.devices?.length||0,")"]}),l(N,{loading:t,groupDevices:r})]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Timestamps"}),e.create_datetime&&n(d.Text,{color:"gray",children:[" Created: ",new Date(e.create_datetime).toLocaleString()]}),e.last_modify_datetime&&n(d.Text,{color:"gray",children:[" ","Modified: ",new Date(e.last_modify_datetime).toLocaleString()]})]})]}),l(S.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:o})]}):l(d.Text,{color:"red",children:"Device group not found"}),j=({boxes:e,loading:r,onSelect:t})=>{if(r)return l(_,{text:"Loading media boxes..."});if(!e?.length)return l(d.Text,{color:"yellow",children:"No media boxes found"});var i=[...e.map(e=>({label:`📦 ${e.name||"Unnamed"}`,value:e.id,box:e})),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return n(d.Box,{flexDirection:"column",children:[n(d.Text,{bold:!0,marginBottom:1,children:["Media Boxes (",e.length,")"]}),l(S.Ay,{items:i,onSelect:t})]})},$=({box:e,loading:r,error:t,onSelect:i})=>r&&!e?l(_,{text:"Loading media box..."}):t?n(d.Box,{flexDirection:"column",children:[n(d.Text,{color:"red",children:["Error: ",t]}),l(S.Ay,{items:[{label:"← Back",value:"back"}],onSelect:i})]}):e?n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&l(d.Text,{color:"gray",children:e.description}),n(d.Box,{marginY:1,flexDirection:"column",children:[n(d.Text,{color:"gray",children:["ID: ",e.id]}),e.tags?.length>0&&n(d.Text,{color:"gray",children:["Tags: ",e.tags.join(", ")]}),null!=e.size&&n(d.Text,{color:"gray",children:["Size: ",e.size]}),e.passcodes?.length>0&&n(d.Box,{flexDirection:"column",marginTop:1,children:[n(d.Text,{bold:!0,color:"white",children:["Passcodes (",e.passcodes.length,")"]}),e.passcodes.slice(0,5).map(e=>n(d.Text,{color:"gray",children:[" ",e.name||"Passcode",": ",e.code]},e.id)),e.passcodes.length>5&&n(d.Text,{color:"gray",dimColor:!0,children:[" ","... and ",e.passcodes.length-5," more"]})]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&n(d.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&n(d.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),l(S.Ay,{items:[{label:"List Files",value:"files"},{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:i})]}):l(d.Text,{color:"red",children:"Media box not found"}),G=({files:e,loading:r,onSelect:t,box:i})=>{if(r)return l(_,{text:"Loading media files..."});if(!e?.length)return l(d.Text,{color:"yellow",children:"No media files found"});var o=[...e.map(e=>{var r;return{label:`${"Image"===(r=e.fileType)?"\uD83D\uDDBC":"Video"===r?"\uD83C\uDF9E":"Audio"===r?"\uD83C\uDFB5":"\uD83D\uDCC4"} ${e.name||"Unnamed"}`,value:e.id,file:e}}),{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}];return n(d.Box,{flexDirection:"column",children:[n(d.Text,{bold:!0,marginBottom:1,children:["Media Files (",e.length,")",i?.name?` - ${i.name}`:""]}),l(S.Ay,{items:o,onSelect:t})]})},F=({file:e,loading:r,error:t,onSelect:i})=>{if(r&&!e)return l(_,{text:"Loading media file..."});if(t)return n(d.Box,{flexDirection:"column",children:[n(d.Text,{color:"red",children:["Error: ",t]}),l(S.Ay,{items:[{label:"← Back",value:"back"}],onSelect:i})]});if(!e)return l(d.Text,{color:"red",children:"Media file not found"});var o=e.meta,a=(0,f.buildScreenshotUrl)(e),c=(0,f.buildScreenshotUrl)(e,{preferThumbnail:!0}),s=!!(c&&c!==a);return n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,color:"cyan",children:e.name||"Unnamed"}),e.description&&l(d.Text,{color:"gray",children:e.description}),n(d.Box,{marginY:1,flexDirection:"column",children:[n(d.Text,{color:"gray",children:["ID: ",e.id]}),n(d.Text,{color:"gray",children:["Box ID: ",e.boxId]}),n(d.Text,{color:"gray",children:["Type: ",e.fileType]}),e.userTags?.length>0&&n(d.Text,{color:"gray",children:["Tags: ",e.userTags.join(", ")]}),o?.originalWidth!=null&&o?.originalHeight!=null&&n(d.Text,{color:"gray",children:["Size: ",o.originalWidth,"x",o.originalHeight]}),o?.originalFileSize!=null&&n(d.Text,{color:"gray",children:["File: ",(Number(o.originalFileSize)/1024).toFixed(1)," KB"]}),a&&n(d.Text,{color:"gray",children:["Original URL: ",a]}),s&&n(d.Text,{color:"gray",children:["Thumbnail URL: ",c]}),n(d.Box,{flexDirection:"column",marginTop:1,children:[l(d.Text,{bold:!0,color:"white",children:"Timestamps"}),e.createdAt&&n(d.Text,{color:"gray",children:[" Created: ",new Date(e.createdAt).toLocaleString()]}),e.updatedAt&&n(d.Text,{color:"gray",children:[" Modified: ",new Date(e.updatedAt).toLocaleString()]})]})]}),l(S.Ay,{items:[{label:"↻ Refresh",value:"refresh"},{label:"← Back",value:"back"}],onSelect:i})]})},V=i(92642),H=(e,r)=>{if(!e)return"";var t="string"==typeof e?e:JSON.stringify(e);return t.length>r?t.slice(0,r-1)+"…":t},z=({onBack:e})=>{var r=s((0,c.useState)([]),2),t=r[0],i=r[1],o=s((0,c.useState)(!0),2),u=o[0],f=o[1],m=s((0,c.useState)(null),2),g=m[0],p=m[1];return(0,c.useEffect)(()=>{var e,r=(0,h.getCurrentProfile)(),t=(0,h.getToken)(r),l=(0,h.getActivityLogBaseUrl)();if(!t){p("Not logged in. Run `bricks auth login` first."),f(!1);return}if(!l){p("Activity log URL not configured."),f(!1);return}var n=(0,V.createActivityLogClient)(l,t),o=new Date(Date.now()-36e5).toISOString(),c=new Date().toISOString(),d=new AbortController;return(e=a(function*(){try{var e=yield n.collectEvents({start_time:o,end_time:c},{limit:50,signal:d.signal});i(e)}catch(e){"AbortError"!==e.name&&p(e.message)}f(!1)}),function(){return e.apply(this,arguments)})(),()=>d.abort()},[]),n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,marginBottom:1,children:"Activity Log (last 1h)"}),u&&l(_,{text:"Fetching events..."}),g&&n(d.Text,{color:"red",children:["Error: ",g]}),!u&&!g&&0===t.length&&l(d.Text,{color:"yellow",children:"No events found in the last hour"}),!u&&t.length>0&&n(d.Box,{flexDirection:"column",marginBottom:1,children:[n(d.Text,{color:"gray",children:["Timestamp".padEnd(22)," ","Type".padEnd(12)," ","Device".padEnd(14)," ","Event Name".padEnd(24)," Sender"]}),t.map((e,r)=>n(d.Text,{children:[new Date(e.timestamp).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z").padEnd(22)," ",H(e.event_type||"",12).padEnd(12)," ",H(e.device_id||"",14).padEnd(14)," ",H(e.event_name||"",24).padEnd(24)," ",H(e.sender||"",16)]},r)),t.length>=50&&n(d.Text,{color:"yellow",children:["Showing first ",50," events"]})]}),l(S.Ay,{items:[{label:"← Back",value:"back"}],onSelect:r=>"back"===r.value&&e()})]})},Y=i(29253),q=i(44618),J=["B","C","G","D"],K=({instanceType:e,instance:r,client:t,onDone:i,onCancel:o})=>{var u,h=(0,d.useApp)().exit,f=s((0,c.useState)("select_ref"),2),m=f[0],g=f[1],p=s((0,c.useState)(""),2),x=p[0],y=p[1],v=s((0,c.useState)("search"),2),T=v[0],b=v[1],D=s((0,c.useState)(null),2),E=D[0],I=D[1],A=s((0,c.useState)(null),2),B=A[0],C=A[1],k=s((0,c.useState)(""),2),w=k[0],L=k[1],O=s((0,c.useState)(""),2),P=O[0],M=O[1],R=s((0,c.useState)(null),2),N=R[0],U=R[1],j=r?.short_edit?.ref_map||{},$=Object.entries(j).filter(([,e])=>e&&!e.hide),G=(0,q.V)(j,{keyword:x,types:J}),F=G.flatMap(e=>[{label:e.label,value:`__header_${e.prefix}__`,isHeader:!0},...e.refs.map(({shortId:e,ref:r})=>({label:`${r.title||e} (${e})`,value:e,ref:r}))]),V=[...x?[{label:"↻ Clear Search",value:"__clear_search__"}]:[],{label:"← Back",value:"__back__"}],H=F.length>0?[...F,...V]:V,z=H.findIndex(e=>!e.isHeader&&!e.value?.startsWith("__"));(0,d.useInput)((e,r)=>{r.tab&&"select_ref"===m?b(e=>"search"===e?"list":"search"):(r.escape&&("select_ref"===m&&o(),"input_path"===m&&g("select_ref"),"input_content"===m&&g("input_path"),"confirm"===m&&g("input_content"),"done"===m&&o()),"q"===e&&"input_path"!==m&&"input_content"!==m&&("select_ref"!==m||"search"!==T)&&h())},{isActive:!0});var K=(u=a(function*(){if(t&&r?._id&&E){g("submitting"),U(null);try{var l={shortId:E,path:w.trim(),content:(e=>{var r=e.trim();if(""===r)return null;try{return JSON.parse(r)}catch{return r}})(P),forwardDataLink:!0};B?.inner_ref?.pid&&(l.innerRefParentShortId=B.inner_ref.pid),"application"===e?yield t.shortEditApplication({id:r._id,list:[l]}):yield t.shortEditModule({id:r._id,list:[l]}),yield i(),g("done")}catch(e){U(e.message),g("confirm")}}}),function(){return u.apply(this,arguments)});return r?.short_edit?.enabled?0===$.length?n(d.Box,{flexDirection:"column",children:[l(d.Text,{color:"yellow",children:"No Short Edit references found."}),l(S.Ay,{items:[{label:"← Back",value:"back"}],onSelect:o})]}):"select_ref"===m?n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,children:"Short Edit References"}),l(d.Text,{color:"gray",dimColor:!0,children:"Showing: Brick, Canvas, Generator, Data"}),n(d.Box,{marginTop:1,flexDirection:"column",children:[l(d.Text,{color:"gray",children:"Search (title or shortId)"}),l(Y.A,{value:x,placeholder:"type to filter, Enter to focus list",onChange:e=>y(e),onSubmit:()=>b("list"),focus:"search"===T}),l(d.Text,{color:"gray",dimColor:!0,children:"Press Tab to switch focus"})]}),n(d.Box,{marginTop:1,children:[0===G.length&&l(d.Text,{color:"yellow",children:"No references match your search."}),l(S.Ay,{items:H,isFocused:"list"===T,initialIndex:z>-1?z:0,indicatorComponent:()=>null,itemComponent:({label:e,isSelected:r,isHeader:t})=>t?l(d.Box,{marginTop:1,children:l(d.Text,{bold:!0,color:"white",children:e})}):n(d.Text,{color:r?"blue":void 0,children:[r?"❯":" "," ",e]}),onSelect:e=>{if("__back__"===e.value)return void o();if("__clear_search__"===e.value){y(""),b("search");return}e.isHeader||(I(e.value),C(e.ref),g("input_path"))}})]})]}):"input_path"===m?n(d.Box,{flexDirection:"column",children:[n(d.Text,{children:["Reference:"," ",n(d.Text,{color:"cyan",children:[B?.title||E," (",E,")"]})]}),l(d.Text,{marginTop:1,children:"Enter property path (e.g. title, property.backgroundColor)"}),N&&n(d.Text,{color:"red",children:["Error: ",N]}),l(Y.A,{value:w,placeholder:"path",onChange:e=>{L(e),N&&U(null)},onSubmit:e=>{var r=e.trim();r?(L(r),g("input_content")):U("Path is required")},focus:!0})]}):"input_content"===m?n(d.Box,{flexDirection:"column",children:[n(d.Text,{children:["Path: ",l(d.Text,{color:"cyan",children:w})]}),l(d.Text,{marginTop:1,children:"Enter new content (JSON or plain text). Empty to clear."}),N&&n(d.Text,{color:"red",children:["Error: ",N]}),l(Y.A,{value:P,placeholder:"content",onChange:e=>{M(e),N&&U(null)},onSubmit:()=>g("confirm"),focus:!0})]}):"submitting"===m?l(_,{text:"Applying short edit..."}):"done"===m?n(d.Box,{flexDirection:"column",children:[l(d.Text,{color:"green",children:"Short edit applied successfully."}),l(S.Ay,{items:[{label:"Edit another property",value:"again"},{label:"← Back",value:"back"}],onSelect:e=>{"again"===e.value?(g("select_ref"),I(null),C(null),L(""),M(""),U(null)):o()}})]}):n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,marginBottom:1,children:"Confirm Short Edit"}),n(d.Text,{children:["Reference:"," ",n(d.Text,{color:"cyan",children:[B?.title||E," (",E,")"]})]}),n(d.Text,{children:["Path: ",l(d.Text,{color:"cyan",children:w})]}),n(d.Text,{children:["Content: ",l(d.Text,{color:"cyan",children:P||"<empty>"})]}),N&&n(d.Text,{color:"red",children:["Error: ",N]}),l(S.Ay,{items:[{label:"Apply",value:"apply"},{label:"Edit Path",value:"edit_path"},{label:"Edit Content",value:"edit_content"},{label:"← Back",value:"back"}],onSelect:e=>{"apply"===e.value&&K(),"edit_path"===e.value&&g("input_path"),"edit_content"===e.value&&g("input_content"),"back"===e.value&&o()}})]}):n(d.Box,{flexDirection:"column",children:[n(d.Text,{color:"yellow",children:["Short Edit is not enabled for this ",e,"."]}),l(S.Ay,{items:[{label:"← Back",value:"back"}],onSelect:o})]})},W=i(16928),X=i(79896),Q=i(10750),Z=i(77768),ee="options",er="output_dir",et="confirm",el="generating",en="post_install",ei="done",eo=({type:e,instance:r,client:t,onDone:i,onCancel:o})=>{var u,h=(0,d.useApp)().exit,f=s((0,c.useState)(ee),2),m=f[0],g=f[1],p=s((0,c.useState)({setupGitHubActions:!0,setupAgents:!0,setupClaudeCode:!0,setupGeminiCLI:!1,runBunInstall:!0,initGit:!0}),2),y=p[0],v=p[1],T=s((0,c.useState)(process.cwd()),2),b=T[0],_=T[1],D=s((0,c.useState)(""),2),E=D[0],I=D[1],A=s((0,c.useState)(null),2),B=A[0],C=A[1],k=s((0,c.useState)(null),2),w=k[0],L=k[1],O=Q(r?.name||"bricks-ctor"),P=W.resolve(b,O),M=(0,c.useCallback)(e=>{"back"===e.value?o():"continue"===e.value?g(er):v(r=>({...r,[e.value]:!r[e.value]}))},[o]),R=(0,c.useCallback)(()=>{X.existsSync(P)?C(`Directory already exists: ${P}`):(C(null),g(et))},[P]),N=(0,c.useCallback)((u=a(function*(l){if("back"===l.value)return void g(er);if("cancel"===l.value)return void o();if("confirm"===l.value){g(el);try{I("Fetching project from BRICKS...");var n="application"===e,i=n?t.queries.applicationProject:t.queries.moduleProject,a=(yield t.query(i,{id:r._id,buildApplicationOnly:!1,setupGitHubActions:y.setupGitHubActions,setupAgents:y.setupAgents,setupClaudeCode:y.setupClaudeCode,setupGeminiCLI:y.setupGeminiCLI}))[n?"applicationProject":"moduleProject"];if(!a?.files)throw Error("Failed to fetch project files");I("Creating project directory..."),X.mkdirSync(P,{recursive:!0}),I(`Writing ${a.files.length} files...`);var c=yield(0,Z.KN)(a.files,P);(0,Z.oz)(c),g(en);var d={path:P,files:a.files.length,bunInstalled:!1,gitInitialized:!1};Object.assign(d,(yield(0,Z.o0)(P,{install:y.runBunInstall,git:y.initGit,onStatus:I}))),L(d),g(ei)}catch(e){C(e.message),g(ee)}}}),function(e){return u.apply(this,arguments)}),[t,r,e,y,P,o]),U=(0,c.useCallback)(e=>{"exit"===e.value?h():i()},[h,i]);if(m===ee){var j=[{label:`${y.setupGitHubActions?"[x]":"[ ]"} GitHub Actions workflow`,value:"setupGitHubActions"},{label:`${y.setupAgents?"[x]":"[ ]"} AGENTS.md`,value:"setupAgents"},{label:`${y.setupClaudeCode?"[x]":"[ ]"} CLAUDE.md`,value:"setupClaudeCode"},{label:`${y.setupGeminiCLI?"[x]":"[ ]"} GEMINI.md`,value:"setupGeminiCLI"},{label:`${y.runBunInstall?"[x]":"[ ]"} Run bun install after generation`,value:"runBunInstall"},{label:`${y.initGit?"[x]":"[ ]"} Initialize git repository`,value:"initGit"},{label:"→ Continue",value:"continue"},{label:"← Back",value:"back"}];return n(d.Box,{flexDirection:"column",children:[n(d.Text,{bold:!0,color:"cyan",children:["Initialize BRICKS Project: ",r?.name||"Untitled"]}),l(d.Text,{color:"gray",marginBottom:1,children:"Select options for project generation (press Enter to toggle)"}),B&&n(d.Text,{color:"red",marginBottom:1,children:["Error: ",B]}),l(S.Ay,{items:j,onSelect:M})]})}return m===er?n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,color:"cyan",children:"Output Directory"}),l(d.Text,{color:"gray",marginBottom:1,children:"Enter the parent directory for the project:"}),B&&l(d.Text,{color:"red",marginBottom:1,children:B}),n(d.Box,{children:[l(d.Text,{children:"Directory: "}),l(Y.A,{value:b,onChange:_,onSubmit:R})]}),n(d.Text,{color:"gray",marginTop:1,children:["Project will be created at: ",P]})]}):m===et?n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,color:"cyan",children:"Confirm Project Generation"}),n(d.Box,{marginY:1,flexDirection:"column",children:[n(d.Text,{children:["Name: ",l(d.Text,{color:"green",children:r?.name||"Untitled"})]}),n(d.Text,{children:["Type: ",l(d.Text,{color:"yellow",children:e})]}),n(d.Text,{children:["Path: ",l(d.Text,{color:"cyan",children:P})]}),l(d.Text,{color:"gray",marginTop:1,children:"Options:"}),n(d.Text,{color:"gray",children:[" - GitHub Actions: ",y.setupGitHubActions?"Yes":"No"]}),n(d.Text,{color:"gray",children:[" - AGENTS.md: ",y.setupAgents?"Yes":"No"]}),n(d.Text,{color:"gray",children:[" - CLAUDE.md: ",y.setupClaudeCode?"Yes":"No"]}),n(d.Text,{color:"gray",children:[" - GEMINI.md: ",y.setupGeminiCLI?"Yes":"No"]}),n(d.Text,{color:"gray",children:[" - Run bun install: ",y.runBunInstall?"Yes":"No"]}),n(d.Text,{color:"gray",children:[" - Initialize git: ",y.initGit?"Yes":"No"]})]}),l(S.Ay,{items:[{label:"Confirm & Generate",value:"confirm"},{label:"← Change Directory",value:"back"},{label:"Cancel",value:"cancel"}],onSelect:N})]}):m===el||m===en?n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,color:"cyan",children:"Generating Project..."}),n(d.Box,{marginY:1,children:[l(d.Text,{color:"green",children:l(x.A,{type:"dots"})}),n(d.Text,{children:[" ",E]})]})]}):m===ei&&w?n(d.Box,{flexDirection:"column",children:[l(d.Text,{bold:!0,color:"green",children:"Project initialized successfully!"}),n(d.Box,{marginY:1,flexDirection:"column",children:[n(d.Text,{children:["Path: ",l(d.Text,{color:"cyan",children:w.path})]}),n(d.Text,{children:["Files: ",l(d.Text,{color:"green",children:w.files})]}),n(d.Text,{children:["Dependencies:"," ",l(d.Text,{color:w.bunInstalled?"green":"yellow",children:w.bunInstalled?"Installed":"Not installed (run bun install manually)"})]}),n(d.Text,{children:["Git:"," ",l(d.Text,{color:w.gitInitialized?"green":"yellow",children:w.gitInitialized?"Initialized":"Not initialized"})]})]}),l(d.Text,{bold:!0,marginY:1,children:"Next steps:"}),n(d.Text,{color:"gray",children:[" cd ",O]}),!w.bunInstalled&&l(d.Text,{color:"gray",children:" bun install"}),l(d.Text,{color:"gray",children:" bun invoke-simulator"}),n(d.Text,{color:"gray",marginTop:1,children:["For more information, see ",O,"/README.md"]}),l(d.Box,{marginTop:1,children:l(S.Ay,{items:[{label:"← Back to Detail",value:"back"},{label:"Exit CLI",value:"exit"}],onSelect:U})})]}):null};let ea=()=>{var e,r,t,i,o,g,p,x,v=(0,d.useApp)().exit,D=s((0,c.useState)(m.MAIN),2),S=D[0],I=D[1],A=s((0,c.useState)(null),2),N=A[0],V=A[1],H=s((0,c.useState)(null),2),Y=H[0],q=H[1],J=s((0,c.useState)(!0),2),W=J[0],X=J[1],Q=s((0,c.useState)(null),2),Z=Q[0],ee=Q[1],er=s((0,c.useState)([]),2),et=er[0],el=er[1],en=s((0,c.useState)(null),2),ei=en[0],ea=en[1],ec=s((0,c.useState)([]),2),ed=ec[0],es=ec[1],eu=s((0,c.useState)(null),2),eh=eu[0],ef=eu[1],em=s((0,c.useState)([]),2),eg=em[0],ep=em[1],ex=s((0,c.useState)(null),2),ey=ex[0],ev=ex[1],eT=s((0,c.useState)([]),2),eb=eT[0],e_=eT[1],eD=s((0,c.useState)(null),2),eS=eD[0],eE=eD[1],eI=s((0,c.useState)([]),2),eA=eI[0],eB=eI[1],eC=s((0,c.useState)(!1),2),ek=eC[0],ew=eC[1],eL=s((0,c.useState)(null),2),eO=eL[0],eP=eL[1],eM=s((0,c.useState)(null),2),eR=eM[0],eN=eM[1],eU=s((0,c.useState)(null),2),ej=eU[0],e$=eU[1],eG=s((0,c.useState)(null),2),eF=eG[0],eV=eG[1],eH=s((0,c.useState)([]),2),ez=eH[0],eY=eH[1],eq=s((0,c.useState)(null),2),eJ=eq[0],eK=eq[1],eW=s((0,c.useState)([]),2),eX=eW[0],eQ=eW[1],eZ=s((0,c.useState)(null),2),e0=eZ[0],e1=eZ[1],e2=S===m.DEVICES,e4=S===m.DEVICE_DETAIL,e6=S===m.GROUPS,e9=S===m.GROUP_DETAIL;(0,c.useEffect)(()=>{var e=(0,h.getCurrentProfile)(),r=(0,h.getToken)(e);if(!r){ee("Not logged in. Run `bricks auth login` first."),X(!1);return}var t=(0,u.createClient)((0,h.getBaseUrl)(),r);V(t),t.workspace().then(e=>{q(e),X(!1)}).catch(e=>{ee(e.message),X(!1)})},[]),(0,d.useInput)((e,r)=>{"q"===e&&v(),r.escape&&(S===m.DEVICE_CONTROL?(I(m.DEVICE_DETAIL),eP(null)):S===m.DEVICE_SCREENSHOT?(I(m.DEVICE_DETAIL),e$(null),eV(null)):S===m.DEVICE_DETAIL?(I(m.DEVICES),ea(null)):S===m.APP_DETAIL?(I(m.APPS),ef(null)):S===m.MODULE_DETAIL?(I(m.MODULES),ev(null)):S===m.GROUP_DETAIL?(I(m.GROUPS),eE(null),eB([])):S===m.MEDIA_FILE_DETAIL?(I(m.MEDIA_FILES),e1(null)):S===m.MEDIA_FILES?(I(m.MEDIA_BOX_DETAIL),e1(null)):S===m.MEDIA_BOX_DETAIL?(I(m.MEDIA_BOXES),eK(null),eQ([])):S===m.MEDIA_BOXES?I(m.MAIN):S!==m.MAIN&&I(m.MAIN))},{isActive:S!==m.APP_SHORT_EDIT&&S!==m.MODULE_SHORT_EDIT&&S!==m.APP_PROJECT_INIT&&S!==m.MODULE_PROJECT_INIT});var e5=(0,c.useCallback)(a(function*(){if(N){X(!0);try{var e=yield N.devices({});el(e||[])}catch(e){ee(e.message)}X(!1)}}),[N]),e7=(0,c.useCallback)((e=a(function*(e){if(N){X(!0),eN(null);try{var r=yield N.device({id:e});ea(r)}catch(e){eN(e.message)}X(!1)}}),function(r){return e.apply(this,arguments)}),[N]),e8=(0,c.useCallback)(a(function*(){if(N){X(!0);try{var e=yield N.applications({});es(e||[])}catch(e){ee(e.message)}X(!1)}}),[N]),e3=(0,c.useCallback)((r=a(function*(e){if(N){X(!0),eN(null);try{var r=yield N.application({id:e});ef(r)}catch(e){eN(e.message)}X(!1)}}),function(e){return r.apply(this,arguments)}),[N]),re=(0,c.useCallback)(a(function*(){if(N){X(!0);try{var e=yield N.modules({});ep(e||[])}catch(e){ee(e.message)}X(!1)}}),[N]),rr=(0,c.useCallback)((t=a(function*(e){if(N){X(!0),eN(null);try{var r=yield N.module({id:e});ev(r)}catch(e){eN(e.message)}X(!1)}}),function(e){return t.apply(this,arguments)}),[N]),rt=(0,c.useCallback)(a(function*(){if(N){X(!0);try{var e=yield N.deviceGroups({});e_(e||[])}catch(e){ee(e.message)}X(!1)}}),[N]),rl=(0,c.useCallback)((i=a(function*(e){if(N){X(!0),eN(null);try{var r=yield Promise.all([N.deviceGroup({id:e}),N.devicesByGroup({id:e})]),t=s(r,2),l=t[0],n=t[1];eE(l),eB(n||[])}catch(e){eN(e.message)}X(!1)}}),function(e){return i.apply(this,arguments)}),[N]),rn=(0,c.useCallback)(a(function*(){if(N){X(!0);try{var e=yield N.mediaBoxes();eY(e||[])}catch(e){ee(e.message)}X(!1)}}),[N]),ri=(0,c.useCallback)((o=a(function*(e){if(N){X(!0),eN(null);try{var r=yield N.mediaBox({id:e});eK(r)}catch(e){eN(e.message)}X(!1)}}),function(e){return o.apply(this,arguments)}),[N]),ro=(0,c.useCallback)((g=a(function*(e){if(N){X(!0);try{var r=yield N.mediaFiles({boxId:e});eQ(r||[])}catch(e){ee(e.message)}X(!1)}}),function(e){return g.apply(this,arguments)}),[N]),ra=(0,c.useCallback)((p=a(function*(e){if(N){X(!0),eN(null);try{var r=yield N.mediaFile({id:e});e1(r)}catch(e){eN(e.message)}X(!1)}}),function(e){return p.apply(this,arguments)}),[N]),rc=(0,c.useCallback)((x=a(function*(e){if(N&&ei){ew(!0),eP(null);try{yield N.controlDevice({id:ei._id,type:e}),eP({success:!0,message:`Command sent: ${e}`})}catch(e){eP({success:!1,message:e.message})}ew(!1)}}),function(e){return x.apply(this,arguments)}),[N,ei]),rd=(0,c.useCallback)(a(function*(e=!1){if(N&&ei&&Y){X(!0),eV(null),e$(null);try{e&&(yield N.controlDevice({id:ei._id,type:"take-screenshot"}),yield new Promise(e=>setTimeout(e,3e3)));var r=yield(0,f.fetchAndSaveScreenshot)(N,Y,ei._id,null,{preferThumbnail:!0});r.error?eV(r.error):e$(r)}catch(e){eV(e.message)}X(!1)}}),[N,ei,Y]),rs=y((0,c.useCallback)(()=>{N&&e5()},[N,e5]),e2),ru=y((0,c.useCallback)(()=>{N&&ei&&e7(ei._id)},[N,ei,e7]),e4),rh=y((0,c.useCallback)(()=>{N&&rt()},[N,rt]),e6),rf=y((0,c.useCallback)(()=>{N&&eS&&rl(eS._id)},[N,eS,rl]),e9);return W&&!Y?n(d.Box,{flexDirection:"column",children:[l(T,{workspace:Y,view:S}),l(_,{text:"Connecting to workspace..."})]}):Z&&!Y?n(d.Box,{flexDirection:"column",children:[l(T,{workspace:Y,view:S}),n(d.Text,{color:"red",children:["Error: ",Z]}),l(b,{})]}):n(d.Box,{flexDirection:"column",children:[l(T,{workspace:Y,view:S}),S===m.MAIN&&l(E,{onSelect:e=>{"exit"===e.value?v():(I(e.value),e.value===m.DEVICES?e5():e.value===m.APPS?e8():e.value===m.MODULES?re():e.value===m.GROUPS?rt():e.value===m.MEDIA_BOXES&&rn())},mediaEnabled:(0,f.isMediaEnabled)(Y),activityLogEnabled:!!(0,h.getActivityLogBaseUrl)()}),S===m.DEVICES&&l(B,{devices:et,loading:W,onSelect:e=>{if("back"===e.value)return void I(m.MAIN);if("refresh"===e.value){e5(),rs.resetCountdown();return}ea(null),X(!0),I(m.DEVICE_DETAIL),e7(e.value)},countdown:rs.countdown,lastRefreshTime:rs.lastRefreshTime}),S===m.DEVICE_DETAIL&&l(C,{device:ei,loading:W,error:eR,onSelect:e=>{if("back"===e.value){I(m.DEVICES),ea(null);return}if("refresh"===e.value){e7(ei._id),ru.resetCountdown();return}"control"===e.value&&(I(m.DEVICE_CONTROL),eP(null)),"screenshot"===e.value&&(I(m.DEVICE_SCREENSHOT),e$(null),eV(null),rd(!1))},mediaEnabled:(0,f.isMediaEnabled)(Y),countdown:ru.countdown,lastRefreshTime:ru.lastRefreshTime}),S===m.DEVICE_CONTROL&&l(k,{device:ei,onSelect:e=>{if("back"===e.value){I(m.DEVICE_DETAIL),eP(null);return}rc(e.value)},controlling:ek,controlResult:eO}),S===m.DEVICE_SCREENSHOT&&l(w,{device:ei,screenshot:ej,loading:W,error:eF,onSelect:e=>{if("back"===e.value){I(m.DEVICE_DETAIL),e$(null),eV(null);return}"refresh"===e.value?rd(!1):"take"===e.value&&rd(!0)}}),S===m.APPS&&l(L,{apps:ed,loading:W,onSelect:e=>{"back"===e.value?I(m.MAIN):"refresh"===e.value?e8():(ef(null),X(!0),I(m.APP_DETAIL),e3(e.value))}}),S===m.APP_DETAIL&&l(O,{app:eh,loading:W,error:eR,onSelect:e=>{if("back"===e.value){I(m.APPS),ef(null);return}"refresh"===e.value?e3(eh._id):("short_edit"===e.value&&(I(m.APP_SHORT_EDIT),eN(null)),"project_init"===e.value&&(I(m.APP_PROJECT_INIT),eN(null)))}}),S===m.APP_SHORT_EDIT&&l(K,{instanceType:"application",instance:eh,client:N,onDone:a(function*(){return e3(eh._id)}),onCancel:()=>I(m.APP_DETAIL)}),S===m.APP_PROJECT_INIT&&l(eo,{type:"application",instance:eh,client:N,onDone:()=>I(m.APP_DETAIL),onCancel:()=>I(m.APP_DETAIL)}),S===m.MODULES&&l(P,{modules:eg,loading:W,onSelect:e=>{"back"===e.value?I(m.MAIN):"refresh"===e.value?re():(ev(null),X(!0),I(m.MODULE_DETAIL),rr(e.value))}}),S===m.MODULE_DETAIL&&l(M,{module:ey,loading:W,error:eR,onSelect:e=>{if("back"===e.value){I(m.MODULES),ev(null);return}"refresh"===e.value?rr(ey._id):("short_edit"===e.value&&(I(m.MODULE_SHORT_EDIT),eN(null)),"project_init"===e.value&&(I(m.MODULE_PROJECT_INIT),eN(null)))}}),S===m.MODULE_SHORT_EDIT&&l(K,{instanceType:"module",instance:ey,client:N,onDone:a(function*(){return rr(ey._id)}),onCancel:()=>I(m.MODULE_DETAIL)}),S===m.MODULE_PROJECT_INIT&&l(eo,{type:"module",instance:ey,client:N,onDone:()=>I(m.MODULE_DETAIL),onCancel:()=>I(m.MODULE_DETAIL)}),S===m.GROUPS&&l(R,{groups:eb,loading:W,onSelect:e=>{if("back"===e.value)return void I(m.MAIN);if("refresh"===e.value){rt(),rh.resetCountdown();return}eE(null),eB([]),X(!0),I(m.GROUP_DETAIL),rl(e.value)},countdown:rh.countdown,lastRefreshTime:rh.lastRefreshTime}),S===m.GROUP_DETAIL&&l(U,{group:eS,groupDevices:eA,loading:W,error:eR,onSelect:e=>{if("back"===e.value){I(m.GROUPS),eE(null),eB([]);return}"refresh"===e.value&&(rl(eS._id),rf.resetCountdown())},countdown:rf.countdown,lastRefreshTime:rf.lastRefreshTime}),S===m.ACTIVITY_LOG&&l(z,{onBack:()=>I(m.MAIN)}),S===m.MEDIA_BOXES&&l(j,{boxes:ez,loading:W,onSelect:e=>{"back"===e.value?I(m.MAIN):"refresh"===e.value?rn():(eK(null),eQ([]),X(!0),I(m.MEDIA_BOX_DETAIL),ri(e.value))}}),S===m.MEDIA_BOX_DETAIL&&l($,{box:eJ,loading:W,error:eR,onSelect:e=>{if("back"===e.value){I(m.MEDIA_BOXES),eK(null),eQ([]);return}"refresh"===e.value?ri(eJ.id):"files"===e.value&&(eQ([]),e1(null),I(m.MEDIA_FILES),ro(eJ.id))}}),S===m.MEDIA_FILES&&l(G,{files:eX,box:eJ,loading:W,onSelect:e=>{if("back"===e.value){I(m.MEDIA_BOX_DETAIL),e1(null);return}"refresh"===e.value?ro(eJ.id):(e1(null),X(!0),I(m.MEDIA_FILE_DETAIL),ra(e.value))}}),S===m.MEDIA_FILE_DETAIL&&l(F,{file:e0,loading:W,error:eR,onSelect:e=>{if("back"===e.value){I(m.MEDIA_FILES),e1(null);return}"refresh"===e.value&&ra(e0.id)}}),l(b,{})]})};var ec="1"===process.env.BRICKS_CLI_DISTRIBUTION,ed=(o=a(function*(){if(ec)return void(0,d.render)(l(ea,{}));var e=(yield i.e(8166).then(i.bind(i,29557))).TerminalInfoProvider;(0,d.render)(l(e,{children:l(ea,{})}))}),function(){return o.apply(this,arguments)})},92642(e,r,t){t.r(r),t.d(r,{ActivityLogClient:()=>_,createActivityLogClient:()=>D});var l,n,i,o=t(99436),a=t(5018),c=t(44668),d=t(4275),s=t(32235),u=t(62192),h=t(79657),f=t(64007);function m(e){var r,t,l,n=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,l=Symbol.iterator);n--;){if(t&&null!=(r=e[t]))return r.call(e);if(l&&null!=(r=e[l]))return new g(r.call(e));t="@@asyncIterator",l="@@iterator"}throw TypeError("Object is not async iterable")}function g(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(g=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new g(e)}function*p(e){if(e.errors?.length)throw Error(e.errors.map(e=>e.message).join("\n"));if(e.data){for(var r of Object.values(e.data))if(Array.isArray(r))for(var t of r)yield t}if(Array.isArray(e.incremental)){for(var l of e.incremental)if(Array.isArray(l.items))for(var n of l.items)yield n}}function x(){return(x=d(function*(e){var r=e.headers.get("content-type")||"";if(r.includes("application/json")){var t=yield s(e.json());if(t.errors?.length)throw Error(t.errors.map(e=>e.message).join("\n"));var l=Object.keys(t.data||{})[0];if(l&&Array.isArray(t.data[l]))for(var n of t.data[l])yield n;return}var i=r.match(/boundary="?([^";]+)"?/),o=i?i[1]:"-",a=`--${o}`,c="",d=!1,h=new TextDecoder,f=e=>{for(var r=0;-1!==(r=e.indexOf(a,r));){if(0===r||"\n"===e[r-1])return r;r+=a.length}return -1},g=function*(){for(var e;-1!==(e=f(c));){var r=c.slice(0,e);(c=c.slice(e+a.length)).startsWith("\r\n")?c=c.slice(2):c.startsWith("\n")&&(c=c.slice(1));var t=r.indexOf("\r\n\r\n"),l=-1!==t?r.slice(t+4).trim():r.trim();if(l){var n=void 0;try{n=JSON.parse(l)}catch{continue}if(yield*p(n),!1===n.hasNext){d=!0;return}}}};try{var x=!1,y=!1;try{for(var v,T,b=m(e.body);x=!(T=yield s(b.next())).done;x=!1){var _=T.value;if(c+=h.decode(_,{stream:!0}),yield*u(m(g()),s),d)break}}catch(e){y=!0,v=e}finally{try{x&&null!=b.return&&(yield s(b.return()))}finally{if(y)throw v}}}catch(e){if(!e.message?.includes("Premature close")||!d)throw e}if(!d&&c.trim()){var D,S=c.indexOf("\r\n\r\n"),E=-1!==S?c.slice(S+4).trim():c.trim();if(E&&!E.startsWith("--")){try{D=JSON.parse(E)}catch{}D&&(yield*u(m(p(D)),s),!1===D.hasNext&&(d=!0))}}e.body?.destroy()})).apply(this,arguments)}var y=`
2
+ query AL_events($filter: EventsFilter!) {
3
+ events(filter: $filter) @stream {
4
+ device_id
5
+ event_type
6
+ event_name
7
+ subspace_id
8
+ sender
9
+ payload
10
+ timestamp
11
+ }
12
+ }
13
+ `,v=`
14
+ query AL_screenshots($filter: ScreenshotFilter!) {
15
+ screenshots(filter: $filter) @stream {
16
+ timestamp
17
+ }
18
+ }
19
+ `;function T(e){var r,t,l,n=2;for("u">typeof Symbol&&(t=Symbol.asyncIterator,l=Symbol.iterator);n--;){if(t&&null!=(r=e[t]))return r.call(e);if(l&&null!=(r=e[l]))return new b(r.call(e));t="@@asyncIterator",l="@@iterator"}throw TypeError("Object is not async iterable")}function b(e){function r(e){if(Object(e)!==e)return Promise.reject(TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:r}})}return(b=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return r(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):r(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):r(t.apply(this.s,arguments))}},new b(e)}var _=c(function e(r,t){a(this,e),this.baseUrl=r,this.token=t,this.graphqlUrl=`${r}/api/graphql`,this.fetch=function(e){var r=process.env.HTTPS_PROXY||process.env.https_proxy;if(!r||!e.startsWith("https://"))return h.Ay;var t=new f(r);return(e,r={})=>(0,h.Ay)(e,{...r,agent:t})}(r)},[{key:"streamQuery",value:function(e,r){var t=this;return d(function*(e,r,{signal:l}={}){var n=yield s(t.fetch(t.graphqlUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.token}`,Accept:'multipart/mixed; boundary="-", application/json'},body:JSON.stringify({query:e,variables:r}),signal:l}));if(!n.ok){var i=yield s(n.text().catch(()=>""));throw Error(`Activity-log query failed (${n.status}): ${i}`)}yield*u(T(function(e){return x.apply(this,arguments)}(n)),s)}).apply(this,arguments)}},{key:"events",value:function(e,r){var t=this;return d(function*(){yield*u(T(t.streamQuery(y,{filter:e},r)),s)})()}},{key:"screenshots",value:function(e,r){var t=this;return d(function*(){yield*u(T(t.streamQuery(v,{filter:e},r)),s)})()}},{key:"collectEvents",value:(l=o(function*(e,{limit:r,signal:t}={}){var l=[],n=!1,i=!1;try{for(var o,a,c=T(this.events(e,{signal:t}));n=!(a=yield c.next()).done;n=!1){var d=a.value;if(l.push(d),r&&l.length>=r)break}}catch(e){i=!0,o=e}finally{try{n&&null!=c.return&&(yield c.return())}finally{if(i)throw o}}return l}),function(e){return l.apply(this,arguments)})},{key:"collectScreenshots",value:(n=o(function*(e,{signal:r}={}){var t=[],l=!1,n=!1;try{for(var i,o,a=T(this.screenshots(e,{signal:r}));l=!(o=yield a.next()).done;l=!1){var c=o.value;t.push(c)}}catch(e){n=!0,i=e}finally{try{l&&null!=a.return&&(yield a.return())}finally{if(n)throw i}}return t}),function(e){return n.apply(this,arguments)})},{key:"downloadScreenshot",value:(i=o(function*(e,r,t,{signal:l}={}){var n=`${this.baseUrl}/api/v1/${encodeURIComponent(e)}/${encodeURIComponent(r)}/screenshot?ts=${encodeURIComponent(t)}`,i=yield this.fetch(n,{headers:{Authorization:`Bearer ${this.token}`},signal:l});if(!i.ok){var o=yield i.text().catch(()=>"");throw Error(`Screenshot fetch failed (${i.status}): ${o}`)}return Buffer.from((yield i.arrayBuffer()))}),function(e,r,t){return i.apply(this,arguments)})}]),D=(e,r)=>new _(e,r)},77768(e,r,t){t.d(r,{BZ:()=>v,KN:()=>p,kU:()=>g,o0:()=>y,oz:()=>x});var l,n,i,o,a=t(99436),c=t(16928),d=t(79896),s=t(35317),u=t(10750),h=e=>{try{return(0,s.execSync)(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}},f=(e,r,t)=>new Promise((l,n)=>{var i=[e,...r].join(" "),o=(0,s.spawn)(i,[],{cwd:t,stdio:"pipe",shell:!0}),a=[];o.stderr.on("data",e=>a.push(e)),o.on("close",e=>{0===e?l():n(Error(Buffer.concat(a).toString().trim()||`Command failed with code ${e}`))}),o.on("error",n)}),m=(l=a(function*(e,r){try{var l=(yield t.e(7456).then(t.bind(t,79491))).format;return(yield l(r,e,{trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100})).code}catch{}return e}),function(e,r){return l.apply(this,arguments)}),g=(e=[])=>{var r=e.find(e=>"application.json"===e.name);if(!r)return"bricks-ctor";try{var t=JSON.parse(r.input);return u(t.name||"bricks-ctor")}catch{return"bricks-ctor"}},p=(n=a(function*(e,r){var t;return Promise.all(e.map((t=a(function*(e){var t=c.join(r,e.name),l=e.input;return e.formatable&&(l=yield m(l,t)),{...e,filePath:t,content:l}}),function(e){return t.apply(this,arguments)})))}),function(e,r){return n.apply(this,arguments)}),x=e=>{e.forEach(e=>{d.mkdirSync(c.dirname(e.filePath),{recursive:!0}),d.writeFileSync(e.filePath,e.content)})},y=(i=a(function*(e,r={}){var t="function"==typeof r.onStatus?r.onStatus:()=>{},l=!1,n=!1;if(!1!==r.install&&h("bun")){t("Installing dependencies (bun install)...");try{yield f("bun",["install"],e),l=!0}catch{}}if(!1!==r.git&&h("git")){t("Initializing git repository...");try{yield f("git",["init"],e),yield f("git",["add","."],e),yield f("git",["-c 'user.name=BRICKS CLI'","-c 'user.email=cli@bricks.tools'","commit","-m 'chore: initialize commit'"],e),n=!0}catch{}}return{bunInstalled:l,gitInitialized:n}}),function(e){return i.apply(this,arguments)}),v=(o=a(function*(e,r,t){var l=t.client,n=t.output,i=t.outputAsTarget;if(!l)throw Error("client is required");if(!n)throw Error("output directory is required");var o=(e=>{for(var r=c.resolve(e);;){if(d.existsSync(c.join(r,"application.json"))||d.existsSync(c.join(r,"module.json")))return r;var t=c.dirname(r);if(t===r)return null;r=t}})(i?c.dirname(c.resolve(n)):n);if(o)throw Error(`Cannot initialize a new BRICKS project inside an existing project (${o}). Choose a directory outside the project.`);var a="application"===e?l.applicationProject:l.moduleProject,s=yield a({id:r,buildApplicationOnly:!1,setupGitHubActions:!1!==t.githubActions,setupAgents:!1!==t.agents,setupClaudeCode:!1!==t.claude,setupGeminiCLI:!0===t.gemini});if(!s?.files)throw Error(`${e} project not found`);var u=g(s.files),h=i?c.resolve(n):c.resolve(n,u);if(d.existsSync(h))throw Error(`Directory already exists: ${h}`);d.mkdirSync(h,{recursive:!0}),x((yield p(s.files,h)));var f=yield y(h,t),m=f.bunInstalled,v=f.gitInitialized;return{success:!0,path:h,files:s.files.length,bunInstalled:m,gitInitialized:v}}),function(e,r,t){return o.apply(this,arguments)})},60450(e,r,t){t.r(r),t.d(r,{buildScreenshotUrl:()=>m,downloadScreenshot:()=>g,fetchAndSaveScreenshot:()=>p,getDeviceScreenshot:()=>f,getSystemMediaBoxId:()=>h,isMediaEnabled:()=>u});var l,n,i,o=t(99436),a=t(79657),c=t(73024),d=t(76760),s=t(48161),u=e=>e?.media_resource?.enable_media_workspace===!0,h=e=>u(e)&&e.media_resource?.system_media_box_id||null,f=(l=o(function*(e,r,t){var l=yield e.mediaFiles({boxId:r,userTags:[`bricks_screenshot_${t}`],limit:1});return l?.[0]||null}),function(e,r,t){return l.apply(this,arguments)}),m=(e,{preferThumbnail:r=!1}={})=>{if(!e?.meta?.storageEndpoint)return null;var t=e.meta,l=t.storageEndpoint,n=t.originalFileKey,i=(r?(e=>{var r=e?.meta;if(!r)return null;if("Video"===e.fileType&&r.videoThumbOriginalFileKey)return r.videoThumbOriginalFileKey;var t=r.imageVersions||[];if(!Array.isArray(t)||0===t.length)return null;var l=t.filter(e=>e?.strategy==="BOUNDED"&&"number"==typeof e.width).sort((e,r)=>e.width-r.width);return(l[0]||t[0])?.key||null})(e):null)||n;return i?`${l}/${i}`:null},g=(n=o(function*(e,r=null){var t=yield(0,a.Ay)(e);if(!t.ok)throw Error(`Failed to download screenshot: ${t.statusText}`);var l=yield t.buffer(),n=r||d.join(s.tmpdir(),`bricks-screenshot-${Date.now()}.png`),i=d.dirname(n);return c.existsSync(i)||c.mkdirSync(i,{recursive:!0}),c.writeFileSync(n,l),n}),function(e){return n.apply(this,arguments)}),p=(i=o(function*(e,r,t,l=null,n={}){var i=h(r);if(!i)return{error:"Media workspace not enabled for this workspace"};var o=yield f(e,i,t);if(!o)return{error:"No screenshot available for this device"};var a=m(o,n);return a?{path:yield g(a,l),file:o,url:a}:{error:"Could not build screenshot URL"}}),function(e,r,t){return i.apply(this,arguments)})}};