import{__exports as r}from"../../../_virtual/es.disposable-stack.constructor.mjs";import{__require as e}from"../internals/export.mjs";import{__require as s}from"../internals/descriptors.mjs";import{__require as t}from"../internals/get-built-in.mjs";import{__require as i}from"../internals/a-callable.mjs";import{__require as n}from"../internals/an-instance.mjs";import{__require as o}from"../internals/define-built-in.mjs";import{__require as a}from"../internals/define-built-ins.mjs";import{__require as u}from"../internals/define-built-in-accessor.mjs";import{__require as m}from"../internals/well-known-symbol.mjs";import{__require as p}from"../internals/internal-state.mjs";import{__require as l}from"../internals/add-disposable-resource.mjs";var c;function f(){if(c)return r;c=1;var f=e(),d=s(),_=t(),h=i(),b=n(),v=o(),j=a(),q=u(),k=m(),g=p(),w=l(),y=_("SuppressedError"),S=ReferenceError,x=k("dispose"),D=k("toStringTag"),E="DisposableStack",F=g.set,R=g.getterFor(E),T="sync-dispose",W="disposed",z=function(r){var e=R(r);if(e.state===W)throw new S(E+" already disposed");return e},A=function(){F(b(this,B),{type:E,state:"pending",stack:[]}),d||(this.disposed=!1)},B=A.prototype;return j(B,{dispose:function(){var r=R(this);if(r.state!==W){r.state=W,d||(this.disposed=!0);for(var e,s=r.stack,t=s.length,i=!1;t;){var n=s[--t];s[t]=null;try{n()}catch(r){i?e=new y(r,e):(i=!0,e=r)}}if(r.stack=null,i)throw e}},use:function(r){return w(z(this),r,T),r},adopt:function(r,e){var s=z(this);return h(e),w(s,void 0,T,function(){e(r)}),r},defer:function(r){var e=z(this);h(r),w(e,void 0,T,r)},move:function(){var r=z(this),e=new A;return R(e).stack=r.stack,r.stack=[],r.state=W,d||(this.disposed=!0),e}}),d&&q(B,"disposed",{configurable:!0,get:function(){return R(this).state===W}}),v(B,x,B.dispose,{name:"dispose"}),v(B,D,E,{nonWritable:!0}),f({global:!0,constructor:!0},{DisposableStack:A}),r}export{f as __require};