Dot_Files/.config/raycast/extensions/6d35b3a5-ae12-48b1-b5de-616a22387eae/image_list.js

22 lines
141 KiB
JavaScript
Raw Normal View History

var Ds=Object.create;var dt=Object.defineProperty;var Ns=Object.getOwnPropertyDescriptor;var Ms=Object.getOwnPropertyNames;var Fs=Object.getPrototypeOf,js=Object.prototype.hasOwnProperty;var dn=e=>dt(e,"__esModule",{value:!0});var v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bs=(e,t)=>{for(var r in t)dt(e,r,{get:t[r],enumerable:!0})},hn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ms(t))!js.call(e,i)&&(r||i!=="default")&&dt(e,i,{get:()=>t[i],enumerable:!(n=Ns(t,i))||n.enumerable});return e},pn=(e,t)=>hn(dn(dt(e!=null?Ds(Fs(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),Us=(e=>(t,r)=>e&&e.get(t)||(r=hn(dn({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var Qt=v((Il,Xt)=>{var mn=[],Gs=mn.forEach,Ws=mn.slice;Xt.exports.extend=function(e){return Gs.call(Ws.call(arguments,1),function(t){if(t)for(var r in t)e[r]=t[r]}),e};Xt.exports.parseJSON=function(e){try{return JSON.parse(e)}catch{return null}}});var bn=v((yn,pt)=>{var Hs=require("https"),zs=require("http"),er=require("url"),gn=Qt(),xl=pt.exports.maxRedirects=5,vn={https:Hs,http:zs};for(ht in vn)X=function(){},X.prototype=vn[ht],X=new X,X.request=function(e){return function(t,r,n){n=n||{};var i=typeof t=="object"&&"maxRedirects"in t?t.maxRedirects:yn.maxRedirects,o=gn.extend({count:0,max:i,clientRequest:null,userCallback:r},n);if(o.count>o.max){var s=new Error("Max redirects exceeded. To allow more redirects, pass options.maxRedirects property.");return o.clientRequest.emit("error",s),o.clientRequest}o.count++;var a;typeof t=="string"?a=t:a=er.format(gn.extend({protocol:ht},t));var u=Object.getPrototypeOf(e).request(t,c(a,o));o.clientRequest||(o.clientRequest=u);function c(f,l){return function(d){if(d.statusCode<300||d.statusCode>399||!("location"in d.headers))return l.userCallback(d);var h=er.resolve(f,d.headers.location),w=er.parse(h).protocol;return w=w.substr(0,w.length-1),pt.exports[w].get(h,c(f,l),l)}}return u}}(X),X.get=function(e){return function(t,r,n){var i=e.request(t,r,n);return i.end(),i}}(X),pt.exports[ht]=X;var X,ht});var tr=v((Ll,wn)=>{wn.exports=require("stream")});var Cn=v((ql,En)=>{"use strict";function Sn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Vs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Sn(Object(r),!0).forEach(function(n){$s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ks(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ys(e,t,r){return t&&_n(e.prototype,t),r&&_n(e,r),e}var Js=require("buffer"),mt=Js.Buffer,Zs=require("util"),rr=Zs.inspect,Xs=rr&&rr.custom||"inspect";function Qs(e,t,r){mt.prototype.copy.call(e,t,r)}En.exports=function(){function e(){Ks(this,e),this.head=null,this.tail=null,this.length=0}return Ys(e,[{key:"push",value:function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"con
`).join(`
`+o),e.push(i+"m+"+Lt.exports.humanize(this.diff)+"")}else e[0]=hf()+t+" "+e[0]}function hf(){return I.inspectOpts.hideDate?"":new Date().toISOString()+" "}function pf(...e){return process.stderr.write(xt.format(...e)+`
`)}function mf(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function gf(){return process.env.DEBUG}function vf(e){e.inspectOpts={};let t=Object.keys(I.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=I.inspectOpts[t[r]]}Lt.exports=Ir()(I);var{formatters:Li}=Lt.exports;Li.o=function(e){return this.inspectOpts.colors=this.useColors,xt.inspect(e,this.inspectOpts).split(`
`).map(t=>t.trim()).join(" ")};Li.O=function(e){return this.inspectOpts.colors=this.useColors,xt.inspect(e,this.inspectOpts)}});var Di=v((nc,Lr)=>{typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Lr.exports=Pi():Lr.exports=qi()});var Mi=v((ic,Ni)=>{var yf=require("fs");Ni.exports=function(e,t,r){t=typeof t!="undefined"?t:`
`,r=typeof r!="undefined"?r:"utf8";var n=[],i=yf.readFileSync(e,r);if(i.indexOf("-END CERTIFICATE-")<0||i.indexOf("-BEGIN CERTIFICATE-")<0)throw Error("File does not contain 'BEGIN CERTIFICATE' or 'END CERTIFICATE'");i=i.split(t);var o=[],s,a;for(s=0,a=i.length;s<a;s++){var u=i[s];u.length!==0&&(o.push(u),u.match(/-END CERTIFICATE-/)&&(n.push(o.join(t)),o=[]))}return n}});var Bi=v((oc,ji)=>{var bf=require("querystring"),wf=bn(),qr=require("fs"),qt=require("path"),xe=require("url"),Sf=Ci(),Dt=Di()("modem"),Fi=Qt(),_f=require("util"),xe=require("url"),Ef=Mi(),Cf=require("os").type()==="Windows_NT",Tf=function(){var e,t={};if(!process.env.DOCKER_HOST)t.socketPath=Cf?"//./pipe/docker_engine":"/var/run/docker.sock";else if(process.env.DOCKER_HOST.indexOf("unix://")===0)t.socketPath=process.env.DOCKER_HOST.substring(7)||"/var/run/docker.sock";else if(process.env.DOCKER_HOST.indexOf("npipe://")===0)t.socketPath=process.env.DOCKER_HOST.substring(8)||"//./pipe/docker_engine";else{var r=process.env.DOCKER_HOST;r.indexOf("//")<0&&(r="tcp://"+r);try{e=new xe.URL(r)}catch{throw new Error("DOCKER_HOST env variable should be something like tcp://localhost:1234")}t.port=e.port,process.env.DOCKER_TLS_VERIFY==="1"||t.port==="2376"?t.protocol="https":t.protocol="http",t.host=e.hostname,process.env.DOCKER_CERT_PATH&&(t.ca=Ef(qt.join(process.env.DOCKER_CERT_PATH,"ca.pem")),t.cert=qr.readFileSync(qt.join(process.env.DOCKER_CERT_PATH,"cert.pem")),t.key=qr.readFileSync(qt.join(process.env.DOCKER_CERT_PATH,"key.pem"))),process.env.DOCKER_CLIENT_TIMEOUT&&(t.timeout=parseInt(process.env.DOCKER_CLIENT_TIMEOUT,10))}return t},_e=function(e){var t=Tf(),r=Object.assign({},t,e);this.host=r.host,this.host||(this.socketPath=r.socketPath),this.port=r.port,this.username=r.username,this.password=r.password,this.version=r.version,this.key=r.key,this.cert=r.cert,this.ca=r.ca,this.timeout=r.timeout,this.connectionTimeout=r.connectionTimeout,this.checkServerIdentity=r.checkServerIdentity,this.agent=r.agent,this.headers=r.headers||{},this.key&&this.cert&&this.ca&&(this.protocol="https"),this.protocol=r.protocol||this.protocol||"http"};_e.prototype.dial=function(e,t){var r,n,i,o=this;if(e.options&&(r=e.options),r&&r.authconfig&&delete r.authconfig,r&&r.abortSignal&&delete r.abortSignal,this.version&&(e.path="/"+this.version+e.path),this.host){var s=xe.parse(o.host);n=xe.format({protocol:s.protocol||o.protocol,hostname:s.hostname||o.host,port:o.port}),n=xe.resolve(n,e.path)}else n=e.path;e.path.indexOf("?")!==-1&&(r&&Object.keys(r).length>0?n+=this.buildQuerystring(r._query||r):n=n.substring(0,n.length-1));var a={path:n,method:e.method,headers:e.headers||Object.assign({},o.headers),key:o.key,cert:o.cert,ca:o.ca};if(this.checkServerIdentity&&(a.checkServerIdentity=this.checkServerIdentity),this.agent&&(a.agent=this.agent),e.authconfig&&(a.headers["X-Registry-Auth"]=e.authconfig.key||e.authconfig.base64||Buffer.from(JSON.stringify(e.authconfig)).toString("base64")),e.registryconfig&&(a.headers["X-Registry-Config"]=e.registryconfig.base64||Buffer.from(JSON.stringify(e.registryconfig)).toString("base64")),e.abortSignal&&(a.signal=e.abortSignal),e.file?(typeof e.file=="string"?i=qr.createReadStream(qt.resolve(e.file)):i=e.file,a.headers["Content-Type"]="application/tar"):r&&e.method==="POST"&&(i=JSON.stringify(r._body||r),e.allowEmpty||i!=="{}"&&i!=='""'?a.headers["Content-Type"]="application/json":i=void 0),typeof i=="string"?a.headers["Content-Length"]=Buffer.byteLength(i):Buffer.isBuffer(i)===!0?a.headers["Content-Length"]=i.length:(a.method==="PUT"||e.hijack||e.openStdin)&&(a.headers["Transfer-Encoding"]="chunked"),e.hijack&&(a.headers.Connection="Upgrade",a.headers.Upgrade="tcp"),this.socketPath)a.socketPath=this.socketPath;else{var u=xe.parse(n);a.hostname=u.hostname,a.port=u.port,a.path=u.path}this.buildRequest(a,e,i,t)};_e.prototype.buildRequest=function(e,t,r,n){var i=this,o,s=wf[i.protocol].request(e,function(){});Dt("Sending: %s",_f.inspect(e,{showHidden:!0,depth:null})),i.connectionTimeout&&(o=setTimeout(function(){Dt("Connection Timeout of %s ms exceeded",
`))>=0;){if(d==0){n=n.slice(1);continue}l(n.slice(0,d)),n=n.slice(d+1)}}function l(d){if(d[d.length-1]=="\r"&&(d=d.substr(0,d.length-1)),d.length>0){var h=JSON.parse(d);i.push(h),r&&r(h)}}}function a(c){o=!0,e.removeListener("data",s),e.removeListener("error",a),e.removeListener("end",u),e.removeListener("close",u),t(c,i)}function u(){o||t(null,i),o=!0}};_e.prototype.buildQuerystring=function(e){var t={};return Object.keys(e).map(function(r,n){e[r]&&typeof e[r]=="object"&&!Array.isArray(e[r])||r==="cachefrom"?t[r]=JSON.stringify(e[r]):t[r]=e[r]}),bf.stringify(t)};ji.exports=_e});var $i=v((sc,Vi)=>{"use strict";var G=require("fs"),Ee=require("path"),kf=G.lchown?"lchown":"chown",Rf=G.lchownSync?"lchownSync":"chownSync",Ui=G.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),Gi=(e,t,r)=>{try{return G[Rf](e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},Pf=(e,t,r)=>{try{return G.chownSync(e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},Of=Ui?(e,t,r,n)=>i=>{!i||i.code!=="EISDIR"?n(i):G.chown(e,t,r,n)}:(e,t,r,n)=>n,Dr=Ui?(e,t,r)=>{try{return Gi(e,t,r)}catch(n){if(n.code!=="EISDIR")throw n;Pf(e,t,r)}}:(e,t,r)=>Gi(e,t,r),Af=process.version,Wi=(e,t,r)=>G.readdir(e,t,r),If=(e,t)=>G.readdirSync(e,t);/^v4\./.test(Af)&&(Wi=(e,t,r)=>G.readdir(e,r));var Nt=(e,t,r,n)=>{G[kf](e,t,r,Of(e,t,r,i=>{n(i&&i.code!=="ENOENT"?i:null)}))},Hi=(e,t,r,n,i)=>{if(typeof t=="string")return G.lstat(Ee.resolve(e,t),(o,s)=>{if(o)return i(o.code!=="ENOENT"?o:null);s.name=t,Hi(e,s,r,n,i)});if(t.isDirectory())Nr(Ee.resolve(e,t.name),r,n,o=>{if(o)return i(o);let s=Ee.resolve(e,t.name);Nt(s,r,n,i)});else{let o=Ee.resolve(e,t.name);Nt(o,r,n,i)}},Nr=(e,t,r,n)=>{Wi(e,{withFileTypes:!0},(i,o)=>{if(i){if(i.code==="ENOENT")return n();if(i.code!=="ENOTDIR"&&i.code!=="ENOTSUP")return n(i)}if(i||!o.length)return Nt(e,t,r,n);let s=o.length,a=null,u=c=>{if(!a){if(c)return n(a=c);if(--s===0)return Nt(e,t,r,n)}};o.forEach(c=>Hi(e,c,t,r,u))})},xf=(e,t,r,n)=>{if(typeof t=="string")try{let i=G.lstatSync(Ee.resolve(e,t));i.name=t,t=i}catch(i){if(i.code==="ENOENT")return;throw i}t.isDirectory()&&zi(Ee.resolve(e,t.name),r,n),Dr(Ee.resolve(e,t.name),r,n)},zi=(e,t,r)=>{let n;try{n=If(e,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;if(i.code==="ENOTDIR"||i.code==="ENOTSUP")return Dr(e,t,r);throw i}return n&&n.length&&n.forEach(i=>xf(e,i,t,r)),Dr(e,t,r)};Vi.exports=Nr;Nr.sync=zi});var Ji=v((ac,Yi)=>{"use strict";var{Buffer:V}=require("buffer"),Ki=Symbol.for("BufferList");function P(e){if(!(this instanceof P))return new P(e);P._init.call(this,e)}P._init=function(t){Object.defineProperty(this,Ki,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)};P.prototype._new=function(t){return new P(t)};P.prototype._offset=function(t){if(t===0)return[0,0];let r=0;for(let n=0;n<this._bufs.length;n++){let i=r+this._bufs[n].length;if(t<i||n===this._bufs.length-1)return[n,t-r];r=i}};P.prototype._reverseOffset=function(e){let t=e[0],r=e[1];for(let n=0;n<t;n++)r+=this._bufs[n].length;return r};P.prototype.get=function(t){if(t>this.length||t<0)return;let r=this._offset(t);return this._bufs[r[0]][r[1]]};P.prototype.slice=function(t,r){return typeof t=="number"&&t<0&&(t+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,t,r)};P.prototype.copy=function(t,r,n,i){if((typeof n!="number"||n<0)&&(n=0),(typeof i!="number"||i>this.length)&&(i=this.length),n>=this.length||i<=0)return t||V.alloc(0);let o=!!t,s=this._offset(n),a=i-n,u=a,c=o&&r||0,f=s[1];if(n===0&&i===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:V.concat(this._bufs,this.length);for(let l=0;l<this._bufs.length;l++)this._bufs[l].copy(t,c),c+=this._bufs[l].length;return t}if(u<=this._bufs[s[0]].length-f)return o?this._bufs[s[0]].copy(t,r,f,f+u):this._bufs[s[0]].slice(f,f+u);o||(t=V.allocUnsafe(a));for(let l=s[0];l<this._bufs.length;l++){let d=this._bufs[l].length-f;if(u>d)this._bufs[l].copy(t,c,f),c+=d;else{this._bufs[l].copy(t,c,f,f+u),c+=d;break}u-=d,f&&(f=0)}return t.length>c?t.slice(0,c):t};P.prototype.shallowSlice=function(t,r){if(t=t||0,r=typeof r!="number"?this.
`)),e.linkname&&(t+=jr(" linkpath="+e.linkname+`
`));var r=e.pax;if(r)for(var n in r)t+=jr(" "+n+"="+r[n]+`
`);return Buffer.from(t)};qe.decodePax=function(e){for(var t={};e.length;){for(var r=0;r<e.length&&e[r]!==32;)r++;var n=parseInt(e.slice(0,r).toString(),10);if(!n)return t;var i=e.slice(r+1,n-1).toString(),o=i.indexOf("=");if(o===-1)return t;t[i.slice(0,o)]=i.slice(o+1),e=e.slice(n)}return t};qe.encode=function(e){var t=qf(512),r=e.name,n="";if(e.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),Buffer.byteLength(r)!==r.length)return null;for(;Buffer.byteLength(r)>100;){var i=r.indexOf("/");if(i===-1)return null;n+=n?"/"+r.slice(0,i):r.slice(0,i),r=r.slice(i+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(n)>155||e.linkname&&Buffer.byteLength(e.linkname)>100?null:(t.write(r),t.write(le(e.mode&Bf,6),100),t.write(le(e.uid,6),108),t.write(le(e.gid,6),116),t.write(le(e.size,11),124),t.write(le(e.mtime.getTime()/1e3|0,11),136),t[156]=Xi+Wf(e.type),e.linkname&&t.write(e.linkname,157),Qi.copy(t,Qe),Mf.copy(t,Fr),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(le(e.devmajor||0,6),329),t.write(le(e.devminor||0,6),337),n&&t.write(n,345),t.write(le(to(t),6),148),t)};qe.decode=function(e,t,r){var n=e[156]===0?0:e[156]-Xi,i=Le(e,0,100,t),o=ce(e,100,8),s=ce(e,108,8),a=ce(e,116,8),u=ce(e,124,12),c=ce(e,136,12),f=Gf(n),l=e[157]===0?null:Le(e,157,100,t),d=Le(e,265,32),h=Le(e,297,32),w=ce(e,329,8),S=ce(e,337,8),y=to(e);if(y===8*32)return null;if(y!==ce(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(Qi.compare(e,Qe,Qe+6)===0)e[345]&&(i=Le(e,345,155,t)+"/"+i);else if(!(Ff.compare(e,Qe,Qe+6)===0&&jf.compare(e,Fr,Fr+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return n===0&&i&&i[i.length-1]==="/"&&(n=5),{name:i,mode:o,uid:s,gid:a,size:u,mtime:new Date(1e3*c),type:f,linkname:l,uname:d,gname:h,devmajor:w,devminor:S}}});var uo=v((lc,ao)=>{var ro=require("util"),zf=Zi(),et=Br(),no=we().Writable,io=we().PassThrough,oo=function(){},so=function(e){return e&=511,e&&512-e},Vf=function(e,t){var r=new Ft(e,t);return r.end(),r},$f=function(e,t){return t.path&&(e.name=t.path),t.linkpath&&(e.linkname=t.linkpath),t.size&&(e.size=parseInt(t.size,10)),e.pax=t,e},Ft=function(e,t){this._parent=e,this.offset=t,io.call(this,{autoDestroy:!1})};ro.inherits(Ft,io);Ft.prototype.destroy=function(e){this._parent.destroy(e)};var te=function(e){if(!(this instanceof te))return new te(e);no.call(this,e),e=e||{},this._offset=0,this._buffer=zf(),this._missing=0,this._partial=!1,this._onparse=oo,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var t=this,r=t._buffer,n=function(){t._continue()},i=function(d){if(t._locked=!1,d)return t.destroy(d);t._stream||n()},o=function(){t._stream=null;var d=so(t._header.size);d?t._parse(d,s):t._parse(512,l),t._locked||n()},s=function(){t._buffer.consume(so(t._header.size)),t._parse(512,l),n()},a=function(){var d=t._header.size;t._paxGlobal=et.decodePax(r.slice(0,d)),r.consume(d),o()},u=function(){var d=t._header.size;t._pax=et.decodePax(r.slice(0,d)),t._paxGlobal&&(t._pax=Object.assign({},t._paxGlobal,t._pax)),r.consume(d),o()},c=function(){var d=t._header.size;this._gnuLongPath=et.decodeLongPath(r.slice(0,d),e.filenameEncoding),r.consume(d),o()},f=function(){var d=t._header.size;this._gnuLongLinkPath=et.decodeLongPath(r.slice(0,d),e.filenameEncoding),r.consume(d),o()},l=function(){var d=t._offset,h;try{h=t._header=et.decode(r.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(w){t.emit("error",w)}if(r.consume(512),!h){t._parse(512,l),n();return}if(h.type==="gnu-long-path"){t._parse(h.size,c),n();return}if(h.type==="gnu-long-link-path"){t._parse(h.size,f),n();return}if(h.type==="pax-global-header"){t._parse(h.size,a),n();return}if(h.type==="pax-header"){t._parse(h.size,u),n();return}if(t._gnuLongPath&&(h.name=t._gnuLongPath,t._gnuLongPath=null),t._gnuLongLinkPath&&(h.linkname=t._gnuLongLinkPath,t._gnuLongLinkPath=null),t._pax&&(t._header=h=$f(h,t._pax),t._pax=null),t._locked=!0,!h.size||
`),on=e=>"```\n"+e+"\n```",sn=e=>"`"+e+"`";var an=e=>e.State==="running";var lt=1e3,Jt=e=>{let t=({Id:f})=>e.getContainer(f).stop(),r=({Id:f})=>e.getContainer(f).start(),n=({Id:f})=>e.getContainer(f).restart(),i=({Id:f})=>e.getContainer(f).remove();return{useImages:()=>{let[f,l]=(0,O.useState)(),[d,h]=(0,O.useState)(!1),[w,S]=(0,O.useState)(),y=(0,O.useRef)();return(0,O.useEffect)(()=>{async function p(){try{let b=await e.listImages();l(b)}catch(b){b instanceof Error&&S(b)}}return q(h,p)(),y.current=setInterval(p,lt),()=>y.current&&clearInterval(y.current)},[]),{images:f,error:w,isLoading:d,removeImage:q(h,({Id:p})=>e.getImage(p).remove())}},useImageInfo:({Id:f})=>{let[l,d]=(0,O.useState)(),[h,w]=(0,O.useState)(!1),S=(0,O.useRef)();return(0,O.useEffect)(()=>{async function y(){let p=await e.getImage(f).inspect();d(p)}return q(w,y)(),S.current=setInterval(y,lt),()=>S.current&&clearInterval(S.current)},[f]),{imageInfo:l,isLoading:h}},useContainers:()=>{let[f,l]=(0,O.useState)(),[d,h]=(0,O.useState)(!1),[w,S]=(0,O.useState)(),y=(0,O.useRef)();return(0,O.useEffect)(()=>{async function p(){try{let b=await e.listContainers({all:!0});l(b)}catch(b){b instanceof Error&&S(b)}}return q(h,p)(),y.current=setInterval(p,lt),()=>y.current&&clearInterval(y.current)},[]),{containers:f,isLoading:d,error:w,startContainer:q(h,r),stopContainer:q(h,t),restartContainer:q(h,n),removeContainer:q(h,i)}},useContainerInfo:f=>{let[l,d]=(0,O.useState)(),[h,w]=(0,O.useState)(!1),S=(0,O.useRef)();return(0,O.useEffect)(()=>{async function y(){let p=await e.getContainer(f).inspect();d(p)}return q(w,y)(),S.current=setInterval(y,lt),()=>S.current&&clearInterval(S.current)},[f]),{containerInfo:l,isLoading:h,startContainer:q(w,r),restartContainer:q(w,n),stopContainer:q(w,t),removeContainer:q(w,i)}},useProjects:()=>{let[f,l]=(0,O.useState)(),[d,h]=(0,O.useState)(!1),[w,S]=(0,O.useState)(),y=(0,O.useRef)();return(0,O.useEffect)(()=>{async function p(){try{let b=await e.listContainers({all:!0});l(Yt(b))}catch(b){b instanceof Error&&S(b)}}return q(h,p)(),y.current=setInterval(p,lt),()=>y.current&&clearInterval(y.current)},[]),{projects:f,isLoading:d,error:w,startProject:q(h,async p=>{await Promise.all(p.containers.filter(g=>!an(g)).map(g=>e.getContainer(g.Id).start()));let b=await e.listContainers({all:!0});l(Yt(b))}),stopProject:q(h,async p=>{await Promise.all(p.containers.filter(g=>an(g)).map(g=>e.getContainer(g.Id).stop()));let b=await e.listContainers({all:!0});l(Yt(b))})}}}};function q(e,t){return async r=>{e(!0);try{let n=await t(r);return e(!1),n}finally{e(!1)}}}var ct=e=>e.RepoTags.join(" "),Cl=(e,t)=>{let r=e.replace("sha256:","");return t!==void 0?r.slice(0,t):r},ks=e=>e!==void 0?`## ${ct(e)}`+nn([["ID",Cl(e.Id,12)],["Size",un(e.Size)],["OS",e.Os],["Architecture",e.Architecture],["Command",sn(kl(e.Config.Cmd))],["Entrypoint",sn(Rl(e.Config.Entrypoint))]])+Tl(e.Config.Env)+`
`:"",Tl=e=>e.length===0?"":[`
## Environment`,on(e.join(`
`))].join(`
`),kl=e=>e.join(" "),Rl=e=>e==null?"-":Array.isArray(e)?e.join(" "):e,un=(e,t=2)=>{if(e===0)return"0 Bytes";let r=1024,n=t<0?0:t,i=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(e)/Math.log(r));return parseFloat((e/Math.pow(r,o)).toFixed(n))+" "+i[o]};var he=require("@raycast/api"),Zt=require("react");var fn=e=>e.errno===-61&&e.code==="ECONNREFUSED";function ln({error:e}){let[t,r]=(0,Zt.useState)([]);(0,Zt.useEffect)(()=>{async function i(){let o=await(0,he.getApplications)();r(o)}i()},[]);let n=t.find(({bundleId:i})=>i==="com.docker.docker");return _jsx(he.Detail,{markdown:Pl(e),actions:fn(e)&&n!==void 0?_jsx(he.ActionPanel,null,_jsx(he.OpenAction,{title:"Launch Docker",target:n.path})):null})}var Pl=e=>{let t="Error message:\n\n```\n"+e.message+"\n```";return fn(e)?["## \u26A0\uFE0F Error connecting to Docker",t].join(`
`):`## An Error Occurred:
${t}`};var Rs=pn(rn()),Ps=require("@raycast/api"),Os=require("react");function cn({imageId:e}){let t=(0,Os.useMemo)(()=>new Rs.default,[]),{useImageInfo:r}=Jt(t),{imageInfo:n,isLoading:i}=r({Id:e});return _jsx(Ps.Detail,{navigationTitle:"Image Details",isLoading:i,markdown:ks(n)})}var Be=require("@raycast/api"),As=({action:e,onSuccess:t,onFailure:r})=>async()=>{try{await e(),t!==void 0&&await(0,Be.showToast)(Be.ToastStyle.Success,...Is(t()))}catch(n){n instanceof Error&&r!==void 0&&await(0,Be.showToast)(Be.ToastStyle.Failure,...Is(r(n)))}},Is=e=>Array.isArray(e)?e:[e];function qs(){let e=(0,Ls.useMemo)(()=>new xs.default,[]),{useImages:t}=Jt(e),{images:r,isLoading:n,error:i,removeImage:o}=t();return i?_jsx(ln,{error:i}):_jsx(N.List,{isLoading:n},r?.map(s=>_jsx(N.List.Item,{key:s.Id,title:ct(s),icon:{source:"icon-image.png",tintColor:N.Color.SecondaryText},accessoryTitle:un(s.Size)??"",actions:_jsx(N.ActionPanel,{title:ct(s)},_jsx(N.PushAction,{title:"Inspect",icon:{source:N.Icon.Binoculars},shortcut:{modifiers:["cmd"],key:"i"},target:_jsx(cn,{imageId:s.Id})}),_jsx(N.ActionPanel.Item,{title:"Remove Image",icon:{source:N.Icon.Trash,tintColor:N.Color.Red},shortcut:{modifiers:["cmd","shift"],key:"x"},onAction:As({action:()=>o(s),onSuccess:()=>`Image ${ct(s)} removed`,onFailure:({message:a})=>a})}))})))}module.exports=Us(Ol);0&&(module.exports={});
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */