-
Notifications
You must be signed in to change notification settings - Fork 14
/
webtor_min.js
1 lines (1 loc) · 29.5 KB
/
webtor_min.js
1
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e.exports=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}},function(e,t,n){e.exports=n(5)},function(e,t,n){const o=n(6);t.iframeResize=o,t.iframeResizer=o,t.iframeResizerContentWindow=n(7)},function(e,t,n){var o,i,r;!function(n){if("undefined"!=typeof window){var a,c=0,u=!1,s=!1,d="message".length,l="[iFrameSizer]",f=l.length,m=null,g=window.requestAnimationFrame,h={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},p={},w=null,y={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){S("onMessage function not defined")},onResized:function(){},onScroll:function(){return!0}},b={};window.jQuery&&((a=window.jQuery).fn?a.fn.iFrameResize||(a.fn.iFrameResize=function(e){return this.filter("iframe").each((function(t,n){B(n,e)})).end()}):I("","Unable to bind to jQuery, it is not fully loaded.")),i=[],void 0===(r="function"==typeof(o=_)?o.apply(t,i):o)||(e.exports=r),window.iFrameResize=window.iFrameResize||_()}function v(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function x(e,t,n){e.addEventListener(t,n,!1)}function T(e,t,n){e.removeEventListener(t,n,!1)}function O(e){return l+"["+function(e){var t="Host page: "+e;return window.top!==window.self&&(t=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e),t}(e)+"]"}function E(e){return p[e]?p[e].log:u}function M(e,t){R("log",e,t,E(e))}function I(e,t){R("info",e,t,E(e))}function S(e,t){R("warn",e,t,!0)}function R(e,t,n,o){!0===o&&"object"==typeof window.console&&console[e](O(t),n)}function z(e){function t(){i("Height"),i("Width"),L((function(){W(z),A(N),g("onResized",z)}),z,"init")}function n(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function o(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}function i(e){var t=Number(p[N]["max"+e]),n=Number(p[N]["min"+e]),o=e.toLowerCase(),i=Number(z[o]);M(N,"Checking "+o+" is in range "+n+"-"+t),i<n&&(i=n,M(N,"Set "+o+" to min value")),i>t&&(i=t,M(N,"Set "+o+" to max value")),z[o]=""+i}function r(e){return R.substr(R.indexOf(":")+d+e)}function a(e,t){var n,o,i;n=function(){var n,o;H("Send Page Info","pageInfo:"+(n=document.body.getBoundingClientRect(),o=z.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:o.height,iframeWidth:o.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(o.top-n.top,10),offsetLeft:parseInt(o.left-n.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,t)},o=32,b[i=t]||(b[i]=setTimeout((function(){b[i]=null,n()}),o))}function c(e){var t=e.getBoundingClientRect();return C(N),{x:Math.floor(Number(t.left)+Number(m.x)),y:Math.floor(Number(t.top)+Number(m.y))}}function u(e){var t=e?c(z.iframe):{x:0,y:0},n={x:Number(z.width)+t.x,y:Number(z.height)+t.y};M(N,"Reposition requested from iFrame (offset x:"+t.x+" y:"+t.y+")"),window.top!==window.self?window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](n.x,n.y):S(N,"Unable to scroll to requested position, window.parentIFrame not found"):(m=n,s(),M(N,"--"))}function s(){!1!==g("onScroll",m)?A(N):j()}function g(e,t){return k(N,e,t)}var h,w,y,v,O,E,R=e.data,z={},N=null;"[iFrameResizerChild]Ready"===R?function(){for(var e in p)H("iFrame requested init",U(e),p[e].iframe,e)}():l===(""+R).substr(0,f)&&R.substr(f).split(":")[0]in p?(y=R.substr(f).split(":"),v=y[1]?parseInt(y[1],10):0,O=p[y[0]]&&p[y[0]].iframe,E=getComputedStyle(O),z={iframe:O,id:y[0],height:v+n(E)+o(E),width:y[2],type:y[3]},N=z.id,p[N]&&(p[N].loaded=!0),(w=z.type in{true:1,false:1,undefined:1})&&M(N,"Ignoring init message from meta parent page"),!w&&function(e){var t=!0;return p[e]||(t=!1,S(z.type+" No settings for "+e+". Message was: "+R)),t}(N)&&(M(N,"Received: "+R),h=!0,null===z.iframe&&(S(N,"IFrame ("+z.id+") not found"),h=!1),h&&function(){var t,n=e.origin,o=p[N]&&p[N].checkOrigin;if(o&&""+n!="null"&&!(o.constructor===Array?function(){var e=0,t=!1;for(M(N,"Checking connection is from allowed list of origins: "+o);e<o.length;e++)if(o[e]===n){t=!0;break}return t}():(t=p[N]&&p[N].remoteHost,M(N,"Checking connection is from: "+t),n===t)))throw new Error("Unexpected message received from: "+n+" for "+z.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(p[N]&&p[N].firstRun&&p[N]&&(p[N].firstRun=!1),z.type){case"close":F(z.iframe);break;case"message":e=r(6),M(N,"onMessage passed: {iframe: "+z.iframe.id+", message: "+e+"}"),g("onMessage",{iframe:z.iframe,message:JSON.parse(e)}),M(N,"--");break;case"autoResize":p[N].autoResize=JSON.parse(r(9));break;case"scrollTo":u(!1);break;case"scrollToOffset":u(!0);break;case"pageInfo":a(p[N]&&p[N].iframe,N),function(){function e(e,o){function i(){p[n]?a(p[n].iframe,n):t()}["scroll","resize"].forEach((function(t){M(n,e+t+" listener for sendPageInfo"),o(window,t,i)}))}function t(){e("Remove ",T)}var n=N;e("Add ",x),p[n]&&(p[n].stopPageInfo=t)}();break;case"pageInfoStop":p[N]&&p[N].stopPageInfo&&(p[N].stopPageInfo(),delete p[N].stopPageInfo);break;case"inPageLink":!function(e){var t,n=e.split("#")[1]||"",o=decodeURIComponent(n),i=document.getElementById(o)||document.getElementsByName(o)[0];i?(t=c(i),M(N,"Moving to in page link (#"+n+") at x: "+t.x+" y: "+t.y),m={x:t.x,y:t.y},s(),M(N,"--")):window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(n):M(N,"In page link #"+n+" not found and window.parentIFrame not found"):M(N,"In page link #"+n+" not found")}(r(9));break;case"reset":P(z);break;case"init":t(),g("onInit",z.iframe);break;default:t()}var e}())):I(N,"Ignored: "+R)}function k(e,t,n){var o=null,i=null;if(p[e]){if("function"!=typeof(o=p[e][t]))throw new TypeError(t+" on iFrame["+e+"] is not a function");i=o(n)}return i}function N(e){var t=e.id;delete p[t]}function F(e){var t=e.id;if(!1!==k(t,"onClose",t)){M(t,"Removing iFrame: "+t);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){S(e)}k(t,"onClosed",t),M(t,"--"),N(e)}else M(t,"Close iframe cancelled by onClose event")}function C(e){null===m&&M(e,"Get page position: "+(m={x:void 0!==window.pageXOffset?window.pageXOffset:document.documentElement.scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:document.documentElement.scrollTop}).x+","+m.y)}function A(e){null!==m&&(window.scrollTo(m.x,m.y),M(e,"Set page position: "+m.x+","+m.y),j())}function j(){m=null}function P(e){M(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),C(e.id),L((function(){W(e),H("reset","reset",e.iframe,e.id)}),e,"reset")}function W(e){function t(t){s||"0"!==e[t]||(s=!0,M(o,"Hidden iFrame detected, creating visibility listener"),function(){function e(){Object.keys(p).forEach((function(e){!function(e){function t(t){return"0px"===(p[e]&&p[e].iframe.style[t])}p[e]&&null!==p[e].iframe.offsetParent&&(t("height")||t("width"))&&H("Visibility change","resize",p[e].iframe,e)}(e)}))}function t(t){M("window","Mutation observed: "+t[0].target+" "+t[0].type),q(e,16)}var n=v();n&&(o=document.querySelector("body"),new n(t).observe(o,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}));var o}())}function n(n){!function(t){e.id?(e.iframe.style[t]=e[t]+"px",M(e.id,"IFrame ("+o+") "+t+" set to "+e[t]+"px")):M("undefined","messageData id not set")}(n),t(n)}var o=e.iframe.id;p[o]&&(p[o].sizeHeight&&n("height"),p[o].sizeWidth&&n("width"))}function L(e,t,n){n!==t.type&&g&&!window.jasmine?(M(t.id,"Requesting animation frame"),g(e)):e()}function H(e,t,n,o,i){var r,a=!1;o=o||n.id,p[o]&&(n&&"contentWindow"in n&&null!==n.contentWindow?(r=p[o]&&p[o].targetOrigin,M(o,"["+e+"] Sending msg to iframe["+o+"] ("+t+") targetOrigin: "+r),n.contentWindow.postMessage(l+t,r)):S(o,"["+e+"] IFrame("+o+") not found"),i&&p[o]&&p[o].warningTimeout&&(p[o].msgTimeout=setTimeout((function(){!p[o]||p[o].loaded||a||(a=!0,S(o,"IFrame has not responded within "+p[o].warningTimeout/1e3+" 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."))}),p[o].warningTimeout)))}function U(e){return e+":"+p[e].bodyMarginV1+":"+p[e].sizeWidth+":"+p[e].log+":"+p[e].interval+":"+p[e].enablePublicMethods+":"+p[e].autoResize+":"+p[e].bodyMargin+":"+p[e].heightCalculationMethod+":"+p[e].bodyBackground+":"+p[e].bodyPadding+":"+p[e].tolerance+":"+p[e].inPageLinks+":"+p[e].resizeFrom+":"+p[e].widthCalculationMethod}function B(e,t){function n(e){var t=e.split("Callback");if(2===t.length){var n="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1);this[n]=this[e],delete this[e],S(r,"Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version.")}}var o,i,r=function(n){var o;return""===n&&(e.id=(o=t&&t.id||y.id+c++,null!==document.getElementById(o)&&(o+=c++),n=o),u=(t||{}).log,M(n,"Added missing iframe ID: "+n+" ("+e.src+")")),n}(e.id);r in p&&"iFrameResizer"in e?S(r,"Ignored iFrame, already setup."):(!function(t){var o;t=t||{},p[r]={firstRun:!0,iframe:e,remoteHost:e.src&&e.src.split("/").slice(0,3).join("/")},function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(t),Object.keys(t).forEach(n,t),function(e){for(var t in y)Object.prototype.hasOwnProperty.call(y,t)&&(p[r][t]=Object.prototype.hasOwnProperty.call(e,t)?e[t]:y[t])}(t),p[r]&&(p[r].targetOrigin=!0===p[r].checkOrigin?""===(o=p[r].remoteHost)||null!==o.match(/^(about:blank|javascript:|file:\/\/)/)?"*":o:"*")}(t),function(){switch(M(r,"IFrame scrolling "+(p[r]&&p[r].scrolling?"enabled":"disabled")+" for "+r),e.style.overflow=!1===(p[r]&&p[r].scrolling)?"hidden":"auto",p[r]&&p[r].scrolling){case"omit":break;case!0:e.scrolling="yes";break;case!1:e.scrolling="no";break;default:e.scrolling=p[r]?p[r].scrolling:"no"}}(),function(){function t(t){1/0!==p[r][t]&&0!==p[r][t]&&(e.style[t]=p[r][t]+"px",M(r,"Set "+t+" = "+p[r][t]+"px"))}function n(e){if(p[r]["min"+e]>p[r]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}n("Height"),n("Width"),t("maxHeight"),t("minHeight"),t("maxWidth"),t("minWidth")}(),"number"!=typeof(p[r]&&p[r].bodyMargin)&&"0"!==(p[r]&&p[r].bodyMargin)||(p[r].bodyMarginV1=p[r].bodyMargin,p[r].bodyMargin=p[r].bodyMargin+"px"),o=U(r),(i=v())&&function(t){e.parentNode&&new t((function(t){t.forEach((function(t){Array.prototype.slice.call(t.removedNodes).forEach((function(t){t===e&&F(e)}))}))})).observe(e.parentNode,{childList:!0})}(i),x(e,"load",(function(){var t,n;H("iFrame.onload",o,e,void 0,!0),t=p[r]&&p[r].firstRun,n=p[r]&&p[r].heightCalculationMethod in h,!t&&n&&P({iframe:e,height:0,width:0,type:"init"})})),H("init",o,e,void 0,!0),p[r]&&(p[r].iframe.iFrameResizer={close:F.bind(null,p[r].iframe),removeListeners:N.bind(null,p[r].iframe),resize:H.bind(null,"Window resize","resize",p[r].iframe),moveToAnchor:function(e){H("Move to anchor","moveToAnchor:"+e,p[r].iframe,r)},sendMessage:function(e){H("Send Message","message:"+(e=JSON.stringify(e)),p[r].iframe,r)}}))}function q(e,t){null===w&&(w=setTimeout((function(){w=null,e()}),t))}function D(){"hidden"!==document.visibilityState&&(M("document","Trigger event: Visiblity change"),q((function(){V("Tab Visable","resize")}),16))}function V(e,t){Object.keys(p).forEach((function(n){(function(e){return p[e]&&"parent"===p[e].resizeFrom&&p[e].autoResize&&!p[e].firstRun})(n)&&H(e,t,p[n].iframe,n)}))}function J(){x(window,"message",z),x(window,"resize",(function(){var e;M("window","Trigger event: "+(e="resize")),q((function(){V("Window "+e,"resize")}),16)})),x(document,"visibilitychange",D),x(document,"-webkit-visibilitychange",D)}function _(){function e(e,n){n&&(!function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">")}(),B(n,e),t.push(n))}var t;return function(){var e,t=["moz","webkit","o","ms"];for(e=0;e<t.length&&!g;e+=1)g=window[t[e]+"RequestAnimationFrame"];g?g=g.bind(window):M("setup","RequestAnimationFrame not supported")}(),J(),function(n,o){switch(t=[],function(e){e&&e.enablePublicMethods&&S("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(n),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),e.bind(void 0,n));break;case"object":e(n,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return t}}}()},function(e,t,n){!function(t){if("undefined"!=typeof window){var n=!0,o="",i=0,r="",a=null,c="",u=!1,s={resize:1,click:1},d=!0,l=1,f="bodyOffset",m=!0,g="",h={},p=32,w=null,y=!1,b="[iFrameSizer]",v=b.length,x="",T={max:1,min:1,bodyScroll:1,documentElementScroll:1},O="child",E=window.parent,M="*",I=0,S=!1,R=null,z=16,k=1,N="scroll",F=window,C=function(){ne("onMessage function not defined")},A=function(){},j=function(){},P={height:function(){return ne("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return ne("Custom width calculation function not defined"),document.body.scrollWidth}},W={},L=!1;try{var H=Object.create({},{passive:{get:function(){L=!0}}});window.addEventListener("test",G,H),window.removeEventListener("test",G,H)}catch(e){}var U,B,q,D,V,J,_,Q=Date.now||function(){return(new Date).getTime()},X={bodyOffset:function(){return document.body.offsetHeight+me("marginTop")+me("marginBottom")},offset:function(){return X.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return P.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,he(X))},min:function(){return Math.min.apply(null,he(X))},grow:function(){return X.max()},lowestElement:function(){return Math.max(X.bodyOffset()||X.documentElementOffset(),ge("bottom",we()))},taggedElement:function(){return pe("bottom","data-iframe-height")}},Y={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return P.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(Y.bodyScroll(),Y.documentElementScroll())},max:function(){return Math.max.apply(null,he(Y))},min:function(){return Math.min.apply(null,he(Y))},rightMostElement:function(){return ge("right",we())},taggedElement:function(){return pe("right","data-iframe-width")}},K=(U=ye,V=null,J=0,_=function(){J=Q(),V=null,D=U.apply(B,q),V||(B=q=null)},function(){var e=Q();J||(J=e);var t=z-(e-J);return B=this,q=arguments,t<=0||t>z?(V&&(clearTimeout(V),V=null),J=e,D=U.apply(B,q),V||(B=q=null)):V||(V=setTimeout(_,t)),D});Z(window,"message",(function(t){var n={init:function(){g=t.data,E=t.source,oe(),d=!1,setTimeout((function(){m=!1}),128)},reset:function(){m?te("Page reset ignored by init"):(te("Page size reset by host page"),xe("resetPage"))},resize:function(){be("resizeParent","Parent window requested size check")},moveToAnchor:function(){h.findTarget(i())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var e=i();te("PageInfoFromParent called from parent: "+e),j(JSON.parse(e)),te(" --")},message:function(){var e=i();te("onMessage called from parent: "+e),C(JSON.parse(e)),te(" --")}};function o(){return t.data.split("]")[1].split(":")[0]}function i(){return t.data.substr(t.data.indexOf(":")+1)}function r(){return t.data.split(":")[2]in{true:1,false:1}}function a(){var i=o();i in n?n[i]():!e.exports&&"iFrameResize"in window||"jQuery"in window&&"iFrameResize"in window.jQuery.prototype||r()||ne("Unexpected message ("+t.data+")")}b===(""+t.data).substr(0,v)&&(!1===d?a():r()?n.init():te('Ignored message of type "'+o()+'". Received before initialization.'))})),Z(window,"readystatechange",Ee),Ee()}function G(){}function Z(e,t,n,o){e.addEventListener(t,n,!!L&&(o||{}))}function $(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ee(e){return b+"["+x+"] "+e}function te(e){y&&"object"==typeof window.console&&console.log(ee(e))}function ne(e){"object"==typeof window.console&&console.warn(ee(e))}function oe(){var e;!function(){function e(e){return"true"===e}var t=g.substr(v).split(":");x=t[0],i=void 0!==t[1]?Number(t[1]):i,u=void 0!==t[2]?e(t[2]):u,y=void 0!==t[3]?e(t[3]):y,p=void 0!==t[4]?Number(t[4]):p,n=void 0!==t[6]?e(t[6]):n,r=t[7],f=void 0!==t[8]?t[8]:f,o=t[9],c=t[10],I=void 0!==t[11]?Number(t[11]):I,h.enable=void 0!==t[12]&&e(t[12]),O=void 0!==t[13]?t[13]:O,N=void 0!==t[14]?t[14]:N}(),te("Initialising iFrame ("+location.href+")"),function(){function e(e,t){return"function"==typeof e&&(te("Setup custom "+t+"CalcMethod"),P[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(t=window.iFrameResizer,te("Reading data from page: "+JSON.stringify(t)),Object.keys(t).forEach(ie,t),C="onMessage"in t?t.onMessage:C,A="onReady"in t?t.onReady:A,M="targetOrigin"in t?t.targetOrigin:M,f="heightCalculationMethod"in t?t.heightCalculationMethod:f,N="widthCalculationMethod"in t?t.widthCalculationMethod:N,f=e(f,"height"),N=e(N,"width"));var t;te("TargetOrigin for parent set to: "+M)}(),function(){void 0===r&&(r=i+"px");re("margin",function(e,t){-1!==t.indexOf("-")&&(ne("Negative CSS value ignored for "+e),t="");return t}("margin",r))}(),re("background",o),re("padding",c),(e=document.createElement("div")).style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e),se(),de(),document.documentElement.style.height="",document.body.style.height="",te('HTML & body height set to "auto"'),te("Enable public methods"),F.parentIFrame={autoResize:function(e){return!0===e&&!1===n?(n=!0,le()):!1===e&&!0===n&&(n=!1,ce("remove"),null!==a&&a.disconnect(),clearInterval(w)),Oe(0,0,"autoResize",JSON.stringify(n)),n},close:function(){Oe(0,0,"close")},getId:function(){return x},getPageInfo:function(e){"function"==typeof e?(j=e,Oe(0,0,"pageInfo")):(j=function(){},Oe(0,0,"pageInfoStop"))},moveToAnchor:function(e){h.findTarget(e)},reset:function(){Te("parentIFrame.reset")},scrollTo:function(e,t){Oe(t,e,"scrollTo")},scrollToOffset:function(e,t){Oe(t,e,"scrollToOffset")},sendMessage:function(e,t){Oe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){f=e,se()},setWidthCalculationMethod:function(e){N=e,de()},setTargetOrigin:function(e){te("Set targetOrigin: "+e),M=e},size:function(e,t){be("size","parentIFrame.size("+(e||"")+(t?","+t:"")+")",e,t)}},le(),h=function(){function e(e){var t=e.getBoundingClientRect(),n={x:void 0!==window.pageXOffset?window.pageXOffset:document.documentElement.scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:document.documentElement.scrollTop};return{x:parseInt(t.left,10)+parseInt(n.x,10),y:parseInt(t.top,10)+parseInt(n.y,10)}}function t(t){var n=t.split("#")[1]||t,o=decodeURIComponent(n),i=document.getElementById(o)||document.getElementsByName(o)[0];void 0!==i?function(t){var o=e(t);te("Moving to in page link (#"+n+") at x: "+o.x+" y: "+o.y),Oe(o.y,o.x,"scrollToOffset")}(i):(te("In page link (#"+n+") not found in iFrame, so sending to parent"),Oe(0,0,"inPageLink","#"+n))}function n(){""!==location.hash&&"#"!==location.hash&&t(location.href)}h.enable?Array.prototype.forEach&&document.querySelectorAll?(te("Setting up location.hash handlers"),Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),(function(e){"#"!==e.getAttribute("href")&&Z(e,"click",(function(e){e.preventDefault(),t(this.getAttribute("href"))}))})),Z(window,"hashchange",n),setTimeout(n,128)):ne("In page linking not fully supported in this browser! (See README.md for IE8 workaround)"):te("In page linking not enabled");return{findTarget:t}}(),be("init","Init message from host page"),A()}function ie(e){var t=e.split("Callback");if(2===t.length){var n="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1);this[n]=this[e],delete this[e],ne("Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version.")}}function re(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style[e]=t,te("Body "+e+' set to "'+t+'"'))}function ae(e){var t={add:function(t){function n(){be(e.eventName,e.eventType)}W[t]=n,Z(window,t,n,{passive:!0})},remove:function(e){var t,n,o,i=W[e];delete W[e],t=window,n=e,o=i,t.removeEventListener(n,o,!1)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),te($(e.method)+" event listener: "+e.eventType)}function ce(e){ae({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),ae({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),ae({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),ae({method:e,eventType:"Input",eventName:"input"}),ae({method:e,eventType:"Mouse Up",eventName:"mouseup"}),ae({method:e,eventType:"Mouse Down",eventName:"mousedown"}),ae({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),ae({method:e,eventType:"Print",eventName:["afterprint","beforeprint"]}),ae({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),ae({method:e,eventType:"Touch Start",eventName:"touchstart"}),ae({method:e,eventType:"Touch End",eventName:"touchend"}),ae({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),ae({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),ae({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),ae({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===O&&ae({method:e,eventType:"IFrame Resized",eventName:"resize"})}function ue(e,t,n,o){return t!==e&&(e in n||(ne(e+" is not a valid option for "+o+"CalculationMethod."),e=t),te(o+' calculation method set to "'+e+'"')),e}function se(){f=ue(f,"bodyOffset",X,"height")}function de(){N=ue(N,"scroll",Y,"width")}function le(){var e;!0===n?(ce("add"),e=0>p,window.MutationObserver||window.WebKitMutationObserver?e?fe():a=function(){function e(e){function t(e){!1===e.complete&&(te("Attach listeners to "+e.src),e.addEventListener("load",o,!1),e.addEventListener("error",i,!1),a.push(e))}"attributes"===e.type&&"src"===e.attributeName?t(e.target):"childList"===e.type&&Array.prototype.forEach.call(e.target.querySelectorAll("img"),t)}function t(e){te("Remove listeners from "+e.src),e.removeEventListener("load",o,!1),e.removeEventListener("error",i,!1),function(e){a.splice(a.indexOf(e),1)}(e)}function n(e,n,o){t(e.target),be(n,o+": "+e.target.src,void 0,void 0)}function o(e){n(e,"imageLoad","Image loaded")}function i(e){n(e,"imageLoadFailed","Image load failed")}function r(t){be("mutationObserver","mutationObserver: "+t[0].target+" "+t[0].type),t.forEach(e)}var a=[],c=window.MutationObserver||window.WebKitMutationObserver,u=function(){var e=document.querySelector("body");return u=new c(r),te("Create body MutationObserver"),u.observe(e,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),u}();return{disconnect:function(){"disconnect"in u&&(te("Disconnect body MutationObserver"),u.disconnect(),a.forEach(t))}}}():(te("MutationObserver not supported in this browser!"),fe())):te("Auto Resize disabled")}function fe(){0!==p&&(te("setInterval: "+p+"ms"),w=setInterval((function(){be("interval","setInterval: "+p)}),Math.abs(p)))}function me(e,t){var n=0;return t=t||document.body,n=null!==(n=document.defaultView.getComputedStyle(t,null))?n[e]:0,parseInt(n,10)}function ge(e,t){for(var n=t.length,o=0,i=0,r=$(e),a=Q(),c=0;c<n;c++)(o=t[c].getBoundingClientRect()[e]+me("margin"+r,t[c]))>i&&(i=o);return a=Q()-a,te("Parsed "+n+" HTML elements"),te("Element position calculated in "+a+"ms"),function(e){e>z/2&&te("Event throttle increased to "+(z=2*e)+"ms")}(a),i}function he(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function pe(e,t){var n=document.querySelectorAll("["+t+"]");return 0===n.length&&(ne("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")),ge(e,n)}function we(){return document.querySelectorAll("body *")}function ye(e,t,n,o){var i,r;!function(){function e(e,t){return!(Math.abs(e-t)<=I)}return i=void 0!==n?n:X[f](),r=void 0!==o?o:Y[N](),e(l,i)||u&&e(k,r)}()&&"init"!==e?e in{init:1,interval:1,size:1}||!(f in T||u&&N in T)?e in{interval:1}||te("No change in size detected"):Te(t):(ve(),Oe(l=i,k=r,e))}function be(e,t,n,o){S&&e in s?te("Trigger event cancelled: "+e):(e in{reset:1,resetPage:1,init:1}||te("Trigger event: "+t),"init"===e?ye(e,t,n,o):K(e,t,n,o))}function ve(){S||(S=!0,te("Trigger event lock on")),clearTimeout(R),R=setTimeout((function(){S=!1,te("Trigger event lock off"),te("--")}),128)}function xe(e){l=X[f](),k=Y[N](),Oe(l,k,e)}function Te(e){var t=f;f="bodyOffset",te("Reset trigger event: "+e),ve(),xe("reset"),f=t}function Oe(e,t,n,o,i){var r;void 0===i?i=M:te("Message targetOrigin: "+i),te("Sending message to host page ("+(r=x+":"+e+":"+t+":"+n+(void 0!==o?":"+o:""))+")"),E.postMessage(b+r,i)}function Ee(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}}()},function(e,t,n){"use strict";n.r(t);var o=n(1),i=n.n(o),r=n(2),a=n.n(r),c=n(3),u=n.n(c),s=n(0),d=n.n(s),l=n(4),f={baseUrl:"https://webtor.io",width:"800px",mode:"video",subtitles:[],poster:null},m=function(){function e(){a()(this,e),d()(this,"TORRENT_FETCHED","torrent fetched"),d()(this,"TORRENT_ERROR","torrent error"),d()(this,"INIT","init")}return u()(e,[{key:"push",value:function(e){var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),n="webtor-".concat(t);e=Object.assign(f,e);var o=document.getElementById(e.id);if(!o)throw'Failed to find element with id "'.concat(e.id,'"');if(e.torrentUrl&&e.magnet)throw"There should be only one magnet or torrentUrl";if(!e.torrentUrl&&!e.magnet)throw"magnet or torrentUrl required";var r={id:t,mode:e.mode,theme:e.theme};Object.keys(r).forEach((function(e){return void 0===r[e]?delete r[e]:{}}));var a=new URLSearchParams(r),c="".concat(e.baseUrl,"/show?").concat(a.toString()),u=document.createElement("iframe");u.id=n,u.width=e.width,u.setAttribute("allowFullScreen",""),u.setAttribute("webkitAllowFullScreen",""),u.setAttribute("mozAllowFullScreen",""),u.scrolling="no",u.frameBorder="0",u.onload=function(){Object(l.iframeResize)({heightCalculationMethod:"taggedElement",checkOrigin:!1},"#".concat(n))},u.allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",o.appendChild(u),u.src=c;var s=this;window.addEventListener("message",(function(n){var o=n.data;"object"===i()(o)&&o.id==t&&"function"==typeof e.on&&(o.name==s.INIT&&u.contentWindow.postMessage({id:t,name:"init",data:{magnet:e.magnet,torrentUrl:e.torrentUrl,subtitles:e.subtitles,poster:e.poster}},"*"),e.on(o))}))}}]),e}();window.webtor=function(e){if(e){if(Array.isArray(e)){var t=new m,n=!0,o=!1,i=void 0;try{for(var r,a=e[Symbol.iterator]();!(n=(r=a.next()).done);n=!0){var c=r.value;t.push(c)}}catch(e){o=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return t}return e}return new m}(window.webtor)}]);