import{isSingleExpression as e}from"./directive-helpers.js";import{Directive as t,PartType as i}from"./directive.js";export{directive}from"./directive.js";
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */const s=(e,t)=>{const i=e._$AN;if(void 0===i)return!1;for(const e of i)e._$AO?.(t,!1),s(e,t);return!0},o=e=>{let t,i;do{if(void 0===(t=e._$AM))break;i=t._$AN,i.delete(e),e=t}while(0===i?.size)},r=e=>{for(let t;t=e._$AM;e=t){let i=t._$AN;if(void 0===i)t._$AN=i=new Set;else if(i.has(e))break;i.add(e),c(t)}};function h(e){void 0!==this._$AN?(o(this),this._$AM=e,r(this)):this._$AM=e}function n(e,t=!1,i=0){const $=this._$AH,_=this._$AN;if(void 0!==_&&0!==_.size)if(t)if(Array.isArray($))for(let e=i;e<$.length;e++)s($[e],!1),o($[e]);else null!=$&&(s($,!1),o($));else s(this,e)}const c=e=>{e.type==i.CHILD&&(e._$AP??=n,e._$AQ??=h)};class f extends t{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),r(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(s(this,e),o(this))}setValue(t){if(e(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}export{f as AsyncDirective,t as Directive,i as PartType};