onairos 3.2.0 โ 3.4.0
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/dist/129.js +2 -0
- package/dist/129.js.map +1 -0
- package/dist/185.js +2 -0
- package/dist/185.js.map +1 -0
- package/dist/22.js +2 -0
- package/dist/22.js.map +1 -0
- package/dist/241.js +1 -1
- package/dist/241.js.map +1 -1
- package/dist/659.js +2 -0
- package/dist/659.js.map +1 -0
- package/dist/672.js +2 -0
- package/dist/672.js.map +1 -0
- package/dist/726.js +2 -0
- package/dist/726.js.map +1 -0
- package/dist/947.js +2 -0
- package/dist/947.js.map +1 -0
- package/dist/991.js +1 -1
- package/dist/iframe.bundle.js +1 -1
- package/dist/iframe.bundle.js.map +1 -1
- 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/persona-anim.json +1 -0
- package/dist/rain-anim.json +1 -0
- package/dist/static/05c758ed311d612f5b2e.png +0 -0
- package/dist/static/57bfa6300fc0291f56f9.png +0 -0
- package/dist/static/727ee52ae16d80076d2a.png +0 -0
- package/dist/static/d8ffd6e9a25afb35ce77.png +0 -0
- package/package.json +164 -164
- package/src/assets/chatgpt-icon.png +0 -0
package/dist/129.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(this.webpackChunkOnairosLaravel=this.webpackChunkOnairosLaravel||[]).push([[129,540],{129:(e,t,n)=>{n.d(t,{OnairosButton:()=>V});var r=n(540);function o(e){let{onContinue:t,onClose:n}=e;return(0,r.useEffect)(()=>{const e=document.createElement("script");return e.src="https://scripts.sirv.com/sirvjs/v3/sirv.js",e.async=!0,document.head.appendChild(e),()=>{const e=document.querySelector('script[src="https://scripts.sirv.com/sirvjs/v3/sirv.js"]');e&&document.head.removeChild(e)}},[]),r.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},r.createElement("div",{className:"px-6 text-center flex-1 flex flex-col justify-center"},r.createElement("div",{className:"mb-8 flex justify-center"},r.createElement("div",{className:"w-20 h-20 flex items-center justify-center"},r.createElement("img",{className:"Sirv w-full h-full object-contain","data-src":"https://anushkasirv.sirv.com/OnairosBlack.png",alt:"Onairos Logo"}))),r.createElement("p",{className:"text-gray-500 text-sm mb-2"},"Welcome to"),r.createElement("h1",{className:"text-4xl font-bold text-gray-900 mb-6 text-balance"},"Onairos"),r.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!")),r.createElement("div",{className:"px-6 pb-8 flex-shrink-0"},r.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 transition-colors",onClick:t},"Get Started",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})))))}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const i={1:"https://anushkasirv.sirv.com/persona1.png",2:"https://anushkasirv.sirv.com/persona2.png",3:"https://anushkasirv.sirv.com/persona3.png",4:"https://anushkasirv.sirv.com/persona4.png",5:"https://anushkasirv.sirv.com/persona5.png"},c={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 u(e){let{onComplete:t,personaImages:n,priorityPlatform:o=null}=e;const a=null!=n?n:i,[s,u]=(0,r.useState)({}),[m,d]=(0,r.useState)(!1),[p,f]=(0,r.useState)(null),[g,h]=(0,r.useState)("Google"),[y,b]=(0,r.useState)(()=>"undefined"!=typeof window?window.innerHeight:800),[v,x]=(0,r.useState)(()=>"undefined"!=typeof window?window.innerWidth:1200);(0,r.useEffect)(()=>{const e=()=>{b(window.innerHeight),x(window.innerWidth)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const w=Math.min(.7*y,640),E=y<760?1.18:1.35,k=(0,r.useId)(),N={gmail:r.createElement("svg",{viewBox:"0 0 24 24"},r.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"}),r.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"}),r.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"}),r.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"})),reddit:r.createElement("svg",{viewBox:"0 0 24 24"},r.createElement("path",{fill:"#FF4500",d:"M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 1 1.108-.701zM9.25 12C8.561 12 8 12.562 8 13.25c0 .687.561 1.248 1.25 1.248.687 0 1.248-.561 1.248-1.249 0-.688-.561-1.249-1.249-1.249zm5.5 0c-.687 0-1.248.561-1.248 1.25 0 .687.561 1.248 1.249 1.248.688 0 1.249-.561 1.249-1.249 0-.687-.562-1.249-1.25-1.249zm-5.466 3.99a.327.327 0 0 0-.231.094.33.33 0 0 0 0 .463c.842.842 2.484.913 2.961.913.477 0 2.105-.056 2.961-.913a.361.361 0 0 0 .029-.463.33.33 0 0 0-.464 0c-.547.533-1.684.73-2.512.73-.828 0-1.979-.196-2.512-.73a.326.326 0 0 0-.232-.095z"})),instagram:r.createElement("svg",{viewBox:"0 0 24 24"},r.createElement("defs",null,r.createElement("radialGradient",{id:k,cx:"0.5",cy:"1",r:"1"},r.createElement("stop",{offset:"0%",stopColor:"#FD5949"}),r.createElement("stop",{offset:"50%",stopColor:"#D6249F"}),r.createElement("stop",{offset:"100%",stopColor:"#285AEB"}))),r.createElement("path",{fill:"url(#".concat(k,")"),d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.073-1.689-.073-4.849 0-3.204.013-3.583.072-4.948.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0 3.675c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"})),linkedin:r.createElement("svg",{viewBox:"0 0 24 24"},r.createElement("path",{fill:"#0077B5",d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})),pinterest:r.createElement("svg",{viewBox:"0 0 24 24"},r.createElement("path",{fill:"#E60023",d:"M12 0C5.373 0 0 5.372 0 12s5.373 12 12 12c6.628 0 12-5.372 12-12S18.628 0 12 0zm0 19c-.721 0-1.418-.109-2.073-.312.286-.465.713-1.227.87-1.835l.437-1.664c.229.436.895.8 1.604.8 2.111 0 3.633-1.941 3.633-4.354 0-2.312-1.895-4.049-4.218-4.049-2.972 0-4.684 1.946-4.684 4.338 0 1.083.424 2.42 1.218 2.847.131.07.201.04.232-.107.023-.106.151-.602.2-.784.067-.25.041-.336-.145-.553-.408-.474-.615-1.088-.615-1.72 0-1.658 1.222-3.259 3.297-3.259 1.798 0 3.064 1.244 3.064 3.018 0 2.019-.864 3.423-2.024 3.423-.633 0-1.106-.537-.954-1.196.181-.788.532-1.637.532-2.204 0-.508-.267-.932-.822-.932-.652 0-1.176.685-1.176 1.602 0 .584.197.98.197.98l-.79 3.396C6.595 16.85 6.017 14.47 6.017 12c0-3.313 2.687-6 6-6s6 2.687 6 6-2.687 6-6 6z"}))},C={Google:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"search"),", ",r.createElement("strong",{className:"font-semibold"},"YouTube"),", and ",r.createElement("strong",{className:"font-semibold"},"location signals")," to better understand your interests and routines."),Reddit:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"search history")," to better understand your interests and routines."),Instagram:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"photos")," and ",r.createElement("strong",{className:"font-semibold"},"interactions")," to learn visual preferences."),LinkedIn:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"professional graph")," and ",r.createElement("strong",{className:"font-semibold"},"content")," to infer career interests."),Pinterest:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"pins")," and ",r.createElement("strong",{className:"font-semibold"},"boards")," to understand creative tastes.")},O=[{name:"Google",connector:"gmail",icon:N.gmail},{name:"Reddit",connector:"reddit",icon:N.reddit},{name:"Instagram",connector:"instagram",icon:N.instagram},{name:"LinkedIn",connector:"linkedin",icon:N.linkedin},{name:"Pinterest",connector:"pinterest",icon:N.pinterest}];async function S(e){const t=O.find(t=>t.name===e);if(!t)return!1;try{var n;d(!0),f(e);const r=localStorage.getItem("username")||(null===(n=JSON.parse(localStorage.getItem("onairosUser")||"{}"))||void 0===n?void 0:n.email)||"user@example.com",o=await fetch("".concat(c.baseUrl,"/").concat(t.connector,"/authorize"),{method:"POST",headers:{"x-api-key":c.apiKey,"Content-Type":"application/json"},body:JSON.stringify({session:{username:r}})});if(!o.ok)throw new Error("auth failed");const a=await o.json(),s={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 i=null;for(const e of s)if(a[e]){i=a[e];break}if(!i)throw new Error("no url");if(/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=i,!0;const m=window.open(i,"".concat(t.connector,"_oauth"),"width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no");if(!m)throw new Error("popup blocked");let p=!1;const g=setInterval(()=>{try{m.location&&"onairos.uk"===m.location.hostname&&(p=!0,m.close())}catch(e){p||(p=!0)}try{m.closed&&(clearInterval(g),u(t=>l(l({},t),{},{[e]:!0})),d(!1),f(null))}catch(e){}},800);return setTimeout(()=>{try{!m.closed&&p&&m.close()}catch(e){}},1e4),setTimeout(()=>{m.closed||(m.close(),clearInterval(g),d(!1),f(null))},3e5),!0}catch(e){return d(!1),f(null),!1}}(0,r.useEffect)(()=>{const e=localStorage.getItem("onairos_oauth_platform");e&&(localStorage.removeItem("onairos_oauth_platform"),localStorage.removeItem("onairos_oauth_return"),u(t=>l(l({},t),{},{[e]:!0})))},[]);const j=Object.values(s).filter(Boolean).length,P=Math.min(j+1,5);return r.createElement("div",{className:"w-full h-full flex flex-col relative",style:{height:"100vh",minHeight:0,paddingBottom:144}},r.createElement("div",{className:"px-6 pt-16 pb-6"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2 leading-tight"},"Connect App Data"),r.createElement("p",{className:"text-gray-600 text-base"},"More Connections, Better Personalization.")),r.createElement("div",{className:"px-6 flex-1 flex items-center justify-center",style:{marginTop:-36}},r.createElement("div",{className:"overflow-hidden rounded-[28px]",style:{width:w,height:w}},r.createElement("img",{src:a[P],alt:"Persona ".concat(P),className:"w-full h-full object-cover",onError:e=>{const t=e.currentTarget.parentElement;e.currentTarget.style.display="none",t&&(t.style.background="linear-gradient(135deg,#f97316 0%,#ec4899 50%,#8b5cf6 100%)")}}))),r.createElement("div",{className:"px-6",style:{height:96,marginTop:Math.max(-84,.1*-y)}},r.createElement("div",{className:"h-full flex items-end justify-center overflow-x-hidden"},r.createElement("div",{className:"grid w-full box-border",style:{gridTemplateColumns:"repeat(5, 1fr)",columnGap:y<760?16:24,alignItems:"end",justifyItems:"center",paddingInline:8}},O.map(e=>{const t=!!s[e.name],n=m&&p===e.name,o=g===e.name;return r.createElement("div",{key:e.name,className:"flex items-end justify-center",style:{width:76,height:76}},r.createElement("button",{type:"button",onClick:()=>h(e.name),className:"relative grid place-items-end outline-none",style:{width:76,height:76},title:e.name},r.createElement("div",{className:"rounded-full border-2 transition-transform duration-150 ease-out flex items-center justify-center\n ".concat(t?"border-black bg-black text-white":"border-gray-300 hover:border-gray-400 bg-white text-black"),style:{width:52,height:52,transform:"scale(".concat(o?E:1,")"),transformOrigin:"bottom center",willChange:"transform"}},n?r.createElement("div",{className:"animate-spin h-5 w-5 border-2 border-gray-400 rounded-full border-t-transparent"}):r.createElement("div",{className:"flex items-center justify-center",style:{width:22,height:22}},r.cloneElement(e.icon,{width:22,height:22,style:{display:"block"}})))))})))),r.createElement("div",{className:"px-6",style:{marginTop:-6}},r.createElement("div",{className:"mx-auto rounded-2xl bg-white shadow-sm border border-gray-200 px-4 py-3",style:{width:"min(680px,92%)"}},r.createElement("div",{className:"flex items-center justify-between"},r.createElement("div",{className:"text-gray-900 font-medium"},g),r.createElement("button",{type:"button",role:"switch","aria-checked":!!s[g],"aria-label":"toggle ".concat(g),onClick:()=>(async e=>{if(m&&p!==e)return;s[e]?u(t=>l(l({},t),{},{[e]:!1})):await S(e)})(g),disabled:m&&p!==g,className:"relative inline-flex items-center transition-colors disabled:opacity-50 ".concat(s[g]?"bg-black":"bg-gray-200"," rounded-full"),style:{width:56,height:32}},r.createElement("span",{className:"absolute bg-white rounded-full shadow",style:{width:24,height:24,transform:s[g]?"translateX(26px)":"translateX(6px)",transition:"transform 160ms ease"}}))),r.createElement("div",{className:"mt-3"},r.createElement("div",{className:"rounded-2xl bg-gray-50 text-gray-700 text-sm leading-6 px-4 py-3 shadow-[inset_0_0_0_1px_rgba(0,0,0,0.04)]"},C[g]||null)))),r.createElement("div",{className:"absolute left-0 right-0 px-6",style:{bottom:16,height:88}},r.createElement("div",{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 cursor-pointer transition-colors",onClick:()=>{const e=Object.entries(s).filter(e=>{let[,t]=e;return t}).map(e=>{let[t]=e;return t});null==t||t({connectedAccounts:e,totalConnections:e.length})}},"Update",r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))),r.createElement("div",{onClick:()=>null==t?void 0:t({connectedAccounts:[],totalConnections:0}),className:"w-full text-gray-600 text-base font-medium py-2 text-center cursor-pointer hover:text-gray-800 transition-colors"},"Skip")))}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach(function(t){p(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function p(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const f={1:"https://anushkasirv.sirv.com/persona1.png",2:"https://anushkasirv.sirv.com/persona2.png",3:"https://anushkasirv.sirv.com/persona3.png",4:"https://anushkasirv.sirv.com/persona4.png",5:"https://anushkasirv.sirv.com/persona5.png"},g={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 h(e){let{onComplete:t,personaImages:n,priorityPlatform:o=null}=e;const a=null!=n?n:f,[l,s]=(0,r.useState)({}),[i,c]=(0,r.useState)(!1),[u,m]=(0,r.useState)(null),[p,h]=(0,r.useState)("Google"),[y,b]=(0,r.useState)(()=>"undefined"!=typeof window?window.innerHeight:800),[v,x]=(0,r.useState)(()=>"undefined"!=typeof window?window.innerWidth:1200);(0,r.useEffect)(()=>{const e=()=>{b(window.innerHeight),x(window.innerWidth)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const w=Math.min(.7*y,640),E=y<760?1.18:1.35,k=(0,r.useId)(),N={gmail:r.createElement("svg",{viewBox:"0 0 24 24"},r.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"}),r.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"}),r.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"}),r.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"})),reddit:r.createElement("svg",{viewBox:"0 0 24 24"},r.createElement("path",{fill:"#FF4500",d:"M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 1 1.108-.701zM9.25 12C8.561 12 8 12.562 8 13.25c0 .687.561 1.248 1.25 1.248.687 0 1.248-.561 1.248-1.249 0-.688-.561-1.249-1.249-1.249zm5.5 0c-.687 0-1.248.561-1.248 1.25 0 .687.561 1.248 1.249 1.248.688 0 1.249-.561 1.249-1.249 0-.687-.562-1.249-1.25-1.249zm-5.466 3.99a.327.327 0 0 0-.231.094.33.33 0 0 0 0 .463c.842.842 2.484.913 2.961.913.477 0 2.105-.056 2.961-.913a.361.361 0 0 0 .029-.463.33.33 0 0 0-.464 0c-.547.533-1.684.73-2.512.73-.828 0-1.979-.196-2.512-.73a.326.326 0 0 0-.232-.095z"})),instagram:r.createElement("svg",{viewBox:"0 0 24 24"},r.createElement("defs",null,r.createElement("radialGradient",{id:k,cx:"0.5",cy:"1",r:"1"},r.createElement("stop",{offset:"0%",stopColor:"#FD5949"}),r.createElement("stop",{offset:"50%",stopColor:"#D6249F"}),r.createElement("stop",{offset:"100%",stopColor:"#285AEB"}))),r.createElement("path",{fill:"url(#".concat(k,")"),d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.073-1.689-.073-4.849 0-3.204.013-3.583.072-4.948.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0 3.675c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"})),linkedin:r.createElement("svg",{viewBox:"0 0 24 24"},r.createElement("path",{fill:"#0077B5",d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})),pinterest:r.createElement("svg",{viewBox:"0 0 24 24"},r.createElement("path",{fill:"#E60023",d:"M12 0C5.373 0 0 5.372 0 12s5.373 12 12 12c6.628 0 12-5.372 12-12S18.628 0 12 0zm0 19c-.721 0-1.418-.109-2.073-.312.286-.465.713-1.227.87-1.835l.437-1.664c.229.436.895.8 1.604.8 2.111 0 3.633-1.941 3.633-4.354 0-2.312-1.895-4.049-4.218-4.049-2.972 0-4.684 1.946-4.684 4.338 0 1.083.424 2.42 1.218 2.847.131.07.201.04.232-.107.023-.106.151-.602.2-.784.067-.25.041-.336-.145-.553-.408-.474-.615-1.088-.615-1.72 0-1.658 1.222-3.259 3.297-3.259 1.798 0 3.064 1.244 3.064 3.018 0 2.019-.864 3.423-2.024 3.423-.633 0-1.106-.537-.954-1.196.181-.788.532-1.637.532-2.204 0-.508-.267-.932-.822-.932-.652 0-1.176.685-1.176 1.602 0 .584.197.98.197.98l-.79 3.396C6.595 16.85 6.017 14.47 6.017 12c0-3.313 2.687-6 6-6s6 2.687 6 6-2.687 6-6 6z"}))},C={Google:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"search"),", ",r.createElement("strong",{className:"font-semibold"},"YouTube"),", and ",r.createElement("strong",{className:"font-semibold"},"location signals")," to better understand your interests and routines."),Reddit:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"search history")," to better understand your interests and routines."),Instagram:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"photos")," and ",r.createElement("strong",{className:"font-semibold"},"interactions")," to learn visual preferences."),LinkedIn:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"professional graph")," and ",r.createElement("strong",{className:"font-semibold"},"content")," to infer career interests."),Pinterest:r.createElement(r.Fragment,null,"We use your ",r.createElement("strong",{className:"font-semibold"},"pins")," and ",r.createElement("strong",{className:"font-semibold"},"boards")," to understand creative tastes.")},O=[{name:"Google",connector:"gmail",icon:N.gmail},{name:"Reddit",connector:"reddit",icon:N.reddit},{name:"Instagram",connector:"instagram",icon:N.instagram},{name:"LinkedIn",connector:"linkedin",icon:N.linkedin},{name:"Pinterest",connector:"pinterest",icon:N.pinterest}];async function S(e){const t=O.find(t=>t.name===e);if(!t)return!1;try{var n;c(!0),m(e);const r=localStorage.getItem("username")||(null===(n=JSON.parse(localStorage.getItem("onairosUser")||"{}"))||void 0===n?void 0:n.email)||"user@example.com",o=await fetch("".concat(g.baseUrl,"/").concat(t.connector,"/authorize"),{method:"POST",headers:{"x-api-key":g.apiKey,"Content-Type":"application/json"},body:JSON.stringify({session:{username:r}})});if(!o.ok)throw new Error("auth failed");const a=await o.json(),l={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 i=null;for(const e of l)if(a[e]){i=a[e];break}if(!i)throw new Error("no url");if(/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=i,!0;const u=window.open(i,"".concat(t.connector,"_oauth"),"width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no");if(!u)throw new Error("popup blocked");let p=!1;const f=setInterval(()=>{try{u.location&&"onairos.uk"===u.location.hostname&&(p=!0,u.close())}catch(e){p||(p=!0)}try{u.closed&&(clearInterval(f),s(t=>d(d({},t),{},{[e]:!0})),c(!1),m(null))}catch(e){}},800);return setTimeout(()=>{try{!u.closed&&p&&u.close()}catch(e){}},1e4),setTimeout(()=>{u.closed||(u.close(),clearInterval(f),c(!1),m(null))},3e5),!0}catch(e){return c(!1),m(null),!1}}(0,r.useEffect)(()=>{const e=localStorage.getItem("onairos_oauth_platform");e&&(localStorage.removeItem("onairos_oauth_platform"),localStorage.removeItem("onairos_oauth_return"),s(t=>d(d({},t),{},{[e]:!0})))},[]);const j=Object.values(l).filter(Boolean).length,P=Math.min(j+1,5);return r.createElement("div",{className:"w-full h-full flex flex-col relative",style:{height:"100vh",minHeight:0,paddingBottom:144}},r.createElement("div",{className:"px-6 pt-16 pb-6"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2 leading-tight"},"Connect App Data"),r.createElement("p",{className:"text-gray-600 text-base"},"More Connections, Better Personalization.")),r.createElement("div",{className:"px-6 flex-1 flex items-center justify-center",style:{marginTop:-36}},r.createElement("div",{className:"overflow-hidden rounded-[28px]",style:{width:w,height:w}},r.createElement("img",{src:a[P],alt:"Persona ".concat(P),className:"w-full h-full object-cover",onError:e=>{const t=e.currentTarget.parentElement;e.currentTarget.style.display="none",t&&(t.style.background="linear-gradient(135deg,#f97316 0%,#ec4899 50%,#8b5cf6 100%)")}}))),r.createElement("div",{className:"px-6",style:{height:96,marginTop:Math.max(-84,.1*-y)}},r.createElement("div",{className:"h-full flex items-end justify-center overflow-x-hidden"},r.createElement("div",{className:"grid w-full box-border",style:{gridTemplateColumns:"repeat(5, 1fr)",columnGap:y<760?16:24,alignItems:"end",justifyItems:"center",paddingInline:8}},O.map(e=>{const t=!!l[e.name],n=i&&u===e.name,o=p===e.name;return r.createElement("div",{key:e.name,className:"flex items-end justify-center",style:{width:76,height:76}},r.createElement("button",{type:"button",onClick:()=>h(e.name),className:"relative grid place-items-end outline-none",style:{width:76,height:76},title:e.name},r.createElement("div",{className:"rounded-full border-2 transition-transform duration-150 ease-out flex items-center justify-center\n ".concat(t?"border-black bg-black text-white":"border-gray-300 hover:border-gray-400 bg-white text-black"),style:{width:52,height:52,transform:"scale(".concat(o?E:1,")"),transformOrigin:"bottom center",willChange:"transform"}},n?r.createElement("div",{className:"animate-spin h-5 w-5 border-2 border-gray-400 rounded-full border-t-transparent"}):r.createElement("div",{className:"flex items-center justify-center",style:{width:22,height:22}},r.cloneElement(e.icon,{width:22,height:22,style:{display:"block"}})))))})))),r.createElement("div",{className:"px-6",style:{marginTop:-6}},r.createElement("div",{className:"mx-auto rounded-2xl bg-white shadow-sm border border-gray-200 px-4 py-3",style:{width:"min(680px,92%)"}},r.createElement("div",{className:"flex items-center justify-between"},r.createElement("div",{className:"text-gray-900 font-medium"},p),r.createElement("button",{type:"button",role:"switch","aria-checked":!!l[p],"aria-label":"toggle ".concat(p),onClick:()=>(async e=>{if(i&&u!==e)return;l[e]?s(t=>d(d({},t),{},{[e]:!1})):await S(e)})(p),disabled:i&&u!==p,className:"relative inline-flex items-center transition-colors disabled:opacity-50 ".concat(l[p]?"bg-black":"bg-gray-200"," rounded-full"),style:{width:56,height:32}},r.createElement("span",{className:"absolute bg-white rounded-full shadow",style:{width:24,height:24,transform:l[p]?"translateX(26px)":"translateX(6px)",transition:"transform 160ms ease"}}))),r.createElement("div",{className:"mt-3"},r.createElement("div",{className:"rounded-2xl bg-gray-50 text-gray-700 text-sm leading-6 px-4 py-3 shadow-[inset_0_0_0_1px_rgba(0,0,0,0.04)]"},C[p]||null)))),r.createElement("div",{className:"absolute left-0 right-0 px-6",style:{bottom:16,height:88}},r.createElement("div",{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 cursor-pointer transition-colors",onClick:()=>{const e=Object.entries(l).filter(e=>{let[,t]=e;return t}).map(e=>{let[t]=e;return t});null==t||t({connectedAccounts:e,totalConnections:e.length})}},"Update",r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))),r.createElement("div",{onClick:()=>null==t?void 0:t({connectedAccounts:[],totalConnections:0}),className:"w-full text-gray-600 text-base font-medium py-2 text-center cursor-pointer hover:text-gray-800 transition-colors"},"Skip")))}function y(e){let{onComplete:t,onBack:n,userEmail:o}=e;const[a,l]=(0,r.useState)(""),[s,i]=(0,r.useState)({length:!1,uppercase:!1,number:!1});(0,r.useEffect)(()=>{i({length:a.length>=6,uppercase:/[A-Z]/.test(a),number:/\d/.test(a)})},[a]);const c=s.length&&s.uppercase&&s.number;return r.createElement("div",{className:"w-full h-full flex flex-col",style:{height:"100%",minHeight:0}},r.createElement("div",{className:"px-6 pt-16 flex-1 flex flex-col",style:{minHeight:0,overflow:"hidden"}},r.createElement("div",{className:"mb-6 flex-shrink-0"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2"},"Create a PIN"),r.createElement("p",{className:"text-gray-600 text-base"},"A PIN so only you have the access to your data")),r.createElement("div",{className:"mb-6 flex-shrink-0"},r.createElement("input",{type:"password",value:a,onChange:e=>l(e.target.value),className:"w-full px-4 py-4 border-2 border-gray-300 rounded-xl text-center text-lg font-medium focus:border-gray-900 focus:outline-none bg-gray-50",placeholder:"Enter your PIN",maxLength:20})),r.createElement("div",{className:"flex-1 overflow-y-auto",style:{minHeight:0}},r.createElement("div",{className:"space-y-3 pb-4"},r.createElement("p",{className:"text-gray-900 font-medium mb-4"},"Your PIN must:"),r.createElement("div",{className:"space-y-3"},r.createElement("div",{className:"flex items-center gap-3"},r.createElement("div",{className:"w-5 h-5 rounded-full border-2 ".concat(s.length?"border-green-500 bg-green-500":"border-gray-300 bg-white")},s.length&&r.createElement("svg",{className:"w-3 h-3 text-white m-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),r.createElement("span",{className:"text-gray-700"},"Be at least 6 characters in length.")),r.createElement("div",{className:"flex items-center gap-3"},r.createElement("div",{className:"w-5 h-5 rounded-full border-2 ".concat(s.uppercase?"border-green-500 bg-green-500":"border-gray-300 bg-white")},s.uppercase&&r.createElement("svg",{className:"w-3 h-3 text-white m-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),r.createElement("span",{className:"text-gray-700"},"Contain an uppercase letter.")),r.createElement("div",{className:"flex items-center gap-3"},r.createElement("div",{className:"w-5 h-5 rounded-full border-2 ".concat(s.number?"border-green-500 bg-green-500":"border-gray-300 bg-white")},s.number&&r.createElement("svg",{className:"w-3 h-3 text-white m-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),r.createElement("span",{className:"text-gray-700"},"Contain a number.")))))),r.createElement("div",{className:"px-6 pb-6 pt-4 flex-shrink-0 space-y-3",style:{minHeight:"auto"}},r.createElement("div",{className:"w-full rounded-full py-4 text-base font-medium flex items-center justify-center gap-2 transition-colors ".concat(c?"bg-gray-900 hover:bg-gray-800 text-white cursor-pointer":"bg-gray-300 text-gray-500 cursor-not-allowed"),onClick:c?()=>{c&&t({pin:a,pinCreated:!0,timestamp:(new Date).toISOString()})}:void 0},"Continue",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})))))}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w.apply(null,arguments)}const E=[{id:"basic",name:"Basic Profile",description:"Essential profile information, account details, and basic demographics",icon:"User",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:"preferences",name:"User Preferences",description:"User preferences, interests, settings and personal choices",icon:"Grid3X3",required:!1,tooltip:"Your stated preferences and interests from connected platforms. Helps customize your experience.",privacyLink:"https://onairos.uk/privacy#preferences-data"},{id:"personality",name:"Personality Traits",description:"Personality traits, behavioral patterns and psychological insights",icon:"Brain",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"}],k=e=>{let{dataType:t,isEnabled:n,onToggle:o,isLast:a}=e;return r.createElement("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50"},r.createElement("div",{className:"flex items-center gap-4"},r.createElement("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center flex-shrink-0"},(e=>{const t={className:"w-4 h-4 text-gray-600"};switch(e){case"User":return r.createElement("svg",w({},t,{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"}));case"Grid3X3":return r.createElement("svg",w({},t,{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"}));case"Brain":return r.createElement("svg",w({},t,{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"}));default:return r.createElement("span",{className:"text-lg"},e)}})(t.icon)),r.createElement("div",{className:"min-w-0 flex-1"},r.createElement("span",{className:"font-medium text-gray-900 text-sm"},t.name))),r.createElement("div",{onClick:()=>{t.required||o(t.id,!n)},className:"w-5 h-5 rounded border-2 flex items-center justify-center cursor-pointer transition-colors flex-shrink-0 ".concat(n?"bg-gray-900 border-gray-900":"bg-white border-gray-300")},n&&r.createElement("svg",{className:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},r.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"}))))},N=e=>{let{userEmail:t="user@example.com",testMode:n=!0,onComplete:o,autoFetch:a=!0,appName:l="Test App",formatResponse:s=!1,responseFormat:i="simple"}=e;const[c,u]=(0,r.useState)({basic:!0,personality:!1,preferences:!1}),[m,d]=(0,r.useState)(!1),[p,f]=(0,r.useState)(null),g=(e,t)=>{const n=E.find(t=>t.id===e);null!=n&&n.required||u(n=>v(v({},n),{},{[e]:t}))},h=Object.values(c).filter(Boolean).length;return r.createElement("div",{className:"w-full h-full flex flex-col min-h-0"},r.createElement("div",{className:"px-6 pt-16 flex-1 flex flex-col min-h-0",style:{minHeight:"calc(100vh - 200px)"}},r.createElement("div",{className:"mb-4 flex justify-center items-center gap-4 flex-shrink-0"},r.createElement("div",{className:"w-12 h-12 bg-white rounded-xl shadow-lg flex items-center justify-center border border-gray-100"},r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"none"},r.createElement("path",{d:"M12 2C13.1 2 14 2.9 14 4C14 5.1 13.1 6 12 6C10.9 6 10 5.1 10 4C10 2.9 10.9 2 12 2Z",fill:"black"}),r.createElement("path",{d:"M21 9V7L15 6.5V9C15 10.66 13.66 12 12 12C10.34 12 9 10.66 9 9V6.5L3 7V9C3 12.87 6.13 16 10 16V22H14V16C17.87 16 21 12.87 21 9Z",fill:"black"}))),r.createElement("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})),r.createElement("div",{className:"w-12 h-12 bg-white rounded-xl shadow-lg flex items-center justify-center border border-gray-100"},r.createElement("span",{className:"text-xl font-serif font-bold text-black"},"E"))),r.createElement("div",{className:"mb-4 flex-shrink-0"},r.createElement("h1",{className:"text-xl font-bold text-gray-900 mb-2 text-balance leading-tight"},"Enoch wants to personalize your experience"),r.createElement("p",{className:"text-gray-600 text-sm"},"Choose what to share:")),r.createElement("div",{className:"flex-1 overflow-y-auto min-h-0"},r.createElement("div",{className:"space-y-4 pb-4"},E.map((e,t)=>r.createElement(k,{key:e.id,dataType:e,isEnabled:c[e.id],onToggle:g,isLast:t===E.length-1}))))),r.createElement("div",{className:"px-6 pb-6 pt-3 flex-shrink-0 space-y-2 bg-white border-t border-gray-100"},r.createElement("div",{className:"w-full bg-gray-900 hover:bg-gray-800 text-white rounded-full py-3 text-sm font-medium flex items-center justify-center gap-2 cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:async()=>{console.log("๐ฅ DataRequest: fetchUserData called"),console.log("๐ฅ DataRequest: onComplete function:",typeof o),console.log("๐ฅ DataRequest: selectedData:",c),console.log("๐ฅ DataRequest: selectedCount:",h),d(!0),f(null);try{const e=(e=>{let t=0;const n=e+Date.now().toString();for(let e=0;e<n.length;e++)t=(t<<5)-t+n.charCodeAt(e),t&=t;return"user_".concat(Math.abs(t).toString(36))})(t),r=Object.entries(c).filter(e=>{let[t,n]=e;return n}).map(e=>{let[t]=e;return t}),s=e=>{const t=[],n=(new Date).toISOString(),r={basic:"Medium",personality:"Large",preferences:"Traits"};return e.forEach(e=>{r[e]&&t.push({data:r[e],date:n})}),t},i=n?"https://api2.onairos.uk/inferenceTest":"https://api2.onairos.uk/getAPIurlMobile",u={userHash:e,appName:l,approvedData:r,apiUrl:i,testMode:n,timestamp:(new Date).toISOString()};if(a)if(n)console.log("๐งช Test mode: Simulating data request API call for:",r),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:r,timestamp:(new Date).toISOString(),testMode:!0}},t=v(v({},u),{},{apiResponse:e,success:!0,simulated:!0});d(!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(r),n={approvedData:r,userEmail:t,appName:l,confirmations:e};console.log("๐ฅ DataRequest: Making API call to:",i),console.log("๐ฅ Request body:",n);const a=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error("API request failed with status ".concat(a.status));const c=await a.json();console.log("๐ฅ API Response:",c);const m=v(v({},u),{},{apiResponse:c,success:!0});d(!1),console.log("๐ฅ DataRequest: Calling onComplete with result:",m),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(m),console.log("๐ฅ DataRequest: onComplete called successfully")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined")}catch(e){console.error("๐ฅ API Error:",e),f(e.message),d(!1);const t=v(v({},u),{},{apiResponse:null,error:e.message,success:!1});o(t)}else d(!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),f(e.message),d(!1),o&&o({error:e.message,success:!1,userEmail:t,appName:l,testMode:n})}},disabled:m||0===h},m?"Processing...":"Accept & Continue",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))),r.createElement("div",{onClick:()=>o({cancelled:!0}),className:"w-full bg-gray-200 hover:bg-gray-300 text-gray-700 rounded-full py-3 text-sm font-medium text-center cursor-pointer transition-colors"},"Decline"),p&&r.createElement("div",{className:"mt-3 p-3 rounded-lg text-center bg-red-50 border border-red-200 text-red-600"},r.createElement("p",{className:"text-xs"},p))))},C={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)"};function O(e){var t,n,o,a,l;let{onComplete:s,userEmail:i,appName:c="App",testMode:u=!0}=e;const[m,d]=(0,r.useState)(0),[p,f]=(0,r.useState)(0),[g,h]=(0,r.useState)(!1),y=[{title:"Setting up your personal AI",description:"Initializing your secure data model",icon:"๐ค",duration:u?800:2e3},{title:"Processing your connections",description:"Analyzing your social media patterns",icon:"๐",duration:u?600:2500},{title:"Training your model",description:"Building your personalized insights",icon:"๐ง ",duration:u?700:3e3},{title:"Finalizing setup",description:"Preparing your Onairos experience",icon:"โจ",duration:u?500:2e3}];return(0,r.useEffect)(()=>{let e,t;if(m<y.length){const n=y[m].duration,r=100/y.length;e=setInterval(()=>{f(e=>{const t=e+r/(n/100);return Math.min(t,(m+1)*r)})},100),t=setTimeout(()=>{if(m<y.length-1)d(e=>e+1);else{h(!0);const e=u?400:1e3;u&&console.log("๐งช Test mode: Training simulation completed"),setTimeout(()=>{s({trainingComplete:!0,timestamp:(new Date).toISOString(),userEmail:i,appName:c,testMode:u,simulatedTraining:u})},e)}},n)}return()=>{e&&clearInterval(e),t&&clearTimeout(t)}},[m,s,i,c]),r.createElement("div",{className:"w-full flex flex-col items-center space-y-8"},r.createElement("div",{className:"text-center"},r.createElement("div",{className:"w-20 h-20 rounded-full flex items-center justify-center mx-auto mb-4",style:{background:"linear-gradient(135deg, ".concat(C.info,", #8B5CF6)")}},r.createElement("div",{className:"text-3xl"},g?"๐":null===(t=y[m])||void 0===t?void 0:t.icon)),r.createElement("h2",{className:"text-2xl font-bold mb-2",style:{color:C.textPrimary}},g?"All set!":null===(n=y[m])||void 0===n?void 0:n.title),r.createElement("p",{style:{color:C.textSecondary}},g?"Your personal AI is ready to use":null===(o=y[m])||void 0===o?void 0:o.description)),r.createElement("div",{className:"w-full"},r.createElement("div",{className:"flex justify-between text-sm mb-2",style:{color:C.textSecondary}},r.createElement("span",null,"Progress"),r.createElement("span",null,Math.round(p),"%")),r.createElement("div",{className:"w-full rounded-full h-2",style:{backgroundColor:C.borderLight}},r.createElement("div",{className:"h-2 rounded-full transition-all duration-300 ease-out",style:{width:"".concat(p,"%"),background:"linear-gradient(90deg, ".concat(C.info,", #8B5CF6)")}}))),r.createElement("div",{className:"flex justify-center space-x-2"},y.map((e,t)=>r.createElement("div",{key:t,className:"w-3 h-3 rounded-full transition-all duration-300",style:{backgroundColor:t<=m?C.info:C.border}}))),r.createElement("div",{className:"p-4 rounded-lg w-full",style:{backgroundColor:C.backgroundSecondary}},r.createElement("div",{className:"flex items-center space-x-3"},r.createElement("div",{className:"w-8 h-8 rounded-full flex items-center justify-center",style:{backgroundColor:"#DBEAFE"}},r.createElement("div",{className:"text-sm"},g?"โ
":null===(a=y[m])||void 0===a?void 0:a.icon)),r.createElement("div",null,r.createElement("h3",{className:"font-medium",style:{color:C.textPrimary}},g?"Training Complete":"Step ".concat(m+1," of ").concat(y.length)),r.createElement("p",{className:"text-sm",style:{color:C.textSecondary}},g?"Your Onairos experience is ready":null===(l=y[m])||void 0===l?void 0:l.description)))),r.createElement("div",{className:"text-center"},r.createElement("p",{className:"text-sm",style:{color:C.textSecondary}},"Setting up for ",r.createElement("span",{className:"font-medium"},c)),i&&r.createElement("p",{className:"text-xs mt-1",style:{color:C.textMuted}},i)))}function S(e){let{onComplete:t}=e;const[n,o]=(0,r.useState)(0),[a,l]=(0,r.useState)(0),s=[{message:"Validating PIN and continuing training",progress:20},{message:"Uploading model to secure storage",progress:40},{message:"Running test inference",progress:60},{message:"Storing results in databases",progress:80},{message:"Complete!",progress:100}];(0,r.useEffect)(()=>{const e=setInterval(()=>{o(e=>{const n=e+1;return n>=s.length?(setTimeout(()=>{t()},1e3),e):n})},3e3);return()=>clearInterval(e)},[s.length,t]),(0,r.useEffect)(()=>{const e=setInterval(()=>{l(e=>(e+1)%4)},500);return()=>clearInterval(e)},[]);const i=s[n];return r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"px-6 pt-6 pb-4 flex-shrink-0"}),r.createElement("div",{className:"flex-1 flex flex-col justify-center items-center px-6"},r.createElement("div",{className:"text-center mb-12"},r.createElement("h1",{className:"font-bold text-gray-900 leading-tight",style:{fontSize:"clamp(16px, 4vw, 20px)",marginBottom:"clamp(24px, 6vw, 48px)"}},i.message,"Complete!"!==i.message&&r.createElement("span",{className:"inline-block w-8 text-left"},".".repeat(a))),r.createElement("div",{className:"mx-auto",style:{width:"clamp(200px, 50vw, 300px)"}},r.createElement("div",{className:"w-full h-2 bg-gray-200 rounded-full"},r.createElement("div",{className:"h-2 bg-gray-900 rounded-full transition-all duration-1000 ease-out",style:{width:"".concat(i.progress,"%")}}))))),r.createElement("div",{className:"h-20 flex-shrink-0"})))}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const I=["Analyst","Diplomat","Sentinel","Explorer","Architect","Logician","Commander","Debater","Advocate","Mediator","Protagonist","Campaigner","Logistician","Defender","Executive","Consul"],_=["Openness","Conscientiousness","Extraversion","Agreeableness","Neuroticism"];function R(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{includeDictionary:r=!0,includeArray:o=!0}=n;if(!e)return e;const a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,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(r){const e={};I.forEach((n,r)=>{e[n]=t[r]}),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)&&r){const e={};_.forEach((n,r)=>{void 0!==t[r]&&(e[n]=t[r])}),a.traitDict=e}}return a}const A=["children","title","subtitle","icon","showHeader","showCloseButton","onClose","onBack","showBackButton","className","contentClassName","centerContent","style"],L=["children","visible","onClose","onBackdropClick","backdropStyle","modalStyle"];function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(null,arguments)}function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach(function(t){D(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const z=e=>{let{children:t,title:n,subtitle:o,icon:a,showHeader:l=!0,showCloseButton:s=!1,onClose:i,onBack:c,showBackButton:u=!1,className:m="",contentClassName:d="",centerContent:p=!0,style:f={}}=e,g=T(e,A);const h=U({backgroundColor:C.background,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column"},f),y={position:"sticky",top:0,backgroundColor:C.background,zIndex:10,padding:"clamp(8px, 2vw, 16px) clamp(16px, 4vw, 32px) clamp(6px, 1.5vw, 12px)"},b=U({flex:1,padding:"clamp(16px, 4vw, 32px)",display:"flex",flexDirection:"column",overflow:"auto",minHeight:0},p&&{alignItems:"center",justifyContent:"flex-start"}),v={fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(20px, 5vw, 28px)",fontWeight:"700",color:C.textPrimary,margin:"0 0 clamp(6px, 1.5vw, 12px) 0",textAlign:p?"center":"left",lineHeight:"1.2"},x={fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(14px, 3.5vw, 18px)",fontWeight:"400",color:C.textSecondary,margin:"0 0 clamp(20px, 5vw, 40px) 0",textAlign:p?"center":"left",lineHeight:"1.5"};return r.createElement("div",B({className:"onairos-page-layout ".concat(m),style:h},g),l&&r.createElement("div",{style:y},r.createElement("div",{className:"flex items-center justify-between"},u&&c&&r.createElement("button",{onClick:c,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Go back"},r.createElement("span",{style:{fontSize:"16px",color:C.textPrimary}},"โ")),s&&i&&r.createElement("button",{onClick:i,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Close"},r.createElement("span",{style:{fontSize:"16px",color:C.textPrimary}},"ร")))),r.createElement("div",{className:"onairos-page-content ".concat(d),style:b},a&&r.createElement("div",{style:{width:"clamp(40px, 8vw, 56px)",height:"clamp(40px, 8vw, 56px)",margin:"0 auto clamp(16px, 4vw, 32px)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"clamp(20px, 5vw, 28px)"}},"string"==typeof a?r.createElement("span",null,a):a),n&&r.createElement("h1",{style:v},n),o&&r.createElement("p",{style:x},o),t))},F=e=>{let{children:t,visible:n=!0,onClose:o,onBackdropClick:a,backdropStyle:l={},modalStyle:s={}}=e,i=T(e,L);if(!n)return null;const c=U({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),u=U({backgroundColor:C.background,borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",height:"90vh",width:"100%",maxWidth:"500px",boxShadow:"0 -10px 40px rgba(0, 0, 0, 0.3)",overflow:"hidden",display:"flex",flexDirection:"column"},s);return r.createElement("div",{style:c,onClick:e=>{e.target===e.currentTarget&&(a?a():o&&o())}},r.createElement("div",{style:u},r.createElement(z,B({showHeader:!0,showCloseButton:!0,onClose:o},i),t)))};function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function H(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V(e){let{requestData:t,webpageName:n,inferenceData:a=null,onComplete:l=null,autoFetch:s=!0,testMode:i=!0,proofMode:c=!1,textLayout:m="below",textColor:d="white",login:p=!1,buttonType:f="pill",loginReturn:g=null,loginType:b="signIn",visualType:v="full",appIcon:x=null,enableTraining:w=!0,formatResponse:E=!0,responseFormat:k={includeDictionary:!0,includeArray:!0},priorityPlatform:C=null}=e;const[j,P]=(0,r.useState)(!1),[I,_]=(0,r.useState)("welcome"),[A,L]=(0,r.useState)(null),[B,M]=(0,r.useState)(null);(0,r.useEffect)(()=>{(()=>{if(i)return console.log("๐งช Test mode: Starting fresh flow, clearing any cached user data"),localStorage.removeItem("onairosUser"),void _("welcome");const e=localStorage.getItem("onairosUser");if(e)try{const t=JSON.parse(e);L(t),t.onboardingComplete&&t.pinCreated?_("dataRequest"):t.verified&&!t.onboardingComplete?_("onboarding"):t.onboardingComplete&&!t.pinCreated&&_("pin")}catch(e){console.error("Error parsing saved user data:",e),localStorage.removeItem("onairosUser")}})()},[i]);const U=()=>{P(!1),M(null)},D=()=>{console.log("๐ฅ Welcome screen continue clicked"),_("email")},T=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 n=W(W({},e),{},{verified:!0,onboardingComplete:!t,pinCreated:!t});L(n),localStorage.setItem("onairosUser",JSON.stringify(n)),t?(console.log("๐ NEW USER detected โ Starting onboarding flow (data connectors page)"),_("onboarding")):(console.log("๐ EXISTING USER detected โ Going directly to data request (data permissions page)"),_("dataRequest"))},z=e=>{console.log("Onboarding completed:",e);const t=W(W({},A),{},{onboardingComplete:!0,connectedAccounts:e.connectedAccounts||[]});L(t),localStorage.setItem("onairosUser",JSON.stringify(t)),_("pin")},q=e=>{console.log("PIN setup completed:",e);const t=W(W(W({},A),e),{},{pinCreated:!0});L(t),localStorage.setItem("onairosUser",JSON.stringify(t)),_("loading")},H=e=>{console.log("๐ Training completed:",e);const t=W(W({},A),{},{trainingCompleted:!0},e);L(t),localStorage.setItem("onairosUser",JSON.stringify(t)),_("dataRequest")},V=e=>{console.log("๐ฅ OnairosButton: Data request completed:",e);const t=W(W({},A),{},{lastDataRequest:e});L(t),localStorage.setItem("onairosUser",JSON.stringify(t)),console.log("๐ฅ Closing overlay after data request completion"),P(!1);let n=e;if(E&&null!=e&&e.apiResponse)try{var r;n=W(W({},e),{},{apiResponse:R(e.apiResponse,k)}),console.log("๐ฅ Response formatted with dictionary:",(null===(r=n.apiResponse)||void 0===r?void 0:r.personalityDict)||"No personality data")}catch(e){console.warn("๐ฅ Error formatting response:",e)}if(console.log("๐ฅ Calling onComplete callback with:",n),l)try{l(n),console.log("๐ฅ onComplete callback executed successfully")}catch(e){console.error("๐ฅ Error in onComplete callback:",e)}else console.log("๐ฅ No onComplete callback provided")},$="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===f?"px-4 py-2":"w-12 h-12"," bg-transparent OnairosConnect"),G={flexDirection:"below"===m?"column":"row",backgroundColor:"transparent",color:d,border:"1px solid transparent"},Y={width:"20px",height:"20px",marginRight:"full"===v?"12px":"0"};return r.createElement(r.Fragment,null,r.createElement("button",{className:$,onClick:async()=>{try{console.log("๐ฅ openTerminal called"),P(!0)}catch(e){console.error("Error in openTerminal:",e)}},style:G},("full"===v||"icon"===v)&&r.createElement("img",{src:p?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:Y}),"icon"!==v&&r.createElement("span",{className:"".concat("black"===d?"text-black":"text-white"," ").concat("icon"===v?"sr-only":""," ").concat("right"===m?"ml-2":"left"===m?"mr-2":"")},(()=>{switch(b){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})())),j&&r.createElement(r.Fragment,null,"email"===I?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:U,className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))),r.createElement("div",{className:"h-[min(85vh,700px)]"},r.createElement(u,{onSuccess:T,testMode:i})))):"onboarding"===I?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:()=>_("email"),className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),r.createElement(h,{onComplete:z,onBack:()=>_("email"),appIcon:x||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:n,username:(null==A?void 0:A.email)||(null==A?void 0:A.username),testMode:i,priorityPlatform:C}))):"dataRequest"===I?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:()=>_("loading"),className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),r.createElement(N,{onComplete:V,userEmail:null==A?void 0:A.email,requestData:t,appName:n,autoFetch:s,testMode:i,appIcon:x,connectedAccounts:(null==A?void 0:A.connectedAccounts)||{}}))):"pin"===I?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:()=>_("onboarding"),className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),r.createElement("div",{className:"flex-1 min-h-0"},r.createElement(y,{onComplete:q,onBack:()=>_("onboarding"),userEmail:null==A?void 0:A.email})))):"loading"===I?r.createElement(S,{onComplete:()=>{_("dataRequest")}}):r.createElement(F,{visible:j,onClose:U,showBackButton:"training"===I,onBack:()=>{"email"===I&&_("welcome"),"onboarding"===I&&_("email"),"pin"===I&&_("onboarding"),"training"===I&&_("pin")},title:(()=>{switch(I){case"welcome":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(I){case"welcome":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(n)}})(),icon:(()=>{switch(I){case"welcome":case"email":default:return"";case"onboarding":return"๐";case"pin":return"๐";case"training":return"โก";case"dataRequest":return"๐"}})(),centerContent:!0},(()=>{switch(I){case"welcome":return r.createElement(o,{onContinue:D,onClose:U,webpageName:n,appIcon:x,testMode:i});case"email":return r.createElement("div",{className:"h-[min(85vh,700px)]"},r.createElement(u,{onSuccess:T,testMode:i}));case"onboarding":return r.createElement(h,{onComplete:z,onBack:()=>_("email"),appIcon:x||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:n,username:(null==A?void 0:A.email)||(null==A?void 0:A.username),testMode:i,priorityPlatform:C});case"pin":return r.createElement(y,{onComplete:q,userEmail:null==A?void 0:A.email});case"training":return r.createElement(O,{onComplete:H,userEmail:null==A?void 0:A.email,appName:n,connectedAccounts:(null==A?void 0:A.connectedAccounts)||[],testMode:i});case"dataRequest":return r.createElement(N,{onComplete:V,userEmail:null==A?void 0:A.email,requestData:t,appName:n,autoFetch:s,testMode:i,appIcon:x,connectedAccounts:(null==A?void 0:A.connectedAccounts)||{}});default:return r.createElement("div",{className:"flex flex-col items-center space-y-4 p-6"},r.createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}),r.createElement("p",{className:"text-gray-600"},"Loading..."))}})())))}},287:(e,t)=>{var n=Symbol.for("react.element"),r=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"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,h={};function y(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||f}function b(){}function v(e,t,n){this.props=e,this.context=t,this.refs=h,this.updater=n||f}y.prototype.isReactComponent={},y.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")},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=y.prototype;var x=v.prototype=new b;x.constructor=v,g(x,y.prototype),x.isPureReactComponent=!0;var w=Array.isArray,E=Object.prototype.hasOwnProperty,k={current:null},N={key:!0,ref:!0,__self:!0,__source:!0};function C(e,t,r){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)E.call(t,o)&&!N.hasOwnProperty(o)&&(a[o]=t[o]);var i=arguments.length-2;if(1===i)a.children=r;else if(1<i){for(var c=Array(i),u=0;u<i;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(o in i=e.defaultProps)void 0===a[o]&&(a[o]=i[o]);return{$$typeof:n,type:e,key:l,ref:s,props:a,_owner:k.current}}function O(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var S=/\/+/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 i=!1;if(null===e)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case n:case r:i=!0}}if(i)return l=l(i=e),e=""===a?"."+j(i,0):a,w(l)?(o="",null!=e&&(o=e.replace(S,"$&/")+"/"),P(l,t,o,"",function(e){return e})):null!=l&&(O(l)&&(l=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(l,o+(!l.key||i&&i.key===l.key?"":(""+l.key).replace(S,"$&/")+"/")+e)),t.push(l)),1;if(i=0,a=""===a?".":a+":",w(e))for(var c=0;c<e.length;c++){var u=a+j(s=e[c],c);i+=P(s,t,o,u,l)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(s=e.next()).done;)i+=P(s=s.value,t,o,u=a+j(s,c++),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 i}function I(e,t,n){if(null==e)return e;var r=[],o=0;return P(e,r,"","",function(e){return t.call(n,e,o++)}),r}function _(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 R={current:null},A={transition:null},L={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:A,ReactCurrentOwner:k};function B(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:I,forEach:function(e,t,n){I(e,function(){t.apply(this,arguments)},n)},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(!O(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=y,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=L,t.act=B,t.cloneElement=function(e,t,r){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 i=e.type.defaultProps;for(c in t)E.call(t,c)&&!N.hasOwnProperty(c)&&(o[c]=void 0===t[c]&&void 0!==i?i[c]:t[c])}var c=arguments.length-2;if(1===c)o.children=r;else if(1<c){i=Array(c);for(var u=0;u<c;u++)i[u]=arguments[u+2];o.children=i}return{$$typeof:n,type:e.type,key:a,ref:l,props:o,_owner:s}},t.createContext=function(e){return(e={$$typeof:i,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=C,t.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=O,t.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:_}},t.memo=function(e,t){return{$$typeof:m,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=A.transition;A.transition={};try{e()}finally{A.transition=t}},t.unstable_act=B,t.useCallback=function(e,t){return R.current.useCallback(e,t)},t.useContext=function(e){return R.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return R.current.useDeferredValue(e)},t.useEffect=function(e,t){return R.current.useEffect(e,t)},t.useId=function(){return R.current.useId()},t.useImperativeHandle=function(e,t,n){return R.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return R.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return R.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return R.current.useMemo(e,t)},t.useReducer=function(e,t,n){return R.current.useReducer(e,t,n)},t.useRef=function(e){return R.current.useRef(e)},t.useState=function(e){return R.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return R.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return R.current.useTransition()},t.version="18.3.1"},540:(e,t,n)=>{e.exports=n(287)}}]);
|
|
2
|
+
//# sourceMappingURL=129.js.map
|