{"version":3,"file":"product-iframe-row-c52659d9.js","sources":["../../../../src/scripts/modules/product-iframe-row.tsx"],"sourcesContent":["import { Component } from '@verndale/core';\nimport { debounce } from '../helpers/debounce';\n\nclass ProductIframeRow extends Component {\n  setupDefaults() {\n    this.dom = {\n      iframe: this.el.querySelector<HTMLElement>('iframe')\n    };\n  }\n\n  addListeners() {\n    const iframe = this.dom.iframe as HTMLIFrameElement;\n    iframe.addEventListener('load', () => {\n      setTimeout(() => {\n        this.setIframeHeight();\n      }, 500);\n    });\n    window.addEventListener(\n      'resize',\n      debounce(this.handleResize.bind(this), 100)\n    );\n  }\n\n  setIframeHeight() {\n    const iframe = this.dom.iframe as HTMLIFrameElement;\n    const iframeHeight =\n      iframe.contentWindow?.document.documentElement.scrollHeight;\n\n    iframe.style.height = iframeHeight + 'px';\n    iframe.setAttribute('height', iframeHeight?.toString() || '');\n  }\n\n  handleResize() {\n    this.setIframeHeight();\n  }\n}\n\nexport default ProductIframeRow;\n"],"names":["ProductIframeRow","Component","debounce","iframe","iframeHeight","_a"],"mappings":"wLAGA,MAAMA,UAAyBC,CAAU,CACvC,eAAgB,CACd,KAAK,IAAM,CACT,OAAQ,KAAK,GAAG,cAA2B,QAAQ,CAAA,CAEvD,CAEA,cAAe,CACE,KAAK,IAAI,OACjB,iBAAiB,OAAQ,IAAM,CACpC,WAAW,IAAM,CACf,KAAK,gBAAgB,GACpB,GAAG,CAAA,CACP,EACM,OAAA,iBACL,SACAC,EAAS,KAAK,aAAa,KAAK,IAAI,EAAG,GAAG,CAAA,CAE9C,CAEA,iBAAkB,OACV,MAAAC,EAAS,KAAK,IAAI,OAClBC,GACJC,EAAAF,EAAO,gBAAP,YAAAE,EAAsB,SAAS,gBAAgB,aAE1CF,EAAA,MAAM,OAASC,EAAe,KACrCD,EAAO,aAAa,UAAUC,GAAA,YAAAA,EAAc,aAAc,EAAE,CAC9D,CAEA,cAAe,CACb,KAAK,gBAAgB,CACvB,CACF"}