Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

java-bridge

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

java-bridge - npm Package Compare versions

Comparing version 2.1.7 to 2.1.8-beta.1

dist/ts-src/TypescriptBulkDefinitionGenerator.d.ts

2

dist/index.prod.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.java=t():e.java=t()}(global,(()=>(()=>{var e={388:(e,t,a)=>{e=a.nmd(e);try{process.dlopen(e,__dirname+a(17).sep+a.p+"java.linux-x64-gnu.node")}catch(e){throw new Error("node-loader:\n"+e)}},163:(e,t,a)=>{const{existsSync:r,readFileSync:n}=a(147),{join:i}=a(17),{platform:o,arch:s}=process;let c=null,d=!1,u=null;function l(){if(process.report&&"function"==typeof process.report.getReport){const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}try{return n("/usr/bin/ldd","utf8").includes("musl")}catch(e){return!0}}switch(o){case"android":switch(s){case"arm64":d=r(i(__dirname,"java.android-arm64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.android-arm64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-android-arm64")}catch(e){u=e}break;case"arm":d=r(i(__dirname,"java.android-arm-eabi.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.android-arm-eabi.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-android-arm-eabi")}catch(e){u=e}break;default:throw new Error(`Unsupported architecture on Android ${s}`)}break;case"win32":switch(s){case"x64":d=r(i(__dirname,"java.win32-x64-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-x64-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-x64-msvc")}catch(e){u=e}break;case"ia32":d=r(i(__dirname,"java.win32-ia32-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-ia32-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-ia32-msvc")}catch(e){u=e}break;case"arm64":d=r(i(__dirname,"java.win32-arm64-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-arm64-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-arm64-msvc")}catch(e){u=e}break;default:throw new Error(`Unsupported architecture on Windows: ${s}`)}break;case"darwin":switch(s){case"x64":d=r(i(__dirname,"java.darwin-x64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.darwin-x64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-darwin-x64")}catch(e){u=e}break;case"arm64":d=r(i(__dirname,"java.darwin-arm64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.darwin-arm64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-darwin-arm64")}catch(e){u=e}break;default:throw new Error(`Unsupported architecture on macOS: ${s}`)}break;case"freebsd":if("x64"!==s)throw new Error(`Unsupported architecture on FreeBSD: ${s}`);d=r(i(__dirname,"java.freebsd-x64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.freebsd-x64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-freebsd-x64")}catch(e){u=e}break;case"linux":switch(s){case"x64":if(l()){d=r(i(__dirname,"java.linux-x64-musl.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-x64-musl.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-x64-musl")}catch(e){u=e}}else{d=r(i(__dirname,"java.linux-x64-gnu.node"));try{c=d?a(388):require("java-bridge-linux-x64-gnu")}catch(e){u=e}}break;case"arm64":if(l()){d=r(i(__dirname,"java.linux-arm64-musl.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm64-musl.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm64-musl")}catch(e){u=e}}else{d=r(i(__dirname,"java.linux-arm64-gnu.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm64-gnu.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm64-gnu")}catch(e){u=e}}break;case"arm":d=r(i(__dirname,"java.linux-arm-gnueabihf.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm-gnueabihf.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm-gnueabihf")}catch(e){u=e}break;default:throw new Error(`Unsupported architecture on Linux: ${s}`)}break;default:throw new Error(`Unsupported OS: ${o}, architecture: ${s}`)}if(!c){if(u)throw u;throw new Error("Failed to load native binding")}const{Java:f,getClassFields:p,getField:y,setField:m,getStaticField:v,setStaticField:h,JavaInterfaceProxy:g,StdoutRedirect:b,getJavaLibPath:w}=c;e.exports.Java=f,e.exports.getClassFields=p,e.exports.getField=y,e.exports.setField=m,e.exports.getStaticField=v,e.exports.setStaticField=h,e.exports.JavaInterfaceProxy=g,e.exports.StdoutRedirect=b,e.exports.getJavaLibPath=w},248:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=i(a(7)),c=a(236),d=o(a(147)),u=o(a(17)),l=s.default.createSourceFile("source.ts","",s.default.ScriptTarget.Latest,!1,s.default.ScriptKind.TS);class f{constructor(e,t=null,a=[]){this.classname=e,this.progressCallback=t,this.resolvedImports=a,this.usesBasicOrJavaType=!1,this.additionalImports=[],this.importsToResolve=[]}static async convertMethods(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a={};for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const n=await r.getName(),i=await r.getReturnType(),o=await r.getParameterTypes(),s={returnType:await i.getTypeName(),parameters:await Promise.all(o.map((e=>e.getTypeName()))),isStatic:await t.isStatic(e)};Object.hasOwn(a,n)?a[n].push(s):a[n]=[s]}}return a}async convertFields(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a=[];for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const n=await r.getName(),i=await r.getType(),o=await i.getTypeName(),c=[s.default.factory.createModifier(s.SyntaxKind.PublicKeyword)];await t.isStatic(e)&&c.push(s.default.factory.createModifier(s.SyntaxKind.StaticKeyword)),await t.isFinal(e)&&c.push(s.default.factory.createModifier(s.SyntaxKind.ReadonlyKeyword));let d=s.default.factory.createPropertyDeclaration(c,n,void 0,this.javaTypeToTypescriptType(o,!0),void 0);d=s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.SingleLineCommentTrivia,` ================== Field ${n} ==================`,!0),a.push(s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.MultiLineCommentTrivia,`*\n * Original type: '${await i.getTypeName()}'\n `,!0))}}return a}async convertConstructors(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a=[];for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const e=await r.getParameterTypes();a.push(await Promise.all(e.map((e=>e.getTypeName()))))}}const r=a.map(((e,t)=>{const a=e.map(this.convertParameter.bind(this));let r=s.default.factory.createConstructorDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.PublicKeyword)],a,void 0);return 0===t&&(r=s.default.addSyntheticLeadingComment(r,s.default.SyntaxKind.SingleLineCommentTrivia," ================== Constructors ==================",!0)),e.length>0&&(r=s.default.addSyntheticLeadingComment(r,s.default.SyntaxKind.MultiLineCommentTrivia,"*\n"+e.map(((e,t)=>` * @param var${t} original type: '${e}'\n`)).join("")+" ",!0)),r}));return[...a.map(((e,t)=>this.createMethod({returnType:this.classname,parameters:e,isStatic:!0},"newInstance",t,!1))),...r]}javaTypeToTypescriptType(e,t){switch(e){case"byte[]":case"java.lang.Byte[]":return s.default.factory.createTypeReferenceNode("Buffer")}if(e.endsWith("[]"))return s.default.factory.createArrayTypeNode(this.javaTypeToTypescriptType(e.substring(0,e.length-2),t));switch(e){case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"float":case"java.lang.Float":case"double":case"java.lang.Double":case"byte":case"java.lang.Byte":case"short":case"java.lang.Short":return s.default.factory.createKeywordTypeNode(s.default.SyntaxKind.NumberKeyword);case"char":case"java.lang.Character":case"java.lang.String":return s.default.factory.createKeywordTypeNode(s.default.SyntaxKind.StringKeyword);case"boolean":case"java.lang.Boolean":return s.default.factory.createKeywordTypeNode(s.default.SyntaxKind.BooleanKeyword);case"void":case"java.lang.Void":return s.default.factory.createKeywordTypeNode(s.default.SyntaxKind.VoidKeyword);case"java.lang.Object":return this.usesBasicOrJavaType=!0,s.default.factory.createTypeReferenceNode("BasicOrJavaType");default:this.resolvedImports.includes(e)||this.additionalImports.push(e),this.importsToResolve.push(e);const a=e===this.classname&&t;return s.default.factory.createTypeReferenceNode(e===this.classname?e.substring(e.lastIndexOf(".")+1)+(a?"Class":""):e.replaceAll(".","_"))}}convertParameter(e,t){const a="var"+t,r=this.javaTypeToTypescriptType(e,!0);return s.default.factory.createParameterDeclaration(void 0,void 0,a,void 0,r)}convertParameters(e){return e.parameters.map(this.convertParameter.bind(this))}static createMethodComment(e){return"*\n"+e.parameters.map(((e,t)=>` * @param var${t} original type: '${e}'\n`)).join("")+` * @return original return type: '${e.returnType}'\n `}createMethod(e,t,a,r){const n=s.default.factory.createModifier(s.default.SyntaxKind.PublicKeyword),i=s.default.factory.createModifier(s.default.SyntaxKind.StaticKeyword),o=[n];e.isStatic&&o.push(i);let c=this.javaTypeToTypescriptType(e.returnType,!1);r||(c=s.default.factory.createTypeReferenceNode(s.default.factory.createIdentifier("Promise"),[c]));let d=s.default.factory.createMethodDeclaration(o,void 0,t+(r?"Sync":""),void 0,void 0,this.convertParameters(e),c,void 0);return 0===a&&(d=s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.SingleLineCommentTrivia,` ================== Method ${t} ==================`,!0)),s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.MultiLineCommentTrivia,f.createMethodComment(e),!0)}convertMethod(e,t){const a=[];for(let r=0;r<e.length;r++){const n=e[r];a.push(this.createMethod(n,t,r,!1),this.createMethod(n,t,r,!0))}return a}getAdditionalImports(){const e=e=>{const t=this.classname.split("."),a=e.split(".");for(let e=0;e<t.length&&a[e]===t[e];e++)t[e]=null,a[e]=null;return"./"+t.filter((e=>!!e)).map((()=>"")).join("../")+a.filter((e=>!!e)).join("/")};return this.importsToResolve.filter((e=>e!=this.classname)).filter(((e,t,a)=>a.indexOf(e)===t)).map((t=>s.default.factory.createImportDeclaration(void 0,s.default.factory.createImportClause(!1,void 0,s.default.factory.createNamedImports([s.default.factory.createImportSpecifier(!1,s.default.factory.createIdentifier(t.substring(t.lastIndexOf(".")+1)),s.default.factory.createIdentifier(t.replaceAll(".","_")))])),s.default.factory.createStringLiteral(e(t)))))}getImports(){const e=[s.default.factory.createImportSpecifier(!1,void 0,s.default.factory.createIdentifier("importClass")),s.default.factory.createImportSpecifier(!1,void 0,s.default.factory.createIdentifier("JavaClass"))];this.usesBasicOrJavaType&&e.push(s.default.factory.createImportSpecifier(!1,void 0,s.default.factory.createIdentifier("BasicOrJavaType")));const t=s.default.factory.createNamedImports(e);return s.default.factory.createImportDeclaration(void 0,s.default.factory.createImportClause(!1,void 0,t),s.default.factory.createStringLiteral("java-bridge"))}getExportStatement(e){const t=s.default.factory.createClassDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.ExportKeyword)],e,void 0,[s.default.factory.createHeritageClause(s.default.SyntaxKind.ExtendsKeyword,[s.default.factory.createExpressionWithTypeArguments(s.default.factory.createIdentifier(`importClass<typeof ${e}Class>("${this.classname}")`),void 0)])],[]);return[s.default.addSyntheticLeadingComment(t,s.SyntaxKind.MultiLineCommentTrivia,`*\n * Class ${this.classname}.\n *\n * This actually imports the java class for further use.\n * The class ${e}Class only defines types, this is the class you should actually import.\n * Please note that this statement imports the underlying java class at runtime, which may take a while.\n * This was generated by java-bridge.\n * You should probably not edit this.\n `,!0),s.default.factory.createExportDefault(s.default.factory.createIdentifier(e))]}getText(e){return e.map((e=>e&&s.default.createPrinter({newLine:s.default.NewLineKind.LineFeed}).printNode(s.default.EmitHint.Unspecified,e,l)||"")).join("\n")}async generate(){if(this.resolvedImports.includes(this.classname))return[];this.resolvedImports.push(this.classname),this.progressCallback&&this.progressCallback(this.classname);const e=(await(0,c.importClassAsync)(this.classname)).class,t=this.classname.substring(this.classname.lastIndexOf(".")+1),a=await e.getDeclaredFields(),r=await e.getDeclaredMethods(),n=await this.convertFields(a),i=await f.convertMethods(r);for(const[e,t]of Object.entries(i))n.push(...this.convertMethod(t,e));const o=await e.getDeclaredConstructors(),d=await this.convertConstructors(o);n.push(...d);let u=s.default.factory.createClassDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.ExportKeyword),s.default.factory.createModifier(s.default.SyntaxKind.DeclareKeyword)],t+"Class",void 0,[s.default.factory.createHeritageClause(s.default.SyntaxKind.ExtendsKeyword,[s.default.factory.createExpressionWithTypeArguments(s.default.factory.createIdentifier("JavaClass"),void 0)])],n);u=s.default.addSyntheticLeadingComment(u,s.default.SyntaxKind.MultiLineCommentTrivia,`*\n * This class just defines types, you should import ${t} instead of this.\n * This was generated by java-bridge.\n * You should probably not edit this.\n `,!0);const l=this.getText([this.getImports(),...this.getAdditionalImports(),null,u,null,...this.getExportStatement(t)]),p=[];for(const e of this.additionalImports){const t=new f(e,this.progressCallback,this.resolvedImports),a=await t.generate();p.push(...a)}return p.push({name:this.classname,contents:l}),p}static async save(e,t){for(const a of e){const e=a.name.split(".");e[e.length-1]=e[e.length-1]+".ts";const r=u.default.join(t,...e);await d.default.promises.mkdir(u.default.dirname(r),{recursive:!0}),await d.default.promises.writeFile(r,a.contents,{encoding:"utf8"})}}}t.default=f},91:(e,t)=>{"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.JavaObject=t.JavaVersion=void 0,function(e){e.VER_1_1="1.1",e.VER_1_2="1.2",e.VER_1_4="1.4",e.VER_1_6="1.6",e.VER_1_8="1.8",e.VER_9="9",e.VER_10="10"}(a=t.JavaVersion||(t.JavaVersion={})),Object.freeze(a),t.JavaObject=class{}},236:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||r(t,e,a)},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TypescriptDefinitionGenerator=t.getJavaVersionSync=t.getJavaVersion=t.getJavaLibPath=t.UnknownJavaClass=t.JavaClassConstructor=t.JavaClass=t.JavaClassProxy=t.JavaClassInstance=t.JavaObject=t.JavaVersion=void 0;var c=a(91);Object.defineProperty(t,"JavaVersion",{enumerable:!0,get:function(){return c.JavaVersion}}),Object.defineProperty(t,"JavaObject",{enumerable:!0,get:function(){return c.JavaObject}}),Object.defineProperty(t,"JavaClassInstance",{enumerable:!0,get:function(){return c.JavaClassInstance}}),Object.defineProperty(t,"JavaClassProxy",{enumerable:!0,get:function(){return c.JavaClassProxy}}),Object.defineProperty(t,"JavaClass",{enumerable:!0,get:function(){return c.JavaClass}}),Object.defineProperty(t,"JavaClassConstructor",{enumerable:!0,get:function(){return c.JavaClassConstructor}}),Object.defineProperty(t,"UnknownJavaClass",{enumerable:!0,get:function(){return c.UnknownJavaClass}}),i(a(818),t);const d=o(a(818));t.default=d;var u=a(163);Object.defineProperty(t,"getJavaLibPath",{enumerable:!0,get:function(){return u.getJavaLibPath}});var l=a(102);Object.defineProperty(t,"getJavaVersion",{enumerable:!0,get:function(){return l.getJavaVersion}}),Object.defineProperty(t,"getJavaVersionSync",{enumerable:!0,get:function(){return l.getJavaVersionSync}});const f=s(a(248));t.TypescriptDefinitionGenerator=f.default},818:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaInstance=t.newProxy=t.stdout=t.classpath=t.isInstanceOf=t.appendClasspath=t.importClassAsync=t.importClass=t.setClassLoader=t.getClassLoader=t.ensureJvm=void 0;const r=a(163),n=a(841);let i=null;function o(e){i||(i=new r.Java(e?.libPath,e?.version,e?.opts,e,(0,n.getJavaLibPath)(),(0,n.getNativeLibPath)()))}function s(e,t){for(const a of(0,r.getClassFields)(e["class.proxy"],t)){const n=()=>t?(0,r.getStaticField)(e,a.name):(0,r.getField)(e,a.name);a.isFinal?Object.defineProperty(e,a.name,{get:n,enumerable:!0}):Object.defineProperty(e,a.name,{get:n,set:n=>t?(0,r.setStaticField)(e,a.name,n):(0,r.setField)(e,a.name,n),enumerable:!0})}}function c(e){return s(e,!0),class extends e{constructor(...e){super(...e),s(this,!1)}static async newInstanceAsync(...e){const t=await super.newInstanceAsync(...e);return s(t,!1),t}}}function d(e){o(),i.appendClasspath(e)}var u;t.ensureJvm=o,t.getClassLoader=function(){return o(),i.classLoader},t.setClassLoader=function(e){o(),i.classLoader=e},t.importClass=function(e){return o(),c(i.importClass(e))},t.importClassAsync=async function(e){return o(),c(await i.importClassAsync(e))},t.appendClasspath=d,t.isInstanceOf=function(e,t){return o(),i.isInstanceOf(e,t)},(u=t.classpath||(t.classpath={})).append=function(e){d(e)},u.get=function(){return o(),i.loadedJars},(t.stdout||(t.stdout={})).enableRedirect=function(e,t){return o(),i.setStdoutCallbacks(e,t)},t.newProxy=function(e,t){o();const a=Object.create(null);for(const[e,r]of Object.entries(t))a[e]=(e,t,...a)=>{if(e)throw e;try{t(null,r(...a))}catch(e){e instanceof Error?t(e):t(new Error(e.toString()))}};return i.createInterfaceProxy(e,a)},t.getJavaInstance=function(){return i}},841:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaLibPath=t.getNativeLibPath=void 0;const s=o(a(17)),c=i(a(147)),d=o(a(230)),{platform:u,arch:l}=process;function f(e){const t=s.default.join(__dirname,e+".node");if(c.default.existsSync(t))return t;{const t=e.replaceAll(".","-").replace("java","java-bridge");return require&&require.resolve?require.resolve(t):a(955).resolve(t)}}function p(){return new Error(`Unsupported platform: ${u} ${l}`)}t.getNativeLibPath=function(){switch(u){case"android":switch(l){case"arm64":return f("java.android-arm64");case"arm":return f("java.android-arm-eabi");default:throw p()}case"win32":return f(`java.win32-${l}-msvc`);case"darwin":return f(`java.darwin-${l}`);case"freebsd":return f(`java.freebsd-${l}`);case"linux":switch(l){case"x64":case"arm64":return f(`java.linux-${l}-${function(){if(process.report&&"function"==typeof process.report.getReport){const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}try{return(0,c.readFileSync)("/usr/bin/ldd","utf8").includes("musl")}catch(e){return!0}}()?"musl":"gnu"}`);case"arm":return f("java.linux-arm-gnueabihf");default:throw p()}default:throw p()}},t.getJavaLibPath=function(){const e=s.default.join(__dirname,"..","java-src","build","libs");let t=d.default.sync("*.jar",{cwd:e});if(0===t.length)throw new Error(`No java lib found in ${e}`);return s.default.join(e,t[0])}},102:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaVersionSync=t.getJavaVersion=void 0;const r=a(818);t.getJavaVersion=async function(){const e=await(0,r.importClassAsync)("java.lang.System");return await e.getProperty("java.version")},t.getJavaVersionSync=function(){return(0,r.importClass)("java.lang.System").getPropertySync("java.version")}},955:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=955,e.exports=t},230:e=>{"use strict";e.exports=require("glob")},7:e=>{"use strict";e.exports=require("typescript")},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}return a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),a.p="",a(236)})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.java=t():e.java=t()}(global,(()=>(()=>{var e={388:(e,t,a)=>{e=a.nmd(e);try{process.dlopen(e,__dirname+a(17).sep+a.p+"java.linux-x64-gnu.node")}catch(e){throw new Error("node-loader:\n"+e)}},163:(e,t,a)=>{const{existsSync:r,readFileSync:n}=a(147),{join:i}=a(17),{platform:o,arch:s}=process;let c=null,d=!1,l=null;function u(){if(process.report&&"function"==typeof process.report.getReport){const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}try{return n("/usr/bin/ldd","utf8").includes("musl")}catch(e){return!0}}switch(o){case"android":switch(s){case"arm64":d=r(i(__dirname,"java.android-arm64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.android-arm64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-android-arm64")}catch(e){l=e}break;case"arm":d=r(i(__dirname,"java.android-arm-eabi.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.android-arm-eabi.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-android-arm-eabi")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on Android ${s}`)}break;case"win32":switch(s){case"x64":d=r(i(__dirname,"java.win32-x64-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-x64-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-x64-msvc")}catch(e){l=e}break;case"ia32":d=r(i(__dirname,"java.win32-ia32-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-ia32-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-ia32-msvc")}catch(e){l=e}break;case"arm64":d=r(i(__dirname,"java.win32-arm64-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-arm64-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-arm64-msvc")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on Windows: ${s}`)}break;case"darwin":switch(s){case"x64":d=r(i(__dirname,"java.darwin-x64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.darwin-x64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-darwin-x64")}catch(e){l=e}break;case"arm64":d=r(i(__dirname,"java.darwin-arm64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.darwin-arm64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-darwin-arm64")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on macOS: ${s}`)}break;case"freebsd":if("x64"!==s)throw new Error(`Unsupported architecture on FreeBSD: ${s}`);d=r(i(__dirname,"java.freebsd-x64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.freebsd-x64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-freebsd-x64")}catch(e){l=e}break;case"linux":switch(s){case"x64":if(u()){d=r(i(__dirname,"java.linux-x64-musl.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-x64-musl.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-x64-musl")}catch(e){l=e}}else{d=r(i(__dirname,"java.linux-x64-gnu.node"));try{c=d?a(388):require("java-bridge-linux-x64-gnu")}catch(e){l=e}}break;case"arm64":if(u()){d=r(i(__dirname,"java.linux-arm64-musl.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm64-musl.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm64-musl")}catch(e){l=e}}else{d=r(i(__dirname,"java.linux-arm64-gnu.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm64-gnu.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm64-gnu")}catch(e){l=e}}break;case"arm":d=r(i(__dirname,"java.linux-arm-gnueabihf.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm-gnueabihf.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm-gnueabihf")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on Linux: ${s}`)}break;default:throw new Error(`Unsupported OS: ${o}, architecture: ${s}`)}if(!c){if(l)throw l;throw new Error("Failed to load native binding")}const{Java:f,getClassFields:p,getField:y,setField:v,getStaticField:m,setStaticField:h,JavaInterfaceProxy:g,StdoutRedirect:b,getJavaLibPath:w}=c;e.exports.Java=f,e.exports.getClassFields=p,e.exports.getField=y,e.exports.setField=v,e.exports.getStaticField=m,e.exports.setStaticField=h,e.exports.JavaInterfaceProxy=g,e.exports.StdoutRedirect=b,e.exports.getJavaLibPath=w},238:function(e,t,a){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TypescriptBulkDefinitionGenerator=void 0;const n=r(a(248));t.TypescriptBulkDefinitionGenerator=class{constructor(){this.declarations=[],this.resolvedImports=[]}async generate(e,t=null){let a=0;for(const r of e){const e=new n.default(r,t,this.resolvedImports),i=await e.generate();a+=i.length,this.declarations.push(...i)}return a}async save(e){await n.default.save(this.declarations,e)}get moduleDeclarations(){return this.declarations}}},248:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=i(a(7)),c=a(236),d=o(a(147)),l=o(a(17)),u=s.default.createSourceFile("source.ts","",s.default.ScriptTarget.Latest,!1,s.default.ScriptKind.TS),f=["toString","wait","getClass","hashCode","notify","notifyAll","equals"];class p{constructor(e,t=null,a=[]){this.classname=e,this.progressCallback=t,this.resolvedImports=a,this.usesBasicOrJavaType=!1,this.additionalImports=[],this.importsToResolve=[]}static async convertMethods(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a={};for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const n=await r.getName(),i=await r.getReturnType(),o=await r.getParameterTypes(),s={returnType:await i.getTypeName(),parameters:await Promise.all(o.map((e=>e.getTypeName()))),isStatic:await t.isStatic(e)};Object.hasOwn(a,n)?a[n].push(s):a[n]=[s]}}return a}async convertFields(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a=[];for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const n=await r.getName(),i=await r.getType(),o=await i.getTypeName(),c=[s.default.factory.createModifier(s.SyntaxKind.PublicKeyword)];await t.isStatic(e)&&c.push(s.default.factory.createModifier(s.SyntaxKind.StaticKeyword)),await t.isFinal(e)&&c.push(s.default.factory.createModifier(s.SyntaxKind.ReadonlyKeyword));let d=s.default.factory.createPropertyDeclaration(c,n,void 0,this.javaTypeToTypescriptType(o,!0),void 0);d=s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.SingleLineCommentTrivia,` ================== Field ${n} ==================`,!0),a.push(s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.MultiLineCommentTrivia,`*\n * Original type: '${await i.getTypeName()}'\n `,!0))}}return a}async isAbstractOrInterface(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier");return await e.isInterface()||await t.isAbstract(await e.getModifiers())}createPrivateConstructor(){const e=s.default.factory.createConstructorDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.PrivateKeyword)],[],s.default.factory.createBlock([s.default.factory.createExpressionStatement(s.default.factory.createCallExpression(s.default.factory.createSuper(),[],[]))],!0));return s.default.addSyntheticLeadingComment(e,s.default.SyntaxKind.MultiLineCommentTrivia,"*\n * Private constructor to prevent instantiation\n * as this is either an abstract class or an interface\n ",!0)}async convertConstructors(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a=[];for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const e=await r.getParameterTypes();a.push(await Promise.all(e.map((e=>e.getTypeName()))))}}const r=a.map(((e,t)=>{const a=e.map(this.convertParameter.bind(this));let r=s.default.factory.createConstructorDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.PublicKeyword)],a,void 0);return 0===t&&(r=s.default.addSyntheticLeadingComment(r,s.default.SyntaxKind.SingleLineCommentTrivia," ================== Constructors ==================",!0)),e.length>0&&(r=s.default.addSyntheticLeadingComment(r,s.default.SyntaxKind.MultiLineCommentTrivia,"*\n"+e.map(((e,t)=>` * @param var${t} original type: '${e}'\n`)).join("")+" ",!0)),r}));return[...a.map(((e,t)=>this.createMethod({returnType:this.classname,parameters:e,isStatic:!0},"newInstance",t,!1,!0))),...r]}primitiveToClassType(e){switch(e){case"boolean":return"java.lang.Boolean";case"byte":return"java.lang.Byte";case"char":return"java.lang.Character";case"short":return"java.lang.Short";case"int":return"java.lang.Integer";case"long":return"java.lang.Long";case"float":return"java.lang.Float";case"double":return"java.lang.Double";default:return e}}isPrimitive(e){return["boolean","byte","char","short","int","long","float","double"].includes(e)}javaTypeToTypescriptType(e,t,a=!0){const r=e=>a?s.default.factory.createUnionTypeNode([e,s.default.factory.createLiteralTypeNode(s.default.factory.createNull())]):e;switch(e){case"byte[]":case"java.lang.Byte[]":return r(s.default.factory.createTypeReferenceNode("Buffer"))}if(e.endsWith("[]"))return r(s.default.factory.createArrayTypeNode(this.javaTypeToTypescriptType(e.substring(0,e.length-2),t)));const n=e=>{this.resolvedImports.includes(e)||this.additionalImports.push(e),this.importsToResolve.push(e);const a=e===this.classname&&t;return s.default.factory.createTypeReferenceNode(e===this.classname?e.substring(e.lastIndexOf(".")+1)+(a?"Class":""):e.replaceAll(".","_"))},i=(r,...i)=>{const o=[s.default.factory.createKeywordTypeNode(r)];return!this.isPrimitive(e)&&a&&o.push(s.default.factory.createLiteralTypeNode(s.default.factory.createNull())),t?s.default.factory.createUnionTypeNode([n(this.primitiveToClassType(e)),...i.map((e=>s.default.factory.createKeywordTypeNode(e))),...o]):s.default.factory.createUnionTypeNode(o)};switch(e){case"int":case"java.lang.Integer":case"float":case"java.lang.Float":case"double":case"java.lang.Double":case"byte":case"java.lang.Byte":case"short":case"java.lang.Short":return i(s.SyntaxKind.NumberKeyword);case"long":case"java.lang.Long":return i(s.SyntaxKind.NumberKeyword,s.SyntaxKind.BigIntKeyword);case"char":case"java.lang.Character":case"java.lang.String":return r(s.default.factory.createKeywordTypeNode(s.SyntaxKind.StringKeyword));case"boolean":case"java.lang.Boolean":return i(s.SyntaxKind.BooleanKeyword);case"void":case"java.lang.Void":return s.default.factory.createKeywordTypeNode(s.SyntaxKind.VoidKeyword);case"java.lang.Object":return this.usesBasicOrJavaType=!0,r(s.default.factory.createTypeReferenceNode("BasicOrJavaType"));default:return r(n(e))}}convertParameter(e,t){const a="var"+t,r=this.javaTypeToTypescriptType(e,!0);return s.default.factory.createParameterDeclaration(void 0,void 0,a,void 0,r)}convertParameters(e){return e.parameters.map(this.convertParameter.bind(this))}static createMethodComment(e){return"*\n"+e.parameters.map(((e,t)=>` * @param var${t} original type: '${e}'\n`)).join("")+` * @return original return type: '${e.returnType}'\n `}createMethod(e,t,a,r,n){const i=s.default.factory.createModifier(s.default.SyntaxKind.PublicKeyword),o=s.default.factory.createModifier(s.default.SyntaxKind.StaticKeyword),c=[i];e.isStatic&&c.push(o);let d=this.javaTypeToTypescriptType(e.returnType,!1,!n);r||(d=s.default.factory.createTypeReferenceNode(s.default.factory.createIdentifier("Promise"),[d]));let l=s.default.factory.createMethodDeclaration(c,void 0,t+(r?"Sync":""),void 0,void 0,this.convertParameters(e),d,void 0);return 0===a&&(l=s.default.addSyntheticLeadingComment(l,s.default.SyntaxKind.SingleLineCommentTrivia,` ================== Method ${t} ==================`,!0)),s.default.addSyntheticLeadingComment(l,s.default.SyntaxKind.MultiLineCommentTrivia,p.createMethodComment(e),!0)}convertMethod(e,t){const a=[];for(let r=0;r<e.length;r++){const n=e[r],i=f.includes(t);a.push(this.createMethod(n,t,r,!1,i),this.createMethod(n,t,r,!0,i))}return a}getAdditionalImports(){const e=e=>{const t=this.classname.split("."),a=e.split(".");for(let e=0;e<t.length&&a[e]===t[e];e++)t[e]=null,a[e]=null;return"./"+t.filter((e=>!!e)).map((()=>"")).join("../")+a.filter((e=>!!e)).join("/")};return this.importsToResolve.filter((e=>e!=this.classname)).filter(((e,t,a)=>a.indexOf(e)===t)).map((t=>s.default.factory.createImportDeclaration(void 0,s.default.factory.createImportClause(!1,void 0,s.default.factory.createNamedImports([s.default.factory.createImportSpecifier(!1,s.default.factory.createIdentifier(t.substring(t.lastIndexOf(".")+1)),s.default.factory.createIdentifier(t.replaceAll(".","_")))])),s.default.factory.createStringLiteral(e(t)))))}getImports(){const e=[s.default.factory.createImportSpecifier(!1,void 0,s.default.factory.createIdentifier("importClass")),s.default.factory.createImportSpecifier(!1,void 0,s.default.factory.createIdentifier("JavaClass"))];this.usesBasicOrJavaType&&e.push(s.default.factory.createImportSpecifier(!1,void 0,s.default.factory.createIdentifier("BasicOrJavaType")));const t=s.default.factory.createNamedImports(e);return s.default.factory.createImportDeclaration(void 0,s.default.factory.createImportClause(!1,void 0,t),s.default.factory.createStringLiteral("java-bridge"))}getExportStatement(e,t){const a=s.default.factory.createClassDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.ExportKeyword)],e,void 0,[s.default.factory.createHeritageClause(s.default.SyntaxKind.ExtendsKeyword,[s.default.factory.createExpressionWithTypeArguments(s.default.factory.createIdentifier(`importClass<typeof ${e}Class>("${this.classname}")`),void 0)])],t?[this.createPrivateConstructor()]:[]);return[s.default.addSyntheticLeadingComment(a,s.SyntaxKind.MultiLineCommentTrivia,`*\n * Class ${this.classname}.\n *\n * This actually imports the java class for further use.\n * The class ${e}Class only defines types, this is the class you should actually import.\n * Please note that this statement imports the underlying java class at runtime, which may take a while.\n * This was generated by java-bridge.\n * You should probably not edit this.\n `,!0),s.default.factory.createExportDefault(s.default.factory.createIdentifier(e))]}getText(e){return e.map((e=>e&&s.default.createPrinter({newLine:s.default.NewLineKind.LineFeed}).printNode(s.default.EmitHint.Unspecified,e,u)||"")).join("\n")}async generate(){if(this.resolvedImports.includes(this.classname))return[];this.resolvedImports.push(this.classname),this.progressCallback&&this.progressCallback(this.classname);const e=(await(0,c.importClassAsync)(this.classname)).class,t=this.classname.substring(this.classname.lastIndexOf(".")+1),a=(await e.getFields()).filter((function(e,t,a){return a.findIndex((t=>e.getNameSync()===t.getNameSync()))===t})),r=await e.getMethods(),n=await this.convertFields(a),i=await p.convertMethods(r);for(const[e,t]of Object.entries(i))n.push(...this.convertMethod(t,e));const o=await this.isAbstractOrInterface(e);if(!o){const t=await e.getDeclaredConstructors(),a=await this.convertConstructors(t);n.push(...a)}let d=s.default.factory.createClassDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.ExportKeyword),s.default.factory.createModifier(s.default.SyntaxKind.DeclareKeyword)],t+"Class",void 0,[s.default.factory.createHeritageClause(s.default.SyntaxKind.ExtendsKeyword,[s.default.factory.createExpressionWithTypeArguments(s.default.factory.createIdentifier("JavaClass"),void 0)])],n);d=s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.MultiLineCommentTrivia,`*\n * This class just defines types, you should import ${t} instead of this.\n * This was generated by java-bridge.\n * You should probably not edit this.\n `,!0);const l=this.getText([this.getImports(),...this.getAdditionalImports(),null,d,null,...this.getExportStatement(t,o)]),u=[];for(const e of this.additionalImports){const t=new p(e,this.progressCallback,this.resolvedImports),a=await t.generate();u.push(...a)}return u.push({name:this.classname,contents:l}),u}static async save(e,t){for(const a of e){const e=a.name.split(".");e[e.length-1]=e[e.length-1]+".ts";const r=l.default.join(t,...e);await d.default.promises.mkdir(l.default.dirname(r),{recursive:!0}),await d.default.promises.writeFile(r,a.contents,{encoding:"utf8"})}}}t.default=p},91:(e,t)=>{"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.JavaObject=t.JavaVersion=void 0,function(e){e.VER_1_1="1.1",e.VER_1_2="1.2",e.VER_1_4="1.4",e.VER_1_6="1.6",e.VER_1_8="1.8",e.VER_9="9",e.VER_10="10"}(a=t.JavaVersion||(t.JavaVersion={})),Object.freeze(a),t.JavaObject=class{}},236:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||r(t,e,a)},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TypescriptBulkDefinitionGenerator=t.TypescriptDefinitionGenerator=t.getJavaVersionSync=t.getJavaVersion=t.getJavaLibPath=t.UnknownJavaClass=t.JavaClassConstructor=t.JavaClass=t.JavaClassProxy=t.JavaClassInstance=t.JavaObject=t.JavaVersion=void 0;var c=a(91);Object.defineProperty(t,"JavaVersion",{enumerable:!0,get:function(){return c.JavaVersion}}),Object.defineProperty(t,"JavaObject",{enumerable:!0,get:function(){return c.JavaObject}}),Object.defineProperty(t,"JavaClassInstance",{enumerable:!0,get:function(){return c.JavaClassInstance}}),Object.defineProperty(t,"JavaClassProxy",{enumerable:!0,get:function(){return c.JavaClassProxy}}),Object.defineProperty(t,"JavaClass",{enumerable:!0,get:function(){return c.JavaClass}}),Object.defineProperty(t,"JavaClassConstructor",{enumerable:!0,get:function(){return c.JavaClassConstructor}}),Object.defineProperty(t,"UnknownJavaClass",{enumerable:!0,get:function(){return c.UnknownJavaClass}}),i(a(818),t);const d=o(a(818));t.default=d;var l=a(163);Object.defineProperty(t,"getJavaLibPath",{enumerable:!0,get:function(){return l.getJavaLibPath}});var u=a(102);Object.defineProperty(t,"getJavaVersion",{enumerable:!0,get:function(){return u.getJavaVersion}}),Object.defineProperty(t,"getJavaVersionSync",{enumerable:!0,get:function(){return u.getJavaVersionSync}});const f=s(a(248));t.TypescriptDefinitionGenerator=f.default;var p=a(238);Object.defineProperty(t,"TypescriptBulkDefinitionGenerator",{enumerable:!0,get:function(){return p.TypescriptBulkDefinitionGenerator}})},818:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaInstance=t.newProxy=t.stdout=t.classpath=t.isInstanceOf=t.appendClasspathAny=t.appendClasspath=t.importClassAsync=t.importClass=t.setClassLoader=t.getClassLoader=t.ensureJvm=void 0;const r=a(163),n=a(841);let i=null;function o(e){return!i&&(i=new r.Java(e?.libPath,e?.version,e?.opts,e,(0,n.getJavaLibPath)(),(0,n.getNativeLibPath)()),!0)}function s(e,t){for(const a of(0,r.getClassFields)(e["class.proxy"],t)){const n=()=>t?(0,r.getStaticField)(e,a.name):(0,r.getField)(e,a.name);a.isFinal?Object.defineProperty(e,a.name,{get:n,enumerable:!0}):Object.defineProperty(e,a.name,{get:n,set:n=>t?(0,r.setStaticField)(e,a.name,n):(0,r.setField)(e,a.name,n),enumerable:!0})}}function c(e){return s(e,!0),class extends e{constructor(...e){super(...e),s(this,!1)}static async newInstanceAsync(...e){const t=await super.newInstanceAsync(...e);return s(t,!1),t}}}function d(e){o(),i.appendClasspath(e)}function l(e,t){o(),i.appendAnyToClasspath(e,t)}var u;t.ensureJvm=o,t.getClassLoader=function(){return o(),i.classLoader},t.setClassLoader=function(e){o(),i.classLoader=e},t.importClass=function(e){return o(),c(i.importClass(e))},t.importClassAsync=async function(e){return o(),c(await i.importClassAsync(e))},t.appendClasspath=d,t.appendClasspathAny=l,t.isInstanceOf=function(e,t){return o(),i.isInstanceOf(e,t)},(u=t.classpath||(t.classpath={})).append=function(e){d(e)},u.appendAny=function(e,t){l(e,t)},u.get=function(){return o(),i.loadedJars},(t.stdout||(t.stdout={})).enableRedirect=function(e,t){return o(),i.setStdoutCallbacks(e,t)},t.newProxy=function(e,t){o();const a=Object.create(null);for(const[e,r]of Object.entries(t))a[e]=(e,t,...a)=>{if(e)throw e;try{t(null,r(...a))}catch(e){e instanceof Error?t(e):t(new Error(e.toString()))}};return i.createInterfaceProxy(e,a)},t.getJavaInstance=function(){return i}},841:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaLibPath=t.getNativeLibPath=void 0;const s=o(a(17)),c=i(a(147)),d=o(a(230)),{platform:l,arch:u}=process;function f(e){const t=s.default.join(__dirname,e+".node");if(c.default.existsSync(t))return t;{const t=e.replaceAll(".","-").replace("java","java-bridge");return require&&require.resolve?require.resolve(t):a(955).resolve(t)}}function p(){return new Error(`Unsupported platform: ${l} ${u}`)}t.getNativeLibPath=function(){switch(l){case"android":switch(u){case"arm64":return f("java.android-arm64");case"arm":return f("java.android-arm-eabi");default:throw p()}case"win32":return f(`java.win32-${u}-msvc`);case"darwin":return f(`java.darwin-${u}`);case"freebsd":return f(`java.freebsd-${u}`);case"linux":switch(u){case"x64":case"arm64":return f(`java.linux-${u}-${function(){if(process.report&&"function"==typeof process.report.getReport){const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}try{return(0,c.readFileSync)("/usr/bin/ldd","utf8").includes("musl")}catch(e){return!0}}()?"musl":"gnu"}`);case"arm":return f("java.linux-arm-gnueabihf");default:throw p()}default:throw p()}},t.getJavaLibPath=function(){const e=s.default.join(__dirname,"..","java-src","build","libs");let t=d.default.sync("*.jar",{cwd:e});if(0===t.length)throw new Error(`No java lib found in ${e}`);return s.default.join(e,t[0])}},102:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaVersionSync=t.getJavaVersion=void 0;const r=a(818);t.getJavaVersion=async function(){const e=await(0,r.importClassAsync)("java.lang.System");return await e.getProperty("java.version")},t.getJavaVersionSync=function(){return(0,r.importClass)("java.lang.System").getPropertySync("java.version")}},955:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=955,e.exports=t},230:e=>{"use strict";e.exports=require("glob")},7:e=>{"use strict";e.exports=require("typescript")},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}return a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),a.p="",a(236)})()));
//# sourceMappingURL=index.prod.min.js.map
#!/usr/bin/env node
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.java=t():e.java=t()}(global,(()=>(()=>{var __webpack_modules__={388:(e,t,a)=>{e=a.nmd(e);try{process.dlopen(e,__dirname+a(17).sep+a.p+"java.linux-x64-gnu.node")}catch(e){throw new Error("node-loader:\n"+e)}},163:(e,t,a)=>{const{existsSync:r,readFileSync:n}=a(147),{join:i}=a(17),{platform:s,arch:o}=process;let c=null,d=!1,l=null;function u(){if(process.report&&"function"==typeof process.report.getReport){const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}try{return n("/usr/bin/ldd","utf8").includes("musl")}catch(e){return!0}}switch(s){case"android":switch(o){case"arm64":d=r(i(__dirname,"java.android-arm64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.android-arm64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-android-arm64")}catch(e){l=e}break;case"arm":d=r(i(__dirname,"java.android-arm-eabi.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.android-arm-eabi.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-android-arm-eabi")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on Android ${o}`)}break;case"win32":switch(o){case"x64":d=r(i(__dirname,"java.win32-x64-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-x64-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-x64-msvc")}catch(e){l=e}break;case"ia32":d=r(i(__dirname,"java.win32-ia32-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-ia32-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-ia32-msvc")}catch(e){l=e}break;case"arm64":d=r(i(__dirname,"java.win32-arm64-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-arm64-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-arm64-msvc")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on Windows: ${o}`)}break;case"darwin":switch(o){case"x64":d=r(i(__dirname,"java.darwin-x64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.darwin-x64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-darwin-x64")}catch(e){l=e}break;case"arm64":d=r(i(__dirname,"java.darwin-arm64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.darwin-arm64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-darwin-arm64")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on macOS: ${o}`)}break;case"freebsd":if("x64"!==o)throw new Error(`Unsupported architecture on FreeBSD: ${o}`);d=r(i(__dirname,"java.freebsd-x64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.freebsd-x64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-freebsd-x64")}catch(e){l=e}break;case"linux":switch(o){case"x64":if(u()){d=r(i(__dirname,"java.linux-x64-musl.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-x64-musl.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-x64-musl")}catch(e){l=e}}else{d=r(i(__dirname,"java.linux-x64-gnu.node"));try{c=d?a(388):require("java-bridge-linux-x64-gnu")}catch(e){l=e}}break;case"arm64":if(u()){d=r(i(__dirname,"java.linux-arm64-musl.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm64-musl.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm64-musl")}catch(e){l=e}}else{d=r(i(__dirname,"java.linux-arm64-gnu.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm64-gnu.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm64-gnu")}catch(e){l=e}}break;case"arm":d=r(i(__dirname,"java.linux-arm-gnueabihf.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm-gnueabihf.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm-gnueabihf")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on Linux: ${o}`)}break;default:throw new Error(`Unsupported OS: ${s}, architecture: ${o}`)}if(!c){if(l)throw l;throw new Error("Failed to load native binding")}const{Java:f,getClassFields:p,getField:m,setField:v,getStaticField:h,setStaticField:y,JavaInterfaceProxy:b,StdoutRedirect:_,getJavaLibPath:g}=c;e.exports.Java=f,e.exports.getClassFields=p,e.exports.getField=m,e.exports.setField=v,e.exports.getStaticField=h,e.exports.setStaticField=y,e.exports.JavaInterfaceProxy=b,e.exports.StdoutRedirect=_,e.exports.getJavaLibPath=g},248:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(a(7)),c=a(236),d=s(a(147)),l=s(a(17)),u=o.default.createSourceFile("source.ts","",o.default.ScriptTarget.Latest,!1,o.default.ScriptKind.TS);class f{constructor(e,t=null,a=[]){this.classname=e,this.progressCallback=t,this.resolvedImports=a,this.usesBasicOrJavaType=!1,this.additionalImports=[],this.importsToResolve=[]}static async convertMethods(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a={};for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const n=await r.getName(),i=await r.getReturnType(),s=await r.getParameterTypes(),o={returnType:await i.getTypeName(),parameters:await Promise.all(s.map((e=>e.getTypeName()))),isStatic:await t.isStatic(e)};Object.hasOwn(a,n)?a[n].push(o):a[n]=[o]}}return a}async convertFields(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a=[];for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const n=await r.getName(),i=await r.getType(),s=await i.getTypeName(),c=[o.default.factory.createModifier(o.SyntaxKind.PublicKeyword)];await t.isStatic(e)&&c.push(o.default.factory.createModifier(o.SyntaxKind.StaticKeyword)),await t.isFinal(e)&&c.push(o.default.factory.createModifier(o.SyntaxKind.ReadonlyKeyword));let d=o.default.factory.createPropertyDeclaration(c,n,void 0,this.javaTypeToTypescriptType(s,!0),void 0);d=o.default.addSyntheticLeadingComment(d,o.default.SyntaxKind.SingleLineCommentTrivia,` ================== Field ${n} ==================`,!0),a.push(o.default.addSyntheticLeadingComment(d,o.default.SyntaxKind.MultiLineCommentTrivia,`*\n * Original type: '${await i.getTypeName()}'\n `,!0))}}return a}async convertConstructors(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a=[];for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const e=await r.getParameterTypes();a.push(await Promise.all(e.map((e=>e.getTypeName()))))}}const r=a.map(((e,t)=>{const a=e.map(this.convertParameter.bind(this));let r=o.default.factory.createConstructorDeclaration([o.default.factory.createModifier(o.default.SyntaxKind.PublicKeyword)],a,void 0);return 0===t&&(r=o.default.addSyntheticLeadingComment(r,o.default.SyntaxKind.SingleLineCommentTrivia," ================== Constructors ==================",!0)),e.length>0&&(r=o.default.addSyntheticLeadingComment(r,o.default.SyntaxKind.MultiLineCommentTrivia,"*\n"+e.map(((e,t)=>` * @param var${t} original type: '${e}'\n`)).join("")+" ",!0)),r}));return[...a.map(((e,t)=>this.createMethod({returnType:this.classname,parameters:e,isStatic:!0},"newInstance",t,!1))),...r]}javaTypeToTypescriptType(e,t){switch(e){case"byte[]":case"java.lang.Byte[]":return o.default.factory.createTypeReferenceNode("Buffer")}if(e.endsWith("[]"))return o.default.factory.createArrayTypeNode(this.javaTypeToTypescriptType(e.substring(0,e.length-2),t));switch(e){case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"float":case"java.lang.Float":case"double":case"java.lang.Double":case"byte":case"java.lang.Byte":case"short":case"java.lang.Short":return o.default.factory.createKeywordTypeNode(o.default.SyntaxKind.NumberKeyword);case"char":case"java.lang.Character":case"java.lang.String":return o.default.factory.createKeywordTypeNode(o.default.SyntaxKind.StringKeyword);case"boolean":case"java.lang.Boolean":return o.default.factory.createKeywordTypeNode(o.default.SyntaxKind.BooleanKeyword);case"void":case"java.lang.Void":return o.default.factory.createKeywordTypeNode(o.default.SyntaxKind.VoidKeyword);case"java.lang.Object":return this.usesBasicOrJavaType=!0,o.default.factory.createTypeReferenceNode("BasicOrJavaType");default:this.resolvedImports.includes(e)||this.additionalImports.push(e),this.importsToResolve.push(e);const a=e===this.classname&&t;return o.default.factory.createTypeReferenceNode(e===this.classname?e.substring(e.lastIndexOf(".")+1)+(a?"Class":""):e.replaceAll(".","_"))}}convertParameter(e,t){const a="var"+t,r=this.javaTypeToTypescriptType(e,!0);return o.default.factory.createParameterDeclaration(void 0,void 0,a,void 0,r)}convertParameters(e){return e.parameters.map(this.convertParameter.bind(this))}static createMethodComment(e){return"*\n"+e.parameters.map(((e,t)=>` * @param var${t} original type: '${e}'\n`)).join("")+` * @return original return type: '${e.returnType}'\n `}createMethod(e,t,a,r){const n=o.default.factory.createModifier(o.default.SyntaxKind.PublicKeyword),i=o.default.factory.createModifier(o.default.SyntaxKind.StaticKeyword),s=[n];e.isStatic&&s.push(i);let c=this.javaTypeToTypescriptType(e.returnType,!1);r||(c=o.default.factory.createTypeReferenceNode(o.default.factory.createIdentifier("Promise"),[c]));let d=o.default.factory.createMethodDeclaration(s,void 0,t+(r?"Sync":""),void 0,void 0,this.convertParameters(e),c,void 0);return 0===a&&(d=o.default.addSyntheticLeadingComment(d,o.default.SyntaxKind.SingleLineCommentTrivia,` ================== Method ${t} ==================`,!0)),o.default.addSyntheticLeadingComment(d,o.default.SyntaxKind.MultiLineCommentTrivia,f.createMethodComment(e),!0)}convertMethod(e,t){const a=[];for(let r=0;r<e.length;r++){const n=e[r];a.push(this.createMethod(n,t,r,!1),this.createMethod(n,t,r,!0))}return a}getAdditionalImports(){const e=e=>{const t=this.classname.split("."),a=e.split(".");for(let e=0;e<t.length&&a[e]===t[e];e++)t[e]=null,a[e]=null;return"./"+t.filter((e=>!!e)).map((()=>"")).join("../")+a.filter((e=>!!e)).join("/")};return this.importsToResolve.filter((e=>e!=this.classname)).filter(((e,t,a)=>a.indexOf(e)===t)).map((t=>o.default.factory.createImportDeclaration(void 0,o.default.factory.createImportClause(!1,void 0,o.default.factory.createNamedImports([o.default.factory.createImportSpecifier(!1,o.default.factory.createIdentifier(t.substring(t.lastIndexOf(".")+1)),o.default.factory.createIdentifier(t.replaceAll(".","_")))])),o.default.factory.createStringLiteral(e(t)))))}getImports(){const e=[o.default.factory.createImportSpecifier(!1,void 0,o.default.factory.createIdentifier("importClass")),o.default.factory.createImportSpecifier(!1,void 0,o.default.factory.createIdentifier("JavaClass"))];this.usesBasicOrJavaType&&e.push(o.default.factory.createImportSpecifier(!1,void 0,o.default.factory.createIdentifier("BasicOrJavaType")));const t=o.default.factory.createNamedImports(e);return o.default.factory.createImportDeclaration(void 0,o.default.factory.createImportClause(!1,void 0,t),o.default.factory.createStringLiteral("java-bridge"))}getExportStatement(e){const t=o.default.factory.createClassDeclaration([o.default.factory.createModifier(o.default.SyntaxKind.ExportKeyword)],e,void 0,[o.default.factory.createHeritageClause(o.default.SyntaxKind.ExtendsKeyword,[o.default.factory.createExpressionWithTypeArguments(o.default.factory.createIdentifier(`importClass<typeof ${e}Class>("${this.classname}")`),void 0)])],[]);return[o.default.addSyntheticLeadingComment(t,o.SyntaxKind.MultiLineCommentTrivia,`*\n * Class ${this.classname}.\n *\n * This actually imports the java class for further use.\n * The class ${e}Class only defines types, this is the class you should actually import.\n * Please note that this statement imports the underlying java class at runtime, which may take a while.\n * This was generated by java-bridge.\n * You should probably not edit this.\n `,!0),o.default.factory.createExportDefault(o.default.factory.createIdentifier(e))]}getText(e){return e.map((e=>e&&o.default.createPrinter({newLine:o.default.NewLineKind.LineFeed}).printNode(o.default.EmitHint.Unspecified,e,u)||"")).join("\n")}async generate(){if(this.resolvedImports.includes(this.classname))return[];this.resolvedImports.push(this.classname),this.progressCallback&&this.progressCallback(this.classname);const e=(await(0,c.importClassAsync)(this.classname)).class,t=this.classname.substring(this.classname.lastIndexOf(".")+1),a=await e.getDeclaredFields(),r=await e.getDeclaredMethods(),n=await this.convertFields(a),i=await f.convertMethods(r);for(const[e,t]of Object.entries(i))n.push(...this.convertMethod(t,e));const s=await e.getDeclaredConstructors(),d=await this.convertConstructors(s);n.push(...d);let l=o.default.factory.createClassDeclaration([o.default.factory.createModifier(o.default.SyntaxKind.ExportKeyword),o.default.factory.createModifier(o.default.SyntaxKind.DeclareKeyword)],t+"Class",void 0,[o.default.factory.createHeritageClause(o.default.SyntaxKind.ExtendsKeyword,[o.default.factory.createExpressionWithTypeArguments(o.default.factory.createIdentifier("JavaClass"),void 0)])],n);l=o.default.addSyntheticLeadingComment(l,o.default.SyntaxKind.MultiLineCommentTrivia,`*\n * This class just defines types, you should import ${t} instead of this.\n * This was generated by java-bridge.\n * You should probably not edit this.\n `,!0);const u=this.getText([this.getImports(),...this.getAdditionalImports(),null,l,null,...this.getExportStatement(t)]),p=[];for(const e of this.additionalImports){const t=new f(e,this.progressCallback,this.resolvedImports),a=await t.generate();p.push(...a)}return p.push({name:this.classname,contents:u}),p}static async save(e,t){for(const a of e){const e=a.name.split(".");e[e.length-1]=e[e.length-1]+".ts";const r=l.default.join(t,...e);await d.default.promises.mkdir(l.default.dirname(r),{recursive:!0}),await d.default.promises.writeFile(r,a.contents,{encoding:"utf8"})}}}t.default=f},91:(e,t)=>{"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.JavaObject=t.JavaVersion=void 0,function(e){e.VER_1_1="1.1",e.VER_1_2="1.2",e.VER_1_4="1.4",e.VER_1_6="1.6",e.VER_1_8="1.8",e.VER_9="9",e.VER_10="10"}(a=t.JavaVersion||(t.JavaVersion={})),Object.freeze(a),t.JavaObject=class{}},236:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||r(t,e,a)},s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TypescriptDefinitionGenerator=t.getJavaVersionSync=t.getJavaVersion=t.getJavaLibPath=t.UnknownJavaClass=t.JavaClassConstructor=t.JavaClass=t.JavaClassProxy=t.JavaClassInstance=t.JavaObject=t.JavaVersion=void 0;var c=a(91);Object.defineProperty(t,"JavaVersion",{enumerable:!0,get:function(){return c.JavaVersion}}),Object.defineProperty(t,"JavaObject",{enumerable:!0,get:function(){return c.JavaObject}}),Object.defineProperty(t,"JavaClassInstance",{enumerable:!0,get:function(){return c.JavaClassInstance}}),Object.defineProperty(t,"JavaClassProxy",{enumerable:!0,get:function(){return c.JavaClassProxy}}),Object.defineProperty(t,"JavaClass",{enumerable:!0,get:function(){return c.JavaClass}}),Object.defineProperty(t,"JavaClassConstructor",{enumerable:!0,get:function(){return c.JavaClassConstructor}}),Object.defineProperty(t,"UnknownJavaClass",{enumerable:!0,get:function(){return c.UnknownJavaClass}}),i(a(818),t);const d=s(a(818));t.default=d;var l=a(163);Object.defineProperty(t,"getJavaLibPath",{enumerable:!0,get:function(){return l.getJavaLibPath}});var u=a(102);Object.defineProperty(t,"getJavaVersion",{enumerable:!0,get:function(){return u.getJavaVersion}}),Object.defineProperty(t,"getJavaVersionSync",{enumerable:!0,get:function(){return u.getJavaVersionSync}});const f=o(a(248));t.TypescriptDefinitionGenerator=f.default},818:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaInstance=t.newProxy=t.stdout=t.classpath=t.isInstanceOf=t.appendClasspath=t.importClassAsync=t.importClass=t.setClassLoader=t.getClassLoader=t.ensureJvm=void 0;const r=a(163),n=a(841);let i=null;function s(e){i||(i=new r.Java(e?.libPath,e?.version,e?.opts,e,(0,n.getJavaLibPath)(),(0,n.getNativeLibPath)()))}function o(e,t){for(const a of(0,r.getClassFields)(e["class.proxy"],t)){const n=()=>t?(0,r.getStaticField)(e,a.name):(0,r.getField)(e,a.name);a.isFinal?Object.defineProperty(e,a.name,{get:n,enumerable:!0}):Object.defineProperty(e,a.name,{get:n,set:n=>t?(0,r.setStaticField)(e,a.name,n):(0,r.setField)(e,a.name,n),enumerable:!0})}}function c(e){return o(e,!0),class extends e{constructor(...e){super(...e),o(this,!1)}static async newInstanceAsync(...e){const t=await super.newInstanceAsync(...e);return o(t,!1),t}}}function d(e){s(),i.appendClasspath(e)}var l;t.ensureJvm=s,t.getClassLoader=function(){return s(),i.classLoader},t.setClassLoader=function(e){s(),i.classLoader=e},t.importClass=function(e){return s(),c(i.importClass(e))},t.importClassAsync=async function(e){return s(),c(await i.importClassAsync(e))},t.appendClasspath=d,t.isInstanceOf=function(e,t){return s(),i.isInstanceOf(e,t)},(l=t.classpath||(t.classpath={})).append=function(e){d(e)},l.get=function(){return s(),i.loadedJars},(t.stdout||(t.stdout={})).enableRedirect=function(e,t){return s(),i.setStdoutCallbacks(e,t)},t.newProxy=function(e,t){s();const a=Object.create(null);for(const[e,r]of Object.entries(t))a[e]=(e,t,...a)=>{if(e)throw e;try{t(null,r(...a))}catch(e){e instanceof Error?t(e):t(new Error(e.toString()))}};return i.createInterfaceProxy(e,a)},t.getJavaInstance=function(){return i}},841:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaLibPath=t.getNativeLibPath=void 0;const o=s(a(17)),c=i(a(147)),d=s(a(230)),{platform:l,arch:u}=process;function f(e){const t=o.default.join(__dirname,e+".node");if(c.default.existsSync(t))return t;{const t=e.replaceAll(".","-").replace("java","java-bridge");return require&&require.resolve?require.resolve(t):a(955).resolve(t)}}function p(){return new Error(`Unsupported platform: ${l} ${u}`)}t.getNativeLibPath=function(){switch(l){case"android":switch(u){case"arm64":return f("java.android-arm64");case"arm":return f("java.android-arm-eabi");default:throw p()}case"win32":return f(`java.win32-${u}-msvc`);case"darwin":return f(`java.darwin-${u}`);case"freebsd":return f(`java.freebsd-${u}`);case"linux":switch(u){case"x64":case"arm64":return f(`java.linux-${u}-${function(){if(process.report&&"function"==typeof process.report.getReport){const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}try{return(0,c.readFileSync)("/usr/bin/ldd","utf8").includes("musl")}catch(e){return!0}}()?"musl":"gnu"}`);case"arm":return f("java.linux-arm-gnueabihf");default:throw p()}default:throw p()}},t.getJavaLibPath=function(){const e=o.default.join(__dirname,"..","java-src","build","libs");let t=d.default.sync("*.jar",{cwd:e});if(0===t.length)throw new Error(`No java lib found in ${e}`);return o.default.join(e,t[0])}},764:function(__unused_webpack_module,exports,__webpack_require__){"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&__createBinding(t,e,a);return __setModuleDefault(t,e),t},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const yargs_1=__importDefault(__webpack_require__(760)),perf_hooks_1=__webpack_require__(74),path_1=__importDefault(__webpack_require__(17)),_1=__importStar(__webpack_require__(236)),package_json_1=__webpack_require__(598),importOra=()=>eval("import('ora').then(ora => ora.default)"),importChalk=()=>eval("import('chalk').then(chalk => chalk.default)"),builder=e=>{e.positional("classnames",{describe:"The fully qualified class name(s) to convert",type:"string"}),e.positional("output",{describe:"The output file",type:"string"}),e.option("classpath",{alias:"cp",type:"string",describe:"The classpath to use"})},handler=async({classnames:e,output:t,classpath:a})=>{let r=null;try{const n=perf_hooks_1.performance.now();(0,_1.ensureJvm)({useDaemonThreads:!0}),a&&_1.default.classpath.append(a);const i=await importChalk(),s=await importOra();console.log(`Starting ${i.cyanBright("java-bridge")} ${i.greenBright("v"+package_json_1.version)} Java definition generator`);const o=(0,_1.getJavaInstance)(),c=_1.default.classpath.get();c.length>0&&console.log(`Started JVM with version ${i.cyanBright(o.version)} and classpath '${c.map((e=>i.cyanBright(e))).join(";")}'`),console.log(`Converting classes ${e.map((e=>i.magentaBright(e))).join(", ")} to typescript and saving result to ${i.cyanBright(path_1.default.normalize(t))}`),r=s().start();const d=[];let l=0,u=0,f=0,p="";const m=setInterval((()=>{f+=1,v()}),1e3),v=()=>{r.text=i.gray(`Elapsed time: ${i.yellow(f)} seconds ${i.white("|")} Converted ${i.cyanBright(l)} classes ${i.white("|")} Converting class ${i.magentaBright(p)}`)};for(const a of e){const e=new _1.TypescriptDefinitionGenerator(a,(e=>{p=e,l++,v()}),d),n=await e.generate();u+=n.length,r.text="saving results",await _1.TypescriptDefinitionGenerator.save(n,t)}clearInterval(m);const h=((perf_hooks_1.performance.now()-n)/1e3).toFixed(1);r.succeed(`Success - Converted ${i.blueBright(u)} classes in ${i.blueBright(h)} seconds`)}catch(e){r?.fail("Failed to convert classes"),console.error(e),process.exit(1)}};yargs_1.default.command("* <output> <classnames..>",!1,builder,handler).parse()},102:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaVersionSync=t.getJavaVersion=void 0;const r=a(818);t.getJavaVersion=async function(){const e=await(0,r.importClassAsync)("java.lang.System");return await e.getProperty("java.version")},t.getJavaVersionSync=function(){return(0,r.importClass)("java.lang.System").getPropertySync("java.version")}},955:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=955,e.exports=t},230:e=>{"use strict";e.exports=require("glob")},7:e=>{"use strict";e.exports=require("typescript")},760:e=>{"use strict";e.exports=require("yargs")},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")},74:e=>{"use strict";e.exports=require("perf_hooks")},598:e=>{"use strict";e.exports=JSON.parse('{"name":"java-bridge","version":"2.1.7","main":"dist/index.prod.min.js","types":"dist/ts-src/index.d.ts","description":"A bridge between Node.js and Java APIs","repository":{"type":"git","url":"git+https://github.com/MarkusJx/node-java-bridge.git"},"author":"MarkusJx","bugs":{"url":"https://github.com/MarkusJx/node-java-bridge/issues"},"homepage":"https://github.com/MarkusJx/node-java-bridge#readme","files":["dist/*.js","dist/*.map","dist/**/*.d.ts","java-src/build/libs/*.jar"],"napi":{"name":"java","triples":{"additional":["aarch64-apple-darwin","i686-pc-windows-msvc","aarch64-unknown-linux-gnu"]}},"bin":{"java-ts-gen":"./dist/java-ts-gen.js"},"license":"MIT","prettier":{"printWidth":80,"semi":true,"singleQuote":true,"tabWidth":4,"trailingComma":"es5"},"engines":{"node":">= 15"},"scripts":{"artifacts":"napi artifacts","build":"npm run build:napi","build:debug":"npm run build:napi:debug && npm run build:ts && npm run build:java","postbuild":"npm run build:ts && npm run build:java","build:napi":"napi build --platform --release --js native.js --dts native.d.ts","build:napi:debug":"napi build --platform --js native.js --dts native.d.ts","build:ts":"webpack build && cpy native.d.ts dist","build:java":"run-script-os","build:java:darwin:linux":"cd java-src && chmod +x gradlew && ./gradlew shadowJar","build:java:win32":"cd java-src && .\\\\gradlew.bat shadowJar","prepublishOnly":"napi prepublish -t npm","test":"npm run testOnly","testOnly":"mocha -r ts-node/register test/**/*.test.ts","pretest":"npm run build","version":"napi version","prettier":"prettier --write .","prebuild":"rimraf dist","prebuild:debug":"rimraf dist","benchmark":"ts-node -P test/tsconfig.json test/benchmark/benchmark.ts && ts-node -P test/tsconfig.json test/benchmark/benchmarkDaemonThreads.ts","prebenchmark":"npm run build","docs":"typedoc --out docs ts-src/index.ts"},"dependencies":{"chalk":"^5.1.2","glob":"^8.0.3","ora":"^6.1.2","typescript":"^4.9.3","yargs":"^17.6.2"},"devDependencies":{"@napi-rs/cli":"^2.12.1","@types/chai":"^4.3.4","@types/glob":"^8.0.0","@types/is-ci":"^3.0.0","@types/mocha":"^10.0.0","@types/node":"^18.11.9","@types/semver":"^7.3.13","@types/webpack-node-externals":"^2.5.3","@types/yargs":"^17.0.13","chai":"^4.3.7","cpy-cli":"^4.2.0","expose-gc":"^1.0.0","is-ci":"^3.0.1","mocha":"^10.1.0","nanobench":"^3.0.0","node-loader":"^2.0.0","prettier":"^2.7.1","rimraf":"^3.0.2","run-script-os":"^1.1.6","semver":"^7.3.8","string-replace-loader":"^3.1.0","ts-loader":"^9.4.1","ts-node":"^10.9.1","tslib":"^2.4.1","typedoc":"^0.23.21","webpack":"^5.75.0","webpack-cli":"^5.0.0","webpack-node-externals":"^3.0.0"},"optionalDependencies":{"java-bridge-darwin-arm64":"2.1.5","java-bridge-darwin-x64":"2.1.5","java-bridge-linux-x64-gnu":"2.1.5","java-bridge-win32-ia32-msvc":"2.1.5","java-bridge-win32-x64-msvc":"2.1.5","java-bridge-linux-arm64-gnu":"2.1.5"}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var a=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(a.exports,a,a.exports,__webpack_require__),a.loaded=!0,a.exports}__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),__webpack_require__.p="";var __webpack_exports__=__webpack_require__(764);return __webpack_exports__})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.java=t():e.java=t()}(global,(()=>(()=>{var __webpack_modules__={388:(e,t,a)=>{e=a.nmd(e);try{process.dlopen(e,__dirname+a(17).sep+a.p+"java.linux-x64-gnu.node")}catch(e){throw new Error("node-loader:\n"+e)}},163:(e,t,a)=>{const{existsSync:r,readFileSync:n}=a(147),{join:i}=a(17),{platform:o,arch:s}=process;let c=null,d=!1,l=null;function u(){if(process.report&&"function"==typeof process.report.getReport){const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}try{return n("/usr/bin/ldd","utf8").includes("musl")}catch(e){return!0}}switch(o){case"android":switch(s){case"arm64":d=r(i(__dirname,"java.android-arm64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.android-arm64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-android-arm64")}catch(e){l=e}break;case"arm":d=r(i(__dirname,"java.android-arm-eabi.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.android-arm-eabi.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-android-arm-eabi")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on Android ${s}`)}break;case"win32":switch(s){case"x64":d=r(i(__dirname,"java.win32-x64-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-x64-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-x64-msvc")}catch(e){l=e}break;case"ia32":d=r(i(__dirname,"java.win32-ia32-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-ia32-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-ia32-msvc")}catch(e){l=e}break;case"arm64":d=r(i(__dirname,"java.win32-arm64-msvc.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.win32-arm64-msvc.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-win32-arm64-msvc")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on Windows: ${s}`)}break;case"darwin":switch(s){case"x64":d=r(i(__dirname,"java.darwin-x64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.darwin-x64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-darwin-x64")}catch(e){l=e}break;case"arm64":d=r(i(__dirname,"java.darwin-arm64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.darwin-arm64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-darwin-arm64")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on macOS: ${s}`)}break;case"freebsd":if("x64"!==s)throw new Error(`Unsupported architecture on FreeBSD: ${s}`);d=r(i(__dirname,"java.freebsd-x64.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.freebsd-x64.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-freebsd-x64")}catch(e){l=e}break;case"linux":switch(s){case"x64":if(u()){d=r(i(__dirname,"java.linux-x64-musl.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-x64-musl.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-x64-musl")}catch(e){l=e}}else{d=r(i(__dirname,"java.linux-x64-gnu.node"));try{c=d?a(388):require("java-bridge-linux-x64-gnu")}catch(e){l=e}}break;case"arm64":if(u()){d=r(i(__dirname,"java.linux-arm64-musl.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm64-musl.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm64-musl")}catch(e){l=e}}else{d=r(i(__dirname,"java.linux-arm64-gnu.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm64-gnu.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm64-gnu")}catch(e){l=e}}break;case"arm":d=r(i(__dirname,"java.linux-arm-gnueabihf.node"));try{c=d?a(Object(function(){var e=new Error("Cannot find module './java.linux-arm-gnueabihf.node'");throw e.code="MODULE_NOT_FOUND",e}())):require("java-bridge-linux-arm-gnueabihf")}catch(e){l=e}break;default:throw new Error(`Unsupported architecture on Linux: ${s}`)}break;default:throw new Error(`Unsupported OS: ${o}, architecture: ${s}`)}if(!c){if(l)throw l;throw new Error("Failed to load native binding")}const{Java:f,getClassFields:p,getField:m,setField:y,getStaticField:v,setStaticField:h,JavaInterfaceProxy:g,StdoutRedirect:b,getJavaLibPath:_}=c;e.exports.Java=f,e.exports.getClassFields=p,e.exports.getField=m,e.exports.setField=y,e.exports.getStaticField=v,e.exports.setStaticField=h,e.exports.JavaInterfaceProxy=g,e.exports.StdoutRedirect=b,e.exports.getJavaLibPath=_},238:function(e,t,a){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TypescriptBulkDefinitionGenerator=void 0;const n=r(a(248));t.TypescriptBulkDefinitionGenerator=class{constructor(){this.declarations=[],this.resolvedImports=[]}async generate(e,t=null){let a=0;for(const r of e){const e=new n.default(r,t,this.resolvedImports),i=await e.generate();a+=i.length,this.declarations.push(...i)}return a}async save(e){await n.default.save(this.declarations,e)}get moduleDeclarations(){return this.declarations}}},248:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=i(a(7)),c=a(236),d=o(a(147)),l=o(a(17)),u=s.default.createSourceFile("source.ts","",s.default.ScriptTarget.Latest,!1,s.default.ScriptKind.TS),f=["toString","wait","getClass","hashCode","notify","notifyAll","equals"];class p{constructor(e,t=null,a=[]){this.classname=e,this.progressCallback=t,this.resolvedImports=a,this.usesBasicOrJavaType=!1,this.additionalImports=[],this.importsToResolve=[]}static async convertMethods(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a={};for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const n=await r.getName(),i=await r.getReturnType(),o=await r.getParameterTypes(),s={returnType:await i.getTypeName(),parameters:await Promise.all(o.map((e=>e.getTypeName()))),isStatic:await t.isStatic(e)};Object.hasOwn(a,n)?a[n].push(s):a[n]=[s]}}return a}async convertFields(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a=[];for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const n=await r.getName(),i=await r.getType(),o=await i.getTypeName(),c=[s.default.factory.createModifier(s.SyntaxKind.PublicKeyword)];await t.isStatic(e)&&c.push(s.default.factory.createModifier(s.SyntaxKind.StaticKeyword)),await t.isFinal(e)&&c.push(s.default.factory.createModifier(s.SyntaxKind.ReadonlyKeyword));let d=s.default.factory.createPropertyDeclaration(c,n,void 0,this.javaTypeToTypescriptType(o,!0),void 0);d=s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.SingleLineCommentTrivia,` ================== Field ${n} ==================`,!0),a.push(s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.MultiLineCommentTrivia,`*\n * Original type: '${await i.getTypeName()}'\n `,!0))}}return a}async isAbstractOrInterface(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier");return await e.isInterface()||await t.isAbstract(await e.getModifiers())}createPrivateConstructor(){const e=s.default.factory.createConstructorDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.PrivateKeyword)],[],s.default.factory.createBlock([s.default.factory.createExpressionStatement(s.default.factory.createCallExpression(s.default.factory.createSuper(),[],[]))],!0));return s.default.addSyntheticLeadingComment(e,s.default.SyntaxKind.MultiLineCommentTrivia,"*\n * Private constructor to prevent instantiation\n * as this is either an abstract class or an interface\n ",!0)}async convertConstructors(e){const t=await(0,c.importClassAsync)("java.lang.reflect.Modifier"),a=[];for(const r of e){const e=await r.getModifiers();if(await t.isPublic(e)){const e=await r.getParameterTypes();a.push(await Promise.all(e.map((e=>e.getTypeName()))))}}const r=a.map(((e,t)=>{const a=e.map(this.convertParameter.bind(this));let r=s.default.factory.createConstructorDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.PublicKeyword)],a,void 0);return 0===t&&(r=s.default.addSyntheticLeadingComment(r,s.default.SyntaxKind.SingleLineCommentTrivia," ================== Constructors ==================",!0)),e.length>0&&(r=s.default.addSyntheticLeadingComment(r,s.default.SyntaxKind.MultiLineCommentTrivia,"*\n"+e.map(((e,t)=>` * @param var${t} original type: '${e}'\n`)).join("")+" ",!0)),r}));return[...a.map(((e,t)=>this.createMethod({returnType:this.classname,parameters:e,isStatic:!0},"newInstance",t,!1,!0))),...r]}primitiveToClassType(e){switch(e){case"boolean":return"java.lang.Boolean";case"byte":return"java.lang.Byte";case"char":return"java.lang.Character";case"short":return"java.lang.Short";case"int":return"java.lang.Integer";case"long":return"java.lang.Long";case"float":return"java.lang.Float";case"double":return"java.lang.Double";default:return e}}isPrimitive(e){return["boolean","byte","char","short","int","long","float","double"].includes(e)}javaTypeToTypescriptType(e,t,a=!0){const r=e=>a?s.default.factory.createUnionTypeNode([e,s.default.factory.createLiteralTypeNode(s.default.factory.createNull())]):e;switch(e){case"byte[]":case"java.lang.Byte[]":return r(s.default.factory.createTypeReferenceNode("Buffer"))}if(e.endsWith("[]"))return r(s.default.factory.createArrayTypeNode(this.javaTypeToTypescriptType(e.substring(0,e.length-2),t)));const n=e=>{this.resolvedImports.includes(e)||this.additionalImports.push(e),this.importsToResolve.push(e);const a=e===this.classname&&t;return s.default.factory.createTypeReferenceNode(e===this.classname?e.substring(e.lastIndexOf(".")+1)+(a?"Class":""):e.replaceAll(".","_"))},i=(r,...i)=>{const o=[s.default.factory.createKeywordTypeNode(r)];return!this.isPrimitive(e)&&a&&o.push(s.default.factory.createLiteralTypeNode(s.default.factory.createNull())),t?s.default.factory.createUnionTypeNode([n(this.primitiveToClassType(e)),...i.map((e=>s.default.factory.createKeywordTypeNode(e))),...o]):s.default.factory.createUnionTypeNode(o)};switch(e){case"int":case"java.lang.Integer":case"float":case"java.lang.Float":case"double":case"java.lang.Double":case"byte":case"java.lang.Byte":case"short":case"java.lang.Short":return i(s.SyntaxKind.NumberKeyword);case"long":case"java.lang.Long":return i(s.SyntaxKind.NumberKeyword,s.SyntaxKind.BigIntKeyword);case"char":case"java.lang.Character":case"java.lang.String":return r(s.default.factory.createKeywordTypeNode(s.SyntaxKind.StringKeyword));case"boolean":case"java.lang.Boolean":return i(s.SyntaxKind.BooleanKeyword);case"void":case"java.lang.Void":return s.default.factory.createKeywordTypeNode(s.SyntaxKind.VoidKeyword);case"java.lang.Object":return this.usesBasicOrJavaType=!0,r(s.default.factory.createTypeReferenceNode("BasicOrJavaType"));default:return r(n(e))}}convertParameter(e,t){const a="var"+t,r=this.javaTypeToTypescriptType(e,!0);return s.default.factory.createParameterDeclaration(void 0,void 0,a,void 0,r)}convertParameters(e){return e.parameters.map(this.convertParameter.bind(this))}static createMethodComment(e){return"*\n"+e.parameters.map(((e,t)=>` * @param var${t} original type: '${e}'\n`)).join("")+` * @return original return type: '${e.returnType}'\n `}createMethod(e,t,a,r,n){const i=s.default.factory.createModifier(s.default.SyntaxKind.PublicKeyword),o=s.default.factory.createModifier(s.default.SyntaxKind.StaticKeyword),c=[i];e.isStatic&&c.push(o);let d=this.javaTypeToTypescriptType(e.returnType,!1,!n);r||(d=s.default.factory.createTypeReferenceNode(s.default.factory.createIdentifier("Promise"),[d]));let l=s.default.factory.createMethodDeclaration(c,void 0,t+(r?"Sync":""),void 0,void 0,this.convertParameters(e),d,void 0);return 0===a&&(l=s.default.addSyntheticLeadingComment(l,s.default.SyntaxKind.SingleLineCommentTrivia,` ================== Method ${t} ==================`,!0)),s.default.addSyntheticLeadingComment(l,s.default.SyntaxKind.MultiLineCommentTrivia,p.createMethodComment(e),!0)}convertMethod(e,t){const a=[];for(let r=0;r<e.length;r++){const n=e[r],i=f.includes(t);a.push(this.createMethod(n,t,r,!1,i),this.createMethod(n,t,r,!0,i))}return a}getAdditionalImports(){const e=e=>{const t=this.classname.split("."),a=e.split(".");for(let e=0;e<t.length&&a[e]===t[e];e++)t[e]=null,a[e]=null;return"./"+t.filter((e=>!!e)).map((()=>"")).join("../")+a.filter((e=>!!e)).join("/")};return this.importsToResolve.filter((e=>e!=this.classname)).filter(((e,t,a)=>a.indexOf(e)===t)).map((t=>s.default.factory.createImportDeclaration(void 0,s.default.factory.createImportClause(!1,void 0,s.default.factory.createNamedImports([s.default.factory.createImportSpecifier(!1,s.default.factory.createIdentifier(t.substring(t.lastIndexOf(".")+1)),s.default.factory.createIdentifier(t.replaceAll(".","_")))])),s.default.factory.createStringLiteral(e(t)))))}getImports(){const e=[s.default.factory.createImportSpecifier(!1,void 0,s.default.factory.createIdentifier("importClass")),s.default.factory.createImportSpecifier(!1,void 0,s.default.factory.createIdentifier("JavaClass"))];this.usesBasicOrJavaType&&e.push(s.default.factory.createImportSpecifier(!1,void 0,s.default.factory.createIdentifier("BasicOrJavaType")));const t=s.default.factory.createNamedImports(e);return s.default.factory.createImportDeclaration(void 0,s.default.factory.createImportClause(!1,void 0,t),s.default.factory.createStringLiteral("java-bridge"))}getExportStatement(e,t){const a=s.default.factory.createClassDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.ExportKeyword)],e,void 0,[s.default.factory.createHeritageClause(s.default.SyntaxKind.ExtendsKeyword,[s.default.factory.createExpressionWithTypeArguments(s.default.factory.createIdentifier(`importClass<typeof ${e}Class>("${this.classname}")`),void 0)])],t?[this.createPrivateConstructor()]:[]);return[s.default.addSyntheticLeadingComment(a,s.SyntaxKind.MultiLineCommentTrivia,`*\n * Class ${this.classname}.\n *\n * This actually imports the java class for further use.\n * The class ${e}Class only defines types, this is the class you should actually import.\n * Please note that this statement imports the underlying java class at runtime, which may take a while.\n * This was generated by java-bridge.\n * You should probably not edit this.\n `,!0),s.default.factory.createExportDefault(s.default.factory.createIdentifier(e))]}getText(e){return e.map((e=>e&&s.default.createPrinter({newLine:s.default.NewLineKind.LineFeed}).printNode(s.default.EmitHint.Unspecified,e,u)||"")).join("\n")}async generate(){if(this.resolvedImports.includes(this.classname))return[];this.resolvedImports.push(this.classname),this.progressCallback&&this.progressCallback(this.classname);const e=(await(0,c.importClassAsync)(this.classname)).class,t=this.classname.substring(this.classname.lastIndexOf(".")+1),a=(await e.getFields()).filter((function(e,t,a){return a.findIndex((t=>e.getNameSync()===t.getNameSync()))===t})),r=await e.getMethods(),n=await this.convertFields(a),i=await p.convertMethods(r);for(const[e,t]of Object.entries(i))n.push(...this.convertMethod(t,e));const o=await this.isAbstractOrInterface(e);if(!o){const t=await e.getDeclaredConstructors(),a=await this.convertConstructors(t);n.push(...a)}let d=s.default.factory.createClassDeclaration([s.default.factory.createModifier(s.default.SyntaxKind.ExportKeyword),s.default.factory.createModifier(s.default.SyntaxKind.DeclareKeyword)],t+"Class",void 0,[s.default.factory.createHeritageClause(s.default.SyntaxKind.ExtendsKeyword,[s.default.factory.createExpressionWithTypeArguments(s.default.factory.createIdentifier("JavaClass"),void 0)])],n);d=s.default.addSyntheticLeadingComment(d,s.default.SyntaxKind.MultiLineCommentTrivia,`*\n * This class just defines types, you should import ${t} instead of this.\n * This was generated by java-bridge.\n * You should probably not edit this.\n `,!0);const l=this.getText([this.getImports(),...this.getAdditionalImports(),null,d,null,...this.getExportStatement(t,o)]),u=[];for(const e of this.additionalImports){const t=new p(e,this.progressCallback,this.resolvedImports),a=await t.generate();u.push(...a)}return u.push({name:this.classname,contents:l}),u}static async save(e,t){for(const a of e){const e=a.name.split(".");e[e.length-1]=e[e.length-1]+".ts";const r=l.default.join(t,...e);await d.default.promises.mkdir(l.default.dirname(r),{recursive:!0}),await d.default.promises.writeFile(r,a.contents,{encoding:"utf8"})}}}t.default=p},91:(e,t)=>{"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.JavaObject=t.JavaVersion=void 0,function(e){e.VER_1_1="1.1",e.VER_1_2="1.2",e.VER_1_4="1.4",e.VER_1_6="1.6",e.VER_1_8="1.8",e.VER_9="9",e.VER_10="10"}(a=t.JavaVersion||(t.JavaVersion={})),Object.freeze(a),t.JavaObject=class{}},236:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||r(t,e,a)},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TypescriptBulkDefinitionGenerator=t.TypescriptDefinitionGenerator=t.getJavaVersionSync=t.getJavaVersion=t.getJavaLibPath=t.UnknownJavaClass=t.JavaClassConstructor=t.JavaClass=t.JavaClassProxy=t.JavaClassInstance=t.JavaObject=t.JavaVersion=void 0;var c=a(91);Object.defineProperty(t,"JavaVersion",{enumerable:!0,get:function(){return c.JavaVersion}}),Object.defineProperty(t,"JavaObject",{enumerable:!0,get:function(){return c.JavaObject}}),Object.defineProperty(t,"JavaClassInstance",{enumerable:!0,get:function(){return c.JavaClassInstance}}),Object.defineProperty(t,"JavaClassProxy",{enumerable:!0,get:function(){return c.JavaClassProxy}}),Object.defineProperty(t,"JavaClass",{enumerable:!0,get:function(){return c.JavaClass}}),Object.defineProperty(t,"JavaClassConstructor",{enumerable:!0,get:function(){return c.JavaClassConstructor}}),Object.defineProperty(t,"UnknownJavaClass",{enumerable:!0,get:function(){return c.UnknownJavaClass}}),i(a(818),t);const d=o(a(818));t.default=d;var l=a(163);Object.defineProperty(t,"getJavaLibPath",{enumerable:!0,get:function(){return l.getJavaLibPath}});var u=a(102);Object.defineProperty(t,"getJavaVersion",{enumerable:!0,get:function(){return u.getJavaVersion}}),Object.defineProperty(t,"getJavaVersionSync",{enumerable:!0,get:function(){return u.getJavaVersionSync}});const f=s(a(248));t.TypescriptDefinitionGenerator=f.default;var p=a(238);Object.defineProperty(t,"TypescriptBulkDefinitionGenerator",{enumerable:!0,get:function(){return p.TypescriptBulkDefinitionGenerator}})},818:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaInstance=t.newProxy=t.stdout=t.classpath=t.isInstanceOf=t.appendClasspathAny=t.appendClasspath=t.importClassAsync=t.importClass=t.setClassLoader=t.getClassLoader=t.ensureJvm=void 0;const r=a(163),n=a(841);let i=null;function o(e){return!i&&(i=new r.Java(e?.libPath,e?.version,e?.opts,e,(0,n.getJavaLibPath)(),(0,n.getNativeLibPath)()),!0)}function s(e,t){for(const a of(0,r.getClassFields)(e["class.proxy"],t)){const n=()=>t?(0,r.getStaticField)(e,a.name):(0,r.getField)(e,a.name);a.isFinal?Object.defineProperty(e,a.name,{get:n,enumerable:!0}):Object.defineProperty(e,a.name,{get:n,set:n=>t?(0,r.setStaticField)(e,a.name,n):(0,r.setField)(e,a.name,n),enumerable:!0})}}function c(e){return s(e,!0),class extends e{constructor(...e){super(...e),s(this,!1)}static async newInstanceAsync(...e){const t=await super.newInstanceAsync(...e);return s(t,!1),t}}}function d(e){o(),i.appendClasspath(e)}function l(e,t){o(),i.appendAnyToClasspath(e,t)}var u;t.ensureJvm=o,t.getClassLoader=function(){return o(),i.classLoader},t.setClassLoader=function(e){o(),i.classLoader=e},t.importClass=function(e){return o(),c(i.importClass(e))},t.importClassAsync=async function(e){return o(),c(await i.importClassAsync(e))},t.appendClasspath=d,t.appendClasspathAny=l,t.isInstanceOf=function(e,t){return o(),i.isInstanceOf(e,t)},(u=t.classpath||(t.classpath={})).append=function(e){d(e)},u.appendAny=function(e,t){l(e,t)},u.get=function(){return o(),i.loadedJars},(t.stdout||(t.stdout={})).enableRedirect=function(e,t){return o(),i.setStdoutCallbacks(e,t)},t.newProxy=function(e,t){o();const a=Object.create(null);for(const[e,r]of Object.entries(t))a[e]=(e,t,...a)=>{if(e)throw e;try{t(null,r(...a))}catch(e){e instanceof Error?t(e):t(new Error(e.toString()))}};return i.createInterfaceProxy(e,a)},t.getJavaInstance=function(){return i}},841:function(e,t,a){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&r(t,e,a);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaLibPath=t.getNativeLibPath=void 0;const s=o(a(17)),c=i(a(147)),d=o(a(230)),{platform:l,arch:u}=process;function f(e){const t=s.default.join(__dirname,e+".node");if(c.default.existsSync(t))return t;{const t=e.replaceAll(".","-").replace("java","java-bridge");return require&&require.resolve?require.resolve(t):a(955).resolve(t)}}function p(){return new Error(`Unsupported platform: ${l} ${u}`)}t.getNativeLibPath=function(){switch(l){case"android":switch(u){case"arm64":return f("java.android-arm64");case"arm":return f("java.android-arm-eabi");default:throw p()}case"win32":return f(`java.win32-${u}-msvc`);case"darwin":return f(`java.darwin-${u}`);case"freebsd":return f(`java.freebsd-${u}`);case"linux":switch(u){case"x64":case"arm64":return f(`java.linux-${u}-${function(){if(process.report&&"function"==typeof process.report.getReport){const{glibcVersionRuntime:e}=process.report.getReport().header;return!e}try{return(0,c.readFileSync)("/usr/bin/ldd","utf8").includes("musl")}catch(e){return!0}}()?"musl":"gnu"}`);case"arm":return f("java.linux-arm-gnueabihf");default:throw p()}default:throw p()}},t.getJavaLibPath=function(){const e=s.default.join(__dirname,"..","java-src","build","libs");let t=d.default.sync("*.jar",{cwd:e});if(0===t.length)throw new Error(`No java lib found in ${e}`);return s.default.join(e,t[0])}},764:function(__unused_webpack_module,exports,__webpack_require__){"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&__createBinding(t,e,a);return __setModuleDefault(t,e),t},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const yargs_1=__importDefault(__webpack_require__(760)),perf_hooks_1=__webpack_require__(74),path_1=__importDefault(__webpack_require__(17)),_1=__importStar(__webpack_require__(236)),package_json_1=__webpack_require__(598),importOra=()=>eval("import('ora').then(ora => ora.default)"),importChalk=()=>eval("import('chalk').then(chalk => chalk.default)"),builder=e=>{e.positional("classnames",{describe:"The fully qualified class name(s) to convert",type:"string"}),e.positional("output",{describe:"The output file",type:"string"}),e.option("classpath",{alias:"cp",type:"string",describe:"The classpath to use"})},handler=async({classnames:e,output:t,classpath:a})=>{let r=null;try{const n=perf_hooks_1.performance.now();(0,_1.ensureJvm)({useDaemonThreads:!0}),a&&_1.default.classpath.append(a);const i=await importChalk(),o=await importOra();console.log(`Starting ${i.cyanBright("java-bridge")} ${i.greenBright("v"+package_json_1.version)} Java definition generator`);const s=(0,_1.getJavaInstance)(),c=_1.default.classpath.get();c.length>0&&console.log(`Started JVM with version ${i.cyanBright(s.version)} and classpath '${c.map((e=>i.cyanBright(e))).join(";")}'`),console.log(`Converting classes ${e.map((e=>i.magentaBright(e))).join(", ")} to typescript and saving result to ${i.cyanBright(path_1.default.normalize(t))}`),r=o().start();const d=[];let l=0,u=0,f=0,p="";const m=setInterval((()=>{f+=1,y()}),1e3),y=()=>{r.text=i.gray(`Elapsed time: ${i.yellow(f)} seconds ${i.white("|")} Converted ${i.cyanBright(l)} classes ${i.white("|")} Converting class ${i.magentaBright(p)}`)};for(const a of e){const e=new _1.TypescriptDefinitionGenerator(a,(e=>{p=e,l++,y()}),d),n=await e.generate();u+=n.length,r.text="saving results",await _1.TypescriptDefinitionGenerator.save(n,t)}clearInterval(m);const v=((perf_hooks_1.performance.now()-n)/1e3).toFixed(1);r.succeed(`Success - Converted ${i.blueBright(u)} classes in ${i.blueBright(v)} seconds`)}catch(e){r?.fail("Failed to convert classes"),console.error(e),process.exit(1)}};yargs_1.default.command("* <output> <classnames..>",!1,builder,handler).parse()},102:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getJavaVersionSync=t.getJavaVersion=void 0;const r=a(818);t.getJavaVersion=async function(){const e=await(0,r.importClassAsync)("java.lang.System");return await e.getProperty("java.version")},t.getJavaVersionSync=function(){return(0,r.importClass)("java.lang.System").getPropertySync("java.version")}},955:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=955,e.exports=t},230:e=>{"use strict";e.exports=require("glob")},7:e=>{"use strict";e.exports=require("typescript")},760:e=>{"use strict";e.exports=require("yargs")},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")},74:e=>{"use strict";e.exports=require("perf_hooks")},598:e=>{"use strict";e.exports=JSON.parse('{"name":"java-bridge","version":"2.1.8-beta.1","main":"dist/index.prod.min.js","types":"dist/ts-src/index.d.ts","description":"A bridge between Node.js and Java APIs","repository":{"type":"git","url":"git+https://github.com/MarkusJx/node-java-bridge.git"},"author":"MarkusJx","bugs":{"url":"https://github.com/MarkusJx/node-java-bridge/issues"},"homepage":"https://github.com/MarkusJx/node-java-bridge#readme","files":["dist/*.js","dist/*.map","dist/**/*.d.ts","java-src/build/libs/*.jar"],"napi":{"name":"java","triples":{"additional":["aarch64-apple-darwin","i686-pc-windows-msvc","aarch64-unknown-linux-gnu"]}},"bin":{"java-ts-gen":"./dist/java-ts-gen.js"},"license":"MIT","prettier":{"printWidth":80,"semi":true,"singleQuote":true,"tabWidth":4,"trailingComma":"es5"},"engines":{"node":">= 15"},"scripts":{"artifacts":"napi artifacts","build":"npm run build:napi","build:debug":"npm run build:napi:debug && npm run build:ts && npm run build:java","postbuild":"npm run build:ts && npm run build:java","build:napi":"napi build --platform --release --js native.js --dts native.d.ts","build:napi:debug":"napi build --platform --js native.js --dts native.d.ts","build:ts":"webpack build && cpy native.d.ts dist","build:java":"run-script-os","build:java:darwin:linux":"cd java-src && chmod +x gradlew && ./gradlew shadowJar","build:java:win32":"cd java-src && .\\\\gradlew.bat shadowJar","prepublishOnly":"napi prepublish -t npm","test":"npm run testOnly","testOnly":"mocha -r ts-node/register test/*.test.ts --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json","pretestOnly":"npm run generateTestTypes","pretest":"npm run build","version":"napi version","prettier":"prettier --write .","prebuild":"rimraf dist","prebuild:debug":"rimraf dist","benchmark":"ts-node -P test/tsconfig.json test/benchmark/benchmark.ts && ts-node -P test/tsconfig.json test/benchmark/benchmarkDaemonThreads.ts","prebenchmark":"npm run build","docs":"typedoc --out docs ts-src/index.ts","generateTestTypes":"ts-node -P test/tsconfig.json test/generateTestTypes.ts"},"dependencies":{"chalk":"^5.1.2","glob":"^8.0.3","ora":"^6.1.2","typescript":"^4.9.3","yargs":"^17.6.2"},"devDependencies":{"@napi-rs/cli":"^2.13.0","@types/chai":"^4.3.4","@types/glob":"^8.0.0","@types/is-ci":"^3.0.0","@types/mocha":"^10.0.1","@types/node":"^18.11.10","@types/semver":"^7.3.13","@types/webpack-node-externals":"^2.5.3","@types/yargs":"^17.0.15","chai":"^4.3.7","cpy-cli":"^4.2.0","expose-gc":"^1.0.0","is-ci":"^3.0.1","mocha":"^10.1.0","mocha-junit-reporter":"^2.2.0","mocha-multi-reporters":"^1.5.1","nanobench":"^3.0.0","node-loader":"^2.0.0","prettier":"^2.8.0","rimraf":"^3.0.2","run-script-os":"^1.1.6","semver":"^7.3.8","string-replace-loader":"^3.1.0","ts-loader":"^9.4.2","ts-node":"^10.9.1","tslib":"^2.4.1","typedoc":"^0.23.21","webpack":"^5.75.0","webpack-cli":"^5.0.0","webpack-node-externals":"^3.0.0"},"optionalDependencies":{"java-bridge-darwin-arm64":"2.1.5","java-bridge-darwin-x64":"2.1.5","java-bridge-linux-arm64-gnu":"2.1.5","java-bridge-linux-x64-gnu":"2.1.5","java-bridge-win32-ia32-msvc":"2.1.5","java-bridge-win32-x64-msvc":"2.1.5"}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var a=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(a.exports,a,a.exports,__webpack_require__),a.loaded=!0,a.exports}__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),__webpack_require__.p="";var __webpack_exports__=__webpack_require__(764);return __webpack_exports__})()));
//# sourceMappingURL=java-ts-gen.js.map

