alran 0.9.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/ALRAN_TOOLS_NOTICES.md +11 -0
  2. package/README.md +11 -16
  3. package/assets/agents/alran/skills/alran-code-product/SKILL.md +3 -3
  4. package/assets/agents/alran/skills/alran-code-product/references/account-models.md +19 -16
  5. package/chunks/{account-commands-JZ6NXTTK.js → account-commands-GW7N3MYC.js} +1 -1
  6. package/chunks/{anthropic-MN33DP4E.js → anthropic-63VE6MAE.js} +1 -1
  7. package/chunks/{application-ITGAJ4HC.js → application-WPPTE6LU.js} +1 -1
  8. package/chunks/{auth-command-V3RVPLZO.js → auth-command-36RMNQZW.js} +1 -1
  9. package/chunks/azure-openai-responses-OIP3KVKJ.js +2 -0
  10. package/chunks/chunk-2K5H5GA7.js +2 -0
  11. package/chunks/chunk-3GGKARES.js +2 -0
  12. package/chunks/chunk-5RIMHTEU.js +207 -0
  13. package/chunks/{chunk-EYK25HWR.js → chunk-5Y76VFHY.js} +1 -1
  14. package/chunks/{chunk-QIN5ZBE2.js → chunk-6DOVXX7W.js} +1 -1
  15. package/chunks/{chunk-E3GLGDGC.js → chunk-6PFI65C6.js} +1 -1
  16. package/chunks/{chunk-4PDIO3M6.js → chunk-6UXSIWCB.js} +1 -1
  17. package/chunks/{chunk-OQNU3VPS.js → chunk-C6LAAFG2.js} +2 -2
  18. package/chunks/{chunk-33CNY6GP.js → chunk-CUG7F2FN.js} +1 -1
  19. package/chunks/chunk-DFMYLGVU.js +249 -0
  20. package/chunks/{chunk-IIE366LR.js → chunk-G5MOGPZ3.js} +490 -485
  21. package/chunks/{chunk-FC4M2B7E.js → chunk-IC6A323Q.js} +1 -1
  22. package/chunks/{chunk-4X22UJQH.js → chunk-IN2Z5SSJ.js} +1 -1
  23. package/chunks/chunk-JSTSFMGK.js +70 -0
  24. package/chunks/{chunk-WWNUAU4P.js → chunk-LCC45PCZ.js} +1 -1
  25. package/chunks/{chunk-7QLAXRD2.js → chunk-MPQ6G7LH.js} +254 -254
  26. package/chunks/{chunk-FUERW2DW.js → chunk-MUXNNOSQ.js} +1 -1
  27. package/chunks/{chunk-44VPC5LA.js → chunk-NBONSNQZ.js} +1 -1
  28. package/chunks/chunk-NMKRNU5O.js +2 -0
  29. package/chunks/chunk-NVPGGFT3.js +2 -0
  30. package/chunks/chunk-NZXJAHTO.js +9 -0
  31. package/chunks/{chunk-6255CZPL.js → chunk-PCL2CVVE.js} +1 -1
  32. package/chunks/chunk-PXH4SBCS.js +3 -0
  33. package/chunks/chunk-RLJVY75P.js +28 -0
  34. package/chunks/{chunk-WYANV3IX.js → chunk-RLND4AYL.js} +1 -1
  35. package/chunks/chunk-TJC4LPRQ.js +2 -0
  36. package/chunks/chunk-U4PFHJ7Z.js +27 -0
  37. package/chunks/chunk-V2SB4U4D.js +2 -0
  38. package/chunks/chunk-VGKKKM2W.js +6 -0
  39. package/chunks/{chunk-XFCC2CI2.js → chunk-VUISZDXX.js} +1 -1
  40. package/chunks/chunk-XVGPB7TW.js +21 -0
  41. package/chunks/{chunk-CJM7ZJ6W.js → chunk-ZDI22NOK.js} +1 -1
  42. package/chunks/{data-dir-LDVKDCJ2.js → data-dir-OEPRRIOO.js} +1 -1
  43. package/chunks/{dist-2BRD4JFU.js → dist-VKYZJYR6.js} +1 -1
  44. package/chunks/{dist-EXKHRFQO.js → dist-WGTMUM3E.js} +1 -1
  45. package/chunks/{ffi-OUPK6AY6.js → ffi-EFLUAAVX.js} +1 -1
  46. package/chunks/{ffi-M5UP5J6C.js → ffi-QKKA5HYI.js} +1 -1
  47. package/chunks/{google-UJAPMFAB.js → google-RCR46TTQ.js} +1 -1
  48. package/chunks/{google-vertex-VLSF55PW.js → google-vertex-Y26T7YYR.js} +1 -1
  49. package/chunks/{install-source-JTIUC4G4.js → install-source-63OVVBMK.js} +1 -1
  50. package/chunks/launcher-2UG3JPYF.js +63 -0
  51. package/chunks/lifecycle-5IPJRP2V.js +2 -0
  52. package/chunks/{main-TQGGRHTS.js → main-7SGOQBHZ.js} +2 -2
  53. package/chunks/{mistral-ZJZUEF2X.js → mistral-NEBDKUEI.js} +1 -1
  54. package/chunks/{module-6F3E5H7Y-BN7QWGYB.js → module-6F3E5H7Y-FIMLNSCK.js} +1 -1
  55. package/chunks/{module-asyncify-R6PWJ6ZV-P4FWSBAY.js → module-asyncify-R6PWJ6ZV-Q2HJ3NOC.js} +1 -1
  56. package/chunks/{multipart-parser-L6M455MS.js → multipart-parser-JVSLI2CL.js} +1 -1
  57. package/chunks/{network-proxy-U72JCK2I.js → network-proxy-AJO7ZW3O.js} +1 -1
  58. package/chunks/openai-codex-responses-L2CIGCKO.js +2 -0
  59. package/chunks/openai-completions-C4PHW6MD.js +2 -0
  60. package/chunks/openai-responses-5NVFOW4Y.js +2 -0
  61. package/chunks/{openrouter-G2EHY5BD.js → openrouter-BKUGQT7Z.js} +1 -1
  62. package/chunks/{otel-OHXIZ666.js → otel-DRJM2PIX.js} +1 -1
  63. package/chunks/plugin-command-CIDTOPNB.js +2 -0
  64. package/chunks/provider-command-UZ7KQFAC.js +2 -0
  65. package/chunks/run-acp-command-AKDLHKMR.js +59 -0
  66. package/chunks/{run-exec-command-5ADSQR2Z.js → run-exec-command-UXTPS7LC.js} +1 -1
  67. package/chunks/{skills-command-XXXEZAG6.js → skills-command-57TF53NO.js} +1 -1
  68. package/chunks/src-5PSNGHHD.js +2 -0
  69. package/chunks/{src-IBHIRTD7.js → src-YZ26EVSY.js} +1 -1
  70. package/chunks/telemetry-3NXMCOVD.js +2 -0
  71. package/chunks/{telemetry-command-COQG2AKK.js → telemetry-command-CMDERYNN.js} +1 -1
  72. package/chunks/{tools-WDBB2JKV.js → tools-CRJR35HS.js} +1 -1
  73. package/chunks/{undici-TUGHZJSA.js → undici-O4OQVZ6I.js} +1 -1
  74. package/chunks/{update-NB6OD572.js → update-ACFAGV6F.js} +1 -1
  75. package/cli.js +2 -3
  76. package/embedded/alran-tools/cli.mjs +1 -5
  77. package/embedded/alran-tools/manifest.json +1 -1
  78. package/image-preview-worker.js +1 -1
  79. package/matrix-mcp-stdio.js +1 -1
  80. package/package.json +1 -1
  81. package/quickjs-worker.js +1 -1
  82. package/chunks/azure-openai-responses-OWHMUNKC.js +0 -2
  83. package/chunks/chunk-C3CMJAAV.js +0 -3
  84. package/chunks/chunk-ENHOPPS7.js +0 -16
  85. package/chunks/chunk-FSNYOJPJ.js +0 -2
  86. package/chunks/chunk-FXOH6TEQ.js +0 -21
  87. package/chunks/chunk-GRXX6I72.js +0 -2
  88. package/chunks/chunk-GSYHBK5Q.js +0 -6
  89. package/chunks/chunk-IWK7PZP7.js +0 -207
  90. package/chunks/chunk-KCLRJQ53.js +0 -59
  91. package/chunks/chunk-M7GW4VMR.js +0 -27
  92. package/chunks/chunk-QFUV5PX6.js +0 -2
  93. package/chunks/chunk-TW23QKAD.js +0 -3
  94. package/chunks/chunk-U7U3DJHF.js +0 -2
  95. package/chunks/chunk-WTAJMYF2.js +0 -249
  96. package/chunks/chunk-YLQXZBEL.js +0 -2
  97. package/chunks/chunk-Z6BHCXKT.js +0 -25
  98. package/chunks/chunk-Z6HBNJCA.js +0 -8
  99. package/chunks/launcher-FCZ3EDBF.js +0 -61
  100. package/chunks/lifecycle-GY435YMF.js +0 -2
  101. package/chunks/openai-codex-responses-FPCDNRL5.js +0 -2
  102. package/chunks/openai-completions-D32YW6KL.js +0 -2
  103. package/chunks/openai-responses-ZCGSENM4.js +0 -2
  104. package/chunks/plugin-command-OSAFHS7C.js +0 -2
  105. package/chunks/provider-command-SKTCHD4E.js +0 -2
  106. package/chunks/run-acp-command-SG2BDMFJ.js +0 -2
  107. package/chunks/src-DNIDEMVV.js +0 -2
  108. package/chunks/telemetry-J7ZLGF5X.js +0 -2
  109. /package/chunks/{chunk-EOR6EDNR.js → chunk-2AYWJZ72.js} +0 -0
  110. /package/chunks/{chunk-YPV2X2RG.js → chunk-4XP5XUIZ.js} +0 -0
  111. /package/chunks/{chunk-NWB7LFOK.js → chunk-5DQTVSQV.js} +0 -0
  112. /package/chunks/{chunk-OIQ336YE.js → chunk-EJN3SE5B.js} +0 -0
  113. /package/chunks/{chunk-A7GMJNA2.js → chunk-K5DTFR6D.js} +0 -0
  114. /package/chunks/{chunk-ZQOALVGL.js → chunk-R44C5DM6.js} +0 -0
  115. /package/chunks/{chunk-PNXZWSWT.js → chunk-UJCAE7SG.js} +0 -0
  116. /package/chunks/{chunk-J3KCPYZT.js → chunk-W5ZOLW7T.js} +0 -0
  117. /package/chunks/{chunk-XAGZ6ZEU.js → chunk-XLVABFJC.js} +0 -0
  118. /package/chunks/{chunk-N5SVBCUB.js → chunk-XSEU4WQD.js} +0 -0
  119. /package/chunks/{chunk-CSOUJVKM.js → chunk-Z5HOCNTZ.js} +0 -0
  120. /package/chunks/{emscripten-module-ZS3PMSDF.js → emscripten-module-3WGSFZYF.js} +0 -0
  121. /package/chunks/{emscripten-module-XPTEOIWW.js → emscripten-module-74WUXTHL.js} +0 -0
  122. /package/chunks/{emscripten-module-WYNDFH3N.js → emscripten-module-MCN4Y3N4.js} +0 -0
  123. /package/chunks/{emscripten-module-RD6P2XH5.js → emscripten-module-NEAT5LGD.js} +0 -0
  124. /package/chunks/{ffi-ORLOPBB3.js → ffi-JIGPPPF7.js} +0 -0
  125. /package/chunks/{ffi-IO7WZQNG.js → ffi-RLX77WFG.js} +0 -0
  126. /package/chunks/{pdfjs-SHZAF7PF.js → pdfjs-2UOWBGC2.js} +0 -0
  127. /package/chunks/{photon_rs-C52RL4CI.js → photon_rs-MVWYTYTO.js} +0 -0
