PageSourceSearch

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

js aafp.org collected 2026-09-24 07:32:00 UTC 11,053 bytes, 2 lines download raw bytes

1/*! For license information please see comments.js.LICENSE.txt */
2(self.webpackChunkaafp_embeds=self.webpackChunkaafp_embeds||[]).push([[125],{417(e,t,n){"use strict";n.d(t,{initComments:()=>c});var r,o=n(690),i=n(452),a=n.n(i),l=(r=function(e,t){return r=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])},r(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=function(e){function t(t){var n=this,r="true"===(null==t?void 0:t.getAttribute("data-aafp-cmp-initialized"));return n=e.call(this,t)||this,Object.defineProperty(n,"dataHandle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"toggleButton",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"injectedScripts",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(n,"showLabel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"hideLabel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"$commentsArea",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"defaultErrorMsg",{enumerable:!0,configurable:!0,writable:!0,value:"Error Loading Comments"}),Object.defineProperty(n,"commentsVisibility",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"firstCommentObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"hideAds",{enumerable:!0,configurable:!0,writable:!0,value:function(){var e;null===(e=document.querySelector(".base-page"))||void 0===e||e.classList.add("aafp-comments--hide-ads")}}),Object.defineProperty(n,"showAds",{enumerable:!0,configurable:!0,writable:!0,value:function(){var e;null===(e=document.querySelector(".base-page"))||void 0===e||e.classList.remove("aafp-comments--hide-ads")}}),Object.defineProperty(n,"onToggleButtonClick",{enumerable:!0,configurable:!0,writable:!0,value:function(e){e.preventDefault();var t=e.target;n.toggleButton&&t&&(n.$el.classList.contains("aafp-comments--hidden")?(t.innerText=n.hideLabel,n.commentsVisibility&&n.hideAds()):(t.innerText=n.showLabel,n.showAds()),n.$el.classList.toggle("aafp-comments--hidden"))}}),Object.defineProperty(n,"revealHiddenComments",{enumerable:!0,configurable:!0,writable:!0,value:function(){var e;n.$el.classList.contains("aafp-comments--hidden")&&(n.$el.classList.remove("aafp-comments--hidden"),null===(e=n.$el.querySelector(".comment-signin-message"))||void 0===e||e.remove(),n.toggleButton&&(n.toggleButton.innerText=n.hideLabel),n.c
2ommentsVisibility&&n.hideAds())}}),Object.defineProperty(n,"disconnectFirstCommentObserver",{enumerable:!0,configurable:!0,writable:!0,value:function(){var e;null===(e=n.firstCommentObserver)||void 0===e||e.disconnect(),n.firstCommentObserver=null}}),Object.defineProperty(n,"setupFirstCommentAutoReveal",{enumerable:!0,configurable:!0,writable:!0,value:function(){var e;if("hidden"===n.commentsVisibility){var t=null===(e=n.$commentsArea)||void 0===e?void 0:e.querySelector(".commentcontainerccomments");t&&!t.querySelector(".commentdiv")&&(n.disconnectFirstCommentObserver(),n.firstCommentObserver=new MutationObserver(function(){t.querySelector(".commentdiv")&&(n.revealHiddenComments(),n.disconnectFirstCommentObserver())}),n.firstCommentObserver.observe(t,{childList:!0}))}}}),n.showLabel=n.$el.dataset.showLabel||"Add/View Comments",n.hideLabel=n.$el.dataset.hideLabel||"Hide Comments",r||(n.commentsVisibility=n.$el.dataset.commentsVisibility||void 0,n.onToggleButtonClick=n.onToggleButtonClick.bind(n),n.displayError=n.displayError.bind(n),n.init()),n}return l(t,e),Object.defineProperty(t.prototype,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this.dataHandle=this.$el.dataset.handle,this.renderTemplate(),this.toggleButton=this.$el.querySelector(".aafp-comments__toggle button"),this.$commentsArea=this.$el.querySelector("#aafp-comments-area"),null===(e=this.toggleButton)||void 0===e||e.addEventListener("click",this.onToggleButtonClick),"shown"===this.commentsVisibility?this.hideAds():this.showAds(),this.fetchComments()}}),Object.defineProperty(t.prototype,"renderTemplate",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t=a()("aafp-comments aafp-comments--loading",{"aafp-comments--hidden":"hidden"===this.commentsVisibility}).split(" ");(e=this.$el.classList).add.apply(e,function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(t),!1));var n="\n      ".concat(this.commentsVisibility?'\n          <div class="aafp-comments__toggle">\n            <button\n              type="button"\n              class="aafp-button"\n              aria-controls="aafp-comments-area"\n            >\n              '.concat("shown"===this.commentsVisibility?this.hideLabel:this.showLabel,"\n            </button>\n          </div>\n        "):"","\n    "),r="\n      ".concat(n,'\n      <div id="aafp-comments-area">\n        <div class="loading-spinner">\n          <div class="loading-spinner__spinner" aria-hidden="true">\n            <span class="aafp-icon aafp-icon--spinner loading-spinner__spinner-icon">\n              <svg class="aafp-icon__svg" aria-hidden="true"\n                focusable="false">\n                <use xlink:href="#spinner"></use>\n              </svg>\n            </span>\n          </div>\n        </div>\n      </div>\n    ');this.$el.innerHTML=r}}),Object.defineProperty(t.prototype,"displayError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=null==e?void 0:e.target,n=e?"Error loading script: ".concat(t.src):null;this.$commentsArea&&(this.$commentsArea.innerHTML='\n        <div class="aafp-comments__error">'.concat(this.defaultErrorMsg,"</div>\n      ")),n&&console.error(n)}}),Object.defineProperty(t.prototype,"fetchComments",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e=this,t=void 0,r=function(){var e,t,n,r,o,i,a,l,s,c,u=this;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}(this,function(d){switch(d.label){case 0:this.abortController=new AbortController,e=this.abortController.signal,t=setTimeout(function(){return u.abortController.abort()},1e4),d.label=1;case 1:if(d.trys.push([1,4,,5]),!this.dataHandle)throw Error("Data path is not defined");if(!(n=this.$el.dataset.mockPartial||"https://www.aafp.org/ams/commenting/display?handle=".concat(encodeURIComponent(this.dataHandle),"&nocache=").concat((new Date).getTime())))throw Error("Invalid Url");return[4,fetch(n,{signal:e})];case 2:if(!(r=d.sent()).ok)throw Error("Cannot fetch comments from ".concat(r.url));return[4,r.text()];case 3:return o=d.sent(),this.$commentsArea.innerHTML=o.replace(/<link\b[^>]*?>/gi,""),this.$el.classList.remove("aafp-comments--loading"),this.setupFirstCommentAutoReveal(),clearTimeout(t),this.$commentsArea&&(i="https://ui.aafp.net/aafp-brand-components/2/components/
2aafp-web-components/aafp-web-components.js",a="https://www.aafp.org/ams/commenting/Pages/Display/display.js",document.querySelector('script[src="'.concat(i,'"]'))||((l=document.createElement("script")).async=!0,l.addEventListener("error",this.displayError),l.setAttribute("src",i),this.injectedScripts.push(l),document.head.appendChild(l)),document.querySelector('script[src="'.concat(a,'"]'))?"function"==typeof window.setUpPageForComments&&window.setUpPageForComments():((s=document.createElement("script")).async=!0,s.addEventListener("load",function(){"function"==typeof window.setUpPageForComments&&window.setUpPageForComments()}),s.addEventListener("error",this.displayError),s.setAttribute("src",a),this.injectedScripts.push(s),document.head.appendChild(s))),[3,5];case 4:return c=d.sent(),this.displayError(null),console.error(c),[3,5];case 5:return[2]}})},new((n=void 0)||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function l(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,l)}s((r=r.apply(e,t||[])).next())});var e,t,n,r}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t,n;null===(t=this.abortController)||void 0===t||t.abort(),null===(n=this.toggleButton)||void 0===n||n.removeEventListener("click",this.onToggleButtonClick),this.disconnectFirstCommentObserver(),this.injectedScripts.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)}),this.injectedScripts=[],e.prototype.destroy.call(this)}}),t}(o.$);function c(e){if(e)try{new s(e)}catch(e){console.error(e)}}},452(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,i(n)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)r.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()}}]);

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.