@@ -47,2 +47,4 @@ /* tslint:disable */

useDaemonThreads?: boolean
/** Additional paths to add to the class path */
classpath?: Array<string>
}

@@ -93,2 +95,3 @@ /**

appendClasspath(classpath: string | string[]): void
appendAnyToClasspath(path: string | string[], recursive?: boolean | undefined | null): void
/** Set the stdout/stderr callbacks */

@@ -95,0 +98,0 @@ setStdoutCallbacks(stdoutCallback?: ((err: Error | null, data?: string) => void) | undefined | null, stderrCallback?: ((err: Error | null, data?: string) => void) | undefined | null): StdoutRedirect

@@ -140,3 +140,3 @@ /**

*/
instanceOf<T extends JavaClassConstructorType>(other: string | T): boolean;
instanceOf<T extends object>(other: string | T): boolean;
/**

@@ -143,0 +143,0 @@ * Default java equals implementation.

@@ -16,2 +16,3 @@ export { JavaVersion, JavaObject, JavaClassInstance, JavaClassProxy, JavaClass, JavaClassConstructor, UnknownJavaClass, JavaType, BasicOrJavaType, BasicType, JavaClassType, Constructor, UnknownJavaClassType, JavaClassConstructorType, } from './definitions';

export { TypescriptDefinitionGenerator };
export { TypescriptBulkDefinitionGenerator } from './TypescriptBulkDefinitionGenerator';
export { ModuleDeclaration, MethodDeclaration, ProgressCallback, } from './TypescriptDefinitionGenerator';

@@ -19,2 +19,7 @@ import { Java, JavaOptions } from '../native';

opts?: Array<string> | null;
/**
* Additional items to add to the class path.
* This also allows wildcard imports, e.g. `/lib/*`
*/
classpath?: string[];
}

