PageSourceSearch

https://incode.com/js/site.js

js incode.com collected 2026-10-02 03:55:38 UTC 20,938 bytes, 527 lines download raw bytes

1(function() {
2    "use strict";
3    var reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
4    function stripEmptyIds() {
5        var els = document.querySelectorAll('script[id=""]');
6        for (var i = 0; i < els.length; i++) els[i].removeAttribute("id");
7    }
8    stripEmptyIds();
9    new MutationObserver(stripEmptyIds).observe(document.documentElement, {
10        childList: true,
11        subtree: true
12    });
13    function stripStrayTextNodes() {
14        var n = document.body.firstChild;
15        while (n) {
16            var next = n.nextSibling;
17            if (n.nodeType === 3 && /^\s*$/.test(n.textContent) && /[\u2028\u2029\u00A0\u202F\uFEFF]/.test(n.textContent)) {
18                document.body.removeChild(n);
19            }
20            n = next;
21        }
22    }
23    stripStrayTextNodes();
24    new MutationObserver(stripStrayTextNodes).observe(document.body, {
25        childList: true
26    });
27    var hasScrolled = window.scrollY > 4;
28    var scrollGateWaiters = [];
29    var scrollGateRearmFns = [];
30    function onScrollGate(fn) {
31        if (hasScrolled) {
32            fn();
33            return;
34        }
35        scrollGateWaiters.push(fn);
36    }
37    function armScrollGate() {
38        window.addEventListener("scroll", function release() {
39            if (window.scrollY <= 4) return;
40            hasScrolled = true;
41            window.removeEventListener("scroll", release);
42            scrollGateWaiters.forEach(function(fn) {
43                fn();
44            });
45            scrollGateWaiters = [];
46        }, {
47            passive: true
48        });
49    }
50    if (!hasScrolled) armScrollGate();
51    window.addEventListener("pageshow", function(e) {
52        if (!e.persisted || window.scrollY > 4) return;
53        hasScrolled = false;
54        scrollGateWaiters = [];
55        armScrollGate();
56        scrollGateRearmFns.forEach(function(fn) {
57            fn();
58        });
59    });
60    function initReveal() {
61        var els = [].slice.call(document.querySelectorAll("[data-reveal]"));
62        if (!els.length) return;
63        els.forEach(function(el) {
64            var d = el.getAttribute("data-reveal-delay");
65            if (d) el.style.setProperty("--reveal-delay", d + "s");
66            var y = el.getAttribute("data-reveal-y");
67            if (y) el.style.setProperty("--reveal-y", y + "px");
68        });
69        if (reduceMotion || !("IntersectionObserver" in window)) {
70            els.forEach(function(el) {
71                el.classList.add("is-revealed");
72            });
73            return;
74        }
75        els.forEach(function(el) {
76            if (!el.hasAttribute("data-reveal-scroll")) return;
77            scrollGateRearmFns.push(function() {
78                el.classList.remove("is-revealed");
79                onScrollGate(function() {
80                    el.classList.add("is-revealed");
81                });
82            });
83        });
84        var io = new IntersectionObserver(function(entries) {
85            entries.forEach(function(entry) {
86                if (!entry.isIntersecting) return;
87                var el = entry.target;
88                io.unobserve(el);
89                if (!hasScrolled && el.hasAttribute("data-reveal-scroll")) {
90                    onScrollGate(function() {
91                        el.classList.add("is-revealed");
92                    });
93                    return;
94                }
95                el.classList.add("is-revealed");
96            });
97        }, {
98            rootMargin: "-80px 0px -80px 0px"
99        });
100        els.forEach(function(el) {
101            io.observe(el);
102        });
103    }
104    var COUNTER_FROM = .97;
105    function initCounters() {
106        var els = [].slice.call(document.querySelectorAll("[data-counter]"));
107        if (!els.length) return;
108        function easeOutCubic(t) {
109            var u = 1 - t;
110            return 1 - u * u * u;
111        }
112        function format(v, decimals, prefix, suffix) {
113            return prefix + v.toFixed(decimals).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + suffix;
114        }
115        function run(el) {
116            var to = parseFloat(el.getAttribute("data-counter-to") || "0");
117            var duration = parseFloat(el.getAttribute("data-counter-duration") || "2.4") * 1e3;
118            var prefix = el.getAttribute("data-counter-prefix") || "";
119            var suffix = el.getAttribute("data-counter-suffix") || "";
120            var decimals = parseInt(el.getAttribute("data-counter-decimals") || "0", 10);
121            if (reduceMotion) {
122                el.textContent = format(to, decimals, prefix, suffix);
123                return;
124            }
125            var from = to * COUNTER_FROM;
126            var start = null;
127            function frame(ts) {
128                if (start === null) start = ts;
129                var t = Math.min((ts - start) / duration, 1);
130                el.textContent = format(from + (to - from) * easeOutCubic(t), decimals, prefix, suffix);
131                if (t < 1) requestAnimationFrame(frame);
132            }
133            requestAnimationFrame(frame);
134        }
135        if (!("IntersectionObserver" in window)) {
136            els.forEach(run);
137            return;
138        }
139        els.forEach(function(el) {
140            if (reduceMotion || !el.closest("[data-reveal-scroll]")) return;
141            scrollGateRearmFns.push(function() {
142                var prefix = el.getAttribute("data-counter-prefix") || "";
143                var suffix = el.getAttribute("data-counter-suffix") || "";
144                var decimals = parseInt(el.getAttribute("data-counter-decimals") || "0", 10);
145                var to = parseFloat(el.getAttribute("data-counter-to") || "0");
146                el.textContent = format(to * COUNTER_FROM, decimals, prefix, suffix);
147                onScrollGate(function() {
148                    run(el);
149                });
150            });
151        });
152        var io = new IntersectionObserver(function(entries) {
153            entries.forEach(function(entry) {
154                if (!entry.isIntersecting) return;
155                var el = entry.target;
156                io.unobserve(el);
157                if (!hasScrolled && el.closest("[data-reveal-scroll]")) {
158                    onScrollGate(function() {
159                        run(el);
160                    });
161                    return;
162                }
163                run(el);
164            });
165        }, {
166            rootMargin: "-60px 0px -60px 0px"
167        });
168        els.forEach(function(el) {
169            io.observe(el);
170        });
171    }
172    function initTabs() {
173        document.querySelectorAll("[data-tabs]").forEach(function(root) {
174            var tabs = root.querySelectorAll("[data-tab]");
175            function activate(tab) {
176                var key = tab.getAttribute("data-tab");
177                tabs.forEach(function(t) {
178                    t.classList.toggle("is-active", t === tab);
179                    t.setAttribute("aria-selected", t === tab ? "true" : "false");
180                });
181                root.querySelectorAll("[data-tab-panel]").forEach(function(p) {
182                    p.classList.toggle("is-active", p.getAttribute("data-tab-panel") === key);
183                });
184            }
185            tabs.forEach(function(tab) {
186                tab.setAttribute("role", "tab");
187                tab.addEventListener("click", function() {
188                    activate(tab);
189                });
190            });
191            if (tabs.length && !root.querySelector("[data-tab-panel].is-active")) {
192                activate(tabs[0]);
193            }
194        });
195    }
196    function initNav() {
197        var toggle = document.querySelector("[data-nav-toggle]");
198        var nav = document.querySelector("[data-nav]");
199        if (!toggle || !nav) return;
200        function setOpen(open) {
201            nav.classList.toggle("is-open", open);
202            toggle.classList.toggle("is-open", open);
203            toggle.setAttribute("aria-expanded", open ? "true" : "false");
204            document.documentElement.classList.toggle("nav-open", open);
205        }
206        toggle.addEventListener("click", function() {
207            setOpen(!nav.classList.contains("is-open"));
208        });
209        nav.addEventListener("click", function(e) {
210            if (e.target.closest("a")) setOpen(false);
211        });
212        document.addEventListener("keydown", function(e) {
213            if (e.key === "Escape") setOpen(false);
214        });
215    }
216    function initHeaderScroll() {
217        var header = document.querySelector("[data-header]");
218        if (!header) return;
219        var brights = [].slice.call(document.querySelectorAll("[data-header-bright]"));
220        var heroCard = header.classList.contains("c-header--card") ? document.querySelector("main section") : null;
221        function onScroll() {
222            var bright;
223            if (brights.length) {
224                var mid = header.offsetHeight / 2;
225                bright = brights.some(function(s) {
226                    var r = s.getBoundingClientRect();
227                    return r.top <= mid && r.bottom > mid;
228                });
229            } else {
230                bright = window.scrollY > 8;
231            }
232            header.classList.toggle("is-scrolled", bright);
233            header.classList.toggle("is-past-top", window.scrollY > 8);
234            if (heroCard) {
235                header.classList.toggle("is-over-hero", heroCard.getBoundingClientRect().bottom > header.offsetHeight / 2);
236            }
237        }
238        window.addEventListener("scroll", onScroll, {
239            passive: true
240        });
241        onScroll();
242    }
243    function initCardHeroSnap() {
244        if (!document.querySelector(".mod-hero__inner, .co-hero")) return;
245        window.addEventListener("pageshow", function() {
246            requestAnimationFrame(function() {
247                if (window.scrollY > 0 && window.scrollY < window.innerHeight * .9) {
248                    window.scrollTo(0, 0);
249                }
250            });
251        });
252    }
253    function initForms() {
254        document.querySelectorAll("[data-demo-form]").forEach(function(form) {
255            form.addEventListener("submit", function(e) {
256                e.preventDefault();
257                form.classList.add("is-pending");
258                var btn = form.querySelector('button[type="submit"]');
259                if (btn) btn.disabled = true;
260                setTimeout(function() {
261                    form.classList.remove("is-pending");
262                    form.hidden = true;
263                    var scope = form.closest("[data-form-scope]") || document;
264                    var success = scope.querySelector("[data-form-success]");
265                    if (success) success.hidden = false;
266                }, 700);
267            });
268        });
269    }
270    function initHeaderMegaIndent() {
271        var header = document.querySelector("[data-header]");
272        if (!header || !header.querySelector(".c-header__mega--indent, .c-header__mega--feature")) return;
273        var link = header.querySelector(".c-header__nav .c-header__link");
274        var panel = header.querySelector(".c-header__mega-inner");
275        if (!link || !panel) return;
276        function measure() {
277            var linkRect = link.getBoundingClientRect();
278            var panelRect = panel.getBoundingClientRect();
279            if (!linkRect.width || !panelRect.width) return;
280            var textStart = linkRect.left + parseFloat(window.getComputedStyle(link).paddingLeft || "0");
281            header.style.setProperty("--hdr-nav-indent", Math.max(32, Math.round(textStart - panelRect.left)) + "px");
282        }
283        window.addEventListener("resize", measure, {
284            passive: true
285        });
286        window.addEventListener("load", measure);
287        measure();
288    }
289    function initHeaderFeatureFallback() {
290        [].slice.call(document.querySelectorAll(".c-header__mega-feature-media img")).forEac
290h(function(img) {
291            function hide() {
292                img.style.display = "none";
293            }
294            img.addEventListener("error", hide);
295            if (img.complete && img.naturalWidth === 0) hide();
296        });
297    }
298    window.siteModal = function(root, paneSel, closeSel, opts) {
299        opts = opts || {};
300        var panes = paneSel ? [].slice.call(root.querySelectorAll(paneSel)) : [];
301        var closeBtn = root.querySelector("[data-modal-focus], button");
302        var lastFocus = null;
303        var hideTimer = null;
304        var gutter = window.CSS && window.CSS.supports && window.CSS.supports("scrollbar-gutter", "stable");
305        function lock() {
306            var docEl = document.documentElement;
307            if (gutter) {
308                docEl.style.scrollbarGutter = "stable";
309            } else {
310                var gap = window.innerWidth - docEl.clientWidth;
311                if (gap > 0) docEl.style.paddingRight = gap + "px";
312            }
313            docEl.style.overflow = "hidden";
314        }
315        function unlock() {
316            var docEl = document.documentElement;
317            docEl.style.overflow = "";
318            docEl.style.scrollbarGutter = "";
319            docEl.style.paddingRight = "";
320        }
321        function open(i) {
322            if (hideTimer) {
323                window.clearTimeout(hideTimer);
324                hideTimer = null;
325            }
326            panes.forEach(function(p, k) {
327                p.hidden = k !== i;
328            });
329            lastFocus = document.activeElement;
330            root.hidden = false;
331            lock();
332            window.requestAnimationFrame(function() {
333                window.requestAnimationFrame(function() {
334                    root.classList.add("is-open");
335                });
336            });
337            if (closeBtn) closeBtn.focus();
338        }
339        function close() {
340            if (root.hidden) return;
341            root.classList.remove("is-open");
342            unlock();
343            if (opts.onClose) opts.onClose();
344            hideTimer = window.setTimeout(function() {
345                root.hidden = true;
346                hideTimer = null;
347            }, reduceMotion ? 0 : 320);
348            if (lastFocus && lastFocus.focus) lastFocus.focus();
349            lastFocus = null;
350        }
351        [].slice.call(root.querySelectorAll(closeSel)).forEach(function(el) {
352            el.addEventListener("click", close);
353        });
354        document.addEventListener("keydown", function(e) {
355            if (e.key === "Escape") close();
356        });
357        return {
358            open: open,
359            close: close
360        };
361    };
362    function init() {
363        initTabs();
364        initReveal();
365        initCounters();
366        initNav();
367        initHeaderScroll();
368        initCardHeroSnap();
369        initHeaderMegaIndent();
370        initHeaderFeatureFallback();
371        initForms();
372    }
373    if (document.readyState === "loading") {
374        document.addEventListener("DOMContentLoaded", init);
375    } else {
376        init();
377    }
378})();
379
380document.querySelectorAll("[data-cookie-settings]").forEach(function(link) {
381    link.addEventListener("click", function(e) {
382        e.preventDefault();
383        if (window.CookieScript && window.CookieScript.instance) {
384            window.CookieScript.instance.showDetails();
385        }
386    });
387});
388
389(function() {
390    var CS_COPY = "We use cookies to personalize content and ads, and to analyze our " + "traffic. We also share information about your use of our site with " + "our advertising and analytics partners, who may combine it with " + "other information that you have provided to them or that they have " + "collected from your use of their services. Please see our";
391    function csRewrite() {
392        var desc = document.getElementById("cookiescript_description");
393        if (!desc || desc.getAttribute("data-cs-rewrote")) return !!desc;
394        var box = desc.querySelector("[data-cs-desc-box]");
395        var more = document.getElementById("cookiescript_readmore");
396        if (!box || !more) return false;
397        desc.setAttribute("data-cs-rewrote", "1");
398        box.textContent = CS_COPY;
399        more.textContent = more.textContent.replace(/\s+/g, " ").trim();
400        for (var n = desc.firstChild; n; ) {
401            var next = n.nextSibling;
402            if (n.nodeType === 3 && !n.textContent.trim()) desc.removeChild(n);
403            n = next;
404        }
405        desc.insertBefore(document.createTextNode(" "), more);
406        desc.appendChild(document.createTextNode("."));
407        return true;
408    }
409    if (!csRewrite() && window.MutationObserver) {
410        var csObs = new MutationObserver(function() {
411            if (csRewrite()) csObs.disconnect();
412        });
413        csObs.observe(document.documentElement, {
414            childList: true,
415            subtree: true
416        });
417        window.setTimeout(function() {
418            csObs.disconnect();
419        }, 2e4);
420    }
421})();
422
423document.querySelectorAll("[data-newsletter]").forEach(function(box) {
424    var form = box.querySelector("[data-newsletter-form]");
425    var msg = box.querySelector("[data-newsletter-msg]");
426    if (!form || !msg) return;
427    form.addEventListener("submit", function(e) {
428        e.preventDefault();
429        var es = (document.documentElement.lang || "").indexOf("es") === 0;
430        var show = function(text, ok) {
431            msg.textContent = text;
432            msg.hidden = false;
433            msg.classList.toggle("is-ok", !!ok);
434        };
435        var formId = box.getAttribute("data-form-id");
436        if (!formId) {
437            show(es ? "La suscripción aún no está activa — vuelve pronto." : "Subscriptions aren't active yet — check back soon.", false);
438            return;
439        }
440        var portal = box.getAttribute("data-portal-id");
441        var email = form.querySelector('input[type="email"]').value;
442        var btn = form.querySelector('button[type="submit"]');
443        btn.disabled = true;
444        fetch("https://api.hsforms.com/submissions/v3/integration/submit/" + portal + "/" + formId, {
445            method: "POST",
446            headers: {
447                "Content-Type": "application/json"
448            },
449            body: JSON.stringify({
450                fields: [ {
451                    objectTypeId: "0-1",
452                    name: "email",
453                    value: email
454                } ],
455                context: {
456                    pageUri: location.href,
457                    pageName: document.title
458                }
459            })
460        }).then(function(r) {
461            if (r.ok) {
462                show(es ? "¡Gracias! Suscripción recibida." : "Thank you! You're subscribed.", true);
463                form.reset();
464            } else {
465                show(es ? "Algo salió mal — intenta de nuevo." : "Something went wrong — please try again.", false);
466            }
467        }).catch(function() {
468            show(es ? "Algo salió mal — intenta de nuevo." : "Something went wrong — please try again.", false);
469        }).finally(function() {
470            btn.disabled = false;
471        });
472    });
473});
474
475document.addEventListener("error", function(e) {
476    var img = e.target;
477    if (!img || img.tagName !== "IMG" || !img.closest) return;
478    if (!img.closest(".prose-blog") && !img.hasAttribute("data-hide-onerror")) return;
479    var fig = img.closest("figure");
480    (fig || img).style.display = "none";
481}, true);
482
483(function() {
484    var mq = window.matchMedia("(max-width: 1023px)");
485    function availWidth(el) {
486        var p = el.parentElement;
487        if (!p) return 0;
488        var cs = window.getComputedStyle(p);
489        return p.clientWidth - (parseFloat(cs.paddingLeft) || 0) - (parseFloat(cs.paddingRight) || 0);
490    }
491    function fit() {
492        var decks = document.querySelectorAll("[data-dash-fit]");
493        for (var i = 0; i < decks.length; i++) {
494            var d = decks[i];
495            var base = parseFloat(d.getAttribute("data-dash-base")) || 0;
496            if (!base) continue;
497            d.style.zoom = "";
498            d.style.width = "";
499            d.style.maxWidth = "";
500            if (!mq.matches) continue;
501            var avail = availWidth(d);
502            if (avail > 0 && avail < base) {
503                d.style.width = base + "px";
504                d.style.maxWidth = "none";
505                d.style.zoom = (avail / base).toFixed(4);
506            }
507        }
508    }
509    window.__dashFit = fit;
510    function ready(fn) {
511        if (document.readyState !== "loading") fn(); else document.addEventListener("DOMContentLoaded", fn);
512    }
513    ready(function() {
514        fit();
515        var raf;
516        function onResize() {
517            if (raf) cancelAnimationFrame(raf);
518            raf = requestAnimationFrame(fit);
519        }
520        window.addEventListener("resize", onResize, {
521            passive: true
522        });
523        window.addEventListener("orientationchange", fit);
524        if (mq.addEventListener) mq.addEventListener("change", fit); else if (mq.addListener) mq.addListener(fit);
525        window.addEventListener("load", fit);
526    });
527})();

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.