| /*! For license information please see server-ui-0.1.0.js.LICENSE.txt */ | |
| import*as r from"@minecraft/common";import*as e from"@minecraft/server-ui-bindings";var t={d:(r,e)=>{for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},n={};t.d(n,{W_:()=>u.ActionFormData,S_:()=>u.ActionFormResponse,KB:()=>u.FormResponse,Hk:()=>u.MessageFormData,zS:()=>u.MessageFormResponse,yX:()=>u.ModalFormData,FK:()=>u.ModalFormResponse});const o=(a={InvalidArgumentError:()=>r.InvalidArgumentError,InvalidArgumentErrorType:()=>r.InvalidArgumentErrorType},s={},t.d(s,a),s);var a,s,i,p=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)};i=new WeakMap;const u=(r=>{var e={};return t.d(e,r),e})({ActionFormData:()=>e.ActionFormData,ActionFormResponse:()=>e.ActionFormResponse,FormResponse:()=>e.FormResponse,MessageFormData:()=>e.MessageFormData,MessageFormResponse:()=>e.MessageFormResponse,ModalFormData:()=>e.ModalFormData,ModalFormResponse:()=>e.ModalFormResponse});new class{constructor(){i.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,p(this,i,"f")):r}unwrapCore(r,e,t,n){if("void"!==e.name){if(e.array_type){if(!Array.isArray(r))throw new o.InvalidArgumentError(t,"array",o.InvalidArgumentErrorType.InvalidType,n);let a=0;const s=[];for(const o of r)s[a++]=this.unwrapCore(o,e.array_type,t,n);return s}if(e.is_external_enum){if("string"!=typeof r&&"number"!=typeof r)throw new o.InvalidArgumentError(t,e.name,o.InvalidArgumentErrorType.InvalidType,n);return r}if(e.is_internal_enum){if(-1===e.enum_values?.indexOf(r))throw new o.InvalidArgumentError(t,e.name,o.InvalidArgumentErrorType.InvalidType,n);return r}if(e.is_type){if(e.type_alias)return this.unwrapCore(r,e.type_alias,t,n);throw new o.InvalidArgumentError(t,e.name,o.InvalidArgumentErrorType.InvalidType,n)}if(e.variant_types&&e.variant_types.length>0){const a=e.variant_types.map((r=>r.name));for(const o of e.variant_types)try{return this.unwrapCore(r,o,t,n)}catch{}throw new o.InvalidArgumentError(t,`variant of [ ${a.join(" | ")} ]`,o.InvalidArgumentErrorType.InvalidType,n)}if("string"===e.name||"number"===e.name||"boolean"===e.name){if(typeof r!==e.name)throw new o.InvalidArgumentError(t,e.name,o.InvalidArgumentErrorType.InvalidType,n);return r}if(e.optional_type)return r?this.unwrapCore(r,e.optional_type,t,n):r;if(e.class_type&&!(r instanceof e.class_type))throw new o.InvalidArgumentError(t,e.name,o.InvalidArgumentErrorType.InvalidType,n);if(e.interface_data){if("object"!=typeof r||void 0===r)throw new o.InvalidArgumentError(t,e.name,o.InvalidArgumentErrorType.InvalidType,n);const a=r,s={};for(const r of e.interface_data().properties)if(r.name in a)s[r.name]=this.unwrapCore(a[r.name],r.type,t,n);else if(void 0===r.type.optional_type)throw new o.InvalidArgumentError(t,e.name,o.InvalidArgumentErrorType.Empty,n);return s}if(e.closure_type)return(...n)=>{const o=[];let a=0;for(const r of n)o.push(this.wrapCore(r,e.closure_type.argument_types[a],`${t} returned closure`)),a++;try{return this.unwrapCore(r(...o),e.closure_type.return_type,`${t} closure`)}catch(r){throw this.unwrapCore(r,{name:"Error",is_error:!0},`${t} closure`)}};if(e.is_generic_instance||e.class_type||"unknown"===e.name||e.is_error){if(!(r instanceof Object))return r;const e=this.proxyToGetInner.get(r.constructor);return e?e.call(r,p(this,i,"f")):r}throw new o.InvalidArgumentError(t,e.name,o.InvalidArgumentErrorType.Unknown,n)}}};var m=n.W_,c=n.S_,y=n.KB,l=n.Hk,f=n.zS,d=n.yX,w=n.FK;export{m as ActionFormData,c as ActionFormResponse,y as FormResponse,l as MessageFormData,f as MessageFormResponse,d as ModalFormData,w as ModalFormResponse}; |
Xet Storage Details
- Size:
- 5.2 kB
- Xet hash:
- e2afaa9fbce7a75dfbaf6973bc782373e9ffb174832848197543ca696042ab4b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.