@@ -54,5 +59,26 @@ /**

*
* ## Notes on the `classpath` option
*
* If you need to set the class path *before* jvm startup, for example
* when using libraries with custom class loaders, you'd need to call
* `ensureJvm` *before* making any other call to `java-bridge` as those
* methods may themselves call `ensureJvm` with no arguments
* (see comment above). Altering the startup classpath after jvm boot is
* not possible, you can only alter the runtime classpath using
* `appendClasspath` or `appendClasspathAny` which may not reflect
* in an altered classpath in your java application/library if your
* application is using a custom classpath (e.g. Spring Boot).
*
* Also, it is not possible to restart the jvm after is has been started
* once, in order to alter the startup classpath. This is due to some
* limitations with the destructor feature of the node.js native api,
* which may not call the destructor in time and having two jvm instances
* in the same application is not allowed by java. Additionally, destroying
* the jvm instance may cause *undefined behaviour*, which may or may not
* cause the application to crash. Let's not do that.
*
* @param options the options to use when creating the jvm
* @return true if the jvm was created and false if the jvm already existed and was not created
*/
export declare function ensureJvm(options?: JVMOptions): void;
export declare function ensureJvm(options?: JVMOptions): boolean;
/**

@@ -165,2 +191,4 @@ * Get the addon's internal class loader.

*
* **Note: This can only import single files, not directories.**
*
* ## Example

@@ -188,2 +216,23 @@ * ```ts

/**
* Append either a single or multiple jars or directories to the class path.
* This will check if the path(s) passed are directories and will
* add a trailing slash to the path if it doesn't already have one
* so the class loader will treat it as a directory. This will
* check if the file or directory exists and throw an error if it doesn't exist.
*
* ## Example
* ```ts
* appendClasspathAny('/path/to/dir');
* ```
*
* Pass multiple paths:
* ```ts
* appendClasspathAny(['/path/to/dir1', '/path/to/my.jar']);
* ```
*
* @param path the file(s) or directory(s) to add
* @param recursive whether to recursively add all files in the directory
*/
export declare function appendClasspathAny(path: string | string[], recursive?: boolean): void;
/**
* Check if `this_obj` is instance of `other`.

@@ -222,3 +271,3 @@ * This uses the native java `instanceof` operator.

*/
export declare function isInstanceOf<T extends JavaClassConstructorType>(this_obj: JavaClass, other: string | T): boolean;
export declare function isInstanceOf<T extends object>(this_obj: JavaClass, other: string | T): boolean;
/**

@@ -241,5 +290,9 @@ * Methods for altering and querying the class path.

/**
* Get the loaded jars in the class path
* @inheritDoc appendClasspathAny
*/
function appendAny(path: string | string[], recursive?: boolean): void;
/**
* Get the loaded files or directories in the class path
*
* @returns a list of the loaded jars
* @returns a list of the loaded files
*/

