(()=>{"use strict";async function r(r){if(!window.formbricks){const o=await fetch(`${r}/api/packages/app`);if(!o.ok)return{ok:!1,error:new Error("Failed to load Formbricks App SDK")};const e=await o.text(),t=document.createElement("script");t.innerHTML=e,document.head.appendChild(t);const n=async()=>new Promise(((r,o)=>{const e=setInterval((()=>{window.formbricks&&(clearInterval(e),r())}),100);setTimeout((()=>{clearInterval(e),o(new Error("Formbricks App SDK loading timed out"))}),1e4)}));try{return await n(),{ok:!0,data:void 0}}catch(r){return{ok:!1,error:new Error(r.message??"Failed to load Formbricks App SDK")}}}return{ok:!0,data:void 0}}const o=new Proxy({},{get:(o,e,t)=>async(...o)=>{if(!window.formbricks){if("init"!==e)return void console.error("🧱 Formbricks - Global error: You need to call formbricks.init before calling any other method");if(!o[0])return void console.error("🧱 Formbricks - Global error: You need to pass the apiHost as the first argument");const{apiHost:n}=o[0],i=await(t=r,async(...r)=>{try{return{ok:!0,data:await t(...r)}}catch(r){return{ok:!1,error:r}}})(n);if(!i.ok)return void console.error(`🧱 Formbricks - Global error: ${i.error.message}`)}var t;if(window.formbricks&&"function"!=typeof window.formbricks[e])console.error(`🧱 Formbricks - Global error: Formbricks App SDK does not support method ${String(e)}`);else try{return window.formbricks[e](...o)}catch(r){return void console.error(`Something went wrong: ${r}`)}}});document.addEventListener("DOMContentLoaded",(()=>{window.tsdk_formbricks=o,window.dispatchEvent(new Event("themeisle:survey:loaded"))}))})();