@akross/artemis-ads-sdk 3.7.6 → 3.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- class e{static applyDefaults(e){return{timeout:5e3,debug:!1,proxyExternalScripts:!1,enableGPTPpid:!1,...e}}static hasBaseUrl(e){return!!(e.baseUrl&&e.baseUrl.trim().length>0)}static hasArtemisAppId(e){return!!(e.artemisAdsAppId&&e.artemisAdsAppId.trim().length>0)}static getArtemisAppId(e,t){return e.artemisAdsAppId||t||""}static isValid(e){return this.hasBaseUrl(e)&&this.hasArtemisAppId(e)}static getPrimaryColor(e,t="#007bff"){return e.primaryColor||t}static isValidColor(e){return!!e&&/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)}static getLuminaToken(e,t="QQDCYMdFh2AJqwP"){return e.luminaToken||t}}class t{constructor(e){this.userId=e.userId,this.advertisingId=e.advertisingId,Object.keys(e||{}).forEach(t=>{t in this||(this[t]=e[t])})}hasAdvertisingId(){return!!(this.advertisingId&&this.advertisingId.trim().length>0)}getAdvertisingId(e){return this.advertisingId||e||""}setAdvertisingId(e){this.advertisingId=e}clearAdvertisingId(){this.advertisingId=null}isValid(){return!!(this.userId&&this.userId.trim().length>0)}getUserId(e){return this.userId||e||""}hasCompleteData(){return this.isValid()&&this.hasAdvertisingId()}}function r(){if("undefined"==typeof navigator)return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/iPhone|iPad|iPod/i.test(e)||/iPhone|iPad|iPod/i.test(t)}function i(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent||"";return/Android/i.test(e)}function n(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/iPad/i.test(t)||/Macintosh/i.test(e)&&"undefined"!=typeof document&&"ontouchend"in document,i=/Android/i.test(e)&&!/Mobile/i.test(e);return r||i}function a(){if("undefined"==typeof navigator)return!1;if(n())return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/iPhone|iPod/i.test(t)||/iPhone|iPod/i.test(e),i=/Android/i.test(e)&&/Mobile/i.test(e);return r||i}function s(){if("undefined"==typeof navigator)return!1;if(a()||n())return!1;const e=navigator.userAgent||"",t=navigator.platform||"",i=/Win/i.test(t)||/Windows/i.test(e),s=/Mac/i.test(t)&&!r(),o=/Linux/i.test(t)&&!/Android/i.test(e);return i||s||o}function o(){return a()?"mobile":n()?"tablet":s()?"desktop":"unknown"}class l{constructor(e){this.params=e.params,this.type=e.type,Object.keys(e).forEach(t=>{"params"!==t&&"type"!==t&&(this[t]=e[t])})}findParamByKey(e){return this.params?.find(t=>t.key===e)?.value}findAdUnitId(){return r()?this.findParamByKey("adUnitIdiOS")??this.findParamByKey("adUnitId")??"":this.findParamByKey("adUnitId")??""}findVastTag(){return this.findParamByKey("tag")??""}findEventSuffix(){return this.findParamByKey("eventSuffix")??""}findTimeout(){const e=this.findParamByKey("timeout");return e?parseInt(e,10):void 0}}var c,d,u;function h(e){return[d.BANNER,d.VIDEO_V2,d.PROGRAMMATIC_V2,d.SURVEY_V2,d.EXTERNAL_REDIRECT,d.TYPE_GOOGLE_RV,d.TYPE_GOOGLE_RI,d.TYPE_MAX_RV,d.TYPE_KWAI_RV,d.TYPE_FALLBACK].includes(e)}!function(e){e.SUCCESS="SUCCESS",e.ERROR="ERROR",e.EMPTY="EMPTY"}(c||(c={})),function(e){e.BANNER="image",e.VIDEO_V2="video_v2",e.PROGRAMMATIC_V2="programatica_v2",e.SURVEY_V2="survey_v2",e.EXTERNAL_REDIRECT="external_redirect",e.TYPE_GOOGLE_RV="GAM_RV",e.TYPE_GOOGLE_RI="GAM_RI",e.TYPE_MAX_RV="MAX_RV",e.TYPE_KWAI_RV="KWAI_RV",e.TYPE_FALLBACK="fallback",e.PROGRAMMATIC="programatica",e.PROGRAMMATIC_ADMOB_RB="google-admob-rv",e.PROGRAMMATIC_MAX_RV="max-rv",e.UNKNOWN=""}(d||(d={})),function(e){e[e.REWARDED=11]="REWARDED",e[e.REWARDED_REDIRECTED=12]="REWARDED_REDIRECTED",e[e.MEDIA_WATCHED=13]="MEDIA_WATCHED",e[e.SKIPPED=20]="SKIPPED",e[e.ERROR=21]="ERROR",e[e.CONNECTION_ERROR=22]="CONNECTION_ERROR",e[e.NO_FILL=23]="NO_FILL",e[e.CANCELED=24]="CANCELED",e[e.POLL_WRONG_ANSWER=25]="POLL_WRONG_ANSWER",e[e.EXTERNAL_REDIRECT=26]="EXTERNAL_REDIRECT",e[e.BANNER_CLICK=27]="BANNER_CLICK"}(u||(u={}));class g{constructor(e,t){this.description=e,this.cause=t}}class p{constructor(e){this.type=e.type,this.url=e.url,this.originalContent=e.originalContent,this.proxy=e.proxy,this.skipEnabled=e.skipEnabled,this.skipSeconds=e.skipSeconds,this.videoId=e.videoId,this.eventSuffix=e.eventSuffix}hasUrl(){return!(!this.url||!this.url.trim())}hasType(){return!(!this.type||!this.type.trim())}isSupportedType(){return["IN_HOUSE","VAST","VPAID"].includes(this.type?.toUpperCase())}}class m{constructor(e){this.waterfall=e.waterfall?e.waterfall.map(e=>new l(e)):void 0}hasWaterfall(){return!!(this.waterfall&&this.waterfall.length>0)}getInfo(){return this.hasWaterfall()?`Waterfall com ${this.waterfall.length} anúncios`:"Conteúdo programático vazio"}}class f{constructor(e){this.url=e.url,this.adBlock=e.adBlock}hasUrl(){return!(!this.url||!this.url.trim())}hasAdBlock(){return!(!this.adBlock||!this.adBlock.trim())}}let v=class{constructor(e){this.infoPrimary=e.infoPrimary,this.infoSecondary=e.infoSecondary,this.actionButtonLabel=e.actionButtonLabel,this.link=e.link,this.thumbnail=e.thumbnail}hasLink(){return!(!this.link||!this.link.trim())}hasThumbnail(){return!(!this.thumbnail||!this.thumbnail.trim())}hasInfoPrimary(){return!(!this.infoPrimary||!this.infoPrimary.trim())}hasInfoSecondary(){return!(!this.infoSecondary||!this.infoSecondary.trim())}hasActionButtonLabel(){return!(!this.actionButtonLabel||!this.actionButtonLabel.trim())}};class E{constructor(e){this.url=e.url,this.programmatic=e.programmatic?new m(e.programmatic):void 0,this.video=e.video?new p(e.video):void 0,this.infoPrimary=e.infoPrimary,this.infoSecondary=e.infoSecondary,this.survey=e.survey?new f(e.survey):void 0,this.externalRedirect=e.externalRedirect?new v(e.externalRedirect):void 0,!this.externalRedirect&&(e.link||e.actionButtonLabel||e.thumbnail)&&(this.externalRedirect=new v({infoPrimary:e.infoPrimary,infoSecondary:e.infoSecondary,actionButtonLabel:e.actionButtonLabel,link:e.link,thumbnail:e.thumbnail}))}hasUrl(){return!(!this.url||!this.url.trim())}isProgrammatic(){return!(!this.programmatic||!this.programmatic.hasWaterfall())}isSurvey(){return!(!this.survey||!this.survey.hasUrl())}isExternalRedirect(){return!(!this.externalRedirect||!this.externalRedirect.hasLink())}getInfo(){return this.hasUrl()?`URL: ${this.url}`:this.isProgrammatic()?this.programmatic.getInfo():this.isSurvey()?`Survey: ${this.survey.url}`:this.isExternalRedirect()?`External Redirect: ${this.externalRedirect.link}`:"Conteúdo vazio"}}class y{constructor(e){this.type=e.type,this.title=e.title,this.description=e.description,this.buttons=e.buttons||[],this.url=e.url,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isExternal(){return"EXTERNAL"===this.type}hasUrl(){return!(!this.url||!this.url.trim())}hasButtons(){return this.buttons.length>0}getInfo(){return`${this.title}: ${this.description}`}}class w{constructor(e){this.media=e.media,this.result=e.result,this.error=e.error,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isSuccess(){return this.result===u.REWARDED||this.result===u.REWARDED_REDIRECTED||this.result===u.EXTERNAL_REDIRECT||this.result===u.BANNER_CLICK}isSkipped(){return this.result===u.SKIPPED}hasError(){return this.result===u.ERROR||!!this.error}getErrorMessage(){return this.error?this.error.description||this.error.cause||"Erro desconhecido":"Sem erro"}getInfo(){return this.isSuccess()?"Anúncio visualizado com sucesso":this.isSkipped()?"Anúncio pulado":this.hasError()?`Erro: ${this.getErrorMessage()}`:"Resultado desconhecido"}}class b{constructor(e=!1){this.debugMode=e}debug(e,...t){this.debugMode}info(e,...t){}warn(e,...t){}error(e,...t){}}class A{constructor(){}interceptRequest(e){const t=Pt.getCustomHeaders();if(t){const r=new Headers(e.headers);Object.entries(t).forEach(([e,t])=>{r.set(e,t)}),e.headers=r}const r=new Headers(e.headers);return r.set("Content-Type","application/json"),r.set("Accept","application/json"),e.headers=r,e}interceptResponse(e){return e}}class R{constructor(e){this.fetchConfig=e}async fetchWithConfig(e,t={}){const{baseUrl:r,restInterceptor:i}=this.fetchConfig;i&&(t=i.interceptRequest(t));const n=new URL(e,r).toString();return fetch(n,{...t})}async requestCampaign(e,t,r,i){const n=`campaign/v3/${e}?size=${r}${i?`&t=${i}`:""}`,a=await this.fetchWithConfig(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(`Failed to request campaign: ${a.statusText}`);return 204==a.status?{}:a.json()}async sendTracking(e,t,r,i,n,a){const s=`tracker?e=${e}&c=${t??""}&u=${r}&requestId=${i}${n?`&m=${n}`:""}${a?`&s=${a}`:""}`,o=await this.fetchWithConfig(s,{method:"POST",keepalive:!0});if(!o.ok)throw new Error(`Failed to send tracking: ${o.statusText}`)}async checkConnectivity(e="https://access-network.akross.com.br"){const t=Math.round(1e4*Math.random()),r=await this.fetchWithConfig(`${e}?rand=${t}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to check connectivity: ${r.statusText}`);return r}async sendParsedVastTrackingEvent(e){const t=await this.fetchWithConfig(e,{method:"GET",keepalive:!0});if(!t.ok)throw new Error(`Failed to send parsed VAST tracking event: ${t.statusText}`)}}class T{constructor(){}createFetchConfig(e,t,r=!1,i=!0){return{baseUrl:e,timeout:t,debugMode:r,restInterceptor:i?new A:null}}init(e="",t=5,r=!1,i=!0){let n=e;if(""===n){const e=Pt.getConfig();n=e?.baseUrl||"https://internal-artemis-837746407.us-east-1.elb.amazonaws.com/adserver/"}return this.createFetchConfig(n,t,r,i)}getArtemisAdsService(e=30,t=!1,r=!0){const i=this.init("",e,t,r);return new R(i)}}const k="impression",I="success_impression",C="click",D="complete",S="campaign-click",L="prog-wtfl-start",N="prog-conn-error",x="prog-fallback-req",M="prog-ad-error",O="prog-ad-no-fill",U="prog-skipped",P="ad-error",V="start",_="firstQuartile",q="midpoint",F="thirdQuartile",B="skipped";class H{constructor(){this.logger=new b(Pt.getDebugMode()),this.apiFactory=new T}async sendEvent(e,t,r,i,n){await this.requestEvent(e,t,r,i,n)}async requestEvent(e,t,r,i,n){const a=Pt.getUserData(),s=a?.userId;if(s)try{const a=Pt.getDebugMode(),o=this.apiFactory.getArtemisAdsService(3,a);await o.sendTracking(e,t,s,r,i,n),this.logger.debug(`Event sent successfully: ${e} for campaign ${t}`)}catch(e){this.logger.warn("Error sending tracking event:",e)}else this.logger.error("Error sending tracking event: User id is null")}async sendMediaClickEvent(e,t,r){await this.sendEvent("media-click",e,t,r)}async sendCampaignClickEvent(e,t){await this.sendEvent(S,e,t)}async sendCampaignsImpressionEvent(e,t){for(const r of t)await this.sendEvent(k,r.campaignUuid,e)}async sendImpressedEvent(e,t,r){await this.sendEvent(k,e,t,r)}async sendSuccessImpressionEvent(e,t,r){await this.sendEvent(I,e,t,r)}async sendCompleteEvent(e,t,r,i){await this.sendEvent(D,e,t,r,i)}async sendAllAdsCompletedEvent(e,t,r,i){await this.sendEvent("all-ads-completed"+(i?`${i}`:""),e,t,r)}async sendAdCompletedEvent(e,t,r){await this.sendEvent("ad-completed",e,t,r)}async sendEventFromUrl(e){try{const t=Pt.getDebugMode(),r=this.apiFactory.getArtemisAdsService(3,t);await r.sendParsedVastTrackingEvent(e),this.logger.debug("Parsed VAST tracking event sent successfully")}catch(e){this.logger.warn("Error sending tracking event from URL:",e)}}async sendVpaidStartEvent(e,t,r){await this.sendEvent(V,e,t,r)}async sendFirstQuartileEvent(e,t,r){await this.sendEvent(_,e,t,r)}async sendMidpointEvent(e,t,r){await this.sendEvent(q,e,t,r)}async sendThirdQuartileEvent(e,t,r){await this.sendEvent(F,e,t,r)}async sendSkippedEvent(e,t,r){await this.sendEvent(B,e,t,r)}async sendAdErrorEvent(e,t,r){await this.sendEvent(P,e,t,r)}async sendAdNoFillEvent(e,t,r){await this.sendEvent(O,e,t,r)}async sendWaterfallStartEvent(e,t,r){await this.sendEvent(L,e,t,r)}async sendProgConnectionError(e,t,r){await this.sendEvent(N,e,t,r)}async sendProgFallbackReq(e,t,r){await this.sendEvent(x,e,t,r)}async sendProgError(e,t,r){await this.sendEvent(M,e,t,r)}async sendProgSkipped(e,t,r){await this.sendEvent(U,e,t,r)}async sendClickThroughEvent(e,t,r){await this.sendEvent("clickthrough",e,t,r)}async sendParsedVastTrackingEvent(e){await this.sendEventFromUrl(e)}}function W(){return new H}const z=H,K=W,G={REWARDED:"Benefício adiquirido com sucesso",NOT_REWARDED:"Você precisa assistir o anúncio até o fim para obter o benefício",REDIRECT_ERROR:"Você não tem nenhum aplicativo instalado para abrir uma página na web",ERROR:"Ocorreu um erro ao exibir o anúncio. Por favor, tente novamente",CONNECTION_ERROR:"Ocorreu um erro ao exibir o anúncio. Por favor, verifique sua conexão e tente novamente",NO_FILL:"Não foi possível encontrar uma publicidade no momento. Por favor, tente novamente",VAST_BACK:"Para obter o prêmio é necessário assistir o vídeo até o final"};var j;!function(e){e.IMPRESSION="IMPRESSION",e.CLICKTHROUGH="CLICKTHROUGH",e.VAST_IMPRESSION="VAST_IMPRESSION",e.START="START",e.FIRST_QUARTILE="FIRST_QUARTILE",e.MIDPOINT="MIDPOINT",e.THIRD_QUARTILE="THIRD_QUARTILE",e.COMPLETE="COMPLETE",e.ERROR="ERROR",e.SKIPPED="SKIPPED",e.NO_FILL="NO_FILL",e.PROGRAMMATIC_ERROR="PROGRAMMATIC_ERROR",e.PROGRAMMATIC_SKIPPED="PROGRAMMATIC_SKIPPED",e.PROGRAMMATIC_WATERFALL_START="PROGRAMMATIC_WATERFALL_START",e.PROGRAMMATIC_CONNECTION_ERROR="PROGRAMMATIC_CONNECTION_ERROR",e.PROGRAMMATIC_FALLBACK_REQ="PROGRAMMATIC_FALLBACK_REQ",e.AD_COMPLETED="AD_COMPLETED",e.ALL_ADS_COMPLETED="ALL_ADS_COMPLETED"}(j||(j={}));class ${constructor(e){this.sentEvents=new Set,this.config=e,this.logger=new b(Pt.getDebugMode()),this.eventsHelper=new H}sendEventCallback(e,t){if(this.sentEvents.has(e))this.logger.debug(`Event ${e} already sent, skipping`);else switch(this.sentEvents.add(e),this.logger.debug(`Sending event: ${e} for media: ${t.title}`),e){case j.IMPRESSION:this.onAdImpression(t);break;case j.START:this.onAdStarted(t);break;case j.FIRST_QUARTILE:this.onFirstQuartile(t);break;case j.MIDPOINT:this.onMidpoint(t);break;case j.THIRD_QUARTILE:this.onThirdQuartile(t);break;case j.COMPLETE:this.onAdComplete(t);break;case j.ERROR:this.onAdError(t);break;case j.SKIPPED:this.onAdSkipped(t);break;case j.NO_FILL:this.onProgrammaticNoFill(t);break;case j.PROGRAMMATIC_ERROR:this.onProgrammaticAdError(t);break;case j.PROGRAMMATIC_SKIPPED:this.onProgrammaticSkipped(t);break;case j.PROGRAMMATIC_WATERFALL_START:this.onProgrammaticStart(t);break;case j.PROGRAMMATIC_CONNECTION_ERROR:this.onProgrammaticConnectionError(t);break;case j.PROGRAMMATIC_FALLBACK_REQ:this.onProgrammaticFallbackReq(t);break;case j.CLICKTHROUGH:this.onClickThrough(t);break;case j.AD_COMPLETED:this.onAdCompleted(t);break;case j.ALL_ADS_COMPLETED:this.onAllAdsCompleted(t);break;default:this.logger.warn(`Unknown event: ${e}`)}}finishWithResult(e,t,r){const i=new w({media:e,result:t});switch(t){case u.REWARDED:if(this.logger.debug(`Checking mediasLeft: ${e.mediasLeft} (type: ${typeof e.mediasLeft})`),(e.mediasLeft||0)>1)this.logger.debug(`Setting result to MEDIA_WATCHED because mediasLeft (${e.mediasLeft}) > 1`),i.result=u.MEDIA_WATCHED;else if(this.logger.debug(`Keeping result as REWARDED because mediasLeft (${e.mediasLeft}) <= 1`),"EXTERNAL"===e.success?.type)try{e.success.url&&(window.open(e.success.url,"_blank"),i.result=u.REWARDED_REDIRECTED)}catch(e){i.error=new g(G.REDIRECT_ERROR),i.result=u.ERROR}break;case u.ERROR:i.error=new g(G.ERROR,r);break;case u.NO_FILL:i.error=new g(G.NO_FILL,"NO_FILL");break;case u.CONNECTION_ERROR:i.error=new g(G.CONNECTION_ERROR,"CONNECTION_ERROR");break;case u.CANCELED:i.error=new g(G.NOT_REWARDED);break;case u.REWARDED_REDIRECTED:case u.EXTERNAL_REDIRECT:break;default:this.logger.warn(`Unknown result: ${t}`)}return i}onAdImpression(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendImpressedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdClickThrough(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendClickThroughEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdStarted(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendVpaidStartEvent(e.campaignId||"",e.requestId||"",e.uuid)}onFirstQuartile(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendFirstQuartileEvent(e.campaignId||"",e.requestId||"",e.uuid)}onMidpoint(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendMidpointEvent(e.campaignId||"",e.requestId||"",e.uuid)}onThirdQuartile(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendThirdQuartileEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdComplete(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendCompleteEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdCompleted(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendAdCompletedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAllAdsCompleted(e){this.eventsHelper.sendAllAdsCompletedEvent(e.campaignId||"",e.requestId||"",e.uuid,e.content?.video?.eventSuffix)}onAdSkipped(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendSkippedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdError(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendAdErrorEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticNoFill(e){this.eventsHelper.sendAdNoFillEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticStart(e){this.eventsHelper.sendWaterfallStartEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticConnectionError(e,t){this.eventsHelper.sendProgConnectionError(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticFallbackReq(e){this.eventsHelper.sendProgFallbackReq(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticAdError(e,t){this.eventsHelper.sendProgError(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticSkipped(e){this.eventsHelper.sendProgSkipped(e.campaignId||"",e.requestId||"",e.uuid)}onClickThrough(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendClickThroughEvent(e.campaignId||"",e.requestId||"",e.uuid)}canSendLocalEvents(e){if(e.type===d.VIDEO_V2){const t=e.content?.video?.type?.toUpperCase();return"VAST"===t||"VPAID"===t}return!0}clearSentEvents(){this.sentEvents.clear()}hasEventBeenSent(e){return this.sentEvents.has(e)}}function Y(e){return new $(e)}const Q=1e3;function X(e=!1){return new Promise((t,r)=>{if(window.googletag)return void t();if(document.getElementById("gpt-script"))setTimeout(()=>{window.googletag?t():r(new Error("GPT script exists but not loaded"))},Q);else{const i="https://www.googletagservices.com/tag/js/gpt.js",n=document.createElement("script");n.src=ee("gpt.js",i,e),n.id="gpt-script",n.async=!0,n.onload=()=>{setTimeout(()=>{window.googletag?t():r(new Error("GPT script failed to initialize"))},Q)},n.onerror=e=>{r(e)},document.head.appendChild(n)}})}function J(e=!1){return new Promise((t,r)=>{if(window.google&&window.google.ima)return void t();if(document.getElementById("ima-script"))setTimeout(()=>{window.google&&window.google.ima?t():r(new Error("IMA SDK script exists but not loaded"))},Q);else{const i="https://imasdk.googleapis.com/js/sdkloader/ima3.js",n=document.createElement("script");n.src=ee("ima3.js",i,e),n.id="ima-script",n.async=!0,n.onload=()=>{setTimeout(()=>{window.google&&window.google.ima?t():r(new Error("IMA SDK failed to initialize"))},Q)},n.onerror=e=>{r(e)},document.head.appendChild(n)}})}function Z(e,t=!1){return new Promise((r,i)=>{if(window.adsbylumina&&window.__luminaBasecodeReady__)return void r();if(document.getElementById("lumina-script"))setTimeout(()=>{window.adsbylumina&&window.__luminaBasecodeReady__?r():i(new Error("Lumina SDK script exists but not loaded"))},Q);else{const n="https://s16-ad.ap4r.com/kos/s101/nlav11187/lumina/lumina-install.js",a=new URLSearchParams;e.token&&a.append("token",e.token),void 0!==e.debug&&a.append("debug",e.debug.toString());const s=`${n}?${a.toString()}`,o=document.createElement("script");o.src=ee("lumina-install.js",s,t),o.id="lumina-script",o.async=!0,o.onload=()=>{setTimeout(()=>{window.adsbylumina&&window.__luminaBasecodeReady__?r():i(new Error("Lumina SDK failed to initialize"))},Q)},o.onerror=e=>{i(new Error("Failed to load Lumina SDK script"))},document.head.appendChild(o)}})}function ee(e,t,r=!1){if(!r)return t;const i=Pt.getConfig()?.cdnBaseUrl;return i?`${i}/static/js/${e}`:t}class te{constructor(e){this.modalElement=null,this.videoElement=null,this.videoContainer=null,this.closeButton=null,this.fallbackOverlay=null,this.fallbackTimerEl=null,this.fallbackSaibaMaisBtn=null,this.logger=e}createModal(){try{if(this.cleanup(),this.modalElement=document.createElement("div"),this.modalElement.innerHTML='\n <style>\n .aa-vast-modal {\n display: flex;\n flex-direction: column;\n position: fixed;\n inset: 0;\n width: 100vw;\n height: 100vh;\n background-color: #000;\n z-index: 2147483647;\n overflow: hidden;\n }\n\n .aa-vast-header {\n flex-shrink: 0;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n padding: 0 8px;\n background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));\n z-index: 10;\n }\n\n .aa-vast-modal-dialog {\n flex: 1;\n min-height: 0;\n position: relative;\n overflow: hidden;\n }\n\n .content-video-vast {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .aa-vast-close-btn {\n position: relative;\n width: 44px;\n height: 44px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.5);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background-color 0.2s ease, transform 0.15s ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .aa-vast-close-btn:hover {\n background-color: rgba(0, 0, 0, 0.8);\n }\n\n .aa-vast-close-btn:active {\n transform: scale(0.95);\n }\n\n .aa-vast-close-btn::before,\n .aa-vast-close-btn::after {\n content: \'\';\n position: absolute;\n width: 22px;\n height: 2px;\n background-color: #fff;\n border-radius: 1px;\n }\n\n .aa-vast-close-btn::before {\n transform: rotate(45deg);\n }\n\n .aa-vast-close-btn::after {\n transform: rotate(-45deg);\n }\n\n .ima-ad-container {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 2;\n }\n\n .ima-ad-container > * {\n pointer-events: auto;\n }\n\n .ima-video-element {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: contain;\n cursor: pointer;\n z-index: 1;\n }\n\n .ima-video-element:focus {\n outline: none;\n }\n\n .aa-vast-fallback-overlay {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 5;\n display: none;\n align-items: flex-end;\n justify-content: flex-end;\n padding: 24px 16px 16px;\n background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));\n pointer-events: none;\n }\n\n .aa-vast-fallback-overlay.is-visible {\n display: flex;\n pointer-events: auto;\n }\n\n .aa-vast-fallback-overlay > * {\n pointer-events: auto;\n }\n\n .aa-vast-fallback-timer {\n position: absolute;\n left: 0;\n bottom: 0;\n color: #fff;\n display: inline-block;\n font-family: Arial, sans-serif;\n font-weight: normal;\n font-size: 11px;\n line-height: normal;\n padding: 5px;\n padding-right: 10px;\n pointer-events: auto;\n text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);\n cursor: default;\n }\n\n .aa-vast-fallback-saiba-mais {\n padding: 8px 16px;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n background-color: rgba(255, 255, 255, 0.25);\n border: 1px solid rgba(255, 255, 255, 0.5);\n border-radius: 4px;\n cursor: pointer;\n text-decoration: none;\n transition: background-color 0.2s ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .aa-vast-fallback-saiba-mais:hover {\n background-color: rgba(255, 255, 255, 0.35);\n }\n </style>\n <div id="modal" class="aa-vast-modal">\n <header class="aa-vast-header">\n <button type="button" class="aa-vast-close-btn" id="close-modal" aria-label="Fechar anúncio"></button>\n </header>\n <div class="aa-vast-modal-dialog">\n <div id="content-video-vast" class="content-video-vast">\n <video id="ima-video-element" class="ima-video-element" autoplay playsinline></video>\n <div id="ima-ad-container" class="ima-ad-container"></div>\n </div>\n <div id="aa-vast-fallback-overlay" class="aa-vast-fallback-overlay" aria-hidden="true">\n <span id="aa-vast-fallback-timer" class="aa-vast-fallback-timer">Anúncio 0:00</span>\n <button type="button" id="aa-vast-fallback-saiba-mais" class="aa-vast-fallback-saiba-mais">Saiba mais</button>\n </div>\n </div>\n </div>\n ',document.body.appendChild(this.modalElement),this.videoElement=this.modalElement.querySelector("#ima-video-element"),this.videoContainer=this.modalElement.querySelector(".content-video-vast"),this.closeButton=this.modalElement.querySelector("#close-modal"),this.fallbackOverlay=this.modalElement.querySelector("#aa-vast-fallback-overlay"),this.fallbackTimerEl=this.modalElement.querySelector("#aa-vast-fallback-timer"),this.fallbackSaibaMaisBtn=this.modalElement.querySelector("#aa-vast-fallback-saiba-mais"),!this.videoElement)throw new Error("Video element not found");return this.logger.debug("Modal created successfully"),this.videoElement}catch(e){throw this.logger.error("Error creating modal:",e),e}}getVideoElement(){return this.videoElement}getVideoContainer(){return this.videoContainer}getAdContainer(){return this.modalElement?this.modalElement.querySelector("#ima-ad-container"):null}setCloseCallback(e){this.closeButton&&this.closeButton.addEventListener("click",e)}showFallbackOverlay(e){this.fallbackOverlay&&(this.fallbackOverlay.classList.add("is-visible"),this.fallbackOverlay.setAttribute("aria-hidden","false"),this.fallbackSaibaMaisBtn&&(this.fallbackSaibaMaisBtn.style.display=e?"":"none"),this.logger.debug("Fallback overlay shown"))}hideFallbackOverlay(){this.fallbackOverlay&&(this.fallbackOverlay.classList.remove("is-visible"),this.fallbackOverlay.setAttribute("aria-hidden","true"),this.logger.debug("Fallback overlay hidden"))}updateFallbackTimer(e,t){if(!this.fallbackTimerEl)return;const r=Math.max(0,Math.floor((t||0)-e)),i=Math.floor(r/60),n=r%60;this.fallbackTimerEl.textContent=`Anúncio ${i}:${n.toString().padStart(2,"0")}`}setFallbackSaibaMaisClick(e){this.fallbackSaibaMaisBtn&&this.fallbackSaibaMaisBtn.addEventListener("click",e)}close(){this.modalElement&&(this.modalElement.style.display="none")}hide(){this.modalElement&&(this.modalElement.style.display="none",this.modalElement.style.visibility="hidden",this.logger.debug("Modal hidden (not removed)"))}remove(){this.modalElement&&(document.body.removeChild(this.modalElement),this.modalElement=null)}showVideo(){this.videoElement&&(this.videoElement.style.display="block",this.videoElement.style.visibility="visible",this.logger.debug("Video made visible"))}cleanup(){try{this.closeButton&&(this.closeButton.remove(),this.closeButton=null),this.fallbackOverlay=null,this.fallbackTimerEl=null,this.fallbackSaibaMaisBtn=null,this.videoElement&&(this.videoElement=null),this.videoContainer&&(this.videoContainer.remove(),this.videoContainer=null),this.modalElement&&(this.modalElement.remove(),this.modalElement=null),this.logger.debug("UI cleaned up successfully")}catch(e){this.logger.error("Error cleaning up UI:",e)}}}class re{static show(){if(this.isVisible)return;const e=Pt.getConfig(),t=e?.primaryColor||"#007bff",r=document.createElement("div");r.id=this.OVERLAY_ID,r.innerHTML=`\n <style>\n #${this.OVERLAY_ID} {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.8);\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n margin: 0;\n padding: 0;\n }\n \n #${this.OVERLAY_ID} .loading-content {\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n #${this.OVERLAY_ID} .spinner {\n width: 40px;\n height: 40px;\n border: 4px solid rgba(255, 255, 255, 0.3);\n border-top: 4px solid ${t};\n border-radius: 50%;\n animation: spin 1s linear infinite;\n margin-bottom: 16px;\n flex-shrink: 0;\n }\n \n #${this.OVERLAY_ID} .loading-text {\n font-size: 16px;\n font-weight: 500;\n margin: 0;\n line-height: 1.2;\n }\n \n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n </style>\n <div class="loading-content">\n <div class="spinner"></div>\n <p class="loading-text">Carregando Publicidade</p>\n </div>\n `,document.body.appendChild(r),this.isVisible=!0}static hide(){const e=document.getElementById(this.OVERLAY_ID);e&&(e.remove(),this.isVisible=!1)}static isShowing(){return this.isVisible}static forceHide(){const e=document.getElementById(this.OVERLAY_ID);e&&e.remove(),this.isVisible=!1}}re.OVERLAY_ID="akross-loading-overlay",re.isVisible=!1;function ie(){return!0===Pt.getConfig()?.enableGPTPpid}function ne(e){if(!e||"string"!=typeof e)return!1;const t=e.trim();return t.length>=1&&t.length<=150}function ae(e){if(!ie())return;if(!ne(e))return;if("undefined"==typeof window)return;const t=e.trim();window.googletag=window.googletag||{cmd:[]},window.googletag.cmd.push(()=>{try{"function"==typeof window.googletag?.pubads&&window.googletag.pubads().setPublisherProvidedId(t)}catch{}})}function se(){if(!ie())return;if("undefined"==typeof window||"function"!=typeof window.googletag?.pubads)return;const e=Pt.getUserData()?.userId;if(e&&ne(e))try{window.googletag.pubads().setPublisherProvidedId(e.trim())}catch{}}function oe(){if("undefined"!=typeof __VERSION__)return __VERSION__;if("undefined"!=typeof process&&process.env?.npm_package_version)return process.env.npm_package_version;try{return"3.7.6"}catch(e){return"unknown"}}function le(){const e=oe(),t="undefined"!=typeof process&&process.env;return{version:e,isDevelopment:!!t&&"development"===process.env.NODE_ENV,isProduction:!t||"production"===process.env.NODE_ENV,buildTime:(new Date).toISOString()}}const ce=oe(),de=le();class ue{constructor(e){this.overlayElement=null,this.iframeElement=null,this.loadingElement=null,this.errorElement=null,this.retryButton=null,this.closeButton=null,this.isSurveyCompleted=!1,this.isSurveyClosed=!1,this.media=e;const t=Pt.getDebugMode();this.logger=new b(t),this.mediaResultHelper=new $({userId:Pt.getUserData()?.userId||"",debug:t})}async start(){try{return this.logger.debug("Starting survey overlay for media:",this.media.title),"survey_v2"!==this.media.type&&"video_v2"!==this.media.type?(this.logger.error("Unsupported media type:",this.media.type),new w({media:this.media,result:u.ERROR,error:new g("Unsupported media type")})):this.media.content?.survey?.url?(this.createOverlay(),this.setupEventListeners(),this.loadSurvey(),new Promise(e=>{this.onResultCallback=t=>{let r=this.mediaResultHelper.finishWithResult(t.media,t.result);e(r)}})):(this.logger.error("Survey URL not found"),new w({media:this.media,result:u.ERROR,error:new g("Survey URL not found")}))}catch(e){return this.logger.error("Error starting survey overlay:",e),new w({media:this.media,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.innerHTML=`\n <style>${ue.OVERLAY_CSS}</style>\n <div class="aa-survey-overlay">\n <div class="aa-survey-dialog">\n <div class="aa-survey-content">\n <iframe class="aa-survey-iframe"></iframe>\n <div class="aa-survey-loading" style="display: none;">\n <div style="width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #007bff; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 16px;"></div>\n <div style="color: #666; font-size: 14px;">Carregando pesquisa...</div>\n </div>\n <div class="aa-survey-error" style="display: none;">\n <div style="font-size: 48px; margin-bottom: 16px;">⚠️</div>\n <div class="aa-survey-error-message" style="font-size: 16px; color: #666; margin-bottom: 24px;"></div>\n <button style="background-color: #007bff; color: white; border: none; padding: 12px 24px; border-radius: 4px; cursor: pointer; font-size: 14px; transition: background-color 0.2s ease;">Tentar Novamente</button>\n </div>\n </div>\n <button type="button" class="closeButton"></button>\n </div>\n </div>\n `,document.body.appendChild(this.overlayElement),this.iframeElement=this.overlayElement.querySelector(".aa-survey-iframe"),this.loadingElement=this.overlayElement.querySelector(".aa-survey-loading"),this.errorElement=this.overlayElement.querySelector(".aa-survey-error"),this.retryButton=this.overlayElement.querySelector('button[style*="Tentar Novamente"]'),this.closeButton=this.overlayElement.querySelector(".closeButton"),this.applyPrimaryColor(),this.logger.debug("Survey overlay created")}applyPrimaryColor(){const t=Pt.getConfig(),r=t?e.getPrimaryColor(t,"#007bff"):"#007bff";if(this.loadingElement){const e=this.loadingElement.querySelector('div[style*="border-top"]');e&&(e.style.borderTop=`4px solid ${r}`)}this.retryButton&&(this.retryButton.style.backgroundColor=r,this.retryButton.addEventListener("mouseenter",()=>{this.retryButton.style.backgroundColor=this.darkenColor(r,10)}),this.retryButton.addEventListener("mouseleave",()=>{this.retryButton.style.backgroundColor=r}))}setupEventListeners(){this.retryButton&&this.retryButton.addEventListener("click",()=>{this.hideErrorInterface(),this.loadSurvey()}),this.closeButton&&this.closeButton.addEventListener("click",()=>{this.executeBackButtonLogic()}),document.addEventListener("keydown",e=>{"Escape"===e.key&&this.executeBackButtonLogic()}),this.overlayElement&&this.overlayElement.addEventListener("click",e=>{e.target===this.overlayElement&&this.executeBackButtonLogic()})}loadSurvey(){this.iframeElement&&this.media.content?.survey?.url?(this.logger.debug("Loading survey from URL:",this.media.content.survey.url),this.hideErrorInterface(),this.showLoading(),this.iframeElement.src=this.media.content.survey.url,this.iframeElement.onload=()=>{this.hideLoading(),setTimeout(()=>{this.injectSurveyBridge()},100)},this.iframeElement.onerror=()=>{this.hideLoading(),this.showErrorInterface("Erro ao carregar a pesquisa")}):this.showErrorInterface("URL da pesquisa não encontrada")}injectSurveyBridge(){try{this.setupMessageListener(),this.attemptScriptInjection()}catch(e){this.logger.error("Error setting up survey bridge:",e)}}setupMessageListener(){const e=e=>{const{data:t}=e;t&&"akross-survey"===t.source&&(this.logger.debug("Survey message received from iframe:",t),this.handleSurveyMessage(t))};window.addEventListener("message",e),this._messageHandler=e}attemptScriptInjection(){const e=this.createSurveyBridgeScript(),t=()=>{try{if(!this.iframeElement?.contentWindow)return!1;const t=this.iframeElement.contentDocument||this.iframeElement.contentWindow.document;if(t&&"complete"===t.readyState){const r=t.createElement("script");return r.textContent=e,t.head.appendChild(r),!0}return"function"==typeof this.iframeElement.contentWindow.eval&&(this.iframeElement.contentWindow.eval(e),!0)}catch(e){return!1}};t()||setTimeout(()=>{t()||setTimeout(()=>{t()||setTimeout(()=>{t()},1e3)},500)},200)}createSurveyBridgeScript(){return"\n (function() {\n // Função notifyHost para compatibilidade com SurveyJS\n window.notifyHost = function(eventName, payload) {\n const message = {\n source: 'akross-survey',\n type: eventName,\n payload,\n ts: Date.now()\n };\n\n // 1) iOS WKWebView\n try {\n if (window.webkit?.messageHandlers?.surveyBridge) {\n window.webkit.messageHandlers.surveyBridge.postMessage(message);\n return;\n }\n } catch (error) {\n console.error('❌ NotifyHost: Erro iOS WKWebView:', error);\n }\n\n // 2) Android WebView (via addJavascriptInterface)\n try {\n if (window.AndroidSurveyBridge?.postMessage) {\n // Em Android é comum aceitar string; envie JSON serializado\n window.AndroidSurveyBridge.postMessage(JSON.stringify(message));\n return;\n }\n } catch (error) {\n console.error('❌ NotifyHost: Erro Android WebView:', error);\n }\n\n // 3) Web (iFrame → janela hospedeira)\n if (window.parent && window.parent !== window) {\n window.parent.postMessage(message, '*');\n }\n };\n })();\n "}getSurveyBridgeScript(){return this.createSurveyBridgeScript()}testCommunication(){if(this.logger.debug("Testing communication with iframe"),this.iframeElement?.contentWindow){const e={source:"akross-survey-test",type:"communication_test",payload:{timestamp:Date.now()}};this.iframeElement.contentWindow.postMessage(e,"*")}}handleSurveyMessage(e){try{switch(this.logger.debug("Survey message received:",e),e.type){case"survey_complete":this.handleSurveyComplete(e.payload);break;case"survey_save":this.handleSurveySave(e.payload);break;case"survey_closed":this.handleSurveyClose();break;case"survey_started":this.handleSurveyStarted(e.payload);break;case"survey_progress":this.handleSurveyProgress(e.payload);break;default:this.logger.warn("Unknown message type:",e.type)}}catch(e){this.logger.error("Error processing survey message:",e)}}processPayload(e,t,r){if(this.logger.debug(`${t} with payload:`,e),e){const i=r(e);this.logger.debug(`${t} data:`,i)}}handleSurveyComplete(e){this.processPayload(e,"🎉 Survey Complete Handler",e=>({answers:e.answers,timeSpent:e.timeSpent,completed:e.completed})),this.isSurveyCompleted=!0}handleSurveySave(e){this.processPayload(e,"💾 Survey Save Handler",e=>({progress:e.progress,answers:e.answers,timestamp:(new Date).toISOString()}))}handleSurveyClose(){this.logger.debug("Survey close requested. Completed:",this.isSurveyCompleted),this.isSurveyClosed=!0,this.executeBackButtonLogic()}handleSurveyStarted(e){this.processPayload(e,"🚀 Survey Started Handler",e=>({surveyId:e.surveyId,timestamp:(new Date).toISOString(),userAgent:navigator.userAgent}))}handleSurveyProgress(e){this.processPayload(e,"📊 Survey Progress Handler",e=>({progress:e.progress,currentPage:e.currentPage,totalPages:e.totalPages,timestamp:(new Date).toISOString()}))}executeBackButtonLogic(){this.isSurveyCompleted?this.finishWithResult(u.REWARDED):this.finishWithResult(u.CANCELED)}finishWithResult(e){if(this.logger.debug("Finishing survey overlay with result:",e),this.cleanup(),this.onResultCallback){const t=new w({media:this.media,result:e});this.onResultCallback(t)}}setElementVisibility(e,t,r="block"){e&&(e.style.display=t?r:"none")}showErrorInterface(e="Erro ao carregar a pesquisa"){if(this.errorElement){const t=this.errorElement.querySelector(".aa-survey-error-message");t&&(t.textContent=e),this.setElementVisibility(this.errorElement,!0,"flex")}this.setElementVisibility(this.iframeElement,!1),this.hideLoading()}hideErrorInterface(){this.setElementVisibility(this.errorElement,!1),this.setElementVisibility(this.iframeElement,!0)}showLoading(){this.setElementVisibility(this.loadingElement,!0)}hideLoading(){this.setElementVisibility(this.loadingElement,!1)}darkenColor(e,t){const r=parseInt(e.replace("#",""),16),i=Math.round(2.55*t),n=(r>>16)-i,a=(r>>8&255)-i,s=(255&r)-i;return"#"+(16777216+65536*(n<255?n<1?0:n:255)+256*(a<255?a<1?0:a:255)+(s<255?s<1?0:s:255)).toString(16).slice(1)}cleanup(){this._messageHandler&&(window.removeEventListener("message",this._messageHandler),this._messageHandler=null),this.overlayElement&&this.overlayElement.parentNode&&this.overlayElement.parentNode.removeChild(this.overlayElement),this.overlayElement=null,this.iframeElement=null,this.loadingElement=null,this.errorElement=null,this.retryButton=null,this.closeButton=null}}ue.OVERLAY_CSS="\n .aa-survey-overlay {\n display: block;\n position: fixed;\n z-index: 1;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .aa-survey-dialog {\n background-color: white;\n border-radius: 8px;\n position: relative;\n width: 100%;\n max-width: 95vw;\n height: 95vh;\n overflow: hidden;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n }\n\n .aa-survey-content {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .aa-survey-iframe {\n width: 100%;\n height: 100%;\n border: none;\n }\n\n .aa-survey-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n z-index: 10;\n }\n\n .aa-survey-error {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: white;\n display: none;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding: 20px;\n }\n\n .closeButton {\n display: flex;\n position: absolute;\n top: 10px;\n right: 10px;\n background-color: rgba(0, 0, 0, 0.8);\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n width: 40px;\n height: 40px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n font-size: 0;\n transition: all 0.2s ease;\n z-index: 10;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);\n }\n\n .closeButton::before,\n .closeButton::after {\n content: '';\n position: absolute;\n width: 20px;\n height: 2px;\n background-color: white;\n border-radius: 1px;\n }\n\n .closeButton::before {\n transform: rotate(45deg);\n }\n\n .closeButton::after {\n transform: rotate(-45deg);\n }\n\n .closeButton:hover {\n background-color: rgba(0, 0, 0, 0.9);\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ";var he,ge,pe,me={},fe={};function ve(){if(he)return fe;function e(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}he=1;var t=e({HTML:"text/html",isHTML:function(e){return e===t.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),i={find:function(e,t,r){if(void 0===r&&(r=Array.prototype),e&&"function"==typeof r.find)return r.find.call(e,t);for(var i=0;i<e.length;i++)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];if(t.call(void 0,n,i,e))return n}},freeze:e,NAMESPACE:r},n=i.find,a=i.NAMESPACE;function s(e){return""!==e}function o(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function l(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(s):[]}(e);return Object.keys(t.reduce(o,{}))}function c(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function d(e,t){var r=e.prototype;if(!(r instanceof t)){function i(){}i.prototype=t.prototype,c(r,i=new i),e.prototype=r=i}r.constructor!=e&&(r.constructor=e)}var u={},h=u.ELEMENT_NODE=1,g=u.ATTRIBUTE_NODE=2,p=u.TEXT_NODE=3,m=u.CDATA_SECTION_NODE=4,f=u.ENTITY_REFERENCE_NODE=5,v=u.ENTITY_NODE=6,E=u.PROCESSING_INSTRUCTION_NODE=7,y=u.COMMENT_NODE=8,w=u.DOCUMENT_NODE=9,b=u.DOCUMENT_TYPE_NODE=10,A=u.DOCUMENT_FRAGMENT_NODE=11,R=u.NOTATION_NODE=12,T={},k={};T.INDEX_SIZE_ERR=(k[1]="Index size error",1),T.DOMSTRING_SIZE_ERR=(k[2]="DOMString size error",2);var I=T.HIERARCHY_REQUEST_ERR=(k[3]="Hierarchy request error",3);T.WRONG_DOCUMENT_ERR=(k[4]="Wrong document",4),T.INVALID_CHARACTER_ERR=(k[5]="Invalid character",5),T.NO_DATA_ALLOWED_ERR=(k[6]="No data allowed",6),T.NO_MODIFICATION_ALLOWED_ERR=(k[7]="No modification allowed",7);var C=T.NOT_FOUND_ERR=(k[8]="Not found",8);T.NOT_SUPPORTED_ERR=(k[9]="Not supported",9);var D=T.INUSE_ATTRIBUTE_ERR=(k[10]="Attribute in use",10);function S(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,k[e]),this.message=k[e],Error.captureStackTrace&&Error.captureStackTrace(this,S);return r.code=e,t&&(this.message=this.message+": "+t),r}function L(){}function N(e,t){this._node=e,this._refresh=t,x(this)}function x(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(we(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var i=r.length;i in e;i++)Object.prototype.hasOwnProperty.call(e,i)&&delete e[i];c(r,e),e._inc=t}}function M(){}function O(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function U(e,t,r,i){if(i?t[O(t,i)]=r:t[t.length++]=r,e){r.ownerElement=e;var n=e.ownerDocument;n&&(i&&H(n,e,i),function(e,t,r){e&&e._inc++,r.namespaceURI===a.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}(n,e,r))}}function P(e,t,r){var i=O(t,r);if(!(i>=0))throw new S(C,new Error(e.tagName+"@"+r));for(var n=t.length-1;i<n;)t[i]=t[++i];if(t.length=n,e){var a=e.ownerDocument;a&&(H(a,e,r),r.ownerElement=null)}}function V(){}function _(){}function q(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function F(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(F(e,t))return!0}while(e=e.nextSibling)}function B(){this.ownerDocument=this}function H(e,t,r,i){e&&e._inc++,r.namespaceURI===a.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function W(e,t,r){if(e&&e._inc){e._inc++;var i=t.childNodes;if(r)i[i.length++]=r;else{for(var n=t.firstChild,a=0;n;)i[a++]=n,n=n.nextSibling;i.length=a,delete i[i.length]}}}function z(e,t){var r=t.previousSibling,i=t.nextSibling;return r?r.nextSibling=i:e.firstChild=i,i?i.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,W(e.ownerDocument,e),t}function K(e){return e&&e.nodeType===_.DOCUMENT_TYPE_NODE}function G(e){return e&&e.nodeType===_.ELEMENT_NODE}function j(e){return e&&e.nodeType===_.TEXT_NODE}function $(e,t){var r=e.childNodes||[];if(n(r,G)||K(t))return!1;var i=n(r,K);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Y(e,t){var r=e.childNodes||[];if(n(r,function(e){return G(e)&&e!==t}))return!1;var i=n(r,K);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Q(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===_.DOCUMENT_FRAGMENT_NODE){var s=a.filter(G);if(s.length>1||n(a,j))throw new S(I,"More than one element or text in fragment");if(1===s.length&&!$(e,r))throw new S(I,"Element in fragment can not be inserted before doctype")}if(G(t)&&!$(e,r))throw new S(I,"Only one element can be added and only after doctype");if(K(t)){if(n(i,K))throw new S(I,"Only one doctype is allowed");var o=n(i,G);if(r&&i.indexOf(o)<i.indexOf(r))throw new S(I,"Doctype can only be inserted before an element");if(!r&&o)throw new S(I,"Doctype can not be appended since element is present")}}function X(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===_.DOCUMENT_FRAGMENT_NODE){var s=a.filter(G);if(s.length>1||n(a,j))throw new S(I,"More than one element or text in fragment");if(1===s.length&&!Y(e,r))throw new S(I,"Element in fragment can not be inserted before doctype")}if(G(t)&&!Y(e,r))throw new S(I,"Only one element can be added and only after doctype");if(K(t)){function l(e){return K(e)&&e!==r}if(n(i,l))throw new S(I,"Only one doctype is allowed");var o=n(i,G);if(r&&i.indexOf(o)<i.indexOf(r))throw new S(I,"Doctype can only be inserted before an element")}}function J(e,t,r,i){(function(e,t,r){if(!function(e){return e&&(e.nodeType===_.DOCUMENT_NODE||e.nodeType===_.DOCUMENT_FRAGMENT_NODE||e.nodeType===_.ELEMENT_NODE)}(e))throw new S(I,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new S(C,"child not in parent");if(!function(e){return e&&(G(e)||j(e)||K(e)||e.nodeType===_.DOCUMENT_FRAGMENT_NODE||e.nodeType===_.COMMENT_NODE||e.nodeType===_.PROCESSING_INSTRUCTION_NODE)}(t)||K(t)&&e.nodeType!==_.DOCUMENT_NODE)throw new S(I,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)})(e,t,r),e.nodeType===_.DOCUMENT_NODE&&(i||Q)(e,t,r);var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===A){var a=t.firstChild;if(null==a)return t;var s=t.lastChild}else a=s=t;var o=r?r.previousSibling:e.lastChild;a.previousSibling=o,s.nextSibling=r,o?o.nextSibling=a:e.firstChild=a,null==r?e.lastChild=s:r.previousSibling=s;do{a.parentNode=e}while(a!==s&&(a=a.nextSibling));return W(e.ownerDocument||e,e),t.nodeType==A&&(t.firstChild=t.lastChild=null),t}function Z(){this._nsMap={}}function ee(){}function te(){}function re(){}function ie(){}function ne(){}function ae(){}function se(){}function oe(){}function le(){}function ce(){}function de(){}function ue(){}function ge(e,t){var r=[],i=9==this.nodeType&&this.documentElement||this,n=i.prefix,a=i.namespaceURI;if(a&&null==n&&null==(n=i.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return ve(this,r,e,t,s),r.join("")}function pe(e,t,r){var i=e.prefix||"",n=e.namespaceURI;if(!n)return!1;if("xml"===i&&n===a.XML||n===a.XMLNS)return!1;for(var s=r.length;s--;){var o=r[s];if(o.prefix===i)return o.namespace!==n}return!0}function me(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,q),'"')}function ve(e,t,r,i,n){if(n||(n=[]),i){if(!(e=i(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case h:var s=e.attributes,o=s.length,l=e.firstChild,c=e.tagName,d=c;if(!(r=a.isHTML(e.namespaceURI)||r)&&!e.prefix&&e.namespaceURI){for(var u,v=0;v<s.length;v++)if("xmlns"===s.item(v).name){u=s.item(v).value;break}if(!u)for(var R=n.length-1;R>=0;R--)if(""===(T=n[R]).prefix&&T.namespace===e.namespaceURI){u=T.namespace;break}if(u!==e.namespaceURI)for(R=n.length-1;R>=0;R--){var T;if((T=n[R]).namespace===e.namespaceURI){T.prefix&&(d=T.prefix+":"+c);break}}}t.push("<",d);for(var k=0;k<o;k++)"xmlns"==(I=s.item(k)).prefix?n.push({prefix:I.localName,namespace:I.value}):"xmlns"==I.nodeName&&n.push({prefix:"",namespace:I.value});for(k=0;k<o;k++){var I,C,D;pe(I=s.item(k),0,n)&&(me(t,(C=I.prefix||"")?"xmlns:"+C:"xmlns",D=I.namespaceURI),n.push({prefix:C,namespace:D})),ve(I,t,r,i,n)}if(c===d&&pe(e,0,n)&&(me(t,(C=e.prefix||"")?"xmlns:"+C:"xmlns",D=e.namespaceURI),n.push({prefix:C,namespace:D})),l||r&&!/^(?:meta|link|img|br|hr|input)$/i.test(c)){if(t.push(">"),r&&/^script$/i.test(c))for(;l;)l.data?t.push(l.data):ve(l,t,r,i,n.slice()),l=l.nextSibling;else for(;l;)ve(l,t,r,i,n.slice()),l=l.nextSibling;t.push("</",d,">")}else t.push("/>");return;case w:case A:for(l=e.firstChild;l;)ve(l,t,r,i,n.slice()),l=l.nextSibling;return;case g:return me(t,e.name,e.value);case p:return t.push(e.data.replace(/[<&>]/g,q));case m:return t.push("<![CDATA[",e.data,"]]>");case y:return t.push("\x3c!--",e.data,"--\x3e");case b:var S=e.publicId,L=e.systemId;if(t.push("<!DOCTYPE ",e.name),S)t.push(" PUBLIC ",S),L&&"."!=L&&t.push(" ",L),t.push(">");else if(L&&"."!=L)t.push(" SYSTEM ",L,">");else{var N=e.internalSubset;N&&t.push(" [",N,"]"),t.push(">")}return;case E:return t.push("<?",e.target," ",e.data,"?>");case f:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Ee(e,t,r){var i;switch(t.nodeType){case h:(i=t.cloneNode(!1)).ownerDocument=e;case A:break;case g:r=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,r)for(var n=t.firstChild;n;)i.appendChild(Ee(e,n,r)),n=n.nextSibling;return i}function ye(e,t,r){var i=new t.constructor;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var a=t[n];"object"!=typeof a&&a!=i[n]&&(i[n]=a)}switch(t.childNodes&&(i.childNodes=new L),i.ownerDocument=e,i.nodeType){case h:var s=t.attributes,o=i.attributes=new M,l=s.length;o._ownerElement=i;for(var c=0;c<l;c++)i.setAttributeNode(ye(e,s.item(c),!0));break;case g:r=!0}if(r)for(var d=t.firstChild;d;)i.appendChild(ye(e,d,r)),d=d.nextSibling;return i}function we(e,t,r){e[t]=r}T.INVALID_STATE_ERR=(k[11]="Invalid state",11),T.SYNTAX_ERR=(k[12]="Syntax error",12),T.INVALID_MODIFICATION_ERR=(k[13]="Invalid modification",13),T.NAMESPACE_ERR=(k[14]="Invalid namespace",14),T.INVALID_ACCESS_ERR=(k[15]="Invalid access",15),S.prototype=Error.prototype,c(T,S),L.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var r=[],i=0;i<this.length;i++)ve(this[i],r,e,t);return r.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},N.prototype.item=function(e){return x(this),this[e]||null},d(N,L),M.prototype={length:0,item:L.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new S(D);var r=this.getNamedItem(e.nodeName);return U(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new S(D);return t=this.getNamedItemNS(e.namespaceURI,e.localName),U(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return P(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return P(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var i=this[r];if(i.localName==t&&i.namespaceURI==e)return i}return null}},V.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var i=new B;if(i.implementation=this,i.childNodes=new L,i.doctype=r||null,r&&i.appendChild(r),t){var n=i.createElementNS(e,t);i.appendChild(n)}return i},createDocumentType:function(e,t,r){var i=new ae;return i.name=e,i.nodeName=e,i.publicId=t||"",i.systemId=r||"",i}},_.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return J(this,e,t)},replaceChild:function(e,t){J(this,e,t,X),t&&this.removeChild(t)},removeChild:function(e){return z(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ye(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==p&&e.nodeType==p?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&r[i]===e)return i;t=t.nodeType==g?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==g?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},c(u,_),c(u,_.prototype),B.prototype={nodeName:"#document",nodeType:w,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==A){for(var r=e.firstChild;r;){var i=r.nextSibling;this.insertBefore(r,t),r=i}return e}return J(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===h&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),z(this,e)},replaceChild:function(e,t){J(this,e,t,X),e.ownerDocument=this,t&&this.removeChild(t),G(e)&&(this.documentElement=e)},importNode:function(e,t){return Ee(this,e,t)},getElementById:function(e){var t=null;return F(this.documentElement,function(r){if(r.nodeType==h&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=l(e);return new N(this,function(r){var i=[];return t.length>0&&F(r.documentElement,function(n){if(n!==r&&n.nodeType===h){var a=n.getAttribute("class");if(a){var s=e===a;if(!s){var o=l(a);s=t.every((c=o,function(e){return c&&-1!==c.indexOf(e)}))}s&&i.push(n)}}var c}),i})},createElement:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new L,(t.attributes=new M)._ownerElement=t,t},createDocumentFragment:function(){var e=new ce;return e.ownerDocument=this,e.childNodes=new L,e},createTextNode:function(e){var t=new re;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new ie;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ne;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new de;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new ee;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new le;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Z,i=t.split(":"),n=r.attributes=new M;return r.childNodes=new L,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,n._ownerElement=r,r},createAttributeNS:function(e,t){var r=new ee,i=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,r}},d(B,_),Z.prototype={nodeType:h,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===A?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,W(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var i=this.ownerDocument.createAttributeNS(e,t);i.value=i.nodeValue=""+r,this.setAttributeNode(i)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new N(this,function(t){var r=[];return F(t,function(i){i===t||i.nodeType!=h||"*"!==e&&i.tagName!=e||r.push(i)}),r})},getElementsByTagNameNS:function(e,t){return new N(this,function(r){var i=[];return F(r,function(n){n===r||n.nodeType!==h||"*"!==e&&n.namespaceURI!==e||"*"!==t&&n.localName!=t||i.push(n)}),i})}},B.prototype.getElementsByTagName=Z.prototype.getElementsByTagName,B.prototype.getElementsByTagNameNS=Z.prototype.getElementsByTagNameNS,d(Z,_),ee.prototype.nodeType=g,d(ee,_),te.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(k[I])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){r=this.data.substring(0,e)+r+this.data.substring(e+t),this.nodeValue=this.data=r,this.length=r.length}},d(te,_),re.prototype={nodeName:"#text",nodeType:p,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},d(re,te),ie.prototype={nodeName:"#comment",nodeType:y},d(ie,te),ne.prototype={nodeName:"#cdata-section",nodeType:m},d(ne,te),ae.prototype.nodeType=b,d(ae,_),se.prototype.nodeType=R,d(se,_),oe.prototype.nodeType=v,d(oe,_),le.prototype.nodeType=f,d(le,_),ce.prototype.nodeName="#document-fragment",ce.prototype.nodeType=A,d(ce,_),de.prototype.nodeType=E,d(de,_),ue.prototype.serializeToString=function(e,t,r){return ge.call(e,t,r)},_.prototype.toString=ge;try{if(Object.defineProperty){function et(e){switch(e.nodeType){case h:case A:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(et(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(N.prototype,"length",{get:function(){return x(this),this.$$length}}),Object.defineProperty(_.prototype,"textContent",{get:function(){return et(this)},set:function(e){switch(this.nodeType){case h:case A:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),we=function(e,t,r){e["$$"+t]=r}}}catch(tt){}var be,Ae,Re=V,Te=ue,ke=(be=function(e,t){var r=i.freeze;t.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES},be(Ae={path:undefined,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&Ae.path)}},Ae.exports),Ae.exports),Ie=i.NAMESPACE,Ce=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,De=new RegExp("[\\-\\.0-9"+Ce.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Se=new RegExp("^"+Ce.source+De.source+"*(?::"+Ce.source+De.source+"*)?$");function Le(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Le)}function Ne(){}function xe(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Me(e,t,r,i,n,a){function s(e,t,i){r.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),r.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,n),i)}for(var o,l=++t,c=0;;){var d=e.charAt(l);switch(d){case"=":if(1===c)o=e.slice(t,l),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(a.warning('attribute value must after "="'),o=e.slice(t,l)),t=l+1,!((l=e.indexOf(d,t))>0))throw new Error("attribute value no end '"+d+"' match");s(o,u=e.slice(t,l),t-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');s(o,u=e.slice(t,l),t),a.warning('attribute "'+o+'" missed start quot('+d+")!!"),t=l+1,c=5}break;case"/":switch(c){case 0:r.setTagName(e.slice(t,l));case 5:case 6:case 7:c=7,r.closed=!0;case 4:case 1:break;case 2:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==c&&r.setTagName(e.slice(t,l)),l;case">":switch(c){case 0:r.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(u=e.slice(t,l)).slice(-1)&&(r.closed=!0,u=u.slice(0,-1));case 2:2===c&&(u=o),4==c?(a.warning('attribute "'+u+'" missed quot(")!'),s(o,u,t)):(Ie.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),s(u,u,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"€":d=" ";default:if(d<=" ")switch(c){case 0:r.setTagName(e.slice(t,l)),c=6;break;case 1:o=e.slice(t,l),c=2;break;case 4:var u=e.slice(t,l);a.warning('attribute "'+u+'" missed quot(")!!'),s(o,u,t);case 5:c=6}else switch(c){case 2:r.tagName,Ie.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=l,c=1;break;case 5:a.warning('attribute space is required"'+o+'"!!');case 6:c=1,t=l;break;case 3:c=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function Oe(e,t,r){for(var i=e.tagName,n=null,a=e.length;a--;){var s=e[a],o=s.qName,l=s.value;if((h=o.indexOf(":"))>0)var c=s.prefix=o.slice(0,h),d=o.slice(h+1),u="xmlns"===c&&d;else d=o,c=null,u="xmlns"===o&&"";s.localName=d,!1!==u&&(null==n&&(n={},Ve(r,r={})),r[u]=n[u]=l,s.uri=Ie.XMLNS,t.startPrefixMapping(u,l))}for(a=e.length;a--;)(c=(s=e[a]).prefix)&&("xml"===c&&(s.uri=Ie.XML),"xmlns"!==c&&(s.uri=r[c||""]));var h;(h=i.indexOf(":"))>0?(c=e.prefix=i.slice(0,h),d=e.localName=i.slice(h+1)):(c=null,d=e.localName=i);var g=e.uri=r[c||""];if(t.startElement(g,d,i,e),!e.closed)return e.currentNSMap=r,e.localNSMap=n,!0;if(t.endElement(g,d,i),n)for(c in n)Object.prototype.hasOwnProperty.call(n,c)&&t.endPrefixMapping(c)}function Ue(e,t,r,i,n){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(r)?(n.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,i),n.characters(s,0,s.length),a)}return t+1}function Pe(e,t,r,i){var n=i[r];return null==n&&((n=e.lastIndexOf("</"+r+">"))<t&&(n=e.lastIndexOf("</"+r)),i[r]=n),n<t}function Ve(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function _e(e,t,r,i){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4))>t?(r.comment(e,t+4,n-t-4),n+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var n=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,n-t-9),r.endCDATA(),n+3}var a=function(e,t){var r,i=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=t,n.exec(e);r=n.exec(e);)if(i.push(r),r[1])return i}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],l=!1,c=!1;s>3&&(/^public$/i.test(a[2][0])?(l=a[3][0],c=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var d=a[s-1];return r.startDTD(o,l,c),r.endDTD(),d.index+d[0].length}return-1}function qe(e,t,r){var i=e.indexOf("?>",t);if(i){var n=e.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(n[0].length,r.processingInstruction(n[1],n[2]),i+2):-1}return-1}function Fe(){this.attributeNames={}}Le.prototype=new Error,Le.prototype.name=Le.name,Ne.prototype={parse:function(e,t,r){var i=this.domBuilder;i.startDocument(),Ve(t,t={}),function(e,t,r,i,n){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(r,t)?r[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(n.error("entity not found:"+e),e)}function s(t){if(t>p){var r=e.substring(p,t).replace(/&#?\w+;/g,a);u&&o(p),i.characters(r,0,t-p),p=t}}function o(t,r){for(;t>=c&&(r=d.exec(e));)l=r.index,c=l+r[0].length,u.lineNumber++;u.columnNumber=t-l+1}for(var l=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,u=i.locator,h=[{currentNSMap:t}],g={},p=0;;){try{var m=e.indexOf("<",p);if(m<0){if(!e.substr(p).match(/^\s*$/)){var f=i.doc,v=f.createTextNode(e.substr(p));f.appendChild(v),i.currentElement=v}return}switch(m>p&&s(m),e.charAt(m+1)){case"/":var E=e.indexOf(">",m+3),y=e.substring(m+2,E).replace(/[ \t\n\r]+$/g,""),w=h.pop();E<0?(y=e.substring(m+2).replace(/[\s<].*/,""),n.error("end tag name: "+y+" is not complete:"+w.tagName),E=m+1+y.length):y.match(/\s</)&&(y=y.replace(/[\s<].*/,""),n.error("end tag name: "+y+" maybe not complete"),E=m+1+y.length);var b=w.localNSMap,A=w.tagName==y;if(A||w.tagName&&w.tagName.toLowerCase()==y.toLowerCase()){if(i.endElement(w.uri,w.localName,y),b)for(var R in b)Object.prototype.hasOwnProperty.call(b,R)&&i.endPrefixMapping(R);A||n.fatalError("end tag name: "+y+" is not match the current start tagName:"+w.tagName)}else h.push(w);E++;break;case"?":u&&o(m),E=qe(e,m,i);break;case"!":u&&o(m),E=_e(e,m,i,n);break;default:u&&o(m);var T=new Fe,k=h[h.length-1].currentNSMap,I=(E=Me(e,m,T,k,a,n),T.length);if(!T.closed&&Pe(e,E,T.tagName,g)&&(T.closed=!0,r.nbsp||n.warning("unclosed xml attribute")),u&&I){for(var C=xe(u,{}),D=0;D<I;D++){var S=T[D];o(S.offset),S.locator=xe(u,{})}i.locator=C,Oe(T,i,k)&&h.push(T),i.locator=u}else Oe(T,i,k)&&h.push(T);Ie.isHTML(T.uri)&&!T.closed?E=Ue(e,E,T.tagName,a,i):E++}}catch(e){if(e instanceof Le)throw e;n.error("element parse error: "+e),E=-1}E>p?p=E:s(Math.max(m,p)+1)}}(e,t,r,i,this.errorHandler),i.endDocument()}},Fe.prototype={setTagName:function(e){if(!Se.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!Se.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var Be=Re,He=i.NAMESPACE,We=Le,ze=Ne;function Ke(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Ge(e){this.options=e||{locator:{}}}function je(){this.cdata=!1}function $e(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Ye(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function Qe(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Ge.prototype.parseFromString=function(e,t){var r=this.options,i=new ze,n=r.domBuilder||new je,a=r.errorHandler,s=r.locator,o=r.xmlns||{},l=/\/x?html?$/.test(t),c=l?ke.HTML_ENTITIES:ke.XML_ENTITIES;s&&n.setDocumentLocator(s),i.errorHandler=function(e,t,r){if(!e){if(t instanceof je)return t;e=t}var i={},n=e instanceof Function;function a(t){var a=e[t];!a&&n&&(a=2==e.length?function(r){e(t,r)}:e),i[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(r))}||function(){}}return r=r||{},a("warning"),a("error"),a("fatalError"),i}(a,n,s),i.domBuilder=r.domBuilder||n,l&&(o[""]=He.HTML),o.xml=o.xml||He.XML;var d=r.normalizeLineEndings||Ke;return e&&"string"==typeof e?i.parse(d(e),o,c):i.errorHandler.error("invalid doc source"),n.doc},je.prototype={startDocument:function(){this.doc=(new Be).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,i){var n=this.doc,a=n.createElementNS(e,r||t),s=i.length;Qe(this,a),this.currentElement=a,this.locator&&$e(this.locator,a);for(var o=0;o<s;o++){e=i.getURI(o);var l=i.getValue(o),c=(r=i.getQName(o),n.createAttributeNS(e,r));this.locator&&$e(i.getLocator(o),c),c.value=c.nodeValue=l,a.setAttributeNode(c)}},endElement:function(e,t,r){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&$e(this.locator,r),Qe(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=Ye.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&$e(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=Ye.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&$e(this.locator,i),Qe(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var i=this.doc.implementation;if(i&&i.createDocumentType){var n=i.createDocumentType(e,t,r);this.locator&&$e(this.locator,n),Qe(this,n),this.doc.doctype=n}},warning:function(e){},error:function(e){},fatalError:function(e){throw new We(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){je.prototype[e]=function(){return null}});var Xe={DOMParser:Ge}.DOMParser,Je={DOMImplementation:Re,XMLSerializer:Te,DOMParser:Xe},Ze=function(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}({__proto__:null,default:Je,DOMImplementation:Re,XMLSerializer:Te,DOMParser:Xe},[Je]);return fe.index=Ze,fe}function Ee(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}Object.defineProperty(me,"__esModule",{value:!0});const ye=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function we(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=[],n=Re(e);!t.ERRORCODE||r.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=De(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING;for(const e in t)t[e]=Ce(t[e]);for(const e in n){const r=n[e];"string"==typeof r&&i.push(be(r,t))}return i}function be(e,t){const r=(e=Ae(e,t)).match(/[^[\]]+(?=])/g);if(!r)return e;let i=r.filter(e=>ye.indexOf(e)>-1);return 0===i.length?e:(i=i.reduce((e,t)=>(e[t]=-1,e),{}),Ae(e,i))}function Ae(e,t){let r=e;for(const e in t){const i=t[e];r=r.replace(new RegExp("(?:\\[|%%)(".concat(e,")(?:\\]|%%)"),"g"),i)}return r}function Re(e){return Array.isArray(e)?e.map(e=>e&&e.hasOwnProperty("url")?e.url:e):e}function Te(e){return/^(https?:\/\/|\/\/)/.test(e)}function ke(e,t){for(let r=0;r<t.length;r++)if(Ie(t[r],e))return!0;return!1}function Ie(e,t){if(e&&t){const r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);return r.length===i.length&&e.id===t.id&&e.url===t.url}return!1}function Ce(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function De(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}const Se={track:function(e,t,r){we(e,t,r).forEach(e=>{"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:we,extractURLsFromTemplates:Re,filterUrlTemplates:function(e){return e.reduce((e,t)=>{const r=t.url||t;return Te(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:ke,isTemplateObjectEqual:Ie,encodeURIComponentRFC3986:Ce,replaceUrlMacros:be,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce((t,r)=>t.concat(Array.isArray(r)?e(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];return r.concat(i).reduce((e,t)=>(ke(t,e)||e.push(t),e),[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:De,isValidUrl:Te,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=typeof e?e:JSON.stringify(e)}};function Le(e){return["true","TRUE","True","1"].includes(e)}function Ne(e){if(null==e)return-1;if(Se.isNumeric(e))return parseInt(e);const t=e.split(":");if(3!==t.length)return-1;const r=t[2].split(".");let i=parseInt(r[0]);2===r.length&&(i+=parseFloat("0.".concat(r[1])));const n=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(n)||isNaN(i)||n>3600||i>60?-1:a+n+i}const xe={childByName:function(e,t){return Array.from(e.childNodes).find(e=>e.nodeName===t)},childrenByName:function(e,t){return Array.from(e.childNodes).filter(e=>e.nodeName===t)},resolveVastAdTagURI:function(e,t){if(!t)return e;if(e.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(e)}if(!e.includes("://")){const r=t.slice(0,t.lastIndexOf("/"));return"".concat(r,"/").concat(e)}return e},parseBoolean:Le,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,r){const i=t.getAttribute(e);i&&r.setAttribute(e,i)},parseAttributes:function(e){return Array.from(e.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:Ne,getStandAloneAds:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>!parseInt(e.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>parseInt(e.sequence,10)).sort((e,t)=>e.sequence-t.sequence)},assignAttributes:function(e,t){e&&Array.from(e).forEach(e=>{let{nodeName:r,nodeValue:i}=e;if(r&&i&&t.hasOwnProperty(r)){let e=i;"boolean"==typeof t[r]&&(e=Le(e)),t[r]=e}})},mergeWrapperAdData:function(e,t){var r;e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[...e.viewableImpression,...t.viewableImpression]),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;const i=(t.creatives||[]).filter(e=>e&&"companion"===e.type),n=i.reduce((e,t)=>((t.variations||[]).forEach(t=>{(t.companionClickTrackingURLTemplates||[]).forEach(t=>{Se.containsTemplateObject(t,e)||e.push(t)})}),e),[]);e.creatives=i.concat(e.creatives);const a=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,s=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;if(e.creatives.forEach(e=>{if(t.trackingEvents&&t.trackingEvents[e.type])for(const r in t.trackingEvents[e.type]){const i=t.trackingEvents[e.type][r];Array.isArray(e.trackingEvents[r])||(e.trackingEvents[r]=[]),e.trackingEvents[r]=e.trackingEvents[r].concat(i)}"linear"===e.type&&(a&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),s&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&n.length&&(e.variations||[]).forEach(e=>{e.companionClickTrackingURLTemplates=Se.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,n)})}),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories)),null!==(r=t.creatives)&&void 0!==r&&r.length){const r=t.creatives.filter(e=>{var t;return(null===(t=e.icons)||void 0===t?void 0:t.length)&&!e.mediaFiles.length});r.length&&(e.creatives=e.creatives.concat(r))}}};function Me(e,t){const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=Ee(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"companion",required:null,variations:[]}}(t);return r.required=e.getAttribute("required")||null,r.variations=xe.childrenByName(e,"Companion").map(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adType:"companionAd",width:e.width||0,height:e.height||0,assetWidth:e.assetWidth||null,assetHeight:e.assetHeight||null,expandedWidth:e.expandedWidth||null,expandedHeight:e.expandedHeight||null,apiFramework:e.apiFramework||null,adSlotId:e.adSlotId||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(xe.parseAttributes(e));t.htmlResources=xe.childrenByName(e,"HTMLResource").reduce((e,t)=>{const r=xe.parseNodeText(t);return r?e.concat(r):e},[]),t.iframeResources=xe.childrenByName(e,"IFrameResource").reduce((e,t)=>{const r=xe.parseNodeText(t);return r?e.concat(r):e},[]),t.staticResources=xe.childrenByName(e,"StaticResource").reduce((e,t)=>{const r=xe.parseNodeText(t);return r?e.concat({url:r,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=xe.parseNodeText(xe.childByName(e,"AltText"))||null;const r=xe.childByName(e,"TrackingEvents");r&&xe.childrenByName(r,"Tracking").forEach(e=>{const r=e.getAttribute("event"),i=xe.parseNodeText(e);r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))}),t.companionClickTrackingURLTemplates=xe.childrenByName(e,"CompanionClickTracking").map(e=>({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})),t.companionClickThroughURLTemplate=xe.parseNodeText(xe.childByName(e,"CompanionClickThrough"))||null;const i=xe.childByName(e,"AdParameters");return i&&(t.adParameters={value:xe.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),r}function Oe(e,t){let r;const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=Ee(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);i.duration=xe.parseDuration(xe.parseNodeText(xe.childByName(e,"Duration")));const n=e.getAttribute("skipoffset");if(null==n)i.skipDelay=null;else if("%"===n.charAt(n.length-1)&&-1!==i.duration){const e=parseInt(n,10);i.skipDelay=i.duration*(e/100)}else i.skipDelay=xe.parseDuration(n);const a=xe.childByName(e,"VideoClicks");if(a){const e=xe.childByName(a,"ClickThrough");i.videoClickThroughURLTemplate=e?{id:e.getAttribute("id")||null,url:xe.parseNodeText(e)}:null,xe.childrenByName(a,"ClickTracking").forEach(e=>{i.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})}),xe.childrenByName(a,"CustomClick").forEach(e=>{i.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})})}const s=xe.childByName(e,"AdParameters");s&&(i.adParameters={value:xe.parseNodeText(s),xmlEncoded:s.getAttribute("xmlEncoded")||null}),xe.childrenByName(e,"TrackingEvents").forEach(e=>{xe.childrenByName(e,"Tracking").forEach(e=>{let t=e.getAttribute("event");const n=xe.parseNodeText(e);if(t&&n){if("progress"===t){if(r=e.getAttribute("offset"),!r)return;t="%"===r.charAt(r.length-1)?"progress-".concat(r):"progress-".concat(xe.parseDuration(r))}Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(n)}})}),xe.childrenByName(e,"MediaFiles").forEach(e=>{xe.childrenByName(e,"MediaFile").forEach(e=>{i.mediaFiles.push(function(e){const t={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};t.id=e.getAttribute("id"),t.fileURL=xe.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);const r=e.getAttribute("scalable");r&&"string"==typeof r&&(t.scalable=xe.parseBoolean(r));const i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=xe.parseBoolean(i)),t}(e))});const t=xe.childByName(e,"InteractiveCreativeFile");t&&(i.interactiveCreativeFile=function(e){const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:xe.parseBoolean(e.variableDuration),fileURL:null}}(xe.parseAttributes(e));return t.fileURL=xe.parseNodeText(e),t}(t));const r=xe.childByName(e,"ClosedCaptionFiles");r&&xe.childrenByName(r,"ClosedCaptionFile").forEach(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(xe.parseAttributes(e));t.fileURL=xe.parseNodeText(e),i.closedCaptionFiles.push(t)});const n=xe.childByName(e,"Mezzanine"),a=function(e){const t={};let r=!1;return["delivery","type","width","height"].forEach(i=>{e&&e.getAttribute(i)?t[i]=e.getAttribute(i):r=!0}),r?null:t}(n);if(a){const e={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};e.id=n.getAttribute("id"),e.fileURL=xe.parseNodeText(n),e.delivery=a.delivery,e.codec=n.getAttribute("codec"),e.type=a.type,e.width=parseInt(a.width,10),e.height=parseInt(a.height,10),e.fileSize=parseInt(n.getAttribute("fileSize"),10),e.mediaType=n.getAttribute("mediaType")||"2D",i.mezzanine=e}});const o=xe.childByName(e,"Icons");return o&&xe.childrenByName(o,"Icon").forEach(e=>{i.icons.push(function(e){const t={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[],altText:null,hoverText:null};t.program=e.getAttribute("program"),t.height=parseInt(e.getAttribute("height")||0),t.width=parseInt(e.getAttribute("width")||0),t.xPosition=function(e){return-1!==["left","right"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("xPosition")),t.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),t.apiFramework=e.getAttribute("apiFramework"),t.pxratio=e.getAttribute("pxratio")||"1",t.offset=xe.parseDuration(e.getAttribute("offset")),t.duration=xe.parseDuration(e.getAttribute("duration")),t.altText=e.getAttribute("altText"),t.hoverText=e.getAttribute("hoverText"),xe.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=xe.parseNodeText(e)}),xe.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=xe.parseNodeText(e)}),xe.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=xe.parseNodeText(e)});const r=xe.childByName(e,"IconClicks");if(r){t.iconClickThroughURLTemplate=xe.parseNodeText(xe.childByName(r,"IconClickThrough")),xe.childrenByName(r,"IconClickTracking").forEach(e=>{t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})});const e=xe.childByName(r,"IconClickFallbackImages");e&&xe.childrenByName(e,"IconClickFallbackImage").forEach(e=>{t.iconClickFallbackImages.push({url:xe.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return t.iconViewTrackingURLTemplate=xe.parseNodeText(xe.childByName(e,"IconViewTracking")),t}(e))}),i}function Ue(e,t){const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=Ee(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return xe.childrenByName(e,"TrackingEvents").forEach(e=>{let t,i;xe.childrenByName(e,"Tracking").forEach(e=>{t=e.getAttribute("event"),i=xe.parseNodeText(e),t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))})}),xe.childrenByName(e,"NonLinear").forEach(e=>{const t={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.expandedWidth=e.getAttribute("expandedWidth"),t.expandedHeight=e.getAttribute("expandedHeight"),t.scalable=xe.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=xe.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=xe.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),xe.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=xe.parseNodeText(e)}),xe.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=xe.parseNodeText(e)}),xe.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=xe.parseNodeText(e)});const i=xe.childByName(e,"AdParameters");i&&(t.adParameters={value:xe.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=xe.parseNodeText(xe.childByName(e,"NonLinearClickThrough")),xe.childrenByName(e,"NonLinearClickTracking").forEach(e=>{t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})}),r.variations.push(t)}),r}function Pe(e){const t=[];return e.forEach(e=>{const r=Ve(e);r&&t.push(r)}),t}function Ve(e){if("#comment"===e.nodeName)return null;const t={name:null,value:null,attributes:{},children:[]},r=e.attributes,i=e.childNodes;if(t.name=e.nodeName,e.attributes)for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];i.nodeName&&i.nodeValue&&(t.attributes[i.nodeName]=i.nodeValue)}for(const e in i)if(i.hasOwnProperty(e)){const r=Ve(i[e]);r&&t.children.push(r)}if(0===t.children.length||1===t.children.length&&["#cdata-section","#text"].indexOf(t.children[0].name)>=0){const r=xe.parseNodeText(e);""!==r&&(t.value=r),t.children=[]}return null===(n=t).value&&0===Object.keys(n.attributes).length&&0===n.children.length?null:t;var n}function _e(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}const qe={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Fe(e,t){if(!qe[e.nodeName]||!qe[e.nodeName].attributes)return;const r=qe[e.nodeName].attributes.filter(t=>!e.getAttribute(t));r.length>0&&We({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:r},t)}function Be(e,t,r){const i=qe[e.nodeName],n=!r&&"Wrapper"!==e.nodeName;if(i&&!n){if(i.subElements){const r=i.subElements.filter(t=>!xe.childByName(e,t));r.length>0&&We({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:r},t)}r&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(t=>xe.childByName(e,t))||We({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}function He(e){return e.children&&0!==e.children.length}function We(e,t){let{name:r,parentName:i,attributes:n,subElements:a,oneOfResources:s}=e,o="Element '".concat(r,"'");o+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):s?" must provide one of the following '".concat(s.join(", "),"' "):" is empty",t("VAST-warning",{message:o,parentElement:i,specVersion:4.1})}const ze=function e(t,r,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),Fe(t,r),He(t)){Be(t,r,i);for(let n=0;n<t.children.length;n++)e(t.children[n],r,i)}else 0===xe.parseNodeText(t).length&&We({name:t.nodeName,parentName:t.parentNode.nodeName},r)};function Ke(e,t){let{allowMultipleAds:r,followAdditionalWrappers:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=Array.from(e.childNodes).filter(e=>{const t=e.nodeName.toLowerCase();return"inline"===t||!1!==i&&"wrapper"===t});for(const i of n){if(xe.copyNodeAttribute("id",e,i),xe.copyNodeAttribute("sequence",e,i),xe.copyNodeAttribute("adType",e,i),"Wrapper"===i.nodeName)return{ad:$e(i,t),type:"WRAPPER"};if("InLine"===i.nodeName)return{ad:Ge(i,t,{allowMultipleAds:r}),type:"INLINE"};const n=i.nodeName.toLowerCase();t("VAST-warning",{message:"<".concat(i.nodeName,"inline"===n?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:i})}}function Ge(e,t){let{allowMultipleAds:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!1===r&&e.getAttribute("sequence")?null:je(e,t)}function je(e,t){let r=[];t&&ze(e,t);const i=Array.from(e.childNodes),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,sequence:e.sequence||null,adType:e.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(xe.parseAttributes(e));return i.forEach(e=>{switch(e.nodeName){case"Error":n.errorURLTemplates.push(xe.parseNodeText(e));break;case"Impression":n.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)});break;case"Creatives":n.creatives=function(e){const t=[];return e.forEach(e=>{const r={id:e.getAttribute("id")||null,adId:_e(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];let n;xe.childrenByName(e,"UniversalAdId").forEach(e=>{const t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:xe.parseNodeText(e)};i.push(t)});const a=xe.childByName(e,"CreativeExtensions");a&&(n=Pe(xe.childrenByName(a,"CreativeExtension")));for(const a in e.childNodes){const s=e.childNodes[a];let o;switch(s.nodeName){case"Linear":o=Oe(s,r);break;case"NonLinearAds":o=Ue(s,r);break;case"CompanionAds":o=Me(s,r)}o&&(i&&(o.universalAdIds=i),n&&(o.creativeExtensions=n),t.push(o))}}),t}(xe.childrenByName(e,"Creative"));break;case"Extensions":{const t=xe.childrenByName(e,"Extension");n.extensions=Pe(t),n.adVerifications.length||(r=function(e){let t=null,r=[];return e.some(e=>t=xe.childByName(e,"AdVerifications")),t&&(r=Ye(xe.childrenByName(t,"Verification"))),r}(t));break}case"AdVerifications":n.adVerifications=Ye(xe.childrenByName(e,"Verification"));break;case"AdSystem":n.system={value:xe.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":n.title=xe.parseNodeText(e);break;case"AdServingId":n.adServingId=xe.parseNodeText(e);break;case"Category":n.categories.push({authority:e.getAttribute("authority")||null,value:xe.parseNodeText(e)});break;case"Expires":n.expires=parseInt(xe.parseNodeText(e),10);break;case"ViewableImpression":n.viewableImpression.push(function(e){const t=(e,t)=>{const r=xe.parseNodeText(t);return r&&e.push(r),e};return{id:e.getAttribute("id")||null,viewable:xe.childrenByName(e,"Viewable").reduce(t,[]),notViewable:xe.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:xe.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":n.description=xe.parseNodeText(e);break;case"Advertiser":n.advertiser={id:e.getAttribute("id")||null,value:xe.parseNodeText(e)};break;case"Pricing":n.pricing={value:xe.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":n.survey={value:xe.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:xe.parseNodeText(e)})}}),r.length&&(n.adVerifications=n.adVerifications.concat(r)),n}function $e(e,t){const r=je(e,t),i=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");r.followAdditionalWrappers=!i||xe.parseBoolean(i),r.allowMultipleAds=!!n&&xe.parseBoolean(n),r.fallbackOnNoAd=a?xe.parseBoolean(a):null;let s=xe.childByName(e,"VASTAdTagURI");if(s?r.nextWrapperURL=xe.parseNodeText(s):(s=xe.childByName(e,"VASTAdTagURL"),s&&(r.nextWrapperURL=xe.parseNodeText(xe.childByName(s,"URL")))),r.creatives.forEach(e=>{if(["linear","nonlinear"].includes(e.type)){if(e.trackingEvents){r.trackingEvents||(r.trackingEvents={}),r.trackingEvents[e.type]||(r.trackingEvents[e.type]={});for(const t in e.trackingEvents){const i=e.trackingEvents[t];Array.isArray(r.trackingEvents[e.type][t])||(r.trackingEvents[e.type][t]=[]),i.forEach(i=>{r.trackingEvents[e.type][t].push(i)})}}e.videoClickTrackingURLTemplates&&(Array.isArray(r.videoClickTrackingURLTemplates)||(r.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach(e=>{r.videoClickTrackingURLTemplates.push(e)})),e.videoClickThroughURLTemplate&&(r.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(r.videoCustomClickURLTemplates)||(r.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach(e=>{r.videoCustomClickURLTemplates.push(e)}))}}),r.nextWrapperURL)return r}function Ye(e){const t=[];return e.forEach(e=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},i=Array.from(e.childNodes);xe.assignAttributes(e.attributes,r),i.forEach(e=>{let{nodeName:t,textContent:i,attributes:n}=e;switch(t){case"JavaScriptResource":case"ExecutableResource":r.resource=i.trim(),xe.assignAttributes(n,r);break;case"VerificationParameters":r.parameters=i.trim()}});const n=xe.childByName(e,"TrackingEvents");n&&xe.childrenByName(n,"Tracking").forEach(e=>{const t=e.getAttribute("event"),i=xe.parseNodeText(e);t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))}),t.push(r)}),t}class Qe{constructor(){this._handlers=[]}on(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(e,t,r){const i={fired:!1,wrapFn:void 0};function n(){i.fired||(e.off(t,i.wrapFn),i.fired=!0,r.bind(e)(...arguments))}return i.wrapFn=n,n}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];let n=!1;return this._handlers.forEach(t=>{"*"===t.event&&(n=!0,t.handler(e,...r)),t.event===e&&(n=!0,t.handler(...r))}),n}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let Xe=0,Je=0;const Ze=(e,t)=>{!e||!t||e<=0||t<=0||(Je=(Je*Xe+8*e/t)/++Xe)},et={ERRORCODE:900,extensions:[]},tt="VAST response version not supported";class rt extends Qe{constructor(){let{fetcher:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null,this.keepFailedAdPod=!1}trackVastError(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},et,t,...i)),Se.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return Je}initParsingStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),Ze(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(e=>this.buildVASTResponse(e))}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(e=>this.buildVASTResponse(e))}buildVASTResponse(e){const t=function(e){let{ads:t,errorURLTemplates:r,version:i}=e;return{ads:t||[],errorURLTemplates:r||[],version:i||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:i=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:s}=t;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var o;this.emit("VAST-ad-parsed",{type:"ERROR",url:i,wrapperDepth:n});const t="VideoAdServingTemplate"===(null==e||null===(o=e.documentElement)||void 0===o?void 0:o.nodeName);throw new Error(t?tt:"Invalid VAST XMLDocument")}const l=[],c=e.documentElement.childNodes,d=e.documentElement.getAttribute("version");r&&d&&(this.vastVersion=d);for(const e in c){const t=c[e];if("Error"===t.nodeName){const e=xe.parseNodeText(t);r?this.rootErrorURLTemplates.push(e):this.errorURLTemplates.push(e)}else if("Ad"===t.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(!1===a&&l.length>1)break;const e=Ke(t,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:s});e.ad?(l.push(e.ad),this.emit("VAST-ad-parsed",{type:e.type,url:i,wrapperDepth:n,adIndex:l.length-1,vastVersion:d})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return l}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:i=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:s=!1,followAdditionalWrappers:o,allowMultipleAds:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&s&&(l=!0);try{c=this.parseVastXml(e,{isRootVAST:s,url:t,wrapperDepth:a,allowMultipleAds:l,followAdditionalWrappers:o})}catch(e){return Promise.reject(e)}if(1===c.length&&null!=i&&(c[0].sequence=i),!1===r){const e=xe.getSortedAdPods(c),t=xe.getStandAloneAds(c);e.length?c=e:t.length&&(c=[t.shift()]),this.remainingAds=t}return this.resolveAds(c,{wrapperDepth:a,previousUrl:n,url:t})}resolveAds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:i}=arguments.length>1?arguments[1]:void 0;const n=[];return r=i,e.forEach(e=>{const i=this.resolveWrappers(e,t,r);n.push(i)}),Promise.all(n).then(e=>Se.flatten(e))}resolveWrappers(e,t,r){const i={...e};return new Promise(e=>{var n;if(t++,!i.nextWrapperURL)return delete i.nextWrapperURL,e(i);if(!this.fetcher)return i.VASTAdTagURI=i.nextWrapperURL,delete i.nextWrapperURL,e(i);if(t>=this.maxWrapperDepth)return i.errorCode=302,delete i.nextWrapperURL,e(i);i.nextWrapperURL=xe.resolveVastAdTagURI(i.nextWrapperURL,r);const a=null!==(n=this.parsingOptions.allowMultipleAds)&&void 0!==n?n:i.allowMultipleAds,s=i.sequence;this.fetcher.fetchVAST({url:i.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(n=>this.parse(n,{url:i.nextWrapperURL,previousUrl:r,wrapperSequence:s,wrapperDepth:t,followAdditionalWrappers:i.followAdditionalWrappers,allowMultipleAds:a}).then(t=>{if(delete i.nextWrapperURL,0===t.length)return i.creatives=[],e(i);t.forEach(e=>{e&&xe.mergeWrapperAdData(e,i)}),e(t)})).catch(t=>{i.errorCode=t.message===tt?102:301,i.errorMessage=t.message,e(i)})})}completeWrapperResolving(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const r=e.ads[t],i=!r.creatives.some(e=>{var t,r;return(null===(t=e.mediaFiles)||void 0===t?void 0:t.length)>0||(null===(r=e.variations)||void 0===r?void 0:r.length)>0});!r.errorCode&&!i||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),this.keepFailedAdPod&&r.sequence?r.hasFailed=!0:e.ads.splice(t,1))}}}let it=null;const nt={data:{},length:0,getItem(e){return this.data[e]},setItem(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem(e){delete this.data[e],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class at{constructor(){this.storage=this.initStorage()}initStorage(){if(it)return it;try{it="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){it=null}return it&&!this.isStorageDisabled(it)||(it=nt,it.clear()),it}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(e){return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const st=12e4,ot={get:async function(e,t){try{const r=new AbortController,i=setTimeout(()=>{throw r.abort(),new Error("URLHandler: Request timed out after ".concat(t.timeout||st," ms (408)"))},t.timeout||st),n=await fetch(e,{...t,signal:r.signal,credentials:t.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(i)}),a=function(e){return Se.isBrowserEnvironment()&&"https:"===window.location.protocol&&e.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":200===e.status&&e.ok?null:"URLHandler: ".concat(e.statusText," (").concat(e.status,")")}(n);return a?{error:new Error(a),statusCode:n.status}:async function(e){const t=await e.text();let r;return r=Se.isBrowserEnvironment()?new DOMParser:new((await Promise.resolve().then(function(){return ve()}).then(function(e){return e.index})).DOMParser),{xml:r.parseFromString(t,"text/xml"),details:{byteLength:t.length,statusCode:e.status,rawXml:t}}}(n)}catch(e){return{error:e,statusCode:"AbortError"===e.name?408:null}}}};class lt{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||ot,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||st,withCredentials:Boolean(e.withCredentials)}}addURLTemplateFilter(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:r,maxWrapperDepth:i,emitter:n,wrapperDepth:a=0,previousUrl:s=null,wrapperAd:o=null}=e;const l=Date.now();this.URLTemplateFilters.forEach(e=>{r=e(r)}),n("VAST-resolving",{url:r,previousUrl:s,wrapperDepth:a,maxWrapperDepth:i,timeout:this.fetchingOptions.timeout,wrapperAd:o});const c=await this.urlHandler.get(r,this.fetchingOptions),d=Math.round(Date.now()-l);if(n("VAST-resolved",{url:r,previousUrl:s,wrapperDepth:a,error:(null==c?void 0:c.error)||null,duration:d,statusCode:(null==c?void 0:c.statusCode)||null,...null==c?void 0:c.details}),Ze(null==c||null===(t=c.details)||void 0===t?void 0:t.byteLength,d),c.error)throw new Error(c.error);return c.xml}}function ct(e){if(!e?.fileURL)return!1;if("vpaid"===(e.apiFramework||"").toLowerCase())return!1;const t=(e.mimeType||"").toLowerCase();return t.startsWith("video/")||""===t}pe=me.VASTClient=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new at;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new lt,this.vastParser=new rt({fetcher:this.fetcher}),this.storage=r,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((i,n)=>{if(this.cappingFreeLunch>=this.totalCalls)return n(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return n(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(r=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(r,t).then(e=>{const t=this.vastParser.buildVASTResponse(e);i(t)}))).catch(e=>n(e))})}},me.VASTParser=rt,ge=me.VASTTracker=class extends Qe{constructor(e,t,r){var i;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=a,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const e in this.creative.trackingEvents){const t=this.creative.trackingEvents[e];this.trackingEvents[e]=t.slice(0)}this.viewableImpressionTrackers=(null===(i=this.ad.viewableImpression)||void 0===i?void 0:i.reduce((e,t)=>(e.notViewable.push(...t.notViewable),e.viewUndetermined.push(...t.viewUndetermined),e.viewable.push(...t.viewable),e),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach(e=>{let[t,r]=e;r.length&&(this.trackingEvents[t]=r)}),function(e){return"linear"===e.type}(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}"nonLinearAd"===this.variation.adType?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return"companionAd"===e.adType}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){Se.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!Se.isValidTimeValue(e)||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))});const i=this.skipDelay||-1;if(-1===i||this.skippable||(i>e?this.emit("skip-countdown",i-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const i=Math.round(e/this.assetDuration*100),n=[];if(e>0){n.push("start");for(let e=this.lastPercentage;e<i;e++)n.push("progress-".concat(e+1,"%"));n.push("progress-".concat(e));for(const t in this.quartiles)this.isQuartileReached(t,this.quartiles[t],e)&&(n.push(t),this._alreadyTriggeredQuartiles[t]=!0);this.lastPercentage=i}n.forEach(e=>{this.track(e,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let i=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(i=!0),i}setMuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}setSkipDelay(e){Se.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e&&"boolean"==typeof t?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(Se.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"string"==typeof e&&"boolean"==typeof t?this.error({ERRORCODE:e},t):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const r=this.ad.adVerifications.find(t=>t.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const i=r.trackingEvents;if(i&&i.verificationNotExecuted){const e=i.verificationNotExecuted;this.trackURLs(e,t),this.emit("verificationNotExecuted",{trackingURLTemplates:e})}}overlayViewDuration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&"object"==typeof t?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!==e&&"string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,i={...t};if(r){this.progress&&(i.ADPLAYHEAD=this.progressFormatted());const e=Se.resolveURLTemplates([r],i)[0];this.emit("clickthrough",e)}}trackProgressEvents(e,t,r){const i=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(e=>{let[t]=e;return t.startsWith("progress-")}).map(e=>{let[t,r]=e;return{name:t,time:parseFloat(t.split("-")[1]),urls:r}}).filter(e=>{let{time:t}=e;return t<=i&&t>this.progress}).forEach(e=>{let{name:i,urls:n}=e;!r&&this.trackedProgressEvents.includes(i)||(this.emit(i,{trackingURLTemplates:n}),this.trackURLs(n,t),r?delete this.trackingEvents[i]:this.trackedProgressEvents.push(i))})}track(e){let{macros:t={},once:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof t)return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,r);const i=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;i?(this.emit(e,{trackingURLTemplates:i}),this.trackURLs(i,t)):n&&this.emit(e,null),r&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{validUrls:n,invalidUrls:a}=Se.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const s={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(s.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(s.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(s.UNIVERSALADID=this.creative.universalAdIds.map(e=>e.idRegistry.concat(" ",e.value)).join(",")),this.ad&&(this.ad.sequence&&(s.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(s.ADTYPE=this.ad.adType),this.ad.adServingId&&(s.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(s.ADCATEGORIES=this.ad.categories.map(e=>e.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(s.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(e=>e.value).join(","))),Se.track(n,s,i)}convertToTimecode(e){if(!Se.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),i=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Se.addLeadingZeros(r,2),":").concat(Se.addLeadingZeros(i,2),":").concat(Se.addLeadingZeros(n,2),".").concat(Se.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}},me.parseDuration=Ne;class dt{constructor(e={}){this.resolvePlayerExecution=null,this.videoElement=null,this.adContainer=null,this.adDisplayContainer=null,this.adsLoader=null,this.adManager=null,this.usingVastFallback=!1,this.vastTracker=null,this.vastFallbackUnlisten=null,this.fallbackProgressEmitted=new Set,this.config=e,this.logger=new b(Pt.getDebugMode());const t=Pt.getUserData(),r=Pt.getDebugMode();this.mediaResultHelper=new $({userId:t?.userId||"",debug:r}),this.ui=new te(this.logger)}async start(e){this.logger.debug("Starting VAST player for media:",e.title),re.show();try{this.currentMedia=e;return await this.checkConnectivity()?(this.logger.debug("Connectivity OK, using IMA SDK for VAST"),await this.executeWithIMA()):this.isVpaidMedia()?(this.logger.debug("No connectivity and media is VPAID; fallback does not support VPAID, returning connection error"),this.finishWithResult(u.CONNECTION_ERROR)):(this.logger.debug("No connectivity, using VAST fallback (vast-client)"),await this.executeWithVastFallback())}catch(e){this.logger.error("Error starting VAST player:",e);const t=e instanceof Error?e.message:"Unknown error";return this.finishWithResult(u.ERROR,t)}}async checkConnectivity(){try{const e=Pt.getDebugMode(),t=(new T).getArtemisAdsService(5,e);return await t.checkConnectivity(),!0}catch{return!1}}isVpaidMedia(){const e=this.currentMedia?.content?.video?.type;return"string"==typeof e&&"VPAID"===e.toUpperCase()}async executeWithIMA(){try{if(this.logger.debug("Executing VAST with IMA SDK:",this.currentMedia.title),!window.google||!window.google.ima||!window.google.ima.AdsLoader){this.logger.debug("IMA SDK not available, loading...");try{const e=Pt.getConfig()?.proxyExternalScripts||!1;await J(e),this.logger.debug("IMA SDK loaded successfully")}catch(e){return this.logger.error("Failed to load IMA SDK (e.g. no connectivity):",e),this.isVpaidMedia()?(this.logger.debug("Media is VPAID; fallback does not support VPAID, returning connection error"),this.finishWithResult(u.CONNECTION_ERROR)):await this.executeWithVastFallback()}}const e=this.config.imaConfig||{locale:"pt-BR",vastLoadTimeout:1e4,vpaidMode:window.google.ima.ImaSdkSettings.VpaidMode.ENABLED,continuousPlayback:!0};window.google.ima.settings.setVpaidMode(e.vpaidMode),window.google.ima.settings.setLocale(e.locale),this.logger.debug("IMA SDK configured successfully"),this.createModal(),await this.setupIMA();const t=this.prepareAdTagUrl();return await this.requestAds(t),this.logger.debug("VAST ad executed successfully with IMA SDK"),await this.waitForAdResult()}catch(e){return this.logger.error("Error executing with IMA SDK:",e),this.finishWithResult(u.ERROR)}}async executeWithVastFallback(){this.usingVastFallback=!0;try{this.logger.debug("Executing VAST with fallback (vast-client):",this.currentMedia.title),this.createModal(),this.ui.showVideo();const r=this.prepareAdTagUrl(),i=function(e){if(!e?.ads?.length)return null;for(const t of e.ads){if(!t.creatives?.length)continue;const e=t.creatives.find(e=>"linear"===e.type&&e.mediaFiles?.length);if(!e?.mediaFiles?.length)continue;const r=e.mediaFiles.find(e=>ct(e));if(r?.fileURL)return{ad:t,creative:e,mediaUrl:r.fileURL,clickThroughUrl:e.videoClickThroughURLTemplate||null}}return null}(await async function(e){const t=new pe;return await t.get(e)}(r));if(!i)return this.logger.error("VAST fallback: no linear creative with media found"),this.finishWithResult(u.ERROR);if(this.vastTracker=(e=i.ad,t=i.creative,new ge(null,e,t)),!this.videoElement)return this.finishWithResult(u.ERROR);const n=this.videoElement;n.src=i.mediaUrl,n.load(),this.ui.setFallbackSaibaMaisClick(()=>{this.vastTracker&&(this.vastTracker.once?.("clickthrough",e=>{e&&window.open(e,"_blank")}),this.vastTracker.click(null,{}),this.sendClickThroughEvent())});const a=()=>{this.vastTracker?.trackImpression(),this.vastTracker?.load?.(),re.hide(),this.ui.showFallbackOverlay(!!i.clickThroughUrl),this.ui.updateFallbackTimer(0,i.creative.duration??0),this.logger.debug("VAST fallback: ad loaded")},s=()=>{this.vastTracker&&this.vastTracker.setProgress(n.currentTime),this.emitFallbackProgressEvents(n.currentTime,i.creative.duration??0),this.ui.updateFallbackTimer(n.currentTime,i.creative.duration??0)},o=async()=>{this.vastTracker?.complete?.(),this.sendCompleteEvent(),this.sendAllAdsCompletedEvent(),this.logger.debug("VAST fallback: ad completed"),this.ui.hideFallbackOverlay(),this.ui.hide();const e=this.currentMedia.content?.survey?.hasUrl();if(e)try{const e=new ue(this.currentMedia),t=await e.start();this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}catch(e){this.logger.error("Error executing survey after video:",e),this.finishWithResult(u.REWARDED)}else this.finishWithResult(u.REWARDED);this.removeVastFallbackListeners(),setTimeout(()=>{this.ui.cleanup(),this.cleanupResources()},1e3)},l=()=>{this.logger.error("VAST fallback: video error"),this.vastTracker?.error?.(),this.sendAdErrorEvent(),this.finishWithResult(u.ERROR),this.removeVastFallbackListeners()},c=e=>{this.vastTracker&&(this.vastTracker.once?.("clickthrough",e=>{e&&window.open(e,"_blank")}),this.vastTracker.click(null,{CLICKPOS:[e.clientX,e.clientY]}),this.sendClickThroughEvent())};return n.addEventListener("canplay",a,{once:!0}),n.addEventListener("timeupdate",s),n.addEventListener("ended",o,{once:!0}),n.addEventListener("error",l,{once:!0}),n.addEventListener("click",c),this.vastFallbackUnlisten=()=>{n.removeEventListener("canplay",a),n.removeEventListener("timeupdate",s),n.removeEventListener("ended",o),n.removeEventListener("error",l),n.removeEventListener("click",c)},await n.play().catch(e=>{this.logger.error("VAST fallback: play failed",e),l()}),await this.waitForAdResult()}catch(e){return this.logger.error("Error executing VAST fallback:",e),this.removeVastFallbackListeners(),this.finishWithResult(u.ERROR)}var e,t}emitFallbackProgressEvents(e,t){if(t<=0)return;const r=e/t,i=[.001,.25,.5,.75];[{key:"start",send:()=>this.sendVpaidStartEvent()},{key:"firstQuartile",send:()=>this.sendFirstQuartileEvent()},{key:"midpoint",send:()=>this.sendMidpointEvent()},{key:"thirdQuartile",send:()=>this.sendThirdQuartileEvent()}].forEach((e,t)=>{r>=i[t]&&!this.fallbackProgressEmitted.has(e.key)&&(this.fallbackProgressEmitted.add(e.key),e.send())})}removeVastFallbackListeners(){this.vastFallbackUnlisten&&(this.vastFallbackUnlisten(),this.vastFallbackUnlisten=null),this.vastTracker=null,this.usingVastFallback=!1,this.fallbackProgressEmitted.clear()}async waitForAdResult(){return new Promise(e=>{this.resolvePlayerExecution=e})}finishWithResult(e,t){this.logger.debug("Finishing VAST player with result:",e),re.hide();const r=this.mediaResultHelper.finishWithResult(this.currentMedia,e,t);return this.resolvePlayerExecution&&(this.resolvePlayerExecution(r),this.resolvePlayerExecution=null),this.cleanup(),r}createModal(){try{this.videoElement=this.ui.createModal(),this.ui.setCloseCallback(()=>{this.finishWithResult(u.CANCELED),this.destroyPlayerOnClose()})}catch(e){throw this.logger.error("Error creating modal:",e),e}}prepareAdTagUrl(){if("video_v2"===this.currentMedia.type){if(!this.currentMedia.content?.video?.url)throw this.logger.error("Video V2 URL not found"),new Error("Video V2 URL not found");return this.currentMedia.content.video.url}if(!this.currentMedia.content?.url)throw this.logger.error("Media content URL not found"),new Error("Media content URL not found");return this.currentMedia.content.url}async setupIMA(){try{if(!this.videoElement)throw new Error("Video element not found");if(this.adContainer=this.ui.getAdContainer(),!this.adContainer)throw new Error("Ad container not found");this.ui.showVideo(),this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoElement),this.adDisplayContainer.initialize(),this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.setupIMAEvents(),this.logger.debug("IMA SDK setup completed")}catch(e){throw this.logger.error("Error setting up IMA SDK:",e),e}}setupIMAEvents(){this.adsLoader&&(this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e=>{if(this.logger.debug("AdsManager loaded"),this.adManager=e.getAdsManager(this.videoElement),this.adManager){const e=this.videoElement?.clientWidth||640,t=this.videoElement?.clientHeight||480;this.logger.debug(`Initializing ad with dimensions: ${e}x${t}`),this.setupAdManagerEvents(),this.adManager.init(e,t,window.google.ima.ViewMode.NORMAL),this.adManager.start(),this.logger.debug("Ad started successfully"),setTimeout(()=>{this.ui.showVideo()},100)}}),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,e=>{this.logger.error("Ad error:",e.getError()),this.finishWithResult(u.ERROR)}))}setupAdManagerEvents(){this.adManager&&(this.adManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,()=>{this.logger.debug("Ad loaded"),re.hide()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,()=>{this.logger.debug("Ad started"),this.sendVpaidStartEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.FIRST_QUARTILE,()=>{this.logger.debug("Ad first quartile"),this.sendFirstQuartileEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.MIDPOINT,()=>{this.logger.debug("Ad midpoint"),this.sendMidpointEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.THIRD_QUARTILE,()=>{this.logger.debug("Ad third quartile"),this.sendThirdQuartileEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,()=>{this.sendCompleteEvent(),this.logger.debug("Ad completed")}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,async()=>{this.logger.debug("All ads completed"),this.sendAllAdsCompletedEvent(),this.ui.hide();const e=this.currentMedia.content?.survey?.hasUrl();if(e){this.logger.debug("Video completed, executing survey");try{const e=new ue(this.currentMedia),t=await e.start();this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}catch(e){this.logger.error("Error executing survey after video:",e),this.finishWithResult(u.REWARDED)}}else this.finishWithResult(u.REWARDED);setTimeout(()=>{this.ui.cleanup(),this.cleanupResources()},1e3)}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.CLICK,()=>{this.logger.debug("Ad click (clickthrough / Saiba mais)"),this.sendClickThroughEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.VIDEO_CLICKED,()=>{this.logger.debug("Video area clicked (pause/resume by IMA)")}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.SKIPPED,()=>{this.logger.debug("Ad skipped"),this.sendSkippedEvent()}))}async requestAds(e){try{if(!this.adsLoader)throw new Error("AdsLoader not initialized");const t=new window.google.ima.AdsRequest;t.adTagUrl=e,this.logger.debug("Requesting ads with URL:",e),this.adsLoader.requestAds(t),this.logger.debug("Ads requested successfully")}catch(e){throw this.logger.error("Error requesting ads:",e),e}}sendVpaidStartEvent(){this.mediaResultHelper.sendEventCallback(j.START,this.currentMedia)}sendFirstQuartileEvent(){this.mediaResultHelper.sendEventCallback(j.FIRST_QUARTILE,this.currentMedia)}sendMidpointEvent(){this.mediaResultHelper.sendEventCallback(j.MIDPOINT,this.currentMedia)}sendThirdQuartileEvent(){this.mediaResultHelper.sendEventCallback(j.THIRD_QUARTILE,this.currentMedia)}sendCompleteEvent(){this.mediaResultHelper.sendEventCallback(j.AD_COMPLETED,this.currentMedia)}sendAllAdsCompletedEvent(){this.mediaResultHelper.sendEventCallback(j.ALL_ADS_COMPLETED,this.currentMedia)}sendClickThroughEvent(){this.mediaResultHelper.sendEventCallback(j.CLICKTHROUGH,this.currentMedia)}sendSkippedEvent(){this.mediaResultHelper.sendEventCallback(j.SKIPPED,this.currentMedia)}sendAdErrorEvent(){this.mediaResultHelper.sendEventCallback(j.ERROR,this.currentMedia)}destroyPlayerOnClose(){this.usingVastFallback&&this.removeVastFallbackListeners(),this.adManager&&(this.adManager.destroy(),this.adManager=null),this.adsLoader&&(this.adsLoader.destroy(),this.adsLoader=null),this.adDisplayContainer&&(this.adDisplayContainer.destroy(),this.adDisplayContainer=null),this.ui.cleanup(),this.adContainer=null,this.mediaResultHelper.clearSentEvents(),this.resolvePlayerExecution=null}cleanup(){this.logger.debug("Cleaning up VAST player"),this.ui.cleanup(),this.videoElement=null,this.adContainer=null}cleanupResources(){this.logger.debug("Cleaning up VAST player resources (UI already cleaned)"),this.mediaResultHelper.clearSentEvents(),this.resolvePlayerExecution=null,this.adContainer=null,this.videoElement=null}destroy(){this.logger.debug("Destroying VAST player"),this.cleanup()}}function ut(e){return new dt(e)}var ht;!function(e){e.NO_FILL="NO_FILL",e.CONNECTION_ERROR="CONNECTION_ERROR",e.AD_FAILED="AD_FAILED",e.REWARDED="REWARDED",e.SKIPPED="SKIPPED"}(ht||(ht={}));class gt{constructor(){this.steps=[]}addStep(e,t){this.steps.push({result:e,errorMessage:t})}getWaterfallSummary(){return this.steps.map(e=>`${e.result}`).join(", ")||"No results"}getDetailedWaterfallSummary(){return this.steps.map(e=>{switch(e.result){case ht.AD_FAILED:return"AD_FAILED"+(e.errorMessage?`(${e.errorMessage})`:"");case ht.NO_FILL:return"NO_FILL";case ht.CONNECTION_ERROR:return"CONNECTION_ERROR";case ht.REWARDED:return"REWARDED";case ht.SKIPPED:return"SKIPPED";default:return e.result}}).join(" | ")}findMainResult(){return this.steps.some(e=>e.result===ht.REWARDED)?ht.REWARDED:this.steps.some(e=>e.result===ht.SKIPPED)?ht.SKIPPED:this.steps.some(e=>e.result===ht.NO_FILL)?ht.NO_FILL:this.steps.some(e=>e.result===ht.AD_FAILED)?ht.AD_FAILED:ht.CONNECTION_ERROR}clear(){this.steps=[]}getSteps(){return[...this.steps]}getStepCount(){return this.steps.length}}function pt(){return new gt}class mt{constructor(e){this.isLoaded=!1,this.isDestroyed=!1,this.loadTimeout=null,this.rewardedSlot=null,this.rewardPayload=null,this.resolvePromise=null,this.eventListeners={rewardedSlotReady:null,rewardedSlotClosed:null,rewardedSlotGranted:null,slotRenderEnded:null},this.config=e,this.logger=new b(Pt.getDebugMode())}async loadAd(){return this.isDestroyed?(this.logger.warn("Wrapper already destroyed"),{result:ht.AD_FAILED,errorMessage:"Wrapper destroyed"}):(this.logger.debug("Loading GAM Rewarded Video:",this.config.adUnitId),new Promise(e=>{this.resolvePromise=e,this.initGooglePublisherTag().then(()=>{if(!this.isDestroyed)return this.renderRewardedAd();e({result:ht.AD_FAILED,errorMessage:"Wrapper destroyed"})}).catch(t=>{this.logger.error("Error loading GAM RV:",t),e({result:ht.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"})})}))}async initGooglePublisherTag(){if("undefined"==typeof window)throw new Error("Window object not available");if(!window.googletag){window.googletag=window.googletag||{cmd:[]};try{await X(),this.logger.debug("GPT script ready")}catch(e){throw this.logger.error("Failed to load GPT script:",e),new Error(`Failed to load Google Publisher Tag: ${e instanceof Error?e.message:"Unknown error"}`)}}}async renderRewardedAd(){return new Promise((e,t)=>{this.loadTimeout=setTimeout(()=>{this.isDestroyed||(this.logger.error("GAM RV load timeout"),this.resolvePromise?.({result:ht.CONNECTION_ERROR,errorMessage:"Load timeout"}),this.removeEventListeners(),t(new Error("Load timeout")))},this.config.timeout);try{window.googletag.cmd.push(()=>{this.isDestroyed||(se(),this.rewardedSlot=window.googletag.defineOutOfPageSlot(this.config.adUnitId,window.googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot?(this.rewardedSlot.addService(window.googletag.pubads()),this.addCampaignParams(),this.addEventListeners(),window.googletag.enableServices(),window.googletag.display(this.rewardedSlot),e()):(this.logger.error("Rewarded ads are not supported on this page"),this.resolvePromise?.({result:ht.AD_FAILED,errorMessage:"Rewarded ads not supported"}),this.removeEventListeners(),t(new Error("Rewarded ads not supported"))))})}catch(e){this.logger.error("Error in renderRewardedAd:",e),this.resolvePromise?.({result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}),this.removeEventListeners(),t(e)}})}addCampaignParams(){this.rewardedSlot&&this.config.campaignParams&&(this.config.campaignParams.mediaId&&this.rewardedSlot.setTargeting("a_media_id",this.config.campaignParams.mediaId),this.config.campaignParams.campaignId&&this.rewardedSlot.setTargeting("a_campaign_id",this.config.campaignParams.campaignId),this.config.campaignParams.zoneId&&this.rewardedSlot.setTargeting("a_zone_id",this.config.campaignParams.zoneId),this.config.campaignParams.requestId&&this.rewardedSlot.setTargeting("a_request_id",this.config.campaignParams.requestId))}addEventListeners(){this.logger.debug("Adding GAM RV event listeners"),this.eventListeners.rewardedSlotReady||(this.eventListeners.rewardedSlotReady=e=>{this.isDestroyed||(this.logger.debug("Rewarded ad slot is ready"),history.pushState(null,"Google Rewarded Video","#goog_rewarded"),re.hide(),e.makeRewardedVisible(),this.logger.debug("Rewarded ad is active"))},window.googletag.pubads().addEventListener("rewardedSlotReady",this.eventListeners.rewardedSlotReady)),this.eventListeners.rewardedSlotClosed||(this.eventListeners.rewardedSlotClosed=()=>{this.isDestroyed||(this.logger.debug("Rewarded ad closed"),this.resolvePromise?.({result:ht.SKIPPED,errorMessage:void 0}),this.dismissRewardedAd())},window.googletag.pubads().addEventListener("rewardedSlotClosed",this.eventListeners.rewardedSlotClosed)),this.eventListeners.rewardedSlotGranted||(this.eventListeners.rewardedSlotGranted=e=>{this.isDestroyed||(this.logger.debug("User rewarded"),this.resolvePromise?.({result:ht.REWARDED,errorMessage:void 0}),this.dismissRewardedAd())},window.googletag.pubads().addEventListener("rewardedSlotGranted",this.eventListeners.rewardedSlotGranted)),this.eventListeners.slotRenderEnded||(this.eventListeners.slotRenderEnded=e=>{this.isDestroyed||(this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),e.slot===this.rewardedSlot&&e.isEmpty&&(this.logger.debug("No ad returned for rewarded ad slot"),this.resolvePromise?.({result:ht.NO_FILL,errorMessage:"No ad returned"}),this.dismissRewardedAd()))},window.googletag.pubads().addEventListener("slotRenderEnded",this.eventListeners.slotRenderEnded))}removeEventListeners(){this.logger.debug("Removing GAM RV event listeners"),this.eventListeners.rewardedSlotReady&&(window.googletag.pubads().removeEventListener("rewardedSlotReady",this.eventListeners.rewardedSlotReady),this.eventListeners.rewardedSlotReady=null),this.eventListeners.rewardedSlotClosed&&(window.googletag.pubads().removeEventListener("rewardedSlotClosed",this.eventListeners.rewardedSlotClosed),this.eventListeners.rewardedSlotClosed=null),this.eventListeners.rewardedSlotGranted&&(window.googletag.pubads().removeEventListener("rewardedSlotGranted",this.eventListeners.rewardedSlotGranted),this.eventListeners.rewardedSlotGranted=null),this.eventListeners.slotRenderEnded&&(window.googletag.pubads().removeEventListener("slotRenderEnded",this.eventListeners.slotRenderEnded),this.eventListeners.slotRenderEnded=null)}dismissRewardedAd(){this.rewardPayload&&(this.rewardPayload=null),this.logger.debug("Rewarded ad has been closed"),this.rewardedSlot&&window.googletag.destroySlots([this.rewardedSlot]),this.removeEventListeners()}destroy(){this.isDestroyed||(this.logger.debug("Destroying GAM RV wrapper"),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.removeEventListeners(),this.rewardedSlot&&window.googletag&&window.googletag.destroySlots([this.rewardedSlot]),this.isDestroyed=!0,this.isLoaded=!1,this.rewardedSlot=null,this.rewardPayload=null)}isAdLoaded(){return this.isLoaded}}function ft(e){return new mt(e)}class vt{constructor(e){this.isDestroyed=!1,this.loadTimeout=null,this.resolvePromise=null,this.adInstance=null,this.adContainer=null,this.adElement=null,this.mediaResultHelper=null,this.config=e,this.logger=new b(Pt.getDebugMode()),this.mediaResultHelper=e.mediaResultHelper||null}async loadAd(){if(this.isDestroyed)return this.logger.warn("Wrapper already destroyed"),{result:ht.AD_FAILED,errorMessage:"Wrapper destroyed"};const e=Pt.getConfig()?.luminaToken;return e&&0!==e.trim().length?(this.logger.debug("Loading Lumina Rewarded Video:",this.config.tagId),new Promise(e=>{this.resolvePromise=e,this.initLuminaSDK().then(()=>{if(!this.isDestroyed)return this.renderRewardedAd();e({result:ht.AD_FAILED,errorMessage:"Wrapper destroyed"})}).catch(t=>{this.logger.error("Error loading Lumina RV:",t),e({result:ht.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"})})})):(this.logger.warn("Lumina token not configured, skipping Lumina RV step"),{result:ht.AD_FAILED,errorMessage:"Lumina token not configured"})}async initLuminaSDK(){if("undefined"==typeof window)throw new Error("Window object not available");try{const e=this.config.debug||!1,t=Pt.getConfig()?.luminaToken,r=Pt.getConfig()?.proxyExternalScripts||!1;await Z({token:t,debug:e},r),this.logger.debug("Lumina SDK script ready")}catch(e){throw this.logger.error("Failed to load Lumina SDK script:",e),new Error(`Failed to load Lumina SDK: ${e instanceof Error?e.message:"Unknown error"}`)}}createAdContainer(){this.adContainer=document.createElement("div"),this.adContainer.id=`lumina-ad-container-${Date.now()}`,this.adContainer.style.display="block",this.adContainer.style.width="100%",this.adContainer.style.height="100vh",this.adContainer.style.position="fixed",this.adContainer.style.top="0",this.adContainer.style.left="0",this.adContainer.style.zIndex="9999",this.adElement=document.createElement("ins"),this.adElement.className="adsbylumina",this.adElement.style.display="block",this.adElement.style.width="100%",this.adElement.style.height="100%";const e=this.config.media?.uuid||`lumina-${Date.now()}`;this.adElement.setAttribute("data-ad-type","fluid"),this.adElement.setAttribute("data-ad-client","ug"),this.adElement.setAttribute("data-ad-tagId",this.config.tagId),this.adElement.setAttribute("data-ad-slot","close"),this.adElement.setAttribute("data-ad-luminaAdToken",e),this.adElement.setAttribute("data-ad-mute","false"),this.adContainer.appendChild(this.adElement),document.body.appendChild(this.adContainer),this.logger.debug("Lumina ad container created")}async renderRewardedAd(){return new Promise((e,t)=>{if(this.loadTimeout=setTimeout(()=>{this.isDestroyed||(this.logger.error("Lumina RV load timeout"),this.resolvePromise?.({result:ht.CONNECTION_ERROR,errorMessage:"Load timeout"}),this.removeAdContainer(),t(new Error("Load timeout")))},this.config.timeout),this.createAdContainer(),!window.adsbylumina)return void t(new Error("Lumina SDK not available"));window.adsbylumina=window.adsbylumina||[];const r={luminaAdToken:this.config.media?.uuid||`lumina-${Date.now()}`,tagId:this.config.tagId,bidfloor:0,onAdRequestSuccess:r=>{if(!this.isDestroyed){this.logger.debug("Ad request succeeded, price:",r.price),this.adInstance=r,this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.adContainer&&(this.adContainer.style.display="block");try{r.renderAd(),this.logger.debug("Ad rendered successfully"),re.hide(),e()}catch(e){this.logger.error("renderAd() failed:",e);const r=e instanceof Error?e.message:"Ad render failed";this.removeAdContainer(),this.resolvePromise?.({result:ht.AD_FAILED,errorMessage:r}),t(new Error(r))}}},onAdRequestFailed:e=>{if(this.isDestroyed)return;this.logger.error("Ad request failed:",e),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.removeAdContainer();const r=e.error??"Unknown error",i=r.toLowerCase().includes("no ad"),n=i?ht.NO_FILL:ht.AD_FAILED;this.logger.debug("Error classified as: "+(i?"NO_FILL":"AD_FAILED")),this.resolvePromise?.({result:n,errorMessage:r}),t(new Error(r))},onAdComplete:e=>{this.isDestroyed||(this.logger.debug("Ad completed",e),this.logger.debug("User rewarded"),this.resolvePromise?.({result:ht.REWARDED,errorMessage:void 0}),this.removeAdContainer())},onAdClick:e=>{this.isDestroyed||(this.logger.debug("Ad clicked",e),this.mediaResultHelper&&this.config.media&&this.mediaResultHelper.sendEventCallback(j.CLICKTHROUGH,this.config.media))},onTemplateClose:()=>{this.isDestroyed||(this.logger.debug("Rewarded ad closed"),this.resolvePromise?.({result:ht.SKIPPED,errorMessage:void 0}),this.removeAdContainer())}};window.adsbylumina.push(r)})}removeAdContainer(){this.adContainer&&this.adContainer.parentNode&&(this.adContainer.parentNode.removeChild(this.adContainer),this.adContainer=null,this.adElement=null,this.logger.debug("Lumina ad container removed"))}destroy(){this.isDestroyed||(this.logger.debug("Destroying Lumina RV wrapper"),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.adInstance=null,this.removeAdContainer(),this.isDestroyed=!0)}}function Et(e){return new vt(e)}class yt{constructor(e={}){this.currentMedia=null,this.config=e,this.logger=new b(Pt.getDebugMode());const t=Pt.getUserData(),r=Pt.getDebugMode();this.mediaResultHelper=new $({userId:t?.userId||"",debug:r}),this.waterfallTracker=new gt}async start(e){this.logger.debug("Starting programmatic player for media:",e.title),re.show();try{this.currentMedia=e,this.waterfallTracker.clear(),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_WATERFALL_START,e);const t=e.content?.programmatic?.waterfall;return t&&0!==t.length?await this.executeWaterfall(t):(this.logger.error("Empty or null waterfall"),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_ERROR,e),re.hide(),this.createErrorResult("Empty or null waterfall"))}catch(e){throw this.logger.error("Error in start method:",e),re.hide(),e}}async executeWaterfall(e){this.logger.debug("Executing waterfall with",e.length,"steps");for(let t=0;t<e.length;t++){const r=e[t];this.logger.debug(`Loading ad ${t+1} of ${e.length}: ${r.type}`);try{const e=await this.loadAd(r,t);if(e instanceof w)return this.logger.debug("Fallback executed, returning result directly"),e;if(e.result===ht.REWARDED)return this.logger.debug("Ad rewarded successfully"),this.mediaResultHelper.sendEventCallback(j.COMPLETE,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.REWARDED);if(e.result===ht.SKIPPED)return this.logger.debug("Ad skipped"),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_SKIPPED,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.SKIPPED);this.waterfallTracker.addStep(e.result,e.errorMessage),this.logger.debug(`Ad ${t+1} failed: ${e.result} - ${e.errorMessage}, trying next`)}catch(e){this.logger.error(`Error loading ad ${t+1}:`,e),this.waterfallTracker.addStep(ht.AD_FAILED,e instanceof Error?e.message:"Unknown error")}}return this.logger.debug("No more ads to load in waterfall. Summary:",this.waterfallTracker.getDetailedWaterfallSummary()),re.hide(),await this.sendProgResultEvent()}async loadAd(e,t){const r=e.type,i=e.findTimeout()||this.config.loadTimeout||1e4;switch(this.logger.debug(`Loading ad type: ${r}`),r){case d.TYPE_GOOGLE_RV:return await this.loadGAMRewardedVideo(e.findAdUnitId(),i);case d.TYPE_KWAI_RV:return await this.loadLuminaRewardedVideo(e.findAdUnitId(),i);case d.TYPE_FALLBACK:return await this.loadVideoFallback(e.findVastTag(),e.findEventSuffix());default:return this.logger.warn(`Ad type ${r} not supported in web`),{result:ht.AD_FAILED,errorMessage:`Ad type ${r} not supported`}}}async loadGAMRewardedVideo(e,t){try{if(this.logger.debug("Loading GAM Rewarded Video"),!e)return this.logger.error("Ad unit ID not found for GAM RV"),{result:ht.AD_FAILED,errorMessage:"Ad unit ID not found"};const r=this.buildCampaignParams(),i=Pt.getDebugMode(),n=new mt({adUnitId:e,timeout:t,campaignParams:r,debug:i});return await this.loadGAMRewardedVideoWithWrapper(n)}catch(e){return this.logger.error("Error loading GAM RV:",e),{result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}}}async loadLuminaRewardedVideo(e,t){try{if(this.logger.debug("Loading Lumina Rewarded Video"),!e)return this.logger.error("TagId not found for Lumina RV"),{result:ht.AD_FAILED,errorMessage:"TagId not found"};const r=this.buildCampaignParams(),i=Pt.getDebugMode(),n=new vt({tagId:e,timeout:t,campaignParams:r,debug:i,mediaResultHelper:this.mediaResultHelper,media:this.currentMedia||void 0});return await this.loadLuminaRewardedVideoWithWrapper(n)}catch(e){return this.logger.error("Error loading Lumina RV:",e),{result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}}}async loadLuminaRewardedVideoWithWrapper(e){try{const t=await e.loadAd();return this.logger.debug("Lumina RV result:",t.result),t}catch(e){return this.logger.error("Error loading Lumina RV:",e),{result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}}}async loadGAMRewardedVideoWithWrapper(e){try{const t=await e.loadAd();return this.logger.debug("GAM RV result:",t.result),t}catch(e){return this.logger.error("Error loading GAM RV:",e),{result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}}}async loadVideoFallback(e,t){try{this.logger.debug("Loading fallback VIDEO_V2"),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_FALLBACK_REQ,this.currentMedia),this.sendProgResultEvent();const r=JSON.parse(JSON.stringify(this.currentMedia));r.type=d.VIDEO_V2,r.content={video:{type:"IN_HOUSE",url:e,proxy:!1,eventSuffix:t}};const i=new Rt(r);return await i.click(!1)}catch(e){return this.logger.error("Error loading fallback:",e),new w({media:this.currentMedia,result:u.ERROR,error:new g(G.ERROR,e instanceof Error?e.message:"Unknown error")})}}createErrorResult(e){return new w({media:this.currentMedia,result:u.ERROR,error:new g(G.ERROR,e instanceof Error?e.message:"Unknown error")})}async sendProgResultEvent(){switch(this.waterfallTracker.findMainResult()){case ht.NO_FILL:return this.logger.debug("Waterfall completed with NO_FILL"),this.mediaResultHelper.sendEventCallback(j.NO_FILL,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.NO_FILL);case ht.AD_FAILED:const e=`Waterfall failed: ${this.waterfallTracker.getDetailedWaterfallSummary()}`;return this.logger.error("Waterfall",e),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_ERROR,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.ERROR,e);case ht.CONNECTION_ERROR:return this.logger.debug("Waterfall completed with CONNECTION_ERROR"),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_CONNECTION_ERROR,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.CONNECTION_ERROR,"Connection Error");case ht.REWARDED:return this.mediaResultHelper.finishWithResult(this.currentMedia,u.REWARDED);case ht.SKIPPED:return this.mediaResultHelper.finishWithResult(this.currentMedia,u.SKIPPED)}}buildCampaignParams(){const e={};return this.currentMedia?.uuid&&(e.mediaId=this.currentMedia.uuid),this.currentMedia?.campaignId&&(e.campaignId=this.currentMedia.campaignId),this.currentMedia?.zoneId&&(e.zoneId=this.currentMedia.zoneId),this.currentMedia?.requestId&&(e.requestId=this.currentMedia.requestId),e}destroy(){this.logger.debug("Destroying AARewardedVideo"),re.hide(),this.currentMedia=null,this.waterfallTracker.clear()}}function wt(e){return new yt(e)}class bt{constructor(e){this.media=e;const t=Pt.getDebugMode();this.logger=new b(t),this.mediaResultHelper=new $({userId:Pt.getUserData()?.userId||"",debug:t})}async start(){try{if(!this.getRedirectUrl())return this.logger.error("URL de redirecionamento não encontrada"),this.mediaResultHelper.finishWithResult(this.media,u.ERROR,"URL de redirecionamento não encontrada");return new w({media:this.media,result:u.EXTERNAL_REDIRECT})}catch(e){return this.logger.error("Erro ao executar redirecionamento externo:",e),this.mediaResultHelper.finishWithResult(this.media,u.ERROR,e instanceof Error?e.message:"Erro desconhecido")}}getRedirectUrl(){if(this.media.content?.externalRedirect?.link)return this.media.content.externalRedirect.link;const e=this.media._rawContent;return e&&e.link?e.link:this.media.content?.url?this.media.content.url:this.media.externalUrl?.url?this.media.externalUrl.url:this.media.success?.url?this.media.success.url:null}}class At{constructor(e){this.media=e;const t=Pt.getDebugMode();this.logger=new b(t),this.mediaResultHelper=new $({userId:Pt.getUserData()?.userId||"",debug:t})}async start(){try{return this.getClickUrl()?(this.mediaResultHelper.sendEventCallback(j.CLICKTHROUGH,this.media),new w({media:this.media,result:u.BANNER_CLICK})):(this.logger.error("URL de clique do banner não encontrada"),this.mediaResultHelper.finishWithResult(this.media,u.ERROR,"URL de clique do banner não encontrada"))}catch(e){return this.logger.error("Erro ao executar clique do banner:",e),this.mediaResultHelper.finishWithResult(this.media,u.ERROR,e instanceof Error?e.message:"Erro desconhecido")}}getClickUrl(){return this.media.externalUrl?.url??null}}class Rt{constructor(e){this.uuid=e.uuid,this.type=e.type,this.title=e.title,this.viewed=e.viewed,this.campaignId=e.campaignId,this.campaignName=e.campaignName,this.requestId=e.requestId,this.zoneId=e.zoneId,this.mediasLeft=e.mediasLeft,this.layout=e.layout,e.content&&(this.content=new E(e.content)),e.success&&(this.success=new y(e.success)),Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.content&&!this._rawContent&&(this._rawContent=e.content)}async click(e=!0){const t=Pt.getDebugMode(),r=new b(t);try{const t=Pt.getUserData();if(!t?.userId)return r.error("Error executing media click: user id is null"),new w({media:this,result:u.ERROR,error:new g("User ID is required")});if(e){(new H).sendMediaClickEvent(this.campaignId||"",this.requestId||"",this.uuid).catch(e=>r.warn("Error sending click event:",e))}switch(this.type){case d.VIDEO_V2:return await this.executeVideoV2Media(t.userId);case d.PROGRAMMATIC_V2:return await this.executeProgrammaticV2Media(t.userId);case d.SURVEY_V2:return await this.executeSurveyV2Media(t.userId);case d.EXTERNAL_REDIRECT:return await this.executeExternalRedirectMedia(t.userId);case d.BANNER:return await this.executeBannerMedia(t.userId);default:return r.warn(`Unsupported media type: ${this.type}`),new w({media:this,result:u.ERROR,error:new g(`Unsupported media type: ${this.type}`)})}return new w({media:this,result:u.ERROR,error:new g("Media execution failed")})}catch(e){return r.error("Error executing media click:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}async executeProgrammaticV2Media(e){const t=Pt.getDebugMode();new b(t).debug("Executing Programmatic V2 media:",this.title);const r=new yt,i=await r.start(this);return new w(i)}async executeVideoV2Media(e){const t=Pt.getDebugMode(),r=new b(t);r.debug("Executing Video V2 media:",this.title);try{const e=new dt,t=await e.start(this);return r.debug("Video V2 execution completed:",t.result),t}catch(e){return r.error("Error in executeVideoV2Media:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}async executeSurveyV2Media(e){const t=Pt.getDebugMode(),r=new b(t);r.debug("Executing Survey V2 media:",this.title);try{const e=new ue(this),t=await e.start();return r.debug("Survey V2 execution completed:",t.result),t}catch(e){return r.error("Error in executeSurveyV2Media:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}async executeExternalRedirectMedia(e){const t=Pt.getDebugMode(),r=new b(t);r.debug("Executing External Redirect media:",this.title);try{const e=new bt(this),t=await e.start();return r.debug("External Redirect execution completed:",t.result),t}catch(e){return r.error("Error in executeExternalRedirectMedia:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}async executeBannerMedia(e){const t=Pt.getDebugMode(),r=new b(t);r.debug("Executing Banner media:",this.title);try{const e=new At(this),t=await e.start();return r.debug("Banner execution completed:",t.result),t}catch(e){return r.error("Error in executeBannerMedia:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}}class Tt{constructor(e){this.image=e.image,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}hasValidImage(){return!!(this.image&&this.image.trim().length>0)}getImageUrl(e){return this.hasValidImage()?this.image:e||""}isAbsoluteUrl(){return this.image.startsWith("http://")||this.image.startsWith("https://")}}class kt{constructor(e){this.primaryColor=e.primaryColor,this.secondaryColor=e.secondaryColor,this.title=e.title,this.primaryInformation=e.primaryInformation,this.secondaryInformation=e.secondaryInformation,this.enableCountdown=e.enableCountdown||!1,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.header&&(this.header=new Tt(e.header))}getPrimaryColorHex(){return this.primaryColor.startsWith("#")?this.primaryColor:`#${this.primaryColor}`}getSecondaryColorHex(){return this.secondaryColor.startsWith("#")?this.secondaryColor:`#${this.secondaryColor}`}isValid(){return!!(this.primaryColor&&this.secondaryColor&&this.title&&this.header)}}class It{constructor(e){this.success=e.success,this.media=e.media||[],Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.layout&&(this.layout=new kt(e.layout)),this.media=this.media.map(e=>new Rt(e))}getUnviewedMedia(){return this.media.filter(e=>!e.viewed)}getMediaByType(e){return this.media.filter(t=>t.type===e)}hasAvailableMedia(){return this.getUnviewedMedia().length>0}getMediaCount(){return this.media.length}}class Ct{constructor(e){this.name=e.name,this.description=e.description,this.value=e.value,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}hasDescription(){return!(!this.description||!this.description.trim())}hasValue(){return!!this.value}getInfo(){return this.hasDescription()?`${this.name}: ${this.description}`:this.name}}class Dt{constructor(e){this.campaignUuid=e.campaignUuid,this.campaignName=e.campaignName,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.mainData&&(this.mainData=new It(e.mainData)),this.benefitOffers=(e.benefitOffers||[]).map(e=>new Ct(e))}getUnviewedMedia(){return this.mainData?.media?.filter(e=>!e.viewed)||[]}getMediaByType(e){return this.mainData?.media?.filter(t=>t.type===e)||[]}hasAvailableMedia(){return this.getUnviewedMedia().length>0}}class St{constructor(e){this.uuid=e.uuid,this.name=e.name,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isValid(){return!(!this.uuid||!this.name)}getInfo(){return`${this.name} (${this.uuid})`}}class Lt{constructor(e){this.requestId=e.requestId,this.campaigns=e.campaigns||[],Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.zone&&(this.zone=new St(e.zone)),this.campaigns=this.campaigns.map(e=>new Dt(e))}getCampaignsWithAvailableMedia(){return this.campaigns.filter(e=>e.hasAvailableMedia())}getAllMedia(){return this.campaigns.flatMap(e=>e.mainData?.media||[])}getMediaByType(e){return this.campaigns.flatMap(t=>t.getMediaByType(e))}}class Nt{constructor(e){this.responseStatus=e.responseStatus,this.error=e.error,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.campaignResponse&&(this.campaignResponse=new Lt(e.campaignResponse))}isSuccess(){return this.responseStatus===c.SUCCESS}isEmpty(){return this.responseStatus===c.EMPTY}hasError(){return this.responseStatus===c.ERROR}getCampaigns(){return this.campaignResponse?.campaigns||[]}getAllMedia(){return this.campaignResponse?.getAllMedia()||[]}}class xt{constructor(e){this.userId=e.userId,this.context=e.context,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}addContext(e,t){this.context||(this.context={}),this.context[e]=t}getContext(e){return this.context?.[e]}hasContext(){return!!(this.context&&Object.keys(this.context).length>0)}}const Mt="@AkrossAds:SDK_CONFIG",Ot="@Dataads:USER_DATA",Ut="@Dataads:CUSTOM_HEADERS";class Pt{static saveConfig(e){localStorage.setItem(Mt,JSON.stringify(e))}static getConfig(){const e=localStorage.getItem(Mt);return e?JSON.parse(e):null}static updateConfig(e){const t=this.getConfig();if(t){const r={...t,...e};this.saveConfig(r)}}static deleteConfig(){localStorage.removeItem(Mt)}static saveUserData(e,r=null){const i=new t({userId:e,advertisingId:r});localStorage.setItem(Ot,JSON.stringify(i))}static getUserData(){const e=localStorage.getItem(Ot);return e?JSON.parse(e):null}static removeUserData(){localStorage.removeItem(Ot)}static getDebugMode(){const e=this.getConfig();return e?.debug||!1}static setDebugMode(e){this.updateConfig({debug:e})}static getCustomHeaders(){const e=localStorage.getItem(Ut);return e?JSON.parse(e):null}static saveCustomHeaders(e){localStorage.setItem(Ut,JSON.stringify(e))}static removeCustomHeaders(){localStorage.removeItem(Ut)}static clearAll(){localStorage.removeItem(Mt),localStorage.removeItem(Ot),localStorage.removeItem(Ut)}}class Vt{constructor(){this.isInitialized=!1,this.config=null,this.logger=new b(Pt.getDebugMode())}getIsInitialized(){return this.isInitialized}async initialize(t){return new Promise(async(r,i)=>{try{if(this.isInitialized)return this.logger.warn("SDK já foi inicializado"),r();this.logger=new b(Pt.getDebugMode()),this.config=e.applyDefaults(t),this.logger.info("Inicializando SDK..."),Pt.saveConfig(t),await this.preloadScripts(),this.isInitialized=!0,this.logger.info("SDK inicializado com sucesso!"),r()}catch(e){this.logger.error("Erro ao inicializar SDK:",e),i(e)}})}async setUserId(e,t){return new Promise(async(r,i)=>{if(!this.isInitialized)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));try{this.logger.debug("Definindo userId:",e),Pt.saveUserData(e,t),ae(e),this.logger.info("UserId definido com sucesso"),r()}catch(e){this.logger.error("Erro ao definir userId:",e),i(e)}})}async getUserId(){return new Promise(async(e,t)=>{if(!this.isInitialized)return this.logger.error("SDK não foi inicializado"),t(new Error("SDK não foi inicializado"));try{const t=Pt.getUserData();e(t?.userId||"")}catch(e){this.logger.error("Erro ao obter userId:",e),t(e)}})}async getUserData(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{return Pt.getUserData()}catch(e){throw this.logger.error("Erro ao obter dados do usuário:",e),e}}async setCustomHeaders(e){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{Pt.saveCustomHeaders(e),this.logger.info("Headers customizados definidos com sucesso")}catch(e){throw this.logger.error("Erro ao definir headers customizados:",e),e}}async removeCustomHeaders(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{Pt.removeCustomHeaders(),this.logger.info("Headers customizados removidos com sucesso")}catch(e){throw this.logger.error("Erro ao remover headers customizados:",e),e}}async getCustomHeaders(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{return Pt.getCustomHeaders()}catch(e){throw this.logger.error("Erro ao obter headers customizados:",e),e}}getConfig(){return this.config}async clearAll(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{Pt.clearAll(),this.isInitialized=!1,this.config=null,this.logger.info("Todas as configurações foram limpas")}catch(e){throw this.logger.error("Erro ao limpar configurações:",e),e}}async preloadScripts(){try{window.google&&window.google.ima&&window.google.ima.AdsLoader||await J(this.config?.proxyExternalScripts||!1),window.googletag||await X(this.config?.proxyExternalScripts||!1);if(!!(this.config?.luminaToken&&this.config.luminaToken.trim().length>0)&&(!window.adsbylumina||!window.__luminaBasecodeReady__)){const t=e.getLuminaToken(this.config);await Z({token:t,debug:Pt.getDebugMode()},this.config?.proxyExternalScripts||!1)}}catch(e){this.logger.warn("Erro ao pré-carregar scripts (não crítico):",e)}}getDebugInfo(){return{isInitialized:this.isInitialized,debugMode:Pt.getDebugMode(),config:this.config,userData:Pt.getUserData(),customHeaders:Pt.getCustomHeaders(),scriptsLoaded:{ima:!!(window.google&&window.google.ima&&window.google.ima.AdsLoader),gpt:!!window.googletag,lumina:!(!window.adsbylumina||!window.__luminaBasecodeReady__)},version:le()}}}class _t{constructor(){this.cachedDeviceInfo=null,this.logger=new b(Pt.getDebugMode())}async getDeviceContext(){if(this.cachedDeviceInfo)return this.cachedDeviceInfo;try{const e={},t=Pt.getConfig();t?.appId&&(e.appId=t.appId),t?.appVersion&&(e.appVersion=t.appVersion),e.deviceId=this.getDeviceId(),e.sdkVersion=this.getSdkVersion(),e.brand=this.getBrowserBrand(),e.hardware=this.getHardwareInfo(),e.manufacturer=this.getManufacturer(),e.model=this.getModel(),e.product=this.getProduct(),e.osVersion=this.getOSVersion(),e.os="WEB",e.eventDate=Date.now().toString(),e.userAgent=navigator.userAgent,e.language=navigator.language,e.platform=navigator.platform,e.screenWidth=screen.width.toString(),e.screenHeight=screen.height.toString(),e.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone;const[r,i]=await Promise.allSettled([this.getLocation(),this.getAdId()]);return"fulfilled"===r.status&&r.value&&(e.lat=r.value.latitude.toString(),e.long=r.value.longitude.toString()),"fulfilled"===i.status&&i.value&&(e.adId=i.value),this.cachedDeviceInfo=e,e}catch(e){return this.logger.error("Error getting device context:",e),this.getFallbackContext()}}getSdkVersion(){return oe()}clearCache(){this.cachedDeviceInfo=null}getBrowserInfo(){return{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,cookieEnabled:navigator.cookieEnabled.toString(),onLine:navigator.onLine.toString()}}getScreenInfo(){return{screenWidth:screen.width.toString(),screenHeight:screen.height.toString(),screenColorDepth:screen.colorDepth.toString(),screenPixelDepth:screen.pixelDepth.toString(),availWidth:screen.availWidth.toString(),availHeight:screen.availHeight.toString()}}getFallbackContext(){return{deviceId:"unknown",sdkVersion:this.getSdkVersion(),os:"WEB",eventDate:Date.now().toString()}}getDeviceId(){const e="akross_device_id";let t=localStorage.getItem(e);return t||(t=this.generateDeviceFingerprint(),localStorage.setItem(e,t)),t}generateDeviceFingerprint(){const e=document.createElement("canvas"),t=e.getContext("2d");t&&(t.textBaseline="top",t.font="14px Arial",t.fillText("Akross Device ID",2,2));const r=[navigator.userAgent,navigator.language,screen.width+"x"+screen.height,(new Date).getTimezoneOffset(),e.toDataURL()].join("|");return btoa(r).substring(0,16)}getBrowserBrand(){const e=navigator.userAgent;return e.includes("Chrome")?"Google":e.includes("Firefox")?"Mozilla":e.includes("Safari")?"Apple":e.includes("Edge")?"Microsoft":"Unknown"}getHardwareInfo(){return navigator.hardwareConcurrency?`CPU Cores: ${navigator.hardwareConcurrency}`:"Unknown"}getManufacturer(){const e=navigator.userAgent;return e.includes("Windows")?"Microsoft":e.includes("Mac")?"Apple":e.includes("Linux")?"Linux":"Unknown"}getModel(){const e=navigator.userAgent;return e.includes("Mobile")?"Mobile Device":e.includes("Tablet")?"Tablet":"Desktop"}getProduct(){return navigator.platform||"Unknown"}getOSVersion(){const e=navigator.userAgent.match(/(Windows|Mac|Linux|Android|iOS)\s+([\d.]+)/);return e?e[2]:"Unknown"}async getLocation(){return new Promise(e=>{navigator.geolocation?navigator.permissions?.query({name:"geolocation"}).then(t=>{"granted"===t.state?navigator.geolocation.getCurrentPosition(t=>{e({latitude:t.coords.latitude,longitude:t.coords.longitude})},()=>e(null),{timeout:5e3,enableHighAccuracy:!1}):e(null)}).catch(()=>{e(null)}):e(null)})}async getAdId(){return null}}let qt=null;class Ft{constructor(e,t,r=!1){this.logger=new b(Pt.getDebugMode()),this.eventsHelper=new H}async requestCampaign(e,t=1,r,i){const n=new Nt({responseStatus:c.ERROR});if("undefined"==typeof window||!window.AkrossAds)return this.logger.warn("SDK não foi inicializado"),n;{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.warn("SDK não foi inicializado"),n}const a=Pt.getUserData();if(!a?.userId)return this.logger.error("Erro ao obter campanha: userId está vazio"),n;try{const s=(qt||(qt=new _t),qt),o={...await s.getDeviceContext(),...r},l=new xt({userId:a.userId,context:o}),d=(new T).getArtemisAdsService(30,!1,!0),u=await d.requestCampaign(e,l,t,i);if(u&&u.campaigns&&u.campaigns.length>0){u.campaigns.forEach(e=>{const t=e.mainData.media.filter(e=>!e.viewed).length;e.mainData.media.forEach(r=>{r.campaignId=e.campaignUuid,r.campaignName=e.campaignName,r.requestId=u.requestId,r.zoneId=u.zone.uuid,r.success=e.mainData.success,r.mediasLeft=t,r.layout=e.mainData.layout})});const e=new Lt({...u,campaigns:u.campaigns});n.campaignResponse=e,n.responseStatus=c.SUCCESS}else n.responseStatus=c.EMPTY}catch(e){n.error=e instanceof Error?e:new Error("Erro desconhecido"),n.responseStatus=c.ERROR,this.logger.error("Erro ao obter campanha:",e)}return n}async bannerClick(e,t,r,i){try{const n=Pt.getUserData();if(!n?.userId)return void this.logger.error("Erro ao abrir URL: userId está vazio");const a=new URL(e);a.searchParams.has("userId")||a.searchParams.set("userId",n.userId),a.searchParams.has("campaignId")||a.searchParams.set("campaignId",t);const s=(new T).getArtemisAdsService(30,!1,!0);await s.sendTracking("click",t,n.userId,r,i,"banner"),window.open(a.toString(),"_blank")}catch(e){this.logger.error("Erro ao abrir URL:",e)}}async sendEvent(e,t,r,i,n){return new Promise(async(a,s)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),s(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),s(new Error("SDK não foi inicializado"))}const o=Pt.getUserData();if(!o?.userId)return this.logger.error("UserId não encontrado"),s(new Error("UserId não encontrado"));this.logger.debug("Enviando evento:",{event:e,campaignId:t,trackingId:r,mediaId:i,source:n}),await this.eventsHelper.sendEvent(e,t,r,i,n),this.logger.info("Evento enviado com sucesso"),a()}catch(e){this.logger.error("Erro ao enviar evento:",e),s(e)}})}async sendCampaignsImpressionEvent(e,t){return new Promise(async(r,i)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"))}const n=Pt.getUserData();if(!n?.userId)return this.logger.error("UserId não encontrado"),i(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de impressão para campanhas:",{trackingId:e,campaignsCount:t.length}),await this.eventsHelper.sendCampaignsImpressionEvent(e,t),this.logger.info("Eventos de impressão enviados com sucesso"),r()}catch(e){this.logger.error("Erro ao enviar eventos de impressão:",e),i(e)}})}async sendCampaignClickEvent(e,t){return new Promise(async(r,i)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"))}const n=Pt.getUserData();if(!n?.userId)return this.logger.error("UserId não encontrado"),i(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de clique na campanha:",{campaignId:e,trackingId:t}),await this.eventsHelper.sendCampaignClickEvent(e,t),this.logger.info("Evento de clique na campanha enviado com sucesso"),r()}catch(e){this.logger.error("Erro ao enviar evento de clique na campanha:",e),i(e)}})}async sendSuccessImpressionEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=Pt.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento success_impression:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendSuccessImpressionEvent(e,t,r),this.logger.info("Evento success_impression enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento success_impression:",e),n(e)}})}async sendMediaClickEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=Pt.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de clique na mídia:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendMediaClickEvent(e,t,r),this.logger.info("Evento de clique na mídia enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento de clique na mídia:",e),n(e)}})}async sendClickThroughEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=Pt.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento clickthrough:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendClickThroughEvent(e,t,r),this.logger.info("Evento clickthrough enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento clickthrough:",e),n(e)}})}static getSdkVersion(){return oe()}}class Bt{constructor(e){if(this.logger=new b(Pt.getDebugMode()),"string"==typeof e){const t=document.querySelector(e);if(!t)throw new Error(`Elemento não encontrado: ${e}`);this.containerElement=t}else this.containerElement=e;this.imageElement=document.createElement("img"),this.imageElement.style.display="block",this.containerElement.innerHTML=""}setClickListener(e){this.clickListener=e}setMediaClickHandler(e){this.mediaClickHandler=e}setSuccessListener(e){this.successListener=e}setErrorListener(e){this.errorListener=e}async loadZone(e,t){try{const r=Pt.getUserData();if(!r?.userId)return this.logger.error("Erro ao carregar banner: userId está vazio"),void this.errorListener?.onError();const i=new Ft,n=await i.requestCampaign(e,1,void 0,t);if(!n.campaignResponse?.campaigns?.length)return this.logger.error("Nenhuma campanha encontrada para a zona:",e),void this.errorListener?.onError();const a=n.campaignResponse.campaigns[0].mainData.media[0];if(a.type!==d.BANNER)return this.logger.error("Tipo de mídia não suportado para banner:",a.type),void this.errorListener?.onError();this.containerElement.appendChild(this.imageElement),await this.loadBanner(a)}catch(e){this.logger.error("Erro ao carregar banner:",e),this.errorListener?.onError()}}async loadBanner(e){try{if(!e.content?.url)return this.logger.error("Erro ao carregar banner: URL da imagem não encontrada"),void this.errorListener?.onError();this.containerElement.appendChild(this.imageElement),await this.loadImage(e.content.url,e)}catch(e){this.logger.error("Erro ao carregar banner:",e),this.errorListener?.onError()}}async loadImage(e,t){try{const r=Pt.getUserData();if(!r?.userId)return this.logger.error("Erro ao carregar banner: userId não encontrado nas preferences"),this.removeImageFromDOM(),void this.errorListener?.onError();const i=r.userId,n=await fetch(e,{method:"GET",mode:"cors",cache:"default"});if(!n.ok)return this.logger.error(`Erro ao carregar imagem: ${n.status} ${n.statusText}`),this.removeImageFromDOM(),void this.errorListener?.onError();const a=await n.blob(),s=URL.createObjectURL(a);this.imageElement.src=s,this.imageElement.alt=t.title||"Banner",this.imageElement.onload=()=>{this.applyOptimizedFit()},this.imageElement.onerror=()=>{this.logger.error("Erro ao carregar imagem: falha no carregamento da imagem"),this.removeImageFromDOM(),this.errorListener?.onError()};(new H).sendImpressedEvent(t.campaignId,t.requestId,t.uuid),this.successListener?.onSuccess(t.analytics?.impression),this.setupClickHandler(t,i)}catch(e){this.logger.error("Erro ao carregar imagem:",e),this.removeImageFromDOM(),this.errorListener?.onError()}}removeImageFromDOM(){try{this.imageElement&&this.imageElement.parentNode&&this.imageElement.parentNode.removeChild(this.imageElement)}catch(e){this.logger.error("Erro ao remover imagem do DOM:",e)}}applyOptimizedFit(){try{this.containerElement.style.display="flex",this.containerElement.style.alignItems="center",this.containerElement.style.justifyContent="center",this.imageElement.style.maxWidth="100%",this.imageElement.style.maxHeight="100%",this.imageElement.style.objectFit="contain",this.imageElement.style.objectPosition="center",this.logger.debug("Fit simples aplicado com flexbox")}catch(e){this.logger.error("Erro ao aplicar fit simples:",e),this.imageElement.style.width="100%",this.imageElement.style.height="auto",this.imageElement.style.objectFit="contain"}}setupClickHandler(e,t){const r=e.externalUrl?.url||e.success?.url,i=!!this.mediaClickHandler;(i||r)&&(this.imageElement.style.cursor="pointer",this.imageElement.addEventListener("click",()=>{if(this.clickListener?.onClick(e.analytics?.click),i){const t=new Rt(e);return void Promise.resolve(this.mediaClickHandler(t)).catch(e=>this.logger.error("Erro no mediaClickHandler do banner:",e))}this.executeBannerClick(r,e,t)}))}async executeBannerClick(e,t,r){try{const r=t.campaignId||t.campaignUuid;if(!r)return void this.logger.error("Erro ao executar clique: campaignId não encontrado na mídia");const i=new H;i.sendMediaClickEvent(r,t.requestId,t.uuid),i.sendClickThroughEvent(r,t.requestId,t.uuid),window.open(e,"_blank","noopener,noreferrer")}catch(e){this.logger.error("Erro ao executar clique do banner:",e)}}destroy(){this.campaignCall&&(this.campaignCall=void 0),this.imageElement.removeEventListener("click",()=>{}),this.containerElement&&(this.containerElement.innerHTML="")}}class Ht{constructor(e){this.config={timeout:1e4,debug:!1,...e},this.logger=new b(this.config.debug),this.sdkManager=new Vt,this.adsManager=new Ft(this.config.appId,this.config.appVersion,this.config.debug),Pt.setDebugMode(this.config.debug||!1),this.logger.debug("Debug mode salvo via PreferencesUtil:",this.config.debug||!1),this.logger.info("SDK Akross Artemis Ads criado"),this.logger.debug("Configuração:",this.config)}async initialize(){return this.sdkManager.initialize(this.config)}isInitialized(){return this.sdkManager.getIsInitialized()}async setUserId(e,t){return this.sdkManager.setUserId(e,t)}async getUserId(){return this.sdkManager.getUserId()}async getUserData(){return this.sdkManager.getUserData()}async setCustomHeaders(e){return this.sdkManager.setCustomHeaders(e)}async removeCustomHeaders(){return this.sdkManager.removeCustomHeaders()}async getCustomHeaders(){return this.sdkManager.getCustomHeaders()}getConfig(){return this.sdkManager.getConfig()}async clearAll(){return this.sdkManager.clearAll()}getDebugInfo(){return this.sdkManager.getDebugInfo()}getVersion(){return oe()}getVersionInfo(){return le()}async sendEvent(e,t,r,i,n){return this.adsManager.sendEvent(e,t,r,i,n)}async sendCampaignsImpressionEvent(e,t){return this.adsManager.sendCampaignsImpressionEvent(e,t)}async sendCampaignClickEvent(e,t){return this.adsManager.sendCampaignClickEvent(e,t)}async sendSuccessImpressionEvent(e,t,r){return this.adsManager.sendSuccessImpressionEvent(e,t,r)}async sendMediaClickEvent(e,t,r){return this.adsManager.sendMediaClickEvent(e,t,r)}async sendClickThroughEvent(e,t,r){return this.adsManager.sendClickThroughEvent(e,t,r)}async requestCampaign(e,t,r,i){return this.logger.debug("Solicitando campanhas para zona:",e),this.adsManager.requestCampaign(e,t||1,r,i)}async bannerClick(e,t,r,i){return this.logger.debug("Processando clique em banner:",{campaignId:t,mediaId:i}),this.adsManager.bannerClick(e,t,r,i)}}let Wt=null;async function zt(e){return Wt||(Wt=new Ht(e),await Wt.initialize(),Wt)}function Kt(){return Wt}function Gt(){Wt&&(Wt.clearAll(),Wt=null,"undefined"!=typeof window&&delete window.AkrossAds)}"undefined"!=typeof window&&(window.AkrossAds={init:zt,getInstance:Kt,destroy:Gt,SDK:Ht,AAManager:Vt,AdsManager:Ft,VERSION:ce,VERSION_INFO:de,getVersion:oe,getVersionInfo:le,AAMedia:Rt,AACampaign:Dt,AACampaignResponse:Lt,AACampaignResult:Nt,AAZone:St,AAMainData:It,AAContent:E,AASuccess:y,AABenefitOffer:Ct,AAAdWatchResult:w,AAVastPlayer:dt,AARewardedVideoHandler:yt,AAEventsCallbackHelper:H,AARvEventsCallbackHelper:z,AAMediaResultHelper:$,PreferencesUtil:Pt,GlobalLoadingOverlay:re,ArtemisAdsBannerLoader:Bt});export{w as AAAdWatchResult,At as AABanner,Ct as AABenefitOffer,Dt as AACampaign,l as AACampaignConfig,xt as AACampaignRequest,Lt as AACampaignResponse,c as AACampaignResponseStatus,Nt as AACampaignResult,E as AAContent,g as AAError,H as AAEventsCallbackHelper,Tt as AAHeader,kt as AALayout,It as AAMainData,Vt as AAManager,Rt as AAMedia,u as AAMediaPlayResult,$ as AAMediaResultHelper,d as AAMediaTypes,m as AAProgrammatic,yt as AARewardedVideo,z as AARvEventsCallbackHelper,y as AASuccess,f as AASurveyV2,dt as AAVastPlayer,j as AAVastTrackingEvents,St as AAZone,Ft as AdsManager,Ht as AkrossAdsSDK,Bt as ArtemisAdsBannerLoader,S as CAMPAIGN_CLICK_EVENT,C as CLICK_EVENT,e as ConfigUtils,P as ERROR_EVENT,G as ERROR_MESSAGES,mt as GAMRewardedVideoWrapper,k as IMPRESSION_EVENT,b as Logger,vt as LuminaRewardedVideoWrapper,O as NO_FILL_EVENT,M as PROGRAMMATIC_ERROR,x as PROGRAMMATIC_FALLBACK_REQ,U as PROGRAMMATIC_SKIPPED,N as PROG_CONN_ERROR_EVENT,Pt as PreferencesUtil,I as SUCCESS_IMPRESSION_EVENT,ht as StepResult,t as UserDataCache,ce as VERSION,de as VERSION_INFO,D as VPAID_COMPLETE_EVENT,_ as VPAID_FIRST_QUARTILE_EVENT,q as VPAID_MIDPOINT_EVENT,B as VPAID_SKIPPED_EVENT,V as VPAID_START_EVENT,F as VPAID_THIRD_QUARTILE_EVENT,L as WATERFALL_START_EVENT,gt as WaterfallResultHelper,se as applyGPTPpidIfEnabled,W as createAAEventsCallbackHelper,Y as createAAMediaResultHelper,wt as createAARewardedVideoHandler,K as createAARvEventsCallbackHelper,ut as createAAVastPlayer,ft as createGAMRewardedVideoWrapper,Et as createLuminaRewardedVideoWrapper,pt as createWaterfallResultHelper,Gt as destroy,o as getDeviceType,Kt as getInstance,oe as getVersion,le as getVersionInfo,zt as init,i as isAndroid,s as isDesktop,ie as isGPTPpidEnabled,r as isIOS,h as isMediaTypeSupported,a as isMobile,n as isTablet,ne as isValidPPID,X as loadGPTScript,J as loadIMAScript,Z as loadLuminaScript,ae as setGPTPublisherProvidedId};
1
+ class e{static applyDefaults(e){return{timeout:5e3,debug:!1,proxyExternalScripts:!1,enableGPTPpid:!1,...e}}static hasBaseUrl(e){return!!(e.baseUrl&&e.baseUrl.trim().length>0)}static hasArtemisAppId(e){return!!(e.artemisAdsAppId&&e.artemisAdsAppId.trim().length>0)}static getArtemisAppId(e,t){return e.artemisAdsAppId||t||""}static isValid(e){return this.hasBaseUrl(e)&&this.hasArtemisAppId(e)}static getPrimaryColor(e,t="#007bff"){return e.primaryColor||t}static isValidColor(e){return!!e&&/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)}static getLuminaToken(e,t="QQDCYMdFh2AJqwP"){return e.luminaToken||t}}class t{constructor(e){this.userId=e.userId,this.advertisingId=e.advertisingId,Object.keys(e||{}).forEach(t=>{t in this||(this[t]=e[t])})}hasAdvertisingId(){return!!(this.advertisingId&&this.advertisingId.trim().length>0)}getAdvertisingId(e){return this.advertisingId||e||""}setAdvertisingId(e){this.advertisingId=e}clearAdvertisingId(){this.advertisingId=null}isValid(){return!!(this.userId&&this.userId.trim().length>0)}getUserId(e){return this.userId||e||""}hasCompleteData(){return this.isValid()&&this.hasAdvertisingId()}}function r(){if("undefined"==typeof navigator)return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/iPhone|iPad|iPod/i.test(e)||/iPhone|iPad|iPod/i.test(t)}function i(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent||"";return/Android/i.test(e)}function n(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/iPad/i.test(t)||/Macintosh/i.test(e)&&"undefined"!=typeof document&&"ontouchend"in document,i=/Android/i.test(e)&&!/Mobile/i.test(e);return r||i}function a(){if("undefined"==typeof navigator)return!1;if(n())return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/iPhone|iPod/i.test(t)||/iPhone|iPod/i.test(e),i=/Android/i.test(e)&&/Mobile/i.test(e);return r||i}function s(){if("undefined"==typeof navigator)return!1;if(a()||n())return!1;const e=navigator.userAgent||"",t=navigator.platform||"",i=/Win/i.test(t)||/Windows/i.test(e),s=/Mac/i.test(t)&&!r(),o=/Linux/i.test(t)&&!/Android/i.test(e);return i||s||o}function o(){return a()?"mobile":n()?"tablet":s()?"desktop":"unknown"}class l{constructor(e){this.params=e.params,this.type=e.type,Object.keys(e).forEach(t=>{"params"!==t&&"type"!==t&&(this[t]=e[t])})}findParamByKey(e){return this.params?.find(t=>t.key===e)?.value}findAdUnitId(){return r()?this.findParamByKey("adUnitIdiOS")??this.findParamByKey("adUnitId")??"":this.findParamByKey("adUnitId")??""}findVastTag(){return this.findParamByKey("tag")??""}findEventSuffix(){return this.findParamByKey("eventSuffix")??""}findTimeout(){const e=this.findParamByKey("timeout");return e?parseInt(e,10):void 0}}var c,d,u;function h(e){return[d.BANNER,d.VIDEO_V2,d.PROGRAMMATIC_V2,d.SURVEY_V2,d.EXTERNAL_REDIRECT,d.TYPE_GOOGLE_RV,d.TYPE_GOOGLE_RI,d.TYPE_MAX_RV,d.TYPE_KWAI_RV,d.TYPE_FALLBACK].includes(e)}!function(e){e.SUCCESS="SUCCESS",e.ERROR="ERROR",e.EMPTY="EMPTY"}(c||(c={})),function(e){e.BANNER="image",e.VIDEO_V2="video_v2",e.PROGRAMMATIC_V2="programatica_v2",e.SURVEY_V2="survey_v2",e.EXTERNAL_REDIRECT="external_redirect",e.TYPE_GOOGLE_RV="GAM_RV",e.TYPE_GOOGLE_RI="GAM_RI",e.TYPE_MAX_RV="MAX_RV",e.TYPE_KWAI_RV="KWAI_RV",e.TYPE_FALLBACK="fallback",e.PROGRAMMATIC="programatica",e.PROGRAMMATIC_ADMOB_RB="google-admob-rv",e.PROGRAMMATIC_MAX_RV="max-rv",e.UNKNOWN=""}(d||(d={})),function(e){e[e.REWARDED=11]="REWARDED",e[e.REWARDED_REDIRECTED=12]="REWARDED_REDIRECTED",e[e.MEDIA_WATCHED=13]="MEDIA_WATCHED",e[e.SKIPPED=20]="SKIPPED",e[e.ERROR=21]="ERROR",e[e.CONNECTION_ERROR=22]="CONNECTION_ERROR",e[e.NO_FILL=23]="NO_FILL",e[e.CANCELED=24]="CANCELED",e[e.POLL_WRONG_ANSWER=25]="POLL_WRONG_ANSWER",e[e.EXTERNAL_REDIRECT=26]="EXTERNAL_REDIRECT",e[e.BANNER_CLICK=27]="BANNER_CLICK"}(u||(u={}));class g{constructor(e,t){this.description=e,this.cause=t}}class p{constructor(e){this.type=e.type,this.url=e.url,this.originalContent=e.originalContent,this.proxy=e.proxy,this.skipEnabled=e.skipEnabled,this.skipSeconds=e.skipSeconds,this.videoId=e.videoId,this.eventSuffix=e.eventSuffix}hasUrl(){return!(!this.url||!this.url.trim())}hasType(){return!(!this.type||!this.type.trim())}isSupportedType(){return["IN_HOUSE","VAST","VPAID"].includes(this.type?.toUpperCase())}}class m{constructor(e){this.waterfall=e.waterfall?e.waterfall.map(e=>new l(e)):void 0}hasWaterfall(){return!!(this.waterfall&&this.waterfall.length>0)}getInfo(){return this.hasWaterfall()?`Waterfall com ${this.waterfall.length} anúncios`:"Conteúdo programático vazio"}}class f{constructor(e){this.url=e.url,this.adBlock=e.adBlock}hasUrl(){return!(!this.url||!this.url.trim())}hasAdBlock(){return!(!this.adBlock||!this.adBlock.trim())}}let v=class{constructor(e){this.infoPrimary=e.infoPrimary,this.infoSecondary=e.infoSecondary,this.actionButtonLabel=e.actionButtonLabel,this.link=e.link,this.thumbnail=e.thumbnail}hasLink(){return!(!this.link||!this.link.trim())}hasThumbnail(){return!(!this.thumbnail||!this.thumbnail.trim())}hasInfoPrimary(){return!(!this.infoPrimary||!this.infoPrimary.trim())}hasInfoSecondary(){return!(!this.infoSecondary||!this.infoSecondary.trim())}hasActionButtonLabel(){return!(!this.actionButtonLabel||!this.actionButtonLabel.trim())}};class E{constructor(e){this.url=e.url,this.programmatic=e.programmatic?new m(e.programmatic):void 0,this.video=e.video?new p(e.video):void 0,this.infoPrimary=e.infoPrimary,this.infoSecondary=e.infoSecondary,this.survey=e.survey?new f(e.survey):void 0,this.externalRedirect=e.externalRedirect?new v(e.externalRedirect):void 0,!this.externalRedirect&&(e.link||e.actionButtonLabel||e.thumbnail)&&(this.externalRedirect=new v({infoPrimary:e.infoPrimary,infoSecondary:e.infoSecondary,actionButtonLabel:e.actionButtonLabel,link:e.link,thumbnail:e.thumbnail}))}hasUrl(){return!(!this.url||!this.url.trim())}isProgrammatic(){return!(!this.programmatic||!this.programmatic.hasWaterfall())}isSurvey(){return!(!this.survey||!this.survey.hasUrl())}isExternalRedirect(){return!(!this.externalRedirect||!this.externalRedirect.hasLink())}getInfo(){return this.hasUrl()?`URL: ${this.url}`:this.isProgrammatic()?this.programmatic.getInfo():this.isSurvey()?`Survey: ${this.survey.url}`:this.isExternalRedirect()?`External Redirect: ${this.externalRedirect.link}`:"Conteúdo vazio"}}class y{constructor(e){this.type=e.type,this.title=e.title,this.description=e.description,this.buttons=e.buttons||[],this.url=e.url,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isExternal(){return"EXTERNAL"===this.type}hasUrl(){return!(!this.url||!this.url.trim())}hasButtons(){return this.buttons.length>0}getInfo(){return`${this.title}: ${this.description}`}}class w{constructor(e){this.media=e.media,this.result=e.result,this.error=e.error,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isSuccess(){return this.result===u.REWARDED||this.result===u.REWARDED_REDIRECTED||this.result===u.EXTERNAL_REDIRECT||this.result===u.BANNER_CLICK}isSkipped(){return this.result===u.SKIPPED}hasError(){return this.result===u.ERROR||!!this.error}getErrorMessage(){return this.error?this.error.description||this.error.cause||"Erro desconhecido":"Sem erro"}getInfo(){return this.isSuccess()?"Anúncio visualizado com sucesso":this.isSkipped()?"Anúncio pulado":this.hasError()?`Erro: ${this.getErrorMessage()}`:"Resultado desconhecido"}}class b{constructor(e=!1){this.debugMode=e}debug(e,...t){this.debugMode}info(e,...t){}warn(e,...t){}error(e,...t){}}class A{constructor(){}interceptRequest(e){const t=qt.getCustomHeaders();if(t){const r=new Headers(e.headers);Object.entries(t).forEach(([e,t])=>{r.set(e,t)}),e.headers=r}const r=new Headers(e.headers);return r.set("Content-Type","application/json"),r.set("Accept","application/json"),e.headers=r,e}interceptResponse(e){return e}}class R{constructor(e){this.fetchConfig=e}async fetchWithConfig(e,t={}){const{baseUrl:r,restInterceptor:i}=this.fetchConfig;i&&(t=i.interceptRequest(t));const n=new URL(e,r).toString();return fetch(n,{...t})}async requestCampaign(e,t,r,i){const n=`campaign/v3/${e}?size=${r}${i?`&t=${i}`:""}`,a=await this.fetchWithConfig(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(`Failed to request campaign: ${a.statusText}`);return 204==a.status?{}:a.json()}async sendTracking(e,t,r,i,n,a){const s=`tracker?e=${e}&c=${t??""}&u=${r}&requestId=${i}${n?`&m=${n}`:""}${a?`&s=${a}`:""}`,o=await this.fetchWithConfig(s,{method:"POST",keepalive:!0});if(!o.ok)throw new Error(`Failed to send tracking: ${o.statusText}`)}async checkConnectivity(e="https://access-network.akross.com.br"){const t=Math.round(1e4*Math.random()),r=await this.fetchWithConfig(`${e}?rand=${t}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to check connectivity: ${r.statusText}`);return r}async sendParsedVastTrackingEvent(e){const t=await this.fetchWithConfig(e,{method:"GET",keepalive:!0});if(!t.ok)throw new Error(`Failed to send parsed VAST tracking event: ${t.statusText}`)}}class T{constructor(){}createFetchConfig(e,t,r=!1,i=!0){return{baseUrl:e,timeout:t,debugMode:r,restInterceptor:i?new A:null}}init(e="",t=5,r=!1,i=!0){let n=e;if(""===n){const e=qt.getConfig();n=e?.baseUrl||"https://internal-artemis-837746407.us-east-1.elb.amazonaws.com/adserver/"}return this.createFetchConfig(n,t,r,i)}getArtemisAdsService(e=30,t=!1,r=!0){const i=this.init("",e,t,r);return new R(i)}}const k="impression",I="success_impression",C="click",D="complete",S="campaign-click",L="prog-wtfl-start",N="prog-conn-error",x="prog-fallback-req",M="prog-ad-error",O="prog-ad-no-fill",U="prog-skipped",P="ad-error",V="start",_="firstQuartile",q="midpoint",F="thirdQuartile",B="skipped";class H{constructor(){this.logger=new b(qt.getDebugMode()),this.apiFactory=new T}async sendEvent(e,t,r,i,n){await this.requestEvent(e,t,r,i,n)}async requestEvent(e,t,r,i,n){const a=qt.getUserData(),s=a?.userId;if(s)try{const a=qt.getDebugMode(),o=this.apiFactory.getArtemisAdsService(3,a);await o.sendTracking(e,t,s,r,i,n),this.logger.debug(`Event sent successfully: ${e} for campaign ${t}`)}catch(e){this.logger.warn("Error sending tracking event:",e)}else this.logger.error("Error sending tracking event: User id is null")}async sendMediaClickEvent(e,t,r){await this.sendEvent("media-click",e,t,r)}async sendCampaignClickEvent(e,t){await this.sendEvent(S,e,t)}async sendCampaignsImpressionEvent(e,t){for(const r of t)await this.sendEvent(k,r.campaignUuid,e)}async sendImpressedEvent(e,t,r){await this.sendEvent(k,e,t,r)}async sendSuccessImpressionEvent(e,t,r){await this.sendEvent(I,e,t,r)}async sendCompleteEvent(e,t,r,i){await this.sendEvent(D,e,t,r,i)}async sendAllAdsCompletedEvent(e,t,r,i){await this.sendEvent("all-ads-completed"+(i?`${i}`:""),e,t,r)}async sendAdCompletedEvent(e,t,r){await this.sendEvent("ad-completed",e,t,r)}async sendEventFromUrl(e){try{const t=qt.getDebugMode(),r=this.apiFactory.getArtemisAdsService(3,t);await r.sendParsedVastTrackingEvent(e),this.logger.debug("Parsed VAST tracking event sent successfully")}catch(e){this.logger.warn("Error sending tracking event from URL:",e)}}async sendVpaidStartEvent(e,t,r){await this.sendEvent(V,e,t,r)}async sendFirstQuartileEvent(e,t,r){await this.sendEvent(_,e,t,r)}async sendMidpointEvent(e,t,r){await this.sendEvent(q,e,t,r)}async sendThirdQuartileEvent(e,t,r){await this.sendEvent(F,e,t,r)}async sendSkippedEvent(e,t,r){await this.sendEvent(B,e,t,r)}async sendAdErrorEvent(e,t,r){await this.sendEvent(P,e,t,r)}async sendAdNoFillEvent(e,t,r){await this.sendEvent(O,e,t,r)}async sendWaterfallStartEvent(e,t,r){await this.sendEvent(L,e,t,r)}async sendProgConnectionError(e,t,r){await this.sendEvent(N,e,t,r)}async sendProgFallbackReq(e,t,r){await this.sendEvent(x,e,t,r)}async sendProgError(e,t,r){await this.sendEvent(M,e,t,r)}async sendProgSkipped(e,t,r){await this.sendEvent(U,e,t,r)}async sendClickThroughEvent(e,t,r){await this.sendEvent("clickthrough",e,t,r)}async sendParsedVastTrackingEvent(e){await this.sendEventFromUrl(e)}}function W(){return new H}const z=H,K=W,G={REWARDED:"Benefício adiquirido com sucesso",NOT_REWARDED:"Você precisa assistir o anúncio até o fim para obter o benefício",REDIRECT_ERROR:"Você não tem nenhum aplicativo instalado para abrir uma página na web",ERROR:"Ocorreu um erro ao exibir o anúncio. Por favor, tente novamente",CONNECTION_ERROR:"Ocorreu um erro ao exibir o anúncio. Por favor, verifique sua conexão e tente novamente",NO_FILL:"Não foi possível encontrar uma publicidade no momento. Por favor, tente novamente",VAST_BACK:"Para obter o prêmio é necessário assistir o vídeo até o final"};var j;!function(e){e.IMPRESSION="IMPRESSION",e.CLICKTHROUGH="CLICKTHROUGH",e.VAST_IMPRESSION="VAST_IMPRESSION",e.START="START",e.FIRST_QUARTILE="FIRST_QUARTILE",e.MIDPOINT="MIDPOINT",e.THIRD_QUARTILE="THIRD_QUARTILE",e.COMPLETE="COMPLETE",e.ERROR="ERROR",e.SKIPPED="SKIPPED",e.NO_FILL="NO_FILL",e.PROGRAMMATIC_ERROR="PROGRAMMATIC_ERROR",e.PROGRAMMATIC_SKIPPED="PROGRAMMATIC_SKIPPED",e.PROGRAMMATIC_WATERFALL_START="PROGRAMMATIC_WATERFALL_START",e.PROGRAMMATIC_CONNECTION_ERROR="PROGRAMMATIC_CONNECTION_ERROR",e.PROGRAMMATIC_FALLBACK_REQ="PROGRAMMATIC_FALLBACK_REQ",e.AD_COMPLETED="AD_COMPLETED",e.ALL_ADS_COMPLETED="ALL_ADS_COMPLETED"}(j||(j={}));class ${constructor(e){this.sentEvents=new Set,this.config=e,this.logger=new b(qt.getDebugMode()),this.eventsHelper=new H}sendEventCallback(e,t){if(this.sentEvents.has(e))this.logger.debug(`Event ${e} already sent, skipping`);else switch(this.sentEvents.add(e),this.logger.debug(`Sending event: ${e} for media: ${t.title}`),e){case j.IMPRESSION:this.onAdImpression(t);break;case j.START:this.onAdStarted(t);break;case j.FIRST_QUARTILE:this.onFirstQuartile(t);break;case j.MIDPOINT:this.onMidpoint(t);break;case j.THIRD_QUARTILE:this.onThirdQuartile(t);break;case j.COMPLETE:this.onAdComplete(t);break;case j.ERROR:this.onAdError(t);break;case j.SKIPPED:this.onAdSkipped(t);break;case j.NO_FILL:this.onProgrammaticNoFill(t);break;case j.PROGRAMMATIC_ERROR:this.onProgrammaticAdError(t);break;case j.PROGRAMMATIC_SKIPPED:this.onProgrammaticSkipped(t);break;case j.PROGRAMMATIC_WATERFALL_START:this.onProgrammaticStart(t);break;case j.PROGRAMMATIC_CONNECTION_ERROR:this.onProgrammaticConnectionError(t);break;case j.PROGRAMMATIC_FALLBACK_REQ:this.onProgrammaticFallbackReq(t);break;case j.CLICKTHROUGH:this.onClickThrough(t);break;case j.AD_COMPLETED:this.onAdCompleted(t);break;case j.ALL_ADS_COMPLETED:this.onAllAdsCompleted(t);break;default:this.logger.warn(`Unknown event: ${e}`)}}finishWithResult(e,t,r){const i=new w({media:e,result:t});switch(t){case u.REWARDED:if(this.logger.debug(`Checking mediasLeft: ${e.mediasLeft} (type: ${typeof e.mediasLeft})`),(e.mediasLeft||0)>1)this.logger.debug(`Setting result to MEDIA_WATCHED because mediasLeft (${e.mediasLeft}) > 1`),i.result=u.MEDIA_WATCHED;else if(this.logger.debug(`Keeping result as REWARDED because mediasLeft (${e.mediasLeft}) <= 1`),"EXTERNAL"===e.success?.type)try{e.success.url&&(window.open(e.success.url,"_blank"),i.result=u.REWARDED_REDIRECTED)}catch(e){i.error=new g(G.REDIRECT_ERROR),i.result=u.ERROR}break;case u.ERROR:i.error=new g(G.ERROR,r);break;case u.NO_FILL:i.error=new g(G.NO_FILL,"NO_FILL");break;case u.CONNECTION_ERROR:i.error=new g(G.CONNECTION_ERROR,"CONNECTION_ERROR");break;case u.CANCELED:i.error=new g(G.NOT_REWARDED);break;case u.REWARDED_REDIRECTED:case u.EXTERNAL_REDIRECT:break;default:this.logger.warn(`Unknown result: ${t}`)}return i}onAdImpression(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendImpressedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdClickThrough(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendClickThroughEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdStarted(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendVpaidStartEvent(e.campaignId||"",e.requestId||"",e.uuid)}onFirstQuartile(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendFirstQuartileEvent(e.campaignId||"",e.requestId||"",e.uuid)}onMidpoint(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendMidpointEvent(e.campaignId||"",e.requestId||"",e.uuid)}onThirdQuartile(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendThirdQuartileEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdComplete(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendCompleteEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdCompleted(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendAdCompletedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAllAdsCompleted(e){this.eventsHelper.sendAllAdsCompletedEvent(e.campaignId||"",e.requestId||"",e.uuid,e.content?.video?.eventSuffix)}onAdSkipped(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendSkippedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdError(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendAdErrorEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticNoFill(e){this.eventsHelper.sendAdNoFillEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticStart(e){this.eventsHelper.sendWaterfallStartEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticConnectionError(e,t){this.eventsHelper.sendProgConnectionError(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticFallbackReq(e){this.eventsHelper.sendProgFallbackReq(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticAdError(e,t){this.eventsHelper.sendProgError(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticSkipped(e){this.eventsHelper.sendProgSkipped(e.campaignId||"",e.requestId||"",e.uuid)}onClickThrough(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendClickThroughEvent(e.campaignId||"",e.requestId||"",e.uuid)}canSendLocalEvents(e){if(e.type===d.VIDEO_V2){const t=e.content?.video?.type?.toUpperCase();return"VAST"===t||"VPAID"===t}return!0}clearSentEvents(){this.sentEvents.clear()}hasEventBeenSent(e){return this.sentEvents.has(e)}}function Y(e){return new $(e)}const Q=1e3;function X(e=!1){return new Promise((t,r)=>{if(window.googletag)return void t();if(document.getElementById("gpt-script"))setTimeout(()=>{window.googletag?t():r(new Error("GPT script exists but not loaded"))},Q);else{const i="https://www.googletagservices.com/tag/js/gpt.js",n=document.createElement("script");n.src=ee("gpt.js",i,e),n.id="gpt-script",n.async=!0,n.onload=()=>{setTimeout(()=>{window.googletag?t():r(new Error("GPT script failed to initialize"))},Q)},n.onerror=e=>{r(e)},document.head.appendChild(n)}})}function J(e=!1){return new Promise((t,r)=>{if(window.google&&window.google.ima)return void t();if(document.getElementById("ima-script"))setTimeout(()=>{window.google&&window.google.ima?t():r(new Error("IMA SDK script exists but not loaded"))},Q);else{const i="https://imasdk.googleapis.com/js/sdkloader/ima3.js",n=document.createElement("script");n.src=ee("ima3.js",i,e),n.id="ima-script",n.async=!0,n.onload=()=>{setTimeout(()=>{window.google&&window.google.ima?t():r(new Error("IMA SDK failed to initialize"))},Q)},n.onerror=e=>{r(e)},document.head.appendChild(n)}})}function Z(e,t=!1){return new Promise((r,i)=>{if(window.adsbylumina&&window.__luminaBasecodeReady__)return void r();if(document.getElementById("lumina-script"))setTimeout(()=>{window.adsbylumina&&window.__luminaBasecodeReady__?r():i(new Error("Lumina SDK script exists but not loaded"))},Q);else{const n="https://s16-ad.ap4r.com/kos/s101/nlav11187/lumina/lumina-install.js",a=new URLSearchParams;e.token&&a.append("token",e.token),void 0!==e.debug&&a.append("debug",e.debug.toString());const s=`${n}?${a.toString()}`,o=document.createElement("script");o.src=ee("lumina-install.js",s,t),o.id="lumina-script",o.async=!0,o.onload=()=>{setTimeout(()=>{window.adsbylumina&&window.__luminaBasecodeReady__?r():i(new Error("Lumina SDK failed to initialize"))},Q)},o.onerror=e=>{i(new Error("Failed to load Lumina SDK script"))},document.head.appendChild(o)}})}function ee(e,t,r=!1){if(!r)return t;const i=qt.getConfig()?.cdnBaseUrl;return i?`${i}/static/js/${e}`:t}class te{constructor(e){this.modalElement=null,this.videoElement=null,this.videoContainer=null,this.closeButton=null,this.fallbackOverlay=null,this.fallbackTimerEl=null,this.fallbackSaibaMaisBtn=null,this.logger=e}createModal(){try{if(this.cleanup(),this.modalElement=document.createElement("div"),this.modalElement.innerHTML='\n <style>\n .aa-vast-modal {\n display: flex;\n flex-direction: column;\n position: fixed;\n inset: 0;\n width: 100vw;\n height: 100vh;\n background-color: #000;\n z-index: 2147483647;\n overflow: hidden;\n }\n\n .aa-vast-header {\n flex-shrink: 0;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n padding: 0 8px;\n background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));\n z-index: 10;\n }\n\n .aa-vast-modal-dialog {\n flex: 1;\n min-height: 0;\n position: relative;\n overflow: hidden;\n }\n\n .content-video-vast {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .aa-vast-close-btn {\n position: relative;\n width: 44px;\n height: 44px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.5);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background-color 0.2s ease, transform 0.15s ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .aa-vast-close-btn:hover {\n background-color: rgba(0, 0, 0, 0.8);\n }\n\n .aa-vast-close-btn:active {\n transform: scale(0.95);\n }\n\n .aa-vast-close-btn::before,\n .aa-vast-close-btn::after {\n content: \'\';\n position: absolute;\n width: 22px;\n height: 2px;\n background-color: #fff;\n border-radius: 1px;\n }\n\n .aa-vast-close-btn::before {\n transform: rotate(45deg);\n }\n\n .aa-vast-close-btn::after {\n transform: rotate(-45deg);\n }\n\n .ima-ad-container {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 2;\n }\n\n .ima-ad-container > * {\n pointer-events: auto;\n }\n\n .ima-video-element {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: contain;\n cursor: pointer;\n z-index: 1;\n }\n\n .ima-video-element:focus {\n outline: none;\n }\n\n .aa-vast-fallback-overlay {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 5;\n display: none;\n align-items: flex-end;\n justify-content: flex-end;\n padding: 24px 16px 16px;\n background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));\n pointer-events: none;\n }\n\n .aa-vast-fallback-overlay.is-visible {\n display: flex;\n pointer-events: auto;\n }\n\n .aa-vast-fallback-overlay > * {\n pointer-events: auto;\n }\n\n .aa-vast-fallback-timer {\n position: absolute;\n left: 0;\n bottom: 0;\n color: #fff;\n display: inline-block;\n font-family: Arial, sans-serif;\n font-weight: normal;\n font-size: 11px;\n line-height: normal;\n padding: 5px;\n padding-right: 10px;\n pointer-events: auto;\n text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);\n cursor: default;\n }\n\n .aa-vast-fallback-saiba-mais {\n padding: 8px 16px;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n background-color: rgba(255, 255, 255, 0.25);\n border: 1px solid rgba(255, 255, 255, 0.5);\n border-radius: 4px;\n cursor: pointer;\n text-decoration: none;\n transition: background-color 0.2s ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .aa-vast-fallback-saiba-mais:hover {\n background-color: rgba(255, 255, 255, 0.35);\n }\n </style>\n <div id="modal" class="aa-vast-modal">\n <header class="aa-vast-header">\n <button type="button" class="aa-vast-close-btn" id="close-modal" aria-label="Fechar anúncio"></button>\n </header>\n <div class="aa-vast-modal-dialog">\n <div id="content-video-vast" class="content-video-vast">\n <video id="ima-video-element" class="ima-video-element" autoplay playsinline></video>\n <div id="ima-ad-container" class="ima-ad-container"></div>\n </div>\n <div id="aa-vast-fallback-overlay" class="aa-vast-fallback-overlay" aria-hidden="true">\n <span id="aa-vast-fallback-timer" class="aa-vast-fallback-timer">Anúncio 0:00</span>\n <button type="button" id="aa-vast-fallback-saiba-mais" class="aa-vast-fallback-saiba-mais">Saiba mais</button>\n </div>\n </div>\n </div>\n ',document.body.appendChild(this.modalElement),this.videoElement=this.modalElement.querySelector("#ima-video-element"),this.videoContainer=this.modalElement.querySelector(".content-video-vast"),this.closeButton=this.modalElement.querySelector("#close-modal"),this.fallbackOverlay=this.modalElement.querySelector("#aa-vast-fallback-overlay"),this.fallbackTimerEl=this.modalElement.querySelector("#aa-vast-fallback-timer"),this.fallbackSaibaMaisBtn=this.modalElement.querySelector("#aa-vast-fallback-saiba-mais"),!this.videoElement)throw new Error("Video element not found");return this.logger.debug("Modal created successfully"),this.videoElement}catch(e){throw this.logger.error("Error creating modal:",e),e}}getVideoElement(){return this.videoElement}getVideoContainer(){return this.videoContainer}getAdContainer(){return this.modalElement?this.modalElement.querySelector("#ima-ad-container"):null}setCloseCallback(e){this.closeButton&&this.closeButton.addEventListener("click",e)}showFallbackOverlay(e){this.fallbackOverlay&&(this.fallbackOverlay.classList.add("is-visible"),this.fallbackOverlay.setAttribute("aria-hidden","false"),this.fallbackSaibaMaisBtn&&(this.fallbackSaibaMaisBtn.style.display=e?"":"none"),this.logger.debug("Fallback overlay shown"))}hideFallbackOverlay(){this.fallbackOverlay&&(this.fallbackOverlay.classList.remove("is-visible"),this.fallbackOverlay.setAttribute("aria-hidden","true"),this.logger.debug("Fallback overlay hidden"))}updateFallbackTimer(e,t){if(!this.fallbackTimerEl)return;const r=Math.max(0,Math.floor((t||0)-e)),i=Math.floor(r/60),n=r%60;this.fallbackTimerEl.textContent=`Anúncio ${i}:${n.toString().padStart(2,"0")}`}setFallbackSaibaMaisClick(e){this.fallbackSaibaMaisBtn&&this.fallbackSaibaMaisBtn.addEventListener("click",e)}close(){this.modalElement&&(this.modalElement.style.display="none")}hide(){this.modalElement&&(this.modalElement.style.display="none",this.modalElement.style.visibility="hidden",this.logger.debug("Modal hidden (not removed)"))}remove(){this.modalElement&&(document.body.removeChild(this.modalElement),this.modalElement=null)}showVideo(){this.videoElement&&(this.videoElement.style.display="block",this.videoElement.style.visibility="visible",this.logger.debug("Video made visible"))}cleanup(){try{this.closeButton&&(this.closeButton.remove(),this.closeButton=null),this.fallbackOverlay=null,this.fallbackTimerEl=null,this.fallbackSaibaMaisBtn=null,this.videoElement&&(this.videoElement=null),this.videoContainer&&(this.videoContainer.remove(),this.videoContainer=null),this.modalElement&&(this.modalElement.remove(),this.modalElement=null),this.logger.debug("UI cleaned up successfully")}catch(e){this.logger.error("Error cleaning up UI:",e)}}}class re{static show(){if(this.isVisible)return;const e=qt.getConfig(),t=e?.primaryColor||"#007bff",r=document.createElement("div");r.id=this.OVERLAY_ID,r.innerHTML=`\n <style>\n #${this.OVERLAY_ID} {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.8);\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n margin: 0;\n padding: 0;\n }\n \n #${this.OVERLAY_ID} .loading-content {\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n #${this.OVERLAY_ID} .spinner {\n width: 40px;\n height: 40px;\n border: 4px solid rgba(255, 255, 255, 0.3);\n border-top: 4px solid ${t};\n border-radius: 50%;\n animation: spin 1s linear infinite;\n margin-bottom: 16px;\n flex-shrink: 0;\n }\n \n #${this.OVERLAY_ID} .loading-text {\n font-size: 16px;\n font-weight: 500;\n margin: 0;\n line-height: 1.2;\n }\n \n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n </style>\n <div class="loading-content">\n <div class="spinner"></div>\n <p class="loading-text">Carregando Publicidade</p>\n </div>\n `,document.body.appendChild(r),this.isVisible=!0}static hide(){const e=document.getElementById(this.OVERLAY_ID);e&&(e.remove(),this.isVisible=!1)}static isShowing(){return this.isVisible}static forceHide(){const e=document.getElementById(this.OVERLAY_ID);e&&e.remove(),this.isVisible=!1}}re.OVERLAY_ID="akross-loading-overlay",re.isVisible=!1;function ie(){return!0===qt.getConfig()?.enableGPTPpid}function ne(e){if(!e||"string"!=typeof e)return!1;const t=e.trim();return t.length>=1&&t.length<=150}function ae(e){if(!ie())return;if(!ne(e))return;if("undefined"==typeof window)return;const t=e.trim();window.googletag=window.googletag||{cmd:[]},window.googletag.cmd.push(()=>{try{"function"==typeof window.googletag?.pubads&&window.googletag.pubads().setPublisherProvidedId(t)}catch{}})}function se(){if(!ie())return;if("undefined"==typeof window||"function"!=typeof window.googletag?.pubads)return;const e=qt.getUserData()?.userId;if(e&&ne(e))try{window.googletag.pubads().setPublisherProvidedId(e.trim())}catch{}}function oe(){if("undefined"!=typeof __VERSION__)return __VERSION__;if("undefined"!=typeof process&&process.env?.npm_package_version)return process.env.npm_package_version;try{return"3.7.8"}catch(e){return"unknown"}}function le(){const e=oe(),t="undefined"!=typeof process&&process.env;return{version:e,isDevelopment:!!t&&"development"===process.env.NODE_ENV,isProduction:!t||"production"===process.env.NODE_ENV,buildTime:(new Date).toISOString()}}const ce=oe(),de=le();class ue{constructor(e){this.overlayElement=null,this.iframeElement=null,this.loadingElement=null,this.errorElement=null,this.retryButton=null,this.closeButton=null,this.isSurveyCompleted=!1,this.isSurveyClosed=!1,this.media=e;const t=qt.getDebugMode();this.logger=new b(t),this.mediaResultHelper=new $({userId:qt.getUserData()?.userId||"",debug:t})}async start(){try{return this.logger.debug("Starting survey overlay for media:",this.media.title),"survey_v2"!==this.media.type&&"video_v2"!==this.media.type?(this.logger.error("Unsupported media type:",this.media.type),new w({media:this.media,result:u.ERROR,error:new g("Unsupported media type")})):this.media.content?.survey?.url?(this.createOverlay(),this.setupEventListeners(),this.loadSurvey(),new Promise(e=>{this.onResultCallback=t=>{let r=this.mediaResultHelper.finishWithResult(t.media,t.result);e(r)}})):(this.logger.error("Survey URL not found"),new w({media:this.media,result:u.ERROR,error:new g("Survey URL not found")}))}catch(e){return this.logger.error("Error starting survey overlay:",e),new w({media:this.media,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.innerHTML=`\n <style>${ue.OVERLAY_CSS}</style>\n <div class="aa-survey-overlay">\n <div class="aa-survey-dialog">\n <div class="aa-survey-content">\n <iframe class="aa-survey-iframe"></iframe>\n <div class="aa-survey-loading" style="display: none;">\n <div style="width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #007bff; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 16px;"></div>\n <div style="color: #666; font-size: 14px;">Carregando pesquisa...</div>\n </div>\n <div class="aa-survey-error" style="display: none;">\n <div style="font-size: 48px; margin-bottom: 16px;">⚠️</div>\n <div class="aa-survey-error-message" style="font-size: 16px; color: #666; margin-bottom: 24px;"></div>\n <button style="background-color: #007bff; color: white; border: none; padding: 12px 24px; border-radius: 4px; cursor: pointer; font-size: 14px; transition: background-color 0.2s ease;">Tentar Novamente</button>\n </div>\n </div>\n <button type="button" class="closeButton"></button>\n </div>\n </div>\n `,document.body.appendChild(this.overlayElement),this.iframeElement=this.overlayElement.querySelector(".aa-survey-iframe"),this.loadingElement=this.overlayElement.querySelector(".aa-survey-loading"),this.errorElement=this.overlayElement.querySelector(".aa-survey-error"),this.retryButton=this.overlayElement.querySelector('button[style*="Tentar Novamente"]'),this.closeButton=this.overlayElement.querySelector(".closeButton"),this.applyPrimaryColor(),this.logger.debug("Survey overlay created")}applyPrimaryColor(){const t=qt.getConfig(),r=t?e.getPrimaryColor(t,"#007bff"):"#007bff";if(this.loadingElement){const e=this.loadingElement.querySelector('div[style*="border-top"]');e&&(e.style.borderTop=`4px solid ${r}`)}this.retryButton&&(this.retryButton.style.backgroundColor=r,this.retryButton.addEventListener("mouseenter",()=>{this.retryButton.style.backgroundColor=this.darkenColor(r,10)}),this.retryButton.addEventListener("mouseleave",()=>{this.retryButton.style.backgroundColor=r}))}setupEventListeners(){this.retryButton&&this.retryButton.addEventListener("click",()=>{this.hideErrorInterface(),this.loadSurvey()}),this.closeButton&&this.closeButton.addEventListener("click",()=>{this.executeBackButtonLogic()}),document.addEventListener("keydown",e=>{"Escape"===e.key&&this.executeBackButtonLogic()}),this.overlayElement&&this.overlayElement.addEventListener("click",e=>{e.target===this.overlayElement&&this.executeBackButtonLogic()})}loadSurvey(){this.iframeElement&&this.media.content?.survey?.url?(this.logger.debug("Loading survey from URL:",this.media.content.survey.url),this.hideErrorInterface(),this.showLoading(),this.iframeElement.src=this.media.content.survey.url,this.iframeElement.onload=()=>{this.hideLoading(),setTimeout(()=>{this.injectSurveyBridge()},100)},this.iframeElement.onerror=()=>{this.hideLoading(),this.showErrorInterface("Erro ao carregar a pesquisa")}):this.showErrorInterface("URL da pesquisa não encontrada")}injectSurveyBridge(){try{this.setupMessageListener(),this.attemptScriptInjection()}catch(e){this.logger.error("Error setting up survey bridge:",e)}}setupMessageListener(){const e=e=>{const{data:t}=e;t&&"akross-survey"===t.source&&(this.logger.debug("Survey message received from iframe:",t),this.handleSurveyMessage(t))};window.addEventListener("message",e),this._messageHandler=e}attemptScriptInjection(){const e=this.createSurveyBridgeScript(),t=()=>{try{if(!this.iframeElement?.contentWindow)return!1;const t=this.iframeElement.contentDocument||this.iframeElement.contentWindow.document;if(t&&"complete"===t.readyState){const r=t.createElement("script");return r.textContent=e,t.head.appendChild(r),!0}return"function"==typeof this.iframeElement.contentWindow.eval&&(this.iframeElement.contentWindow.eval(e),!0)}catch(e){return!1}};t()||setTimeout(()=>{t()||setTimeout(()=>{t()||setTimeout(()=>{t()},1e3)},500)},200)}createSurveyBridgeScript(){return"\n (function() {\n // Função notifyHost para compatibilidade com SurveyJS\n window.notifyHost = function(eventName, payload) {\n const message = {\n source: 'akross-survey',\n type: eventName,\n payload,\n ts: Date.now()\n };\n\n // 1) iOS WKWebView\n try {\n if (window.webkit?.messageHandlers?.surveyBridge) {\n window.webkit.messageHandlers.surveyBridge.postMessage(message);\n return;\n }\n } catch (error) {\n console.error('❌ NotifyHost: Erro iOS WKWebView:', error);\n }\n\n // 2) Android WebView (via addJavascriptInterface)\n try {\n if (window.AndroidSurveyBridge?.postMessage) {\n // Em Android é comum aceitar string; envie JSON serializado\n window.AndroidSurveyBridge.postMessage(JSON.stringify(message));\n return;\n }\n } catch (error) {\n console.error('❌ NotifyHost: Erro Android WebView:', error);\n }\n\n // 3) Web (iFrame → janela hospedeira)\n if (window.parent && window.parent !== window) {\n window.parent.postMessage(message, '*');\n }\n };\n })();\n "}getSurveyBridgeScript(){return this.createSurveyBridgeScript()}testCommunication(){if(this.logger.debug("Testing communication with iframe"),this.iframeElement?.contentWindow){const e={source:"akross-survey-test",type:"communication_test",payload:{timestamp:Date.now()}};this.iframeElement.contentWindow.postMessage(e,"*")}}handleSurveyMessage(e){try{switch(this.logger.debug("Survey message received:",e),e.type){case"survey_complete":this.handleSurveyComplete(e.payload);break;case"survey_save":this.handleSurveySave(e.payload);break;case"survey_closed":this.handleSurveyClose();break;case"survey_started":this.handleSurveyStarted(e.payload);break;case"survey_progress":this.handleSurveyProgress(e.payload);break;default:this.logger.warn("Unknown message type:",e.type)}}catch(e){this.logger.error("Error processing survey message:",e)}}processPayload(e,t,r){if(this.logger.debug(`${t} with payload:`,e),e){const i=r(e);this.logger.debug(`${t} data:`,i)}}handleSurveyComplete(e){this.processPayload(e,"🎉 Survey Complete Handler",e=>({answers:e.answers,timeSpent:e.timeSpent,completed:e.completed})),this.isSurveyCompleted=!0}handleSurveySave(e){this.processPayload(e,"💾 Survey Save Handler",e=>({progress:e.progress,answers:e.answers,timestamp:(new Date).toISOString()}))}handleSurveyClose(){this.logger.debug("Survey close requested. Completed:",this.isSurveyCompleted),this.isSurveyClosed=!0,this.executeBackButtonLogic()}handleSurveyStarted(e){this.processPayload(e,"🚀 Survey Started Handler",e=>({surveyId:e.surveyId,timestamp:(new Date).toISOString(),userAgent:navigator.userAgent}))}handleSurveyProgress(e){this.processPayload(e,"📊 Survey Progress Handler",e=>({progress:e.progress,currentPage:e.currentPage,totalPages:e.totalPages,timestamp:(new Date).toISOString()}))}executeBackButtonLogic(){this.isSurveyCompleted?this.finishWithResult(u.REWARDED):this.finishWithResult(u.CANCELED)}finishWithResult(e){if(this.logger.debug("Finishing survey overlay with result:",e),this.cleanup(),this.onResultCallback){const t=new w({media:this.media,result:e});this.onResultCallback(t)}}setElementVisibility(e,t,r="block"){e&&(e.style.display=t?r:"none")}showErrorInterface(e="Erro ao carregar a pesquisa"){if(this.errorElement){const t=this.errorElement.querySelector(".aa-survey-error-message");t&&(t.textContent=e),this.setElementVisibility(this.errorElement,!0,"flex")}this.setElementVisibility(this.iframeElement,!1),this.hideLoading()}hideErrorInterface(){this.setElementVisibility(this.errorElement,!1),this.setElementVisibility(this.iframeElement,!0)}showLoading(){this.setElementVisibility(this.loadingElement,!0)}hideLoading(){this.setElementVisibility(this.loadingElement,!1)}darkenColor(e,t){const r=parseInt(e.replace("#",""),16),i=Math.round(2.55*t),n=(r>>16)-i,a=(r>>8&255)-i,s=(255&r)-i;return"#"+(16777216+65536*(n<255?n<1?0:n:255)+256*(a<255?a<1?0:a:255)+(s<255?s<1?0:s:255)).toString(16).slice(1)}cleanup(){this._messageHandler&&(window.removeEventListener("message",this._messageHandler),this._messageHandler=null),this.overlayElement&&this.overlayElement.parentNode&&this.overlayElement.parentNode.removeChild(this.overlayElement),this.overlayElement=null,this.iframeElement=null,this.loadingElement=null,this.errorElement=null,this.retryButton=null,this.closeButton=null}}ue.OVERLAY_CSS="\n .aa-survey-overlay {\n display: block;\n position: fixed;\n z-index: 1;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .aa-survey-dialog {\n background-color: white;\n border-radius: 8px;\n position: relative;\n width: 100%;\n max-width: 95vw;\n height: 95vh;\n overflow: hidden;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n }\n\n .aa-survey-content {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .aa-survey-iframe {\n width: 100%;\n height: 100%;\n border: none;\n }\n\n .aa-survey-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n z-index: 10;\n }\n\n .aa-survey-error {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: white;\n display: none;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding: 20px;\n }\n\n .closeButton {\n display: flex;\n position: absolute;\n top: 10px;\n right: 10px;\n background-color: rgba(0, 0, 0, 0.8);\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n width: 40px;\n height: 40px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n font-size: 0;\n transition: all 0.2s ease;\n z-index: 10;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);\n }\n\n .closeButton::before,\n .closeButton::after {\n content: '';\n position: absolute;\n width: 20px;\n height: 2px;\n background-color: white;\n border-radius: 1px;\n }\n\n .closeButton::before {\n transform: rotate(45deg);\n }\n\n .closeButton::after {\n transform: rotate(-45deg);\n }\n\n .closeButton:hover {\n background-color: rgba(0, 0, 0, 0.9);\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ";var he,ge,pe,me={},fe={};function ve(){if(he)return fe;function e(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}he=1;var t=e({HTML:"text/html",isHTML:function(e){return e===t.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),i={find:function(e,t,r){if(void 0===r&&(r=Array.prototype),e&&"function"==typeof r.find)return r.find.call(e,t);for(var i=0;i<e.length;i++)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];if(t.call(void 0,n,i,e))return n}},freeze:e,NAMESPACE:r},n=i.find,a=i.NAMESPACE;function s(e){return""!==e}function o(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function l(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(s):[]}(e);return Object.keys(t.reduce(o,{}))}function c(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function d(e,t){var r=e.prototype;if(!(r instanceof t)){function i(){}i.prototype=t.prototype,c(r,i=new i),e.prototype=r=i}r.constructor!=e&&(r.constructor=e)}var u={},h=u.ELEMENT_NODE=1,g=u.ATTRIBUTE_NODE=2,p=u.TEXT_NODE=3,m=u.CDATA_SECTION_NODE=4,f=u.ENTITY_REFERENCE_NODE=5,v=u.ENTITY_NODE=6,E=u.PROCESSING_INSTRUCTION_NODE=7,y=u.COMMENT_NODE=8,w=u.DOCUMENT_NODE=9,b=u.DOCUMENT_TYPE_NODE=10,A=u.DOCUMENT_FRAGMENT_NODE=11,R=u.NOTATION_NODE=12,T={},k={};T.INDEX_SIZE_ERR=(k[1]="Index size error",1),T.DOMSTRING_SIZE_ERR=(k[2]="DOMString size error",2);var I=T.HIERARCHY_REQUEST_ERR=(k[3]="Hierarchy request error",3);T.WRONG_DOCUMENT_ERR=(k[4]="Wrong document",4),T.INVALID_CHARACTER_ERR=(k[5]="Invalid character",5),T.NO_DATA_ALLOWED_ERR=(k[6]="No data allowed",6),T.NO_MODIFICATION_ALLOWED_ERR=(k[7]="No modification allowed",7);var C=T.NOT_FOUND_ERR=(k[8]="Not found",8);T.NOT_SUPPORTED_ERR=(k[9]="Not supported",9);var D=T.INUSE_ATTRIBUTE_ERR=(k[10]="Attribute in use",10);function S(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,k[e]),this.message=k[e],Error.captureStackTrace&&Error.captureStackTrace(this,S);return r.code=e,t&&(this.message=this.message+": "+t),r}function L(){}function N(e,t){this._node=e,this._refresh=t,x(this)}function x(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(we(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var i=r.length;i in e;i++)Object.prototype.hasOwnProperty.call(e,i)&&delete e[i];c(r,e),e._inc=t}}function M(){}function O(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function U(e,t,r,i){if(i?t[O(t,i)]=r:t[t.length++]=r,e){r.ownerElement=e;var n=e.ownerDocument;n&&(i&&H(n,e,i),function(e,t,r){e&&e._inc++,r.namespaceURI===a.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}(n,e,r))}}function P(e,t,r){var i=O(t,r);if(!(i>=0))throw new S(C,new Error(e.tagName+"@"+r));for(var n=t.length-1;i<n;)t[i]=t[++i];if(t.length=n,e){var a=e.ownerDocument;a&&(H(a,e,r),r.ownerElement=null)}}function V(){}function _(){}function q(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function F(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(F(e,t))return!0}while(e=e.nextSibling)}function B(){this.ownerDocument=this}function H(e,t,r,i){e&&e._inc++,r.namespaceURI===a.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function W(e,t,r){if(e&&e._inc){e._inc++;var i=t.childNodes;if(r)i[i.length++]=r;else{for(var n=t.firstChild,a=0;n;)i[a++]=n,n=n.nextSibling;i.length=a,delete i[i.length]}}}function z(e,t){var r=t.previousSibling,i=t.nextSibling;return r?r.nextSibling=i:e.firstChild=i,i?i.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,W(e.ownerDocument,e),t}function K(e){return e&&e.nodeType===_.DOCUMENT_TYPE_NODE}function G(e){return e&&e.nodeType===_.ELEMENT_NODE}function j(e){return e&&e.nodeType===_.TEXT_NODE}function $(e,t){var r=e.childNodes||[];if(n(r,G)||K(t))return!1;var i=n(r,K);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Y(e,t){var r=e.childNodes||[];if(n(r,function(e){return G(e)&&e!==t}))return!1;var i=n(r,K);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Q(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===_.DOCUMENT_FRAGMENT_NODE){var s=a.filter(G);if(s.length>1||n(a,j))throw new S(I,"More than one element or text in fragment");if(1===s.length&&!$(e,r))throw new S(I,"Element in fragment can not be inserted before doctype")}if(G(t)&&!$(e,r))throw new S(I,"Only one element can be added and only after doctype");if(K(t)){if(n(i,K))throw new S(I,"Only one doctype is allowed");var o=n(i,G);if(r&&i.indexOf(o)<i.indexOf(r))throw new S(I,"Doctype can only be inserted before an element");if(!r&&o)throw new S(I,"Doctype can not be appended since element is present")}}function X(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===_.DOCUMENT_FRAGMENT_NODE){var s=a.filter(G);if(s.length>1||n(a,j))throw new S(I,"More than one element or text in fragment");if(1===s.length&&!Y(e,r))throw new S(I,"Element in fragment can not be inserted before doctype")}if(G(t)&&!Y(e,r))throw new S(I,"Only one element can be added and only after doctype");if(K(t)){function l(e){return K(e)&&e!==r}if(n(i,l))throw new S(I,"Only one doctype is allowed");var o=n(i,G);if(r&&i.indexOf(o)<i.indexOf(r))throw new S(I,"Doctype can only be inserted before an element")}}function J(e,t,r,i){(function(e,t,r){if(!function(e){return e&&(e.nodeType===_.DOCUMENT_NODE||e.nodeType===_.DOCUMENT_FRAGMENT_NODE||e.nodeType===_.ELEMENT_NODE)}(e))throw new S(I,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new S(C,"child not in parent");if(!function(e){return e&&(G(e)||j(e)||K(e)||e.nodeType===_.DOCUMENT_FRAGMENT_NODE||e.nodeType===_.COMMENT_NODE||e.nodeType===_.PROCESSING_INSTRUCTION_NODE)}(t)||K(t)&&e.nodeType!==_.DOCUMENT_NODE)throw new S(I,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)})(e,t,r),e.nodeType===_.DOCUMENT_NODE&&(i||Q)(e,t,r);var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===A){var a=t.firstChild;if(null==a)return t;var s=t.lastChild}else a=s=t;var o=r?r.previousSibling:e.lastChild;a.previousSibling=o,s.nextSibling=r,o?o.nextSibling=a:e.firstChild=a,null==r?e.lastChild=s:r.previousSibling=s;do{a.parentNode=e}while(a!==s&&(a=a.nextSibling));return W(e.ownerDocument||e,e),t.nodeType==A&&(t.firstChild=t.lastChild=null),t}function Z(){this._nsMap={}}function ee(){}function te(){}function re(){}function ie(){}function ne(){}function ae(){}function se(){}function oe(){}function le(){}function ce(){}function de(){}function ue(){}function ge(e,t){var r=[],i=9==this.nodeType&&this.documentElement||this,n=i.prefix,a=i.namespaceURI;if(a&&null==n&&null==(n=i.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return ve(this,r,e,t,s),r.join("")}function pe(e,t,r){var i=e.prefix||"",n=e.namespaceURI;if(!n)return!1;if("xml"===i&&n===a.XML||n===a.XMLNS)return!1;for(var s=r.length;s--;){var o=r[s];if(o.prefix===i)return o.namespace!==n}return!0}function me(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,q),'"')}function ve(e,t,r,i,n){if(n||(n=[]),i){if(!(e=i(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case h:var s=e.attributes,o=s.length,l=e.firstChild,c=e.tagName,d=c;if(!(r=a.isHTML(e.namespaceURI)||r)&&!e.prefix&&e.namespaceURI){for(var u,v=0;v<s.length;v++)if("xmlns"===s.item(v).name){u=s.item(v).value;break}if(!u)for(var R=n.length-1;R>=0;R--)if(""===(T=n[R]).prefix&&T.namespace===e.namespaceURI){u=T.namespace;break}if(u!==e.namespaceURI)for(R=n.length-1;R>=0;R--){var T;if((T=n[R]).namespace===e.namespaceURI){T.prefix&&(d=T.prefix+":"+c);break}}}t.push("<",d);for(var k=0;k<o;k++)"xmlns"==(I=s.item(k)).prefix?n.push({prefix:I.localName,namespace:I.value}):"xmlns"==I.nodeName&&n.push({prefix:"",namespace:I.value});for(k=0;k<o;k++){var I,C,D;pe(I=s.item(k),0,n)&&(me(t,(C=I.prefix||"")?"xmlns:"+C:"xmlns",D=I.namespaceURI),n.push({prefix:C,namespace:D})),ve(I,t,r,i,n)}if(c===d&&pe(e,0,n)&&(me(t,(C=e.prefix||"")?"xmlns:"+C:"xmlns",D=e.namespaceURI),n.push({prefix:C,namespace:D})),l||r&&!/^(?:meta|link|img|br|hr|input)$/i.test(c)){if(t.push(">"),r&&/^script$/i.test(c))for(;l;)l.data?t.push(l.data):ve(l,t,r,i,n.slice()),l=l.nextSibling;else for(;l;)ve(l,t,r,i,n.slice()),l=l.nextSibling;t.push("</",d,">")}else t.push("/>");return;case w:case A:for(l=e.firstChild;l;)ve(l,t,r,i,n.slice()),l=l.nextSibling;return;case g:return me(t,e.name,e.value);case p:return t.push(e.data.replace(/[<&>]/g,q));case m:return t.push("<![CDATA[",e.data,"]]>");case y:return t.push("\x3c!--",e.data,"--\x3e");case b:var S=e.publicId,L=e.systemId;if(t.push("<!DOCTYPE ",e.name),S)t.push(" PUBLIC ",S),L&&"."!=L&&t.push(" ",L),t.push(">");else if(L&&"."!=L)t.push(" SYSTEM ",L,">");else{var N=e.internalSubset;N&&t.push(" [",N,"]"),t.push(">")}return;case E:return t.push("<?",e.target," ",e.data,"?>");case f:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Ee(e,t,r){var i;switch(t.nodeType){case h:(i=t.cloneNode(!1)).ownerDocument=e;case A:break;case g:r=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,r)for(var n=t.firstChild;n;)i.appendChild(Ee(e,n,r)),n=n.nextSibling;return i}function ye(e,t,r){var i=new t.constructor;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var a=t[n];"object"!=typeof a&&a!=i[n]&&(i[n]=a)}switch(t.childNodes&&(i.childNodes=new L),i.ownerDocument=e,i.nodeType){case h:var s=t.attributes,o=i.attributes=new M,l=s.length;o._ownerElement=i;for(var c=0;c<l;c++)i.setAttributeNode(ye(e,s.item(c),!0));break;case g:r=!0}if(r)for(var d=t.firstChild;d;)i.appendChild(ye(e,d,r)),d=d.nextSibling;return i}function we(e,t,r){e[t]=r}T.INVALID_STATE_ERR=(k[11]="Invalid state",11),T.SYNTAX_ERR=(k[12]="Syntax error",12),T.INVALID_MODIFICATION_ERR=(k[13]="Invalid modification",13),T.NAMESPACE_ERR=(k[14]="Invalid namespace",14),T.INVALID_ACCESS_ERR=(k[15]="Invalid access",15),S.prototype=Error.prototype,c(T,S),L.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var r=[],i=0;i<this.length;i++)ve(this[i],r,e,t);return r.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},N.prototype.item=function(e){return x(this),this[e]||null},d(N,L),M.prototype={length:0,item:L.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new S(D);var r=this.getNamedItem(e.nodeName);return U(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new S(D);return t=this.getNamedItemNS(e.namespaceURI,e.localName),U(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return P(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return P(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var i=this[r];if(i.localName==t&&i.namespaceURI==e)return i}return null}},V.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var i=new B;if(i.implementation=this,i.childNodes=new L,i.doctype=r||null,r&&i.appendChild(r),t){var n=i.createElementNS(e,t);i.appendChild(n)}return i},createDocumentType:function(e,t,r){var i=new ae;return i.name=e,i.nodeName=e,i.publicId=t||"",i.systemId=r||"",i}},_.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return J(this,e,t)},replaceChild:function(e,t){J(this,e,t,X),t&&this.removeChild(t)},removeChild:function(e){return z(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ye(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==p&&e.nodeType==p?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&r[i]===e)return i;t=t.nodeType==g?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==g?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},c(u,_),c(u,_.prototype),B.prototype={nodeName:"#document",nodeType:w,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==A){for(var r=e.firstChild;r;){var i=r.nextSibling;this.insertBefore(r,t),r=i}return e}return J(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===h&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),z(this,e)},replaceChild:function(e,t){J(this,e,t,X),e.ownerDocument=this,t&&this.removeChild(t),G(e)&&(this.documentElement=e)},importNode:function(e,t){return Ee(this,e,t)},getElementById:function(e){var t=null;return F(this.documentElement,function(r){if(r.nodeType==h&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=l(e);return new N(this,function(r){var i=[];return t.length>0&&F(r.documentElement,function(n){if(n!==r&&n.nodeType===h){var a=n.getAttribute("class");if(a){var s=e===a;if(!s){var o=l(a);s=t.every((c=o,function(e){return c&&-1!==c.indexOf(e)}))}s&&i.push(n)}}var c}),i})},createElement:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new L,(t.attributes=new M)._ownerElement=t,t},createDocumentFragment:function(){var e=new ce;return e.ownerDocument=this,e.childNodes=new L,e},createTextNode:function(e){var t=new re;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new ie;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ne;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new de;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new ee;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new le;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Z,i=t.split(":"),n=r.attributes=new M;return r.childNodes=new L,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,n._ownerElement=r,r},createAttributeNS:function(e,t){var r=new ee,i=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,r}},d(B,_),Z.prototype={nodeType:h,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===A?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,W(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var i=this.ownerDocument.createAttributeNS(e,t);i.value=i.nodeValue=""+r,this.setAttributeNode(i)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new N(this,function(t){var r=[];return F(t,function(i){i===t||i.nodeType!=h||"*"!==e&&i.tagName!=e||r.push(i)}),r})},getElementsByTagNameNS:function(e,t){return new N(this,function(r){var i=[];return F(r,function(n){n===r||n.nodeType!==h||"*"!==e&&n.namespaceURI!==e||"*"!==t&&n.localName!=t||i.push(n)}),i})}},B.prototype.getElementsByTagName=Z.prototype.getElementsByTagName,B.prototype.getElementsByTagNameNS=Z.prototype.getElementsByTagNameNS,d(Z,_),ee.prototype.nodeType=g,d(ee,_),te.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(k[I])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){r=this.data.substring(0,e)+r+this.data.substring(e+t),this.nodeValue=this.data=r,this.length=r.length}},d(te,_),re.prototype={nodeName:"#text",nodeType:p,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},d(re,te),ie.prototype={nodeName:"#comment",nodeType:y},d(ie,te),ne.prototype={nodeName:"#cdata-section",nodeType:m},d(ne,te),ae.prototype.nodeType=b,d(ae,_),se.prototype.nodeType=R,d(se,_),oe.prototype.nodeType=v,d(oe,_),le.prototype.nodeType=f,d(le,_),ce.prototype.nodeName="#document-fragment",ce.prototype.nodeType=A,d(ce,_),de.prototype.nodeType=E,d(de,_),ue.prototype.serializeToString=function(e,t,r){return ge.call(e,t,r)},_.prototype.toString=ge;try{if(Object.defineProperty){function et(e){switch(e.nodeType){case h:case A:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(et(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(N.prototype,"length",{get:function(){return x(this),this.$$length}}),Object.defineProperty(_.prototype,"textContent",{get:function(){return et(this)},set:function(e){switch(this.nodeType){case h:case A:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),we=function(e,t,r){e["$$"+t]=r}}}catch(tt){}var be,Ae,Re=V,Te=ue,ke=(be=function(e,t){var r=i.freeze;t.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES},be(Ae={path:undefined,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&Ae.path)}},Ae.exports),Ae.exports),Ie=i.NAMESPACE,Ce=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,De=new RegExp("[\\-\\.0-9"+Ce.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Se=new RegExp("^"+Ce.source+De.source+"*(?::"+Ce.source+De.source+"*)?$");function Le(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Le)}function Ne(){}function xe(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Me(e,t,r,i,n,a){function s(e,t,i){r.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),r.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,n),i)}for(var o,l=++t,c=0;;){var d=e.charAt(l);switch(d){case"=":if(1===c)o=e.slice(t,l),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(a.warning('attribute value must after "="'),o=e.slice(t,l)),t=l+1,!((l=e.indexOf(d,t))>0))throw new Error("attribute value no end '"+d+"' match");s(o,u=e.slice(t,l),t-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');s(o,u=e.slice(t,l),t),a.warning('attribute "'+o+'" missed start quot('+d+")!!"),t=l+1,c=5}break;case"/":switch(c){case 0:r.setTagName(e.slice(t,l));case 5:case 6:case 7:c=7,r.closed=!0;case 4:case 1:break;case 2:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==c&&r.setTagName(e.slice(t,l)),l;case">":switch(c){case 0:r.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(u=e.slice(t,l)).slice(-1)&&(r.closed=!0,u=u.slice(0,-1));case 2:2===c&&(u=o),4==c?(a.warning('attribute "'+u+'" missed quot(")!'),s(o,u,t)):(Ie.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),s(u,u,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"€":d=" ";default:if(d<=" ")switch(c){case 0:r.setTagName(e.slice(t,l)),c=6;break;case 1:o=e.slice(t,l),c=2;break;case 4:var u=e.slice(t,l);a.warning('attribute "'+u+'" missed quot(")!!'),s(o,u,t);case 5:c=6}else switch(c){case 2:r.tagName,Ie.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=l,c=1;break;case 5:a.warning('attribute space is required"'+o+'"!!');case 6:c=1,t=l;break;case 3:c=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function Oe(e,t,r){for(var i=e.tagName,n=null,a=e.length;a--;){var s=e[a],o=s.qName,l=s.value;if((h=o.indexOf(":"))>0)var c=s.prefix=o.slice(0,h),d=o.slice(h+1),u="xmlns"===c&&d;else d=o,c=null,u="xmlns"===o&&"";s.localName=d,!1!==u&&(null==n&&(n={},Ve(r,r={})),r[u]=n[u]=l,s.uri=Ie.XMLNS,t.startPrefixMapping(u,l))}for(a=e.length;a--;)(c=(s=e[a]).prefix)&&("xml"===c&&(s.uri=Ie.XML),"xmlns"!==c&&(s.uri=r[c||""]));var h;(h=i.indexOf(":"))>0?(c=e.prefix=i.slice(0,h),d=e.localName=i.slice(h+1)):(c=null,d=e.localName=i);var g=e.uri=r[c||""];if(t.startElement(g,d,i,e),!e.closed)return e.currentNSMap=r,e.localNSMap=n,!0;if(t.endElement(g,d,i),n)for(c in n)Object.prototype.hasOwnProperty.call(n,c)&&t.endPrefixMapping(c)}function Ue(e,t,r,i,n){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(r)?(n.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,i),n.characters(s,0,s.length),a)}return t+1}function Pe(e,t,r,i){var n=i[r];return null==n&&((n=e.lastIndexOf("</"+r+">"))<t&&(n=e.lastIndexOf("</"+r)),i[r]=n),n<t}function Ve(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function _e(e,t,r,i){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4))>t?(r.comment(e,t+4,n-t-4),n+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var n=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,n-t-9),r.endCDATA(),n+3}var a=function(e,t){var r,i=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=t,n.exec(e);r=n.exec(e);)if(i.push(r),r[1])return i}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],l=!1,c=!1;s>3&&(/^public$/i.test(a[2][0])?(l=a[3][0],c=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var d=a[s-1];return r.startDTD(o,l,c),r.endDTD(),d.index+d[0].length}return-1}function qe(e,t,r){var i=e.indexOf("?>",t);if(i){var n=e.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(n[0].length,r.processingInstruction(n[1],n[2]),i+2):-1}return-1}function Fe(){this.attributeNames={}}Le.prototype=new Error,Le.prototype.name=Le.name,Ne.prototype={parse:function(e,t,r){var i=this.domBuilder;i.startDocument(),Ve(t,t={}),function(e,t,r,i,n){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(r,t)?r[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(n.error("entity not found:"+e),e)}function s(t){if(t>p){var r=e.substring(p,t).replace(/&#?\w+;/g,a);u&&o(p),i.characters(r,0,t-p),p=t}}function o(t,r){for(;t>=c&&(r=d.exec(e));)l=r.index,c=l+r[0].length,u.lineNumber++;u.columnNumber=t-l+1}for(var l=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,u=i.locator,h=[{currentNSMap:t}],g={},p=0;;){try{var m=e.indexOf("<",p);if(m<0){if(!e.substr(p).match(/^\s*$/)){var f=i.doc,v=f.createTextNode(e.substr(p));f.appendChild(v),i.currentElement=v}return}switch(m>p&&s(m),e.charAt(m+1)){case"/":var E=e.indexOf(">",m+3),y=e.substring(m+2,E).replace(/[ \t\n\r]+$/g,""),w=h.pop();E<0?(y=e.substring(m+2).replace(/[\s<].*/,""),n.error("end tag name: "+y+" is not complete:"+w.tagName),E=m+1+y.length):y.match(/\s</)&&(y=y.replace(/[\s<].*/,""),n.error("end tag name: "+y+" maybe not complete"),E=m+1+y.length);var b=w.localNSMap,A=w.tagName==y;if(A||w.tagName&&w.tagName.toLowerCase()==y.toLowerCase()){if(i.endElement(w.uri,w.localName,y),b)for(var R in b)Object.prototype.hasOwnProperty.call(b,R)&&i.endPrefixMapping(R);A||n.fatalError("end tag name: "+y+" is not match the current start tagName:"+w.tagName)}else h.push(w);E++;break;case"?":u&&o(m),E=qe(e,m,i);break;case"!":u&&o(m),E=_e(e,m,i,n);break;default:u&&o(m);var T=new Fe,k=h[h.length-1].currentNSMap,I=(E=Me(e,m,T,k,a,n),T.length);if(!T.closed&&Pe(e,E,T.tagName,g)&&(T.closed=!0,r.nbsp||n.warning("unclosed xml attribute")),u&&I){for(var C=xe(u,{}),D=0;D<I;D++){var S=T[D];o(S.offset),S.locator=xe(u,{})}i.locator=C,Oe(T,i,k)&&h.push(T),i.locator=u}else Oe(T,i,k)&&h.push(T);Ie.isHTML(T.uri)&&!T.closed?E=Ue(e,E,T.tagName,a,i):E++}}catch(e){if(e instanceof Le)throw e;n.error("element parse error: "+e),E=-1}E>p?p=E:s(Math.max(m,p)+1)}}(e,t,r,i,this.errorHandler),i.endDocument()}},Fe.prototype={setTagName:function(e){if(!Se.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!Se.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var Be=Re,He=i.NAMESPACE,We=Le,ze=Ne;function Ke(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Ge(e){this.options=e||{locator:{}}}function je(){this.cdata=!1}function $e(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Ye(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function Qe(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Ge.prototype.parseFromString=function(e,t){var r=this.options,i=new ze,n=r.domBuilder||new je,a=r.errorHandler,s=r.locator,o=r.xmlns||{},l=/\/x?html?$/.test(t),c=l?ke.HTML_ENTITIES:ke.XML_ENTITIES;s&&n.setDocumentLocator(s),i.errorHandler=function(e,t,r){if(!e){if(t instanceof je)return t;e=t}var i={},n=e instanceof Function;function a(t){var a=e[t];!a&&n&&(a=2==e.length?function(r){e(t,r)}:e),i[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(r))}||function(){}}return r=r||{},a("warning"),a("error"),a("fatalError"),i}(a,n,s),i.domBuilder=r.domBuilder||n,l&&(o[""]=He.HTML),o.xml=o.xml||He.XML;var d=r.normalizeLineEndings||Ke;return e&&"string"==typeof e?i.parse(d(e),o,c):i.errorHandler.error("invalid doc source"),n.doc},je.prototype={startDocument:function(){this.doc=(new Be).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,i){var n=this.doc,a=n.createElementNS(e,r||t),s=i.length;Qe(this,a),this.currentElement=a,this.locator&&$e(this.locator,a);for(var o=0;o<s;o++){e=i.getURI(o);var l=i.getValue(o),c=(r=i.getQName(o),n.createAttributeNS(e,r));this.locator&&$e(i.getLocator(o),c),c.value=c.nodeValue=l,a.setAttributeNode(c)}},endElement:function(e,t,r){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&$e(this.locator,r),Qe(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=Ye.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&$e(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=Ye.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&$e(this.locator,i),Qe(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var i=this.doc.implementation;if(i&&i.createDocumentType){var n=i.createDocumentType(e,t,r);this.locator&&$e(this.locator,n),Qe(this,n),this.doc.doctype=n}},warning:function(e){},error:function(e){},fatalError:function(e){throw new We(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){je.prototype[e]=function(){return null}});var Xe={DOMParser:Ge}.DOMParser,Je={DOMImplementation:Re,XMLSerializer:Te,DOMParser:Xe},Ze=function(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}({__proto__:null,default:Je,DOMImplementation:Re,XMLSerializer:Te,DOMParser:Xe},[Je]);return fe.index=Ze,fe}function Ee(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}Object.defineProperty(me,"__esModule",{value:!0});const ye=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function we(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=[],n=Re(e);!t.ERRORCODE||r.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=De(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING;for(const e in t)t[e]=Ce(t[e]);for(const e in n){const r=n[e];"string"==typeof r&&i.push(be(r,t))}return i}function be(e,t){const r=(e=Ae(e,t)).match(/[^[\]]+(?=])/g);if(!r)return e;let i=r.filter(e=>ye.indexOf(e)>-1);return 0===i.length?e:(i=i.reduce((e,t)=>(e[t]=-1,e),{}),Ae(e,i))}function Ae(e,t){let r=e;for(const e in t){const i=t[e];r=r.replace(new RegExp("(?:\\[|%%)(".concat(e,")(?:\\]|%%)"),"g"),i)}return r}function Re(e){return Array.isArray(e)?e.map(e=>e&&e.hasOwnProperty("url")?e.url:e):e}function Te(e){return/^(https?:\/\/|\/\/)/.test(e)}function ke(e,t){for(let r=0;r<t.length;r++)if(Ie(t[r],e))return!0;return!1}function Ie(e,t){if(e&&t){const r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);return r.length===i.length&&e.id===t.id&&e.url===t.url}return!1}function Ce(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function De(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}const Se={track:function(e,t,r){we(e,t,r).forEach(e=>{"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:we,extractURLsFromTemplates:Re,filterUrlTemplates:function(e){return e.reduce((e,t)=>{const r=t.url||t;return Te(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:ke,isTemplateObjectEqual:Ie,encodeURIComponentRFC3986:Ce,replaceUrlMacros:be,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce((t,r)=>t.concat(Array.isArray(r)?e(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];return r.concat(i).reduce((e,t)=>(ke(t,e)||e.push(t),e),[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:De,isValidUrl:Te,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=typeof e?e:JSON.stringify(e)}};function Le(e){return["true","TRUE","True","1"].includes(e)}function Ne(e){if(null==e)return-1;if(Se.isNumeric(e))return parseInt(e);const t=e.split(":");if(3!==t.length)return-1;const r=t[2].split(".");let i=parseInt(r[0]);2===r.length&&(i+=parseFloat("0.".concat(r[1])));const n=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(n)||isNaN(i)||n>3600||i>60?-1:a+n+i}const xe={childByName:function(e,t){return Array.from(e.childNodes).find(e=>e.nodeName===t)},childrenByName:function(e,t){return Array.from(e.childNodes).filter(e=>e.nodeName===t)},resolveVastAdTagURI:function(e,t){if(!t)return e;if(e.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(e)}if(!e.includes("://")){const r=t.slice(0,t.lastIndexOf("/"));return"".concat(r,"/").concat(e)}return e},parseBoolean:Le,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,r){const i=t.getAttribute(e);i&&r.setAttribute(e,i)},parseAttributes:function(e){return Array.from(e.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:Ne,getStandAloneAds:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>!parseInt(e.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>parseInt(e.sequence,10)).sort((e,t)=>e.sequence-t.sequence)},assignAttributes:function(e,t){e&&Array.from(e).forEach(e=>{let{nodeName:r,nodeValue:i}=e;if(r&&i&&t.hasOwnProperty(r)){let e=i;"boolean"==typeof t[r]&&(e=Le(e)),t[r]=e}})},mergeWrapperAdData:function(e,t){var r;e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[...e.viewableImpression,...t.viewableImpression]),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;const i=(t.creatives||[]).filter(e=>e&&"companion"===e.type),n=i.reduce((e,t)=>((t.variations||[]).forEach(t=>{(t.companionClickTrackingURLTemplates||[]).forEach(t=>{Se.containsTemplateObject(t,e)||e.push(t)})}),e),[]);e.creatives=i.concat(e.creatives);const a=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,s=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;if(e.creatives.forEach(e=>{if(t.trackingEvents&&t.trackingEvents[e.type])for(const r in t.trackingEvents[e.type]){const i=t.trackingEvents[e.type][r];Array.isArray(e.trackingEvents[r])||(e.trackingEvents[r]=[]),e.trackingEvents[r]=e.trackingEvents[r].concat(i)}"linear"===e.type&&(a&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),s&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&n.length&&(e.variations||[]).forEach(e=>{e.companionClickTrackingURLTemplates=Se.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,n)})}),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories)),null!==(r=t.creatives)&&void 0!==r&&r.length){const r=t.creatives.filter(e=>{var t;return(null===(t=e.icons)||void 0===t?void 0:t.length)&&!e.mediaFiles.length});r.length&&(e.creatives=e.creatives.concat(r))}}};function Me(e,t){const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=Ee(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"companion",required:null,variations:[]}}(t);return r.required=e.getAttribute("required")||null,r.variations=xe.childrenByName(e,"Companion").map(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adType:"companionAd",width:e.width||0,height:e.height||0,assetWidth:e.assetWidth||null,assetHeight:e.assetHeight||null,expandedWidth:e.expandedWidth||null,expandedHeight:e.expandedHeight||null,apiFramework:e.apiFramework||null,adSlotId:e.adSlotId||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(xe.parseAttributes(e));t.htmlResources=xe.childrenByName(e,"HTMLResource").reduce((e,t)=>{const r=xe.parseNodeText(t);return r?e.concat(r):e},[]),t.iframeResources=xe.childrenByName(e,"IFrameResource").reduce((e,t)=>{const r=xe.parseNodeText(t);return r?e.concat(r):e},[]),t.staticResources=xe.childrenByName(e,"StaticResource").reduce((e,t)=>{const r=xe.parseNodeText(t);return r?e.concat({url:r,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=xe.parseNodeText(xe.childByName(e,"AltText"))||null;const r=xe.childByName(e,"TrackingEvents");r&&xe.childrenByName(r,"Tracking").forEach(e=>{const r=e.getAttribute("event"),i=xe.parseNodeText(e);r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))}),t.companionClickTrackingURLTemplates=xe.childrenByName(e,"CompanionClickTracking").map(e=>({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})),t.companionClickThroughURLTemplate=xe.parseNodeText(xe.childByName(e,"CompanionClickThrough"))||null;const i=xe.childByName(e,"AdParameters");return i&&(t.adParameters={value:xe.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),r}function Oe(e,t){let r;const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=Ee(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);i.duration=xe.parseDuration(xe.parseNodeText(xe.childByName(e,"Duration")));const n=e.getAttribute("skipoffset");if(null==n)i.skipDelay=null;else if("%"===n.charAt(n.length-1)&&-1!==i.duration){const e=parseInt(n,10);i.skipDelay=i.duration*(e/100)}else i.skipDelay=xe.parseDuration(n);const a=xe.childByName(e,"VideoClicks");if(a){const e=xe.childByName(a,"ClickThrough");i.videoClickThroughURLTemplate=e?{id:e.getAttribute("id")||null,url:xe.parseNodeText(e)}:null,xe.childrenByName(a,"ClickTracking").forEach(e=>{i.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})}),xe.childrenByName(a,"CustomClick").forEach(e=>{i.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})})}const s=xe.childByName(e,"AdParameters");s&&(i.adParameters={value:xe.parseNodeText(s),xmlEncoded:s.getAttribute("xmlEncoded")||null}),xe.childrenByName(e,"TrackingEvents").forEach(e=>{xe.childrenByName(e,"Tracking").forEach(e=>{let t=e.getAttribute("event");const n=xe.parseNodeText(e);if(t&&n){if("progress"===t){if(r=e.getAttribute("offset"),!r)return;t="%"===r.charAt(r.length-1)?"progress-".concat(r):"progress-".concat(xe.parseDuration(r))}Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(n)}})}),xe.childrenByName(e,"MediaFiles").forEach(e=>{xe.childrenByName(e,"MediaFile").forEach(e=>{i.mediaFiles.push(function(e){const t={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};t.id=e.getAttribute("id"),t.fileURL=xe.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);const r=e.getAttribute("scalable");r&&"string"==typeof r&&(t.scalable=xe.parseBoolean(r));const i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=xe.parseBoolean(i)),t}(e))});const t=xe.childByName(e,"InteractiveCreativeFile");t&&(i.interactiveCreativeFile=function(e){const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:xe.parseBoolean(e.variableDuration),fileURL:null}}(xe.parseAttributes(e));return t.fileURL=xe.parseNodeText(e),t}(t));const r=xe.childByName(e,"ClosedCaptionFiles");r&&xe.childrenByName(r,"ClosedCaptionFile").forEach(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(xe.parseAttributes(e));t.fileURL=xe.parseNodeText(e),i.closedCaptionFiles.push(t)});const n=xe.childByName(e,"Mezzanine"),a=function(e){const t={};let r=!1;return["delivery","type","width","height"].forEach(i=>{e&&e.getAttribute(i)?t[i]=e.getAttribute(i):r=!0}),r?null:t}(n);if(a){const e={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};e.id=n.getAttribute("id"),e.fileURL=xe.parseNodeText(n),e.delivery=a.delivery,e.codec=n.getAttribute("codec"),e.type=a.type,e.width=parseInt(a.width,10),e.height=parseInt(a.height,10),e.fileSize=parseInt(n.getAttribute("fileSize"),10),e.mediaType=n.getAttribute("mediaType")||"2D",i.mezzanine=e}});const o=xe.childByName(e,"Icons");return o&&xe.childrenByName(o,"Icon").forEach(e=>{i.icons.push(function(e){const t={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[],altText:null,hoverText:null};t.program=e.getAttribute("program"),t.height=parseInt(e.getAttribute("height")||0),t.width=parseInt(e.getAttribute("width")||0),t.xPosition=function(e){return-1!==["left","right"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("xPosition")),t.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),t.apiFramework=e.getAttribute("apiFramework"),t.pxratio=e.getAttribute("pxratio")||"1",t.offset=xe.parseDuration(e.getAttribute("offset")),t.duration=xe.parseDuration(e.getAttribute("duration")),t.altText=e.getAttribute("altText"),t.hoverText=e.getAttribute("hoverText"),xe.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=xe.parseNodeText(e)}),xe.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=xe.parseNodeText(e)}),xe.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=xe.parseNodeText(e)});const r=xe.childByName(e,"IconClicks");if(r){t.iconClickThroughURLTemplate=xe.parseNodeText(xe.childByName(r,"IconClickThrough")),xe.childrenByName(r,"IconClickTracking").forEach(e=>{t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})});const e=xe.childByName(r,"IconClickFallbackImages");e&&xe.childrenByName(e,"IconClickFallbackImage").forEach(e=>{t.iconClickFallbackImages.push({url:xe.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return t.iconViewTrackingURLTemplate=xe.parseNodeText(xe.childByName(e,"IconViewTracking")),t}(e))}),i}function Ue(e,t){const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=Ee(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return xe.childrenByName(e,"TrackingEvents").forEach(e=>{let t,i;xe.childrenByName(e,"Tracking").forEach(e=>{t=e.getAttribute("event"),i=xe.parseNodeText(e),t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))})}),xe.childrenByName(e,"NonLinear").forEach(e=>{const t={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.expandedWidth=e.getAttribute("expandedWidth"),t.expandedHeight=e.getAttribute("expandedHeight"),t.scalable=xe.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=xe.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=xe.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),xe.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=xe.parseNodeText(e)}),xe.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=xe.parseNodeText(e)}),xe.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=xe.parseNodeText(e)});const i=xe.childByName(e,"AdParameters");i&&(t.adParameters={value:xe.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=xe.parseNodeText(xe.childByName(e,"NonLinearClickThrough")),xe.childrenByName(e,"NonLinearClickTracking").forEach(e=>{t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)})}),r.variations.push(t)}),r}function Pe(e){const t=[];return e.forEach(e=>{const r=Ve(e);r&&t.push(r)}),t}function Ve(e){if("#comment"===e.nodeName)return null;const t={name:null,value:null,attributes:{},children:[]},r=e.attributes,i=e.childNodes;if(t.name=e.nodeName,e.attributes)for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];i.nodeName&&i.nodeValue&&(t.attributes[i.nodeName]=i.nodeValue)}for(const e in i)if(i.hasOwnProperty(e)){const r=Ve(i[e]);r&&t.children.push(r)}if(0===t.children.length||1===t.children.length&&["#cdata-section","#text"].indexOf(t.children[0].name)>=0){const r=xe.parseNodeText(e);""!==r&&(t.value=r),t.children=[]}return null===(n=t).value&&0===Object.keys(n.attributes).length&&0===n.children.length?null:t;var n}function _e(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}const qe={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Fe(e,t){if(!qe[e.nodeName]||!qe[e.nodeName].attributes)return;const r=qe[e.nodeName].attributes.filter(t=>!e.getAttribute(t));r.length>0&&We({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:r},t)}function Be(e,t,r){const i=qe[e.nodeName],n=!r&&"Wrapper"!==e.nodeName;if(i&&!n){if(i.subElements){const r=i.subElements.filter(t=>!xe.childByName(e,t));r.length>0&&We({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:r},t)}r&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(t=>xe.childByName(e,t))||We({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}function He(e){return e.children&&0!==e.children.length}function We(e,t){let{name:r,parentName:i,attributes:n,subElements:a,oneOfResources:s}=e,o="Element '".concat(r,"'");o+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):s?" must provide one of the following '".concat(s.join(", "),"' "):" is empty",t("VAST-warning",{message:o,parentElement:i,specVersion:4.1})}const ze=function e(t,r,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),Fe(t,r),He(t)){Be(t,r,i);for(let n=0;n<t.children.length;n++)e(t.children[n],r,i)}else 0===xe.parseNodeText(t).length&&We({name:t.nodeName,parentName:t.parentNode.nodeName},r)};function Ke(e,t){let{allowMultipleAds:r,followAdditionalWrappers:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=Array.from(e.childNodes).filter(e=>{const t=e.nodeName.toLowerCase();return"inline"===t||!1!==i&&"wrapper"===t});for(const i of n){if(xe.copyNodeAttribute("id",e,i),xe.copyNodeAttribute("sequence",e,i),xe.copyNodeAttribute("adType",e,i),"Wrapper"===i.nodeName)return{ad:$e(i,t),type:"WRAPPER"};if("InLine"===i.nodeName)return{ad:Ge(i,t,{allowMultipleAds:r}),type:"INLINE"};const n=i.nodeName.toLowerCase();t("VAST-warning",{message:"<".concat(i.nodeName,"inline"===n?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:i})}}function Ge(e,t){let{allowMultipleAds:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!1===r&&e.getAttribute("sequence")?null:je(e,t)}function je(e,t){let r=[];t&&ze(e,t);const i=Array.from(e.childNodes),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,sequence:e.sequence||null,adType:e.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(xe.parseAttributes(e));return i.forEach(e=>{switch(e.nodeName){case"Error":n.errorURLTemplates.push(xe.parseNodeText(e));break;case"Impression":n.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:xe.parseNodeText(e)});break;case"Creatives":n.creatives=function(e){const t=[];return e.forEach(e=>{const r={id:e.getAttribute("id")||null,adId:_e(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];let n;xe.childrenByName(e,"UniversalAdId").forEach(e=>{const t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:xe.parseNodeText(e)};i.push(t)});const a=xe.childByName(e,"CreativeExtensions");a&&(n=Pe(xe.childrenByName(a,"CreativeExtension")));for(const a in e.childNodes){const s=e.childNodes[a];let o;switch(s.nodeName){case"Linear":o=Oe(s,r);break;case"NonLinearAds":o=Ue(s,r);break;case"CompanionAds":o=Me(s,r)}o&&(i&&(o.universalAdIds=i),n&&(o.creativeExtensions=n),t.push(o))}}),t}(xe.childrenByName(e,"Creative"));break;case"Extensions":{const t=xe.childrenByName(e,"Extension");n.extensions=Pe(t),n.adVerifications.length||(r=function(e){let t=null,r=[];return e.some(e=>t=xe.childByName(e,"AdVerifications")),t&&(r=Ye(xe.childrenByName(t,"Verification"))),r}(t));break}case"AdVerifications":n.adVerifications=Ye(xe.childrenByName(e,"Verification"));break;case"AdSystem":n.system={value:xe.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":n.title=xe.parseNodeText(e);break;case"AdServingId":n.adServingId=xe.parseNodeText(e);break;case"Category":n.categories.push({authority:e.getAttribute("authority")||null,value:xe.parseNodeText(e)});break;case"Expires":n.expires=parseInt(xe.parseNodeText(e),10);break;case"ViewableImpression":n.viewableImpression.push(function(e){const t=(e,t)=>{const r=xe.parseNodeText(t);return r&&e.push(r),e};return{id:e.getAttribute("id")||null,viewable:xe.childrenByName(e,"Viewable").reduce(t,[]),notViewable:xe.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:xe.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":n.description=xe.parseNodeText(e);break;case"Advertiser":n.advertiser={id:e.getAttribute("id")||null,value:xe.parseNodeText(e)};break;case"Pricing":n.pricing={value:xe.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":n.survey={value:xe.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:xe.parseNodeText(e)})}}),r.length&&(n.adVerifications=n.adVerifications.concat(r)),n}function $e(e,t){const r=je(e,t),i=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");r.followAdditionalWrappers=!i||xe.parseBoolean(i),r.allowMultipleAds=!!n&&xe.parseBoolean(n),r.fallbackOnNoAd=a?xe.parseBoolean(a):null;let s=xe.childByName(e,"VASTAdTagURI");if(s?r.nextWrapperURL=xe.parseNodeText(s):(s=xe.childByName(e,"VASTAdTagURL"),s&&(r.nextWrapperURL=xe.parseNodeText(xe.childByName(s,"URL")))),r.creatives.forEach(e=>{if(["linear","nonlinear"].includes(e.type)){if(e.trackingEvents){r.trackingEvents||(r.trackingEvents={}),r.trackingEvents[e.type]||(r.trackingEvents[e.type]={});for(const t in e.trackingEvents){const i=e.trackingEvents[t];Array.isArray(r.trackingEvents[e.type][t])||(r.trackingEvents[e.type][t]=[]),i.forEach(i=>{r.trackingEvents[e.type][t].push(i)})}}e.videoClickTrackingURLTemplates&&(Array.isArray(r.videoClickTrackingURLTemplates)||(r.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach(e=>{r.videoClickTrackingURLTemplates.push(e)})),e.videoClickThroughURLTemplate&&(r.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(r.videoCustomClickURLTemplates)||(r.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach(e=>{r.videoCustomClickURLTemplates.push(e)}))}}),r.nextWrapperURL)return r}function Ye(e){const t=[];return e.forEach(e=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},i=Array.from(e.childNodes);xe.assignAttributes(e.attributes,r),i.forEach(e=>{let{nodeName:t,textContent:i,attributes:n}=e;switch(t){case"JavaScriptResource":case"ExecutableResource":r.resource=i.trim(),xe.assignAttributes(n,r);break;case"VerificationParameters":r.parameters=i.trim()}});const n=xe.childByName(e,"TrackingEvents");n&&xe.childrenByName(n,"Tracking").forEach(e=>{const t=e.getAttribute("event"),i=xe.parseNodeText(e);t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))}),t.push(r)}),t}class Qe{constructor(){this._handlers=[]}on(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(e,t,r){const i={fired:!1,wrapFn:void 0};function n(){i.fired||(e.off(t,i.wrapFn),i.fired=!0,r.bind(e)(...arguments))}return i.wrapFn=n,n}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];let n=!1;return this._handlers.forEach(t=>{"*"===t.event&&(n=!0,t.handler(e,...r)),t.event===e&&(n=!0,t.handler(...r))}),n}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let Xe=0,Je=0;const Ze=(e,t)=>{!e||!t||e<=0||t<=0||(Je=(Je*Xe+8*e/t)/++Xe)},et={ERRORCODE:900,extensions:[]},tt="VAST response version not supported";class rt extends Qe{constructor(){let{fetcher:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null,this.keepFailedAdPod=!1}trackVastError(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},et,t,...i)),Se.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return Je}initParsingStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),Ze(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(e=>this.buildVASTResponse(e))}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(e=>this.buildVASTResponse(e))}buildVASTResponse(e){const t=function(e){let{ads:t,errorURLTemplates:r,version:i}=e;return{ads:t||[],errorURLTemplates:r||[],version:i||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:i=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:s}=t;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var o;this.emit("VAST-ad-parsed",{type:"ERROR",url:i,wrapperDepth:n});const t="VideoAdServingTemplate"===(null==e||null===(o=e.documentElement)||void 0===o?void 0:o.nodeName);throw new Error(t?tt:"Invalid VAST XMLDocument")}const l=[],c=e.documentElement.childNodes,d=e.documentElement.getAttribute("version");r&&d&&(this.vastVersion=d);for(const e in c){const t=c[e];if("Error"===t.nodeName){const e=xe.parseNodeText(t);r?this.rootErrorURLTemplates.push(e):this.errorURLTemplates.push(e)}else if("Ad"===t.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(!1===a&&l.length>1)break;const e=Ke(t,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:s});e.ad?(l.push(e.ad),this.emit("VAST-ad-parsed",{type:e.type,url:i,wrapperDepth:n,adIndex:l.length-1,vastVersion:d})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return l}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:i=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:s=!1,followAdditionalWrappers:o,allowMultipleAds:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&s&&(l=!0);try{c=this.parseVastXml(e,{isRootVAST:s,url:t,wrapperDepth:a,allowMultipleAds:l,followAdditionalWrappers:o})}catch(e){return Promise.reject(e)}if(1===c.length&&null!=i&&(c[0].sequence=i),!1===r){const e=xe.getSortedAdPods(c),t=xe.getStandAloneAds(c);e.length?c=e:t.length&&(c=[t.shift()]),this.remainingAds=t}return this.resolveAds(c,{wrapperDepth:a,previousUrl:n,url:t})}resolveAds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:i}=arguments.length>1?arguments[1]:void 0;const n=[];return r=i,e.forEach(e=>{const i=this.resolveWrappers(e,t,r);n.push(i)}),Promise.all(n).then(e=>Se.flatten(e))}resolveWrappers(e,t,r){const i={...e};return new Promise(e=>{var n;if(t++,!i.nextWrapperURL)return delete i.nextWrapperURL,e(i);if(!this.fetcher)return i.VASTAdTagURI=i.nextWrapperURL,delete i.nextWrapperURL,e(i);if(t>=this.maxWrapperDepth)return i.errorCode=302,delete i.nextWrapperURL,e(i);i.nextWrapperURL=xe.resolveVastAdTagURI(i.nextWrapperURL,r);const a=null!==(n=this.parsingOptions.allowMultipleAds)&&void 0!==n?n:i.allowMultipleAds,s=i.sequence;this.fetcher.fetchVAST({url:i.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(n=>this.parse(n,{url:i.nextWrapperURL,previousUrl:r,wrapperSequence:s,wrapperDepth:t,followAdditionalWrappers:i.followAdditionalWrappers,allowMultipleAds:a}).then(t=>{if(delete i.nextWrapperURL,0===t.length)return i.creatives=[],e(i);t.forEach(e=>{e&&xe.mergeWrapperAdData(e,i)}),e(t)})).catch(t=>{i.errorCode=t.message===tt?102:301,i.errorMessage=t.message,e(i)})})}completeWrapperResolving(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const r=e.ads[t],i=!r.creatives.some(e=>{var t,r;return(null===(t=e.mediaFiles)||void 0===t?void 0:t.length)>0||(null===(r=e.variations)||void 0===r?void 0:r.length)>0});!r.errorCode&&!i||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),this.keepFailedAdPod&&r.sequence?r.hasFailed=!0:e.ads.splice(t,1))}}}let it=null;const nt={data:{},length:0,getItem(e){return this.data[e]},setItem(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem(e){delete this.data[e],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class at{constructor(){this.storage=this.initStorage()}initStorage(){if(it)return it;try{it="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){it=null}return it&&!this.isStorageDisabled(it)||(it=nt,it.clear()),it}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(e){return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const st=12e4,ot={get:async function(e,t){try{const r=new AbortController,i=setTimeout(()=>{throw r.abort(),new Error("URLHandler: Request timed out after ".concat(t.timeout||st," ms (408)"))},t.timeout||st),n=await fetch(e,{...t,signal:r.signal,credentials:t.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(i)}),a=function(e){return Se.isBrowserEnvironment()&&"https:"===window.location.protocol&&e.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":200===e.status&&e.ok?null:"URLHandler: ".concat(e.statusText," (").concat(e.status,")")}(n);return a?{error:new Error(a),statusCode:n.status}:async function(e){const t=await e.text();let r;return r=Se.isBrowserEnvironment()?new DOMParser:new((await Promise.resolve().then(function(){return ve()}).then(function(e){return e.index})).DOMParser),{xml:r.parseFromString(t,"text/xml"),details:{byteLength:t.length,statusCode:e.status,rawXml:t}}}(n)}catch(e){return{error:e,statusCode:"AbortError"===e.name?408:null}}}};class lt{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||ot,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||st,withCredentials:Boolean(e.withCredentials)}}addURLTemplateFilter(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:r,maxWrapperDepth:i,emitter:n,wrapperDepth:a=0,previousUrl:s=null,wrapperAd:o=null}=e;const l=Date.now();this.URLTemplateFilters.forEach(e=>{r=e(r)}),n("VAST-resolving",{url:r,previousUrl:s,wrapperDepth:a,maxWrapperDepth:i,timeout:this.fetchingOptions.timeout,wrapperAd:o});const c=await this.urlHandler.get(r,this.fetchingOptions),d=Math.round(Date.now()-l);if(n("VAST-resolved",{url:r,previousUrl:s,wrapperDepth:a,error:(null==c?void 0:c.error)||null,duration:d,statusCode:(null==c?void 0:c.statusCode)||null,...null==c?void 0:c.details}),Ze(null==c||null===(t=c.details)||void 0===t?void 0:t.byteLength,d),c.error)throw new Error(c.error);return c.xml}}function ct(e){if(!e?.fileURL)return!1;if("vpaid"===(e.apiFramework||"").toLowerCase())return!1;const t=(e.mimeType||"").toLowerCase();return t.startsWith("video/")||""===t}pe=me.VASTClient=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new at;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new lt,this.vastParser=new rt({fetcher:this.fetcher}),this.storage=r,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((i,n)=>{if(this.cappingFreeLunch>=this.totalCalls)return n(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return n(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(r=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(r,t).then(e=>{const t=this.vastParser.buildVASTResponse(e);i(t)}))).catch(e=>n(e))})}},me.VASTParser=rt,ge=me.VASTTracker=class extends Qe{constructor(e,t,r){var i;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=a,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const e in this.creative.trackingEvents){const t=this.creative.trackingEvents[e];this.trackingEvents[e]=t.slice(0)}this.viewableImpressionTrackers=(null===(i=this.ad.viewableImpression)||void 0===i?void 0:i.reduce((e,t)=>(e.notViewable.push(...t.notViewable),e.viewUndetermined.push(...t.viewUndetermined),e.viewable.push(...t.viewable),e),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach(e=>{let[t,r]=e;r.length&&(this.trackingEvents[t]=r)}),function(e){return"linear"===e.type}(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}"nonLinearAd"===this.variation.adType?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return"companionAd"===e.adType}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){Se.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!Se.isValidTimeValue(e)||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))});const i=this.skipDelay||-1;if(-1===i||this.skippable||(i>e?this.emit("skip-countdown",i-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const i=Math.round(e/this.assetDuration*100),n=[];if(e>0){n.push("start");for(let e=this.lastPercentage;e<i;e++)n.push("progress-".concat(e+1,"%"));n.push("progress-".concat(e));for(const t in this.quartiles)this.isQuartileReached(t,this.quartiles[t],e)&&(n.push(t),this._alreadyTriggeredQuartiles[t]=!0);this.lastPercentage=i}n.forEach(e=>{this.track(e,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let i=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(i=!0),i}setMuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}setSkipDelay(e){Se.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e&&"boolean"==typeof t?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(Se.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"string"==typeof e&&"boolean"==typeof t?this.error({ERRORCODE:e},t):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const r=this.ad.adVerifications.find(t=>t.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const i=r.trackingEvents;if(i&&i.verificationNotExecuted){const e=i.verificationNotExecuted;this.trackURLs(e,t),this.emit("verificationNotExecuted",{trackingURLTemplates:e})}}overlayViewDuration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&"object"==typeof t?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))})}close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!==e&&"string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(Se.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,i={...t};if(r){this.progress&&(i.ADPLAYHEAD=this.progressFormatted());const e=Se.resolveURLTemplates([r],i)[0];this.emit("clickthrough",e)}}trackProgressEvents(e,t,r){const i=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(e=>{let[t]=e;return t.startsWith("progress-")}).map(e=>{let[t,r]=e;return{name:t,time:parseFloat(t.split("-")[1]),urls:r}}).filter(e=>{let{time:t}=e;return t<=i&&t>this.progress}).forEach(e=>{let{name:i,urls:n}=e;!r&&this.trackedProgressEvents.includes(i)||(this.emit(i,{trackingURLTemplates:n}),this.trackURLs(n,t),r?delete this.trackingEvents[i]:this.trackedProgressEvents.push(i))})}track(e){let{macros:t={},once:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof t)return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,r);const i=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;i?(this.emit(e,{trackingURLTemplates:i}),this.trackURLs(i,t)):n&&this.emit(e,null),r&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{validUrls:n,invalidUrls:a}=Se.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const s={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(s.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(s.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(s.UNIVERSALADID=this.creative.universalAdIds.map(e=>e.idRegistry.concat(" ",e.value)).join(",")),this.ad&&(this.ad.sequence&&(s.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(s.ADTYPE=this.ad.adType),this.ad.adServingId&&(s.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(s.ADCATEGORIES=this.ad.categories.map(e=>e.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(s.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(e=>e.value).join(","))),Se.track(n,s,i)}convertToTimecode(e){if(!Se.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),i=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Se.addLeadingZeros(r,2),":").concat(Se.addLeadingZeros(i,2),":").concat(Se.addLeadingZeros(n,2),".").concat(Se.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}},me.parseDuration=Ne;class dt{constructor(e={}){this.resolvePlayerExecution=null,this.videoElement=null,this.adContainer=null,this.adDisplayContainer=null,this.adsLoader=null,this.adManager=null,this.usingVastFallback=!1,this.vastTracker=null,this.vastFallbackUnlisten=null,this.fallbackProgressEmitted=new Set,this.config=e,this.logger=new b(qt.getDebugMode());const t=qt.getUserData(),r=qt.getDebugMode();this.mediaResultHelper=new $({userId:t?.userId||"",debug:r}),this.ui=new te(this.logger)}async start(e){this.logger.debug("Starting VAST player for media:",e.title),re.show();try{this.currentMedia=e;return await this.checkConnectivity()?(this.logger.debug("Connectivity OK, using IMA SDK for VAST"),await this.executeWithIMA()):this.isVpaidMedia()?(this.logger.debug("No connectivity and media is VPAID; fallback does not support VPAID, returning connection error"),this.finishWithResult(u.CONNECTION_ERROR)):(this.logger.debug("No connectivity, using VAST fallback (vast-client)"),await this.executeWithVastFallback())}catch(e){this.logger.error("Error starting VAST player:",e);const t=e instanceof Error?e.message:"Unknown error";return this.finishWithResult(u.ERROR,t)}}async checkConnectivity(){try{const e=qt.getDebugMode(),t=(new T).getArtemisAdsService(5,e);return await t.checkConnectivity(),!0}catch{return!1}}isVpaidMedia(){const e=this.currentMedia?.content?.video?.type;return"string"==typeof e&&"VPAID"===e.toUpperCase()}async executeWithIMA(){try{if(this.logger.debug("Executing VAST with IMA SDK:",this.currentMedia.title),!window.google||!window.google.ima||!window.google.ima.AdsLoader){this.logger.debug("IMA SDK not available, loading...");try{const e=qt.getConfig()?.proxyExternalScripts||!1;await J(e),this.logger.debug("IMA SDK loaded successfully")}catch(e){return this.logger.error("Failed to load IMA SDK (e.g. no connectivity):",e),this.isVpaidMedia()?(this.logger.debug("Media is VPAID; fallback does not support VPAID, returning connection error"),this.finishWithResult(u.CONNECTION_ERROR)):await this.executeWithVastFallback()}}const e=this.config.imaConfig||{locale:"pt-BR",vastLoadTimeout:1e4,vpaidMode:window.google.ima.ImaSdkSettings.VpaidMode.ENABLED,continuousPlayback:!0};window.google.ima.settings.setVpaidMode(e.vpaidMode),window.google.ima.settings.setLocale(e.locale),this.logger.debug("IMA SDK configured successfully"),this.createModal(),await this.setupIMA();const t=this.prepareAdTagUrl();return await this.requestAds(t),this.logger.debug("VAST ad executed successfully with IMA SDK"),await this.waitForAdResult()}catch(e){return this.logger.error("Error executing with IMA SDK:",e),this.finishWithResult(u.ERROR)}}async executeWithVastFallback(){this.usingVastFallback=!0;try{this.logger.debug("Executing VAST with fallback (vast-client):",this.currentMedia.title),this.createModal(),this.ui.showVideo();const r=this.prepareAdTagUrl(),i=function(e){if(!e?.ads?.length)return null;for(const t of e.ads){if(!t.creatives?.length)continue;const e=t.creatives.find(e=>"linear"===e.type&&e.mediaFiles?.length);if(!e?.mediaFiles?.length)continue;const r=e.mediaFiles.find(e=>ct(e));if(r?.fileURL)return{ad:t,creative:e,mediaUrl:r.fileURL,clickThroughUrl:e.videoClickThroughURLTemplate||null}}return null}(await async function(e){const t=new pe;return await t.get(e)}(r));if(!i)return this.logger.error("VAST fallback: no linear creative with media found"),this.finishWithResult(u.ERROR);if(this.vastTracker=(e=i.ad,t=i.creative,new ge(null,e,t)),!this.videoElement)return this.finishWithResult(u.ERROR);const n=this.videoElement;n.src=i.mediaUrl,n.load(),this.ui.setFallbackSaibaMaisClick(()=>{this.vastTracker&&(this.vastTracker.once?.("clickthrough",e=>{e&&window.open(e,"_blank")}),this.vastTracker.click(null,{}),this.sendClickThroughEvent())});const a=()=>{this.vastTracker?.trackImpression(),this.vastTracker?.load?.(),re.hide(),this.ui.showFallbackOverlay(!!i.clickThroughUrl),this.ui.updateFallbackTimer(0,i.creative.duration??0),this.logger.debug("VAST fallback: ad loaded")},s=()=>{this.vastTracker&&this.vastTracker.setProgress(n.currentTime),this.emitFallbackProgressEvents(n.currentTime,i.creative.duration??0),this.ui.updateFallbackTimer(n.currentTime,i.creative.duration??0)},o=async()=>{this.vastTracker?.complete?.(),this.sendCompleteEvent(),this.sendAllAdsCompletedEvent(),this.logger.debug("VAST fallback: ad completed"),this.ui.hideFallbackOverlay(),this.ui.hide();const e=this.currentMedia.content?.survey?.hasUrl();if(e)try{const e=new ue(this.currentMedia),t=await e.start();this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}catch(e){this.logger.error("Error executing survey after video:",e),this.finishWithResult(u.REWARDED)}else this.finishWithResult(u.REWARDED);this.removeVastFallbackListeners(),setTimeout(()=>{this.ui.cleanup(),this.cleanupResources()},1e3)},l=()=>{this.logger.error("VAST fallback: video error"),this.vastTracker?.error?.(),this.sendAdErrorEvent(),this.finishWithResult(u.ERROR),this.removeVastFallbackListeners()},c=e=>{this.vastTracker&&(this.vastTracker.once?.("clickthrough",e=>{e&&window.open(e,"_blank")}),this.vastTracker.click(null,{CLICKPOS:[e.clientX,e.clientY]}),this.sendClickThroughEvent())};return n.addEventListener("canplay",a,{once:!0}),n.addEventListener("timeupdate",s),n.addEventListener("ended",o,{once:!0}),n.addEventListener("error",l,{once:!0}),n.addEventListener("click",c),this.vastFallbackUnlisten=()=>{n.removeEventListener("canplay",a),n.removeEventListener("timeupdate",s),n.removeEventListener("ended",o),n.removeEventListener("error",l),n.removeEventListener("click",c)},await n.play().catch(e=>{this.logger.error("VAST fallback: play failed",e),l()}),await this.waitForAdResult()}catch(e){return this.logger.error("Error executing VAST fallback:",e),this.removeVastFallbackListeners(),this.finishWithResult(u.ERROR)}var e,t}emitFallbackProgressEvents(e,t){if(t<=0)return;const r=e/t,i=[.001,.25,.5,.75];[{key:"start",send:()=>this.sendVpaidStartEvent()},{key:"firstQuartile",send:()=>this.sendFirstQuartileEvent()},{key:"midpoint",send:()=>this.sendMidpointEvent()},{key:"thirdQuartile",send:()=>this.sendThirdQuartileEvent()}].forEach((e,t)=>{r>=i[t]&&!this.fallbackProgressEmitted.has(e.key)&&(this.fallbackProgressEmitted.add(e.key),e.send())})}removeVastFallbackListeners(){this.vastFallbackUnlisten&&(this.vastFallbackUnlisten(),this.vastFallbackUnlisten=null),this.vastTracker=null,this.usingVastFallback=!1,this.fallbackProgressEmitted.clear()}async waitForAdResult(){return new Promise(e=>{this.resolvePlayerExecution=e})}finishWithResult(e,t){this.logger.debug("Finishing VAST player with result:",e),re.hide();const r=this.mediaResultHelper.finishWithResult(this.currentMedia,e,t);return this.resolvePlayerExecution&&(this.resolvePlayerExecution(r),this.resolvePlayerExecution=null),this.cleanup(),r}createModal(){try{this.videoElement=this.ui.createModal(),this.ui.setCloseCallback(()=>{this.finishWithResult(u.CANCELED),this.destroyPlayerOnClose()})}catch(e){throw this.logger.error("Error creating modal:",e),e}}prepareAdTagUrl(){if("video_v2"===this.currentMedia.type){if(!this.currentMedia.content?.video?.url)throw this.logger.error("Video V2 URL not found"),new Error("Video V2 URL not found");return this.currentMedia.content.video.url}if(!this.currentMedia.content?.url)throw this.logger.error("Media content URL not found"),new Error("Media content URL not found");return this.currentMedia.content.url}async setupIMA(){try{if(!this.videoElement)throw new Error("Video element not found");if(this.adContainer=this.ui.getAdContainer(),!this.adContainer)throw new Error("Ad container not found");this.ui.showVideo(),this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoElement),this.adDisplayContainer.initialize(),this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.setupIMAEvents(),this.logger.debug("IMA SDK setup completed")}catch(e){throw this.logger.error("Error setting up IMA SDK:",e),e}}setupIMAEvents(){this.adsLoader&&(this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e=>{if(this.logger.debug("AdsManager loaded"),this.adManager=e.getAdsManager(this.videoElement),this.adManager){const e=this.videoElement?.clientWidth||640,t=this.videoElement?.clientHeight||480;this.logger.debug(`Initializing ad with dimensions: ${e}x${t}`),this.setupAdManagerEvents(),this.adManager.init(e,t,window.google.ima.ViewMode.NORMAL),this.adManager.start(),this.logger.debug("Ad started successfully"),setTimeout(()=>{this.ui.showVideo()},100)}}),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,e=>{this.logger.error("Ad error:",e.getError()),this.finishWithResult(u.ERROR)}))}setupAdManagerEvents(){this.adManager&&(this.adManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,()=>{this.logger.debug("Ad loaded"),re.hide()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,()=>{this.logger.debug("Ad started"),this.sendVpaidStartEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.FIRST_QUARTILE,()=>{this.logger.debug("Ad first quartile"),this.sendFirstQuartileEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.MIDPOINT,()=>{this.logger.debug("Ad midpoint"),this.sendMidpointEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.THIRD_QUARTILE,()=>{this.logger.debug("Ad third quartile"),this.sendThirdQuartileEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,()=>{this.sendCompleteEvent(),this.logger.debug("Ad completed")}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,async()=>{this.logger.debug("All ads completed"),this.sendAllAdsCompletedEvent(),this.ui.hide();const e=this.currentMedia.content?.survey?.hasUrl();if(e){this.logger.debug("Video completed, executing survey");try{const e=new ue(this.currentMedia),t=await e.start();this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}catch(e){this.logger.error("Error executing survey after video:",e),this.finishWithResult(u.REWARDED)}}else this.finishWithResult(u.REWARDED);setTimeout(()=>{this.ui.cleanup(),this.cleanupResources()},1e3)}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.CLICK,()=>{this.logger.debug("Ad click (clickthrough / Saiba mais)"),this.sendClickThroughEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.VIDEO_CLICKED,()=>{this.logger.debug("Video area clicked (pause/resume by IMA)")}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.SKIPPED,()=>{this.logger.debug("Ad skipped"),this.sendSkippedEvent()}))}async requestAds(e){try{if(!this.adsLoader)throw new Error("AdsLoader not initialized");const t=new window.google.ima.AdsRequest;t.adTagUrl=e,this.logger.debug("Requesting ads with URL:",e),this.adsLoader.requestAds(t),this.logger.debug("Ads requested successfully")}catch(e){throw this.logger.error("Error requesting ads:",e),e}}sendVpaidStartEvent(){this.mediaResultHelper.sendEventCallback(j.START,this.currentMedia)}sendFirstQuartileEvent(){this.mediaResultHelper.sendEventCallback(j.FIRST_QUARTILE,this.currentMedia)}sendMidpointEvent(){this.mediaResultHelper.sendEventCallback(j.MIDPOINT,this.currentMedia)}sendThirdQuartileEvent(){this.mediaResultHelper.sendEventCallback(j.THIRD_QUARTILE,this.currentMedia)}sendCompleteEvent(){this.mediaResultHelper.sendEventCallback(j.AD_COMPLETED,this.currentMedia)}sendAllAdsCompletedEvent(){this.mediaResultHelper.sendEventCallback(j.ALL_ADS_COMPLETED,this.currentMedia)}sendClickThroughEvent(){this.mediaResultHelper.sendEventCallback(j.CLICKTHROUGH,this.currentMedia)}sendSkippedEvent(){this.mediaResultHelper.sendEventCallback(j.SKIPPED,this.currentMedia)}sendAdErrorEvent(){this.mediaResultHelper.sendEventCallback(j.ERROR,this.currentMedia)}destroyPlayerOnClose(){this.usingVastFallback&&this.removeVastFallbackListeners(),this.adManager&&(this.adManager.destroy(),this.adManager=null),this.adsLoader&&(this.adsLoader.destroy(),this.adsLoader=null),this.adDisplayContainer&&(this.adDisplayContainer.destroy(),this.adDisplayContainer=null),this.ui.cleanup(),this.adContainer=null,this.mediaResultHelper.clearSentEvents(),this.resolvePlayerExecution=null}cleanup(){this.logger.debug("Cleaning up VAST player"),this.ui.cleanup(),this.videoElement=null,this.adContainer=null}cleanupResources(){this.logger.debug("Cleaning up VAST player resources (UI already cleaned)"),this.mediaResultHelper.clearSentEvents(),this.resolvePlayerExecution=null,this.adContainer=null,this.videoElement=null}destroy(){this.logger.debug("Destroying VAST player"),this.cleanup()}}function ut(e){return new dt(e)}var ht;!function(e){e.NO_FILL="NO_FILL",e.CONNECTION_ERROR="CONNECTION_ERROR",e.AD_FAILED="AD_FAILED",e.REWARDED="REWARDED",e.SKIPPED="SKIPPED"}(ht||(ht={}));class gt{constructor(){this.steps=[]}addStep(e,t){this.steps.push({result:e,errorMessage:t})}getWaterfallSummary(){return this.steps.map(e=>`${e.result}`).join(", ")||"No results"}getDetailedWaterfallSummary(){return this.steps.map(e=>{switch(e.result){case ht.AD_FAILED:return"AD_FAILED"+(e.errorMessage?`(${e.errorMessage})`:"");case ht.NO_FILL:return"NO_FILL";case ht.CONNECTION_ERROR:return"CONNECTION_ERROR";case ht.REWARDED:return"REWARDED";case ht.SKIPPED:return"SKIPPED";default:return e.result}}).join(" | ")}findMainResult(){return this.steps.some(e=>e.result===ht.REWARDED)?ht.REWARDED:this.steps.some(e=>e.result===ht.SKIPPED)?ht.SKIPPED:this.steps.some(e=>e.result===ht.NO_FILL)?ht.NO_FILL:this.steps.some(e=>e.result===ht.AD_FAILED)?ht.AD_FAILED:ht.CONNECTION_ERROR}clear(){this.steps=[]}getSteps(){return[...this.steps]}getStepCount(){return this.steps.length}}function pt(){return new gt}class mt{constructor(e){this.isLoaded=!1,this.isDestroyed=!1,this.loadTimeout=null,this.rewardedSlot=null,this.rewardPayload=null,this.resolvePromise=null,this.eventListeners={rewardedSlotReady:null,rewardedSlotClosed:null,rewardedSlotGranted:null,slotRenderEnded:null},this.config=e,this.logger=new b(qt.getDebugMode())}async loadAd(){return this.isDestroyed?(this.logger.warn("Wrapper already destroyed"),{result:ht.AD_FAILED,errorMessage:"Wrapper destroyed"}):(this.logger.debug("Loading GAM Rewarded Video:",this.config.adUnitId),new Promise(e=>{this.resolvePromise=e,this.initGooglePublisherTag().then(()=>{if(!this.isDestroyed)return this.renderRewardedAd();e({result:ht.AD_FAILED,errorMessage:"Wrapper destroyed"})}).catch(t=>{this.logger.error("Error loading GAM RV:",t),e({result:ht.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"})})}))}async initGooglePublisherTag(){if("undefined"==typeof window)throw new Error("Window object not available");if(!window.googletag){window.googletag=window.googletag||{cmd:[]};try{await X(),this.logger.debug("GPT script ready")}catch(e){throw this.logger.error("Failed to load GPT script:",e),new Error(`Failed to load Google Publisher Tag: ${e instanceof Error?e.message:"Unknown error"}`)}}}async renderRewardedAd(){return new Promise((e,t)=>{this.loadTimeout=setTimeout(()=>{this.isDestroyed||(this.logger.error("GAM RV load timeout"),this.resolvePromise?.({result:ht.CONNECTION_ERROR,errorMessage:"Load timeout"}),this.removeEventListeners(),t(new Error("Load timeout")))},this.config.timeout);try{window.googletag.cmd.push(()=>{this.isDestroyed||(se(),this.rewardedSlot=window.googletag.defineOutOfPageSlot(this.config.adUnitId,window.googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot?(this.rewardedSlot.addService(window.googletag.pubads()),this.addCampaignParams(),this.addEventListeners(),window.googletag.enableServices(),window.googletag.display(this.rewardedSlot),e()):(this.logger.error("Rewarded ads are not supported on this page"),this.resolvePromise?.({result:ht.AD_FAILED,errorMessage:"Rewarded ads not supported"}),this.removeEventListeners(),t(new Error("Rewarded ads not supported"))))})}catch(e){this.logger.error("Error in renderRewardedAd:",e),this.resolvePromise?.({result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}),this.removeEventListeners(),t(e)}})}addCampaignParams(){this.rewardedSlot&&this.config.campaignParams&&(this.config.campaignParams.mediaId&&this.rewardedSlot.setTargeting("a_media_id",this.config.campaignParams.mediaId),this.config.campaignParams.campaignId&&this.rewardedSlot.setTargeting("a_campaign_id",this.config.campaignParams.campaignId),this.config.campaignParams.zoneId&&this.rewardedSlot.setTargeting("a_zone_id",this.config.campaignParams.zoneId),this.config.campaignParams.requestId&&this.rewardedSlot.setTargeting("a_request_id",this.config.campaignParams.requestId))}addEventListeners(){this.logger.debug("Adding GAM RV event listeners"),this.eventListeners.rewardedSlotReady||(this.eventListeners.rewardedSlotReady=e=>{this.isDestroyed||(this.logger.debug("Rewarded ad slot is ready"),history.pushState(null,"Google Rewarded Video","#goog_rewarded"),re.hide(),e.makeRewardedVisible(),this.logger.debug("Rewarded ad is active"))},window.googletag.pubads().addEventListener("rewardedSlotReady",this.eventListeners.rewardedSlotReady)),this.eventListeners.rewardedSlotClosed||(this.eventListeners.rewardedSlotClosed=()=>{this.isDestroyed||(this.logger.debug("Rewarded ad closed"),this.resolvePromise?.({result:ht.SKIPPED,errorMessage:void 0}),this.dismissRewardedAd())},window.googletag.pubads().addEventListener("rewardedSlotClosed",this.eventListeners.rewardedSlotClosed)),this.eventListeners.rewardedSlotGranted||(this.eventListeners.rewardedSlotGranted=e=>{this.isDestroyed||(this.logger.debug("User rewarded"),this.resolvePromise?.({result:ht.REWARDED,errorMessage:void 0}),this.dismissRewardedAd())},window.googletag.pubads().addEventListener("rewardedSlotGranted",this.eventListeners.rewardedSlotGranted)),this.eventListeners.slotRenderEnded||(this.eventListeners.slotRenderEnded=e=>{this.isDestroyed||(this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),e.slot===this.rewardedSlot&&e.isEmpty&&(this.logger.debug("No ad returned for rewarded ad slot"),this.resolvePromise?.({result:ht.NO_FILL,errorMessage:"No ad returned"}),this.dismissRewardedAd()))},window.googletag.pubads().addEventListener("slotRenderEnded",this.eventListeners.slotRenderEnded))}removeEventListeners(){this.logger.debug("Removing GAM RV event listeners"),this.eventListeners.rewardedSlotReady&&(window.googletag.pubads().removeEventListener("rewardedSlotReady",this.eventListeners.rewardedSlotReady),this.eventListeners.rewardedSlotReady=null),this.eventListeners.rewardedSlotClosed&&(window.googletag.pubads().removeEventListener("rewardedSlotClosed",this.eventListeners.rewardedSlotClosed),this.eventListeners.rewardedSlotClosed=null),this.eventListeners.rewardedSlotGranted&&(window.googletag.pubads().removeEventListener("rewardedSlotGranted",this.eventListeners.rewardedSlotGranted),this.eventListeners.rewardedSlotGranted=null),this.eventListeners.slotRenderEnded&&(window.googletag.pubads().removeEventListener("slotRenderEnded",this.eventListeners.slotRenderEnded),this.eventListeners.slotRenderEnded=null)}dismissRewardedAd(){this.rewardPayload&&(this.rewardPayload=null),this.logger.debug("Rewarded ad has been closed"),this.rewardedSlot&&window.googletag.destroySlots([this.rewardedSlot]),this.removeEventListeners()}destroy(){this.isDestroyed||(this.logger.debug("Destroying GAM RV wrapper"),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.removeEventListeners(),this.rewardedSlot&&window.googletag&&window.googletag.destroySlots([this.rewardedSlot]),this.isDestroyed=!0,this.isLoaded=!1,this.rewardedSlot=null,this.rewardPayload=null)}isAdLoaded(){return this.isLoaded}}function ft(e){return new mt(e)}class vt{constructor(e){this.isDestroyed=!1,this.loadTimeout=null,this.resolvePromise=null,this.adInstance=null,this.adContainer=null,this.adElement=null,this.mediaResultHelper=null,this.config=e,this.logger=new b(qt.getDebugMode()),this.mediaResultHelper=e.mediaResultHelper||null}async loadAd(){if(this.isDestroyed)return this.logger.warn("Wrapper already destroyed"),{result:ht.AD_FAILED,errorMessage:"Wrapper destroyed"};const e=qt.getConfig()?.luminaToken;return e&&0!==e.trim().length?(this.logger.debug("Loading Lumina Rewarded Video:",this.config.tagId),new Promise(e=>{this.resolvePromise=e,this.initLuminaSDK().then(()=>{if(!this.isDestroyed)return this.renderRewardedAd();e({result:ht.AD_FAILED,errorMessage:"Wrapper destroyed"})}).catch(t=>{this.logger.error("Error loading Lumina RV:",t),e({result:ht.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"})})})):(this.logger.warn("Lumina token not configured, skipping Lumina RV step"),{result:ht.AD_FAILED,errorMessage:"Lumina token not configured"})}async initLuminaSDK(){if("undefined"==typeof window)throw new Error("Window object not available");try{const e=this.config.debug||!1,t=qt.getConfig()?.luminaToken,r=qt.getConfig()?.proxyExternalScripts||!1;await Z({token:t,debug:e},r),this.logger.debug("Lumina SDK script ready")}catch(e){throw this.logger.error("Failed to load Lumina SDK script:",e),new Error(`Failed to load Lumina SDK: ${e instanceof Error?e.message:"Unknown error"}`)}}createAdContainer(){this.adContainer=document.createElement("div"),this.adContainer.id=`lumina-ad-container-${Date.now()}`,this.adContainer.style.display="block",this.adContainer.style.width="100%",this.adContainer.style.height="100vh",this.adContainer.style.position="fixed",this.adContainer.style.top="0",this.adContainer.style.left="0",this.adContainer.style.zIndex="9999",this.adElement=document.createElement("ins"),this.adElement.className="adsbylumina",this.adElement.style.display="block",this.adElement.style.width="100%",this.adElement.style.height="100%";const e=this.config.media?.uuid||`lumina-${Date.now()}`;this.adElement.setAttribute("data-ad-type","fluid"),this.adElement.setAttribute("data-ad-client","ug"),this.adElement.setAttribute("data-ad-tagId",this.config.tagId),this.adElement.setAttribute("data-ad-slot","close"),this.adElement.setAttribute("data-ad-luminaAdToken",e),this.adElement.setAttribute("data-ad-mute","false"),this.adContainer.appendChild(this.adElement),document.body.appendChild(this.adContainer),this.logger.debug("Lumina ad container created")}async renderRewardedAd(){return new Promise((e,t)=>{if(this.loadTimeout=setTimeout(()=>{this.isDestroyed||(this.logger.error("Lumina RV load timeout"),this.resolvePromise?.({result:ht.CONNECTION_ERROR,errorMessage:"Load timeout"}),this.removeAdContainer(),t(new Error("Load timeout")))},this.config.timeout),this.createAdContainer(),!window.adsbylumina)return void t(new Error("Lumina SDK not available"));window.adsbylumina=window.adsbylumina||[];const r={luminaAdToken:this.config.media?.uuid||`lumina-${Date.now()}`,tagId:this.config.tagId,bidfloor:0,onAdRequestSuccess:r=>{if(!this.isDestroyed){this.logger.debug("Ad request succeeded, price:",r.price),this.adInstance=r,this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.adContainer&&(this.adContainer.style.display="block");try{r.renderAd(),this.logger.debug("Ad rendered successfully"),re.hide(),e()}catch(e){this.logger.error("renderAd() failed:",e);const r=e instanceof Error?e.message:"Ad render failed";this.removeAdContainer(),this.resolvePromise?.({result:ht.AD_FAILED,errorMessage:r}),t(new Error(r))}}},onAdRequestFailed:e=>{if(this.isDestroyed)return;this.logger.error("Ad request failed:",e),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.removeAdContainer();const r=e.error??"Unknown error",i=r.toLowerCase().includes("no ad"),n=i?ht.NO_FILL:ht.AD_FAILED;this.logger.debug("Error classified as: "+(i?"NO_FILL":"AD_FAILED")),this.resolvePromise?.({result:n,errorMessage:r}),t(new Error(r))},onAdComplete:e=>{this.isDestroyed||(this.logger.debug("Ad completed",e),this.logger.debug("User rewarded"),this.resolvePromise?.({result:ht.REWARDED,errorMessage:void 0}),this.removeAdContainer())},onAdClick:e=>{this.isDestroyed||(this.logger.debug("Ad clicked",e),this.mediaResultHelper&&this.config.media&&this.mediaResultHelper.sendEventCallback(j.CLICKTHROUGH,this.config.media))},onTemplateClose:()=>{this.isDestroyed||(this.logger.debug("Rewarded ad closed"),this.resolvePromise?.({result:ht.SKIPPED,errorMessage:void 0}),this.removeAdContainer())}};window.adsbylumina.push(r)})}removeAdContainer(){this.adContainer&&this.adContainer.parentNode&&(this.adContainer.parentNode.removeChild(this.adContainer),this.adContainer=null,this.adElement=null,this.logger.debug("Lumina ad container removed"))}destroy(){this.isDestroyed||(this.logger.debug("Destroying Lumina RV wrapper"),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.adInstance=null,this.removeAdContainer(),this.isDestroyed=!0)}}function Et(e){return new vt(e)}class yt{constructor(e={}){this.currentMedia=null,this.config=e,this.logger=new b(qt.getDebugMode());const t=qt.getUserData(),r=qt.getDebugMode();this.mediaResultHelper=new $({userId:t?.userId||"",debug:r}),this.waterfallTracker=new gt}async start(e){this.logger.debug("Starting programmatic player for media:",e.title),re.show();try{this.currentMedia=e,this.waterfallTracker.clear(),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_WATERFALL_START,e);const t=e.content?.programmatic?.waterfall;return t&&0!==t.length?await this.executeWaterfall(t):(this.logger.error("Empty or null waterfall"),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_ERROR,e),re.hide(),this.createErrorResult("Empty or null waterfall"))}catch(e){throw this.logger.error("Error in start method:",e),re.hide(),e}}async executeWaterfall(e){this.logger.debug("Executing waterfall with",e.length,"steps");for(let t=0;t<e.length;t++){const r=e[t];this.logger.debug(`Loading ad ${t+1} of ${e.length}: ${r.type}`);try{const e=await this.loadAd(r,t);if(e instanceof w)return this.logger.debug("Fallback executed, returning result directly"),e;if(e.result===ht.REWARDED)return this.logger.debug("Ad rewarded successfully"),this.mediaResultHelper.sendEventCallback(j.COMPLETE,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.REWARDED);if(e.result===ht.SKIPPED)return this.logger.debug("Ad skipped"),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_SKIPPED,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.SKIPPED);this.waterfallTracker.addStep(e.result,e.errorMessage),this.logger.debug(`Ad ${t+1} failed: ${e.result} - ${e.errorMessage}, trying next`)}catch(e){this.logger.error(`Error loading ad ${t+1}:`,e),this.waterfallTracker.addStep(ht.AD_FAILED,e instanceof Error?e.message:"Unknown error")}}return this.logger.debug("No more ads to load in waterfall. Summary:",this.waterfallTracker.getDetailedWaterfallSummary()),re.hide(),await this.sendProgResultEvent()}async loadAd(e,t){const r=e.type,i=e.findTimeout()||this.config.loadTimeout||1e4;switch(this.logger.debug(`Loading ad type: ${r}`),r){case d.TYPE_GOOGLE_RV:return await this.loadGAMRewardedVideo(e.findAdUnitId(),i);case d.TYPE_KWAI_RV:return await this.loadLuminaRewardedVideo(e.findAdUnitId(),i);case d.TYPE_FALLBACK:return await this.loadVideoFallback(e.findVastTag(),e.findEventSuffix());default:return this.logger.warn(`Ad type ${r} not supported in web`),{result:ht.AD_FAILED,errorMessage:`Ad type ${r} not supported`}}}async loadGAMRewardedVideo(e,t){try{if(this.logger.debug("Loading GAM Rewarded Video"),!e)return this.logger.error("Ad unit ID not found for GAM RV"),{result:ht.AD_FAILED,errorMessage:"Ad unit ID not found"};const r=this.buildCampaignParams(),i=qt.getDebugMode(),n=new mt({adUnitId:e,timeout:t,campaignParams:r,debug:i});return await this.loadGAMRewardedVideoWithWrapper(n)}catch(e){return this.logger.error("Error loading GAM RV:",e),{result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}}}async loadLuminaRewardedVideo(e,t){try{if(this.logger.debug("Loading Lumina Rewarded Video"),!e)return this.logger.error("TagId not found for Lumina RV"),{result:ht.AD_FAILED,errorMessage:"TagId not found"};const r=this.buildCampaignParams(),i=qt.getDebugMode(),n=new vt({tagId:e,timeout:t,campaignParams:r,debug:i,mediaResultHelper:this.mediaResultHelper,media:this.currentMedia||void 0});return await this.loadLuminaRewardedVideoWithWrapper(n)}catch(e){return this.logger.error("Error loading Lumina RV:",e),{result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}}}async loadLuminaRewardedVideoWithWrapper(e){try{const t=await e.loadAd();return this.logger.debug("Lumina RV result:",t.result),t}catch(e){return this.logger.error("Error loading Lumina RV:",e),{result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}}}async loadGAMRewardedVideoWithWrapper(e){try{const t=await e.loadAd();return this.logger.debug("GAM RV result:",t.result),t}catch(e){return this.logger.error("Error loading GAM RV:",e),{result:ht.AD_FAILED,errorMessage:e instanceof Error?e.message:"Unknown error"}}}async loadVideoFallback(e,t){try{this.logger.debug("Loading fallback VIDEO_V2"),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_FALLBACK_REQ,this.currentMedia),this.sendProgResultEvent();const r=JSON.parse(JSON.stringify(this.currentMedia));r.type=d.VIDEO_V2,r.content={video:{type:"IN_HOUSE",url:e,proxy:!1,eventSuffix:t}};const i=new Rt(r);return await i.click(!1)}catch(e){return this.logger.error("Error loading fallback:",e),new w({media:this.currentMedia,result:u.ERROR,error:new g(G.ERROR,e instanceof Error?e.message:"Unknown error")})}}createErrorResult(e){return new w({media:this.currentMedia,result:u.ERROR,error:new g(G.ERROR,e instanceof Error?e.message:"Unknown error")})}async sendProgResultEvent(){switch(this.waterfallTracker.findMainResult()){case ht.NO_FILL:return this.logger.debug("Waterfall completed with NO_FILL"),this.mediaResultHelper.sendEventCallback(j.NO_FILL,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.NO_FILL);case ht.AD_FAILED:const e=`Waterfall failed: ${this.waterfallTracker.getDetailedWaterfallSummary()}`;return this.logger.error("Waterfall",e),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_ERROR,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.ERROR,e);case ht.CONNECTION_ERROR:return this.logger.debug("Waterfall completed with CONNECTION_ERROR"),this.mediaResultHelper.sendEventCallback(j.PROGRAMMATIC_CONNECTION_ERROR,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,u.CONNECTION_ERROR,"Connection Error");case ht.REWARDED:return this.mediaResultHelper.finishWithResult(this.currentMedia,u.REWARDED);case ht.SKIPPED:return this.mediaResultHelper.finishWithResult(this.currentMedia,u.SKIPPED)}}buildCampaignParams(){const e={};return this.currentMedia?.uuid&&(e.mediaId=this.currentMedia.uuid),this.currentMedia?.campaignId&&(e.campaignId=this.currentMedia.campaignId),this.currentMedia?.zoneId&&(e.zoneId=this.currentMedia.zoneId),this.currentMedia?.requestId&&(e.requestId=this.currentMedia.requestId),e}destroy(){this.logger.debug("Destroying AARewardedVideo"),re.hide(),this.currentMedia=null,this.waterfallTracker.clear()}}function wt(e){return new yt(e)}class bt{constructor(e){this.media=e;const t=qt.getDebugMode();this.logger=new b(t),this.mediaResultHelper=new $({userId:qt.getUserData()?.userId||"",debug:t})}async start(){try{if(!this.getRedirectUrl())return this.logger.error("URL de redirecionamento não encontrada"),this.mediaResultHelper.finishWithResult(this.media,u.ERROR,"URL de redirecionamento não encontrada");return new w({media:this.media,result:u.EXTERNAL_REDIRECT})}catch(e){return this.logger.error("Erro ao executar redirecionamento externo:",e),this.mediaResultHelper.finishWithResult(this.media,u.ERROR,e instanceof Error?e.message:"Erro desconhecido")}}getRedirectUrl(){if(this.media.content?.externalRedirect?.link)return this.media.content.externalRedirect.link;const e=this.media._rawContent;return e&&e.link?e.link:this.media.content?.url?this.media.content.url:this.media.externalUrl?.url?this.media.externalUrl.url:this.media.success?.url?this.media.success.url:null}}class At{constructor(e){this.media=e;const t=qt.getDebugMode();this.logger=new b(t),this.mediaResultHelper=new $({userId:qt.getUserData()?.userId||"",debug:t})}async start(){try{return this.getClickUrl()?(this.mediaResultHelper.sendEventCallback(j.CLICKTHROUGH,this.media),new w({media:this.media,result:u.BANNER_CLICK})):(this.logger.error("URL de clique do banner não encontrada"),this.mediaResultHelper.finishWithResult(this.media,u.ERROR,"URL de clique do banner não encontrada"))}catch(e){return this.logger.error("Erro ao executar clique do banner:",e),this.mediaResultHelper.finishWithResult(this.media,u.ERROR,e instanceof Error?e.message:"Erro desconhecido")}}getClickUrl(){return this.media.externalUrl?.url??null}}class Rt{constructor(e){this.uuid=e.uuid,this.type=e.type,this.title=e.title,this.viewed=e.viewed,this.campaignId=e.campaignId,this.campaignName=e.campaignName,this.requestId=e.requestId,this.zoneId=e.zoneId,this.mediasLeft=e.mediasLeft,this.layout=e.layout,this.partnerEventUuid=e.partnerEventUuid,e.content&&(this.content=new E(e.content)),e.success&&(this.success=new y(e.success)),Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.content&&!this._rawContent&&(this._rawContent=e.content)}getPostbackBenefits(){return this.partnerEvent?.benefits}async click(e=!0){const t=qt.getDebugMode(),r=new b(t);try{const t=qt.getUserData();if(!t?.userId)return r.error("Error executing media click: user id is null"),new w({media:this,result:u.ERROR,error:new g("User ID is required")});if(e){(new H).sendMediaClickEvent(this.campaignId||"",this.requestId||"",this.uuid).catch(e=>r.warn("Error sending click event:",e))}switch(this.type){case d.VIDEO_V2:return await this.executeVideoV2Media(t.userId);case d.PROGRAMMATIC_V2:return await this.executeProgrammaticV2Media(t.userId);case d.SURVEY_V2:return await this.executeSurveyV2Media(t.userId);case d.EXTERNAL_REDIRECT:return await this.executeExternalRedirectMedia(t.userId);case d.BANNER:return await this.executeBannerMedia(t.userId);default:return r.warn(`Unsupported media type: ${this.type}`),new w({media:this,result:u.ERROR,error:new g(`Unsupported media type: ${this.type}`)})}return new w({media:this,result:u.ERROR,error:new g("Media execution failed")})}catch(e){return r.error("Error executing media click:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}async executeProgrammaticV2Media(e){const t=qt.getDebugMode();new b(t).debug("Executing Programmatic V2 media:",this.title);const r=new yt,i=await r.start(this);return new w(i)}async executeVideoV2Media(e){const t=qt.getDebugMode(),r=new b(t);r.debug("Executing Video V2 media:",this.title);try{const e=new dt,t=await e.start(this);return r.debug("Video V2 execution completed:",t.result),t}catch(e){return r.error("Error in executeVideoV2Media:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}async executeSurveyV2Media(e){const t=qt.getDebugMode(),r=new b(t);r.debug("Executing Survey V2 media:",this.title);try{const e=new ue(this),t=await e.start();return r.debug("Survey V2 execution completed:",t.result),t}catch(e){return r.error("Error in executeSurveyV2Media:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}async executeExternalRedirectMedia(e){const t=qt.getDebugMode(),r=new b(t);r.debug("Executing External Redirect media:",this.title);try{const e=new bt(this),t=await e.start();return r.debug("External Redirect execution completed:",t.result),t}catch(e){return r.error("Error in executeExternalRedirectMedia:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}async executeBannerMedia(e){const t=qt.getDebugMode(),r=new b(t);r.debug("Executing Banner media:",this.title);try{const e=new At(this),t=await e.start();return r.debug("Banner execution completed:",t.result),t}catch(e){return r.error("Error in executeBannerMedia:",e),new w({media:this,result:u.ERROR,error:new g(e instanceof Error?e.message:"Unknown error")})}}}class Tt{constructor(e){this.image=e.image,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}hasValidImage(){return!!(this.image&&this.image.trim().length>0)}getImageUrl(e){return this.hasValidImage()?this.image:e||""}isAbsoluteUrl(){return this.image.startsWith("http://")||this.image.startsWith("https://")}}class kt{constructor(e){this.primaryColor=e.primaryColor,this.secondaryColor=e.secondaryColor,this.title=e.title,this.primaryInformation=e.primaryInformation,this.secondaryInformation=e.secondaryInformation,this.enableCountdown=e.enableCountdown||!1,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.header&&(this.header=new Tt(e.header))}getPrimaryColorHex(){return this.primaryColor.startsWith("#")?this.primaryColor:`#${this.primaryColor}`}getSecondaryColorHex(){return this.secondaryColor.startsWith("#")?this.secondaryColor:`#${this.secondaryColor}`}isValid(){return!!(this.primaryColor&&this.secondaryColor&&this.title&&this.header)}}class It{constructor(e){this.success=e.success,this.media=e.media||[],Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.layout&&(this.layout=new kt(e.layout)),this.media=this.media.map(e=>new Rt(e))}getUnviewedMedia(){return this.media.filter(e=>!e.viewed)}getMediaByType(e){return this.media.filter(t=>t.type===e)}hasAvailableMedia(){return this.getUnviewedMedia().length>0}getMediaCount(){return this.media.length}}class Ct{constructor(e){this.name=e.name,this.description=e.description,this.value=e.value,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}hasDescription(){return!(!this.description||!this.description.trim())}hasValue(){return!!this.value}getInfo(){return this.hasDescription()?`${this.name}: ${this.description}`:this.name}}class Dt{constructor(e){this.quantity=e.quantity,this.unit=e.unit}}class St{constructor(e){this.uuid=e.uuid,this.label=e.label,this.description=e.description,this.benefits=(e.benefits||[]).map(e=>new Dt(e))}}class Lt{constructor(e){this.event=new St(e.event)}}class Nt{constructor(e){this.campaignUuid=e.campaignUuid,this.campaignName=e.campaignName,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.mainData&&(this.mainData=new It(e.mainData)),this.benefitOffers=(e.benefitOffers||[]).map(e=>new Ct(e)),this.events=e.events?e.events.map(e=>new Lt(e)):void 0}getUnviewedMedia(){return this.mainData?.media?.filter(e=>!e.viewed)||[]}getMediaByType(e){return this.mainData?.media?.filter(t=>t.type===e)||[]}hasAvailableMedia(){return this.getUnviewedMedia().length>0}}class xt{constructor(e){this.uuid=e.uuid,this.name=e.name,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isValid(){return!(!this.uuid||!this.name)}getInfo(){return`${this.name} (${this.uuid})`}}class Mt{constructor(e){this.requestId=e.requestId,this.campaigns=e.campaigns||[],Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.zone&&(this.zone=new xt(e.zone)),this.campaigns=this.campaigns.map(e=>new Nt(e))}getCampaignsWithAvailableMedia(){return this.campaigns.filter(e=>e.hasAvailableMedia())}getAllMedia(){return this.campaigns.flatMap(e=>e.mainData?.media||[])}getMediaByType(e){return this.campaigns.flatMap(t=>t.getMediaByType(e))}}class Ot{constructor(e){this.responseStatus=e.responseStatus,this.error=e.error,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.campaignResponse&&(this.campaignResponse=new Mt(e.campaignResponse))}isSuccess(){return this.responseStatus===c.SUCCESS}isEmpty(){return this.responseStatus===c.EMPTY}hasError(){return this.responseStatus===c.ERROR}getCampaigns(){return this.campaignResponse?.campaigns||[]}getAllMedia(){return this.campaignResponse?.getAllMedia()||[]}}class Ut{constructor(e){this.userId=e.userId,this.context=e.context,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}addContext(e,t){this.context||(this.context={}),this.context[e]=t}getContext(e){return this.context?.[e]}hasContext(){return!!(this.context&&Object.keys(this.context).length>0)}}const Pt="@AkrossAds:SDK_CONFIG",Vt="@Dataads:USER_DATA",_t="@Dataads:CUSTOM_HEADERS";class qt{static saveConfig(e){localStorage.setItem(Pt,JSON.stringify(e))}static getConfig(){const e=localStorage.getItem(Pt);return e?JSON.parse(e):null}static updateConfig(e){const t=this.getConfig();if(t){const r={...t,...e};this.saveConfig(r)}}static deleteConfig(){localStorage.removeItem(Pt)}static saveUserData(e,r=null){const i=new t({userId:e,advertisingId:r});localStorage.setItem(Vt,JSON.stringify(i))}static getUserData(){const e=localStorage.getItem(Vt);return e?JSON.parse(e):null}static removeUserData(){localStorage.removeItem(Vt)}static getDebugMode(){const e=this.getConfig();return e?.debug||!1}static setDebugMode(e){this.updateConfig({debug:e})}static getCustomHeaders(){const e=localStorage.getItem(_t);return e?JSON.parse(e):null}static saveCustomHeaders(e){localStorage.setItem(_t,JSON.stringify(e))}static removeCustomHeaders(){localStorage.removeItem(_t)}static clearAll(){localStorage.removeItem(Pt),localStorage.removeItem(Vt),localStorage.removeItem(_t)}}class Ft{constructor(){this.isInitialized=!1,this.config=null,this.logger=new b(qt.getDebugMode())}getIsInitialized(){return this.isInitialized}async initialize(t){return new Promise(async(r,i)=>{try{if(this.isInitialized)return this.logger.warn("SDK já foi inicializado"),r();this.logger=new b(qt.getDebugMode()),this.config=e.applyDefaults(t),this.logger.info("Inicializando SDK..."),qt.saveConfig(t),await this.preloadScripts(),this.isInitialized=!0,this.logger.info("SDK inicializado com sucesso!"),r()}catch(e){this.logger.error("Erro ao inicializar SDK:",e),i(e)}})}async setUserId(e,t){return new Promise(async(r,i)=>{if(!this.isInitialized)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));try{this.logger.debug("Definindo userId:",e),qt.saveUserData(e,t),ae(e),this.logger.info("UserId definido com sucesso"),r()}catch(e){this.logger.error("Erro ao definir userId:",e),i(e)}})}async getUserId(){return new Promise(async(e,t)=>{if(!this.isInitialized)return this.logger.error("SDK não foi inicializado"),t(new Error("SDK não foi inicializado"));try{const t=qt.getUserData();e(t?.userId||"")}catch(e){this.logger.error("Erro ao obter userId:",e),t(e)}})}async getUserData(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{return qt.getUserData()}catch(e){throw this.logger.error("Erro ao obter dados do usuário:",e),e}}async setCustomHeaders(e){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{qt.saveCustomHeaders(e),this.logger.info("Headers customizados definidos com sucesso")}catch(e){throw this.logger.error("Erro ao definir headers customizados:",e),e}}async removeCustomHeaders(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{qt.removeCustomHeaders(),this.logger.info("Headers customizados removidos com sucesso")}catch(e){throw this.logger.error("Erro ao remover headers customizados:",e),e}}async getCustomHeaders(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{return qt.getCustomHeaders()}catch(e){throw this.logger.error("Erro ao obter headers customizados:",e),e}}getConfig(){return this.config}async clearAll(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{qt.clearAll(),this.isInitialized=!1,this.config=null,this.logger.info("Todas as configurações foram limpas")}catch(e){throw this.logger.error("Erro ao limpar configurações:",e),e}}async preloadScripts(){try{window.google&&window.google.ima&&window.google.ima.AdsLoader||await J(this.config?.proxyExternalScripts||!1),window.googletag||await X(this.config?.proxyExternalScripts||!1);if(!!(this.config?.luminaToken&&this.config.luminaToken.trim().length>0)&&(!window.adsbylumina||!window.__luminaBasecodeReady__)){const t=e.getLuminaToken(this.config);await Z({token:t,debug:qt.getDebugMode()},this.config?.proxyExternalScripts||!1)}}catch(e){this.logger.warn("Erro ao pré-carregar scripts (não crítico):",e)}}getDebugInfo(){return{isInitialized:this.isInitialized,debugMode:qt.getDebugMode(),config:this.config,userData:qt.getUserData(),customHeaders:qt.getCustomHeaders(),scriptsLoaded:{ima:!!(window.google&&window.google.ima&&window.google.ima.AdsLoader),gpt:!!window.googletag,lumina:!(!window.adsbylumina||!window.__luminaBasecodeReady__)},version:le()}}}class Bt{constructor(){this.cachedDeviceInfo=null,this.logger=new b(qt.getDebugMode())}async getDeviceContext(){if(this.cachedDeviceInfo)return this.cachedDeviceInfo;try{const e={},t=qt.getConfig();t?.appId&&(e.appId=t.appId),t?.appVersion&&(e.appVersion=t.appVersion),e.deviceId=this.getDeviceId(),e.sdkVersion=this.getSdkVersion(),e.brand=this.getBrowserBrand(),e.hardware=this.getHardwareInfo(),e.manufacturer=this.getManufacturer(),e.model=this.getModel(),e.product=this.getProduct(),e.osVersion=this.getOSVersion(),e.os="WEB",e.eventDate=Date.now().toString(),e.userAgent=navigator.userAgent,e.language=navigator.language,e.platform=navigator.platform,e.screenWidth=screen.width.toString(),e.screenHeight=screen.height.toString(),e.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone;const[r,i]=await Promise.allSettled([this.getLocation(),this.getAdId()]);return"fulfilled"===r.status&&r.value&&(e.lat=r.value.latitude.toString(),e.long=r.value.longitude.toString()),"fulfilled"===i.status&&i.value&&(e.adId=i.value),this.cachedDeviceInfo=e,e}catch(e){return this.logger.error("Error getting device context:",e),this.getFallbackContext()}}getSdkVersion(){return oe()}clearCache(){this.cachedDeviceInfo=null}getBrowserInfo(){return{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,cookieEnabled:navigator.cookieEnabled.toString(),onLine:navigator.onLine.toString()}}getScreenInfo(){return{screenWidth:screen.width.toString(),screenHeight:screen.height.toString(),screenColorDepth:screen.colorDepth.toString(),screenPixelDepth:screen.pixelDepth.toString(),availWidth:screen.availWidth.toString(),availHeight:screen.availHeight.toString()}}getFallbackContext(){return{deviceId:"unknown",sdkVersion:this.getSdkVersion(),os:"WEB",eventDate:Date.now().toString()}}getDeviceId(){const e="akross_device_id";let t=localStorage.getItem(e);return t||(t=this.generateDeviceFingerprint(),localStorage.setItem(e,t)),t}generateDeviceFingerprint(){const e=document.createElement("canvas"),t=e.getContext("2d");t&&(t.textBaseline="top",t.font="14px Arial",t.fillText("Akross Device ID",2,2));const r=[navigator.userAgent,navigator.language,screen.width+"x"+screen.height,(new Date).getTimezoneOffset(),e.toDataURL()].join("|");return btoa(r).substring(0,16)}getBrowserBrand(){const e=navigator.userAgent;return e.includes("Chrome")?"Google":e.includes("Firefox")?"Mozilla":e.includes("Safari")?"Apple":e.includes("Edge")?"Microsoft":"Unknown"}getHardwareInfo(){return navigator.hardwareConcurrency?`CPU Cores: ${navigator.hardwareConcurrency}`:"Unknown"}getManufacturer(){const e=navigator.userAgent;return e.includes("Windows")?"Microsoft":e.includes("Mac")?"Apple":e.includes("Linux")?"Linux":"Unknown"}getModel(){const e=navigator.userAgent;return e.includes("Mobile")?"Mobile Device":e.includes("Tablet")?"Tablet":"Desktop"}getProduct(){return navigator.platform||"Unknown"}getOSVersion(){const e=navigator.userAgent.match(/(Windows|Mac|Linux|Android|iOS)\s+([\d.]+)/);return e?e[2]:"Unknown"}async getLocation(){return new Promise(e=>{navigator.geolocation?navigator.permissions?.query({name:"geolocation"}).then(t=>{"granted"===t.state?navigator.geolocation.getCurrentPosition(t=>{e({latitude:t.coords.latitude,longitude:t.coords.longitude})},()=>e(null),{timeout:5e3,enableHighAccuracy:!1}):e(null)}).catch(()=>{e(null)}):e(null)})}async getAdId(){return null}}let Ht=null;class Wt{constructor(e,t,r=!1){this.logger=new b(qt.getDebugMode()),this.eventsHelper=new H}async requestCampaign(e,t=1,r,i){const n=new Ot({responseStatus:c.ERROR});if("undefined"==typeof window||!window.AkrossAds)return this.logger.warn("SDK não foi inicializado"),n;{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.warn("SDK não foi inicializado"),n}const a=qt.getUserData();if(!a?.userId)return this.logger.error("Erro ao obter campanha: userId está vazio"),n;try{const s=(Ht||(Ht=new Bt),Ht),o={...await s.getDeviceContext(),...r},l=new Ut({userId:a.userId,context:o}),d=(new T).getArtemisAdsService(30,!1,!0),u=await d.requestCampaign(e,l,t,i);if(u&&u.campaigns&&u.campaigns.length>0){u.campaigns.forEach(e=>{const t=e.mainData.media.filter(e=>!e.viewed).length;e.mainData.media.forEach(r=>{if(r.campaignId=e.campaignUuid,r.campaignName=e.campaignName,r.requestId=u.requestId,r.zoneId=u.zone.uuid,r.success=e.mainData.success,r.mediasLeft=t,r.layout=e.mainData.layout,r.partnerEventUuid&&e.events){const t=e.events.find(e=>e.event?.uuid===r.partnerEventUuid);t&&(r.partnerEvent=t.event)}})});const e=new Mt({...u,campaigns:u.campaigns});n.campaignResponse=e,n.responseStatus=c.SUCCESS}else n.responseStatus=c.EMPTY}catch(e){n.error=e instanceof Error?e:new Error("Erro desconhecido"),n.responseStatus=c.ERROR,this.logger.error("Erro ao obter campanha:",e)}return n}async bannerClick(e,t,r,i){try{const n=qt.getUserData();if(!n?.userId)return void this.logger.error("Erro ao abrir URL: userId está vazio");const a=new URL(e);a.searchParams.has("userId")||a.searchParams.set("userId",n.userId),a.searchParams.has("campaignId")||a.searchParams.set("campaignId",t);const s=(new T).getArtemisAdsService(30,!1,!0);await s.sendTracking("click",t,n.userId,r,i,"banner"),window.open(a.toString(),"_blank")}catch(e){this.logger.error("Erro ao abrir URL:",e)}}async sendEvent(e,t,r,i,n){return new Promise(async(a,s)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),s(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),s(new Error("SDK não foi inicializado"))}const o=qt.getUserData();if(!o?.userId)return this.logger.error("UserId não encontrado"),s(new Error("UserId não encontrado"));this.logger.debug("Enviando evento:",{event:e,campaignId:t,trackingId:r,mediaId:i,source:n}),await this.eventsHelper.sendEvent(e,t,r,i,n),this.logger.info("Evento enviado com sucesso"),a()}catch(e){this.logger.error("Erro ao enviar evento:",e),s(e)}})}async sendCampaignsImpressionEvent(e,t){return new Promise(async(r,i)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"))}const n=qt.getUserData();if(!n?.userId)return this.logger.error("UserId não encontrado"),i(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de impressão para campanhas:",{trackingId:e,campaignsCount:t.length}),await this.eventsHelper.sendCampaignsImpressionEvent(e,t),this.logger.info("Eventos de impressão enviados com sucesso"),r()}catch(e){this.logger.error("Erro ao enviar eventos de impressão:",e),i(e)}})}async sendCampaignClickEvent(e,t){return new Promise(async(r,i)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"))}const n=qt.getUserData();if(!n?.userId)return this.logger.error("UserId não encontrado"),i(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de clique na campanha:",{campaignId:e,trackingId:t}),await this.eventsHelper.sendCampaignClickEvent(e,t),this.logger.info("Evento de clique na campanha enviado com sucesso"),r()}catch(e){this.logger.error("Erro ao enviar evento de clique na campanha:",e),i(e)}})}async sendSuccessImpressionEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=qt.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento success_impression:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendSuccessImpressionEvent(e,t,r),this.logger.info("Evento success_impression enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento success_impression:",e),n(e)}})}async sendMediaClickEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=qt.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de clique na mídia:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendMediaClickEvent(e,t,r),this.logger.info("Evento de clique na mídia enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento de clique na mídia:",e),n(e)}})}async sendClickThroughEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=qt.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento clickthrough:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendClickThroughEvent(e,t,r),this.logger.info("Evento clickthrough enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento clickthrough:",e),n(e)}})}static getSdkVersion(){return oe()}}class zt{constructor(e){if(this.logger=new b(qt.getDebugMode()),"string"==typeof e){const t=document.querySelector(e);if(!t)throw new Error(`Elemento não encontrado: ${e}`);this.containerElement=t}else this.containerElement=e;this.imageElement=document.createElement("img"),this.imageElement.style.display="block",this.containerElement.innerHTML=""}setClickListener(e){this.clickListener=e}setMediaClickHandler(e){this.mediaClickHandler=e}setSuccessListener(e){this.successListener=e}setErrorListener(e){this.errorListener=e}async loadZone(e,t){try{const r=qt.getUserData();if(!r?.userId)return this.logger.error("Erro ao carregar banner: userId está vazio"),void this.errorListener?.onError();const i=new Wt,n=await i.requestCampaign(e,1,void 0,t);if(!n.campaignResponse?.campaigns?.length)return this.logger.error("Nenhuma campanha encontrada para a zona:",e),void this.errorListener?.onError();const a=n.campaignResponse.campaigns[0].mainData.media[0];if(a.type!==d.BANNER)return this.logger.error("Tipo de mídia não suportado para banner:",a.type),void this.errorListener?.onError();this.containerElement.appendChild(this.imageElement),await this.loadBanner(a)}catch(e){this.logger.error("Erro ao carregar banner:",e),this.errorListener?.onError()}}async loadBanner(e){try{if(!e.content?.url)return this.logger.error("Erro ao carregar banner: URL da imagem não encontrada"),void this.errorListener?.onError();this.containerElement.appendChild(this.imageElement),await this.loadImage(e.content.url,e)}catch(e){this.logger.error("Erro ao carregar banner:",e),this.errorListener?.onError()}}async loadImage(e,t){try{const r=qt.getUserData();if(!r?.userId)return this.logger.error("Erro ao carregar banner: userId não encontrado nas preferences"),this.removeImageFromDOM(),void this.errorListener?.onError();const i=r.userId,n=await fetch(e,{method:"GET",mode:"cors",cache:"default"});if(!n.ok)return this.logger.error(`Erro ao carregar imagem: ${n.status} ${n.statusText}`),this.removeImageFromDOM(),void this.errorListener?.onError();const a=await n.blob(),s=URL.createObjectURL(a);this.imageElement.src=s,this.imageElement.alt=t.title||"Banner",this.imageElement.onload=()=>{this.applyOptimizedFit()},this.imageElement.onerror=()=>{this.logger.error("Erro ao carregar imagem: falha no carregamento da imagem"),this.removeImageFromDOM(),this.errorListener?.onError()};(new H).sendImpressedEvent(t.campaignId,t.requestId,t.uuid),this.successListener?.onSuccess(t.analytics?.impression),this.setupClickHandler(t,i)}catch(e){this.logger.error("Erro ao carregar imagem:",e),this.removeImageFromDOM(),this.errorListener?.onError()}}removeImageFromDOM(){try{this.imageElement&&this.imageElement.parentNode&&this.imageElement.parentNode.removeChild(this.imageElement)}catch(e){this.logger.error("Erro ao remover imagem do DOM:",e)}}applyOptimizedFit(){try{this.containerElement.style.display="flex",this.containerElement.style.alignItems="center",this.containerElement.style.justifyContent="center",this.imageElement.style.maxWidth="100%",this.imageElement.style.maxHeight="100%",this.imageElement.style.objectFit="contain",this.imageElement.style.objectPosition="center",this.logger.debug("Fit simples aplicado com flexbox")}catch(e){this.logger.error("Erro ao aplicar fit simples:",e),this.imageElement.style.width="100%",this.imageElement.style.height="auto",this.imageElement.style.objectFit="contain"}}setupClickHandler(e,t){const r=e.externalUrl?.url||e.success?.url,i=!!this.mediaClickHandler;(i||r)&&(this.imageElement.style.cursor="pointer",this.imageElement.addEventListener("click",()=>{if(this.clickListener?.onClick(e.analytics?.click),i){const t=new Rt(e);return void Promise.resolve(this.mediaClickHandler(t)).catch(e=>this.logger.error("Erro no mediaClickHandler do banner:",e))}this.executeBannerClick(r,e,t)}))}async executeBannerClick(e,t,r){try{const r=t.campaignId||t.campaignUuid;if(!r)return void this.logger.error("Erro ao executar clique: campaignId não encontrado na mídia");const i=new H;i.sendMediaClickEvent(r,t.requestId,t.uuid),i.sendClickThroughEvent(r,t.requestId,t.uuid),window.open(e,"_blank","noopener,noreferrer")}catch(e){this.logger.error("Erro ao executar clique do banner:",e)}}destroy(){this.campaignCall&&(this.campaignCall=void 0),this.imageElement.removeEventListener("click",()=>{}),this.containerElement&&(this.containerElement.innerHTML="")}}class Kt{constructor(e){this.config={timeout:1e4,debug:!1,...e},this.logger=new b(this.config.debug),this.sdkManager=new Ft,this.adsManager=new Wt(this.config.appId,this.config.appVersion,this.config.debug),qt.setDebugMode(this.config.debug||!1),this.logger.debug("Debug mode salvo via PreferencesUtil:",this.config.debug||!1),this.logger.info("SDK Akross Artemis Ads criado"),this.logger.debug("Configuração:",this.config)}async initialize(){return this.sdkManager.initialize(this.config)}isInitialized(){return this.sdkManager.getIsInitialized()}async setUserId(e,t){return this.sdkManager.setUserId(e,t)}async getUserId(){return this.sdkManager.getUserId()}async getUserData(){return this.sdkManager.getUserData()}async setCustomHeaders(e){return this.sdkManager.setCustomHeaders(e)}async removeCustomHeaders(){return this.sdkManager.removeCustomHeaders()}async getCustomHeaders(){return this.sdkManager.getCustomHeaders()}getConfig(){return this.sdkManager.getConfig()}async clearAll(){return this.sdkManager.clearAll()}getDebugInfo(){return this.sdkManager.getDebugInfo()}getVersion(){return oe()}getVersionInfo(){return le()}async sendEvent(e,t,r,i,n){return this.adsManager.sendEvent(e,t,r,i,n)}async sendCampaignsImpressionEvent(e,t){return this.adsManager.sendCampaignsImpressionEvent(e,t)}async sendCampaignClickEvent(e,t){return this.adsManager.sendCampaignClickEvent(e,t)}async sendSuccessImpressionEvent(e,t,r){return this.adsManager.sendSuccessImpressionEvent(e,t,r)}async sendMediaClickEvent(e,t,r){return this.adsManager.sendMediaClickEvent(e,t,r)}async sendClickThroughEvent(e,t,r){return this.adsManager.sendClickThroughEvent(e,t,r)}async requestCampaign(e,t,r,i){return this.logger.debug("Solicitando campanhas para zona:",e),this.adsManager.requestCampaign(e,t||1,r,i)}async bannerClick(e,t,r,i){return this.logger.debug("Processando clique em banner:",{campaignId:t,mediaId:i}),this.adsManager.bannerClick(e,t,r,i)}}let Gt=null;async function jt(e){return Gt||(Gt=new Kt(e),await Gt.initialize(),Gt)}function $t(){return Gt}function Yt(){Gt&&(Gt.clearAll(),Gt=null,"undefined"!=typeof window&&delete window.AkrossAds)}"undefined"!=typeof window&&(window.AkrossAds={init:jt,getInstance:$t,destroy:Yt,SDK:Kt,AAManager:Ft,AdsManager:Wt,VERSION:ce,VERSION_INFO:de,getVersion:oe,getVersionInfo:le,AAMedia:Rt,AACampaign:Nt,AACampaignResponse:Mt,AACampaignResult:Ot,AAZone:xt,AAMainData:It,AAContent:E,AASuccess:y,AABenefitOffer:Ct,AAAdWatchResult:w,AAVastPlayer:dt,AARewardedVideoHandler:yt,AAEventsCallbackHelper:H,AARvEventsCallbackHelper:z,AAMediaResultHelper:$,PreferencesUtil:qt,GlobalLoadingOverlay:re,ArtemisAdsBannerLoader:zt});export{w as AAAdWatchResult,At as AABanner,Ct as AABenefitOffer,Nt as AACampaign,l as AACampaignConfig,Ut as AACampaignRequest,Mt as AACampaignResponse,c as AACampaignResponseStatus,Ot as AACampaignResult,E as AAContent,g as AAError,Lt as AAEvent,Dt as AAEventBenefit,St as AAEventDetail,H as AAEventsCallbackHelper,Tt as AAHeader,kt as AALayout,It as AAMainData,Ft as AAManager,Rt as AAMedia,u as AAMediaPlayResult,$ as AAMediaResultHelper,d as AAMediaTypes,m as AAProgrammatic,yt as AARewardedVideo,z as AARvEventsCallbackHelper,y as AASuccess,f as AASurveyV2,dt as AAVastPlayer,j as AAVastTrackingEvents,xt as AAZone,Wt as AdsManager,Kt as AkrossAdsSDK,zt as ArtemisAdsBannerLoader,S as CAMPAIGN_CLICK_EVENT,C as CLICK_EVENT,e as ConfigUtils,P as ERROR_EVENT,G as ERROR_MESSAGES,mt as GAMRewardedVideoWrapper,k as IMPRESSION_EVENT,b as Logger,vt as LuminaRewardedVideoWrapper,O as NO_FILL_EVENT,M as PROGRAMMATIC_ERROR,x as PROGRAMMATIC_FALLBACK_REQ,U as PROGRAMMATIC_SKIPPED,N as PROG_CONN_ERROR_EVENT,qt as PreferencesUtil,I as SUCCESS_IMPRESSION_EVENT,ht as StepResult,t as UserDataCache,ce as VERSION,de as VERSION_INFO,D as VPAID_COMPLETE_EVENT,_ as VPAID_FIRST_QUARTILE_EVENT,q as VPAID_MIDPOINT_EVENT,B as VPAID_SKIPPED_EVENT,V as VPAID_START_EVENT,F as VPAID_THIRD_QUARTILE_EVENT,L as WATERFALL_START_EVENT,gt as WaterfallResultHelper,se as applyGPTPpidIfEnabled,W as createAAEventsCallbackHelper,Y as createAAMediaResultHelper,wt as createAARewardedVideoHandler,K as createAARvEventsCallbackHelper,ut as createAAVastPlayer,ft as createGAMRewardedVideoWrapper,Et as createLuminaRewardedVideoWrapper,pt as createWaterfallResultHelper,Yt as destroy,o as getDeviceType,$t as getInstance,oe as getVersion,le as getVersionInfo,jt as init,i as isAndroid,s as isDesktop,ie as isGPTPpidEnabled,r as isIOS,h as isMediaTypeSupported,a as isMobile,n as isTablet,ne as isValidPPID,X as loadGPTScript,J as loadIMAScript,Z as loadLuminaScript,ae as setGPTPublisherProvidedId};