@@ -0,0 +1,21 @@
1
+ import { createRequire as __alran_cR } from "module"; import { basename as __alran_basename, dirname as __alran_dirname, join as __alran_join } from "path"; import { fileURLToPath as __alran_fileURLToPath, pathToFileURL as __alran_pathToFileURL } from "url"; const __alran_tuiCurrentModuleDir = __alran_dirname(__alran_fileURLToPath(import.meta.url)); const __alran_tuiPackageRoot = __alran_basename(__alran_tuiCurrentModuleDir) === "chunks" ? __alran_dirname(__alran_tuiCurrentModuleDir) : __alran_tuiCurrentModuleDir; const __alran_tuiPackageEntryUrl = __alran_pathToFileURL(__alran_join(__alran_tuiPackageRoot, "cli.js")).href; const require = __alran_cR(__alran_tuiPackageEntryUrl); const __dirname = __alran_tuiPackageRoot;
2
+ import{o as $t}from"./chunk-VUISZDXX.js";import{a as Fe,c as ce,e as Io}from"./chunk-XQK7JM66.js";var Ys=ce((Fp,qs)=>{var Ve=Fe("constants");var uc=process.cwd;var At=null;var cc=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!At)At=uc.call(process);return At};try{process.cwd()}catch(e){}if(typeof process.chdir==="function"){to=process.chdir;process.chdir=function(e){At=null;to.call(process,e)};if(Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,to)}var to;qs.exports=fc;function fc(e){if(Ve.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)){n(e)}if(!e.lutimes){t(e)}e.chown=a(e.chown);e.fchown=a(e.fchown);e.lchown=a(e.lchown);e.chmod=o(e.chmod);e.fchmod=o(e.fchmod);e.lchmod=o(e.lchmod);e.chownSync=l(e.chownSync);e.fchownSync=l(e.fchownSync);e.lchownSync=l(e.lchownSync);e.chmodSync=i(e.chmodSync);e.fchmodSync=i(e.fchmodSync);e.lchmodSync=i(e.lchmodSync);e.stat=c(e.stat);e.fstat=c(e.fstat);e.lstat=c(e.lstat);e.statSync=d(e.statSync);e.fstatSync=d(e.fstatSync);e.lstatSync=d(e.lstatSync);if(e.chmod&&!e.lchmod){e.lchmod=function(u,m,y){if(y)process.nextTick(y)};e.lchmodSync=function(){}}if(e.chown&&!e.lchown){e.lchown=function(u,m,y,x){if(x)process.nextTick(x)};e.lchownSync=function(){}}if(cc==="win32"){e.rename=typeof e.rename!=="function"?e.rename:(function(u){function m(y,x,w){var T=Date.now();var D=0;u(y,x,function N(U){if(U&&(U.code==="EACCES"||U.code==="EPERM"||U.code==="EBUSY")&&Date.now()-T<6e4){setTimeout(function(){e.stat(x,function(G,W){if(G&&G.code==="ENOENT")u(y,x,N);else w(U)})},D);if(D<100)D+=10;return}if(w)w(U)})}if(Object.setPrototypeOf)Object.setPrototypeOf(m,u);return m})(e.rename)}e.read=typeof e.read!=="function"?e.read:(function(u){function m(y,x,w,T,D,N){var U;if(N&&typeof N==="function"){var G=0;U=function(W,le,Me){if(W&&W.code==="EAGAIN"&&G<10){G++;return u.call(e,y,x,w,T,D,U)}N.apply(this,arguments)}}return u.call(e,y,x,w,T,D,U)}if(Object.setPrototypeOf)Object.setPrototypeOf(m,u);return m})(e.read);e.readSync=typeof e.readSync!=="function"?e.readSync:(function(u){return function(m,y,x,w,T){var D=0;while(true){try{return u.call(e,m,y,x,w,T)}catch(N){if(N.code==="EAGAIN"&&D<10){D++;continue}throw N}}}})(e.readSync);function n(u){u.lchmod=function(m,y,x){u.open(m,Ve.O_WRONLY|Ve.O_SYMLINK,y,function(w,T){if(w){if(x)x(w);return}u.fchmod(T,y,function(D){u.close(T,function(N){if(x)x(D||N)})})})};u.lchmodSync=function(m,y){var x=u.openSync(m,Ve.O_WRONLY|Ve.O_SYMLINK,y);var w=true;var T;try{T=u.fchmodSync(x,y);w=false}finally{if(w){try{u.closeSync(x)}catch(D){}}else{u.closeSync(x)}}return T}}function t(u){if(Ve.hasOwnProperty("O_SYMLINK")&&u.futimes){u.lutimes=function(m,y,x,w){u.open(m,Ve.O_SYMLINK,function(T,D){if(T){if(w)w(T);return}u.futimes(D,y,x,function(N){u.close(D,function(U){if(w)w(N||U)})})})};u.lutimesSync=function(m,y,x){var w=u.openSync(m,Ve.O_SYMLINK);var T;var D=true;try{T=u.futimesSync(w,y,x);D=false}finally{if(D){try{u.closeSync(w)}catch(N){}}else{u.closeSync(w)}}return T}}else if(u.futimes){u.lutimes=function(m,y,x,w){if(w)process.nextTick(w)};u.lutimesSync=function(){}}}function o(u){if(!u)return u;return function(m,y,x){return u.call(e,m,y,function(w){if(f(w))w=null;if(x)x.apply(this,arguments)})}}function i(u){if(!u)return u;return function(m,y){try{return u.call(e,m,y)}catch(x){if(!f(x))throw x}}}function a(u){if(!u)return u;return function(m,y,x,w){return u.call(e,m,y,x,function(T){if(f(T))T=null;if(w)w.apply(this,arguments)})}}function l(u){if(!u)return u;return function(m,y,x){try{return u.call(e,m,y,x)}catch(w){if(!f(w))throw w}}}function c(u){if(!u)return u;return function(m,y,x){if(typeof y==="function"){x=y;y=null}function w(T,D){if(D){if(D.uid<0)D.uid+=4294967296;if(D.gid<0)D.gid+=4294967296}if(x)x.apply(this,arguments)}return y?u.call(e,m,y,w):u.call(e,m,w)}}function d(u){if(!u)return u;return function(m,y){var x=y?u.call(e,m,y):u.call(e,m);if(x){if(x.uid<0)x.uid+=4294967296;if(x.gid<0)x.gid+=4294967296}return x}}function f(u){if(!u)return true;if(u.code==="ENOSYS")return true;var m=!process.getuid||process.getuid()!==0;if(m){if(u.code==="EINVAL"||u.code==="EPERM")return true}return false}}});var Xs=ce((Bp,Hs)=>{var Ws=Fe("stream").Stream;Hs.exports=dc;function dc(e){return{ReadStream:n,WriteStream:t};function n(o,i){if(!(this instanceof n))return new n(o,i);Ws.call(this);var a=this;this.path=o;this.fd=null;this.readable=true;this.paused=false;this.flags="r";this.mode=438;this.bufferSize=64*1024;i=i||{};var l=Object.keys(i);for(var c=0,d=l.length;c<d;c++){var f=l[c];this[f]=i[f]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if("number"!==typeof this.start){throw TypeError("start must be a Number")}if(this.end===void 0){this.end=Infinity}else if("number"!==typeof this.end){throw TypeError("end must be a Number")}if(this.start>this.end){throw new Error("start must be <= end")}this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(u,m){if(u){a.emit("error",u);a.readable=false;return}a.fd=m;a.emit("open",m);a._read()})}function t(o,i){if(!(this instanceof t))return new t(o,i);Ws.call(this);this.path=o;this.fd=null;this.writable=true;this.flags="w";this.encoding="binary";this.mode=438;this.bytesWritten=0;i=i||{};var a=Object.keys(i);for(var l=0,c=a.length;l<c;l++){var d=a[l];this[d]=i[d]}if(this.start!==void 0){if("number"!==typeof this.start){throw TypeError("start must be a Number")}if(this.start<0){throw new Error("start must be >= zero")}this.pos=this.start}this.busy=false;this._queue=[];if(this.fd===null){this._open=e.open;this._queue.push([this._open,this.path,this.flags,this.mode,void 0]);this.flush()}}}});var Js=ce((Up,zs)=>{"use strict";zs.exports=mc;var pc=Object.getPrototypeOf||function(e){return e.__proto__};function mc(e){if(e===null||typeof e!=="object")return e;if(e instanceof Object)var n={__proto__:pc(e)};else var n=Object.create(null);Object.getOwnPropertyNames(e).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))});return n}});var so=ce((jp,io)=>{var J=Fe("fs");var gc=Ys();var yc=Xs();var hc=Js();var _t=Fe("util");var re;var xt;if(typeof Symbol==="function"&&typeof Symbol.for==="function"){re=Symbol.for("graceful-fs.queue");xt=Symbol.for("graceful-fs.previous")}else{re="___graceful-fs.queue";xt="___graceful-fs.previous"}function bc(){}function ea(e,n){Object.defineProperty(e,re,{get:function(){return n}})}var Je=bc;if(_t.debuglog)Je=_t.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))Je=function(){var e=_t.format.apply(_t,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: ");console.error(e)};if(!J[re]){Qs=global[re]||[];ea(J,Qs);J.close=(function(e){function n(t,o){return e.call(J,t,function(i){if(!i){Zs()}if(typeof o==="function")o.apply(this,arguments)})}Object.defineProperty(n,xt,{value:e});return n})(J.close);J.closeSync=(function(e){function n(t){e.apply(J,arguments);Zs()}Object.defineProperty(n,xt,{value:e});return n})(J.closeSync);if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")){process.on("exit",function(){Je(J[re]);Fe("assert").equal(J[re].length,0)})}}var Qs;if(!global[re]){ea(global,J[re])}io.exports=ro(hc(J));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!J.__patched){io.exports=ro(J);J.__patched=true}function ro(e){gc(e);e.gracefulify=ro;e.createReadStream=le;e.createWriteStream=Me;var n=e.readFile;e.readFile=t;function t(M,j,I){if(typeof j==="function")I=j,j=null;return Q(M,j,I);function Q(X,K,$,k){return n(X,K,function(V){if(V&&(V.code==="EMFILE"||V.code==="ENFILE"))dn([Q,[X,K,$],V,k||Date.now(),Date.now()]);else{if(typeof $==="function")$.apply(this,arguments)}})}}var o=e.writeFile;e.writeFile=i;function i(M,j,I,Q){if(typeof I==="function")Q=I,I=null;return X(M,j,I,Q);function X(K,$,k,V,Y){return o(K,$,k,function(q){if(q&&(q.code==="EMFILE"||q.code==="ENFILE"))dn([X,[K,$,k,V],q,Y||Date.now(),Date.now()]);else{if(typeof V==="function")V.apply(this,arguments)}})}}var a=e.appendFile;if(a)e.appendFile=l;function l(M,j,I,Q){if(typeof I==="function")Q=I,I=null;return X(M,j,I,Q);function X(K,$,k,V,Y){return a(K,$,k,function(q){if(q&&(q.code==="EMFILE"||q.code==="ENFILE"))dn([X,[K,$,k,V],q,Y||Date.now(),Date.now()]);else{if(typeof V==="function")V.apply(this,arguments)}})}}var c=e.copyFile;if(c)e.copyFile=d;function d(M,j,I,Q){if(typeof I==="function"){Q=I;I=0}return X(M,j,I,Q);function X(K,$,k,V,Y){return c(K,$,k,function(q){if(q&&(q.code==="EMFILE"||q.code==="ENFILE"))dn([X,[K,$,k,V],q,Y||Date.now(),Date.now()]);else{if(typeof V==="function")V.apply(this,arguments)}})}}var f=e.readdir;e.readdir=m;var u=/^v[0-5]\./;function m(M,j,I){if(typeof j==="function")I=j,j=null;var Q=u.test(process.version)?function K($,k,V,Y){return f($,X($,k,V,Y))}:function K($,k,V,Y){return f($,k,X($,k,V,Y))};return Q(M,j,I);function X(K,$,k,V){return function(Y,q){if(Y&&(Y.code==="EMFILE"||Y.code==="ENFILE"))dn([Q,[K,$,k],Y,V||Date.now(),Date.now()]);else{if(q&&q.sort)q.sort();if(typeof k==="function")k.call(this,Y,q)}}}}if(process.version.substr(0,4)==="v0.8"){var y=yc(e);N=y.ReadStream;G=y.WriteStream}var x=e.ReadStream;if(x){N.prototype=Object.create(x.prototype);N.prototype.open=U}var w=e.WriteStream;if(w){G.prototype=Object.create(w.prototype);G.prototype.open=W}Object.defineProperty(e,"ReadStream",{get:function(){return N},set:function(M){N=M},enumerable:true,configurable:true});Object.defineProperty(e,"WriteStream",{get:function(){return G},set:function(M){G=M},enumerable:true,configurable:true});var T=N;Object.defineProperty(e,"FileReadStream",{get:function(){return T},set:function(M){T=M},enumerable:true,configurable:true});var D=G;Object.defineProperty(e,"FileWriteStream",{get:function(){return D},set:function(M){D=M},enumerable:true,configurable:true});function N(M,j){if(this instanceof N)return x.apply(this,arguments),this;else return N.apply(Object.create(N.prototype),arguments)}function U(){var M=this;me(M.path,M.flags,M.mode,function(j,I){if(j){if(M.autoClose)M.destroy();M.emit("error",j)}else{M.fd=I;M.emit("open",I);M.read()}})}function G(M,j){if(this instanceof G)return w.apply(this,arguments),this;else return G.apply(Object.create(G.prototype),arguments)}function W(){var M=this;me(M.path,M.flags,M.mode,function(j,I){if(j){M.destroy();M.emit("error",j)}else{M.fd=I;M.emit("open",I)}})}function le(M,j){return new e.ReadStream(M,j)}function Me(M,j){return new e.WriteStream(M,j)}var Ae=e.open;e.open=me;function me(M,j,I,Q){if(typeof I==="function")Q=I,I=null;return X(M,j,I,Q);function X(K,$,k,V,Y){return Ae(K,$,k,function(q,Ie){if(q&&(q.code==="EMFILE"||q.code==="ENFILE"))dn([X,[K,$,k,V],q,Y||Date.now(),Date.now()]);else{if(typeof V==="function")V.apply(this,arguments)}})}}return e}function dn(e){Je("ENQUEUE",e[0].name,e[1]);J[re].push(e);oo()}var Ct;function Zs(){var e=Date.now();for(var n=0;n<J[re].length;++n){if(J[re][n].length>2){J[re][n][3]=e;J[re][n][4]=e}}oo()}function oo(){clearTimeout(Ct);Ct=void 0;if(J[re].length===0)return;var e=J[re].shift();var n=e[0];var t=e[1];var o=e[2];var i=e[3];var a=e[4];if(i===void 0){Je("RETRY",n.name,t);n.apply(null,t)}else if(Date.now()-i>=6e4){Je("TIMEOUT",n.name,t);var l=t.pop();if(typeof l==="function")l.call(null,o)}else{var c=Date.now()-a;var d=Math.max(a-i,1);var f=Math.min(d*1.2,100);if(c>=f){Je("RETRY",n.name,t);n.apply(null,t.concat([i]))}else{J[re].push(e)}}if(Ct===void 0){Ct=setTimeout(oo,0)}}});var ta=ce((Kp,na)=>{function pe(e,n){if(typeof n==="boolean"){n={forever:n}}this._originalTimeouts=JSON.parse(JSON.stringify(e));this._timeouts=e;this._options=n||{};this._maxRetryTime=n&&n.maxRetryTime||Infinity;this._fn=null;this._errors=[];this._attempts=1;this._operationTimeout=null;this._operationTimeoutCb=null;this._timeout=null;this._operationStart=null;if(this._options.forever){this._cachedTimeouts=this._timeouts.slice(0)}}na.exports=pe;pe.prototype.reset=function(){this._attempts=1;this._timeouts=this._originalTimeouts};pe.prototype.stop=function(){if(this._timeout){clearTimeout(this._timeout)}this._timeouts=[];this._cachedTimeouts=null};pe.prototype.retry=function(e){if(this._timeout){clearTimeout(this._timeout)}if(!e){return false}var n=new Date().getTime();if(e&&n-this._operationStart>=this._maxRetryTime){this._errors.unshift(new Error("RetryOperation timeout occurred"));return false}this._errors.push(e);var t=this._timeouts.shift();if(t===void 0){if(this._cachedTimeouts){this._errors.splice(this._errors.length-1,this._errors.length);this._timeouts=this._cachedTimeouts.slice(0);t=this._timeouts.shift()}else{return false}}var o=this;var i=setTimeout(function(){o._attempts++;if(o._operationTimeoutCb){o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout);if(o._options.unref){o._timeout.unref()}}o._fn(o._attempts)},t);if(this._options.unref){i.unref()}return true};pe.prototype.attempt=function(e,n){this._fn=e;if(n){if(n.timeout){this._operationTimeout=n.timeout}if(n.cb){this._operationTimeoutCb=n.cb}}var t=this;if(this._operationTimeoutCb){this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)}this._operationStart=new Date().getTime();this._fn(this._attempts)};pe.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated");this.attempt(e)};pe.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated");this.attempt(e)};pe.prototype.start=pe.prototype.try;pe.prototype.errors=function(){return this._errors};pe.prototype.attempts=function(){return this._attempts};pe.prototype.mainError=function(){if(this._errors.length===0){return null}var e={};var n=null;var t=0;for(var o=0;o<this._errors.length;o++){var i=this._errors[o];var a=i.message;var l=(e[a]||0)+1;e[a]=l;if(l>=t){n=i;t=l}}return n}});var ra=ce(Qe=>{var Ac=ta();Qe.operation=function(e){var n=Qe.timeouts(e);return new Ac(n,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};Qe.timeouts=function(e){if(e instanceof Array){return[].concat(e)}var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:Infinity,randomize:false};for(var t in e){n[t]=e[t]}if(n.minTimeout>n.maxTimeout){throw new Error("minTimeout is greater than maxTimeout")}var o=[];for(var i=0;i<n.retries;i++){o.push(this.createTimeout(i,n))}if(e&&e.forever&&!o.length){o.push(this.createTimeout(i,n))}o.sort(function(a,l){return a-l});return o};Qe.createTimeout=function(e,n){var t=n.randomize?Math.random()+1:1;var o=Math.round(t*n.minTimeout*Math.pow(n.factor,e));o=Math.min(o,n.maxTimeout);return o};Qe.wrap=function(e,n,t){if(n instanceof Array){t=n;n=null}if(!t){t=[];for(var o in e){if(typeof e[o]==="function"){t.push(o)}}}for(var i=0;i<t.length;i++){var a=t[i];var l=e[a];e[a]=function c(d){var f=Qe.operation(n);var u=Array.prototype.slice.call(arguments,1);var m=u.pop();u.push(function(y){if(f.retry(y)){return}if(y){arguments[0]=f.mainError()}m.apply(this,arguments)});f.attempt(function(){d.apply(e,u)})}.bind(e,l);e[a].options=n}}});var ia=ce((Vp,oa)=>{oa.exports=ra()});var sa=ce(($p,St)=>{St.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32"){St.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(process.platform==="linux"){St.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}});var fa=ce((qp,gn)=>{var H=global.process;var Ze=function(e){return e&&typeof e==="object"&&typeof e.removeListener==="function"&&typeof e.emit==="function"&&typeof e.reallyExit==="function"&&typeof e.listeners==="function"&&typeof e.kill==="function"&&typeof e.pid==="number"&&typeof e.on==="function"};if(!Ze(H)){gn.exports=function(){return function(){}}}else{aa=Fe("assert");pn=sa();la=/^win/i.test(H.platform);Un=Fe("events");if(typeof Un!=="function"){Un=Un.EventEmitter}if(H.__signal_exit_emitter__){te=H.__signal_exit_emitter__}else{te=H.__signal_exit_emitter__=new Un;te.count=0;te.emitted={}}if(!te.infinite){te.setMaxListeners(Infinity);te.infinite=true}gn.exports=function(e,n){if(!Ze(global.process)){return function(){}}aa.equal(typeof e,"function","a callback must be provided for exit handler");if(mn===false){ao()}var t="exit";if(n&&n.alwaysLast){t="afterexit"}var o=function(){te.removeListener(t,e);if(te.listeners("exit").length===0&&te.listeners("afterexit").length===0){Rt()}};te.on(t,e);return o};Rt=function e(){if(!mn||!Ze(global.process)){return}mn=false;pn.forEach(function(n){try{H.removeListener(n,vt[n])}catch(t){}});H.emit=Et;H.reallyExit=lo;te.count-=1};gn.exports.unload=Rt;en=function e(n,t,o){if(te.emitted[n]){return}te.emitted[n]=true;te.emit(n,t,o)};vt={};pn.forEach(function(e){vt[e]=function n(){if(!Ze(global.process)){return}var t=H.listeners(e);if(t.length===te.count){Rt();en("exit",null,e);en("afterexit",null,e);if(la&&e==="SIGHUP"){e="SIGINT"}H.kill(H.pid,e)}}});gn.exports.signals=function(){return pn};mn=false;ao=function e(){if(mn||!Ze(global.process)){return}mn=true;te.count+=1;pn=pn.filter(function(n){try{H.on(n,vt[n]);return true}catch(t){return false}});H.emit=ca;H.reallyExit=ua};gn.exports.load=ao;lo=H.reallyExit;ua=function e(n){if(!Ze(global.process)){return}H.exitCode=n||0;en("exit",H.exitCode,null);en("afterexit",H.exitCode,null);lo.call(H,H.exitCode)};Et=H.emit;ca=function e(n,t){if(n==="exit"&&Ze(global.process)){if(t!==void 0){H.exitCode=t}var o=Et.apply(this,arguments);en("exit",H.exitCode,null);en("afterexit",H.exitCode,null);return o}else{return Et.apply(this,arguments)}}}var aa;var pn;var la;var Un;var te;var Rt;var en;var vt;var mn;var ao;var lo;var ua;var Et;var ca});var pa=ce((Yp,uo)=>{"use strict";var da=Symbol();function _c(e,n,t){const o=n[da];if(o){return n.stat(e,(a,l)=>{if(a){return t(a)}t(null,l.mtime,o)})}const i=new Date(Math.ceil(Date.now()/1e3)*1e3+5);n.utimes(e,i,i,a=>{if(a){return t(a)}n.stat(e,(l,c)=>{if(l){return t(l)}const d=c.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(n,da,{value:d});t(null,c.mtime,d)})})}function Cc(e){let n=Date.now();if(e==="s"){n=Math.ceil(n/1e3)*1e3}return new Date(n)}uo.exports.probe=_c;uo.exports.getMtime=Cc});var ba=ce((Wp,Kn)=>{"use strict";var xc=Fe("path");var po=so();var Sc=ia();var Rc=fa();var ma=pa();var we={};function jn(e,n){return n.lockfilePath||`${e}.lock`}function mo(e,n,t){if(!n.realpath){return t(null,xc.resolve(e))}n.fs.realpath(e,t)}function fo(e,n,t){const o=jn(e,n);n.fs.mkdir(o,i=>{if(!i){return ma.probe(o,n.fs,(a,l,c)=>{if(a){n.fs.rmdir(o,()=>{});return t(a)}t(null,l,c)})}if(i.code!=="EEXIST"){return t(i)}if(n.stale<=0){return t(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}))}n.fs.stat(o,(a,l)=>{if(a){if(a.code==="ENOENT"){return fo(e,{...n,stale:0},t)}return t(a)}if(!ga(l,n)){return t(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}))}ya(e,n,c=>{if(c){return t(c)}fo(e,{...n,stale:0},t)})})})}function ga(e,n){return e.mtime.getTime()<Date.now()-n.stale}function ya(e,n,t){n.fs.rmdir(jn(e,n),o=>{if(o&&o.code!=="ENOENT"){return t(o)}t()})}function kt(e,n){const t=we[e];if(t.updateTimeout){return}t.updateDelay=t.updateDelay||n.update;t.updateTimeout=setTimeout(()=>{t.updateTimeout=null;n.fs.stat(t.lockfilePath,(o,i)=>{const a=t.lastUpdate+n.stale<Date.now();if(o){if(o.code==="ENOENT"||a){return co(e,t,Object.assign(o,{code:"ECOMPROMISED"}))}t.updateDelay=1e3;return kt(e,n)}const l=t.mtime.getTime()===i.mtime.getTime();if(!l){return co(e,t,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}))}const c=ma.getMtime(t.mtimePrecision);n.fs.utimes(t.lockfilePath,c,c,d=>{const f=t.lastUpdate+n.stale<Date.now();if(t.released){return}if(d){if(d.code==="ENOENT"||f){return co(e,t,Object.assign(d,{code:"ECOMPROMISED"}))}t.updateDelay=1e3;return kt(e,n)}t.mtime=c;t.lastUpdate=Date.now();t.updateDelay=null;kt(e,n)})})},t.updateDelay);if(t.updateTimeout.unref){t.updateTimeout.unref()}}function co(e,n,t){n.released=true;if(n.updateTimeout){clearTimeout(n.updateTimeout)}if(we[e]===n){delete we[e]}n.options.onCompromised(t)}function vc(e,n,t){n={stale:1e4,update:null,realpath:true,retries:0,fs:po,onCompromised:o=>{throw o},...n};n.retries=n.retries||0;n.retries=typeof n.retries==="number"?{retries:n.retries}:n.retries;n.stale=Math.max(n.stale||0,2e3);n.update=n.update==null?n.stale/2:n.update||0;n.update=Math.max(Math.min(n.update,n.stale/2),1e3);mo(e,n,(o,i)=>{if(o){return t(o)}const a=Sc.operation(n.retries);a.attempt(()=>{fo(i,n,(l,c,d)=>{if(a.retry(l)){return}if(l){return t(a.mainError())}const f=we[i]={lockfilePath:jn(i,n),mtime:c,mtimePrecision:d,options:n,lastUpdate:Date.now()};kt(i,n);t(null,u=>{if(f.released){return u&&u(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}))}ha(i,{...n,realpath:false},u)})})})})}function ha(e,n,t){n={fs:po,realpath:true,...n};mo(e,n,(o,i)=>{if(o){return t(o)}const a=we[i];if(!a){return t(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}))}a.updateTimeout&&clearTimeout(a.updateTimeout);a.released=true;delete we[i];ya(i,n,t)})}function Ec(e,n,t){n={stale:1e4,realpath:true,fs:po,...n};n.stale=Math.max(n.stale||0,2e3);mo(e,n,(o,i)=>{if(o){return t(o)}n.fs.stat(jn(i,n),(a,l)=>{if(a){return a.code==="ENOENT"?t(null,false):t(a)}return t(null,!ga(l,n))})})}function kc(){return we}Rc(()=>{for(const e in we){const n=we[e].options;try{n.fs.rmdirSync(jn(e,n))}catch(t){}}});Kn.exports.lock=vc;Kn.exports.unlock=ha;Kn.exports.check=Ec;Kn.exports.getLocks=kc});var _a=ce((Hp,Aa)=>{"use strict";var Tc=so();function wc(e){const n=["mkdir","realpath","stat","rmdir","utimes"];const t={...e};n.forEach(o=>{t[o]=(...i)=>{const a=i.pop();let l;try{l=e[`${o}Sync`](...i)}catch(c){return a(c)}a(null,l)}});return t}function Oc(e){return(...n)=>new Promise((t,o)=>{n.push((i,a)=>{if(i){o(i)}else{t(a)}});e(...n)})}function Mc(e){return(...n)=>{let t;let o;n.push((i,a)=>{t=i;o=a});e(...n);if(t){throw t}return o}}function Ic(e){e={...e};e.fs=wc(e.fs||Tc);if(typeof e.retries==="number"&&e.retries>0||e.retries&&typeof e.retries.retries==="number"&&e.retries.retries>0){throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"})}return e}Aa.exports={toPromise:Oc,toSync:Mc,toSyncOptions:Ic}});var yo=ce((Xp,$e)=>{"use strict";var yn=ba();var{toPromise:Tt,toSync:wt,toSyncOptions:go}=_a();async function Ca(e,n){const t=await Tt(yn.lock)(e,n);return Tt(t)}function Lc(e,n){const t=wt(yn.lock)(e,go(n));return wt(t)}function Pc(e,n){return Tt(yn.unlock)(e,n)}function Dc(e,n){return wt(yn.unlock)(e,go(n))}function Nc(e,n){return Tt(yn.check)(e,n)}function Fc(e,n){return wt(yn.check)(e,go(n))}$e.exports=Ca;$e.exports.lock=Ca;$e.exports.unlock=Pc;$e.exports.lockSync=Lc;$e.exports.unlockSync=Dc;$e.exports.check=Nc;$e.exports.checkSync=Fc});var tl={max_image_bytes_inline:10485760,max_video_bytes_inline:52428800,max_request_body_bytes:67108864,max_attachments_count:4};var Lo={max_image_bytes_inline:10485760,max_video_bytes_inline:52428800,max_request_body_bytes:67108864,max_attachments_count:4,max_images_per_request:20};var Ce={"Alran-Werk":{name:"Ottili Werk 1.1",family:"coding",attachment:true,reasoning:true,tool_call:true,temperature:true,modalities:{input:["text","image"],output:["text"]},limit:{context:1e6,output:256e3},options:{reasoningSummary:"auto"},thinking:{effortOptions:["minimal","low","medium","high","xhigh","max"],defaultEffort:"medium"},thinking_config:{mode:"switchable",default_value:"true"},variants:{"none-thinking":{thinking:{type:"disabled"}},thinking:{thinking:{type:"adaptive"}}},capabilities:tl},"anthropic/claude-sonnet-5.5":{name:"Claude Sonnet 5.5",family:"anthropic",attachment:true,reasoning:true,tool_call:true,temperature:false,modalities:{input:["text","image"],output:["text"]},limit:{context:1e6,output:128e3},thinking:{effortOptions:["low","medium","high","xhigh"],defaultEffort:"medium"},thinking_config:{mode:"always_on"},variants:{thinking:{thinking:{type:"adaptive"}}},max_data_class:"public",capabilities:Lo},"anthropic/claude-opus-5.5":{name:"Claude Opus 5.5",family:"anthropic",attachment:true,reasoning:true,tool_call:true,temperature:false,modalities:{input:["text","image"],output:["text"]},limit:{context:1e6,output:128e3},thinking:{effortOptions:["low","medium","high","xhigh"],defaultEffort:"medium"},thinking_config:{mode:"always_on"},variants:{thinking:{thinking:{type:"adaptive"}}},max_data_class:"public",capabilities:Lo}};function qt(e){if(typeof e!=="object"||e===null||Array.isArray(e))return{};const n=e.enabled;return typeof n==="boolean"?{enabled:n}:{}}function Yt(e,n){return{enabled:qt(n).enabled??qt(e).enabled??true}}import ke from"node:fs";import xe from"node:fs";var Wt=384;function rn(e){if(process.platform==="win32")return;const n=xe.statSync(e).mode;if((n&63)===0)return;xe.chmodSync(e,n&448)}function fe(e,n,t=false){const o=xe.constants.O_WRONLY|xe.constants.O_CREAT|(t?xe.constants.O_EXCL:0);const i=xe.openSync(e,o,Wt);try{xe.fchmodSync(i,Wt);xe.ftruncateSync(i,0);xe.writeFileSync(i,n)}finally{xe.closeSync(i)}}import ae from"node:path";import du from"node:os";import{spawnSync as pu}from"node:child_process";import{fileURLToPath as mu}from"node:url";function rl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e["default"]:e}var oe={};var et={};var Be={};var Po;function kn(){if(Po)return Be;Po=1;function e(l){return typeof l==="undefined"||l===null}function n(l){return typeof l==="object"&&l!==null}function t(l){if(Array.isArray(l))return l;else if(e(l))return[];return[l]}function o(l,c){if(c){const d=Object.keys(c);for(let f=0,u=d.length;f<u;f+=1){const m=d[f];l[m]=c[m]}}return l}function i(l,c){let d="";for(let f=0;f<c;f+=1){d+=l}return d}function a(l){return l===0&&Number.NEGATIVE_INFINITY===1/l}Be.isNothing=e;Be.isObject=n;Be.toArray=t;Be.repeat=i;Be.isNegativeZero=a;Be.extend=o;return Be}var Ht;var Do;function Tn(){if(Do)return Ht;Do=1;function e(t,o){let i="";const a=t.reason||"(unknown reason)";if(!t.mark)return a;if(t.mark.name){i+='in "'+t.mark.name+'" '}i+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")";if(!o&&t.mark.snippet){i+="\n\n"+t.mark.snippet}return a+" "+i}function n(t,o){Error.call(this);this.name="YAMLException";this.reason=t;this.mark=o;this.message=e(this,false);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=new Error().stack||""}}n.prototype=Object.create(Error.prototype);n.prototype.constructor=n;n.prototype.toString=function t(o){return this.name+": "+e(this,o)};Ht=n;return Ht}var Xt;var No;function ol(){if(No)return Xt;No=1;const e=kn();function n(i,a,l,c,d){let f="";let u="";const m=Math.floor(d/2)-1;if(c-a>m){f=" ... ";a=c-m+f.length}if(l-c>m){u=" ...";l=c+m-u.length}return{str:f+i.slice(a,l).replace(/\t/g,"\u2192")+u,pos:c-a+f.length}}function t(i,a){return e.repeat(" ",a-i.length)+i}function o(i,a){a=Object.create(a||null);if(!i.buffer)return null;if(!a.maxLength)a.maxLength=79;if(typeof a.indent!=="number")a.indent=1;if(typeof a.linesBefore!=="number")a.linesBefore=3;if(typeof a.linesAfter!=="number")a.linesAfter=2;const l=/\r?\n|\r|\0/g;const c=[0];const d=[];let f;let u=-1;while(f=l.exec(i.buffer)){d.push(f.index);c.push(f.index+f[0].length);if(i.position<=f.index&&u<0){u=c.length-2}}if(u<0)u=c.length-1;let m="";const y=Math.min(i.line+a.linesAfter,d.length).toString().length;const x=a.maxLength-(a.indent+y+3);for(let T=1;T<=a.linesBefore;T++){if(u-T<0)break;const D=n(i.buffer,c[u-T],d[u-T],i.position-(c[u]-c[u-T]),x);m=e.repeat(" ",a.indent)+t((i.line-T+1).toString(),y)+" | "+D.str+"\n"+m}const w=n(i.buffer,c[u],d[u],i.position,x);m+=e.repeat(" ",a.indent)+t((i.line+1).toString(),y)+" | "+w.str+"\n";m+=e.repeat("-",a.indent+y+3+w.pos)+"^\n";for(let T=1;T<=a.linesAfter;T++){if(u+T>=d.length)break;const D=n(i.buffer,c[u+T],d[u+T],i.position-(c[u]-c[u+T]),x);m+=e.repeat(" ",a.indent)+t((i.line+T+1).toString(),y)+" | "+D.str+"\n"}return m.replace(/\n$/,"")}Xt=o;return Xt}var zt;var Fo;function se(){if(Fo)return zt;Fo=1;const e=Tn();const n=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"];const t=["scalar","sequence","mapping"];function o(a){const l={};if(a!==null){Object.keys(a).forEach(function(c){a[c].forEach(function(d){l[String(d)]=c})})}return l}function i(a,l){l=l||{};Object.keys(l).forEach(function(c){if(n.indexOf(c)===-1){throw new e('Unknown option "'+c+'" is met in definition of "'+a+'" YAML type.')}});this.options=l;this.tag=a;this.kind=l["kind"]||null;this.resolve=l["resolve"]||function(){return true};this.construct=l["construct"]||function(c){return c};this.instanceOf=l["instanceOf"]||null;this.predicate=l["predicate"]||null;this.represent=l["represent"]||null;this.representName=l["representName"]||null;this.defaultStyle=l["defaultStyle"]||null;this.multi=l["multi"]||false;this.styleAliases=o(l["styleAliases"]||null);if(t.indexOf(this.kind)===-1){throw new e('Unknown kind "'+this.kind+'" is specified for "'+a+'" YAML type.')}}zt=i;return zt}var Jt;var Bo;function ii(){if(Bo)return Jt;Bo=1;const e=Tn();const n=se();function t(a,l){const c=[];a[l].forEach(function(d){let f=c.length;c.forEach(function(u,m){if(u.tag===d.tag&&u.kind===d.kind&&u.multi===d.multi){f=m}});c[f]=d});return c}function o(){const a={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function l(c){if(c.multi){a.multi[c.kind].push(c);a.multi["fallback"].push(c)}else{a[c.kind][c.tag]=a["fallback"][c.tag]=c}}for(let c=0,d=arguments.length;c<d;c+=1){arguments[c].forEach(l)}return a}function i(a){return this.extend(a)}i.prototype.extend=function a(l){let c=[];let d=[];if(l instanceof n){d.push(l)}else if(Array.isArray(l)){d=d.concat(l)}else if(l&&(Array.isArray(l.implicit)||Array.isArray(l.explicit))){if(l.implicit)c=c.concat(l.implicit);if(l.explicit)d=d.concat(l.explicit)}else{throw new e("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })")}c.forEach(function(u){if(!(u instanceof n)){throw new e("Specified list of YAML types (or a single Type object) contains a non-Type object.")}if(u.loadKind&&u.loadKind!=="scalar"){throw new e("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}if(u.multi){throw new e("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}});d.forEach(function(u){if(!(u instanceof n)){throw new e("Specified list of YAML types (or a single Type object) contains a non-Type object.")}});const f=Object.create(i.prototype);f.implicit=(this.implicit||[]).concat(c);f.explicit=(this.explicit||[]).concat(d);f.compiledImplicit=t(f,"implicit");f.compiledExplicit=t(f,"explicit");f.compiledTypeMap=o(f.compiledImplicit,f.compiledExplicit);return f};Jt=i;return Jt}var Qt;var Uo;function si(){if(Uo)return Qt;Uo=1;const e=se();Qt=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(n){return n!==null?n:""}});return Qt}var Zt;var jo;function ai(){if(jo)return Zt;jo=1;const e=se();Zt=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(n){return n!==null?n:[]}});return Zt}var er;var Ko;function li(){if(Ko)return er;Ko=1;const e=se();er=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(n){return n!==null?n:{}}});return er}var nr;var Go;function ui(){if(Go)return nr;Go=1;const e=ii();nr=new e({explicit:[si(),ai(),li()]});return nr}var tr;var Vo;function ci(){if(Vo)return tr;Vo=1;const e=se();function n(i){if(i===null)return true;const a=i.length;return a===1&&i==="~"||a===4&&(i==="null"||i==="Null"||i==="NULL")}function t(){return null}function o(i){return i===null}tr=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:n,construct:t,predicate:o,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});return tr}var rr;var $o;function fi(){if($o)return rr;$o=1;const e=se();function n(i){if(i===null)return false;const a=i.length;return a===4&&(i==="true"||i==="True"||i==="TRUE")||a===5&&(i==="false"||i==="False"||i==="FALSE")}function t(i){return i==="true"||i==="True"||i==="TRUE"}function o(i){return Object.prototype.toString.call(i)==="[object Boolean]"}rr=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:n,construct:t,predicate:o,represent:{lowercase:function(i){return i?"true":"false"},uppercase:function(i){return i?"TRUE":"FALSE"},camelcase:function(i){return i?"True":"False"}},defaultStyle:"lowercase"});return rr}var or;var qo;function di(){if(qo)return or;qo=1;const e=kn();const n=se();function t(f){return f>=48&&f<=57||f>=65&&f<=70||f>=97&&f<=102}function o(f){return f>=48&&f<=55}function i(f){return f>=48&&f<=57}function a(f){if(f===null)return false;const u=f.length;let m=0;let y=false;if(!u)return false;let x=f[m];if(x==="-"||x==="+"){x=f[++m]}if(x==="0"){if(m+1===u)return true;x=f[++m];if(x==="b"){m++;for(;m<u;m++){x=f[m];if(x!=="0"&&x!=="1")return false;y=true}return y&&isFinite(l(f))}if(x==="x"){m++;for(;m<u;m++){if(!t(f.charCodeAt(m)))return false;y=true}return y&&isFinite(l(f))}if(x==="o"){m++;for(;m<u;m++){if(!o(f.charCodeAt(m)))return false;y=true}return y&&isFinite(l(f))}}for(;m<u;m++){if(!i(f.charCodeAt(m))){return false}y=true}if(!y)return false;return isFinite(l(f))}function l(f){let u=f;let m=1;let y=u[0];if(y==="-"||y==="+"){if(y==="-")m=-1;u=u.slice(1);y=u[0]}if(u==="0")return 0;if(y==="0"){if(u[1]==="b")return m*parseInt(u.slice(2),2);if(u[1]==="x")return m*parseInt(u.slice(2),16);if(u[1]==="o")return m*parseInt(u.slice(2),8)}return m*parseInt(u,10)}function c(f){return l(f)}function d(f){return Object.prototype.toString.call(f)==="[object Number]"&&(f%1===0&&!e.isNegativeZero(f))}or=new n("tag:yaml.org,2002:int",{kind:"scalar",resolve:a,construct:c,predicate:d,represent:{binary:function(f){return f>=0?"0b"+f.toString(2):"-0b"+f.toString(2).slice(1)},octal:function(f){return f>=0?"0o"+f.toString(8):"-0o"+f.toString(8).slice(1)},decimal:function(f){return f.toString(10)},hexadecimal:function(f){return f>=0?"0x"+f.toString(16).toUpperCase():"-0x"+f.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}});return or}var ir;var Yo;function pi(){if(Yo)return ir;Yo=1;const e=kn();const n=se();const t=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");const o=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function i(f){if(f===null)return false;if(!t.test(f)){return false}if(isFinite(parseFloat(f,10))){return true}return o.test(f)}function a(f){let u=f.toLowerCase();const m=u[0]==="-"?-1:1;if("+-".indexOf(u[0])>=0){u=u.slice(1)}if(u===".inf"){return m===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY}else if(u===".nan"){return NaN}return m*parseFloat(u,10)}const l=/^[-+]?[0-9]+e/;function c(f,u){if(isNaN(f)){switch(u){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}}else if(Number.POSITIVE_INFINITY===f){switch(u){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}}else if(Number.NEGATIVE_INFINITY===f){switch(u){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}}else if(e.isNegativeZero(f)){return"-0.0"}const m=f.toString(10);return l.test(m)?m.replace("e",".e"):m}function d(f){return Object.prototype.toString.call(f)==="[object Number]"&&(f%1!==0||e.isNegativeZero(f))}ir=new n("tag:yaml.org,2002:float",{kind:"scalar",resolve:i,construct:a,predicate:d,represent:c,defaultStyle:"lowercase"});return ir}var sr;var Wo;function mi(){if(Wo)return sr;Wo=1;sr=ui().extend({implicit:[ci(),fi(),di(),pi()]});return sr}var ar;var Ho;function gi(){if(Ho)return ar;Ho=1;ar=mi();return ar}var lr;var Xo;function yi(){if(Xo)return lr;Xo=1;const e=se();const n=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");const t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function o(l){if(l===null)return false;if(n.exec(l)!==null)return true;if(t.exec(l)!==null)return true;return false}function i(l){let c=0;let d=null;let f=n.exec(l);if(f===null)f=t.exec(l);if(f===null)throw new Error("Date resolve error");const u=+f[1];const m=+f[2]-1;const y=+f[3];if(!f[4]){return new Date(Date.UTC(u,m,y))}const x=+f[4];const w=+f[5];const T=+f[6];if(f[7]){c=f[7].slice(0,3);while(c.length<3){c+="0"}c=+c}if(f[9]){const N=+f[10];const U=+(f[11]||0);d=(N*60+U)*6e4;if(f[9]==="-")d=-d}const D=new Date(Date.UTC(u,m,y,x,w,T,c));if(d)D.setTime(D.getTime()-d);return D}function a(l){return l.toISOString()}lr=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:o,construct:i,instanceOf:Date,represent:a});return lr}var ur;var zo;function hi(){if(zo)return ur;zo=1;const e=se();function n(t){return t==="<<"||t===null}ur=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:n});return ur}var cr;var Jo;function bi(){if(Jo)return cr;Jo=1;const e=se();const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";function t(l){if(l===null)return false;let c=0;const d=l.length;const f=n;for(let u=0;u<d;u++){const m=f.indexOf(l.charAt(u));if(m>64)continue;if(m<0)return false;c+=6}return c%8===0}function o(l){const c=l.replace(/[\r\n=]/g,"");const d=c.length;const f=n;let u=0;const m=[];for(let x=0;x<d;x++){if(x%4===0&&x){m.push(u>>16&255);m.push(u>>8&255);m.push(u&255)}u=u<<6|f.indexOf(c.charAt(x))}const y=d%4*6;if(y===0){m.push(u>>16&255);m.push(u>>8&255);m.push(u&255)}else if(y===18){m.push(u>>10&255);m.push(u>>2&255)}else if(y===12){m.push(u>>4&255)}return new Uint8Array(m)}function i(l){let c="";let d=0;const f=l.length;const u=n;for(let y=0;y<f;y++){if(y%3===0&&y){c+=u[d>>18&63];c+=u[d>>12&63];c+=u[d>>6&63];c+=u[d&63]}d=(d<<8)+l[y]}const m=f%3;if(m===0){c+=u[d>>18&63];c+=u[d>>12&63];c+=u[d>>6&63];c+=u[d&63]}else if(m===2){c+=u[d>>10&63];c+=u[d>>4&63];c+=u[d<<2&63];c+=u[64]}else if(m===1){c+=u[d>>2&63];c+=u[d<<4&63];c+=u[64];c+=u[64]}return c}function a(l){return Object.prototype.toString.call(l)==="[object Uint8Array]"}cr=new e("tag:yaml.org,2002:binary",{kind:"scalar",resolve:t,construct:o,predicate:a,represent:i});return cr}var fr;var Qo;function Ai(){if(Qo)return fr;Qo=1;const e=se();const n=Object.prototype.hasOwnProperty;const t=Object.prototype.toString;function o(a){if(a===null)return true;const l={};const c=a;for(let d=0,f=c.length;d<f;d+=1){const u=c[d];let m=false;if(t.call(u)!=="[object Object]")return false;let y;for(y in u){if(n.call(u,y)){if(!m)m=true;else return false}}if(!m)return false;if(n.call(l,y))return false;Object.defineProperty(l,y,{value:true})}return true}function i(a){return a!==null?a:[]}fr=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:o,construct:i});return fr}var dr;var Zo;function _i(){if(Zo)return dr;Zo=1;const e=se();const n=Object.prototype.toString;function t(i){if(i===null)return true;const a=i;const l=new Array(a.length);for(let c=0,d=a.length;c<d;c+=1){const f=a[c];if(n.call(f)!=="[object Object]")return false;const u=Object.keys(f);if(u.length!==1)return false;l[c]=[u[0],f[u[0]]]}return true}function o(i){if(i===null)return[];const a=i;const l=new Array(a.length);for(let c=0,d=a.length;c<d;c+=1){const f=a[c];const u=Object.keys(f);l[c]=[u[0],f[u[0]]]}return l}dr=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:t,construct:o});return dr}var pr;var ei;function Ci(){if(ei)return pr;ei=1;const e=se();const n=Object.prototype.hasOwnProperty;function t(i){if(i===null)return true;const a=i;for(const l in a){if(n.call(a,l)){if(a[l]!==null)return false}}return true}function o(i){return i!==null?i:{}}pr=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:t,construct:o});return pr}var mr;var ni;function yr(){if(ni)return mr;ni=1;mr=gi().extend({implicit:[yi(),hi()],explicit:[bi(),Ai(),_i(),Ci()]});return mr}var ti;function il(){if(ti)return et;ti=1;const e=kn();const n=Tn();const t=ol();const o=yr();const i=Object.prototype.hasOwnProperty;const a=1;const l=2;const c=3;const d=4;const f=1;const u=2;const m=3;const y=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;const x=/[\x85\u2028\u2029]/;const w=/[,\[\]{}]/;const T=/^(?:!|!!|![0-9A-Za-z-]+!)$/;const D=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function N(r){return Object.prototype.toString.call(r)}function U(r){return r===10||r===13}function G(r){return r===9||r===32}function W(r){return r===9||r===32||r===10||r===13}function le(r){return r===44||r===91||r===93||r===123||r===125}function Me(r){if(r>=48&&r<=57){return r-48}const p=r|32;if(p>=97&&p<=102){return p-97+10}return-1}function Ae(r){if(r===120){return 2}if(r===117){return 4}if(r===85){return 8}return 0}function me(r){if(r>=48&&r<=57){return r-48}return-1}function M(r){switch(r){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return"\n";case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function j(r){if(r<=65535){return String.fromCharCode(r)}return String.fromCharCode((r-65536>>10)+55296,(r-65536&1023)+56320)}function I(r,p,_){if(p==="__proto__"){Object.defineProperty(r,p,{configurable:true,enumerable:true,writable:true,value:_})}else{r[p]=_}}const Q=new Array(256);const X=new Array(256);for(let r=0;r<256;r++){Q[r]=M(r)?1:0;X[r]=M(r)}function K(r,p){this.input=r;this.filename=p["filename"]||null;this.schema=p["schema"]||o;this.onWarning=p["onWarning"]||null;this.legacy=p["legacy"]||false;this.json=p["json"]||false;this.listener=p["listener"]||null;this.maxDepth=typeof p["maxDepth"]==="number"?p["maxDepth"]:100;this.maxTotalMergeKeys=typeof p["maxTotalMergeKeys"]==="number"?p["maxTotalMergeKeys"]:1e4;this.implicitTypes=this.schema.compiledImplicit;this.typeMap=this.schema.compiledTypeMap;this.length=r.length;this.position=0;this.line=0;this.lineStart=0;this.lineIndent=0;this.depth=0;this.totalMergeKeys=0;this.firstTabInLine=-1;this.documents=[];this.anchorMapTransactions=[]}function $(r,p){const _={name:r.filename,buffer:r.input.slice(0,-1),position:r.position,line:r.line,column:r.position-r.lineStart};_.snippet=t(_);return new n(p,_)}function k(r,p){throw $(r,p)}function V(r,p){if(r.onWarning){r.onWarning.call(null,$(r,p))}}function Y(r,p,_){const C=r.anchorMapTransactions;if(C.length!==0){const b=C[C.length-1];if(!i.call(b,p)){b[p]={existed:i.call(r.anchorMap,p),value:r.anchorMap[p]}}}r.anchorMap[p]=_}function q(r){r.anchorMapTransactions.push(Object.create(null))}function Ie(r){const p=r.anchorMapTransactions.pop();const _=r.anchorMapTransactions;if(_.length===0)return;const C=_[_.length-1];const b=Object.keys(p);for(let s=0,g=b.length;s<g;s+=1){const h=b[s];if(!i.call(C,h)){C[h]=p[h]}}}function Ut(r){const p=r.anchorMapTransactions.pop();const _=Object.keys(p);for(let C=_.length-1;C>=0;C-=1){const b=p[_[C]];if(b.existed){r.anchorMap[_[C]]=b.value}else{delete r.anchorMap[_[C]]}}}function _n(r){return{position:r.position,line:r.line,lineStart:r.lineStart,lineIndent:r.lineIndent,firstTabInLine:r.firstTabInLine,tag:r.tag,anchor:r.anchor,kind:r.kind,result:r.result}}function nn(r,p){r.position=p.position;r.line=p.line;r.lineStart=p.lineStart;r.lineIndent=p.lineIndent;r.firstTabInLine=p.firstTabInLine;r.tag=p.tag;r.anchor=p.anchor;r.kind=p.kind;r.result=p.result}const qn={YAML:function r(p,_,C){if(p.version!==null){k(p,"duplication of %YAML directive")}if(C.length!==1){k(p,"YAML directive accepts exactly one argument")}const b=/^([0-9]+)\.([0-9]+)$/.exec(C[0]);if(b===null){k(p,"ill-formed argument of the YAML directive")}const s=parseInt(b[1],10);const g=parseInt(b[2],10);if(s!==1){k(p,"unacceptable YAML version of the document")}p.version=C[0];p.checkLineBreaks=g<2;if(g!==1&&g!==2){V(p,"unsupported YAML version of the document")}},TAG:function r(p,_,C){let b;if(C.length!==2){k(p,"TAG directive accepts exactly two arguments")}const s=C[0];b=C[1];if(!T.test(s)){k(p,"ill-formed tag handle (first argument) of the TAG directive")}if(i.call(p.tagMap,s)){k(p,'there is a previously declared suffix for "'+s+'" tag handle')}if(!D.test(b)){k(p,"ill-formed tag prefix (second argument) of the TAG directive")}try{b=decodeURIComponent(b)}catch(g){k(p,"tag prefix is malformed: "+b)}p.tagMap[s]=b}};function ue(r,p,_,C){if(p<_){const b=r.input.slice(p,_);if(C){for(let s=0,g=b.length;s<g;s+=1){const h=b.charCodeAt(s);if(!(h===9||h>=32&&h<=1114111)){k(r,"expected valid JSON character")}}}else if(y.test(b)){k(r,"the stream contains non-printable characters")}r.result+=b}}function Le(r){r.totalMergeKeys++;if(r.maxTotalMergeKeys!==-1&&r.totalMergeKeys>r.maxTotalMergeKeys){k(r,"merge keys exceeded maxTotalMergeKeys ("+r.maxTotalMergeKeys+")")}}function Cn(r,p,_,C){if(!e.isObject(_)){k(r,"cannot merge mappings; the provided source object is unacceptable")}Le(r);const b=Object.keys(_);for(let s=0,g=b.length;s<g;s+=1){const h=b[s];Le(r);if(!i.call(p,h)){I(p,h,_[h]);C[h]=true}}}function ve(r,p,_,C,b,s,g,h,S){if(Array.isArray(b)){b=Array.prototype.slice.call(b);for(let R=0,v=b.length;R<v;R+=1){if(Array.isArray(b[R])){k(r,"nested arrays are not supported inside keys")}if(typeof b==="object"&&N(b[R])==="[object Object]"){b[R]="[object Object]"}}}if(typeof b==="object"&&N(b)==="[object Object]"){b="[object Object]"}b=String(b);if(p===null){p={}}if(C==="tag:yaml.org,2002:merge"){if(Array.isArray(s)){if(s.length>100){k(r,"abnormal merge sequence size")}for(let R=0,v=s.length;R<v;R+=1){Cn(r,p,s[R],_)}}else{Cn(r,p,s,_)}}else{if(!r.json&&!i.call(_,b)&&i.call(p,b)){r.line=g||r.line;r.lineStart=h||r.lineStart;r.position=S||r.position;k(r,"duplicated mapping key")}I(p,b,s);delete _[b]}return p}function xn(r){const p=r.input.charCodeAt(r.position);if(p===10){r.position++}else if(p===13){r.position++;if(r.input.charCodeAt(r.position)===10){r.position++}}else{k(r,"a line break is expected")}r.line+=1;r.lineStart=r.position;r.firstTabInLine=-1}function Z(r,p,_){let C=0;let b=r.input.charCodeAt(r.position);while(b!==0){while(G(b)){if(b===9&&r.firstTabInLine===-1){r.firstTabInLine=r.position}b=r.input.charCodeAt(++r.position)}if(p&&b===35){do{b=r.input.charCodeAt(++r.position)}while(b!==10&&b!==13&&b!==0)}if(U(b)){xn(r);b=r.input.charCodeAt(r.position);C++;r.lineIndent=0;while(b===32){r.lineIndent++;b=r.input.charCodeAt(++r.position)}}else{break}}if(_!==-1&&C!==0&&r.lineIndent<_){V(r,"deficient indentation")}return C}function _e(r){let p=r.position;let _=r.input.charCodeAt(p);if((_===45||_===46)&&_===r.input.charCodeAt(p+1)&&_===r.input.charCodeAt(p+2)){p+=3;_=r.input.charCodeAt(p);if(_===0||W(_)){return true}}return false}function tn(r,p){if(p===1){r.result+=" "}else if(p>1){r.result+=e.repeat("\n",p-1)}}function Yn(r,p,_){let C;let b;let s;let g;let h;let S;const R=r.kind;const v=r.result;let A=r.input.charCodeAt(r.position);if(W(A)||le(A)||A===35||A===38||A===42||A===33||A===124||A===62||A===39||A===34||A===37||A===64||A===96){return false}if(A===63||A===45){const E=r.input.charCodeAt(r.position+1);if(W(E)||_&&le(E)){return false}}r.kind="scalar";r.result="";C=b=r.position;s=false;while(A!==0){if(A===58){const E=r.input.charCodeAt(r.position+1);if(W(E)||_&&le(E)){break}}else if(A===35){const E=r.input.charCodeAt(r.position-1);if(W(E)){break}}else if(r.position===r.lineStart&&_e(r)||_&&le(A)){break}else if(U(A)){g=r.line;h=r.lineStart;S=r.lineIndent;Z(r,false,-1);if(r.lineIndent>=p){s=true;A=r.input.charCodeAt(r.position);continue}else{r.position=b;r.line=g;r.lineStart=h;r.lineIndent=S;break}}if(s){ue(r,C,b,false);tn(r,r.line-g);C=b=r.position;s=false}if(!G(A)){b=r.position+1}A=r.input.charCodeAt(++r.position)}ue(r,C,b,false);if(r.result){return true}r.kind=R;r.result=v;return false}function Sn(r,p){let _;let C;let b=r.input.charCodeAt(r.position);if(b!==39){return false}r.kind="scalar";r.result="";r.position++;_=C=r.position;while((b=r.input.charCodeAt(r.position))!==0){if(b===39){ue(r,_,r.position,true);b=r.input.charCodeAt(++r.position);if(b===39){_=r.position;r.position++;C=r.position}else{return true}}else if(U(b)){ue(r,_,C,true);tn(r,Z(r,false,p));_=C=r.position}else if(r.position===r.lineStart&&_e(r)){k(r,"unexpected end of the document within a single quoted scalar")}else{r.position++;if(!G(b)){C=r.position}}}k(r,"unexpected end of the stream within a single quoted scalar")}function Wn(r,p){let _;let C;let b;let s=r.input.charCodeAt(r.position);if(s!==34){return false}r.kind="scalar";r.result="";r.position++;_=C=r.position;while((s=r.input.charCodeAt(r.position))!==0){if(s===34){ue(r,_,r.position,true);r.position++;return true}else if(s===92){ue(r,_,r.position,true);s=r.input.charCodeAt(++r.position);if(U(s)){Z(r,false,p)}else if(s<256&&Q[s]){r.result+=X[s];r.position++}else if((b=Ae(s))>0){let g=b;let h=0;for(;g>0;g--){s=r.input.charCodeAt(++r.position);if((b=Me(s))>=0){h=(h<<4)+b}else{k(r,"expected hexadecimal character")}}r.result+=j(h);r.position++}else{k(r,"unknown escape sequence")}_=C=r.position}else if(U(s)){ue(r,_,C,true);tn(r,Z(r,false,p));_=C=r.position}else if(r.position===r.lineStart&&_e(r)){k(r,"unexpected end of the document within a double quoted scalar")}else{r.position++;if(!G(s)){C=r.position}}}k(r,"unexpected end of the stream within a double quoted scalar")}function Hn(r,p){let _=true;let C;let b;let s;const g=r.tag;let h;const S=r.anchor;let R;let v;let A;let E;const O=Object.create(null);let L;let P;let F;let B=r.input.charCodeAt(r.position);if(B===91){R=93;E=false;h=[]}else if(B===123){R=125;E=true;h={}}else{return false}if(r.anchor!==null){Y(r,r.anchor,h)}B=r.input.charCodeAt(++r.position);while(B!==0){Z(r,true,p);B=r.input.charCodeAt(r.position);if(B===R){r.position++;r.tag=g;r.anchor=S;r.kind=E?"mapping":"sequence";r.result=h;return true}else if(!_){k(r,"missed comma between flow collection entries")}else if(B===44){k(r,"expected the node content, but found ','")}P=L=F=null;v=A=false;if(B===63){const Ne=r.input.charCodeAt(r.position+1);if(W(Ne)){v=A=true;r.position++;Z(r,true,p)}}C=r.line;b=r.lineStart;s=r.position;De(r,p,a,false,true);P=r.tag;L=r.result;Z(r,true,p);B=r.input.charCodeAt(r.position);if((A||r.line===C)&&B===58){v=true;B=r.input.charCodeAt(++r.position);Z(r,true,p);De(r,p,a,false,true);F=r.result}if(E){ve(r,h,O,P,L,F,C,b,s)}else if(v){h.push(ve(r,null,O,P,L,F,C,b,s))}else{h.push(L)}Z(r,true,p);B=r.input.charCodeAt(r.position);if(B===44){_=true;B=r.input.charCodeAt(++r.position)}else{_=false}}k(r,"unexpected end of the stream within a flow collection")}function Pe(r,p){let _;let C=f;let b=false;let s=false;let g=p;let h=0;let S=false;let R;let v=r.input.charCodeAt(r.position);if(v===124){_=false}else if(v===62){_=true}else{return false}r.kind="scalar";r.result="";while(v!==0){v=r.input.charCodeAt(++r.position);if(v===43||v===45){if(f===C){C=v===43?m:u}else{k(r,"repeat of a chomping mode identifier")}}else if((R=me(v))>=0){if(R===0){k(r,"bad explicit indentation width of a block scalar; it cannot be less than one")}else if(!s){g=p+R-1;s=true}else{k(r,"repeat of an indentation width identifier")}}else{break}}if(G(v)){do{v=r.input.charCodeAt(++r.position)}while(G(v));if(v===35){do{v=r.input.charCodeAt(++r.position)}while(!U(v)&&v!==0)}}while(v!==0){xn(r);r.lineIndent=0;v=r.input.charCodeAt(r.position);while((!s||r.lineIndent<g)&&v===32){r.lineIndent++;v=r.input.charCodeAt(++r.position)}if(!s&&r.lineIndent>g){g=r.lineIndent}if(U(v)){h++;continue}if(!s&&g===0){k(r,"missing indentation for block scalar")}if(r.lineIndent<g){if(C===m){r.result+=e.repeat("\n",b?1+h:h)}else if(C===f){if(b){r.result+="\n"}}break}if(_){if(G(v)){S=true;r.result+=e.repeat("\n",b?1+h:h)}else if(S){S=false;r.result+=e.repeat("\n",h+1)}else if(h===0){if(b){r.result+=" "}}else{r.result+=e.repeat("\n",h)}}else{r.result+=e.repeat("\n",b?1+h:h)}b=true;s=true;h=0;const A=r.position;while(!U(v)&&v!==0){v=r.input.charCodeAt(++r.position)}ue(r,A,r.position,false)}return true}function Xn(r,p){const _=r.tag;const C=r.anchor;const b=[];let s=false;if(r.firstTabInLine!==-1)return false;if(r.anchor!==null){Y(r,r.anchor,b)}let g=r.input.charCodeAt(r.position);while(g!==0){if(r.firstTabInLine!==-1){r.position=r.firstTabInLine;k(r,"tab characters must not be used in indentation")}if(g!==45){break}const h=r.input.charCodeAt(r.position+1);if(!W(h)){break}s=true;r.position++;if(Z(r,true,-1)){if(r.lineIndent<=p){b.push(null);g=r.input.charCodeAt(r.position);continue}}const S=r.line;De(r,p,c,false,true);b.push(r.result);Z(r,true,-1);g=r.input.charCodeAt(r.position);if((r.line===S||r.lineIndent>p)&&g!==0){k(r,"bad indentation of a sequence entry")}else if(r.lineIndent<p){break}}if(s){r.tag=_;r.anchor=C;r.kind="sequence";r.result=b;return true}return false}function zn(r,p,_){let C;let b;let s;let g;const h=r.tag;const S=r.anchor;const R={};const v=Object.create(null);let A=null;let E=null;let O=null;let L=false;let P=false;if(r.firstTabInLine!==-1)return false;if(r.anchor!==null){Y(r,r.anchor,R)}let F=r.input.charCodeAt(r.position);while(F!==0){if(!L&&r.firstTabInLine!==-1){r.position=r.firstTabInLine;k(r,"tab characters must not be used in indentation")}const B=r.input.charCodeAt(r.position+1);const Ne=r.line;if((F===63||F===58)&&W(B)){if(F===63){if(L){ve(r,R,v,A,E,null,b,s,g);A=E=O=null}P=true;L=true;C=true}else if(L){L=false;C=true}else{k(r,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line")}r.position+=1;F=B}else{b=r.line;s=r.lineStart;g=r.position;if(!De(r,_,l,false,true)){break}if(r.line===Ne){F=r.input.charCodeAt(r.position);while(G(F)){F=r.input.charCodeAt(++r.position)}if(F===58){F=r.input.charCodeAt(++r.position);if(!W(F)){k(r,"a whitespace character is expected after the key-value separator within a block mapping")}if(L){ve(r,R,v,A,E,null,b,s,g);A=E=O=null}P=true;L=false;C=false;A=r.tag;E=r.result}else if(P){k(r,"can not read an implicit mapping pair; a colon is missed")}else{r.tag=h;r.anchor=S;return true}}else if(P){k(r,"can not read a block mapping entry; a multiline key may not be an implicit key")}else{r.tag=h;r.anchor=S;return true}}if(r.line===Ne||r.lineIndent>p){if(L){b=r.line;s=r.lineStart;g=r.position}if(De(r,p,d,true,C)){if(L){E=r.result}else{O=r.result}}if(!L){ve(r,R,v,A,E,O,b,s,g);A=E=O=null}Z(r,true,-1);F=r.input.charCodeAt(r.position)}if((r.line===Ne||r.lineIndent>p)&&F!==0){k(r,"bad indentation of a mapping entry")}else if(r.lineIndent<p){break}}if(L){ve(r,R,v,A,E,null,b,s,g)}if(P){r.tag=h;r.anchor=S;r.kind="mapping";r.result=R}return P}function Jn(r){let p=false;let _=false;let C;let b;let s=r.input.charCodeAt(r.position);if(s!==33)return false;if(r.tag!==null){k(r,"duplication of a tag property")}s=r.input.charCodeAt(++r.position);if(s===60){p=true;s=r.input.charCodeAt(++r.position)}else if(s===33){_=true;C="!!";s=r.input.charCodeAt(++r.position)}else{C="!"}let g=r.position;if(p){do{s=r.input.charCodeAt(++r.position)}while(s!==0&&s!==62);if(r.position<r.length){b=r.input.slice(g,r.position);s=r.input.charCodeAt(++r.position)}else{k(r,"unexpected end of the stream within a verbatim tag")}}else{while(s!==0&&!W(s)){if(s===33){if(!_){C=r.input.slice(g-1,r.position+1);if(!T.test(C)){k(r,"named tag handle cannot contain such characters")}_=true;g=r.position+1}else{k(r,"tag suffix cannot contain exclamation marks")}}s=r.input.charCodeAt(++r.position)}b=r.input.slice(g,r.position);if(w.test(b)){k(r,"tag suffix cannot contain flow indicator characters")}}if(b&&!D.test(b)){k(r,"tag name cannot contain such characters: "+b)}try{b=decodeURIComponent(b)}catch(h){k(r,"tag name is malformed: "+b)}if(p){r.tag=b}else if(i.call(r.tagMap,C)){r.tag=r.tagMap[C]+b}else if(C==="!"){r.tag="!"+b}else if(C==="!!"){r.tag="tag:yaml.org,2002:"+b}else{k(r,'undeclared tag handle "'+C+'"')}return true}function Qn(r){let p=r.input.charCodeAt(r.position);if(p!==38)return false;if(r.anchor!==null){k(r,"duplication of an anchor property")}p=r.input.charCodeAt(++r.position);const _=r.position;while(p!==0&&!W(p)&&!le(p)){p=r.input.charCodeAt(++r.position)}if(r.position===_){k(r,"name of an anchor node must contain at least one character")}r.anchor=r.input.slice(_,r.position);return true}function jt(r){let p=r.input.charCodeAt(r.position);if(p!==42)return false;p=r.input.charCodeAt(++r.position);const _=r.position;while(p!==0&&!W(p)&&!le(p)){p=r.input.charCodeAt(++r.position)}if(r.position===_){k(r,"name of an alias node must contain at least one character")}const C=r.input.slice(_,r.position);if(!i.call(r.anchorMap,C)){k(r,'unidentified alias "'+C+'"')}r.result=r.anchorMap[C];Z(r,true,-1);return true}function Zn(r,p,_,C){const b=_n(r);q(r);nn(r,p);r.tag=null;r.anchor=null;r.kind=null;r.result=null;if(zn(r,_,C)&&r.kind==="mapping"){Ie(r);return true}Ut(r);nn(r,b);return false}function De(r,p,_,C,b){let s;let g;let h=1;let S=false;let R=false;let v=null;let A;let E;let O;if(r.depth>=r.maxDepth){k(r,"nesting exceeded maxDepth ("+r.maxDepth+")")}r.depth+=1;if(r.listener!==null){r.listener("open",r)}r.tag=null;r.anchor=null;r.kind=null;r.result=null;const L=s=g=d===_||c===_;if(C){if(Z(r,true,-1)){S=true;if(r.lineIndent>p){h=1}else if(r.lineIndent===p){h=0}else if(r.lineIndent<p){h=-1}}}if(h===1){while(true){const P=r.input.charCodeAt(r.position);const F=_n(r);if(S&&(P===33&&r.tag!==null||P===38&&r.anchor!==null)){break}if(!Jn(r)&&!Qn(r)){break}if(v===null){v=F}if(Z(r,true,-1)){S=true;g=L;if(r.lineIndent>p){h=1}else if(r.lineIndent===p){h=0}else if(r.lineIndent<p){h=-1}}else{g=false}}}if(g){g=S||b}if(h===1||d===_){if(a===_||l===_){E=p}else{E=p+1}O=r.position-r.lineStart;if(h===1){if(g&&(Xn(r,O)||zn(r,O,E))||Hn(r,E)){R=true}else{const P=r.input.charCodeAt(r.position);if(v!==null&&L&&!g&&P!==124&&P!==62&&Zn(r,v,v.position-v.lineStart,E)){R=true}else if(s&&Pe(r,E)||Sn(r,E)||Wn(r,E)){R=true}else if(jt(r)){R=true;if(r.tag!==null||r.anchor!==null){k(r,"alias node should not have any properties")}}else if(Yn(r,E,a===_)){R=true;if(r.tag===null){r.tag="?"}}if(r.anchor!==null){Y(r,r.anchor,r.result)}}}else if(h===0){R=g&&Xn(r,O)}}if(r.tag===null){if(r.anchor!==null){Y(r,r.anchor,r.result)}}else if(r.tag==="?"){if(r.result!==null&&r.kind!=="scalar"){k(r,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+r.kind+'"')}for(let P=0,F=r.implicitTypes.length;P<F;P+=1){A=r.implicitTypes[P];if(A.resolve(r.result)){r.result=A.construct(r.result);r.tag=A.tag;if(r.anchor!==null){Y(r,r.anchor,r.result)}break}}}else if(r.tag!=="!"){if(i.call(r.typeMap[r.kind||"fallback"],r.tag)){A=r.typeMap[r.kind||"fallback"][r.tag]}else{A=null;const P=r.typeMap.multi[r.kind||"fallback"];for(let F=0,B=P.length;F<B;F+=1){if(r.tag.slice(0,P[F].tag.length)===P[F].tag){A=P[F];break}}}if(!A){k(r,"unknown tag !<"+r.tag+">")}if(r.result!==null&&A.kind!==r.kind){k(r,"unacceptable node kind for !<"+r.tag+'> tag; it should be "'+A.kind+'", not "'+r.kind+'"')}if(!A.resolve(r.result,r.tag)){k(r,"cannot resolve a node with !<"+r.tag+"> explicit tag")}else{r.result=A.construct(r.result,r.tag);if(r.anchor!==null){Y(r,r.anchor,r.result)}}}if(r.listener!==null){r.listener("close",r)}r.depth-=1;return r.tag!==null||r.anchor!==null||R}function Kt(r){const p=r.position;let _=false;let C;r.version=null;r.checkLineBreaks=r.legacy;r.tagMap=Object.create(null);r.anchorMap=Object.create(null);while((C=r.input.charCodeAt(r.position))!==0){Z(r,true,-1);C=r.input.charCodeAt(r.position);if(r.lineIndent>0||C!==37){break}_=true;C=r.input.charCodeAt(++r.position);let b=r.position;while(C!==0&&!W(C)){C=r.input.charCodeAt(++r.position)}const s=r.input.slice(b,r.position);const g=[];if(s.length<1){k(r,"directive name must not be less than one character in length")}while(C!==0){while(G(C)){C=r.input.charCodeAt(++r.position)}if(C===35){do{C=r.input.charCodeAt(++r.position)}while(C!==0&&!U(C));break}if(U(C))break;b=r.position;while(C!==0&&!W(C)){C=r.input.charCodeAt(++r.position)}g.push(r.input.slice(b,r.position))}if(C!==0)xn(r);if(i.call(qn,s)){qn[s](r,s,g)}else{V(r,'unknown document directive "'+s+'"')}}Z(r,true,-1);if(r.lineIndent===0&&r.input.charCodeAt(r.position)===45&&r.input.charCodeAt(r.position+1)===45&&r.input.charCodeAt(r.position+2)===45){r.position+=3;Z(r,true,-1)}else if(_){k(r,"directives end mark is expected")}De(r,r.lineIndent-1,d,false,true);Z(r,true,-1);if(r.checkLineBreaks&&x.test(r.input.slice(p,r.position))){V(r,"non-ASCII line breaks are interpreted as content")}r.documents.push(r.result);if(r.position===r.lineStart&&_e(r)){if(r.input.charCodeAt(r.position)===46){r.position+=3;Z(r,true,-1)}return}if(r.position<r.length-1){k(r,"end of the stream or a document separator is expected")}}function Rn(r,p){r=String(r);p=p||{};if(r.length!==0){if(r.charCodeAt(r.length-1)!==10&&r.charCodeAt(r.length-1)!==13){r+="\n"}if(r.charCodeAt(0)===65279){r=r.slice(1)}}const _=new K(r,p);const C=r.indexOf("\0");if(C!==-1){_.position=C;k(_,"null byte is not allowed in input")}_.input+="\0";while(_.input.charCodeAt(_.position)===32){_.lineIndent+=1;_.position+=1}while(_.position<_.length-1){Kt(_)}return _.documents}function Gt(r,p,_){if(p!==null&&typeof p==="object"&&typeof _==="undefined"){_=p;p=null}const C=Rn(r,_);if(typeof p!=="function"){return C}for(let b=0,s=C.length;b<s;b+=1){p(C[b])}}function Vt(r,p){const _=Rn(r,p);if(_.length===0){return void 0}else if(_.length===1){return _[0]}throw new n("expected a single document in the stream, but found more")}et.loadAll=Gt;et.load=Vt;return et}var gr={};var ri;function sl(){if(ri)return gr;ri=1;const e=kn();const n=Tn();const t=yr();const o=Object.prototype.toString;const i=Object.prototype.hasOwnProperty;const a=65279;const l=9;const c=10;const d=13;const f=32;const u=33;const m=34;const y=35;const x=37;const w=38;const T=39;const D=42;const N=44;const U=45;const G=58;const W=61;const le=62;const Me=63;const Ae=64;const me=91;const M=93;const j=96;const I=123;const Q=124;const X=125;const K={};K[0]="\\0";K[7]="\\a";K[8]="\\b";K[9]="\\t";K[10]="\\n";K[11]="\\v";K[12]="\\f";K[13]="\\r";K[27]="\\e";K[34]='\\"';K[92]="\\\\";K[133]="\\N";K[160]="\\_";K[8232]="\\L";K[8233]="\\P";const $=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];const k=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function V(s,g){if(g===null)return{};const h={};const S=Object.keys(g);for(let R=0,v=S.length;R<v;R+=1){let A=S[R];let E=String(g[A]);if(A.slice(0,2)==="!!"){A="tag:yaml.org,2002:"+A.slice(2)}const O=s.compiledTypeMap["fallback"][A];if(O&&i.call(O.styleAliases,E)){E=O.styleAliases[E]}h[A]=E}return h}function Y(s){let g;let h;const S=s.toString(16).toUpperCase();if(s<=255){g="x";h=2}else if(s<=65535){g="u";h=4}else if(s<=4294967295){g="U";h=8}else{throw new n("code point within a string may not be greater than 0xFFFFFFFF")}return"\\"+g+e.repeat("0",h-S.length)+S}const q=1;const Ie=2;function Ut(s){this.schema=s["schema"]||t;this.indent=Math.max(1,s["indent"]||2);this.noArrayIndent=s["noArrayIndent"]||false;this.skipInvalid=s["skipInvalid"]||false;this.flowLevel=e.isNothing(s["flowLevel"])?-1:s["flowLevel"];this.styleMap=V(this.schema,s["styles"]||null);this.sortKeys=s["sortKeys"]||false;this.lineWidth=s["lineWidth"]||80;this.noRefs=s["noRefs"]||false;this.noCompatMode=s["noCompatMode"]||false;this.condenseFlow=s["condenseFlow"]||false;this.quotingType=s["quotingType"]==='"'?Ie:q;this.forceQuotes=s["forceQuotes"]||false;this.replacer=typeof s["replacer"]==="function"?s["replacer"]:null;this.implicitTypes=this.schema.compiledImplicit;this.explicitTypes=this.schema.compiledExplicit;this.tag=null;this.result="";this.duplicates=[];this.usedDuplicates=null}function _n(s,g){const h=e.repeat(" ",g);let S=0;let R="";const v=s.length;while(S<v){let A;const E=s.indexOf("\n",S);if(E===-1){A=s.slice(S);S=v}else{A=s.slice(S,E+1);S=E+1}if(A.length&&A!=="\n")R+=h;R+=A}return R}function nn(s,g){return"\n"+e.repeat(" ",s.indent*g)}function qn(s,g){for(let h=0,S=s.implicitTypes.length;h<S;h+=1){const R=s.implicitTypes[h];if(R.resolve(g)){return true}}return false}function ue(s){return s===f||s===l}function Le(s){return s>=32&&s<=126||s>=161&&s<=55295&&s!==8232&&s!==8233||s>=57344&&s<=65533&&s!==a||s>=65536&&s<=1114111}function Cn(s){return Le(s)&&s!==a&&s!==d&&s!==c}function ve(s,g,h){const S=Cn(s);const R=S&&!ue(s);return(h?S:S&&s!==N&&s!==me&&s!==M&&s!==I&&s!==X)&&s!==y&&!(g===G&&!R)||Cn(g)&&!ue(g)&&s===y||g===G&&R}function xn(s){return Le(s)&&s!==a&&!ue(s)&&s!==U&&s!==Me&&s!==G&&s!==N&&s!==me&&s!==M&&s!==I&&s!==X&&s!==y&&s!==w&&s!==D&&s!==u&&s!==Q&&s!==W&&s!==le&&s!==T&&s!==m&&s!==x&&s!==Ae&&s!==j}function Z(s){return!ue(s)&&s!==G}function _e(s,g){const h=s.charCodeAt(g);let S;if(h>=55296&&h<=56319&&g+1<s.length){S=s.charCodeAt(g+1);if(S>=56320&&S<=57343){return(h-55296)*1024+S-56320+65536}}return h}function tn(s){const g=/^\n* /;return g.test(s)}const Yn=1;const Sn=2;const Wn=3;const Hn=4;const Pe=5;function Xn(s,g,h,S,R,v,A,E){let O;let L=0;let P=null;let F=false;let B=false;const Ne=S!==-1;let vn=-1;let En=xn(_e(s,0))&&Z(_e(s,s.length-1));if(g||A){for(O=0;O<s.length;L>=65536?O+=2:O++){L=_e(s,O);if(!Le(L)){return Pe}En=En&&ve(L,P,E);P=L}}else{for(O=0;O<s.length;L>=65536?O+=2:O++){L=_e(s,O);if(L===c){F=true;if(Ne){B=B||O-vn-1>S&&s[vn+1]!==" ";vn=O}}else if(!Le(L)){return Pe}En=En&&ve(L,P,E);P=L}B=B||Ne&&(O-vn-1>S&&s[vn+1]!==" ")}if(!F&&!B){if(En&&!A&&!R(s)){return Yn}return v===Ie?Pe:Sn}if(h>9&&tn(s)){return Pe}if(!A){return B?Hn:Wn}return v===Ie?Pe:Sn}function zn(s,g,h,S,R){s.dump=(function(){if(g.length===0){return s.quotingType===Ie?'""':"''"}if(!s.noCompatMode){if($.indexOf(g)!==-1||k.test(g)){return s.quotingType===Ie?'"'+g+'"':"'"+g+"'"}}const v=s.indent*Math.max(1,h);const A=s.lineWidth===-1?-1:Math.max(Math.min(s.lineWidth,40),s.lineWidth-v);const E=S||s.flowLevel>-1&&h>=s.flowLevel;function O(L){return qn(s,L)}switch(Xn(g,E,s.indent,A,O,s.quotingType,s.forceQuotes&&!S,R)){case Yn:return g;case Sn:return"'"+g.replace(/'/g,"''")+"'";case Wn:return"|"+Jn(g,s.indent)+Qn(_n(g,v));case Hn:return">"+Jn(g,s.indent)+Qn(_n(jt(g,A),v));case Pe:return'"'+De(g)+'"';default:throw new n("impossible error: invalid scalar style")}})()}function Jn(s,g){const h=tn(s)?String(g):"";const S=s[s.length-1]==="\n";const R=S&&(s[s.length-2]==="\n"||s==="\n");const v=R?"+":S?"":"-";return h+v+"\n"}function Qn(s){return s[s.length-1]==="\n"?s.slice(0,-1):s}function jt(s,g){const h=/(\n+)([^\n]*)/g;let S=(function(){let E=s.indexOf("\n");E=E!==-1?E:s.length;h.lastIndex=E;return Zn(s.slice(0,E),g)})();let R=s[0]==="\n"||s[0]===" ";let v;let A;while(A=h.exec(s)){const E=A[1];const O=A[2];v=O[0]===" ";S+=E+(!R&&!v&&O!==""?"\n":"")+Zn(O,g);R=v}return S}function Zn(s,g){if(s===""||s[0]===" ")return s;const h=/ [^ ]/g;let S;let R=0;let v;let A=0;let E=0;let O="";while(S=h.exec(s)){E=S.index;if(E-R>g){v=A>R?A:E;O+="\n"+s.slice(R,v);R=v+1}A=E}O+="\n";if(s.length-R>g&&A>R){O+=s.slice(R,A)+"\n"+s.slice(A+1)}else{O+=s.slice(R)}return O.slice(1)}function De(s){let g="";let h=0;for(let S=0;S<s.length;h>=65536?S+=2:S++){h=_e(s,S);const R=K[h];if(!R&&Le(h)){g+=s[S];if(h>=65536)g+=s[S+1]}else{g+=R||Y(h)}}return g}function Kt(s,g,h){let S="";const R=s.tag;for(let v=0,A=h.length;v<A;v+=1){let E=h[v];if(s.replacer){E=s.replacer.call(h,String(v),E)}if(p(s,g,E,false,false)||typeof E==="undefined"&&p(s,g,null,false,false)){if(S!=="")S+=","+(!s.condenseFlow?" ":"");S+=s.dump}}s.tag=R;s.dump="["+S+"]"}function Rn(s,g,h,S){let R="";const v=s.tag;for(let A=0,E=h.length;A<E;A+=1){let O=h[A];if(s.replacer){O=s.replacer.call(h,String(A),O)}if(p(s,g+1,O,true,true,false,true)||typeof O==="undefined"&&p(s,g+1,null,true,true,false,true)){if(!S||R!==""){R+=nn(s,g)}if(s.dump&&c===s.dump.charCodeAt(0)){R+="-"}else{R+="- "}R+=s.dump}}s.tag=v;s.dump=R||"[]"}function Gt(s,g,h){let S="";const R=s.tag;const v=Object.keys(h);for(let A=0,E=v.length;A<E;A+=1){let O="";if(S!=="")O+=", ";if(s.condenseFlow)O+='"';const L=v[A];let P=h[L];if(s.replacer){P=s.replacer.call(h,L,P)}if(!p(s,g,L,false,false)){continue}if(s.dump.length>1024)O+="? ";O+=s.dump+(s.condenseFlow?'"':"")+":"+(s.condenseFlow?"":" ");if(!p(s,g,P,false,false)){continue}O+=s.dump;S+=O}s.tag=R;s.dump="{"+S+"}"}function Vt(s,g,h,S){let R="";const v=s.tag;const A=Object.keys(h);if(s.sortKeys===true){A.sort()}else if(typeof s.sortKeys==="function"){A.sort(s.sortKeys)}else if(s.sortKeys){throw new n("sortKeys must be a boolean or a function")}for(let E=0,O=A.length;E<O;E+=1){let L="";if(!S||R!==""){L+=nn(s,g)}const P=A[E];let F=h[P];if(s.replacer){F=s.replacer.call(h,P,F)}if(!p(s,g+1,P,true,true,true)){continue}const B=s.tag!==null&&s.tag!=="?"||s.dump&&s.dump.length>1024;if(B){if(s.dump&&c===s.dump.charCodeAt(0)){L+="?"}else{L+="? "}}L+=s.dump;if(B){L+=nn(s,g)}if(!p(s,g+1,F,true,B)){continue}if(s.dump&&c===s.dump.charCodeAt(0)){L+=":"}else{L+=": "}L+=s.dump;R+=L}s.tag=v;s.dump=R||"{}"}function r(s,g,h){const S=h?s.explicitTypes:s.implicitTypes;for(let R=0,v=S.length;R<v;R+=1){const A=S[R];if((A.instanceOf||A.predicate)&&(!A.instanceOf||typeof g==="object"&&g instanceof A.instanceOf)&&(!A.predicate||A.predicate(g))){if(h){if(A.multi&&A.representName){s.tag=A.representName(g)}else{s.tag=A.tag}}else{s.tag="?"}if(A.represent){const E=s.styleMap[A.tag]||A.defaultStyle;let O;if(o.call(A.represent)==="[object Function]"){O=A.represent(g,E)}else if(i.call(A.represent,E)){O=A.represent[E](g,E)}else{throw new n("!<"+A.tag+'> tag resolver accepts not "'+E+'" style')}s.dump=O}return true}}return false}function p(s,g,h,S,R,v,A){s.tag=null;s.dump=h;if(!r(s,h,false)){r(s,h,true)}const E=o.call(s.dump);const O=S;if(S){S=s.flowLevel<0||s.flowLevel>g}const L=E==="[object Object]"||E==="[object Array]";let P;let F;if(L){P=s.duplicates.indexOf(h);F=P!==-1}if(s.tag!==null&&s.tag!=="?"||F||s.indent!==2&&g>0){R=false}if(F&&s.usedDuplicates[P]){s.dump="*ref_"+P}else{if(L&&F&&!s.usedDuplicates[P]){s.usedDuplicates[P]=true}if(E==="[object Object]"){if(S&&Object.keys(s.dump).length!==0){Vt(s,g,s.dump,R);if(F){s.dump="&ref_"+P+s.dump}}else{Gt(s,g,s.dump);if(F){s.dump="&ref_"+P+" "+s.dump}}}else if(E==="[object Array]"){if(S&&s.dump.length!==0){if(s.noArrayIndent&&!A&&g>0){Rn(s,g-1,s.dump,R)}else{Rn(s,g,s.dump,R)}if(F){s.dump="&ref_"+P+s.dump}}else{Kt(s,g,s.dump);if(F){s.dump="&ref_"+P+" "+s.dump}}}else if(E==="[object String]"){if(s.tag!=="?"){zn(s,s.dump,g,v,O)}}else if(E==="[object Undefined]"){return false}else{if(s.skipInvalid)return false;throw new n("unacceptable kind of an object to dump "+E)}if(s.tag!==null&&s.tag!=="?"){let B=encodeURI(s.tag[0]==="!"?s.tag.slice(1):s.tag).replace(/!/g,"%21");if(s.tag[0]==="!"){B="!"+B}else if(B.slice(0,18)==="tag:yaml.org,2002:"){B="!!"+B.slice(18)}else{B="!<"+B+">"}s.dump=B+" "+s.dump}}return true}function _(s,g){const h=[];const S=[];C(s,h,S);const R=S.length;for(let v=0;v<R;v+=1){g.duplicates.push(h[S[v]])}g.usedDuplicates=new Array(R)}function C(s,g,h){if(s!==null&&typeof s==="object"){const S=g.indexOf(s);if(S!==-1){if(h.indexOf(S)===-1){h.push(S)}}else{g.push(s);if(Array.isArray(s)){for(let R=0,v=s.length;R<v;R+=1){C(s[R],g,h)}}else{const R=Object.keys(s);for(let v=0,A=R.length;v<A;v+=1){C(s[R[v]],g,h)}}}}}function b(s,g){g=g||{};const h=new Ut(g);if(!h.noRefs)_(s,h);let S=s;if(h.replacer){S=h.replacer.call({"":S},"",S)}if(p(h,0,S,true,true))return h.dump+"\n";return""}gr.dump=b;return gr}var oi;function al(){if(oi)return oe;oi=1;const e=il();const n=sl();function t(o,i){return function(){throw new Error("Function yaml."+o+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}oe.Type=se();oe.Schema=ii();oe.FAILSAFE_SCHEMA=ui();oe.JSON_SCHEMA=mi();oe.CORE_SCHEMA=gi();oe.DEFAULT_SCHEMA=yr();oe.load=e.load;oe.loadAll=e.loadAll;oe.dump=n.dump;oe.YAMLException=Tn();oe.types={binary:bi(),float:pi(),map:li(),null:ci(),pairs:_i(),set:Ci(),timestamp:yi(),bool:fi(),int:di(),merge:hi(),omap:Ai(),seq:ai(),str:si()};oe.safeLoad=t("safeLoad","load");oe.safeLoadAll=t("safeLoadAll","loadAll");oe.safeDump=t("safeDump","dump");return oe}var ll=al();var ne=rl(ll);var{Type:id,Schema:sd,FAILSAFE_SCHEMA:ad,JSON_SCHEMA:ld,CORE_SCHEMA:ud,DEFAULT_SCHEMA:cd,load:fd,loadAll:dd,dump:pd,YAMLException:md,types:gd,safeLoad:yd,safeLoadAll:hd,safeDump:bd}=ne;function xi(e){const n=e.tui;if(n==null||typeof n!=="object"||Array.isArray(n))return{};const t=n;const o=t.notifications;let i;if(o&&typeof o==="object"&&!Array.isArray(o)){const{when:d,method:f,events:u}=o;i={...d==="unfocused"||d==="always"||d==="never"?{when:d}:{},...f==="auto"||f==="osc9"||f==="osc777"||f==="bel"?{method:f}:{},...Array.isArray(u)?{events:u.filter(m=>typeof m==="string")}:{}}}const a=t.statusLine;const l=Array.isArray(a)?a.filter(d=>typeof d==="string").map(d=>d.trim()).filter(Boolean):void 0;const c=ul(t.customStatusLine);return{...t.terminalTitle===null?{terminalTitle:null}:Array.isArray(t.terminalTitle)?{terminalTitle:t.terminalTitle.filter(d=>typeof d==="string").map(d=>d.trim()).filter(Boolean)}:{},...typeof t.showTips==="boolean"?{showTips:t.showTips}:{},...typeof t.programStatus==="boolean"?{programStatus:t.programStatus}:{},...i?{notifications:i}:{},...l?{statusLine:l}:{},...c?{customStatusLine:c}:{}}}function ul(e){if(e==null||typeof e!=="object"||Array.isArray(e))return void 0;const n=e;const t=typeof n.command==="string"?n.command.trim():"";if(!t)return void 0;return{command:t,...n.display==="inline"||n.display==="block"?{display:n.display}:{},...n.position==="above"||n.position==="below"?{position:n.position}:{},...n.colorMode==="plain"||n.colorMode==="ansi"?{colorMode:n.colorMode}:{},...typeof n.maxLines==="number"&&Number.isFinite(n.maxLines)?{maxLines:n.maxLines}:{},...typeof n.timeoutMs==="number"&&Number.isFinite(n.timeoutMs)?{timeoutMs:n.timeoutMs}:{},...typeof n.intervalSeconds==="number"&&Number.isFinite(n.intervalSeconds)?{intervalSeconds:n.intervalSeconds}:{}}}import{createHash as cl,randomUUID as fl}from"node:crypto";import tt from"node:fs";import nt from"node:path";function vi(e){if(e==null||typeof e!=="object"||Array.isArray(e))return void 0;const n=e;const t={};if(typeof n.apiKey==="string")t.apiKey=n.apiKey;if(typeof n.baseURL==="string")t.baseURL=n.baseURL;const o=br(n.modelContextLimits);if(o)t.modelContextLimits=o;return Object.keys(t).length>0?t:void 0}function br(e){if(!z(e))return void 0;const n=Object.entries(e).filter(t=>t[0].length>0&&Number.isSafeInteger(t[1])&&t[1]>0);return n.length>0?Object.fromEntries(n):void 0}function Ei(e,n){if(!n)return e;return Object.fromEntries(Object.entries(e).map(([t,o])=>{const i=n[t];return[t,i!==void 0&&o.contextWindowOptions?.includes(i)?{...o,limit:{...o.limit,context:i}}:o]}))}function Ar(e){const n=e.provider?.alran;const t=n?.catalogModels??n?.models??Ce;return Ei(Object.fromEntries(Object.entries(t).filter(([,o])=>o.enabled!==false)),e.alran_api?.modelContextLimits)}function ki(e,n){const t=e.alran;if(!t?.models)return e;return{...e,alran:{...t,catalogModels:t.models,models:Ei(t.models,n)}}}function Ti(e){if(e==null||typeof e!=="object"||Array.isArray(e))return void 0;const n=Object.entries(e).filter(([,t])=>t!=null&&typeof t==="object"&&!Array.isArray(t));if(n.length===0)return void 0;return Object.fromEntries(n.map(([t,o])=>[t,Oi(o)]))}function wi(e){return Object.fromEntries(Object.entries(e).map(([n,t])=>[n,z(t)?Oi(t):t]))}function Oi(e){if(!z(e.models))return e;let n=false;const t=Object.fromEntries(Object.entries(e.models).map(([o,i])=>{if(!z(i)||!z(i.thinking))return[o,i];const a=typeof i.thinking.effort==="string"?i.thinking.effort.trim():"";const l=typeof i.thinking.defaultEffort==="string"?i.thinking.defaultEffort.trim():"";if(!Object.hasOwn(i.thinking,"effort")&&!Object.hasOwn(i.thinking,"defaultEffort")){return[o,i]}const c=[];const d=new Set;if(Array.isArray(i.thinking.effortOptions)){for(const y of i.thinking.effortOptions){if(typeof y!=="string")continue;const x=y.trim();if(!x||d.has(x))continue;d.add(x);c.push(x)}}if(a&&!d.has(a)){d.add(a);c.push(a)}if(l&&!d.has(l)){d.add(l);c.push(l)}const f={...i.thinking};delete f.effort;delete f.effortOptions;delete f.defaultEffort;const u={...f,...c.length>0?{effortOptions:c}:{},...l?{defaultEffort:l}:{}};const m={...i};if(Object.keys(u).length>0)m.thinking=u;else delete m.thinking;n=true;return[o,m]}));return n?{...e,models:t}:e}var Mi="byok_legacy_provider_to_custom_provider_v1";var Ii="config.yaml.bak.byok-legacy-provider.";var hr=new Set(["alran","alran_api","provider","custom_provider"]);var dl=/^[A-Za-z0-9 _-]+$/;function Li(e,n){const t={migrated:false,migratedProviders:{}};if(!n.isManagedRuntime())return t;if(!tt.existsSync(e))return t;const o=gl(e);if(!z(o.provider))return t;const i=o.provider;const a=z(o.custom_provider)?o.custom_provider:{};const l=Rl(o);const c={};const d={...a};const f=new Set(Object.keys(d));let u=false;const m=n.getManagedPreset().provider;for(const[y,x]of Object.entries(i)){if(!yl(y,x,m)){continue}const w=l.providers[y];if(w&&!hr.has(w)&&!z(d[w])){delete i[y];u=true;continue}const T=w&&!hr.has(w)?w:Al(y,x,f);c[y]=T;if(!z(d[T])){d[T]=bl(x);f.add(T);u=true}if(l.providers[y]!==T){l.providers[y]=T;u=true}delete i[y];u=true}if(!u&&Object.keys(c).length===0)return t;u=Ri(o,"defaultModel",c)||u;u=Ri(o,"defaultLightModel",c)||u;u=xl(o,c)||u;if(!u)return{migrated:false,migratedProviders:c};if(Object.keys(d).length>0)o.custom_provider=d;else delete o.custom_provider;vl(o,l);try{const y=Sl(e);fe(e,ne.dump(o,{indent:2,lineWidth:-1,noRefs:true}));return{migrated:true,migratedProviders:c,backupPath:y}}catch(y){console.warn(`[config] legacy BYOK provider migration skipped: ${kl(y)}`);return{migrated:false,migratedProviders:c}}}function Pi(e,n){let t=e.provider;const o=e.defaultModel;if(Object.prototype.hasOwnProperty.call(t,"alran_api")){const{alran_api:w,...T}=t;t=T;console.warn('[config] "alran_api" is a reserved provider id; ignoring provider.alran_api from config.yaml')}const i=n.getManagedPreset();const a=i.provider.alran;const l=t.alran;const c=n.isManagedRuntime();const d=c||pl(l,n);if(!d)return{provider:t,defaultModel:o};const f=l?.options;const u=c&&n.shouldEnforceManagedProviderProtection();const m=ml(a.models,l?.models);const y=typeof f?.baseURL==="string"&&f.baseURL.length>0?f.baseURL:void 0;const x=u&&y!=null&&!n.isManagedPresetBaseUrl(y);t={...t,alran:{...a,...l??{},npm:l?.npm??a.npm,models:m,options:{...a.options??{},...f??{},...x?{apiKey:a.options?.apiKey}:{},...u?{authMode:"managed-login",baseURL:a.options?.baseURL}:{}}}};return{provider:t,defaultModel:o}}function pl(e,n){const t=e?.options;if(t?.authMode==="managed-login")return true;return typeof t?.baseURL==="string"&&n.isManagedPresetBaseUrl(t.baseURL)}function ml(e,n){return n&&Object.keys(n).length>0?n:e??{}}function gl(e){try{const n=ne.load(tt.readFileSync(e,"utf-8"));return z(n)?n:{}}catch{return{}}}function yl(e,n,t){if(e==="alran"||e==="alran_api")return false;if(!El(n))return false;if(!hl(n))return false;return!Object.prototype.hasOwnProperty.call(t,e)}function hl(e){const n=z(e.options)?e.options:void 0;return typeof n?.apiKey==="string"&&n.apiKey.trim().length>0&&typeof n.baseURL==="string"&&n.baseURL.trim().length>0&&z(e.models)}function bl(e){const n=z(e.options)?e.options:{};return{...e,kind:"custom",enabled:e.enabled!==false,options:{...n,authMode:"api-key"}}}function Al(e,n,t){const o=z(n)?n:{};const i=typeof o.name==="string"?o.name:void 0;const a=`provider-${_l(e)}`;const l=Si(e)??Si(i)??a;for(let c=0;;c+=1){const d=c===0?l:`${l}-${c+1}`;if(!t.has(d)&&!hr.has(d)){return d}}}function Si(e){const n=e?.trim();if(!n||!dl.test(n))return void 0;const t=n.toLowerCase().replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"");return t||void 0}function _l(e){return cl("sha256").update(e).digest("hex").slice(0,8)}function Ri(e,n,t){const o=e[n];if(typeof o!=="string")return false;const i=Cl(o,t);if(i===o)return false;e[n]=i;return true}function Cl(e,n){const t=e.indexOf("/");if(t<=0||t===e.length-1)return e;const o=e.slice(0,t);const i=n[o];if(!i)return e;return`custom_provider:${i}/${e.slice(t+1)}`}function xl(e,n){if(!z(e.nexus)||!z(e.nexus.model))return false;const t=e.nexus.model.providerID;if(typeof t!=="string")return false;const o=n[t];if(!o)return false;e.nexus.model.providerID=`custom_provider:${o}`;return true}function Di(e){if(process.platform==="win32")return;const n=nt.dirname(e);let t;try{t=tt.readdirSync(n,{withFileTypes:true})}catch{console.warn(`[config] Could not inspect legacy BYOK backups in ${JSON.stringify(n)}. Backup permissions were not verified; check directory access and restrict backup permissions manually.`);return}for(const o of t){if(o.isFile()&&o.name.startsWith(Ii)){const i=nt.join(n,o.name);try{rn(i)}catch{console.warn(`[config] Could not restrict legacy BYOK backup ${JSON.stringify(i)}. It may still be readable by other users; restrict its permissions manually.`)}}}}function Sl(e){const n=nt.join(nt.dirname(e),`${Ii}${Date.now()}.${fl()}`);rn(e);fe(n,tt.readFileSync(e),true);return n}function Rl(e){const n=z(e.migrations)?e.migrations:void 0;const t=n?.[Mi];const o=z(t)&&z(t.providers)?Object.fromEntries(Object.entries(t.providers).filter(i=>typeof i[1]==="string")):{};return{providers:o}}function vl(e,n){const t=z(e.migrations)?e.migrations:{};t[Mi]={version:1,providers:n.providers};e.migrations=t}function El(e){if(!z(e))return false;return typeof e.name==="string"||typeof e.npm==="string"||typeof e.api==="string"||z(e.options)||z(e.models)}function z(e){return e!=null&&typeof e==="object"&&!Array.isArray(e)}function kl(e){if(e instanceof Error)return e.message;return String(e)}var wn="native";function On(e){if(e==="native"||e==="mcp")return e;return wn}function Ni(e){if(e==="mcp"){throw new Error("MCP backend coming in v2 follow-up plan")}}function Fi(e,n){if(e==null||typeof e!=="object"||Array.isArray(e)){return n}const t=Reflect.get(e,"mode");return{mode:t==="inline"||t==="subagent"?t:n.mode,modeSource:t==="inline"||t==="subagent"?"explicit":"default"}}function Bi(e,n){const t=n.keepAlive;const o=n.xdg;const i=n.spawnConcurrency;const a=()=>({enabled:t.enabled,maxProcesses:t.maxProcesses,maxLifetimeMs:t.maxLifetimeMs,agents:[...t.agents]});const l=e.opencode;if(l==null||typeof l!=="object"||Array.isArray(l)){return{keepAlive:a(),xdg:{...o},spawnConcurrency:i}}const c=l;const d=c.spawnConcurrency;const f=typeof d==="number"&&Number.isFinite(d)&&d>0&&Number.isInteger(d)?d:i;const u=Tl(c.xdg,o);const m=c.keepAlive;if(m==null||typeof m!=="object"||Array.isArray(m)){return{keepAlive:a(),xdg:u,spawnConcurrency:f}}const y=m;const x=y.maxProcesses;const w=typeof x==="number"&&Number.isFinite(x)&&x>0&&Number.isInteger(x)?x:t.maxProcesses;const T=y.maxLifetimeMs;const D=typeof T==="number"&&Number.isFinite(T)&&T>0&&Number.isInteger(T)?T:t.maxLifetimeMs;const N=y.agents;let U;if(Array.isArray(N)){U=N.filter(G=>typeof G==="string"&&G.length>0);if(U.length===0)U=[...t.agents]}else{U=[...t.agents]}return{keepAlive:{enabled:typeof y.enabled==="boolean"?y.enabled:t.enabled,maxProcesses:w,maxLifetimeMs:D,agents:U},xdg:u,spawnConcurrency:f}}function Tl(e,n){const t=e!=null&&typeof e==="object"&&!Array.isArray(e)?e:void 0;const o=t?.startupImport;const i=o==="background"||o==="blocking"||o==="off"?o:n.startupImport;return{dataIsolation:typeof t?.dataIsolation==="boolean"?t.dataIsolation:n.dataIsolation,startupImport:i}}function rt(e){const n=JSON.stringify({level:40,time:Date.now(),name:"config.asr",msg:e});process.stderr.write(`${n}
3
+ `)}var it={enabled:true};function Ui(e){if(e==null||typeof e!=="object"||Array.isArray(e))return false;const n=e;const t=typeof n.apiKey==="string"&&n.apiKey.trim().length>0;const o=typeof n.resourceId==="string"&&n.resourceId.trim().length>0;return t||o}function ot(e){return typeof e==="string"&&e.trim().length>0}function ji(e){const n=e.asr;if(n==null||typeof n!=="object"||Array.isArray(n)){return{...it}}const t=n;if(Ui(t.seed)){rt("Ignoring legacy `asr.seed.*` in config \u2014 Seed ASR was retired from the daemon; only Amadeus remains. Remove `asr.seed` from config.yaml.")}if(Ui(t.qwen)){rt("Ignoring legacy `asr.qwen.apiKey` in config \u2014 Qwen ASR was retired from the daemon; only Amadeus remains. Remove `asr.qwen` from config.yaml.")}if(ot(t.mode)||ot(t.proxyBaseUrl)){rt("Ignoring legacy `asr.mode` / `asr.proxyBaseUrl` in config \u2014 the daemon no longer runs the shared asr-proxy WebSocket path. The Amadeus HTTP proxy is managed by the application environment. Remove these keys from config.yaml.")}if(ot(t.primaryProvider)||ot(t.fallbackProvider)){rt("Ignoring legacy `asr.primaryProvider` / `asr.fallbackProvider` in config \u2014 only Amadeus remains and provider selection is no longer configurable. Remove these keys from config.yaml.")}return{enabled:typeof t.enabled==="boolean"?t.enabled:it.enabled}}var wl={policyOwner:"core",storageWriteVersion:2,classifierTimeoutMs:6e4,userConfirmationEnabled:true,nativeDelete:false};function Ki(e,n=wl){const t=e.permission;if(t==null||typeof t!=="object"||Array.isArray(t)){return{...n}}const o=t;const i=o.policyOwner===void 0?n.policyOwner:o.policyOwner==="engine"||o.policyOwner==="core"?o.policyOwner:"engine";const a=o.storageWriteVersion===1||o.storageWriteVersion===2?o.storageWriteVersion:n.storageWriteVersion;const l=o.classifierTimeoutMs;const c=typeof l==="number"&&Number.isFinite(l)&&l>=5e3?Math.floor(l):n.classifierTimeoutMs;const d=typeof o.userConfirmationEnabled==="boolean"?o.userConfirmationEnabled:n.userConfirmationEnabled;const f=o.nativeDelete===true;return{policyOwner:i,storageWriteVersion:a,classifierTimeoutMs:c,userConfirmationEnabled:d,nativeDelete:f}}var Gi=["user-cc","user-codex","user-agents","workspace-alran","workspace-cc","workspace-agents"];var Ol={"user-cc":"user-claude","workspace-cc":"workspace-claude"};var at={external:{enabled:true,walkUp:true,duplicateWarn:true,sources:{"workspace-alran":{enabled:true,priority:65},"workspace-cc":{enabled:true,priority:60},"workspace-agents":{enabled:true,priority:55},"user-cc":{enabled:true,priority:40},"user-codex":{enabled:true,priority:35},"user-agents":{enabled:true,priority:30}}}};function st(e){return e!=null&&typeof e==="object"&&!Array.isArray(e)}function Ml(e,n){if(!st(e))return n;return{enabled:typeof e.enabled==="boolean"?e.enabled:n.enabled,priority:typeof e.priority==="number"&&Number.isFinite(e.priority)?e.priority:n.priority}}function _r(e){const n=at;const t=st(e.skills)?e.skills:{};const o=st(t.external)?t.external:{};const i=st(o.sources)?o.sources:{};const a={...n.external.sources};for(const l of Gi){const c=Ol[l];const d=Object.hasOwn(i,l)?i[l]:c?i[c]:void 0;a[l]=Ml(d,n.external.sources[l])}return{external:{enabled:typeof o.enabled==="boolean"?o.enabled:n.external.enabled,walkUp:typeof o.walkUp==="boolean"?o.walkUp:n.external.walkUp,duplicateWarn:typeof o.duplicateWarn==="boolean"?o.duplicateWarn:n.external.duplicateWarn,sources:a}}}var Il=Gi;var Vi=["pi-agent"];var on="pi-agent";function $i(e){if(typeof e!=="string")return on;if(Vi.includes(e)){return e}return on}function Cr(e){if(e==null||typeof e!=="object"||Array.isArray(e)){return{defaultFramework:on}}const n=e;return{defaultFramework:$i(n.defaultFramework)}}import qi from"node:fs";import Ll from"node:os";import Pl from"node:path";var Yi=".alran";var Dl={error:()=>void 0,info:()=>void 0,warn:()=>void 0};function Nl(e){return e??Ll.homedir()}function Fl(e,n){return n?`${e}-${n}`:e}function Wi(e,n){return Pl.join(Nl(e),Fl(Yi,n))}function Bl(e,n){try{const t=qi.lstatSync(e);if(t.isSymbolicLink()||!t.isDirectory()){n.warn(`Data dir path ${e} exists but is not a directory; using it as it is`);return}}catch(t){const o=t.code;if(o!=="ENOENT"&&o!=="ENOTDIR"){n.warn(`Data dir ${e} is inaccessible: ${String(t)}`);return}}try{qi.mkdirSync(e,{recursive:true})}catch(t){n.warn(`Failed to create data dir ${e}: ${String(t)}`)}}function sn(e={}){const n=Wi(e.homeDir,e.profile??null);Bl(n,e.logger??Dl);return n}var kr=["read","write","edit","bash","task_query","task_output","task_stop","grep","glob","todowrite","web_fetch","website_deploy"];var Tr=["images_understand","image_synthesize","images_search_and_download","image_reverse_search","submit_video_generation","query_video_generation","gen_videos","batch_text_to_video","batch_image_to_video","get_voice_list","batch_text_to_audio","batch_text_to_music","synthesize_speech","batch_synthesize_speech","audios_understand","videos_understand","transcribe_audio"];var wr=["code-review","deep-research","deploy-website","docx","edit-deployed-website","init","llm-call","alran-tools-master","alran-doctor","pdf","plugin-creator","pptx","skill-creator","skill-refiner","visual-page","x-link-reader","xlsx"];var zi=["control-in-app-browser","cu-desktop","resume-codex","alran","create-agent","alran-code-product","miniapp-creator"];var Ul=new Set(["modelConfigId","persona","tools","builtinTools","skills","features"]);var jl=new Set(["enabled"]);var vr=new Set(["alran","delegation","webSearch"]);var Ji=new Set(kr);var Hi=["task_query","task_output","task_stop"];var Qi=new Set(Tr);var Er=new Set(wr);var Zi=new Set(zi);var Kl=new Set(["plan-mode"]);function Or(e){const n=lt(e);const t=lt(n?.default);return{default:t?Vl(t):{}}}function Gl(e,n="agent"){if(e===void 0)return{};const t=Sr(e,n);Rr(t,Ul,n);const o={};if(t.modelConfigId!==void 0){if(typeof t.modelConfigId!=="string"||!t.modelConfigId.trim()){de(`${n}.modelConfigId`,"must be a non-empty string")}o.modelConfigId=t.modelConfigId.trim()}if(t.persona!==void 0){const i=Sr(t.persona,`${n}.persona`);Rr(i,jl,`${n}.persona`);if(i.enabled!==void 0&&typeof i.enabled!=="boolean"){de(`${n}.persona.enabled`,"must be a boolean")}o.persona={...typeof i.enabled==="boolean"?{enabled:i.enabled}:{}}}if(t.tools!==void 0){if(!Array.isArray(t.tools))de(`${n}.tools`,"must be an array");o.tools=t.tools.map((i,a)=>{if(typeof i!=="string"||!Ji.has(i)){de(`${n}.tools[${a}]`,`must be one of ${kr.join(", ")}`)}return i})}if(t.builtinTools!==void 0){if(!Array.isArray(t.builtinTools))de(`${n}.builtinTools`,"must be an array");o.builtinTools=t.builtinTools.map((i,a)=>{if(i==="web_search"){de(`${n}.builtinTools[${a}]`,"web_search is feature-owned; use features.webSearch")}if(typeof i!=="string"||!Qi.has(i)){de(`${n}.builtinTools[${a}]`,`must be one of ${Tr.join(", ")}`)}return i})}if(t.skills!==void 0){if(!Array.isArray(t.skills))de(`${n}.skills`,"must be an array");o.skills=t.skills.map((i,a)=>{if(typeof i==="string"&&Zi.has(i.trim())){const l=i.trim();de(`${n}.skills[${a}]`,`${l} is capability-owned; use its owning Tool or feature switch`)}if(typeof i!=="string"||!Er.has(i.trim())){de(`${n}.skills[${a}]`,`must be one of ${wr.join(", ")}`)}return i.trim()})}if(t.features!==void 0){const i=Sr(t.features,`${n}.features`);Rr(i,vr,`${n}.features`);for(const a of vr){if(i[a]!==void 0&&typeof i[a]!=="boolean"){de(`${n}.features.${a}`,"must be a boolean")}}o.features={...typeof i.alran==="boolean"?{alran:i.alran}:{},...typeof i.delegation==="boolean"?{delegation:i.delegation}:{},...typeof i.webSearch==="boolean"?{webSearch:i.webSearch}:{}}}return o}function Vl(e){const n={};if(typeof e.modelConfigId==="string"&&e.modelConfigId.trim()){n.modelConfigId=e.modelConfigId.trim()}const t=lt(e.persona);if(typeof t?.enabled==="boolean"){n.persona={enabled:t.enabled}}if(Xi(e.tools,Ji)){const i=[...e.tools];if(!Hi.some(a=>i.includes(a))){i.push(...Hi)}n.tools=i}if(Xi(e.builtinTools,Qi)){n.builtinTools=[...e.builtinTools]}if(Array.isArray(e.skills)){const i=e.skills.map(a=>typeof a==="string"?a.trim():a);if(i.every(a=>typeof a==="string"&&(Er.has(a)||Kl.has(a))&&!Zi.has(a))){n.skills=i.filter(a=>typeof a==="string"&&Er.has(a))}}const o=lt(e.features);if(o){const i={};for(const a of vr){if(typeof o[a]==="boolean")i[a]=o[a]}if(Object.keys(i).length>0)n.features=i}return n}function lt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)?e:void 0}function Xi(e,n){return Array.isArray(e)&&e.every(t=>typeof t==="string"&&n.has(t))}function $l(e={},n={}){return{persona:{enabled:n.persona?.enabled??e.persona?.enabled??true},tools:xr(n.tools??e.tools),builtinTools:xr(n.builtinTools??e.builtinTools),skills:xr(n.skills??e.skills),features:{alran:n.features?.alran??e.features?.alran??true,delegation:n.features?.delegation??e.features?.delegation??true,webSearch:n.features?.webSearch??e.features?.webSearch??true}}}function ql(e,n){return e.tools===void 0||e.tools.includes(n)}function Yl(e,n){return e.builtinTools===void 0||e.builtinTools.includes(n)}function Wl(e,n){return e.skills===void 0||e.skills.includes(n)}function xr(e){return e===void 0?void 0:[...e]}function Sr(e,n){if(e==null||typeof e!=="object"||Array.isArray(e)){de(n,"must be an object")}return e}function Rr(e,n,t){for(const o of Object.keys(e)){if(!n.has(o))de(`${t}.${o}`,"is not supported")}}function de(e,n){throw new Error(`Invalid configuration at ${e}: ${n}`)}var Mr={enabled:true};function es(e,n=Mr){const t=e.askUser;if(t==null||typeof t!=="object"||Array.isArray(t)){return{...n}}const o=t;return{enabled:typeof o.enabled==="boolean"?o.enabled:n.enabled}}var rs=["none","evaluator","subagent"];var os=["brief","transcript"];var is=["same-route-small-fast"];var ss="goal-verifier-readonly";var as=[ss];var ge={budget:{graceSteps:1},breaker:{repeatedReplyLimit:3},verifier:{repeatedNotMetLimit:5,evidence:"brief"},evaluator:{modelPolicy:"same-route-small-fast",maxTokens:32e3,timeoutSeconds:60,maxRetries:1}};var Ir={budget:{graceSteps:3},evaluator:{maxRetries:1}};function Lr(e){const n=[];const t=an(e,"goal",n);ln(t,"goal",n,["objectiveMaxChars","verification","budget","breaker","verifier","evaluator","subagent"]);const o=an(t.budget,"goal.budget",n);ln(o,"goal.budget",n,["defaultTokens","defaultMainTurns","defaultActiveSeconds","graceSteps"]);const i=an(t.breaker,"goal.breaker",n);ln(i,"goal.breaker",n,["repeatedReplyLimit"]);const a=an(t.verifier,"goal.verifier",n);ln(a,"goal.verifier",n,["repeatedNotMetLimit","evidence"]);const l=an(t.evaluator,"goal.evaluator",n);ln(l,"goal.evaluator",n,["modelPolicy","maxTokens","timeoutSeconds","maxRetries"]);const c=an(t.subagent,"goal.subagent",n);ln(c,"goal.subagent",n,["profile","maxTurns","maxTokens","timeoutSeconds"]);const d=ts(t.verification,"goal.verification",rs,n);const f=He(t.objectiveMaxChars,"goal.objectiveMaxChars",n,{min:1});const u=He(o.defaultTokens,"goal.budget.defaultTokens",n,{min:1});const m=He(o.defaultMainTurns,"goal.budget.defaultMainTurns",n,{min:1});const y=He(o.defaultActiveSeconds,"goal.budget.defaultActiveSeconds",n,{min:1});const x=ts(c.profile,"goal.subagent.profile",as,n);const w=He(c.maxTurns,"goal.subagent.maxTurns",n,{min:1});const T=He(c.maxTokens,"goal.subagent.maxTokens",n,{min:1});const D=He(c.timeoutSeconds,"goal.subagent.timeoutSeconds",n,{min:1});const N={...x!==void 0?{profile:x}:{},...w!==void 0?{maxTurns:w}:{},...T!==void 0?{maxTokens:T}:{},...D!==void 0?{timeoutSeconds:D}:{}};return{config:{...f!==void 0?{objectiveMaxChars:f}:{},...d!==void 0?{verification:d}:{},budget:{...u!==void 0?{defaultTokens:u}:{},...m!==void 0?{defaultMainTurns:m}:{},...y!==void 0?{defaultActiveSeconds:y}:{},graceSteps:un(o.graceSteps,"goal.budget.graceSteps",ge.budget.graceSteps,n,{min:0,max:Ir.budget.graceSteps})},breaker:{repeatedReplyLimit:un(i.repeatedReplyLimit,"goal.breaker.repeatedReplyLimit",ge.breaker.repeatedReplyLimit,n,{min:1})},verifier:{repeatedNotMetLimit:un(a.repeatedNotMetLimit,"goal.verifier.repeatedNotMetLimit",ge.verifier.repeatedNotMetLimit,n,{min:1}),evidence:ns(a.evidence,"goal.verifier.evidence",os,ge.verifier.evidence,n)},evaluator:{modelPolicy:ns(l.modelPolicy,"goal.evaluator.modelPolicy",is,ge.evaluator.modelPolicy,n),maxTokens:un(l.maxTokens,"goal.evaluator.maxTokens",ge.evaluator.maxTokens,n,{min:1}),timeoutSeconds:un(l.timeoutSeconds,"goal.evaluator.timeoutSeconds",ge.evaluator.timeoutSeconds,n,{min:1}),maxRetries:un(l.maxRetries,"goal.evaluator.maxRetries",ge.evaluator.maxRetries,n,{min:0,max:Ir.evaluator.maxRetries})},...Object.keys(N).length>0?{subagent:N}:{}},warnings:n}}function an(e,n,t){if(e===void 0)return{};if(e===null||typeof e!=="object"||Array.isArray(e)){t.push(Ue(n,"expected an object; using defaults"));return{}}return e}function ln(e,n,t,o){for(const i of Object.keys(e)){if(!o.includes(i))t.push(Ue(`${n}.${i}`,"unknown key ignored"))}}function un(e,n,t,o,i){if(e==null)return t;if(!Number.isInteger(e)||e<i.min){o.push(Ue(n,`expected an integer >= ${i.min}; using default`));return t}if(i.max!=null&&e>i.max){o.push(Ue(n,`exceeds maximum ${i.max}; clamped`));return i.max}return e}function He(e,n,t,o){if(e==null)return void 0;if(!Number.isInteger(e)||e<o.min){t.push(Ue(n,`expected an integer >= ${o.min}; ignored`));return void 0}if(o.max!=null&&e>o.max){t.push(Ue(n,`exceeds maximum ${o.max}; clamped`));return o.max}return e}function ns(e,n,t,o,i){if(e==null)return o;if(typeof e!=="string"||!t.includes(e)){i.push(Ue(n,`expected one of: ${t.join(", ")}; using default`));return o}return e}function ts(e,n,t,o){if(e==null)return void 0;if(typeof e!=="string"||!t.includes(e)){o.push(Ue(n,`expected one of: ${t.join(", ")}; ignored`));return void 0}return e}function Ue(e,n){return`Invalid goal config at ${e}: ${n}`}var Mn=["timeout","network","rate_limited","tpm_rate_limited","overloaded"];var ye=Object.freeze({maxRetries:5,initialDelayMs:1e3,maxDelayMs:3e4,maxElapsedMs:12e4,retryOn:Object.freeze([...Mn])});var ls=Object.freeze({maxRetries:{min:0,max:20},initialDelayMs:{min:100,max:6e4},maxDelayMs:{min:100,max:6e5},maxElapsedMs:{min:1e3,max:36e5}});var Hl=new Set(["maxRetries","initialDelayMs","maxDelayMs","maxElapsedMs","retryOn"]);function Xl(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function ut(e,n,t,o){if(e===void 0||e===null)return t;const{min:i,max:a}=ls[n];const l=typeof e==="number"?e:typeof e==="string"&&e.trim()!==""?Number(e):NaN;if(!Number.isInteger(l)){o.push(`retry.${n} must be a whole number; using ${t}.`);return t}if(l<i||l>a){const c=Math.min(a,Math.max(i,l));o.push(`retry.${n} must be between ${i} and ${a}; using ${c}.`);return c}return l}function Pr(e){const n=[];if(e===void 0||e===null)return{config:structuredClone(ye),warnings:n};if(!Xl(e)){return{config:structuredClone(ye),warnings:["retry must be a mapping (maxRetries, initialDelayMs, maxDelayMs, maxElapsedMs, retryOn); using the defaults."]}}for(const c of Object.keys(e))if(!Hl.has(c))n.push(`retry.${c} is not a setting; ignored.`);const t=ut(e.maxRetries,"maxRetries",ye.maxRetries,n);const o=ut(e.initialDelayMs,"initialDelayMs",ye.initialDelayMs,n);let i=ut(e.maxDelayMs,"maxDelayMs",ye.maxDelayMs,n);if(i<o){n.push(`retry.maxDelayMs (${i}) is below retry.initialDelayMs (${o}); using ${o}.`);i=o}const a=ut(e.maxElapsedMs,"maxElapsedMs",ye.maxElapsedMs,n);let l=ye.retryOn;if(e.retryOn!==void 0&&e.retryOn!==null){if(!Array.isArray(e.retryOn)){n.push(`retry.retryOn must be a list of ${Mn.join(", ")}; using all of them.`)}else{const c=[];for(const d of e.retryOn){const f=typeof d==="string"?d.trim().toLowerCase().replace(/-/g,"_"):"";if(Mn.includes(f)){if(!c.includes(f))c.push(f)}else{n.push(`retry.retryOn: "${String(d)}" is not a category that can be retried (${Mn.join(", ")}); ignored.`)}}if(c.includes("rate_limited")&&!c.includes("tpm_rate_limited"))c.push("tpm_rate_limited");l=Object.freeze(c)}}return{config:{maxRetries:t,initialDelayMs:o,maxDelayMs:i,maxElapsedMs:a,retryOn:l},warnings:n}}function zl(e){const n=e??ye;return{maxRetries:n.maxRetries,baseDelayMs:n.initialDelayMs,maxDelayMs:n.maxDelayMs,maxRetryElapsedMs:n.maxElapsedMs,retryReasons:n.retryOn}}var Se={enabled:true,maxInlineKiB:64,mcpDetailsMaxInlineKiB:32,watermarkKiB:256,minSavingsKiB:256,minCandidateKiB:2,keepRecentRounds:5};var Jl=Math.floor(Number.MAX_SAFE_INTEGER/1024);function Dr(e){const n=Zl(e)?e:{};return{enabled:typeof n.enabled==="boolean"?n.enabled:Se.enabled,maxInlineKiB:In(n.maxInlineKiB,Se.maxInlineKiB),mcpDetailsMaxInlineKiB:In(n.mcpDetailsMaxInlineKiB,Se.mcpDetailsMaxInlineKiB),watermarkKiB:In(n.watermarkKiB,Se.watermarkKiB),minSavingsKiB:In(n.minSavingsKiB,Se.minSavingsKiB),minCandidateKiB:In(n.minCandidateKiB,Se.minCandidateKiB),keepRecentRounds:Ql(n.keepRecentRounds,Se.keepRecentRounds)}}function In(e,n){return typeof e==="number"&&Number.isSafeInteger(e)&&e>0&&e<=Jl?e:n}function Ql(e,n){return typeof e==="number"&&Number.isSafeInteger(e)&&e>0?e:n}function Zl(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var eu=5*1024*1024;var Ln={recoveryDivisor:2,image:{max_width:2e3,max_height:2e3,max_base64_bytes:4.5*1024*1024}};function Fr(e){const n=us(e)?e:{};const t=n.recoveryDivisor;const o=us(n.image)?n.image:{};const i=Ln.image;return{recoveryDivisor:typeof t==="number"&&Number.isFinite(t)&&t>1?t:Ln.recoveryDivisor,image:{max_width:Nr(o.max_width)??i.max_width,max_height:Nr(o.max_height)??i.max_height,max_base64_bytes:Math.min(Nr(o.max_base64_bytes)??i.max_base64_bytes,eu)}}}function Nr(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>0?e:void 0}function us(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Pn={};function Br(e){if(e==null||typeof e!=="object"||Array.isArray(e)){return{...Pn}}const n=Reflect.get(e,"chromePath");if(typeof n!=="string"||!n.trim()){return{...Pn}}return{chromePath:n.trim()}}import{isIP as nu}from"node:net";function cs(e){return{enabled:false,filesystemMode:"full_access"}}function fs(e){return!e.enabled||e.filesystemMode==="full_access"?{enabled:false,filesystemMode:"full_access"}:{...e}}function jr(e){const n=cs(e);return{enabled:n.enabled,filesystem:{policy:{mode:n.filesystemMode},denyRead:[],denyWrite:[]},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:"open"}}var Kr=jr(process.platform);var tu=new Set(["read_only","workspace_write","delete_guard","full_access"]);var ru=new Set(["deny","allow_all"]);function Gr(e,n=process.platform){const t=jr(n);if(e===void 0)return t;const o=Dn(e,"sandbox",["enabled","filesystem","network","localAccess"]);const i=o.filesystem===void 0?{}:Dn(o.filesystem,"sandbox.filesystem",["policy","denyRead","denyWrite","allowGitConfig"]);const a=i.policy===void 0?{}:Dn(i.policy,"sandbox.filesystem.policy",["mode"]);const l=o.network===void 0?{}:Dn(o.network,"sandbox.network",["policy","deniedDomains"]);const c=l.policy===void 0?{}:Dn(l.policy,"sandbox.network.policy",["mode"]);const d=o.enabled===void 0?t.enabled:ou(o.enabled,"sandbox.enabled");const f=a.mode??(d?"delete_guard":"full_access");if(typeof f!=="string"||!tu.has(f)){throw new Error(`Invalid sandbox.filesystem.policy.mode "${String(f)}"`)}const u=c.mode??t.network.policy.mode;if(typeof u!=="string"||!ru.has(u)){throw new Error(`Invalid sandbox.network.policy.mode "${String(u)}"`)}const m=l.deniedDomains===void 0?[...t.network.deniedDomains]:Ur(l.deniedDomains,"sandbox.network.deniedDomains");for(const x of m)iu(x);const y=fs({enabled:d,filesystemMode:f});return{enabled:y.enabled,filesystem:{policy:{mode:y.filesystemMode},denyRead:i.denyRead===void 0?[...t.filesystem.denyRead]:Ur(i.denyRead,"sandbox.filesystem.denyRead"),denyWrite:i.denyWrite===void 0?[...t.filesystem.denyWrite]:Ur(i.denyWrite,"sandbox.filesystem.denyWrite")},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:o.localAccess===void 0?t.localAccess:o.localAccess==="open"||o.localAccess==="restricted"?o.localAccess:(()=>{throw new Error(`Invalid sandbox.localAccess "${String(o.localAccess)}"`)})()}}function Dn(e,n,t){if(e==null||typeof e!=="object"||Array.isArray(e)){throw new Error(`Invalid ${n}: expected object`)}const o=e;const i=Object.keys(o).find(a=>!t.includes(a));if(i)throw new Error(`Unknown ${n}.${i}`);return o}function ou(e,n){if(typeof e!=="boolean")throw new Error(`Invalid ${n}: expected boolean`);return e}function Ur(e,n){if(!Array.isArray(e)||e.some(t=>typeof t!=="string")){throw new Error(`Invalid ${n}: expected string array`)}return[...e]}function iu(e){const n=()=>{throw new Error(`Invalid sandbox.network.deniedDomains entry "${e}"`)};const t=e.match(/^\[([^\]]+)\](?::(.+))?$/);if(t){if(nu(t[1]??"")!==6)n();ds(t[2],e);return}if((e.match(/:/g)??[]).length>1){n()}const o=e.lastIndexOf(":");const i=o>-1?e.slice(0,o):e;const a=o>-1?e.slice(o+1):void 0;ds(a,e);if(i==="*")return;if(!su(i))n()}function su(e){if(e.includes("://")||e.includes("/")||e.includes(":"))return false;if(e==="localhost")return true;if(e.startsWith("*.")){const n=e.slice(2);const t=n.split(".");return t.length>=2&&t.every(o=>o.length>0)}if(e.includes("*"))return false;return e.includes(".")&&!e.startsWith(".")&&!e.endsWith(".")}function ds(e,n){if(e===void 0)return;const t=Number(e);if(!/^[1-9][0-9]{0,4}$/.test(e)||!Number.isInteger(t)||t>65535){throw new Error(`Invalid sandbox.network.deniedDomains entry "${n}"`)}}function ps(e,n){if(n.length===0)return false;if(n.includes("*"))return true;return n.includes(e)}var je=Object.freeze({commits:true,pullRequests:true});var Vr="Alran Code";var ms="noreply@alran.dev";var gs="https://alran.dev";var ys=`Generated by [${Vr}](${gs})`;var au="ALRAN_COMMIT_TRAILER";function $r(e){const n=e.attribution;if(n==null||typeof n!=="object"||Array.isArray(n)){return{...je}}const t=n;return{commits:typeof t.commits==="boolean"?t.commits:je.commits,pullRequests:typeof t.pullRequests==="boolean"?t.pullRequests:je.pullRequests}}var lu=/^(?:ottili|alran|claude|anthropic)[\s_-]+/iu;var uu=64;function cu(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function ct(e){return e.replace(/[^\p{L}\p{N} ._+()/-]/gu," ").replace(/\s+/gu," ").trim().slice(0,uu).trim()}function hs(e){const n=(e??"").trim();if(!n)return"";const t=Ce[n]?.name;if(t)return ct(t.replace(lu,""));const o=n.slice(n.lastIndexOf("/")+1);const i=/^(?:(?:ottili|alran)[\s_-]+)?werk(?:[\s_-]+(\d+(?:[.-]\d+)*))?$/iu.exec(o);if(i)return ct(`Werk${i[1]?` ${i[1].replace(/-/gu,".")}`:""}`);const a=/^(?:claude[\s_-]+)?(opus|sonnet|haiku)[\s_-]+(\d+(?:[.-]\d+)*)$/iu.exec(o);if(a?.[1]&&a[2])return ct(`${cu(a[1])} ${a[2].replace(/-/gu,".")}`);return ct(o)}function bs(e){const n=e?.trim()?` using ${e.trim()}`:"";return`Co-Authored-By: ${Vr}${n} <${ms}>`}function As(e,n){if((n?.commits??je.commits)!==true)return void 0;return bs(hs(e?.model_id))}function fu(e){const n=As(e.model,e.config);const t=(e.config?.pullRequests??je.pullRequests)===true;if(!n&&!t)return void 0;return["Attribution for git commits and pull requests you create from here on (replaces any earlier attribution guidance, including an earlier copy of this reminder; the user's own instructions about these lines, such as AGENTS.md or memory rules, take precedence over this reminder, but do not add attribution lines this reminder leaves out):","",...n?["- End git commit messages with:",n]:[],...t?["- End pull request descriptions with:",ys]:[]].join("\n")}function gu(){return process.env.__ALRAN_ALLOW_LEGACY_RUNTIME_ENV==="1"}var _s={dev:"test",test:"test",staging:"staging",prod:"prod"};function yu(e){return e==="cn"||e==="en"}function Es(e){return e==="test"||e==="prod"||e==="dev"||e==="staging"}function ks(){const e=process.env.ALRAN_REGION;if(yu(e))return e;if(dt()){const n=process.env.NEXT_PUBLIC_LOCALE;if(n==="zh")return"cn";if(n==="en")return"en"}return"en"}function he(){const e=process.env.ALRAN_BUILD_ENV;if(Es(e))return e;if(dt()){const n=process.env.NEXT_PUBLIC_BUILD_ENV;const t=n&&Object.prototype.hasOwnProperty.call(_s,n)?_s[n]:void 0;if(t)return t}return"prod"}function ft(){if(ws("managed"))return true;const e=process.env.__ALRAN_RUNTIME_MANAGED;if(e==="1")return true;if(e==="0")return false;if(dt())return true;if(he()==="prod"||he()==="staging")return true;return false}function dt(){const e=process.versions;return process.env.ELECTRON_RUN_AS_NODE==="1"||typeof e.electron==="string"}function Fn(){return`${ks()}-${he()}`}var Ee={none:0,test:1,internal:2,online:3};var hu={internal:"internal",inside:"online"};function bu(e){for(const[n,t]of Object.entries(e)){if(Ee[t.defaultVisibility]>Ee[t.configurableVisibility]){throw new Error(`Invalid beta feature definition "${n}": defaultVisibility (${t.defaultVisibility}) must not exceed configurableVisibility (${t.configurableVisibility})`)}for(const o of t.defaultBuildVariants??[]){const i=hu[o];if(Ee[i]>Ee[t.configurableVisibility]){throw new Error(`Invalid beta feature definition "${n}": defaultBuildVariant (${o}) must not exceed configurableVisibility (${t.configurableVisibility})`)}}for(const o of t.defaultBuildEnvironments??[]){const i=o==="prod"?"online":"test";if(Ee[i]>Ee[t.configurableVisibility]){throw new Error(`Invalid beta feature definition "${n}": defaultBuildEnvironment (${o}) must not exceed configurableVisibility (${t.configurableVisibility})`)}}}}var Bn={autoMemory:{defaultVisibility:"online",configurableVisibility:"online"},skillEvolve:{defaultVisibility:"test",configurableVisibility:"online"},skillEvolveBuiltinMr:{defaultVisibility:"none",configurableVisibility:"test"},skillProposal:{defaultVisibility:"test",configurableVisibility:"online"},browserBridge:{defaultVisibility:"test",configurableVisibility:"online"},filePanelBrowser:{defaultVisibility:"online",configurableVisibility:"online"},filePanelBrowserMultiTab:{defaultVisibility:"online",configurableVisibility:"online"},browserUseTooling:{defaultVisibility:"online",configurableVisibility:"online"},browserUseAutoOpenPanel:{defaultVisibility:"online",configurableVisibility:"online"},browserAgentCursor:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanMode:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanModeAgentEntry:{defaultVisibility:"none",configurableVisibility:"online"},ptc:{defaultVisibility:"test",defaultBuildVariants:["internal","inside"],configurableVisibility:"online"},peek:{defaultVisibility:"test",configurableVisibility:"test"},keepAlive:{defaultVisibility:"test",configurableVisibility:"test"},promptOverride:{defaultVisibility:"test",configurableVisibility:"test"},cuMode:{defaultVisibility:"online",configurableVisibility:"online"},asr:{defaultVisibility:"online",configurableVisibility:"online"},taskHistoryProjectGrouping:{defaultVisibility:"online",configurableVisibility:"online"},threadGoal:{defaultVisibility:"online",configurableVisibility:"online"},alranTools:{defaultVisibility:"none",defaultBuildEnvironments:["dev","test","staging","prod"],defaultPlatforms:["darwin","linux","win32"],configurableVisibility:"online"},codexOAuth:{defaultVisibility:"online",configurableVisibility:"online"}};bu(Bn);function Au(e){const n=e.buildEnv??he();if(n!=="prod")return"test";return e.internalBuild===true?"internal":"online"}function _u(e,n){const t=e.defaultBuildVariants;if(!t)return false;return n.internalBuild===true&&t.includes("internal")||n.insideBuild===true&&t.includes("inside")}function Cu(e,n){const t=n.defaultBuildEnvironment??n.buildEnv??Hr();return e.defaultBuildEnvironments?.includes(t)===true}function Hr(){const e=dt()?process.env.NEXT_PUBLIC_BUILD_ENV:void 0;return Es(e)?e:he()}function Cs(e,n){return e.defaultPlatforms?.includes(n.platform??process.platform)!==false}function Xr(e,n,t={}){const o=Bn[e];const i=Ee[Au(t)];const a=t.defaultBuildEnvironment??t.buildEnv??Hr();if(e==="alranTools"&&a==="dev"&&t.alranToolsDevMode==="published"&&Cs(o,t))return true;if(n===false)return false;if(n===true)return i<=Ee[o.configurableVisibility];if(!Cs(o,t))return false;if(Cu(o,t))return true;if(_u(o,t))return true;return i<=Ee[o.defaultVisibility]}function xu(e){return Bn[e].configurableVisibility==="online"}function zr(e=process.env){return e.__ALRAN_BUILD_INTERNAL==="true"}function Su(e=process.env){return e.__ALRAN_BUILD_INSIDE==="true"}var Ru={APP_DIR:".alran",ENV_PREFIX:"alran",CLI_NAME:"alran"};var Ts="__ALRAN_RUNTIME";function pt(e){return gu()?process.env[`${Ts}_${e}`]:void 0}function mt(e){const n=`--${e}`;for(let t=2;t<process.argv.length;t++){const o=process.argv[t];if(o===n)return process.argv[t+1];if(o?.startsWith(`${n}=`))return o.slice(n.length+1)}return void 0}function ws(e){const n=`--${e}`;return process.argv.slice(2).some(t=>t===n||t.startsWith(`${n}=`))}var cn=5321;var Yr=5001;var qr=65535;var Os=500;var Jr=2;var vu=Os*Jr;var Ms=vu+Jr;var xs=1;var Eu=new Set(["agent-archon","alran"]);var Ss=(()=>{const e=79764919;const n=new Uint32Array(256);for(let t=0;t<256;t++){let o=t<<24;for(let i=0;i<8;i++){o=(o&2147483648)!==0?e^o<<1:o<<1;o>>>=0}n[t]=o>>>0}return n})();function ku(e){const n=Buffer.from(`${e}
4
+ `,"utf-8");let t=0;for(const i of n){t=(Ss[(t>>>24^i)&255]^t<<8)>>>0}let o=n.length;while(o!==0){t=(Ss[(t>>>24^o&255)&255]^t<<8)>>>0;o>>>=8}return(t^4294967295)>>>0}function Tu(e){return ku(e)%Os*Jr+2}function Rs(e,n){try{const t=pu("git",e,{encoding:"utf-8",timeout:3e3,stdio:["ignore","pipe","pipe"],...n?{cwd:n}:{}});if(t.status===0&&t.stdout)return t.stdout.trim();return null}catch{return null}}function wu(e){const n=e.match(/[/:]([^/:]+?)(?:\.git)?$/);return n?.[1]??null}function Is(){return process.env.ALRAN_DATA_DIR?.trim()||process.env.ALRAN_DATA_DIR?.trim()}function gt(){if(ws("disable-git-auto-config")||pt("DISABLE_GIT_AUTO_CONFIG"))return false;if(mt("data-dir"))return false;if(Is())return false;return true}function yt(){const e=mt("profile")??pt("PROFILE");return e&&e.length>0?e:null}function Ls(){const e=mt("port")??pt("PORT");const n=e?parseInt(e,10):NaN;return Number.isNaN(n)?null:n}function Wr(){const e=mt("data-dir")??Is()??pt("DATA_DIR");return e&&e.length>0?e:null}function Ou(){return Boolean(yt()&&Wr())}function Ps(){return Boolean(yt()&&Ls()!==null)}var Xe=null;function Mu(){Xe=null}function ze(){if(Xe!==null)return Xe;const e={runtimePort:cn,uiPort:Yr,profile:null,autoDetected:false};if(true){Xe=e;return e}const n=[void 0,Iu()];for(const t of n){try{const o=Rs(["remote","get-url","origin"],t);if(!o)continue;const i=wu(o);if(!i||!Eu.has(i))continue;const a=Rs(["branch","--show-current"],t);if(!a)continue;const l=Tu(a);Xe={runtimePort:cn+l,uiPort:Yr+l,profile:a.replace(/\//g,"-"),autoDetected:true};return Xe}catch{}}Xe=e;return e}function Iu(){try{if(typeof __dirname==="string")return __dirname}catch{}const e=new Error().stack??"";for(const n of e.split("\n")){const t=/file:\/\/[^)\s]+/u.exec(n)?.[0]?.replace(/:\d+:\d+$/u,"");if(t){try{return ae.dirname(mu(t))}catch{}}const o=/\(?((?:\/|[A-Za-z]:\\)[^()]+?\.(?:cjs|mjs|js|ts)):\d+:\d+\)?/u.exec(n)?.[1];if(o)return ae.dirname(o)}return void 0}function Lu(){const e=yt();if(e)return e;if(!gt())return null;return ze().profile}function Qr(){const e=yt();if(Ou()){return Wr()}if(gt()){const t=ze();if(t.autoDetected&&t.profile){return sn({profile:t.profile})}}const n=Wr();if(n){return n}if(e){return sn({profile:e})}return sn()}function Te(){return ae.join(Qr(),"config.yaml")}var ht={"cn-test":"https://ottili-test.example.invalid/v1","cn-dev":"https://ottili-test.example.invalid/v1","cn-staging":"https://ottili-pre.example.invalid/v1","en-test":"https://ottili-overseas-test.example.invalid/v1","en-dev":"https://ottili-overseas-test.example.invalid/v1","en-staging":"https://ottili-overseas-pre.example.invalid/v1","cn-prod":"https://ai.ottili.one/v1","en-prod":"https://ai.ottili.one/v1"};var Ds=["https://api.ottili.one/alran/api/v1/llm/v1"];var Pu=new Set([...Object.values(ht),...Ds]);var Du=new Set([...Object.values(ht),...Ds].map(e=>new URL(e).origin));function Ns(e){if(Pu.has(e))return true;try{const n=new URL(e);return!n.username&&!n.password&&Du.has(n.origin)}catch{return false}}function Fs(){return he()==="test"}function Nu(){return!Fs()}function Fu(e){if(!ft()||!ke.existsSync(e)){return}const n=Bs(e);const{provider:t}=n;if(t==null||typeof t!=="object"||Array.isArray(t))return;const{alran:o}=t;if(o==null||typeof o!=="object"||Array.isArray(o))return;const{options:i}=o;if(i==null||typeof i!=="object"||Array.isArray(i))return;const a=i.baseURL;if(typeof a!=="string")return;const l=ht[Fn()];if(a===l||!Ns(a))return;const c=ke.readFileSync(e);i.baseURL=l;try{fe(e,ne.dump(n,{indent:2,lineWidth:-1,noRefs:true}))}catch(d){let f=false;try{f=ke.readFileSync(e).equals(c)}catch{}if(!f)throw d;console.warn("[config] managed preset baseURL sync skipped; config file unchanged, using runtime provider settings")}}function Ke(e){const n={authMode:"api-key",baseURL:ht[e]};const t={name:"Ottili AI Platform",npm:"@ai-sdk/openai-compatible",options:n,models:{...Ce},model_order:["Alran-Werk","anthropic/claude-sonnet-5.5","anthropic/claude-opus-5.5"]};return{provider:{alran:t},defaultModel:"alran/Alran-Werk"}}var bt={"cn-test":Ke("cn-test"),"cn-dev":Ke("cn-dev"),"cn-staging":Ke("cn-staging"),"cn-prod":Ke("cn-prod"),"en-test":Ke("en-test"),"en-dev":Ke("en-dev"),"en-staging":Ke("en-staging"),"en-prod":Ke("en-prod")};var ee={logLevel:"info",devPort:Yr,permissionMode:"auto",skipWindowsHardSafetyChecks:false,sseErrorPush:{history:true,stream:true},beta:Object.fromEntries(Object.keys(Bn).map(e=>[e,Xr(e,void 0,{buildEnv:"dev"})])),agents:{default:{}},memory:{enabled:true,proactive:false,dailyDigest:{enabled:false}},skillEvolve:{enabled:true,inSession:{N:20,minIntervalSeconds:30,maxPendingPerSession:1},signalCooldownHours:24,minConfidence:.7,excludeAgents:["skill-editor"],disableModelPrefixes:["Alran-M2"],builtinMrEnabled:false,sourceRepo:void 0,proposal:{enabled:false,eligibleAgents:["alran"],minMessageCount:40,skipPassiveSessionEnd:true},lifecycle:{staleThresholdDays:15,archiveThresholdDays:30}},sessionRotate:{enabled:true,activeSessionLookbackHours:12},agentStop:{debounceMs:500,maxActiveSpanMs:30*60*1e3},asr:{...it},skills:at,askUser:{...Mr},sessionTitle:{enabled:true},attribution:{...je},promptSuggestion:{},cli:{spawn:{enabled:false}},browser:{...Pn},tui:{},telemetry:{enabled:false,metrics:false,diagnostics:false},opencode:{xdg:{dataIsolation:false,startupImport:"off"},keepAlive:{enabled:false,maxProcesses:5,maxLifetimeMs:288e5,agents:["alran","main","verifier","code-reviewer"]},spawnConcurrency:3},contextManagement:{disableSystemReminderModels:[],cuMaxScreenshotsInContext:2},runawayGuard:{enabled:true},toolResultCompaction:{...Se},requestMedia:{...Ln},agentRuntime:{defaultFramework:on},logRetentionDays:3,cuBackend:wn,worktreeRefreshBeforeCreate:true,review:{mode:"subagent",modeSource:"default"},goal:structuredClone(ge),retry:structuredClone(ye),retryWarnings:[],sandbox:structuredClone(Kr),goalWarnings:[]};function Bu(){const e=Te();const n=ae.dirname(e);if(!ke.existsSync(n)){ke.mkdirSync(n,{recursive:true})}if(ke.existsSync(e)){eo(e);return}if(!ft()){const i=sn({homeDir:du.homedir()});const a=ae.join(i,"config.yaml");if(e!==a&&ke.existsSync(a)){rn(a);fe(e,ke.readFileSync(a),true)}return}const t=bt[Fn()];const o=ne.dump({logLevel:ee.logLevel,provider:Zr?t.provider:void 0,defaultModel:t.defaultModel,skipWindowsHardSafetyChecks:ee.skipWindowsHardSafetyChecks});fe(e,o,true)}function Bs(e=Te()){try{const n=ke.readFileSync(e,"utf-8");const t=ne.load(n);if(t!=null&&typeof t==="object"&&!Array.isArray(t)){return t}return{}}catch{return{}}}var Nn=null;function Uu(e){if(e==null||typeof e!=="object"||Array.isArray(e))return void 0;const n=e;return{branchFinish:typeof n.branchFinish==="boolean"?n.branchFinish:false}}var Us={isManagedRuntime:ft,shouldEnforceManagedProviderProtection:Nu,getManagedPreset:()=>bt[Fn()],isManagedPresetBaseUrl:Ns};var js=true;var Zr=true;function ju(e){js=e}function Ku(e){Zr=e}function eo(e){rn(e);Di(e);if(js){Li(e,Us)}if(Zr)Fu(e)}function fn(){Nn=null}function Ge(){if(Nn)return Nn;Bu();const e=Bs();Nn=no(e,Qr());return Nn}function Gu(e,n){if(!n)return{defaultModel:n,replaced:false};const t=n.indexOf("/");if(t<=0||t===n.length-1){return{defaultModel:n,replaced:false}}const o=n.slice(0,t);const i=n.slice(t+1);if(o!=="alran"&&o!=="alran_api"){return{defaultModel:n,replaced:false}}const a=e.alran?.models;const l=a&&Object.keys(a).length>0?a:Ce;const c=l[i];if(c&&c.enabled!==false){return{defaultModel:n,replaced:false}}const d=bt[Fn()].defaultModel;const f=d.slice(d.indexOf("/")+1);const u=l[f];if(!u||u.enabled===false){return{defaultModel:n,replaced:false}}console.warn(`[config] default model "${n}" is not in the official catalog; using "${d}"`);return{defaultModel:d,replaced:true}}function no(e,n){const t=e.sseErrorPush;const o=t!=null&&typeof t==="object"&&!Array.isArray(t)?t:void 0;let i=typeof e.devPort==="number"?e.devPort:ee.devPort;if(gt()&&!Ps()){const m=ze();if(m.autoDetected){i=m.uiPort}}const a=Lr(e.goal);const l=Pr(e.retry);const c=Pi({provider:e.provider!=null&&typeof e.provider==="object"&&!Array.isArray(e.provider)?wi(e.provider):{},defaultModel:typeof e.defaultModel==="string"?e.defaultModel:void 0},Us);const d=Gu(c.provider,c.defaultModel);const f=br(e.alranModelContextLimits);const u=qu(e);return{logLevel:typeof e.logLevel==="string"?e.logLevel:ee.logLevel,devPort:i,...c,defaultModel:d.defaultModel,provider:ki(c.provider,f),defaultModelVariant:!d.replaced&&typeof e.defaultModelVariant==="string"?e.defaultModelVariant:void 0,defaultModelThinking:!d.replaced&&e.defaultModelThinking&&typeof e.defaultModelThinking==="object"&&typeof e.defaultModelThinking.effort==="string"?{effort:e.defaultModelThinking.effort}:void 0,defaultModelContextWindow:!d.replaced&&Number.isSafeInteger(e.defaultModelContextWindow)&&Number(e.defaultModelContextWindow)>0&&Number(e.defaultModelContextWindow)<=2147483647?Number(e.defaultModelContextWindow):void 0,alran_api:vi(e.alran_api),alranModelContextLimits:f,custom_provider:Ti(e.custom_provider),alranModelSource:typeof e.alranModelSource==="string"&&(e.alranModelSource==="token_plan"||e.alranModelSource==="alran_api_key")?e.alranModelSource:void 0,nexus:e.nexus!=null&&typeof e.nexus==="object"&&!Array.isArray(e.nexus)?(()=>{const m={};if(typeof Reflect.get(e.nexus,"enabled")==="boolean"){m.enabled=Reflect.get(e.nexus,"enabled")}const y=Reflect.get(e.nexus,"model");if(y!=null&&typeof y==="object"&&!Array.isArray(y)&&typeof Reflect.get(y,"providerID")==="string"&&typeof Reflect.get(y,"modelID")==="string"){m.model={providerID:Reflect.get(y,"providerID"),modelID:Reflect.get(y,"modelID"),...typeof Reflect.get(y,"variant")==="string"?{variant:Reflect.get(y,"variant")}:{}}}return Object.keys(m).length>0?m:void 0})():void 0,defaultLightModel:typeof e.defaultLightModel==="string"?e.defaultLightModel:void 0,skipWindowsHardSafetyChecks:e.skipWindowsHardSafetyChecks===true,permissionMode:typeof e.permissionMode==="string"&&["default","bypassPermissions","auto","off"].includes(e.permissionMode)?e.permissionMode:ee.permissionMode,permission:Ki(e),sseErrorPush:{history:typeof o?.history==="boolean"?o.history:ee.sseErrorPush.history,stream:typeof o?.stream==="boolean"?o.stream:ee.sseErrorPush.stream},notifications:Uu(e.notifications),dataDir:n,agentsDir:ae.join(n,"agents"),sessionsDir:ae.join(n,"sessions"),memoryDir:ae.join(n,"memory"),skillsDir:ae.join(n,"skills"),builtinSkillsDir:ae.join(n,".builtin-skills"),logsDir:ae.join(n,"logs"),pluginsDir:ae.join(n,"plugins"),plansDir:ae.join(n,"plans"),harnessesDir:ae.join(n,"harnesses"),subAgentsDir:ae.join(n,"subagents"),beta:u,agents:Or(e.agents),memory:$u(e),skillEvolve:Hu(e,u),sessionRotate:Xu(e),agentStop:zu(e),asr:ji(e),skills:_r(e),askUser:es(e,ee.askUser),sessionTitle:Ju(e),attribution:$r(e),promptSuggestion:Qu(e),cli:Zu(e),browser:Br(e.browser),tui:xi(e),telemetry:Vu(e.telemetry),opencode:Bi(e,ee.opencode),contextManagement:ec(e),runawayGuard:Yt(e.runawayGuard),toolResultCompaction:Dr(e.toolResultCompaction),requestMedia:Fr(e.requestMedia),agentRuntime:Cr(e.agentRuntime),logRetentionDays:nc(e),contentReview:tc(e),mcpToolSearch:rc(e),cuBackend:On(e.cuBackend),review:Fi(e.review,ee.review),worktreeRefreshBeforeCreate:e.worktreeRefreshBeforeCreate!==false,promptConfig:Gs(e.promptConfig),goal:a.config,goalWarnings:a.warnings,retry:l.config,retryWarnings:l.warnings,sandbox:Gr(e.sandbox)}}function Vu(e){if(e==null||typeof e!=="object"||Array.isArray(e)){return{...ee.telemetry}}const n=Reflect.get(e,"enabled");return{enabled:typeof n==="boolean"?n:ee.telemetry.enabled,metrics:Reflect.get(e,"metrics")===true,diagnostics:Reflect.get(e,"diagnostics")===true}}function $u(e){const n=e.memory;const t=n!=null&&typeof n==="object"&&!Array.isArray(n)?n:{};const o=t.dailyDigest;const i=o!=null&&typeof o==="object"&&!Array.isArray(o)?o:{};return{enabled:typeof t.enabled==="boolean"?t.enabled:ee.memory.enabled,proactive:typeof t.proactive==="boolean"?t.proactive:ee.memory.proactive,dailyDigest:{enabled:typeof i.enabled==="boolean"?i.enabled:ee.memory.dailyDigest.enabled}}}function qu(e){const n=e.beta!=null&&typeof e.beta==="object"&&!Array.isArray(e.beta)?e.beta:{};const t=Ks();const o={};for(const i of Object.keys(Bn)){o[i]=Xr(i,n[i],t)}return o}function Ks(){return{buildEnv:he(),defaultBuildEnvironment:Hr(),internalBuild:zr(),insideBuild:Su(),alranToolsDevMode:process.env.ALRAN_DEV_ALRAN_TOOLS_MODE==="published"?"published":void 0}}function Yu(e){const n=e.provider;if(n==null||typeof n!=="object"||Array.isArray(n)){return[]}const t=[];for(const o of Object.values(n)){if(o==null||typeof o!=="object"||Array.isArray(o))continue;const{models:i}=o;if(i==null||typeof i!=="object"||Array.isArray(i))continue;t.push(...Object.keys(i))}return t}function Wu(e,n){if(n.length===0)return true;const t=Yu(e);if(t.length===0)return false;const o=n.map(i=>i.toLowerCase());return!t.every(i=>o.some(a=>i.toLowerCase().startsWith(a)))}function vs(e,n){return typeof e==="number"&&Number.isFinite(e)&&e>0?e:n}function Hu(e,n){const t=ee.skillEvolve;const o=e.skillEvolve;const i=o!=null&&typeof o==="object"&&!Array.isArray(o);const a=i?o:{};const l=a.inSession;let{inSession:c}=t;if(l!=null&&typeof l==="object"&&!Array.isArray(l)){const I=l;c={N:typeof I.N==="number"&&I.N>0?I.N:t.inSession.N,minIntervalSeconds:typeof I.minIntervalSeconds==="number"&&I.minIntervalSeconds>=0?I.minIntervalSeconds:t.inSession.minIntervalSeconds,maxPendingPerSession:typeof I.maxPendingPerSession==="number"&&I.maxPendingPerSession>=1?I.maxPendingPerSession:t.inSession.maxPendingPerSession}}const d=a.excludeAgents;const f=Array.isArray(d)&&d.every(I=>typeof I==="string")?d:t.excludeAgents;const u=Array.isArray(a.disableModelPrefixes)&&a.disableModelPrefixes.every(I=>typeof I==="string")?a.disableModelPrefixes:t.disableModelPrefixes;const m=!n.skillEvolve?false:typeof a.enabled==="boolean"?a.enabled:Wu(e,u);const y=!m?false:!n.skillEvolveBuiltinMr?false:typeof a.builtinMrEnabled==="boolean"?a.builtinMrEnabled:t.builtinMrEnabled;const x=a.sourceRepo;const w=typeof x==="string"&&x.trim().length>0?x.trim():t.sourceRepo;const T=a.proposal;const D=t.proposal;const N=T!=null&&typeof T==="object"&&!Array.isArray(T)?T:{};const U=Array.isArray(N.eligibleAgents)&&N.eligibleAgents.every(I=>typeof I==="string")?N.eligibleAgents:D.eligibleAgents;const G=typeof N.minMessageCount==="number"&&N.minMessageCount>=1?Math.floor(N.minMessageCount):D.minMessageCount;const W=typeof N.skipPassiveSessionEnd==="boolean"?N.skipPassiveSessionEnd:D.skipPassiveSessionEnd;const le=typeof N.enabled==="boolean"?N.enabled:null;const Me=!m?false:!n.skillProposal?false:le??true;const Ae=a.lifecycle;const me=Ae&&typeof Ae==="object"&&!Array.isArray(Ae)?Ae:{};const M=vs(me.staleThresholdDays,t.lifecycle.staleThresholdDays);const j=vs(me.archiveThresholdDays,t.lifecycle.archiveThresholdDays);if(!(M<j)){throw new Error(`Invalid skillEvolve.lifecycle config: staleThresholdDays (${M}) must be strictly less than archiveThresholdDays (${j}).`)}return{enabled:m,inSession:c,signalCooldownHours:typeof a.signalCooldownHours==="number"&&a.signalCooldownHours>0?a.signalCooldownHours:t.signalCooldownHours,minConfidence:typeof a.minConfidence==="number"&&a.minConfidence>=0&&a.minConfidence<=1?a.minConfidence:t.minConfidence,scannerModel:typeof a.scannerModel==="string"?a.scannerModel:void 0,excludeAgents:f,disableModelPrefixes:u,builtinMrEnabled:y,sourceRepo:w,proposal:{enabled:Me,eligibleAgents:U,minMessageCount:G,skipPassiveSessionEnd:W},lifecycle:{staleThresholdDays:M,archiveThresholdDays:j}}}function Xu(e){const n=ee.sessionRotate;const t=e.sessionRotate;if(t==null||typeof t!=="object"||Array.isArray(t))return{...n};const o=t;const i=o.activeSessionLookbackHours;return{enabled:typeof o.enabled==="boolean"?o.enabled:n.enabled,activeSessionLookbackHours:typeof i==="number"&&Number.isFinite(i)&&i>0?i:n.activeSessionLookbackHours}}function zu(e){const n=ee.agentStop;const t=e.agentStop;if(t==null||typeof t!=="object"||Array.isArray(t)){return{...n}}const o=t;const i=o.debounceMs;const a=o.maxActiveSpanMs;return{debounceMs:typeof i==="number"&&Number.isFinite(i)&&i>=0?i:n.debounceMs,maxActiveSpanMs:typeof a==="number"&&Number.isFinite(a)&&a>=0?a:n.maxActiveSpanMs}}function Gs(e){const n=he()==="prod"&&!zr();if(e==null||typeof e!=="object"||Array.isArray(e)){return{autoUpdate:n}}const t=e.autoUpdate;return{autoUpdate:typeof t==="boolean"?t:n}}function Ju(e){const n=ee.sessionTitle;const t=e.sessionTitle;if(t==null||typeof t!=="object"||Array.isArray(t)){return{...n}}const o=t;return{enabled:typeof o.enabled==="boolean"?o.enabled:n.enabled}}function Qu(e){const n=e.promptSuggestion;const t=n!=null&&typeof n==="object"&&!Array.isArray(n)?n.enabled:void 0;return typeof t==="boolean"?{enabled:t}:{}}function Zu(e){const n=ee.cli;const t=e.cli;if(t==null||typeof t!=="object"||Array.isArray(t)){return{spawn:{...n.spawn}}}const o=t.spawn;if(o==null||typeof o!=="object"||Array.isArray(o)){return{spawn:{...n.spawn}}}const i=o;return{spawn:{enabled:typeof i.enabled==="boolean"?i.enabled:n.spawn.enabled}}}function ec(e){const n=ee.contextManagement;const t=e.contextManagement;if(t==null||typeof t!=="object"||Array.isArray(t)){return{disableSystemReminderModels:[...n.disableSystemReminderModels],cuMaxScreenshotsInContext:n.cuMaxScreenshotsInContext}}const o=t;const i=o.disableSystemReminderModels;const a=Array.isArray(i)&&i.every(f=>typeof f==="string"&&f.length>0)?i:[...n.disableSystemReminderModels];const l=o.cuMaxScreenshotsInContext;const c=typeof l==="number"&&Number.isFinite(l)&&l>=0?Math.floor(l):n.cuMaxScreenshotsInContext;const d=typeof o.compactionTriggerAt==="number"?o.compactionTriggerAt:void 0;return{disableSystemReminderModels:a,cuMaxScreenshotsInContext:c,...d===void 0?{}:{compactionTriggerAt:d}}}function nc(e){const n=e.logRetentionDays;if(typeof n==="number"&&n>=1&&Number.isFinite(n)){return Math.floor(n)}return ee.logRetentionDays}function tc(e){const n=e.contentReview;if(n==null||typeof n!=="object"||Array.isArray(n))return void 0;const t={};const o=Reflect.get(n,"enabled");if(typeof o==="boolean")t.enabled=o;const i=Reflect.get(n,"testBaseURL");if(typeof i==="string"&&i.trim()){t.testBaseURL=i.trim()}return Object.keys(t).length>0?t:void 0}function rc(e){const n=e.mcpToolSearch;if(n==null||typeof n!=="object"||Array.isArray(n))return void 0;const t={};const o=Reflect.get(n,"enabled");if(typeof o==="boolean")t.enabled=o;const i=Reflect.get(n,"systemHint");if(typeof i==="boolean")t.systemHint=i;const a=Reflect.get(n,"thresholdPct");if(typeof a==="number")t.thresholdPct=a;const l=Reflect.get(n,"minDeferCount");if(typeof l==="number")t.minDeferCount=l;const c=Reflect.get(n,"topKDefault");if(typeof c==="number")t.topKDefault=c;const d=Reflect.get(n,"topKMax");if(typeof d==="number")t.topKMax=d;const f=Reflect.get(n,"maxSchemaTextLen");if(typeof f==="number")t.maxSchemaTextLen=f;const u=Reflect.get(n,"modelWhitelist");if(Array.isArray(u)){t.modelWhitelist=u.filter(m=>typeof m==="string")}return Object.keys(t).length>0?t:void 0}function Vs(){const e=Ls();if(gt()&&!Ps()){const n=ze();if(n.autoDetected){return n.runtimePort}}return e??cn}function oc(e=Vs()){const n=e+Ms;if(n<=qr){return n}const t=e+xs;if(t<=qr){return t}throw new Error(`Cannot allocate an OpenCode sidecar port for runtime port ${String(e)}; choose a runtime port <= ${String(qr-xs)}.`)}var ic=["ALRAN_DISABLE_TELEMETRY","DO_NOT_TRACK"];function sc(e,n=()=>Ge().telemetry[e]){for(const t of ic){if(/^(?:1|true|yes|on)$/iu.test(process.env[t]?.trim()??""))return false}try{return n()===true}catch{return false}}function $s(e){return false}function Mp(e){return e.replace(/^#{2,4} MCP\/App citation examples\r?\n\r?\n```\r?\n[\s\S]*?^```\r?\n\s*/gm,n=>n.includes("#alran-source=")?"":n).replace(/^#{2,4} Citations\r?\n(?:[ \t]*\r?\n)*Cite every used result where it supports the answer\.[\s\S]*?^Do not cite unused calls or unsupported claims, invent metadata, output bare parenthesized links, or add trailing source\/reference lists\.\r?\n*/gm,n=>n.includes("Citation candidate")?"":n)}function Ip(e){const n=["- Independent tool calls can run in parallel in one response.","- Issue independent tool calls together when safe. Run dependent calls or conflicting writes sequentially, and follow each tool's concurrency restrictions.",'- Tool selection for this turn is described in "Tool calls in this turn".'];const t=n.find(u=>e.includes(u));if(!t)return e;const o="- Reference code as `file_path:line_number` \u2014 it's clickable.";const i="- Reference code as `file_path:line_number` so it is clickable. Place references near the relevant claim; group them only when there are many files.";const a=["- Cite sources where they support the answer, using exact source URLs or supplied links.","- Place references near the relevant claim; group them only when there are many files.","- Cite only sources you used; do not invent sources or links."].join("\n");const l=["- When referencing code, use `file_path:line_number` format.","- When citing one or two files, place one or two `file_path:line_number` references in the relevant conclusion sentence. Use a separate evidence list only when there are many references.",o,"- Reference code as `file_path:line_number` \u2014 it's clickable in the TUI."];const c=l.reduce((u,m)=>u.replaceAll(`${m}\r
5
+ `,"").replaceAll(`${m}
6
+ `,""),e.replace(i,"- Place references near the relevant claim; group them only when there are many files.")).replace(t,`${t}
7
+ ${o}`);if(c.includes(a))return c;const d=/^(#{1,2}) Communication & Delivery\r?$/m.exec(c);if(d){const u=d[1];const m=d.index+d[0].length;const y=new RegExp(`^(?:#{1,${u.length}} |\\{\\{[#/])`,"m").exec(c.slice(m));const x=y?m+y.index:c.length;return`${c.slice(0,x).trimEnd()}
8
+
9
+ ${u}# References
10
+ ${a}
11
+
12
+ ${c.slice(x)}`}const f=/^(#{2,4}) (?:Media Output|Deliverable Files)\r?$/m;if(f.test(c)){return c.replace(f,(u,m)=>`${m} References
13
+ ${a}
14
+
15
+ ${u}`)}return`${c.trimEnd()}
16
+
17
+ ## References
18
+ ${a}`}function ac(e,n=process.env){return $s({platform:e,internalBuild:n.__ALRAN_BUILD_INTERNAL==="true",insideBuild:n.__ALRAN_BUILD_INSIDE==="true"})}function lc(e){return e.requested}import{randomBytes as Bc}from"node:crypto";import{promises as qe}from"node:fs";import{dirname as Uc,join as xa}from"node:path";var Ra=Io(yo(),1);async function jc(e,n){const t=xa(e,"config.yaml");let o;let i=false;let a;try{await qe.mkdir(e,{recursive:true});await qe.writeFile(t,"",{flag:"a",mode:384});await qe.chmod(t,384);const l=await qe.realpath(t);o=xa(Uc(l),`.config-tmp-${Bc(6).toString("hex")}`);a=await Ra.default.lock(l,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}});const c=ne.load(await qe.readFile(l,"utf8"));const d=c??{};if(!Sa(d))throw new Error("Invalid config document");const f=d.tui??{};if(!Sa(f))throw new Error("Invalid TUI settings");const u={...f};if(n===void 0)delete u.statusLine;else u.statusLine=[...n];const m={...d,tui:u};const y=384;const x=await qe.open(o,"wx",y);i=true;try{await x.writeFile(ne.dump(m,{lineWidth:-1,noRefs:true}),"utf8");await x.chmod(y)}finally{await x.close()}await qe.rename(o,l)}catch{throw new Error("Unable to save status line settings. Check config.yaml syntax and permissions.")}finally{if(i&&o)await qe.unlink(o).catch(()=>void 0);await a?.().catch(()=>void 0)}}function Sa(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype}function Kc(e){if(typeof e!=="object"||e===null||Array.isArray(e))return{};const n=e;const t=n.kill_switch??n.killSwitch;const o=n.sample_rate??n.sampleRate;const i=n.default_enabled??n.defaultEnabled;return{...typeof t==="boolean"?{killSwitch:t}:{},...typeof o==="number"&&Number.isFinite(o)&&o>=0&&o<=1?{sampleRate:o}:{},...typeof i==="boolean"?{defaultEnabled:i}:{}}}function va(e,n){if(typeof e==="boolean")return e;return n?.defaultEnabled??true}function Gc(e,n){const t=va(e.promptSuggestion?.enabled,n);return{...e,promptSuggestion:{...e.promptSuggestion,enabled:t}}}import Vc from"node:fs";var ho=Object.freeze({stopSubAgent:true,stopAsyncBash:true});var $c=["stopSubAgent","stopAsyncBash"];function Mt(e){const n=Ea(e.conversation)?e.conversation:{};const t={...ho};const o={stopSubAgent:"default",stopAsyncBash:"default"};const i=[];for(const a of $c){const l=n[a];if(typeof l==="boolean"){t[a]=l;o[a]="explicit"}else if(l!==void 0){i.push(a)}}return{...t,policySource:o,...i.length>0?{ignoredKeys:i}:{}}}function qc(e){let n;try{n=e??Te()}catch{return Ot({reason:"path_error"})}let t;try{t=Vc.readFileSync(n,"utf8")}catch(i){const a=Yc(i);if(a==="ENOENT")return{...Mt({}),configPath:n};return Ot({reason:"read_error",...a?{errorCode:a}:{}},n)}let o;try{o=ne.load(t)}catch(i){const a=Wc(i);return Ot({reason:"yaml_error",...a?{line:a}:{}},n)}if(o==null)return{...Mt({}),configPath:n};if(!Ea(o))return Ot({reason:"not_a_mapping"},n);return{...Mt(o),configPath:n}}function Ot(e,n){return{...ho,policySource:{stopSubAgent:"read_failed",stopAsyncBash:"read_failed"},failure:e,...n?{configPath:n}:{}}}function Ea(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype}function Yc(e){const n=e?.code;return typeof n==="string"?n:void 0}function Wc(e){const n=e?.mark?.line;return typeof n==="number"&&Number.isInteger(n)&&n>=0?n+1:void 0}var Ta="https://platform.ottili.one";var wa="https://ai.ottili.one/v1";var Oa="sk-ottili-";var Ma="ALRAN_API_KEY";var Gn="ALRAN_API_BASE";var Ia="OTTILI_PLATFORM_URL";var La="OTTILI_API_KEY_CONSOLE_URL";var Hc="/api-keys";function Pa(e){return e.replace(/\/+$/u,"")}function Da(e){const n=Pa(e.trim());if(n.length===0)return n;return n.replace(/\/chat\/completions$/iu,"")}function bo(e=process.env){const n=e[Ia]?.trim();if(n)return Pa(n);return Ta}function It(e=process.env){const n=e[Gn]?.trim();if(n)return zc(Da(n),e);return wa}var ka="ALRAN_API_BASE_ALLOW_HTTP";var Xc=new Set(["localhost","127.0.0.1","[::1]"]);function zc(e,n=process.env){let t;try{t=new URL(e)}catch{throw new Error(`${Gn} must be an absolute https URL; got ${JSON.stringify(e)}.`)}if(t.username!==""||t.password!==""){throw new Error(`${Gn} must not carry a user name or password.`)}const o=t.protocol==="https:";const i=t.protocol==="http:"&&(Xc.has(t.hostname)||n[ka]==="1");if(!o&&!i){throw new Error(`${Gn} must be an https URL, so the API key is not sent in the clear (http is accepted for localhost, or with ${ka}=1); got ${JSON.stringify(e)}.`)}return e}function Jc(e,n=process.env){return It(n)}function Na(e=process.env){const n=e[Ma]?.trim();return n||void 0}function Qc(e){return typeof e==="string"&&e.trim().startsWith(Oa)}function Fa(e,n=process.env){const t=n[La]?.trim();if(t)return t;return`${new URL(It(n)).origin}${Hc}`}function Zc(e=process.env){return Fa(bo(e),e)}function ef(e=process.env){const n=Na(e);return{platformUrl:bo(e),apiBaseUrl:It(e),...n?{apiKey:n}:{}}}import hn from"node:fs";import Lt from"node:path";function nf(e=he()){return e==="prod"?"prod":"dev"}function Ao(e,n){return Lt.join(e,"auth","platform",n)}function Pt(e,n){return Lt.join(Ao(e,n),"platform-session.json")}function Ba(e,n){let t;try{t=JSON.parse(hn.readFileSync(Pt(e,n),"utf8"))}catch{return null}if(!t||typeof t!=="object"||Array.isArray(t))return null;const o=t;const i=typeof o.sessionId==="string"?o.sessionId.trim():"";if(!i)return null;return{sessionId:i,companyId:typeof o.companyId==="string"?o.companyId:"",subjectId:typeof o.subjectId==="string"?o.subjectId:"",platformEnv:n,baseUrl:typeof o.baseUrl==="string"?o.baseUrl:"",storedAtMs:typeof o.storedAtMs==="number"?o.storedAtMs:0}}function tf(e,n){try{hn.rmSync(Pt(e,n),{force:true})}catch{}}function Ua(e){return e==="prod"?["prod","dev"]:["dev","prod"]}function rf(e,n){for(const t of Ua(n)){const o=Ba(e,t);if(o)return o}return null}function of(e,n,t,o={}){const i=Ao(e,n);hn.mkdirSync(i,{recursive:true,mode:448});if(process.platform!=="win32"){try{hn.chmodSync(i,448)}catch{}}const a={...o,sessionId:t.sessionId,companyId:t.companyId,subjectId:t.subjectId,baseUrl:t.baseUrl,storedAtMs:t.storedAtMs??Date.now()};fe(Pt(e,n),`${JSON.stringify(a,null,2)}
19
+ `)}function _o(e){return Lt.join(e,"auth","platform","account.json")}function ja(e){try{const n=JSON.parse(hn.readFileSync(_o(e),"utf8"));const t={};const o=n?.projects;if(o&&typeof o==="object"&&!Array.isArray(o)){for(const[i,a]of Object.entries(o)){if(typeof a==="string"&&a.trim())t[i]=a.trim()}}return{version:1,projects:t}}catch{return{version:1,projects:{}}}}function sf(e,n,t){const o=ja(e);const i={...o.projects};if(t)i[n]=t;else delete i[n];const a=_o(e);hn.mkdirSync(Lt.dirname(a),{recursive:true,mode:448});fe(a,`${JSON.stringify({version:1,projects:i},null,2)}
20
+ `)}var Ka={fast:"ottili/kern-1.1",standard:"ottili/fels-1.1",coding:"ottili/werk-1.1",premium:"ottili/werk-1.1-pro"};var Co=["anthropic/claude-sonnet-5.5","anthropic/claude-opus-5.5"];var xo={"Alran-Werk":"ottili/werk-1.1","anthropic/claude-sonnet-5.5":"anthropic/claude-sonnet-5.5","anthropic/claude-opus-5.5":"anthropic/claude-opus-5.5"};var Ga={werk:"Alran-Werk","ottili/werk-1.1":"Alran-Werk",sonnet:"anthropic/claude-sonnet-5.5","claude-sonnet-5.5":"anthropic/claude-sonnet-5.5","claude-sonnet-5-5":"anthropic/claude-sonnet-5.5",opus:"anthropic/claude-opus-5.5","claude-opus-5.5":"anthropic/claude-opus-5.5","claude-opus-5-5":"anthropic/claude-opus-5.5"};function So(e){const n=e.trim();return Ga[n.toLowerCase()]??n}function af(e){const n=xo[So(e)]??e;return Co.includes(n)}var Va="coding";function $a(e){if(typeof e!=="string")return false;const n=e.trim();return/^ottili\/[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/iu.test(n)||Co.includes(n)}function lf(e){const n=e?.trim();if(!n)return Ka[Va];if($a(n))return n;const t=xo[So(n)];if(t)return t;throw new Error(`No Ottili AI Platform gateway route for model "${e}". Add it to ALRAN_MODEL_TO_GATEWAY_ID; external models must not silently fall back to Alran-Werk.`)}var uf=["api.ottili.one"];var cf=new Set(uf.map(e=>`https://${e}`));function ff(e,n){return/^custom_provider:alran-legacy(?:-\d+)?$/u.test(e)&&(!n||Ro(n))}function Ro(e){try{const n=new URL(e);if(n.username||n.password)return false;return cf.has(n.origin.toLowerCase())}catch{return false}}function df(e){if(e!=="managed-login"&&e!=="api-key"&&e!=="oauth")return void 0;return e}function vo(e){const n=typeof e?.baseURL==="string"?e.baseURL.trim():"";const t=n.length>0&&Ro(n);const o=df(e?.authMode);const i=[];if(typeof e?.authMode==="string"&&!o){i.push(`Unknown provider authMode "${e.authMode}"; falling back to compatibility resolution.`)}if(o){if(o==="managed-login"&&n.length>0&&!t&&!e?.allowManagedBaseURLOverride){i.push("Provider authMode is managed-login but baseURL is not a known managed Alran host.")}return{authMode:o,source:"explicit",managedBaseURL:t,warnings:i}}if(t){i.push("Provider authMode is inferred from a managed Alran baseURL; set options.authMode: managed-login to make this explicit.");return{authMode:"managed-login",source:"inferred-managed-base-url",managedBaseURL:t,warnings:i}}return{authMode:"api-key",source:"default-api-key",managedBaseURL:t,warnings:i}}var Oe="alran";var bn="alran_api";var pf="external";var Eo="custom_provider:";function mf(e){return e===Oe||e===bn}function ko(e,n){if(n===bn)return"alran_api_key";if(n.startsWith(Eo))return"custom_provider";if(n!==Oe)return"configured_provider";if(e.alranModelSource==="alran_api_key")return"alran_api_key";const t=e.provider?.[n]?.options;const o=vo({authMode:t?.authMode,baseURL:t?.baseURL}).authMode;if(o==="api-key")return"alran_api_key";return o==="managed-login"?"managed_token_plan":"configured_provider"}function qa(e,n,t){const o=ko(e,n);switch(o){case"managed_token_plan":{return Dt(e.provider?.[n],true)}case"alran_api_key":{const i=e.provider?.[Oe];return Dt({...i,models:i?.models??Ce},true)}case"custom_provider":{const i=e.custom_provider?.[n.slice(Eo.length)];if(!i||i.enabled===false)return[];return Dt(i)}case"configured_provider":return Dt(e.provider?.[n])}}function gf(e){const n=ko(e.config,e.providerId);const t=e.modelId.trim();if(t.length>0&&qa(e.config,e.providerId,e.preset).includes(t)){return{available:true,route:n}}return{available:false,route:n,code:e.source==="config_default"?"DEFAULT_MODEL_NOT_AVAILABLE_FOR_ROUTE":"MODEL_NOT_AVAILABLE_FOR_ROUTE",message:`Model "${e.providerId}/${e.modelId}" is not available for the "${n}" route (preset ${e.preset}).`}}function Dt(e,n=false){const t=Object.entries(e?.models??{}).filter(([,l])=>l?.enabled!==false).map(([l])=>l);const o=e?.model_order;if(!n||!Array.isArray(o)||!o.every(l=>typeof l==="string")){return t}const i=new Set(t);const a=o.filter(l=>i.delete(l));return[...a,...t.filter(l=>i.has(l))]}import{randomBytes as yf}from"node:crypto";import Ye from"node:fs";import{dirname as Ya,join as hf}from"node:path";var Wa=Io(yo(),1);var wo=384;var Nt=new Set(["__proto__","prototype","constructor"]);var bf=["alran_api","custom_provider"];async function Af(e){const n=e.trim();if(!n||n.includes(".")||Nt.has(n)){throw new ie("Invalid provider id")}return $n(async t=>{if(be(t.provider))delete t.provider[n];return{write:true,value:void 0}}).then(({config:t})=>({config:t}))}async function _f(e){if(!be(e)||!be(e.models)){throw new ie("Invalid managed Alran provider snapshot")}Ft(e);return $n(async n=>{n.provider={...be(n.provider)?n.provider:{},[Oe]:structuredClone(e)};return{write:true,value:void 0}}).then(({config:n})=>({config:n}))}var ie=class extends Error{name="LocalModelProviderConfigValidationError"};var Vn=class extends Error{name="LocalModelProviderConfigWriteError";constructor(){super("Local runtime failed to update config file")}};async function Cf(e){return $n(async(n,t)=>{const o={alran_api:be(n.alran_api)?n.alran_api:void 0,custom_provider:Ef(be(n.custom_provider)?n.custom_provider:void 0),alranModelSource:typeof n.alranModelSource==="string"?n.alranModelSource:void 0,defaultModel:typeof n.defaultModel==="string"?n.defaultModel:void 0,defaultModelVariant:typeof n.defaultModelVariant==="string"?n.defaultModelVariant:void 0};await e(o,t);for(const i of bf){const a=o[i];if(a===void 0){delete n[i];continue}if(!be(a)){throw new ie(`Invalid BYOK config subtree "${i}"`)}Ft(a);n[i]=a}To(n,"alranModelSource",o.alranModelSource);if(n.defaultModel!==o.defaultModel){delete n.defaultModelThinking;delete n.defaultModelContextWindow}To(n,"defaultModel",o.defaultModel);To(n,"defaultModelVariant",o.defaultModelVariant);return{write:true,value:void 0}}).then(({config:n})=>({config:n}))}async function xf(e){const n=e.modelKey.trim();if(!n){throw new ie("Default model must not be empty")}if(e.contextLimit!==void 0&&(!Number.isSafeInteger(e.contextLimit)||e.contextLimit<=0||e.contextLimit>2147483647))throw new ie("Invalid default context");if(e.thinking?.effort!==void 0&&(typeof e.thinking.effort!=="string"||!e.thinking.effort.trim()))throw new ie("Invalid default effort");return $n(async t=>{t.defaultModel=n;if(e.contextLimit===void 0)delete t.defaultModelContextWindow;else t.defaultModelContextWindow=e.contextLimit;if(e.thinking?.effort===void 0)delete t.defaultModelThinking;else t.defaultModelThinking={effort:e.thinking.effort};if(e.variant===void 0)delete t.defaultModelVariant;else t.defaultModelVariant=e.variant;return{write:true,value:void 0}}).then(({config:t})=>({config:t}))}async function Sf(e,n){const t=e.modelId.trim();if(e.providerId!==Oe&&e.providerId!==bn||!t||Nt.has(t)){throw new ie("Invalid Alran model context target")}const o=await $n(async(i,a)=>{const l=e.providerId===Oe?a.provider?.[e.providerId]?.models?.[t]:Ar(a)[t];if(e.providerId===bn&&!l?.contextWindowOptions?.includes(e.contextLimit)){throw new ie("Invalid Alran API context limit")}if(l?.limit?.context!==e.expectedContextLimit){return{write:false,value:false}}if(!await n(a))return{write:false,value:false};const c=e.providerId===Oe?["alranModelContextLimits",t]:["alran_api","modelContextLimits",t];kf(i,c,e.contextLimit);return{write:true,value:true}});return{config:o.config,updated:o.value}}async function $n(e){const n=Te();let t;try{await Ye.promises.mkdir(Ya(n),{recursive:true});await Ye.promises.writeFile(n,"",{flag:"a",mode:wo});await Ye.promises.chmod(n,wo);t=await Wa.default.lock(n,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}});const o=vf(n);fn();const i=await e(o,Ge());if(i.write){Ft(o);await Rf(n,ne.dump(o,{indent:2,lineWidth:-1,noRefs:true}));fn()}return{config:Ge(),value:i.value}}catch(o){if(o instanceof ie||o instanceof Vn){throw o}throw new Vn}finally{await t?.().catch(()=>void 0)}}async function Rf(e,n){const t=await Ye.promises.realpath(e).catch(()=>e);const o=hf(Ya(t),`.config-tmp-${yf(6).toString("hex")}`);let i=false;try{const a=wo;const l=await Ye.promises.open(o,"wx",a);i=true;try{await l.writeFile(n,"utf-8");await l.chmod(a)}finally{await l.close()}await Ye.promises.rename(o,t)}catch{if(i)await Ye.promises.unlink(o).catch(()=>void 0);throw new Vn}}function vf(e){const n=Ye.readFileSync(e,"utf-8");let t;try{t=ne.load(n)}catch{throw new ie("Invalid config.yaml: unable to parse YAML")}if(t==null)return{};if(!be(t)||Object.getPrototypeOf(t)!==Object.prototype){throw new ie("Invalid config.yaml: expected a YAML mapping")}return t}function Ef(e){if(!e)return void 0;return Object.fromEntries(Object.entries(e).filter(([,n])=>be(n)))}function To(e,n,t){if(t===void 0)delete e[n];else e[n]=t}function kf(e,n,t){const o=n.at(-1);if(!o)throw new ie("Invalid config path");let i=e;for(const a of n.slice(0,-1)){if(!a||Nt.has(a)){throw new ie("Invalid config path")}const l=i[a];if(be(l))i=l;else{const c={};i[a]=c;i=c}}i[o]=t}function Ft(e){for(const[n,t]of Object.entries(e)){if(!n||Nt.has(n)){throw new ie(`Local runtime cannot update config field segment "${n}"`)}if(be(t))Ft(t)}}function be(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function Ff(e){const n=e.trim();if(!n)return null;if(n.startsWith("{")){try{const o=JSON.parse(n);const i=typeof o.pid==="number"?o.pid:parseInt(String(o.pid),10);if(isNaN(i)||i<=0)return null;const a=Bf(o.owner)?o.owner:"unknown";const l=Uf(o.startedAt);return{pid:i,owner:a,...l!==void 0?{startedAt:l}:{},...typeof o.mode==="string"?{mode:o.mode}:{},...typeof o.startupToken==="string"?{startupToken:o.startupToken}:{}}}catch{return null}}const t=parseInt(n,10);if(isNaN(t)||t<=0)return null;return{pid:t,owner:"unknown"}}function Bf(e){return e==="electron"||e==="cli"||e==="unknown"}function Uf(e){if(typeof e==="number"&&Number.isFinite(e))return e;if(typeof e!=="string")return void 0;const n=new Date(e).getTime();return Number.isFinite(n)?n:void 0}function jf(e,n){const t={pid:e,owner:n,startedAt:Date.now()};return JSON.stringify(t)}function Kf(){const e=process.argv.slice(2);for(let n=0;n<e.length;n++){const t=e[n];const o=t==="--owner"?e[n+1]:t?.startsWith("--owner=")?t.slice(8):void 0;if(o==="electron")return"electron";if(o==="service"||o==="cli")return"cli"}return"cli"}import We from"node:fs";import Gf from"node:path";var Ha="local-runtime.auth.json";function Re(e){return typeof e==="string"&&e.trim().length>0?e.trim():void 0}function Oo(e){if(!e)return{};return{...Re(e.accessToken)?{accessToken:Re(e.accessToken)}:{},...Re(e.realUserID)?{realUserID:Re(e.realUserID)}:{},...Re(e.userEmail)?{userEmail:Re(e.userEmail)}:{},...Re(e.userName)?{userName:Re(e.userName)}:{},...Re(e.subUserName)?{subUserName:Re(e.subUserName)}:{}}}function Bt(e){return Gf.join(e,Ha)}function Vf(e){try{const n=We.readFileSync(Bt(e),"utf-8");const t=JSON.parse(n);if(t.version!==1||!t.auth||typeof t.auth!=="object")return void 0;const o=Oo(t.auth);return o.accessToken?o:void 0}catch{return void 0}}function $f(e,n,t={}){const o=Bt(e);const i=Oo(n);if(!i.accessToken){Xa(e);return{path:o,written:false}}We.mkdirSync(e,{recursive:true,mode:448});const a={version:1,updatedAtMs:Date.now(),auth:i};const l=`${o}.${process.pid}.${Date.now()}.tmp`;We.writeFileSync(l,`${JSON.stringify(a,null,2)}
21
+ `,{encoding:"utf-8",mode:384});if(t.retryWindowsFileSystem){$t(()=>We.renameSync(l,o));$t(()=>We.chmodSync(o,384))}else{We.renameSync(l,o);We.chmodSync(o,384)}return{path:o,written:true}}function Xa(e){try{We.rmSync(Bt(e),{force:true})}catch{}}import za from"node:net";var Ja={"e2e-runtime":5e3,"e2e-ui":5500,"smoke-runtime":7e3};var Mo=100;async function qf(e,n={}){const t=n.isPortFree??Wf;const o=n.getFreePort??Hf;const i=n.getWorktreeBasePort??Yf;const a=i()+Ja[e];const l=a-i();if(l<Mo){throw new Error(`pickTestPort(${e}): role offset ${l} collides with app runtime (0); must be >= ${Mo}.`)}if(a>65535){return o()}if(await t(a))return a;return o()}function Yf(){const e=ze();return e.autoDetected?e.runtimePort:cn}async function Wf(e){return new Promise(n=>{const t=za.createServer();t.once("error",()=>n(false));t.listen(e,"127.0.0.1",()=>{t.close(()=>n(true))})})}async function Hf(){return new Promise((e,n)=>{const t=za.createServer();t.listen(0,"127.0.0.1",()=>{const o=t.address();if(o&&typeof o!=="string"){const{port:i}=o;t.close(()=>e(i))}else{t.close(()=>n(new Error("Failed to get free port")))}});t.on("error",n)})}import Qa from"node:fs";import Xf from"node:path";var zf=new Set(["native","mcp"]);function Za(){return On(Ge().cuBackend)}function Jf(e){if(!zf.has(e)){throw new Error(`invalid cuBackend value: ${String(e)}`)}const n=Te();let t={};try{const o=Qa.readFileSync(n,"utf-8");const i=ne.load(o);if(i!=null&&typeof i==="object"&&!Array.isArray(i)){t=i}}catch{}t.cuBackend=e;Qa.mkdirSync(Xf.dirname(n),{recursive:true});fe(n,ne.dump(t));fn()}function Qf(e=Za()){Ni(e)}import el from"node:fs";var An=class extends Error{code;configPath;constructor(n,t,o,i){super(o,i);this.name="ConfigFileError";this.code=n;this.configPath=t}};function nl(e){let n;try{n=el.readFileSync(e,"utf-8")}catch(o){throw new An("CONFIG_READ_FAILED",e,`Cannot read config ${e}.`,{cause:o})}let t;try{t=ne.load(n)}catch(o){throw new An("CONFIG_PARSE_FAILED",e,`Config is not valid YAML: ${e}`,{cause:o})}if(t==null||typeof t!=="object"||Array.isArray(t)){throw new An("CONFIG_ROOT_INVALID",e,`Config root must be an object: ${e}`)}return t}function Zf(e,n){if(el.existsSync(e))eo(e);return no(nl(e),n.dataDir)}function ed(e,n){const t=nl(e);if(t.beta==null||typeof t.beta!=="object"||Array.isArray(t.beta)){return void 0}const o=t.beta[n];return typeof o==="boolean"?o:void 0}export{yo as a,Ce as b,qt as c,Yt as d,Wt as e,fe as f,ne as g,Ar as h,wn as i,On as j,at as k,_r as l,Il as m,Vi as n,on as o,$i as p,Cr as q,Yi as r,Wi as s,sn as t,kr as u,Tr as v,wr as w,zi as x,Or as y,Gl as z,$l as A,ql as B,Yl as C,Wl as D,rs as E,os as F,is as G,ss as H,as as I,ge as J,Ir as K,Lr as L,Mn as M,ye as N,ls as O,Pr as P,zl as Q,Se as R,Dr as S,Ln as T,Fr as U,Pn as V,Br as W,fs as X,jr as Y,Kr as Z,Gr as _,ps as $,je as aa,Vr as ba,ms as ca,gs as da,ys as ea,au as fa,$r as ga,hs as ha,bs as ia,As as ja,fu as ka,ks as la,he as ma,ft as na,Fn as oa,Xr as pa,xu as qa,zr as ra,Ru as sa,Ts as ta,cn as ua,Ms as va,Mu as wa,ze as xa,Lu as ya,Qr as za,Te as Aa,Fs as Ba,bt as Ca,ju as Da,Ku as Ea,fn as Fa,Ge as Ga,Ks as Ha,Gs as Ia,Vs as Ja,oc as Ka,sc as La,Mp as Ma,Ip as Na,ac as Oa,lc as Pa,jc as Qa,Kc as Ra,va as Sa,Gc as Ta,ho as Ua,Mt as Va,qc as Wa,Ta as Xa,wa as Ya,Oa as Za,Ma as _a,Gn as $a,Ia as ab,La as bb,Da as cb,bo as db,It as eb,Jc as fb,Na as gb,Qc as hb,Fa as ib,Zc as jb,ef as kb,nf as lb,Ao as mb,Pt as nb,Ba as ob,tf as pb,Ua as qb,rf as rb,of as sb,_o as tb,ja as ub,sf as vb,Ka as wb,Co as xb,xo as yb,Ga as zb,So as Ab,af as Bb,Va as Cb,$a as Db,lf as Eb,ff as Fb,Ro as Gb,vo as Hb,Oe as Ib,bn as Jb,pf as Kb,Eo as Lb,mf as Mb,ko as Nb,qa as Ob,gf as Pb,Af as Qb,_f as Rb,Cf as Sb,xf as Tb,Sf as Ub,Ff as Vb,jf as Wb,Kf as Xb,Ha as Yb,Oo as Zb,Bt as _b,Vf as $b,$f as ac,Xa as bc,Ja as cc,Mo as dc,qf as ec,Za as fc,Jf as gc,Qf as hc,An as ic,Zf as jc,ed as kc};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __alran_cR } from "module"; import { basename as __alran_basename, dirname as __alran_dirname, join as __alran_join } from "path"; import { fileURLToPath as __alran_fileURLToPath, pathToFileURL as __alran_pathToFileURL } from "url"; const __alran_tuiCurrentModuleDir = __alran_dirname(__alran_fileURLToPath(import.meta.url)); const __alran_tuiPackageRoot = __alran_basename(__alran_tuiCurrentModuleDir) === "chunks" ? __alran_dirname(__alran_tuiCurrentModuleDir) : __alran_tuiCurrentModuleDir; const __alran_tuiPackageEntryUrl = __alran_pathToFileURL(__alran_join(__alran_tuiPackageRoot, "cli.js")).href; const require = __alran_cR(__alran_tuiPackageEntryUrl); const __dirname = __alran_tuiPackageRoot;
2
- import{b as f,c as Q,d as x,e as p,f as g}from"./chunk-YPV2X2RG.js";var q=Object.defineProperty;var K=(e,t)=>{for(var r in t)q(e,r,{get:t[r],enumerable:true})};var k=false;function b(...e){k&&console.log("quickjs-emscripten:",...e)}var W={};K(W,{QuickJSAsyncifyError:()=>F,QuickJSAsyncifySuspended:()=>V,QuickJSEmptyGetOwnPropertyNames:()=>U,QuickJSEmscriptenModuleError:()=>Z,QuickJSMemoryLeakDetected:()=>Y,QuickJSNotImplemented:()=>R,QuickJSPromisePending:()=>B,QuickJSUnknownIntrinsic:()=>j,QuickJSUnwrapError:()=>A,QuickJSUseAfterFree:()=>E,QuickJSWrongOwner:()=>N});var A=class extends Error{constructor(e,t){let r=typeof e=="object"&&e&&"message"in e?String(e.message):String(e);super(r);this.cause=e;this.context=t;this.name="QuickJSUnwrapError"}};var N=class extends Error{constructor(){super(...arguments);this.name="QuickJSWrongOwner"}};var E=class extends Error{constructor(){super(...arguments);this.name="QuickJSUseAfterFree"}};var R=class extends Error{constructor(){super(...arguments);this.name="QuickJSNotImplemented"}};var F=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifyError"}};var V=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifySuspended"}};var Y=class extends Error{constructor(){super(...arguments);this.name="QuickJSMemoryLeakDetected"}};var Z=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmscriptenModuleError"}};var j=class extends TypeError{constructor(){super(...arguments);this.name="QuickJSUnknownIntrinsic"}};var B=class extends Error{constructor(){super(...arguments);this.name="QuickJSPromisePending"}};var U=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmptyGetOwnPropertyNames"}};function*D(e){return yield e}function X(e){return D(C(e))}var H=D;H.of=X;function L(e,t){return(...r)=>{let i=t.call(e,H,...r);return C(i)}}function ee(e,t){let r=t.call(e,H);return C(r)}function C(e){function t(r){return r.done?r.value:r.value instanceof Promise?r.value.then(i=>t(e.next(i)),i=>t(e.throw(i))):t(e.next(r.value))}return t(e.next())}var m=class{[Symbol.dispose](){return this.dispose()}};var M=Symbol.dispose??Symbol.for("Symbol.dispose");var I=m.prototype;I[M]||(I[M]=function(){return this.dispose()});var h=class G extends m{constructor(t,r,i,s){super();this._value=t;this.copier=r;this.disposer=i;this._owner=s;this._alive=true;this._constructorStack=k?new Error("Lifetime constructed").stack:void 0}get alive(){return this._alive}get value(){return this.assertAlive(),this._value}get owner(){return this._owner}get dupable(){return!!this.copier}dup(){if(this.assertAlive(),!this.copier)throw new Error("Non-dupable lifetime");return new G(this.copier(this._value),this.copier,this.disposer,this._owner)}consume(t){this.assertAlive();let r=t(this);return this.dispose(),r}map(t){return this.assertAlive(),t(this)}tap(t){return t(this),this}dispose(){this.assertAlive(),this.disposer&&this.disposer(this._value),this._alive=false}assertAlive(){if(!this.alive)throw this._constructorStack?new E(`Lifetime not alive
2
+ import{b as f,c as Q,d as x,e as p,f as g}from"./chunk-4XP5XUIZ.js";var q=Object.defineProperty;var K=(e,t)=>{for(var r in t)q(e,r,{get:t[r],enumerable:true})};var k=false;function b(...e){k&&console.log("quickjs-emscripten:",...e)}var W={};K(W,{QuickJSAsyncifyError:()=>F,QuickJSAsyncifySuspended:()=>V,QuickJSEmptyGetOwnPropertyNames:()=>U,QuickJSEmscriptenModuleError:()=>Z,QuickJSMemoryLeakDetected:()=>Y,QuickJSNotImplemented:()=>R,QuickJSPromisePending:()=>B,QuickJSUnknownIntrinsic:()=>j,QuickJSUnwrapError:()=>A,QuickJSUseAfterFree:()=>E,QuickJSWrongOwner:()=>N});var A=class extends Error{constructor(e,t){let r=typeof e=="object"&&e&&"message"in e?String(e.message):String(e);super(r);this.cause=e;this.context=t;this.name="QuickJSUnwrapError"}};var N=class extends Error{constructor(){super(...arguments);this.name="QuickJSWrongOwner"}};var E=class extends Error{constructor(){super(...arguments);this.name="QuickJSUseAfterFree"}};var R=class extends Error{constructor(){super(...arguments);this.name="QuickJSNotImplemented"}};var F=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifyError"}};var V=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifySuspended"}};var Y=class extends Error{constructor(){super(...arguments);this.name="QuickJSMemoryLeakDetected"}};var Z=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmscriptenModuleError"}};var j=class extends TypeError{constructor(){super(...arguments);this.name="QuickJSUnknownIntrinsic"}};var B=class extends Error{constructor(){super(...arguments);this.name="QuickJSPromisePending"}};var U=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmptyGetOwnPropertyNames"}};function*D(e){return yield e}function X(e){return D(C(e))}var H=D;H.of=X;function L(e,t){return(...r)=>{let i=t.call(e,H,...r);return C(i)}}function ee(e,t){let r=t.call(e,H);return C(r)}function C(e){function t(r){return r.done?r.value:r.value instanceof Promise?r.value.then(i=>t(e.next(i)),i=>t(e.throw(i))):t(e.next(r.value))}return t(e.next())}var m=class{[Symbol.dispose](){return this.dispose()}};var M=Symbol.dispose??Symbol.for("Symbol.dispose");var I=m.prototype;I[M]||(I[M]=function(){return this.dispose()});var h=class G extends m{constructor(t,r,i,s){super();this._value=t;this.copier=r;this.disposer=i;this._owner=s;this._alive=true;this._constructorStack=k?new Error("Lifetime constructed").stack:void 0}get alive(){return this._alive}get value(){return this.assertAlive(),this._value}get owner(){return this._owner}get dupable(){return!!this.copier}dup(){if(this.assertAlive(),!this.copier)throw new Error("Non-dupable lifetime");return new G(this.copier(this._value),this.copier,this.disposer,this._owner)}consume(t){this.assertAlive();let r=t(this);return this.dispose(),r}map(t){return this.assertAlive(),t(this)}tap(t){return t(this),this}dispose(){this.assertAlive(),this.disposer&&this.disposer(this._value),this._alive=false}assertAlive(){if(!this.alive)throw this._constructorStack?new E(`Lifetime not alive
3
3
  ${this._constructorStack}
4
4
  Lifetime used`):new E("Lifetime not alive")}};var y=class extends h{constructor(e,t){super(e,void 0,void 0,t)}get dupable(){return true}dup(){return this}dispose(){}};var O=class extends h{constructor(e,t,r,i){super(e,t,r,i)}dispose(){this._alive=false}};function T(e,t){let r;try{e.dispose()}catch(i){r=i}if(t&&r)throw Object.assign(t,{message:`${t.message}
5
5
  Then, failed to dispose scope: ${r.message}`,disposeError:r}),t;if(t||r)throw t||r}var c=class _ extends m{constructor(){super(...arguments);this._disposables=new h(new Set);this.manage=t=>(this._disposables.value.add(t),t)}static withScope(t){let r=new _,i;try{return t(r)}catch(s){throw i=s,s}finally{T(r,i)}}static withScopeMaybeAsync(t,r){return ee(void 0,function*(i){let s=new _,n;try{return yield*i.of(r.call(t,i,s))}catch(a){throw n=a,a}finally{T(s,n)}})}static async withScopeAsync(t){let r=new _,i;try{return await t(r)}catch(s){throw i=s,s}finally{T(r,i)}}get alive(){return this._disposables.alive}dispose(){let t=Array.from(this._disposables.value.values()).reverse();for(let r of t)r.alive&&r.dispose();this._disposables.dispose()}};function te(e){let t=e?Array.from(e):[];function r(){return t.forEach(s=>s.alive?s.dispose():void 0)}function i(){return t.some(s=>s.alive)}return Object.defineProperty(t,M,{configurable:true,enumerable:false,value:r}),Object.defineProperty(t,"dispose",{configurable:true,enumerable:false,value:r}),Object.defineProperty(t,"alive",{configurable:true,enumerable:false,get:i}),t}function P(e){return!!(e&&(typeof e=="object"||typeof e=="function")&&"alive"in e&&typeof e.alive=="boolean"&&"dispose"in e&&typeof e.dispose=="function")}var J=class $ extends m{static success(t){return new re(t)}static fail(t,r){return new ie(t,r)}static is(t){return t instanceof $}};var re=class extends J{constructor(e){super();this.value=e}get alive(){return P(this.value)?this.value.alive:true}dispose(){P(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr(e){return this.value}};var ie=class extends J{constructor(e,t){super();this.error=e;this.onUnwrap=t}get alive(){return P(this.error)?this.error.alive:true}dispose(){P(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr(e){return e}};var w=J;var se=class extends m{constructor(e){super();this.resolve=t=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,t||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())};this.reject=t=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,t||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())};this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()};this.context=e.context,this.owner=e.context.runtime,this.handle=e.promiseHandle,this.settled=new Promise(t=>{this.onSettled=t}),this.resolveHandle=e.resolveHandle,this.rejectHandle=e.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}};var z=class{constructor(e){this.module=e}toPointerArray(e){let t=new Int32Array(e.map(s=>s.value)),r=t.length*t.BYTES_PER_ELEMENT,i=this.module._malloc(r);return new Uint8Array(this.module.HEAPU8.buffer,i,r).set(new Uint8Array(t.buffer)),new h(i,void 0,s=>this.module._free(s))}newTypedArray(e,t){let r=new e(new Array(t).fill(0)),i=r.length*r.BYTES_PER_ELEMENT,s=this.module._malloc(i),n=new e(this.module.HEAPU8.buffer,s,t);return n.set(r),new h({typedArray:n,ptr:s},void 0,a=>this.module._free(a.ptr))}newMutablePointerArray(e){return this.newTypedArray(Int32Array,e)}newHeapCharPointer(e){let t=this.module.lengthBytesUTF8(e),r=t+1,i=this.module._malloc(r);return this.module.stringToUTF8(e,i,r),new h({ptr:i,strlen:t},void 0,s=>this.module._free(s.ptr))}newHeapBufferPointer(e){let t=e.byteLength,r=this.module._malloc(t);return this.module.HEAPU8.set(e,r),new h({pointer:r,numBytes:t},void 0,i=>this.module._free(i.pointer))}consumeHeapCharPointer(e){let t=this.module.UTF8ToString(e);return this.module._free(e),t}};var Se=Object.freeze({BaseObjects:true,Date:true,Eval:true,StringNormalize:true,RegExp:true,JSON:true,Proxy:true,MapSet:true,TypedArrays:true,Promise:true});function ne(e){if(!e)return 0;let t=0;for(let[r,i]of Object.entries(e)){if(!(r in Q))throw new j(r);i&&(t|=Q[r])}return t}function oe(e){if(typeof e=="number")return e;if(e===void 0)return 0;let{type:t,strict:r,strip:i,compileOnly:s,backtraceBarrier:n}=e,a=0;return t==="global"&&(a|=f.JS_EVAL_TYPE_GLOBAL),t==="module"&&(a|=f.JS_EVAL_TYPE_MODULE),r&&(a|=f.JS_EVAL_FLAG_STRICT),i&&(a|=f.JS_EVAL_FLAG_STRIP),s&&(a|=f.JS_EVAL_FLAG_COMPILE_ONLY),n&&(a|=f.JS_EVAL_FLAG_BACKTRACE_BARRIER),a}function ae(e){if(typeof e=="number")return e;if(e===void 0)return 0;let{strings:t,symbols:r,quickjsPrivate:i,onlyEnumerable:s,numbers:n,numbersAsStrings:a}=e,o=0;return t&&(o|=p.JS_GPN_STRING_MASK),r&&(o|=p.JS_GPN_SYMBOL_MASK),i&&(o|=p.JS_GPN_PRIVATE_MASK),s&&(o|=p.JS_GPN_ENUM_ONLY),n&&(o|=p.QTS_GPN_NUMBER_MASK),a&&(o|=p.QTS_STANDARD_COMPLIANT_NUMBER),o}function ue(...e){let t=[];for(let r of e)r!==void 0&&(t=t.concat(r));return t}var le=class extends m{constructor(e,t){super();this.handle=e;this.context=t;this._isDone=false;this.owner=t.runtime}[Symbol.iterator](){return this}next(e){if(!this.alive||this._isDone)return{done:true,value:void 0};let t=this._next??(this._next=this.context.getProp(this.handle,"next"));return this.callIteratorMethod(t,e)}return(e){if(!this.alive)return{done:true,value:void 0};let t=this.context.getProp(this.handle,"return");if(t===this.context.undefined&&e===void 0)return this.dispose(),{done:true,value:void 0};let r=this.callIteratorMethod(t,e);return t.dispose(),this.dispose(),r}throw(e){if(!this.alive)return{done:true,value:void 0};let t=e instanceof h?e:this.context.newError(e),r=this.context.getProp(this.handle,"throw"),i=this.callIteratorMethod(r,e);return t.alive&&t.dispose(),r.dispose(),this.dispose(),i}get alive(){return this.handle.alive}dispose(){this._isDone=true,this.handle.dispose(),this._next?.dispose()}callIteratorMethod(e,t){let r=t?this.context.callFunction(e,this.handle,t):this.context.callFunction(e,this.handle);if(r.error)return this.dispose(),{value:r};let i=this.context.getProp(r.value,"done").consume(n=>this.context.dump(n));if(i)return r.value.dispose(),this.dispose(),{done:i,value:void 0};let s=this.context.getProp(r.value,"value");return r.value.dispose(),{value:w.success(s),done:i}}};var he=class extends z{constructor(e){super(e.module);this.scope=new c;this.copyJSValue=t=>this.ffi.QTS_DupValuePointer(this.ctx.value,t);this.freeJSValue=t=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,t)};e.ownedLifetimes?.forEach(t=>this.scope.manage(t)),this.owner=e.owner,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=this.scope.manage(e.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage(e){return this.scope.manage(e)}consumeJSCharPointer(e){let t=this.module.UTF8ToString(e);return this.ffi.QTS_FreeCString(this.ctx.value,e),t}heapValueHandle(e){return new h(e,this.copyJSValue,this.freeJSValue,this.owner)}staticHeapValueHandle(e){return this.manage(this.heapValueHandle(e)),new y(e,this.owner)}};var ce=class extends m{constructor(e){super();this._undefined=void 0;this._null=void 0;this._false=void 0;this._true=void 0;this._global=void 0;this._BigInt=void 0;this._Symbol=void 0;this._SymbolIterator=void 0;this._SymbolAsyncIterator=void 0;this.fnNextId=-32768;this.fnMaps=new Map;this.cToHostCallbacks={callFunction:(t,r,i,s,n)=>{if(t!==this.ctx.value)throw new Error("QuickJSContext instance received C -> JS call with mismatched ctx");let a=this.getFunction(n);if(!a)throw new Error(`QuickJSContext had no callback with id ${n}`);return c.withScopeMaybeAsync(this,function*(o,u){let d=u.manage(new O(r,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),v=new Array(i);for(let l=0;l<i;l++){let S=this.ffi.QTS_ArgvGetJSValueConstPointer(s,l);v[l]=u.manage(new O(S,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let l=yield*o(a.apply(d,v));if(l){if("error"in l&&l.error)throw this.runtime.debugLog("throw error",l.error),l.error;let S=u.manage(l instanceof h?l:l.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,S.value)}return 0}catch(l){return this.errorToHandle(l).consume(S=>this.ffi.QTS_Throw(this.ctx.value,S.value))}})}};this.runtime=e.runtime,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=e.ctx,this.memory=new he({...e,owner:this.runtime}),e.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let e=this.ffi.QTS_GetUndefined();return this._undefined=new y(e)}get null(){if(this._null)return this._null;let e=this.ffi.QTS_GetNull();return this._null=new y(e)}get true(){if(this._true)return this._true;let e=this.ffi.QTS_GetTrue();return this._true=new y(e)}get false(){if(this._false)return this._false;let e=this.ffi.QTS_GetFalse();return this._false=new y(e)}get global(){if(this._global)return this._global;let e=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle(e),this._global}newNumber(e){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,e))}newString(e){let t=this.memory.newHeapCharPointer(e).consume(r=>this.ffi.QTS_NewString(this.ctx.value,r.value.ptr));return this.memory.heapValueHandle(t)}newUniqueSymbol(e){let t=(typeof e=="symbol"?e.description:e)??"",r=this.memory.newHeapCharPointer(t).consume(i=>this.ffi.QTS_NewSymbol(this.ctx.value,i.value.ptr,0));return this.memory.heapValueHandle(r)}newSymbolFor(e){let t=(typeof e=="symbol"?e.description:e)??"",r=this.memory.newHeapCharPointer(t).consume(i=>this.ffi.QTS_NewSymbol(this.ctx.value,i.value.ptr,1));return this.memory.heapValueHandle(r)}getWellKnownSymbol(e){return this._Symbol??(this._Symbol=this.memory.manage(this.getProp(this.global,"Symbol"))),this.getProp(this._Symbol,e)}newBigInt(e){if(!this._BigInt){let i=this.getProp(this.global,"BigInt");this.memory.manage(i),this._BigInt=new y(i.value,this.runtime)}let t=this._BigInt,r=String(e);return this.newString(r).consume(i=>this.unwrapResult(this.callFunction(t,this.undefined,i)))}newObject(e){e&&this.runtime.assertOwned(e);let t=e?this.ffi.QTS_NewObjectProto(this.ctx.value,e.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(t)}newArray(){let e=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle(e)}newArrayBuffer(e){let t=new Uint8Array(e),r=this.memory.newHeapBufferPointer(t),i=this.ffi.QTS_NewArrayBuffer(this.ctx.value,r.value.pointer,t.length);return this.memory.heapValueHandle(i)}newPromise(e){let t=c.withScope(r=>{let i=r.manage(this.memory.newMutablePointerArray(2)),s=this.ffi.QTS_NewPromiseCapability(this.ctx.value,i.value.ptr),n=this.memory.heapValueHandle(s),[a,o]=Array.from(i.value.typedArray).map(u=>this.memory.heapValueHandle(u));return new se({context:this,promiseHandle:n,resolveHandle:a,rejectHandle:o})});return e&&typeof e=="function"&&(e=new Promise(e)),e&&Promise.resolve(e).then(t.resolve,r=>r instanceof h?t.reject(r):this.newError(r).consume(t.reject)),t}newFunction(e,t){let r=++this.fnNextId;return this.setFunction(r,t),this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,r,e))}newError(e){let t=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return e&&typeof e=="object"?(e.name!==void 0&&this.newString(e.name).consume(r=>this.setProp(t,"name",r)),e.message!==void 0&&this.newString(e.message).consume(r=>this.setProp(t,"message",r))):typeof e=="string"?this.newString(e).consume(r=>this.setProp(t,"message",r)):e!==void 0&&this.newString(String(e)).consume(r=>this.setProp(t,"message",r)),t}typeof(e){return this.runtime.assertOwned(e),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,e.value))}getNumber(e){return this.runtime.assertOwned(e),this.ffi.QTS_GetFloat64(this.ctx.value,e.value)}getString(e){return this.runtime.assertOwned(e),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,e.value))}getSymbol(e){this.runtime.assertOwned(e);let t=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,e.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,e.value)?Symbol.for(t):Symbol(t)}getBigInt(e){this.runtime.assertOwned(e);let t=this.getString(e);return BigInt(t)}getArrayBuffer(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,e.value),r=this.ffi.QTS_GetArrayBuffer(this.ctx.value,e.value);if(!r)throw new Error("Couldn't allocate memory to get ArrayBuffer");return new h(this.module.HEAPU8.subarray(r,r+t),void 0,()=>this.module._free(r))}getPromiseState(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_PromiseState(this.ctx.value,e.value);if(t<0)return{type:"fulfilled",value:e,notAPromise:true};if(t===x.Pending)return{type:"pending",get error(){return new B("Cannot unwrap a pending promise")}};let r=this.ffi.QTS_PromiseResult(this.ctx.value,e.value),i=this.memory.heapValueHandle(r);if(t===x.Fulfilled)return{type:"fulfilled",value:i};if(t===x.Rejected)return{type:"rejected",error:i};throw i.dispose(),new Error(`Unknown JSPromiseStateEnum: ${t}`)}resolvePromise(e){this.runtime.assertOwned(e);let t=c.withScope(r=>{let i=r.manage(this.getProp(this.global,"Promise")),s=r.manage(this.getProp(i,"resolve"));return this.callFunction(s,i,e)});return t.error?Promise.resolve(t):new Promise(r=>{c.withScope(i=>{let s=i.manage(this.newFunction("resolve",u=>{r(this.success(u&&u.dup()))})),n=i.manage(this.newFunction("reject",u=>{r(this.fail(u&&u.dup()))})),a=i.manage(t.value),o=i.manage(this.getProp(a,"then"));this.callFunction(o,a,s,n).unwrap().dispose()})})}isEqual(e,t,r=g.IsStrictlyEqual){if(e===t)return true;this.runtime.assertOwned(e),this.runtime.assertOwned(t);let i=this.ffi.QTS_IsEqual(this.ctx.value,e.value,t.value,r);if(i===-1)throw new R("WASM variant does not expose equality");return!!i}eq(e,t){return this.isEqual(e,t,g.IsStrictlyEqual)}sameValue(e,t){return this.isEqual(e,t,g.IsSameValue)}sameValueZero(e,t){return this.isEqual(e,t,g.IsSameValueZero)}getProp(e,t){this.runtime.assertOwned(e);let r;return typeof t=="number"&&t>=0?r=this.ffi.QTS_GetPropNumber(this.ctx.value,e.value,t):r=this.borrowPropertyKey(t).consume(i=>this.ffi.QTS_GetProp(this.ctx.value,e.value,i.value)),this.memory.heapValueHandle(r)}getLength(e){if(this.runtime.assertOwned(e),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,e.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames(e,t={strings:true,numbersAsStrings:true}){this.runtime.assertOwned(e),e.value;let r=ae(t);if(r===0)throw new U("No options set, will return an empty array");return c.withScope(i=>{let s=i.manage(this.memory.newMutablePointerArray(1)),n=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,s.value.ptr,this.uint32Out.value.ptr,e.value,r);if(n)return this.fail(this.memory.heapValueHandle(n));let a=this.uint32Out.value.typedArray[0],o=s.value.typedArray[0],u=new Uint32Array(this.module.HEAP8.buffer,o,a),d=Array.from(u).map(v=>this.memory.heapValueHandle(v));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,o),this.success(te(d))})}getIterator(e){let t=this._SymbolIterator??(this._SymbolIterator=this.memory.manage(this.getWellKnownSymbol("iterator")));return c.withScope(r=>{let i=r.manage(this.getProp(e,t)),s=this.callFunction(i,e);return s.error?s:this.success(new le(s.value,this))})}setProp(e,t,r){this.runtime.assertOwned(e),this.borrowPropertyKey(t).consume(i=>this.ffi.QTS_SetProp(this.ctx.value,e.value,i.value,r.value))}defineProp(e,t,r){this.runtime.assertOwned(e),c.withScope(i=>{let s=i.manage(this.borrowPropertyKey(t)),n=r.value||this.undefined,a=!!r.configurable,o=!!r.enumerable,u=!!r.value,d=r.get?i.manage(this.newFunction(r.get.name,r.get)):this.undefined,v=r.set?i.manage(this.newFunction(r.set.name,r.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,e.value,s.value,n.value,d.value,v.value,a,o,u)})}callFunction(e,t,...r){this.runtime.assertOwned(e);let i,s=r[0];s===void 0||Array.isArray(s)?i=s??[]:i=r;let n=this.memory.toPointerArray(i).consume(o=>this.ffi.QTS_Call(this.ctx.value,e.value,t.value,i.length,o.value)),a=this.ffi.QTS_ResolveException(this.ctx.value,n);return a?(this.ffi.QTS_FreeValuePointer(this.ctx.value,n),this.fail(this.memory.heapValueHandle(a))):this.success(this.memory.heapValueHandle(n))}callMethod(e,t,r=[]){return this.getProp(e,t).consume(i=>this.callFunction(i,e,r))}evalCode(e,t="eval.js",r){let i=r===void 0?1:0,s=oe(r),n=this.memory.newHeapCharPointer(e).consume(o=>this.ffi.QTS_Eval(this.ctx.value,o.value.ptr,o.value.strlen,t,i,s)),a=this.ffi.QTS_ResolveException(this.ctx.value,n);return a?(this.ffi.QTS_FreeValuePointer(this.ctx.value,n),this.fail(this.memory.heapValueHandle(a))):this.success(this.memory.heapValueHandle(n))}throw(e){return this.errorToHandle(e).consume(t=>this.ffi.QTS_Throw(this.ctx.value,t.value))}borrowPropertyKey(e){return typeof e=="number"?this.newNumber(e):typeof e=="string"?this.newString(e):new y(e.value,this.runtime)}getMemory(e){if(e===this.rt.value)return this.memory;throw new Error("Private API. Cannot get memory from a different runtime")}dump(e){this.runtime.assertOwned(e);let t=this.typeof(e);if(t==="string")return this.getString(e);if(t==="number")return this.getNumber(e);if(t==="bigint")return this.getBigInt(e);if(t==="undefined")return;if(t==="symbol")return this.getSymbol(e);let r=this.getPromiseState(e);if(r.type==="fulfilled"&&!r.notAPromise)return e.dispose(),{type:r.type,value:r.value.consume(this.dump)};if(r.type==="pending")return e.dispose(),{type:r.type};if(r.type==="rejected")return e.dispose(),{type:r.type,error:r.error.consume(this.dump)};let i=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,e.value));try{return JSON.parse(i)}catch{return i}}unwrapResult(e){if(e.error){let t="context"in e.error?e.error.context:this,r=e.error.consume(i=>this.dump(i));if(r&&typeof r=="object"&&typeof r.message=="string"){let{message:i,name:s,stack:n,...a}=r,o=new A(r,t);typeof s=="string"&&(o.name=r.name),o.message=i;let u=o.stack;throw typeof n=="string"&&(o.stack=`${s}: ${i}
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __alran_cR } from "module"; import { basename as __alran_basename, dirname as __alran_dirname, join as __alran_join } from "path"; import { fileURLToPath as __alran_fileURLToPath, pathToFileURL as __alran_pathToFileURL } from "url"; const __alran_tuiCurrentModuleDir = __alran_dirname(__alran_fileURLToPath(import.meta.url)); const __alran_tuiPackageRoot = __alran_basename(__alran_tuiCurrentModuleDir) === "chunks" ? __alran_dirname(__alran_tuiCurrentModuleDir) : __alran_tuiCurrentModuleDir; const __alran_tuiPackageEntryUrl = __alran_pathToFileURL(__alran_join(__alran_tuiPackageRoot, "cli.js")).href; const require = __alran_cR(__alran_tuiPackageEntryUrl); const __dirname = __alran_tuiPackageRoot;
2
- import{a,b,c,d}from"./chunk-4PDIO3M6.js";import"./chunk-IWK7PZP7.js";import"./chunk-EYK25HWR.js";import"./chunk-FXOH6TEQ.js";import"./chunk-XFCC2CI2.js";import"./chunk-N5SVBCUB.js";import"./chunk-HNWBFJNO.js";import"./chunk-XQK7JM66.js";export{b as getTuiDataDirPath,d as prepareTuiDataDir,a as resolveDefaultTuiDataDir,c as resolveTuiDataDir};
2
+ import{a,b,c,d}from"./chunk-6UXSIWCB.js";import"./chunk-5RIMHTEU.js";import"./chunk-5Y76VFHY.js";import"./chunk-XVGPB7TW.js";import"./chunk-VUISZDXX.js";import"./chunk-XSEU4WQD.js";import"./chunk-HNWBFJNO.js";import"./chunk-XQK7JM66.js";export{b as getTuiDataDirPath,d as prepareTuiDataDir,a as resolveDefaultTuiDataDir,c as resolveTuiDataDir};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __alran_cR } from "module"; import { basename as __alran_basename, dirname as __alran_dirname, join as __alran_join } from "path"; import { fileURLToPath as __alran_fileURLToPath, pathToFileURL as __alran_pathToFileURL } from "url"; const __alran_tuiCurrentModuleDir = __alran_dirname(__alran_fileURLToPath(import.meta.url)); const __alran_tuiPackageRoot = __alran_basename(__alran_tuiCurrentModuleDir) === "chunks" ? __alran_dirname(__alran_tuiCurrentModuleDir) : __alran_tuiCurrentModuleDir; const __alran_tuiPackageEntryUrl = __alran_pathToFileURL(__alran_join(__alran_tuiPackageRoot, "cli.js")).href; const require = __alran_cR(__alran_tuiPackageEntryUrl); const __dirname = __alran_tuiPackageRoot;
2
- import"./chunk-XQK7JM66.js";function M(){if(typeof globalThis.DOMMatrix!=="undefined")return;globalThis.DOMMatrix=class G{constructor(e){if(Array.isArray(e)&&e.length===6){this.a=e[0];this.b=e[1];this.c=e[2];this.d=e[3];this.e=e[4];this.f=e[5]}else{this.a=1;this.b=0;this.c=0;this.d=1;this.e=0;this.f=0}}translateSelf(e,a=0){this.e=this.a*e+this.c*a+this.e;this.f=this.b*e+this.d*a+this.f;return this}scaleSelf(e,a=e){this.a*=e;this.b*=e;this.c*=a;this.d*=a;return this}}}function C(){M()}var m;var P=globalThis.process?.release?.name==="node";var F=typeof window!=="undefined";async function T(t,e={}){const{getDocument:a}=await v();let r={};if(P)try{const n=import.meta.resolve("pdfjs-dist/package.json");r={disableFontFace:true,standardFontDataUrl:new URL("./standard_fonts/",n).href,cMapUrl:new URL("./cmaps/",n).href,cMapPacked:true}}catch{}return await a({data:t,useSystemFonts:true,...r,...e}).promise}async function g(t,e,a){const r=O(t)?t:await T(t,a);try{return await e(r)}finally{if(r!==t)await r.loadingTask.destroy()}}async function v(){if(!m)await h();return m}async function h(t,{reload:e=false}={}){if(m&&!e)return;C();if(t)try{m=await b(t());return}catch(a){throw new Error(`PDF.js could not be resolved: ${a}`)}try{m=await import("./pdfjs-SHZAF7PF.js")}catch(a){throw new Error(`Serverless PDF.js bundle could not be resolved: ${a}`)}}function O(t){return typeof t==="object"&&t!==null&&"_pdfInfo"in t}async function b(t){const e=await t;return e.default||e}var d;var D=class{#t=false;constructor({enableHWA:t=false}={}){this.#t=t}create(t,e){const a=this._createCanvas(t,e);return{canvas:a,context:a.getContext("2d",{willReadFrequently:!this.#t})}}reset({canvas:t},e,a){if(!t)throw new Error("Canvas is not specified");t.width=e;t.height=a}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0;t.canvas.height=0;t.canvas=void 0;t.context=void 0}_createCanvas(t,e){throw new Error("Not implemented")}};var I=class extends D{constructor({ownerDocument:t=globalThis.document,enableHWA:e=false}={}){super({enableHWA:e});this._document=t}_createCanvas(t,e){const a=this._document.createElement("canvas");a.width=t;a.height=e;return a}};var E=class extends D{constructor({enableHWA:t=false}={}){super({enableHWA:t})}_createCanvas(t,e){if(!d)throw new Error("@napi-rs/canvas module is not resolved");return d.createCanvas(t,e)}};async function _(t){d??=await b(t());globalThis[Symbol.for("unpdf.canvasModule")]=d}function L(){if(!d)return;globalThis.DOMMatrix=d.DOMMatrix;if(typeof globalThis.ImageData==="undefined")globalThis.ImageData=d.ImageData;if(typeof globalThis.Path2D==="undefined")globalThis.Path2D=d.Path2D}async function j(t,e){return await g(t,async a=>{if(e<1||e>a.numPages)throw new Error(`Invalid page number. Must be between 1 and ${a.numPages}.`);const r=await a.getPage(e);const n=await r.getOperatorList();const{OPS:u}=await v();const c=[];for(let o=0;o<n.fnArray.length;o++){if(n.fnArray[o]!==u.paintImageXObject)continue;const i=n.argsArray[o][0];const s=await new Promise(x=>(i.startsWith("g_")?r.commonObjs:r.objs).get(i,x));if(!s||!s.data||!s.width||!s.height)continue;const{width:l,height:w,data:y}=s;const f=y.length/(l*w);if(![1,3,4].includes(f))continue;const p=f;c.push({data:y,width:l,height:w,channels:p,key:i})}return c})}async function S(t,e,a={}){const r=await A(a.canvasImport);return await g(t,async n=>{if(e<1||e>n.numPages)throw new Error(`Invalid page number. Must be between 1 and ${n.numPages}.`);const u=await n.getPage(e);const c=u.getViewport({scale:1});let o=a.scale||1;if(a.width)o=a.width/c.width;else if(a.height)o=a.height/c.height;const i=u.getViewport({scale:Math.max(0,o)});const s=new r;const l=s.create(i.width,i.height);try{await u.render({canvas:l.canvas,canvasContext:l.context,viewport:i}).promise;const{canvas:w}=l;if(a.toDataURL)return w.toDataURL();if("encode"in w){const f=await w.encode("png");return f.buffer.slice(f.byteOffset,f.byteOffset+f.byteLength)}const y=await new Promise(f=>{w.toBlob(f)});if(!y)throw new Error("Failed to encode canvas to a PNG blob.");return await y.arrayBuffer()}finally{s.destroy(l)}},{CanvasFactory:r})}async function A(t){if(F)return I;if(P){if(!t)throw new Error('Parameter "canvasImport" is required in Node.js environment.');await _(t);L();return E}throw new Error("Unsupported environment for canvas creation.")}async function k(t){return await g(t,async e=>{const a=await Promise.all(Array.from({length:e.numPages},(r,n)=>$(e,n+1)));return{totalPages:e.numPages,links:a.flat()}})}async function $(t,e){const a=await(await t.getPage(e)).getAnnotations();const r=[];for(const n of a)if(n.subtype==="Link"&&n.url)r.push(n.url);return r}var U=["xmp:createdate","xmp:modifydate","xmp:metadatadate","xap:createdate","xap:modifydate","xap:metadatadate"];async function R(t,e={}){return await g(t,async a=>{const r=await a.getMetadata();const n=r?.info||{};if(e.parseDates){const{PDFDateString:u}=await v();if(n?.CreationDate)n.CreationDate=u.toDateObject(n?.CreationDate);if(n?.ModDate)n.ModDate=u.toDateObject(n?.ModDate);if(r.metadata)r.metadata=new Proxy(r.metadata,{get(c,o){if(o==="get")return i=>{const s=c.get(i);if(U.includes(i)&&s)return B(s);return s};return c[o]}})}return{info:n,metadata:r?.metadata||{}}})}function B(t){if(!t)return;const e=Date.parse(t);if(!Number.isNaN(e))return new Date(e)}async function N(t){return await g(t,async e=>{const a=await Promise.all(Array.from({length:e.numPages},(r,n)=>J(e,n+1)));return{totalPages:e.numPages,items:a}})}async function J(t,e){const a=await(await t.getPage(e)).getTextContent();const r=a.styles;return a.items.filter(n=>n.str!=null).map(n=>{const[u,c,o,i,s,l]=n.transform;return{str:n.str,x:s,y:l,width:n.width,height:n.height,fontSize:Math.hypot(o,i),fontFamily:r[n.fontName]?.fontFamily??"",dir:n.dir,hasEOL:n.hasEOL}})}async function V(t,e={}){const{mergePages:a=false}=e;return await g(t,async r=>{const n=await Promise.all(Array.from({length:r.numPages},(u,c)=>q(r,c+1)));return{totalPages:r.numPages,text:a?z(n):n}})}async function q(t,e){return(await(await t.getPage(e)).getTextContent()).items.filter(a=>a.str!=null).map(a=>a.str+(a.hasEOL?"\n":"")).join("")}function z(t){return t.join("\n").replace(/[^\S\n]+/g," ").replace(/ ?\n ?/g,"\n").replace(/\n{3,}/g,"\n\n")}async function W(t){await h(t,{reload:true})}async function X(t){await h(t.pdfjs,{reload:true})}var H=async(...t)=>{await h();return await R(...t)};var K=async(...t)=>{await h();return await V(...t)};var Q=async(...t)=>{await h();return await N(...t)};var Y=async(...t)=>{await h();return await j(...t)};var Z=async(...t)=>{await h();return await S(...t)};var tt=async(...t)=>{await h();return await k(...t)};export{X as configureUnPDF,A as createIsomorphicCanvasFactory,W as definePDFJSModule,Y as extractImages,tt as extractLinks,K as extractText,Q as extractTextItems,T as getDocumentProxy,H as getMeta,v as getResolvedPDFJS,Z as renderPageAsImage,h as resolvePDFJSImport};
2
+ import"./chunk-XQK7JM66.js";function M(){if(typeof globalThis.DOMMatrix!=="undefined")return;globalThis.DOMMatrix=class G{constructor(e){if(Array.isArray(e)&&e.length===6){this.a=e[0];this.b=e[1];this.c=e[2];this.d=e[3];this.e=e[4];this.f=e[5]}else{this.a=1;this.b=0;this.c=0;this.d=1;this.e=0;this.f=0}}translateSelf(e,a=0){this.e=this.a*e+this.c*a+this.e;this.f=this.b*e+this.d*a+this.f;return this}scaleSelf(e,a=e){this.a*=e;this.b*=e;this.c*=a;this.d*=a;return this}}}function C(){M()}var m;var P=globalThis.process?.release?.name==="node";var F=typeof window!=="undefined";async function T(t,e={}){const{getDocument:a}=await v();let r={};if(P)try{const n=import.meta.resolve("pdfjs-dist/package.json");r={disableFontFace:true,standardFontDataUrl:new URL("./standard_fonts/",n).href,cMapUrl:new URL("./cmaps/",n).href,cMapPacked:true}}catch{}return await a({data:t,useSystemFonts:true,...r,...e}).promise}async function g(t,e,a){const r=O(t)?t:await T(t,a);try{return await e(r)}finally{if(r!==t)await r.loadingTask.destroy()}}async function v(){if(!m)await h();return m}async function h(t,{reload:e=false}={}){if(m&&!e)return;C();if(t)try{m=await b(t());return}catch(a){throw new Error(`PDF.js could not be resolved: ${a}`)}try{m=await import("./pdfjs-2UOWBGC2.js")}catch(a){throw new Error(`Serverless PDF.js bundle could not be resolved: ${a}`)}}function O(t){return typeof t==="object"&&t!==null&&"_pdfInfo"in t}async function b(t){const e=await t;return e.default||e}var d;var D=class{#t=false;constructor({enableHWA:t=false}={}){this.#t=t}create(t,e){const a=this._createCanvas(t,e);return{canvas:a,context:a.getContext("2d",{willReadFrequently:!this.#t})}}reset({canvas:t},e,a){if(!t)throw new Error("Canvas is not specified");t.width=e;t.height=a}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0;t.canvas.height=0;t.canvas=void 0;t.context=void 0}_createCanvas(t,e){throw new Error("Not implemented")}};var I=class extends D{constructor({ownerDocument:t=globalThis.document,enableHWA:e=false}={}){super({enableHWA:e});this._document=t}_createCanvas(t,e){const a=this._document.createElement("canvas");a.width=t;a.height=e;return a}};var E=class extends D{constructor({enableHWA:t=false}={}){super({enableHWA:t})}_createCanvas(t,e){if(!d)throw new Error("@napi-rs/canvas module is not resolved");return d.createCanvas(t,e)}};async function _(t){d??=await b(t());globalThis[Symbol.for("unpdf.canvasModule")]=d}function L(){if(!d)return;globalThis.DOMMatrix=d.DOMMatrix;if(typeof globalThis.ImageData==="undefined")globalThis.ImageData=d.ImageData;if(typeof globalThis.Path2D==="undefined")globalThis.Path2D=d.Path2D}async function j(t,e){return await g(t,async a=>{if(e<1||e>a.numPages)throw new Error(`Invalid page number. Must be between 1 and ${a.numPages}.`);const r=await a.getPage(e);const n=await r.getOperatorList();const{OPS:u}=await v();const c=[];for(let o=0;o<n.fnArray.length;o++){if(n.fnArray[o]!==u.paintImageXObject)continue;const i=n.argsArray[o][0];const s=await new Promise(x=>(i.startsWith("g_")?r.commonObjs:r.objs).get(i,x));if(!s||!s.data||!s.width||!s.height)continue;const{width:l,height:w,data:y}=s;const f=y.length/(l*w);if(![1,3,4].includes(f))continue;const p=f;c.push({data:y,width:l,height:w,channels:p,key:i})}return c})}async function S(t,e,a={}){const r=await A(a.canvasImport);return await g(t,async n=>{if(e<1||e>n.numPages)throw new Error(`Invalid page number. Must be between 1 and ${n.numPages}.`);const u=await n.getPage(e);const c=u.getViewport({scale:1});let o=a.scale||1;if(a.width)o=a.width/c.width;else if(a.height)o=a.height/c.height;const i=u.getViewport({scale:Math.max(0,o)});const s=new r;const l=s.create(i.width,i.height);try{await u.render({canvas:l.canvas,canvasContext:l.context,viewport:i}).promise;const{canvas:w}=l;if(a.toDataURL)return w.toDataURL();if("encode"in w){const f=await w.encode("png");return f.buffer.slice(f.byteOffset,f.byteOffset+f.byteLength)}const y=await new Promise(f=>{w.toBlob(f)});if(!y)throw new Error("Failed to encode canvas to a PNG blob.");return await y.arrayBuffer()}finally{s.destroy(l)}},{CanvasFactory:r})}async function A(t){if(F)return I;if(P){if(!t)throw new Error('Parameter "canvasImport" is required in Node.js environment.');await _(t);L();return E}throw new Error("Unsupported environment for canvas creation.")}async function k(t){return await g(t,async e=>{const a=await Promise.all(Array.from({length:e.numPages},(r,n)=>$(e,n+1)));return{totalPages:e.numPages,links:a.flat()}})}async function $(t,e){const a=await(await t.getPage(e)).getAnnotations();const r=[];for(const n of a)if(n.subtype==="Link"&&n.url)r.push(n.url);return r}var U=["xmp:createdate","xmp:modifydate","xmp:metadatadate","xap:createdate","xap:modifydate","xap:metadatadate"];async function R(t,e={}){return await g(t,async a=>{const r=await a.getMetadata();const n=r?.info||{};if(e.parseDates){const{PDFDateString:u}=await v();if(n?.CreationDate)n.CreationDate=u.toDateObject(n?.CreationDate);if(n?.ModDate)n.ModDate=u.toDateObject(n?.ModDate);if(r.metadata)r.metadata=new Proxy(r.metadata,{get(c,o){if(o==="get")return i=>{const s=c.get(i);if(U.includes(i)&&s)return B(s);return s};return c[o]}})}return{info:n,metadata:r?.metadata||{}}})}function B(t){if(!t)return;const e=Date.parse(t);if(!Number.isNaN(e))return new Date(e)}async function N(t){return await g(t,async e=>{const a=await Promise.all(Array.from({length:e.numPages},(r,n)=>J(e,n+1)));return{totalPages:e.numPages,items:a}})}async function J(t,e){const a=await(await t.getPage(e)).getTextContent();const r=a.styles;return a.items.filter(n=>n.str!=null).map(n=>{const[u,c,o,i,s,l]=n.transform;return{str:n.str,x:s,y:l,width:n.width,height:n.height,fontSize:Math.hypot(o,i),fontFamily:r[n.fontName]?.fontFamily??"",dir:n.dir,hasEOL:n.hasEOL}})}async function V(t,e={}){const{mergePages:a=false}=e;return await g(t,async r=>{const n=await Promise.all(Array.from({length:r.numPages},(u,c)=>q(r,c+1)));return{totalPages:r.numPages,text:a?z(n):n}})}async function q(t,e){return(await(await t.getPage(e)).getTextContent()).items.filter(a=>a.str!=null).map(a=>a.str+(a.hasEOL?"\n":"")).join("")}function z(t){return t.join("\n").replace(/[^\S\n]+/g," ").replace(/ ?\n ?/g,"\n").replace(/\n{3,}/g,"\n\n")}async function W(t){await h(t,{reload:true})}async function X(t){await h(t.pdfjs,{reload:true})}var H=async(...t)=>{await h();return await R(...t)};var K=async(...t)=>{await h();return await V(...t)};var Q=async(...t)=>{await h();return await N(...t)};var Y=async(...t)=>{await h();return await j(...t)};var Z=async(...t)=>{await h();return await S(...t)};var tt=async(...t)=>{await h();return await k(...t)};export{X as configureUnPDF,A as createIsomorphicCanvasFactory,W as definePDFJSModule,Y as extractImages,tt as extractLinks,K as extractText,Q as extractTextItems,T as getDocumentProxy,H as getMeta,v as getResolvedPDFJS,Z as renderPageAsImage,h as resolvePDFJSImport};
3
3
  /*! Bundled license information:
4
4
 
5
5
  unpdf/dist/index.mjs: