"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AspectApplication=exports.Aspects=exports.AspectPriority=void 0,exports._aspectTreeRevisionReader=_aspectTreeRevisionReader;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var errors_1=()=>{var tmp=require("./errors");return errors_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("./private/literal-string");return literal_string_1=()=>tmp,tmp};const ASPECTS_SYMBOL=Symbol.for("cdk-aspects");class AspectPriority{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.AspectPriority",version:"2.256.1"};static MUTATING=200;static READONLY=1e3;static DEFAULT=500}exports.AspectPriority=AspectPriority;class Aspects{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.Aspects",version:"2.256.1"};static of(scope){let aspects=scope[ASPECTS_SYMBOL];return aspects||(aspects=new Aspects(scope),Object.defineProperty(scope,ASPECTS_SYMBOL,{value:aspects,configurable:!1,enumerable:!1})),aspects}_scope;_appliedAspects;constructor(scope){this._appliedAspects=[],this._scope=scope}add(aspect,options){try{jsiiDeprecationWarnings().aws_cdk_lib_IAspect(aspect),jsiiDeprecationWarnings().aws_cdk_lib_AspectOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.add),error}const newApplication=new AspectApplication(this._scope,aspect,options?.priority??AspectPriority.DEFAULT);this._appliedAspects.some(a=>a.aspect===newApplication.aspect&&a.priority===newApplication.priority)||(this._appliedAspects.push(newApplication),bumpAspectTreeRevision(this._scope))}get all(){return this._appliedAspects.map(application=>application.aspect)}get applied(){return[...this._appliedAspects]}}exports.Aspects=Aspects;function bumpAspectTreeRevision(construct){const root=construct.node.root,rev=root[TREE_REVISION_SYM]??0;root[TREE_REVISION_SYM]=rev+1}function _aspectTreeRevisionReader(construct){const root=construct.node.root;return()=>root[TREE_REVISION_SYM]??0}class AspectApplication{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.AspectApplication",version:"2.256.1"};construct;aspect;_priority;constructor(construct,aspect,priority){try{jsiiDeprecationWarnings().aws_cdk_lib_IAspect(aspect)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,AspectApplication),error}this.construct=construct,this.aspect=aspect,this._priority=priority}get priority(){return this._priority}set priority(priority){if(priority<0)throw new(errors_1()).ValidationError((0,literal_string_1().lit)`PriorityNonNegativeNumber`,"Priority must be a non-negative number",this.construct);this._priority=priority,bumpAspectTreeRevision(this.construct)}}exports.AspectApplication=AspectApplication;const TREE_REVISION_SYM=Symbol.for("@aws-cdk/core.Aspects.treeRevision");
