import{a as B,b as E}from"./chunk-ALQKJAHP.js";import{b as y,c as A,l as C,n as F,o as S,t as x}from"./chunk-5UXPTCSD.js";import{a as D}from"./chunk-6ZRHK4ON.js";import{a as w}from"./chunk-7XQDZF73.js";import{z as f}from"./chunk-2HZMOK4U.js";import{b as O}from"./chunk-Q6LCSRIW.js";import{u as l,v as k,w as b,x as g}from"./chunk-E24W34C4.js";import{Fb as h,Hb as I}from"./chunk-EYDNSYYE.js";import{r as _}from"./chunk-T6CC5WUU.js";import{e as z,g as s}from"./chunk-VKWPEFWQ.js";s();s();async function T(n){let{organization:a,storeFqdn:o,operationId:r,remoteApp:u}=n;l({headline:"Canceling bulk operation.",body:[{list:{items:[`ID: ${r}`,...E({organization:a,remoteApp:u,storeFqdn:o})]}}]});let v=await B(u,o),p=await C({adminSession:v,operationId:r});if(p?.userErrors?.length){F(p.userErrors,"Failed to cancel bulk operation.");return}let i=p?.bulkOperation;if(i){let t=S(i),d=i.status==="CANCELING"?[`This may take a few moments. Check the status with:
`,{command:`shopify app bulk status --id=${A(i.id)}`}]:t.body,c={headline:t.headline,...d&&{body:d},...t.customSections&&{customSections:t.customSections}};switch(t.renderType){case"success":k(c);break;case"warning":b(c);break;case"info":l(c);break}}else g({headline:"Bulk operation not found or could not be canceled.",body:I`ID: ${h.yellow(r)}`.value})}var m=z(_(),1);var q,e=class extends D{async run(){let{flags:a}=await this.parse(q),{appContextResult:o,store:r}=await x(a);return await T({organization:o.organization,storeFqdn:r.shopDomain,operationId:y(a.id),remoteApp:o.remoteApp}),{app:o.app}}};q=e;e.summary="Cancel a bulk operation.";e.description="Cancels a running bulk operation by ID.";e.flags={...O,...w,id:m.Flags.string({description:"The bulk operation ID to cancel (numeric ID or full GID).",env:"SHOPIFY_FLAG_ID",required:!0}),store:m.Flags.string({char:"s",description:"The store domain. Must be an existing dev store.",env:"SHOPIFY_FLAG_STORE",parse:async n=>f(n)})};var K=e;export{K as a};
