PageSourceSearch

https://t90-os-v1-2.base44.app/assets/NarrativeReport-D9x7xvtl.js

js t90-os-v1-2.base44.app collected 2026-10-03 03:10:06 UTC 28,031 bytes, 1 lines download raw bytes

1import{j as t,m as y,V as G,r as x,O as H,A as z,X as V,M as q,K,b as j,a as X,G as J,u as Q,q as Z,l as ee,W as te,T as B,v as se}from"./index-Bf5Dl9ga.js";import{S as ae,a as A}from"./SurfaceShell-Bz5CucKi.js";import{g as I,a as P}from"./competitionModes-BYXsrovh.js";import{g as re}from"./combinationLibrary-BIIlintS.js";import"./questionBank-wctuBAx4.js";import{g as ne}from"./identityLibrary-CkSHGOD0.js";import{S as D}from"./share-2-Bkl0jaCZ.js";import{R as ie,a as oe}from"./ReportCoachingNotes-BVEVb0C0.js";import{u as le,a as ce}from"./useFocusTrap-CaHrnhHR.js";import{M as de}from"./mail-CT8lmmUU.js";import{L as pe}from"./link-2-C1-qMpIr.js";import{D as he}from"./download-B0DemHQm.js";import{S as T}from"./SectionLabel-Bn-fEsjV.js";import{C as ue}from"./compass-COMOIurW.js";import{W as me}from"./wind-6eP9ZE9H.js";/* empty css                           */import"./user-DApmB3zf.js";import"./heart-BAYMlj8V.js";function xe(e){const a=[],s=I(e.power_source);s&&a.push({dimension:"power_source",label:"Power Source",value:s.name,description:s.definition,core_language:s.core_language,athlete_translation:s.athlete_translation_blocks[0],parent_translation:s.parent_translation_blocks[0],coach_translation:s.coach_translation_blocks[0],first_adju
1stment:s.first_adjustments[0]});const r=P(e.competition_mode);return r&&a.push({dimension:"competition_mode",label:"Competition Mode",value:r.name,description:r.definition,pressure_behavior:r.pressure_behavior,strengths:r.strengths,risks:r.risks,athlete_translation:r.athlete_translation_blocks[0],parent_translation:r.parent_translation_blocks[0],coach_translation:r.coach_translation_blocks[0]}),{fields:a}}function fe(e,a={}){var o;const s=I(e.power_source),r=P(e.competition_mode);if(!s||!r)return null;const n=re(e.power_source,e.competition_mode),i=xe(e);return{assessment_type:"aos",assessment_record_id:e.id,headline:"Your Athlete Operating System",subtext:"This is how you prepare, respond, compete, and grow.",athlete_name:a.full_name||"Athlete",sport:a.sport||"",position:a.position||"",completion_date:e.created_date||e.completed_at||new Date().toISOString(),power_source:s.name,competition_mode:r.name,opening_narrative:_e(s,r,n,i),identity_summary:be(s,r),strengths:ye(s,r),growth_edges:ge(s,r),coaching_notes:we(s),best_environment:je(s,r),under_pressure:ve(s,r,n),first_adju
1stment:(n==null?void 0:n.first_adjustment)||((o=s.first_adjustments)==null?void 0:o[0])||"",share_permission:null}}function _e(e,a,s,r){var i,o;const n=[];return s!=null&&s.athlete_summary?n.push(s.athlete_summary):n.push(e.description),r!=null&&r.that_means&&n.push(r.that_means),(i=e.athlete_translation_blocks)!=null&&i[0]&&n.push(e.athlete_translation_blocks[0]),(o=a.athlete_translation_blocks)!=null&&o[0]&&n.push(a.athlete_translation_blocks[0]),n.join(" ")}function be(e,a){var s,r,n,i;return{how_you_operate:`Your operating system runs on confidence fueled by ${e.name.toLowerCase()}. ${e.description}`,what_drives_you:e.core_language,how_you_prepare:((s=e.first_adjustments)==null?void 0:s[0])||((r=e.unlocks)==null?void 0:r[0])||"",how_you_respond_under_pressure:a.pressure_behavior,what_helps_you_grow:((n=e.unlocks)==null?void 0:n[0])||"",what_can_pull_you_off_track:((i=e.disruptors)==null?void 0:i[0])||""}}function ye(e,a){var r,n,i,o,h;const s=[];return(r=a.strengths)!=null&&r[0]&&s.push({title:a.strengths[0],body:`Under pressure, ${a.pressure_behavior.toLowerCase()} This is where your ${a.strengths[0].toLowerCase()} becomes visible.`}),s.push({title:`${e.name} as Fuel`,body:`${e.description} ${((n=e.athlete_translation_blocks)==null?void 0:n[0])||""}`.trim()}),(i=a.strengths)!=null&&i[1]&&s.push({title:a.strengths[1],body:`Your ability to ${a.strengths[1].toLowerCase()} is part of what makes you effective when the moment demands it.`}),(o=e.unlocks)!=null&&o[1]&&s.push({title:"Intentional Preparation",body:`${e.unlocks[1]} ${e.core_language}`}),(h=a.strengths)!=null&&h[2]&&s.push({title:a.strengths[2],body:`When the game is on the line, your ${a.strengths[2].toLowerCase()} gives you an edge.`}),s.slice(0,5)}function ge(e,a){var r,n,i,o,h,m,u,v;const s=[];return(r=a.risks)!=null&&r[0]&&s.push({title:O(a.risks[0]),body:`Under pressure, you may ${a.risks[0].toLowerCase()}. The next step is ${((i=(n=a.coach_translation_blocks)==null?void 0:n[0])==null?void 0:i.toLowerCase())||"building awareness of this tendency"}.`}),(o=e.disruptors)!=null&&o[0]&&s.push({title:O(e.disruptors[0]),body:`${e.disruptors[0]} ${((h=e.parent_translation_blocks)==null?void 0:h[0])||""}`.trim()}),(m=a.risks)!=null&&m[1]&&s.push({title:O(a.risks[1]),body:`Be aware that you can ${a.risks[1].toLowerCase()}. ${((u=a.athlete_translation_blocks)==null?void 0:u[0])||""}`.trim()}),(v=e.disruptors)!=null&&v[1]&&s.push({title:"Protecting Your Fuel Source",body:`${e.disruptors[1]} Your confidence depends on ${e.name.toLowerCase()}, so protecting that fuel source matters.`}),s.slice(0,4)}function we(e,a){var s,r,n;return{athlete:((s=e.athlete_translation_blocks)==null?void 0:s[0])||"",parent:((r=e.parent_translation_blocks)==null?void 0:r[0])||"",coach:((n=e.coach_translation_blocks)==null?void 0:n[0])||""}}function je(e,a){var r,n,i,o;const s=[];return s.push(`You perform best when ${((n=(r=e.unlocks)==null?void 0:r[0])==null?void 0:n.toLowerCase())||"your fuel source is supported"}.`),(i=e.unlocks)!=null&&i[1]&&s.push(e.unlocks[1]),s.push(`Under pressure, you need ${a.pressure_behavior.toLowerCase().replace(/\.$/,"")} to be channeled effectively.`),(o=a.coach_translation_blocks)!=null&&o[0]&&s.push(a.coach_translation_blocks[0]),s.join(" ")}function ve(e,a,s){var n,i;const r=[];return s!=null&&s.pressure_pattern?r.push(`When the pressure rises, ${s.pressure_pattern.toLowerCase()}`):r.push(`When the pressure rises, ${a.pressure_behavior.toLowerCase()}`),((n=a.risks)==null?void 0:n.length)>0&&r.push(`You may ${a.risks.slice(0,2).map(o=>o.toLowerCase()).join(" or ")}.`),(i=e.first_adjustments)!=null&&i[0]&&r.push(`To reset: ${e.first_adjustments[0].toLowerCase()}`),r.join(" ")}function O(e){const a=e.replace(/^(Over-?|Skipping |Carrying |Forcing |Rushing |Burning |Mistaking |Getting )/i,"");return a.charAt(0).toUpperCase()+a.slice(1)}function ke(e,a={}){var r,n;const s=ne(e.competitive_identity);return s?{assessment_type:"cos",assessment_record_id:e.id,headline:"Your Competitive Operating System",subtext:"This is how you compete, respond, and perform under pressure.",athlete_name:a.full_name||"Athlete",sport:
1a.sport||"",position:a.position||"",completion_date:e.created_date||e.completed_at||new Date().toISOString(),competitive_identity:s.display_name,opening_narrative:Ne(s),identity_summary:Ce(s),strengths:Se(s),growth_edges:$e(s),coaching_notes:Le(s),best_environment:Re(s),under_pressure:Te(s),first_adjustment:((r=s.daily_focus)==null?void 0:r[0])||((n=s.development_path)==null?void 0:n[0])||"",share_permission:null}:null}function Ne(e){const a=[e.full_description];return e.athlete_translation&&a.push(e.athlete_translation),e.short_description&&a.push(e.short_description),a.join(" ")}function Ce(e){var a,s,r;return{how_you_compete:e.short_description||e.full_description||"",how_you_respond_to_pressure:((a=e.pressure_tendencies)==null?void 0:a.join(". "))||"",how_you_build_confidence:e.athlete_translation||"",how_you_handle_mistakes:((s=e.growth_opportunities)==null?void 0:s.join(". "))||"",how_coaches_should_communicate:e.coach_translation||"",what_unlocks_your_best_performance:((r=e.ideal_environment)==null?void 0:r.join(", "))||""}}function Se(e){var s;const a=[];return(e.competitive_strengths||[]).slice(0,3).forEach((r,n)=>{const i=[e.full_description,e.athlete_translation,`Your ${r.toLowerCase()} is part of what makes you effective in competition.`];a.push({title:r,body:i[n%i.length]})}),(s=e.leadership_characteristics)!=null&&s[0]&&a.push({title:e.leadership_characteristics[0],body:`${e.full_description} You ${e.leadership_characteristics[0].toLowerCase()}.`}),a.slice(0,5)}function $e(e){var s,r,n;const a=[];return(e.growth_opportunities||[]).slice(0,2).forEach(i=>{a.push({title:i,body:`${i}. ${e.athlete_translation||""}`.trim()})}),(s=e.pressure_tendencies)!=null&&s[0]&&a.push({title:Ae(e.pressure_tendencies[0]),body:`Under pressure, you ${e.pressure_tendencies[0].toLowerCase()}. ${((r=e.development_path)==null?void 0:r[0])||""}`.trim()}),(n=e.common_misalignments)!=null&&n[0]&&a.push({title:"Avoiding Misalignment",body:`${e.common_misalignments[0]}. ${e.parent_translation||""}`.trim()}),a.slice(0,4)}function Le(e){return{athlete:e.athlete_translation||"",parent:e.parent_translation||"",coach:e.coach_translation||""}}function Re(e){var s,r;const a=[];return((s=e.ideal_environment)==null?void 0:s.length)>0&&a.push(`You perform best in an environment with ${e.ideal_environment.map(n=>n.toLowerCase()).join(", ")}.`),a.push(e.full_description),((r=e.practice_focus)==null?void 0:r.length)>0&&a.push(`Your training thrives on ${e.practice_focus.map(n=>n.toLowerCase()).join(" and ")}.`),a.join(" ")}function Te(e){var s,r,n;const a=[];return((s=e.pressure_tendencies)==null?void 0:s.length)>0&&a.push(`When pressure rises, you ${e.pressure_tendencies.map(i=>i.toLowerCase()).join(" and ")}.`),((r=e.growth_opportunities)==null?void 0:r.length)>0&&a.push(`To reset: ${e.growth_opportunities[0].toLowerCase()}.`),((n=e.practice_focus)==null?void 0:n.length)>0&&a.push(`Your reset routine involves ${e.practice_focus.map(i=>i.toLowerCase()).join(" and ")}.`),a.join(" ")}function Ae(e){const a=e.replace(/^(Can |May )/i,"");return a.charAt(0).toUpperCase()+a.slice(1)}const Oe="https://media.base44.com/images/public/6a468988fb60bd0c7961e4d8/0bbbb83d4_Logo_A.svg";function Ee({report:e,onShare:a}){var i;const s=e.report_data||e,r=s.completion_date?new Date(s.completion_date).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}):"—",n=s.assessment_type==="aos"?"Athlete Operating System":"Competitor Operating System";return t.jsxs(y.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4},className:"rounded-[24px] overflow-hidden border border-white/[0.08] t90-metal-card",children:[t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 bg-primary/8 border-b border-white/[0.06]",children:[t.jsx("span",{className:"text-[9px] font-heading font-bold text-primary tracking-[0.2em] uppercase",children:"T90 Identity Report"}),t.jsx("img",{src:Oe,alt:"T90",className:"w-5 h-5",style:{mixBlendMode:"screen"}})]}),t.jsxs("div",{className:"px-5 pt-6 pb-6",children:[t.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-white/[0.05] border border-primary/30 flex items-center justify-center flex-shrink-0",children:t.jsx("span",{className:"text-[18px] font-heading font-bold text-white/80",children:(((i=s.athlete_name)==null?void 0:i[0])||"A").toUpperCase()})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-[18px] font-heading font-bold text-white uppercase leading-tight line-clamp-2",children:s.athlete_name||"Athlete"}),t.jsxs("p",{className:"text-[11px] font-body text-white/45 mt-0.5",children:[s.sport||"Athlete",s.position?` · ${s.position}`:""]})]})]}),t.jsx("h1",{className:"text-[26px] font-heading font-extrabold text-white uppercase leading-[1.1] tracking-tight mb-2",children:s.headline}),t.jsx("p",{className:"text-[14px] font-body font-light text-white/55 leading-[1.6] mb-5",children:s.subtext}),t.jsxs("div",{className:"grid grid-cols-2 gap-px bg-white/[0.04] rounded-[12px] overflow-hidden mb-5",children:[t.jsx(L,{label:"Assessment",value:n}),t.jsx(L,{label:"Completed",value:r}
1),t.jsx(L,{label:"Report Version",value:`v${s.report_version||1}`}),t.jsx(L,{label:"Type",value:s.assessment_type==="aos"?"Who am I?":"How do I compete?"})]}),a&&t.jsxs("button",{onClick:a,className:"w-full flex items-center justify-center gap-2 text-white font-heading font-bold text-[14px] rounded-2xl py-3.5 min-h-[50px] t90-cta-glow bg-primary active:scale-[0.98] transition-transform",children:[t.jsx(D,{className:"w-4 h-4",strokeWidth:2.5}),"Share This Report"]})]})]})}function L({label:e,value:a}){return t.jsxs("div",{className:"bg-card px-4 py-3",children:[t.jsx("p",{className:"text-[9px] font-heading font-bold text-white/30 tracking-[0.12em] uppercase",children:e}),t.jsx("p",{className:"text-[12px] font-body font-medium text-white/80 mt-0.5 line-clamp-2",children:a})]})}const Ue=[{key:"full",label:"Full Report",description:"Everything in the report"},{key:"coach",label:"Coach Summary",description:"Coach-facing notes only"},{key:"parent",label:"Parent Summary",description:"Parent-facing notes only"},{key:"athlete",label:"Athlete Summary",description:"Athlete-facing notes only"}];function Ye({open:e,onClose:a,report:s}){const{toast:r}=G(),[n,i]=x.useState("full"),[o,h]=x.useState(""),[m,u]=x.useState(!1),[v,f]=x.useState(!1),N=le(e);if(ce(e),x.useEffect(()=>{if(!e)return;const c=l=>{l.key==="Escape"&&a()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[e,a]),!s)return null;const d=s.report_data||s,g=s.id,C=d.athlete_name||"Athlete",w=d.assessment_type==="aos"?"AOS":"COS",_=()=>{f(!1),h(""),a()},b=async()=>{var l;return((l=(await j.functions.invoke("generateNarrativeReport",{action:"update_share",report_id:g,share_permission:n})).data)==null?void 0:l.share_url)||`${window.location.origin}/report/${g}`},S=async()=>{var c;if(!o||!o.includes("@")){r({title:"Enter a valid email address",variant:"destructive"});return}u(!0);try{const l=await j.functions.invoke("shareReport",{report_id:g,share_permission:n,send_method:"email",recipient_email:o.trim()}),p=l==null?void 0:l.data;p!=null&&p.sent?f(!0):p!=null&&p.unregistered_recipient?r({title:"Couldn't deliver the email",description:"That address isn't a registered T90 user yet and Resend isn't configured. Copy the link instead, or ask them to join T90 first.",variant:"destructive"}):r({title:"Couldn't deliver the email",description:(p==null?void 0:p.error)||"Something went wrong. Try copying the link instead.",variant:"destructive"})}catch(l){r({title:"Unable to send email",description:((c=l==null?void 0:l.data)==null?void 0:c.error)||(l==null?void 0:l.message)||"Please try again.",variant:"destructive"})}finally{u(!1)}},U=async()=>{var c;u(!0);try{const l=await j.functions.invoke("shareReport",{report_id:g,share_permission:n,send_method:"text"}),p=l==null?void 0:l.data,k=(p==null?void 0:p.text)||`${C} shared their T90 ${w} Report with you: ${p==null?void 0:p.share_url}`,Y=o&&!o.includes("@")?o.replace(/[^0-9+]/g,""):"",M=Y?`sms:${Y}?body=${encodeURIComponent(k)}`:`sms:?body=${encodeURIComponent(k)}`;try{await navigator.clipboard.writeText(k)}catch{}try{window.location.href=M}catch{}r({title:"Message ready to send",description:"We opened your texting app with the message — just choose a recipient and send. (It's also copied in case you need to paste it.)"}),f(!0)}catch(l){r({title:"Unable to share",description:((c=l==null?void 0:l.data)==null?void 0:c.error)||(l==null?void 0:l.message)||"Please try again.",variant:"destructive"})}finally{u(!1)}},$=async()=>{u(!0);try{const c=await b();await navigator.clipboard.writeText(c),r({title:"Link copied to clipboard"}),f(!0)}catch{r({title:"Unable to copy link",variant:"destructive"})}finally{u(!1)}};return H.createPortal(t.jsx(z,{children:e&&t.jsx(y.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},onClick:_,className:"fixed inset-0 z-[60] bg-black/70 backdrop-blur-sm flex items-end sm:items-center justify-center p-0 sm:p-4",children:t.jsxs(y.div,{ref:N,role:"dialog","aria-modal":"true","aria-labelledby":"report-share-title","aria-describedby":"report-share-desc",tabIndex:-1,initial:{y:"100%",opacity:0},animate:{y:0,opacity:1},exit:{y:"100%",opacity:0},transition:{type:"spring",damping:30,stiffness:300},onClick:c=>c.stopPropagation(),className:"w-full max-w-md max-h-[92vh] rounded-t-[28px] sm:rounded-[28px] flex flex-col",style:{background:"linear-gradient(180deg, #12161B 0%, #090B0E 100%)",border:"1px solid rgba(255,255,255,0.08)",boxShadow:"0 -20px 60px rgba(0,0,0,0.5)"},children:[t.jsxs("div",{className:"flex justify-center pt-3 pb-1 relative flex-shrink-0",children:[t.jsx("div",{className:"w-10 h-1 rounded-full bg-white/15"}),t.jsx("button",{onClick:_,"aria-label":"Close share dialog",className:"absolute top-3 right-4 w-8 h-8 rounded-lg bg-white/[0.06] flex items-center justify-center",children:t.jsx(V,{className:"w-4 h-4 text-white/60",strokeWidth:2.5})})]}),t.jsx("div",{className:"overflow-y-auto overscroll-contain px-5 pb-10 pt-2 safe-bottom no-scrollbar",children:v?t.jsx(We,{onClose:_}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(D,{className:"w-4 h-4 text-primary",strokeWidth:2.5}),t.jsx("h3",{id:"report-share-title",className:"text-[18px] font-heading font-bold text-white uppercase",children:"Share Your T90 Report"})]}),t.jsx("p",{id:"report-share-desc",className:"text-[13px] font-body text-white/55 leading-[1.55] mb-5",children:"Choose who can view this report. You are in control of what you share."}),t.jsx("div",{className:"space-y-2 mb-5",children:Ue.map(c=>t.jsx(Be,{opt:c,selected:n===c.key,onSelect:()=>i(c.key)},c.key))}),t.jsx("input",{type:"text",value:o,onChange:c=>h(c.target.value),placeholder:"Email or phone number (optional for link)",className:"w-full rounded-[12px] bg-white/[0.04] border border-white/[0.08] px-4 py-3 text-[13px] font-body text-white placeholder:text-white/30 outline-none focus:border-primary/40 mb-5"}),t.jsxs("div",{className:"space-y-2.5",children:[t.jsx(R,{icon:de,label:"Share by Email",onClick:S,disabled:m||!o||!o.includes("@"),loading:m}),t.jsx(R,{icon:q,label:"Share by Text",onClick:U,disabled:m,loading:m}),t.jsx(R,{icon:pe,label:"Copy Link",onClick:$,disabled:m,loading:m}),t.jsx(R,{icon:he,label:"Download PDF",onClick:()=>{_(),setTimeout(()=>window.print(),300)},disabled:m,loading:!1})]}),t.jsxs("div",{className:"flex items-start gap-2 mt-5",children:[t.jsx(K,{className:"w-3 h-3 text-white/30 mt-0.5 flex-shrink-0",strokeWidth:2.5}),t.jsx("p",{className:"text-[10px] font-body text-white/35 leading-[1.5]",children:"Only the sections you choose will be visible. You can revoke access anytime by changing the permission."})]})]})})]})})}),document.body)}function Be({opt:e,selected:a,onSelect:s}){return t.jsxs("button",{onClick:s,className:`w-full flex items-center gap-3 rounded-[12px] px-4 py-3 border transition-all ${a?"border-primary/40 bg-primary/[0.06]":"border-white/[0.06] bg-white/[0.02]"}`,children:[t.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center flex-shrink-0 ${a?"border-primary":"border-white/20"}`,children:a&&t.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-primary"})}),t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx("p",{className:`text-[13px] font-heading font-bold ${a?"text-white":"text-white/70"}`,children:e.label}),t.jsx("p",{className:"text-[10px] font-body text-white/40",children:e.description})]})]})}function R({icon:e,label:a,onClick:s,disabled:r,loading:n}){return t.jsxs("button",{onClick:s,disabled:r,className:"w-full flex items-center justify-center gap-2 text-white font-heading font-semibold text-[14px] rounded-2xl py-3.5 min-h-[48px] bg-white/[0.05] border border-white/[0.1] hover:bg-white/[0.08] active:scale-[0.98] transition-all disabled:opacity-40",children:[t.jsx(e,{className:"w-4 h-4 text-white/70",strokeWidth:2.5}),n?"Sharing...":a]})}function We({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center text-center py-8",children:[t.jsx("div",{className:"w-14 h-14 roun
1ded-full bg-[#2DBA7A]/15 flex items-center justify-center mb-4",children:t.jsx(X,{className:"w-7 h-7 text-[#2DBA7A]",strokeWidth:2.5})}),t.jsx("h3",{className:"text-[18px] font-heading font-bold text-white uppercase mb-2",children:"Report Shared"}),t.jsx("p",{className:"text-[13px] font-body text-white/55 leading-[1.6] mb-6 max-w-xs",children:"Your report has been shared with the permission level you selected. The recipient will receive a secure link to view it."}),t.jsx("button",{onClick:e,className:"inline-flex items-center justify-center gap-2 text-white font-heading font-semibold text-[14px] rounded-full px-7 py-3 t90-cta-glow bg-primary active:scale-[0.98] transition-transform",children:"Done"})]})}function rt(){const{type:e}=J(),a=Q(),s=Z("/identity"),{user:r}=ee(),[n,i]=x.useState(null),[o,h]=x.useState(!0),[m,u]=x.useState(null),[v,f]=x.useState(!1),N=x.useCallback(async()=>{h(!0),u(null);try{const g=e==="aos"?"AthleteOperatingSystem":"CompetitiveOperatingSystem",C=await j.entities[g].list("-created_date",1),w=C==null?void 0:C[0];if(!w){u("no_assessment"),h(!1);return}const _=await j.entities.AthleteProfile.list("-created_date",1),b=_==null?void 0:_[0],S={full_name:(r==null?void 0:r.full_name)||"Athlete",sport:(b==null?void 0:b.sport)||"",position:(b==null?void 0:b.position)||""},$=(await j.entities.GeneratedReport.filter({owner_user_id:r.id},"-created_date",200)||[]).find(p=>{var k;return((k=p.report_data)==null?void 0:k.assessment_record_id)===w.id});if($){i($),h(!1);return}const c=e==="aos"?fe(w,S):ke(w,S);if(!c){u("build_failed"),h(!1);return}const l=await j.functions.invoke("generateNarrativeReport",{assessment_type:e,report_data:c,assessment_record_id:w.id});i(l.data)}catch{u("load_failed")}finally{h(!1)}},[e,r]);if(x.useEffect(()=>{N()},[N]),o)return t.jsx(ae,{family:"identity",label:"Preparing your report..."});if(m==="no_assessment")return t.jsxs(A,{family:"identity",bare:!0,children:[t.jsx("div",{className:"sticky top-0 z-30 bg-background border-b border-white/[0.06] px-5 py-3 safe-top",children:t.jsx(E,{onClick:s})}),t.jsxs("div",{className:"px-5 py-8 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-[20px] bg-white/[0.05] flex items-center justify-center mx-auto mb-4",children:t.jsx(te,{className:"w-7 h-7 text-white/40",strokeWidth:1.75})}),t.jsxs("h3",{className:"text-[18px] font-heading font-bold text-white mb-2",children:["No ",e==null?void 0:e.toUpperCase()," Assessment Found"]}),t.jsxs("p",{className:"text-[14px] font-body text-white/56 leading-[1.6] mb-6 max-w-xs mx-auto",children:["Complete your ",e==null?void 0:e.toUpperCase()," assessment to generate your narrative identity report."]}),t.jsxs("button",{onClick:()=>a(`/assessment/${e}`),className:"inline-flex items-center gap-2 text-white font-heading font-semibold text-[15px] rounded-full px-7 py-3 t90-cta-glow bg-primary active:scale-[0.98] transition-transform",children:["Take ",e==null?void 0:e.toUpperCase()," Assessment"]})]})]});if(m||!n)return t.jsxs(A,{family:"identity",bare:!0,children:[t.jsx("div",{className:"sticky top-0 z-30 bg-background border-b border-white/[0.06] px-5 py-3 safe-top",children:t.jsx(E,{onClick:s})}),t.jsxs("div",{className:"px-5 py-8 text-center",children:[t.jsx("p",{className:"text-[14px] font-body text-white/56",children:"Unable to load report. Please try again."}),t.jsx("button",{onClick:N,className:"mt-4 text-primary font-heading font-bold text-[13px] uppercase",children:"Retry"})]})]});const d=n.report_data||n;return t.jsxs(A,{family:"identity",bare:!0,children:[t.jsx("div",{className:"sticky top-0 z-30 bg-background border-b border-white/[0.06] px-5 py-3 safe-top",children:t.jsx(E,{onClick:()=>a("/identity")})}),t.jsxs("div",{className:"px-5 pt-5 pb-10 space-y-1",children:[t.jsx(Ee,{report:n,onShare:()=>f(!0)}),d.opening_narrative&&t.jsxs("div",{className:"mt-6 px-5",children:[t.jsx(T,{label:"Opening Narrative"}),t.jsx(y.div,{initial:{opacity:0,y:14},animate:{opacity:1,y:0},transition:{duration:.35},className:"rounded-[20px] p-5 border border-primary/15 bg-primary/[0.03]",children:t.jsx("p",{className:"text-[15px] font-body font-light text-white/85 leading-[1.7] italic",children:d.opening_narrative})})]}),d.identity_summary&&t.jsx(Ie,{summary:d.identity_summary,type:d.assessment_type}),t.jsx(ie,{strengths:d.strengths,growthEdges:d.growth_edges}),d.coaching_notes&&t.jsx(oe,{notes:d.coaching_notes}),d.best_environment&&t.jsx(W,{icon:ue,label:"Best Environment",body:d.best_environment,accent:"#5B8DB8"}),d.under_pressure&&t.jsx(W,{icon:me,label:"Under Pressure",body:d.under_pressure,accent:"#F59E0B"}
1),d.first_adjustment&&t.jsxs("div",{className:"mt-6 px-5",children:[t.jsx(T,{label:"First Adjustment"}),t.jsx(y.div,{initial:{opacity:0,y:14},animate:{opacity:1,y:0},transition:{duration:.35},className:"rounded-[20px] p-5 border border-primary/20 bg-primary/[0.05]",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx(B,{className:"w-4 h-4 text-primary",strokeWidth:2.5})}),t.jsx("p",{className:"text-[14px] font-body font-medium text-white/85 leading-[1.6]",children:d.first_adjustment})]})})]}),t.jsx("div",{className:"mt-8 px-5",children:t.jsxs(y.button,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},onClick:()=>f(!0),className:"w-full flex items-center justify-center gap-2 text-white font-heading font-bold text-[15px] rounded-2xl py-4 min-h-[54px] t90-cta-glow bg-primary active:scale-[0.98] transition-transform",children:[t.jsx(B,{className:"w-4 h-4",strokeWidth:2.5}),"Share This Report"]})})]}),t.jsx(Ye,{open:v,onClose:()=>f(!1),report:n})]})}function E({onClick:e}){return t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:e,className:"w-9 h-9 rounded-xl bg-white/[0.05] flex items-center justify-center flex-shrink-0 active:scale-95 transition-transform","aria-label":"Back to Identity",children:t.jsx(se,{className:"w-4 h-4 text-white",strokeWidth:2.5})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h1",{className:"text-[15px] font-heading font-bold text-white leading-tight",children:"Narrative Identity Report"}),t.jsx("p",{className:"text-[10px] font-body text-white/48",children:"Your shareable T90 profile"})]})]})}function Ie({summary:e,type:a}){const s=a==="aos"?[{label:"How You Operate",key:"how_you_operate"},{label:"What Drives You",key:"what_drives_you"},{label:"How You Prepare",key:"how_you_prepare"}
1,{label:"Under Pressure",key:"how_you_respond_under_pressure"},{label:"What Helps You Grow",key:"what_helps_you_grow"},{label:"What Can Pull You Off Track",key:"what_can_pull_you_off_track"}]:[{label:"How You Compete",key:"how_you_compete"},{label:"Responding to Pressure",key:"how_you_respond_to_pressure"},{label:"Building Confidence",key:"how_you_build_confidence"},{label:"Handling Mistakes",key:"how_you_handle_mistakes"},{label:"Coach Communication",key:"how_coaches_should_communicate"},{label:"What Unlocks Your Best",key:"what_unlocks_your_best_performance"}];return t.jsxs("div",{className:"mt-6 px-5",children:[t.jsx(T,{label:"Identity Summary"}),t.jsx("div",{className:"space-y-2.5",children:s.map(r=>{const n=e==null?void 0:e[r.key];return n?t.jsxs(y.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"rounded-[12px] bg-white/[0.03] border border-white/[0.04] px-4 py-3",children:[t.jsx("p",{className:"text-[9px] font-heading font-bold text-white/35 tracking-[0.12em] uppercase mb-1",children:r.label}),t.jsx("p",{className:"text-[12px] font-body text-white/75 leading-[1.55]",children:n})]},r.key):null})})]})}function W({icon:e,label:a,body:s,accent:r}){return t.jsxs("div",{className:"mt-6 px-5",children:[t.jsx(T,{label:a}),t.jsx(y.div,{initial:{opacity:0,y:14},animate:{opacity:1,y:0},transition:{duration:.35},className:"t90-card p-5",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{backgroundColor:`${r}20`},children:t.jsx(e,{className:"w-4 h-4",strokeWidth:2.5,style:{color:r}})}),t.jsx("p",{className:"text-[13px] font-body font-light text-white/75 leading-[1.65]",children:s})]})})]})}export{rt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.