PageSourceSearch

https://newenden-pc.gov.uk/wp-content/plugins/altcha/public/vendor/interceptor.min.js?ver=3.0.4

js newenden-pc.gov.uk collected 2026-10-02 20:23:15 UTC 6,665 bytes, 1 lines download raw bytes

1(function(u,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(u=typeof globalThis<"u"?globalThis:u||self,f(u["[name]"]={}))})(this,(function(u){"use strict";const f=Symbol("events_intercepted"),p=Symbol("request_intercepted"),T=H=>{const{debug:_=!1,formsSelector:C="form",filter:F,intercept:g=["fetch","forms","xhr"],onFailure:E,onVerified:P,widget:l}=H,b=globalThis.fetch.bind(globalThis),A=XMLHttpRequest.prototype.open,w=XMLHttpRequest.prototype.send,M=XMLHttpRequest.prototype.setRequestHeader,D=EventTarget.prototype.addEventListener,v=!!window.isSecureContext,y="Secure Context (HTTPS) required! Learn more: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts";let d=[],q=!1;c("Activating interceptor",g),v||c(new Error(y)),g.includes("fetch")&&I(),g.includes("forms")&&O(),g.includes("xhr")&&k();function x(){d.forEach(e=>{delete e.dataset.intercepted,e.removeEventListener("submit",X,{capture:!0}),e.querySelectorAll('[type="submit"]').forEach(t=>{t.removeEventListener("click",U,{capture:!0})})}),globalThis.fetch=b,XMLHttpRequest.prototype.open=A,XMLHttpRequest.prototype.send=w,XMLHttpRequest.prototype.setRequestHeader=M,EventTarget.prototype.addEventListener=D,delete XMLHttpRequest.prototype[p],delete EventTarget.prototype[f],d=[],c("Interceptor destroyed")}function I(){return p in globalThis.fetch?!1:(c("Registering fetch hooks"),globalThis.fetch=async(e,t={})=>{const n=t?.method||"GET",i=String(e),r=await L("fetch",n,i,t.headers,t.body);if(r){c("Intercepting fetch",n,i);try{if(!await m(typeof r=="object"?r:void 0))throw new Error("Unable to receive verification payload.")}catch(s){try{E?.(String(s.message||s))}catch{}throw s}}return b(e,t)},Object.assign(globalThis.fetch,{[p]:!0}),!0)}function O(){return d=[...new Set([...d,...document.querySelectorAll(C)])],c("Registering form hooks:",d.length),d.forEach(e=>{e.dataset.intercepted!=="true"&&(e.dataset.intercepted="true",e.addEventListener("submit",X,{capture:!0}),e.querySelectorAll('[type="submit"]').forEach(t=>{const n=t;n.onclick&&n.addEventListener("click",U,{capture:!0})}))}),!0}function k(){return p in XMLHttpRequest.prototype?!1:(c("Registering XMLHttpRequest hooks"),XMLHttpRequest.prototype.open=function(e,t,...n){return this._method=e.toUpperCase(),this._url=t,A.call(this,e,t,...n)},XMLHttpRequest.prototype.setRequestHeader=function(e,t){return this._headers||(this._headers=new Headers),this._headers.append(e,t),M.call(this,e,t)},XMLHttpRequest.prototype.send=function(e){const t=this._method||"GET",n=String(this._url||""),i=r=>{try{E?.(String(r.message||r))}catch{}this.dispatchEvent(new Event(String(r.message||r))),typeof this.onerror=="function"&&this.onerror.call(this,r)};L("xhr",t,n,this._headers,e).then(r=>{r?(c("Intercepting XMLHttpRequest",t,n),m(typeof r=="object"?r:void 0).then(s=>{if(s)w.call(this,e);else throw new Error("Unable to receive verification payload.")}).catch(i)):w.call(this,e)}).catch(i)},XMLHttpRequest.prototype[p]=!0,!0)}function c(...e){(_||e.some(t=>t instanceof Error))&&console[e[0]instanceof Error?"error":"log"]("ALTCHA Interceptor:",...e)}function j(e,t){try{return e=e instanceof URL?e:new URL(e,location.origin),t=t instanceof URL?t:new URL(t,location.origin),e.origin===t.origin&&e.pathname===t.pathname}catch{}return!1}function X(e){const t=e.target;if(q){e.preventDefault(),e.stopPropagation();return}if(t.dataset.altchaprocessing||t.querySelector("altcha-widget"))return;const n=t.getAttribute("method")?.toUpperCase()||"POST",i=t.getAttribute("action")||location.href;c("Intercepting form submit event",n,i),e.preventDefault(),e.stopPropagation();const r=e.submitter,s=r?.style.pointerEvents||"auto";r&&(r.style.pointerEvents="none"),t.dataset.altchaprocessing="true",L("form",n,i,void 0,new FormData(t)).then(o=>{if(o)return m(typeof o=="object"?o:void 0).then(a=>{if(a)t.dataset.altcha=a,S(t,r);else throw new Error("Unable to receive verification payload.")}).catch(a=>{try{E?.(String(a.message||a))}catch{}t.dispatchEvent(new Event(String(a.message||a)))}).finally(()=>{requestAnimationFrame(()=>{delete t.dataset.altcha})});requestAnimationFrame(()=>{S(t,r)}
1)}).finally(()=>{requestAnimationFrame(()=>{r&&(r.style.pointerEvents=s),delete t.dataset.altchaprocessing})})}function U(e){const t=e.target,n=t.closest("form");n&&(e.preventDefault(),e.stopPropagation(),n.dataset.altchaprocessing||S(n,t))}async function B(e,t){if(t instanceof FormData)return Object.fromEntries(t.entries());const n=new Response(t,{headers:e}),i=n.headers.get("content-type");return i?.includes("application/x-www-form-urlencoded")||i?.includes("multipart/form-data")?Object.fromEntries((await n.formData()).entries()):i?.includes("application/json")?n.json():null}async function m(e,t){q=!0;const n=document.createElement("altcha-widget"),i=n;if(!v)throw requestAnimationFrame(()=>{alert(y)}),new Error(y);let r=null;document.body.append(n);const s=new URL(t||l.challenge||location.href,location.origin);if(e)for(const o in e)e[o]!==null&&e[o]!==void 0&&s.searchParams.set("params."+o,e[o]);return new Promise((o,a)=>{requestAnimationFrame(()=>{"verify"in n?(n.addEventListener("code",()=>{c("Code verification requested")}),n.addEventListener("statechange",V=>{const h=V;if(c("Widget state change:",h.detail.state),h.detail.state==="verified"){const R=h.detail.payload;if(R){try{P?.(R)}catch{}o(R)}else a(new Error("Verification failed."))}else h.detail.state==="error"?a(new Error("Verification failed.")):h.detail.state==="unverified"&&o(null)}),i.configure({challenge:s.toString(),codeChallengeDisplay:"bottomsheet",debug:H.debug,display:l.display||"bar",fetch:b,hideFooter:l.hideFooter,hideLogo:l.hideLogo,minDuration:(l.display==="invisible"?0:500)+(l.delay||0)}),requestAnimationFrame(()=>{i.show(),v?i.verify():a(new Error(y))})):a(new Error("Failed to render widget."))})}).catch(o=>{throw r=o,o}).finally(()=>{q=!1,r?(l.display==="invisible"&&(i.configure({display:"bar"}),requestAnimationFrame(()=>{i.show()})),i&&i.getState()!=="error"&&i.reset("error",r)):(i?.reset(),n?.remove())})}function S(e,t){e&&"requestSubmit"in e?e.requestSubmit(t):e?.reportValidity()&&(t?t.click():e.submit())}async function L(e,t,n,i,r){if(l.challenge&&j(n,l.challenge))return!1;const s=new Headers(i),o=["GET","HEAD","OPTIONS"].includes(t)?null:await B(s,r);if(F)try{return await F({body:o,headers:s,method:t,source:e,url:new URL(n,location.origin)})}catch(a){c("Filter function error",a)}return!0}return{destroy:x,requestAltchaVerification:m}};globalThis.altchaInterceptor=T,u.interceptor=T,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));

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.