onairos 4.0.21 โ 4.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +397 -397
- package/dist/10.js +1 -1
- package/dist/123.js +1 -1
- package/dist/129.js +1 -1
- package/dist/18.js +1 -1
- package/dist/185.js +1 -1
- package/dist/22.js +1 -1
- package/dist/225.js +1 -1
- package/dist/241.js +1 -1
- package/dist/31.js +1 -1
- package/dist/336.js +1 -1
- package/dist/342.js +1 -1
- package/dist/342.js.map +1 -1
- package/dist/360.js +1 -1
- package/dist/421.js +1 -1
- package/dist/433.js +1 -1
- package/dist/502.js +1 -1
- package/dist/540.js +1 -1
- package/dist/540.js.map +1 -1
- package/dist/575.js +1 -1
- package/dist/592.js +1 -1
- package/dist/659.js +1 -1
- package/dist/672.js +1 -1
- package/dist/672.js.map +1 -1
- package/dist/845.js +1 -1
- package/dist/911.js +1 -1
- package/dist/947.js +1 -1
- package/dist/961.js +1 -1
- package/dist/961.js.map +1 -1
- package/dist/991.js +1 -1
- package/dist/999.js +1 -1
- package/dist/data_request_iframe.html +11 -11
- package/dist/data_request_popup.html +320 -320
- package/dist/iframe.bundle.js +1 -1
- package/dist/oauth-callback.html +137 -206
- package/dist/onairos-laravel.js +1 -1
- package/dist/onairos-laravel.js.map +1 -1
- package/dist/onairos.bundle.js +1 -1
- package/dist/onairos.bundle.js.map +1 -1
- package/dist/onairos.esm.js +1 -1
- package/dist/onairos.esm.js.map +1 -1
- package/dist/src_onairosButton_jsx.js +1 -1
- package/dist/static/8c5b220bf6f482881a90.png +1 -1
- package/dist/vendors-node_modules_lottie-react_build_index_umd_js-node_modules_lucide-react_dist_esm_icons-20f774.js +1 -1
- package/dist/vendors-node_modules_react-dom_index_js.js +1 -1
- package/dist/vendors-node_modules_react_index_js.js +1 -1
- package/llm.txt +333 -333
- package/package.json +171 -167
package/dist/123.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkOnairosLaravel=this.webpackChunkOnairosLaravel||[]).push([[123,540],{123:(e,t,r)=>{r.d(t,{OnairosButton:()=>K});var n=r(540);const o=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},a=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),l=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const c=(0,n.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:c="",children:i,iconNode:u,...d},m)=>(0,n.createElement)("svg",{ref:m,...s,width:t,height:t,stroke:e,strokeWidth:o?24*Number(r)/Number(t):r,className:a("lucide",c),...!i&&!l(d)&&{"aria-hidden":"true"},...d},[...u.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(i)?i:[i]])),i=((e,t)=>{const r=(0,n.forwardRef)(({className:r,...l},s)=>{return(0,n.createElement)(c,{ref:s,iconNode:t,className:a(`lucide-${i=o(e),i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...l});var i});return r.displayName=o(e),r})("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),u={btnGradStart:"#1A1A1A",btnGradEnd:"#000000",btnLabel:"#FFFFFF",btnBorder:"rgba(0, 0, 0, 0.2)",iconCircleGradientStart:"#333333",iconCircleGradientEnd:"#1A1A1A",background:"#FFFFFF",backgroundSecondary:"#F8F9FA",textPrimary:"#1A1A1A",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",success:"#10B981",error:"#EF4444",warning:"#F59E0B",info:"#3B82F6",hover:"rgba(0, 0, 0, 0.05)",pressed:"rgba(0, 0, 0, 0.1)",focus:"rgba(59, 130, 246, 0.1)"},d=["label","onClick","iconRight","loading","disabled","testId","className","style","textStyle","centered"];function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},m.apply(null,arguments)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach(function(t){g(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function g(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const y=e=>{let{size:t=40,children:r,className:o=""}=e;return n.createElement("div",{className:"relative flex items-center justify-center border border-black border-opacity-25 ".concat(o),style:{width:t,height:t,borderRadius:t/2,background:"linear-gradient(to bottom, ".concat(u.iconCircleGradientStart,", ").concat(u.iconCircleGradientEnd,")")}},r||n.createElement("span",{className:"font-semibold opacity-95",style:{fontSize:"20px",color:u.btnLabel,backgroundColor:"transparent"}},"โ"))},b=e=>{let{label:t="Get Started",onClick:r,iconRight:o,loading:a=!1,disabled:l=!1,testId:s,className:c="",style:i={},textStyle:f={},centered:g=!1}=e,b=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,d);const[h,v]=(0,n.useState)(!1),x=p({height:"48px",borderRadius:"100px",border:"1px solid ".concat(u.btnBorder),background:"linear-gradient(to bottom, ".concat(u.btnGradStart,", ").concat(u.btnGradEnd,")"),position:"relative",overflow:"hidden",width:g?"auto":"100%",minWidth:g?"250px":"auto",maxWidth:g?"350px":"none",margin:g?"0 auto":"0",cursor:l?"not-allowed":"pointer",opacity:l?.65:1,boxShadow:l?"none":"20px 30px 40px rgba(0,0,0,0.10)",transition:"all 0.2s ease"},i),E={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.1)",borderRadius:"100px",opacity:h?1:0,transition:"opacity 0.1s ease"},w=p({fontFamily:"Inter, system-ui, sans-serif",fontWeight:"600",fontSize:"16px",color:u.btnLabel,textAlign:"center",backgroundColor:"transparent"},f);return n.createElement("button",m({className:"relative ".concat(c),style:x,onClick:r,onMouseDown:()=>v(!0),onMouseUp:()=>v(!1),onMouseLeave:()=>v(!1),disabled:l||a,"data-testid":s,"aria-label":t},b),n.createElement("div",{style:E}),n.createElement("div",{style:{position:"absolute",left:0,right:0,top:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"transparent"}},a?n.createElement("div",{className:"animate-spin rounded-full border-2 border-white border-t-transparent",style:{width:"20px",height:"20px"}}):n.createElement("span",{style:w},t)),n.createElement("div",{style:{position:"absolute",right:"4px",top:"4px",bottom:"4px",width:"40px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"transparent"}},!a&&(o||n.createElement(y,null))))};function h(e){let{onSuccess:t,onClose:r,testMode:o=!0}=e;const[a,l]=(0,n.useState)(""),[s,c]=(0,n.useState)(""),[d,m]=(0,n.useState)("email"),[f,p]=(0,n.useState)(!1),[g,y]=(0,n.useState)(""),h=async e=>{if(e.preventDefault(),y(""),(e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))(a)){p(!0);try{if(o)console.log("๐งช Test mode: Simulating email verification request for:",a),setTimeout(()=>{m("code"),p(!1),console.log("๐งช Test mode: Email verification simulated successfully")},800);else{const e=window.onairosApiKey||"test-key",t=await fetch("https://api2.onairos.uk/email/verification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify({email:a,action:"request"})});if(!t.ok)throw new Error("Failed to send verification code");const r=await t.json();if(!r.success)throw new Error(r.error||"Failed to send verification code");console.log("๐ง Email request response:",r),m("code"),p(!1)}}catch(e){console.error("Email request error:",e),y(e.message),p(!1)}}else y("Please enter a valid email address")},v=async e=>{e.preventDefault(),y(""),p(!0);try{if(o)console.log("๐งช Test mode: Simulating code verification for:",a,"with code:",s),"123456"===s||6===s.length?(m("success"),setTimeout(()=>{const e={email:a,verified:!0,token:"test-token-"+Date.now(),userName:a.split("@")[0],existingUser:!1,accountInfo:null,isNewUser:!0,flowType:"onboarding",adminMode:!1,userCreated:!0,accountDetails:{email:a,createdAt:(new Date).toISOString(),testAccount:!0}};console.log("๐งช Test mode: Simulated verification successful, user data:",e),t(e)},600)):(y("Invalid code. Use any 6-digit code (e.g., 123456) for testing."),p(!1));else{const e=window.onairosApiKey||"test-key",r=await fetch("https://api2.onairos.uk/email/verification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify({email:a,action:"verify",code:s})});if(!r.ok)throw new Error("Invalid verification code");const n=await r.json();if(!n.success)throw new Error(n.error||"Verification failed");console.log("๐ง Email verification response:",n),m("success"),setTimeout(()=>{t({email:a,verified:!0,token:n.token||n.jwtToken,userName:n.userName,existingUser:n.existingUser,accountInfo:n.accountInfo,isNewUser:!n.existingUser,flowType:n.existingUser?"dataRequest":"onboarding",adminMode:n.adminMode,userCreated:n.userCreated,accountDetails:n.accountDetails})},1e3)}}catch(e){console.error("Email verification error:",e),y(e.message||"Invalid code. Please try again."),p(!1)}};return n.createElement("div",{className:"w-full"},"email"===d&&n.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},n.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},n.createElement("button",{onClick:r,className:"absolute left-6 top-6 p-1 hover:bg-gray-100 rounded-full transition-colors"},n.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),n.createElement("div",{className:"flex justify-center mb-8"},n.createElement("div",{className:"w-24 h-1 bg-gray-300 rounded-full"},n.createElement("div",{className:"w-8 h-1 bg-gray-600 rounded-full"})))),n.createElement("div",{className:"px-6 text-center flex-1 flex flex-col justify-center"},n.createElement("div",{className:"mb-8 flex justify-center"},n.createElement("div",{className:"w-16 h-16 bg-gray-100 rounded-2xl flex items-center justify-center"},n.createElement("div",{className:"w-8 h-8 relative"},n.createElement("svg",{viewBox:"0 0 32 32",className:"w-full h-full"},n.createElement("path",{d:"M4 12c0-2.2 1.8-4 4-4h16c2.2 0 4 1.8 4 4v8c0 2.2-1.8 4-4 4h-4l-2-3h-4l-2 3H8c-2.2 0-4-1.8-4-4v-8z",fill:"none",stroke:"currentColor",strokeWidth:"2"}),n.createElement("circle",{cx:"10",cy:"16",r:"2",fill:"currentColor"}),n.createElement("circle",{cx:"22",cy:"16",r:"2",fill:"currentColor"}),n.createElement("path",{d:"M12 24c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",stroke:"currentColor",strokeWidth:"2",fill:"none"}))))),n.createElement("p",{className:"text-gray-500 text-sm mb-2"},"Welcome to"),n.createElement("h1",{className:"text-4xl font-bold text-gray-900 mb-6 text-balance"},"Onairos"),n.createElement("p",{className:"text-gray-600 text-base leading-relaxed mb-12 text-pretty px-2"},"OnairOS personalizes your digital experience on every app so you can just enjoy being you!"),o&&n.createElement("div",{className:"p-3 rounded-lg border text-center mb-6",style:{backgroundColor:"#EBF8FF",borderColor:"#BEE3F8",color:"#2B6CB0"}},n.createElement("p",{className:"text-sm"},"Test mode: Any valid email will work")),n.createElement("div",{className:"mb-8"},n.createElement("input",{type:"email",value:a,onChange:e=>l(e.target.value),placeholder:"Enter your email",className:"w-full px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",style:{borderColor:u.border,backgroundColor:u.background,fontFamily:"Inter, system-ui, sans-serif",fontSize:"16px"},required:!0})),n.createElement("div",{className:"flex items-center mb-8"},n.createElement("div",{className:"flex-1 h-px",style:{backgroundColor:"#E5E5E5"}}),n.createElement("span",{className:"px-4 text-sm",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",color:u.textMuted}},"Or"),n.createElement("div",{className:"flex-1 h-px",style:{backgroundColor:"#E5E5E5"}})),n.createElement("div",{className:"mb-8"},n.createElement("button",{type:"button",className:"w-full flex items-center justify-center px-4 py-3 border rounded-lg hover:bg-gray-50 transition-colors",style:{borderColor:u.border,backgroundColor:u.background,fontFamily:"Inter, system-ui, sans-serif",fontSize:"16px",fontWeight:"500",color:u.textPrimary}},n.createElement("svg",{className:"w-5 h-5 mr-3",viewBox:"0 0 24 24"},n.createElement("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),n.createElement("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),n.createElement("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),n.createElement("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),"Continue with Google")),g&&n.createElement("div",{className:"mb-6"},n.createElement("p",{className:"text-sm",style:{color:u.error}},g))),n.createElement("div",{className:"px-6 pb-8 flex-shrink-0"},n.createElement("button",{className:"w-full bg-gray-900 hover:bg-gray-800 text-white rounded-full py-4 text-base font-medium flex items-center justify-center gap-2",onClick:h,disabled:f||!a.trim()},"Get Started",n.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))))),"code"===d&&n.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},n.createElement("div",{className:"w-full mb-10"},n.createElement("h1",{className:"font-bold text-left mb-2",style:{fontFamily:"IBM Plex Sans, system-ui, sans-serif",fontWeight:"700",fontSize:"24px",lineHeight:"32px",color:u.textPrimary}},"Enter verification code"),n.createElement("p",{className:"text-left mb-2",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",fontSize:"16px",lineHeight:"24px",color:u.textSecondary}},"We've sent a 6-digit code to ",a)),o&&n.createElement("div",{className:"p-3 rounded-lg border text-center mb-6",style:{backgroundColor:"#EBF8FF",borderColor:"#BEE3F8",color:"#2B6CB0"}},n.createElement("p",{className:"text-sm"},"Test mode: Use code 123456")),n.createElement("div",{className:"px-4 mb-6"},n.createElement("div",{className:"flex justify-center space-x-3"},Array.from({length:6},(e,t)=>n.createElement("input",{key:t,type:"text",maxLength:"1",value:s[t]||"",onChange:e=>{const r=s.split("");if(r[t]=e.target.value,c(r.join("")),e.target.value&&t<5){var n;const r=null===(n=e.target.parentElement)||void 0===n?void 0:n.children[t+1];r&&r.focus()}},onKeyDown:e=>{if("Backspace"===e.key&&!s[t]&&t>0){var r;const n=null===(r=e.target.parentElement)||void 0===r?void 0:r.children[t-1];n&&n.focus()}},className:"w-12 h-12 border rounded-lg text-center text-lg font-medium focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",style:{borderColor:u.border,backgroundColor:u.background,fontFamily:"Inter, system-ui, sans-serif"}})))),g&&n.createElement("div",{className:"mb-6"},n.createElement("p",{className:"text-sm text-center",style:{color:u.error}},g)),n.createElement("div",{className:"w-full mb-6"},n.createElement(b,{label:"Continue",onClick:v,loading:f,disabled:f||6!==s.length,testId:"verify-code-button"})),n.createElement("div",{style:{flex:1,minHeight:"20px"}}),n.createElement("div",{className:"w-full"},n.createElement("button",{type:"button",onClick:()=>m("email"),className:"w-full py-2 px-4 font-medium transition-colors text-sm",style:{color:u.textSecondary}},"Use a different email"))),"success"===d&&n.createElement("div",{className:"w-full flex flex-col items-center space-y-6"},n.createElement("div",{className:"flex items-center justify-center w-16 h-16 rounded-full",style:{backgroundColor:"#D1FAE5"}},n.createElement(i,{className:"w-8 h-8",style:{color:u.success}})),n.createElement("div",{className:"text-center space-y-2"},n.createElement("h2",{className:"text-xl font-semibold",style:{color:u.textPrimary}},"Email verified!"),n.createElement("p",{style:{color:u.textSecondary}},"Setting up your account...")),n.createElement("div",{className:"w-8 h-8"},n.createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}))))}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){E(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function E(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const w=[{name:"YouTube",icon:"๐บ",color:"bg-red-500",connector:"youtube"},{name:"LinkedIn",icon:"๐ผ",color:"bg-blue-700",connector:"linkedin"},{name:"Reddit",icon:"๐ฅ",color:"bg-orange-500",connector:"reddit"},{name:"Pinterest",icon:"๐",color:"bg-red-600",connector:"pinterest"},{name:"Instagram",icon:"๐ท",color:"bg-pink-500",connector:"instagram"},{name:"GitHub",icon:"โก",color:"bg-gray-800",connector:"github"},{name:"Facebook",icon:"๐ฅ",color:"bg-blue-600",connector:"facebook"},{name:"Gmail",icon:"โ๏ธ",color:"bg-red-400",connector:"gmail"}],k={apiKey:process.env.REACT_APP_ONAIROS_API_KEY||"onairos_web_sdk_live_key_2024",baseUrl:process.env.REACT_APP_ONAIROS_BASE_URL||"https://api2.onairos.uk",sdkType:"web",enableHealthMonitoring:!0,enableAutoRefresh:!0,enableConnectionValidation:!0};function N(e){let{onComplete:t,appIcon:r,appName:o="App"}=e;const[a,l]=(0,n.useState)({}),[s,c]=(0,n.useState)(!1),[i,u]=(0,n.useState)(null),[d,m]=(0,n.useState)({}),[f,p]=(0,n.useState)({}),[g,y]=(0,n.useState)(0);(0,n.useEffect)(()=>{(()=>{const e=localStorage.getItem("onairos_oauth_platform");e&&(console.log("๐ฑ OAuth return detected for: ".concat(e)),localStorage.removeItem("onairos_oauth_platform"),localStorage.removeItem("onairos_oauth_return"),l(t=>x(x({},t),{},{[e]:!0})),m(t=>x(x({},t),{},{[e]:null})),console.log("โ
".concat(e," marked as connected from OAuth return")))})()},[]);const b=async e=>{console.log("๐ connectToPlatform called for: ".concat(e));const t=w.find(t=>t.name===e);if(null==t||!t.connector)return console.error("โ No connector found for platform: ".concat(e)),!1;try{var r;c(!0),u(e),m(t=>x(x({},t),{},{[e]:null})),console.log("๐ Starting OAuth connection for ".concat(e,"..."));const n=localStorage.getItem("username")||(null===(r=localStorage.getItem("onairosUser"))||void 0===r?void 0:r.email)||"user@example.com",o="".concat(k.baseUrl,"/").concat(t.connector,"/authorize"),a=await fetch(o,{method:"POST",headers:{"x-api-key":k.apiKey,"Content-Type":"application/json"},body:JSON.stringify({session:{username:n}})});if(!a.ok)throw new Error("HTTP ".concat(a.status,": ").concat(a.statusText));const s=await a.json();console.log("๐ ".concat(e," OAuth response:"),s);const i={youtube:["youtubeURL","youtubeUrl","youtube_url"],linkedin:["linkedinURL","linkedinUrl","linkedin_url"],reddit:["redditURL","redditUrl","reddit_url"],pinterest:["pinterestURL","pinterestUrl","pinterest_url"],instagram:["instagramURL","instagramUrl","instagram_url"],github:["githubURL","githubUrl","github_url"],facebook:["facebookURL","facebookUrl","facebook_url"],gmail:["gmailURL","gmailUrl","gmail_url"]}[t.connector]||["".concat(t.connector,"URL"),"".concat(t.connector,"Url"),"".concat(t.connector,"_url"),"platformURL","authUrl","url"];let d=null,f=null;for(const e of i)if(s[e]){d=s[e],f=e;break}if(!d)throw console.error("โ No OAuth URL found for ".concat(e,":")),console.error("Expected one of:",i),console.error("Response keys:",Object.keys(s)),console.error("Full response:",s),new Error("No OAuth URL found. Backend should return one of: ".concat(i.join(", ")));if(console.log("โ
Found OAuth URL for ".concat(e," using key: ").concat(f)),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768)return localStorage.setItem("onairos_oauth_platform",e),localStorage.setItem("onairos_oauth_return",window.location.href),window.location.href=d,!0;{const r=window.open(d,"".concat(t.connector,"_oauth"),"width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no");if(!r)throw new Error("Popup blocked. Please allow popups and try again.");let n=!1;const o=setInterval(()=>{try{if(r.location&&"onairos.uk"===r.location.hostname)return n=!0,console.log("๐ ".concat(e," popup navigated to onairos.uk - treating as success")),void r.close()}catch(t){n||(n=!0,console.log("๐ ".concat(e," popup navigated (cross-origin) - likely to onairos.uk")))}try{if(r.closed){clearInterval(o);const t=localStorage.getItem("onairos_".concat(e,"_success")),r=localStorage.getItem("onairos_".concat(e,"_error")),a=localStorage.getItem("onairos_".concat(e,"_timestamp")),s=a&&Date.now()-parseInt(a)<3e4;t&&s?(console.log("โ
".concat(e," OAuth completed successfully (callback page)")),localStorage.removeItem("onairos_".concat(e,"_success")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),l(t=>x(x({},t),{},{[e]:!0})),m(t=>x(x({},t),{},{[e]:null}))):r&&s?(console.log("โ ".concat(e," OAuth failed:"),r),localStorage.removeItem("onairos_".concat(e,"_error")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),m(t=>x(x({},t),{},{[e]:r}))):n?(console.log("โ
".concat(e," OAuth likely successful (navigated to onairos.uk)")),l(t=>x(x({},t),{},{[e]:!0})),m(t=>x(x({},t),{},{[e]:null}))):(console.log("โ ๏ธ ".concat(e," OAuth cancelled or no response")),m(t=>x(x({},t),{},{[e]:"Connection was cancelled"}))),c(!1),u(null)}}catch(e){}},1e3);return setTimeout(()=>{try{!r.closed&&r.location&&"onairos.uk"===r.location.hostname&&(console.log("๐ช Auto-closing ".concat(e," popup showing onairos.uk (not found)")),r.close())}catch(t){!r.closed&&n&&(console.log("๐ช Auto-closing ".concat(e," popup (cross-origin, likely onairos.uk)")),r.close())}},1e4),setTimeout(()=>{r.closed||(r.close(),clearInterval(o),m(t=>x(x({},t),{},{[e]:"Connection timeout"})),c(!1),u(null))},3e5),!0}}catch(t){return console.error("โ Error connecting to ".concat(e,":"),t),m(r=>x(x({},r),{},{[e]:t.message})),c(!1),u(null),!1}},h=async e=>{if(console.log("๐ฅ TOGGLE CLICKED: ".concat(e)),s&&i!==e)return void console.log("โ ๏ธ Already connecting to ".concat(i,", ignoring click on ").concat(e));a[e]?(console.log("๐ Disconnecting from ".concat(e,"...")),l(t=>x(x({},t),{},{[e]:!1})),m(t=>x(x({},t),{},{[e]:null}))):await b(e)},v=Object.values(a).filter(Boolean).length;return n.createElement("div",{className:"max-w-sm mx-auto bg-white p-4 rounded-lg shadow-lg"},n.createElement("div",{className:"flex items-center justify-center mb-4"},n.createElement("div",{className:"flex items-center space-x-2"},n.createElement("img",{src:r||"https://onairos.sirv.com/Images/OnairosBlack.png",alt:o,className:"w-8 h-8 rounded-lg"}),n.createElement("div",{className:"flex items-center text-gray-400"},n.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 8l4 4m0 0l-4 4m4-4H3"}))),n.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos",className:"w-8 h-8 rounded-lg"}))),n.createElement("div",{className:"text-center mb-4"},n.createElement("h2",{className:"text-lg font-bold text-gray-900 mb-1"},"Connect Data"),n.createElement("p",{className:"text-gray-600 text-sm"},"Connect data here to enhance your ",o," experience")),n.createElement("div",{className:"space-y-3 mb-4"},w.slice(0,6).map(e=>{const t=a[e.name]||!1,r=i===e.name,o=d[e.name],l=s&&!r;return n.createElement("div",{key:e.name,className:"flex items-center justify-between p-3 border rounded-lg transition-all duration-200 ".concat(l?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-gray-50"," ").concat(t?"border-green-300 bg-green-50":o?"border-red-300 bg-red-50":r?"border-blue-300 bg-blue-50":"border-gray-200 bg-white"),onClick:()=>!l&&h(e.name)},n.createElement("div",{className:"flex items-center space-x-3"},n.createElement("div",{className:"w-10 h-10 rounded-lg ".concat(e.color," flex items-center justify-center text-white text-lg relative")},r?n.createElement("div",{className:"animate-spin h-5 w-5 border-2 border-white rounded-full border-t-transparent"}):e.icon,t&&!r&&n.createElement("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-green-500 rounded-full flex items-center justify-center"},n.createElement("svg",{className:"w-2.5 h-2.5 text-white",fill:"currentColor",viewBox:"0 0 20 20"},n.createElement("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"}))),o&&!r&&n.createElement("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-red-500 rounded-full flex items-center justify-center"},n.createElement("svg",{className:"w-2.5 h-2.5 text-white",fill:"currentColor",viewBox:"0 0 20 20"},n.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})))),n.createElement("div",{className:"flex-1"},n.createElement("h3",{className:"font-semibold text-gray-900 text-sm"},e.name),n.createElement("p",{className:"text-gray-600 text-xs"},"YouTube"===e.name?"We analyze your watch history, likes, and subscriptions to understand your interests.":"Pinterest"===e.name?"We analyze your pins, boards, and interests to understand your style and preferences.":"Connect your ".concat(e.name," account to enhance your experience.")),o&&n.createElement("p",{className:"text-xs text-red-600 mt-1"},o))),n.createElement("div",{className:"flex items-center"},n.createElement("button",{className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(t?"bg-blue-600":"bg-gray-200"," ").concat(l?"opacity-50 cursor-not-allowed":"cursor-pointer"),onClick:t=>{t.stopPropagation(),l||h(e.name)},disabled:l},n.createElement("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white transition-transform ".concat(t?"translate-x-6":"translate-x-1")}))))})),v>0&&n.createElement("div",{className:"mb-4 p-2 bg-green-50 border border-green-200 rounded-lg"},n.createElement("p",{className:"text-green-800 text-sm text-center"},"โ
",v," connection",v>1?"s":""," active")),n.createElement("button",{onClick:()=>{const e=Object.entries(a).filter(e=>{let[t,r]=e;return r}).map(e=>{let[t]=e;return t});t({connectedAccounts:e,totalConnections:e.length,healthScore:g,connectionHealth:f,sdkVersion:"2.1.7",enhancedFeatures:{healthMonitoring:k.enableHealthMonitoring,autoRefresh:k.enableAutoRefresh,connectionValidation:k.enableConnectionValidation}})},disabled:0===v,className:"mx-auto px-3 py-2 rounded-lg font-medium transition-colors text-xs max-w-40 ".concat(v>0?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed")},v>0?"Continue with ".concat(v," connection").concat(v>1?"s":""):"Connect at least one platform"),n.createElement("button",{onClick:()=>t({connectedAccounts:[],totalConnections:0}),className:"mx-auto mt-2 py-2 px-4 text-gray-500 hover:text-gray-700 text-sm"},"Skip for now"))}function S(e){let{onComplete:t,userEmail:r}=e;const[o,a]=(0,n.useState)(""),[l,s]=(0,n.useState)({length:!1,number:!1,special:!1});(0,n.useEffect)(()=>{s({length:o.length>=8,number:/[0-9]/.test(o),special:/[!@#$%^&*(),.?":{}|<>]/.test(o)})},[o]);const c=Object.values(l).every(e=>e)&&o.length>0,i=e=>{e.preventDefault(),c&&t({pin:o,pinCreated:!0,timestamp:(new Date).toISOString()})};return n.createElement("div",{className:"w-full space-y-6"},n.createElement("form",{onSubmit:i,className:"w-full space-y-6"},n.createElement("div",null,n.createElement("label",{htmlFor:"pin",className:"block text-sm font-medium mb-2",style:{color:u.textPrimary}},"Create PIN"),n.createElement("input",{type:"password",id:"pin",value:o,onChange:e=>a(e.target.value),className:"w-full px-3 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",style:{borderColor:u.border,backgroundColor:u.background},placeholder:"Enter your secure PIN"})),n.createElement("div",{className:"p-4 rounded-lg",style:{backgroundColor:u.backgroundSecondary}},n.createElement("h4",{className:"text-sm font-medium mb-3",style:{color:u.textPrimary}},"PIN Requirements:"),n.createElement("div",{className:"space-y-2"},Object.entries({length:"At least 8 characters",number:"One number (0-9)",special:"One special character (!@#$%^&*)"}).map(e=>{let[t,r]=e;return n.createElement("div",{key:t,className:"flex items-center"},n.createElement("div",{className:"w-4 h-4 rounded-full mr-2 flex items-center justify-center",style:{backgroundColor:l[t]?u.success:u.border}},l[t]&&n.createElement("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),n.createElement("span",{className:"text-sm",style:{color:l[t]?u.success:u.textSecondary}},r))}))),n.createElement(b,{label:"Create PIN",onClick:i,disabled:!c,testId:"create-pin-button"})),r&&n.createElement("p",{className:"text-center text-sm",style:{color:u.textSecondary}},"Securing account for: ",n.createElement("span",{className:"font-medium"},r)))}function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach(function(t){j(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function j(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const P=[{id:"basic",name:"Basic Info",description:"Essential profile information, account details, and basic demographics",icon:"๐ค",required:!0,tooltip:"Includes name, email, basic profile information. This data is essential for personalization and is always included.",privacyLink:"https://onairos.uk/privacy#basic-info"},{id:"personality",name:"Personality",description:"Personality traits, behavioral patterns and psychological insights",icon:"๐",required:!1,tooltip:"AI-analyzed personality traits based on your social media activity and interactions. Used to improve content recommendations.",privacyLink:"https://onairos.uk/privacy#personality-data"},{id:"preferences",name:"Preferences",description:"User preferences, interests, settings and personal choices",icon:"โ๏ธ",required:!1,tooltip:"Your stated preferences and interests from connected platforms. Helps customize your experience.",privacyLink:"https://onairos.uk/privacy#preferences-data"}],I=e=>{let{dataType:t,isEnabled:r,onToggle:o,isLast:a}=e;const[l,s]=(0,n.useState)(!1);return n.createElement("div",{className:"w-full p-4 border rounded-xl cursor-pointer transition-all duration-200 ".concat(a?"":"mb-3"),style:{backgroundColor:l?u.grey50:u.surface,borderColor:r?u.primary:u.grey200,borderWidth:"1px",transform:l?"scale(0.99)":"scale(1)",opacity:t.required?.6:1,cursor:t.required?"default":"pointer"},onClick:()=>{t.required||(s(!0),setTimeout(()=>s(!1),150),o(t.id,!r))}},n.createElement("div",{className:"flex items-start justify-between"},n.createElement("div",{className:"flex items-start space-x-3 flex-1"},n.createElement("div",{className:"flex-shrink-0 w-12 h-12 rounded-full flex items-center justify-center",style:{backgroundColor:u.grey100}},n.createElement("span",{className:"text-xl"},t.icon)),n.createElement("div",{className:"flex-1 min-w-0"},n.createElement("div",{className:"flex items-center space-x-2 mb-1"},n.createElement("h3",{className:"font-semibold text-left",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"600",fontSize:"16px",lineHeight:"20px",color:u.grey800}},t.name),t.required&&n.createElement("span",{className:"text-xs px-2 py-1 rounded-full",style:{backgroundColor:u.primary,color:u.surface,fontFamily:"Inter, system-ui, sans-serif",fontWeight:"500"}},"Required")),n.createElement("p",{className:"text-left",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",fontSize:"14px",lineHeight:"20px",color:u.grey600}},t.description))),n.createElement("div",{className:"flex-shrink-0 ml-3"},n.createElement("div",{className:"w-12 h-6 rounded-full transition-all duration-200 relative",style:{backgroundColor:r?u.primary:u.grey300}},n.createElement("div",{className:"w-5 h-5 bg-white rounded-full absolute top-0.5 transition-all duration-200",style:{left:r?"26px":"2px",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}})))))},R=e=>{let{userEmail:t="user@example.com",testMode:r=!0,onComplete:o,autoFetch:a=!0,appName:l="Test App",formatResponse:s=!1,responseFormat:c="simple"}=e;const[i,d]=(0,n.useState)({basic:!0,personality:!1,preferences:!1}),[m,f]=(0,n.useState)(!1),[p,g]=(0,n.useState)(null),y=(e,t)=>{const r=P.find(t=>t.id===e);null!=r&&r.required||d(r=>O(O({},r),{},{[e]:t}))},h=Object.values(i).filter(Boolean).length;return n.createElement("div",{className:"w-full h-full flex flex-col",style:{backgroundColor:u.surface}},n.createElement("div",{className:"flex-shrink-0 px-6 pt-6 pb-4"},n.createElement("div",{className:"w-full p-4 rounded-xl mb-6 flex items-start space-x-3",style:{backgroundColor:"#EBF8FF",border:"1px solid #BEE3F8"}},n.createElement("div",{className:"flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center mt-0.5",style:{backgroundColor:"#3182CE"}},n.createElement("span",{className:"text-white text-sm"},"๐")),n.createElement("p",{className:"text-left",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",fontSize:"14px",lineHeight:"20px",color:"#2B6CB0"}},"Your selected data will be securely processed and used only for the intended purpose.")),n.createElement("div",{className:"mb-6"},n.createElement("h1",{className:"font-bold text-left mb-2",style:{fontFamily:"IBM Plex Sans, system-ui, sans-serif",fontWeight:"700",fontSize:"24px",lineHeight:"32px",color:u.grey800}},"Data Types"))),n.createElement("div",{className:"flex-1 px-6 overflow-y-auto"},n.createElement("div",{className:"pb-32"},P.map((e,t)=>n.createElement(I,{key:e.id,dataType:e,isEnabled:i[e.id],onToggle:y,isLast:t===P.length-1})),n.createElement("div",{className:"mt-6 p-4 rounded-xl flex items-center space-x-2",style:{backgroundColor:u.grey50}},n.createElement("span",{className:"text-sm",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"500",color:u.grey600}},"โ
",h," data type",1!==h?"s":""," selected")))),n.createElement("div",{className:"flex-shrink-0 px-6 pb-6",style:{position:"absolute",bottom:0,left:0,right:0,backgroundColor:u.surface,paddingTop:"24px"}},n.createElement("div",{className:"mb-4 flex justify-center"},n.createElement(b,{label:m?"Processing...":"Share Selected Data",onClick:async()=>{console.log("๐ฅ DataRequest: fetchUserData called"),console.log("๐ฅ DataRequest: onComplete function:",typeof o),console.log("๐ฅ DataRequest: selectedData:",i),console.log("๐ฅ DataRequest: selectedCount:",h),f(!0),g(null);try{const e=(e=>{let t=0;const r=e+Date.now().toString();for(let e=0;e<r.length;e++)t=(t<<5)-t+r.charCodeAt(e),t&=t;return"user_".concat(Math.abs(t).toString(36))})(t),n=Object.entries(i).filter(e=>{let[t,r]=e;return r}).map(e=>{let[t]=e;return t}),s=e=>{const t=[],r=(new Date).toISOString(),n={basic:"Medium",personality:"Large",preferences:"Traits"};return e.forEach(e=>{n[e]&&t.push({data:n[e],date:r})}),t},c=r?"https://api2.onairos.uk/inferenceTest":"https://api2.onairos.uk/getAPIurlMobile",u={userHash:e,appName:l,approvedData:n,apiUrl:c,testMode:r,timestamp:(new Date).toISOString()};if(a)if(r)console.log("๐งช Test mode: Simulating data request API call for:",n),setTimeout(()=>{const e={success:!0,message:"Data request simulated successfully",data:{personalityScores:{openness:.75,conscientiousness:.68,extraversion:.82,agreeableness:.71,neuroticism:.43},insights:["You show high creativity and openness to new experiences","Strong social tendencies with good interpersonal skills","Well-organized approach to tasks and goals"],dataProcessed:n,timestamp:(new Date).toISOString(),testMode:!0}},t=O(O({},u),{},{apiResponse:e,success:!0,simulated:!0});f(!1),console.log("๐งช Test mode: Simulated data request completed:",t),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(t),console.log("๐ฅ DataRequest: onComplete called successfully (test mode)")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined (test mode)")},1200);else try{const e=s(n),r={approvedData:n,userEmail:t,appName:l,confirmations:e};console.log("๐ฅ DataRequest: Making API call to:",c),console.log("๐ฅ Request body:",r);const a=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw new Error("API request failed with status ".concat(a.status));const i=await a.json();console.log("๐ฅ API Response:",i);const d=O(O({},u),{},{apiResponse:i,success:!0});f(!1),console.log("๐ฅ DataRequest: Calling onComplete with result:",d),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(d),console.log("๐ฅ DataRequest: onComplete called successfully")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined")}catch(e){console.error("๐ฅ API Error:",e),g(e.message),f(!1);const t=O(O({},u),{},{apiResponse:null,error:e.message,success:!1});o(t)}else f(!1),console.log("๐ฅ DataRequest: Auto-fetch disabled, calling onComplete with base result"),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(u),console.log("๐ฅ DataRequest: onComplete called successfully (auto-fetch disabled)")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined (auto-fetch disabled)")}catch(e){console.error("๐ฅ DataRequest Error:",e),g(e.message),f(!1),o&&o({error:e.message,success:!1,userEmail:t,appName:l,testMode:r})}},disabled:m||0===h,loading:m,centered:!0})),n.createElement("div",{className:"text-center"},n.createElement("button",{className:"text-center",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"500",fontSize:"16px",color:u.grey600,background:"none",border:"none",cursor:"pointer"},onClick:()=>o({cancelled:!0})},"Cancel")),p&&n.createElement("div",{className:"mt-4 p-3 rounded-lg text-center",style:{backgroundColor:"#FEF2F2",borderColor:"#FECACA",color:"#DC2626"}},n.createElement("p",{className:"text-sm"},p))))};function A(e){var t,r,o,a,l;let{onComplete:s,userEmail:c,appName:i="App",testMode:d=!0}=e;const[m,f]=(0,n.useState)(0),[p,g]=(0,n.useState)(0),[y,b]=(0,n.useState)(!1),h=[{title:"Setting up your personal AI",description:"Initializing your secure data model",icon:"๐ค",duration:d?800:2e3},{title:"Processing your connections",description:"Analyzing your social media patterns",icon:"๐",duration:d?600:2500},{title:"Training your model",description:"Building your personalized insights",icon:"๐ง ",duration:d?700:3e3},{title:"Finalizing setup",description:"Preparing your Onairos experience",icon:"โจ",duration:d?500:2e3}];return(0,n.useEffect)(()=>{let e,t;if(m<h.length){const r=h[m].duration,n=100/h.length;e=setInterval(()=>{g(e=>{const t=e+n/(r/100);return Math.min(t,(m+1)*n)})},100),t=setTimeout(()=>{if(m<h.length-1)f(e=>e+1);else{b(!0);const e=d?400:1e3;d&&console.log("๐งช Test mode: Training simulation completed"),setTimeout(()=>{s({trainingComplete:!0,timestamp:(new Date).toISOString(),userEmail:c,appName:i,testMode:d,simulatedTraining:d})},e)}},r)}return()=>{e&&clearInterval(e),t&&clearTimeout(t)}},[m,s,c,i]),n.createElement("div",{className:"w-full flex flex-col items-center space-y-8"},n.createElement("div",{className:"text-center"},n.createElement("div",{className:"w-20 h-20 rounded-full flex items-center justify-center mx-auto mb-4",style:{background:"linear-gradient(135deg, ".concat(u.info,", #8B5CF6)")}},n.createElement("div",{className:"text-3xl"},y?"๐":null===(t=h[m])||void 0===t?void 0:t.icon)),n.createElement("h2",{className:"text-2xl font-bold mb-2",style:{color:u.textPrimary}},y?"All set!":null===(r=h[m])||void 0===r?void 0:r.title),n.createElement("p",{style:{color:u.textSecondary}},y?"Your personal AI is ready to use":null===(o=h[m])||void 0===o?void 0:o.description)),n.createElement("div",{className:"w-full"},n.createElement("div",{className:"flex justify-between text-sm mb-2",style:{color:u.textSecondary}},n.createElement("span",null,"Progress"),n.createElement("span",null,Math.round(p),"%")),n.createElement("div",{className:"w-full rounded-full h-2",style:{backgroundColor:u.borderLight}},n.createElement("div",{className:"h-2 rounded-full transition-all duration-300 ease-out",style:{width:"".concat(p,"%"),background:"linear-gradient(90deg, ".concat(u.info,", #8B5CF6)")}}))),n.createElement("div",{className:"flex justify-center space-x-2"},h.map((e,t)=>n.createElement("div",{key:t,className:"w-3 h-3 rounded-full transition-all duration-300",style:{backgroundColor:t<=m?u.info:u.border}}))),n.createElement("div",{className:"p-4 rounded-lg w-full",style:{backgroundColor:u.backgroundSecondary}},n.createElement("div",{className:"flex items-center space-x-3"},n.createElement("div",{className:"w-8 h-8 rounded-full flex items-center justify-center",style:{backgroundColor:"#DBEAFE"}},n.createElement("div",{className:"text-sm"},y?"โ
":null===(a=h[m])||void 0===a?void 0:a.icon)),n.createElement("div",null,n.createElement("h3",{className:"font-medium",style:{color:u.textPrimary}},y?"Training Complete":"Step ".concat(m+1," of ").concat(h.length)),n.createElement("p",{className:"text-sm",style:{color:u.textSecondary}},y?"Your Onairos experience is ready":null===(l=h[m])||void 0===l?void 0:l.description)))),n.createElement("div",{className:"text-center"},n.createElement("p",{className:"text-sm",style:{color:u.textSecondary}},"Setting up for ",n.createElement("span",{className:"font-medium"},i)),c&&n.createElement("p",{className:"text-xs mt-1",style:{color:u.textMuted}},c)))}function D(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const T=["Analyst","Diplomat","Sentinel","Explorer","Architect","Logician","Commander","Debater","Advocate","Mediator","Protagonist","Campaigner","Logistician","Defender","Executive","Consul"],F=["Openness","Conscientiousness","Extraversion","Agreeableness","Neuroticism"];function U(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{includeDictionary:n=!0,includeArray:o=!0}=r;if(!e)return e;const a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?D(Object(r),!0).forEach(function(t){_(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):D(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e);if(null!==(t=e.InferenceResult)&&void 0!==t&&t.traits||e.traits||e.scores){var l;const t=(null===(l=e.InferenceResult)||void 0===l?void 0:l.traits)||e.traits||e.scores;if(Array.isArray(t)&&t.length>=16){if(n){const e={};T.forEach((r,n)=>{e[r]=t[n]}),a.InferenceResult?a.InferenceResult.personalityDict=e:a.personalityDict=e}var s;if(!o)null!==(s=a.InferenceResult)&&void 0!==s&&s.traits&&delete a.InferenceResult.traits,a.traits&&delete a.traits,a.scores&&delete a.scores}}if(e.traitResult||e.traits){const t=e.traitResult||e.traits;if(Array.isArray(t)&&n){const e={};F.forEach((r,n)=>{void 0!==t[n]&&(e[r]=t[n])}),a.traitDict=e}}return a}const B=["children","title","subtitle","icon","showHeader","showCloseButton","onClose","onBack","showBackButton","className","contentClassName","centerContent","style"],L=["children","visible","onClose","onBackdropClick","backdropStyle","modalStyle"];function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},q.apply(null,arguments)}function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){W(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function W(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}const H=e=>{let{children:t,title:r,subtitle:o,icon:a,showHeader:l=!0,showCloseButton:s=!1,onClose:c,onBack:i,showBackButton:d=!1,className:m="",contentClassName:f="",centerContent:p=!0,style:g={}}=e,y=$(e,B);const b=z({backgroundColor:u.background,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column"},g),h={position:"sticky",top:0,backgroundColor:u.background,zIndex:10,padding:"12px 24px 8px",borderBottom:"1px solid ".concat(u.borderLight)},v=z({flex:1,padding:"24px",display:"flex",flexDirection:"column",overflow:"auto",minHeight:0},p&&{alignItems:"center",justifyContent:"flex-start"}),x={fontFamily:"Inter, system-ui, sans-serif",fontSize:"24px",fontWeight:"700",color:u.textPrimary,margin:"0 0 8px 0",textAlign:p?"center":"left"},E={fontFamily:"Inter, system-ui, sans-serif",fontSize:"16px",fontWeight:"400",color:u.textSecondary,margin:"0 0 32px 0",textAlign:p?"center":"left",lineHeight:"1.5"};return n.createElement("div",q({className:"onairos-page-layout ".concat(m),style:b},y),l&&n.createElement("div",{style:h},n.createElement("div",{className:"flex items-center justify-between"},d&&i&&n.createElement("button",{onClick:i,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Go back"},n.createElement("span",{style:{fontSize:"16px",color:u.textPrimary}},"โ")),n.createElement("div",{className:"w-12 h-1.5 rounded-full mx-auto",style:{backgroundColor:u.border}}),s&&c&&n.createElement("button",{onClick:c,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Close"},n.createElement("span",{style:{fontSize:"16px",color:u.textPrimary}},"ร")))),n.createElement("div",{className:"onairos-page-content ".concat(f),style:v},a&&n.createElement("div",{style:{width:"48px",height:"48px",margin:"0 auto 24px",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"24px"}},"string"==typeof a?n.createElement("span",null,a):a),r&&n.createElement("h1",{style:x},r),o&&n.createElement("p",{style:E},o),t))},G=e=>{let{children:t,visible:r=!0,onClose:o,onBackdropClick:a,backdropStyle:l={},modalStyle:s={}}=e,c=$(e,L);if(!r)return null;const i=z({position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"},l),d=z({backgroundColor:u.background,borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",height:"100vh",width:"100%",maxWidth:"500px",boxShadow:"0 -10px 40px rgba(0, 0, 0, 0.3)",overflow:"hidden",display:"flex",flexDirection:"column"},s);return n.createElement("div",{style:i,onClick:e=>{e.target===e.currentTarget&&(a?a():o&&o())}},n.createElement("div",{style:d},n.createElement(H,q({showHeader:!0,showCloseButton:!0,onClose:o},c),t)))};function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach(function(t){J(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function J(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function K(e){let{requestData:t,webpageName:r,inferenceData:o=null,onComplete:a=null,autoFetch:l=!0,testMode:s=!0,proofMode:c=!1,textLayout:i="below",textColor:u="white",login:d=!1,buttonType:m="pill",loginReturn:f=null,loginType:p="signIn",visualType:g="full",appIcon:y=null,enableTraining:b=!0,formatResponse:v=!0,responseFormat:x={includeDictionary:!0,includeArray:!0}}=e;const[E,w]=(0,n.useState)(!1),[k,C]=(0,n.useState)("email"),[O,j]=(0,n.useState)(null),[P,I]=(0,n.useState)(null);(0,n.useEffect)(()=>{(()=>{if(s)return console.log("๐งช Test mode: Starting fresh flow, clearing any cached user data"),localStorage.removeItem("onairosUser"),void C("email");const e=localStorage.getItem("onairosUser");if(e)try{const t=JSON.parse(e);j(t),t.onboardingComplete&&t.pinCreated?C("dataRequest"):t.verified&&!t.onboardingComplete?C("onboarding"):t.onboardingComplete&&!t.pinCreated&&C("pin")}catch(e){console.error("Error parsing saved user data:",e),localStorage.removeItem("onairosUser")}})()},[s]);const D=()=>{w(!1),I(null)},_=e=>{console.log("๐ฅ Email auth successful:",e),console.log("๐ง User State:",{isNewUser:e.isNewUser,userState:e.userState,flowType:e.flowType,existingUser:e.existingUser,hasAccountInfo:!!e.accountInfo});const t=!0===e.isNewUser||!1===e.existingUser||"onboarding"===e.flowType||"new"===e.userState||!e.accountInfo;console.log("๐ Flow determination:",{finalDecision:t?"NEW USER โ onboarding (data connectors)":"EXISTING USER โ dataRequest (data permissions)",reasoning:{isNewUser:e.isNewUser,existingUserFalse:!1===e.existingUser,flowTypeOnboarding:"onboarding"===e.flowType,noAccountInfo:!e.accountInfo}});const r=Y(Y({},e),{},{verified:!0,onboardingComplete:!t,pinCreated:!t});j(r),localStorage.setItem("onairosUser",JSON.stringify(r)),t?(console.log("๐ NEW USER detected โ Starting onboarding flow (data connectors page)"),C("onboarding")):(console.log("๐ EXISTING USER detected โ Going directly to data request (data permissions page)"),C("dataRequest"))},T=e=>{console.log("Onboarding completed:",e);const t=Y(Y({},O),{},{onboardingComplete:!0,connectedAccounts:e.connectedAccounts||[]});j(t),localStorage.setItem("onairosUser",JSON.stringify(t)),C("pin")},F=e=>{console.log("PIN setup completed:",e);const t=Y(Y(Y({},O),e),{},{pinCreated:!0});j(t),localStorage.setItem("onairosUser",JSON.stringify(t)),C("dataRequest")},B=e=>{console.log("๐ Training completed:",e);const t=Y(Y({},O),{},{trainingCompleted:!0},e);j(t),localStorage.setItem("onairosUser",JSON.stringify(t)),C("dataRequest")},L=e=>{console.log("๐ฅ OnairosButton: Data request completed:",e);const t=Y(Y({},O),{},{lastDataRequest:e});j(t),localStorage.setItem("onairosUser",JSON.stringify(t)),console.log("๐ฅ Closing overlay after data request completion"),w(!1);let r=e;if(v&&null!=e&&e.apiResponse)try{var n;r=Y(Y({},e),{},{apiResponse:U(e.apiResponse,x)}),console.log("๐ฅ Response formatted with dictionary:",(null===(n=r.apiResponse)||void 0===n?void 0:n.personalityDict)||"No personality data")}catch(e){console.warn("๐ฅ Error formatting response:",e)}if(console.log("๐ฅ Calling onComplete callback with:",r),a)try{a(r),console.log("๐ฅ onComplete callback executed successfully")}catch(e){console.error("๐ฅ Error in onComplete callback:",e)}else console.log("๐ฅ No onComplete callback provided")},q="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===m?"px-4 py-2":"w-12 h-12"," bg-transparent OnairosConnect"),M={flexDirection:"below"===i?"column":"row",backgroundColor:"transparent",color:u,border:"1px solid transparent"},z={width:"20px",height:"20px",marginRight:"full"===g?"12px":"0"};return n.createElement(n.Fragment,null,n.createElement("button",{className:q,onClick:async()=>{try{console.log("๐ฅ openTerminal called"),w(!0)}catch(e){console.error("Error in openTerminal:",e)}},style:M},("full"===g||"icon"===g)&&n.createElement("img",{src:d?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:z}),"icon"!==g&&n.createElement("span",{className:"".concat("black"===u?"text-black":"text-white"," ").concat("icon"===g?"sr-only":""," ").concat("right"===i?"ml-2":"left"===i?"mr-2":"")},(()=>{switch(p){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})())),E&&n.createElement(G,{visible:E,onClose:D,showBackButton:"email"!==k&&"dataRequest"!==k,onBack:()=>{"onboarding"===k&&C("email"),"pin"===k&&C("onboarding"),"training"===k&&C("pin")},title:(()=>{switch(k){case"email":default:return"";case"onboarding":return"Connect Your Data";case"pin":return"Secure Your Account";case"training":return"Training Your Model";case"dataRequest":return"Data Request"}})(),subtitle:(()=>{switch(k){case"email":default:return"";case"onboarding":return"Choose which accounts to connect for a personalized experience";case"pin":return"Create a secure PIN to protect your data";case"training":return"Building your personalized insights";case"dataRequest":return"Select the data you want to share with ".concat(r)}})(),icon:(()=>{switch(k){case"email":default:return"";case"onboarding":return"๐";case"pin":return"๐";case"training":return"โก";case"dataRequest":return"๐"}})(),centerContent:!0},(()=>{switch(k){case"email":return n.createElement(h,{onSuccess:_,testMode:s});case"onboarding":return n.createElement(N,{onComplete:T,appIcon:y||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:r,username:(null==O?void 0:O.email)||(null==O?void 0:O.username),testMode:s});case"pin":return n.createElement(S,{onComplete:F,userEmail:null==O?void 0:O.email});case"training":return n.createElement(A,{onComplete:B,userEmail:null==O?void 0:O.email,appName:r,connectedAccounts:(null==O?void 0:O.connectedAccounts)||[],testMode:s});case"dataRequest":return n.createElement(R,{onComplete:L,userEmail:null==O?void 0:O.email,requestData:t,appName:r,autoFetch:l,testMode:s,appIcon:y,connectedAccounts:(null==O?void 0:O.connectedAccounts)||{}});default:return n.createElement("div",{className:"flex flex-col items-center space-y-4 p-6"},n.createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}),n.createElement("p",{className:"text-gray-600"},"Loading..."))}})()))}},287:(e,t)=>{var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function b(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||p}function h(){}function v(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||p}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},h.prototype=b.prototype;var x=v.prototype=new h;x.constructor=v,g(x,b.prototype),x.isPureReactComponent=!0;var E=Array.isArray,w=Object.prototype.hasOwnProperty,k={current:null},N={key:!0,ref:!0,__self:!0,__source:!0};function S(e,t,n){var o,a={},l=null,s=null;if(null!=t)for(o in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(l=""+t.key),t)w.call(t,o)&&!N.hasOwnProperty(o)&&(a[o]=t[o]);var c=arguments.length-2;if(1===c)a.children=n;else if(1<c){for(var i=Array(c),u=0;u<c;u++)i[u]=arguments[u+2];a.children=i}if(e&&e.defaultProps)for(o in c=e.defaultProps)void 0===a[o]&&(a[o]=c[o]);return{$$typeof:r,type:e,key:l,ref:s,props:a,_owner:k.current}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var O=/\/+/g;function j(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function P(e,t,o,a,l){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c=!1;if(null===e)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case r:case n:c=!0}}if(c)return l=l(c=e),e=""===a?"."+j(c,0):a,E(l)?(o="",null!=e&&(o=e.replace(O,"$&/")+"/"),P(l,t,o,"",function(e){return e})):null!=l&&(C(l)&&(l=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(l,o+(!l.key||c&&c.key===l.key?"":(""+l.key).replace(O,"$&/")+"/")+e)),t.push(l)),1;if(c=0,a=""===a?".":a+":",E(e))for(var i=0;i<e.length;i++){var u=a+j(s=e[i],i);c+=P(s,t,o,u,l)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),i=0;!(s=e.next()).done;)c+=P(s=s.value,t,o,u=a+j(s,i++),l);else if("object"===s)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function I(e,t,r){if(null==e)return e;var n=[],o=0;return P(e,n,"","",function(e){return t.call(r,e,o++)}),n}function R(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var A={current:null},D={transition:null},_={ReactCurrentDispatcher:A,ReactCurrentBatchConfig:D,ReactCurrentOwner:k};function T(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:I,forEach:function(e,t,r){I(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return I(e,function(){t++}),t},toArray:function(e){return I(e,function(e){return e})||[]},only:function(e){if(!C(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=b,t.Fragment=o,t.Profiler=l,t.PureComponent=v,t.StrictMode=a,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_,t.act=T,t.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=g({},e.props),a=e.key,l=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(l=t.ref,s=k.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(i in t)w.call(t,i)&&!N.hasOwnProperty(i)&&(o[i]=void 0===t[i]&&void 0!==c?c[i]:t[i])}var i=arguments.length-2;if(1===i)o.children=n;else if(1<i){c=Array(i);for(var u=0;u<i;u++)c[u]=arguments[u+2];o.children=c}return{$$typeof:r,type:e.type,key:a,ref:l,props:o,_owner:s}},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=S,t.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:i,render:e}},t.isValidElement=C,t.lazy=function(e){return{$$typeof:m,_payload:{_status:-1,_result:e},_init:R}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=D.transition;D.transition={};try{e()}finally{D.transition=t}},t.unstable_act=T,t.useCallback=function(e,t){return A.current.useCallback(e,t)},t.useContext=function(e){return A.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return A.current.useDeferredValue(e)},t.useEffect=function(e,t){return A.current.useEffect(e,t)},t.useId=function(){return A.current.useId()},t.useImperativeHandle=function(e,t,r){return A.current.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return A.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return A.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return A.current.useMemo(e,t)},t.useReducer=function(e,t,r){return A.current.useReducer(e,t,r)},t.useRef=function(e){return A.current.useRef(e)},t.useState=function(e){return A.current.useState(e)},t.useSyncExternalStore=function(e,t,r){return A.current.useSyncExternalStore(e,t,r)},t.useTransition=function(){return A.current.useTransition()},t.version="18.3.1"},540:(e,t,r)=>{e.exports=r(287)}}]);
|
|
1
|
+
"use strict";(this.webpackChunkOnairosLaravel=this.webpackChunkOnairosLaravel||[]).push([[123,540],{123:(e,t,r)=>{r.d(t,{OnairosButton:()=>K});var n=r(540);const o=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},a=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),l=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const c=(0,n.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:c="",children:i,iconNode:u,...d},m)=>(0,n.createElement)("svg",{ref:m,...s,width:t,height:t,stroke:e,strokeWidth:o?24*Number(r)/Number(t):r,className:a("lucide",c),...!i&&!l(d)&&{"aria-hidden":"true"},...d},[...u.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(i)?i:[i]])),i=((e,t)=>{const r=(0,n.forwardRef)(({className:r,...l},s)=>{return(0,n.createElement)(c,{ref:s,iconNode:t,className:a(`lucide-${i=o(e),i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...l});var i});return r.displayName=o(e),r})("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),u={btnGradStart:"#1A1A1A",btnGradEnd:"#000000",btnLabel:"#FFFFFF",btnBorder:"rgba(0, 0, 0, 0.2)",iconCircleGradientStart:"#333333",iconCircleGradientEnd:"#1A1A1A",background:"#FFFFFF",backgroundSecondary:"#F8F9FA",textPrimary:"#1A1A1A",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",success:"#10B981",error:"#EF4444",warning:"#F59E0B",info:"#3B82F6",hover:"rgba(0, 0, 0, 0.05)",pressed:"rgba(0, 0, 0, 0.1)",focus:"rgba(59, 130, 246, 0.1)"},d=["label","onClick","iconRight","loading","disabled","testId","className","style","textStyle","centered"];function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},m.apply(null,arguments)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach(function(t){g(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function g(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const y=e=>{let{size:t=40,children:r,className:o=""}=e;return n.createElement("div",{className:"relative flex items-center justify-center border border-black border-opacity-25 ".concat(o),style:{width:t,height:t,borderRadius:t/2,background:"linear-gradient(to bottom, ".concat(u.iconCircleGradientStart,", ").concat(u.iconCircleGradientEnd,")")}},r||n.createElement("span",{className:"font-semibold opacity-95",style:{fontSize:"20px",color:u.btnLabel,backgroundColor:"transparent"}},"โ"))},b=e=>{let{label:t="Get Started",onClick:r,iconRight:o,loading:a=!1,disabled:l=!1,testId:s,className:c="",style:i={},textStyle:f={},centered:g=!1}=e,b=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,d);const[h,v]=(0,n.useState)(!1),x=p({height:"48px",borderRadius:"100px",border:"1px solid ".concat(u.btnBorder),background:"linear-gradient(to bottom, ".concat(u.btnGradStart,", ").concat(u.btnGradEnd,")"),position:"relative",overflow:"hidden",width:g?"auto":"100%",minWidth:g?"250px":"auto",maxWidth:g?"350px":"none",margin:g?"0 auto":"0",cursor:l?"not-allowed":"pointer",opacity:l?.65:1,boxShadow:l?"none":"20px 30px 40px rgba(0,0,0,0.10)",transition:"all 0.2s ease"},i),E={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.1)",borderRadius:"100px",opacity:h?1:0,transition:"opacity 0.1s ease"},w=p({fontFamily:"Inter, system-ui, sans-serif",fontWeight:"600",fontSize:"16px",color:u.btnLabel,textAlign:"center",backgroundColor:"transparent"},f);return n.createElement("button",m({className:"relative ".concat(c),style:x,onClick:r,onMouseDown:()=>v(!0),onMouseUp:()=>v(!1),onMouseLeave:()=>v(!1),disabled:l||a,"data-testid":s,"aria-label":t},b),n.createElement("div",{style:E}),n.createElement("div",{style:{position:"absolute",left:0,right:0,top:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"transparent"}},a?n.createElement("div",{className:"animate-spin rounded-full border-2 border-white border-t-transparent",style:{width:"20px",height:"20px"}}):n.createElement("span",{style:w},t)),n.createElement("div",{style:{position:"absolute",right:"4px",top:"4px",bottom:"4px",width:"40px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"transparent"}},!a&&(o||n.createElement(y,null))))};function h(e){let{onSuccess:t,onClose:r,testMode:o=!0}=e;const[a,l]=(0,n.useState)(""),[s,c]=(0,n.useState)(""),[d,m]=(0,n.useState)("email"),[f,p]=(0,n.useState)(!1),[g,y]=(0,n.useState)(""),h=async e=>{if(e.preventDefault(),y(""),(e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))(a)){p(!0);try{if(o)console.log("๐งช Test mode: Simulating email verification request for:",a),setTimeout(()=>{m("code"),p(!1),console.log("๐งช Test mode: Email verification simulated successfully")},800);else{const e=window.onairosApiKey||"test-key",t=await fetch("https://api2.onairos.uk/email/verification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify({email:a,action:"request"})});if(!t.ok)throw new Error("Failed to send verification code");const r=await t.json();if(!r.success)throw new Error(r.error||"Failed to send verification code");console.log("๐ง Email request response:",r),m("code"),p(!1)}}catch(e){console.error("Email request error:",e),y(e.message),p(!1)}}else y("Please enter a valid email address")},v=async e=>{e.preventDefault(),y(""),p(!0);try{if(o)console.log("๐งช Test mode: Simulating code verification for:",a,"with code:",s),"123456"===s||6===s.length?(m("success"),setTimeout(()=>{const e={email:a,verified:!0,token:"test-token-"+Date.now(),userName:a.split("@")[0],existingUser:!1,accountInfo:null,isNewUser:!0,flowType:"onboarding",adminMode:!1,userCreated:!0,accountDetails:{email:a,createdAt:(new Date).toISOString(),testAccount:!0}};console.log("๐งช Test mode: Simulated verification successful, user data:",e),t(e)},600)):(y("Invalid code. Use any 6-digit code (e.g., 123456) for testing."),p(!1));else{const e=window.onairosApiKey||"test-key",r=await fetch("https://api2.onairos.uk/email/verification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify({email:a,action:"verify",code:s})});if(!r.ok)throw new Error("Invalid verification code");const n=await r.json();if(!n.success)throw new Error(n.error||"Verification failed");console.log("๐ง Email verification response:",n),m("success"),setTimeout(()=>{t({email:a,verified:!0,token:n.token||n.jwtToken,userName:n.userName,existingUser:n.existingUser,accountInfo:n.accountInfo,isNewUser:!n.existingUser,flowType:n.existingUser?"dataRequest":"onboarding",adminMode:n.adminMode,userCreated:n.userCreated,accountDetails:n.accountDetails})},1e3)}}catch(e){console.error("Email verification error:",e),y(e.message||"Invalid code. Please try again."),p(!1)}};return n.createElement("div",{className:"w-full"},"email"===d&&n.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},n.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},n.createElement("button",{onClick:r,className:"absolute left-6 top-6 p-1 hover:bg-gray-100 rounded-full transition-colors"},n.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),n.createElement("div",{className:"flex justify-center mb-8"},n.createElement("div",{className:"w-24 h-1 bg-gray-300 rounded-full"},n.createElement("div",{className:"w-8 h-1 bg-gray-600 rounded-full"})))),n.createElement("div",{className:"px-6 text-center flex-1 flex flex-col justify-center"},n.createElement("div",{className:"mb-8 flex justify-center"},n.createElement("div",{className:"w-16 h-16 bg-gray-100 rounded-2xl flex items-center justify-center"},n.createElement("div",{className:"w-8 h-8 relative"},n.createElement("svg",{viewBox:"0 0 32 32",className:"w-full h-full"},n.createElement("path",{d:"M4 12c0-2.2 1.8-4 4-4h16c2.2 0 4 1.8 4 4v8c0 2.2-1.8 4-4 4h-4l-2-3h-4l-2 3H8c-2.2 0-4-1.8-4-4v-8z",fill:"none",stroke:"currentColor",strokeWidth:"2"}),n.createElement("circle",{cx:"10",cy:"16",r:"2",fill:"currentColor"}),n.createElement("circle",{cx:"22",cy:"16",r:"2",fill:"currentColor"}),n.createElement("path",{d:"M12 24c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",stroke:"currentColor",strokeWidth:"2",fill:"none"}))))),n.createElement("p",{className:"text-gray-500 text-sm mb-2"},"Welcome to"),n.createElement("h1",{className:"text-4xl font-bold text-gray-900 mb-6 text-balance"},"Onairos"),n.createElement("p",{className:"text-gray-600 text-base leading-relaxed mb-12 text-pretty px-2"},"OnairOS personalizes your digital experience on every app so you can just enjoy being you!"),o&&n.createElement("div",{className:"p-3 rounded-lg border text-center mb-6",style:{backgroundColor:"#EBF8FF",borderColor:"#BEE3F8",color:"#2B6CB0"}},n.createElement("p",{className:"text-sm"},"Test mode: Any valid email will work")),n.createElement("div",{className:"mb-8"},n.createElement("input",{type:"email",value:a,onChange:e=>l(e.target.value),placeholder:"Enter your email",className:"w-full px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",style:{borderColor:u.border,backgroundColor:u.background,fontFamily:"Inter, system-ui, sans-serif",fontSize:"16px"},required:!0})),n.createElement("div",{className:"flex items-center mb-8"},n.createElement("div",{className:"flex-1 h-px",style:{backgroundColor:"#E5E5E5"}}),n.createElement("span",{className:"px-4 text-sm",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",color:u.textMuted}},"Or"),n.createElement("div",{className:"flex-1 h-px",style:{backgroundColor:"#E5E5E5"}})),n.createElement("div",{className:"mb-8"},n.createElement("button",{type:"button",className:"w-full flex items-center justify-center px-4 py-3 border rounded-lg hover:bg-gray-50 transition-colors",style:{borderColor:u.border,backgroundColor:u.background,fontFamily:"Inter, system-ui, sans-serif",fontSize:"16px",fontWeight:"500",color:u.textPrimary}},n.createElement("svg",{className:"w-5 h-5 mr-3",viewBox:"0 0 24 24"},n.createElement("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),n.createElement("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),n.createElement("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),n.createElement("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),"Continue with Google")),g&&n.createElement("div",{className:"mb-6"},n.createElement("p",{className:"text-sm",style:{color:u.error}},g))),n.createElement("div",{className:"px-6 pb-8 flex-shrink-0"},n.createElement("button",{className:"w-full bg-gray-900 hover:bg-gray-800 text-white rounded-full py-4 text-base font-medium flex items-center justify-center gap-2",onClick:h,disabled:f||!a.trim()},"Get Started",n.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))))),"code"===d&&n.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},n.createElement("div",{className:"w-full mb-10"},n.createElement("h1",{className:"font-bold text-left mb-2",style:{fontFamily:"IBM Plex Sans, system-ui, sans-serif",fontWeight:"700",fontSize:"24px",lineHeight:"32px",color:u.textPrimary}},"Enter verification code"),n.createElement("p",{className:"text-left mb-2",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",fontSize:"16px",lineHeight:"24px",color:u.textSecondary}},"We've sent a 6-digit code to ",a)),o&&n.createElement("div",{className:"p-3 rounded-lg border text-center mb-6",style:{backgroundColor:"#EBF8FF",borderColor:"#BEE3F8",color:"#2B6CB0"}},n.createElement("p",{className:"text-sm"},"Test mode: Use code 123456")),n.createElement("div",{className:"px-4 mb-6"},n.createElement("div",{className:"flex justify-center space-x-3"},Array.from({length:6},(e,t)=>n.createElement("input",{key:t,type:"text",maxLength:"1",value:s[t]||"",onChange:e=>{const r=s.split("");if(r[t]=e.target.value,c(r.join("")),e.target.value&&t<5){var n;const r=null===(n=e.target.parentElement)||void 0===n?void 0:n.children[t+1];r&&r.focus()}},onKeyDown:e=>{if("Backspace"===e.key&&!s[t]&&t>0){var r;const n=null===(r=e.target.parentElement)||void 0===r?void 0:r.children[t-1];n&&n.focus()}},className:"w-12 h-12 border rounded-lg text-center text-lg font-medium focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",style:{borderColor:u.border,backgroundColor:u.background,fontFamily:"Inter, system-ui, sans-serif"}})))),g&&n.createElement("div",{className:"mb-6"},n.createElement("p",{className:"text-sm text-center",style:{color:u.error}},g)),n.createElement("div",{className:"w-full mb-6"},n.createElement(b,{label:"Continue",onClick:v,loading:f,disabled:f||6!==s.length,testId:"verify-code-button"})),n.createElement("div",{style:{flex:1,minHeight:"20px"}}),n.createElement("div",{className:"w-full"},n.createElement("button",{type:"button",onClick:()=>m("email"),className:"w-full py-2 px-4 font-medium transition-colors text-sm",style:{color:u.textSecondary}},"Use a different email"))),"success"===d&&n.createElement("div",{className:"w-full flex flex-col items-center space-y-6"},n.createElement("div",{className:"flex items-center justify-center w-16 h-16 rounded-full",style:{backgroundColor:"#D1FAE5"}},n.createElement(i,{className:"w-8 h-8",style:{color:u.success}})),n.createElement("div",{className:"text-center space-y-2"},n.createElement("h2",{className:"text-xl font-semibold",style:{color:u.textPrimary}},"Email verified!"),n.createElement("p",{style:{color:u.textSecondary}},"Setting up your account...")),n.createElement("div",{className:"w-8 h-8"},n.createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}))))}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){E(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function E(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const w=[{name:"YouTube",icon:"๐บ",color:"bg-red-500",connector:"youtube"},{name:"LinkedIn",icon:"๐ผ",color:"bg-blue-700",connector:"linkedin"},{name:"Reddit",icon:"๐ฅ",color:"bg-orange-500",connector:"reddit"},{name:"Pinterest",icon:"๐",color:"bg-red-600",connector:"pinterest"},{name:"Instagram",icon:"๐ท",color:"bg-pink-500",connector:"instagram"},{name:"GitHub",icon:"โก",color:"bg-gray-800",connector:"github"},{name:"Facebook",icon:"๐ฅ",color:"bg-blue-600",connector:"facebook"},{name:"Gmail",icon:"โ๏ธ",color:"bg-red-400",connector:"gmail"}],k={apiKey:process.env.REACT_APP_ONAIROS_API_KEY||"onairos_web_sdk_live_key_2024",baseUrl:process.env.REACT_APP_ONAIROS_BASE_URL||"https://api2.onairos.uk",sdkType:"web",enableHealthMonitoring:!0,enableAutoRefresh:!0,enableConnectionValidation:!0};function N(e){let{onComplete:t,appIcon:r,appName:o="App"}=e;const[a,l]=(0,n.useState)({}),[s,c]=(0,n.useState)(!1),[i,u]=(0,n.useState)(null),[d,m]=(0,n.useState)({}),[f,p]=(0,n.useState)({}),[g,y]=(0,n.useState)(0);(0,n.useEffect)(()=>{(()=>{const e=localStorage.getItem("onairos_oauth_platform");e&&(console.log("๐ฑ OAuth return detected for: ".concat(e)),localStorage.removeItem("onairos_oauth_platform"),localStorage.removeItem("onairos_oauth_return"),l(t=>x(x({},t),{},{[e]:!0})),m(t=>x(x({},t),{},{[e]:null})),console.log("โ
".concat(e," marked as connected from OAuth return")))})()},[]);const b=async e=>{console.log("๐ connectToPlatform called for: ".concat(e));const t=w.find(t=>t.name===e);if(null==t||!t.connector)return console.error("โ No connector found for platform: ".concat(e)),!1;try{var r;c(!0),u(e),m(t=>x(x({},t),{},{[e]:null})),console.log("๐ Starting OAuth connection for ".concat(e,"..."));const n=localStorage.getItem("username")||(null===(r=localStorage.getItem("onairosUser"))||void 0===r?void 0:r.email)||"user@example.com",o="".concat(k.baseUrl,"/").concat(t.connector,"/authorize"),a=await fetch(o,{method:"POST",headers:{"x-api-key":k.apiKey,"Content-Type":"application/json"},body:JSON.stringify({session:{username:n}})});if(!a.ok)throw new Error("HTTP ".concat(a.status,": ").concat(a.statusText));const s=await a.json();console.log("๐ ".concat(e," OAuth response:"),s);const i={youtube:["youtubeURL","youtubeUrl","youtube_url"],linkedin:["linkedinURL","linkedinUrl","linkedin_url"],reddit:["redditURL","redditUrl","reddit_url"],pinterest:["pinterestURL","pinterestUrl","pinterest_url"],instagram:["instagramURL","instagramUrl","instagram_url"],github:["githubURL","githubUrl","github_url"],facebook:["facebookURL","facebookUrl","facebook_url"],gmail:["gmailURL","gmailUrl","gmail_url"]}[t.connector]||["".concat(t.connector,"URL"),"".concat(t.connector,"Url"),"".concat(t.connector,"_url"),"platformURL","authUrl","url"];let d=null,f=null;for(const e of i)if(s[e]){d=s[e],f=e;break}if(!d)throw console.error("โ No OAuth URL found for ".concat(e,":")),console.error("Expected one of:",i),console.error("Response keys:",Object.keys(s)),console.error("Full response:",s),new Error("No OAuth URL found. Backend should return one of: ".concat(i.join(", ")));if(console.log("โ
Found OAuth URL for ".concat(e," using key: ").concat(f)),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768)return localStorage.setItem("onairos_oauth_platform",e),localStorage.setItem("onairos_oauth_return",window.location.href),window.location.href=d,!0;{const r=window.open(d,"".concat(t.connector,"_oauth"),"width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no");if(!r)throw new Error("Popup blocked. Please allow popups and try again.");let n=!1;const o=setInterval(()=>{try{if(r.location&&"onairos.uk"===r.location.hostname)return n=!0,console.log("๐ ".concat(e," popup navigated to onairos.uk - treating as success")),void r.close()}catch(t){n||(n=!0,console.log("๐ ".concat(e," popup navigated (cross-origin) - likely to onairos.uk")))}try{if(r.closed){clearInterval(o);const t=localStorage.getItem("onairos_".concat(e,"_success")),r=localStorage.getItem("onairos_".concat(e,"_error")),a=localStorage.getItem("onairos_".concat(e,"_timestamp")),s=a&&Date.now()-parseInt(a)<3e4;t&&s?(console.log("โ
".concat(e," OAuth completed successfully (callback page)")),localStorage.removeItem("onairos_".concat(e,"_success")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),l(t=>x(x({},t),{},{[e]:!0})),m(t=>x(x({},t),{},{[e]:null}))):r&&s?(console.log("โ ".concat(e," OAuth failed:"),r),localStorage.removeItem("onairos_".concat(e,"_error")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),m(t=>x(x({},t),{},{[e]:r}))):n?(console.log("โ
".concat(e," OAuth likely successful (navigated to onairos.uk)")),l(t=>x(x({},t),{},{[e]:!0})),m(t=>x(x({},t),{},{[e]:null}))):(console.log("โ ๏ธ ".concat(e," OAuth cancelled or no response")),m(t=>x(x({},t),{},{[e]:"Connection was cancelled"}))),c(!1),u(null)}}catch(e){}},1e3);return setTimeout(()=>{try{!r.closed&&r.location&&"onairos.uk"===r.location.hostname&&(console.log("๐ช Auto-closing ".concat(e," popup showing onairos.uk (not found)")),r.close())}catch(t){!r.closed&&n&&(console.log("๐ช Auto-closing ".concat(e," popup (cross-origin, likely onairos.uk)")),r.close())}},1e4),setTimeout(()=>{r.closed||(r.close(),clearInterval(o),m(t=>x(x({},t),{},{[e]:"Connection timeout"})),c(!1),u(null))},3e5),!0}}catch(t){return console.error("โ Error connecting to ".concat(e,":"),t),m(r=>x(x({},r),{},{[e]:t.message})),c(!1),u(null),!1}},h=async e=>{if(console.log("๐ฅ TOGGLE CLICKED: ".concat(e)),s&&i!==e)return void console.log("โ ๏ธ Already connecting to ".concat(i,", ignoring click on ").concat(e));a[e]?(console.log("๐ Disconnecting from ".concat(e,"...")),l(t=>x(x({},t),{},{[e]:!1})),m(t=>x(x({},t),{},{[e]:null}))):await b(e)},v=Object.values(a).filter(Boolean).length;return n.createElement("div",{className:"max-w-sm mx-auto bg-white p-4 rounded-lg shadow-lg"},n.createElement("div",{className:"flex items-center justify-center mb-4"},n.createElement("div",{className:"flex items-center space-x-2"},n.createElement("img",{src:r||"https://onairos.sirv.com/Images/OnairosBlack.png",alt:o,className:"w-8 h-8 rounded-lg"}),n.createElement("div",{className:"flex items-center text-gray-400"},n.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 8l4 4m0 0l-4 4m4-4H3"}))),n.createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos",className:"w-8 h-8 rounded-lg"}))),n.createElement("div",{className:"text-center mb-4"},n.createElement("h2",{className:"text-lg font-bold text-gray-900 mb-1"},"Connect Data"),n.createElement("p",{className:"text-gray-600 text-sm"},"Connect data here to enhance your ",o," experience")),n.createElement("div",{className:"space-y-3 mb-4"},w.slice(0,6).map(e=>{const t=a[e.name]||!1,r=i===e.name,o=d[e.name],l=s&&!r;return n.createElement("div",{key:e.name,className:"flex items-center justify-between p-3 border rounded-lg transition-all duration-200 ".concat(l?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-gray-50"," ").concat(t?"border-green-300 bg-green-50":o?"border-red-300 bg-red-50":r?"border-blue-300 bg-blue-50":"border-gray-200 bg-white"),onClick:()=>!l&&h(e.name)},n.createElement("div",{className:"flex items-center space-x-3"},n.createElement("div",{className:"w-10 h-10 rounded-lg ".concat(e.color," flex items-center justify-center text-white text-lg relative")},r?n.createElement("div",{className:"animate-spin h-5 w-5 border-2 border-white rounded-full border-t-transparent"}):e.icon,t&&!r&&n.createElement("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-green-500 rounded-full flex items-center justify-center"},n.createElement("svg",{className:"w-2.5 h-2.5 text-white",fill:"currentColor",viewBox:"0 0 20 20"},n.createElement("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"}))),o&&!r&&n.createElement("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-red-500 rounded-full flex items-center justify-center"},n.createElement("svg",{className:"w-2.5 h-2.5 text-white",fill:"currentColor",viewBox:"0 0 20 20"},n.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})))),n.createElement("div",{className:"flex-1"},n.createElement("h3",{className:"font-semibold text-gray-900 text-sm"},e.name),n.createElement("p",{className:"text-gray-600 text-xs"},"YouTube"===e.name?"We analyze your watch history, likes, and subscriptions to understand your interests.":"Pinterest"===e.name?"We analyze your pins, boards, and interests to understand your style and preferences.":"Connect your ".concat(e.name," account to enhance your experience.")),o&&n.createElement("p",{className:"text-xs text-red-600 mt-1"},o))),n.createElement("div",{className:"flex items-center"},n.createElement("button",{className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(t?"bg-blue-600":"bg-gray-200"," ").concat(l?"opacity-50 cursor-not-allowed":"cursor-pointer"),onClick:t=>{t.stopPropagation(),l||h(e.name)},disabled:l},n.createElement("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white transition-transform ".concat(t?"translate-x-6":"translate-x-1")}))))})),v>0&&n.createElement("div",{className:"mb-4 p-2 bg-green-50 border border-green-200 rounded-lg"},n.createElement("p",{className:"text-green-800 text-sm text-center"},"โ
",v," connection",v>1?"s":""," active")),n.createElement("button",{onClick:()=>{const e=Object.entries(a).filter(e=>{let[t,r]=e;return r}).map(e=>{let[t]=e;return t});t({connectedAccounts:e,totalConnections:e.length,healthScore:g,connectionHealth:f,sdkVersion:"2.1.7",enhancedFeatures:{healthMonitoring:k.enableHealthMonitoring,autoRefresh:k.enableAutoRefresh,connectionValidation:k.enableConnectionValidation}})},disabled:0===v,className:"mx-auto px-3 py-2 rounded-lg font-medium transition-colors text-xs max-w-40 ".concat(v>0?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed")},v>0?"Continue with ".concat(v," connection").concat(v>1?"s":""):"Connect at least one platform"),n.createElement("button",{onClick:()=>t({connectedAccounts:[],totalConnections:0}),className:"mx-auto mt-2 py-2 px-4 text-gray-500 hover:text-gray-700 text-sm"},"Skip for now"))}function S(e){let{onComplete:t,userEmail:r}=e;const[o,a]=(0,n.useState)(""),[l,s]=(0,n.useState)({length:!1,number:!1,special:!1});(0,n.useEffect)(()=>{s({length:o.length>=8,number:/[0-9]/.test(o),special:/[!@#$%^&*(),.?":{}|<>]/.test(o)})},[o]);const c=Object.values(l).every(e=>e)&&o.length>0,i=e=>{e.preventDefault(),c&&t({pin:o,pinCreated:!0,timestamp:(new Date).toISOString()})};return n.createElement("div",{className:"w-full space-y-6"},n.createElement("form",{onSubmit:i,className:"w-full space-y-6"},n.createElement("div",null,n.createElement("label",{htmlFor:"pin",className:"block text-sm font-medium mb-2",style:{color:u.textPrimary}},"Create PIN"),n.createElement("input",{type:"password",id:"pin",value:o,onChange:e=>a(e.target.value),className:"w-full px-3 py-3 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",style:{borderColor:u.border,backgroundColor:u.background},placeholder:"Enter your secure PIN"})),n.createElement("div",{className:"p-4 rounded-lg",style:{backgroundColor:u.backgroundSecondary}},n.createElement("h4",{className:"text-sm font-medium mb-3",style:{color:u.textPrimary}},"PIN Requirements:"),n.createElement("div",{className:"space-y-2"},Object.entries({length:"At least 8 characters",number:"One number (0-9)",special:"One special character (!@#$%^&*)"}).map(e=>{let[t,r]=e;return n.createElement("div",{key:t,className:"flex items-center"},n.createElement("div",{className:"w-4 h-4 rounded-full mr-2 flex items-center justify-center",style:{backgroundColor:l[t]?u.success:u.border}},l[t]&&n.createElement("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),n.createElement("span",{className:"text-sm",style:{color:l[t]?u.success:u.textSecondary}},r))}))),n.createElement(b,{label:"Create PIN",onClick:i,disabled:!c,testId:"create-pin-button"})),r&&n.createElement("p",{className:"text-center text-sm",style:{color:u.textSecondary}},"Securing account for: ",n.createElement("span",{className:"font-medium"},r)))}function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach(function(t){j(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function j(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const P=[{id:"basic",name:"Basic Info",description:"Essential profile information, account details, and basic demographics",icon:"๐ค",required:!0,tooltip:"Includes name, email, basic profile information. This data is essential for personalization and is always included.",privacyLink:"https://onairos.uk/privacy#basic-info"},{id:"personality",name:"Personality",description:"Personality traits, behavioral patterns and psychological insights",icon:"๐",required:!1,tooltip:"AI-analyzed personality traits based on your social media activity and interactions. Used to improve content recommendations.",privacyLink:"https://onairos.uk/privacy#personality-data"},{id:"preferences",name:"Preferences",description:"User preferences, interests, settings and personal choices",icon:"โ๏ธ",required:!1,tooltip:"Your stated preferences and interests from connected platforms. Helps customize your experience.",privacyLink:"https://onairos.uk/privacy#preferences-data"}],I=e=>{let{dataType:t,isEnabled:r,onToggle:o,isLast:a}=e;const[l,s]=(0,n.useState)(!1);return n.createElement("div",{className:"w-full p-4 border rounded-xl cursor-pointer transition-all duration-200 ".concat(a?"":"mb-3"),style:{backgroundColor:l?u.grey50:u.surface,borderColor:r?u.primary:u.grey200,borderWidth:"1px",transform:l?"scale(0.99)":"scale(1)",opacity:t.required?.6:1,cursor:t.required?"default":"pointer"},onClick:()=>{t.required||(s(!0),setTimeout(()=>s(!1),150),o(t.id,!r))}},n.createElement("div",{className:"flex items-start justify-between"},n.createElement("div",{className:"flex items-start space-x-3 flex-1"},n.createElement("div",{className:"flex-shrink-0 w-12 h-12 rounded-full flex items-center justify-center",style:{backgroundColor:u.grey100}},n.createElement("span",{className:"text-xl"},t.icon)),n.createElement("div",{className:"flex-1 min-w-0"},n.createElement("div",{className:"flex items-center space-x-2 mb-1"},n.createElement("h3",{className:"font-semibold text-left",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"600",fontSize:"16px",lineHeight:"20px",color:u.grey800}},t.name),t.required&&n.createElement("span",{className:"text-xs px-2 py-1 rounded-full",style:{backgroundColor:u.primary,color:u.surface,fontFamily:"Inter, system-ui, sans-serif",fontWeight:"500"}},"Required")),n.createElement("p",{className:"text-left",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",fontSize:"14px",lineHeight:"20px",color:u.grey600}},t.description))),n.createElement("div",{className:"flex-shrink-0 ml-3"},n.createElement("div",{className:"w-12 h-6 rounded-full transition-all duration-200 relative",style:{backgroundColor:r?u.primary:u.grey300}},n.createElement("div",{className:"w-5 h-5 bg-white rounded-full absolute top-0.5 transition-all duration-200",style:{left:r?"26px":"2px",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}})))))},R=e=>{let{userEmail:t="user@example.com",testMode:r=!0,onComplete:o,autoFetch:a=!0,appName:l="Test App",formatResponse:s=!1,responseFormat:c="simple"}=e;const[i,d]=(0,n.useState)({basic:!0,personality:!1,preferences:!1}),[m,f]=(0,n.useState)(!1),[p,g]=(0,n.useState)(null),y=(e,t)=>{const r=P.find(t=>t.id===e);null!=r&&r.required||d(r=>O(O({},r),{},{[e]:t}))},h=Object.values(i).filter(Boolean).length;return n.createElement("div",{className:"w-full h-full flex flex-col",style:{backgroundColor:u.surface}},n.createElement("div",{className:"flex-shrink-0 px-6 pt-6 pb-4"},n.createElement("div",{className:"w-full p-4 rounded-xl mb-6 flex items-start space-x-3",style:{backgroundColor:"#EBF8FF",border:"1px solid #BEE3F8"}},n.createElement("div",{className:"flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center mt-0.5",style:{backgroundColor:"#3182CE"}},n.createElement("span",{className:"text-white text-sm"},"๐")),n.createElement("p",{className:"text-left",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",fontSize:"14px",lineHeight:"20px",color:"#2B6CB0"}},"Your selected data will be securely processed and used only for the intended purpose.")),n.createElement("div",{className:"mb-6"},n.createElement("h1",{className:"font-bold text-left mb-2",style:{fontFamily:"IBM Plex Sans, system-ui, sans-serif",fontWeight:"700",fontSize:"24px",lineHeight:"32px",color:u.grey800}},"Data Types"))),n.createElement("div",{className:"flex-1 px-6 overflow-y-auto"},n.createElement("div",{className:"pb-32"},P.map((e,t)=>n.createElement(I,{key:e.id,dataType:e,isEnabled:i[e.id],onToggle:y,isLast:t===P.length-1})),n.createElement("div",{className:"mt-6 p-4 rounded-xl flex items-center space-x-2",style:{backgroundColor:u.grey50}},n.createElement("span",{className:"text-sm",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"500",color:u.grey600}},"โ
",h," data type",1!==h?"s":""," selected")))),n.createElement("div",{className:"flex-shrink-0 px-6 pb-6",style:{position:"absolute",bottom:0,left:0,right:0,backgroundColor:u.surface,paddingTop:"24px"}},n.createElement("div",{className:"mb-4 flex justify-center"},n.createElement(b,{label:m?"Processing...":"Share Selected Data",onClick:async()=>{console.log("๐ฅ DataRequest: fetchUserData called"),console.log("๐ฅ DataRequest: onComplete function:",typeof o),console.log("๐ฅ DataRequest: selectedData:",i),console.log("๐ฅ DataRequest: selectedCount:",h),f(!0),g(null);try{const e=(e=>{let t=0;const r=e+Date.now().toString();for(let e=0;e<r.length;e++)t=(t<<5)-t+r.charCodeAt(e),t&=t;return"user_".concat(Math.abs(t).toString(36))})(t),n=Object.entries(i).filter(e=>{let[t,r]=e;return r}).map(e=>{let[t]=e;return t}),s=e=>{const t=[],r=(new Date).toISOString(),n={basic:"Medium",personality:"Large",preferences:"Traits"};return e.forEach(e=>{n[e]&&t.push({data:n[e],date:r})}),t},c=r?"https://api2.onairos.uk/inferenceTest":"https://api2.onairos.uk/getAPIurlMobile",u={userHash:e,appName:l,approvedData:n,apiUrl:c,testMode:r,timestamp:(new Date).toISOString()};if(a)if(r)console.log("๐งช Test mode: Simulating data request API call for:",n),setTimeout(()=>{const e={success:!0,message:"Data request simulated successfully",data:{personalityScores:{openness:.75,conscientiousness:.68,extraversion:.82,agreeableness:.71,neuroticism:.43},insights:["You show high creativity and openness to new experiences","Strong social tendencies with good interpersonal skills","Well-organized approach to tasks and goals"],dataProcessed:n,timestamp:(new Date).toISOString(),testMode:!0}},t=O(O({},u),{},{apiResponse:e,success:!0,simulated:!0});f(!1),console.log("๐งช Test mode: Simulated data request completed:",t),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(t),console.log("๐ฅ DataRequest: onComplete called successfully (test mode)")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined (test mode)")},1200);else try{const e=s(n),r={approvedData:n,userEmail:t,appName:l,confirmations:e};console.log("๐ฅ DataRequest: Making API call to:",c),console.log("๐ฅ Request body:",r);const a=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw new Error("API request failed with status ".concat(a.status));const i=await a.json();console.log("๐ฅ API Response:",i);const d=O(O({},u),{},{apiResponse:i,success:!0});f(!1),console.log("๐ฅ DataRequest: Calling onComplete with result:",d),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(d),console.log("๐ฅ DataRequest: onComplete called successfully")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined")}catch(e){console.error("๐ฅ API Error:",e),g(e.message),f(!1);const t=O(O({},u),{},{apiResponse:null,error:e.message,success:!1});o(t)}else f(!1),console.log("๐ฅ DataRequest: Auto-fetch disabled, calling onComplete with base result"),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(u),console.log("๐ฅ DataRequest: onComplete called successfully (auto-fetch disabled)")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined (auto-fetch disabled)")}catch(e){console.error("๐ฅ DataRequest Error:",e),g(e.message),f(!1),o&&o({error:e.message,success:!1,userEmail:t,appName:l,testMode:r})}},disabled:m||0===h,loading:m,centered:!0})),n.createElement("div",{className:"text-center"},n.createElement("button",{className:"text-center",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"500",fontSize:"16px",color:u.grey600,background:"none",border:"none",cursor:"pointer"},onClick:()=>o({cancelled:!0})},"Cancel")),p&&n.createElement("div",{className:"mt-4 p-3 rounded-lg text-center",style:{backgroundColor:"#FEF2F2",borderColor:"#FECACA",color:"#DC2626"}},n.createElement("p",{className:"text-sm"},p))))};function A(e){var t,r,o,a,l;let{onComplete:s,userEmail:c,appName:i="App",testMode:d=!0}=e;const[m,f]=(0,n.useState)(0),[p,g]=(0,n.useState)(0),[y,b]=(0,n.useState)(!1),h=[{title:"Setting up your personal AI",description:"Initializing your secure data model",icon:"๐ค",duration:d?800:2e3},{title:"Processing your connections",description:"Analyzing your social media patterns",icon:"๐",duration:d?600:2500},{title:"Training your model",description:"Building your personalized insights",icon:"๐ง ",duration:d?700:3e3},{title:"Finalizing setup",description:"Preparing your Onairos experience",icon:"โจ",duration:d?500:2e3}];return(0,n.useEffect)(()=>{let e,t;if(m<h.length){const r=h[m].duration,n=100/h.length;e=setInterval(()=>{g(e=>{const t=e+n/(r/100);return Math.min(t,(m+1)*n)})},100),t=setTimeout(()=>{if(m<h.length-1)f(e=>e+1);else{b(!0);const e=d?400:1e3;d&&console.log("๐งช Test mode: Training simulation completed"),setTimeout(()=>{s({trainingComplete:!0,timestamp:(new Date).toISOString(),userEmail:c,appName:i,testMode:d,simulatedTraining:d})},e)}},r)}return()=>{e&&clearInterval(e),t&&clearTimeout(t)}},[m,s,c,i]),n.createElement("div",{className:"w-full flex flex-col items-center space-y-8"},n.createElement("div",{className:"text-center"},n.createElement("div",{className:"w-20 h-20 rounded-full flex items-center justify-center mx-auto mb-4",style:{background:"linear-gradient(135deg, ".concat(u.info,", #8B5CF6)")}},n.createElement("div",{className:"text-3xl"},y?"๐":null===(t=h[m])||void 0===t?void 0:t.icon)),n.createElement("h2",{className:"text-2xl font-bold mb-2",style:{color:u.textPrimary}},y?"All set!":null===(r=h[m])||void 0===r?void 0:r.title),n.createElement("p",{style:{color:u.textSecondary}},y?"Your personal AI is ready to use":null===(o=h[m])||void 0===o?void 0:o.description)),n.createElement("div",{className:"w-full"},n.createElement("div",{className:"flex justify-between text-sm mb-2",style:{color:u.textSecondary}},n.createElement("span",null,"Progress"),n.createElement("span",null,Math.round(p),"%")),n.createElement("div",{className:"w-full rounded-full h-2",style:{backgroundColor:u.borderLight}},n.createElement("div",{className:"h-2 rounded-full transition-all duration-300 ease-out",style:{width:"".concat(p,"%"),background:"linear-gradient(90deg, ".concat(u.info,", #8B5CF6)")}}))),n.createElement("div",{className:"flex justify-center space-x-2"},h.map((e,t)=>n.createElement("div",{key:t,className:"w-3 h-3 rounded-full transition-all duration-300",style:{backgroundColor:t<=m?u.info:u.border}}))),n.createElement("div",{className:"p-4 rounded-lg w-full",style:{backgroundColor:u.backgroundSecondary}},n.createElement("div",{className:"flex items-center space-x-3"},n.createElement("div",{className:"w-8 h-8 rounded-full flex items-center justify-center",style:{backgroundColor:"#DBEAFE"}},n.createElement("div",{className:"text-sm"},y?"โ
":null===(a=h[m])||void 0===a?void 0:a.icon)),n.createElement("div",null,n.createElement("h3",{className:"font-medium",style:{color:u.textPrimary}},y?"Training Complete":"Step ".concat(m+1," of ").concat(h.length)),n.createElement("p",{className:"text-sm",style:{color:u.textSecondary}},y?"Your Onairos experience is ready":null===(l=h[m])||void 0===l?void 0:l.description)))),n.createElement("div",{className:"text-center"},n.createElement("p",{className:"text-sm",style:{color:u.textSecondary}},"Setting up for ",n.createElement("span",{className:"font-medium"},i)),c&&n.createElement("p",{className:"text-xs mt-1",style:{color:u.textMuted}},c)))}function D(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const T=["Analyst","Diplomat","Sentinel","Explorer","Architect","Logician","Commander","Debater","Advocate","Mediator","Protagonist","Campaigner","Logistician","Defender","Executive","Consul"],F=["Openness","Conscientiousness","Extraversion","Agreeableness","Neuroticism"];function U(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{includeDictionary:n=!0,includeArray:o=!0}=r;if(!e)return e;const a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?D(Object(r),!0).forEach(function(t){_(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):D(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e);if(null!==(t=e.InferenceResult)&&void 0!==t&&t.traits||e.traits||e.scores){var l;const t=(null===(l=e.InferenceResult)||void 0===l?void 0:l.traits)||e.traits||e.scores;if(Array.isArray(t)&&t.length>=16){if(n){const e={};T.forEach((r,n)=>{e[r]=t[n]}),a.InferenceResult?a.InferenceResult.personalityDict=e:a.personalityDict=e}var s;if(!o)null!==(s=a.InferenceResult)&&void 0!==s&&s.traits&&delete a.InferenceResult.traits,a.traits&&delete a.traits,a.scores&&delete a.scores}}if(e.traitResult||e.traits){const t=e.traitResult||e.traits;if(Array.isArray(t)&&n){const e={};F.forEach((r,n)=>{void 0!==t[n]&&(e[r]=t[n])}),a.traitDict=e}}return a}const B=["children","title","subtitle","icon","showHeader","showCloseButton","onClose","onBack","showBackButton","className","contentClassName","centerContent","style"],L=["children","visible","onClose","onBackdropClick","backdropStyle","modalStyle"];function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},q.apply(null,arguments)}function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){W(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function W(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}const H=e=>{let{children:t,title:r,subtitle:o,icon:a,showHeader:l=!0,showCloseButton:s=!1,onClose:c,onBack:i,showBackButton:d=!1,className:m="",contentClassName:f="",centerContent:p=!0,style:g={}}=e,y=$(e,B);const b=z({backgroundColor:u.background,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column"},g),h={position:"sticky",top:0,backgroundColor:u.background,zIndex:10,padding:"12px 24px 8px",borderBottom:"1px solid ".concat(u.borderLight)},v=z({flex:1,padding:"24px",display:"flex",flexDirection:"column",overflow:"auto",minHeight:0},p&&{alignItems:"center",justifyContent:"flex-start"}),x={fontFamily:"Inter, system-ui, sans-serif",fontSize:"24px",fontWeight:"700",color:u.textPrimary,margin:"0 0 8px 0",textAlign:p?"center":"left"},E={fontFamily:"Inter, system-ui, sans-serif",fontSize:"16px",fontWeight:"400",color:u.textSecondary,margin:"0 0 32px 0",textAlign:p?"center":"left",lineHeight:"1.5"};return n.createElement("div",q({className:"onairos-page-layout ".concat(m),style:b},y),l&&n.createElement("div",{style:h},n.createElement("div",{className:"flex items-center justify-between"},d&&i&&n.createElement("button",{onClick:i,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Go back"},n.createElement("span",{style:{fontSize:"16px",color:u.textPrimary}},"โ")),n.createElement("div",{className:"w-12 h-1.5 rounded-full mx-auto",style:{backgroundColor:u.border}}),s&&c&&n.createElement("button",{onClick:c,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Close"},n.createElement("span",{style:{fontSize:"16px",color:u.textPrimary}},"ร")))),n.createElement("div",{className:"onairos-page-content ".concat(f),style:v},a&&n.createElement("div",{style:{width:"48px",height:"48px",margin:"0 auto 24px",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"24px"}},"string"==typeof a?n.createElement("span",null,a):a),r&&n.createElement("h1",{style:x},r),o&&n.createElement("p",{style:E},o),t))},G=e=>{let{children:t,visible:r=!0,onClose:o,onBackdropClick:a,backdropStyle:l={},modalStyle:s={}}=e,c=$(e,L);if(!r)return null;const i=z({position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"},l),d=z({backgroundColor:u.background,borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",height:"100vh",width:"100%",maxWidth:"500px",boxShadow:"0 -10px 40px rgba(0, 0, 0, 0.3)",overflow:"hidden",display:"flex",flexDirection:"column"},s);return n.createElement("div",{style:i,onClick:e=>{e.target===e.currentTarget&&(a?a():o&&o())}},n.createElement("div",{style:d},n.createElement(H,q({showHeader:!0,showCloseButton:!0,onClose:o},c),t)))};function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach(function(t){J(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function J(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function K(e){let{requestData:t,webpageName:r,inferenceData:o=null,onComplete:a=null,autoFetch:l=!0,testMode:s=!0,proofMode:c=!1,textLayout:i="below",textColor:u="white",login:d=!1,buttonType:m="pill",loginReturn:f=null,loginType:p="signIn",visualType:g="full",appIcon:y=null,enableTraining:b=!0,formatResponse:v=!0,responseFormat:x={includeDictionary:!0,includeArray:!0}}=e;const[E,w]=(0,n.useState)(!1),[k,C]=(0,n.useState)("email"),[O,j]=(0,n.useState)(null),[P,I]=(0,n.useState)(null);(0,n.useEffect)(()=>{(()=>{if(s)return console.log("๐งช Test mode: Starting fresh flow, clearing any cached user data"),localStorage.removeItem("onairosUser"),void C("email");const e=localStorage.getItem("onairosUser");if(e)try{const t=JSON.parse(e);j(t),t.onboardingComplete&&t.pinCreated?C("dataRequest"):t.verified&&!t.onboardingComplete?C("onboarding"):t.onboardingComplete&&!t.pinCreated&&C("pin")}catch(e){console.error("Error parsing saved user data:",e),localStorage.removeItem("onairosUser")}})()},[s]);const D=()=>{w(!1),I(null)},_=e=>{console.log("๐ฅ Email auth successful:",e),console.log("๐ง User State:",{isNewUser:e.isNewUser,userState:e.userState,flowType:e.flowType,existingUser:e.existingUser,hasAccountInfo:!!e.accountInfo});const t=!0===e.isNewUser||!1===e.existingUser||"onboarding"===e.flowType||"new"===e.userState||!e.accountInfo;console.log("๐ Flow determination:",{finalDecision:t?"NEW USER โ onboarding (data connectors)":"EXISTING USER โ dataRequest (data permissions)",reasoning:{isNewUser:e.isNewUser,existingUserFalse:!1===e.existingUser,flowTypeOnboarding:"onboarding"===e.flowType,noAccountInfo:!e.accountInfo}});const r=Y(Y({},e),{},{verified:!0,onboardingComplete:!t,pinCreated:!t});j(r),localStorage.setItem("onairosUser",JSON.stringify(r)),t?(console.log("๐ NEW USER detected โ Starting onboarding flow (data connectors page)"),C("onboarding")):(console.log("๐ EXISTING USER detected โ Going directly to data request (data permissions page)"),C("dataRequest"))},T=e=>{console.log("Onboarding completed:",e);const t=Y(Y({},O),{},{onboardingComplete:!0,connectedAccounts:e.connectedAccounts||[]});j(t),localStorage.setItem("onairosUser",JSON.stringify(t)),C("pin")},F=e=>{console.log("PIN setup completed:",e);const t=Y(Y(Y({},O),e),{},{pinCreated:!0});j(t),localStorage.setItem("onairosUser",JSON.stringify(t)),C("dataRequest")},B=e=>{console.log("๐ Training completed:",e);const t=Y(Y({},O),{},{trainingCompleted:!0},e);j(t),localStorage.setItem("onairosUser",JSON.stringify(t)),C("dataRequest")},L=e=>{console.log("๐ฅ OnairosButton: Data request completed:",e);const t=Y(Y({},O),{},{lastDataRequest:e});j(t),localStorage.setItem("onairosUser",JSON.stringify(t)),console.log("๐ฅ Closing overlay after data request completion"),w(!1);let r=e;if(v&&null!=e&&e.apiResponse)try{var n;r=Y(Y({},e),{},{apiResponse:U(e.apiResponse,x)}),console.log("๐ฅ Response formatted with dictionary:",(null===(n=r.apiResponse)||void 0===n?void 0:n.personalityDict)||"No personality data")}catch(e){console.warn("๐ฅ Error formatting response:",e)}if(console.log("๐ฅ Calling onComplete callback with:",r),a)try{a(r),console.log("๐ฅ onComplete callback executed successfully")}catch(e){console.error("๐ฅ Error in onComplete callback:",e)}else console.log("๐ฅ No onComplete callback provided")},q="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===m?"px-4 py-2":"w-12 h-12"," bg-transparent OnairosConnect"),M={flexDirection:"below"===i?"column":"row",backgroundColor:"transparent",color:u,border:"1px solid transparent"},z={width:"20px",height:"20px",marginRight:"full"===g?"12px":"0"};return n.createElement(n.Fragment,null,n.createElement("button",{className:q,onClick:async()=>{try{console.log("๐ฅ openTerminal called"),w(!0)}catch(e){console.error("Error in openTerminal:",e)}},style:M},("full"===g||"icon"===g)&&n.createElement("img",{src:d?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:z}),"icon"!==g&&n.createElement("span",{className:"".concat("black"===u?"text-black":"text-white"," ").concat("icon"===g?"sr-only":""," ").concat("right"===i?"ml-2":"left"===i?"mr-2":"")},(()=>{switch(p){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})())),E&&n.createElement(G,{visible:E,onClose:D,showBackButton:"email"!==k&&"dataRequest"!==k,onBack:()=>{"onboarding"===k&&C("email"),"pin"===k&&C("onboarding"),"training"===k&&C("pin")},title:(()=>{switch(k){case"email":default:return"";case"onboarding":return"Connect Your Data";case"pin":return"Secure Your Account";case"training":return"Training Your Model";case"dataRequest":return"Data Request"}})(),subtitle:(()=>{switch(k){case"email":default:return"";case"onboarding":return"Choose which accounts to connect for a personalized experience";case"pin":return"Create a secure PIN to protect your data";case"training":return"Building your personalized insights";case"dataRequest":return"Select the data you want to share with ".concat(r)}})(),icon:(()=>{switch(k){case"email":default:return"";case"onboarding":return"๐";case"pin":return"๐";case"training":return"โก";case"dataRequest":return"๐"}})(),centerContent:!0},(()=>{switch(k){case"email":return n.createElement(h,{onSuccess:_,testMode:s});case"onboarding":return n.createElement(N,{onComplete:T,appIcon:y||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:r,username:(null==O?void 0:O.email)||(null==O?void 0:O.username),testMode:s});case"pin":return n.createElement(S,{onComplete:F,userEmail:null==O?void 0:O.email});case"training":return n.createElement(A,{onComplete:B,userEmail:null==O?void 0:O.email,appName:r,connectedAccounts:(null==O?void 0:O.connectedAccounts)||[],testMode:s});case"dataRequest":return n.createElement(R,{onComplete:L,userEmail:null==O?void 0:O.email,requestData:t,appName:r,autoFetch:l,testMode:s,appIcon:y,connectedAccounts:(null==O?void 0:O.connectedAccounts)||{}});default:return n.createElement("div",{className:"flex flex-col items-center space-y-4 p-6"},n.createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}),n.createElement("p",{className:"text-gray-600"},"Loading..."))}})()))}},287:(e,t)=>{var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function b(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||p}function h(){}function v(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||p}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},h.prototype=b.prototype;var x=v.prototype=new h;x.constructor=v,g(x,b.prototype),x.isPureReactComponent=!0;var E=Array.isArray,w=Object.prototype.hasOwnProperty,k={current:null},N={key:!0,ref:!0,__self:!0,__source:!0};function S(e,t,n){var o,a={},l=null,s=null;if(null!=t)for(o in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(l=""+t.key),t)w.call(t,o)&&!N.hasOwnProperty(o)&&(a[o]=t[o]);var c=arguments.length-2;if(1===c)a.children=n;else if(1<c){for(var i=Array(c),u=0;u<c;u++)i[u]=arguments[u+2];a.children=i}if(e&&e.defaultProps)for(o in c=e.defaultProps)void 0===a[o]&&(a[o]=c[o]);return{$$typeof:r,type:e,key:l,ref:s,props:a,_owner:k.current}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var O=/\/+/g;function j(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function P(e,t,o,a,l){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c=!1;if(null===e)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case r:case n:c=!0}}if(c)return l=l(c=e),e=""===a?"."+j(c,0):a,E(l)?(o="",null!=e&&(o=e.replace(O,"$&/")+"/"),P(l,t,o,"",function(e){return e})):null!=l&&(C(l)&&(l=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(l,o+(!l.key||c&&c.key===l.key?"":(""+l.key).replace(O,"$&/")+"/")+e)),t.push(l)),1;if(c=0,a=""===a?".":a+":",E(e))for(var i=0;i<e.length;i++){var u=a+j(s=e[i],i);c+=P(s,t,o,u,l)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),i=0;!(s=e.next()).done;)c+=P(s=s.value,t,o,u=a+j(s,i++),l);else if("object"===s)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function I(e,t,r){if(null==e)return e;var n=[],o=0;return P(e,n,"","",function(e){return t.call(r,e,o++)}),n}function R(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var A={current:null},D={transition:null},_={ReactCurrentDispatcher:A,ReactCurrentBatchConfig:D,ReactCurrentOwner:k};function T(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:I,forEach:function(e,t,r){I(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return I(e,function(){t++}),t},toArray:function(e){return I(e,function(e){return e})||[]},only:function(e){if(!C(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=b,t.Fragment=o,t.Profiler=l,t.PureComponent=v,t.StrictMode=a,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_,t.act=T,t.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=g({},e.props),a=e.key,l=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(l=t.ref,s=k.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(i in t)w.call(t,i)&&!N.hasOwnProperty(i)&&(o[i]=void 0===t[i]&&void 0!==c?c[i]:t[i])}var i=arguments.length-2;if(1===i)o.children=n;else if(1<i){c=Array(i);for(var u=0;u<i;u++)c[u]=arguments[u+2];o.children=c}return{$$typeof:r,type:e.type,key:a,ref:l,props:o,_owner:s}},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=S,t.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:i,render:e}},t.isValidElement=C,t.lazy=function(e){return{$$typeof:m,_payload:{_status:-1,_result:e},_init:R}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=D.transition;D.transition={};try{e()}finally{D.transition=t}},t.unstable_act=T,t.useCallback=function(e,t){return A.current.useCallback(e,t)},t.useContext=function(e){return A.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return A.current.useDeferredValue(e)},t.useEffect=function(e,t){return A.current.useEffect(e,t)},t.useId=function(){return A.current.useId()},t.useImperativeHandle=function(e,t,r){return A.current.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return A.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return A.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return A.current.useMemo(e,t)},t.useReducer=function(e,t,r){return A.current.useReducer(e,t,r)},t.useRef=function(e){return A.current.useRef(e)},t.useState=function(e){return A.current.useState(e)},t.useSyncExternalStore=function(e,t,r){return A.current.useSyncExternalStore(e,t,r)},t.useTransition=function(){return A.current.useTransition()},t.version="18.3.1"},540:(e,t,r)=>{e.exports=r(287)}}]);
|
|
2
2
|
//# sourceMappingURL=123.js.map
|