import{a as E}from"./chunk-YJCJDCVP.js";import{a as _}from"./chunk-OASPW2P2.js";import{a as I,b as w}from"./chunk-STJ3LWFL.js";import{f as a,g as u,p as S,v as b}from"./chunk-PTIJDS6I.js";import{ua as f,xa as p}from"./chunk-2HZMOK4U.js";import{b as T,c as g}from"./chunk-Q6LCSRIW.js";import{g as s,u as c}from"./chunk-E24W34C4.js";import{d as v}from"./chunk-ELIH6GCC.js";import{Lb as l}from"./chunk-EYDNSYYE.js";import{r as x}from"./chunk-T6CC5WUU.js";import{e as L,g as m}from"./chunk-VKWPEFWQ.js";m();m();function A(o,e){return{theme:{id:o.id,name:o.name,role:o.role,shop:e.storeFqdn,preview_url:I(o,e),editor_url:w(o,e)}}}function D(o){let{platform:e,arch:n}=s(),t=a(),r=null;return t&&(r=Number(u())||null),{store:t??"Not configured",development_theme_id:r,cli_version:o.cliVersion,os:`${e}-${n}`,shell:process.env.SHELL??"unknown",node_version:process.version}}async function O(o,e){let n;if(e.development)n=await new E(o).findOrCreate();else{let t={filter:{theme:e.theme}};n=await _(o,t)}return n?A(n,o):void 0}async function y(o){return[M(),await j(o)]}function M(){let o=a()??"Not configured",e=u();return p(`theme-command:info:dev-theme-loaded:${e}`),N("Theme Configuration",[["Store",o],["Development Theme ID",e?`#${e}`:{subdued:"Not set"}]])}async function j(o){let{platform:e,arch:n}=s();return N("Tooling and System",[["Shopify CLI",o.cliVersion],["OS",`${e}-${n}`],["Shell",process.env.SHELL??"unknown"],["Node version",process.version]])}function N(o,e){return{title:o,body:{tabularData:e,firstColumnSubdued:!0}}}async function F(o,e){let n=Object.entries(o.theme).map(([t,r])=>{if(t==="editor_url"||t==="preview_url"){let C=String(r),$=t==="editor_url"?"Open in Theme Editor":"Preview Theme";return[d(t),{link:{url:C,label:$}}]}else return t==="id"?[d(t),`#${r}`]:[d(t),`${r}`]});return{customSections:[...e.environment?[{title:"Theme information",body:[{subdued:`Environment name: ${e.environment}`}]}]:[],{title:"Theme Details",body:{tabularData:n,firstColumnSubdued:!0}}]}}function d(o){return o.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}var h=L(x(),1);var i=class extends b{async command(e,n){if(f("theme-command:info"),e.theme||e.development){let t=await O(n,e);if(!t)throw new v("Theme not found!");if(e.json)return l(JSON.stringify(t,null,2));let r=await F(t,e);c(r)}else{if(e.json)return l(JSON.stringify(D({cliVersion:this.config.version}),null,2));let t=await y({cliVersion:this.config.version});c({customSections:t})}f("theme-command:info")}};i.description="Displays information about your theme environment, including your current store. Can also retrieve information about a specific theme.";i.flags={...T,...g,...S,development:h.Flags.boolean({char:"d",description:"Retrieve info from your development theme.",env:"SHOPIFY_FLAG_DEVELOPMENT"}),theme:h.Flags.string({char:"t",description:"Theme ID or name of the remote theme.",env:"SHOPIFY_FLAG_THEME_ID"})};i.multiEnvironmentsFlags=["store","password"];var k=i;export{k as a};
