(function framework7ComponentLoader(e,t){void 0===t&&(t=!0);var a=document,c=window,p=e.$,u=(e.Template7,e.utils),v=e.device,o=(e.support,e.Class),i=(e.Modal,e.ConstructorMethods,e.ModalMethods,function(s){function e(i,e){void 0===e&&(e={}),s.call(this,e,[i]);var t,n=this;if(!c.vi)throw new Error("Framework7: vi SDK not found.");void 0!==c.orientation&&(t=-90===c.orientation||90===c.orientation?"horizontal":"vertical");var a=u.extend({},i.params.vi,{appId:i.id,appVer:i.version,language:i.language,width:i.width,height:i.height,os:v.os,osVersion:v.osVersion,orientation:t});n.useModulesParams(a),n.params=u.extend(a,e);var o={},r="on autoplay fallbackOverlay fallbackOverlayText enabled".split(" ");if(Object.keys(n.params).forEach(function(e){if(!(0<=r.indexOf(e))){var t=n.params[e];0<=[null,void 0].indexOf(t)||(o[e]=t)}}),!n.params.appId)throw new Error('Framework7: "app.id" is required to display an ad. Make sure you have specified it on app initialization.');if(!n.params.placementId)throw new Error('Framework7: "placementId" is required to display an ad.');function l(){var e=p("iframe#viAd");0!==e.length&&e.css({width:i.width+"px",height:i.height+"px"})}function d(){n.$overlayEl&&(n.$overlayEl.off("click touchstart"),n.$overlayEl.remove())}n.ad=new c.vi.Ad(o),u.extend(n.ad,{onAdReady:function(){i.on("resize",l),n.emit("local::ready"),n.params.autoplay&&n.start()},onAdStarted:function(){n.emit("local::started")},onAdClick:function(e){n.emit("local::click",e)},onAdImpression:function(){n.emit("local::impression")},onAdStopped:function(e){i.off("resize",l),d(),n.emit("local::stopped",e),"complete"===e&&(n.emit("local::complete"),n.emit("local::completed")),"userexit"===e&&n.emit("local::userexit"),n.destroyed=!0},onAutoPlayFailed:function(e,t){var a,o;n.emit("local::autoplayFailed",e,t),e&&e.name&&-1!==e.name.indexOf("NotAllowedError")&&n.params.fallbackOverlay&&(a=t)&&(n.$overlayEl=p(('\n        <div class="vi-overlay no-fastclick">\n          '+(n.params.fallbackOverlayText?'<div class="vi-overlay-text">'+n.params.fallbackOverlayText+"</div>":"")+'\n          <div class="vi-overlay-play-button"></div>\n        </div>\n      ').trim()),n.$overlayEl.on("touchstart",function(){o=u.now()}),n.$overlayEl.on("click",function(){if(!(300<u.now()-o)){if(a)return a.play(),void d();n.start(),d()}}),i.root.append(n.$overlayEl))},onAdError:function(e){d(),i.off("resize",l),n.emit("local::error",e),n.destroyed=!0}}),n.init(),u.extend(n,{app:i})}return s&&(e.__proto__=s),((e.prototype=Object.create(s&&s.prototype)).constructor=e).prototype.start=function(){var e=this;e.destroyed||e.ad&&e.ad.startAd()},e.prototype.pause=function(){var e=this;e.destroyed||e.ad&&e.ad.pauseAd()},e.prototype.resume=function(){var e=this;e.destroyed||e.ad&&e.ad.resumeAd()},e.prototype.stop=function(){var e=this;e.destroyed||e.ad&&e.ad.stopAd()},e.prototype.init=function(){this.destroyed||this.ad&&this.ad.initAd()},e.prototype.destroy=function(){this.destroyed=!0,this.emit("local::beforeDestroy"),u.deleteProps(this)},e}(o)),n={name:"vi",params:{vi:{enabled:!1,autoplay:!0,fallbackOverlay:!0,fallbackOverlayText:"Please watch this ad",showMute:!0,startMuted:(v.ios||v.android)&&!v.cordova,appId:null,appVer:null,language:null,width:null,height:null,placementId:"pltd4o7ibb9rc653x14",placementType:"interstitial",videoSlot:null,showProgress:!0,showBranding:!0,os:null,osVersion:null,orientation:null,age:null,gender:null,advertiserId:null,latitude:null,longitude:null,accuracy:null,storeId:null,ip:null,manufacturer:null,model:null,connectionType:null,connectionProvider:null}},create:function(){var t=this;t.vi={sdkReady:!1,createAd:function(e){return new i(t,e)},loadSdk:function(){if(!t.vi.sdkReady){var e=a.createElement("script");e.onload=function(){t.emit("viSdkReady"),t.vi.sdkReady=!0},e.src="https://c.vi-serve.com/viadshtml/vi.min.js",p("head").append(e)}}}},on:{init:function(){(this.params.vi.enabled||this.passedParams.vi&&!1!==this.passedParams.vi.enabled)&&this.vi.loadSdk()}}};if(t){if(e.prototype.modules&&e.prototype.modules[n.name])return;e.use(n),e.instance&&(e.instance.useModuleParams(n,e.instance.params),e.instance.useModule(n))}return n}(Framework7, typeof Framework7AutoInstallComponent === 'undefined' ? undefined : Framework7AutoInstallComponent))
