planbee 0.1.0
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.
- package/LICENSE +33 -0
- package/README.md +76 -0
- package/THIRD-PARTY-NOTICES.txt +933 -0
- package/bin/planbee.js +398 -0
- package/bin/planbee.js.LEGAL.txt +20 -0
- package/package.json +34 -0
package/bin/planbee.js
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var bD=Object.create;var Vu=Object.defineProperty;var xD=Object.getOwnPropertyDescriptor;var vD=Object.getOwnPropertyNames;var wD=Object.getPrototypeOf,ED=Object.prototype.hasOwnProperty;var D=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var DD=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of vD(e))!ED.call(t,o)&&o!==n&&Vu(t,o,{get:()=>e[o],enumerable:!(s=xD(e,o))||s.enumerable});return t};var Xo=(t,e,n)=>(n=t!=null?bD(wD(t)):{},DD(e||!t||!t.__esModule?Vu(n,"default",{value:t,enumerable:!0}):n,t));var Qu=D((qB,Xu)=>{var Yu=require("stream").Stream,SD=require("util");Xu.exports=St;function St(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}SD.inherits(St,Yu);St.create=function(t,e){var n=new this;e=e||{};for(var s in e)n[s]=e[s];n.source=t;var o=t.emit;return t.emit=function(){return n._handleEmit(arguments),o.apply(t,arguments)},t.on("error",function(){}),n.pauseStream&&t.pause(),n};Object.defineProperty(St.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}});St.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};St.prototype.resume=function(){this._released||this.release(),this.source.resume()};St.prototype.pause=function(){this.source.pause()};St.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this)),this._bufferedEvents=[]};St.prototype.pipe=function(){var t=Yu.prototype.pipe.apply(this,arguments);return this.resume(),t};St.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}t[0]==="data"&&(this.dataSize+=t[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(t)};St.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(t))}}});var np=D((MB,tp)=>{var kD=require("util"),ep=require("stream").Stream,Zu=Qu();tp.exports=Ce;function Ce(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}kD.inherits(Ce,ep);Ce.create=function(t){var e=new this;t=t||{};for(var n in t)e[n]=t[n];return e};Ce.isStreamLike=function(t){return typeof t!="function"&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"&&!Buffer.isBuffer(t)};Ce.prototype.append=function(t){var e=Ce.isStreamLike(t);if(e){if(!(t instanceof Zu)){var n=Zu.create(t,{maxDataSize:1/0,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this)),t=n}this._handleErrors(t),this.pauseStreams&&t.pause()}return this._streams.push(t),this};Ce.prototype.pipe=function(t,e){return ep.prototype.pipe.call(this,t,e),this.resume(),t};Ce.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};Ce.prototype._realGetNext=function(){var t=this._streams.shift();if(typeof t>"u"){this.end();return}if(typeof t!="function"){this._pipeNext(t);return}var e=t;e(function(n){var s=Ce.isStreamLike(n);s&&(n.on("data",this._checkDataSize.bind(this)),this._handleErrors(n)),this._pipeNext(n)}.bind(this))};Ce.prototype._pipeNext=function(t){this._currentStream=t;var e=Ce.isStreamLike(t);if(e){t.on("end",this._getNext.bind(this)),t.pipe(this,{end:!1});return}var n=t;this.write(n),this._getNext()};Ce.prototype._handleErrors=function(t){var e=this;t.on("error",function(n){e._emitError(n)})};Ce.prototype.write=function(t){this.emit("data",t)};Ce.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};Ce.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};Ce.prototype.end=function(){this._reset(),this.emit("end")};Ce.prototype.destroy=function(){this._reset(),this.emit("close")};Ce.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};Ce.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(t))}};Ce.prototype._updateDataSize=function(){this.dataSize=0;var t=this;this._streams.forEach(function(e){e.dataSize&&(t.dataSize+=e.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};Ce.prototype._emitError=function(t){this._reset(),this.emit("error",t)}});var sp=D((UB,AD)=>{AD.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}});var rp=D((HB,op)=>{op.exports=sp()});var cp=D(tt=>{"use strict";var Qo=rp(),_D=require("path").extname,ip=/^\s*([^;\s]*)(?:;|\s|$)/,CD=/^text\//i;tt.charset=ap;tt.charsets={lookup:ap};tt.contentType=OD;tt.extension=TD;tt.extensions=Object.create(null);tt.lookup=PD;tt.types=Object.create(null);$D(tt.extensions,tt.types);function ap(t){if(!t||typeof t!="string")return!1;var e=ip.exec(t),n=e&&Qo[e[1].toLowerCase()];return n&&n.charset?n.charset:e&&CD.test(e[1])?"UTF-8":!1}function OD(t){if(!t||typeof t!="string")return!1;var e=t.indexOf("/")===-1?tt.lookup(t):t;if(!e)return!1;if(e.indexOf("charset")===-1){var n=tt.charset(e);n&&(e+="; charset="+n.toLowerCase())}return e}function TD(t){if(!t||typeof t!="string")return!1;var e=ip.exec(t),n=e&&tt.extensions[e[1].toLowerCase()];return!n||!n.length?!1:n[0]}function PD(t){if(!t||typeof t!="string")return!1;var e=_D("x."+t).toLowerCase().substr(1);return e&&tt.types[e]||!1}function $D(t,e){var n=["nginx","apache",void 0,"iana"];Object.keys(Qo).forEach(function(o){var r=Qo[o],i=r.extensions;if(!(!i||!i.length)){t[o]=i;for(var a=0;a<i.length;a++){var c=i[a];if(e[c]){var l=n.indexOf(Qo[e[c]].source),u=n.indexOf(r.source);if(e[c]!=="application/octet-stream"&&(l>u||l===u&&e[c].substr(0,12)==="application/"))continue}e[c]=o}}})}});var up=D((WB,lp)=>{lp.exports=ND;function ND(t){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;e?e(t):setTimeout(t,0)}});var Li=D((JB,dp)=>{var pp=up();dp.exports=ID;function ID(t){var e=!1;return pp(function(){e=!0}),function(s,o){e?t(s,o):pp(function(){t(s,o)})}}});var Bi=D((KB,fp)=>{fp.exports=RD;function RD(t){Object.keys(t.jobs).forEach(FD.bind(t)),t.jobs={}}function FD(t){typeof this.jobs[t]=="function"&&this.jobs[t]()}});var qi=D((GB,hp)=>{var mp=Li(),jD=Bi();hp.exports=LD;function LD(t,e,n,s){var o=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[o]=BD(e,o,t[o],function(r,i){o in n.jobs&&(delete n.jobs[o],r?jD(n):n.results[o]=i,s(r,n.results))})}function BD(t,e,n,s){var o;return t.length==2?o=t(n,mp(s)):o=t(n,e,mp(s)),o}});var Mi=D((VB,gp)=>{gp.exports=qD;function qD(t,e){var n=!Array.isArray(t),s={index:0,keyedList:n||e?Object.keys(t):null,jobs:{},results:n?{}:[],size:n?Object.keys(t).length:t.length};return e&&s.keyedList.sort(n?e:function(o,r){return e(t[o],t[r])}),s}});var Ui=D((YB,yp)=>{var MD=Bi(),UD=Li();yp.exports=HD;function HD(t){Object.keys(this.jobs).length&&(this.index=this.size,MD(this),UD(t)(null,this.results))}});var xp=D((XB,bp)=>{var zD=qi(),WD=Mi(),JD=Ui();bp.exports=KD;function KD(t,e,n){for(var s=WD(t);s.index<(s.keyedList||t).length;)zD(t,e,s,function(o,r){if(o){n(o,r);return}if(Object.keys(s.jobs).length===0){n(null,s.results);return}}),s.index++;return JD.bind(s,n)}});var Hi=D((QB,Zo)=>{var vp=qi(),GD=Mi(),VD=Ui();Zo.exports=YD;Zo.exports.ascending=wp;Zo.exports.descending=XD;function YD(t,e,n,s){var o=GD(t,n);return vp(t,e,o,function r(i,a){if(i){s(i,a);return}if(o.index++,o.index<(o.keyedList||t).length){vp(t,e,o,r);return}s(null,o.results)}),VD.bind(o,s)}function wp(t,e){return t<e?-1:t>e?1:0}function XD(t,e){return-1*wp(t,e)}});var Dp=D((ZB,Ep)=>{var QD=Hi();Ep.exports=ZD;function ZD(t,e,n){return QD(t,e,null,n)}});var kp=D((eq,Sp)=>{Sp.exports={parallel:xp(),serial:Dp(),serialOrdered:Hi()}});var zi=D((tq,Ap)=>{"use strict";Ap.exports=Object});var Cp=D((nq,_p)=>{"use strict";_p.exports=Error});var Tp=D((sq,Op)=>{"use strict";Op.exports=EvalError});var $p=D((oq,Pp)=>{"use strict";Pp.exports=RangeError});var Ip=D((rq,Np)=>{"use strict";Np.exports=ReferenceError});var Fp=D((iq,Rp)=>{"use strict";Rp.exports=SyntaxError});var er=D((aq,jp)=>{"use strict";jp.exports=TypeError});var Bp=D((cq,Lp)=>{"use strict";Lp.exports=URIError});var Mp=D((lq,qp)=>{"use strict";qp.exports=Math.abs});var Hp=D((uq,Up)=>{"use strict";Up.exports=Math.floor});var Wp=D((pq,zp)=>{"use strict";zp.exports=Math.max});var Kp=D((dq,Jp)=>{"use strict";Jp.exports=Math.min});var Vp=D((fq,Gp)=>{"use strict";Gp.exports=Math.pow});var Xp=D((mq,Yp)=>{"use strict";Yp.exports=Math.round});var Zp=D((hq,Qp)=>{"use strict";Qp.exports=Number.isNaN||function(e){return e!==e}});var td=D((gq,ed)=>{"use strict";var eS=Zp();ed.exports=function(e){return eS(e)||e===0?e:e<0?-1:1}});var sd=D((yq,nd)=>{"use strict";nd.exports=Object.getOwnPropertyDescriptor});var Wi=D((bq,od)=>{"use strict";var tr=sd();if(tr)try{tr([],"length")}catch{tr=null}od.exports=tr});var id=D((xq,rd)=>{"use strict";var nr=Object.defineProperty||!1;if(nr)try{nr({},"a",{value:1})}catch{nr=!1}rd.exports=nr});var Ji=D((vq,ad)=>{"use strict";ad.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),s=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(var r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var i=Object.getOwnPropertySymbols(e);if(i.length!==1||i[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,n);if(a.value!==o||a.enumerable!==!0)return!1}return!0}});var ud=D((wq,ld)=>{"use strict";var cd=typeof Symbol<"u"&&Symbol,tS=Ji();ld.exports=function(){return typeof cd!="function"||typeof Symbol!="function"||typeof cd("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:tS()}});var Ki=D((Eq,pd)=>{"use strict";pd.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Gi=D((Dq,dd)=>{"use strict";var nS=zi();dd.exports=nS.getPrototypeOf||null});var hd=D((Sq,md)=>{"use strict";var sS="Function.prototype.bind called on incompatible ",oS=Object.prototype.toString,rS=Math.max,iS="[object Function]",fd=function(e,n){for(var s=[],o=0;o<e.length;o+=1)s[o]=e[o];for(var r=0;r<n.length;r+=1)s[r+e.length]=n[r];return s},aS=function(e,n){for(var s=[],o=n||0,r=0;o<e.length;o+=1,r+=1)s[r]=e[o];return s},cS=function(t,e){for(var n="",s=0;s<t.length;s+=1)n+=t[s],s+1<t.length&&(n+=e);return n};md.exports=function(e){var n=this;if(typeof n!="function"||oS.apply(n)!==iS)throw new TypeError(sS+n);for(var s=aS(arguments,1),o,r=function(){if(this instanceof o){var u=n.apply(this,fd(s,arguments));return Object(u)===u?u:this}return n.apply(e,fd(s,arguments))},i=rS(0,n.length-s.length),a=[],c=0;c<i;c++)a[c]="$"+c;if(o=Function("binder","return function ("+cS(a,",")+"){ return binder.apply(this,arguments); }")(r),n.prototype){var l=function(){};l.prototype=n.prototype,o.prototype=new l,l.prototype=null}return o}});var js=D((kq,gd)=>{"use strict";var lS=hd();gd.exports=Function.prototype.bind||lS});var sr=D((Aq,yd)=>{"use strict";yd.exports=Function.prototype.call});var Vi=D((_q,bd)=>{"use strict";bd.exports=Function.prototype.apply});var vd=D((Cq,xd)=>{"use strict";xd.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Ed=D((Oq,wd)=>{"use strict";var uS=js(),pS=Vi(),dS=sr(),fS=vd();wd.exports=fS||uS.call(dS,pS)});var Sd=D((Tq,Dd)=>{"use strict";var mS=js(),hS=er(),gS=sr(),yS=Ed();Dd.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new hS("a function is required");return yS(mS,gS,e)}});var Td=D((Pq,Od)=>{"use strict";var bS=Sd(),kd=Wi(),_d;try{_d=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var Yi=!!_d&&kd&&kd(Object.prototype,"__proto__"),Cd=Object,Ad=Cd.getPrototypeOf;Od.exports=Yi&&typeof Yi.get=="function"?bS([Yi.get]):typeof Ad=="function"?function(e){return Ad(e==null?e:Cd(e))}:!1});var Rd=D(($q,Id)=>{"use strict";var Pd=Ki(),$d=Gi(),Nd=Td();Id.exports=Pd?function(e){return Pd(e)}:$d?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return $d(e)}:Nd?function(e){return Nd(e)}:null});var or=D((Nq,Fd)=>{"use strict";var xS=Function.prototype.call,vS=Object.prototype.hasOwnProperty,wS=js();Fd.exports=wS.call(xS,vS)});var Hd=D((Iq,Ud)=>{"use strict";var ue,ES=zi(),DS=Cp(),SS=Tp(),kS=$p(),AS=Ip(),ss=Fp(),ns=er(),_S=Bp(),CS=Mp(),OS=Hp(),TS=Wp(),PS=Kp(),$S=Vp(),NS=Xp(),IS=td(),qd=Function,Xi=function(t){try{return qd('"use strict"; return ('+t+").constructor;")()}catch{}},Ls=Wi(),RS=id(),Qi=function(){throw new ns},FS=Ls?function(){try{return arguments.callee,Qi}catch{try{return Ls(arguments,"callee").get}catch{return Qi}}}():Qi,es=ud()(),Je=Rd(),jS=Gi(),LS=Ki(),Md=Vi(),Bs=sr(),ts={},BS=typeof Uint8Array>"u"||!Je?ue:Je(Uint8Array),vn={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ue:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ue:ArrayBuffer,"%ArrayIteratorPrototype%":es&&Je?Je([][Symbol.iterator]()):ue,"%AsyncFromSyncIteratorPrototype%":ue,"%AsyncFunction%":ts,"%AsyncGenerator%":ts,"%AsyncGeneratorFunction%":ts,"%AsyncIteratorPrototype%":ts,"%Atomics%":typeof Atomics>"u"?ue:Atomics,"%BigInt%":typeof BigInt>"u"?ue:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ue:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ue:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ue:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":DS,"%eval%":eval,"%EvalError%":SS,"%Float16Array%":typeof Float16Array>"u"?ue:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ue:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ue:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ue:FinalizationRegistry,"%Function%":qd,"%GeneratorFunction%":ts,"%Int8Array%":typeof Int8Array>"u"?ue:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ue:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ue:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":es&&Je?Je(Je([][Symbol.iterator]())):ue,"%JSON%":typeof JSON=="object"?JSON:ue,"%Map%":typeof Map>"u"?ue:Map,"%MapIteratorPrototype%":typeof Map>"u"||!es||!Je?ue:Je(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":ES,"%Object.getOwnPropertyDescriptor%":Ls,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ue:Promise,"%Proxy%":typeof Proxy>"u"?ue:Proxy,"%RangeError%":kS,"%ReferenceError%":AS,"%Reflect%":typeof Reflect>"u"?ue:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ue:Set,"%SetIteratorPrototype%":typeof Set>"u"||!es||!Je?ue:Je(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ue:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":es&&Je?Je(""[Symbol.iterator]()):ue,"%Symbol%":es?Symbol:ue,"%SyntaxError%":ss,"%ThrowTypeError%":FS,"%TypedArray%":BS,"%TypeError%":ns,"%Uint8Array%":typeof Uint8Array>"u"?ue:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ue:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ue:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ue:Uint32Array,"%URIError%":_S,"%WeakMap%":typeof WeakMap>"u"?ue:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ue:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ue:WeakSet,"%Function.prototype.call%":Bs,"%Function.prototype.apply%":Md,"%Object.defineProperty%":RS,"%Object.getPrototypeOf%":jS,"%Math.abs%":CS,"%Math.floor%":OS,"%Math.max%":TS,"%Math.min%":PS,"%Math.pow%":$S,"%Math.round%":NS,"%Math.sign%":IS,"%Reflect.getPrototypeOf%":LS};if(Je)try{null.error}catch(t){jd=Je(Je(t)),vn["%Error.prototype%"]=jd}var jd,qS=function t(e){var n;if(e==="%AsyncFunction%")n=Xi("async function () {}");else if(e==="%GeneratorFunction%")n=Xi("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=Xi("async function* () {}");else if(e==="%AsyncGenerator%"){var s=t("%AsyncGeneratorFunction%");s&&(n=s.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&Je&&(n=Je(o.prototype))}return vn[e]=n,n},Ld={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},qs=js(),rr=or(),MS=qs.call(Bs,Array.prototype.concat),US=qs.call(Md,Array.prototype.splice),Bd=qs.call(Bs,String.prototype.replace),ir=qs.call(Bs,String.prototype.slice),HS=qs.call(Bs,RegExp.prototype.exec),zS=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,WS=/\\(\\)?/g,JS=function(e){var n=ir(e,0,1),s=ir(e,-1);if(n==="%"&&s!=="%")throw new ss("invalid intrinsic syntax, expected closing `%`");if(s==="%"&&n!=="%")throw new ss("invalid intrinsic syntax, expected opening `%`");var o=[];return Bd(e,zS,function(r,i,a,c){o[o.length]=a?Bd(c,WS,"$1"):i||r}),o},KS=function(e,n){var s=e,o;if(rr(Ld,s)&&(o=Ld[s],s="%"+o[0]+"%"),rr(vn,s)){var r=vn[s];if(r===ts&&(r=qS(s)),typeof r>"u"&&!n)throw new ns("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:s,value:r}}throw new ss("intrinsic "+e+" does not exist!")};Ud.exports=function(e,n){if(typeof e!="string"||e.length===0)throw new ns("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new ns('"allowMissing" argument must be a boolean');if(HS(/^%?[^%]*%?$/,e)===null)throw new ss("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=JS(e),o=s.length>0?s[0]:"",r=KS("%"+o+"%",n),i=r.name,a=r.value,c=!1,l=r.alias;l&&(o=l[0],US(s,MS([0,1],l)));for(var u=1,p=!0;u<s.length;u+=1){var d=s[u],f=ir(d,0,1),m=ir(d,-1);if((f==='"'||f==="'"||f==="`"||m==='"'||m==="'"||m==="`")&&f!==m)throw new ss("property names with quotes must have matching quotes");if((d==="constructor"||!p)&&(c=!0),o+="."+d,i="%"+o+"%",rr(vn,i))a=vn[i];else if(a!=null){if(!(d in a)){if(!n)throw new ns("base intrinsic for "+e+" exists, but the property is not available.");return}if(Ls&&u+1>=s.length){var h=Ls(a,d);p=!!h,p&&"get"in h&&!("originalValue"in h.get)?a=h.get:a=a[d]}else p=rr(a,d),a=a[d];p&&!c&&(vn[i]=a)}}return a}});var Wd=D((Rq,zd)=>{"use strict";var GS=Ji();zd.exports=function(){return GS()&&!!Symbol.toStringTag}});var Gd=D((Fq,Kd)=>{"use strict";var VS=Hd(),Jd=VS("%Object.defineProperty%",!0),YS=Wd()(),XS=or(),QS=er(),ar=YS?Symbol.toStringTag:null;Kd.exports=function(e,n){var s=arguments.length>2&&!!arguments[2]&&arguments[2].force,o=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof s<"u"&&typeof s!="boolean"||typeof o<"u"&&typeof o!="boolean")throw new QS("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");ar&&(s||!XS(e,ar))&&(Jd?Jd(e,ar,{configurable:!o,enumerable:!1,value:n,writable:!1}):e[ar]=n)}});var Yd=D((jq,Vd)=>{"use strict";Vd.exports=function(t,e){return Object.keys(e).forEach(function(n){t[n]=t[n]||e[n]}),t}});var Zd=D((Lq,Qd)=>{"use strict";var na=np(),ZS=require("util"),Zi=require("path"),ek=require("http"),tk=require("https"),nk=require("url").parse,sk=require("fs"),ok=require("stream").Stream,rk=require("crypto"),ea=cp(),ik=kp(),ak=Gd(),cn=or(),ta=Yd();function Xd(t){return String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}function he(t){if(!(this instanceof he))return new he(t);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],na.call(this),t=t||{};for(var e in t)this[e]=t[e]}ZS.inherits(he,na);he.LINE_BREAK=`\r
|
|
3
|
+
`;he.DEFAULT_CONTENT_TYPE="application/octet-stream";he.prototype.append=function(t,e,n){n=n||{},typeof n=="string"&&(n={filename:n});var s=na.prototype.append.bind(this);if((typeof e=="number"||e==null)&&(e=String(e)),Array.isArray(e)){this._error(new Error("Arrays are not supported."));return}var o=this._multiPartHeader(t,e,n),r=this._multiPartFooter();s(o),s(e),s(r),this._trackLength(o,e,n)};he.prototype._trackLength=function(t,e,n){var s=0;n.knownLength!=null?s+=Number(n.knownLength):Buffer.isBuffer(e)?s=e.length:typeof e=="string"&&(s=Buffer.byteLength(e)),this._valueLength+=s,this._overheadLength+=Buffer.byteLength(t)+he.LINE_BREAK.length,!(!e||!e.path&&!(e.readable&&cn(e,"httpVersion"))&&!(e instanceof ok))&&(n.knownLength||this._valuesToMeasure.push(e))};he.prototype._lengthRetriever=function(t,e){cn(t,"fd")?t.end!=null&&t.end!=1/0&&t.start!=null?e(null,t.end+1-(t.start?t.start:0)):sk.stat(t.path,function(n,s){if(n){e(n);return}var o=s.size-(t.start?t.start:0);e(null,o)}):cn(t,"httpVersion")?e(null,Number(t.headers["content-length"])):cn(t,"httpModule")?(t.on("response",function(n){t.pause(),e(null,Number(n.headers["content-length"]))}),t.resume()):e("Unknown stream")};he.prototype._multiPartHeader=function(t,e,n){if(typeof n.header=="string")return n.header;var s=this._getContentDisposition(e,n),o=this._getContentType(e,n),r="",i={"Content-Disposition":["form-data",'name="'+Xd(t)+'"'].concat(s||[]),"Content-Type":[].concat(o||[])};typeof n.header=="object"&&ta(i,n.header);var a;for(var c in i)if(cn(i,c)){if(a=i[c],a==null)continue;Array.isArray(a)||(a=[a]),a.length&&(r+=c+": "+a.join("; ")+he.LINE_BREAK)}return"--"+this.getBoundary()+he.LINE_BREAK+r+he.LINE_BREAK};he.prototype._getContentDisposition=function(t,e){var n;if(typeof e.filepath=="string"?n=Zi.normalize(e.filepath).replace(/\\/g,"/"):e.filename||t&&(t.name||t.path)?n=Zi.basename(e.filename||t&&(t.name||t.path)):t&&t.readable&&cn(t,"httpVersion")&&(n=Zi.basename(t.client._httpMessage.path||"")),n)return'filename="'+Xd(n)+'"'};he.prototype._getContentType=function(t,e){var n=e.contentType;return!n&&t&&t.name&&(n=ea.lookup(t.name)),!n&&t&&t.path&&(n=ea.lookup(t.path)),!n&&t&&t.readable&&cn(t,"httpVersion")&&(n=t.headers["content-type"]),!n&&(e.filepath||e.filename)&&(n=ea.lookup(e.filepath||e.filename)),!n&&t&&typeof t=="object"&&(n=he.DEFAULT_CONTENT_TYPE),n};he.prototype._multiPartFooter=function(){return function(t){var e=he.LINE_BREAK,n=this._streams.length===0;n&&(e+=this._lastBoundary()),t(e)}.bind(this)};he.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+he.LINE_BREAK};he.prototype.getHeaders=function(t){var e,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t)cn(t,e)&&(n[e.toLowerCase()]=t[e]);return n};he.prototype.setBoundary=function(t){if(typeof t!="string")throw new TypeError("FormData boundary must be a string");this._boundary=t};he.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};he.prototype.getBuffer=function(){for(var t=new Buffer.alloc(0),e=this.getBoundary(),n=0,s=this._streams.length;n<s;n++)typeof this._streams[n]!="function"&&(Buffer.isBuffer(this._streams[n])?t=Buffer.concat([t,this._streams[n]]):t=Buffer.concat([t,Buffer.from(this._streams[n])]),(typeof this._streams[n]!="string"||this._streams[n].substring(2,e.length+2)!==e)&&(t=Buffer.concat([t,Buffer.from(he.LINE_BREAK)])));return Buffer.concat([t,Buffer.from(this._lastBoundary())])};he.prototype._generateBoundary=function(){this._boundary="--------------------------"+rk.randomBytes(12).toString("hex")};he.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;return this._streams.length&&(t+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),t};he.prototype.hasKnownLength=function(){var t=!0;return this._valuesToMeasure.length&&(t=!1),t};he.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length&&(e+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(t.bind(this,null,e));return}ik.parallel(this._valuesToMeasure,this._lengthRetriever,function(n,s){if(n){t(n);return}s.forEach(function(o){e+=o}),t(null,e)})};he.prototype.submit=function(t,e){var n,s,o={method:"post"};return typeof t=="string"?(t=nk(t),s=ta({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},o)):(s=ta(t,o),s.port||(s.port=s.protocol==="https:"?443:80)),s.headers=this.getHeaders(t.headers),s.protocol==="https:"?n=tk.request(s):n=ek.request(s),this.getLength(function(r,i){if(r&&r!=="Unknown stream"){this._error(r);return}if(i&&n.setHeader("Content-Length",i),this.pipe(n),e){var a,c=function(l,u){return n.removeListener("error",c),n.removeListener("response",a),e.call(this,l,u)};a=c.bind(this,null),n.on("error",c),n.on("response",a)}}.bind(this)),n};he.prototype._error=function(t){this.error||(this.error=t,this.pause(),this.emit("error",t))};he.prototype.toString=function(){return"[object FormData]"};ak(he.prototype,"FormData");Qd.exports=he});var tf=D((Bq,ef)=>{var os=1e3,rs=os*60,is=rs*60,wn=is*24,ck=wn*7,lk=wn*365.25;ef.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return uk(t);if(n==="number"&&isFinite(t))return e.long?dk(t):pk(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function uk(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),s=(e[2]||"ms").toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return n*lk;case"weeks":case"week":case"w":return n*ck;case"days":case"day":case"d":return n*wn;case"hours":case"hour":case"hrs":case"hr":case"h":return n*is;case"minutes":case"minute":case"mins":case"min":case"m":return n*rs;case"seconds":case"second":case"secs":case"sec":case"s":return n*os;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function pk(t){var e=Math.abs(t);return e>=wn?Math.round(t/wn)+"d":e>=is?Math.round(t/is)+"h":e>=rs?Math.round(t/rs)+"m":e>=os?Math.round(t/os)+"s":t+"ms"}function dk(t){var e=Math.abs(t);return e>=wn?cr(t,e,wn,"day"):e>=is?cr(t,e,is,"hour"):e>=rs?cr(t,e,rs,"minute"):e>=os?cr(t,e,os,"second"):t+" ms"}function cr(t,e,n,s){var o=e>=n*1.5;return Math.round(t/n)+" "+s+(o?"s":"")}});var sa=D((qq,nf)=>{function fk(t){n.debug=n,n.default=n,n.coerce=c,n.disable=i,n.enable=o,n.enabled=a,n.humanize=tf(),n.destroy=l,Object.keys(t).forEach(u=>{n[u]=t[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let p=0;for(let d=0;d<u.length;d++)p=(p<<5)-p+u.charCodeAt(d),p|=0;return n.colors[Math.abs(p)%n.colors.length]}n.selectColor=e;function n(u){let p,d=null,f,m;function h(...g){if(!h.enabled)return;let b=h,v=Number(new Date),E=v-(p||v);b.diff=E,b.prev=p,b.curr=v,p=v,g[0]=n.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let S=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(B,L)=>{if(B==="%%")return"%";S++;let $=n.formatters[L];if(typeof $=="function"){let I=g[S];B=$.call(b,I),g.splice(S,1),S--}return B}),n.formatArgs.call(b,g),(b.log||n.log).apply(b,g)}return h.namespace=u,h.useColors=n.useColors(),h.color=n.selectColor(u),h.extend=s,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(f!==n.namespaces&&(f=n.namespaces,m=n.enabled(u)),m),set:g=>{d=g}}),typeof n.init=="function"&&n.init(h),h}function s(u,p){let d=n(this.namespace+(typeof p>"u"?":":p)+u);return d.log=this.log,d}function o(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let p=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of p)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function r(u,p){let d=0,f=0,m=-1,h=0;for(;d<u.length;)if(f<p.length&&(p[f]===u[d]||p[f]==="*"))p[f]==="*"?(m=f,h=d,f++):(d++,f++);else if(m!==-1)f=m+1,h++,d=h;else return!1;for(;f<p.length&&p[f]==="*";)f++;return f===p.length}function i(){let u=[...n.names,...n.skips.map(p=>"-"+p)].join(",");return n.enable(""),u}function a(u){for(let p of n.skips)if(r(u,p))return!1;for(let p of n.names)if(r(u,p))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}nf.exports=fk});var sf=D((nt,lr)=>{nt.formatArgs=hk;nt.save=gk;nt.load=yk;nt.useColors=mk;nt.storage=bk();nt.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();nt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function mk(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function hk(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+lr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,s=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(n++,o==="%c"&&(s=n))}),t.splice(s,0,e)}nt.log=console.debug||console.log||(()=>{});function gk(t){try{t?nt.storage.setItem("debug",t):nt.storage.removeItem("debug")}catch{}}function yk(){let t;try{t=nt.storage.getItem("debug")||nt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function bk(){try{return localStorage}catch{}}lr.exports=sa()(nt);var{formatters:xk}=lr.exports;xk.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var rf=D((Ke,pr)=>{var vk=require("tty"),ur=require("util");Ke.init=_k;Ke.log=Sk;Ke.formatArgs=Ek;Ke.save=kk;Ke.load=Ak;Ke.useColors=wk;Ke.destroy=ur.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Ke.colors=[6,2,3,4,5,1];try{let t=require("supports-color");t&&(t.stderr||t).level>=2&&(Ke.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}Ke.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,r)=>r.toUpperCase()),s=process.env[e];return/^(yes|on|true|enabled)$/i.test(s)?s=!0:/^(no|off|false|disabled)$/i.test(s)?s=!1:s==="null"?s=null:s=Number(s),t[n]=s,t},{});function wk(){return"colors"in Ke.inspectOpts?!!Ke.inspectOpts.colors:vk.isatty(process.stderr.fd)}function Ek(t){let{namespace:e,useColors:n}=this;if(n){let s=this.color,o="\x1B[3"+(s<8?s:"8;5;"+s),r=` ${o};1m${e} \x1B[0m`;t[0]=r+t[0].split(`
|
|
4
|
+
`).join(`
|
|
5
|
+
`+r),t.push(o+"m+"+pr.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Dk()+e+" "+t[0]}function Dk(){return Ke.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Sk(...t){return process.stderr.write(ur.formatWithOptions(Ke.inspectOpts,...t)+`
|
|
6
|
+
`)}function kk(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function Ak(){return process.env.DEBUG}function _k(t){t.inspectOpts={};let e=Object.keys(Ke.inspectOpts);for(let n=0;n<e.length;n++)t.inspectOpts[e[n]]=Ke.inspectOpts[e[n]]}pr.exports=sa()(Ke);var{formatters:of}=pr.exports;of.o=function(t){return this.inspectOpts.colors=this.useColors,ur.inspect(t,this.inspectOpts).split(`
|
|
7
|
+
`).map(e=>e.trim()).join(" ")};of.O=function(t){return this.inspectOpts.colors=this.useColors,ur.inspect(t,this.inspectOpts)}});var Ms=D((Mq,oa)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?oa.exports=sf():oa.exports=rf()});var af=D(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});function Ck(t){return function(e,n){return new Promise((s,o)=>{t.call(this,e,n,(r,i)=>{r?o(r):s(i)})})}}ra.default=Ck});var uf=D((aa,lf)=>{"use strict";var cf=aa&&aa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},Ok=require("events"),Tk=cf(Ms()),Pk=cf(af()),Us=Tk.default("agent-base");function $k(t){return!!t&&typeof t.addRequest=="function"}function ia(){let{stack:t}=new Error;return typeof t!="string"?!1:t.split(`
|
|
8
|
+
`).some(e=>e.indexOf("(https.js:")!==-1||e.indexOf("node:https:")!==-1)}function dr(t,e){return new dr.Agent(t,e)}(function(t){class e extends Ok.EventEmitter{constructor(s,o){super();let r=o;typeof s=="function"?this.callback=s:s&&(r=s),this.timeout=null,r&&typeof r.timeout=="number"&&(this.timeout=r.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:ia()?443:80}set defaultPort(s){this.explicitDefaultPort=s}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:ia()?"https:":"http:"}set protocol(s){this.explicitProtocol=s}callback(s,o,r){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(s,o){let r=Object.assign({},o);typeof r.secureEndpoint!="boolean"&&(r.secureEndpoint=ia()),r.host==null&&(r.host="localhost"),r.port==null&&(r.port=r.secureEndpoint?443:80),r.protocol==null&&(r.protocol=r.secureEndpoint?"https:":"http:"),r.host&&r.path&&delete r.path,delete r.agent,delete r.hostname,delete r._defaultAgent,delete r.defaultPort,delete r.createConnection,s._last=!0,s.shouldKeepAlive=!1;let i=!1,a=null,c=r.timeout||this.timeout,l=f=>{s._hadError||(s.emit("error",f),s._hadError=!0)},u=()=>{a=null,i=!0;let f=new Error(`A "socket" was not created for HTTP request before ${c}ms`);f.code="ETIMEOUT",l(f)},p=f=>{i||(a!==null&&(clearTimeout(a),a=null),l(f))},d=f=>{if(i)return;if(a!=null&&(clearTimeout(a),a=null),$k(f)){Us("Callback returned another Agent instance %o",f.constructor.name),f.addRequest(s,r);return}if(f){f.once("free",()=>{this.freeSocket(f,r)}),s.onSocket(f);return}let m=new Error(`no Duplex stream was returned to agent-base for \`${s.method} ${s.path}\``);l(m)};if(typeof this.callback!="function"){l(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(Us("Converting legacy callback function to promise"),this.promisifiedCallback=Pk.default(this.callback)):this.promisifiedCallback=this.callback),typeof c=="number"&&c>0&&(a=setTimeout(u,c)),"port"in r&&typeof r.port!="number"&&(r.port=Number(r.port));try{Us("Resolving socket for %o request: %o",r.protocol,`${s.method} ${s.path}`),Promise.resolve(this.promisifiedCallback(s,r)).then(d,p)}catch(f){Promise.reject(f).catch(p)}}freeSocket(s,o){Us("Freeing socket %o %o",s.constructor.name,o),s.destroy()}destroy(){Us("Destroying agent %o",this.constructor.name)}}t.Agent=e,t.prototype=t.Agent.prototype})(dr||(dr={}));lf.exports=dr});var pf=D(zs=>{"use strict";var Nk=zs&&zs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zs,"__esModule",{value:!0});var Ik=Nk(Ms()),Hs=Ik.default("https-proxy-agent:parse-proxy-response");function Rk(t){return new Promise((e,n)=>{let s=0,o=[];function r(){let p=t.read();p?u(p):t.once("readable",r)}function i(){t.removeListener("end",c),t.removeListener("error",l),t.removeListener("close",a),t.removeListener("readable",r)}function a(p){Hs("onclose had error %o",p)}function c(){Hs("onend")}function l(p){i(),Hs("onerror %o",p),n(p)}function u(p){o.push(p),s+=p.length;let d=Buffer.concat(o,s);if(d.indexOf(`\r
|
|
9
|
+
\r
|
|
10
|
+
`)===-1){Hs("have not received end of HTTP headers yet..."),r();return}let m=d.toString("ascii",0,d.indexOf(`\r
|
|
11
|
+
`)),h=+m.split(" ")[1];Hs("got proxy server response: %o",m),e({statusCode:h,buffered:d})}t.on("error",l),t.on("close",a),t.on("end",c),r()})}zs.default=Rk});var mf=D(En=>{"use strict";var Fk=En&&En.__awaiter||function(t,e,n,s){function o(r){return r instanceof n?r:new n(function(i){i(r)})}return new(n||(n=Promise))(function(r,i){function a(u){try{l(s.next(u))}catch(p){i(p)}}function c(u){try{l(s.throw(u))}catch(p){i(p)}}function l(u){u.done?r(u.value):o(u.value).then(a,c)}l((s=s.apply(t,e||[])).next())})},as=En&&En.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(En,"__esModule",{value:!0});var df=as(require("net")),ff=as(require("tls")),jk=as(require("url")),Lk=as(require("assert")),Bk=as(Ms()),qk=uf(),Mk=as(pf()),Ws=Bk.default("https-proxy-agent:agent"),ca=class extends qk.Agent{constructor(e){let n;if(typeof e=="string"?n=jk.default.parse(e):n=e,!n)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");Ws("creating new HttpsProxyAgent instance: %o",n),super(n);let s=Object.assign({},n);this.secureProxy=n.secureProxy||zk(s.protocol),s.host=s.hostname||s.host,typeof s.port=="string"&&(s.port=parseInt(s.port,10)),!s.port&&s.host&&(s.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in s)&&(s.ALPNProtocols=["http 1.1"]),s.host&&s.path&&(delete s.path,delete s.pathname),this.proxy=s}callback(e,n){return Fk(this,void 0,void 0,function*(){let{proxy:s,secureProxy:o}=this,r;o?(Ws("Creating `tls.Socket`: %o",s),r=ff.default.connect(s)):(Ws("Creating `net.Socket`: %o",s),r=df.default.connect(s));let i=Object.assign({},s.headers),c=`CONNECT ${`${n.host}:${n.port}`} HTTP/1.1\r
|
|
12
|
+
`;s.auth&&(i["Proxy-Authorization"]=`Basic ${Buffer.from(s.auth).toString("base64")}`);let{host:l,port:u,secureEndpoint:p}=n;Hk(u,p)||(l+=`:${u}`),i.Host=l,i.Connection="close";for(let g of Object.keys(i))c+=`${g}: ${i[g]}\r
|
|
13
|
+
`;let d=Mk.default(r);r.write(`${c}\r
|
|
14
|
+
`);let{statusCode:f,buffered:m}=yield d;if(f===200){if(e.once("socket",Uk),n.secureEndpoint){Ws("Upgrading socket connection to TLS");let g=n.servername||n.host;return ff.default.connect(Object.assign(Object.assign({},Wk(n,"host","hostname","path","port")),{socket:r,servername:g}))}return r}r.destroy();let h=new df.default.Socket({writable:!1});return h.readable=!0,e.once("socket",g=>{Ws("replaying proxy buffer for failed request"),Lk.default(g.listenerCount("data")>0),g.push(m),g.push(null)}),h})}};En.default=ca;function Uk(t){t.resume()}function Hk(t,e){return!!(!e&&t===80||e&&t===443)}function zk(t){return typeof t=="string"?/^https:?$/i.test(t):!1}function Wk(t,...e){let n={},s;for(s in t)e.includes(s)||(n[s]=t[s]);return n}});var gf=D((pa,hf)=>{"use strict";var Jk=pa&&pa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},la=Jk(mf());function ua(t){return new la.default(t)}(function(t){t.HttpsProxyAgent=la.default,t.prototype=la.default.prototype})(ua||(ua={}));hf.exports=ua});var bf=D((Wq,yf)=>{var Js;yf.exports=function(){if(!Js){try{Js=Ms()("follow-redirects")}catch{}typeof Js!="function"&&(Js=function(){})}Js.apply(null,arguments)}});var Df=D((Jq,Da)=>{var Gs=require("url"),Ks=Gs.URL,Kk=require("http"),Gk=require("https"),ga=require("stream").Writable,ya=require("assert"),xf=bf();(function(){var e=typeof process<"u",n=typeof window<"u"&&typeof document<"u",s=Sn(Error.captureStackTrace);!e&&(n||!s)&&console.warn("The follow-redirects package should be excluded from browser builds.")})();var ba=!1;try{ya(new Ks(""))}catch(t){ba=t.code==="ERR_INVALID_URL"}var Vk=["Authorization","Proxy-Authorization","Cookie"],Yk=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],xa=["abort","aborted","connect","error","socket","timeout"],va=Object.create(null);xa.forEach(function(t){va[t]=function(e,n,s){this._redirectable.emit(t,e,n,s)}});var fa=Vs("ERR_INVALID_URL","Invalid URL",TypeError),ma=Vs("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Xk=Vs("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",ma),Qk=Vs("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Zk=Vs("ERR_STREAM_WRITE_AFTER_END","write after end"),eA=ga.prototype.destroy||wf;function st(t,e){ga.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var n=this;this._onNativeResponse=function(s){try{n._processResponse(s)}catch(o){n.emit("error",o instanceof ma?o:new ma({cause:o}))}},this._headerFilter=new RegExp("^(?:"+Vk.concat(t.sensitiveHeaders).map(iA).join("|")+")$","i"),this._performRequest()}st.prototype=Object.create(ga.prototype);st.prototype.abort=function(){Ea(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};st.prototype.destroy=function(t){return Ea(this._currentRequest,t),eA.call(this,t),this};st.prototype.write=function(t,e,n){if(this._ending)throw new Zk;if(!Dn(t)&&!oA(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(Sn(e)&&(n=e,e=null),t.length===0){n&&n();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,n)):(this.emit("error",new Qk),this.abort())};st.prototype.end=function(t,e,n){if(Sn(t)?(n=t,t=e=null):Sn(e)&&(n=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,n);else{var s=this,o=this._currentRequest;this.write(t,e,function(){s._ended=!0,o.end(null,null,n)}),this._ending=!0}};st.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)};st.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)};st.prototype.setTimeout=function(t,e){var n=this;function s(i){i.setTimeout(t),i.removeListener("timeout",i.destroy),i.addListener("timeout",i.destroy)}function o(i){n._timeout&&clearTimeout(n._timeout),n._timeout=setTimeout(function(){n.emit("timeout"),r()},t),s(i)}function r(){n._timeout&&(clearTimeout(n._timeout),n._timeout=null),n.removeListener("abort",r),n.removeListener("error",r),n.removeListener("response",r),n.removeListener("close",r),e&&n.removeListener("timeout",e),n.socket||n._currentRequest.removeListener("socket",o)}return e&&this.on("timeout",e),this.socket?o(this.socket):this._currentRequest.once("socket",o),this.on("socket",s),this.on("abort",r),this.on("error",r),this.on("response",r),this.on("close",r),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){st.prototype[t]=function(e,n){return this._currentRequest[t](e,n)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(st.prototype,t,{get:function(){return this._currentRequest[t]}})});st.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),sA(t.sensitiveHeaders)||(t.sensitiveHeaders=[]),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e))}};st.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e)throw new TypeError("Unsupported protocol "+t);if(this._options.agents){var n=t.slice(0,-1);this._options.agent=this._options.agents[n]}var s=this._currentRequest=e.request(this._options,this._onNativeResponse);s._redirectable=this;for(var o of xa)s.on(o,va[o]);if(this._currentUrl=/^\//.test(this._options.path)?Gs.format(this._options):this._options.path,this._isRedirect){var r=0,i=this,a=this._requestBodyBuffers;(function c(l){if(s===i._currentRequest)if(l)i.emit("error",l);else if(r<a.length){var u=a[r++];s.finished||s.write(u.data,u.encoding,c)}else i._ended&&s.end()})()}};st.prototype._processResponse=function(t){var e=t.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:e});var n=t.headers.location;if(!n||this._options.followRedirects===!1||e<300||e>=400){t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[];return}if(Ea(this._currentRequest),t.destroy(),++this._redirectCount>this._options.maxRedirects)throw new Xk;var s,o=this._options.beforeRedirect;o&&(s=Object.assign({Host:t.req.getHeader("host")},this._options.headers));var r=this._options.method;((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],da(/^content-/i,this._options.headers));var i=da(/^host$/i,this._options.headers),a=wa(this._currentUrl),c=i||a.host,l=/^\w+:/.test(n)?this._currentUrl:Gs.format(Object.assign(a,{host:c})),u=tA(n,l);if(xf("redirecting to",u.href),this._isRedirect=!0,ha(u,this._options),(u.protocol!==a.protocol&&u.protocol!=="https:"||u.host!==c&&!nA(u.host,c))&&da(this._headerFilter,this._options.headers),Sn(o)){var p={headers:t.headers,statusCode:e},d={url:l,method:r,headers:s};o(this._options,p,d),this._sanitizeOptions(this._options)}this._performRequest()};function vf(t){var e={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(t).forEach(function(s){var o=s+":",r=n[o]=t[s],i=e[s]=Object.create(r);function a(l,u,p){return rA(l)?l=ha(l):Dn(l)?l=ha(wa(l)):(p=u,u=Ef(l),l={protocol:o}),Sn(u)&&(p=u,u=null),u=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},l,u),u.nativeProtocols=n,!Dn(u.host)&&!Dn(u.hostname)&&(u.hostname="::1"),ya.equal(u.protocol,o,"protocol mismatch"),xf("options",u),new st(u,p)}function c(l,u,p){var d=i.request(l,u,p);return d.end(),d}Object.defineProperties(i,{request:{value:a,configurable:!0,enumerable:!0,writable:!0},get:{value:c,configurable:!0,enumerable:!0,writable:!0}})}),e}function wf(){}function wa(t){var e;if(ba)e=new Ks(t);else if(e=Ef(Gs.parse(t)),!Dn(e.protocol))throw new fa({input:t});return e}function tA(t,e){return ba?new Ks(t,e):wa(Gs.resolve(e,t))}function Ef(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname))throw new fa({input:t.href||t});if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host))throw new fa({input:t.href||t});return t}function ha(t,e){var n=e||{};for(var s of Yk)n[s]=t[s];return n.hostname.startsWith("[")&&(n.hostname=n.hostname.slice(1,-1)),n.port!==""&&(n.port=Number(n.port)),n.path=n.search?n.pathname+n.search:n.pathname,n}function da(t,e){var n;for(var s in e)t.test(s)&&(n=e[s],delete e[s]);return n===null||typeof n>"u"?void 0:String(n).trim()}function Vs(t,e,n){function s(o){Sn(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,o||{}),this.code=t,this.message=this.cause?e+": "+this.cause.message:e}return s.prototype=new(n||Error),Object.defineProperties(s.prototype,{constructor:{value:s,enumerable:!1},name:{value:"Error ["+t+"]",enumerable:!1}}),s}function Ea(t,e){for(var n of xa)t.removeListener(n,va[n]);t.on("error",wf),t.destroy(e)}function nA(t,e){ya(Dn(t)&&Dn(e));var n=t.length-e.length-1;return n>0&&t[n]==="."&&t.endsWith(e)}function sA(t){return t instanceof Array}function Dn(t){return typeof t=="string"||t instanceof String}function Sn(t){return typeof t=="function"}function oA(t){return typeof t=="object"&&"length"in t}function rA(t){return Ks&&t instanceof Ks}function iA(t){return t.replace(/[\]\\/()*+?.$]/g,"\\$&")}Da.exports=vf({http:Kk,https:Gk});Da.exports.wrap=vf});var de=D((Kq,Ym)=>{"use strict";var sm=Zd(),aA=require("crypto"),cA=require("url"),om=gf(),rm=require("http"),im=require("https"),am=require("http2"),Ha=require("util"),Sf=require("path"),lA=Df(),yt=require("zlib"),ot=require("stream"),uA=require("events");function cm(t,e){return function(){return t.apply(e,arguments)}}var{toString:pA}=Object.prototype,{getPrototypeOf:ln}=Object,{iterator:so,toStringTag:lm}=Symbol,Zs=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),um=t=>typeof t=="string"&&(t==="__proto__"||t==="constructor"||t==="prototype"),pm=(t,e,n)=>t===Object.prototype||!n&&e===null,dA=t=>{if(!Object.isExtensible(t))return!1;let e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&e.push(...Object.getOwnPropertySymbols(t)),e.every(n=>{if(um(n))return!1;let s=Object.getOwnPropertyDescriptor(t,n);return!!s&&s.configurable&&s.writable===!0})},eo=(t,e)=>{let n=t,s=[];for(;n!=null;){if(s.indexOf(n)!==-1)return!1;s.push(n);let o=ln(n);if(pm(n,o,n===t))return!1;if(Zs(n,e))return!0;n=o}return!1},fA=(t,e)=>t!=null&&eo(t,e)?t[e]:void 0,mA=t=>{if(t==null||typeof t!="object"&&typeof t!="function")return t;let e=ln(t);if(e===null&&dA(t))return t;let n=Object.create(null),s=Object.create(null),o=[],r=t;for(;r!=null&&o.indexOf(r)===-1;){o.push(r);let i=r===t?e:ln(r);if(pm(r,i,r===t))break;let a=Object.getOwnPropertyNames(r);Object.getOwnPropertySymbols&&a.push(...Object.getOwnPropertySymbols(r));for(let c of a)um(c)||Zs(s,c)||(n[c]=t[c],s[c]=!0);r=i}return n},za=(t=>e=>{let n=pA.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),bt=t=>(t=t.toLowerCase(),e=>za(e)===t),kr=t=>e=>typeof e===t,{isArray:_n}=Array,Cn=kr("undefined");function ps(t){return t!==null&&!Cn(t)&&t.constructor!==null&&!Cn(t.constructor)&&rt(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var dm=bt("ArrayBuffer");function hA(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&dm(t.buffer),e}var gA=kr("string"),rt=kr("function"),fm=kr("number"),ds=t=>t!==null&&typeof t=="object",yA=t=>t===!0||t===!1,mr=t=>{if(!ds(t))return!1;let e=ln(t);return(e===null||e===Object.prototype||ln(e)===null)&&!eo(t,lm)&&!eo(t,so)},bA=t=>{if(!ds(t)||ps(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},xA=bt("Date"),vA=bt("File"),wA=t=>!!(t&&typeof t.uri<"u"),EA=t=>t&&typeof t.getParts<"u",DA=bt("Blob"),SA=bt("FileList"),kA=bt("Set"),AA=t=>ds(t)&&rt(t.pipe);function _A(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}var kf=_A(),Af=typeof kf.FormData<"u"?kf.FormData:void 0,CA=t=>{if(!t)return!1;if(Af&&t instanceof Af)return!0;let e=ln(t);if(!e||e===Object.prototype||!rt(t.append))return!1;let n=za(t);return n==="formdata"||n==="object"&&rt(t.toString)&&t.toString()==="[object FormData]"},OA=bt("URLSearchParams"),[TA,PA,$A,NA]=["ReadableStream","Request","Response","Headers"].map(bt),IA=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function oo(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let s,o;if(typeof t!="object"&&(t=[t]),_n(t))for(s=0,o=t.length;s<o;s++)e.call(null,t[s],s,t);else{if(ps(t))return;let r=n?Object.getOwnPropertyNames(t):Object.keys(t),i=r.length,a;for(s=0;s<i;s++)a=r[s],e.call(null,t[a],a,t)}}function mm(t,e){if(ps(t))return null;e=e.toLowerCase();let n=Object.keys(t),s=n.length,o;for(;s-- >0;)if(o=n[s],e===o.toLowerCase())return o;return null}var kn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,hm=t=>!Cn(t)&&t!==kn;function Ra(...t){let{caseless:e,skipUndefined:n}=hm(this)&&this||{},s={},o=(r,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;let a=e&&typeof i=="string"&&mm(s,i)||i,c=Zs(s,a)?s[a]:void 0;mr(c)&&mr(r)?s[a]=Ra(c,r):mr(r)?s[a]=Ra({},r):_n(r)?s[a]=r.slice():(!n||!Cn(r))&&(s[a]=r)};for(let r=0,i=t.length;r<i;r++){let a=t[r];if(!a||ps(a)||(oo(a,o),typeof a!="object"||_n(a)))continue;let c=Object.getOwnPropertySymbols(a);for(let l=0;l<c.length;l++){let u=c[l];JA.call(a,u)&&o(a[u],u)}}return s}var RA=(t,e,n,{allOwnKeys:s}={})=>(oo(e,(o,r)=>{n&&rt(o)?Object.defineProperty(t,r,{__proto__:null,value:cm(o,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,r,{__proto__:null,value:o,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),t),FA=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),jA=(t,e,n,s)=>{t.prototype=Object.create(e.prototype,s),Object.defineProperty(t.prototype,"constructor",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{__proto__:null,value:e.prototype}),n&&Object.assign(t.prototype,n)},LA=(t,e,n,s)=>{let o,r,i,a={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),r=o.length;r-- >0;)i=o[r],(!s||s(i,t,e))&&!a[i]&&(e[i]=t[i],a[i]=!0);t=n!==!1&&ln(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},BA=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;let s=t.indexOf(e,n);return s!==-1&&s===n},qA=t=>{if(!t)return null;if(_n(t))return t;let e=t.length;if(!fm(e))return null;let n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},MA=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&ln(Uint8Array)),UA=(t,e)=>{let s=(t&&t[so]).call(t),o;for(;(o=s.next())&&!o.done;){let r=o.value;e.call(t,r[0],r[1])}},HA=(t,e)=>{let n,s=[];for(;(n=t.exec(e))!==null;)s.push(n);return s},zA=bt("HTMLFormElement"),WA=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,o){return s.toUpperCase()+o}),{propertyIsEnumerable:JA}=Object.prototype,KA=bt("RegExp"),gm=(t,e)=>{let n=Object.getOwnPropertyDescriptors(t),s={};oo(n,(o,r)=>{let i;(i=e(o,r,t))!==!1&&(s[r]=i||o)}),Object.defineProperties(t,s)},GA=t=>{gm(t,(e,n)=>{if(rt(t)&&["arguments","caller","callee"].includes(n))return!1;let s=t[n];if(rt(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},VA=(t,e)=>{let n={},s=o=>{o.forEach(r=>{n[r]=!0})};return _n(t)?s(t):s(String(t).split(e)),n},YA=()=>{},XA=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function QA(t){return!!(t&&rt(t.append)&&t[lm]==="FormData"&&t[so])}var ZA=t=>{let e=new WeakSet,n=s=>{if(ds(s)){if(e.has(s))return;if(ps(s))return s;if(!("toJSON"in s)){e.add(s);let o;if(kA(s)){o=[];for(let r of s){let i=n(r);!Cn(i)&&o.push(i)}}else o=_n(s)?[]:{},oo(s,(r,i)=>{let a=n(r);!Cn(a)&&(o[i]=a)});return e.delete(s),o}}return s};return n(t)},e_=bt("AsyncFunction"),t_=t=>t&&(ds(t)||rt(t))&&rt(t.then)&&rt(t.catch),ym=((t,e)=>t?setImmediate:e?((n,s)=>(kn.addEventListener("message",({source:o,data:r})=>{o===kn&&r===n&&s.length&&s.shift()()},!1),o=>{s.push(o),kn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",rt(kn.postMessage)),n_=typeof queueMicrotask<"u"?queueMicrotask.bind(kn):typeof process<"u"&&process.nextTick||ym,bm=t=>t!=null&&rt(t[so]),s_=t=>t!=null&&eo(t,so)&&bm(t),x={isArray:_n,isArrayBuffer:dm,isBuffer:ps,isFormData:CA,isArrayBufferView:hA,isString:gA,isNumber:fm,isBoolean:yA,isObject:ds,isPlainObject:mr,isEmptyObject:bA,isReadableStream:TA,isRequest:PA,isResponse:$A,isHeaders:NA,isUndefined:Cn,isDate:xA,isFile:vA,isReactNativeBlob:wA,isReactNative:EA,isBlob:DA,isRegExp:KA,isFunction:rt,isStream:AA,isURLSearchParams:OA,isTypedArray:MA,isFileList:SA,forEach:oo,merge:Ra,extend:RA,trim:IA,stripBOM:FA,inherits:jA,toFlatObject:LA,kindOf:za,kindOfTest:bt,endsWith:BA,toArray:qA,forEachEntry:UA,matchAll:HA,isHTMLForm:zA,hasOwnProperty:Zs,hasOwnProp:Zs,hasOwnInPrototypeChain:eo,getSafeProp:fA,toSafeFlatObject:mA,reduceDescriptors:gm,freezeMethods:GA,toObjectSet:VA,toCamelCase:WA,noop:YA,toFiniteNumber:XA,findKey:mm,global:kn,isContextDefined:hm,isSpecCompliantForm:QA,toJSONObject:ZA,isAsyncFn:e_,isThenable:t_,setImmediate:ym,asap:n_,isIterable:bm,isSafeIterable:s_},o_=x.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),r_=t=>{let e={},n,s,o;return t&&t.split(`
|
|
15
|
+
`).forEach(function(i){o=i.indexOf(":"),n=i.substring(0,o).trim().toLowerCase(),s=i.substring(o+1).trim();let a=x.hasOwnProp(e,n);!n||a&&x.hasOwnProp(o_,n)||(n==="set-cookie"?a?e[n].push(s):e[n]=[s]:e[n]=a?e[n]+", "+s:s)}),e};function i_(t){let e=0,n=t.length;for(;e<n;){let s=t.charCodeAt(e);if(s!==9&&s!==32)break;e+=1}for(;n>e;){let s=t.charCodeAt(n-1);if(s!==9&&s!==32)break;n-=1}return e===0&&n===t.length?t:t.slice(e,n)}var a_=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),c_=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Wa(t,e){return x.isArray(t)?t.map(n=>Wa(n,e)):i_(String(t).replace(e,""))}var l_=t=>Wa(t,a_),u_=t=>Wa(t,c_);function Ja(t){let e=Object.create(null);return x.forEach(t.toJSON(),(n,s)=>{e[s]=u_(n)}),e}var _f=Symbol("internals");function Ys(t){return t&&String(t).trim().toLowerCase()}function hr(t){return t===!1||t==null?t:x.isArray(t)?t.map(hr):l_(String(t))}function p_(t){let e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,s;for(;s=n.exec(t);)e[s[1]]=s[2];return e}var d_=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function Sa(t){let e=0,n=t.length;for(;e<n;){let s=t.charCodeAt(e);if(s!==9&&s!==32)break;e+=1}for(;n>e;){let s=t.charCodeAt(n-1);if(s!==9&&s!==32)break;n-=1}return e===0&&n===t.length?t:t.slice(e,n)}function f_(t){let e=t.length-1;if(e<1||t.charCodeAt(0)!==34||t.charCodeAt(e)!==34)return t;let n="";for(let s=1;s<e;s++){let o=t.charCodeAt(s);if(o===34||o===92&&(s+=1,s>=e))return t;n+=t[s]}return n}function m_(t){let e=Object.create(null),n=String(t),s=0,o=!1,r=!1;function i(a){let c=Sa(n.slice(s,a)),l=c.indexOf("=");if(l<1)return;let u=Sa(c.slice(0,l));if(!d_.test(u))return;let p=u.toLowerCase();if(p==="__proto__"||p==="constructor"||p==="prototype")return;let d=Sa(c.slice(l+1));e[p]=f_(d)}for(let a=0;a<n.length;a++){let c=n.charCodeAt(a);o?r?r=!1:c===92?r=!0:c===34&&(o=!1):c===34?o=!0:(c===44||c===59)&&(i(a),s=a+1)}return i(n.length),e}var h_=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ka(t,e,n,s,o){if(x.isFunction(s))return s.call(this,e,n);if(o&&(e=n),!!x.isString(e)){if(x.isString(s))return e.indexOf(s)!==-1;if(x.isRegExp(s))return s.test(e)}}function g_(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,s)=>n.toUpperCase()+s)}function y_(t,e){let n=x.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+n,{__proto__:null,value:function(o,r,i){return this[s].call(this,e,o,r,i)},configurable:!0})})}var $e=class{constructor(e){e&&this.set(e)}set(e,n,s){let o=this;function r(a,c,l){let u=Ys(c);if(!u)return;let p=x.findKey(o,u);(!p||o[p]===void 0||l===!0||l===void 0&&o[p]!==!1)&&(o[p||c]=hr(a))}let i=(a,c)=>x.forEach(a,(l,u)=>r(l,u,c));if(x.isPlainObject(e)||e instanceof this.constructor)i(e,n);else if(x.isString(e)&&(e=e.trim())&&!h_(e))i(r_(e),n);else if(x.isObject(e)&&x.isSafeIterable(e)){let a=Object.create(null),c,l;for(let u of e){if(!x.isArray(u))throw new TypeError("Object iterator must return a key-value pair");l=u[0],x.hasOwnProp(a,l)?(c=a[l],a[l]=x.isArray(c)?[...c,u[1]]:[c,u[1]]):a[l]=u[1]}i(a,n)}else e!=null&&r(n,e,s);return this}get(e,n){if(e=Ys(e),e){let s=x.findKey(this,e);if(s){let o=this[s];if(!n)return o;if(n===!0)return p_(o);if(x.isFunction(n))return n.call(this,o,s);if(x.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ys(e),e){let s=x.findKey(this,e);return!!(s&&this[s]!==void 0&&(!n||ka(this,this[s],s,n)))}return!1}delete(e,n){let s=this,o=!1;function r(i){if(i=Ys(i),i){let a=x.findKey(s,i);a&&(!n||ka(s,s[a],a,n))&&(delete s[a],o=!0)}}return x.isArray(e)?e.forEach(r):r(e),o}clear(e){let n=Object.keys(this),s=n.length,o=!1;for(;s--;){let r=n[s];(!e||ka(this,this[r],r,e,!0))&&(delete this[r],o=!0)}return o}normalize(e){let n=this,s={};return x.forEach(this,(o,r)=>{let i=x.findKey(s,r);if(i){n[i]=hr(o),delete n[r];return}let a=e?g_(r):String(r).trim();a!==r&&delete n[r],n[a]=hr(o),s[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let n=Object.create(null);return x.forEach(this,(s,o)=>{s!=null&&s!==!1&&(n[o]=e&&x.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
16
|
+
`)}getSetCookie(){let e=this.get("set-cookie");return x.isArray(e)?e:e==null||e===!1?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return m_(e)}static concat(e,...n){let s=new this(e);return n.forEach(o=>s.set(o)),s}static accessor(e){let s=(this[_f]=this[_f]={accessors:{}}).accessors,o=this.prototype;function r(i){let a=Ys(i);s[a]||(y_(o,i),s[a]=!0)}return x.isArray(e)?e.forEach(r):r(e),this}};$e.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);x.reduceDescriptors($e.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[n]=s}}});x.freezeMethods($e);var vr="[REDACTED ****]";function b_(t){if(x.hasOwnProp(t,"toJSON"))return!0;let e=Object.getPrototypeOf(t);for(;e&&e!==Object.prototype;){if(x.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function x_(t,e){let n=new Set(e.map(r=>String(r).toLowerCase())),s=[],o=r=>{if(r===null||typeof r!="object"||x.isBuffer(r))return r;if(s.indexOf(r)!==-1)return;r instanceof $e&&(r=r.toJSON()),s.push(r);let i;if(x.isArray(r))i=[],r.forEach((a,c)=>{let l=o(a);x.isUndefined(l)||(i[c]=l)});else{if(!x.isPlainObject(r)&&b_(r))return s.pop(),r;i=Object.create(null);for(let[a,c]of Object.entries(r)){let l=n.has(a.toLowerCase())?vr:o(c);x.isUndefined(l)||(i[a]=l)}}return s.pop(),i};return o(t)}function Cf(t){try{return String(t)}catch{return""}}function v_(t){return t.errors.map(n=>{try{return n&&n.message?Cf(n.message):Cf(n)}catch{return""}}).filter(Boolean).join("; ")||t.name||"AggregateError"}var T=class t extends Error{static from(e,n,s,o,r,i){let a=e.message;!a&&x.isArray(e.errors)&&e.errors.length&&(a=v_(e));let c=new t(a,n||e.code,s,o,r);return Object.defineProperty(c,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),c.name=e.name,e.status!=null&&c.status==null&&(c.status=e.status),i&&Object.assign(c,i),c}constructor(e,n,s,o,r){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),s&&(this.config=s),o&&(this.request=o),r&&(this.response=r,this.status=r.status)}toJSON(){let e=this.config,n=e&&x.hasOwnProp(e,"redact")?e.redact:void 0,s=x.isArray(n)&&n.length>0?x_(e,n):x.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:s,code:this.code,status:this.status}}};T.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";T.ERR_BAD_OPTION="ERR_BAD_OPTION";T.ECONNABORTED="ECONNABORTED";T.ETIMEDOUT="ETIMEDOUT";T.ECONNREFUSED="ECONNREFUSED";T.ERR_NETWORK="ERR_NETWORK";T.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";T.ERR_DEPRECATED="ERR_DEPRECATED";T.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";T.ERR_BAD_REQUEST="ERR_BAD_REQUEST";T.ERR_CANCELED="ERR_CANCELED";T.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";T.ERR_INVALID_URL="ERR_INVALID_URL";T.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var Aa={isBufferAvailable(){return typeof Buffer<"u"},from(t){return Buffer.from(t)}},xm=100;function Fa(t){return x.isPlainObject(t)||x.isArray(t)}function vm(t){return x.endsWith(t,"[]")?t.slice(0,-2):t}function _a(t,e,n){return t?t.concat(e).map(function(o,r){return o=vm(o),!n&&r?"["+o+"]":o}).join(n?".":""):e}function w_(t){return x.isArray(t)&&!t.some(Fa)}var E_=x.toFlatObject(x,{},null,function(e){return/^is[A-Z]/.test(e)});function Ar(t,e,n){if(!x.isObject(t))throw new TypeError("target must be an object");e=e||new(sm||FormData);let s=(v,E)=>{let S=x.getSafeProp(n,v);return x.isUndefined(S)?E:S},o=s("metaTokens",!0),r=s("visitor")||h,i=s("dots",!1),a=s("indexes",!1),c=s("Blob")||typeof Blob<"u"&&Blob,l=s("maxDepth",xm),u=c&&x.isSpecCompliantForm(e),p=[];if(!x.isFunction(r))throw new TypeError("visitor must be a function");function d(v){if(v===null)return"";if(x.isDate(v))return v.toISOString();if(x.isBoolean(v))return v.toString();if(!u&&x.isBlob(v))throw new T("Blob is not supported. Use a Buffer instead.");if(x.isArrayBuffer(v)||x.isTypedArray(v)){if(u&&typeof c=="function")return new c([v]);if(Aa&&Aa.isBufferAvailable())return Aa.from(v);throw new T("Blob is not supported. Use a Buffer instead.",T.ERR_NOT_SUPPORT)}return v}function f(v){if(v>l)throw new T("Object is too deeply nested ("+v+" levels). Max depth: "+l,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(v,E){if(l===1/0)return JSON.stringify(v);let S=[];return JSON.stringify(v,function(B,L){if(!x.isObject(L))return L;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(L),f(E+S.length-1),L})}function h(v,E,S){let C=v;if(x.isReactNative(e)&&x.isReactNativeBlob(v))return e.append(_a(S,E,i),d(v)),!1;if(v&&!S&&typeof v=="object"){if(x.endsWith(E,"{}"))E=o?E:E.slice(0,-2),v=m(v,1);else if(x.isArray(v)&&w_(v)||(x.isFileList(v)||x.endsWith(E,"[]"))&&(C=x.toArray(v)))return E=vm(E),C.forEach(function(L,$){!(x.isUndefined(L)||L===null)&&e.append(a===!0?_a([E],$,i):a===null?E:E+"[]",d(L))}),!1}return Fa(v)?!0:(e.append(_a(S,E,i),d(v)),!1)}let g=Object.assign(E_,{defaultVisitor:h,convertValue:d,isVisitable:Fa});function b(v,E,S=0){if(!x.isUndefined(v)){if(f(S),p.indexOf(v)!==-1)throw new Error("Circular reference detected in "+E.join("."));p.push(v),x.forEach(v,function(B,L){(!(x.isUndefined(B)||B===null)&&r.call(e,B,x.isString(L)?L.trim():L,E,g))===!0&&b(B,E?E.concat(L):[L],S+1)}),p.pop()}}if(!x.isObject(t))throw new TypeError("data must be an object");return b(t),e}function Of(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(t).replace(/[!'()~]|%20/g,function(s){return e[s]})}function wm(t,e){this._pairs=[],t&&Ar(t,this,e)}var Em=wm.prototype;Em.append=function(e,n){this._pairs.push([e,n])};Em.toString=function(e){let n=e?s=>e.call(this,s,Of):Of;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function D_(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ka(t,e,n){if(!e)return t;t=t||"";let s=x.isFunction(n)?{serialize:n}:n,o=x.getSafeProp(s,"encode")||D_,r=x.getSafeProp(s,"serialize"),i;if(r?i=r(e,s):i=x.isURLSearchParams(e)?e.toString():new wm(e,s).toString(o),i){let a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}var Xs=Symbol("internals");function Dm(t){return t?t.length:0}function Tf(t){if(t)for(;t.length&&t[t.length-1]===null;)t.pop()}function Qs(t,e){let n=t.handlers,s=Dm(n);n!==e.handlersRef?(e.handlersRef=n,e.handlerEntries.clear()):s!==e.handlersLength&&(s?e.handlerEntries.forEach(function(r,i){n[r.index]!==r.handler&&e.handlerEntries.delete(i)}):e.handlerEntries.clear()),e.handlersLength=s}var wr=class{constructor(){this.handlers=[],this[Xs]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,n,s){let o={fulfilled:e,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null},r=this[Xs];this.handlers==null&&(this.handlers=[]),Qs(this,r);let i=r.nextId++;return this.handlers.push(o),r.handlerEntries.set(i,{handler:o,index:this.handlers.length-1}),r.handlersLength=this.handlers.length,i}eject(e){let n=this[Xs];Qs(this,n);let s=n.handlerEntries.get(e);if(s){if(n.handlerEntries.delete(e),this.handlers[s.index]!==s.handler)return;this.handlers[s.index]=null,n.iterationDepth||(Tf(this.handlers),n.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Qs(this,this[Xs]))}forEach(e){let n=this[Xs];Qs(this,n),n.iterationDepth++;try{x.forEach(this.handlers,function(o){o!==null&&e(o)})}finally{--n.iterationDepth||(Qs(this,n),Tf(this.handlers),n.handlersLength=Dm(this.handlers))}}},_r={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},S_=cA.URLSearchParams,Ca="abcdefghijklmnopqrstuvwxyz",Pf="0123456789",Sm={DIGIT:Pf,ALPHA:Ca,ALPHA_DIGIT:Ca+Ca.toUpperCase()+Pf},k_=(t=16,e=Sm.ALPHA_DIGIT)=>{let n="",{length:s}=e,o=new Uint32Array(t);aA.randomFillSync(o);for(let r=0;r<t;r++)n+=e[o[r]%s];return n},A_={isNode:!0,classes:{URLSearchParams:S_,FormData:sm,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Sm,generateString:k_,protocols:["http","https","file","data"]},Ga=typeof window<"u"&&typeof document<"u",ja=typeof navigator=="object"&&navigator||void 0,__=Ga&&(!ja||["ReactNative","NativeScript","NS"].indexOf(ja.product)<0),C_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",O_=Ga&&window.location.href||"http://localhost",T_=Object.freeze({__proto__:null,hasBrowserEnv:Ga,hasStandardBrowserEnv:__,hasStandardBrowserWebWorkerEnv:C_,navigator:ja,origin:O_}),De={...T_,...A_};function P_(t,e){return Ar(t,new De.classes.URLSearchParams,{visitor:function(n,s,o,r){return De.isNode&&x.isBuffer(n)?(this.append(s,n.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...e})}var $f=xm;function km(t){if(t>$f)throw new T("FormData field is too deeply nested ("+t+" levels). Max depth: "+$f,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function $_(t){let e=[],n=/[^.[\]]+|\[([^.[\]]*)]/g,s;for(;(s=n.exec(t))!==null;)km(e.length),e.push(s[0]==="[]"?"":s[1]||s[0]);return e}function N_(t){let e={},n=Object.keys(t),s,o=n.length,r;for(s=0;s<o;s++)r=n[s],e[r]=t[r];return e}function Am(t){function e(n,s,o,r){km(r);let i=n[r++];if(i==="__proto__")return!0;let a=Number.isFinite(+i),c=r>=n.length;return i=!i&&x.isArray(o)?o.length:i,c?(x.hasOwnProp(o,i)?o[i]=x.isArray(o[i])?o[i].concat(s):[o[i],s]:o[i]=s,!a):((!x.hasOwnProp(o,i)||!x.isObject(o[i]))&&(o[i]=[]),e(n,s,o[i],r)&&x.isArray(o[i])&&(o[i]=N_(o[i])),!a)}if(x.isFormData(t)&&x.isFunction(t.entries)){let n={};return x.forEachEntry(t,(s,o)=>{e($_(s),o,n,0)}),n}return null}var _m=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),cs=(t,e)=>t!=null&&x.hasOwnProp(t,e)?t[e]:void 0;function I_(t,e,n){if(x.isString(t))try{return(e||JSON.parse)(t),x.trim(t)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(t)}var ro={transitional:_r,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){let s=n.getContentType()||"",o=s.indexOf("application/json")>-1,r=x.isObject(e);if(r&&x.isHTMLForm(e)&&(e=new FormData(e)),x.isFormData(e))return o?JSON.stringify(Am(e)):e;if(x.isArrayBuffer(e)||x.isBuffer(e)||x.isStream(e)||x.isFile(e)||x.isBlob(e)||x.isReadableStream(e))return e;if(x.isArrayBufferView(e))return e.buffer;if(x.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(r){let c=cs(this,"formSerializer");if(s.indexOf("application/x-www-form-urlencoded")>-1)return P_(e,c).toString();if((a=x.isFileList(e))||s.indexOf("multipart/form-data")>-1){let l=cs(this,"env"),u=l&&l.FormData;return Ar(a?{"files[]":e}:e,u&&new u,c)}}return r||o?(n.setContentType("application/json",!1),I_(e)):e}],transformResponse:[function(e){let n=cs(this,"transitional")||ro.transitional,s=n&&n.forcedJSONParsing,o=cs(this,"responseType"),r=o==="json";if(x.isResponse(e)||x.isReadableStream(e))return e;if(e&&x.isString(e)&&(s&&!o||r)){let a=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(e,cs(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?T.from(c,T.ERR_BAD_RESPONSE,this,null,cs(this,"response")):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:De.classes.FormData,Blob:De.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};x.forEach(_m,t=>{ro.headers[t]={}});function Oa(t,e){let n=this||ro,s=e||n,o=$e.from(s.headers),r=s.data;return x.forEach(t,function(a){r=a.call(n,r,o.normalize(),e?e.status:void 0)}),o.normalize(),r}function Cm(t){return!!(t&&t.__CANCEL__)}var Yt=class extends T{constructor(e,n,s){super(e??"canceled",T.ERR_CANCELED,n,s),this.name="CanceledError",this.__CANCEL__=!0}};function ls(t,e,n){let s=n.config.validateStatus;!n.status||!s||s(n.status)?t(n):e(new T("Request failed with status code "+n.status,n.status>=400&&n.status<500?T.ERR_BAD_REQUEST:T.ERR_BAD_RESPONSE,n.config,n.request,n))}function R_(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function F_(t,e){if(!e)return t;let n=t.length;for(;n>0&&t.charCodeAt(n-1)===47;)n--;return t.slice(0,n)+"/"+e.replace(/^\/+/,"")}var j_=/[\t\n\r]/g;function Om(t){if(typeof t!="string")return t;let e=0;for(;e<t.length&&t.charCodeAt(e)<=32;)e++;return t.slice(e).replace(j_,"")}var L_=/^https?:(?!\/\/)/i;function B_(t){return t&&t.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,n,s="")=>`${n}${s}${vr}`)}function q_(t){let e=t.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${vr}@`),n=e.indexOf("#"),o=(n===-1?e:e.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${vr}`);return n===-1?o:`${o}#${B_(e.slice(n+1))}`}function Nf(t,e){if(typeof t=="string"){let n=Om(t);if(L_.test(n))throw new T(`Invalid URL ${JSON.stringify(q_(n))}: missing "//" after protocol`,T.ERR_INVALID_URL,e)}}function Va(t,e,n,s){Nf(e,s);let o=!R_(e);return t&&(o||n===!1)?(Nf(t,s),F_(t,e)):e}var M_={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function U_(t){try{return new URL(t)}catch{return null}}function H_(t){var e=(typeof t=="string"?U_(t):t)||{},n=e.protocol,s=e.host,o=e.port;if(typeof s!="string"||!s||typeof n!="string"||(n=n.split(":",1)[0],s=s.replace(/:\d*$/,""),o=parseInt(o)||M_[n]||0,!z_(s,o)))return"";var r=La(n+"_proxy")||La("all_proxy");return r&&r.indexOf("://")===-1&&(r=n+"://"+r),r}function z_(t,e){var n=La("no_proxy").toLowerCase();return n?n==="*"?!1:n.split(/[,\s]/).every(function(s){if(!s)return!0;var o=s.match(/^(.+):(\d+)$/),r=o?o[1]:s,i=o?parseInt(o[2]):0;return i&&i!==e?!0:/^[.*]/.test(r)?(r.charAt(0)==="*"&&(r=r.slice(1)),!t.endsWith(r)):t!==r}):!0}function La(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}var to="1.20.0";function gr(t){let e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(t);return e&&e[1]||""}var W_=/^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;function J_(t,e,n){let s=n&&n.Blob||De.classes.Blob,o=gr(t);if(e===void 0&&s&&(e=!0),o==="data"){t=o.length?t.slice(o.length+1):t;let r=W_.exec(t);if(!r)throw new T("Invalid URL",T.ERR_INVALID_URL);let i=r[1],a=r[2],c=r[3]?"base64":"utf8",l=r[4],u="";i?u=a?i+a:i:a&&(u="text/plain"+a);let p=c==="base64"?Buffer.from(l,"base64"):Buffer.from(decodeURIComponent(l),c);if(e){if(!s)throw new T("Blob is not supported",T.ERR_NOT_SUPPORT);return new s([p],{type:u})}return p}throw new T("Unsupported protocol "+o,T.ERR_NOT_SUPPORT)}var K_=["content-type","content-length"];function Tm(t,e,n){if(n!=="content-only"){t.set(e);return}Object.entries(e||{}).forEach(([s,o])=>{K_.includes(s.toLowerCase())&&t.set(s,o)})}var Ta=Symbol("internals"),Er=class extends ot.Transform{constructor(e){e=x.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(s,o)=>!x.isUndefined(o[s])),super({readableHighWaterMark:e.chunkSize});let n=this[Ta]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",s=>{s==="progress"&&(n.isCaptured||(n.isCaptured=!0))})}_read(e){let n=this[Ta];return n.onReadCallback&&n.onReadCallback(),super._read(e)}_transform(e,n,s){let o=this[Ta],r=o.maxRate,i=this.readableHighWaterMark,a=o.timeWindow,c=1e3/a,l=r/c,u=o.minChunkSize!==!1?Math.max(o.minChunkSize,l*.01):0,p=(f,m)=>{let h=Buffer.byteLength(f);o.bytesSeen+=h,o.bytes+=h,o.isCaptured&&this.emit("progress",o.bytesSeen),this.push(f)?process.nextTick(m):o.onReadCallback=()=>{o.onReadCallback=null,process.nextTick(m)}},d=(f,m)=>{let h=Buffer.byteLength(f),g=null,b=i,v,E=0;if(r){let S=Date.now();(!o.ts||(E=S-o.ts)>=a)&&(o.ts=S,v=l-o.bytes,o.bytes=v<0?-v:0,E=0),v=l-o.bytes}if(r){if(v<=0)return setTimeout(()=>{m(null,f)},a-E);v<b&&(b=v)}b&&h>b&&h-b>u&&(g=f.subarray(b),f=f.subarray(0,b)),p(f,g?()=>{process.nextTick(m,null,g)}:m)};d(e,function f(m,h){if(m)return s(m);h?d(h,f):s(null)})}},{asyncIterator:If}=Symbol,Pm=async function*(t){t.stream?yield*t.stream():t.arrayBuffer?yield await t.arrayBuffer():t[If]?yield*t[If]():yield t},G_=De.ALPHABET.ALPHA_DIGIT+"-_",no=typeof TextEncoder=="function"?new TextEncoder:new Ha.TextEncoder,An=`\r
|
|
17
|
+
`,V_=no.encode(An),Y_=2,Ba=class{constructor(e,n){let{escapeName:s}=this.constructor,o=x.isString(n),r=`Content-Disposition: form-data; name="${s(e)}"${!o&&n.name?`; filename="${s(n.name)}"`:""}${An}`;if(o)n=no.encode(String(n).replace(/\r?\n|\r\n?/g,An));else{let i=String(n.type||"application/octet-stream").replace(/[\r\n]/g,"");r+=`Content-Type: ${i}${An}`}this.headers=no.encode(r+An),this.contentLength=o?n.byteLength:n.size,this.size=this.headers.byteLength+this.contentLength+Y_,this.name=e,this.value=n}async*encode(){yield this.headers;let{value:e}=this;x.isTypedArray(e)?yield e:yield*Pm(e),yield V_}static escapeName(e){return String(e).replace(/[\r\n"]/g,n=>({"\r":"%0D","\n":"%0A",'"':"%22"})[n])}},X_=(t,e,n)=>{let{tag:s="form-data-boundary",size:o=25,boundary:r=s+"-"+De.generateString(o,G_)}=n||{};if(!x.isFormData(t))throw new TypeError("FormData instance required");if(r.length<1||r.length>70)throw new Error("boundary must be 1-70 characters long");let i=no.encode("--"+r+An),a=no.encode("--"+r+"--"+An),c=a.byteLength,l=Array.from(t.entries()).map(([p,d])=>{let f=new Ba(p,d);return c+=f.size,f});c+=i.byteLength*l.length,c=x.toFiniteNumber(c);let u={"Content-Type":`multipart/form-data; boundary=${r}`};return Number.isFinite(c)&&(u["Content-Length"]=c),e&&e(u),ot.Readable.from(async function*(){for(let p of l)yield i,yield*p.encode();yield a}())},qa=class extends ot.Transform{__transform(e,n,s){this.push(e),s()}_transform(e,n,s){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let o=Buffer.alloc(2);o[0]=120,o[1]=156,this.push(o,n)}this.__transform(e,n,s)}},Ma=class{constructor(){this.sessions=Object.create(null)}getSession(e,n){n=Object.assign(Object.create(null),{sessionTimeout:1e3},n);let s=this.sessions[e];if(s){let p=s.length;for(let d=0;d<p;d++){let[f,m]=s[d];if(!f.destroyed&&!f.closed&&Ha.isDeepStrictEqual(m,n))return f}}let o=am.connect(e,n),r,i,a=()=>{if(r)return;r=!0,i&&(clearTimeout(i),i=null);let p=s,d=p.length,f=d;for(;f--;)if(p[f][0]===o){d===1?delete this.sessions[e]:p.splice(f,1),o.closed||o.close();return}},c=o.request,{sessionTimeout:l}=n;if(l!=null){let p=0;o.request=function(){let d=c.apply(this,arguments);return p++,i&&(clearTimeout(i),i=null),d.once("close",()=>{--p||(i=setTimeout(()=>{i=null,a()},l))}),d}}o.once("close",a),o.once("error",a);let u=[o,n];return s?s.push(u):s=this.sessions[e]=[u],o}},Q_=(t,e)=>x.isAsyncFn(t)?function(...n){let s=n.pop();t.apply(this,n).then(o=>{try{e?s(null,...e(o)):s(null,o)}catch(r){s(r)}},s)}:t,Z_=new Set(["localhost","0.0.0.0"]),$m=t=>{let e=t.length;for(;e&&t.charCodeAt(e-1)===46;)e--;return e===t.length?t:t.slice(0,e)},Nm=t=>{let e=t.split(".");return e.length!==4||e[0]!=="127"?!1:e.every(n=>/^\d+$/.test(n)&&Number(n)>=0&&Number(n)<=255)},Pa=t=>{if(/^0[xX][0-9a-fA-F]+$/.test(t)){let e=parseInt(t.slice(2),16);return Number.isFinite(e)?e:null}if(t.length>1&&/^0[0-7]+$/.test(t)){let e=parseInt(t,8);return Number.isFinite(e)?e:null}if(t.length>1&&/^0[0-9]+$/.test(t))return null;if(/^[0-9]+$/.test(t)){let e=parseInt(t,10);return Number.isFinite(e)?e:null}return null},Im=t=>{if(typeof t!="string"||!t||t.indexOf(":")!==-1)return t;let e=t;if(e.charAt(0)==="["&&e.charAt(e.length-1)==="]"&&(e=e.slice(1,-1)),e=$m(e),!/^[0-9.xXa-fA-F]+$/.test(e))return t;let n=e.split(".");if(n.some(u=>u===""))return t;if(n.length===4){let u=n.map(Pa);return u.some(p=>p===null||p<0||p>255)?t:u.join(".")}if(n.length>4||n.length===1)return t;let s=n.slice(0,-1),o=n[n.length-1],r=4-s.length,i=Pa(o);if(i===null)return t;let a=(1<<8*r)-1;if(i<0||i>a)return t;let c=new Array(r).fill(0);for(let u=r-1,p=i;u>=0;u--,p>>=8)c[u]=p&255;let l=s.map(Pa);return l.some(u=>u===null||u<0||u>255)?t:[...l,...c].join(".")},$a=t=>/^0{1,4}$/.test(t),e1=t=>{if(t==="::")return!0;let e=t.indexOf("::");if(e!==-1){if(e!==t.lastIndexOf("::"))return!1;let s=t.slice(0,e),o=t.slice(e+2),r=s?s.split(":"):[],i=o?o.split(":"):[];return r.length+i.length<8&&r.every($a)&&i.every($a)}let n=t.split(":");return n.length===8&&n.every($a)},t1=t=>{if(t==="::1")return!0;let e=t.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i);if(e)return Nm(e[1]);let n=t.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);if(n){let o=parseInt(n[1],16);return o>=32512&&o<=32767}let s=t.split(":");if(s.length===8){for(let o=0;o<7;o++)if(!/^0+$/.test(s[o]))return!1;return/^0*1$/.test(s[7])}return!1},Rf=t=>t?Z_.has(t)||Nm(t)||e1(t)?!0:t1(t):!1,n1={http:80,https:443,ws:80,wss:443,ftp:21},s1=t=>{let e=t,n=0;if(e.charAt(0)==="["){let r=e.indexOf("]");if(r!==-1){let i=e.slice(1,r),a=e.slice(r+1);return a.charAt(0)===":"&&/^\d+$/.test(a.slice(1))&&(n=Number.parseInt(a.slice(1),10)),[i,n]}}let s=e.indexOf(":"),o=e.lastIndexOf(":");return s!==-1&&s===o&&/^\d+$/.test(e.slice(o+1))&&(n=Number.parseInt(e.slice(o+1),10),e=e.slice(0,o)),[e,n]},o1=/^(?:::|(?:0{1,4}:){1,4}:|(?:0{1,4}:){5})ffff:(\d+\.\d+\.\d+\.\d+)$/i,r1=/^(?:::|(?:0{1,4}:){1,4}:|(?:0{1,4}:){5})ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i,Rm=t=>{if(typeof t!="string"||t.indexOf(":")===-1)return t;let e=t.match(o1);if(e)return e[1];let n=t.match(r1);if(n){let s=parseInt(n[1],16),o=parseInt(n[2],16);return`${s>>8}.${s&255}.${o>>8}.${o&255}`}return t},i1=/^(?:0|[1-9]\d{0,2})$/,Fm=t=>{let e=t.split(".");return e.length===4&&e.every(n=>i1.test(n)&&Number(n)<=255)?e.map(Number):null},a1=/^[0-9a-f]{1,4}$/i,c1=t=>{let e=t.split("::");if(e.length>2)return null;let n=e[0]?e[0].split(":"):[];if(e.length===2){let s=e[1]?e[1].split(":"):[],o=8-n.length-s.length;if(o<1)return null;n.push(...new Array(o).fill("0"),...s)}return n.length!==8||n.some(s=>!a1.test(s))?null:n.flatMap(s=>{let o=Number.parseInt(s,16);return[o>>8&255,o&255]})},jm=t=>typeof t!="string"||!t?null:t.indexOf(":")!==-1?c1(t):Fm(t),Ff=t=>{if(!t)return t;t.charAt(0)==="["&&t.charAt(t.length-1)==="]"&&(t=t.slice(1,-1));let e=$m(t),n=Im(e);return n!==e?n:Rm(e)},l1=t=>{let e=t,n=e.charAt(0)==="[",s=e.charAt(e.length-1)==="]",o=e.includes("[")||e.includes("]");if(n||s){if(!n||!s||(e=e.slice(1,-1),e.indexOf(":")===-1||e.includes("[")||e.includes("]")))return null}else if(o)return null;if(!e||e.charAt(e.length-1)===".")return null;let r=e.indexOf(":")!==-1;if(r)try{e=new URL(`http://[${e}]/`).hostname.slice(1,-1)}catch{return null}else if(e=Im(e),!Fm(e))return null;return{normalized:Rm(e),wasIPv6:r}},u1=/^(.+)\/(0|[1-9]\d{0,2})$/,p1=t=>{if(t.indexOf("/")===-1)return;let e=u1.exec(t);if(!e)return null;let n=Number(e[2]),s=l1(e[1]);if(!s)return null;let{normalized:o,wasIPv6:r}=s;if(r&&o.indexOf(":")===-1){if(n<96)return null;n-=96}let i=jm(o);return!i||n>i.length*8?null:{bytes:i,prefix:n}},d1=(t,e,n)=>{let s=n>>3;for(let r=0;r<s;r++)if(t[r]!==e[r])return!1;let o=n&7;if(o){let r=255<<8-o&255;if((t[s]&r)!==(e[s]&r))return!1}return!0};function f1(t){let e;try{e=new URL(t)}catch{return!1}let n=(process.env.no_proxy||process.env.NO_PROXY||"").toLowerCase();if(!n)return!1;if(n==="*")return!0;let s=Number.parseInt(e.port,10)||n1[e.protocol.split(":",1)[0]]||0,o=Ff(e.hostname.toLowerCase()),r=jm(o);return n.split(/[\s,]+/).some(i=>{if(!i)return!1;if(i==="*")return!0;let a=p1(i);if(a!==void 0)return a!==null&&!!r&&r.length===a.bytes.length&&d1(r,a.bytes,a.prefix);let[c,l]=s1(i);return c=Ff(c),!c||l&&l!==s?!1:(c.charAt(0)==="*"&&(c=c.slice(1)),c.charAt(0)==="."?o.endsWith(c):o===c||Rf(o)&&Rf(c))})}function m1(t,e){t=t||10;let n=new Array(t),s=new Array(t),o=0,r=0,i;return e=e!==void 0?e:1e3,function(c){let l=Date.now(),u=s[r];i||(i=l),n[o]=c,s[o]=l;let p=r,d=0;for(;p!==o;)d+=n[p++],p=p%t;if(o=(o+1)%t,o===r&&(r=(r+1)%t),l-i<e)return;let f=u&&l-u;return f?Math.round(d*1e3/f):void 0}}function h1(t,e){let n=0,s=1e3/e,o,r,i=(u,p=Date.now())=>{n=p,o=null,r&&(clearTimeout(r),r=null),t(...u)};return[(...u)=>{let p=Date.now(),d=p-n;d>=s?i(u,p):(o=u,r||(r=setTimeout(()=>{r=null,i(o)},s-d)))},()=>o&&i(o),(...u)=>i(u)]}var us=(t,e,n=3)=>{let s=0,o=m1(50,250);return h1(r=>{if(!r||!x.isNumber(r.loaded))return;let i=r.loaded,a=r.lengthComputable?r.total:void 0,c=Math.max(0,a!=null?Math.min(i,a):i),l=Math.max(0,c-s),u=o(l);s=Math.max(s,c);let p={loaded:c,total:a,progress:a?c/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:r,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},n)},Dr=(t,e)=>{let n=t!=null;return[s=>e[0]({lengthComputable:n,total:t,loaded:s}),e[1]]},Sr=(t,e=x.asap)=>(...n)=>e(()=>t(...n)),jf=t=>t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102,Lm=(t,e,n)=>e+2<n&&jf(t.charCodeAt(e+1))&&jf(t.charCodeAt(e+2)),Lf=t=>t<=57?t-48:(t&223)-55,g1=t=>t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===43||t===47||t===45||t===95,y1=t=>t===9||t===10||t===12||t===13||t===32,b1=t=>{let e=Math.floor(t/4),n=t%4;return e*3+(n===2?1:n===3?2:0)},Bm=t=>{let e=t.length,n=0;return e>0&&t.charCodeAt(e-1)===61&&(n++,e>1&&t.charCodeAt(e-2)===61&&n++),Math.floor((e-n)*3/4)},x1=t=>{let e=t.length,n=0,s=0,o=!1;for(let r=0;r<e;r++){let i=t.charCodeAt(r);if(i===37&&Lm(t,r,e)&&(i=Lf(t.charCodeAt(r+1))*16+Lf(t.charCodeAt(r+2)),r+=2),!y1(i)){if(i===61){s++;continue}if(!g1(i)||s>0){o=!0;continue}n++}}return o||s>2||s>0&&(n+s)%4!==0||n%4===1?Bm(t):b1(n)},qm=(t,e)=>{if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;let n=t.indexOf(",");if(n<0)return 0;let s=t.slice(5,n),o=t.slice(n+1);if(/;base64/i.test(s))return e(o);let i=0;for(let a=0,c=o.length;a<c;a++){let l=o.charCodeAt(a);if(l===37&&Lm(o,a,c))i+=1,a+=2;else if(l<128)i+=1;else if(l<2048)i+=2;else if(l>=55296&&l<=56319&&a+1<c){let u=o.charCodeAt(a+1);u>=56320&&u<=57343?(i+=4,a++):i+=3}else i+=3}return i};function v1(t){let e=typeof t=="string"?t.indexOf("#"):-1;return qm(e===-1?t:t.slice(0,e),x1)}function w1(t){return qm(t,Bm)}var Bf={flush:yt.constants.Z_SYNC_FLUSH,finishFlush:yt.constants.Z_SYNC_FLUSH},E1={flush:yt.constants.BROTLI_OPERATION_FLUSH,finishFlush:yt.constants.BROTLI_OPERATION_FLUSH},D1={flush:yt.constants.ZSTD_e_flush,finishFlush:yt.constants.ZSTD_e_flush},Mm=x.isFunction(yt.createBrotliDecompress),Um=x.isFunction(yt.createZstdDecompress),Hm="gzip, compress, deflate"+(Mm?", br":""),S1=Hm+(Um?", zstd":""),qf=typeof process<"u"&&process.nextTick?process.nextTick.bind(process):x.asap,{http:k1,https:A1}=lA,Ya=/https:?/,Mf=Symbol("axios.http.socketListener"),yr=Symbol("axios.http.currentReq");function _1(t){let e=this[yr];e&&!e.destroyed&&e.destroy(t)}var zm=Symbol("axios.http.installedTunnel"),C1=new Map,Uf=new WeakMap,Hf={22:21,24:5};function O1(t=process.versions&&process.versions.node){if(!t)return!1;let[e,n]=t.split(".").map(s=>Number(s));return!Number.isInteger(e)||!Number.isInteger(n)?!1:e>24?!0:Hf[e]!=null&&n>=Hf[e]}function zf(t,e=process.versions&&process.versions.node){if(!O1(e))return!1;let n=t&&t.options;return!!(n&&x.hasOwnProp(n,"proxyEnv")&&n.proxyEnv!=null)}function T1(t,e,n){return Ya.test(t.protocol)?n||im.globalAgent:e||rm.globalAgent}function P1(t,e){let n=t.protocol+"//"+t.hostname+":"+(t.port||"")+"#"+(t.auth||""),s=e?Uf.get(e)||Uf.set(e,new Map).get(e):C1,o=s.get(n);if(o)return o;let r=e&&e.options?{...e.options,...t}:t;if(o=new om(r),e&&e.options){let i={...e.options},a=o.callback;o.callback=function(l,u){return a.call(this,l,{...i,...u})}}return o[zm]=!0,s.set(n,o),o}var Wf=De.protocols.map(t=>t+":"),Jf=t=>{if(!x.isString(t))return t;try{return decodeURIComponent(t)}catch{return t}},Kf=(t,[e,n])=>(t.on("end",n).on("error",n),e),$1=new Ma;function N1(t,e,n){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.auth&&t.beforeRedirects.auth(t),t.beforeRedirects.sensitiveHeaders&&t.beforeRedirects.sensitiveHeaders(t,n),t.beforeRedirects.config&&t.beforeRedirects.config(t,e,n)}function I1(t,e){t&&Object.keys(t).forEach(n=>{e.has(n.toLowerCase())&&delete t[n]})}function R1(t,e){if(!e)return!1;try{return new URL(e.url).origin===new URL(t.href).origin}catch{return!1}}function Wm(t,e,n,s,o,r,i=!0){let a=e,c=T1(t,r,o);if(!a&&a!==!1&&i&&!zf(c)){let l=H_(n);l&&(f1(n)||(a=new URL(l)))}if(s&&t.headers)for(let l of Object.keys(t.headers))l.toLowerCase()==="proxy-authorization"&&delete t.headers[l];if(s&&t.agent&&t.agent[zm]&&(t.agent=void 0),a){let l=a instanceof URL,u=h=>l||x.hasOwnProp(a,h)?a[h]:void 0,p=u("username"),d=u("password"),f=x.hasOwnProp(a,"auth")?a.auth:void 0;if(p&&(f=(p||"")+":"+(d||"")),f){let h=typeof f=="object",g=h&&x.hasOwnProp(f,"username")?f.username:void 0,b=h&&x.hasOwnProp(f,"password")?f.password:void 0;if(!!(g||b))f=(g||"")+":"+(b||"");else if(h)throw new T("Invalid proxy authorization",T.ERR_BAD_OPTION,{proxy:a})}if(Ya.test(t.protocol)){if(!(o instanceof om)){let h=u("hostname")||u("host"),g=u("port"),b=u("protocol"),v=b?b.includes(":")?b:`${b}:`:"http:",E=h&&h.includes(":")&&!h.startsWith("[")?`[${h}]`:h,S=new URL(`${v}//${E}${g?":"+g:""}`),C={protocol:S.protocol,hostname:S.hostname.replace(/^\[|\]$/g,""),port:S.port,auth:f&&typeof f=="string"?f:void 0};S.protocol==="https:"&&(C.ALPNProtocols=["http/1.1"]);let B=P1(C,o);t.agent=B,t.agents&&(t.agents.https=B)}}else{if(f){let v=Buffer.from(f,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+v}let h=!1;for(let v of Object.keys(t.headers))if(v.toLowerCase()==="host"){h=!0;break}h||(t.headers.host=t.hostname+(t.port?":"+t.port:""));let g=u("hostname")||u("host");t.hostname=g,t.host=g,t.port=u("port"),t.path=n;let b=u("protocol");b&&(t.protocol=b.includes(":")?b:`${b}:`)}}return t.beforeRedirects.proxy=function(u){Wm(u,e,u.href,!0,o,r,i)},!!(a||e!==!1&&i&&zf(c))}var F1=typeof process<"u"&&x.kindOf(process)==="process",j1=t=>new Promise((e,n)=>{let s,o,r=(c,l)=>{o||(o=!0,s&&s(c,l))},i=c=>{r(c),e(c)},a=c=>{r(c,!0),n(c)};t(i,a,c=>s=c).catch(a)}),L1=({address:t,family:e})=>{if(!x.isString(t))throw new T("address must be a string",T.ERR_BAD_OPTION_VALUE);return{address:t,family:e||(t.indexOf(".")<0?6:4)}},Gf=(t,e)=>L1(x.isObject(t)?t:{address:t,family:e}),Vf=new WeakMap,B1=t=>{let e=Vf.get(t);if(e)return e;let n=Q_(t,s=>x.isArray(s)?s:[s]);return e=(s,o,r)=>{n(s,o,(i,a,c)=>{if(i)return r(i);let l;try{l=x.isArray(a)?a.map(u=>Gf(u)):[Gf(a,c)]}catch(u){return r(u)}o.all?r(i,l):r(i,l[0].address,l[0].family)})},Vf.set(t,e),e},q1={request(t,e){let n=t.protocol+"//"+t.hostname+":"+(t.port||(t.protocol==="https:"?443:80)),{http2Options:s,headers:o}=t,r=$1.getSession(n,s),{HTTP2_HEADER_SCHEME:i,HTTP2_HEADER_METHOD:a,HTTP2_HEADER_PATH:c,HTTP2_HEADER_STATUS:l}=am.constants,u={[i]:t.protocol.replace(":",""),[a]:t.method,[c]:t.path};x.forEach(o,(d,f)=>{f.charAt(0)!==":"&&(u[f]=d)});let p=r.request(u);return p.once("response",d=>{let f=p;d=Object.assign({},d);let m=d[l];delete d[l],f.headers=d,f.statusCode=+m,e(f)}),p}},M1=F1&&function(e){return j1(async function(s,o,r){let i=P=>x.getSafeProp(e,P),a=i("transitional")||_r,c=i("data"),l=i("lookup"),u=i("family"),p=i("httpVersion");p===void 0&&(p=1);let d=p,f=i("http2Options"),m=i("httpAgent"),h=i("httpsAgent"),g=i("proxy"),b=i("responseType"),v=i("responseEncoding"),E=i("socketPath"),S=i("method").toUpperCase(),C=i("maxRedirects"),B=i("maxBodyLength"),L=i("maxContentLength"),$=i("decompress"),I,R=!1,U,Q;try{p=+p}catch{throw new T("Invalid protocol version: value is not a number",T.ERR_BAD_OPTION_VALUE,e)}if(Number.isNaN(p))throw new T(`Invalid protocol version: '${d}' is not a number`,T.ERR_BAD_OPTION_VALUE,e);if(p!==1&&p!==2)throw new T(`Unsupported protocol version '${p}'`,T.ERR_BAD_OPTION_VALUE,e);let M=p===2;l&&(l=B1(l));let z=new uA.EventEmitter;function ge(P){try{z.emit("abort",!P||P.type?new Yt(null,e,U):P)}catch{}}function oe(){Q&&(clearTimeout(Q),Q=null)}function xe(){let P=i("timeout"),O=P?"timeout of "+P+"ms exceeded":"timeout exceeded",q=i("timeoutErrorMessage");return q&&(O=q),new T(O,a.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,e,U)}z.once("abort",o);let Ee=()=>{oe(),e.cancelToken&&e.cancelToken.unsubscribe(ge),e.signal&&e.signal.removeEventListener("abort",ge),z.removeAllListeners()};(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(ge),e.signal&&(e.signal.aborted?ge():e.signal.addEventListener("abort",ge))),r((P,O)=>{if(I=!0,oe(),O){R=!0,Ee();return}let{data:q}=P;if(q instanceof ot.Readable||q instanceof ot.Duplex){let G=ot.finished(q,()=>{G(),Ee()})}else Ee()});let ve=Va(i("baseURL"),i("url"),i("allowAbsoluteUrls"),e),Me=E?"http://localhost":De.hasBrowserEnv?De.origin:void 0,F=new URL(ve,Me),H=F.protocol||Wf[0];if(H==="data:"){if(L>-1){let O=String(i("url")||ve||"");if(w1(O)>L)return o(new T("maxContentLength size of "+L+" exceeded",T.ERR_BAD_RESPONSE,e))}let P;if(S!=="GET")return ls(s,o,{status:405,statusText:"method not allowed",headers:{},config:e});try{P=J_(i("url"),b==="blob",{Blob:e.env&&e.env.Blob})}catch(O){throw T.from(O,T.ERR_BAD_REQUEST,e)}return b==="text"?(P=P.toString(v),(!v||v==="utf8")&&(P=x.stripBOM(P))):b==="stream"&&(P=ot.Readable.from(P)),ls(s,o,{data:P,status:200,statusText:"OK",headers:new $e,config:e})}if(Wf.indexOf(H)===-1)return o(new T("Unsupported protocol "+H,T.ERR_BAD_REQUEST,e));let W=$e.from(e.headers).normalize();W.set("User-Agent","axios/"+to,!1);let{onUploadProgress:N,onDownloadProgress:ce}=e,pe=e.maxRate,Z,me;if(x.isSpecCompliantForm(c)){let P=W.getContentType(/boundary=([-_\w\d]{10,70})/i);c=X_(c,O=>{W.set(O)},{tag:`axios-${to}-boundary`,boundary:P&&P[1]||void 0})}else if(x.isFormData(c)&&x.isFunction(c.getHeaders)&&c.getHeaders!==Object.prototype.getHeaders){if(Tm(W,c.getHeaders(),i("formDataHeaderPolicy")),!W.hasContentLength())try{let P=await Ha.promisify(c.getLength).call(c);Number.isFinite(P)&&P>=0&&W.setContentLength(P)}catch{}}else if(x.isBlob(c)||x.isFile(c))c.size&&W.setContentType(c.type||"application/octet-stream"),W.setContentLength(c.size||0),c=ot.Readable.from(Pm(c));else if(c&&!x.isStream(c)){if(!Buffer.isBuffer(c))if(x.isArrayBuffer(c))c=Buffer.from(new Uint8Array(c));else if(x.isString(c))c=Buffer.from(c,"utf-8");else return o(new T("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",T.ERR_BAD_REQUEST,e));if(W.setContentLength(c.length,!1),B>-1&&c.length>B)return o(new T("Request body larger than maxBodyLength limit",T.ERR_BAD_REQUEST,e))}let _e=x.toFiniteNumber(W.getContentLength());x.isArray(pe)?(Z=pe[0],me=pe[1]):Z=me=pe,c&&(N||Z)&&(x.isStream(c)||(c=ot.Readable.from(c,{objectMode:!1})),c=ot.pipeline([c,new Er({maxRate:x.toFiniteNumber(Z)})],x.noop),N&&c.on("progress",Kf(c,Dr(_e,us(Sr(N,qf),!1,3)))));let ie,Ue=i("auth");if(Ue){let P=x.getSafeProp(Ue,"username")||"",O=x.getSafeProp(Ue,"password")||"";ie=P+":"+O}if(!ie&&(F.username||F.password)){let P=Jf(F.username),O=Jf(F.password);ie=P+":"+O}ie&&W.delete("authorization");let ze;try{ze=Ka(F.pathname+F.search,i("params"),i("paramsSerializer")).replace(/^\?/,"")}catch(P){return o(T.from(P,T.ERR_BAD_REQUEST,e,null,null,{url:i("url"),exists:!0}))}W.set("Accept-Encoding",x.hasOwnProp(a,"advertiseZstdAcceptEncoding")&&a.advertiseZstdAcceptEncoding===!0?S1:Hm,!1),M&&l&&(f=Object.assign(Object.create(null),f,{lookup:l}));let le=Object.assign(Object.create(null),{path:ze,method:S,headers:Ja(W),agents:{http:m,https:h},auth:ie,protocol:H,family:u,beforeRedirect:N1,beforeRedirects:Object.create(null),http2Options:f,createConnection:void 0});!x.isUndefined(l)&&(le.lookup=l);let Xe=!1;if(E){if(typeof E!="string")return o(new T("socketPath must be a string",T.ERR_BAD_OPTION_VALUE,e));let P=i("allowedSocketPaths");if(P!=null){let O=Array.isArray(P)?P:[P],q=Sf.resolve(E);if(!O.some(ee=>typeof ee=="string"&&Sf.resolve(ee)===q))return o(new T(`socketPath "${E}" is not permitted by allowedSocketPaths`,T.ERR_BAD_OPTION_VALUE,e))}le.socketPath=E}else le.hostname=F.hostname.startsWith("[")?F.hostname.slice(1,-1):F.hostname,le.port=F.port,Xe=Wm(le,g,H+"//"+F.hostname+(F.port?":"+F.port:"")+le.path,!1,h,m,!M);let w,_=!1,j=!1,A=Ya.test(le.protocol);if(le.agent==null&&(le.agent=A?h:m),M){if(Xe)return o(new T("HTTP/2 requests with a proxy are not supported",T.ERR_NOT_SUPPORT,e));w=q1}else{let P=i("transport");if(P)w=P;else if(C===0)w=A?im:rm,_=!0;else{j=!0,le.sensitiveHeaders=[],C&&(le.maxRedirects=C);let O=i("beforeRedirect");if(O&&(le.beforeRedirects.config=O),ie){let G=F.origin,ee=ie;le.beforeRedirects.auth=function(je){try{new URL(je.href).origin===G&&(je.auth=ee)}catch{}}}let q=i("sensitiveHeaders");if(q!=null){if(!x.isArray(q))return o(new T("sensitiveHeaders must be an array of strings",T.ERR_BAD_OPTION_VALUE,e));let G=new Set;for(let ee of q){if(!x.isString(ee))return o(new T("sensitiveHeaders must be an array of strings",T.ERR_BAD_OPTION_VALUE,e));G.add(ee.toLowerCase())}G.size&&(le.sensitiveHeaders=Array.from(G),le.beforeRedirects.sensitiveHeaders=function(Qe,je){R1(Qe,je)||I1(Qe.headers,G)})}w=A?A1:k1}}B>-1?le.maxBodyLength=B:le.maxBodyLength=1/0,le.insecureHTTPParser=!!i("insecureHTTPParser"),U=w.request(le,function(O){if(oe(),U.destroyed)return;let q=[O],G=x.toFiniteNumber(O.headers["content-length"]);if(ce||me){let ae=new Er({maxRate:x.toFiniteNumber(me)});ce&&ae.on("progress",Kf(ae,Dr(G,us(Sr(ce,qf),!0,3)))),q.push(ae)}let ee=O,Qe=O.req||U;if($!==!1&&O.headers["content-encoding"])switch((S==="HEAD"||O.statusCode===204)&&delete O.headers["content-encoding"],(O.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":q.push(yt.createUnzip(Bf)),delete O.headers["content-encoding"];break;case"deflate":q.push(new qa),q.push(yt.createUnzip(Bf)),delete O.headers["content-encoding"];break;case"br":Mm&&(q.push(yt.createBrotliDecompress(E1)),delete O.headers["content-encoding"]);break;case"zstd":Um&&(q.push(yt.createZstdDecompress(D1)),delete O.headers["content-encoding"]);break}ee=q.length>1?ot.pipeline(q,x.noop):q[0];let je={status:O.statusCode,statusText:O.statusMessage,headers:new $e(O.headers),config:e,request:Qe};if(b==="stream"){if(L>-1){let ae=L,Yo=ee;async function*Fs(){let We=0;for await(let Gu of Yo){if(We+=Gu.length,We>ae)throw new T("maxContentLength size of "+ae+" exceeded",T.ERR_BAD_RESPONSE,e,Qe);yield Gu}}ee=ot.Readable.from(Fs(),{objectMode:!1})}je.data=ee,ls(s,o,je)}else{let ae=[],Yo=0;ee.on("data",function(We){ae.push(We),Yo+=We.length,L>-1&&Yo>L&&(R=!0,ee.destroy(),ge(new T("maxContentLength size of "+L+" exceeded",T.ERR_BAD_RESPONSE,e,Qe)))}),ee.on("aborted",function(){if(R)return;let We=new T("stream has been aborted",T.ERR_BAD_RESPONSE,e,Qe,je);ee.destroy(We),o(We)}),ee.on("error",function(We){R||o(T.from(We,null,e,Qe,je))}),ee.on("end",function(){try{let We=ae.length===1?ae[0]:Buffer.concat(ae);b!=="arraybuffer"&&(We=We.toString(v),(!v||v==="utf8")&&(We=x.stripBOM(We))),je.data=We}catch(We){return o(T.from(We,null,e,je.request,je))}ls(s,o,je)})}z.once("abort",ae=>{ee.destroyed||(ee.emit("error",ae),ee.destroy())})}),z.once("abort",P=>{U.close?U.close():U.destroy(P)}),U.on("error",function(O){o(T.from(O,null,e,U))});let k=new Set;if(U.on("socket",function(O){typeof O.setKeepAlive=="function"&&O.setKeepAlive(!0,1e3*60),O[Mf]||(O.on("error",_1),O[Mf]=!0),O[yr]=U,k.add(O)}),U.once("close",function(){oe();for(let O of k)O[yr]===U&&(O[yr]=null);k.clear()}),i("timeout")){let P=parseInt(i("timeout"),10);if(Number.isNaN(P)){ge(new T("error trying to parse `config.timeout` to int",T.ERR_BAD_OPTION_VALUE,e,U));return}let O=function(){I||ge(xe())};_&&P>0&&(Q=setTimeout(O,P)),U.setTimeout(P,O)}else U.setTimeout(0);if(x.isStream(c)){let P=!1,O=!1;c.on("end",()=>{P=!0}),c.once("error",G=>{O=!0,U.destroy(G)}),c.on("close",()=>{!P&&!O&&ge(new Yt("Request stream has been aborted",e,U))});let q=c;if(B>-1&&!j){let G=B,ee=0;q=ot.pipeline([c,new ot.Transform({transform(Qe,je,ae){if(ee+=Qe.length,ee>G)return ae(new T("Request body larger than maxBodyLength limit",T.ERR_BAD_REQUEST,e,U));ae(null,Qe)}})],x.noop),q.on("error",Qe=>{U.destroyed||U.destroy(Qe)})}q.pipe(U)}else c&&U.write(c),U.end()})},U1=De.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,De.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(De.origin),De.navigator&&/(msie|trident)/i.test(De.navigator.userAgent)):()=>!0,H1=De.hasStandardBrowserEnv?{write(t,e,n,s,o,r,i){if(typeof document>"u")return;let a=[`${t}=${encodeURIComponent(e)}`];x.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),x.isString(s)&&a.push(`path=${s}`),x.isString(o)&&a.push(`domain=${o}`),r===!0&&a.push("secure"),x.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;let e=document.cookie.split(";");for(let n=0;n<e.length;n++){let s=e[n].replace(/^\s+/,""),o=s.indexOf("=");if(o!==-1&&s.slice(0,o)===t)try{return decodeURIComponent(s.slice(o+1))}catch{return s.slice(o+1)}}return null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}},Yf=t=>t instanceof $e?{...t}:t,z1=t=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(t).concat(Object.getOwnPropertySymbols(t).filter(e=>Object.getOwnPropertyDescriptor(t,e).enumerable)):Object.keys(t);function On(t,e){t=t||{},e=e||{};let n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function s(u,p,d,f){return x.isPlainObject(u)&&x.isPlainObject(p)?x.merge.call({caseless:f},u,p):x.isPlainObject(p)?x.merge({},p):x.isArray(p)?p.slice():p}function o(u,p,d,f){if(x.isUndefined(p)){if(!x.isUndefined(u))return s(void 0,u,d,f)}else return s(u,p,d,f)}function r(u,p){if(!x.isUndefined(p))return s(void 0,p)}function i(u,p){if(x.isUndefined(p)){if(!x.isUndefined(u))return s(void 0,u)}else return s(void 0,p)}function a(u){let p=x.hasOwnProp(e,"transitional")?e.transitional:void 0;if(!x.isUndefined(p))if(x.isPlainObject(p)){if(x.hasOwnProp(p,u))return p[u]}else return;let d=x.hasOwnProp(t,"transitional")?t.transitional:void 0;if(x.isPlainObject(d)&&x.hasOwnProp(d,u))return d[u]}function c(u,p,d){if(x.hasOwnProp(e,d))return s(u,p);if(x.hasOwnProp(t,d))return s(void 0,u)}let l={url:r,method:r,data:r,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutErrorMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:c,headers:(u,p,d)=>o(Yf(u),Yf(p),d,!0)};return x.forEach(z1({...t,...e}),function(p){if(p==="__proto__"||p==="constructor"||p==="prototype")return;let d=x.hasOwnProp(l,p)?l[p]:o,f=x.hasOwnProp(t,p)?t[p]:void 0,m=x.hasOwnProp(e,p)?e[p]:void 0,h=d(f,m,p);x.isUndefined(h)&&d!==c||(n[p]=h)}),x.hasOwnProp(e,"validateStatus")&&x.isUndefined(e.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(x.hasOwnProp(t,"validateStatus")?n.validateStatus=s(void 0,t.validateStatus):delete n.validateStatus),n}var W1=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,n)=>String.fromCharCode(parseInt(n,16)));function Jm(t){let e=On({},t),n=d=>x.hasOwnProp(e,d)?e[d]:void 0,s=n("data"),o=n("withXSRFToken"),r=n("xsrfHeaderName"),i=n("xsrfCookieName"),a=n("headers"),c=n("auth"),l=n("baseURL"),u=n("allowAbsoluteUrls"),p=n("url");if(e.headers=a=$e.from(a),e.url=Ka(Va(l,p,u,e),n("params"),n("paramsSerializer")),c){let d=x.getSafeProp(c,"username")||"",f=x.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(d+":"+(f?W1(f):"")))}catch(m){throw T.from(m,T.ERR_BAD_OPTION_VALUE,t)}}if(x.isFormData(s)){let d=x.getSafeProp(s,"getHeaders");De.hasStandardBrowserEnv||De.hasStandardBrowserWebWorkerEnv||x.isReactNative(s)?a.setContentType(void 0):x.isFunction(d)&&Tm(a,d.call(s),n("formDataHeaderPolicy"))}if(De.hasStandardBrowserEnv&&(x.isFunction(o)&&(o=o(e)),o===!0||o==null&&U1(e.url))){let f=r&&i&&H1.read(i);f&&a.set(r,f)}return e}var J1=typeof XMLHttpRequest<"u",K1=J1&&function(t){return new Promise(function(n,s){let o=Jm(t),r=o.data,i=$e.from(o.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=o,u,p,d,f,m,h;function g(){f&&f(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function v(S){if(!b)return;if(b.status===0&&(gr(Om(o.url))||gr(De.origin))!=="file"&&!(b.responseURL&&b.responseURL.startsWith("file:"))){s(new T("Request aborted",T.ECONNABORTED,t,b)),g(),b=null;return}try{S?h&&h(S):m&&m()}catch($){setTimeout(()=>{throw $})}if(!b)return;let C=$e.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:C,config:t,request:b};ls(function(I){n(I),g()},function(I){s(I),g()},L),b=null}"onloadend"in b?b.onloadend=v:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.startsWith("file:"))||setTimeout(v)},b.onabort=function(){b&&(s(new T("Request aborted",T.ECONNABORTED,t,b)),g(),b=null)},b.onerror=function(C){let B=C&&C.message?C.message:"Network Error",L=new T(B,T.ERR_NETWORK,t,b);L.event=C||null,s(L),g(),b=null},b.ontimeout=function(){let C=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",B=o.transitional||_r;o.timeoutErrorMessage&&(C=o.timeoutErrorMessage),s(new T(C,B.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,t,b)),g(),b=null},r===void 0&&i.setContentType(null),"setRequestHeader"in b&&x.forEach(Ja(i),function(C,B){b.setRequestHeader(B,C)}),x.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),a&&a!=="json"&&(b.responseType=o.responseType),l&&([d,m,h]=us(l,!0),b.addEventListener("progress",d)),c&&b.upload&&([p,f]=us(c),b.upload.addEventListener("progress",p),b.upload.addEventListener("loadend",f)),(o.cancelToken||o.signal)&&(u=S=>{b&&(s(!S||S.type?new Yt(null,t,b):S),b.abort(),g(),b=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));let E=gr(o.url);if(E&&!De.protocols.includes(E)){s(new T("Unsupported protocol "+E+":",T.ERR_BAD_REQUEST,t)),g();return}b.send(r||null)})},G1=(t,e)=>{if(t=t?t.filter(Boolean):[],!e&&!t.length)return;let n=new AbortController,s=!1,o=function(c){if(!s){s=!0,i();let l=c instanceof Error?c:this.reason;n.abort(l instanceof T?l:new Yt(l instanceof Error?l.message:l))}},r=e&&setTimeout(()=>{r=null,o(new T(`timeout of ${e}ms exceeded`,T.ETIMEDOUT))},e),i=()=>{t&&(r&&clearTimeout(r),r=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),t=null)};t.forEach(c=>{if(!s){if(c.aborted){o.call(c);return}c.addEventListener("abort",o,{once:!0})}});let{signal:a}=n;return a.unsubscribe=()=>x.asap(i),a},V1=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let s=0,o;for(;s<n;)o=s+e,yield t.slice(s,o),s=o},Y1=async function*(t,e){for await(let n of X1(t))yield*V1(n,e)},X1=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:n,value:s}=await e.read();if(n)break;yield s}}finally{await e.cancel()}},Xf=(t,e,n,s)=>{let o=Y1(t,e),r=0,i,a=c=>{i||(i=!0,s&&s(c))};return new ReadableStream({async pull(c){try{let{done:l,value:u}=await o.next();if(l){a(),c.close();return}let p=u.byteLength;if(n){let d=r+=p;n(d)}c.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(c){return a(c),o.return()}},{highWaterMark:2})},Qf=64*1024,Q1={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:fr}=x,Z1=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,n)=>String.fromCharCode(parseInt(n,16))),Zf=t=>{if(!x.isString(t))return t;try{return decodeURIComponent(t)}catch{return t}},em=(t,...e)=>{try{return!!t(...e)}catch{return!1}},eC=t=>{let e=t.indexOf("://"),n=t;return e!==-1&&(n=n.slice(e+3)),n.includes("@")||n.includes(":")},tC=t=>{let e=x.global!==void 0&&x.global!==null?x.global:globalThis,{ReadableStream:n,TextEncoder:s}=e;t=x.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},t);let{fetch:o,Request:r,Response:i}=t,a=o?fr(o):typeof fetch=="function",c=fr(r),l=fr(i);if(!a)return!1;let u=a&&fr(n),p=a&&(typeof s=="function"?(b=>v=>b.encode(v))(new s):async b=>new Uint8Array(await new r(b).arrayBuffer())),d=c&&u&&em(()=>{let b=!1,v=new r(De.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),E=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!E}),f=l&&u&&em(()=>x.isReadableStream(new i("").body)),m={stream:f&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!m[b]&&(m[b]=(v,E)=>{let S=v&&v[b];if(S)return S.call(v);throw new T(`Response type '${b}' is not supported`,T.ERR_NOT_SUPPORT,E)})});let h=async b=>{if(b==null)return 0;if(x.isBlob(b))return b.size;if(x.isSpecCompliantForm(b))return(await new r(De.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(x.isArrayBufferView(b)||x.isArrayBuffer(b))return b.byteLength;if(x.isURLSearchParams(b)&&(b=b+""),x.isString(b))return(await p(b)).byteLength},g=async(b,v)=>{let E=x.toFiniteNumber(b.getContentLength());return E??h(v)};return async b=>{let{url:v,method:E,data:S,signal:C,cancelToken:B,timeout:L,onDownloadProgress:$,onUploadProgress:I,responseType:R,headers:U,withCredentials:Q="same-origin",fetchOptions:M,maxContentLength:z,maxBodyLength:ge,maxRedirects:oe}=Jm(b),xe=x.isNumber(z)&&z>-1,Ee=x.isNumber(ge)&&ge>-1,ve=Z=>x.hasOwnProp(b,Z)?b[Z]:void 0,Me=o||fetch;R=R?(R+"").toLowerCase():"text";let F=G1([C,B&&B.toAbortSignal()],L),H=null,W=F&&F.unsubscribe&&(()=>{F.unsubscribe()}),N,ce=null,pe=()=>new T("Request body larger than maxBodyLength limit",T.ERR_BAD_REQUEST,b,H);try{let Z,me=ve("auth");if(me){let A=x.getSafeProp(me,"username")||"",k=x.getSafeProp(me,"password")||"";Z={username:A,password:k}}if(eC(v)){let A=new URL(v,De.origin);if(!Z&&(A.username||A.password)){let k=Zf(A.username),P=Zf(A.password);Z={username:k,password:P}}(A.username||A.password)&&(A.username="",A.password="",v=A.href)}if(Z&&(U.delete("authorization"),U.set("Authorization","Basic "+btoa(Z1((Z.username||"")+":"+(Z.password||""))))),xe&&typeof v=="string"&&v.startsWith("data:")&&v1(v)>z)throw new T("maxContentLength size of "+z+" exceeded",T.ERR_BAD_RESPONSE,b,H);if(Ee&&E!=="get"&&E!=="head"){let A=await h(S);if(typeof A=="number"&&isFinite(A)&&(N=A,A>ge))throw pe()}let _e=Ee&&(x.isReadableStream(S)||x.isStream(S)),ie=(A,k,P)=>Xf(A,Qf,O=>{if(Ee&&O>ge)throw ce=pe();k&&k(O)},P);if(d&&E!=="get"&&E!=="head"&&(I||_e)){if(N=N??await g(U,S),N!==0||_e){let A=new r(v,{method:"POST",body:S,duplex:"half"}),k;if(x.isFormData(S)&&(k=A.headers.get("content-type"))&&U.setContentType(k),A.body){let[P,O]=I&&Dr(N,us(Sr(I)))||[];S=ie(A.body,P,O)}}}else if(_e&&!c&&u&&E!=="get"&&E!=="head")S=ie(S);else if(_e&&c&&!d&&E!=="get"&&E!=="head")throw new T("Stream request bodies are not supported by the current fetch implementation",T.ERR_NOT_SUPPORT,b,H);x.isString(Q)||(Q=Q?"include":"omit");let Ue=c&&"credentials"in r.prototype;if(x.isFormData(S)){let A=U.getContentType();A&&/^multipart\/form-data/i.test(A)&&!/boundary=/i.test(A)&&U.delete("content-type")}U.set("User-Agent","axios/"+to,!1);let ze=M==null?M:Object.assign(Object.create(null),M);ze&&(delete ze.body,delete ze.headers,delete ze.method,delete ze.signal,delete ze.duplex,delete ze.credentials);let le=Object.assign(Object.create(null),ze,{signal:F,method:E.toUpperCase(),headers:Ja(U.normalize()),body:S,duplex:"half",credentials:Ue?Q:void 0});c&&(x.forEach(Q1,(A,k)=>{le[k]===void 0&&(le[k]=A)}),le.signal===void 0&&(le.signal=null),le.body===void 0&&(le.body=null)),oe===0&&(le.redirect="manual",ze&&(ze.redirect="manual")),H=c&&new r(v,le);let Xe=await(c?Me(H,ze):Me(v,le)),w=$e.from(Xe.headers);if(xe){let A=x.toFiniteNumber(w.getContentLength());if(A!=null&&A>z)throw new T("maxContentLength size of "+z+" exceeded",T.ERR_BAD_RESPONSE,b,H)}let _=f&&(R==="stream"||R==="response");if(f&&Xe.body&&($||xe||_&&W)){let A={};["status","statusText","headers"].forEach(ee=>{A[ee]=Xe[ee]});let k=x.toFiniteNumber(w.getContentLength()),[P,O]=$&&Dr(k,us(Sr($),!0))||[],q=0,G=ee=>{if(xe&&(q=ee,q>z))throw new T("maxContentLength size of "+z+" exceeded",T.ERR_BAD_RESPONSE,b,H);P&&P(ee)};Xe=new i(Xf(Xe.body,Qf,G,()=>{O&&O(),W&&W()}),A)}R=R||"text";let j=await m[x.findKey(m,R)||"text"](Xe,b);if(xe&&!f&&!_){let A;if(j!=null&&(typeof j.byteLength=="number"?A=j.byteLength:typeof j.size=="number"?A=j.size:typeof j=="string"&&(A=typeof s=="function"?new s().encode(j).byteLength:j.length)),typeof A=="number"&&A>z)throw new T("maxContentLength size of "+z+" exceeded",T.ERR_BAD_RESPONSE,b,H)}return!_&&W&&W(),await new Promise((A,k)=>{ls(A,k,{data:j,headers:$e.from(Xe.headers),status:Xe.status,statusText:Xe.statusText,config:b,request:H})})}catch(Z){if(W&&W(),F&&F.aborted&&F.reason instanceof T){let me=F.reason;throw me.config=b,H&&(me.request=H),Z!==me&&Object.defineProperty(me,"cause",{__proto__:null,value:Z,writable:!0,enumerable:!1,configurable:!0}),me}if(ce)throw H&&!ce.request&&(ce.request=H),ce;if(Z instanceof T)throw H&&!Z.request&&(Z.request=H),Z;if(Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message)){let me=new T("Network Error",T.ERR_NETWORK,b,H,Z&&Z.response);throw Object.defineProperty(me,"cause",{__proto__:null,value:Z.cause||Z,writable:!0,enumerable:!1,configurable:!0}),me}throw T.from(Z,Z&&Z.code,b,H,Z&&Z.response)}}},nC=new Map,Km=t=>{let e=t&&t.env||{},{fetch:n,Request:s,Response:o}=e,r=[s,o,n],i=r.length,a=i,c,l,u=nC;for(;a--;)c=r[a],l=u.get(c),l===void 0&&u.set(c,l=a?new Map:tC(e)),u=l;return l};Km();var Xa={http:M1,xhr:K1,fetch:{get:Km}};x.forEach(Xa,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(t,"adapterName",{__proto__:null,value:e})}});var tm=t=>`- ${t}`,sC=t=>x.isFunction(t)||t===null||t===!1;function oC(t,e){t=x.isArray(t)?t:[t];let{length:n}=t,s,o,r={};for(let i=0;i<n;i++){s=t[i];let a;if(o=s,!sC(s)&&(o=Xa[(a=String(s)).toLowerCase()],o===void 0))throw new T(`Unknown adapter '${a}'`);if(o&&(x.isFunction(o)||(o=o.get(e))))break;r[a||"#"+i]=o}if(!o){let i=Object.entries(r).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build")),a=n?i.length>1?`since :
|
|
18
|
+
`+i.map(tm).join(`
|
|
19
|
+
`):" "+tm(i[0]):"as no adapter specified";throw new T("There is no suitable adapter to dispatch the request "+a,T.ERR_NOT_SUPPORT)}return o}var Gm={getAdapter:oC,adapters:Xa};function Na(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Yt(null,t)}function Ia(t){let e=x.toSafeFlatObject(t);return Na(e),e.headers=$e.from(x.getSafeProp(e,"headers")),e.data=Oa.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Gm.getAdapter(e.adapter||ro.adapter,e)(e).then(function(o){Na(e),e.response=o;try{o.data=Oa.call(e,e.transformResponse,o)}finally{delete e.response}return o.headers=$e.from(o.headers),o},function(o){if(!Cm(o)&&(Na(e),o&&o.response)){e.response=o.response;try{o.response.data=Oa.call(e,e.transformResponse,o.response)}finally{delete e.response}o.response.headers=$e.from(o.response.headers)}return Promise.reject(o)})}var Cr={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Cr[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});var nm={};Cr.transitional=function(e,n,s){function o(r,i){return"[Axios v"+to+"] Transitional option '"+r+"'"+i+(s?". "+s:"")}return(r,i,a)=>{if(e===!1)throw new T(o(i," has been removed"+(n?" in "+n:"")),T.ERR_DEPRECATED);return n&&!nm[i]&&(nm[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(r,i,a):!0}};Cr.spelling=function(e){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function rC(t,e,n){if(typeof t!="object"||t===null)throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);let s=Object.keys(t),o=s.length;for(;o-- >0;){let r=s[o],i=Object.prototype.hasOwnProperty.call(e,r)?e[r]:void 0;if(i){let a=t[r],c=a===void 0||i(a,r,t);if(c!==!0)throw new T("option "+r+" must be "+c,T.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new T("Unknown option "+r,T.ERR_BAD_OPTION)}}var br={assertOptions:rC,validators:Cr},Ze=br.validators,Vt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new wr,response:new wr}}async request(e,n){try{return await this._request(e,n)}catch(s){if(s instanceof Error)try{let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;let r=o.stack,i="";if(typeof r=="string"){let a=r.indexOf(`
|
|
20
|
+
`);i=a===-1?"":r.slice(a+1)}if(!s.stack)s.stack=i;else if(i){let a=i.indexOf(`
|
|
21
|
+
`),c=a===-1?-1:i.indexOf(`
|
|
22
|
+
`,a+1),l=c===-1?"":i.slice(c+1);String(s.stack).endsWith(l)||(s.stack+=`
|
|
23
|
+
`+i)}}catch{}throw s}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=On(this.defaults,n);let{transitional:s,paramsSerializer:o,headers:r}=n;s!==void 0&&br.assertOptions(s,{silentJSONParsing:Ze.transitional(Ze.boolean),forcedJSONParsing:Ze.transitional(Ze.boolean),clarifyTimeoutError:Ze.transitional(Ze.boolean),legacyInterceptorReqResOrdering:Ze.transitional(Ze.boolean),advertiseZstdAcceptEncoding:Ze.transitional(Ze.boolean),validateStatusUndefinedResolves:Ze.transitional(Ze.boolean)},!1),o!=null&&(x.isFunction(o)?n.paramsSerializer={serialize:o}:br.assertOptions(o,{encode:Ze.function,serialize:Ze.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),br.assertOptions(n,{baseUrl:Ze.spelling("baseURL"),withXsrfToken:Ze.spelling("withXSRFToken")},!0),n.method=(x.getSafeProp(n,"method")||x.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=r&&x.merge(r.common,r[n.method]);r&&x.forEach(_m.concat("common"),m=>{delete r[m]}),n.headers=$e.concat(i,r);let a=[],c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(n)===!1)return;c=c&&h.synchronous;let g=n.transitional||_r;g&&g.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});let l=[];this.interceptors.response.forEach(function(h){l.push(h.fulfilled,h.rejected)});let u,p=0,d;if(!c){let m=[Ia.bind(this),void 0];for(m.unshift(...a),m.push(...l),d=m.length,u=Promise.resolve(n);p<d;)u=u.then(m[p++],m[p++]);return u}d=a.length;let f=n;for(;p<d;){let m=a[p++],h=a[p++];try{f=m?m(f):f}catch(g){if(!h){u=Promise.reject(g);break}try{let b=h.call(this,g);x.isThenable(b)&&(u=Promise.resolve(b).then(()=>Ia.call(this,f)))}catch(b){u=Promise.reject(b)}break}}if(!u)try{u=Ia.call(this,f)}catch(m){u=Promise.reject(m)}for(p=0,d=l.length;p<d;)u=u.then(l[p++],l[p++]);return u}getUri(e){e=On(this.defaults,e);let n=Va(e.baseURL,e.url,e.allowAbsoluteUrls,e);return Ka(n,e.params,e.paramsSerializer)}};x.forEach(["delete","get","head","options"],function(e){Vt.prototype[e]=function(n,s){return this.request(On(s||{},{method:e,url:n,data:s&&x.hasOwnProp(s,"data")?s.data:void 0}))}});x.forEach(["post","put","patch","query"],function(e){function n(s){return function(r,i,a){return this.request(On(a||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}Vt.prototype[e]=n(),e!=="query"&&(Vt.prototype[e+"Form"]=n(!0))});var Ua=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(r){n=r});let s=this;this.promise.then(o=>{if(!s._listeners)return;let r=s._listeners.length;for(;r-- >0;)s._listeners[r](o);s._listeners=null}),this.promise.then=o=>{let r,i=new Promise(a=>{s.subscribe(a),r=a}).then(o);return i.cancel=function(){s.unsubscribe(r)},i},e(function(r,i,a){s.reason||(s.reason=new Yt(r,i,a),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){let e=new AbortController,n=s=>{e.abort(s)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new t(function(o){e=o}),cancel:e}}};function iC(t){return function(n){return t.apply(null,n)}}function aC(t){return x.isObject(t)&&t.isAxiosError===!0}var xr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(xr).forEach(([t,e])=>{xr[e]===void 0&&(xr[e]=t)});function Vm(t){let e=new Vt(t),n=cm(Vt.prototype.request,e);return x.extend(n,Vt.prototype,e,{allOwnKeys:!0}),x.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return Vm(On(t,o))},n}var Le=Vm(ro);Le.Axios=Vt;Le.CanceledError=Yt;Le.CancelToken=Ua;Le.isCancel=Cm;Le.VERSION=to;Le.toFormData=Ar;Le.AxiosError=T;Le.Cancel=Le.CanceledError;Le.all=function(e){return Promise.all(e)};Le.spread=iC;Le.isAxiosError=aC;Le.mergeConfig=On;Le.AxiosHeaders=$e;Le.formToJSON=t=>Am(x.isHTMLForm(t)?new FormData(t):t);Le.getAdapter=Gm.getAdapter;Le.HttpStatusCode=xr;Le.default=Le;Ym.exports=Le});var te=D((Gq,eh)=>{var Xm="https://planbee.infin8.world",Qm="http://localhost:3456";function Zm(t){if(t&&t.local)return!0;let e=(process.env.PLANBEE_MODE||"").toLowerCase();return e==="local"||e==="enterprise"}function cC(t){return t&&t.apiUrl?t.apiUrl:process.env.PLANBEE_API_URL?process.env.PLANBEE_API_URL:Zm(t)?Qm:Xm}function lC(t){return{mode:Zm(t)&&!process.env.PLANBEE_API_URL?"local":"cloud",authRequired:!0}}function uC(t){return`Could not reach PlanBee API at ${t}. Check your network connection, or set PLANBEE_API_URL / pass --local if you meant to target a local dev server.`}eh.exports={CLOUD_DEFAULT_API_URL:Xm,LOCAL_DEFAULT_API_URL:Qm,resolveApiUrl:cC,getProfile:lC,getConnectionErrorMessage:uC}});var nh=D((Vq,th)=>{var pC=["true","1","yes","on"],dC=["false","0","no","off"];function fC(t,e){if(t==null||t==="")return e;let n=String(t).trim().toLowerCase();return pC.includes(n)?!0:dC.includes(n)?!1:e}function mC(){return fC(process.env.LINEAR_ENABLED,!1)}th.exports={isLinearEnabled:mC}});var Qa=D((Yq,rh)=>{function sh(t){return typeof t!="string"||t.length===0?!1:!!(t.startsWith("/")||/^[a-zA-Z]:[/\\]/.test(t)||t.startsWith("\\\\"))}function oh(t){return typeof t!="string"||t.length===0?!1:!!(/(?:^|[/\\])\.\.(?:$|[/\\])/.test(t)||t.startsWith("..")&&(t[2]==="/"||t[2]==="\\")||/^[a-zA-Z]:\.\.[/\\]/.test(t))}function hC(t){return sh(t)?oh(t)?"Path contains directory traversal and is not allowed":null:"Path must be absolute (POSIX /path or Windows C:\\path)"}rh.exports={isAbsoluteAnyPlatform:sh,containsDirectoryTraversal:oh,validatePathAbsolute:hC}});var ah=D((Xq,ih)=>{"use strict";var Za=require("fs"),gC=require("util"),yC=require("path"),kt,ec=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let n=e.shift(),s=function(){};return typeof e[e.length-1]=="function"&&(s=e.pop()),s=s||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]=n,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:s})):s(),kt.format.apply(kt.format,[this.cache[this.locale][n]||n].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),n=e.shift(),s=e.shift(),o=e.shift(),r=function(){};typeof e[e.length-1]=="function"&&(r=e.pop()),this.cache[this.locale]||this._readLocaleFile();let i=o===1?n:s;this.cache[this.locale][n]&&(i=this.cache[this.locale][n][o===1?"one":"other"]),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]={one:n,other:s},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r();let a=[i];return~i.indexOf("%d")&&a.push(o),kt.format.apply(kt.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this.cache[this.locale][n]=e[n])}_taggedLiteral(e,...n){let s="";return e.forEach(function(o,r){let i=n[r+1];s+=o,typeof i<"u"&&(s+="%s")}),this.__.apply(this,[s].concat([].slice.call(n,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,n=this.writeQueue[0],s=n.directory,o=n.locale,r=n.cb,i=this._resolveLocaleFile(s,o),a=JSON.stringify(this.cache[o],null,2);kt.fs.writeFile(i,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),r(c)})}_readLocaleFile(){let e={},n=this._resolveLocaleFile(this.directory,this.locale);try{kt.fs.readFileSync&&(e=JSON.parse(kt.fs.readFileSync(n,"utf-8")))}catch(s){if(s instanceof SyntaxError&&(s.message="syntax error in "+n),s.code==="ENOENT")e={};else throw s}this.cache[this.locale]=e}_resolveLocaleFile(e,n){let s=kt.resolve(e,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(s)&&~n.lastIndexOf("_")){let o=kt.resolve(e,"./",n.split("_")[0]+".json");this._fileExistsSync(o)&&(s=o)}return s}_fileExistsSync(e){return kt.exists(e)}};function bC(t,e){kt=e;let n=new ec(t);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}var xC={fs:{readFileSync:Za.readFileSync,writeFile:Za.writeFile},format:gC.format,resolve:yC.resolve,exists:t=>{try{return Za.statSync(t).isFile()}catch{return!1}}},vC=t=>bC(t,xC);ih.exports=vC});var ic=D((Qq,hh)=>{"use strict";var wC=require("util"),ch=require("path"),EC=require("fs");function io(t){if(t!==t.toLowerCase()&&t!==t.toUpperCase()||(t=t.toLowerCase()),t.indexOf("-")===-1&&t.indexOf("_")===-1)return t;{let n="",s=!1,o=t.match(/^-+/);for(let r=o?o[0].length:0;r<t.length;r++){let i=t.charAt(r);s&&(s=!1,i=i.toUpperCase()),r!==0&&(i==="-"||i==="_")?s=!0:i!=="-"&&i!=="_"&&(n+=i)}return n}}function dh(t,e){let n=t.toLowerCase();e=e||"-";let s="";for(let o=0;o<t.length;o++){let r=n.charAt(o),i=t.charAt(o);r!==i&&o>0?s+=`${e}${n.charAt(o)}`:s+=i}return s}function fh(t){return t==null?!1:typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^0[^.]/.test(t)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function DC(t){if(Array.isArray(t))return t.map(i=>typeof i!="string"?i+"":i);t=t.trim();let e=0,n=null,s=null,o=null,r=[];for(let i=0;i<t.length;i++){if(n=s,s=t.charAt(i),s===" "&&!o){n!==" "&&e++;continue}s===o?o=null:(s==="'"||s==='"')&&!o&&(o=s),r[e]||(r[e]=""),r[e]+=s}return r}var At;(function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARRAY="array"})(At||(At={}));var Xt,rc=class{constructor(e){Xt=e}parse(e,n){let s=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},n),o=DC(e),r=typeof e=="string",i=SC(Object.assign(Object.create(null),s.alias)),a=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},s.configuration),c=Object.assign(Object.create(null),s.default),l=s.configObjects||[],u=s.envPrefix,p=a["populate--"],d=p?"--":"_",f=Object.create(null),m=Object.create(null),h=s.__||Xt.format,g={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},b=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,v=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(s.array||[]).filter(Boolean).forEach(function(w){let _=typeof w=="object"?w.key:w,j=Object.keys(w).map(function(A){return{boolean:"bools",string:"strings",number:"numbers"}[A]}).filter(Boolean).pop();j&&(g[j][_]=!0),g.arrays[_]=!0,g.keys.push(_)}),[].concat(s.boolean||[]).filter(Boolean).forEach(function(w){g.bools[w]=!0,g.keys.push(w)}),[].concat(s.string||[]).filter(Boolean).forEach(function(w){g.strings[w]=!0,g.keys.push(w)}),[].concat(s.number||[]).filter(Boolean).forEach(function(w){g.numbers[w]=!0,g.keys.push(w)}),[].concat(s.count||[]).filter(Boolean).forEach(function(w){g.counts[w]=!0,g.keys.push(w)}),[].concat(s.normalize||[]).filter(Boolean).forEach(function(w){g.normalize[w]=!0,g.keys.push(w)}),typeof s.narg=="object"&&Object.entries(s.narg).forEach(([w,_])=>{typeof _=="number"&&(g.nargs[w]=_,g.keys.push(w))}),typeof s.coerce=="object"&&Object.entries(s.coerce).forEach(([w,_])=>{typeof _=="function"&&(g.coercions[w]=_,g.keys.push(w))}),typeof s.config<"u"&&(Array.isArray(s.config)||typeof s.config=="string"?[].concat(s.config).filter(Boolean).forEach(function(w){g.configs[w]=!0}):typeof s.config=="object"&&Object.entries(s.config).forEach(([w,_])=>{(typeof _=="boolean"||typeof _=="function")&&(g.configs[w]=_)})),W(s.key,i,s.default,g.arrays),Object.keys(c).forEach(function(w){(g.aliases[w]||[]).forEach(function(_){c[_]=c[w]})});let E=null;Xe();let S=[],C=Object.assign(Object.create(null),{_:[]}),B={};for(let w=0;w<o.length;w++){let _=o[w],j=_.replace(/^-{3,}/,"---"),A,k,P,O,q,G;if(_!=="--"&&/^-/.test(_)&&me(_))L(_);else if(j.match(/^---+(=|$)/)){L(_);continue}else if(_.match(/^--.+=/)||!a["short-option-groups"]&&_.match(/^-.+=/))O=_.match(/^--?([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&(N(O[1],g.arrays)?w=I(w,O[1],o,O[2]):N(O[1],g.nargs)!==!1?w=$(w,O[1],o,O[2]):R(O[1],O[2],!0));else if(_.match(v)&&a["boolean-negation"])O=_.match(v),O!==null&&Array.isArray(O)&&O.length>=2&&(k=O[1],R(k,N(k,g.arrays)?[!1]:!1));else if(_.match(/^--.+/)||!a["short-option-groups"]&&_.match(/^-[^-]+/))O=_.match(/^--?(.+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(k=O[1],N(k,g.arrays)?w=I(w,k,o):N(k,g.nargs)!==!1?w=$(w,k,o):(q=o[w+1],q!==void 0&&(!q.match(/^-/)||q.match(b))&&!N(k,g.bools)&&!N(k,g.counts)||/^(true|false)$/.test(q)?(R(k,q),w++):R(k,ie(k))));else if(_.match(/^-.\..+=/))O=_.match(/^-([^=]+)=([\s\S]*)$/),O!==null&&Array.isArray(O)&&O.length>=3&&R(O[1],O[2]);else if(_.match(/^-.\..+/)&&!_.match(b))q=o[w+1],O=_.match(/^-(.\..+)/),O!==null&&Array.isArray(O)&&O.length>=2&&(k=O[1],q!==void 0&&!q.match(/^-/)&&!N(k,g.bools)&&!N(k,g.counts)?(R(k,q),w++):R(k,ie(k)));else if(_.match(/^-[^-]+/)&&!_.match(b)){P=_.slice(1,-1).split(""),A=!1;for(let ee=0;ee<P.length;ee++){if(q=_.slice(ee+2),P[ee+1]&&P[ee+1]==="="){G=_.slice(ee+3),k=P[ee],N(k,g.arrays)?w=I(w,k,o,G):N(k,g.nargs)!==!1?w=$(w,k,o,G):R(k,G),A=!0;break}if(q==="-"){R(P[ee],q);continue}if(/[A-Za-z]/.test(P[ee])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(q)&&N(q,g.bools)===!1){R(P[ee],q),A=!0;break}if(P[ee+1]&&P[ee+1].match(/\W/)){R(P[ee],q),A=!0;break}else R(P[ee],ie(P[ee]))}k=_.slice(-1)[0],!A&&k!=="-"&&(N(k,g.arrays)?w=I(w,k,o):N(k,g.nargs)!==!1?w=$(w,k,o):(q=o[w+1],q!==void 0&&(!/^(-|--)[^-]/.test(q)||q.match(b))&&!N(k,g.bools)&&!N(k,g.counts)||/^(true|false)$/.test(q)?(R(k,q),w++):R(k,ie(k))))}else if(_.match(/^-[0-9]$/)&&_.match(b)&&N(_.slice(1),g.bools))k=_.slice(1),R(k,ie(k));else if(_==="--"){S=o.slice(w+1);break}else if(a["halt-at-non-option"]){S=o.slice(w);break}else L(_)}xe(C,!0),xe(C,!1),z(C),oe(),Me(C,g.aliases,c,!0),Ee(C),a["set-placeholder-key"]&&ve(C),Object.keys(g.counts).forEach(function(w){F(C,w.split("."))||R(w,0)}),p&&S.length&&(C[d]=[]),S.forEach(function(w){C[d].push(w)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(C).filter(w=>w!=="--"&&w.includes("-")).forEach(w=>{delete C[w]}),a["strip-aliased"]&&[].concat(...Object.keys(i).map(w=>i[w])).forEach(w=>{a["camel-case-expansion"]&&w.includes("-")&&delete C[w.split(".").map(_=>io(_)).join(".")],delete C[w]});function L(w){let _=M("_",w);(typeof _=="string"||typeof _=="number")&&C._.push(_)}function $(w,_,j,A){let k,P=N(_,g.nargs);if(P=typeof P!="number"||isNaN(P)?1:P,P===0)return le(A)||(E=Error(h("Argument unexpected for: %s",_))),R(_,ie(_)),w;let O=le(A)?0:1;if(a["nargs-eats-options"])j.length-(w+1)+O<P&&(E=Error(h("Not enough arguments following: %s",_))),O=P;else{for(k=w+1;k<j.length&&(!j[k].match(/^-[^0-9]/)||j[k].match(b)||me(j[k]));k++)O++;O<P&&(E=Error(h("Not enough arguments following: %s",_)))}let q=Math.min(O,P);for(!le(A)&&q>0&&(R(_,A),q--),k=w+1;k<q+w+1;k++)R(_,j[k]);return w+q}function I(w,_,j,A){let k=[],P=A||j[w+1],O=N(_,g.nargs);if(N(_,g.bools)&&!/^(true|false)$/.test(P))k.push(!0);else if(le(P)||le(A)&&/^-/.test(P)&&!b.test(P)&&!me(P)){if(c[_]!==void 0){let q=c[_];k=Array.isArray(q)?q:[q]}}else{le(A)||k.push(Q(_,A,!0));for(let q=w+1;q<j.length&&!(!a["greedy-arrays"]&&k.length>0||O&&typeof O=="number"&&k.length>=O||(P=j[q],/^-/.test(P)&&!b.test(P)&&!me(P)));q++)w=q,k.push(Q(_,P,r))}return typeof O=="number"&&(O&&k.length<O||isNaN(O)&&k.length===0)&&(E=Error(h("Not enough arguments following: %s",_))),R(_,k),w}function R(w,_,j=r){if(/-/.test(w)&&a["camel-case-expansion"]){let P=w.split(".").map(function(O){return io(O)}).join(".");U(w,P)}let A=Q(w,_,j),k=w.split(".");H(C,k,A),g.aliases[w]&&g.aliases[w].forEach(function(P){let O=P.split(".");H(C,O,A)}),k.length>1&&a["dot-notation"]&&(g.aliases[k[0]]||[]).forEach(function(P){let O=P.split("."),q=[].concat(k);q.shift(),O=O.concat(q),(g.aliases[w]||[]).includes(O.join("."))||H(C,O,A)}),N(w,g.normalize)&&!N(w,g.arrays)&&[w].concat(g.aliases[w]||[]).forEach(function(O){Object.defineProperty(B,O,{enumerable:!0,get(){return _},set(q){_=typeof q=="string"?Xt.normalize(q):q}})})}function U(w,_){g.aliases[w]&&g.aliases[w].length||(g.aliases[w]=[_],f[_]=!0),g.aliases[_]&&g.aliases[_].length||U(_,w)}function Q(w,_,j){j&&(_=kC(_)),(N(w,g.bools)||N(w,g.counts))&&typeof _=="string"&&(_=_==="true");let A=Array.isArray(_)?_.map(function(k){return M(w,k)}):M(w,_);return N(w,g.counts)&&(le(A)||typeof A=="boolean")&&(A=tc()),N(w,g.normalize)&&N(w,g.arrays)&&(Array.isArray(_)?A=_.map(k=>Xt.normalize(k)):A=Xt.normalize(_)),A}function M(w,_){return!a["parse-positional-numbers"]&&w==="_"||!N(w,g.strings)&&!N(w,g.bools)&&!Array.isArray(_)&&(fh(_)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${_}`)))||!le(_)&&N(w,g.numbers))&&(_=Number(_)),_}function z(w){let _=Object.create(null);Me(_,g.aliases,c),Object.keys(g.configs).forEach(function(j){let A=w[j]||_[j];if(A)try{let k=null,P=Xt.resolve(Xt.cwd(),A),O=g.configs[j];if(typeof O=="function"){try{k=O(P)}catch(q){k=q}if(k instanceof Error){E=k;return}}else k=Xt.require(P);ge(k)}catch(k){k.name==="PermissionDenied"?E=k:w[j]&&(E=Error(h("Invalid JSON config file: %s",A)))}})}function ge(w,_){Object.keys(w).forEach(function(j){let A=w[j],k=_?_+"."+j:j;typeof A=="object"&&A!==null&&!Array.isArray(A)&&a["dot-notation"]?ge(A,k):(!F(C,k.split("."))||N(k,g.arrays)&&a["combine-arrays"])&&R(k,A)})}function oe(){typeof l<"u"&&l.forEach(function(w){ge(w)})}function xe(w,_){if(typeof u>"u")return;let j=typeof u=="string"?u:"",A=Xt.env();Object.keys(A).forEach(function(k){if(j===""||k.lastIndexOf(j,0)===0){let P=k.split("__").map(function(O,q){return q===0&&(O=O.substring(j.length)),io(O)});(_&&g.configs[P.join(".")]||!_)&&!F(w,P)&&R(P.join("."),A[k])}})}function Ee(w){let _,j=new Set;Object.keys(w).forEach(function(A){if(!j.has(A)&&(_=N(A,g.coercions),typeof _=="function"))try{let k=M(A,_(w[A]));[].concat(g.aliases[A]||[],A).forEach(P=>{j.add(P),w[P]=k})}catch(k){E=k}})}function ve(w){return g.keys.forEach(_=>{~_.indexOf(".")||typeof w[_]>"u"&&(w[_]=void 0)}),w}function Me(w,_,j,A=!1){Object.keys(j).forEach(function(k){F(w,k.split("."))||(H(w,k.split("."),j[k]),A&&(m[k]=!0),(_[k]||[]).forEach(function(P){F(w,P.split("."))||H(w,P.split("."),j[k])}))})}function F(w,_){let j=w;a["dot-notation"]||(_=[_.join(".")]),_.slice(0,-1).forEach(function(k){j=j[k]||{}});let A=_[_.length-1];return typeof j!="object"?!1:A in j}function H(w,_,j){let A=w;a["dot-notation"]||(_=[_.join(".")]),_.slice(0,-1).forEach(function(G){G=lh(G),typeof A=="object"&&A[G]===void 0&&(A[G]={}),typeof A[G]!="object"||Array.isArray(A[G])?(Array.isArray(A[G])?A[G].push({}):A[G]=[A[G],{}],A=A[G][A[G].length-1]):A=A[G]});let k=lh(_[_.length-1]),P=N(_.join("."),g.arrays),O=Array.isArray(j),q=a["duplicate-arguments-array"];!q&&N(k,g.nargs)&&(q=!0,(!le(A[k])&&g.nargs[k]===1||Array.isArray(A[k])&&A[k].length===g.nargs[k])&&(A[k]=void 0)),j===tc()?A[k]=tc(A[k]):Array.isArray(A[k])?q&&P&&O?A[k]=a["flatten-duplicate-arrays"]?A[k].concat(j):(Array.isArray(A[k][0])?A[k]:[A[k]]).concat([j]):!q&&!!P==!!O?A[k]=j:A[k]=A[k].concat([j]):A[k]===void 0&&P?A[k]=O?j:[j]:q&&!(A[k]===void 0||N(k,g.counts)||N(k,g.bools))?A[k]=[A[k],j]:A[k]=j}function W(...w){w.forEach(function(_){Object.keys(_||{}).forEach(function(j){g.aliases[j]||(g.aliases[j]=[].concat(i[j]||[]),g.aliases[j].concat(j).forEach(function(A){if(/-/.test(A)&&a["camel-case-expansion"]){let k=io(A);k!==j&&g.aliases[j].indexOf(k)===-1&&(g.aliases[j].push(k),f[k]=!0)}}),g.aliases[j].concat(j).forEach(function(A){if(A.length>1&&/[A-Z]/.test(A)&&a["camel-case-expansion"]){let k=dh(A,"-");k!==j&&g.aliases[j].indexOf(k)===-1&&(g.aliases[j].push(k),f[k]=!0)}}),g.aliases[j].forEach(function(A){g.aliases[A]=[j].concat(g.aliases[j].filter(function(k){return A!==k}))}))})})}function N(w,_){let j=[].concat(g.aliases[w]||[],w),A=Object.keys(_),k=j.find(P=>A.includes(P));return k?_[k]:!1}function ce(w){let _=Object.keys(g);return[].concat(_.map(A=>g[A])).some(function(A){return Array.isArray(A)?A.includes(w):A[w]})}function pe(w,..._){return[].concat(..._).some(function(A){let k=w.match(A);return k&&ce(k[1])})}function Z(w){if(w.match(b)||!w.match(/^-[^-]+/))return!1;let _=!0,j,A=w.slice(1).split("");for(let k=0;k<A.length;k++){if(j=w.slice(k+2),!ce(A[k])){_=!1;break}if(A[k+1]&&A[k+1]==="="||j==="-"||/[A-Za-z]/.test(A[k])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(j)||A[k+1]&&A[k+1].match(/\W/))break}return _}function me(w){return a["unknown-options-as-args"]&&_e(w)}function _e(w){return w=w.replace(/^-{3,}/,"--"),w.match(b)||Z(w)?!1:!pe(w,/^-+([^=]+?)=[\s\S]*$/,v,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function ie(w){return!N(w,g.bools)&&!N(w,g.counts)&&`${w}`in c?c[w]:Ue(ze(w))}function Ue(w){return{[At.BOOLEAN]:!0,[At.STRING]:"",[At.NUMBER]:void 0,[At.ARRAY]:[]}[w]}function ze(w){let _=At.BOOLEAN;return N(w,g.strings)?_=At.STRING:N(w,g.numbers)?_=At.NUMBER:N(w,g.bools)?_=At.BOOLEAN:N(w,g.arrays)&&(_=At.ARRAY),_}function le(w){return w===void 0}function Xe(){Object.keys(g.counts).find(w=>N(w,g.arrays)?(E=Error(h("Invalid configuration: %s, opts.count excludes opts.array.",w)),!0):N(w,g.nargs)?(E=Error(h("Invalid configuration: %s, opts.count excludes opts.narg.",w)),!0):!1)}return{aliases:Object.assign({},g.aliases),argv:Object.assign(B,C),configuration:a,defaulted:Object.assign({},m),error:E,newAliases:Object.assign({},f)}}};function SC(t){let e=[],n=Object.create(null),s=!0;for(Object.keys(t).forEach(function(o){e.push([].concat(t[o],o))});s;){s=!1;for(let o=0;o<e.length;o++)for(let r=o+1;r<e.length;r++)if(e[o].filter(function(a){return e[r].indexOf(a)!==-1}).length){e[o]=e[o].concat(e[r]),e.splice(r,1),s=!0;break}}return e.forEach(function(o){o=o.filter(function(i,a,c){return c.indexOf(i)===a});let r=o.pop();r!==void 0&&typeof r=="string"&&(n[r]=o)}),n}function tc(t){return t!==void 0?t+1:1}function lh(t){return t==="__proto__"?"___proto___":t}function kC(t){return typeof t=="string"&&(t[0]==="'"||t[0]==='"')&&t[t.length-1]===t[0]?t.substring(1,t.length-1):t}var nc,sc,oc,uh=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,ph=(sc=(nc=process==null?void 0:process.versions)===null||nc===void 0?void 0:nc.node)!==null&&sc!==void 0?sc:(oc=process==null?void 0:process.version)===null||oc===void 0?void 0:oc.slice(1);if(ph&&Number(ph.match(/^([^.]+)/)[1])<uh)throw Error(`yargs parser supports a minimum Node.js version of ${uh}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var AC=process?process.env:{},mh=new rc({cwd:process.cwd,env:()=>AC,format:wC.format,normalize:ch.normalize,resolve:ch.resolve,require:t=>{if(typeof require<"u")return require(t);if(t.match(/\.json$/))return JSON.parse(EC.readFileSync(t,"utf8"));throw Error("only .json config files are supported in ESM")}}),ao=function(e,n){return mh.parse(e.slice(),n).argv};ao.detailed=function(t,e){return mh.parse(t.slice(),e)};ao.camelCase=io;ao.decamelize=dh;ao.looksLikeNumber=fh;hh.exports=ao});var yh=D((Zq,gh)=>{"use strict";gh.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var Or=D((eM,bh)=>{"use strict";var _C=yh();bh.exports=t=>typeof t=="string"?t.replace(_C(),""):t});var vh=D((tM,ac)=>{"use strict";var xh=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);ac.exports=xh;ac.exports.default=xh});var Eh=D((nM,wh)=>{"use strict";wh.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var Tr=D((sM,cc)=>{"use strict";var CC=Or(),OC=vh(),TC=Eh(),Dh=t=>{if(typeof t!="string"||t.length===0||(t=CC(t),t.length===0))return 0;t=t.replace(TC()," ");let e=0;for(let n=0;n<t.length;n++){let s=t.codePointAt(n);s<=31||s>=127&&s<=159||s>=768&&s<=879||(s>65535&&n++,e+=OC(s)?2:1)}return e};cc.exports=Dh;cc.exports.default=Dh});var kh=D((oM,Sh)=>{"use strict";Sh.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var lc=D((rM,_h)=>{var co=kh(),Ah={};for(let t of Object.keys(co))Ah[co[t]]=t;var V={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};_h.exports=V;for(let t of Object.keys(V)){if(!("channels"in V[t]))throw new Error("missing channels property: "+t);if(!("labels"in V[t]))throw new Error("missing channel labels property: "+t);if(V[t].labels.length!==V[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:n}=V[t];delete V[t].channels,delete V[t].labels,Object.defineProperty(V[t],"channels",{value:e}),Object.defineProperty(V[t],"labels",{value:n})}V.rgb.hsl=function(t){let e=t[0]/255,n=t[1]/255,s=t[2]/255,o=Math.min(e,n,s),r=Math.max(e,n,s),i=r-o,a,c;r===o?a=0:e===r?a=(n-s)/i:n===r?a=2+(s-e)/i:s===r&&(a=4+(e-n)/i),a=Math.min(a*60,360),a<0&&(a+=360);let l=(o+r)/2;return r===o?c=0:l<=.5?c=i/(r+o):c=i/(2-r-o),[a,c*100,l*100]};V.rgb.hsv=function(t){let e,n,s,o,r,i=t[0]/255,a=t[1]/255,c=t[2]/255,l=Math.max(i,a,c),u=l-Math.min(i,a,c),p=function(d){return(l-d)/6/u+1/2};return u===0?(o=0,r=0):(r=u/l,e=p(i),n=p(a),s=p(c),i===l?o=s-n:a===l?o=1/3+e-s:c===l&&(o=2/3+n-e),o<0?o+=1:o>1&&(o-=1)),[o*360,r*100,l*100]};V.rgb.hwb=function(t){let e=t[0],n=t[1],s=t[2],o=V.rgb.hsl(t)[0],r=1/255*Math.min(e,Math.min(n,s));return s=1-1/255*Math.max(e,Math.max(n,s)),[o,r*100,s*100]};V.rgb.cmyk=function(t){let e=t[0]/255,n=t[1]/255,s=t[2]/255,o=Math.min(1-e,1-n,1-s),r=(1-e-o)/(1-o)||0,i=(1-n-o)/(1-o)||0,a=(1-s-o)/(1-o)||0;return[r*100,i*100,a*100,o*100]};function PC(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}V.rgb.keyword=function(t){let e=Ah[t];if(e)return e;let n=1/0,s;for(let o of Object.keys(co)){let r=co[o],i=PC(t,r);i<n&&(n=i,s=o)}return s};V.keyword.rgb=function(t){return co[t]};V.rgb.xyz=function(t){let e=t[0]/255,n=t[1]/255,s=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let o=e*.4124+n*.3576+s*.1805,r=e*.2126+n*.7152+s*.0722,i=e*.0193+n*.1192+s*.9505;return[o*100,r*100,i*100]};V.rgb.lab=function(t){let e=V.rgb.xyz(t),n=e[0],s=e[1],o=e[2];n/=95.047,s/=100,o/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let r=116*s-16,i=500*(n-s),a=200*(s-o);return[r,i,a]};V.hsl.rgb=function(t){let e=t[0]/360,n=t[1]/100,s=t[2]/100,o,r,i;if(n===0)return i=s*255,[i,i,i];s<.5?o=s*(1+n):o=s+n-s*n;let a=2*s-o,c=[0,0,0];for(let l=0;l<3;l++)r=e+1/3*-(l-1),r<0&&r++,r>1&&r--,6*r<1?i=a+(o-a)*6*r:2*r<1?i=o:3*r<2?i=a+(o-a)*(2/3-r)*6:i=a,c[l]=i*255;return c};V.hsl.hsv=function(t){let e=t[0],n=t[1]/100,s=t[2]/100,o=n,r=Math.max(s,.01);s*=2,n*=s<=1?s:2-s,o*=r<=1?r:2-r;let i=(s+n)/2,a=s===0?2*o/(r+o):2*n/(s+n);return[e,a*100,i*100]};V.hsv.rgb=function(t){let e=t[0]/60,n=t[1]/100,s=t[2]/100,o=Math.floor(e)%6,r=e-Math.floor(e),i=255*s*(1-n),a=255*s*(1-n*r),c=255*s*(1-n*(1-r));switch(s*=255,o){case 0:return[s,c,i];case 1:return[a,s,i];case 2:return[i,s,c];case 3:return[i,a,s];case 4:return[c,i,s];case 5:return[s,i,a]}};V.hsv.hsl=function(t){let e=t[0],n=t[1]/100,s=t[2]/100,o=Math.max(s,.01),r,i;i=(2-n)*s;let a=(2-n)*o;return r=n*o,r/=a<=1?a:2-a,r=r||0,i/=2,[e,r*100,i*100]};V.hwb.rgb=function(t){let e=t[0]/360,n=t[1]/100,s=t[2]/100,o=n+s,r;o>1&&(n/=o,s/=o);let i=Math.floor(6*e),a=1-s;r=6*e-i,i&1&&(r=1-r);let c=n+r*(a-n),l,u,p;switch(i){default:case 6:case 0:l=a,u=c,p=n;break;case 1:l=c,u=a,p=n;break;case 2:l=n,u=a,p=c;break;case 3:l=n,u=c,p=a;break;case 4:l=c,u=n,p=a;break;case 5:l=a,u=n,p=c;break}return[l*255,u*255,p*255]};V.cmyk.rgb=function(t){let e=t[0]/100,n=t[1]/100,s=t[2]/100,o=t[3]/100,r=1-Math.min(1,e*(1-o)+o),i=1-Math.min(1,n*(1-o)+o),a=1-Math.min(1,s*(1-o)+o);return[r*255,i*255,a*255]};V.xyz.rgb=function(t){let e=t[0]/100,n=t[1]/100,s=t[2]/100,o,r,i;return o=e*3.2406+n*-1.5372+s*-.4986,r=e*-.9689+n*1.8758+s*.0415,i=e*.0557+n*-.204+s*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),i=Math.min(Math.max(0,i),1),[o*255,r*255,i*255]};V.xyz.lab=function(t){let e=t[0],n=t[1],s=t[2];e/=95.047,n/=100,s/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let o=116*n-16,r=500*(e-n),i=200*(n-s);return[o,r,i]};V.lab.xyz=function(t){let e=t[0],n=t[1],s=t[2],o,r,i;r=(e+16)/116,o=n/500+r,i=r-s/200;let a=r**3,c=o**3,l=i**3;return r=a>.008856?a:(r-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i=l>.008856?l:(i-16/116)/7.787,o*=95.047,r*=100,i*=108.883,[o,r,i]};V.lab.lch=function(t){let e=t[0],n=t[1],s=t[2],o;o=Math.atan2(s,n)*360/2/Math.PI,o<0&&(o+=360);let i=Math.sqrt(n*n+s*s);return[e,i,o]};V.lch.lab=function(t){let e=t[0],n=t[1],o=t[2]/360*2*Math.PI,r=n*Math.cos(o),i=n*Math.sin(o);return[e,r,i]};V.rgb.ansi16=function(t,e=null){let[n,s,o]=t,r=e===null?V.rgb.hsv(t)[2]:e;if(r=Math.round(r/50),r===0)return 30;let i=30+(Math.round(o/255)<<2|Math.round(s/255)<<1|Math.round(n/255));return r===2&&(i+=60),i};V.hsv.ansi16=function(t){return V.rgb.ansi16(V.hsv.rgb(t),t[2])};V.rgb.ansi256=function(t){let e=t[0],n=t[1],s=t[2];return e===n&&n===s?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(s/255*5)};V.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let n=(~~(t>50)+1)*.5,s=(e&1)*n*255,o=(e>>1&1)*n*255,r=(e>>2&1)*n*255;return[s,o,r]};V.ansi256.rgb=function(t){if(t>=232){let r=(t-232)*10+8;return[r,r,r]}t-=16;let e,n=Math.floor(t/36)/5*255,s=Math.floor((e=t%36)/6)/5*255,o=e%6/5*255;return[n,s,o]};V.rgb.hex=function(t){let n=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(n.length)+n};V.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];e[0].length===3&&(n=n.split("").map(a=>a+a).join(""));let s=parseInt(n,16),o=s>>16&255,r=s>>8&255,i=s&255;return[o,r,i]};V.rgb.hcg=function(t){let e=t[0]/255,n=t[1]/255,s=t[2]/255,o=Math.max(Math.max(e,n),s),r=Math.min(Math.min(e,n),s),i=o-r,a,c;return i<1?a=r/(1-i):a=0,i<=0?c=0:o===e?c=(n-s)/i%6:o===n?c=2+(s-e)/i:c=4+(e-n)/i,c/=6,c%=1,[c*360,i*100,a*100]};V.hsl.hcg=function(t){let e=t[1]/100,n=t[2]/100,s=n<.5?2*e*n:2*e*(1-n),o=0;return s<1&&(o=(n-.5*s)/(1-s)),[t[0],s*100,o*100]};V.hsv.hcg=function(t){let e=t[1]/100,n=t[2]/100,s=e*n,o=0;return s<1&&(o=(n-s)/(1-s)),[t[0],s*100,o*100]};V.hcg.rgb=function(t){let e=t[0]/360,n=t[1]/100,s=t[2]/100;if(n===0)return[s*255,s*255,s*255];let o=[0,0,0],r=e%1*6,i=r%1,a=1-i,c=0;switch(Math.floor(r)){case 0:o[0]=1,o[1]=i,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=i;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=i,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return c=(1-n)*s,[(n*o[0]+c)*255,(n*o[1]+c)*255,(n*o[2]+c)*255]};V.hcg.hsv=function(t){let e=t[1]/100,n=t[2]/100,s=e+n*(1-e),o=0;return s>0&&(o=e/s),[t[0],o*100,s*100]};V.hcg.hsl=function(t){let e=t[1]/100,s=t[2]/100*(1-e)+.5*e,o=0;return s>0&&s<.5?o=e/(2*s):s>=.5&&s<1&&(o=e/(2*(1-s))),[t[0],o*100,s*100]};V.hcg.hwb=function(t){let e=t[1]/100,n=t[2]/100,s=e+n*(1-e);return[t[0],(s-e)*100,(1-s)*100]};V.hwb.hcg=function(t){let e=t[1]/100,s=1-t[2]/100,o=s-e,r=0;return o<1&&(r=(s-o)/(1-o)),[t[0],o*100,r*100]};V.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};V.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};V.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};V.gray.hsl=function(t){return[0,0,t[0]]};V.gray.hsv=V.gray.hsl;V.gray.hwb=function(t){return[0,100,t[0]]};V.gray.cmyk=function(t){return[0,0,0,t[0]]};V.gray.lab=function(t){return[t[0],0,0]};V.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,s=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(s.length)+s};V.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var Oh=D((iM,Ch)=>{var Pr=lc();function $C(){let t={},e=Object.keys(Pr);for(let n=e.length,s=0;s<n;s++)t[e[s]]={distance:-1,parent:null};return t}function NC(t){let e=$C(),n=[t];for(e[t].distance=0;n.length;){let s=n.pop(),o=Object.keys(Pr[s]);for(let r=o.length,i=0;i<r;i++){let a=o[i],c=e[a];c.distance===-1&&(c.distance=e[s].distance+1,c.parent=s,n.unshift(a))}}return e}function IC(t,e){return function(n){return e(t(n))}}function RC(t,e){let n=[e[t].parent,t],s=Pr[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)n.unshift(e[o].parent),s=IC(Pr[e[o].parent][o],s),o=e[o].parent;return s.conversion=n,s}Ch.exports=function(t){let e=NC(t),n={},s=Object.keys(e);for(let o=s.length,r=0;r<o;r++){let i=s[r];e[i].parent!==null&&(n[i]=RC(i,e))}return n}});var Ph=D((aM,Th)=>{var uc=lc(),FC=Oh(),fs={},jC=Object.keys(uc);function LC(t){let e=function(...n){let s=n[0];return s==null?s:(s.length>1&&(n=s),t(n))};return"conversion"in t&&(e.conversion=t.conversion),e}function BC(t){let e=function(...n){let s=n[0];if(s==null)return s;s.length>1&&(n=s);let o=t(n);if(typeof o=="object")for(let r=o.length,i=0;i<r;i++)o[i]=Math.round(o[i]);return o};return"conversion"in t&&(e.conversion=t.conversion),e}jC.forEach(t=>{fs[t]={},Object.defineProperty(fs[t],"channels",{value:uc[t].channels}),Object.defineProperty(fs[t],"labels",{value:uc[t].labels});let e=FC(t);Object.keys(e).forEach(s=>{let o=e[s];fs[t][s]=BC(o),fs[t][s].raw=LC(o)})});Th.exports=fs});var jh=D((cM,Fh)=>{"use strict";var $h=(t,e)=>(...n)=>`\x1B[${t(...n)+e}m`,Nh=(t,e)=>(...n)=>{let s=t(...n);return`\x1B[${38+e};5;${s}m`},Ih=(t,e)=>(...n)=>{let s=t(...n);return`\x1B[${38+e};2;${s[0]};${s[1]};${s[2]}m`},$r=t=>t,Rh=(t,e,n)=>[t,e,n],ms=(t,e,n)=>{Object.defineProperty(t,e,{get:()=>{let s=n();return Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},pc,hs=(t,e,n,s)=>{pc===void 0&&(pc=Ph());let o=s?10:0,r={};for(let[i,a]of Object.entries(pc)){let c=i==="ansi16"?"ansi":i;i===e?r[c]=t(n,o):typeof a=="object"&&(r[c]=t(a[e],o))}return r};function qC(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[n,s]of Object.entries(e)){for(let[o,r]of Object.entries(s))e[o]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[o]=e[o],t.set(r[0],r[1]);Object.defineProperty(e,n,{value:s,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",ms(e.color,"ansi",()=>hs($h,"ansi16",$r,!1)),ms(e.color,"ansi256",()=>hs(Nh,"ansi256",$r,!1)),ms(e.color,"ansi16m",()=>hs(Ih,"rgb",Rh,!1)),ms(e.bgColor,"ansi",()=>hs($h,"ansi16",$r,!0)),ms(e.bgColor,"ansi256",()=>hs(Nh,"ansi256",$r,!0)),ms(e.bgColor,"ansi16m",()=>hs(Ih,"rgb",Rh,!0)),e}Object.defineProperty(Fh,"exports",{enumerable:!0,get:qC})});var Hh=D((lM,Uh)=>{"use strict";var lo=Tr(),MC=Or(),UC=jh(),Nr=new Set(["\x1B","\x9B"]),HC=39,fc="\x07",qh="[",zC="]",Mh="m",mc=`${zC}8;;`,Lh=t=>`${Nr.values().next().value}${qh}${t}${Mh}`,Bh=t=>`${Nr.values().next().value}${mc}${t}${fc}`,WC=t=>t.split(" ").map(e=>lo(e)),dc=(t,e,n)=>{let s=[...e],o=!1,r=!1,i=lo(MC(t[t.length-1]));for(let[a,c]of s.entries()){let l=lo(c);if(i+l<=n?t[t.length-1]+=c:(t.push(c),i=0),Nr.has(c)&&(o=!0,r=s.slice(a+1).join("").startsWith(mc)),o){r?c===fc&&(o=!1,r=!1):c===Mh&&(o=!1);continue}i+=l,i===n&&a<s.length-1&&(t.push(""),i=0)}!i&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},JC=t=>{let e=t.split(" "),n=e.length;for(;n>0&&!(lo(e[n-1])>0);)n--;return n===e.length?t:e.slice(0,n).join(" ")+e.slice(n).join("")},KC=(t,e,n={})=>{if(n.trim!==!1&&t.trim()==="")return"";let s="",o,r,i=WC(t),a=[""];for(let[l,u]of t.split(" ").entries()){n.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let p=lo(a[a.length-1]);if(l!==0&&(p>=e&&(n.wordWrap===!1||n.trim===!1)&&(a.push(""),p=0),(p>0||n.trim===!1)&&(a[a.length-1]+=" ",p++)),n.hard&&i[l]>e){let d=e-p,f=1+Math.floor((i[l]-d-1)/e);Math.floor((i[l]-1)/e)<f&&a.push(""),dc(a,u,e);continue}if(p+i[l]>e&&p>0&&i[l]>0){if(n.wordWrap===!1&&p<e){dc(a,u,e);continue}a.push("")}if(p+i[l]>e&&n.wordWrap===!1){dc(a,u,e);continue}a[a.length-1]+=u}n.trim!==!1&&(a=a.map(JC));let c=[...a.join(`
|
|
24
|
+
`)];for(let[l,u]of c.entries()){if(s+=u,Nr.has(u)){let{groups:d}=new RegExp(`(?:\\${qh}(?<code>\\d+)m|\\${mc}(?<uri>.*)${fc})`).exec(c.slice(l).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);o=f===HC?void 0:f}else d.uri!==void 0&&(r=d.uri.length===0?void 0:d.uri)}let p=UC.codes.get(Number(o));c[l+1]===`
|
|
25
|
+
`?(r&&(s+=Bh("")),o&&p&&(s+=Lh(p))):u===`
|
|
26
|
+
`&&(o&&p&&(s+=Lh(o)),r&&(s+=Bh(r)))}return s};Uh.exports=(t,e,n)=>String(t).normalize().replace(/\r\n/g,`
|
|
27
|
+
`).split(`
|
|
28
|
+
`).map(s=>KC(s,e,n)).join(`
|
|
29
|
+
`)});var Jh=D((uM,Wh)=>{"use strict";var GC={right:ZC,center:eO},VC=0,Ir=1,YC=2,Rr=3,hc=class{constructor(e){var n;this.width=e.width,this.wrap=(n=e.wrap)!==null&&n!==void 0?n:!0,this.rows=[]}span(...e){let n=this.div(...e);n.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let n=e.map(s=>typeof s=="string"?this.colFromString(s):s);return this.rows.push(n),n}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let n=e.split(`
|
|
30
|
+
`).map(o=>o.split(" ")),s=0;return n.forEach(o=>{o.length>1&&dt.stringWidth(o[0])>s&&(s=Math.min(Math.floor(this.width*.5),dt.stringWidth(o[0])))}),n.forEach(o=>{this.div(...o.map((r,i)=>({text:r.trim(),padding:this.measurePadding(r),width:i===0&&o.length>1?s:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let n=dt.stripAnsi(e);return[0,n.match(/\s*$/)[0].length,0,n.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(n=>{this.rowToString(n,e)}),e.filter(n=>!n.hidden).map(n=>n.text).join(`
|
|
31
|
+
`)}rowToString(e,n){return this.rasterize(e).forEach((s,o)=>{let r="";s.forEach((i,a)=>{let{width:c}=e[a],l=this.negatePadding(e[a]),u=i;if(l>dt.stringWidth(i)&&(u+=" ".repeat(l-dt.stringWidth(i))),e[a].align&&e[a].align!=="left"&&this.wrap){let d=GC[e[a].align];u=d(u,l),dt.stringWidth(u)<l&&(u+=" ".repeat((c||0)-dt.stringWidth(u)-1))}let p=e[a].padding||[0,0,0,0];p[Rr]&&(r+=" ".repeat(p[Rr])),r+=zh(e[a],u,"| "),r+=u,r+=zh(e[a],u," |"),p[Ir]&&(r+=" ".repeat(p[Ir])),o===0&&n.length>0&&(r=this.renderInline(r,n[n.length-1]))}),n.push({text:r.replace(/ +$/,""),span:e.span})}),n}renderInline(e,n){let s=e.match(/^ */),o=s?s[0].length:0,r=n.text,i=dt.stringWidth(r.trimRight());return n.span?this.wrap?o<i?e:(n.hidden=!0,r.trimRight()+" ".repeat(o-i)+e.trimLeft()):(n.hidden=!0,r+e):e}rasterize(e){let n=[],s=this.columnWidths(e),o;return e.forEach((r,i)=>{r.width=s[i],this.wrap?o=dt.wrap(r.text,this.negatePadding(r),{hard:!0}).split(`
|
|
32
|
+
`):o=r.text.split(`
|
|
33
|
+
`),r.border&&(o.unshift("."+"-".repeat(this.negatePadding(r)+2)+"."),o.push("'"+"-".repeat(this.negatePadding(r)+2)+"'")),r.padding&&(o.unshift(...new Array(r.padding[VC]||0).fill("")),o.push(...new Array(r.padding[YC]||0).fill(""))),o.forEach((a,c)=>{n[c]||n.push([]);let l=n[c];for(let u=0;u<i;u++)l[u]===void 0&&l.push("");l.push(a)})}),n}negatePadding(e){let n=e.width||0;return e.padding&&(n-=(e.padding[Rr]||0)+(e.padding[Ir]||0)),e.border&&(n-=4),n}columnWidths(e){if(!this.wrap)return e.map(i=>i.width||dt.stringWidth(i.text));let n=e.length,s=this.width,o=e.map(i=>{if(i.width)return n--,s-=i.width,i.width}),r=n?Math.floor(s/n):0;return o.map((i,a)=>i===void 0?Math.max(r,XC(e[a])):i)}};function zh(t,e,n){return t.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?n:" ":""}function XC(t){let e=t.padding||[],n=1+(e[Rr]||0)+(e[Ir]||0);return t.border?n+4:n}function QC(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function ZC(t,e){t=t.trim();let n=dt.stringWidth(t);return n<e?" ".repeat(e-n)+t:t}function eO(t,e){t=t.trim();let n=dt.stringWidth(t);return n>=e?t:" ".repeat(e-n>>1)+t}var dt;function tO(t,e){return dt=e,new hc({width:t?.width||QC(),wrap:t?.wrap})}var nO=Tr(),sO=Or(),oO=Hh();function rO(t){return tO(t,{stringWidth:nO,stripAnsi:sO,wrap:oO})}Wh.exports=rO});var Yh=D((pM,Vh)=>{var{dirname:Kh,resolve:Gh}=require("path"),{readdirSync:iO,statSync:aO}=require("fs");Vh.exports=function(t,e){let n=Gh(".",t),s;for(aO(n).isDirectory()||(n=Kh(n));;){if(s=e(n,iO(n)),s)return Gh(n,s);if(n=Kh(s=n),s===n)break}}});var Qh=D((dM,Xh)=>{"use strict";Xh.exports=function(e){if(e===void 0&&(e=2),e>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+e+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");var n=Error.prepareStackTrace;Error.prepareStackTrace=function(o,r){return r};var s=new Error().stack;if(Error.prepareStackTrace=n,s!==null&&typeof s=="object")return s[e]?s[e].getFileName():void 0}});var ng=D((fM,yc)=>{"use strict";var Zh=require("fs"),cO=require("path").join,lO=require("path").resolve,eg=require("path").dirname,gc={extensions:["js","json","coffee"],recurse:!0,rename:function(t){return t},visit:function(t){return t}};function uO(t,e,n){return new RegExp("\\.("+n.extensions.join("|")+")$","i").test(e)&&!(n.include&&n.include instanceof RegExp&&!n.include.test(t))&&!(n.include&&typeof n.include=="function"&&!n.include(t,e))&&!(n.exclude&&n.exclude instanceof RegExp&&n.exclude.test(t))&&!(n.exclude&&typeof n.exclude=="function"&&n.exclude(t,e))}function tg(t,e,n){var s={};e&&!n&&typeof e!="string"&&(n=e,e=null),n=n||{};for(var o in gc)typeof n[o]>"u"&&(n[o]=gc[o]);return e=e?lO(eg(t.filename),e):eg(t.filename),Zh.readdirSync(e).forEach(function(r){var i=cO(e,r),a,c,l;Zh.statSync(i).isDirectory()&&n.recurse?(a=tg(t,i,n),Object.keys(a).length&&(s[n.rename(r,i,r)]=a)):i!==t.filename&&uO(i,r,n)&&(c=r.substring(0,r.lastIndexOf(".")),l=t.require(i),s[n.rename(c,i,r)]=n.visit(l,i,r)||l)}),s}yc.exports=tg;yc.exports.defaults=gc});var Bc=D((mM,Ig)=>{"use strict";var sg=require("assert"),Ve=class t extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}},uo,bc=[];function Kr(t,e,n,s){uo=s;let o={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if(typeof t.extends!="string")return o;let r=/\.json|\..*rc$/.test(t.extends),i=null;if(r)i=function(a,c){return uo.path.resolve(a,c)}(e,t.extends);else try{i=require.resolve(t.extends)}catch{return t}(function(a){if(bc.indexOf(a)>-1)throw new Ve(`Circular extended configurations: '${a}'.`)})(i),bc.push(i),o=r?JSON.parse(uo.readFileSync(i,"utf8")):require(t.extends),delete t.extends,o=Kr(o,uo.path.dirname(i),n,uo)}return bc=[],n?Pg(o,t):Object.assign({},o,t)}function Pg(t,e){let n={};function s(o){return o&&typeof o=="object"&&!Array.isArray(o)}Object.assign(n,t);for(let o of Object.keys(e))s(e[o])&&s(n[o])?n[o]=Pg(t[o],e[o]):n[o]=e[o];return n}function ws(t){let e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=e.shift();if(!s)throw new Error(`No command found in: ${t}`);let o={cmd:s.replace(n,""),demanded:[],optional:[]};return e.forEach((r,i)=>{let a=!1;r=r.replace(/\s/g,""),/\.+[\]>]/.test(r)&&i===e.length-1&&(a=!0),/^\[/.test(r)?o.optional.push({cmd:r.replace(n,"").split("|"),variadic:a}):o.demanded.push({cmd:r.replace(n,"").split("|"),variadic:a})}),o}var pO=["first","second","third","fourth","fifth","sixth"];function K(t,e,n){try{let s=0,[o,r,i]=typeof t=="object"?[{demanded:[],optional:[]},t,e]:[ws(`cmd ${t}`),e,n],a=[].slice.call(r);for(;a.length&&a[a.length-1]===void 0;)a.pop();let c=i||a.length;if(c<o.demanded.length)throw new Ve(`Not enough arguments provided. Expected ${o.demanded.length} but received ${a.length}.`);let l=o.demanded.length+o.optional.length;if(c>l)throw new Ve(`Too many arguments provided. Expected max ${l} but received ${c}.`);o.demanded.forEach(u=>{let p=og(a.shift());u.cmd.filter(d=>d===p||d==="*").length===0&&rg(p,u.cmd,s),s+=1}),o.optional.forEach(u=>{if(a.length===0)return;let p=og(a.shift());u.cmd.filter(d=>d===p||d==="*").length===0&&rg(p,u.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function og(t){return Array.isArray(t)?"array":t===null?"null":typeof t}function rg(t,e,n){throw new Ve(`Invalid ${pO[n]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}function Ie(t){return!!t&&!!t.then&&typeof t.then=="function"}function _t(t,e,n,s){n.assert.notStrictEqual(t,e,s)}function ig(t,e){e.assert.strictEqual(typeof t,"string")}function Jr(t){return Object.keys(t)}function vs(t={},e=()=>!0){let n={};return Jr(t).forEach(s=>{e(s,t[s])&&(n[s]=t[s])}),n}function $g(){return process.versions.electron&&!process.defaultApp?0:1}function Ng(){return process.argv[$g()]}var dO=Object.freeze({__proto__:null,hideBin:function(t){return t.slice($g()+1)},getProcessArgvBin:Ng});function y(t,e,n,s){if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(t):s?s.value:e.get(t)}function J(t,e,n,s,o){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?o.call(t,n):o?o.value=n:e.set(t,n),n}var Nc=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,n,s=!0,o=!1){if(K("<array|function> [boolean] [boolean] [boolean]",[e,n,s],arguments.length),Array.isArray(e)){for(let r=0;r<e.length;r++){if(typeof e[r]!="function")throw Error("middleware must be a function");let i=e[r];i.applyBeforeValidation=n,i.global=s}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let r=e;r.applyBeforeValidation=n,r.global=s,r.mutates=o,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,n){let s=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(o=>{let r=[...s[n]||[],n];return!o.option||!r.includes(o.option)}),e.option=n,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function ho(t,e,n,s){return n.reduce((o,r)=>{if(r.applyBeforeValidation!==s)return o;if(r.mutates){if(r.applied)return o;r.applied=!0}if(Ie(o))return o.then(i=>Promise.all([i,r(i,e)])).then(([i,a])=>Object.assign(i,a));{let i=r(o,e);return Ie(i)?i.then(a=>Object.assign(o,a)):Object.assign(o,i)}},t)}function go(t,e,n=s=>{throw s}){try{let s=typeof t=="function"?t():t;return Ie(s)?s.then(o=>e(o)):e(s)}catch(s){return n(s)}}var gs=/(^\*)|(^\$0)/,Ic=class{constructor(e,n,s,o){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=o,this.usage=e,this.globalMiddleware=s,this.validation=n}addDirectory(e,n,s,o){typeof(o=o||{}).recurse!="boolean"&&(o.recurse=!1),Array.isArray(o.extensions)||(o.extensions=["js"]);let r=typeof o.visit=="function"?o.visit:i=>i;o.visit=(i,a,c)=>{let l=r(i,a,c);if(l){if(this.requireCache.has(a))return l;this.requireCache.add(a),this.addHandler(l)}return l},this.shim.requireDirectory({require:n,filename:s},e,o)}addHandler(e,n,s,o,r,i){let a=[],c=function(l){return l?l.map(u=>(u.applyBeforeValidation=!1,u)):[]}(r);if(o=o||(()=>{}),Array.isArray(e))if(function(l){return l.every(u=>typeof u=="string")}(e))[e,...a]=e;else for(let l of e)this.addHandler(l);else{if(function(l){return typeof l=="object"&&!Array.isArray(l)}(e)){let l=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);return e.aliases&&(l=[].concat(l).concat(e.aliases)),void this.addHandler(l,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated)}if(ag(s))return void this.addHandler([e].concat(a),n,s.builder,s.handler,s.middlewares,s.deprecated)}if(typeof e=="string"){let l=ws(e);a=a.map(d=>ws(d).cmd);let u=!1,p=[l.cmd].concat(a).filter(d=>!gs.test(d)||(u=!0,!1));p.length===0&&u&&p.push("$0"),u&&(l.cmd=p[0],a=p.slice(1),e=e.replace(gs,l.cmd)),a.forEach(d=>{this.aliasMap[d]=l.cmd}),n!==!1&&this.usage.command(e,n,u,a,i),this.handlers[l.cmd]={original:e,description:n,handler:o,builder:s||{},middlewares:c,deprecated:i,demanded:l.demanded,optional:l.optional},u&&(this.defaultCommand=this.handlers[l.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,n,s,o,r,i){let a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,c=n.getInternalMethods().getContext(),l=c.commands.slice(),u=!e;e&&(c.commands.push(e),c.fullCommands.push(a.original));let p=this.applyBuilderUpdateUsageAndParse(u,a,n,s.aliases,l,o,r,i);return Ie(p)?p.then(d=>this.applyMiddlewareAndGetResult(u,a,d.innerArgv,c,r,d.aliases,n)):this.applyMiddlewareAndGetResult(u,a,p.innerArgv,c,r,p.aliases,n)}applyBuilderUpdateUsageAndParse(e,n,s,o,r,i,a,c){let l=n.builder,u=s;if(Rc(l)){s.getInternalMethods().getUsageInstance().freeze();let p=l(s.getInternalMethods().reset(o),c);if(Ie(p))return p.then(d=>{var f;return u=(f=d)&&typeof f.getInternalMethods=="function"?d:s,this.parseAndUpdateUsage(e,n,u,r,i,a)})}else(function(p){return typeof p=="object"})(l)&&(s.getInternalMethods().getUsageInstance().freeze(),u=s.getInternalMethods().reset(o),Object.keys(n.builder).forEach(p=>{u.option(p,l[p])}));return this.parseAndUpdateUsage(e,n,u,r,i,a)}parseAndUpdateUsage(e,n,s,o,r,i){e&&s.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(o,n),n.description);let a=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,r,i);return Ie(a)?a.then(c=>({aliases:s.parsed.aliases,innerArgv:c})):{aliases:s.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,n){let s=gs.test(n.original)?n.original.replace(gs,"").trim():n.original,o=e.filter(r=>!gs.test(r));return o.push(s),`$0 ${o.join(" ")}`}handleValidationAndGetResult(e,n,s,o,r,i,a,c){if(!i.getInternalMethods().getHasOutput()){let l=i.getInternalMethods().runValidation(r,c,i.parsed.error,e);s=go(s,u=>(l(u),u))}if(n.handler&&!i.getInternalMethods().getHasOutput()){i.getInternalMethods().setHasOutput();let l=!!i.getOptions().configuration["populate--"];i.getInternalMethods().postProcess(s,l,!1,!1),s=go(s=ho(s,i,a,!1),u=>{let p=n.handler(u);return Ie(p)?p.then(()=>u):u}),e||i.getInternalMethods().getUsageInstance().cacheHelpMessage(),Ie(s)&&!i.getInternalMethods().hasParseCallback()&&s.catch(u=>{try{i.getInternalMethods().getUsageInstance().fail(null,u)}catch{}})}return e||(o.commands.pop(),o.fullCommands.pop()),s}applyMiddlewareAndGetResult(e,n,s,o,r,i,a){let c={};if(r)return s;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(n,s,o,a));let l=this.globalMiddleware.getMiddleware().slice(0).concat(n.middlewares),u=ho(s,a,l,!0);return Ie(u)?u.then(p=>this.handleValidationAndGetResult(e,n,p,o,i,a,l,c)):this.handleValidationAndGetResult(e,n,u,o,i,a,l,c)}populatePositionals(e,n,s,o){n._=n._.slice(s.commands.length);let r=e.demanded.slice(0),i=e.optional.slice(0),a={};for(this.validation.positionalCount(r.length,n._.length);r.length;){let c=r.shift();this.populatePositional(c,n,a)}for(;i.length;){let c=i.shift();this.populatePositional(c,n,a)}return n._=s.commands.concat(n._.map(c=>""+c)),this.postProcessPositionals(n,a,this.cmdToParseOptions(e.original),o),a}populatePositional(e,n,s){let o=e.cmd[0];e.variadic?s[o]=n._.splice(0).map(String):n._.length&&(s[o]=[String(n._.shift())])}cmdToParseOptions(e){let n={array:[],default:{},alias:{},demand:{}},s=ws(e);return s.demanded.forEach(o=>{let[r,...i]=o.cmd;o.variadic&&(n.array.push(r),n.default[r]=[]),n.alias[r]=i,n.demand[r]=!0}),s.optional.forEach(o=>{let[r,...i]=o.cmd;o.variadic&&(n.array.push(r),n.default[r]=[]),n.alias[r]=i}),n}postProcessPositionals(e,n,s,o){let r=Object.assign({},o.getOptions());r.default=Object.assign(s.default,r.default);for(let l of Object.keys(s.alias))r.alias[l]=(r.alias[l]||[]).concat(s.alias[l]);r.array=r.array.concat(s.array),r.config={};let i=[];if(Object.keys(n).forEach(l=>{n[l].map(u=>{r.configuration["unknown-options-as-args"]&&(r.key[l]=!0),i.push(`--${l}`),i.push(u)})}),!i.length)return;let a=Object.assign({},r.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(i,Object.assign({},r,{configuration:a}));if(c.error)o.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{let l=Object.keys(n);Object.keys(n).forEach(u=>{l.push(...c.aliases[u])}),Object.keys(c.argv).forEach(u=>{l.includes(u)&&(n[u]||(n[u]=c.argv[u]),!this.isInConfigs(o,u)&&!this.isDefaulted(o,u)&&Object.prototype.hasOwnProperty.call(e,u)&&Object.prototype.hasOwnProperty.call(c.argv,u)&&(Array.isArray(e[u])||Array.isArray(c.argv[u]))?e[u]=[].concat(e[u],c.argv[u]):e[u]=c.argv[u])})}}isDefaulted(e,n){let{default:s}=e.getOptions();return Object.prototype.hasOwnProperty.call(s,n)||Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(n))}isInConfigs(e,n){let{configObjects:s}=e.getOptions();return s.some(o=>Object.prototype.hasOwnProperty.call(o,n))||s.some(o=>Object.prototype.hasOwnProperty.call(o,this.shim.Parser.camelCase(n)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let s=gs.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(s,this.defaultCommand.description)}let n=this.defaultCommand.builder;if(Rc(n))return n(e,!0);ag(n)||Object.keys(n).forEach(s=>{e.option(s,n[s])})}moduleName(e){let n=function(s){if(typeof require>"u")return null;for(let o,r=0,i=Object.keys(require.cache);r<i.length;r++)if(o=require.cache[i[r]],o.exports===s)return o;return null}(e);if(!n)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(n.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:n,desc:s}){for(let o of[e,n,s]){if(typeof o=="string"||o===!1)return o;_t(o,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();_t(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function ag(t){return typeof t=="object"&&!!t.builder&&typeof t.handler=="function"}function Rc(t){return typeof t=="function"}function mo(t){typeof process<"u"&&[process.stdout,process.stderr].forEach(e=>{let n=e;n._handle&&n.isTTY&&typeof n._handle.setBlocking=="function"&&n._handle.setBlocking(t)})}function fO(t){return typeof t=="boolean"}function mO(t,e){let n=e.y18n.__,s={},o=[];s.failFn=function($){o.push($)};let r=null,i=null,a=!0;s.showHelpOnFail=function($=!0,I){let[R,U]=typeof $=="string"?[!0,$]:[$,I];return t.getInternalMethods().isGlobalContext()&&(i=U),r=U,a=R,s};let c=!1;s.fail=function($,I){let R=t.getInternalMethods().getLoggerInstance();if(!o.length){if(t.getExitProcess()&&mo(!0),!c){c=!0,a&&(t.showHelp("error"),R.error()),($||I)&&R.error($||I);let U=r||i;U&&(($||I)&&R.error(""),R.error(U))}if(I=I||new Ve($),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,I);throw I}for(let U=o.length-1;U>=0;--U){let Q=o[U];if(fO(Q)){if(I)throw I;if($)throw Error($)}else Q($,I,s)}};let l=[],u=!1;s.usage=($,I)=>$===null?(u=!0,l=[],s):(u=!1,l.push([$,I||""]),s),s.getUsage=()=>l,s.getUsageDisabled=()=>u,s.getPositionalGroupName=()=>n("Positionals:");let p=[];s.example=($,I)=>{p.push([$,I||""])};let d=[];s.command=function($,I,R,U,Q=!1){R&&(d=d.map(M=>(M[2]=!1,M))),d.push([$,I||"",R,U,Q])},s.getCommands=()=>d;let f={};s.describe=function($,I){Array.isArray($)?$.forEach(R=>{s.describe(R,I)}):typeof $=="object"?Object.keys($).forEach(R=>{s.describe(R,$[R])}):f[$]=I},s.getDescriptions=()=>f;let m=[];s.epilog=$=>{m.push($)};let h,g=!1;s.wrap=$=>{g=!0,h=$},s.getWrap=()=>e.getEnv("YARGS_DISABLE_WRAP")?null:(g||(h=function(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}(),g=!0),h);let b="__yargsString__:";function v($,I,R){let U=0;return Array.isArray($)||($=Object.values($).map(Q=>[Q])),$.forEach(Q=>{U=Math.max(e.stringWidth(R?`${R} ${Fr(Q[0])}`:Fr(Q[0]))+cg(Q[0]),U)}),I&&(U=Math.min(U,parseInt((.5*I).toString(),10))),U}let E;function S($){return t.getOptions().hiddenOptions.indexOf($)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function C($,I){let R=`[${n("default:")} `;if($===void 0&&!I)return null;if(I)R+=I;else switch(typeof $){case"string":R+=`"${$}"`;break;case"object":R+=JSON.stringify($);break;default:R+=$}return`${R}]`}s.deferY18nLookup=$=>b+$,s.help=function(){if(E)return E;(function(){let F=t.getDemandedOptions(),H=t.getOptions();(Object.keys(H.alias)||[]).forEach(W=>{H.alias[W].forEach(N=>{f[N]&&s.describe(W,f[N]),N in F&&t.demandOption(W,F[N]),H.boolean.includes(N)&&t.boolean(W),H.count.includes(N)&&t.count(W),H.string.includes(N)&&t.string(W),H.normalize.includes(N)&&t.normalize(W),H.array.includes(N)&&t.array(W),H.number.includes(N)&&t.number(W)})})})();let $=t.customScriptName?t.$0:e.path.basename(t.$0),I=t.getDemandedOptions(),R=t.getDemandedCommands(),U=t.getDeprecatedOptions(),Q=t.getGroups(),M=t.getOptions(),z=[];z=z.concat(Object.keys(f)),z=z.concat(Object.keys(I)),z=z.concat(Object.keys(R)),z=z.concat(Object.keys(M.default)),z=z.filter(S),z=Object.keys(z.reduce((F,H)=>(H!=="_"&&(F[H]=!0),F),{}));let ge=s.getWrap(),oe=e.cliui({width:ge,wrap:!!ge});if(!u){if(l.length)l.forEach(F=>{oe.div({text:`${F[0].replace(/\$0/g,$)}`}),F[1]&&oe.div({text:`${F[1]}`,padding:[1,0,0,0]})}),oe.div();else if(d.length){let F=null;F=R._?`${$} <${n("command")}>
|
|
34
|
+
`:`${$} [${n("command")}]
|
|
35
|
+
`,oe.div(`${F}`)}}if(d.length>1||d.length===1&&!d[0][2]){oe.div(n("Commands:"));let F=t.getInternalMethods().getContext(),H=F.commands.length?`${F.commands.join(" ")} `:"";t.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(d=d.sort((N,ce)=>N[0].localeCompare(ce[0])));let W=$?`${$} `:"";d.forEach(N=>{let ce=`${W}${H}${N[0].replace(/^\$0 ?/,"")}`;oe.span({text:ce,padding:[0,2,0,2],width:v(d,ge,`${$}${H}`)+4},{text:N[1]});let pe=[];N[2]&&pe.push(`[${n("default")}]`),N[3]&&N[3].length&&pe.push(`[${n("aliases:")} ${N[3].join(", ")}]`),N[4]&&(typeof N[4]=="string"?pe.push(`[${n("deprecated: %s",N[4])}]`):pe.push(`[${n("deprecated")}]`)),pe.length?oe.div({text:pe.join(" "),padding:[0,0,0,2],align:"right"}):oe.div()}),oe.div()}let xe=(Object.keys(M.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);z=z.filter(F=>!t.parsed.newAliases[F]&&xe.every(H=>(M.alias[H]||[]).indexOf(F)===-1));let Ee=n("Options:");Q[Ee]||(Q[Ee]=[]),function(F,H,W,N){let ce=[],pe=null;Object.keys(W).forEach(Z=>{ce=ce.concat(W[Z])}),F.forEach(Z=>{pe=[Z].concat(H[Z]),pe.some(me=>ce.indexOf(me)!==-1)||W[N].push(Z)})}(z,M.alias,Q,Ee);let ve=F=>/^--/.test(Fr(F)),Me=Object.keys(Q).filter(F=>Q[F].length>0).map(F=>({groupName:F,normalizedKeys:Q[F].filter(S).map(H=>{if(xe.includes(H))return H;for(let W,N=0;(W=xe[N])!==void 0;N++)if((M.alias[W]||[]).includes(H))return W;return H})})).filter(({normalizedKeys:F})=>F.length>0).map(({groupName:F,normalizedKeys:H})=>{let W=H.reduce((N,ce)=>(N[ce]=[ce].concat(M.alias[ce]||[]).map(pe=>F===s.getPositionalGroupName()?pe:(/^[0-9]$/.test(pe)?M.boolean.includes(ce)?"-":"--":pe.length>1?"--":"-")+pe).sort((pe,Z)=>ve(pe)===ve(Z)?0:ve(pe)?1:-1).join(", "),N),{});return{groupName:F,normalizedKeys:H,switches:W}});if(Me.filter(({groupName:F})=>F!==s.getPositionalGroupName()).some(({normalizedKeys:F,switches:H})=>!F.every(W=>ve(H[W])))&&Me.filter(({groupName:F})=>F!==s.getPositionalGroupName()).forEach(({normalizedKeys:F,switches:H})=>{F.forEach(W=>{var N,ce;ve(H[W])&&(H[W]=(N=H[W],ce=4,Lc(N)?{text:N.text,indentation:N.indentation+ce}:{text:N,indentation:ce}))})}),Me.forEach(({groupName:F,normalizedKeys:H,switches:W})=>{oe.div(F),H.forEach(N=>{let ce=W[N],pe=f[N]||"",Z=null;pe.includes(b)&&(pe=n(pe.substring(16))),M.boolean.includes(N)&&(Z=`[${n("boolean")}]`),M.count.includes(N)&&(Z=`[${n("count")}]`),M.string.includes(N)&&(Z=`[${n("string")}]`),M.normalize.includes(N)&&(Z=`[${n("string")}]`),M.array.includes(N)&&(Z=`[${n("array")}]`),M.number.includes(N)&&(Z=`[${n("number")}]`);let me=[N in U?(_e=U[N],typeof _e=="string"?`[${n("deprecated: %s",_e)}]`:`[${n("deprecated")}]`):null,Z,N in I?`[${n("required")}]`:null,M.choices&&M.choices[N]?`[${n("choices:")} ${s.stringifiedValues(M.choices[N])}]`:null,C(M.default[N],M.defaultDescription[N])].filter(Boolean).join(" ");var _e;oe.span({text:Fr(ce),padding:[0,2,0,2+cg(ce)],width:v(W,ge)+4},pe);let ie=t.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;me&&!ie?oe.div({text:me,padding:[0,0,0,2],align:"right"}):oe.div()}),oe.div()}),p.length&&(oe.div(n("Examples:")),p.forEach(F=>{F[0]=F[0].replace(/\$0/g,$)}),p.forEach(F=>{F[1]===""?oe.div({text:F[0],padding:[0,2,0,2]}):oe.div({text:F[0],padding:[0,2,0,2],width:v(p,ge)+4},{text:F[1]})}),oe.div()),m.length>0){let F=m.map(H=>H.replace(/\$0/g,$)).join(`
|
|
36
|
+
`);oe.div(`${F}
|
|
37
|
+
`)}return oe.toString().replace(/\s*$/,"")},s.cacheHelpMessage=function(){E=this.help()},s.clearCachedHelpMessage=function(){E=void 0},s.hasCachedHelpMessage=function(){return!!E},s.showHelp=$=>{let I=t.getInternalMethods().getLoggerInstance();$||($="error"),(typeof $=="function"?$:I[$])(s.help())},s.functionDescription=$=>["(",$.name?e.Parser.decamelize($.name,"-"):n("generated-value"),")"].join(""),s.stringifiedValues=function($,I){let R="",U=I||", ",Q=[].concat($);return $&&Q.length&&Q.forEach(M=>{R.length&&(R+=U),R+=JSON.stringify(M)}),R};let B=null;s.version=$=>{B=$},s.showVersion=$=>{let I=t.getInternalMethods().getLoggerInstance();$||($="error"),(typeof $=="function"?$:I[$])(B)},s.reset=function($){return r=null,c=!1,l=[],u=!1,m=[],p=[],d=[],f=vs(f,I=>!$[I]),s};let L=[];return s.freeze=function(){L.push({failMessage:r,failureOutput:c,usages:l,usageDisabled:u,epilogs:m,examples:p,commands:d,descriptions:f})},s.unfreeze=function($=!1){let I=L.pop();I&&($?(f={...I.descriptions,...f},d=[...I.commands,...d],l=[...I.usages,...l],p=[...I.examples,...p],m=[...I.epilogs,...m]):{failMessage:r,failureOutput:c,usages:l,usageDisabled:u,epilogs:m,examples:p,commands:d,descriptions:f}=I)},s}function Lc(t){return typeof t=="object"}function cg(t){return Lc(t)?t.indentation:0}function Fr(t){return Lc(t)?t.text:t}var Fc=class{constructor(e,n,s,o){var r,i,a;this.yargs=e,this.usage=n,this.command=s,this.shim=o,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(a=((r=this.shim.getEnv("SHELL"))===null||r===void 0?void 0:r.includes("zsh"))||((i=this.shim.getEnv("ZSH_NAME"))===null||i===void 0?void 0:i.includes("zsh")))!==null&&a!==void 0&&a}defaultCompletion(e,n,s,o){let r=this.command.getCommandHandlers();for(let a=0,c=e.length;a<c;++a)if(r[e[a]]&&r[e[a]].builder){let l=r[e[a]].builder;if(Rc(l)){this.indexAfterLastReset=a+1;let u=this.yargs.getInternalMethods().reset();return l(u,!0),u.argv}}let i=[];this.commandCompletions(i,e,s),this.optionCompletions(i,e,n,s),this.choicesFromOptionsCompletions(i,e,n,s),this.choicesFromPositionalsCompletions(i,e,n,s),o(null,i)}commandCompletions(e,n,s){let o=this.yargs.getInternalMethods().getContext().commands;s.match(/^-/)||o[o.length-1]===s||this.previousArgHasChoices(n)||this.usage.getCommands().forEach(r=>{let i=ws(r[0]).cmd;if(n.indexOf(i)===-1)if(this.zshShell){let a=r[1]||"";e.push(i.replace(/:/g,"\\:")+":"+a)}else e.push(i)})}optionCompletions(e,n,s,o){if((o.match(/^-/)||o===""&&e.length===0)&&!this.previousArgHasChoices(n)){let r=this.yargs.getOptions(),i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(r.key).forEach(a=>{let c=!!r.configuration["boolean-negation"]&&r.boolean.includes(a);i.includes(a)||r.hiddenOptions.includes(a)||this.argsContainKey(n,a,c)||this.completeOptionKey(a,e,o,c&&!!r.default[a])})}}choicesFromOptionsCompletions(e,n,s,o){if(this.previousArgHasChoices(n)){let r=this.getPreviousArgChoices(n);r&&r.length>0&&e.push(...r.map(i=>i.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,n,s,o){if(o===""&&e.length>0&&this.previousArgHasChoices(n))return;let r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],i=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),a=r[s._.length-i-1];if(!a)return;let c=this.yargs.getOptions().choices[a]||[];for(let l of c)l.startsWith(o)&&e.push(l.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let n=e[e.length-1],s="";if(!n.startsWith("-")&&e.length>1&&(s=n,n=e[e.length-2]),!n.startsWith("-"))return;let o=n.replace(/^-+/,""),r=this.yargs.getOptions(),i=[o,...this.yargs.getAliases()[o]||[]],a;for(let c of i)if(Object.prototype.hasOwnProperty.call(r.key,c)&&Array.isArray(r.choices[c])){a=r.choices[c];break}return a?a.filter(c=>!s||c.startsWith(s)):void 0}previousArgHasChoices(e){let n=this.getPreviousArgChoices(e);return n!==void 0&&n.length>0}argsContainKey(e,n,s){let o=r=>e.indexOf((/^[^0-9]$/.test(r)?"-":"--")+r)!==-1;if(o(n)||s&&o(`no-${n}`))return!0;if(this.aliases){for(let r of this.aliases[n])if(o(r))return!0}return!1}completeOptionKey(e,n,s,o){var r,i,a,c;let l=e;if(this.zshShell){let p=this.usage.getDescriptions(),d=(i=(r=this==null?void 0:this.aliases)===null||r===void 0?void 0:r[e])===null||i===void 0?void 0:i.find(h=>{let g=p[h];return typeof g=="string"&&g.length>0}),f=d?p[d]:void 0,m=(c=(a=p[e])!==null&&a!==void 0?a:f)!==null&&c!==void 0?c:"";l=`${e.replace(/:/g,"\\:")}:${m.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let u=!/^--/.test(s)&&(p=>/^[^0-9]$/.test(p))(e)?"-":"--";n.push(u+l),o&&n.push(u+"no-"+l)}customCompletion(e,n,s,o){if(_t(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){let r=this.customCompletionFunction(s,n);return Ie(r)?r.then(i=>{this.shim.process.nextTick(()=>{o(null,i)})}).catch(i=>{this.shim.process.nextTick(()=>{o(i,void 0)})}):o(null,r)}return function(r){return r.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,n,(r=o)=>this.defaultCompletion(e,n,s,r),r=>{o(null,r)}):this.customCompletionFunction(s,n,r=>{o(null,r)})}getCompletion(e,n){let s=e.length?e[e.length-1]:"",o=this.yargs.parse(e,!0),r=this.customCompletionFunction?i=>this.customCompletion(e,i,s,n):i=>this.defaultCompletion(e,i,s,n);return Ie(o)?o.then(r):r(o)}generateCompletionScript(e,n){let s=this.zshShell?`#compdef {{app_name}}
|
|
38
|
+
###-begin-{{app_name}}-completions-###
|
|
39
|
+
#
|
|
40
|
+
# yargs command completion script
|
|
41
|
+
#
|
|
42
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
|
|
43
|
+
# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
|
|
44
|
+
#
|
|
45
|
+
_{{app_name}}_yargs_completions()
|
|
46
|
+
{
|
|
47
|
+
local reply
|
|
48
|
+
local si=$IFS
|
|
49
|
+
IFS=$'
|
|
50
|
+
' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
|
|
51
|
+
IFS=$si
|
|
52
|
+
_describe 'values' reply
|
|
53
|
+
}
|
|
54
|
+
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
55
|
+
###-end-{{app_name}}-completions-###
|
|
56
|
+
`:`###-begin-{{app_name}}-completions-###
|
|
57
|
+
#
|
|
58
|
+
# yargs command completion script
|
|
59
|
+
#
|
|
60
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
|
|
61
|
+
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
|
|
62
|
+
#
|
|
63
|
+
_{{app_name}}_yargs_completions()
|
|
64
|
+
{
|
|
65
|
+
local cur_word args type_list
|
|
66
|
+
|
|
67
|
+
cur_word="\${COMP_WORDS[COMP_CWORD]}"
|
|
68
|
+
args=("\${COMP_WORDS[@]}")
|
|
69
|
+
|
|
70
|
+
# ask yargs to generate completions.
|
|
71
|
+
type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
|
|
72
|
+
|
|
73
|
+
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
|
|
74
|
+
|
|
75
|
+
# if no match was found, fall back to filename completion
|
|
76
|
+
if [ \${#COMPREPLY[@]} -eq 0 ]; then
|
|
77
|
+
COMPREPLY=()
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
return 0
|
|
81
|
+
}
|
|
82
|
+
complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
|
83
|
+
###-end-{{app_name}}-completions-###
|
|
84
|
+
`,o=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),s=s.replace(/{{app_name}}/g,o),s=s.replace(/{{completion_command}}/g,n),s.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function hO(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let n=[],s,o;for(s=0;s<=e.length;s++)n[s]=[s];for(o=0;o<=t.length;o++)n[0][o]=o;for(s=1;s<=e.length;s++)for(o=1;o<=t.length;o++)e.charAt(s-1)===t.charAt(o-1)?n[s][o]=n[s-1][o-1]:s>1&&o>1&&e.charAt(s-2)===t.charAt(o-1)&&e.charAt(s-1)===t.charAt(o-2)?n[s][o]=n[s-2][o-2]+1:n[s][o]=Math.min(n[s-1][o-1]+1,Math.min(n[s][o-1]+1,n[s-1][o]+1));return n[e.length][t.length]}var lg=["$0","--","_"],Ne,Tn,po,xt,ft,jr,un,Pn,Lr,vt,Br,wt,$t,mt,Et,qr,ys,Ge,X,Mr,Ur,ht,$n,bs,Nn,pn,Hr,se,In,Rn,Fn,re,zr,Nt,Oe,ug=Symbol("copyDoubleDash"),pg=Symbol("copyDoubleDash"),xc=Symbol("deleteFromParserHintObject"),dg=Symbol("emitWarning"),fg=Symbol("freeze"),mg=Symbol("getDollarZero"),jn=Symbol("getParserConfiguration"),hg=Symbol("getUsageConfiguration"),vc=Symbol("guessLocale"),gg=Symbol("guessVersion"),yg=Symbol("parsePositionalNumbers"),wc=Symbol("pkgUp"),dn=Symbol("populateParserHintArray"),xs=Symbol("populateParserHintSingleValueDictionary"),Ec=Symbol("populateParserHintArrayDictionary"),Dc=Symbol("populateParserHintDictionary"),Sc=Symbol("sanitizeKey"),kc=Symbol("setKey"),Ac=Symbol("unfreeze"),bg=Symbol("validateAsync"),xg=Symbol("getCommandInstance"),vg=Symbol("getContext"),wg=Symbol("getHasOutput"),Eg=Symbol("getLoggerInstance"),Dg=Symbol("getParseContext"),Sg=Symbol("getUsageInstance"),kg=Symbol("getValidationInstance"),Wr=Symbol("hasParseCallback"),Ag=Symbol("isGlobalContext"),Ln=Symbol("postProcess"),_g=Symbol("rebase"),_c=Symbol("reset"),fo=Symbol("runYargsParserAndExecuteCommands"),Cc=Symbol("runValidation"),Cg=Symbol("setHasOutput"),Bn=Symbol("kTrackManuallySetKeys"),jc=class{constructor(e=[],n,s,o){this.customScriptName=!1,this.parsed=!1,Ne.set(this,void 0),Tn.set(this,void 0),po.set(this,{commands:[],fullCommands:[]}),xt.set(this,null),ft.set(this,null),jr.set(this,"show-hidden"),un.set(this,null),Pn.set(this,!0),Lr.set(this,{}),vt.set(this,!0),Br.set(this,[]),wt.set(this,void 0),$t.set(this,{}),mt.set(this,!1),Et.set(this,null),qr.set(this,!0),ys.set(this,void 0),Ge.set(this,""),X.set(this,void 0),Mr.set(this,void 0),Ur.set(this,{}),ht.set(this,null),$n.set(this,null),bs.set(this,{}),Nn.set(this,{}),pn.set(this,void 0),Hr.set(this,!1),se.set(this,void 0),In.set(this,!1),Rn.set(this,!1),Fn.set(this,!1),re.set(this,void 0),zr.set(this,{}),Nt.set(this,null),Oe.set(this,void 0),J(this,se,o,"f"),J(this,pn,e,"f"),J(this,Tn,n,"f"),J(this,Mr,s,"f"),J(this,wt,new Nc(this),"f"),this.$0=this[mg](),this[_c](),J(this,Ne,y(this,Ne,"f"),"f"),J(this,re,y(this,re,"f"),"f"),J(this,Oe,y(this,Oe,"f"),"f"),J(this,X,y(this,X,"f"),"f"),y(this,X,"f").showHiddenOpt=y(this,jr,"f"),J(this,ys,this[pg](),"f")}addHelpOpt(e,n){return K("[string|boolean] [string]",[e,n],arguments.length),y(this,Et,"f")&&(this[xc](y(this,Et,"f")),J(this,Et,null,"f")),e===!1&&n===void 0||(J(this,Et,typeof e=="string"?e:"help","f"),this.boolean(y(this,Et,"f")),this.describe(y(this,Et,"f"),n||y(this,re,"f").deferY18nLookup("Show help"))),this}help(e,n){return this.addHelpOpt(e,n)}addShowHiddenOpt(e,n){if(K("[string|boolean] [string]",[e,n],arguments.length),e===!1&&n===void 0)return this;let s=typeof e=="string"?e:y(this,jr,"f");return this.boolean(s),this.describe(s,n||y(this,re,"f").deferY18nLookup("Show hidden options")),y(this,X,"f").showHiddenOpt=s,this}showHidden(e,n){return this.addShowHiddenOpt(e,n)}alias(e,n){return K("<object|string|array> [string|array]",[e,n],arguments.length),this[Ec](this.alias.bind(this),"alias",e,n),this}array(e){return K("<array|string>",[e],arguments.length),this[dn]("array",e),this[Bn](e),this}boolean(e){return K("<array|string>",[e],arguments.length),this[dn]("boolean",e),this[Bn](e),this}check(e,n){return K("<function> [boolean]",[e,n],arguments.length),this.middleware((s,o)=>go(()=>e(s,o.getOptions()),r=>(r?(typeof r=="string"||r instanceof Error)&&y(this,re,"f").fail(r.toString(),r):y(this,re,"f").fail(y(this,se,"f").y18n.__("Argument check failed: %s",e.toString())),s),r=>(y(this,re,"f").fail(r.message?r.message:r.toString(),r),s)),!1,n),this}choices(e,n){return K("<object|string|array> [string|array]",[e,n],arguments.length),this[Ec](this.choices.bind(this),"choices",e,n),this}coerce(e,n){if(K("<object|string|array> [function]",[e,n],arguments.length),Array.isArray(e)){if(!n)throw new Ve("coerce callback must be provided");for(let s of e)this.coerce(s,n);return this}if(typeof e=="object"){for(let s of Object.keys(e))this.coerce(s,e[s]);return this}if(!n)throw new Ve("coerce callback must be provided");return y(this,X,"f").key[e]=!0,y(this,wt,"f").addCoerceMiddleware((s,o)=>{let r;return Object.prototype.hasOwnProperty.call(s,e)?go(()=>(r=o.getAliases(),n(s[e])),i=>{s[e]=i;let a=o.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[e]&&a!==!0)for(let c of r[e])s[c]=i;return s},i=>{throw new Ve(i.message)}):s},e),this}conflicts(e,n){return K("<string|object> [string|array]",[e,n],arguments.length),y(this,Oe,"f").conflicts(e,n),this}config(e="config",n,s){return K("[object|string] [string|function] [function]",[e,n,s],arguments.length),typeof e!="object"||Array.isArray(e)?(typeof n=="function"&&(s=n,n=void 0),this.describe(e,n||y(this,re,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(o=>{y(this,X,"f").config[o]=s||!0}),this):(e=Kr(e,y(this,Tn,"f"),this[jn]()["deep-merge-config"]||!1,y(this,se,"f")),y(this,X,"f").configObjects=(y(this,X,"f").configObjects||[]).concat(e),this)}completion(e,n,s){return K("[string] [string|boolean|function] [function]",[e,n,s],arguments.length),typeof n=="function"&&(s=n,n=void 0),J(this,ft,e||y(this,ft,"f")||"completion","f"),n||n===!1||(n="generate completion script"),this.command(y(this,ft,"f"),n),s&&y(this,xt,"f").registerFunction(s),this}command(e,n,s,o,r,i){return K("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,n,s,o,r,i],arguments.length),y(this,Ne,"f").addHandler(e,n,s,o,r,i),this}commands(e,n,s,o,r,i){return this.command(e,n,s,o,r,i)}commandDir(e,n){K("<string> [object]",[e,n],arguments.length);let s=y(this,Mr,"f")||y(this,se,"f").require;return y(this,Ne,"f").addDirectory(e,s,y(this,se,"f").getCallerFile(),n),this}count(e){return K("<array|string>",[e],arguments.length),this[dn]("count",e),this[Bn](e),this}default(e,n,s){return K("<object|string|array> [*] [string]",[e,n,s],arguments.length),s&&(ig(e,y(this,se,"f")),y(this,X,"f").defaultDescription[e]=s),typeof n=="function"&&(ig(e,y(this,se,"f")),y(this,X,"f").defaultDescription[e]||(y(this,X,"f").defaultDescription[e]=y(this,re,"f").functionDescription(n)),n=n.call()),this[xs](this.default.bind(this),"default",e,n),this}defaults(e,n,s){return this.default(e,n,s)}demandCommand(e=1,n,s,o){return K("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,n,s,o],arguments.length),typeof n!="number"&&(s=n,n=1/0),this.global("_",!1),y(this,X,"f").demandedCommands._={min:e,max:n,minMsg:s,maxMsg:o},this}demand(e,n,s){return Array.isArray(n)?(n.forEach(o=>{_t(s,!0,y(this,se,"f")),this.demandOption(o,s)}),n=1/0):typeof n!="number"&&(s=n,n=1/0),typeof e=="number"?(_t(s,!0,y(this,se,"f")),this.demandCommand(e,n,s,s)):Array.isArray(e)?e.forEach(o=>{_t(s,!0,y(this,se,"f")),this.demandOption(o,s)}):typeof s=="string"?this.demandOption(e,s):s!==!0&&s!==void 0||this.demandOption(e),this}demandOption(e,n){return K("<object|string|array> [string]",[e,n],arguments.length),this[xs](this.demandOption.bind(this),"demandedOptions",e,n),this}deprecateOption(e,n){return K("<string> [string|boolean]",[e,n],arguments.length),y(this,X,"f").deprecatedOptions[e]=n,this}describe(e,n){return K("<object|string|array> [string]",[e,n],arguments.length),this[kc](e,!0),y(this,re,"f").describe(e,n),this}detectLocale(e){return K("<boolean>",[e],arguments.length),J(this,Pn,e,"f"),this}env(e){return K("[string|boolean]",[e],arguments.length),e===!1?delete y(this,X,"f").envPrefix:y(this,X,"f").envPrefix=e||"",this}epilogue(e){return K("<string>",[e],arguments.length),y(this,re,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,n){return K("<string|array> [string]",[e,n],arguments.length),Array.isArray(e)?e.forEach(s=>this.example(...s)):y(this,re,"f").example(e,n),this}exit(e,n){J(this,mt,!0,"f"),J(this,un,n,"f"),y(this,vt,"f")&&y(this,se,"f").process.exit(e)}exitProcess(e=!0){return K("[boolean]",[e],arguments.length),J(this,vt,e,"f"),this}fail(e){if(K("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new Ve("Invalid first argument. Expected function or boolean 'false'");return y(this,re,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,n){return K("<array> [function]",[e,n],arguments.length),n?y(this,xt,"f").getCompletion(e,n):new Promise((s,o)=>{y(this,xt,"f").getCompletion(e,(r,i)=>{r?o(r):s(i)})})}getDemandedOptions(){return K([],0),y(this,X,"f").demandedOptions}getDemandedCommands(){return K([],0),y(this,X,"f").demandedCommands}getDeprecatedOptions(){return K([],0),y(this,X,"f").deprecatedOptions}getDetectLocale(){return y(this,Pn,"f")}getExitProcess(){return y(this,vt,"f")}getGroups(){return Object.assign({},y(this,$t,"f"),y(this,Nn,"f"))}getHelp(){if(J(this,mt,!0,"f"),!y(this,re,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[fo](y(this,pn,"f"),void 0,void 0,0,!0);if(Ie(n))return n.then(()=>y(this,re,"f").help())}let e=y(this,Ne,"f").runDefaultBuilderOn(this);if(Ie(e))return e.then(()=>y(this,re,"f").help())}return Promise.resolve(y(this,re,"f").help())}getOptions(){return y(this,X,"f")}getStrict(){return y(this,In,"f")}getStrictCommands(){return y(this,Rn,"f")}getStrictOptions(){return y(this,Fn,"f")}global(e,n){return K("<string|array> [boolean]",[e,n],arguments.length),e=[].concat(e),n!==!1?y(this,X,"f").local=y(this,X,"f").local.filter(s=>e.indexOf(s)===-1):e.forEach(s=>{y(this,X,"f").local.includes(s)||y(this,X,"f").local.push(s)}),this}group(e,n){K("<string|array> <string>",[e,n],arguments.length);let s=y(this,Nn,"f")[n]||y(this,$t,"f")[n];y(this,Nn,"f")[n]&&delete y(this,Nn,"f")[n];let o={};return y(this,$t,"f")[n]=(s||[]).concat(e).filter(r=>!o[r]&&(o[r]=!0)),this}hide(e){return K("<string>",[e],arguments.length),y(this,X,"f").hiddenOptions.push(e),this}implies(e,n){return K("<string|object> [number|string|array]",[e,n],arguments.length),y(this,Oe,"f").implies(e,n),this}locale(e){return K("[string]",[e],arguments.length),e===void 0?(this[vc](),y(this,se,"f").y18n.getLocale()):(J(this,Pn,!1,"f"),y(this,se,"f").y18n.setLocale(e),this)}middleware(e,n,s){return y(this,wt,"f").addMiddleware(e,!!n,s)}nargs(e,n){return K("<string|object|array> [number]",[e,n],arguments.length),this[xs](this.nargs.bind(this),"narg",e,n),this}normalize(e){return K("<array|string>",[e],arguments.length),this[dn]("normalize",e),this}number(e){return K("<array|string>",[e],arguments.length),this[dn]("number",e),this[Bn](e),this}option(e,n){if(K("<string|object> [object]",[e,n],arguments.length),typeof e=="object")Object.keys(e).forEach(s=>{this.options(s,e[s])});else{typeof n!="object"&&(n={}),this[Bn](e),!y(this,Nt,"f")||e!=="version"&&n?.alias!=="version"||this[dg](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
85
|
+
`),void 0,"versionWarning"),y(this,X,"f").key[e]=!0,n.alias&&this.alias(e,n.alias);let s=n.deprecate||n.deprecated;s&&this.deprecateOption(e,s);let o=n.demand||n.required||n.require;o&&this.demand(e,o),n.demandOption&&this.demandOption(e,typeof n.demandOption=="string"?n.demandOption:void 0),n.conflicts&&this.conflicts(e,n.conflicts),"default"in n&&this.default(e,n.default),n.implies!==void 0&&this.implies(e,n.implies),n.nargs!==void 0&&this.nargs(e,n.nargs),n.config&&this.config(e,n.configParser),n.normalize&&this.normalize(e),n.choices&&this.choices(e,n.choices),n.coerce&&this.coerce(e,n.coerce),n.group&&this.group(e,n.group),(n.boolean||n.type==="boolean")&&(this.boolean(e),n.alias&&this.boolean(n.alias)),(n.array||n.type==="array")&&(this.array(e),n.alias&&this.array(n.alias)),(n.number||n.type==="number")&&(this.number(e),n.alias&&this.number(n.alias)),(n.string||n.type==="string")&&(this.string(e),n.alias&&this.string(n.alias)),(n.count||n.type==="count")&&this.count(e),typeof n.global=="boolean"&&this.global(e,n.global),n.defaultDescription&&(y(this,X,"f").defaultDescription[e]=n.defaultDescription),n.skipValidation&&this.skipValidation(e);let r=n.describe||n.description||n.desc,i=y(this,re,"f").getDescriptions();Object.prototype.hasOwnProperty.call(i,e)&&typeof r!="string"||this.describe(e,r),n.hidden&&this.hide(e),n.requiresArg&&this.requiresArg(e)}return this}options(e,n){return this.option(e,n)}parse(e,n,s){K("[string|array] [function|boolean|object] [function]",[e,n,s],arguments.length),this[fg](),e===void 0&&(e=y(this,pn,"f")),typeof n=="object"&&(J(this,$n,n,"f"),n=s),typeof n=="function"&&(J(this,ht,n,"f"),n=!1),n||J(this,pn,e,"f"),y(this,ht,"f")&&J(this,vt,!1,"f");let o=this[fo](e,!!n),r=this.parsed;return y(this,xt,"f").setParsed(this.parsed),Ie(o)?o.then(i=>(y(this,ht,"f")&&y(this,ht,"f").call(this,y(this,un,"f"),i,y(this,Ge,"f")),i)).catch(i=>{throw y(this,ht,"f")&&y(this,ht,"f")(i,this.parsed.argv,y(this,Ge,"f")),i}).finally(()=>{this[Ac](),this.parsed=r}):(y(this,ht,"f")&&y(this,ht,"f").call(this,y(this,un,"f"),o,y(this,Ge,"f")),this[Ac](),this.parsed=r,o)}parseAsync(e,n,s){let o=this.parse(e,n,s);return Ie(o)?o:Promise.resolve(o)}parseSync(e,n,s){let o=this.parse(e,n,s);if(Ie(o))throw new Ve(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return o}parserConfiguration(e){return K("<object>",[e],arguments.length),J(this,Ur,e,"f"),this}pkgConf(e,n){K("<string> [string]",[e,n],arguments.length);let s=null,o=this[wc](n||y(this,Tn,"f"));return o[e]&&typeof o[e]=="object"&&(s=Kr(o[e],n||y(this,Tn,"f"),this[jn]()["deep-merge-config"]||!1,y(this,se,"f")),y(this,X,"f").configObjects=(y(this,X,"f").configObjects||[]).concat(s)),this}positional(e,n){K("<string> <object>",[e,n],arguments.length);let s=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];n=vs(n,(i,a)=>!(i==="type"&&!["string","number","boolean"].includes(a))&&s.includes(i));let o=y(this,po,"f").fullCommands[y(this,po,"f").fullCommands.length-1],r=o?y(this,Ne,"f").cmdToParseOptions(o):{array:[],alias:{},default:{},demand:{}};return Jr(r).forEach(i=>{let a=r[i];Array.isArray(a)?a.indexOf(e)!==-1&&(n[i]=!0):a[e]&&!(i in n)&&(n[i]=a[e])}),this.group(e,y(this,re,"f").getPositionalGroupName()),this.option(e,n)}recommendCommands(e=!0){return K("[boolean]",[e],arguments.length),J(this,Hr,e,"f"),this}required(e,n,s){return this.demand(e,n,s)}require(e,n,s){return this.demand(e,n,s)}requiresArg(e){return K("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&y(this,X,"f").narg[e]||this[xs](this.requiresArg.bind(this),"narg",e,NaN),this}showCompletionScript(e,n){return K("[string] [string]",[e,n],arguments.length),e=e||this.$0,y(this,ys,"f").log(y(this,xt,"f").generateCompletionScript(e,n||y(this,ft,"f")||"completion")),this}showHelp(e){if(K("[string|function]",[e],arguments.length),J(this,mt,!0,"f"),!y(this,re,"f").hasCachedHelpMessage()){if(!this.parsed){let s=this[fo](y(this,pn,"f"),void 0,void 0,0,!0);if(Ie(s))return s.then(()=>{y(this,re,"f").showHelp(e)}),this}let n=y(this,Ne,"f").runDefaultBuilderOn(this);if(Ie(n))return n.then(()=>{y(this,re,"f").showHelp(e)}),this}return y(this,re,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,n){return K("[boolean|string] [string]",[e,n],arguments.length),y(this,re,"f").showHelpOnFail(e,n),this}showVersion(e){return K("[string|function]",[e],arguments.length),y(this,re,"f").showVersion(e),this}skipValidation(e){return K("<array|string>",[e],arguments.length),this[dn]("skipValidation",e),this}strict(e){return K("[boolean]",[e],arguments.length),J(this,In,e!==!1,"f"),this}strictCommands(e){return K("[boolean]",[e],arguments.length),J(this,Rn,e!==!1,"f"),this}strictOptions(e){return K("[boolean]",[e],arguments.length),J(this,Fn,e!==!1,"f"),this}string(e){return K("<array|string>",[e],arguments.length),this[dn]("string",e),this[Bn](e),this}terminalWidth(){return K([],0),y(this,se,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return K("<object>",[e],arguments.length),J(this,Pn,!1,"f"),y(this,se,"f").y18n.updateLocale(e),this}usage(e,n,s,o){if(K("<string|null|undefined> [string|boolean] [function|object] [function]",[e,n,s,o],arguments.length),n!==void 0){if(_t(e,null,y(this,se,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,n,s,o);throw new Ve(".usage() description must start with $0 if being used as alias for .command()")}return y(this,re,"f").usage(e),this}usageConfiguration(e){return K("<object>",[e],arguments.length),J(this,zr,e,"f"),this}version(e,n,s){let o="version";if(K("[boolean|string] [string] [string]",[e,n,s],arguments.length),y(this,Nt,"f")&&(this[xc](y(this,Nt,"f")),y(this,re,"f").version(void 0),J(this,Nt,null,"f")),arguments.length===0)s=this[gg](),e=o;else if(arguments.length===1){if(e===!1)return this;s=e,e=o}else arguments.length===2&&(s=n,n=void 0);return J(this,Nt,typeof e=="string"?e:o,"f"),n=n||y(this,re,"f").deferY18nLookup("Show version number"),y(this,re,"f").version(s||void 0),this.boolean(y(this,Nt,"f")),this.describe(y(this,Nt,"f"),n),this}wrap(e){return K("<number|null|undefined>",[e],arguments.length),y(this,re,"f").wrap(e),this}[(Ne=new WeakMap,Tn=new WeakMap,po=new WeakMap,xt=new WeakMap,ft=new WeakMap,jr=new WeakMap,un=new WeakMap,Pn=new WeakMap,Lr=new WeakMap,vt=new WeakMap,Br=new WeakMap,wt=new WeakMap,$t=new WeakMap,mt=new WeakMap,Et=new WeakMap,qr=new WeakMap,ys=new WeakMap,Ge=new WeakMap,X=new WeakMap,Mr=new WeakMap,Ur=new WeakMap,ht=new WeakMap,$n=new WeakMap,bs=new WeakMap,Nn=new WeakMap,pn=new WeakMap,Hr=new WeakMap,se=new WeakMap,In=new WeakMap,Rn=new WeakMap,Fn=new WeakMap,re=new WeakMap,zr=new WeakMap,Nt=new WeakMap,Oe=new WeakMap,ug)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[pg](){return{log:(...e)=>{this[Wr]()||console.log(...e),J(this,mt,!0,"f"),y(this,Ge,"f").length&&J(this,Ge,y(this,Ge,"f")+`
|
|
86
|
+
`,"f"),J(this,Ge,y(this,Ge,"f")+e.join(" "),"f")},error:(...e)=>{this[Wr]()||console.error(...e),J(this,mt,!0,"f"),y(this,Ge,"f").length&&J(this,Ge,y(this,Ge,"f")+`
|
|
87
|
+
`,"f"),J(this,Ge,y(this,Ge,"f")+e.join(" "),"f")}}}[xc](e){Jr(y(this,X,"f")).forEach(n=>{if(n==="configObjects")return;let s=y(this,X,"f")[n];Array.isArray(s)?s.includes(e)&&s.splice(s.indexOf(e),1):typeof s=="object"&&delete s[e]}),delete y(this,re,"f").getDescriptions()[e]}[dg](e,n,s){y(this,Lr,"f")[s]||(y(this,se,"f").process.emitWarning(e,n),y(this,Lr,"f")[s]=!0)}[fg](){y(this,Br,"f").push({options:y(this,X,"f"),configObjects:y(this,X,"f").configObjects.slice(0),exitProcess:y(this,vt,"f"),groups:y(this,$t,"f"),strict:y(this,In,"f"),strictCommands:y(this,Rn,"f"),strictOptions:y(this,Fn,"f"),completionCommand:y(this,ft,"f"),output:y(this,Ge,"f"),exitError:y(this,un,"f"),hasOutput:y(this,mt,"f"),parsed:this.parsed,parseFn:y(this,ht,"f"),parseContext:y(this,$n,"f")}),y(this,re,"f").freeze(),y(this,Oe,"f").freeze(),y(this,Ne,"f").freeze(),y(this,wt,"f").freeze()}[mg](){let e,n="";return e=/\b(node|iojs|electron)(\.exe)?$/.test(y(this,se,"f").process.argv()[0])?y(this,se,"f").process.argv().slice(1,2):y(this,se,"f").process.argv().slice(0,1),n=e.map(s=>{let o=this[_g](y(this,Tn,"f"),s);return s.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<s.length?o:s}).join(" ").trim(),y(this,se,"f").getEnv("_")&&y(this,se,"f").getProcessArgvBin()===y(this,se,"f").getEnv("_")&&(n=y(this,se,"f").getEnv("_").replace(`${y(this,se,"f").path.dirname(y(this,se,"f").process.execPath())}/`,"")),n}[jn](){return y(this,Ur,"f")}[hg](){return y(this,zr,"f")}[vc](){if(!y(this,Pn,"f"))return;let e=y(this,se,"f").getEnv("LC_ALL")||y(this,se,"f").getEnv("LC_MESSAGES")||y(this,se,"f").getEnv("LANG")||y(this,se,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[gg](){return this[wc]().version||"unknown"}[yg](e){let n=e["--"]?e["--"]:e._;for(let s,o=0;(s=n[o])!==void 0;o++)y(this,se,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(n[o]=Number(s));return e}[wc](e){let n=e||"*";if(y(this,bs,"f")[n])return y(this,bs,"f")[n];let s={};try{let o=e||y(this,se,"f").mainFilename;!e&&y(this,se,"f").path.extname(o)&&(o=y(this,se,"f").path.dirname(o));let r=y(this,se,"f").findUp(o,(i,a)=>a.includes("package.json")?"package.json":void 0);_t(r,void 0,y(this,se,"f")),s=JSON.parse(y(this,se,"f").readFileSync(r,"utf8"))}catch{}return y(this,bs,"f")[n]=s||{},y(this,bs,"f")[n]}[dn](e,n){(n=[].concat(n)).forEach(s=>{s=this[Sc](s),y(this,X,"f")[e].push(s)})}[xs](e,n,s,o){this[Dc](e,n,s,o,(r,i,a)=>{y(this,X,"f")[r][i]=a})}[Ec](e,n,s,o){this[Dc](e,n,s,o,(r,i,a)=>{y(this,X,"f")[r][i]=(y(this,X,"f")[r][i]||[]).concat(a)})}[Dc](e,n,s,o,r){if(Array.isArray(s))s.forEach(i=>{e(i,o)});else if((i=>typeof i=="object")(s))for(let i of Jr(s))e(i,s[i]);else r(n,this[Sc](s),o)}[Sc](e){return e==="__proto__"?"___proto___":e}[kc](e,n){return this[xs](this[kc].bind(this),"key",e,n),this}[Ac](){var e,n,s,o,r,i,a,c,l,u,p,d;let f=y(this,Br,"f").pop(),m;_t(f,void 0,y(this,se,"f")),e=this,n=this,s=this,o=this,r=this,i=this,a=this,c=this,l=this,u=this,p=this,d=this,{options:{set value(h){J(e,X,h,"f")}}.value,configObjects:m,exitProcess:{set value(h){J(n,vt,h,"f")}}.value,groups:{set value(h){J(s,$t,h,"f")}}.value,output:{set value(h){J(o,Ge,h,"f")}}.value,exitError:{set value(h){J(r,un,h,"f")}}.value,hasOutput:{set value(h){J(i,mt,h,"f")}}.value,parsed:this.parsed,strict:{set value(h){J(a,In,h,"f")}}.value,strictCommands:{set value(h){J(c,Rn,h,"f")}}.value,strictOptions:{set value(h){J(l,Fn,h,"f")}}.value,completionCommand:{set value(h){J(u,ft,h,"f")}}.value,parseFn:{set value(h){J(p,ht,h,"f")}}.value,parseContext:{set value(h){J(d,$n,h,"f")}}.value}=f,y(this,X,"f").configObjects=m,y(this,re,"f").unfreeze(),y(this,Oe,"f").unfreeze(),y(this,Ne,"f").unfreeze(),y(this,wt,"f").unfreeze()}[bg](e,n){return go(n,s=>(e(s),s))}getInternalMethods(){return{getCommandInstance:this[xg].bind(this),getContext:this[vg].bind(this),getHasOutput:this[wg].bind(this),getLoggerInstance:this[Eg].bind(this),getParseContext:this[Dg].bind(this),getParserConfiguration:this[jn].bind(this),getUsageConfiguration:this[hg].bind(this),getUsageInstance:this[Sg].bind(this),getValidationInstance:this[kg].bind(this),hasParseCallback:this[Wr].bind(this),isGlobalContext:this[Ag].bind(this),postProcess:this[Ln].bind(this),reset:this[_c].bind(this),runValidation:this[Cc].bind(this),runYargsParserAndExecuteCommands:this[fo].bind(this),setHasOutput:this[Cg].bind(this)}}[xg](){return y(this,Ne,"f")}[vg](){return y(this,po,"f")}[wg](){return y(this,mt,"f")}[Eg](){return y(this,ys,"f")}[Dg](){return y(this,$n,"f")||{}}[Sg](){return y(this,re,"f")}[kg](){return y(this,Oe,"f")}[Wr](){return!!y(this,ht,"f")}[Ag](){return y(this,qr,"f")}[Ln](e,n,s,o){return s||Ie(e)?e:(n||(e=this[ug](e)),(this[jn]()["parse-positional-numbers"]||this[jn]()["parse-positional-numbers"]===void 0)&&(e=this[yg](e)),o&&(e=ho(e,this,y(this,wt,"f").getMiddleware(),!1)),e)}[_c](e={}){J(this,X,y(this,X,"f")||{},"f");let n={};n.local=y(this,X,"f").local||[],n.configObjects=y(this,X,"f").configObjects||[];let s={};return n.local.forEach(o=>{s[o]=!0,(e[o]||[]).forEach(r=>{s[r]=!0})}),Object.assign(y(this,Nn,"f"),Object.keys(y(this,$t,"f")).reduce((o,r)=>{let i=y(this,$t,"f")[r].filter(a=>!(a in s));return i.length>0&&(o[r]=i),o},{})),J(this,$t,{},"f"),["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach(o=>{n[o]=(y(this,X,"f")[o]||[]).filter(r=>!s[r])}),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach(o=>{n[o]=vs(y(this,X,"f")[o],r=>!s[r])}),n.envPrefix=y(this,X,"f").envPrefix,J(this,X,n,"f"),J(this,re,y(this,re,"f")?y(this,re,"f").reset(s):mO(this,y(this,se,"f")),"f"),J(this,Oe,y(this,Oe,"f")?y(this,Oe,"f").reset(s):function(o,r,i){let a=i.y18n.__,c=i.y18n.__n,l={nonOptionCount:function(m){let h=o.getDemandedCommands(),g=m._.length+(m["--"]?m["--"].length:0)-o.getInternalMethods().getContext().commands.length;h._&&(g<h._.min||g>h._.max)&&(g<h._.min?h._.minMsg!==void 0?r.fail(h._.minMsg?h._.minMsg.replace(/\$0/g,g.toString()).replace(/\$1/,h._.min.toString()):null):r.fail(c("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",g,g.toString(),h._.min.toString())):g>h._.max&&(h._.maxMsg!==void 0?r.fail(h._.maxMsg?h._.maxMsg.replace(/\$0/g,g.toString()).replace(/\$1/,h._.max.toString()):null):r.fail(c("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",g,g.toString(),h._.max.toString()))))},positionalCount:function(m,h){h<m&&r.fail(c("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",h,h+"",m+""))},requiredArguments:function(m,h){let g=null;for(let b of Object.keys(h))Object.prototype.hasOwnProperty.call(m,b)&&m[b]!==void 0||(g=g||{},g[b]=h[b]);if(g){let b=[];for(let E of Object.keys(g)){let S=g[E];S&&b.indexOf(S)<0&&b.push(S)}let v=b.length?`
|
|
88
|
+
${b.join(`
|
|
89
|
+
`)}`:"";r.fail(c("Missing required argument: %s","Missing required arguments: %s",Object.keys(g).length,Object.keys(g).join(", ")+v))}},unknownArguments:function(m,h,g,b,v=!0){var E;let S=o.getInternalMethods().getCommandInstance().getCommands(),C=[],B=o.getInternalMethods().getContext();if(Object.keys(m).forEach(L=>{lg.includes(L)||Object.prototype.hasOwnProperty.call(g,L)||Object.prototype.hasOwnProperty.call(o.getInternalMethods().getParseContext(),L)||l.isValidAndSomeAliasIsNotNew(L,h)||C.push(L)}),v&&(B.commands.length>0||S.length>0||b)&&m._.slice(B.commands.length).forEach(L=>{S.includes(""+L)||C.push(""+L)}),v){let L=((E=o.getDemandedCommands()._)===null||E===void 0?void 0:E.max)||0,$=B.commands.length+L;$<m._.length&&m._.slice($).forEach(I=>{I=String(I),B.commands.includes(I)||C.includes(I)||C.push(I)})}C.length&&r.fail(c("Unknown argument: %s","Unknown arguments: %s",C.length,C.map(L=>L.trim()?L:`"${L}"`).join(", ")))},unknownCommands:function(m){let h=o.getInternalMethods().getCommandInstance().getCommands(),g=[],b=o.getInternalMethods().getContext();return(b.commands.length>0||h.length>0)&&m._.slice(b.commands.length).forEach(v=>{h.includes(""+v)||g.push(""+v)}),g.length>0&&(r.fail(c("Unknown command: %s","Unknown commands: %s",g.length,g.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(m,h){if(!Object.prototype.hasOwnProperty.call(h,m))return!1;let g=o.parsed.newAliases;return[m,...h[m]].some(b=>!Object.prototype.hasOwnProperty.call(g,b)||!g[m])},limitedChoices:function(m){let h=o.getOptions(),g={};if(!Object.keys(h.choices).length)return;Object.keys(m).forEach(E=>{lg.indexOf(E)===-1&&Object.prototype.hasOwnProperty.call(h.choices,E)&&[].concat(m[E]).forEach(S=>{h.choices[E].indexOf(S)===-1&&S!==void 0&&(g[E]=(g[E]||[]).concat(S))})});let b=Object.keys(g);if(!b.length)return;let v=a("Invalid values:");b.forEach(E=>{v+=`
|
|
90
|
+
${a("Argument: %s, Given: %s, Choices: %s",E,r.stringifiedValues(g[E]),r.stringifiedValues(h.choices[E]))}`}),r.fail(v)}},u={};function p(m,h){let g=Number(h);return typeof(h=isNaN(g)?h:g)=="number"?h=m._.length>=h:h.match(/^--no-.+/)?(h=h.match(/^--no-(.+)/)[1],h=!Object.prototype.hasOwnProperty.call(m,h)):h=Object.prototype.hasOwnProperty.call(m,h),h}l.implies=function(m,h){K("<string|object> [array|number|string]",[m,h],arguments.length),typeof m=="object"?Object.keys(m).forEach(g=>{l.implies(g,m[g])}):(o.global(m),u[m]||(u[m]=[]),Array.isArray(h)?h.forEach(g=>l.implies(m,g)):(_t(h,void 0,i),u[m].push(h)))},l.getImplied=function(){return u},l.implications=function(m){let h=[];if(Object.keys(u).forEach(g=>{let b=g;(u[g]||[]).forEach(v=>{let E=b,S=v;E=p(m,E),v=p(m,v),E&&!v&&h.push(` ${b} -> ${S}`)})}),h.length){let g=`${a("Implications failed:")}
|
|
91
|
+
`;h.forEach(b=>{g+=b}),r.fail(g)}};let d={};l.conflicts=function(m,h){K("<string|object> [array|string]",[m,h],arguments.length),typeof m=="object"?Object.keys(m).forEach(g=>{l.conflicts(g,m[g])}):(o.global(m),d[m]||(d[m]=[]),Array.isArray(h)?h.forEach(g=>l.conflicts(m,g)):d[m].push(h))},l.getConflicting=()=>d,l.conflicting=function(m){Object.keys(m).forEach(h=>{d[h]&&d[h].forEach(g=>{g&&m[h]!==void 0&&m[g]!==void 0&&r.fail(a("Arguments %s and %s are mutually exclusive",h,g))})}),o.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(d).forEach(h=>{d[h].forEach(g=>{g&&m[i.Parser.camelCase(h)]!==void 0&&m[i.Parser.camelCase(g)]!==void 0&&r.fail(a("Arguments %s and %s are mutually exclusive",h,g))})})},l.recommendCommands=function(m,h){h=h.sort((v,E)=>E.length-v.length);let g=null,b=1/0;for(let v,E=0;(v=h[E])!==void 0;E++){let S=hO(m,v);S<=3&&S<b&&(b=S,g=v)}g&&r.fail(a("Did you mean %s?",g))},l.reset=function(m){return u=vs(u,h=>!m[h]),d=vs(d,h=>!m[h]),l};let f=[];return l.freeze=function(){f.push({implied:u,conflicting:d})},l.unfreeze=function(){let m=f.pop();_t(m,void 0,i),{implied:u,conflicting:d}=m},l}(this,y(this,re,"f"),y(this,se,"f")),"f"),J(this,Ne,y(this,Ne,"f")?y(this,Ne,"f").reset():function(o,r,i,a){return new Ic(o,r,i,a)}(y(this,re,"f"),y(this,Oe,"f"),y(this,wt,"f"),y(this,se,"f")),"f"),y(this,xt,"f")||J(this,xt,function(o,r,i,a){return new Fc(o,r,i,a)}(this,y(this,re,"f"),y(this,Ne,"f"),y(this,se,"f")),"f"),y(this,wt,"f").reset(),J(this,ft,null,"f"),J(this,Ge,"","f"),J(this,un,null,"f"),J(this,mt,!1,"f"),this.parsed=!1,this}[_g](e,n){return y(this,se,"f").path.relative(e,n)}[fo](e,n,s,o=0,r=!1){let i=!!s||r;e=e||y(this,pn,"f"),y(this,X,"f").__=y(this,se,"f").y18n.__,y(this,X,"f").configuration=this[jn]();let a=!!y(this,X,"f").configuration["populate--"],c=Object.assign({},y(this,X,"f").configuration,{"populate--":!0}),l=y(this,se,"f").Parser.detailed(e,Object.assign({},y(this,X,"f"),{configuration:{"parse-positional-numbers":!1,...c}})),u=Object.assign(l.argv,y(this,$n,"f")),p,d=l.aliases,f=!1,m=!1;Object.keys(u).forEach(h=>{h===y(this,Et,"f")&&u[h]?f=!0:h===y(this,Nt,"f")&&u[h]&&(m=!0)}),u.$0=this.$0,this.parsed=l,o===0&&y(this,re,"f").clearCachedHelpMessage();try{if(this[vc](),n)return this[Ln](u,a,!!s,!1);y(this,Et,"f")&&[y(this,Et,"f")].concat(d[y(this,Et,"f")]||[]).filter(v=>v.length>1).includes(""+u._[u._.length-1])&&(u._.pop(),f=!0),J(this,qr,!1,"f");let h=y(this,Ne,"f").getCommands(),g=y(this,xt,"f").completionKey in u,b=f||g||r;if(u._.length){if(h.length){let v;for(let E,S=o||0;u._[S]!==void 0;S++){if(E=String(u._[S]),h.includes(E)&&E!==y(this,ft,"f")){let C=y(this,Ne,"f").runCommand(E,this,l,S+1,r,f||m||r);return this[Ln](C,a,!!s,!1)}if(!v&&E!==y(this,ft,"f")){v=E;break}}!y(this,Ne,"f").hasDefaultCommand()&&y(this,Hr,"f")&&v&&!b&&y(this,Oe,"f").recommendCommands(v,h)}y(this,ft,"f")&&u._.includes(y(this,ft,"f"))&&!g&&(y(this,vt,"f")&&mo(!0),this.showCompletionScript(),this.exit(0))}if(y(this,Ne,"f").hasDefaultCommand()&&!b){let v=y(this,Ne,"f").runCommand(null,this,l,0,r,f||m||r);return this[Ln](v,a,!!s,!1)}if(g){y(this,vt,"f")&&mo(!0);let v=(e=[].concat(e)).slice(e.indexOf(`--${y(this,xt,"f").completionKey}`)+1);return y(this,xt,"f").getCompletion(v,(E,S)=>{if(E)throw new Ve(E.message);(S||[]).forEach(C=>{y(this,ys,"f").log(C)}),this.exit(0)}),this[Ln](u,!a,!!s,!1)}if(y(this,mt,"f")||(f?(y(this,vt,"f")&&mo(!0),i=!0,this.showHelp("log"),this.exit(0)):m&&(y(this,vt,"f")&&mo(!0),i=!0,y(this,re,"f").showVersion("log"),this.exit(0))),!i&&y(this,X,"f").skipValidation.length>0&&(i=Object.keys(u).some(v=>y(this,X,"f").skipValidation.indexOf(v)>=0&&u[v]===!0)),!i){if(l.error)throw new Ve(l.error.message);if(!g){let v=this[Cc](d,{},l.error);s||(p=ho(u,this,y(this,wt,"f").getMiddleware(),!0)),p=this[bg](v,p??u),Ie(p)&&!s&&(p=p.then(()=>ho(u,this,y(this,wt,"f").getMiddleware(),!1)))}}}catch(h){if(!(h instanceof Ve))throw h;y(this,re,"f").fail(h.message,h)}return this[Ln](p??u,a,!!s,!0)}[Cc](e,n,s,o){let r={...this.getDemandedOptions()};return i=>{if(s)throw new Ve(s.message);y(this,Oe,"f").nonOptionCount(i),y(this,Oe,"f").requiredArguments(i,r);let a=!1;y(this,Rn,"f")&&(a=y(this,Oe,"f").unknownCommands(i)),y(this,In,"f")&&!a?y(this,Oe,"f").unknownArguments(i,e,n,!!o):y(this,Fn,"f")&&y(this,Oe,"f").unknownArguments(i,e,{},!1,!1),y(this,Oe,"f").limitedChoices(i),y(this,Oe,"f").implications(i),y(this,Oe,"f").conflicting(i)}}[Cg](){J(this,mt,!0,"f")}[Bn](e){if(typeof e=="string")y(this,X,"f").key[e]=!0;else for(let n of e)y(this,X,"f").key[n]=!0}},Oc,Tc,{readFileSync:gO}=require("fs"),{inspect:yO}=require("util"),{resolve:bO}=require("path"),xO=ah(),vO=ic(),Pc,Og={assert:{notStrictEqual:sg.notStrictEqual,strictEqual:sg.strictEqual},cliui:Jh(),findUp:Yh(),getEnv:t=>process.env[t],getCallerFile:Qh(),getProcessArgvBin:Ng,inspect:yO,mainFilename:(Tc=(Oc=require==null?void 0:require.main)===null||Oc===void 0?void 0:Oc.filename)!==null&&Tc!==void 0?Tc:process.cwd(),Parser:vO,path:require("path"),process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:process.stdout.columns!==void 0?process.stdout.columns:null},readFileSync:gO,require,requireDirectory:ng(),stringWidth:Tr(),y18n:xO({directory:bO(__dirname,"../locales"),updateFiles:!1})},Tg=!((Pc=process==null?void 0:process.env)===null||Pc===void 0)&&Pc.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<Tg)throw Error(`yargs supports a minimum Node.js version of ${Tg}. Read our version support policy: https://github.com/yargs/yargs#supported-nodejs-versions`);var wO=ic(),$c,EO={applyExtends:Kr,cjsPlatformShim:Og,Yargs:($c=Og,(t=[],e=$c.process.cwd(),n)=>{let s=new jc(t,e,n,$c);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}),argsert:K,isPromise:Ie,objFilter:vs,parseCommand:ws,Parser:wO,processArgv:dO,YError:Ve};Ig.exports=EO});var Fg=D((hM,Rg)=>{var{applyExtends:DO,cjsPlatformShim:SO,Parser:kO,Yargs:Gr,processArgv:AO}=Bc();Gr.applyExtends=(t,e,n)=>DO(t,e,n,SO);Gr.hideBin=AO.hideBin;Gr.Parser=kO;Rg.exports=Gr});var Lg=D((gM,jg)=>{var{applyExtends:_O,cjsPlatformShim:CO,Parser:OO,processArgv:TO}=Bc();jg.exports={applyExtends:(t,e,n)=>_O(t,e,n,CO),hideBin:TO.hideBin,Parser:OO}});var Be=D((yM,Bg)=>{var PO=new Set(["PLANBEE_SESSION_ID","PLANBEE_AGENT_TYPE","PLANBEE_API_URL","PLANBEE_PARENT_ID","PLANBEE_PARENT_SESSION_ID","PLANBEE_TASK","PLANBEE_SDK_MANAGED","PLANBEE_COORDINATOR_MANAGED","PLANBEE_IS_SUBAGENT","PLANBEE_SUBAGENT_REGISTERED","PLANBEE_INJECTED_MESSAGE","PLANBEE_STOP_TASK_REMINDER","PLANBEE_PROMPT_TASK_REMINDER","PLANBEE_PERMISSION_MODE","PLANBEE_TTS_DISABLED","PLANBEE_LOG_PATH","PLANBEE_ENABLE_MOCK_CLAUDE","PLANBEE_ENABLE_MOCK_LLM","PLANBEE_HOOK_TEST","PLANBEE_EXIT_CODE","PLANBEE_OUTPUT_SUMMARY","PLANBEE_HEARTBEAT_INTERVAL_MS","PLANBEE_HEARTBEAT_ALIVE_MS","PLANBEE_AGENT_ALIVE_MS","PLANBEE_BOT_ID","PLANBEE_BOT_TOKEN","PLANBEE_CHAT_ID","PLANBEE_MESSAGE_ID","PLANBEE_USER_ID","PLANBEE_USER_USERNAME","PLANBEE_GEMINI_FORCE_LEGACY","PLANBEE_GEMINI_FORCE_STREAMING","PLANBEE_GEMINI_CANARY_PERCENT","PLANBEE_GEMINI_NATIVE_PLAN","PLANBEE_GEMINI_LEGACY_TELEMETRY","PLANBEE_AUTH_CACHE_TTL_MS"]);function $O(t){if(!PO.has(t))throw new Error(`Unknown env var: ${t}. Not in PLANBEE namespace table.`);return process.env[t]}function NO(t={}){let e={...process.env},n=require("path").join(require("os").homedir(),"bin");return e.PATH&&!e.PATH.split(":").includes(n)&&(e.PATH=`${n}:${e.PATH}`),"CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH"in e||(e.CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH="5"),"CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS"in e||(e.CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS="20"),Object.assign(e,t),e}function IO(t){return t}Bg.exports={getEnv:$O,buildSpawnEnv:NO,injectEnv:IO}});var it=D((bM,Mg)=>{var RO=require("os"),qc=require("path"),Ae=require("fs");function Es(){return process.env.PLANBEE_CLI_TOKEN_PATH||qc.join(RO.homedir(),".planbee","cli-auth.json")}function FO(){return`${Es()}.lock`}function Mc(t){let e=Es(),n=FO(),s;try{Ae.mkdirSync(qc.dirname(e),{recursive:!0});try{s=Ae.openSync(n,"wx",384)}catch(o){if(o.code!=="EEXIST"||Date.now()-Ae.statSync(n).mtimeMs<3e4)throw o;let i=`${n}.${process.pid}.stale`;Ae.renameSync(n,i);try{Ae.unlinkSync(i)}catch{}s=Ae.openSync(n,"wx",384)}return t()}finally{if(s!==void 0){try{Ae.closeSync(s)}catch{}try{Ae.unlinkSync(n)}catch{}}}}function Uc(t){let e=Es();Ae.mkdirSync(qc.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;Ae.writeFileSync(n,JSON.stringify(t,null,2),{mode:384}),Ae.chmodSync(n,384);try{Ae.renameSync(n,e)}catch(s){if(s.code!=="EEXIST"&&s.code!=="EPERM")throw s;let o=`${e}.${process.pid}.bak`;try{Ae.existsSync(e)&&Ae.renameSync(e,o),Ae.renameSync(n,e);try{Ae.unlinkSync(o)}catch{}}catch(r){try{!Ae.existsSync(e)&&Ae.existsSync(o)&&Ae.renameSync(o,e)}catch{}try{Ae.unlinkSync(n)}catch{}throw r}}try{Ae.chmodSync(e,384)}catch{}}function jO(t){return Mc(()=>Uc(t))}function yo(){try{return JSON.parse(Ae.readFileSync(Es(),"utf8"))}catch{return null}}var qg=2*60*1e3;function LO(){let t=process.env.PLANBEE_PAT_INVALID_RETRY_MS;if(t===void 0||String(t).trim()==="")return qg;let e=Number(t);return Number.isFinite(e)&&e>=0?e:qg}function Hc(t,e=Date.now()){if(!t||!t.invalid_at)return!1;let n=new Date(t.invalid_at).getTime();return Number.isNaN(n)?!1:e-n<LO()}function BO(){let t=yo();return t&&!Hc(t)&&typeof t.token=="string"&&t.token?t.token:null}function qO(){let t=yo();return t&&!Hc(t)&&typeof t.api_url=="string"&&t.api_url?t.api_url:null}function MO(){try{Ae.unlinkSync(Es())}catch{}}function UO(t="INVALID_TOKEN",e=null){return Mc(()=>{let n=yo();return!n||!n.token||e&&n.token!==e?!1:(Uc({...n,invalid_at:new Date().toISOString(),invalid_reason:t}),!0)})}function HO(t=null){return Mc(()=>{let e=yo();if(!e||!e.token||t&&e.token!==t||!e.invalid_at&&!e.invalid_reason)return!1;let n={...e};return delete n.invalid_at,delete n.invalid_reason,Uc(n),!0})}Mg.exports={get TOKEN_PATH(){return Es()},save:jO,load:yo,getToken:BO,getApiUrl:qO,clear:MO,markInvalid:UO,markValid:HO,isBlockingInvalid:Hc}});var Hg=D((xM,Ug)=>{var zO=de(),{resolveApiUrl:WO}=te(),{getEnv:JO}=Be(),KO=`${WO()}/notify`,GO=["info","success","error","warning","progress","question","joke","finished_user_interaction_required"],VO=["happy","sad","excited","serious","calm","neutral","cheerful"];async function YO(t){let e={message:t.message};t.projectId&&(e.project_id=t.projectId),t.session&&(e.session_id=t.session),t.type&&(e.type=t.type),t.title&&(e.title=t.title),t.mood&&(e.mood=t.mood),t.speed!==void 0&&(e.speech_speed=parseFloat(t.speed)),t.volume!==void 0&&(e.volume=parseFloat(t.volume)),t.voice&&(e.voice=t.voice);let n={"Content-Type":"application/json"},s=null;try{s=it().getToken()}catch{s=null}s||(s=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN),s&&(n.Authorization=`Bearer ${s}`);try{return{success:!0,data:(await zO.post(KO,e,{headers:n,timeout:5e3})).data}}catch(o){return o.code==="ECONNREFUSED"||o.code==="ETIMEDOUT"?{success:!1,error:"Cannot connect to PlanBee server",exitCode:3}:o.response?{success:!1,error:`HTTP ${o.response.status}: ${o.response.data?.error||"Unknown error"}`,exitCode:2}:{success:!1,error:o.message,exitCode:2}}}async function XO(t){let e=t.message||t._[0];e||(console.error("Error: Message is required"),process.exit(1)),e.length>5e3&&(console.error("Error: Message must not exceed 5000 characters"),process.exit(1));let n=await YO({message:e,projectId:t.projectId,session:t.session,type:t.type,title:t.title,mood:t.mood,speed:t.speed,volume:t.volume,voice:t.voice});if(n.success){if(t.json)console.log(JSON.stringify(n.data,null,2));else if(!t.quiet){let s=n.data?.id||n.data?.message_id||"ok";console.log(`Message sent (ID: ${s})`),n.data?.warning&&console.warn(`Warning: ${n.data.warning}`)}process.exit(0)}else t.quiet||console.error(`Error: ${n.error}`),process.exit(n.exitCode||1)}Ug.exports={command:"speak [message]",describe:"Send voice notification",builder:t=>t.positional("message",{type:"string",description:"Message to speak (1-5000 characters)"}).option("project-id",{alias:"p",type:"string",description:"Project UUID for project-specific voice"}).option("session",{alias:"S",type:"string",description:"Agent session ID (auto-resolves project)",default:JO("PLANBEE_SESSION_ID")}).option("type",{alias:"y",type:"string",description:"Message type",choices:GO,default:"info"}).option("title",{alias:"t",type:"string",description:"Short title (max 100 chars)"}).option("mood",{alias:"m",type:"string",description:"Voice mood",choices:VO,default:"neutral"}).option("speed",{alias:"s",type:"number",description:"Speech speed (0.5-2.0)",default:1}).option("volume",{alias:"o",type:"number",description:"Volume (0.0-1.0)",default:.8}).option("voice",{alias:"v",type:"string",description:"Voice (OpenAI: alloy, nova, etc.)"}).option("quiet",{alias:"q",type:"boolean",description:"Suppress output",default:!1}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example('$0 speak "Build complete"',"Simple notification").example('$0 speak "Tests passed" -y success',"Success message").example('$0 speak "Error occurred" -y error -m serious',"Error with mood").example('$0 speak "Task done" -y finished_user_interaction_required',"Request user attention"),handler:XO}});var Wg=D((vM,zg)=>{zg.exports={command:"configure",describe:"Configure Linear API integration for a project",builder:t=>t.option("api-key",{type:"string",description:"Linear API key (lin_api_...)",demandOption:!0}).option("team-id",{type:"string",description:"Linear team ID",demandOption:!0}).option("webhook-secret",{type:"string",description:"Webhook HMAC secret for signature validation",default:null}).option("project",{type:"string",description:"Project name (unique identifier)",default:"maestro"}).option("disable",{type:"boolean",description:"Disable sync for this project",default:!1}).option("default-project",{type:"string",description:"Default Linear project ID (UUID) for new issues",default:null}),handler:async()=>{console.error("Error: `planbee linear configure` is not available in the standalone CLI package yet."),console.error(" Reason: config is written directly to Postgres; no REST endpoint exists for it (see issue #123)."),console.error(" Use the PlanBee app settings UI to configure Linear integration for now."),process.exit(1)}}});var Kg=D((wM,Jg)=>{Jg.exports={command:"sync",describe:"Manually sync tasks to Linear",builder:t=>t.option("project",{type:"string",description:"Project name from linear_sync_config",default:"maestro"}).option("dry-run",{type:"boolean",description:"Simulate sync without making changes",default:!1}).option("force",{type:"boolean",description:"Skip conflict detection, force overwrite",default:!1}),handler:async()=>{console.error("Error: `planbee linear sync` is not available in the standalone CLI package yet."),console.error(" Reason: the sync engine talks directly to Postgres; no REST endpoint exists for it (see issue #123)."),process.exit(1)}}});var Rt=D((EM,Yg)=>{var zc=/^[A-Z]+-\d+$/,bo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Re={INVALID_ISSUE_ID:"INVALID_ISSUE_ID",INVALID_LABEL_ID:"INVALID_LABEL_ID",INVALID_CONFLICT_ID:"INVALID_CONFLICT_ID",ISSUE_NOT_FOUND:"ISSUE_NOT_FOUND",CONFLICT_NOT_FOUND:"CONFLICT_NOT_FOUND",API_CONNECTION_ERROR:"API_CONNECTION_ERROR",API_TIMEOUT:"API_TIMEOUT",INVALID_INPUT:"INVALID_INPUT",UNAUTHORIZED:"UNAUTHORIZED",RATE_LIMITED:"RATE_LIMITED",SERVER_ERROR:"SERVER_ERROR"},It={[Re.INVALID_ISSUE_ID]:t=>`Error: Invalid issue ID format "${t}". Expected format: ABC-123 or UUID`,[Re.INVALID_LABEL_ID]:t=>`Error: Invalid label ID format "${t}". Label IDs must be UUIDs.`,[Re.INVALID_CONFLICT_ID]:t=>`Error: Invalid conflict ID format "${t}". Conflict IDs must be UUIDs.`,[Re.ISSUE_NOT_FOUND]:t=>`Error: Issue not found: ${t}`,[Re.CONFLICT_NOT_FOUND]:t=>`Error: Conflict not found: ${t}`,[Re.API_CONNECTION_ERROR]:()=>"Error: Cannot connect to PlanBee API. Is the server running?",[Re.API_TIMEOUT]:t=>`Error: Request timed out after ${t}ms`,[Re.INVALID_INPUT]:t=>`Error: Invalid or missing field: ${t}`,[Re.UNAUTHORIZED]:()=>"Error: Unauthorized. Check your API key.",[Re.RATE_LIMITED]:()=>"Error: Rate limit exceeded. Please try again later.",[Re.SERVER_ERROR]:()=>"Error: Server error. Please try again."};function Gg(t){return!t||typeof t!="string"?!1:zc.test(t)||bo.test(t)}function QO(t){return bo.test(t)}function ZO(t){return zc.test(t)}function eT(t){Gg(t)||(console.error(It[Re.INVALID_ISSUE_ID](t)),process.exit(1))}function Vg(t){if(t.code==="ECONNREFUSED")return It[Re.API_CONNECTION_ERROR]();if(t.code==="ETIMEDOUT"||t.code==="ECONNABORTED")return It[Re.API_TIMEOUT](t.config?.timeout||"unknown");if(t.response){let{status:e,data:n}=t.response;if(e===401)return It[Re.UNAUTHORIZED]();if(e===404)return It[Re.ISSUE_NOT_FOUND](n?.issueId||"unknown");if(e===429)return It[Re.RATE_LIMITED]();if(e>=500)return It[Re.SERVER_ERROR]();if(n?.error)return`Error: ${n.error}`}return`Error: ${t.message}`}function tT(t){console.error(Vg(t)),process.exit(1)}function nT(t){if(!t||t==="")return[];let e=t.split(",").map(n=>n.trim()).filter(n=>n);for(let n of e)bo.test(n)||(console.error(It[Re.INVALID_LABEL_ID](n)),process.exit(1));return e}function sT(t){(!t||!bo.test(t))&&(console.error(It[Re.INVALID_CONFLICT_ID](t||"empty")),process.exit(1))}function oT(t=3e4){return{timeout:t,validateStatus:e=>e<500}}Yg.exports={isValidIssueId:Gg,isUUID:QO,isIdentifier:ZO,validateIssueId:eT,validateLabelIds:nT,validateConflictId:sT,getErrorMessage:Vg,handleError:tT,createAxiosConfig:oT,ErrorCodes:Re,ErrorMessages:It,ISSUE_IDENTIFIER_PATTERN:zc,UUID_PATTERN:bo}});var Qg=D((DM,Xg)=>{var rT=de(),{validateIssueId:iT,handleError:aT}=Rt(),{resolveApiUrl:cT}=te(),lT=cT();async function uT(t){let{issueId:e,json:n,project:s="default"}=t;iT(e);try{let o=await rT.get(`${lT}/api/v1/linear/issue/${e}`,{params:{project:s}});if(n)console.log(JSON.stringify(o.data,null,2));else{let{issue:r}=o.data;console.log(`Issue: ${r.identifier}`),console.log(`Title: ${r.title}`),console.log(`Status: ${r.status}`),console.log(`Priority: ${r.priority}`),console.log(`Created: ${r.created}`),console.log(`Updated: ${r.updated}`),r.description&&console.log(`
|
|
92
|
+
Description:
|
|
93
|
+
${r.description}`),r.labels&&r.labels.length>0&&console.log(`
|
|
94
|
+
Labels: ${r.labels.map(i=>i.name).join(", ")}`),r.comments&&r.comments.length>0&&(console.log(`
|
|
95
|
+
Comments (${r.comments.length}):`),r.comments.forEach((i,a)=>{console.log(`
|
|
96
|
+
--- Comment ${a+1} by ${i.user.name} ---`),console.log(` ${i.body}`)}))}process.exit(0)}catch(o){aT(o)}}Xg.exports={command:"get <issue-id>",describe:"Get Linear issue details",builder:t=>t.positional("issue-id",{type:"string",description:"Linear issue identifier (e.g., INF-978) or UUID"}).option("project",{type:"string",description:"Project name",default:"maestro"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example("$0 linear get INF-978","Get issue details").example("$0 linear get INF-978 --json","Get issue as JSON").example("$0 linear get INF-978 --project maestro","Get issue from specific project"),handler:uT}});var ey=D((SM,Zg)=>{var pT=de(),{validateIssueId:dT,handleError:fT}=Rt(),{resolveApiUrl:mT}=te(),hT=mT();async function gT(t){let{issueId:e,message:n,json:s,project:o="default"}=t;dT(e),n||(console.error("Error: message is required"),process.exit(1));try{let r=await pT.post(`${hT}/api/v1/linear/issue/${e}/comment`,{content:n,project:o});if(s)console.log(JSON.stringify(r.data,null,2));else{let{commentId:i,createdAt:a}=r.data;console.log("[OK] Comment added successfully"),console.log(`Comment ID: ${i}`),console.log(`Created at: ${a}`)}process.exit(0)}catch(r){fT(r)}}Zg.exports={command:"comment <issue-id> <message>",describe:"Add comment to Linear issue",builder:t=>t.positional("issue-id",{type:"string",description:"Linear issue identifier (e.g., INF-978) or UUID"}).positional("message",{type:"string",description:"Comment message (Markdown supported)"}).option("project",{type:"string",description:"Project name",default:"maestro"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example('$0 linear comment INF-978 "Phase 1 completed"',"Add simple comment").example('$0 linear comment INF-978 "**Status**: All tests passing" --json',"Add Markdown comment"),handler:gT}});var ny=D((kM,ty)=>{var yT=de(),{validateIssueId:bT,handleError:xT}=Rt(),{resolveApiUrl:vT}=te(),wT=vT();async function ET(t){let{issueId:e,status:n,json:s,project:o="default"}=t;bT(e);let r=["Todo","In Progress","In Review","Done","Cancelled","Canceled","Backlog","Duplicate"];r.includes(n)||(console.error(`Error: Invalid status. Must be one of: ${r.join(", ")}`),process.exit(1));try{let i=await yT.put(`${wT}/api/v1/linear/issue/${e}/status`,{status:n,project:o});if(s)console.log(JSON.stringify(i.data,null,2));else{let{issueId:a,status:c,updatedAt:l}=i.data;console.log("[OK] Status updated successfully"),console.log(`Issue: ${a}`),console.log(`New status: ${c}`),console.log(`Updated at: ${l}`)}process.exit(0)}catch(i){xT(i)}}ty.exports={command:"status <issue-id> <status>",describe:"Update Linear issue status",builder:t=>t.positional("issue-id",{type:"string",description:"Linear issue identifier (e.g., INF-978) or UUID"}).positional("status",{type:"string",description:"New status",choices:["Todo","In Progress","In Review","Done","Cancelled","Canceled","Backlog","Duplicate"]}).option("project",{type:"string",description:"Project name",default:"maestro"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example('$0 linear status INF-978 "In Progress"',"Set status to In Progress").example("$0 linear status INF-978 Done --json","Mark as Done (JSON output)"),handler:ET}});var iy=D((AM,ry)=>{var sy=de(),{resolveApiUrl:DT}=te(),oy=DT();async function ST(t,e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?t:(await sy.get(`${oy}/api/v1/linear/issue/${t}`,{params:{project:e}})).data.issue.id}async function kT(t){let{title:e,description:n,linearProject:s,project:o="default",priority:r,json:i,parent:a}=t;e||(console.error("Error: --title is required"),process.exit(1));try{let c={title:e,project:o};n&&(c.description=n),s&&(c.projectId=s),r!==void 0&&(c.priority=r),a&&(c.parentId=await ST(a,o));let l=await sy.post(`${oy}/api/v1/linear/issue`,c);if(i)console.log(JSON.stringify(l.data,null,2));else{let{issueId:u,identifier:p,createdAt:d}=l.data;console.log("[OK] Issue created successfully"),console.log(`Identifier: ${p}`),console.log(`Issue ID: ${u}`),console.log(`Created at: ${d}`)}process.exit(0)}catch(c){c.response?console.error(`Error: ${c.response.data.error||c.message}`):c.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${c.message}`),process.exit(1)}}ry.exports={command:"create",describe:"Create new Linear issue",builder:t=>t.option("title",{type:"string",description:"Issue title",demandOption:!0}).option("description",{type:"string",description:"Issue description (Markdown supported)"}).option("linear-project",{type:"string",description:"Linear project ID"}).option("project",{type:"string",description:"PlanBee project name",default:"maestro"}).option("priority",{type:"number",description:"Priority (0-4)",choices:[0,1,2,3,4]}).option("parent",{type:"string",description:"Parent issue identifier (e.g., INF-1134) to create sub-issue"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example('$0 linear create --title "Bug fix" --description "Fix login issue"',"Create basic issue").example('$0 linear create --title "Feature" --priority 2 --json',"Create with priority").example('$0 linear create --title "Subtask" --parent INF-1134',"Create sub-issue"),handler:kT}});var uy=D((_M,ly)=>{var ay=de(),{validateIssueId:AT,validateLabelIds:_T,handleError:CT}=Rt(),{resolveApiUrl:OT}=te(),cy=OT();async function TT(t){let{issueId:e,set:n,json:s,project:o="default"}=t;AT(e);try{if(n!==void 0){let r=_T(n),i=await ay.put(`${cy}/api/v1/linear/issue/${e}/labels`,{labelIds:r,project:o});if(s)console.log(JSON.stringify(i.data,null,2));else{let{issueId:a,updatedAt:c}=i.data;console.log("[OK] Labels updated successfully"),console.log(`Issue: ${a}`),console.log(`Updated at: ${c}`)}}else{let r=await ay.get(`${cy}/api/v1/linear/issue/${e}/labels`,{params:{project:o}});if(s)console.log(JSON.stringify(r.data,null,2));else{let{labels:i}=r.data;i.length===0?console.log("No labels found"):(console.log(`Labels for ${e}:`),i.forEach(a=>{console.log(` - ${a.name} (ID: ${a.id}, Color: ${a.color})`)}))}}process.exit(0)}catch(r){CT(r)}}ly.exports={command:"labels <issue-id>",describe:"Manage Linear issue labels",builder:t=>t.positional("issue-id",{type:"string",description:"Linear issue identifier (e.g., INF-978) or UUID"}).option("set",{type:"string",description:"Set labels (comma-separated label IDs)"}).option("project",{type:"string",description:"Project name",default:"maestro"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example("$0 linear labels INF-978","List labels").example("$0 linear labels INF-978 --set label-1,label-2","Set specific labels").example('$0 linear labels INF-978 --set "" ',"Clear all labels"),handler:TT}});var dy=D((CM,py)=>{var PT=de(),{resolveApiUrl:$T}=te(),NT=$T();async function IT(t){let{resolved:e,json:n,limit:s=50,offset:o=0}=t;try{let r={limit:s,offset:o};e!==void 0&&(r.resolved=e);let i=await PT.get(`${NT}/api/v1/linear/conflicts`,{params:r});if(n)console.log(JSON.stringify(i.data,null,2));else{let{conflicts:a,total:c}=i.data;a.length===0?console.log("No conflicts found"):(console.log(`Linear Conflicts (${a.length}/${c}):
|
|
97
|
+
`),a.forEach((l,u)=>{console.log(`${u+1}. Conflict ID: ${l.id}`),console.log(` Task ID: ${l.task_id}`),console.log(` Linear Issue: ${l.linear_issue_id}`),console.log(` Winner: ${l.winner}`),console.log(` Created: ${l.created_at}`),console.log(` Resolved: ${l.resolved_at||"Not resolved"}`),console.log("")}))}process.exit(0)}catch(r){r.response?console.error(`Error: ${r.response.data.error||r.message}`):r.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${r.message}`),process.exit(1)}}py.exports={command:"conflicts",describe:"List Linear sync conflicts",builder:t=>t.option("resolved",{type:"boolean",description:"Filter by resolved status (true/false)"}).option("limit",{type:"number",description:"Max results to return",default:50}).option("offset",{type:"number",description:"Pagination offset",default:0}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example("$0 linear conflicts","List all conflicts").example("$0 linear conflicts --resolved false","List unresolved conflicts only").example("$0 linear conflicts --resolved true --json","List resolved conflicts as JSON"),handler:IT}});var my=D((OM,fy)=>{var RT=de(),{validateConflictId:FT,handleError:jT,ErrorMessages:LT,ErrorCodes:BT}=Rt(),{resolveApiUrl:qT}=te(),MT=qT();async function UT(t){let{conflictId:e,resolution:n,json:s,project:o="maestro"}=t;FT(e);try{let r=await RT.post(`${MT}/api/v1/linear/conflicts/${e}/resolve`,{resolution:n,project:o});if(s)console.log(JSON.stringify(r.data,null,2));else{let{conflictId:i,winner:a,resolvedAt:c}=r.data;console.log("[OK] Conflict resolved successfully"),console.log(`Conflict ID: ${i}`),console.log(`Winner: ${a}`),console.log(`Resolved at: ${c}`)}process.exit(0)}catch(r){r.response&&r.response.status===404&&(console.error(LT[BT.CONFLICT_NOT_FOUND](e)),process.exit(1)),jT(r)}}fy.exports={command:"resolve <conflict-id> <resolution>",describe:"Resolve Linear sync conflict",builder:t=>t.positional("conflict-id",{type:"string",description:"Conflict UUID"}).positional("resolution",{type:"string",description:"Resolution strategy",choices:["keep_planbee","keep_linear","manual_merge"]}).option("project",{type:"string",description:"Project name",default:"maestro"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example("$0 linear resolve abc-123 keep_planbee","Keep PlanBee version").example("$0 linear resolve abc-123 keep_linear --json","Keep Linear version (JSON output)"),handler:UT}});var gy=D((TM,hy)=>{var HT=de(),{validateIssueId:zT,handleError:WT,createAxiosConfig:JT}=Rt(),{resolveApiUrl:KT}=te(),GT=KT();async function VT(t){let{issueId:e,description:n,json:s,project:o="default"}=t;zT(e),!n&&n!==""&&(console.error("Error: description is required"),process.exit(1));try{let r=await HT.put(`${GT}/api/v1/linear/issue/${e}/update-description`,{description:n,project:o},JT());if(s)console.log(JSON.stringify(r.data,null,2));else{let{issueId:i,updatedAt:a}=r.data;console.log("Description updated successfully"),console.log(`Issue ID: ${i}`),console.log(`Updated at: ${a}`)}process.exit(0)}catch(r){WT(r)}}hy.exports={command:"description <issue-id> <description>",describe:"Update Linear issue description",builder:t=>t.positional("issue-id",{type:"string",description:"Linear issue identifier (e.g., INF-978) or UUID"}).positional("description",{type:"string",description:"New description (Markdown supported, max 65535 chars)"}).option("project",{type:"string",description:"Project name",default:"maestro"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example('$0 linear description INF-978 "Updated requirements"',"Update description").example('$0 linear description INF-978 "**Status**: Phase 1 complete" --json',"Update with Markdown"),handler:VT}});var by=D((PM,yy)=>{var YT=de(),{validateIssueId:XT,handleError:QT,createAxiosConfig:ZT}=Rt(),{resolveApiUrl:eP}=te(),tP=eP();async function nP(t){let{issueId:e,commentId:n,content:s,json:o,project:r="maestro"}=t;XT(e),n||(console.error("Error: comment-id is required"),process.exit(1)),s||(console.error("Error: content is required"),process.exit(1));try{let i=await YT.put(`${tP}/api/v1/linear/issue/${e}/comment/${n}`,{content:s,project:r},ZT());o?console.log(JSON.stringify(i.data,null,2)):(console.log("[OK] Comment updated successfully"),console.log(`Comment ID: ${i.data.commentId}`),console.log(`Updated at: ${i.data.updatedAt}`)),process.exit(0)}catch(i){QT(i)}}yy.exports={command:"edit-comment <issue-id> <comment-id> <content>",describe:"Update Linear comment",builder:t=>t.positional("issue-id",{type:"string",description:"Linear issue identifier (e.g., INF-978) or UUID"}).positional("comment-id",{type:"string",description:"Comment ID (UUID)"}).positional("content",{type:"string",description:"New comment content (max 65535 chars)"}).option("project",{type:"string",description:"Project name",default:"maestro"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example('$0 linear edit-comment INF-978 abc-123 "Updated text"',"Update comment"),handler:nP}});var vy=D(($M,xy)=>{var sP=de(),{validateIssueId:oP,handleError:rP,createAxiosConfig:iP}=Rt(),{resolveApiUrl:aP}=te(),cP=aP();async function lP(t){let{issueId:e,commentId:n,json:s,project:o="maestro"}=t;oP(e),n||(console.error("Error: comment-id is required"),process.exit(1));try{let r=await sP.delete(`${cP}/api/v1/linear/issue/${e}/comment/${n}?project=${o}`,iP());s?console.log(JSON.stringify(r.data,null,2)):(console.log("[OK] Comment deleted successfully"),console.log(`Comment ID: ${r.data.commentId||"deleted"}`)),process.exit(0)}catch(r){rP(r)}}xy.exports={command:"delete-comment <issue-id> <comment-id>",describe:"Delete Linear comment",builder:t=>t.positional("issue-id",{type:"string",description:"Linear issue identifier (e.g., INF-978) or UUID"}).positional("comment-id",{type:"string",description:"Comment ID (UUID)"}).option("project",{type:"string",description:"Project name",default:"maestro"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example("$0 linear delete-comment INF-978 abc-123","Delete comment"),handler:lP}});var Ey=D((NM,wy)=>{var uP=de(),{handleError:pP}=Rt(),{resolveApiUrl:dP}=te(),fP=dP();async function mP(t){let{projectId:e,status:n,limit:s,json:o,project:r="default"}=t;try{let i=await uP.get(`${fP}/api/v1/linear/issues`,{params:{projectId:e,status:n,limit:s,project:r}}),{issues:a}=i.data;o?console.log(JSON.stringify(a,null,2)):!a||a.length===0?console.log("No issues found matching filters."):(console.log(`Found ${a.length} issues:
|
|
98
|
+
`),a.forEach(c=>{let l=c.assignee?`(@${c.assignee.name})`:"",u=c.project?`[${c.project.name}] `:"";console.log(`[${c.status}] ${u}${c.identifier}: ${c.title} ${l}`)}))}catch(i){if(i.response){let{data:a}=i.response;a&&a.error&&(console.error(`Error: ${a.error}`),process.exit(1))}pP(i)}process.exit(0)}wy.exports={command:"list",describe:"List Linear issues (filters: --project-id, --status)",builder:t=>t.option("project-id",{type:"string",description:"Filter by Linear Project ID"}).option("status",{type:"string",description:'Filter by Status (e.g. "In Progress")'}).option("limit",{type:"number",description:"Max issues to return",default:50}).option("project",{type:"string",description:"PlanBee Project name",default:"maestro"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example('$0 linear list --status "In Progress"',"List all in-progress issues").example("$0 linear list --project-id logic-project-id","List issues in specific project"),handler:mP}});var Sy=D((IM,Dy)=>{var Wc=de(),{resolveApiUrl:hP}=te(),Jc=hP();async function gP(t){try{let e=await Wc.get(`${Jc}/api/v1/linear/polling/status`,{timeout:1e4}),n=e.data.status||[];t.json&&(console.log(JSON.stringify(e.data,null,2)),process.exit(0)),n.length===0&&(console.log("Kein Linear-Polling konfiguriert."),process.exit(0));for(let s of n)console.log(`Config: ${s.project_name||"default"} (${s.config_id})`),console.log(` Aktiv: ${s.is_active?"Ja":"Nein"}`),console.log(` Intervall: ${s.poll_interval_seconds}s`),console.log(` Letzte Abfrage: ${s.last_poll_at||"Nie"}`),console.log(` Fehler: ${s.error_count}${s.last_error?` (${s.last_error})`:""}`),s.auto_spawn_enabled&&console.log(` Auto-Spawn: Ja (bei Status "${s.auto_spawn_on_status||"Todo"}")`),console.log("");process.exit(0)}catch(e){e.code==="ECONNREFUSED"?console.error("Error: PlanBee server nicht erreichbar"):console.error(`Error: ${e.response?.data?.error||e.message}`),process.exit(1)}}async function yP(t){try{let e=t.configId?{configId:t.configId}:{},n=await Wc.post(`${Jc}/api/v1/linear/polling/start`,e,{timeout:1e4});t.json?console.log(JSON.stringify(n.data,null,2)):console.log(n.data.message||"Polling gestartet"),process.exit(0)}catch(e){console.error(`Error: ${e.response?.data?.error||e.message}`),process.exit(1)}}async function bP(t){try{let e=t.configId?{configId:t.configId}:{},n=await Wc.post(`${Jc}/api/v1/linear/polling/stop`,e,{timeout:1e4});t.json?console.log(JSON.stringify(n.data,null,2)):console.log(n.data.message||"Polling gestoppt"),process.exit(0)}catch(e){console.error(`Error: ${e.response?.data?.error||e.message}`),process.exit(1)}}Dy.exports={command:"polling <action>",describe:"Manage Linear polling service",builder:t=>t.positional("action",{type:"string",description:"Polling action",choices:["status","start","stop"]}).option("config-id",{type:"string",description:"Specific config ID (optional)"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example("$0 linear polling status","Show polling state").example("$0 linear polling start","Start all polling").example("$0 linear polling stop","Stop all polling"),handler:async t=>{switch(t.action){case"status":return gP(t);case"start":return yP(t);case"stop":return bP(t);default:console.error(`Unknown action: ${t.action}`),process.exit(1)}}}});var _y=D((RM,Ay)=>{var xP=de(),{resolveApiUrl:vP}=te(),wP=vP(),ky={issue_created:"Erstellt",issue_updated:"Aktualisiert",status_changed:"Status",comment_added:"Kommentar",label_changed:"Label",assignee_changed:"Zugewiesen",priority_changed:"Prioritaet",auto_spawn:"Auto-Agent"};async function EP(t){let{limit:e=20,type:n,issueId:s,json:o}=t;try{let r=new URLSearchParams;r.set("limit",String(e)),n&&r.set("eventType",n),s&&r.set("issueId",s);let i=await xP.get(`${wP}/api/v1/linear/activity?${r.toString()}`,{timeout:1e4}),a=i.data.activities||[];o&&(console.log(JSON.stringify(i.data,null,2)),process.exit(0)),a.length===0&&(console.log("Keine Linear-Aktivitaeten gefunden."),process.exit(0)),console.log(`Linear-Aktivitaeten (${a.length} von ${i.data.total}):
|
|
99
|
+
`);for(let c of a){let l=ky[c.event_type]||c.event_type,u=c.linear_issue_identifier||c.linear_issue_id?.slice(0,8),p=DP(c.created_at),d="";c.old_value&&c.new_value&&(d=` ${c.old_value} -> ${c.new_value}`),console.log(` [${l}] ${u}: ${c.issue_title||""}${d} (${p})`)}process.exit(0)}catch(r){r.code==="ECONNREFUSED"?console.error("Error: PlanBee server nicht erreichbar"):console.error(`Error: ${r.response?.data?.error||r.message}`),process.exit(1)}}function DP(t){if(!t)return"";let e=Date.now()-new Date(t).getTime(),n=Math.floor(e/6e4);if(n<1)return"gerade eben";if(n<60)return`vor ${n}m`;let s=Math.floor(n/60);return s<24?`vor ${s}h`:`vor ${Math.floor(s/24)}d`}Ay.exports={command:"activity",describe:"Show recent Linear activity feed",builder:t=>t.option("limit",{type:"number",description:"Max entries to show",default:20}).option("type",{type:"string",description:"Filter by event type",choices:Object.keys(ky)}).option("issue-id",{type:"string",description:"Filter by issue ID"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example("$0 linear activity","Show recent activity").example("$0 linear activity --type status_changed","Show only status changes").example("$0 linear activity --issue-id INF-1234","Show activity for specific issue"),handler:EP}});var Oy=D((FM,Cy)=>{var SP=de(),{resolveApiUrl:kP}=te(),AP=kP(),Kc=["backlog","todo","in_progress","in_review","done","cancelled"];async function _P(t){let{sessionId:e,status:n,json:s}=t;Kc.includes(n)||(console.error(`Error: Invalid workflow status. Must be one of: ${Kc.join(", ")}`),process.exit(1));try{let o=await SP.patch(`${AP}/api/v1/agents/${e}/workflow-status`,{workflowStatus:n},{timeout:1e4});s?console.log(JSON.stringify(o.data,null,2)):(console.log(`Workflow-Status aktualisiert: ${o.data.oldStatus} -> ${o.data.newStatus}`),o.data.linearIssueId&&console.log(`Linear-Ticket: ${o.data.linearIssueId} (synchronisiert)`)),process.exit(0)}catch(o){if(o.response){let r=o.response.data?.error||o.response.statusText;console.error(`Error: ${r}`)}else o.code==="ECONNREFUSED"?console.error("Error: PlanBee server nicht erreichbar"):console.error(`Error: ${o.message}`);process.exit(1)}}Cy.exports={command:"workflow-status <session-id> <status>",describe:"Set workflow status for an agent (Linear Deep Integration)",builder:t=>t.positional("session-id",{type:"string",description:"Agent session ID"}).positional("status",{type:"string",description:"Workflow status",choices:Kc}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example("$0 workflow-status abc-123 in_progress","Set agent to In Progress").example("$0 workflow-status abc-123 done --json","Mark as Done (JSON)"),handler:_P}});var Ds=D((jM,qy)=>{var CP=require("crypto"),Py=require("fs"),Ty=require("os"),Vr=require("path"),$y=6e3,Gc=4e3,Yr=16e3,Ny=4,Iy=new Set(["RUN_COMMAND","VIEW_FILE","GREP_SEARCH","FIND","LIST_DIRECTORY","CODE_ACTION","READ_URL_CONTENT","SEARCH_WEB","ASK_QUESTION","INVOKE_SUBAGENT","ERROR_MESSAGE"]),Ry=new Set(["EPHEMERAL_MESSAGE","SYSTEM_MESSAGE","CONVERSATION_HISTORY","CHECKPOINT","GENERIC"]);function Fy(t){let e=Vr.join(Ty.homedir(),".gemini","antigravity-cli","brain",String(t)),n=Vr.join(e,".system_generated","logs","transcript.jsonl");return Py.existsSync(n)?e:Vr.join(Ty.homedir(),".gemini","antigravity","brain",String(t))}function jy(t){return Vr.join(Fy(t),".system_generated","logs","transcript.jsonl")}function OP(t){try{return!!t&&Py.existsSync(jy(t))}catch{return!1}}function Ly(t,e){let n=CP.createHash("sha1").update(`${t}:${e}`).digest("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}function xo(t,e){let n=typeof t=="string"?t:String(t??"");return n.length<=e?n:`${n.slice(0,e)}
|
|
100
|
+
\u2026[gek\xFCrzt]`}function TP(t){if(!t||typeof t!="object")return{};let e;try{e=JSON.stringify(t)}catch{return{}}return e.length<=Gc?t:{_truncated:`${e.slice(0,Gc)}
|
|
101
|
+
\u2026[gek\xFCrzt]`}}function PP(t){return typeof t!="string"?"":t.replace(/<\/?USER_REQUEST>/g,"").trim()}function By(t,e,n){let s=(t||"").trim();if(!s)return[];let o;try{o=JSON.parse(s)}catch{return[]}if(!o||typeof o!="object"||!o.type)return[];if(Ry.has(o.type))return[];let r=Ly(e,o.step_index!=null?o.step_index:`t${o.created_at||""}`);if(o.type==="USER_INPUT"){let i=PP(o.content);return i?[{type:"user",uuid:r,message:{role:"user",content:xo(i,Yr)}}]:[]}if(o.type==="PLANNER_RESPONSE"){let i=[];if(typeof o.thinking=="string"&&o.thinking.trim()&&i.push({type:"text",text:xo(o.thinking.trim(),Yr)}),typeof o.content=="string"&&o.content.trim()&&i.push({type:"text",text:xo(o.content.trim(),Yr)}),Array.isArray(o.tool_calls)&&o.tool_calls.forEach((c,l)=>{!c||typeof c!="object"||i.push({type:"tool_use",id:`${r}-${l}`,name:c.name||"unknown",input:TP(c.args)})}),!i.length)return[];let a={role:"assistant",content:i};return Number.isFinite(n)&&(a.usage={input_tokens:Math.round(n/Ny),planbee_estimated:!0}),[{type:"assistant",uuid:r,message:a}]}if(Iy.has(o.type)){let i=typeof o.content=="string"?o.content:"";return o.type==="ERROR_MESSAGE"&&typeof o.error=="string"&&o.error.trim()&&(i=i?`${o.error}
|
|
102
|
+
${i}`:o.error),!i||!i.trim()?[]:[{type:"user",uuid:r,message:{role:"user",content:[{type:"tool_result",tool_use_id:r,content:xo(i,$y)}]}}]}return[]}function $P(t,e,n){let s=[],o=n;for(let r of String(t||"").split(`
|
|
103
|
+
`))if(r.trim()){Number.isFinite(o)&&(o+=r.length+1);for(let i of By(r,e,o))s.push(JSON.stringify(i))}return s.length?`${s.join(`
|
|
104
|
+
`)}
|
|
105
|
+
`:""}qy.exports={agyLineToStreamJson:By,agyChunkToStreamJson:$P,agyBrainDir:Fy,agyTranscriptPath:jy,hasAgyTranscript:OP,deterministicUuid:Ly,TOOL_RESULT_TYPES:Iy,SKIP_TYPES:Ry,clip:xo,MAX_TEXT_CHARS:Yr,MAX_TOOL_RESULT_CHARS:$y,MAX_TOOL_ARGS_CHARS:Gc,CHARS_PER_TOKEN_ESTIMATE:Ny}});var qn=D((LM,Jy)=>{var Xr=require("fs"),NP=require("os"),My=require("path"),{execFileSync:Uy}=require("child_process");function Hy(t){if(process.platform==="win32"){let e=Uy("powershell.exe",["-NoProfile","-NonInteractive","-Command",`(Get-CimInstance Win32_Process -Filter "ProcessId=${t}").CommandLine`],{encoding:"utf-8",windowsHide:!0}).trim();if(!e)throw new Error(`no command line for pid ${t}`);return e}return Uy("ps",["-p",String(t),"-o","command="],{encoding:"utf-8"})}function zy(t,e){let n=()=>My.join(NP.homedir(),".planbee",t),s=c=>My.join(n(),`${c}.pid`),o=(c,l=process.pid)=>{try{return Xr.mkdirSync(n(),{recursive:!0}),Xr.writeFileSync(s(c),String(l),"utf-8"),!0}catch{return!1}},r=c=>{try{Xr.unlinkSync(s(c))}catch{}},i=c=>{try{let l=parseInt(Xr.readFileSync(s(c),"utf-8").trim(),10);return Number.isInteger(l)&&l>0?l:null}catch{return null}};return{pidFilePath:s,writePidFile:o,removePidFile:r,readPid:i,isAlive:c=>{let l=i(c);if(!l)return!1;try{process.kill(l,0)}catch{return r(c),!1}try{let u=Hy(l);return e(u,c)?!0:(r(c),!1)}catch{return!1}},dir:n}}var IP=/(?:--session|-S)[=\s]+([0-9a-fA-F-]{36})/;function Wy(t,e){if(!/inbox/.test(t)||!/(--wait|-W\b|--watch)/.test(t))return!1;let n=t.match(IP);return!n||n[1].toLowerCase()===String(e).toLowerCase()}var Ss=zy("wait",Wy);function RP(){return Ss.dir()}function FP(t){return Ss.pidFilePath(t)}function jP(t,e){return Ss.writePidFile(t,e)}function LP(t){return Ss.removePidFile(t)}function BP(t){return Ss.readPid(t)}function qP(t){return Ss.isAlive(t)}Jy.exports={readCommandLine:Hy,waitDir:RP,pidFilePath:FP,writePidFile:jP,removePidFile:LP,readPid:BP,isWatcherAlive:qP,createPidStore:zy,waitCmdlineMatches:Wy}});var Qr=D((BM,eb)=>{var Mn=require("fs"),Yc=require("path"),Yy=require("os"),{resolveApiUrl:MP}=te(),vo="[transcript-sync]",Vc=200*1024,Ky=8e3,UP=3e4,HP=999999999,zP=6e4,Gy=new Map;function Xy(){return Yc.join(Yy.homedir(),".planbee","transcript-sync")}function Qy(t){return Yc.join(Xy(),`${t}.json`)}function WP(t){try{let e=Mn.readFileSync(Qy(t),"utf-8"),n=JSON.parse(e);return Number.isFinite(n.offset)&&n.offset>=0?n.offset:0}catch{return 0}}function JP(t,e){try{Mn.mkdirSync(Xy(),{recursive:!0}),Mn.writeFileSync(Qy(t),JSON.stringify({offset:e,updatedAt:new Date().toISOString()}))}catch(n){console.error(`${vo} offset persist failed (non-fatal):`,n.message)}}function KP(){let t=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN;if(t)return t;try{return it().getToken()||null}catch{return null}}function Zy(t){let e=process.cwd().replace(/[/.]/g,"-");return Yc.join(Yy.homedir(),".claude","projects",e,`${t}.jsonl`)}async function Vy(t,e,n){let s=new AbortController,o=setTimeout(()=>s.abort(),n);try{return await fetch(t,{...e,signal:s.signal})}finally{clearTimeout(o)}}async function GP(t,{transcriptPath:e}={}){let n={synced:0,skippedLongLines:0};try{if(!t)return{...n,reason:"no-session"};let s=e||Zy(t),o;try{o=Mn.statSync(s)}catch{return{...n,reason:"no-file"}}let r=WP(t);if(r>o.size&&(r=0),r>=o.size)return{...n,reason:"up-to-date"};let i=KP();if(!i)return{...n,reason:"no-token"};let a=MP().replace(/\/$/,""),c=Gy.get(t);if(!c||Date.now()-c.ts>zP){let E=await Vy(`${a}/api/v1/sessions/${t}`,{headers:{Authorization:`Bearer ${i}`}},Ky);if(!E.ok)return{...n,reason:`ownership-${E.status}`};Gy.set(t,{ts:Date.now()})}let l=Mn.openSync(s,"r"),u;try{let E=Buffer.alloc(o.size-r);Mn.readSync(l,E,0,E.length,r),u=E.toString("utf-8")}finally{Mn.closeSync(l)}let p=u.lastIndexOf(`
|
|
106
|
+
`);if(p===-1)return{...n,reason:"no-complete-line"};let d=u.slice(0,p+1),f=Buffer.byteLength(d,"utf-8"),m=`${a}/api/v1/agents/${t}/response`,h=Date.now()+UP,g="",b=0,v=async()=>{if(!g)return!0;let E=await Vy(m,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify({content:g,sequence:HP,stream:"stdout"})},Ky);return E.ok?(n.synced+=1,b+=Buffer.byteLength(g,"utf-8"),g="",!0):(console.error(`${vo} chunk POST failed (${E.status}) \u2014 Rest beim n\xE4chsten Turn`),!1)};for(let E of d.split(`
|
|
107
|
+
`)){if(Date.now()>h){console.error(`${vo} Zeitbudget ersch\xF6pft \u2014 Rest beim n\xE4chsten Turn`);break}let S=`${E}
|
|
108
|
+
`;if(!E.trim()){g+=S;continue}if(Buffer.byteLength(S,"utf-8")>Vc){if(n.skippedLongLines+=1,!await v())break;b+=Buffer.byteLength(S,"utf-8");continue}if(Buffer.byteLength(g,"utf-8")+Buffer.byteLength(S,"utf-8")>Vc&&!await v())break;g+=S}return g&&await v(),b>0&&JP(t,r+Math.min(b,f)),n.skippedLongLines>0&&console.error(`${vo} ${n.skippedLongLines} Zeile(n) > ${Vc/1024}kb \xFCbersprungen (Riesen-Tool-Output)`),n}catch(s){return console.error(`${vo} sync error (non-fatal):`,s.message),{...n,reason:`error:${s.message}`}}}eb.exports={syncTranscript:GP,defaultTranscriptPath:Zy}});var Qc=D((qM,ab)=>{var Ct=require("fs"),Ft=require("path"),VP=require("os"),{resolveApiUrl:YP}=te(),wo="[subagent-sync]",tb=200*1024,XP=8e3,QP=2e4,ZP=40,Xc=new Map;function sb(){return Ft.join(VP.homedir(),".planbee","transcript-sync")}function ob(t){return Ft.join(sb(),`${t}.json`)}function e$(t){try{let e=JSON.parse(Ct.readFileSync(ob(t),"utf-8"));return Number.isFinite(e.offset)&&e.offset>=0?e.offset:0}catch{return 0}}function nb(t,e){try{Ct.mkdirSync(sb(),{recursive:!0}),Ct.writeFileSync(ob(t),JSON.stringify({offset:e,updatedAt:new Date().toISOString()}))}catch(n){console.error(`${wo} offset persist failed (non-fatal):`,n.message)}}function t$(){let t=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN;if(t)return t;try{return it().getToken()||null}catch{return null}}async function n$(t,e,n){let s=new AbortController,o=setTimeout(()=>s.abort(),n);try{return await fetch(t,{...e,signal:s.signal})}finally{clearTimeout(o)}}function rb(t,e){if(!t||!e)return null;let n=Ft.basename(e).replace(/\.jsonl$/,"");return Ft.join(Ft.dirname(e),n||t,"subagents")}function ib(t){let e=[],n=/^agent-([0-9a-f]{8,32})\.jsonl$/i,s;try{s=Ct.readdirSync(t,{withFileTypes:!0})}catch{return e}for(let o of s)if(o.isFile()){let r=o.name.match(n);r&&e.push({file:Ft.join(t,o.name),agentId:r[1],workflowId:null})}else if(o.isDirectory()&&o.name==="workflows"){let r=[];try{r=Ct.readdirSync(Ft.join(t,"workflows"),{withFileTypes:!0})}catch{}for(let i of r){if(!i.isDirectory()||!i.name.startsWith("wf_"))continue;let a=[];try{a=Ct.readdirSync(Ft.join(t,"workflows",i.name))}catch{}for(let c of a){let l=c.match(n);l&&e.push({file:Ft.join(t,"workflows",i.name,c),agentId:l[1],workflowId:i.name})}}}return e}function s$(t){let e=t.replace(/\.jsonl$/,".meta.json");if(Xc.has(e))return Xc.get(e);let n=null;try{n=JSON.parse(Ct.readFileSync(e,"utf-8"))}catch{n=null}return n&&Xc.set(e,n),n}async function o$(t,{transcriptPath:e}={}){let n={files:0,posted:0};try{let s=rb(t,e);if(!s)return{...n,reason:"no-session"};let o=ib(s);if(!o.length)return{...n,reason:"no-files"};let r=t$();if(!r)return{...n,reason:"no-token"};let a=`${YP().replace(/\/$/,"")}/api/v1/agents/${t}/subagent-transcript`,c=Date.now()+QP;for(let{file:l,agentId:u,workflowId:p}of o.slice(0,ZP)){if(Date.now()>c){console.error(`${wo} Zeitbudget ersch\xF6pft \u2014 Rest beim n\xE4chsten Lauf`);break}let d;try{d=Ct.statSync(l)}catch{continue}let f=`${t}--agent-${u}`,m=e$(f);if(m>d.size&&(m=0),m>=d.size)continue;n.files+=1;let h=Ct.openSync(l,"r"),g,b=0;try{let L=Buffer.alloc(Math.min(d.size-m,tb));b=Ct.readSync(h,L,0,L.length,m),g=L.toString("utf-8",0,b)}finally{Ct.closeSync(h)}let v=g.lastIndexOf(`
|
|
109
|
+
`);if(v===-1){d.size-m>tb&&(nb(f,m+b),console.error(`${wo} Riesen-Zeile in ${Ft.basename(l)} \xFCbersprungen`));continue}let E=g.slice(0,v+1),S=s$(l)||{},C={agentId:u,content:E,meta:{agentType:S.agentType||(p?"workflow-subagent":null),toolUseId:S.toolUseId||null,description:S.description||null,workflowId:p}},B=await n$(a,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify(C)},XP);if(!B.ok){console.error(`${wo} POST failed (${B.status}) f\xFCr agent-${u} \u2014 Rest beim n\xE4chsten Lauf`);continue}nb(f,m+Buffer.byteLength(E,"utf-8")),n.posted+=1}return n}catch(s){return console.error(`${wo} sync error (non-fatal):`,s.message),{...n,reason:`error:${s.message}`}}}ab.exports={syncSubagents:o$,subagentsDir:rb,_collectAgentFiles:ib}});var fn=D((MM,lb)=>{var cb=require("fs"),{spawn:r$}=require("child_process"),{createPidStore:i$}=qn(),{syncTranscript:a$}=Qr(),{syncSubagents:c$,subagentsDir:l$}=Qc(),Eo=i$("sync-ticker",t=>/internal-hook/.test(t)&&/sync-ticker/.test(t)),u$=15e3,p$=700,d$=2*60*60*1e3;function f$(t){return new Promise(e=>{setTimeout(e,t)})}function Zr(t){try{process.stderr.write(`[sync-ticker] ${t}
|
|
110
|
+
`)}catch{}}async function m$(t,e={},n={}){if(!t)return;let{transcriptPath:s,intervalMs:o=u$,debounceMs:r=p$,maxRuntimeMs:i=d$}=e,a=n.syncTranscript||a$,c=n.syncSubagents||c$,l=n.sleep||f$,u=n.watch||cb.watch,{writePidFile:p,removePidFile:d,readPid:f}=Eo;p(t);let m=process.pid,h=!0,g=!1,b=!1,v=!1,E=async()=>{if(g)return null;if(b)return v=!0,null;b=!0;let M=null;try{M=await a(t,{transcriptPath:s}),M&&M.reason&&M.reason!=="up-to-date"&&Zr(`sync no-op: reason=${M.reason}`),await c(t,{transcriptPath:s})}catch(z){Zr(`sync failed (non-fatal): ${z.message}`)}finally{b=!1,v&&!g&&(v=!1,M=await E())}return M},S=null,C=null,B=()=>{if(S||g||!s)return!1;try{return S=u(s,()=>{C&&clearTimeout(C),C=setTimeout(()=>{C=null,E()},r)}),S&&typeof S.on=="function"&&S.on("error",()=>{try{S.close()}catch{}S=null}),E(),!0}catch{return S=null,!1}},L=null,$=()=>{if(L||g||!s)return!1;let M=l$(t,s);if(!M||!cb.existsSync(M))return!1;try{return L=u(M,{recursive:!0},()=>{C&&clearTimeout(C),C=setTimeout(()=>{C=null,E()},r)}),L&&typeof L.on=="function"&&L.on("error",()=>{try{L.close()}catch{}L=null}),E(),!0}catch{return L=null,!1}},I=()=>{if(g=!0,C&&(clearTimeout(C),C=null),S){try{S.close()}catch{}S=null}if(L){try{L.close()}catch{}L=null}},R=()=>{I(),d(t),process.exit(0)};process.on("SIGTERM",R),process.on("SIGINT",R),B(),$();let U=Date.now()+i,Q=0;try{for(;;){if(await l(o),f(t)!==m){h=!1;return}if(Date.now()>=U)break;S||B(),L||$();let M=await E();if(M&&M.reason==="no-file"){if(Q+=1,Q>=3)break}else M&&(Q=0)}}finally{process.removeListener("SIGTERM",R),process.removeListener("SIGINT",R),I(),h&&d(t)}}function h$(t,e,n={}){try{if(!t||!e)return!1;let s=n.isAlive||Eo.isAlive,o=n.spawn||r$;if(s(t))return!1;let r=o(process.execPath,[require.resolve("../cli/index.js"),"internal-hook","--type","sync-ticker","--session",t,"--transcript-path",e],{detached:!0,stdio:"ignore"});return r&&typeof r.unref=="function"&&r.unref(),!0}catch(s){return Zr(`spawn failed (non-fatal): ${s.message}`),!1}}function g$(t){try{if(!t)return;let e=Eo.readPid(t);if(e)try{process.kill(e,"SIGTERM")}catch{}Eo.removePidFile(t)}catch(e){Zr(`stop failed (non-fatal): ${e.message}`)}}lb.exports={runTicker:m$,spawnTickerIfNeeded:h$,stopTicker:g$,_store:Eo}});var So=D((UM,wb)=>{var Un=require("fs"),gb=require("path"),y$=require("os"),{resolveApiUrl:b$}=te(),{agyChunkToStreamJson:x$,agyTranscriptPath:yb}=Ds(),Do="[agy-transcript-sync]",ub=240*1024,pb=8e3,v$=3e4,bb=999999999,w$=6e4,db=new Map,fb=Buffer.byteLength(JSON.stringify({content:"",sequence:bb,stream:"stdout"}),"utf-8");function E$(t){return Buffer.byteLength(JSON.stringify(t),"utf-8")-2}var Zc="agy-transcript-sync";function xb(t=Zc){return gb.join(y$.homedir(),".planbee",t)}function vb(t,e){return gb.join(xb(e),`${t}.json`)}function D$(t,e){try{let n=JSON.parse(Un.readFileSync(vb(t,e),"utf-8"));return Number.isFinite(n.offset)&&n.offset>=0?n.offset:0}catch{return 0}}function S$(t,e,n){try{Un.mkdirSync(xb(n),{recursive:!0}),Un.writeFileSync(vb(t,n),JSON.stringify({offset:e,updatedAt:new Date().toISOString()}))}catch(s){console.error(`${Do} offset persist failed (non-fatal):`,s.message)}}function k$(){let t=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN;if(t)return t;try{return it().getToken()||null}catch{return null}}async function mb(t,e,n){let s=new AbortController,o=setTimeout(()=>s.abort(),n);try{return await fetch(t,{...e,signal:s.signal})}finally{clearTimeout(o)}}async function hb(t,{transcriptPath:e,convert:n=x$,stateDirName:s=Zc}={}){let o={synced:0,converted:0};try{if(!t)return{...o,reason:"no-session"};let r=e||yb(t),i;try{i=Un.statSync(r)}catch{return{...o,reason:"no-file"}}let a=D$(t,s);if(a>i.size&&(a=0),a>=i.size)return{...o,reason:"up-to-date"};let c=k$();if(!c)return{...o,reason:"no-token"};let l=b$().replace(/\/$/,""),u=db.get(t);if(!u||Date.now()-u.ts>w$){let R=await mb(`${l}/api/v1/sessions/${t}`,{headers:{Authorization:`Bearer ${c}`}},pb);if(!R.ok)return{...o,reason:`ownership-${R.status}`};db.set(t,{ts:Date.now()})}let p=Un.openSync(r,"r"),d;try{let R=Buffer.alloc(i.size-a);Un.readSync(p,R,0,R.length,a),d=R.toString("utf-8")}finally{Un.closeSync(p)}let f=d.lastIndexOf(`
|
|
111
|
+
`);if(f===-1)return{...o,reason:"no-complete-line"};let m=d.slice(0,f+1),h=Buffer.byteLength(m,"utf-8"),g=`${l}/api/v1/agents/${t}/response`,b=Date.now()+v$,v=m.split(`
|
|
112
|
+
`),E=v.length-1,S="",C=0,B=0,L=0,$=a,I=async()=>{if(!S)return L+=B,B=0,!0;let R=await mb(g,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify({content:S,sequence:bb,stream:"stdout"})},pb);return R.ok?(o.synced+=1,L+=B,B=0,S="",C=0,!0):(console.error(`${Do} chunk POST failed (${R.status}) \u2014 Rest beim n\xE4chsten Tick`),!1)};for(let R=0;R<=E;R+=1){if(Date.now()>b){console.error(`${Do} Zeitbudget ersch\xF6pft \u2014 Rest beim n\xE4chsten Tick`);break}let U=v[R],Q=Buffer.byteLength(R===E?U:`${U}
|
|
113
|
+
`,"utf-8");if($+=Q,!U.trim()){B+=Q;continue}let M=n(U,t,$);M&&(o.converted+=1);let z=M?E$(M):0;if(fb+z>ub){if(console.error(`${Do} Zeile > Body-Budget (${z}B escaped) \u2014 \xFCbersprungen`),!await I())break;L+=Q;continue}if(S&&fb+C+z>ub&&!await I())break;S+=M,C+=z,B+=Q}return(S||B)&&await I(),L>0&&S$(t,a+Math.min(L,h),s),o}catch(r){return console.error(`${Do} sync error (non-fatal):`,r.message),{...o,reason:`error:${r.message}`}}}wb.exports={syncAgyTranscript:hb,syncAdaptedTranscript:hb,agyTranscriptPath:yb,DEFAULT_STATE_DIR_NAME:Zc}});var ko=D((HM,_b)=>{var A$=require("fs"),{spawn:Eb}=require("child_process"),el=fn(),{syncAgyTranscript:_$}=So(),{agyTranscriptPath:Db,hasAgyTranscript:C$}=Ds(),tl=el._store,Sb=24*60*60*1e3,kb=30*60*1e3;function Ab(t){try{process.stderr.write(`[agy-sync-ticker] ${t}
|
|
114
|
+
`)}catch{}}function nl(t,e,n=Eb){try{let s=n(process.execPath,[require.resolve("../cli/index.js"),"internal-hook","--type","agy-sync-ticker","--session",t,"--transcript-path",e],{detached:!0,stdio:"ignore"});return s&&typeof s.unref=="function"&&s.unref(),!0}catch(s){return Ab(`spawn failed (non-fatal): ${s.message}`),!1}}async function O$(t,e={},n={}){if(!t)return;let s=n.runTicker||el.runTicker,o=n.syncAgyTranscript||_$,r=n.statSync||A$.statSync,i=n.spawnDetached||nl,a=n.readPid||tl.readPid,c=n.now||Date.now,l=n.selfPid||process.pid,u=e.transcriptPath||Db(t),p=e.maxRuntimeMs||Sb;await s(t,{...e,transcriptPath:u,maxRuntimeMs:p},{syncTranscript:o,syncSubagents:async()=>null});try{let d=a(t);if(d&&d!==l)return;let f=r(u);c()-f.mtimeMs<kb&&i(t,u)}catch{}}function T$(t,e,n={}){try{if(!t)return!1;let s=n.isAlive||tl.isAlive,o=n.spawn||Eb,r=n.hasAgyTranscript||C$,i=e||Db(t);return!e&&!r(t)||s(t)?!1:nl(t,i,o)}catch(s){return Ab(`spawn failed (non-fatal): ${s.message}`),!1}}function P$(t){return el.stopTicker(t)}_b.exports={runAgyTicker:O$,spawnAgyTickerIfNeeded:T$,stopAgyTicker:P$,_spawnDetached:nl,_store:tl,AGY_MAX_RUNTIME_MS:Sb,RESPAWN_ACTIVE_WINDOW_MS:kb}});var Rb=D((zM,Ib)=>{var Tb=require("crypto"),$$=6e3,Cb=4e3,Ob=16e3,Pb=new Set(["system"]);function $b(t,e){let n=Tb.createHash("sha1").update(`${t}:${e}`).digest("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}function sl(t,e){let n=typeof t=="string"?t:String(t??"");return n.length<=e?n:`${n.slice(0,e)}
|
|
115
|
+
\u2026[gek\xFCrzt]`}function N$(t){if(!t||typeof t!="object")return{};let e;try{e=JSON.stringify(t)}catch{return{}}return e.length<=Cb?t:{_truncated:`${e.slice(0,Cb)}
|
|
116
|
+
\u2026[gek\xFCrzt]`}}function I$(t){return Tb.createHash("sha1").update(t).digest("hex").slice(0,16)}function Nb(t,e){let n=(t||"").trim();if(!n)return[];let s;try{s=JSON.parse(n)}catch{return[]}if(!s||typeof s!="object"||!s.type)return[];if(Pb.has(s.type))return[];let o=s.id!=null?s.id:s.timestamp||I$(n),r=$b(e,o);if(s.type==="user.message"){let i=s.data&&typeof s.data.content=="string"?s.data.content:"";return i?[{type:"user",uuid:r,message:{role:"user",content:sl(i,Ob)}}]:[]}if(s.type==="assistant.message"){let i=[],a=s.data&&typeof s.data.content=="string"?s.data.content:"";return a.trim()&&i.push({type:"text",text:sl(a.trim(),Ob)}),(s.data&&Array.isArray(s.data.toolRequests)?s.data.toolRequests:[]).forEach((l,u)=>{!l||typeof l!="object"||i.push({type:"tool_use",id:`${r}-${u}`,name:l.name||"unknown",input:N$(l.arguments)})}),i.length?[{type:"assistant",uuid:r,message:{role:"assistant",content:i}}]:[]}if(s.type==="tool.execution_complete"){let i=s.data&&s.data.result&&typeof s.data.result.content=="string"?s.data.result.content:"",a=!!(s.data&&s.data.success===!1);return!i&&!a?[]:[{type:"user",uuid:r,message:{role:"user",content:[{type:"tool_result",tool_use_id:r,content:sl(i||"[Tool-Fehler ohne Ausgabe]",$$)}]}}]}return[]}function R$(t,e){let n=[];for(let s of String(t||"").split(`
|
|
117
|
+
`))if(s.trim())for(let o of Nb(s,e))n.push(JSON.stringify(o));return n.length?`${n.join(`
|
|
118
|
+
`)}
|
|
119
|
+
`:""}Ib.exports={copilotLineToStreamJson:Nb,copilotEventToStreamJson:R$,deterministicUuid:$b,SKIP_TYPES:Pb}});var ol=D((WM,Lb)=>{var Hn=require("fs"),Fb=require("os"),zn=require("path");function jb(t){if(t)return t;let e=zn.join(Fb.homedir(),".copilot","session-state");if(Hn.existsSync(e))return e;let n=zn.join(Fb.homedir(),".github-copilot","session-state");return Hn.existsSync(n)?n:e}async function F$(t,e,n={}){let s=jb(n.dir);if(e){let o=zn.join(s,e,"events.jsonl");try{return await Hn.promises.access(o,Hn.constants.R_OK),o}catch{}}if(!t)return null;try{let o=await Hn.promises.readdir(s,{withFileTypes:!0}),r=[],i=zn.resolve(t);for(let a of o){if(!a.isDirectory())continue;let c=zn.join(s,a.name,"workspace.yaml");try{let u=(await Hn.promises.readFile(c,"utf-8")).match(/^cwd:\s*(.+)$/m);if(u){let p=u[1].replace(/^['"]|['"]$/g,"").trim();if(p===t||zn.resolve(p)===i){let d=zn.join(s,a.name,"events.jsonl");try{let f=await Hn.promises.stat(d);r.push({eventsPath:d,mtime:f.mtime})}catch{}}}}catch{}}if(r.length>0)return r.sort((a,c)=>c.mtime-a.mtime),r[0].eventsPath}catch{return null}return null}Lb.exports={discoverCopilotTranscript:F$,copilotSessionStateDir:jb}});var il=D((JM,Vb)=>{var Ot=require("fs"),rl=require("path"),j$=require("os"),{resolveApiUrl:L$}=te(),{copilotEventToStreamJson:B$}=Rb(),{discoverCopilotTranscript:q$}=ol(),Ao="[copilot-transcript-sync]",Bb=240*1024,qb=8e3,M$=3e4,Wb=999999999,U$=6e4,Mb=new Map,Ub=Buffer.byteLength(JSON.stringify({content:"",sequence:Wb,stream:"stdout"}),"utf-8");function H$(t){return Buffer.byteLength(JSON.stringify(t),"utf-8")-2}function ei(t){return t||rl.join(j$.homedir(),".planbee","copilot-transcript-sync")}function Jb(t,e){return rl.join(ei(e),`${t}.json`)}function z$(t,e){try{let n=JSON.parse(Ot.readFileSync(Jb(t,e),"utf-8"));return Number.isFinite(n.offset)&&n.offset>=0?n.offset:0}catch{return 0}}function W$(t,e,n){try{Ot.mkdirSync(ei(n),{recursive:!0}),Ot.writeFileSync(Jb(t,n),JSON.stringify({offset:e,updatedAt:new Date().toISOString()}))}catch(s){console.error(`${Ao} offset persist failed (non-fatal):`,s.message)}}function Kb(t){return rl.join(ei(t),"_noop-stats.json")}function Hb(t,e){try{Ot.mkdirSync(ei(e),{recursive:!0});let n=Kb(e),s={};try{s=JSON.parse(Ot.readFileSync(n,"utf-8"))}catch{s={}}s[t]=(s[t]||0)+1,Ot.writeFileSync(n,JSON.stringify(s))}catch{}}function J$(t){try{return JSON.parse(Ot.readFileSync(Kb(t),"utf-8"))}catch{return{}}}function K$(){let t=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN;if(t)return t;try{return it().getToken()||null}catch{return null}}async function zb(t,e,n){let s=new AbortController,o=setTimeout(()=>s.abort(),n);try{return await fetch(t,{...e,signal:s.signal})}finally{clearTimeout(o)}}async function G$(){return{cliSessionId:null,folder:null}}async function Gb(t,e={},n={}){if(!t)return null;let s=n.discover||q$,o=await G$(t,n),r=o.folder||e.folder||null;try{return await s(r,o.cliSessionId,{dir:e.dir})}catch{return null}}async function V$(t,e={},n={}){let s={synced:0,converted:0},{stateDir:o}=e;try{if(!t)return{...s,reason:"no-session"};let r=e.transcriptPath;if(r||(r=await Gb(t,e,n)),!r)return Hb(t,o),{...s,reason:"no-path"};let i;try{i=Ot.statSync(r)}catch{return Hb(t,o),{...s,reason:"no-file"}}let a=z$(t,o);if(a>i.size&&(a=0),a>=i.size)return{...s,reason:"up-to-date"};let c=K$();if(!c)return{...s,reason:"no-token"};let l=L$().replace(/\/$/,""),u=Mb.get(t);if(!u||Date.now()-u.ts>U$){let I=await zb(`${l}/api/v1/sessions/${t}`,{headers:{Authorization:`Bearer ${c}`}},qb);if(!I.ok)return{...s,reason:`ownership-${I.status}`};Mb.set(t,{ts:Date.now()})}let p=Ot.openSync(r,"r"),d;try{let I=Buffer.alloc(i.size-a);Ot.readSync(p,I,0,I.length,a),d=I.toString("utf-8")}finally{Ot.closeSync(p)}let f=d.lastIndexOf(`
|
|
120
|
+
`);if(f===-1)return{...s,reason:"no-complete-line"};let m=d.slice(0,f+1),h=Buffer.byteLength(m,"utf-8"),g=`${l}/api/v1/agents/${t}/response`,b=Date.now()+M$,v=m.split(`
|
|
121
|
+
`),E=v.length-1,S="",C=0,B=0,L=0,$=async()=>{if(!S)return L+=B,B=0,!0;let I=await zb(g,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify({content:S,sequence:Wb,stream:"stdout"})},qb);return I.ok?(s.synced+=1,L+=B,B=0,S="",C=0,!0):(console.error(`${Ao} chunk POST failed (${I.status}) \u2014 Rest beim n\xE4chsten Tick`),!1)};for(let I=0;I<=E;I+=1){if(Date.now()>b){console.error(`${Ao} Zeitbudget ersch\xF6pft \u2014 Rest beim n\xE4chsten Tick`);break}let R=v[I],U=Buffer.byteLength(I===E?R:`${R}
|
|
122
|
+
`,"utf-8");if(!R.trim()){B+=U;continue}let Q=B$(R,t);Q&&(s.converted+=1);let M=Q?H$(Q):0;if(Ub+M>Bb){if(console.error(`${Ao} Zeile > Body-Budget (${M}B escaped) \u2014 \xFCbersprungen`),!await $())break;L+=U;continue}if(S&&Ub+C+M>Bb&&!await $())break;S+=Q,C+=M,B+=U}return(S||B)&&await $(),L>0&&W$(t,a+Math.min(L,h),o),s}catch(r){return console.error(`${Ao} sync error (non-fatal):`,r.message),{...s,reason:`error:${r.message}`}}}Vb.exports={syncCopilotTranscript:V$,resolveCopilotTranscriptPath:Gb,getCopilotNoopStats:J$}});var Co=D((KM,ex)=>{var _o=require("fs"),Y$=require("os"),al=require("path"),{spawn:Yb}=require("child_process"),cl=fn(),{syncCopilotTranscript:X$,resolveCopilotTranscriptPath:Q$}=il(),ll=cl._store;function Z$(t){return al.join(t||al.join(Y$.homedir(),".planbee","logs"),"copilot-ticker-errors.log")}var Xb=24*60*60*1e3,Qb=30*60*1e3;function Zb(t){try{process.stderr.write(`[copilot-sync-ticker] ${t}
|
|
123
|
+
`)}catch{}}function ul(t,e,n,s=Yb){let o=null;try{let r=n,i=null;r==null&&(i=Z$(),_o.mkdirSync(al.dirname(i),{recursive:!0}),o=_o.openSync(i,"a"),r=o);let a=[require.resolve("../cli/index.js"),"internal-hook","--type","copilot-sync-ticker","--session",t];e&&a.push("--transcript-path",e),i&&a.push("--log-path",i);let c=s(process.execPath,a,{detached:!0,stdio:["ignore","ignore",r]});if(o!==null){try{_o.closeSync(o)}catch{}o=null}return c.unref(),!0}catch(r){if(Zb(`spawn failed (non-fatal): ${r.message}`),o!==null)try{_o.closeSync(o)}catch{}return!1}}async function eN(t,e={},n={}){if(!t)return;let s=n.runTicker||cl.runTicker,o=n.syncCopilotTranscript||X$,r=n.resolvePath||Q$,i=n.statSync||_o.statSync,a=n.spawnDetached||ul,c=n.readPid||ll.readPid,l=n.now||Date.now,u=n.selfPid||process.pid,p=e.maxRuntimeMs||Xb,{transcriptPath:d}=e;if(d||(d=await r(t,e,n)),!!d){await s(t,{...e,transcriptPath:d,maxRuntimeMs:p},{syncTranscript:o,syncSubagents:async()=>null});try{let f=c(t);if(f&&f!==u)return;let m=i(d);l()-m.mtimeMs<Qb&&a(t,d,e.logFd||null)}catch{}}}function tN(t,e,n={}){try{if(!t)return!1;let s=n.isAlive||ll.isAlive,o=n.spawn||Yb;return s(t)?!1:ul(t,e||null,n.logFd||null,o)}catch(s){return Zb(`spawn failed (non-fatal): ${s.message}`),!1}}function nN(t){return cl.stopTicker(t)}ex.exports={runCopilotTicker:eN,spawnCopilotTickerIfNeeded:tN,stopCopilotTicker:nN,_spawnDetached:ul,_store:ll,COPILOT_MAX_RUNTIME_MS:Xb,RESPAWN_ACTIVE_WINDOW_MS:Qb}});var rx=D((GM,ox)=>{var sN=de(),tx=require("path"),{resolveApiUrl:oN}=te(),rN=oN();function nx(t,e){try{if(!t)return;let{hasAgyTranscript:n,agyTranscriptPath:s}=Ds(),o=typeof e=="string"&&e.toLowerCase()==="agy",r=n(t);if(!o&&!r)return;if(o&&!r){console.error(`Warnung: --provider agy gesetzt, aber kein agy-Transcript unter der Session-ID gefunden:
|
|
124
|
+
${s(t)}
|
|
125
|
+
Stelle sicher, dass --session-id die agy Conversation-UUID ist, oder starte den Sync manuell mit einem expliziten Pfad:
|
|
126
|
+
planbee transcript-sync --session ${t} --path <transcript.jsonl>`);return}let{spawnAgyTickerIfNeeded:i}=ko();i(t)}catch{}}function sx(t,e){try{if(!t||!(typeof e=="string"&&e.toLowerCase()==="copilot"))return;let{spawnCopilotTickerIfNeeded:s}=Co();s(t)}catch{}}async function iN(t){let{folder:e,task:n,agentType:s,parent:o,json:r,sessionId:i,force:a,userManaged:c,provider:l}=t;e||(console.error("Error: --folder is required"),process.exit(1)),n||(console.error("Error: --task is required"),process.exit(1)),s||(console.error("Error: --agent-type is required"),process.exit(1));let p={folder:tx.isAbsolute(e)?e:tx.resolve(process.cwd(),e),task:n,agentType:s,parentSessionId:o||null};i&&(p.sessionId=i),a&&(p.force=!0),c&&(p.spawnSource="user-cli");try{let d=await sN.post(`${rN}/api/v1/sessions/register`,p),f=d.data.session||d.data,m=i||f.sessionId||f.id;r?console.log(JSON.stringify(d.data,null,2)):(console.log("[OK] Session registered successfully"),console.log(`Session ID: ${f.sessionId||f.id}`),console.log(`Agent Type: ${f.agentType}`),console.log(`Status: ${f.status}`),f.parentSessionId&&console.log(`Parent: ${f.parentSessionId}`)),nx(m,l),sx(m,l),process.exit(0)}catch(d){if(d.response)if(d.response.status===409&&d.response.data?.existingSession){let f=d.response.data.existingSession;console.error(`Error: ${d.response.data.error}`),console.error(""),console.error("Existing session:"),console.error(` Session ID: ${f.id}`),console.error(` Agent Type: ${f.agentType}`),console.error(` Status: ${f.status}`),console.error(""),console.error("Use --force to create a new session anyway")}else console.error(`Error: ${d.response.data.error||d.message}`);else d.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${d.message}`);process.exit(1)}}var aN=["queen","planbee-queen","planbee-proxy","planbee-coordinator","planbee-default","researcher","coder","tester","reviewer","architect","debugger","optimizer","guard","watchdog"];ox.exports={command:"register",describe:"Register new agent session",builder:t=>t.option("folder",{type:"string",description:"Workspace folder (absolute path)",demandOption:!0}).option("task",{type:"string",description:"Task description",demandOption:!0}).option("agent-type",{type:"string",description:`Agent type (built-in: ${aN.join(", ")}, or custom types from DB)`,demandOption:!0}).option("parent",{type:"string",description:"Parent session ID"}).option("session-id",{type:"string",description:"Explicit session ID (UUID, auto-generated if not provided)"}).option("force",{type:"boolean",description:"Force new session even if an active session exists for this folder",default:!1}).option("user-managed",{type:"boolean",description:"Mark as user-managed CLI agent (system will never respawn)",default:!1}).option("provider",{type:"string",description:'LLM provider (e.g. "agy" for Antigravity, "copilot" for GitHub Copilot CLI \u2014 enables live transcript sync)'}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example('$0 register --folder /path/to/project --task "Implement feature X" --agent-type coder',"Register coder session").example('$0 register --folder /tmp/project --task "Research task" --agent-type researcher --parent <parent-uuid>',"Register child agent").example('$0 register --folder /path/to/project --task "New task" --agent-type coder --force',"Force new session despite existing"),handler:iN,maybeStartAgySync:nx,maybeStartCopilotSync:sx}});var mn=D((VM,ax)=>{var ks=de(),{resolveApiUrl:cN,getProfile:lN}=te(),pl=cN(),ix=!1;function uN(){ix||(ix=!0,ks.interceptors.request.use(async t=>{if(t.url&&t.url.startsWith(pl)){if(t.headers&&t.headers.Authorization)return t;try{let e=lN();if(e&&e.authRequired){let n=null;try{let s=it();if(n=s.getToken(),n&&s.isBlockingInvalid){let o=s.load();o&&o.invalid_at&&(t._planbeePatHealToken=n)}}catch{n=null}n||(n=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN),n&&(t.headers=t.headers||{},t.headers.Authorization=`Bearer ${n}`)}}catch{}}return t}),ks.interceptors.response&&typeof ks.interceptors.response.use=="function"&&ks.interceptors.response.use(t=>{let e=t&&t.config&&t.config._planbeePatHealToken,n=t&&t.data&&typeof t.data=="object";if(e&&t.status<400&&n)try{it().markValid(e)}catch{}return t}))}uN();var pN=2e3,dN=["spawning","prepared","idle","not_started"],fN=["error","timeout"];async function mN(t,e,n={}){let s=n.intervalMs||pN,o=Date.now(),r=null;for(;Date.now()-o<e;){try{let i=await ks.get(`${pl}/api/v1/agents/${t}/status`),a=i.data&&i.data.status,c=a&&typeof a=="object"?a.status:a;if(c){if(r=c,fN.includes(c))return{outcome:"error",status:c};if(!dN.includes(c))return{outcome:"active",status:c}}}catch(i){if(i.response&&i.response.status===404)return{outcome:"error",status:"not_found"}}await new Promise(i=>setTimeout(i,s))}return{outcome:"timeout",status:r}}ax.exports={axios:ks,PLANBEE_API_URL:pl,pollAgentStatus:mN}});var dx=D((YM,px)=>{var{randomUUID:hN}=require("crypto"),gN=require("path"),{axios:ml,PLANBEE_API_URL:hl,pollAgentStatus:yN}=mn(),{getEnv:cx}=Be(),{getProfile:lx}=te(),{isAbsoluteAnyPlatform:bN}=Qa(),dl=0,As=1,fl=3,ux=90;function jt(t,e,n){n?console.log(JSON.stringify({success:e.success,sessionId:e.sessionId??null,status:e.status??null,phase:e.phase??null,deviceId:e.deviceId??null,hostname:e.hostname??null,deduplicated:e.deduplicated===!0,...e.delegatedTo?{delegatedTo:e.delegatedTo}:{},...e.error?{error:e.error}:{}})):e.error?console.error(`Error: ${e.error}`):t===dl?(console.log("[OK] Agent running (confirmed)"),console.log(`Session ID: ${e.sessionId}`),console.log(`Status: ${e.status}`),e.delegatedTo&&console.log(`Delegated to: ${e.delegatedTo.hostname||e.delegatedTo.deviceId}`),e.deduplicated&&console.log("(deduplicated: existing session returned)")):t===fl&&(console.log("[..] Agent accepted but NOT confirmed running."),console.log(`Session ID: ${e.sessionId}`),console.log(`Status: ${e.status}`),e.delegatedTo&&console.log(`Delegated to: ${e.delegatedTo.hostname||e.delegatedTo.deviceId}`),console.log(`Do NOT blindly re-spawn \u2014 check with: planbee status --session ${e.sessionId}`)),process.exit(t)}var xN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function vN(t){if(xN.test(t))return{deviceId:t};let e;try{let o=await ml.get(`${hl}/api/v1/devices`);e=o.data&&o.data.devices||[]}catch(o){return{error:`Konnte Ger\xE4te-Liste nicht laden: ${o.response?.data?.error||o.message}`}}let n=t.toLowerCase(),s=e.filter(o=>o.hostname&&o.hostname.toLowerCase()===n);if(s.length===0){let o=e.length?e.map(r=>`${r.hostname||"?"} (${r.deviceId})`).join(", "):"(keine registrierten Ger\xE4te)";return{error:`Kein Ger\xE4t mit hostname "${t}". Verf\xFCgbar: ${o}`}}if(s.length>1){let o=s.map(r=>`${r.hostname} (${r.deviceId})`).join(", ");return{error:`Mehrdeutiger hostname "${t}" \u2014 Kandidaten: ${o}. Bitte device_id angeben.`}}return{deviceId:s[0].deviceId,hostname:s[0].hostname||null}}function wN(t){return t.length?t.map(e=>`${e.hostname||"?"} (${e.online?"online":"offline"})`).join(", "):"(keine registrierten Ger\xE4te)"}async function EN(){let t;try{let s=await ml.get(`${hl}/api/v1/devices`);t=s.data&&s.data.devices||[]}catch(s){return{error:`Konnte Ger\xE4te-Liste nicht laden: ${s.response?.data?.error||s.message}`}}let e=t.filter(s=>s.online===!0);if(e.length===1)return{deviceId:e[0].deviceId,hostname:e[0].hostname||null};if(t.length===0)return{error:"Kein --device angegeben und keine registrierten Ger\xE4te gefunden. (keine registrierten Ger\xE4te)"};let n=wN(t);return e.length===0?{error:`Kein --device angegeben und kein Ger\xE4t online. Registrierte Ger\xE4te: ${n}`}:{error:`Kein --device angegeben und mehrere Ger\xE4te online (${e.length}). Bitte --device angeben. Registrierte Ger\xE4te: ${n}`}}function DN(){try{let t=lx();if(t&&t.authRequired)return hN()}catch{}return null}async function SN(t){let{type:e,task:n,parent:s,folder:o,json:r,wait:i,timeout:a,device:c,topic:l,guard:u,watchdog:p,guardModel:d,guardProvider:f,guardReportTo:m,guardCanRestart:h,guardCanStop:g,guardCheckInterval:b,reviewDeepness:v,reviewExecution:E,browserMode:S,browserDomains:C,watchMode:B,model:L,provider:$,permissionMode:I,permissions:R}=t;if(!e)return jt(As,{success:!1,error:"--type is required"},r);if(u&&p)return jt(As,{success:!1,error:"Cannot use both --guard and --watchdog. Choose one."},r);let U=null,Q=null;if(c){let ie=await vN(c);if(ie.error)return jt(As,{success:!1,error:ie.error},r);U=ie.deviceId,Q=ie.hostname||null}else{let ie=null;try{ie=lx()}catch{}if(ie&&ie.mode==="cloud"){let Ue=await EN();if(Ue.error)return jt(As,{success:!1,error:Ue.error},r);U=Ue.deviceId,Q=Ue.hostname||null}}let M=null;o&&(M=bN(o)?o:gN.resolve(process.cwd(),o));let z={};u&&(z.guardMode="guard"),p&&(z.guardMode="watchdog"),d&&(z.guardModel=d),f&&(z.guardProvider=f),m&&(z.guardReportTo=m),h&&(z.guardCanRestart=!0),g&&(z.guardCanStop=!0),b&&(z.guardCheckInterval=Number(b)),v&&(z.reviewDeepness=v),E&&(z.reviewExecution=E),S&&S!=="none"&&(z.browserMode=S,C&&(z.browserDomains=C.split(",").map(ie=>ie.trim()).filter(Boolean))),B!==void 0&&(z.watchMode=B),$&&(z.llmType=$),L&&(z.model=L),I&&(z.permissionMode=I),l&&typeof l=="string"&&l.trim()&&(z.topic=l.trim());let ge=DN(),oe=(Number(a)>0?Number(a):ux)*1e3,xe=i!==!1,Ee;try{let ie={};cx("PLANBEE_SESSION_ID")&&(ie["X-PlanBee-Caller-Session"]=cx("PLANBEE_SESSION_ID")),Ee=await ml.post(`${hl}/api/v1/agents/spawn`,{agentType:e,taskDescription:n||"",parentSessionId:s||null,workspacePath:M,permissions:R,metadata:Object.keys(z).length>0?z:void 0,...ge?{idempotencyKey:ge}:{},...U?{targetDeviceId:U}:{}},{headers:ie})}catch(ie){let Ue;return ie.response?Ue=ie.response.data?.error||ie.message:ie.code==="ECONNREFUSED"?Ue="Cannot connect to PlanBee API. Is the server running?":Ue=ie.message,jt(As,{success:!1,error:Ue},r)}let ve=Ee.data||{},Me=ve.agent||{},F=ve.sessionId||Me.sessionId||null,H=ve.status||Me.status||null,W=ve.phase||null,N=ve.deduplicated===!0,ce=ve.delegatedTo||null,pe=ce&&ce.deviceId||U||null,Z=ce&&ce.hostname||Q||null,me={deviceId:pe,hostname:Z,...ce?{delegatedTo:ce}:{}};if(W==="running")return jt(dl,{success:!0,sessionId:F,status:H||"running",phase:"running",deduplicated:N,...me},r);if(!xe)return jt(fl,{success:!0,sessionId:F,status:H||"spawning",phase:"accepted",deduplicated:N,...me},r);r||console.log(`Waiting for agent ${F} to become active (timeout ${oe/1e3}s)...`);let _e=await yN(F,oe);if(_e.outcome==="active")return jt(dl,{success:!0,sessionId:F,status:_e.status,phase:"running",deduplicated:N,...me},r);if(_e.outcome==="error"){let ie=_e.status==="not_found";return jt(As,{success:!1,sessionId:F,status:_e.status,phase:"accepted",deduplicated:N,...me,error:ie?"Agent not found during status poll":`Agent entered '${_e.status}' state`},r)}return jt(fl,{success:!0,sessionId:F,status:_e.status||H||"spawning",phase:"accepted",deduplicated:N,...me},r)}var kN=["queen","researcher","coder","tester","reviewer","architect","debugger","optimizer","guard","watchdog"];px.exports={command:"spawn",describe:"Spawn new agent process",builder:t=>t.option("type",{type:"string",description:`Agent type (built-in: ${kN.join(", ")}, or custom types from DB)`}).option("task",{type:"string",description:"Task description"}).option("parent",{type:"string",description:"Parent session ID"}).option("folder",{type:"string",description:"Workspace folder path"}).option("device",{type:"string",description:"Target device (device_id UUID or unique hostname) to run the agent on (delegates via GET /devices; see `planbee devices`). In cloud mode, omitting this auto-selects your single online device (fails with a device list if 0 or 2+ are online)."}).option("guard",{type:"boolean",description:"Spawn a Guard agent to monitor workflow compliance",default:!1}).option("watchdog",{type:"boolean",description:"Spawn a Watchdog agent for simple process monitoring",default:!1}).option("guard-model",{type:"string",description:"Model for the guard/watchdog (default: sonnet for guard, haiku for watchdog)"}).option("guard-provider",{type:"string",description:"LLM provider for guard/watchdog (e.g., copilot, claude)"}).option("guard-report-to",{type:"string",description:"Session ID for watchdog/guard to report issues to"}).option("guard-can-restart",{type:"boolean",description:"Allow guard to restart the target agent",default:!1}).option("guard-can-stop",{type:"boolean",description:"Allow guard to stop the target agent",default:!1}).option("guard-check-interval",{type:"number",description:"Minutes between guard checks (default: 5 for guard, 10 for watchdog)"}).option("review-deepness",{type:"string",description:"Review depth level",choices:["surface","standard","deep","extreme"]}).option("review-execution",{type:"string",description:"Review execution mode (task = Task-Tool sub-agents)",choices:["task"]}).option("browser-mode",{type:"string",description:"Browser integration mode (chrome requires Chrome Extension, playwright uses MCP)",choices:["none","chrome","playwright","both"],default:"none"}).option("browser-domains",{type:"string",description:'Comma-separated domain allowlist for browser access (e.g. "*.example.com,localhost:*")'}).option("watch-mode",{type:"boolean",description:"Enable inbox watch mode (default: true for copilot, false for claude)"}).option("provider",{type:"string",description:"LLM provider for the agent (claude, copilot)",choices:["claude","copilot"]}).option("model",{type:"string",description:"Model name or shorthand (e.g. opus, sonnet, haiku, claude-sonnet-4-6)"}).option("topic",{type:"string",description:"Optional topic/name for the agent"}).option("permissions",{type:"string",description:"Message permission mode for this agent: allow-only-coordinator (default: unrestricted)",choices:["allow-only-coordinator"]}).option("permission-mode",{type:"string",hidden:!0,description:"Legacy alias for permissions"}).option("json",{type:"boolean",description:"Output exactly one JSON object { success, sessionId, status, phase, deduplicated, error? }",default:!1}).option("wait",{type:"boolean",description:"Poll agent status until active/error/timeout (default: true; use --no-wait to skip)",default:!0}).option("timeout",{type:"number",description:"Poll timeout in seconds when waiting (default: 90)",default:ux}).example('$0 spawn --type coder --task "Implement auth" --parent <uuid>',"Spawn coder agent (waits for confirmation)").example('$0 spawn --type researcher --task "Research X" --no-wait',"Spawn without waiting (exit 3 = accepted, not confirmed)").example('$0 spawn --type queen --task "Lead project" --provider copilot --model opus',"Spawn queen with specific model").example('$0 spawn --type coder --task "Fix bug" --device my-macbook',"Delegate spawn to another device by hostname").epilogue("Exit codes: 0 = running (confirmed), 3 = accepted but NOT confirmed (--no-wait / poll timeout \u2014 NEVER blindly re-spawn, check with `planbee status --session <id>`), 1 = error."),handler:SN}});var _x=D((XM,Ax)=>{"use strict";var ne=t=>typeof t=="string",Oo=()=>{let t,e,n=new Promise((s,o)=>{t=s,e=o});return n.resolve=t,n.reject=e,n},fx=t=>t==null?"":String(t),AN=(t,e,n)=>{t.forEach(s=>{e[s]&&(n[s]=e[s])})},_N=/###/g,mx=t=>t&&t.includes("###")?t.replace(_N,"."):t,hx=t=>!t||ne(t),To=(t,e,n)=>{let s=ne(e)?e.split("."):e,o=0;for(;o<s.length-1;){if(hx(t))return{};let r=mx(s[o]);!t[r]&&n&&(t[r]=new n),Object.prototype.hasOwnProperty.call(t,r)?t=t[r]:t={},++o}return hx(t)?{}:{obj:t,k:mx(s[o])}},gx=(t,e,n)=>{let{obj:s,k:o}=To(t,e,Object);if(s!==void 0||e.length===1){s[o]=n;return}let r=e[e.length-1],i=e.slice(0,e.length-1),a=To(t,i,Object);for(;a.obj===void 0&&i.length;)r=`${i[i.length-1]}.${r}`,i=i.slice(0,i.length-1),a=To(t,i,Object),a?.obj&&typeof a.obj[`${a.k}.${r}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${r}`]=n},CN=(t,e,n,s)=>{let{obj:o,k:r}=To(t,e,Object);o[r]=o[r]||[],o[r].push(n)},ni=(t,e)=>{let{obj:n,k:s}=To(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},ON=(t,e,n)=>{let s=ni(t,n);return s!==void 0?s:ni(e,n)},Ex=(t,e,n)=>{for(let s in e)s!=="__proto__"&&s!=="constructor"&&(Object.prototype.hasOwnProperty.call(t,s)?ne(t[s])||t[s]instanceof String||ne(e[s])||e[s]instanceof String?n&&(t[s]=e[s]):Ex(t[s],e[s],n):t[s]=e[s]);return t},Qt=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),TN={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},PN=t=>ne(t)?t.replace(/[&<>"'\/]/g,e=>TN[e]):t,bl=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let n=this.regExpMap.get(e);if(n!==void 0)return n;let s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}},$N=[" ",",","?","!",";"],NN=new bl(20),IN=(t,e,n)=>{e=e||"",n=n||"";let s=$N.filter(i=>!e.includes(i)&&!n.includes(i));if(s.length===0)return!0;let o=NN.getRegExp(`(${s.map(i=>i==="?"?"\\?":i).join("|")})`),r=!o.test(t);if(!r){let i=t.indexOf(n);i>0&&!o.test(t.substring(0,i))&&(r=!0)}return r},xl=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;let s=e.split(n),o=t;for(let r=0;r<s.length;){if(!o||typeof o!="object")return;let i,a="";for(let c=r;c<s.length;++c)if(c!==r&&(a+=n),a+=s[c],i=o[a],i!==void 0){if(["string","number","boolean"].includes(typeof i)&&c<s.length-1)continue;r+=c-r+1;break}o=i}return o},Po=t=>t?.replace(/_/g,"-"),RN={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}},vl=class t{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||RN,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,s,o){return o&&!this.debug?null:(e=e.map(r=>ne(r)?r.replace(/[\r\n\x00-\x1F\x7F]/g," "):r),ne(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new t(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new t(this.logger,e)}},Lt=new vl,_s=class{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);let o=this.observers[s].get(n)||0;this.observers[s].set(n,o+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}once(e,n){let s=(...o)=>{n(...o),this.off(e,s)};return this.on(e,s),this}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([o,r])=>{for(let i=0;i<r;i++)o(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,r])=>{for(let i=0;i<r;i++)o(e,...n)})}},si=class extends _s{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,s,o={}){let r=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,i=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure,a;e.includes(".")?a=e.split("."):(a=[e,n],s&&(Array.isArray(s)?a.push(...s):ne(s)&&r?a.push(...s.split(r)):a.push(s)));let c=ni(this.data,a);return!c&&!n&&!s&&e.includes(".")&&(e=a[0],n=a[1],s=a.slice(2).join(".")),c||!i||!ne(s)?c:xl(this.data?.[e]?.[n],s,r)}addResource(e,n,s,o,r={silent:!1}){let i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=[e,n];s&&(a=a.concat(i?s.split(i):s)),e.includes(".")&&(a=e.split("."),o=n,n=a[1]),this.addNamespaces(n),gx(this.data,a,o),r.silent||this.emit("added",e,n,s,o)}addResources(e,n,s,o={silent:!1}){for(let r in s)(ne(s[r])||Array.isArray(s[r]))&&this.addResource(e,n,r,s[r],{silent:!0});o.silent||this.emit("added",e,n,s)}addResourceBundle(e,n,s,o,r,i={silent:!1,skipCopy:!1}){let a=[e,n];e.includes(".")&&(a=e.split("."),o=s,s=n,n=a[1]),this.addNamespaces(n);let c=ni(this.data,a)||{};i.skipCopy||(s=JSON.parse(JSON.stringify(s))),o?Ex(c,s,r):c={...c,...s},gx(this.data,a,c),i.silent||this.emit("added",e,n,s)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(o=>n[o]&&Object.keys(n[o]).length>0)}toJSON(){return this.data}},Dx={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,s,o){return t.forEach(r=>{e=this.processors[r]?.process(e,n,s,o)??e}),e}},Sx=Symbol("i18next/PATH_KEY");function FN(){let t=[],e=Object.create(null),n;return e.get=(s,o)=>(n?.revoke?.(),o===Sx?t:(t.push(o),n=Proxy.revocable(s,e),n.proxy)),Proxy.revocable(Object.create(null),e).proxy}function Wn(t,e){let{[Sx]:n}=t(FN()),s=e?.keySeparator??".",o=e?.nsSeparator??":",r=e?.enableSelector==="strict";if(n.length>1&&o){let i=e?.ns,a=r?Array.isArray(i)?i:i?[i]:null:Array.isArray(i)?i:null;if(a&&(r?a:a.length>1?a.slice(1):[]).includes(n[0]))return`${n[0]}${o}${n.slice(1).join(s)}`}return n.join(s)}var gl=t=>!ne(t)&&typeof t!="boolean"&&typeof t!="number",oi=class t extends _s{constructor(e,n={}){super(),AN(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Lt.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){let s={...n};if(e==null)return!1;let o=this.resolve(e,s);if(o?.res===void 0)return!1;let r=gl(o.res);return!(s.returnObjects===!1&&r)}extractFromKey(e,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");let o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,r=n.ns||this.options.defaultNS||[],i=s&&e.includes(s),a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!IN(e,s,o);if(i&&!a){let c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:ne(r)?[r]:r};let l=e.split(s);(s!==o||s===o&&this.options.ns.includes(l[0]))&&(r=l.shift()),e=l.join(o)}return{key:e,namespaces:ne(r)?[r]:r}}translate(e,n,s){let o=typeof n=="object"?{...n}:n;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o={...o}),o||(o={}),e==null)return"";typeof e=="function"&&(e=Wn(e,{...this.options,...o})),Array.isArray(e)||(e=[String(e)]),e=e.map(M=>typeof M=="function"?Wn(M,{...this.options,...o}):String(M));let r=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:a,namespaces:c}=this.extractFromKey(e[e.length-1],o),l=c[c.length-1],u=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");let p=o.lng||this.language,d=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p?.toLowerCase()==="cimode")return d?r?{res:`${l}${u}${a}`,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:l,usedParams:this.getUsedParamsDetails(o)}:`${l}${u}${a}`:r?{res:a,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:l,usedParams:this.getUsedParamsDetails(o)}:a;let f=this.resolve(e,o),m=f?.res,h=f?.usedKey||a,g=f?.exactUsedKey||a,b=["[object Number]","[object Function]","[object RegExp]"],v=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,E=!this.i18nFormat||this.i18nFormat.handleAsObject,S=o.count!==void 0&&!ne(o.count),C=t.hasDefaultValue(o),B=S?this.pluralResolver.getSuffix(p,o.count,o):"",L=o.ordinal&&S?this.pluralResolver.getSuffix(p,o.count,{ordinal:!1}):"",$=S&&!o.ordinal&&o.count===0,I=$&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${B}`]||o[`defaultValue${L}`]||o.defaultValue,R=m;E&&!m&&C&&(R=I);let U=gl(R),Q=Object.prototype.toString.apply(R);if(E&&R&&U&&!b.includes(Q)&&!(ne(v)&&Array.isArray(R))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,R,{...o,ns:c}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(f.res=M,f.usedParams=this.getUsedParamsDetails(o),f):M}if(i){let M=Array.isArray(R),z=M?[]:{},ge=M?g:h;for(let oe in R)if(Object.prototype.hasOwnProperty.call(R,oe)){let xe=`${ge}${i}${oe}`;C&&!m?z[oe]=this.translate(xe,{...o,defaultValue:gl(I)?I[oe]:void 0,joinArrays:!1,ns:c}):z[oe]=this.translate(xe,{...o,joinArrays:!1,ns:c}),z[oe]===xe&&(z[oe]=R[oe])}m=z}}else if(E&&ne(v)&&Array.isArray(m))m=m.join(v),m&&(m=this.extendTranslation(m,e,o,s));else{let M=!1,z=!1;!this.isValidLookup(m)&&C&&(M=!0,m=I),this.isValidLookup(m)||(z=!0,m=a);let oe=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&z?void 0:m,xe=C&&I!==m&&this.options.updateMissing;if(z||M||xe){if(this.logger.log(xe?"updateKey":"missingKey",p,l,S&&!xe?`${a}${this.pluralResolver.getSuffix(p,o.count,o)}`:a,xe?I:m),i){let F=this.resolve(a,{...o,keySeparator:!1});F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Ee=[],ve=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ve&&ve[0])for(let F=0;F<ve.length;F++)Ee.push(ve[F]);else this.options.saveMissingTo==="all"?Ee=this.languageUtils.toResolveHierarchy(o.lng||this.language):Ee.push(o.lng||this.language);let Me=(F,H,W)=>{let N=C&&W!==m?W:oe;this.options.missingKeyHandler?this.options.missingKeyHandler(F,l,H,N,xe,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(F,l,H,N,xe,o),this.emit("missingKey",F,l,H,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?Ee.forEach(F=>{let H=this.pluralResolver.getSuffixes(F,o);$&&o[`defaultValue${this.options.pluralSeparator}zero`]&&!H.includes(`${this.options.pluralSeparator}zero`)&&H.push(`${this.options.pluralSeparator}zero`),H.forEach(W=>{Me([F],a+W,o[`defaultValue${W}`]||I)})}):Me(Ee,a,I))}m=this.extendTranslation(m,e,o,f,s),z&&m===a&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${a}`),(z||M)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${a}`:a,M?m:void 0,o))}return r?(f.res=m,f.usedParams=this.getUsedParamsDetails(o),f):m}extendTranslation(e,n,s,o,r){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});let c=ne(e)&&(s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),l;if(c){let p=e.match(this.interpolator.nestingRegexp);l=p&&p.length}let u=s.replace&&!ne(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),e=this.interpolator.interpolate(e,u,s.lng||this.language||o.usedLng,s),c){let p=e.match(this.interpolator.nestingRegexp),d=p&&p.length;l<d&&(s.nest=!1)}!s.lng&&o&&o.res&&(s.lng=this.language||o.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...p)=>r?.[0]===p[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${n[0]}`),null):this.translate(...p,n),s)),s.interpolation&&this.interpolator.reset()}let i=s.postProcess||this.options.postProcess,a=ne(i)?[i]:i;return e!=null&&a?.length&&s.applyPostProcessor!==!1&&(e=Dx.handle(a,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,n={}){let s,o,r,i,a;return ne(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(c=>typeof c=="function"?Wn(c,{...this.options,...n}):c)),e.forEach(c=>{if(this.isValidLookup(s))return;let l=this.extractFromKey(c,n),u=l.key;o=u;let p=l.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));let d=n.count!==void 0&&!ne(n.count),f=d&&!n.ordinal&&n.count===0,m=n.context!==void 0&&(ne(n.context)||typeof n.context=="number")&&n.context!=="",h=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);p.forEach(g=>{this.isValidLookup(s)||(a=g,!this.checkedLoadedFor[`${h[0]}-${g}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(this.checkedLoadedFor[`${h[0]}-${g}`]=!0,this.logger.warn(`key "${o}" for languages "${h.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach(b=>{if(this.isValidLookup(s))return;i=b;let v=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(v,u,b,g,n);else{let S;d&&(S=this.pluralResolver.getSuffix(b,n.count,n));let C=`${this.options.pluralSeparator}zero`,B=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(n.ordinal&&S.startsWith(B)&&v.push(u+S.replace(B,this.options.pluralSeparator)),v.push(u+S),f&&v.push(u+C)),m){let L=`${u}${this.options.contextSeparator||"_"}${n.context}`;v.push(L),d&&(n.ordinal&&S.startsWith(B)&&v.push(L+S.replace(B,this.options.pluralSeparator)),v.push(L+S),f&&v.push(L+C))}}let E;for(;E=v.pop();)this.isValidLookup(s)||(r=E,s=this.getResource(b,g,E,n))}))})}),{res:s,usedKey:o,exactUsedKey:r,usedLng:i,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,s,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,s,o):this.resourceStore.getResource(e,n,s,o)}getUsedParamsDetails(e={}){let n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!ne(e.replace),o=s?e.replace:e;if(s&&typeof e.count<"u"&&(o={...o,count:e.count}),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!s){o={...o};for(let r of n)delete o[r]}return o}static hasDefaultValue(e){let n="defaultValue";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&s.startsWith(n)&&e[s]!==void 0)return!0;return!1}},ri=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Lt.create("languageUtils"),this.resolveHierarchyCache={}}clearCache(){this.resolveHierarchyCache={}}getScriptPartFromCode(e){if(e=Po(e),!e||!e.includes("-"))return null;let n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=Po(e),!e||!e.includes("-"))return e;let n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(ne(e)&&e.includes("-")){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(s=>{if(n)return;let o=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(o))&&(n=o)}),!n&&this.options.supportedLngs&&e.forEach(s=>{if(n)return;let o=this.getScriptPartFromCode(s);if(this.isSupportedCode(o))return n=o;let r=this.getLanguagePartFromCode(s);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(i=>i===r?!0:!i.includes("-")&&!r.includes("-")?!1:!!(i.includes("-")&&!r.includes("-")&&i.slice(0,i.indexOf("-"))===r||i.startsWith(r)&&r.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),ne(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let s=e[n];return s||(s=e[this.getScriptPartFromCode(n)]),s||(s=e[this.formatLanguageCode(n)]),s||(s=e[this.getLanguagePartFromCode(n)]),s||(s=e.default),s||[]}toResolveHierarchy(e,n){let s=this.options.fallbackLng,o=Array.isArray(s)?s.join("|"):s;o!==this._cachedFallbackLng&&(this.resolveHierarchyCache={},this._cachedFallbackLng=o);let r=n===void 0||n===!1||ne(n),i=n===void 0&&typeof this.options.fallbackLng=="function",a=ne(e)&&r&&!i,c=null;if(a){let d;n===void 0?d="undefined":n===!1?d="boolean:false":d=`string:${n}`,c=`${e.length}:${e}|${d}`}if(c!==null){let d=this.resolveHierarchyCache[c];if(d!==void 0)return d.slice()}let l=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),u=[],p=d=>{d&&(this.isSupportedCode(d)?u.push(d):this.logger.warn(`rejecting language code not found in supportedLngs: ${d}`))};return ne(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&p(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&p(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&p(this.getLanguagePartFromCode(e))):ne(e)&&p(this.formatLanguageCode(e)),l.forEach(d=>{u.includes(d)||p(this.formatLanguageCode(d))}),c!==null?(this.resolveHierarchyCache[c]=u,u.slice()):u}},yx={zero:0,one:1,two:2,few:3,many:4,other:5},bx={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},wl=class{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=Lt.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){let s=Po(e==="dev"?"en":e),o=n.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:s,type:o});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let i;try{i=new Intl.PluralRules(s,{type:o})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),bx;if(!e.match(/-|_/))return bx;let c=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(c,n)}return this.pluralRulesCache[r]=i,i}needsPlural(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,n,s={}){return this.getSuffixes(e,s).map(o=>`${n}${o}`)}getSuffixes(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?s.resolvedOptions().pluralCategories.sort((o,r)=>yx[o]-yx[r]).map(o=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(e,n,s={}){let o=this.getRule(e,s);return o?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${o.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,s))}},xx=(t,e,n,s=".",o=!0)=>{let r=ON(t,e,n);return!r&&o&&ne(n)&&(r=xl(t,n,s),r===void 0&&(r=xl(e,n,s))),r},jN=t=>t.replace(/\$/g,"$$$$"),ii=class{constructor(e={}){this.logger=Lt.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(n=>n),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:n,escapeValue:s,useRawValueToEscape:o,prefix:r,prefixEscaped:i,suffix:a,suffixEscaped:c,formatSeparator:l,unescapeSuffix:u,unescapePrefix:p,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:m,nestingSuffixEscaped:h,nestingOptionsSeparator:g,maxReplaces:b,alwaysFormat:v}=e.interpolation;this.escape=n!==void 0?n:PN,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=r?Qt(r):i||"{{",this.suffix=a?Qt(a):c||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":p?Qt(p):"-",this.unescapeSuffix=this.unescapePrefix?"":u?Qt(u):"",this.nestingPrefix=d?Qt(d):f||Qt("$t("),this.nestingSuffix=m?Qt(m):h||Qt(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=b||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(n,s)=>n?.source===s?(n.lastIndex=0,n):new RegExp(s,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,s,o){let r,i,a,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=f=>{if(!f.includes(this.formatSeparator)){let b=xx(n,c,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,s,{...o,...n,interpolationkey:f}):b}let m=f.split(this.formatSeparator),h=m.shift().trim(),g=m.join(this.formatSeparator).trim();return this.format(xx(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure),g,s,{...o,...n,interpolationkey:h})};this.resetRegExp(),!this.escapeValue&&typeof e=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false \u2014 if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");let u=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,p=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>f},{regex:this.regexp,safeValue:f=>this.escapeValue?this.escape(f):f}].forEach(f=>{for(a=0;r=f.regex.exec(e);){let m=r[1].trim();if(i=l(m),i===void 0)if(typeof u=="function"){let g=u(e,r,o);i=ne(g)?g:""}else if(o&&Object.prototype.hasOwnProperty.call(o,m))i="";else if(p){i=r[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),i="";else!ne(i)&&!this.useRawValueToEscape&&(i=fx(i));let h=f.safeValue(i);if(e=e.replace(r[0],jN(h)),p?(f.regex.lastIndex+=h.length,f.regex.lastIndex-=r[0].length):f.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,n,s={}){let o,r,i,a=(c,l)=>{let u=this.nestingOptionsSeparator;if(!c.includes(u))return c;let p=c.split(new RegExp(`${Qt(u)}[ ]*{`)),d=`{${p[1]}`;c=p[0],d=this.interpolate(d,i);let f=d.match(/'/g),m=d.match(/"/g);((f?.length??0)%2===0&&!m||(m?.length??0)%2!==0)&&(d=d.replace(/'/g,'"'));try{i=JSON.parse(d),l&&(i={...l,...i})}catch(h){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,h),`${c}${u}${d}`}return i.defaultValue&&i.defaultValue.includes(this.prefix)&&delete i.defaultValue,c};for(;o=this.nestingRegexp.exec(e);){let c=[];i={...s},i=i.replace&&!ne(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;let l=/{.*}/s.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(l!==-1&&(c=o[1].slice(l).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),o[1]=o[1].slice(0,l)),r=n(a.call(this,o[1].trim(),i),i),r&&o[0]===e&&!ne(r))return r;ne(r)||(r=fx(r)),r||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),r=""),c.length&&(r=c.reduce((u,p)=>this.format(u,p,s.lng,{...s,interpolationkey:o[1].trim()}),r.trim())),e=e.replace(o[0],r),this.regexp.lastIndex=0}return e}},LN=t=>{let e=t.toLowerCase().trim(),n={};if(t.includes("(")){let s=t.split("(");e=s[0].toLowerCase().trim();let o=s[1].slice(0,-1);e==="currency"&&!o.includes(":")?n.currency||(n.currency=o.trim()):e==="relativetime"&&!o.includes(":")?n.range||(n.range=o.trim()):o.split(";").forEach(i=>{if(i){let[a,...c]=i.split(":"),l=c.join(":").trim().replace(/^'+|'+$/g,""),u=a.trim();n[u]||(n[u]=l),l==="false"&&(n[u]=!1),l==="true"&&(n[u]=!0),isNaN(l)||(n[u]=parseInt(l,10))}})}return{formatName:e,formatOptions:n}},vx=t=>{let e={};return(n,s,o)=>{let r=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(r={...r,[o.interpolationkey]:void 0});let i=s+JSON.stringify(r),a=e[i];return a||(a=t(Po(s),o),e[i]=a),a(n)}},BN=t=>(e,n,s)=>t(Po(n),s)(e),El=class{constructor(e={}){this.logger=Lt.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";let s=n.cacheInBuiltFormats?vx:BN;this.formats={number:s((o,r)=>{let i=new Intl.NumberFormat(o,{...r});return a=>i.format(a)}),currency:s((o,r)=>{let i=new Intl.NumberFormat(o,{...r,style:"currency"});return a=>i.format(a)}),datetime:s((o,r)=>{let i=new Intl.DateTimeFormat(o,{...r});return a=>i.format(a)}),relativetime:s((o,r)=>{let i=new Intl.RelativeTimeFormat(o,{...r});return a=>i.format(a,r.range||"day")}),list:s((o,r)=>{let i=new Intl.ListFormat(o,{...r});return a=>i.format(a)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=vx(n)}format(e,n,s,o={}){if(!n||e==null)return e;let r=n.split(this.formatSeparator),i=[];for(let c=0;c<r.length;c++){let l=r[c];for(;l.indexOf("(")>-1&&!l.includes(")")&&c+1<r.length;)l=`${l}${this.formatSeparator}${r[++c]}`;i.push(l)}return i.reduce((c,l)=>{let{formatName:u,formatOptions:p}=LN(l);if(this.formats[u]){let d=c;try{let f=o?.formatParams?.[o.interpolationkey]||{},m=f.locale||f.lng||o.locale||o.lng||s;d=this.formats[u](c,m,{...p,...o,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return c},e)}},qN=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)},Dl=class extends _s{constructor(e,n,s,o={}){super(),this.backend=e,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=o,this.logger=Lt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(s,o.backend,o)}queueLoad(e,n,s,o){let r={},i={},a={},c={};return e.forEach(l=>{let u=!0;n.forEach(p=>{let d=`${l}|${p}`;!s.reload&&this.store.hasResourceBundle(l,p)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?i[d]===void 0&&(i[d]=!0):(this.state[d]=1,u=!1,i[d]===void 0&&(i[d]=!0),r[d]===void 0&&(r[d]=!0),c[p]===void 0&&(c[p]=!0)))}),u||(a[l]=!0)}),(Object.keys(r).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(r),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(c)}}loaded(e,n,s){let o=e.split("|"),r=o[0],i=o[1];n&&this.emit("failedLoading",r,i,n),!n&&s&&this.store.addResourceBundle(r,i,s,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&s&&(this.state[e]=0);let a={};this.queue.forEach(c=>{CN(c.loaded,[r],i),qN(c,e),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(l=>{a[l]||(a[l]={});let u=c.loaded[l];u.length&&u.forEach(p=>{a[l][p]===void 0&&(a[l][p]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(e,n,s,o=0,r=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:s,tried:o,wait:r,callback:i});return}this.readingCalls++;let a=(l,u)=>{if(this.readingCalls--,this.waitingReads.length>0){let p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(l&&u&&o<this.maxRetries){setTimeout(()=>{this.read(e,n,s,o+1,r*2,i)},r);return}i(l,u)},c=this.backend[s].bind(this.backend);if(c.length===2){try{let l=c(e,n);l&&typeof l.then=="function"?l.then(u=>a(null,u)).catch(a):a(null,l)}catch(l){a(l)}return}return c(e,n,a)}prepareLoading(e,n,s={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();ne(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ne(n)&&(n=[n]);let r=this.queueLoad(e,n,s,o);if(!r.toLoad.length)return r.pending.length||o(),null;r.toLoad.forEach(i=>{this.loadOne(i)})}load(e,n,s){this.prepareLoading(e,n,{},s)}reload(e,n,s){this.prepareLoading(e,n,{reload:!0},s)}loadOne(e,n=""){let s=e.split("|"),o=s[0],r=s[1];this.read(o,r,"read",void 0,void 0,(i,a)=>{i&&this.logger.warn(`${n}loading namespace ${r} for language ${o} failed`,i),!i&&a&&this.logger.log(`${n}loaded namespace ${r} for language ${o}`,a),this.loaded(e,i,a)})}saveMissing(e,n,s,o,r,i={},a=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${s}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if(this.backend?.create){let c={...i,isUpdate:r},l=this.backend.create.bind(this.backend);if(l.length<6)try{let u;l.length===5?u=l(e,n,s,o,c):u=l(e,n,s,o),u&&typeof u.then=="function"?u.then(p=>a(null,p)).catch(a):a(null,u)}catch(u){a(u)}else l(e,n,s,o,a,c)}!e||!e[0]||this.store.addResource(e[0],n,s,o)}}},yl=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),ne(t[1])&&(e.defaultValue=t[1]),ne(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){let n=t[3]||t[2];Object.keys(n).forEach(s=>{e[s]=n[s]})}return e},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),wx=t=>(ne(t.ns)&&(t.ns=[t.ns]),ne(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),ne(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&!t.supportedLngs.includes("cimode")&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),ti=()=>{},MN=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})},Sl=class t extends _s{constructor(e={},n){if(super(),this.options=wx(e),this.services={},this.logger=Lt,this.modules={external:[]},MN(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(ne(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));let s=yl();this.options={...s,...this.options,...wx(e)},this.options.interpolation={...s.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler);let o=l=>l?typeof l=="function"?new l:l:null;if(!this.options.isClone){this.modules.logger?Lt.init(o(this.modules.logger),this.options):Lt.init(null,this.options);let l;this.modules.formatter?l=this.modules.formatter:l=El;let u=new ri(this.options);this.store=new si(this.options.resources,this.options);let p=this.services;p.logger=Lt,p.resourceStore=this.store,p.languageUtils=u,p.pluralResolver=new wl(u,{prepend:this.options.pluralSeparator}),l&&(p.formatter=o(l),p.formatter.init&&p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new ii(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new Dl(o(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.languageDetector&&(p.languageDetector=o(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=o(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new oi(this.services,this.options),this.translator.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,n||(n=ti),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&l[0]!=="dev"&&(this.options.lng=l[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(l=>{this[l]=(...u)=>this.store[l](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(l=>{this[l]=(...u)=>(this.store[l](...u),this)});let a=Oo(),c=()=>{let l=(u,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(p),n(u,p)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return l(null,this.t.bind(this));this.changeLanguage(this.options.lng,l)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),a}loadResources(e,n=ti){let s=n,o=ne(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();let r=[],i=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(l=>{l!=="cimode"&&(r.includes(l)||r.push(l))})};o?i(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>i(c)),this.options.preload?.forEach?.(a=>i(a)),this.services.backendConnector.load(r,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(a)})}else s(null)}reloadResources(e,n,s){let o=Oo();return typeof e=="function"&&(s=e,e=void 0),typeof n=="function"&&(s=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),s||(s=ti),this.services.backendConnector.reload(e,n,r=>{o.resolve(),s(r)}),o}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Dx.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!["cimode","dev"].includes(e)){for(let n=0;n<this.languages.length;n++){let s=this.languages[n];if(!["cimode","dev"].includes(s)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;let s=Oo();this.emit("languageChanging",e);let o=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},r=(a,c)=>{c?this.isLanguageChangingTo===e&&(o(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,s.resolve((...l)=>this.t(...l)),n&&n(a,(...l)=>this.t(...l))},i=a=>{!e&&!a&&this.services.languageDetector&&(a=[]);let c=ne(a)?a:a&&a[0],l=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(ne(a)?[a]:a);l&&(this.language||o(l),this.translator.language||this.translator.changeLanguage(l),this.services.languageDetector?.cacheUserLanguage?.(l)),this.loadResources(l,u=>{r(u,l)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e),s}getFixedT(e,n,s,o){let r=o?.scopeNs,i=(a,c,...l)=>{let u;typeof c!="object"?u=this.options.overloadTranslationOptionHandler([a,c].concat(l)):u={...c},u.lng=u.lng||i.lng,u.lngs=u.lngs||i.lngs;let p=u.ns!==void 0&&u.ns!==null;u.ns=u.ns||i.ns,u.keyPrefix!==""&&(u.keyPrefix=u.keyPrefix||s||i.keyPrefix);let d={...this.options,...u};Array.isArray(r)&&!p&&(d.ns=r),typeof u.keyPrefix=="function"&&(u.keyPrefix=Wn(u.keyPrefix,d));let f=this.options.keySeparator||".",m;return u.keyPrefix&&Array.isArray(a)?m=a.map(h=>(typeof h=="function"&&(h=Wn(h,d)),`${u.keyPrefix}${f}${h}`)):(typeof a=="function"&&(a=Wn(a,d)),m=u.keyPrefix?`${u.keyPrefix}${f}${a}`:a),this.t(m,u)};return ne(e)?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=s,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let s=n.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;let i=(a,c)=>{let l=this.services.backendConnector.state[`${a}|${c}`];return l===-1||l===0||l===2};if(n.precheck){let a=n.precheck(this,i);if(a!==void 0)return a}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(s,e)&&(!o||i(r,e)))}loadNamespaces(e,n){let s=Oo();return this.options.ns?(ne(e)&&(e=[e]),e.forEach(o=>{this.options.ns.includes(o)||this.options.ns.push(o)}),this.loadResources(o=>{s.resolve(),n&&n(o)}),s):(n&&n(),Promise.resolve())}loadLanguages(e,n){let s=Oo();ne(e)&&(e=[e]);let o=this.options.preload||[],r=e.filter(i=>!o.includes(i)&&this.services.languageUtils.isSupportedCode(i));return r.length?(this.options.preload=o.concat(r),this.loadResources(i=>{s.resolve(),n&&n(i)}),s):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{let o=new Intl.Locale(e);if(o&&o.getTextInfo){let r=o.getTextInfo();if(r&&r.direction)return r.direction}}catch{}let n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=this.services?.languageUtils||new ri(yl());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(s.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){let s=new t(e,n);return s.createInstance=t.createInstance,s}cloneInstance(e={},n=ti){let s=e.forkResourceStore;s&&delete e.forkResourceStore;let o={...this.options,...e,isClone:!0},r=new t(o);if((e.debug!==void 0||e.prefix!==void 0)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(a=>{r[a]=this[a]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},s){let a=Object.keys(this.store.data).reduce((c,l)=>(c[l]={...this.store.data[l]},c[l]=Object.keys(c[l]).reduce((u,p)=>(u[p]={...c[l][p]},u),c[l]),c),{});r.store=new si(a,o),r.services.resourceStore=r.store}if(e.interpolation){let c={...yl().interpolation,...this.options.interpolation,...e.interpolation},l={...o,interpolation:c};r.services.interpolator=new ii(l)}return r.translator=new oi(r.services,o),r.translator.on("*",(a,...c)=>{r.emit(a,...c)}),r.init(o,n),r.translator.options=o,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},kx=Sl.createInstance();kx.keyFromSelector=Wn;Ax.exports=kx});var Cx=D((QM,UN)=>{UN.exports={inbox:{serverUnreachable:"PlanBee server unreachable ({{url}})",connectionAborted:"Connection to server aborted",unknownError:"Unknown error",justNow:"just now",crossTenantBlock:"Message blocked: the target session belongs to a different user and you do not share a team that has access to this project. Cross-tenant sends are not allowed \u2014 verify the recipient's team membership and project sharing, then retry.",timeAgoMinutes:"{{minutes}}m ago",timeAgoHoursMinutes:"{{hours}}h {{minutes}}m ago",timeAgoHours:"{{hours}}h ago",header:"PlanBee Inbox",divider:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",queuedCount:" Queued messages: {{count}}",unreadDelivered:" Delivered (unread): {{count}}",deliveredCount:" Delivered messages: {{count}}",total:" Total: {{count}}",listHint:`
|
|
127
|
+
Use "planbee inbox --list" to show queued messages.`,fetchError:"Error fetching inbox: {{error}}",confirmError:"Error confirming messages: {{error}}",messageDeleted:"Message deleted: {{id}}",messagePreview:" Preview: {{preview}}",messageNotQueued:"Message cannot be deleted (no longer queued)",messageNotFound:"Message not found",deleteError:"Error deleting message: {{error}}",watchingLog:"Watching inbox for new messages (timeout: {{timeout}}s, interval: {{interval}}s{{monitorSuffix}})...",monitorSuffix:", monitor: on ({{scope}})",serverWaiting:"PlanBee server unreachable ({{url}}), waiting for connection...",claimError:"Error claiming message: {{error}}",batchReceived:"You received {{count}} messages as a batch.",batchConfirm:"Confirm all: planbee inbox --confirm {{ids}}",singleReceived:"You just received this message.",checkTasks:"IMPORTANT: Check your task list after each message:",checkTasksCmd:" \u2022 planbee tasks --session $PLANBEE_SESSION_ID --all",updateTasks:" \u2022 Update your tasks as needed",markCompleted:' \u2022 Mark completed tasks as "completed"',watchModeRestart:"After processing the message you MUST restart watch mode:",watchClaimError:"Error in watch claim: {{error}}",timeoutReached:"Timeout reached. Please restart watch mode.",keepTasksUpdated:"IMPORTANT: Keep your task list up to date",afterTimeoutInstructions:" After every watch timeout and after each new message:",checkTasksAfterTimeout:" \u2022 Check your tasks: planbee tasks --session $PLANBEE_SESSION_ID --all",updateTasksAfterTimeout:" \u2022 Update your task list as needed",markCompletedAfterTimeout:' \u2022 Mark completed tasks as "completed"',useProgress:" \u2022 Use: planbee progress for progress updates",overviewHelp:" Keeping your task list current helps you and your team stay on track",overviewHelp2:" and collaborate efficiently.",watchModeDeactivated:"\u26D4 Watch mode was deactivated - no restart needed.",continueWorking:"You can continue working normally.",watchModeRestartCmd:"Restart watch mode with:",watchModeDeactivatedHeader:"\u26D4 WATCHMODE DEACTIVATED",watchModeDisabledByUser:"Watch mode was deactivated by the user. You can end watch mode",watchModeDisabledByUser2:"now and continue working normally.",noQueuedMessages:"No queued messages.",queuedMessages:"Queued messages ({{count}}):",from:" From: {{label}}",age:" Age: {{age}}",preview:" Preview: {{preview}}",readHint:`
|
|
128
|
+
Use "planbee inbox --read <id>" to read a message.`,listFetchError:"Error fetching messages: {{error}}",priority:" Priority: {{priority}}",status:" Status: {{status}}",sent:" Sent: {{age}}",messageLabel:`
|
|
129
|
+
Message:`,markedRead:`
|
|
130
|
+
\u2713 Marked as read.`,readError:"Error reading message: {{error}}",waitingMessages:`{{count}} queued message(s):
|
|
131
|
+
`,allDisplayed:`
|
|
132
|
+
\u2713 All {{count}} message(s) displayed.`,allMarkedRead:"\u2713 All messages marked as read.",readAllError:"Error reading messages: {{error}}",noSystemMessages:"No system messages.",systemMessages:"System messages ({{count}}):",systemMessageNote:`
|
|
133
|
+
System messages are internal state tracking records (not delivered as prompt).`,systemFetchError:"Error fetching system messages: {{error}}",sessionNotFound:"Error: Session ID not found.",sessionEnvHint:"Set the PLANBEE_SESSION_ID environment variable or pass --session <id>:",sessionEnvExample1:" PLANBEE_SESSION_ID=<id> planbee inbox",sessionEnvExample2:" planbee inbox --session <id>",waitSessionInvalid:'Error: --wait requires a valid session UUID, got: "{{value}}". Watcher NOT started (a sessionless watcher holds a claim but can never deliver).',ageWarning:"Age: {{age}} (this message may contain outdated information)",batchHeader:"=== PLANBEE BATCH: {{count}} MESSAGES ===",batchEndHeader:"=== END BATCH ===",describe:"Manage your PlanBee message queue",optSession:"Session ID (overrides PLANBEE_SESSION_ID)",optList:"List queued messages with details",optRead:"Read a specific message (ID) and mark as read",optReadAll:"Read all queued messages and mark as read",optConfirm:"Confirm message(s) as read (comma-separated IDs)",optDelete:"Delete a queued message from the queue (ID)",optWatch:"DEPRECATED: alias of --wait (the old foreground claim loop was removed)",optInterval:"Poll interval in seconds (default: 5)",optTimeout:"Wait timeout in seconds (default: 14400)",optSystem:"Show system messages (internal state transitions)",optMonitor:"Show agent events in real time (with --watch)",optMonitorScope:"Monitor scope: swarm (own agents), project (project agents), global (all)",optJson:"JSON output",exSummary:"Show inbox summary",exList:"List all queued messages",exRead:"Read a specific message",exReadAll:"Read all queued messages",exConfirm:"Confirm a message as read",exConfirmMulti:"Confirm multiple messages",exWatch:"Wait for new messages",exWatchTimeout:"Wait max. 60 seconds",exWatchMonitor:"Watch with real-time agent events (swarm scope)",exWatchMonitorProject:"Watch with project events",exWatchMonitorGlobal:"Watch with all agent events",exSystem:"Show system messages",optWait:"Wait for new messages; exits when the first one arrives (wake-watcher). Run as a background task for remote control",watchDeprecated:"[planbee] --watch is deprecated and now behaves like --wait (wake-only, no claiming). After the wait exits, read messages with 'planbee inbox --read-all'.",exWait:"Wait for the next message (exits on arrival)",exWaitTimeout:"Wake-watcher with 4h timeout (remote-control default)",optWaitSupervised:"Like --wait, but self-healing: an in-process supervisor watches the wake-watcher and restarts it automatically after unexpected exits (kill -9, MCP disconnect). Same exit codes as --wait (0 wake / 2 timeout / 3 auth-dead / 4 remote-control-off / 5 session-gone / 6 already-waiting)",exWaitSupervised:"Self-healing wake-watcher (auto-restart on unexpected exit)"},startAgent:{sessionRequired:"Error: --session is required",starting:"Starting agent {{id}}...",waitingActivation:"Agent starting, waiting for activation...",cloudFallback:"Cloud mode: server-side start unavailable (501), falling back to status poll...",agentActive:"[OK] Agent {{id}} is active",statusLabel:" Status: {{status}}",llmStateLabel:" LLM State: {{state}}",agentNotFound:"Error: Agent {{id}} not found",timeoutError:"Timeout: Agent {{id}} did not become active within {{seconds}}s",httpError:"Error ({{status}}): {{message}}",serverUnreachable:"Error: PlanBee server unreachable. Is the server running on localhost:3456?",genericError:"Error: {{message}}",startFailed:"Error: {{error}}",describe:"Start a prepared agent",optSession:"Session ID of the agent to start",optTimeout:"Timeout in milliseconds (default: 60000)",optJson:"JSON output",exStart:"Start prepared agent",exTimeout:"With longer timeout",exJson:"JSON output"},watchRules:{watchModeActive:"\u2705 active",watchModeInactive:"\u274C inactive",customRulesYes:"yes",customRulesNo:"no (defaults)",sessionNotFound:"Session not found: {{id}}",error:"Error: {{error}}",invalidJson:"Error: Invalid JSON for --set",rulesSaved:"\u2713 Display rules saved",dashboardUpdated:"> **{{time}}** \xB7 Dashboard updated",sessionRequired:"Error: Session ID not found.",sessionHint:"Set PLANBEE_SESSION_ID or pass --session <id>",describe:"Watch mode dashboard display rules and data",optSession:"Session ID (overrides PLANBEE_SESSION_ID)",optData:"Fetch and render live dashboard data",optSet:"Set custom display rules (JSON)",optJson:"JSON output",exRules:"Show display rules",exDashboard:"Render live dashboard",exSet:"Set custom rules"},send:{messageRequired:"Error: --message is required",sessionRequired:"Error: PLANBEE_SESSION_ID environment variable not set",sessionRequiredHint:"This command must be run inside a PlanBee agent session",messageSentToParent:"\u2713 Message sent to parent",warning:" \u26A0 Warning: {{warning}}",httpError:"Error: {{message}}",noParentHint:`
|
|
134
|
+
Note: This session is a root session without a parent.`,invalidSessionHint:`
|
|
135
|
+
Note: PLANBEE_SESSION_ID is invalid or the session does not exist.`,serverUnreachable:"Error: PlanBee server unreachable. Is the server running?",genericError:"Error: {{message}}",optPriority:"Message priority: normal = wait until idle, high/urgent = interrupt immediately",invalidSessionIdFormat:'Error: {{field}} "{{value}}" is not a valid session ID (expected: full UUID, 36 characters, format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)',truncatedSessionId:'Error: {{field}} "{{value}}" looks like a TRUNCATED ID (8 characters, as shown in inbox/status displays). Please use the FULL UUID (36 characters), not the short form.'},status:{ambiguousId:'Ambiguous ID "{{id}}" - {{count}} matches:',sessionNotFoundPrefix:"Session not found for ID prefix: {{id}}",allSessionsHeader:"All Sessions:",noSessions:" No active sessions found.",projectLabel:"Project: {{folder}}",totalSessions:"Total: {{count}} sessions",noSessionsCompact:" No active sessions found.",totalSessionsCompact:"Total: {{count}} sessions",healthHeader:"System Health Status:",error:"Error: {{error}}",describe:"Show session status or system health",optSession:"Session ID (UUID)",optJson:"JSON output",optHealth:"Run system health checks",optCompact:"Compact table view instead of tree view",exAll:"Show all active sessions",exSession:"Show status of a session",exHealth:"Show system health status",exJson:"Show status as JSON"},listAgents:{noAgents:"No active agents found ({{scope}}).",useAll:"Use --all for all projects.",agentCount:`
|
|
136
|
+
{{count}} agent(s) {{scope}}:
|
|
137
|
+
`,describe:"List all active agents (no search term required)",optAll:"Show agents from all projects",optFolder:"Filter by project folder",optStatus:"Filter by status (comma-separated, e.g. active,plan_ready)",optJson:"JSON output"},activity:{now:"now",noAgents:"No active agents found.",useAll:"Use --all for all projects.",noActivity:"No activity found.",noActivityEntry:"(no activity)",describe:"Last action of each active agent",optAll:"Show activity from all projects",optSince:"Only activity since duration (e.g. 10m, 1h, 2d)",optJson:"JSON output"},plan:{planStatusFor:"Plan status for {{id}}:",yes:"[OK] Yes",no:"[--] No",isManaged:" Agent managed: {{value}}",isPlanDecided:" Plan decided: {{value}}",planTruncated:" ... (truncated, --full for full text)",openQuestions:`
|
|
138
|
+
Open question(s):`,options:" Options: {{options}}",answerHint:`
|
|
139
|
+
Answer: planbee plan answer {{id}} -m "Your answer"`,approved:"[OK] Plan approved for session {{id}}",rejected:"[REJECT] Plan rejected for session {{id}}",feedbackRequired:"Error: --message (-m) is required for feedback.",feedbackSent:"[FB] Feedback sent to session {{id}}",executing:"[RUN] Plan executing in new session: {{newId}}",answersRequired:"Error: Please provide --answers or --message.",answered:"[OK] Question answered for session {{id}}",dismissed:"[OK] Plan/question dismissed for session {{id}}",noPlan:"No plan available for this session.",noPending:"No agents with pending plans.",agentsWaiting:`{{count}} agent(s) waiting for review:
|
|
140
|
+
`,since:"Since: {{age}}",serverUnreachable:"PlanBee server unreachable. Is the server running on localhost:3456?",actionError:"Error during {{action}}: {{error}}",demandCommand:"Please provide a subcommand: status, approve, reject, feedback, execute, answer, dismiss, list, view"},dashboard:{noAgents:"No active agents found ({{scope}}).",useAll:"Use --all for all projects.",summary:`\u{1F4CA} {{active}} active | {{completed}} done | {{error}} error | {{other}} other
|
|
141
|
+
`,describe:"Compact overview of all active agents",optAll:"Show agents from all projects",optChildren:"Show only children of a specific session (queen ID)",optJson:"JSON output"},cliApiClient:{sessionExpired:`
|
|
142
|
+
Session expired. Please log in again:
|
|
143
|
+
planbee auth login
|
|
144
|
+
|
|
145
|
+
`,cloudUnreachable:"PlanBee cloud server unreachable. Check your internet connection.",localUnreachable:"Local PlanBee server unreachable at {{url}}.",genericUnreachable:"PlanBee server unreachable."},messageStatus:{idRequired:"Error: Message ID is required",header:"\u{1F4E8} Message Status",priority:" Priority: {{value}}",sent:" Sent: {{time}}",delivered:" Delivered: {{time}} ({{duration}})",deliveredPending:" Delivered: pending",readConfirmation:" Read confirmation: \u2713 {{time}} ({{duration}})",readPending:" Read confirmation: pending",targetAgentHeader:" \u2500\u2500 Target Agent \u2500\u2500",task:" Task: {{task}}",taskWithPercent:" Task: {{task}} ({{percent}}%)",durationSeconds:"after {{seconds}}s",durationMinutes:"after {{minutes}}min",notFound:"Error: Message not found: {{id}}"},inboxWait:{started:"Waiting for new messages (wake-watcher, timeout: {{timeout}}s, poll interval: {{interval}}s). Exits when a message arrives.",pollError:"Inbox poll failed (attempt {{attempt}}, next retry in {{backoffSeconds}}s): {{error}}",wakeIntro:"Execute now, in this order:",wakeHandle:"Handle the request(s), update your tasks (planbee progress ...).",wakeRearm:"Re-arm the wake-watcher BEFORE ending your turn \u2014 Bash tool with run_in_background: true:",wakeEnforced:"(If you skip the re-arm, the Stop hook will block your turn and remind you.)",timeoutReached:"[PlanBee] Wake-watcher timeout after {{timeout}}s \u2014 no messages. Re-arm now (Bash, run_in_background: true):",disabled:"[PlanBee] Remote control was disabled for this session \u2014 do NOT re-arm the watcher. Continue normally.",sessionGone:"[PlanBee] Session no longer exists \u2014 watcher stopped. Do not re-arm.",alreadyWaiting:"a wake-watcher is already running for this session \u2014 do NOT re-arm, exit your loop"},remoteControl:{describe:"Enable/disable remote control for a session (inbox push wakes the terminal)",optAction:"on | off | status",optSession:"Session ID (defaults to PLANBEE_SESSION_ID)",optTimeout:"Wake-watcher timeout in seconds (default: 14400)",optInterval:"Poll interval in seconds (default: 5)",optJson:"Output as JSON",exOn:"Enable remote control for the current session",exOff:"Disable remote control",exStatus:"Show remote-control status as JSON",sessionRequired:"No session ID: pass --session or set PLANBEE_SESSION_ID",sessionNotFound:"Session not found",enabled:"Remote control ENABLED for this session.",armHint:"Arm the wake-watcher now (Bash tool, run_in_background: true):",enforcementNote:"The Stop hook now enforces a running watcher: without one, the agent's turn will not end. Messages from any device (planbee send, Electron, Mobile) wake this session automatically.",statusHeader:"Remote-Control Status",watcherMissing:"Remote control is ON but no watcher process is running \u2014 arm it:",disabled:"Remote control DISABLED. A running watcher exits by itself within ~30s.",error:"remote-control failed: {{error}}"},permissions:{sendBlocked:"Message blocked: you are restricted to sending to specific agents only and the target session is not in your allowlist. This is a permanent policy decision \u2014 retrying will not change the outcome. Adjust the message permissions or contact your coordinator to update the allowlist.",updateLocked:"Permission update rejected: the target session has manually locked permissions that cannot be overwritten by an agent. This restriction was set by a user and cannot be changed dynamically. Contact the user to update or remove the lock."},usage:{describe:"Show provider limits (Claude, AGY, MiniMax, Copilot)",optDevice:'Device: device id, hostname or "all" for every device',optProvider:"Filter provider: claude, agy, minimax, copilot or all",optJson:"Print the raw API response as JSON",optDays:"Additionally show the token total of the last N days (0 = all)",exAccount:"Account-wide limits as a table",exDevices:"Limits of all registered devices",exJson:"Claude only, as raw JSON",headerAccount:"Usage (account-wide)",headerDevice:"Device: {{hostname}} ({{deviceId}}) - {{state}}",online:"online",offline:"offline",deviceOfflineHint:" Note: device is offline (last heartbeat: {{lastSeen}}) - values may be stale.",colProvider:"Provider",colWindow:"Window",colUsage:"Used/Limit/%",colReset:"Reset",windowMonth:"Month",windowExtra:"Extra",resetIn:"in {{rest}}",noData:"no data",noWindows:"no window data reported",stale:"data is stale",noteLine:" Note: {{note}}",providerUnavailable:" {{provider}}: not configured or no data ({{reason}})",providerNone:"None of the requested providers returned data.",noDevices:"No registered devices.",deviceNotFound:"Device not found: {{device}}",notLoggedIn:'Not logged in - run "planbee auth login".',connectionFailed:"Cannot reach the PlanBee API ({{url}}).",unknownProvider:'Unknown provider "{{provider}}". Valid: {{valid}}',invalidDays:"Invalid value for --days: {{days}}",errorPrefix:"Error: {{error}}",summaryHeader:"Token total ({{days}} days)",summaryTotals:" Sessions: {{sessions}} | Input: {{input}} | Output: {{output}} | Turns: {{turns}}"}}});var Ox=D((ZM,HN)=>{HN.exports={inbox:{serverUnreachable:"PlanBee-Server nicht erreichbar ({{url}})",connectionAborted:"Verbindung zum Server abgebrochen",unknownError:"Unbekannter Fehler",justNow:"gerade eben",crossTenantBlock:"Nachricht blockiert: die Ziel-Session gehoert einem anderen Benutzer und ihr teilt kein Team mit Zugriff auf dieses Projekt. Cross-Tenant-Sends sind nicht erlaubt \u2014 pruefe Team-Mitgliedschaft und Projekt-Sharing, dann erneut versuchen.",timeAgoMinutes:"vor {{minutes}}m",timeAgoHoursMinutes:"vor {{hours}}h {{minutes}}m",timeAgoHours:"vor {{hours}}h",header:"PlanBee Inbox",divider:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",queuedCount:" Wartende Nachrichten: {{count}}",unreadDelivered:" Zugestellte (ungelesen): {{count}}",deliveredCount:" Zugestellte Nachrichten: {{count}}",total:" Gesamt: {{count}}",listHint:`
|
|
146
|
+
Nutze "planbee inbox --list" zum Anzeigen der wartenden Nachrichten.`,fetchError:"Fehler beim Abrufen der Inbox: {{error}}",confirmError:"Fehler beim Best\xE4tigen der Nachrichten: {{error}}",messageDeleted:"Nachricht gel\xF6scht: {{id}}",messagePreview:" Vorschau: {{preview}}",messageNotQueued:"Nachricht kann nicht gel\xF6scht werden (nicht mehr in Warteschlange)",messageNotFound:"Nachricht nicht gefunden",deleteError:"Fehler beim L\xF6schen der Nachricht: {{error}}",watchingLog:"Watching inbox for new messages (timeout: {{timeout}}s, interval: {{interval}}s{{monitorSuffix}})...",monitorSuffix:", monitor: on ({{scope}})",serverWaiting:"PlanBee-Server nicht erreichbar ({{url}}), warte auf Verbindung...",claimError:"Fehler beim Claimen der Nachricht: {{error}}",batchReceived:"Du hast {{count}} Nachrichten als Batch empfangen.",batchConfirm:"Bestaetige alle: planbee inbox --confirm {{ids}}",singleReceived:"Du hast diese Nachricht soeben empfangen.",checkTasks:"WICHTIG: Pruefe nach jeder Nachricht deine Aufgabenliste:",checkTasksCmd:" \u2022 planbee tasks --session $PLANBEE_SESSION_ID --all",updateTasks:" \u2022 Aktualisiere deine Tasks bei Bedarf",markCompleted:' \u2022 Markiere erledigte Tasks als "completed"',watchModeRestart:"Nach Bearbeitung der Nachricht MUSST du den Watch-Modus neu starten:",watchClaimError:"Fehler beim Watch-Claim: {{error}}",timeoutReached:"Time-Out erreicht. Bitte Watchmode erneut starten.",keepTasksUpdated:"WICHTIG: Halte deine Aufgabenliste stets aktuell",afterTimeoutInstructions:" Nach jedem Watch-Timeout und nach jeder neuen Nachricht:",checkTasksAfterTimeout:" \u2022 Pr\xFCfe deine Tasks: planbee tasks --session $PLANBEE_SESSION_ID --all",updateTasksAfterTimeout:" \u2022 Aktualisiere deine Task-Liste bei Bedarf",markCompletedAfterTimeout:' \u2022 Markiere erledigte Tasks als "completed"',useProgress:" \u2022 Nutze: planbee progress f\xFCr Fortschritts-Updates",overviewHelp:" Eine aktuelle Aufgabenliste hilft dir und deinem Team, den \xDCberblick",overviewHelp2:" zu behalten und effizient zusammenzuarbeiten.",watchModeDeactivated:"\u26D4 Watch Mode wurde deaktiviert - kein Neustart notwendig.",continueWorking:"Du kannst normal weiterarbeiten.",watchModeRestartCmd:"Watch-Modus neu starten mit:",watchModeDeactivatedHeader:"\u26D4 WATCHMODE DEAKTIVIERT",watchModeDisabledByUser:"Der Watch Mode wurde vom User deaktiviert. Du kannst den Watch-Modus",watchModeDisabledByUser2:"jetzt beenden und normal weiterarbeiten.",noQueuedMessages:"Keine wartenden Nachrichten.",queuedMessages:"Wartende Nachrichten ({{count}}):",from:" Von: {{label}}",age:" Alter: {{age}}",preview:" Vorschau: {{preview}}",readHint:`
|
|
147
|
+
Nutze "planbee inbox --read <id>" zum Lesen einer Nachricht.`,listFetchError:"Fehler beim Abrufen der Nachrichten: {{error}}",priority:" Priorit\xE4t: {{priority}}",status:" Status: {{status}}",sent:" Gesendet: {{age}}",messageLabel:`
|
|
148
|
+
Nachricht:`,markedRead:`
|
|
149
|
+
\u2713 Als gelesen markiert.`,readError:"Fehler beim Lesen der Nachricht: {{error}}",waitingMessages:`{{count}} wartende Nachricht(en):
|
|
150
|
+
`,allDisplayed:`
|
|
151
|
+
\u2713 Alle {{count}} Nachricht(en) angezeigt.`,allMarkedRead:"\u2713 Alle Nachrichten als gelesen markiert.",readAllError:"Fehler beim Lesen der Nachrichten: {{error}}",noSystemMessages:"Keine System-Nachrichten.",systemMessages:"System-Nachrichten ({{count}}):",systemMessageNote:`
|
|
152
|
+
System-Nachrichten sind interne State-Tracking-Records (nicht als Prompt zugestellt).`,systemFetchError:"Fehler beim Abrufen der System-Nachrichten: {{error}}",sessionNotFound:"Fehler: Session-ID nicht gefunden.",sessionEnvHint:"Setze die Umgebungsvariable PLANBEE_SESSION_ID oder \xFCbergib --session <id>:",sessionEnvExample1:" PLANBEE_SESSION_ID=<id> planbee inbox",sessionEnvExample2:" planbee inbox --session <id>",waitSessionInvalid:'Fehler: --wait braucht eine g\xFCltige Session-UUID, bekommen: "{{value}}". Der Watcher wird NICHT gestartet (ein sessionloser Watcher h\xE4lt einen Claim, kann aber nichts zustellen).',ageWarning:"Age: {{age}} (diese Nachricht kann veraltete Informationen enthalten)",batchHeader:"=== PLANBEE BATCH: {{count}} NACHRICHTEN ===",batchEndHeader:"=== ENDE BATCH ===",describe:"Verwalte deine PlanBee-Nachrichtenwarteschlange",optSession:"Session-ID (\xFCberschreibt PLANBEE_SESSION_ID)",optList:"Liste wartende Nachrichten mit Details",optRead:"Lies eine spezifische Nachricht (ID) und markiere als gelesen",optReadAll:"Lies alle wartenden Nachrichten und markiere sie als gelesen",optConfirm:"Best\xE4tige Nachricht(en) als gelesen (komma-separierte IDs)",optDelete:"L\xF6sche eine wartende Nachricht aus der Warteschlange (ID)",optWatch:"VERALTET: Alias f\xFCr --wait (der alte Vordergrund-Claim-Loop wurde entfernt)",optInterval:"Poll-Intervall in Sekunden (Default: 5)",optTimeout:"Wait-Timeout in Sekunden (Default: 14400)",optSystem:"Zeige System-Nachrichten (interne State-Transitions)",optMonitor:"Zeige Agenten-Events in Echtzeit (mit --watch)",optMonitorScope:"Monitor-Scope: swarm (eigene Agenten), project (Projekt-Agenten), global (alle)",optJson:"JSON-Ausgabe",exSummary:"Zeige Inbox-Zusammenfassung",exList:"Liste alle wartenden Nachrichten",exRead:"Lies eine spezifische Nachricht",exReadAll:"Lies alle wartenden Nachrichten",exConfirm:"Best\xE4tige eine Nachricht als gelesen",exConfirmMulti:"Best\xE4tige mehrere Nachrichten",exWatch:"Warte auf neue Nachrichten",exWatchTimeout:"Warte max. 60 Sekunden",exWatchMonitor:"Watch mit Echtzeit-Agenten-Events (Swarm-Scope)",exWatchMonitorProject:"Watch mit Projekt-Events",exWatchMonitorGlobal:"Watch mit allen Agenten-Events",exSystem:"Zeige System-Nachrichten",optWait:"Auf neue Nachrichten warten; beendet sich beim ersten Treffer (Wake-Watcher). F\xFCr Remote-Control als Background-Task starten",watchDeprecated:"[planbee] --watch ist veraltet und verh\xE4lt sich jetzt wie --wait (weckt nur, claimt nichts). Nach dem Exit Nachrichten mit 'planbee inbox --read-all' lesen.",exWait:"Auf die n\xE4chste Nachricht warten (Exit bei Eingang)",exWaitTimeout:"Wake-Watcher mit 4h-Timeout (Remote-Control-Default)",optWaitSupervised:"Wie --wait, aber selbstheilend: ein Supervisor im selben Prozess \xFCberwacht den Wake-Watcher und startet ihn nach unerwarteten Exits (kill -9, MCP-Disconnect) automatisch neu. Gleiche Exit-Codes wie --wait (0 wake / 2 timeout / 3 auth-dead / 4 remote-control-off / 5 session-gone / 6 already-waiting)",exWaitSupervised:"Selbstheilender Wake-Watcher (Auto-Restart bei unerwartetem Exit)"},startAgent:{sessionRequired:"Fehler: --session ist erforderlich",starting:"Starte Agent {{id}}...",waitingActivation:"Agent wird gestartet, warte auf Aktivierung...",cloudFallback:"Cloud-Modus: server-seitiger Start nicht verf\xFCgbar (501), Fallback auf Status-Poll...",agentActive:"[OK] Agent {{id}} ist aktiv",statusLabel:" Status: {{status}}",llmStateLabel:" LLM State: {{state}}",agentNotFound:"Fehler: Agent {{id}} nicht gefunden",timeoutError:"Timeout: Agent {{id}} wurde nicht innerhalb von {{seconds}}s aktiv",httpError:"Fehler ({{status}}): {{message}}",serverUnreachable:"Fehler: PlanBee Server nicht erreichbar. L\xE4uft der Server auf localhost:3456?",genericError:"Fehler: {{message}}",startFailed:"Fehler: {{error}}",describe:"Startet einen vorbereiteten (prepared) Agent",optSession:"Session-ID des zu startenden Agents",optTimeout:"Timeout in Millisekunden (Standard: 60000)",optJson:"JSON-Ausgabe",exStart:"Prepared Agent starten",exTimeout:"Mit l\xE4ngerem Timeout",exJson:"JSON-Ausgabe"},watchRules:{watchModeActive:"\u2705 aktiv",watchModeInactive:"\u274C inaktiv",customRulesYes:"ja",customRulesNo:"nein (Defaults)",sessionNotFound:"Session nicht gefunden: {{id}}",error:"Fehler: {{error}}",invalidJson:"Fehler: Ung\xFCltiges JSON f\xFCr --set",rulesSaved:"\u2713 Display-Regeln gespeichert",dashboardUpdated:"> **{{time}}** \xB7 Dashboard aktualisiert",sessionRequired:"Fehler: Session-ID nicht gefunden.",sessionHint:"Setze PLANBEE_SESSION_ID oder \xFCbergib --session <id>",describe:"Watch-Mode Dashboard Display-Regeln und Daten",optSession:"Session-ID (\xFCberschreibt PLANBEE_SESSION_ID)",optData:"Live-Dashboard-Daten abrufen und rendern",optSet:"Custom Display-Regeln setzen (JSON)",optJson:"JSON-Ausgabe",exRules:"Display-Regeln anzeigen",exDashboard:"Live-Dashboard rendern",exSet:"Custom Regeln setzen"},send:{messageRequired:"Fehler: --message ist erforderlich",sessionRequired:"Fehler: PLANBEE_SESSION_ID Umgebungsvariable nicht gesetzt",sessionRequiredHint:"Dieser Befehl muss innerhalb einer PlanBee-Agent-Session ausgefuehrt werden",messageSentToParent:"\u2713 Nachricht an Parent gesendet",warning:" \u26A0 Warnung: {{warning}}",httpError:"Fehler: {{message}}",noParentHint:`
|
|
153
|
+
Hinweis: Diese Session ist eine Root-Session ohne Parent.`,invalidSessionHint:`
|
|
154
|
+
Hinweis: Die PLANBEE_SESSION_ID ist ungueltig oder die Session existiert nicht.`,serverUnreachable:"Fehler: PlanBee Server nicht erreichbar. Laeuft der Server?",genericError:"Fehler: {{message}}",optPriority:"Message priority: normal = warten bis idle, high/urgent = sofort unterbrechen",invalidSessionIdFormat:'Fehler: {{field}} "{{value}}" ist keine gueltige Session-ID (erwartet: vollstaendige UUID, 36 Zeichen, Format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)',truncatedSessionId:'Fehler: {{field}} "{{value}}" sieht nach einer GEKUERZTEN ID aus (8 Zeichen, wie in Inbox-/Status-Anzeigen). Bitte die VOLLSTAENDIGE UUID (36 Zeichen) verwenden, nicht die Kurzform.'},status:{ambiguousId:'Mehrdeutige ID "{{id}}" - {{count}} Treffer:',sessionNotFoundPrefix:"Session nicht gefunden fuer ID-Prefix: {{id}}",allSessionsHeader:"Alle Sessions:",noSessions:" Keine aktiven Sessions gefunden.",projectLabel:"Projekt: {{folder}}",totalSessions:"Gesamt: {{count}} Sessions",noSessionsCompact:" Keine aktiven Sessions gefunden.",totalSessionsCompact:"Gesamt: {{count}} Sessions",healthHeader:"System Health Status:",error:"Fehler: {{error}}",describe:"Zeige Session-Status oder System-Health",optSession:"Session-ID (UUID)",optJson:"JSON-Ausgabe",optHealth:"F\xFChre System-Health-Checks durch",optCompact:"Kompakte Tabellenansicht statt Baumdarstellung",exAll:"Zeige alle aktiven Sessions",exSession:"Zeige Status einer Session",exHealth:"Zeige den System-Health-Status",exJson:"Zeige Status als JSON"},listAgents:{noAgents:"Keine aktiven Agenten gefunden ({{scope}}).",useAll:"Nutze --all f\xFCr alle Projekte.",agentCount:`
|
|
155
|
+
{{count}} Agent(en) {{scope}}:
|
|
156
|
+
`,describe:"Liste alle aktiven Agenten (ohne Suchbegriff)",optAll:"Zeige Agenten aller Projekte",optFolder:"Filter nach Projektordner",optStatus:"Filter nach Status (kommagetrennt, z.B. active,plan_ready)",optJson:"JSON-Ausgabe"},activity:{now:"jetzt",noAgents:"Keine aktiven Agenten gefunden.",useAll:"Nutze --all f\xFCr alle Projekte.",noActivity:"Keine Aktivit\xE4t gefunden.",noActivityEntry:"(keine Aktivit\xE4t)",describe:"Letzte Aktion jedes aktiven Agenten",optAll:"Zeige Aktivit\xE4t aller Projekte",optSince:"Nur Aktivit\xE4t seit Dauer (z.B. 10m, 1h, 2d)",optJson:"JSON-Ausgabe"},plan:{planStatusFor:"Plan-Status f\xFCr {{id}}:",yes:"[OK] Ja",no:"[--] Nein",isManaged:" Agent managed: {{value}}",isPlanDecided:" Plan decided: {{value}}",planTruncated:" ... (gek\xFCrzt, --full f\xFCr vollst\xE4ndigen Text)",openQuestions:`
|
|
157
|
+
Offene Frage(n):`,options:" Optionen: {{options}}",answerHint:`
|
|
158
|
+
Beantworten: planbee plan answer {{id}} -m "Deine Antwort"`,approved:"[OK] Plan genehmigt fuer Session {{id}}",rejected:"[REJECT] Plan abgelehnt fuer Session {{id}}",feedbackRequired:"Error: --message (-m) ist erforderlich f\xFCr Feedback.",feedbackSent:"[FB] Feedback gesendet an Session {{id}}",executing:"[RUN] Plan wird in neuer Session ausgefuehrt: {{newId}}",answersRequired:"Error: Bitte --answers oder --message angeben.",answered:"[OK] Frage beantwortet f\xFCr Session {{id}}",dismissed:"[OK] Plan/Frage dismissed fuer Session {{id}}",noPlan:"Kein Plan vorhanden f\xFCr diese Session.",noPending:"Keine Agenten mit offenen Pl\xE4nen.",agentsWaiting:`{{count}} Agent(en) warten auf Review:
|
|
159
|
+
`,since:"Seit: {{age}}",serverUnreachable:"PlanBee Server nicht erreichbar. L\xE4uft der Server auf localhost:3456?",actionError:"Fehler beim {{action}}: {{error}}",demandCommand:"Bitte einen Subcommand angeben: status, approve, reject, feedback, execute, answer, dismiss, list, view"},dashboard:{noAgents:"Keine aktiven Agenten gefunden ({{scope}}).",useAll:"Nutze --all f\xFCr alle Projekte.",summary:`\u{1F4CA} {{active}} aktiv | {{completed}} fertig | {{error}} error | {{other}} andere
|
|
160
|
+
`,describe:"Kompakte \xDCbersicht aller aktiven Agenten",optAll:"Zeige Agenten aller Projekte",optChildren:"Zeige nur Kinder einer bestimmten Session (Queen-ID)",optJson:"JSON-Ausgabe"},cliApiClient:{sessionExpired:`
|
|
161
|
+
Session abgelaufen. Bitte erneut einloggen:
|
|
162
|
+
planbee auth login
|
|
163
|
+
|
|
164
|
+
`,cloudUnreachable:"PlanBee Cloud-Server nicht erreichbar. Pr\xFCfe deine Internetverbindung.",localUnreachable:"Lokaler PlanBee-Server nicht erreichbar auf {{url}}.",genericUnreachable:"PlanBee Server nicht erreichbar."},messageStatus:{idRequired:"Fehler: Message ID ist erforderlich",header:"\u{1F4E8} Message Status",priority:" Priorit\xE4t: {{value}}",sent:" Gesendet: {{time}}",delivered:" Zugestellt: {{time}} ({{duration}})",deliveredPending:" Zugestellt: ausstehend",readConfirmation:" Lesebest\xE4tigung: \u2713 {{time}} ({{duration}})",readPending:" Lesebest\xE4tigung: ausstehend",targetAgentHeader:" \u2500\u2500 Ziel-Agent \u2500\u2500",task:" Aufgabe: {{task}}",taskWithPercent:" Aufgabe: {{task}} ({{percent}}%)",durationSeconds:"nach {{seconds}}s",durationMinutes:"nach {{minutes}}min",notFound:"Fehler: Message nicht gefunden: {{id}}"},inboxWait:{started:"Warte auf neue Nachrichten (Wake-Watcher, Timeout: {{timeout}}s, Poll-Intervall: {{interval}}s). Beendet sich bei Nachrichteneingang.",pollError:"Inbox-Poll fehlgeschlagen (Versuch {{attempt}}, naechster Retry in {{backoffSeconds}}s): {{error}}",wakeIntro:"F\xFChre jetzt aus, in dieser Reihenfolge:",wakeHandle:"Bearbeite die Anliegen, aktualisiere deine Tasks (planbee progress ...).",wakeRearm:"Arme den Wake-Watcher NEU, bevor du deinen Turn beendest \u2014 Bash-Tool mit run_in_background: true:",wakeEnforced:"(Ohne Re-Arm blockiert der Stop-Hook deinen Turn und erinnert dich.)",timeoutReached:"[PlanBee] Wake-Watcher-Timeout nach {{timeout}}s \u2014 keine Nachrichten. Jetzt neu armen (Bash, run_in_background: true):",disabled:"[PlanBee] Remote-Control wurde f\xFCr diese Session deaktiviert \u2014 Watcher NICHT neu armen. Normal weiterarbeiten.",sessionGone:"[PlanBee] Session existiert nicht mehr \u2014 Watcher beendet. Nicht neu armen.",alreadyWaiting:"a wake-watcher is already running for this session \u2014 do NOT re-arm, exit your loop"},remoteControl:{describe:"Remote-Control f\xFCr eine Session ein-/ausschalten (Inbox-Push weckt das Terminal)",optAction:"on | off | status",optSession:"Session-ID (Default: PLANBEE_SESSION_ID)",optTimeout:"Wake-Watcher-Timeout in Sekunden (Default: 14400)",optInterval:"Poll-Intervall in Sekunden (Default: 5)",optJson:"Ausgabe als JSON",exOn:"Remote-Control f\xFCr die aktuelle Session aktivieren",exOff:"Remote-Control deaktivieren",exStatus:"Remote-Control-Status als JSON anzeigen",sessionRequired:"Keine Session-ID: --session \xFCbergeben oder PLANBEE_SESSION_ID setzen",sessionNotFound:"Session nicht gefunden",enabled:"Remote-Control f\xFCr diese Session AKTIVIERT.",armHint:"Arme jetzt den Wake-Watcher (Bash-Tool, run_in_background: true):",enforcementNote:"Der Stop-Hook erzwingt ab jetzt einen laufenden Watcher: ohne ihn endet der Turn des Agenten nicht. Nachrichten von allen Ger\xE4ten (planbee send, Electron, Mobile) wecken diese Session automatisch.",statusHeader:"Remote-Control-Status",watcherMissing:"Remote-Control ist AN, aber kein Watcher-Prozess l\xE4uft \u2014 armen:",disabled:"Remote-Control DEAKTIVIERT. Ein laufender Watcher beendet sich selbst innerhalb ~30s.",error:"remote-control fehlgeschlagen: {{error}}"},usage:{describe:"Provider-Limits (Claude, AGY, MiniMax, Copilot) abfragen",optDevice:'Geraet: Device-ID, Hostname oder "all" fuer alle Geraete',optProvider:"Provider filtern: claude, agy, minimax, copilot oder all",optJson:"Rohe API-Antwort als JSON ausgeben",optDays:"Zusaetzlich Token-Summe der letzten N Tage (0 = alles)",exAccount:"Kontoweite Limits als Tabelle",exDevices:"Limits aller registrierten Geraete",exJson:"Nur Claude, als rohes JSON",headerAccount:"Usage (kontoweit)",headerDevice:"Geraet: {{hostname}} ({{deviceId}}) - {{state}}",online:"online",offline:"offline",deviceOfflineHint:" Hinweis: Geraet ist offline (letzter Heartbeat: {{lastSeen}}) - Werte koennen veraltet sein.",colProvider:"Provider",colWindow:"Fenster",colUsage:"Genutzt/Limit/%",colReset:"Reset",windowMonth:"Monat",windowExtra:"Extra",resetIn:"in {{rest}}",noData:"keine Daten",noWindows:"keine Fensterdaten gemeldet",stale:"Daten veraltet (stale)",noteLine:" Hinweis: {{note}}",providerUnavailable:" {{provider}}: nicht konfiguriert oder keine Daten ({{reason}})",providerNone:"Kein angefragter Provider liefert Daten.",noDevices:"Keine registrierten Geraete.",deviceNotFound:"Geraet nicht gefunden: {{device}}",notLoggedIn:'Nicht eingeloggt - "planbee auth login" ausfuehren.',connectionFailed:"Keine Verbindung zur PlanBee-API ({{url}}).",unknownProvider:'Unbekannter Provider "{{provider}}". Gueltig: {{valid}}',invalidDays:"Ungueltiger Wert fuer --days: {{days}}",errorPrefix:"Fehler: {{error}}",summaryHeader:"Token-Summe ({{days}} Tage)",summaryTotals:" Sessions: {{sessions}} | Input: {{input}} | Output: {{output}} | Turns: {{turns}}"}}});var et=D((e3,Tx)=>{var ai=_x(),zN=Cx(),WN=Ox();ai.init({resources:{en:{translation:zN},de:{translation:WN}},lng:process.env.PLANBEE_LANG||"en",fallbackLng:"en",initImmediate:!1});ai.agent=ai.getFixedT("en");Tx.exports=ai});var Rx=D((t3,Ix)=>{var $x=de(),JN=require("crypto"),at=et(),{resolveApiUrl:KN}=te(),{getEnv:kl}=Be(),Nx=KN(),GN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,VN=/^[0-9a-f]{8}$/i;function Px(t,e){return GN.test(t)?null:VN.test(t)?at.t("send.truncatedSessionId",{field:e,value:t}):at.t("send.invalidSessionIdFormat",{field:e,value:t})}function YN(t){if(!t)return null;let e=Date.now()-new Date(t).getTime(),n=Math.floor(e/1e3);if(n<60)return`${n}s ago`;let s=Math.floor(n/60);return s<60?`${s}m ago`:`${Math.floor(s/60)}h ago`}async function XN(t){let{to:e,message:n,json:s,from:o,priority:r,abort:i,replyExpected:a,replyTo:c,instructions:l}=t,u=t.reply===!1,p=o||t.session||kl("PLANBEE_SESSION_ID")||null;p||(console.error("Error: --from is required (or set --session or PLANBEE_SESSION_ID env var). Anonymous messages are not allowed."),process.exit(1)),e||(console.error("Error: --to is required"),process.exit(1)),n||(console.error("Error: --message is required"),process.exit(1));let d=Px(e,"--to");if(d&&(console.error(d),process.exit(1)),o){let f=Px(o,"--from");f&&(console.error(f),process.exit(1))}i&&!["high","urgent"].includes(r||"normal")&&(console.error("Error: --abort requires --priority high or --priority urgent"),process.exit(1));try{let f=JN.randomUUID(),m=await $x.post(`${Nx}/api/v1/messages/send`,{to:e,message:n,from:p,priority:r||"normal",inject:!0,abortIfBusy:i===!0,idempotencyKey:f,...a&&{replyExpected:!0},...c&&{replyTo:c},...u&&{noReplyNeeded:!0},...l&&{instructions:l}},{timeout:1e4});if(s)console.log(JSON.stringify(m.data,null,2));else if(console.log(`\u2713 Message sent to ${e}`),console.log(` Message ID: ${m.data.messageId}`),console.log(` Priority: ${r||"normal"}`),console.log(` Status: ${m.data.status}`),m.data.injected?console.log(` \u2713 Sofort zugestellt (PID: ${m.data.processId})`):console.log(" Queued"),m.data.aborted&&console.log(" \u26A0 Agent was aborted for high-priority message"),m.data.warning&&console.log(at.t("send.warning",{warning:m.data.warning})),m.data.targetAgent){let h=m.data.targetAgent;console.log(" -- Target Agent --"),console.log(` Status: ${h.status}${h.agentType?` \xB7 ${h.agentType}`:""}`),h.currentTask&&console.log(` Task: ${h.currentTask}${h.completionPercent?` (${h.completionPercent}%)`:""}`),h.lastActivity&&console.log(` Last activity: ${YN(h.lastActivity)}`)}process.exit(0)}catch(f){f.response?console.error(`Error: ${f.response.data.error||f.message}`):f.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${f.message}`),process.exit(1)}}async function QN(t){let{message:e,json:n}=t,s=kl("PLANBEE_SESSION_ID");e||(console.error(at.t("send.messageRequired")),process.exit(1)),s||(console.error(at.t("send.sessionRequired")),console.error(at.t("send.sessionRequiredHint")),process.exit(1));try{let o=await $x.post(`${Nx}/api/v1/messages/send-to-queen`,{message:e},{headers:{"Content-Type":"application/json","X-PlanBee-Session-Id":s}});n?console.log(JSON.stringify(o.data,null,2)):(console.log(at.t("send.messageSentToParent")),console.log(` Message ID: ${o.data.messageId}`),console.log(` Parent ID: ${o.data.parentSessionId}`),console.log(` Status: ${o.data.status}`),o.data.warning&&console.log(at.t("send.warning",{warning:o.data.warning}))),process.exit(0)}catch(o){if(o.response){let r=o.response.data.error||o.message;console.error(at.t("send.httpError",{message:r})),o.response.data.code==="NO_PARENT_SESSION"?console.error(at.t("send.noParentHint")):o.response.data.code==="SESSION_NOT_FOUND"&&console.error(at.t("send.invalidSessionHint"))}else o.code==="ECONNREFUSED"?console.error(at.t("send.serverUnreachable")):console.error(at.t("send.genericError",{message:o.message}));process.exit(1)}}Ix.exports={send:{command:"send",describe:"Send message to specific agent with priority support (Phase 7)",builder:t=>t.option("to",{alias:"t",type:"string",description:"Target session ID",demandOption:!0}).option("message",{alias:"m",type:"string",description:"Message content",demandOption:!0}).option("from",{alias:"f",type:"string",description:"REQUIRED: Source session ID (or set --session / PLANBEE_SESSION_ID)"}).option("session",{alias:"S",type:"string",description:"Own session ID (used as from if --from not set)",default:kl("PLANBEE_SESSION_ID")}).option("priority",{alias:"p",type:"string",description:at.t("send.optPriority"),default:"normal",choices:["low","normal","high","urgent"]}).option("abort",{type:"boolean",description:"Abort running agent (auto-enabled for high/urgent, set false to disable)",default:!1}).option("reply-expected",{type:"boolean",description:"Request reply from recipient",default:!1}).option("reply-to",{type:"string",description:"Override reply-to session ID (default: sender)"}).option("reply",{type:"boolean",description:"Antwort erwartet \u2014 mit --no-reply signalisieren, dass keine Antwort n\xF6tig ist",default:!0}).option("instructions",{alias:"i",type:"string",description:"Behavioral instructions for recipient"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).example('$0 send --to <uuid> --message "Hello"',"Send normal priority message").example('$0 send -t <uuid> -m "Status?" --reply-expected',"Request a reply").example('$0 send --to <uuid> -m "Analyze error" --reply-expected -i "Reply with root cause"',"With instructions").example('$0 send --to <uuid> -m "URGENT!" --priority urgent --abort',"Interrupt agent with urgent message").example('$0 send --to <uuid> -m "FYI" --no-reply',"Fire-and-forget, keine Antwort erwartet"),handler:XN},sendToQueen:{command:"send-to-queen",describe:"Send message to parent (queen) agent",builder:t=>t.option("message",{type:"string",description:"Message content",demandOption:!0}).option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:QN}}});var $o=D((n3,Bx)=>{var{getEnv:Al}=Be(),Fx=Al("PLANBEE_HEARTBEAT_INTERVAL_MS"),ZN=Fx?parseInt(Fx,10):15e3,jx=Al("PLANBEE_HEARTBEAT_ALIVE_MS"),eI=jx?parseInt(jx,10):90*1e3,Lx=Al("PLANBEE_AGENT_ALIVE_MS"),tI=Lx?parseInt(Lx,10):600*1e3;Bx.exports={WATCH_HEARTBEAT_INTERVAL_MS:ZN,WATCH_HEARTBEAT_ALIVE_MS:eI,AGENT_HEARTBEAT_ALIVE_MS:tI}});var Cl=D((s3,qx)=>{var _l=class extends Error{constructor({kind:e,store:n,daysOld:s=null,email:o=null,token:r=null,cause:i=null}={}){super(`Authentication token expired (${e}${n?` @ ${n}`:""})`),this.name="AuthExpiredError",this.code="AUTH_EXPIRED",this.kind=e,this.store=n,this.daysOld=s,this.email=o,Object.defineProperty(this,"_token",{value:r,enumerable:!1,writable:!0}),i&&(this.cause=i)}};function nI(t){let e=[];return e.push("PlanBee CLI: stored authentication token is no longer valid."),t.kind==="pat"?(e.push(` Token type: Personal Access Token (${t.store||"~/.planbee/cli-auth.json"})`),t.daysOld!=null&&e.push(` Token age: ${t.daysOld} day(s) (likely rotated server-side)`)):t.kind==="jwt"&&(e.push(` Token type: Supabase JWT (${t.store||"~/.planbee/auth.json"})`),t.daysOld!=null&&e.push(` Expired since: ${t.daysOld} minute(s)`)),t.email&&e.push(` Account: ${t.email}`),e.push(""),e.push("To restore CLI access, run:"),e.push(" planbee auth login --email <you> --password <pw>"),e.push(""),e.push("Then retry the original command."),e.join(`
|
|
165
|
+
`)}qx.exports={AuthExpiredError:_l,formatAuthExpiredMessage:nI}});var ci=D((o3,Hx)=>{var sI=de(),oI=require("path"),rI=require("os"),No=it(),{resolveApiUrl:iI}=te(),{AuthExpiredError:aI}=Cl(),cI=6e3,lI=["INVALID_TOKEN","TOKEN_EXPIRED"];async function Ol(t,e){if(!t)return{ok:!1,errorCode:"MISSING_TOKEN"};let s=iI({apiUrl:e}).replace(/\/+$/,""),o=s.endsWith("/api")?`${s}/v1/auth/me`:`${s}/api/v1/auth/me`;try{let r=await sI.get(o,{headers:{Authorization:`Bearer ${t}`},timeout:cI,maxRedirects:5,validateStatus:()=>!0}),i=r.data,a=i&&typeof i=="object"&&!Array.isArray(i);return r.status===200?a&&(i.user||i.success===!0)?{ok:!0,status:200,user:i.user}:{ok:!1,status:200,errorCode:"UNEXPECTED_BODY"}:r.status===401?a&&lI.includes(i.code)?{ok:!1,status:401,errorCode:"INVALID_TOKEN",serverCode:i.code}:{ok:!1,status:401,errorCode:"AUTH_AMBIGUOUS",serverCode:a?i.code:null}:r.status===403&&a&&i.code==="ACCOUNT_INACTIVE"?{ok:!1,status:403,errorCode:"INVALID_TOKEN",serverCode:i.code}:{ok:!1,status:r.status,errorCode:"TRANSIENT"}}catch(r){return{ok:!1,status:null,errorCode:"NETWORK",errorMessage:r.message}}}function uI(t){if(!t)return null;let e=Date.now()-new Date(t).getTime();return Number.isNaN(e)?null:Math.max(0,Math.floor(e/(24*60*60*1e3)))}function Mx(){let t=No.load();return!t||!t.token?null:{kind:"pat",token:t.token,apiUrl:t.api_url,store:No.TOKEN_PATH,daysOld:uI(t.created_at),email:t.user?.email||null,invalidAt:t.invalid_at||null,invalidBlocking:No.isBlockingInvalid(t)}}function Ux(){let t=Mx();return t?{kind:"pat",snapshot:t}:{kind:null,snapshot:null}}async function pI(){let{kind:t,snapshot:e}=Ux();if(!e)return{valid:!1,kind:null,user:null,email:null,daysOld:null,minutesLeft:null,store:null,errorCode:"MISSING_TOKEN",errorMessage:"No CLI token in ~/.planbee/",expiredError:null};let n=t==="jwt"&&e.expired,s=await Ol(e.token,e.apiUrl);if(s.errorCode==="INVALID_TOKEN"){let o=Number(process.env.PLANBEE_AUTH_CONFIRM_DELAY_MS)||2e3;await new Promise(i=>setTimeout(i,o));let r=await Ol(e.token,e.apiUrl);s=r.errorCode==="INVALID_TOKEN"?r:{...r,errorCode:r.ok?null:r.errorCode||"TRANSIENT"},r.ok&&(s=r)}if(s.ok){if(t==="pat"&&e.invalidAt)try{No.markValid(e.token)}catch{}return{valid:!0,kind:t,user:s.user||null,email:e.email,daysOld:e.daysOld,minutesLeft:e.minutesLeft,store:e.store,errorCode:null,errorMessage:null,expiredError:null}}return s.errorCode==="INVALID_TOKEN"?{valid:!1,kind:t,user:null,email:e.email,daysOld:e.daysOld,minutesLeft:e.minutesLeft,store:e.store,errorCode:"INVALID_TOKEN",errorMessage:s.errorCode||"Server rejected token",expiredError:new aI({kind:t,store:e.store,daysOld:e.daysOld,email:e.email,token:e.token})}:n?{valid:!1,kind:t,user:null,email:e.email,daysOld:e.daysOld,minutesLeft:e.minutesLeft,store:e.store,errorCode:s.errorCode||"TRANSIENT",errorMessage:s.errorMessage||`HTTP ${s.status||"n/a"}`,expiredError:null}:{valid:!1,kind:t,user:null,email:e.email,daysOld:e.daysOld,minutesLeft:e.minutesLeft,store:e.store,errorCode:s.errorCode||"TRANSIENT",errorMessage:s.errorMessage||`HTTP ${s.status||"n/a"}`,expiredError:null}}function dI(t){if(!t)return null;if(t.kind==="pat"&&t.store){try{if(No.markInvalid("INVALID_TOKEN",t._token))return t.store}catch{}return t.store}return null}function fI(){return!!(process.stdin&&process.stdin.isTTY&&process.stdout&&process.stdout.isTTY)}async function mI({method:t="github"}={}){let n=require("readline").createInterface({input:process.stdin,output:process.stdout}),s=a=>new Promise(c=>n.question(a,l=>c(l)));try{let a=(await s("Re-login now via GitHub in your browser? [Y/n] ")).trim().toLowerCase();if(a&&a!=="y"&&a!=="yes")return!1}finally{n.close()}let{spawn:o}=require("child_process"),r=oI.join(rI.homedir(),"bin","planbee"),i=["auth","login",`--${t}`];return new Promise(a=>{let c=!1,l=o(r,i,{stdio:"inherit"});l.on("error",()=>a(!1)),l.on("exit",u=>{c=!0,a(u===0)}),setTimeout(()=>{c||a(!1)},6e4)})}Hx.exports={probeAuthMe:Ol,loadPatSnapshot:Mx,pickActiveToken:Ux,validateAuth:pI,clearExpiredToken:dI,isInteractiveTerminal:fI,interactiveRelogin:mI}});var $l=D((r3,Qx)=>{var{axios:Io,PLANBEE_API_URL:Ro}=mn(),Tt=et(),{WATCH_HEARTBEAT_INTERVAL_MS:hI}=$o(),Zt=qn(),Wx=14400,gI=3e4,Fo=1e4;function ui(t,e){return`planbee inbox --wait --session ${t} --timeout ${e}`}function Bt(t,e,n){console.log(`EXIT_REASON: ${t} ${e} \u2014 ${n}`),process.exit(t)}function Jx(t,e,n){return[`=== PLANBEE REMOTE CONTROL \u2014 ${e} new message(s) ===`,Tt.agent("inboxWait.wakeIntro")," 1. planbee inbox --read-all"," 2. planbee inbox --confirm <message-ids>",` 3. ${Tt.agent("inboxWait.wakeHandle")}`,` 4. ${Tt.agent("inboxWait.wakeRearm")}`,` ${ui(t,n)}`,Tt.agent("inboxWait.wakeEnforced")].join(`
|
|
166
|
+
`)}function Kx(t,e){return[Tt.agent("inboxWait.timeoutReached",{timeout:e}),ui(t,e)].join(`
|
|
167
|
+
`)}async function li(t,e){try{let n=await Io.post(`${Ro}/api/v1/sessions/${t}/watching-inbox`,{watching:e},{timeout:Fo,validateStatus:()=>!0}),s=n.data||{};return{status:n.status,rejected:n.status===409,heartbeatAgeSeconds:s.heartbeatAgeSeconds??null,claimState:s.claimState??null,autoReleaseInSeconds:s.autoReleaseInSeconds??null}}catch{return{status:0,rejected:!1}}}async function zx(t){try{await Io.post(`${Ro}/api/v1/sessions/${t}/watching-inbox-heartbeat`,{},{timeout:Fo})}catch{}}async function Tl(t){try{await Io.post(`${Ro}/api/v1/sessions/${t}/watching-inbox-release`,{},{timeout:Fo})}catch{}}async function Pl(t){try{let n=(await Io.get(`${Ro}/api/v1/sessions/${t}`,{timeout:Fo})).data?.session;return n?{watchMode:!!n.watchMode,watchTimeout:n.watchTimeout||null}:null}catch(e){return e.response?.status===404?{gone:!0}:null}}async function Gx(t,e){let n=ci(),{formatAuthExpiredMessage:s}=Cl(),o=await n.validateAuth();if(!o.expiredError)return!0;let r=n.clearExpiredToken(o.expiredError);if(process.stderr.write(`
|
|
168
|
+
${s(o.expiredError)}
|
|
169
|
+
`),r&&process.stderr.write(`Marked dead token for recovery: ${r}
|
|
170
|
+
`),n.isInteractiveTerminal()&&await n.interactiveRelogin({method:"github"}))return process.stderr.write(`Re-login OK, retrying...
|
|
171
|
+
`),!0;try{Zt.removePidFile(e)}catch{}await Tl(e),Bt(3,"auth-dead","token dead \u2014 run `planbee auth login`, then re-arm")}async function Vx(t){return((await Io.get(`${Ro}/api/v1/messages/${t}?status=queued`,{timeout:Fo})).data?.messages||[]).length}function yI(t){return new Promise(e=>{setTimeout(e,t)})}var Yx=10;function Xx(t,e,n){return Tt.t("inboxWait.pollError",{attempt:t,backoffSeconds:Math.round(e/1e3),error:n.response?.data?.error||n.message})}async function bI(t,{interval:e=5,timeout:n=Wx}={}){let s=Date.now(),o=n*1e3;if(Zt.isWatcherAlive(t)){Bt(6,"already-waiting",Tt.agent("inboxWait.alreadyWaiting"));return}if(Zt.writePidFile(t),(await li(t,!0)).rejected){Zt.removePidFile(t),Bt(6,"already-waiting",Tt.agent("inboxWait.alreadyWaiting"));return}let i=h=>async()=>{Zt.removePidFile(t),await li(t,!1),h==="SIGINT"&&Bt(0,"stopped","interrupted at the terminal (Ctrl-C) \u2014 do NOT auto re-arm"),Bt(0,"reaped",`terminated by ${h} (background reaper, not an error) \u2014 re-arm: ${ui(t,n)}`)};process.on("SIGINT",i("SIGINT")),process.on("SIGTERM",i("SIGTERM")),await zx(t);let c=(await Pl(t))?.watchMode===!0;console.log(Tt.agent("inboxWait.started",{timeout:n,interval:e}));let l=e*1e3,u=Math.max(l*3,15e3),p=l,d=Date.now(),f=Date.now(),m=0;for(;;){let h=null;try{h=await Vx(t),m=0}catch(g){if(g.response?.status===401){await Gx(g,t)&&(m=0,p=l);continue}m+=1,p=u,(m===1||m%Yx===0)&&console.error(Xx(m,p,g))}if(h!==null){if(h>0){Zt.removePidFile(t),await Tl(t),console.log(Jx(t,h,n)),Bt(0,"wake","messages waiting \u2014 read, confirm, handle, then re-arm");return}p=Math.min(p+2500,u)}if(Date.now()-s>=o){Zt.removePidFile(t),await Tl(t),console.log(Kx(t,n)),Bt(2,"timeout","no messages \u2014 not an error, just re-arm");return}if(await yI(p),Date.now()-f>=gI){f=Date.now();let g=await Pl(t);if(g?.gone){Zt.removePidFile(t),console.log(Tt.agent("inboxWait.sessionGone")),Bt(5,"session-gone","session no longer exists \u2014 do NOT re-arm, exit your loop");return}if(c&&g&&!g.watchMode){Zt.removePidFile(t),await li(t,!1),console.log(Tt.agent("inboxWait.disabled")),Bt(4,"remote-control-off","remote control disabled \u2014 do NOT re-arm");return}}Date.now()-d>=hI&&(await zx(t),d=Date.now())}}Qx.exports={waitForMessages:bI,buildWakeText:Jx,buildTimeoutText:Kx,rearmCommand:ui,countQueued:Vx,fetchRemoteControlState:Pl,handleAuthFailure:Gx,setWatchingFlag:li,exitWith:Bt,formatPollRetryLog:Xx,POLL_RETRY_LOG_EVERY:Yx,DEFAULT_WAIT_TIMEOUT_S:Wx}});var uv=D((i3,lv)=>{var xI=require("path"),{EventEmitter:vI}=require("events"),ev=500,tv=5,nv=new Set([0,2,3,4,5,6]),sv=100,ov=3e4,rv=90*1e3,iv="[planbee-watcher-supervisor]";function wI(){return qn()}function Zx(t){let e=process.argv[1]||xI.resolve(__dirname,"..","..","index.js");return{command:process.execPath,baseArgs:[e],extraArgs:[],_cliEntry:t}}function av(t){return function(n,s){let o=`${iv} [${n}] ${s}
|
|
172
|
+
`;t&&typeof t.write=="function"?t.write(o):process.stderr.write(o)}}var pi=class extends vI{constructor(e){super(),this.sessionId=e.sessionId,this.timeoutSeconds=e.timeoutSeconds||14400,this.intervalSeconds=e.intervalSeconds||5,this.cliCommand=e.cliCommand||Zx().command,this.cliArgsBase=e.cliArgsBase||Zx().baseArgs,this.pidStore=e.pidStore||wI(),this.spawnFn=e.spawnFn||require("child_process").spawn,this.log=e.log||av(e.logStream),this.setTimeoutFn=e.setTimeoutFn||setTimeout,this.clearTimeoutFn=e.clearTimeoutFn||clearTimeout;let n=e.restartDelayMs!=null?e.restartDelayMs:ev;this.restartDelayMs=Math.min(Math.max(n,sv),ov),this.maxRestartCount=e.maxRestartCount!=null?e.maxRestartCount:tv,this.stillstandTimeoutMs=e.stillstandTimeoutMs!=null?e.stillstandTimeoutMs:rv,this.onMcpDisconnect=e.onMcpDisconnect||null,this._currentChild=null,this._currentPid=null,this._restartCount=0,this._stopped=!1,this._pendingRestartTimer=null,this._pendingReasonOverride=null}start(){return this._stopped=!1,this._restartCount=0,this._ensureNoForeignWatcher(),this._spawnWatcher("initial"),this}stop(){if(this._stopped=!0,this._pendingRestartTimer&&(this.clearTimeoutFn(this._pendingRestartTimer),this._pendingRestartTimer=null),this._currentChild&&typeof this._currentChild.kill=="function")try{this._currentChild.kill("SIGTERM")}catch{}this._currentChild=null,this._currentPid=null}triggerMcpDisconnect(e="external mcp-disconnect signal"){if(!this._stopped&&this._currentChild){this.log("WARN",`mcp-disconnect detected session=${this.sessionId} reason=${e} -- restarting watcher`),this._pendingReasonOverride={reason:"mcp-disconnect",level:"WARN"};try{this._currentChild.kill("SIGKILL")}catch{}}}_ensureNoForeignWatcher(){if(!(!this.pidStore.isWatcherAlive||typeof this.pidStore.isWatcherAlive!="function")&&this.pidStore.isWatcherAlive(this.sessionId)){let e=new Error(`Watcher already running for session ${this.sessionId}`);throw e.code="WATCHER_ALREADY_RUNNING",e}}_spawnWatcher(e,n){if(this._stopped)return null;this._ensureNoForeignWatcher();let s=[...this.cliArgsBase,"inbox","--wait","--session",this.sessionId,"--timeout",String(this.timeoutSeconds),"--interval",String(this.intervalSeconds)],o=this.spawnFn(this.cliCommand,s,{stdio:["ignore","pipe","pipe"],detached:!1});if(this._currentChild=o,this._currentPid=o&&o.pid?o.pid:null,o&&o.stdout&&typeof o.stdout.pipe=="function"&&o.stdout.pipe(process.stdout),o&&o.stderr&&typeof o.stderr.pipe=="function"&&o.stderr.pipe(process.stderr),e==="initial")this.log("INFO",`watcher started session=${this.sessionId} pid=${this._currentPid}`);else{this._restartCount+=1;let r=n||"WARN";this.log(r,`auto-restart session=${this.sessionId} reason=${e} pid=${this._currentPid} restartCount=${this._restartCount}`),this.emit("restart",{sessionId:this.sessionId,reason:e,newPid:this._currentPid,restartCount:this._restartCount})}return o&&typeof o.on=="function"&&o.on("exit",(r,i)=>this._handleChildExit(r,i,e,o)),o}_handleChildExit(e,n,s,o){if(o!==void 0&&this._currentChild!==o)return;let r=this._currentPid;this._currentChild=null,this._currentPid=null;let i=this._pendingReasonOverride;if(this._pendingReasonOverride=null,this._stopped){this.log("INFO",`watcher stopped session=${this.sessionId} signal=${n} code=${e} pid=${r}`);return}if(n){let a=i||{reason:n==="SIGKILL"?"kill-9":`signal-${String(n).toLowerCase()}`,level:"ERROR"};this.log(a.level,`watcher killed session=${this.sessionId} signal=${n} pid=${r} reason=${a.reason} -- auto-restart`),this._scheduleRestart(a.reason,a.level,{signal:n,oldPid:r});return}if(e!==null&&!nv.has(e)){this.log("ERROR",`watcher exited unexpectedly session=${this.sessionId} code=${e} pid=${r} -- auto-restart`),this._scheduleRestart("unexpected-exit","ERROR",{code:e,oldPid:r});return}this.log("INFO",`watcher exited cleanly session=${this.sessionId} code=${e} signal=${n} -- no auto-restart`),this.emit("exit",{sessionId:this.sessionId,code:e,signal:n,oldPid:r,reason:s})}_scheduleRestart(e,n,s={}){if(!this._stopped&&!this._pendingRestartTimer){if(this._restartCount>=this.maxRestartCount){this.log("ERROR",`max restart count reached session=${this.sessionId} restartCount=${this._restartCount} maxRestartCount=${this.maxRestartCount} -- no further auto-restart`),this.emit("exit",{sessionId:this.sessionId,code:1,signal:null,oldPid:s.oldPid!=null?s.oldPid:null,reason:"restarts-exhausted"});return}this._pendingRestartTimer=this.setTimeoutFn(()=>{this._pendingRestartTimer=null,!this._stopped&&this._spawnWatcher(e,n)},this.restartDelayMs)}}getState(){return{sessionId:this.sessionId,currentPid:this._currentPid,restartCount:this._restartCount,stopped:this._stopped,pendingRestart:!!this._pendingRestartTimer}}};function cv(t){return new pi(t).start()}function EI(t,{timeoutSeconds:e,intervalSeconds:n}={}){let s;try{s=cv({sessionId:t,timeoutSeconds:e,intervalSeconds:n})}catch(r){throw r.code==="WATCHER_ALREADY_RUNNING"&&(console.log("EXIT_REASON: 6 already-waiting \u2014 a supervised or bare watcher for this session is already running"),process.exit(6)),r}let o=()=>{s.stop(),console.log("EXIT_REASON: 0 stopped \u2014 externally stopped \u2014 do NOT auto re-arm"),process.exit(0)};process.on("SIGINT",o),process.on("SIGTERM",o),s.on("exit",({code:r,reason:i})=>{let a=r??0;i==="restarts-exhausted"&&console.log(`EXIT_REASON: ${a} restarts-exhausted \u2014 supervisor gave up after max restart count, do NOT auto re-arm without investigation`),process.exit(a)})}lv.exports={WatcherSupervisor:pi,startSupervisor:cv,runSupervisedWait:EI,makeLogger:av,DEFAULT_RESTART_DELAY_MS:ev,DEFAULT_STILLSTAND_TIMEOUT_MS:rv,DEFAULT_MAX_RESTART_COUNT:tv,MIN_RESTART_DELAY_MS:sv,MAX_RESTART_DELAY_MS:ov,WATCHER_DESIGNED_EXIT_CODES:nv,SUPERVISOR_LOG_PREFIX:iv}});var hv=D((a3,mv)=>{var Y=et(),{axios:en,PLANBEE_API_URL:qt}=mn(),{getEnv:DI}=Be(),SI=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,{waitForMessages:kI,DEFAULT_WAIT_TIMEOUT_S:pv}=$l(),{runSupervisedWait:AI}=uv();function Kn(t){return t.response?.data?.error?t.response.data.error:t.code==="ECONNREFUSED"?Y.t("inbox.serverUnreachable",{url:qt}):t.code==="ECONNRESET"?Y.t("inbox.connectionAborted"):t.message?t.message:Y.t("inbox.unknownError")}function di(t){let e=Date.now(),n=new Date(t).getTime(),s=e-n,o=Math.floor(s/6e4);if(o<1)return Y.t("inbox.justNow");if(o<60)return Y.t("inbox.timeAgoMinutes",{minutes:o});let r=Math.floor(o/60),i=o%60;return i>0?Y.t("inbox.timeAgoHoursMinutes",{hours:r,minutes:i}):Y.t("inbox.timeAgoHours",{hours:r})}function dv(t){return t.length<=250?t:`${t.substring(0,247)}...`}var fv=500;function Jn(t,e,n,s={}){return{command:t,sessionId:e,timestamp:new Date().toISOString(),data:n,meta:s}}function Rl(t){let e=t.metadata?typeof t.metadata=="string"?JSON.parse(t.metadata):t.metadata:{};return{replyExpected:e.replyExpected||!1,replyTo:e.replyTo||t.fromSessionId||null,instructions:e.instructions||null,noReplyNeeded:e.noReplyNeeded||!1}}function Nl(t){let{replyExpected:e,replyTo:n,instructions:s}=Rl(t),o=t.message?t.message.length:0,r=t.fromSessionId?"agent":"user";return{id:t.id,from:t.fromSessionId||null,fromType:r,status:t.status,priority:t.priority||"normal",createdAt:t.createdAt,age:di(t.createdAt),length:o,isLong:o>fv,preview:dv(t.message||""),replyExpected:e,replyTo:n,instructions:s}}function Il(t){let{replyExpected:e,replyTo:n,instructions:s}=Rl(t),o=t.message?t.message.length:0,r=t.fromSessionId?"agent":"user";return{id:t.id,from:t.fromSessionId||null,fromType:r,status:t.status,priority:t.priority||"normal",createdAt:t.createdAt,deliveredAt:t.deliveredAt||null,readByAgentAt:t.readByAgentAt||null,length:o,isLong:o>fv,replyExpected:e,replyTo:n,instructions:s,content:t.message||""}}async function _I(t,e){try{let n=await en.get(`${qt}/api/v1/messages/${t}`),{messages:s}=n.data,o=s.filter(a=>a.status==="queued"||a.status==="delivering").length,r=s.filter(a=>a.status==="delivered").length,i=s.filter(a=>a.status==="delivered"&&!a.readByAgentAt).length;e?console.log(JSON.stringify(Jn("inbox.summary",t,{queued:o,delivered:r,unread:i,total:s.length}),null,2)):(console.log(Y.t("inbox.header")),console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log(Y.t("inbox.queuedCount",{count:o})),console.log(Y.t("inbox.unreadDelivered",{count:i})),console.log(Y.t("inbox.deliveredCount",{count:r})),console.log(Y.t("inbox.total",{count:s.length})),(o>0||i>0)&&console.log(Y.t("inbox.listHint")))}catch(n){console.error(Y.t("inbox.fetchError",{error:Kn(n)})),process.exit(1)}}async function CI(t,e,n){try{let s=t.split(",").map(l=>l.trim()).filter(Boolean),o=await en.post(`${qt}/api/v1/messages/confirm`,{ids:s,sessionId:e}),{confirmed:r,messages:i}=o.data,a=i.map(l=>l.id),c=s.filter(l=>!a.includes(l));if(n){console.log(JSON.stringify(Jn("inbox.confirm",e,{confirmed:a,failed:c}),null,2));return}r===0?console.log("No messages confirmed (already confirmed or not found)"):(console.log(`Confirmed ${r} message(s) as read`),i.forEach(l=>{console.log(` - ${l.id}: ${l.preview}...`)}))}catch(s){console.error(Y.t("inbox.confirmError",{error:Kn(s)})),process.exit(1)}}async function OI(t){try{let e=await en.delete(`${qt}/api/v1/messages/${t}`),{deletedMessage:n}=e.data;console.log(Y.t("inbox.messageDeleted",{id:t})),n?.preview&&console.log(Y.t("inbox.messagePreview",{preview:n.preview}))}catch(e){e.response?.status===409?console.error(Y.t("inbox.messageNotQueued")):e.response?.status===404?console.error(Y.t("inbox.messageNotFound")):console.error(Y.t("inbox.deleteError",{error:Kn(e)})),process.exit(1)}}async function TI(t,e,n={}){try{let{status:s="pending",from:o,search:r}=n,i=new URLSearchParams;s&&i.set("status",s),o&&i.set("from",o),r&&i.set("search",r);let a=await en.get(`${qt}/api/v1/messages/${t}?${i.toString()}`),{messages:c}=a.data;if(e){let d=c.map(Nl);console.log(JSON.stringify(Jn("inbox.list",t,{messages:d},{total:c.length,filtered:d.length,filters:{status:s,from:o||null,search:r||null}}),null,2));return}let l=s==="all"?"All messages":`Messages [${s}]`,u=[];o&&u.push(`from: ${o.substring(0,8)}`),r&&u.push(`search: "${r}"`);let p=u.length?` | ${u.join(", ")}`:"";if(c.length===0){console.log(`No messages found (${l}${p}).`);return}console.log(`${l} (${c.length})${p}:`),console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");for(let d of c){let f=Nl(d),m=f.from?`${f.from} (agent)`:"User",h=f.priority!=="normal"?` [${f.priority.toUpperCase()}]`:"",g=d.readByAgentAt?"[read]":`[${f.status}]`;console.log(""),console.log(` ${g} ID: ${f.id}`),console.log(` From: ${m}${h} | ${f.age} | ${f.length} chars`),f.replyExpected&&(console.log(` *** REPLY REQUIRED *** \u2192 planbee send --to ${f.replyTo||f.from||"<sender>"} --message "..."`),f.instructions&&console.log(` Instructions: ${f.instructions}`)),console.log(` Preview: ${f.preview}`),f.isLong&&console.log(` LONG MESSAGE (${f.length} chars) \u2014 read full: planbee inbox --read ${f.id}`)}console.log(`
|
|
173
|
+
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),console.log(""),console.log(" planbee inbox --read <id> Read full message (always complete)"),console.log(" planbee inbox --list --all All messages (incl. delivered/read)"),console.log(" planbee inbox --list --from <id> Filter by sender"),console.log(" planbee inbox --list --search <keyword> Search message content"),console.log(" planbee inbox --list --status delivered Only delivered messages")}catch(s){console.error(Y.t("inbox.listFetchError",{error:Kn(s)})),process.exit(1)}}async function PI(t,e){try{let n=await en.get(`${qt}/api/v1/messages/message/${t}`),{message:s}=n.data;if(e){let o=Il(s);console.log(JSON.stringify(Jn("inbox.read",s.toSessionId||null,{message:o}),null,2))}else{let o=s.fromSessionId?`${s.fromSessionId} (agent)`:"User",r=di(s.createdAt),{replyExpected:i,replyTo:a,instructions:c}=Rl(s),l=s.message?s.message.length:0;if(console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log(` ID: ${s.id}`),console.log(` From: ${o}`),console.log(` Priority: ${s.priority||"normal"}`),console.log(` Status: ${s.status}`),console.log(` Sent: ${r} | ${l} chars`),i&&console.log(" *** REPLY REQUIRED ***"),console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log(`
|
|
174
|
+
Message:`),console.log(s.message),console.log(`
|
|
175
|
+
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),i){let u=a||s.fromSessionId||"<sender>";console.log(`REPLY REQUIRED: Respond with: planbee send --to ${u} --message "..."`),c&&console.log(`Instructions: ${c}`),console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}console.log(`<current_datetime>${new Date().toISOString()}</current_datetime>`)}if(s.status==="queued"||s.status==="delivered"){let o=await en.post(`${qt}/api/v1/messages/${t}/mark-read`);!e&&!o.data.alreadyRead&&console.log(`
|
|
176
|
+
Marked as read.`)}}catch(n){console.error(Y.t("inbox.readError",{error:Kn(n)})),process.exit(1)}}async function $I(t,e){try{let n=await en.get(`${qt}/api/v1/messages/${t}?status=queued`),{messages:s}=n.data;if(s.length===0){console.log(e?JSON.stringify(Jn("inbox.read-all",t,{messages:[]},{total:0}),null,2):"No pending messages.");return}if(e){let o=s.map(Il);console.log(JSON.stringify(Jn("inbox.read-all",t,{messages:o},{total:o.length}),null,2))}else{console.log(`${s.length} pending message(s):
|
|
177
|
+
`);for(let o=0;o<s.length;o++){let r=s[o],i=Il(r),a=i.from?`${i.from} (agent)`:"User";if(console.log(`
|
|
178
|
+
[${o+1}/${s.length}] \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),console.log(` ID: ${r.id}`),console.log(` From: ${a}`),console.log(` Priority: ${r.priority||"normal"}`),console.log(` Sent: ${di(r.createdAt)} | ${i.length} chars`),i.replyExpected&&console.log(" *** REPLY REQUIRED ***"),console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log(r.message),i.replyExpected){let c=i.replyTo||i.from||"<sender>";console.log(`
|
|
179
|
+
REPLY REQUIRED: planbee send --to ${c} --message "..."`),i.instructions&&console.log(`Instructions: ${i.instructions}`)}}console.log(`
|
|
180
|
+
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),console.log(`
|
|
181
|
+
All ${s.length} message(s) displayed.`)}for(let o of s)await en.post(`${qt}/api/v1/messages/${o.id}/mark-read`);e||console.log("All messages marked as read.")}catch(n){console.error(Y.t("inbox.readAllError",{error:Kn(n)})),process.exit(1)}}async function NI(t,e){try{let n=await en.get(`${qt}/api/v1/messages/${t}?status=system`),{messages:s}=n.data;if(e){let o=s.map(Nl);console.log(JSON.stringify(Jn("inbox.list",t,{messages:o},{total:o.length,filtered:o.length,filters:{status:"system",from:null,search:null}}),null,2));return}if(s.length===0){console.log(Y.t("inbox.noSystemMessages"));return}console.log(Y.t("inbox.systemMessages",{count:s.length})),console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");for(let o of s){let r=o.fromSessionId?`${o.fromSessionId} (self)`:"System",i=di(o.createdAt),a=dv(o.message);console.log(`
|
|
182
|
+
ID: ${o.id}`),console.log(Y.t("inbox.from",{label:r})),console.log(Y.t("inbox.age",{age:i})),console.log(Y.t("inbox.preview",{preview:a}))}console.log(`
|
|
183
|
+
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),console.log(Y.t("inbox.systemMessageNote"))}catch(n){console.error(Y.t("inbox.systemFetchError",{error:Kn(n)})),process.exit(1)}}async function II(t){let{list:e,read:n,readAll:s,system:o,json:r,confirm:i,watch:a,wait:c,waitSupervised:l,interval:u,timeout:p,delete:d,all:f,from:m,search:h,status:g}=t,b=t.session||DI("PLANBEE_SESSION_ID");b||(console.error(Y.t("inbox.sessionNotFound")),console.error(""),console.error(Y.t("inbox.sessionEnvHint")),console.error(Y.t("inbox.sessionEnvExample1")),console.error(Y.t("inbox.sessionEnvExample2")),process.exit(1)),d?await OI(d):i?await CI(i,b,r):c||a||l?(SI.test(b)||(console.error(Y.t("inbox.waitSessionInvalid",{value:b})),console.error(Y.t("inbox.sessionEnvHint")),console.error(" planbee inbox --wait --session <session-uuid>"),process.exit(1)),l?AI(b,{intervalSeconds:u||5,timeoutSeconds:p||pv}):(a&&console.error(Y.t("inbox.watchDeprecated")),await kI(b,{interval:u||5,timeout:p||pv}))):o?await NI(b,r):e?await TI(b,r,{status:f?"all":g||"pending",from:m,search:h}):n?await PI(n,r):s?await $I(b,r):await _I(b,r)}mv.exports={command:"inbox",describe:Y.t("inbox.describe"),builder:t=>t.option("session",{alias:"S",type:"string",description:Y.t("inbox.optSession")}).option("list",{alias:"l",type:"boolean",description:Y.t("inbox.optList")}).option("all",{type:"boolean",description:"With --list: show all messages (queued + delivered + read)"}).option("status",{type:"string",description:"With --list: filter by status (queued, delivered, read, all)"}).option("from",{type:"string",description:"With --list: filter by sender session ID"}).option("search",{type:"string",description:"With --list: search message content (case-insensitive)"}).option("read",{alias:"r",type:"string",description:Y.t("inbox.optRead")}).option("read-all",{type:"boolean",description:Y.t("inbox.optReadAll")}).option("confirm",{alias:"c",type:"string",description:Y.t("inbox.optConfirm")}).option("delete",{alias:"d",type:"string",description:Y.t("inbox.optDelete")}).option("wait",{alias:"W",type:"boolean",description:Y.t("inbox.optWait")}).option("wait-supervised",{type:"boolean",description:Y.t("inbox.optWaitSupervised")}).option("watch",{alias:"w",type:"boolean",description:Y.t("inbox.optWatch")}).option("interval",{type:"number",description:Y.t("inbox.optInterval")}).option("timeout",{type:"number",description:Y.t("inbox.optTimeout")}).option("system",{alias:"s",type:"boolean",description:Y.t("inbox.optSystem")}).option("json",{type:"boolean",description:Y.t("inbox.optJson")}).example("planbee inbox",Y.t("inbox.exSummary")).example("planbee inbox --list",Y.t("inbox.exList")).example("planbee inbox --list --all","List all messages (incl. delivered/read)").example("planbee inbox --list --from <id>","Filter by sender").example("planbee inbox --list --search <kw>","Search message content").example("planbee inbox --list --status delivered","Only delivered messages").example("planbee inbox --read <id>",Y.t("inbox.exRead")).example("planbee inbox --read-all",Y.t("inbox.exReadAll")).example("planbee inbox --confirm <id>",Y.t("inbox.exConfirm")).example("planbee inbox --confirm <id1>,<id2>",Y.t("inbox.exConfirmMulti")).example("planbee inbox --list --json","JSON output (envelope format)").example("planbee inbox --wait",Y.t("inbox.exWait")).example("planbee inbox --wait --timeout 14400",Y.t("inbox.exWaitTimeout")).example("planbee inbox --wait-supervised",Y.t("inbox.exWaitSupervised")).example("planbee inbox --system",Y.t("inbox.exSystem")),handler:II}});var wv=D((c3,vv)=>{var{axios:bv,PLANBEE_API_URL:xv}=mn(),Ye=et(),{getEnv:RI}=Be(),FI=qn(),{rearmCommand:gv,DEFAULT_WAIT_TIMEOUT_S:jI}=$l(),{WATCH_HEARTBEAT_ALIVE_MS:Fl}=$o();function LI(t){return t.response?.data?.error||t.message}async function yv(t,e,{timeout:n,interval:s}){let o={watchMode:e};e&&(o.watchTimeout=n,o.watchInterval=s),await bv.patch(`${xv}/api/v1/agents/${t}/watch-mode`,o,{timeout:1e4})}async function BI(t){return(await bv.get(`${xv}/api/v1/sessions/${t}`,{timeout:1e4})).data?.session||null}async function qI(t){let{action:e,json:n}=t,s=t.session||RI("PLANBEE_SESSION_ID");s||(console.error(Ye.t("remoteControl.sessionRequired")),process.exit(1));let o=t.timeout||jI,r=t.interval||5;try{if(e==="on"){await yv(s,!0,{timeout:o,interval:r});let i=gv(s,o);if(n){console.log(JSON.stringify({success:!0,sessionId:s,remoteControl:!0,armCommand:i},null,2));return}console.log(Ye.agent("remoteControl.enabled")),console.log(""),console.log(Ye.agent("remoteControl.armHint")),console.log(` ${i}`),console.log(""),console.log(Ye.agent("remoteControl.enforcementNote"))}else if(e==="off"){if(await yv(s,!1,{}),n){console.log(JSON.stringify({success:!0,sessionId:s,remoteControl:!1},null,2));return}console.log(Ye.agent("remoteControl.disabled"))}else{let i=await BI(s);i||(console.error(Ye.t("remoteControl.sessionNotFound")),process.exit(1));let a=FI.isWatcherAlive(s),c=i.inboxWatchHeartbeatAt||null,l=null,u=null,p=null;if(c){let d=Date.now()-new Date(c).getTime();l=Math.floor(d/1e3);let f=Math.max(0,Fl-d);u=Math.floor(f/1e3),p=l*1e3<Fl?"live":"stale"}else i.isWatchingInbox&&(p="no-heartbeat");if(n){console.log(JSON.stringify({success:!0,sessionId:s,remoteControl:!!i.watchMode,watchTimeout:i.watchTimeout||null,isWatchingInbox:!!i.isWatchingInbox,inboxWatchHeartbeatAt:c,watcherProcessAlive:a,heartbeatAgeSeconds:l,autoReleaseInSeconds:u,claimState:p},null,2));return}console.log(Ye.agent("remoteControl.statusHeader")),console.log(` Remote-Control: ${i.watchMode?"ON":"OFF"}`),console.log(` Watcher-Prozess (lokal): ${a?"ALIVE":"\u2014"}`),console.log(` is_watching_inbox: ${i.isWatchingInbox?"true":"false"}`),l!==null?(console.log(` Heartbeat-Alter: ${l}s`),u>0?console.log(` Auto-Freigabe in: ${u}s (Heartbeat-TTL ${Math.floor(Fl/1e3)}s)`):console.log(" Auto-Freigabe: Heartbeat-TTL abgelaufen, naechster Watcher DIESER Session gewinnt (andere Sessions sind nicht betroffen)"),p==="stale"&&!a?console.log(" Diagnose: stale Flag ohne lebenden Watcher \u2014 Re-Arm ohne Toggle sicher"):p==="live"&&!a&&console.log(" Diagnose: frischer Heartbeat aber kein lokaler Prozess \u2014 Remote-Watcher? Stale nach TTL.")):i.isWatchingInbox?console.log(" Heartbeat: nie gesetzt (kein Watcher hat je gebeatet)"):console.log(" Heartbeat: \u2014"),i.watchMode&&!a&&(console.log(""),console.log(Ye.agent("remoteControl.watcherMissing")),console.log(` ${gv(s,i.watchTimeout||o)}`))}}catch(i){console.error(Ye.t("remoteControl.error",{error:LI(i)})),process.exit(1)}}vv.exports={command:"remote-control <action>",describe:Ye.t("remoteControl.describe"),builder:t=>t.positional("action",{type:"string",choices:["on","off","status"],description:Ye.t("remoteControl.optAction")}).option("session",{alias:"S",type:"string",description:Ye.t("remoteControl.optSession")}).option("timeout",{type:"number",description:Ye.t("remoteControl.optTimeout")}).option("interval",{type:"number",description:Ye.t("remoteControl.optInterval")}).option("json",{type:"boolean",description:Ye.t("remoteControl.optJson")}).example("planbee remote-control on",Ye.t("remoteControl.exOn")).example("planbee remote-control off",Ye.t("remoteControl.exOff")).example("planbee remote-control status --json",Ye.t("remoteControl.exStatus")),handler:qI}});var Av=D((l3,kv)=>{var Ev=de(),{resolveApiUrl:MI}=te(),ct=et(),Dv=MI();function jl(t){return t?new Date(t).toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit",second:"2-digit"}):null}function Sv(t,e){if(!t||!e)return null;let n=new Date(e).getTime()-new Date(t).getTime();return n<1e3?`${n}ms`:n<6e4?ct.t("messageStatus.durationSeconds",{seconds:Math.round(n/1e3)}):ct.t("messageStatus.durationMinutes",{minutes:Math.round(n/6e4)})}async function UI(t){let{id:e,json:n}=t;e||(console.error(ct.t("messageStatus.idRequired")),process.exit(1));try{let o=(await Ev.get(`${Dv}/api/v1/messages/message/${e}`)).data.message,r=null;if(o.toSessionId||o.to_session_id){let i=o.toSessionId||o.to_session_id;try{let a=await Ev.get(`${Dv}/api/v1/sessions/${i}`);r=a.data.session||a.data}catch{}}if(n)console.log(JSON.stringify({message:o,targetAgent:r},null,2));else{let i=o.createdAt||o.created_at,a=o.deliveredAt||o.delivered_at,c=o.readByAgentAt||o.read_by_agent_at;if(console.log(ct.t("messageStatus.header")),console.log(` ID: ${o.id}`),console.log(` Status: ${o.status}`),console.log(ct.t("messageStatus.priority",{value:o.priority||"normal"})),console.log(ct.t("messageStatus.sent",{time:jl(i)})),console.log(a?ct.t("messageStatus.delivered",{time:jl(a),duration:Sv(i,a)}):ct.t("messageStatus.deliveredPending")),console.log(c?ct.t("messageStatus.readConfirmation",{time:jl(c),duration:Sv(i,c)}):ct.t("messageStatus.readPending")),r){console.log(ct.t("messageStatus.targetAgentHeader"));let l=r.agentType||r.agent_type,u=r.currentTask||r.current_task,p=r.completionPercent||r.completion_percent;console.log(` Status: ${r.status}${l?` \xB7 ${l}`:""}`),u&&console.log(p?ct.t("messageStatus.taskWithPercent",{task:u,percent:p}):ct.t("messageStatus.task",{task:u}))}}process.exit(0)}catch(s){s.response?.status===404?console.error(ct.t("messageStatus.notFound",{id:e})):s.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${s.message}`),process.exit(1)}}kv.exports={command:"message-status <id>",describe:"Show delivery and read confirmation status for a message",builder:t=>t.positional("id",{describe:"Message UUID",type:"string"}).option("json",{alias:"j",type:"boolean",describe:"Output as JSON",default:!1}),handler:UI}});var Cv=D((u3,_v)=>{var Mt=de(),{resolveApiUrl:HI}=te(),{getEnv:fi}=Be(),Ut=HI();async function zI(t){let{key:e,value:n,namespace:s,json:o,expectedVersion:r,checksum:i,forceOverwrite:a}=t,c=fi("PLANBEE_SESSION_ID")||null;e||(console.error("Error: --key is required"),process.exit(1)),n||(console.error("Error: --value is required"),process.exit(1));try{let l;try{l=JSON.parse(n)}catch{l=n}let u=await Mt.post(`${Ut}/api/v1/memory/store`,{sessionId:c,key:e,value:l,metadata:{namespace:s||"default",expiresAt:t.expiresAt||null},expectedVersion:r!==void 0?Number(r):void 0,checksum:i||void 0,forceOverwrite:a||void 0}),{memory:p}=u.data;o?console.log(JSON.stringify(u.data,null,2)):(console.log("[OK] Memory stored successfully"),console.log(`Namespace: ${s||"default"}`),console.log(`Key: ${e}`),p&&p.version!==void 0&&console.log(`Version: ${p.version}`),p&&p.noOp&&console.log("No-Op: value unchanged, version was NOT incremented (AC 8)"),p&&p.warning&&console.log(`WARNING: ${p.warning}`)),process.exit(0)}catch(l){l.response?console.error(`Error: ${l.response.data.error||l.message}`):l.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${l.message}`),process.exit(1)}}async function WI(t){let{namespace:e,key:n,json:s}=t;e||(console.error("Error: --namespace is required"),process.exit(1)),n||(console.error("Error: --key is required"),process.exit(1));try{let o=encodeURIComponent(e),r=encodeURIComponent(n),i=await Mt.get(`${Ut}/api/v1/memory/${o}/${r}`,{headers:fi("PLANBEE_SESSION_ID")?{"X-PlanBee-Session-Id":fi("PLANBEE_SESSION_ID")}:{}});if(s)console.log(JSON.stringify(i.data,null,2));else{let{memory:a}=i.data;console.log(`Namespace: ${a.namespace}`),console.log(`Key: ${a.key}`),console.log(`Version: ${a.version||1}`),console.log(`Checksum: ${a.checksum||""}`),console.log(`Value: ${JSON.stringify(a.value,null,2)}`),console.log(`Access Count: ${a.accessCount||0}`),a.expiresAt&&console.log(`Expires: ${new Date(a.expiresAt).toLocaleString()}`),console.log(`Updated: ${new Date(a.updatedAt).toLocaleString()}`)}process.exitCode=0}catch(o){o.response&&o.response.status===404?console.error(`Memory not found: ${e}/${n}`):o.response?console.error(`Error: ${o.response.data.error||o.message}`):o.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${o.message}`),process.exitCode=1}}async function JI(t){let{namespace:e,json:n}=t;e||(console.error("Error: --namespace is required"),process.exit(1));try{let s=encodeURIComponent(e),o=await Mt.get(`${Ut}/api/v1/memory/list/${s}`);if(n)console.log(JSON.stringify(o.data,null,2));else{let{memories:r,total:i}=o.data;if(i===0){console.log(`No memories found in namespace: ${e}`),process.exitCode=0;return}console.log(`Found ${i} memory entries in ${e}:
|
|
184
|
+
`),console.log("KEY | VALUE | VER | ACCESSED | UPDATED"),console.log("\u2500".repeat(100));for(let a of r){let c=a.key.substring(0,25).padEnd(25),l=a.valueTruncated.substring(0,25).padEnd(25),u=String(a.version||1).padEnd(3),p=String(a.accessCount||0).padEnd(8),d=new Date(a.updatedAt).toLocaleString();console.log(`${c} | ${l} | ${u} | ${p} | ${d}`)}}process.exitCode=0}catch(s){s.response?console.error(`Error: ${s.response.data.error||s.message}`):s.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${s.message}`),process.exitCode=1}}async function KI(t){let{namespace:e,key:n,bulk:s,cascade:o,json:r,force:i}=t;e||(console.error("Error: --namespace is required"),process.exit(1));try{let a=encodeURIComponent(e);if(s||o||!n){if(!i){let f=require("readline").createInterface({input:process.stdin,output:process.stdout}),m=o?"CASCADE delete":"BULK delete",h=o?`This will delete ALL memories in namespace '${e}' and all child namespaces.`:`This will delete ALL memories in namespace '${e}'.`;console.log(`
|
|
185
|
+
WARNING: ${m}`),console.log(h),console.log(`This operation cannot be undone.
|
|
186
|
+
`),await new Promise(g=>{f.question("Are you sure you want to continue? (yes/no): ",b=>{f.close(),b.toLowerCase()!=="yes"&&(console.log("Operation cancelled"),process.exit(0)),g()})})}let u=o?"?cascade=true":"",p=await Mt.delete(`${Ut}/api/v1/memory/${a}${u}`);if(r)console.log(JSON.stringify(p.data,null,2));else{let{deletedCount:d,namespaces:f}=p.data;if(o){console.log("[OK] Cascade delete completed"),console.log(`Deleted ${d} memories across ${Object.keys(f).length} namespaces:`);for(let[m,h]of Object.entries(f))console.log(` ${m}: ${h.length} memories`)}else console.log("[OK] Bulk delete completed"),console.log(`Deleted ${d} memories from namespace: ${e}`)}process.exit(0)}let c=encodeURIComponent(n),l=await Mt.delete(`${Ut}/api/v1/memory/${a}/${c}`);if(r)console.log(JSON.stringify(l.data,null,2));else{let{deletedCount:u}=l.data;u>0?(console.log("[OK] Memory deleted successfully"),console.log(`Namespace: ${e}`),console.log(`Key: ${n}`)):(console.log("Memory not found (already deleted or never existed)"),console.log(`Namespace: ${e}`),console.log(`Key: ${n}`))}process.exit(0)}catch(a){a.response?console.error(`Error: ${a.response.data.error||a.message}`):a.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${a.message}`),process.exit(1)}}async function GI(t){let{namespace:e,key:n,json:s,limit:o,offset:r}=t;e||(console.error("Error: --namespace is required"),process.exit(1)),n||(console.error("Error: --key is required"),process.exit(1));try{let i=encodeURIComponent(e),a=encodeURIComponent(n),c=new URLSearchParams;o&&c.append("limit",o),r&&c.append("offset",r);let l=await Mt.get(`${Ut}/api/v1/memory/history/${i}/${a}?${c}`);if(s)console.log(JSON.stringify(l.data,null,2));else{let{currentVersion:u,totalVersions:p,versions:d}=l.data;if(console.log(`Memory: ${e}/${n}`),console.log(`Current Version: ${u}`),console.log(`Stored Snapshots (excl. current): ${p}
|
|
187
|
+
`),d.length===0)console.log("No version history available (never modified)");else{console.log("VERSION | CHANGED BY | CHANGED AT"),console.log("\u2500".repeat(80));for(let f of d){let m=String(f.versionNumber).padEnd(7),h=(f.agentType||"unknown").substring(0,20).padEnd(20),g=new Date(f.changedAt).toLocaleString();console.log(`${m} | ${h} | ${g}`)}}}process.exitCode=0}catch(i){i.response&&i.response.status===404?console.error(`Memory not found: ${e}/${n}`):i.response?console.error(`Error: ${i.response.data.error||i.message}`):i.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${i.message}`),process.exitCode=1}}async function VI(t){let{namespace:e,key:n,versionA:s,versionB:o,json:r}=t;e||(console.error("Error: --namespace is required"),process.exit(1)),n||(console.error("Error: --key is required"),process.exit(1)),s||(console.error("Error: --version-a is required"),process.exit(1));try{let i=encodeURIComponent(e),a=encodeURIComponent(n),c=new URLSearchParams;c.append("versionA",s),o&&c.append("versionB",o);let l=await Mt.get(`${Ut}/api/v1/memory/diff/${i}/${a}?${c}`);if(r)console.log(JSON.stringify(l.data,null,2));else{let{versionA:u,versionB:p,diff:d}=l.data;if(console.log(`Memory: ${e}/${n}`),console.log(`Comparing Version ${u} \u2192 Version ${p}
|
|
188
|
+
`),d.length===0)console.log("No differences found");else for(let f of d)f.type==="removed"?console.log(`- ${f.line}`):f.type==="added"?console.log(`+ ${f.line}`):console.log(` ${f.line}`)}process.exitCode=0}catch(i){i.response&&i.response.status===404?console.error(`Error: ${i.response.data.error||"Memory or version not found"}`):i.response?console.error(`Error: ${i.response.data.error||i.message}`):i.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${i.message}`),process.exitCode=1}}_v.exports={store:{command:"store",describe:"Store memory value",builder:t=>t.option("key",{type:"string",description:"Memory key",demandOption:!0}).option("value",{type:"string",description:"Memory value (JSON string or plain text)",demandOption:!0}).option("namespace",{type:"string",description:"Memory namespace",default:"default"}).option("expires-at",{type:"string",description:"Optional expiry date (ISO8601, e.g. 2026-12-31)"}).option("expected-version",{type:"number",description:"Optimistic-locking guard (AC 1-3): version last read via `memory get`. Required to update an existing key without a warning (Phase A); ignored for a brand-new key. Mismatch -> HTTP 409, re-read and retry."}).option("checksum",{type:"string",description:"Optional checksum from a prior `memory get` (AC 5/6), verified server-side against the currently locked row alongside --expected-version."}).option("force-overwrite",{type:"boolean",description:"Explicit, audited bypass of the version check (AC 3, story-memory-optimistic-lock-phase-b) -- overwrites an existing key regardless of --expected-version or hard-mode. NOT the same as omitting --expected-version; use only for deliberate repairs/bulk-overwrites.",default:!1}).option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:zI},get:{command:"get",describe:"Retrieve memory value",builder:t=>t.option("namespace",{type:"string",description:"Memory namespace",demandOption:!0}).option("key",{type:"string",description:"Memory key",demandOption:!0}).option("json",{type:"boolean",description:"Output JSON. Recommended (though not enforced -- AC 9 fixes the underlying pipe-truncation for both modes) for a store -> get -> store version-lock cycle, since it hands you --expected-version/--checksum as structured fields instead of text you would otherwise have to parse.",default:!1}),handler:WI},list:{command:"list",describe:"List memories in namespace",builder:t=>t.option("namespace",{type:"string",description:"Memory namespace (supports /* wildcard)",demandOption:!0}).option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:JI},delete:{command:"delete",describe:"Delete memory value(s)",builder:t=>t.option("namespace",{type:"string",description:"Memory namespace",demandOption:!0}).option("key",{type:"string",description:"Memory key (optional for bulk delete)",demandOption:!1}).option("bulk",{type:"boolean",description:"Delete all memories in namespace (Story 4.3)",default:!1}).option("cascade",{type:"boolean",description:"Delete namespace and all child namespaces (Story 4.3)",default:!1}).option("force",{type:"boolean",description:"Skip confirmation prompt for bulk/cascade delete",default:!1}).option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:KI},export:{command:"export",describe:"Export memories from namespace to JSON file (AC 4.5.6)",builder:t=>t.option("namespace",{type:"string",description:"Memory namespace to export",demandOption:!0}).option("output",{type:"string",description:"Output file path",demandOption:!0}).option("json",{type:"boolean",description:"Output JSON response",default:!1}),handler:YI},import:{command:"import",describe:"Import memories from JSON file to namespace (AC 4.5.7)",builder:t=>t.option("input",{type:"string",description:"Input file path",demandOption:!0}).option("namespace",{type:"string",description:"Target namespace",demandOption:!0}).option("session",{type:"string",description:"Session ID (optional)",demandOption:!1}).option("json",{type:"boolean",description:"Output JSON response",default:!1}),handler:XI},cleanup:{command:"cleanup",describe:"Cleanup old memories (AC 4.5.8)",builder:t=>t.option("max-age",{type:"number",description:"Maximum age in days (default 30)",default:30}).option("dry-run",{type:"boolean",description:"Preview without actual deletion",default:!1}).option("json",{type:"boolean",description:"Output JSON response",default:!1}),handler:QI},history:{command:"history",describe:"Get version history for a memory entry",builder:t=>t.option("namespace",{type:"string",description:"Memory namespace",demandOption:!0}).option("key",{type:"string",description:"Memory key",demandOption:!0}).option("limit",{type:"number",description:"Maximum number of versions to display",default:50}).option("offset",{type:"number",description:"Pagination offset",default:0}).option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:GI},diff:{command:"diff",describe:"Compare two versions of a memory entry",builder:t=>t.option("namespace",{type:"string",description:"Memory namespace",demandOption:!0}).option("key",{type:"string",description:"Memory key",demandOption:!0}).option("version-a",{type:"string",description:'First version number (or "current")',demandOption:!0}).option("version-b",{type:"string",description:'Second version number (or "current", default: current)',default:"current"}).option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:VI}};async function YI(t){let{namespace:e,output:n,json:s}=t;try{let o=await Mt.get(`${Ut}/api/v1/memory/export/${encodeURIComponent(e)}`,{timeout:6e4,responseType:"json"});await require("fs").promises.writeFile(n,JSON.stringify(o.data,null,2),"utf8"),s?console.log(JSON.stringify({success:!0,outputPath:n,count:o.data.count},null,2)):(console.log("Memory export completed successfully"),console.log(`Namespace: ${e}`),console.log(`Output file: ${n}`),console.log(`Exported: ${o.data.count} memories`)),process.exit(0)}catch(o){o.response?console.error(`Error: ${o.response.data.error||o.message}`):o.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):o.code==="EACCES"||o.code==="ENOENT"?console.error(`Error: Cannot write to output file: ${n}`):console.error(`Error: ${o.message}`),process.exit(1)}}async function XI(t){let{input:e,namespace:n,session:s,json:o}=t;try{let i=await require("fs").promises.readFile(e,"utf8"),a=JSON.parse(i);(!a.memories||!Array.isArray(a.memories))&&(console.error("Error: Invalid import file format: missing 'memories' array"),process.exit(1));let c=s||fi("PLANBEE_SESSION_ID")||null,l=0,u=0;for(let p of a.memories)try{await Mt.post(`${Ut}/api/v1/memory/store`,{sessionId:c,key:p.key,value:p.value,metadata:{namespace:n}}),l++}catch(d){console.warn(`Warning: Failed to import memory '${p.key}': ${d.message}`),u++}o?console.log(JSON.stringify({success:!0,imported:l,skipped:u,message:`Imported ${l} memories into namespace '${n}'`},null,2)):(console.log("Memory import completed successfully"),console.log(`Input file: ${e}`),console.log(`Target namespace: ${n}`),console.log(`Imported: ${l} memories`),u>0&&console.log(`Skipped: ${u} memories (see warnings above)`)),process.exit(0)}catch(r){r.code==="ENOENT"?console.error(`Error: Input file not found: ${e}`):r instanceof SyntaxError?console.error(`Error: Invalid JSON in input file: ${r.message}`):r.response?console.error(`Error: ${r.response.data.error||r.message}`):r.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${r.message}`),process.exit(1)}}async function QI(t){let{maxAge:e,dryRun:n,json:s}=t;try{let o=await Mt.post(`${Ut}/api/v1/memory/cleanup`,{maxAgeDays:e,dryRun:n});if(s)console.log(JSON.stringify(o.data,null,2));else{let{count:r,message:i}=o.data;console.log(n?"Dry run - preview of cleanup operation:":"Memory cleanup completed successfully"),console.log(i),r>0&&n&&console.log(`
|
|
189
|
+
To perform actual cleanup, run without --dry-run flag.`)}process.exit(0)}catch(o){o.response?console.error(`Error: ${o.response.data.error||o.message}`):o.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${o.message}`),process.exit(1)}}});var Pv=D((p3,Tv)=>{var Ll=de(),{resolveApiUrl:ZI}=te(),{getEnv:eR}=Be(),Bl=ZI(),ql=3e5,Ov=5e3;async function tR(t){let{forAgent:e,event:n,timeout:s,json:o}=t,r=eR("PLANBEE_SESSION_ID");r||(console.error("Error: PLANBEE_SESSION_ID environment variable not set"),console.error("This command must be run from within a PlanBee agent session"),process.exit(1)),e||(console.error("Error: --for-agent is required"),process.exit(1)),n||(console.error("Error: --event is required"),process.exit(1));let i=s||ql,a=Date.now();o||(console.log(`Waiting for ${n} event from agent ${e}...`),console.log(`Timeout: ${i}ms`));try{for(;Date.now()-a<i;){let l=(await Ll.get(`${Bl}/api/v1/messages/poll/${r}`,{params:{eventTypes:n}})).data.events.filter(u=>u.fromSessionId===e&&u.eventType===n);if(l.length>0){let u=l[0];await Ll.post(`${Bl}/api/v1/messages/${u.eventId}/read`),o?console.log(JSON.stringify(u,null,2)):(console.log("[OK] Event received!"),console.log(`Event ID: ${u.eventId}`),console.log(`From: ${u.fromSessionId}`),console.log(`Type: ${u.eventType}`),console.log(`Content: ${JSON.stringify(u.content,null,2)}`)),process.exit(0)}await new Promise(u=>setTimeout(u,Ov))}console.error(`Error: Timeout waiting for event after ${i}ms`),process.exit(1)}catch(c){c.response?console.error(`Error: ${c.response.data.error||c.message}`):c.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${c.message}`),process.exit(1)}}async function nR(t){let{namespace:e,key:n,timeout:s,json:o}=t;e||(console.error("Error: --namespace is required"),process.exit(1)),n||(console.error("Error: --key is required"),process.exit(1));let r=s||ql,i=Date.now();o||(console.log(`Waiting for memory ${e}/${n}...`),console.log(`Timeout: ${r}ms`));try{for(;Date.now()-i<r;){try{let a=await Ll.get(`${Bl}/api/v1/memory/${e}/${n}`);if(a.data.success){let{memory:c}=a.data;o?console.log(JSON.stringify(c,null,2)):(console.log("[OK] Memory found!"),console.log(`Namespace: ${c.namespace}`),console.log(`Key: ${c.key}`),console.log(`Value: ${JSON.stringify(c.value,null,2)}`)),process.exit(0)}}catch(a){if(!(a.response&&a.response.status===404))throw a}await new Promise(a=>setTimeout(a,Ov))}console.error(`Error: Timeout waiting for memory after ${r}ms`),process.exit(1)}catch(a){a.response?console.error(`Error: ${a.response.data.error||a.message}`):a.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${a.message}`),process.exit(1)}}Tv.exports={agent:{command:"wait",describe:"Wait for event from agent or memory to appear",builder:t=>t.option("for-agent",{type:"string",description:"Wait for event from specific agent session"}).option("for-memory",{type:"boolean",description:"Wait for memory to appear",default:!1}).option("event",{type:"string",description:"Event type to wait for (required with --for-agent)"}).option("namespace",{type:"string",description:"Memory namespace (required with --for-memory)"}).option("key",{type:"string",description:"Memory key (required with --for-memory)"}).option("timeout",{type:"number",description:"Timeout in milliseconds",default:ql}).option("json",{type:"boolean",description:"Output JSON",default:!1}).check(e=>{if(e.forAgent&&!e.event)throw new Error("--event is required when using --for-agent");if(e.forMemory&&(!e.namespace||!e.key))throw new Error("--namespace and --key are required when using --for-memory");if(!e.forAgent&&!e.forMemory)throw new Error("Either --for-agent or --for-memory must be specified");return!0}),handler:t=>t.forMemory?nR(t):tR(t)}}});var lt=D((d3,Fv)=>{var $v=de(),{resolveApiUrl:Nv,getProfile:Iv}=te(),mi=et();function sR(t){let e=(()=>{try{return Iv(t)}catch{return{mode:"cloud",authRequired:!0}}})(),n=$v.create({baseURL:Nv(t),timeout:e.mode==="cloud"?1e4:5e3});return n.interceptors.request.use(s=>{if(e.authRequired){let o=null;try{o=it().getToken()}catch{o=null}o||(o=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN),o&&(s.headers=s.headers||{},s.headers.Authorization=`Bearer ${o}`)}return s}),n.interceptors.response.use(s=>s,s=>(s.response?.status===401&&(process.stderr.write(mi.t("cliApiClient.sessionExpired")),process.exit(1)),Promise.reject(s))),n}function oR(t){try{let e=Iv();return e.mode==="cloud"?mi.t("cliApiClient.cloudUnreachable"):mi.t("cliApiClient.localUnreachable",{url:t||e.apiUrl})}catch{return mi.t("cliApiClient.genericUnreachable")}}async function Rv(){let t=null;try{t=it().getToken()}catch{t=null}return t||(t=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN),t||null}async function rR(t){let e=await Rv();if(!e)return null;let n=$v.create({baseURL:Nv(t),timeout:8e3});return n.defaults.headers.common=n.defaults.headers.common||{},n.defaults.headers.common.Authorization=`Bearer ${e}`,n}Fv.exports={createApiClient:sR,createRawApiClient:rR,resolveCliToken:Rv,getConnectionErrorMessage:oR}});var Bv=D((f3,Lv)=>{var{getEnv:Ml}=Be(),{createApiClient:Ul}=lt();async function iR(t){let{session:e,json:n}=t,s=e||Ml("PLANBEE_SESSION_ID");s||(console.error("Error: --session is required or PLANBEE_SESSION_ID must be set"),process.exit(1));let o=Ul(t);try{let[r,i]=await Promise.all([o.get(`/api/v1/sessions/${s}`),o.get(`/api/v1/agents/${s}/status`)]),a=r.data.session,c=i.data.status;n?console.log(JSON.stringify({session:a,agent:c},null,2)):(console.log("Session Status:"),console.log(` ID: ${a.id}`),console.log(` Agent Type: ${a.agentType}`),console.log(` Status: ${a.status}`),console.log(` Folder: ${a.folder}`),console.log(` Task: ${a.task}`),a.parentId&&console.log(` Parent: ${a.parentId}`),console.log(` Children: ${a.childrenCount}`),console.log(""),console.log("Agent Details:"),console.log(` Process ID: ${c.processId||"N/A"}`),console.log(` Uptime: ${c.uptimeSeconds}s`),console.log(` Output Log: ${c.outputLogPath}`),console.log(` Created: ${new Date(c.createdAt).toLocaleString()}`),console.log(` Updated: ${new Date(c.updatedAt).toLocaleString()}`)),process.exit(0)}catch(r){r.response&&r.response.status===404?console.error(`Session not found: ${s}`):r.response?console.error(`Error: ${r.response.data.error||r.message}`):r.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${r.message}`),process.exit(1)}}async function aR(t){let{session:e,json:n}=t,s=e||Ml("PLANBEE_SESSION_ID");s||(console.error("Error: --session is required or PLANBEE_SESSION_ID must be set"),process.exit(1));let o=Ul(t);try{let r=await o.get(`/api/v1/sessions/${s}/children`),{children:i,total:a}=r.data;if(n)console.log(JSON.stringify(r.data,null,2));else{a===0&&(console.log("No child agents found"),process.exit(0)),console.log(`Found ${a} child agent(s):
|
|
190
|
+
`),console.log("SESSION_ID | AGENT_TYPE | STATUS | TASK"),console.log("\u2500".repeat(110));for(let c of i){let{id:l}=c,u=c.agentType.padEnd(12),p=c.status.padEnd(10),d=c.task.substring(0,30);console.log(`${l} | ${u} | ${p} | ${d}`)}}process.exit(0)}catch(r){r.response&&r.response.status===404?console.error(`Session not found: ${s}`):r.response?console.error(`Error: ${r.response.data.error||r.message}`):r.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${r.message}`),process.exit(1)}}async function cR(t){let{session:e,json:n}=t,s=e||Ml("PLANBEE_SESSION_ID");s||(console.error("Error: --session is required or PLANBEE_SESSION_ID must be set"),process.exit(1));let o=Ul(t);try{let r=await o.get(`/api/v1/sessions/${s}/tree`),{tree:i}=r.data;n?console.log(JSON.stringify(i,null,2)):(console.log(`Session Tree (${i.totalSessions} total):
|
|
191
|
+
`),jv(i.root,0)),process.exit(0)}catch(r){r.response&&r.response.status===404?console.error(`Session not found: ${s}`):r.response?console.error(`Error: ${r.response.data.error||r.message}`):r.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${r.message}`),process.exit(1)}}function jv(t,e){let n=" ".repeat(e),s=e>0?"\u2514\u2500 ":"",o=`[${t.status}]`;if(console.log(`${n}${s}${t.agentType} ${o} (${t.id.substring(0,8)})`),console.log(`${n} ${t.task.substring(0,60)}`),t.children&&t.children.length>0)for(let r of t.children)jv(r,e+1)}Lv.exports={status:{command:"status",describe:"Get session status",builder:t=>t.option("session",{type:"string",description:"Session ID (defaults to PLANBEE_SESSION_ID)"}).option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:iR},listChildren:{command:"list-children",describe:"List direct children of session",builder:t=>t.option("session",{type:"string",description:"Session ID (defaults to PLANBEE_SESSION_ID)"}).option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:aR},tree:{command:"tree",describe:"Display session hierarchy tree",builder:t=>t.option("session",{type:"string",description:"Root session ID (defaults to PLANBEE_SESSION_ID)"}).option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:cR}}});var Uv=D((m3,Mv)=>{var Hl=de(),Te=et(),{resolveApiUrl:lR}=te(),{getEnv:uR}=Be(),zl=lR();async function pR(t,e){try{let n=await Hl.get(`${zl}/api/v1/agents/${t}/watch-rules`),{rules:s,watchMode:o,isCustom:r}=n.data;e?console.log(JSON.stringify(n.data,null,2)):(console.log("Watch Display Rules"),console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),console.log(` Watch Mode: ${o?Te.t("watchRules.watchModeActive"):Te.t("watchRules.watchModeInactive")}`),console.log(` Custom Rules: ${r?Te.t("watchRules.customRulesYes"):Te.t("watchRules.customRulesNo")}`),console.log(` Format: ${s.display_format}`),console.log(` Max Lines: ${s.max_lines}`),console.log(` Sections: ${s.sections.join(", ")}`))}catch(n){n.response?.status===404?console.error(Te.t("watchRules.sessionNotFound",{id:t})):console.error(Te.t("watchRules.error",{error:n.response?.data?.error||n.message})),process.exit(1)}}async function dR(t,e){try{let n;try{n=JSON.parse(e)}catch{console.error(Te.t("watchRules.invalidJson")),process.exit(1)}let s=await Hl.patch(`${zl}/api/v1/agents/${t}/watch-rules`,{rules:n});console.log(Te.t("watchRules.rulesSaved")),console.log(JSON.stringify(s.data.rules,null,2))}catch(n){console.error(Te.t("watchRules.error",{error:n.response?.data?.error||n.message})),process.exit(1)}}async function qv(t,e){try{let n=await Hl.get(`${zl}/api/v1/agents/${t}/watch-dashboard-data`),{data:s}=n;if(e){console.log(JSON.stringify(s,null,2));return}console.log(""),console.log(`# \u{1F41D} ${s.headline}`),console.log(""),s.agents&&s.agents.length>0&&(console.log("| Agent | | Status |"),console.log("|-------|-|--------|"),s.agents.forEach(r=>{let i=r.task?` \xB7 ${r.task}`:"";console.log(`| **${r.name}** | ${r.emoji} | ${r.status}${i} |`)}),console.log(""));let{tasks:o}=s;if(o&&o.total>0){let r=o.completed||0,{total:i}=o,a=Math.round(r/i*10),c="\u2705".repeat(a)+"\u2B1C".repeat(10-a);console.log(`**\u{1F9EA} Tasks** \xB7 ${c} \xB7 ${r}/${i} erledigt`),console.log("")}if(s.activeTasks&&s.activeTasks.length>0){let r=s.activeTasks.filter(a=>a.status==="completed"),i=s.activeTasks.filter(a=>a.status!=="completed");if(r.length>0||i.length>0){console.log("| \u2705 erledigt | \u{1F527} aktiv |"),console.log("|------------|---------|");let a=Math.max(r.length,i.length);for(let c=0;c<a;c++){let l=r[c]?.title||"",u=i[c]?.title||"";console.log(`| ${l} | ${u} |`)}console.log("")}}s.bugs&&s.bugs.count>0&&(console.log(`**\u{1F41B} ${s.bugs.count} Bugs** \xB7 ${s.bugs.summary}`),console.log("")),console.log(Te.t("watchRules.dashboardUpdated",{time:s.lastUpdate})),console.log("")}catch(n){n.response?.status===404?console.error(Te.t("watchRules.sessionNotFound",{id:t})):console.error(Te.t("watchRules.error",{error:n.response?.data?.error||n.message})),process.exit(1)}}async function fR(t){let{data:e,set:n,json:s}=t,o=t.session||uR("PLANBEE_SESSION_ID");o||(console.error(Te.t("watchRules.sessionRequired")),console.error(Te.t("watchRules.sessionHint")),process.exit(1)),n?await dR(o,n):e?await qv(o,s):await pR(o,s)}Mv.exports={getDashboardData:qv,command:"watch-rules",describe:Te.t("watchRules.describe"),builder:t=>t.option("session",{alias:"S",type:"string",description:Te.t("watchRules.optSession")}).option("data",{alias:"d",type:"boolean",description:Te.t("watchRules.optData")}).option("set",{type:"string",description:Te.t("watchRules.optSet")}).option("json",{type:"boolean",description:Te.t("watchRules.optJson")}).example("planbee watch-rules --session <id>",Te.t("watchRules.exRules")).example("planbee watch-rules --data --session <id>",Te.t("watchRules.exDashboard")).example(`planbee watch-rules --set '{"max_lines":30}' --session <id>`,Te.t("watchRules.exSet")),handler:fR}});var Wv=D((h3,zv)=>{var mR=de(),{resolveApiUrl:hR}=te(),{getEnv:Hv}=Be(),gR=hR();async function yR(t){let e=t["session-id"]||t.session||Hv("PLANBEE_SESSION_ID");try{let n=await mR.get(`${gR}/api/v1/swarm/${e}/agents`),{agents:s,room:o}=n.data;if(t.json)console.log(JSON.stringify(n.data,null,2));else{console.log(`Swarm Room: ${o?.topic||"N/A"}`),console.log(`Agents: ${s.length}`);for(let r of s)console.log(` - ${r.session_id||r.id} [${r.agent_type}] ${r.status}`)}process.exit(0)}catch(n){n.response?console.error(`Error: ${n.response.data.error||n.message}`):n.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${n.message}`),process.exit(1)}}zv.exports={command:"status [session-id]",describe:"Show swarm agents status",builder:t=>t.positional("session-id",{describe:"Agent session ID (or use PLANBEE_SESSION_ID)",type:"string"}).option("session",{alias:"s",type:"string",description:"Session ID (alternative to positional arg)"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).check(e=>{if(!(e["session-id"]||e.session||Hv("PLANBEE_SESSION_ID")))throw new Error("Session ID required (use positional arg <session-id>, --session, or set PLANBEE_SESSION_ID)");return!0}),handler:yR}});var Gv=D((g3,Kv)=>{var bR=de(),{resolveApiUrl:xR}=te(),{getEnv:Jv}=Be(),vR=xR();async function wR(t){let e=t["session-id"]||t.session||Jv("PLANBEE_SESSION_ID");try{let n=await bR.get(`${vR}/api/v1/swarm/${e}/health`),{health:s}=n.data;if(t.json)console.log(JSON.stringify(n.data,null,2));else{console.log("Swarm Health:");for(let o of s){let r=o.alive?"\u2705 alive":"\u274C dead";console.log(` - ${o.sessionId} [${o.agentType}] PID=${o.pid||"N/A"} ${r}`)}}process.exit(0)}catch(n){n.response?console.error(`Error: ${n.response.data.error||n.message}`):n.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${n.message}`),process.exit(1)}}Kv.exports={command:"health [session-id]",describe:"Show swarm agents OS process health",builder:t=>t.positional("session-id",{describe:"Agent session ID (or use PLANBEE_SESSION_ID)",type:"string"}).option("session",{alias:"s",type:"string",description:"Session ID (alternative to positional arg)"}).option("json",{type:"boolean",description:"Output JSON",default:!1}).check(e=>{if(!(e["session-id"]||e.session||Jv("PLANBEE_SESSION_ID")))throw new Error("Session ID required (use positional arg <session-id>, --session, or set PLANBEE_SESSION_ID)");return!0}),handler:wR}});var Yv=D((y3,Vv)=>{var ER=de(),{resolveApiUrl:DR}=te(),SR=DR();async function kR(t){try{let e=await ER.get(`${SR}/api/v1/providers/status`),{providers:n}=e.data;if(t.json)console.log(JSON.stringify(e.data,null,2));else{console.log("Provider Status:");for(let[s,o]of Object.entries(n)){let r=o.watchModeRecommended?"\u2705":"\u274C";console.log(` ${s}: ${o.type} | Watch-Mode: ${r} | ${o.reason}`),o.dailyLimit&&console.log(` Daily Limit: ${o.dailyLimit}`),o.monthlyLimit&&console.log(` Monthly Limit: ${o.monthlyLimit}`)}}process.exit(0)}catch(e){e.response?console.error(`Error: ${e.response.data.error||e.message}`):e.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${e.message}`),process.exit(1)}}Vv.exports={command:"status",describe:"Show provider status with cost models and quotas",builder:t=>t.option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:kR}});var Zv=D((b3,Qv)=>{var{axios:AR,PLANBEE_API_URL:_R,pollAgentStatus:CR}=mn(),Se=et(),Xv=6e4;function tn(t){console.log(JSON.stringify(t,null,2))}async function OR(t){let{session:e,timeout:n,json:s}=t,o=e;if(!o){s?tn({success:!1,sessionId:null,error:Se.t("startAgent.sessionRequired")}):console.error(Se.t("startAgent.sessionRequired")),process.exit(1);return}let r=n||Xv;s||console.log(Se.t("startAgent.starting",{id:o}));try{let a=await AR.post(`${_R}/api/v1/agents/${o}/start`,{},{timeout:1e4});if(!a.data.success){let c=a.data.error||"Start fehlgeschlagen";s?tn({success:!1,sessionId:o,error:c}):console.error(Se.t("startAgent.startFailed",{error:c})),process.exit(1);return}}catch(a){if(a.response?.status===501)s||console.log(Se.t("startAgent.cloudFallback"));else if(a.response?.status===404){s?tn({success:!1,sessionId:o,status:404,error:Se.t("startAgent.agentNotFound",{id:o})}):console.error(Se.t("startAgent.agentNotFound",{id:o})),process.exit(1);return}else if(a.response){let c=a.response.data?.error||a.message;s?tn({success:!1,sessionId:o,status:a.response.status,error:c}):console.error(Se.t("startAgent.httpError",{status:a.response.status,message:c})),process.exit(1);return}else if(a.code==="ECONNREFUSED"){s?tn({success:!1,sessionId:o,error:Se.t("startAgent.serverUnreachable")}):console.error(Se.t("startAgent.serverUnreachable")),process.exit(1);return}else{s?tn({success:!1,sessionId:o,error:a.message}):console.error(Se.t("startAgent.genericError",{message:a.message})),process.exit(1);return}}s||console.log(Se.t("startAgent.waitingActivation"));let i=await CR(o,r);if(i.outcome==="active"){s?tn({success:!0,sessionId:o,status:i.status}):(console.log(Se.t("startAgent.agentActive",{id:o})),console.log(Se.t("startAgent.statusLabel",{status:i.status}))),process.exit(0);return}if(i.outcome==="error"){let c=i.status==="not_found"?Se.t("startAgent.agentNotFound",{id:o}):Se.t("startAgent.startFailed",{error:`agent entered '${i.status}' state`});s?tn({success:!1,sessionId:o,status:i.status,error:c}):console.error(c),process.exit(1);return}s?tn({success:!1,sessionId:o,status:i.status||"spawning",error:"Timeout"}):console.error(Se.t("startAgent.timeoutError",{id:o,seconds:r/1e3})),process.exit(1)}Qv.exports={command:"start-agent",describe:Se.t("startAgent.describe"),builder:t=>t.option("session",{alias:"s",type:"string",description:Se.t("startAgent.optSession"),demandOption:!0}).option("timeout",{alias:"t",type:"number",description:Se.t("startAgent.optTimeout"),default:Xv}).option("json",{type:"boolean",description:Se.t("startAgent.optJson"),default:!1}).example("$0 start-agent --session <uuid>",Se.t("startAgent.exStart")).example("$0 start-agent -s <uuid> --timeout 120000",Se.t("startAgent.exTimeout")).example("$0 start-agent -s <uuid> --json",Se.t("startAgent.exJson")),handler:OR}});var nw=D((x3,tw)=>{var{axios:TR,PLANBEE_API_URL:PR}=mn(),Wl=0,$R=1;function ew(t,e){return t?t.length<=e?t:`${t.slice(0,e-3)}...`:"-"}function NR(t){if(!t)return"-";let e=new Date(t);if(Number.isNaN(e.getTime()))return"-";let n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}`}async function IR(t){let e=t.json===!0,n;try{let r=await TR.get(`${PR}/api/v1/devices`);n=r.data&&r.data.devices||[]}catch(r){let i;r.response?i=r.response.data?.error||r.message:r.code==="ECONNREFUSED"?i="Cannot connect to PlanBee API. Is the server running?":i=r.message,e?console.log(JSON.stringify({success:!1,devices:[],error:i})):console.error(`Error: ${i}`),process.exit($R);return}if(e){console.log(JSON.stringify({success:!0,devices:n})),process.exit(Wl);return}if(n.length===0){console.log("Keine registrierten Ger\xE4te."),process.exit(Wl);return}let o=[{label:"Hostname",width:24},{label:"Device ID",width:36},{label:"Platform",width:12},{label:"Online",width:7},{label:"Last Seen",width:16}].map(r=>r.label.padEnd(r.width)).join(" ");console.log(o),console.log("-".repeat(o.length));for(let r of n){let i=[ew(r.hostname||"-",24).padEnd(24),(r.deviceId||"-").padEnd(36),ew(r.platform||"-",12).padEnd(12),(r.online?"yes":"no").padEnd(7),NR(r.lastSeen).padEnd(16)];console.log(i.join(" "))}console.log(""),process.exit(Wl)}tw.exports={command:"devices",describe:"List your registered devices with online status",builder:t=>t.option("json",{type:"boolean",description:"Output raw JSON ({ success, devices: [{ deviceId, hostname, platform, lastSeen, online }] })",default:!1}).example("$0 devices","Ger\xE4te als Tabelle").example("$0 devices --json","Ger\xE4te als rohes JSON"),handler:IR}});var cw=D((v3,aw)=>{var RR=et();function Pe(t,e){return RR.t(t,{...e||{},interpolation:{escapeValue:!1}})}var FR=["claude","agy","minimax","copilot","zai"],Ht={claude:"Claude",agyGemini:"AGY Gemini",agySonnetGpt:"AGY Sonnet/GPT",minimax:"MiniMax",copilot:"Copilot",zai:"Z.AI"};function ow(t){if(typeof t!="number"||Number.isNaN(t))return null;let e=Math.round(t*10)/10;return`${Number.isInteger(e)?e:e.toFixed(1)}%`}function rw({used:t,limit:e,percent:n}){let s=ow(n);return typeof t=="number"&&typeof e=="number"&&e>0?s?`${t}/${e} (${s})`:`${t}/${e}`:s||"-"}function iw(t,e=Date.now()){if(!t)return"-";let n=Date.parse(t);if(Number.isNaN(n))return"-";let s=new Date(n),o=d=>String(d).padStart(2,"0"),r=`${s.getFullYear()}-${o(s.getMonth()+1)}-${o(s.getDate())} ${o(s.getHours())}:${o(s.getMinutes())}`,i=n-e;if(i<=0)return r;let a=Math.floor(i/6e4),c=Math.floor(a/1440),l=Math.floor(a%1440/60),u=a%60,p;return c>0?p=`${c}d${o(l)}h`:l>0?p=`${l}h${o(u)}m`:p=`${u}m`,`${r} (${Pe("usage.resetIn",{rest:p})})`}function nn(t,e,n,s){return{provider:t,window:e,usage:rw(n),reset:s||null}}function hn(t){if(!t||typeof t!="object")return null;let e=typeof t.utilization=="number"?t.utilization:t.usedPercent;return typeof e!="number"?null:{percent:e,resetAt:t.resetsAt||t.resetAt||null}}function jR(t){if(!t)return{rows:[],reason:Pe("usage.noData")};let e=[["5h",t.fiveHour],["7d",t.sevenDay],["7d Sonnet",t.sevenDaySonnet]],n=[];for(let[s,o]of e){let r=hn(o);r&&n.push(nn(Ht.claude,s,{percent:r.percent},r.resetAt))}return t.extraUsage&&typeof t.extraUsage.utilization=="number"&&n.push(nn(Ht.claude,Pe("usage.windowExtra"),{used:t.extraUsage.usedCredits,limit:t.extraUsage.monthlyLimit,percent:t.extraUsage.utilization},null)),n.length===0?{rows:[],reason:t.error||t.note||Pe("usage.noData")}:{rows:n,reason:t.error||null}}function sw(t,e){if(!e)return{rows:[],reason:Pe("usage.noData")};if(e.error)return{rows:[],reason:e.error};let n=[],s=hn(e.fiveHour);s&&n.push(nn(t,"5h",{used:e.totalUsed,limit:e.totalLimit,percent:s.percent},s.resetAt));let o=hn(e.sevenDay);return o&&n.push(nn(t,"7d",{percent:o.percent},o.resetAt)),n.length===0?{rows:[],reason:Pe("usage.noWindows")}:{rows:n,reason:null}}function LR(t){let e=sw(Ht.agyGemini,t.antigravityGemini),n=sw(Ht.agySonnetGpt,t.antigravitySonnetGpt),s=[...e.rows,...n.rows];return s.length>0?{rows:s,reason:null}:{rows:[],reason:e.reason||n.reason||Pe("usage.noData")}}function BR(t){if(!t)return{rows:[],reason:Pe("usage.noData")};if(t.error)return{rows:[],reason:t.error};if(t.status&&t.status!=="available"&&t.status!=="stale"){let o=t.reason||t.errorCode||t.status;return{rows:[],reason:o}}let e=[],n=hn(t.fiveHour);n&&e.push(nn(Ht.minimax,"5h",{percent:n.percent},n.resetAt));let s=hn(t.sevenDay);return s&&e.push(nn(Ht.minimax,"7d",{percent:s.percent},s.resetAt)),e.length===0?{rows:[],reason:Pe("usage.noWindows")}:{rows:e,reason:t.stale?Pe("usage.stale"):null}}function qR(t){if(!t)return{rows:[],reason:Pe("usage.noData")};if(t.error)return{rows:[],reason:t.error};if(t.status&&t.status!=="available"&&t.status!=="stale"){let o=t.reason||t.errorCode||t.status;return{rows:[],reason:o}}let e=[],n=hn(t.fiveHour);n&&e.push(nn(Ht.zai,"5h",{percent:n.percent},n.resetAt));let s=hn(t.sevenDay);return s&&e.push(nn(Ht.zai,"7d",{percent:s.percent},s.resetAt)),e.length===0?{rows:[],reason:Pe("usage.noWindows")}:{rows:e,reason:t.stale?Pe("usage.stale"):null}}function MR(t){return t?t.error?{rows:[],reason:t.error}:typeof t.used!="number"?{rows:[],reason:Pe("usage.noData")}:{rows:[nn(Ht.copilot,Pe("usage.windowMonth"),{used:t.used,limit:t.limit,percent:t.utilizationPercent},t.resetAt||null)],reason:null}:{rows:[],reason:Pe("usage.noData")}}function UR(t,e){let n=t||{},s=[],o=[],r=[],i={claude:()=>jR(n.claude!==void 0?n.claude:{fiveHour:n.fiveHour||null,sevenDay:n.sevenDay||null,sevenDaySonnet:n.sevenDaySonnet||null,extraUsage:n.extraUsage||null,error:n.claudeError||null}),agy:()=>LR(n),minimax:()=>BR(n.minimax),copilot:()=>MR(n.copilot),zai:()=>qR(n.zai)};for(let a of e){let c=i[a];if(!c)continue;let l=c();l.rows.length===0?o.push({provider:a,reason:l.reason||Pe("usage.noData")}):(s.push(...l.rows),l.reason&&r.push(`${a}: ${l.reason}`))}return{rows:s,unavailable:o,notes:r}}function HR(t,e=Date.now()){let n=[{label:Pe("usage.colProvider"),width:16},{label:Pe("usage.colWindow"),width:10},{label:Pe("usage.colUsage"),width:22},{label:Pe("usage.colReset"),width:30}],s=n.map(r=>r.label.padEnd(r.width)).join(" "),o=[s.trimEnd(),"-".repeat(s.length)];for(let r of t)o.push([String(r.provider).padEnd(n[0].width),String(r.window).padEnd(n[1].width),String(r.usage).padEnd(n[2].width),iw(r.reset,e).padEnd(n[3].width)].join(" ").trimEnd());return o}aw.exports={t:Pe,PROVIDER_KEYS:FR,PROVIDER_LABELS:Ht,formatPercent:ow,formatUsage:rw,formatReset:iw,readWindow:hn,buildRows:UR,renderTable:HR}});var gw=D((w3,hw)=>{var{axios:Jl,PLANBEE_API_URL:gi}=mn(),{t:we,PROVIDER_KEYS:hi,buildRows:zR,renderTable:WR,formatReset:JR}=cw(),jo=0,Os=1,Kl=2,lw=3,Gl=4,uw=5;function pw(t){if(t.response){let{status:e}=t.response,n=t.response.data&&t.response.data.error||t.message;return e===401||e===403?{message:we("usage.notLoggedIn"),exitCode:Kl}:{message:n,exitCode:Os}}return["ECONNREFUSED","ENOTFOUND","ECONNRESET","ETIMEDOUT","ECONNABORTED"].includes(t.code)?{message:we("usage.connectionFailed",{url:gi}),exitCode:lw}:{message:t.message,exitCode:Os}}function KR(t){let e=(t||"all").toLowerCase();if(e==="all")return[...hi];let n=e.split(",").map(s=>s.trim()).filter(Boolean);return n.length===0||n.some(s=>!hi.includes(s))?null:n}function GR(t,e){let n=e.toLowerCase();return t.find(s=>(s.deviceId||"").toLowerCase()===n)||t.find(s=>(s.hostname||"").toLowerCase()===n)||t.find(s=>(s.deviceId||"").toLowerCase().startsWith(n))||null}function Cs(t,e,n){t?console.log(JSON.stringify({success:!1,error:e,exitCode:n})):console.error(we("usage.errorPrefix",{error:e})),process.exit(n)}function dw(t,e){let{rows:n,unavailable:s,notes:o}=zR(t,e);n.length>0&&WR(n).forEach(r=>console.log(r));for(let r of o)console.log(we("usage.noteLine",{note:r}));for(let r of s)console.log(we("usage.providerUnavailable",{provider:r.provider,reason:r.reason}));return n.length>0}function fw(t){if(!t)return;console.log(""),console.log(we("usage.summaryHeader",{days:t.days}));let e=t.totals||{};console.log(we("usage.summaryTotals",{sessions:e.sessions||0,input:e.inputTokens||0,output:e.outputTokens||0,turns:e.turns||0}))}async function mw(t){return(await Jl.get(`${gi}/api/usage/summary?days=${encodeURIComponent(t)}`)).data}async function VR(t,e,n){let s,o=null;try{s=(await Jl.get(`${gi}/api/usage`)).data||{},n!==null&&(o=await mw(n))}catch(i){let{message:a,exitCode:c}=pw(i);Cs(e,a,c);return}if(e){console.log(JSON.stringify({success:!0,scope:"account",providers:t,usage:s,...o?{summary:o}:{}})),process.exit(jo);return}console.log(we("usage.headerAccount")),console.log("");let r=dw(s,t);fw(o),r||console.log(we("usage.providerNone")),console.log(""),process.exit(r?jo:Gl)}function YR(t){let e=t.isOnline?we("usage.online"):we("usage.offline");console.log(we("usage.headerDevice",{hostname:t.hostname||"-",deviceId:t.deviceId,state:e})),t.isOnline||console.log(we("usage.deviceOfflineHint",{lastSeen:JR(t.lastHeartbeat)}))}async function XR(t,e,n,s){let o=String(t.device),r=o.toLowerCase()==="all",i,a=null;try{let u=await Jl.get(`${gi}/api/usage/devices`);i=u.data&&u.data.devices||[],s!==null&&(a=await mw(s))}catch(u){let{message:p,exitCode:d}=pw(u);Cs(n,p,d);return}let c;if(r){if(c=i,c.length===0){Cs(n,we("usage.noDevices"),Os);return}}else{let u=GR(i,o);if(!u){Cs(n,we("usage.deviceNotFound",{device:o}),Kl);return}c=[u]}if(n){console.log(JSON.stringify({success:!0,scope:"devices",providers:e,devices:c,...a?{summary:a}:{}})),process.exit(jo);return}let l=!1;for(let u of c)YR(u),console.log(""),dw(u.usage||{},e)&&(l=!0),console.log("");if(fw(a),!l){console.log(we("usage.providerNone")),process.exit(Gl);return}if(!r&&c.some(u=>!u.isOnline)){process.exit(uw);return}process.exit(jo)}async function QR(t){let e=t.json===!0,n=KR(t.provider);if(!n){Cs(e,we("usage.unknownProvider",{provider:t.provider,valid:[...hi,"all"].join(", ")}),Os);return}let s=null;if(t.days!==void 0&&t.days!==null){let o=parseInt(t.days,10);if(!Number.isFinite(o)||o<0){Cs(e,we("usage.invalidDays",{days:t.days}),Os);return}s=o}if(t.device){await XR(t,n,e,s);return}await VR(n,e,s)}hw.exports={command:"usage",describe:we("usage.describe"),builder:t=>t.option("device",{type:"string",description:we("usage.optDevice")}).option("provider",{type:"string",choices:[...hi,"all"],default:"all",description:we("usage.optProvider")}).option("json",{type:"boolean",default:!1,description:we("usage.optJson")}).option("days",{type:"number",description:we("usage.optDays")}).example("$0 usage",we("usage.exAccount")).example("$0 usage --device all",we("usage.exDevices")).example("$0 usage --provider claude --json",we("usage.exJson")),handler:QR,EXIT_CODES:{EXIT_OK:jo,EXIT_ERROR:Os,EXIT_AUTH:Kl,EXIT_CONNECTION:lw,EXIT_PROVIDER_UNAVAILABLE:Gl,EXIT_DEVICE_OFFLINE:uw}}});var Ew=D((E3,ww)=>{var qe=et();async function ZR(){return[{ok:!1,name:"system-health",error:"Not available in the standalone planbee CLI (no lightweight REST health endpoint yet \u2014 see issue #123)."}]}var{resolveApiUrl:eF,getConnectionErrorMessage:yw}=te(),{createApiClient:tF}=lt(),bw=eF(),ke={cyan:t=>`\x1B[36m${t}\x1B[0m`,green:t=>`\x1B[32m${t}\x1B[0m`,yellow:t=>`\x1B[33m${t}\x1B[0m`,red:t=>`\x1B[31m${t}\x1B[0m`,gray:t=>`\x1B[90m${t}\x1B[0m`,blue:t=>`\x1B[34m${t}\x1B[0m`,white:t=>t,bold:t=>`\x1B[1m${t}\x1B[0m`,underline:t=>`\x1B[4m${t}\x1B[0m`};async function nF(t,e){try{let o=((await e.get(`/api/v1/agents/search?q=${encodeURIComponent(t)}&limit=5`,{timeout:5e3})).data.agents||[]).filter(r=>r.id&&r.id.replace(/-/g,"").startsWith(t.replace(/-/g,"")));return o.length===1?o[0].id:(o.length>1&&(console.error(qe.t("status.ambiguousId",{id:t,count:o.length})),o.forEach(r=>console.error(` ${r.id} (${r.agent_type}, ${r.status})`))),null)}catch{return null}}async function sF(t,e){if(!t||t.length===36&&t.includes("-"))return t;let n=await nF(t,e);return n||(console.error(qe.t("status.sessionNotFoundPrefix",{id:t})),null)}async function oF(t,e){try{let[n,s]=await Promise.all([e.get(`/api/v1/sessions/${t}`,{timeout:1e4}),e.get(`/api/v1/agents/${t}/tasks`,{timeout:5e3}).catch(()=>({data:{tasks:[]}}))]),{session:o}=n.data;return s.data&&s.data.tasks&&(o.tasks=s.data.tasks),{success:!0,data:{session:o}}}catch(n){if(n.code==="ECONNREFUSED"||n.code==="ETIMEDOUT")return{success:!1,error:yw(bw),exitCode:3};if(n.response){let s=n.response.data?.error||n.response.data?.details||"Unknown error";return{success:!1,error:`HTTP ${n.response.status}: ${s}`,exitCode:n.response.status===404?2:1}}return{success:!1,error:n.message,exitCode:2}}}async function rF(t){try{return{success:!0,data:(await t.get("/api/v1/sessions",{timeout:1e4})).data}}catch(e){if(e.code==="ECONNREFUSED"||e.code==="ETIMEDOUT")return{success:!1,error:yw(bw),exitCode:3};if(e.response){let n=e.response.data?.error||e.response.data?.details||"Unknown error";return{success:!1,error:`HTTP ${e.response.status}: ${n}`,exitCode:1}}return{success:!1,error:e.message,exitCode:2}}}function xw(t){return{active:"green",running:"green",spawning:"blue",idle:"gray",paused:"yellow",waiting:"yellow",completed:"gray",stopped:"red",error:"red",timeout:"red"}[t]||"white"}function iF(t){let e=xw(t.status),n=ke[e];if(console.log(""),console.log(ke.bold("Session Details:")),console.log("================"),console.log(""),console.log(` ID: ${ke.cyan(t.id)}`),console.log(` Type: ${t.agentType}`),console.log(` Status: ${n(t.status)}`),console.log(` Task: ${t.task}`),t.currentTask){let s=t.completionPercent!==void 0&&t.completionPercent!==null?` (${t.completionPercent}%)`:"";console.log(` Progress: ${ke.yellow(t.currentTask)}${s}`)}if(console.log(` Folder: ${t.folder}`),console.log(` Created: ${new Date(t.createdAt).toLocaleString()}`),console.log(` Updated: ${new Date(t.updatedAt).toLocaleString()}`),t.parentId&&console.log(` Parent: ${t.parentId}`),t.childrenCount&&t.childrenCount>0&&console.log(` Children: ${t.childrenCount}`),t.compactVersion&&t.compactVersion>1&&console.log(` Circle: ${ke.blue(`V${t.compactVersion}`)} ${ke.gray(`(Chain Root: ${t.compactChainRoot||"unknown"})`)}`),t.tasks&&t.tasks.length>0){console.log(""),console.log(ke.bold("Current Activity:"));let s=t.tasks.find(r=>r.status==="active");if(s)if(console.log(` ${ke.green("[>>>]")} ${s.title} (${s.percent}%)`),s.state)try{let r=typeof s.state=="string"?JSON.parse(s.state):s.state,i=JSON.stringify(r,null,2).replace(/^/gm," ");console.log(" State:"),console.log(ke.gray(i))}catch{console.log(` State: ${s.state}`)}else console.log(` ${ke.gray("(No state metadata)")}`);else console.log(` ${ke.gray("(No active task)")}`);let o=t.tasks.filter(r=>r.status==="completed").sort((r,i)=>new Date(i.updatedAt||0)-new Date(r.updatedAt||0)).slice(0,3);o.length>0&&(console.log(""),console.log(ke.bold("Recent History:")),o.forEach(r=>{console.log(` ${ke.gray("[done]")} ${r.title}`),r.resolution?console.log(` Resolution: ${ke.white(r.resolution)}`):console.log(` ${ke.red("[!] Missing resolution")}`)}))}console.log("")}function aF(t){let e=new Map,n=[];return t.forEach(s=>{e.set(s.id,{...s,children:[]})}),e.forEach(s=>{s.parentId&&e.has(s.parentId)?e.get(s.parentId).children.push(s):n.push(s)}),n}function vw(t,e="",n=!0,s=!0){let o=[],r=xw(t.status),i=ke[r],a=t.id.substring(0,8),c="";s||(c=n?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ");let l=`${ke.cyan(a)} (${t.agentType}) ${i(`[${t.status}]`)} - ${t.task}`;o.push(`${e}${c}${l}`);let u=t.children||[],p=s?" ":e+(n?" ":"\u2502 ");return u.forEach((d,f)=>{let m=f===u.length-1;o.push(vw(d,p,m,!1))}),o.join(`
|
|
192
|
+
`)}function cF(t){if(console.log(""),console.log(ke.bold(qe.t("status.allSessionsHeader"))),console.log("=============="),console.log(""),!t||t.length===0){console.log(qe.t("status.noSessions")),console.log("");return}let e={};t.forEach(n=>{let s=n.folder||"unknown";e[s]||(e[s]=[]),e[s].push(n)}),Object.keys(e).sort().forEach(n=>{console.log(ke.bold(ke.underline(qe.t("status.projectLabel",{folder:n})))),console.log(""),aF(e[n]).forEach(o=>{console.log(vw(o," ",!0,!0))}),console.log("")}),console.log(qe.t("status.totalSessions",{count:t.length})),console.log("")}function lF(t){if(console.log(""),!t||t.length===0){console.log(qe.t("status.noSessionsCompact")),console.log("");return}let n=[{label:"ID",width:10},{label:"Status",width:12},{label:"Type",width:12},{label:"Task",width:40},{label:"%",width:5}].map(s=>s.label.padEnd(s.width)).join(" ");console.log(n),console.log("-".repeat(n.length)),t.forEach(s=>{let o=s.id.substring(0,8),r=(s.status||"-").padEnd(12),i=(s.agentType||s.agent_type||"-").substring(0,12).padEnd(12),a=(s.currentTask||s.task||"-").substring(0,40).padEnd(40),c=s.completionPercent!=null?`${s.completionPercent}%`:"-";console.log(`${o.padEnd(10)} ${r} ${i} ${a} ${c.padEnd(5)}`)}),console.log(""),console.log(qe.t("status.totalSessionsCompact",{count:t.length})),console.log("")}function uF(t){console.log(""),console.log(ke.bold("System Health Status:")),console.log("======================="),console.log("");let e=!0;return t.forEach(n=>{let s=n.ok?ke.green("[OK]"):ke.red("[ERROR]"),o=n.ok?"":ke.red(`- ${n.error}`);console.log(` ${s} ${n.name}`),n.ok||(e=!1,console.log(` ${o}`))}),console.log(""),e}async function pF(t){if(t.health){let n=await ZR(),s=uF(n);process.exit(s?0:1);return}let e=tF(t);if(t.session){let n=await sF(t.session,e);if(!n){process.exit(2);return}let s=await oF(n,e);if(s.success){let{session:o}=s.data;t.json?console.log(JSON.stringify({success:!0,...o},null,2)):iF(o),process.exit(0)}else console.error(qe.t("status.error",{error:s.error})),process.exit(s.exitCode||1)}else{let n=await rF(e);if(n.success){let{sessions:s}=n.data;t.json?console.log(JSON.stringify({success:!0,items:s,totalCount:s.length,sessions:s},null,2)):t.compact?lF(s):cF(s),process.exit(0)}else console.error(qe.t("status.error",{error:n.error})),process.exit(n.exitCode||1)}}ww.exports={command:"status [session]",describe:qe.t("status.describe"),builder:t=>t.positional("session",{type:"string",description:qe.t("status.optSession")}).option("session",{alias:"s",type:"string",description:qe.t("status.optSession")}).option("json",{type:"boolean",description:qe.t("status.optJson"),default:!1}).option("health",{type:"boolean",description:qe.t("status.optHealth"),default:!1}).option("compact",{type:"boolean",description:qe.t("status.optCompact"),default:!1}).example("$0 status",qe.t("status.exAll")).example("$0 status --session <uuid>",qe.t("status.exSession")).example("$0 status --health",qe.t("status.exHealth")).example("$0 status -s <uuid> --json",qe.t("status.exJson")),handler:pF}});var kw=D((D3,Sw)=>{var{resolveApiUrl:dF,getConnectionErrorMessage:fF}=te(),{createApiClient:mF}=lt(),hF=dF();async function gF(t,e){try{return{success:!0,data:(await e.get(`/api/v1/sessions/${t}/tree`,{timeout:1e4})).data}}catch(n){if(n.code==="ECONNREFUSED"||n.code==="ETIMEDOUT")return{success:!1,error:fF(hF),exitCode:3};if(n.response){let s=n.response.data?.error||n.response.data?.details||"Unknown error";return{success:!1,error:`HTTP ${n.response.status}: ${s}`,exitCode:n.response.status===404?2:1}}return{success:!1,error:n.message,exitCode:2}}}function yF(t){return{active:"green",running:"green",spawning:"blue",idle:"gray",paused:"yellow",waiting:"yellow",completed:"gray",stopped:"red",error:"red",timeout:"red"}[t]||"white"}var bF={cyan:t=>`\x1B[36m${t}\x1B[0m`,green:t=>`\x1B[32m${t}\x1B[0m`,yellow:t=>`\x1B[33m${t}\x1B[0m`,red:t=>`\x1B[31m${t}\x1B[0m`,gray:t=>`\x1B[90m${t}\x1B[0m`,blue:t=>`\x1B[34m${t}\x1B[0m`,white:t=>t};function Dw(t,e="",n=!0,s=!1){if(!t)return"";let o=[],r="";s||(r=n?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ");let i=t.id.substring(0,8),a=yF(t.status),c=bF[a],l=`${i} (${t.agentType}) ${c(`[${t.status}]`)}`;o.push(`${e}${r}${l}`);let u=s?"":e+(n?" ":"\u2502 "),p=t.children||[];return p.forEach((d,f)=>{let m=f===p.length-1;o.push(Dw(d,u,m,!1))}),o.join(`
|
|
193
|
+
`)}async function xF(t){t.session||(console.error("Fehler: --session ist erforderlich"),process.exit(1));let e=mF(t),n=await gF(t.session,e);if(n.success){let s=n.data.tree||n.data,o=s.root||s,r=s.totalSessions||"N/A";if(t.json)console.log(JSON.stringify(o,null,2));else{console.log(`
|
|
194
|
+
Session-Hierarchie:`),console.log(`===================
|
|
195
|
+
`);let i=Dw(o,"",!0,!0);console.log(i),console.log(""),console.log(`Gesamt-Sessions: ${r}`)}process.exit(0)}else console.error(`Fehler: ${n.error}`),process.exit(n.exitCode||1)}Sw.exports={command:"tree",describe:"Zeige Session-Hierarchie als Baum",builder:t=>t.option("session",{alias:"s",type:"string",description:"Root Session-ID (UUID)",demandOption:!0}).option("json",{type:"boolean",description:"JSON-Ausgabe",default:!1}).example("$0 tree --session <queen-uuid>","Zeige Hierarchie der Queen-Session").example("$0 tree -s <session-uuid> --json","Zeige Hierarchie als JSON"),handler:xF}});var _w=D((S3,Aw)=>{async function vF(){return new Promise(t=>{let e="",n=setTimeout(()=>{t(null)},100);process.stdin.setEncoding("utf8"),process.stdin.on("data",s=>{e+=s}),process.stdin.on("end",()=>{if(clearTimeout(n),e.trim().length===0){t(null);return}try{let s=JSON.parse(e.trim());t(s)}catch(s){console.error("[stdin-reader] Warning: Failed to parse stdin JSON:",s.message),t(null)}}),process.stdin.on("error",s=>{clearTimeout(n),console.error("[stdin-reader] Warning: Error reading stdin:",s.message),t(null)})})}Aw.exports={readStdinJSON:vF}});var yi=D((k3,Tw)=>{var{resolveApiUrl:Cw}=te();function wF(){try{return new URL(Cw()),!0}catch{return!1}}function Ow(){let t=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN;if(!t)try{t=it().getToken()}catch{t=null}return t||null}function EF(t,e,n=null,{timeoutMs:s=6e3}={}){return new Promise(o=>{let r;try{r=new URL(Cw())}catch{o({status:0,body:null});return}let i=n?JSON.stringify(n):null,a=r.protocol==="https:"?require("https"):require("http"),c={"Content-Type":"application/json"};i&&(c["Content-Length"]=Buffer.byteLength(i));let l=Ow();l&&(c.Authorization=`Bearer ${l}`);let u=a.request({hostname:r.hostname,port:r.port||(r.protocol==="https:"?443:80),path:e,method:t,headers:c,timeout:s},p=>{let d="";p.on("data",f=>{d+=f}),p.on("end",()=>{let f=null;try{f=JSON.parse(d)}catch{f=null}o({status:p.statusCode||0,body:f})})});u.on("error",()=>o({status:0,body:null})),u.on("timeout",()=>{u.destroy(),o({status:0,body:null})}),i&&u.write(i),u.end()})}Tw.exports={isRemoteApi:wF,httpApi:EF,resolveHookToken:Ow}});var qo=D((A3,Fw)=>{var DF=require("fs"),SF=require("os"),Lo=require("path"),{deterministicUuid:Pw,clip:Bo,MAX_TEXT_CHARS:Vl,MAX_TOOL_RESULT_CHARS:kF}=Ds();function Nw(){return Lo.join(SF.homedir(),".codex","sessions")}function Iw(t){if(!t)return null;let e=`-${t}.jsonl`,n=o=>{try{return DF.readdirSync(o).sort().reverse()}catch{return[]}},s=Nw();for(let o of n(s)){let r=Lo.join(s,o);for(let i of n(r)){let a=Lo.join(r,i);for(let c of n(a)){let l=Lo.join(a,c);for(let u of n(l))if(u.startsWith("rollout-")&&u.endsWith(e))return Lo.join(l,u)}}}return null}function AF(t){try{return!!Iw(t)}catch{return!1}}function _F(t){return typeof t!="string"||!t?!1:/[\\/]\.codex[\\/]sessions[\\/]/.test(t)}function $w(t){return Array.isArray(t.content)?t.content.map(e=>e&&typeof e.text=="string"?e.text:"").filter(e=>e.trim()).join(`
|
|
196
|
+
`).trim():""}function bi(t,e){return{type:"assistant",uuid:t,message:{role:"assistant",content:e}}}function CF(t,e){return{type:"user",uuid:t,message:{role:"user",content:[{type:"tool_result",tool_use_id:t,content:Bo(e,kF)}]}}}function Rw(t,e){let n=(t||"").trim();if(!n)return[];let s;try{s=JSON.parse(n)}catch{return[]}if(!s||typeof s!="object")return[];if(s.type!=="event_msg")return[];let{payload:o}=s;if(!o||typeof o!="object"||o.type!=="item_completed")return[];let{item:r}=o;if(!r||typeof r!="object")return[];let i=s.ordinal!=null?s.ordinal:`i${r.id||""}`,a=Pw(e,i);if(r.type==="UserMessage"){let c=$w(r);return c?[{type:"user",uuid:a,message:{role:"user",content:Bo(c,Vl)}}]:[]}if(r.type==="AgentMessage"){let c=$w(r);return c?[bi(a,[{type:"text",text:Bo(c,Vl)}])]:[]}if(r.type==="CommandExecution"){let c=Array.isArray(r.command)?r.command.join(" "):String(r.command||"");if(!c.trim())return[];let l=[bi(a,[{type:"tool_use",id:a,name:"Bash",input:{command:Bo(c,Vl)}}])],u=r.aggregated_output||r.formatted_output||r.stdout||"",d=`${r.exit_code!=null?`[exit ${r.exit_code}]`:`[${r.status||"unknown"}]`}
|
|
197
|
+
${u}`.trim();return d&&l.push(CF(Pw(e,`${i}:out`),d)),l}if(r.type==="Extension"){if(r.kind!=="web.search")return[];let c=Array.isArray(r.action?.queries)&&r.action.queries.length?r.action.queries:[r.query||r.action?.query].filter(Boolean);return c.length?[bi(a,[{type:"tool_use",id:a,name:"WebSearch",input:{queries:c.map(l=>Bo(String(l),500))}}])]:[]}if(r.type==="FileChange"){let c=r.changes&&typeof r.changes=="object"?r.changes:{},l=Object.keys(c).map(u=>({path:u,type:c[u]&&c[u].type?c[u].type:"modify"}));return l.length?[bi(a,[{type:"tool_use",id:a,name:"Edit",input:{files:l}}])]:[]}return[]}function OF(t,e){let n=[];for(let s of String(t||"").split(`
|
|
198
|
+
`))if(s.trim())for(let o of Rw(s,e))n.push(JSON.stringify(o));return n.length?`${n.join(`
|
|
199
|
+
`)}
|
|
200
|
+
`:""}Fw.exports={codexLineToStreamJson:Rw,codexChunkToStreamJson:OF,codexSessionsDir:Nw,codexTranscriptPath:Iw,hasCodexTranscript:AF,isCodexTranscriptPath:_F}});var Yl=D((_3,Bw)=>{var{syncAdaptedTranscript:TF}=So(),{codexChunkToStreamJson:PF,codexTranscriptPath:jw}=qo(),Lw="codex-transcript-sync";async function $F(t,{transcriptPath:e}={}){return TF(t,{transcriptPath:e||jw(t)||void 0,convert:PF,stateDirName:Lw})}Bw.exports={syncCodexTranscript:$F,codexTranscriptPath:jw,STATE_DIR_NAME:Lw}});var eu=D((C3,Ww)=>{var NF=require("fs"),{spawn:qw}=require("child_process"),Xl=fn(),{syncCodexTranscript:IF}=Yl(),{codexTranscriptPath:Mw,hasCodexTranscript:RF}=qo(),Ql=Xl._store,Uw=24*60*60*1e3,Hw=30*60*1e3;function zw(t){try{process.stderr.write(`[codex-sync-ticker] ${t}
|
|
201
|
+
`)}catch{}}function Zl(t,e,n=qw){try{let s=[require.resolve("../cli/index.js"),"internal-hook","--type","codex-sync-ticker","--session",t];e&&s.push("--transcript-path",e);let o=n(process.execPath,s,{detached:!0,stdio:"ignore"});return o&&typeof o.unref=="function"&&o.unref(),!0}catch(s){return zw(`spawn failed (non-fatal): ${s.message}`),!1}}async function FF(t,e={},n={}){if(!t)return;let s=n.runTicker||Xl.runTicker,o=n.syncCodexTranscript||IF,r=n.statSync||NF.statSync,i=n.spawnDetached||Zl,a=n.readPid||Ql.readPid,c=n.now||Date.now,l=n.selfPid||process.pid,u=n.codexTranscriptPath||Mw,p=e.transcriptPath||u(t),d=e.maxRuntimeMs||Uw;await s(t,{...e,transcriptPath:p,maxRuntimeMs:d},{syncTranscript:o,syncSubagents:async()=>null});try{let f=a(t);if(f&&f!==l)return;let m=r(p);c()-m.mtimeMs<Hw&&i(t,p)}catch{}}function jF(t,e,n={}){try{if(!t)return!1;let s=n.isAlive||Ql.isAlive,o=n.spawn||qw,r=n.hasCodexTranscript||RF,i=n.codexTranscriptPath||Mw,a=e||i(t);return!e&&!r(t)||s(t)?!1:Zl(t,a,o)}catch(s){return zw(`spawn failed (non-fatal): ${s.message}`),!1}}function LF(t){return Xl.stopTicker(t)}Ww.exports={runCodexTicker:FF,spawnCodexTickerIfNeeded:jF,stopCodexTicker:LF,_spawnDetached:Zl,_store:Ql,CODEX_MAX_RUNTIME_MS:Uw,RESPAWN_ACTIVE_WINDOW_MS:Hw}});var Mo=D((T3,e0)=>{var tu=require("fs"),BF=require("os"),Kw=require("path"),{isRemoteApi:O3,httpApi:xi}=yi(),{WATCH_HEARTBEAT_ALIVE_MS:qF}=$o(),MF="[message-delivery]",UF=5,HF=14400;function nu(t){console.error(`${MF} ${t}`)}async function Gw(t){if(!t)return null;try{let e=await xi("GET",`/api/v1/sessions/${t}`);if(e.status!==200||!e.body||!e.body.session)return null;let n=e.body.session;return{spawnSource:n.spawnSource||null,watchMode:!!n.watchMode,watchTimeout:n.watchTimeout||null,isWatchingInbox:!!n.isWatchingInbox,inboxWatchHeartbeatAt:n.inboxWatchHeartbeatAt||null,llmType:n.llmType||null}}catch(e){return nu(`session info lookup failed: ${e.message}`),null}}async function zF(t){let e=await Gw(t);return!!(e&&e.spawnSource==="user-cli")}function WF(t,e=qF){if(!t)return!1;let n=new Date(t).getTime();return Number.isFinite(n)&&Date.now()-n<e}async function JF(t,e){let n=[];for(let s=0;s<e;s+=1){let o=await xi("POST",`/api/v1/messages/claim-for-watch/${t}`);if(o.status!==200||!o.body||!o.body.message)break;n.push(o.body.message)}return n}async function KF(t,{max:e=UF}={}){if(!t)return[];try{return await JF(t,e)}catch(n){return nu(`claim failed: ${n.message}`),[]}}function su(t){return t.map(n=>{let s=n.metadata||{},o=["=== PLANBEE MESSAGE ===",`From: ${n.fromSessionId||"user"}`,`Priority: ${n.priority||"normal"}`,`Message-ID: ${n.id}`,`Sent: ${n.createdAt?new Date(n.createdAt).toISOString():""}`];return s.replyTo&&o.push(`Reply-To: ${s.replyTo}`),s.replyExpected&&o.push("Reply-Expected: yes"),s.noReplyNeeded&&o.push("No-Reply-Needed: true"),s.instructions&&o.push(`Instructions: ${s.instructions}`),o.push("===","",n.message),o.join(`
|
|
202
|
+
`)}).join(`
|
|
203
|
+
|
|
204
|
+
`)}var GF=3,VF=10*60*1e3,YF=5*60*1e3;function XF(t,e){let n=(t||[]).filter(c=>c&&vi.includes(c.status));if(n.length===0)return null;let s=n.slice(0,GF),o=s.map(c=>{let l=Number.isFinite(c.percent)?`${c.percent}%`:"0%";return`${c.title||c.key||"task"} (${c.status}, ${l})`}),r=n.length-s.length,i=o.join("; ")+(r>0?`; and ${r} more`:""),a=e||"<session>";return`[PlanBee] Reminder: you have ${n.length} open task(s) (${i}). If this prompt changes or advances your work, update the task list first: mark done work completed/100% with --resolution, adjust the percent/state of the active task, register new tasks for new scope.
|
|
205
|
+
planbee progress --session ${a} --task "<title>" --key <key> --percent <n> [--state '{"step":"...","next":"..."}'] [--resolution "<what was achieved>"]`}function Vw(t,e){return e||Kw.join(BF.homedir(),".planbee",t)}function Yw(t,e,n){return Kw.join(Vw(t,n),`${e}.ts`)}function Xw(t,e,n,s={}){if(!e)return!1;let{now:o=Date.now(),dir:r}=s;try{let i=tu.readFileSync(Yw(t,e,r),"utf-8"),a=parseInt(String(i).trim(),10);return Number.isFinite(a)?o-a<n:!1}catch{return!1}}function Qw(t,e,n={}){if(!e)return;let{now:s=Date.now(),dir:o}=n;try{tu.mkdirSync(Vw(t,o),{recursive:!0}),tu.writeFileSync(Yw(t,e,o),String(s))}catch{}}function QF(t,e={}){let{windowMs:n=VF,...s}=e;return Xw("prompt-task-reminder",t,n,s)}function ZF(t,e={}){Qw("prompt-task-reminder",t,e)}var e2=15*60*1e3;function Zw(){let t=parseInt(process.env.PLANBEE_TASK_REMINDER_COOLDOWN_MS,10);return Number.isFinite(t)&&t>=0?t:e2}function t2(t,e={}){let{windowMs:n=Zw(),...s}=e;return Xw("stop-task-reminder",t,n,s)}function n2(t,e={}){Qw("stop-task-reminder",t,e)}function s2(t,e){return`[PlanBee Remote-Control] Session inbox watcher not running, remote control is active.
|
|
206
|
+
Start it now with run_in_background: true, then end your turn:
|
|
207
|
+
|
|
208
|
+
planbee inbox --wait --session ${t} --timeout ${e||HF}
|
|
209
|
+
|
|
210
|
+
Exit codes:
|
|
211
|
+
0 wake / 2 timeout -> re-arm
|
|
212
|
+
3 auth-dead -> run \`planbee auth login\`, then re-arm
|
|
213
|
+
4 remote-control-off / 5 session-gone / 6 already-waiting -> do NOT re-arm`}var vi=["planned","active","blocked"],o2={planned:"[ ]",active:"[~]",blocked:"[!]"},Jw=160;async function r2(t,{timeoutMs:e=2500}={}){if(!t)return[];try{let n=await xi("GET",`/api/v1/agents/${t}/tasks`,null,{timeoutMs:e});return n.status!==200||!n.body||!Array.isArray(n.body.tasks)?[]:n.body.tasks.filter(s=>s&&vi.includes(s.status))}catch(n){return nu(`open-tasks fetch failed: ${n.message}`),[]}}async function i2(t,{timeoutMs:e=2500}={}){if(!t)return null;try{let n=await xi("GET",`/api/v1/agents/${t}/tasks`,null,{timeoutMs:e});if(n.status!==200||!n.body||!Array.isArray(n.body.tasks))return null;let{tasks:s}=n.body,o=null;for(let r=0;r<s.length;r++){let i=s[r]&&s[r].updatedAt;i&&(!o||i>o)&&(o=i)}return o}catch{return null}}function a2(t){if(t==null)return null;let e;try{e=typeof t=="string"?t:JSON.stringify(t)}catch{return null}return!e||e==="{}"||e==='""'||e==="null"?null:e.length>Jw?`${e.slice(0,Jw-3)}...`:e}function c2(t,e){let n=(t||[]).filter(r=>r&&vi.includes(r.status));if(n.length===0)return null;let s=n.map(r=>{let i=o2[r.status]||"[ ]",a=Number.isFinite(r.percent)?`${r.percent}%`:"0%",c=`${i} ${r.title||r.key||"task"} (${r.status}, ${a})`;if(r.status==="active"){let l=a2(r.state);c+=l?` \u2014 last state: ${l}`:" \u2014 no state recorded yet"}return c}),o=e||"<session>";return`[PlanBee] You have ${n.length} open task(s) at the end of this turn:
|
|
214
|
+
${s.join(`
|
|
215
|
+
`)}
|
|
216
|
+
|
|
217
|
+
Before you end this turn: update the task status now \u2014 mark completed tasks as completed/100% with --resolution, update active ones with the current --percent/--state, set stuck ones to --status blocked. Do this now and you will not see this reminder again next turn. Leave a task untouched only if it is genuinely still open and correct.
|
|
218
|
+
planbee progress --session ${o} --task "<title>" --key <key> --percent <n> [--state '{"step":"...","next":"..."}'] [--resolution "<what was achieved>"]`}function l2(t,e){let n=(t||[]).filter(a=>a&&vi.includes(a.status));if(n.length===0)return null;let s=n.length,o=n.find(a=>a.status==="active"),r=o&&Number.isFinite(o.percent)?`${o.percent}%`:null,i=s===1?`[PlanBee] ${s} open task`:`[PlanBee] ${s} open tasks`;return o&&(i+=`, active: ${o.title||o.key||"task"}`,r&&(i+=` (${r})`)),i+=". Update it now (planbee progress ...) to prevent this reminder next turn. Full list: planbee tasks",i}function u2(t,e=null,n=null){let s=[];return t&&t.length>0&&s.push(`${su(t)}
|
|
219
|
+
|
|
220
|
+
[PlanBee] ${t.length} message(s) were delivered at the end of your turn. Handle them now (reply if Reply-Expected), update your tasks, then finish.`),e&&s.push(e),n&&s.push(n),JSON.stringify({decision:"block",reason:s.join(`
|
|
221
|
+
|
|
222
|
+
`)})}function p2(t){return`${su(t)}
|
|
223
|
+
|
|
224
|
+
[PlanBee] ${t.length} queued message(s) were delivered together with this prompt. Consider them while handling the user request; reply where Reply-Expected.`}e0.exports={getSessionInfo:Gw,isUserCliSession:zF,isHeartbeatFresh:WF,claimQueuedMessages:KF,formatMessages:su,fetchOpenTasks:r2,fetchTaskFreshness:i2,buildTaskReminder:c2,buildTaskReminderShort:l2,buildPromptTaskReminder:XF,isPromptReminderThrottled:QF,markPromptReminderInjected:ZF,isStopReminderThrottled:t2,markStopReminderInjected:n2,resolveStopReminderCooldownMs:Zw,buildRearmInstruction:s2,buildStopBlockPayload:u2,buildPromptContext:p2,FRESH_WINDOW_MS:YF}});var r0=D((P3,o0)=>{var t0=require("fs"),d2=require("os"),ou=require("path"),{WATCH_HEARTBEAT_ALIVE_MS:f2}=$o();function n0(t){return ou.join(t||ou.join(d2.homedir(),".planbee","logs"),"watcher-heal.log")}function m2(t,{dir:e}={}){try{let n=n0(e);return t0.mkdirSync(ou.dirname(n),{recursive:!0}),t0.appendFileSync(n,`${JSON.stringify({ts:new Date().toISOString(),...t})}
|
|
225
|
+
`),!0}catch{return!1}}function s0(t,e=f2){if(!t)return!1;let n=new Date(t).getTime();return Number.isFinite(n)&&Date.now()-n<e}function h2(t,e,n){return t?t.watchMode?e?{action:"none",reason:"alive-local"}:t.isWatchingInbox?s0(t.inboxWatchHeartbeatAt)?{action:"none",reason:"alive-remote-heartbeat"}:n?{action:"escalate",reason:"auth-dead"}:{action:"heal",reason:"dead-or-timeout"}:{action:"none",reason:"stopped-intentionally"}:{action:"none",reason:"remote-control-off"}:{action:"none",reason:"session-gone"}}o0.exports={healLogPath:n0,logHeal:m2,isHeartbeatFresh:s0,decideHealAction:h2}});var a0=D(($3,i0)=>{var Uo="[[PLAN_START]]",ru="[[PLAN_END]]",Ho="[[QUESTION_START]]",wi="[[QUESTION_END]]",g2=["## PlanBee Session Protocol","","This process was spawned by PlanBee. Your PlanBee session ID is exported in the shell","environment variable `$PLANBEE_SESSION_ID` (if you are a sub-agent, the parent session ID is","in `$PLANBEE_PARENT_ID`). Use the `planbee` CLI with this session ID to report progress and","stay reachable \u2014 pass `$PLANBEE_SESSION_ID` literally as the `--session` value, never a","guessed or invented ID:","","```bash",'planbee progress --session $PLANBEE_SESSION_ID --task "What you are doing" --percent 50','planbee speak -S $PLANBEE_SESSION_ID "Status update"',"planbee inbox --session $PLANBEE_SESSION_ID","```","","## PlanBee Git Commit Policy","When creating git commits, always append the PlanBee co-author trailer to your commit messages (do NOT use provider-specific co-author tags like Claude/Anthropic):","Co-authored-by: PlanBee Agent <agent-$PLANBEE_SESSION_ID@planbee.infin8.world>","PlanBee-Session-Id: $PLANBEE_SESSION_ID","PlanBee-Agent-Type: $PLANBEE_AGENT_TYPE"].join(`
|
|
226
|
+
`),y2=["## Asking the User a Question","","The interactive `AskUserQuestion` tool is NOT available in this environment \u2014 do not","attempt to call it. If you genuinely need the user to decide something before you can","continue (a choice you cannot resolve from the task, the code, or sensible defaults),","END YOUR TURN with a question block in EXACTLY this format as the LAST thing in your","final message:","",Ho,'{"questions":[{"question":"Full question text?","header":"Short label",','"options":[{"label":"Option A","description":"What choosing A means"},','{"label":"Option B","description":"What choosing B means"}],"multiSelect":false}]}',wi,"","Rules: valid JSON between the markers, 1-4 questions, 2-6 options each, short labels.","The system shows the user an answer UI and resumes you with their answers.","Use this sparingly \u2014 only when you are truly blocked on a user decision."].join(`
|
|
227
|
+
`),b2=["If you must clarify requirements BEFORE you can produce a sound plan, you may end your",'turn with a question block (see "Asking the User a Question") instead of the plan;',"after the user answers you will be resumed to finish planning."].join(`
|
|
228
|
+
`),x2=["## Plan Mode (Read-Only)","","You are running in PLAN MODE. Research the task and produce a complete implementation","plan for the user to review. You MUST NOT modify any files or make any changes.","","When your plan is complete, output it between EXACTLY these markers and end your turn:","",Uo,"# Plan title","","## Analysis","\u2026","","## Steps","1. \u2026","","## Affected Files","- \u2026","","## Risks","- \u2026",ru,"","Between the markers ONLY the plan (Markdown). After approval a separate agent executes it."].join(`
|
|
229
|
+
`);function v2(t){if(typeof t!="string")return"";let e=t.trim();if(!e.startsWith("{")&&!e.startsWith("["))return t;let n;try{n=JSON.parse(e)}catch{return t}let s=[],o=(r,i)=>{if(!(i>8||r==null)){if(typeof r=="string"){r.length>3&&s.push(r);return}if(Array.isArray(r)){for(let a of r)o(a,i+1);return}if(typeof r=="object")for(let a of Object.values(r))o(a,i+1)}};return o(n,0),s.join(`
|
|
230
|
+
`)}function w2(t){if(typeof t!="string"||!t.includes(Ho))return null;let n=t.indexOf(Ho)+Ho.length,s=t.indexOf(wi,n);if(s===-1||t.slice(s+wi.length).trim().length>500)return null;let r=t.slice(n,s).trim().replace(/^```(?:json)?\s*/i,"").replace(/```\s*$/,"").trim(),i;try{i=JSON.parse(r)}catch{return null}let a=Array.isArray(i)?i:i&&i.questions;if(!Array.isArray(a)||a.length===0)return null;let c=[];for(let l of a.slice(0,4)){if(!l||typeof l.question!="string"||!l.question.trim())continue;let u=Array.isArray(l.options)?l.options.slice(0,6).filter(p=>p&&typeof p.label=="string"&&p.label.trim()).map(p=>({label:String(p.label).slice(0,200),description:typeof p.description=="string"?p.description.slice(0,500):""})):[];c.push({question:l.question.slice(0,1e3),header:typeof l.header=="string"?l.header.slice(0,40):"",options:u,multiSelect:l.multiSelect===!0})}return c.length>0?c:null}function E2(t){if(typeof t!="string"||!t.includes(Uo))return null;let e=t.indexOf(Uo)+Uo.length,n=t.indexOf(ru,e);return(n===-1?t.slice(e):t.slice(e,n)).trim()||null}function D2(t){let e=["The user answered your questions:"];for(let[n,s]of Object.entries(t||{}))n!=="_dismissed"&&e.push("",`Q: ${n}`,`A: ${s}`);return e.push("","Continue your work using these answers."),e.join(`
|
|
231
|
+
`)}i0.exports={PLAN_START_MARKER:Uo,PLAN_END_MARKER:ru,QUESTION_START_MARKER:Ho,QUESTION_END_MARKER:wi,QUESTION_PROTOCOL_PROMPT:y2,PLAN_MODE_QUESTION_HINT:b2,GENERIC_PLAN_PROTOCOL_PROMPT:x2,PLANBEE_SESSION_PROTOCOL_PROMPT:g2,parseQuestionBlock:w2,parsePlanBlock:E2,buildQuestionAnsweredMessage:D2,extractTextForScan:v2}});var l0=D((N3,c0)=>{function S2({topic:t=null,tasks:e=[]}={}){if(!Array.isArray(e)||e.length===0)return null;let n=["## Current Task State (auto-loaded)",""];t&&n.push(`Topic: ${t}`,"");let s=new Map;for(let a of e)s.set(a.key,a);let o=[],r=new Map;for(let a of e)a.parentKey&&s.has(a.parentKey)?(r.has(a.parentKey)||r.set(a.parentKey,[]),r.get(a.parentKey).push(a)):o.push(a);let i=(a,c)=>{let l=k2(a.status),u=`${c}${l} ${a.title} (${a.percent}%)`;a.resolution&&(u+=` -- "${A2(a.resolution,80)}"`),n.push(u),a.state&&Object.keys(a.state).length>0&&n.push(`${c} State: ${JSON.stringify(a.state)}`);let p=r.get(a.key)||[];for(let d of p)i(d,`${c} `)};for(let a of o)i(a,"");return n.join(`
|
|
232
|
+
`)}function k2(t){switch(t){case"completed":return"[done]";case"active":return"[>>>]";case"blocked":return"[!!!]";case"planned":return"[...]";case"prepared":return"[rdy]";default:return"[???]"}}function A2(t,e){return!t||t.length<=e?t:`${t.slice(0,e-3)}...`}c0.exports={formatTaskTreeFromData:S2}});var g0=D((R3,h0)=>{var{isRemoteApi:I3,httpApi:iu,resolveHookToken:u0}=yi(),{formatTaskTreeFromData:_2}=l0(),p0=`
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
`,C2="[prompt-injector]",O2="resume-recovery",T2="watch-mode-protocol";function sn(t){console.error(`${C2} ${t}`)}function d0(t,e={}){if(!t)return"";let n=t;for(let[s,o]of Object.entries(e))n=n.replace(new RegExp(`{{\\s*${s}\\s*}}`,"g"),()=>String(o));return n}function P2(t){return t?{agentType:t.agentType||t.agent_type||null,topic:t.topic||null,watchMode:!!(t.watchMode||t.watch_mode),watchTimeout:t.watchTimeout||t.watch_timeout||null,watchInterval:t.watchInterval||t.watch_interval||null,watchDisplayRules:t.watchDisplayRules||t.watch_display_rules||null,browserConfig:t.browserConfig||t.browser_config||null,spawnConfig:t.spawnConfig||t.spawn_config||null}:null}function $2(t,e,n){let s=[];t==="SessionStart"&&(e==="resume"||e==="compact")&&s.push(O2),n&&n.watchMode&&s.push(T2);let o=n&&n.browserConfig&&n.browserConfig.mode;return o&&o!=="none"&&(s.push("browser-security"),(o==="chrome"||o==="both")&&s.push("browser-chrome"),(o==="playwright"||o==="both")&&s.push("browser-playwright")),s}function gn(t){return process.env[`PLANBEE_${t}`]||""}function f0(){if(gn("SDK_MANAGED")==="true"){if(gn("IS_SUBAGENT")==="true"||gn("SUBAGENT_REGISTERED")==="true"){let t=gn("SESSION_ID"),e=gn("PARENT_ID");return{skip:!0,output:`## PlanBee Sub-Agent
|
|
237
|
+
|
|
238
|
+
Your session ID: \`${t}\`
|
|
239
|
+
You are a sub-agent of parent \`${e}\`.
|
|
240
|
+
|
|
241
|
+
Optional progress reporting:
|
|
242
|
+
|
|
243
|
+
\`\`\`bash
|
|
244
|
+
planbee progress --session ${t} --task "Description" --percent 50
|
|
245
|
+
\`\`\`
|
|
246
|
+
|
|
247
|
+
This is a minimal prompt set. Focus on your assigned task and work efficiently.
|
|
248
|
+
`}}return sn("SDK-managed agent, skipping (prompts via systemPromptAppend)"),{skip:!0}}return gn("INJECTED_MESSAGE")==="true"?(sn("message-injection process, skipping prompt re-injection"),{skip:!0}):{skip:!1}}async function N2(t){if(!t)return null;let e=await iu("GET",`/api/v1/sessions/${t}`);return e.status===200&&e.body&&e.body.session?e.body.session:null}async function I2(t,e,n){let s=n.length?`&include=${encodeURIComponent(n.join(","))}`:"",o=await iu("GET",`/api/v1/prompts/preview/${encodeURIComponent(t)}?phase=${encodeURIComponent(e)}${s}`);return o.status===200&&o.body&&typeof o.body.assembledPrompt=="string"&&o.body.assembledPrompt?(sn(`remote blocks: ${o.body.blockCount} block(s) for ${t}/${e}`),o.body.assembledPrompt):(sn(`remote blocks unavailable (status ${o.status})`),null)}async function R2(t,e){if(!t)return null;let n=await iu("GET",`/api/v1/agents/${t}/tasks`);if(n.status!==200||!n.body||!Array.isArray(n.body.tasks)||n.body.tasks.length===0)return null;let s=e&&(e.topic||null)||null;return _2({topic:s,tasks:n.body.tasks})}function F2(t){let e=t&&t.watchTimeout||180,n=t&&t.watchInterval||3,s={watch_timeout:String(e),watch_interval:String(n),watch_bash_timeout:String(e+5)},o=t&&t.watchDisplayRules;return o&&(s.watch_display_rules_json=JSON.stringify(o)),s}function j2(t,e){if(!t||!t.includes("{domains}"))return t;let n=e&&e.browserConfig&&Array.isArray(e.browserConfig.domains)&&e.browserConfig.domains.length>0?e.browserConfig.domains.join(", "):"localhost:*, 127.0.0.1:*";return t.replace(/\{domains\}/g,()=>n)}async function m0({phase:t,stdinData:e=null,sessionId:n=null}={}){if(!n){let p=f0();if(p.skip)return p.output||null}let s=n||gn("SESSION_ID")||e&&e.session_id||"",o=e&&e.source||"";if(!s)return sn(`no session id available, skipping ${t} injection`),null;let r=[],i=null,a=gn("AGENT_TYPE")||"",c=null;{if(!(u0&&u0()))return`## PlanBee (not authenticated)
|
|
249
|
+
|
|
250
|
+
This session is running with PlanBee hooks enabled, but no PlanBee auth token was found.
|
|
251
|
+
|
|
252
|
+
Session ID: \`${s}\`
|
|
253
|
+
Hook phase: \`${t}\`
|
|
254
|
+
Source: \`${o||"unknown"}\`
|
|
255
|
+
|
|
256
|
+
To enable PlanBee registration + context injection, authenticate PlanBee first (e.g. run \`planbee login\`)
|
|
257
|
+
or export \`PLANBEE_AUTH_TOKEN\` / \`PLANBEE_TOKEN\` in your shell environment.
|
|
258
|
+
`;if(t==="PreCompact")try{let{syncTranscript:f}=Qr();await f(s,{transcriptPath:e&&e.transcript_path})}catch(f){sn(`transcript-sync failed (non-fatal): ${f.message}`)}c=P2(await N2(s)),a||(a=c&&c.agentType||""),a=a||"default";let d=await I2(a,t,$2(t,o,c));d&&r.push(d),(t==="PreCompact"||o==="resume"||o==="compact")&&(i=await R2(s,c),sn(i?"remote task state injected":"no remote task state available"))}if(r.length===0&&!i)return sn(`nothing to inject for phase ${t}`),null;let l={session_id:s,agent_type:a||"default",timestamp:new Date().toISOString(),project_path:process.cwd(),...c?F2(c):{}},u=d0(r.join(p0),l);return u=j2(u,c),i&&(u=u?`${u}${p0}${i}`:i),u}async function L2({phase:t,stdinData:e=null}={}){try{let n=await m0({phase:t,stdinData:e});n&&(process.stdout.write(n),process.stdout.write(`
|
|
259
|
+
`))}catch(n){sn(`fatal (non-blocking): ${n.message}`)}}h0.exports={buildInjection:m0,runInjection:L2,renderTemplate:d0,checkGuards:f0}});var Ou=D((F3,Cu)=>{var zo=require("path"),{execSync:Ei}=require("child_process"),{readStdinJSON:Vn}=_w(),{resolveApiUrl:Su}=te(),{getEnv:fe}=Be(),{discoverCopilotTranscript:B2}=ol();function Di(t){return new Promise(e=>{let n=JSON.stringify(t),s=new URL(Su()),o=s.protocol==="https:"?require("https"):require("http"),r={"Content-Type":"application/json","Content-Length":Buffer.byteLength(n)},i=null;try{i=it().getToken()}catch{i=null}i||(i=process.env.PLANBEE_AUTH_TOKEN||process.env.PLANBEE_TOKEN),i&&(r.Authorization=`Bearer ${i}`);let a=o.request({hostname:s.hostname,port:s.port||(s.protocol==="https:"?443:80),path:"/api/v1/sessions/notify",method:"POST",headers:r,timeout:2e3},c=>{c.resume(),c.on("end",e)});a.on("error",()=>e()),a.on("timeout",()=>{a.destroy(),e()}),a.write(n),a.end()})}var{isRemoteApi:Ps,httpApi:He}=yi();function Si(){try{let t=parseInt(Ei(`ps -o ppid= -p ${process.ppid}`,{encoding:"utf-8"}).trim(),10);if(t>1)return t}catch(t){console.warn("[internal-hook] Could not determine grandparent PID:",t.message)}return process.ppid}var q2=[{provider:"copilot",match:({cmdline:t})=>/(^|\/)copilot(\s|$)/.test(t)},{provider:"codex",match:({transcriptPath:t})=>qo().isCodexTranscriptPath(t)},{provider:"agy",match:({cmdline:t,transcriptPath:e})=>!!(t&&(t.includes("antigravity")||t.includes("gemini"))||e&&(e.includes("antigravity-cli")||e.includes("gemini")))}];async function b0(t,e){if(e&&(e.includes("antigravity-cli")||e.includes("gemini"))){let{syncAgyTranscript:i}=So();await i(t,{transcriptPath:e});return}let{isCodexTranscriptPath:s}=qo();if(s(e)){let{syncCodexTranscript:i}=Yl();await i(t,{transcriptPath:e});return}let{syncTranscript:o}=Qr();await o(t,{transcriptPath:e});let{syncSubagents:r}=Qc();await r(t,{transcriptPath:e})}function ku(t,e=null){let n="";try{n=Ei(`ps -o command= -p ${t}`,{encoding:"utf-8"}).trim()}catch(s){console.warn("[internal-hook] Could not detect CLI provider:",s.message)}for(let s of q2)try{if(s.match({cmdline:n,transcriptPath:e,claudePid:t}))return s.provider}catch(o){console.warn(`[internal-hook] provider detector ${s.provider} failed:`,o.message)}return null}function M2(t){try{let e=Ei(`ps -o command= -p ${t}`,{encoding:"utf-8"}).trim();if(e.includes("--dangerously-skip-permissions"))return"dangerously-skip-permissions";let n=e.match(/--permission-mode\s+(\S+)/);return n?n[1]:null}catch(e){return console.warn("[internal-hook] Could not detect permission mode:",e.message),null}}async function Wo(){let t=null,e=null,n=process.cwd(),s="unknown";console.log("[internal-hook] \u2192 Reading stdin JSON...");let o=await Vn();if(o){if(o.conversationId&&!o.session_id&&(o.session_id=o.conversationId),o.workspacePaths&&Array.isArray(o.workspacePaths)&&o.workspacePaths.length>0&&!o.cwd){let[a]=o.workspacePaths;o.cwd=a}o.transcriptPath&&!o.transcript_path&&(o.transcript_path=o.transcriptPath)}o&&o.session_id?(console.log("[internal-hook] \u2713 Session data from stdin JSON"),t=o.session_id,n=o.cwd||process.cwd(),s="stdin",console.log("[internal-hook] - hook_event:",o.hook_event_name),console.log("[internal-hook] - source:",o.source),console.log("[internal-hook] - model:",o.model)):(console.log("[internal-hook] \u2192 No stdin JSON, checking environment variables..."),t=process.env.CLAUDE_SESSION_ID||null,e=fe("PLANBEE_AGENT_TYPE")||null,s="env",t&&console.log("[internal-hook] \u2713 Session data from environment variables (manual mode)"));let r=fe("PLANBEE_SESSION_ID")||null,i=t;return r&&r!==t&&(console.log(`[internal-hook] ID-Mismatch: PlanBee=${r}, CLI=${t}, using PlanBee as primary`),t=r),{sessionId:t,cliSessionId:i,planbeeEnvId:r,agentType:e,folderPath:n,source:s,stdinData:o}}async function au(){let{sessionId:t,cliSessionId:e,agentType:n,folderPath:s,stdinData:o}=await Wo();if(!t){console.error("[internal-hook] PreInvocation error: No session ID found"),process.stdout.write(`{}
|
|
260
|
+
`),process.exit(0);return}let r=!1;{let m=await He("GET",`/api/v1/sessions/${t}`);m.status===200&&m.body&&m.body.session&&(r=!0)}let i=o?.transcript_path||null;try{let{spawnAgyTickerIfNeeded:m}=ko();m(t,i)&&console.log(`[internal-hook] \u2192 AGY-Sync-Ticker gestartet (transcript: ${i||"default"})`)}catch(m){console.warn("[internal-hook] AGY-Ticker-Start fehlgeschlagen (non-fatal):",m.message)}if(r){process.stdout.write(`{}
|
|
261
|
+
`),process.exit(0);return}let a=await _u(),c=n||fe("PLANBEE_AGENT_TYPE")||(a!=="unknown"?a:"coder"),l=fe("PLANBEE_TASK")||"Bereit. Warte auf Anweisungen.",u=Si(),p={model:o?.model||null,transcriptPath:i,hookSource:o?.source||"unknown",hookEvent:"PreInvocation",permissionMode:null};{console.log(`[internal-hook] PreInvocation \u2192 HTTP-Registrierung gegen ${Su()} ...`);let m=await He("POST","/api/v1/sessions/register",{sessionId:t,folder:s,task:l,agentType:c,force:!0,automatic:!0,cliSessionId:e,processId:u,spawnSource:"user-cli",provider:"agy",metadata:p});if(m.status===201||m.status===200){console.log(`[internal-hook] PreInvocation \u2713 Agent registriert: ${t}`);try{await Di({sessionId:t,event:"status-changed",oldStatus:"spawning",newStatus:"active"})}catch{}}else console.error(`[internal-hook] PreInvocation \u2717 Registrierung fehlgeschlagen (HTTP ${m.status})`)}let f={injectSteps:[{ephemeralMessage:`\u{1F41D} **PlanBee: Anti-Gravity-Kopplung aktiv** (Session: \`${t}\`)
|
|
262
|
+
|
|
263
|
+
Remote-Control und Transkript-Synchronisation sind bereit.`}]};process.stdout.write(`${JSON.stringify(f)}
|
|
264
|
+
`),process.exit(0)}async function cu(){if(fe("PLANBEE_INJECTED_MESSAGE")==="true"){console.log("[internal-hook] Injected message process detected, skipping registration"),process.exit(0);return}console.log("================================================="),console.log("[internal-hook] \u2713 SessionStart Hook AUFGERUFEN!"),console.log("[internal-hook] Timestamp:",new Date().toISOString()),console.log("=================================================");let{sessionId:t,cliSessionId:e,planbeeEnvId:n,agentType:s,folderPath:o,source:r,stdinData:i}=await Wo(),a=n||fe("PLANBEE_SESSION_ID"),c=e,l=!1;fe("PLANBEE_COORDINATOR_MANAGED")==="true"&&a&&c&&a===c&&(console.log("[internal-hook] Coordinator-managed agent detected, skipping sub-agent detection"),l=!0);let u=Ps();if(console.log("[internal-hook] Data source:",r),console.log("[internal-hook] Working Directory:",o),!t){console.error("[internal-hook] Error: No session ID found (tried stdin JSON, env vars, and parent detection)"),console.error(`[internal-hook] ENV check: PLANBEE_SESSION_ID=${fe("PLANBEE_SESSION_ID")||"NOT SET"}`),console.error(`[internal-hook] ENV check: PLANBEE_PARENT_SESSION_ID=${fe("PLANBEE_PARENT_SESSION_ID")||"NOT SET"}`),console.error(`[internal-hook] ENV check: CLAUDE_SESSION_ID=${process.env.CLAUDE_SESSION_ID||"NOT SET"}`),console.error("[internal-hook] Hook execution failed, but allowing session to start (graceful degradation)"),process.exit(0);return}console.log("[internal-hook] \u2192 Session-ID gefunden:",t,"(CLI:",e,")"),console.log("[internal-hook] \u2192 Erkenne Agent-Typ...");let p=await _u(),d=s||fe("PLANBEE_AGENT_TYPE")||(p!=="unknown"?p:"coder");console.log("[internal-hook] \u2192 Agent-Typ:",d);let f=fe("PLANBEE_TASK")||null;console.log("[internal-hook] \u2192 Task-Description:",f||"NONE");let m=Si(),h=fe("PLANBEE_PERMISSION_MODE")||M2(m);console.log("[internal-hook] \u2192 Permission-Mode:",h||"default");let g={model:i?.model||null,transcriptPath:i?.transcript_path||null,hookSource:i?.source||"unknown",hookEvent:i?.hook_event_name||"SessionStart",permissionMode:h||null};console.log("[internal-hook] \u2192 Hook Metadata:",g);let b=g.hookSource==="compact";if(u){let v=ku(m,g.transcriptPath);console.log(`[internal-hook] \u2192 CLI-Provider-Erkennung (Cloud-Pfad): ${v||"nicht erkannt (claude/Default)"}`),console.log(`[internal-hook] \u2192 Cloud-HTTP-Registrierung gegen ${Su()} ...`);let E=await He("POST","/api/v1/sessions/register",{sessionId:t,folder:o,task:f||"Bereit. Warte auf Anweisungen.",agentType:d,force:!0,automatic:!0,cliSessionId:e,processId:m,spawnSource:"user-cli",provider:v||void 0,metadata:g});if(E.status===201||E.status===200){let S=E.body?.session?.sessionId||t;console.log(`[internal-hook] \u2713 Agent registriert (cloud): ${S} (type: ${d}, CLI-ID: ${e})`);try{await Di({sessionId:S,event:"status-changed",oldStatus:b?"compacting":"spawning",newStatus:"active"})}catch{}if(v==="copilot")try{let{spawnCopilotTickerIfNeeded:C}=Co(),B=C(S);console.log(`[internal-hook] \u2192 Copilot-Sync-Ticker (Cloud-Pfad): ${B?"gestartet":"laeuft bereits / kein Start noetig"}`)}catch(C){console.warn("[internal-hook] Copilot-Ticker-Start (Cloud-Pfad) fehlgeschlagen (non-fatal):",C.message)}if(v==="codex")try{let{spawnCodexTickerIfNeeded:C}=eu(),B=C(S,g.transcriptPath);console.log(`[internal-hook] \u2192 Codex-Sync-Ticker (Cloud-Pfad): ${B?"gestartet":"laeuft bereits / kein Start noetig"}`)}catch(C){console.warn("[internal-hook] Codex-Ticker-Start (Cloud-Pfad) fehlgeschlagen (non-fatal):",C.message)}}else console.error(`[internal-hook] \u2717 Cloud-Registrierung fehlgeschlagen (HTTP ${E.status}):`,JSON.stringify(E.body||{})),console.error("[internal-hook] Allowing session to start (graceful degradation)");process.exit(0);return}console.error("[internal-hook] FATAL: PlanBee API unreachable/misconfigured \u2014 no local DB fallback in the standalone CLI package."),console.error("[internal-hook] Allowing session to start (graceful degradation)."),process.exit(0)}async function lu(){let{sessionId:t,cliSessionId:e}=await Wo();if(console.log(`[internal-hook] on-compact: Session ${t||"unknown"}`),!t){console.log("[internal-hook] on-compact: No session_id, skipping"),process.exit(0);return}try{await Di({sessionId:t,event:"status-changed",oldStatus:"active",newStatus:"compacting"}),console.log("[internal-hook] on-compact: compacting broadcast sent")}catch(n){console.warn("[internal-hook] on-compact notify failed (non-fatal):",n.message)}process.exit(0)}async function uu(){let{sessionId:t,cliSessionId:e,folderPath:n,stdinData:s}=await Wo();if(!t){console.error("[internal-hook] Error: No session ID found (tried stdin JSON and env vars)"),console.error("[internal-hook] Hook execution failed, but allowing session to end (graceful degradation)"),process.exit(0);return}let o=Ps();if(fe("PLANBEE_SDK_MANAGED")==="true"){console.log("[internal-hook] Finish: SDK-managed agent, skipping (managed by SdkAgentRunner)"),process.exit(0);return}if(fe("PLANBEE_INJECTED_MESSAGE")==="true"){let c=!1;try{let d=s?.transcript_path;if(d){let f=require("fs");if(f.existsSync(d)){let m=f.statSync(d),h=Math.min(m.size,4096),g=f.openSync(d,"r"),b=Buffer.alloc(h);f.readSync(g,b,0,h,Math.max(0,m.size-h)),f.closeSync(g);let E=b.toString("utf-8").split(`
|
|
265
|
+
`).filter(S=>S.trim());for(let S=E.length-1;S>=0;S--)try{let C=JSON.parse(E[S]);if(C.type==="assistant"||C.role==="assistant"){let B=typeof C.message=="string"?C.message:JSON.stringify(C.message||C.content||"");/you['''\u2019]ve hit your limit|rate limit/i.test(B)&&(c=!0);break}}catch{}}}}catch(d){console.warn("[internal-hook] Rate-limit check failed (non-critical):",d.message)}let l=c?"rate_limited":"waiting";console.log(c?`[internal-hook] Finish: Rate limit detected, setting ${t} -> rate_limited`:`[internal-hook] Finish: Injected message completed, setting ${t} -> waiting`);let u=c?"paused":"waiting",p=await He("POST",`/api/v1/agents/${t}/status`,{status:u});p.status!==200&&console.warn(`[internal-hook] Finish: Status-Update fehlgeschlagen (HTTP ${p.status})`),process.exit(0);return}let r=fe("PLANBEE_EXIT_CODE"),i=null;r!==void 0&&r!==""&&(i=parseInt(r,10),isNaN(i)&&(console.warn(`[internal-hook] Invalid exit code '${r}', storing NULL`),i=null));let a=fe("PLANBEE_OUTPUT_SUMMARY")||null;if(console.log(`[internal-hook] Finish hook: Completing session ${t} (exit code: ${i})`),o){let c=Si(),l=ku(c,s?.transcript_path),u;if(l==="copilot")try{u=await B2(n,e)}catch(f){console.warn("[internal-hook] Finish(cloud): Copilot-Transcript-Discovery fehlgeschlagen (non-fatal):",f.message)}console.log(`[internal-hook] \u2192 Finish(cloud): CLI-Provider-Erkennung: ${l||"nicht erkannt (claude/Default)"}${l==="copilot"?`, Transcript: ${u||"NICHT gefunden"}`:""}`);let p=await He("POST",`/api/v1/sessions/${t}/complete`,{exitCode:i,outputSummary:a,provider:l||void 0,transcriptPath:u||(l==="codex"?s?.transcript_path:void 0)||void 0});if(p.status===200?console.log(`[internal-hook] \u2713 Session completed (cloud): ${t}`):console.warn(`[internal-hook] Finish(cloud): complete fehlgeschlagen (HTTP ${p.status}):`,JSON.stringify(p.body||{})),fe("PLANBEE_INJECTED_MESSAGE")!=="true")try{fn().stopTicker(t)}catch{}let d=fe("PLANBEE_PARENT_ID");if(d)try{Ei(`planbee send --to "${d}" --message "RESULT (auto-hook): agent session completed" 2>/dev/null || true`,{env:{...process.env},timeout:5e3})}catch{}try{await b0(t,s?.transcript_path)}catch(f){console.warn("[internal-hook] finish transcript-sync failed (non-fatal):",f.message)}process.exit(0);return}console.error("[internal-hook] FATAL: PlanBee API unreachable/misconfigured \u2014 no local DB fallback in the standalone CLI package."),process.exit(0)}function U2(t){try{if(!t)return null;let e=require("fs");if(!e.existsSync(t))return null;let n=e.statSync(t),s=Math.min(n.size,4096),o=e.openSync(t,"r"),r=Buffer.alloc(s);e.readSync(o,r,0,s,Math.max(0,n.size-s)),e.closeSync(o);let i=r.toString("utf-8").split(`
|
|
266
|
+
`).filter(a=>a.trim());for(let a=i.length-1;a>=0;a--)try{let c=JSON.parse(i[a]);if((c.type==="assistant"||c.role==="assistant")&&c.message?.model)return c.message.model}catch{}}catch(e){console.warn("[internal-hook] Model-Erkennung aus Transkript fehlgeschlagen (non-critical):",e.message)}return null}async function pu(){console.log=(...a)=>console.error(...a);let t=await Vn(),e=t?.session_id,s=fe("PLANBEE_SESSION_ID")||null||e;if(fe("PLANBEE_SDK_MANAGED")==="true"){process.exit(0);return}if(!s){console.log("[internal-hook] on-stop: No session_id, skipping"),process.exit(0);return}let o=t.stop_hook_active===!0;o&&console.log("[internal-hook] on-stop: stop_hook_active=true \u2014 Status-Report ja, Delivery nein"),console.log(`[internal-hook] on-stop: Session ${s} (CLI: ${e}) -> waiting`);let r=U2(t?.transcript_path),i=t?.effort?.level||process.env.CLAUDE_EFFORT||null;if(Ps()){let a=await He("POST",`/api/v1/agents/${s}/status`,{status:"waiting",...r?{model:r}:{},...i?{effort:i}:{}});a.status!==200&&(console.warn(`[internal-hook] on-stop(cloud): HTTP ${a.status} \u2014 retrying status transition once`),await new Promise(c=>{setTimeout(c,500)}),a=await He("POST",`/api/v1/agents/${s}/status`,{status:"waiting",...r?{model:r}:{},...i?{effort:i}:{}})),a.status!==200?console.warn(`[internal-hook] on-stop(cloud): status transition failed (HTTP ${a.status}) \u2014 server reaper will reconcile`):console.log("[internal-hook] on-stop: Done (cloud)");try{await b0(s,t?.transcript_path)}catch(c){console.warn("[internal-hook] on-stop transcript-sync failed (non-fatal):",c.message)}try{fn().stopTicker(s)}catch{}await du(s,{deliveryAllowed:!o}),process.exit(0);return}console.error("[internal-hook] on-stop: PlanBee API unreachable/misconfigured \u2014 no local DB fallback in the standalone CLI package."),await du(s,{deliveryAllowed:!o}),process.exit(0)}async function du(t,{deliveryAllowed:e=!0}={}){try{let n=Mo(),s=await n.getSessionInfo(t);if(!s||s.spawnSource!=="user-cli")return;let o=e?await n.claimQueuedMessages(t):[],r=null;if(s.watchMode&&fe("PLANBEE_INJECTED_MESSAGE")!=="true"){let a=qn(),c=a.isWatcherAlive(t);c||(await new Promise(l=>{setTimeout(l,1500)}),c=a.isWatcherAlive(t)),c||(r=n.buildRearmInstruction(t,s.watchTimeout))}let i=null;if(e&&fe("PLANBEE_STOP_TASK_REMINDER")!=="off"&&fe("PLANBEE_INJECTED_MESSAGE")!=="true"){let a=o.length>0;if(a||!n.isStopReminderThrottled(t)){let l=await n.fetchOpenTasks(t);if(l&&l.length>0){let u=await n.fetchTaskFreshness(t);u!==null&&Date.now()-new Date(u).getTime()<n.FRESH_WINDOW_MS&&!a?i=n.buildTaskReminderShort(l,t):i=n.buildTaskReminder(l,t),i&&n.markStopReminderInjected(t)}}}if(o.length===0&&!r&&!i){s.llmType==="agy"&&process.stdout.write(`{}
|
|
267
|
+
`);return}if(o.length>0&&console.error(`[internal-hook] on-stop: delivering ${o.length} queued message(s) via stop-block`),r&&console.error("[internal-hook] on-stop: remote-control active, watcher missing \u2014 enforcing re-arm"),i&&console.error("[internal-hook] on-stop: appending open-task reminder to stop-block"),Ps()&&await He("POST",`/api/v1/agents/${t}/status`,{status:"active"}),s.llmType==="agy"){let a=[];o&&o.length>0&&a.push(`${n.formatMessages(o)}
|
|
268
|
+
|
|
269
|
+
[PlanBee] ${o.length} message(s) were delivered at the end of your turn. Handle them now (reply if Reply-Expected), update your tasks, then finish.`),r&&a.push(r),i&&a.push(i),process.stdout.write(`${JSON.stringify({decision:"continue",reason:a.join(`
|
|
270
|
+
|
|
271
|
+
`)})}
|
|
272
|
+
`)}else process.stdout.write(n.buildStopBlockPayload(o,r,i)),await new Promise(a=>process.stdout.write(`
|
|
273
|
+
`,a))}catch(n){console.error("[internal-hook] on-stop delivery failed (non-fatal):",n.message)}}async function y0(t){try{let e=Mo();if(!await e.isUserCliSession(t))return;let n=await e.claimQueuedMessages(t);if(n.length===0)return;console.error(`[internal-hook] on-prompt: delivering ${n.length} queued message(s) as prompt context`),process.stdout.write(e.buildPromptContext(n)),await new Promise(s=>process.stdout.write(`
|
|
274
|
+
`,s))}catch(e){console.error("[internal-hook] on-prompt delivery failed (non-fatal):",e.message)}}async function fu(t){try{if(fe("PLANBEE_PROMPT_TASK_REMINDER")==="off"||fe("PLANBEE_INJECTED_MESSAGE")==="true")return;let e=Mo();if(e.isPromptReminderThrottled(t))return;let n=Symbol("timeout"),s=(async()=>{let r=await e.fetchOpenTasks(t);return e.buildPromptTaskReminder(r,t)})(),o=await Promise.race([s,new Promise(r=>{setTimeout(()=>r(n),2500)})]);if(o===n||!o)return;console.error("[internal-hook] on-prompt: injecting open-task reminder as prompt context"),process.stdout.write(`${o}
|
|
275
|
+
`),await new Promise(r=>process.stdout.write("",r)),e.markPromptReminderInjected(t)}catch(e){console.error("[internal-hook] on-prompt task-reminder failed (non-fatal):",e.message)}}async function mu(t){try{if(fe("PLANBEE_INJECTED_MESSAGE")==="true")return;let e=Mo(),n=await e.getSessionInfo(t);if(!n||n.spawnSource!=="user-cli")return;let s=qn(),o=r0(),r=s.isWatcherAlive(t),i=o.decideHealAction(n,r,!1);if(i.action==="heal"){let c=await ci().validateAuth();i=o.decideHealAction(n,r,!!c.expiredError)}if(i.action==="none")return;if(o.logHeal({sessionId:t,action:i.action,reason:i.reason,source:"on-prompt"}),i.action==="escalate"){console.error(`[internal-hook] on-prompt: WATCHER-ESKALATION session=${t} reason=auth-dead \u2014 planbee auth login noetig (Re-Arm wuerde sofort wieder sterben, siehe ~/.planbee/logs/watcher-heal.log)`);return}console.error(`[internal-hook] on-prompt: watcher tot zwischen zwei Turns erkannt (reason=${i.reason}) \u2014 Re-Arm-Anweisung als Prompt-Kontext injiziert`),process.stdout.write(`${e.buildRearmInstruction(t,n.watchTimeout)}
|
|
276
|
+
`),await new Promise(a=>process.stdout.write("",a))}catch(e){console.error("[internal-hook] on-prompt watcher-heal failed (non-fatal):",e.message)}}async function hu(){console.log=(...o)=>console.error(...o);let t=await Vn(),e=t?.session_id,s=fe("PLANBEE_SESSION_ID")||null||e;if(fe("PLANBEE_SDK_MANAGED")==="true"){process.exit(0);return}if(!s){console.log("[internal-hook] on-prompt: No session_id, skipping"),process.exit(0);return}if(console.log(`[internal-hook] on-prompt: Session ${s} (CLI: ${e}) -> active`),Ps()){let o=await He("POST",`/api/v1/agents/${s}/status`,{status:"active"});if(o.status!==200?console.warn(`[internal-hook] on-prompt(cloud): HTTP ${o.status}`):console.log("[internal-hook] on-prompt: Done (cloud)"),t?.transcript_path)try{fn().spawnTickerIfNeeded(s,t.transcript_path)}catch{}await y0(s),await mu(s),await fu(s),process.exit(0);return}console.error("[internal-hook] on-prompt: PlanBee API unreachable/misconfigured \u2014 no local DB fallback in the standalone CLI package."),await y0(s),await mu(s),await fu(s),process.exit(0)}async function gu(){console.log=(...l)=>console.error(...l);let t=await Vn(),e=t?.tool_name||"<unknown>",n=t?.session_id,o=fe("PLANBEE_SESSION_ID")||null||n;if(fe("PLANBEE_SDK_MANAGED")==="true"){console.error(`[internal-hook] pre-tool-use: SDK-managed session ${o||"<no-id>"} \u2014 no-op (Pfad 1 nutzt canUseTool direkt)`),process.stdout.write(`${JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow",permissionDecisionReason:"SDK-managed session (Pfad 1) \u2014 handled by SdkAgentRunner.canUseTool"}})}
|
|
277
|
+
`),process.exit(0);return}let r=!1;if(o)try{let l=await He("GET",`/api/v1/agents/${o}/spawn-source`);r=l.status===200&&l.body?.spawnSource==="user-cli"}catch(l){console.error(`[internal-hook] pre-tool-use: spawn_source HTTP lookup failed: ${l.message} \u2014 fallback to allow`)}if(!r){console.error(`[internal-hook] pre-tool-use: non-Pfad-2 session ${o||"<no-id>"} tool=${e} \u2014 allow (Pfad 1/3/unknown)`),process.stdout.write(`${JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow",permissionDecisionReason:"Non-Pfad-2 Session (SDK oder Fremd-Provider oder unknown)"}})}
|
|
278
|
+
`),process.exit(0);return}let i=!1,a=null;if(e==="AskUserQuestion"){let l=t?.tool_input?.questions;if(Array.isArray(l)&&l.length>0){let u=await He("POST",`/api/v1/agents/${o}/question`,{questions:l,cli_pid:process.pid});u.status===409&&u.body&&u.body.code==="QUESTION_ALREADY_PENDING"?(i=!0,console.error(`[internal-hook] pre-tool-use: question announce abgelehnt (409 QUESTION_ALREADY_PENDING, offene Frage=${u.body.open_question_id||"unbekannt"})`)):u.status!==200?console.error(`[internal-hook] pre-tool-use: question announce failed (status=${u.status}) -- falling through to long-poll anyway`):u.body&&u.body.ghost===!0?i=!0:u.body&&typeof u.body.question_id=="string"&&(a=u.body.question_id)}else console.error("[internal-hook] pre-tool-use: AskUserQuestion tool_input.questions missing/empty -- cannot announce")}if(e==="ExitPlanMode"){let l=t?.tool_input?.plan;if(typeof l=="string"&&l.length>0){let u=await He("POST",`/api/v1/agents/${o}/plan-ready`,{plan:l});u.status!==200?console.error(`[internal-hook] pre-tool-use: plan-ready announce failed (status=${u.status}) -- falling through to long-poll anyway`):u.body&&u.body.ghost===!0&&(i=!0)}else console.error("[internal-hook] pre-tool-use: ExitPlanMode tool_input.plan missing/empty -- cannot announce")}if(i){console.error(`[internal-hook] pre-tool-use: ${e}-Announce wurde serverseitig unterdrueckt (ghost:true) fuer ${o} \u2014 kein Long-Poll, sofortiges deny`),process.stdout.write(`${JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:"Die Anfrage konnte nicht angezeigt werden, weil fuer diese Session bereits eine andere Interaktion offen ist. Es wird keine Antwort kommen. Bitte eigenstaendig entscheiden und weiterarbeiten oder die Frage/den Plan spaeter erneut stellen."}})}
|
|
279
|
+
`),process.exit(0);return}console.error(`[internal-hook] pre-tool-use: Pfad-2-Session ${o} tool=${e} \u2014 starte Long-Poll-Bridge`);let c=await E0(o,e,a);process.stdout.write(`${JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:c.permissionDecision,permissionDecisionReason:c.reason}})}
|
|
280
|
+
`),process.exit(0)}var yu=59e4,x0=20,v0=1e3,H2=["ExitPlanMode","AskUserQuestion"],Ts=57e4,Au=19e4,Gn=3;async function w0(t,e,n=Date.now()+yu,s=null){let o=s?`&question_id=${encodeURIComponent(s)}`:"";for(;Date.now()<n;){let r=n-Date.now(),i=Math.max(1,Math.min(x0,Math.floor(r/1e3))),a=await He("GET",`/api/v1/agents/${t}/interaction-answer?wait=${i}${o}`,null,{timeoutMs:i*1e3+5e3});if(a.status===200&&a.body&&a.body.answer){let c=S0(a.body.answer,e);return e==="ExitPlanMode"&&c.permissionDecision==="allow"&&W2(t),c}a.status!==204&&(console.error(`[internal-hook] pre-tool-use: interaction-answer poll status=${a.status} \u2014 retry`),await new Promise(c=>{setTimeout(c,v0)}))}return console.error(`[internal-hook] pre-tool-use: Pfad-2 Long-Poll-Bridge Timeout fuer ${t} (${n-(Date.now()-(n-yu))}ms Budget)`),{permissionDecision:"deny",reason:"Keine Antwort innerhalb des Zeitfensters erhalten (Timeout). Bitte eigenstaendig entscheiden oder die Frage/den Plan erneut stellen."}}async function E0(t,e,n=null){let s=Date.now()+Ts,o=0;for(;Date.now()<s;){o++;let r=s-Date.now(),i=Math.min(s,Date.now()+Au);console.error(`[internal-hook] pre-tool-use: Multi-Round ${o}/${Gn} startet (${Math.round(r/1e3)}s Multi-Round-Budget verbleibend, ${Math.round((i-Date.now())/1e3)}s diese Runde) \u2014 warte weiter sichtbar`);let a=await w0(t,e,i,n);if(!(a.permissionDecision==="deny"&&a.reason.includes("Zeitfensters")))return console.error(`[internal-hook] pre-tool-use: Multi-Round ${o} Antwort erhalten (decision=${a.permissionDecision})`),a;let c=Math.round((s-Date.now())/1e3);console.error(`[internal-hook] pre-tool-use: Multi-Round ${o} Timeout \u2014 ${c}s Multi-Round-Budget verbleibend, starte naechste Runde`)}console.error(`[internal-hook] pre-tool-use: Multi-Round-Gesamtbudget erschoepft (${Ts}ms, ${Gn} Runden)`);try{await He("POST",`/api/v1/agents/${t}/question-timeout`,null)}catch(r){console.error(`[internal-hook] pre-tool-use: question-timeout notify failed: ${r.message} (non-fatal)`)}return{permissionDecision:"deny",reason:`Keine Antwort innerhalb des Multi-Round-Gesamtbudgets (${Ts/1e3}s, ${Gn} Runden). Bitte eigenstaendig entscheiden oder die Frage/den Plan erneut stellen.`}}var z2=60*1e3;function D0(t){let e=require("os"),n=process.env.PLANBEE_PLAN_APPROVAL_DIR||zo.join(e.homedir(),".planbee","plan-approved");return zo.join(n,`${t}.json`)}function W2(t){if(t)try{let e=require("fs"),n=D0(t);e.mkdirSync(zo.dirname(n),{recursive:!0}),e.writeFileSync(n,JSON.stringify({at:Date.now()}),{mode:384})}catch(e){console.error(`[internal-hook] plan-approval marker write failed: ${e.message} (non-fatal)`)}}function J2(t){if(!t)return!1;let e=require("fs"),n=D0(t);try{let s=e.readFileSync(n,"utf8");e.unlinkSync(n);let o=JSON.parse(s).at||0;return Date.now()-o<=z2}catch{try{e.unlinkSync(n)}catch{}return!1}}function S0(t,e){if(t.kind==="question"||e==="AskUserQuestion"){let s=t.answers||{};if(s._dismissed||s._aborted)return{permissionDecision:"deny",reason:"User closed the question dialog without answering. Please continue your task or decide yourself if possible."};let{buildQuestionAnsweredMessage:o}=a0();return{permissionDecision:"deny",reason:o(s)}}let n=t.decision||{};return n.action==="approve"?n.additionalPrompt?{permissionDecision:"deny",reason:`Plan genehmigt. Zus\xE4tzliche Anweisungen vom Nutzer:
|
|
281
|
+
|
|
282
|
+
${n.additionalPrompt}
|
|
283
|
+
|
|
284
|
+
F\xFChre den Plan jetzt aus.`}:{permissionDecision:"allow",reason:"Plan genehmigt."}:n.action==="feedback"?{permissionDecision:"deny",reason:`Der Nutzer hat Feedback zum Plan: ${n.feedback}. Bitte \xFCberarbeite den Plan entsprechend.`}:{permissionDecision:"deny",reason:"Plan wurde abgelehnt. Stoppe die Ausf\xFChrung."}}async function bu(){console.log=(...f)=>console.error(...f);let t=await Vn(),e=t?.tool_name||"<unknown>",n=t?.tool_input??null,s=t?.permission_suggestions??null,o=t?.session_id,i=fe("PLANBEE_SESSION_ID")||null||o,a=(f,m={})=>{process.stdout.write(`${JSON.stringify({hookSpecificOutput:{hookEventName:"PermissionRequest",decision:{behavior:f,...m}}})}
|
|
285
|
+
`),process.exit(0)};if(fe("PLANBEE_SDK_MANAGED")==="true")return console.error(`[internal-hook] permission-request: SDK-managed session ${i||"<no-id>"} \u2014 no-op`),a("allow");let c=!1;if(i)try{let f=await He("GET",`/api/v1/agents/${i}/spawn-source`);c=f.status===200&&f.body?.spawnSource==="user-cli"}catch(f){console.error(`[internal-hook] permission-request: spawn_source HTTP lookup failed: ${f.message} \u2014 fallback to allow`)}if(!c)return console.error(`[internal-hook] permission-request: non-Pfad-2 session ${i||"<no-id>"} tool=${e} \u2014 allow (AC-6 Scope-Grenze)`),a("allow");if(H2.includes(e)){if(console.error(`[internal-hook] permission-request: Pfad-2-Session ${i} tool=${e} \u2014 bereits via PreToolUse-Bridge entschieden, kein zweiter Long-Poll`),e==="ExitPlanMode"){if(!J2(i))return console.error(`[internal-hook] permission-request: ${i} ExitPlanMode ohne frischen Freigabe-Nachweis \u2014 allow OHNE Moduswechsel`),a("allow");try{await He("PATCH",`/api/v1/agents/${i}/permission-mode`,{permissionMode:"bypassPermissions"})}catch(f){console.error(`[internal-hook] permission-request: permission-mode sync failed: ${f.message} (non-fatal)`)}return a("allow",{updatedPermissions:[{type:"setMode",mode:"bypassPermissions",destination:"session"}]})}return a("allow")}let l=await He("POST",`/api/v1/agents/${i}/permission-request`,{toolName:e,toolInput:n,permissionSuggestions:s});l.status!==200&&console.error(`[internal-hook] permission-request: announce failed (status=${l.status}) -- falling through to long-poll anyway`),console.error(`[internal-hook] permission-request: Pfad-2-Session ${i} tool=${e} \u2014 starte Long-Poll-Bridge (Multi-Round)`);let u=0,p=Date.now()+Ts,d=null;for(;Date.now()<p;){u++;let f=p-Date.now(),m=Math.min(p,Date.now()+Au);for(console.error(u===1?`[internal-hook] permission-request: Multi-Round ${u}/${Gn} startet (${Math.round(f/1e3)}s Multi-Round-Budget verbleibend, ${Math.round((m-Date.now())/1e3)}s diese Runde) \u2014 warte weiter sichtbar`:`[internal-hook] permission-request: Multi-Round ${u}/${Gn} startet (${Math.round(f/1e3)}s verbleibend) \u2014 Runde ${u-1} Timeout, fortsetzen`),d=null;Date.now()<m;){let g=m-Date.now(),b=Math.max(1,Math.min(x0,Math.floor(g/1e3))),v=await He("GET",`/api/v1/agents/${i}/interaction-answer?wait=${b}`,null,{timeoutMs:b*1e3+5e3});if(v.status===200&&v.body?.answer?.kind==="permission"){d=v.body.answer.decision;break}v.status!==204&&(console.error(`[internal-hook] permission-request: interaction-answer poll status=${v.status} \u2014 retry`),await new Promise(E=>{setTimeout(E,v0)}))}if(d!==null)return console.error(`[internal-hook] permission-request: Multi-Round ${u} Antwort erhalten (behavior=${d?.behavior})`),d?.behavior==="allow"?a("allow",{...d.updatedInput?{updatedInput:d.updatedInput}:{},...d.updatedPermissions?{updatedPermissions:d.updatedPermissions}:{}}):a("deny",{message:d?.message||"Permission denied by user."});let h=Math.round((p-Date.now())/1e3);console.error(`[internal-hook] permission-request: Multi-Round ${u} Timeout \u2014 ${h}s Multi-Round-Budget verbleibend`)}console.error(`[internal-hook] permission-request: Multi-Round-Gesamtbudget erschoepft (${Ts}ms, ${Gn} Runden)`);try{await He("POST",`/api/v1/agents/${i}/question-timeout`,null)}catch(f){console.error(`[internal-hook] permission-request: question-timeout notify failed: ${f.message} (non-fatal)`)}return a("deny",{message:"Keine Antwort innerhalb des Zeitfensters erhalten (Timeout). Anfrage abgelehnt, bitte erneut versuchen."})}async function xu(){let t=process.env.CLAUDE_SESSION_ID,e=process.env.CLAUDE_ERROR||"Unknown error",n=process.env.CLAUDE_ERROR_STACK||"",s=process.env.CLAUDE_ERROR_CODE||"1";if(console.log(`[internal-hook] ON-ERROR Hook: Capturing error for session ${t}`),Ps()){console.error(`[internal-hook] on-error(cloud): ${e} (code ${s})`),n&&console.error(n),process.exit(0);return}try{let o=require("fs"),r="/tmp/planbee-errors";o.existsSync(r)||o.mkdirSync(r,{recursive:!0});let i=zo.join(r,`${t}.log`),a=`[${new Date().toISOString()}] ERROR
|
|
286
|
+
Session: ${t}
|
|
287
|
+
Message: ${e}
|
|
288
|
+
Stack: ${n}
|
|
289
|
+
Code: ${s}
|
|
290
|
+
|
|
291
|
+
`;o.appendFileSync(i,a),console.log(`[internal-hook] Error logged to ${i}`)}catch(o){console.error(`[internal-hook] Failed to write error log: ${o.message}`)}console.log("[internal-hook] Error logged (event system deprecated)"),process.exit(0)}async function _u(){try{let t=zo.join(process.cwd(),"CLAUDE.md"),e=require("fs").promises;try{let r=(await e.readFile(t,"utf-8")).match(/<!--\s*AGENT_TYPE:\s*(\w+)\s*-->/i);if(r)return r[1].toLowerCase()}catch{}let n=process.argv.join(" ").toLowerCase();if(n.includes("researcher"))return"researcher";if(n.includes("coder"))return"coder";if(n.includes("tester"))return"tester";if(n.includes("reviewer"))return"reviewer";if(n.includes("architect"))return"architect";if(n.includes("debugger"))return"debugger";if(n.includes("optimizer"))return"optimizer";let s=process.cwd().toLowerCase();return s.includes("-researcher")?"researcher":s.includes("-coder")?"coder":s.includes("-tester")?"tester":"unknown"}catch(t){return console.warn("[internal-hook] Agent type discovery failed:",t.message),"unknown"}}async function vu(t){let e=t==="inject-start"?"SessionStart":"PreCompact",n=null;try{n=await Vn()}catch{}let{runInjection:s}=g0();await s({phase:e,stdinData:n})}async function wu(t={}){let e=t.session||fe("PLANBEE_SESSION_ID")||null,n=t["transcript-path"]||t.transcriptPath||null;if(!e||!n){process.exit(0);return}try{let{runTicker:s}=fn();await s(e,{transcriptPath:n})}catch(s){process.stderr.write(`[internal-hook] sync-ticker error (non-fatal): ${s.message}
|
|
292
|
+
`)}process.exit(0)}async function Eu(t={}){let e=t.session||fe("PLANBEE_SESSION_ID")||null,n=t["transcript-path"]||t.transcriptPath||null;if(!e){process.exit(0);return}try{let{runAgyTicker:s}=ko();await s(e,{transcriptPath:n||void 0})}catch(s){process.stderr.write(`[internal-hook] agy-sync-ticker error (non-fatal): ${s.message}
|
|
293
|
+
`)}process.exit(0)}async function k0(t={}){let e=t.session||fe("PLANBEE_SESSION_ID")||null,n=t["transcript-path"]||t.transcriptPath||null;if(!e){process.exit(0);return}try{let{runCodexTicker:s}=eu();await s(e,{transcriptPath:n||void 0})}catch(s){process.stderr.write(`[internal-hook] codex-sync-ticker error (non-fatal): ${s.message}
|
|
294
|
+
`)}process.exit(0)}async function Du(t={}){let e=t.session||fe("PLANBEE_SESSION_ID")||null,n=t["transcript-path"]||t.transcriptPath||null,s=t["log-path"]||null;if(!e){process.exit(0);return}let o=null;if(s)try{let r=require("fs"),i=require("path");r.mkdirSync(i.dirname(s),{recursive:!0}),o=r.openSync(s,"a"),r.writeSync(o,`[${new Date().toISOString()}] [copilot-sync-ticker] started, logging to ${s}
|
|
295
|
+
`)}catch{}try{let{runCopilotTicker:r}=Co();await r(e,{transcriptPath:n||void 0,logFd:o})}catch(r){o!==null&&require("fs").writeSync(o,`[${new Date().toISOString()}] [internal-hook] copilot-sync-ticker error: ${r.message}
|
|
296
|
+
`)}if(o!==null)try{require("fs").closeSync(o)}catch{}process.exit(0)}async function K2(){process.argv.includes("inject-start")||process.argv.includes("inject-compact")||(console.log("================================================="),console.log("[internal-hook] MAIN() AUFGERUFEN"),console.log("[internal-hook] process.argv:",process.argv),console.log("================================================="));let e=process.argv.slice(2),n=e.indexOf("--type");if(n===-1||!e[n+1]){console.error("[internal-hook] Error: --type parameter required"),console.error("Usage: planbee internal-hook --type <start|pre-invocation|on-compact|finish|on-error|on-stop|on-prompt|sync-ticker|inject-start|inject-compact>"),process.exit(1);return}let s=e[n+1];if(s==="inject-start"||s==="inject-compact"){await vu(s),await new Promise(o=>process.stdout.write("",o)),process.exit(0);return}switch(console.log("[internal-hook] Hook-Type:",s),s){case"start":console.log("[internal-hook] \u2192 Rufe handleStartHook() auf..."),await cu();break;case"pre-invocation":console.log("[internal-hook] \u2192 Rufe handlePreInvocationHook() auf..."),await au();break;case"on-compact":console.log("[internal-hook] \u2192 Rufe handleOnCompactHook() auf..."),await lu();break;case"finish":console.log("[internal-hook] \u2192 Rufe handleFinishHook() auf..."),await uu();break;case"on-error":console.log("[internal-hook] \u2192 Rufe handleOnErrorHook() auf..."),await xu();break;case"on-stop":console.log("[internal-hook] \u2192 Rufe handleOnStopHook() auf..."),await pu();break;case"on-prompt":console.log("[internal-hook] \u2192 Rufe handleOnPromptHook() auf..."),await hu();break;case"pre-tool-use":console.log("[internal-hook] \u2192 Rufe handlePreToolUseHook() auf..."),await gu();break;case"permission-request":console.log("[internal-hook] \u2192 Rufe handlePermissionRequestHook() auf..."),await bu();break;case"sync-ticker":{let o=e.indexOf("--session"),r=e.indexOf("--transcript-path");await wu({session:o!==-1?e[o+1]:void 0,"transcript-path":r!==-1?e[r+1]:void 0});break}case"agy-sync-ticker":{let o=e.indexOf("--session"),r=e.indexOf("--transcript-path");await Eu({session:o!==-1?e[o+1]:void 0,"transcript-path":r!==-1?e[r+1]:void 0});break}case"codex-sync-ticker":{let o=e.indexOf("--session"),r=e.indexOf("--transcript-path");await k0({session:o!==-1?e[o+1]:void 0,"transcript-path":r!==-1?e[r+1]:void 0});break}case"copilot-sync-ticker":{let o=e.indexOf("--session"),r=e.indexOf("--transcript-path"),i=e.indexOf("--log-path");await Du({session:o!==-1?e[o+1]:void 0,"transcript-path":r!==-1?e[r+1]:void 0,"log-path":i!==-1?e[i+1]:void 0});break}default:console.error(`[internal-hook] Error: Unknown hook type '${s}'`),console.error("Valid types: start, pre-invocation, on-compact, finish, on-error, on-stop, on-prompt, pre-tool-use, permission-request, sync-ticker, agy-sync-ticker, codex-sync-ticker, copilot-sync-ticker"),process.exit(1)}}require.main===Cu&&K2().catch(t=>{console.error("[internal-hook] Fatal error:",t.message),process.exit(0)});Cu.exports={command:"internal-hook",describe:"Internal hook handler for Claude CLI/AGY integration (SessionStart, PreInvocation, PreCompact, PreToolUse, SessionEnd, Stop, UserPromptSubmit)",builder:t=>t.option("deliver",{describe:"Enable hook-based message delivery (set by current settings generation; stdout must be unredirected)",type:"boolean",default:!1}).option("type",{describe:"Hook type to execute",type:"string",choices:["start","pre-invocation","on-compact","finish","on-error","on-stop","on-prompt","pre-tool-use","permission-request","sync-ticker","agy-sync-ticker","codex-sync-ticker","copilot-sync-ticker","inject-start","inject-compact"],demandOption:!0,requiresArg:!0}).option("session",{describe:"Session ID (sync-ticker)",type:"string"}).option("transcript-path",{describe:"Transcript JSONL path (sync-ticker)",type:"string"}).option("log-path",{describe:"Log file path for stderr redirection (copilot-sync-ticker)",type:"string"}).example("planbee internal-hook --type start","Trigger SessionStart hook").example("planbee internal-hook --type pre-invocation","Trigger PreInvocation hook").example("planbee internal-hook --type inject-start","Print SessionStart prompt injection to stdout").example("planbee internal-hook --type finish","Trigger SessionEnd hook").example("planbee internal-hook --type on-stop","Trigger Stop hook (agent idle)").example("planbee internal-hook --type on-prompt","Trigger UserPromptSubmit hook (agent active)").example("planbee internal-hook --type pre-tool-use","Trigger PreToolUse hook (Pfad 2 interactive-terminal bridge)").strict(),handler:async t=>{let e=t.type;try{if(e==="inject-start"||e==="inject-compact"){await vu(e),await new Promise(n=>process.stdout.write("",n)),process.exit(0);return}switch(e){case"start":await cu();break;case"pre-invocation":await au();break;case"on-compact":await lu();break;case"finish":await uu();break;case"on-error":await xu();break;case"on-stop":await pu();break;case"on-prompt":await hu();break;case"pre-tool-use":await gu();break;case"permission-request":await bu();break;case"sync-ticker":await wu(t);break;case"agy-sync-ticker":await Eu(t);break;case"codex-sync-ticker":await k0(t);break;case"copilot-sync-ticker":await Du(t);break;default:console.error(`[internal-hook] Error: Unknown hook type '${e}'`),console.error("Valid types: start, pre-invocation, on-compact, finish, on-error, on-stop, on-prompt, pre-tool-use, permission-request, sync-ticker, agy-sync-ticker, codex-sync-ticker, copilot-sync-ticker"),process.exit(1)}}catch(n){console.error("[internal-hook] Fatal error:",n.message),process.exit(0)}},handleStartHook:cu,handlePreInvocationHook:au,handleOnCompactHook:lu,handleFinishHook:uu,handleOnErrorHook:xu,handleOnStopHook:pu,handleOnPromptHook:hu,handlePreToolUseHook:gu,handlePermissionRequestHook:bu,_resolvePath2InteractionDecision:w0,_resolvePath2InteractionDecisionMultiRound:E0,_formatPath2Answer:S0,PATH2_HOOK_BUDGET_MS:yu,PATH2_MULTI_ROUND_BUDGET_MS:Ts,PATH2_ROUND_BUDGET_MS:Au,PATH2_MULTI_ROUND_MAX_ROUNDS:Gn,handleInjectHook:vu,handleSyncTickerHook:wu,handleAgySyncTickerHook:Eu,handleCopilotSyncTickerHook:Du,discoverAgentType:_u,detectCliProvider:ku,getClaudeProcessPid:Si,readStdinJSON:Vn,getHookContext:Wo,sendHttpNotify:Di,_deliverViaStopBlock:du,_injectPromptTaskReminder:fu,_healWatcherOnPrompt:mu}});var T0=D((j3,O0)=>{var Tu=require("fs"),{createApiClient:G2}=lt(),{getEnv:C0}=Be(),V2={pending:"planned",cancelled:"completed",canceled:"completed",done:"completed",in_progress:"active","in-progress":"active",started:"active",ready:"prepared"};function A0(t){return V2[t]||t}var{resolveApiUrl:Y2}=te(),X2=Y2();function Q2(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)}var Z2={command:"progress",describe:"Update agent task progress",builder:t=>t.option("task",{alias:"t",type:"string",description:"Current task description (single-task mode)"}).option("tasks",{alias:"T",type:"string",description:"JSON array of tasks for batch mode: [{key,title,status,percent}]"}).option("percent",{alias:"p",type:"number",description:"Completion percentage (0-100)"}).option("status",{alias:"S",type:"string",description:"Task status: planned, active, completed, prepared, blocked (default: active)"}).option("key",{alias:"k",type:"string",description:"Task key for single-task mode (auto-generated from title if not set)"}).option("parent-key",{alias:"P",type:"string",description:"Parent task key for subtask hierarchy (single-task mode)"}).option("topic",{type:"string",description:'Overarching topic/theme for this session (e.g. "INF-400: Feature X")'}).option("session",{alias:"s",type:"string",description:"Session ID (defaults to PLANBEE_SESSION_ID env var)"}).option("state",{type:"string",description:`JSON state metadata for the task (e.g. '{"step":"auth","files_modified":["src/auth.js"]}')`}).option("state-file",{type:"string",description:"Path to a JSON file containing state metadata (avoids shell quoting issues)"}).option("resolution",{type:"string",description:"Human-readable resolution log for the task (pre-compact handover notes)"}).option("resolution-file",{type:"string",description:"Path to a text file containing the resolution log (avoids shell quoting issues)"}).option("tasks-file",{type:"string",description:"Path to a JSON file containing the tasks array (avoids shell quoting issues)"}).option("compact-ready",{type:"boolean",description:"Signal that agent is ready for circle-compact (context window nearing limit)",default:!1}).option("estimate",{alias:"e",type:"number",description:"Estimated minutes for the task (e.g. 30 for 30 minutes)"}).option("json",{type:"boolean",description:"Output as JSON",default:!1}).check(e=>{if(!e.task&&!e.tasks&&!e.tasksFile&&!e.topic&&!e.compactReady)throw new Error("Either --task, --tasks, --tasks-file, --topic, or --compact-ready is required");if(e.task&&(e.tasks||e.tasksFile))throw new Error("Cannot use both --task and --tasks/--tasks-file");if(e.tasks&&e.tasksFile)throw new Error("Cannot use both --tasks and --tasks-file");if(e.state&&e.stateFile)throw new Error("Cannot use both --state and --state-file");if(e.resolution&&e.resolutionFile)throw new Error("Cannot use both --resolution and --resolution-file");if(e.percent!==void 0&&(e.percent<0||e.percent>100))throw new Error("Percent must be between 0 and 100");return!0}),handler:async t=>{let e=t.session||C0("PLANBEE_SESSION_ID");e||(console.error("Error: Session ID required (use --session or set PLANBEE_SESSION_ID)"),process.exit(1));let n=null,s=t.tasksFile?(()=>{try{return Tu.readFileSync(t.tasksFile,"utf8").trim()}catch(a){console.error(`Error reading --tasks-file: ${a.message}`),process.exit(1)}})():t.tasks;if(s)try{if(n=JSON.parse(s),!Array.isArray(n))throw new Error("--tasks must be a JSON array");for(let a of n)a.status&&(a.status=A0(a.status))}catch(a){console.error(`Error parsing --tasks JSON: ${a.message}`),console.error("Hint: Your JSON is not valid. Ensure proper encoding of special characters (quotes, apostrophes, backslashes)."),console.error("Tip: Use --tasks-file /tmp/tasks.json to avoid shell quoting issues."),process.exit(1)}else if(t.task){let a=t.status?A0(t.status):t.percent===100?"completed":"active",c={key:t.key||Q2(t.task),title:t.task,status:a,percent:t.percent!==void 0?t.percent:0};t.parentKey&&(c.parentKey=t.parentKey),t.estimate!==void 0&&(c.estimatedMinutes=t.estimate);let l=t.stateFile?(()=>{try{return Tu.readFileSync(t.stateFile,"utf8").trim()}catch(p){console.error(`Error reading --state-file: ${p.message}`),process.exit(1)}})():t.state;if(l)try{c.state=JSON.parse(l)}catch(p){console.error(`Error parsing --state JSON: ${p.message}`),console.error("Hint: Your JSON is not valid. Ensure proper encoding of special characters (quotes, apostrophes, backslashes)."),console.error("Tip: Use --state-file /tmp/state.json to avoid shell quoting issues."),process.exit(1)}let u=t.resolutionFile?(()=>{try{return Tu.readFileSync(t.resolutionFile,"utf8").trim()}catch(p){console.error(`Error reading --resolution-file: ${p.message}`),process.exit(1)}})():t.resolution;u&&(c.resolution=u),n=[c]}let o=t.topic||null,r=t.compactReady||!1,i=await ej(e,n,o,r);if(i){if(i._rejected){console.error(i.error||"Request rejected by API"),process.exitCode=1;return}let a=i.tasks||[];if(t.json)console.log(JSON.stringify({success:!0,sessionId:e,topic:i.topic||o,tasks:a,activeTask:i.activeTask||null,openCount:i.openCount||0,accuracy:i.accuracy||null,timestamp:new Date().toISOString()}));else{if(o&&console.log(`Topic set: ${o}`),a.length>0){let u=n?n.length:0;console.log(`Progress updated: ${u} task${u!==1?"s":""}`);let p={};for(let h of a)p[h.key]=h;let d=[],f={};for(let h of a)h.parentKey&&p[h.parentKey]?(f[h.parentKey]||(f[h.parentKey]=[]),f[h.parentKey].push(h)):d.push(h);let m=(h,g)=>{let b=h.status==="completed"?"[done]":h.status==="active"?"[>>>]":"[...]",v=" ".repeat(g+1),E="";h.actualMinutes!=null&&h.estimatedMinutes!=null?E=` \u2014 ${h.actualMinutes}m actual / ${h.estimatedMinutes}m est.`:h.actualMinutes!=null?E=` \u2014 ${h.actualMinutes}m actual`:h.estimatedMinutes!=null&&(E=` \u2014 ~${h.estimatedMinutes}m est.`),console.log(`${v}${b} ${h.title} (${h.percent||0}%)${E}`);let S=f[h.key]||[];for(let C of S)m(C,g+1)};for(let h of d)m(h,0);if(i.accuracy?.sampleCount>0){let{avgRatio:h,sampleCount:g}=i.accuracy,b;h>=.8&&h<=1.2?b="well calibrated":h>1.2?b="underestimated":b="overestimated",console.log(`
|
|
297
|
+
Estimate accuracy: ${h.toFixed(1)}x (${b}, n=${g})`)}}i.isFirstRegistration&&(console.log(""),console.log("=== TASK FIELD REFERENCE (shown once on first registration) ==="),console.log(""),console.log("Supported fields in --tasks JSON array:"),console.log(" key string Unique ID (auto-generated from title if omitted)"),console.log(" title string Task description"),console.log(" status string planned | active | completed | blocked"),console.log(" percent number 0-100"),console.log(" parentKey string Parent task key for subtask hierarchy (max 3 levels)"),console.log(" estimatedMinutes number Estimated duration in minutes (set upfront for calibration!)"),console.log(" actualMinutes \u2014 Auto-computed from started_at \u2192 completed_at (read-only)"),console.log(" state object JSON context: {step, files_modified, decisions, next_action}"),console.log(" resolution string Completion notes (required for completed tasks)"),console.log(""),console.log(" Calibration: Set estimatedMinutes when registering tasks. After completion,"),console.log(' the system shows "Estimate accuracy: X.Xx" \u2014 use this to improve future estimates.'),console.log(""),console.log("TIP: Avoid JSON encoding issues \u2014 use --tasks-file instead of --tasks:"),console.log(""),console.log(" cat > /tmp/tasks.json << 'EOF'"),console.log(" ["),console.log(' {"key":"task-1","title":"Analysis","status":"active","percent":0,"estimatedMinutes":30},'),console.log(' {"key":"task-2","title":"Implementation","status":"planned","percent":0,"estimatedMinutes":60},'),console.log(' {"key":"task-2a","title":"Backend","status":"planned","percent":0,"parentKey":"task-2","estimatedMinutes":40}'),console.log(" ]"),console.log(" EOF"),console.log(" planbee progress --session $PLANBEE_SESSION_ID --tasks-file /tmp/tasks.json"),console.log(""),console.log("==="));let c=t.state||n&&n.some(u=>u.state),l=new Set;if(!i.compactReady){if(n){let u=n.filter(p=>p.status==="completed"&&!p.resolution);for(let p of u){let d=a.find(f=>f.key===p.key);d&&!d.resolution&&(console.log(""),console.log(`[!] Task "${p.title}" completed without --resolution. Future agents won't know what was accomplished.
|
|
298
|
+
|
|
299
|
+
Add --resolution to document what was accomplished:
|
|
300
|
+
planbee progress --session $PLANBEE_SESSION_ID --task "${p.title}" \\
|
|
301
|
+
--key ${p.key} --status completed --percent 100 \\
|
|
302
|
+
--resolution "Describe what was completed and what works now"
|
|
303
|
+
|
|
304
|
+
Example: --resolution "API implemented with 5 endpoints. All tests pass."`),l.add(`resolution:${p.key}`))}}if(!c){let u=a.find(p=>p.status==="active");u&&(u.percent||0)>=50&&!u.state&&(console.log(""),console.log(`WARNING: Task "${u.title}" at ${u.percent}% has no state object.
|
|
305
|
+
|
|
306
|
+
Add --state to preserve context across compaction:
|
|
307
|
+
--state '{"step":"current-phase","files":["modified-files"],"next":"next-action"}'
|
|
308
|
+
|
|
309
|
+
Example: --state '{"step":"testing","files":["api.js"],"next":"Write unit tests"}'`),l.add(`state:${u.key}`))}}if(i.stateWarnings&&i.stateWarnings.length>0&&n){let u=new Set(n.map(d=>d.key)),p=i.stateWarnings.filter(d=>{let f=d.match(/Task "([^"]+)" completed without resolution/),m=d.match(/Task "([^"]+)" is at \d+% but has no state/),h=f?.[1]||m?.[1];if(!h)return!1;let g=a.find(b=>b.title===h);return!(!g||!u.has(g.key)||l.has(`resolution:${g.key}`)||l.has(`state:${g.key}`))});if(p.length>0){console.log("");for(let d of p)console.log(d)}}i.reminder&&(console.log(""),console.log(i.reminder)),t.compactReady&&(console.log(""),console.log("\u26A0 Circle-Compact is disabled. Using auto-compact only. --compact-ready signal was ignored."))}process.exit(0)}console.error(`[progress] FATAL: PlanBee API nicht erreichbar (${X2}). Kein lokaler DB-Fallback im standalone CLI-Paket.`),console.error("[progress] Pruefe Server-Health/Netzwerk. Fuer lokale Entwicklung: --local oder PLANBEE_API_URL=http://localhost:3456."),process.exit(1)}};function _0(t,e,n,s,o){let r={};e&&e.length>0&&(r.tasks=e),n&&(r.topic=n),s&&(r.compactReady=!0);let i={},a=C0("PLANBEE_SESSION_ID");return a&&(i["X-PlanBee-Session-Id"]=a),G2().post(`/api/v1/agents/${t}/tasks`,r,{timeout:o,headers:i}).then(l=>l.data||{}).catch(l=>{let u=l.response?.status;return u>=400&&u<500?{_rejected:!0,...l.response.data||{error:`HTTP ${u}`}}:null})}async function ej(t,e,n,s){let o=await _0(t,e,n,s,1e4);return o!==null?o:(await new Promise(r=>setTimeout(r,1e3)),_0(t,e,n,s,2e4))}O0.exports=Z2});var N0=D((L3,$0)=>{var{createApiClient:tj}=lt(),{getEnv:P0}=Be(),nj={command:"tasks [session-id]",describe:"List agent tasks for a session",builder:t=>t.positional("session-id",{describe:"Agent session ID (or use PLANBEE_SESSION_ID)",type:"string"}).option("session",{alias:"s",type:"string",description:"Legacy option for session ID",hidden:!0}).option("all",{alias:"a",type:"boolean",description:"Show all tasks including completed (default: only open)",default:!1}).option("json",{type:"boolean",description:"Output as JSON",default:!1}).option("verbose",{alias:"v",type:"boolean",description:"Show state objects and resolution logs for each task",default:!1}).check(e=>{if(!(e["session-id"]||e.session||P0("PLANBEE_SESSION_ID")))throw new Error("Session ID required (use positional arg <session-id> or set PLANBEE_SESSION_ID)");return!0}),handler:async t=>{let e=t["session-id"]||t.session||P0("PLANBEE_SESSION_ID"),n=await sj(e);n||(console.error("Error: Could not connect to PlanBee API"),process.exit(1)),n.success||(console.error(`Error: ${n.error||"Unknown error"}`),process.exit(1));let s=n.tasks||[];t.all||(s=s.filter(u=>u.status==="planned"||u.status==="active"||u.status==="blocked")),s.length===0&&(t.json?console.log(JSON.stringify({success:!0,sessionId:e,items:[],totalCount:0,tasks:[],summary:{open:0,completed:0,total:0}},null,2)):t.all?console.log("No tasks found for this session."):console.log("No open tasks. Use --all to show completed tasks."),process.exit(0));let o={};for(let u of s)o[u.key]=u;let i=(u=>{let p=[],d={};for(let m of u)m.parentKey&&o[m.parentKey]?(d[m.parentKey]||(d[m.parentKey]=[]),d[m.parentKey].push(m)):p.push(m);let f=m=>{let h={...m},g=d[m.key]||[];return g.length>0&&(h.children=g.map(f)),h};return p.map(f)})(s),a=s.filter(u=>u.status!=="completed").length,c=s.filter(u=>u.status==="completed").length;t.json&&(console.log(JSON.stringify({success:!0,sessionId:e,items:i,totalCount:i.length,summary:{open:a,completed:c,total:s.length},tasks:i},null,2)),process.exit(0));let l={session:e,summary:{open:a,completed:c,total:s.length},tasks:i};console.log(JSON.stringify(l,null,2)),console.log(""),console.log("// Aufgaben pflegen:"),console.log('// Neu: planbee progress --task "Titel" --key k --percent 0'),console.log(`// Aktiv: planbee progress --task "Titel" --key k --percent 50 --state '{"step":"phase","next":"..."}' `),console.log('// Erledigt: planbee progress --task "Titel" --key k --percent 100 --resolution "Was wurde erreicht"'),console.log("// [!] = fehlende Resolution/State [s] = State vorhanden"),process.exit(0)}};function sj(t){return tj().get(`/api/v1/agents/${t}/tasks`,{timeout:3e3}).then(n=>n.data??null).catch(n=>n.response?.data?n.response.data:null)}$0.exports=nj});var B0=D((B3,L0)=>{var ki=require("path"),oj=require("os"),rj=require("fs"),Ai=oj.homedir(),I0=ki.join(Ai,".planbee"),R0=ki.join(Ai,".planbee","agents","logs"),F0=ki.join(Ai,".maestro-speak"),j0=ki.join(Ai,".maestro","agents","logs"),ij="/tmp/maestro-agents";function Pu(t){try{return rj.existsSync(t)}catch{return!1}}function aj(t=Pu){return $u(I0,F0,t)}function cj(t=Pu){return $u(R0,j0,t)}function $u(t,e,n=Pu){return n(t)?t:n(e)?e:t}L0.exports={NEW_CONFIG_DIR:I0,NEW_AGENT_LOG_DIR:R0,LEGACY_CONFIG_DIR:F0,LEGACY_AGENT_LOG_DIR:j0,LEGACY_TEMP_AGENT_LOG_DIR:ij,getConfigDir:aj,getAgentLogDir:cj,resolveWithFallback:$u}});var U0=D((q3,M0)=>{var Nu=require("fs").promises,q0=require("path"),{getConfigDir:lj}=B0(),Iu=class{constructor(e=null){this.configPath=e||q0.join(lj(),"voice-settings.json"),this.defaults={defaultVoice:"alloy",defaultFallbackVoice:"Helena",defaultVolume:.8,defaultSpeed:1,ttsModel:"gpt-4o-mini-tts",ttsFormat:"mp3",defaultProvider:"openai"},this.settings={...this.defaults},this.allowedVoices=["alloy","ash","ballad","coral","echo","fable","marin","nova","onyx","sage","shimmer","verse","cedar"],this.allowedModels=["tts-1","tts-1-hd","gpt-4o-mini-tts"],this.allowedFormats=["mp3","opus","aac","flac","wav","pcm"]}async load(){try{let e=await Nu.readFile(this.configPath,"utf-8"),n=JSON.parse(e);this.settings={...this.defaults,...n}}catch{this.settings={...this.defaults}}}async save(){try{let e=q0.dirname(this.configPath);await Nu.mkdir(e,{recursive:!0}),await Nu.writeFile(this.configPath,JSON.stringify(this.settings,null,2),"utf-8")}catch(e){throw console.error("Failed to save voice settings:",e),e}}async getDefaultVoice(){return this.settings.defaultVoice}async getDefaultFallbackVoice(){return this.settings.defaultFallbackVoice}async getDefaultVolume(){return this.settings.defaultVolume}async getDefaultSpeed(){return this.settings.defaultSpeed}async setDefaultVoice(e){if(!this.allowedVoices.includes(e))throw new Error(`Invalid OpenAI voice: ${e}. Allowed voices: ${this.allowedVoices.join(", ")}`);this.settings.defaultVoice=e,await this.save()}async setDefaultFallbackVoice(e){this.settings.defaultFallbackVoice=e,await this.save()}async setDefaultVolume(e){if(e<0||e>1)throw new Error("Volume must be between 0 and 1");this.settings.defaultVolume=e,await this.save()}async setDefaultSpeed(e){if(e<.5||e>2)throw new Error("Speed must be between 0.5 and 2.0");this.settings.defaultSpeed=e,await this.save()}async getTtsModel(){return this.settings.ttsModel}async setTtsModel(e){if(!this.allowedModels.includes(e))throw new Error(`Invalid TTS model: ${e}. Allowed: ${this.allowedModels.join(", ")}`);this.settings.ttsModel=e,await this.save()}async getTtsFormat(){return this.settings.ttsFormat}async setTtsFormat(e){if(!this.allowedFormats.includes(e))throw new Error(`Invalid TTS format: ${e}. Allowed: ${this.allowedFormats.join(", ")}`);this.settings.ttsFormat=e,await this.save()}async getDefaultProvider(){return this.settings.defaultProvider||"openai"}async setDefaultProvider(e){let n=["openai"];if(!n.includes(e))throw new Error(`Invalid TTS provider: ${e}. Allowed: ${n.join(", ")}`);this.settings.defaultProvider=e,await this.save()}async getAllSettings(){return{...this.settings}}async resetToDefaults(){this.settings={...this.defaults},await this.save()}};M0.exports=Iu});var z0=D((M3,H0)=>{var uj=U0(),pj="tts-config",dj="Configure TTS model and audio format settings",fj=t=>t.option("model",{alias:"m",type:"string",description:"TTS model (tts-1, tts-1-hd, gpt-4o-mini-tts)"}).option("format",{alias:"f",type:"string",description:"Audio format (mp3, opus, aac, flac, wav, pcm)"}).option("show",{alias:"s",type:"boolean",description:"Show current settings"}).option("json",{type:"boolean",description:"Output as JSON"}).example("$0 audio tts-config --show","Show current TTS settings").example("$0 audio tts-config --model tts-1-hd","Use high-definition model").example("$0 audio tts-config --format opus","Use opus format for lower latency"),mj=async t=>{let e=new uj;await e.load();let{model:n,format:s,show:o,json:r}=t;if(n)try{await e.setTtsModel(n),r||console.log(`TTS model set to: ${n}`)}catch(i){console.error(`Error: ${i.message}`),process.exit(1)}if(s)try{await e.setTtsFormat(s),r||console.log(`TTS format set to: ${s}`)}catch(i){console.error(`Error: ${i.message}`),process.exit(1)}if(o||!n&&!s){let i=await e.getAllSettings();r?console.log(JSON.stringify({ttsModel:i.ttsModel,ttsFormat:i.ttsFormat,defaultVoice:i.defaultVoice,defaultSpeed:i.defaultSpeed,defaultVolume:i.defaultVolume},null,2)):(console.log(`
|
|
310
|
+
TTS Configuration:`),console.log("=================="),console.log(`Model: ${i.ttsModel}`),console.log(`Format: ${i.ttsFormat}`),console.log(`Voice: ${i.defaultVoice}`),console.log(`Speed: ${i.defaultSpeed}`),console.log(`Volume: ${i.defaultVolume}`),console.log(""),console.log("Available models: tts-1, tts-1-hd, gpt-4o-mini-tts"),console.log("Available formats: mp3, opus, aac, flac, wav, pcm"))}};H0.exports={command:pj,describe:dj,builder:fj,handler:mj}});var Fu=D((U3,G0)=>{var on=require("fs").promises,zt=require("path");function W0(){return'---\ndescription: Register a new PlanBee agent session\n---\n\n# PlanBee Register\n\nRegister the current session as a PlanBee agent so the dashboard and other agents can reach it.\n\n## When to use\n\n- At the start of your turn, when starting a new agent session.\n- When your operator (or a coordinator agent) asks you to register so this session shows up on the dashboard.\n\n## Invocation\n\n```\nplanbee register \\\n --folder <absolute-path-to-workspace> \\\n --task "<short description of what you will do>" \\\n --agent-type <type> \\\n [--parent <parent-session-id>] \\\n [--session-id <explicit-uuid>] \\\n [--json]\n```\n\n## Flags\n\nRequired:\n- `--folder <path>` -- absolute path to the workspace folder.\n- `--task "<description>"` -- short task description.\n- `--agent-type <type>` -- one of the built-in types (`coder`, `researcher`, `tester`, `reviewer`, `architect`, `debugger`, `optimizer`, `guard`, `watchdog`, `queen`, `planbee-queen`, `planbee-proxy`, `planbee-coordinator`, `planbee-default`) or a custom type from the DB.\n\nOptional:\n- `--parent <id>` -- parent session ID.\n- `--session-id <uuid>` -- explicit session UUID (auto-generated if omitted).\n- `--json` -- emit a machine-readable JSON response instead of the short text confirmation.\n- `--force` -- create a new session even if an active session already exists for this folder.\n- `--user-managed` -- mark the session as user-managed (the system will never respawn it).\n\n## Environment variables\n\n`$PLANBEE_SESSION_ID` and `$PLANBEE_PARENT_ID` are exported for agents spawned by PlanBee. Use them literally as shown in the SessionStart block of this conversation. If you are running in a terminal session started by hand (not spawned by PlanBee) and the variables are not set, pass `--session-id` explicitly with the value you obtained from the watcher registration.\n\n## Response\n\n- Without `--json`: a short text confirmation (`Session ID`, `Agent Type`, `Status`, optional `Parent`).\n- With `--json`: a machine-readable JSON object. Always use `--json` if you intend to parse the result or forward it to another agent.\n'}function J0(){return`---
|
|
311
|
+
description: PlanBee Remote-Control for this session (on/off/status). Wakes the session on inbox messages from any device.
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
# PlanBee Remote Control
|
|
315
|
+
|
|
316
|
+
Argument: $ARGUMENTS -- \`on\` (Default), \`off\` or \`status\`.
|
|
317
|
+
|
|
318
|
+
## on (Default, also when the argument is empty)
|
|
319
|
+
|
|
320
|
+
1. Determine your session ID:
|
|
321
|
+
- If the shell variable \`$PLANBEE_SESSION_ID\` is already set (PlanBee-
|
|
322
|
+
spawned agent process), use it directly.
|
|
323
|
+
- Otherwise (manually opened terminal): substitute the session ID
|
|
324
|
+
literally, as shown in the SessionStart block of this conversation.
|
|
325
|
+
Do NOT pass the literal string \`$PLANBEE_SESSION_ID\` to the CLI.
|
|
326
|
+
2. Run:
|
|
327
|
+
\`\`\`
|
|
328
|
+
planbee remote-control on --session <your-session-id>
|
|
329
|
+
planbee inbox --wait --session <your-session-id> --timeout 14400
|
|
330
|
+
\`\`\`
|
|
331
|
+
The second command MUST be a Bash tool call with \`run_in_background: true\`
|
|
332
|
+
(never in the foreground) so the Stop hook can wake you on new messages.
|
|
333
|
+
3. Confirm to the user: remote-control is on -- messages from any device
|
|
334
|
+
(planbee send, Electron, Mobile) wake this session automatically.
|
|
335
|
+
|
|
336
|
+
Rules after activation:
|
|
337
|
+
- When the watcher background task ends, READ its output and follow it
|
|
338
|
+
exactly: \`planbee inbox --read-all\` -> \`planbee inbox --confirm <ids>\` ->
|
|
339
|
+
handle the request -> re-arm the watcher with the same background command
|
|
340
|
+
before ending your turn.
|
|
341
|
+
- A timeout exit is not an error -- just re-arm.
|
|
342
|
+
- The Stop hook enforces re-arming: without a running watcher your turn
|
|
343
|
+
will not end.
|
|
344
|
+
|
|
345
|
+
## off
|
|
346
|
+
|
|
347
|
+
1. Determine your session ID (same rule as "on"): use the shell variable
|
|
348
|
+
if set, otherwise substitute the literal from the SessionStart block.
|
|
349
|
+
2. Run: \`planbee remote-control off --session <your-session-id>\`
|
|
350
|
+
3. The running watcher terminates itself (within ~30s). Do NOT re-arm.
|
|
351
|
+
|
|
352
|
+
## status
|
|
353
|
+
|
|
354
|
+
Run \`planbee remote-control status --session <your-session-id>\` and summarise
|
|
355
|
+
the result briefly (mode on/off, watcher process alive yes/no, heartbeat).
|
|
356
|
+
`}function Ru(t){switch(t){case".claude":return{kind:"markdown",dir:"commands",ext:".md"};case".codex":return{kind:"markdown",dir:"prompts",ext:".md"};case".agents":return{kind:"skill",dir:"skills",ext:"SKILL.md"};case".gemini":return{kind:"toml",dir:"commands",ext:".toml"};default:throw new Error(`Unknown target dir: ${t}`)}}async function K0(t,e,n,s){let o=Ru(e.dir),r=zt.join(t,o.dir);if(await on.mkdir(r,{recursive:!0}),o.kind==="toml"){try{await on.unlink(zt.join(r,`${n}.md`))}catch{}let i=n==="planbee-register"?"Register a new PlanBee agent session":"PlanBee remote-control for this session",a=s.replace(/\\/g,"\\\\").replace(/"""/g,'\\"\\"\\"'),c=`description = "${i}"
|
|
357
|
+
prompt = """
|
|
358
|
+
${a}
|
|
359
|
+
"""
|
|
360
|
+
`;await on.writeFile(zt.join(r,`${n}${o.ext}`),c,"utf-8");return}if(o.kind==="skill"){let i=zt.join(r,n);await on.mkdir(i,{recursive:!0});let a=n==="planbee-register"?"Register a new PlanBee agent session":"PlanBee remote-control for this session",c=s.replace(/^---\n[\s\S]*?\n---\n/,""),l=`---
|
|
361
|
+
name: ${n}
|
|
362
|
+
description: ${a}
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
${c}`;await on.writeFile(zt.join(i,o.ext),l,"utf-8");return}await on.writeFile(zt.join(r,`${n}${o.ext}`),s,"utf-8")}async function hj(t,e){let n=[{name:"planbee-register",body:W0()},{name:"planbee-remote",body:J0()}];for(let{name:s,body:o}of n)await K0(t,e,s,o)}async function gj(t,e){let n=Ru(e.dir),s=zt.join(t,n.dir),o=["planbee-register","planbee-remote"];for(let r of o){try{await on.unlink(zt.join(s,`${r}${n.ext}`))}catch{}if(n.kind==="skill"){let i=zt.join(s,r);try{await on.rm(i,{recursive:!0,force:!0})}catch{}}if(e.dir===".gemini")try{await on.unlink(zt.join(s,`${r}.md`))}catch{}}}G0.exports={buildRegisterCommandMarkdown:W0,buildRemoteCommandMarkdown:J0,detectCommandFormat:Ru,writeAgentCommand:K0,installAgentCommands:hj,uninstallAgentCommands:gj}});var _i=D((H3,Lu)=>{var Pt=require("fs").promises,gt=require("path"),yj=require("os"),Dt=gt.join(yj.tmpdir(),"planbee-hook.log"),Jo=2,bj="PlanBee hooks v",V0=/^PlanBee hooks v(\d+)$/,ju=class{constructor(){this.planbeeRoot=gt.resolve(__dirname,"../.."),this.hooksDir=gt.join(this.planbeeRoot,".claude/hooks")}validateProjectPath(e){if(!e||typeof e!="string")throw new Error("Invalid project path: path is required and must be a string");let n=gt.resolve(e);if(n.includes(".."))throw new Error("Invalid project path: path traversal detected");if(!gt.isAbsolute(n))throw new Error("Invalid project path: must be absolute path");if(["/etc","/bin","/sbin","/usr/bin","/usr/sbin","/boot","/sys","/proc"].some(o=>n.startsWith(o)))throw new Error("Invalid project path: access to system directories forbidden");return n}buildHookConfig(){return{SessionStart:[{hooks:[{type:"command",command:`planbee internal-hook --type start >> "${Dt}" 2>&1`},{type:"command",command:`planbee internal-hook --type inject-start 2>> "${Dt}"`}]}],PreCompact:[{hooks:[{type:"command",command:`planbee internal-hook --type on-compact >> "${Dt}" 2>&1`},{type:"command",command:`planbee internal-hook --type inject-compact 2>> "${Dt}"`}]}],PreToolUse:[{matcher:"AskUserQuestion|ExitPlanMode",hooks:[{type:"command",command:`planbee internal-hook --type pre-tool-use 2>> "${Dt}"`,timeout:600}]}],PermissionRequest:[{hooks:[{type:"command",command:`planbee internal-hook --type permission-request 2>> "${Dt}"`,timeout:600}]}],Stop:[{hooks:[{type:"command",command:`planbee internal-hook --type on-stop --deliver 2>> "${Dt}"`}]}],UserPromptSubmit:[{hooks:[{type:"command",command:`planbee internal-hook --type on-prompt --deliver 2>> "${Dt}"`}]}],SessionEnd:[{hooks:[{type:"command",command:`planbee internal-hook --type finish >> "${Dt}" 2>&1`}]}]}}buildHookConfigForTarget(e){return e.dir===".agents"?{PreInvocation:[{type:"command",command:`planbee internal-hook --type pre-invocation 2>> "${Dt}"`,timeout:30}],Stop:[{type:"command",command:`planbee internal-hook --type on-stop --deliver 2>> "${Dt}"`,timeout:30}],PreToolUse:[{matcher:"AskUserQuestion|ExitPlanMode|ask_question",hooks:[{type:"command",command:`planbee internal-hook --type pre-tool-use 2>> "${Dt}"`,timeout:600}]}]}:e.dir===".gemini"?{}:this.buildHookConfig()}buildPermissions(e){return e===".gemini"?["command(planbee)"]:["Bash(planbee:*)"]}async installRemoteCommand(){throw new Error("installRemoteCommand() removed in Story 1.3 -- use installAgentCommands() from agent-command-content.js (all four targets, per-target format)")}async areCommandFilesPresent(e){let n=this.validateProjectPath(e),s=[".claude/commands/planbee-register.md",".claude/commands/planbee-remote.md",".gemini/commands/planbee-register.toml",".gemini/commands/planbee-remote.toml",".codex/prompts/planbee-register.md",".codex/prompts/planbee-remote.md",".agents/skills/planbee-register/SKILL.md",".agents/skills/planbee-remote/SKILL.md"];for(let o of s)try{await Pt.access(gt.join(n,o))}catch{return!1}return!0}async install(e,n={}){let s=this.validateProjectPath(e);try{await Pt.access(s)}catch{throw new Error(`Project path does not exist: ${s}`)}if(!n.force){let i=await this.getStatus(s),a=await this.areCommandFilesPresent(s);if(i.completeness==="complete"&&a)return{status:"already_installed",path:s}}let o=[{dir:".claude",file:"settings.json"},{dir:".gemini",file:"settings.json"},{dir:".codex",file:"hooks.json"},{dir:".agents",file:"hooks.json"}],r=[];for(let i of o){let a=gt.join(s,i.dir);await Pt.mkdir(a,{recursive:!0});let c=gt.join(a,i.file),l={};try{let b=await Pt.readFile(c,"utf-8");l=JSON.parse(b)}catch{}let u=this.buildHookConfigForTarget(i),p=l.hooks||{},d=b=>{let v=b||"";if(v.includes(this.hooksDir))return!0;if(!v.includes("internal-hook"))return!1;let E=[];for(let S of Object.values(u))if(Array.isArray(S))for(let C of S)if(C.hooks&&Array.isArray(C.hooks))for(let B of C.hooks)B.command&&E.push(B.command);else C.command&&E.push(C.command);return!E.includes(v)},f={...p};for(let[b,v]of Object.entries(f)){if(!Array.isArray(v))continue;let E=[];for(let S of v)if(S.hooks&&Array.isArray(S.hooks)){let C=S.hooks.filter(B=>!d(B.command));C.length>0&&E.push({...S,hooks:C})}else(S.command?d(S.command):!1)||E.push(S);E.length>0?f[b]=E:delete f[b]}for(let[b,v]of Object.entries(u))if(f[b]){let E=f[b][0];if(E&&E.hooks&&Array.isArray(E.hooks)){let S=E.hooks.map(B=>B.command),C=v[0]&&v[0].hooks?v[0].hooks:[];for(let B of C)S.includes(B.command)||E.hooks.push(B)}else{let S=f[b].map(C=>C.command).filter(Boolean);for(let C of v)C.command&&!S.includes(C.command)&&f[b].push(C)}}else f[b]=v;let m={...l};if(Object.keys(f).length>0?m.hooks=f:delete m.hooks,i.file==="settings.json"){let b=l.permissions||{},v=b.allow||[],E=this.buildPermissions(i.dir),S=[...v];for(let C of E)S.includes(C)||S.push(C);m.permissions={...b,allow:S},m._planbeeHookVersion=Jo,delete m.planbee}else delete m.planbee,delete m._planbeeHookVersion,m.description=`${bj}${Jo}`;await Pt.writeFile(c,`${JSON.stringify(m,null,2)}
|
|
366
|
+
`,"utf-8");let{installAgentCommands:h}=Fu();await h(a,i);let g=Object.keys(u);for(let b of g)r.includes(b)||r.push(b)}return{status:"installed",path:s,hookTypes:r}}async uninstall(e){let n=this.validateProjectPath(e),s=[{dir:".claude",file:"settings.json"},{dir:".gemini",file:"settings.json"},{dir:".codex",file:"hooks.json"},{dir:".agents",file:"hooks.json"}];for(let o of s){let r=gt.join(n,o.dir),i=gt.join(r,o.file),a;try{let l=await Pt.readFile(i,"utf-8");a=JSON.parse(l)}catch{continue}if(a.hooks){for(let[l,u]of Object.entries(a.hooks)){if(!Array.isArray(u))continue;let p=[];for(let d of u)if(d.hooks&&Array.isArray(d.hooks)){let f=d.hooks.filter(m=>{let h=m.command||"";return!h.includes("internal-hook")&&!h.includes(this.hooksDir)});f.length>0&&p.push({...d,hooks:f})}else{let f=d.command||"";f.includes("internal-hook")||f.includes(this.hooksDir)||p.push(d)}a.hooks[l]=p,a.hooks[l].length===0&&delete a.hooks[l]}Object.keys(a.hooks).length===0&&delete a.hooks}if(a.permissions&&Array.isArray(a.permissions.allow)){let l=this.buildPermissions(o.dir),u=[`Bash(node ${this.hooksDir}/*.js)`],p=[...l,...u];a.permissions.allow=a.permissions.allow.filter(d=>!p.includes(d)),a.permissions.allow.length===0&&delete a.permissions.allow,Object.keys(a.permissions).length===0&&delete a.permissions}delete a.planbee,delete a._planbeeHookVersion,typeof a.description=="string"&&V0.test(a.description)&&delete a.description;try{let{uninstallAgentCommands:l}=Fu();await l(r,o)}catch{}Object.keys(a).filter(l=>l!=="planbee").length===0?await Pt.unlink(i):await Pt.writeFile(i,`${JSON.stringify(a,null,2)}
|
|
367
|
+
`,"utf-8")}return{status:"uninstalled",path:n}}async isInstalled(e){return(await this.getStatus(e)).completeness==="complete"}async getStatus(e){let n=this.validateProjectPath(e),s=[{dir:".claude",file:"settings.json"},{dir:".gemini",file:"settings.json"},{dir:".codex",file:"hooks.json"},{dir:".agents",file:"hooks.json"}],o=Object.keys(this.buildHookConfig()),r={installed:!1,settingsExists:!1,settingsValid:!1,planbeePath:this.planbeeRoot,hooksPath:this.hooksDir,hookTypes:[],hooksScriptsAccessible:!1,expectedHookTypes:o,missingHookTypes:[],completeness:"not_installed",hookConfigVersion:null,expectedHookConfigVersion:Jo},i=null;for(let a of s){let c=gt.join(n,a.dir,a.file);try{let l=await Pt.readFile(c,"utf-8");r.settingsExists=!0;let u=JSON.parse(l);if(r.settingsValid=!0,u.hooks){let p=!1;for(let[d,f]of Object.entries(u.hooks)){let m=JSON.stringify(f);(m.includes("internal-hook")||m.includes(this.hooksDir))&&(p=!0,r.hookTypes.includes(d)||r.hookTypes.push(d))}if(r.hookTypes.length>0&&(r.installed=!0),p){let d=0;if(a.file==="settings.json")d=Number(u._planbeeHookVersion)||0;else{let f=V0.exec(u.description||"");d=f?Number(f[1]):0}i=i===null?d:Math.min(i,d)}}}catch{}}try{await Pt.access(gt.join(this.hooksDir,"session-start.js")),await Pt.access(gt.join(this.hooksDir,"pre-compact.js")),r.hooksScriptsAccessible=!0}catch{r.hooksScriptsAccessible=!1}return r.missingHookTypes=o.filter(a=>!r.hookTypes.includes(a)),r.hookConfigVersion=i,r.installed?r.missingHookTypes.length>0?r.completeness="incomplete":i===null||i<Jo?r.completeness="outdated":r.completeness="complete":r.completeness="not_installed",r}};Lu.exports=ju;Lu.exports.HOOK_CONFIG_VERSION=Jo});var Oi=D((z3,Y0)=>{var Ci=require("fs"),$s=require("path"),{createApiClient:xj}=lt();async function vj(t,e={}){if(!t||t===".")return process.cwd();let n=$s.resolve(t);if(Ci.existsSync(n))return n;try{let o=await xj(e).get("/projects"),i=(Array.isArray(o.data)?o.data:o.data?.projects||[]).find(a=>a.id===t||a.name&&a.name.toLowerCase()===t.toLowerCase());if(i){if(Array.isArray(i.devicePaths)){for(let u of i.devicePaths)if(u.path&&Ci.existsSync(u.path))return u.path}if(i.path&&Ci.existsSync(i.path))return i.path;let c=require("os").homedir(),l=[$s.join(c,"infin8",i.name),$s.join(c,"Projects",i.name),$s.join(c,"projects",i.name),$s.join(c,"workspace",i.name),$s.join(c,i.name)];for(let u of l)if(Ci.existsSync(u))return u}}catch{}return n}Y0.exports={resolveTargetProjectPath:vj}});var Q0=D((W3,X0)=>{var wj=_i(),{resolveTargetProjectPath:Ej}=Oi();X0.exports={command:"install [project-path]",describe:"Install PlanBee hooks in a target project",builder:t=>t.positional("project-path",{describe:"Path to target project or project name (defaults to current directory)",type:"string"}).option("project",{alias:"p",describe:"Project name or ID to resolve device-specific path",type:"string"}).option("force",{alias:"f",describe:"Overwrite existing hook configuration",type:"boolean",default:!1}),handler:async t=>{try{let e=t["project-path"]||t.project||".",n=await Ej(e,t),o=await new wj().install(n,{force:t.force});if(o.status==="already_installed"){console.log(`PlanBee hooks already installed in ${o.path}`),console.log("Use --force to reinstall.");return}console.log(`PlanBee hooks installed in ${o.path}`),console.log(`Hook types: ${o.hookTypes.join(", ")}`),console.log(`Settings: ${o.path}/.claude/settings.json`),console.log('Note: Antigravity (Gemini CLI) shows a one-time confirmation dialog ("Project hooks detected \u2014 Allow execution?") the first time a hook runs in this project. Hooks fire automatically after that.')}catch(e){console.error(`Error: ${e.message}`),process.exit(1)}}}});var eE=D((J3,Z0)=>{var Dj=_i(),{resolveTargetProjectPath:Sj}=Oi();Z0.exports={command:"uninstall [project-path]",describe:"Remove PlanBee hooks from a target project",builder:t=>t.positional("project-path",{describe:"Path to target project or project name (defaults to current directory)",type:"string"}).option("project",{alias:"p",describe:"Project name or ID to resolve device-specific path",type:"string"}),handler:async t=>{try{let e=t["project-path"]||t.project||".",n=await Sj(e,t),o=await new Dj().uninstall(n);if(o.status==="not_installed"){console.log(`No PlanBee hooks found in ${o.path}`);return}console.log(`PlanBee hooks removed from ${o.path}`)}catch(e){console.error(`Error: ${e.message}`),process.exit(1)}}}});var nE=D((K3,tE)=>{var kj=_i(),{resolveTargetProjectPath:Aj}=Oi();tE.exports={command:"status [project-path]",describe:"Check PlanBee hooks installation status",builder:t=>t.positional("project-path",{describe:"Path to target project or project name (defaults to current directory)",type:"string"}).option("project",{alias:"p",describe:"Project name or ID to resolve device-specific path",type:"string"}).option("json",{describe:"Output as JSON",type:"boolean",default:!1}),handler:async t=>{try{let e=t["project-path"]||t.project||".",n=await Aj(e,t),o=await new kj().getStatus(n);if(t.json){console.log(JSON.stringify(o,null,2));return}console.log(`Project: ${n}`),console.log(`Installed: ${o.installed?"Yes":"No"}`),o.installed?(console.log(`Hook types: ${o.hookTypes.join(", ")}`),console.log(`PlanBee path: ${o.planbeePath}`),console.log(`Hooks path: ${o.hooksPath}`),console.log(`Scripts accessible: ${o.hooksScriptsAccessible?"Yes":"No"}`),o.completeness==="incomplete"?(console.log(`Vollstaendigkeit: installiert, aber veraltet -- ${o.missingHookTypes.join(", ")} fehlt/fehlen`),console.log('Hinweis: "planbee hooks install <project-path> --force" zieht die fehlenden Hook-Typen additiv nach (fremde Eintraege bleiben erhalten).')):console.log("Vollstaendigkeit: vollstaendig")):console.log(`Settings file: ${o.settingsExists?"exists":"not found"}`)}catch(e){console.error(`Error: ${e.message}`),process.exit(1)}}}});var oE=D((G3,sE)=>{var{createApiClient:_j}=lt();function Ko(t,e){return t?t.length<=e?t:`${t.slice(0,e)}...`:""}function Cj(t){if(!t)return"-";let e=new Date(t),n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}`}async function Oj(t){let{query:e,"agent-status":n,"agent-type":s,limit:o,json:r,global:i}=t,a=new URLSearchParams({q:e});n&&a.set("status",n),s&&a.set("type",s),o&&a.set("limit",String(o)),i||a.set("folder",process.cwd());let c=await Tj(`/api/v1/agents/search?${a.toString()}`);if(c||(console.error("Error: Cannot connect to PlanBee API. Is the server running?"),process.exit(1)),c.success||(console.error(`Error: ${c.error||"Unknown error"}`),process.exit(1)),r){let m=c.agents||[];console.log(JSON.stringify({...c,success:!0,items:m,totalCount:c.count||m.length},null,2)),process.exit(0)}let l=c.agents||[],u=i?"(global)":`in ${process.cwd()}`;l.length===0&&(console.log(`No agents found matching "${e}" ${u}.`),i||console.log("Try --global to search across all projects."),process.exit(0)),console.log(`Found ${c.count} agent(s) matching "${e}" ${u}:
|
|
368
|
+
`);let p=[{label:"ID",width:10},{label:"Status",width:10},{label:"Type",width:12},{label:"Topic",width:30},{label:"Task",width:30},{label:"Model",width:12},{label:"Updated",width:18}],d=p.map(m=>m.label.padEnd(m.width)).join(" "),f=p.map(m=>"-".repeat(m.width)).join(" ");console.log(d),console.log(f);for(let m of l){let h=[Ko(m.id,8).padEnd(10),(m.status||"-").padEnd(10),Ko(m.agent_type||"-",12).padEnd(12),Ko(m.topic||"-",30).padEnd(30),Ko(m.task||"-",30).padEnd(30),Ko(m.model||"-",12).padEnd(12),Cj(m.updated_at).padEnd(18)];console.log(h.join(" "))}process.exit(0)}function Tj(t){return _j().get(t,{timeout:1e4}).then(n=>n.data??null).catch(n=>n.response?.data?n.response.data:null)}sE.exports={command:"agents <query>",describe:"Search agents by topic, task, type, model, or session ID",builder:t=>t.positional("query",{type:"string",description:"Search term"}).option("agent-status",{alias:"s",type:"string",description:"Filter by status (e.g. active, idle, completed)"}).option("agent-type",{alias:"t",type:"string",description:"Filter by agent type (e.g. queen, coder, researcher)"}).option("limit",{alias:"l",type:"number",description:"Max results (default 50, max 200)",default:50}).option("json",{type:"boolean",description:"Output as JSON",default:!1}).option("global",{alias:"g",type:"boolean",description:"Search across all projects (default: current project only)",default:!1}).example('$0 search agents "billing"',"Find agents related to billing in current project").example('$0 search agents "billing" --global',"Find agents related to billing across all projects").example('$0 search agents "INF" --agent-status active',"Active agents with INF in topic/task").example('$0 search agents "opus" -t queen --json',"Queen agents using Opus model"),handler:Oj}});var aE=D((V3,iE)=>{var{createApiClient:Pj}=lt();function rE(t,e,n){return n||!t?t||"":t.length<=e?t:`${t.slice(0,e)}...`}function $j(t){if(!t)return"-";let e=new Date(t),n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}:${n(e.getSeconds())}`}async function Nj(t){let{"session-id":e,query:n,role:s,limit:o,json:r,full:i}=t,a=new URLSearchParams;n&&a.set("q",n),s&&s!=="all"&&a.set("role",s),o&&a.set("limit",String(o)),i&&a.set("full","true");let c=`/api/v1/agents/${e}/transcript/search?${a.toString()}`,l=await Ij(c);l||(console.error("Error: Cannot connect to PlanBee API. Is the server running?"),process.exit(1)),l.success||(console.error(`Error: ${l.error||"Unknown error"}`),process.exit(1)),r&&(console.log(JSON.stringify(l,null,2)),process.exit(0));let u=l.matches||[];if(u.length===0){let f=n?`"${n}"`:"(all)";console.log(`No matches found for ${f} in transcript ${e.slice(0,8)}...`),process.exit(0)}let p=n?`"${n}"`:"(all)";console.log(`Found ${l.count} match(es) for ${p} in transcript ${e.slice(0,8)}...:
|
|
369
|
+
`);let d=!1;for(let f of u){let m=(f.role||"unknown").toUpperCase().padEnd(10),h=`L${f.lineIndex}`.padEnd(7),g=$j(f.timestamp);if(console.log(`${h} ${m} ${g}`),f.content){let b=f.content.split(`
|
|
370
|
+
`),v=i?b:b.slice(0,3);!i&&b.length>3&&(d=!0);for(let E of v)!i&&E.length>200&&(d=!0),console.log(` ${rE(E,200,i)}`)}if(f.hasToolUse&&f.toolUses)for(let b of f.toolUses){let v=[];b.filePath&&v.push(b.filePath),b.command&&(!i&&b.command.length>80&&(d=!0),v.push(rE(b.command,80,i))),console.log(` [Tool: ${b.name}] ${v.join(" ")}`)}console.log("")}!i&&d&&console.log("Hint: Output is truncated. Use --full for complete content."),process.exit(0)}function Ij(t){return Pj().get(t,{timeout:3e4}).then(n=>n.data??null).catch(n=>n.response?.data?n.response.data:null)}iE.exports={command:"transcript <session-id> [query]",describe:"Search within an agent transcript",builder:t=>t.positional("session-id",{type:"string",description:"Agent session ID (UUID)"}).positional("query",{type:"string",description:"Search term (empty = show all entries)",default:""}).option("role",{alias:"r",type:"string",description:"Filter by role",choices:["user","assistant","all"],default:"all"}).option("limit",{alias:"l",type:"number",description:"Max results (default 50, max 200)",default:50}).option("json",{type:"boolean",description:"Output as JSON",default:!1}).option("full",{type:"boolean",description:"Show full values without truncation",default:!1}).example('$0 search transcript abc123-... "database"','Search for "database" in transcript').example('$0 search transcript abc123-... "error" --role assistant','Assistant messages with "error"').example('$0 search transcript abc123-... "migration" --full',"Full content without truncation").example('$0 search transcript abc123-... "migration" --json',"JSON output for programmatic use"),handler:Nj}});var lE=D((Y3,cE)=>{var{createApiClient:Rj}=lt();function Ti(t,e,n){return n||!t?t||"":t.length<=e?t:`${t.slice(0,e)}...`}function Fj(t){if(!t)return"-";let e=new Date(t),n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}:${n(e.getSeconds())}`}function Go(t){return Rj().get(t,{timeout:3e4}).then(n=>n.data??null).catch(n=>n.response?.data?n.response.data:null)}var Ns=500;async function jj(t,e){let n=[],s=0,o=null,r=await Go(`/api/v1/agents/${t}/transcript/tail?lines=1`);r&&r.success&&(o=r.totalLines||0),o!==null&&o>Ns&&process.stderr.write(`Fetching ${o} entries in pages of ${Ns}...
|
|
371
|
+
`);let i=0;for(;;){let a=new URLSearchParams;a.set("offset",String(s)),a.set("lines",String(Ns)),e&&a.set("full","true");let c=`/api/v1/agents/${t}/transcript?${a.toString()}`,l=await Go(c);if(!l||!l.success){if(i===0)return l;break}i++;let u=l.lines||[];for(let p of u)n.push(p);if(o>Ns&&process.stderr.write(` Page ${i}: ${n.length}/${o} entries\r`),u.length<Ns||u.length===0||l.hasMore===!1)break;s+=u.length}return o>Ns&&process.stderr.write(`
|
|
372
|
+
`),{success:!0,lines:n,totalLines:n.length,hasMore:!1}}function Lj(t,e){return!e||e==="all"?t:t.filter(n=>n.role===e)}function Bj(t,e,n=!1){if(t.length===0){console.log(`No entries found for session ${e.slice(0,8)}...`);return}let s=!1;for(let o of t){let r=(o.role||"unknown").toUpperCase().padEnd(10),i=Fj(o.timestamp);if(console.log(`${r} ${i}`),o.content){let a=o.content.split(`
|
|
373
|
+
`),c=n?a:a.slice(0,5);!n&&a.length>5&&(s=!0);for(let l of c){let u=n?l:Ti(l,200,!1);!n&&l.length>200&&(s=!0),console.log(` ${u}`)}}if(o.hasToolUse&&o.toolUses)for(let a of o.toolUses){let c=[];a.filePath&&c.push(a.filePath),a.command&&(!n&&a.command.length>80&&(s=!0),c.push(n?a.command:Ti(a.command,80,!1))),a.description&&(!n&&a.description.length>80&&(s=!0),c.push(n?a.description:Ti(a.description,80,!1))),console.log(` [Tool: ${a.name}] ${c.join(" ")}`)}if(o.toolResults)for(let a of o.toolResults){let c=a.isError?"[ERROR]":"[Result]";!n&&a.content&&a.content.length>150&&(s=!0);let l=n?a.content:Ti(a.content,150,!1);console.log(` ${c} ${l}`)}console.log("")}return s}async function qj(t){let e=t["session-id"]||t.session||process.env.PLANBEE_SESSION_ID,{last:n,since:s,offset:o,lines:r,role:i,json:a,full:c,all:l}=t,u;if(l)u=await jj(e,c);else if(s){let g=new URLSearchParams;g.set("since",s),r&&g.set("lines",String(r)),c&&g.set("full","true");let b=`/api/v1/agents/${e}/transcript?${g.toString()}`;u=await Go(b)}else if(o!=null){let g=new URLSearchParams;g.set("offset",String(o)),r&&g.set("lines",String(r)),c&&g.set("full","true");let b=`/api/v1/agents/${e}/transcript?${g.toString()}`;u=await Go(b)}else{let g=n||20,b=new URLSearchParams;b.set("lines",String(g)),c&&b.set("full","true");let v=`/api/v1/agents/${e}/transcript/tail?${b.toString()}`;u=await Go(v)}u||(console.error("Error: Cannot connect to PlanBee API. Is the server running?"),process.exit(1)),u.success||(console.error(`Error: ${u.error||"Unknown error"}`),process.exit(1));let p=u.lines||[];p=Lj(p,i);let d=t.search||t.q;if(d){let g=d.toLowerCase();p=p.filter(b=>[b.content||"",...(b.toolUses||[]).map(E=>`${E.name} ${E.command||""} ${E.filePath||""} ${E.description||""}`),...(b.toolResults||[]).map(E=>E.content||"")].join(" ").toLowerCase().includes(g))}a&&(console.log(JSON.stringify({...u,success:!0,items:p,totalCount:p.length,lines:p},null,2)),process.exit(0));let f=u.totalLines?` (total: ${u.totalLines})`:"",m=u.hasMore?" [more available]":"";console.log(`Transcript ${e.slice(0,8)}... - ${p.length} entries${f}${m}
|
|
374
|
+
`);let h=Bj(p,e,c);if(!c&&h&&console.log("Hint: Content is truncated. Use --full for complete content."),u.hasMore&&!l){let g=u.totalLines||"?";console.log(`Hint: Showing ${p.length} of ${g} entries. Use --all to fetch the complete transcript.`)}process.exit(0)}cE.exports={command:"transcript [session-id]",describe:"Read transcript entries from an agent session",builder:t=>t.positional("session-id",{type:"string",description:"Agent session ID (UUID)"}).option("last",{alias:"n",type:"number",description:"Number of last entries to show (tail mode, default 20)"}).option("since",{type:"string",description:'Show entries since timestamp (ISO format or "YYYY-MM-DD HH:MM:SS")'}).option("offset",{type:"number",description:"Start reading from this line offset (for polling)"}).option("lines",{alias:"l",type:"number",description:"Number of lines to read (with --offset or --since)"}).option("role",{alias:"r",type:"string",description:"Filter by role",choices:["user","assistant","all"],default:"all"}).option("json",{type:"boolean",description:"Output as JSON",default:!1}).option("full",{type:"boolean",description:"Show full values without truncation",default:!1}).option("all",{type:"boolean",description:"Fetch the entire transcript (ignores pagination)",default:!1}).check(e=>{if(!(e["session-id"]||e.session||process.env.PLANBEE_SESSION_ID))throw new Error("Session ID required (use positional arg <session-id> or set PLANBEE_SESSION_ID)");if(e.all&&(e.last||e.since||e.offset!==void 0))throw new Error("--all cannot be combined with --last, --since, or --offset");return!0}).option("search",{alias:"q",type:"string",description:"Search/filter entries containing this term"}).example("$0 transcript <session-id>","Last 20 entries (default)").example("$0 transcript <session-id> --last 50","Last 50 entries").example('$0 transcript <session-id> --since "2026-02-08 14:30:00"',"Entries since timestamp").example("$0 transcript <session-id> --offset 50 --lines 20","Offset-based reading").example("$0 transcript <session-id> --role assistant","Only assistant messages").example("$0 transcript <session-id> --full","Full output without truncation").example("$0 transcript <session-id> --all","Fetch complete transcript (all entries)").example("$0 transcript <session-id> --all --full","Complete transcript, lossless (all entries + full content)").example("$0 transcript <session-id> --json","JSON output"),handler:qj}});var pE=D((X3,uE)=>{var{agyTranscriptPath:Mj}=Ds();async function Uj(t){let e=t.session||t.sessionId;if(!e){console.error("Fehler: --session ist erforderlich"),process.exit(1);return}if(String(t.provider||"").toLowerCase()==="copilot"){try{let{syncCopilotTranscript:o}=il(),r=await o(e,{transcriptPath:t.path||void 0});r.reason&&r.synced===0?console.log(`Sofort-Sync: nichts \xFCbertragen (${r.reason}).`):console.log(`Sofort-Sync: ${r.synced} Chunk(s), ${r.converted} Copilot-Event(s) konvertiert.`)}catch(o){console.error(`Sofort-Sync fehlgeschlagen (non-fatal): ${o.message}`)}if(t.once){process.exit(0);return}try{let{spawnCopilotTickerIfNeeded:o}=Co(),r=o(e,t.path||void 0);console.log(r?"Live-Sync-Ticker gestartet (detached).":"Live-Sync-Ticker l\xE4uft bereits (kein Doppelstart).")}catch(o){console.error(`Ticker-Start fehlgeschlagen (non-fatal): ${o.message}`)}process.exit(0);return}let s=t.path||Mj(e);try{let{syncAgyTranscript:o}=So(),r=await o(e,{transcriptPath:s});r.reason&&r.synced===0?console.log(`Sofort-Sync: nichts \xFCbertragen (${r.reason}).`):console.log(`Sofort-Sync: ${r.synced} Chunk(s), ${r.converted} agy-Zeile(n) konvertiert.`)}catch(o){console.error(`Sofort-Sync fehlgeschlagen (non-fatal): ${o.message}`)}if(t.once){process.exit(0);return}try{let{spawnAgyTickerIfNeeded:o}=ko(),r=o(e,s);console.log(r?"Live-Sync-Ticker gestartet (detached).":"Live-Sync-Ticker l\xE4uft bereits (kein Doppelstart).")}catch(o){console.error(`Ticker-Start fehlgeschlagen (non-fatal): ${o.message}`)}process.exit(0)}uE.exports={command:"transcript-sync",describe:"agy-Live-Transcript-Sync f\xFCr eine Session manuell (re-)armen",builder:t=>t.option("session",{alias:"s",type:"string",description:"Session-ID (= agy Conversation-UUID)",demandOption:!0}).option("path",{alias:"p",type:"string",description:"Pfad zur agy transcript.jsonl (optional, sonst abgeleitet)"}).option("once",{type:"boolean",description:"Nur ein einmaliger Sync, keinen Live-Ticker starten",default:!1}).option("provider",{type:"string",description:'LLM provider ("agy" = default, "copilot" f\xFCr GitHub-Copilot-CLI-Sessions)'}).example("$0 transcript-sync --session 915d6516-1581-48e8-b4aa-5201305d0779","agy-Sync armieren").example("$0 transcript-sync -s <uuid> --once","Einmaliger Sync ohne Daemon"),handler:Uj}});var fE=D((Q3,dE)=>{var{createApiClient:Hj}=lt();function Bu(){let t=new Date,e=new Date(t.getFullYear(),0,1),n=t-e,s=1e3*60*60*24*7,o=Math.ceil(n/s);return`${t.getFullYear()}-W${String(o).padStart(2,"0")}`}function yn(t,e,n=null){return Hj().request({method:t,url:e,data:n}).then(o=>o.data??{}).catch(o=>o.response?.data?o.response.data:{error:o.message||"Request failed"})}var zj={urgent:"[!!]",high:"[!]",medium:"[~]",low:"[-]"},Wj={open:"[ ]",done:"[x]",moved:"[>]",cancelled:"[_]"};function Is(t,e){let n=zj[t.priority]||"[-]",s=Wj[t.status]||"[ ]",o=t.category?`[${t.category}]`:"",r=t.due_date?`Due: ${t.due_date}`:"",i=t.moved_from?`(from ${t.moved_from})`:"";return`${e+1}. ${s} ${n} ${t.title} ${o} ${r} ${i}`.trim()}async function Jj(t){let e=new URLSearchParams;t.week&&e.append("week",t.week),t.status&&e.append("status",t.status),t.category&&e.append("category",t.category),t.priority&&e.append("priority",t.priority),t.all&&e.append("all","true");let n=await yn("GET",`/api/v1/todos?${e}`);(!n||n.error)&&(console.error("Error:",n?.error||"Failed to fetch todos"),process.exit(1)),t.json&&(console.log(JSON.stringify(n,null,2)),process.exit(0));let s=n.todos||[];s.length===0&&(console.log("No todos found."),process.exit(0));let o=t.week||Bu();console.log(`
|
|
375
|
+
Todos ${t.all?"(All Weeks)":`for ${o}`}
|
|
376
|
+
`),s.forEach((a,c)=>console.log(Is(a,c)));let r=s.filter(a=>a.status==="open").length,i=s.filter(a=>a.status==="done").length;console.log(`
|
|
377
|
+
Total: ${s.length} | Open: ${r} | Done: ${i}
|
|
378
|
+
`)}async function Kj(t){let e=t.title||t._[1];e||(console.error("Error: Title is required (use --title or as argument)"),process.exit(1));let n={title:e,description:t.description,priority:t.priority||"medium",category:t.category,week:t.week||Bu(),due_date:t.due,notes:t.notes},s=await yn("POST","/api/v1/todos",n);(!s||s.error)&&(console.error("Error:",s?.error||"Failed to create todo"),process.exit(1)),t.json&&(console.log(JSON.stringify(s,null,2)),process.exit(0)),console.log("[OK] Todo created:"),console.log(Is(s.todo,0)),console.log(`ID: ${s.todo.id}`)}async function Gj(t){let e=t._[1];e||(console.error("Error: Todo ID is required"),process.exit(1));let n=await yn("POST",`/api/v1/todos/${e}/done`);(!n||n.error)&&(console.error("Error:",n?.error||"Failed to mark todo as done"),process.exit(1)),t.json&&(console.log(JSON.stringify(n,null,2)),process.exit(0)),console.log("[OK] Todo marked as done:"),console.log(Is(n.todo,0))}async function Vj(t){let e=t._[1];e||(console.error("Error: Todo ID is required"),process.exit(1));let n={};t.title&&(n.title=t.title),t.description!==void 0&&(n.description=t.description),t.priority&&(n.priority=t.priority),t.category!==void 0&&(n.category=t.category),t.status&&(n.status=t.status),t.due!==void 0&&(n.due_date=t.due),t.notes!==void 0&&(n.notes=t.notes),Object.keys(n).length===0&&(console.error("Error: No fields to update"),process.exit(1));let s=await yn("PUT",`/api/v1/todos/${e}`,n);(!s||s.error)&&(console.error("Error:",s?.error||"Failed to update todo"),process.exit(1)),t.json&&(console.log(JSON.stringify(s,null,2)),process.exit(0)),console.log("[OK] Todo updated:"),console.log(Is(s.todo,0))}async function Yj(t){let e=t._[1];e||(console.error("Error: Todo ID is required"),process.exit(1));let n=await yn("DELETE",`/api/v1/todos/${e}`);(!n||n.error)&&(console.error("Error:",n?.error||"Failed to delete todo"),process.exit(1)),t.json&&(console.log(JSON.stringify(n,null,2)),process.exit(0)),console.log("[OK] Todo deleted:"),console.log(n.message)}async function Xj(t){let e=t._[1];(!e||!t.to)&&(console.error("Error: Todo ID and --to week are required"),process.exit(1));let n=await yn("PUT",`/api/v1/todos/${e}`,{week:t.to,moved_from:t.from||Bu(),status:"open"});(!n||n.error)&&(console.error("Error:",n?.error||"Failed to move todo"),process.exit(1)),t.json&&(console.log(JSON.stringify(n,null,2)),process.exit(0)),console.log(`[OK] Todo moved to ${t.to}:`),console.log(Is(n.todo,0))}async function Qj(t){let e={from_week:t.from,to_week:t.to},n=await yn("POST","/api/v1/todos/rollover",e);(!n||n.error)&&(console.error("Error:",n?.error||"Failed to rollover todos"),process.exit(1)),t.json&&(console.log(JSON.stringify(n,null,2)),process.exit(0)),console.log(`[OK] ${n.message}`),console.log(`From: ${n.from_week} -> To: ${n.to_week}`),n.todos&&n.todos.length>0&&(console.log(`
|
|
379
|
+
Moved todos:`),n.todos.forEach((s,o)=>console.log(Is(s,o))))}async function Zj(t){let e=await yn("GET","/api/v1/todos/weeks");(!e||e.error)&&(console.error("Error:",e?.error||"Failed to fetch week overview"),process.exit(1)),t.json&&(console.log(JSON.stringify(e,null,2)),process.exit(0));let n=e.weeks||[];n.length===0&&(console.log("No weeks found."),process.exit(0)),console.log(`
|
|
380
|
+
Week Overview
|
|
381
|
+
`),console.log("Week | Total | Open | Done | Moved | Cancelled"),console.log("----------|-------|------|------|-------|----------"),n.forEach(s=>{let o=s.week.padEnd(9),r=String(s.total).padEnd(5),i=String(s.open).padEnd(4),a=String(s.done).padEnd(4),c=String(s.moved).padEnd(5),l=String(s.cancelled).padEnd(9);console.log(`${o} | ${r} | ${i} | ${a} | ${c} | ${l}`)}),console.log()}var eL={command:"todo <action>",describe:"Personal todo/weekly planner",builder:t=>t.positional("action",{describe:"Action to perform",type:"string",choices:["list","add","done","edit","remove","move","rollover","weeks"]}).option("week",{alias:"w",type:"string",description:"ISO week (e.g., 2026-W07)"}).option("all",{alias:"a",type:"boolean",description:"Show all weeks",default:!1}).option("status",{type:"string",description:"Filter by status",choices:["open","done","moved","cancelled"]}).option("category",{alias:"c",type:"string",description:"Filter/set category"}).option("priority",{alias:"p",type:"string",description:"Filter/set priority",choices:["urgent","high","medium","low"]}).option("title",{alias:"t",type:"string",description:"Todo title"}).option("description",{alias:"d",type:"string",description:"Todo description"}).option("due",{type:"string",description:"Due date (YYYY-MM-DD)"}).option("notes",{alias:"n",type:"string",description:"Additional notes"}).option("to",{type:"string",description:"Target week for move/rollover"}).option("from",{type:"string",description:"Source week for move/rollover"}).option("json",{type:"boolean",description:"Output as JSON",default:!1}),handler:async t=>{switch(t.action||t._[0]){case"list":await Jj(t);break;case"add":await Kj(t);break;case"done":await Gj(t);break;case"edit":await Vj(t);break;case"remove":await Yj(t);break;case"move":await Xj(t);break;case"rollover":await Qj(t);break;case"weeks":await Zj(t);break;default:console.error("Error: Invalid action. Use: list, add, done, edit, remove, move, rollover, weeks"),process.exit(1)}}};dE.exports=eL});var hE=D((Z3,mE)=>{var Wt=de(),be=et(),{resolveApiUrl:tL}=te(),{getEnv:nL}=Be(),Jt=tL(),Kt=15e3;function Gt(){return{"Content-Type":"application/json","X-PlanBee-Session-Id":nL("PLANBEE_SESSION_ID")||"cli"}}async function sL(t){let{sessionId:e,json:n}=t;try{let o=(await Wt.get(`${Jt}/api/v1/agents/${e}/plan/status`,{headers:Gt(),timeout:Kt})).data;if(n){console.log(JSON.stringify(o,null,2));return}if(console.log(be.t("plan.planStatusFor",{id:e})),console.log(` Pending Plan: ${o.hasPendingPlan?be.t("plan.yes"):be.t("plan.no")}`),console.log(` Pending Question: ${o.hasPendingQuestion?be.t("plan.yes"):be.t("plan.no")}`),console.log(be.t("plan.isManaged",{value:o.isManaged?be.t("plan.yes"):be.t("plan.no")})),console.log(be.t("plan.isPlanDecided",{value:o.isPlanDecided?be.t("plan.yes"):be.t("plan.no")})),o.hasPendingPlan&&o.planData?.plan){let r=t.full?o.planData.plan:o.planData.plan.length>500?`${o.planData.plan.substring(0,500)}
|
|
382
|
+
${be.t("plan.planTruncated")}`:o.planData.plan;console.log(`
|
|
383
|
+
Plan:
|
|
384
|
+
${r.split(`
|
|
385
|
+
`).map(i=>` ${i}`).join(`
|
|
386
|
+
`)}`)}if(o.hasPendingQuestion&&o.questionData?.questions){console.log(be.t("plan.openQuestions"));for(let r of o.questionData.questions)console.log(` - ${r.question||r}`),r.options?.length&&console.log(be.t("plan.options",{options:r.options.join(", ")}));console.log(be.t("plan.answerHint",{id:e}))}}catch(s){rn(s,"Plan-Status abrufen")}}async function oL(t){let{sessionId:e,additionalPrompt:n,json:s}=t;try{let o={action:"approve"};n&&(o.additionalPrompt=n);let r=await Wt.post(`${Jt}/api/v1/agents/${e}/plan/decide`,o,{headers:Gt(),timeout:Kt});console.log(s?JSON.stringify(r.data,null,2):be.t("plan.approved",{id:e}))}catch(o){rn(o,"Plan genehmigen")}}async function rL(t){let{sessionId:e,json:n}=t;try{let s=await Wt.post(`${Jt}/api/v1/agents/${e}/plan/decide`,{action:"reject"},{headers:Gt(),timeout:Kt});console.log(n?JSON.stringify(s.data,null,2):be.t("plan.rejected",{id:e}))}catch(s){rn(s,"Plan ablehnen")}}async function iL(t){let{sessionId:e,message:n,additionalPrompt:s,json:o}=t;(!n||!n.trim())&&(console.error(be.t("plan.feedbackRequired")),process.exit(1));try{let r={action:"feedback",feedback:n};s&&(r.additionalPrompt=s);let i=await Wt.post(`${Jt}/api/v1/agents/${e}/plan/decide`,r,{headers:Gt(),timeout:Kt});console.log(o?JSON.stringify(i.data,null,2):be.t("plan.feedbackSent",{id:e}))}catch(r){rn(r,"Feedback senden")}}async function aL(t){let{sessionId:e,model:n,llmType:s,json:o}=t;try{let r={action:"execute_new_session"};n&&(r.model=n),s&&(r.llmType=s);let i=await Wt.post(`${Jt}/api/v1/agents/${e}/plan/decide`,r,{headers:Gt(),timeout:Kt});console.log(o?JSON.stringify(i.data,null,2):be.t("plan.executing",{newId:i.data.newSessionId}))}catch(r){rn(r,"execute plan in new session")}}async function cL(t){let{sessionId:e,answers:n,message:s,json:o}=t;try{let r;n?r=JSON.parse(n):s?r={[(await Wt.get(`${Jt}/api/v1/agents/${e}/plan/status`,{headers:Gt(),timeout:Kt})).data.questionData?.questions?.[0]?.question||"answer"]:s}:(console.error(be.t("plan.answersRequired")),process.exit(1));let i=await Wt.post(`${Jt}/api/v1/agents/${e}/question/answer`,{answers:r},{headers:Gt(),timeout:Kt});console.log(o?JSON.stringify(i.data,null,2):be.t("plan.answered",{id:e}))}catch(r){rn(r,"Frage beantworten")}}async function lL(t){let{sessionId:e,json:n}=t;try{let s=await Wt.post(`${Jt}/api/v1/agents/${e}/plan/dismiss`,{},{headers:Gt(),timeout:Kt});console.log(n?JSON.stringify(s.data,null,2):be.t("plan.dismissed",{id:e}))}catch(s){rn(s,"Plan dismissen")}}async function uL(t){let{sessionId:e,json:n}=t;try{let o=(await Wt.get(`${Jt}/api/v1/agents/${e}/plan/status`,{headers:Gt(),timeout:Kt})).data;(!o.hasPendingPlan||!o.planData?.plan)&&(console.error(be.t("plan.noPlan")),process.exit(1)),console.log(n?JSON.stringify(o.planData,null,2):o.planData.plan)}catch(s){rn(s,"Plan anzeigen")}}async function pL(t){let{json:e}=t;try{let o=((await Wt.get(`${Jt}/api/v1/sessions?includeCompleted=false`,{headers:Gt(),timeout:Kt})).data.sessions||[]).filter(r=>r.status==="plan_ready"||r.pending_interaction==="plan");if(e){console.log(JSON.stringify(o,null,2));return}if(o.length===0){console.log(be.t("plan.noPending"));return}console.log(be.t("plan.agentsWaiting",{count:o.length}));for(let r of o){let i=r.status==="plan_ready"||r.pending_interaction==="plan"?"[Plan]":"[Frage]",a=r.updated_at?dL(new Date(r.updated_at)):"?",c=r.topic||r.task_description||"-",l=c.length>60?`${c.substring(0,60)}...`:c;console.log(` ${i} ${r.id}`),console.log(` Topic: ${l}`),console.log(` Agent: ${r.agent_type||"default"} | ${be.t("plan.since",{age:a})}`),console.log("")}}catch(n){rn(n,"Plan-Liste abrufen")}}function dL(t){let e=Math.floor((Date.now()-t.getTime())/1e3);if(e<60)return`${e}s`;let n=Math.floor(e/60);if(n<60)return`${n}m`;let s=Math.floor(n/60);return s<24?`${s}h ${n%60}m`:`${Math.floor(s/24)}d ${s%24}h`}function rn(t,e){(t.code==="ECONNREFUSED"||t.code==="ETIMEDOUT")&&(console.error(be.t("plan.serverUnreachable")),process.exit(3)),t.response?.data?.error&&(console.error(be.t("plan.actionError",{action:e,error:t.response.data.error})),process.exit(2)),console.error(be.t("plan.actionError",{action:e,error:t.message})),process.exit(2)}var fL={command:"plan",describe:"Plan review & control (approve, reject, feedback, list)",builder:t=>t.command({command:"status <sessionId>",describe:"Show plan/question status for a session",builder:e=>e.positional("sessionId",{type:"string",describe:"Target session ID"}).option("full",{type:"boolean",default:!1,describe:"Show full plan text (no truncation)"}).option("json",{type:"boolean",default:!1}),handler:sL}).command({command:"approve <sessionId>",describe:"Approve a pending plan",builder:e=>e.positional("sessionId",{type:"string",describe:"Target session ID"}).option("additional-prompt",{alias:"p",type:"string",describe:"Additional instructions for the agent"}).option("json",{type:"boolean",default:!1}),handler:oL}).command({command:"reject <sessionId>",describe:"Reject a pending plan",builder:e=>e.positional("sessionId",{type:"string",describe:"Target session ID"}).option("json",{type:"boolean",default:!1}),handler:rL}).command({command:"feedback <sessionId>",describe:"Send feedback on a plan (requests revision)",builder:e=>e.positional("sessionId",{type:"string",describe:"Target session ID"}).option("message",{alias:"m",type:"string",describe:"Feedback message",demandOption:!0}).option("additional-prompt",{alias:"p",type:"string",describe:"Additional instructions for the agent"}).option("json",{type:"boolean",default:!1}),handler:iL}).command({command:"execute <sessionId>",describe:"Execute plan in a new agent session",builder:e=>e.positional("sessionId",{type:"string",describe:"Target session ID"}).option("model",{type:"string",describe:"Model override (e.g. sonnet, opus)"}).option("llm-type",{type:"string",describe:"LLM provider (claude, copilot)"}).option("json",{type:"boolean",default:!1}),handler:aL}).command({command:"answer <sessionId>",describe:"Answer a pending question from an agent",builder:e=>e.positional("sessionId",{type:"string",describe:"Target session ID"}).option("answers",{alias:"a",type:"string",describe:'JSON object: {"question": "answer"}'}).option("message",{alias:"m",type:"string",describe:"Free-text answer (auto-maps to first question)"}).option("json",{type:"boolean",default:!1}),handler:cL}).command({command:"dismiss <sessionId>",describe:"Dismiss a pending plan/question (clears stale UI state)",builder:e=>e.positional("sessionId",{type:"string",describe:"Target session ID"}).option("json",{type:"boolean",default:!1}),handler:lL}).command({command:"list",describe:"List agents with pending plans",builder:e=>e.option("json",{type:"boolean",default:!1}),handler:pL}).command({command:"view <sessionId>",describe:"View full plan text",builder:e=>e.positional("sessionId",{type:"string",describe:"Target session ID"}).option("json",{type:"boolean",default:!1}),handler:uL}).demandCommand(1,be.t("plan.demandCommand")).strict(),handler:()=>{}};mE.exports=fL});var CE=D((eU,pt)=>{var{createHash:mL}=require("crypto"),Yn=de(),{resolveApiUrl:hL}=te(),{getEnv:gE}=Be(),gL="v8",Xn=hL(),yE=15*1024,yL=["f0_working","f0_sleeping"],bE=4,$i=["f0_working","f0_sleeping","f1_working","f1_sleeping","f2_working","f2_sleeping","f3_working","f3_sleeping","compacting","plan_ready","listening","plan_ready_watching"],qu={queen:"Royal bee with golden crown, purple and gold accents, regal commanding pose, royal cape",coder:"Bee with terminal screen visor, green code lines on face, keyboard pattern on body stripes",dev:"Bee with terminal screen visor, green code lines on face, keyboard pattern on body stripes",tester:"Bee with magnifying glass, clipboard accessory, checkmark and bug patterns on body",researcher:"Bee with explorer hat, book and compass accessories, curious wide-open eyes",architect:"Bee with blueprint scroll, ruler accessory, structured geometric patterns on body",reviewer:"Bee with monocle and red pen, careful attentive expression, checklist on body",debugger:"Bee with wrench tool, magnifying glass inspecting bugs, detective hat",optimizer:"Bee with rocket booster wings, speedometer on body, streamlined aerodynamic design","bee-generator":"Meta-bee with paint palette and brush, artistic creative expression, rainbow accents",default:"Friendly cheerful worker bee with bright eyes and warm smile"};function vE(t,e){let n=qu[t]||qu.default;return e?`${n}, themed around: ${e}`:n}function wE(t){return mL("sha256").update(t.trim().toLowerCase()).digest("hex").slice(0,12)}var Rs={cx:26,cy:30,tolerance:.5},Pi={x0:12,y0:-7,x1:40,y1:10},bn={x0:18,y0:33,x1:34,y1:47},bL=13;function ye(t,e){let n=t.match(new RegExp(`\\b${e}\\s*=\\s*"(-?[\\d.]+)"`));return n?parseFloat(n[1]):null}function EE(t){return t.match(/<(circle|ellipse|rect|text|path|line|polygon|polyline)\b[^>]*>/g)||[]}function xL(t){let e=/<g\b[^>]*\sdata-p="/g,n="",s=0;for(;;){e.lastIndex=s;let o=e.exec(t);if(!o)return n+t.slice(s);let r=o.index;n+=t.slice(s,r);let i=0,a=r;for(;a<t.length;)if(t.startsWith("</g>",a)){if(i-=1,a+=4,i===0)break}else t.startsWith("<g",a)?(i+=1,a+=2):a+=1;s=a}}function DE(t,{allowBellyGear:e=!1}={}){let n=EE(xL(t));if(!n.some(o=>{if(!o.startsWith("<circle"))return!1;let r=ye(o,"cx"),i=ye(o,"cy");return r!==null&&i!==null&&Math.abs(r-Rs.cx)<=Rs.tolerance&&Math.abs(i-Rs.cy)<=Rs.tolerance}))return`LED fehlt oder sitzt nicht auf ${Rs.cx},${Rs.cy}`;for(let o of n){let r=ye(o,"cx"),i=ye(o,"cy"),a=ye(o,"x"),c=ye(o,"y"),l=ye(o,"width"),u=ye(o,"height"),p=r,d=i,f=ye(o,"rx")!==null?ye(o,"rx")*2:(ye(o,"r")||0)*2,m=ye(o,"ry")!==null?ye(o,"ry")*2:(ye(o,"r")||0)*2;if(p===null&&a!==null&&c!==null&&(p=a+(l||0)/2,d=c+(u||0)/2,f=l||0,m=u||0),p===null||d===null)continue;if(!o.startsWith("<text")&&d<bL&&(p<Pi.x0||p>Pi.x1||d<Pi.y0||d>Pi.y1))return`Element ueber dem Kopf liegt ausserhalb der Accessoire-Zone (${p},${d})`;let h=f>bn.x1-bn.x0||m>bn.y1-bn.y0,g=p>=bn.x0&&p<=bn.x1&&d>=bn.y0&&d<=bn.y1;if(!(e&&Math.abs(p-26)<=1&&Math.abs(d-38)<=1)&&g&&!h)return`Detail in der Bauch-Sperrzone 18,33 16x14 (${p},${d})`}return null}var vL=2,wL=[{name:"Screen",x:17,y:16,w:18,h:8},{name:"Fuss links",x:17,y:52,w:6,h:4},{name:"Fuss rechts",x:29,y:52,w:6,h:4}],EL=[{name:"Kopf",skel:"kopf",rectFallback:{x:14,y:13,w:24,h:15},box:{minX:10,maxX:42,minY:10,maxY:32},minW:12,minH:8},{name:"Koerper",skel:"koerper",rectFallback:{x:14,y:28,w:24,h:24},box:{minX:10,maxX:42,minY:24,maxY:56},minW:14,minH:16}],DL=[{name:"Antennen-Spitze links",cx:15,cy:7},{name:"Antennen-Spitze rechts",cx:37,cy:7}],xE=[{name:"Fluegel links",cx:9,cy:36},{name:"Fluegel rechts",cx:43,cy:36}];function ut(t,e,n=vL){return t!==null&&Math.abs(t-e)<=n}function SL(t){let e=(t.match(/-?\d*\.?\d+/g)||[]).map(Number);if(e.length<2)return null;let n=1/0,s=1/0,o=-1/0,r=-1/0;for(let i=0;i+1<e.length;i+=2){let a=e[i],c=e[i+1];a<n&&(n=a),a>o&&(o=a),c<s&&(s=c),c>r&&(r=c)}return{x0:n,y0:s,x1:o,y1:r}}function kL(t){if(t.startsWith("<rect")){let e=ye(t,"x"),n=ye(t,"y"),s=ye(t,"width"),o=ye(t,"height");return e===null||n===null||s===null||o===null?null:{x0:e,y0:n,x1:e+s,y1:n+o}}if(t.startsWith("<path")){let e=t.match(/\bd\s*=\s*"([^"]*)"/);return e?SL(e[1]):null}return null}function AL(t,e){let n=t.match(new RegExp(`<(?:rect|path)\\b[^>]*\\bdata-skel="${e}"[^>]*>`));return n?n[0]:null}function SE(t,e=!1){let n=EE(t),s=n.filter(a=>a.startsWith("<rect")),o=n.filter(a=>a.startsWith("<circle")),r=n.filter(a=>a.startsWith("<ellipse")),i=n.filter(a=>a.startsWith("<path"));for(let a of wL)if(!s.some(l=>ut(ye(l,"x"),a.x)&&ut(ye(l,"y"),a.y)&&ut(ye(l,"width"),a.w)&&ut(ye(l,"height"),a.h)))return`Bauplan-Element fehlt: ${a.name} (rect ${a.x},${a.y} ${a.w}x${a.h})`;for(let a of EL){let{rectFallback:c}=a;if(s.some(m=>ut(ye(m,"x"),c.x)&&ut(ye(m,"y"),c.y)&&ut(ye(m,"width"),c.w)&&ut(ye(m,"height"),c.h)))continue;let u=AL(t,a.skel),p=u&&kL(u);if(!p)return`Bauplan-Element fehlt: ${a.name} (weder Standard-Rechteck noch data-skel="${a.skel}")`;if(p.x0<a.box.minX||p.x1>a.box.maxX||p.y0<a.box.minY||p.y1>a.box.maxY)return`${a.name} (data-skel="${a.skel}") liegt ausserhalb der erwarteten Zone`;let d=p.x1-p.x0,f=p.y1-p.y0;if(d<a.minW||f<a.minH)return`${a.name} (data-skel="${a.skel}") ist zu klein (${d.toFixed(1)}x${f.toFixed(1)})`}for(let a of DL)if(!(t.includes(`transform="translate(${a.cx},${a.cy})"`)||o.some(l=>ut(ye(l,"cx"),a.cx)&&ut(ye(l,"cy"),a.cy))))return`Bauplan-Element fehlt: ${a.name} (circle ${a.cx},${a.cy})`;if(e){let a=xE.every(l=>r.some(u=>ut(ye(u,"cx"),l.cx,3)&&ut(ye(u,"cy"),l.cy,3))),c=i.some(l=>l.includes('fill="url(#wg-'));return!a&&!c?"Bauplan-Element fehlt: Fluegel oder Schwanz":null}for(let a of xE)if(!r.some(l=>ut(ye(l,"cx"),a.cx,3)&&ut(ye(l,"cy"),a.cy,3)))return`Bauplan-Element fehlt: ${a.name} (ellipse ${a.cx},${a.cy})`;return null}function _L(t,e=gL){if(!t||typeof t!="object")return"Bee data is not an object";let n=$i.filter(o=>o in t);if(n.length===0)return"No recognized bee states found";let s=yL.filter(o=>!(o in t));if(s.length>0)return`Missing required states: ${s.join(", ")}`;if(n.length<bE)return`Only ${n.length} states found, minimum ${bE} required`;for(let o of $i)if(o in t){if(typeof t[o]!="string")return`State "${o}" is not a string`;if(Buffer.byteLength(t[o],"utf8")>yE)return`State "${o}" exceeds ${yE/1024}KB limit`;if(e==="v5"||e==="v6"||e==="v7"||e==="v8"||e==="v9"){let r=DE(t[o],{allowBellyGear:e==="v7"});if(r)return`State "${o}": ${r}`}if(e==="v6"||e==="v7"||e==="v8"||e==="v9"){let r=SE(t[o],e==="v9");if(r)return`State "${o}": ${r}`}}return null}function kE(t){return AE(t)}function AE(t){return t.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<foreignObject[\s\S]*?<\/foreignObject>/gi,"").replace(/on\w+\s*=\s*["'][^"']*["']/gi,"").replace(/javascript\s*:/gi,"").replace(/<use[\s\S]*?\/>/gi,"")}function CL(t){let e={};for(let n of $i)t[n]&&(e[n]=kE(t[n]));return e}async function OL(t){try{let e=await Yn.get(`${Xn}/api/v1/memory/bee-gallery/${t}`,{timeout:3e3});return e.data?.success&&e.data?.memory?.value?e.data.memory.value:null}catch{return null}}async function TL(t,e,n){let s=JSON.stringify({states:e,prompt:n||null,storedAt:new Date().toISOString(),format:"full-bee-v1"});await Yn.post(`${Xn}/api/v1/memory/store`,{sessionId:null,key:t,value:s,metadata:{namespace:"bee-gallery",format:"full-bee-v1"}},{timeout:1e4})}async function PL(t){try{return(await Yn.get(`${Xn}/api/v1/agents/${t}/status`,{timeout:5e3})).data?.success===!0}catch(e){return e.response?.status!==404}}async function _E(t,e){await Yn.patch(`${Xn}/api/v1/agents/${t}/bee`,{customBeeHash:e},{timeout:5e3})}async function $L(){try{let e=(await Yn.get(`${Xn}/api/v1/memory/list/bee-gallery`,{timeout:5e3})).data?.memories||[];return await Promise.all(e.map(async n=>{try{let s=await Yn.get(`${Xn}/api/v1/memory/bee-gallery/${n.key}`,{timeout:3e3});return{...n,value:s.data?.memory?.value||null}}catch{return n}}))}catch{return[]}}var NL={command:"bee",describe:"Generate custom agent bee mascot",builder:t=>t.option("session",{alias:"s",type:"string",description:"Session ID"}).option("prompt",{alias:"p",type:"string",description:"Description of the desired bee"}).option("force",{alias:"f",type:"boolean",default:!1,description:"Skip cache"}).option("gallery",{type:"boolean",default:!1,description:"List cached bees"}).option("request",{alias:"r",type:"boolean",default:!1,description:"Submit a bee request to the generator queue"}).option("agent-type",{type:"string",description:"Override agent type for auto-prompt generation"}),handler:async t=>{try{if(t.gallery){let i=await $L();i.length===0?console.log("No bees in gallery yet."):(console.log(`Bee Gallery (${i.length} entries):
|
|
387
|
+
`),i.forEach(a=>{let c=a.key||a,l=null,u="unknown",p=0;try{let d=JSON.parse(a.value);l=d.prompt||null,u=d.format||"legacy-accessories",d.states&&(p=Object.keys(d.states).length)}catch{}console.log(` Hash: ${c}`),console.log(` Format: ${u}${p?` (${p} states)`:""}`),l&&console.log(` Prompt: "${l}"`),console.log()}));return}if(t.request){let i=t.session||gE("PLANBEE_SESSION_ID");i||(console.error("Error: --session or $PLANBEE_SESSION_ID required"),process.exit(1));try{let a=await Yn.post(`${Xn}/api/v1/bee/request`,{sessionId:i,prompt:t.prompt||null,agentType:t.agentType||null},{timeout:5e3});a.data?.success?(console.log(`[OK] Bee request submitted (ID: ${a.data.request.id})`),t.prompt?console.log(` Prompt: "${t.prompt}"`):console.log(" Mode: Auto-assignment (no specific prompt)"),console.log(" The Bee Generator agent will process this request.")):(console.error(`Error: ${a.data?.error||"Unknown error"}`),process.exit(1))}catch(a){a.response?.data?.error?console.error(`Error: ${a.response.data.error}`):console.error(`Error: ${a.message}`),process.exit(1)}return}let e=t.session||gE("PLANBEE_SESSION_ID");e||(console.error("Error: --session or $PLANBEE_SESSION_ID required"),process.exit(1));let{prompt:n}=t,s=n;!s&&t.agentType&&(s=vE(t.agentType,null),console.log(`Auto-generated prompt for ${t.agentType}: "${s}"`)),s||(console.error("Error: --prompt or --agent-type is required"),process.exit(1)),await PL(e)||(console.error(`Error: Session ${e} not found`),process.exit(1));let r=wE(s);if(console.log(`Bee hash: ${r}`),!t.force&&await OL(r)){console.log("[OK] Cache hit! Using existing bee."),await _E(e,r),console.log(`[OK] Bee assigned to session ${e.slice(0,8)}...`);return}console.log("[INFO] No cached bee found. Use the Bee Generator agent or POST /api/v1/bee/gallery to create one."),process.exit(1)}catch(e){console.error(`Error: ${e.message}`),process.exit(1)}}};pt.exports=NL;pt.exports.BEE_STATES=$i;pt.exports.ROLE_PROMPTS=qu;pt.exports.hashPrompt=wE;pt.exports.validateBeeStructure=_L;pt.exports.validateStateCoordinates=DE;pt.exports.validateSkeleton=SE;pt.exports.basicSanitize=AE;pt.exports.sanitizeBeeStates=CL;pt.exports.sanitizeFullSvg=kE;pt.exports.generatePromptForAgentType=vE;pt.exports.storeBeeInMemory=TL;pt.exports.updateSessionBeeHash=_E});var TE=D((tU,OE)=>{var IL=de(),{resolveApiUrl:RL}=te(),{getEnv:FL}=Be(),jL=RL(),Ni=["activity","alert-triangle","bell","book-open","bot","brush","bug","building-2","camera","check-circle-2","circle","clipboard-list","code","cog","compass","cpu","crown","database","eye","file-text","flask-conical","folder","git-branch","git-merge","globe","hand","hard-drive","heart","help-circle","hexagon","image","key","layers","lightbulb","loader-2","lock","mail","message-circle","monitor","music","package","palette","pause-circle","pencil","refresh-cw","rocket","search","server","settings","shield","shield-off","square","star","terminal","tool","user","users","wifi-off","wrench","zap"],LL={command:"icon",describe:"Set or clear the belly icon override for an agent bee mascot",builder:t=>t.option("session",{alias:"s",type:"string",description:"Session ID"}).option("set",{type:"string",description:'Lucide icon name to set (e.g. "crown", "flask-conical")'}).option("clear",{type:"boolean",default:!1,description:"Clear icon override (revert to status-driven icon)"}).option("list",{alias:"l",type:"boolean",default:!1,description:"List all available icon names"}),handler:async t=>{try{if(t.list){console.log(`Available icons (${Ni.length}):
|
|
388
|
+
`);let o=4,r=20;for(let i=0;i<Ni.length;i+=o){let a=Ni.slice(i,i+o).map(c=>c.padEnd(r)).join("");console.log(` ${a}`)}return}let e=t.session||FL("PLANBEE_SESSION_ID");e||(console.error("Error: --session or $PLANBEE_SESSION_ID required"),process.exit(1)),!t.set&&!t.clear&&(console.error("Error: --set <icon-name> or --clear required"),process.exit(1)),t.set&&!Ni.includes(t.set)&&(console.error(`Error: Unknown icon "${t.set}". Use --list to see available icons.`),process.exit(1));let n=t.clear?null:t.set,s=await IL.patch(`${jL}/api/v1/agents/${e}/icon`,{iconOverride:n},{timeout:5e3});s.data?.success?console.log(n?`[OK] Icon set to "${n}" for session ${e.slice(0,8)}...`:`[OK] Icon override cleared for session ${e.slice(0,8)}...`):(console.error(`Error: ${s.data?.error||"Unknown error"}`),process.exit(1))}catch(e){e.response?.status===404?console.error("Error: Session not found"):e.response?.data?.error?console.error(`Error: ${e.response.data.error}`):console.error(`Error: ${e.message}`),process.exit(1)}}};OE.exports=LL});var $E=D((nU,PE)=>{var Qn=et(),{resolveApiUrl:BL}=te(),{createApiClient:qL,getConnectionErrorMessage:ML}=lt(),UL=BL();function Mu(t,e){return t?t.length<=e?t:`${t.slice(0,e-3)}...`:"-"}function Uu(t){return t?t.replace(/\/+$/,""):""}function HL(t){return{active:"\u{1F7E2}",running:"\u{1F7E2}",spawning:"\u{1F535}",watching_inbox:"\u{1F7E1}",plan_ready:"\u{1F4CB}",waiting_for_answer:"\u23F3",waiting:"\u23F3",idle:"\u26AA",paused:"\u23F8\uFE0F",completed:"\u2705",stopped:"\u{1F534}",error:"\u{1F534}",timeout:"\u{1F534}"}[t]||"\u26AA"}async function zL(t){let e=qL(t),n;try{n=(await e.get("/api/v1/dashboard/overview")).data}catch(m){console.error(m.response?.data?.error||ML(UL)),process.exit(1)}(!n||!n.success)&&(console.error("Error: Cannot connect to PlanBee API or request failed."),process.exit(1));let s=n.data?.projects||[],o=Uu(process.cwd()),r=s;t.all||(r=s.filter(m=>Uu(m.folder)===o),r.length===0&&(r=s.filter(m=>o.startsWith(Uu(m.folder)))));let i=[],a=(m,h=0)=>{for(let g of m)i.push({...g,_depth:h}),g.children&&g.children.length>0&&a(g.children,h+1)};if(r.forEach(m=>a(m.agents||[])),t.children&&(i=i.filter(m=>m.parentId===t.children)),t.json&&(console.log(JSON.stringify({projects:r,agents:i,total:i.length},null,2)),process.exit(0)),i.length===0){let m=t.all?"global":o;console.log(Qn.t("dashboard.noAgents",{scope:m})),t.all||console.log(Qn.t("dashboard.useAll")),process.exit(0)}let c=r.length===1?r[0].name:"Alle Projekte";console.log(`
|
|
389
|
+
\u{1F41D} PlanBee Dashboard (${c})
|
|
390
|
+
`);let u=[{label:"Agent",width:10},{label:"",width:3},{label:"Status",width:14},{label:"Task",width:35},{label:"%",width:5},{label:"Model",width:14}].map(m=>m.label.padEnd(m.width)).join(" "),p="\u2500".repeat(u.length);console.log(u),console.log(p);for(let m of i){let h=(m.id||"").substring(0,8),g=HL(m.status),v=m.isWatchingInbox||m.status==="watching_inbox"?"watching":m.status||"-",E=m.activeTask?Mu(m.activeTask.title,35):Mu(m.currentTask||m.task,35),S=m.completionPercent!=null?`${m.completionPercent}%`:"-",C=m.activeTask?`${m.activeTask.percent||0}%`:S,B=Mu(m.model||"-",14),$=[`${" ".repeat(m._depth||0)}${h}`.padEnd(10),g.padEnd(3),v.padEnd(14),E.padEnd(35),C.padEnd(5),B.padEnd(14)];console.log($.join(" "))}let d={active:0,completed:0,error:0,other:0};for(let m of i)["active","running","spawning","delegating"].includes(m.status)?d.active++:m.status==="completed"?d.completed++:["error","timeout","stopped"].includes(m.status)?d.error++:d.other++;console.log(p);let f=d;console.log(Qn.t("dashboard.summary",{active:f.active,completed:f.completed,error:f.error,other:f.other})),process.exit(0)}PE.exports={command:"dashboard",describe:Qn.t("dashboard.describe"),builder:t=>t.option("all",{alias:"a",type:"boolean",description:Qn.t("dashboard.optAll"),default:!1}).option("children",{alias:"c",type:"string",description:Qn.t("dashboard.optChildren")}).option("json",{type:"boolean",description:Qn.t("dashboard.optJson"),default:!1}).example("$0 dashboard","Agenten im aktuellen Projekt").example("$0 dashboard --all","Alle Agenten aller Projekte").example("$0 dashboard --children <queen-id>","Kinder einer Queen"),handler:zL}});var IE=D((sU,NE)=>{var xn=et(),{resolveApiUrl:WL}=te(),{createApiClient:JL,getConnectionErrorMessage:KL}=lt(),GL=WL();function Ii(t,e){return t?t.length<=e?t:`${t.slice(0,e-3)}...`:"-"}function Hu(t){return t?t.replace(/\/+$/,""):""}function VL(t){if(!t)return"-";let e=new Date(t),n=s=>String(s).padStart(2,"0");return`${n(e.getHours())}:${n(e.getMinutes())}`}async function YL(t){let e=JL(t),n;try{n=(await e.get("/api/v1/sessions?includeCompleted=false")).data}catch(l){console.error(l.response?.data?.error||KL(GL)),process.exit(1)}(!n||!n.success)&&(console.error("Error: Cannot connect to PlanBee API. Is the server running?"),process.exit(1));let s=n.sessions||[],o=Hu(process.cwd());if(!t.all){let l=t.folder?Hu(t.folder):o;s=s.filter(u=>{let p=Hu(u.folder);return p===l||l.startsWith(p)})}if(t.status){let l=t.status.split(",").map(u=>u.trim().toLowerCase());s=s.filter(u=>l.includes(u.status))}if(t.json&&(console.log(JSON.stringify({success:!0,count:s.length,agents:s},null,2)),process.exit(0)),s.length===0){let l=t.all?"global":t.folder||o;console.log(xn.t("listAgents.noAgents",{scope:l})),t.all||console.log(xn.t("listAgents.useAll")),process.exit(0)}let r=t.all?"(global)":`in ${t.folder||o}`;console.log(xn.t("listAgents.agentCount",{count:s.length,scope:r}));let a=[{label:"ID",width:36},{label:"Status",width:12},{label:"Type",width:12},{label:"Topic",width:25},{label:"Task",width:25},{label:"Model",width:14},{label:"Updated",width:6}].map(l=>l.label.padEnd(l.width)).join(" "),c="-".repeat(a.length);console.log(a),console.log(c);for(let l of s){let u=[(l.id||"").padEnd(36),(l.status||"-").padEnd(12),Ii(l.agentType||"-",12).padEnd(12),Ii(l.topic||"-",25).padEnd(25),Ii(l.task||"-",25).padEnd(25),Ii(l.model||"-",14).padEnd(14),VL(l.updatedAt).padEnd(6)];console.log(u.join(" "))}console.log(""),process.exit(0)}NE.exports={command:"agents",describe:xn.t("listAgents.describe"),builder:t=>t.option("all",{alias:"a",type:"boolean",description:xn.t("listAgents.optAll"),default:!1}).option("folder",{alias:"f",type:"string",description:xn.t("listAgents.optFolder")}).option("status",{alias:"s",type:"string",description:xn.t("listAgents.optStatus")}).option("json",{type:"boolean",description:xn.t("listAgents.optJson"),default:!1}).example("$0 agents","Aktive Agenten im aktuellen Projekt").example("$0 agents --all","Alle aktiven Agenten").example("$0 agents --status active,plan_ready","Nur bestimmte Status"),handler:YL}});var LE=D((oU,jE)=>{var an=et(),{resolveApiUrl:XL}=te(),{createApiClient:QL,getConnectionErrorMessage:ZL}=lt(),eB=XL();function RE(t,e){if(!t)return"";let n=t.replace(/\n/g," ").replace(/\s+/g," ").trim();return n.length<=e?n:`${n.slice(0,e-3)}...`}function FE(t){return t?t.replace(/\/+$/,""):""}function tB(t){if(!t)return"-";let e=Date.now(),n=new Date(t).getTime(),s=e-n,o=Math.floor(s/1e3);if(o<60)return an.t("activity.now");let r=Math.floor(o/60);if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function nB(t){if(!t)return null;let e=t.match(/^(\d+)([smhd])$/);if(!e)return null;let n=parseInt(e[1],10),s=e[2];return n*({s:1e3,m:6e4,h:36e5,d:864e5}[s]||6e4)}async function sB(t){let e=QL(t),n=async l=>{try{return(await e.get(l)).data}catch{return null}},s;try{s=(await e.get("/api/v1/sessions?includeCompleted=false")).data}catch(l){console.error(l.response?.data?.error||ZL(eB)),process.exit(1)}(!s||!s.success)&&(console.error("Error: Cannot connect to PlanBee API. Is the server running?"),process.exit(1));let o=s.sessions||[],r=FE(process.cwd());t.all||(o=o.filter(l=>{let u=FE(l.folder);return u===r||r.startsWith(u)})),o.length===0&&(console.log(an.t("activity.noAgents")),t.all||console.log(an.t("activity.useAll")),process.exit(0));let i=o.map(l=>n(`/api/v1/agents/${l.id}/transcript/tail?lines=1`)),a=await Promise.allSettled(i),c=o.map((l,u)=>{let p=a[u],d=null,f=l.updatedAt;if(p.status==="fulfilled"&&p.value&&p.value.success){let h=p.value.entries||[];h.length>0&&(d=h[h.length-1],f=d.timestamp||f)}let m=an.t("activity.noActivityEntry");if(d){if(d.content)m=RE(d.content,60);else if(d.toolUses&&d.toolUses.length>0){let h=d.toolUses[0];m=RE(h.description||h.command||h.name||"Tool call",60)}}return{id:l.id,shortId:l.id.substring(0,8),status:l.status,timeAgo:tB(f),timestamp:f,summary:m}});if(t.since){let l=nB(t.since);if(l){let u=Date.now()-l;c.filter(p=>new Date(p.timestamp).getTime()>=u)}}t.json&&(console.log(JSON.stringify({success:!0,count:c.length,activities:c},null,2)),process.exit(0)),c.length===0&&(console.log(an.t("activity.noActivity")),process.exit(0)),console.log("");for(let l of c){let u=l.timeAgo.padEnd(6);console.log(`${l.shortId} ${u} ${l.summary}`)}console.log(""),process.exit(0)}jE.exports={command:"activity",describe:an.t("activity.describe"),builder:t=>t.option("all",{alias:"a",type:"boolean",description:an.t("activity.optAll"),default:!1}).option("since",{type:"string",description:an.t("activity.optSince")}).option("json",{type:"boolean",description:an.t("activity.optJson"),default:!1}).example("$0 activity","Letzte Aktion pro Agent").example("$0 activity --all","Alle Projekte").example("$0 activity --since 10m","Nur letzte 10 Minuten"),handler:sB}});var UE=D((rU,ME)=>{var BE=de(),{resolveApiUrl:oB}=te(),qE=oB(),rB={green:"\x1B[32m",yellow:"\x1B[33m",red:"\x1B[31m"},iB="\x1B[0m";async function aB(t){try{if(t.canSpawn){(await BE.get(`${qE}/api/v1/system/can-spawn`)).data.allowed?(console.log("ALLOWED"),process.exit(0)):(console.log("BLOCKED"),process.exit(1));return}let e=await BE.get(`${qE}/api/v1/system/load`),{data:n}=e;if(t.json){console.log(JSON.stringify(n,null,2)),process.exit(0);return}let{cpu:s,memory:o,agents:r,severity:i,canSpawn:a}=n,c=rB[i]||"",l=s.loadAvg.map(p=>p.toFixed(1)).join(" "),u=Object.entries(r.byLlmType||{}).map(([p,d])=>`${d} ${p}`).join(", ")||"none";console.log(`System Load: ${c}${i.toUpperCase()}${iB}`),console.log(` CPU: ${s.percent}% (${s.cores} cores, load avg: ${l})`),console.log(` RAM: ${o.percent}% (${o.usedGb} / ${o.totalGb} GB)`),console.log(` Agents: ${r.total}/${r.maxConcurrent} active (${u})`),console.log(` Spawn: ${a?"\x1B[32mALLOWED\x1B[0m":"\x1B[31mBLOCKED\x1B[0m"}`),process.exit(0)}catch(e){e.response?console.error(`Error: ${e.response.data?.error||e.message}`):e.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${e.message}`),process.exit(1)}}ME.exports={command:"system-load",describe:"Show system resource load (CPU, RAM, agents)",builder:t=>t.option("json",{type:"boolean",description:"Output JSON",default:!1}).option("can-spawn",{type:"boolean",description:"Exit 0 if spawn allowed, 1 if blocked",default:!1}),handler:aB}});var WE=D((iU,zE)=>{var Ri=de(),{resolveApiUrl:cB}=te(),{getEnv:HE}=Be(),Fi=cB();async function lB(t){let{project:e,session:n}=t;e||(console.error("Error: --project is required"),process.exit(1));let s=n||HE("PLANBEE_SESSION_ID");s||(console.error("Error: --session or PLANBEE_SESSION_ID required"),process.exit(1));try{let o=await Ri.post(`${Fi}/api/v1/system/test-locks`,{projectPath:e,sessionId:s});console.log(`Lock acquired: ${o.data.lock.id}`),process.exit(0)}catch(o){if(o.response?.status===409){let{lock:r}=o.response.data;console.error(`Lock held by session ${r?.session_id?.slice(0,8)||"unknown"} since ${r?.acquired_at||"unknown"}`),process.exit(1)}console.error(`Error: ${o.response?.data?.error||o.message}`),process.exit(1)}}async function uB(t){let{project:e,session:n}=t;e||(console.error("Error: --project is required"),process.exit(1));let s=n||HE("PLANBEE_SESSION_ID");try{let i=((await Ri.get(`${Fi}/api/v1/system/test-locks`)).data.locks||[]).find(a=>a.project_path===e&&(!s||a.session_id===s));i||(console.error("No active lock found for this project/session"),process.exit(1)),await Ri.delete(`${Fi}/api/v1/system/test-locks/${i.id}`),console.log("Lock released"),process.exit(0)}catch(o){console.error(`Error: ${o.response?.data?.error||o.message}`),process.exit(1)}}async function pB(t){try{let e=await Ri.get(`${Fi}/api/v1/system/test-locks`),{locks:n}=e.data;if(t.json){console.log(JSON.stringify(n,null,2)),process.exit(0);return}if(n.length===0)console.log("No active test locks");else{console.log(`Active test locks (${n.length}):`);for(let s of n){let o=Math.round((Date.now()-new Date(s.acquired_at).getTime())/6e4);console.log(` ${s.project_path} session=${s.session_id.slice(0,8)} type=${s.lock_type} age=${o}min`)}}process.exit(0)}catch(e){e.code==="ECONNREFUSED"?console.error("Error: Cannot connect to PlanBee API. Is the server running?"):console.error(`Error: ${e.response?.data?.error||e.message}`),process.exit(1)}}zE.exports={command:"test-lock <subcommand>",describe:"Manage test suite locks to prevent parallel test runs",builder:t=>t.command({command:"acquire",describe:"Acquire a test lock for a project",builder:e=>e.option("project",{type:"string",description:"Absolute project path",demandOption:!0}).option("session",{type:"string",description:"Session ID (default: PLANBEE_SESSION_ID)"}),handler:lB}).command({command:"release",describe:"Release a test lock for a project",builder:e=>e.option("project",{type:"string",description:"Absolute project path",demandOption:!0}).option("session",{type:"string",description:"Session ID (default: PLANBEE_SESSION_ID)"}),handler:uB}).command({command:"status",describe:"List active test locks",builder:e=>e.option("json",{type:"boolean",description:"Output JSON",default:!1}),handler:pB}).demandCommand(1,"You need to specify a test-lock subcommand").help(),handler:()=>{}}});var GE=D((aU,KE)=>{var JE=de(),dB=require("path"),{resolveApiUrl:fB}=te(),ji=fB(),Fe={cyan:t=>`\x1B[36m${t}\x1B[0m`,green:t=>`\x1B[32m${t}\x1B[0m`,yellow:t=>`\x1B[33m${t}\x1B[0m`,red:t=>`\x1B[31m${t}\x1B[0m`,gray:t=>`\x1B[90m${t}\x1B[0m`,bold:t=>`\x1B[1m${t}\x1B[0m`},mB={"claude-cli":"\u{1F7E0}","claude-sdk":"\u{1F535}",copilot:"\u{1F7E3}"};KE.exports={command:"discover",describe:"Discover and import historical CLI/SDK sessions",builder:t=>t.option("project",{type:"string",description:"Filter by project path (absolute)"}).option("provider",{type:"string",choices:["claude-cli","claude-sdk","copilot","all"],default:"all",description:"Filter by provider"}).option("import",{type:"boolean",default:!1,description:"Import all non-imported sessions"}).option("import-all",{type:"boolean",default:!1,description:"Import all without confirmation"}).option("limit",{type:"number",default:50,description:"Maximum sessions to display"}).option("json",{type:"boolean",default:!1,description:"JSON output"}).example("$0 discover","Scan all providers").example("$0 discover --provider claude-sdk","Show only SDK sessions").example("$0 discover --import-all","Import all non-imported sessions"),handler:async t=>{try{t.project&&(dB.isAbsolute(t.project)||(console.error(Fe.red("Error: --project must be an absolute path")),process.exit(1)),t.project.includes("..")&&(console.error(Fe.red('Error: --project must not contain ".."')),process.exit(1)));let e=new URLSearchParams;t.project&&e.set("project",t.project),t.provider&&t.provider!=="all"&&e.set("provider",t.provider),t.limit&&e.set("limit",t.limit),console.log(Fe.cyan("\u{1F50D} Scanning for sessions..."));let n;try{n=(await JE.get(`${ji}/api/v1/sessions/discover?${e}`,{timeout:3e4})).data.sessions||[]}catch(r){console.error(Fe.red(`Error: PlanBee API unreachable (${ji}/api/v1/sessions/discover).`)),console.error(Fe.red(` ${r.message}`)),process.exit(1)}if(t.json){console.log(JSON.stringify({sessions:n,total:n.length},null,2));return}if(n.length===0){console.log(Fe.yellow("No sessions found."));return}let s=n.filter(r=>!r.alreadyImported),o=n.filter(r=>r.alreadyImported);console.log(`
|
|
391
|
+
Found ${Fe.bold(n.length)} sessions (${Fe.green(`${s.length} new`)}, ${Fe.gray(`${o.length} already imported`)})
|
|
392
|
+
`),console.log(Fe.bold(" Provider Session ID Project First Prompt Date")),console.log(` ${"\u2500".repeat(95)}`);for(let r of n){let i=mB[r.provider]||"\u26AA",a=r.provider.padEnd(10),c=(r.sessionId||"").substring(0,8),l=(r.projectName||"\u2014").substring(0,14).padEnd(14),u=(r.firstPrompt||r.summary||"\u2014").substring(0,35).padEnd(35),p=r.timestamps?.modified?new Date(r.timestamps.modified).toLocaleDateString():"\u2014",d=r.alreadyImported?Fe.gray(" \u2713"):Fe.green(" \u2605");console.log(`${d} ${i} ${a} ${c} ${l} ${u} ${p}`)}if((t.import||t.importAll)&&s.length>0){console.log(`
|
|
393
|
+
${Fe.cyan(`Importing ${s.length} sessions...`)}`);try{let i=(await JE.post(`${ji}/api/v1/sessions/discover/import`,{sessions:s},{timeout:6e4})).data;if(console.log(Fe.green(`\u2713 Imported: ${i.imported}`)),i.skipped>0&&console.log(Fe.yellow(`\u2298 Skipped: ${i.skipped}`)),i.failed?.length>0){console.log(Fe.red(`\u2717 Failed: ${i.failed.length}`));for(let a of i.failed)console.log(Fe.red(` - ${a.sessionId}: ${a.error}`))}}catch(r){console.error(Fe.red(`Error: import failed, PlanBee API unreachable (${ji}/api/v1/sessions/discover/import).`)),console.error(Fe.red(` ${r.message}`)),process.exit(1)}}else s.length>0&&!t.import&&!t.importAll&&console.log(`
|
|
394
|
+
${Fe.gray("Use --import or --import-all to import new sessions.")}`)}catch(e){console.error(Fe.red(`Error: ${e.message}`)),process.exit(1)}}}});var XE=D((cU,YE)=>{function hB(t,e={}){let n=["CLI Authentication Status"],s=t||{},o=e.patSnapshot,r=e.jwtSnapshot;if(o){let i=o.daysOld!=null?`${o.daysOld}d`:"?",a=VE(s,"pat",!1);n.push(` PAT (cli-auth.json): ${a} (age ${i})`)}else n.push(" PAT (cli-auth.json): --");if(r){let i=gB(r.minutesLeft),a=VE(s,"jwt",!!r.expired);n.push(` JWT (auth.json): ${a} (${i})`)}else n.push(" JWT (auth.json): --");return s.kind?n.push(` Active source: ${s.kind.toUpperCase()}`):n.push(" Active source: none"),s.email&&n.push(` Account: ${s.email}`),s.valid||(n.push(""),s.errorCode==="MISSING_TOKEN"?(n.push(" No CLI token found. Run:"),n.push(" planbee auth login --github")):s.expiredError?(n.push(""),n.push(" Token rejected. Run ONE of:"),n.push(" planbee auth login --github (opens browser, easiest)"),n.push(" planbee auth login --google"),n.push(" planbee auth login --email <you> --password <pw>")):(s.errorCode==="TRANSIENT"||s.errorCode==="NETWORK")&&(n.push(""),n.push(` Cannot reach server right now (${s.errorCode}: ${s.errorMessage||"n/a"}).`),n.push(" Token may still be valid; will retry on next command."))),n.join(`
|
|
395
|
+
`)}YE.exports={formatAuthStatus:hB};function VE(t,e,n){return t.kind!==e?n?"expired":"standby":t.valid?"valid":t.expiredError?"EXPIRED":"unreachable"}function gB(t){return t==null?"?":t<0?"expired":`${t}m left`}});var tD=D((lU,eD)=>{var QE=de(),yB=require("os"),Zn=it(),{resolveApiUrl:ZE}=te(),bB=ci(),{formatAuthStatus:xB}=XE();async function vB(t,e,n){let s=ZE(n),o;try{o=(await QE.post(`${s}/auth/login`,{email:t,password:e},{timeout:1e4})).data}catch(l){let u=l.response?.data?.error||l.response?.data?.details||l.message;throw new Error(`Login failed: ${u}`)}let r=o.access_token||o.session?.access_token;if(!r)throw new Error("Login failed: no access token in server response");let i;try{i=await QE.post(`${s}/api/v1/cli-tokens`,{name:`cli-${yB.hostname()}`},{headers:{Authorization:`Bearer ${r}`},timeout:1e4})}catch(l){let u=l.response?.data?.error||l.message;throw new Error(`Could not issue CLI token: ${u}`)}let{token:a}=i.data;if(!a)throw new Error("Could not issue CLI token: server returned no token");let c=o.user||o.session?.user||{};Zn.save({token:a,api_url:s,user:{id:c.id||null,email:c.email||t},created_at:new Date().toISOString()}),n.json?console.log(JSON.stringify({success:!0,user:{email:c.email||t}},null,2)):(console.log("Login successful"),console.log(`Welcome, ${c.email||t}`))}async function wB(t){if(t.github||t.google){console.error(`Error: OAuth login (--${t.github?"github":"google"}) is not available in the standalone planbee CLI. Use --email/--password, or log in via the PlanBee app and run \`planbee auth login --token <pat>\`.`),process.exit(1);return}if(t.token){Zn.save({token:t.token,api_url:ZE(t),user:null,created_at:new Date().toISOString()}),console.log("Token saved to ~/.planbee/cli-auth.json");return}let{email:e,password:n}=t;(!e||!n)&&(console.error("Error: Email and password are required"),console.error("Usage: planbee auth login --email <email> --password <pass>"),console.error(" Or: planbee auth login --token <personal-access-token>"),process.exit(1));try{await vB(e,n,t)}catch(s){t.json?console.log(JSON.stringify({success:!1,error:s.message},null,2)):console.error(s.message),process.exit(1)}}async function EB(t){let e=Zn.load();if(!e||!e.token){t.json?console.log(JSON.stringify({success:!0,message:"Already logged out"})):console.log("Not logged in");return}Zn.clear(),t.json?console.log(JSON.stringify({success:!0,message:"Logged out successfully"})):console.log("Logged out successfully")}async function DB(t){let e=await bB.validateAuth();if(t.json){console.log(JSON.stringify({authenticated:e.valid,user:e.user||(e.email?{email:e.email}:null),active_source:e.kind,pat:e.kind==="pat"?{store:e.store,daysOld:e.daysOld}:null,error:e.expiredError?{code:e.errorCode,message:e.expiredError.message}:null},null,2));return}let n=Zn.load(),s=n&&n.token?{daysOld:e.kind==="pat"?e.daysOld:null}:null;console.log(xB(e,{patSnapshot:s,jwtSnapshot:null}))}async function SB(t,e){switch(t){case"login":await wB(e);break;case"logout":await EB(e);break;case"status":case"whoami":await DB(e);break;default:console.error(`Unknown auth subcommand: ${t}`),console.error("Available subcommands: login, logout, status"),process.exit(1)}}eD.exports={authCommand:SB,loadToken:Zn.load.bind(Zn)}});var nD=D((uU,kB)=>{kB.exports={name:"planbee",version:"0.1.0",description:"PlanBee CLI - agent coordination, hooks, and voice notifications for Claude Code",license:"SEE LICENSE IN LICENSE",bin:{planbee:"bin/planbee.js"},files:["bin","LICENSE","THIRD-PARTY-NOTICES.txt"],engines:{node:">=18"},scripts:{build:"node scripts/build.js && node scripts/third-party-notices.js",prepublishOnly:"npm run build"},dependencies:{},devDependencies:{axios:"^1.6.2",yargs:"^17.7.2",i18next:"^26.2.0",esbuild:"^0.24.0"},repository:{type:"git",url:"git+https://git.infin8.world/infin8/planbee-cli.git"},author:"infin8 world llc (https://www.infin8.world)",homepage:"https://www.infin8.world"}});var AB=de(),{resolveApiUrl:_B}=te(),{isLinearEnabled:CB}=nh(),{validatePathAbsolute:OB}=Qa(),TB=`${_B()}/notify`,sD=1,oD=5e3,rD=100,PB=.5,$B=2,NB=0,IB=1,RB=["info","success","error","warning","progress","question","joke","finished_user_interaction_required"],FB=["happy","sad","excited","serious","calm","neutral","cheerful"],Ku=0,cD=1,Vo=2,zu=3;function lD(t){return!t||t.length<sD?`Message must be at least ${sD} character`:t.length>oD?`Message must not exceed ${oD} characters`:null}function uD(t){return t&&t.length>rD?`Title must not exceed ${rD} characters`:null}function pD(t){return OB(t)}function Wu(t,e,n,s){let o=parseFloat(t);return Number.isNaN(o)?`${s} must be a valid number`:o<e||o>n?`${s} must be between ${e} and ${n}`:null}function dD(t,e){return t&&!e||!t&&e?"Both --project and --path must be provided together":null}function iD(t,e=!1){e||console.error(`Error: ${t}`)}function aD(t,e=!1,n=!1){e||console.log(n?JSON.stringify(t,null,2):t)}function fD(t){let{id:e,status:n}=t;return n==="queued"?`[OK] Message queued (ID: ${e})`:`[OK] Message sent (ID: ${e})`}async function mD(t){let e={message:t.message};t.project&&t.path&&(e.project=t.project,e.path=t.path),t.type&&(e.type=t.type),t.title&&(e.title=t.title),t.mood&&(e.mood=t.mood),t.speed!==void 0&&(e.speech_speed=parseFloat(t.speed)),t.volume!==void 0&&(e.volume=parseFloat(t.volume)),t.voiceId&&(e.voice_id=t.voiceId);try{return{success:!0,data:(await AB.post(TB,e,{headers:{"Content-Type":"application/json"},timeout:5e3})).data}}catch(n){if(n.code==="ECONNREFUSED"||n.code==="ETIMEDOUT")return{success:!1,error:"Cannot connect to PlanBee server",exitCode:zu};if(n.response){let{status:s,data:o}=n.response;return s===503?{success:!1,error:"PlanBee server is offline",exitCode:zu}:s===404?{success:!1,error:"Project not found. Use --register to register project first.",exitCode:Vo}:{success:!1,error:`HTTP ${s}: ${o.error||o.message||"Unknown error"}`,exitCode:Vo}}return{success:!1,error:n.message||"Unknown error occurred",exitCode:Vo}}}function hD(){return process.argv.includes("--json")}var Ju={tasks:"planbee tasks <session-id> --json",status:"planbee status <session-id> --json",transcript:"planbee transcript <session-id> --json",send:'planbee send <session-id> "<message>" --json',spawn:'planbee spawn --task "<task>" --json'};function gD(){let t=process.argv[2];return t&&Ju[t]?Ju[t]:"planbee --help --json"}function yD(){return function(e,n,s){if(!e&&!n)return;let o=e||n?.message||"Unknown error";if(hD()){let r=gD();console.log(JSON.stringify({error:!0,message:o,suggestion:r})),process.exit(1)}else console.error(`Error: ${o}`),s.showHelp(),process.exit(1)}}async function jB(){let t=Fg(),{hideBin:e}=Lg(),n=Hg(),s=Wg(),o=Kg(),r=Qg(),i=ey(),a=ny(),c=iy(),l=uy(),u=dy(),p=my(),d=gy(),f=by(),m=vy(),h=Ey(),g=Sy(),b=_y(),v=Oy(),E=rx(),S=dx(),C=Rx(),B=hv(),L=wv(),$=Av(),I=Cv(),R=Pv(),U=Bv(),Q=Uv(),M=Wv(),z=Gv(),ge=Yv(),oe=Zv(),xe=nw(),Ee=gw(),ve=Ew(),Me=kw(),F=Ou(),H=T0(),W=N0(),N=z0(),ce=Q0(),pe=eE(),Z=nE(),me=oE(),_e=aE(),ie=lE(),Ue=pE(),ze=fE(),le=hE(),Xe=CE(),w=TE(),_=$E(),j=IE(),A=LE(),k=UE(),P=WE(),O=GE(),{authCommand:q}=tD(),G=await t(e(process.argv)).scriptName("planbee").version(nD().version).fail(yD()).usage("Usage: $0 <command> [options]").command(n).command(CB()?[{command:"linear",describe:"Linear integration commands",builder:ae=>ae.command(s).command(o).command(r).command(i).command(a).command(c).command(l).command(u).command(p).command(d).command(f).command(m).command(h).command(g).command(b).demandCommand(1,"You need to specify a linear subcommand").help(),handler:()=>{}}]:[]).command("auth <subcommand>","Authentication commands (login, logout, whoami)",ae=>ae.positional("subcommand",{describe:"Auth subcommand",choices:["login","logout","status","whoami"]}).option("email",{type:"string",description:"Email address"}).option("password",{type:"string",description:"Password"}).option("token",{type:"string",description:"Existing personal access token to store directly"}),async ae=>{await q(ae.subcommand,ae)}).command(E).command(S).command(oe).command(xe).command(Ee).command(C.send).command(C.sendToQueen).command(B).command(L).command($).command(Q).command("swarm","Swarm management commands",ae=>ae.command(M).command(z).demandCommand(1,"You need to specify a swarm subcommand").help()).command("providers","Provider management commands",ae=>ae.command(ge).demandCommand(1,"You need to specify a providers subcommand").help()).command("memory","Memory management commands",ae=>ae.command(I.store).command(I.get).command(I.list).command(I.delete).command(I.export).command(I.import).command(I.cleanup).command(I.history).command(I.diff).demandCommand(1,"You need to specify a memory subcommand").help()).command(R.agent).command(U.listChildren).command(ve).command(Me).command(F).command(H).command(W).command(v).command("audio","Audio and TTS configuration",ae=>ae.command(N).demandCommand(1,"You need to specify an audio subcommand").help()).command("hooks","Manage PlanBee hooks in projects",ae=>ae.command(ce).command(pe).command(Z).demandCommand(1,"You need to specify a hooks subcommand").help()).command("search","Search agents and transcripts",ae=>ae.command(me).command(_e).demandCommand(1,"You need to specify a search subcommand").help()).command(ie).command(Ue).command(ze).command(le).command(Xe).command(w).command(_).command(j).command(A).command(k).command(P).command(O).option("project",{type:"string",description:"Project identifier",global:!1}).option("path",{type:"string",description:"Absolute project path",global:!1}).option("message",{type:"string",description:"Message to send (1-5000 characters)",global:!1}).option("type",{type:"string",description:"Message type",choices:RB,default:"info",global:!1}).option("title",{type:"string",description:"Short title (max 100 chars)",global:!1}).option("mood",{type:"string",description:"Voice mood",choices:FB,default:"neutral",global:!1}).option("speed",{type:"number",description:"Speech speed (0.5-2.0)",default:1,global:!1}).option("volume",{type:"number",description:"Volume (0.0-1.0)",default:.8,global:!1}).option("voice-id",{type:"string",description:"Override voice selection",global:!1}).option("quiet",{type:"boolean",description:"Suppress stdout",default:!1,global:!1}).option("json",{type:"boolean",description:"Output JSON response",default:!1,global:!1}).option("local",{type:"boolean",description:"Use local dev server (http://localhost:3456) instead of cloud",default:!1,global:!0,coerce:ae=>(ae&&(process.env.PLANBEE_MODE="local"),ae)}).help("h").alias("h","help").example('$0 --project myapp --path /home/user/myapp --message "Build complete"').example('$0 --message "Quick notification" --type success').example('$0 register --folder /path/to/workspace --task "Research task" --agent-type researcher').example('$0 spawn --type coder --task "Implement feature" --parent session-id-here').example(`$0 memory store --key task-status --value '{"status": "completed"}'`).epilogue(`Modes: cloud (default, https://planbee.infin8.world), local (--local / PLANBEE_MODE=local -> http://localhost:3456).
|
|
396
|
+
Override the API base URL entirely with PLANBEE_API_URL.
|
|
397
|
+
|
|
398
|
+
infin8 -- infin8 world llc, www.infin8.world`).strict().parseAsync(),ee=["linear","register","spawn","start-agent","devices","send","send-to-queen","inbox","remote-control","memory","wait","status","list-children","tree","auth","progress","tasks","internal-hook","audio","hooks","search","transcript","todo","plan","bee","icon","watch-rules","swarm","providers","dashboard","agents","activity","system-load","test-lock","discover"];if(Array.isArray(G._)&&G._.length>0&&ee.includes(G._[0]))return;let Qe=[lD(G.message),uD(G.title),dD(G.project,G.path),G.path?pD(G.path):null,Wu(G.speed,PB,$B,"Speed"),Wu(G.volume,NB,IB,"Volume")];for(let ae of Qe)ae&&(iD(ae,G.quiet),process.exit(cD));let je=await mD({message:G.message,project:G.project,path:G.path,type:G.type,title:G.title,mood:G.mood,speed:G.speed,volume:G.volume,voiceId:G.voiceId});je.success?(G.json?aD(je.data,G.quiet,!0):aD(fD(je.data),G.quiet,!1),process.exit(Ku)):(iD(je.error,G.quiet),process.exit(je.exitCode))}function LB(){let t=n=>{let s=process.argv.indexOf(`--${n}`);return s!==-1?process.argv[s+1]:void 0},e=Ou();return Promise.resolve(e.handler({type:t("type"),session:t("session"),"transcript-path":t("transcript-path"),deliver:process.argv.includes("--deliver")}))}if(require.main===module){let t=process.argv[2]==="internal-hook";(t?LB():jB()).catch(n=>{console.error("Fatal error:",n.message),process.exit(t?Ku:Vo)})}module.exports={validateMessage:lD,validateTitle:uD,validateAbsolutePath:pD,validateRange:Wu,validateProjectContext:dD,sendNotification:mD,formatResponse:fD,isJsonMode:hD,buildJsonFailHandler:yD,buildSuggestion:gD,COMMAND_SUGGESTIONS:Ju,EXIT_SUCCESS:Ku,EXIT_VALIDATION_ERROR:cD,EXIT_SYSTEM_ERROR:Vo,EXIT_APP_OFFLINE:zu};
|