/*! For license information please see server-ui-1.0.0.js.LICENSE.txt */
import{InvalidArgumentError as r,InvalidArgumentErrorType as e}from"@minecraft/common";import*as t from"@minecraft/server-ui-bindings";var n={283(t,n,o){o.d(n,{p:()=>s});var a,i=function(r,e,t,n){if("a"===t&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?n:"a"===t?n.call(r):n?n.value:e.get(r)};class s{constructor(){a.set(this,Symbol()),this.coreToProxyConstructor=new Map,this.proxyToGetInner=new Map}registerProxy(r,e){this.coreToProxyConstructor.set(r,e.prototype.constructor),this.proxyToGetInner.set(e,e.prototype.getInner)}wrapError(r,e){try{return r()}catch(r){throw this.wrapCore(r,{name:"Error",is_error:!0},e)}}wrapCore(r,e,t){if(e.closure_type)return(...n)=>{const o=[];let a=0;for(const r of n)o.push(this.unwrapCore(r,e.closure_type.argument_types[a],`${t} closure`,a)),a++;try{return this.wrapCore(r(...o),e.closure_type.return_type,`${t} closure`)}catch(r){throw this.wrapCore(r,{name:"Error",is_error:!0},`${t} closure`)}};if(e.array_type){if(!Array.isArray(r))throw new Error(`Invalid type passed out of ${t}. Was expecting an array.`);let n=0;const o=[];for(const a of r)o[n++]=this.wrapCore(a,e.array_type,t);return o}if(e.is_external_enum){if("string"!=typeof r&&"number"!=typeof r)throw new Error(`Invalid type passed out of ${t}. Was expecting a string or number enum value.`);return r}if(e.is_internal_enum){if(-1===e.enum_values?.indexOf(r))throw new Error(`Invalid data passed out of ${t}. Received ${JSON.stringify(r)}, but expected one of [${e.enum_values?.join(",")}]`);return r}if(!(r instanceof Object))return r;if(!r.constructor.name)return r;const n=this.coreToProxyConstructor.get(r.constructor);return n?new n(r,i(this,a,"f")):r}unwrapCore(t,n,o,s){if("void"!==n.name){if(n.array_type){if(!Array.isArray(t))throw new r(o,"array",e.InvalidType,s);let a=0;const i=[];for(const r of t)i[a++]=this.unwrapCore(r,n.array_type,o,s);return i}if(n.is_external_enum){if("string"!=typeof t&&"number"!=typeof t)throw new r(o,n.name,e.InvalidType,s);return t}if(n.is_internal_enum){if(-1===n.enum_values?.indexOf(t))throw new r(o,n.name,e.InvalidType,s);return t}if(n.is_type){if(n.type_alias)return this.unwrapCore(t,n.type_alias,o,s);throw new r(o,n.name,e.InvalidType,s)}if(n.variant_types&&n.variant_types.length>0){const a=n.variant_types.map(r=>r.name);for(const r of n.variant_types)try{return this.unwrapCore(t,r,o,s)}catch{}throw new r(o,`variant of [ ${a.join(" | ")} ]`,e.InvalidType,s)}if("string"===n.name||"number"===n.name||"boolean"===n.name){if(typeof t!==n.name)throw new r(o,n.name,e.InvalidType,s);return t}if(n.optional_type)return t?this.unwrapCore(t,n.optional_type,o,s):t;if(n.class_type&&!(t instanceof n.class_type))throw new r(o,n.name,e.InvalidType,s);if(n.interface_data){if("object"!=typeof t||void 0===t)throw new r(o,n.name,e.InvalidType,s);const a=t,i={};for(const t of n.interface_data().properties)if(t.name in a)i[t.name]=this.unwrapCore(a[t.name],t.type,o,s);else if(void 0===t.type.optional_type)throw new r(o,n.name,e.Empty,s);return i}if(n.closure_type)return(...r)=>{const e=[];let a=0;for(const t of r)e.push(this.wrapCore(t,n.closure_type.argument_types[a],`${o} returned closure`)),a++;try{return this.unwrapCore(t(...e),n.closure_type.return_type,`${o} closure`)}catch(r){throw this.unwrapCore(r,{name:"Error",is_error:!0},`${o} closure`)}};if(n.is_generic_instance||n.class_type||"unknown"===n.name||n.is_error){if(!(t instanceof Object))return t;const r=this.proxyToGetInner.get(t.constructor);return r?r.call(t,i(this,a,"f")):t}throw new r(o,n.name,e.Unknown,s)}}}a=new WeakMap},934(r,e,t){t.r(e);var n=t(435),o={};for(const r in n)"default"!==r&&(o[r]=()=>n[r]);t.d(e,o)},435(r){r.exports=t}},o={};function a(r){var e=o[r];if(void 0!==e)return e.exports;var t=o[r]={exports:{}};return n[r](t,t.exports,a),t.exports}a.d=(r,e)=>{for(var t in e)a.o(e,t)&&!a.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},a.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),a.r=r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var i={};a.r(i);var s=a(283),p=a(934),u={};for(const r in p)"default"!==r&&(u[r]=()=>p[r]);a.d(i,u),new s.p;export*from"@minecraft/server-ui-bindings";