PageSourceSearch

https://www.aafp.org/embed-assets/00711301f21f67b3e94d0d96f167761c89adcdc6/chunks/alert-banner.js

js aafp.org collected 2026-09-24 07:32:02 UTC 10,977 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkaafp_embeds=self.webpackChunkaafp_embeds||[]).push([[486],{681(e,t,n){n.d(t,{FA:()=>a,ZX:()=>l,qw:()=>s});var o="aafp.userAuthReady",i="data-aafp-user-js";function a(e){if("undefined"!=typeof window&&"undefined"!=typeof document&&e)if(window.AAFPUserObject)r(window.AAFPUserObject);else if(!document.head.querySelector("script[".concat(i,"]"))){var t=document.createElement("script");t.async=!0,t.src=e,t.setAttribute(i,""),t.addEventListener("load",function(){window.AAFPUserObject&&r(window.AAFPUserObject)}),t.addEventListener("error",function(){console.error("Failed to load AAFPUser script from ".concat(e))}),document.head.appendChild(t)}}function r(e){"undefined"!=typeof window&&(window.AAFPUserObject||(window.AAFPUserObject=e),window.dispatchEvent(new CustomEvent(o,{detail:e})))}function s(){var e,t=!1,n=function(){};return{promise:new Promise(function(i,a){if(e=a,"undefined"!=typeof window)if(window.AAFPUserObject)i(window.AAFPUserObject);else{var r=function(e){t||(n(),i(e.detail||window.AAFPUserObject))},s=window.setTimeout(function(){t||(n(),a(new Error("AAFPUserObject failed to load")))},1e4);n=function(){window.removeEventListener(o,r),window.clearTimeout(s)},window.addEventListener(o,r,{once:!0})}else a(new Error("AAFPUserObject is unavailable on the server"))}),cancel:function(o){t=!0,n(),e(o)}}}function l(e){return"".concat(e).concat("undefined"!=typeof window?"?redirect=".concat(encodeURIComponent(window.location.href)):"")}},674(e,t,n){n.d(t,{displayAlertBanner:()=>h});var o,i=n(690),a=n(272),r=(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=new Set,l="aafp-alert-banner--showing",c="aafp-alert-banner--shown",u=function(e){function t(t){var n,o,i=e.call(this,t)||this;return Object.defineProperty(i,"$closeButton",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"$textContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"uid",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"shouldSetCookie",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"onTransitionComplete",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"handleContentClick",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t,n=e.target.closest("a, button");if(n){var o=(null===(t=n.textContent)||void 0===t?void 0:t.trim())||"";o&&i.trackClick(o)}}}),Object.defineProperty(i,"handleCloseButtonClick",{enumerable:!0,configurable:!0,writable:!0,value:function(){var e;i.uid&&i.shouldSetCookie&&(e=d(i.uid),document.cookie="".concat(e,"=").concat("true","; path=/; max-age=").concat(1209600)),i.hide()}}),i.uid=t.dataset.uid,i.shouldSetCookie="true"===t.dataset.shouldSetCookie,i.$closeButton=t.querySelector(".aafp-alert-banner__close-btn"),null===(n=i.$closeButton)||void 0===n||n.addEventListener("click",i.handleCloseButtonClick,!1),i.$textContainer=t.querySelector(".aafp-alert-banner__text"),null===(o=i.$textContainer)||void 0===o||o.addEventListener("click",i.handleContentClick,!1),i.show(),i.uid&&!s.has(i.uid)&&(s.add(i.uid),i.trackImpression()),i}return r(t,e),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t;this.onTransitionComplete&&(this.$el.removeEventListener("transitionend",this.onTransitionComplete,!1),this.onTransitionComplete=void 0),null===(t=this.$textContainer)||void 0===t||t.removeEventListener("click",this.handleContentClick,!1),e.prototype.destroy.call(this)}}),Object.defineProperty(t.prototype,"show",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.onTransitionComplete&&(this.$el.removeEventListener("transitionend",this.onTransitionComplete,!1),this.onTransitionComplete=void 0),this.$el.classList.remove(c),this.$el.classList.add(l),this.onTransitionComplete=function(t){t&&t.target!==e.$el||(e.$el.classList.remove(l),e.$el.classList.add(c),e.$el.style.height="",e.onTransitionComplete&&e.$el.removeEventListener("transitionend",e.onTransitionComplete,!1),e.onTransitionComplete=void 0)};var t=this.$el.scrollHeight;this.$el.addEventListener("transitionend",this.onTransitionComplete,!1),this.$el.style.height="".concat(t,"px")}}
1),Object.defineProperty(t.prototype,"hide",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.onTransitionComplete&&(this.$el.removeEventListener("transitionend",this.onTransitionComplete,!1),this.onTransitionComplete=void 0),this.$el.classList.remove(l),this.$el.classList.remove(c),this.$el.style.height=""}}),Object.defineProperty(t.prototype,"trackImpression",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;(null===(t=null===(e=window.__aafp)||void 0===e?void 0:e.disabledDataLayerEvents)||void 0===t?void 0:t.content_view)||(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"content_view",action_type:"alert_impression",element_category:"alert_banner",element_id:this.$el.dataset.analyticsElementId||"alert-banner-".concat(this.uid),element_name:(this.$el.dataset.analyticsElementName||"Alert Banner ".concat(this.uid)).toLowerCase(),element_location:"below_global_nav"}))}}),Object.defineProperty(t.prototype,"trackClick",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n;(null===(n=null===(t=window.__aafp)||void 0===t?void 0:t.disabledDataLayerEvents)||void 0===n?void 0:n.content_click)||(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"content_click",action_type:"cta_click",element_category:"alert_banner",element_id:this.$el.dataset.analyticsElementId||"alert-banner-".concat(this.uid),element_name:e.toLowerCase(),element_location:"below_global_nav"}))}}),t}(i.$);function h(e){var t=!1;a.X.subscribe(function(n){var o;if(!n.isLoadingUser&&!t){t=!0;var i=null!==(o=n.user)&&void 0!==o?o:null,a=e.filter(function(e){var t=e.dataset,n=t.onTime,o=t.offTime,a=t.uid,r=t.showFor;if(a){var s=function(e){var t,n="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===n.length)return null===(t=n.pop())||void 0===t?void 0:t.split(";").shift()}(d(a));if(s)return!1}var l=new Date,c=n?new Date(n):void 0,u=o?new Date(o):void 0;return!(c&&isNaN(c.getTime())||u&&isNaN(u.getTime())||(c||u)&&!(c&&!u?l>=c:(u&&!c||c&&u&&l>=c)&&l<u)||!function(e,t){var n,o=Boolean(null==t?void 0:t.AAFPID),i=o&&(null!=(n=null==t?void 0:t.IsMember)&&("boolean"==typeof n?n:"number"==typeof n?1===n:"string"==typeof n&&("1"===n||"true"===n.toLowerCase())));switch(e){case"anonymous":return!o;case"anonymous-and-non-members":return!o||o&&!i;case"members":return i;case"signed-in":return o;default:return!0}}
1(r,i))});(null==a?void 0:a[0])&&new u(a[0])}})}function d(e){return"aafp-dismissed-alert_".concat(e)}},272(e,t,n){n.d(t,{X:()=>i});var o=n(681),i=new(function(){function e(){Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{isMobileMax:null,isTabletMax:null,show:null,searchShow:null,myAccountShow:null,cartFlyoutShow:null,user:null,isLoadingUser:!0}}),Object.defineProperty(this,"listeners",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),this.state.setShow=this.setShow.bind(this),this.state.setSearchShow=this.setSearchShow.bind(this),this.state.setMyAccountShow=this.setMyAccountShow.bind(this),this.state.setCartFlyoutShow=this.setCartFlyoutShow.bind(this),this.state.setIsMobileMax=this.setIsMobileMax.bind(this),this.state.setIsTabletMax=this.setIsTabletMax.bind(this),this.getAuthStateOnLoad()}return Object.defineProperty(e.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.state}}),Object.defineProperty(e.prototype,"setShow",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.state.show!==e&&(this.state.show=e,!0===e&&!0===this.state.myAccountShow&&(this.state.myAccountShow=!1),!0===e&&!0===this.state.searchShow&&(this.state.searchShow=!1),!0===e&&!0===this.state.cartFlyoutShow&&(this.state.cartFlyoutShow=!1),this.notify())}}),Object.defineProperty(e.prototype,"setSearchShow",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.state.searchShow!==e&&(this.state.searchShow=e,!0===e&&!0===this.state.show&&(this.state.show=!1),!0===e&&!0===this.state.myAccountShow&&(this.state.myAccountShow=!1),!0===e&&!0===this.state.cartFlyoutShow&&(this.state.cartFlyoutShow=!1),this.notify())}}),Object.defineProperty(e.prototype,"setMyAccountShow",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.state.myAccountShow!==e&&(this.state.myAccountShow=e,!0===e&&!0===this.state.show&&(this.state.show=!1),!0===e&&!0===this.state.searchShow&&(this.state.searchShow=!1),!0===e&&!0===this.state.cartFlyoutShow&&(this.state.cartFlyoutShow=!1),this.notify())}}),Object.defineProperty(e.prototype,"setCartFlyoutShow",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.state.cartFlyoutShow!==e&&(this.state.cartFlyoutShow=e,!0===e&&!0===this.state.show&&(this.state.show=!1),!0===e&&!0===this.state.searchShow&&(this.state.searchShow=!1),!0===e&&!0===this.state.myAccountShow&&(this.state.myAccountShow=!1),this.notify())}}),Object.defineProperty(e.prototype,"setIsMobileMax",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.state.isMobileMax!==e&&(this.state.isMobileMax=e,this.notify())}}),Object.defineProperty(e.prototype,"setIsTabletMax",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.state.isTabletMax!==e&&(this.state.isTabletMax=e,this.notify())}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.listeners.add(e),this.safeCallListener(e,this.state),function(){t.listeners.delete(e)}}}),Object.defineProperty(e.prototype,"notify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=Array.from(this.listeners),n=new Set;t.forEach(function(t){try{t(e.state)}catch(e){console.warn("TopNavigationContext: Removing invalid listener due to error:",e),n.add(t)}}),n.forEach(function(t){return e.listeners.delete(t)})}}),Object.defineProperty(e.prototype,"safeCallListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){try{e(t)}catch(t){console.warn("TopNavigationContext: Error calling listener:",t),this.listeners.delete(e)}}}),Object.defineProperty(e.prototype,"getAuthStateOnLoad",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;(0,o.qw)().promise.then(function(t){e.state.user=t,e.state.isLoadingUser=!1,e.notify()}).catch(function(){e.state.isLoadingUser=!1,e.notify()})}}),e}())}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.