@@ -246,0 +299,0 @@ function get(): string[];

@@ -58,3 +58,7 @@ export interface MethodDeclaration {

private convertFields;
private isAbstractOrInterface;
private createPrivateConstructor;
private convertConstructors;
private primitiveToClassType;
private isPrimitive;
private javaTypeToTypescriptType;

@@ -61,0 +65,0 @@ private convertParameter;

{
"name": "java-bridge",
"version": "2.1.7",
"version": "2.1.8-beta.1",
"main": "dist/index.prod.min.js",

@@ -59,3 +59,4 @@ "types": "dist/ts-src/index.d.ts",

"test": "npm run testOnly",
"testOnly": "mocha -r ts-node/register test/**/*.test.ts",
"testOnly": "mocha -r ts-node/register test/*.test.ts --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json",
"pretestOnly": "npm run generateTestTypes",
"pretest": "npm run build",

@@ -68,3 +69,4 @@ "version": "napi version",

"prebenchmark": "npm run build",
"docs": "typedoc --out docs ts-src/index.ts"
"docs": "typedoc --out docs ts-src/index.ts",
"generateTestTypes": "ts-node -P test/tsconfig.json test/generateTestTypes.ts"
},

@@ -79,11 +81,11 @@ "dependencies": {

"devDependencies": {
"@napi-rs/cli": "^2.12.1",
"@napi-rs/cli": "^2.13.0",
"@types/chai": "^4.3.4",
"@types/glob": "^8.0.0",
"@types/is-ci": "^3.0.0",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.9",
"@types/mocha": "^10.0.1",
"@types/node": "^18.11.10",
"@types/semver": "^7.3.13",
"@types/webpack-node-externals": "^2.5.3",
"@types/yargs": "^17.0.13",
"@types/yargs": "^17.0.15",
"chai": "^4.3.7",

@@ -94,5 +96,7 @@ "cpy-cli": "^4.2.0",

"mocha": "^10.1.0",
"mocha-junit-reporter": "^2.2.0",
"mocha-multi-reporters": "^1.5.1",
"nanobench": "^3.0.0",
"node-loader": "^2.0.0",
"prettier": "^2.7.1",
"prettier": "^2.8.0",
"rimraf": "^3.0.2",

@@ -102,3 +106,3 @@ "run-script-os": "^1.1.6",

"string-replace-loader": "^3.1.0",
"ts-loader": "^9.4.1",
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",

@@ -112,9 +116,9 @@ "tslib": "^2.4.1",

"optionalDependencies": {
"java-bridge-win32-x64-msvc": "2.1.7",
"java-bridge-darwin-x64": "2.1.7",
"java-bridge-linux-x64-gnu": "2.1.7",
"java-bridge-darwin-arm64": "2.1.7",
"java-bridge-win32-ia32-msvc": "2.1.7",
"java-bridge-linux-arm64-gnu": "2.1.7"
"java-bridge-win32-x64-msvc": "2.1.8-beta.1",
"java-bridge-darwin-x64": "2.1.8-beta.1",
"java-bridge-linux-x64-gnu": "2.1.8-beta.1",
"java-bridge-darwin-arm64": "2.1.8-beta.1",
"java-bridge-win32-ia32-msvc": "2.1.8-beta.1",
"java-bridge-linux-arm64-gnu": "2.1.8-beta.1"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc