#!/usr/bin/env node
import { fileURLToPath as ___fileURLToPath } from "node:url";
import { dirname as ___dirname } from "node:path";
import { createRequire as ___createRequire} from "node:module";
const __filename = ___fileURLToPath(import.meta.url);
const __dirname = ___dirname(__filename);
const require = ___createRequire(import.meta.url);
var b="0123456789",D=b+"abcdefABCDEF",_=`'"\\bfnrtv`,P=_+b+"xu",W="ABCDEFGHIJKLMNOPQRSTUVWXYZ_",R=W+b;function y(t,r="Assertion failed"){if(!t){debugger;throw new Error(r)}}var S={};var w=new Proxy({},{get(t,r){return(...s)=>String(S[r]||r).replace(/\{(\d+)\}/g,(d,a)=>s[+a]??"(no placeholder)")},has(t,r){return Object.prototype.hasOwnProperty.call(S,r)}});var u;(function(t){t[t.Verbose=0]="Verbose",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error",t[t.None=4]="None"})(u||(u={}));var nt={[u.Error]:"[error]",[u.Warn]:"[warning]",[u.Info]:"[info]",[u.Verbose]:"[debug]"};var E;(function(t){function r(e){let n=e.length-2;for(;n>0&&e[n]!=="/";--n);switch(n){case-2:case-1:return e[0]==="/"?"/":".";case 0:return e.substring(0,e.indexOf("/")+1);default:return e.slice(0,n)}}t.dirname=r;function s(e){let n=e.length-2;for(;n>=0&&e[n]!=="/";--n);switch(n){case-2:case-1:return e;default:return e.endsWith("/")?e.slice(n+1,-1):e.slice(n+1)}}t.basename=s;function h(e,n){if(e==n)return"";y(c(e)&&c(n),"resolving relative paths without absolute inputs requires a filesystem"),e.endsWith("/")||(e+="/");let g=n.length;n.endsWith("/")||(n+="/");let o=Math.min(e.length,n.length),p=0,f=0;for(;f<o&&e[f]===n[f];++f)e[f]==="/"&&(p=f);if(p===e.length-1)return n.substring(e.length,g);let m="";for(let x=p+1;x<e.length;++x)(e[x]==="/"||x+1===e.length)&&(m+=m?"/..":"..");return m+n.substring(p,g)}t.relative=h;function d(e){let n=e.split("/"),g=!1;for(let o=0;o<n.length;)n[o]=="."&&o+1!=n.length?n.splice(o,1):n[o]==".."?g?o-1===0&&/\w:/i.test(n[0])?n.splice(o,1):(n.splice(o-1,2),o=o-1):++o:(g=!0,++o);return n.join("/")}t.normalize=d;function a(e,n){return y(c(e),"resolving without an absolute path requires a filesystem"),c(n)?n:d(`${e}/${n}`)}t.resolve=a;function c(e){return/^\/|^\w:\//.test(e)}t.isAbsolute=c;function C(e){let n=e.lastIndexOf(".");return n<1?{name:e,ext:""}:{name:e.substring(0,n),ext:e.substring(n)}}t.splitFilename=C;function v(e){return/\.d\.(ts|mts|cts)$/.test(e)}t.isDeclarationFilePath=v})(E||(E={}));import*as l from"../index.js";var i={Ok:0,OptionError:1,CompileError:3,ValidationError:4,OutputError:5,ExceptionThrown:6,Watching:7};I();async function I(){let t;try{let r=Date.now();t=await l.Application.bootstrapWithPlugins({},[new l.ArgumentsReader(0),new l.TypeDocReader,new l.PackageJsonReader,new l.TSConfigReader,new l.ArgumentsReader(300).ignoreErrors()]);let s=await V(t);s!==i.Watching&&(t.logger.verbose(`Full run took ${Date.now()-r}ms`),F(t.logger)),process.exit(s)}catch(r){console.error("TypeDoc exiting with unexpected error:"),console.error(r),t?.options.getValue("skipErrorChecking")&&console.error("Try turning off --skipErrorChecking. If TypeDoc still crashes, please report a bug."),process.exit(i.ExceptionThrown)}}async function V(t){if(t.options.getValue("version"))return console.log(t.toString()),i.Ok;if(t.options.getValue("help"))return console.log(t.options.getHelp()),i.Ok;if(t.options.getValue("showConfig"))return console.log(t.options.getRawValues()),i.Ok;if(t.logger.hasErrors()||t.options.getValue("treatWarningsAsErrors")&&t.logger.hasWarnings())return i.OptionError;if(t.options.getValue("watch")||process.env.TYPEDOC_FORCE_WATCH)return await t.convertAndWatch(async a=>{t.validate(a),await t.generateOutputs(a)})?i.Watching:i.OptionError;let r=await t.convert();if(!r||t.options.getValue("treatWarningsAsErrors")&&t.logger.hasWarnings())return i.CompileError;let s=t.logger.warningCount;t.validate(r);let h=t.logger.warningCount!==s||t.logger.validationWarningCount!=0;return t.logger.hasErrors()||h&&(t.options.getValue("treatWarningsAsErrors")||t.options.getValue("treatValidationWarningsAsErrors"))?i.ValidationError:t.options.getValue("emit")!=="none"&&(await t.generateOutputs(r),t.logger.hasErrors()||t.options.getValue("treatWarningsAsErrors")&&t.logger.hasWarnings())?i.OutputError:i.Ok}function F(t){let{errorCount:r,warningCount:s}=t;r?t.error(w.found_0_errors_and_1_warnings(r.toString(),s.toString())):s&&t.warn(w.found_0_errors_and_1_warnings(r.toString(),s.toString()))}
