/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@friendlycaptcha/sdk@0.2.0/sdk.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
function flatPromise(e){let t,n;const i=new Promise(((e,i)=>{t=e,n=i}));return e&&e(t,n),{promise:i,resolve:t,reject:n}}function stringHasPrefix(e,t){return 0===e.lastIndexOf(t,0)}var originRegex=/^((?:\w+:)?\/\/([^\/]+))/;function encodeQuery(e){let t=[];const n=Object.keys(e),i=encodeURIComponent;for(let r=0;r<n.length;r++)t.push(`${i(n[r])}=${i(e[n[r]])}`);return t.join("&")}function originOf(e){const t=document.location;if(stringHasPrefix(e,"/")||stringHasPrefix(e,"."))return t.origin?t.origin:t.protocol+"//"+t.host;const n=e.match(originRegex);if(!n)throw new Error("Invalid URL: "+e);return n[1]}var IFrameCommunicationTarget=class{constructor(e){this.ready=!1,this.buffer=[],this.id=e.id,this.type=e.type,this.element=e.element,this.onReady=e.onReady,this.origin=originOf(e.element.src)}send(e){this.ready?this.element.contentWindow.postMessage(e,this.origin):this.buffer.push(e)}setReady(e){this.onReady(),this.ready=e,this.ready&&this.flush()}flush(){for(let e=0;e<this.buffer.length;e++)this.element.contentWindow.postMessage(this.buffer[e],this.origin);this.buffer=[]}};function isAllowedOrigin(e,t){return"*"===e||t.has(e)}var defaultGetStoreFunc,CommunicationBus=class{constructor(){this.origins=new Set,this.targets={},this.answered=new Set,this.onReceiveRootMessage=()=>{},window.addEventListener("message",(e=>{this.onReceive(e)}))}listen(e){let t=this.onReceiveRootMessage;this.onReceiveRootMessage=n=>{t(n),e(n)}}addOrigin(e){this.origins.add(e)}send(e){if(e.from_id){const t=this.targets[e.from_id];if(!t)return void console.error(`[bus] Unexpected message from unknown sender ${e.from_id}`,e);"widget_announce"!==e.type&&"agent_announce"!==e.type||t.setReady(!0)}const t=e.rid;if(t){if(this.answered.has(t+e.to_id))return;this.answered.add(t+e.to_id)}if(""===e.to_id)return void this.onReceiveRootMessage(e);const n=this.targets[e.to_id];n?n.send(e):console.error(`[bus] Unexpected message to unknown target ${e.to_id}`,e)}onReceive(e){if(!isAllowedOrigin(e.origin,this.origins))return;const t=e.data;t&&t._frc&&this.send(t)}registerTarget(e){this.targets[e.id]=e}registerTargetIFrame(e,t,n,i){const r=flatPromise();let o=new Promise((e=>setTimeout((()=>e("timeout")),i)));const s=new IFrameCommunicationTarget({id:t,element:n,type:e,onReady:()=>r.resolve("registered")});return this.registerTarget(s),Promise.race([r.promise,o])}removeTarget(e){delete this.targets[e]}};function randomId(e,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"){let n="";for(let i=0;i<e;i++)n+=t.charAt(Math.floor(Math.random()*t.length));return n}function promisifyRequest(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}function createStore(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const i=promisifyRequest(n);return(e,n)=>i.then((i=>n(i.transaction(t,e).objectStore(t))))}function defaultGetStore(){return defaultGetStoreFunc||(defaultGetStoreFunc=createStore("keyval-store","keyval")),defaultGetStoreFunc}function get(e,t=defaultGetStore()){return t("readonly",(t=>promisifyRequest(t.get(e))))}function set(e,t,n=defaultGetStore()){return n("readwrite",(n=>(n.put(t,e),promisifyRequest(n.transaction))))}var SESSION_COUNT_KEY="frc_sc",SESSION_ID_KEY="frc_sid",SEPARATOR="__",didIncrease=!1,sc="0",sid="__"+randomId(10);function sessionCount(e){if(!didIncrease){let t=0;try{t=parseInt(sessionStorage.getItem(SESSION_COUNT_KEY)||"",10)}catch(e){}isNaN(t)&&(t=0),e&&t++,sc=t.toString();try{sessionStorage.setItem(SESSION_COUNT_KEY,sc)}catch(e){}}return sc}function sessionId(){let e;try{e=sessionStorage.getItem(SESSION_ID_KEY)}catch(e){return sid}return e||(e=randomId(12),sessionStorage.setItem(SESSION_ID_KEY,e)),e}var Store=class{constructor(e){this.mem=new Map,this.storePrefix=e}setup(){return new Promise(((e,t)=>{if(void 0!==this._hasSA)return e(this._hasSA);try{indexedDB.open("")}catch(t){return e(this._hasSA=!1)}if(!document.hasStorageAccess)return e(this._hasSA=!0);document.hasStorageAccess().then((t=>(this._hasSA=t,this._hasSA?this.idb=createStore("friendlycaptcha","frc"):console.debug("FRC has no storage access"),e(this._hasSA)))).catch(t)}))}get(e,t){return this.setup().then((n=>{const i=this.storePrefix+SEPARATOR+e;if(t.p)return n?get(i,this.idb):this.mem.get(e);try{const e=sessionStorage.getItem(i);return null===e?void 0:e}catch(e){}return this.mem.get(e)}))}set(e,t,n){return this.setup().then((i=>{const r=this.storePrefix+SEPARATOR+e;if(n.p){if(i)return set(r,t,this.idb);void 0===t?this.mem.delete(e):this.mem.set(e,t)}else try{void 0===t?(this.mem.delete(e),sessionStorage.removeItem(r)):(this.mem.set(e,t),sessionStorage.setItem(r,t))}catch(e){}}))}hasSA(){return this._hasSA}},supportAllowClipboardWrite="undefined"!=typeof navigator&&void 0!==navigator.userAgentData;function findFRCElements(){return[document.querySelectorAll(".frc-captcha"),document.querySelectorAll(".frc-risk-intelligence")]}function findParentFormElement(e){for(;"FORM"!==e.tagName;)if(!(e=e.parentElement))return null;return e}function executeOnceOnFocusInEvent(e,t){e.addEventListener("focusin",t,{once:!0,passive:!0})}function createManagedInputElement(e,t){const n=document.createElement("input");return n.type="hidden",n.style.display="none",n.name=t,e.appendChild(n),n}function styleIfNotAlreadySet(e,t,n){""===e.style[t]&&(e.style[t]=n)}function setWidgetRootStyles(e){const t=styleIfNotAlreadySet;t(e,"position","relative"),t(e,"height","70px"),t(e,"padding","0"),t(e,"width","316px"),t(e,"maxWidth","100%"),t(e,"maxHeight","100%"),t(e,"overflow","hidden"),t(e,"borderRadius","4px")}function removeWidgetRootStyles(e){e.removeAttribute("style")}function runOnDocumentLoaded(e){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)}function fireFRCEvent(e,t){let n;"function"==typeof window.CustomEvent?n=new CustomEvent(t.name,{bubbles:!0,detail:t}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(t.name,!0,!1,t)),e.dispatchEvent(n)}function findFirstParentLangAttribute(e){for(;!e.lang||"string"!=typeof e.lang;)if(!(e=e.parentElement))return null;return e.lang}var PLACEHOLDER_LOCALIZATIONS={ar:{title:"التحقق من مكافحة الروبوتات",connecting:"التحقق من مكافحة الروبوتات قيد الاتصال…",retrying:"استغرق الاتصال بالتحقق من مكافحة الروبوتات وقتًا طويلاً.\n\nإعادة المحاولة…",failed:"فشل الاتصال بالتحقق من مكافحة الروبوتات."},bg:{title:"Проверка срещу роботи",connecting:"Зарежда се задачата…",retrying:"Неуспешно свързване.\n\nОпит за повторно свързване…",failed:"Неуспешно свързване."},ca:{title:"Verificació anti-robot",connecting:"Carregant el desafiament…",retrying:"Errada de conexió.\n\nReintentant…",failed:"Errada de conexió."},cs:{title:"Ověření proti robotům",connecting:"Připojování kontroly proti robotům…",retrying:"Připojení kontroly proti robotům trvalo příliš dlouho.\n\nOpakuji pokus…",failed:"Kontrola proti robotům se nepodařilo připojit."},da:{title:"Anti-robot-verifikation",connecting:"Anti-robot-kontrol forbinder…",retrying:"Anti-robot-kontrol tog for lang tid at oprette forbindelse.\n\nPrøver igen…",failed:"Anti-robot-kontrol kunne ikke oprette forbindelse."},nl:{title:"Anti-robotcheck",connecting:"Verbinden met Anti-robotcheck…",retrying:"Verbinden met Anti-robotcheck mislukt.\n\nOpnieuw aan het proberen…",failed:"Verbinden met Anti-robotcheck mislukt."},en:{title:"Anti-Robot verification",connecting:"Anti-Robot check connecting…",retrying:"Anti-Robot check took too long to connect.\n\nRetrying…",failed:"Anti-Robot check failed to connect."},fi:{title:"Robottien torjunnan vahvistus",connecting:"Robottien torjunnan tarkistus käynnissä…",retrying:"Robottien torjunnan tarkistus kesti liian kauan.\n\nYritetään uudelleen…",failed:"Robottien torjunnan tarkistus epäonnistui."},fr:{title:"Vérification anti-robot",connecting:"Connexion à la vérification anti-robot…",retrying:"La connexion à la vérification anti-robot a pris trop de temps.\n\nNouvelle tentative…",failed:"Échec de la connexion à la vérification anti-robot."},de:{title:"Anti-Roboter-Verifizierung",connecting:"Verbindung zur Anti-Roboter-Verifizierung wird hergestellt…",retrying:"Verbindung zur Anti-Roboter-Verifizierung hat zu lange gedauert.\n\nErneuter Versuch…",failed:"Verbindung zur Anti-Roboter-Verifizierung ist fehlgeschlagen."},hi:{title:"एंटी-रोबोट सत्यापन",connecting:"चुनौती लोड हो रही है…",retrying:"कनेक्शन विफल.\n\nपुनः प्रयास कर रहे हैं…",failed:"कनेक्शन विफल."},hu:{title:"Robotellenőrzés",connecting:"Robotellenőrzés csatlakozás…",retrying:"A robotellenőrzés túl sokáig tartott a csatlakozáshoz.\n\nÚjrapróbálom…",failed:"A robotellenőrzés nem tudott csatlakozni."},id:{title:"Verifikasi Anti-Robot",connecting:"Pemeriksaan Anti-Robot sedang terhubung…",retrying:"Pemeriksaan Anti-Robot memakan waktu terlalu lama untuk terhubung.\n\nMencoba lagi…",failed:"Pemeriksaan Anti-Robot gagal terhubung."},ja:{title:"ロボット防止認証",connecting:"チャレンジを読み込んでいます…",retrying:"接続失敗.\n\n再試行中…",failed:"接続失敗."},it:{title:"Verifica anti-robot",connecting:"Connessione verifica anti-robot in corso…",retrying:"La connessione alla verifica anti-robot ha richiesto troppo tempo.\n\nRiprovando…",failed:"Impossibile connettersi alla verifica anti-robot."},nb:{title:"Anti-robot-verifisering",connecting:"Laster inn utfordring…",retrying:"Klarte ikke å koble til.\n\nPrøver igjen…",failed:"Klarte ikke å koble til."},pl:{title:"Weryfikacja antyrobotowa",connecting:"Łączenie się z kontrolą antyrobotową…",retrying:"Łączenie się z kontrolą antyrobotową trwało zbyt długo. \n\nPonowna próba…",failed:"Nie udało się połączyć z kontrolą antyrobotową."},ro:{title:"Verificare anti-robot",connecting:"Se incarca testul…",retrying:"Conexiunea a esuat.\n\nReincercare…",failed:"Conexiunea a esuat."},pt:{title:"Verificação anti-robô",connecting:"Verificação anti-robô a ligar…",retrying:"A verificação anti-robô demorou demasiado tempo a ligar-se.\n\nA tentar novamente…",failed:"A verificação anti-robô não conseguiu ligar-se."},ru:{title:"Проверка антиробота",connecting:"Подключение к проверке антиробота…",retrying:"Подключение к проверке антиробота заняло слишком много времени.\n\nПовторяем попытку…",failed:"Не удалось подключиться к проверке антиробота."},sk:{title:"Overovanie proti robotom",connecting:"Pripojenie kontroly proti robotom…",retrying:"Pripojenie kontroly proti robotom trvalo príliš dlho.\n\nOpakujem pokus…",failed:"Pripojenie kontroly proti robotom sa nepodarilo."},sl:{title:"Preverjanje proti robotom",connecting:"Nalaganje izziva…",retrying:"Povezava ni uspela.\n\nPonovni poskus…",failed:"Povezava ni uspela."},es:{title:"Verificación antirrobot",connecting:"Conectando verificación antirrobot…",retrying:"La verificación antirrobot tardó demasiado en conectarse.\n\nReintentando…",failed:"Error al conectar la verificación antirrobot."},sv:{title:"Anti-robotverifiering",connecting:"Anti-robotverifiering ansluter…",retrying:"Anti-robotverifiering tog för lång tid att ansluta.\n\nFörsöker igen…",failed:"Anti-robotverifiering kunde inte ansluta."},th:{title:"การตรวจสอบป้องกันบอท",connecting:"กำลังโหลดการท้าทาย…",retrying:"เชื่อมต่อไม่สำเร็จ.\n\nกำลังลองใหม่…",failed:"เชื่อมต่อไม่สำเร็จ."},tr:{title:"Robot önleme doğrulaması",connecting:"Robot önleme kontrolü bağlanıyor…",retrying:"Robot önleme kontrolü bağlanmak için çok uzun sürdü.\n\nYeniden deniyor…",failed:"Robot önleme kontrolü bağlanamadı."},vi:{title:"Xác minh chống robot",connecting:"Kiểm tra robot đang kết nối…",retrying:"Kiểm tra chống robot mất quá nhiều thời gian để kết nối.\n\nĐang thử lại…",failed:"Kiểm tra chống robot không thể kết nối."},zh:{title:"反机器人验证",connecting:"反机器人验证正在连接…",retrying:"反机器人验证连接耗时过长。\n\n正在重试…",failed:"反机器人验证连接失败。"}},RTL_LANGUAGES=["ar","he","fa","ur","ps","sd","yi"];function getLanguageCode(e){return e.toLowerCase().split("-")[0].split("_")[0]}function isRTLLanguage(e){return e=getLanguageCode(e),-1!==RTL_LANGUAGES.indexOf(e)}function getLocalizedWidgetTitle(e){e=getLanguageCode(e);return(PLACEHOLDER_LOCALIZATIONS[e]||PLACEHOLDER_LOCALIZATIONS.en).title+" - Widget"}function getLocalizedPlaceholderText(e,t){e=getLanguageCode(e);return(PLACEHOLDER_LOCALIZATIONS[e]||PLACEHOLDER_LOCALIZATIONS.en)[t]}var FRAME_ID_DATASET_FIELD="FrcFrameId",AGENT_FRAME_CLASSNAME="frc-i-agent",WIDGET_FRAME_CLASSNAME="frc-i-widget",WIDGET_PLACEHOLDER_CLASSNAME="frc-widget-placeholder";function createAgentIFrame(e,t,n){const i={origin:document.location.origin,sess_id:sessionId(),sess_c:sessionCount(!0),comm_id:t,sdk_v:"0.2.0",v:"1",agent_id:t,ts:Date.now().toString()},r=document.createElement("iframe");r.className=AGENT_FRAME_CLASSNAME,r.dataset[FRAME_ID_DATASET_FIELD]=t,r.src=n+"?"+encodeQuery(i),r.frcSDK=e;const o=r.style;return o.width=o.height=o.border=o.visibility="0",o.display="none",r}function createWidgetIFrame(e,t,n,i){const r=document.createElement("iframe"),o=getLanguageFromOptionsOrParent(i),s={origin:document.location.origin,sess_id:sessionId(),sess_c:sessionCount(!0),comm_id:t,sdk_v:"0.2.0",v:"1",agent_id:e,lang:o,sitekey:i.sitekey||"",ts:Date.now().toString()};i.theme&&(s.theme=i.theme),supportAllowClipboardWrite&&(r.allow="clipboard-write"),r.frameBorder="0",r.src=n+"?"+encodeQuery(s),r.className=WIDGET_FRAME_CLASSNAME,r.title=getLocalizedWidgetTitle(o),r.dataset[FRAME_ID_DATASET_FIELD]=t;const a=r.style;return a.border=a.visibility="0",a.position="absolute",a.height=a.width="100%",a.userSelect="none",a["-webkit-tap-highlight-color"]="transparent",a.display="none",i.element.appendChild(r),r}function createWidgetPlaceholder(e){const t=document.createElement("div");t.classList.add(WIDGET_PLACEHOLDER_CLASSNAME);const n=t.style,i="dark"===e.theme||"auto"===e.theme&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;return n.color=i?"#fff":"#222",n.backgroundColor=i?"#171717":"#fafafa",n.borderRadius="4px",n.border="1px solid",n.borderColor="#ddd",n.padding="8px",n.height=n.width="100%",n.fontSize="14px",n.boxSizing="border-box",setCommonTextStyles(n),e.element.appendChild(t),t}function setCommonTextStyles(e){e.textDecoration=e.fontStyle="none",e.fontWeight="500",e.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',e.lineHeight="1",e.letterSpacing="-0.0125rem"}function createBanner(e){const t=document.createElement("div");t.classList.add("frc-banner");const n=getLanguageFromOptionsOrParent(e),i="dark"===e.theme||"auto"===e.theme&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;let r="#565656",o="#a2a2a2";i&&(r="#a2a2a2",o="#565656");const s=t.style;s.position="absolute",s.bottom="6px",isRTLLanguage(n)?s.left="6px":s.right="6px",s.lineHeight="1";const a=document.createElement("a");a.href="https://friendlycaptcha.com",a.rel="noopener";const c=a.style;setCommonTextStyles(c),c.color=r,c.fontSize="10px",c.userSelect="none",c.textDecorationLine="underline",c.textDecorationThickness="1px",c.textDecorationColor=o,c.letterSpacing="-0.0125rem",a.target="_blank",a.textContent="Friendly Captcha",a.onmouseenter=()=>c.textDecorationColor=r,a.onmouseleave=()=>c.textDecorationColor=o,t.appendChild(a),e.element.appendChild(t)}function getLanguageFromOptionsOrParent(e){let t=e.language;return t&&"html"!==t||(t=findFirstParentLangAttribute(e.element)||""),t}function createFallback(e,t,n){const i=[((e,t)=>{const n=document.createElement("a");n.href=e,n.target="_blank",n.rel="noopener",n.textContent=t;const i=n.style;return setCommonTextStyles(i),i.textDecoration="underline",i.color="#565656",n.onmouseenter=()=>i.textDecoration="none",n.onmouseleave=()=>i.textDecoration="underline",n})(`${t}/connectionTest`,getLocalizedPlaceholderText(n,"failed"))];e.textContent="",i.forEach((t=>e.appendChild(t)))}function windowPerformanceNow(){const e=window.performance;return e?e.now():0}function getTrigger(e,t,n,i){const r=windowPerformanceNow(),o=n.getBoundingClientRect(),s={v:1,tt:e,pnow:r,sm:t,el:{bcr:[o.left,o.top,o.width,o.height],con:document.body.contains(n)},stack:(new Error).stack||"",we:!!window.event,weit:!!window.event&&!!window.event.isTrusted};return i&&(s.ev={ts:i.timeStamp,rt:!!i.relatedTarget,eot:!!i.explicitOriginalTarget,it:i.isTrusted}),s}function mergeObject(e,...t){for(let i=0;i<t.length;i++){const r=t[i];for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}return e}var DEFAULT_FORM_FIELD_NAME="frc-captcha-response",WidgetHandle=class{constructor(e){this.state="init",this.response=".UNINITIALIZED",this.focusEventPending=!1,this.isDestroyed=!1,this.id=e.id;const t=e.createOpts;if(this.e=t.element,this.ready=e.registered,!this.e)throw new Error("No element provided to mount widget under.");this.e.frcWidget=this,this.formFieldName=void 0===t.formFieldName?DEFAULT_FORM_FIELD_NAME:t.formFieldName,this.sitekey=t.sitekey,this._reset=e.callbacks.onReset,this._destroy=e.callbacks.onDestroy,this._trigger=e.callbacks.onTrigger,this.startMode=e.createOpts.startMode||"focus",null!==this.formFieldName&&(this.hiddenFormEl=createManagedInputElement(this.e,this.formFieldName)),this.setState({response:".UNCONNECTED",state:"init"}),this.ready.then((()=>{this.handleStartMode()}))}handleStartMode(){if("focus"!==this.startMode||this.focusEventPending||this.isDestroyed)"auto"===this.startMode&&this.trigger("auto");else{const e=findParentFormElement(this.e);e&&(this.focusEventPending=!0,executeOnceOnFocusInEvent(e,(e=>{this.trigger("focus",{ev:e}),this.focusEventPending=!1})))}}reset(e={trigger:"root"}){if(this.isDestroyed)throw new Error("Can not reset destroyed widget.");this.setState({response:".RESET",state:"reset",resetTrigger:e.trigger}),this._reset(e),this.handleStartMode()}destroy(){this.isDestroyed=!0,this.hiddenFormEl&&this.hiddenFormEl.remove(),this.hiddenFormEl=void 0,this.setState({response:".DESTROYED",state:"destroyed"}),this._destroy()}trigger(e,t={}){if(this.isDestroyed)throw new Error("Can not start destroyed widget.");const n=getTrigger(e,this.startMode,this.e,t.ev);this._trigger({trigger:n})}start(){this.trigger("programmatic")}setState(e){const t=this.state!==e.state;this.response=e.response,this.state=e.state,this.hiddenFormEl&&!1!==this.e.isConnected&&(this.hiddenFormEl.value=e.response),t&&this.dispatchWidgetEvent({name:"frc:widget.statechange",error:e.error,mode:e.mode}),"expired"===this.state?this.dispatchWidgetEvent({name:"frc:widget.expire"}):"completed"===this.state?this.dispatchWidgetEvent({name:"frc:widget.complete"}):"error"===this.state?this.dispatchWidgetEvent({name:"frc:widget.error",error:e.error}):"reset"===this.state&&this.dispatchWidgetEvent({name:"frc:widget.reset",trigger:e.resetTrigger})}dispatchWidgetEvent(e){const t={response:this.response,state:this.state,id:this.id};mergeObject(t,e),fireFRCEvent(this.e,t)}addEventListener(e,t,n){this.e.addEventListener(e,t,n)}removeEventListener(e,t,n){this.e.removeEventListener(e,t,n)}getState(){return this.state}getResponse(){return this.response}getElement(){return this.e}},isFunc=function(e){return"function"==typeof e},patchNativeFunctions=function(e){const t=[],n=new Map,i=window,r=function(){try{const e=document.createElement("iframe");e.style.display="none",(document.body||document.head).appendChild(e);const t=e?e.contentWindow:0;return e.remove(),t||i}catch(e){return i}}(),o=Function.prototype.toString,s=function(...e){const t=!!isFunc(this)&&n.get(this),i=this===s?o:t||this;return o.apply(i,e)};Function.prototype.toString=s;const a="prototype",c=i.EventTarget?i.EventTarget[a].dispatchEvent:{},l=[["Document."+a+".documentElement",i.Document[a],"documentElement"],["Element."+a+".shadowRoot",i.Element[a],"shadowRoot"],["Node."+a+".nodeType",i.Node[a],"nodeType"],["Object.is",i.Object,"is"],["Array."+a+".slice",i.Array[a],"slice"],["Document."+a+".querySelectorAll",i.Document[a],"querySelectorAll"],["Document."+a+".createElement",i.Document[a],"createElement"],["EventTarget."+a+".dispatchEvent",c,"dispatchEvent"]];return e.disableEvalPatching||l.push(["eval",i,"eval"]),l.forEach((function([e,o,s]){const a=Object.getOwnPropertyDescriptor(o,s),c=a&&(a.get||a.set);if(!a)return;if(c){if(!a.get)return}else if("object"!=typeof a.value&&"function"!=typeof a.value)return;let l=0,d=0;const g=function(...n){const o=Date.now();if(o-l>=1e3&&(d=0,l=o),d<50){const n={d:o,pnow:windowPerformanceNow(),n:e,st:(r.Error||i.Error)("FriendlyCaptcha_DummyTrace").stack||""};t.length>2e4&&t.splice(0,1e3),t.push(n),d++}return(c?a.get:a.value).apply(this,n)};try{const e=c?a.get?a.get():void 0:a.value();e&&(g.length=e.length,g.name=e.name)}catch(e){}try{const e=mergeObject({},a);c?e.get=g:e.value=g,Object.defineProperty(o,s,e),n.set(g,c?a.get:a.value)}catch(e){}})),function(){return t.splice(0,t.length)}};function buildOnlineMetric(){const e=[0,0,0,0,0,0,0];return{s:e,add(t){const n=++e[0],i=t-e[1],r=i/n,o=r*r,s=i*r*(n-1);e[1]+=r,e[4]+=s*o*(n*n-3*n+3)+6*o*e[2]-4*r*e[3],e[3]+=s*r*(n-2)-3*r*e[2],e[2]+=s,1==n?e[5]=e[6]=t:(t<e[5]&&(e[5]=t),t>e[6]&&(e[6]=t))}}}var ssig,x="addEventListener",M=Math;function isAndroidUA(){return/Android/i.test(navigator.userAgent)}function onOffEventMetric(e,t,n=!1,i){const r=buildOnlineMetric();let o,s=!1;return runOnDocumentLoaded((()=>{(i=i||document.body)[x](e,(e=>{s&&!n||(o=e.timeStamp,s=!0)})),i[x](t,(e=>{s&&(r.add(e.timeStamp-o),s=!1)}))})),r.s}function eventCounts(e){const t=[];for(let n=0;n<e.length;n++)t.push(0),document[x](e[n],(e=>t[n]++));return t}function keyCountMetric(){const e=[0,0,0,0,0,0,0,0],t={8:1,46:1,9:2,45:3,17:4,13:5,37:6,38:6,39:6,40:6,33:7,34:7};return document[x]("keydown",(n=>{const i=n.keyCode;t[i]?e[t[i]]++:i>=112&&i<=123&&e[0]++})),e}function euclidean2d(e,t,n,i){return M.sqrt(M.pow(e-t,2)+M.pow(n-i,2))}function vector3Length(e,t,n){return M.sqrt(M.pow(e,2)+M.pow(t,2)+M.pow(n,2))}function deltaAngle(e,t){let n=t-e;return n+=n>180?-360:n<-180?360:0,n}var Signals=class{constructor(e){this.rn=0,this.i=0,this.smel={n:0,ts:0,d:0};const t="mouse",n=this.smel,i=e=>{n.n||(n.fts=e.timeStamp,n.fxy=[e.clientX,e.clientY,e.screenX,e.screenY]),n.n++,e.type===t+"leave"&&(n.d+=e.timeStamp-n.ts),n.ts=e.timeStamp,n.xy=[e.clientX,e.clientY]},r=document;runOnDocumentLoaded((()=>{const e=r.body;e[x](t+"enter",i),e[x](t+"leave",i)})),this.bh={onoff:{kdu:onOffEventMetric("keydown","keyup"),cse:onOffEventMetric("compositionstart","compositionend"),mdu:onOffEventMetric(t+"down",t+"up"),mle:onOffEventMetric(t+"leave",t+"enter"),med:onOffEventMetric(t+"enter",t+"down",!0),semd:onOffEventMetric("scrollend",t+"down",!0,r),se:onOffEventMetric("scroll","scrollend",!1,r),pdc:onOffEventMetric("pointerdown","pointercancel",!0),mmc:onOffEventMetric(t+"move","click",!0),tse:onOffEventMetric("touchstart","touchend"),fikd:onOffEventMetric("focusin","keydown",!0)},nev:eventCounts([t+"out","pointercancel","focus","focusin","blur","visibilitychange","copy","paste","cut","contextmenu","click","auxclick","wheel","resize"]),nk:keyCountMetric(),mov:this.setupMovementMetrics(),dm:this.setupMotionMetrics(),do:this.setupOrientationMetrics()},this.dep=e.disableEvalPatching||!1,this.takeTraceRecords=patchNativeFunctions(e)}setupMovementMetrics(){let e,t=[];const n=buildOnlineMetric(),i=buildOnlineMetric(),r=buildOnlineMetric(),o={t:n.s,v:r.s,d:i.s,ns:0},s=()=>{const s=t[t.length-1];if(t.length>=200||s&&(s[0]&&this.tm.timeStamp===s[1]||!s[0]&&this.mm.timeStamp===s[1])){if(clearInterval(e),e=void 0,1===t.length)return o.ns++,void(t=[]);const a=t[0];n.add(s[1]-a[1]),i.add(euclidean2d(s[2],a[2],s[3],a[3]));for(let e=1;e<t.length;e++){const n=t[e],i=t[e-1],o=1e3*euclidean2d(n[2],i[2],n[3],i[3]),s=n[1]-i[1];r.add(o/s)}return void(t=[])}let a=0;if(s?a=s[0]:this.mm&&this.tm?a=this.mm.timeStamp>this.tm.timeStamp?0:1:this.mm||(a=1),a){const e=this.tm.touches[0];e&&t.push([1,this.tm.timeStamp,e.screenX,e.screenY])}else t.push([0,this.mm.timeStamp,this.mm.screenX,this.mm.screenY])};let a=-1;return runOnDocumentLoaded((()=>{const t=document.body;t[x]("mousemove",(t=>{this.mm=t,void 0===e&&(s(),e=setInterval(s,50))})),t[x]("touchmove",(t=>{this.tm=t;const n=t.touches[0];if(n){const e=n.radiusX+1.234*n.radiusY;e!==a&&(a=e,this.rn++)}void 0===e&&(s(),e=setInterval(s,50))}))})),o}setupMotionMetrics(){const e=buildOnlineMetric(),t=buildOnlineMetric(),n={n:0,ts:0,ac:e.s,rr:t.s,i:0,g:!1};return isAndroidUA()?(window[x]("devicemotion",(i=>{n.ts=i.timeStamp,n.i=i.interval,n.g=!i.acceleration;const r=i.acceleration||i.accelerationIncludingGravity;r&&e.add(vector3Length(r.x,r.y,r.z));const o=i.rotationRate;o&&t.add(vector3Length(o.alpha,o.beta,o.gamma))})),n):n}setupOrientationMetrics(){const e=buildOnlineMetric(),t=buildOnlineMetric(),n={fts:0,ts:0,gd:e.s,bd:t.s};if(!isAndroidUA())return n;let i;return window[x]("deviceorientation",(r=>{null!=r.gamma&&null!=r.beta&&null!=r.alpha&&(n.ts=r.timeStamp,n.a=r.alpha,n.b=r.beta,n.g=r.gamma,i?(e.add(deltaAngle(r.gamma,n.g)),t.add(deltaAngle(n.b,r.beta))):(n.fts=n.ts,i=!0))})),n}gmm(){const e=this.mm;return e&&{xy:[e.clientX,e.clientY,e.screenX,e.screenY,e.offsetX,e.offsetY,e.pageX,e.pageY,e.movementX,e.movementY],ts:e.timeStamp}}gtm(){const e=this.tm,t=e&&e.touches,n=t&&t[0];return e&&n&&{id:n.identifier,xy:[n.clientX,n.clientY,n.screenX,n.screenY,n.pageX,n.pageY],r:[n.radiusX,n.radiusX,n.rotationAngle,n.force],n:t.length,ts:e.timeStamp,rn:this.rn}}get(e){const t=document.body,n=window,i=n.performance;return{v:1,i:++this.i,hl:history.length,fe:!!window.frameElement,dep:this.dep,wid:e,sc:parseInt(sessionCount(!1)),sid:sessionId(),conv:0,t:{pnow:windowPerformanceNow(),pto:i&&i.timeOrigin||0,ts:Date.now()},dims:{d:[n.innerWidth,n.innerHeight,n.outerWidth,n.outerHeight,n.screenX,n.screenY,n.pageXOffset,n.pageYOffset,t.clientWidth,t.clientHeight],dpr:n.devicePixelRatio},mel:this.smel,mm:this.gmm(),tm:this.gtm(),bh:this.bh,stack:(new Error).stack||"",trc:this.takeTraceRecords()}}};function getSignals(e){return ssig||(ssig=new Signals(e))}var SHORTHANDS={eu:"https://eu.frcapi.com",global:"https://global.frcapi.com"};function resolveAPIOrigin(e){let t=e;return t?SHORTHANDS[t]&&(t=SHORTHANDS[t]):t=SHORTHANDS.global,originOf(t)}function getSDKDisableEvalPatching(){const e=document.querySelector('meta[name="frc-disable-eval-patching"]');return!!e&&!!e.content}function getSDKAPIEndpoint(){const e=document.querySelector('meta[name="frc-api-endpoint"]');if(e)return e.content;const t=document.currentScript;if(t){const e=t.dataset.frcApiEndpoint;if(e)return e}const n=document.querySelector(".frc-captcha[data-api-endpoint]");if(n){const e=n.dataset.apiEndpoint;if(e)return e}}function tz(){const e=window.Intl;if(!e||!e.DateTimeFormat)return;const t=new e.DateTimeFormat;return t&&t.resolvedOptions?t.resolvedOptions().timeZone:void 0}var CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function encodeStringToBase64Url(e){return window.TextEncoder?encodeBase64Url((new TextEncoder).encode(e)):""}function encodeBase64Url(e){const t=e.length;let n="";for(let i=0;i<t;i+=3){const t=e[i+0],r=e[i+1],o=e[i+2];let s="";s+=CHARS.charAt(t>>>2),s+=CHARS.charAt((3&t)<<4|r>>>4),s+=CHARS.charAt((15&r)<<2|o>>>6),s+=CHARS.charAt(63&o),n+=s}return t%3==2?n=n.substring(0,n.length-1)+"=":t%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var cbus,DEFAULT_FORM_FIELD_NAME2="frc-risk-intelligence-token",RiskIntelligenceHandle=class{constructor(e){if(this.timeout=null,this.data=null,this.e=e.element,!this.e)throw new Error("No element provided for mounting Risk Intelligence handle.");this.e.frcRiskIntelligence=this,this.formFieldName=void 0===e.formFieldName?DEFAULT_FORM_FIELD_NAME2:e.formFieldName,null!==this.formFieldName&&(this.hiddenFormEl=createManagedInputElement(this.e,this.formFieldName)),this.startMode=e.startMode||"focus",this.requestRiskIntelligence=e.riskIntelligence,this.handleStartMode()}handleStartMode(){if("none"===this.startMode)console.warn('Risk Intelligence <div> found with data-start="none" (no-op), skipping...',this.e);else if("auto"===this.startMode)this.request();else{const e=findParentFormElement(this.e);e?executeOnceOnFocusInEvent(e,(()=>{this.request()})):console.warn('Risk Intelligence <div> with startMode of "focus" found without a parent <form> element, skipping...',this.e)}}request(){this.requestRiskIntelligence().then((e=>{null!==this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout((()=>{fireFRCEvent(this.e,{name:"frc:riskintelligence.expire"})}),e.expiresAt-Date.now()),this.data={token:e.token,expiresAt:e.expiresAt},this.hiddenFormEl&&(this.hiddenFormEl.value=e.token),fireFRCEvent(this.e,{name:"frc:riskintelligence.complete",token:e.token,expiresAt:e.expiresAt})})).catch((e=>{fireFRCEvent(this.e,{name:"frc:riskintelligence.error",error:{code:e.code,detail:e.detail}})}))}getData(){return this.data}getElement(){return this.e}addEventListener(e,t,n){this.e.addEventListener(e,t,n)}removeEventListener(e,t,n){this.e.removeEventListener(e,t,n)}},agentEndpoint="/api/v2/captcha/agent",widgetEndpoint="/api/v2/captcha/widget",FRAME_ID_DATASET_FIELD2="FrcFrameId",IFRAME_EXP_TIME=1296e5,sdkC=0,FriendlyCaptchaSDK=class{constructor(e={}){if(this.agents=new Map,this.agentState=new Map,this.widgets=new Map,this._attached=flatPromise(),this.attached=this._attached.promise,this.riskIntelligencePromises=new Map,this.clearRiskIntelligencePromises=new Map,this.riskIntelligenceHandles=[],this.apiEndpoint=e.apiEndpoint,(cbus=cbus||new CommunicationBus).listen((e=>this.onReceiveMessage(e))),this.bus=cbus,++sdkC>1&&console.warn("Multiple Friendly Captcha SDKs created, this is not recommended. Please use a single SDK instance."),this.signals=getSignals({disableEvalPatching:e.disableEvalPatching||getSDKDisableEvalPatching()}),e.startAgent){const e=resolveAPIOrigin(this.apiEndpoint||getSDKAPIEndpoint());this.ensureAgentIFrame(e)}this.setupPeriodicRefresh()}onReceiveMessage(e){if("root_set_response"===e.type){const t=this.widgets.get(e.widget_id);if(!t)return void(1===sdkC&&console.warn(`Received set response message for widget ${e.widget_id} that doesn't exist`));t.setState(e)}else if(stringHasPrefix(e.type,"root_store"))this.handleStoreMessage(e);else if("root_signals_get"===e.type)this.handleSignalsGetMessage(e);else if("widget_language_change"===e.type)this.handleWidgetLanguageChange(e);else if("widget_reset"===e.type){const t=this.widgets.get(e.from_id);if(!t)return void(1===sdkC&&console.warn(`Received reset message for widget ${e.from_id} that doesn't exist`));t.reset({trigger:"widget"})}else stringHasPrefix(e.type,"root_risk_intelligence")&&this.handleRiskIntelligenceMessage(e)}handleRiskIntelligenceMessage(e){if("root_risk_intelligence_generate_reply"===e.type){const t=this.riskIntelligencePromises.get(e.uid);t?(e.data?t.resolve(e.data):e.error?t.reject(e.error):console.warn("Received risk intelligence generate reply message with no data"),this.riskIntelligencePromises.delete(e.uid)):console.warn("Received risk intelligence generate reply message with no promise to resolve")}else if("root_risk_intelligence_clear_reply"===e.type){const t=this.clearRiskIntelligencePromises.get(e.uid);t?e.error?t.reject(e.error):t.resolve():console.warn("Received risk intelligence clear reply message with no promise to resolve"),this.clearRiskIntelligencePromises.delete(e.uid)}}handleWidgetLanguageChange(e){const t=this.widgets.get(e.from_id);if(!t)return void(1===sdkC&&console.warn(`Received language change message for widget ${e.from_id} that doesn't exist`));const n=t.getElement(),i=n.querySelector("iframe");i&&(i.title=getLocalizedWidgetTitle(e.language));const r=n.querySelector(".frc-banner");if(r){const t=r.style;isRTLLanguage(e.language)?(t.left="6px",t.right="auto"):(t.left="auto",t.right="6px")}}handleSignalsGetMessage(e){const t=this.signals.get(e.widget_id);this.bus.send({type:"root_signals_get_reply",from_id:"",to_id:e.from_id,_frc:1,rid:e.rid,value:t})}handleStoreMessage(e){const t=e.from_id,n=this.agentState.get(t);n?"root_store_get"===e.type?n.store.get(e.key,{p:e.p}).then((i=>{this.bus.send({type:"root_store_get_reply",from_id:"",to_id:t,_frc:1,rid:e.rid,value:i,sa:n.store.hasSA()})})):"root_store_set"===e.type&&n.store.set(e.key,e.value,{p:e.p}).then((()=>{this.bus.send({type:"root_store_set_reply",from_id:"",to_id:t,_frc:1,rid:e.rid,sa:n.store.hasSA()})})):console.error(`Store not found ${t}`)}ensureAgentIFrame(e){const t=e+agentEndpoint;let n=document.getElementsByClassName(AGENT_FRAME_CLASSNAME);for(let t=0;t<n.length;t++){const i=n[t];if(originOf(i.src)===e&&i.dataset[FRAME_ID_DATASET_FIELD2])return i.dataset[FRAME_ID_DATASET_FIELD2]}const i="a_"+randomId(12),r=createAgentIFrame(this,i,t);this.agents.set(e,r),this.agentState.set(i,{store:new Store(e),origin:e}),document.body.appendChild(r);let o=1;const s=()=>{this.bus.registerTargetIFrame("agent",i,r,this.getRetryTimeout(o)).then((t=>{if("timeout"===t){if(o>4)return console.error("[Friendly Captcha] Failed to load agent iframe after 4 retries."),r.remove(),void this.agents.delete(e);console.warn("[Friendly Captcha] Retrying agent iframe load."),r.src+="&retry="+o++,s()}}))};return s(),i}setupPeriodicRefresh(){let e=1;setInterval((()=>{const t="&expire="+e++;this.agents.forEach(((e,n)=>{e.src+=t})),this.widgets.forEach(((e,n)=>{e.getElement().querySelector("iframe").src+=t}))}),IFRAME_EXP_TIME)}getRetryTimeout(e){return 1e3*Math.pow(e,1.8)+2e3}attach(e){const[t,n]=findFRCElements();for(let e=0;e<n.length;e++){const t=n[e];if(t&&!t.frcRiskIntelligence){const e=t.dataset,n=e.sitekey;if(!n){console.warn("Risk Intelligence <div> found with no sitekey, skipping...",t);continue}this.riskIntelligenceHandles.push(new RiskIntelligenceHandle({element:t,formFieldName:e.formFieldName,startMode:e.start,riskIntelligence:()=>this.riskIntelligence({sitekey:n,apiEndpoint:e.apiEndpoint})}))}}void 0===e&&(e=t),Array.isArray(e)||e instanceof NodeList||(e=[e]);const i=[];for(let t=0;t<e.length;t++){const n=e[t];if(n&&!n.frcWidget){const e=n.dataset,t={element:n,sitekey:e.sitekey,formFieldName:e.formFieldName,apiEndpoint:e.apiEndpoint,language:e.lang,theme:e.theme,startMode:e.start};i.push(this.createWidget(t))}}const r=this.getAllWidgets();return this._attached.resolve(r),this.attached=Promise.resolve(r),i}createWidget(e){const t=resolveAPIOrigin(e.apiEndpoint||this.apiEndpoint||getSDKAPIEndpoint());this.bus.addOrigin(t);const n=this.ensureAgentIFrame(t),i="w_"+randomId(12),r=e=>{const t={from_id:i,to_id:n,_frc:1};this.bus.send(mergeObject(t,e))},o={onDestroy:()=>{r({type:"root_destroy_widget"}),this.bus.removeTarget(i),this.widgets.delete(i),e.element.innerHTML="",removeWidgetRootStyles(e.element)},onReset:()=>{r({type:"root_reset_widget"})},onTrigger:e=>{r({type:"root_trigger_widget",trigger:e.trigger})}},s=flatPromise(),a=new WidgetHandle({id:i,createOpts:e,callbacks:o,registered:s.promise});this.widgets.set(i,a);const c=createWidgetIFrame(n,i,t+widgetEndpoint,e),l=createWidgetPlaceholder(e);setWidgetRootStyles(e.element),createBanner(e);let d=getLanguageFromOptionsOrParent(e);isRTLLanguage(d)&&(e.element.dir="rtl");const g=l.style;l.textContent=getLocalizedPlaceholderText(d,"connecting");let u=1;function h(n){const i=encodeStringToBase64Url(JSON.stringify({sdk_v:"0.2.0",sitekey:e.sitekey||"",retry:u+"",endpoint:t,ua:navigator.userAgent,tz:tz()||""}));let r=".ERROR.UNREACHABLE";i&&(r+="~"+i),a.setState({state:"error",response:r,error:{code:"network_error",detail:n}})}const m=()=>{this.bus.registerTargetIFrame("widget",i,c,this.getRetryTimeout(u)).then((t=>{if("timeout"===t){if(u>4)return console.error("[Friendly Captcha] Failed to load widget iframe after 4 retries."),h("Widget load timeout, stopped retrying"),g.borderColor="#f00",g.fontSize="12px",void createFallback(l,originOf(c.src),d);g.backgroundColor="#fee",g.color="#222",l.textContent=getLocalizedPlaceholderText(d,"retrying")+` (${u})`,console.warn(`[Friendly Captcha] Retrying widget ${i} iframe load.`),h("Widget load timeout, will retry"),c.src+="&retry="+u++,m()}else"registered"===t&&(e.element.removeChild(l),c.style.display="")}))};return m(),s.resolve(),a}riskIntelligence(e){const t=resolveAPIOrigin(e.apiEndpoint||this.apiEndpoint||getSDKAPIEndpoint());this.bus.addOrigin(t);const n=this.ensureAgentIFrame(t),i=randomId(8);this.bus.send({type:"root_risk_intelligence_generate",to_id:n,from_id:"",_frc:1,sitekey:e.sitekey,bypassCache:e.bypassCache||!1,uid:i});const r=flatPromise();return this.riskIntelligencePromises.set(i,r),r.promise}clearRiskIntelligence(e){const t=resolveAPIOrigin((null==e?void 0:e.apiEndpoint)||this.apiEndpoint||getSDKAPIEndpoint());this.bus.addOrigin(t);const n=this.ensureAgentIFrame(t),i=randomId(8);this.bus.send({type:"root_risk_intelligence_clear",to_id:n,from_id:"",_frc:1,sitekey:null==e?void 0:e.sitekey,uid:i});const r=flatPromise();return this.clearRiskIntelligencePromises.set(i,r),r.promise}getAllWidgets(){const e=[];return this.widgets.forEach((t=>{e.push(t)})),e}getWidgetById(e){return this.widgets.get(e)}getAllRiskIntelligenceHandles(){const e=[];return this.riskIntelligenceHandles.forEach((t=>{e.push(t)})),e}clear(){this.widgets.forEach((e=>{e.destroy()})),this.agents.forEach((e=>{e.remove()})),this.agents.clear()}},FRCWidgetStateChangeEventName="frc:widget.statechange",FRCWidgetCompleteEventName="frc:widget.complete",FRCWidgetExpireEventName="frc:widget.expire",FRCWidgetErrorEventName="frc:widget.error",FRCWidgetResetEventName="frc:widget.reset",FRCRiskIntelligenceCompleteEventName="frc:riskintelligence.complete",FRCRiskIntelligenceErrorEventName="frc:riskintelligence.error",FRCRiskIntelligenceExpireEventName="frc:riskintelligence.expire";export{FRCRiskIntelligenceCompleteEventName,FRCRiskIntelligenceErrorEventName,FRCRiskIntelligenceExpireEventName,FRCWidgetCompleteEventName,FRCWidgetErrorEventName,FRCWidgetExpireEventName,FRCWidgetResetEventName,FRCWidgetStateChangeEventName,FriendlyCaptchaSDK};
/*!
 * Copyright (c) Friendly Captcha GmbH 2023.
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */
/*!
 * Copyright (c) Friendly Captcha GmbH 2026.
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */
//# sourceMappingURL=/sm/6f446fd6673788582ff0961d469a46ed5dee71d06f8b5cd9734ab0c22476e9fd.map