PageSourceSearch

https://nkdagility.com/js/env-switch.min.d44a2593ad72e48df77b8d0f02b11f24e25e9067a199ef7e29991de662ea14fb.js

js nkdagility.com collected 2026-10-02 03:57:19 UTC 2,825 bytes, 1 lines download raw bytes

1(function(){"use strict";if(window.nkdaEnvSwitchInit)return;window.nkdaEnvSwitchInit=!0;var e,s,o="/api/gateway/environment",t=document.querySelectorAll("[data-nkda-env-switch]");if(!t.length)return;e={environment:null,canSwitch:!1,busy:!1};function i(e){return{choices:e.querySelectorAll("[data-nkda-env-choice]"),reason:e.querySelector("[data-nkda-env-reason]")}}function r(e){return e==="sandbox"?"Sandbox":"Live"}function n(n){var s=n&&n.hover,o=e.environment==="sandbox",a=e.canSwitch&&!e.busy;document.querySelectorAll("[data-nkda-env-badge]").forEach(function(e){e.classList.toggle("d-none",!o)}),t.forEach(function(t){var r,o=i(t);o.choices.forEach(function(t){var n=t.getAttribute("data-nkda-env-choice")===e.environment;t.classList.toggle("active",n),t.setAttribute("aria-pressed",n?"true":"false"),t.disabled=!a}),[t].concat(Array.prototype.slice.call(o.choices)).forEach(function(e){s?e.setAttribute("title",s):e.removeAttribute("title")}),r=t.hasAttribute("data-nkda-env-compact")?n&&n.short:s,o.reason&&(r?(o.reason.textContent=r,o.reason.hidden=!1):(o.reason.textContent="",o.reason.hidden=!0))})}function c(){t.forEach(function(t){i(t).choices.forEach(function(t){if(t.nkdaEnvArmed)return;t.nkdaEnvArmed=!0,t.addEventListener("click",function(){var i,s=t.getAttribute("data-nkda-env-choice");if(e.busy||!e.canSwitch||s===e.environment)return;e.busy=!0,n(null),i=r(e.environment),fetch(o,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({environment:s})}).then(function(e){if(!e.ok){var t=new Error("switch failed");throw t.status=e.status,t}window.location.reload()}).catch(function(t){e.busy=!1;var s=t&&t.status?t.status:"?";n({short:"Switch failed (HTTP "+s+")",hover:"Switch failed (HTTP "+s+") — still on "+i+"."})})})})})}function l(e){return!e.hidden&&!e.closest("[hidden]")}s=!1;function a(){if(s)return;s=!0,d()}document.addEventListener("nkda:env-switch-revealed",a),Array.prototype.some.call(t,l)&&a();function d(){window.nkdaApiEnvironment||(window.nkdaApiEnvironment=fetch(o,{cache:"no-store",credentials:"same-origin"}).then(function(e){return e.ok?e.json().then(function(t){return{ok:!0,status:e.status,data:t}}):{ok:!1,status:e.status}}).catch(function(){return{ok:!1,status:0}})),window.nkdaApiEnvironment.then(function(e){if(!e.ok){var t=new Error("unavailable");throw t.status=e.status,t}return e.data}).then(function(t){e.environment=t&&t.environment==="sandbox"?"sandbox":"live",e.canSwitch=!!(t&&t.canSwitch),n(e.canSwitch?null:{short:null,hover:"Only the admin role can switch environments."}),c()}).catch(function(t){e.environment=null,e.canSwitch=!1;var s=t&&t.status,o=s?"HTTP "+s:"no response";n({short:"Unavailable ("+o+")",hover:"Environment switch unavailable — this site's API gateway did not answer ("+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.