/*! For license information please see server-ui-0.1.0.js.LICENSE.txt */
import*as e from"@minecraft/server-ui-bindings";var r={d:(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)},t={};r.d(t,{W_:()=>n.ActionFormData,S_:()=>n.ActionFormResponse,KB:()=>n.FormResponse,Hk:()=>n.MessageFormData,zS:()=>n.MessageFormResponse,yX:()=>n.ModalFormData,FK:()=>n.ModalFormResponse});var o,a=function(e,r,t,o){if("a"===t&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof r?e!==r||!o:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?o:"a"===t?o.call(e):o?o.value:r.get(e)};o=new WeakMap;const n=(s={ActionFormData:()=>e.ActionFormData,ActionFormResponse:()=>e.ActionFormResponse,FormResponse:()=>e.FormResponse,MessageFormData:()=>e.MessageFormData,MessageFormResponse:()=>e.MessageFormResponse,ModalFormData:()=>e.ModalFormData,ModalFormResponse:()=>e.ModalFormResponse},i={},r.d(i,s),i);var s,i;new class{constructor(){o.set(this,Symbol()),this.coreToProxyConstructor=new Map,this.proxyToGetInner=new Map}registerProxy(e,r){this.coreToProxyConstructor.set(e,r.prototype.constructor),this.proxyToGetInner.set(r,r.prototype.getInner)}wrapCore(e,r,t){if(r.closure_type)return(...o)=>{const a=[];let n=0;for(const e of o)a.push(this.unwrapCore(e,r.closure_type.argument_types[n],`${t} closure`,n)),n++;return this.wrapCore(e(...a),r.closure_type.return_type,`${t} closure`)};if(r.array_type){if(!Array.isArray(e))throw new Error(`Invalid type passed out of ${t}. Was expecting an array.`);let o=0;const a=[];for(const n of e)a[o++]=this.wrapCore(n,r.array_type,t);return a}if(!(e instanceof Object))return e;if(!e.constructor.name)return e;const n=this.coreToProxyConstructor.get(e.constructor);return n?new n(e,a(this,o,"f")):e}unwrapCore(e,r,t,n){if("void"!==r.name){if(r.array_type){if(!Array.isArray(e))throw new Error(`Invalid type passed into ${t}${void 0!==n?` for argument ${n}`:""}. Was expecting an array.`);let o=0;const a=[];for(const s of e)a[o++]=this.unwrapCore(s,r.array_type,t,n);return a}if(r.is_type){if(r.type_alias)return this.unwrapCore(e,r.type_alias,t,n);throw new Error(`Invalid type passed into ${t}${void 0!==n?` for argument ${n}`:""}. Was expecting a ${r.name}.`)}if(r.variant_types&&r.variant_types.length>0){const o=r.variant_types.map((e=>e.name));for(const o of r.variant_types)try{return this.unwrapCore(e,o,t,n)}catch{}throw new Error(`Invalid type passed into ${t}${void 0!==n?` for argument ${n}`:""}. Was expecting a variant of [ ${o.join(" | ")} ].`)}if("string"===r.name||"number"===r.name||"boolean"===r.name){if(typeof e!==r.name)throw new Error(`Invalid type passed into ${t}${void 0!==n?` for argument ${n}`:""}. Was expecting a ${r.name}.`);return e}if(r.optional_type)return e?this.unwrapCore(e,r.optional_type,t,n):e;if(r.class_type&&!(e instanceof r.class_type))throw new Error(`Invalid type passed into ${t}${void 0!==n?` for argument ${n}`:""}. Was expecting a ${r.name}.`);if(r.interface_data){if("object"!=typeof e||void 0===e)throw new Error(`Invalid type passed into ${t}${void 0!==n?` for argument ${n}`:""}. Was expecting a ${r.name}.`);const o=e,a={};for(const e of r.interface_data.properties)if(e.name in o)a[e.name]=this.unwrapCore(o[e.name],e.type,t,n);else if(void 0===e.type.optional_type)throw new Error(`Invalid type passed into ${t}${void 0!==n?` for argument ${n}`:""}. Was expecting a ${r.name} but object is missing property ${e.name}.`);return a}if(r.closure_type)return(...o)=>{const a=[];let n=0;for(const e of o)a.push(this.wrapCore(e,r.closure_type.argument_types[n],`${t} returned closure`)),n++;return this.unwrapCore(e(...a),r.closure_type.return_type,`${t} closure`)};if(r.is_generic_instance||r.class_type){if(!(e instanceof Object))return e;const r=this.proxyToGetInner.get(e.constructor);return r?r.call(e,a(this,o,"f")):e}throw new Error(`Unexpected type ${r.name} for ${t}${void 0!==n?` argument ${n}`:""}.`)}}};var p=t.W_,c=t.S_,y=t.KB,m=t.Hk,u=t.zS,f=t.yX,l=t.FK;export{p as ActionFormData,c as ActionFormResponse,y as FormResponse,m as MessageFormData,u as MessageFormResponse,f as ModalFormData,l as ModalFormResponse};