vendor: 1,274 bytes, lines 1-9
1/*! 2 * jQuery UI Tooltip 1.14.2 3 * https://jqueryui.com 4 * 5 * Copyright OpenJS Foundation and other contributors 6 * Released under the MIT license. 7 * https://jquery.org/license 8 */ 9!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","../keycode","../position","../unique-id","../version","../widget"],t):t(jQuery)}(function(r){"use strict";return r.widget("ui.tooltip",{version:"1.14.2",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var t=r(this).attr("title");return r("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var e=(t.attr("aria-describedby")||"").split(/\s+/);e.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",String.prototype.trim.call(e.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),e=(t.attr("aria-describedby")||"").split(/\s+/),i=r.inArray(i,e);-1!==i&&e.splice(i,1),t.removeData("ui-tooltip-id"),(e=String.prototype.trim.call(e.join(" ")))?t.attr("aria-describedby",e):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={}
vendor: 6,331 bytes, lines 9-52
9,this.liveRegion=r("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=r([])},_setOption:function(t,i){var e=this;this._super(t,i),"content"===t&&r.each(this.tooltips,function(t,i){e._updateContent(i.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var o=this;r.each(this.tooltips,function(t,i){var e=r.Event("blur");e.target=e.currentTarget=i.element[0],o.close(e,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var t=r(this);if(t.is("[title]"))return t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")}))},_enable:function(){this.disabledTitles.each(function(){var t=r(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))}),this.disabledTitles=r([])},open:function(t){var e=this,i=r(t?t.target:this.element).closest(this.options.items);i.length&&!i.data("ui-tooltip-id")&&(i.attr("title")&&i.data("ui-tooltip-title",i.attr("title")),i.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&i.parents().each(function(){var t,i=r(this);i.data("ui-tooltip-open")&&((t=r.Event("blur")).target=t.currentTarget=this,e.close(t,!0)),i.attr("title")&&(i.uniqueId(),e.parents[this.id]={element:this,title:i.attr("title")},i.attr("title",""))}),this._registerCloseHandlers(t,i),this._updateContent(i,t))},_updateContent:function(i,e){var t=this.options.content,o=this,n=e?e.type:null;if("string"==typeof t||t.nodeType||t.jquery)return this._open(e,i,t);(t=t.call(i[0],function(t){i.data("ui-tooltip-open")&&(e&&(e.type=n),o._open(e,i,t))}))&&this._open(e,i,t)},_open:function(t,i,e){var o,n,s,l=r.extend({},this.options.position);function a(t){l.of=t,o.is(":hidden")||o.position(l)}e&&((s=this._find(i))?s.tooltip.find(".ui-tooltip-content").html(e):(i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),s=this._tooltip(i),o=s.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(e),this.liveRegion.children().hide(),(s=r("<div>").html(o.find(".ui-tooltip-content").html())).removeAttr("name").find("[name]").removeAttr("name"),s.removeAttr("id").find("[id]").removeAttr("id"),s.appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:a}),a(t)):o.position(r.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(n=this.delayedShow=setInterval(function(){o.is(":visible")&&(a(l.of),clearInterval(n))},13)),this._trigger("open",t,{tooltip:o})))},_registerCloseHandlers:function(t,i){var e={keyup:function(t){t.keyCode===r.ui.keyCode.ESCAPE&&((t=r.Event(t)).currentTarget=i[0],this.close(t,!0))}};i[0]!==this.element[0]&&(e.remove=function(){var t=this._find(i);t&&this._removeTooltip(t.tooltip)}),t&&"mouseover"!==t.type||(e.mouseleave="close"),t&&"focusin"!==t.type||(e.focusout="close"),this._on(!0,i,e)},close:function(t){var i,e=this,o=r(t?t.currentTarget:this.element),n=this._find(o);n?(i=n.tooltip,n.closing||(clearInterval(this.delayedShow),o.data("ui-tooltip-title")&&!o.attr("title")&&o.attr("title",o.data("ui-tooltip-title")),this._removeDescribedBy(o),n.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){e._removeTooltip(r(this))}),o.removeData("ui-tooltip-open"),this._off(o,"mouseleave focusout keyup"),o[0]!==this.element[0]&&this._off(o,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&r.each(this.parents,function(t,i){r(i.element).attr("title",i.title),delete e.parents[t]}),n.closing=!0,this._trigger("close",t,{tooltip:i}),n.hiding)||(n.closing=!1)):o.removeData("ui-tooltip-open")},_tooltip:function(t){var i=r("<div>").attr("role","tooltip"),e=r("<div>").appendTo(i),o=i.uniqueId().attr("id");return this._addClass(e,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(t)),this.tooltips[o]={element:t,tooltip:i}},_find:function(t){t=t.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(t){clearInterval(this.delayedShow),t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){t=t.closest(".ui-front, dialog");return t=t.length?t:this.document[0].body},_destroy:function(){var o=this;r.each(this.tooltips,function(t,i){var e=r.Event("blur"),i=i.element;e.target=e.currentTarget=i[0],o.close(e,!0),r("#"+t).remove(),i.data("ui-tooltip-title")&&(i.attr("title")||i.attr("title",i.data("ui-tooltip-title")),i.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!0===r.uiBackCompat&&r.widget("ui.tooltip",r.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),r.ui.tooltip});; 10var videoNotLoaded = 0; 11var imgError; 12var reloadVideoInterval; 13var jsonData = {}; 14var uppy; 15 16(function ($) { 17 "use strict"; 18 19 var ajaxurl = oaInfo.ajax_url; 20 var partials = oaInfo.partials; 21 var i = 0; 22 23 var environment = 24 window.location.hostname.search("dev.obituary-assistant.com") >= 0 25 ? "dev" 26 : "prod"; 27 28 /* --- Environment resolver (reads PHP hidden input) --- */ 29 function getEnvironment() { 30 var env = 31 window.location.hostname.indexOf("dev.obituary-assistant.com") >= 0 32 ? "dev" 33 : "prod"; 34 try { 35 var el = document.getElementById("oaEnvFromPhp"); // <input id="oaEnvFromPhp" value="dev|prod"> 36 var v = ((el && el.value) || "").toLowerCase(); 37 if (v === "dev" || v === "prod") env = v; 38 } catch (e) {} 39 return env; 40 } 41 environment = getEnvironment(); 42 43 var getCdnUrl = function (s3Url, filter) { 44 if (!s3Url) return ""; 45 try { 46 var u = new URL(s3Url); // e.g. https://obituary-assistant.s3.us-west-2.amazonaws.com/incoming/dev/2/3835/....png 47 var path = u.pathname.replace(/^\/+/, ""); // incoming/dev/2/3835/....png 48 if (path.toLowerCase().indexOf("incoming/") === 0) { 49 path = path.substring("incoming/".length); // dev/2/3835/....png 50 } 51 var base = "https://cdn.obituary-assistant.com"; 52 if (filter) base += filter; // preserve your optional filter handling
53 return base + "/" + path; // https://cdn....com/dev/2/3835/....png 54 } catch (e) { 55 // fallback to old replace behavior (works if input is exactly the s3 host string) 56 var out = s3Url.replace( 57 "https://obituary-assistant.s3.us-west-2.amazonaws.com/incoming/", 58 "https://cdn.obituary-assistant.com/" 59 ); 60 if (filter) { 61 // if caller passed a filter like "/filters:strip_exif()", keep it before the path 62 out = out.replace( 63 "https://cdn.obituary-assistant.com/", 64 "https://cdn.obituary-assistant.com" + filter + "/" 65 ); 66 } 67 return out; 68 } 69 }; 70 71 /* --- Visual toast polyfill (no deps) --- */ 72 (function () { 73 // Use toastr if it's on the page 74 if (typeof window.toastr !== "undefined") { 75 window.safeToast = function (msg, type) { 76 var t = (type || "info").toLowerCase(); 77 if (typeof toastr[t] === "function") toastr[t](String(msg || "")); 78 else toastr.info(String(msg || "")); 79 }; 80 window.safeToast._ui = "toastr"; 81 return; 82 } 83 84 // Install minimal CSS + container once 85 if (!document.getElementById("oa-toast-css")) { 86 var css = document.createElement("style"); 87 css.id = "oa-toast-css"; 88 css.textContent = ` 89#oa-toast-container{position:fixed;top:16px;right:16px;z-index:999999;display:flex;flex-direction:column;gap:8px;pointer-events:none} 90.oa-toast{min-width:240px;max-width:420px;padding:10px 12px;border-radius:8px;color:#fff;font:14px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial,sans-serif;box-shadow:0 8px 24px rgba(0,0,0,.18);opacity:.98;transform:translateY(0);transition:transform .2s ease,opacity .3s ease;pointer-events:auto} 91.oa-toast.oa-hide{opacity:0;transform:translateY(-6px)} 92.oa-info{background:#2563eb} 93.oa-success{background:#16a34a} 94.oa-warning{background:#d97706} 95.oa-error{background:#dc2626} 96`; 97 document.head.appendChild(css); 98 } 99 if (!document.getElementById("oa-toast-container")) { 100 var c = document.createElement("div"); 101 c.id = "oa-toast-container"; 102 document.body.appendChild(c); 103 } 104 var container = document.getElementById("oa-toast-container"); 105 106 window.safeToast = function (msg, type, timeout) { 107 var t = (type || "info").toLowerCase(); 108 var life = Math.max(1500, Number(timeout || 4000)); 109 var el = document.createElement("div"); 110 el.className = 111 "oa-toast oa-" + 112 ({ 113 info: "info", 114 success: "success", 115 warning: "warning", 116 error: "error", 117 }[t] || "info"); 118 el.textContent = String(msg || ""); 119 container.appendChild(el); 120 121 // auto-dismiss 122 setTimeout(function () { 123 el.classList.add("oa-hide"); 124 setTimeout(function () { 125 el.remove(); 126 }, 400); 127 }, life); 128 }; 129 window.safeToast._ui = "inline"; 130 })(); 131 132 // --- toasts (safe wrapper -> delegates to visual toast) --- 133 function safeToast(msg, type) { 134 // Prefer our visual toast polyfill if present 135 if (typeof window.safeToast === "function") { 136 return window.safeToast(msg, type); 137 } 138 // Fallbacks (rare): global toastr or console 139 try { 140 if ( 141 typeof toastr !== "undefined" && 142 typeof toastr[(type || "info").toLowerCase()] === "function" 143 ) { 144 return toastr[(type || "info").toLowerCase()](String(msg || "")); 145 } 146 } catch (e) {} 147 try { 148 console[type === "error" ? "error" : type === "warning" ? "warn" : "log"]( 149 "[toast:" + (type || "info") + "] " + msg 150 ); 151 } catch (e) {} 152 } 153 154 // add this helper near your other small helpers 155 async function sha256Base64FromBlob(blob) { 156 const buf = await blob.arrayBuffer(); 157 const hash = await crypto.subtle.digest("SHA-256", buf); 158 const bytes = new Uint8Array(hash); 159 let s = ""; 160 for (const b of bytes) s += String.fromCharCode(b); 161 return btoa(s); 162 } 163 164 // === CRC32 helper for S3 checksum header (Option A) === 165 var __crcTable; 166 function crc32Base64FromBlob(blob) { 167 return blob.arrayBuffer().then(function (buf) { 168 if (!__crcTable) { 169 __crcTable = new Uint32Array(256); 170 for (var n = 0; n < 256; n++) { 171 var c = n; 172 for (var k = 0; k < 8; k++) { 173 c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1; 174 } 175 __crcTable[n] = c >>> 0; 176 } 177 } 178 var crc = 0 ^ -1; 179 var u8 = new Uint8Array(buf); 180 for (var i = 0; i < u8.length; i++) { 181 crc = (__crcTable[(crc ^ u8[i]) & 0xff] ^ (crc >>> 8)) >>> 0; 182 } 183 crc = (crc ^ -1) >>> 0; 184 // convert to big-endian 4-byte array, then base64 185 var b = new Uint8Array([ 186 (crc >>> 24) & 255, 187 (crc >>> 16) & 255, 188 (crc >>> 8) & 255, 189 crc & 255, 190 ]); 191 var s = ""; 192 for (var j = 0; j < 4; j++) s += String.fromCharCode(b[j]); 193 return btoa(s); 194 }); 195 } 196 197 async function ajaxStartScanByPhotoId(file, photoId) { 198 const payload = { 199 photoId: Number(photoId) || 0, 200 s3_url: file.s3Url, 201 content_type: file.type || "application/octet-stream", 202 content_length: file.size || 0, 203 metadata: { 204 obitId: file.obitId || 0, 205 width: file.width || 0, 206 height: file.height || 0, 207 name: file.name || "", 208 }, 209 }; 210 211 const params = new URLSearchParams({ 212 action: "oa_scan_start", 213 _ajax_nonce: (oaInfo && oaInfo.scan_nonce) || "", 214 215 // â New contract (what your handler decodes) 216 payload: JSON.stringify(payload), 217 218 // â Legacy fields (harmless; keep if older code paths still read these) 219 photoId: String(payload.photoId), 220 s3Url: payload.s3_url, 221 contentType: payload.content_type, 222 contentLength: String(payload.content_length), 223 metadata: JSON.stringify(payload.metadata), 224 }); 225 226 const res = await fetch(ajaxurl, { 227 method: "POST", 228 headers: { "content-type": "application/x-www-form-urlencoded" }, 229 body: params.toString(), // URLSearchParams safely encodes the JSON string 230 }); 231 232 const json = await res.json(); 233 if (!json.success) { 234 throw new Error((json.data && json.data.message) || "scan start failed"); 235 } 236 return json.data; 237 } 238 239 async function ajaxCheckScanByPhotoId(photoId) { 240 const params = new URLSearchParams({ 241 action: "oa_scan_check", 242 _ajax_nonce: oaInfo && oaInfo.scan_nonce ? oaInfo.scan_nonce : "", 243 photoId: String(photoId), 244 }); 245 const res = await fetch(ajaxurl, { 246 method: "POST", 247 headers: { "content-type": "application/x-www-form-urlencoded" }, 248 body: params.toString(), 249 }); 250 const json = await res.json(); 251 if (!json.success) 252 throw new Error((json.data && json.data.message) || "scan check failed"); 253 return json.data; // { status, reasons, thumbReady } 254 } 255 256 async function pollUntilReadyByPhotoId(photoId, opts) { 257 const timeoutMs = (opts && opts.timeoutMs) || 90000; 258 const intervalMs = (opts && opts.intervalMs) || 2500; 259 const start = Date.now(); 260 while (Date.now() - start < timeoutMs) { 261 const { status, reasons, thumbReady } = await ajaxCheckScanByPhotoId( 262 photoId 263 ); 264 if (status === "flagged") return { status, reasons, thumbReady: false }; 265 if (status === "error") return { status, reasons, thumbReady: false }; 266 if (status === "clean" && thumbReady) 267 return { status, reasons, thumbReady: true }; 268 await new Promise((r) => setTimeout(r, intervalMs)); 269 } 270 throw new Error("scan timeout"); 271 } 272 273 function escapeAttr(v) { 274 return String(v || "").replace(/["'\\]/g, "\\$&"); 275 } 276 function findPhotoIdForCdn(cdnUrl) { 277 var $el = $( 278 '#fws-gallery-container [data-url="' + escapeAttr(cdnUrl) + '"]' 279 ); 280 if (!$el.length) return null; 281 var id = 282 $el.attr("data-photo-id") || 283 $el.data("photoId") || 284 $el.attr("data-id") || 285 $el.closest("[data-photo-id]").attr("data-photo-id") || 286 ""; 287 return id ? String(id) : null; 288 } 289 290 imgError = function (image) { 291 videoNotLoaded++; 292 293 image.onerror = ""; 294 image.src = 295 "https://cdn.obituary-assistant.com/filters:strip_exif()/fit-in/150x150/filters:fill(white)/global/please_wait.png"; 296 297 if (videoNotLoaded > 0) { 298 clearInterval(reloadVideoInterval); 299 reloadVideoInterval = setInterval(function () { 300 var data = { 301 action: "refresh_photos_and_videos", 302 obit_id: $("#obit_id").val(), 303 obit_string: $("#obit_url_rewrite").val(), 304 }; 305 306 jQuery.post( 307 ajaxurl + "?_r=" + Math.random(), 308 data, 309 function (response, status) { 310 videoNotLoaded = 0; 311 $("#fws-gallery-container").html(response); 312 var counter = jQuery("#florist-one-gallery-indicators").find( 313 "a" 314 ).length; 315 $("#photo_counter").html(" (" + counter + ")"); 316 }, 317 "html" 318 ); 319 }, 60000); 320 } 321 322 return true; 323 }; 324 325 var $galleryInit = function () { 326 var fwsGalleryModal = document.getElementById("fws-gallery-modal"); 327 var fwsGallery = document.getElementById("fwsPhotosVideosCarousel"); 328 329 if (document.getElementById("fwsPhotosVideosCarousel")) { 330 fwsGalleryModal.addEventListener("show.bs.modal", function (event) {
331 $("#fws-gallery-modal").find(".modal-body").html(""); 332 var videoNum = event.relatedTarget.getAttribute("data-video-num"); 333 var slideNumber = 334 event.relatedTarget.parentElement.getAttribute("data-image-number"); 335 var thumbNailType = event.relatedTarget.parentElement.getAttribute( 336 "data-thumbnail-type" 337 ); 338 339 if (thumbNailType == "photo") { 340 $("#fws-gallery-modal") 341 .find(".modal-body") 342 .html( 343 $("#fwsPhotosVideosCarousel") 344 .find("img") 345 .eq(parseInt(slideNumber))[0].outerHTML 346 ); 347 } else { 348 $("#fws-gallery-modal") 349 .find(".modal-body") 350 .html( 351 '<div class="row">' + 352 $("#fwsPhotosVideosCarousel") 353 .find("video") 354 .eq(parseInt(videoNum)) 355 .parent()[0].outerHTML + 356 "</div>" 357 ); 358 } 359 }); 360 361 fwsGalleryModal.addEventListener("hide.bs.modal", function (event) { 362 $("video").each(function () { 363 $(this).get(0).pause(); 364 }); 365 }); 366 367 fwsGallery.addEventListener("slide.bs.carousel", function (event) { 368 $("video").each(function () { 369 $(this).get(0).pause(); 370 }); 371 372 $("#florist-one-gallery-indicators") 373 .find("a") 374 .parent() 375 .removeClass("active-img"); 376 $("#florist-one-gallery-indicators") 377 .find("a") 378 .eq(event.to) 379 .parent() 380 .addClass("active-img"); 381 }); 382 } 383 384 $("div.obituary-photo-thumbnails").on("click", "img", function () { 385 if ($(this).attr("data-type") == "video") { 386 displayFullVideo( 387 $(this).attr("data-url"), 388 $(this).attr("data-name"), 389 $(this).attr("data-description") 390 ); 391 } else { 392 displayFullImage( 393 $(this).attr("data-url"), 394 $(this).attr("data-name"), 395 $(this).attr("data-description") 396 ); 397 } 398 399 $(".obituary-photo-display-button").css("visibility", "visible"); 400 }); 401 402 var displayFullImage = function (url, name, description) { 403 var htmlString = 404 "<p align='center'><img id='main-gallery-display' src='" + 405 url + 406 "' data-imageID='" + 407 url + 408 "'></p>"; 409 $(".obituary-photo-display").html(htmlString); 410 411 displayGalleryNavigation(); 412 }; 413 414 var displayFullVideo = function (url, name, description) { 415 var htmlString = 416 "<p align='center'>" + 417 "<video controls controlsList='nodownload' poster='" + 418 url + 419 "-p-00002.png'>" + 420 "<source src='" + 421 url + 422 ".mp4' type='video/mp4'>" + 423 "<source src='" + 424 url + 425 ".ts' type='video/ts'>" + 426 "<source src='" + 427 url + 428 ".webm' type='video/webm'>" + 429 "Your browser does not support the video tag." + 430 "</video>"; 431 432 $(".obituary-photo-display").html(htmlString); 433 434 hideGalleryNavigation(); 435 }; 436 437 function loadScript(url, callback) { 438 const script = document.createElement("script"); 439 script.src = url; 440 script.type = "text/javascript"; 441 script.onload = () => { 442 console.log(`${url} loaded`); 443 if (callback) callback(); 444 }; 445 script.onerror = () => console.error(`Failed to load script: ${url}`); 446 document.head.appendChild(script); 447 } 448 449 function loadStylesheet(url) { 450 const link = document.createElement("link"); 451 link.href = url; 452 link.rel = "stylesheet"; 453 link.type = "text/css"; 454 link.onload = () => console.log(`${url} stylesheet loaded`); 455 link.onerror = () => console.error(`Failed to load stylesheet: ${url}`); 456 document.head.appendChild(link); 457 } 458 459 $("#upload_photo").click(function () { 460 if ($getLogin() == 0) { 461 //$(".login").trigger("click"); 462 } else { 463 if (typeof uppy !== "undefined" && uppy != null) {
464 uppy.getPlugin("Dashboard").openModal(); 465 } else { 466 loadStylesheet( 467 "https://cdn.obituary-assistant.com/scripts/uppy/uppy.min.css" 468 ); 469 loadScript( 470 "https://cdn.obituary-assistant.com/scripts/uppy/uppy.js", 471 () => { 472 initializeUploadPhotoVideo(function () { 473 uppy.getPlugin("Dashboard").openModal(); 474 }); 475 } 476 ); 477 } 478 } 479 }); 480 481 var displayGalleryNavigation = function () { 482 var prevImg = $( 483 "div[class='obituary-photo-thumbnails'] img[data-url='" + 484 $("#main-gallery-display").attr("data-imageID") + 485 "']" 486 ).prev(); 487 var nextImg = $( 488 "div[class='obituary-photo-thumbnails'] img[data-url='" + 489 $("#main-gallery-display").attr("data-imageID") + 490 "']" 491 ).next(); 492 493 $(".obituary-photo-display-button.previous").css("display", "block"); 494 $(".obituary-photo-display-button.next").css("display", "block"); 495 496 if (typeof prevImg.attr("data-url") === "undefined") { 497 $(".obituary-photo-display-button.previous").addClass("placeholder"); 498 } else { 499 $(".obituary-photo-display-button.previous").removeClass("placeholder"); 500 } 501 if (typeof nextImg.attr("data-url") === "undefined") { 502 $(".obituary-photo-display-button.next").addClass("placeholder"); 503 } else { 504 $(".obituary-photo-display-button.next").removeClass("placeholder"); 505 } 506 }; 507 508 var hideGalleryNavigation = function () { 509 $(".obituary-photo-display-button.previous").css("display", "none"); 510 $(".obituary-photo-display-button.next").css("display", "none"); 511 }; 512 513 $(".obituary-photo-display-button.previous").click(function () { 514 if (!$(this).hasClass("placeholder")) { 515 var prevImg = $( 516 "div[class='obituary-photo-thumbnails'] img[data-url='" + 517 $("#main-gallery-display").attr("data-imageID") + 518 "']" 519 ).prev(); 520 displayFullImage( 521 prevImg.attr("data-url"), 522 prevImg.attr("data-name"), 523 prevImg.attr("data-description") 524 ); 525 } 526 }); 527 528 $(".obituary-photo-display-button.next").click(function () { 529 if (!$(this).hasClass("placeholder")) { 530 var nextImg = $( 531 "div[class='obituary-photo-thumbnails'] img[data-url='" + 532 $("#main-gallery-display").attr("data-imageID") + 533 "']" 534 ).next(); 535 displayFullImage( 536 nextImg.attr("data-url"), 537 nextImg.attr("data-name"), 538 nextImg.attr("data-description") 539 ); 540 } 541 }); 542 }; 543 544 var initializeUploadPhotoVideo = function (cb) { 545 // initialize uppy.io uploader 546 const AwsS3 = Uppy.AwsS3; 547 uppy = new Uppy.Uppy({ 548 id: "uppyUpload", 549 autoProceed: true, 550 restrictions: { 551 maxFileSize: 100000000, 552 maxNumberOfFiles: 20, 553 minNumberOfFiles: null, 554 allowedFileTypes: ["image/*", "video/*"], 555 }, 556 }) 557 .use(Uppy.Dashboard, { 558 target: "body", 559 inline: false, 560 trigger: ".edit_img", 561 proudlyDisplayPoweredByUppy: false, 562 closeAfterFinish: true, 563 closeModalOnClickOutside: true, 564 }) 565 .use(AwsS3, { 566 fields: [], 567 getUploadParameters: async function (file) { 568 // sanitize filename (keep your existing makeid) 569 function cleanName(name) { 570 var safe = String(name || "").replace(/[^a-zA-Z0-9_.-]+/g, ""); 571 if (safe.length > 4) return safe; 572 var ext = 573 name && name.match(/\.[0-9a-z]+$/i) 574 ? name.match(/\.[0-9a-z]+$/i)[0] 575 : ""; 576 return makeid(16) + (ext || ".dat"); 577 } 578 579 // build the same style key as the other integrations 580 var clientId = String($("#client_id").val() || "0"); 581 var obitId = String($("#obit_id").val() || "0"); 582 var filename = cleanName(file.name).replace(/\.heic$/i, ".jpg"); 583 var key = clientId + "/" + obitId + "/" + filename; 584 585 var contentType = 586 file.type && file.type.toLowerCase().includes("heic") 587 ? "image/jpeg" 588 : file.type || "application/octet-stream"; 589 590 // compute sha256 (optional for your signer) 591 var sha256 = await sha256Base64FromBlob(file.data); 592 593 // signer expects form-encoded (compatible with your existing backend) 594 const form = new URLSearchParams(); 595 form.set("key", key); 596 form.set("contentType", contentType); 597 form.set("contentLength", String(file.size || 0)); 598 form.set( 599 "metadata", 600 JSON.stringify({ 601 name: filename, 602 caption: "", 603 clientId: clientId, 604 obitId: obitId, 605 gallery: true, 606 }) 607 ); 608 // optional: sha256 if backend reads it 609 form.set("sha256", sha256); 610 611 var resp = await fetch( 612 "https://api.obituary-assistant.com/" + 613 getEnvironment() + 614 "/oa-s3-signature", 615 { 616 method: "POST", 617 headers: { "content-type": "application/x-www-form-urlencoded" }, 618 body: form.toString(), 619 } 620 ); 621 622 if (!resp.ok) { 623 var txt = ""; 624 try { 625 txt = await resp.text(); 626 } catch (_) {} 627 throw new Error("Presign failed: " + (txt || resp.status)); 628 } 629 var data = await resp.json(); // { url, key, publicKey } 630 631 try { 632 uppy.setFileMeta(file.id, { 633 serverKey: data.key || null, // 'incoming/...' 634 publicKey: data.publicKey || null, // 'dev/...' 635 }); 636 } catch (_) {} 637 638 // Only set Content-Type; don't add Content-Length/checksum headers 639 return { 640 method: "PUT", 641 url: data.url, 642 headers: { "Content-Type": contentType }, 643 }; 644 }, 645 }); 646 647 // capture width/height into meta 648 uppy.on("file-added", (file) => { 649 const data = file.data; // Blob 650 const url = URL.createObjectURL(data); 651 const image = new Image(); 652 image.src = url; 653 image.onload = () => { 654 uppy.setFileMeta(file.id, { width: image.width, height: image.height }); 655 URL.revokeObjectURL(url); 656 }; 657 }); 658 659 // After uploads succeed: ADD PHOTO first, then start scan by photoId 660 uppy.on("complete", async (result) => { 661 if (!result.successful.length) return; 662 663 const uploaded = result.successful.map((f) => { 664 const s3Url = $.trim(f.uploadURL); 665 const cdnUrl = getCdnUrl(s3Url); 666 const obitId = 667 $("#obit_id").val() || 668 document.body.getAttribute("data-obit-id") || 669 0; 670 return { 671 id: $.trim(f.id), 672 name: $.trim(f.name), 673 size: f.size, 674 type: $.trim(f.type), 675 width: f.meta && f.meta.width, 676 height: f.meta && f.meta.height, 677 s3Url, 678 cdnUrl, 679 obitId: parseInt(obitId, 10) || 0, 680 }; 681 }); 682 683 safeToast( 684 `Creating ${uploaded.length} photo${ 685 uploaded.length > 1 ? "s" : "" 686 } & scanningâ¦`, 687 "info" 688 ); 689 690 // Create â scan each file 691 for (const file of uploaded) { 692 try { 693 await startScanFlow(file); // does: oa_photo_create -> oa_scan_start -> poll -> refresh when clean 694 } catch (e) { 695 safeToast(`Scan failed for ${file.name}`, "error"); 696 try { 697 console.error(e); 698 } catch (_) {} 699 } 700 } 701 }); 702 703 cb(); 704 }; 705 706 var $getLoginVal = function (field) { 707 switch (field) { 708 case "type": 709 return $.cookie("o-s-t"); 710 case "user": 711 return $.cookie("o-s-u"); 712 case "email": 713 return $.cookie("o-s-e"); 714 } 715 }; 716 717 var $getLogin = function () { 718 if ( 719 $.cookie("o-s-t") === undefined || 720 $.cookie("o-s-u") === undefined || 721 $.cookie("o-s-e") === undefined 722 ) { 723 return 0; 724 } else { 725 return 1; 726 } 727 }; 728 729 async function ajaxPhotoCreate(file) { 730 // Build the exact structure your API expects (keyed by the Uppy file id) 731 const photosPayload = {}; 732 photosPayload[file.id] = { 733 obit_id: $("#obit_id").val(), 734 photo_name: $.trim($("#create-gallery-name").val() || ""), 735 photo_url: file.cdnUrl, // CDN URL, not S3 736 photo_description: $.trim($("#create-gallery-desc").val() || ""), 737 photo_creator: $getLoginVal("user") || "", 738 resource_type: file.type || "application/octet-stream", 739 format: file.type || "application/octet-stream", 740 }; 741 742 const params = new URLSearchParams({ 743 action: "oa_photo_create", 744 _ajax_nonce: oaInfo && oaInfo.scan_nonce ? oaInfo.scan_nonce : "", 745 obit_id: String(file.obitId || 0), 746 photos_data: JSON.stringify(photosPayload), // <- this becomes PHOTOSDATA server-side 747 }); 748 749 const res = await fetch(ajaxurl, { 750 method: "POST", 751 headers: { "content-type": "application/x-www-form-urlencoded" }, 752 body: params.toString(), 753 }); 754 const json = await res.json(); 755 if (!json.success) { 756 throw new Error( 757 (json.data && json.data.message) || "photo create failed" 758 ); 759 } 760 // Expect WP handler to return {photoId} 761 return json.data.photoId; 762 } 763 764 // Refresh only the gallery HTML + counter (no full page reload) 765 async function refreshGallerySection() { 766 return new Promise((resolve) => { 767 jQuery.post( 768 ajaxurl + "?_r=" + Math.random(), 769 { 770 action: "refresh_photos_and_videos", 771 obit_id: jQuery("#obit_id").val(), 772 obit_string: jQuery("#obit_url_rewrite").val(), 773 }, 774 function (html) { 775 jQuery("#fws-gallery-container").html(html); 776 const counter = jQuery("#florist-one-gallery-indicators").find( 777 "a" 778 ).length; 779 jQuery("#photo_counter").html(" (" + counter + ")"); 780 resolve(true); 781 }, 782 "html" 783 ); 784 }); 785 } 786 787 // ---- Toasts (polyfill) ---- 788 if (typeof window.safeToast !== "function") { 789 window.safeToast = function (msg, type) { 790 // very simple fallback; replace with your toast lib if present 791 console[type === "error" ? "error" : "log"]( 792 "[toast:" + (type || "info") + "] " + msg 793 ); 794 }; 795 } 796 797 // ---- Auto-approve detector ---- 798 function isAutoApproveEnabled() { 799 // Read from the hidden field you have on the page: 800 // <input type="hidden" id="user_content_auto_allow" name="user_content_auto_allow" value="
8000|1"> 801 var el = document.getElementById("user_content_auto_allow"); 802 if (!el) return false; // default safe: OFF if the field isn't present 803 var v = String(el.value || "") 804 .trim() 805 .toLowerCase(); 806 return v === "1" || v === "true" || v === "yes" || v === "on"; 807 } 808 809 // ---- Refresh only the gallery HTML + counter ---- 810 async function refreshGallerySection() { 811 return new Promise((resolve) => { 812 jQuery.post( 813 ajaxurl + "?_r=" + Math.random(), 814 { 815 action: "refresh_photos_and_videos", 816 obit_id: jQuery("#obit_id").val(), 817 obit_string: jQuery("#obit_url_rewrite").val(), 818 }, 819 function (html) { 820 jQuery("#fws-gallery-container").html(html); 821 const counter = jQuery("#florist-one-gallery-indicators").find( 822 "a" 823 ).length; 824 jQuery("#photo_counter").html(" (" + counter + ")"); 825 resolve(true); 826 }, 827 "html" 828 ); 829 }); 830 } 831 832 async function startScanFlow(file) { 833 // 1) create photo â get photoId 834 const photoId = await ajaxPhotoCreate(file); 835 836 // derive kind from MIME once so all toasts use it consistently 837 const mime = ( 838 (file && (file.type || file.contentType)) || 839 "" 840 ).toLowerCase(); 841 const isVideo = mime.startsWith("video/"); 842 const kind = isVideo ? "Video" : "Photo"; // Title-case for messages 843 const kindLower = isVideo ? "video" : "photo"; // lowercase for sentences 844 845 // --- Videos: no image scan/polling â just toast + light refresh 846 if (isVideo) { 847 const auto = isAutoApproveEnabled(); 848 safeToast( 849 auto 850 ? `${kind} uploaded. Processing... It will appear automatically when ready.` 851 : `${kind} uploaded. Processing... It will appear after admin approval.`, 852 auto ? "info" : "warning" 853 ); 854 await refreshGallerySection(); // surface the âprocessingâ thumb 855 return; // stop here; no scan/poll for videos 856 } 857 858 // 2) start scan (images only; this sends both photoId and legacy s3Url fields) 859 await ajaxStartScanByPhotoId(file, photoId); 860 861 // 3) poll until ready 862 const poll = async () => { 863 const q = new URLSearchParams({ 864 action: "oa_scan_check", 865 _ajax_nonce: oaInfo && oaInfo.scan_nonce ? oaInfo.scan_nonce : "", 866 photoId: String(photoId), 867 }); 868 const r = await fetch(ajaxurl, { 869 method: "POST", 870 headers: { "content-type": "application/x-www-form-urlencoded" }, 871 body: q.toString(), 872 }); 873 const j = await r.json(); 874 if (!j.success) { 875 safeToast(`Scan check failed for ${kindLower} #${photoId}`, "error"); 876 await new Promise((res) => setTimeout(res, 3000)); 877 return poll(); 878 } 879 880 const data = j.data || {}; 881 const status = (data.status || data.raw?.STATUS || "") 882 .toString() 883 .toLowerCase(); 884 const flagged = data.raw?.FLAGGED; 885 886 if (status === "flagged" || flagged === 1 || flagged === "1") { 887 safeToast(`${kind} #${photoId} was flagged`, "warning"); 888 return "flagged"; 889 } 890 if (status === "error") { 891 safeToast(`Scan error on ${kindLower} #${photoId}`, "error"); 892 return "error"; 893 } 894 if (status === "done") { 895 safeToast(`${kind} #${photoId} scanned`, "success"); 896 return "done"; 897 } 898 899 await new Promise((res) => setTimeout(res, 2500)); 900 return poll(); 901 }; 902 903 // After successful start call (we have photoId) 904 if (!isAutoApproveEnabled()) { 905 // â We already started the scan above. Just inform the user and refresh the gallery section. 906 safeToast( 907 `${kind} uploaded. Processing... It will be visible after an admin approves it.`, 908 "info" 909 ); 910 await refreshGallerySection(); 911 return; 912 } 913 914 // Auto-Approve is ON â poll for completion and refresh the gallery when done 915 const final = await poll(); 916 917 if (final === "done" || final === "flagged") { 918 // refresh only the gallery (no full page reload) 919 await refreshGallerySection(); 920 return; 921 } 922 923 // optional: handle "error" 924 if (final === "error") { 925 // keep the gallery as-is; user can retry 926 return; 927 } 928
929 // legacy path support 930 if (final === "clean") { 931 safeToast(`${kind} #${photoId} ready`, "success"); 932 jQuery.post( 933 ajaxurl + "?_r=" + Math.random(), 934 { 935 action: "refresh_photos_and_videos", 936 obit_id: $("#obit_id").val(), 937 obit_string: $("#obit_url_rewrite").val(), 938 }, 939 function (response) { 940 $("#fws-gallery-container").html(response); 941 const counter = jQuery("#florist-one-gallery-indicators").find( 942 "a" 943 ).length; 944 $("#photo_counter").html(" (" + counter + ")"); 945 }, 946 "html" 947 ); 948 } 949 } 950 951 $(document).ready(function () { 952 $galleryInit(); 953 }); 954})(jQuery); 955; 956(function () { 957 "use strict"; 958 959 function initButton() { 960 var buttonPath = document.querySelector('.smooth-back-to-top-button path, .smooth-back-to-top-button rect'); 961 962 if (!buttonPath) { 963 return; 964 } 965 966 var pathLength = buttonPath.getTotalLength(); 967 968 buttonPath.style.strokeDasharray = pathLength + ' ' + pathLength; 969 buttonPath.style.strokeDashoffset = pathLength; 970 971 var isTicking = false; 972 973 var updateButtonProgress = function () { 974 var scroll = window.scrollY; 975 var height = document.documentElement.scrollHeight - window.innerHeight; 976 977 // Calculate progress, handling division by zero if page is smaller than viewport 978 var progress = height > 0 ? pathLength - (scroll * pathLength / height) : pathLength; 979 980 buttonPath.style.strokeDashoffset = progress; 981 isTicking = false; 982 }; 983 984 var onScroll = function () { 985 if (!isTicking) { 986 window.requestAnimationFrame(updateButtonProgress); 987 isTicking = true; 988 } 989 }; 990 991 updateButtonProgress(); 992 993 // Use passive listener for better scroll performance on mobile 994 window.addEventListener('scroll', onScroll, { passive: true }); 995 } 996 997 if (document.readyState === 'loading') { 998 document.addEventListener('DOMContentLoaded', initButton); 999 } else { 1000 initButton(); 1001 } 1002})();; 1003/** 1004 * @file postscribe 1005 * @description Asynchronously write javascript, even with document.write. 1006 * @version v2.0.8 1007 * @see {@link https://krux.github.io/postscribe} 1008 * @license MIT 1009 * @author Derek Brans 1010 * @copyright 2016 Krux Digital, Inc 1011 */ 1012(function webpackUniversalModuleDefinition(root, factory) { 1013 if(typeof exports === 'object' && typeof module === 'object') 1014 module.exports = factory(); 1015 else if(typeof define === 'function' && define.amd) 1016 define([], factory); 1017 else if(typeof exports === 'object') 1018 exports["advads_postscribe"] = factory(); 1019 root["advads_
vendor: 15,628 bytes, lines 1019-1610
1019postscribe"] = factory(); 1020})(this, function() { 1021return /******/ (function(modules) { // webpackBootstrap 1022/******/ // The module cache 1023/******/ var installedModules = {}; 1024/******/ 1025/******/ // The require function 1026/******/ function __webpack_require__(moduleId) { 1027/******/ 1028/******/ // Check if module is in cache 1029/******/ if(installedModules[moduleId]) 1030/******/ return installedModules[moduleId].exports; 1031/******/ 1032/******/ // Create a new module (and put it into the cache) 1033/******/ var module = installedModules[moduleId] = { 1034/******/ exports: {}, 1035/******/ id: moduleId, 1036/******/ loaded: false 1037/******/ }; 1038/******/ 1039/******/ // Execute the module function 1040/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 1041/******/ 1042/******/ // Flag the module as loaded 1043/******/ module.loaded = true; 1044/******/ 1045/******/ // Return the exports of the module 1046/******/ return module.exports; 1047/******/ } 1048/******/ 1049/******/ 1050/******/ // expose the modules object (__webpack_modules__) 1051/******/ __webpack_require__.m = modules; 1052/******/ 1053/******/ // expose the module cache 1054/******/ __webpack_require__.c = installedModules; 1055/******/ 1056/******/ // __webpack_public_path__ 1057/******/ __webpack_require__.p = ""; 1058/******/ 1059/******/ // Load entry module and return exports 1060/******/ return __webpack_require__(0); 1061/******/ }) 1062/************************************************************************/ 1063/******/ ([ 1064/* 0 */ 1065/***/ function(module, exports, __webpack_require__) { 1066 1067 'use strict'; 1068 1069 var _postscribe = __webpack_require__(1); 1070 1071 var _postscribe2 = _interopRequireDefault(_postscribe); 1072 1073 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 1074 1075 module.exports = _postscribe2['default']; 1076 1077/***/ }, 1078/* 1 */ 1079/***/ function(module, exports, __webpack_require__) { 1080 1081 'use strict'; 1082 1083 exports.__esModule = true; 1084 1085 var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 1086 1087 exports['default'] = postscribe; 1088 1089 var _writeStream = __webpack_require__(2); 1090 1091 var _writeStream2 = _interopRequireDefault(_writeStream); 1092 1093 var _utils = __webpack_require__(4); 1094 1095 var utils = _interopRequireWildcard(_utils); 1096 1097 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 1098 1099 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 1100 1101 /** 1102 * A function that intentionally does nothing. 1103 */ 1104 function doNothing() {} 1105 1106 /** 1107 * Available options and defaults. 1108 * 1109 * @type {Object} 1110 */ 1111 var OPTIONS = { 1112 /** 1113 * Called when an async script has loaded. 1114 */ 1115 afterAsync: doNothing, 1116 1117 /** 1118 * Called immediately before removing from the write queue. 1119 */ 1120 afterDequeue: doNothing, 1121 1122 /** 1123 * Called sync after a stream's first thread release. 1124 */ 1125 afterStreamStart: doNothing, 1126 1127 /** 1128 * Called after writing buffered document.write calls. 1129 */ 1130 afterWrite: doNothing, 1131 1132 /** 1133 * Allows disabling the autoFix feature of prescribe 1134 */ 1135 autoFix: true, 1136 1137 /** 1138 * Called immediately before adding to the write queue. 1139 */ 1140 beforeEnqueue: doNothing, 1141 1142 /** 1143 * Called before writing a token. 1144 * 1145 * @param {Object} tok The token 1146 */ 1147 beforeWriteToken: function beforeWriteToken(tok) { 1148 return tok; 1149 }, 1150 1151 /** 1152 * Called before writing buffered document.write calls. 1153 * 1154 * @param {String} str The string 1155 */ 1156 beforeWrite: function beforeWrite(str) { 1157 return str; 1158 }, 1159 1160 /** 1161 * Called when evaluation is finished. 1162 */ 1163 done: doNothing, 1164 1165 /** 1166 * Called when a write results in an error. 1167 * 1168 * @param {Error} e The error 1169 */ 1170 error: function error(e) { 1171 throw new Error(e.msg); 1172 }, 1173 1174 1175 /** 1176 * Whether to let scripts w/ async attribute set fall out of the queue. 1177 */ 1178 releaseAsync: false 1179 }; 1180 1181 var nextId = 0; 1182 var queue = []; 1183 var active = null; 1184 1185 function nextStream() { 1186 var args = queue.shift(); 1187 if (args) { 1188 var options = utils.last(args); 1189 1190 options.afterDequeue(); 1191 args.stream = runStream.apply(undefined, args); 1192 options.afterStreamStart(); 1193 } 1194 } 1195 1196 function runStream(el, html, options) { 1197 active = new _writeStream2['default'](el, options); 1198 1199 // Identify this stream. 1200 active.id = nextId++; 1201 active.name = options.name || active.id; 1202 postscribe.streams[active.name] = active; 1203 1204 // Override document.write. 1205 var doc = el.ownerDocument; 1206 1207 var stash = { 1208 close: doc.close, 1209 open: doc.open, 1210 write: doc.write, 1211 writeln: doc.writeln 1212 }; 1213 1214 function _write(str) { 1215 str = options.beforeWrite(str); 1216 active.write(str); 1217 options.afterWrite(str); 1218 } 1219 1220 _extends(doc, { 1221 close: doNothing, 1222 open: doNothing, 1223 write: function write() { 1224 for (var _len = arguments.length, str = Array(_len), _key = 0; _key < _len; _key++) { 1225 str[_key] = arguments[_key]; 1226 } 1227 1228 return _write(str.join('')); 1229 }, 1230 writeln: function writeln() { 1231 for (var _len2 = arguments.length, str = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 1232 str[_key2] = arguments[_key2]; 1233 } 1234 1235 return _write(str.join('') + '\n'); 1236 } 1237 }); 1238 1239 // Override window.onerror 1240 var oldOnError = active.win.onerror || doNothing; 1241 1242 // This works together with the try/catch around WriteStream::insertScript 1243 // In modern browsers, exceptions in tag scripts go directly to top level 1244 active.win.onerror = function (msg, url, line) { 1245 options.error({ msg: msg + ' - ' + url + ': ' + line }); 1246 oldOnError.apply(active.win, [msg, url, line]); 1247 }; 1248 1249 // Write to the stream 1250 active.write(html, function () { 1251 // restore document.write 1252 _extends(doc, stash); 1253 1254 // restore window.onerror 1255 active.win.onerror = oldOnError; 1256 1257 options.done(); 1258 active = null; 1259 nextStream(); 1260 }); 1261 1262 return active; 1263 } 1264 1265 function postscribe(el, html, options) { 1266 if (utils.isFunction(options)) { 1267 options = { done: options }; 1268 } else if (options === 'clear') { 1269 queue = []; 1270 active = null; 1271 nextId = 0; 1272 return; 1273 } 1274 1275 options = utils.defaults(options, OPTIONS); 1276 1277 // id selector 1278 if (/^#/.test(el)) { 1279 el = window.document.getElementById(el.substr(1)); 1280 } else { 1281 el = el.jquery ? el[0] : el; 1282 } 1283 1284 var args = [el, html, options]; 1285 1286 el.postscribe = { 1287 cancel: function cancel() { 1288 if (args.stream) { 1289 args.stream.abort(); 1290 } else { 1291 args[1] = doNothing; 1292 } 1293 } 1294 }; 1295 1296 options.beforeEnqueue(args); 1297 queue.push(args); 1298 1299 if (!active) { 1300 nextStream(); 1301 } 1302 1303 return el.postscribe; 1304 } 1305 1306 _extends(postscribe, { 1307 // Streams by name. 1308 streams: {}, 1309 // Queue of streams. 1310 queue: queue, 1311 // Expose internal classes. 1312 WriteStream: _writeStream2['default'] 1313 }); 1314 1315/***/ }, 1316/* 2 */ 1317/***/ function(module, exports, __webpack_require__) { 1318 1319 'use strict'; 1320 1321 exports.__esModule = true; 1322 1323 var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 1324 1325 var _prescribe = __webpack_require__(3); 1326 1327 var _prescribe2 = _interopRequireDefault(_prescribe); 1328 1329 var _utils = __webpack_require__(4); 1330 1331 var utils = _interopRequireWildcard(_utils); 1332 1333 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 1334 1335 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 1336 1337 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1338 1339 /** 1340 * Turn on to debug how each chunk affected the DOM. 1341 * @type {boolean} 1342 */ 1343 var DEBUG_CHUNK = false; 1344 1345 /** 1346 * Prefix for data attributes on DOM elements. 1347 * @type {string} 1348 */ 1349 var BASEATTR = 'data-ps-'; 1350 1351 /** 1352 * ID for the style proxy 1353 * @type {string} 1354 */ 1355 var PROXY_STYLE = 'ps-style'; 1356 1357 /** 1358 * ID for the script proxy 1359 * @type {string} 1360 */ 1361 var PROXY_SCRIPT = 'ps-script'; 1362 1363 /** 1364 * Get data attributes 1365 * 1366 * @param {Object} el The DOM element. 1367 * @param {String} name The attribute name. 1368 * @returns {String} 1369 */ 1370 function getData(el, name) { 1371 var attr = BASEATTR + name; 1372 1373 var val = el.getAttribute(attr); 1374 1375 // IE 8 returns a number if it's a number 1376 return !utils.existy(val) ? val : String(val); 1377 } 1378 1379 /** 1380 * Set data attributes 1381 * 1382 * @param {Object} el The DOM element. 1383 * @param {String} name The attribute name. 1384 * @param {null|*} value The attribute value. 1385 */ 1386 function setData(el, name) { 1387 var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 1388 1389 var attr = BASEATTR + name; 1390 1391 if (utils.existy(value) && value !== '') { 1392 el.setAttribute(attr, value); 1393 } else { 1394 el.removeAttribute(attr); 1395 } 1396 } 1397 1398 /** 1399 * Stream static html to an element, where "static html" denotes "html 1400 * without scripts". 1401 * 1402 * This class maintains a *history of writes devoid of any attributes* or 1403 * "proxy history". 1404 * 1405 * Injecting the proxy history into a temporary div has no side-effects, 1406 * other than to create proxy elements for previously written elements. 1407 * 1408 * Given the `staticHtml` of a new write, a `tempDiv`'s innerHTML is set to 1409 * `proxy_history + staticHtml`. 1410 * The *structure* of `tempDiv`'s contents, (i.e., the placement of new nodes 1411 * beside or inside of proxy elements), reflects the DOM structure that would 1412 * have resulted if all writes had been squashed into a single write. 1413 * 1414 * For each descendent `node` of `tempDiv` whose parentNode is a *proxy*, 1415 * `node` is appended to the corresponding *real* element within the DOM. 1416 * 1417 * Proxy elements are mapped to *actual* elements in the DOM by injecting a 1418 * `data-id` attribute into each start tag in `staticHtml`. 1419 * 1420 */ 1421 1422 var WriteStream = function () { 1423 /** 1424 * Constructor. 1425 * 1426 * @param {Object} root The root element 1427 * @param {?Object} options The options 1428 */ 1429 function WriteStream(root) { 1430 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1431 1432 _classCallCheck(this, WriteStream); 1433 1434 this.root = root; 1435 this.options = options; 1436 this.doc = root.ownerDocument; 1437 this.win = this.doc.defaultView || this.doc.parentWindow; 1438 this.parser = new _prescribe2['default']('', { autoFix: options.autoFix }); 1439 1440 // Actual elements by id. 1441 this.actuals = [root]; 1442 1443 // Embodies the "structure" of what's been written so far, 1444 // devoid of attributes. 1445 this.proxyHistory = ''; 1446 1447 // Create a proxy of the root element. 1448 this.proxyRoot = this.doc.createElement(root.nodeName); 1449 1450 this.scriptStack = []; 1451 this.writeQueue = []; 1452 1453 setData(this.proxyRoot, 'proxyof', 0); 1454 } 1455 1456 /** 1457 * Writes the given strings. 1458 * 1459 * @param {...String} str The strings to write 1460 */ 1461 1462 1463 WriteStream.prototype.write = function write() { 1464 var _writeQueue; 1465 1466 (_writeQueue = this.writeQueue).push.apply(_writeQueue, arguments); 1467 1468 // Process writes 1469 // When new script gets pushed or pending this will stop 1470 // because new writeQueue gets pushed 1471 while (!this.deferredRemote && this.writeQueue.length) { 1472 var arg = this.writeQueue.shift(); 1473 1474 if (utils.isFunction(arg)) { 1475 this._callFunction(arg); 1476 } else { 1477 this._writeImpl(arg); 1478 } 1479 } 1480 }; 1481 1482 /** 1483 * Calls the given function. 1484 * 1485 * @param {Function} fn The function to call 1486 * @private 1487 */ 1488 1489 1490 WriteStream.prototype._callFunction = function _callFunction(fn) { 1491 var tok = { type: 'function', value: fn.name || fn.toString() }; 1492 this._onScriptStart(tok); 1493 fn.call(this.win, this.doc); 1494 this._onScriptDone(tok); 1495 }; 1496 1497 /** 1498 * The write implementation 1499 * 1500 * @param {String} html The HTML to write. 1501 * @private 1502 */ 1503 1504 1505 WriteStream.prototype._writeImpl = function _writeImpl(html) { 1506 this.parser.append(html); 1507 1508 var tok = void 0; 1509 var script = void 0; 1510 var style = void 0; 1511 var tokens = []; 1512 1513 // stop if we see a script token 1514 while ((tok = this.parser.readToken()) && !(script = utils.isScript(tok)) && !(style = utils.isStyle(tok))) { 1515 tok = this.options.beforeWriteToken(tok); 1516 1517 if (tok) { 1518 tokens.push(tok); 1519 } 1520 } 1521 1522 if (tokens.length > 0) { 1523 this._writeStaticTokens(tokens); 1524 } 1525 1526 if (script) { 1527 this._handleScriptToken(tok); 1528 } 1529 1530 if (style) { 1531 this._handleStyleToken(tok); 1532 } 1533 }; 1534 1535 /** 1536 * Write contiguous non-script tokens (a chunk) 1537 * 1538 * @param {Array<Object>} tokens The tokens 1539 * @returns {{tokens, raw, actual, proxy}|null} 1540 * @private 1541 */ 1542 1543 1544 WriteStream.prototype._writeStaticTokens = function _writeStaticTokens(tokens) { 1545 var chunk = this._buildChunk(tokens); 1546 1547 if (!chunk.actual) { 1548 // e.g., no tokens, or a noscript that got ignored 1549 return null; 1550 } 1551 1552 chunk.html = this.proxyHistory + chunk.actual; 1553 this.proxyHistory += chunk.proxy; 1554 this.proxyRoot.innerHTML = chunk.html; 1555 1556 if (DEBUG_CHUNK) { 1557 chunk.proxyInnerHTML = this.proxyRoot.innerHTML; 1558 } 1559 1560 this._walkChunk(); 1561 1562 if (DEBUG_CHUNK) { 1563 chunk.actualInnerHTML = this.root.innerHTML; 1564 } 1565 1566 return chunk; 1567 }; 1568 1569 /** 1570 * Build a chunk. 1571 * 1572 * @param {Array<Object>} tokens The tokens to use. 1573 * @returns {{tokens: *, raw: string, actual: string, proxy: string}} 1574 * @private 1575 */ 1576 1577 1578 WriteStream.prototype._buildChunk = function _buildChunk(tokens) { 1579 var nextId = this.actuals.length; 1580 1581 // The raw html of this chunk. 1582 var raw = []; 1583 1584 // The html to create the nodes in the tokens (with id's injected). 1585 var actual = []; 1586 1587 // Html that can later be used to proxy the nodes in the tokens. 1588 var proxy = []; 1589 1590 var len = tokens.length; 1591 for (var i = 0; i < len; i++) { 1592 var tok = tokens[i]; 1593 var tokenRaw = tok.toString(); 1594 1595 raw.push(tokenRaw); 1596 1597 if (tok.attrs) { 1598 // tok.attrs <==> startTag or atomicTag or cursor 1599 // Ignore noscript tags. They are atomic, so we don't have to worry about children. 1600 if (!/^noscript$/i.test(tok.tagName)) { 1601 var id = nextId++; 1602 1603 // Actual: inject id attribute: replace '>' at end of start tag with id attribute + '>' 1604 actual.push(tokenRaw.replace(/(\/?>)/, ' ' + BASEATTR + 'id=' + id + ' $1')); 1605 1606 // Don't proxy scripts: they have no bearing on DOM structure. 1607 if (tok.attrs.id !== PROXY_SCRIPT && tok.attrs.id !== PROXY_STYLE) { 1608 // Proxy: strip all attributes and inject proxyof attribute 1609 proxy.push( 1610 // ignore atomic tags (e.g., style): they have no "structural" effect
vendor: 38,542 bytes, lines 1611-3088
1611 tok.type === 'atomicTag' ? '' : '<' + tok.tagName + ' ' + BASEATTR + 'proxyof=' + id + (tok.unary ? ' />' : '>')); 1612 } 1613 } 1614 } else { 1615 // Visit any other type of token 1616 // Actual: append. 1617 actual.push(tokenRaw); 1618 1619 // Proxy: append endTags. Ignore everything else. 1620 proxy.push(tok.type === 'endTag' ? tokenRaw : ''); 1621 } 1622 } 1623 1624 return { 1625 tokens: tokens, 1626 raw: raw.join(''), 1627 actual: actual.join(''), 1628 proxy: proxy.join('') 1629 }; 1630 }; 1631 1632 /** 1633 * Walk the chunks. 1634 * 1635 * @private 1636 */ 1637 1638 1639 WriteStream.prototype._walkChunk = function _walkChunk() { 1640 var node = void 0; 1641 var stack = [this.proxyRoot]; 1642 1643 // use shift/unshift so that children are walked in document order 1644 while (utils.existy(node = stack.shift())) { 1645 var isElement = node.nodeType === 1; 1646 var isProxy = isElement && getData(node, 'proxyof'); 1647 1648 // Ignore proxies 1649 if (!isProxy) { 1650 if (isElement) { 1651 // New actual element: register it and remove the the id attr. 1652 this.actuals[getData(node, 'id')] = node; 1653 setData(node, 'id'); 1654 } 1655 1656 // Is node's parent a proxy? 1657 var parentIsProxyOf = node.parentNode && getData(node.parentNode, 'proxyof'); 1658 if (parentIsProxyOf) { 1659 // Move node under actual parent. 1660 this.actuals[parentIsProxyOf].appendChild(node); 1661 } 1662 } 1663 1664 // prepend childNodes to stack 1665 stack.unshift.apply(stack, utils.toArray(node.childNodes)); 1666 } 1667 }; 1668 1669 /** 1670 * Handles Script tokens 1671 * 1672 * @param {Object} tok The token 1673 */ 1674 1675 1676 WriteStream.prototype._handleScriptToken = function _handleScriptToken(tok) { 1677 var _this = this; 1678 1679 var remainder = this.parser.clear(); 1680 1681 if (remainder) { 1682 // Write remainder immediately behind this script. 1683 this.writeQueue.unshift(remainder); 1684 } 1685 1686 tok.src = tok.attrs.src || tok.attrs.SRC; 1687 1688 tok = this.options.beforeWriteToken(tok); 1689 if (!tok) { 1690 // User has removed this token 1691 return; 1692 } 1693 1694 if (tok.src && this.scriptStack.length) { 1695 // Defer this script until scriptStack is empty. 1696 // Assumption 1: This script will not start executing until 1697 // scriptStack is empty. 1698 this.deferredRemote = tok; 1699 } else { 1700 this._onScriptStart(tok); 1701 } 1702 1703 // Put the script node in the DOM. 1704 this._writeScriptToken(tok, function () { 1705 _this._onScriptDone(tok); 1706 }); 1707 }; 1708 1709 /** 1710 * Handles style tokens 1711 * 1712 * @param {Object} tok The token 1713 */ 1714 1715 1716 WriteStream.prototype._handleStyleToken = function _handleStyleToken(tok) { 1717 var remainder = this.parser.clear(); 1718 1719 if (remainder) { 1720 // Write remainder immediately behind this style. 1721 this.writeQueue.unshift(remainder); 1722 } 1723 1724 tok.type = tok.attrs.type || tok.attrs.TYPE || 'text/css'; 1725 1726 tok = this.options.beforeWriteToken(tok); 1727 1728 if (tok) { 1729 // Put the style node in the DOM. 1730 this._writeStyleToken(tok); 1731 } 1732 1733 if (remainder) { 1734 this.write(); 1735 } 1736 }; 1737 1738 /** 1739 * Build a style and insert it into the DOM. 1740 * 1741 * @param {Object} tok The token 1742 */ 1743 1744 1745 WriteStream.prototype._writeStyleToken = function _writeStyleToken(tok) { 1746 var el = this._buildStyle(tok); 1747 1748 this._insertCursor(el, PROXY_STYLE); 1749 1750 // Set content 1751 if (tok.content) { 1752 if (el.styleSheet && !el.sheet) { 1753 el.styleSheet.cssText = tok.content; 1754 } else { 1755 el.appendChild(this.doc.createTextNode(tok.content)); 1756 } 1757 } 1758 }; 1759 1760 /** 1761 * Build a style element from an atomic style token. 1762 * 1763 * @param {Object} tok The token 1764 * @returns {Element} 1765 */ 1766 1767 1768 WriteStream.prototype._buildStyle = function _buildStyle(tok) { 1769 var el = this.doc.createElement(tok.tagName); 1770 1771 el.setAttribute('type', tok.type); 1772 1773 // Set attributes 1774 utils.eachKey(tok.attrs, function (name, value) { 1775 el.setAttribute(name, value); 1776 }); 1777 1778 return el; 1779 }; 1780 1781 /** 1782 * Append a span to the stream. That span will act as a cursor 1783 * (i.e. insertion point) for the element. 1784 * 1785 * @param {Object} el The element 1786 * @param {string} which The type of proxy element 1787 */ 1788 1789 1790 WriteStream.prototype._insertCursor = function _insertCursor(el, which) { 1791 this._writeImpl('<span id="' + which + '"/>'); 1792 1793 var cursor = this.doc.getElementById(which); 1794 1795 if (cursor) { 1796 cursor.parentNode.replaceChild(el, cursor); 1797 } 1798 }; 1799 1800 /** 1801 * Called when a script is started. 1802 * 1803 * @param {Object} tok The token 1804 * @private 1805 */ 1806 1807 1808 WriteStream.prototype._onScriptStart = function _onScriptStart(tok) { 1809 tok.outerWrites = this.writeQueue; 1810 this.writeQueue = []; 1811 this.scriptStack.unshift(tok); 1812 }; 1813 1814 /** 1815 * Called when a script is done. 1816 * 1817 * @param {Object} tok The token 1818 * @private 1819 */ 1820 1821 1822 WriteStream.prototype._onScriptDone = function _onScriptDone(tok) { 1823 // Pop script and check nesting. 1824 if (tok !== this.scriptStack[0]) { 1825 this.options.error({ msg: 'Bad script nesting or script finished twice' }); 1826 return; 1827 } 1828 1829 this.scriptStack.shift(); 1830 1831 // Append outer writes to queue and process them. 1832 this.write.apply(this, tok.outerWrites); 1833 1834 // Check for pending remote 1835 1836 // Assumption 2: if remote_script1 writes remote_script2 then 1837 // the we notice remote_script1 finishes before remote_script2 starts. 1838 // I think this is equivalent to assumption 1 1839 if (!this.scriptStack.length && this.deferredRemote) { 1840 this._onScriptStart(this.deferredRemote); 1841 this.deferredRemote = null; 1842 } 1843 }; 1844 1845 /** 1846 * Build a script and insert it into the DOM. 1847 * Done is called once script has executed. 1848 * 1849 * @param {Object} tok The token 1850 * @param {Function} done The callback when complete 1851 */ 1852 1853 1854 WriteStream.prototype._writeScriptToken = function _writeScriptToken(tok, done) { 1855 var el = this._buildScript(tok); 1856 var asyncRelease = this._shouldRelease(el); 1857 var afterAsync = this.options.afterAsync; 1858 1859 if (tok.src) { 1860 // Fix for attribute "SRC" (capitalized). IE does not recognize it. 1861 el.src = tok.src; 1862 this._scriptLoadHandler(el, !asyncRelease ? function () { 1863 done(); 1864 afterAsync(); 1865 } : afterAsync); 1866 } 1867 1868 try { 1869 this._insertCursor(el, PROXY_SCRIPT); 1870 if (!el.src || asyncRelease) { 1871 done(); 1872 } 1873 } catch (e) { 1874 this.options.error(e); 1875 done(); 1876 } 1877 }; 1878 1879 /** 1880 * Build a script element from an atomic script token. 1881 * 1882 * @param {Object} tok The token 1883 * @returns {Element} 1884 */ 1885 1886 1887 WriteStream.prototype._buildScript = function _buildScript(tok) { 1888 var el = this.doc.createElement(tok.tagName); 1889 1890 // Set attributes 1891 utils.eachKey(tok.attrs, function (name, value) { 1892 el.setAttribute(name, value); 1893 }); 1894 1895 // Set content 1896 if (tok.content) { 1897 el.text = tok.content; 1898 } 1899 1900 return el; 1901 }; 1902 1903 /** 1904 * Setup the script load handler on an element. 1905 * 1906 * @param {Object} el The element 1907 * @param {Function} done The callback 1908 * @private 1909 */ 1910 1911 1912 WriteStream.prototype._scriptLoadHandler = function _scriptLoadHandler(el, done) { 1913 function cleanup() { 1914 el = el.onload = el.onreadystatechange = el.onerror = null; 1915 } 1916 1917 var error = this.options.error; 1918 1919 function success() { 1920 cleanup(); 1921 if (done != null) { 1922 done(); 1923 } 1924 done = null; 1925 } 1926 1927 function failure(err) { 1928 cleanup(); 1929 error(err); 1930 if (done != null) { 1931 done(); 1932 } 1933 done = null; 1934 } 1935 1936 function reattachEventListener(el, evt) { 1937 var handler = el['on' + evt]; 1938 if (handler != null) { 1939 el['_on' + evt] = handler; 1940 } 1941 } 1942 1943 reattachEventListener(el, 'load'); 1944 reattachEventListener(el, 'error'); 1945 1946 _extends(el, { 1947 onload: function onload() { 1948 if (el._onload) { 1949 try { 1950 el._onload.apply(this, Array.prototype.slice.call(arguments, 0)); 1951 } catch (err) { 1952 failure({ msg: 'onload handler failed ' + err + ' @ ' + el.src }); 1953 } 1954 } 1955 success(); 1956 }, 1957 onerror: function onerror() { 1958 if (el._onerror) { 1959 try { 1960 el._onerror.apply(this, Array.prototype.slice.call(arguments, 0)); 1961 } catch (err) { 1962 failure({ msg: 'onerror handler failed ' + err + ' @ ' + el.src }); 1963 return; 1964 } 1965 } 1966 failure({ msg: 'remote script failed ' + el.src }); 1967 }, 1968 onreadystatechange: function onreadystatechange() { 1969 if (/^(loaded|complete)$/.test(el.readyState)) { 1970 success(); 1971 } 1972 } 1973 }); 1974 }; 1975 1976 /** 1977 * Determines whether to release. 1978 * 1979 * @param {Object} el The element 1980 * @returns {boolean} 1981 * @private 1982 */ 1983 1984 1985 WriteStream.prototype._shouldRelease = function _shouldRelease(el) { 1986 var isScript = /^script$/i.test(el.nodeName); 1987 return !isScript || !!(this.options.releaseAsync && el.src && el.hasAttribute('async')); 1988 }; 1989 1990 return WriteStream; 1991 }(); 1992 1993 exports['default'] = WriteStream; 1994 1995/***/ }, 1996/* 3 */ 1997/***/ function(module, exports, __webpack_require__) { 1998 1999 /** 2000 * @file prescribe 2001 * @description Tiny, forgiving HTML parser 2002 * @version vundefined 2003 * @see {@link https://github.com/krux/prescribe/} 2004 * @license MIT 2005 * @author Derek Brans 2006 * @copyright 2016 Krux Digital, Inc 2007 */ 2008 (function webpackUniversalModuleDefinition(root, factory) { 2009 if(true) 2010 module.exports = factory(); 2011 else if(typeof define === 'function' && define.amd) 2012 define([], factory); 2013 else if(typeof exports === 'object') 2014 exports["Prescribe"] = factory(); 2015 else 2016 root["Prescribe"] = factory(); 2017 })(this, function() { 2018 return /******/ (function(modules) { // webpackBootstrap 2019 /******/ // The module cache 2020 /******/ var installedModules = {}; 2021 2022 /******/ // The require function 2023 /******/ function __webpack_require__(moduleId) { 2024 2025 /******/ // Check if module is in cache 2026 /******/ if(installedModules[moduleId]) 2027 /******/ return installedModules[moduleId].exports; 2028 2029 /******/ // Create a new module (and put it into the cache) 2030 /******/ var module = installedModules[moduleId] = { 2031 /******/ exports: {}, 2032 /******/ id: moduleId, 2033 /******/ loaded: false 2034 /******/ }; 2035 2036 /******/ // Execute the module function 2037 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 2038 2039 /******/ // Flag the module as loaded 2040 /******/ module.loaded = true; 2041 2042 /******/ // Return the exports of the module 2043 /******/ return module.exports; 2044 /******/ } 2045 2046 2047 /******/ // expose the modules object (__webpack_modules__) 2048 /******/ __webpack_require__.m = modules; 2049 2050 /******/ // expose the module cache 2051 /******/ __webpack_require__.c = installedModules; 2052 2053 /******/ // __webpack_public_path__ 2054 /******/ __webpack_require__.p = ""; 2055 2056 /******/ // Load entry module and return exports 2057 /******/ return __webpack_require__(0); 2058 /******/ }) 2059 /************************************************************************/ 2060 /******/ ([ 2061 /* 0 */ 2062 /***/ function(module, exports, __webpack_require__) { 2063 2064 'use strict'; 2065 2066 var _HtmlParser = __webpack_require__(1); 2067 2068 var _HtmlParser2 = _interopRequireDefault(_HtmlParser); 2069 2070 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2071 2072 module.exports = _HtmlParser2['default']; 2073 2074 /***/ }, 2075 /* 1 */ 2076 /***/ function(module, exports, __webpack_require__) { 2077 2078 'use strict'; 2079 2080 exports.__esModule = true; 2081 2082 var _supports = __webpack_require__(2); 2083 2084 var supports = _interopRequireWildcard(_supports); 2085 2086 var _streamReaders = __webpack_require__(3); 2087 2088 var streamReaders = _interopRequireWildcard(_streamReaders); 2089 2090 var _fixedReadTokenFactory = __webpack_require__(6); 2091 2092 var _fixedReadTokenFactory2 = _interopRequireDefault(_fixedReadTokenFactory); 2093 2094 var _utils = __webpack_require__(5); 2095 2096 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2097 2098 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 2099 2100 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2101 2102 /** 2103 * Detection regular expressions. 2104 * 2105 * Order of detection matters: detection of one can only 2106 * succeed if detection of previous didn't 2107 2108 * @type {Object} 2109 */ 2110 var detect = { 2111 comment: /^<!--/, 2112 endTag: /^<\//, 2113 atomicTag: /^<\s*(script|style|noscript|iframe|textarea)[\s\/>]/i, 2114 startTag: /^</, 2115 chars: /^[^<]/ 2116 }; 2117 2118 /** 2119 * HtmlParser provides the capability to parse HTML and return tokens 2120 * representing the tags and content. 2121 */ 2122 2123 var HtmlParser = function () { 2124 /** 2125 * Constructor. 2126 * 2127 * @param {string} stream The initial parse stream contents. 2128 * @param {Object} options The options 2129 * @param {boolean} options.autoFix Set to true to automatically fix errors 2130 */ 2131 function HtmlParser() { 2132 var _this = this; 2133 2134 var stream = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 2135 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 2136 2137 _classCallCheck(this, HtmlParser); 2138 2139 this.stream = stream; 2140 2141 var fix = false; 2142 var fixedTokenOptions = {}; 2143 2144 for (var key in supports) { 2145 if (supports.hasOwnProperty(key)) { 2146 if (options.autoFix) { 2147 fixedTokenOptions[key + 'Fix'] = true; // !supports[key]; 2148 } 2149 fix = fix || fixedTokenOptions[key + 'Fix']; 2150 } 2151 } 2152 2153 if (fix) { 2154 this._readToken = (0, _fixedReadTokenFactory2['default'])(this, fixedTokenOptions, function () { 2155 return _this._readTokenImpl(); 2156 }); 2157 this._peekToken = (0, _fixedReadTokenFactory2['default'])(this, fixedTokenOptions, function () { 2158 return _this._peekTokenImpl(); 2159 }); 2160 } else { 2161 this._readToken = this._readTokenImpl; 2162 this._peekToken = this._peekTokenImpl; 2163 } 2164 } 2165 2166 /** 2167 * Appends the given string to the parse stream. 2168 * 2169 * @param {string} str The string to append 2170 */ 2171 2172 2173 HtmlParser.prototype.append = function append(str) { 2174 this.stream += str; 2175 }; 2176 2177 /** 2178 * Prepends the given string to the parse stream. 2179 * 2180 * @param {string} str The string to prepend 2181 */ 2182 2183 2184 HtmlParser.prototype.prepend = function prepend(str) { 2185 this.stream = str + this.stream; 2186 }; 2187 2188 /** 2189 * The implementation of the token reading. 2190 * 2191 * @private 2192 * @returns {?Token} 2193 */ 2194 2195 2196 HtmlParser.prototype._readTokenImpl = function _readTokenImpl() { 2197 var token = this._peekTokenImpl(); 2198 if (token) { 2199 this.stream = this.stream.slice(token.length); 2200 return token; 2201 } 2202 }; 2203 2204 /** 2205 * The implementation of token peeking. 2206 * 2207 * @returns {?Token} 2208 */ 2209 2210 2211 HtmlParser.prototype._peekTokenImpl = function _peekTokenImpl() { 2212 for (var type in detect) { 2213 if (detect.hasOwnProperty(type)) { 2214 if (detect[type].test(this.stream)) { 2215 var token = streamReaders[type](this.stream); 2216 2217 if (token) { 2218 if (token.type === 'startTag' && /script|style/i.test(token.tagName)) { 2219 return null; 2220 } else { 2221 token.text = this.stream.substr(0, token.length); 2222 return token; 2223 } 2224 } 2225 } 2226 } 2227 } 2228 }; 2229 2230 /** 2231 * The public token peeking interface. Delegates to the basic token peeking 2232 * or a version that performs fixups depending on the `autoFix` setting in 2233 * options. 2234 * 2235 * @returns {object} 2236 */ 2237 2238 2239 HtmlParser.prototype.peekToken = function peekToken() { 2240 return this._peekToken(); 2241 }; 2242 2243 /** 2244 * The public token reading interface. Delegates to the basic token reading 2245 * or a version that performs fixups depending on the `autoFix` setting in 2246 * options. 2247 * 2248 * @returns {object} 2249 */ 2250 2251 2252 HtmlParser.prototype.readToken = function readToken() { 2253 return this._readToken(); 2254 }; 2255 2256 /** 2257 * Read tokens and hand to the given handlers. 2258 * 2259 * @param {Object} handlers The handlers to use for the different tokens. 2260 */ 2261 2262 2263 HtmlParser.prototype.readTokens = function readTokens(handlers) { 2264 var tok = void 0; 2265 while (tok = this.readToken()) { 2266 // continue until we get an explicit "false" return 2267 if (handlers[tok.type] && handlers[tok.type](tok) === false) { 2268 return; 2269 } 2270 } 2271 }; 2272 2273 /** 2274 * Clears the parse stream. 2275 * 2276 * @returns {string} The contents of the parse stream before clearing. 2277 */ 2278 2279 2280 HtmlParser.prototype.clear = function clear() { 2281 var rest = this.stream; 2282 this.stream = ''; 2283 return rest; 2284 }; 2285 2286 /** 2287 * Returns the rest of the parse stream. 2288 * 2289 * @returns {string} The contents of the parse stream. 2290 */ 2291 2292 2293 HtmlParser.prototype.rest = function rest() { 2294 return this.stream; 2295 }; 2296 2297 return HtmlParser; 2298 }(); 2299 2300 exports['default'] = HtmlParser; 2301 2302 2303 HtmlParser.tokenToString = function (tok) { 2304 return tok.toString(); 2305 }; 2306 2307 HtmlParser.escapeAttributes = function (attrs) { 2308 var escapedAttrs = {}; 2309 2310 for (var name in attrs) { 2311 if (attrs.hasOwnProperty(name)) { 2312 escapedAttrs[name] = (0, _utils.escapeQuotes)(attrs[name], null); 2313 } 2314 } 2315 2316 return escapedAttrs; 2317 }; 2318 2319 HtmlParser.supports = supports; 2320 2321 for (var key in supports) { 2322 if (supports.hasOwnProperty(key)) { 2323 HtmlParser.browserHasFlaw = HtmlParser.browserHasFlaw || !supports[key] && key; 2324 } 2325 } 2326 2327 /***/ }, 2328 /* 2 */ 2329 /***/ function(module, exports) { 2330 2331 'use strict'; 2332 2333 exports.__esModule = true; 2334 var tagSoup = false; 2335 var selfClose = false; 2336 2337 var work = window.document.createElement('div'); 2338 2339 try { 2340 var html = '<P><I></P></I>'; 2341 work.innerHTML = html; 2342 exports.tagSoup = tagSoup = work.innerHTML !== html; 2343 } catch (e) { 2344 exports.tagSoup = tagSoup = false; 2345 } 2346 2347 try { 2348 work.innerHTML = '<P><i><P></P></i></P>'; 2349 exports.selfClose = selfClose = work.childNodes.length === 2; 2350 } catch (e) { 2351 exports.selfClose = selfClose = false; 2352 } 2353 2354 work = null; 2355 2356 exports.tagSoup = tagSoup; 2357 exports.selfClose = selfClose; 2358 2359 /***/ }, 2360 /* 3 */ 2361 /***/ function(module, exports, __webpack_require__) { 2362 2363 'use strict'; 2364 2365 exports.__esModule = true; 2366 2367 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 2368 2369 exports.comment = comment; 2370 exports.chars = chars; 2371 exports.startTag = startTag; 2372 exports.atomicTag = atomicTag; 2373 exports.endTag = endTag; 2374 2375 var _tokens = __webpack_require__(4); 2376 2377 /** 2378 * Regular Expressions for parsing tags and attributes 2379 * 2380 * @type {Object} 2381 */ 2382 var REGEXES = { 2383 startTag: /^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, 2384 endTag: /^<\/([\-A-Za-z0-9_]+)[^>]*>/, 2385 attr: /(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g, 2386 fillAttr: /^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i 2387 }; 2388 2389 /** 2390 * Reads a comment token 2391 * 2392 * @param {string} stream The input stream 2393 * @returns {CommentToken} 2394 */ 2395 function comment(stream) { 2396 var index = stream.indexOf('-->'); 2397 if (index >= 0) { 2398 return new _tokens.CommentToken(stream.substr(4, index - 1), index + 3); 2399 } 2400 } 2401 2402 /** 2403 * Reads non-tag characters. 2404 * 2405 * @param {string} stream The input stream 2406 * @returns {CharsToken} 2407 */ 2408 function chars(stream) { 2409 var index = stream.indexOf('<'); 2410 return new _tokens.CharsToken(index >= 0 ? index : stream.length); 2411 } 2412 2413 /** 2414 * Reads start tag token. 2415 * 2416 * @param {string} stream The input stream 2417 * @returns {StartTagToken} 2418 */ 2419 function startTag(stream) { 2420 var endTagIndex = stream.indexOf('>'); 2421 if (endTagIndex !== -1) { 2422 var match = stream.match(REGEXES.startTag); 2423 if (match) { 2424 var _ret = function () { 2425 var attrs = {}; 2426 var booleanAttrs = {}; 2427 var rest = match[2]; 2428 2429 match[2].replace(REGEXES.attr, function (match, name) { 2430 if (!(arguments[2] || arguments[3] || arguments[4] || arguments[5])) { 2431 attrs[name] = ''; 2432 } else if (arguments[5]) { 2433 attrs[arguments[5]] = ''; 2434 booleanAttrs[arguments[5]] = true; 2435 } else { 2436 attrs[name] = arguments[2] || arguments[3] || arguments[4] || REGEXES.fillAttr.test(name) && name || ''; 2437 } 2438 2439 rest = rest.replace(match, ''); 2440 }); 2441 2442 return { 2443 v: new _tokens.StartTagToken(match[1], match[0].length, attrs, booleanAttrs, !!match[3], rest.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '')) 2444 }; 2445 }(); 2446 2447 if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; 2448 } 2449 } 2450 } 2451 2452 /** 2453 * Reads atomic tag token. 2454 * 2455 * @param {string} stream The input stream 2456 * @returns {AtomicTagToken} 2457 */ 2458 function atomicTag(stream) { 2459 var start = startTag(stream); 2460 if (start) { 2461 var rest = stream.slice(start.length); 2462 // for optimization, we check first just for the end tag 2463 if (rest.match(new RegExp('<\/\\s*' + start.tagName + '\\s*>', 'i'))) { 2464 // capturing the content is inefficient, so we do it inside the if 2465 var match = rest.match(new RegExp('([\\s\\S]*?)<\/\\s*' + start.tagName + '\\s*>', 'i')); 2466 if (match) { 2467 return new _tokens.AtomicTagToken(start.tagName, match[0].length + start.length, start.attrs, start.booleanAttrs, match[1]); 2468 } 2469 } 2470 } 2471 } 2472 2473 /** 2474 * Reads an end tag token. 2475 * 2476 * @param {string} stream The input stream 2477 * @returns {EndTagToken} 2478 */ 2479 function endTag(stream) { 2480 var match = stream.match(REGEXES.endTag); 2481 if (match) { 2482 return new _tokens.EndTagToken(match[1], match[0].length); 2483 } 2484 } 2485 2486 /***/ }, 2487 /* 4 */ 2488 /***/ function(module, exports, __webpack_require__) { 2489 2490 'use strict'; 2491 2492 exports.__esModule = true; 2493 exports.EndTagToken = exports.AtomicTagToken = exports.StartTagToken = exports.TagToken = exports.CharsToken = exports.CommentToken = exports.Token = undefined; 2494 2495 var _utils = __webpack_require__(5); 2496 2497 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2498 2499 /** 2500 * Token is a base class for all token types parsed. Note we don't actually 2501 * use intheritance due to IE8's non-existent ES5 support. 2502 */ 2503 var Token = 2504 /** 2505 * Constructor. 2506 * 2507 * @param {string} type The type of the Token. 2508 * @param {Number} length The length of the Token text. 2509 */ 2510 exports.Token = function Token(type, length) { 2511 _classCallCheck(this, Token); 2512 2513 this.type = type; 2514 this.length = length; 2515 this.text = ''; 2516 }; 2517 2518 /** 2519 * CommentToken represents comment tags. 2520 */ 2521 2522 2523 var CommentToken = exports.CommentToken = function () { 2524 /** 2525 * Constructor. 2526 * 2527 * @param {string} content The content of the comment 2528 * @param {Number} length The length of the Token text. 2529 */ 2530 function CommentToken(content, length) { 2531 _classCallCheck(this, CommentToken); 2532 2533 this.type = 'comment'; 2534 this.length = length || (content ? content.length : 0); 2535 this.text = ''; 2536 this.content = content; 2537 } 2538 2539 CommentToken.prototype.toString = function toString() { 2540 return '<!--' + this.content; 2541 }; 2542 2543 return CommentToken; 2544 }(); 2545 2546 /** 2547 * CharsToken represents non-tag characters. 2548 */ 2549 2550 2551 var CharsToken = exports.CharsToken = function () { 2552 /** 2553 * Constructor. 2554 * 2555 * @param {Number} length The length of the Token text. 2556 */ 2557 function CharsToken(length) { 2558 _classCallCheck(this, CharsToken); 2559 2560 this.type = 'chars'; 2561 this.length = length; 2562 this.text = ''; 2563 } 2564 2565 CharsToken.prototype.toString = function toString() { 2566 return this.text; 2567 }; 2568 2569 return CharsToken; 2570 }(); 2571 2572 /** 2573 * TagToken is a base class for all tag-based Tokens. 2574 */ 2575 2576 2577 var TagToken = exports.TagToken = function () { 2578 /** 2579 * Constructor. 2580 * 2581 * @param {string} type The type of the token. 2582 * @param {string} tagName The tag name. 2583 * @param {Number} length The length of the Token text. 2584 * @param {Object} attrs The dictionary of attributes and values 2585 * @param {Object} booleanAttrs If an entry has 'true' then the attribute 2586 * is a boolean attribute 2587 */ 2588 function TagToken(type, tagName, length, attrs, booleanAttrs) { 2589 _classCallCheck(this, TagToken); 2590 2591 this.type = type; 2592 this.length = length; 2593 this.text = ''; 2594 this.tagName = tagName; 2595 this.attrs = attrs; 2596 this.booleanAttrs = booleanAttrs; 2597 this.unary = false; 2598 this.html5Unary = false; 2599 } 2600 2601 /** 2602 * Formats the given token tag. 2603 * 2604 * @param {TagToken} tok The TagToken to format. 2605 * @param {?string} [content=null] The content of the token. 2606 * @returns {string} The formatted tag. 2607 */ 2608 2609 2610 TagToken.formatTag = function formatTag(tok) { 2611 var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 2612 2613 var str = '<' + tok.tagName; 2614 for (var key in tok.attrs) { 2615 if (tok.attrs.hasOwnProperty(key)) { 2616 str += ' ' + key; 2617 2618 var val = tok.attrs[key]; 2619 if (typeof tok.booleanAttrs === 'undefined' || typeof tok.booleanAttrs[key] === 'undefined') { 2620 str += '="' + (0, _utils.escapeQuotes)(val) + '"'; 2621 } 2622 } 2623 } 2624 2625 if (tok.rest) { 2626 str += ' ' + tok.rest; 2627 } 2628 2629 if (tok.unary && !tok.html5Unary) { 2630 str += '/>'; 2631 } else { 2632 str += '>'; 2633 } 2634 2635 if (content !== undefined && content !== null) { 2636 str += content + '</' + tok.tagName + '>'; 2637 } 2638 2639 return str; 2640 }; 2641 2642 return TagToken; 2643 }(); 2644 2645 /** 2646 * StartTagToken represents a start token. 2647 */ 2648 2649 2650 var StartTagToken = exports.StartTagToken = function () { 2651 /** 2652 * Constructor. 2653 * 2654 * @param {string} tagName The tag name. 2655 * @param {Number} length The length of the Token text 2656 * @param {Object} attrs The dictionary of attributes and values 2657 * @param {Object} booleanAttrs If an entry has 'true' then the attribute 2658 * is a boolean attribute 2659 * @param {boolean} unary True if the tag is a unary tag 2660 * @param {string} rest The rest of the content. 2661 */ 2662 function StartTagToken(tagName, length, attrs, booleanAttrs, unary, rest) { 2663 _classCallCheck(this, StartTagToken); 2664 2665 this.type = 'startTag'; 2666 this.length = length; 2667 this.text = ''; 2668 this.tagName = tagName; 2669 this.attrs = attrs; 2670 this.booleanAttrs = booleanAttrs; 2671 this.html5Unary = false; 2672 this.unary = unary; 2673 this.rest = rest; 2674 } 2675 2676 StartTagToken.prototype.toString = function toString() { 2677 return TagToken.formatTag(this); 2678 }; 2679 2680 return StartTagToken; 2681 }(); 2682 2683 /** 2684 * AtomicTagToken represents an atomic tag. 2685 */ 2686 2687 2688 var AtomicTagToken = exports.AtomicTagToken = function () { 2689 /** 2690 * Constructor. 2691 * 2692 * @param {string} tagName The name of the tag. 2693 * @param {Number} length The length of the tag text. 2694 * @param {Object} attrs The attributes. 2695 * @param {Object} booleanAttrs If an entry has 'true' then the attribute 2696 * is a boolean attribute 2697 * @param {string} content The content of the tag. 2698 */ 2699 function AtomicTagToken(tagName, length, attrs, booleanAttrs, content) { 2700 _classCallCheck(this, AtomicTagToken); 2701 2702 this.type = 'atomicTag'; 2703 this.length = length; 2704 this.text = ''; 2705 this.tagName = tagName; 2706 this.attrs = attrs; 2707 this.booleanAttrs = booleanAttrs; 2708 this.unary = false; 2709 this.html5Unary = false; 2710 this.content = content; 2711 } 2712 2713 AtomicTagToken.prototype.toString = function toString() { 2714 return TagToken.formatTag(this, this.content); 2715 }; 2716 2717 return AtomicTagToken; 2718 }(); 2719 2720 /** 2721 * EndTagToken represents an end tag. 2722 */ 2723 2724 2725 var EndTagToken = exports.EndTagToken = function () { 2726 /** 2727 * Constructor. 2728 * 2729 * @param {string} tagName The name of the tag. 2730 * @param {Number} length The length of the tag text. 2731 */ 2732 function EndTagToken(tagName, length) { 2733 _classCallCheck(this, EndTagToken); 2734 2735 this.type = 'endTag'; 2736 this.length = length; 2737 this.text = ''; 2738 this.tagName = tagName; 2739 } 2740 2741 EndTagToken.prototype.toString = function toString() { 2742 return '</' + this.tagName + '>'; 2743 }; 2744 2745 return EndTagToken; 2746 }(); 2747 2748 /***/ }, 2749 /* 5 */ 2750 /***/ function(module, exports) { 2751 2752 'use strict'; 2753 2754 exports.__esModule = true; 2755 exports.escapeQuotes = escapeQuotes; 2756 2757 /** 2758 * Escape quotes in the given value. 2759 * 2760 * @param {string} value The value to escape. 2761 * @param {string} [defaultValue=''] The default value to return if value is falsy. 2762 * @returns {string} 2763 */ 2764 function escapeQuotes(value) { 2765 var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 2766 2767 // There's no lookback in JS, so /(^|[^\\])"/ only matches the first of two `"`s. 2768 // Instead, just match anything before a double-quote and escape if it's not already escaped. 2769 return !value ? defaultValue : value.replace(/([^"]*)"/g, function (_, prefix) { 2770 return (/\\/.test(prefix) ? prefix + '"' : prefix + '\\"' 2771 ); 2772 }); 2773 } 2774 2775 /***/ }, 2776 /* 6 */ 2777 /***/ function(module, exports) { 2778 2779 'use strict'; 2780 2781 exports.__esModule = true; 2782 exports['default'] = fixedReadTokenFactory; 2783 /** 2784 * Empty Elements - HTML 4.01 2785 * 2786 * @type {RegExp} 2787 */ 2788 var EMPTY = /^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i; 2789 2790 /** 2791 * Elements that you can intentionally leave open (and which close themselves) 2792 * 2793 * @type {RegExp} 2794 */ 2795 var CLOSESELF = /^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i; 2796 2797 /** 2798 * Corrects a token. 2799 * 2800 * @param {Token} tok The token to correct 2801 * @returns {Token} The corrected token 2802 */ 2803 function correct(tok) { 2804 if (tok && tok.type === 'startTag') { 2805 tok.unary = EMPTY.test(tok.tagName) || tok.unary; 2806 tok.html5Unary = !/\/>$/.test(tok.text); 2807 } 2808 return tok; 2809 } 2810 2811 /** 2812 * Peeks at the next token in the parser. 2813 * 2814 * @param {HtmlParser} parser The parser 2815 * @param {Function} readTokenImpl The underlying readToken implementation 2816 * @returns {Token} The next token 2817 */ 2818 function peekToken(parser, readTokenImpl) { 2819 var tmp = parser.stream; 2820 var tok = correct(readTokenImpl()); 2821 parser.stream = tmp; 2822 return tok; 2823 } 2824 2825 /** 2826 * Closes the last token. 2827 * 2828 * @param {HtmlParser} parser The parser 2829 * @param {Array<Token>} stack The stack 2830 */ 2831 function closeLast(parser, stack) { 2832 var tok = stack.pop(); 2833 2834 // prepend close tag to stream. 2835 parser.prepend('</' + tok.tagName + '>'); 2836 } 2837 2838 /** 2839 * Create a new token stack. 2840 * 2841 * @returns {Array<Token>} 2842 */ 2843 function newStack() { 2844 var stack = []; 2845 2846 stack.last = function () { 2847 return this[this.length - 1]; 2848 }; 2849 2850 stack.lastTagNameEq = function (tagName) { 2851 var last = this.last(); 2852 return last && last.tagName && last.tagName.toUpperCase() === tagName.toUpperCase(); 2853 }; 2854 2855 stack.containsTagName = function (tagName) { 2856 for (var i = 0, tok; tok = this[i]; i++) { 2857 if (tok.tagName === tagName) { 2858 return true; 2859 } 2860 } 2861 return false; 2862 }; 2863 2864 return stack; 2865 } 2866 2867 /** 2868 * Return a readToken implementation that fixes input. 2869 * 2870 * @param {HtmlParser} parser The parser 2871 * @param {Object} options Options for fixing 2872 * @param {boolean} options.tagSoupFix True to fix tag soup scenarios 2873 * @param {boolean} options.selfCloseFix True to fix self-closing tags 2874 * @param {Function} readTokenImpl The underlying readToken implementation 2875 * @returns {Function} 2876 */ 2877 function fixedReadTokenFactory(parser, options, readTokenImpl) { 2878 var stack = newStack(); 2879 2880 var handlers = { 2881 startTag: function startTag(tok) { 2882 var tagName = tok.tagName; 2883 2884 if (tagName.toUpperCase() === 'TR' && stack.lastTagNameEq('TABLE')) { 2885 parser.prepend('<TBODY>'); 2886 prepareNextToken(); 2887 } else if (options.selfCloseFix && CLOSESELF.test(tagName) && stack.containsTagName(tagName)) { 2888 if (stack.lastTagNameEq(tagName)) { 2889 closeLast(parser, stack); 2890 } else { 2891 parser.prepend('</' + tok.tagName + '>'); 2892 prepareNextToken(); 2893 } 2894 } else if (!tok.unary) { 2895 stack.push(tok); 2896 } 2897 }, 2898 endTag: function endTag(tok) { 2899 var last = stack.last(); 2900 if (last) { 2901 if (options.tagSoupFix && !stack.lastTagNameEq(tok.tagName)) { 2902 // cleanup tag soup 2903 closeLast(parser, stack); 2904 } else { 2905 stack.pop(); 2906 } 2907 } else if (options.tagSoupFix) { 2908 // cleanup tag soup part 2: skip this token 2909 readTokenImpl(); 2910 prepareNextToken(); 2911 } 2912 } 2913 }; 2914 2915 function prepareNextToken() { 2916 var tok = peekToken(parser, readTokenImpl); 2917 if (tok && handlers[tok.type]) { 2918 handlers[tok.type](tok); 2919 } 2920 } 2921 2922 return function fixedReadToken() { 2923 prepareNextToken(); 2924 return correct(readTokenImpl()); 2925 }; 2926 } 2927 2928 /***/ } 2929 /******/ ]) 2930 }); 2931 ; 2932 2933/***/ }, 2934/* 4 */ 2935/***/ function(module, exports) { 2936 2937 'use strict'; 2938 2939 exports.__esModule = true; 2940 2941 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 2942 2943 exports.existy = existy; 2944 exports.isFunction = isFunction; 2945 exports.each = each; 2946 exports.eachKey = eachKey; 2947 exports.defaults = defaults; 2948 exports.toArray = toArray; 2949 exports.last = last; 2950 exports.isTag = isTag; 2951 exports.isScript = isScript; 2952 exports.isStyle = isStyle; 2953 /** 2954 * Determine if the thing is not undefined and not null. 2955 * 2956 * @param {*} thing The thing to test 2957 * @returns {boolean} True if the thing is not undefined and not null. 2958 */ 2959 function existy(thing) { 2960 return thing !== void 0 && thing !== null; 2961 } 2962 2963 /** 2964 * Is this a function? 2965 * 2966 * @param {*} x The variable to test 2967 * @returns {boolean} True if the variable is a function 2968 */ 2969 function isFunction(x) { 2970 return 'function' === typeof x; 2971 } 2972 2973 /** 2974 * Loop over each item in an array-like value. 2975 * 2976 * @param {Array<*>} arr The array to loop over 2977 * @param {Function} fn The function to call 2978 * @param {?Object} target The object to bind to the function 2979 */ 2980 function each(arr, fn, target) { 2981 var i = void 0; 2982 var len = arr && arr.length || 0; 2983 for (i = 0; i < len; i++) { 2984 fn.call(target, arr[i], i); 2985 } 2986 } 2987 2988 /** 2989 * Loop over each key/value pair in a hash. 2990 * 2991 * @param {Object} obj The object 2992 * @param {Function} fn The function to call 2993 * @param {?Object} target The object to bind to the function 2994 */ 2995 function eachKey(obj, fn, target) { 2996 for (var key in obj) { 2997 if (obj.hasOwnProperty(key)) { 2998 fn.call(target, key, obj[key]); 2999 } 3000 } 3001 } 3002 3003 /** 3004 * Set default options where some option was not specified. 3005 * 3006 * @param {Object} options The destination 3007 * @param {Object} _defaults The defaults 3008 * @returns {Object} 3009 */ 3010 function defaults(options, _defaults) { 3011 options = options || {}; 3012 eachKey(_defaults, function (key, val) { 3013 if (!existy(options[key])) { 3014 options[key] = val; 3015 } 3016 }); 3017 return options; 3018 } 3019 3020 /** 3021 * Convert value (e.g., a NodeList) to an array. 3022 * 3023 * @param {*} obj The object 3024 * @returns {Array<*>} 3025 */ 3026 function toArray(obj) { 3027 try { 3028 return Array.prototype.slice.call(obj); 3029 } catch (e) { 3030 var _ret = function () { 3031 var ret = []; 3032 each(obj, function (val) { 3033 ret.push(val); 3034 }); 3035 return { 3036 v: ret 3037 }; 3038 }(); 3039 3040 if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; 3041 } 3042 } 3043 3044 /** 3045 * Get the last item in an array 3046 * 3047 * @param {Array<*>} array The array 3048 * @returns {*} The last item in the array 3049 */ 3050 function last(array) { 3051 return array[array.length - 1]; 3052 } 3053 3054 /** 3055 * Test if token is a script tag. 3056 * 3057 * @param {Object} tok The token 3058 * @param {String} tag The tag name 3059 * @returns {boolean} True if the token is a script tag 3060 */ 3061 function isTag(tok, tag) { 3062 return !tok || !(tok.type === 'startTag' || tok.type === 'atomicTag') || !('tagName' in tok) ? !1 : !!~tok.tagName.toLowerCase().indexOf(tag); 3063 } 3064 3065 /** 3066 * Test if token is a script tag. 3067 * 3068 * @param {Object} tok The token 3069 * @returns {boolean} True if the token is a script tag 3070 */ 3071 function isScript(tok) { 3072 return isTag(tok, 'script'); 3073 } 3074 3075 /** 3076 * Test if token is a style tag. 3077 * 3078 * @param {Object} tok The token 3079 * @returns {boolean} True if the token is a style tag 3080 */ 3081 function isStyle(tok) { 3082 return isTag(tok, 'style'); 3083 } 3084 3085/***/ } 3086/******/ ]) 3087}); 3088;
3089; 3090(()=>{"use strict";var e={428:e=>{e.exports=window.jQuery},960:(e,a,t)=>{t.d(a,{K:()=>r});var i=t(428),s=t.n(i);e=t.hmd(e);const n={REFERRER_COOKIE_NAME:"advanced_ads_pro_visitor_referrer",PAGE_IMPRESSIONS_COOKIE_NAME:"advanced_ads_page_impressions",AD_IMPRESSIONS_COOKIE_NAME:"advanced_ads_ad_impressions",VISITOR_INFO_COOKIE_NAME:"advanced_ads_visitor",conditions:{mobile:"check_mobile",referrer_url:"check_referrer_url",user_agent:"check_user_agent",request_uri:"check_request_uri",browser_lang:"check_browser_lang",cookie:"check_cookie",page_impressions:"check_page_impressions",ad_impressions:"check_ad_impressions",new_visitor:"check_new_visitor",adblocker:"check_adblocker",device_width:"check_browser_width",tablet:"check_tablet",loggedin:"check_loggedin",capability:"check_capability",role:"check_role",geo_targeting:"check_geo_targeting",buddypress_profile_field:"check_buddypress_profile_field"},init:function(){s()(document).trigger("advads-passive-cb-conditions",[this]),this.init=function(){}},frontend_check:function(e,a){var t=this.conditions[e.type];return"string"==typeof t&&(t=advads_pro_utils.bind(this[t],this)),!t||!!t(e,a)},check_mobile:function(a){if(function(a){var i=/iPhone/i,s=/iPod/i,n=/iPad/i,r=/(?=.*\bAndroid\b)(?=.*\bMobile\b)/i,o=/Android/i,d=/(?=.*\bAndroid\b)(?=.*\bSD4930UR\b)/i,_=/(?=.*\bAndroid\b)(?=.*\b(?:KFOT|KFTT|KFJWI|KFJWA|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|KFARWI|KFASWI|KFSAWI|KFSAWA)\b)/i,c=/IEMobile/i,l=/(?=.*\bWindows\b)(?=.*\bARM\b)/i,p=/BlackBerry/i,T=/BB10/i,u=/Opera Mini/i,b=/(CriOS|Chrome)(?=.*\bMobile\b)/i,v=/(?=.*\bFirefox\b)(?=.*\bMobile\b)/i,h=new RegExp("(?:Nexus 7|BNTV250|Kindle Fire|Silk|GT-P1000)","i"),f=function(e,a){return e.test(a)},A=function(e){var a=e||navigator.userAgent,t=a.split("[FBAN");return void 0!==t[1]&&(a=t[0]),this.apple={phone:f(i,a),ipod:f(s,a),tablet:!f(i,a)&&f(n,a),device:f(i,a)||f(s,a)||f(n,a)},this.amazon={phone:f(d,a),tablet:!f(d,a)&&f(_,a),device:f(d,a)||f(_,a)},this.android={phone:f(d,a)||f(r,a),tablet:!f(d,a)&&!f(r,a)&&(f(_,a)||f(o,a)),device:f(d,a)||f(_,a)||f(r,a)||f(o,a)},this.windows={phone:f(c,a),tablet:f(l,a),device:f(c,a)||f(l,a)},this.other={blackberry:f(p,a),blackberry10:f(T,a),opera:f(u,a),firefox:f(v,a),chrome:f(b,a),device:f(p,a)||f(T,a)||f(u,a)||f(v,a)||f(b,a)},this.seven_inch=f(h,a),this.any=this.apple.device||this.android.device||this.windows.device||this.other.device||this.seven_inch,this.phone=this.apple.phone||this.android.phone||this.windows.phone,this.tablet=this.apple.tablet||this.android.tablet||this.windows.tablet,"undefined"==typeof window?this:void 0},P=function(){var e=new A;return e.Class=A,e};e.exports&&"undefined"==typeof window?e.exports=A:e.exports&&"undefined"!=typeof window?e.exports=P():"function"==typeof define&&t.amdO?define("isMobile",[],a.isMobile=P()):a.isMobile=P()}(this),!advads_pro_utils.isset(a.value)){if(!advads_pro_utils.isset(a.operator))return!0;const e=this.isMobile.any;return"is_not"===a.operator?!e:e}const i=this.check_tablet({operator:"is"});return Object.keys(Object.fromEntries(Object.entries({mobile:this.isMobile.any&&!i,tablet:i,desktop:!this.isMobile.any&&!i}).filter(([e,t])=>a.value.includes(e)&&t))).length>0},check_referrer_url:function(e){var a=advads_pro_utils.extract_cookie_data(advads.get_cookie(this.REFERRER_COOKIE_NAME))||"";return this.helper_check_string(a,e)},check_user_agent:function(e){var a="object"==typeof navigator?navigator.userAgent:"";return this.helper_check_string(a,e)},check_browser_lang:function(e){var a=e.value;if(!a)return!0;var t="object"==typeof navigator?navigator.languages?navigator.languages.join(","):navigator.language||navigator.userLanguage:"";if(!t)return!0;try{var i=new RegExp("\\b"+a+"\\b","i"),s=-1!==t.search(i)}catch(e){return!0}return"is_not"===e.operator?!s:s},check_request_uri:function(e){var a="object"==typeof location?location.href:"";return this.helper_check_string(a,e)},check_cookie:function(e){e.operator&&(e.operator=this.maybe_replace_cookie_operator(e.operator));var a=!advads_pro_utils.isset(e.operator)||"match_not"!==e.operator;if(!advads_pro_utils.isset(e.cookie)||""===e.cookie)return a;
3090var t=advads.get_cookie(e.cookie);return advads_pro_utils.isset(t)?advads_pro_utils.isset(e.value)&&""!==e.value?(e.value=unescape(e.value.replace(/\\(.)/gm,"$1")),this.helper_check_string(t,e)):a:!a},check_page_impressions:function(e){if(!advads_pro_utils.isset(e.operator)||!advads_pro_utils.isset(e.value))return!0;var a,t=advads_pro_utils.extract_cookie_data(advads.get_cookie(this.PAGE_IMPRESSIONS_COOKIE_NAME));if(!advads_pro_utils.isset(t))return!0;a=parseInt(t,10)||0;var i=parseInt(e.value)||0;switch(e.operator){case"is_equal":if(i!==a)return!1;break;case"is_higher":if(i>a)return!1;break;case"is_lower":if(i<a)return!1}return!0},check_ad_impressions:function(e,a){if(!advads_pro_utils.isset(e.value)||!advads_pro_utils.isset(e.timeout)||!advads_pro_utils.isset(a.id))return!0;var t=parseInt(e.value)||0,i=this.AD_IMPRESSIONS_COOKIE_NAME+"_"+a.id,s=i+"_timeout";return!(advads_pro_utils.isset(advads.get_cookie(i))&&advads_pro_utils.isset(advads.get_cookie(s))&&t<=(parseInt(advads.get_cookie(i))||0))},check_new_visitor:function(e){if(!advads_pro_utils.isset(e.operator))return!0;const a=advads.cookie_exists(this.PAGE_IMPRESSIONS_COOKIE_NAME)?advads_pro_utils.extract_cookie_data(advads.get_cookie(this.PAGE_IMPRESSIONS_COOKIE_NAME)):0;return"is"===e.operator?1===a:1<a},check_adblocker:function(e){if(!advads_pro_utils.isset(e.operator))return!0;var a;switch(advanced_ads_check_adblocker(function(e){a=e}),e.operator){case"is":return a;case"is_not":return!a}return!0},check_browser_width:function(e){if(!advads_pro_utils.isset(e.operator)||!advads_pro_utils.isset(e.value))return!0;var a=s()(window).width(),t=parseInt(e.value)||0;switch(e.operator){case"is_equal":if(t!==a)return!1;break;case"is_higher":if(t>a)return!1;break;case"is_lower":if(t<a)return!1}return!0},check_tablet:function(e){if(!advads_pro_utils.isset(e.operator))return!0;const a={iPad:"iPad|iPad.*Mobile",NexusTablet:"Android.*Nexus[\\s]+(7|9|10)",SamsungTablet:"SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561",Kindle:"Kindle|Silk.*Accelerated|Android.*\\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI)\\b",SurfaceTablet:"Windows NT [0-9.]+; ARM;.*(Tablet|ARMBJS)",HPTablet:"HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10",AsusTablet:"^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\\bK00F\\b|\\bK00C\\b|\\bK00E\\b|\\bK00L\\b|TX201LA|ME176C|ME102A|\\bM80TA\\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K017 |ME572C|ME103K|ME170C|ME171C|\\bME70C\\b|ME581C|ME581CL|ME8510C|ME181C|P01Y|PO1MA",BlackBerryTablet:"PlayBook|RIM Tablet",HTCtablet:"HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410",MotorolaTablet:"xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|M
3090Z608|MZ609|MZ615|MZ616|MZ617",NookTablet:"Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2",AcerTablet:"Android.*; \\b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\\b|W3-810|\\bA3-A10\\b|\\bA3-A11\\b|\\bA3-A20",ToshibaTablet:"Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO",LGTablet:"\\bL-06C|LG-V909|LG-V900|LG-V700|LG-V510|LG-V500|LG-V410|LG-V400|LG-VK810\\b",FujitsuTablet:"Android.*\\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\\b",PrestigioTablet:"PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002",LenovoTablet:"Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)",DellTablet:"Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7",YarvikTablet:"Android.*\\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\\b",MedionTablet:"Android.*\\bOYO\\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB",ArnovaTablet:"AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT|AN9G2",IntensoTablet:"INM8002KP|INM1010FP|INM805ND|Intenso Tab|TAB1004",IRUTablet:"M702pro",MegafonTablet:"MegaFon V9|\\bZTE V9\\b|Android.*\\bMT7A\\b",EbodaTablet:"E-Boda (Supreme|Impresspeed|Izzycomm|Essential)",AllViewTablet:"Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)",ArchosTablet:"\\b(101G9|80G9|A101IT)\\b|Qilive 97R|Archos5|\\bARCHOS (70|79|80|90|97|101|FAMILYPAD|)(b|)(G10| Cobalt| TITANIUM(HD|)| Xenon| Neon|XSK| 2| XS 2| PLATINUM| CARBON|GAMEPAD)\\b",AinolTablet:"NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark",NokiaLumiaTablet:"Lumia 2520",SonyTablet:"Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551|SGP621|SGP612|SOT31",PhilipsTablet:"\\b(PI2010|PI3000|PI3100|PI3105|PI3110|PI3205|PI3210|PI3900|PI4010|PI7000|PI7100)\\b",CubeTablet:"Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT",CobyTablet:"MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010",MIDTablet:"M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733|MID4X10",MSITablet:"MSI \\b(Primo 73K|Primo 73L|Primo 81L|Primo 77|Primo 93|Primo 75|Primo 76|Primo 73|Primo 81|Primo 91|Primo 90|Enjoy 71|Enjoy 7|Enjoy 10)\\b",SMiTTablet:"Android.*(\\bMID\\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)",RockChipTablet:"Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A",FlyTablet:"IQ310|Fly Vision",bqTablet:"Android.*(bq)?.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris E10)|Maxwell.*Lite|Maxwell.*Plus",HuaweiTablet:"MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim",NecTablet:"\\bN-06D|\\bN-08D",PantechTablet:"Pantech.*P4100",Bronch
3090oTablet:"Broncho.*(N701|N708|N802|a710)",VersusTablet:"TOUCHPAD.*[78910]|\\bTOUCHTAB\\b",ZyncTablet:"z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900",PositivoTablet:"TB07STA|TB10STA|TB07FTA|TB10FTA",NabiTablet:"Android.*\\bNabi",KoboTablet:"Kobo Touch|\\bK080\\b|\\bVox\\b Build|\\bArc\\b Build",DanewTablet:"DSlide.*\\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\\b",TexetTablet:"NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE",PlaystationTablet:"Playstation.*(Portable|Vita)",TrekstorTablet:"ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A|SurfTab",PyleAudioTablet:"\\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\\b",AdvanTablet:"Android.* \\b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\\b ",DanyTechTablet:"Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1",GalapadTablet:"Android.*\\bG1\\b",MicromaxTablet:"Funbook|Micromax.*\\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\\b",KarbonnTablet:"Android.*\\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\\b",AllFineTablet:"Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide",PROSCANTablet:"\\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\\b",YONESTablet:"BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026",ChangJiaTablet:"TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503",GUTablet:"TX-A1301|TX-M9002|Q702|kf026",PointOfVie
3090wTablet:"TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10",OvermaxTablet:"OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)",HCLTablet:"HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync",DPSTablet:"DPS Dream 9|DPS Dual 7",VistureTablet:"V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10",CrestaTablet:"CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989",MediatekTablet:"\\bMT8125|MT8389|MT8135|MT8377\\b",ConcordeTablet:"Concorde([ ]+)?Tab|ConCorde ReadMan",GoCleverTablet:"GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042",ModecomTablet:"FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003",VoninoTablet:"\\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\\bQ8\\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\\b",ECSTablet:"V07OT2|TM105A|S10OT1|TR10CS1",StorexTablet:"eZee[_']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab",VodafoneTablet:"SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7",EssentielBTablet:"Smart[ ']?TAB[ ]+?[0-9]+|Family[ ']?TAB2",RossMoorTablet:"RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711",iMobileTablet:"i-mobile i-note",TolinoTablet:"tolino tab [0-9.]+|tolino shine",AudioSonicTablet:"\\bC-22Q|T7-QC|T-17B|T-17P\\b",AMPETablet:"Android.* A78 ",SkkTablet:"Android.* (SKYPAD|PHOENIX|CYCLOPS)",TecnoTablet:"TECNO P9",JXDTablet:"Android.* \\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\\b",iJoyTablet:"Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)",FX2Tablet:"FX2 PAD7|FX2 PAD10",XoroTablet:"KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151",ViewsonicTablet:"ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a",OdysTablet:"LOOX|XENO10|ODYS[ -](Space|EVO|Xpress|NOON)|\\bXELIO\\b|Xelio10Pro|XELIO7PHONETAB|XELIO10EXTREME|XELIOPT2|NEO_QUAD10",CaptivaTablet:"CAPTIVA PAD",IconbitTablet:"NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S",TeclastTablet:"T98 4G|\\bP80\\b|\\bX90HD\\b|X98 Air|X98 Air 3G|\\bX89\\b|P80 3G|\\bX80h\\b|P98 Air|\\bX89HD\\b|P98 3G|\\bP90HD\\b|P89 3G|X98 3G|\\bP70h\\b|P79HD 3G|G18d 3G|\\bP79HD\\b|\\bP89s\\b|\\bA88\\b|\\bP10HD\\b|\\bP19HD\\b|G18 3G|\\bP78HD\\b|\\bA78\\b|\\bP75\\b|G17s 3G|G17h 3G|\\bP85t\\b|\\bP90\\b|\\bP11\\b|\\bP98t\\b|\\bP98HD\\b|\\bG18d\\b|\\bP85s\\b|\\bP11HD\\b|\\bP88s\\b|\\bA80HD\\b|\\bA80se\\b|\\bA10h\\b|\\bP89\\b|\\bP78s\\b|\\bG18\\b|\\bP85\\b|\\bA70h\\b|\\bA70\\b|\\bG17\\b|\\bP18\\b|\\bA80s\\b|\\bA11s\\b|\\bP88HD\\b|\\bA80h\\b|\\bP76s\\b|\\bP76h\\b|\\bP98\\b|\\bA10HD\\b|\\bP78\\b|\\bP88\\b|\\bA11\\b|\\bA10t\\b|\\bP76a\\b|\\bP76t\\b|\\bP76e\\b|\\bP85HD\\b|\\bP85a\\b|\\bP86\\b|\\bP75HD\\b|\\bP76v\\b|\\bA12\\b|\\bP75a\\b|\\bA15\\b|\\bP76Ti\\b|\\bP81HD\\b|\\bA10\\b|\\bT760VE\\b|\\bT720HD\\b|\\bP76\\b|\\bP73\\b|\\bP71\\b|\\bP72\\b|\\bT720SE\\b|\\bC520Ti\\b|\\bT760\\b|\\bT720VE\\b|T720-3GE|T720-WiFi",OndaTablet:"\\b(V975i|Vi30|VX530|V701|Vi60|V701s|Vi50|V801s|V719|Vx610w|VX610W|V819i|Vi10|VX580W|Vi10|V711s|V813|V811|V820w|V820|Vi20|V711|VI30W|V712|V891w|V972|V819w|V820w|Vi60|V820w|V711|V813s|V801|V819|V975s|V801|V819|V819|V818|V811|V712|V975m|V101w|V961w|V812|V818|V971|V971s|V919|V989|V116w|V102w|V973|Vi40)\\b[\\s]+",JaytechTablet:"TPC-PA762",BlaupunktTablet:"Endeavour 800NG|Endeavour 1010",DigmaTablet:"\\b(iDx10|iDx9|iDx8|iDx7|iDxD7|iDxD8|iDsQ8|iDsQ7|iDsQ8|iDsD10|iDnD7|3TS804H|iDsQ11|iDj7|iDs10)\\b",EvolioTablet:"ARIA_Mini_wifi|Aria[ _]Mini|Evolio X10|Evolio X7|Evolio X8|\\bEvotab\\b|\\bNeura\\b",LavaTablet:"QPAD E704|\\bIvoryS\\b|E-TAB IVORY|\\bE-TAB\\b",AocTablet:"MW0811|MW0812|MW0922|MTK8382|MW1031|MW0831|MW0821|MW0931|MW0712",MpmanTablet:"MP11 OCTA|MP10 OCTA|MPQC1114|MPQC1004|MPQC994|MPQC974|MPQC973|MPQC804|MPQC784|MPQC780|\\bMPG7\\b|MPDCG75|MPDCG71|MPDC1006|MP101DC|MPDC9000|MPDC905|MPDC706HD|MPDC706|MPDC705|MPDC110|MPDC100|MPDC99|MPDC97|MPDC88|MPDC8|MPDC77|MP709|MID701|MID711|MID170|MPDC703|MPQC1010",CelkonTablet:"CT695|CT888|CT[\\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\\bCT-1\\b",WolderTablet:"miTab \\b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\\b",MiTablet:"\\bMI PAD\\b|\\bHM NOTE 1W\\b",
3090NibiruTablet:"Nibiru M1|Nibiru Jupiter One",NexoTablet:"NEXO NOVA|NEXO 10|NEXO AVIO|NEXO FREE|NEXO GO|NEXO EVO|NEXO 3G|NEXO SMART|NEXO KIDDO|NEXO MOBI",LeaderTablet:"TBLT10Q|TBLT10I|TBL-10WDKB|TBL-10WDKBO2013|TBL-W230V2|TBL-W450|TBL-W500|SV572|TBLT7I|TBA-AC7-8G|TBLT79|TBL-8W16|TBL-10W32|TBL-10WKB|TBL-W100",UbislateTablet:"UbiSlate[\\s]?7C",PocketBookTablet:"Pocketbook",KocasoTablet:"\\b(TB-1207)\\b",Hudl:"Hudl HT7S3|Hudl 2",TelstraTablet:"T-Hub2",GenericTablet:"Android.*\\b97D\\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\\bA7EB\\b|CatNova8|A1_07|CT704|CT1002|\\bM721\\b|rk30sdk|\\bEVOTAB\\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\\bM6pro\\b|CT1020W|arc 10HD|\\bJolla\\b|\\bTP750\\b"};var t="object"==typeof navigator?navigator.userAgent:"",i="";for(var s in a){var n=new RegExp(a[s],"i");if(n.test(t)){i=n;break}}switch(e.operator){case"is":return""!==i;case"is_not":return""===i}return!0},check_loggedin:function(e){if(!advads_pro_utils.isset(e.operator)||!advads_pro_utils.isset(e.type))return!0;var a=this.check_stored(e,function(e,a){return!0===a});switch(e.operator){case"is":return!0===a;case"is_not":return!1===a}return!0},check_capability:function(e){if(!advads_pro_utils.isset(e.operator)||!advads_pro_utils.isset(e.value)||!advads_pro_utils.isset(e.type))return!0;var a=this.check_stored(e,function(e,a){return a===e.value});switch(e.operator){case"can":return!0===a;case"can_not":return!1===a}return!0},check_role:function(e){if(!advads_pro_utils.isset(e.operator)||!advads_pro_utils.isset(e.value)||!advads_pro_utils.isset(e.type))return!0;var a=this.check_stored(e,function(e,a){return a===e.value});switch(e.operator){case"is":return!0===a;case"is_not":return!1===a}return!0},check_geo_targeting:function(e){if(!advads_pro_utils.isset(e.type)||!advads_pro_utils.isset(e.operator))return!0;var a=this.check_stored(e,function(e,a){return"object"!=typeof a||(a.is_sucuri?this.check_geo_sucuri(e,a):this.check_geo_default(e,a))},this);return a},check_geo_default:function(e,a){var t=e.city?e.city.trim().toLowerCase():"",i=e.region?e.region.trim().toLowerCase():"",s=e.country?e.country.trim():"",n=(""+a.visitor_city).toLowerCase(),r=(""+a.visitor_region).toLowerCase(),o=""+a.continent_code,d=a.country_code;if(0===s.indexOf("CONT_")&&(d="CONT_"+o),"latlon"===e.geo_mode){if(this.check_for_valid_lat_lon_options(e)){var _=advads_pro_utils.calculate_distance(parseFloat(a.current_lat),parseFloat(a.current_lon),parseFloat(e.lat),parseFloat(e.lon),e.distance_unit);return"gt"===e.distance_condition?_>e.distance:_<=e.distance}return!0}return"is_not"===e.operator?t?t!==n:i?i!==r:"EU"===s?!a.is_eu_state:s!==d:t?t===n:i?i===r:"EU"===s?a.is_eu_state:s===d},check_for_valid_lat_lon_options:function(e){return advads_pro_utils.is_numeric(e.lat)&&advads_pro_utils.is_numeric(e.lon)&&""!==e.distance_condition&&advads_pro_utils.is_numeric(e.distance)&&""!==e.distance_unit},check_geo_sucuri:function(e,a){e.operator&&e.operator;var t=e.country?e.country.trim():"";return"is_not"===e.operator?"EU"===t?!a.is_eu_state:t!==country_code:"EU"===t?a.is_eu_state:t===country_code},check_buddypress_profile_field:function(e){if(!(advads_pro_utils.isset(e.operator)&&advads_pro_utils.isset(e.value)&&advads_pro_utils.isset(e.type)&&advads_pro_utils.isset(e.field)))return!0;var a=this.check_stored(e,function(e,a){if("object"!=typeof a)return!0;if(a.field!==e.field)return!1;var t=a.data;if(Array.isArray(t)){const a=-1!==["contain","start","end","match","regex"].indexOf(e.operator);return t.length?a?t.some(function(a){return Advads_passive_cb_Conditions.helper_check_string(a,e)}):t.every(function(a){return Advads_passive_cb_Conditions.helper_check_string(a,e)}):!a}return Advads_passive_cb_Conditions.helper_check_string(a.data,e)},this);return a},check_stored:function(e,a,t){var i=Advads_passive_cb_Conditions.get_stored_info()[e.type];if("object"!=typeof i)return!0;for(var s in i)if(i.hasOwnProperty(s)){var n=i[s];if("object"==typeof n&&void 0!==n.data&&a.call(t,e,n.data))return!0}return!1},helper_check_string:function(e,a){var t=a.operator,i=a.value;if("string"!=typeof i||""===i)return!0;var s=!0;switch(t){case"contain":s=-1!==e.indexOf(i);break;case"contain_not":s=-1===e.indexOf(i);break;case"start":s=0===e.lastIndexOf(i,0);break;case"start_not":s=0!==e.lastIndexOf(i,0);break;case"end":s=e.slice(-i.length)===i;break;case"end_not":s=e.slice(-i.length)!==i;break;case"match":s=e===i;break;case"match_not":s=e!==i;break;case"regex":case"regex_not":try{var n=new RegExp(i);s=!!e.match(n),"regex_not"===t&&(s=!s)}catch(e){advads_pro_utils.log('regular expression"'+i+'" in visitor condition is broken')}}return s},get_stored_info:function(){try{var e=JSON.parse(advads.get_cookie(this.VISITOR_INFO_COOKIE_NAME))}catch(e){}return"object"!=typeof e||"object"!=typeof e.conditions?{}:e.conditions},maybe_replace_cookie_operator:function(e){var a={show:"match",hide:"match_not"};return a[e]?a[e]:e}},r=()=>{window.Advads_passive_cb_Conditions=n}}},t={};function i(a){var s=t[a];if(void 0!==s)return s.exports;var n=t[a]={id:a,loaded:!1,exports:{}};return e[a](n,n.exports,i),n.loaded=!0,n.exports}i.amdO={},i.n=e=>
3090{var a=e&&e.__esModule?()=>e.default:()=>e;return i.d(a,{a}),a},i.d=(e,a)=>{for(var t in a)i.o(a,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},i.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),i.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a);var s=i(428),n=i.n(s);class r{constructor(e,a){if(!("object"==typeof e&&e.hasOwnProperty("id")&&e.hasOwnProperty("type")&&e.hasOwnProperty("ads")&&e.hasOwnProperty("placement_info")&&"object"==typeof e.ads))throw new SyntaxError("Can not create Advads_passive_cb_Placement obj");this.id=e.id,this.ajax_query=e.ajax_query,this.type=e.type,this.element_id=a,this.ads=e.ads,this.ads_for_ab=e.ads_for_ab,this.groups_for_ab=e.groups_for_ab,this.placement_info=e.placement_info,this.placement_id=advads_pro_utils.isset_nested(this.placement_info,"id")?parseInt(this.placement_info.id,10):null,this.group_info=e.group_info,this.group_wrap=e.group_wrap,this.server_info_duration=parseInt(e.server_info_duration,10)||0,this.server_conditions=e.server_conditions,e.inject_before&&advanced_ads_pro.inject_before.push({elementId:this.element_id,data:e.inject_before})}can_display(){if(advads_pro_utils.isset_nested(this.placement_info,"test_id")&&n().inArray(this.placement_info.slug,advanced_ads_pro.get_random_placements())<0)return!1;if(advads_pro_utils.isset_nested(this.placement_info,"layer_placement","close","enabled")&&this.placement_info.layer_placement.close.enabled&&advads_pro_utils.isset_nested(this.placement_info,"layer_placement","close","timeout_enabled")&&this.placement_info.layer_placement.close.timeout_enabled&&advads_pro_utils.isset(advads.get_cookie("timeout_placement_"+this.placement_info.slug)))return!1;if(advads_pro_utils.isset_nested(this.placement_info,"close","enabled")&&this.placement_info.close.enabled&&advads_pro_utils.isset_nested(this.placement_info,"close","timeout_enabled")&&this.placement_info.close.timeout_enabled&&advads_pro_utils.isset(advads.get_cookie("timeout_placement_"+this.placement_info.slug)))return!1;if(advads_pro_utils.isset_nested(this.placement_info,"options")&&"object"==typeof this.placement_info.options){var e=this.placement_info.options;if(!advads_pro_utils.selector_exists(e))return!1}return!0}can_use_passive_cb(){if(!this.ajax_query)return!0;var e=window.Advads_passive_cb_Conditions.get_stored_info(),a=~~((new Date).getTime()/1e3);for(var t in this.server_conditions)if(this.server_conditions.hasOwnProperty(t)){var i=e[this.server_conditions[t].type];if("object"!=typeof i)return!1;var s=i[t];if("object"!=typeof s)return!1;if((parseInt(s.time,10)||0)+this.server_info_duration<a)return!1}return!0}output(){let e=!0;const a=this.get_group_for_adblocker();if(this.can_display())switch(this.type){case"ad":if(!this.can_display())break;let t=new Advads_passive_cb_Ad(this.ads[this.id],this.element_id);if(!t.can_display())break;const i=this.get_ad_for_adblocker();if(a){this.swap_group_info(a);const t=new Advads_passive_cb_Group(this,this.element_id);t.output(),e=t.is_empty;break}i&&i.can_display()&&(t=i),t.output({track:!advads.privacy||"unknown"!==advads.privacy.get_state(),inject:!0,do_has_ad:!0}),e=!1;break;case"group":if("object"==typeof this.group_info){a&&this.swap_group_info(a);const t=new Advads_passive_cb_Group(this,this.element_id);t.output(),e=t.is_empty}}advanced_ads_pro.dispatchWrapperCBEvent(this.element_id,e,"passive",{emptyCbOption:Boolean(this.placement_info.cache_busting_empty)}),advanced_ads_pro.observers.fire({event:"inject_placement",id:this.placement_id,is_empty:e,cb_type:"passive"}),advanced_ads_pro.hasAd(this.placement_id,"placement",this.placement_info.title,"passive")}swap_group_info(e){this.id=e.id,this.type="group",this.group_info=e}get_ad_for_adblocker(){return!(!advanced_ads_pro.adblocker_active||!this.ads_for_ab)&&new Advads_passive_cb_Ad(this.ads_for_ab[Object.keys(this.ads_for_ab)[0]],this.element_id)}get_group_for_adblocker(){return!(!advanced_ads_pro.adblocker_active||!this.groups_for_ab)&&this.groups_for_ab}}const o={ads:[],passive_ads:{},deferedAds:[],blockme:!1,blockmeQueue:[],observers:n().Callbacks(),postscribeOb
3090servers:n().Callbacks(),random_placements:!1,iterations:0,adblocker_active:!1,injected:0,injected_done:0,options:{action:"advads_ad_select"},inject_before:[],ajaxAdArgsByElementId:{},dispatchWrapperCBEvent(e,a,t,i){void 0===i&&(i={}),document.dispatchEvent(new CustomEvent("advads_pro_cache_busting_done",{detail:{elementId:e,isEmpty:a,type:t,extra:i}}))},isBusy:!1,set busy(e){this.isBusy=e,document.dispatchEvent(new CustomEvent("advanced_ads_pro."+(e?"busy":"idle")))},get busy(){return this.isBusy},load:function(e){var a,t,i,s,r,o;a=e.hasOwnProperty("id")?e.id:null,t=e.hasOwnProperty("method")?e.method:null,i=e.hasOwnProperty("params")&&"object"==typeof e.params?this.add_general_ajax_args(e.params):{},s=e.hasOwnProperty("elementid")?e.elementid:null,r=advanced_ads_pro_ajax_object.lazy_load_module_enabled&&i&&"enabled"===i.lazy_load,o=e.hasOwnProperty("blog_id")?e.blog_id:"";var d=e.hasOwnProperty("server_conditions")?e.server_conditions:"";if(s&&this.iterations>1&&n()("."+s).empty(),i&&"object"==typeof i){if(!window.advads_pro_utils.selector_exists(i))return;if(i.test_id&&n().inArray(i.slug,this.get_random_placements())<0)return;i.adblocker_active=this.adblocker_active,i=JSON.stringify(i)}var _={ad_id:a,ad_method:t,ad_args:i,elementId:s,blog_id:o,server_conditions:d};r?advanced_ads_pro.lazy_load.add(s,"ajax",_):this.deferedAds[this.deferedAds.length]=_},add_general_ajax_args:function(e){return window.advads_pro_utils.isset(e.post)&&advads_ajax_queries_args[e.post]&&(e.post=advads_ajax_queries_args[e.post]),e},hasAd:function(e,a,t,i,s){var n={id:e,type:a,title:t,cb_type:i,elementId:s};this.ads.push(n),this.observers.fire({event:"hasAd",ad:n})},injectBlocked:function(){var e,a,t=this.blockmeQueue,i=t.length;for(this.blockmeQueue=[],a=0;a<i;a+=1)e=t[a],this.inject(e[0],e[1])},_inject_before:function(e,a){return e&&window.advads_pro_utils.each(advanced_ads_pro.inject_before,function(t){t.elementId===e&&(window.advads_pro_utils.each(t.data,function(e){a.append(e)}),a=n()("."+e),t.data=[])}),a},inject:function(e,a){var t,i,s=this;if(this.blockme)this.blockmeQueue.push([e,a]);else{this.injected++;for(var r=new RegExp(/^([\s\S]*?)<script[^>]+?data-tcf="waiting-for-consent"[^>]+>(.+?)<\/script>([\s\S]*)$/i),o=r.exec(a);null!==o;){var d=document.createElement("script");d.setAttribute("type","text/plain"),d.textContent=o[2],a=o[1]+advads.privacy.decode_ad(d,!1)+o[3],o=r.exec(a)}try{if(t=a.match(/<script[^>]+src/)&&-1===a.indexOf(" async"),null===e)i=n()("head ");else if(!(i=n()("."+e)).length)return void this.injected--;if(t)this.blockme=!0,(i=s._inject_before(e,i)).each(function(){var e=n()(this);advads_postscribe(e,a,{beforeWriteToken:s.beforeWriteToken,afterAsync:function(){s.blockme=!1,s.injectBlocked()},done:function(){s.postscribeObservers.fire({event:"postscribe_done",ref:i,ad:a})},error:function(e){console.error(e),advanced_ads_pro.injected--}})});else{if(i=s._inject_before(e,i),-1!==a.indexOf("gform.initializeOnLoaded")){const e=document.createElement("DIV");e.innerHTML=a;const t=e.querySelector('input[type="submit"]');if(t){const a=t.getAttribute("onclick"),i=t.getAttribute("onkeypress"),s=t.id,n=document.createElement("SCRIPT");t.removeAttribute("onclick"),t.removeAttribute("onkeypress"),n.innerHTML=["click","keypress"].map(function(e){return`document.body.addEventListener("${e}", function(event){if (event.target && event.target.id === "${this.id}"){${this[e]}}})`},{id:s,click:a,keypress:i}).join(";"),e.append(n)}const i=e.querySelector("form"),s=i.getAttribute("action");s.includes("#gf")&&i.setAttribute("action",`${window.location.href.split("#")[0]}#${s.split("#")[1]}`),a=e.innerHTML}i.each(function(){var e=n()(this);advads_postscribe(e,a,{beforeWriteToken:s.beforeWriteToken,done:function(){s.postscribeObservers.fire({event:"postscribe_done",ref:i,ad:a})},error:function(e){console.error(e),advanced_ads_pro.injected--}})})}}catch(e){console.error(e),this.injected--}}},beforeWriteToken:function(e){if("startTag"===e.type)for(var a in e.attrs){var t=e.attrs[a];'{"'===t.substring(0,2)&&(t=t.replace(/\"/g,"""),e.attrs[a]=t)}return"atomicTag"===e.type&&e.src&&(e.src=e.src.replace(/&/g,"&")),e},loadAjaxAds:function(){if(!this.deferedAds.length)return advanced_ads_pro.observers.fire({event:"inject_ajax_ads",ad_ids:[]}
3090),void advanced_ads_pro.return_to_idle_injections_done();new Date;var e={action:"advads_ad_select",ad_ids:this.ads,deferedAds:this.deferedAds,consent:"undefined"==typeof advads?"not_needed":advads.privacy.get_state(),theId:window.advanced_ads_pro_ajax_object.the_id,isSingular:advanced_ads_pro_ajax_object.is_singular};document.dispatchEvent(new CustomEvent("advanced-ads-ajax-cb-payload",{detail:{payload:e}}));for(const e of this.deferedAds)this.ajaxAdArgsByElementId[e.elementId]=JSON.parse(e.ad_args);document.dispatchEvent(new CustomEvent("advads_ajax_ad_select",{detail:e})),this.deferedAds=[];const a=this;n().ajax({url:advanced_ads_pro_ajax_object.ajax_url,method:"POST",data:e,dataType:"json"}).done(function(e){var t={};if(Array.isArray(e)){advanced_ads_pro.observe_injections();for(var i=0;i<e.length;i++){var s=e[i];if(s.hasOwnProperty("status")&&"success"===s.status&&s.hasOwnProperty("item")&&s.item&&(s.inject_before&&advanced_ads_pro.inject_before.push({elementId:s.elementId,data:s.inject_before}),advanced_ads_pro.inject(s.elementId,s.item,!0),s.hasOwnProperty("ads")&&Array.isArray(s.ads)))for(var n=0;n<s.ads.length;n++)if(advanced_ads_pro.hasAd(s.ads[n].id,s.ads[n].type,s.ads[n].title,"ajax",s.elementId),"ad"===s.ads[n].type&&s.ads[n].tracking_enabled){var r=s.blog_id?s.blog_id:1;void 0===t[r]&&(t[r]=[]),t[r].push(s.ads[n].id)}s.status&&advanced_ads_pro.dispatchWrapperCBEvent(s.elementId,"error"===s.status,"ajax",{emptyCbOption:Boolean(a.ajaxAdArgsByElementId[s.elementId].cache_busting_empty)}),s.hasOwnProperty("method")&&"placement"===s.method&&advanced_ads_pro.observers.fire({event:"inject_placement",id:s.id,is_empty:!!s.item,cb_type:"ajax"})}advanced_ads_pro.observers.fire({event:"inject_ajax_ads",ad_ids:t}),window.advads_pro_utils.log("AJAX CB response\n",e),document.body.dispatchEvent(new CustomEvent("advads_ajax_cb_response",{detail:{response:e}})),advanced_ads_pro.return_to_idle_injections_done()}}).fail(function(){advanced_ads_pro.return_to_idle_injections_done()})},get_random_placements:function(e){return!1!==this.random_placements||(this.random_placements=[],window.advads_pro_utils.each_key(e,function(e,a){if("object"==typeof a){const e=window.advads_pro_utils.get_random_el_by_weight(a.placements);e&&this.random_placements.push(e)}},this)),this.random_placements},create_non_existent_arrays:function(){0===this.iterations&&(window.advads_pro_utils.each(["advads_passive_ads","advads_passive_groups","advads_passive_placements"],function(e){window.advads_pro_utils.isset(window[e])||(window[e]={})}),window.advads_pro_utils.each(["advads_placement_tests","advads_ajax_queries","advads_has_ads","advads_js_items"],function(e){window.advads_pro_utils.isset(window[e])||(window[e]=[])}))},process_passive_cb:function(){var e=this;e.create_non_existent_arrays(),window.advads_pro_utils.print_debug_arrays();var a=function(a){e.busy=!0,e.iterations++,e.lazy_load.clear(),e.adblocker_active=a,e.observe_injections(),window.advads_pro_utils.each(advads_has_ads,function(e){advanced_ads_pro.hasAd.apply(advanced_ads_pro,e)}),e.get_random_placements(advads_placement_tests),window.advads_pro_utils.each_key(window.advads_passive_ads,function(e,a){var t=(e+"").indexOf("_");-1!==t&&(e=e.slice(0,t)),window.advads_pro_utils.each(a.elementid,function(t){advanced_ads_pro.iterations>1&&n()("."+t).empty();var i=new Advads_passive_cb_Ad(a.ads[e],t);i.can_display()&&i.output({track:!0,inject:!0,do_has_ad:!0})})}),window.advads_pro_utils.each_key(window.advads_passive_groups,function(e,a){window.advads_pro_utils.each(a.elementid,function(e){advanced_ads_pro.iterations>1&&n()("."+e).empty(),new Advads_passive_cb_Group(a,e).output()})}),window.advads_pro_utils.each_key(window.advads_passive_placements,function(e,a){window.advads_pro_utils.each(a.elementid,function(t){advanced_ads_pro.iterations>1&&n()("."+t).empty();var i=new Advads_passive_cb_Placement(a,t);i.can_use_passive_cb()?advanced_ads_pro_ajax_object.lazy_load_module_enabled&&a.placement_info.lazy_load&&"enabled"===a.placement_info.lazy_load?advanced_ads_pro.lazy_load.add(t,"passive",{key:e,placement_id:a.placement_info.id}):i.output():advanced_ads_pro.load(i.ajax_query)})}),window.advads_pro_utils.isset(window.advads_js_items)&&window.advads_pro_utils.each_key(advads_js_items,function(e,a){advanced_ads_pro.iterations>1||window.advads_pro_utils.selector_exists(a.args)&&(a.inject_before&&advanced_ads_pro.inject_before.push({elementId:a.elementid,data:a.inject_before}),advanced_ads_pro.inject(a.elementid,a.output,!0),window.advads_pro_utils.each(a.has_js_items,function(e){advanced_ads_pro.hasAd(e.id,e.type,e.title),"ad"===e.type&&(advanced_ads_pro.passive_ads[e.blog_id]||(advanced_ads_pro.passive_ads[e.blog_id]=[]),advanced_ads_pro.passive_ads[e.blog_id].push(e.id))}))}),e.observers.fire({event:"inject_passive_ads",ad_ids:e.passive_ads}),e.passive_ads={},e.process_ajax_ads(advads_ajax_queries),e.lazy_load.enable()};"function"==typeof advanced_ads_check_adblocker?advanced_ads_check_adblocker(function(e){a(e)}):a(!1)},observe_injections:function(){advanced_ads_pro.injected_done>
30900||advanced_ads_pro.postscribeObservers.add(function(e){"postscribe_done"===e.event&&advanced_ads_pro.injected_done++})},return_to_idle_injections_done:function(){var e=1e3,a=setInterval(function(){e-=10,(advanced_ads_pro.injected_done>=advanced_ads_pro.injected||e<0)&&(advanced_ads_pro.injected=0,advanced_ads_pro.injected_done=0,advanced_ads_pro.busy=!1,clearInterval(a))},10)},process_ajax_ads:function(e){Array.isArray(e)&&window.advads_pro_utils.each(e,function(e){advanced_ads_pro.load(e)}),this.loadAjaxAds()},lazy_load:{lazy_map:{},did_init:!1,add:function(e,a,t){var i,s=document.getElementById(e);s&&(t.placement_id?i=t.placement_id:"placement"===t.ad_method&&(i=t.ad_id),this.lazy_map[e]={node:s,type:a,data:t,offset:this.get_offset(i)})},get_offset:function(e){var a=0;return advanced_ads_pro_ajax_object.lazy_load&&(a=advanced_ads_pro_ajax_object.lazy_load.offsets[e]?parseInt(advanced_ads_pro_ajax_object.lazy_load.offsets[e],10):parseInt(advanced_ads_pro_ajax_object.lazy_load.default_offset,10)),a},clear:function(){this.lazy_map={}},enable:function(){var e=this;e.did_init?n()(window).trigger("scroll"):(e._create_scroll_handler(),e.did_init=!0)},_create_scroll_handler:function(){var e=this,a=!0;function t(){var t=n()(window).height();window.advads_pro_utils.each_key(e.lazy_map,function(a,i){var s=i.node.getBoundingClientRect(),n=i.offset;s.top+n>=0&&s.bottom-n<=t&&e._display(a)}),a=!1}function i(e){var a=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return setTimeout(e,16)};a.call(window,e)}n()(window).on("scroll",function(){a||(a=!0,i(t))}),i(t)},_display:function(e){var a=this.lazy_map[e];if(a){if(delete this.lazy_map[e],"ajax"===a.type)advanced_ads_pro.deferedAds.push(a.data),advanced_ads_pro.process_ajax_ads();else{var t=window.advads_passive_placements[a.data.key];new Advads_passive_cb_Placement(t,e).output(),advanced_ads_pro.observers.fire({event:"inject_passive_ads",ad_ids:advanced_ads_pro.passive_ads}),advanced_ads_pro.passive_ads={}}advanced_ads_pro.busy=!1}}}};var d=i(960);const _={debug:window.location&&window.location.hash&&-1!==window.location.hash.indexOf("#debug=true"),each:function(e,a,t){var i,s=e&&e.length||0;for(i=0;i<s;i++)a.call(t,e[i],i)},each_key:function(e,a,t){var i;if("object"==typeof e)for(i in e)e.hasOwnProperty(i)&&a.call(t,i,e[i])},log:function(){if(this.debug&&this.isset(window.console)){var e=Array.prototype.slice.call(arguments);e.unshift("Advanced Ads CB:"),window.console.log.apply(window.console,e)}},print_debug_arrays:function(){0===advanced_ads_pro.iterations&&(this.log("passive_ads\n",window.advads_passive_ads),this.log("passive_groups\n",window.advads_passive_groups),this.log("passive_placements\n",window.advads_passive_placements),this.log("ajax_queries\n",window.advads_ajax_queries),this.log(window.Advads_passive_cb_Conditions.VISITOR_INFO_COOKIE_NAME+"\n",window.Advads_passive_cb_Conditions.get_stored_info()))},isset:function(e){return void 0!==e},isset_nested:function(e){for(var a=arguments.length,t=1;t<a;t++){if(!e||!e.hasOwnProperty(arguments[t]))return!1;e=e[arguments[t]]}return!0},is_numeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},get_random_number:function(e,a){var t=e-.5+Math.random()*(a-e+1);return Math.round(t)},get_random_el_by_weight:function(e,a){var t,i=0;if(a=void 0!==a&&a,"object"==typeof e){for(var s in e)s!==a&&e.hasOwnProperty(s)&&(i+=parseInt(e[s])||0);if(i<1)return null;for(var s in t=advads_pro_utils.get_random_number(1,i),e)if(s!==a&&e.hasOwnProperty(s)&&(t-=e[s])<=0)return s}},bind:function(e,a){return function(){return e.apply(a,arguments)}},shuffle_array:function(e){var a,t,i=e.length;if(!i)return e;for(;--i;)t=~~(Math.random()*(i+1)),a=e[i],e[i]=e[t],e[t]=a;return e},selector_exists:function(e){var a=e[e.inject_by&&"pro_custom_element"!==e.inject_by?"container_id":"pro_custom_element"];if(!a)return!0;var t=n()(a);return t.length?!(!advanced_ads_pro_ajax_object.moveintohidden&&!t.filter(":visible").length&&(advads_pro_utils.log("selector is hidden",a),1)):(advads_pro_utils.log("selector does not exist",a),!1)},deg2rad:function(e){return e*Math.PI/180},calculate_distance:function(e,t,i,s,n){n=n||"km",e=this.deg2rad(e),t=this.deg2rad(t),i=this.deg2rad(i);const r=(s=this.deg2rad(s))-t;a=Math.pow(Math.cos(i)*Math.sin(r),2)+Math.pow(Math.cos(e)*Math.sin(i)-Math.sin(e)*Math.cos(i)*Math.cos(r),2),b=Math.sin(e)*Math.sin(i)+Math.cos(e)*Math.cos(i)*Math.cos(r);const o=Math.atan2(Math.sqrt(a),b);return"mi"===n?3958.755865744*o:6371*o},extract_cookie_data(e){try{var a=JSON.parse(e)}catch(a){return e}return"object"!=typeof a?e:a.data}},c={element_ids:{},passiveRefresh:{},collectPassiveRefreshData:e=>{c.passiveRefresh[e.cb_id]=e},switchToPassive:e=>{const a=c.passiveRefresh[e];setTimeout(()=>{n()(`.${a.cb_id}`).empty(),c.launchRefresh(a)},parseInt(a.default_interval,10))},launchRefresh:e=>{new r({id:e.placement_info.id,type:e.type,ads:e.ads,placement_info:e.placement_info,group_info:e.group_info,group_wrap:e.group_wrap},e.cb_id).output()},add_query:(l=[],function(e,a){e.elementid;var t=(new Date).getTime()+a;l[t]=l[t]||[],l[t].push(e),setTimeout(function(){var e=(new Date).getTime(),a=[];for(const n in l)if(l.hasOwnProperty(n)&&e>n-1e3){for(var t=l[n],i=t.length,s=0;s<i;s++)a.push(t[s]);delete l[n]}advanced_ads_pro.process_ajax_ads(a)},a)}),find_float:function(e){var a=!1;return e.find("div").each(function(e,t){if("left"===this.style.float||"right"===this.style.float)return a=this.style.float,!1}),a},prepare_wrapper:function(e,a,t){t||(this.maybe_increase_sizes(e),e.empty()),this.set_float(e,a)},maybe_increase_sizes:function(e){var a=e.css("float");-1===["left","right"].indexOf(a)&&(a=!1);var t={};if(a){var i=parseInt(e.css("min-width"),10)||0,s=e.prop("scrollWidth")||0;s>i&&(t["min-width"]=s)}var n=parseInt(e.css("min-height"),10)||0,r=e.prop("scrollHeight")||0;r>n&&(t["min-height"]=r),(t["min-height"]||t["min-width"])&&e.css(t)},set_float:function(e,a){-1===["left","right"].indexOf(a)&&(a=!1),a!==(e.data("prev_float")||!1)&&(e.data("prev_float",a),a?e.css({"min-width":"","min-height":"",float:a}):e.css({"min-width":"","min-height":"",float:""}))}};var l;const p=()=>{const e={},a={};let t=null,i=0;const s=e=>{const a={};
3090return e.classList.forEach(e=>{if(e.startsWith("gas_fallback-")){const t=e.split("-");a.ad=t[1],a.fallback=t[2]}}),a},n=e=>{if(!advancedAds.adHealthNotice.enabled||!document.getElementById("wpadminbar"))return;const a=document.getElementById("wp-admin-bar-advanced_ads_ad_health_fine");a?.remove();const t=document.getElementById("wp-admin-bar-advanced_ads_ad_health").querySelector("ul"),i=document.createElement("li");i.role="group",i.id="wp-admin-bar-advanced_ads_gads_fallback";const s=document.createElement("div");s.className="ab-item ab-empty-item",s.role="menuitem",s.textContent=window.advancedAds.adHealthNotice.pattern.replace("[ad_title]",e.ads[parseInt(e.placement_info.item.split("_")[1],10)].title),t.appendChild(i),i.appendChild(s)},r=e=>Object.values(window.advads_passive_placements).find(a=>0===a.elementid.indexOf(e))||!1,o=e=>void 0!==a[e]&&a[e],d=(e,a)=>e.ads[a]||!1;document.addEventListener("advanced_ads_pro_adsense_unfilled",a=>{i--,0===i&&t.disconnect();const _=s(a.detail.ad.closest('[class^="gas_fallback-"]'));e[_.ad]&&(e=>{const a=r(e.cbId)||o(e.cbId);a&&(((e,a)=>{const t=e.fallback.split("_");if("ad"===t[0]){const i=d(a,t[1]);if(!i)return;const s=new window.Advads_passive_cb_Ad(i,e.cbId);e.wrapper.remove(),s.output({track:!0,inject:!0,do_has_ad:!0})}
3090if("group"===t[0]){a.id=parseInt(t[1],10),a.type="group",a.group_info=a.adsense_fallback_group_info;const i=new window.Advads_passive_cb_Group(a,e.cbId);e.wrapper.remove(),i.output()}})(e,a),n(a))})(e[_.ad])}),document.body.addEventListener("advads_ajax_cb_response",({detail:e})=>{e.response.forEach(e=>{a[e.elementId]=e})}),window.advanced_ads_ready(()=>{window.advanced_ads_pro&&window.advanced_ads_pro.postscribeObservers.add(a=>{if("postscribe_done"!==a.event)return;if(-1===a.ad.indexOf("gas_fallback-"))return;const n=a.ref[0],r=n.querySelector('[class^="gas_fallback-"]'),o=s(r);var d;e[o.ad]={fallback:o.fallback,wrapper:r,cbId:n.id},d=r.querySelector("ins"),null===t&&(t=new window.MutationObserver(e=>{for(const a of e){if("unfilled"!==a.target.getAttribute("data-ad-status"))return;document.dispatchEvent(new CustomEvent("advanced_ads_pro_adsense_unfilled",{detail:{ad:a.target}}))}})),t.observe(d,{attributeFilter:["data-ad-status"]}),i++})})};window.advanced_ads_pro=o,(0,d.K)(),window.Advads_passive_cb_Placement=r,window.Advads_passive_cb_Ad=class{constructor(e,a){if("object"!=typeof e||!advads_pro_utils.isset(e.id)||!advads_pro_utils.isset(e.title)||!advads_pro_utils.isset(e.content))throw new SyntaxError("Can not create Advads_passive_cb_Ad obj");this.id=e.id,this.title=e.title,this.content=e.content?e.content:"",this.type=e.type,this.expiry_date=parseInt(e.expiry_date)||0,this.visitors=e.visitors,this.once_per_page=e.once_per_page,this.elementid=a||null,this.day_indexes=e.day_indexes?e.day_indexes:null,this.debugmode=e.debugmode,this.tracking_enabled=void 0===e.tracking_enabled||!0===e.tracking_enabled,this.blog_id=e.blog_id?e.blog_id:"",this.privacy=e.privacy?e.privacy:{},this.position=e.position?e.position:"",document.dispatchEvent(new CustomEvent("advanced-ads-passive-cb-ad-info",{detail:{ad:this,adInfo:e}}))}output(e){if(e=e||{},this.debugmode){var a=this.can_display({ignore_debugmode:!0})?"displayed":"hidden",t=n()(this.content).find(".advads-passive-cb-debug").data(a);this.content=this.content.replace("##advanced_ads_passive_cb_debug##",t)}if(e.do_has_ad&&advanced_ads_pro.hasAd(this.id,"ad",this.title,"passive"),e.track&&this.tracking_enabled&&(advanced_ads_pro.passive_ads[this.blog_id]||(advanced_ads_pro.passive_ads[this.blog_id]=[]),advanced_ads_pro.passive_ads[this.blog_id].push(this.id)),advads_pro_utils.log("output passive ad",this.id,this.elementid,this.content),!e.inject)return this.content;advanced_ads_pro.inject(this.elementid,this.content)}can_display(e){if(e=e||{},this.debugmode&&!e.ignore_debugmode)return!0;if(""===this.content.trim())return advads_pro_utils.log("passive ad id",this.id,"cannot be displayed: empty content"),!1;if(!this.can_display_by_visitor())return advads_pro_utils.log("passive ad id",this.id,"cannot be displayed: by_visitor"),!1;if(!this.can_display_by_expiry_date())return advads_pro_utils.log("passive ad id",this.id,"cannot be displayed: by_expiry_date"),!1;if(!this.can_display_by_timeout())return advads_pro_utils.log("passive ad id",this.id,"cannot be displayed: by_timeout"),!1;if(!this.can_display_by_display_limit())return advads_pro_utils.log("passive ad id",this.id,"cannot be displayed: by_display_limit"),!1;if(!this.can_display_by_weekday())return advads_pro_utils.log("passive ad id",this.id,"cannot be displayed: by_weekday"),!1;if(!this.can_display_by_cfp())return advads_pro_utils.log("passive ad id",this.id,"cannot be displayed: by_cfp"),!1;if(!this.can_display_by_consent())return advads_pro_utils.log("passive ad id",this.id,"cannot be displayed: by_consent"),!1;const a={display:!0};return document.dispatchEvent(new CustomEvent("advanced-ads-passive-cb-can-display",{detail:{canDisplay:a,checkOptions:e,adInfo:this}})),a.display}can_display_by_visitor(){if(!Array.isArray(this.visitors)||0===this.visitors.length)return!0;window.Advads_passive_cb_Conditions.init();for(var e,a=0,t=!1,i=0;i<this.visitors.length;++i)if(e=this.visitors[a],t&&"or"===e.connector)a++;else if(t=window.Advads_passive_cb_Conditions.frontend_check(e,this))a++;else if(a++,!this.visitors[a]||"or"!==this.visitors[a].connector)return!1;return!0}can_display_by_expiry_date(){return this.expiry_date<=0||this.expiry_date>~~((new Date).getTime()/1e3)}can_display_by_weekday(){if(!this.day_indexes)return!0;var e=new Date,a=window.advanced_ads_pro_ajax_object.wp_timezone_offset/60,t=a/60>=0?Math.floor(a/60):Math.ceil(a/60);return(a=e.getUTCMinutes()+a%60)>60&&(t++,a%=60),e.setHours(e.getUTCHours()+t),e.setMinutes(a),n().inArray(e.getDay(),this.day_indexes)>=0}can_display_by_timeout(){return!advads_pro_utils.isset(advads.get_cookie("timeout_"+this.id
3090))}can_display_by_display_limit(){if(this.once_per_page)for(var e=advanced_ads_pro.ads.length,a=0;a<e;a++)if("ad"===advanced_ads_pro.ads[a].type&&parseInt(advanced_ads_pro.ads[a].id,10)===this.id)return!1;return!0}can_display_by_cfp(){for(const e of this.visitors)if("ad_clicks"===e.type&&e["exclude-from-global"])return!0;return!advads.get_cookie("advads_pro_cfp_ban")}can_display_by_consent(){if(!advads.privacy||this.privacy.ignore||"adsense"===this.type&&advads.privacy.is_adsense_npa_enabled()||("image"===this.type||"dummy"===this.type)&&!this.privacy.needs_consent)return!0;var e=advads.privacy.get_state();return"accepted"===e||"not_needed"===e}},window.Advads_passive_cb_Group=class{constructor(e,a){if(!(advads_pro_utils.isset(e.group_info.id)&&advads_pro_utils.isset(e.group_info.type)&&advads_pro_utils.isset(e.group_info.weights)&&advads_pro_utils.isset(e.group_info.ordered_ad_ids)&&advads_pro_utils.isset(e.group_info.ad_count)&&advads_pro_utils.isset(e.ads)))throw new SyntaxError("Can not create Advads_passive_cb_Group obj");this.id=e.group_info.id,this.name=e.group_info.name?e.group_info.name:this.id,this.type=e.group_info.type,this.weights=e.group_info.weights,this.ordered_ad_ids=e.group_info.ordered_ad_ids,this.ad_count=e.group_info.ad_count,this.elementid=a||null,this.slider_options=!!advads_pro_utils.isset(e.group_info.slider_options)&&e.group_info.slider_options,this.refresh_enabled=advads_pro_utils.isset(e.group_info.refresh_enabled),advads_pro_utils.isset(e.group_info.refresh_interval_for_ads)?this.refresh_interval=e.group_info.refresh_interval_for_ads:advads_pro_utils.isset(e.group_info.refresh_interval)?this.refresh_interval=e.group_info.refresh_interval:this.refresh_interval=2e3,this.placement=e instanceof Advads_passive_cb_Placement&&e,this.random=e.group_info.random,this.ads=e.ads,this.group_wrap=e.group_wrap,this.is_empty=!0}output(){var e=this.placement&&this.placement.get_ad_for_adblocker();if(advanced_ads_pro.hasAd(this.id,"group",this.name,"passive"),!e&&this.refresh_enabled)return void this.output_refresh();var a,t=0,i=[];const s=this.placement&&this.placement.get_group_for_adblocker();switch(s&&(this.ads=s.ads),this.type){case"ordered":case"slider":a=this.shuffle_ordered_ads(this.ordered_ad_ids,this.weights);break;case"grid":a=this.random?this.shuffle_ads():this.shuffle_ordered_ads(this.ordered_ad_ids,this.weights);break;default:a=this.shuffle_ads()}if(Array.isArray(a)&&n().isPlainObject(this.ads)){for(var r=0;r<a.length;r++)if(this.ads.hasOwnProperty(a[r])){var o=this.ads[a[r]];if("object"==typeof o){var d=new Advads_passive_cb_Ad(o,this.elementid);if(d.can_display()){e&&(d=e);const a=!advads.privacy||"unknown"!==advads.privacy.get_state();"slider"===this.type&&this.slider_options||this.group_wrap?i.push(d.output({track:a,inject:!1,do_has_ad:!0})):d.output({track:a,inject:!0,do_has_ad:!0}),t++,this.is_empty=!1}}if(t===this.ad_count)break;if(!this.is_empty&&e)break}i.length&&("slider"===this.type&&this.slider_options&&(i=this.output_slider(i)),advanced_ads_pro.inject(this.elementid,this.add_group_wrap(i,t)))}}output_refresh(){var e=this.ordered_ad_ids,a=[],t=this,i=!1,s=[],r=0,o=(this.refresh_interval,n()("."+t.elementid));function d(e){if(n().inArray(e.id,s)<0&&e.tracking_enabled){var a={};a[e.blog_id]=[e.id],advanced_ads_pro.observers.fire({event:"inject_passive_ads",ad_ids:a})}}function _(e){return"object"!=typeof t.refresh_interval?parseInt(t.refresh_interval,10)||2e3:parseInt(t.refresh_interval[e],10)||2e3}function c(e){var a="";return advads_pro_utils.isset_nested(t.placement,"placement_info","options","placement_position")&&(a=t.placement.placement_info.options.placement_position),-1===["left","right"].indexOf(a)&&(a=e.position),a}o=advanced_ads_pro._inject_before(this.elementid,o),Array.isArray(e)&&n().isPlainObject(this.ads)&&function l(){for(var p=function(){var a;if("ordered"===t.type)if(-1!==(a=e.indexOf(i)))var s=e.slice(a+1).concat(e.slice(0,a));else s=e;else-1!==(a=(s=t.shuffle_ads()).indexOf(i))&&s.splice(a,1);return s}(),T=p.length,u=0;u<T;u++){var b=p[u],v=t.ads[b];if("object"==typeof v){var h=new Advads_passive_cb_Ad(v,t.elementid);if(h.can_display()){if(0===r)a=[h.output({track:!0,inject:!1,do_has_ad:!0})],advanced_ads_group_refresh.prepare_wrapper(o,c(h),!0);else{var f=n().inArray(b,s)<0;a=[h.output({track:!1,inject:!1,do_has_ad:f})],d(h),advanced_ads_group_refresh.prepare_wrapper(o,c(h),!1)}s.push(h.id),advanced_ads_pro.inject(t.elementid,t.add_group_wrap(a,1)),t.is_empty=!1,r++,setTimeout(function(){t.placement&&!t.placement.can_display()||l()},_(b)),i=h.id;break}}}}()}add_group_wrap(e,a){if(!e.length)return"";var t="",i="";if(this.group_wrap)for(var s=0;s<this.group_wrap.length;s++){var n=this.group_wrap[s];if(n.min_ads=n.min_ads||1,!("object"!=typeof n||n.min_ads>a))if(n.before&&(t=n.before+t),n.after&&(i+=n.after),"string"==typeof n.each)for(var r=0;r<e.length;r++)e[r]=n.each.replace("%s",e[r]);else if("object"==typeof n.each){var o=n.each;for(r=0;r<e.length;r++){for(var d in o){var _=!1;if(o.hasOwnProperty(d)&&"all"!==d&&(1+r)%parseInt(d,10)===0){e[r]=o[d].replace("%s",e[r]),_=!0;break}}!_&&o.all&&(e[r]=o.all.replace("%s",e[r]))}}}return t+e.join("")+i}output_slider(e){var a;return e.length>1&&"function"==typeof n().fn.unslider&&(a=e.join("</li><li>"),(e=[]).push('<div id="'+this.slider_options.slider_id+'" class="'+this.slider_options.init_class+" "+this.slider_options.prefix+'slider"><ul><li>'),e.push(a),e.push("</li></ul></div>"),e.push("<script>jQuery(function() { jQuery('."+this.slider_options.init_class+"').unslider({ "+this.slider_options.settings+" }); });<\/script>")),e}shuffle_ordered_ads(e,a){const t=[];for(var i=0;i<e.length;i++){var s=a[e[i]];if(!s)return e;t.push(s)}var n=t.length,r=0;for(i=1;i<=n;i++)if(i==n||t[i]!==t[i-1]){var o=i-r;if(1!==o){var d=advads_pro_utils.shuffle_array(e.slice(r,r+o)),_=[r,o].concat(d);Array.prototype.splice.apply(e,_)}r=i}return e}shuffle_ads(){const e=[],a=n().extend({},this.weights);
3090let t=advads_pro_utils.get_random_el_by_weight(a);for(;null!==t;)delete a[t],e.push(parseInt(t,10)),t=advads_pro_utils.get_random_el_by_weight(a);return e}},window.advads_pro_utils=_,window.advanced_ads_group_refresh=c,n()(()=>{p()}),"undefined"!=typeof advads&&void 0!==advads.privacy.dispatch_event?document.addEventListener("advanced_ads_privacy",function(e){if("unknown"===e.detail.previousState||"rejected"===e.detail.previousState&&"accepted"===e.detail.state){if(_.log("reload ads! transition from "+e.detail.previousState+" to "+e.detail.state),"accepted"===e.detail.state||"not_needed"===e.detail.state){var a='script[type="text/plain"][data-tcf="waiting-for-consent"]';document.querySelectorAll(a).forEach(function(e){o.passive_ads.hasOwnProperty(e.dataset.bid)||(o.passive_ads[e.dataset.bid]=[]),o.passive_ads[e.dataset.bid].push(parseInt(e.dataset.id,10)),advads.privacy.decode_ad(e)}),new MutationObserver(function(e){var t={},i=function(e){void 0!==e.dataset.noTrack&&"impressions"===e.dataset.noTrack||(t.hasOwnProperty(e.dataset.bid)||(t[e.dataset.bid]=[]),t[e.dataset.bid].push(parseInt(e.dataset.id,10))),advads.privacy.decode_ad(e)};e.forEach(function(e){e.addedNodes.forEach(function(e){void 0===e.tagName||void 0===e.dataset||"script"!==e.tagName.toLowerCase()||"waiting-for-consent"!==e.dataset.tcf?void 0!==e.dataset&&"waiting-for-consent"===e.dataset.tcf||document.querySelectorAll(a).forEach(i):i(e)})}),Object.keys(t).length&&o.observers.fire({event:"advanced_ads_decode_inserted_ads",ad_ids:t})}).observe(document,{subtree:!0,childList:!0})}o.busy?document.addEventListener("advanced_ads_pro.idle",o.process_passive_cb,{once:!0}):o.process_passive_cb()}else _.log("no action! transition from "+e.detail.previousState+" to "+e.detail.state)}):(window.advanced_ads_ready||n()(document).ready).call(null,function(){o.process_passive_cb()}),n()(document).on("advanced-ads-resize-window",function(){const e=function(){let e=o.ads.length;for(;e--;)"off"!==o.ads.cb_method&&o.ads.splice(e,1);o.process_passive_cb()};o.busy?document.addEventListener("advanced_ads_pro.idle",e,{once:!0}):e()}),document.addEventListener("advads_pro_cache_busting_done",e=>{if(!e.detail.isEmpty||!e.detail.extra.emptyCbOption)return;let a=document.getElementById(e.detail.elementId);a&&(a.parentNode&&a.parentNode.classList.contains("widget")&&(a=a.parentNode),a.remove())}),o.observers.add(e=>{-1===["inject_passive_ads","inject_ajax_ads"].indexOf(e.event)||Array.isArray(e.ad_ids)&&!e.ad_ids.length||(()=>{const e=document.getElementById("wp-admin-bar-advanced_ads_ad_health_highlight_ads");if(!e)return;const a=e.querySelector(".highlighted_ads_count");a&&(a.innerText=document.querySelectorAll(`.${window.advancedAds.frontendPrefix}highlight-wrapper`).length)})()})})();; 3091/** 3092 * Process ads with cache busting 'On' 3093 */ 3094var advanced_ads_layer_cache_busting; 3095if ( ! advanced_ads_layer_cache_busting ) { 3096 advanced_ads_layer_cache_busting = { 3097 doc_loaded: false, 3098 bufferedAds: [], 3099 3100 flush: function() { 3101 var _bufferedAds = this.bufferedAds; 3102 this.bufferedAds = []; 3103 3104 for ( var i = 0; i < _bufferedAds.length; i++ ) { 3105 this._process_item( jQuery( _bufferedAds[i] ) ); 3106 3107 } 3108 3109 }, 3110 3111 _process_item: function( banner ) { 3112 var banner_id = banner.attr('id'); 3113 3114 advads_items.conditions[banner_id] = advads_items.conditions[banner_id] || {}; 3115 3116 // advads_layer_center_if_not_sticky ( banner ) 3117 3118 if (banner.hasClass('advads-effect') ) { 3119 advads_layer_gather_effects(banner_id); 3120 } 3121 3122 if ( ! banner.hasClass( 'use-fancybox' ) ) { 3123 advads_layer_gather_background( banner_id ); 3124 } 3125 3126 advads_layer_gather_auto_close( banner ); 3127 3128 // display onload ad right away 3129 if (banner.hasClass(advanced_ads_layer_settings.layer_class + '-onload')) { 3130 advads_items.conditions[banner_id].scrolloffset = true; 3131 advads_check_item_conditions(banner_id); 3132 // exit popup (if the user leaves the page) 3133 } else if (banner.hasClass(advanced_ads_layer_settings.layer_class + '-exit')) { 3134 ouibounce(banner[0], { 3135 // the modal will fire any time the page is reloaded, for the same user 3136 aggressive: true, 3137 // amount of time that firing is surpressed for 3138 timer: 0, 3139 callback: function() { 3140 // reset display to none after Ouibounce 3141 banner.css('display', 'none'); 3142 advads_items.conditions[banner_id].scrolloffset = true; 3143 advads_check_item_conditions(banner_id); 3144 } 3145 }); 3146 // display after delay of n seconds 3147 } else if ( banner.hasClass( advanced_ads_layer_settings.layer_class + '-delay' ) ) {
3148 var delay = ( parseInt( banner.attr( 'data-advads-layer-delay' ), 10 ) ) || 0; 3149 setTimeout( function() { 3150 advads_items.conditions[banner_id].delay_expired = true; 3151 advads_check_item_conditions(banner_id); 3152 }, delay ); 3153 // ad depends on scrolling 3154 } else { 3155 // calculate scroll length (document height - window height) 3156 var advads_scrollhalf = (jQuery(document).height() - jQuery(window).height()) / 2; 3157 3158 var scroll_handler = function ( event ) { 3159 if ( jQuery.inArray( banner_id, advads_items.showed ) !== -1 ) { 3160 //console.log( 'off scroll event' ) 3161 jQuery( window ).off( 'scroll', scroll_handler ); 3162 return; 3163 } 3164 3165 // display scroll ads right after scrolling stopped 3166 if ( banner.hasClass( advanced_ads_layer_settings.layer_class + '-stop' ) ) { 3167 advads_items.conditions[banner_id].scrolloffset = true; 3168 advads_check_item_conditions( banner_id ); 3169 } 3170 3171 // display ads after half the page was scrolled 3172 if ( jQuery( document ).scrollTop() >= advads_scrollhalf) { 3173 if ( banner.hasClass( advanced_ads_layer_settings.layer_class + '-half' ) ) { 3174 advads_items.conditions[banner_id].scrolloffset = true; 3175 advads_check_item_conditions(banner_id); 3176 } 3177 } 3178 3179 // display ads after custom scroll offset 3180 if ( banner.hasClass( advanced_ads_layer_settings.layer_class + '-offset' ) ) { 3181 var custom_offset = advads_extract_custom_offset_from_class( '#' + banner_id ); 3182 if ( jQuery( document ).scrollTop() >= custom_offset ) { 3183 advads_items.conditions[banner_id].scrolloffset = true; 3184 advads_check_item_conditions( banner_id ); 3185 } 3186 } 3187 } 3188 3189 3190 jQuery( window ).onEnd( 'scroll', scroll_handler, 100); 3191 } 3192 3193 }, 3194 3195 observe: function (event) { 3196 if ( event.event === 'postscribe_done' && event.ref && event.ad ) { 3197 var banner = jQuery( event.ref ).children( 'div' ); 3198 if ( ! banner.hasClass( advanced_ads_layer_settings.layer_class + '' ) ) { 3199 return; 3200 } 3201 3202 if ( advanced_ads_layer_cache_busting.doc_loaded ) { 3203 advanced_ads_layer_cache_busting.bufferedAds.push( banner ); 3204 advanced_ads_layer_cache_busting.flush(); 3205 } 3206 } 3207 }, 3208 } 3209} 3210 3211// Advanced Ads Pro is enabled 3212if ( typeof advanced_ads_pro === 'object' && advanced_ads_pro !== null ) { 3213 // observe cache busting done event 3214 advanced_ads_pro.postscribeObservers.add( advanced_ads_layer_cache_busting.observe ); 3215} 3216 3217/** 3218 * Process ads with cache busting 'Off' 3219 */ 3220var layers = function() { 3221 advanced_ads_layer_cache_busting.doc_loaded = true; 3222 3223 jQuery('.' + advanced_ads_layer_settings.layer_class).each(function () { 3224 advanced_ads_layer_cache_busting.bufferedAds.push(jQuery(this)); 3225 }); 3226 3227 advanced_ads_layer_cache_busting.flush(); 3228}; 3229 3230if (typeof advads !== 'undefined' && typeof advads.privacy.dispatch_event !== 'undefined') { 3231 document.addEventListener('advanced_ads_privacy', function (event) { 3232 if ( 3233 (event.detail.state === 'accepted' || event.detail.state === 'not_needed') 3234 && window.advanced_ads_layer_settings.placements !== null 3235 ) { 3236 window.advanced_ads_layer_settings.placements.forEach(function (value) { 3237 document.querySelectorAll('script[type="text/plain"][data-tcf="waiting-for-consent"][data-placement="' + value + '"]').forEach(advads.privacy.decode_ad); 3238 }); 3239 } 3240 3241 layers(); 3242 }); 3243} else { 3244 ( window.advanced_ads_ready || jQuery( document ).ready ).call( null, function() { 3245 layers(); 3246 }); 3247} 3248 3249/** 3250 * adjust position for centered layer banner if not added by the sticky plugin 3251 * @param {string} $ad jQuery object (wrapped set) 3252 */ 3253function advads_layer_center_if_not_sticky( $ad ) { 3254 if ($ad.hasClass('is-sticky')) { 3255 return; 3256 } 3257 /* 3258 var left = ( jQuery( window ).width() - ad.width() ) / 2; 3259 var top = ( jQuery( window ).height() - ad.height() ) / 2; 3260 ad.css('left', left); 3261 ad.css('top', top); 3262 ad.css('position', 'fixed'); 3263 */ 3264 3265 var width = parseInt($ad.attr('data-width'), 10); 3266 var height = parseInt($ad.attr('data-height'), 10); 3267 3268
3269 var is_transform_supported = getSupportedTransform(); 3270 3271 var transform_property = ''; 3272 if (!height) { 3273 if (is_transform_supported) { 3274 transform_property += 'translateY(50%) '; 3275 } else { 3276 jQuery($ad).css({'top': '0', 'bottom': 'auto'}); 3277 } 3278 } 3279 if (!width) { 3280 if (is_transform_supported) { 3281 transform_property += 'translateX(-50%) '; 3282 } else { 3283 jQuery($ad).css({'left': '0', 'right': 'auto'}); 3284 } 3285 3286 } 3287 if (transform_property) { 3288 set_ad_transform($ad, transform_property); 3289 } 3290} 3291 3292/** 3293 * gather information about display effects and duration 3294 * @param {string} id of the ad, without # 3295 */ 3296function advads_layer_gather_effects(id) { 3297 var banner = jQuery('#' + id); 3298 // display effect duration 3299 advads_items.effect_durations[id] = advads_extract_duration_from_class(banner); 3300 // load display effects 3301 if (banner.hasClass('advads-effect-fadein')) { 3302 advads_items.display_effect_callbacks[id] = 'advads_display_effect_fadein'; 3303 }; 3304 if (banner.hasClass('advads-effect-show')) { 3305 advads_items.display_effect_callbacks[id] = 'advads_display_effect_show'; 3306 }; 3307 if (banner.hasClass('advads-effect-slide')) { 3308 advads_items.display_effect_callbacks[id] = 'advads_display_effect_slide'; 3309 }; 3310} 3311 3312/** 3313 * gather information about background 3314 * @param {string} id of the ad, without # 3315 */ 3316function advads_layer_gather_background(id) { 3317 var banner = jQuery('#' + id); 3318 // add display callback to the ads with background 3319 if (banner.hasClass('advads-has-background') && banner.is(':hidden')) { 3320 if (!advads_items.display_callbacks[id] != 'undefined') { 3321 advads_items.display_callbacks[id] = {}; 3322 var length = 0; 3323 } else { 3324 var length = advads_items.display_callbacks[id].length; 3325 } 3326 3327 advads_items.display_callbacks[id][length] = 'advads_layer_display_background_callback'; 3328 } 3329} 3330 3331/** 3332 * Gather auto close info and schedule auto close. 3333 * 3334 * @param {obj} $banner A jQuery object representing the banner wrapper. 3335 */ 3336function advads_layer_gather_auto_close( $banner ) { 3337 var delay = parseInt( $banner.data( 'auto-close-delay'), 10 ); 3338 if ( ! delay ) { return; } 3339 var banner_id = $banner.attr('id'); 3340 advads_items.display_callbacks[ banner_id ] = advads_items.display_callbacks[ banner_id ] || {}; 3341 advads_items.display_callbacks[ banner_id ].auto_close = function( banner_id ) { 3342 setTimeout( function() { 3343 advads_layer_close_item( banner_id ); 3344 }, delay ); 3345 } 3346} 3347 3348/** 3349 * check if background can be removed 3350 * 3351 * @param {string} id id of the ad, without # 3352 * @returns {bool} true, if background can be removed 3353 */ 3354function can_remove_background(item) { 3355 advads_items.backgrounds[ item ] = false; 3356 var remove = true; 3357 jQuery.each( advads_items.backgrounds, function( i, val ) { 3358 if ( val == true ) { 3359 //if ( advads_items.conditions.hasOwnProperty(i) && advads_items.conditions[i].scrolloffset == true ) { 3360 remove = false; 3361 //break the loop 3362 return false; 3363 //} 3364 } 3365 }); 3366 return remove; 3367} 3368 3369/**
3370 * check item conditions and display the ad if all conditions are true 3371 * 3372 * @param {string} id id of the ad, without # 3373 * @returns {bool} true, if item can be displayed 3374 */ 3375function advads_check_item_conditions(id) { 3376 var item = jQuery('#' + id); 3377 if (item.length == 0) { 3378 return; 3379 } 3380 3381 var display = true; 3382 jQuery.each(advads_items.conditions[id], function (method, flag) { 3383 if (flag === false) { 3384 // display the banner 3385 display = false; 3386 } 3387 }); 3388 3389 if ( display ) { 3390 advads_items.showed.push(id); 3391 3392 item.trigger( advanced_ads_layer_settings.layer_class + '-trigger' ); 3393 3394 if ( item.hasClass('use-fancybox') ) { 3395 fancybox_display (id); 3396 } else { 3397 var ad = jQuery('#' + id); 3398 3399 // responsive CSS as we don't have CSS file. 3400 switch( ad.attr('data-position') ) { 3401 case 'topcenter': 3402 case 'topright': 3403 case 'center': 3404 case 'centerright': 3405 case 'bottomright': 3406 case 'bottomcenter': 3407 if ( ! parseInt( ad.attr( 'data-width' ), 10 ) ) { 3408 if ( jQuery( window ).width() > 768 ) { 3409 ad.css( 'width', 'auto' ); 3410 } 3411 } 3412 break; 3413 } 3414 3415 // TODO: Remove this block after verifying no issues in v2.1 or later. 3416 3417 /*var width = parseInt( ad.attr( 'data-width' ), 10 ); 3418 var height = parseInt( ad.attr( 'data-height' ), 10 ); 3419 var is_transform_supported = getSupportedTransform(); 3420 3421 switch ( jQuery(ad).attr('data-position') ) { 3422 case 'topcenter': 3423 if ( ! width ) { 3424 if ( is_transform_supported ) { 3425 set_ad_transform(ad, 'translateX(-50%)'); 3426 } else { 3427 jQuery( ad ).css({ 'left':'0', 'right':'auto', 'top':'0', 'bottom':'auto' }); 3428 } 3429 } 3430 break; 3431 case 'centerleft': 3432 if ( ! height ) { 3433 if ( is_transform_supported ) { 3434 set_ad_transform(ad, 'translateY(50%)'); 3435 } else { 3436 jQuery( ad ).css({ 'left':'0', 'right':'auto', 'top':'0', 'bottom':'auto' }); 3437 } 3438 } 3439 break; 3440 case 'center': 3441 var transform_property = ''; 3442 if ( ! height ) { 3443 if ( is_transform_supported ) { 3444 transform_property += 'translateY(50%) '; 3445 } else { 3446 jQuery( ad ).css({ 'top':'0', 'bottom':'auto' }); 3447 } 3448 } 3449 if ( ! width ) { 3450 if ( is_transform_supported ) { 3451 transform_property += 'translateX(-50%) '; 3452 } else { 3453 jQuery( ad ).css({ 'left':'0', 'right':'auto' }); 3454 } 3455 3456 } 3457 if (transform_property) { 3458 set_ad_transform(ad, transform_property); 3459 } 3460 break; 3461 case 'centerright': 3462 if ( ! height ) { 3463 if ( is_transform_supported ) { 3464 set_ad_transform(ad, 'translateY(50%)'); 3465 } else { 3466 jQuery( ad ).css({ 'left':'0', 'right':'auto', 'top':'0', 'bottom':'auto' }); 3467 } 3468 3469 } 3470 break; 3471 case 'bottomcenter': 3472 if ( ! width ) { 3473 if ( is_transform_supported ) { 3474 set_ad_transform(ad, 'translateX(-50%)'); 3475 } else { 3476 jQuery( ad ).css({ 'left':'0', 'right':'auto', 'top':'0', 'bottom':'auto' }); 3477 } 3478 3479 } 3480 break; 3481 } */ 3482 3483 advads_layer_call_display_callbacks( id ); 3484 3485 if (advads_items.display_effect_callbacks[id] == undefined) { 3486 ad.show(); 3487 } else { 3488 var callback = window[advads_items.display_effect_callbacks[id]]; 3489 callback(id); 3490 } 3491 } 3492 } 3493} 3494 3495/** 3496 * shows the ad using fancybox plugin 3497 * 3498 * @param {string} id id of the ad, without # 3499 */ 3500function fancybox_display(id) { 3501 var banner = jQuery('#' + id); 3502 3503 var settings = { 3504 'speedIn' : 0, 3505 'speedOut' : 0, 3506 'showCloseButton' : true, 3507 'hideOnOverlayClick' : banner.hasClass( 'advads-background-click-close' ), 3508 'centerOnScroll' : true, 3509 //'autoScale' : false, 3510 //'autoDimensions' : false, 3511 'margin' : 20, 3512 'padding' : 10, 3513 'onClosed': function() { 3514 if ( typeof advads_items.close_functions[ id ] === 'function' ) { 3515 advads_items.close_functions[ id ](); 3516 } 3517 }, 3518 // Once the content is displayed. 3519 'onComplete': function() { 3520 advads_layer_call_display_callbacks( id ); 3521 }, 3522 } 3523 3524 if (advads_items.display_effect_callbacks[id] == undefined) { 3525 settings['transitionIn'] = 'none'; 3526 } else { 3527 var callback = advads_items.display_effect_callbacks[id]; 3528 switch ( callback ) { 3529 case 'advads_display_effect_fadein': 3530 settings['transitionIn'] = 'fade'; 3531 break; 3532 case 'advads_display_effect_show': 3533 settings['transitionIn'] = 'elastic'; 3534 break; 3535 default: 3536 settings['transitionIn'] = 'none'; 3537 } 3538 } 3539 3540 if ( ! banner.hasClass('advads-has-background') ) { 3541 settings['overlayShow'] = false;
3542 } 3543 3544 if ( ! banner.hasClass('advads-close') ) { 3545 settings['showCloseButton'] = false; 3546 } 3547 // extract duration of the transitionIn effect 3548 var speedIn = advads_extract_duration_from_class(banner); 3549 settings['speedIn'] = ( speedIn ) ? speedIn : 0; 3550 3551 var position = jQuery(banner).attr('data-position'); 3552 // css for Fancybox 3553 var output_css = '#fancybox-close { right: -15px; }'; 3554 output_css += '#fancybox-loading, #fancybox-loading div, #fancybox-overlay, #fancybox-wrap, #fancybox-wrap div {'; 3555 output_css += '-webkit-box-sizing: content-box !important; -moz-box-sizing: content-box !important; box-sizing: content-box !important; }'; 3556 3557 switch ( position ) { 3558 case 'topleft': 3559 output_css += '#fancybox-wrap { position: fixed; bottom: auto !important; top: 0px !important; right: auto !important; left: 0px !important; }'; 3560 break; 3561 case 'topcenter': 3562 output_css += '#fancybox-wrap { position: fixed; bottom: auto !important; top: 0px !important; }'; 3563 break; 3564 case 'topright': 3565 output_css += '#fancybox-wrap { position: fixed; bottom: auto !important; top: 0px !important; right: 0px !important; left: auto !important; }'; 3566 break; 3567 case 'centerleft': 3568 output_css += '#fancybox-wrap { left: 0px !important; right: auto !important; }'; 3569 break; 3570 case 'center': 3571 break; 3572 case 'centerright': 3573 output_css += '#fancybox-wrap { right: 0px !important; left: auto !important; }'; 3574 break; 3575 case 'bottomleft': 3576 output_css += '#fancybox-wrap { position: fixed; bottom: 0px !important; top: auto !important; right: auto !important; left: 0px !important; }'; 3577 break; 3578 case 'bottomcenter': 3579 output_css += '#fancybox-wrap { position: fixed; bottom: 0px !important; top: auto !important; }'; 3580 break; 3581 case 'bottomright': 3582 output_css += '#fancybox-wrap { position: fixed; bottom: 0px !important; top: auto !important; right: 0px !important; left: auto !important; }'; 3583 break; 3584 } 3585 3586 3587 jQuery('#' + advanced_ads_layer_settings.layer_class + '-custom-css').html(output_css); 3588 3589 // show fancybox 3590 if ( typeof jQuery.fancybox == 'function' ) { 3591 banner.waitForImages( function() { 3592 settings['content'] = banner.show(); 3593 jQuery.fancybox( settings ); 3594 }); 3595 } 3596} 3597 3598/** 3599 * Call display callbacks. 3600 * 3601 * @param {string} banner_id id of the banner, without # 3602 */ 3603function advads_layer_call_display_callbacks( banner_id ) { 3604 // iterate through all callback function and call them 3605 advads_items.display_callbacks[ banner_id ] = advads_items.display_callbacks[ banner_id ] || {}; 3606 jQuery.each( advads_items.display_callbacks[ banner_id ], function ( key, func ) { 3607 if ( typeof func === 'string' ) { 3608 func = window[ func ]; 3609 } 3610 func( banner_id ); 3611 }); 3612} 3613 3614/** 3615 * return a custom offset extracted from a class name 3616 * @param {str} field 3617 * @returns {int} offset 3618 */ 3619function advads_extract_custom_offset_from_class(field) { 3620 var offset = 0; 3621 var classes = jQuery(field).attr('class'); 3622 if (classes !== undefined) { 3623 // create class array 3624 classes = classes.split(/\s+/); 3625 jQuery.each(classes, function (key, value) { 3626 if (value === '') 3627 return false; 3628 // get information about the solution from a class 3629 var pattern = new RegExp(advanced_ads_layer_settings.layer_class + '-offset-', 'gi'); 3630 if (value.match(pattern)) { 3631 infos = value.split('-'); 3632 offset = parseInt(infos[3]) 3633 return false; 3634 } 3635 }); 3636 } 3637 3638 return offset; 3639}; 3640 3641/** 3642 * return a duration extracted from a class name 3643 * @param {str} field 3644 * @returns {int} offset 3645 */ 3646function advads_extract_duration_from_class(field) { 3647 var duration = 0; 3648 var classes = field.attr('class'); 3649 if (classes !== undefined) { 3650 // create class array 3651 classes = classes.split(/\s+/); 3652 jQuery.each(classes, function (key, value) { 3653 if (value === '') 3654 return false;
3655 // get information about the solution from a class 3656 if (value.match(/advads-duration-/gi)) { 3657 infos = value.split('-'); 3658 duration = parseInt(infos[2]) 3659 return false; 3660 } 3661 }); 3662 } 3663 3664 return duration; 3665}; 3666 3667/** 3668 * callback function in case a layer ad is displayed with a background 3669 * @param {type} ad object 3670 */ 3671function advads_layer_display_background_callback(id) { 3672 // display overlay in case it is attached to an ad still not visible 3673 var banner = jQuery('#' + id); 3674 // only display background if there is an unvisible ad with a background AND no background visible yet 3675 if (banner.hasClass('advads-has-background') && banner.is(':hidden')) { 3676 //there is background for this ad 3677 advads_items.backgrounds[id] = true; 3678 if (jQuery('.advads-background').length === 0) { 3679 var args = { 3680 "class": "advads-background", 3681 "style": "position: fixed; bottom: 0; right: 0; display: block; width: 100%; height: 100%; background: #000; z-index: 9998; opacity:.5;", 3682 } 3683 if ( banner.hasClass( 'advads-background-click-close' ) ) { 3684 args.click = function() { 3685 jQuery( this ).remove(); 3686 advads_layer_close_items(); 3687 } 3688 } 3689 jQuery( '<div/>', args ).appendTo( 'body' ); 3690 } 3691 } 3692} 3693 3694/** 3695 * callback for display effect fadeIn 3696 * @param {obj} ad container 3697 */ 3698function advads_display_effect_fadein(id) { 3699 var banner = jQuery('#' + id); 3700 var duration = parseInt(advads_items.effect_durations[id]); 3701 banner.fadeIn(duration); 3702} 3703 3704/** 3705 * callback for display effect show 3706 * @param {obj} ad container 3707 */ 3708function advads_display_effect_show(id) { 3709 var banner = jQuery('#' + id); 3710 var duration = parseInt(advads_items.effect_durations[id]); 3711 banner.show(duration); 3712} 3713 3714/** 3715 * callback for display effect slideDown 3716 * @link http://api.jquery.com/slideDown/ 3717 * @param {obj} ad container 3718 */ 3719function advads_display_effect_slide(id) { 3720 var banner = jQuery('#' + id); 3721 var duration = parseInt(advads_items.effect_durations[id]); 3722 banner.slideDown(duration); 3723} 3724 3725/** 3726 * check, if css transform is supported by user's browser 3727 * 3728 * [http://stackoverflow.com/a/12625986] 3729 */ 3730function getSupportedTransform() { 3731 var prefixes = 'transform WebkitTransform MozTransform OTransform msTransform'.split(' '); 3732 var div = document.createElement('div'); 3733 for(var i = 0; i < prefixes.length; i++) { 3734 if(div && div.style[prefixes[i]] !== undefined) { 3735 return prefixes[i]; 3736 } 3737 } 3738 return false; 3739} 3740 3741/** 3742 * set css transform property for the ad 3743 * @param {string} jQuery object (wrapped set) 3744 * @param {string} values of property 3745 */ 3746function set_ad_transform( ad, transform_properties ) { 3747 jQuery( ad ).css({ 3748 '-webkit-transform': transform_properties, 3749 '-moz-transform': transform_properties, 3750 'transform': transform_properties 3751 }); 3752} 3753 3754/** 3755 * Close item (when user clicks on the close button/background or automatically after n sec.). 3756 * 3757 * @param {string} item_id Id of the item. 3758 */ 3759function advads_layer_close_item( item_id ) { 3760 if ( typeof advads_items.close_functions[ item_id ] === 'function' ) { 3761 advads_items.close_functions[ item_id ](); 3762 advads_items.close_functions[ item_id ] = null; 3763 3764 // Close Fancybox window. 3765 if ( jQuery.fancybox && typeof jQuery.fancybox.close === 'function' ) { 3766 jQuery.fancybox.close(); 3767 } 3768 } 3769} 3770 3771/** 3772 * Close all items. 3773 */ 3774function advads_layer_close_items() { 3775 for ( var item_id in advads_items.close_functions ) { 3776 if ( advads_items.close_functions.hasOwnProperty( item_id ) ) { 3777 advads_layer_close_item( item_id ); 3778 } 3779 } 3780} 3781 3782/** 3783 * Close an item if it contains a GAM ad that did not fill the space. 3784 */ 3785document.addEventListener( 'aagam_empty_slot', function ( ev ) { 3786 const div = document.getElementById( ev.detail ); 3787 if ( ! div ) { 3788 return; 3789 } 3790 3791 const layer = div.closest( '.' + document.body.classList.value.split( 'aa-prefix-' )[1].split( ' ' )[0] + 'layer' ); 3792 3793 if ( ! layer ) { 3794 return; 3795 } 3796 3797 if ( typeof advads_items.close_functions[layer.id] === 'function' ) { 3798 advads_layer_close_item( layer.id ); 3799 } else { 3800 let interval = setInterval( function () { 3801 if ( typeof advads_items.close_functions[layer.id] === 'function' ) { 3802 advads_layer_close_item( layer.id ); 3803 clearInterval( interval ); 3804 } 3805 }, 750 ); 3806 } 3807} ); 3808 3809//https://github.com/tonai/jquery-onend 3810!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.fn.onEnd=function(){var a,b=Array.prototype.slice.call(arguments),c=b.pop(),d=b.pop(),e=function(){var b=Array.prototype.slice.call(arguments);clearTimeout(a),a=setTimeout(function(){d.apply(this,b)}.bind(this),c)};e.guid=d.guid||(d.guid=jQuery.guid++),b.push(e),this.on.apply(this,b)}}); 3811 3812/*! 3813 * Ouibounce 3814 * https://github.com/carlsednaoui/ouibounce 3815 * 3816 * Copyright (c) 2014 Carl Sednaoui 3817 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). 3818 **/ 3819!function(e,n){"function"==typeof define&&define.amd?define(n):"object"==typeof exports?module.exports=n(require,exports,module):e.ouibounce=n()}(this,function(e,n,o){return function(e,n){"use strict";function o(e,n){return"undefined"==typeof e?n:e}function i(e){var n=24*e*60*60*1e3,o=new Date;return o.setTime(o.getTime()+n),"; expires="+o.toUTCString()}function t(){s()||(L.addEventListener("mouseleave",u),L.addEventListener("mouseenter",r),L.addEventListener("keydown",c))}function u(e){e.clientY>k||(D=setTimeout(m,y))}function r(){D&&(clearTimeout(D),D=null)}
3819function c(e){g||e.metaKey&&76===e.keyCode&&(g=!0,D=setTimeout(m,y))}function d(e,n){return a()[e]===n}function a(){for(var e=document.cookie.split("; "),n={},o=e.length-1;o>=0;o--){var i=e[o].split("=");n[i[0]]=i[1]}return n}function s(){return d(T,"true")&&!v}function m(){s()||(e&&(e.style.display="block"),E(),f())}function f(e){var n=e||{};"undefined"!=typeof n.cookieExpire&&(b=i(n.cookieExpire)),n.sitewide===!0&&(w=";path=/"),"undefined"!=typeof n.cookieDomain&&(x=";domain="+n.cookieDomain),"undefined"!=typeof n.cookieName&&(T=n.cookieName),document.cookie=T+"=true"+b+x+w,L.removeEventListener("mouseleave",u),L.removeEventListener("mouseenter",r),L.removeEventListener("keydown",c)}var l=n||{},v=l.aggressive||!1,k=o(l.sensitivity,20),p=o(l.timer,1e3),y=o(l.delay,0),E=l.callback||function(){},b=i(l.cookieExpire)||"",x=l.cookieDomain?";domain="+l.cookieDomain:"",T=l.cookieName?l.cookieName:"viewedOuibounceModal",w=l.sitewide===!0?";path=/":"",D=null,L=document.documentElement;setTimeout(t,p);var g=!1;return{fire:m,disable:f,isDisabled:s}}}); 3820 3821/*! waitForImages jQuery Plugin 2015-06-02 */ 3822!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){var b="waitForImages";a.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage","cursor"],hasImageAttributes:["srcset"]},a.expr[":"]["has-src"]=function(b){return a(b).is('img[src][src!=""]')},a.expr[":"].uncached=function(b){return a(b).is(":has-src")?!b.complete:!1},a.fn.waitForImages=function(){var c,d,e,f=0,g=0,h=a.Deferred();if(a.isPlainObject(arguments[0])?(e=arguments[0].waitForAll,d=arguments[0].each,c=arguments[0].finished):1===arguments.length&&"boolean"===a.type(arguments[0])?e=arguments[0]:(c=arguments[0],d=arguments[1],e=arguments[2]),c=c||a.noop,d=d||a.noop,e=!!e,!a.isFunction(c)||!a.isFunction(d))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var i=a(this),j=[],k=a.waitForImages.hasImageProperties||[],l=a.waitForImages.hasImageAttributes||[],m=/url\(\s*(['"]?)(.*?)\1\s*\)/g;e?i.find("*").addBack().each(function(){var b=a(this);b.is("img:has-src")&&j.push({src:b.attr("src"),element:b[0]}),a.each(k,function(a,c){var d,e=b.css(c);if(!e)return!0;for(;d=m.exec(e);)j.push({src:d[2],element:b[0]})}),a.each(l,function(c,d){var e,f=b.attr(d);return f?(e=f.split(","),void a.each(e,function(c,d){d=a.trim(d).split(" ")[0],j.push({src:d,element:b[0]})})):!0})}):i.find("img:has-src").each(function(){j.push({src:this.src,element:this})}),f=j.length,g=0,0===f&&(c.call(i[0]),h.resolveWith(i[0])),a.each(j,function(e,j){var k=new Image,l="load."+b+" error."+b;a(k).one(l,function m(b){var e=[g,f,"load"==b.type];return g++,d.apply(j.element,e),h.notifyWith(j.element,e),a(this).off(l,m),g==f?(c.call(i[0]),h.resolveWith(i[0]),!1):void 0}),k.src=j.src})}),h.promise()}}); 3823; 3824!function(){"use strict";var e,t={noop:function(){},texturize:function(e){return(e=(e=(e=(e+="").replace(/'/g,"’").replace(/'/g,"’")).replace(/"/g,"”").replace(/"/g,"”").replace(/"/g,"”").replace(/[\u201D]/g,"”")).replace(/([\w]+)=&#[\d]+;(.+?)&#[\d]+;/g,'$1="$2"')).trim()},applyReplacements:function(e,t){if(e)return t?e.replace(/{(\d+)}/g,function(e,r){return void 0!==t[r]?t[r]:e}):e},getBackgroundImage:function(e){var t=document.createElement("canvas"),r=t.getContext&&t.getContext("2d");if(e){r.filter="blur(20px) ",r.drawImage(e,0,0);var o=t.toDataURL("image/png");return t=null,o}}},r=function(){function e(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function r(e,t,r,o){if(!e)return o();e.jpCarouselCancelFade&&e.jpCarouselCancelFade(),e.classList.remove("jp-carousel-fade"),e.style.removeProperty("display"),e.style.opacity=t,e.style.pointerEvents="none",e.offsetWidth,e.classList.add("jp-carousel-fade"),e.style.opacity=r;var a=1e3*parseFloat(getComputedStyle(e).transitionDuration)||0,i=setTimeout(function(){e.jpCarouselCancelFade=null,e.style.removeProperty("pointer-events"),o()},a+50);e.jpCarouselCancelFade=function(){clearTimeout(i),e.jpCarouselCancelFade=null}}return{closest:function(t,r){if(t.closest)return t.closest(r);var o=t;do{if(e(o,r))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null},matches:e,hide:function(e){e&&(e.style.display="none")},show:function(e){e&&(e.style.display="block")},fadeIn:function(e,o){r(e,0,1,o=o||t.noop)},fadeOut:function(e,o){o=o||t.noop,r(e,1,0,function(){e&&(e.style.display="none"),o()})},scrollToElement:function(e,t,r){if(!e||!t)return r?r():void 0;var o=t.querySelector(".jp-carousel-info-extra");o&&(o.style.minHeight=window.innerHeight-64+"px");var a=!0,i=Date.now(),n=t.scrollTop,l=Math.max(0,e.offsetTop-Math.max(0,window.innerHeight-function(e){var t=e.querySelector(".jp-carousel-info-footer"),r=e.querySelector(".jp-carousel-info-extra"),o=e.querySelector(".jp-carousel-info-content-wrapper");if(t&&r&&o){var a=window.getComputedStyle(r),i=parseInt(a.paddingTop,10)+parseInt(a.paddingBottom,10);return i=isNaN(i)?0:i,o.offsetHeight+t.offsetHeight+i}return 0}(t)))-t.scrollTop;function s(){a=!1}
3824l=Math.min(l,t.scrollHeight-window.innerHeight),t.addEventListener("wheel",s),function e(){var c,u=Date.now(),d=(c=(u-i)/300)<.5?2*c*c:1-Math.pow(-2*c+2,2)/2,p=(d=d>1?1:d)*l;if(t.scrollTop=n+p,u<=i+300&&a)return requestAnimationFrame(e);r&&r(),o&&(o.style.minHeight=""),a=!1,t.removeEventListener("wheel",s)}()},getJSONAttribute:function(e,t){if(e&&e.hasAttribute(t))try{return JSON.parse(e.getAttribute(t))}catch{return}},convertToPlainText:function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},stripHTML:function(e){var t=document.createElement("div");return t.innerHTML=e.replace(/<[^>]*>?/gm,""),t.textContent},emitEvent:function(e,t,r){var o;try{o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r||null})}catch{(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,r||null)}e.dispatchEvent(o)},isTouch:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch}}}();function o(){var o,a,i,n,l="",s=!1,c="div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, figure.wp-block-gallery.has-nested-images, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery",u=".gallery-item, .tiled-gallery-item, .blocks-gallery-item, .tiled-gallery__item",d=u+", .wp-block-image",p={},m="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.stat?wpcom.carousel.stat:t.noop,g="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.pageview?wpcom.carousel.pageview:t.noop;function h(t){if(!s)switch(t.which){case 38:t.preventDefault(),p.overlay.scrollTop-=100;break;case 40:t.preventDefault(),p.overlay.scrollTop+=100;break;case 39:t.preventDefault(),e.slideNext();break;case 37:case 8:t.preventDefault(),e.slidePrev();break;case 27:t.preventDefault(),x()}}function f(){s=!0}function v(){s=!1}function y(e){e.role="button",e.tabIndex=0,e.ariaLabel=jetpackCarouselStrings.image_label}function w(){p.overlay||(p.overlay=document.querySelector(".jp-carousel-overlay"),p.container=p.overlay.querySelector(".jp-carousel-wrap"),p.gallery=p.container.querySelector(".jp-carousel"),p.info=p.overlay.querySelector(".jp-carousel-info"),p.caption=p.info.querySelector(".jp-carousel-caption"),p.commentField=p.overlay.querySelector("#jp-carousel-comment-form-comment-field"),p.emailField=p.overlay.querySelector("#jp-carousel-comment-form-email-field"),p.authorField=p.overlay.querySelector("#jp-carousel-comment-form-author-field"),p.urlField=p.overlay.querySelector("#jp-carousel-comment-form-url-field"),window.innerWidth<=760&&Math.round(window.innerWidth/760*110)<40&&r.isTouch(),[p.commentField,p.emailField,p.authorField,p.urlField].forEach(function(e){e&&(e.addEventListener("focus",f),e.addEventListener("blur",v))}),p.overlay.addEventListener("click",function(e){var t,o,a=e.target,i=!!r.closest(a,".jp-carousel-close-hint"),n=!!window.matchMedia("(max-device-width: 760px)").matches;a===p.overlay?n||x():i?x():a.classList.contains("jp-carousel-image-download")?m("download_original_click"):a.classList.contains("jp-carousel-comment-login")?(t=p.currentSlide,o=t?t.attrs.attachmentId:"0",window.location.href=jetpackCarouselStrings.login_url+"%23jp-carousel-"+o):r.closest(a,"#jp-carousel-comment-form-container")?function(e){var t=e.target,o=r.getJSONAttribute(p.container,"data-carousel-extra")||{},a=p.currentSlide.attrs.attachmentId,i=document.querySelector("#jp-carousel-comment-form-submit-and-info-wrapper"),n=document.querySelector("#jp-carousel-comment-form-spinner"),l=document.querySelector("#jp-carousel-comment-form-button-submit"),s=document.querySelector("#jp-carousel-comment-form");if(p.commentField&&p.commentField.getAttribute("id")===t.getAttribute("id"))f(),r.show(i);else if(r.matches(t,'input[type="submit"]')){e.preventDefault(),e.stopPropagation(),r.show(n),s.classList.add("jp-carousel-is-disabled");var c={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:o.blog_id,id:a,comment:p.commentField.value};if(!c.comment.length)return void j(jetpackCarouselStrings.no_comment_text,!1);if(1!==Number(jetpackCarouselStrings.is_logged_in)&&(c.email=p.emailField.value,c.author=p.authorField.value,c.url=p.urlField.value,1===Number(jetpackCarouselStrings.require_name_email))){if(!c.email.length||!c.email.match("@"))return void j(jetpackCarouselStrings.no_comment_email,!1);if(!c.author.length)return void j(jetpackCarouselStrings.no_comment_author,!1)}var u=new XMLHttpRequest;u.open("POST",jetpackCarouselStrings.ajaxurl,!0),u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),u.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&this.status>=200&&this.status<300){var e;try{e=JSON.parse(this.response)}catch{return void j(jetpackCarouselStrings.comment_post_error,!1)}"approved"===e.comment_status?j(jetpackCarouselStrings.comment_approved,!0):"unapproved"===e.comment_status?j(jetpackCarouselStrings.comment_unapproved,!0):j(jetpackCarouselStrings.comment_post_error,!1),H(),q(a),l.value=jetpackCarouselStrings.post_comment,r.hide(n),s.classList.remove("jp-carousel-is-disabled")}else j(jetpackCarouselStrings.comment_post_error,!1)};var d=[];for(var m in c)if(m){var g=encodeURIComponent(m)+"="+encodeURIComponent(c[m]);d.push(g.replace(/%20/g,"+"))}var h=d.join("&");u.send(h)}}(e):(r.closest(a,".jp-carousel-photo-icons-container")||a.classList.contains("jp-carousel-photo-title"))&&function(e){e.preventDefault();var t=e.target,o=p.info.querySelector(".jp-carousel-info-extra"),a=p.info.querySelector(".jp-carousel-image-meta"),i=p.info.querySelector(".jp-carousel-comments-wrapper"),n=p.info.querySelector(".jp-carousel-icon-info"),l=p.info.querySelector(".jp-carousel-icon-comments");function s(){l&&l.classList.remove("jp-carousel-selected"),n.classList.toggle("jp-carousel-selected"),i&&i.classList.remove("jp-carousel-show"),a&&(a.classList.toggle("jp-carousel-show"),a.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}function c(){n&&n.classList.remove("jp-carousel-selected"),l.classList.toggle("jp-carousel-selected"),a&&a.classList.remove("jp-carousel-show"),i&&(i.classList.toggle("jp-carousel-show"),i.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}(r.closest(t,".jp-carousel-icon-info")||t.classList.contains("jp-carousel-photo-title"))&&(a&&a.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,s):(s(),r.scrollToElement(p.info,p.overlay))),r.closest(t,".jp-carousel-icon-comments")&&(i&&i.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,c):(c(),r.scrollToElement(p.info,p.overlay)))}(e)}),window.addEventListener("keydown",h),p.overlay.addEventListener("jp_carousel.afterOpen",function(){v(),p.slides.length<=1||(p.slides.length<=5?r.show(p.info.querySelector(".jp-swiper-pagination")):r.show(p.info.querySelector(".jp-carousel-pagination")))}),p.overlay.addEventListener("jp_carousel.beforeClose",function(){f(),document.documentElement.style.removeProperty("height"),e&&e.enable(),r.hide(p.info.querySelector(".jp-swiper-pagination")),r.hide(p.info.querySelector(".jp-carousel-pagination"))}),p.overlay.addEventListener("jp_carousel.afterClose",function(){window.history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.href="",l="",p.isOpen=!1}),p.overlay.addEventListener("touchstart",function(e){e.touches.length>1&&e.preventDefault()}))}function j(e,t){var o=p.overlay.querySelector("#jp-carousel-comment-post-results"),a="jp-carousel-comment-post-"+(t?"success":"error");o.innerHTML='<span class="'+a+'">'+e+"</span>",r.hide(p.overlay.querySelector("#jp-carousel-comment-form-spinner")),p.overlay.querySelector("#jp-carousel-comment-form").classList.remove("jp-carousel-is-disabled"),r.show(o)}function b(){var e=document.querySelectorAll("a img[data-attachment-id]");Array.prototype.forEach.call(e,function(e){var t=e.parentElement,o=t.parentElement;if(!o.classList.contains("gallery-icon")&&!r.closest(o,u)&&t.hasAttribute("href")){var a=!1;t.getAttribute("href").split("?")[0]===e.getAttribute("data-orig-file").split("?")[0]&&1===Number(jetpackCarouselStrings.single_image_gallery_media_file)&&(a=!0),t.getAttribute("href")===e.getAttribute("data-permalink")&&(a=!0),a&&(y(e),t.classList.add("single-image-gallery"),t.setAttribute("data-carousel-extra",JSON.stringify({blog_id:Number(jetpackCarouselStrings.blog_id)})))}})}function S(t,r){p.isOpen?(L(r),e.slideTo(r+1)):M(t,{startIndex:r})}function L(e){(!e||e<0||e>p.slides.length)&&(e=0),p.currentSlide=p.slides[e];var o,a,i=p.currentSlide,n=i.attrs.attachmentId;A(p.slides[e]),function(e){var t=[],r=p.slides.length;if(r>1){var o=e>0?e-1:r-1;t.push(o);var a=e<r-1?e+1:0;t.push(a)}t.forEach(function(e){var t=p.slides[e];t&&(A(t),1!==Number(jetpackCarouselStrings.display_background_image)||t.backgroundImage||_(t))})}(e),1!==Number(jetpackCarouselStrings.display_background_image)||p.slides[e].backgroundImage||_(p.slides[e]),r.hide(p.caption),function(e){var t,o,a,i,n,l,s;if(i=p.overlay.querySelector(".jp-carousel-photo-caption"),n=p.overlay.querySelector(".jp-carousel-caption"),l=p.overlay.querySelector(".jp-carousel-photo-title"),s=p.overlay.querySelector(".jp-carousel-photo-description"),r.hide(i),r.hide(n),r.hide(l),r.hide(s),t=E(e.caption)||"",o=E(e.title)||"",a=E(e.desc)||"",(t||o||a)&&(t&&(i.innerHTML=t,n.innerHTML=t,r.show(i),r.show(n)),r.stripHTML(t)===r.stripHTML(o)&&(o=""),r.stripHTML(t)===r.stripHTML(a)&&(a=""),r.stripHTML(o)===r.stripHTML(a)&&(a=""),a&&(s.innerHTML=a,r.show(s),o||t||(i.textContent=r.stripHTML(a),r.show(i))),o)){var c=r.stripHTML(o);l.textContent=c,t||(i.textContent=c,n.textContent=c,r.show(i)),r.show(l)}}
3824({caption:i.attrs.caption,title:i.attrs.title,desc:i.attrs.desc}),function(e){if(!e||1!==Number(jetpackCarouselStrings.display_exif))return!1;var t=p.info.querySelector(".jp-carousel-image-meta");if(!t)return!1;var r="";for(var o in e){var a=e[o],i=jetpackCarouselStrings.meta_data||[];if(0!==parseFloat(a)&&a.length&&-1!==i.indexOf(o)){switch(o){case"focal_length":a+="mm";break;case"shutter_speed":a=C(a);break;case"aperture":a="f/"+a}r+="<li><h5>"+jetpackCarouselStrings[o]+"</h5>"+a+"</li>"}}var n=t.querySelector("ul.jp-carousel-image-exif");if(""!==r){if(!n){(n=document.createElement("ul")).className="jp-carousel-image-exif";var l=t.querySelector(".jp-carousel-title-and-caption");l&&l.nextSibling?t.insertBefore(n,l.nextSibling):t.insertBefore(n,t.firstChild)}n.innerHTML=r,n.style.removeProperty("display")}else n&&n.parentNode.removeChild(n)}(p.slides[e].attrs.imageMeta),function(e){if(!e)return!1;var r,o=[e.attrs.origWidth,e.attrs.origHeight],a=document.createElement("a");a.href=e.attrs.src.replace(/\?.+$/,""),r=null!==a.hostname.match(/^i[\d]{1}\.wp\.com$/i)?a.href:e.attrs.origFile.replace(/\?.+$/,"");var i=p.info.querySelector(".jp-carousel-download-text"),n=p.info.querySelector(".jp-carousel-image-download");i.innerHTML=t.applyReplacements(jetpackCarouselStrings.download_original,o),n.setAttribute("href",r),n.style.removeProperty("display")}(i),1===Number(jetpackCarouselStrings.display_comments)&&(o=p.slides[e].attrs.commentsOpened,a=p.info.querySelector("#jp-carousel-comment-form-container"),1===parseInt(o,10)?r.fadeIn(a):r.fadeOut(a),q(n),r.hide(p.info.querySelector("#jp-carousel-comment-post-results")));var s=p.info.querySelector(".jp-carousel-pagination");if(s&&p.slides.length>5){var c=e+1;s.innerHTML="<span>"+c+" / "+p.slides.length+"</span>"}jetpackCarouselStrings.stats&&p.isOpen&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+jetpackCarouselStrings.stats+"&post="+encodeURIComponent(n)+"&rand="+Math.random()),p.isOpen&&g(n),l="#jp-carousel-"+n,window.location.hash=l}function x(){document.body.style.overflow=a,document.documentElement.style.overflow=i,H(),f(),r.emitEvent(p.overlay,"jp_carousel.beforeClose"),window.scrollTo(window.scrollX||window.pageXOffset||0,n||0),p.isOpen=!1,e.destroy(),p.slides=[],p.currentSlide=void 0,p.gallery.innerHTML="",r.fadeOut(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterClose")})}function k(e){if("object"!=typeof e&&(e={}),void 0===e.origFile)return"";if(void 0===e.origWidth||void 0===e.maxWidth)return e.origFile;if(!e.largeFile)return e.origFile;var t=document.createElement("a");t.href=e.largeFile;var r=/^i[0-2]\.wp\.com$/i.test(t.hostname),o=function(e,t,r){var o,a=r?e.replace(/.*=([\d]+%2C[\d]+).*$/,"$1"):e.replace(/.*-([\d]+x[\d]+)\..+$/,"$1");return"9999"===(o=a!==e?r?a.split("%2C"):a.split("x"):[t,0])[0]&&(o[0]="0"),"9999"===o[1]&&(o[1]="0"),o}(e.largeFile,e.origWidth,r),a=parseInt(o[0],10),i=parseInt(o[1],10);if(e.origMaxWidth=e.maxWidth,e.origMaxHeight=e.maxHeight,void 0!==window.devicePixelRatio&&window.devicePixelRatio>1&&(e.maxWidth=e.maxWidth*window.devicePixelRatio,e.maxHeight=e.maxHeight*window.devicePixelRatio),a>=e.maxWidth||i>=e.maxHeight)return e.largeFile;if(r){if(-1===e.largeFile.lastIndexOf("?"))return e.largeFile;var n=function(e){var t;try{t=new URL(e)}catch(t){return e}var r=["quality","ssl","filter","brightness","contrast","colorize","smooth"],o=Array.from(t.searchParams.entries());return t.search="",o.forEach(([e,o])=>{r.includes(e)&&t.searchParams.append(e,o)}),t}(e.largeFile);return(e.origWidth>e.maxWidth||e.origHeight>e.maxHeight)&&(e.origMaxWidth=2*e.maxWidth,e.origMaxHeight=2*e.maxHeight,n.searchParams.set("fit",e.origMaxWidth+","+e.origMaxHeight)),n.toString()}return e.origFile}function C(e){return e>=1?Math.round(10*e)/10+"s":"1/"+Math.round(1/e)+"s"}function E(e){return!e.match(" ")&&e.match("_")?"":e}function q(e,t){var a=void 0===t,i=p.info.querySelector(".jp-carousel-icon-comments .jp-carousel-has-comments-indicator");if(i.classList.remove("jp-carousel-show"),clearInterval(o),e){(!t||t<1)&&(t=0);var n=p.info.querySelector(".jp-carousel-comments"),l=p.info.querySelector("#jp-carousel-comments-loading");r.show(l),a&&(r.hide(n),n.innerHTML="");var s=new XMLHttpRequest,c=jetpackCarouselStrings.ajaxurl+"?action=get_attachment_comments&nonce="+jetpackCarouselStrings.nonce+"&id="+e+"&offset="+t;s.open("GET",c),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var u=function(){r.fadeIn(n),r.fadeOut(l)};s.onload=function(){if(p.currentSlide&&p.currentSlide.attrs.attachmentId===e){var c,d=s.status>=200&&s.status<300;try{c=JSON.parse(s.responseText)}catch{}if(!d||!c||!Array.isArray(c))return u();a&&(n.innerHTML="");for(var m=0;m<c.length;m++){var g=c[m],h=document.createElement("div");h.classList.add("jp-carousel-comment"),h.setAttribute("id","jp-carousel-comment-"+g.id),h.innerHTML='<div class="comment-gravatar">'+g.gravatar_markup+'</div><div class="comment-content"><div class="comment-author">'+g.author_markup+'</div><div class="comment-date">'+g.date_gmt+"</div>"+g.content+"</div>",n.appendChild(h),clearInterval(o),o=setInterval(function(){p.container.scrollTop+150>window.innerHeight&&(q(e,t+10),clearInterval(o))},300)}c.length>0&&(r.show(n),i.innerText=c.length,i.classList.add("jp-carousel-show")),r.hide(l)}},s.onerror=u,s.send()}}function A(e){var t=e.attrs,r=e.el.querySelector("img");if(!r.hasAttribute("data-loaded"))if(r.setAttribute("itemprop","image"),r.setAttribute("data-loaded",1),t.previewImage&&t.previewImage!==t.src){r.src=t.previewImage,r.style.filter="blur(8px)";var o=new window.Image;o.addEventListener("load",function(){r.src=t.src,r.style.filter=""},{once:!0}),o.addEventListener("error",function(){r.style.filter=""},{once:!0}),o.src=t.src}else r.src=t.src}function _(e){var t=e.attrs.originalElement;if(t)if(t.complete&&0!==t.naturalHeight)T(e,t);else{var r=function(){t.removeEventListener("error",o),T(e,t)},o=function(){t.removeEventListener("load",r)};t.addEventListener("load",r,{once:!0}),t.addEventListener("error",o,{once:!0})}}
3824function T(e,r){var o=t.getBackgroundImage(r);o&&(e.backgroundImage=o,e.el.style.backgroundImage="url("+o+")",e.el.style.backgroundSize="cover",e.el.style.backgroundPosition="center")}function H(){p.commentField&&(p.commentField.value="")}function I(e,o){p.slides=[];var a={width:window.innerWidth,height:window.innerHeight-64};0!==o&&null!==e[o].getAttribute("data-gallery-src")&&((new Image).src=e[o].getAttribute("data-gallery-src")),Array.prototype.forEach.call(e,function(e,o){var i=r.closest(e,"a"),n=e.getAttribute("data-orig-file")||e.getAttribute("src-orig"),l=e.getAttribute("data-attachment-id")||e.getAttribute("data-id")||"0",s=document.querySelector('img[data-attachment-id="'+l+'"] + figcaption');s=s?s.innerHTML:e.getAttribute("data-image-caption");var c={originalElement:e,attachmentId:l,commentsOpened:e.getAttribute("data-comments-opened")||"0",imageMeta:r.getJSONAttribute(e,"data-image-meta")||{},title:e.getAttribute("data-image-title")||"",desc:e.getAttribute("data-image-description")||"",largeFile:e.getAttribute("data-large-file")||"",origFile:n||"",thumbSize:{width:e.naturalWidth,height:e.naturalHeight},caption:s||"",permalink:i&&i.getAttribute("href"),src:n||e.getAttribute("src")||""},u=r.closest(e,".tiled-gallery-item"),d=u&&u.querySelector(".tiled-gallery-caption"),m=d&&d.innerHTML;m&&(c.caption=m);var g=function(e){var t=e.getAttribute("data-orig-size")||"";if(t){var r=t.split(",");return{width:parseInt(r[0],10),height:parseInt(r[1],10)}}return{width:e.getAttribute("data-original-width")||e.getAttribute("width")||void 0,height:e.getAttribute("data-original-height")||e.getAttribute("height")||void 0}}(e);if(c.origWidth=g.width||c.thumbSize.width,c.origHeight=g.height||c.thumbSize.height,"undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.generateImgSrc?c.src=wpcom.carousel.generateImgSrc(e,a):c.src=k({origFile:c.src,origWidth:c.origWidth,origHeight:c.origHeight,maxWidth:a.width,maxHeight:a.height,largeFile:c.largeFile}),e.setAttribute("data-gallery-src",c.src),"0"!==c.attachmentId){c.title=t.texturize(c.title),c.desc=t.texturize(c.desc),c.caption=t.texturize(c.caption);var h=new Image,f=document.createElement("div");f.classList.add("swiper-slide"),f.setAttribute("itemprop","associatedMedia"),f.setAttribute("itemscope",""),f.setAttribute("itemtype","https://schema.org/ImageObject");var v=document.createElement("div");v.classList.add("swiper-zoom-container"),p.gallery.appendChild(f),f.appendChild(v),v.appendChild(h),f.setAttribute("data-attachment-id",c.attachmentId),f.setAttribute("data-permalink",c.permalink),f.setAttribute("data-orig-file",c.origFile),c.previewImage=e.currentSrc||e.getAttribute("src")||"";var y={el:f,attrs:c,index:o};p.slides.push(y)}})}function M(e,t){if(!window.JetpackSwiper){var o=document.querySelector("#jp-carousel-loading-overlay");r.show(o);var a=document.createElement("script");return a.id="jetpack-carousel-swiper-js",a.src=window.jetpackSwiperLibraryPath.url,a.async=!0,a.onload=function(){r.hide(o),F(e,t)},a.onerror=function(){r.hide(o)},void document.head.appendChild(a)}F(e,t)}function F(t,o){var l,s={imgSelector:".gallery-item [data-attachment-id], .tiled-gallery-item [data-attachment-id], img[data-attachment-id], img[data-id]",startIndex:0},c=r.getJSONAttribute(t,"data-carousel-extra");if(!c)return;const u=t.querySelectorAll(s.imgSelector);if(u.length&&(w(),!p.isOpen)){for(var d in p.isOpen=!0,a=getComputedStyle(document.body).overflow,document.body.style.overflow="hidden",i=getComputedStyle(document.documentElement).overflow,document.documentElement.style.overflow="hidden",n=window.scrollY||window.pageYOffset||0,p.container.setAttribute("data-carousel-extra",JSON.stringify(c)),m(["open","view_image"]),o||{})s[d]=o[d];-1===s.startIndex&&(s.startIndex=0),r.emitEvent(p.overlay,"jp_carousel.beforeOpen"),p.gallery.innerHTML="",p.overlay.style.opacity=1,p.overlay.style.display="block",I(u,s.startIndex),(e=new window.JetpackSwiper(".jp-carousel-swiper-container",{centeredSlides:!0,zoom:!0,loop:p.slides.length>1,enabled:p.slides.length>1,pagination:{el:".jp-swiper-pagination",clickable:!0},navigation:{nextEl:".jp-swiper-button-next",prevEl:".jp-swiper-button-prev"},initialSlide:s.startIndex,on:{init:function(){L(s.startIndex)}},preventClicks:!1,preventClicksPropagation:!1,preventInteractionOnTransition:!r.isTouch(),threshold:5})).on("slideChange",function(e){p.isOpen&&(L(e.realIndex),p.overlay.classList.remove("jp-carousel-hide-control
3824s"))}),e.on("zoomChange",function(e,t){t>1&&p.overlay.classList.add("jp-carousel-hide-controls"),1===t&&p.overlay.classList.remove("jp-carousel-hide-controls")}),e.on("doubleTap",function(e){if(clearTimeout(l),1===e.zoom.scale)var t=setTimeout(function(){p.overlay.classList.remove("jp-carousel-hide-controls"),clearTimeout(t)},150)}),e.on("tap",function(){e.zoom.scale>1&&(l=setTimeout(function(){p.overlay.classList.toggle("jp-carousel-hide-controls")},150))}),r.fadeIn(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterOpen")})}}function O(e){if("click"!==e.type){if("keydown"===e.type){const t=document.activeElement.parentElement,r=t&&t.classList.contains("tiled-gallery__item");" "!==e.key&&"Enter"!==e.key||!r||R(e)}}else R(e)}function N(e){return(e||"").split("?")[0].replace(/\/$/,"")}function W(e){"A"===e.tagName&&(e=e.querySelector("img")||e);var t=e.parentElement,o=t?t.parentElement:null,a=null;if(o&&o.classList.contains("wp-block-image")?a=t.getAttribute("href"):t&&t.classList.contains("wp-block-image")&&t.querySelector(":scope > a")&&(a=t.querySelector(":scope > a").getAttribute("href")),a){var i=N(a),n=N(e.getAttribute("data-orig-file")),l=N(e.getAttribute("data-permalink"));if(i!==n&&i!==l)return!1}return!(t&&t.classList.contains("gallery-caption")||r.matches(t,"figcaption"))}function R(e){if(window.CSS&&window.CSS.supports&&window.CSS.supports("display","grid")){var t,o=e.target,a=r.closest(o,c);if(a){if(!(t=a)||!t.getAttribute("data-carousel-extra"))return;if(!W(o))return;document.documentElement.style.height="auto",e.preventDefault(),e.stopPropagation();var i=r.closest(o,d),n=Array.prototype.indexOf.call(a.querySelectorAll(d),i);M(a,{startIndex:n})}}}document.body.addEventListener("click",O),document.body.addEventListener("keydown",O),document.querySelectorAll(u+"img").forEach(function(e){W(e)&&y(e)}),1===Number(jetpackCarouselStrings.single_image_gallery)&&(b(),document.body.addEventListener("is.post-load",function(){b()})),window.addEventListener("hashchange",function(){var e=/jp-carousel-(\d+)/;if(window.location.hash&&e.test(window.location.hash)){if(window.location.hash!==l||!p.isOpen)if(window.location.hash&&p.gallery&&!p.isOpen&&history.back)history.back();else{l=window.location.hash;for(var t=window.location.hash.match(e),r=parseInt(t[1],10),o=document.querySelectorAll(c),a=0;a<o.length;a++){for(var i,n=o[a],s=n.querySelectorAll("img"),u=0;u<s.length;u++)if(parseInt(s[u].getAttribute("data-attachment-id"),10)===r||parseInt(s[u].getAttribute("data-id"),10)===r){i=u;break}if(void 0!==i){S(n,i);break}}}}else p.isOpen&&x()}),window.location.hash&&r.emitEvent(window,"hashchange")}"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o)}();;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.