{"version":3,"sources":["iframeResizer.js"],"names":["undefined","window","$","count","logEnabled","hiddenCheckEnabled","msgHeaderLen","length","msgId","msgIdLen","pagePosition","requestAnimationFrame","resetRequiredMethods","max","scroll","bodyScroll","documentElementScroll","settings","timer","defaults","autoResize","bodyBackground","bodyMargin","bodyMarginV1","bodyPadding","checkOrigin","inPageLinks","enablePublicMethods","heightCalculationMethod","id","interval","log","maxHeight","Infinity","maxWidth","minHeight","minWidth","mouseEvents","resizeFrom","scrolling","sizeHeight","sizeWidth","warningTimeout","tolerance","widthCalculationMethod","onClose","onClosed","onInit","onMessage","warn","onMouseEnter","onMouseLeave","onResized","onScroll","frameTimer","jQuery","fn","iFrameResize","options","this","filter","each","index","element","setupIFrame","end","info","define","amd","factory","module","exports","getMutationObserver","MutationObserver","WebKitMutationObserver","MozMutationObserver","addEventListener","el","evt","func","removeEventListener","formatLogHeader","iframeId","retStr","top","self","parentIFrame","getId","getMyID","isLogEnabled","msg","output","type","enabled","console","iFrameListener","event","resizeIFrame","ensureInRange","syncResize","setSize","messageData","setPagePosition","on","getPaddingEnds","compStyle","boxSizing","paddingTop","parseInt","paddingBottom","getBorderEnds","borderTopWidth","borderBottomWidth","Dimension","Number","min","dimension","toLowerCase","size","getMsgBody","offset","substr","indexOf","sendPageInfoToIframe","iframe","time","frameId","bodyPosition","iFramePosition","trigger","document","body","getBoundingClientRect","JSON","stringify","iframeHeight","height","iframeWidth","width","clientHeight","Math","documentElement","innerHeight","clientWidth","innerWidth","offsetTop","offsetLeft","left","scrollTop","pageYOffset","scrollLeft","pageXOffset","documentHeight","documentWidth","windowHeight","windowWidth","setTimeout","getElementPosition","target","getPagePosition","x","floor","y","scrollRequestFromChild","addOffset","newPosition","scrollTo","unsetPagePosition","onMouse","mousePos","data","split","screenX","screenY","funcName","val","chkEvent","retBool","retCode","createOutgoingMsg","iFrameReadyMsgReceived","getComputedStyle","loaded","true","false","hasSettings","remoteHost","origin","constructor","Array","i","checkList","Error","isMessageFromIFrame","firstRun","closeIFrame","msgBody","message","parse","setListener","sendPageInfo","stop","forEach","stopPageInfo","startPageInfoMonitor","location","hash","hashData","decodeURIComponent","getElementById","getElementsByName","jumpPosition","moveToAnchor","resetIFrame","actionMsg","retVal","TypeError","removeIframeListeners","parentNode","removeChild","error","chkZero","checkIFrames","Object","keys","key","settingId","chkDimension","style","offsetParent","checkIFrame","mutationObserved","mutations","debouce","querySelector","observe","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","fixHiddenIFrames","processDimension","setDimension","doNotSync","jasmine","calleeMsg","noResponseWarning","errorShown","contentWindow","targetOrigin","postMessage","msgTimeout","depricate","splitName","name","charAt","toUpperCase","slice","src","ensureHasId","join","checkOptions","option","prototype","hasOwnProperty","call","copyOptions","match","processOptions","overflow","setScrolling","addStyle","styleValue","chkMinMax","setLimits","mutation","removedNodes","removedNode","createDestroyObserver","resetRequertMethod","iFrameResizer","close","bind","removeListeners","resize","anchor","sendMessage","tabVisible","visibilityState","sendTriggerMsg","eventName","isIFrameResizeEnabled","setupEventListeners","init","tagName","chkType","iFrames","push","vendors","setupRequestAnimationFrame","warnDeprecatedOptions","querySelectorAll"],"mappings":"CAWC,SAAWA,GACV,GAAsB,oBAAXC,OAAX,CAEA,IAy3CkCC,EAz3C9BC,EAAQ,EACVC,GAAa,EACbC,GAAqB,EAErBC,EADY,UACaC,OACzBC,EAAQ,gBACRC,EAAWD,EAAMD,OACjBG,EAAe,KACfC,EAAwBV,OAAOU,sBAC/BC,EAAuB,CACrBC,IAAK,EACLC,OAAQ,EACRC,WAAY,EACZC,sBAAuB,GAEzBC,EAAW,GACXC,EAAQ,KACRC,EAAW,CACTC,YAAY,EACZC,eAAgB,KAChBC,WAAY,KACZC,aAAc,EACdC,YAAa,KACbC,aAAa,EACbC,aAAa,EACbC,qBAAqB,EACrBC,wBAAyB,aACzBC,GAAI,gBACJC,SAAU,GACVC,KAAK,EACLC,UAAWC,EAAAA,EACXC,SAAUD,EAAAA,EACVE,UAAW,EACXC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BsD,SAAU,2BAA4B+J,GAGzD,SAAS5N,IACP,SAASkO,EAAK7O,EAASK,GAWjBA,KAVJ,WACE,IAAKA,EAAQyO,QACX,MAAM,IAAIhF,UAAU,qCACf,GAAI,WAAazJ,EAAQyO,QAAQtC,cACtC,MAAM,IAAI1C,UACR,iCAAmCzJ,EAAQyO,QAAU,KAMzDC,GACAzO,EAAYD,EAASL,GACrBgP,EAAQC,KAAK5O,IAYjB,IAAI2O,EAKJ,OArxCF,WACE,IACI1I,EADA4I,EAAU,CAAC,MAAO,SAAU,IAAK,MAIrC,IAAK5I,EAAI,EAAGA,EAAI4I,EAAQrS,SAAWI,EAAuBqJ,GAAK,EAC7DrJ,EAAwBV,OAAO2S,EAAQ5I,GAAK,yBAGzCrJ,EAMHA,EAAwBA,EAAsBiR,KAAK3R,QALnD8B,EAAI,QAAS,uCAwwCf8Q,GACAP,IAEO,SAAuB5O,EAASoG,GAKrC,OAJA4I,EAAU,GAdZ,SAA+BhP,GACzBA,GAAWA,EAAQ/B,qBACrBsB,EACE,sGAaJ6P,CAAsBpP,UAEPoG,GACb,IAAK,YACL,IAAK,SACH+B,MAAM4E,UAAU/D,QAAQiE,KACtBzI,SAAS6K,iBAAiBjJ,GAAU,UACpCyI,EAAKX,UA52ChB,EA42CgClO,IAEvB,MAEF,IAAK,SACH6O,EAAK7O,EAASoG,GACd,MAEF,QACE,MAAM,IAAI0D,UAAU,gCAAkC1D,EAAS,KAGnE,OAAO4I,IAx3CZ","file":"iframeResizer.js","sourcesContent":["/*\n * File: iframeResizer.js\n * Desc: Force iframes to size to content.\n * Requires: iframeResizer.contentWindow.js to be loaded into the target frame.\n * Doc: https://github.com/davidjbradshaw/iframe-resizer\n * Author: David J. Bradshaw - dave@bradshaw.net\n * Contributor: Jure Mav - jure.mav@gmail.com\n * Contributor: Reed Dadoune - reed@dadoune.com\n */\n\n// eslint-disable-next-line sonarjs/cognitive-complexity, no-shadow-restricted-names\n;(function (undefined) {\n  if (typeof window === 'undefined') return // don't run for server side render\n\n  var count = 0,\n    logEnabled = false,\n    hiddenCheckEnabled = false,\n    msgHeader = 'message',\n    msgHeaderLen = msgHeader.length,\n    msgId = '[iFrameSizer]', // Must match iframe msg ID\n    msgIdLen = msgId.length,\n    pagePosition = null,\n    requestAnimationFrame = window.requestAnimationFrame,\n    resetRequiredMethods = {\n      max: 1,\n      scroll: 1,\n      bodyScroll: 1,\n      documentElementScroll: 1\n    },\n    settings = {},\n    timer = null,\n    defaults = {\n      autoResize: true,\n      bodyBackground: null,\n      bodyMargin: null,\n      bodyMarginV1: 8,\n      bodyPadding: null,\n      checkOrigin: true,\n      inPageLinks: false,\n      enablePublicMethods: true,\n      heightCalculationMethod: 'bodyOffset',\n      id: 'iFrameResizer',\n      interval: 32,\n      log: false,\n      maxHeight: Infinity,\n      maxWidth: Infinity,\n      minHeight: 0,\n      minWidth: 0,\n      mouseEvents: true,\n      resizeFrom: 'parent',\n      scrolling: false,\n      sizeHeight: true,\n      sizeWidth: false,\n      warningTimeout: 5000,\n      tolerance: 0,\n      widthCalculationMethod: 'scroll',\n      onClose: function () {\n        return true\n      },\n      onClosed: function () {},\n      onInit: function () {},\n      onMessage: function () {\n        warn('onMessage function not defined')\n      },\n      onMouseEnter: function () {},\n      onMouseLeave: function () {},\n      onResized: function () {},\n      onScroll: function () {\n        return true\n      }\n    }\n\n  function getMutationObserver() {\n    return (\n      window.MutationObserver ||\n      window.WebKitMutationObserver ||\n      window.MozMutationObserver\n    )\n  }\n\n  function addEventListener(el, evt, func) {\n    el.addEventListener(evt, func, false)\n  }\n\n  function removeEventListener(el, evt, func) {\n    el.removeEventListener(evt, func, false)\n  }\n\n  function setupRequestAnimationFrame() {\n    var vendors = ['moz', 'webkit', 'o', 'ms']\n    var x\n\n    // Remove vendor prefixing if prefixed and break early if not\n    for (x = 0; x < vendors.length && !requestAnimationFrame; x += 1) {\n      requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']\n    }\n\n    if (!requestAnimationFrame) {\n      log('setup', 'RequestAnimationFrame not supported')\n    } else {\n      // Firefox extension content-scripts have a globalThis object that is not the same as window.\n      // Binding `requestAnimationFrame` to window allows the function to work and prevents errors\n      // being thrown when run in that context, and should be a no-op in every other context.\n      requestAnimationFrame = requestAnimationFrame.bind(window)\n    }\n  }\n\n  function getMyID(iframeId) {\n    var retStr = 'Host page: ' + iframeId\n\n    if (window.top !== window.self) {\n      retStr =\n        window.parentIFrame && window.parentIFrame.getId\n          ? window.parentIFrame.getId() + ': ' + iframeId\n          : 'Nested host page: ' + iframeId\n    }\n\n    return retStr\n  }\n\n  function formatLogHeader(iframeId) {\n    return msgId + '[' + getMyID(iframeId) + ']'\n  }\n\n  function isLogEnabled(iframeId) {\n    return settings[iframeId] ? settings[iframeId].log : logEnabled\n  }\n\n  function log(iframeId, msg) {\n    output('log', iframeId, msg, isLogEnabled(iframeId))\n  }\n\n  function info(iframeId, msg) {\n    output('info', iframeId, msg, isLogEnabled(iframeId))\n  }\n\n  function warn(iframeId, msg) {\n    output('warn', iframeId, msg, true)\n  }\n\n  function output(type, iframeId, msg, enabled) {\n    if (true === enabled && 'object' === typeof window.console) {\n      // eslint-disable-next-line no-console\n      console[type](formatLogHeader(iframeId), msg)\n    }\n  }\n\n  function iFrameListener(event) {\n    function resizeIFrame() {\n      function resize() {\n        setSize(messageData)\n        setPagePosition(iframeId)\n        on('onResized', messageData)\n      }\n\n      ensureInRange('Height')\n      ensureInRange('Width')\n\n      syncResize(resize, messageData, 'init')\n    }\n\n    function processMsg() {\n      var data = msg.substr(msgIdLen).split(':')\n      var height = data[1] ? parseInt(data[1], 10) : 0\n      var iframe = settings[data[0]] && settings[data[0]].iframe\n      var compStyle = getComputedStyle(iframe)\n\n      return {\n        iframe: iframe,\n        id: data[0],\n        height: height + getPaddingEnds(compStyle) + getBorderEnds(compStyle),\n        width: data[2],\n        type: data[3]\n      }\n    }\n\n    function getPaddingEnds(compStyle) {\n      if (compStyle.boxSizing !== 'border-box') {\n        return 0\n      }\n      var top = compStyle.paddingTop ? parseInt(compStyle.paddingTop, 10) : 0\n      var bot = compStyle.paddingBottom\n        ? parseInt(compStyle.paddingBottom, 10)\n        : 0\n      return top + bot\n    }\n\n    function getBorderEnds(compStyle) {\n      if (compStyle.boxSizing !== 'border-box') {\n        return 0\n      }\n      var top = compStyle.borderTopWidth\n        ? parseInt(compStyle.borderTopWidth, 10)\n        : 0\n      var bot = compStyle.borderBottomWidth\n        ? parseInt(compStyle.borderBottomWidth, 10)\n        : 0\n      return top + bot\n    }\n\n    function ensureInRange(Dimension) {\n      var max = Number(settings[iframeId]['max' + Dimension]),\n        min = Number(settings[iframeId]['min' + Dimension]),\n        dimension = Dimension.toLowerCase(),\n        size = Number(messageData[dimension])\n\n      log(iframeId, 'Checking ' + dimension + ' is in range ' + min + '-' + max)\n\n      if (size < min) {\n        size = min\n        log(iframeId, 'Set ' + dimension + ' to min value')\n      }\n\n      if (size > max) {\n        size = max\n        log(iframeId, 'Set ' + dimension + ' to max value')\n      }\n\n      messageData[dimension] = '' + size\n    }\n\n    function isMessageFromIFrame() {\n      function checkAllowedOrigin() {\n        function checkList() {\n          var i = 0,\n            retCode = false\n\n          log(\n            iframeId,\n            'Checking connection is from allowed list of origins: ' +\n              checkOrigin\n          )\n\n          for (; i < checkOrigin.length; i++) {\n            if (checkOrigin[i] === origin) {\n              retCode = true\n              break\n            }\n          }\n          return retCode\n        }\n\n        function checkSingle() {\n          var remoteHost = settings[iframeId] && settings[iframeId].remoteHost\n          log(iframeId, 'Checking connection is from: ' + remoteHost)\n          return origin === remoteHost\n        }\n\n        return checkOrigin.constructor === Array ? checkList() : checkSingle()\n      }\n\n      var origin = event.origin,\n        checkOrigin = settings[iframeId] && settings[iframeId].checkOrigin\n\n      if (checkOrigin && '' + origin !== 'null' && !checkAllowedOrigin()) {\n        throw new Error(\n          'Unexpected message received from: ' +\n            origin +\n            ' for ' +\n            messageData.iframe.id +\n            '. Message was: ' +\n            event.data +\n            '. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.'\n        )\n      }\n\n      return true\n    }\n\n    function isMessageForUs() {\n      return (\n        msgId === ('' + msg).substr(0, msgIdLen) &&\n        msg.substr(msgIdLen).split(':')[0] in settings\n      ) // ''+Protects against non-string msg\n    }\n\n    function isMessageFromMetaParent() {\n      // Test if this message is from a parent above us. This is an ugly test, however, updating\n      // the message format would break backwards compatibity.\n      var retCode = messageData.type in { true: 1, false: 1, undefined: 1 }\n\n      if (retCode) {\n        log(iframeId, 'Ignoring init message from meta parent page')\n      }\n\n      return retCode\n    }\n\n    function getMsgBody(offset) {\n      return msg.substr(msg.indexOf(':') + msgHeaderLen + offset)\n    }\n\n    function forwardMsgFromIFrame(msgBody) {\n      log(\n        iframeId,\n        'onMessage passed: {iframe: ' +\n          messageData.iframe.id +\n          ', message: ' +\n          msgBody +\n          '}'\n      )\n\n      on('onMessage', {\n        iframe: messageData.iframe,\n        message: JSON.parse(msgBody)\n      })\n\n      log(iframeId, '--')\n    }\n\n    function getPageInfo() {\n      var bodyPosition = document.body.getBoundingClientRect(),\n        iFramePosition = messageData.iframe.getBoundingClientRect()\n\n      return JSON.stringify({\n        iframeHeight: iFramePosition.height,\n        iframeWidth: iFramePosition.width,\n        clientHeight: Math.max(\n          document.documentElement.clientHeight,\n          window.innerHeight || 0\n        ),\n        clientWidth: Math.max(\n          document.documentElement.clientWidth,\n          window.innerWidth || 0\n        ),\n        offsetTop: parseInt(iFramePosition.top - bodyPosition.top, 10),\n        offsetLeft: parseInt(iFramePosition.left - bodyPosition.left, 10),\n        scrollTop: window.pageYOffset,\n        scrollLeft: window.pageXOffset,\n        documentHeight: document.documentElement.clientHeight,\n        documentWidth: document.documentElement.clientWidth,\n        windowHeight: window.innerHeight,\n        windowWidth: window.innerWidth\n      })\n    }\n\n    function sendPageInfoToIframe(iframe, iframeId) {\n      function debouncedTrigger() {\n        trigger('Send Page Info', 'pageInfo:' + getPageInfo(), iframe, iframeId)\n      }\n      debounceFrameEvents(debouncedTrigger, 32, iframeId)\n    }\n\n    function startPageInfoMonitor() {\n      function setListener(type, func) {\n        function sendPageInfo() {\n          if (settings[id]) {\n            sendPageInfoToIframe(settings[id].iframe, id)\n          } else {\n            stop()\n          }\n        }\n\n        ;['scroll', 'resize'].forEach(function (evt) {\n          log(id, type + evt + ' listener for sendPageInfo')\n          func(window, evt, sendPageInfo)\n        })\n      }\n\n      function stop() {\n        setListener('Remove ', removeEventListener)\n      }\n\n      function start() {\n        setListener('Add ', addEventListener)\n      }\n\n      var id = iframeId // Create locally scoped copy of iFrame ID\n\n      start()\n\n      if (settings[id]) {\n        settings[id].stopPageInfo = stop\n      }\n    }\n\n    function stopPageInfoMonitor() {\n      if (settings[iframeId] && settings[iframeId].stopPageInfo) {\n        settings[iframeId].stopPageInfo()\n        delete settings[iframeId].stopPageInfo\n      }\n    }\n\n    function checkIFrameExists() {\n      var retBool = true\n\n      if (null === messageData.iframe) {\n        warn(iframeId, 'IFrame (' + messageData.id + ') not found')\n        retBool = false\n      }\n      return retBool\n    }\n\n    function getElementPosition(target) {\n      var iFramePosition = target.getBoundingClientRect()\n\n      getPagePosition(iframeId)\n\n      return {\n        x: Math.floor(Number(iFramePosition.left) + Number(pagePosition.x)),\n        y: Math.floor(Number(iFramePosition.top) + Number(pagePosition.y))\n      }\n    }\n\n    function scrollRequestFromChild(addOffset) {\n      /* istanbul ignore next */ // Not testable in Karma\n      function reposition() {\n        pagePosition = newPosition\n        scrollTo()\n        log(iframeId, '--')\n      }\n\n      function calcOffset() {\n        return {\n          x: Number(messageData.width) + offset.x,\n          y: Number(messageData.height) + offset.y\n        }\n      }\n\n      function scrollParent() {\n        if (window.parentIFrame) {\n          window.parentIFrame['scrollTo' + (addOffset ? 'Offset' : '')](\n            newPosition.x,\n            newPosition.y\n          )\n        } else {\n          warn(\n            iframeId,\n            'Unable to scroll to requested position, window.parentIFrame not found'\n          )\n        }\n      }\n\n      var offset = addOffset\n          ? getElementPosition(messageData.iframe)\n          : { x: 0, y: 0 },\n        newPosition = calcOffset()\n\n      log(\n        iframeId,\n        'Reposition requested from iFrame (offset x:' +\n          offset.x +\n          ' y:' +\n          offset.y +\n          ')'\n      )\n\n      if (window.top !== window.self) {\n        scrollParent()\n      } else {\n        reposition()\n      }\n    }\n\n    function scrollTo() {\n      if (false !== on('onScroll', pagePosition)) {\n        setPagePosition(iframeId)\n      } else {\n        unsetPagePosition()\n      }\n    }\n\n    function findTarget(location) {\n      function jumpToTarget() {\n        var jumpPosition = getElementPosition(target)\n\n        log(\n          iframeId,\n          'Moving to in page link (#' +\n            hash +\n            ') at x: ' +\n            jumpPosition.x +\n            ' y: ' +\n            jumpPosition.y\n        )\n        pagePosition = {\n          x: jumpPosition.x,\n          y: jumpPosition.y\n        }\n\n        scrollTo()\n        log(iframeId, '--')\n      }\n\n      function jumpToParent() {\n        if (window.parentIFrame) {\n          window.parentIFrame.moveToAnchor(hash)\n        } else {\n          log(\n            iframeId,\n            'In page link #' +\n              hash +\n              ' not found and window.parentIFrame not found'\n          )\n        }\n      }\n\n      var hash = location.split('#')[1] || '',\n        hashData = decodeURIComponent(hash),\n        target =\n          document.getElementById(hashData) ||\n          document.getElementsByName(hashData)[0]\n\n      if (target) {\n        jumpToTarget()\n      } else if (window.top !== window.self) {\n        jumpToParent()\n      } else {\n        log(iframeId, 'In page link #' + hash + ' not found')\n      }\n    }\n\n    function onMouse(event) {\n      var mousePos = {}\n\n      if (Number(messageData.width) === 0 && Number(messageData.height) === 0) {\n        var data = getMsgBody(9).split(':')\n        mousePos = {\n          x: data[1],\n          y: data[0]\n        }\n      } else {\n        mousePos = {\n          x: messageData.width,\n          y: messageData.height\n        }\n      }\n\n      on(event, {\n        iframe: messageData.iframe,\n        screenX: Number(mousePos.x),\n        screenY: Number(mousePos.y),\n        type: messageData.type\n      })\n    }\n\n    function on(funcName, val) {\n      return chkEvent(iframeId, funcName, val)\n    }\n\n    function actionMsg() {\n      if (settings[iframeId] && settings[iframeId].firstRun) firstRun()\n\n      switch (messageData.type) {\n        case 'close':\n          closeIFrame(messageData.iframe)\n          break\n\n        case 'message':\n          forwardMsgFromIFrame(getMsgBody(6))\n          break\n\n        case 'mouseenter':\n          onMouse('onMouseEnter')\n          break\n\n        case 'mouseleave':\n          onMouse('onMouseLeave')\n          break\n\n        case 'autoResize':\n          settings[iframeId].autoResize = JSON.parse(getMsgBody(9))\n          break\n\n        case 'scrollTo':\n          scrollRequestFromChild(false)\n          break\n\n        case 'scrollToOffset':\n          scrollRequestFromChild(true)\n          break\n\n        case 'pageInfo':\n          sendPageInfoToIframe(\n            settings[iframeId] && settings[iframeId].iframe,\n            iframeId\n          )\n          startPageInfoMonitor()\n          break\n\n        case 'pageInfoStop':\n          stopPageInfoMonitor()\n          break\n\n        case 'inPageLink':\n          findTarget(getMsgBody(9))\n          break\n\n        case 'reset':\n          resetIFrame(messageData)\n          break\n\n        case 'init':\n          resizeIFrame()\n          on('onInit', messageData.iframe)\n          break\n\n        default:\n          if (\n            Number(messageData.width) === 0 &&\n            Number(messageData.height) === 0\n          ) {\n            warn(\n              'Unsupported message received (' +\n                messageData.type +\n                '), this is likely due to the iframe containing a later ' +\n                'version of iframe-resizer than the parent page'\n            )\n          } else {\n            resizeIFrame()\n          }\n      }\n    }\n\n    function hasSettings(iframeId) {\n      var retBool = true\n\n      if (!settings[iframeId]) {\n        retBool = false\n        warn(\n          messageData.type +\n            ' No settings for ' +\n            iframeId +\n            '. Message was: ' +\n            msg\n        )\n      }\n\n      return retBool\n    }\n\n    function iFrameReadyMsgReceived() {\n      // eslint-disable-next-line no-restricted-syntax, guard-for-in\n      for (var iframeId in settings) {\n        trigger(\n          'iFrame requested init',\n          createOutgoingMsg(iframeId),\n          settings[iframeId].iframe,\n          iframeId\n        )\n      }\n    }\n\n    function firstRun() {\n      if (settings[iframeId]) {\n        settings[iframeId].firstRun = false\n      }\n    }\n\n    var msg = event.data,\n      messageData = {},\n      iframeId = null\n\n    if ('[iFrameResizerChild]Ready' === msg) {\n      iFrameReadyMsgReceived()\n    } else if (isMessageForUs()) {\n      messageData = processMsg()\n      iframeId = messageData.id\n      if (settings[iframeId]) {\n        settings[iframeId].loaded = true\n      }\n\n      if (!isMessageFromMetaParent() && hasSettings(iframeId)) {\n        log(iframeId, 'Received: ' + msg)\n\n        if (checkIFrameExists() && isMessageFromIFrame()) {\n          actionMsg()\n        }\n      }\n    } else {\n      info(iframeId, 'Ignored: ' + msg)\n    }\n  }\n\n  function chkEvent(iframeId, funcName, val) {\n    var func = null,\n      retVal = null\n\n    if (settings[iframeId]) {\n      func = settings[iframeId][funcName]\n\n      if ('function' === typeof func) {\n        retVal = func(val)\n      } else {\n        throw new TypeError(\n          funcName + ' on iFrame[' + iframeId + '] is not a function'\n        )\n      }\n    }\n\n    return retVal\n  }\n\n  function removeIframeListeners(iframe) {\n    var iframeId = iframe.id\n    delete settings[iframeId]\n  }\n\n  function closeIFrame(iframe) {\n    var iframeId = iframe.id\n    if (chkEvent(iframeId, 'onClose', iframeId) === false) {\n      log(iframeId, 'Close iframe cancelled by onClose event')\n      return\n    }\n    log(iframeId, 'Removing iFrame: ' + iframeId)\n\n    try {\n      // Catch race condition error with React\n      if (iframe.parentNode) {\n        iframe.parentNode.removeChild(iframe)\n      }\n    } catch (error) {\n      warn(error)\n    }\n\n    chkEvent(iframeId, 'onClosed', iframeId)\n    log(iframeId, '--')\n    removeIframeListeners(iframe)\n  }\n\n  function getPagePosition(iframeId) {\n    if (null === pagePosition) {\n      pagePosition = {\n        x:\n          window.pageXOffset !== undefined\n            ? window.pageXOffset\n            : document.documentElement.scrollLeft,\n        y:\n          window.pageYOffset !== undefined\n            ? window.pageYOffset\n            : document.documentElement.scrollTop\n      }\n      log(\n        iframeId,\n        'Get page position: ' + pagePosition.x + ',' + pagePosition.y\n      )\n    }\n  }\n\n  function setPagePosition(iframeId) {\n    if (null !== pagePosition) {\n      window.scrollTo(pagePosition.x, pagePosition.y)\n      log(\n        iframeId,\n        'Set page position: ' + pagePosition.x + ',' + pagePosition.y\n      )\n      unsetPagePosition()\n    }\n  }\n\n  function unsetPagePosition() {\n    pagePosition = null\n  }\n\n  function resetIFrame(messageData) {\n    function reset() {\n      setSize(messageData)\n      trigger('reset', 'reset', messageData.iframe, messageData.id)\n    }\n\n    log(\n      messageData.id,\n      'Size reset requested by ' +\n        ('init' === messageData.type ? 'host page' : 'iFrame')\n    )\n    getPagePosition(messageData.id)\n    syncResize(reset, messageData, 'reset')\n  }\n\n  function setSize(messageData) {\n    function setDimension(dimension) {\n      if (!messageData.id) {\n        log('undefined', 'messageData id not set')\n        return\n      }\n      messageData.iframe.style[dimension] = messageData[dimension] + 'px'\n      log(\n        messageData.id,\n        'IFrame (' +\n          iframeId +\n          ') ' +\n          dimension +\n          ' set to ' +\n          messageData[dimension] +\n          'px'\n      )\n    }\n\n    function chkZero(dimension) {\n      // FireFox sets dimension of hidden iFrames to zero.\n      // So if we detect that set up an event to check for\n      // when iFrame becomes visible.\n\n      /* istanbul ignore next */ // Not testable in PhantomJS\n      if (!hiddenCheckEnabled && '0' === messageData[dimension]) {\n        hiddenCheckEnabled = true\n        log(iframeId, 'Hidden iFrame detected, creating visibility listener')\n        fixHiddenIFrames()\n      }\n    }\n\n    function processDimension(dimension) {\n      setDimension(dimension)\n      chkZero(dimension)\n    }\n\n    var iframeId = messageData.iframe.id\n\n    if (settings[iframeId]) {\n      if (settings[iframeId].sizeHeight) {\n        processDimension('height')\n      }\n      if (settings[iframeId].sizeWidth) {\n        processDimension('width')\n      }\n    }\n  }\n\n  function syncResize(func, messageData, doNotSync) {\n    /* istanbul ignore if */ // Not testable in PhantomJS\n    if (\n      doNotSync !== messageData.type &&\n      requestAnimationFrame &&\n      // including check for jasmine because had trouble getting spy to work in unit test using requestAnimationFrame\n      !window.jasmine\n    ) {\n      log(messageData.id, 'Requesting animation frame')\n      requestAnimationFrame(func)\n    } else {\n      func()\n    }\n  }\n\n  function trigger(calleeMsg, msg, iframe, id, noResponseWarning) {\n    function postMessageToIFrame() {\n      var target = settings[id] && settings[id].targetOrigin\n      log(\n        id,\n        '[' +\n          calleeMsg +\n          '] Sending msg to iframe[' +\n          id +\n          '] (' +\n          msg +\n          ') targetOrigin: ' +\n          target\n      )\n      iframe.contentWindow.postMessage(msgId + msg, target)\n    }\n\n    function iFrameNotFound() {\n      warn(id, '[' + calleeMsg + '] IFrame(' + id + ') not found')\n    }\n\n    function chkAndSend() {\n      if (\n        iframe &&\n        'contentWindow' in iframe &&\n        null !== iframe.contentWindow\n      ) {\n        // Null test for PhantomJS\n        postMessageToIFrame()\n      } else {\n        iFrameNotFound()\n      }\n    }\n\n    function warnOnNoResponse() {\n      function warning() {\n        if (settings[id] && !settings[id].loaded && !errorShown) {\n          errorShown = true\n          warn(\n            id,\n            'IFrame has not responded within ' +\n              settings[id].warningTimeout / 1000 +\n              ' seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning.'\n          )\n        }\n      }\n\n      if (\n        !!noResponseWarning &&\n        settings[id] &&\n        !!settings[id].warningTimeout\n      ) {\n        settings[id].msgTimeout = setTimeout(\n          warning,\n          settings[id].warningTimeout\n        )\n      }\n    }\n\n    var errorShown = false\n\n    id = id || iframe.id\n\n    if (settings[id]) {\n      chkAndSend()\n      warnOnNoResponse()\n    }\n  }\n\n  function createOutgoingMsg(iframeId) {\n    return (\n      iframeId +\n      ':' +\n      settings[iframeId].bodyMarginV1 +\n      ':' +\n      settings[iframeId].sizeWidth +\n      ':' +\n      settings[iframeId].log +\n      ':' +\n      settings[iframeId].interval +\n      ':' +\n      settings[iframeId].enablePublicMethods +\n      ':' +\n      settings[iframeId].autoResize +\n      ':' +\n      settings[iframeId].bodyMargin +\n      ':' +\n      settings[iframeId].heightCalculationMethod +\n      ':' +\n      settings[iframeId].bodyBackground +\n      ':' +\n      settings[iframeId].bodyPadding +\n      ':' +\n      settings[iframeId].tolerance +\n      ':' +\n      settings[iframeId].inPageLinks +\n      ':' +\n      settings[iframeId].resizeFrom +\n      ':' +\n      settings[iframeId].widthCalculationMethod +\n      ':' +\n      settings[iframeId].mouseEvents\n    )\n  }\n\n  function isNumber(value) {\n    return typeof value === 'number'\n  }\n\n  function setupIFrame(iframe, options) {\n    function setLimits() {\n      function addStyle(style) {\n        var styleValue = settings[iframeId][style]\n        if (Infinity !== styleValue && 0 !== styleValue) {\n          iframe.style[style] = isNumber(styleValue)\n            ? styleValue + 'px'\n            : styleValue\n          log(iframeId, 'Set ' + style + ' = ' + iframe.style[style])\n        }\n      }\n\n      function chkMinMax(dimension) {\n        if (\n          settings[iframeId]['min' + dimension] >\n          settings[iframeId]['max' + dimension]\n        ) {\n          throw new Error(\n            'Value for min' +\n              dimension +\n              ' can not be greater than max' +\n              dimension\n          )\n        }\n      }\n\n      chkMinMax('Height')\n      chkMinMax('Width')\n\n      addStyle('maxHeight')\n      addStyle('minHeight')\n      addStyle('maxWidth')\n      addStyle('minWidth')\n    }\n\n    function newId() {\n      var id = (options && options.id) || defaults.id + count++\n      if (null !== document.getElementById(id)) {\n        id += count++\n      }\n      return id\n    }\n\n    function ensureHasId(iframeId) {\n      if ('' === iframeId) {\n        // eslint-disable-next-line no-multi-assign\n        iframe.id = iframeId = newId()\n        logEnabled = (options || {}).log\n        log(\n          iframeId,\n          'Added missing iframe ID: ' + iframeId + ' (' + iframe.src + ')'\n        )\n      }\n\n      return iframeId\n    }\n\n    function setScrolling() {\n      log(\n        iframeId,\n        'IFrame scrolling ' +\n          (settings[iframeId] && settings[iframeId].scrolling\n            ? 'enabled'\n            : 'disabled') +\n          ' for ' +\n          iframeId\n      )\n      iframe.style.overflow =\n        false === (settings[iframeId] && settings[iframeId].scrolling)\n          ? 'hidden'\n          : 'auto'\n      switch (settings[iframeId] && settings[iframeId].scrolling) {\n        case 'omit':\n          break\n\n        case true:\n          iframe.scrolling = 'yes'\n          break\n\n        case false:\n          iframe.scrolling = 'no'\n          break\n\n        default:\n          iframe.scrolling = settings[iframeId]\n            ? settings[iframeId].scrolling\n            : 'no'\n      }\n    }\n\n    // The V1 iFrame script expects an int, where as in V2 expects a CSS\n    // string value such as '1px 3em', so if we have an int for V2, set V1=V2\n    // and then convert V2 to a string PX value.\n    function setupBodyMarginValues() {\n      if (\n        'number' ===\n          typeof (settings[iframeId] && settings[iframeId].bodyMargin) ||\n        '0' === (settings[iframeId] && settings[iframeId].bodyMargin)\n      ) {\n        settings[iframeId].bodyMarginV1 = settings[iframeId].bodyMargin\n        settings[iframeId].bodyMargin =\n          '' + settings[iframeId].bodyMargin + 'px'\n      }\n    }\n\n    function checkReset() {\n      // Reduce scope of firstRun to function, because IE8's JS execution\n      // context stack is borked and this value gets externally\n      // changed midway through running this function!!!\n      var firstRun = settings[iframeId] && settings[iframeId].firstRun,\n        resetRequertMethod =\n          settings[iframeId] &&\n          settings[iframeId].heightCalculationMethod in resetRequiredMethods\n\n      if (!firstRun && resetRequertMethod) {\n        resetIFrame({ iframe: iframe, height: 0, width: 0, type: 'init' })\n      }\n    }\n\n    function setupIFrameObject() {\n      if (settings[iframeId]) {\n        settings[iframeId].iframe.iFrameResizer = {\n          close: closeIFrame.bind(null, settings[iframeId].iframe),\n\n          removeListeners: removeIframeListeners.bind(\n            null,\n            settings[iframeId].iframe\n          ),\n\n          resize: trigger.bind(\n            null,\n            'Window resize',\n            'resize',\n            settings[iframeId].iframe\n          ),\n\n          moveToAnchor: function (anchor) {\n            trigger(\n              'Move to anchor',\n              'moveToAnchor:' + anchor,\n              settings[iframeId].iframe,\n              iframeId\n            )\n          },\n\n          sendMessage: function (message) {\n            message = JSON.stringify(message)\n            trigger(\n              'Send Message',\n              'message:' + message,\n              settings[iframeId].iframe,\n              iframeId\n            )\n          }\n        }\n      }\n    }\n\n    // We have to call trigger twice, as we can not be sure if all\n    // iframes have completed loading when this code runs. The\n    // event listener also catches the page changing in the iFrame.\n    function init(msg) {\n      function iFrameLoaded() {\n        trigger('iFrame.onload', msg, iframe, undefined, true)\n        checkReset()\n      }\n\n      function createDestroyObserver(MutationObserver) {\n        if (!iframe.parentNode) {\n          return\n        }\n\n        var destroyObserver = new MutationObserver(function (mutations) {\n          mutations.forEach(function (mutation) {\n            var removedNodes = Array.prototype.slice.call(mutation.removedNodes) // Transform NodeList into an Array\n            removedNodes.forEach(function (removedNode) {\n              if (removedNode === iframe) {\n                closeIFrame(iframe)\n              }\n            })\n          })\n        })\n        destroyObserver.observe(iframe.parentNode, {\n          childList: true\n        })\n      }\n\n      var MutationObserver = getMutationObserver()\n      if (MutationObserver) {\n        createDestroyObserver(MutationObserver)\n      }\n\n      addEventListener(iframe, 'load', iFrameLoaded)\n      trigger('init', msg, iframe, undefined, true)\n    }\n\n    function checkOptions(options) {\n      if ('object' !== typeof options) {\n        throw new TypeError('Options is not an object')\n      }\n    }\n\n    function copyOptions(options) {\n      // eslint-disable-next-line no-restricted-syntax\n      for (var option in defaults) {\n        if (Object.prototype.hasOwnProperty.call(defaults, option)) {\n          settings[iframeId][option] = Object.prototype.hasOwnProperty.call(\n            options,\n            option\n          )\n            ? options[option]\n            : defaults[option]\n        }\n      }\n    }\n\n    function getTargetOrigin(remoteHost) {\n      return '' === remoteHost ||\n        null !== remoteHost.match(/^(about:blank|javascript:|file:\\/\\/)/)\n        ? '*'\n        : remoteHost\n    }\n\n    function depricate(key) {\n      var splitName = key.split('Callback')\n\n      if (splitName.length === 2) {\n        var name =\n          'on' + splitName[0].charAt(0).toUpperCase() + splitName[0].slice(1)\n        this[name] = this[key]\n        delete this[key]\n        warn(\n          iframeId,\n          \"Deprecated: '\" +\n            key +\n            \"' has been renamed '\" +\n            name +\n            \"'. The old method will be removed in the next major version.\"\n        )\n      }\n    }\n\n    function processOptions(options) {\n      options = options || {}\n      settings[iframeId] = {\n        firstRun: true,\n        iframe: iframe,\n        remoteHost: iframe.src && iframe.src.split('/').slice(0, 3).join('/')\n      }\n\n      checkOptions(options)\n      Object.keys(options).forEach(depricate, options)\n      copyOptions(options)\n\n      if (settings[iframeId]) {\n        settings[iframeId].targetOrigin =\n          true === settings[iframeId].checkOrigin\n            ? getTargetOrigin(settings[iframeId].remoteHost)\n            : '*'\n      }\n    }\n\n    function beenHere() {\n      return iframeId in settings && 'iFrameResizer' in iframe\n    }\n\n    var iframeId = ensureHasId(iframe.id)\n\n    if (!beenHere()) {\n      processOptions(options)\n      setScrolling()\n      setLimits()\n      setupBodyMarginValues()\n      init(createOutgoingMsg(iframeId))\n      setupIFrameObject()\n    } else {\n      warn(iframeId, 'Ignored iFrame, already setup.')\n    }\n  }\n\n  function debouce(fn, time) {\n    if (null === timer) {\n      timer = setTimeout(function () {\n        timer = null\n        fn()\n      }, time)\n    }\n  }\n\n  var frameTimer = {}\n  function debounceFrameEvents(fn, time, frameId) {\n    if (!frameTimer[frameId]) {\n      frameTimer[frameId] = setTimeout(function () {\n        frameTimer[frameId] = null\n        fn()\n      }, time)\n    }\n  }\n\n  // Not testable in PhantomJS\n  /* istanbul ignore next */\n\n  function fixHiddenIFrames() {\n    function checkIFrames() {\n      function checkIFrame(settingId) {\n        function chkDimension(dimension) {\n          return (\n            '0px' ===\n            (settings[settingId] && settings[settingId].iframe.style[dimension])\n          )\n        }\n\n        function isVisible(el) {\n          return null !== el.offsetParent\n        }\n\n        if (\n          settings[settingId] &&\n          isVisible(settings[settingId].iframe) &&\n          (chkDimension('height') || chkDimension('width'))\n        ) {\n          trigger(\n            'Visibility change',\n            'resize',\n            settings[settingId].iframe,\n            settingId\n          )\n        }\n      }\n\n      Object.keys(settings).forEach(function (key) {\n        checkIFrame(key)\n      })\n    }\n\n    function mutationObserved(mutations) {\n      log(\n        'window',\n        'Mutation observed: ' + mutations[0].target + ' ' + mutations[0].type\n      )\n      debouce(checkIFrames, 16)\n    }\n\n    function createMutationObserver() {\n      var target = document.querySelector('body'),\n        config = {\n          attributes: true,\n          attributeOldValue: false,\n          characterData: true,\n          characterDataOldValue: false,\n          childList: true,\n          subtree: true\n        },\n        observer = new MutationObserver(mutationObserved)\n\n      observer.observe(target, config)\n    }\n\n    var MutationObserver = getMutationObserver()\n    if (MutationObserver) {\n      createMutationObserver()\n    }\n  }\n\n  function resizeIFrames(event) {\n    function resize() {\n      sendTriggerMsg('Window ' + event, 'resize')\n    }\n\n    log('window', 'Trigger event: ' + event)\n    debouce(resize, 16)\n  }\n\n  // Not testable in PhantomJS\n  /* istanbul ignore next */\n  function tabVisible() {\n    function resize() {\n      sendTriggerMsg('Tab Visable', 'resize')\n    }\n\n    if ('hidden' !== document.visibilityState) {\n      log('document', 'Trigger event: Visiblity change')\n      debouce(resize, 16)\n    }\n  }\n\n  function sendTriggerMsg(eventName, event) {\n    function isIFrameResizeEnabled(iframeId) {\n      return (\n        settings[iframeId] &&\n        'parent' === settings[iframeId].resizeFrom &&\n        settings[iframeId].autoResize &&\n        !settings[iframeId].firstRun\n      )\n    }\n\n    Object.keys(settings).forEach(function (iframeId) {\n      if (isIFrameResizeEnabled(iframeId)) {\n        trigger(eventName, event, settings[iframeId].iframe, iframeId)\n      }\n    })\n  }\n\n  function setupEventListeners() {\n    addEventListener(window, 'message', iFrameListener)\n\n    addEventListener(window, 'resize', function () {\n      resizeIFrames('resize')\n    })\n\n    addEventListener(document, 'visibilitychange', tabVisible)\n\n    addEventListener(document, '-webkit-visibilitychange', tabVisible)\n  }\n\n  function factory() {\n    function init(options, element) {\n      function chkType() {\n        if (!element.tagName) {\n          throw new TypeError('Object is not a valid DOM element')\n        } else if ('IFRAME' !== element.tagName.toUpperCase()) {\n          throw new TypeError(\n            'Expected <IFRAME> tag, found <' + element.tagName + '>'\n          )\n        }\n      }\n\n      if (element) {\n        chkType()\n        setupIFrame(element, options)\n        iFrames.push(element)\n      }\n    }\n\n    function warnDeprecatedOptions(options) {\n      if (options && options.enablePublicMethods) {\n        warn(\n          'enablePublicMethods option has been removed, public methods are now always available in the iFrame'\n        )\n      }\n    }\n\n    var iFrames\n\n    setupRequestAnimationFrame()\n    setupEventListeners()\n\n    return function iFrameResizeF(options, target) {\n      iFrames = [] // Only return iFrames past in on this call\n\n      warnDeprecatedOptions(options)\n\n      switch (typeof target) {\n        case 'undefined':\n        case 'string':\n          Array.prototype.forEach.call(\n            document.querySelectorAll(target || 'iframe'),\n            init.bind(undefined, options)\n          )\n          break\n\n        case 'object':\n          init(options, target)\n          break\n\n        default:\n          throw new TypeError('Unexpected data type (' + typeof target + ')')\n      }\n\n      return iFrames\n    }\n  }\n\n  function createJQueryPublicMethod($) {\n    if (!$.fn) {\n      info('', 'Unable to bind to jQuery, it is not fully loaded.')\n    } else if (!$.fn.iFrameResize) {\n      $.fn.iFrameResize = function $iFrameResizeF(options) {\n        function init(index, element) {\n          setupIFrame(element, options)\n        }\n\n        return this.filter('iframe').each(init).end()\n      }\n    }\n  }\n\n  if (window.jQuery) {\n    createJQueryPublicMethod(window.jQuery)\n  }\n\n  if (typeof define === 'function' && define.amd) {\n    define([], factory)\n  } else if (typeof module === 'object' && typeof module.exports === 'object') {\n    // Node for browserfy\n    module.exports = factory()\n  }\n  window.iFrameResize = window.iFrameResize || factory()\n})()\n"]}