PageSourceSearch

https://darwinbox.com/_next/static/chunks/3128.4db8ab05db7d29bb.js

js darwinbox.com collected 2026-09-24 17:43:31 UTC 4,867 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3128,3990],{43128:function(e,t,r){"use strict";r.r(t);var n=r(85893),o=r(67294),l=r(73935),a=r(70724),i=r(93990),u=r.n(i);let s=window.location.search.includes("vgdebug=1");t.default=e=>{let{open:t,onClose:r,onSubmitted:i,title:c,bodyContent:d,formBloks:m,formCss:v,formStyle:f}=e,g=(0,o.useRef)(null),y=(0,o.useRef)(""),b=(0,o.useRef)(!1);(0,o.useEffect)(()=>{t&&(b.current=!1)},[t]);let h=e=>{if(b.current){s&&console.log("[video-gate] duplicate submit signal ignored");return}b.current=!0,i(e)},[p,_]=(0,o.useState)(!1);return((0,o.useEffect)(()=>_(!0),[]),(0,o.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&r()};document.addEventListener("keydown",e);let n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",e),document.body.style.overflow=n}},[t,r]),(0,o.useEffect)(()=>{if(!t)return;let e=e=>{var t,r,n,o;let l=e.data;if(!l||"hsFormCallback"!==l.type)return;if(s&&console.log("[video-gate] hsFormCallback:",l.eventName,l),"onFormReady"===l.eventName){s&&console.log("[video-gate] form ready");return}if("onFormSubmitted"!==l.eventName&&"onFormSubmit"!==l.eventName)return;let a="";try{a=(null===(r=g.current)||void 0===r?void 0:null===(t=r.querySelector('form input[name="email"]'))||void 0===t?void 0:t.value)||""}catch(e){}if(!a)try{let e=null===(n=g.current)||void 0===n?void 0:n.querySelector("iframe.hs-form-iframe"),t=null==e?void 0:e.contentDocument;t&&(a=(null===(o=t.querySelector('input[name="email"]'))||void 0===o?void 0:o.value)||"")}catch(e){}if(!a){let e=l.data||l.submissionValues||[];Array.isArray(e)?a=(e.find(e=>(null==e?void 0:e.name)==="email")||{}).value||"":e&&"object"==typeof e&&(a=e.email||"")}if("onFormSubmit"===l.eventName){y.current=a,s&&console.log("[video-gate] captured email, waiting for onFormSubmitted:",a||"(empty)");return}let i=a||y.current||"";s&&console.log("[video-gate] onFormSubmitted -> unlocking:",i),h(i)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[t,i]),(0,o.useEffect)(()=>{if(!t)return;let e=g.current;if(!e)return;let r=new MutationObserver(()=>{if(!y.current)return;let t=!!e.querySelector("form"),n=e.querySelector(".submitted-message, .hs-form-frame__thankyou");if(!t||n){s&&console.log("[video-gate] form replaced by thank-you -> unlocking (fallback):",y.current);let e=y.current;y.current="",r.disconnect(),h(e)}});return r.observe(e,{childList:!0,subtree:!0}),()=>r.disconnect()},[t,i]),(0,o.useEffect)(()=>{if(!t)return;let e=g.current;if(!e)return;let r=e=>{let t=e.target;if(!t||"FORM"!==t.tagName)return;let r=t.querySelector('input[name="email"]')||t.querySelector('input[type="email"]');(null==r?void 0:r.value)?(y.current=r.value,s&&console.log("[video-gate] email captured at submit:",r.value)):s&&console.warn("[video-gate] submit fired but no email input found - tracking will not work")};return e.addEventListener("submit",r,!0),()=>e.removeEventListener("submit",r,!0)},[t]),(0,o.useEffect)(()=>{if(!t)return;let e=g.current;if(!e)return;let r=e=>{let t=e.target;if(!t||"FORM"!==t.tagName)return;if(t.classList.contains("hs-form")||t.classList.contains("hs-form-private")||t.closest(".hs-form-private, .hs-form-frame")){s&&console.log("[video-gate] native submit seen on HubSpot form -> NOT intercepting (correct)");return}let r=t.querySelector('input[name="email"]')||t.querySelector('input[type="email"]'),n=(null==r?void 0:r.value)||"";n&&(e.preventDefault(),h(n))};return e.addEventListener("submit",r),()=>e.removeEventListener("submit",r)},[t,i]),t&&p)?(0,l.createPortal)((0,n.jsx)("div",{className:u().overlay,role:"dialog","aria-modal":"true","aria-label":c||"Unlock the videos",onClick:e=>{e.target===e.currentTarget&&r()},children:(0,n.jsxs)("div",{className:u().panel,ref:g,children:[(0,n.jsx)("button",{type:"button","aria-label":"Close",className:u().closeBtn,onClick:r,children:(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M1 1 L13 13 M13 1 L1 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}),c&&(0,n.jsx)("h3",{className:u().title,children:c}),Array.isArray(d)&&d.length>0&&(0,n.jsx)("div",{className:u().body,children:(0,a.sb)(d)}),v&&(0,n.jsx)("style",{dangerouslySetInnerHTML:{__html:String(v)}}),Array.isArray(m)&&m.length>0&&(0,n.jsx)("div",{className:"".concat(u().formContainer," hs-form-skin ").concat(f||"").trim(),children:(0,a.sb)(m)})]})}),document.body):null}},93990:function(e){e.exports={overlay:"video-gate-modal_overlay__mdIa7",gateFadeIn:"video-gate-modal_gateFadeIn__c4g6j",panel:"video-gate-modal_panel__9jFAM",closeBtn:"video-gate-modal_closeBtn__aoNJw",title:"video-gate-modal_title__htrHE",body:"video-gate-modal_body__zbwrP",formContainer:"video-gate-modal_formContainer__oDYG3"}}}]);

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.