1/* 2@licstart The following is the entire license notice for the 3JavaScript code in this page. 4 5Copyright (c) 2025 Xe Iaso <[email protected]> 6 7Permission is hereby granted, free of charge, to any person obtaining a copy 8of this software and associated documentation files (the "Software"), to deal 9in the Software without restriction, including without limitation the rights 10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11copies of the Software, and to permit persons to whom the Software is 12furnished to do so, subject to the following conditions: 13 14The above copyright notice and this permission notice shall be included in 15all copies or substantial portions of the Software. 16 17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23THE SOFTWARE. 24 25Includes code from https://github.com/aws/aws-sdk-js-crypto-helpers which is 26used under the terms of the Apache 2 license. 27 28@licend The above is the entire license notice 29for the JavaScript code in this page. 30*/ 31(()=>{var F=[408,425,429,500,502,503,504],D=e=>e!=null&&typeof e=="object"&&e.name==="AbortError",R=()=>new DOMException("Aborted","AbortError"),Y=(e,t)=>new Promise((n,o)=>{if(t!=null&&t.aborted){o(R());return}let s=()=>{clearTimeout(r),o(R())},r=setTimeout(()=>{t!=null&&t.removeEventListener("abort",s),n()},e);t!=null&&t.addEventListener("abort",s,{once:!0})}),I=(e,t=750,n=1e4)=>Math.random()*Math.min(n,t*Math.pow(e,2)),q=e=>{let t=e.headers.get("Retry-After");if(t===null)return null;let n=Number(t);if(Number.isFinite(n))return Math.max(0,n*1e3);let o=Date.parse(t);return Number.isNaN(o)?null:Math.max(0,o-Date.now())},L=async(e,t={})=>{var f,g,b,w;let n=(f=t.attempts)!=null?f:5,o=(g=t.baseDelayMs)!=null?g:750,s=(b=t.maxDelayMs)!=null?b:1e4,r=(w=t.signal)!=null?w:null,c=new Error(`anubis: ${e} could not be fetched`),u=null;for(let m=0;m<n;m++){if(m>0){let i=u!==null?u:I(m-1,o,s);u=null,await Y(i,r)}let l;try{l=await fetch(e,r===null?{}:{signal:r})}catch(i){if(D(i))throw i;c=i instanceof Error?i:new Error(String(i));continue}if(l.ok)return l;if(c=new Error(`anubis: ${e} returned HTTP ${l.status} (unretryable failure)`),F.indexOf(l.status)===-1)throw c;let p=q(l);p!==null&&(u=Math.min(p,s))}throw c};var H=()=>navigator.hardwareConcurrency!==void 0?navigator.hardwareConcurrency:1,X=e=>({spawn:()=>new Worker(e),dispose:()=>{}}),B=async(e,t)=>{let n=X(e),o;try{let r=await L(e,{signal:t});o=URL.createObjectURL(new Blob([await r.text()],{type:"text/javascript"}))}catch(r){if(D(r))throw r;return console.warn("anubis: could not pre-fetch worker source (server may be under attack) using direct spawner in the vain hope that this works",r),n}let s=!0;return{spawn:()=>{if(s)try{return new Worker(o)}catch(r){console.warn("anubis: blob worker rejected, using direct URL",r),s=!1}return new Worker(e)},dispose:()=>URL.revokeObjectURL(o)}};var J=()=>navigator.userAgent.includes("Firefox")||navigator.userAgent.includes("Goanna")?(console.log("Firefox detected, using pure-JS fallback"),"purejs"):window.isSecureContext?"webcrypto":"purejs";async function _(e,t,n=5,o=null,s,r=Math.trunc(Math.max(H()/2,1))){console.debug("fast algo");let c=J(),u=`${e.basePrefix}/.within.website/x/cmd/anubis/static/js/worker/sha256-${c}.mjs?cacheBuster=${e.version}`,f=await B(u,o);try{return await V(f,t,n,o,s,r)}finally{f.dispose()}}function V(e,t,n,o,s,r){return new Promise((c,u)=>{let f=[],g=!1,b=0,w=()=>{console.log("PoW aborted"),m(),u(new DOMException("Aborted","AbortError"))},m=()=>{g||(g=!0,f.forEach(l=>l.terminate()),o!=null&&o.removeEventListener("abort",w))};if(o!=null){if(o.aborted)return w();o.addEventListener("abort",w,{once:!0})}for(let l=0;l<r;l++){let p;try{p=e.spawn()}catch(i){m(),u(new Error(`anubis: could not start proof of work worker: ${i} (is your browser out of date?)`));return}f.push(p),p.onmessage=i=>{typeof i.data=="number"?s==null||s(i.data):(m(),c(i.data))},p.onerror=i=>{b++,console.warn(`anubis: proof of work worker died (${b}/${r})`,i),!(b<r)&&(m(),u(new Error("anubis: all proof of work workers failed at runtime (file a bug?)")))},p.postMessage({data:t,difficulty:n,nonce:l,threads:r})}})}var U={fast:_,slow:_};var k=e=>document.getElementById(e);var S=(e="",t={})=>{let n=new URL(e,window.location.href);return Object.entries(t).forEach(o=>{let[s,r]=o;n.searchParams.set(s,r)}),n.toString()};var x=e=>{let t=k(e);return t===null?null:JSON.parse(t.textContent)};var G=window.__anubisBooted===!0;window.__anubisBooted=!0;var P=(e,t,n)=>S(`${n}/.within.website/x/cmd/anubis/static/img/${e}.webp`,{cacheBuster:t}),z=async()=>document.documentElement.lang,C=async e=>{let t=x("anubis_base_prefix");if(t===null)return{};try{return await(await L(`${t}/.within.website/x/cmd/anubis/static/locales/${e}.json`)).json()}catch(n){return console.warn(`Failed to load translations for ${e}`,n),e!=="en"?await C("en"):{}}},j=()=>{let e=x("anubis_public_url");return e===null?"/":e&&window.location.href.startsWith(e)?new URLSearchParams(window.location.search).get("redir"):window.location.href},v={},O,K=async()=>{O=await z(),v=await C(O)},d=e=>v[`js_${e}
31`]||v[e]||`unknown translatable string: ${e}`;(async()=>{var $;if(G){console.debug("anubis: main.mjs already running, ignoring duplicate load");return}await K();let e=[{name:"Web Workers",msg:d("web_workers_error"),value:window.Worker},{name:"Cookies",msg:d("cookies_error"),value:navigator.cookieEnabled}],t=k("status"),n=k("image"),o=k("title"),s=k("progress"),r=x("anubis_version"),c=x("anubis_base_prefix"),u=document.querySelector("details"),f=!1;u&&u.addEventListener("toggle",()=>{u.open&&(f=!0)});let g=({titleMsg:h,statusMsg:y,imageSrc:E})=>{o.innerHTML=h,t.innerHTML=y,n.src=E,s.style.display="none"};t.innerHTML=d("calculating");for(let{value:h,name:y,msg:E}of e)if(!h){g({titleMsg:`${d("missing_feature")} ${y}`,statusMsg:E,imageSrc:P("reject",r,c)});return}let{challenge:b,rules:w}=x("anubis_challenge"),m=U[w.algorithm];if(!m){g({titleMsg:d("challenge_error"),statusMsg:d("challenge_error_msg"),imageSrc:P("reject",r,c)});return}t.innerHTML=`${d("calculating_difficulty")} ${w.difficulty}, `,s.style.display="inline-block";let l=document.createTextNode(`${d("speed")} 0kH/s`);t.appendChild(l);let p=0,i=!1,N=Math.pow(16,-w.difficulty);try{let h=Date.now(),{hash:y,nonce:E}=await m({basePrefix:c,version:r},b.randomData,w.difficulty,null,a=>{let M=Date.now()-h;M-p>1e3&&(p=M,l.data=`${d("speed")} ${(a/M).toFixed(3)}kH/s`);let A=Math.pow(1-N,a),T=(1-Math.pow(A,2))*100;s.ariaValueNow=`${T}`,s.firstElementChild!==null&&(s.firstElementChild.style.width=`${T}%`),A<.1&&!i&&(t.append(document.createElement("br"),document.createTextNode(d("verification_longer"))),i=!0)}),W=Date.now();if(console.log({hash:y,nonce:E}),f){let M=function(){var T;let A=(T=j())!=null?T:"/";window.location.replace(S(`${c}/.within.website/x/cmd/anubis/api/pass-challenge`,{id:b.id,response:y,nonce:E,redir:A,elapsedTime:`${W-h}`}))},a=document.getElementById("progress");a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="center",a.style.height="2rem",a.style.borderRadius="1rem",a.style.cursor="pointer",a.style.background="#b16286",a.style.color="white",a.style.fontWeight="bold",a.style.outline="4px solid #b16286",a.style.outlineOffset="2px",a.style.width="min(20rem, 90%)",a.style.margin="1rem auto 2rem",a.innerHTML=d("finished_reading"),a.onclick=M,setTimeout(M,3e4)}else{let a=($=j())!=null?$:"/";window.location.replace(S(`${c}/.within.website/x/cmd/anubis/api/pass-challenge`,{id:b.id,response:y,nonce:E,redir:a,elapsedTime:`${W-h}`}))}}catch(h){g({titleMsg:d("calculation_error"),statusMsg:`${d("calculation_error_msg")} ${h.message}`,imageSrc:P("reject",r,c)})}})();})(); 32//# sourceMappingURL=main.mjs.map
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.