(function(n){"use strict";function b(n,t,i){"addEventListener"in window?n.addEventListener(t,i,!1):"attachEvent"in window&&n.attachEvent("on"+t,i)}function li(n,t,i){"removeEventListener"in window?n.removeEventListener(t,i,!1):"detachEvent"in window&&n.detachEvent("on"+t,i)}function ai(n){return n.charAt(0).toUpperCase()+n.slice(1)}function hr(n){var i,r,f,t=null,u=0,e=function(){u=k();t=null;f=n.apply(i,r);t||(i=r=null)};return function(){var s=k(),o;return u||(u=s),o=p-(s-u),i=this,r=arguments,o<=0||o>p?(t&&(clearTimeout(t),t=null),u=s,f=n.apply(i,r),t||(i=r=null)):t||(t=setTimeout(e,o)),f}}function vi(n){return nt+"["+tt+"] "+n}function t(n){st&&"object"==typeof console&&console.log(vi(n))}function s(n){"object"==typeof console&&console.warn(vi(n))}function cr(){lr();t("Initialising iFrame ("+location.href+")");ar();yr();wt("background",gt);wt("padding",ni);gr();wi();bi();pr();tu();ki();v=nu();l("init","Init message from host page");at()}function lr(){function i(n){return"true"===n?!0:!1}var t=ri.substr(fi).split(":");tt=t[0];ut=n!==t[1]?Number(t[1]):ut;g=n!==t[2]?i(t[2]):g;st=n!==t[3]?i(t[3]):st;c=n!==t[4]?Number(t[4]):c;e=n!==t[6]?i(t[6]):e;d=t[7];r=n!==t[8]?t[8]:r;gt=t[9];ni=t[10];ct=n!==t[11]?Number(t[11]):ct;v.enable=n!==t[12]?i(t[12]):!1;ht=n!==t[13]?t[13]:ht;u=n!==t[14]?t[14]:u}function ar(){function i(){var n=window.iFrameResizer;t("Reading data from page: "+JSON.stringify(n));lt="messageCallback"in n?n.messageCallback:lt;at="readyCallback"in n?n.readyCallback:at;y="targetOrigin"in n?n.targetOrigin:y;r="heightCalculationMethod"in n?n.heightCalculationMethod:r;u="widthCalculationMethod"in n?n.widthCalculationMethod:u}function n(n,i){return"function"==typeof n&&(t("Setup custom "+i+"CalcMethod"),yt[i]=n,n="custom"),n}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(i(),r=n(r,"height"),u=n(u,"width"));t("TargetOrigin for parent set to: "+y)}function vr(n,t){return-1!==t.indexOf("-")&&(s("Negative CSS value ignored for "+n),t=""),t}function wt(i,r){n!==r&&""!==r&&"null"!==r&&(document.body.style[i]=r,t("Body "+i+' set to "'+r+'"'))}function yr(){n===d&&(d=ut+"px");wt("margin",vr("margin",d))}function pr(){document.documentElement.style.height="";document.body.style.height="";t('HTML & body height set to "auto"')}function i(n){var i={add:function(t){function i(){l(n.eventName,n.eventType)}pt[t]=i;b(window,t,i)},remove:function(n){var t=pt[n];delete pt[n];li(window,n,t)}};n.eventNames&&Array.prototype.map?(n.eventName=n.eventNames[0],n.eventNames.map(i[n.method])):i[n.method](n.eventName);t(ai(n.method)+" event listener: "+n.eventType)}function yi(n){i({method:n,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]});i({method:n,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]});i({method:n,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]});i({method:n,eventType:"Input",eventName:"input"});i({method:n,eventType:"Mouse Up",eventName:"mouseup"});i({method:n,eventType:"Mouse Down",eventName:"mousedown"});i({method:n,eventType:"Orientation Change",eventName:"orientationchange"});i({method:n,eventType:"Print",eventName:["afterprint","beforeprint"]});i({method:n,eventType:"Ready State Change",eventName:"readystatechange"});i({method:n,eventType:"Touch Start",eventName:"touchstart"});i({method:n,eventType:"Touch End",eventName:"touchend"});i({method:n,eventType:"Touch Cancel",eventName:"touchcancel"});i({method:n,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]});i({method:n,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]});i({method:n,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]});"child"===ht&&i({method:n,eventType:"IFrame Resized",eventName:"resize"})}function pi(n,i,r,u){return i!==n&&(n in r||(s(n+" is not a valid option for "+u+"CalculationMethod."),n=i),t(u+' calculation method set to "'+n+'"')),n}function wi(){r=pi(r,ot,o,"height")}function bi(){u=pi(u,ci,h,"width")}function ki(){!0===e?(yi("add"),ru()):t("Auto Resize disabled")}function wr(){t("Disable outgoing messages");oi=!1}function br(){t("Remove event listener: Message");li(window,"message",er)}function kr(){null!==ft&&ft.disconnect()}function di(){yi("remove");kr();clearInterval(ui)}function dr(){wr();br();!0===e&&di()}function gr(){var n=document.createElement("div");n.style.clear="both";n.style.display="block";document.body.appendChild(n)}function nu(){function u(){return{x:window.pageXOffset!==n?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==n?window.pageYOffset:document.documentElement.scrollTop}}function e(n){var t=n.getBoundingClientRect(),i=u();return{x:parseInt(t.left,10)+parseInt(i.x,10),y:parseInt(t.top,10)+parseInt(i.y,10)}}function i(i){function s(n){var i=e(n);t("Moving to in page link (#"+r+") at x: "+i.x+" y: "+i.y);f(i.y,i.x,"scrollToOffset")}var r=i.split("#")[1]||i,u=decodeURIComponent(r),o=document.getElementById(u)||document.getElementsByName(u)[0];n!==o?s(o):(t("In page link (#"+r+") not found in iFrame, so sending to parent"),f(0,0,"inPageLink","#"+r))}function r(){""!==location.hash&&"#"!==location.hash&&i(location.href)}function o(){function n(n){function t(n){n.preventDefault();i(this.getAttribute("href"))}"#"!==n.getAttribute("href")&&b(n,"click",t)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),n)}function h(){b(window,"hashchange",r)}function c(){setTimeout(r,et)}function l(){Array.prototype.forEach&&document.querySelectorAll?(t("Setting up location.hash handlers"),o(),h(),c()):s("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return v.enable?l():t("In page linking not enabled"),{findTarget:i}}function tu(){t("Enable public methods");sr.parentIFrame={autoResize:function(n){return!0===n&&!1===e?(e=!0,ki()):!1===n&&!0===e&&(e=!1,di()),e},close:function(){f(0,0,"close");dr()},getId:function(){return tt},getPageInfo:function(n){"function"==typeof n?(vt=n,f(0,0,"pageInfo")):(vt=function(){},f(0,0,"pageInfoStop"))},moveToAnchor:function(n){v.findTarget(n)},reset:function(){fr("parentIFrame.reset")},scrollTo:function(n,t){f(t,n,"scrollTo")},scrollToOffset:function(n,t){f(t,n,"scrollToOffset")},sendMessage:function(n,t){f(0,0,"message",JSON.stringify(n),t)},setHeightCalculationMethod:function(n){r=n;wi()},setWidthCalculationMethod:function(n){u=n;bi()},setTargetOrigin:function(n){t("Set targetOrigin: "+n);y=n},size:function(n,t){var i=""+(n?n:"")+(t?","+t:"");l("size","parentIFrame.size("+i+")",n,t)}}}function gi(){0!==c&&(t("setInterval: "+c+"ms"),ui=setInterval(function(){l("interval","setInterval: "+c)},Math.abs(c)))}function iu(){function s(n){function i(n){!1===n.complete&&(t("Attach listeners to "+n.src),n.addEventListener("load",e,!1),n.addEventListener("error",o,!1),r.push(n))}n.type==="attributes"&&n.attributeName==="src"?i(n.target):n.type==="childList"&&Array.prototype.forEach.call(n.target.querySelectorAll("img"),i)}function h(n){r.splice(r.indexOf(n),1)}function u(n){t("Remove listeners from "+n.src);n.removeEventListener("load",e,!1);n.removeEventListener("error",o,!1);h(n)}function f(t,i,r){u(t.target);l(i,r+": "+t.target.src,n,n)}function e(n){f(n,"imageLoad","Image loaded")}function o(n){f(n,"imageLoadFailed","Image load failed")}function c(n){l("mutationObserver","mutationObserver: "+n[0].target+" "+n[0].type);n.forEach(s)}function a(){var n=document.querySelector("body");return i=new v(c),t("Create body MutationObserver"),i.observe(n,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),i}var r=[],v=window.MutationObserver||window.WebKitMutationObserver,i=a();return{disconnect:function(){"disconnect"in i&&(t("Disconnect body MutationObserver"),i.disconnect(),r.forEach(u))}}}function ru(){var n=0>c;window.MutationObserver||window.WebKitMutationObserver?n?gi():ft=iu():(t("MutationObserver not supported in this browser!"),gi())}function bt(n,t){function r(n){var i,r;return/^\d+(px)?$/i.test(n)?parseInt(n,dt):(i=t.style.left,r=t.runtimeStyle.left,t.runtimeStyle.left=t.currentStyle.left,t.style.left=n||0,n=t.style.pixelLeft,t.style.left=i,t.runtimeStyle.left=r,n)}var i=0;return t=t||document.body,"defaultView"in document&&"getComputedStyle"in document.defaultView?(i=document.defaultView.getComputedStyle(t,null),i=null!==i?i[n]:0):i=r(t.currentStyle[n]),parseInt(i,dt)}function uu(n){n>p/2&&(p=2*n,t("Event throttle increased to "+p+"ms"))}function kt(n,i){for(var o=i.length,f=0,e=0,s=ai(n),r=k(),u=0;u<o;u++)f=i[u].getBoundingClientRect()[n]+bt("margin"+s,i[u]),f>e&&(e=f);return r=k()-r,t("Parsed "+o+" HTML elements"),t("Element position calculated in "+r+"ms"),uu(r),e}function rt(n){return[n.bodyOffset(),n.bodyScroll(),n.documentElementOffset(),n.documentElementScroll()]}function nr(n,t){function r(){return s("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")}var i=document.querySelectorAll("["+t+"]");return 0===i.length&&r(),kt(n,i)}function tr(){return document.querySelectorAll("body *")}function fu(i,e,s,c){function p(){a=l;w=v;f(a,w,i)}function y(){function t(n,t){var i=Math.abs(n-t)<=ct;return!i}return l=n!==s?s:o[r](),v=n!==c?c:h[u](),t(a,l)||g&&t(w,v)}function b(){return!(i in{init:1,interval:1,size:1})}function k(){return r in ei||g&&u in ei}function d(){t("No change in size detected")}function nt(){b()&&k()&&y?fr(e):i in{interval:1}||d()}var l,v;y()||"init"===i?(rr(),p()):nt()}function l(n,i,r,u){function f(){n in{reset:1,resetPage:1,init:1}||t("Trigger event: "+i)}function e(){return it&&n in or}e()?t("Trigger event cancelled: "+n):(f(),ir(n,i,r,u))}function rr(){it||(it=!0,t("Trigger event lock on"));clearTimeout(hi);hi=setTimeout(function(){it=!1;t("Trigger event lock off");t("--")},et)}function ur(n){a=o[r]();w=h[u]();f(a,w,n)}function fr(n){var i=r;r=ot;t("Reset trigger event: "+n);rr();ur("reset");r=i}function f(i,r,u,f,e){function o(){n===e?e=y:t("Message targetOrigin: "+e)}function s(){var s=i+":"+r,o=tt+":"+s+":"+u+(n!==f?":"+f:"");t("Sending message to host page ("+o+")");si.postMessage(nt+o,e)}!0===oi&&(o(),s())}function er(n){function e(){return nt===(""+n.data).substr(0,fi)}function u(){return n.data.split("]")[1].split(":")[0]}function r(){return n.data.substr(n.data.indexOf(":")+1)}function o(){return!(typeof module!="undefined"&&module.exports)&&"iFrameResize"in window}function f(){return n.data.split(":")[2]in{"true":1,"false":1}}function h(){var t=u();t in i?i[t]():o()||f()||s("Unexpected message ("+n.data+")")}function c(){!1===ti?h():f()?i.init():t('Ignored message of type "'+u()+'". Received before initialization.')}var i={init:function(){function r(){ri=n.data;si=n.source;cr();ti=!1;setTimeout(function(){ii=!1},et)}document.body?r():(t("Waiting for page ready"),b(window,"readystatechange",i.initFromParent))},reset:function(){ii?t("Page reset ignored by init"):(t("Page size reset by host page"),ur("resetPage"))},resize:function(){l("resizeParent","Parent window requested size check")},moveToAnchor:function(){v.findTarget(r())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var n=r();t("PageInfoFromParent called from parent: "+n);vt(JSON.parse(n));t(" --")},message:function(){var n=r();t("MessageCallback called from parent: "+n);lt(JSON.parse(n));t(" --")}};e()&&c()}function eu(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}var k,o,h,ir;if(typeof window!="undefined"){var e=!1,dt=10,gt="",ut=0,d="",ft=null,ni="",g=!1,or={resize:1,click:1},et=128,ti=!0,a=0,ot="taggedElement",r=ot,ii=!0,ri="",v={},c=32,ui=null,st=!1,nt="[iFrameSizer]",fi=nt.length,tt="",ei={max:1,min:1,bodyScroll:1,documentElementScroll:1},ht="child",oi=!0,si=window.parent,y="*",ct=0,it=!1,hi=null,p=16,w=1,ci="scroll",u=ci,sr=window,lt=function(){s("MessageCallback function not defined")},at=function(){},vt=function(){},yt={height:function(){return s("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return s("Custom width calculation function not defined"),document.body.scrollWidth}},pt={};k=Date.now||function(){return(new Date).getTime()};o={bodyOffset:function(){return document.body.offsetHeight+bt("marginTop")+bt("marginBottom")},offset:function(){return o.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return yt.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,rt(o))},min:function(){return Math.min.apply(null,rt(o))},grow:function(){return o.max()},lowestElement:function(){return Math.max(o.bodyOffset(),kt("bottom",tr()))},taggedElement:function(){return nr("bottom","data-iframe-height")}};h={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return yt.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(h.bodyScroll(),h.documentElementScroll())},max:function(){return Math.max.apply(null,rt(h))},min:function(){return Math.min.apply(null,rt(h))},rightMostElement:function(){return kt("right",tr())},taggedElement:function(){return nr("right","data-iframe-width")}};ir=hr(fu);b(window,"message",er);eu()}})()